query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
GET /reviews/new GET /reviews/new.json
def new @product = Product.new respond_to do |format| format.html #If it's a html request this line tell rails to look for new_release.html.erb in your views directory format.js #If it's a js request this line tell rails to look for new_release.js.erb in your views directory end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @new_review = NewReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = @place.reviews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = reviewable.reviews.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = current_user.reviews.new\n 1.times { @review.review_photos.build }\n @place = Place.first\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @book_review = BookReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_review }\n end\n end", "def new\n\t\t@review = Review.new\n\tend", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review }\n end\n end", "def new\n @review = Review.new\n end", "def new\n @review = Review.new\n end", "def new\n @review = Review.new\n end", "def new\n @review = Review.new\n end", "def new\n @review = Review.new\n end", "def new\n @review = Review.new\n end", "def new\n @review = Review.new\n end", "def new\n @review = Review.new\n end", "def new\n\t\t@review = Review.new\n\t\[email protected] = Establishment.new\n\t\[email protected] = Category.new\n\t\[email protected] = Clientele.new\n\t\[email protected]_level = SoundLevel.new\n\t\[email protected] = Hygiene.new\n\t\[email protected] = Rating.new\n\t\t\n\t\tcollect_additional_params()\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @review }\n\t\tend\n\tend", "def new\n\t\t@book_review = BookReview.new\n\t\t@book_review.user_id = current_user.id\n\t\t@book_review.book_id = params[:book_id]\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render :json => @book_review }\n\t\tend\n\tend", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end", "def new\n # this is the form for adding a new review\n # once we generated the model \"Review\", using the variable we are adding a form to feed into the db\n @review = Review.new\n end", "def create\n @review = Review.new(params[:review])\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @bollywood_review = BollywoodReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bollywood_review }\n end\n end", "def create\n @review = current_author.reviews.create(review_params)\n render json: @review, status: 201\n end", "def new\n @rating_alt = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating_alt }\n end\n end", "def new\n @comment = Comment.new\n if params[:recipe] != nil\n @recipe = Recipe.find(params[:recipe].to_i)\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render action: 'show', status: :created, location: @review }\n else\n format.html { render action: 'new' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @review_image = ReviewImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review_image }\n end\n end", "def new\n @review = Review.new\nend", "def create\n review = course.reviews.new(review_params)\n \n if review.save\n render json: ReviewSerializer.new(review).serialized_json\n else\n render json: { error: review.errors.messages }, status: 422\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.save\n render json: @review, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.save\n render json: @review, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.save\n render json: @review, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @review = Review.new(review_params)\n if @review.save\n redirect_to reviews_path\n else\n render 'new'\n end\n end", "def new\n # any registered user can add a location\n unless current_user.is_general_user?\n redirect_to denied_path\n return\n end\n\n @review = Review.new\n logger.info \"review.new params: \" + params.inspect\n if params[:dish_id]\n @dish = Dish.find(params[:dish_id])\n else\n @dish = current_dish\n end\n @review.dish_id = @dish.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review }\n end\n end", "def new\n @title = t 'conclusion_draft_review.new_title'\n @conclusion_draft_review =\n ConclusionDraftReview.new(review_id: params[:review])\n\n @conclusion_draft_review.review&.build_best_practice_comments\n\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.erb\n end\n end", "def create\n @review = reviewable.reviews.build(params[:review])\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to reviewable_review_url(reviewable, @review), notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n\t\tif !authenticate_user!(\"You must be logged in to write a review. Login now or sign up!\", true) \n\t\t\treturn \n\t\tend\t\t\n\t\t@store_review = @store.store_reviews.build\t\t\n\t\trender layout: false\t\t\n\tend", "def new\n @reviewable_object = current_user.reviewable_objects.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reviewable_object }\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@review = Review.new(review_params)\n\t\[email protected]_id = current_user.id\n\t\trespond_to do |format|\n\t\t\tif @review.save\n\t\t\t\t@reviews = Review.order(:heading).paginate(page: params[:page], per_page: 18)\n\t\t\t\tformat.html { redirect_to @review; flash[:success]= 'review was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @review }\n\t\t\t\tformat.js\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @review.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n\t\t\tend\n\t\tend\n\tend", "def create\n @review = Review.new(review_params)\n current_user.reviews << @review\n respond_to do |format|\n if @review.save\n format.json { render :show, status: :created, location: @review }\n else\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @reviewer = Reviewer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reviewer }\n end\n end", "def create\n @user = current_user\n @review = @user.reviews.build(review_params)\n if @user.save\n render json: @review\n end\n end", "def new\n load_data\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def create\n #binding.pry\n review = Review.new(review_params) \n if review.save\n render json: ReviewSerializer.new(review)\n else\n render json: {errors: review.errors.full_messages}\n end\n end", "def new\n @prefer = Prefer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prefer }\n end\n end", "def new\n @venue_review = @venue.venue_reviews.new\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @venue_review }\n end\n end", "def new\n @review_type = ReviewType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review_type }\n end\n end", "def new\n member = Review.new\n end", "def new\n @interview = Interview.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interview }\n end\n end", "def create\n\t\treview = Review.create(:user_id=>params[:review][:user_id], :note_id=>params[:review][:note_id], :status=>params[:review][:status])\n\t\treview.save!\n\n render json: []\n\tend", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @business = Business.find(params[:business_id])\n @review = @business.reviews.build(review_params)\n end", "def new\n @discount = Discount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discount }\n end\n end", "def new\n @discount = Discount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discount }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @comment }\n end\n end", "def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @comment }\n end\n end", "def create\n\t\t@book_review = BookReview.new(params[:book_review])\n\t\t@book_review.user_id = current_user.id\n\t\t@book_review.book_id = params[:book_id]\n\n\t\trespond_to do |format|\n\t\t\tif @book_review.save\n\t\t\t\tformat.html { redirect_to @book_review, :notice => 'Book review was successfully created.' }\n\t\t\t\tformat.json { render :json => @book_review, :status => :created, :location => @book_review }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.json { render :json => @book_review.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def new\n\t\t@review = Review.new\n\t\t@trip_id = params[:trip_id]\n\t\t# @review.trip_id = @trip_id\n\tend", "def create\n if current_user\n @review = current_user.reviews.build(params[:review])\n\n respond_to do |format|\n if @review.save\n flash[:success] = 'Запись успешно добавлена!'\n format.html { redirect_to reviews_path }\n format.json { render json: @review, status: :created, location: reviews_path }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:error] = 'Вы должны войти в систему!'\n redirect_to root_path\n end\n end", "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end", "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end", "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end", "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end", "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end", "def new\n @comment = @posting.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def new\n @comment = @commentable.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment }\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to dashboard_path, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @paragraph_rating = ParagraphRating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paragraph_rating }\n end\n end", "def new\n @title = \"New Book\"\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end", "def create\n @review = Review.new(review_params)\n\[email protected]_id = current_user.id\n\t\n\t# used for partials rendering in SPA\n\t@site = Site.find(@review.site_id)\n\t@sites = Site.all\n\t@reviews = Review.where(site_id: @site.id).order(\"created_at DESC\")\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n\t\tformat.js\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n\t\tformat.js { render 'shared/errors' }\n end\n end\n end", "def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end", "def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end", "def new\n @proposal = Proposal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end", "def new\n @comment_vote = CommentVote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment_vote }\n end\n end", "def new\n @comment_vote = CommentVote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment_vote }\n end\n end", "def new\n @comment_vote = CommentVote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comment_vote }\n end\n end", "def new\n @collection = current_user.collections.find(params[:collection_id]) \n @recommender = @collection.recommenders.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recommender }\n end\n end", "def create\n @review = @publication.reviews.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review.publication, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @recommend = Recommend.new\n\n respond_to do |format|\n format.html\n format.json { render json: @recommend }\n end\n end" ]
[ "0.81673604", "0.784093", "0.784093", "0.784093", "0.784093", "0.784093", "0.784093", "0.78267056", "0.77887195", "0.7446452", "0.72677046", "0.7107704", "0.7100102", "0.7100102", "0.7013424", "0.7013424", "0.7013424", "0.7013424", "0.7013424", "0.7013424", "0.7013424", "0.7013424", "0.70130605", "0.69590384", "0.6907051", "0.6907051", "0.6907051", "0.6898528", "0.6897657", "0.68662405", "0.6825497", "0.68069816", "0.67956775", "0.6774486", "0.6772904", "0.67717475", "0.67687666", "0.67642057", "0.67642057", "0.67642057", "0.67619723", "0.6756937", "0.6746994", "0.6720731", "0.67205596", "0.6714615", "0.67091465", "0.67091465", "0.66860205", "0.66612136", "0.66163266", "0.66135037", "0.6605478", "0.66033787", "0.6592911", "0.65914476", "0.65712595", "0.6546554", "0.6536917", "0.6527558", "0.65273815", "0.65273815", "0.65273815", "0.65273815", "0.65273815", "0.65273815", "0.65273815", "0.65273815", "0.65273815", "0.65273815", "0.65273815", "0.65273815", "0.6511308", "0.65057075", "0.65057075", "0.6504847", "0.64941376", "0.64941376", "0.64940876", "0.6487354", "0.6474608", "0.64668554", "0.64668554", "0.64668554", "0.64668554", "0.64668554", "0.64645934", "0.6456543", "0.6455733", "0.6452811", "0.64497054", "0.64462537", "0.6444175", "0.6444175", "0.6444175", "0.6432743", "0.6432743", "0.6432743", "0.64149547", "0.64136285", "0.64131933" ]
0.0
-1
POST /reviews POST /reviews.json
def create @product = Product.new(myparams) respond_to do |format| if @product.save format.html {redirect_to @product, notice: 'Product was successfully created.'} else format.html { render action: "new" } format.json { render json: @product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @review = current_author.reviews.create(review_params)\n render json: @review, status: 201\n end", "def create\n review = course.reviews.new(review_params)\n \n if review.save\n render json: ReviewSerializer.new(review).serialized_json\n else\n render json: { error: review.errors.messages }, status: 422\n end\n end", "def create\n @user = current_user\n @review = @user.reviews.build(review_params)\n if @user.save\n render json: @review\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.save\n render json: @review, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.save\n render json: @review, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.save\n render json: @review, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @review = Review.new(review_params)\n current_user.reviews << @review\n respond_to do |format|\n if @review.save\n format.json { render :show, status: :created, location: @review }\n else\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = reviewable.reviews.build(params[:review])\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to reviewable_review_url(reviewable, @review), notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(params[:review])\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@review = Review.new(review_params)\n\t\[email protected]_id = current_user.id\n\t\trespond_to do |format|\n\t\t\tif @review.save\n\t\t\t\t@reviews = Review.order(:heading).paginate(page: params[:page], per_page: 18)\n\t\t\t\tformat.html { redirect_to @review; flash[:success]= 'review was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @review }\n\t\t\t\tformat.js\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @review.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n\t\t\tend\n\t\tend\n\tend", "def create\n @review = @post.reviews.where(user_id: current_user.id).create(params[:review])\n respond_with @post, @review, location: post_path(@post, anchor: \"review_#{@review.id}\")\n end", "def create\n #binding.pry\n review = Review.new(review_params) \n if review.save\n render json: ReviewSerializer.new(review)\n else\n render json: {errors: review.errors.full_messages}\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render action: 'show', status: :created, location: @review }\n else\n format.html { render action: 'new' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_review(booking, options = {})\n post(\"bookings/#{booking}/reviews\", reviews: [options]).pop\n end", "def create\n\t\treview = Review.create(:user_id=>params[:review][:user_id], :note_id=>params[:review][:note_id], :status=>params[:review][:status])\n\t\treview.save!\n\n render json: []\n\tend", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to dashboard_path, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n @review.user = current_user\n\n if @review.save\n render :show, status: :created, location: @review\n else\n render json: { Error: @review.errors }, status: :unprocessable_entity\n end\n end", "def new\n @review = reviewable.reviews.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def create\n @review = current_user.reviews.build(review_params)\n \n if @review.save\n flash[:success] = 'レビューを投稿しました。'\n redirect_to root_url\n else\n @reviews = current_user.reviews.order(id: :desc).page(params[:page])\n flash.now[:danger] = 'レビューの投稿に失敗しました。'\n render '/reviews'\n end\n end", "def create\n @review = Review.new(review_params)\n if @review.save\n redirect_to reviews_path\n else\n render 'new'\n end\n end", "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def create\n @review = @publication.reviews.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review.publication, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reviews_and_rating = ReviewsAndRating.new(reviews_and_rating_params)\n\n respond_to do |format|\n if @reviews_and_rating.save\n format.html { redirect_to @reviews_and_rating, notice: 'Reviews and rating was successfully created.' }\n format.json { render :show, status: :created, location: @reviews_and_rating }\n else\n format.html { render :new }\n format.json { render json: @reviews_and_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if !!@review && current_user\n current_user.reviews << @review\n @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n # TODO redirect to page that shows what their review will look like. \n format.html { redirect_to thanks_path, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: \"レビューが作成されました\" }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user\n @review = current_user.reviews.build(params[:review])\n\n respond_to do |format|\n if @review.save\n flash[:success] = 'Запись успешно добавлена!'\n format.html { redirect_to reviews_path }\n format.json { render json: @review, status: :created, location: reviews_path }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:error] = 'Вы должны войти в систему!'\n redirect_to root_path\n end\n end", "def create\n @review = Review.new(review_params)\n respond_to do |format|\n if Review.validate(@review) and @review.save\n format.html { redirect_to bookings_path, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n flash[:notice] = \"You are submitting your review multiple times. Aborting\"\n format.html { redirect_to bookings_path }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\[email protected]_id = current_user.id\n\t\n\t# used for partials rendering in SPA\n\t@site = Site.find(@review.site_id)\n\t@sites = Site.all\n\t@reviews = Review.where(site_id: @site.id).order(\"created_at DESC\")\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n\t\tformat.js\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n\t\tformat.js { render 'shared/errors' }\n end\n end\n end", "def save_review\r\n return unless self.review\r\n begin\r\n r = JSON.parse self.review\r\n c = Comment.new\r\n c.id = r['id']\r\n c.content = r['content']\r\n c.user_id = r['user']['id']\r\n c.app_id = r['app']['id']\r\n c.created_at = Time.at r['created_at']\r\n c.model = r['model']\r\n c.sdk = r['sdk']\r\n c.image = r['image']\r\n c.image_size = r['image_size']\r\n c.sns_status_id = r['sns_status_id']\r\n c.sns_id = r['sns_id'] \r\n c.in_reply_to_id = r['in_reply_to_id']\r\n c.save\r\n rescue\r\n end\r\n end", "def create\n @user_review = UserReview.new(user_review_params)\n\n respond_to do |format|\n if @user_review.save!\n format.html { redirect_to user_reviews_path, notice: 'User review was successfully created.' }\n format.json { render :show, status: :created, location: @user_review }\n else\n format.html { render :new }\n format.json { render json: @user_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = @story.reviews.new(review_params)\n if @review.save\n redirect_to @review.story, notice: 'Review was successfully created.'\n else\n render :new\n end\n end", "def new\n @review = current_user.reviews.new\n 1.times { @review.review_photos.build }\n @place = Place.first\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def create\n @item_review = ItemReview.new(item_review_params)\n\n respond_to do |format|\n if @item_review.save\n format.html { redirect_to @item_review, notice: 'Item review was successfully created.' }\n format.json { render :show, status: :created, location: @item_review }\n else\n format.html { render :new }\n format.json { render json: @item_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:user_id] && params[:recruiter_id] && params[:review]\n user = User.find(params[:user_id])\n # puts user\n recruiter = Recruiter.find(params[:recruiter_id])\n # puts recruiter\n ################################\n params[\"got_interview\"] ? got_interview = params[\"got_interview\"] : got_interview = false\n params[\"got_job\"] ? got_job = params[\"got_job\"] : got_job = false\n got_job ? got_interview = true : \"null\" #if got job then must have had interview\n params[\"rating\"] ? rating = params[\"rating\"] : rating = 0 #0 means not rated\n params[\"recommended\"] ? recommended = params[\"recommended\"] : recommended = false\n params[\"ghoster\"] ? ghoster = params[\"ghoster\"] : ghoster = false\n # puts \"*********$\"\n # puts params\n # puts recommended\n # puts params[:recommended]\n # puts \"***************$\"\n review = Review.new(\n user_id: user.id,\n recruiter_id: recruiter.id,\n review: params[\"review\"],\n got_interview: got_interview,\n got_job: got_job,\n rating: rating,\n recommended: recommended,\n ghoster: ghoster\n ) #Review.new\n\n if review.save\n render json: {\"POSTED REVIEW\": \"ok\"} #works\n else\n render json: {\"error\": \"ERROR SAVE POSTED REVIEW\"}\n end\n ################################\n # render json: {\"POSTED REVIEW\": \"ok\"} #works\n else\n render json: {\"error\": \"no user_id or recruiter_id or review\"}\n end # if params[:user_id]\n end", "def new\n @review = @place.reviews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def create\n @recipe = Recipe.find params[:recipe_id]\n review = Review.new review_params\n review.recipe = @recipe\n review.user = current_user\n if review.save\n render json:{id: review.id}\n else \n render(json: {status: 422},\n status: 422 )\n end\n end", "def create\n @item_review = ItemReview.new(item_review_params)\n\n respond_to do |format|\n if @item_review.save\n format.html { redirect_to @item_review, notice: 'Item review was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item_review }\n else\n format.html { render action: 'new' }\n format.json { render json: @item_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = current_user.reviews.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to place_path(@review.place), notice: 'Review was successfully created.' }\n else\n format.html { redirect_to root_path }\n end\n end\n end", "def create\n\t\t@book_review = BookReview.new(params[:book_review])\n\t\t@book_review.user_id = current_user.id\n\t\t@book_review.book_id = params[:book_id]\n\n\t\trespond_to do |format|\n\t\t\tif @book_review.save\n\t\t\t\tformat.html { redirect_to @book_review, :notice => 'Book review was successfully created.' }\n\t\t\t\tformat.json { render :json => @book_review, :status => :created, :location => @book_review }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.json { render :json => @book_review.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def review\n\t@applicants = Applicant.all\n\t\n\trespond_to do |format|\n\tformat.html # review.html.erb\n\tformat.json { render json: @applicants }\n\tend\n\tend", "def create\n item = Item.find(params[:review][:rateable_id])\n @review = item.reviews.new\n @review.user_id = current_user.id\n @review.rating = params[:review][:rating]\n @review.comment = params[:review][:comment]\n if @review.save\n redirect_to item_path(item)\n else\n flash[:alet] = \"There was a problem creating the review\"\n render :new\n end\n end", "def reviews(params = {})\n data = request(\"/review/list\", params.merge(v: \"2\"))\n reviews = data[\"reviews\"][\"review\"]\n if reviews.present?\n reviews.map { |review| Hashie::Mash.new(review) }\n else\n []\n end\n end", "def create\n @review = @place.reviews.new(params[:review])\n @review.user = current_user\n respond_to do |format|\n if @review.save\n format.html { redirect_to place_path(@place), notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { redirect_to place_path(@place, :anchor => \"review\"), notice: 'Please enter your review!!.' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @reviews = Review.all\n @review = Review.new(review: params[:review][:review], my_book_id: params[:my_book_id])\n end", "def create\n @review = Review.new(review_params)\n @review.exceptional ||= 0\n if @review.save\n @apn.update_attribute(:reviewed, true)\n link = reviews_path\n name = @apn.profile.first_name.capitalize + \" \".to_s + @apn.profile.last_name.capitalize\n redirect_to new_review_path, notice: (\"#{name} successfully reviewed.\" +\n \" New application loaded. If you're feeling lazy, <a href='#{link}'>\" +\n \"go to the Dashboard</a>\").html_safe\n else\n render action: \"new\", alert: \"something went wrong with submitting the review\"\n end\n end", "def create\n\t\t@review = Review.new(params[:review])\n\t\[email protected] = Establishment.find(params[:establishment])\n\t\[email protected] = Category.find(params[:category])\n\t\[email protected] = Clientele.find(params[:clientele])\n\t\[email protected]_level = SoundLevel.find(params[:sound_level])\n\t\[email protected] = Hygiene.find(params[:hygiene])\n\t\[email protected] = Rating.find(params[:rating])\n\n\t\trespond_to do |format|\n\t\t\tif @review.save\n\t\t\t\tformat.html { redirect_to(@review, :notice => 'Review was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @review, :status => :created, :location => @review }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @review.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @critic_review = CriticReview.new(critic_review_params)\n\n respond_to do |format|\n if @critic_review.save\n format.html { redirect_to @critic_review, notice: 'Critic review was successfully created.' }\n format.json { render :show, status: :created, location: @critic_review }\n else\n format.html { render :new }\n format.json { render json: @critic_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Creates a new review & sends them back to their updated page\n review = current_user.reviews.create(review_params)\n if review.save\n redirect_to :back\n else\n redirect_to product_path(id: params[:product_id])\n end\n end", "def welcome\n @reviews = Review.all\n render json: @reviews\n end", "def create\n @comic = Comic.find(params[:comic_id])\n @review = current_user.reviews.new(review_params)\n @review.tag_list = params[:tag_list]\n @review.comic_id = @comic.id\n p @review\n p review_params\n respond_to do |format|\n if @review.save\n format.html { redirect_to comic_path(@comic), notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.valid?\n @review.save \n @boardgame = Boardgame.find(params[:boardgame_id])\n render json: @boardgame, status: :created \n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @product = Product.find params[:product_id] \n @review = @product.reviews.create(review_params)\n if @review.save\n redirect_to :back\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def create\n @visitor_review = VisitorReview.new(visitor_review_params)\n\n respond_to do |format|\n if @visitor_review.save\n format.html { redirect_to @visitor_review, notice: 'Visitor review was successfully created.' }\n format.json { render :show, status: :created, location: @visitor_review }\n else\n format.html { render :new }\n format.json { render json: @visitor_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book_review = BookReview.new(params[:book_review])\n\n respond_to do |format|\n if @book_review.save\n format.html { redirect_to @book_review, notice: 'Book review was successfully created.' }\n format.json { render json: @book_review, status: :created, location: @book_review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def reviews_params\n params.require(:review).permit(:name, :email, :content, :score)\n end", "def index\n @reviews = @post.reviews.all\n respond_with @post, @reviews\n end", "def create\n @review = Review.new(review_params)\n @review.user_id = current_user.id\n @review.movie_id = @movie.id\n\n respond_to do |format|\n #If the review is saved, it redirects to the movie page and shows the notice.\n if @review.save\n format.html { redirect_to @movie, notice: t('review.create') }\n format.json { render :show, status: :created, location: @review }\n #If the review is not saved, it refreshes the create review page.\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "def post_review\n @review = Review.new\n @review.title = params[:title]\n @review.description = params[:description]\n @review.name = params[:name]\n @review.user_id = User.find(session[:user_id]).id\n @review.rating = params[:rating]\n @review.listing = params[:listing]\n @review.save()\n # flash[:notice] = \"Review added successfully.\"\n redirect_to :action => :listing, :id => params[:listing]\n end", "def review_params\n params.require(:review).permit(:customer_id, :car_id, :reservation_id, :content, :rating)\n end", "def create\n if @restaurant.present?\n review = Review.new(review_params)\n if review.save\n render_json content: review\n else\n render_json content: review.errors\n end\n else\n render json: {error: \"restaurant id #{review_params[:restaurant_id]} does not exist\"}, status: :forbidden\n end\n end", "def create\n @book = Book.find(params[:book_id])\n @review = @book.reviews.build(review_params)\n @review.user = current_user\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to book_path(@book), notice: 'Su crítica se envió correctamente.' }\n format.json { render :show, status: :created, location: @review }\n format.js\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @shop = Shop.find(params[:shop_id])\n @review = @shop.reviews.create(reviewer: params[:review][:reviewer], rate: params[:review][:rate], body: params[:review][:body])\n\n if @review.save\n puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n flash[:notice] = \"レビューの投稿が完了しました\"\n redirect_to shop_path(@shop)\n\n else\n redirect_to shop_path(@shop)\n flash[:notice] = \"レビューの投稿に失敗しました\"\n end\n\n\n end", "def create_review(book_id, params = {})\n params = params.merge(book_id: book_id, v: \"2\")\n\n params[:read_at] = params[:read_at].strftime('%Y-%m-%d') if params[:read_at].is_a?(Time)\n\n params[:'review[review]'] = params.delete(:review) if params[:review]\n params[:'review[rating]'] = params.delete(:rating) if params[:rating]\n params[:'review[read_at]'] = params.delete(:read_at) if params[:read_at]\n\n data = oauth_request_method(:post, '/review.xml', params)\n\n Hashie::Mash.new(data[\"review\"])\n end", "def create\n @review = Review.new(params[:review])\n @review.review_date = Time.now\n @review.user_id = current_user.id\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to place_url(@review.place), notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def review_params\n params.require(:review).permit(:user_id, :comic_id, :review_text, :review_title, :netabare, :tag_list, :star)\n end", "def review\n fetch('restaurant.review')\n end", "def create\n @food_review = FoodReview.new(food_review_params)\n\n respond_to do |format|\n if @food_review.save\n format.html { redirect_to @food_review, notice: 'Food review was successfully created.' }\n format.json { render :show, status: :created, location: @food_review }\n else\n format.html { render :new }\n format.json { render json: @food_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n author = Author.find(params[:author_id])\n @reviews = author.reviews\n render json: @reviews\n end", "def new\n @new_review = NewReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_review }\n end\n end", "def create\n @restaurant_review = RestaurantReview.new(restaurant_review_params)\n\n respond_to do |format|\n if @restaurant_review.save\n format.html { redirect_to @restaurant_review, notice: 'Restaurant review was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant_review }\n else\n format.html { render :new }\n format.json { render json: @restaurant_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def index\n reviews = Review.all\n render json: reviews\n end", "def create\r\n _params = review_init_params\r\n _params[:id] = SecurityManager.md5(\"#{@user.id}_#{@task.id}\")\r\n _params[:score] = _params[:score].to_i\r\n _params[:author_id] = @user.id\r\n\r\n begin\r\n @review = @task.reviews.create(_params)\r\n rescue Mongo::Error::OperationFailure\r\n return bad_request(\"duplicated\")\r\n end\r\n\r\n respond_to do |format|\r\n if @review.save\r\n format.html { redirect_to '/task' }\r\n else\r\n return unprocessable_entity\r\n end\r\n end\r\n end", "def index\n @reviews = @place.reviews\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end", "def review_params\n params.require(:review).permit(:description, :rating, :restaurant_id)\n end", "def create\n @review = Review.new(review_params)\n respond_to do |format|\n if @review.save\n format.json { render action: 'show', status: :created, location: @review }\n format.html { redirect_to postings_path, notice: 'Review was successfully created.' }\n if current_user.type == \"Student\"\n format.html { redirect_to postings_path, notice: 'Review was successfully created.' }\n else\n format.html { redirect_to supervisor_application_index_path, notice: 'Review was successfully created.' }\n end\n else\n format.html { redirect_to postings_path, notice: \"Review could not be saved. Make sure you fill out fields with an *.\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@reviews = @share.reviews.order(priority: :asc)\n\t\t@reviewToAlter = @share.reviews.new(review_params)\n\t\t\n\t\tif @reviewToAlter.save\n\t\t\tredirect_to share_reviews_path(@share), notice: \"Review saved!\"\n\t\telse\n\t\t\tflash[:alert] = \"Error : #{@reviewToAlter.errors.full_messages.to_sentence}\"\n\t\t\trender :index\n\t\tend\n\tend", "def reviews( params={} )\n reviews = get_connections(\"reviews\", params)\n return map_connections reviews, :to => Facebook::Graph::Review\n end", "def create\n @review = Review.new(params[:review])\n if @review.save\n flash[:notice] = \"Review Created\"\n redirect_to \"/products\"\n else\n render \"create\"\n end\n end", "def review_params\n params.require(:review).permit(:content, :rating)\n end", "def create \n @refrigerator = Refrigerator.find(params[:refrigerator_id])\n @review = Review.create(create_update_params)\n @refrigerator.reviews << @review\n\n if @review.save!\n\n flash[:notice] = 'Review successfully created.'\n redirect_to refrigerator_path(params[:refrigerator_id])\n else\n flash[:notice] = 'Could not create new review.'\n redirect_to (new_refrigerator_review_path(@refrigerator))\n end\n end", "def review\n @users = User.all\n @review = Review.new\n end", "def create\n @review = Review.new(params[:review])\n @review.user = current_user\n\n respond_to do |format|\n if @review.save\n flash[:notice] = 'Review was successfully created.'\n format.html { redirect_to(@review) }\n format.xml { render :xml => @review, :status => :created, :location => @review }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @review.errors, :status => :unprocessable_entity }\n end\n end\n end", "def review_params\n params.require(:review).permit(:rating, :comment)\n end", "def review_params\n params.require(:review).permit(:rating, :comment)\n end", "def review_params\n params.require(:review).permit( :description, :rating)\n end", "def create\n @review = Review.new(params[:review])\n\n if @review.save\n redirect_to contact_path, :notice => \"Uw waardering is geplaatst, hartelijk dank!\"\n else\n\t\t\tredirect_to contact_path, :notice => \"Uw waardering kan op dit moment niet geplaatst worden, probeer het later nog eens.\"\n end\n end", "def index\n @reviews = Review.all\n \n end", "def review_params\n params.require(:review).permit(:score, :confidence, :comments, :paper_id)\n end", "def review_params\n params.require(:review).permit(:lecture_id, :user_id, :content, :rating)\n end" ]
[ "0.7576602", "0.75637454", "0.7493771", "0.747111", "0.747111", "0.747111", "0.7300367", "0.72989565", "0.7201945", "0.7201945", "0.71795744", "0.717838", "0.71406734", "0.7120858", "0.7118763", "0.7002209", "0.6988962", "0.6979939", "0.69722533", "0.69606304", "0.6958055", "0.6953352", "0.6946341", "0.6917387", "0.6896529", "0.689131", "0.684411", "0.68377984", "0.6826352", "0.68095565", "0.6805745", "0.68000114", "0.6756741", "0.6750588", "0.6718385", "0.6698959", "0.6666458", "0.6655321", "0.66511434", "0.6650238", "0.66481405", "0.6643257", "0.66334975", "0.6632171", "0.6625182", "0.6617069", "0.6616355", "0.6614021", "0.65939176", "0.6578096", "0.6566304", "0.655079", "0.6537635", "0.65306634", "0.6529929", "0.6526942", "0.6526942", "0.6521888", "0.6516327", "0.65065676", "0.6494446", "0.64794886", "0.6476289", "0.6476289", "0.6476289", "0.6476289", "0.6476289", "0.6476289", "0.6471607", "0.6462259", "0.6460475", "0.64579177", "0.6457529", "0.6450494", "0.64474744", "0.6443972", "0.6440192", "0.642906", "0.64266014", "0.6419717", "0.64197063", "0.641245", "0.641245", "0.64110076", "0.641063", "0.6410248", "0.640811", "0.640109", "0.64005774", "0.6394809", "0.6391521", "0.6385833", "0.6378832", "0.6370554", "0.6365557", "0.6365557", "0.6360124", "0.63526964", "0.63338596", "0.6333214", "0.63185745" ]
0.0
-1
PUT /reviews/1 PUT /reviews/1.json
def update respond_to do |format| if @product.update_attributes(myparams) format.html { redirect_to @product, notice: 'Product was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end", "def update_review\n @review = Review.find(params[:id])\n @review.update(params[:review])\n redirect \"/reviews/#{@review.id}\"\n end", "def update\n @review = Review.find(params[:id])\n\n if @review.update(review_params)\n head :no_content\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def update\n @review = Review.find(params[:id])\n\n if @review.update(review_params)\n head :no_content\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def update\n @review = Review.find(params[:id])\n\n if @review.update(review_params)\n head :no_content\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def update\n @review = reviewable.reviews.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to reviewable_review_url(reviewable, @review), notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\treview = Review.find(params['id'].to_i) if params['id']\n\t\treview.review_text = params['review_text'] if params['review_text']\n\t\treview.rating = params['rating'] if params['rating']\n\t\treview.reviewer_id = params['reviewer_id'] if params['reviewer_id']\n\t\treview.user_id = params['user_id'].to_i if params['user_id']\n\t\treview.trip_id = params['trip_id'].to_i if params['trip_id']\n\t\treview.save\n\tend", "def update\n @review = @place.reviews.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to reviews_path, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = @post.reviews.where(user_id: current_user.id).find(params[:id])\n @review.update_attributes(params[:review])\n respond_with @post, @review, location: post_path(@post, anchor: \"review_#{@review.id}\")\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @review.update(review_params)\n render json: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\nend", "def update\n @review = Review.find(params[:id])\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review.lecture, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review.lecture }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to restaurent_path(@restaurent.id), notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @review.update(review_params)\n render :show, status: :ok, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = current_user\n @review = Review.find(params[:id])\n @review.update_attributes(review_params)\n render json: @review, include: [:movie]\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n movie = Movie.find(params[:movie_id])\n review = Review.find(params[:id])\n review.update(review_params)\n redirect_to '/movies/#{movies.id}/reviews/#{review.id}'\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review.publication, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_review(review_id, params = {})\n params = params.merge(v: \"2\")\n\n params[:read_at] = params[:read_at].strftime('%Y-%m-%d') if params[:read_at].is_a?(Time)\n\n params[:'review[review]'] = params.delete(:review) if params[:review]\n params[:'review[rating]'] = params.delete(:rating) if params[:rating]\n params[:'review[read_at]'] = params.delete(:read_at) if params[:read_at]\n\n # Documentation says that you should use HTTP PUT, but API returns\n # 401 Unauthorized when PUT is used instead of POST\n data = oauth_request_method(:post, \"/review/#{review_id}.xml\", params)\n\n Hashie::Mash.new(data[\"review\"])\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n flash[:notice] = 'Review was successfully updated.'\n format.html { redirect_to(@review) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @review.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @review = Review.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n format.js {render nothing: true}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @user, notice: '评价更新成功' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @listing, notice: 'Review was updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update_attributes(review_params)\n flash[:success] = \"Review updated\"\n format.html { redirect_to @review.user } # notice: 'Review was successfully updated.'\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to vendor_path(@review.vendor, view: \"recomendacoes\"), notice: 'A sua avaliação foi atualizada com sucesso' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@reviews = @share.reviews.order(priority: :asc)\n\t\t@reviewToAlter = Review.find(params[:id])\n\t\t@review = Review.find(params[:id])\n\t\tif @review.update(review_params)\n\t\t\tredirect_to share_reviews_path(@share), notice: 'Review successfully updated!'\n\t\telse\n\t\t\tflash[:alert] = \"Error : #{@review.errors.full_messages.to_sentence}\"\n\t\t\trender :edit\n\t\tend\n\tend", "def create\n @review = current_author.reviews.create(review_params)\n render json: @review, status: 201\n end", "def update\n @book_review = BookReview.find(params[:id])\n\n respond_to do |format|\n if @book_review.update_attributes(params[:book_review])\n format.html { redirect_to @book_review, notice: 'Book review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@book_review = BookReview.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @book_review.update_attributes(params[:book_review])\n\t\t\t\tformat.html { redirect_to @book_review, :notice => 'Book review was successfully updated.' }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.json { render :json => @book_review.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @review = Review.find(params[:id])\n\n if @review.update_attributes(params[:review])\n\t\t\tredirect_to reviews_path, :notice => \"De waardering is aangepast.\"\n else\n\t\t\tredirect_to reviews_path, :notice => \"De aanpassing kan op dit moment niet worden doorgevoerd. Het is mogelijk dat je meer dan drie referenties wilt aanvinken voor op de voorpagina.\"\n end\n end", "def update\n respond_to do |format|\n if @reviews_and_rating.update(reviews_and_rating_params)\n format.html { redirect_to @reviews_and_rating, notice: 'Reviews and rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @reviews_and_rating }\n else\n format.html { render :edit }\n format.json { render json: @reviews_and_rating.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to project_path(@project), notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @review = @album.review\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n flash[:notice] = \"Review '#{@review}' was successfully updated.\"\n format.html { redirect_to review_url(@review) }\n format.xml { head :ok }\n format.js { render :template => 'music/reviews/success' }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @review.errors.to_xml }\n format.js { render :template => 'music/reviews/error' }\n end\n end\n end", "def update\n @review = current_user.reviews.find_by_id(params[:id])\n if @review.nil?\n flash[:notice] = t(:review_not_found)\n return redirect_back_or_default()\n else\n @reviewable = @review.reviewable\n @review.content = params[:review][:content]\n @review.reviewable_id = params[:review][:reviewable_id]\n @review.reviewable_type = params[:review][:reviewable_type]\n end\n\n respond_to do |format|\n #if @review.update_attributes(params[:review])\n if @review.save\n format.html { redirect_to review_path(@review), :notice => t(:review_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: \"レビューを更新しました\" }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @restaurant.present?\n if @review.present?\n if @review.update(review_params)\n render_json content: @review\n else\n render_json content: @review.errors\n end\n end\n end\n\n end", "def update\n if @review.update(review_params)\n redirect_to @review.story, notice: 'Review was successfully updated.'\n else\n render :edit\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: \"振り返りの更新に成功しました。\" }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @establishment = Establishment.find(params[:establishemnt_id])\n @reviews = @establishment.reviews.find(params[:id])\n @reviews.update(params[:review].permit(:rating, :review_content))\n\n redirect_to @establishment\n=begin\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def update\n\t\t@review = Review.find(params[:id])\n\t\[email protected] = Establishment.find(params[:establishment])\n\t\[email protected] = Category.find(params[:category])\n\t\[email protected] = Clientele.find(params[:clientele])\n\t\[email protected]_level = SoundLevel.find(params[:sound_level])\n\t\[email protected] = Hygiene.find(params[:hygiene])\n\t\[email protected] = Rating.find(params[:rating])\n\n\t\trespond_to do |format|\n\t\t\tif @review.update_attributes(params[:review])\n\t\t\t\tformat.html { redirect_to(@review, :notice => 'Review was successfully updated.') }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @review.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @review.update(review_params)\n @paper = @review.paper\n @rate = 0.0\n @top = 0.0\n @bottem = 0.0\n @paper.reviews.each do |review| \n @top += review.score * review.confidence\n @bottem += review.confidence\n end\n @rate = @top / @bottem\n @paper.update_attribute(:rating, @paper.rating = @rate)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def update_pull_review(repo, pull_number, review_id, body, options = {})\n opts = options.dup\n opts[:body] = body\n put \"#{Repository.path repo}/pulls/#{pull_number}/reviews/#{review_id}\", opts\n end", "def update\n respond_to do |format|\n #If the params are filled in and valid, it redirects to the review page and shows the notice\n if @review.update(review_params)\n format.html { redirect_to @review, notice: t('review.update') }\n format.json { render :show, status: :ok, location: @review }\n #If it doesnt update then it refreshes the edit review page\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @review.update(review_params)\n @boardgame = Boardgame.find(params[:boardgame_id])\n render json: @boardgame, status: :ok\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @reviews = args[:reviews] if args.key?(:reviews)\n @average_rating = args[:average_rating] if args.key?(:average_rating)\n @total_review_count = args[:total_review_count] if args.key?(:total_review_count)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def set_review\n @review = Review.find_by_id(params[:id])\n if @review == nil\n head :not_found\n end\n end", "def update\n\t\t@review = Review.find(params[:id])\n\n\t\tif @review.update(review_params.merge(:contract_id => @review.contract_id))\n\t\t\tredirect_to @review\n\t\telse\n\t\t\trender 'edit'\n\t\t\t# => Error when updating empty body element.\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @review.update(review_params)\n format.html { redirect_to categories_url, notice: 'レビューの更新完了です!' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @review.update_attributes(review_params)\n redirect_to edit_review_path(@review), notice: (\"Review was successfully updated.\")\n else\n render action: \"edit\"\n end\n end", "def edit_review\n # client should be able to edit a review.\n puts \"Which review would you like to edit?\"\n pp Client.find_by(name: @@client_name).reviews\n puts \"Please enter the ID\"\n input = gets.strip\n selected_review = Review.find_by(id: input)\n puts \"What would you like for the new review to say?\"\n input = gets.strip\n selected_review.update(text_body: input)\n puts \"Your review has been updated, here's the new review:\"\n pp selected_review\n client_continue\n end", "def update\n\t\t@set_def_avt=params[:review][:default_avatar]\n\t\[email protected]_page.destroy if @set_def_avt\n\n\t\trespond_to do |format|\n\t\t\tif @review.update(review_params)\n\t\t\t\t@reviews = Review.order(:heading).paginate(page: params[:page], per_page: 18)\n\t\t\t\tformat.html { redirect_to @review; flash[:info]= 'review was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @review }\n\t\t\t\tformat.js\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @review.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @item_review.update(item_review_params)\n format.html { redirect_to @item_review, notice: 'Item review was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_review }\n else\n format.html { render :edit }\n format.json { render json: @item_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_review.update!(user_review_params)\n format.html { redirect_to user_reviews_path, notice: 'User review was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_review }\n else\n format.html { render :edit }\n format.json { render json: @user_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item_review.update(item_review_params)\n format.html { redirect_to @item_review, notice: 'Item review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params) && @review.revoke_approval!\n format.json { render :show, status: :ok, location: @review }\n else\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end", "def set_review\n @review = Review.find(params[:id])\n end" ]
[ "0.74415576", "0.7076267", "0.695862", "0.695862", "0.695862", "0.69368684", "0.69190276", "0.69046", "0.67975336", "0.6762971", "0.6762971", "0.6762971", "0.6762971", "0.675068", "0.6626877", "0.6621346", "0.66203684", "0.66143364", "0.6560194", "0.6560194", "0.6560194", "0.6560194", "0.6560194", "0.6560194", "0.6560194", "0.6549292", "0.65261215", "0.6490676", "0.6490676", "0.6490676", "0.64752537", "0.6445988", "0.6418369", "0.63750076", "0.6368519", "0.63586533", "0.6313839", "0.6303943", "0.6301556", "0.6292996", "0.62914836", "0.62706405", "0.6264676", "0.62582225", "0.62281555", "0.6226368", "0.62227505", "0.62211424", "0.6221134", "0.62163025", "0.6206622", "0.62052166", "0.6200219", "0.6174679", "0.6174679", "0.6174679", "0.6174679", "0.6174679", "0.6174679", "0.6174679", "0.61630803", "0.6143387", "0.6131374", "0.6125917", "0.61215097", "0.61214423", "0.6119602", "0.6113905", "0.6111076", "0.61020476", "0.6095656", "0.6088907", "0.6087155", "0.60774976", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394", "0.6074394" ]
0.0
-1
DELETE /reviews/1 DELETE /reviews/1.json
def destroy @product.destroy respond_to do |format| format.html { redirect_to products_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reviews_delete(id)\n delete id.to_s\n _response_status(204, last_response)\n end", "def destroy\n @review = reviewable.reviews.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewable_reviews_url(reviewable) }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :ok }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @user = current_user\n @review = Review.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n review = Review.find_by(id: params[:id]).destroy\n render json: review\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to(reviews_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to(reviews_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_review.destroy\n respond_to do |format|\n format.html { redirect_to item_reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = @place.reviews.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: 'Review was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: \"レビューが削除されました\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to(review_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to restaurent_path(@restaurent.id),\n notice: \"Review was successfully destroyed\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n\n head :no_content\n end", "def destroy\n @review.destroy\n\n head :no_content\n end", "def destroy\n @review.destroy\n\n head :no_content\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to reviews_url, notice: \"振り返りを削除しました。\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n #If destroyed, it display the notice.\n format.html { redirect_to reviews_url, notice: t('review.destroy') }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n respond_to do |format|\n format.html { redirect_to @review.lecture, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = @post.reviews.where(user_id: current_user.id).find(params[:id])\n @review.destroy\n respond_with @post, @review, location: post_path(@post, anchor: \"reviews\")\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to publication_reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, ReviewsController\n @review = Review.find(params[:id])\n if @review\n @review.destroy\n flash[:success] = 'Запись была успешно удалена!'\n else\n flash[:error] = 'Запись не найдена.'\n end\n\n respond_to do |format|\n format.html { redirect_to reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book_review = BookReview.find(params[:id])\n @book_review.destroy\n\n respond_to do |format|\n format.html { redirect_to book_reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to project_path(@project), notice: 'Review was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@review = Review.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(reviews_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend", "def destroy\n @review = find_review\n @review.destroy\n redirect_to reviews_path\n end", "def destroy\n @first_review.destroy\n respond_to do |format|\n format.html { redirect_to first_reviews_url, notice: 'First review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_show_path, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reviews_and_rating.destroy\n respond_to do |format|\n format.html { redirect_to reviews_and_ratings_url, notice: 'Reviews and rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_review.destroy\n respond_to do |format|\n format.html { redirect_to item_reviews_url, notice: 'Item review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find params[:id]\n @review.destroy\n redirect_to :back\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to @book, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_review = UserReview.find(params[:id])\n @user_review.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_reviews_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @review.destroy\n redirect_to root_url\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n flash[:notice] = \"This review was successfully deleted!\"\n redirect_to root_path\n end", "def destroy\n @shop_review.destroy\n respond_to do |format|\n format.html { redirect_to shop_reviews_url, notice: '가게 리뷰가 삭제되었습니다.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant_review.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_reviews_url, notice: 'Restaurant review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @visitor_review.destroy\n respond_to do |format|\n format.html { redirect_to visitor_reviews_url, notice: 'Visitor review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fourth_review.destroy\n respond_to do |format|\n format.html { redirect_to fourth_reviews_url, notice: 'Fourth review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @device_review.destroy\n respond_to do |format|\n format.html { redirect_to device_reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_review.destroy\n respond_to do |format|\n format.html { redirect_to admin_reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @auditreview.destroy\n respond_to do |format|\n format.html { redirect_to auditreviews_url, notice: 'Auditreview was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reviewer = Reviewer.find(params[:id])\n @reviewer.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@review = Review.find(params[:id])\n\t\[email protected]\n\t\tredirect_to share_reviews_path(@share), notice: \"Review successfully deleted!\"\t\t\n\tend", "def destroy\n @critic_review.destroy\n respond_to do |format|\n format.html { redirect_to critic_reviews_url, notice: 'Critic review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n end", "def destroy\n @blade_review.destroy\n respond_to do |format|\n format.html { redirect_to blade_reviews_url, notice: 'Blade review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id]) # param comes from route\n @review.destroy\n\n redirect_to restaurant_path(@restaurant.id)\n end", "def destroy\n @food_review.destroy\n respond_to do |format|\n format.html { redirect_to food_reviews_url, notice: 'Food review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hm_review.destroy\n respond_to do |format|\n format.html { redirect_to hm_reviews_url, notice: 'Hm review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = current_user\n @review_like = ReviewLike.find(params[:id]).delete\n render json: { msg: \"Delete Successful\" }\n end", "def destroy\n @boo_k_review.destroy\n respond_to do |format|\n format.html { redirect_to boo_k_reviews_url, notice: 'Boo k review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_review.destroy\n respond_to do |format|\n format.html { redirect_to user_reviews_url, notice: 'User review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Product.find(params[:product_id]).reviews.find(params[:id])\n @review.destroy\n redirect_to :back\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n if user_signed_in? && current_user.admin?\n @new_review = NewReview.find(params[:id])\n @new_review.destroy\n\n respond_to do |format|\n format.html { redirect_to new_reviews_url }\n format.json { head :no_content }\n end\n else\n redirect_to root_path\n end\n end", "def destroy\n @review_template.destroy\n respond_to do |format|\n format.html { redirect_to review_templates_url }\n format.json { head :no_content }\n end\n end", "def delete_user\n delete_reviews(self)\n self.destroy\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to categories_url, notice: 'レビューの削除完了です!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review_count.destroy\n respond_to do |format|\n format.html { redirect_to review_counts_url, notice: 'Review count was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tour_review.destroy\n respond_to do |format|\n format.html { redirect_to tour_reviews_url, notice: 'ツアーレビューは正常に削除されました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bollywood_review = BollywoodReview.find(params[:id])\n @bollywood_review.destroy\n\n respond_to do |format|\n format.html { redirect_to bollywood_reviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n Review.destory(params[:id])\nend", "def destroy\n @review.destroy\n respond_to do |format|\n # Broadcast remove review on list from model.\n format.turbo_stream { render turbo_stream: \"\" }\n format.html { redirect_to recipe_path(@recipe, anchor: \"reviews_header\"), notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @thesis_review = ThesisReview.find(params[:id])\n @thesis_review.destroy\n\n respond_to do |format|\n format.html { redirect_to(thesis_reviews_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\t@book_review = BookReview.find(params[:id])\n\t\t@book_review.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to book_reviews_url }\n\t\t\tformat.json { head :ok }\n\t\tend\n\tend", "def destroy\n @admin_nature_of_review.destroy\n respond_to do |format|\n format.html { redirect_to admin_nature_of_reviews_url, notice: 'Nature of review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review_image = ReviewImage.find(params[:id])\n @review_image.destroy\n\n respond_to do |format|\n format.html { redirect_to review_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hospital = Hospital.find(params[:hospital_id])\n @review = @hospital.reviews.find(params[:id])\n @review.destroy\n respond_to do |format|\n flash[:success] = \"삭제 성공\"\n format.html { redirect_to @hospital }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @product = Product.find(params[:product_id])\n @revoew = @product.reviews.find(params[:id])\n @review.destroy\n\n redirect_to product_path(@product)\n\n end", "def destroy\n @evenreview.destroy\n respond_to do |format|\n format.html { redirect_to evenreviews_url, notice: 'Evenreview was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find(params[:project_id])\n @review = @project.reviews.find(params[:id])\n @paths = @review.file\n @line = @review.line\n @review.destroy\n\n respond_to do |format|\n # format.html { redirect_to blob_project_path(@project, 'blob', @paths) }\n format.html { redirect_to line_project_path(@project, 'line', @paths, @line) }\n # format.js { @reviews = @project.reviews_by_line(@paths, @line).paginate(page: params[:page], per_page: 20) }\n format.js { @reviews = Review.with_project(@project).with_file(@paths).with_line(@line).paginate(page: params[:page], per_page: 20) }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.html { redirect_to places_url, notice: 'Review was successfully destroyed.' }\n end\n end", "def destroy\n unless current_user.is_review_moderator?\n redirect_to denied_path\n return\n end\n\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to(reviews_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rating.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n @reservation.reviwed = false\n @reservation.save\n format.html { redirect_to listings_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_review.destroy\n respond_to do |format|\n format.html { redirect_to event_reviews_url, notice: 'Event review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reviewable_object = current_user.reviewable_objects.find(params[:id])\n @reviewable_object.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewable_objects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n vendor = @review.vendor\n user = @review.user\n @review.destroy\n vendor.save # para atualizar o number_reviews\n\n respond_to do |format|\n format.html { redirect_to vendor_path(vendor, view: \"recomendacoes\") }\n format.json { head :ok }\n end\n end", "def destroy\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\t\tformat.js\n\t\tend\n\tend", "def destroy\n @bookreview.destroy\n respond_to do |format|\n format.html { redirect_to book_path(@bookreview.book_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @bizowners_review.destroy\n respond_to do |format|\n format.html { redirect_to bizowners_reviews_url, notice: 'Bizowners review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @review.destroy\n respond_to do |format|\n\t format.js\n format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.78339803", "0.7793395", "0.7784284", "0.77726567", "0.77726567", "0.77726567", "0.77726567", "0.77726567", "0.7675433", "0.7675356", "0.76534444", "0.76534444", "0.76534444", "0.7640298", "0.74997073", "0.74997073", "0.7471851", "0.7413653", "0.7411421", "0.7411421", "0.7411421", "0.7411421", "0.7411421", "0.7411421", "0.7411421", "0.7411421", "0.7391597", "0.7377098", "0.73708576", "0.7369254", "0.7354971", "0.7354971", "0.7354971", "0.7320031", "0.73119164", "0.7304874", "0.7285188", "0.7241543", "0.7239192", "0.7234086", "0.7220066", "0.721412", "0.71992755", "0.7192366", "0.7176221", "0.7146974", "0.7127848", "0.7127217", "0.71145934", "0.71103424", "0.70975995", "0.70830786", "0.7079591", "0.70757383", "0.70706326", "0.7059626", "0.70530736", "0.70402336", "0.7039072", "0.70283055", "0.7020858", "0.7019805", "0.701645", "0.7008477", "0.70075613", "0.7002922", "0.6990786", "0.69790566", "0.69745415", "0.6954628", "0.69495213", "0.6944607", "0.69195116", "0.6912278", "0.6911547", "0.69050354", "0.6892275", "0.6872293", "0.68625265", "0.68605447", "0.6853683", "0.68325126", "0.6829135", "0.6826046", "0.68065304", "0.6804502", "0.6794295", "0.67808354", "0.6767752", "0.67388207", "0.6730046", "0.67115474", "0.6710128", "0.6689548", "0.6677106", "0.6655792", "0.66525483", "0.66514945", "0.66475755", "0.664666", "0.6639983" ]
0.0
-1
GET /notifies/1 GET /notifies/1.json
def show @notify = Notify.find(params[:id]) @notify.is_read = true ; @notify.save respond_to do |format| format.html # show.html.erb format.json { render json: @notify } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @notifies = Notify.where(:course_id => @course.id).order('created_at DESC').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @course.notifies }\n end\n end", "def show\n @notify = @course.notifies.find(params[:id])\n @notify.readed_times += 1\n @notify.save\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @notify }\n end\n end", "def notifications(params={})\n Endpoints::Notifications.new(self).get(params)\n end", "def show\n @notification = Notification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notification }\n end\n end", "def index\n @notifications = Notification.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notifications }\n end\n end", "def new\n @notify = Notify.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notify }\n end\n end", "def notifications\n query_api_object Notification, \"/rest/notifications\", nil, \"GET\", \"notifications\"\n end", "def index\n @notifications = Notification.all\n @notifications = @notifications.select { |x| x.user_id == params[:user_id].to_i }\n render json: { items: @notifications }\n end", "def index\n notifications = params[:unread].nil? || params[:unread] == 0 ? current_user.notifications : Notification.where(user: current_user, status: :unread).all\n\n render json: {\n status: 'Success',\n message: '',\n notifications: notifications.as_json(except: [\n :created_at,\n :updated_at\n ])\n }, status: 200\n end", "def show\n @eve_notification = EveNotification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eve_notification }\n end\n end", "def show\n render json: @notification\n end", "def show\n respond_to do |format|\n if @notification==nil\n format.json { render json: {error: \"Esta notificacion ya no existe\"}, status: :not_found }\n format.html {\n redirect_to root_path, notice: \"Esta notificacion ya no existe\"\n }\n else\n format.json { render json: {notification: @notification}, status: :ok }\n format.html {\n @notification.update(readed: true)\n }\n end\n end\n end", "def get_notifications\n begin\n response = notifications_api.get\n [parse_json(response), nil]\n rescue RestClient::Unauthorized\n [{}, Unauthorized]\n end\n end", "def show\n @emails = JSON.parse(@notification.fetch_emails)\n end", "def show_notifications # :norobots:\n pass_query_params\n data = []\n @observation = find_or_goto_index(Observation, params[:id].to_s)\n return unless @observation\n name_tracking_emails(@user.id).each do |q|\n fields = [:naming, :notification, :shown]\n naming_id, notification_id, shown = q.get_integers(fields)\n next unless shown.nil?\n notification = Notification.find(notification_id)\n if notification.note_template\n data.push([notification, Naming.find(naming_id)])\n end\n q.add_integer(:shown, 1)\n end\n @data = data.sort_by { rand }\n end", "def show\n @notice = @person.notices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notice }\n end\n end", "def show\n @notify_observer = NotifyObserver.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @notify_observer }\n end\n end", "def show\n respond_with @notification = Notification.find(params[:id])\n end", "def get_notifications notifiable_type\n n = Notification.where(user_id:current_user, notifiable_type: notifiable_type)\n events_id = Array.new\n n.each do |v|\n events_id << v.notifiable_id\n end\n events = Event.where(id:events_id)\n\n end", "def index\n respond_with @notifications = Notification.latest.paginate(:page => params[:page], :per_page => 100)\n end", "def index\n # @notifications = current_user.notifications\n @notifications = @notifications.order(\"id desc\")\n\n if !params[:search].blank?\n @notifications = @notifications&.search(params[:search])\n end\n\n total = @notifications&.count\n\n @notifications = @notifications&.paginate(per_page: params[:per_page], page: params[:page])\n\n render json: {\n data: @notifications.collect{|n| NotificationSerializer.new(n).attributes},\n meta: {\n current_page: params[:page],\n per_page: params[:per_page],\n total: total\n }\n }\n end", "def notification(id)\n response = self.class.get(\"/notifications/\" + id.to_s + \".xml\")\n note = response[\"notification\"]\n new_note = Notification.new( :body => note[\"body\"],\n :subject => note[\"subject\"],\n :id => note[\"id\"],\n :send_at => note[\"send_at\"],\n :escalation => note[\"escalation\"])\n note[\"recipients\"].each do |rcpt|\n new_note.add_recipient(Recipient.new(:id => rcpt[\"id\"],\n :channel => rcpt[\"channel\"],\n :address => rcpt[\"address\"],\n :status => rcpt[\"status\"],\n :send_at => rcpt[\"send_at\"]))\n end\n new_note \n end", "def notifications\n @campus_id = current_user.campus_users.first.campus_id\n invi_status=CRUD::Utility::Invitations.new(@campus_id)\n data = invi_status.get_request_sent\n render :json=>{:data=>data}\n end", "def notifications\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @client = Octokit::Client.new(:access_token => @current_user.token)\n\n # get first 50 notifications (github paginates at 50)\n notifications = @client.notifications({all: true, per_page: 50})\n\n # if there are more pages, get page 2\n more_pages = @client.last_response.rels[:next]\n if more_pages\n notifications.concat more_pages.get.data\n end\n\n # Consider how to get more pages...\n # page_count = 0\n # while more_pages and page_count < 10\n # notifications.concat more_pages.get.data\n # page_count++\n # more_pages = @client.last_response.rels[:next]\n # end\n\n # iterate over notifications to:\n # add score value\n # add notification_url value\n @json = notifications.map do |notification|\n add_score_url_to_notification(notification, {favRepos: @current_user.UserPreference.repos})\n end\n\n respond_to do |format|\n format.json {\n render json: @json.to_json, status: 200\n }\n end\n end", "def index\n @notifiers = Notifier.all\n end", "def show\n @notification = current_user.find_client(params[:client_id]).notifications.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def show\n @job_notification = JobNotification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_notification }\n end\n end", "def show\n @task_note = Note.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task_note }\n end\n end", "def index\n @notifications = current_user.notifications.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifications }\n end\n end", "def refreshnotify\n @title = \"\"\n\n puts '====================== refreshnotify'\n\n current_user.update_attributes!(:notify => \"NO\")\n @user = current_user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :user=>@user.as_json(:only => [:id, :name, :email, :invitation_token, :notify, :buddy, :gender, :displayname], :methods => [:photo_url]) \n } }\n end\n end", "def new\n @notice = @person.notices.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\n end\n end", "def show\n @project_note = ProjectNote.find(params[:id])\n\n render json: @project_note\n end", "def index\n\n if @notification\n json_response(@notification.user_subscriptions)\n end\n if request.path_parameters.has_key?(:user_id)\n json_response(@user.user_subscriptions)\n end\n end", "def index\n @task_notes = Note.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_notes }\n end\n end", "def show\n @user = User.find(params[:user_id])\n @note = @user.notes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @note }\n end\n end", "def show\n render json: @note\n end", "def show\n @note = Note.find(params[:id])\n @user = User.where(:id => @note.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notes }\n end\n end", "def new\n\n @notification = Notification.new\n @current_user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notification }\n end\n end", "def index\n @note = Note.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end", "def index\n @notes = Note.all\n render json: @notes\n end", "def index\n @notifications = Notification.includes(:contextable).where(notifiable: @context)\n render json: paginated_json(@notifications) { |notifications| notifications_json(notifications) }\n end", "def check\n\n\t\t@unseenNotifications = {notifications: current_user.notifications.unseen.count}\n\t\trespond_to do |format|\n\n\t\t\tformat.json { render json: @unseenNotifications }\n\n\t\tend\n\n\tend", "def show\n @notification = Notification.find(params[:id])\n end", "def show\n @notification = Notification.find_by(id: params[:id])\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @note }\n end\n end", "def index\n @reminders = Reminder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reminders }\n end\n end", "def index\n @reminders = Reminder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reminders }\n end\n end", "def notifications\n response = self.class.get('/notifications.xml')\n notifications_array = []\n response['notifications'].each do |note|\n new_note = Notification.new(:body => note[\"body\"],\n :subject => note[\"subject\"],\n :send_at => note[\"send_at\"],\n :id => note[\"id\"],\n :escalation => note[\"escalation\"])\n note[\"recipients\"].each do |rcpt|\n new_note.add_recipient(Recipient.new(:id => rcpt[\"id\"],\n :channel => rcpt[\"channel\"],\n :address => rcpt[\"address\"],\n :status => rcpt[\"status\"],\n :send_at => rcpt[\"send_at\"]))\n end\n notifications_array << new_note \n end\n notifications_array\n end", "def new\n @eve_notification = EveNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @eve_notification }\n end\n end", "def index\n @notes = current_registry.person.notes.includes(:about_person => :person)\n @notes = @notes.includes(:about_event => :event)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end", "def notifications\n @user = current_user\n @notifications.update_all(updated_at: Time.zone.now)\n respond_to do |format|\n format.html\n format.json\n end\n end", "def show\n @note = Note.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @note }\n end\n end", "def index\n @notes = Note.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end", "def notes\n return bad_request unless params[:note_id] and request.format.json? || request.format.js?\n return not_found unless current_note\n @response = {'annotation' => current_note.canonical}\n render_cross_origin_json\n end", "def new\n @notify_observer = NotifyObserver.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @notify_observer }\n end\n end", "def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end", "def show\n render json: @notification_count\n end", "def show\n @notification = current_user.notifications.find(params[:id])\n @receipients = @notification.receipients.paginate(:page => params[:page] || 1, :per_page => 10) \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @notification }\n end\n end", "def show\n render json: @notes\n end", "def show\n @reminder = Reminder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reminder }\n end\n end", "def show\n @reminder = Reminder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reminder }\n end\n end", "def show\n @reminder = Reminder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reminder }\n end\n end", "def show\n @note = Note.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @note }\n end\n end", "def index\n @notes = Note.where{project_id == my{@project.id}}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end", "def index\n @notifications = Notification.all\n end", "def index\n @notifications = Notification.all\n end", "def index\n @notifications = Notification.all\n end", "def index\n @notifications = Notification.all\n end", "def index\n @notifications = Notification.all\n end", "def index\n @notifications = Notification.all\n end", "def show\n @inform_mail = InformMail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inform_mail }\n end\n end", "def show\n @push_notification = PushNotification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @push_notification }\n end\n end", "def show\n client = Client.find(params[:id])\n notifications = Notification.all\n client_notifications = notifications\n .select { |notification| client.companies.include? notification.company }\n render json: client_notifications\n end", "def index\n\t\t@notifications = Notification.all\n\tend", "def specific_notes(id, accept)\n begin\n \t# Calls a certain note depending on the number \n return RestClient.get 'http://localhost:4567/notes/' + id.to_s, :accept => accept\n rescue => e\n return e.response\n end\n end", "def show\n @data_note = DataNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_note }\n end\n end", "def show\n @note = Note.find(params[:id])\n respond_with(@note)\n end", "def new\n @task_note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_note }\n end\n end", "def index\n @notifiers = Notifier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifiers }\n end\n end", "def index\n respond_with Note.all\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notes }\n end\n end", "def show\n @payment_notification = PaymentNotification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment_notification }\n end\n end", "def create\n @notifier = Notifier.new(notifier_params)\n\n respond_to do |format|\n if @notifier.save\n format.html { redirect_to @notifier, notice: 'Notifier was successfully created.' }\n format.json { render :show, status: :created, location: @notifier }\n else\n format.html { render :new }\n format.json { render json: @notifier.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @note = Note.find(params[:id])\n\n respond_with(@note)\n end", "def message_notifications\n notifications = Message.where(receiver_id: @current_user.id, read_status: 0)\n if notifications\n render json: {\n status: 'success',\n message: 'Your notifications',\n data: notifications.length()\n },\n status: :ok\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pushup_reminders }\n end\n end", "def new\n respond_with @notification = @application.notifications.new\n end", "def show\n\t\t@user=User.find(params[:user_id])\n \t@[email protected](params[:room_id])\n \t\t@device= @room.devices.find(params[:device_device_id])\n \t\t@note = @device.notes.find(params[:id])\n \trender json: @note if stale?(@note)\n\tend", "def index\n\t\trender json: current_user.noteBooks.as_json(:include=> [:notes=>{:only=>[\"id\"]}])\n # render json: NoteBook.all.as_json(:include=> [:notes=>{:only=>[\"id\"]}])\n\tend", "def index\n @emails = @user.emails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @emails }\n end\n end", "def index\n @emails = @user.emails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @emails }\n end\n end", "def show\n @lecture_note = LectureNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lecture_note }\n end\n end", "def show\n @notifications = Notification.where(user: current_user).where(notification_obeject_id: params[:id]).where(read: false)\n @notifications.each do |note|\n note.read = true\n note.save\n end\n end", "def get_notifications\n \t\n \t@notifs = []\n\n \tif current_user\n @notifs = Notification.where(:user_id => current_user.id, :seen => false)\n \tend\n end", "def index\n @notes = Note.all\n \n respond_with(@notes)\n end", "def show\n @notification_restriction = NotificationRestriction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notification_restriction }\n end\n end", "def show\n=begin\n @notification_log = NotificationLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notification_log }\n end\n=end\n end", "def index\n @payment_notifications = PaymentNotification.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payment_notifications }\n end\n end", "def show\n @dispatched_email = DispatchedEmail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dispatched_email }\n end\n end", "def show\n @core_nota = Core::Nota.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_nota }\n end\n end", "def show\n if @note.about_person\n @person = @note.about_person.person\n end\n if @note.about_event\n @event = @note.about_event.event\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @note }\n end\n end" ]
[ "0.6844212", "0.67529", "0.6646549", "0.64029044", "0.6353408", "0.632896", "0.62753147", "0.6224504", "0.62209016", "0.62145936", "0.61955875", "0.617665", "0.61640614", "0.61634034", "0.6156989", "0.6152265", "0.61198914", "0.6090113", "0.6030251", "0.60213304", "0.6019659", "0.5983752", "0.5983188", "0.59441066", "0.59074676", "0.5906274", "0.58952653", "0.58873284", "0.5884393", "0.5881169", "0.58768886", "0.5873755", "0.58666414", "0.58623767", "0.58622104", "0.5859292", "0.58511376", "0.58488494", "0.5839323", "0.58318514", "0.5831842", "0.58203036", "0.5807316", "0.5806396", "0.57928985", "0.57855827", "0.57855827", "0.57840854", "0.57817626", "0.5777134", "0.5776698", "0.57740283", "0.5767776", "0.57614595", "0.57544607", "0.57457906", "0.57414365", "0.57350683", "0.57335395", "0.568938", "0.568938", "0.568938", "0.56844306", "0.5683118", "0.5678058", "0.5678058", "0.5678058", "0.5678058", "0.5678058", "0.5678058", "0.56757134", "0.56458336", "0.56443894", "0.56437707", "0.5641705", "0.56369346", "0.5634159", "0.5633116", "0.56299883", "0.5629199", "0.5628401", "0.5622205", "0.55986196", "0.5595671", "0.5594521", "0.5593553", "0.55903804", "0.55830353", "0.55818224", "0.5579652", "0.5579652", "0.5578998", "0.55701447", "0.55652964", "0.5564061", "0.5548904", "0.5535035", "0.5528122", "0.5522571", "0.55171764", "0.551582" ]
0.0
-1
GET /notifies/new GET /notifies/new.json
def new @notify = Notify.new respond_to do |format| format.html # new.html.erb format.json { render json: @notify } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @notice = @person.notices.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\n end\n end", "def new\n @eve_notification = EveNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @eve_notification }\n end\n end", "def new\n respond_with @notification = @application.notifications.new\n end", "def new\n\n @notification = Notification.new\n @current_user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notification }\n end\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notes }\n end\n end", "def new\n @notify_observer = NotifyObserver.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @notify_observer }\n end\n end", "def new\n @task_note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_note }\n end\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @note }\n end\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @note }\n end\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @note }\n end\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @note }\n end\n end", "def create\n @notifier = Notifier.new(notifier_params)\n\n respond_to do |format|\n if @notifier.save\n format.html { redirect_to @notifier, notice: 'Notifier was successfully created.' }\n format.json { render :show, status: :created, location: @notifier }\n else\n format.html { render :new }\n format.json { render json: @notifier.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notifier }\n end\n end", "def new\n @notification = current_user.notifications.new\n load_context\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notification }\n end\n end", "def new\n @job_notification = JobNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job_notification }\n end\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @note }\n end\n end", "def new\n @notification = Notification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notification }\n end\n end", "def new\n @push_notification = PushNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @push_notification }\n end\n end", "def create\n @notify = Notify.new(params[:notify])\n\n respond_to do |format|\n if @notify.save\n format.html { redirect_to @notify, notice: 'Notify was successfully created.' }\n format.json { render json: @notify, status: :created, location: @notify }\n else\n format.html { render action: \"new\" }\n format.json { render json: @notify.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @email = @user.emails.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @inform_mail = InformMail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inform_mail }\n end\n end", "def create\n @notification = Notification.new(notification_params)\n\n if @notification.save\n render json: @notification\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end", "def new\n @reminder = Reminder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reminder }\n end\n end", "def new\n @payment_notification = PaymentNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_notification }\n end\n end", "def create\n @notification = Notification.new(params[:notification])\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render json: @notification, status: :created, location: @notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @data_note = DataNote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_note }\n end\n end", "def new\n @notice = Notice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\n end\n end", "def new\n @note = Note.new\n respond_with(@note)\n end", "def new\n @new_city_notification = NewCityNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_city_notification }\n end\n end", "def new\r\n @reminder = Reminder.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @reminder }\r\n end\r\n end", "def create\n @Notification = Notification.new(params[:note])\n @Notification.state = \"new\";\n \n respond_to do |format| \n format.html { render :action => \"new\" }\n format.xml { render :xml => @Notification.errors, :status => :created }\n end\n end", "def new\n @note = Note.new\n\n respond_with(@note)\n end", "def new\n=begin\n @notification_log = NotificationLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notification_log }\n end\n=end\n end", "def new\n @delivery_note = DeliveryNote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery_note }\n end\n end", "def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render action: 'show', status: :created, location: @notification }\n else\n format.html { render action: 'new' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render action: 'show', status: :created, location: @notification }\n else\n format.html { render action: 'new' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @todo = @list.todos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @status_de_la_notificacion = StatusDeLaNotificacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status_de_la_notificacion }\n end\n end", "def new\n @alarm_notification = AlarmNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alarm_notification }\n end\n end", "def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render :show, status: :created, location: @notification }\n else\n format.html { render :new }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @notification_type = NotificationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notification_type }\n end\n end", "def create\n\t\t@newEntry = Note.create(title: params[:title], entry: params[:entry], topic: params[:topic])\n\t\t@allNotes = Note.all\n\t\trender json: @allNotes\n\tend", "def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @email = Email.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email }\n end\n end", "def new\n @users_mail = UsersMail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users_mail }\n end\n end", "def new\n @notification_restriction = NotificationRestriction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notification_restriction }\n end\n end", "def new\n @detour = Detour.new\n\n @detour.dispatcher = User.find_by_id(session[:userid]).full_name\n\n @locations = Location.find(:all)\n @nrs = Array.new\n @locations.each do |l|\n @nrs.push( NotificationRequest.new(l.id, l.short_name, l.long_name, l.notify_by_default))\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @detour }\n end\n end", "def new\n @patch = Patch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patch }\n end\n end", "def new\n @dispatched_email = DispatchedEmail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dispatched_email }\n end\n end", "def create\n @eve_notification = EveNotification.new(params[:eve_notification])\n\n respond_to do |format|\n if @eve_notification.save\n format.html { redirect_to @eve_notification, notice: 'Eve notification was successfully created.' }\n format.json { render json: @eve_notification, status: :created, location: @eve_notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @eve_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @noto = Noto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @noto }\n end\n end", "def create\n respond_to do |format|\n if @notifier.save\n format.html { redirect_to(@notifier, :notice => 'Kennisgever is succesvol aangemaakt.') }\n format.xml { render :xml => @notifier, :status => :created, :location => @notifier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @notifier.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @notify_me = current_app.notify_mes.new(params[:notify_me])\n if @notify_me.save\n render json: 'ok', status: 201\n else\n render json: {errors: @notify_me.errors }, status: 422\n end\n end", "def new\n @user = User.find(params[:user_id])\n @note = @user.notes.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @note }\n end\n end", "def create\n @notification = Notification.new(notification_params)\n if @notification.save\n Notifier.send_notification(@notification)\n render json: \"Created succesfully\", status: :ok\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def new\n @email_update = EmailUpdate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_update }\n end\n end", "def new\n @note = Note.new\n @options.merge!({url: [@project, @item, :notes]})\n\n respond_to do |format|\n format.html { render action: 'new', layout: @options[:layout] }\n format.json { render json: @note }\n end\n end", "def new\n @apn_notification = APN::Notification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @apn_notification }\n end\n end", "def new\n @notify_config = NotifyConfig.new\n\n add_breadcrumb('Create Notification Configuration')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notify_config }\n end\n end", "def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def new\n @repuestum = Repuestum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repuestum }\n end\n end", "def create\n @notification = Notification.new(notification_params)\n @notification.user_id = current_user.id\n @notification.read = false\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to notifications_path }\n else\n format.html { render :new }\n end\n end\n end", "def new\n @core_nota = Core::Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @core_nota }\n end\n end", "def new\n @todo_list = TodoList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo_list }\n end\n end", "def new\n @mail_check = MailCheck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mail_check }\n end\n end", "def new\n authorize! :create, NotificationTemplate.new\n\n @notification_template = NotificationTemplate.new\n @supported_events = Notifier.supported_events\n @supported_formats = Notifier.supported_formats\n #prepare some help text arrays for available tokens\n @available_tokens = self.notification_tokens\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notification_template }\n end\n end", "def new\n @pushup_reminder = @user.presence ? @user.pushup_reminders.build : PushupReminder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pushup_reminder }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=>@todo}\n end\n end", "def new\n @title = t('view.firms.new_title')\n @firm = Firm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @firm }\n end\n end", "def new\n @newsletter = Newsletter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newsletter }\n end\n end", "def notifications_new\n @notifications = Submission.includes(:user, :problem, followings: :user).where(visible: true).order(\"lastcomment DESC\").paginate(page: params[:page]).to_a\n @new = true\n render :notifications\n end", "def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n NotificationMailer.create(@notification.id).deliver_now\n format.html { redirect_to @notification, notice: \"Success! We will notify you at #{@notification.email} as new jobs are posted.\" }\n else\n format.html { render :new }\n end\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @invite = Invite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite }\n end\n end", "def new\n @announce = Announce.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce }\n end\n end", "def new\n @emailu = Emailu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @emailu }\n end\n end", "def show\n @notify = @course.notifies.find(params[:id])\n @notify.readed_times += 1\n @notify.save\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @notify }\n end\n end", "def new\n @mail_item = MailItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mail_item }\n end\n end", "def new\n @tip = Tip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip }\n end\n end", "def new\n @mail_typ = MailTyp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mail_typ }\n end\n end", "def new\n @invite_list = InviteList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_list }\n end\n end", "def new\n @new_review = NewReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_review }\n end\n end", "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def new\n @todo_task = TodoTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo_task }\n end\n end", "def new\n @mailing_list = MailingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mailing_list }\n end\n end", "def new\n @todo_list = TodoList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=>@todo_list}\n end\n end", "def create\n @note = @current_user.notes.create(note_params)\n render json: @note\n end", "def create\n @email_notification = EmailNotification.new(email_notification_params)\n\n respond_to do |format|\n if @email_notification.save\n format.html { redirect_to @email_notification, notice: 'Email notification was successfully created.' }\n format.json { render :show, status: :created, location: @email_notification }\n else\n format.html { render :new }\n format.json { render json: @email_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @nota = Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end", "def new\n @nota = Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @note }\n end\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @note }\n end\n end" ]
[ "0.72891724", "0.720788", "0.7190865", "0.71595454", "0.70646733", "0.7041957", "0.70204496", "0.6970532", "0.6970532", "0.6970532", "0.6970532", "0.69502145", "0.6931167", "0.6900661", "0.6889475", "0.6877958", "0.687424", "0.6851719", "0.68263197", "0.67974806", "0.6780711", "0.6747893", "0.6745281", "0.6741375", "0.67378634", "0.67364484", "0.67148685", "0.67062634", "0.6703364", "0.6690593", "0.6686691", "0.6685757", "0.6670637", "0.6665046", "0.66460156", "0.66460156", "0.6631247", "0.66312253", "0.6627711", "0.658471", "0.658309", "0.6557338", "0.65446925", "0.65446925", "0.65446925", "0.65446925", "0.65369314", "0.6516123", "0.65147483", "0.6501388", "0.65004826", "0.64915806", "0.64776325", "0.64762163", "0.64735204", "0.64675283", "0.64607817", "0.64524704", "0.64524704", "0.64524704", "0.64524704", "0.64524704", "0.6448322", "0.6435197", "0.64339197", "0.6416794", "0.6409321", "0.6400785", "0.6378341", "0.6376631", "0.63733065", "0.63651055", "0.6360343", "0.63393676", "0.6330318", "0.63299465", "0.6327199", "0.63268715", "0.6318538", "0.6310329", "0.6310329", "0.6310329", "0.63054514", "0.6301938", "0.6301315", "0.6295671", "0.62919825", "0.6288523", "0.62820405", "0.62785923", "0.6277774", "0.6273488", "0.62732995", "0.6271237", "0.62683386", "0.626178", "0.62577075", "0.62577075", "0.62528926", "0.62528926" ]
0.7662222
0
POST /notifies POST /notifies.json
def create @notify = Notify.new(params[:notify]) respond_to do |format| if @notify.save format.html { redirect_to @notify, notice: 'Notify was successfully created.' } format.json { render json: @notify, status: :created, location: @notify } else format.html { render action: "new" } format.json { render json: @notify.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify(params)\n client.post('/notify', params)\n end", "def create\n @notification = Notification.new(notification_params)\n if @notification.save\n Notifier.send_notification(@notification)\n render json: \"Created succesfully\", status: :ok\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end", "def create\n @notifier = Notifier.new(notifier_params)\n\n respond_to do |format|\n if @notifier.save\n format.html { redirect_to @notifier, notice: 'Notifier was successfully created.' }\n format.json { render :show, status: :created, location: @notifier }\n else\n format.html { render :new }\n format.json { render json: @notifier.errors, status: :unprocessable_entity }\n end\n end\n end", "def notify(interests, data = {})\n Request.new(\n @pusher_client,\n :post,\n url(\"/notifications\"),\n {},\n payload(interests, data)\n ).send_sync\n end", "def notify(interests, data = {})\n Request.new(\n @eventflit_client,\n :post,\n url(\"/publishes\"),\n {},\n payload(interests, data)\n ).send_sync\n end", "def create\n @notification = Notification.new(notification_params)\n\n if @notification.save\n render json: @notification\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end", "def post_notification(attributes)\n begin\n response = notifications_api.post(encode_json(attributes))\n [parse_json(response), nil]\n rescue RestClient::UnprocessableEntity => e\n [parse_json(e.response), InvalidNotification]\n rescue RestClient::Unauthorized\n [{}, Unauthorized]\n end\n end", "def create!(note)\n self.class.post('/notifications.xml', :body => note.to_xml)\n end", "def create_notification\n subject = \"#{student_request.name} \"\n body = \"#{student_request.name} (#{student_request.email}) needs tutorial.\"\n tutor_request.notify(subject, body, self)\n end", "def create\n @notify_me = current_app.notify_mes.new(params[:notify_me])\n if @notify_me.save\n render json: 'ok', status: 201\n else\n render json: {errors: @notify_me.errors }, status: 422\n end\n end", "def notify(data={})\n RestClient::Request.execute(:method => :post, :url => notify_path, :payload => data, :timeout => TIMEOUT, :open_timeout => TIMEOUT)\n rescue\n nil\n end", "def createNotification(user_id,subject, content, notification_key)\n parameters={id_user: (user_id).to_i, subject: subject.to_s, content: content.to_s, notification_key: notification_key.to_s, delivered: false, read: false}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4052/notifications\", options)\n return results\n end", "def create\n @email_reminder = EmailReminder.create_notice(email_reminder_params)\n respond_with @email_reminder\n end", "def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render :show, status: :created, location: @notification }\n else\n format.html { render :new }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notification = Notification.new(params[:notification])\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render json: @notification, status: :created, location: @notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @notifier.save\n format.html { redirect_to(@notifier, :notice => 'Kennisgever is succesvol aangemaakt.') }\n format.xml { render :xml => @notifier, :status => :created, :location => @notifier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @notifier.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n NotificationMailer.create(@notification.id).deliver_now\n format.html { redirect_to @notification, notice: \"Success! We will notify you at #{@notification.email} as new jobs are posted.\" }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @eve_notification = EveNotification.new(params[:eve_notification])\n\n respond_to do |format|\n if @eve_notification.save\n format.html { redirect_to @eve_notification, notice: 'Eve notification was successfully created.' }\n format.json { render json: @eve_notification, status: :created, location: @eve_notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @eve_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @email_notification = EmailNotification.new(email_notification_params)\n\n respond_to do |format|\n if @email_notification.save\n format.html { redirect_to @email_notification, notice: 'Email notification was successfully created.' }\n format.json { render :show, status: :created, location: @email_notification }\n else\n format.html { render :new }\n format.json { render json: @email_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render action: 'show', status: :created, location: @notification }\n else\n format.html { render action: 'new' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render action: 'show', status: :created, location: @notification }\n else\n format.html { render action: 'new' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @eventnotifier = Eventnotifier.new(eventnotifier_params)\n\n respond_to do |format|\n if @eventnotifier.save\n format.html { redirect_to @eventnotifier, notice: 'Eventnotifier was successfully created.' }\n format.json { render :show, status: :created, location: @eventnotifier }\n else\n format.html { render :new }\n format.json { render json: @eventnotifier.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_notification = AdminNotification.new(admin_notification_params)\n\n if @admin_notification.save\n render json: @admin_notification, status: :created, location: @admin_notification\n else\n render json: @admin_notification.errors, status: :unprocessable_entity\n end\n end", "def create(notifier_type_id, notifier_config, event_types)\n required = required_params(binding.send(:local_variables), binding)\n call(:post, path, :payload => {:required => required})\n end", "def create\n @note = @current_user.notes.create(note_params)\n render json: @note\n end", "def notification(method, *args)\n data = Request.new(method, args, nil).data\n RPC.log \"CLIENT ENCODE NOTIFICATION #{data.inspect}\"\n data.to_json\n end", "def create\n @user_notvenified = UserNotvenified.new(user_notvenified_params)\n\n respond_to do |format|\n if @user_notvenified.save\n format.html { redirect_to @user_notvenified, notice: 'User notvenified was successfully created.' }\n format.json { render :show, status: :created, location: @user_notvenified }\n else\n format.html { render :new }\n format.json { render json: @user_notvenified.errors, status: :unprocessable_entity }\n end\n end\n end", "def notification_params\n params.require(:notification).permit(:email)\n end", "def notification_params\n params.require(:notification).permit(:title, :ndesc)\n end", "def create\n @note = Note.new(note_params)\n if @note.save\n render json: @note, status: :created, location: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n\n end", "def post_notification( notification_type, from = nil, options={})\n attributes = {\n :info => options,\n :source_id => from.id,\n :target_id => id,\n :typenum => notification_type,\n :accepted => false\n }\n attributes[:source_id] = from.id if from\n notification = Notification.create( attributes )\n self.notifications_received << notification\n notification\n end", "def create\n @note = Note.new(note_params)\n if @note.save\n render json: @note, status: :created, location: note_url(@note)\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end", "def notification_params\n params.require(:notification).permit(:creator_id, :receiver_id, :post_id, :type, :title, :message, :read)\n end", "def create\n respond_with :api, :v1, Note.create(note_params)\n end", "def send_notifications\n send_new_post_to(:person) if self.person.notify_on_response_posted\n send_new_post_to(:receiver) if self.receiver && self.receiver.notify_on_response_received\n end", "def notifications_params\n params.require(:notification).permit(:requests, :invites, :users, :timeline, :notifier, :message, :queue)\n end", "def create\n @project = Project.find(@_params[:notification][:project_id].to_i)\n @notification = @project.notifications.build(notification_params)\n #@notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n # Tell the NotificationMailer to send a notification email after save\n NotificationMailer.new_notification_email(@project).deliver_now\n\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render :show, status: :created, location: @notification }\n else\n format.html { render :new }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def notification_params\n params.require(:notification).permit(:provider, :body, :user_id)\n end", "def create\n\n @detour = Detour.new(params[:detour])\n\n @detour.create_addr = request.remote_ip\n @detour.canceled = nil\n\n respond_to do |format|\n if @detour.save\n my_nrs = params[:@nrs]\n logger.info(\"Detours.create - Adding notifications\\n\")\n my_nrs.each_value do | nr |\n logger.info(\"Notification for location_id = \" + nr[:location_id] + \"\\n\")\n logger.info(\" notify = \" + nr[:notify] + \"\\n\")\n logger.info(\" acknowledge = \" + nr[:acknowledge] + \"\\n\")\n if nr[:notify].to_i == 1 \n # Look up the location and get the notification methods\n location = Location.find(nr[:location_id])\n logger.info(\" Location \" + nr[:location_id] + \" is known as \" + location.long_name + \"\\n\")\n if location.fax_default == 1 && ! location.fax_number.blank?\n notification = Notification.create(\n :detour_id => @detour.id,\n :location_id => nr[:location_id],\n :notification_type => \"DETON\",\n :notification_method => \"FAX\",\n :acknowledge_requested => nr[:acknowledge]\n )\n end\n if location.email_default == 1 && ! location.email_address.blank?\n notification = Notification.create(\n :detour_id => @detour.id,\n :location_id => nr[:location_id],\n :notification_type => \"DETON\",\n :notification_method => \"EMAIL\",\n :acknowledge_requested => nr[:acknowledge]\n )\n end\n if location.printer_default == 1 && ! location.printer.blank?\n notification = Notification.create(\n :detour_id => @detour.id,\n :location_id => nr[:location_id],\n :notification_type => \"DETON\",\n :notification_method => \"PRINTER\",\n :acknowledge_requested => nr[:acknowledge]\n )\n end\n if location.phone_default == 1 && ! location.phone_number.blank?\n notification = Notification.create(\n :detour_id => @detour.id,\n :location_id => nr[:location_id],\n :notification_type => \"DETON\",\n :notification_method => \"PHONE\",\n :acknowledge_requested => nr[:acknowledge]\n )\n end\n else\n logger.info(\" NO Notification requested for this location\")\n end\n end\n flash[:notice] = 'Detour was successfully created.'\n format.html { redirect_to(detours_url) }\n format.xml { render :xml => @detour, :status => :created, :location => @detour }\n else\n @locations = Location.find(:all)\n @nrs = Array.new\n @locations.each do |l|\n @nrs.push( NotificationRequest.new(l.id, l.short_name, l.long_name, l.notify_by_default))\n end\n format.html { render :action => \"new\" }\n format.xml { render :xml => @detour.errors, :status => :unprocessable_entity }\n end\n end\n end", "def notification(params)\n mail(params)\n end", "def notification_params\n params.require(:notification).permit( :title, :detail, :notification_type, :notification_data, :date, :remind_at, :location, :location_url, :created_by, :recurrence_data, :default_data, :form_name)\n end", "def create\n begin\n @notification = Notification.find_or_initialize_by(email: notification_params['email'])\n @notification.send_email_notification(notification_params) if @notification.valid?\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Mail has been sent successfully.' }\n format.json { render :show, status: :created, location: @notification }\n else\n format.html { render :new }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n rescue Exception => e\n @notification.errors.add(:base, JSON.parse(e.response)['message'])\n respond_to do |format|\n format.html { render :new }\n end\n end\n\n end", "def notification_params\n params.require(:notification).permit(:title, :description, :reference_date, :tipo, :seen, :de_usuario_id, :para_usuario_id, :id_item)\n end", "def create\n # @recived = {nombre: params[:nombre], email: params[:mail], mensaje: params[:mensaje] }\n user = User.find_by_email(params[:mail])\n if user\n @notification = Notification.new(from_type: \"contact\", from_id: user.id, message:\"#{params[:nombre]}:#{params[:mensaje]}\")\n respond_to do |format|\n if @notification.save\n format.json { render json: {created: @notification}}\n format.html { redirect_to @notification, notice: 'Email enviado correctamente' }\n else\n format.json { render json: {error: \"El email no pudo ser enviado: #{@notification.errors}\"}, status: :unprocessable_entity }\n format.html { redirect_to root_path, notice: \"El email no pudo ser enviado: #{@notification.errors}\" }\n end\n end\n else\n respond_to do |format|\n format.json { render json: {error: \"El email que nos has dado no esta registrado en nuestra aplicacion, por favor registrese y vuelva a intentarlo\"}, status: 401 }\n format.html { redirect_to root_path, notice: 'El email que nos has dado no esta registrado en nuestra aplicacion, por favor registrese y vuelva a intentarlo' }\n end\n end\n end", "def create\n @Notification = Notification.new(params[:note])\n @Notification.state = \"new\";\n \n respond_to do |format| \n format.html { render :action => \"new\" }\n format.xml { render :xml => @Notification.errors, :status => :created }\n end\n end", "def notify(data)\n puts data[:email]\n @body = data[:body]\n mail to: data[:email], subject: data[:subject]\n end", "def create\n @notificacione = Notificacione.new(notificacione_params)\n\n respond_to do |format|\n if @notificacione.save\n format.html { redirect_to @notificacione, notice: 'Notificacione was successfully created.' }\n format.json { render :show, status: :created, location: @notificacione }\n else\n format.html { render :new }\n format.json { render json: @notificacione.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @notify = @course.notifies.find(params[:id])\n @notify.readed_times += 1\n @notify.save\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @notify }\n end\n end", "def add_notification(notification)\n query_api_object Model::Notification, '/rest/notifications', notification.to_hash, 'POST'\n end", "def create\n @notification = Notification.new(notification_params)\n @notification.user_id = current_user.id\n @notification.read = false\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to notifications_path }\n else\n format.html { render :new }\n end\n end\n end", "def create\n Rails.logger.info \"CREATING NEW NOTE with params #{params}\"\n receiver = find_by_type_and_id(params[:receiver_type], params[:receiver_id])\n note = Note.new(:message => params[:message], :sender => current_profile, :private => params[:private_note], :receiver => receiver)\n if (reply_to_note_id = params[:reply_to_note_id])\n note.receiver = Note.find(reply_to_note_id).sender\n note.replied_to = reply_to_note_id\n end\n note.save! \n flash[:notice] = \"Your message has ben sent.\" \n render :text => {:message => \"Messsage Sent\" }.to_json\n rescue Exception => e\n flash[:errors] = \"There was an error sending your message, please try again.\"\n render :text => {:message => \"Unable to save message.\", :error => e.message }.to_json\n end", "def notification_params\n params.require(:notification).permit(:user_id, :tool_id, :sender, :title, :body)\n end", "def new\n respond_with @notification = @application.notifications.new\n end", "def notification_params\r\n\t\tparams.require(:notification).permit(:info, :seen, :user_id)\r\n\tend", "def notification_params\n params.require(:notification).permit(:user_id,:content, :note_id, :notificable_id, :notificable_type, :created_at, :updated_at, :is_read, :author )\n\n end", "def create\n @note = current_user.notes.build(params[:note])\n if @note.save\n flash[:notice] = 'Note was successfully created.'\n end\n respond_with(@note)\n end", "def create\n @notify_message = NotifyMessage.new(notify_message_params)\n\n respond_to do |format|\n if @notify_message.save\n format.html { redirect_to @notify_message, notice: \"Notify message was successfully created.\" }\n format.json { render :show, status: :created, location: @notify_message }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @notify_message.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event_note = EventNote.new(event_note_params)\n\n respond_to do |format|\n if @event_note.save\n format.html { redirect_to @event_note, notice: 'Event note was successfully created.' }\n format.json { render :show, status: :created, location: @event_note }\n else\n format.html { render :new }\n format.json { render json: @event_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n\t\t@notification = Notification.new(notification_params)\r\n\t\tif @notification.save\r\n\t\t\tAction.create(info: current_user.username + ' was sent this notification: (' + @notification.info + ').', user_email: current_user.email)\r\n\t\tend\r\n\tend", "def create\n @task_note = Note.new(params[:note])\n\n respond_to do |format|\n if @task_note.save\n format.html { redirect_to notes_path, notice: 'Task note was successfully created.' }\n format.json { render json: @task_note, status: :created, location: @task_note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @participant = Participant.new(participant_params)\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to \"/dynamics/#{@participant.dynamic.id}\", notice: '' }\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 if(User.all.where(email:\"[email protected]\").last.id!=nil)\n Notification.create :user_id => User.all.where(email:@participant.email).last.id , :text => \"you were added to dynamic #{@participant.dynamic.name}\", :estado => false\n end \n end\n end", "def notifications\n @campus_id = current_user.campus_users.first.campus_id\n invi_status=CRUD::Utility::Invitations.new(@campus_id)\n data = invi_status.get_request_sent\n render :json=>{:data=>data}\n end", "def send_post_notification(post)\n @post = post\n @post = post\n @poster = post.poster\n if @post.post_needs.size == 0\n @post_needs = []\n else\n @post_needs = @post.post_needs.alphabetical\n end\n recipients = @post.notify_emails\n\n if recipients != \"\"\n mail(:to => recipients, :subject => 'New Request at ' + post.street_1)\n end\n end", "def create\n @notification = Notification.new(params[:notification])\n # @notification.applicationd_id = @application.id\n @notification.save\n\n respond_with @notification\n end", "def create\n notification_params = params.slice(:to, :title, :body).merge(data: params[:data])\n\n @notification = Notification.find_or_create_by(pr_id: notification_params[:data][:ghprbPullId]) do |notification|\n notification.github_login = notification_params[:to]\n notification.title = notification_params[:title]\n notification.body = notification_params[:body]\n end\n\n data = []\n data = JSON.parse(@notification.data) if @notification.data\n @notification.data = process_notification_data(data, notification_params[:data]).to_json\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render :show, status: :created, location: @notification }\n else\n format.html { render :new }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n @note = Note.new(params_as_note_attributes_hash)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to(@note, :notice => 'Note was successfully created.') }\n format.json { render :json => @note, :status => :created, :location => @note }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @note.errors, :status => :unprocessable_entity }\n end\n end\n end", "def notification_params\n params.require(:notification).permit(:user_id, :title, :desc, :sender_id)\n end", "def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @description = self.pupil.title + \" has sadly declined your offer\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You hve declined the offer by ' + @tutor.title)\n else\n @description = self.pupil.title + \" is now a student at your school\"\n @notifiable.notifications.create(:user => @tutor ,:receiver_id => @student.id, :message => 'You are now a student of ' + @tutor.title)\n end\n @notifiable.notifications.create(:user => @student, :receiver_id => @tutor.id, :message => @description)\n end\n end", "def update\n if @notification.update(notification_params)\n render json: @notification\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end", "def create\n @kpi_notification = KpiNotification.new(kpi_notification_params)\n\n respond_to do |format|\n if @kpi_notification.save\n format.html { redirect_to @kpi_notification, notice: 'Kpi notification was successfully created.' }\n format.json { render :show, status: :created, location: @kpi_notification }\n else\n format.html { render :new }\n format.json { render json: @kpi_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(authToken, noteStore, note)\n\tcreatedNote = noteStore.createNote(authToken, note)\n\tputs \"Successfully created a new note with GUID: #{createdNote.guid}\"\nend", "def create\n @inform_mail = InformMail.new(params[:inform_mail])\n @inform_mail.sender = current_user\n respond_to do |format|\n if @inform_mail.save\n format.html { redirect_to inform_mails_url }\n format.json { render json: inform_mails_path(type: \"output\"), status: :created, location: @inform_mail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inform_mail.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_notify\n gcm_response = send_notification(params[:test_payload_to_send], params[:test_gcm_ids])\n\n render json: get_v1_formatted_response({}, true, [gcm_response[:response]]).to_json\n end", "def new\n @notify = Notify.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notify }\n end\n end", "def send_notifications\n end", "def notify_clients\n http_post(body: {data: @pids.to_json})\n end", "def push(notifications)\n notifications.each do |notif|\n notif.results = WNSConnection.post notif, @access_token, @options\n end\n end", "def notification_params\n params.require(:notification).permit(:user_id, :is_read, :title, :target_id, :target_type)\n end", "def create\n @notify_observer = NotifyObserver.new(params[:notify_observer])\n @notify_observer.save\n @properties = params[:notify_observer_properties]\n \n for property in @properties\n @notify_observer.notify_observer_properties.create(:name => property)\n end if @properties\n \n respond_to do |format|\n if @notify_observer.save\n format.html { redirect_to @notify_observer, :notice => 'Notify observer was successfully created.' }\n format.json { render :json => @notify_observer, :status => created, :location => @notify_observer }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @notify_observer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def notifications\n end", "def create\n @user_has_note = UserHasNote.new(user_has_note_params)\n\n respond_to do |format|\n if @user_has_note.save\n format.html { redirect_to @user_has_note, notice: 'User has note was successfully created.' }\n format.json { render :show, status: :created, location: @user_has_note }\n else\n format.html { render :new }\n format.json { render json: @user_has_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @note = current_user.notes.new(note_params)\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html { render :new }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def notification_params\n params.require(:notification).permit(:notification,:article)\n end", "def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n create_checkings(@notification)\n # Checking.create(user: current_user, notification: @notification)\n format.html { redirect_to @notification, notice: 'notification was successfully created.' }\n format.js\n format.json { render :show, status: :created, location: @notification }\n else\n format.html { render :new }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def note_params\n params.require(:note).permit(:prospect_id, :body, :user_id)\n end", "def create\n @notification = Notification.new(params[:notification])\n\n respond_to do |format|\n if @notification.save\n flash[:notice] = 'Notification was successfully created.'\n format.html { redirect_to(@notification) }\n format.xml { render :xml => @notification, :status => :created, :location => @notification }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @notification.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @notificacao = Notificacao.new(notificacao_params)\n\n respond_to do |format|\n if @notificacao.save\n format.html { redirect_to @notificacao, notice: 'Notificacao foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @notificacao }\n else\n format.html { render :new }\n format.json { render json: @notificacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n progress_note = ProgressNote.new(progress_note_params)\n\n if progress_note.save\n render json: serialize_progress_note(progress_note)\n else\n render json: { errors: progress_note.errors.full_messages }, status: 422\n end\n end", "def create\n if params[:question][:content].gsub(/[ \\t\\r\\n]/, '').length == 0\n respond_to do |format|\n format.json { render json: nil, status: :unprocessable_entity}\n end\n return\n end\n\n #@question = Question.new(params[:question])\n @question = current_user.questions.new(params[:question])\n @question.closed = false\n\n respond_to do |format|\n if @question.save\n #receiver = User.ne(_id: current_user).to_a.first\n receivers = User.ne(_id: current_user).to_a\n #notification = receiver.question_notifications.create!(:question_url => question_path(@question))\n #notification_data = {:url => notification_path(notification, :type => :q), :type => :q}\n #message = {:channel => '/notifications/users/' + receiver._id, :data => notification_data.to_json.html_safe}\n question_description = @question.content.truncate(20, separator: ' ')\n\n messages = []\n receivers.each do |receiver|\n if receiver.group == current_user.group\n notification = receiver.question_notifications.create!(:question_url => question_path(@question), :question_description => question_description)\n notification_data = {:url => notification_path(notification, :type => :q), :type => :q, :question_description => question_description}\n messages.push({:channel => '/notifications/users/' + receiver._id, :data => notification_data.to_json.html_safe})\n end\n end\n\n faye_uri = URI.parse(\"http://localhost:\" + TestMongoid::Application.config.faye_server_port.to_s + \"/faye\")\n Net::HTTP.post_form(faye_uri, :message => messages.to_json)\n\n #format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.html { redirect_to root_path, notice: 'Question was successfully created.' }\n format.json { render json: nil, status: :created}\n else\n #format.html { render action: \"new\" }\n format.html { redirect_to root_path, notice: 'Question was not created...' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def notification_params\n params.permit(:type, :judul, :text, :user_id)\n end", "def create\n @notification_count = NotificationCount.new(notification_count_params)\n\n if @notification_count.save\n render json: @notification_count, status: :created, location: @notification_count\n else\n render json: @notification_count.errors, status: :unprocessable_entity\n end\n end", "def create\n tag_value = subscription_params[\"user_entry\"]\n\n #If the tag_value is empty, we match everything, so build a notification for the entire Tell collection\n #Else search through Tell collection by subscription type, generating notifications for matching tags\n case subscription_params[\"subscription_type\"]\n #Type = title\n when \"0\"\n @subscription = current_user.subscriptions.build({\"title\"=>tag_value, \"subscription_type\"=>0})\n\n tells = Tell.where(title: tag_value)\n #Type = teller\n when \"1\"\n @subscription = current_user.subscriptions.build({\"teller\"=>tag_value, \"subscription_type\"=>1})\n\n tells = Tell.where(tellerName: tag_value)\n #Type = keyword\n when \"2\"\n @subscription = current_user.subscriptions.build({\"keyword\"=>tag_value, \"subscription_type\"=>2})\n\n tells = Tell.where(keyword: tag_value)\n else\n puts \"Something went wrong...\"\n end\n\n if tag_value == \"\"\n tells = Tell.all\n end\n \n tells.each do |tell|\n @subscription.notifications.build({\"tell_id\"=>tell.id})\n end\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription, notice: 'Subscription was successfully created.' }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def notification_params\n params.require(:notification).permit(:title, :message)\n end", "def notification_params\n params.require(:notification).permit(:title, :message)\n end", "def post_announcement\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/announcements/#{@announcement.id}\")\n mail to: @user.email, subject: \"[bootcamp] #{@announcement.user.login_name}さんからお知らせです。\"\n end", "def create\n @parent_to_teacher_notification = ParentToTeacherNotification.new(parent_to_teacher_notification_params)\n\n respond_to do |format|\n if @parent_to_teacher_notification.save\n format.html { redirect_to @parent_to_teacher_notification, notice: 'Parent to teacher notification was successfully created.' }\n format.json { render :show, status: :created, location: @parent_to_teacher_notification }\n else\n format.html { render :new }\n format.json { render json: @parent_to_teacher_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sale_note = Sale::Note.new(sale_note_params)\n\n respond_to do |format|\n if @sale_note.save\n format.html { redirect_to @sale_note, notice: 'Note was successfully created.' }\n format.json { render :show, status: :created, location: @sale_note }\n else\n format.html { render :new }\n format.json { render json: @sale_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def notifications\n @user = current_user\n @notifications.update_all(updated_at: Time.zone.now)\n respond_to do |format|\n format.html\n format.json\n end\n end", "def http_raw_notify_data\n {\n \"id\"=>\"b9879d2b-052f-4a0a-8a3f-3e72049e4d19\", \n \"event\"=>\"invoice_paid\", \n \"payload\"=> invoice_data\n }.to_json\n end", "def create\n @email = Email.new(email_params)\n\n respond_to do |format|\n if @email.save\n if @email.recipients\n recipients = @email.recipients.split(\",\")\n recipients.each { |r|\n Notifications.notify(r,@email.subject,@email.message).deliver_now\n }\n end\n\n\n format.html { redirect_to @email, notice: 'Email was successfully created.' }\n format.json { render :show, status: :created, location: @email }\n else\n format.html { render :new }\n format.json { render json: @email.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6908091", "0.6752805", "0.67457795", "0.66866416", "0.661315", "0.6523518", "0.6479741", "0.64321166", "0.6428187", "0.63793534", "0.63128704", "0.6279602", "0.6241167", "0.61394966", "0.61318505", "0.60862654", "0.60823995", "0.6075425", "0.6070833", "0.60698074", "0.60698074", "0.6048406", "0.6034101", "0.5999351", "0.5969558", "0.5952649", "0.5950627", "0.5932454", "0.5895968", "0.58947283", "0.5894434", "0.5884031", "0.5880617", "0.5864624", "0.5862972", "0.5829311", "0.58256", "0.581781", "0.58095783", "0.5785816", "0.57718277", "0.57620364", "0.5761802", "0.57614994", "0.57611847", "0.5759916", "0.5752243", "0.57484317", "0.5735375", "0.5735058", "0.5727559", "0.57217705", "0.5705049", "0.57049257", "0.56858176", "0.56773555", "0.56678915", "0.56642175", "0.5663862", "0.5662813", "0.56566924", "0.5653818", "0.56485707", "0.56482023", "0.56480646", "0.5641755", "0.56362796", "0.5620784", "0.5614587", "0.56128997", "0.5612107", "0.56084675", "0.5607658", "0.5607173", "0.560713", "0.56061226", "0.5605156", "0.5603961", "0.5601133", "0.55996317", "0.55977774", "0.5595441", "0.55938154", "0.559351", "0.5592959", "0.5591016", "0.5585608", "0.55855656", "0.5585432", "0.5578229", "0.5574091", "0.55687207", "0.5565045", "0.5565045", "0.55442077", "0.5543039", "0.5542085", "0.55414623", "0.55409944", "0.55407655" ]
0.6451875
7
PUT /notifies/1 PUT /notifies/1.json
def update @notify = Notify.find(params[:id]) respond_to do |format| if @notify.update_attributes(params[:notify]) format.html { redirect_to @notify, notice: 'Notify was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @notify.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateNotification\n read = convertToBoolean(read)\n delivered = convertToBoolean(delivered)\n\n parameters={id_user: params[:id_user].to_i, subject: params[:subject].to_s, content: params[:content].to_s, read: params[:read], delivered: params[:delivered] }\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n url = \"http://192.168.99.101:4052/notifications/\"+params[:id].to_s\n results = HTTParty.put(url.to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n if @notification.update(notification_params)\n render json: @notification\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @notifier.update(notifier_params)\n format.html { redirect_to @notifier, notice: 'Notifier was successfully updated.' }\n format.json { render :show, status: :ok, location: @notifier }\n else\n format.html { render :edit }\n format.json { render json: @notifier.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n note = Note.find(params[\"id\"])\n note.update_attributes(note_params)\n respond_with note, json: note\n end", "def show\n @notify = @course.notifies.find(params[:id])\n @notify.readed_times += 1\n @notify.save\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @notify }\n end\n end", "def update\n if @notification.update(notification_params)\n render json: \"Successfully updated\", status: :ok\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @notification.update(params.fetch(:notification, {}))\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification }\n else\n format.html { render :edit }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_seenNotification\n user = User.where(id: params[:idUser]).first\n token = params[:auth_token]\n if(user.auth_token == token)\n req = Notification.where(id: params[:idNotification]).first\n req.update(:seen=>true)\n\n\n render json: { status: 'SUCCESS', message: 'Notificacion actualizada' }, status: :ok\n else\n render json: { status: 'INVALID', message: 'Token invalido'}, status: :unauthorized\n end\n end", "def update\n notification = Notification.find(params[:id])\n notification.update(\n params.permit(:title, :description)\n )\n notification.active = false\n notification.save\n render json: notification\n end", "def update\n puts \"==========================\"\n puts \"UPDATE\"\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def incident_update(statuspage_id, incident_id, incident_details, current_status, current_state, notifications = 0, message_subject = \"Status Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n data['incident_details'] = incident_details\n data['current_status'] = current_status\n data['current_state'] = current_state\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'incident/update',\n :payload => data\n end", "def update\n respond_to do |format|\n if @notifier.update_attributes(params[:notifier])\n format.html { redirect_to(@notifier, :notice => 'Kennisgever is succesvol aangepast.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @notifier.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @note.update(note_params)\n render json: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @notification = Notification.find(params[:id])\n\n respond_to do |format|\n if @notification.update_attributes(params[:notification])\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @notification = Notification.find(params[:id])\n\n respond_to do |format|\n if @notification.update_attributes(params[:notification])\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.json { render :show, status: :ok, location: @notification }\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n else\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n format.html { render :edit }\n end\n end\n end", "def update\n @eve_notification = EveNotification.find(params[:id])\n\n respond_to do |format|\n if @eve_notification.update_attributes(params[:eve_notification])\n format.html { redirect_to @eve_notification, notice: 'Eve notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @eve_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @eventnotifier.update(eventnotifier_params)\n format.html { redirect_to @eventnotifier, notice: 'Eventnotifier was successfully updated.' }\n format.json { render :show, status: :ok, location: @eventnotifier }\n else\n format.html { render :edit }\n format.json { render json: @eventnotifier.errors, status: :unprocessable_entity }\n end\n end\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 @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 notify(params)\n client.post('/notify', params)\n end", "def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification }\n else\n format.html { render :edit }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification }\n else\n format.html { render :edit }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification }\n else\n format.html { render :edit }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification }\n else\n format.html { render :edit }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification }\n else\n format.html { render :edit }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification }\n else\n format.html { render :edit }\n format.json { render json: @notification.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 notifications\n @user = current_user\n @notifications.update_all(updated_at: Time.zone.now)\n respond_to do |format|\n format.html\n format.json\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 @notification = current_user.notifications.find(params[:id])\n\n respond_to do |format|\n if @notification.update_attributes(params[:notification])\n format.html { redirect_to(@notification, :notice => 'Notification was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @notification.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 @email_reminder.update(email_reminder_params)\n respond_with @email_reminder\n end", "def update\n @note = Note.find(params[:id])\n if @note.user == @current_user\n @note.update(note_params)\n render json: @note\n else\n render json: { error: \"No such note for user\" }, status: :unauthorized\n end\n end", "def update\n @notify_observer = NotifyObserver.find(params[:id])\n\n respond_to do |format|\n if @notify_observer.update_attributes(params[:notify_observer])\n format.html { redirect_to @notify_observer, notice: 'Notify observer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notify_observer.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 respond_to do |format|\n if @email_notification.update(email_notification_params)\n format.html { redirect_to @email_notification, notice: 'Email notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @email_notification }\n else\n format.html { render :edit }\n format.json { render json: @email_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @notification = current_user.notifications.where(id: params[:id]).first\n authorize @notification\n if @notification.update_attributes(notification_params)\n render 'show'\n else\n render(json: {errors: @notification.errors.messages}, status: 400)\n end\n end", "def update\n @admin_notification = AdminNotification.find(params[:id])\n\n if @admin_notification.update(admin_notification_params)\n head :no_content\n else\n render json: @admin_notification.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @notification2.update(notification2_params)\n format.html { redirect_to @notification2, notice: 'Notification2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification2 }\n else\n format.html { render :edit }\n format.json { render json: @notification2.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_notvenified.update(user_notvenified_params)\n format.html { redirect_to @user_notvenified, notice: 'User notvenified was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_notvenified }\n else\n format.html { render :edit }\n format.json { render json: @user_notvenified.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task_note = Note.find(params[:id])\n\n respond_to do |format|\n if @task_note.update_attributes(params[:note])\n format.html { redirect_to notes_path, notice: 'Task note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n\t\tif @notification.update(notification_params)\r\n\t\t\tAction.create(info: current_user.username + ' has seen this notification: (' + @notification.info + ').', user_email: current_user.email)\r\n\t\tend\r\n\tend", "def update_many\n if @admin_notifications.update_all(admin_notification_params)\n render json: @admin_notifications, status: :ok, location: admin_notifications_url\n else\n render json: @admin_notifications.errors, status: :unprocessable_entity\n end\n end", "def update\n @notification_count = NotificationCount.find(params[:id])\n\n if @notification_count.update(notification_count_params)\n head :no_content\n else\n render json: @notification_count.errors, status: :unprocessable_entity\n end\n end", "def update\n @notification = Notification.find(params[:id])\n respond_to do |format|\n if @notification.update_attributes(params[:notification])\n format.html { redirect_to notifications_path, notice: t(\"activerecord.models.notification\") + t(\"message.updated\") }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n push_notification(@notification.id, @notification.car.device_token, @notification.text)\n end", "def update\n if @todo.update(todo_params.merge!(updated_by_id: current_user.id))\n render json: @todo\n else\n render json: {errors: @todo.errors.full_messages}, status: 422\n end\n end", "def update\n @note.update(note_params)\n\n respond_to do |format|\n format.json { render json: flash.to_hash }\n end\n\n end", "def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params_as_note_attributes_hash)\n format.html { redirect_to(@note, :notice => 'Note was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @note.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 respond_to do |format|\n if @event_note.update(event_note_params)\n format.html { redirect_to @event_note, notice: 'Event note was successfully updated.' }\n format.json { render :show, status: :ok, location: @event_note }\n else\n format.html { render :edit }\n format.json { render json: @event_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.html { redirect_to @note, :notice => 'Contact was successfully updated.' }\n format.json { render :json => @note }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @note.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @notify_message.update(notify_message_params)\n format.html { redirect_to @notify_message, notice: \"Notify message was successfully updated.\" }\n format.json { render :show, status: :ok, location: @notify_message }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @notify_message.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kpi_notification.update(kpi_notification_params)\n format.html { redirect_to @kpi_notification, notice: 'Kpi notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @kpi_notification }\n else\n format.html { render :edit }\n format.json { render json: @kpi_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @notice = @person.notices.find(params[:id])\n\n respond_to do |format|\n if @notice.update_attributes(params[:notice])\n format.html { redirect_to person_notices_path( @person), notice: 'notice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @notification = Notification.find(params[:id])\n\n respond_to do |format|\n if @notification.update_attributes(params[:notification])\n flash[:notice] = 'Notification was successfully updated.'\n format.html { redirect_to(@notification) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @notification.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 @notification.update(notification_params)\n format.html { redirect_to root_path, notice: 'Mon notification a bien été mis à jour.' }\n format.json { render :show, status: :ok, location: @notification }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @alert = Alert.find(params[:id])\n notifiers = Hash.new\n User.find(params[:notifiers]).each{|user| notifiers[user.id] = 0}\n @alert.notifiers = notifiers\n @alert.host = params[:host]\n @alert.trigger = params[:trigger]\n respond_to do |format|\n if @alert.update_attributes(params[:alert])\n format.html { redirect_to @alert, notice: 'Alert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @todo.update(todo_params)\n head :no_content\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end", "def notify(interests, data = {})\n Request.new(\n @pusher_client,\n :post,\n url(\"/notifications\"),\n {},\n payload(interests, data)\n ).send_sync\n end", "def update\n @note = Note.find(params[:id])\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_has_note.update(user_has_note_params)\n format.html { redirect_to @user_has_note, notice: 'User has note was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_has_note }\n else\n format.html { render :edit }\n format.json { render json: @user_has_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @notion.update(notion_params)\n format.html { redirect_to @notion, notice: 'Notion was successfully updated.' }\n format.json { render :show, status: :ok, location: @notion }\n else\n format.html { render :edit }\n format.json { render json: @notion.errors, status: :unprocessable_entity }\n end\n end\n end", "def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # TODO: add push notification here\n pending_request = PendingTutorRequest.find(params[:id])\n accepted_request = AcceptedTutorRequest\n .create(pending_request.as_json(only: [:tutor_subject_id, :student_id, :tutor_id]))\n pending_request.destroy\n json_response(accepted_request, :ok)\n end", "def update\n respond_to do |format|\n if @notificacao.update(notificacao_params)\n format.html { redirect_to @notificacao, notice: 'Notificacao foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @notificacao }\n else\n format.html { render :edit }\n format.json { render json: @notificacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to Note, notice: 'Note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @to_do = ToDo.find(params[:id])\n\n if @to_do.update(params[:to_do])\n head :no_content\n else\n render json: @to_do.errors, status: :unprocessable_entity\n end\n end", "def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.html { redirect_to [@project, @item, @note], notice: \"#{Note.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project_note = ProjectNote.find(params[:id])\n\n if @project_note.update(project_note_params(params[:project_note]))\n head :no_content\n else\n render json: @project_note.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def notify(interests, data = {})\n Request.new(\n @eventflit_client,\n :post,\n url(\"/publishes\"),\n {},\n payload(interests, data)\n ).send_sync\n end", "def notify(data={})\n RestClient::Request.execute(:method => :post, :url => notify_path, :payload => data, :timeout => TIMEOUT, :open_timeout => TIMEOUT)\n rescue\n nil\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @note }\n else\n format.html { render action: 'edit' }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @to_do = ToDo.find(params[:id])\n\n if @to_do.update(to_do_params)\n head :no_content\n else\n render json: @to_do.errors, status: :unprocessable_entity\n end\n end", "def update\n @notice.update(notice_params)\n respond_to do |format|\n format.json { render action: 'show' }\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html do\n flash[:notice] = t('controllers.notes.update.success')\n redirect_to @note.contact || @note\n end\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note1.update(note1_params)\n format.html { redirect_to @note1, notice: \"Note1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @note1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @note1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note.update(note_params)\n format.html { redirect_to @note, notice: 'Note was successfully updated.' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { render :edit }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_add_and_remove_notification\n notification = {\n \"title\" => \"Test subject soon to be removed\",\n \"message\" => \"Hopefully deleted message!!\",\n \"email_address\" => \"Hopefully deleted e-mail address\"\n }\n\n # Make a new notification and then delete it\n notification_id = make_a_notification(notification)\n delete '/notification/' + notification_id\n assert_equal 204, last_response.status\n\n # Double check that it's gone\n get '/notification/' + notification_id\n assert_equal 404, last_response.status\n end", "def update\n respond_to do |format|\n if @tipo_notificacione.update(tipo_notificacione_params)\n format.html { redirect_to @tipo_notificacione, notice: 'Tipo notificacione was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_notificacione }\n else\n format.html { render :edit }\n format.json { render json: @tipo_notificacione.errors, status: :unprocessable_entity }\n end\n end\n end", "def updated\n @notification = Notification.find(params[:id])\n\n # dispatches call to private method (if implemented)\n send(@notification.event) if respond_to?(@notification.event, true)\n\n @notification.destroy\n render json: {}, status: :ok\n end", "def create\n @notifier = Notifier.new(notifier_params)\n\n respond_to do |format|\n if @notifier.save\n format.html { redirect_to @notifier, notice: 'Notifier was successfully created.' }\n format.json { render :show, status: :created, location: @notifier }\n else\n format.html { render :new }\n format.json { render json: @notifier.errors, status: :unprocessable_entity }\n end\n end\n end", "def refreshnotify\n @title = \"\"\n\n puts '====================== refreshnotify'\n\n current_user.update_attributes!(:notify => \"NO\")\n @user = current_user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :user=>@user.as_json(:only => [:id, :name, :email, :invitation_token, :notify, :buddy, :gender, :displayname], :methods => [:photo_url]) \n } }\n end\n end", "def update\n authorize! :edit, @notification_template\n\n @supported_events = Notifier.supported_events\n @supported_formats = Notifier.supported_formats\n respond_to do |format|\n if @notification_template.update_attributes(params[:notification_template])\n format.html { redirect_to(@notification_template, :notice => I18n.t(:'notification_template.notices.updated')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @notification_template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @note = Note.find(params[:id])\n\n # Warning. jQuery doesn't validate \"head :ok\" as valid without (for example) 'dataType: \"html\"'.\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n SyncLog.note_update(@note.graph.id, @note, params[:clientId])\n format.xml { head :ok }\n else\n format.xml { render :xml => @note.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @note = Note.find(params[:id])\n\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.html { redirect_to @note, notice: 'Документ успешно обновлен.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n note = Note.find(params[:id])\n\n\tif note.update_attributes(params[:note])\n\t\trender :json => { :success => :true } \n else\n\t\trender :json => { :success => :false, :errors => errors }\n end\n #respond_to do |format|\n # if @note.update_attributes(params[:note])\n # format.html { redirect_to(@note, :notice => 'Note was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @note.errors, :status => :unprocessable_entity }\n # end\n #end\n end" ]
[ "0.650636", "0.6337263", "0.6284009", "0.61724764", "0.61609596", "0.60869235", "0.6076981", "0.6038033", "0.6009348", "0.5997258", "0.5989609", "0.5981908", "0.596619", "0.5934886", "0.5934886", "0.5934886", "0.5931656", "0.5931656", "0.59255636", "0.5918346", "0.5913821", "0.5885304", "0.5856943", "0.58448625", "0.58356977", "0.58356977", "0.58356977", "0.58356977", "0.58356977", "0.58356977", "0.5822779", "0.57884043", "0.57840145", "0.5783493", "0.5781413", "0.5779991", "0.577522", "0.57650834", "0.57176393", "0.5715696", "0.57032686", "0.56994", "0.5682926", "0.5638458", "0.5633852", "0.5609869", "0.55660576", "0.5559495", "0.55438274", "0.55383635", "0.55342525", "0.5529666", "0.5528842", "0.5527616", "0.55246645", "0.55092734", "0.55004036", "0.54916954", "0.5484842", "0.54837745", "0.5474083", "0.5466806", "0.54613715", "0.5459436", "0.5456303", "0.544381", "0.54437757", "0.54335403", "0.54326665", "0.5429358", "0.5427942", "0.54209244", "0.54200834", "0.5417922", "0.54119045", "0.5411224", "0.5405698", "0.54048115", "0.5404699", "0.54045236", "0.5402399", "0.5402336", "0.54000616", "0.53989464", "0.53949505", "0.53949505", "0.53949505", "0.53949505", "0.53949505", "0.53949505", "0.53949505", "0.539185", "0.5386031", "0.53843623", "0.53842837", "0.5381462", "0.5377305", "0.5365585", "0.5365064", "0.53638184" ]
0.6129593
5
DELETE /notifies/1 DELETE /notifies/1.json
def destroy @notify = Notify.find(params[:id]) @notify.destroy respond_to do |format| format.html { redirect_to notifies_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @notification = Notification.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notifier.destroy\n respond_to do |format|\n format.html { redirect_to notifiers_url, notice: 'Notifier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@notification = Notification.find(params[:id])\n #@notification.destroy\n\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end", "def delete\n @notification = Users::Notification.find_by_id(params[:id])\n @notification.set_status_deleted\n\n respond_to do |format|\n format.html { redirect_to notification_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @eve_notification = EveNotification.find(params[:id])\n @eve_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to eve_notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to app_notifications_url, notice: 'Notifiation was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification = current_user.notifications.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to(notifications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def delete_Notification\n dest = Notification.where(id: params[:idNotification]).first\n if (dest) \n Notification.where(id: params[:idNotification]).destroy_all\n render json: { status: 'SUCCESS', message: 'ELIMINACION EXITOSA'}, status: :ok\n else\n render json: { status: 'INVALID', message: 'NOTIFICACION NO ENCONTRADA'}, status: :unauthorized\n end\n end", "def destroy\n client = current_user.find_client(params[:client_id])\n @notification = client.notifications.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to client_notifications_url(client) }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notifier.destroy\n\n respond_to do |format|\n format.html { redirect_to(notifiers_url, :notice => 'Kennisgever is succesvol ontkoppeld.') }\n format.xml { head :ok }\n end\n end", "def destroy\n @notification = Notification.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to notifications_url }\n end\n end", "def destroy\n @notify_observer = NotifyObserver.find(params[:id])\n @notify_observer.destroy\n\n respond_to do |format|\n format.html { redirect_to notify_observers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @notification.destroy\n send_success_json(@notification.id, {:msg => \"deleted\"})\n else\n send_error_json(@notification.id, \"delete_error\", 400)\n end\n end", "def destroy\n @notification = @application.notifications.find(params[:id])\n @notification.destroy\n\n respond_with @notification\n end", "def destroy\n @notification = Notification.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to(notifications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n head :no_content \n end", "def call(id)\n client.delete(\"/api/rest/v1/notifications/#{id}.json\")\n true\n end", "def test_add_and_remove_notification\n notification = {\n \"title\" => \"Test subject soon to be removed\",\n \"message\" => \"Hopefully deleted message!!\",\n \"email_address\" => \"Hopefully deleted e-mail address\"\n }\n\n # Make a new notification and then delete it\n notification_id = make_a_notification(notification)\n delete '/notification/' + notification_id\n assert_equal 204, last_response.status\n\n # Double check that it's gone\n get '/notification/' + notification_id\n assert_equal 404, last_response.status\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @email_notification.destroy\n respond_to do |format|\n format.html { redirect_to email_notifications_url, notice: 'Email notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @inform_mail.destroy\n respond_to do |format|\n format.html { redirect_to inform_mails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to project_notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @eventnotifier.destroy\n respond_to do |format|\n format.html { redirect_to eventnotifiers_url, notice: 'Eventnotifier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_with Note.destroy(params[:id])\n end", "def destroy\n @notification2.destroy\n respond_to do |format|\n format.html { redirect_to notification2s_url, notice: 'Notification2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to noticias_notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @detour = Detour.find(params[:id])\n @detour.notifications.each do |n|\n logger.info(\"Deleteing notification \" + n.id.to_s + \" for detour \" + @detour.id.to_s + \"\\n\")\n n.destroy\n end\n @detour.destroy\n\n respond_to do |format|\n format.html { redirect_to(detours_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to(notes_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n \n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_note = Note.find(params[:id])\n @task_note.destroy\n\n respond_to do |format|\n format.html { redirect_to task_notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note1.destroy\n respond_to do |format|\n format.html { redirect_to note1s_url, notice: \"Note1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notify_message.destroy\n respond_to do |format|\n format.html { redirect_to notify_messages_url, notice: \"Notify message was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: t('controllers.notes.destroy.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification_count.destroy\n\n head :no_content\n end", "def destroy\n @email_reminder.destroy\n respond_with @email_reminder\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to incoming_notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @doctor_notification.destroy\n respond_to do |format|\n format.html { redirect_to doctor_notifications_url, notice: 'Doctor notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n teacher_exclusive\n @note.delete\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'La note a été suprimée' }\n format.json { head :no_content }\n end\n end", "def destroy\n @parent_to_teacher_notification.destroy\n respond_to do |format|\n format.html { redirect_to parent_to_teacher_notifications_url, notice: 'Parent to teacher notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reminder.destroy\n respond_to do |format|\n format.html { redirect_to reminders_url, notice: 'Lembrete excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_notification.destroy\n\n head :no_content\n end", "def destroy\n @payment_notification = PaymentNotification.find(params[:id])\n @payment_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'Note successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to participant_path(@participant), notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notificacione.destroy\n respond_to do |format|\n format.html { redirect_to notificaciones_url, notice: 'Notificacione was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pushup_reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to pushup_reminders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inform_mail = InformMail.find(params[:id])\n @inform_mail.destroy\n\n respond_to do |format|\n format.html { redirect_to inform_mails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n \n @note.destroy\n\n respond_to do |format|\n format.html { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @notificationtype.destroy\n respond_to do |format|\n format.html { redirect_to moderator_notificationtypes_url, notice: 'Notificationtype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @apn_notification = APN::Notification.find(params[:id])\n @apn_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to(apn_notifications_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n notice = \"#{Note.name} was successfully removed.\"\n\n respond_to do |format|\n format.html { redirect_to [@project, @item, :notes] }\n format.json { render json: {msg: notice} }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @job_notification = JobNotification.find(params[:id])\n @job_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to job_notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @push_notification = PushNotification.find(params[:id])\n @push_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to push_notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notify_config = NotifyConfig.find(params[:id])\n @notify_config.destroy\n\n respond_to do |format|\n format.html { redirect_to notify_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @delivery_note = DeliveryNote.find(params[:id])\n @delivery_note.destroy\n\n respond_to do |format|\n format.html { redirect_to delivery_notes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @reminder.destroy\n respond_to do |format|\n format.html { redirect_to reminders_url, notice: 'Reminder was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kpi_notification.destroy\n respond_to do |format|\n format.html { redirect_to kpi_notifications_url, notice: 'Kpi notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reminder.destroy\n respond_to do |format|\n format.html { redirect_to reminders_url, notice: \"Reminder was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @alarm_notification = AlarmNotification.find(params[:id])\n @alarm_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to alarm_notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notification_type = NotificationType.find(params[:id])\n @notification_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(notification_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tipo_notificacione.destroy\n respond_to do |format|\n format.html { redirect_to tipo_notificaciones_url, notice: 'Tipo notificacione 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 @note.destroy\n respond_to do |format|\n format.html do\n redirect_to event_data_path,\n notice: 'Note was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "def destroy\n \n \n #remove notification \n #remove plots \n\n\n if [email protected]_id\n notifications = Journal.where(notification_type: \"StoryCreate\", notification_id: @tale.id)\n notifications.each do|notification|\n notification.delete\n end \n\n\n @tale.destroy\n\n\n\n\n\n\n respond_to do |format|\n #format.html { redirect_to tales_url }\n format.html { redirect_to profiles_index_path(current_user.id) }\n format.json { head :no_content }\n end\n end\n\n\n end", "def destroy\n @note = @user.notes.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to(notes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dormer_notification.destroy\n respond_to do |format|\n format.html { redirect_to dormer_notifications_url, notice: 'Dormer notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_notifications\n @tutor = Tutor.find(params[:id])\n Notification.where(user_type: 'Tutor', user_id: @tutor.id).destroy_all\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to notes_url, notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notice = Notice.find(params[:id])\n @notice.destroy\n\n respond_to do |format|\n format.html { redirect_to person_notices_path( @person) }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to curso_notes_path(params[:curso_id]), notice: 'Nota eliminada correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_reminder = UserReminder.find(params[:id])\n @user_reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_reminders_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @communication_note.destroy\n respond_to do |format|\n format.html { redirect_to communication_notes_url, notice: 'Communication note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @notes_list.destroy\n respond_to do |format|\n format.html { redirect_to @note, notice: 'Notes list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @to_do_note.destroy\n respond_to do |format|\n format.html { redirect_to to_do_notes_url, notice: 'To do note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.72010946", "0.7198548", "0.7174811", "0.71705055", "0.71705055", "0.71705055", "0.71705055", "0.7150994", "0.7103595", "0.7074628", "0.7058735", "0.70096505", "0.6997625", "0.69692254", "0.6960587", "0.69497055", "0.6943368", "0.69406766", "0.6911222", "0.691012", "0.6909212", "0.69088995", "0.69088995", "0.69088995", "0.69088995", "0.69088995", "0.69039994", "0.68902147", "0.68164873", "0.6774563", "0.67646414", "0.67271525", "0.6711791", "0.66906106", "0.6684064", "0.6682833", "0.66611683", "0.66435224", "0.66412467", "0.66395754", "0.6636045", "0.659881", "0.6596185", "0.6596185", "0.65961045", "0.6587913", "0.6586916", "0.6586867", "0.6584561", "0.65836346", "0.6581035", "0.6580933", "0.6575684", "0.6574051", "0.6574051", "0.6574051", "0.6574051", "0.655988", "0.65538734", "0.65533924", "0.6552049", "0.65435255", "0.6543513", "0.6533325", "0.6528462", "0.6528421", "0.6527177", "0.6509515", "0.6503299", "0.6503161", "0.6500412", "0.64992684", "0.6496284", "0.6493858", "0.6489671", "0.64876217", "0.6487032", "0.6486092", "0.6485686", "0.6484911", "0.6483046", "0.6482566", "0.6480554", "0.64776915", "0.6473455", "0.6468642", "0.64677495", "0.64665383", "0.64557326", "0.6454809", "0.6450945", "0.6450945", "0.6450945", "0.6450945", "0.6441273", "0.64357394", "0.6425872", "0.6420858", "0.6417339", "0.64106536" ]
0.7402391
0
Define batch operation inside a block
def initialize &blk @writers = [] instance_exec &blk if block_given? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch\n yield if block_given?\n end", "def batch(*args, &block)\n raise \"Block required!\" unless block_given?\n do_op(:batch, *args, &block)\n end", "def batch(*args, &block)\n raise \"Block required!\" unless block_given?\n do_op(:batch, *args, &block)\n end", "def batch(*args, &block)\n self.instance_exec(*args, &block)\n end", "def batch\n req = create_batch_request\n if block_given?\n yield req\n req.execute\n else\n req\n end\n end", "def each(&block)\n @batch_queue.each(&block)\n end", "def multi(&block); end", "def batch arg = nil\n if arg\n # Backward compatibility\n return scoped.batch(arg)\n else\n raise ArgumentError, \"Block not given\" unless block_given?\n end\n b = BatchAction.send(:new, self, @mutation)\n yield b\n results = Array.new(b.actions.length).to_java\n process = lambda do\n results.each_with_index do |r, idx|\n action = b.actions[idx]\n type = action[:type]\n case type\n when :get\n action[:result] = (r.nil? || r.empty?) ? nil : Row.send(:new, self, r)\n when :append\n action[:result] = r && Row.send(:new, self, r).to_h\n when :increment\n action[:result] = r &&\n Row.send(:new, self, r).to_h.tap { |h|\n h.each do |k, v|\n h[k] = Util.from_bytes :fixnum, v unless v.is_a?(Fixnum)\n end\n }\n else\n case r\n when java.lang.Exception\n action[:result] = false\n action[:exception] = r\n when nil\n action[:result] = false\n else\n action[:result] = true\n end\n end\n end\n b.actions\n end\n\n begin\n htable.batch b.actions.map { |a| a[:action] }, results\n process.call\n rescue Exception => e\n raise HBase::BatchException.new(e, process.call)\n end\n end", "def process(cursor, batch) end", "def batch\n mon_synchronize do\n begin\n original, @client = @client, SSDB::Batch.new\n yield(self)\n @client.values = original.perform(@client)\n ensure\n @client = original\n end\n end\n end", "def batch\n mon_synchronize do\n begin\n original, @client = @client, SSDB::Batch.new\n yield(self)\n @client.values = original.perform(@client)\n ensure\n @client = original\n end\n end\n end", "def run_batch\n make_run_batch_call\n end", "def each(&block)\n @all.each_batch { |batch| batch.each { |s| yield s } }\n end", "def process_blocks(blocks); end", "def batch\n job && job.batch\n end", "def process_batch(batch)\n call([], :process_batch, batch.__calls)\n end", "def run_bulk; end", "def perform(&block)\n raise Exception.new(\"You must have at least 2 requests\") unless @requests.length > 1\n @responses.clear\n requests.each_slice(Limit).to_a.each do |batch|\n body = {\n :batch => Yajl::Encoder.encode(batch),\n :access_token => Baloo.client_credentials\n }\n Client.post(\"/\", :body => body).each do |response|\n # response['headers'] = Yajl::Parser.parse(response['headers'])\n response['body'] = Yajl::Parser.parse(response['body'])\n yield response\n end\n end\n end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def blocks() end", "def script_do_in_batches(options = {}, &block)\n start = Time.now\n count_options = options.reject {|k,v| %w(order select batch_size sleep logger).include?(k.to_s)}\n item_count = count(count_options)\n iteration = 1\n do_in_batches(options) do |record|\n msg = \"#{iteration} of #{item_count} (#{(iteration.to_f / item_count * 100).round(2)}%)\"\n puts \"#{record.id.to_s.ljust(10)} #{msg.ljust(30)} time #{Time.now - start}\"\n yield(record)\n iteration += 1\n end\n puts \"Finished in #{Time.now - start} s\"\n end", "def execute(&block)\n\tblock\nend", "def execute(&block)\n\tblock\nend", "def callBlock\n yield ,\n end", "def exec__batch *args\n batch_commands *args\n end", "def batch(serial_only=false)\n @batch_request=true\n Thread.current[:facebooker_current_batch_queue]=[]\n yield\n # Set the batch request to false so that post will execute the batch job\n @batch_request=false\n BatchRun.current_batch=Thread.current[:facebooker_current_batch_queue]\n post(\"facebook.batch.run\",:method_feed=>BatchRun.current_batch.map{|q| q.uri}.to_json,:serial_only=>serial_only.to_s)\n ensure\n @batch_request=false\n BatchRun.current_batch=nil\n end", "def blocks; end", "def blocks; end", "def blocks; end", "def exec__batch_generator batch_generator\n batch_commands batch__from_batch_generator batch_generator\n end", "def as_block\n lambda do |rec|\n call(rec)\n end\n end", "def batch(&block)\n # NOTE: the use of 'self.staging' is quite important in this method.\n\n # write current index to git-staging-index\n idx = self.staging? ? self.staging : nil\n idx.sync if idx\n\n # replace current index with an in-mem staging index\n unstage\n self.staging=StageMemIndex.read(self)\n\n begin\n yield staging if block_given?\n\n rescue Exception => e\n # ensure index is discarded if there is a problem\n unstage\n self.staging if idx\n raise e\n end\n\n # write in-mem staging index to git-staging-index\n self.staging.force_sync\n\n # read git-staging-index if appropriate\n unstage\n self.staging if idx\n end", "def process(&block); end", "def batch(*spec)\n Batch.new(self, spec.flatten)\n end", "def execute(&block)\r\n block\r\nend", "def execute(block)\n block.call\nend", "def execute(block)\n block.call\nend", "def execute(block)\n block.call\nend", "def execute(block)\n block.call\nend", "def execute(block)\n block.call\nend", "def execute(block)\n block.call\nend", "def execute(block)\n block.call\nend", "def perform(&block); end", "def batch_new\n end", "def ddl_batch\n raise Google::Cloud::FailedPreconditionError, \"No block given for the DDL batch\" unless block_given?\n begin\n start_batch_ddl\n yield\n run_batch\n rescue StandardError\n abort_batch\n raise\n ensure\n @ddl_batch = nil\n end\n end", "def execute(&block)\n # block\n block.call\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def run(&block)\n case @sproc_type\n when :select, :all\n all(&block)\n when :first\n first\n when :insert\n insert\n when :update\n update\n when :delete\n delete\n end\n end", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend", "def execute(&block)\n\tblock.call\nend", "def execute(&block)\n\tblock.call\nend", "def execute(&block)\n\tblock.call\nend", "def execute(&block)\n\tblock.call\nend", "def execute(&block)\n block.call \nend", "def each_row_batch_by_sql(sql, options={}, &block)\n options = {:connection => self.connection}.merge(options)\n cursor = PostgreSQLCursor::Cursor.new(sql, options)\n return cursor.each_row_batch(&block) if block_given?\n cursor.iterate_batched\n end", "def multiple_batch!(operations, opts = {})\n response = multiple_batch(operations, opts)\n\n response.wait(opts)\n end", "def each_row(batch = ETL::Batch.new)\n @rows_processed = 0\n @data.each do |h|\n h = h.clone\n transform_row!(h)\n yield h\n @rows_processed += 1\n end\n end", "def bulk(records)\n records_array = Array(records)\n\n bulk_delay(records_array)\n\n yield\n\n bulk_queue(records_array)\n end", "def transaction(&block)\n yield\n end", "def transaction(&block)\n yield\n end", "def execute(&block)\n block.call\n end", "def execute(&block)\n block.call\n end", "def each( & block )\n \n return atomic_cursor.each( & block )\n\n end", "def execute(&block)\n block.call\nend" ]
[ "0.81389767", "0.76496035", "0.76496035", "0.73745054", "0.7248513", "0.72482705", "0.72371423", "0.6968127", "0.6911174", "0.68711305", "0.68711305", "0.6754351", "0.6674515", "0.6655991", "0.6643987", "0.66007435", "0.65276766", "0.64920634", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.645385", "0.6433654", "0.63693863", "0.6363313", "0.6363313", "0.6270603", "0.6259265", "0.62373555", "0.62279594", "0.62279594", "0.62279594", "0.6226233", "0.6221477", "0.621116", "0.6197474", "0.619391", "0.61898345", "0.61599827", "0.61599827", "0.61599827", "0.61599827", "0.61599827", "0.61599827", "0.61599827", "0.61511636", "0.61498237", "0.61410016", "0.61311513", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6120812", "0.6116889", "0.611334", "0.611334", "0.61055326", "0.61055326", "0.61055326", "0.61050886", "0.6079241", "0.60681546", "0.6060745", "0.60423374", "0.60256815", "0.60186744", "0.60186744", "0.60059696", "0.60059696", "0.59907585", "0.59848195" ]
0.0
-1
Define a write operation for the batch.
def write filenames, values, options={} w = MultiExiftool::Writer.new(filenames, values, options) @writers << w end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write\n command :write\n self\n end", "def write\n write_data\n end", "def add_write(key, value, binary = false)\n if (@is_commit)\n raise RuntimeError.new('No further request supported after a commit!')\n end\n @requests << {'write' => {key => JSONConnection.encode_value(value, binary)}}\n self\n end", "def write\n end", "def write; end", "def write; end", "def bulk_write(operations, options = {})\n BulkWrite.get(self, operations, options).execute\n end", "def write!(_)\n raise NotImplementedError, 'Implement #write! in child class'\n end", "def set_write(policy, operation, key, bins)\n begin_cmd\n field_count = estimate_key_size(key, policy)\n\n predexp_size = estimate_predexp(policy.predexp)\n field_count += 1 if predexp_size > 0\n\n exp_size = estimate_expression_size(@policy.filter_exp)\n field_count += 1 if exp_size > 0\n\n bins.each do |bin|\n estimate_operation_size_for_bin(bin)\n end\n\n size_buffer\n\n write_header_with_policy(policy, 0, INFO2_WRITE, field_count, bins.length)\n write_key(key, policy)\n write_predexp(policy.predexp, predexp_size)\n write_filter_exp(@policy.filter_exp, exp_size)\n\n bins.each do |bin|\n write_operation_for_bin(bin, operation)\n end\n\n end_cmd\n mark_compressed(policy)\n end", "def write object, index\n raise NotImplementedError\n end", "def write(&block)\n @write_block = block\n end", "def write\n raise \"Writers must implement #write\"\n end", "def write(method, path, body = {}, opts = {})\n request(WRITE, method, path, body, opts)\n end", "def write_method\n @write_method ||= Proc.new do |name, buff|\n File.write(name, buff, mode: 'w')\n end\n end", "def call_write(data, openclose = true)\n if options[:delta]\n wf.write_delta(data, openclose)\n else\n wf.write(data, openclose)\n end\n end", "def save_operation\n self.writeable_attributes\n end", "def write?; end", "def write?; end", "def write?; end", "def close_write() end", "def close_write() end", "def close_write() end", "def write(_request, _response)\n raise NotImplementedError, 'Implement this method in your strategy'\n end", "def write(data)\n end", "def bulk_write(requests, options = {})\n BulkWrite.new(self, requests, options).execute\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_date_time_value(\"lastActionDateTime\", @last_action_date_time)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_string_value(\"operation\", @operation)\n writer.write_string_value(\"status\", @status)\n writer.write_additional_data(@additional_data)\n end", "def writer\n @writer ||= begin\n if @batching\n batch_size = (@batching == true) ? Kithe.indexable_settings.batching_mode_batch_size : @batching\n @local_writer = true\n Kithe.indexable_settings.writer_instance!(\"solr_writer.batch_size\" => batch_size)\n end\n end\n end", "def write(data, *args, **kwd); end", "def write(*data); end", "def write(data); end", "def write(data); end", "def write(data); end", "def write(data); end", "def commit\n writer.commit\n end", "def close_write(*) end", "def write(*args)\n @writer.<<(*args) if @writer\n end", "def write( socket, operation, arg = nil )\n socket.write( [ 42 ].pack( \"C\" ) ) # magic num\n socket.write( [ 137 ].pack( \"C\" ) ) # magic num\n socket.write( [ operation ].pack( \"C\" ) ) # op byte (0 | 1 | 2)\n if not arg.nil?\n socket.write( [ arg.length ].pack( \"L\" ) )\n socket.write( arg )\n end\nend", "def write(key, value)\n perform_update(:write, key, value.to_s)\n end", "def write( &block )\n compile!( :write!, &block )\n end", "def write\n raise \"Nodes must implement #write\"\n end", "def open_for_write\n end", "def write(chunk)\n # chunk is a Fluent::MemoryBufferChunk or Fluent::FileBufferChunk.\n validate_token\n # Send the events in bulk if possible.\n if @monasca_log_api_client.supports_bulk?\n write_bulk chunk\n else\n write_single chunk\n end\n end", "def write(value)\n record.send(\"#{name}_data=\", value)\n end", "def write= w\n @write = (w == 1) ? 1 : 0\n end", "def close_write; end", "def write\n row.set_attribute(attr_name, contents)\n end", "def commit_writes!\n raise 'this kind of worksheet does not require writes to be committed'\n end", "def set_operate(policy, key, args)\n begin_cmd\n field_count = estimate_key_size(key, policy)\n\n predexp_size = estimate_predexp(policy.predexp)\n field_count += 1 if predexp_size > 0\n\n exp_size = estimate_expression_size(policy.filter_exp)\n field_count += 1 if exp_size > 0\n\n @data_offset += args.size\n\n size_buffer\n\n write_header_with_policy(policy, args.read_attr, args.write_attr, field_count, args.operations.length)\n write_key(key, policy)\n write_predexp(policy.predexp, predexp_size)\n write_filter_exp(policy.filter_exp, exp_size)\n\n args.operations.each do |operation|\n write_operation_for_operation(operation)\n end\n\n end_cmd\n mark_compressed(policy)\n end", "def <<(item)\n @batch << item\n end", "def bulk_writer request_threads: nil, batch_threads: nil, retries: nil\n BulkWriter.new self, @service, request_threads: request_threads,\n batch_threads: batch_threads, retries: retries\n end", "def perform_write(command)\n @tcp_socket.send(command.to_bytes.pack('C*'), 0)\n end", "def write(points = [], openclose = manage_conn, prefix = nil)\n writer.write(points, openclose, prefix)\n end", "def record_write bytes\n @reader.record_write bytes, @state\n end", "def write_metadata; end", "def writer\n @writer ||= lookup_operation_handler(:write_register)\n end", "def pending_write?; end", "def _do_write(io)\n instantiate_all\n @field_objs.each { |f| f.do_write(io) }\n end", "def write(key, value, options = {})\n options = merged_options(options)\n\n invoke(:write, key) do |store|\n write_entity(key, value, store, options)\n end\n end", "def docs_to_write; end", "def write(record)\n @worker.enqueue record\n end", "def write(data=nil,headers={})\n #raise SyntaxException, \"No data was provided for object '#{@name}'\" if (data.nil?)\n # Try to get the content type\n raise SyntaxException, \"No data or header updates supplied\" if (data.nil? and headers.empty?)\n if headers['Content-Type'].nil?\n type = MIME::Types.type_for(self.name).first.to_s\n if type.empty?\n headers['Content-Type'] = \"application/octet-stream\"\n else\n headers['Content-Type'] = type\n end\n end\n response = self.container.connection.cfreq(\"PUT\",@storagehost,\"#{@storagepath}\",headers,data)\n raise InvalidResponseException, \"Invalid content-length header sent\" if (response.code == \"412\")\n raise MisMatchedChecksumException, \"Mismatched etag\" if (response.code == \"422\")\n raise InvalidResponseException, \"Invalid response code #{response.code}\" unless (response.code == \"201\")\n make_path(File.dirname(self.name)) if @make_path == true\n self.populate\n true\n end", "def direct_write action, field, params={}\n opts = {:single_quoted => false}\n params = {\n :query => {\n \"ClientToken\" => self.token,\n \"Action\" => Type::String.safe_value(action, opts),\n \"PK_Field\" => Type::String.safe_value(field, opts),\n \"Call_ID\" => Type::String.safe_value(params[:call_id], opts),\n \"pk_id\" => Type::String.safe_value(params[:pk_id], opts),\n \"Values\" => (params[:values].to_json if params[:values]),\n \"Leave_Open\" => Type::String.safe_value(params[:leave_open], opts),\n \"Rationale\" => Type::String.safe_value(params[:rationale], opts)\n }\n }\n\n put 'direct_write.php', params\n end", "def seq_write_cmd\n 'fio --name=write --numjobs=1 --ioengine=sync --rw=write --bs=4k --size=1g --direct=1 --refill_buffers=1 --filename=fio.tmp'\n end", "def write(instance, title, string, &block)\n framework = instance.configuration.framework\n example = framework.current_example\n\n node_keys = get_titles_for(\n framework,\n example\n )\n\n framework.write(\n instance,\n example,\n node_keys,\n title,\n string,\n &block\n )\n end", "def define_write_method(attr_name)\n evaluate_attribute_method attr_name, \"def #{attr_name}=(new_value);write_attribute('#{attr_name}', new_value);end\", \"#{attr_name}=\"\n end", "def _do_write(io)\n raise NotImplementedError\n end", "def record_write bytes, state=nil\n begin\n do_record_write bytes, state\n rescue\n nil\n end\n end", "def write(chunk)\n # dummy\n end", "def write(entry)\n raise NotImplementedError\n end", "def write(entry)\n raise NotImplementedError\n end", "def save_journal(operation, changes = {})\r\n if operation == :delete\r\n @record.attributes.each { |k, v| changes[k] = v }\r\n end\r\n changes.except!('created_at', 'updated_at', 'created_by', 'updated_by')\r\n\r\n if (operation != :update) || changes.size > 0\r\n # determine site_id\r\n site_id = @record.site_id if @record && @record.respond_to?('site_id')\r\n site_id = dc_get_site._id if site_id.nil? && dc_get_site\r\n\r\n DcJournal.create(site_id: site_id,\r\n operation: operation,\r\n user_id: session[:user_id],\r\n tables: params[:table],\r\n ids: params[:ids],\r\n doc_id: params[:id],\r\n ip: request.remote_ip,\r\n time: Time.now,\r\n diff: changes.to_json)\r\n end\r\nend", "def write(value)\n # pass\n end", "def set_write\n @write = Write.find(params[:id])\n end", "def write\n @id = store.put(self)\n end", "def writer; end", "def write!(value = true)\n @write = value\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_string_value(\"actionName\", @action_name)\n writer.write_enum_value(\"actionState\", @action_state)\n writer.write_date_time_value(\"lastUpdatedDateTime\", @last_updated_date_time)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_additional_data(@additional_data)\n end", "def write_stream_declaration(index, name, type, registry, metadata)\n do_write do\n Logfiles.write_stream_declaration(wio, index, name, type, registry, metadata)\n end\n\tend", "def write_record ids, attributes, options = {}\n remote.write ids, attributes, options[:context]\n end", "def write(arg0)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_collection_of_object_values(\"resourceActions\", @resource_actions)\n writer.write_additional_data(@additional_data)\n end", "def store_in_batch(batch)\n batch.set(firestore_doc_id, serialized_for_firestore)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_primitive_values(\"allowedResourceActions\", @allowed_resource_actions)\n writer.write_string_value(\"condition\", @condition)\n writer.write_collection_of_primitive_values(\"excludedResourceActions\", @excluded_resource_actions)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_additional_data(@additional_data)\n end", "def write(buf, *args)\n Polyphony.backend_write(self, buf, *args)\n end", "def batch_write_item(request_options)\n request_options[:request_items].each do |table_name, requests|\n table = get_table(table_name)\n\n requests.each do |request_hash|\n if request_hash[:put_request]\n item = request_hash[:put_request][:item].symbolize_keys\n hash_key_value = item[hash_key_attr]\n if range_key_attr.present?\n range_key_value = item[range_key_attr]\n table[hash_key_value] = {} if table[hash_key_value].nil?\n table[hash_key_value][range_key_value] = item\n else\n table[hash_key_value] = item\n end\n else\n item = request_hash[:delete_request][:key]\n id = item[hash_key_attr]\n table.delete(id)\n end\n end\n end\n end", "def write_path\n @write_path ||= ::Brainstem::ApiDocs.write_path\n end", "def write_example\n path.open(\"w\") { |file| file << EXAMPLE }\n path.chmod(0600)\n end", "def write(input)\r\n target.write input\r\n self\r\n end", "def perform( handle, data, offset=0 )\n @handle = handle\n @offset = offset\n @data = data\n @pos = 0\n\n @driver.write( nil, handle, offset, data[0,CHUNK_SIZE] )\n end", "def write(chunk, last_chunk = T.unsafe(nil)); end", "def write(chunk, last_chunk = T.unsafe(nil)); end", "def write(chunk, last_chunk = T.unsafe(nil)); end", "def write(chunk, last_chunk = T.unsafe(nil)); end", "def write!( event )\n # Not implemented\n end", "def write(handle, offset, data)\n send_request(FXP_WRITE, :string, handle, :int64, offset, :string, data)\n end", "def define_writer!(k, definition)\n define_method(\"#{k}=\") do |value|\n # Recursively convert hash and array of hash to schematized objects\n value = ensure_schema value, definition[:schema]\n\n # Initial value\n instance_variable_set \"@#{k}\", value\n\n # Dirty tracking\n self.changed_attributes ||= Set.new\n self.changed_attributes << k\n end\n end", "def <<(mutation)\n @batch_queue << mutation\n if @queue_size > 0 and @batch_queue.length >= @queue_size\n begin\n @cassandra.flush_batch(@options)\n ensure\n @batch_queue = []\n end\n end\n end", "def write\n ensure_data_bag_exists\n\n result = locks.new(\n id: data_bag_id,\n type: type,\n name: name,\n client_name: client_name,\n process_id: Process.pid,\n time: Time.now\n ).save\n\n lock_manager.register(Actor.current)\n\n result\n rescue\n lock_manager.unregister(Actor.current)\n end", "def write(string, *smth)\n #This is a stub, used for indexing\n end", "def write data\n _data[:out].write data\n _data[:out].flush\n end", "def operation(*_)\n raise 'not implemented'\n end" ]
[ "0.66145045", "0.6332422", "0.6292489", "0.625028", "0.6101671", "0.6101671", "0.6004967", "0.5946159", "0.5926048", "0.5915748", "0.5846598", "0.57803243", "0.5725235", "0.5703362", "0.5661108", "0.56598943", "0.5652876", "0.5652876", "0.5652876", "0.5652799", "0.5652799", "0.5652799", "0.56443006", "0.5623331", "0.5608541", "0.55950105", "0.5590892", "0.55906004", "0.5582846", "0.55718595", "0.55718595", "0.55718595", "0.55718595", "0.55714494", "0.55711174", "0.5565158", "0.55626386", "0.55499303", "0.55493385", "0.5543008", "0.5542455", "0.55237514", "0.5514819", "0.5513025", "0.5475774", "0.54677427", "0.5437162", "0.5435379", "0.5428129", "0.5426546", "0.5406482", "0.54012835", "0.53969616", "0.53912634", "0.5389703", "0.5371392", "0.53652203", "0.5352886", "0.53518", "0.53334504", "0.5331211", "0.5322895", "0.5316897", "0.5314528", "0.5296689", "0.52923024", "0.5291953", "0.529181", "0.5288461", "0.5288461", "0.52810174", "0.5278907", "0.52747285", "0.5272", "0.5267601", "0.52628934", "0.52580327", "0.5251679", "0.5249136", "0.5243732", "0.5238517", "0.52358997", "0.5227571", "0.5223715", "0.52232385", "0.52052826", "0.5201731", "0.51993287", "0.5193554", "0.51807433", "0.51807433", "0.51807433", "0.51807433", "0.5174064", "0.51709145", "0.5166802", "0.5164195", "0.51489747", "0.5128485", "0.51268744", "0.51240456" ]
0.0
-1
Getting the commandline arguments which would be executed when calling write. It could be useful for logging, debugging or whatever.
def exiftool_args @writers.map {|w| w.exiftool_args + ['-execute']}.flatten end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arguments\n arguments = visit_node_for_arguments([], root, false)\n # Don't specify -write for the last output file.\n arguments[-2] == '-write' or\n raise \"[BULLDOG BUG]: expected second last argument to be -write in: #{arguments.inspect}\"\n arguments.delete_at(-2)\n arguments\n end", "def arguments\n @args ||= {}\n unless @args.size > 0\n ARGV.each_with_index do |arg, index|\n if arg.start_with?('-')\n if index + 1 < ARGV.size\n next_arg = ARGV[index + 1]\n if next_arg.start_with?('-') then\n @args.update(argument_present_or_direct(arg))\n else\n @args.update(arg => next_arg)\n end\n else\n @args.update(argument_present_or_direct(arg))\n end\n end\n end\n end\n @args\n end", "def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end", "def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end", "def arguments\n tailing_args = tailing_non_options\n\n if tailing_args.any? { |arg| arg[0,1] == '-' }\n tailing_args.unshift('--')\n end\n\n return leading_non_options + options + tailing_args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n return args\n end", "def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n return args\r\n end", "def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n return args\r\n end", "def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n \r\n return args\r\n end", "def argv; end", "def command_arguments(options={})\n args = []\n args.concat(['--type', options[:type].to_s]) if options[:type]\n args.concat(['--line-break', options[:line_break].to_s]) if options[:line_break]\n args.concat(['--charset', options[:charset].to_s]) if options[:charset]\n\n if options[:type].to_s == 'js'\n args << '--nomunge' unless options[:munge]\n args << '--preserve-semi' if options[:preserve_semicolons]\n args << '--disable-optimizations' unless options[:optimize]\n end\n\n args\n end", "def spawn_args\n result = Array.new\n unless environment.empty?\n result << environment\n end\n result.concat(command_line)\n opts = Hash.new\n opts[:chdir] = directory.to_s unless directory.nil?\n opts[:pgroup] = pgroup unless pgroup.nil?\n opts[:umask] = umask unless umask.nil?\n opts[:unsetenv_others] = unsetenv_others unless unsetenv_others.nil?\n opts[:close_others] = close_others unless close_others.nil?\n rlimit.each do |key, value|\n opts[\"rlimit_#{key}\".to_sym] = value\n end\n redirection.each do |key, value|\n opts[key] = value\n end\n result << opts\n result\n end", "def get_target_args\n\t\t\targs = ARGV.reject {|arg| arg =~ /^-/ || Rake::Task.task_defined?(arg) }\n\t\t\treturn args\n\t\tend", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # this measure does not require any user arguments, return an empty list\n\n return args\n end", "def getArguments\n\n\t# Parse the arguments\n\ttheArgs = { :clang => false,\n\t\t\t\t:rewrite => false,\n\t\t\t\t:help => false,\n\t\t\t\t:paths => [],\n\t\t\t\t:exclude => [] }\n\n\ttheParser = OptionParser.new do |opts|\n\t\topts.banner = \"Usage:\\n rn-format [--help] [--clang] [--rewrite] [--exclude=PATH] PATH [PATH...]\";\n\t\topts.separator \"\";\n\t\topts.separator \"Reformat any source files within the supplied paths,\";\n\t\topts.separator \"displaying the results to standard output.\";\n\t\topts.separator \"\";\n\t\topts.separator \"Options:\";\n\n\t\topts.on('--clang',\t\t\t\t\t\t'Show raw clang-format output') do\n\t\t\ttheArgs[:clang] = true;\n\t\tend\n\n\t\topts.on('--rewrite',\t\t\t\t\t'Rewrite files in-place') do\n\t\t\ttheArgs[:rewrite] = true;\n\t\tend\n\n\t\topts.on('--exclude=PATH',\t\t\t\t'Exclude a path') do |thePath|\n\t\t\ttheArgs[:exclude] << File.expand_path(thePath);\n\t\tend\n\n\t\topts.on('--help',\t\t\t\t\t\t'Show the help') do\n\t\t\ttheArgs[:help] = true;\n\t\tend\n\tend\n\n\ttheParser.parse!;\n\ttheArgs[:paths] = ARGV;\n\n\n\n\t# Show the help\n\tif (theArgs[:help] || theArgs[:paths].empty?)\n\t\tputs theParser.help();\n\t\texit(false);\n\tend\n\t\n\treturn theArgs;\n\nend", "def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n # this measure does not require any user arguments, return an empty list\n return args\n end", "def args\n defined_args = []\n self.class.init_args.keys.each do | arg |\n if arg_val = send(arg)\n defined_args << \":#{arg} => #{arg_val}\"\n end\n end\n defined_args.join(\",\\n\")\n end", "def argv; argline.split(/ +/) unless argline.nil?; end", "def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # this measure does not require any user arguments, return an empty list\n\n return args\n end", "def arguments\n parser.arguments\n end", "def arguments\n @arguments ||= Launchr::OrderedHash.new\n @arguments\n end", "def arguments\n \"\"\n end", "def arguments()\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n # todo - add bool arguments to decide what tables to generate, default all to true.\r\n\r\n return args\r\n end", "def extract_arguments!\n return ARGV[0], nil, nil if ARGV.length == 1\n\n raise(ArgumentError, \"Usage: mixtape-bu SOURCE [CHANGES] [DEST]\") unless ARGV.length == 3\n\n ARGV.take(3)\nend", "def args\n raw_args\n end", "def vars(argv = [])\n argv\n end", "def cmd(options={})\n arguments\n end", "def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # url of the city database\n city_db_url = OpenStudio::Measure::OSArgument.makeStringArgument('city_db_url', true)\n city_db_url.setDisplayName('City Database Url')\n city_db_url.setDescription('Url of the City Database')\n city_db_url.setDefaultValue('')\n args << city_db_url\n\n # project id to update\n project_id = OpenStudio::Measure::OSArgument.makeStringArgument('project_id', true)\n project_id.setDisplayName('Project ID')\n project_id.setDescription('Project ID to generate reports for.')\n project_id.setDefaultValue('0')\n args << project_id\n\n # datapoint id to update\n datapoint_id = OpenStudio::Measure::OSArgument.makeStringArgument('datapoint_id', true)\n datapoint_id.setDisplayName('Datapoint ID')\n datapoint_id.setDescription('Datapoint ID to generate reports for.')\n datapoint_id.setDefaultValue('0')\n args << datapoint_id\n\n return args\n end", "def cmdline\n begin\n # The arguments are separated by nulls (\\000) - Substitute it\n # with spaces, which is way more human.\n File.read(\"/proc/#{@pid}/cmdline\").gsub /\\000/, ' '\n rescue Errno::ENOENT\n nil\n end\n end", "def to_shellwords\n argv = []\n argv << %[--autopath] if autopath?\n argv << %[--verbose] if verbose?\n argv << %[--format=\"#{format}\"] if format\n argv << %[--chdir=\"#{chdir}\"] if chdir\n argv << %[--tags=\"#{tags.join(';')}\"] unless tags.empty?\n argv << %[--match=\"#{match.join(';')}\"] unless match.empty?\n argv << %[--units=\"#{units.join(';')}\"] unless units.empty?\n argv << %[--loadpath=\"#{loadpath.join(';')}\"] unless loadpath.empty?\n argv << %[--requires=\"#{requires.join(';')}\"] unless requires.empty?\n argv << files.join(' ') unless files.empty?\n argv\n end", "def arguments()\n args = OpenStudio::Measure::OSArgumentVector.new\n\n #make an argument for the frequency\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"RunPeriod\"\n arg = OpenStudio::Measure::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n arg.setDisplayName(\"Reporting Frequency\")\n arg.setDefaultValue(\"Hourly\")\n args << arg\n\n #make an argument for including optional output variables\n arg = OpenStudio::Measure::OSArgument::makeBoolArgument(\"inc_output_variables\", true)\n arg.setDisplayName(\"Include Output Variables\")\n arg.setDefaultValue(false)\n args << arg\n\n return args\n end", "def args(argv)\n Docopt.docopt(docopt, version: @version, argv:argv)\n end", "def args\n return [] unless options[\"args\"]\n options[\"args\"].map do |options|\n Argument.new options\n end\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # this measure will require arguments, but at this time, they are not known\n geometry_profile = OpenStudio::Ruleset::OSArgument::makeStringArgument('geometry_profile', true)\n geometry_profile.setDefaultValue(\"{}\")\n os_model = OpenStudio::Ruleset::OSArgument::makeStringArgument('os_model', true)\n os_model.setDefaultValue('multi-model mode')\n user_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('user_id', true)\n user_id.setDefaultValue(\"00000000-0000-0000-0000-000000000000\")\n job_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('job_id', true)\n #job_id.setDefaultValue(SecureRandom.uuid.to_s)\n ashrae_climate_zone = OpenStudio::Ruleset::OSArgument::makeStringArgument('ashrae_climate_zone', false)\n ashrae_climate_zone.setDefaultValue(\"-1\")\n building_type = OpenStudio::Ruleset::OSArgument::makeStringArgument('building_type', false)\n building_type.setDefaultValue(\"BadDefaultType\")\n\n args << geometry_profile\n args << os_model\n args << user_id\n args << job_id\n args << ashrae_climate_zone\n args << building_type\n\n return args\n end", "def args(args = [])\n args << \"--out=#{::File.basename(r.path)}\"\n args << \"--dir=#{::File.dirname(r.path)}\"\n args << \"--checksum=sha-256=#{r.checksum}\" if r.checksum\n args << \"--header='#{r.header}'\" if r.header\n args << \"--check-certificate=#{r.check_cert}\"\n args << \"--file-allocation=falloc\"\n args << \"--max-connection-per-server=#{r.connections}\"\n args << r.source\n end", "def commander _args\n \"commander _args;\" \n end", "def to_s\n @argv.join(' ')\n end", "def arguments(workspace)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n return args\n end", "def arguments(workspace)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n return args\n end", "def args()\n #This is a stub, used for indexing\n end", "def args\n Mysh.parse_args(cooked_body)\n end", "def extract_args(*args)\n options = args.extract_options!\n if options.length.positive?\n [args.pop, options.fetch(:keys) { [] }, options.fetch(:argv) { [] }]\n else\n keys, argv = args.shift(2)\n keys ||= []\n argv ||= []\n [args.pop, keys, argv]\n end\n end", "def args\n @args.args\n end", "def exiftool_args\n fail MultiExiftool::Error, 'No filenames.' if filenames.empty?\n cmd = []\n cmd << Writer.mandatory_args\n cmd << options_args\n cmd << values_args\n cmd << filenames\n cmd.flatten\n end", "def processCommandLineOptions\n if ARGV\n ARGV.each do |arg|\n if arg.index('=')\n setting, value = arg.split('=')\n setting = setting.chomp\n value = value.chomp.strip\n if setting == 'logLevel'\n value = value.upcase.gsub(/\\'/,'')\n level = LEVELS_TEXT.index(value.upcase)\n @currentLogLevel = level if level\n elsif setting == 'consoleLogging'\n @consoleLogging = value.downcase == 'true'\n elsif setting == 'logfile'\n @currentFileName = File.expand_path(value)\n end\n end\n end\n end\n end", "def parse_arguments\n @arguments = ARGV.collect { |arg| arg.strip }\n @filename = Pathname.new(@arguments.first)\n end", "def to_argv\n flags = []\n each do |f,v|\n m = f.to_s.size == 1 ? '-' : '--'\n case v\n when Array\n v.each{ |e| flags << \"#{m}#{f}='#{e}'\" }\n when true\n flags << \"#{m}#{f}\"\n when false, nil\n # nothing\n else\n flags << \"#{m}#{f}='#{v}'\"\n end\n end\n flags\n end", "def arguments\r\n args = OpenStudio::Ruleset::OSArgumentVector.new\r\n\r\n #make choice argument for facade\r\n choices = OpenStudio::StringVector.new\r\n choices << \"MessagePack\"\r\n choices << \"CSV\"\r\n choices << \"Both\"\r\n output_format = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(\"output_format\", choices)\r\n output_format.setDisplayName(\"Output Format\")\r\n output_format.setDefaultValue(\"Both\")\r\n args << output_format\r\n\r\n args\r\n end", "def commandGetOut _args\n \"commandGetOut _args;\" \n end", "def args() return @args end", "def arguments()\n args = OpenStudio::Measure::OSArgumentVector.new\n \n #make an argument for the frequency\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Detailed\"\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"Runperiod\"\n reporting_frequency = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName(\"Reporting Frequency\")\n reporting_frequency.setDefaultValue(\"Hourly\")\n args << reporting_frequency\n \n # TODO: argument for subset of output meters\n \n return args\n end", "def arguments()\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument to toggle QAQC\n run_sim_settings_checks = OpenStudio::Measure::OSArgument.makeBoolArgument('run_sim_settings_checks', true)\n run_sim_settings_checks.setDisplayName('Run Checks')\n run_sim_settings_checks.setDescription('If set to true, will run the measure, which adds output variables and increases runtime.')\n run_sim_settings_checks.setDefaultValue(false)\n args << run_sim_settings_checks\n return args\n end", "def arguments\n Properties[self.class] ||= {}\n return Properties[self.class][:args] || []\n end", "def args\n @x.args.uniq\n end", "def arguments(model = nil)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n return args\n end", "def options\n @options ||= args.dig(:options) || {}\n end", "def to_args\n args = [\n \"--name \\\"#{name}\\\"\",\n \"--version \\\"#{version}\\\"\",\n \"--user \\\"#{user}\\\"\",\n \"--group \\\"#{group}\\\"\",\n \"--iteration \\\"#{iteration}\\\"\",\n \"--homepage \\\"#{homepage}\\\"\",\n \"--home \\\"#{home}\\\"\",\n \"--architecture \\\"#{architecture}\\\"\",\n \"--description \\\"#{description}\\\"\",\n \"--maintainer \\\"#{maintainer}\\\"\",\n \"--vendor \\\"#{vendor}\\\"\"\n ]\n args.push \"--dependencies #{dependencies.map{|d| \"\\\"#{d}\\\"\"}.join}\" unless dependencies.nil? || dependencies.empty?\n args.push \"--build-dependencies #{build_dependencies.map{|d| \"\\\"#{d}\\\"\"}.join}\" unless build_dependencies.nil? || build_dependencies.empty?\n args.push \"--compile-cache-dir \\\"#{compile_cache_dir}\\\"\" unless compile_cache_dir.nil? || compile_cache_dir.empty?\n args.push \"--before-precompile \\\"#{before_precompile}\\\"\" unless before_precompile.nil? || before_precompile.empty?\n args.push \"--after-precompile \\\"#{after_precompile}\\\"\" unless after_precompile.nil? || after_precompile.empty?\n args.push \"--before-install \\\"#{before_install}\\\"\" unless before_install.nil? || before_install.empty?\n args.push \"--after-install \\\"#{after_install}\\\"\" unless after_install.nil? || after_install.empty?\n args.push \"--before-remove \\\"#{before_remove}\\\"\" unless before_remove.nil? || before_remove.empty?\n args.push \"--after-remove \\\"#{after_remove}\\\"\" unless after_remove.nil? || after_remove.empty?\n\n args.push \"--license \\\"#{license}\\\"\" unless license.nil? || license.empty?\n args.push \"--buildpack \\\"#{buildpack}\\\"\" unless buildpack.nil? || buildpack.empty?\n args.push \"--buildpack_list \\\"#{buildpack_list}\\\"\" unless buildpack_list.nil? || buildpack_list.empty?\n args.push \"--force-os \\\"#{force_os}\\\"\" unless force_os.nil? || force_os.empty?\n args.push \"--runner \\\"#{runner}\\\"\" unless runner.nil? || runner.empty?\n args.push \"--logrotate-frequency \\\"#{logrotate_frequency}\\\"\" unless logrotate_frequency.nil? || logrotate_frequency.empty?\n args.push \"--logrotate-backlog \\\"#{logrotate_backlog}\\\"\" unless logrotate_backlog.nil?\n args.push \"--env #{env.variables.map{|v| \"\\\"#{v}\\\"\"}.join(\" \")}\" if env.present?\n args.push \"--auto\" if auto\n args.push \"--verbose\" if verbose\n args.push \"--store-cache\" if store_cache\n args.push \"--debug\" if debug\n args.push \"--verify\" if verify\n args.push \"--no-clean\" if !clean\n args.push \"--no-edge\" if !edge\n args.push \"--tmpdir\" if !tmpdir\n args\n end", "def initialize(argv = [])\n @arguments ||= argv\n end", "def parse_arguments\n @command_line_options = {}\n @config.insert 0, '<command_line>', @command_line_options\n\n @options = OptionParser.new do |opts|\n opts.on('-a', '--application STRING', 'set application name') do |application|\n @command_line_options[:application] = application\n end\n\n opts.on('-d', '--destination DIR', 'set destination directory', \"default: #{@config[:destination_directory]}\") do |directory|\n @command_line_options[:destination_directory] = directory\n end\n\n opts.on('-n', '--dryrun', 'do not switch') do\n @command_line_options[:dryrun] = true\n end\n\n opts.on('-V', '--version STRING', 'set application version to deploy') do |version|\n @command_line_options[:version] = version\n end\n end\n @options.parse!\n end", "def options_arguments\n @options_arguments ||= Launchr::OrderedHash.new\n @options_arguments\n end", "def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument to toggle QAQC\n run_qaqc = OpenStudio::Measure::OSArgument.makeBoolArgument('run_qaqc', true)\n run_qaqc.setDisplayName('Run QAQC?:')\n run_qaqc.setDescription('If set to true, will run this QAQC measure, adding in many substantial output variables.')\n run_qaqc.setDefaultValue(false)\n args << run_qaqc\n\n return args\n end", "def arguments\n return @arguments\n end", "def get_args( from: '', required: false, default_value: [], comment: '' )\n cmd_options = @options['command_line_options'][from]\n # Auto documentation of this option\n @doc.push \"Option to pass arguments from: #{from},\\tdefault_value :#{default_value},\\tcomment :#{comment}\"\n if cmd_options.class == Array\n cmd_options = cmd_options.join ' '\n cmd_options = \"\\\"#{cmd_options}\\\"\" # return with quotes\n else\n @errors.push \" Arguments option #{from} should be an Array. #{cmd_options.class} found\"\n end\n end", "def text_from_args\n\t\t\treturn ARGV.join(' ').gsub(\"\\t\",'')\n\t\tend", "def args\n @args\n end", "def build_args\n if File.exist? build_info_file\n build_info = File.readlines build_info_file\n build_info = build_info.map {|x| x.strip }\n build_info.delete \"\"\n build_info\n else\n []\n end\n end", "def get_log_args\n args = {}\n args[\"APP_UUID\"] = @application.uuid if @application\n args[\"DOMAIN\"] = (@application.domain_namespace if @application) || (@domain.namespace if @domain)\n args\n end", "def effectiveCommander _args\n \"effectiveCommander _args;\" \n end", "def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for the variable name\n variable_name = OpenStudio::Measure::OSArgument.makeStringArgument('variable_name', true)\n variable_name.setDisplayName('Enter Variable Name.')\n variable_name.setDescription('Valid values can be found in the eplusout.rdd file after a simulation is run.')\n args << variable_name\n\n # make an argument for the electric tariff\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << 'Detailed'\n reporting_frequency_chs << 'Timestep'\n reporting_frequency_chs << 'Zone Timestep'\n reporting_frequency_chs << 'Hourly'\n reporting_frequency_chs << 'Daily'\n reporting_frequency_chs << 'Monthly'\n reporting_frequency_chs << 'Runperiod'\n reporting_frequency = OpenStudio::Measure::OSArgument.makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency.')\n reporting_frequency.setDefaultValue('Hourly')\n args << reporting_frequency\n\n # make an argument for the key_value\n key_value = OpenStudio::Measure::OSArgument.makeStringArgument('key_value', true)\n key_value.setDisplayName('Enter Key Name.')\n key_value.setDescription('Enter * for all objects or the full name of a specific object to.')\n key_value.setDefaultValue('*')\n args << key_value\n\n env = OpenStudio::Measure::OSArgument.makeStringArgument('env', true)\n env.setDisplayName('availableEnvPeriods')\n env.setDescription('availableEnvPeriods')\n env.setDefaultValue('RUN PERIOD 1')\n args << env\n\n args\n end", "def get_cmdline_str(args)\n # Build commandline string, with quotes around arguments with special\n # characters in them (i.e., characters interpreted by shell)\n args_str = \"\"\n quote = '\"'\n args.each do |arg|\n if not arg.kind_of?(String)\n raise RuntimeError, \"Argument not string: '#{arg}' (#{arg.class})\"\n end\n\n if arg.nil?\n next\n end\n # Quote whitespace and '\\'\n if not /[\\s\\\\]/.match(arg).nil?\n arg = \"#{quote}#{arg}#{quote}\"\n end\n args_str += \"#{arg} \"\n end\n args_str.strip!()\n\n return args_str\n end", "def read_from_cmdline\n require \"shellwords.rb\"\n words = Shellwords.shellwords(\n if not ARGV.empty?\n ARGV.join(' ')\n else\n STDERR.print \"(offline mode: enter name=value pairs on standard input)\\n\" if STDIN.tty?\n readlines.join(' ').gsub(/\\n/, '')\n end.gsub(/\\\\=/, '%3D').gsub(/\\\\&/, '%26'))\n\n if words.find{|x| x =~ /=/} then words.join('&') else words.join('+') end\n end", "def command_line_params\n params = \"\"\n\n # Disallow password auth. We need to fail if no trusted key is set up.\n params += \"-o PasswordAuthentication=no \"\n\n # Disallow other keyoard-interactive auth methods.\n params += \"-o ChallengeResponseAuthentication=no \"\n\n # Automatically add unknown hosts to the \"known hosts\" file, without prompting.\n params += \"-o StrictHostKeyChecking=no \"\n\n # Also silence warnings since StrictHostKeyChecking=no always issues a warning\n params += \"-o LogLevel=ERROR \"\n\n if !@fail_on_host_changes\n # Ignore when the signature of a host changes. This usually happens when a machine is upgraded,\n # but could also happen due to man-in-the-middle attacks.\n params += \"-o UserKnownHostsFile=/dev/null \"\n end\n\n params\n end", "def exiftool_args\n fail MultiExiftool::Error, 'No filenames.' if filenames.empty?\n cmd = []\n cmd << Reader.mandatory_args\n cmd << options_args\n cmd << tags_args\n cmd << filenames\n cmd.flatten\n end", "def parse_args()\r\n\t\tfor arg in ARGV\r\n\t\t\tif arg == \"-d\"\r\n\t\t\t\t@daemonize = true\r\n\t\t\telsif arg == \"development\" || arg == \"production\"\r\n\t\t\t\t@db_env = arg\r\n\t\t\tend\r\n\t\tend\r\n\t\tputs \"Using DB: #{@db_env}\"\r\n\tend", "def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # URL of the DEnCity server that will be posted to\n hostname = OpenStudio::Ruleset::OSArgument::makeStringArgument('hostname', true)\n hostname.setDisplayName('URL of the DEnCity Server')\n hostname.setDefaultValue('http://www.dencity.org')\n args << hostname\n\n # DEnCity server user id at hostname\n user_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('user_id',true)\n user_id.setDisplayName('User ID for DEnCity Server')\n args << user_id\n\n # DEnCIty server user id's password\n auth_code = OpenStudio::Ruleset::OSArgument::makeStringArgument('auth_code', true)\n auth_code.setDisplayName('Authentication code for User ID on DEnCity server')\n args << auth_code\n\n # Building type for DEnCity's metadata\n building_type = OpenStudio::Ruleset::OSArgument::makeStringArgument('building_type', false)\n building_type.setDisplayName('Building type')\n args << building_type\n\n # HVAC system for DEnCity's metadata\n primary_hvac = OpenStudio::Ruleset::OSArgument::makeStringArgument('primary_hvac', false)\n primary_hvac.setDisplayName('Primary HVAC system in building')\n args << primary_hvac\n\n args\n\n end", "def process_argv!\n args = ARGV.dup\n self.rest = []\n until args.empty? do\n arg = args.shift\n case\n when arg == '--'\n self.rest += args\n break\n when arg =~ /\\A--([\\w\\-\\.]+)(?:=(.*))?\\z/\n param, val = [$1, $2]\n param.gsub!(/\\-/, '.') # translate --scoped-flag to --scoped.flag\n param = param.to_sym unless (param =~ /\\./) # symbolize non-scoped keys\n if val == nil then val = true # --flag option on its own means 'set that option'\n elsif val == '' then val = nil end # --flag='' the explicit empty string means nil\n self[param] = val\n when arg =~ /\\A-(\\w+)\\z/\n $1.each_char do |flag|\n param = param_with_flag(flag)\n self[param] = true if param\n end\n else\n self.rest << arg\n end\n end\n end", "def command_line_options\n opts = GetoptLong.new(*ARG_SPEC)\n options = {}\n opts.each do |opt,arg|\n opt[0,2] = ''\n opt = opt.to_sym\n case opt\n when :help\n puts usage(\"[param ...]\")\n exit 0\n else\n options[opt] = arg ? arg : true\n end\n end\n options\nend", "def to_argv\n flags = (Hash===last ? pop : {})\n flags = flags.to_argv\n flags + self\n end", "def arguments; end", "def arguments; end", "def arguments; end", "def windows_installer_arguments\n# @windows_installer_arguments ||= Array(options[:windows_installer_arguments]).join \" \"\n @windows_installer_arguments ||= '/S'\n end", "def cmdline\n if @cmdline.nil?\n cmdline = \"#{@cmd}\"\n @args.each do |arg|\n cmdline << (arg.to_s.index(\" \") ? \" \\\"#{arg}\\\"\" : \" #{arg}\")\n end if @args\n @cmdline = cmdline\n end\n @cmdline\n end", "def extract_build_args args # :nodoc:\n return [] unless offset = args.index('--')\n build_args = args.slice!(offset...args.length)\n build_args.shift\n build_args\n end", "def args (configLoc)\n conf = File.dirname(__FILE__) + \"/#{configLoc}\"\n args = Array.new\n args << \"--private_token=#{ENV['TOKEN']}\"\n args << \"--config=#{conf}\"\n return args\n end", "def argv=(args)\n puts \"setting argv to #{args.inspect}\"\n eval \"opal.runtime.cs(opal.runtime.Object, 'ARGV', #{args.inspect});\"\n end", "def process_arguments\n @e_addr = @options.email\n @r_name = @options.run_names\n @m_name = @options.machine_names\n @action = @options.action\n @snfs = @options.snfs\n end", "def collect_build_args\n build_flags = []\n\n build_flags << \"--HEAD\" if HEAD?\n build_flags << \"--universal\" if build_universal?\n build_flags << \"--build-bottle\" if build_bottle?\n build_flags << \"--build-from-source\" if build_from_source?\n\n build_flags\n end", "def read_arguments\n\tif (ARGV.length() < 2)\n\t\traise ArgumentError, \"Invalid number of arguments, \\n correct usage 'ruby ./661561-project-one.rb <input_file> <regression_type>'\"\n\tend\n\t\n\tfilename = ARGV[0]\n\tregression_type = ARGV[1]\n\n\tif !(VALID_REGRESSIONS.include? regression_type)\n\t\traise ArgumentError, 'Regression type is not valid.'\t\n\tend\n\n\treturn filename, regression_type\n\nend", "def get_arguments(cmd)\n (main_args, sub_command, sub_args) = split_command(cmd)\n int_sub_command = '' #sub_command\n until sub_args.empty? do\n (int_main_args, int_sub_command, sub_args) = split_command(sub_args)\n end\n return [sub_command, int_sub_command]\nend", "def parsed_args\n args = Options.new('binnacle - Simple Test and Infra automation Framework')\n args.verbose = 0\n args.runner = false\n args.result_json = ''\n\n opt_parser = OptionParser.new do |opts|\n opts.banner = 'Usage: binnacle [options] <testfile>'\n\n opts.on('-w', '--wide', 'Do not crop the task line') { args.wide = true }\n opts.on('-v', '--verbose', 'Verbose output') { args.verbose += 1 }\n opts.on('-r', '--runner', 'Run the tasks from a file (Internal use only)') { args.runner = true }\n opts.on('--results-json=FILE', 'Results JSON file') do |json_file|\n args.result_json = json_file\n end\n\n opts.on('-h', '--help', 'Prints this help') do\n puts opts\n exit\n end\n\n opts.on('--version', 'Show Version information') do\n puts \"Binnacle #{Binnacle::VERSION}\"\n exit\n end\n end\n\n opt_parser.parse!(ARGV)\n\n if ARGV.empty?\n warn 'Task file is not specified'\n exit EXIT_INVALID_ARGS\n end\n\n args.task_files = ARGV\n args\nend", "def extract_extra_args(images)\n if idx = ARGV.find_index(\"--\")\n extra_args = ARGV[idx + 1..-1]\n extra_args.each { |a| images.delete(a) }\n end\n\n [images, extra_args]\n end", "def args\n @args \n end" ]
[ "0.6826597", "0.6823561", "0.67863256", "0.6747927", "0.67327046", "0.6711787", "0.6702479", "0.6702479", "0.6702479", "0.6702479", "0.6702479", "0.6702479", "0.6702479", "0.6636234", "0.6636234", "0.6558838", "0.6475331", "0.640297", "0.6395194", "0.6392166", "0.6387632", "0.63573843", "0.6342233", "0.6339464", "0.63370657", "0.6318525", "0.6302911", "0.6291005", "0.6274514", "0.62429595", "0.62408674", "0.62210107", "0.620087", "0.61969", "0.6169611", "0.6157173", "0.61372495", "0.61359316", "0.6113091", "0.61055315", "0.6102603", "0.60903454", "0.6086452", "0.60608345", "0.604704", "0.60355383", "0.6029037", "0.5983405", "0.59801006", "0.5979653", "0.596666", "0.5964575", "0.5963378", "0.5941658", "0.5926111", "0.59201896", "0.5907669", "0.58782166", "0.5847106", "0.5845722", "0.5836366", "0.5814603", "0.5796334", "0.57837766", "0.57829416", "0.5770961", "0.57620555", "0.5758288", "0.5735735", "0.57141924", "0.57080686", "0.5701057", "0.5689352", "0.56878453", "0.5681832", "0.5680193", "0.56540453", "0.5651314", "0.56462985", "0.56446105", "0.56422216", "0.56406164", "0.5622335", "0.56070894", "0.5599575", "0.55894434", "0.55894434", "0.55894434", "0.5588756", "0.5584751", "0.55835354", "0.5578585", "0.5577813", "0.5576812", "0.5572924", "0.5571689", "0.557107", "0.556338", "0.55527806", "0.55490714" ]
0.597366
50
Returns the most directly responsible party for an appeal when it is at the Board, mirroring Legacy Appeals' location code in VACOLS
def assigned_to_location return COPY::CASE_LIST_TABLE_POST_DECISION_LABEL if root_task&.status == Constants.TASK_STATUSES.completed active_tasks = tasks.where(status: [Constants.TASK_STATUSES.in_progress, Constants.TASK_STATUSES.assigned]) return most_recently_assigned_to_label(active_tasks) if active_tasks.any? on_hold_tasks = tasks.where(status: Constants.TASK_STATUSES.on_hold) return most_recently_assigned_to_label(on_hold_tasks) if on_hold_tasks.any? return most_recently_assigned_to_label(tasks) if tasks.any? status_hash[:type].to_s.titleize end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coalition_leader(party)\n natural_leader = @parties.find {|p| p.id == party.natural_leader_id }\n natural_leader || @parties.max_by(&:seats_won)\n end", "def best_offense\n offense_suite\n best_offense_id = @average_goals_by_id.invert.max[1]\n @team_name_by_id[best_offense_id]\n end", "def offensive_row_for_ai(board)\n offensive_play = {}\n WINNING_COMBINATIONS.each { |offense| offensive_play[offense] = 0 }\n WINNING_COMBINATIONS.each do |offense|\n offense.each do |is_x|\n offensive_play[offense] += 1 if board[is_x] == COMPUTER_MARKER\n if board[is_x] == PLAYER_MARKER\n offensive_play[offense] = 0\n break\n end\n end\n end\n offensive_play\nend", "def fo_tool\n return actor.equips[0] if actor.primary_use == 1\n return actor.equips[1] if actor.primary_use == 2\n return actor.assigned_item if actor.primary_use == 3\n return actor.assigned_item2 if actor.primary_use == 4\n return actor.assigned_item3 if actor.primary_use == 5\n return actor.assigned_item4 if actor.primary_use == 6\n return actor.assigned_skill if actor.primary_use == 7\n return actor.assigned_skill2 if actor.primary_use == 8\n return actor.assigned_skill3 if actor.primary_use == 9\n return actor.assigned_skill4 if actor.primary_use == 10\n end", "def party\n parties.first\n end", "def on_the_offensive(brd)\n attack = []\n WINNING_LINES.each do |line|\n current_line = brd.values_at(*line)\n if current_line.count(COMPUTER_MARKER) == 2\n attack = line\n end\n attack # returns array that is the best attack vector\nend\n\ndef determine_threat(brd)\n threat_line = []\n WINNING_LINES.each do |line|\n current_line = brd.values_at(*line)\n if current_line.any?(COMPUTER_MARKER)\n next\n elsif current_line.count(PLAYER_MARKER) == 2\n threat_line = line\n end\n end\n threat_line\nend", "def get_avail_cor(player, opponent)\n taken = player + opponent # all occupied board positions\n avail_cor = @corners - (@corners & taken) # determine which corners are taken\n if avail_cor.size > 0 # if there are any open corners\n position = avail_cor.sample # take one of them\n else\n position = get_avail_edg(player, opponent) # otherwise take an open edge\n end\n end", "def player_index\n\t\t\[email protected]_index do |row|\n\t\t\t\t@grid[row].each_index do |col|\n\t\t\t\t\tif @grid[row][col].respond_to?(:resident) && Person === @grid[row][col].resident\n\t\t\t\t\t\treturn [row, col]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tnil\n\t\tend", "def best_offense\n @teams.max_by { |team| team.average_goals_scored }.team_name\n end", "def threat_row_for_ai(board)\n defend_spaces = {}\n WINNING_COMBINATIONS.each { |threat| defend_spaces[threat] = 0 }\n WINNING_COMBINATIONS.each do |threat|\n threat.each do |is_x|\n defend_spaces[threat] += 1 if board[is_x] == PLAYER_MARKER\n if board[is_x] == COMPUTER_MARKER\n defend_spaces[threat] = 0\n break\n end\n end\n end\n defend_spaces\nend", "def who_is_winner(pieces_position_list)\n representation = create_representation(pieces_position_list)\n\n diagonal = get_diagonal(representation)\n on_row = by_row(representation)\n on_column = by_column(representation)\n\n [diagonal, on_column, on_row].select { |x| x != 'Draw' }.first\nend", "def target_position(investigator)\n max_confidence = @positions.values.max\n position = @positions.select {|key, value| value == max_confidence }.keys.reject{ |e| e == investigator.location }.sample\n position = @cities.random_city(exclusion = investigator.location) unless position\n position\n end", "def party\n respond_to?(:partyMembershipHasParty) ? partyMembershipHasParty.first : nil\n end", "def round1_my_party_cand\n Candidate.all.select do |can|\n if can.party == self.party and can.level_of_governments == \"Local Election\"\n puts''\n puts\" \"\n puts\" #{can.name} \"\n puts\" \"\n puts\" State: #{can.state} \"\n puts\" Party: #{can.party} \"\n puts\" Age: #{can.age} \"\n puts\" Years of Experience: #{can.years_of_experience} \"\n puts\" Level of Government: #{can.level_of_governments} \"\n puts\" \"\n puts' ==================================================='\n end\n end\n end", "def agency\n\t\treturn @agency if @agency_loaded\n\t\t@agency_loaded = true\n\t\tcc = cost_center.to_s[0, 2]\n\t\tagens = Agency.find(:all, :conditions => ['find_in_set(?, vacancy_data_codes)', cc])\n\t\t@agency = agens[0] if agens.size == 1\n\t\t@agency ||= Agency.find_by_abbreviation('MC')\n\tend", "def appeals\n @appeals ||= begin\n legacy_appeals = find_appeals_ready_for_geomatching(\n LegacyAppeal,\n select_fields: [:vacols_id]\n ).first(QUERY_LIMIT / 2)\n\n ama_appeals = find_appeals_ready_for_geomatching(Appeal).first(QUERY_LIMIT / 2)\n legacy_appeals + ama_appeals\n end\n end", "def pbRoamingAreas(index)\n data=RoamingSpecies[index]\n return data[5] if data && data[5]\n return RoamingAreas\nend", "def company_code\n if self.yard.present? && self.yard.facility.present? && self.yard.facility.country.present?\n country = self.yard.facility.country\n \"COPART#{country.code}\".upcase\n else\n \"\"\n end\n end", "def find_candidate_for_guessing\n unassigned_cells.sort_by { |cell|\n [cell.available_values.size, to_s]\n }.first\n end", "def office\n offices.first\n end", "def whole_affil (new_party_affiliation)\n if new_party_affiliation == \"d\"\n \"Democrat\"\n else new_party_affiliation == \"r\"\n \"Republican\"\n end\n end", "def likely_organization\n match_keys = [[:telephone_number], [:fax_number], [:first_line, :second_line, :postal_code]]\n [mailing_address, practice_location_address].each do |address|\n match_keys.each do |mk|\n matcher = address.slice(*mk).reject { |k, v| v.blank? }\n if matcher.size > 0 && org_address = Address.where(matcher.merge(entity_type: 'Organization')).first\n return org_address.entity\n end\n end\n end\n return nil\n end", "def hipaa_code_related_to_partner_and_payment_condition(crosswalk_record)\n if crosswalk_record\n if @zero_payment && is_partner_bac\n if crosswalk_record.denied_hipaa_code_id.present? && crosswalk_record.crosswalk_record_id.present?\n rc_crosswalk = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if rc_crosswalk.present?\n @denied_hipaa_code_record = rc_crosswalk.denied_hipaa_code\n @hipaa_code = @denied_hipaa_code_record.hipaa_adjustment_code if @denied_hipaa_code_record\n end\n end\n else\n rcc_log.debug \"Obtaining HIPAA CODE.\"\n if crosswalk_record.hipaa_code_active_indicator\n @hipaa_code = crosswalk_record.hipaa_adjustment_code\n elsif crosswalk_record.crosswalk_record_id.present?\n rcc_log.debug \"hipaa_code_active_indicator is false. Obtaining the hipaa_record\"\n rc_crosswalk = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if rc_crosswalk.present?\n @hipaa_code_record = rc_crosswalk.hipaa_code\n if @hipaa_code_record && @hipaa_code_record.eligible_for_output?(get_eob)\n @hipaa_code = @hipaa_code_record.hipaa_adjustment_code if @hipaa_code_record.present?\n end\n end\n end\n end\n end\n rcc_log.debug \"HIPAA CODE : #{@hipaa_code}\"\n @hipaa_code.to_s.upcase\n end", "def find_organism\n return self.dnafrag.genome_db\n end", "def alien_species\n # 2. for those Colonies, get the information about the species\n self.colonies.map do |colony_instance|\n colony_instance.alien_species\n end\n end", "def biggest_council\n return if payer_breakdown.blank? || payer_breakdown.all?{ |o| o[:organisation_type] != 'Council' }\n council_details = payer_breakdown.select{ |o| o[:organisation_type] == 'Council'}.sort{|a,b| b[:total_spend] <=> a[:total_spend]}.first\n Council.find_by_id(council_details[:organisation_id])\n end", "def electoral_college\n ec_seats = @seats.dup\n unless ec_seats.has_key?(\"District of Columbia\")\n\tec_seats[\"District of Columbia\"] = 1\n end\n ec_seats.each {|k,v| ec_seats[k] = v + 2}\n ec_seats\n end", "def venues_presented_at\n find_related_frbr_objects( :is_presented_by, :which_roles?) \n end", "def detect_winner(brd)\n Board::WINNING_LINES.each do |line|\n if brd.position_values[line[0]] == Board::PLAYER_MARKER &&\n brd.position_values[line[1]] == Board::PLAYER_MARKER &&\n brd.position_values[line[2]] == Board::PLAYER_MARKER\n return 'Player'\n elsif brd.position_values[line[0]] == Board::CPU_MARKER &&\n brd.position_values[line[1]] == Board::CPU_MARKER &&\n brd.position_values[line[2]] == Board::CPU_MARKER\n return 'CPU'\n end\n end\n nil\n end", "def house()\n\t\tadmin = self.parties.where{type == AdminParty.to_s}.first\n\t\traise \"administrator party not found\" if admin.nil?\n\t\tadmin\n\tend", "def highest_degree_offered\n degree = {\n '0' => nil, '1' => '4-year', '2' => '4-year', '3' => '4-year',\n '4' => '2-year' \n }\n\n !facility_code.nil? && degree.keys.include?(facility_code[1]) ? degree[facility_code[1]] : 'NCD'\n end", "def opponent_board\n boards.opponent.first\n end", "def party_for(user)\n\t\tparties = self.parties.joins{contact}.where{contact.user_id == user.id}\n\t\tparties.first\n\tend", "def round3_my_party_cand\n Candidate.all.select do |can|\n if can.party == self.party and can.level_of_governments == \"National Election\"\n puts''\n puts\" \"\n puts\" #{can.name} \"\n puts\" \"\n puts\" State: #{can.state} \"\n puts\" Party: #{can.party} \"\n puts\" Age: #{can.age} \"\n puts\" Years of Experience: #{can.years_of_experience} \"\n puts\" Level of Government: #{can.level_of_governments} \"\n puts\" \"\n puts' ==================================================='\n end\n end\n end", "def winner_col\n for col_index in 0..BOARD_MAX_INDEX\n first_symbol=@board[0][col_index]\n\n for row_index in 1..BOARD_MAX_INDEX\n if first_symbol !=@board[row_index][col_index]\n break\n elsif\n row_index == BOARD_MAX_INDEX and first_symbol !=EMPTY_POS\n return first_symbol\n end\n end\n end\n return \n end", "def getChipsMatch\n @chips.each_index.select{|i| @chips[i] == @elevatorFloor}\n end", "def get_vacant_pos col\n vacant_position = nil\n\n @row.times do |idx|\n if @grid[idx][col-1] == \"O\"\n vacant_position = idx + 1\n else\n break\n end\n end\n\n vacant_position\n end", "def highest_earner(drivers)\n # hash data for the highest earning driver\n highest_earner_data = drivers.max { |a, b| a[:total_earned] <=> b[:total_earned]}\n # extracts the driver ID\n highest_earner = highest_earner_data[:driver_id]\n return highest_earner\nend", "def get_target(map, loc)\n owned = nil\n owned_min = 1000\n GameMap::CARDINALS.each do |l|\n new_loc = map.find_location(loc, l)\n site = map.site(new_loc)\n if site.owner != $tag && site.strength < owned_min\n owned_min = site.strength\n owned = l\n end\n end\n owned\nend", "def office_country_code\n self.dig_for_string(\"agentSummary\", \"office\", \"officeAddress\", \"countryCode\")\n end", "def suggested_sales_area\n if advert=self.advertiser\n # offer = self.offers.last\n if advert.address and zc = advert.address.zip_code_obj\n zc.sales_area\n end\n end\n end", "def authoritative_company\n @authoritative_company ||= begin\n if self.badge&.company_id.present?\n Company.unscoped { self.badge.company }\n\n # System user senders include anniversaries and the first ambassador badge\n # It is an edge case for anniversaries because they should have custom badges enabled\n # and thus should hit the above conditional\n # However, recognitions for the ambassador badge are sent during signup\n # and thus do not have custom badges enabled yet\n # Regardless, pick the first user recipient\n elsif self.sender&.system_user?\n # there are definitely odd cases where the recognition is left around\n # but the recipients have deleted_at set\n # We don't care about that here. If we have a recognition object,\n # return the recipients even if they have been \"deleted\"\n Company.unscoped { User.unscoped{ self.user_recipients.first&.company }}\n else\n # This is a bit of a weird branch. Not sure if or when we'll hit this\n # But the latter part of the || was added to get a test to pass spec/models/recognition_spec.rb\n Company.unscoped{ self.sender_company || self.sender&.company}\n end\n end\n end", "def round2_my_party_cand\n Candidate.all.select do |can|\n if can.party == self.party and can.level_of_governments == \"State Election\"\n puts''\n puts\" \"\n puts\" #{can.name} \"\n puts\" \"\n puts\" State: #{can.state} \"\n puts\" Party: #{can.party} \"\n puts\" Age: #{can.age} \"\n puts\" Years of Experience: #{can.years_of_experience} \"\n puts\" Level of Government: #{can.level_of_governments} \"\n puts\" \"\n puts' ==================================================='\n end\n end\n end", "def get_hipaa_code_for_adjustment_reason(adjustment_reason)\n adjustment_hipaa_code_id = \"#{adjustment_reason}_hipaa_code_id\"\n hipaa_code_id_from_entity = entity.send(adjustment_hipaa_code_id)\n if hipaa_code_id_from_entity.present?\n hipaa_code_array = HipaaCode.get_active_code_details_given_ids([hipaa_code_id_from_entity])\n if hipaa_code_array.present?\n hipaa_id_and_code_and_description = hipaa_code_array.first\n if hipaa_id_and_code_and_description.present?\n hipaa_code = hipaa_id_and_code_and_description[1]\n end\n end\n end\n hipaa_code = hipaa_code.to_s.upcase\n rcc_log.debug \"Getting HIPAA code directly from the entity table : #{hipaa_code}\"\n hipaa_code\n end", "def party_aligned_cand\n Candidate.all.select do |can|\n if can.party == self.party\n puts'==================================================='\n puts\" \"\n puts\" #{can.name} \"\n puts\" \"\n puts\" State: #{can.state} \"\n puts\" Party: #{can.party} \"\n puts\" Age: #{can.age} \"\n puts\" Years of Experience: #{can.years_of_experience} \"\n puts\" Level of Government: #{can.level_of_governments} \"\n puts\" \"\n puts'==================================================='\n end\n end\n end", "def company\n alliance_company\n end", "def get_avail_edg(player, opponent)\n taken = player + opponent # all occupied board positions\n avail_edg = @edges - (@edges & taken) # determine which edges are taken\n position = avail_edg.sample # take one of them\n end", "def client_code(crosswalk_record)\n rcc_log.debug \"Obtaining CLIENT CODE.\"\n if crosswalk_record && crosswalk_record.crosswalk_record_id.present?\n crosswalk_record = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if crosswalk_record.present?\n client_code_association_records = crosswalk_record.reason_codes_clients_facilities_set_names_client_codes.\n select{|rcfsc| rcfsc.category != 'DENIED' or rcfsc.category == nil}\n client_code_record = client_code_association_records.first.client_code if client_code_association_records.present?\n if client_code_record.present?\n client_code = client_code_record.adjustment_code\n rcc_log.debug \"CLIENT CODE : #{client_code}, having ID : #{client_code_record.id}\"\n end\n end\n end\n client_code.to_s.upcase\n end", "def office_country\n self.dig_for_string(\"agentSummary\", \"office\", \"officeAddress\", \"country\")\n end", "def get_best_mir_for_event(event_type, pool_type)\n @swimmer.meeting_individual_results.for_pool_type(pool_type).for_event_type(event_type).is_not_disqualified.exists? ?\n @swimmer.meeting_individual_results.for_pool_type(pool_type).for_event_type(event_type).is_personal_best.first :\n nil\n end", "def select_winner(altered_grid)\n altered_grid.each do |row|\n winner = row.each_cons(4).to_a.select do |chunk|\n chunk.uniq.length == 1 && chunk.none? { |el| el.nil? }\n end\n\n return winner[0][0] unless winner.empty?\n end\n\n nil\n end", "def worst_offense\n @teams.min_by { |team| team.average_goals_scored }.team_name\n end", "def secondary_address\n addresses.select{ |a| a.address_rank_code == 2 }.first\n end", "def detect_winner(brd)\n WINNING_LINES.each do |line|\n if brd.values_at(*line).count(PLAYER_MARKER) == 3\n return 'Player'\n elsif brd.values_at(*line).count(COMPUTER_MARKER) == 3\n return 'Computer'\n end\n end\n nil\nend", "def payer_reason_codes_for_nyu\n (facility.sitecode.to_s.strip == '00549' && eob.patient_account_number.to_s[0..2] == 'SAL') ? {0 => 'REF'} : nil\n end", "def primary_funder(data_management_plan:)\n return nil unless data_management_plan.present? && data_management_plan.project.present?\n\n funders = data_management_plan.project.fundings.map(&:affiliation)\n return nil unless funders.any?\n\n funders.last\n end", "def item_at_bays_more(loc1, loc2, loc3, loc4)\n product_bays_more = WAREHOUSE.select{ |bays| bays[:rack_bay_position] == loc1 || bays[:rack_bay_position] == loc2 || bays[:rack_bay_position] == loc3 || bays[:rack_bay_position] == loc4 }\n product_bays_more.map{ |bays| bays[:product_name] }.join(\", \")\nend", "def actual_accommodation\r\n return self.accommodation_histories.last\r\n end", "def prefered_vendor\n vendors_array = vendors\n\n highest_revenue = 0\n best_vendor = nil\n\n vendors_array.each do |vendor|\n vendor_revenue = vendor.revenue\n if vendor_revenue > highest_revenue\n highest_revenue = vendor_revenue\n best_vendor = vendor\n end\n end\n\n return best_vendor\n end", "def hureistic_search (board) #open useful in finding min conflicts\n end", "def service_payee_identification\n code, qual = nil, nil\n claim = eob.claim_information\n fac = facility\n\n if (claim && !claim.payee_npi.blank?)\n code = claim.payee_npi\n qual = 'XX'\n Output835.log.info \"Payee NPI from the 837 is chosen\"\n elsif (claim && !claim.payee_tin.blank?)\n code = claim.payee_tin\n qual = 'FI'\n Output835.log.info \"Payee TIN from 837 is chosen\"\n elsif !fac.facility_npi.blank?\n code = fac.facility_npi\n qual = 'XX'\n Output835.log.info \"facility NPI from FC is chosen\"\n elsif !fac.facility_tin.blank?\n code = fac.facility_tin\n qual = 'FI'\n Output835.log.info \"facility TIN from FC is chosen\"\n end\n\n return code, qual\n end", "def preferred_vendor\n # returns the vendor with the highest revenue\n vendors.max_by {|vendor| FarMar::Vendor.find(vendor.id).revenue}\n end", "def current_benefit_of(insurance_type = \"D\") \n insurance_type.strip!\n ip_benefits = policy_benefit_details.select{|x| x.benefit_type.strip == insurance_type && x.deleted == 'N'}\n ip_benefits = ip_benefits.select{|x| x.status == 'CU' }\n current_one = ip_benefits.sort{|a, b| a.effective <=> b.effective}.last\n end", "def getAreaCode(city_name, dial_book)\n \n areaCode = dial_book.select { |k, v| k == city_name }\n \n areaCode.select { |k, v| return v} # Return just the area code\n \nend", "def electronic_holding_location\n @electronic_holding_location ||= holdings&.find { |h| (h.dig('holdingsType', 'name') || h.dig('location', 'effectiveLocation', 'details', 'holdingsTypeName')) == 'Electronic' }\n end", "def selector(evidence)\n a=Array.new\n max=0\n maxIndex=0\n for i in 0..9\n if(evidence.getOffSet.include?(i))\n next\n end\n a[i] = p7(i,evidence)\n #puts 'P(' + i.to_s + ') = '+ (a[i]).to_s\n end\n max(a,0)\n return a\nend", "def get_oute_judgement(sente, board)\n if sente > 0\n role_value = Piece::OU\n opponent_kiki = board.gote_kikis\n else\n role_value = - Piece::OU\n opponent_kiki = board.sente_kikis\n end\n 11.upto(99).each do |point|\n piece = board.board[point]\n next if piece == Piece::WALL\n next unless piece != Piece::NONE && piece == role_value\n # this piece is ou\n # check if oute?\n move_kikis = opponent_kiki.get_move_kikis(point)\n jump_kikis = opponent_kiki.get_jump_kikis(point)\n if move_kikis.size > 0 || jump_kikis.size > 0\n return [point, move_kikis, jump_kikis]\n end\n end\n nil\n end", "def location_of_bay(bay)\n location = WAREHOUSE.select{ |item| item[:product_name] == bay }\n return location[0][:rack_bay_position]\nend", "def hash_for_location(offense); end", "def big_investors\n self.investors.select {|vc| vc.tres_commas_club}\n end", "def offense\n offensive_pieces = if game_of_piece.current_color == 'white'\n Piece.where(color: 'white', game_id: game_id, active: true)\n else\n Piece.where(color: 'black', game_id: game_id, active: true)\n end\n offensive_pieces\n end", "def sel_avail_cor(player, opponent)\n taken = player + opponent # all occupied board positions\n # determine which corners are taken and take a random corner from the open opcor pair\n (taken & @opcor_1).size == 2 ? position = @opcor_2.sample : position = @opcor_1.sample\n end", "def most_rooms\n has_info = 0\n has_info = $postings.select{|p| p.to_s.downcase[/\\d+(?=bedroom|br)/]}\n max_post = has_info.max{|a,b| a.to_s.downcase[/\\d+(?=bedroom|br)/].to_i <=> b.to_s.downcase[/\\d+(?=bedroom|br)/].to_i}\n max_room = max_post.to_s.downcase[/\\d+(?=bedroom|br)/].to_i\n max_room_ads = has_info.select{|p| p.to_s.downcase[/\\d+(?=bedroom|br)/].to_i == max_room}\n list_apt(max_room_ads)\nend", "def winner\n [rows, columns, diagonals].each do |groups|\n win_groups = groups.select { |g| g.all? && g.uniq.size == 1 }\n return [@human_player, @computer_player].find { |p| p.to_s == win_groups[0][0] } if !win_groups.empty?\n end\n nil\n end", "def get_opportunity_followup_overdue(cid, eid)\n get_my_overdue_opportunity(cid, eid)\n end", "def best_monitoring_asteroid\n best = {}\n all = visible_asteroids\n all.each.with_index do |row, y|\n row.each.with_index do |count, x|\n next if count.nil?\n\n if best[:count].nil? || best[:count] < count\n best[:count] = count\n best[:coordinates] = [x, y]\n end\n end\n end\n best\n end", "def computer_index\n if turn_count == 0\n return CORNERS.sample\n elsif turn_count == 2\n return CORNERS.sample\n elsif turn_count == 4\n empty = nil\n WIN_COMBINATIONS.each do |combo|\n if @board[combo[0]] == \"X\" && @board[combo[1]] == \"X\" && (@board[combo[2]] == \" \" || @board[combo[2]] == \"\")\n empty = combo[2]\n return combo[2]\n elsif @board[combo[1]] == \"X\" && @board[combo[2]] == \"X\" && (@board[combo[0]] == \" \" || @board[combo[0]] == \"\")\n empty = combo[0]\n return combo[0]\n elsif @board[combo[0]] == \"X\" && @board[combo[2]] == \"X\" && (@board[combo[1]] == \" \" || @board[combo[1]] == \"\")\n empty = combo[1]\n return combo[1]\n elsif @board[combo[0]] == \"O\" && @board[combo[1]] == \"O\" && (@board[combo[2]] == \" \" || @board[combo[2]] == \"\")\n empty = combo[2]\n return combo[2]\n elsif @board[combo[1]] == \"O\" && @board[combo[2]] == \"O\" && (@board[combo[0]] == \" \" || @board[combo[0]] == \"\")\n empty = combo[0]\n return combo[0]\n elsif @board[combo[0]] == \"O\" && @board[combo[2]] == \"O\" && (@board[combo[1]] == \" \" || @board[combo[1]] == \"\")\n empty = combo[1]\n return combo[1]\n end\n end\n return CORNERS.sample if !empty\n elsif turn_count == 6\n empty = nil\n WIN_COMBINATIONS.each do |combo|\n if @board[combo[0]] == \"X\" && @board[combo[1]] == \"X\" && (@board[combo[2]] == \" \" || @board[combo[2]] == \"\")\n empty = combo[2]\n return combo[2]\n elsif @board[combo[1]] == \"X\" && @board[combo[2]] == \"X\" && (@board[combo[0]] == \" \" || @board[combo[0]] == \"\")\n empty = combo[0]\n return combo[0]\n elsif @board[combo[0]] == \"X\" && @board[combo[2]] == \"X\" && (@board[combo[1]] == \" \" || @board[combo[1]] == \"\")\n empty = combo[1]\n return combo[1]\n end\n end\n WIN_COMBINATIONS.each do |combo|\n if @board[combo[0]] == \"O\" && @board[combo[1]] == \"O\" && (@board[combo[2]] == \" \" || @board[combo[2]] == \"\")\n empty = combo[2]\n return combo[2]\n elsif @board[combo[1]] == \"O\" && @board[combo[2]] == \"O\" && (@board[combo[0]] == \" \" || @board[combo[0]] == \"\")\n empty = combo[0]\n return combo[0]\n elsif @board[combo[0]] == \"O\" && @board[combo[2]] == \"O\" && (@board[combo[1]] == \" \" || @board[combo[1]] == \"\")\n empty = combo[1]\n return combo[1]\n end\n end\n return CORNERS.sample if !empty\n else\n @board.each do |space|\n if space == \" \" || space == \"\"\n return @board.index(space)\n end\n end\n end\n end", "def get_best_mir_for_meeting(meeting, event_type, pool_type)\n @swimmer.meeting_individual_results.for_meeting_editions(meeting).for_pool_type(pool_type).for_event_type(event_type).is_not_disqualified.exists? ?\n @swimmer.meeting_individual_results.for_meeting_editions(meeting).for_pool_type(pool_type).for_event_type(event_type).is_not_disqualified.sort_by_timing('ASC').first :\n nil\n end", "def party(str)\n Party.where(name: str).first\nend", "def parties(location, state)\n if location == :north\n soldiers_at(:north, state).map { |soldier| [soldier] } # one guy\n else\n soldiers_at(:south, state).combination(2).to_a # two guys\n end\nend", "def best_comm(addr)\n\n addr_nbo = Socket.resolv_nbo_i(addr)\n comm = nil\n msb = 0\n\n each { |route|\n if ((route.subnet_nbo & route.netmask_nbo) ==\n (addr_nbo & route.netmask_nbo))\n if (route.bitmask >= msb)\n comm = route.comm\n msb = route.bitmask\n end\n end\n }\n\n comm\n end", "def constituency\n constituencies.first\n end", "def most_rebound(player_name)\r\n game_hash.each do |team, data|\r\n data.each do |team_info, value|\r\n if team_info == \"players\".to_sym\r\n value.each do |player, detail|\r\n if player == player_name\r\n return detail[:rebounds]\r\n end\r\n end\r\n end\r\n end\r\n end\r\nend", "def get_room_over_under(room,preferences)\n over_under = Array.new\n preferences.each do |pref|\n over_under.push([room.id,\"Price\", 4420 - room.price]) if pref[0] == \"pref_price\"\n over_under.push([room.id,\"Size\", room.area - 100]) if pref[0] == \"pref_size\"\n over_under.push([room.id,\"Noise\", room.cleanliness - 3]) if pref[0] == \"pref_clean\"\n over_under.push([room.id,\"Clean\", room.noisiness - 3]) if pref[0] == \"pref_noise\"\n over_under.push([room.id,\"Location\", room.location - 3]) if pref[0] == \"pref_location\"\n over_under.push([room.id,\"Social\", room.social - 3]) if pref[0] == \"pref_social\"\n if pref[0] == \"Air Conditioning\"\n if room.ac == true\n over_under.push([room.id,\"pref_ac\", 1])\n else\n over_under.push([room.id,\"pref_ac\", -1])\n end\n end\n end\n return over_under\n end", "def alien_number\n vlp_documents.select{|doc| doc.alien_number.present? }.first.try(:alien_number)\n end", "def denied_hipaa_code(crosswalk_record)\n rcc_log.debug \"Obtaining Denied HIPAA CODE for zero payment.\"\n if crosswalk_record.denied_hipaa_code_id.present? && crosswalk_record.crosswalk_record_id.present?\n if @denied_hipaa_code_record.blank?\n rc_crosswalk = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if rc_crosswalk.present?\n @denied_hipaa_code_record = rc_crosswalk.denied_hipaa_code\n end\n end\n denied_hipaa_code = @denied_hipaa_code_record.hipaa_adjustment_code if @denied_hipaa_code_record\n end\n rcc_log.debug \"Denied HIPAA CODE : #{denied_hipaa_code}\"\n denied_hipaa_code.to_s.upcase\n end", "def winner_row\n for row_index in 0..BOARD_MAX_INDEX\n first_symbol=@board[row_index][0]\n for col_index in 1..BOARD_MAX_INDEX\n if first_symbol !=@board[row_index][col_index]\n break \n elsif col_index ==BOARD_MAX_INDEX and first_symbol != EMPTY_POS\n return first_symbol\n end\n end\n end\n return \n end", "def plan\n calculate_scores_and_attendabilities\n \n highest_attendability_value = @attendabilities.sort {|a,b| a[1] <=> b[1]}.reverse[0][1]\n best_attendabilities = @attendabilities.to_a.select {|a| (a[1] == highest_attendability_value)}\n pairs_with_best_attendabilities = best_attendabilities.collect {|b| b[0]}\n best_scores = @scores.to_a.select {|s| pairs_with_best_attendabilities.include?(s[0])}.sort {|a,b| a[1] <=> b[1]}.reverse\n \n produce_roster(:monday, best_scores[0][0][0])\n produce_roster(:wednesday, best_scores[0][0][1])\n end", "def office_postal_code\n self.dig_for_string(\"agentSummary\", \"office\", \"officeAddress\", \"postalCode\")\n end", "def item_at_bays(loc1, loc2, loc3)\n product_bays = WAREHOUSE.select{ |bays| bays[:rack_bay_position] == loc1 || bays[:rack_bay_position] == loc2 || bays[:rack_bay_position] == loc3 }\n product_bays.map{ |bays| bays[:product_name] }.join(\", \")\nend", "def preferred_vendor\n self.vendors.max_by { |vendor| vendor.revenue}\n end", "def denied_client_code(crosswalk_record)\n rcc_log.debug \"Obtaining Denied CLIENT CODE for zero payment.\"\n if crosswalk_record && crosswalk_record.crosswalk_record_id.present?\n crosswalk_record = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if crosswalk_record.present?\n client_code_association_records = crosswalk_record.reason_codes_clients_facilities_set_names_client_codes.\n select{|rcfsc| rcfsc.category == 'DENIED'}\n client_code_record = client_code_association_records.first.client_code if client_code_association_records.present?\n if client_code_record.present?\n denied_client_code = client_code_record.adjustment_code\n rcc_log.debug \"Denied CLIENT CODE : #{denied_client_code}, having ID : #{client_code_record.id}\"\n end\n end\n end\n denied_client_code.to_s.upcase\n end", "def compute_client_code(facility_specific_payees, facility)\n client_code = nil\n unless patient_account_number.blank?\n unless facility_specific_payees.blank?\n facility_specific_payees.each do |payee|\n identifier_index = patient_account_number.upcase.index(\"#{payee.db_identifier}\")\n case payee.match_criteria\n when 'like'\n if identifier_index && identifier_index >= 1\n client_code = payee.xpeditor_client_code\n break\n end\n when 'start_with'\n if identifier_index && identifier_index == 0\n client_code = payee.xpeditor_client_code\n break\n end\n when 'equals'\n if payee.db_identifier == patient_account_number\n client_code = payee.xpeditor_client_code\n break\n end\n when 'length'\n if payee.db_identifier.to_i == patient_account_number.length\n client_code = payee.xpeditor_client_code\n break\n end\n when 'start_with_and_length_8'\n if identifier_index && identifier_index == 0 && patient_account_number.length == 8\n client_code = payee.xpeditor_client_code\n break\n end\n when 'all_numeric'\n if patient_account_number.match(/^[0-9]*$/)\n client_code = payee.xpeditor_client_code\n break\n end\n else\n client_code = payee.xpeditor_client_code\n break\n end\n end\n else\n client_code = facility.sitecode\n end\n end\n\n client_code\n end", "def visible_corporations\n if @par_rag\n @game.sorted_corporations.select { |c| c == @game.rag }\n else\n @game.sorted_corporations.reject(&:closed?)\n end\n end", "def pbFirstTarget(idxBattler,target_data)\r\n case target_data.id\r\n when :NearAlly\r\n @battle.eachSameSideBattler(idxBattler) do |b|\r\n next if b.index==idxBattler || [email protected]?(b,idxBattler)\r\n next if b.fainted?\r\n return b.index\r\n end\r\n @battle.eachSameSideBattler(idxBattler) do |b|\r\n next if b.index==idxBattler || [email protected]?(b,idxBattler)\r\n return b.index\r\n end\r\n when :NearFoe, :NearOther\r\n indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)\r\n indices.each { |i| return i if @battle.nearBattlers?(i,idxBattler) && [email protected][i].fainted? }\r\n indices.each { |i| return i if @battle.nearBattlers?(i,idxBattler) }\r\n when :Foe, :Other\r\n indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)\r\n indices.each { |i| return i if [email protected][i].fainted? }\r\n indices.each { |i| return i }\r\n end\r\n return idxBattler # Target the user initially\r\n end", "def hazardRoom\n return @@hazardRoom[self.number-1]\n end", "def find_best_seats(arrangment_hash, columns)\n center_seat = columns/2\n alloted_seat = nil\n arrangment_hash.each do |l|\n row = l.keys.first.split(\"\", 2)\n @request_seats.times do |m|\n # If row has eeven single unavailable seat\n if l.values.include? (\"U\")\n # Loop trough seats\n loop_through_center(l, center_seat)\n break if @request_seats == 0 \n else\n # If all the seats in row is available then allot center seat\n l[row.first + center_seat.to_s] = \"U\"\n @request_seats -= 1\n @result << \"Alloted seat is #{row.first + center_seat.to_s}\"\n break if @request_seats == 0 \n end\n end\n end\n puts arrangment_hash\n end", "def preferred_260(fields)\n fields.select { |field| field.indicator1 == '3' }.last || fields.last\n end", "def item_target_actors\n [$game_party.members[0]]\n end", "def choose_elevator\n elevator_scores = []\n\n for elevator in @column.elevator_list do\n \n # Initialize score to 0\n score = 0\n floor_difference = elevator.current_floor - @floor\n\n # Prevents use of any offline/under-maintenance elevators\n if elevator.status != \"online\"\n score = -1\n elevator_scores.append(score)\n else\n\n # Bonify score based on difference in floors\n if floor_difference == 0\n score += 5000\n else\n score += 5000/(floor_difference.abs() + 1)\n end\n \n # Bonify score based on direction (highest priority)\n if elevator.movement != \"idle\"\n if floor_difference >= 0 and @direction == \"down\" and elevator.movement == \"down\"\n \n # Paths are crossed going down, therefore favor this elevator\n score += 10000\n \n elsif floor_difference <= 0 and @direction == \"up\" and elevator.movement == \"up\"\n\n # Paths are crossed going down, therefore favor this elevator\n score += 10000\n \n else\n \n # Paths are not crossed, therefore try avoiding the use of this elevator\n score = 0\n \n # Give redemption points, in worst case scenario where all elevators never cross paths\n next_floor_difference = elevator.next_floor - @floor\n if next_floor_difference == 0\n score += 500\n else\n score += 500/(next_floor_difference.abs() + 1)\n end\n end\n end\n\n # Bonify score on request queue size (the smaller number of pre-existing requests, the faster therefore the better)\n if elevator.requests_queue.length() <= 3\n score += 1000\n elsif elevator.requests_queue.length() <= 7\n score += 250\n end\n \n # Send total score of elevator to the scores list\n elevator_scores.append(score)\n end\n end\n\n # Get value of highest score\n highest_score = -1\n for score in elevator_scores do\n if (score > highest_score)\n highest_score = score\n end\n end\n \n # Get elevator with the highest score (or nil if all elevators were offline\n chosen_elevator = nil\n if (highest_score > -1)\n chosen_elevator = @column.elevator_list[elevator_scores.find_index(highest_score)]\n puts \"Chosen elevator: Elevator #{chosen_elevator.id}\"\n end\n return chosen_elevator\n end", "def best_tipper\n meal_with_highest_tip = meals.max do |meal_a, meal_b|\n meal_a.tip <=> meal_b.tip\n end\n\n meal_with_highest_tip.customer \n end" ]
[ "0.5891766", "0.5829512", "0.5767095", "0.54307795", "0.5329864", "0.531303", "0.52799463", "0.5225691", "0.5195573", "0.51468146", "0.514602", "0.51007617", "0.5095855", "0.50956285", "0.5078558", "0.5067649", "0.5025033", "0.5023163", "0.5015977", "0.5013058", "0.500838", "0.5002843", "0.49970236", "0.4996172", "0.499332", "0.4985841", "0.49725568", "0.4964591", "0.4958281", "0.49530017", "0.49470887", "0.4946142", "0.49371064", "0.49333158", "0.4922014", "0.4908909", "0.49044204", "0.490223", "0.4900695", "0.4896904", "0.4896743", "0.48903355", "0.48763013", "0.48705766", "0.4870061", "0.48524642", "0.48507953", "0.48410317", "0.48368934", "0.48271862", "0.48153675", "0.4814352", "0.48087177", "0.48070025", "0.48067898", "0.48038998", "0.48016578", "0.480112", "0.47954735", "0.47843465", "0.47839054", "0.47806394", "0.4780344", "0.4779124", "0.47761104", "0.47746012", "0.47735944", "0.47609264", "0.4760348", "0.4756238", "0.4748268", "0.4734599", "0.47209495", "0.47124022", "0.4712019", "0.47119072", "0.47040114", "0.4697589", "0.46951798", "0.46824548", "0.46805727", "0.46771327", "0.46748888", "0.4671659", "0.46707812", "0.46690026", "0.46658888", "0.46649942", "0.4663534", "0.46614778", "0.46579424", "0.46554583", "0.46530357", "0.46503946", "0.4643098", "0.46371567", "0.46359327", "0.46349618", "0.46344322", "0.4634278", "0.46322736" ]
0.0
-1
For now power_of_attorney returns the first claimant's power of attorney
def power_of_attorney claimants.first&.power_of_attorney end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power_of_attorney\n claimants.first.power_of_attorney if claimants.first\n end", "def calc_am_pure_power(user, target)\n 2\n end", "def object_of_power; end", "def power\n data.power\n end", "def power\r\n return @access >> 26\r\n end", "def power_bonus(att_id)\n\t\t\t@cid = att_id\n\t\t\tpb = Rollem.new\n\t\t\t@att_bonus = pb.rollspread(19,23)\n\t#\t\tputs \" #{@gladiator[@cid]} for slot #{@att_bonus} has an attack bonus of #{@stat[@cid][@att_bonus]} a #{@stat_name[@cid][@att_bonus]} \"\t\n\t\t\tputs \" \"\n\t\tend", "def metric_power\n #noinspection RubyYardReturnMatch\n metric_prefixes.map.with_index { |_item, index| (1000**(index + 1)).to_i }\n end", "def skill_effect_power(user, skill)\r\n power = skill.power + user.atk * skill.atk_f / 100\r\n if power > 0\r\n power -= self.pdef * skill.pdef_f / 200\r\n power -= self.mdef * skill.mdef_f / 200\r\n power = [power, 0].max\r\n end\r\n return power\r\n end", "def digit_nth_powers(n)\r\n\t# collect all integers which are the sum of the digits to the nth power\r\n\tnth_power_sums = (10..find_max_nth_power(n)).select do |prospect|\r\n\t\tprospect == prospect.to_s.chars.map{|digit| digit.to_i ** n}.inject(:+)\r\n\tend\r\n\r\n\t# return sum of these numbers\r\n\tnth_power_sums.inject(:+)\r\nend", "def metric_power\n metric_prefixes.map.with_index { |_item, index| (1000**(index + 1)).to_i }\nend", "def skill_power(skillname, player, usage)\n p \"==>calc #{player.name} skill power of #{skillname} for #{usage}:\"\n skill = player.query_skill(skillname)\n if (skill == nil)\n #logger.info(\"user #{player[:id]}-#{player.ext[:name]} doesn't have skill '#{skillname}'\")\n return 1\n end\n # p = skill.power(context)\n level = skill.data[:level]\n p \"=>level=#{level} apply_attack=#{player.tmp[:apply_attack]} apply_dodge=#{player.tmp[:apply_dodge]}\"\n \n if (usage == \"attack\" && player.tmp[:apply_attack] != nil)\n level += player.tmp[:apply_attack]\n end\n \n if (usage == \"dodge\" && player.tmp[:apply_dodge] != nil)\n # level += player.tmp[:apply_dodge]\n level = level * ( (100 + player.tmp[:apply_dodge]/10 ).to_f / 100 )\n end \n \n # if (usage == \"parry\" && player.tmp[:apply_defense] != nil)\n # level += player.tmp[:apply_dodge]\n # end \n jingli_bonus = 50 + player.tmp[:jingli]/ (player.tmp[:max_jl]+1) * 50\n if (jingli_bonus > 150)\n jingli_bonus = 150\n end\n \n total_exp = calc_total_exp(player.tmp[:level])\n p \"level=#{level} jingli_bonus=#{jingli_bonus}, total exp #{total_exp}\"\n if( level<1 ) \n return (total_exp/20.0 * (jingli_bonus/10) ).to_i\n end\n\n \n p =level**3/3 \n str = player.tmp[:str]\n dext = player.tmp[:dext]\n # p \"===>#{player.tmp.inspect}\"\n \n p \"==>p=#{p}, level=#{level} str=#{str} dext=#{dext} \"\n if (usage == \"attack\" || usage == \"parry\")\n p = (p + total_exp +1) / 30 * (( str+1)/10)\n else\n p = (p + total_exp +1) / 30 * (( dext+1)/10)\n end\n \n p = p.to_i\n p \"==>skill power=#{p}\"\n \n if p <= 1\n return 1\n else\n return p\n end\n end", "def power(base, power)\n base ** power\nend", "def power(a,p)\n\ti=1\n\tpow=1\n\twhile i<=p do\n\t\tpow = pow*a\n\t\ti +=1\n\tend\n\tputs pow\nend", "def power(num,pow)\n if pow == 0\n num\n else\n total = 1\n count = 0\n while count < pow\n total *= num\n count += 1\n end\n return total\n end\nend", "def power(base, power)\r\n base ** multiply(power, 1)\r\nend", "def self_powers\n series = Enumerator.new do |y|\n s = 1\n\n loop do \n y << s ** s\n s += 1\n end\n end\n \n collect = 0 \n until series.peek > (1000 ** 1000 ) do\n collect += series.next\n end\n\n i = collect.to_s.length - 1\n collect.to_s.slice(i - 9..i) \nend", "def power(curr_value, to_power)\n curr_value**to_power\nend", "def how_high(energy)\n energy * energy\nend", "def pow base, p\n base ** p\n end", "def pow (base_num , pow_num)\n results=1\n pow_num.times do \n results*=base_num\n end \n results\nend", "def power_detection(n, largest_exp = true)\r\n\t\tx, k = n, 1\r\n\r\n\t\tlimit = ilog2(n)\r\n\t\t(2..limit).each_prime do |exp|\r\n\t\t\tbreak if limit < exp\r\n\r\n\t\t\troot, pow = iroot(n, exp, true)\r\n\t\t\tif pow == n\r\n\t\t\t\treturn root, exp unless largest_exp\r\n\r\n\t\t\t\tn = x = root\r\n\t\t\t\tk *= exp\r\n\t\t\t\tlimit = ilog2(n)\r\n\t\t\t\tredo\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\treturn x, k\r\n\tend", "def expotential(num, power)\n result = 1\n loop do\n result = multiply(result, num)\n power -= 1\n break if power == 0\n end\n result\nend", "def power(num, power)\r\n num ** power\r\nend", "def power_to_the(power, num)\n result = multiply(num, num)\n if power >=3\n (power - 2).times { result = result * num }\n end\n result\nend", "def pow(base_num, pow_num)\n result = 1\n pow_num.times do |index|\n result = result * base_num\n end\n\n return result\nend", "def dig_pow(n, p)\n sum = n.digits.reverse.map.with_index { |digit, i| digit ** (p + i) }.sum\n sum % n == 0 ? sum / n : -1\nend", "def self_powers_2\n (1..1000).map {|i| i**i}.reduce(:+) % (10**10)\nend", "def power(n)\n n ** 2\nend", "def power_to_the_n(num, power)\n if power == 0\n 1\n elsif power == 1\n num\n else \n counter = 2\n total = multiply(num, num)\n while counter < power\n total = multiply(total, num)\n counter += 1\n end\n total \n end \nend", "def dig_pow(n, p)\n power_arr = []\n\n digit_arr = n.to_s.chars.map(&:to_i)\n\n digit_arr.each do |digit|\n power_arr << (digit ** p)\n p += 1\n end\n\n\n if power_arr.sum % n == 0\n k = power_arr.sum / n\n else\n -1\n end\nend", "def power(num, power)\n\tnum**power\nend", "def pow(base, exponent) #(3, 4) ==> 3 * 3 * 3 * 3 = \n return 1 if exponent == 0 \n #return base if exponent == 1\n base * pow(base, exponent - 1)\nend", "def exponent1(base, power)\n # if power equals zero , then 1 else (base * method(base,power - 1))\n if power == 0\n return 1\n else\n (base * exponent1(base, power - 1))\n end\nend", "def perfect_power(n)\n\nend", "def pow(n,p)\n ans = 1\n while p!=0 do\n ans = ans*n%BASE if p&1==1\n n=n*n%BASE\n p=p>>1\n end\n ans\n end", "def sum_of_power(p)\n result = []\n powers = 0.upto(10).map {|n| n**p}\n 2.upto(p.get_max_num) do |i|\n num = i.get_base_array(10).map {|n| powers[n]}\n if i == num.inject(0) {|t,n| t + n}\n result << i\n end\n end\n return result\nend", "def powerI(power, base)\n acc = 1\n power.times { acc *= base }\n return acc\nend", "def power(n, exp)\n total = 1\n 1.upto(exp) do |num|\n total = multiply(n, total)\n end\n total\nend", "def pow(base_num, pow_num)\n result = 1\n pow_num.times do |index|#loop trough the code ex: if pow_num is = 3, the loop will trough 3 times.\n result = result * base_num\n end\n return result\nend", "def getMilkPowder\n @milk_powder\n end", "def power(a,b)\n @a=a\n @b=b\n\n return @a**@b\n\nend", "def power(x,n)\n n == 0 ? (return 1) : x*power(x,n-1)\n\nend", "def pow(power)\n return nil if power == 0\n cloned_unit = self.clone\n return cloned_unit if power == 1\n if power > 0\n new_unit = self.clone\n (power - 1).times { new_unit *= cloned_unit }\n elsif power < 0\n new_unit = reciprocalize\n ((power.abs) - 1).times { new_unit /= cloned_unit }\n end\n return new_unit\n end", "def power_to_the_n(number, power)\n return 1 if power == 0\n result = 1\n while power > 0\n result = multiply(result, number)\n power -= 1\n end\n result\nend", "def power(nb1, nb2)\n return nb1 ** nb2\nend", "def pow(a,b)\n power=1\n for i in 1..b\n power=power*a\n end\n return power\nend", "def general_power(n, x)\n multiply(n, 1)**(x)\nend", "def power_of_n(number, power)\n array = [number] * power\n base_number = 1\n array.each do |num|\n base_number = multiply(base_number, num)\n end\n base_number\nend", "def how_high\n energy * energy\nend", "def pow(base_num, pow_num)\n result = 1\n pow_num.times do\n result = result * base_num\n end\n return result\nend", "def power_of(num, exponent)\n product = multiply(num, num)\n \n (exponent - 2).times { product *= num }\n\n product\nend", "def num_to_power(num, power)\n # count = 1\n return 1 if power == 0\n return num if power == 1\n num_multiply = power / 2\n product = 1\n num_multiply.times do\n product *= multiply(num, num)\n end\n if power % 2 == 1\n product *= num\n end\n product\nend", "def raise_to_power_brute(x, y)\n result = x\n\n while y > 1\n result *= x\n y -= 1\n end\n\n result\nend", "def power(x,y)\n x**y\nend", "def power(x,y)\n\treturn x**y\nend", "def power!(p0) end", "def my_pow(x, n)\n return x if n == 1\n return x * x if n == 2\n return x / x if n == -2\n\n if n > 0\n x * my_pow(x, n - 1)\n else\n my_pow(x, n + 1)\n end\nend", "def dig_pow(n, p)\n # your code\n num = n.to_s\n total = 0\n for i in (0..(num.size - 1))\n total += (num[i].to_i) ** (p + i)\n end\n\n\n if total % n == 0\n total / n\n else\n -1\n end\nend", "def dig_pow(n, p)\n # your code\n num = n.to_s\n total = 0\n for i in (0..(num.size - 1))\n total += (num[i].to_i) ** (p + i)\n end\n\n\n if total % n == 0\n total / n\n else\n -1\n end\nend", "def power_fact(m, u)\n (u ** m).to_f / fact(m).to_f\n end", "def rpower(n) end", "def power(a, b)\n return a**b\nend", "def nth_powers(n)\n (1..9).to_a.map {|num| num**n}\nend", "def move_power(move)\n @el.expr['attacks'].each do |type, attacks|\n if attacks.include?(move)\n idx = @el.expr['attacks'][type].index(move)\n idx /= 2.0 if type == 'Normal'\n return ((120 * Math.log10((idx + 1).to_f / 2 + 1)) + 1).ceil # 170\n end\n end\n end", "def get_difficulty\n if self.power < 3\n difficulty = 1\n elsif self.power >= 3 && self.power < 6\n difficulty = 2\n else\n difficulty = 3\n end\n end", "def pow!(power)\n make_dimensionless if power == 0\n return self if power == 1\n if power < 0\n self.reciprocalize!\n power *= -1\n end\n return self if power == 1 #reciprocalized self\n original_dimensions = self.clone\n (power - 1).times { self.multiply!(original_dimensions) }\n get_description\n return self\n end", "def rec_exp_1(base, power)\nend", "def power(bas,exponent)\n i = 1\n resultat = bas\n while i < exponent\n resultat *= bas\n i += 1\n end\n return resultat\nend", "def expo_1(number, power)\n return 1 if power == 0\n return number if power == 1 \n\n number * expo(number, power - 1)\nend", "def power(base, exp)\n return base ** exp\nend", "def pow( x, n)\n if (n == 0)\n return (1)\n elsif (n % 2 == 0)\n value = pow(x, n / 2)\n return (value * value)\n else\n value = pow(x, n / 2)\n return (x * value * value)\n end\nend", "def power (*base_and_power)\n base_and_power.inject(:**)\nend", "def exponent_1(base, power)\n\treturn 1 if power == 0\n\tlesser_power = power - 1\n\tbase_to_the_lesser_power = exponent_1(base, lesser_power)\n\tbase * base_to_the_lesser_power\nend", "def power_of_n(num, exponent)\n num ** exponent\nend", "def power_level(x, y)\n ((((x + 10) * y ) + $serial_num) * (x + 10)).digits[2] - 5\nend", "def power_level(x, y)\n ((((x + 10) * y ) + $serial_num) * (x + 10)).digits[2] - 5\nend", "def powers1(n)\n n.to_s(2).to_i.digits.map.with_index { |c, i| c.to_i * 2**i }.reject(&:zero?)\nend", "def factor_out_powers_of(exponent)\n [1, self]\n end", "def getSpecialValue\n maxBonus\n end", "def dig_pow(n, p)\n sum = n.digits.reverse.each_with_index.sum { |d, index| d**(p + index) }\n (sum % n).zero? ? sum.div(n) : -1\nend", "def pow1pm1(x, y)\n (x <= -1) ? ((1 + x) ** y) - 1 : Math.exp(y * Math.log(1.0 + x)) - 1\n end", "def boatswain\n return self.swabbie unless self.swabbie.nil?\n highval = 0\n self.axe.each do |flotsam|\n counter = self.filibuster(flotsam)\n highval = ((highval <=> counter) == 1) ? highval : counter\n end\n \".#{highval + 1}\"\n end", "def calculatePower x,y\n\n # For example, to find the power level of the fuel cell at 3,5 in a grid with serial number 8\n # Find the fuel cell's rack ID, which is its X coordinate plus 10.\n # == The rack ID is 3 + 10 = 13.\n rackID = x + 10\n\n # Begin with a power level of the rack ID times the Y coordinate.\n # Increase the power level by the value of the grid serial number (your puzzle input).\n # Set the power level to itself multiplied by the rack ID.\n # == The power level starts at 13 * 5 = 65.\n # == Adding the serial number produces 65 + 8 = 73.\n # == Multiplying by the rack ID produces 73 * 13 = 949.\n powerLevel = (rackID * y + $serialNumber) * rackID\n\n # Keep only the hundreds digit of the power level (so 12345 becomes 3; numbers with no hundreds digit become 0).\n # The hundreds digit of 949 is 9.\n # Subtract 5 from the power level.\n # Subtracting 5 produces 9 - 5 = 4.\n powerLevel = powerLevel.to_s[-3].to_i-5\n\nend", "def prediction_power( token )\n e1 = 0.0\n e0 = 0.0\n system_total = get_system_total\n max_token_count = get_max_system_token_count\n e0 = system_total - max_token_count[1]\n \n get_pool_names.each do |pool_name|\n\te1 += ( get_token_total(token) - get_token_counts(token, pool_name) )\n end\n return [e1,e0,1-(e1/e0)]\n end", "def #power(a,b)\n\ta ** b\nend", "def highest_attack_power_weapon\n weapon = self.weapons.sort_by do |weapon|\n weapon.attack_power\n end.last\n weapon\n end", "def dig_pow(n, p)\n sum = 0\n n.to_s.split('').map(&:to_i).each do |digit|\n sum += digit**p\n p += 1\n end\n (sum % n).zero? ? sum.to_f / n : -1\nend", "def power(n, e)\n if e == 0\n return 1\n elsif e == 1 \n return n\n else\n multiply(n, n**(e - 1))\n end\nend", "def power_of_n(n, power)\n result = 1\n power.times {result = multiply(n, result)} # similar to recursion\n result\nend", "def desired_xp\n return (200 * level * (level + 1)).to_i\n end", "def pow(x, n)\n if n == 0\n return 1\n elsif n % 2 == 0\n return pow(x, n/2) * pow(x, n/2)\n else\n return x*pow(x, n-1)\n end\nend", "def masterwork_prob_bonus; 0; end", "def power_it(number_1, number_2)\n number_1 ** number_2\nend", "def power (x,y)\n return x**y \nend", "def probA1(bit, sampleSum, remainingSamples, geneSum, remainingGenes, mutsRemaining, bitsRemaining)\n\n ar = sampleSum.to_f/remainingSamples.to_f\n ac = geneSum.to_f/remainingGenes.to_f\n a = mutsRemaining.to_f/bitsRemaining.to_f\n\n prob = nil\n if a == 1 #avoid division by zero problem in prob calculation\n prob = 1\n else\n prob = (ar*ac)/(a*(((1-ar)*(1-ac)/(1-a))+(ar*ac/a)))\n end\n\n #avoid division by zero problem in d calculation\n if prob == 1 \n prob = 0.999999\n elsif prob == 0\n prob = 0.000001\n end\n\n if bit == 1 \n return prob\n end\n return 1-prob\nend", "def pow(power)\n Dimensions.new(self.to_hash).pow!(power)\n end", "def calculate_proof_of_work\n\t\treturn self.pow_strategy.find( self.previous_block.proof, self.previous_hash )\n\tend", "def power(integer, power)\n number_collection = []\n return nil if power < 0\n return 1 if power == 0\n \n power.times do\n number_collection << integer\n end\n \n number_collection.reduce(:*)\nend", "def probA0(bit)\n\n # not quite zero, to avoid paying infinitely large\n # penalty when calculating score (div by zero)\n if bit == 0\n return 0.999999\n else #bit == 1\n # This value can be used to tweak coverage vs\n # exclusivity of modules\n return 0.000005\n end\nend" ]
[ "0.82929695", "0.6228024", "0.61443865", "0.59521675", "0.592249", "0.5920519", "0.59185344", "0.59052867", "0.5869389", "0.58402663", "0.5815954", "0.5793008", "0.57913446", "0.5772158", "0.5762761", "0.5740735", "0.57341623", "0.5720131", "0.57065344", "0.5697112", "0.56900513", "0.5682184", "0.5674261", "0.56658727", "0.56616354", "0.5649156", "0.56425846", "0.5635332", "0.5634271", "0.5629524", "0.5625922", "0.56219774", "0.56170934", "0.5614316", "0.55955976", "0.5586924", "0.55812794", "0.55705076", "0.5556618", "0.5555309", "0.55525887", "0.5548946", "0.5541377", "0.5537448", "0.553721", "0.5528457", "0.5527701", "0.5523862", "0.5522225", "0.552069", "0.5520382", "0.55149776", "0.5513345", "0.54992443", "0.5490544", "0.54885423", "0.54883593", "0.54874986", "0.54874986", "0.5484298", "0.5482164", "0.54765517", "0.5464473", "0.5456136", "0.54552513", "0.5451506", "0.54460365", "0.54422826", "0.543927", "0.54308337", "0.5426919", "0.54268545", "0.5422389", "0.54177654", "0.54176366", "0.54176366", "0.5416774", "0.5413999", "0.54071754", "0.5403314", "0.5398403", "0.5397866", "0.5395522", "0.53873885", "0.537778", "0.5376791", "0.5372311", "0.53711885", "0.53642046", "0.5358388", "0.5356781", "0.5351682", "0.53479433", "0.5343535", "0.53422666", "0.5333679", "0.5333012", "0.5327933", "0.53260124" ]
0.78796595
2
needed for appeal status api
def appeal_status_id "A#{id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def statuses; end", "def retrieve_status\n \n end", "def status(*) end", "def status\n end", "def status\n end", "def status\n end", "def status\n end", "def status_message; end", "def status=(status); end", "def status_code; end", "def get_status\n\t\tstatus\n\tend", "def status\n info['status']\n end", "def status\n service.get(\"\")\n end", "def last_status; end", "def custom_status\n {}\n end", "def status_params\n end", "def api_status\n path = self.api_root + '/status'\n # make sure access token is still valid\n headers = {\n 'Authorization' => \"Bearer #{self.valid_access_token['access_token']}\",\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json'\n }\n begin\n response = RestClient::Request.execute(method: :get, url: path, headers: headers)\n JSON.parse(response.body)\n rescue RestClient::ExceptionWithResponse => e\n Rails.logger.error \"FireCloud status error: #{e.message}\"\n e.response\n end\n end", "def api_error; end", "def status\n request :get, \"_status\"\n end", "def map_status\n end", "def status\n super\n end", "def status_effect; end", "def apis; end", "def status\n get('/api/status')\n end", "def status\n data[:status]\n end", "def status\n head :ok\n end", "def status\n head :ok\n end", "def update_api_status()\n api_status = generate_api_status()\n if !api_status.nil? and !api_status.empty?\n HelperFunctions.write_file(HEALTH_FILE, api_status)\n end\n end", "def status\n debug { \"status\" }\n verify_response { Remote.get('/status', :api_key => api_key ) }\n end", "def good\n @status\n end", "def status\n @status\n end", "def status\n @status\n end", "def status\n get_json('status.json')\n end", "def status\n info[\"Status\"]\n end", "def api_mode; end", "def transform_status(status); end", "def status\n data.status\n end", "def status_info\n current_path = '/api/v1/status'\n @conn.get(current_path)\n end", "def extend_status(_status)\n end", "def get_status\n result = {}\n result['registration'] = !!registration_start_date && !!registration_end_date\n result['cfp'] = !!call_for_papers\n result['venue'] = !!venue && !!venue.name && !!venue.address && !!venue.website\n result['rooms'] = rooms.count > 0\n result['tracks'] = tracks.count > 0\n result['event_types'] = event_types.count > 0\n result['difficulty_levels'] = difficulty_levels.count > 0\n result['process'] = (result.select { |k, v| v }.length / result.length.to_f * 100).round(0).to_s\n result['short_title'] = short_title\n result\n end", "def status\n {\n 'body' => 'Service is up!'\n }\n end", "def pending_requests; end", "def pending_requests; end", "def pending_requests; end", "def generate_api_status()\n if Time.now.to_i - @last_api_status < API_STATUS_CHECK_IN_FREQUENCY\n Djinn.log_debug(\"Not enough time has passed since last time we \" +\n \"gathered API status - will try again later.\")\n return\n end\n\n if my_node.is_appengine?\n apichecker_host = my_node.private_ip\n else\n apichecker_host = get_shadow.private_ip\n end\n\n Djinn.log_debug(\"Generating new API status by contacting API checker \" +\n \"at #{apichecker_host}\")\n apichecker_url = \"http://#{apichecker_host}:#{ApiChecker::SERVER_PORT}/health/all\"\n\n retries_left = 3\n data = {}\n begin\n response = Net::HTTP.get_response(URI.parse(apichecker_url))\n data = JSON.load(response.body)\n\n if data.class != Hash\n Djinn.log_error(\"API status received from host at #{apichecker_url} \" +\n \"was not a Hash, but was a #{data.class.name} containing: #{data}\")\n return\n end\n rescue Exception => e\n Djinn.log_error(\"Couldn't get API status from host at #{apichecker_url}\")\n\n if retries_left > 0\n Kernel.sleep(5)\n retries_left -= 1\n retry\n else\n Djinn.log_warn(\"ApiChecker at #{apichecker_host} appears to be down - will \" +\n \"try again later.\")\n return\n end\n end\n\n majorities = {}\n\n data.each { |k, v|\n @api_status[k] = [] if @api_status[k].nil?\n @api_status[k] << v\n\n # If not enough API statuses are known yet, pad it with 'running' to avoid\n # accidentally claiming that an API has failed without sufficient evidence\n # of its failure.\n @api_status[k] = HelperFunctions.shorten_to_n_items(10, @api_status[k],\n \"running\")\n majorities[k] = HelperFunctions.find_majority_item(@api_status[k])\n }\n\n @last_api_status = Time.now.to_i\n\n json_state = JSON.dump(majorities)\n return json_state\n end", "def status_object\n @status\n end", "def status\n 'unknown'\n end", "def getStatus()\n params = Hash.new\n return doCurl(\"get\",\"/status\",params)\n end", "def status\n o = @api.status\n OpenStruct.new o\n end", "def status()\n puts @status\n end", "def status\n last_response.status\nend", "def pending_response_requests; end", "def status\n @status\n end", "def status\n @status\n end", "def api; end", "def api; end", "def test_firecloud_api_status\n status = @fire_cloud_client.api_status\n assert status.is_a?(Hash), \"Did not get expected status Hash object; found #{status.class.name}\"\n assert status['ok'].present?, 'Did not find root status message'\n assert status['systems'].present?, 'Did not find system statuses'\n # look for presence of systems that SCP depends on\n services = [FireCloudClient::RAWLS_SERVICE, FireCloudClient::SAM_SERVICE, FireCloudClient::AGORA_SERVICE,\n FireCloudClient::THURLOE_SERVICE, FireCloudClient::BUCKETS_SERVICE]\n services.each do |service|\n assert status['systems'][service].present?, \"Did not find required service: #{service}\"\n assert [true, false].include?(status['systems'][service]['ok']), \"Did not find expected 'ok' message of true/false; found: #{status['systems'][service]['ok']}\"\n end\n end", "def response_code; end", "def response_code; end", "def response_code; end", "def response_code; end", "def status_infos\n data[:status_infos]\n end", "def status\n params['ret_status']\n end", "def status\n return :code => info[:statuscode].to_i, :messages => info[:messages]\n end", "def status\n @gapi.status\n end", "def status_hash\n return_val = { status: status ,\n post: true, # settable\n disable: @disable,\n error: @error }\n return_val\n end", "def status\n \"approved\"\n end", "def status(token)\n # Duplicate method so the external API can't register a provider failure\n retrieve_status(token)\n end", "def unknown; status[:unknown]; end", "def status\n @json_body['status']\n end", "def status\n\t\treturn @status\n\tend", "def status\r\n case status_id\r\n when 1; \"Sending\"\r\n when 2; \"Sent\"\r\n when 3; \"Bounced\"\r\n when 4; \"Opened\"\r\n when 5; \"Downloaded\"\r\n when 6; \"Send Failed\"\r\n else; \"Processing\"\r\n end\r\n end", "def api_only; end", "def api_only; end", "def api_only; end", "def api_response(status, message)\n render :json => {:status => status, :message => message}.to_json, :status => status\n end", "def status\n instance_get(:status)\n end", "def status\n \"#{@description} #{@status}\"\n end", "def affiliate_status\n get 'affiliateStatus'\n end", "def getStatus\n @status\n end", "def status_getdata!()\n @status = TAC_PLUS_AUTHEN_STATUS_GETDATA\n end", "def status request\n @status\n end", "def boiler_status; end", "def status\n super || StatusType.active\n end", "def ok; @status = 200 end", "def ok; @status = 200 end", "def status\n @app = ThirdpartyService.get_app(@url, AUTH, @http, @body)\n if @app['code'] != nil\n session[:toast_type] = 'error'\n session[:toast_message] = @app['errors'][0]['message']\n redirect_to app_list_path\n return\n end\n # Display success message\n session[:toast_type] = 'status'\n session[:toast_message] = 'App ' + params[:status] + 'ed successfully'\n end", "def status_code(*)\n end", "def index\n head params[:response_status]\n end", "def status\n get_request_without_headers(endpoint_uri('status'))\n end", "def status\n raise NotImplementedError\n end" ]
[ "0.7415168", "0.7415168", "0.7415168", "0.7415168", "0.7415168", "0.7415168", "0.7415168", "0.7415168", "0.7415168", "0.72959346", "0.7189796", "0.71434397", "0.7021668", "0.7021668", "0.7021668", "0.7021668", "0.7007037", "0.67824924", "0.6777188", "0.6684741", "0.6660862", "0.6646397", "0.66309655", "0.6568823", "0.6566502", "0.6563087", "0.6554528", "0.653911", "0.65241116", "0.65092605", "0.65054923", "0.6462645", "0.644911", "0.64440846", "0.64111394", "0.64111394", "0.6381911", "0.63754034", "0.63726646", "0.63668007", "0.63668007", "0.6366635", "0.6366304", "0.63468033", "0.63120276", "0.6286492", "0.62744695", "0.6272181", "0.6266776", "0.6260346", "0.6237031", "0.6237031", "0.6237031", "0.62137485", "0.6211204", "0.62043715", "0.6201561", "0.619428", "0.6188917", "0.6152164", "0.615038", "0.614847", "0.614847", "0.61393607", "0.61393607", "0.6134856", "0.613314", "0.613314", "0.613314", "0.613314", "0.61159366", "0.6115716", "0.6098686", "0.60960305", "0.6083945", "0.608069", "0.6068021", "0.60676426", "0.60637563", "0.6056712", "0.6054544", "0.604647", "0.604647", "0.604647", "0.6024376", "0.60241705", "0.59964037", "0.59938085", "0.59719324", "0.5969821", "0.5968661", "0.59650606", "0.5962788", "0.5960143", "0.5960143", "0.5955942", "0.595515", "0.5951941", "0.595068", "0.59329796" ]
0.617646
59
rubocop:disable CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity
def fetch_pre_decision_status if pending_schedule_hearing_task? :pending_hearing_scheduling elsif hearing_pending? :scheduled_hearing elsif evidence_submission_hold_pending? :evidentiary_period elsif at_vso? :at_vso elsif distributed_to_a_judge? :decision_in_progress else :on_docket end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def probers; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def strategy; end", "def refutal()\n end", "def used?; end", "def suivre; end", "def isolated; end", "def isolated; end", "def offences_by; end", "def executor; end", "def executor; end", "def executor; end", "def operations; end", "def operations; end", "def private_method\n end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def custom; end", "def custom; end", "def internal; end", "def intensifier; end", "def ignores; end", "def common\n \n end", "def prepareForReuse; end", "def processor; end", "def apply\n end", "def spec; end", "def spec; end", "def celebration; end", "def internship_passed; end", "def anchored; end", "def operation; end", "def same; end", "def ignore; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def who_we_are\r\n end", "def initialize\n \n end", "def weber; end", "def villian; end", "def initialize\n \n end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def generate_comprehensive\n\n end", "def checks; end", "def identify; end", "def under_construction\n end", "def missing; end", "def formation; end", "def used\n raise NotImplementedError\n end", "def initialize\n\n end", "def initialize\n\n end", "def extra; end", "def pausable; end", "def wrapper; end", "def original_result; end", "def initialize() end", "def apply()\n end", "def initialize\n\t\t\n\tend", "def internal?; end", "def final; end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def code_of_conduct; end", "def init; end", "def init; end", "def init; end", "def init; end", "def offences_by=(_arg0); end", "def initialize\n super\n end", "def initialize\n super\n end", "def initialize\n super\n end", "def perform\n \n end", "def initialize\n # nothing here for now\n end", "def initialize\n super()\n end", "def overrides; end" ]
[ "0.7505564", "0.62114626", "0.62114626", "0.62113", "0.6049034", "0.6038803", "0.6038803", "0.6038803", "0.6038803", "0.60220784", "0.60151976", "0.58800304", "0.58698237", "0.58152044", "0.58152044", "0.58062404", "0.578759", "0.578759", "0.578759", "0.5780685", "0.5780685", "0.5758554", "0.57288253", "0.57288253", "0.5728745", "0.5728745", "0.57149506", "0.567358", "0.56610674", "0.5658877", "0.56221", "0.5616665", "0.5608276", "0.5601767", "0.5601767", "0.55941236", "0.5593923", "0.5584066", "0.5571495", "0.55621624", "0.5547287", "0.5546951", "0.5546951", "0.5546951", "0.5546951", "0.5546951", "0.5546951", "0.5546951", "0.5546951", "0.5546951", "0.55462414", "0.55437654", "0.55435765", "0.5531533", "0.55059636", "0.5466918", "0.5466918", "0.5466918", "0.5466918", "0.5466918", "0.5466918", "0.5466918", "0.5466918", "0.5466918", "0.5466918", "0.5466918", "0.5453857", "0.5441214", "0.5438376", "0.54325396", "0.54302603", "0.5429305", "0.5423585", "0.5415585", "0.5415585", "0.54152393", "0.5405215", "0.5402278", "0.5391313", "0.5384896", "0.5384639", "0.53836757", "0.5361664", "0.5356953", "0.5353346", "0.5353346", "0.5353346", "0.5353346", "0.53524995", "0.5350357", "0.5350357", "0.5350357", "0.5350357", "0.5349431", "0.53417355", "0.53417355", "0.53417355", "0.5340968", "0.5335389", "0.53325355", "0.5326034" ]
0.0
-1
rubocop:enable CyclomaticComplexity rubocop:enable Metrics/PerceivedComplexity rubocop:disable Metrics/MethodLength rubocop:disable CyclomaticComplexity
def fetch_details_for_status case fetch_status when :bva_decision { issues: api_issues_for_status_details_issues(decision_issues) } when :ama_remand { issues: api_issues_for_status_details_issues(decision_issues) } when :post_bva_dta_decision post_bva_dta_decision_status_details when :bva_decision_effectuation { bva_decision_date: decision_event_date, aoj_decision_date: decision_effectuation_event_date } when :pending_hearing_scheduling { type: "video" } when :scheduled_hearing api_scheduled_hearing_status_details when :decision_in_progress { decision_timeliness: AppealSeries::DECISION_TIMELINESS.dup } else {} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def probers; end", "def schubert; end", "def refutal()\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def strategy; end", "def suivre; end", "def offences_by; end", "def operations; end", "def operations; end", "def private_method\n end", "def common\n \n end", "def intensifier; end", "def custom; end", "def custom; end", "def used?; end", "def anchored; end", "def internal; end", "def who_we_are\r\n end", "def isolated; end", "def isolated; end", "def executor; end", "def executor; end", "def executor; end", "def celebration; end", "def checks; end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def villian; end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def ignores; end", "def internship_passed; end", "def operation; end", "def generate_comprehensive\n\n end", "def formation; end", "def weber; end", "def processor; end", "def spec; end", "def spec; end", "def missing; end", "def apply\n end", "def code_of_conduct; end", "def ignore; end", "def identify; end", "def extra; end", "def appraisals; end", "def appraisals; end", "def same; end", "def initialize\n \n end", "def under_construction\n end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize\n \n end", "def prepareForReuse; end", "def used\n raise NotImplementedError\n end", "def relatorios\n end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def silly_adjective; end", "def wrapper; end", "def initialize\n\n end", "def initialize\n\n end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def apply()\n end", "def jack_handey; end", "def returns; end", "def missing?; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end", "def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end", "def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end", "def overrides; end" ]
[ "0.73557204", "0.6193672", "0.6193672", "0.61274225", "0.5964895", "0.5862997", "0.5857945", "0.5857945", "0.5857945", "0.5857945", "0.58357155", "0.58067286", "0.57552665", "0.57416034", "0.57416034", "0.5735425", "0.57157385", "0.5714775", "0.5706094", "0.5706094", "0.56721514", "0.56043994", "0.56006956", "0.55920625", "0.5588685", "0.5588685", "0.55487686", "0.55487686", "0.55487686", "0.55421764", "0.55391234", "0.5533565", "0.5533565", "0.55296206", "0.55226886", "0.55226886", "0.55226886", "0.55226886", "0.551236", "0.5506014", "0.5480573", "0.54729617", "0.5472051", "0.54603386", "0.5456526", "0.5449952", "0.5449952", "0.5449117", "0.5439729", "0.5422888", "0.54079974", "0.5384161", "0.5377981", "0.5351881", "0.5351881", "0.534463", "0.5331999", "0.53262895", "0.5325526", "0.5325526", "0.5325526", "0.5325526", "0.5325526", "0.5325526", "0.5325526", "0.5325526", "0.5325526", "0.5325526", "0.5325526", "0.53241044", "0.5318633", "0.53111035", "0.53079045", "0.5301812", "0.5301812", "0.5301812", "0.5301812", "0.5265331", "0.5261842", "0.5258076", "0.5258076", "0.52574223", "0.52574223", "0.52574223", "0.52574223", "0.52574223", "0.52574223", "0.52574223", "0.52574223", "0.52574223", "0.52544665", "0.52503693", "0.52393514", "0.52389485", "0.5232599", "0.5232599", "0.5232599", "0.5228391", "0.5228391", "0.5228391", "0.5226624" ]
0.0
-1
rubocop:enable CyclomaticComplexity rubocop:enable Metrics/MethodLength
def post_bva_dta_decision_status_details issue_list = remanded_sc_decision_issues { issues: api_issues_for_status_details_issues(issue_list), bva_decision_date: decision_event_date, aoj_decision_date: remand_decision_event_date } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def probers; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def strategy; end", "def used?; end", "def suivre; end", "def custom; end", "def custom; end", "def operations; end", "def operations; end", "def internal; end", "def private_method\n end", "def isolated; end", "def isolated; end", "def intensifier; end", "def offences_by; end", "def executor; end", "def executor; end", "def executor; end", "def common\n \n end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def processor; end", "def anchored; end", "def ignores; end", "def who_we_are\r\n end", "def celebration; end", "def operation; end", "def spec; end", "def spec; end", "def internship_passed; end", "def apply\n end", "def weber; end", "def checks; end", "def identify; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def missing; end", "def same; end", "def villian; end", "def initialize\n \n end", "def initialize\n \n end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def ignore; end", "def prepareForReuse; end", "def wrapper; end", "def internal?; end", "def formation; end", "def used\n raise NotImplementedError\n end", "def missing?; end", "def extra; end", "def initialize\n\n end", "def initialize\n\n end", "def under_construction\n end", "def code_of_conduct; end", "def initialize() end", "def final; end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def returns; end", "def overrides; end", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize\n\t\t\n\tend", "def apply()\n end", "def call; end", "def call; end", "def call; end", "def call; end" ]
[ "0.7652754", "0.6421851", "0.6421851", "0.63809973", "0.6231824", "0.6214224", "0.6214224", "0.6214224", "0.6214224", "0.6161234", "0.60857505", "0.6006304", "0.60033596", "0.59283596", "0.59283596", "0.5927897", "0.5927897", "0.5892361", "0.58667564", "0.58412385", "0.58412385", "0.58312976", "0.58176786", "0.58156127", "0.58156127", "0.58156127", "0.5788955", "0.57842493", "0.57842493", "0.57476413", "0.5734731", "0.5729951", "0.5707278", "0.57038873", "0.56965744", "0.56958544", "0.56958544", "0.5688379", "0.56739265", "0.5670189", "0.56571585", "0.5636624", "0.56364244", "0.56364244", "0.56364244", "0.56364244", "0.56364244", "0.56364244", "0.56364244", "0.56364244", "0.56364244", "0.5631595", "0.5628619", "0.5622249", "0.56116444", "0.5603869", "0.5593338", "0.5593338", "0.5593338", "0.5593338", "0.5593338", "0.5593338", "0.5593338", "0.5593338", "0.5593338", "0.5593338", "0.5593338", "0.558889", "0.5588265", "0.55842537", "0.55822974", "0.5574456", "0.55441344", "0.5538719", "0.553269", "0.55206966", "0.55206966", "0.55205894", "0.5511958", "0.55085254", "0.5507974", "0.5507272", "0.5507272", "0.5507272", "0.5507272", "0.54980683", "0.54980683", "0.54980683", "0.54980683", "0.5496603", "0.54947877", "0.5486717", "0.5486717", "0.5486717", "0.5486717", "0.54823285", "0.5453215", "0.5436958", "0.5436958", "0.5436958", "0.5436958" ]
0.0
-1
we always want to show ratings on intake
def can_contest_rating_issues? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n set_rating\n end", "def rating\n review.rating if review\n end", "def num_ratings \n 5\n end", "def rating\n rating_calculator.rate(raters)\n end", "def rating\r\n\t\t@rating\r\n\tend", "def rating\n 0\n end", "def rating\n @rating\n end", "def rating\n # review = Review.where(user_id: user.id, video_id: video.id).first\n #review = Review.find_by(user_id: user.id, video_id: video.id)\n review.rating if review\n end", "def rating #Getter\n @rating\n end", "def set_rating\n food_reviews = self.food_reviews\n if self.has_rating\n totrating = 0\n food_reviews.each do |food_review|\n totrating = totrating + food_review.rating\n end\n avg_rating = totrating.to_f/food_reviews.length\n @food_rating = avg_rating.round(2)\n return\n end\n @food_rating = 0.0\n end", "def show\n @overall = overall_rating\n end", "def show\n @movie = Movie.find(params[:id])\n @current_users_rating ||= @movie.ratings.where(user: current_user).pick(:rating)\n \n if @movie.ratings.any?\n @average_rating = @movie.ratings.average(:rating).round(2) \n @ratings_count = @movie.ratings.count(:rating)\n end\n end", "def show\n @rating = UserRating.where(movie_id: @movie.id).average(:rating)\n if @rating\n @rating = @rating.round(1)\n else\n @rating = 0\n end\n end", "def show\n @reviews = Review.where(tutor_profile_id: @tutor_profile.id).order(\"created_at DESC\")\n if @reviews.blank?\n avg_rating = 0 \n else\n @avg_rating = @reviews.average(:rating).round(2) \n end\n end", "def ratings_query\n super\n end", "def set_rating\n all_ratings = []\n self.reviews.each { |review| all_ratings << review.overall_rating }\n self.rating = all_ratings.reduce(:+) / (all_ratings.length * 1.0)\n self.save\n end", "def rating\n cached_rating\n end", "def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end", "def show\n @tv_episode = TvEpisode.find(params[:id])\n @IMDBrating = Rating.rating(\"TvEpisode\",\"tv_episodes\",params[:id],'IMDB').to_a[0]\n @TVDBrating = Rating.rating(\"TvEpisode\",\"tv_episodes\",params[:id],'TVDB').to_a[0]\n\n\n if [email protected]?\n @IMDBrating = @IMDBrating.average[0..2]\n else\n @IMDBrating = \"N/A\"\n end\n\n if [email protected]?\n @TVDBrating = @TVDBrating.average[0..2]\n else\n @TVDBrating = \"N/A\"\n end\n\n @reviews = TvEpisode.reviews(@tv_episode.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tv_episode }\n end\n end", "def update_ratings\n tournament.rater.update_ratings(self)\n end", "def rating\n return nil unless ratings.length > 0\n (ratings.average(:value) / 0.25).round * 0.25\n end", "def show\n @average = Review.where(:omise_id => params[:id]).average(:rating)\n\n if Review.where(:omise_id => params[:id]).count == 0\n @average_show = 0\n elsif Review.where(:omise_id => params[:id]).count == 1\n\n @average_show = @average\n else\n @average_show = @average.round(1)\n end\n\n end", "def index\n @ratings = Rating.all\n end", "def index\n @ratings = Rating.all\n end", "def index\n @ratings = Rating.all\n end", "def show\n movies_search = Movie.search_rating(@movie.name)\n unless(movies_search['total']==0)\n @rating = movies_search['movies'][0]['ratings']['audience_score']\n @poster = movies_search['movies'][0]['posters']['original']\n @movie.poster = @poster\n @movie.save\n end\n end", "def show\n @review = Review.new\n\n if @listing.reviews.blank?\n @avg_rating = 0\n else\n @avg_rating = @listing.reviews.average(:rating).round(2)\n end\n\n end", "def rating\n if average_rating?\n # Integerize it for now -- no fractional average ratings\n (the_ratings = ratings.average(:rating)) ? the_ratings.round : 0.0\n else\n self.old_rating.nil? ? nil : self.old_rating.rating\n end\n end", "def rating\n return @rating\n end", "def rating\n reviews.average(:rating)\n end", "def rating _args\n \"rating _args;\" \n end", "def show\n @reviews = Review.where(videogame_id: @videogame.id).order(\"created_at DESC\")\n \n if @reviews.blank?\n @avg_rating = 0\n else\n @avg_rating = @reviews.average(:rating).round(2)\n end\n end", "def ratings\n\t\tself.reviews.map{|review| review.rating}\n\tend", "def show\n @reviews = @album.reviews.order(\"created_at DESC\")\n unless @reviews.present?\n @avg_review = 0\n else\n @avg_review = @reviews.average(:rating).present? ? @reviews.average(:rating).round(2) : 0\n end\n end", "def rating\n rating_id.get_object.name\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def show\n @rating = Rating.new\n @rating.beer = @beer\n end", "def ratings(number_of_reviews)\n\t\treturn true if number_of_reviews > 0\n\tend", "def ratings_count\n ratings.count\n end", "def indesign_review_stars( article )\n if article.review? && (article.review_rating.to_i > 0)\n text = \"<ParaStyle:Reviews\\\\:Review Rating>\"\n text << (0..article.review_rating.to_i-1).collect{|n| \"r\"}.join\n return text.html_safe\n else\n return \"\"\n end\n end", "def show\n @user = @profile.user.id \n @reviews = Review.where(:profile_id => @profile.id).order(\"created_at DESC\")\n @average_rating = @reviews.average(:rating)\n end", "def rating\n rat = Rating.average(:rating, :conditions => [\"photo_id = ?\", self.id])\n if rat\n rat\n else\n 0\n end\n end", "def show\n @reviews = Review.where(music_id: @music.id).order(\"created_at DESC\")\n\n if @reviews.blank?\n @avg_review = 0\n else\n @avg_review = @reviews.average(:rating).round(2)\n end\n end", "def set_idea_rating\n @idea_rating = IdeaRating.find(params[:id])\n end", "def show\n @dev = User.find(params[:id])\n @ratings = RatingService::get_ratings(@dev)\n end", "def show\n @review = Review.new\n # @landmark = Landmark.find(params[:id])\n @review.landmark = @landmark\n @star_ratings = StarRating.where(landmark_id: @landmark)\n @star_rating = StarRating.new\n\n if @star_ratings.blank?\n @avg_rating = 0\n else\n @avg_rating = @star_ratings.average(:rating).round(2)\n end\n\n end", "def rating\n @ole.Rating\n end", "def show\n\t\t@widget = Widget.find(params[:id])\n\t\t@rate = @widget.ratings.average :rate\n\tend", "def index_ratings\n @rating = Rating.all\n end", "def show\n @myRating= Rating.find_by_wine_id_and_user_id(@wine.id,current_user.id);\n @myRating= Rating.new(user_id: current_user.id) if @myRating.nil?\n \n User.all.each do |i|\n if(! @wine.ratings.any?{|r| r.user_id==i.id})\n curr= Rating.find_by_wine_id_and_user_id(params[:wine_id],current_user.id);\n if(curr.nil?)\n curr= Rating.new()\n curr[:wine_id]= params[@wine.id]\n curr[:user_id]= i.id\n end\n \n @wine.ratings.push(curr)\n end\n end\n \n end", "def rating\n Rating.average(:rating, :conditions => [\"sight_id = ?\", self.id])\n end", "def show\n if @book.reviews.blank?\n # if no reviews set this val to none\n @average_review = 0;\n else\n # round the reviews by half a star approx\n @average_review = @book.reviews.average(:rating).round(2)\n end\n end", "def rating\n if self.rating_sum > 0 && self.rating_count > 0\n (self.rating_sum / self.rating_count).round(2)\n end\n end", "def average_ratings\n ratings = 0\n self.ratings.each {|r| ratings += r.score}\n avg = votes == 0 ? 0 : ratings.to_f/votes.to_f\n \"%.1f\" % avg\n end", "def average_ratings\n ratings = 0\n self.ratings.each {|r| ratings += r.score}\n avg = votes == 0 ? 0 : ratings.to_f/votes.to_f\n \"%.1f\" % avg\n end", "def show\n @reviews = @dog.reviews\n @rating = Review.get_average_rating(@dog)\n end", "def rate(rating)\n @nb_ratings += 1\n @sum_ratings += rating\n @average_rating = @sum_ratings / @nb_ratings\n end", "def show\n goodreads = Goodreads.new.book_by_isbn(@book.isbn)\n @rating = goodreads.average_rating.to_f\n @num_ratings = goodreads.work.ratings_count\n rescue\n @rating = 0.0\n @ratings_count = 0\n end", "def ratings_count\n rating && rating.ratings_count || 0\n end", "def add_rating(rating)\n if @count < TRAINING_SET_SIZE\n add_movie(rating)\n add_user(rating)\n @count += 1\n else\n @test_set << rating\n end\n end", "def show\n @items = Item.order(\"item_price ASC\").where(\"restaurant_id == ? \",params[:id])\n @restaurant = Restaurant.find(params[:id])\n @reviews = Review.find_all_by_restaurant_id(params[:id])\n if customersigned_in?\n @review = current_customer.reviews.build(restaurant_id: params[:id])\n @rating = current_customer.ratings.find_by_restaurant_id(params[:id])\n if @rating.nil?\n @rating = current_customer.ratings.build(restaurant_id: params[:id], user_rating: 0)\n end\n end\n\n end", "def rating\n return @rating if @rating\n result = PublicEarth::Db::Collection.one.rating(self.id)\n @rating = { :average_rating => result['average_rating'].to_f, :rating_count => result['rating_count'].to_i } rescue nil\n end", "def update_rating\n ratings = reviews.pluck(:rating)\n value = ratings.empty? ? 0 : (ratings.reduce(:+).to_f / ratings.size)\n update(rating: value)\n end", "def show\n @article = Article.find(params[:id])\n @rating = Rating.new\n \n #limited to first 5\n @related_articles = @article.find_related_tags.limit(5)\n \n @ratings = @article.ratings\n @quality = quality_avg(@ratings)\n @interest = interest_avg(@ratings)\n @readagain = readagain_avg(@ratings)\n @words = get_words(@ratings)\n \n \n \n @title = \"Specialties of the Day\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def review(rating)\n user = User.new\n user.read_creddentials\n user.login\n response = user.review rating\n if response\n puts 'Last food reviewed!'\n else\n puts 'Nothing to review'\n end\n end", "def show\n @project = @design.project_id\n @reviews = Review.where(design_id: @design.id).order(\"created_at DESC\")\n if @reviews.blank?\n @avg_rating = 0\n else\n @avg_rating = @reviews.average(:rating).round(2)\n end\n end", "def avg_rating\n @avg = self.ratings.average(:rating) \n @avg ? @avg : 0\n end", "def count_ratings\n\t\tself.ratings.all.count\n\tend", "def show\n @anecdote = Anecdote.find(params[:id])\n \n @ratings = @anecdote.ratings.reverse_order\n end", "def show\n @comment = Comment.new\n @comment.user = current_user\n @comment.tvshow = @tvshow\n\n if (current_user != nil)\n @rating = Rating.find_by(user_id: current_user.id, tvshow_id: @tvshow.id)\n\n if @rating == nil\n @rating = Rating.new\n @rating.score = 0\n end\n end\n\n\n @total = @tvshow.ratings.length\n @moyenne = 0\n @pourcentage = 0\n\n for rate in @tvshow.ratings\n @moyenne += rate.score\n end\n\n if @total > 0\n @moyenne = @moyenne/@total\n @pourcentage = @moyenne / 5.0 * 100.0\n else\n @moyenne = 0\n @pourcentage = 0\n end\n\n end", "def show\n @reviews = Review.select { |review| review.item_id == @item.id }\n @review = Review.new(item_id: @item.id)\n @ratingSum = 0.0\n @reviews.each do |review|\n @ratingSum = @ratingSum + review.rating\n end\n @avgRating = (@ratingSum/@reviews.count).round(1)\n if logged_in?\n @isPrevRented = Rental.find_by(user_id: current_user.id, history: true, item_id: params[:id])\n @isPrevReviewed = Review.find_by(user_id: current_user, item_id: params[:id])\n end\n @rentals = Rental.where(item_id: params[:id], history: true)\n end", "def rating\n average = 0.0\n ratings.each { |r|\n average = average + r.rating\n }\n if ratings.size != 0\n average = average / ratings.size\n end\n average\n end", "def check_rating\n if self.rating == nil \n self.rating = 0\n end \n end", "def rating\n r = Rating.create_from_database(rating_id.to_i)\n r.rating\n end", "def show\n @fooddrinks = Fooddrink.all\n Fooddrink.update_avg_qty(@fooddrink)\n @recommends = Fooddrink.where(user_id: @fooddrink.user_id).where.not(id: @fooddrink.id).order(created_at: :desc)\n end", "def listing_ratings\n review_ids = Review.where(listing_id: listings.select(:id).collect(&:id)).select(&:id).collect(&:id)\n ReviewRating.where(review_id: review_ids)\n end", "def set_rating\n @rating = Rating.find_by_name(params[:id])\n end", "def show\n if @game.reviews.blank?\n @average_review = 0\n else\n @average_review = @game.reviews.average(:rating).round(2)\n end\n end", "def show\n if current_launcher\n @comment = @coin_ico.comments.build(launcher_id:current_launcher.id) \n @rating = Rating.where(coin_ico_id: @coin_ico.id, launcher_id: @current_launcher.id).first\n unless @rating\n @rating = Rating.create(coin_ico_id: @coin_ico.id, launcher_id: @current_launcher.id, score: 0)\n end\n puts \"-------#{@rating.errors.inspect}-----------\"\n end\n end", "def swagger \n critiq_rating + like_rating\n end", "def rated_by?( user )\n\t\t\t\t\tratings.detect {|r| r.user_id == user.id }\n\t\t\t\tend", "def getUserStarRating(u, e)\n return (getUserRating(u, e) != \"None\") ? reviewRating(getUserRating(u, e)) : \"None\".html_safe\n end", "def index\n @reviews_and_ratings = ReviewsAndRating.all\n end", "def show\n @rating1 = @question.answers.where(count: 1).count\n @rating2 = @question.answers.where(count: 2).count\n @rating3 = @question.answers.where(count: 3).count\n @rating4 = @question.answers.where(count: 4).count\n @rating5 = @question.answers.where(count: 5).count\n\n end", "def show\n # @todo comment this out and replace with proper user 'deleted' flag\n if User.where(id: @book.user_id.to_s.to_i).exists?(conditions = :none)\n @book_user = User.find(@book.user_id)\n else\n @book_user = User.find_by(username: 'removedUser')\n end\n @rating = Rate.where(rateable_id: @book.id)\n unless @rating.empty?\n @sum = 0\n @rating.each do |rate|\n @sum += rate.stars_num\n end\n @final_rating = @sum / @rating.length\n @remaining_stars = 5 - @final_rating\n end\n end", "def show\n # Update the view counter if the viewer has a unique session hash\n impressionist(@post, nil, { unique: [:session_hash] })\n\n # Checks if the current trader is allowed to buy the item in this post\n if current_trader\n @in_buy_cat = ApprovedBuyCat.where(trader_id: current_trader.id).where(status: \"1\").exists?(:buy_cat_id => @post.subcategory_id)\n end\n @bid = Bid.new(post_id: @post.id)\n\n # Get the rating for the post\n ratings = Trade.includes(:post).where(posts: { trader_id: @post.trader_id } ).collect{|m| m.rating.to_i}.compact\n length = ratings.collect{|m| if m != 0\n m\n end}.compact.length\n\n @rating = ratings.sum.to_f / (length == 0? 1 : length)\n if @rating == nil\n @rating = 0\n end\n\n end", "def num_ratings\n ratings.count\nend" ]
[ "0.733439", "0.70936286", "0.70198995", "0.6919473", "0.6864956", "0.6845459", "0.67886686", "0.6786422", "0.67759085", "0.6765408", "0.67482823", "0.67391205", "0.67296636", "0.6726875", "0.6710505", "0.65838486", "0.6528316", "0.6513746", "0.6502415", "0.6496189", "0.6484872", "0.6457706", "0.64355785", "0.64355785", "0.64355785", "0.64306927", "0.6407469", "0.64050347", "0.640431", "0.63968104", "0.63924795", "0.6382673", "0.6381853", "0.6374479", "0.6363055", "0.63626516", "0.63626516", "0.63626516", "0.63589585", "0.63480264", "0.6345626", "0.6345626", "0.6345626", "0.6345626", "0.6345626", "0.6345626", "0.6345626", "0.6345626", "0.6345626", "0.6345626", "0.6344342", "0.63322514", "0.6325141", "0.6322113", "0.63120794", "0.6306318", "0.6295663", "0.62912875", "0.6289717", "0.6289526", "0.62867486", "0.6279807", "0.62782496", "0.62744063", "0.6273963", "0.62668085", "0.62659705", "0.6255799", "0.6255799", "0.6236283", "0.6234169", "0.62330365", "0.62324077", "0.62176216", "0.62173116", "0.62167925", "0.6214114", "0.62061685", "0.6205887", "0.62035537", "0.6197427", "0.61913097", "0.6173812", "0.6162885", "0.61569977", "0.615415", "0.61492074", "0.6148932", "0.6146756", "0.61418587", "0.61346483", "0.6130098", "0.61234397", "0.61230284", "0.6119738", "0.6114022", "0.61088294", "0.61071104", "0.60980254", "0.6097372", "0.6096794" ]
0.0
-1
def set_light(name, action) end
def set_thermostat(location, temperature) #@nest.set_temperature(location, temperature) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def light(action = :toggle)\n case action\n when :on, :off\n @elements.light.values.each { |element| element.public_send(action) if element.respond_to? action }\n when :toggle\n light_off? ? light(:on) : light(:off)\n end\n end", "def switchLight _obj, _args\n \"_obj switchLight _args;\" \n end", "def change_light(light, quote)\n\n\tif quote.changePercent <= -1\n\t\tlight.set_color LIFX::Color.red, duration: 0\n\t\tMac::TTS.say(\"#{quote.name} is down #{quote.changePercent.abs} percent\", :victoria)\n\telsif quote.changePercent >= 1\n\t\tlight.set_color LIFX::Color.green, duration: 0\n\t\tMac::TTS.say(\"#{quote.name} is up #{quote.changePercent.abs} percent\", :victoria)\n\telse\n\t\tlight.set_color LIFX::Color.blue, duration: 0\n\t\tMac::TTS.say(\"#{quote.name} is flat at #{quote.changePercent} percent\", :victoria)\n\tend\n\tsleep(0.5)\n\tlight.set_color LIFX::Color.hsb(0,0,0.35), duration: 0\n\nend", "def set_light\n @light = Light.find(params[:id])\n end", "def set_light\n @light = Light.find(params[:id])\n end", "def set_light\n @light = Light.find(params[:id])\n end", "def setLightColor _obj, _args\n \"_obj setLightColor _args;\" \n end", "def on\n @level = 100\n puts \"Light is on\"\n end", "def on\n @level = 100\n puts \"Light is on\"\n end", "def initialize(light)\n @light = light\n end", "def initialize(light)\n @light = light\n end", "def setLightBrightness _obj, _args\n \"_obj setLightBrightness _args;\" \n end", "def turnLightsOn\n @lightsOn = true\n end", "def setLightAmbient _obj, _args\n \"_obj setLightAmbient _args;\" \n end", "def execute\n light.on\n end", "def update_light(colour)\n case colour\n when \"green\"\n return \"yellow\"\n when \"yellow\"\n return \"red\"\n when \"red\"\n return \"green\"\n end\nend", "def setLightIntensity _obj, _args\n \"_obj setLightIntensity _args;\" \n end", "def lights(x)\n if x == \"on\"\n @lightstatus = \"on\"\n elsif x == \"off\"\n @lightstatus = \"off\"\n else\n p \"Type lights(on) or lights(off)\"\n end\n end", "def switch_light_on\n puts \"*** switch_light_on\"\n true\nend", "def control_light\n if @is_toggled\n @is_emitting_light = true\n else\n @is_emitting_liht = false\n end\n end", "def setLightDayLight _obj, _args\n \"_obj setLightDayLight _args;\" \n end", "def control_light\n if @is_toggled\n @is_emitting_light = true\n else\n @is_emitting_light = false\n end\n end", "def red\n\t\tlight COLOR_KEY_RED\n\tend", "def bright; end", "def bright; end", "def lights(lights)\n if lights == \"on\"\n @lights = true\n elsif lights == \"off\"\n @lights = false\n end\n end", "def setLightnings _obj, _args\n \"_obj setLightnings _args;\" \n end", "def light_switch_button\n $tracer.trace(__method__)\n return ToolTag.new(a.id(\"/Switch/\"), __method__)\n end", "def update_light(current)\n if current == \"green\"\n puts \"yellow\"\n elsif current == \"yellow\"\n puts \"red\"\n elsif current == \"red\"\n puts \"green\"\n end\nend", "def execute\n @last_level = @light.level\n @light.on\n end", "def back_light=(new_state)\n\t try_set_screen\n\t tmp = new_state ? 1 : 0\n\t Klass.setBacklight(@handle, tmp)\n new_state\n end", "def add_light(light_id, light_name)\n Light.new(light_name, light_id, @api_endpoint, @key)\n end", "def add_light(light_id, light_name)\n Light.new(light_name, light_id, @api_endpoint, @key)\n end", "def set_state(ul,lr,state)\r\n update_lights(ul,lr) do |i,j|\r\n @lights[i][j] = state\r\n end\r\n end", "def undo\n light.on\n end", "def set_flashlight\n @flashlight = Flashlight.find(params[:id])\n end", "def dark; end", "def dark; end", "def set_high_light\n @high_light = HighLight.find(params[:id])\n end", "def yellow \n\t\tlight COLOR_KEY_YELLOW\n\tend", "def green\n\t\tlight COLOR_KEY_GREEN\n\tend", "def set_lighting_class\n @lighting_class = LightingClass.find(params[:id])\n end", "def set_lightning\n @lightning = Lightning.find(params[:id])\n end", "def turnLightsOff\n @lightsOn = false\n end", "def white_light\n @command.execute(1, [0x31, 0x00, 0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00])\n\n self\n end", "def lights_on(bool)\n if bool == true\n @lights = true\n end\n if bool == false\n @lights = false\n end\n end", "def enableGunLights _obj, _args\n \"_obj enableGunLights _args;\" \n end", "def setLightAttenuation _obj, _args\n \"_obj setLightAttenuation _args;\" \n end", "def milight_on_full_brightness\n\t\t$bridge.all_on\n\t\tsleep(1)\n\t\t$bridge.brightness(25)\t\t\t\n\tend", "def lights\n @lights = !@lights\n end", "def setLightUseFlare _obj, _args\n \"_obj setLightUseFlare _args;\" \n end", "def switch_light_off\n puts \"*** switch_light_off\"\n true\nend", "def lightness(newlight=nil)\n if not newlight\n return self.hsla[2]\n else\n hsla = self.hsla\n hsla[2] = newlight\n return Color.hsla( *hsla )\n end\n end", "def set_highlight(val)\n add_actions \"SetHighlight(#{val})\"\n end", "def setAction(action)\n @action = action\n end", "def action_hook; end", "def use_headlights(brightness = \"low-beam\")\r\n puts \"Turning on #{brightness} headlights\"\r\n puts \"Watch out for deer!\"\r\nend", "def red\n end", "def initialize(light)\n @light = light\n @last_level = light.level\n end", "def initialize(light)\n @light = light\n @last_level = light.level\n end", "def shadows_face_sun=(status)\n end", "def set_leds(args)\n @leds[:advance] = args[:advance] unless args[:advance].nil?\n @leds[:play] = args[:play] unless args[:play].nil?\n @leds[:color] = args[:color] unless args[:color].nil?\n @leds[:intensity] = args[:intensity] unless args[:intensity].nil?\n led_bits = 0b00000000\n led_bits |= 0b00001000 if @leds[:advance]\n led_bits |= 0b00000010 if @leds[:play]\n \n write_chars([LEDS, led_bits, @leds[:color], @leds[:intensity]])\n end", "def lights\n\n @lights = !@lights\n if @lights\n \"The lights are on\"\n else\n \"The lights are off\"\n end\n\n end", "def lbSetColor _obj, _args\n \"_obj lbSetColor _args;\" \n end", "def set_bright(brightness, effect, duration)\n cmd = \"{\\\"id\\\":5,\\\"method\\\":\\\"set_bright\\\",\\\"params\\\":[#{brightness},\\\"#{effect}\\\",#{duration}]}\\r\\n\"\n request(cmd)\n end", "def light_colour\n\t\t\tOmniboard::Colour.new(0).light\n\t\tend", "def set_action(action)\n @action = action\n end", "def spray_paint(new_color)\n self.color = new_color\n end", "def toggle(ul,lr)\r\n update_lights(ul,lr) do |i,j|\r\n if @lights[i][j] == 0\r\n \t@lights[i][j] = 1\t\t \r\n\t else\r\n\t @lights[i][j] = 0\r\n\t end\r\n end\r\n end", "def lights\n @lights ||= add_all_lights\n end", "def lights\n @lights ||= add_all_lights\n end", "def setRainbow _obj, _args\n \"_obj setRainbow _args;\" \n end", "def lowlight_color=(color)\n color = @img.to_color(color) if color.respond_to?(:to_color)\n @img.define('lowlight-color', color)\n end", "def define_action_hook; end", "def light\n @lit = true\n \n @visible = true\n @distance_to_player = self.distance(player.location)\n @turn_last_lit = game.turn\n if self.has_agent? && @agent != player && ! @agent.active?\n @agent.check_awareness\n end\n end", "def light(color_key)\n\t\tdata = LIGHT_MAP[color_key]\n\n\t\tdevice = USB.devices.find {|device| device.idVendor == VENDOR_ID && device.idProduct == PRODUCT_ID}\n\t\thandle = device.usb_open\n \thandle.usb_control_msg(0x21, 0x09, 0x0635, 0x000, \"\\x65\\x0C#{data}\\xFF\\x00\\x00\\x00\\x00\", 0)\n\n \thandle.usb_close\n \thandle = nil\n \t\n end", "def add_light(light)\n @lights.add(light)\n self\n end", "def blink; end", "def blink; end", "def set_player_action(action) \n @player_info[@player_index][:state_call] = action\n end", "def set_light_log\n @light_log = LightLog.find(params[:id])\n end", "def set_spotlight\n @spotlight = Spotlight.find(params[:id])\n end", "def matt_custom_action_begin(label); end", "def green=(_); end", "def milight_adjust_color(r,g,b)\n\t\tif r == 100 && g == 100 && b == 100\n\t\t\t$bridge.white\n\t\telse\n\t\t\t$bridge.color(Color::RGB.from_percentage(r, g, b)) \n\t\tend\n\tend", "def light(i)\n Light.new(self, i, get(\"/lights/#{i}\").data) # TODO: cache by index/name?\n end", "def setshadow(*)\n super\n end", "def off\n @level = 0\n puts \"Light is off\"\n end", "def off\n @level = 0\n puts \"Light is off\"\n end", "def light(light_id)\n self.lights[light_id.to_i-1]\n end", "def light(light_id)\n self.lights[light_id.to_i-1]\n end", "def green\n end", "def set_color(color)\n @color = color\n end", "def action(name, altname=nil, &block) \n Runner.instance.add_action name, altname, &block\n end", "def set_led\n @led = Led.find(params[:id])\n end", "def initialize(*args)\n super\n @action = :set\nend", "def on\n set_power(\"on\", \"smooth\",1000)\n end", "def red; end", "def red; end", "def set_action(action)\n return unless action\n\n @action = action\n @ext.set_action(action)\n end", "def respond_to_launch\r\n if Applications.light_on?\r\n response = turn_light_off\r\n else\r\n response = turn_light_on\r\n end\r\n end" ]
[ "0.70755255", "0.7064786", "0.69721156", "0.69661564", "0.69661564", "0.69661564", "0.6864522", "0.6674563", "0.6674563", "0.66683215", "0.66683215", "0.6631379", "0.65590173", "0.65462667", "0.65218025", "0.6516069", "0.6480886", "0.6479021", "0.64436436", "0.64235413", "0.64202476", "0.63934284", "0.6327384", "0.6310399", "0.6310399", "0.6254744", "0.6254702", "0.6252127", "0.6165053", "0.6152605", "0.61261225", "0.60722", "0.60722", "0.60670626", "0.6049087", "0.6038673", "0.6025126", "0.6025126", "0.6001035", "0.5998929", "0.5916635", "0.59081846", "0.5906193", "0.5894752", "0.5879645", "0.58674705", "0.5853811", "0.58364946", "0.5812838", "0.5788088", "0.5786206", "0.57830167", "0.5779137", "0.57767963", "0.5774257", "0.57737464", "0.577338", "0.57560503", "0.575473", "0.575473", "0.57361984", "0.5732538", "0.57166433", "0.5712854", "0.5680209", "0.5657582", "0.5655652", "0.56397283", "0.5636968", "0.5634341", "0.5634341", "0.56325066", "0.56021684", "0.5581789", "0.5548567", "0.554758", "0.55455625", "0.5540407", "0.5540407", "0.5531862", "0.5530416", "0.5522222", "0.5516944", "0.54992354", "0.54976434", "0.549708", "0.5486521", "0.54842603", "0.54842603", "0.54776627", "0.54776627", "0.5461545", "0.5454928", "0.54521316", "0.54504645", "0.54422814", "0.5437979", "0.54335314", "0.54335314", "0.5433101", "0.542126" ]
0.0
-1
Tell Nest that I am home when I leave work so that the house is warm when I actually get home
def car_left_work(car) @nest.home! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_home\n return unless can_go_home? && wants_to_go_home?\n pack_bags\n get_tickets\n board_plane\nend", "def work_out\n self.happiness = @happiness + 2\n self.hygiene = @hygiene - 3\n \"♪ another one bites the dust ♫\"\n end", "def do_homework\n return if backlog.empty?\n\n current_homework = backlog.delete_at(0)\n current_homework.status = 'done'\n puts \"Student #{surname}: I have done my homework #{current_homework.title}\"\n homeworks << current_homework\n notify(current_homework)\n end", "def go_home?\n @in_coffin\n end", "def returnToHome\n @traveled_distance += distanceCalculation(@x, @y, @z,\n @@origin_x, @@origin_y, @@origin_z)\n @fuel -= distanceCalculation(@x, @y, @z,\n @@origin_x, @@origin_y, @@origin_z)\n if @fuel <= 0\n @fuel = 0\n puts 'Probe out of fuel...'\n else\n puts 'We are home...'\n printProbe\n end\n end", "def home\n forrest = ForrestGump.last\n\n gon.running_route = forrest.route\n gon.running_distance = forrest.distance\n gon.forrest_quote = forrest.quotes.sample\n gon.starting_position = forrest.starting_position\n\n @distance_remaining = forrest.route_distance - forrest.distance\n @tweets = Tweet.all.sort { |a, b| b.mile <=> a.mile }.first(50)\n end", "def opponent\n\t\thomeaway=='H' ? self.contest.awaycontestant : self.contest.homecontestant\n\tend", "def away?\n status == :away\n end", "def passage_of_time\n if @stuff_in_belly > 0\n # move food from belly to intestine\n @stuff_in_belly = @stuff_in_belly - 1\n @stuff_in_intestine = @stuff_in_intestine + 1\n else\n if @asleep\n @asleep = false\n puts 'He wakes up suddenly!'\n end\n puts @name + ' is starving! In desperation, he ate YOU!'\n exit\n end\n \n if @stuff_in_intestine >= 10\n @stuff_in_intestine = 0\n puts 'Whoops! ' + @name + ' had an accident...'\n end\n \n if hungry?\n if @asleep\n @asleep = false\n puts 'He wakes up suddenly!'\n end\n puts @name + '\\'s stomach grumbles...'\n end\n \n if poopy?\n if @asleep\n @asleep = false\n puts 'He wakes up suddenly!'\n end\n puts @name + ' does the potty dance...'\n end\n end", "def mark_worker_was_here\n @adventure.events.create(action: 'worker_ran')\n end", "def power_outage\n event_display(\"There has been a city-wide power outage!\\n All the computers are down- no studying for today!\")\n group_event_hash_creator({technical_skills: -1})\n end", "def send_chest_infame\n Chest_Service.send_feedback(Chest_Service::INFAME, online_chest)\n end", "def find_a_home?\n return \"INPROC\" if build_your_team? == \"DONE\"\n nil\n end", "def walk\n if @awake != true\n puts \"Wake up, #{@name}. It's time for a walk.\"\n @awake = true\n end #end of conditional to wake up and go out\n\n if @food_in_intestine > 50\n @food_in_intestine = 0\n puts \"#{@name} pooped.\"\n else\n puts \"#{@name} sniffs around, but doesn't do business.\"\n end #end of conditional for pooping on walk\n time_passed\nend", "def onroad_state(statistics)\n distance_from_last_start = distance_from [statistics.last_start.latitude, statistics.last_start.longitude]\n duration_since_last_start = (time - statistics.last_start.time).to_i\n\n if ignition_is_off? && (distance_from_last_start >= 0.01 or duration_since_last_start > 300)\n on_stop(statistics, duration_since_last_start)\n else\n on_road(statistics)\n end \n end", "def car_arrived_home(car)\n if self.is_night?\n @hue.on(\"Porch\", @@HUE_FULL_BRIGHTNESS , @@HUE_WARM)\n end\n end", "def works_at_hanson_st?\n @city == HANSON\n end", "def graduate\n @startup = current_user.startup\n if @startup.can_enter_nreduce?\n @startup.force_setup_complete!\n flash[:notice] = \"Welcome to your new community of founders!\"\n redirect_to '/'\n else\n redirect_to current_user.weekly_class\n end\n end", "def underdog\n\t if home_team != favorite\n\t home_team\n\t else\n\t visitor_team\n\t end\n\tend", "def on_bees?\n state == 'bees'\n end", "def away?\n self.state == :away\n end", "def neighborhoodLoop(command, home)\n\t\tcase command.getCommand()\n\t\twhen 'left'\n\t\t\tif(@player.location % 3 != 1)\n\t\t\t\[email protected] = @player.location - 1;\n\t\t\t\tputs \"You have moved west to another house.\"\n\t\t\telse\n\t\t\t\tputs \"You are at the edge of your neighborhood and cannot go further west.\"\n\t\t\tend\n\t\twhen 'right'\n\t\t\tif(@player.location % 3 != 0)\n\t\t\t\[email protected] = @player.location + 1;\n\t\t\t\tputs \"You have moved east to another house.\"\n\t\t\telse\n\t\t\t\tputs \"You are at the edge of your neighborhood and cannot go further east.\"\n\t\t\tend\n\t\twhen 'up'\n\t\t\tif(@player.location + 3 < 10)\n\t\t\t\[email protected] = @player.location + 3;\n\t\t\t\tputs \"You have moved north to another house.\"\n\t\t\telse\n\t\t\t\tputs \"You are at the edge of your neighborhood and cannot go further north.\"\n\t\t\tend\n\t\twhen 'down'\n\t\t\tif(@player.location - 3 > 0)\n\t\t\t\[email protected] = @player.location - 3;\n\t\t\t\tputs \"You have moved south to another house.\"\n\t\t\telse\n\t\t\t\tputs \"You are at the edge of your neighborhood and cannot go further south.\"\n\t\t\tend\n\t\twhen 'si'\n\t\t\tputs \"Weapon Name\\t-\\tUses\"\n\t\t\[email protected] do |weapon|\n\t\t\t\tif(weapon.uses < 0)\n\t\t\t\t\tputs \"#{weapon.name}\\t-\\tUnlimited uses\";\n\t\t\t\telse\n\t\t\t\t\tputs \"#{weapon.name}\\t-\\t#{weapon.uses} uses\";\n\t\t\t\tend\n\t\t\tend\n\t\twhen 'sm'\n\t\t\tputs \"You lost the map and connot use it anymore\";\n\t\t\t# print map of houses and monster count info\n\t\t\t# TODO: print map of neighborhood\n\t\twhen 'eh'\n\t\t\tputs \"You entered house number #{@player.location}\";\n\t\t\thome = @neighborhood.homes[@player.location - 1];\n\t\twhen 'ns'\n\t\t\[email protected]();\n\t\telse\n\t\t\tputs \"That is not a command.\";\n\t\tend\n\t\t\n\t\treturn home\n\tend", "def passage_of_time\n\tif @stuff_in_belly > 0\n\t\t# move food from belly to intestine\n\t\t@stuff_in_belly = @stuff_in_belly - 1\n\t\t@stuff_in_intestine = @stuff_in_intestine + 1\n\telse\n\tif @asleep\n\t\t@asleep = false\n\t\tputs 'He wakes up suddenly!'\n\tend\nputs @name + ' is starving! In desperation, he ate YOU!'\nexit\nend\n\nif @stuff_in_intestine >= 10\n\t@stuff_in_intestine = 0\n\tputs 'Whoops! ' + @name + ' had an accident...'\nend\n\nif hungry?\n\tif @asleep\n\t@asleep = false\n\tputs 'He wakes up suddenly!'\n\tend\nputs @name + '\\'s stomach grumbles...'\nend\n\nif poopy?\n\tif @asleep\n\t@asleep = false\n\tputs 'He wakes up suddenly!'\n\tend\nputs @name + ' does the potty dance...'\nend\nend", "def went!\n\t\t\t\t## Load all neighboring Rooms when going to the Room the first time\n\t\t\t\tload_neighbors\n\t\t\t\t@known = true if (unknown?)\n\t\t\tend", "def new_born\n !alive && neighbours_living.count == 3\n end", "def goaway!\n goaway block: true\n end", "def here\n if @zone_cur == 0\n narrate(\"you are currently at the #{self.name} entrance\")\n elsif @zone_cur == 10\n narrate(\"you are currently at the #{self.name} exit!\")\n else\n narrate(\"you are currently in the #{self.name}\")\n end\n actions\n end", "def notify_ready\n if state == :smoking\n puts \"#{name} says: I'm good on smokes, thanks\"\n else\n transition :procuring\n end\n end", "def home\n # TBD: replace sitemap with my messages, once we are there\n logger.debug(\"PeopleController.home: current_person: #{current_person.inspect}\")\n store_location # so if we click on something we'll come back here: it is home, after all!\n @person = current_person\n @talks = Talk.talks_by_person(@person)\n @title = @person.name.titlecase\n end", "def touch_in(station)\n deduct(PENALTYFARE) if @in_joureny == true\n min_balance? ? (fail \"insufficent funds\") : @the_journey.start(station)\n @in_journey = true\n end", "def make_harvestable\n self.alt_identities_changed = true\n self.harvested = false\n end", "def soon(to, fixture)\n mail to: to,\n from: '[email protected]',\n subject: \"Who do you think will win? #{fixture.home.name} v #{fixture.away.name}\"\n end", "def away?\n online? and (presence.show == :away or presence.show == :xa)\n end", "def homeLoop(commands, home)\n\t\twhile(true) #wait for commands until house exited\n\t\t\tcase commands.getCommand()\n\t\t\t\n\t\t\twhen 'am'\n\t\t\t\tattackLoop(home)\n\n\t\t\t\tif(@player.health == 0)\n\t\t\t\t\treturn nil;\n\t\t\t\tend\n\t\t\twhen 'hs'\n\t\t\t\t# Show staus of house here\n\t\t\t\thome.getStatus();\n\t\t\twhen 'eh'\n\t\t\t\t# exit the house\n\t\t\t\tputs puts \"You exited house number #{@player.location}\"\n\t\t\t\treturn nil;\n\t\t\telse\n\t\t\t\tputs \"That is not a command.\";\n\t\t\tend\n\t\tend\n\tend", "def waiver\n end", "def announce_win(game_data)\n puts \"You won with #{game_data.lives} left!\"\n end", "def work_out\n self.happiness += 2\n self.hygiene -= 3\n return \"♪ another one bites the dust ♫\" \n end", "def beg_for_food(food_served)\n if food_served\n puts \"Whimper\"\n end\n end", "def landing() end", "def home\n @prompt = TTY::Prompt.new\n clear_terminal\n divider\n choice = @prompt.select(\"Hi,#{@user.name} what do you want to do today?\\n\",\n [\"Look for player information\",\"Look for club information\",\"Look for league information\", \"Trivia\"],\"-> Quit\",\"-> Restart\" )\n divider\n case choice\n when \"Look for player information\"\n players_home\n when \"Look for club information\"\n club_identification\n when \"Look for league information\"\n leagues_home \n when \"Trivia\"\n intro_trivia\n when \"3\"\n league_home\n when \"-> Quit\" || \"QUIT\"\n when \"-> Restart\" || \"RESTART\"\n run\n else\n puts \"Oops you miss the goal, try again...\"\n pause\n home\n end\n end", "def home\n # do nothing\n end", "def honk_horn\n\n @honk_horn = \"Whoop\"\n end", "def eventJobFinished\n\t\tsuper\n\t\tif getEnergy==0 or @dead then\n\t\t\tsimDeath\n\t\t\treturn\n\t\tend\n\t\t\n\t\tsetFighting(false)\n\t\t\n\t\tif @bossName==\"\" then\n\t\t\n\t\t\thouse=getMap.getNext(self,\"house\")\n\t\t\tif house\n\t\t\t\thouseName=house.getName\n\t\t\t\tif houseName==\"\" then\n\t\t\t\t\tputs \"ERROR House has no name!\"\n\t\t\t\t\texit\n\t\t\t\tend\n\t\t\t\t@bossName=houseName\n\t\t\t\tnewRestJob(rand()*2)\n\t\t\t\thouse=getMap.getRuby(house)\n\t\t\t\thouse.signUp(self)\n\t\t\t\t@signed=true\n\t\t\tend\n\t\telse\n\t\t\tboss=getMap.getByName(@bossName)\n\t\t\t@boss=boss\n\t\t\tif not @signed then\n\t\t\t\tputs @bossName\n\t\t\t\tputs boss\n\t\t\t\tboss.signUp(self)\n\t\t\t\t@signed=true\n\t\t\tend\n\t\t\tboss.assignJob(self)\n\t\tend\n\tend", "def home\n @happykid = OpeningTime.all\n @promo = Promo.all\n @news = News.all\n\n @meta = News.last\n\n @siteinfo = SiteInfo.all\n \n end", "def state_on_table_game_end\n @log.debug(\"Net_state: change to state state_on_table_game_end\")\n @network_state = :state_on_table_game_end\n make_state_change_ntfy(:ntfy_state_on_table_game_end)\n end", "def west (game)\n @state.west(self, game)\n end", "def continue\n\n inventory_with_leisure = expected_inventory.dup\n inventory_with_leisure[:leisure] = 1\n\n inventory_with_fishing = expected_inventory.dup\n # TODO: DRY up this logic with Person#catch_fish\n inventory_with_fishing[:fish] += @skills[:fish]\n\n #p '@'*88\n #p inventory_with_fishing\n #p rank_potential_inventory(inventory_with_fishing)\n #p '@'*88\n #p inventory_with_leisure\n #p rank_potential_inventory(inventory_with_leisure)\n #p '@'*88\n if rank_potential_inventory(inventory_with_fishing) < rank_potential_inventory(inventory_with_leisure)\n catch_fish\n @last_activity = :catch_fish\n else\n @last_activity = :leisure\n end\n\n\n eat # or starve\n end", "def standby_team(config); end", "def eat\n @hungry = false\n end", "def eat\n @hungry = false\n end", "def eat\n @hungry = false\n end", "def send_chest_fame\n Chest_Service.send_feedback(Chest_Service::FAME, online_chest)\n end", "def home\n # Calculate the total days including weekends\n # Calculate the days left without weekends and arbitrary time off\n ### Todo: Use MST, MDT to ensure the proper day\n ### Todo: Use pro-rated calculation to determine number of days off\n @days_gross = (DateTime.new(2014,9,30) - Date.today).to_i\n @days_left = @days_gross - (@days_gross / 7 * 2)\n @days_left = @days_left - 10\n\n # Calculate the partial day\n time_now = Time.now.in_time_zone(\"Mountain Time (US & Canada)\")\n @time_now_formatted = time_now.strftime(\"%A - %B %d, %Y; %I:%M%p %Z\")\n @hours_left = 0\n @minutes_left = 0\n @seconds_left = 0\n unless time_now.saturday? || time_now.sunday?\n # The end of the day is 5:00 PM today\n partial_day = FIVE_PM - time_now.seconds_since_midnight\n if partial_day > 0\n # Since we are using Time, we need to truncate (remove) the decimal\n @hours_left = (partial_day / ONE_HOUR).truncate\n @minutes_left = ((partial_day % ONE_HOUR) / ONE_MINUTE).truncate\n @seconds_left = ((partial_day % ONE_HOUR) % ONE_MINUTE).truncate\n end\n end\n\n render :action => \"countdown\"\n end", "def welcome(street, city, state)\n case state\n\n when \"California\"\n return \"Welcome to California!\"\n when \"CA\"\n return \"Welcome to California!\"\n else\n return \"You should move to California\"\n end\n end", "def leave(_team, _permanent: false)\n # stub\n end", "def start!\n\t\twhile [email protected]_home?\n\t\t\[email protected]!\t\t\n\t\t\t@no_of_hops+=1\n\t\t\[email protected]\n\t\tend\n\tend", "def train_footman\n if can_train_footman?\n @gold -= 135\n @food -= 2\n Footman.new\n end\n end", "def who_we_are\r\n end", "def on_investigation_end; end", "def on_investigation_end; end", "def stats_when_home(season = nil)\n data = stats_request(\"homeAndAway\", season)\n data.find do |s| s[\"isHome\"] end\n end", "def takeoff\n if @engine_on == false\n return \"airplane not started, please start\"\n elsif @engine_on == true && @flying == false\n @flying = true\n @fuel -= 15\n return \"airplane launched\"\n else\n return \"airplane already flying\"\n end\n end", "def pay_interest!(entity)\n owed = interest_owed(entity)\n # This is here so that the log message does not get duplicated.\n if corp_has_new_zealand?(entity) && entity.loans.size.positive?\n @log << \"#{entity.name}'s token in Nieuw Zeeland covers one loan's worth of interest\"\n end\n return super unless owed.negative?\n\n # Negative interest -> corporation has New Zealand\n @log << \"#{entity.name} gets $20 for having a token in Nieuw Zeeland and no loans\"\n entity.spend(owed, bank, check_cash: false, check_positive: false)\n nil\n end", "def stand!\n\t\t@standing = true\n\tend", "def local_away(body)\n if body.length > 0\n _remote_control(nil, 'pong', \"away #{body}\", true)\n @var[:presence][@connection.comm.our_keyhash] = [ 'away', body ]\n else\n local_back('')\n end\nend", "def sittinae_hooey(scrawny_appulsion, termly)\n end", "def hometown_show\n if self.venue.city == self.band.hometown\n return true\n end\n end", "def runLoop()\n\t\tgameWon = false;\n\n\t\t# Setup the command for when in a house and when in the neighborhood\n\t\tneighborhoodCommands = Command.new(nil);\n\t\thouseCommands = Command.new(\"house\");\n\t\thome = nil; \n\t\t\n\t\t# Game Loop until Player dies or game is won\n\t\twhile(!gameWon)\n\t\t\t# Check to see if is in a home or not\n\t\t\tif(home === nil)\n\t\t\t\thome = neighborhoodLoop(neighborhoodCommands, home);\n\t\t\telse\n\t\t\t\thomeLoop(houseCommands, home);\n\t\t\t\thome = nil;\n\t\t\tend\n\n\t\t\t# Check for player death\n\t\t\tif(@player.health == 0)\n\t\t\t\tputs \"You have died and failed everyone in your neighborhood. Too Bad!\";\n\t\t\t\treturn nil;\n\t\t\tend\n\n\t\t\t# Check if neighborhood is clear\n\t\t\tif(@neighborhood.all_clear())\n\t\t\t\tgameWon = true;\n\t\t\tend\n\t\tend\n\n\t\tputs \"You have saved the neighborhood!!!\"\n\tend", "def stay_country\n end", "def checkin\n update_attributes(:occupied => false)\n end", "def land\n if @engine_on == false\n return \"airplane not started, please start\"\n elsif @engine_on == true && @flying == false\n return \"airplane already on the ground\"\n else\n @flying = false\n @engine = false\n @fuel -= 10\n return \"airplane landed\"\n end\n end", "def happy?\n @happiness > 7 \n end", "def take_off!\n\t\t@flying = true\n\t\tself\n\tend", "def on_goaway *args\n on :goaway, *args\n close\n end", "def send_away(reason=nil)\n return back if reason.nil?\n send_raw(AWAY, reason)\n end", "def awake_overnights\n\t\tPerson.find(:all,\n\t\t\t\t\t\t\t\t:conditions => \"people.position = 'Awake Overnight' AND house_id = #{self.id}\", \n\t\t\t\t\t\t\t\t:joins => :houses, \n\t\t\t\t\t\t\t\t:order => \"last_name, first_name ASC\")\n\tend", "def happy?\n @happiness > 7\n end", "def casino_floor\n puts\n puts \"Welcome back!\"\n @person_wallet.show_wallet\n choose_game\n end", "def east (game)\n @state.east(self, game)\n end", "def landing\n \n end", "def landing\n \n end", "def finished?\n go_fish.over?\n end", "def stats_when_away(season = nil)\n data = stats_request(\"homeAndAway\", season)\n data.find do |s| !s[\"isHome\"] end\n end", "def dat_menu() \n game_states.size == 1 && exit #fires if this is the only gamestate\n Chingu::Text.create 'Now leaving :(', size: 48, x: 200, y: 200, color: Gosu::Color::RED\n after(500) { $window.pop_game_state(setup: false) }\n end", "def advance_contestants()\n #logger.debug \"Prior(s): #{all_priors.collect{|bc| bc.contestantcode}.inspect()}\"\n winning_team = self.homecontestant.win ? self.homecontestant.team : self.awaycontestant.team\n losing_team = self.homecontestant.loss ? self.homecontestant.team : self.awaycontestant.team\n self.all_priors().each{|bc| bc.team = bc.contestanttype==\"W\" ? winning_team : losing_team; bc.save! }\n end", "def schengen_overstay?\n return schengen_days > 90 if schengen_days\n true\n end", "def tired\t\r\n\tif $hours_asleep >= 8 then\r\n\t $hours_asleep = 0\r\n \t\treturn false\r\n \telse\r\n \t\t$hours_asleep += 1\r\n \t\treturn true\r\n \tend \t\t\r\nend", "def leave; end", "def game_over args, win_or_lose\n # keep track of whether you won or lost\n args.state.game_state = win_or_lose\nend", "def house; end", "def house; end", "def lost_brain\n ZombieMailer.lost_brain\n end", "def start\n update(underway_at: Time.current)\n end", "def current_as_home?(loc)\n case loc\n when 'RESERVES'\n true\n when /^RSRV-/\n true\n when 'NEWBOOKS'\n true\n else\n false\n end\n end", "def greetings\n if @awake\n \"Hi, my name is #{full_name}\"\n else\n 'ZZZzzzZZZzzz'\n end\n end", "def took_off?\n if self.status == \"flying\"\n true\n end\n end", "def get_away()\n @health -= 10\n puts @health\n end", "def occupy_room(room)\n room.occupied = 1\n end", "def show_state\n if @life_points <= 0\n puts \"#{@name} is dead... \\n...Monde de merde...\"\n else\n puts \"#{@name} has #{@life_points} life points left.\"\n end\n end", "def attack_town\n @health += 50\n self\n end" ]
[ "0.624075", "0.57610273", "0.5733039", "0.5732569", "0.57321596", "0.5643529", "0.5603236", "0.55918634", "0.5584835", "0.55800694", "0.55791277", "0.5536771", "0.551509", "0.5477508", "0.5473875", "0.54711694", "0.54683113", "0.5465079", "0.5447729", "0.5415201", "0.54151344", "0.53994673", "0.5394795", "0.5384946", "0.53785133", "0.5374763", "0.53712595", "0.53685033", "0.53578866", "0.535056", "0.5340986", "0.5332402", "0.5321065", "0.5315475", "0.5312437", "0.52991724", "0.5298931", "0.529088", "0.52792865", "0.5277788", "0.52669936", "0.52545506", "0.524584", "0.5240969", "0.5232266", "0.5230376", "0.52259254", "0.5218729", "0.52056646", "0.52056646", "0.52056646", "0.52021986", "0.5185381", "0.5183751", "0.5161439", "0.51567954", "0.5156714", "0.5153659", "0.51524", "0.51524", "0.51501673", "0.5149336", "0.5145027", "0.5143828", "0.5139923", "0.5138335", "0.5134258", "0.5124246", "0.5119693", "0.5112794", "0.51066333", "0.51039565", "0.50985926", "0.50973976", "0.509733", "0.50952345", "0.50946355", "0.5092806", "0.5083166", "0.50789547", "0.50789547", "0.50787336", "0.50776815", "0.5072305", "0.5068682", "0.50665855", "0.50641346", "0.50619066", "0.5056538", "0.5052683", "0.5052683", "0.5051937", "0.50491565", "0.50409836", "0.5040315", "0.5038182", "0.50371873", "0.5032062", "0.5031133", "0.5028029" ]
0.7031587
0
When I get home, turn on the porch light if it's night
def car_arrived_home(car) if self.is_night? @hue.on("Porch", @@HUE_FULL_BRIGHTNESS , @@HUE_WARM) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_light_on\n puts \"*** switch_light_on\"\n true\nend", "def on\n set_power(\"on\", \"smooth\",1000)\n end", "def turnLightsOn\n @lightsOn = true\n end", "def light\n @lit = true\n \n @visible = true\n @distance_to_player = self.distance(player.location)\n @turn_last_lit = game.turn\n if self.has_agent? && @agent != player && ! @agent.active?\n @agent.check_awareness\n end\n end", "def switch_light_off\n puts \"*** switch_light_off\"\n true\nend", "def turn_on #turn the power on\n @power = true\n end", "def on\n @level = 100\n puts \"Light is on\"\n end", "def on\n @level = 100\n puts \"Light is on\"\n end", "def control_light\n if @is_toggled\n @is_emitting_light = true\n else\n @is_emitting_liht = false\n end\n end", "def milight_on_full_brightness\n\t\t$bridge.all_on\n\t\tsleep(1)\n\t\t$bridge.brightness(25)\t\t\t\n\tend", "def control_light\n if @is_toggled\n @is_emitting_light = true\n else\n @is_emitting_light = false\n end\n end", "def lights_on(bool)\n if bool == true\n @lights = true\n end\n if bool == false\n @lights = false\n end\n end", "def turn_on!\n set_power!(:on)\n end", "def turn_on\n 'If the thermocycler is off, toggle the power switch in the back of the' \\\n ' instrument'\n end", "def lights\n @lights = !@lights\n end", "def change_light(light, quote)\n\n\tif quote.changePercent <= -1\n\t\tlight.set_color LIFX::Color.red, duration: 0\n\t\tMac::TTS.say(\"#{quote.name} is down #{quote.changePercent.abs} percent\", :victoria)\n\telsif quote.changePercent >= 1\n\t\tlight.set_color LIFX::Color.green, duration: 0\n\t\tMac::TTS.say(\"#{quote.name} is up #{quote.changePercent.abs} percent\", :victoria)\n\telse\n\t\tlight.set_color LIFX::Color.blue, duration: 0\n\t\tMac::TTS.say(\"#{quote.name} is flat at #{quote.changePercent} percent\", :victoria)\n\tend\n\tsleep(0.5)\n\tlight.set_color LIFX::Color.hsb(0,0,0.35), duration: 0\n\nend", "def light_up\n explode(1)\n @out_duration = 360\n @out = false\n end", "def move_home_set_direction()\n\n if (invert_axis ^ reverse_home) == false\n set_direction_low()\n else\n set_direction_high()\n end\n\n end", "def turnLightsOff\n @lightsOn = false\n end", "def turn_on!\n @turned_off = false\n end", "def respond_to_launch\r\n if Applications.light_on?\r\n response = turn_light_off\r\n else\r\n response = turn_light_on\r\n end\r\n end", "def lights_on?\n @lights\n end", "def turn_on_leds\n @entry_led.on\n @exit_led.on \n end", "def lights\n\n @lights = !@lights\n if @lights\n \"The lights are on\"\n else\n \"The lights are off\"\n end\n\n end", "def off\n @level = 0\n puts \"Light is off\"\n end", "def off\n @level = 0\n puts \"Light is off\"\n end", "def home\n @heading = 0.0\n @xy = [0.0, 0.0]\n @pen_is_down = false\n end", "def switch_lights(lights_hash)\n 1.upto(lights_hash.length) do |count|\n lights_hash.each do |light_num, position|\n if light_num % count == 0\n lights_hash[light_num] == 'off' ? lights_hash[light_num] = 'on' : lights_hash[light_num] = 'off'\n end \n end\n end\nend", "def toggle_on_or_off(lights)\n 1.upto(lights.size) do |round_number|\n lights.each do |position, value|\n if position % round_number == 0\n value == \"off\" ? lights[position] = \"on\" : lights[position] = \"off\"\n end\n end\n end\nend", "def move_home()\n\n move_home_set_direction()\n\n start = Time.now\n home = 0\n\n # keep setting pulses at the step pin until the end stop is reached of a time is reached\n\n while home == 0 do\n\n @board.read_and_process\n span = Time.now - start\n\n if span > @move_home_timeout\n home = 1\n puts \"move home #{@name} timed out\"\n end\n\n if @board.pins[@pin_min].value == 1 and @reverse_home == false\n home = 1\n puts \"end stop home min #{@name} reached\"\n end\n\n if @board.pins[@pin_max].value == 1 and @reverse_home == true\n home = 1\n puts \"end stop home max #{@name} reached\"\n end\n\n if home == 0\n set_pulse_on_pin(@pin_stp)\n end\n\n end\n\n # disable motor driver\n disable_motor()\n\n @pos = 0\n\n end", "def light_switcher(lights)\n 1.upto(lights.size) do |light_num|\n 1.upto(lights.size) do |num|\n if num % light_num == 0\n lights[num] == \"off\" ? lights[num]=\"on\" : lights[num]=\"off\"\n end\n end\n end\n lights\nend", "def activate_hearth\n send(RESET ^ 0x80)\n rescue\n end", "def night\n self.off\n command Command::NIGHT[@group]\n end", "def on_home_row?\n return (white? && y_position == 6) || y_position == 1\n end", "def drawStrongWind; @strongwind = true; end", "def lights_on?\n return [true,false].sample\n end", "def switch_lights(final)\n lights = {}\n (1..final).each {|num| lights[num] = false}\n (1..final).each do |interval|\n lights.each {|key, value| lights[key] = !value if key % interval == 0}\n end\n lights.select {|_, value| value}.keys\nend", "def toggle(lights)\n\n # Using the #upto method, we're able to iterate through each round\n 1.upto(lights.size) do |round_number|\n\n # Next we want to toggle each light off and on\n lights.each do |position, value|\n if position % round_number == 0\n\n # We use a ternary operator here\n # If the current light has a value of \"off\", then the value\n # is set to \"on\".\n value == \"off\" ? lights[position] = \"on\" : lights[position] = \"off\"\n end\n end\n end\nend", "def turn_on()\n 'Turn on the #{model}<br>' \\\n 'If the thermocycler is off, toggle the power switch in the back of the instrument'\n end", "def update_light(current)\n if current == \"green\"\n puts \"yellow\"\n elsif current == \"yellow\"\n puts \"red\"\n elsif current == \"red\"\n puts \"green\"\n end\nend", "def night\nend", "def lights(lights)\n if lights == \"on\"\n @lights = true\n elsif lights == \"off\"\n @lights = false\n end\n end", "def night?\n return $game_switches[::Yuki::Sw::TJN_NightTime]\n end", "def lights?\n @lights\n end", "def lightsOn?\n return @lightsOn\n end", "def dark; end", "def dark; end", "def on\n return true if on?\n cmd('PO')\n return cmd('?P', /PWR[01]/, 10).shift == 'PWR0'\n end", "def low\n @speed = LOW\n puts \"#{@location} ceiling fan is on low\"\n end", "def low\n @speed = LOW\n puts \"#{@location} ceiling fan is on low\"\n end", "def ajust_weather_switches\n weather = current_weather\n $game_switches[::Yuki::Sw::WT_Rain] = (weather == 1)\n $game_switches[::Yuki::Sw::WT_Sunset] = (weather == 2)\n $game_switches[::Yuki::Sw::WT_Sandstorm] = (weather == 3)\n $game_switches[::Yuki::Sw::WT_Snow] = (weather == 4)\n $game_switches[::Yuki::Sw::WT_Fog] = (weather == 5)\n end", "def execute\n light.on\n end", "def home\n #sleep(60)\n end", "def over?\n winner = @light_turn ? DARK : LIGHT\n if board.win?(winner)\n puts \"#{winner} Wins!\"\n return true\n elsif board.available_columns.empty?\n puts \"Tie game!\"\n return true\n end\n false\n end", "def move_home_all\n Status.current.info_target_x = 0\n Status.current.info_target_y = 0\n Status.current.info_target_z = 0\n @ramps_arduino.execute_command('G28', true, false)\n end", "def wake_on_lan\n return nil unless @property_hash.has_key? 'womp'\n return nil unless @property_hash['womp'] == '0' || @property_hash['womp'] == '1'\n \n @property_hash['womp'] == '1' ? :true : :false\n end", "def run_one_game\n # the car is actually in any of three doors:\n car_location = random.rand(1..3)\n\n revealed_goat_door = host_opens_door(car_location)\n other_choice = remaining_closed_door(revealed_goat_door)\n\n if (car_location == other_choice)\n @switcher_total_wins += 1\n end\n\n # Stayer will stay (Door 1)\n if (car_location == 1)\n @stayer_total_wins += 1\n end\n\n # Chaosmonkey will either stay (Door 1) or switch\n chaosmonkey_choice = (random.rand(0..1) == 0) ? other_choice : 1\n\n if (car_location == chaosmonkey_choice)\n @chaosmonkey_total_wins += 1\n end\n end", "def on\n change_state(pin, :high)\n @is_on = true\n true\n end", "def full_moon?\n pom == FULL_MOON\n end", "def hail?\n return false if $game_temp.in_battle && ::BattleEngine.state[:air_lock]\n return current_weather == 4\n end", "def move_home_y\n Status.current.info_target_y = 0\n @ramps_arduino.execute_command('F12', true, false)\n end", "def on\n pwm(0xff)\n end", "def light_up(quad)\n case quad\n when 1\n (0..3).each do |x_index|\n (0..3).each do |y_index|\n @device.change :grid, :x => x_index, :y => y_index, :green => :high\n end\n end\n when 2\n (4..7).each do |x_index|\n (0..3).each do |y_index|\n @device.change :grid, :x => x_index, :y => y_index, :green => :high, :red => :high\n end\n end\n when 3\n (0..3).each do |x_index|\n (4..7).each do |y_index|\n @device.change :grid, :x => x_index, :y => y_index, :red => :high\n end\n end\n when 4\n (4..7).each do |x_index|\n (4..7).each do |y_index|\n @device.change :grid, :x => x_index, :y => y_index, :green => :low, :red => :medium\n end\n end\n end\n end", "def on_turn_start\n check_turn_start_effects\n end", "def time_of_day(daylight)\n puts daylight ? \"It's daytime!\" : \"It's nighttime!\"\nend", "def openeye()\n\t\t@pintar = true\n\tend", "def lights(x)\n if x == \"on\"\n @lightstatus = \"on\"\n elsif x == \"off\"\n @lightstatus = \"off\"\n else\n p \"Type lights(on) or lights(off)\"\n end\n end", "def execute\n @last_level = @light.level\n @light.on\n end", "def white_turn\n @teams[:white].current_team = true\n @teams[:black].current_team = false\n @current_team = @teams[:white]\n end", "def use_headlights(brightness = \"low-beam\")\r\n puts \"Turning on #{brightness} headlights\"\r\n puts \"Watch out for deer!\"\r\nend", "def wake\n if @awake\n return\n else\n @awake = true\n puts \"You woke up #{@name}.\"\n end #end of conditional to wake up the dragon\n end", "def landing() end", "def new_moon?\n pom == NEW_MOON\n end", "def on?; self.refresh!['state']['on']; end", "def half_wind; end", "def time_of_day(daylight)\n if daylight\n puts \"It's daytime!\"\n else\n puts \"It's nighttime!\"\n end\nend", "def weather_condition\n @stormy = chance_of_storm < storm_severity\n end", "def bright; end", "def bright; end", "def go_home\n return unless can_go_home? && wants_to_go_home?\n pack_bags\n get_tickets\n board_plane\nend", "def move_home_y\n $status.info_target_y = 0\n execute_command('F12', true, false)\n end", "def standing_on_platform\n return nil if falling? or jumping?\n what_object_hit_me_on_the :side => :bottom, :restrict => Standable, :look_ahead => 10, :margin_of_error => 25\n end", "def maybe_promote\n if @color == :black && @position[0] == 0\n @king = true\n elsif @color == :red && @position[0] == 7\n @king = true\n end\n end", "def white_light\n @command.execute(1, [0x31, 0x00, 0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00])\n\n self\n end", "def high\n @speed = HIGH\n puts \"#{@location} ceiling fan is on high\"\n end", "def high\n @speed = HIGH\n puts \"#{@location} ceiling fan is on high\"\n end", "def light_colour\n\t\t\tOmniboard::Colour.new(0).light\n\t\tend", "def light_switch(count)\n light_array = (1..count).to_a\n light_hash = {}\n light_array.each do |light|\n light_hash[light] = 'on'\n end\n\n 2.upto(count) do |number|\n light_hash.each do |light, status|\n if light % number == 0\n status == 'off' ? light_hash[light] = 'on' : light_hash[light] = 'off'\n end\n end\n end\n p light_hash\nend", "def medium\n @speed = MEDIUM\n puts \"#{@location} ceiling fan is on medium\"\n end", "def medium\n @speed = MEDIUM\n puts \"#{@location} ceiling fan is on medium\"\n end", "def back_light=(new_state)\n\t try_set_screen\n\t tmp = new_state ? 1 : 0\n\t Klass.setBacklight(@handle, tmp)\n new_state\n end", "def blink; end", "def blink; end", "def setLightDayLight _obj, _args\n \"_obj setLightDayLight _args;\" \n end", "def shadows_face_sun=(status)\n end", "def land?; !@water; end", "def land?; !@water; end", "def land?; !@water; end", "def toggle(ul,lr)\r\n update_lights(ul,lr) do |i,j|\r\n if @lights[i][j] == 0\r\n \t@lights[i][j] = 1\t\t \r\n\t else\r\n\t @lights[i][j] = 0\r\n\t end\r\n end\r\n end", "def enable_weather_dimness\n $game_system.weather_no_dimness = false\n end" ]
[ "0.6639072", "0.6410299", "0.64044005", "0.63252604", "0.6312118", "0.6280482", "0.6262816", "0.6262816", "0.62213415", "0.61652166", "0.6154113", "0.6139274", "0.612894", "0.6084529", "0.60606915", "0.6029116", "0.60016245", "0.5970451", "0.59455895", "0.59286743", "0.5910422", "0.59065074", "0.5899389", "0.584064", "0.58375484", "0.58375484", "0.5797601", "0.5788021", "0.57834786", "0.57665974", "0.57541704", "0.57471913", "0.57201046", "0.5713705", "0.5692008", "0.568957", "0.5666759", "0.56376207", "0.5622957", "0.5615584", "0.56120616", "0.5605029", "0.55996406", "0.55971175", "0.5591532", "0.55912364", "0.55912364", "0.5563836", "0.5557551", "0.5557551", "0.5548279", "0.55447775", "0.5541165", "0.55177206", "0.54930925", "0.54902065", "0.54890877", "0.54856914", "0.5485319", "0.5476718", "0.5443798", "0.5431593", "0.5421161", "0.5413235", "0.5409071", "0.5404943", "0.5393071", "0.5382452", "0.53644466", "0.53543967", "0.53527987", "0.5344595", "0.53352064", "0.53314376", "0.5316723", "0.5309951", "0.5309386", "0.53050464", "0.53050464", "0.53015184", "0.52891564", "0.52849317", "0.52783763", "0.5275811", "0.527279", "0.527279", "0.52655566", "0.5264361", "0.52608323", "0.52608323", "0.5258385", "0.5258018", "0.5258018", "0.5254232", "0.524579", "0.52439326", "0.52439326", "0.52439326", "0.5234623", "0.52298975" ]
0.7500651
0
Computes the solution to equations of the form a/b = x (mod p) where a, b are given and p = Fp
def mod_inv (a, b, base = nil) base = base.nil? ? @fp : base res = Curve.ext_gcd b, base dis = res[1] x = (a - (base * dis * a)) / b Curve.mod x, base end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve\n return ((1..40).inject(:*) / ((1..20).inject(:*) ** 2))\nend", "def divmod(p0) end", "def solve(a,b,n)\n (b*a.inverse_modulo(n)) % n\nend", "def lpf (a)\r\n f = 3\r\n while (a % 2 == 0) && (a > 2)\r\n a /= 2\r\n end\r\n if a == 2\r\n return a\r\n end\r\n while f <= a\r\n if a % f == 0\r\n a /= f\r\n else\r\n f += 2\r\n end\r\n end\r\n return f\r\nend", "def p_value(p, a, b, rmin = 0, rmax = 1)\n fail 'a <= 0' if a <= 0\n fail 'b <= 0' if b <= 0\n fail 'rmin == rmax' if rmin == rmax\n fail 'p <= 0' if p <= 0\n fail 'p > 1' if p > 1\n\n precision = 8.88e-016\n max_iterations = 256\n\n ga = 0\n gb = 2\n\n i = 1\n while ((gb - ga) > precision) && (i < max_iterations)\n guess = (ga + gb) / 2.0\n result = cdf(guess, a, b)\n\n if (result == p) || (result == 0)\n gb = ga\n elsif result > p\n gb = guess\n else\n ga = guess\n end\n\n fail 'No value' if i == max_iterations\n\n i += 1\n end\n\n rmin + guess * (rmax - rmin)\n end", "def pv(fv, n, r)\n fv*(1.0/((1+r)**n))\nend", "def divide(a,b)\n raise Exception.new(\"Undefined. Divisor is 0\") if b == 0\n sign = 1\n result = -1\n\n # Handle corner cases\n if a < 0\n a *= -1\n sign *= -1\n end\n\n if b < 0\n b *= -1\n sign *= -1\n end\n\n while a >= 0\n a -= b\n result += 1\n end\n result * sign\nend", "def fermat_little(p, a)\n begin\n if(p%(ui_pow(a, (p-1))-1) == 0)\n return 0\n else\n return 1\n end\n end\nrescue\n begin\n ArgumentError.new(\"High load. Terminated.\")\n end\nend", "def solution(n, m)\n n / gcd(n, m)\nend", "def rdiv(p0) end", "def modulo_of(fraction); end", "def div_h_p_nr(a,b)\n p = 0\n\n @bits.times do\n if p < 0\n # (i-a) shift combined pa register left one bit\n pa = ((p<<@bits)|a)<<1\n # (ii-a) p=p+b\n a = pa & @mA\n p = signed((pa & @mP) >> @bits)\n p += b\n else\n # (i-b) shift combined pa register left one bit\n pa = ((p<<@bits)|a)<<1\n # (ii-b) p=p-b\n a = pa & @mA\n p = signed((pa & @mP) >> @bits)\n p -= b\n if (p < 0)\n# Tests pass if the following is uncommented\n# # (iv) restore p\n# p += b\n else\n # (iii) if p >= 0\n a |= 1\n end\n end\n end\n # FIXME - need a test case that exercises this last step\n if p < 0\n p += b\n end\n [lo(a),lo(p)]\n end", "def exponenciacion_rapida(a, b, m)\n\t\t_x = 1\n\t\t_y = a%m\n\t\twhile ((b > 0)&&(_y > 1))\n\t\t\tif (b%2 != 0)\n\t\t\t\t_x = (_x*_y)%m\n\t\t\t\tb = b-1\n\t\t\telse\n\t\t\t\t_y = (_y*_y)%m\n\t\t\t\tb = b/2\n\t\t\tend\n\t\tend\n\t\treturn _x\n\tend", "def pf_x(n1, n2, x); pfdist(n1, n2, 1.0 - x); end", "def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend", "def div_h_p_r(a,b)\n p = 0\n\n @bits.times do\n # (i) shift combined pa register left one bit\n pa = ((p<<@bits)|a)<<1\n # (ii) p=p-b\n a = pa & @mA\n p = signed((pa & @mP) >> @bits)\n p -= b\n if (p < 0)\n # (iv) restore p\n p += b\n else\n # (iii) if p >= 0\n a |= 1\n end\n end\n [lo(a),lo(p)]\n end", "def solve(l,p,c)\n\tif( l*c >= p )\n\t\treturn 0\n\telse \n\t\t#the optimal strategy is to pick the\n\t\t#geometric mean and not the average\n\t\tmean = Math.sqrt(l*p)\n\t\t# pick a = c * l :\n\t\tval1 = solve(mean,p,c)\n\t\t# pick a = p / c :\n\t\tval2 = solve(l,mean,c)\n\t\t\n\t\treturn 1 + [val1,val2].max\n\tend\nend", "def reciprocal\n dividend = 1\n answer = max = remainder = count = 0\n 999.downto(7) do |divisor|\n next if divisor % 2 == 0 || divisor % 5 == 0\n count = 0\n until count > 2 && remainder == 1\n remainder = dividend % divisor\n dividend = remainder * 10\n count += 1\n end\n if count > max\n max = count\n answer = divisor\n end\n end\n answer\nend", "def mof(i, p)\n arr = []\n x_swap = []\n (0..(p-2)).each do |x|\n arr.push((i**x) % p)\n end\n (1..(p-1)).each do |n|\n x_swap.push((arr.index {|item| n == item }) % 12 )\n end\n return x_swap\nend", "def get_d(p,q,e)\n phi = (p-1)*(q-1)\n x,y = extended_gcd(e,phi)\n x += phi if x<0 # Have to add the modulus if it returns negative\n x\nend", "def gcd(p0) end", "def modpow(a, x, mod)\n return 1 if x == 0\n return a if x == 1\n half = modpow(a, x/2, mod)\n val = half*half\n val *= a if x.odd?\n val % mod\nend", "def sustitucion_regresiva(n, a, b)\n n = n - 1\n\n x = Array.new(n + 1)\n x[n] = b[n].fdiv(a[n][n])\n\n (0..n - 1).reverse_each do |i|\n sumatoria = (i + 1..n).inject(0) { |sum, k| sum + a[i][k] * x[k] }\n x[i] = (b[i] - sumatoria).fdiv(a[i][i])\n end\n\n puts \"Una solucion aproximada del sistema es X = #{x}\"\n return x\nend", "def f_iter(x)\n cur_prob = 1.0\n for i in 2..$x do\n cur_prob += ($n - cur_prob)/$n\n end\n return cur_prob\nend", "def modpow(a, b, n, m)\n if n == 0\n [1, 0]\n elsif n % 2 == 0\n modpow((a * a) % m, (a * b + b) % m, n / 2, m)\n else\n c, d = modpow(a, b, n - 1, m)\n [(a * c) % m, (a * d + b) % m]\n end\nend", "def solution(a, b, k)\n return (b / k) - ((a - 1) / k)\nend", "def / number\n self.class[ self.with_values do |val|\n raise TErr, \"Compositions with rational exponents \" +\n \"not implemented!\" if val % number != 0\n val / number\n end ]\n end", "def solution(a, b, k)\n first_dividend = a\n remainder = first_dividend%k\n\n while remainder != 0 && first_dividend <= b do\n first_dividend += 1\n remainder = first_dividend%k\n end\n\n remainder == 0 ? (b - first_dividend) / k + 1 : 0\nend", "def solution(a, b, k)\n # write your code in Ruby 2.2\n e = b / k\n s = (a-1) / k\n\n e - s\nend", "def modulo(p0) end", "def gcd( a, b )\r\n\t\t\treturn (b*(a%b))/lcm(b,a%b)\r\n\t\tend", "def div_h_p_r2(a,b)\n p = 0\n\n @bits.times do\n # (i) shift combined pa register left one bit\n pa = ((p<<@bits)|a)<<1\n # (ii) p=p-b\n a = pa & @mA\n p = signed((pa & @mP) >> @bits)\n x = p - b\n if (x >= 0)\n # (iii) if p >= 0\n p = x\n a |= 1\n end\n end\n [lo(a),lo(p)]\n end", "def divide_numbers x, y\n x.fdiv(y)\nend", "def raiseToModulus a, b, n\n b < 0 and raise ArgumentError, \"negative exponent\"\n prod = 1\n a %= n\n until b.zero? do\n if b.odd?\n prod = (prod * a) % n\n end\n b /= 2\n a = (a ** 2) % n\n end\n prod\nend", "def raiseToModulus a, b, n\n b < 0 and raise ArgumentError, \"negative exponent\"\n prod = 1\n a %= n\n until b.zero? do\n if b.odd?\n prod = (prod * a) % n\n end\n b /= 2\n a = (a ** 2) % n\n end\n prod\nend", "def div(p0) end", "def solve(f,l,h)\n\n while true\n \n\t# calculate the mid point. \n m = (l + h) / 2\n\t\n\t# solve f at two points.\n\tx = f(l)\t\n\ty = f(m)\n\t\t\n\t# check for tolerance and f(m)=0\n\tif y==0 or (h-l)/2 < $TOL\n\t return m\n\tend\n\t\t\n\t# if the signs of 'x' and 'y' match then the zero is not in that interval.\n\t# else it is.\n if x * y > 0\n l = m\n else\n h = m\n end\n \n end\n\t\nend", "def pow(n,p)\n ans = 1\n while p!=0 do\n ans = ans*n%BASE if p&1==1\n n=n*n%BASE\n p=p>>1\n end\n ans\n end", "def add_frac(a,b)\nlcm = a[1].lcm(b[1])\nputs a.inspect\nputs b.inspect\nputs lcm\nif lcm == a[1] and b[1] then\n sum2 = a[0] + b[0]\n puts \"Your fraction is #{sum2}/#{lcm}\"\nelse\n sum1 = (a[0]*b[1]) + (b[0]*a[1])\n puts sum1\nputs \"Your fraction is #{sum1}/#{lcm}\"\nend\nend", "def answer(a, b)\n\tif a == 1\n\t\treturn 1 \n\telsif a > b\n\t\treturn 0\n\telsif a % 2 == 0\n\t\treturn 1 + answer(a/2, b)\n\telse\n\t\treturn 1 + answer((3 * a) + 1, b)\n\tend\nend", "def division\n\tputs \"which numbers would you like to divide\"\n\tdiv_number1 = gets.chomp.to_f\n\tdiv_number2 = gets.chomp.to_f\n\tif div_number2.to_f == 0\n\t\tputs \"That is not possible, you failed fourth grade math.\"\t\t\n\telse\n\t\tputs div_number1.to_f / div_number2.to_f\n\tend\nend", "def divisionm(num_1,num_2)\n return num_1 / num_2\nend", "def solve(a, b, c)\n v = b ** 2 - 4 * a * c\n if v < 0: raise RangeError end\n s0 = ((-1)*b - Math.sqrt(v))/(2*a)\n s1 = ((-1)*b + Math.sqrt(v))/(2*a)\n return s0, s1\nend", "def calc_A(a, n, g)\n modpow(g, a, n)\n end", "def divide(a,b,num_of_sig_figs=10)\n #output will be our answer\n output = 0\n #we loop until our dividend is smaller than our divisor\n while a >= b\n # we subtract the divisor from the dividend and the difference is our new dividend\n a -= b\n #we increase the output by 1\n output += 1\n end\n if a == 0\n #if there is no remainder we return the output\n output\n else\n #if there is a remainder we need to change the output to a string\n output = output.to_s\n #sig_figs keeps track of the significant figures we've made\n sig_figs = output.length\n #remainder_args takes an array of three arguments - the dividend, divisor and the final answer string which ends with a . as we will be adding decimals\n remainder_args = [a,b,output + '.']\n #the default number of significant figures is 10. The loop runs until we hit the number of significant figures or if there is no remainder left\n while sig_figs < num_of_sig_figs && remainder_args[0] != 0\n #we have to create a new function which we will call recursively to add any new digits after the decimal point. We must call it on an array because otherwise we cannot change the variables due to Ruby's scope\n def remainder_divide(arr)\n #we multiply the dividend by 10 to make it a non decimal number\n arr[0] = multiply(arr[0], 10)\n #this loop is the same as our original division\n output = 0\n while arr[0] >= arr[1]\n arr[0] -= arr[1]\n output += 1\n end\n #here we change the output to a string and attach it to our original answer.\n output = output.to_s\n arr[2] += output\n #We change the remainder_args to our new array\n remainder_args = [arr[0],arr[1],arr[2]]\n end\n #now that we've defined our function, we will call it on our array of arguments until we hit the desired amount of significant figures or we have the answer\n remainder_divide(remainder_args)\n #we add one to our significant figures so that we don't loop infinitely\n sig_figs += 1\n end\n #we return our answer converted back to a number\n remainder_args[2].to_f\n end\nend", "def remainder(p0) end", "def calc_v(x, n, g)\n modpow(g, x, n)\n end", "def solution(n)\n lowest_p = nil\n a = 1\n\n while a * a <= n\n if n % a == 0\n b = n / a\n current_p = 2 * (a + b)\n\n if !lowest_p || current_p < lowest_p\n lowest_p = current_p\n end\n end\n\n a += 1\n end\n\n lowest_p\nend", "def divmod(val); end", "def solve( n = 1_000, a = 3, b = 5 )\n # Important that multiples of BOTH a and b not be double-counted.\n (0...n).select {|x| 0 == x % a || 0 == x % b}.inject( :+ )\n end", "def test_groebner_basis_coeff_01\n x, y, z = @P.vars('xyz')\n\n f1 = x**2 + y**2 + z**2 - 1\n f2 = x**2 + z**2 - y\n f3 = x - z\n\n g = x**3 + y**3 + z**3\n q, r = g.divmod_s(f1, f2, f3)\n # p q\n # p r\n assert_equal(g, q.inner_product([f1, f2, f3]) + r)\n # if g == q.inner_product([f1, f2, f3]) + r\n # puts \"Success!\"\n # else\n # puts \"Fail.\"\n # end\n 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 egcd(a, b)\n # let A, B = a, b \n s, t, u, v = 1, 0, 0, 1\n while 0 < b\n # loop invariant: a = sA + tB and b = uA + vB and gcd(a,b) = gcd(A,B)\n q = a/b\n a, b, s, t, u, v = b, (a%b), u, v, (s-u*q), (t-v*q) \n end \nreturn [a, s, t] \nend", "def inv_gcd(a, b)\n a %= b\n return [b, 0] if a == 0\n\n s, t = b, a\n m0, m1 = 0, 1\n while t>0 do\n u, s = s.divmod(t)\n m0 -= m1*u\n s, t = t, s\n m0, m1 = m1, m0\n end\n m0 += b/s if m0 < 0\n return [s, m0]\nend", "def dec_remainder_of_two_floats(f_dividend, f_divisor)\r\n # your code goes here\r\n f_dividend / f_divisor - (f_dividend / f_divisor).to_i\r\nend", "def / other\n other = Fraction.new(other) if other.instance_of? Fixnum\n self * other.inv\n end", "def calcD(pn,pa)\n return -1*(Math.log2(pn/pa))\nend", "def simplificar (fraccion)\n mcd = gcd(fraccion.numerador, fraccion.denominador)\n Fraccion.new( fraccion.numerador/mcd , fraccion.denominador/mcd)\n \n \n end", "def dec_remainder_of_two_floats(f_dividend, f_divisor)\n # your code goes here\n puts (f_divisor/f_dividend).round(1)\nend", "def divide\n match '/'\n factor\n emit_ln 'MOVE (SP)+,D1'\n emit_ln 'DIVS D1,D0'\nend", "def reciprocal ()\n\tFraccion.new(@denominador,@numerador)\n end", "def divisione(a, b)\n puts \"DIVIDENDO #{a} / #{b}\"\n a / b\nend", "def inv_mod x,n\n d,r,s = gcd2 x,n\n if d==1\n r % n\n else\n 0\n end\nend", "def continued_fraction(a, b, a_, b_)\r\n\t\t# Initialize\r\n\t\tq = q_ = nil\r\n\t\trslt = []\r\n\r\n\t\tuntil 0 == b or 0 == b_\r\n\t\t\t# Euclidean step\r\n\t\t\tq, r = a.divmod(b)\r\n\r\n\t\t\tr_ = a_ - b_ * q\r\n\t\t\tif r_ < 0 or b_ <= r_\r\n\t\t\t\tq_ = a_ / b_\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\r\n\t\t\trslt.push(q)\r\n\t\t\ta , b = b , r\r\n\t\t\ta_, b_ = b_, r_\r\n\t\tend\r\n\r\n\t\tif 0 == b\r\n\t\t\treturn rslt, [] if 0 == b_\r\n\t\t\treturn rslt, [a_ / b_, INFINITY]\r\n\t\tend\r\n\r\n\t\treturn rslt, [a / b, INFINITY] if 0 == b_\r\n\r\n\t\tq, q_ = q_, q if q > q_\r\n\t\treturn rslt, [q, q_]\r\n\tend", "def divide(x, y)\n if y == 0\n return \"Psst. You can't divide by zero. Please try again.\"\n elsif x.is_a?(Integer) && y.is_a?(Integer) && x % y != 0\n return x.to_f / y\n else\n return x / y\n end\nend", "def solve(n, m)\n m -= 1\n fac(n+m)/(fac(m)*fac(n)) % 1000000007\nend", "def fastexp_mod x,k,n\n if k<0\n throw :error\n elsif k==0\n 1\n elsif (k%2==0)\n fastexp_mod (x*x)%n, k/2, n\n else\n x*(fastexp_mod (x*x)%n, k/2, n) % n\n end\nend", "def solve(a, b, c)\n par = (b * b - 4 * a * c).sqrt\n [(-b + par) / (2 * a), (-b - par) / (2 * a)]\n end", "def division (first_number, second_number)\nfirst_number / second_number\nend", "def post_divide; end", "def mod(num1, num2)\n num2.to_f % num1.to_f;\nend", "def extended_lehmer_gcd(a, b)\r\n\t\td0 = a\r\n\t\tu0 = 1\t# d0 = a * u0 + b * v0\r\n\t\td1 = b\r\n\t\tu1 = 0\t# d1 = a * u1 + b * v1\r\n\r\n\t\tloop do\r\n\t\t\tif d1.instance_of?(Fixnum)\r\n\t\t\t\t_u, _v, d = extended_gcd(d0, d1)\r\n\r\n\t\t\t\t# here\r\n\t\t\t\t# d == _u * d0 + _v * d1\r\n\t\t\t\t# d0 == u0 * a + v0 * b\r\n\t\t\t\t# d1 == u1 * a + v1 * b\r\n\r\n\t\t\t\tu = _u * u0 + _v * u1\r\n\t\t\t\tv = (d - u * a) / b\r\n\r\n\t\t\t\treturn u, v, d\r\n\t\t\tend\r\n\r\n\t\t\t# Get most significant digits of d0 and d1\r\n\t\t\tshift_size = (d0 < d1 ? d1 : d0).bit_size - FIXNUM_BIT_SIZE\r\n\t\t\ta_ = d0 >> shift_size\r\n\t\t\tb_ = d1 >> shift_size\r\n\r\n\t\t\t# Initialize (Here a_ and b_ are next value of d0, d1)\r\n\t\t\t_A = 1\r\n\t\t\t_B = 0\t# a_ == msd(d0) * _A + msd(d1) * _B\r\n\t\t\t_C = 0\r\n\t\t\t_D = 1\t# b_ == msd(d0) * _C + msd(d1) * _D\r\n\r\n\t\t\t# Test Quotient\r\n\t\t\tuntil 0 == b_ + _C or 0 == b_ + _D\r\n\t\t\t\tq1 = (a_ + _B) / (b_ + _D)\r\n\t\t\t\tq2 = (a_ + _A) / (b_ + _C)\r\n\t\t\t\tbreak if q1 != q2\r\n\r\n\t\t\t\t# Euclidean step\r\n\t\t\t\t_A, _C = _C, _A - q1 * _C\r\n\t\t\t\t_B, _D = _D, _B - q1 * _D\r\n\t\t\t\ta_, b_ = b_, a_ - q1 * b_\r\n\t\t\tend\r\n\r\n\t\t\t# Multi-precision step\r\n\t\t\tif 0 == _B\r\n\t\t\t\tq, r = d0.divmod(d1)\r\n\t\t\t\td0, d1 = d1, r\r\n\t\t\t\tu0, u1 = u1, u0 - q * u1\r\n\t\t\telse\r\n\t\t\t\td0, d1 = d0 * _A + d1 * _B, d0 * _C + d1 * _D\r\n\t\t\t\tu0, u1 =u0 * _A + u1 * _B, u0 * _C + u1 * _D\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def calc_imc(a, p)\n\taqd = (a * a) / 10000\n\timc = p / aqd\n\tr_imc(imc)\nend", "def divide(a,b)\n a/b\nend", "def equationValue(a, b, c, d, x)\n\t\tf = ((a+x)/(b+x))**(b + x)\n\t\tf = f - (c/d)\n\t\treturn f\n\tend", "def mod_mult (p, n)\n q = p\n r = Point.new Float::INFINITY, Float::INFINITY\n\n while n > 0\n if n % 2 == 1\n r = self.mod_add r, q\n end\n\n q = self.mod_add q, q\n n = (n / 2).floor\n end\n r\n end", "def div(a, b) #=> funkcja wykonujaca dzielenie\n\n\tif b == 0\n\n\t\tputs \"Nie dzielimy przez 0!\"\n\t\treturn\n\n\telse\n\n\t\tputs \"Wynik: #{a/b}\"\n\n\tend\n\n\tputs \"Dzialanie wykonane prawidlowo\" #=> ta informacja nie pojawi sie w przypadku dzielenia przez 0\n\nend", "def div(x, y)\n x / y\nend", "def pick_op (a, b, numbers, answer, solution)\n test(a, b, \"+\", a+b, numbers, answer, solution.clone)\n test(a, b, \"-\", a-b, numbers, answer, solution.clone)\n test(a, b, \"*\", a*b, numbers, answer, solution.clone)\n test(a, b, \"/\", a/b, numbers, answer, solution.clone) if (b != 0 && a % b == 0) #avoid divide by zero and fractions\nend", "def pfdist(n1, n2, y); pf(1.0 - y, n1, n2); end", "def gcd2 a,b\n if a<b\n d,s,r = gcd2 b,a\n [d,r,s]\n elsif b==0\n [a,1,0]\n else\n x=a/b\n y=a%b\n d,r,s = gcd2 b,y\n # here we know that d = r*b+s*y, and a=x*b+y, so y=a-x*b\n # thus d=r*b+s*(a-x*b) = (r-s*x)*b + s*a\n # so we return [d,s,r-s*x]\n # uncomment the following three lines to see this work out\n # puts \"#{a}=#{x}*#{b}+#{y}\"\n # puts \"#{d}=#{s}*#{a} + #{(r-s*x)}*#{b}\"\n [d,s,(r-s*x)]\n end\nend", "def logsolver(base, number)\n b = log(base)\n a = log(number)\n return (a) / (b)\n end", "def gcd a,b\n if a<b\n gcd b,a\n elsif b==0\n a\n else\n gcd b,a%b\n end\nend", "def modpow(a, n, m)\n r = 1\n while true\n r = r * a % m if n[0] == 1\n n >>= 1\n return r if n == 0\n a = a * a % m\n end\n end", "def gcd( a, b )\n return a if b.zero?\n gcd b, a % b\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 dig_pow(n, p)\n # your code\n num = n.to_s\n total = 0\n for i in (0..(num.size - 1))\n total += (num[i].to_i) ** (p + i)\n end\n\n\n if total % n == 0\n total / n\n else\n -1\n end\nend", "def dig_pow(n, p)\n # your code\n num = n.to_s\n total = 0\n for i in (0..(num.size - 1))\n total += (num[i].to_i) ** (p + i)\n end\n\n\n if total % n == 0\n total / n\n else\n -1\n end\nend", "def phi_norm(n)\n primes = n.prime_division.map(&:first)\n primes.map { |p| 1.0 - 1.0 / p }.inject(:*)\nend", "def divide(a, b)\n divide = a / b\n return divide\nend", "def findFivtyPercent(input)\r\noutput=input/2\r\n# by default ruby returns the last calculated value. No need of return statement at this point\r\nreturn output\r\nend", "def /(b)\n b = b.symdescfy\n case b\n when Number\n __div_number(b)\n when Infinity\n ZERO\n else\n super\n end\n end", "def gcd(a, b)\n return a if b == 0\n\n remiander = a % b\n return gcd(b, remiander)\nend", "def mod_pow(base, power, mod)\n result = 1\n while power > 0\n result = (result * base) % mod if power & 1 == 1\n base = (base * base) % mod\n power >>= 1;\n end\n result\nend", "def lehmer_gcd(a, b)\r\n\t\ta = -a if a < 0\r\n\t\tb = -b if b < 0\r\n\t\ta, b = b, a if a < b\r\n\r\n\t\tuntil 0 == b\r\n\t\t\treturn Abst.gcd(a, b) if b.instance_of?(Fixnum)\r\n\r\n\t\t\t# Get most significant digits of a and b\r\n\t\t\tshift_size = (a < b ? b : a).bit_size - FIXNUM_BIT_SIZE\r\n\t\t\ta_ = a >> shift_size\r\n\t\t\tb_ = b >> shift_size\r\n\r\n\t\t\t_A = 1\r\n\t\t\t_B = 0\t# a_ == msd(a) * _A + msd(b) * _B\r\n\t\t\t_C = 0\r\n\t\t\t_D = 1\t# b_ == msd(a) * _C + msd(b) * _D\r\n\r\n\t\t\t# Always\r\n\t\t\t# a_ + _B <= msd(a * _A + b * _B) < a_ + _A AND\r\n\t\t\t# b_ + _C <= msd(a * _C + b * _D) < a_ + _D\r\n\t\t\t# OR\r\n\t\t\t# a_ + _B > msd(a * _A + b * _B) >= a_ + _A AND\r\n\t\t\t# b_ + _C > msd(a * _C + b * _D) >= a_ + _D\r\n\r\n\t\t\t# Test quotient\r\n\t\t\tuntil 0 == b_ + _C or 0 == b_ + _D\r\n\t\t\t\tq1 = (a_ + _A) / (b_ + _C)\r\n\t\t\t\tq2 = (a_ + _B) / (b_ + _D)\r\n\t\t\t\tbreak if q1 != q2\r\n\r\n\t\t\t\t# Euclidean step\r\n\t\t\t\t_A, _C = _C, _A - q1 * _C\r\n\t\t\t\t_B, _D = _D, _B - q1 * _D\r\n\t\t\t\ta_, b_ = b_, a_ - q1 * b_\r\n\t\t\tend\r\n\r\n\t\t\t# Multi-precision step\r\n\t\t\tif 0 == _B\r\n\t\t\t\ta, b = b, a % b\r\n\t\t\telse\r\n\t\t\t\ta, b = a * _A + b * _B, a * _C + b * _D\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\treturn a\r\n\tend", "def p_value(pr,a,b)\n GSL::Cdf::gamma_Pinv(pr.to_f, a.to_f, b.to_f)\n end", "def calculate_probability\n @value.denominator.fdiv(@value.denominator + @value.numerator)\n end", "def incomplete_beta_function(x, alp, bet)\n return if x < 0.0\n return 1.0 if x > 1.0\n\n tiny = 1.0E-50\n\n if x > ((alp + 1.0)/(alp + bet + 2.0))\n return 1.0 - incomplete_beta_function(1.0 - x, bet, alp)\n end\n\n # To avoid overflow problems, the implementation applies the logarithm properties\n # to calculate in a faster and safer way the values.\n lbet_ab = (Math.lgamma(alp)[0] + Math.lgamma(bet)[0] - Math.lgamma(alp + bet)[0]).freeze\n front = (Math.exp(Math.log(x) * alp + Math.log(1.0 - x) * bet - lbet_ab) / alp.to_f).freeze\n\n # This is the non-log version of the left part of the formula (before the continuous fraction)\n # down_left = alp * self.beta_function(alp, bet)\n # upper_left = (x ** alp) * ((1.0 - x) ** bet)\n # front = upper_left/down_left\n\n f, c, d = 1.0, 1.0, 0.0\n\n returned_value = nil\n\n # Let's do more iterations than the proposed implementation (200 iters)\n (0..500).each do |number|\n m = number/2\n\n numerator = if number == 0\n 1.0\n elsif number % 2 == 0\n (m * (bet - m) * x)/((alp + 2.0 * m - 1.0)* (alp + 2.0 * m))\n else\n top = -((alp + m) * (alp + bet + m) * x)\n down = ((alp + 2.0 * m) * (alp + 2.0 * m + 1.0))\n\n top/down\n end\n\n d = 1.0 + numerator * d\n d = tiny if d.abs < tiny\n d = 1.0 / d\n\n c = 1.0 + numerator / c\n c = tiny if c.abs < tiny\n\n cd = (c*d).freeze\n f = f * cd\n\n if (1.0 - cd).abs < 1.0E-10\n returned_value = front * (f - 1.0)\n break\n end\n end\n\n returned_value\n end", "def modulo(x, y)\n if y == 0\n return \"Psst. You can't divide by zero. Please try again.\"\n else\n return x % y\n end\nend", "def solve112(target_proportion)\n bouncy_proportion = 0\n total_bouncy = 0\n num = 0\n while bouncy_proportion < target_proportion\n num += 1\n if bouncy?(num)\n total_bouncy += 1\n bouncy_proportion = 1.0*total_bouncy/num\n end\n end\n puts target_proportion, num\nend" ]
[ "0.6324482", "0.6291089", "0.6045206", "0.592962", "0.5914762", "0.5885352", "0.5872081", "0.5839785", "0.58292603", "0.57683337", "0.57475543", "0.5728507", "0.5644301", "0.56398076", "0.5613875", "0.5613271", "0.56000406", "0.5549818", "0.5544975", "0.5541752", "0.553294", "0.55198747", "0.55032045", "0.5500498", "0.5482129", "0.5474144", "0.5447792", "0.54370695", "0.5426214", "0.5424498", "0.54222524", "0.54216725", "0.5386611", "0.5385234", "0.5385234", "0.537457", "0.5372214", "0.53495395", "0.5345016", "0.5341429", "0.53412527", "0.53326917", "0.5321898", "0.5315546", "0.5300653", "0.5293568", "0.52929133", "0.52896386", "0.5288871", "0.52843624", "0.5279989", "0.52781045", "0.5271646", "0.5270373", "0.52664596", "0.5257882", "0.5257184", "0.52569854", "0.52559125", "0.52461547", "0.52407455", "0.52398217", "0.5236466", "0.5236178", "0.5207668", "0.52024126", "0.51977175", "0.5197628", "0.51893896", "0.5183219", "0.51795924", "0.5175687", "0.5174972", "0.51720846", "0.5171124", "0.51649034", "0.51622504", "0.51582575", "0.51400065", "0.51388365", "0.51383173", "0.5134862", "0.51274884", "0.51246065", "0.51232445", "0.5122069", "0.5120183", "0.5120183", "0.5119225", "0.51122797", "0.5111678", "0.5105146", "0.5102803", "0.510178", "0.50988084", "0.5085159", "0.50850046", "0.5084429", "0.5078274", "0.5078154" ]
0.567636
12
Subtracts two points on the curve See mod_add below for a description of the algorithm
def mod_sub (a, b) self.mod_add a, Ecc::Point.new(b.x, -b.y) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtract(x,y)\r\n x - y \r\nend", "def subtract a, b\n\ta - b\nend", "def -(other)\n raise TypeError, \"Subtract 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 subtract(a, b)\n\treturn a - b\nend", "def subtract_point \n\t\t@lives -= 1\n\tend", "def mod_add (a, b)\n if b.inf\n return a\n end\n if a.inf\n return b\n end\n\n x1 = a.x\n x2 = b.x\n y1 = a.y\n y2 = b.y\n\n if x1 == x2 and y1 == -y2\n return Point.new Float::INFINITY, Float::INFINITY\n end\n\n if x1 == x2 and y1 == y2\n lambda = self.mod_inv 3 * x1 ** 2 + @a, 2 * y1\n else\n lambda = self.mod_inv y2 - y1, x2 - x1\n end\n\n x3 = Curve.mod lambda ** 2 - x1 - x2, @fp\n y3 = Curve.mod lambda * (x1 - x3) - y1, @fp\n\n Ecc::Point.new x3, y3\n end", "def -(other_point)\n Point.new(self.x - other_point.x, self.y - other_point.y)\n end", "def subtract!(rhs)\n subtract rhs, self\n end", "def sub!(point)\r\n @x -= point.x\r\n @y -= point.y\r\n end", "def subtract(a, b)\n a - b\nend", "def subtract(a, b)\n a - b\nend", "def subtract(a, b)\n a - b\nend", "def subtract(a, b)\n a - b\nend", "def Point2dSubtract(arg0, arg1)\n ret = _invoke(1610743817, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def subtract (a,b)\n return a-b\nend", "def sub!(rhs)\n @x -= rhs.x\n @y -= rhs.y\n self\n end", "def subt(x, y)\n x - y\nend", "def subtract_them(a, b)\n return a - b\n end", "def substract_function(iSubFunction)\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n case iSubFunction.function_data[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n lNewPoints = []\n unionXWithFunction_PiecewiseLinear(iSubFunction) do |iX, iY, iOtherY|\n if (iY == nil)\n lNewPoints << [ iX, -iOtherY ]\n elsif (iOtherY == nil)\n lNewPoints << [ iX, iY ]\n else\n lNewPoints << [ iX, iY - iOtherY ]\n end\n end\n # Replace with new points\n @Function[:Points] = lNewPoints\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n optimize\n end", "def do_subtract (opts)\n\tsum = @original\n\tparams = opts[:parameters]\n\tif !params || params.size(:seq) == 0 then -@original\n\telse do_sequential(opts) { |a, b| a - b }\n\tend\n end", "def subtract(other)\n clone.subtract! other\n end", "def sub(v)\n @x -= v.x\n @y -= v.y\n self\n end", "def -(p)\n Pair.new(@x - p.x, @y - p.y)\n end", "def subtract(first_arg, second_arg)\n first_arg - second_arg\nend", "def subtract (number1, number2)\n number1 - number2\n end", "def subtract(a, b)\n difference = a - b\n return difference\nend", "def - (other); \n if(self && other)\n i = other.i - self.i \n j = other.j - self.j\n pt = Point2D.new(i, j)\n vectorAdd = Vector2D.new( 0, 0 )\n vectorAdd.initializeWithPoint( pt )\n end\n end", "def subtract(number1, number2)\n number1 - number2\n end", "def subtract(a, b)\n puts \"SUBTRACTING #{a} - #{b}\"\n a - b\nend", "def subtract(num1,num2)\n\tp num1 - num2\nend", "def subtract (num1, num2)\n num1 - num2\nend", "def - other\n other.is_a?(Vips::Image) ?\n subtract(other) : linear(1, Image.smap(other) { |x| x * -1 })\n end", "def subtract(num1, num2)\n num1 - num2\nend", "def subtract(num1, num2)\n num1 - num2\nend", "def minus()\n \t\terror?\n \t\tsecond = @stack.pop\n \t\tfirst = @stack.pop\n \t\t@stack << (first - second)\n end", "def -(other)\n Vector.new(@x - other.x, @y - other.y)\n end", "def -(other)\n raise TypeError unless other.kind_of?(self.class)\n if self < other\n raise UndefinedOperationError; end\n if other.zero? then return self; end\n self.prev - other.prev\n end", "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 -(p)\n Point.new(@x - p.x, @y - p.y)\n end", "def subtract(num1, num2)\n return num1 - num2\nend", "def -(vector2)\n end", "def subtract_two_terms(left, right)\n\tadd_two_terms(left, flip_sign_on_term(right))\nend", "def subtract!(x=0,y=0,z=0)\n if x.kind_of? Numeric\n add!(-x, -y, -z)\n elsif x.point3_like?\n subtract! x.x, x.y, x.z\n else\n raise_no_conversion x\n end\n end", "def subtract(t1,t2) ##revisar name\n\t\treturn (t1-t2).to_i\n\tend", "def subtract(num, num2)\n return num - num2\nend", "def subtract(input_a, input_b, name: nil)\n input_a, input_b = check_data_types(input_a, input_b)\n sub(input_a, input_b, name: name)\n end", "def -(other)\n return self + (-other)\n end", "def subtract(first_number, second_number)\n first_number - second_number\nend", "def subtract(number_one, number_two)\nnumber_one - number_two\nend", "def minus\n return error_message if stack.empty?\n x = stack.pop\n y = stack.pop\n stack << y - x\n @value = y - x \n end", "def subtract(number_1, number_2)\n return number_1 - number_2\nend", "def subtract(first_number, second_number)\n return first_number - second_number\nend", "def -(rhs)\n Vektor[*zip(rhs).map {|x,y| x-y}]\n end", "def sub!(rhs)\n @x -= rhs.x\n @y -= rhs.y\n @z -= rhs.z\n self\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 subtract(first_number , second_number)\n return first_number - second_number\nend", "def coeficiente(p1,p2)\n return p2.abs.subPoint(p1.abs)\n end", "def subt(a,b)\n a-b\nend", "def -(other)\n self + (-other)\n end", "def do_minus s; a = mega_pop(s); b = mega_pop(s); s[:stack].push(b-a); end", "def sub(rhs)\n Vector2.new(@x - rhs.x, @y - rhs.y)\n end", "def -(other)\n @vector.merge!(other.hash){|key, oldval, newval| newval - oldval}\n end", "def subtract\n C.curry.(->(x, y) { x - y })\n end", "def -(other)\n combine(:-, other) ||\n fail(TypeError, \"Can't subtract #{other} from #{self}.\")\n end", "def subtract(n1, n2)\n difference = n1 - n2\n return difference\nend", "def -(other)\n self + other * -1\n end", "def Point3dSubtract(arg0, arg1)\n ret = _invoke(1610743867, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def -(other_vector)\n Vector.new @x - other_vector.x, @y - other_vector.y\n end", "def -(rhs)\n difference(rhs)\n end", "def sub(other)\n @x = @x - other.x\n @y = @y - other.y\n @z = @z - other.z\n self\n end", "def -\n a = pop\n b = pop\n push b - a\n end", "def -(other)\n Money.create_from_cents((cents - other.to_money.cents))\n end", "def subtract\n match '-'\n term\n emit_ln 'SUB (SP)+, D0'\n emit_ln 'NEG D0'\nend", "def shifted_diff(first, second)\n return -1\nend", "def -(subtrahend)\n self.minus(subtrahend).to_sub\n end", "def subtract\n @input1 = params[:input1]\n @input2 = params[:input2]\n @input1 = @input1.to_i\n @input2 = @input2.to_i\n @subtract = @input1 - @input2\n end", "def -(other); end", "def subtraction (first_number, second_number)\nfirst_number - second_number\nend", "def bbSub(first_point, second_point)\n\n bbp(first_point.x - second_point.x, first_point.y - second_point.y)\n end", "def minus\n\n\t\t# we have to make sure we have enough elements to perform the operation by calling empty\n\t\tempty?\n\n\t\t# store num2 by pop to take from end of array\n\t\tnum_1 = @calculator.pop\n\t\tnum_2 = @calculator.pop\n\n\t\t# result of the subtraction is pushed into @calc\n\t\t@calculator << num_2 - num_1\n\n\tend", "def - b\n 2.plus self.plus(b)\n end", "def subtract(a, b)\n puts \"SUBTRACTING #{a} - #{b}\"\n a - b # This is the output as the final expression of the function\nend", "def subtract(other)\n return [copy] unless overlap?(other)\n case [@tstart <=> other.tstart, @tend <=> other.tend]\n when [0,0], [1,-1], [0,-1], [1,0] # self is completely covered by other\n []\n when [-1,1] # start before other start and end is after other end, multiple bands\n [Band.new(@tstart,other.tstart - 1),Band.new(other.tend + 1,@tend)]\n when [-1,0],[-1,-1] # starts before other but ends at same time\n [Band.new(@tstart,other.tstart - 1)]\n when [0,1],[1,1] # starts same time as other but ends after\n [Band.new(other.tend + 1,@tend)]\n else\n raise \"Should not get here. Attempted #{self} - #{other}\"\n end\n end", "def -(other)\n end", "def subtract(skillName, user, skillpoint)\n\n end", "def -(vector)\n self + (-vector)\n end", "def subtract(key, value)\n update_array(key, value, :subtract)\n end", "def -(other)\n Coord.new(@x - other.x, @y - other.y)\n end", "def sub\n x, y = stack.pop(2)\n push x - y\n end", "def -(other)\n\t\tRacional.new(num*other.denom - other.num*denom, denom*other.denom)\n\tend", "def subtract!(other)\n if other.is_a?(Numeric)\n @data.each_index do |i|\n @data[i] -= other\n end\n elsif other.is_a?(Signal)\n raise ArgumentError, \"other.data.size #{other.size} is not equal to data.size #{@data.size}\" if other.data.size != @data.size\n @data.each_index do |i|\n @data[i] -= other.data[i]\n end\n elsif other.is_a?(Array)\n raise ArgumentError, \"other.size #{other.size} is not equal to data.size #{@data.size}\" if other.size != @data.size\n @data.each_index do |i|\n @data[i] -= other[i]\n end\n else\n raise ArgumentError, \"other is not a Numeric, Signal, or Array\"\n end\n return self\n end", "def subtract!(axis=origin,real=0)\r\n if axis.kind_of? Quaternion\r\n subtract!(axis.axis,axis.real)\r\n elsif axis.point3_like?\r\n set(@axis-axis,@real-real)\r\n else\r\n raise_no_conversion axis\r\n end\r\n self\r\n end", "def diff((x1, y1), (x2, y2))\n [x1 - x2, y1 - y2]\nend", "def -(other)\n combine_with(other) do |_variant, a, b|\n (a || 0) - (b || 0)\n end\n end", "def substract(a,b)\n a.to_i - b.to_i\nend", "def -(a)\n diff = Vector.new\n self.each_index{|k| diff[k] = self[k]-a[k]}\n diff\n end", "def eaurang(a, b)\n a - b;\nend", "def -(vector)\n end", "def -@\n\t\tself.class.new(-@a, -@b)\n\tend", "def calc_subtract(num1, num2)\n puts \"#{num1} - #{num2} = #{num1 - num2}\"\nend" ]
[ "0.7002318", "0.672244", "0.6706518", "0.6692486", "0.66874456", "0.6599773", "0.65433663", "0.6510937", "0.6496247", "0.6481127", "0.6481127", "0.6481127", "0.6481127", "0.64484656", "0.6442239", "0.64277405", "0.64117485", "0.6356988", "0.6305186", "0.62978077", "0.6291159", "0.62773794", "0.6272769", "0.62471044", "0.6238898", "0.62018174", "0.6199044", "0.6198722", "0.61961305", "0.61891603", "0.6156037", "0.61234343", "0.6121292", "0.6121292", "0.6114621", "0.61114395", "0.60847914", "0.6070888", "0.6067107", "0.6058114", "0.6041926", "0.6034592", "0.60173875", "0.5997559", "0.59918964", "0.59885484", "0.5987299", "0.5985305", "0.59794116", "0.59728074", "0.59441394", "0.59278584", "0.5925009", "0.5920503", "0.5907068", "0.5903553", "0.5903449", "0.5896882", "0.5861583", "0.58560264", "0.58530533", "0.585302", "0.58317375", "0.5828569", "0.58171296", "0.5811492", "0.5802382", "0.5798514", "0.5787381", "0.5787138", "0.578516", "0.57844186", "0.57787883", "0.5766531", "0.5762878", "0.5761486", "0.576103", "0.57599974", "0.57492834", "0.573686", "0.5734228", "0.5731197", "0.57296777", "0.57294106", "0.5724907", "0.57096815", "0.56904733", "0.568419", "0.5681834", "0.56502926", "0.56468225", "0.5638849", "0.56384945", "0.5638178", "0.56059575", "0.558944", "0.55802023", "0.5575733", "0.5574355", "0.55631065" ]
0.7491508
0
Adds two points on the curve
def mod_add (a, b) if b.inf return a end if a.inf return b end x1 = a.x x2 = b.x y1 = a.y y2 = b.y if x1 == x2 and y1 == -y2 return Point.new Float::INFINITY, Float::INFINITY end if x1 == x2 and y1 == y2 lambda = self.mod_inv 3 * x1 ** 2 + @a, 2 * y1 else lambda = self.mod_inv y2 - y1, x2 - x1 end x3 = Curve.mod lambda ** 2 - x1 - x2, @fp y3 = Curve.mod lambda * (x1 - x3) - y1, @fp Ecc::Point.new x3, y3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_line(point1, point2)\n end", "def addPoints(points) \n\t\t@points += points\n\tend", "def +(other_point)\n Point.new(self.x + other_point.x, self.y + other_point.y)\n end", "def addPoint( x, y) \n point = PVector.new(x, y)\n @points.push(point)\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 +(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 + (point)\n self.class.new(x + point.x, y + point.y)\n end", "def add!(point)\r\n @x += point.x\r\n @y += point.y\r\n end", "def add point\n self.x += point.x\n self.y += point.y\n self\n end", "def +(other)\n Point2D.new(@x + other.x, @y + other.y)\n end", "def add_to_point point\n add_to_point! point.dup\n end", "def +(ts)\n self.clone.add_points ts\n end", "def add_to_point! point\n vectors.each do |v|\n point.add! v\n end\n point\n end", "def + point\n\t\tPoint.new(@x+point.x, @y+point.y)\n\tend", "def add_curve(*args)\n end", "def add_point\n end", "def + (point)\n return Point2D.new(@x + point.x, @y + point.y)\n end", "def add(y)\n @x + y\n end", "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 curve(cp1x, cp1y, cp2x, cp2y, x1, y1, x2, y2)\n beginpath(x1, y1)\n CGContextAddCurveToPoint(@ctx, cp1x, cp1y, cp2x, cp2y, x2, y2)\n endpath\n end", "def + (other); \n if(self && other)\n i = self.i + other.i\n j = self.j + other.j\n pt = Point2D.new(i, j)\n vectorAdd = Vector2D.new( 0, 0 )\n vectorAdd.initializeWithPoint( pt )\n end\n end", "def add(v)\n @x += v.x\n @y += v.y\n self\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 [email protected]? || !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 [email protected]? || !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 +(y)\n @x + y\n end", "def +(p)\n Pair.new(@x + p.x, @y + p.y)\n end", "def add_cpoint(point)\n end", "def add!(rhs)\n @x += rhs.x\n @y += rhs.y\n self\n end", "def add(rhs)\n Vector2.new(@x + rhs.x, @y + rhs.y)\n end", "def add!(other)\n @x += other.x\n @y += other.y\n @angle = rad2deg(Math.atan2(@y, @x))\n @length = Math.sqrt(@x * @x + @y * @y)\n end", "def add_positions(pos1, pos2)\n\t[pos1[0] + pos2[0], pos1[1] + pos2[1]]\nend", "def add!(p)\n@x += p.x\n@y += p.y\nself\nend", "def add_positions(pos1, pos2)\r\n\t[pos1[0] + pos2[0], pos1[1] + pos2[1]]\r\nend", "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 + other\n if @coeffs.count > other.coeffs.count\n Polynomial.new @coeffs.zip(other.coeffs).map{ |a| a.map(&:to_f).inject(&:+) }\n else\n Polynomial.new other.coeffs.zip(@coeffs).map{ |a| a.map(&:to_f).inject(&:+) }\n end\n end", "def add_2(x, y)\n x + y\n end", "def add_2(x, y)\nend", "def add_to_point point\n vec = as_bearing_vector\n point.destination_point vec.bearing, vec.distance.in_kms\n end", "def add_points_and_save(xp_value)\n self.points_total += xp_value\n self.save\n end", "def plus(x, y)\n\nend", "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 add_points(points)\n @correct_answers += 1\n @points += points\n end", "def +(other)\n Vector.new(@x + other.x, @y + other.y)\n end", "def plus(e1, e2)\n eval_ex(e1) + eval_ex(e2)\n end", "def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def +(other)\n self.class.new(self.x + other.x, self.y + other.y, self.z.to_i + other.z.to_i)\n end", "def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def line(x1, y1, x2, y2)\n CGContextAddLines(@ctx, [NSPoint.new(x1, y1), NSPoint.new(x2, y2)], 2)\n CGContextDrawPath(@ctx, KCGPathStroke) # apply stroke\n endpath\n\n end", "def add_extra_points(p0, p1, min_res)\n n = points_to_add_between(p0, p1, min_res)\n dir = direction(p0, p1)\n\n (0..n).map do |offset|\n offset_point(p0, dir, min_res * offset)\n end + [p1]\n end", "def accumulate_points(points)\n points.map{|point| point.value}.reduce(0, :+)\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 two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def adds(other, scale)\n self[0] += other[0]*scale; self[1] += other[1]*scale\n self[2] += other[2]*scale\n end", "def +(other)\n Coord.new(@x + other.x, @y + other.y)\n end", "def quadratic_curve(x1, y1, x2, y2)\n [x1.value, y1.value, x2.value, y2.value]\n end", "def curve_points(points)\n cur_page.curve_points(points)\n end", "def +(vector2)\n end", "def two_points_to_line(x1,y1,x2,y2)\n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def +(other)\n Money.create_from_cents((cents + other.to_money.cents))\n end", "def add_point\n @score += 1\n end", "def adjust _x, _y\n x += _x\n y += _y\n end", "def add(other)\n @x = @x + other.x\n @y = @y + other.y\n @z = @z + other.z\n self\n end", "def Point2dAdd(arg0, arg1)\n ret = _invoke(1610743816, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def two_points_to_line(x1,y1,x2,y2)\n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\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 + other\n other.is_a?(Vips::Image) ?\n add(other) : linear(1, other)\n end", "def +(other)\n combine(:add, other)\n end", "def plus\n return error_message if stack.empty?\n x = stack.pop\n y = stack.pop\n stack << x + y\n @value = x + y\n end", "def addition( vector2 )\n i = @i + vector2.i\n j = @j + vector2.j\n pt = Point2D.new(i, j)\n vectorAdd = Vector2D.new( 0, 0 )\n vectorAdd.initializeWithPoint( pt )\n \n return vectorAdd \n end", "def +( vector )\n self.class.new( @x + vector.at(0), @y + vector.at(1) )\n end", "def add_quadraticpath(controlPoint1: { :x => 0.0, :y => 0.0 }, \n endPoint: { :x => 10.0, :y => 20.0 })\n pathElement = { :elementtype => \"pathquadraticcurve\",\n :controlpoint1 => controlPoint1,\n :endpoint => endPoint }\n @pathArray.push(pathElement)\n @pathArray\n end", "def add_points *args\n last = self.points.length\n args.each do |arg|\n case arg\n when Point then\n self.points << arg\n when TrackSegment then\n self.points += arg.points\n when Array then\n arg.each { |a| add_points a }\n else\n raise Ubiquity::Error::BadArgument, \"args should be a list of Points, TrackSegments or Arrays of any of them\"\n end\n end\n clean_memoized # ensures future recalculations\n self\n rescue\n self.points.slice!(last..-1) # in case of error eliminates added elements if any\n nil\n end", "def add(param1, param2, pos)\n @program[pos.value] = param_val(param1) + param_val(param2)\n end", "def add(p0) end", "def curveto(cp1x, cp1y, cp2x, cp2y, x, y)\n CGContextAddCurveToPoint(@ctx, cp1x, cp1y, cp2x, cp2y, x, y)\n end", "def +(x); end", "def sum(x,y)\r\n\t x + y\r\n\tend", "def +(other); end", "def +(other); end", "def +(other); end", "def add_bezierpath_withcp1_cp2_endpoint(controlPoint1: { :x => 0.0,\n :y => 0.0 }, \n controlPoint2: { :x => 9.0,\n :y => 9.0 }, \n endPoint: { :x => 10.0,\n :y => 20.0 })\n pathElement = { :elementtype => \"pathbeziercurve\",\n :controlpoint1 => controlPoint1,\n :controlpoint2 => controlPoint2,\n :endpoint => endPoint }\n @pathArray.push(pathElement)\n @pathArray\n end", "def add!(x=0,y=0,z=0)\n if x.kind_of? Numeric\n set(@x+x, @y+y, @z+z)\n elsif x.point3_like?\n add! x.x, x.y, x.z\n else\n raise_no_conversion x\n end\n end", "def +(rhs)\n Vector.new(self.x + rhs.x, self.y + rhs.y)\n end", "def +(*vector_or_number)\n v = Vector2d::new(vector_or_number)\n Vector2d.new(@x+v.x, @y+v.y)\n end", "def add_point(player)\n end", "def addittion(x, y)\n return (x + y)\nend", "def +(other_vector)\n Vector.new @x + other_vector.x, @y + other_vector.y\n end", "def add(val1, val2) val1 + val2 end", "def + ( *vector_or_number ); v = Vector2d::new( vector_or_number ); Vector2d.new( @x + v.x, @y + v.y ); end", "def add_points_property(points_gained)\n @points = points_gained\n return @points\nend", "def add(x,y)\n\tx+y\nend", "def add_rate(from, to, rate); end", "def egde(x1, y1, x2, y2)\n ConsoleDraw::Figures::Line.new(x1, y1, x2, y2).calculate_coordinates\n end", "def +(other)\n end", "def line(x, y)\n [x.value, y.value]\n end", "def +(p0) end", "def +(p0) end", "def +(p0) end", "def +(p0) end", "def +(*values); end", "def add(x,y)\r\n x + y \r\nend" ]
[ "0.74962234", "0.72730726", "0.7224024", "0.695464", "0.6952536", "0.69473594", "0.6937288", "0.69153154", "0.69018894", "0.68924814", "0.67878145", "0.6770488", "0.67596537", "0.67300266", "0.67045", "0.66844267", "0.66496336", "0.6634676", "0.65250075", "0.64955175", "0.64824295", "0.643039", "0.6423807", "0.6401453", "0.6352687", "0.63191056", "0.6297378", "0.6278309", "0.626567", "0.6239483", "0.6208884", "0.6205995", "0.62040186", "0.61985034", "0.61754453", "0.61378753", "0.6120257", "0.61033386", "0.60952073", "0.6064763", "0.60526735", "0.60473377", "0.6036471", "0.600754", "0.5997683", "0.5977321", "0.5943945", "0.5938401", "0.5933494", "0.5933137", "0.5909739", "0.59085745", "0.58805496", "0.58607066", "0.58548844", "0.58525866", "0.58480805", "0.5844468", "0.58418995", "0.5816922", "0.58161527", "0.5815413", "0.5809612", "0.5805888", "0.57861453", "0.5779519", "0.5778202", "0.5766617", "0.576534", "0.5748514", "0.5745349", "0.57406944", "0.573921", "0.5712835", "0.5711268", "0.5706109", "0.5705708", "0.5705708", "0.5705708", "0.5705267", "0.56948113", "0.56923354", "0.5682914", "0.5676491", "0.5663638", "0.5660813", "0.56596553", "0.56528145", "0.56519103", "0.56512785", "0.5649735", "0.5643985", "0.56421477", "0.5634843", "0.5633489", "0.5633489", "0.5633489", "0.5633489", "0.5629785", "0.56213915" ]
0.6936576
7
Adds a point on the curve, P, to itself n times This has been implemented using the DoubleandAdd algorithm.
def mod_mult (p, n) q = p r = Point.new Float::INFINITY, Float::INFINITY while n > 0 if n % 2 == 1 r = self.mod_add r, q end q = self.mod_add q, q n = (n / 2).floor end r end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(p0) end", "def add point\n self.x += point.x\n self.y += point.y\n self\n end", "def add_to_point point\n add_to_point! point.dup\n end", "def add!(p)\n@x += p.x\n@y += p.y\nself\nend", "def add(n, p)\n return n + p\nend", "def add!(point)\r\n @x += point.x\r\n @y += point.y\r\n end", "def add_to_point! point\n vectors.each do |v|\n point.add! v\n end\n point\n end", "def + (point)\n self.class.new(x + point.x, y + point.y)\n end", "def addPoints(points) \n\t\t@points += points\n\tend", "def +(p)\n Pair.new(@x + p.x, @y + p.y)\n end", "def + point\n\t\tPoint.new(@x+point.x, @y+point.y)\n\tend", "def addPoint( x, y) \n point = PVector.new(x, y)\n @points.push(point)\n end", "def add_point\n end", "def +(p0) end", "def +(p0) end", "def +(p0) end", "def +(p0) 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 insert(p, c, n)\n @starter.step(c, rand(n)).insert_next_fitting(c, p)\n end", "def add(p)\nq = self.dup\nq.add!(p)\nend", "def +(n)\n pc1 = pc + n\n oct1 = (to_i + n).div(12) + if (pc1 > pc) ^ !(n > 0) then -1\n else -n ** 0 end\n Pitch.new(pc1, oct1)\n end", "def + (point)\n return Point2D.new(@x + point.x, @y + point.y)\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 p(n)\r\n (return @ps[n]) if @ps[n]\r\n\r\n sum = 0\r\n @pk.each_with_index do |k, i|\r\n if k > n\r\n break\r\n end\r\n sign = ( i % 4 <= 1 ? 1 : -1)\r\n sum += sign * p( n - k )\r\n sum %= 1_000_000 #keep it under control\r\n end\r\n @ps[n] = sum\r\n return sum\r\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 [email protected]? || !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 [email protected]? || !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 mod_add (a, b)\n if b.inf\n return a\n end\n if a.inf\n return b\n end\n\n x1 = a.x\n x2 = b.x\n y1 = a.y\n y2 = b.y\n\n if x1 == x2 and y1 == -y2\n return Point.new Float::INFINITY, Float::INFINITY\n end\n\n if x1 == x2 and y1 == y2\n lambda = self.mod_inv 3 * x1 ** 2 + @a, 2 * y1\n else\n lambda = self.mod_inv y2 - y1, x2 - x1\n end\n\n x3 = Curve.mod lambda ** 2 - x1 - x2, @fp\n y3 = Curve.mod lambda * (x1 - x3) - y1, @fp\n\n Ecc::Point.new x3, y3\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 add_point\n @score += 1\n end", "def +(ts)\n self.clone.add_points ts\n end", "def add_ppe\n update_basic_fee('PPE',quantity: 800, amount: 200)\n end", "def add_points(points)\n @correct_answers += 1\n @points += points\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 add_points *args\n last = self.points.length\n args.each do |arg|\n case arg\n when Point then\n self.points << arg\n when TrackSegment then\n self.points += arg.points\n when Array then\n arg.each { |a| add_points a }\n else\n raise Ubiquity::Error::BadArgument, \"args should be a list of Points, TrackSegments or Arrays of any of them\"\n end\n end\n clean_memoized # ensures future recalculations\n self\n rescue\n self.points.slice!(last..-1) # in case of error eliminates added elements if any\n nil\n end", "def +(p)\n group(self, p)\n .fmap {|(x, y)| x + y }\n .tap {|r| r.label = \"(#{label} + #{p.label})\" }\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 create_rod(sPoint, a)\r\n pts = []\r\n pts[0] = sPoint\r\n pts[1] = Geom::Point3d.new(sPoint[0] + a, sPoint[1], sPoint[2])\r\n return pts\r\nend", "def add_pulp(mod)\n orange.add_pulp(mod)\n end", "def add_points_and_save(xp_value)\n self.points_total += xp_value\n self.save\n end", "def ip(p)\n (0...size).inject(0) { |sum, i| sum + @coords[i] * p[i] }\n end", "def ip(p)\n (0...size).inject(0) { |sum, i| sum + @coords[i] * p[i] }\n end", "def +(n) self.class.from_integer(to_i + n) end", "def sum_to(n)\n return nil if n < 0\n return 0 if n == 0\n \n n += sum_to(n-1)\n end", "def sum_of_products_of n, sum_up_to=999\r\n p = sum_up_to / n\r\n n * (p *(p + 1)) / 2\r\nend", "def +(n)\n Dice.new(count, sides, increment+n, multiplier)\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 add(v)\n @x += v.x\n @y += v.y\n self\n end", "def set_PADD(value)\n set_input(\"PADD\", value)\n end", "def sum(n)\n end", "def SimpleAdding(num)\n\n # code goes here\n range_num = *(1..num)\n return range_num.inject(:+)\n \nend", "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 accumulate_points(points)\n points.map{|point| point.value}.reduce(0, :+)\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(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 SimpleAdding(num)\n\n # code goes here\n range_sum = *(1..num)\n return range_sum.inject(:+)\n \nend", "def point( mu, di )\n v = @p1.to_vec( @p2 )\n u = v.unit\n ol = v.length\n nl = u * (ol*mu/di)\n p = @p1.dup.add( nl.to_pos )\n p\n end", "def add_line(point1, point2)\n end", "def exp_sum(n, hash = {0=>1, 1=>1})\n\tif n > 1\n\t\tcalc_array = []\n\t\tpent_arr = calc_pent(n)\n\t\tlen = pent_arr.length\n\t\tcount = 0\n\t\twhile count < len\n\t\t\tpent_at_bat = pent_arr.pop\n\t\t\tnum_to_part = n - pent_at_bat\n\t\t\tif hash.has_key? (num_to_part)\n\t\t\t\tcalc_array.unshift(hash[num_to_part])\n\t\t\telsif num_to_part > -1\n\t\t\t\tnew_val = exp_sum(num_to_part, hash)\n\t\t\t\thash[num_to_part] = new_val\n\t\t\t\tcalc_array.unshift(new_val)\n\t\t\tend \n\t\t\tcount += 1\n\t\tend\n\t\tsum_array(calc_array)\n\telsif n < 0\n\t\treturn 0\n\telse \n\t\treturn 1\n\tend\nend", "def add_up(num)\n return (1..num).inject(:+)\nend", "def append(n)\r\n self.value = self.value.to_s + n.to_s\r\n end", "def go(pt)\n raise ArgumentError unless is_point?(pt)\n @xy = pt\n @track.last << @xy if @pen_is_down\n end", "def pt__X_(n, y); ptdist(n, 0.5 + y); end", "def add!(rhs)\n @x += rhs.x\n @y += rhs.y\n self\n end", "def sum_of_point\n # Calculating point of each block\n calculate_points\n # Sum\n rubbish_count + not_clear_count + somewhat_count + understand_count\n end", "def sum(n)\n s = BigDecimal.new(\"1\")\n sig = 1\n\n 1.upto(n) do |i|\n sig *= -1\n s += (1.0 / (2*i + 1)) * sig\n end\n\n 4 * s\nend", "def <<(p)\n raise TypeError, \"Esperada pregunta para inserción\" unless p.is_a? (Pregunta)\n if (@total == 0)\n @cabeza = Nodo.new(p, nil, nil)\n @cola = @cabeza\n else\n @cola.next = Nodo.new(p, nil, @cola)\n @cola = @cola.next\n @cola.value\n end\n @total += 1\n end", "def add_product(p)\n \n raise \"This Flyer is readonly!\" if @readonly\n \n @now = now_with_offset\n \n # We compare the datetime the product was created with the current datetime\n # so that if we can use this object in other places (for example when converting from a csv file to JerkStore). It ensures that only products from a given datetime will appear in this flyer.\n tmp_now = p.datesummarized\n val_now = 0\n val_then = 0\n if (\"day\".eql?(self.timespan))\n val_now = @now.yday\n val_then = tmp_now.yday\n elsif (\"week\".eql?(self.timespan))\n val_now = @now.cweek\n val_then = tmp_now.cweek\n elsif (\"month\".eql?(self.timespan))\n val_now = @now.mon\n val_then = tmp_now.mon\n end\n \n #STDERR.puts \"Comparing #{val_now} to #{val_then} for #{ self.timespan }\"\n \n if (val_now == val_then)\n self.products.unshift(p) \n else\n nil\n end\n \n p\n end", "def hw11_3()\n p = [0, 2]\n q = [15, 6]\n n = 23\n a = 1\n current = {:r => p, :a => 1, :b => 0}\n for i in (0..20)\n print \"$R_#{i}$ & (#{current[:r][0]}, #{current[:r][1]}) & #{current[:a]} & #{current[:b]} \\\\\\\\\\n\"\n if current[:r][1] < 9\n if current[:r][0] == p[0] && current[:r][1] == p[1]\n current[:r] = ec_double_point(current[:r][0], current[:r][1], n, a)\n else\n current[:r] = ec_add_point(current[:r][0], current[:r][1], p[0], p[1], n)\n end\n current[:a] += 1\n elsif current[:r][1] < 17\n current[:r] = ec_add_point(current[:r][0], current[:r][1], q[0], q[1], n)\n current[:b] += 1\n else\n current[:r] = ec_double_point(current[:r][0], current[:r][1], n, a)\n current[:a] *= 2\n current[:b] *= 2\n end\n end\n\n puts 27 * 4 % 29\n print ec_multiply_point(11, 9, 23, 1, 7)\n print \"\\n\"\n print ec_multiply_point(15, 6, 23, 1, 3)\nend", "def + (other); \n if(self && other)\n i = self.i + other.i\n j = self.j + other.j\n pt = Point2D.new(i, j)\n vectorAdd = Vector2D.new( 0, 0 )\n vectorAdd.initializeWithPoint( pt )\n end\n end", "def increment_points(points)\n self.balance = self.balance.to_i + points.to_i\n self.save\n end", "def SimpleAdding(num)\n (1..num).inject(:+)\nend", "def SimpleAdding(num)\n (1..num).inject(:+)\nend", "def geometricSeriesSum(x, n)\n return (power(x, n + 1) - 1) / (x - 1)\nend", "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 add!(x=0,y=0,z=0)\n if x.kind_of? Numeric\n set(@x+x, @y+y, @z+z)\n elsif x.point3_like?\n add! x.x, x.y, x.z\n else\n raise_no_conversion x\n end\n end", "def +(other)\n Point2D.new(@x + other.x, @y + other.y)\n end", "def add_point(player)\n end", "def increment(n = 1)\n @quantity += n\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 pt___x(n, y); ptdist(n, 1.0 - y); end", "def adder(add=1, &prc)\n\treturn prc.call + add\nend", "def sum_terms(n)\n # your code here\n (1..n).inject(&:+)\nend", "def testAddPoint_addOne_validTree\n ps = [UniquePoint3.new(-17,-31,47), UniquePoint3.new(12,-8,92)]\n q = QuadTreeAccelerator.new(ps, nil, 8)\n p = UniquePoint3.new(3, -10, 57)\n q.addPoint(p)\n r = QuadTreeAccelerator.new(ps + [p],nil, 8)\n assert_equal(q.to_s, r.to_s)\n end", "def r(p,n,a,s)\n j = p[a-1] - s - 1\n v = 0\n i = 0\n for i in 0..(j-1) do\n v += b(i) * b(n-i-1)\n end\n v +\n (j <= 1 ? 0 : b(n-j-1) * (r(p,j,a+1,s) - 1)) +\n (n-j-1 <= 1 ? 1 : r(p,n-j-1,a+j+1,s+j+1))\n end", "def add_extra_points(p0, p1, min_res)\n n = points_to_add_between(p0, p1, min_res)\n dir = direction(p0, p1)\n\n (0..n).map do |offset|\n offset_point(p0, dir, min_res * offset)\n end + [p1]\n end", "def add_rate(from, to, rate); 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 adder(surplus=1, &prc)\n value = prc.call\n value + surplus\nend", "def plus(x, y)\n\nend", "def put(ps)\n @piece += ps\n self\n end", "def +(num)\n old_plus(old_plus(num))\n end", "def magicalWell(a, b, n)\n (1..n).sum {\n money = a*b \n a += 1\n b += 1\n money\n }\nend", "def sum_to(n)\n return nil if n <= 0 #negatives and 0\n return 1 if n == 1 #base step\n #inclusive step 1 + sum_to(n)\n n + sum_to(n - 1)\nend", "def square_sum_up_to n=100\r\n (n * (n + 1) / 2)**2\r\nend", "def <<(n)\n @input.push n.to_f\n end", "def increment(points_count)\n\t\t@story_count += 1\n\t\t@points_count += points_count\n\tend", "def begin_adding(*) end", "def sum_to(n)\n return 1 if n == 1\n return nil if n < 1\n n += sum_to(n - 1)\nend", "def bezier(t, points)\n n = points.length - 1\n points.each_with_index.inject(0.0) do |sum, (point, i)|\n sum += n.choose(i) * (1-t)**(n - i) * t**i * point.y\n end\n end" ]
[ "0.67406064", "0.66404366", "0.6563374", "0.64949375", "0.64269406", "0.63768405", "0.6364868", "0.61251175", "0.60865754", "0.60459965", "0.6039418", "0.59770966", "0.5939919", "0.5935999", "0.5935999", "0.5935999", "0.5935999", "0.5867334", "0.58661383", "0.5855765", "0.58034086", "0.57876325", "0.5709051", "0.57072604", "0.5682055", "0.5660976", "0.5658525", "0.56328255", "0.5612894", "0.56078774", "0.5603756", "0.55884725", "0.5585366", "0.55810773", "0.55266297", "0.5496807", "0.54964584", "0.5466236", "0.5464181", "0.5446722", "0.5446722", "0.54413253", "0.5422398", "0.54216635", "0.53866243", "0.5381409", "0.53636765", "0.5329287", "0.53220695", "0.53067726", "0.53065014", "0.5295793", "0.52957606", "0.52943146", "0.52943146", "0.5293295", "0.52822196", "0.52712256", "0.5264566", "0.52639544", "0.5252284", "0.52408147", "0.5239827", "0.5222506", "0.521492", "0.52052444", "0.5193048", "0.51902336", "0.51898265", "0.5189422", "0.5186186", "0.51765645", "0.51765645", "0.5171047", "0.51635844", "0.5154253", "0.51468575", "0.5144393", "0.5131933", "0.5126725", "0.5109613", "0.5103574", "0.51032287", "0.50994", "0.5099043", "0.50960064", "0.5087842", "0.50834", "0.508276", "0.5066834", "0.5065771", "0.50640863", "0.50618124", "0.5060123", "0.5058681", "0.5057582", "0.50575197", "0.50570726", "0.5054927", "0.504961" ]
0.5738527
22
Which time tracking module you will use.
def tt_module mdl = read_attribute( :tt_module ) mdl.present? ? mdl : master.try(:tt_module) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_class; end", "def time_trackings\n Easybill::Api::TimeTrackings\n end", "def playtime_forever\r\n\t raw_app['playtime_forever']\r\n\t end", "def show_time\n\n end", "def get_time_label(type = \"serial\")\n \n if type == \"serial\"\n \n #ref http://stackoverflow.com/questions/7415982/how-do-i-get-the-current-date-time-in-dd-mm-yyyy-hhmm-format\n return Time.now.strftime(\"%Y%m%d_%H%M%S\")\n \n elsif type == \"display\"\n \n #ref http://stackoverflow.com/questions/7415982/how-do-i-get-the-current-date-time-in-dd-mm-yyyy-hhmm-format\n return Time.now.strftime(\"%Y/%m/%d %H:%M:%S\")\n \n else\n \n return Time.now.strftime(\"%Y%m%d_%H%M%S\")\n \n end\n \nend", "def time \n \"time\" \n end", "def time_format\n return :time12 if new_us_user?\n\n clock_type == '12h' ? :time12 : :time24\n end", "def time_class=(_arg0); end", "def time_to_show\n \n end", "def time\n\n end", "def time_hour; Time.now.hour; end", "def now; end", "def now; end", "def ask_time\n # twelve\n end", "def localtime() end", "def get_setup_time(ant)\n end", "def time_now\n ::Time.now\n end", "def report_time time\n end", "def time\n end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def time; end", "def set_time_tracker\n @time_tracker = TimeTracker.find(params[:id])\n end", "def current_time\n return Time.now().to_i\nend", "def determine_current_hour\n\tcurrent_time = Time.new\n\tcurrent_hour = current_time.hour\nend", "def set_time_tracker\n @time_tracker = TimeTracker.find(params[:id])\n end", "def hold_time\n game_type == 'zones' ? config.time || 99999999 : nil\n end", "def current_timeset?\n OrigenTesters::Timing.timeset == self\n end", "def flight_time; end", "def now\n VoltTime.new\n end", "def time\n super\n end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def basic_description\n \"have time select\"\n end", "def determine_current_hour\n current_time = Time.new\n current_hour = current_time.hour\nend", "def current_time\n plan_rebuilder.current_time\n end", "def awesome_active_support_time(object)\n awesome_self(object, :as => :time)\n end", "def current_time\n Time.now.strftime(\"%l:%M %p\")\n end", "def time_klass(time)\n case time\n when ActiveSupport::TimeWithZone\n Time\n else\n time.class\n end\n end", "def getServerTime()\r\n\t\t# get the time now\r\n\t\ttime = Time.now.to_i\r\n\t\ttime\r\n\tend", "def time_zone; end", "def time_zone; end", "def time_zone; end", "def time_zone; end", "def time_zone; end", "def lead_time\n 1\n end", "def base_time\n BASE_TIME\n end", "def event_time(format = \"%l:%M %p\")\n self.showtime.strftime(format) if self.showtime\n end", "def time\n DateTime.now.strftime(TIME_FORMAT)\n end", "def time_tick timestamp\n\t @now = timestamp\n\t super\n\tend", "def acts_like_time?\n true\n end", "def this_event_time\n @event[\"server_gmt\"].to_i\n end", "def acts_like_time?\n\t\ttrue\n\tend", "def current_time\n @definition.current_time\n end", "def __mongoize_time__\n ::Time.configured.local(*self)\n end", "def current_timer; end", "def start_time\n return \"1530\";\n end", "def label_target\n \"delivery_time\"\n end", "def current_otp_timestep\n Time.now.utc.to_i / otp.interval\n end", "def get_time()\n\tarr_times = [\"Morning\", \"Day\", \"Afternoon\", \"Evening\", \"Night\"]\n\t#binding.pry\n\tif Time.now.strftime(\"%H\").to_i < 12 \n\t\tarr_times[0]\n\telsif Time.now.strftime(\"%H\").to_i < 14\n\t\tarr_times[1]\n\telsif Time.now.strftime(\"%H\").to_i < 18\n\t\tarr_times[2]\n\telsif Time.now.strftime(\"%H\").to_i < 21\n\t\tarr_times[3]\n\telse\n\t\tarr_times[4]\n\tend\nend", "def web_time; strftime(WEB_TIME_FORMAT); end", "def get_game_play_time()\r\n return @game_play_time \r\n end", "def time\n @robot.time\n end", "def start_time; end", "def no_time\n no_define\n end", "def current_time\n @current_time\n end", "def current_time\n clock.now.to_f\n end", "def daytime \n \"daytime\" \n end", "def all_suite_times; end", "def all_suite_times; end", "def get_time_required\n 1.0\n end", "def acts_like_time?\n true\n end", "def current_time\n Time.now.strftime('%I:%M:%S %p')\n end", "def time?\n type == \"TIME\"\n end", "def time_format\n return @time_format\n end", "def device_time(format = nil)\n @bridge.device_time(format)\n end", "def device_time(format = nil)\n @bridge.device_time(format)\n end", "def timer_label\n view.timer_label\n end", "def now\n @clock\n end", "def utime=(*) end", "def lead_time\n 4\n end", "def pbGetTimeNow\n return Time.now\nend", "def opening_hour\n 11 # 11am\n end", "def current_time\n DateTime.now\n end", "def current_time\n DateTime.now\n end", "def server_timing; end", "def identifier\n time.ymdHMS\n end", "def utime(*) end", "def localtime\n # Opal 0.9.0 has no localtime method so use getlocal instead\n @time.getlocal\n end", "def ebay_time\n\t\[email protected]_shop_call 'GeteBayTime'\n\tend", "def clock24?\n true\n end" ]
[ "0.6981751", "0.64017165", "0.6151248", "0.6141517", "0.59765303", "0.59274215", "0.5882794", "0.587145", "0.58704287", "0.5851859", "0.5837378", "0.58322567", "0.58322567", "0.5773271", "0.5762978", "0.5758385", "0.57576066", "0.5752768", "0.574981", "0.5747127", "0.5747127", "0.5747127", "0.5747127", "0.5747127", "0.5747127", "0.5747127", "0.5747127", "0.5747127", "0.5716062", "0.5682917", "0.56716204", "0.5654249", "0.5641333", "0.56321096", "0.56273437", "0.5625499", "0.5616434", "0.56162506", "0.56162506", "0.56162506", "0.56162506", "0.56162506", "0.56162506", "0.5613322", "0.5613018", "0.5605868", "0.56045485", "0.55938476", "0.5593039", "0.5590713", "0.5583005", "0.5583005", "0.5583005", "0.5583005", "0.5583005", "0.5582534", "0.5580263", "0.55763507", "0.55762756", "0.5532287", "0.5523335", "0.552066", "0.5520442", "0.55197215", "0.5517727", "0.5514757", "0.5512847", "0.55089676", "0.55072355", "0.5503745", "0.5503399", "0.5496495", "0.54924154", "0.54913354", "0.5483611", "0.54829216", "0.5471205", "0.5459817", "0.54534733", "0.54534733", "0.545192", "0.54440266", "0.5439819", "0.54392976", "0.54366904", "0.54285616", "0.54285616", "0.5427414", "0.542519", "0.54157174", "0.5409352", "0.539835", "0.5397025", "0.5395536", "0.5395536", "0.5393136", "0.5392459", "0.539154", "0.53821474", "0.5381266", "0.5377283" ]
0.0
-1
Recursively sums up all stages' relative progress. This method is the heart of the software!
def relative_progress if stages.any? from_stages = stages.collect{ |pr| pr.relative_progress }.sum end sum=(relative_milestone.to_f / milestones) * relative_expected_percentage sum + from_stages.to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_stage(game, stage)\n game.cycle = self\n game.result.each { |result| stage[result - 1] += 1 }\n stages << stage\n end", "def progress\n total_steps_count = self.steps.count\n\n if total_steps_count.zero?\n 0.0\n else\n approved_steps_count = self.steps.where(state: 'approved').count\n (approved_steps_count * 100.0 / total_steps_count).round(2)\n end\n end", "def tasks_progress\n total_done = 0\n total_tasks = 0\n self.stories.each do |story|\n story.issues.each do |issue|\n total_tasks += 1\n total_done += issue.done\n end\n end\n total_tasks > 0 ? total_done / total_tasks : 100\n end", "def progress\n return 100 unless @history.first\n completed_size = @history.first.jobs.select(&:completed?).size\n completed_size * 100 / @history.first.jobs.size\n end", "def expected_progress_function(date, in_resources)\n\t\tif !has_children?\n\t\t\treturn 0.0\n\t\telse\n\t\t\ttotal_children_value = 0\n\t\t\ttotal_children_value_extolled = 0\n\n\t\t\t# si lo piden en tiempo\n\t\t\tif !in_resources\n\t\t\t\tchildren.each do |c|\n\t\t\t\t\ttotal_children_value += c.duration\n\t\t\t\t\ttotal_children_value_extolled += c.expected_progress_function(date, in_resources) * c.duration\n\t\t\t\tend\n\t\t\t# si lo piden en recursos\n\t\t\telse\n\t\t\t\tchildren.each do |c|\n\t\t\t\t\ttotal_children_value += c.resources_cost_from_children\n\t\t\t\t\ttotal_children_value_extolled += c.expected_progress_function(date, in_resources) * c.resources_cost_from_children\n\t\t\t\tend\n\t\t\tend\n\n\n\t\t\treturn (total_children_value_extolled/total_children_value).to_f.round(1)\n\t\tend\n\tend", "def total\n @parts.map {|part| part.abs }.inject(0) {|sum,val| sum + val }\n end", "def add_job_progress(sum)\n return JobProgress.add(sum) if sum > 0\n -1\n end", "def path_sum(root, sum)\n res = []\n dfs(root, res, [], sum)\n res\nend", "def calculate_progress\n result = self.progress_status\n (100 * result.values.count(true) / result.values.compact.count).to_s\n end", "def transition_stats\n if done?\n @transition_stats ||= (\n stats = {}\n hierarchy = @processor.children.dup\n i = 0\n while i < hierarchy.size\n child = hierarchy[i]\n if child.model.coupled?\n hierarchy.concat(child.children)\n else\n stats[child.model.name] = child.transition_stats\n end\n i+=1\n end\n total = Hash.new(0)\n stats.values.each { |h| h.each { |k, v| total[k] += v }}\n stats[:TOTAL] = total\n stats\n )\n end\n end", "def progress()\n return 1.0 * @done_time_units / @total_time_units\n end", "def calc_progress\n p = 0.25\n unless self.compile_errors.nil?\n p = 0.5\n end\n\n if self.correct\n p = 1.0\n else\n unless self.results.nil?\n p_tc = 0.0\n self.results.each do |id,result|\n unless result['error']\n p_tc = p_tc + 1\n end\n end\n p = p + ((p_tc/self.results.size) * 0.5)\n end\n end\n\n p\n end", "def update_percentage_for_parent_progresses user\n\t\tif model_type == \"lesson\" # find or create progress for track and recursively call on track\n\t\t\tProgress.where(model_type: \"track\", model_id: lesson.track.id, user_id: user.id).first_or_create.update_percentage_for_parent_progresses user\n\t\telsif model_type == \"track\" #update the percentage, find or create progress for topic, and recursively call on topic\n\t\t\tlessons = track.lessons.where('lesson_type != (?)', \"tools\")\n\t\t\tlesson_progresses = lessons.map {|l| l.progress(user) }.compact\n\t\t\tupdate_attributes percent_complete: (lesson_progresses.count / lessons.count.to_f ) * 100\n\t\t\tProgress.where(model_type: \"topic\", model_id: track.topic.id, user_id: user.id).first_or_create.update_percentage_for_parent_progresses user\n\t\telse model_type == \"topic\" #update topic percentage and return\n\t\t\ttracks = topic.tracks\n\t\t\ttrack_progresses = tracks.map {|t| t.progress_percentage(user) }.inject(:+)\n\t\t\tupdate_attributes percent_complete: (track_progresses / tracks.count.to_f ).floor \n\t\tend\n\tend", "def sum_children(records, parent, total = 0)\n return 0 if records[parent].nil?\n\n records[parent].each do |child, how_many|\n total += how_many\n total += how_many * sum_children(records, child)\n end\n total\nend", "def recursively_optimise(path,depth=0)\r\n raise ArgumentError, \"Argument must be a directory\" unless File.directory?(path)\r\n puts \"Called with #{path}\"\r\n total_before = 0\r\n total_after = 0\r\n total_before_types = {}\r\n total_after_types = {}\r\n total_time_types = {}\r\n begin\r\n # Call ourself on any directories in this path\r\n Dir.foreach(path) do |entry|\r\n next if entry == \".\"\r\n next if entry == \"..\"\r\n fullpath = File.join(path, entry)\r\n if File.directory?(fullpath)\r\n res = self.recursively_optimise(fullpath, (depth+1))\r\n total_before += res[:before]\r\n total_after += res[:after]\r\n #if res[:before_types] and res[:after_types]\r\n res[:before_types].each_pair do |k,v|\r\n total_before_types[k] = 0 unless total_before_types[k]\r\n total_before_types[k] += v\r\n end\r\n res[:after_types].each_pair do |k,v|\r\n total_after_types[k] = 0 unless total_after_types[k]\r\n total_after_types[k] += v\r\n end\r\n res[:time_types].each_pair do |k,v|\r\n total_time_types[k] = 0 unless total_time_types[k]\r\n total_time_types[k] += v\r\n end\r\n #end\r\n else\r\n res = @optimiser.optimise_image(fullpath)\r\n total_before += res[:before]\r\n total_after += res[:after]\r\n total_before_types[res[:type]] = 0 unless total_before_types[res[:type]]\r\n total_before_types[res[:type]] += res[:before]\r\n total_after_types[res[:type]] = 0 unless total_after_types[res[:type]]\r\n total_after_types[res[:type]] += res[:after]\r\n total_time_types[res[:type]] = 0 unless total_time_types[res[:type]]\r\n total_time_types[res[:type]] += res[:time]\r\n end\r\n end\r\n rescue Exception => e\r\n puts \"Got exception #{e.inspect} while processing!\"\r\n puts e.backtrace\r\n end\r\n if depth == 0\r\n puts \"\\n\\nDone optimising everything!\"\r\n puts \"I started with a total size of #{Rarity::to_human total_before}\"\r\n puts \"I finished with a total size of #{Rarity::to_human total_after}, a reduction of #{Rarity::to_human (total_before-total_after).abs}\"\r\n\r\n puts\"\\nType breakdowns:\"\r\n total_before_types.each_pair do |k,v|\r\n a = total_after_types[k]\r\n t = total_time_types[k]\r\n puts \"#{k.to_s.upcase}: #{Rarity::to_human v} before, #{Rarity::to_human a} after, reduction of #{Rarity::to_human (v-a).abs} or #{Rarity::to_human (((v-a).abs)/t.abs)} per second saved\"\r\n end\r\n end\r\n return {:before => total_before, :after => total_after, :before_types => total_before_types, :after_types => total_after_types, :time_types => total_time_types}\r\n end", "def progress()\n percent = (($ops / $total_ops) * 100).floor\n if (percent <= 99)\n $progress.progress = percent\n $ops += 1\n else\n $progress.finish\n end\nend", "def reconcile_states_percent(path, states)\n direct_children = states.reject { |k, _| k.gsub(/^#{path}\\//, '').include?('/') }\n return states[path]['percent'] if direct_children.empty?\n percent = 0\n direct_children.each_key { |dc_path| percent += reconcile_states_percent(dc_path, states).to_f * states[dc_path]['weight'].to_f / 100.0 }\n percent\n end", "def real_progress_function(date, in_resources)\n\t\tif date < Time.now\n\t\t\tif !has_children?\n\t\t\t\t0\n\t\t\telse\n\t\t\t\ttotal_children_value = 0\n\t\t\t\ttotal_children_value_extolled = 0\n\n\t\t\t\tif !in_resources\n\t\t\t\t\tchildren.each do |c|\n\t\t\t\t\t\taux_duration = c.duration\n\t\t\t\t\t\ttotal_children_value += aux_duration\n\t\t\t\t\t\ttotal_children_value_extolled += c.real_progress_function(date, in_resources) * aux_duration\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tchildren.each do |c|\n\t\t\t\t\t\taux_resources = c.resources_cost_from_children\n\t\t\t\t\t\ttotal_children_value += aux_resources\n\t\t\t\t\t\ttotal_children_value_extolled += c.real_progress_function(date, in_resources) * aux_resources\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\treturn (total_children_value_extolled/total_children_value).to_f.round(1)\n\t\t\tend\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "def progress_percentage\n total_amount = 0\n # proceed_amount = 0\n total_amount = card_sub_tasks.map(&:service_card_count).reduce(:+)\n # card_sub_tasks.each do |card_sub_task|\n # if card_sub_task.proceed == CardSubTask::PROCEED_FINISHED || card_sub_task.proceed == CardSubTask::PROCEED_ERROR\n # proceed_amount += card_sub_task.service_card_count\n # elsif card_sub_task.proceed == CardSubTask::PROCEED_PROCESSING\n # proceed_amount += card_sub_task.service_cards.count\n # end\n # end\n return percentagere = \"#{sprintf(\"%.1f\", proceed_amount.to_i / total_amount.to_f * 100)}%\"\n end", "def progress\n summary = exec_summary\n summary.progress.num_completed_scan_ranges.to_f / summary.progress.total_scan_ranges.to_f\n end", "def path_sum(root, target)\n return 0 unless root\n\n path_sum_helper(root, target, 0, Hash.new(0))\nend", "def update_progress(total, done)\n percentage = total.zero? ? 100 : ((done.to_f / total) * 100).to_i\n progress(percentage)\n end", "def total_payout\n # calculate children payout\n count = 0\n self.children.each do |child|\n count = count + child.total_payout\n end\n \n # calculate payout of this ativity\n if self.state == COMPLETE\n return count + self.reward\n elsif self.state == EXPIRED\n return count - self.penalty\n else \n return count\n end\n\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 total_workload\n @graders.map(&:workload).reduce(:+)\n end", "def path_sum(root, sum)\n return [] unless root\n res = []\n path_sum_helper(root, sum, [], res)\n res\nend", "def progress\n return 100 unless self.deliverables.size > 0\n return 100 if self.budget == 0.0\n \n balance = 0.0\n \n self.deliverables.each do |deliverable|\n balance += deliverable.budget * deliverable.progress\n end\n \n return (balance / self.budget).round\n end", "def total\n return ( @committed + @not_committed )\n end", "def progress; end", "def progress; end", "def progress; end", "def progress; end", "def progress; end", "def update_progress\n progress = 0\n self.weight_histories.each do |w|\n progress += w.weight_recording\n end\n self.update(progress: progress)\n end", "def path_sum(root, sum)\n return [] if root.nil?\n result = []\n helper(root, sum, result)\n result\nend", "def calculate\n # Percentage of understanding is calculated by following\n self.progress_rate = ((sum_of_point.to_f / total_count.to_f) * 100.00).round(2)\n end", "def branchSums(root)\n sums = []\n calculate_branch_sums(root, 0, sums)\n return sums\nend", "def printSubtreeTotalTime(brickName=\"root\", indent=0, timeBegin=0, timeEnd=0, tasks=false)\n traverse_preorder(brickName, indent) {|brick, depth|\n timeInSecs = brickTotalTimeAggregate(brick['brick'], timeBegin, timeEnd)\n unless(timeInSecs == 0)\n timeDiffPretty = TimeUtils.timeDiffPretty(timeInSecs)\n print \" \" * depth, \"#{brick['brick']}: [#{timeDiffPretty}] [#{timeInSecs/60/@@pomo_duration}]\\n\" \n if(tasks)\n brick['timeWorked'].each{ |tr|\n if(tr.inRange(timeBegin,timeEnd)) \n print \" \" * (depth+1), tr, \"\\n\"\n end\n }\n end\n end\n }\n end", "def total_reward(start_date = nil, end_date = nil)\n # select rep_parent if it exists\n node = self.get_rep_parent\n \n # recusivly count children\n child_count = 0\n node.children.each do |child|\n child_count = child_count + child.total_reward(start_date, end_date)\n end\n\n # if no week requirement then count number of weeks \n if node.is_infinite? and !start_date.nil? and !end_date.nil?\n weeks = ((end_date - start_date)/7).to_i\n return ((weeks * node.reward) + child_count)\n else\n return (node.reward + child_count)\n end\n end", "def progress\n return @procs_queue.size / @initial_size.to_f\n end", "def progress\n total = asset.pieces.count\n downloaded = total - piece_downloads.incomplete.count\n [downloaded, total]\n end", "def total_payout\n # make sure we have rep_parent\n node = self\n if !self.rep_parent.nil?\n node = self.rep_parent\n end\n \n # get total payout of children\n child_payout = 0\n node.children.each do |child|\n child_payout = child_payout + child.total_payout\n end\n \n # multiply complete * reward and expired * penalty\n payout = node.repititions.\n where(:state => Activity::COMPLETE).size * node.reward\n payout = payout -\n node.repititions.\n where(:state => Activity::EXPIRED).size *\n node.penalty\n return payout + child_payout\n \n end", "def iterative_sum(arr)\n total = 0\n arr.each {|num| total += num}\n return total\nend", "def sum\n @coverable_files.values.map do |hits|\n CoverageStat.real_percent(hits)\n end.reduce(&:+)\n end", "def running_total(numbers)\n sum = 0\n running_sums = []\n numbers.each_with_object(running_sums) do |number, array|\n sum += number\n array << sum\n end\n \n running_sums\nend", "def calculate_results\n Repository::Config.new(@repo, @log, @process, @type).status(5) {\n files = files_to_analyze\n puts '-----Files to analyze done (Step 1)'\n files = prepare_files_to_rate files\n puts '-----Prepare files to rate done (Step 2)'\n files = count_total_lines files\n puts '-----Count total lines done (Step 3)'\n files = count_errors files\n puts '-----Count errors done (Step 4)'\n files = grade_categories files\n puts '-----Grade categories done (Step 5)'\n files = grade_files files\n puts '-----Grade files done (Step 6)' + files.to_s\n gpa = grade_repo files\n puts '-----Grade repos done (Step 7)' + gpa.to_s\n gpa_percent = get_overall_grades files\n puts '-----Grade overall percentage done (Step 8)' + gpa_percent.to_s\n cat_issues = get_category_issues files\n puts '-----Get categories issues done (Step 9)' + cat_issues.to_s\n store_cat_issues cat_issues\n puts '-----Store category issues done (Step 10)'\n store_grades gpa, gpa_percent\n puts '-----Store grades done (Step 11)'\n }\n end", "def running_total(arr)\n running_total_arr = []\n sum = 0\n arr.each do |num|\n sum += num\n running_total_arr << sum\n end\n running_total_arr\nend", "def score_progress(player,i)\n framesum = @frame_scores[player - 1][i].reduce(:+)\n \n if i >= 2 && @game_scores[player - 1][-2].nil? == true\n update_2prev(player,i)\n end\n\n if i >= 1 && @game_scores[player - 1][-1].nil? == true\n update_prev(player,i,framesum)\n end\n \n if i == 9 \n @game_scores[player - 1] << @game_scores[player - 1][-1] + framesum\n elsif framesum == 10\n @game_scores[player - 1] << nil\n # puts \"line #{__LINE__} - nil for 10 frame\" # this now adding extra nils w/ function separated out...\n elsif i == 0\n @game_scores[player - 1] << framesum\n # puts \"line #{__LINE__} - first frame != 10\"\n else \n @game_scores[player - 1] << @game_scores[player - 1][i - 1] + framesum\n # puts \"line #{__LINE__} regular addition for frame>=2\"\n end\n print @game_scores[player - 1][i].to_s.rjust(6)\n print \" \", @frame_scores[player - 1][i].inspect.ljust(12)\nend", "def UpdateTotalProgressValue\n total_progress = 0\n\n if @total_count_to_download == 0\n # no package to download, just use the install size\n total_progress = Ops.divide(\n Ops.multiply(TotalInstalledSize(), 100),\n @total_size_to_install\n )\n else\n # compute the total progress (use both download and installation size)\n total_progress = Ops.add(\n Ops.divide(\n Ops.multiply(@total_count_downloaded, @downloading_pct),\n @total_count_to_download\n ),\n Ops.divide(\n Ops.multiply(\n TotalInstalledSize(),\n Ops.subtract(100, @downloading_pct)\n ),\n @total_size_to_install\n )\n )\n end\n\n Builtins.y2debug(\n \"Total package installation progress: %1%%\",\n total_progress\n )\n SlideShow.StageProgress(total_progress, nil)\n\n nil\n end", "def running_total(numbers)\n total = 0\n numbers.map { |number| total += number }\nend", "def sum\n reduce(0, &:+)\n end", "def projects_pledges_sum\n if self.projects.length > 0\n # Use map to return an array of project pledges\n project_pledges = self.projects.map do |p|\n p.pledges\n end\n # Flatten the array and then use reduce to return the total sum amount\n project_pledges.flatten!.reduce(0) do |sum, pledge|\n sum + pledge.amount\n end\n else\n 0\n end\n end", "def path_sum(root, sum)\n path_sum_helper([], root, sum)\nend", "def running_total(arr)\n sum = 0\n arr.inject([]) { |running_sum, num| running_sum << sum += num }\nend", "def get_progresses\n if @all_count > 0\n @progress_ch = 100 * @memorized_count_ch / @all_count\n @progress_ja = 100 * @memorized_count_ja / @all_count\n else\n @progress_ch = 0\n @progress_ja = 0\n end\n end", "def score_progress(player,i)\n framesum = @frame_scores[player - 1][i].reduce(:+)\n \n if i >= 2 && @game_scores[player - 1][-2].nil? == true\n update_2prev(player,i)\n end\n\n if i >= 1 && @game_scores[player - 1][-1].nil? == true\n update_prev(player,i,framesum)\n end\n \n if i == 9 \n @game_scores[player - 1] << @game_scores[player - 1][-1] + framesum\n elsif framesum == 10\n @game_scores[player - 1] << nil\n # puts \"line #{__LINE__} - nil for 10 frame\" # this now adding extra nils w/ function separated out...\n elsif i == 0\n @game_scores[player - 1] << framesum\n # puts \"line #{__LINE__} - first frame != 10\"\n else \n @game_scores[player - 1] << @game_scores[player - 1][i - 1] + framesum\n # puts \"line #{__LINE__} regular addition for frame>=2\"\n end\n unless @stats_mode == true\n print @game_scores[player - 1][i].to_s.rjust(6)\n print \" \", @frame_scores[player - 1][i].inspect.ljust(12)\n end\nend", "def current_yield\n sum = 0\n stock_positions.each do |p|\n sum += p.current_yield\n end\n sum\n end", "def recursive_min_sum(head)\n current = head\n current.sum = current.value.to_i\n current.path = [current.value]\n\n unless current.left && current.right\n current.sum = current.value.to_i\n current.path = [current.value]\n current\n else\n left_child = recursive_min_sum(current.left)\n right_child = recursive_min_sum(current.right)\n min_child = left_child.sum < right_child.sum ? left_child : right_child\n current.sum += min_child.sum\n current.path += min_child.path\n current\n end\nend", "def total_payout\n # make sure we have rep_parent\n node = self.get_rep_parent\n \n # get total payout of children\n child_payout = 0\n node.children.each do |child|\n child_payout = child_payout + child.total_payout\n end\n\n # if no week requirement then number reward - penalty\n if node.is_infinite?\n rewards = node.get_weeks_complete\n penalties = node.get_weeks_expired\n return (rewards * node.reward) - (penalties * node.penalty) + child_payout\n end\n\n # if COMPLETE add reward, if EXPIRED subtract penalty\n if node.state == Activity::COMPLETE\n return child_payout + node.reward\n elsif node.state ==Activity::EXPIRED\n reuturn child_payout - node.penalty\n else\n return child_payout\n end\n end", "def children_sumtrees\n children.each_with_object({}) do |child, sum|\n sum[child.name] = child.total_weight\n end\n end", "def compute1_sum\n target_value = total_value/3\n souvenirs.each_with_index do |val, idx|\n sum(idx) do |arr, i|\n arr[i] = val\n \n # return early if any single element exceeds the target value\n return :stop if val > target_value\n print \"good sum found idx=#{idx}, i=#{i}\" if val == target_value\n @good_sums << i+1 if val == target_value\n end\n end\n end", "def steps\n return @steps if @steps\n\n @filesizes = {}.with_indifferent_access\n\n # Get info from `rclone size` (will not work on Google Drive and Google Photos)\n total_size = files.keys.map do |file|\n size = RcloneUtil.size(src_remote, file).fetch('bytes', 0)\n @filesizes[file] = { :size => size, :transferred => 0 }\n size\n end.sum\n\n @steps = total_size\n end", "def total\n @state[0]*VALUES[0] + @state[1]*VALUES[1] + @state[2]*VALUES[2] + @state[3]*VALUES[3] + @state[4]*VALUES[4]\n end", "def running_total arr\n totals = []\n sum = 0\n arr.each do |elm|\n sum += elm\n totals << sum\n end\n totals\nend", "def resources_cost_from_children\n\t\tif !has_children?\n\t\t\tresources_cost\n\t\telse\n\t\t\tsuma = 0\n\t\t\tchildren.each do |c|\n\t\t\t\tsuma += c.resources_cost_from_children\n\t\t\tend\n\n\t\t\treturn suma \n\t\tend\n\tend", "def charged_so_far\n charges = stages.collect{ |pr| pr.charged_so_far }.sum\n invoices.collect{ |inv| inv.total }.sum + charges\n end", "def total_number_basic_tasks\n total=0\n @sub_tasks.each { |task| total += task.total_number_basic_tasks }\n total \n end", "def running_total(numbers)\n numbers.each.with_index do |num, i|\n if i != 0\n numbers[i] += numbers[i - 1]\n end\n end\n numbers\nend", "def running_total(arr)\n res = []\n running_total = 0\n\n arr.each do |element|\n running_total += element\n res << running_total\n end\n\n res\nend", "def sum_of_point\n # Calculating point of each block\n calculate_points\n # Sum\n rubbish_count + not_clear_count + somewhat_count + understand_count\n end", "def computeCompletionTimes(schedule)\n completionTime = 0\n completionTimesSum = 0\n schedule.each do |job|\n completionTime = completionTime + job[\"length\"]\n completionTimesSum = completionTimesSum + job[\"weight\"] * completionTime\n end\n\n puts completionTimesSum\nend", "def running_total(arr)\n results = []\n total = 0\n arr.each do |el|\n total += el\n results << total\n total = total\n end\n results\nend", "def total\n synchronize do\n (@bars - [@top_bar]).map(&:total).compact.reduce(&:+)\n end\n end", "def sum_recursive(num)\n # can also compute sum with symbol (1..5).inject(:+)\n (1..num).inject { |sum, n| sum + n }\nend", "def sum_of_sums(numbers)\n sum_total = 0\n accumulator = 0\n\n numbers.each do |num|\n accumulator += num\n sum_total += accumulator\n end\n sum_total\nend", "def running_total(array)\n sum = 0\n running_total = []\n\n array.each do |element|\n sum += element\n running_total << sum\n end\n\n running_total\nend", "def get_build_progress\n total = get_total_pages\n complete = get_page_count('success')\n progress = (complete.to_f / total.to_f) * 100\n\n progress.ceil\n end", "def sum\n [@r,@g,@b].inject(:+)\n end", "def slow_total_check_amount\r\n total_chk_amount = 0\r\n self.jobs.each do |job|\r\n check_amount = 0\r\n if job.parent_job_id.blank?\r\n check_amount = CheckInformation.find_by_job_id(job.id).check_amount if CheckInformation.find_by_job_id(job.id)\r\n end\r\n total_chk_amount += check_amount.to_f\r\n end\r\n return total_chk_amount\r\n end", "def total_output\n @outputs.inject(:+)\n end", "def tasks_total_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_total_count\n end\n end", "def tasks_total_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_total_count\n end\n end", "def sum_of_sums(numbers)\n sum_total = 0\n accumulator = 0\n\n numbers.each do |num|\n accumulator += num\n sum_total += accumulator\n end\n\n sum_total\nend", "def sum_of_sums(numbers)\n sum_total = 0\n accumulator = 0\n\n numbers.each do |num|\n accumulator += num\n sum_total += accumulator\n end\n\n sum_total\nend", "def running_total(arr)\n sum = 0\n arr.map { |ele| sum += ele }\nend", "def running_total(array)\n result = []\n\n array.inject(0) do |sum, num|\n result << sum += num\n sum # have to return sum\n end\n result\nend", "def running_total3(array)\n sum = 0\n array.map do |num|\n sum = [sum, num].inject(:+)\n end\nend", "def running_total(array)\n # new_array = []\n sum = 0\n array.inject([]) do |arr, val| \n sum += val\n arr << sum \n arr\n end\nend", "def sum(num, total) => total += num", "def running_total(array)\n sum = 0\n array.each_with_object([]) do |el, new_array|\n new_array << sum += el\n end\nend", "def running_total(arr)\n total_sum = 0\n arr.map { |elem| total_sum += elem }\nend", "def calculate_total_money_spent\n return @trips.inject(0.0) { |sum, trip|\n trip.is_in_progress? ? sum + 0 : sum + trip.cost }\n end", "def total\n roll_all.reduce(&:+)\n end", "def sum; end", "def real_progress\n\t\tif resources_type == 0\n\t\t\treal_progress_function(Date.today, false)\n\t\telse\n\t\t\treal_progress_function(Date.today, true)\n\t\tend\n\tend", "def get_sum_frame()\n sum = 0\n @frames.each do |frame|\n if !frame.score.nil?\n sum += frame.score\n end\n end\n sum\n end", "def progress(status)\n #For each SUT\n $sut.each do |ip, sut|\n #We check the status that we determined earlier,\n #depending on it we call the progress functions\n if status[ip]['status'] == 'Autotest'\n autotestprogress(status, sut, ip)\n elsif status[ip]['status'] == 'Stability'\n stabilityprogress(status, sut, ip)\n elsif status[ip]['status'] == 'CanWakeupTest'\n status[ip]['progress'] == 'Not implemented'\n elsif status[ip]['status'] == 'Manual'\n #If the test is manual, we just say it is not implemented yet. Do not know if it ever will,\n #because it is kind of impossible to know where manual test results will be saved.\n status[ip]['progress'] = 'Not implemented'\n elsif status[ip]['status'] == \"Idle\"\n latest = `ls -td #{$autotestpath}#{sut[:name]}*/ | head -n 1`[0...-1]\n latest = `ls -td #{latest}2017*/ | head -n 1`[0...-1]\n failed = `find #{latest} -name *TestRun.txt`[0...-1]\n if failed == '' && latest != ''\n status[ip]['progress'] = \"Last test failed to proceed\"\n status[ip]['progresscolor'] = \"color:red;\"\n else\n #Idle will be shown as empty in progress tab\n status[ip]['progress'] = ' '\n status[ip]['progresscolor'] = \"color:white;\"\n end\n end\n end\nend", "def total_reward(start_date = nil, end_date = nil)\n # select rep_parent if it exists\n node = self\n if !self.rep_parent.nil?\n node = self.rep_parent\n end\n \n # recusivly count children\n child_count = 0\n node.children.each do |child|\n child_count = child_count + child.total_reward(start_date, end_date)\n end\n\n # select correct reps\n the_reps = nil\n if start_date.nil? or end_date.nil?\n the_reps = node.repititions\n else\n the_reps = node.repititions.\n where(\"show_date >= ? AND show_date <= ?\",\n start_date, end_date)\n end\n\n # return size * reward value\n return (the_reps.size * node.reward) + child_count\n end", "def inc_progress(activity_rank)\n #diff = (@rank - activity_rank).abs\n ranks = [-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8]\n true_diff = ranks.index(activity_rank) - ranks.index(@rank)\n if true_diff < 0\n if true_diff <= -2\n nil\n else\n @progress += 1\n end\n elsif true_diff == 0\n @progress += 3\n else\n @progress += (10*true_diff*true_diff)\n end\n while @progress >= 100\n self.increase_rank\n @progress -= 100\n end\n end", "def tasks_successful_count\n inject(0) do |sum, node|\n sum + node.graph.tasks_successful_count\n end\n end" ]
[ "0.63465625", "0.6313772", "0.60800815", "0.59225166", "0.5892643", "0.58419204", "0.58003575", "0.5786772", "0.573414", "0.571871", "0.56841034", "0.5656823", "0.5632879", "0.5626318", "0.5598514", "0.55951947", "0.55880904", "0.554049", "0.553995", "0.5534106", "0.55208325", "0.548089", "0.5480461", "0.5480435", "0.5470321", "0.546316", "0.5441897", "0.54314595", "0.541813", "0.541813", "0.541813", "0.541813", "0.541813", "0.54080254", "0.5406045", "0.5405934", "0.5400951", "0.5391699", "0.5391441", "0.5384188", "0.5379721", "0.5379414", "0.5347698", "0.534268", "0.5336782", "0.53105634", "0.5296721", "0.5296522", "0.52951014", "0.52682936", "0.5260392", "0.52514493", "0.52485096", "0.5240161", "0.5236197", "0.5224178", "0.5210555", "0.52074534", "0.5206765", "0.5202677", "0.5201227", "0.5200194", "0.5194164", "0.5186262", "0.51849484", "0.51822454", "0.5177265", "0.5175972", "0.5170248", "0.51660824", "0.5158846", "0.515449", "0.5151027", "0.5149039", "0.51458675", "0.5140838", "0.5135939", "0.51348156", "0.5134077", "0.5133847", "0.5131002", "0.5131002", "0.5125349", "0.5125349", "0.51220083", "0.5118686", "0.511299", "0.51030487", "0.5102223", "0.51014566", "0.5093875", "0.5093137", "0.50898665", "0.50885916", "0.50882065", "0.5087567", "0.50842345", "0.5083958", "0.5079495", "0.5075599" ]
0.78042305
0
Recursively finds the supermaster project.
def super_master master ? master.super_master : self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_project(workspace, name)\r\n project = nil\r\n if ( name != \"Parent\")\r\n project = workspace.projects.find { |p| p.name == name && p.state == \"Open\" }\r\n if project == nil\r\n print \"Project \", name, \" not found\\n\"\r\n end\r\n end\r\n project\r\nend", "def __detect_project_home__(path, li = '.lithium')\n path = File.expand_path(path)\n prev_path = nil\n while path && prev_path != path\n marker = File.join(path, li)\n break if File.directory?(marker) && File.exists?(marker)\n prev_path = path\n path = File.dirname(path)\n end\n return path != prev_path ? path : nil\nend", "def find_project(user_path)\n user_path = user_path.to_s\n Pathname.new(Dir.pwd).ascend do |v|\n return nil if v.to_s == user_path || user_path.start_with?(v.to_s)\n config_path = v + CONFIG_DIR\n return v if config_path.directory?\n end\n nil\n end", "def root_project\n self.projects.first.root\n end", "def project_root=(_arg0); end", "def find_source_root(path = Dir.pwd)\n parent = File.dirname(path)\n if parent != path && root = find_source_root(parent)\n return root\n end\n cmakelists = File.join(path, \"CMakeLists.txt\")\n return path if File.exist?(cmakelists)\nend", "def find_repository_and_basepath\n # zuerst lesen wir den Startpfad aus der Datei ein\n unless File.exists?(PATH_TMP_FILE) and (@basepath=IO.read(PATH_TMP_FILE).strip)\n NSRunInformationalAlertPanel('Invalid start directory!',\n \"No directory information could be found in the configuration file '#{PATH_TMP_FILE}'!\",\n 'OK',nil,nil)\n NSApp.stop(self)\n end\n\n # jetzt gehen wir max. 5 Ebenen nach oben und suchen\n # nach einem Rakefile im Verzeichnis\n path=@basepath\n (0..5).each do |step|\n Dir.entries(path).each do |entry|\n return path if entry=~/^(.git|.hg)$/\n end\n path+=\"/..\"\n end\n\n # no reasonable rakefile was found, let's just use\n # the current directory for the files\n @basepath # Dir.pwd\n end", "def just_find_it(here=Pathname.pwd)\n mainfile = here + MAINFILE\n return mainfile if mainfile.exist?\n return nil if here == here.parent\n return just_find_it(here.parent)\nend", "def inside_project?\n project_found = false\n cwd = Pathname(Dir.pwd)\n home_directory = File.expand_path('~')\n cwd.ascend do |current_path|\n project_found = File.file?(\"#{current_path.to_s}/.bebox\")\n self.project_root = current_path.to_s if project_found\n break if project_found || (current_path.to_s == home_directory)\n end\n project_found\n end", "def reachable_projects\n path.ascend.find_all{ |p| p.directory? }.flat_map do |dir|\n dir.children.select{ |p| p.extname == '.xcodeproj' }\n end\n end", "def find_active_project\n if @textmate.documents.first\n active_path = @textmate.documents.first.path\n @projects.find {|p| active_path =~ /^#{p.path}/}\n end\n end", "def reachable_projects\n path.ascend.find_all { |p| p.exist? && p.directory? }.flat_map do |dir|\n dir.children.select { |p| p.extname == '.xcodeproj' }\n end\n end", "def lookup_project\n puts \"Looking for Xcode project...\"\n # list all .xcodeproj files except Pods\n projects_list = Dir.entries(\".\").select { |f| (f.end_with? \".xcodeproj\") && (f != \"Pods.xcodeproj\") }\n projects_list.empty? ? nil : projects_list.first\nend", "def search_top\n Dir.chdir(\".\")\n while File.exist?(\"#{Dir.pwd}/#{@target_app}.#{@@suffix}\")\n @top_dir = Dir.pwd.to_s\n Dir.chdir('..')\n end\n end", "def getRootProjectsFromList(parentProject)\r\n\t\trootProjects = parentProject - getChildProjects(parentProject)\r\n\tend", "def project_root; end", "def project_root; end", "def my_projects\n # Look at all the project\n # see which project's creator is equal to self\n Project.all.select do |project|\n project.creator == self\n end\n end", "def my_projects\n # Look at all the project\n # see which project's creator is equal to self\n Project.all.select do |project|\n project.creator == self\n end\n end", "def find_dotjam path=FileUtils.pwd\n curr=File.join(path,'.jam')\n if File.directory?(curr)\n curr\n else\n up=File.join(path,'..')\n if File.directory? up\n find_dotjam up\n else\n nil\n end\n end\n end", "def ancestor_projects\n node, nodes = self, []\n nodes << node = node.root while node.root\n nodes\n end", "def find_all_parents\n end", "def sync_available_sibling_repos(hostname, remote_repo_parent_dir=\"/root\", ssh_user=\"root\")\n working_dirs = ''\n clone_commands = ''\n SIBLING_REPOS.each do |repo_name, repo_dirs|\n repo_dirs.each do |repo_dir|\n if sync_sibling_repo(repo_name, repo_dir, hostname, remote_repo_parent_dir, ssh_user)\n working_dirs += \"#{repo_name}-working \"\n clone_commands += \"git clone #{repo_name} #{repo_name}-working; \"\n break # just need the first repo found\n end\n end\n end\n return clone_commands, working_dirs\n end", "def git_root_till_home\n Pathname.new(Dir.pwd).ascend do |dir_pathname|\n return dir_pathname if File.directory?(\"#{dir_pathname}/.git\")\n return nil if dir_pathname.to_s == home_dir\n end\n end", "def root_level\n self.find\n end", "def find_root_from(start)\n check = File.expand_path(start)\n ret = nil\n while ret.nil?\n # See if any of these files exist\n self.class.config_filenames.each do |config_name|\n config_file = File.join(check, config_name)\n ret ||= [check, config_file] if File.exists? config_file\n end\n\n # Traverse back (die if we reach the root)\n old_check = check\n check = File.expand_path(File.join(check, '..'))\n raise NoRootError if check == old_check\n end\n ret\n end", "def find_git_root(path)\n\n git_path = nil\n path = Pathname.new(path)\n while( path && !git_path ) do\n current_path = File.join(path,\".git\")\n if File.directory? current_path\n git_path = path\n end\n path = path.parent\n end\n\n return git_path\n end", "def siteroot\n \"/var/www/gforge-projects\"\n end", "def discover_projects!\n self.discover_projects.each(&:save!)\n end", "def discover_current_site_with_root\n site_from_root || discover_current_site_without_root\n end", "def find_selected #:nodoc:\n ret = DcBigMenu.find( @parent.page.menu_id ) if @parent.page.menu_id\n while ret and ret.parent != nil\n ret = DcBigMenu.find( ret.parent )\n end\n# return first if not found (something is wrong)\n# p ret\n ret ||= DcBigMenu.where(dc_site_id: @site._id, parent: nil, active: true).limit(1).first\nend", "def find_root(info_files)\n # Try source file(s) covered by the lcov tracefile(s).\n root_dirs = Hash.new(0)\n info_files.each do |file|\n File.open(file).each do |line|\n line.match(/^SF:(.*)$/) do |match|\n Dir.chdir(File.dirname(match[1])) do\n root_dir = `\"#{@options[:git]}\" rev-parse --show-toplevel`.rstrip\n root_dirs[root_dir] = root_dirs[root_dir] + 1 unless root_dir.empty?\n end if Dir.exist?(File.dirname(match[1]))\n end\n end\n end\n\n if root_dirs.empty?\n nil\n elsif root_dirs.size == 1\n root_dirs.shift[0]\n else\n root_dir = root_dirs.max_by { |key, value| value }[0]\n @log.warn \"Found multiple possible repo roots; settled on: #{root_dir}\"\n root_dir\n end\n end", "def relative_working_dir\n invoke(:rev_parse, '--show-prefix')\n end", "def lookup_root\n pwd = File.expand_path(Dir.pwd)\n home = File.expand_path('~')\n while pwd != '/' && pwd != home\n return pwd if ROOT_INDICATORS.any?{ |r| File.exist?(File.join(pwd, r)) }\n pwd = File.dirname(pwd)\n end\n return nil\n end", "def project_root()\n return @project_root_path if @project_root_path\n \n @project_root_path = Common::find_root_of(\"tiapp.xml\", Common::project_path)\n end", "def locate_root(dir=Dir.pwd)\n dir = File.expand_path(dir)\n home = File.expand_path('~')\n while dir != home && dir != '/'\n return dir if Dir[File.join(dir, '{.git,.hg,.index,.gemspec,*.gemspec}')].first\n dir = File.dirname(dir)\n end\n while dir != home && dir != '/'\n return dir if Dir[File.join(dir, '{lib/}')].first\n dir = File.dirname(dir)\n end\n nil\n end", "def top_level\n git.git_dir.chomp(GIT_DIR)\n end", "def project_hierarchy?(project)\n return -2 if project.nil?\n return 3 if is_superuser\n return 2 if project.manager == self\n project_team_member = team_members.select{|t| t.team == project.team}.first\n return -1 if project_team_member.nil?\n return 1 if project_team_member.is_admin\n return 0\n end", "def projects ; end", "def project_root\n this_file_path.ascend do |p|\n rakefile = p.join( 'Rakefile' )\n return p if rakefile.exist?\n end\n end", "def top_level_files\n program_files.where parent_id: 0\n end", "def getRootProjects(projectsLists)\r\n\t\trootProjects = projectsLists - getChildProjects(projectsLists)\r\n\tend", "def forks\n project.source.forks\n end", "def find_files\n find_files_recursive(@build_result_dir, '')\n end", "def find_existing_sca_projects(school)\n self.sca_projects.find {|sca_projects| sca_projects[:uid] == school[:uid]}\n end", "def repo_root; end", "def find_projects\n #binding.pry\n ProjectBacker.all.select do |element|\n element.backer == self\n end\n end", "def find_root(path)\n path = File.expand_path('..', path) if root?(path) == false\n find_root(path) if root?(path) == false\n return path if root?(path) == true\n end", "def parent_of( page )\n dir = page.directory\n\n loop do\n if @db.has_key? dir\n parent = @db[dir].find {|p| p.filename == 'index'}\n return parent unless parent.nil? or parent == page\n end\n\n break if dir.empty?\n dir = ::File.dirname(dir)\n dir = '' if dir == '.'\n end\n\n return\n end", "def recursive => nil", "def project_root\n @project_root ||= find_project_root\n end", "def project_root\n @project_root ||= find_project_root\n end", "def project_root\n File.expand_path(\"#{__dir__}/..\")\n end", "def fork_master\n defined?(@@fork_master) ? @@fork_master : nil\n end", "def show_master\n end", "def find(dirs); end", "def each_project(&block)\n depth_first = lambda do |p|\n p.projects.each { |c| depth_first.call(c, &block) }\n block.call(p)\n end\n depth_first.call(@project)\n end", "def search_project_paths(word)\n\t\n\t# Collect all .as and .mxml files with a filename that contains the search\n\t# term. When used outside a project this step is skipped.\n\tTextMate.each_text_file do |file|\n\t\t\n\t\tif file =~ /\\b#{word}\\w*\\.(as|mxml)$/\n\t\t\t\n\t\t\tpath = file.sub( $project, \"\" );\n\t\t\t\n\t\t\tcommon_src_dirs.each do |remove|\n\t\t\t\tpath = path.gsub( /^.*\\b#{remove}\\b\\//, '' );\n\t\t\tend\n\n\t\t\tpath = path.gsub(/\\.(as|mxml)$/,'').gsub( \"/\", \".\").sub(/^\\./,'')\n\n\t\t\tif path =~ /\\.#{word}$/\n\t\t\t\t$best_paths << path\n\t\t\telse\n\t\t\t\t$package_paths << path\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\tend\n\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend", "def projects\n if is_deploy_key\n [project]\n else\n user.projects\n end\n end", "def top_level\n git.git_dir.chomp(GIT_DIR)\n end", "def projects\n Project.all.select { |project| project.creator == self }\n end", "def cross_project\n []\n end", "def match_root_folder(path)\n SETTINGS.each_key do |key|\n return SETTINGS[key] if path.index(SETTINGS[key]['path'])\n end\n return nil\nend", "def find_project!\n find_project\n rescue Polymer::MissingProject\n say Polymer.compress_lines(<<-ERROR), :red\n Couldn't find a Polymer project in the current directory, or any of\n the parent directories. Run \"polymer init\" if you want to create a new\n project here.\n ERROR\n exit 1\n end", "def check_core\n @project = 'drupal' if @project =~ /^core|drupal$/\n end", "def root(reload=false)\n ancestors(reload).first\n end", "def needs_project_scoping?(data)\n repository_depth(data) == 1\n end", "def projects\n return [] unless basecamp\n @projects ||= basecamp.projects\n end", "def find_in(dir); end", "def find_by_path(path, flags={})\n if parseit = path.match(/^.*?(([^\\/]+)\\/)?([^\\/]+?)(\\.git)?$/)\n if proj = Project.find_by_identifier(parseit[3]) || !GitHosting.multi_repos?\n # return default or first repo with blank identifier (or first Git repo--very rare?)\n proj && (proj.repository || proj.repo_blank_ident || proj.gitolite_repos.first)\n elsif repo_ident_unique? || flags[:loose] && parseit[2].nil?\n find_by_identifier(parseit[3])\n elsif parseit[2] && proj = Project.find_by_identifier(parseit[2])\n find_by_identifier_and_project_id(parseit[3],proj.id) ||\n flags[:loose] && find_by_identifier(parseit[3]) || nil\n else\n nil\n end\n else\n nil\n end\n end", "def project\n project_obj_files = Dir[\"*.yaml\"]\n unless project_obj_files.empty?\n AimsProject::Project.load(project_obj_files.first)\n else\n raise AimsProject::AimsProjectException.new(\"Sorry, I can't tell what project this is. Please move to the project root directory.\")\n end\nend", "def find_next\n status = `git status -s`.lines.reject(&:nil?).grep(/.. (PCL|tsion|steveklabnik)\\//)\n return nil if status.empty?\n\n first = status.map{|x| x.gsub(/^.. /, '') }.first.strip\n \n if File.directory?(first) \n return [first, [first]]\n else\n name = first.split('/')[-1].split('_', 2)[1]\n end\n\n pcl = find_file('PCL', name)\n tsion = find_file('tsion', name)\n steve = find_file('steveklabnik', name)\n\n [name, [pcl, tsion, steve]]\n end", "def project\n self.projects.first unless projects.empty?\n end", "def find_my_direct_parent\n \t\n \t self.findpapa\n \t directparents = @@directparent.dup\n \t @@directparent.clear\n \t \n \t return directparents\n \t \n end", "def raw_toplevel\n\t\t\twith_dir do\n\t\t\t\treturn Pathname.new(%x/git rev-parse --show-toplevel/.chomp)\n\t\t\tend\n\t\tend", "def homepage\n @homepage ||= Page.find_by_parent_id(nil)\n end", "def find_projects\n @projects = Project.all\n end", "def getProjectFromPath(path)\n folders = path.split('/')\n return folders[folders.index(\"refs\") - 1]\nend", "def locate_middleman_root!(cwd = Pathname.new(Dir.pwd))\n return cwd.to_s if File.exists?(File.join(cwd, 'config.rb'))\n return false if cwd.root?\n locate_middleman_root!(cwd.parent)\nend", "def setup_projects(api_client)\n\n options = Proc.new{|folder_id| \n {\n 'q' => \"'#{folder_id}' in parents\",\n 'fields' => 'items(alternateLink,id,kind,title,webViewLink)'\n }\n }\n\n # TODO: dry it up\n projects = api_client.request('files.list', options.call(self.root_folder_id))\n projects_array = []\n # For each project, grab sections\n projects.items.each do |project|\n project_json = {\n id: project.id,\n title: project.title,\n url: project.alternate_link,\n web_url: project.web_view_link, \n sections: []\n }\n\n # For each section, grab files\n sections = api_client.request('files.list', options.call(project.id))\n sections.items.each do |section|\n section_json = {\n id: section.id,\n title: section.title,\n url: section.alternate_link,\n web_url: section.web_view_link,\n files: []\n }\n files = api_client.request('files.list', options.call(section.id))\n files.items.each do |file|\n file_json = {\n id: file.id,\n title: file.title,\n web_url: file.web_view_link, \n url: file.alternate_link\n }\n section_json[:files] << file_json\n end\n project_json[:sections] << section_json\n end\n projects_array << project_json\n end\n\n Rails.cache.write(keyring(:projects), projects_array.to_json)\n\n end", "def repo_named(full_name)\n pry(Git::Multi.repositories.find { |repo| repo.full_name == full_name })\nend", "def determine_common_folder\n POSSIBLE_COMMON_CORE_FOLDERS.each do |folder|\n path = File.join(File.dirname(__FILE__),'..','..',folder)\n return folder if File.directory?(path)\n end\n\n return nil\nend", "def project; end", "def getFirstVersion(template)\n\n parent = template\n\n until parent.parent.nil?\n parent_tmp = Template.where(\"id = ?\",parent.parent)\n if ! parent_tmp.nil?\n parent=parent_tmp\n else\n return parent\n end\n end\n\n return parent\n\n end", "def manage_all_projects\n projects= [ \n [\"barjob\", \"[email protected]/foo/bar.git\"],\n [\"quxjob\", \"[email protected]/baz/qux.git\"],\n ]\n projects.each do |project_name, git_repo|\n manage_dynamic_branches_for_project(project_name, git_repo)\n end\nend", "def master!\n @master = true\n end", "def myproject\n myproject = @current_profile.owned_project\n end", "def getChildProject(parentProject)\r\n\t\tchildProjects = []\r\n\t\[email protected] do |project|\r\n\t\t\tif (project.is_descendant_of?(parentProject))\r\n\t\t\t\tif (User.current.member_of?(project))\r\n\t\t\t\t\tchildProjects = childProjects << project\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\t\t\r\n\t\treturn childProjects\r\n\tend", "def find_for_site(objects, site)\n #TODO *** IS THERE A BETTER WAY TO IMPLEMENT THIS??? ***\n\n site_objects = []\n objects.each do |o|\n site_objects << o if o.root.site == site\n end\n site_objects\n end", "def no_user_get_friends_projects(token)\n @token = token\n @users = get_my_friends(token)\n @projects = []\n @users.each do |u|\n proj = u.projects.approved\n if proj.any?\n proj.each {|p| @projects << p }\n end\n end\n return @projects\n end", "def backed_projects\n\n # iterate thru existing list of projects and backers to pull just our current\n # instanced backer (self)\n projects_backed = ProjectBacker.all.select do |backed|\n backed.backer == self\n end \n # iterate thru array of projects backed by current user and remove user info\n # while returning an array of just project titles\n projects_backed.map do |projects_b|\n projects_b.project \n end \n end", "def fetchUntestedProjects \r\n @logger.debug \"search untested projects: #{@workspaceFolder}\"\r\n\t\tprojectFolders = FileList.new(@workspaceFolder+\"/*/\")\r\n\t\tprojectFolders.exclude(@workspaceFolder+\"/.*/\") # no meta-data\t\t\r\n\t\tprojectFolders.each do |projectFolder|\r\n\t\t\tsourceFiles = FileList.new(projectFolder+\"/**/*.{h,hpp,c,cpp}\")\r\n\t\t\tif sourceFiles.size() > 0 then\r\n\t\t\t\r\n\t\t\t\tprojectPath = Pathname.new(projectFolder).cleanpath.to_s\r\n\t\t\t\tif @testedProjects.find{ |item| item.projectFolder.eql?(projectPath) } == nil then\r\n @logger.debug \"=> untested project: #{File.basename(projectPath)}\" \r\n\t\t\t\t\t@untestedProjects << projectPath\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def beginning_of_chain\n nested? ? super : active_scaffold_config.model.roots\n end", "def beginning_of_chain\n nested? ? super : active_scaffold_config.model.roots\n end", "def tree(treeish=nil, paths = [])\n begin \n if staging? && (not treeish)\n @staging_index.sync\n super(@staging_index.current_tree.id, paths)\n else\n treeish = @current_branch if not treeish\n super\n end\n rescue Grit::GitRuby::Repository::NoSuchPath\n \n end\n end", "def get_root\n @logger.debug \"GET #{@jenkins_path}/\"\n request = Net::HTTP::Get.new(\"#{@jenkins_path}/\")\n make_http_request(request)\n end", "def recursive_search(args)\n name = args.shift\n cmd = find { |c| c.name == name }\n return cmd, args unless cmd&.parent? && cmd.children.find { |c| c.name == args[0] }\n\n # the command exists &&\n # the command has sub command &&\n # argument matches sub command name\n # -> should search more\n cmd.children.recursive_search(args)\n end", "def find_recur_target\n @parent.find_recur_target\n end", "def root\n acts_as_nested_set_options[:class].find(:first, :conditions => \"(#{acts_as_nested_set_options[:parent_column]} IS NULL OR #{acts_as_nested_set_options[:parent_column]} = 0)\")\n end", "def ensure_repo(user, repo, recursive = false)\n\n repos = db[:projects]\n curuser = ensure_user(user, false, false)\n\n if curuser.nil?\n warn \"Could not find user #{user}\"\n return\n end\n\n currepo = repos.first(:owner_id => curuser[:id], :name => repo)\n\n unless currepo.nil?\n debug \"Repo #{user}/#{repo} exists\"\n return refresh_repo(user, repo, currepo)\n end\n\n r = retrieve_repo(user, repo, true)\n\n if r.nil?\n warn \"Could not retrieve repo #{user}/#{repo}\"\n return\n end\n\n if r['owner']['login'] != curuser[:login]\n info \"Repo changed owner from #{curuser[:login]} to #{r['owner']['login']}\"\n curuser = ensure_user(r['owner']['login'], false, false)\n end\n\n repos.insert(:url => r['url'],\n :owner_id => curuser[:id],\n :name => r['name'],\n :description => unless r['description'].nil? then r['description'][0..254] else nil end,\n :language => r['language'],\n :created_at => date(r['created_at']),\n :updated_at => date(Time.now),\n :etag => unless r['etag'].nil? then r['etag'] end)\n\n unless r['parent'].nil?\n parent_owner = r['parent']['owner']['login']\n parent_repo = r['parent']['name']\n\n parent = ensure_repo(parent_owner, parent_repo)\n\n if parent.nil?\n warn \"Could not find repo #{parent_owner}/#{parent_repo}, parent of: #{user}/#{repo}\"\n repos.filter(:owner_id => curuser[:id], :name => repo).update(:forked_from => -1)\n else\n repos.filter(:owner_id => curuser[:id], :name => repo).update(:forked_from => parent[:id])\n info \"Repo #{user}/#{repo} is a fork of #{parent_owner}/#{parent_repo}\"\n\n unless ensure_fork_point(user, repo).nil?\n warn \"Could not find fork point for #{user}/#{repo}, fork of #{parent_owner}/#{parent_repo}\"\n end\n end\n end\n\n if recursive and not ensure_repo_recursive(user, repo)\n warn \"Could retrieve #{user}/#{repo} recursively\"\n return nil\n end\n\n info \"Added repo #{user}/#{repo}\"\n return repos.first(:owner_id => curuser[:id], :name => repo)\n end" ]
[ "0.59155834", "0.5777824", "0.57755107", "0.5730275", "0.5728772", "0.56676817", "0.5638677", "0.560586", "0.5597221", "0.5588946", "0.5582604", "0.55790144", "0.5571555", "0.55663955", "0.5471594", "0.545317", "0.545317", "0.54037887", "0.53980625", "0.5361248", "0.5325613", "0.5271869", "0.5262199", "0.52310264", "0.51833683", "0.5183273", "0.5168538", "0.51677823", "0.5155334", "0.515399", "0.51401687", "0.51118827", "0.51050115", "0.51014644", "0.5099781", "0.5097955", "0.5084138", "0.507926", "0.50640833", "0.50631905", "0.50628966", "0.5055832", "0.50506467", "0.5050133", "0.50458443", "0.50433815", "0.5039667", "0.50392085", "0.5006628", "0.49969944", "0.49950996", "0.49950996", "0.49922726", "0.49884653", "0.49715096", "0.4970593", "0.49637964", "0.49637064", "0.49626878", "0.49599037", "0.49575722", "0.49561685", "0.49119517", "0.49075174", "0.49066833", "0.49028558", "0.4896185", "0.48920855", "0.48824206", "0.48809522", "0.48753002", "0.48747033", "0.48727155", "0.4871038", "0.4864387", "0.48595685", "0.48546648", "0.4853437", "0.48440418", "0.48438165", "0.4839123", "0.48384017", "0.48361462", "0.48327506", "0.48230338", "0.4820406", "0.48190552", "0.4816208", "0.48074657", "0.4801726", "0.480099", "0.47984982", "0.4790444", "0.4790444", "0.47902387", "0.4788573", "0.47859716", "0.4785814", "0.47753355", "0.47721437" ]
0.59309846
0
Recursively sums up all invoices from the project and its stages.
def charged_so_far charges = stages.collect{ |pr| pr.charged_so_far }.sum invoices.collect{ |inv| inv.total }.sum + charges end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_invoice_amount(start_date, end_date)\n total = 0\n projects.each do |project|\n total += project.invoices.where(due_on_date: start_date...end_date).map(&:total_amount_inc_vat).sum\n end\n total\n end", "def calculate_invoice_total\n res = [ ]\n self.line_items.each do |item|\n res.push(item.qty * item.price)\n end\n # Return the sum of the items\n self.total = res.inject(:+) \n end", "def invoice_total\n self.invoices.sum(:total).to_f\n end", "def invoice_total\n self.invoices.sum(:total).to_f\n end", "def generate_total_billing\n total = 0\n self.ur_invoices.each do |ur_invoice|\n total += ur_invoice.final_total\n end\n\n self.invoice_items.each do |invoice_item|\n total += invoice_item.charges\n end\n\n total\n end", "def invoice_totals_by_merchant(id, invoices, hash)\n hash[id] = invoices.inject(0) do |sum, invoice|\n if invoice_paid_in_full?(invoice.id)\n sum += invoice_total(invoice.id)\n else\n sum\n end\n end\n end", "def sum_payments\n contracts.sum{ |c| c.payments.sum(&:amount)}\n end", "def projects_pledges_sum\n if self.projects.length > 0\n # Use map to return an array of project pledges\n project_pledges = self.projects.map do |p|\n p.pledges\n end\n # Flatten the array and then use reduce to return the total sum amount\n project_pledges.flatten!.reduce(0) do |sum, pledge|\n sum + pledge.amount\n end\n else\n 0\n end\n end", "def totals_by_invoice_collection(invoice_ids)\n invoice_ids.map{ |id| invoice_total(id) }\n end", "def calculate_totals\n subtotal_collector = 0\n active_contracts.each do |active_contract|\n subtotal_collector += active_contract.subtotal\n end\n\n self.subtotal = subtotal_collector\n self.tax = subtotal * 0.09\n self.total = subtotal + tax\n save\n end", "def invoices_group \n render json: {\n paid_invoices: Invoice.where(created_at: params[:start_date]..(params[:end_date]), invoice_status_id: 12).count,\n pending_invoices: Invoice.where(created_at: params[:start_date]..(params[:end_date]), invoice_status_id: 11).count,\n billed_amount: Invoice.where(created_at: params[:start_date]..(params[:end_date]), invoice_status_id: 12).map { |x| x.price + x.plan.fees }.reduce(0,:+),\n pending_amount: Invoice.where(created_at: params[:start_date]..(params[:end_date]), invoice_status_id: 11).map { |x| x.price + x.plan.fees }.reduce(0,:+)\n }\n end", "def actual_income\n outgoing_invoices.where(:status => \"deposited\").inject(0) do |mem, invoice|\n mem += invoice.amount\n end # inject invoice\n end", "def successful_invoices_items_by_invoice_collection(invoices)\n invoices.map { |inv| invoice_items_of_successful_transactions(inv.id) }\n end", "def update_totals\n # update_adjustments\n self.payment_total = payments.completed.map(&:amount).sum\n self.item_total = line_items.map(&:amount).sum\n \n self.adjustment_total = adjustments.eligible.map(&:amount).sum\n self.total = item_total + adjustment_total + gift_packaging_total\n end", "def rollup(*tags)\n\t @budget = 0\n\t #roll up sub organization's accounts\n\t @sub.each do |sub|\n\t sub.rollup\n @budget += sub.budget\n end\n \n #roll up this org's accounts\n @accounts.each do |account|\n @budget += account.dollars\n end\n \n @budget += @Account.dollars # phase this out -- kind of represents sum of all accounts\n\tend", "def build_pending_invoices\n next_occurrences.map do |issue_date|\n invoice = self.becomes(Invoice).dup\n \n invoice.period = nil\n invoice.period_type = nil\n invoice.starting_date = nil\n invoice.finishing_date = nil\n invoice.max_occurrences = nil\n\n self.items.each do |item|\n nitem = Item.new(item.attributes)\n nitem.id = nil\n item.taxes.each do |tax|\n nitem.taxes << tax\n end\n invoice.items << nitem\n end\n\n invoice.recurring_invoice = self\n invoice.issue_date = issue_date\n invoice.due_date = invoice.issue_date + days_to_due.days if days_to_due\n invoice.sent_by_email = false\n invoice.meta_attributes = meta_attributes\n\n invoice.items.each do |item|\n item.description.sub! \"$(issue_date)\", invoice.issue_date.strftime('%Y-%m-%d')\n item.description.sub! \"$(issue_date - period)\", (invoice.issue_date - period.send(period_type)).strftime('%Y-%m-%d')\n item.description.sub! \"$(issue_date + period)\", (invoice.issue_date + period.send(period_type)).strftime('%Y-%m-%d')\n end\n\n invoice\n end\n end", "def total_paid\n payments.collect{|i| i.total_amount or i.calculate_total_amount}.sum + credit_notes.collect{|i| i.total_amount or i.calculate_total_amount}.sum\n end", "def total\n total_invoice_items_price(invoice_items)\n end", "def pay_targeted_invoices_first!\n payments.each do |pm|\n if pm.invoice\n @remaining_amounts[pm.invoice.fy_year] ||= Hash.new(0)\n if pm.invoice.canceled?\n @remaining_amounts[pm.invoice.fy_year][pm.invoice.object_type] += pm.amount\n else\n paid_amount = [[pm.amount, pm.invoice.missing_amount].min, 0].max\n pm.invoice.increment!(:paid_amount, paid_amount)\n @remaining_amounts[pm.invoice.fy_year][pm.invoice.object_type] += pm.amount - paid_amount\n end\n else\n @remaining_amount += pm.amount\n end\n end\n end", "def update_totals\n # update_adjustments\n self.payment_total = payments.completed.map(&:amount).sum\n self.item_total = line_items.map(&:amount).sum\n self.adjustment_total = adjustments.eligible.map(&:amount).sum\n self.total = item_total + adjustment_total\n end", "def total_funds\n sum_funds = 0\n self.funding_rounds.each do |funding_round|\n sum_funds += funding_round.investment\n end \n sum_funds\nend", "def sum_children(records, parent, total = 0)\n return 0 if records[parent].nil?\n\n records[parent].each do |child, how_many|\n total += how_many\n total += how_many * sum_children(records, child)\n end\n total\nend", "def find_company_projects_sum\n \t\t# returns a mapping [project name, client info, sum of hours, id]\n \t\tmy_company.projects.map{\n \t\t\t|p|[p.name, p.client, p.entries.reduce(0) do |sum, entry| \n \t\t\t\t\tsum = sum + entry.hours \n \t\t\t\tend, p.id\n \t\t\t]\n \t\t}\n \tend", "def pay_remaining_amounts_to_same_object_type_invoices!\n @remaining_amounts.each do |year, type_amounts|\n type_amounts.each do |object_type, rem_amount|\n invoices.before_or_during_year(year).where(object_type: object_type).each do |invoice|\n if invoice.missing_amount.positive? && rem_amount.positive?\n paid_amount = [rem_amount, invoice.missing_amount].min\n invoice.increment!(:paid_amount, paid_amount)\n rem_amount -= paid_amount\n end\n invoice.reload.close_or_open!\n end\n @remaining_amount += rem_amount\n end\n end\n end", "def total_pay\n total_pay = self.employees.map do |employee|\n employee.pay\n end\n total_pay.inject(:+)\n end", "def total_payments\n total = 0\n payments.each{|payment| total += payment.amount}\n total\n end", "def revenue_total_by_party party, invoiced=nil, document_id=nil\n revenue_subtotal_by_party(party, invoiced, document_id) + revenue_general_tax_by_party(party, invoiced, document_id) + revenue_after_subtotal_by_party(party, invoiced, document_id)\n end", "def calculate_final(stripe_invoice:)\n # Find the VAT invoice item.\n vat_line = stripe_invoice.lines.find { |line| line.metadata[:type] == 'vat' }\n other_lines = stripe_invoice.lines.to_a - [vat_line]\n subtotal = other_lines.map(&:amount).inject(:+)\n total = stripe_invoice.total\n\n # Recalculate discount based on the sum of all lines besides the vat line.\n discount = calculate_discount(subtotal, calculate_vat_rate, total) if stripe_invoice.discount\n\n # we do #to_i here because discount can be nil.\n subtotal_after_discount = subtotal - discount.to_i\n\n # If there is vat and a discount, we need to recalculate VAT and the discount.\n calculation = if vat_line && stripe_invoice.discount\n # Recalculate VAT based on the total after discount\n vat_amount, vat_rate = calculate_vat(subtotal_after_discount).to_a\n\n {\n discount_amount: discount,\n subtotal_after_discount: subtotal_after_discount,\n vat_amount: vat_amount,\n vat_rate: vat_rate\n }\n else\n {\n discount_amount: stripe_invoice.subtotal - stripe_invoice.total,\n subtotal_after_discount: subtotal_after_discount,\n vat_amount: (vat_line && vat_line.amount).to_i,\n vat_rate: (vat_line && vat_line.metadata[:rate]).to_i\n }\n end\n\n calculation.merge! \\\n subtotal: subtotal,\n total: stripe_invoice.total,\n currency: stripe_invoice.currency\n end", "def project_totals(from=7.days.ago, to=Date.today)\n @pt = []\n projects.each do |p|\n hrs = total_project_hours(p.id, from, to)\n @pt << [p.name, hrs] if hrs > 0\n end\n @pt\n end", "def sub_total\n sum = 0\n line_items.each do |line_item|\n sum += line_item.total_price\n end\n sum\n end", "def total_revenue_generation\n items_by_merchant.each do |merchant, items|\n total_revenue = 0\n items.each do |item|\n invoice_items.each do |invoice_item|\n if invoice_item.item_id === item.id\n total_revenue += invoice_item.quantity * invoice_item.unit_price\n end\n end\n end\n merchant.total_revenue = total_revenue\n end\n end", "def update_totals\n # update_adjustments\n self.payment_total = payments.completed.map(&:amount).sum\n \n self.item_total = order_items.map(&:amount).sum\n self.billing_total = order_items.map(&:cost).sum\n self.customer_total = item_total\n self.full_total = order_items.map(&:full).sum\n end", "def total_funds\n #binding.pry\n funding_rounds.map{|fr| fr.investment}.sum\n end", "def subtotals\n x = {}\n charges.each do |r|\n x[r.product_code] ||= 0.to_f\n x[r.product_code] += r.total_cost.to_f\n end\n return x\n end", "def invested(domain)\n get_total_funds = portfolio.map do |startup| \n if startup.domain == domain\n startup.total_funds\n end\n end\n final_fund = get_total_funds.compact\n final_fund.inject{|sum, el| sum + el}\n end", "def totals_pipeline\n Offer.totals_pipeline(self)\n end", "def grand_total\n order_lines.inject(Money.new(0)) { |grand_total, line| grand_total + line.total_price }\n end", "def expense_total_by_party party, invoiced=nil, document_id=nil\n expense_subtotal_by_party(party, invoiced, document_id) + expense_general_tax_by_party(party, invoiced, document_id) + expense_after_subtotal_by_party(party, invoiced, document_id)\n end", "def compute_sum(projects, date)\n \tmyHash=Hash.new\n \tprojects.each do |project|\n \tsnapshots = project.processed_snapshots\n \tsnapshot = first_previous_analysis(date, snapshots)\n \tlist = get_violations_data(snapshot)\n \t#hash_data = get_violations_data(snapshot)\n \tif !list.empty?\n\t \thash_data = JSON.parse(list)\n\t \thash_data.each do |name, violationsList|\t \t\n\t\t \tif myHash.has_key?(name)\n\t\t\t\t\tmyHash[name]=myHash[name].zip(violationsList).map { |x, y| x + y }\n\t\t\t\telse\t\t\t\t\n\t\t\t\t\tmyHash.merge!(Hash[name => violationsList])\n\t\t\t\tend\n\t\t\tend\n\t\tend\n end\n return myHash\n end", "def total_funds\n total = nil\n FundingRound.all.each do |funding|\n funding.startup == self\n total += funding.investment\n end\n end", "def total_funds\n total = 0\n num_funding_rounds.each do |round| \n total += round.investment\n end\n total\n end", "def amount_spent_on(project)\n self.expenses.where(:project_id => project.id).sum(:amount)\n end", "def getTotalValueOfAllFundInvestments(ind, date)\r\n\r\n\tend", "def calculate_total\n sub_total = 0\n\n if size\n sub_total += Config.booths[size][:price]\n end\n\n self.add_ons.each do |add_on|\n sub_total += add_on.total\n end\n sub_total += industries.length * 35000\n sub_total += fees.pluck(:amount).reduce(0, &:+)\n\n self.total = sub_total\n self.balance = total - payments.paid.map(&:amount_paid).reduce(0, &:+)\n self\n end", "def local_sum_exempt_vat\n invoice_lines.joins(:official_fee_type).where(:official_fee_types => {:apply_vat => false}).sum('total_official_fee')\n end", "def total_funds\n investments = self.funding_rounds.map do |funding_round|\n funding_round.investment\n end\n investments.sum\n end", "def revenue_after_subtotal_by_party party, invoiced=nil, document_id=nil\n sub_total = revenue_subtotal_by_party(party)\n accum = Money.new(0)\n\n filter_invoiced(line_items, invoiced, document_id).each do |li|\n if li.after_subtotal\n\n if li.billable_party == party\n accum += li.percentage_of_subtotal ? li.revenue_total_with_percentage(sub_total) : li.revenue_total\n end\n\n if li.payable_party == party\n accum -= li.percentage_of_subtotal ? li.expense_total_with_percentage(sub_total) : li.expense_total\n end\n\n end\n\n end\n accum\n end", "def total_item\n @items.reject {|item| item.quantity == 0}\n invoice_total = @items.sum {|item| item.sale_price * item.quantity}\n\n end", "def path_sum(root, sum)\n return [] unless root\n res = []\n path_sum_helper(root, sum, [], res)\n res\nend", "def revenue_subtotal_by_party party, invoiced=nil, document_id=nil\n sub_total = Money.new(0)\n\n filter_invoiced(line_items, invoiced, document_id).each do |li|\n if !li.after_subtotal\n\n if li.billable_party == party\n sub_total += li.revenue_total\n end\n\n if li.payable_party == party\n sub_total -= li.expense_total\n end\n\n end\n end\n sub_total\n end", "def project_contribution_sum(project_id)\n total_commits = 0\n total_lines_added = 0\n total_lines_deleted = 0\n # Loop through all contributions of a single project\n self.contributions.where(project_id: project_id).each do |contribution|\n # Add contributions together\n total_commits += contribution.commits\n total_lines_added += contribution.lines_added\n total_lines_deleted += contribution.lines_deleted\n end\n hash = {\n name: Project.find(project_id).name,\n commits: total_commits,\n lines_added: total_lines_added,\n lines_deleted: total_lines_deleted\n }\n end", "def total_sum\n sum = if @payment.respond_to?(:total_sum)\n # use this first, because once the owner has set a specific sum\n # that becomes the final sum to be payed\n @payment.total_sum\n elsif @cart.total_sum\n # if owner has not yet set final sum, see if a cart has been\n # allready saved and use that to calculate\n @cart.total_sum\n else\n # while a transaction and it's cart still has not been stored in\n # db calculate the sum on the fly\n sum = @transaction.unit_price * @transaction.listing_quantity\n sum += @cart.cart_sum if @cart\n sum\n end\n end", "def invoice # rubocop:disable all\n @province = Province.find(params[:province])\n @customer = Customer.find(session[:customer_id])\n customer_order = @customer.orders.build\n customer_order.status = 'outstanding'\n customer_order.pst_rate = @customer.province.pst\n customer_order.gst_rate = @customer.province.gst\n customer_order.hst_rate = @customer.province.hst\n customer_order.address = params[:address]\n customer_order.city = params[:city]\n customer_order.province = params[:province]\n customer_order.country_name = params[:country_name]\n customer_order.postal_code = params[:postal_code]\n customer_order.save\n\n session[:order_id] = customer_order.id\n session[:product_id].each do |product_id|\n product = Product.find(product_id)\n customer_item = customer_order.lineItems.build\n customer_item.order_id = customer_order.id\n customer_item.price = product.price\n customer_item.quantity = params[\"quantity_#{product.id}\"]\n customer_item.product_id = product.id\n customer_item.save\n end\n @line_items = LineItem.where('order_id = ?', session[:order_id])\n session[:order_complete] = true\n end", "def recalc_totals_from_db!\n self.subtotal = self.time_entries.sum(:total_amount) + self.expense_entries.sum(:total_amount)\n self.paid = self.payment_allocates.sum(:amount)\n self.save!\n end", "def total_payout\n # make sure we have rep_parent\n node = self\n if !self.rep_parent.nil?\n node = self.rep_parent\n end\n \n # get total payout of children\n child_payout = 0\n node.children.each do |child|\n child_payout = child_payout + child.total_payout\n end\n \n # multiply complete * reward and expired * penalty\n payout = node.repititions.\n where(:state => Activity::COMPLETE).size * node.reward\n payout = payout -\n node.repititions.\n where(:state => Activity::EXPIRED).size *\n node.penalty\n return payout + child_payout\n \n end", "def bi_total_date(_project, _from, _to, _group)\n if _group.nil?\n budget_items.joins(:budget).where(\"budgets.project_id in (?) AND budgets.approval_date >= ? AND budgets.approval_date <= ?\",_project,_from,_to).select('SUM(budget_items.amount) bi_t')\n else\n budget_items.joins(:budget,:charge_account).where(\"budgets.project_id in (?) AND budgets.approval_date >= ? AND budgets.approval_date <= ? AND charge_accounts.charge_group_id = ?\",_project,_from,_to, _group).select('SUM(budget_items.amount) bi_t')\n end\n end", "def total_funds #YES\n startup_arr = FundingRound.all.select do |f|\n f.startup == self\n end\n startup_arr.collect do |s|\n s.investment\n end.sum \n end", "def order_expenses\n total_expenses_per_subsection = {}\n total_expenses_per_subsection.default = 0.0\n details = self.order_details\n details.each do |detail|\n total_expenses_per_subsection[detail.subsection] += detail.last_value.amount\n end\n total_expenses_per_subsection\n end", "def expense_after_subtotal_by_party party, invoiced=nil, document_id=nil\n sub_total = expense_subtotal_by_party(party)\n accum = Money.new(0)\n\n filter_invoiced(line_items, invoiced, document_id).each do |li|\n if li.after_subtotal\n\n if li.billable_party == party\n accum -= li.percentage_of_subtotal ? li.revenue_total_with_percentage(sub_total) : li.revenue_total\n end\n\n if li.payable_party == party\n accum += li.percentage_of_subtotal ? li.expense_total_with_percentage(sub_total) : li.expense_total\n end\n\n end\n\n end\n accum\n end", "def update_invested\n self.invested_amount = self.investments.map(&:amount).sum\n self.goal_investment = 0 unless self.goal_investment\n self.equity_offered = 0 unless self.equity_offered\n self.save\n end", "def calculate_balance_forward\n invoices.each do |invoice|\n if date_range.is_active? && invoice.issue_date < date_range.start_date\n @balances[invoice.customer_id] += invoice.amount_due\n end\n end\n end", "def total_amounts(style=:solo)\n each_with_object([]) do |bill,memo|\n if style==:solo\n memo << [bill.invoice_month.to_s,bill.total_amount]\n else\n memo << [bill.invoice_month.to_s,'total_charges',nil,nil,nil,bill.total_amount]\n end\n end\n end", "def bi_total(_project, _group)\n if _group.nil?\n budget_items.joins(:budget).where(\"budgets.project_id in (?)\",_project).select('SUM(budget_items.amount) bi_t')\n else\n budget_items.joins(:budget,:charge_account).where(\"budgets.project_id in (?) AND charge_accounts.charge_group_id = ?\",_project, _group).select('SUM(budget_items.amount) bi_t')\n end\n end", "def generate_invoice_items\n if self.project_id.present? && self.payment_profile_id.present? && @start_date.present? && @end_date.present?\n project = Project.find(self.project_id)\n payment_profile = PaymentProfile.find(self.payment_profile_id)\n total_cost_cents = 0;\n\n default_currency = project.account.account_setting.default_currency\n invoice_currency = self.currency || project.account.account_setting.default_currency\n\n # Get mins tracked\n mins_tracked = Timing.minute_duration_submitted_for_period_by_project(project.id, @start_date, @end_date)\n\n # Generate cost\n if payment_profile.rate_card_payment_profiles.present?\n payment_profile.rate_card_payment_profiles.each do |rate_card_payment_profile|\n cost_per_min = rate_card_payment_profile.rate_card.cost_per_min_for_client(project.client_id, project.account)\n mins_for_rate_card = (mins_tracked / 100.0) * rate_card_payment_profile.percentage\n total_cost_cents += mins_for_rate_card * cost_per_min\n end\n end\n\n # Create new invoice item with correct values\n invoice_item_instance = InvoiceItem.new(:quantity => 1, :name => payment_profile.name, :payment_profile_id => payment_profile.id)\n invoice_item_instance.amount_cents = Currency.convert_amount(default_currency, invoice_currency, total_cost_cents)\n return invoice_item_instance\n end\n nil\n end", "def total_payout\n # calculate children payout\n count = 0\n self.children.each do |child|\n count = count + child.total_payout\n end\n \n # calculate payout of this ativity\n if self.state == COMPLETE\n return count + self.reward\n elsif self.state == EXPIRED\n return count - self.penalty\n else \n return count\n end\n\n end", "def rebuild_invoice\n end", "def revenue_by_party_and_line_item_subtype party, line_item_sub_type, invoiced=nil, document_id=nil\n sub_total = revenue_subtotal_by_party(party)\n accum = Money.new(0)\n\n filter_invoiced(line_items, invoiced, document_id).select{|li| li.line_item_sub_type == line_item_sub_type}.each do |li|\n if li.after_subtotal\n\n if li.billable_party == party\n accum += li.percentage_of_subtotal ? li.revenue_total_with_percentage(sub_total) : li.revenue_total\n end\n\n if li.payable_party == party\n accum -= li.percentage_of_subtotal ? -li.expense_total_with_percentage(sub_total) : li.expense_total\n end\n\n else\n\n if li.billable_party == party\n accum += li.revenue_total\n end\n\n if li.payable_party == party\n accum -= li.expense_total\n end\n \n end\n\n end\n accum\n end", "def invoice_revenue\n InvoiceItem.group(:invoice_id).where(invoice_id: id).sum('quantity * unit_price').values.pop\n end", "def invoices(reload = false)\n self.cache(CostAgent::Invoice, :all, reload) do\n (self.api(\"invoices\")/\"invoice\").collect do |invoice|\n items = (invoice/\"invoice-item\").collect do |item|\n price = (item/\"price\").first.inner_text.to_f\n quantity = (item/\"quantity\").first.inner_text.to_f\n cost = price * quantity\n project = self.project((item/\"project-id\").first.inner_text.to_i)\n InvoiceItem.new(\n :id => (item/\"id\").first.inner_text.to_i,\n :invoice_id => (item/\"invoice-id\").first.inner_text.to_i,\n :project_id => project.nil? ? nil : project.id,\n :project => project,\n :item_type => (item/\"item-type\").first.inner_text,\n :description => (item/\"description\").first.inner_text,\n :price => price,\n :quantity => quantity,\n :cost => cost)\n end\n project = self.project((invoice/\"project-id\").first.inner_text.to_i)\n Invoice.new(\n :id => (invoice/\"id\").first.inner_text.to_i,\n :project_id => project.nil? ? nil : project.id,\n :project => project,\n :description => (invoice/\"description\").first.inner_text,\n :reference => (invoice/\"reference\").text,\n :amount => (invoice/\"net-value\").text.to_f,\n :status => (invoice/\"status\").text,\n :date => DateTime.parse((invoice/\"dated-on\").text),\n :due => DateTime.parse((invoice/\"due-on\").text),\n :items => items)\n end\n end\n end", "def total_funds\n my_rounds.map{|rounds| rounds.investment}.sum\n end", "def path_sum(root, sum)\n path_sum_helper([], root, sum)\nend", "def subtotal\n items.map(&:price).reduce(&:+)\n end", "def sum_totals\n @total = Lote.where(:programacion_id => @programacion.first).sum(:precio_t)\n @total = Money.new(\"#{@total}00\", \"USD\").format\n @cantidades = Lote.where(:programacion_id => @programacion.first).sum(:cantidad)\n end", "def subtotal\n return items.inject(0) {|total, item| total + item.subtotal}\n end", "def dni_total(_project, _office)\n if _office.nil?\n delivery_note_items.where('delivery_note_items.project_id in (?)',_project).select('SUM(delivery_note_items.quantity * delivery_note_items.cost) dni_t')\n else\n delivery_note_items.joins(:project).where('delivery_note_items.project_id in (?) AND projects.office_id = ?',_project, _office).select('SUM(delivery_note_items.quantity * delivery_note_items.cost) dni_t')\n end\n end", "def dni_total(_project, _office)\n if _office.nil?\n delivery_note_items.where('delivery_note_items.project_id in (?)',_project).select('SUM(delivery_note_items.quantity * delivery_note_items.cost) dni_t')\n else\n delivery_note_items.joins(:project).where('delivery_note_items.project_id in (?) AND projects.office_id = ?',_project, _office).select('SUM(delivery_note_items.quantity * delivery_note_items.cost) dni_t')\n end\n end", "def get_total\n counts = convert_to_hash(@item_list)\n uniq_items = @item_list.uniq\n\n final = (@total - @sale.apply(uniq_items, counts)).round(2) # Used round for precision\n puts get_invoice + final.to_s\n final\n end", "def invoiced_for_superficie_presentation_unit_type_measurement\n finished_products.each do |finished_product|\n finished_product.products.each do |product|\n product.product_by_invoices.each do |product_by_invoice|\n total_presentation_unit_type_to_use = product_by_invoice.total_presentation_unit_type_to_use\n finished_product.presentation_unit_type.presentation_unit_type_conversions.each do |presentation_unit_type_conversion|\n if packing_material.presentation_unit_type_id.eql?(presentation_unit_type_conversion.presentation_unit_type_to_id)\n invoiced += (total_presentation_unit_type_to_use*presentation_unit_type_conversion.proportion).to_i\n end\n end\n end\n end\n end\n end", "def total_payments\n Payment.total_for_tenant(self)\n end", "def all_invoices\n @gateway.get_invoices.invoices\n end", "def money_made\n # InvoiceItem.joins(invoices: [:transactions, :merchants])\n Merchant.joins(invoices: :transactions).joins(invoices: :invoice_items).where(\"invoices.merchant_id =?\", \"1\").where(transactions: {result: \"success\"}).sum('invoice_items.unit_price * invoice_items.quantity')\n Merchant.joins(invoices: :transactions).joins(invoices: :invoice_items).where(\"invoices.merchant_id =?\", \"1\").where(transactions: {result: \"success\"}).group(\"merchants.id\").select(\"merchants.*, sum(invoice_items.quantity)\")\nend", "def total(bill)\n sum=0.0\n bill.items.each do |i|\n sum += i.price\n end\n return sum\n end", "def total_raised\n payments.inject(0) { |sum, p| sum + p.amount.to_f }\n end", "def show\n @user = current_user\n\n @invoiceline = Invoiceline.new\n @invoices = Invoice.all\n @invoicelines = Invoiceline.all\n @sum = self.compute_invoice(@invoice)\n\n end", "def total\n total = order_items.inject(0) { |sum, p| sum + p.subtotal }\n end", "def revenue\n Invoice.joins(:invoice_items, :transactions)\n .where(merchant: self.id, 'transactions.result' => 'success')\n .sum('invoice_items.quantity * invoice_items.unit_price')\n end", "def calculate_totals\n totals = {}\n if self.amount_due.nil?\n total = 0.00\n order_products.each do |order_product|\n price = order_product.unit_price\n price = order_product.product.price if price.nil?\n total = total + (price * order_product.quantity)\n end\n totals[:product_total] = total\n totals[:tax] = total * 0.055\n totals[:amount_due] = total + totals[:tax]\n else\n totals[:product_total] = self.product_total\n totals[:tax] = self.tax\n totals[:amount_due] = self.amount_due\n end\n return totals\n end", "def total(day, project_id)\n sum = 0\n Array.wrap(day[project_id]).each do |story|\n sum += story['estimate'].to_i\n end\n sum\nend", "def total_payout\n # make sure we have rep_parent\n node = self.get_rep_parent\n \n # get total payout of children\n child_payout = 0\n node.children.each do |child|\n child_payout = child_payout + child.total_payout\n end\n\n # if no week requirement then number reward - penalty\n if node.is_infinite?\n rewards = node.get_weeks_complete\n penalties = node.get_weeks_expired\n return (rewards * node.reward) - (penalties * node.penalty) + child_payout\n end\n\n # if COMPLETE add reward, if EXPIRED subtract penalty\n if node.state == Activity::COMPLETE\n return child_payout + node.reward\n elsif node.state ==Activity::EXPIRED\n reuturn child_payout - node.penalty\n else\n return child_payout\n end\n end", "def calculate_totals\n subtotal = 0\n\n carted_products.each do |carted_product|\n subtotal += carted_product.subtotal\n end\n\n tax = subtotal * 0.09\n total = subtotal + tax\n update(subtotal: subtotal, tax: tax, total: total)\n end", "def path_sum(root, sum)\n return [] if root.nil?\n result = []\n helper(root, sum, result)\n result\nend", "def expense_by_party_and_line_item_subtype party, line_item_sub_type, invoiced=nil, document_id=nil\n sub_total = expense_subtotal_by_party(party)\n accum = Money.new(0)\n\n filter_invoiced(line_items, invoiced, document_id).select{|li| li.line_item_sub_type == line_item_sub_type}.each do |li|\n if li.after_subtotal\n\n if li.billable_party == party\n accum -= li.percentage_of_subtotal ? li.revenue_total_with_percentage(sub_total) : li.revenue_total\n end\n\n if li.payable_party == party\n accum += li.percentage_of_subtotal ? li.expense_total_with_percentage(sub_total) : li.expense_total\n end\n\n else\n\n if li.billable_party == party\n accum -= li.revenue_total\n end\n\n if li.payable_party == party\n accum += li.expense_total\n end\n \n end\n\n end\n accum\n end", "def invested(domain)\n FundingRound.all.inject(0) do |sum, funding_round|\n if (funding_round.venture_capitalist == self && funding_round.startup.domain == domain)\n sum += funding_round.investment\n else\n sum\n end\n end\n end", "def total_payment_amount\n sum = 0.00\n unless self.insurance_payment_eobs.blank?\n self.insurance_payment_eobs.each do |eob|\n (sum = sum + eob.total_amount_paid_for_claim) unless eob.total_amount_paid_for_claim.nil?\n end\n end\n sum\n end", "def subtotal\n line_items.reduce(BigDecimal(\"0\")) { |result, item| result += item.amount }\n end", "def sum_nested_collection\n nested_numbers = [[1,2,3], [5,6,7,5], [9,10,13,6], [1]]\nend", "def index\n if params[:project_id].nil?\n @invoices = Invoice.all\n else\n @project=Project.find(params[:project_id])\n @[email protected]\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end", "def sum_regular(regular_items, end_date, options={})\n\t #end_date = @today + @days_ahead\n\t\tsum_out = regular_items.inject(0) do |sum, (account, item)|\t\n\t\t\titem = [item] unless item.kind_of? Array\n#\t\t\t ep item\n\t\t\tvalue_out = item.inject(0) do |value,info|\n\t\t\t\tfinish = (info[:end] and info[:end] < end_date) ? info[:end] : end_date\n\t\t\t\t#today = (Time.now.to_i / (24.0*3600.0)).round\n\t\t\t\t \n nunits = 0.0\n\t\t\t\tcounter = info[:period][0] == 1 ? 0 : nil\n\t\t\t\tunless counter\n\t\t\t\t\tdate = @today\n\t\t\t\t\tcounter = 0\n\t\t\t\t\tcase info[:period][1]\n\t\t\t\t\twhen :month\n\t\t\t\t\t\twhile date >= (info[:start] or @today)\n\t\t\t\t\t\t\tcounter +=1 if date.mday == (info[:monthday] or 1)\n\t\t\t\t\t\t\tdate -= 1\n\t\t\t\t\t\tend\n\t\t\t\t\twhen :year\n\t\t\t\t\t\twhile date >= (info[:start] or @today) \n\t\t\t\t\t\t\tcounter +=1 if date.yday == (info[:yearday] or 1)\n\t\t\t\t\t\t\tdate -= 1\n\t\t\t\t\t\tend\n\t\t\t\t\twhen :day\n\t\t\t\t\t\twhile date > (info[:start] or @today)\n\t\t\t\t\t\t\tcounter +=1\n\t\t\t\t\t\t\tdate -= 1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n delta_units = account.kind_of?(Account) && account.projection\n\t\t\t\tdate = @today\n\t\t\t\tcase info[:period][1]\n\t\t\t\twhen :month\n\t\t\t\t\t#p date, info\n\t\t\t\t\twhile date <= finish \n if delta_units \n nunits += 1.0/date.days_in_month\n else\n if date.mday == (info[:monthday] or 1)\n nunits += 1 if counter % info[:period][0] == 0\n counter +=1 \n end\n end\n\t\t\t\t\t\tdate += 1\n\t\t\t\t\tend\n\t\t\t\twhen :year\n\t\t\t\t\twhile date <= finish\n if delta_units\n nunits += 1.0/date.days_in_year\n else\n if date.yday == (info[:yearday] or 1)\n nunits += 1 if counter % info[:period][0] == 0\n counter +=1\n end\n end\n\t\t\t\t\t\tdate += 1\n\t\t\t\t\tend\n\t\t\t\twhen :day\n\t\t\t\t\twhile date <= finish\n\t\t\t\t\t\tnunits += 1 if counter % info[:period][0] == 0\n\t\t\t\t\t\tcounter +=1\n\t\t\t\t\t\tdate += 1\n\t\t\t\t\tend\n\t\t\t\tend\n\n\n\n #ep ['name2234', name, info, @projected_account_factor] if info[:discretionary]\n\n value + nunits * (info[:size]||account.projection*(@projected_account_factor||1.0))\n\n\t\t\tend\n\t\t\tsum + value_out\n\t\t\t#(rcp.excluding? and rcp.excluding.include?(name)) ? sum : sum + value\n\t\tend\n\t\tsum_out\n\tend", "def total_paid\n self.user_expenses.reduce(0) { |sum, user_expense| user_expense.paid + sum }\n end", "def spend\n amounts = []\n orders.where(order_status_id: 4).each do |order|\n amounts << order.subtotal\n end\n return amounts.inject(:+)\n end" ]
[ "0.68721366", "0.6070501", "0.6056011", "0.6056011", "0.6042559", "0.5907846", "0.5771606", "0.5766008", "0.56959325", "0.56777", "0.56386256", "0.5585156", "0.5567373", "0.55230254", "0.55194485", "0.5516861", "0.5503217", "0.5468044", "0.54532367", "0.5441618", "0.5422096", "0.53954566", "0.5387884", "0.53863424", "0.5378471", "0.53738976", "0.5368579", "0.533696", "0.53352785", "0.5314664", "0.5314035", "0.5304128", "0.5290803", "0.52872306", "0.5281724", "0.527196", "0.52654743", "0.5255183", "0.5244663", "0.52418417", "0.5238549", "0.5222284", "0.5210126", "0.5204008", "0.52036065", "0.5189612", "0.51843977", "0.51843286", "0.51820934", "0.51753694", "0.51735735", "0.51625943", "0.5156556", "0.51551586", "0.5144683", "0.5137487", "0.51366997", "0.5125486", "0.5115557", "0.5110591", "0.51055783", "0.5094879", "0.5090267", "0.508921", "0.50859994", "0.50824", "0.5082168", "0.5075615", "0.5071938", "0.50677", "0.50676763", "0.50547814", "0.5047334", "0.5046448", "0.50317734", "0.50317734", "0.50316113", "0.5024149", "0.50230074", "0.50205296", "0.5020185", "0.50171816", "0.50012136", "0.49991414", "0.49957085", "0.4993079", "0.49918842", "0.49873075", "0.49745736", "0.49711883", "0.4963522", "0.49586606", "0.49512774", "0.49460006", "0.4943235", "0.49347547", "0.49309748", "0.49266857", "0.49249768", "0.49245355" ]
0.6412949
1
TODO: expand 'remaining_milestones', make recursive. It doesn't apply to master project.
def remaining_milestones finish - milestone end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def milestones\n process_list_response( send(:get , \"/api/v1/milestones.json\")[:body] , Unfuddled::Milestone)\n end", "def get_recalculated_milestones\n userId = params[:user_id]\n timeUnitId = params[:time_unit_id]\n moduleTitle = params[:module_title]\n\n # TODO\n # user = @userRepository.get_user(userId)\n # if !can?(current_user, :read_milestones, user)\n # render status: :forbidden,\n # json: {}\n # return\n # end\n\n # TODO\n # org = @organizationRespository.get_organization(user.organization_id)\n # if !can?(current_user, :read_milestones, org)\n # render status: :forbidden,\n # json: {}\n # return\n # end\n\n result = @progressService.get_recalculated_milestones(userId, timeUnitId, moduleTitle)\n\n render status: result.status,\n json: {\n info: result.info,\n recalculated_milestones: result.object\n }\n end", "def milestones\n Sifter.\n get(api_milestones_url).\n fetch(\"milestones\", []).\n map { |m| Sifter::Milestone.new(m) }\n end", "def milestones\n Sifter.\n get(api_milestones_url).\n fetch(\"milestones\", []).\n map { |m| Sifter::Milestone.new(m) }\n end", "def milestones(project_id, find = 'all')\n records \"milestone\", \"/projects/#{project_id}/milestones/list\", :find => find\n end", "def milestones(project_id, find=\"all\")\n records \"milestone\", \"/projects/#{project_id}/milestones/list\", :find => find\n end", "def limit_milestones?\n !self[:milestones].nil? && self[:milestones] == false\n end", "def create_starting_milestones!\n result = Lighthouse.get_milestones(self.remote_id, self.token.account, self.token.token)\n (result[\"milestones\"] || []).each do |milestone|\n m = self.milestones.create(:name => milestone[\"title\"], :remote_id => milestone[\"id\"], :due_on => milestone[\"due_on\"])\n end\n end", "def setup\n @milestone= milestones(:data1)\n end", "def milestones\n milestones = Milestone.where(project_id: project_ids_relation)\n milestones = milestones.search(query)\n milestones.reorder('updated_at DESC')\n end", "def milestones\n @milestones_proxy ||= MilestonesProxy.new self\n end", "def milestone\n @client.milestone(project_id , milestone_id)\n end", "def ensure_milestone(repository, milestone)\n mappings = milestone.delete(\"mappings\") { [] }\n all = github.milestones(repository)\n\n current = all.select { |cur| cur[:title] == milestone[\"name\"] }.first\n new = current\n\n if current.nil?\n new = github.create_milestone(repository, milestone[\"name\"], description: milestone[\"description\"])\n puts \" Successfully added milestone\"\n else\n unless current[:title] == milestone[\"name\"] && current[:description] == milestone[\"description\"]\n github.update_milestone(repository, current[:number], title: milestone[\"name\"], description: milestone[\"description\"])\n puts \"Updated milestone\"\n end\n end\n\n mappings.each do |previous|\n next unless all.any? { |l| l[:title] == previous }\n previous_number = all.select { |l| l[:title] == previous }.first[:number]\n\n count = 0\n issues_with(repository, \"milestone\", previous) do |issue|\n puts \" Setting milestone on issue #{issue}\"\n github.update_issue(repository, issue, milestone: new[:number])\n count += 1\n puts \"-----\"\n end\n # search is a bit slow, so we'll check that we deleted the number\n # that we expected or we've got none left. Of course, if search\n # updates while we're deleting a huge list we'll need to re-run, but\n # that should be OK\n remaining = issues_with(repository, \"milestone\", previous)\n if remaining.empty? || remaining.length == count\n puts \" Deleting milestone '#{previous}' from #{repository}\"\n github.delete_milestone(repository, previous_number)\n else\n puts \"There are remaining issues returned from search - you should manually check that the '#{previous}' milestone has no tickets assigned (or rerun this command in a few minutes time)\"\n end\n end\nend", "def ensure_milestone(repository, milestone)\n mappings = milestone.delete(\"mappings\") { [] }\n all = github.milestones(repository)\n\n current = all.select { |cur| cur[:title] == milestone[\"name\"]}.first\n new = current\n\n if current.nil?\n new = github.create_milestone(repository, milestone[\"name\"], description: milestone[\"description\"])\n puts \"Successfully added milestone\"\n else\n unless current[:title] == milestone[\"name\"] && current[:description] == milestone[\"description\"]\n github.update_milestone(repository, current[:number], title: milestone[\"name\"], description: milestone[\"description\"])\n puts \"Updated milestone\"\n end\n end\n\n mappings.each do |previous|\n next unless all.any? { |l| l[:title] == previous }\n previous_number = all.select { |l| l[:title] == previous }.first[:number]\n\n count = 0\n issues_with(repository, \"milestone\", previous) do |issue|\n puts \"Setting milestone on issue #{issue}\"\n github.update_issue(repository, issue, milestone: new[:number])\n count += 1\n puts \"-----\"\n end\n # search is a bit slow, so we'll check that we deleted the number\n # that we expected or we've got none left. Of course, if search\n # updates while we're deleting a huge list we'll need to re-run, but\n # that should be OK\n remaining = issues_with(repository, \"milestone\", previous)\n if remaining.empty? || remaining.length == count\n puts \"Deleting milestone '#{previous}' from #{repository}\"\n github.delete_milestone(repository, previous_number)\n else\n puts \"There are remaining issues returned from search - you should manually check that the '#{previous}' milestone has no tickets assigned (or rerun this script in a few minutes time)\"\n end\n end\nend", "def limited_milestones_count\n @limited_milestones_count ||= milestones.limit(count_limit).count\n end", "def cached_milestones\n Rails.cache.fetch([self, 'milestones']) do\n self.milestones.active.select('milestones.id, milestones.title, milestones.project_id').to_a\n end\n end", "def get_milestone\n blocks = self.blocks_get_milestone\n if blocks[\"success\"]\n return blocks[\"milestone\"]\n else\n return nil\n end\n end", "def milestone(project, id)\n get(\"/projects/#{url_encode project}/milestones/#{id}\")\n end", "def milestone_select(perms)\n if @task.id\n milestones = Milestone.find(:all, :order => 'due_at, name', :conditions => ['company_id = ? AND project_id = ? AND completed_at IS NULL', current_user.company.id, selected_project])\n return select('task', 'milestone_id', [[_(\"[None]\"), \"0\"]] + milestones.collect {|c| [ c.name, c.id ] }, {}, perms['milestone'])\n else\n milestones = Milestone.find(:all, :order => 'due_at, name', :conditions => ['company_id = ? AND project_id = ? AND completed_at IS NULL', current_user.company.id, selected_project])\n return select('task', 'milestone_id', [[_(\"[None]\"), \"0\"]] + milestones.collect {|c| [ c.name, c.id ] }, {:selected => 0 }, perms['milestone'])\n end\n end", "def get(*args)\n arguments(args, required: [:user, :repo, :number])\n\n get_request(\"/repos/#{arguments.user}/#{arguments.repo}/milestones/#{arguments.number}\", arguments.params)\n end", "def admin_milestones_stats\n get_admin_stats \"milestones\"\n end", "def milestone_name\n milestone ? milestone.name : 'None'\n end", "def initialize(project, client)\n @project = project\n @client = client\n @existing_milestones = project.milestones.pluck(:iid).to_set\n end", "def getMilestones(response)\r\n\t\t\t\tmilestones_all_json = JSON.parse response\r\n\t\t\t\tmilestones_all_array = milestones_all_json[\"milestones\"]\r\n\t\t\t\tmilestones_class_array = Array.new\r\n\t\t\t\tfor i in 0...milestones_all_array.length\r\n\t\t\t\t\tmilestones_class_array.push(jsonToMilestone(milestones_all_array[i]))\r\n\t\t\t\tend\r\n\t\t\t\treturn milestones_class_array\r\n\t\t\tend", "def latest_milestone\n self.milestones.last\n end", "def index\n @goals = current_user.goals\n \n @goals.each do |g|\n completed_milestone=0\n @milestones=g.milestones \n if(@milestones.count>0)\n @milestones.each do |m|\n if(m.completed)\n completed_milestone=completed_milestone+1\n end\n \n\n end\n g.percentage=(completed_milestone/@milestones.count)*100\n else\n g.percentage=0\n end\n \n end\n\n end", "def milestone?\n self.milestones.collect(&:version_number).include? self.logical_version_number\n end", "def getMilestone(response)\r\n\t\t\t\tmilestones_json = JSON.parse response\r\n\t\t\t\tmilestones_array = milestones_json[\"milestones\"]\r\n\t\t\t\treturn jsonToMilestone(milestones_array[0])\r\n\t\t\tend", "def get_milestones_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProjectsApi#get_milestones ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_milestones\" if id.nil?\n \n # resource path\n path = \"/Projects/{id}/Milestones\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APIMilestone>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProjectsApi#get_milestones\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def filter_milestones_by_project(milestones)\n project_ids =\n milestones.where(project_id: project_ids_relation)\n .select(:project_id).distinct\n .pluck(:project_id)\n\n return Milestone.none if project_ids.nil?\n\n authorized_project_ids_relation =\n Project.where(id: project_ids).ids_with_issuables_available_for(current_user)\n\n milestones.where(project_id: authorized_project_ids_relation)\n end", "def milestones(user_name=nil, repo_name=nil, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n\n _normalize_params_keys(params)\n _filter_params_keys(VALID_MILESTONE_OPTIONS.keys, params)\n _validate_params_values(VALID_MILESTONE_OPTIONS, params)\n\n response = get(\"/repos/#{user}/#{repo}/milestones\", params)\n return response unless block_given?\n response.each { |el| yield el }\n end", "def labels_for_milestone(repo, number, options = {})\n paginate \"#{Repository.path repo}/milestones/#{number}/labels\", options\n end", "def getMilestone\r\n\t\t\t\t\treturn @milestone\r\n\t\t\t\tend", "def rollback_to_latest_milestone\n self.revert_to_milestone self.milestones.count\n end", "def uncomplete_milestone(id)\n record \"/milestones/uncomplete/#{id}\"\n end", "def uncomplete_milestone(id)\n record \"/milestones/uncomplete/#{id}\"\n end", "def revert_to_milestone!(n)\n verify_milestone_exists n\n self.revert_to! self.milestones[n.to_i-1].version\n end", "def complete_milestone(id)\n record \"/milestones/complete/#{id}\"\n end", "def complete_milestone(id)\n record \"/milestones/complete/#{id}\"\n end", "def set_milestone\n @milestone = @appointment.milestones.find(params[:id])\n end", "def revert_to_milestone(n)\n verify_milestone_exists n\n self.revert_to self.milestones[n.to_i-1].version\n end", "def jsonToMilestone(jsonObject)\r\n\t\t\t\tmilestone = Milestone.new\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"id\")\r\n\t\t\t\t\tmilestone.setId(jsonObject[\"id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"name\")\r\n\t\t\t\t\tmilestone.setName(jsonObject[\"name\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"start_date\")\r\n\t\t\t\t\tmilestone.setStartDate(jsonObject[\"start_date\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"start_date_format\")\r\n\t\t\t\t\tmilestone.setStartDateFormat(jsonObject[\"start_date_format\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"start_date_long\")\r\n\t\t\t\t\tmilestone.setStartDateLong(jsonObject[\"start_date_long\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"end_date\")\r\n\t\t\t\t\tmilestone.setEndDate(jsonObject[\"end_date\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"end_date_format\")\r\n\t\t\t\t\tmilestone.setEndDateFormat(jsonObject[\"end_date_format\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"end_date_long\")\r\n\t\t\t\t\tmilestone.setEndDateLong(jsonObject[\"end_date_long\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"status\")\r\n\t\t\t\t\tmilestone.setStatus(jsonObject[\"status\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"flag\")\r\n\t\t\t\t\tmilestone.setFlag(jsonObject[\"flag\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"owner_id\")\r\n\t\t\t\t\tmilestone.setOwnerId(jsonObject[\"owner_id\"])\r\n\t\t\t\tend\r\n\t\t\t\tif jsonObject.has_key?(\"owner_name\")\r\n\t\t\t\t\tmilestone.setOwnerName(jsonObject[\"owner_name\"])\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"link\")\r\n\t\t\t\t\tlink = jsonObject[\"link\"]\r\n\r\n\t\t\t\t\tif link.has_key?(\"self\")\r\n\t\t\t\t\t\tmilestone.setURL(link[\"self\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\t\tif link.has_key?(\"status\")\r\n\t\t\t\t\t\tmilestone.setStatusURL(link[\"status\"][\"url\"])\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\treturn milestone\r\n\t\t\tend", "def create_milestones(project_id, milestones)\n records \"milestone\", \"/projects/#{project_id}/milestones/create\", :milestone => milestones\n end", "def create_milestones(project_id, milestones)\n records \"milestone\", \"/projects/#{project_id}/milestones/create\", :milestone => milestones\n end", "def milestones_expanded=(setting)\n raise ArgumentError, 'Invalid lesson plan milestone groups expanded setting.' \\\n unless MILESTONES_EXPANDED_VALUES.include?(setting)\n\n settings.milestones_expanded = setting\n end", "def milestone entries: entries\n entries.reverse.each do |en|\n desc = en['description']\n if desc.match( DYNAMIC_FINISH_LINE ) or\n desc.match( NUMBER_APPEARS )\n return $1.to_i\n end\n end\n nil\n end", "def planned(target_milestone, opts=Hash.new)\n new({:target_milestone => target_milestone, \n :status => [:unconfirmed, :new, :assigned, :reopened],\n :priority => %w(P1)\n }.merge(opts))\n \t\tend", "def milestone_part(project_id)\n throw_content :sidebar, part(MilestonePart => :index, :project_id => project_id)\n end", "def rollback_to_latest_milestone!\n self.revert_to_milestone! self.milestones.count\n end", "def list(user_name, repo_name, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n\n normalize! params\n\n response = get_request(\"/1.0/repositories/#{user}/#{repo.downcase}/issues/milestones\", params)\n return response unless block_given?\n response.each { |el| yield el }\n end", "def milestone_issues(project, milestone, options = {})\n get(\"/projects/#{url_encode project}/milestones/#{milestone}/issues\", query: options)\n end", "def create\n @milestone = @project.milestones.build(milestone_params)\n\n respond_to do |format|\n if @milestone.save\n format.html { redirect_to @project,\n notice: 'Milestone was successfully created.' }\n format.json { render :show, status: :created, location: @milestone }\n else\n format.html { render :new }\n format.json { render json: @milestone.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def set_project_phase_milestone\n @project_phase_milestone = Project::Phase::Milestone.find(params[:id])\n end", "def create_milestone(project_id, data)\n create_milestones(project_id, [data]).first\n end", "def create_milestone(project_id, data)\n create_milestones(project_id, [data]).first\n end", "def get_milestones(id, opts = {})\n data, status_code, headers = get_milestones_with_http_info(id, opts)\n return data\n end", "def milestone_params\r\n params.require(:milestone).permit(\r\n :name,\r\n :description,\r\n :project_id,\r\n :gitlab_id,\r\n :is_existing_on_gitlab,\r\n )\r\n end", "def as_milestone(xml)\n xml.milestone(lifecycle,\n date: milestone_date,\n version:)\n end", "def milestone(user_name, repo_name, milestone_id, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n _validate_presence_of milestone_id\n _normalize_params_keys(params)\n\n get(\"/repos/#{user}/#{repo}/milestones/#{milestone_id}\", params)\n end", "def update\n project = @milestone.project\n milestone_owner = User.find_by(id: project.user_id)\n\n #Alerts leader if a milestone is reached. Needs testing or way to \"complete\" milestone.\n if !params[:milestone][:success_id].nil?\n milestone_owner.notify(\"alert\", \"Milestone #{view_context.link_to @milestone.name, @milestone} was \n completed in #{view_context.link_to @milestone.project.title, @project}\")\n end\n\n respond_to do |format|\n if @milestone.update_attributes(milestone_params)\n format.html { redirect_to @milestone.project, notice: 'Milestone was successfully created.' }\n format.json { respond_with_bip(@milestone) }\n else\n format.html { redirect_to @milestone.project, alert: @milestone.errors.full_messages.to_sentence }\n format.json {respond_with_bip(@milestone) }\n end\n end\n end", "def test_missing_milestone_is_empty_string\n assert_equal( '', @incomplete[ :milestone ] )\n end", "def deploy_as_childs_is_qr_qwr\n # Each projects\n for project in Project.find(:all, :conditions => [\"is_qr_qwr = 1\"]).select { |p| !p.is_ended}\n # Each milestones\n project.milestones.select{ |m1| m1.checklist_not_applicable==0 and m1.status==0 and m1.done==0 and self.milestone_names.map{|mn| mn.title}.include?(m1.name)}.each do |milestone|\n i = ChecklistItem.find(:first, :conditions=>[\"template_id=? and milestone_id=? and request_id IS NULL and project_id IS NULL\", self.id, milestone.id])\n # Create\n if i == nil\n # Get the parent\n parent = ChecklistItem.find(:first, :conditions=>[\"template_id=? and milestone_id=? and request_id IS NULL and project_id IS NULL\", self.parent.id, milestone.id])\n if parent\n ChecklistItem.create(:milestone_id=>milestone.id, :parent_id=>parent.id, :template_id=>self.id)\n end\n # Update\n else\n parent = ChecklistItem.find(:first, :conditions=>[\"template_id=? and milestone_id=? and request_id IS NULL and project_id IS NULL\", self.parent.id, milestone.id])\n if parent\n i.parent_id = parent.id\n i.save\n end\n end\n end\n end\n end", "def milestone_params\n params.require(:milestone).permit(:name, :expanded)\n end", "def list(*args)\n arguments(args, required: [:user, :repo]) do\n permit VALID_MILESTONE_OPTIONS.keys\n assert_values VALID_MILESTONE_OPTIONS\n end\n\n response = get_request(\"/repos/#{arguments.user}/#{arguments.repo}/milestones\", arguments.params)\n return response unless block_given?\n response.each { |el| yield el }\n end", "def milestone_params\n params.require(:milestone).permit(:project_id, :milestone,\n :release_date, :name)\n end", "def index\n @project = Project.find_by_id(params[:project_id])\n @phase = Project::Phase.find_by_id(params[:phase_id])\n @project_phase_milestones = Project::Phase::Milestone.where(project_phases_id: params[:phase_id])\n end", "def milestone_commit?\n self.milestones.collect(&:version_number).include? self.logical_version_number - 1\n end", "def deploy_as_parent_is_qr_qwr\n for project in Project.find(:all, :conditions => [\"is_qr_qwr = 1\"]).select { |p| !p.is_ended}\n project.milestones.select{ |m1| m1.checklist_not_applicable==0 and m1.status==0 and m1.done==0 and self.milestone_names.map{|mn| mn.title}.include?(m1.name)}.each do |milestone|\n i = ChecklistItem.find(:first, :conditions=>[\"template_id=? and milestone_id=? and request_id IS NULL and project_id IS NULL\", self.id, milestone.id])\n if i == nil\n ChecklistItem.create(:milestone_id=>milestone.id, :parent_id=>0, :template_id=>self.id)\n end\n end\n end\n end", "def project_with_some_tasks(user, options = {})\n task_count = options[:task_count] || 2\n customer = options[:customer] || user.company.internal_customer\n make_milestones = options[:make_milestones]\n\n project = Project.make(:company => user.company, \n :customer => customer)\n perm = project.project_permissions.build(:user => user)\n perm.set(\"all\")\n project.save!\n\n if make_milestones\n 2.times { project.milestones.make }\n end\n\n task_count.times do\n t = Task.make_unsaved(:project => project, :company => project.company)\n t.users << user\n t.milestone = project.milestones.rand\n t.save!\n end\n\n return project\n end", "def set_milestone\r\n @milestone = Milestone.find(params[:id])\r\n end", "def post_milestone_mode(post_milestone, post_failed_run_milestone)\n if post_milestone\n return POST_MILESTONE_MODE.successful_runs_and_final_level_only unless post_failed_run_milestone\n POST_MILESTONE_MODE.all\n else\n POST_MILESTONE_MODE.final_level_only\n end\n end", "def set_milestone\n @milestone = Milestone.find(params[:id])\n end", "def set_milestone\n @milestone = Milestone.find(params[:id])\n end", "def set_milestone\n @milestone = Milestone.find(params[:id])\n end", "def completed(target_milestone, start_date, end_date, opts=Hash.new)\n new({:target_milestone => target_milestone,\n :resolution => [:fixed],\n :priority => %w(--- P1 P2 P3),\n :start_date => start_date,\n :end_date => end_date\n }.merge(opts))\n end", "def tasks_for_timeline\n tasks_f_time ||= []\n milestones.each do |mile|\n mile.tasks.each do |task|\n task.update(start_date: start_date) if task.start_date.nil?\n task.update(end_date: task.start_date + task.pm_duration_estimation.days) if task.end_date.nil?\n tasks_f_time << [task.name + ' | ' + mile.name + ' | ' + task.advance_percentage.to_s + \"% \", task.start_date, task.end_date]\n end\n end\n tasks_f_time\n end", "def project_phase_milestone_params\n params.fetch(:project_phase_milestone, {}).permit(:name, :description)\n end", "def create(user_name, repo_name, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n\n normalize! params\n filter! VALID_MILESTONE_INPUTS, params\n assert_required_keys(%w[ name ], params)\n\n post_request(\"/1.0/repositories/#{user}/#{repo.downcase}/issues/milestones\", params)\n end", "def as_milestone(xml)\n xml.milestone(lifecycle,\n date: updated_at.to_time.iso8601,\n version: version)\n end", "def delete_milestone(project, id)\n delete(\"/projects/#{url_encode project}/milestones/#{id}\")\n end", "def update\n previous_completed = @task.completed\n previous_deadline = @task.deadline\n previous_owner = @task.user\n new_owner = User.find_by(id: params[:task][:user_id])\n task_owner = @task.user\n project = @task.milestone.project\n success = @task.milestone.success\n\n #you can STILL edit tasks when the project becomes a success\n if project.present?\n project_owner = @task.milestone.project.user\n else\n success_owner = @task.milestone.success.leader\n end\n\n if !params[:task][:deadline].nil?\n new_deadline = params[:task][:deadline]\n if new_deadline != previous_deadline && current_user != task_owner\n task_owner.notify(\"alert\", \"#{view_context.link_to current_user.full_name, current_user} changed the due date of\n #{view_context.link_to @task.description, @task.milestone.project} to #{new_deadline}\")\n end\n end\n\n #Notify a task was completed\n if params[:task][:completed] == \"true\" && current_user != task_owner\n task_owner.notify(\"alert\", \"Your task '#{@task.description}' in #{view_context.link_to project.title, project} was completed by #{view_context.link_to current_user.full_name, current_user}\")\n end\n\n #notifies user they have a new task\n if !new_owner.nil? && new_owner != current_user && new_owner != task_owner\n if @task.milestone.project.present?\n new_owner.notify(\"alert\", \"You were assigned to a task in the project #{view_context.link_to @task.milestone.project.title, project}\")\n else\n new_owner.notify(\"alert\", \"You were assigned to a task in the success #{view_context.link_to @task.milestone.success.title, success}\")\n end\n end\n\n modified_params = task_params.clone\n if modified_params[:completed] == \"true\"\n modified_params.merge!({completed_at: DateTime.now})\n next_task = Task.find_by_position_and_milestone_id((@task.position - 1), @task.milestone_id)\n if next_task.present?\n next_task.ball_is_in_your_court(@task) if next_task.user.present? && next_task.crucial == true\n end\n elsif modified_params[:completed] == \"false\"\n modified_params.merge!({completed_at: nil})\n end\n\n respond_to do |format|\n if @task.update_attributes(modified_params)\n @task.create_activities(previous_completed, previous_deadline, previous_owner, current_user)\n\n # during update, if there is 1 last task remaining already and someone is updating client's remaining incomplete task the project owner will be notified every time\n # user!=project_owner ensures that if the changes are made by the project_owner, client is not notified (since client can see it)\n if @task.milestone.tasks.where(completed: false).size==1 && (task_owner!=project_owner || task_owner!=project_owner) && params[:task][:completed]\n\n # if never_alerted (which should be a boolean that shows if there already was a notification from this task)\n if project.present?\n project_owner.notify(\"alert\", \"One task left until #{view_context.link_to @task.milestone.name, project} is completed!\")\n else\n success_owner.notify(\"alert\", \"One task left until #{view_context.link_to @task.milestone.name, success} is completed!\")\n end\n end\n\n # user id gets saved as 0 sometimes when being set as nil. this changes it back\n if @task.user_id == 0\n @task.update_attributes(user_id: nil)\n end\n\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n if project.present?\n format.html { redirect_to project, notice: 'Task was successfully updated.' }\n else\n format.html { redirect_to success, notice: 'Task was successfully updated.' }\n end\n format.json { respond_with_bip(@task) }\n else\n if project.present?\n format.html { redirect_to project, alert: @task.errors.full_messages.to_sentence }\n else\n format.html { redirect_to success, alert: @task.errors.full_messages.to_sentence }\n end\n format.json { respond_with_bip(@task) }\n end\n end\n end", "def sync_with_lighthouse\n results = Lighthouse.get_milestone(self.remote_id, self.project.remote_id, self.project.token.account, self.project.token.token)\n return false unless milestone = results[\"milestone\"]\n self.update(:name => milestone[\"title\"], :due_on => milestone[\"due_on\"], :tickets_count => milestone[\"tickets_count\"], :open_tickets_count => milestone[\"open_tickets_count\"])\n if !self.active?\n self.update(:closed_at => Time.now)\n else\n self.update(:closed_at => nil) if !self.closed_at.nil?\n end\n\n tickets = Lighthouse.get_milestone_tickets(self.name, self.project.remote_id, self.project.token.account, self.project.token.token)\n ticket_ids = tickets ? tickets.collect{ |t| t[\"number\"] }.join(\",\") : \"\"\n total_left = 0.0\n total_elapsed = 0.0\n \n if tickets\n tickets.each { |t|\n tags = t['tag']\n if tags.nil?\n next\n end\n all_tags = tags.split(\" \")\n if all_tags.nil?\n next\n end\n all_tags.each do |tag|\n splitsville = tag.split(\":\")\n \n if splitsville.size == 2 and splitsville[0] == \"hours\"\n if t['state'] == \"open\" or t['state'] == \"new\" then\n total_left += splitsville[1].to_f\n end\n end\n if splitsville.size == 2 and splitsville[0] == \"elapsed\" then\n total_elapsed += splitsville[1].to_f\n end\n end\n }\n end\n \n existing_event = self.milestone_events.first(:created_on.gte => Date.today, :milestone_id => self.id)\n if (existing_event)\n existing_event.update(:open_tickets => ticket_ids, :hours_left => total_left, :hours_elapsed => total_elapsed)\n else\n self.milestone_events.create(:open_tickets => ticket_ids, :hours_left => total_left, :hours_elapsed => total_elapsed)\n end\n end", "def milestone_counts(milestones)\n counts = milestones.reorder(nil).group(:state).count\n\n {\n opened: counts['active'] || 0,\n closed: counts['closed'] || 0,\n all: counts.values.sum || 0\n }\n end", "def milestone!(&block)\n annotations = Memories::Annotation.new\n annotations.instance_eval(&block) if block\n self.milestone_memories << {:version => self.rev, :annotations => annotations.to_hash}\n self.save\n end", "def milestone_params\n params.require(:milestone).permit(:name, :description, :date_begin, :date_end, :user_id, :asociative_user_id)\n end", "def create_single(project)\n request_body = \"<request>\" + self.to_xml(:skip_instruct => true) + \"</request>\"\n response = connection.post(\"/projects/#{project.id}/milestones/create\",\n request_body,\n XML_REQUEST_HEADERS)\n load(self.class.format.decode(response.body).first)\n end", "def new\n \tshipment = Shipment.find(params[:shipment_id]) \t\n \t@milestone = shipment.milestones.new\n end", "def update_milestone(id, data, move = false, move_off_weekends = false)\n record \"/milestones/update/#{id}\", :milestone => data,\n :move_upcoming_milestones => move,\n :move_upcoming_milestones_off_weekends => move_off_weekends\n end", "def index\n add_breadcrumb :planning\n\n @sprints = @project.sprints.not_running\n @issues = @project.backlog_items.not_completed.where(:sprint_id => nil)\n end", "def close_milestones(version_name, options = {})\n project_id = options[:project_id] || ENV[\"CI_PROJECT_ID\"]\n\n select_milestones(project_id, version_name).each do |milestone|\n @client.edit_milestone(project_id, milestone.id, state_event: 'close')\n end\n end", "def get(user_name, repo_name, milestone_id, params={})\n _update_user_repo_params(user_name, repo_name)\n _validate_user_repo_params(user, repo) unless user? && repo?\n _validate_presence_of milestone_id\n normalize! params\n\n get_request(\"/1.0/repositories/#{user}/#{repo.downcase}/issues/milestones/#{milestone_id}\", params)\n end", "def update_milestone(id, data, move=false, move_off_weekends=false)\n record \"/milestones/update/#{id}\", :milestone => data,\n :move_upcoming_milestones => move,\n :move_upcoming_milestones_off_weekends => move_off_weekends\n end", "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 task_milestone_tip(task)\n return if task.milestone_id.to_i <= 0\n\n return task_tooltip([ [ _(\"Milestone Due Date\"), formatted_date_for_current_user(task.milestone.due_date) ] ])\n end", "def process_issues rmp_id, force_new_task = false\n\n (1..$msp.Tasks.Count).each do |i|\n\n # check msp task\n next unless mst = $msp.Tasks(i)\n\n is_group = (mst.OutlineChildren.Count > 0)\n process_issue rmp_id, mst, force_new_task, is_group\n\n end\nend", "def milestone_string number\n milestone_translation.each do |hash|\n if hash['id'] == number\n return hash['title']\n end\n end\n 'Unknown'\nend", "def create_milestone(project, title, options = {})\n body = { title: title }.merge(options)\n post(\"/projects/#{url_encode project}/milestones\", body: body)\n end", "def add_milestone\n Milestone.create(\n :project_id => self.project_id, \n :milestone_type => \"Feedback\",\n :description => self.user.username + \" has submitted feedback on \" + self.project.name\n )\n end", "def relative_progress\n if stages.any?\n from_stages = stages.collect{ |pr| pr.relative_progress }.sum\n end\n sum=(relative_milestone.to_f / milestones) * relative_expected_percentage\n sum + from_stages.to_f\n end", "def restart\n budget.restart\n cost_payment_plan.restart\n self.update(actual_week: 0, status: 'Inicio')\n milestones.map { |mile| mile.restart }\n end" ]
[ "0.7398543", "0.7002436", "0.6820392", "0.6820392", "0.67348146", "0.67230606", "0.66622704", "0.6596266", "0.65128094", "0.6463661", "0.6451744", "0.62752205", "0.6269852", "0.6267551", "0.6238759", "0.6152995", "0.61336654", "0.6023673", "0.60065", "0.6004077", "0.5991004", "0.5952667", "0.5949501", "0.5948847", "0.59338945", "0.59190995", "0.5879646", "0.58650154", "0.5854988", "0.5812047", "0.579513", "0.5762321", "0.5741917", "0.57335025", "0.5691569", "0.5691569", "0.5684327", "0.5680372", "0.5680372", "0.5653217", "0.5652625", "0.5604477", "0.55974466", "0.55974466", "0.5564948", "0.5563104", "0.5525012", "0.5517899", "0.55158794", "0.5482498", "0.547898", "0.5470244", "0.54618174", "0.54611456", "0.54611456", "0.544387", "0.5427559", "0.53876007", "0.5371897", "0.5347108", "0.53400016", "0.5327516", "0.5324895", "0.53181714", "0.5307561", "0.52955997", "0.52772176", "0.5272441", "0.5266575", "0.5261862", "0.52518475", "0.52496475", "0.52496475", "0.52496475", "0.5221783", "0.5206359", "0.519899", "0.51950186", "0.5193228", "0.51864547", "0.5174062", "0.51717705", "0.5171096", "0.51650023", "0.51385236", "0.51334786", "0.51292175", "0.5116002", "0.5107751", "0.5078058", "0.50773907", "0.5064433", "0.50505626", "0.50372905", "0.5015919", "0.5008726", "0.4997801", "0.49960274", "0.49940956", "0.4993383" ]
0.73773223
1
TODO: write 'remaining_hours' method.
def remaining_hours end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remaining_hours_by_day\n values_by_day(0, true) { |x| model.remaining_hours_for_day_number(x) }\n end", "def get_time_remaining\n\n end", "def hours_left\n remaining = WorkingTime::Interval.new(self, close_of_business)\n return remaining.duration\n end", "def remaining_str()\n return \"expired\" if isover?\n\n diff = (@end_time - Time.now).floor\n diff, seconds = diff.divmod 60\n diff, minutes = diff.divmod 60\n diff, hours = diff.divmod 24\n days = diff\n\n str = ''\n str += \"#{days}d\" if days != 0\n str += \"#{hours}h\" if hours != 0\n str += \"#{minutes}m\" if minutes != 0\n str += \"#{seconds}s\" if seconds != 0\n \"#{str} remaining\"\n end", "def get_remaining_hours(logged_hours, estimated_hours, logged_ratio, remaining_ratio)\n if logged_ratio > 0\n remaining_hours = Integer(logged_hours.to_f/logged_ratio.to_f*remaining_ratio)\n else\n remaining_hours = Integer(estimated_hours.to_f*remaining_ratio/100)\n end\n remaining_hours += 1 if remaining_hours == 0\n remaining_hours\n 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 time_remaining\n end", "def time_remaining\n\n end", "def remaining_time()\n return @total_time_units - @done_time_units\n end", "def hours ; self * 60.minutes ; end", "def hours\n self.to_i * 3_600\n end", "def calc_hours_till\n (calc_mins_till / 60.00).round(2)\n end", "def get_hours()\n\n return self.hours\n\nend", "def hours() 60 * minutes end", "def get_expiry_hours(event)\n \n hours_left = (event.event_date - event.created_at) / 60 / 60\n \n if hours_left >= 36\n #return 24.hours\n return 8.hours\n elsif hours_left < 24\n return 5.hours\n end\n\n return 12.hours\n\nend", "def total_hours\n ('%.02f' % ((ends_at - starts_at) / 1.hour)).to_f\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 timeRemaining(t1)\n\t\treturn subtract(t1,getCurrentTime)\n\tend", "def hours ; Duration[self * 3600] ; end", "def hours\n fail \"A value is required for #{__method__}\" unless @value\n return \"0/#{@value}:0:0\"\n end", "def minutes_remaining\n time_elapsed = (Time.new - @start_time) / 60\n (@total_paid * 60 - time_elapsed).floor\n end", "def hours\n self * SECONDS_IN_HOUR\n end", "def hours\n \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 spent_hours\n @spent_hours ||= time_entries.sum(:hours) || 0\n end", "def hours\n return \"There are #{self * (60 * 60)} seconds in #{self} hours\"\n end", "def paid_days_remaining\n days_elapsed = (Time.now.to_i - self.trial_started_at.to_i) / 60 / 60 / 24\n remaining = 365 - days_elapsed\n remaining = 0 if remaining < 0\n remaining\n end", "def days_remaining\n (self.program_budge.duration_in_days+1) - self.day_of_budge\n end", "def remaining_days\n self.paid_through - Date.today\n end", "def hours_until_next_allowed\n ((created_at - RECENT_PERIOD.ago) / 3600).to_i\n end", "def hours_until_next_allowed\n ((created_at - RECENT_PERIOD.ago) / 3600).to_i\n end", "def hours\n\t\treturn self * 60.minutes\n\tend", "def hours\n\t\treturn self * 60.minutes\n\tend", "def hours(ctx)\n return ctx.shift_hours if earning_tests.none?\n\n earning_tests.map { |test| test.hours(ctx) }.min\n end", "def hours; self * HOUR; end", "def in_hours\n Duration::new(seconds: @seconds).to_hours\n end", "def formatted_hours\n as_hours hours\n end", "def formatted_hours\n as_hours hours\n end", "def hours; self * HOUR; end", "def total_hours\n approved_flights.sum(:duration)\n end", "def hours\n _nudge[0]\n end", "def hrs\n self / 24.0\n end", "def hours_until_next_allowed_str\n number_hours = hours_until_next_allowed\n \"#{number_hours} #{'hour'.pluralize(number_hours)}\"\n end", "def hours_until_next_allowed_str\n number_hours = hours_until_next_allowed\n \"#{number_hours} #{'hour'.pluralize(number_hours)}\"\n end", "def hours_available_for(user)\n milestone_resource = milestone_resources.where(resource_id: user).first\n self.duration.to_f * milestone_resource.try(:available_hours_per_day).to_f\n end", "def estimated_hours\n return @estimated_hours if defined?(@estimated_hours)\n\n @estimated_hours = nil\n\n @estimated_hours = issue.estimated_hours if issue\n end", "def hours_until_expiration(now=Time.now)\n distance_in_hours = seconds_until_expiration(now)/SECONDS_IN_A_HOUR\n distance_in_hours.floor\n end", "def hours\n response[\"hours\"]\n end", "def uninvoiced_hours\n @uninvoiced_hours ||= uninvoiced_timers.map(&:hours).sum\n end", "def hours(user_id)\n return self.user_events.find_by(user_id: user_id).hours || 0\n end", "def hours\n @seconds.abs / 60 / 60 * (@seconds < 0 ? -1 : 1)\n end", "def total_day_remaining\n return nil unless total_day && total_day_usage\n\n total_day - total_day_usage\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 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 hours\n\n today = Date.today\n hours = {}\n #if @traveler.is_visitor? or @traveler.is_api_guest? #Return a wide range of hours\n if not @traveler or not @traveler.registered?\n (0..30).each do |n|\n hours[(today + n).to_s] = {open: \"07:00\", close: \"22:00\"}\n end\n\n else # This is not a guest, check to see if the traveler is registered with a service\n\n # NOTE(wilsonj806) For now this implementation does not let registered users\n #...book trips on weekends. Eventually we want to change that so they can do so\n\n if @traveler.booking_profiles.count > 0 #This user is registered with a service\n booking_profile = @traveler.booking_profiles.first\n service = booking_profile.service\n\n min_notice_days = (service.booking_details[:min_days] || 2).to_i\n max_notice_days = (service.booking_details[:max_days] || 14).to_i\n\n \n if service.booking_details[:trusted_users] and booking_profile.external_user_id.in? service.booking_details.try(:[], :trusted_users).split(',').map{ |x| x.strip }\n (1..21).each do |n|\n hours[(today + n).to_s] = {open: \"00:00\", close: \"23:59\"}\n end\n elsif service.schedules.count > 0 #This user's service has listed hours. This is the most common case.\n \n #Find out if we are past the cutoff for today. If so, start counting from tomorrow\n if service.booking_details[:cutoff_time] and (Time.now.in_time_zone.seconds_since_midnight > service.booking_details[:cutoff_time].to_i)\n day = Time.now + 1.days \n else\n day = Time.now\n end\n \n biz_days_count = 0\n (0..max_notice_days).each do |n|\n if service.open_on_day? day\n if biz_days_count >= min_notice_days\n schedule = service.schedules.where(day: day.wday).first\n if schedule\n hours[day.strftime('%Y-%m-%d')] = {open: schedule.schedule_time_to_military_string(schedule.start_time), \n close: schedule.schedule_time_to_military_string(schedule.end_time)}\n end\n end\n biz_days_count += 1\n end\n day = day + 1.days \n end\n\n else #This user is registered with a service, but that service has not entered any hours\n\n (min_notice_days..max_notice_days).each do |n|\n unless (today + n).saturday? or (today + n).sunday?\n hours[(today + n).to_s] = {open: \"08:00\", close: \"17:00\"}\n end\n end\n\n end\n\n else #This user is logged in but isn't registered with a service\n\n (1..14).each do |n|\n unless (today + n).saturday? or (today + n).sunday?\n hours[(today + n).to_s] = {open: \"08:00\", close: \"17:00\"}\n end\n end\n\n end # if #traveler.user_profile.user_services.count > 0\n end # if @travler.is_visitor\n\n render status: 200, json: hours\n\n end", "def hours_until_close\n (self.closing_date.to_time - Time.zone.now.to_time) / 1.hours\n end", "def four_hours\n self.range('4hr')\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 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 total_hours_per_week\n exsisting_shift_hour = Schedule.where(start_time: Date.today-7..Date.today, employee_id: self.employee_id).sum('shift_hour')\n current_shift_hour = self.id.present? ? 0 : (self.end_time - self.start_time)/3600\n if (current_shift_hour + exsisting_shift_hour) > 40\n errors.add(:start_time, 'must be less than equal to 40 per week')\n end\n end", "def has_hours?\n return ( total() > 0.0 )\n end", "def amount_remaining\n @desired_amount - @bought_amount\n end", "def get_days_remaining_with\n remaining = self.user.days_remaining(from_date)\n if !is_actually_deduced? && !is_non_deduce_leave\n remaining -= actual_leave_days\n end\n return remaining\n end", "def remaining_total\n total\n end", "def total_hours(start,finish)\n total=0\n start.upto(finish) {|day|\n total+=@values[day].total\n }\n return total\n end", "def total_hours\n staffing.present? ? staffing.total_client_hours : nil\n end", "def total_working_hours_balance\n @total_working_hours_balance\n end", "def show\n @hours_remaining = (@student.contract.remaining_hours>0)\n end", "def get_otp_remaining_time\n (Time.now.utc.to_i / 30 + 1) * 30 - Time.now.utc.to_i\n end", "def working_hours_balance\n @working_hours_balance\n end", "def time_remaining(end_time)\n remaining = (end_time - Time.now).ceil\n format_countdown(remaining)\n end", "def getDurationHours\r\n\t\t\t\t\treturn @durationHour\r\n\t\t\t\tend", "def remaining\n (Time.now - @last_scrape).to_i \n end", "def fuel_hours\n (fuel_blocks / fuel_per_hour).floor\n end", "def hours\n value_parts[0]\n end", "def hours\n value_parts[0]\n end", "def weekly_hours\n worked_hours\n end", "def days_remaining\n enrollment.days_to_due_date - 1\n end", "def working_hours\n return @working_hours\n end", "def advance_hours(hours)\n self + (hours * 60 * 60)\n end", "def get_working_hours_total\n @total_hours = 0.0\n unless @saved_time_entries.empty?\n @total_hours = @saved_time_entries.map(&:actual_duration).inject(0) do |total,duration|\n actual_duration = @dur_setng_is_one100th ? one_hundredth_timediffernce(duration) : one_tenth_timediffernce(duration)\n total.to_f.roundf2(2) + actual_duration.to_f\n end\n @total_hours = @total_hours.to_f.roundf2(2)\n end\n @total_hours || 0.0\n end", "def hours_planned\n hours_planned = 0\n project_tasks.each do |project_task|\n hours_planned += project_task.hours_planned\n end\n hours_planned\n end", "def absolute_hour(seconds); end", "def hours\n fail \"A value is required for #{__method__}\" unless @value\n fail 'A value cannot be > 24' if @value > 24\n fail 'A value cannot be <= 0' if @value <= 0\n return 'daily' if @value == 24\n\n \"0/#{@value}:0:0\"\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_remaining( address )\n address = encode( address )\n get(\"/timeremaining/#{address}\")\n end", "def remaining\n [0, @duration - elapsed].max\n end", "def round_hours\n self.hours = self.hours.round_to_half\n self.impact = 'None' if self.hours == 0.0\n 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 hours\n seconds / 3600\n end", "def ticket_estimate_in_hours(estimated_minutes)\n (estimated_minutes.to_f / 60).round\n end", "def total_minutes\n hours * 60 + minutes\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 add_hours(hours = 1)\n hours = hours.to_i\n cur_hour = @t_hour\n next_hour = cur_hour + hours\n \n if next_hour >= 24\n @t_hour = 0\n self.add_days(1)\n hours_left = (hours - 1) - (24 - cur_hour)\n self.add_hours(hours_left) if hours_left > 0\n elsif next_hour < 0\n @t_hour = 23\n self.add_days(-1)\n hours_left = hours + cur_hour + 1\n self.add_hours(hours_left) if hours_left < 0\n else\n @t_hour = next_hour\n end\n \n return self\n end", "def validate_time_total(hash, date)\n if hash.values.map(&:to_i).inject(:+) > (MINUTES_PER_HOUR * HOURS_IN_DAY)\n session[:message] = \"You cannot exceed 24 hours in a day. Please try again.\"\n redirect \"/edit_activities/\" + date\n end\n hash\n end", "def quarter_hours\n partial_hours_from_minutes(minutes)\n end", "def working_hours=(value)\n @working_hours = value\n end", "def added\n (@remaining_at_end + @completed) - @remaining_at_start unless @remaining_at_end.nil? || @completed.nil? || @remaining_at_start.nil?\n end", "def time_remaining\n return 0 if finished_at\n backup_source_jobs.map(&:time_remaining).sum\n end" ]
[ "0.735803", "0.711464", "0.7050904", "0.6863293", "0.68260074", "0.6825142", "0.6747123", "0.6740025", "0.6712422", "0.6638831", "0.65863854", "0.6571771", "0.6560081", "0.6541136", "0.6513608", "0.6492945", "0.64909554", "0.6487408", "0.6466897", "0.64453876", "0.6425149", "0.6414489", "0.63997674", "0.63722885", "0.6368227", "0.63677007", "0.636713", "0.63514274", "0.63510853", "0.63310903", "0.63310903", "0.6327684", "0.6327684", "0.6308525", "0.6306434", "0.6305177", "0.6304262", "0.6304262", "0.63038", "0.62940866", "0.6292638", "0.62886035", "0.6270338", "0.6270338", "0.6269478", "0.626333", "0.62562937", "0.6254726", "0.6240561", "0.6196357", "0.61913663", "0.6188732", "0.6170793", "0.61661565", "0.6157334", "0.6153254", "0.61491734", "0.6137637", "0.6122286", "0.611897", "0.6109936", "0.61089194", "0.610258", "0.60991836", "0.60891795", "0.60799646", "0.60757154", "0.60612893", "0.606035", "0.60600704", "0.60383976", "0.60350585", "0.6034821", "0.60290253", "0.60277003", "0.6009917", "0.6009917", "0.60089976", "0.6008172", "0.6005594", "0.6004745", "0.60028213", "0.5977122", "0.59698284", "0.594956", "0.5945349", "0.59378856", "0.59318763", "0.59196645", "0.5907805", "0.59076333", "0.5889669", "0.58848894", "0.587786", "0.587717", "0.58517337", "0.5850706", "0.5850436", "0.5828545", "0.58210826" ]
0.8523543
0
This is also an important method in the software (however simple).
def next_charge ( pre_finalised_quote * relative_progress / 100 ) - charged_so_far end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def suivre; end", "def terpene; end", "def used?; end", "def berlioz; end", "def weber; end", "def ibu; end", "def verdi; end", "def anchored; end", "def who_we_are\r\n end", "def intensifier; end", "def gounod; end", "def pausable; end", "def internal; end", "def refutal()\n end", "def hiss; end", "def stderrs; end", "def identify; end", "def implementation; end", "def implementation; end", "def isolated; end", "def isolated; end", "def zuruecksetzen()\n end", "def internship_passed; end", "def custom; end", "def custom; end", "def missing?; end", "def blg; end", "def user_os_complex\r\n end", "def herald; end", "def ignores; end", "def missing; end", "def formation; end", "def issn; end", "def jack_handey; end", "def placebo?; false end", "def usable?; end", "def internal?; end", "def celebration; end", "def dh; end", "def offences_by; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def villian; end", "def rossini; end", "def extra; end", "def scientist; end", "def how_it_works\r\n end", "def available; end", "def available; end", "def pass; end", "def pass; end", "def escaper; end", "def trd; end", "def standalone; end", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def spec; end", "def spec; end", "def ext; end", "def ext; end", "def silly_adjective; end", "def tiny; end", "def feruchemist; end", "def same; end", "def semact?; false; end", "def missing?; false; end", "def strain; end", "def external; end", "def final; end", "def original; end", "def operations; end", "def operations; end", "def hd\n \n end", "def bellini; end", "def loc; end", "def loc; end", "def loc; end", "def romeo_and_juliet; end", "def sitemaps; end", "def schumann; end", "def whiny; end", "def leeway; end", "def leeway; end", "def check ; true ; end", "def malts; end", "def strategy; end", "def spice; end", "def appraisals; end" ]
[ "0.7372562", "0.69067717", "0.6714965", "0.6540472", "0.6540472", "0.6540472", "0.6540472", "0.64493006", "0.6347023", "0.62172866", "0.61877954", "0.61691016", "0.6150092", "0.6142994", "0.6111192", "0.61104184", "0.6036329", "0.6030139", "0.60179806", "0.60087395", "0.60035", "0.59980464", "0.5993489", "0.59730244", "0.59511846", "0.59511846", "0.59326667", "0.59326667", "0.59264463", "0.59231544", "0.5907011", "0.5907011", "0.58636534", "0.585848", "0.58518654", "0.58421046", "0.5832831", "0.58327746", "0.58198756", "0.58166003", "0.580513", "0.580074", "0.57898897", "0.5784363", "0.57833576", "0.57678723", "0.57651246", "0.5763797", "0.5763797", "0.5763797", "0.5763797", "0.5763797", "0.5763797", "0.5763797", "0.5763797", "0.5763797", "0.5763414", "0.57633877", "0.5752515", "0.57434267", "0.5741028", "0.57243115", "0.57243115", "0.57211304", "0.57211304", "0.57137376", "0.570838", "0.5702669", "0.5687777", "0.56825566", "0.56825566", "0.5680749", "0.5680749", "0.56783867", "0.567359", "0.5670966", "0.5669595", "0.5664788", "0.5657171", "0.56537706", "0.56491315", "0.56446946", "0.5631378", "0.5621613", "0.5621613", "0.56176865", "0.56168944", "0.56138754", "0.56138754", "0.56138754", "0.5605221", "0.5601852", "0.5593795", "0.55926096", "0.5585463", "0.5585463", "0.55731344", "0.5570748", "0.5568563", "0.5566249", "0.5560901" ]
0.0
-1
OPTIONS handle: The string to always use as handle. toggle_handle: The string handle to swap once. toggled_handle: The string handle to swap back once. visible: Whether to show the visible part or the other.
def toggle_block(options={}, &block) visible = options.has_key?(:visible) ? options[:visible] : true escapable = options.has_key?(:escapable) ? options[:escapable] : false out = "<span class='toggle_block'>" if options[:handle] out << "<span class='toggle_block_content'>#{capture(visible, &block)}</span>" out << "<span class='toggled_block_content' style='display: none;'>#{capture(!visible, &block)}</span>" out << handle_element(options[:handle]) else if options[:toggle_handle] out << "<span class='toggle_block_content'>#{capture(visible, &block)}#{handle_element(options[:toggle_handle])}</span>" else out << "<span class='toggle_block_content toggle_block_handle'>#{capture(visible, &block)}</span>" end if options[:toggled_handle] out << "<span class='toggled_block_content' style='display: none;'>#{capture(!visible, &block)}#{handle_element(options[:toggled_handle])}</span>" else out << "<span class='toggled_block_content toggle_block_handle' style='display: none;'>#{capture(!visible, &block)}</span>" end end out << "</span>" raw out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle\n set_switch(!self.switch) if @switch\n end", "def toggle\n if style![:display] == :none\n show\n else\n hide\n end\n end", "def toggle\n if visible?\n hide\n\n else\n show\n\n end\n end", "def toggle\n if on?\n off\n else\n on\n end\n end", "def toggle\n style[:hidden] = !style[:hidden]\n update_visibility\n end", "def toggle(*names)\r\n extract_and_apply_options!(names)\r\n \r\n names.each do |name|\r\n include?(name) ? delete(name) : push(name)\r\n end\r\n \r\n clean! \r\n self\r\n end", "def toggle\n\t\t@toggle ||= Toggle.new(self)\n\tend", "def toggle\n @toggle ||= toggle_class.new(self)\n end", "def toggle\n\t\tstr = \"\"\n\t\t$togglelist_array.each{|a| str += a[1][2] + \",\"}\n\t\tstr.chop!\n\t\t$screen.write_message(str)\n\t\tc = Curses.getch\n\t\teval($togglelist[c][0])\n\t\t$screen.write_message($togglelist[c][1])\n\tend", "def toggle\n set_switch(!self.switch) if @switch\n method(@method).call(self.switch) if @method\n end", "def has_split_toggles\n options.has_key?(:toggles) && options[:toggles].eql?(\"split\")\n end", "def link_to_visibility_toggle(options = {})\r\n options[:of] ||= '$(this.parentNode).next()'\r\n options[:default_visible] = true if options[:default_visible].nil?\r\n\r\n link_text = options[:default_visible] ? 'hide' : 'show'\r\n link_to_function as_(link_text), \"e = #{options[:of]}; e.toggle(); this.innerHTML = (e.style.display == 'none') ? '#{as_('show')}' : '#{as_('hide')}'\", :class => 'visibility-toggle'\r\n end", "def toggle\n cmd = \"{\\\"id\\\":7,\\\"method\\\":\\\"toggle\\\",\\\"params\\\":[]}\\r\\n\"\n request(cmd)\n end", "def draw_switchable(control, index)\n end", "def link_to_visibility_toggle(options = {})\r\n options[:of] ||= '$(this.parentNode).next()'\r\n options[:default_visible] = true if options[:default_visible].nil?\r\n\r\n link_text = options[:default_visible] ? 'hide' : 'show'\r\n link_to_function as_(link_text), \"e = #{options[:of]}; e.toggle(); this.innerHTML = (e.style.display == 'none') ? '#{as_('show')}' : '#{as_('hide')}'\", :class => 'visibility-toggle'\r\n end", "def toggle(switch)\n switch == 1 ? 0 : 1\nend", "def toggle_state\n puts \"******* toggle_state *******\"\n end", "def sync(toggle)\n self.sync_up = toggle\n self.sync_down = toggle\n end", "def toggle!\n if status\n off!\n return false\n else\n on!\n return true\n end\n end", "def toggle\n\t\t@gridOn = !@gridOn\n\tend", "def show_control(**opt)\n opt[:label] ||= 'Show' # TODO: I18n\n opt[:path] ||= show_path\n button_link(**opt)\n end", "def switch(*names)\n names = [names].flatten\n verify_unused(names,flags,switches,\"in global options\")\n switch = Switch.new(names,@@next_desc,@@next_long_desc)\n switches[switch.name] = switch\n clear_nexts\n end", "def toggle_state\n state\n end", "def switch(*names)\n names = [names].flatten\n GLI.verify_unused(names,flags,switches,\"in command #{name}\")\n switch = Switch.new(names,@next_desc,@next_long_desc)\n switches[switch.name] = switch\n clear_nexts\n end", "def show; @showing = false; end", "def switch_control()\n @switch\n end", "def hide_hid!\n @hide_hid = true\n end", "def toggle_help\n @help_window.toggle_text\n end", "def toggle(instance)\n # do nothing\n end", "def visible=(vis)\n if vis\n show\n else\n hide\n end\n end", "def switch(*names)\n options = extract_options(names)\n names = [names].flatten\n\n verify_unused(names)\n switch = Switch.new(names,options)\n switches[switch.name] = switch\n\n clear_nexts\n switches_declaration_order << switch\n switch\n end", "def visible=(bool)\n make_visible !!bool\n end", "def variant!\n @control = false\n end", "def DefProperties\n super\n defProperty('switchOff', 'no', \"set to yes to ask to switch off and then on an interface after a channel change\")\n end", "def visible=(bool)\n if @back\n @back.visible = bool\n end\n super(bool)\n end", "def visible=(bool)\n if @back\n @back.visible = bool\n end\n super(bool)\n end", "def toggle(status)\n log_power_relay_connection(:toggle) do\n toggled_status = relay_connection.toggle(outlet, status)\n if secondary_outlet\n secondary_toggled_status = relay_connection.toggle(secondary_outlet, status)\n handle_mismatch_status(status, toggled_status) if toggled_status != secondary_toggled_status\n end\n toggled_status\n end\n end", "def toggle_selection\n buffer_current.toggle_selection\n update_status_line\n end", "def toggle!\n\t\tif self.can_mark_complete?\n\t\t\tself.mark_complete!\n\t\telsif self.can_re_open?\n\t\t\tself.re_open!\n\t\tend\n\tend", "def toggle_on(outlet = 1)\n toggle(outlet, true)\n end", "def on_toggle_help\n @help_window.toggle_text\n end", "def on_toggle_help\n @help_window.toggle_text\n end", "def visible=(state)\n return false if (state ? true : false) == self.visible?\n if state\n iws = [300, 300]\n @dialog = ::UI::WebDialog.new(@title, false, @title, iws.x, iws.y, 800, 600, false)\n # Callbacks\n @dialog.add_action_callback('init') { |dlg, params|\n unless @init_called\n @init_called = true\n ds = eval(params)\n #@border_size = [iws.x - ds.x, iws.y - ds.y]\n if RUBY_PLATFORM =~ /mswin|mingw/i && @handle\n ws = AMS::Window.get_size(@handle)\n cr = AMS::Window.get_client_rect(@handle)\n cs = [cr[2] - cr[0], cr[3] - cr[1]]\n @border_size = [ws.x - cs.x, ws.y - cs.y]\n else\n @border_size = [2, 24]\n end\n end\n @sliders.each { |name, data|\n generate_slider_html(name, false)\n }\n dlg.execute_script(\"update_size();\")\n }\n @dialog.add_action_callback('size_changed') { |dlg, params|\n @size = eval(params)\n update_placement\n }\n @dialog.add_action_callback('mouse_enter') { |dlg, params|\n @mouse_over = true\n }\n @dialog.add_action_callback('mouse_leave') { |dlg, params|\n @mouse_over = false\n AMS::Sketchup.activate if RUBY_PLATFORM =~ /mswin|mingw/i\n }\n @dialog.add_action_callback('update_note') { |dlg, params|\n next if RUBY_PLATFORM !~ /mswin|mingw/i\n cmd = \"\"\n if AMS::Sketchup.is_main_window_active?\n cmd << \"$('#note1').css('display', 'none');\"\n cmd << \"$('#note2').css('display', 'none');\"\n cmd << \"$('#note3').fadeIn(750);\"\n elsif AMS::Window.is_active?(@handle)\n cmd << \"$('#note1').css('display', 'none');\"\n cmd << \"$('#note3').css('display', 'none');\"\n cmd << \"$('#note2').fadeIn(750);\"\n else\n cmd << \"$('#note2').css('display', 'none');\"\n cmd << \"$('#note3').css('display', 'none');\"\n cmd << \"$('#note1').fadeIn(750);\"\n end\n dlg.execute_script(cmd)\n }\n # Set content\n dir = File.dirname(__FILE__)\n dir.force_encoding(\"UTF-8\") if RUBY_VERSION !~ /1.8/\n url = File.join(dir, 'html/control_panel.html')\n @dialog.set_file(url)\n # Show dialog\n RUBY_PLATFORM =~ /mswin|mingw/i ? @dialog.show : @dialog.show_modal\n # Assign the on_close callback. Important: This must be called after\n # showing dialog in order to work on Mac OS X.\n @dialog.set_on_close {\n if RUBY_PLATFORM =~ /mswin|mingw/i\n AMS::Sketchup.include_dialog(@handle)\n AMS::Sketchup.remove_observer(self)\n end\n @dialog.execute_script('uninit();')\n @dialog = nil\n @handle = nil\n @mouse_over = false\n @init_called = false\n }\n # Find dialog window handle\n @handle = RUBY_PLATFORM =~ /mswin|mingw/i ? AMS::Sketchup.find_window_by_caption(@title) : nil\n if @handle\n # Add observer\n AMS::Sketchup.add_observer(self)\n # Remove dialog caption and borders\n layered = AMS::System.get_windows_version < 6.0 ? 0 : 0x00080000\n style_ex = 0x00010000 | layered # WS_EX_CONTROLPARENT | WS_EX_LAYERED\n #style = 0x54000000 # WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS\n style = 0x94000000 # WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS\n AMS::Window.lock_update(@handle)\n AMS::Window.set_long(@handle, -20, style_ex)\n AMS::Window.set_long(@handle, -16, style)\n AMS::Window.lock_update(nil)\n AMS::Window.set_pos(@handle, 0, 0, 0, 0, 0, 0x0267)\n AMS::Window.set_layered_attributes(@handle, 0, 200, 2)\n AMS::Sketchup.ignore_dialog(@handle)\n AMS::Sketchup.activate\n end\n else\n @dialog.close\n end\n true\n end", "def show_flop\r\n show_hand\r\n end", "def toggle_ahrq_header\n print \"\\n\\nSESSION is #{session[:ahrq_header]}\\n\"\n if [nil,'show'].include?(session[:ahrq_header])\n session[:ahrq_header] = 'hide'\n #print \"...SETTING IT TO 'hide'\\n\"\n else\n session[:ahrq_header] = 'show'\n #print \"...SETTING IT TO 'show'\\n\"\n end\n end", "def update_option_switch_selection(option_switch)\n if Input.trigger?(Input::B)\n Sound.play_cancel\n cancel_command()\n elsif Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT)\n old_val = $game_switches[option_switch]\n if Input.trigger?(Input::LEFT)\n $game_switches[option_switch] = true\n elsif Input.trigger?(Input::RIGHT)\n $game_switches[option_switch] = false\n end\n if old_val != $game_switches[option_switch]\n Sound.play_cursor\n @system_window.window_update()\n end\n end\n end", "def has_toggles\n options.has_key?(:toggles)\n end", "def switches \n @switches ||= {}\n end", "def set_show(val)\n self.show = val\n self\n end", "def switch(bool)\n $game_switches[Yuki::Sw::Nuzlocke_ENA] = bool\n end", "def toggle_ahrq_header\n\t\t@display = params[:display]\n\t\tval = \"show\"\n\t\tif session[:ahrq_header].nil?\n\t\t val = 'hide'\n\t\telsif session[:ahrq_header] == 'show'\n\t\t\tval = 'hide'\n end\n\t session[:ahrq_header] = val\n\t render \"shared/toggle_ahrq_header.js.erb\"\n\tend", "def toggle_menu menu_text=nil\n unless menu_text\n h = { \n # :h => :toggle_hidden, \n :c => :toggle_case, :l => :toggle_long_list , \"1\" => :toggle_columns, \n :g => :use_gui_browser, :t => :use_text_browser}\n ch, menu_text = menu \"Toggle Menu\", h\n end\n case menu_text\n when :toggle_hidden\n $hidden = $hidden ? nil : \"D\"\n refresh\n when :toggle_case\n #$ignorecase = $ignorecase ? \"\" : \"i\"\n $ignorecase = !$ignorecase\n refresh\n when :toggle_columns\n $gviscols = 3 if $gviscols == 1\n $long_listing = false if $gviscols > 1 \n x = $grows * $gviscols\n $pagesize = $pagesize==x ? $grows : x\n when :use_gui_browser\n $open_command = $browser_gui || \"open\"\n when :use_text_browser \n $open_command = $browser_text || \"elinks\"\n\n when :toggle_long_list\n $long_listing = !$long_listing\n if $long_listing\n $gviscols = 1\n $pagesize = $grows\n else\n x = $grows * $gviscols\n $pagesize = $pagesize==x ? $grows : x\n end\n refresh\n end\nend", "def ui_switch_field(content = nil, options = nil, html_options = nil, &block)\n UiBibz::Ui::Core::Forms::Choices::SwitchField.new(content, options, html_options, &block).render\n end", "def initialize(\n add_handle: true,\n delete_handle: true,\n add_naming_authority: true,\n delete_naming_authority: true,\n modify_values: true,\n remove_values: true,\n add_values: true,\n read_values: true,\n modify_administrator: true,\n remove_administrator: true,\n add_administrator: true,\n list_handles: true\n )\n @add_handle = add_handle\n @delete_handle = delete_handle\n @add_naming_authority = add_naming_authority\n @delete_naming_authority = delete_naming_authority\n @modify_values = modify_values\n @remove_values = remove_values\n @add_values = add_values\n @read_values = read_values\n @modify_administrator = modify_administrator\n @remove_administrator = remove_administrator\n @add_administrator = add_administrator\n @list_handles = list_handles\n end", "def toggle\n write((read==HIGH) ? LOW : HIGH)\n end", "def toggle_grid\n if @show_grid\n self.show_grid = false\n else\n self.show_grid = true\n end\n end", "def toggles(*args, &block)\n\n options = args.extract_options!\n label = args.first.nil? ? '' : args.shift\n\n # Pull out the label class\n label_class = options[:label_class] || @options[:default_label_class]\n options.delete :label_class\n\n # This set of toggles will conform to either the stacked or inline style\n options[:style] ||= @options[:default_toggle_style]\n raise \"Invalid style passed to toggles: #{options[:style].to_s}. Must be :stacked or :inline\" unless [:stacked, :inline].include?(options[:style])\n @toggles_style = options[:style]\n\n # Not necessary, but makes it convenient if we are using the horizontal form style\n template.content_tag :div, :class => 'form-group' do\n template.concat self.label(nil, label, :class => label_class) if label.present?\n\n\t\t\tif @options[:layout] == :horizontal\n html_class = label.present? ? @options[:default_div_class] : self.div_labelless_class\n end\n template.concat template.content_tag(:div, :class => html_class) { block.call }\n end\n end", "def pbToggleFollowingPokemon\n if $game_switches[Following_Activated_Switch]==true\n if $game_switches[Toggle_Following_Switch]==true\n $PokemonTemp.dependentEvents.remove_sprite(true)\n pbWait(1)\n $game_switches[Toggle_Following_Switch]=false\n else\n $FollowingFinishedSurfing = false\n $PokemonTemp.dependentEvents.refresh_sprite\n pbWait(1)\n $game_switches[Toggle_Following_Switch]=true\n end\n end\nend", "def set_visible_with_cascade!(state)\n set_visible(state)\n force_visibility_cascade\n self.save\n self\n end", "def toggler\n render :update do |page|\n page['help'].toggle\n # page << \"if($('toggler').innerHTML == 'help'){\"\n # page << \"$('toggler').innerHTML = ' ';\"\n # page << \"}else{\"\n # page << \"$('toggler').innerHTML = 'help';\"\n # page << \"};return false;\"\n end\n end", "def toggle\n fire\n end", "def toggle_off\n set_state_to(:off)\n end", "def openToggle()\n @openToggle_duration = @w_openToggle.animationSpeed\n if (@w_openToggle.openness != 255)\n @w_openToggle.open()\n else\n @w_openToggle.close()\n end\n end", "def toggle_edit_mode\r\n session[:edit_mode] ||= 0 \r\n # error when not logged in\r\n return dc_render_404 if session[:edit_mode] < 1\r\n\r\n # if return_to_ypos parameter is present it will forward it and thus scroll to\r\n # aproximate position it was when toggle was clicked\r\n session[:edit_mode] = (session[:edit_mode] == 1) ? 2 : 1\r\n uri = Rack::Utils.parse_nested_query(request.url)\r\n # it parses only on & so first (return_to) parameter also contains url\r\n url = uri.first.last\r\n if (i = url.index('return_to_ypos')).to_i > 0\r\n url = url[0, i-1]\r\n end \r\n # offset CMS menu\r\n if (ypos = uri['return_to_ypos'].to_i) > 0\r\n ypos += session[:edit_mode] == 2 ? 250 : -250\r\n end\r\n url << (url.match(/\\?/) ? '&' : '?')\r\n url << \"return_to_ypos=#{ypos}\"\r\n redirect_to(url, allow_other_host: true)\r\nend", "def flip( bool )\n\t\t@flipped = bool\n\tend", "def switch_visibility(params = {})\n @visible = params[:visible] || !@visible\n reset_visiblility_counters\n end", "def toggle\n action(action: Actions::TOGGLE)\n self\n end", "def toggle_item\n return unless item.toggable?\n item.toggle\n RPG::SE.new(H87Options::TOGGLE_SOUND).play\n refresh\n activate\n end", "def toggle_item\n return unless item.toggable?\n item.toggle\n RPG::SE.new(H87Options::TOGGLE_SOUND).play\n refresh\n activate\n end", "def toggle\n @raid.toggle\n redirect_to :back\n end", "def switch(name, aliases, desc, long_desc, negatable)\n if negatable\n name = \"[no-]#{name}\" if name.to_s.length > 1\n aliases = aliases.map { |_| _.to_s.length > 1 ? \"[no-]#{_}\" : _ }\n end\n invocations = ([name] + aliases).map { |_| \"`\" + add_dashes(_).strip + \"`\" }.join('|')\n @io.puts header(\"#{invocations}\", 2)\n @io.puts\n @io.puts String(desc).strip\n cmd_desc = String(long_desc).strip\n @io.puts \"\\n> #{cmd_desc}\\n\" unless cmd_desc.length == 0\n @io.puts\n end", "def make_hidden\n @linkage_vis = :hidden\n end", "def toggle_pickers(sender)\n case sender.selectedSegmentIndex\n when 0 # UIPickerView\n @picker_style_segmented_control.hidden = true\n @segment_label.hidden = true\n self.show_picker @my_picker_view\n\n # report the selection to the UI label\n @label.text = \"#{@picker_view_array[@my_picker_view.selectedRowInComponent(0)]} - #{@my_picker_view.selectedRowInComponent(1)}\"\n when 1 # UIDatePicker\n @picker_style_segmented_control.hidden = false\n @segment_label.hidden = false\n self.show_picker @date_picker_view\n\n self.toggle_picker_style @picker_style_segmented_control\n when 2 # Custom\n @picker_style_segmented_control.hidden = true\n @segment_label.hidden = true\n self.show_picker @custom_picker_view\n end\n end", "def setPauseState(handle, pause)\n if ! pause\n if handle.respond_to?(:auto_managed=)\n handle.auto_managed = true\n end\n handle.resume\n else\n if handle.respond_to?(:auto_managed=)\n handle.auto_managed = false\n end\n handle.pause\n end\n end", "def hide(val = true)\n show_in_details !val\n show_in_table !val\n editable !val\n end", "def toggle\n @done = !@done\n end", "def demote\n @primary = false\n @secondary = true\n\n hiccup\n end", "def toggle_editmode\n\t\t@editmode = true\n\t\t$screen.write_message(\"Edit mode\")\n\tend", "def ui_box_switch_field(content = nil, options = nil, html_options = nil, &block)\n UiBibz::Ui::Core::Forms::Choices::BoxSwitchField.new(content, options, html_options, &block).render\n end", "def idlok(bool = false)\n Ncurses.idlok(pointer, bool ? 1 : 0)\n end", "def toggle(outlet, status)\n current_status = status(outlet)\n toggle_relay(outlet) if current_status != status\n status\n end", "def hide\n \tupdate_attribute(:hidden, true)\n end", "def moveToggle()\n @moveToggle_duration = @w_moveToggle.animationSpeed\n if (@w_moveToggle.x != 300 && @w_moveToggle.y != 250)\n @w_moveToggle.moveTo(300, 250)\n else\n @w_moveToggle.moveTo(350, 300)\n end\n end", "def toggle_balloon_for(obj, value, options = {})\n au = Kamelopard::AnimatedUpdate.new [], options\n if ! obj.kind_of? Kamelopard::Placemark and ! obj.kind_of? Kamelopard::ScreenOverlay then\n raise \"Can't show balloons for things that aren't Placemarks or ScreenOverlays\"\n end\n a = XML::Node.new 'Change'\n # XXX This can probably be more robust, based on just the class's name\n if obj.kind_of? Kamelopard::Placemark then\n b = XML::Node.new 'Placemark'\n else\n b = XML::Node.new 'ScreenOverlay'\n end\n b.attributes['targetId'] = obj.kml_id\n c = XML::Node.new 'gx:balloonVisibility'\n c << XML::Node.new_text(value.to_s)\n b << c\n a << b\n au << a\n end", "def hide\n @state = STATE_HIDDEN\n \n if @anchor == ANCHOR_TOP || @anchor == ANCHOR_LEFT\n @slide_offset = extent * -@slide_direction - 1\n else\n @slide_offset = 0\n end\n setup_gui\n end", "def toggle!\n if self.active?\n self.stop!\n else\n self.start!\n end\n end", "def set_capacities_controls\n @control_help_window.add_control(Vocab::TOGGLE, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::CHANGE_CATEGORY, Input::Keys::L, Input::Keys::R)\n end", "def toggle!\n self.featured = !self.featured\n save\n end", "def switches\n Commandorobo::Utils::consume_switch(@raw.join(' '))\n end", "def update_change\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # Make command window active\n @change_window.active = false\n @change_window.visible = false\n @command_window.active = true\n @command_window.visible = true\n @status_window.visible = true\n end\n # C ボタンが押された場合\n if Input.trigger?(Input::C)\n # コマンドウィンドウのカーソル位置で分岐\n case @change_window.index\n when 0 # 脱ぐ\n if $game_switches[2] == true #着替えコマンドが禁止の場合\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n @change_window.active = false\n @change_window.visible = false\n @put_off_window.active = true\n @put_off_window.visible = true\n\n disable_put_off\n\n when 1 # 着る\n if $game_switches[2] == true #着替えコマンドが禁止の場合\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n @change_window.active = false\n @change_window.visible = false\n @put_on_window.active = true\n @put_on_window.visible = true\n\n disable_put_on\n\n when 2 # キャンセル\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n @change_window.active = false\n @change_window.visible = false\n @command_window.active = true\n @command_window.visible = true\n @status_window.visible = true\n # 乳が揺れる\n $menu_pose.shake\n end\n end\n end", "def turn_on\n 'If the thermocycler is off, toggle the power switch in the back of the' \\\n ' instrument'\n end", "def show\n\t\[email protected]\n\tend", "def set_controls_help\n @control_help_window.clear\n set_status_controls if @status_window.active\n set_slots_controls if @slot_window.active \n set_item_controls if @item_window.active\n @control_help_window.refresh\n end", "def toggle(switches)\n 1.upto(1000) do |step|\n switches.map do |switch_num, on_or_off|\n if switch_num % step == 0\n switches[switch_num] = !on_or_off\n end\n end\n end\nend", "def switches #:nodoc:\n @switches ||= {}\n end", "def visible=(visible)\n @visible = visible\n @cVolumeLabel.visible = visible\n @cMuteLabel.visible = visible\n @ucVolumeBar.visible = visible\n @cVolumeValue.visible = visible\n end", "def visible=(visible)\n @visible = visible\n @cVolumeLabel.visible = visible\n @cMuteLabel.visible = visible\n @ucVolumeBar.visible = visible\n @cVolumeValue.visible = visible\n end", "def hidden=(hidden)\n end", "def toggle_link(object, field, link, true_values, false_values)\n state = object.send(field)\n icon = state ? true_values[0] : false_values[0]\n tooltip = state ? true_values[1] : false_values[1]\n data = {\n trueicon: true_values[0],\n falseicon: false_values[0],\n truetooltip: true_values[1],\n falsetooltip: false_values[1]\n }\n action_link tooltip, link, icon, class: \"toggle #{field} #{state}\", data: data\n end", "def animate_controls(hide)\n mul = hide ? -1 : 1\n nul = hide ? 0 : 1\n # TODO: this should be cleaned up\n bg = @bottom_gutter\n sbs = [@stop_button, @playback_button]\n stg = @stage\n oy = stg.y\n ox = stg.x\n # The properties are read only because of OS issues, so we just create a proxy\n stg_hap = SimpleDoubleProperty.new(stg.height)\n stg_hap.add_change_listener {|ov, old, new| stg.setHeight(new); stg.y = oy; stg.x = ox; }\n timeline do\n animate bg.translateYProperty, 0.ms => 500.ms, (32 * nul) => (32 - 32 * nul)\n sbs.each do |sb|\n animate sb.visibleProperty, 0.ms => 500.ms, (!hide) => hide\n end\n animate stg_hap, 0.ms => 500.ms, stg.height => (stg.height + 32 * mul)\n animate bg.pref_height_property, 0.ms => 500.ms, (32 - 32 * nul) => (32 * nul)\n end.play\n end" ]
[ "0.62756747", "0.5867539", "0.5825393", "0.57135844", "0.5685415", "0.56785387", "0.567535", "0.55550504", "0.55278295", "0.54196626", "0.5399839", "0.5374587", "0.53622603", "0.53347623", "0.5332515", "0.53244996", "0.5298098", "0.5273084", "0.5271895", "0.52597195", "0.51277965", "0.51059306", "0.5096716", "0.5075492", "0.50674176", "0.5026249", "0.5019976", "0.50072545", "0.49961197", "0.49591002", "0.49508017", "0.49348554", "0.49181864", "0.49069738", "0.48442346", "0.48442346", "0.48438567", "0.48151326", "0.48083463", "0.4808143", "0.48013654", "0.48013654", "0.47734538", "0.47731882", "0.4765403", "0.47632387", "0.4762719", "0.47498205", "0.47390923", "0.47324064", "0.47249782", "0.47245374", "0.47202817", "0.471702", "0.47129232", "0.4704179", "0.46984646", "0.4693005", "0.46927154", "0.46923602", "0.46921512", "0.46868697", "0.46744955", "0.46501747", "0.46456245", "0.4637146", "0.4634649", "0.46233526", "0.46233526", "0.4621439", "0.4617929", "0.46142697", "0.46055052", "0.4603243", "0.460136", "0.46004236", "0.45999506", "0.4597501", "0.4590657", "0.45877582", "0.4578917", "0.45787963", "0.45784453", "0.4575806", "0.45746332", "0.4573964", "0.45671245", "0.45585918", "0.4557258", "0.4551588", "0.45497736", "0.45489082", "0.45479545", "0.45453617", "0.453758", "0.45332465", "0.4532839", "0.453175", "0.45204976", "0.45168775" ]
0.6292904
0
Unabashedly stolen from ActiveSupport
def constantize names = self.split('::') names.shift if names.empty? || names.first.empty? constant = Object names.each do |name| constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name) end constant end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def escaper=(_); end", "def from; end", "def from; end", "def from; end", "def from; end", "def explicit; end", "def extended(*) end", "def escaper; end", "def beautify; end", "def beautify; end", "def ext; end", "def ext; end", "def ext=(_arg0); end", "def ext=(_arg0); end", "def ext=(_arg0); end", "def anchored; end", "def wrapper; end", "def original; end", "def extension=(_arg0); end", "def extension=(_arg0); end", "def internal; end", "def internal_encoding()\n #This is a stub, used for indexing\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def extensions=(_arg0); end", "def schubert; end", "def probers; end", "def intern() end", "def __getobj__; end", "def weber; end", "def decompose_safe(str)\n raise NotImplementedError\n end", "def file_utils; end", "def convert!; end", "def implemented_in; end", "def name_safe?; end", "def safe; end", "def autofinish; end", "def objects_and_symbols; end", "def iso; end", "def to; end", "def to; end", "def to; end", "def to; end", "def base; self; end", "def intensifier; end", "def binder; end", "def binder; end", "def extension; end", "def extension; end", "def extension; end", "def extension; end", "def normalize; end", "def strict_value_coercions; end", "def base_class; end", "def strict; end", "def reflection; end", "def reflection; end", "def utils; @utilities ||= hansen_utilities end", "def stringified_keys; end", "def berlioz; end", "def ibu; end", "def isolated; end", "def isolated; end", "def key_coercions; end", "def full_sanitizer=(_arg0); end", "def full_sanitizer=(_arg0); end", "def full_sanitizer=(_arg0); end", "def custom; end", "def custom; end", "def to_obj; end", "def converters; end", "def converters; end", "def converters; end", "def extension_black_list; end", "def camelize\n # From activesupport/lib/active_support/inflector.rb:178\n gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n end", "def silly_adjective; end", "def specialty; end", "def with_repl_like_sigint; end", "def simple_blind_ror\n \n end", "def tr_s(p0, p1) end", "def fallbacks=(_arg0); end", "def convert(object); end", "def as_you_like_it_quote; end", "def implementation; end", "def implementation; end", "def bs; end", "def original_result; end", "def spice; end", "def helpers; end", "def helpers; end", "def helpers; end", "def singular_siegler; end", "def extract_frozen_string_literal; end", "def method_731(base); end", "def __convert(h); end", "def reflector; end", "def reflector; end", "def internal_methods; end" ]
[ "0.6019667", "0.55566746", "0.54896253", "0.54896253", "0.54896253", "0.54896253", "0.5364515", "0.5292324", "0.52571636", "0.5255977", "0.5255977", "0.5250606", "0.5250606", "0.5201451", "0.5201451", "0.5201451", "0.5150516", "0.51358056", "0.51132333", "0.50977385", "0.50977385", "0.50790936", "0.5068965", "0.50400025", "0.50400025", "0.50400025", "0.50400025", "0.50283647", "0.50250435", "0.5024179", "0.50237703", "0.50208616", "0.5011255", "0.50070244", "0.50048614", "0.5000613", "0.49911013", "0.4990432", "0.49693727", "0.49658382", "0.49586326", "0.49498057", "0.49329123", "0.49329123", "0.49329123", "0.49329123", "0.49290892", "0.49275488", "0.49201062", "0.49201062", "0.49181414", "0.49181414", "0.49181414", "0.49181414", "0.49030638", "0.48982567", "0.4893932", "0.48933497", "0.48921913", "0.48921913", "0.48869824", "0.48855457", "0.4882767", "0.4874554", "0.48702163", "0.48702163", "0.48641512", "0.4862332", "0.4862332", "0.4862332", "0.4851766", "0.4851766", "0.4848791", "0.4842662", "0.4842662", "0.4842662", "0.48384333", "0.48327923", "0.48310572", "0.48296452", "0.48252168", "0.48120785", "0.48065463", "0.48032734", "0.4799645", "0.47966617", "0.47953704", "0.47953704", "0.47926867", "0.47857848", "0.47834903", "0.47811276", "0.47811276", "0.47811276", "0.47799525", "0.47765416", "0.47684473", "0.47650635", "0.47601306", "0.47601306", "0.4751553" ]
0.0
-1
, :except => [:index]
def index @companies = Company.all.order('rank DESC NULLS LAST') #@companies = CompanyRating.select('company_id,avg(satisfaction+work_environment+cd+flexibility+relation+leadership+pride+opportunities+opinion+stimulatingjob+innovation+management+compensation+workload+equality+objectives+cooperation+guidance+reward+career+transparancy) as rating, COUNT(DISTINCT(user_id,company_id)) as rank').group('company_id').order("rank DESC, rating ASC") #count = CompanyRating.count #@companies = CompanyRating.select('company_id,avg(satisfaction+work_environment+cd+flexibility+relation+leadership+pride+opportunities+opinion+stimulatingjob+innovation+management+compensation+workload+equality+objectives+cooperation+guidance+reward+career+transparancy) as rating, COUNT(DISTINCT(user_id,company_id)) as rank').group('company_id').order("coalesce('rank', #{count}) ASC") #@companies=CompanyRating.select('avg(satisfaction+work_environment+cd+flexibility+relation+leadership+pride+opportunities+opinion+stimulatingjob+innovation+management+compensation+workload+equality+objectives+cooperation+guidance+reward+career+transparancy) as rating,COUNT(DISTINCT(user_id,company_id)) as rank').order('rank') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_noindex\n @noindex = true\n end", "def index?\n false\n end", "def exclude; end", "def index_valid?\n false\n end", "def index_corruption?; end", "def remove(index)\n end", "def index_disabled\n @index_disabled ||= false\n end", "def index\n set_excuses\n end", "def index\n @unwanteds = Unwanted.all\n end", "def index\n super\n end", "def excluded; end", "def index\n set_index\n end", "def index(model, instance = nil)\n # do nothing\n true\n end", "def index\n index_filter\n end", "def should_index?\n\t\t!deleted?\n \tend", "def index\n raise \"not supported\"\n end", "def index_finalized\n index\n end", "def index\n prevent_non_admin\n end", "def index\r\n build_index unless @index\r\n @index\r\n end", "def drop_index\n call(ft_drop)\n end", "def index?\n true\n end", "def index?\n true\n end", "def index?\n true\n end", "def index?\n true\n end", "def index_relations(exclude_relations: []); end", "def names_not_indexed\n names.select { |n| !@index[n.index] }\n end", "def index?\n false\n end", "def index?\n false\n end", "def skip_actions; end", "def suppress_reindex\n self.suppress_reindex_trigger = true\n end", "def suppress_reindex\n self.suppress_reindex_trigger = true\n end", "def suppress_reindex\n self.suppress_reindex_trigger = true\n end", "def index\n @item_not_includeds = ItemNotIncluded.all\n end", "def filter_index\n filter\n end", "def index; @index; end", "def exclude_from_index(entity, boolean)\n entity.properties.to_h.each_key do |value|\n entity.exclude_from_indexes! value, boolean\n end\n end", "def index_template\n :index\n end", "def index_template\n :index\n end", "def delete_at_without_hooks( index )\n\n @without_hooks = true\n\n object = delete_at( index )\n \n @without_hooks = false\n\n return object\n \n end", "def index ; @index ; end", "def index\n no_cache\n super\n end", "def index_rejected_columns\n %w[id]\n end", "def index_filters\n {}\n end", "def index_disabled= bool\n @index_disabled = bool\n end", "def setting_index\n end", "def additional_index_buttons\n nil\n end", "def index\n\t\trender :nothing => true\n\tend", "def show_super_search_links_on_index\n false \n end", "def index\n @users = User.where.not(designation: \"hr\").all\n end", "def index?; end", "def options\n {:index => (index.blank? ? nil : index)}\n end", "def index\n \n end", "def index\n init(false,false)\n \n end", "def supports_index_include?\n false\n end", "def delete_at_index(index)\n \n end", "def index \n \n end", "def index \n \n end", "def exclude=(_arg0); end", "def index_signature; end", "def index # Only view\n end", "def index\n @staffs = Staff.where(employee: true).where.not(admin: true).where.not(super_admin: true)\n end", "def check_index_finder\n # Leave it alone\n end", "def ignore; end", "def index=(_arg0); end", "def exclude_from_model\n []\n end", "def supports_partial_index?\n false\n end", "def supports_partial_index?\n false\n end", "def -@()\n #This is a stub, used for indexing\n end", "def delete_at_indexes_without_hooks( *indexes )\n \n @without_hooks = true\n\n objects = delete_at_indexes( *indexes )\n \n @without_hooks = false\n \n return objects\n \n end", "def index\n @projects = Project.where.not({status: 9})\n end", "def swim(index)\n raise \"Not implemented.\"\n end", "def index?\n return true\n end", "def exclude\n all - methods\n end", "def index\n\n \n end", "def default_index_subaction\n list_all\n end", "def index_wip\n @assets = Asset.find(:all, :conditions => { {:name => :State, :op => \"IN\"} => [\"Skip\", \"Fail\"] })\n render :action => :index, :back => '/app'\n end", "def index_redirect(**opt, &blk)\n opt[:dst] ||= :list_own\n super(**opt, &blk)\n end", "def index\n @stocks = Stock.where.not(producto: nil)\n end", "def require_index(name); end", "def require_index(name); end", "def index\t\t\n\tend", "def include?(index)\n true\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end" ]
[ "0.70812327", "0.68375385", "0.674489", "0.67258954", "0.6723821", "0.67216265", "0.6707613", "0.6685697", "0.6610937", "0.65828615", "0.65257484", "0.6491664", "0.64786303", "0.64450425", "0.64286214", "0.6427914", "0.6423883", "0.64215803", "0.6414757", "0.6374888", "0.62936866", "0.62936866", "0.62936866", "0.62936866", "0.62823546", "0.6241035", "0.6236976", "0.6236976", "0.6234194", "0.6221272", "0.6221272", "0.6221272", "0.62177575", "0.6212907", "0.6152214", "0.6142582", "0.61164117", "0.61164117", "0.61116415", "0.6098483", "0.60982496", "0.60971504", "0.60872185", "0.6078242", "0.6073701", "0.6064423", "0.60626537", "0.6048457", "0.60323435", "0.60211825", "0.601844", "0.6017551", "0.60046923", "0.59951115", "0.5991554", "0.59753805", "0.59753805", "0.5962251", "0.59311354", "0.5930061", "0.5920581", "0.5917516", "0.59132546", "0.5910775", "0.591045", "0.59042287", "0.59042287", "0.5899243", "0.58983636", "0.5895746", "0.58923113", "0.58857656", "0.5882026", "0.587869", "0.5859922", "0.58538795", "0.58534265", "0.58487904", "0.5848591", "0.5848591", "0.58378553", "0.58376646", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033", "0.5834033" ]
0.0
-1
element appears twice except for one element which appears once. Find the single element that only appears only once. Do it in O(logn) time and O(1) space! think of binary search O(logn) what consition are we checking for how do we know which direction should we go next?
def single_in_sorted(arr) lo = 0 hi = arr.length - 1 # Stopping condition is when our window has closed while lo < hi # cutting the array in half mid = ((hi - lo) / 2) + lo # returing the item if iti dosent have a pair nearby return arr[mid] if arr[mid] != arr[mid - 1] && arr[mid] != arr[mid + 1] # if the index is odd and there is a pair below, # then the single element is above us # if index is even and the pair is above,same; # otherwise, the single element is below us if (arr[mid] == arr[mid - 1] && mid.odd?) || (arr[mid] == arr[mid + 1] && mid.even?) lo = mid + 1 else hi = mid - 1 end end # if we havent redurned yet, then the single element # is at the index we closed over arr[lo] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_singleton(array)\n array.each_with_index do |element, index|\n if element != array[index - 1] and element != array[index + 1]\n return element\n end \n end\n -1\nend", "def single_in_sorted(arr)\n index = 0\n found = nil\n until found\n if arr[index] != arr[index + 1]\n found = arr[index]\n else\n index += 2\n end\n end\n found\nend", "def find_it(seq)\n count = 0\n sorted = seq.sort\n \n sorted.each_with_index do |ele, i|\n count += 1\n next_ele_not_same = sorted[i] != sorted[i+1] \n \n return ele if count.odd? && next_ele_not_same\n end\nend", "def first_duplicate2(a)\n found = {}\n a.each do |x|\n return x if found[x]\n found[x] = true\n end\n -1\nend", "def find_duplicate(nums)\n if !nums or nums.size == 0\n return nil\n else\n fast = nums[ 0 ]\n slow = nums[ 0 ]\n while true\n fast = nums[ fast ]\n fast = nums[ fast ]\n slow = nums[ slow ]\n if fast == slow\n new_node = nums[ 0 ]\n while new_node != slow\n new_node = nums[ new_node ]\n slow = nums[ slow ]\n end\n return slow\n end\n end\n end\nend", "def find_duplicate(arr)\n # compare the last and next elements until they match\n dupe = arr.inject do |last, nxt|\n # return the match\n return last if last == nxt\n # otherwise return the next elem\n nxt\n end\nend", "def first_duplicate(a)\n a.uniq.each do |i|\n return i if a.select {|j| i == j}.count > 1\n end\n nil\n end", "def find_dup(array)\n array.each { |x| return x if array.count(x) == 2 }\nend", "def find_dup(arr)\n arr.each do |item|\n item_count = arr.count(item)\n return item if item_count > 1\n end\nend", "def find_it(seq)\n uniqueInts=seq.uniq\n\n uniqueInts.each do |value|\n k=0\n seq.each do |mainSeq|\n k+=1 if mainSeq==value\n end\n return value if k%2==1\n end\nend", "def find_dup(array)\n while array.size > 0\n el = array.shift\n array.each do |val|\n return el if val == el\n end\n end\nend", "def find_duplicate_in(array)\n return array.first if array.length == 1\n\n midpoint_index = array.length / 2\n midpoint = array[midpoint_index]\n previous = array[midpoint_index - 1]\n following = array[midpoint_index + 1]\n\n return midpoint unless midpoint == previous || midpoint == following\n\n if midpoint == previous\n ary1 = array[0, midpoint_index - 1 ]\n ary2 = array[midpoint_index + 1, array.length - 1]\n else\n ary1 = array[0, midpoint_index]\n ary2 = array[midpoint_index + 2, array.length - 1]\n end\n ary = ary1.length.odd? ? ary1 : ary2\n find_duplicate_in(ary)\nend", "def single_in_sorted(arr)\n mid = arr.length/2\n return arr[0] if arr.count == 1\n if arr[mid] != arr[mid + 1] && arr[mid] != arr[mid -1]\n return arr[mid]\n elsif arr[mid] != arr[mid + 1]\n single_in_sorted(arr[mid+1..-1])\n else\n single_in_sorted(arr[mid+1..-1])\n end\nend", "def find_dup(arr)\n arr.find { |element| arr.count(element) == 2 }\nend", "def find_dup(array)\n for elem in array\n return elem if array.count(elem) == 2\n end\nend", "def find_dup(array)\n array.find { |element| array.count(element) == 2 }\nend", "def find_dup(array)\n array.find { |element| array.count(element) == 2 }\nend", "def find_duplicate(array)\n numberCount = {}\n array.each do |element|\n if !numberCount[element]\n numberCount[element] = 1\n else \n return element\n end \n end \n -1\nend", "def find_dup(array)\n array.find { |num| num if array.count(num) > 1 }\nend", "def no_dupes?(arr)\n solved = Hash.new(0)\n arr.each { |ele| solved[ele] += 1 }\n solved.keys.select { |ele| solved[ele] == 1 }\nend", "def no_dupes?(arr)\n hash = Hash.new(0)\n arr.each do |ele|\n hash[ele] += 1\n end\n #can use the select method\n # hash.keys.select {|ele| hash[ele] == 1}\n new = []\n hash.each do |k, v|\n new << k if v == 1\n end\n new\n #another way to do it is sort and if there are adjacent pairs\n # we know that it is not a unique pair\nend", "def find_dup(arr)\n arr.each{ | ele | return ele if arr.count(ele) == 2 }\nend", "def solution(a)\n a.each do |element|\n return element if a.index(element) == a.rindex(element)\n end\nend", "def find_duplicate(arr)\n\tarr.select{|e| arr.count(e) > 1}.uniq\nend", "def element_duplicates?(elem, array)\r\n first_occurrence = array.index(elem)\r\n last_occurrence = array.rindex(elem)\r\n first_occurrence != last_occurrence\r\n end", "def find_dup(array)\n array.inject(Hash.new(0)) { |hash, item| hash[item] += 1; hash }.key(2)\nend", "def find_dup(a) \n 0.upto(a.length - 1).each {|i|\n while a[i] != i + 1 && !a[i].nil?\n if a[a[i] - 1] == a[i]\n return a[i]\n end\n aux = a[i]\n a[i] = a[aux - 1]\n a[aux - 1] = aux \n end\n }\n a.inspect\nend", "def find_dup(array)\n array.find { |item| array.count(item) == 2 }\nend", "def find_element(elem, elems)\n puts \"iterate #{elems}\"\n if (elems.size == 1)\n if elems[0] == elem\n return true\n else\n return false\n end\n end\n\n mid_point = elems.size/2\n puts \"mid point #{elems[mid_point]}\"\n\n # right hand is sorted\n if elems[mid_point] < elems[mid_point+1] && elems[mid_point] < elem\n # perform binary search just on the right\n result = find_element(elem, elems[mid_point+1..elems.size-1])\n elsif elems[mid_point] > elems[mid_point-1] && elems[mid_point] > elem\n # perform binary search just on the left\n result = find_element(elem, elems[0..mid_point])\n else\n # we cannot tell so perform on both\n puts \"perform on both\"\n result = find_element(elem, elems[elems.size/2+1..elems.size-1])\n unless result\n result = find_element(elem, elems[0..elems.size/2])\n end\n end\n\n # normal binary search on sorted\n # if elems[mid_point] > elem\n # result = find_element(elem, elems[0..elems.size/2-1])\n # else\n # result = find_element(elem, elems[elems.size/2..elems.size-1])\n # end\n puts \"\"\n\n result\nend", "def find_dup(array)\n array.each_with_index do |el, idx|\n array.slice(idx+1..-1).each { |val| return el if el == val }\n end\nend", "def single_in_sorted(arr)\n mid = arr.length / 2\n if arr[mid] != arr[mid - 1] && arr[mid] != arr[mid + 1]\n return arr[mid]\n elsif arr[mid] == arr[mid + 1]\n return single_in_sorted(arr.drop(mid + 1))\n else\n return single_in_sorted(arr.take(mid))\n\n end\n\n\nend", "def no_dupes?(arr)\n counter_hash = Hash.new(0)\n arr.each { |ele| counter_hash[ele] += 1 }\n counter_hash.select { |key, val| val == 1 }.keys\n #counter_hash.keys.select { |blah| counter_hash[blah] == 1 }\nend", "def find_first_dup(num_arr)\r\n set = []\r\n num_arr.each do |value|\r\n return value if set[value] #return value if it exists already in the set 'Array'\r\n set[value] = true \r\n end\r\n return -1 \r\nend", "def no_dupes?(arr)\n counts = Hash.new(0)\n arr.each do |e|\n counts[e] += 1\n end\n counts.select {|k,v| v <= 1}.keys\nend", "def find_it(seq)\n hash = {}\n seq.each do |element|\n hash[element] ? hash[element] += 1 : hash[element] = 1\n end\n hash.find do |key, value|\n return key if value.odd?\n end \nend", "def find_it(seq)\n seq.sort!\n res = seq[0]\n res = find_it(seq[2..seq.length]) if seq[1] == res\n res\nend", "def no_dupes?(arr)\n new_hash = Hash.new(0)\n new_arr = []\n\n arr.each do |x|\n new_hash[x] += 1\n end\n\n new_hash.each do |k,v|\n if v == 1\n new_arr << k\n end\n end\n new_arr\nend", "def find_dup(array)\n checked_array = []\n array.each do |el|\n if checked_array.include?(el)\n return el\n else\n checked_array << el\n end\n end\nend", "def find_it(seq)\n integer_occurences = seq.each_with_object(Hash.new(0)) do | int, hash |\n hash[int] += 1\n end\n integer_occurences.select {| int, occured | occured.odd? }.keys[0]\nend", "def find_dup(arr)\n arr.reduce(0) { |acc, current| arr.count(current) == 2 ? current : acc }\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 included_once(haystack, needle)\n count = 0\n for hay in haystack\n if hay == needle\n count += 1\n end\n # if count > 2\n # break\n # end\n end\n count == 1\nend", "def no_dupes?(arr)\n count = Hash.new(0)\n arr.each { |el| count[el] += 1 }\n count.keys.select { |el| count[el] == 1 }\nend", "def find_dup(array)\n array.sort.each_with_index do |obj, idx| \n return obj if obj == array.sort[idx + 1]\n end\nend", "def search item #(item: pointer; var index: longint): boolean\n result = false\n l = 0\n h = size - 1\n while (l <= h) do\n i = (l + h) >> 1\n case compare(self[i], item)\n when -1\n l = i + 1\n when 1\n h = i - 1\n when 0\n h = i - 1\n result = true\n l = i if @duplicates == :dup_ignore || @duplicates == :dup_replace\n end\n end\n index = l\n [result, index]\n end", "def find_duplicate_space(nums)\n # sort nums first (lgn), then check for dups by iterate over (n)\n last_seen = 0\n nums.sort!.each do |num|\n return num if last_seen == num\n last_seen = num\n end\nend", "def find_it(seq)\n h = {}\n seq.each { |i| h[i] ? h[i] = h[i] + 1 : h[i] = 1 }\n h.select { |k, v| v.odd? }.keys.first\nend", "def no_dupes?(arr)\n counter = Hash.new(0)\n arr.each { |ele| counter[ele] +=1 }\n \n # new_array = []\n # counter.each do |k,v|\n # new_array << k if v == 1\n # end\n # new_array\n counter.keys.select { |el| counter[el] == 1 }\nend", "def no_dupes?(arr)\n dupes = Hash.new(0)\n\n arr.each do |ele|\n dupes[ele] += 1\n end\n\n new_arr = []\n dupes.each do |k, v|\n if v == 1\n new_arr << k\n end\n end\n\n new_arr\nend", "def find_single(arr)\n upper = arr.length\n m = upper / 2\n ol = arr.length\n lower = 0\n\n while true\n return m if m + 1 == ol || m == 0\n\n left_same = arr[m] == arr[m - 1]\n right_same = arr[m] == arr[m + 1]\n\n return m unless left_same || right_same\n\n if (m.even? && left_same) || (m.odd? && right_same)\n upper = m\n m = (m - lower) / 2 + lower\n else\n lower = m\n m = m + (upper - m) / 2\n end\n end\nend", "def find_unique_elements(arr)\n \n#Algorithmic Process\n#Create an array that includes elements without the repeats\n#Create a hash that pairs each element of the new array with how many times it appears in the original array\n#Any key-value pair that has 1 for a value is unique and gets placed in the desired array\n \nnew_hash = {}\narr.each do |x|\n new_hash[x] = 0 if new_hash[x].nil?\n new_hash[x] = new_hash[x] + 1\nend\n\nnew_hash.delete_if {|key, value| value != 1}\nnew_hash.each_key {|key| puts key}\n\nend", "def find_unique_elements(arr)\n arr_fin=[]\n arr.each do |x|\n arr.count(x)\n if arr.count(x)==1\n arr_fin << x\n end\n end\n return arr_fin\nend", "def contain_duplicates(arr)\n\n if arr == nil?\n return false\n end\n\n\n hash = Hash.new(0) # counter hash\n\n arr.each do |i|\n\n if hash[i]\n hash[i] = hash[i] + 1\n else\n hash[i] = 1\n end\n if hash[i] > 1\n return true\n end\n end\n\n return false\nend", "def linear_search(sorted_array, desired_item)\n index = 0\n sorted_array.length.times do \n if desired_item == sorted_array[index]\n break \n else \n index += 1\n end\n if index > sorted_array.length - 1\n index = nil \n end\n end\n return index \nend", "def find_dup(array_of_integers)\n array_of_integers.each do |integer|\n return integer if array_of_integers.count(integer) == 2\n end\nend", "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "def find_unique_elements (arr)\n n = Hash.new(0)\n return_array = []\n arr.each do |element|\n n[element] += 1\n end\n n.each_pair { |k,v| \n if v == 1\n return_array << k\n end\n }\n \n return return_array\nend", "def firstDuplicate(a)\n counters = Hash.new(0)\n \n a.each do |i|\n counters[i] = counters[i] += 1\n if counters[i] > 1\n i\n end\n end\n -1\nend", "def find_unique_elements(arr)\n arr_unique = []\n arr.each do |elem1|\n var1 = 0\n arr.each do |elem2|\n if elem1 == elem2\n var1 = var1 + 1\n end\n end\n if var1 <= 1\n arr_unique.push(elem1)\n end\n end\nend", "def fast_hash_additive_find(arr, target)\n lookup_table = Hash.new\n\n arr.each do |element|\n return true if lookup_table[target - element]\n if lookup_table[element]\n lookup_table[element] += 1\n else\n lookup_table[element] = 1\n end\n end\n\n return false\n end", "def find_it(seq)\n hash = Hash.new(0)\n seq.each do |num|\n hash[num] += 1\n end\n\n hash.each do |num, no_of_occurence|\n return num if no_of_occurence.odd?\n end\nend", "def single_in_sorted(arr)\n return arr[0] if arr.length == 1\n\n mid_idx = arr.length / 2\n subarr = arr[0...mid_idx].length\n\n if arr[mid_idx] == arr[mid_idx - 1] && subarr.odd? ||\n arr[mid_idx] == arr[mid_idx + 1] && subarr.even?\n single_in_sorted(arr[(mid_idx + 1) .. -1])\n elsif arr[mid_idx] == arr[mid_idx + 1] && subarr.odd? ||\n arr[mid_idx] == arr[mid_idx - 1] && subarr.even?\n single_in_sorted(arr[0...mid_idx])\n end\nend", "def exists? item, list, lo, hi\n until lo >= hi\n mid = ((lo + hi) / 2).to_i\n if list[mid] < item\n lo = mid + 1\n elsif list[mid] > item\n hi = mid - 1\n else\n return true\n end\n end\n list[lo] == item\nend", "def search(array, value, first = 0)\n return false if array.length == 0\n return true if array[first] == value \n\n return search(array, value, first + 1) if array[first] != value && array.length != first\n return false\nend", "def unique_items(arr) #O(n)\n hash = Hash.new(0)\n results = []\n arr.each do |el|\n hash[el] += 1\n end\n hash.select { |k, v| k if v == 1 }.keys\nend", "def find_it(seq)\n seq.find {|e| seq.count(e).odd?}\nend", "def find_it(seq)\n seq.each do |e|\n a = seq.count(e)\n e if (a % 2).odd?\n end\nend", "def duplicates(array)\n frequency = Hash.new(0)\n array.each do |element|\n frequency[element] += 1\n end\n frequency.each do |k, v|\n return k if v > 1\n end\nend", "def solution(a)\n sorted_array = a.sort\n\n index = 0\n while index < sorted_array.length do\n break unless sorted_array[index] == sorted_array[index+1]\n index += 2\n end\n\n sorted_array[index]\nend", "def two_sum?(arr, target)\n hash = Hash.new(0)\n arr.each do |ele|\n hash[ele] += 1\n end\n arr.each do |ele|\n dif = target - ele\n if hash[dif] && (dif != ele || hash[dif] >= 2 )\n # if hash.include?(dif) && (dif != ele || hash[dif] >= 2 ) \n return true \n end\n end\n false\nend", "def contains_nearby_duplicate(nums, k)\n counter = {}\n \n nums.each_with_index do |num, i|\n return true if i - counter[num] <= k if counter[num]\n \n counter[num] = i \n end\n \n false\nend", "def find_unique_elements(arr)\n\tcounts = Hash.new 0\n\tarr.each do |ele|\n\t\tcounts[ele] += 1\n\tend\n\t\n\tcounts.delete_if {|key, value| value > 1 }\n\tresult = counts.keys #Array returned with keys for non-dupe values\n\treturn result\nend", "def binary_search(numbers, element)\n min = 0\n max = numbers.size - 1\n\n index = nil\n\n while index.nil? do\n middle_element_index = (min + max) / 2 # Every iteration (N / 2) = O(log n)\n middle_element = numbers[middle_element_index] \n \n if element < middle_element\n max = middle_element_index\n elsif element > middle_element\n min = middle_element_index\n elsif element == middle_element\n index = middle_element_index\n end\n end\n\n index\nend", "def no_dupes?(arr)\n count = Hash.new(0)\n\n arr.each { |ele| count[ele] += 1 }\n\n array = []\n count.each { |k, v| array << k if v == 1 }\n\n array\nend", "def find_dup(arr)\n sorted = arr.sort\n num_arr = sorted.select.with_index do |el, idx|\n current_el = sorted[idx]\n if current_el == sorted[idx + 1]\n current_el\n end\n end\n num_arr[0]\nend", "def find_dup(arr)\n arr.select { |i| arr.count(i) == 2 }.uniq.join.to_i\nend", "def find_it(seq)\n seq.find { |n| seq.count(n).odd? }\nend", "def no_dupes?(arr)\n count_hash = Hash.new(0)\n non_dupes = []\n\n arr.each { |ele| count_hash[ele] += 1 }\n\n count_hash.each do |key, val|\n non_dupes << key if val == 1\n end\n\n non_dupes\nend", "def dupe_indices(arr)\n idxs = Hash.new { |h, k| h[k] = [] }\n \n arr.each_with_index do |ele, i|\n idxs[ele] << i\n end\n\n return idxs.select { |ele, arr| arr.length > 1 }\nend", "def search(array, value)\n return false if array.empty?\n element = array.shift\n return element == value || search(array, value)\nend", "def find_duplication(ary)\n ct = Hash.new{|h, k| h[k] = 0}\n ary.each do |x|\n ct[x] += 1\n end\n return ct.select{|k, v| v > 1}.map{|k, v| k}\n end", "def find_it(seq)\n # hash = Hash.new\n \n # seq.each do |num|\n # if hash[num].nil?\n # hash[num] = 1\n # else\n # hash[num] += 1\n # end\n # end\n \n hash = Hash.new(0)\n seq.each { |num| hash[num] += 1 }\n \n hash.each { |k, v| return k if v.odd? }\nend", "def find_single_sorted(a, l, r)\n if l > r\n return \"Not valid\"\n end\n\n if l == r\n return a[l]\n end\n\n mid = (l+r)/2\n\n # If mid is even and element after mid is same, then single element is in right half, else in left half\n if mid%2 == 0\n if a[mid] == a[mid+1]\n return find_single_sorted(a, mid+2, r)\n else\n return find_single_sorted(a, l, mid)\n end\n else\n # If mid is odd and element before mid is same, then single element is in right half, else in left half\n if a[mid] == a[mid-1]\n return find_single_sorted(a, mid+1, r)\n else\n return find_single_sorted(a, l, mid-1)\n end\n end\nend", "def find3(a, X)\n # scan through array\n # build hash storing complement in each key\n complements = {}\n a.each_with_index do |val, ind|\n if complements[X - val]\n complements[X - val].push(ind)\n else\n complements[X - val] = [ind]\n end\n end\n\n # scan through the array again\n # get complement\n # for each value scan the remainder of the arrray\n # for a value such taht a + b = the complement\n\n # for each character we have built a dictionary such that, we can find\n # x = a + complement\n\n # [1, 2, 3]\n # 1 + 2 = 3\n # 1 + 3 = 4 =>\n\n # for each value in the array (a) look at all following values (b) and see if a + b\n # is in the dictionary, if it is, check that their indices do not collide with the index\n # stored at dict(a+b)\n\n a.each_with_index do |va, i|\n a.each_with_index do |vb, j|\n break if i == j\n\n complement = va + vb\n indices = complements[complement]\n\n indices.each do |z|\n # every index is unique\n return [i, j, z] unless z == i || z == j\n end\n end\n end\n\n return nil\nend", "def linear_search(object, array)\n i = 0\n until array[i] == object || array[i] == nil\n i += 1\n end\n array[i] == object ? i : nil\n end", "def find_it(seq)\r\n counts = seq.each_with_object({}) { |n, hash| hash[n] = seq.count(n) }\r\n counts.key(counts.values.find(&:odd?))\r\nend", "def no_dupes?(arr)\n arr.reject do |ele|\n # debugger\n arr.count(ele) > 1\n end\nend", "def okay_two_sum?(arr, target)\n\n arr.each do |ele1| # O(n)\n # debugger\n found = arr.bsearch do |ele2|\n # debugger\n (target - ele1) == ele2\n end\n return true unless found.nil? || arr.index(found) == arr.index(ele1)\n end\n false\nend", "def find_index array, item\n\tl,r = 0, array.length-1\n\n\twhile l <= r\n\t\tm = (r+l) / 2\n\t\tcomp = yield item, array[m]\n\t\tif comp == false\n\t\t\t# Items compare the same\n\t\t\treturn false\n\t\telsif comp == -1 \n\t\t\tr = m - 1\n\t\telse\n\t\t\tl = m + 1\n\t\tend\n\tend\n\n\tl\nend", "def find_dup(arr)\n arr.select { |num| arr.count(num) == 2 }.uniq.join.to_i\nend", "def solution(a)\n # write your code in Ruby 2.2\n seen = {}\n\n a.each do |number|\n seen[number] = true\n end\n\n max = a.max\n\n for i in 1..(max + 1)\n return i unless seen[i]\n end\n\n 1\nend", "def find(value)\n @set.each do |k,v|\n return true if ((value-k) == k) ? @set[value-k] > 1 : @set[value - k]\n end\n return false\n end", "def find_unique_elements(arr)\n collect = Hash.new 0\n \n arr.each do |elt|\n collect[elt] += 1\n end\n\n unique_hash = Hash(collect.select {|k,v| v == 1})\n \n unique_hash.keys\nend", "def find_it(seq)\n seq.find { |num| num if seq.count(num) % 2 != 0 }\nend", "def contains_nearby_duplicate(nums, k)\n nums_hash = {}\n \n nums.each_with_index do |num, index|\n return true if nums_hash[num] && index - nums_hash[num] <= k\n \n nums_hash[num] = index\n end\n \n false\nend", "def find_duplicates(a)\n len=a.length\n n=len-2\n xor= 0\n x,y=0,0 #variables to store duplicates\n \n #xor of all numbers from 1 to n\n for i in 1..n \n xor^=i\n end\n #xor of all array elements\n for i in 0...len \n xor^=a[i]\n end\n #Rightmost set bit\n set_bit_pos= xor & ~(xor-1)\n #Divinding array in two sets ,one with set bit at set_bit_pos and other with 0.\n for i in 0...len\n if (a[i] & set_bit_pos == 0)\n x^=a[i] # XOR of first-set(with 0 at set_bit_pos) in array\n else\n y^=a[i] # XOR of second-set(with 1 at set_bit_pos) in array\n end\n end\n \n for i in 0..n\n if (i & set_bit_pos == 0)\n x^=i # XOR of first-set(with 0 at set_bit_pos) in range\n else\n y^=i # XOR of second-set(with 1 at set_bit_pos) in range\n end\n end\n print \"#{x} #{y}\"\n\treturn\nend", "def nondupes(array)\n new_array = []\n array.each do |elem| \n if array.count(elem) == 1\n new_array << elem \n end\n end\n new_array\nend", "def no_dupes?(array)\n hash = Hash.new(0)\n array.each do |ele|\n hash[ele] += 1\n end\n new_array = []\n hash.each do |k, v|\n new_array << k if v == 1\n end\n return new_array\nend", "def find_it(seq)\n counts = Hash.new 0\n\n seq.each do |num|\n counts[num] += 1\n end\n\n counts.each {|item|\n return item[0] if item[1].odd?\n }\nend", "def find_unique_elements(arr)\n #select each element of the array and compare each one to the rest of the array\n arr.each_index do |idx|\n #compare each element within the array\n #arr.delete_if{|element|arr[idx] == arr[idx+1]}\n if arr[idx] == arr[idx+1]\n arr.delete(arr[idx])\n #delete the first matching element\n arr.delete(arr[idx])\n #delete the element that was matched\n end\n #return/print out the remaining elements within the array\n end\nend" ]
[ "0.7295121", "0.71694446", "0.6959747", "0.69450253", "0.685221", "0.67540324", "0.6752411", "0.6722073", "0.6681793", "0.66581833", "0.6629451", "0.66237307", "0.66185284", "0.6612662", "0.660684", "0.6587311", "0.6587311", "0.65498495", "0.65453166", "0.654302", "0.65407014", "0.65351087", "0.65108633", "0.6458075", "0.6435633", "0.6428973", "0.6426086", "0.6422311", "0.6419063", "0.6416675", "0.64089596", "0.6401042", "0.6372465", "0.63634074", "0.6359771", "0.6356155", "0.63532794", "0.6351696", "0.63378406", "0.632998", "0.6322772", "0.63147736", "0.63071656", "0.6296837", "0.6259653", "0.62462205", "0.62404436", "0.62392104", "0.62243927", "0.62230307", "0.622011", "0.62147075", "0.6212657", "0.62088007", "0.6205989", "0.61917835", "0.61703414", "0.6166404", "0.6156081", "0.6151951", "0.6137888", "0.6135563", "0.6135479", "0.6131491", "0.612461", "0.61173964", "0.61145616", "0.60931015", "0.6069594", "0.60652417", "0.6065083", "0.60599196", "0.60577166", "0.6051516", "0.6047136", "0.60465133", "0.6046415", "0.60424954", "0.60322726", "0.60265374", "0.6024384", "0.6005254", "0.6004221", "0.59956324", "0.5991784", "0.5986979", "0.5985234", "0.59806573", "0.59716684", "0.5969288", "0.59650517", "0.59547377", "0.59526783", "0.5948299", "0.5944975", "0.59445995", "0.5937784", "0.5937283", "0.5936923", "0.59358984" ]
0.66652423
9
GET /press_releases GET /press_releases.json
def index @press_releases = PressRelease.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end", "def index\n @releases = Release.all\n end", "def index\n @releases = Release.all\n end", "def new_releases\n api_call(\"https://api.spotify.com/\",\"/v1/browse/new-releases\")\n end", "def release(project_id, release_id, options = {})\n get \"projects/#{project_id}/releases/#{release_id}\", options\n end", "def show\n @release = @environment.releases.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @release }\n end\n end", "def index\n @releases = Release.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases.to_json(:except => [:user_id]) }\n end\n end", "def releases(country = nil)\n Birdman::Requester.get(\"movies/#{id}/releases/#{country}\")\n end", "def fetch_releases\n require \"open-uri\"\n\n open(RELEASE_URL) { |f| f.read.scan RELEASE_REGEXP }\n end", "def list_releases(workspace_id)\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n url = @api_url + \"/api/workspaces/#{workspace_id}/releases\"\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n releases = JSON.parse(r.body)['data']\n #release_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"releases dump is #{JSON.pretty_generate(releases)}\\nrelease count is #{release_count}\"\n\n releases.each do |release|\n results.push(release)\n end\n return results\n end", "def releases\n self.class.releases\n end", "def releases\n self.class.releases\n end", "def get_release(release_id)\n query_and_build \"releases/#{release_id}\"\n end", "def index\n @client_releases = ClientRelease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_releases }\n end\n end", "def releases_in_group(release_group_id, options = {})\n get \"release_groups/#{release_group_id}/releases\", options\n end", "def display_releases(releases)\n url = \"\"\n releases.each do |release|\n puts \"\\n\\n#{release.name} by #{release.artist} on #{release.label}\\n\"\n release.tracks.each_with_index do |track, index|\n puts \"-#{track.name}\"\n url = track.url\n end\n end\n end", "def get_release(project)\n info = get_github_api(project, \"releases\")\n release = 'master'\n if info.length > 0\n unpublishedDraftLimit = 5\n x = 0\n release = info[x]['tag_name']\n # Unpublished drafts need to be skipped.\n while (unpublishedDraftLimit > x) && info[x]['draft']\n release = info[x]['tag_name']\n x += 1\n end\n end\n release\n end", "def get(*args)\n arguments(args, required: [:owner, :repo, :id]).params\n\n get_request(\"/repos/#{arguments.owner}/#{arguments.repo}/releases/#{arguments.id}\" , arguments.params)\n end", "def index\n respond_with releases\n end", "def show\n @release = Release.find(params[:id])\n @total_downloads = 0\n @release.versions.each do |v|\n @total_downloads += v.downloads\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @release }\n end\n end", "def releases\n repo.releases(changelog.changes)\n end", "def new_dvd_releases\n return @badfruit.parse_movies_array(JSON.parse(@badfruit.get_lists_action(\"new_releases\")))\n end", "def related_releases\n Rails.cache.fetch(\"releases/release-#{id}\", :expires_in => 1.hour) do\n real_releases.all(:order => 'date DESC', :limit => 15)\n end\n end", "def map_releases\n releases.sort! {|x,y| x[1] <=> y[1] }\n .map { |release|\n {\n \"version\" => release[1],\n \"status\" => \"active\",\n \"description_html\" => \"<p>#{release[0]}</p>\",\n \"description_markdown\" => release[0],\n \"providers\" => [\n {\"name\" => \"virtualbox\", \"url\" => \"#{RELEASE_URL}#{release[0]}\"}\n ]\n }\n }\n end", "def get_releases(artist_id, options={})\n api_response = @api_client.make_api_request(:GET, \"artist/releases\", {:artistId => artist_id}, options)\n @api_client.release_digestor.list_from_xml(api_response.content.releases)\n end", "def index\n @title = \"News and Events - Think India NITR club\"\n @press_releases = PressRelease.all.order(\"created_at desc\")\n end", "def index\n @object_releases = ObjectRelease.all\n end", "def release_url(api_url, title)\n # \"subject\": {\n # \"title\": \"v1.4.4\",\n # \"url\": \"https://api.github.com/repos/typed-ember/ember-cli-typescript/releases/13191777\",\n # \"latest_comment_url\": \"https://api.github.com/repos/typed-ember/ember-cli-typescript/releases/13191777\",\n # \"type\": \"Release\"\n # },\n api_index = api_url.index(\"api\")\n repos_index = api_url.index(\"repos\")\n releases_index = api_url.index(\"releases\")\n\n # https://github.com/typed-ember/ember-cli-typescript/releases/tag/v1.4.4\n html_url = api_url[0..api_index - 1] +\n api_url[api_index + \"api.\".length..repos_index - 1] +\n api_url[repos_index + \"repos/\".length..releases_index + \"releases\".length] +\n \"tag/#{title}\"\n html_url\n end", "def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend", "def index\n #@releases = Release.all\n @releases = Release.where(cashier_id: current_user.cashier.id, view: true)\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @releases }\n # end\n end", "def index\n params[:page] ||= 1\n \n @releases = Release.search_archive(params[:search], params[:page])\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @releases }\n end\n end", "def release\n _init\n\n @release = Release.find_by_name(params[:release]) if params[:release]\n @release = Release.actived.first unless @release\n\n render :template => 'sprint/release', :layout => 'release'\n end", "def create\n @release = @environment.releases.new(params[:release])\n\n respond_to do |format|\n if @release.save\n format.html { redirect_to @release, notice: 'Release was successfully created.' }\n format.json { render json: @release, status: :created, location: @release }\n else\n format.html { render action: \"new\" }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end", "def current_dvd_releases\n return @badfruit.parse_movies_array(JSON.parse(@badfruit.get_lists_action(\"current_releases\")))\n end", "def get_url\n heroku_app = options[:heroku_app]\n uriString = \"https://api.heroku.com/apps/#{heroku_app}/releases\"\n accept = '\"Accept: application/vnd.heroku+json; version=3\"'\n order = '\"Range: version ..; order=desc, max=10;\"'\n uri = URI(uriString)\n puts \"URI: #{uri}\"\n\n res = `curl -n --silent #{uriString} -H #{accept} -H #{order}`\n\n result = JSON.parse(res)\n\n id = nil\n ver = nil\n hash = nil\n result.each { |i|\n puts i\n if !id && i[\"slug\"] && i[\"slug\"][\"id\"] && i[\"slug\"][\"id\"] != \"\"\n id = i[\"slug\"][\"id\"]\n ver = i[\"version\"]\n hash = i[\"description\"]\n end\n }\n\n #puts id if id\n if id != nil\n\n uriStringSlug = \"https://api.heroku.com/apps/#{heroku_app}/slugs/#{id}\"\n uriSlug = URI(uriStringSlug)\n\n resSlug = `curl -n --silent #{uriStringSlug} -H #{accept}`\n resultSlug = JSON.parse(resSlug)\n p \"--------------------------------\"\n p \"Version: #{ver}\"\n p \"Hash: #{hash}\"\n p resultSlug[\"blob\"][\"url\"]\n p \"--------------------------------\"\n end\n end", "def campaign_release(id)\n rest.get(:releasesms, id: id)['data']\n end", "def index\n @release_items = ReleaseItem.all\n end", "def releases\n all(QTest::Release, project: @id)\n end", "def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend", "def destroy\n @press_release.destroy\n respond_to do |format|\n format.html { redirect_to press_releases_url }\n format.json { head :no_content }\n end\n end", "def release\n case new_resource.version\n when 'latest'\n require 'octokit'\n Octokit.releases(repo).first[:tag_name]\n else\n \"v#{new_resource.version}\"\n end\n end", "def show\n @release = Release.find(params[:id])\n\n # respond_to do |format|\n # format.html show.html.erb\n # format.json { render json: @release }\n # end\n end", "def get_last_release\n r = api_get(\"/releases\")\n\n return r[0]['tag_name']\nend", "def get_release_info(author, repository, options)\n url = Kernel.format(\n 'https://api.github.com/repos/%{author}/%{repository}/releases/%{tag}%{release}',\n author: author,\n repository: repository,\n tag: (options[:is_tag]) ? 'tags/' : '',\n release: options[:release],\n )\n\n release_info_json = fetch_from_url(\n url,\n options[:username],\n options[:password],\n options[:use_auth],\n options[:use_oauth],\n )\n\n return nil unless release_info_json\n\n # Read in release info from JSON file\n\n Puppet.debug('Parsing release info')\n\n # noinspection RubyResolve\n PSON.load(release_info_json)\nend", "def info\n release = args.shift.downcase.strip rescue nil\n raise(CommandFailed, \"Specify a release\") unless release\n\n release = heroku.release(app, release)\n\n display \"=== Release #{release['name']}\"\n display_info(\"Change\", release[\"descr\"])\n display_info(\"By\", release[\"user\"])\n display_info(\"When\", time_ago(Time.now.to_i - Time.parse(release[\"created_at\"]).to_i))\n display_info(\"Addons\", release[\"addons\"].join(\", \"))\n display_vars(release[\"env\"])\n end", "def release\n configs = store(:get, 'configs').to_s.gsub(\"\\n\", \" \")\n \n # TODO: if error, user need to deploy code first (nothing to deploy) => use a special exit code \n # when code is not pushed or only deploy if app has a correct build\n version = @api.release(@name, configs).to_s.chomp.gsub(\"\\n\", \" \")\n backend = @api.run(@name, :web, version).to_s.chomp.gsub(\"\\n\", \" \")\n @api.route @name, backend\n return version\n end", "def get_latest_release(project, bin)\n api_url = \"https://api.github.com/repos/#{project}/releases/latest\"\n data = URI.parse(api_url).read\n obj = JSON.parse(data)\n version = obj[\"name\"]\n sha_url = \"https://github.com/#{project}/releases/download/#{version}/#{bin}.sha256\"\n sha = URI.parse(sha_url).read\n url = \"https://github.com/#{project}/releases/download/#{version}/#{bin}\"\n sha256 = sha.split(\" \").first\n\n return url, sha256, version\nend", "def create_release(node)\n if node.attributes['id'] and @releases[node.attributes['id']]\n release = @releases[node.attributes['id']]\n else\n release = @factory.new_release\n @releases[node.attributes['id']] = release\n end\n \n # Read all defined data fields\n release.id = node.attributes['id']\n release.title = node.elements['title'].text if node.elements['title']\n release.asin = node.elements['asin'].text if node.elements['asin']\n release.artist = create_artist(node.elements['artist']) if node.elements['artist']\n \n # Read the types\n node.attributes['type'].split(' ').each {|type|\n release.types << Utils.add_namespace(type)\n } if node.attributes['type']\n \n # Read the text representation information.\n if text_representation = node.elements['text-representation']\n release.text_language = text_representation.attributes['language']\n release.text_script = text_representation.attributes['script']\n end\n \n # Read the track list\n read_track_list(node.elements['track-list'], release.tracks) {|track|\n track.artist = release.artist unless track.artist\n track.releases << release\n }\n \n # Read the release event list\n read_release_event_list(node.elements['release-event-list'], release.release_events)\n \n # Read the disc list\n read_disc_list(node.elements['disc-list'], release.discs)\n \n # Read the relation list\n if node.elements['relation-list']\n node.elements.each('relation-list') {|relation_node|\n read_relation_list(relation_node) {|relation|\n release.add_relation relation\n }\n }\n end\n \n # Read the tag list\n read_tag_list(node.elements['tag-list'], release.tags)\n \n return release\n end", "def show\n @os_release = OsRelease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @os_release }\n end\n end", "def show\n @environment = @project.environments.find_by_slug!(params[:id])\n @releases = @environment.releases\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @environment }\n end\n end", "def create\n @press_release = PressRelease.new(press_release_params)\n\n respond_to do |format|\n if @press_release.save\n format.html { redirect_to @press_release, notice: 'Press release was successfully created.' }\n format.json { render :show, status: :created, location: @press_release }\n else\n format.html { render :new }\n format.json { render json: @press_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @release = Release.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release }\n end\n end", "def index\n response = VersionResponse.new( BUILD_VERSION )\n render json: response, :status => 200\n end", "def fetch_versions\n http_get(\"#{host}/#{Configuration.versions_file}\").body\n end", "def to_check\n @releases = Release.all\n end", "def get_artists_releases(artist_id, pagination={})\n query_and_build \"artists/#{artist_id}/releases\", pagination\n end", "def get_release_notes\n path = '/v3/release-logs.json'\n\n header = {\n 'Content-Type' => 'application/json',\n 'User-Agent' => Config.user_agent\n }\n request = Net::HTTP::Get.new(path, header)\n handle_response(@api_client.request(request), 'get_release_notes')\n end", "def create\n @press_release = PressRelease.new(press_release_params)\n\n respond_to do |format|\n if @press_release.save\n format.html { redirect_to @press_release, notice: 'Press release was successfully created.' }\n format.json { render action: 'show', status: :created, location: @press_release }\n else\n format.html { render action: 'new' }\n format.json { render json: @press_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @press = Press.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @press }\n end\n end", "def info\n validate_arguments!\n\n remotes = self.class.heroku_remotes\n\n # trigger 'No app specified' message\n remotes.push ['--app', app] if remotes.empty? or options[:app]\n\n output = {}\n remotes.map do |remote|\n Thread.new(remote) do |remote, app|\n begin\n # capture stdout\n Thread.current[:output] = []\n\n release = api.get_releases(app).body.sort_by do |release|\n release[\"name\"][1..-1].to_i\n end.last[\"name\"]\n\n # display_header(\"#{app}\")\n puts \"##### #{app} #####\\n\"\n\n # this is simply copied from 3.9.6/lib/heroku/command/releases.rb\n # https://github.com/heroku/heroku/blob/master/lib/heroku/command/releases.rb\n\n # ---------\n release_data = api.get_release(app, release).body\n\n data = {\n 'By' => release_data['user'],\n 'Change' => release_data['descr'],\n 'When' => time_ago(release_data[\"created_at\"])\n }\n\n unless release_data['addons'].empty?\n data['Addons'] = release_data['addons']\n end\n\n\n styled_header(\"Release #{release}\")\n styled_hash(data)\n\n display\n\n styled_header(\"#{release} Config Vars\")\n unless release_data['env'].empty?\n if options[:shell]\n release_data['env'].keys.sort.each do |key|\n display(\"#{key}=#{release_data['env'][key]}\")\n end\n else\n styled_hash(release_data['env'])\n end\n else\n display(\"#{release} has no config vars.\")\n end\n # ---------\n\n # capture stdout\n output[remote] = Thread.current[:output].join\n rescue\n output[remote] = \"Something went wrong fetching releases for #{app}.\"\n end\n end\n end.map(&:join)\n\n output.sort.each do |remote, output|\n puts output\n puts\n end\n end", "def release_info\n @release_info ||= @connection.get(RELEASE_INFO_PATH)['release']\n end", "def destroy\n @press_release.destroy\n respond_to do |format|\n format.html { redirect_to press_releases_url, notice: 'Press release was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @release_mains = ReleaseMain.all\n end", "def release\n release_data = EventDate.data_for_release(params[:date_id])\n render json: release_data.to_json\n end", "def release_version!\n projects.each { |project| project.release_version!(tag_full_name) }\n print_log 'Versions released'\n slack_notifier.ping(release_message, icon_emoji: ':see_no_evil:')\n end", "def destroy\n @release = @environment.releases.find(params[:id])\n @release.destroy\n\n respond_to do |format|\n format.html { redirect_to releases_url }\n format.json { head :no_content }\n end\n end", "def post_release_v2(app_name, slug, dyno_types, user, token,\n slug_url, repo_size)\n slug_url_regex = /https:\\/\\/(.+?)\\.s3\\.amazonaws\\.com\\/(.+?)\\?/\n _, slug_put_key, slug_put_bucket = slug_url.match(slug_url_regex).to_a\n start = Time.now\n payload = {\n # \"head\" => head,\n # \"prev_head\" => commit_hash,\n # \"current_seq\" => current_seq,\n \"slug_put_key\" => slug_put_key,\n \"slug_put_bucket\" => slug_put_bucket,\n \"repo_size\" => repo_size,\n \"release_descr\" => \"sokoban-built release\", # punting for v2\n \"language_pack\" => \"Sokoban\", # punting for v2\n \"buildpack\" => \"Sokoban\", # punting for v2\n \"slug_version\" => 2,\n \"slug_size\" => File.size(slug),\n \"stack\" => \"cedar\",\n \"user\" => user,\n \"process_types\" => dyno_types,\n \"git_log\" => \"\",\n \"run_deploy_hooks\" => false,\n \"addons\" => {},\n \"config_vars\" => {}}\n\n release_name =\n Timeout.timeout(30) do\n uri = URI.parse(release_uri(app_name))\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri)\n if uri.scheme == \"https\"\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n request.basic_auth(user, token)\n request[\"Content-Type\"] = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request.body = JSON.unparse(payload)\n response = http.request(request)\n if (response.code != \"200\")\n error_message = begin\n response.body && JSON.parse(response.body)[\"error\"] || \"failure releasing code\"\n rescue Timeout::Error\n \"timed out releasing code\"\n rescue\n \"failure releasing code\"\n end\n raise(error_message)\n end\n response.body\n end\n release_name\n end", "def downloadable_versions\n base_url = 'https://www.drupal.org/node/3060/release?&page=%i'\n page_id = 0\n versions = {}\n\n loop do\n page = Nokogiri::HTML(Typhoeus.get(format(base_url, page_id),\n headers: { 'User-Agent' => 'curl/7.54.0' }).body)\n\n page.css('span.file a').each do |node|\n version = node.text.strip[/\\Adrupal\\-([\\d.]+)\\.tar\\.gz\\z/i, 1]\n\n versions[version] = \"https://ftp.drupal.org/files/projects/#{node.text.strip}\" if version\n end\n\n break if page.css('li.pager-next').empty?\n\n page_id += 1\n end\n\n versions\n end", "def show\n @persons_release = PersonsRelease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persons_release }\n end\n end", "def set_press_release\n @press_release = PressRelease.find(params[:id])\n end", "def index\n @projects = ProjectDecorator.all\n @releases = ReleaseDecorator.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @projects }\n end\n end", "def timeline_releases\n real_releases.order('date DESC').limit(5)\n end", "def show\n @client_release = ClientRelease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_release }\n end\n end", "def releases\n Release.branch(self)\n end", "def versions(module_name)\n path = \"/v3/modules/#{module_name.tr('/','-')}\"\n response = @conn.get(path)\n\n if response.status != 200\n raise R10K::Error.new(\"Request to Puppet Forge '#{path}' failed. Status: #{response.status}\")\n end\n\n releases = response.body['releases'].reject { |r| r['deleted_at'] }\n releases = releases.map do |version_info|\n version_info['version']\n end\n releases.reverse\n end", "def page_versions\n list_versions_for(latest_version_of(@item.path))\n end", "def create\n # Extract the version info\n release = params[:release]\n version = params[:release][:version]\n release.delete(\"version\")\n \n # Validate input\n if (release[:name] == \"\")\n flash[:notice] = \"You must supply a name for the release\"\n respond_to do |format|\n format.html { redirect_to :action => 'new' }\n format.json { head :no_content }\n end\n elsif (release[:source_url] == \"\")\n flash[:notice] = \"You must supply a source URL\"\n respond_to do |format|\n format.html { redirect_to :action => 'new' }\n format.json { head :no_content }\n end\n else\n # Add http:// prefix to source_url if it doesn't already exist\n release[:source_url] = \"http://#{release[:source_url]}\" if not release[:source_url].starts_with? \"http://\" and not release[:source_url].starts_with? \"https://\"\n \n @release = Release.new(release)\n @release.user = current_user\n \n # Add the version info\n # If the URL doesn't start with http:// or https://, add it\n version[:download_url] = \"http://#{version[:download_url]}\" if not version[:download_url].starts_with? \"http://\" and not version[:download_url].starts_with? \"https://\"\n \n @version = Version.new(version)\n @version.version_number = 1\n @version.release = @release\n @release.versions << @version\n\n respond_to do |format|\n if @release.save\n format.html { redirect_to @release, notice: 'Release was successfully created.' }\n format.json { render json: @release, status: :created, location: @release }\n else\n format.html { render action: \"new\" }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def list_by_publisher\n @publisher = params[:publisher].gsub(\"-\",\" \")\n \n if (@publisher == \"all\")\n @releases = Release.find(:all, :order => \"release_date DESC\")\n else\n @releases = Release.find(:all, :conditions => [\"publisher = ?\", @publisher], :order => \"release_date DESC\")\n end\n \n respond_to do |format| \n format.html {render :template => \"releases/index\"}\n format.xml {render :template => \"releases/index\", :layout => false} \n end\n end", "def latest(*args)\n arguments(args, required: [:owner, :repo]).params\n\n get_request(\"repos/#{arguments.owner}/#{arguments.repo}/releases/latest\", arguments.params)\n end", "def new\n @commit = params[:commit]\n @release = @environment.releases.new(\n commit0: @environment.last_commit,\n commit1: @commit)\n if @release.can_read_commits?\n @release.load_commits!\n @release.load_tickets!\n @release.build_changes_from_commits\n end\n if @release.changes.none?\n render :template => \"releases/new_pick_commit\"\n else\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release }\n end\n end\n end", "def request_release(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_release\", options).body)\n @attributes = response['items']\n true\n end", "def request_release(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_release\", options).body)\n @attributes = response['items']\n true\n end", "def github_released\n puts green(\"Release completed\")\n end", "def to_release\n user.releases.find_or_initialize_by(discogs_release_id: discogs_release_id).tap do |release|\n release.catalog_number = catalog_number\n release.label = label\n release.artist = artist\n release.name = name\n release.year = year\n release.genre = genre\n release.format = format\n release.format_quantity = format_quantity\n release.discogs_community_have = discogs_community_have\n release.discogs_community_want = discogs_community_want\n release.discogs_lowest_price = discogs_lowest_price\n release.discogs_number_for_sale = discogs_number_for_sale\n release.discogs_cover_thumb_url = discogs_cover_thumb_url\n release.discogs_api_resource_url = discogs_api_resource_url\n release.discogs_uri = discogs_uri\n end\n end", "def index\n @package_versions = PackageVersion.all\n end", "def get_labels_releases(label_id, pagination={})\n query_and_build \"labels/#{label_id}/releases\", pagination\n end", "def upcoming_dvd_releases\n return @badfruit.parse_movies_array(JSON.parse(@badfruit.get_lists_action(\"upcoming_dvds\")))\n end", "def press_release_params\n params.require(:press_release).permit(:title, :article, :published_on)\n end", "def getNewReleases(time=nil,start=nil,count=nil,extras=nil)\n method = 'getNewReleases'\n type = Album\n args = {}\n args[:time] = time if time\n args[:start] = start if start\n args[:count] = count if count\n args[:extras] = extras if extras\n return_object type,method,args\n end", "def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end", "def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end", "def get(*args)\n params = arguments(args, required: [:owner, :repo, :id]).params\n\n get_request(\"/repos/#{owner}/#{repo}/releases/assets/#{id}\" , params)\n end", "def show\n @release = Release.find(params[:id])\n \n # send to release page if not archived\n redirect_to(:controller => 'releases', :action => 'show', :id => @release.id) and return if [email protected]\n \n # populate release fixes from mantis\n if @release.mantis_project_version_id\n @issues = Issue.fixed(@release.mantis_project_id, @release.mantis_project_version_name)\n end\n @version_released = @release.released?\n @version_release_date = Time.at(@release.release_date).strftime(\"%Y-%m-%d\") if @version_released && @release.release_date\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @release }\n end\n end", "def listversions(project=self.project)\n get('listversions.json', project: project)['versions']\n end", "def data\n return @data if @data\n\n remote = fetch(ref: RELEASES_REF, path: RELEASES_PATH)\n @sha = remote.sha\n\n content = parse(remote.content)\n raise self::ValidationError unless valid?(content)\n\n unsorted = content.filter_map do |release|\n version_string = release['version']\n release_date = release['date']\n\n next if version_string < self::ENABLED_MIN\n\n if version_string < self::SEMVER_MIN\n version_fix = version_string.gsub(/-p(\\d+)/, '.\\1')\n version_comparable = Gem::Version.new(version_fix)\n else\n version_comparable = Gem::Version.new(version_string)\n end\n\n Release.new(version_string, version_comparable, release_date)\n end\n\n @data ||= unsorted.sort_by(&:comparable).reverse\n end", "def update\n respond_to do |format|\n if @press_release.update(press_release_params)\n format.html { redirect_to @press_release, notice: 'Press release was successfully updated.' }\n format.json { render :show, status: :ok, location: @press_release }\n else\n format.html { render :edit }\n format.json { render json: @press_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def list\n @module_name = _('release_Edit')\n @project_id = params[:project_id]\n @releases = Release.find :all,\n :conditions => \"project_id = #{params[:project_id]}\", :order => 'due desc'\n if params[:layout] == 'false'\n render :layout => false \n end\n end", "def list_all_aos_version_boxes(args = {}) \n get(\"/aosversions.json/aosversionbox\", args)\nend", "def fetch_releases(name)\n releases = {}\n\n sources.each do |source|\n source.fetch(name).each do |dependency|\n releases[dependency.version] ||= dependency\n end\n end\n\n return releases.values\n end", "def get_aos_version_by_name(args = {}) \n get(\"/aosversions.json/version/#{args[:aosVersionName]}\", args)\nend" ]
[ "0.7414778", "0.72152907", "0.72152907", "0.7171297", "0.70245", "0.6861803", "0.6860327", "0.68504024", "0.6761848", "0.6735103", "0.6615795", "0.6615795", "0.6589425", "0.65626645", "0.65433186", "0.6529931", "0.6513217", "0.65011406", "0.6467608", "0.6454987", "0.6431971", "0.6374215", "0.6373569", "0.6351559", "0.6313519", "0.6252525", "0.6242165", "0.62037486", "0.61852324", "0.6179469", "0.61564606", "0.6141353", "0.613035", "0.6115999", "0.6112453", "0.60933334", "0.6086506", "0.6074684", "0.6004909", "0.59951365", "0.59785545", "0.59727764", "0.5919458", "0.591309", "0.5849936", "0.5848176", "0.58475864", "0.58264005", "0.58250904", "0.58090746", "0.5801894", "0.5798509", "0.578223", "0.57816637", "0.57814443", "0.57750183", "0.5773843", "0.57722086", "0.5735028", "0.57312495", "0.57290936", "0.57279164", "0.5725672", "0.5725232", "0.56954366", "0.5683311", "0.5657654", "0.5626524", "0.56189436", "0.5609591", "0.55974287", "0.55840933", "0.5582345", "0.55763143", "0.55680746", "0.556237", "0.55419976", "0.5536871", "0.5530493", "0.5528458", "0.55154663", "0.55154663", "0.5505083", "0.5498415", "0.5490329", "0.5490238", "0.54897755", "0.54888076", "0.5484128", "0.5481612", "0.5481612", "0.5462757", "0.5457175", "0.5447124", "0.5419016", "0.541436", "0.5408743", "0.54073465", "0.5404637", "0.5393228" ]
0.7504101
0
GET /press_releases/1 GET /press_releases/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end", "def index\n @press_releases = PressRelease.all\n end", "def show\n @release = @environment.releases.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @release }\n end\n end", "def new_releases\n api_call(\"https://api.spotify.com/\",\"/v1/browse/new-releases\")\n end", "def index\n @releases = Release.all\n end", "def index\n @releases = Release.all\n end", "def release(project_id, release_id, options = {})\n get \"projects/#{project_id}/releases/#{release_id}\", options\n end", "def get_release(release_id)\n query_and_build \"releases/#{release_id}\"\n end", "def index\n @releases = Release.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases.to_json(:except => [:user_id]) }\n end\n end", "def get_release(project)\n info = get_github_api(project, \"releases\")\n release = 'master'\n if info.length > 0\n unpublishedDraftLimit = 5\n x = 0\n release = info[x]['tag_name']\n # Unpublished drafts need to be skipped.\n while (unpublishedDraftLimit > x) && info[x]['draft']\n release = info[x]['tag_name']\n x += 1\n end\n end\n release\n end", "def releases(country = nil)\n Birdman::Requester.get(\"movies/#{id}/releases/#{country}\")\n end", "def index\n @client_releases = ClientRelease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_releases }\n end\n end", "def show\n @release = Release.find(params[:id])\n @total_downloads = 0\n @release.versions.each do |v|\n @total_downloads += v.downloads\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @release }\n end\n end", "def fetch_releases\n require \"open-uri\"\n\n open(RELEASE_URL) { |f| f.read.scan RELEASE_REGEXP }\n end", "def list_releases(workspace_id)\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n url = @api_url + \"/api/workspaces/#{workspace_id}/releases\"\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n releases = JSON.parse(r.body)['data']\n #release_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"releases dump is #{JSON.pretty_generate(releases)}\\nrelease count is #{release_count}\"\n\n releases.each do |release|\n results.push(release)\n end\n return results\n end", "def get(*args)\n arguments(args, required: [:owner, :repo, :id]).params\n\n get_request(\"/repos/#{arguments.owner}/#{arguments.repo}/releases/#{arguments.id}\" , arguments.params)\n end", "def releases\n self.class.releases\n end", "def releases\n self.class.releases\n end", "def index\n respond_with releases\n end", "def create\n @release = @environment.releases.new(params[:release])\n\n respond_to do |format|\n if @release.save\n format.html { redirect_to @release, notice: 'Release was successfully created.' }\n format.json { render json: @release, status: :created, location: @release }\n else\n format.html { render action: \"new\" }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end", "def campaign_release(id)\n rest.get(:releasesms, id: id)['data']\n end", "def index\n response = VersionResponse.new( BUILD_VERSION )\n render json: response, :status => 200\n end", "def related_releases\n Rails.cache.fetch(\"releases/release-#{id}\", :expires_in => 1.hour) do\n real_releases.all(:order => 'date DESC', :limit => 15)\n end\n end", "def releases_in_group(release_group_id, options = {})\n get \"release_groups/#{release_group_id}/releases\", options\n end", "def release\n _init\n\n @release = Release.find_by_name(params[:release]) if params[:release]\n @release = Release.actived.first unless @release\n\n render :template => 'sprint/release', :layout => 'release'\n end", "def release_url(api_url, title)\n # \"subject\": {\n # \"title\": \"v1.4.4\",\n # \"url\": \"https://api.github.com/repos/typed-ember/ember-cli-typescript/releases/13191777\",\n # \"latest_comment_url\": \"https://api.github.com/repos/typed-ember/ember-cli-typescript/releases/13191777\",\n # \"type\": \"Release\"\n # },\n api_index = api_url.index(\"api\")\n repos_index = api_url.index(\"repos\")\n releases_index = api_url.index(\"releases\")\n\n # https://github.com/typed-ember/ember-cli-typescript/releases/tag/v1.4.4\n html_url = api_url[0..api_index - 1] +\n api_url[api_index + \"api.\".length..repos_index - 1] +\n api_url[repos_index + \"repos/\".length..releases_index + \"releases\".length] +\n \"tag/#{title}\"\n html_url\n end", "def get_last_release\n r = api_get(\"/releases\")\n\n return r[0]['tag_name']\nend", "def get_url\n heroku_app = options[:heroku_app]\n uriString = \"https://api.heroku.com/apps/#{heroku_app}/releases\"\n accept = '\"Accept: application/vnd.heroku+json; version=3\"'\n order = '\"Range: version ..; order=desc, max=10;\"'\n uri = URI(uriString)\n puts \"URI: #{uri}\"\n\n res = `curl -n --silent #{uriString} -H #{accept} -H #{order}`\n\n result = JSON.parse(res)\n\n id = nil\n ver = nil\n hash = nil\n result.each { |i|\n puts i\n if !id && i[\"slug\"] && i[\"slug\"][\"id\"] && i[\"slug\"][\"id\"] != \"\"\n id = i[\"slug\"][\"id\"]\n ver = i[\"version\"]\n hash = i[\"description\"]\n end\n }\n\n #puts id if id\n if id != nil\n\n uriStringSlug = \"https://api.heroku.com/apps/#{heroku_app}/slugs/#{id}\"\n uriSlug = URI(uriStringSlug)\n\n resSlug = `curl -n --silent #{uriStringSlug} -H #{accept}`\n resultSlug = JSON.parse(resSlug)\n p \"--------------------------------\"\n p \"Version: #{ver}\"\n p \"Hash: #{hash}\"\n p resultSlug[\"blob\"][\"url\"]\n p \"--------------------------------\"\n end\n end", "def release\n case new_resource.version\n when 'latest'\n require 'octokit'\n Octokit.releases(repo).first[:tag_name]\n else\n \"v#{new_resource.version}\"\n end\n end", "def show\n @os_release = OsRelease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @os_release }\n end\n end", "def display_releases(releases)\n url = \"\"\n releases.each do |release|\n puts \"\\n\\n#{release.name} by #{release.artist} on #{release.label}\\n\"\n release.tracks.each_with_index do |track, index|\n puts \"-#{track.name}\"\n url = track.url\n end\n end\n end", "def show\n @release = Release.find(params[:id])\n\n # respond_to do |format|\n # format.html show.html.erb\n # format.json { render json: @release }\n # end\n end", "def get_latest_release(project, bin)\n api_url = \"https://api.github.com/repos/#{project}/releases/latest\"\n data = URI.parse(api_url).read\n obj = JSON.parse(data)\n version = obj[\"name\"]\n sha_url = \"https://github.com/#{project}/releases/download/#{version}/#{bin}.sha256\"\n sha = URI.parse(sha_url).read\n url = \"https://github.com/#{project}/releases/download/#{version}/#{bin}\"\n sha256 = sha.split(\" \").first\n\n return url, sha256, version\nend", "def index\n @object_releases = ObjectRelease.all\n end", "def index\n @title = \"News and Events - Think India NITR club\"\n @press_releases = PressRelease.all.order(\"created_at desc\")\n end", "def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend", "def index\n #@releases = Release.all\n @releases = Release.where(cashier_id: current_user.cashier.id, view: true)\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @releases }\n # end\n end", "def new_dvd_releases\n return @badfruit.parse_movies_array(JSON.parse(@badfruit.get_lists_action(\"new_releases\")))\n end", "def show\n @environment = @project.environments.find_by_slug!(params[:id])\n @releases = @environment.releases\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @environment }\n end\n end", "def new\n @release = Release.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release }\n end\n end", "def destroy\n @press_release.destroy\n respond_to do |format|\n format.html { redirect_to press_releases_url }\n format.json { head :no_content }\n end\n end", "def release\n configs = store(:get, 'configs').to_s.gsub(\"\\n\", \" \")\n \n # TODO: if error, user need to deploy code first (nothing to deploy) => use a special exit code \n # when code is not pushed or only deploy if app has a correct build\n version = @api.release(@name, configs).to_s.chomp.gsub(\"\\n\", \" \")\n backend = @api.run(@name, :web, version).to_s.chomp.gsub(\"\\n\", \" \")\n @api.route @name, backend\n return version\n end", "def index\n @release_items = ReleaseItem.all\n end", "def releases\n repo.releases(changelog.changes)\n end", "def index\n params[:page] ||= 1\n \n @releases = Release.search_archive(params[:search], params[:page])\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @releases }\n end\n end", "def show\n @press = Press.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @press }\n end\n end", "def map_releases\n releases.sort! {|x,y| x[1] <=> y[1] }\n .map { |release|\n {\n \"version\" => release[1],\n \"status\" => \"active\",\n \"description_html\" => \"<p>#{release[0]}</p>\",\n \"description_markdown\" => release[0],\n \"providers\" => [\n {\"name\" => \"virtualbox\", \"url\" => \"#{RELEASE_URL}#{release[0]}\"}\n ]\n }\n }\n end", "def get_releases(artist_id, options={})\n api_response = @api_client.make_api_request(:GET, \"artist/releases\", {:artistId => artist_id}, options)\n @api_client.release_digestor.list_from_xml(api_response.content.releases)\n end", "def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend", "def show\n @client_release = ClientRelease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_release }\n end\n end", "def info\n release = args.shift.downcase.strip rescue nil\n raise(CommandFailed, \"Specify a release\") unless release\n\n release = heroku.release(app, release)\n\n display \"=== Release #{release['name']}\"\n display_info(\"Change\", release[\"descr\"])\n display_info(\"By\", release[\"user\"])\n display_info(\"When\", time_ago(Time.now.to_i - Time.parse(release[\"created_at\"]).to_i))\n display_info(\"Addons\", release[\"addons\"].join(\", \"))\n display_vars(release[\"env\"])\n end", "def destroy\n @release = @environment.releases.find(params[:id])\n @release.destroy\n\n respond_to do |format|\n format.html { redirect_to releases_url }\n format.json { head :no_content }\n end\n end", "def current_dvd_releases\n return @badfruit.parse_movies_array(JSON.parse(@badfruit.get_lists_action(\"current_releases\")))\n end", "def create\n @press_release = PressRelease.new(press_release_params)\n\n respond_to do |format|\n if @press_release.save\n format.html { redirect_to @press_release, notice: 'Press release was successfully created.' }\n format.json { render :show, status: :created, location: @press_release }\n else\n format.html { render :new }\n format.json { render json: @press_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @press_release = PressRelease.new(press_release_params)\n\n respond_to do |format|\n if @press_release.save\n format.html { redirect_to @press_release, notice: 'Press release was successfully created.' }\n format.json { render action: 'show', status: :created, location: @press_release }\n else\n format.html { render action: 'new' }\n format.json { render json: @press_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def release_info\n @release_info ||= @connection.get(RELEASE_INFO_PATH)['release']\n end", "def get_release_info(author, repository, options)\n url = Kernel.format(\n 'https://api.github.com/repos/%{author}/%{repository}/releases/%{tag}%{release}',\n author: author,\n repository: repository,\n tag: (options[:is_tag]) ? 'tags/' : '',\n release: options[:release],\n )\n\n release_info_json = fetch_from_url(\n url,\n options[:username],\n options[:password],\n options[:use_auth],\n options[:use_oauth],\n )\n\n return nil unless release_info_json\n\n # Read in release info from JSON file\n\n Puppet.debug('Parsing release info')\n\n # noinspection RubyResolve\n PSON.load(release_info_json)\nend", "def get_aos_version_by_name(args = {}) \n get(\"/aosversions.json/version/#{args[:aosVersionName]}\", args)\nend", "def new\n @commit = params[:commit]\n @release = @environment.releases.new(\n commit0: @environment.last_commit,\n commit1: @commit)\n if @release.can_read_commits?\n @release.load_commits!\n @release.load_tickets!\n @release.build_changes_from_commits\n end\n if @release.changes.none?\n render :template => \"releases/new_pick_commit\"\n else\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release }\n end\n end\n end", "def first_release\n self.releases.where(status: STATUS[:completed]).first\n end", "def release\n release_data = EventDate.data_for_release(params[:date_id])\n render json: release_data.to_json\n end", "def destroy\n @press_release.destroy\n respond_to do |format|\n format.html { redirect_to press_releases_url, notice: 'Press release was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def set_press_release\n @press_release = PressRelease.find(params[:id])\n end", "def create\n # Extract the version info\n release = params[:release]\n version = params[:release][:version]\n release.delete(\"version\")\n \n # Validate input\n if (release[:name] == \"\")\n flash[:notice] = \"You must supply a name for the release\"\n respond_to do |format|\n format.html { redirect_to :action => 'new' }\n format.json { head :no_content }\n end\n elsif (release[:source_url] == \"\")\n flash[:notice] = \"You must supply a source URL\"\n respond_to do |format|\n format.html { redirect_to :action => 'new' }\n format.json { head :no_content }\n end\n else\n # Add http:// prefix to source_url if it doesn't already exist\n release[:source_url] = \"http://#{release[:source_url]}\" if not release[:source_url].starts_with? \"http://\" and not release[:source_url].starts_with? \"https://\"\n \n @release = Release.new(release)\n @release.user = current_user\n \n # Add the version info\n # If the URL doesn't start with http:// or https://, add it\n version[:download_url] = \"http://#{version[:download_url]}\" if not version[:download_url].starts_with? \"http://\" and not version[:download_url].starts_with? \"https://\"\n \n @version = Version.new(version)\n @version.version_number = 1\n @version.release = @release\n @release.versions << @version\n\n respond_to do |format|\n if @release.save\n format.html { redirect_to @release, notice: 'Release was successfully created.' }\n format.json { render json: @release, status: :created, location: @release }\n else\n format.html { render action: \"new\" }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def fetch_versions\n http_get(\"#{host}/#{Configuration.versions_file}\").body\n end", "def show\n @persons_release = PersonsRelease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persons_release }\n end\n end", "def release_version!\n projects.each { |project| project.release_version!(tag_full_name) }\n print_log 'Versions released'\n slack_notifier.ping(release_message, icon_emoji: ':see_no_evil:')\n end", "def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end", "def latest\n client = XMLRPC::Client.new2(\"http://pypi.python.org/pypi\")\n client.http_header_extra = {\"Content-Type\" => \"text/xml\"}\n client.timeout = 10\n result = client.call(\"package_releases\", @resource[:name])\n result.first\n rescue Timeout::Error => detail\n raise Puppet::Error, \"Timeout while contacting pypi.python.org: #{detail}\";\n end", "def post_release_v2(app_name, slug, dyno_types, user, token,\n slug_url, repo_size)\n slug_url_regex = /https:\\/\\/(.+?)\\.s3\\.amazonaws\\.com\\/(.+?)\\?/\n _, slug_put_key, slug_put_bucket = slug_url.match(slug_url_regex).to_a\n start = Time.now\n payload = {\n # \"head\" => head,\n # \"prev_head\" => commit_hash,\n # \"current_seq\" => current_seq,\n \"slug_put_key\" => slug_put_key,\n \"slug_put_bucket\" => slug_put_bucket,\n \"repo_size\" => repo_size,\n \"release_descr\" => \"sokoban-built release\", # punting for v2\n \"language_pack\" => \"Sokoban\", # punting for v2\n \"buildpack\" => \"Sokoban\", # punting for v2\n \"slug_version\" => 2,\n \"slug_size\" => File.size(slug),\n \"stack\" => \"cedar\",\n \"user\" => user,\n \"process_types\" => dyno_types,\n \"git_log\" => \"\",\n \"run_deploy_hooks\" => false,\n \"addons\" => {},\n \"config_vars\" => {}}\n\n release_name =\n Timeout.timeout(30) do\n uri = URI.parse(release_uri(app_name))\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri)\n if uri.scheme == \"https\"\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n request.basic_auth(user, token)\n request[\"Content-Type\"] = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request.body = JSON.unparse(payload)\n response = http.request(request)\n if (response.code != \"200\")\n error_message = begin\n response.body && JSON.parse(response.body)[\"error\"] || \"failure releasing code\"\n rescue Timeout::Error\n \"timed out releasing code\"\n rescue\n \"failure releasing code\"\n end\n raise(error_message)\n end\n response.body\n end\n release_name\n end", "def create_release(node)\n if node.attributes['id'] and @releases[node.attributes['id']]\n release = @releases[node.attributes['id']]\n else\n release = @factory.new_release\n @releases[node.attributes['id']] = release\n end\n \n # Read all defined data fields\n release.id = node.attributes['id']\n release.title = node.elements['title'].text if node.elements['title']\n release.asin = node.elements['asin'].text if node.elements['asin']\n release.artist = create_artist(node.elements['artist']) if node.elements['artist']\n \n # Read the types\n node.attributes['type'].split(' ').each {|type|\n release.types << Utils.add_namespace(type)\n } if node.attributes['type']\n \n # Read the text representation information.\n if text_representation = node.elements['text-representation']\n release.text_language = text_representation.attributes['language']\n release.text_script = text_representation.attributes['script']\n end\n \n # Read the track list\n read_track_list(node.elements['track-list'], release.tracks) {|track|\n track.artist = release.artist unless track.artist\n track.releases << release\n }\n \n # Read the release event list\n read_release_event_list(node.elements['release-event-list'], release.release_events)\n \n # Read the disc list\n read_disc_list(node.elements['disc-list'], release.discs)\n \n # Read the relation list\n if node.elements['relation-list']\n node.elements.each('relation-list') {|relation_node|\n read_relation_list(relation_node) {|relation|\n release.add_relation relation\n }\n }\n end\n \n # Read the tag list\n read_tag_list(node.elements['tag-list'], release.tags)\n \n return release\n end", "def latest\n releases.first\n end", "def new\n @os_release = OsRelease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @os_release }\n end\n end", "def get_aos_version(args = {}) \n get(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def index\n @release_mains = ReleaseMain.all\n end", "def show\n @release = Release.find(params[:id])\n \n # send to release page if not archived\n redirect_to(:controller => 'releases', :action => 'show', :id => @release.id) and return if [email protected]\n \n # populate release fixes from mantis\n if @release.mantis_project_version_id\n @issues = Issue.fixed(@release.mantis_project_id, @release.mantis_project_version_name)\n end\n @version_released = @release.released?\n @version_release_date = Time.at(@release.release_date).strftime(\"%Y-%m-%d\") if @version_released && @release.release_date\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @release }\n end\n end", "def releases\n all(QTest::Release, project: @id)\n end", "def get_release_notes\n path = '/v3/release-logs.json'\n\n header = {\n 'Content-Type' => 'application/json',\n 'User-Agent' => Config.user_agent\n }\n request = Net::HTTP::Get.new(path, header)\n handle_response(@api_client.request(request), 'get_release_notes')\n end", "def info\n validate_arguments!\n\n remotes = self.class.heroku_remotes\n\n # trigger 'No app specified' message\n remotes.push ['--app', app] if remotes.empty? or options[:app]\n\n output = {}\n remotes.map do |remote|\n Thread.new(remote) do |remote, app|\n begin\n # capture stdout\n Thread.current[:output] = []\n\n release = api.get_releases(app).body.sort_by do |release|\n release[\"name\"][1..-1].to_i\n end.last[\"name\"]\n\n # display_header(\"#{app}\")\n puts \"##### #{app} #####\\n\"\n\n # this is simply copied from 3.9.6/lib/heroku/command/releases.rb\n # https://github.com/heroku/heroku/blob/master/lib/heroku/command/releases.rb\n\n # ---------\n release_data = api.get_release(app, release).body\n\n data = {\n 'By' => release_data['user'],\n 'Change' => release_data['descr'],\n 'When' => time_ago(release_data[\"created_at\"])\n }\n\n unless release_data['addons'].empty?\n data['Addons'] = release_data['addons']\n end\n\n\n styled_header(\"Release #{release}\")\n styled_hash(data)\n\n display\n\n styled_header(\"#{release} Config Vars\")\n unless release_data['env'].empty?\n if options[:shell]\n release_data['env'].keys.sort.each do |key|\n display(\"#{key}=#{release_data['env'][key]}\")\n end\n else\n styled_hash(release_data['env'])\n end\n else\n display(\"#{release} has no config vars.\")\n end\n # ---------\n\n # capture stdout\n output[remote] = Thread.current[:output].join\n rescue\n output[remote] = \"Something went wrong fetching releases for #{app}.\"\n end\n end\n end.map(&:join)\n\n output.sort.each do |remote, output|\n puts output\n puts\n end\n end", "def latest(*args)\n arguments(args, required: [:owner, :repo]).params\n\n get_request(\"repos/#{arguments.owner}/#{arguments.repo}/releases/latest\", arguments.params)\n end", "def index\n @package_versions = PackageVersion.all\n end", "def show\n @version = Version.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @version }\n end\n end", "def index\n @projects = ProjectDecorator.all\n @releases = ReleaseDecorator.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @projects }\n end\n end", "def request_release(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_release\", options).body)\n @attributes = response['items']\n true\n end", "def request_release(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_release\", options).body)\n @attributes = response['items']\n true\n end", "def update\n @release = @environment.releases.find(params[:id])\n\n respond_to do |format|\n if @release.update_attributes(params[:release])\n format.html { redirect_to @release, notice: 'Release was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @press = Press.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @press }\n end\n end", "def update\n respond_to do |format|\n if @press_release.update(press_release_params)\n format.html { redirect_to @press_release, notice: 'Press release was successfully updated.' }\n format.json { render :show, status: :ok, location: @press_release }\n else\n format.html { render :edit }\n format.json { render json: @press_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def created_release(version)\n puts green(\"Release #{version} created\")\n end", "def new\n @client_release = ClientRelease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client_release }\n end\n end", "def to_check\n @releases = Release.all\n end", "def version_info\n path = File.join(SERVER_ROOT, 'public', 'version_info.json')\n JSON.load File.read(path)\nend", "def version\n api_execute('/version', :get).body\n end", "def show\n @revision = Revision.find(params[:id])\n\n render json: @revision\n end", "def get(*args)\n params = arguments(args, required: [:owner, :repo, :id]).params\n\n get_request(\"/repos/#{owner}/#{repo}/releases/assets/#{id}\" , params)\n end", "def render_version\n render json: { version: BUILD_VERSION }, status: 200\n end", "def set_press_release\n @press_release = PressRelease.friendly.find(params[:id])\n end", "def page_versions\n list_versions_for(latest_version_of(@item.path))\n end", "def to_release\n user.releases.find_or_initialize_by(discogs_release_id: discogs_release_id).tap do |release|\n release.catalog_number = catalog_number\n release.label = label\n release.artist = artist\n release.name = name\n release.year = year\n release.genre = genre\n release.format = format\n release.format_quantity = format_quantity\n release.discogs_community_have = discogs_community_have\n release.discogs_community_want = discogs_community_want\n release.discogs_lowest_price = discogs_lowest_price\n release.discogs_number_for_sale = discogs_number_for_sale\n release.discogs_cover_thumb_url = discogs_cover_thumb_url\n release.discogs_api_resource_url = discogs_api_resource_url\n release.discogs_uri = discogs_uri\n end\n end", "def get_artists_releases(artist_id, pagination={})\n query_and_build \"artists/#{artist_id}/releases\", pagination\n end", "def github_released\n puts green(\"Release completed\")\n end" ]
[ "0.74010694", "0.7379097", "0.72256076", "0.7192834", "0.71362644", "0.71362644", "0.70560074", "0.6947183", "0.68290967", "0.6745728", "0.6642319", "0.6618137", "0.6618009", "0.65002877", "0.64635825", "0.6448798", "0.6366669", "0.6366669", "0.63298917", "0.632745", "0.63236403", "0.63201386", "0.6296165", "0.62945145", "0.6283924", "0.62778544", "0.6273508", "0.6261016", "0.62472045", "0.62226075", "0.6218542", "0.6217635", "0.6204273", "0.61994886", "0.6192612", "0.61842513", "0.6168374", "0.61434394", "0.613054", "0.6128753", "0.6100515", "0.6070424", "0.60691065", "0.60648084", "0.60427004", "0.60174876", "0.59963775", "0.5986342", "0.59649235", "0.5963222", "0.59537846", "0.59317005", "0.59299695", "0.5928441", "0.59163964", "0.59161747", "0.5899459", "0.58649737", "0.5860369", "0.584454", "0.583909", "0.58325", "0.5827285", "0.5826371", "0.58168435", "0.5808047", "0.5804837", "0.58012897", "0.58012897", "0.5797845", "0.57907903", "0.5765932", "0.5764763", "0.5750534", "0.57262206", "0.5724583", "0.57125133", "0.5705984", "0.5699426", "0.56982315", "0.568461", "0.5678108", "0.56751955", "0.5666117", "0.5666117", "0.5647346", "0.5633553", "0.5616672", "0.5607272", "0.56057817", "0.5604349", "0.56017745", "0.55754966", "0.5572956", "0.55714834", "0.55630463", "0.55497444", "0.55384475", "0.5531163", "0.5530651", "0.55245453" ]
0.0
-1
POST /press_releases POST /press_releases.json
def create @press_release = PressRelease.new(press_release_params) respond_to do |format| if @press_release.save format.html { redirect_to @press_release, notice: 'Press release was successfully created.' } format.json { render action: 'show', status: :created, location: @press_release } else format.html { render action: 'new' } format.json { render json: @press_release.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @release = @environment.releases.new(params[:release])\n\n respond_to do |format|\n if @release.save\n format.html { redirect_to @release, notice: 'Release was successfully created.' }\n format.json { render json: @release, status: :created, location: @release }\n else\n format.html { render action: \"new\" }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_releases\n api_call(\"https://api.spotify.com/\",\"/v1/browse/new-releases\")\n end", "def create\n @press_release = PressRelease.new(press_release_params)\n\n respond_to do |format|\n if @press_release.save\n format.html { redirect_to @press_release, notice: 'Press release was successfully created.' }\n format.json { render :show, status: :created, location: @press_release }\n else\n format.html { render :new }\n format.json { render json: @press_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_release_v2(app_name, slug, dyno_types, user, token,\n slug_url, repo_size)\n slug_url_regex = /https:\\/\\/(.+?)\\.s3\\.amazonaws\\.com\\/(.+?)\\?/\n _, slug_put_key, slug_put_bucket = slug_url.match(slug_url_regex).to_a\n start = Time.now\n payload = {\n # \"head\" => head,\n # \"prev_head\" => commit_hash,\n # \"current_seq\" => current_seq,\n \"slug_put_key\" => slug_put_key,\n \"slug_put_bucket\" => slug_put_bucket,\n \"repo_size\" => repo_size,\n \"release_descr\" => \"sokoban-built release\", # punting for v2\n \"language_pack\" => \"Sokoban\", # punting for v2\n \"buildpack\" => \"Sokoban\", # punting for v2\n \"slug_version\" => 2,\n \"slug_size\" => File.size(slug),\n \"stack\" => \"cedar\",\n \"user\" => user,\n \"process_types\" => dyno_types,\n \"git_log\" => \"\",\n \"run_deploy_hooks\" => false,\n \"addons\" => {},\n \"config_vars\" => {}}\n\n release_name =\n Timeout.timeout(30) do\n uri = URI.parse(release_uri(app_name))\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri)\n if uri.scheme == \"https\"\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n request.basic_auth(user, token)\n request[\"Content-Type\"] = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request.body = JSON.unparse(payload)\n response = http.request(request)\n if (response.code != \"200\")\n error_message = begin\n response.body && JSON.parse(response.body)[\"error\"] || \"failure releasing code\"\n rescue Timeout::Error\n \"timed out releasing code\"\n rescue\n \"failure releasing code\"\n end\n raise(error_message)\n end\n response.body\n end\n release_name\n end", "def write_release(payload)\n info 'Creating new release on GitHub'\n rel = payload[:data][:github_kit].delete(:release)\n release = github_client.create_release(\n rel[:repository],\n rel[:tag_name],\n :name => rel[:name],\n :target_commitish => rel[:reference],\n :prerelease => rel[:prerelease],\n :body => rel[:body]\n )\n\n api_release_url = release.rels[:self].href\n public_release_url = release.rels[:html].href\n\n info 'New release created on GitHub. Uploading assets.'\n assets = rel[:assets].map do |asset|\n debug \"Uploading release asset - #{asset}\"\n response = github_client.upload_asset(\n api_release_url,\n asset_store.get(asset),\n :name => asset.sub(/^.+?_/, ''),\n :content_type => 'application/octet-stream'\n )\n debug \"Completed release asset upload - #{asset}\"\n Smash.new(\n :url => response[:url],\n :browser_url => response[:browser_download_url],\n :name => response[:name],\n :id => response[:id]\n )\n end\n payload.set(:data, :github_kit, :release, :assets, assets)\n payload.set(:data, :github_kit, :release, :api_url, api_release_url)\n payload.set(:data, :github_kit, :release, :public_url, public_release_url)\n\n true\n end", "def create_release(attrs = {})\n release = build_release(attrs)\n release.save\n release\n end", "def release(project_id, release_id, options = {})\n get \"projects/#{project_id}/releases/#{release_id}\", options\n end", "def create_release(node)\n if node.attributes['id'] and @releases[node.attributes['id']]\n release = @releases[node.attributes['id']]\n else\n release = @factory.new_release\n @releases[node.attributes['id']] = release\n end\n \n # Read all defined data fields\n release.id = node.attributes['id']\n release.title = node.elements['title'].text if node.elements['title']\n release.asin = node.elements['asin'].text if node.elements['asin']\n release.artist = create_artist(node.elements['artist']) if node.elements['artist']\n \n # Read the types\n node.attributes['type'].split(' ').each {|type|\n release.types << Utils.add_namespace(type)\n } if node.attributes['type']\n \n # Read the text representation information.\n if text_representation = node.elements['text-representation']\n release.text_language = text_representation.attributes['language']\n release.text_script = text_representation.attributes['script']\n end\n \n # Read the track list\n read_track_list(node.elements['track-list'], release.tracks) {|track|\n track.artist = release.artist unless track.artist\n track.releases << release\n }\n \n # Read the release event list\n read_release_event_list(node.elements['release-event-list'], release.release_events)\n \n # Read the disc list\n read_disc_list(node.elements['disc-list'], release.discs)\n \n # Read the relation list\n if node.elements['relation-list']\n node.elements.each('relation-list') {|relation_node|\n read_relation_list(relation_node) {|relation|\n release.add_relation relation\n }\n }\n end\n \n # Read the tag list\n read_tag_list(node.elements['tag-list'], release.tags)\n \n return release\n end", "def process_payload\n payload = params['release']\n repo = Repo.find_by(github_id: params['repository']['id'])\n\n render nothing: true, status: :forbidden and return if repo.inactive?\n\n release = Release.new(\n repo_id: repo.id,\n github_id: payload['id'],\n html_url: payload['html_url'],\n tag_name: payload['tag_name'],\n body: payload['body'],\n prerelease: payload['prerelease'],\n published_at: Time.iso8601(payload['published_at'])\n )\n\n if release.save\n render nothing: true, status: :created\n else\n render nothing: true, status: :bad_request\n end\n end", "def create\n # Extract the version info\n release = params[:release]\n version = params[:release][:version]\n release.delete(\"version\")\n \n # Validate input\n if (release[:name] == \"\")\n flash[:notice] = \"You must supply a name for the release\"\n respond_to do |format|\n format.html { redirect_to :action => 'new' }\n format.json { head :no_content }\n end\n elsif (release[:source_url] == \"\")\n flash[:notice] = \"You must supply a source URL\"\n respond_to do |format|\n format.html { redirect_to :action => 'new' }\n format.json { head :no_content }\n end\n else\n # Add http:// prefix to source_url if it doesn't already exist\n release[:source_url] = \"http://#{release[:source_url]}\" if not release[:source_url].starts_with? \"http://\" and not release[:source_url].starts_with? \"https://\"\n \n @release = Release.new(release)\n @release.user = current_user\n \n # Add the version info\n # If the URL doesn't start with http:// or https://, add it\n version[:download_url] = \"http://#{version[:download_url]}\" if not version[:download_url].starts_with? \"http://\" and not version[:download_url].starts_with? \"https://\"\n \n @version = Version.new(version)\n @version.version_number = 1\n @version.release = @release\n @release.versions << @version\n\n respond_to do |format|\n if @release.save\n format.html { redirect_to @release, notice: 'Release was successfully created.' }\n format.json { render json: @release, status: :created, location: @release }\n else\n format.html { render action: \"new\" }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create_release(tag, message)\n\n if not is_valid_tag(tag)\n raise \"Invalid tag.\"\n end\n\n if message.empty?\n raise \n message = \"Release for #{tag}\"\n end\n\n message = {\n \"tag_name\": tag,\n \"target_commitish\": \"master\",\n \"name\": tag,\n \"body\": message,\n \"draft\": false,\n \"prerelease\": false\n }.to_json\n\n r = api_post(\"/releases\", message)\n\n if not r.kind_of? Net::HTTPCreated\n raise \"Creation of release unsuccessful.\"\n end\nend", "def index\n @press_releases = PressRelease.all\n end", "def press_release_params\n params.require(:press_release).permit(:title, :article, :published_on)\n end", "def github_post\n {\n \"create\" => ->(release) { start_deployment(release) },\n \"update_status\" => ->(release) { update_deployment(release) }\n }\n end", "def create(*args)\n arguments(args, required: [:owner, :repo]) do\n assert_required :tag_name\n end\n\n post_request(\"/repos/#{arguments.owner}/#{arguments.repo}/releases\",\n arguments.params)\n end", "def add_aos_version(args = {}) \n post(\"/aosversions.json/\", args)\nend", "def created_release(version)\n puts green(\"Release #{version} created\")\n end", "def create\n @cashier = Cashier.find(params[:cashier_id])\n @release = @cashier.releases.build(params[:release])\n\n #@release.date_release = post_date Date.today\n respond_to do |format|\n if @release.save\n format.html { redirect_to cashier_path(@cashier), notice: 'Release was successfully created.' }\n #format.html { redirect_to cashier_release_path(@release.cashier, @release), notice: 'Release was successfully created.' }\n format.json { render json: @release, status: :created, location: @release }\n else\n format.html { render action: \"new\" }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @os_release = OsRelease.new(params[:os_release])\n\n respond_to do |format|\n if @os_release.save\n format.html { redirect_to @os_release, notice: 'Os release was successfully created.' }\n format.json { render json: @os_release, status: :created, location: @os_release }\n else\n format.html { render action: \"new\" }\n format.json { render json: @os_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def release!\n version = Origen.app.version\n body = { version: version.to_s }\n if version.production?\n body[:type] = :production\n else\n body[:type] = :development\n end\n post(\"plugins/#{Origen.app.name}/release\", body: body)\n end", "def press_release_params\n params.require(:press_release).permit(:media_type, :media_name, :url, :published_at, :abstract)\n end", "def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end", "def create\n @persons_release = PersonsRelease.new(params[:persons_release])\n\n respond_to do |format|\n if @persons_release.save\n format.html { redirect_to @persons_release, notice: 'Persons release was successfully created.' }\n format.json { render json: @persons_release, status: :created, location: @persons_release }\n else\n format.html { render action: \"new\" }\n format.json { render json: @persons_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_dvd_releases\n return @badfruit.parse_movies_array(JSON.parse(@badfruit.get_lists_action(\"new_releases\")))\n end", "def destroy\n @press_release.destroy\n respond_to do |format|\n format.html { redirect_to press_releases_url }\n format.json { head :no_content }\n end\n end", "def release( release_attributes= {},option={})\n unless option[:page_only]\n template_release = self.template_releases.build\n template_release.name = \"just a test\"\n template_release.save!\n end\n self.reload # release_id shoulb be template_release.id\n @lg = PageGenerator.releaser( self )\n @lg.release \n self.current_template_release \n end", "def deploy_api(name, rev, env, path)\n post(\"/apis/#{name}/revisions/#{rev}/deployments\", {:action => 'deploy', :env => env, :basepath => path})\n end", "def create\n @release = Release.new(release_params)\n @release.project = @project\n\n respond_to do |format|\n if @release.save\n format.html { redirect_to [@release.project, @release], notice: 'Release criada com sucesso.' }\n else\n format.html { render :new }\n end\n end\n end", "def release_params\n params.require(:release).permit(:version, :deliver_date, :project_id)\n end", "def release_params\n params.require(:release).permit(:title, :subtitle, :released_on, :body)\n end", "def create\n @client_release = ClientRelease.new(params[:client_release])\n\n respond_to do |format|\n if @client_release.save\n format.html { redirect_to @client_release, notice: 'Client release was successfully created.' }\n format.json { render json: @client_release, status: :created, location: @client_release }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def request_release(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_release\", options).body)\n @attributes = response['items']\n true\n end", "def request_release(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_release\", options).body)\n @attributes = response['items']\n true\n end", "def index\n @releases = Release.all\n end", "def index\n @releases = Release.all\n end", "def add_aos_version_box(args = {}) \n post(\"/aosversions.json/aosversionbox\", args)\nend", "def release_version!\n projects.each { |project| project.release_version!(tag_full_name) }\n print_log 'Versions released'\n slack_notifier.ping(release_message, icon_emoji: ':see_no_evil:')\n end", "def map_releases\n releases.sort! {|x,y| x[1] <=> y[1] }\n .map { |release|\n {\n \"version\" => release[1],\n \"status\" => \"active\",\n \"description_html\" => \"<p>#{release[0]}</p>\",\n \"description_markdown\" => release[0],\n \"providers\" => [\n {\"name\" => \"virtualbox\", \"url\" => \"#{RELEASE_URL}#{release[0]}\"}\n ]\n }\n }\n end", "def release\n configs = store(:get, 'configs').to_s.gsub(\"\\n\", \" \")\n \n # TODO: if error, user need to deploy code first (nothing to deploy) => use a special exit code \n # when code is not pushed or only deploy if app has a correct build\n version = @api.release(@name, configs).to_s.chomp.gsub(\"\\n\", \" \")\n backend = @api.run(@name, :web, version).to_s.chomp.gsub(\"\\n\", \" \")\n @api.route @name, backend\n return version\n end", "def releases(country = nil)\n Birdman::Requester.get(\"movies/#{id}/releases/#{country}\")\n end", "def create_release(build)\n release = Kubernetes::Release.create_release(\n deploy_id: @job.deploy.id,\n deploy_groups: deploy_group_configs,\n build_id: build.try(:id),\n git_sha: @job.commit,\n git_ref: @reference,\n user: @job.user,\n project: @job.project\n )\n\n unless release.persisted?\n raise Samson::Hooks::UserError, \"Failed to create release: #{release.errors.full_messages.inspect}\"\n end\n\n @output.puts(\"Created release #{release.id}\\nConfig: #{deploy_group_configs.to_json}\")\n release\n end", "def release\n case new_resource.version\n when 'latest'\n require 'octokit'\n Octokit.releases(repo).first[:tag_name]\n else\n \"v#{new_resource.version}\"\n end\n end", "def release\n release_data = EventDate.data_for_release(params[:date_id])\n render json: release_data.to_json\n end", "def destroy\n @press_release.destroy\n respond_to do |format|\n format.html { redirect_to press_releases_url, notice: 'Press release was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def release_params\n params.require(:release).permit(:title, :release_date)\n end", "def release\n action('release')\n end", "def create\n @release_item = ReleaseItem.new(release_item_params)\n\n respond_to do |format|\n if @release_item.save\n format.html { redirect_to @release_item, notice: 'Release item was successfully created.' }\n format.json { render :show, status: :created, location: @release_item }\n else\n format.html { render :new }\n format.json { render json: @release_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def releases\n repo.releases(changelog.changes)\n end", "def release_params\n params.require(:release).permit(:system_id, :versao, :dt_implantacao, :descricao)\n end", "def deploy(release_docs)\n release_docs.each do |release_doc|\n @output.puts \"Creating for #{release_doc.deploy_group.name} role #{release_doc.kubernetes_role.name}\"\n release_doc.deploy\n end\n end", "def create\n @object_release = ObjectRelease.new(object_release_params)\n\n respond_to do |format|\n if @object_release.save\n format.html { redirect_to @object_release, notice: 'Object release was successfully created.' }\n format.json { render :show, status: :created, location: @object_release }\n else\n format.html { render :new }\n format.json { render json: @object_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def to_release\n user.releases.find_or_initialize_by(discogs_release_id: discogs_release_id).tap do |release|\n release.catalog_number = catalog_number\n release.label = label\n release.artist = artist\n release.name = name\n release.year = year\n release.genre = genre\n release.format = format\n release.format_quantity = format_quantity\n release.discogs_community_have = discogs_community_have\n release.discogs_community_want = discogs_community_want\n release.discogs_lowest_price = discogs_lowest_price\n release.discogs_number_for_sale = discogs_number_for_sale\n release.discogs_cover_thumb_url = discogs_cover_thumb_url\n release.discogs_api_resource_url = discogs_api_resource_url\n release.discogs_uri = discogs_uri\n end\n end", "def release\n _init\n\n @release = Release.find_by_name(params[:release]) if params[:release]\n @release = Release.actived.first unless @release\n\n render :template => 'sprint/release', :layout => 'release'\n end", "def create\n @release_main = ReleaseMain.new(release_main_params)\n\n respond_to do |format|\n if @release_main.save\n format.html { redirect_to @release_main, notice: 'Release main was successfully created.' }\n format.json { render :show, status: :created, location: @release_main }\n else\n format.html { render :new }\n format.json { render json: @release_main.errors, status: :unprocessable_entity }\n end\n end\n end", "def release!\n welcome\n return if uncommitted_changes?\n\n # Check if everything is up to date with git remotes\n if branch_behind_remote?\n if want_to_pull? \n cmd \"git pull\"\n cmd \"git pull --tags\"\n else\n inform \"Please pull the changes, then run `rake release` again\"\n return\n end\n end\n\n # Gather user input about the release\n get_release_message\n get_release_version_type\n\n # Confirm and execute\n if you_sure?\n update_dist\n update_bower_file\n cmd \"git add .\"\n cmd \"git commit -am '#{@commit_message}'\"\n cmd \"git tag -a v#{@next_version} -m '#{@commit_message}'\"\n cmd \"git push\"\n cmd \"git push --tags\"\n publish! # to github pages\n\n robot_says \"All done :) Thanks for contributing!\"\n else\n inform \"Release cancelled\"\n end\n end", "def new\n @release = Release.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release }\n end\n end", "def github_released\n puts green(\"Release completed\")\n end", "def set_press_release\n @press_release = PressRelease.find(params[:id])\n end", "def release_step\n super\n npmrc_path = File.expand_path('~/.npmrc')\n\n unless @config.npm_auth_token\n fail CapsuleCD::Error::ReleaseCredentialsMissing, 'cannot deploy page to npm, credentials missing'\n end\n\n # write the knife.rb config file.\n File.open(npmrc_path, 'w+') do |file|\n file.write(\"//registry.npmjs.org/:_authToken=#{@config.npm_auth_token}\")\n end\n\n # run npm publish\n Open3.popen3('npm publish .', chdir: @source_git_local_path) do |_stdin, stdout, stderr, external|\n { stdout: stdout, stderr: stderr }. each do |name, stream_buffer|\n Thread.new do\n until (line = stream_buffer.gets).nil?\n puts \"#{name} -> #{line}\"\n end\n end\n end\n # wait for process\n external.join\n unless external.value.success?\n fail CapsuleCD::Error::ReleasePackageError, 'npm publish failed. Check log for exact error'\n end\n end\n end", "def create\n @press = Press.new(params[:press])\n\n respond_to do |format|\n if @press.save\n format.html { redirect_to @press, notice: 'Press was successfully created.' }\n format.json { render json: @press, status: :created, location: @press }\n else\n format.html { render action: \"new\" }\n format.json { render json: @press.errors, status: :unprocessable_entity }\n end\n end\n end", "def releases_in_group(release_group_id, options = {})\n get \"release_groups/#{release_group_id}/releases\", options\n end", "def update\n respond_to do |format|\n if @press_release.update(press_release_params)\n format.html { redirect_to @press_release, notice: 'Press release was successfully updated.' }\n format.json { render :show, status: :ok, location: @press_release }\n else\n format.html { render :edit }\n format.json { render json: @press_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def release_params\n params.require(:release).permit(:title, :catalogue_number, :format, :country_code, :released_at, :image_data, :artist_id, :query)\n end", "def get_release(release_id)\n query_and_build \"releases/#{release_id}\"\n end", "def release_url(api_url, title)\n # \"subject\": {\n # \"title\": \"v1.4.4\",\n # \"url\": \"https://api.github.com/repos/typed-ember/ember-cli-typescript/releases/13191777\",\n # \"latest_comment_url\": \"https://api.github.com/repos/typed-ember/ember-cli-typescript/releases/13191777\",\n # \"type\": \"Release\"\n # },\n api_index = api_url.index(\"api\")\n repos_index = api_url.index(\"repos\")\n releases_index = api_url.index(\"releases\")\n\n # https://github.com/typed-ember/ember-cli-typescript/releases/tag/v1.4.4\n html_url = api_url[0..api_index - 1] +\n api_url[api_index + \"api.\".length..repos_index - 1] +\n api_url[repos_index + \"repos/\".length..releases_index + \"releases\".length] +\n \"tag/#{title}\"\n html_url\n end", "def release\n context.execute \"[ $(ls -A #{release_path} | wc -l) -gt 0 ] || ( cd #{release_path} && tar -xzf #{repo_path}/#{release_timestamp}.tar.gz )\"\n end", "def releases=(releases_from_response)\n if !releases_from_response.nil? && !releases_from_response.countries?\n @releases = Enceladus::Release.build_collection(releases_from_response.countries)\n end\n end", "def release\n variables[:release]\n end", "def release\n git :archive, fetch(:branch), fetch(:project_root), '| tar -x -C', release_path, \"--strip=#{fetch(:project_root).count('/')+1}\"\n end", "def publish!\n release_file = build_role 'release', release\n\n timestamp.replace(release_file)\n\n timestamp_file = build_role 'timestamp', timestamp\n\n bucket.create(release_file.path_with_hash, release_file.body)\n bucket.create(timestamp_file.path, timestamp_file.body)\n end", "def fetch_releases\n require \"open-uri\"\n\n open(RELEASE_URL) { |f| f.read.scan RELEASE_REGEXP }\n end", "def release_params\n params.require(:release).permit(:name, :description, :project_id, :deadline)\n end", "def execute_ruby_release(type:)\n version_regex = %r{.version\\s*=\\s*'([\\d\\.]+)'}\n gemspec_path = Dir.glob(\"*.gemspec\").first\n gemspec_contents = File.read(gemspec_path)\n version = gemspec_contents.match(version_regex)[1]\n version = Semverse::Version.new(version)\n new_version = \"0.0.5\"\n gemspec_contents = gemspec_contents.sub(version_regex, \".version = '#{new_version}'\")\n\n gemspec_folder_obj = octokit.contents(@originating_repo,)\n gemspec_file_obj = gemspec_folder_obj.find { |file| file[:name] == gemspec_path }\n gemspec_file = octokit.blob(@originating_repo, gemspec_file_obj[:sha])\n gemspec_obj = octokit.contents(@originating_repo, path: gemspec_path)\n gemspec_sha = gemspec_file['sha']\n contents = Base64.encode64(gemspec_contents)\n json = {\n message: \"Updating to #{new_version}\",\n content: contents,\n sha: gemspec_sha\n }.to_json\n\n gemspec_file_obj = octokit.update_contents(@originating_repo, gemspec_path, \"Release #{new_version}\", gemspec_sha, gemspec_contents)\n octokit.add_comment(@originating_repo, @pr_number, \"Thanks! This is now out in #{new_version}\")\n end", "def release_params\n # params.require(:content).permit!(:releases_attributes)\n params.require(:content).permit(releases_attributes: [:screen_id, :_destroy, :id])\n end", "def add_key_and_product_to_releases(releases, key, product)\n releases.each do |release|\n release[:repo_key] ||= key unless key.nil?\n release[:product] = product\n end\n end", "def new\n @commit = params[:commit]\n @release = @environment.releases.new(\n commit0: @environment.last_commit,\n commit1: @commit)\n if @release.can_read_commits?\n @release.load_commits!\n @release.load_tickets!\n @release.build_changes_from_commits\n end\n if @release.changes.none?\n render :template => \"releases/new_pick_commit\"\n else\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release }\n end\n end\n end", "def write_repository(product_dir, releases)\n platforms = releases.map { |release| release[:platform] }.uniq\n platforms.each do |platform|\n configuration_directory = File.join(product_dir, platform)\n FileUtils.mkdir_p(configuration_directory)\n releases_by_version = Hash.new { |hash, key| hash[key] = [] }\n releases.each do |release|\n next if release[:platform] != platform\n\n releases_by_version[release[:version]] << extract_release_fields(release)\n end\n releases_by_version.each_pair do |version, version_releases|\n File.write(File.join(configuration_directory, \"#{version.gsub('/', '-')}.json\"),\n JSON.pretty_generate(version_releases))\n end\n end\n end", "def create!\n doc.kubernetes_release.builds = [builds(:docker_build)]\n Kubernetes::ReleaseDoc.create!(\n doc.attributes.except('id', 'resource_template').merge(kubernetes_release: doc.kubernetes_release)\n )\n end", "def index\n @releases = Release.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases.to_json(:except => [:user_id]) }\n end\n end", "def get_release(project)\n info = get_github_api(project, \"releases\")\n release = 'master'\n if info.length > 0\n unpublishedDraftLimit = 5\n x = 0\n release = info[x]['tag_name']\n # Unpublished drafts need to be skipped.\n while (unpublishedDraftLimit > x) && info[x]['draft']\n release = info[x]['tag_name']\n x += 1\n end\n end\n release\n end", "def destroy\n @release = @environment.releases.find(params[:id])\n @release.destroy\n\n respond_to do |format|\n format.html { redirect_to releases_url }\n format.json { head :no_content }\n end\n end", "def db_insert_releases(db, org, repo, releases)\n db.transaction do\n releases.each do |release|\n db[\n \"DELETE FROM releases WHERE org=? AND repo=? AND id::int=?\", org, repo, release.id].delete\n\n # Sometimes there is no author. Instead, fill in the data with the first file's uploader\n if(release.author)\n author=release.author.login\n else\n if(release.assets and release.assets[0] and release.assets[0].uploader)\n author=release.assets[0].uploader.login\n # puts \"Unable to find an author for #{release.html_url}; using uploader: #{author}\"\n else\n author=nil\n # puts \"Unable to find an author or uploader for #{release.html_url}\"\n end\n end\n\n\t # only include releases that were published\n\t if(release.published_at)\n\t db[\n \t \"INSERT INTO releases (\n\t org, repo, id, html_url, tarball_url, zipball_url, tag_name, name, body, created_at, published_at, author\n\t )\n\t VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )\",\n\t org, repo, release.id, release.html_url, release.tarball_url, release.zipball_url, release.tag_name, release.name, release.body, release.created_at.to_s,\n\t release.published_at.to_s, author].insert\n\t end\n end\n end\n end", "def release(options)\n options = options.rekey\n\n unixname = self.unixname\n\n package = options[:package] || metadata.name\n version = options[:version] || metadata.version\n\n date = options[:date] || metadata.released || Time::now.strftime('%Y-%m-%d %H:%M')\n\n changes = options[:changes] || project.history.releases[0].changes\n notes = options[:notes] || project.history.releases[0].note\n\n release = options[:release] || version\n\n files = options[:files] || options[:file] || []\n\n #store = options[:store] || 'pkg'\n\n processor = options[:processor] || 'Any'\n\n is_public = !options[:private]\n\n #raise ArgumentError, \"missing unixname\" unless unixname\n raise ArgumentError, \"missing package\" unless package\n raise ArgumentError, \"missing release\" unless release\n\n # package name has to be 3+ characters.\n if package.size < 3\n package = package + \"'s\"\n end\n\n # sub in for version if %s is used in release name.\n release = release % version if release.index(\"%s\")\n\n release_notes = notes\n release_changes = changes\n\n # Gather package files to release.\n if files.empty?\n files = find_packages(version)\n else\n files = files.map do |file|\n if File.directory?(file)\n find_packages(version, file)\n else\n file\n end\n end\n files = files.flatten\n end\n files = files.select{ |f| File.file?(f) }\n\n abort \"No package files.\" if files.empty?\n\n files.each do |file|\n abort \"Not a file -- #{file}\" unless File.exist?(file)\n puts \"Release file: #{File.basename(file)}\"\n end\n\n # which package types\n #rtypes = [ 'tgz', 'tbz', 'tar.gz', 'tar.bz2', 'deb', 'gem', 'ebuild', 'zip' ]\n #rtypes -= exclude\n #rtypes = rtypes.collect{ |rt| Regexp.escape( rt ) }\n #re_rtypes = Regexp.new('[.](' << rtypes.join('|') << ')$')\n\n puts \"Releasing #{package} #{release} to #{unixname} project...\" #unless options['quiet']\n\n login do\n\n raise ArgumentError, \"missing group_id\" unless group_id\n\n unless package_id = package?(package)\n if trial?\n puts \"Package '#{package}' does not exist.\"\n puts \"Create package #{package}.\"\n abort \"Cannot continue in trial mode.\"\n else\n #unless options['force']\n q = \"Package '#{package}' does not exist. Create?\"\n a = ask(q, 'yN')\n abort \"Task canceled.\" unless ['y', 'yes', 'okay'].include?(a.downcase)\n #end\n puts \"Creating package #{package}...\"\n create_package(package, is_public)\n unless package_id = package?(package)\n raise \"Package creation failed.\"\n end\n end\n end\n if release_id = release?(release, package_id)\n #unless options[:force]\n if trial?\n puts \"Release #{release} already exists.\"\n else\n q = \"Release #{release} already exists. Re-release?\"\n a = ask(q, 'yN')\n abort \"Task canceled.\" unless ['y', 'yes', 'okay'].include?(a.downcase)\n #puts \"Use -f option to force re-release.\"\n #return\n end\n files.each do |file|\n fname = File.basename(file)\n if file_id = file?(fname, package)\n if trial?\n puts \"Remove file #{fname}.\"\n else\n puts \"Removing file #{fname}...\"\n remove_file(file_id, release_id, package_id)\n end\n end\n if trial?\n puts \"Add file #{fname}.\"\n else\n puts \"Adding file #{fname}...\"\n add_file(file, release_id, package_id, processor)\n end\n end\n else\n if trial?\n puts \"Add release #{release}.\"\n else\n puts \"Adding release #{release}...\"\n add_release(release, package_id, files,\n :processor => processor,\n :release_date => date,\n :release_changes => release_changes,\n :release_notes => release_notes,\n :preformatted => '1'\n )\n unless release_id = release?(release, package_id)\n raise \"Release creation failed.\"\n end\n end\n #files.each do |file|\n # puts \"Added file #{File.basename(file)}.\"\n #end\n end\n end\n puts \"Release complete!\" unless trial?\n end", "def add_release(release_name, package_id, *files)\n page = \"/frs/admin/qrs.php\"\n\n options = (Hash===files.last ? files.pop : {}).rekey\n files = files.flatten\n\n processor = options[:processor]\n release_date = options[:release_date]\n release_changes = options[:release_changes]\n release_notes = options[:release_notes]\n\n release_date ||= Time::now.strftime(\"%Y-%m-%d %H:%M\")\n\n file = files.shift\n puts \"Adding file #{File.basename(file)}...\"\n userfile = open(file, 'rb')\n\n type_id = userfile.path[%r|\\.[^\\./]+$|]\n type_id = FILETYPES[type_id]\n processor_id = PROCESSORS[processor.downcase]\n\n preformatted = '1'\n\n form = {\n \"group_id\" => group_id,\n \"package_id\" => package_id,\n \"release_name\" => release_name,\n \"release_date\" => release_date,\n \"type_id\" => type_id,\n \"processor_id\" => processor_id,\n \"release_notes\" => release_notes,\n \"release_changes\" => release_changes,\n \"preformatted\" => preformatted,\n \"userfile\" => userfile,\n \"submit\" => \"Release File\"\n }\n\n boundary = Array::new(8){ \"%2.2d\" % rand(42) }.join('__')\n boundary = \"multipart/form-data; boundary=___#{ boundary }___\"\n\n html = http_post(page, form, 'content-type' => boundary)\n\n release_id = html[/release_id=\\d+/][/\\d+/].to_i\n puts \"RELEASE ID = #{release_id}\" if $DEBUG\n\n files.each do |file|\n puts \"Adding file #{File.basename(file)}...\"\n add_file(file, release_id, package_id, processor)\n end\n\n release_id\n end", "def index\n respond_with releases\n end", "def list_releases(workspace_id)\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n url = @api_url + \"/api/workspaces/#{workspace_id}/releases\"\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n releases = JSON.parse(r.body)['data']\n #release_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"releases dump is #{JSON.pretty_generate(releases)}\\nrelease count is #{release_count}\"\n\n releases.each do |release|\n results.push(release)\n end\n return results\n end", "def create\n @release = Release.new(release_params)\n\n # release_title = release_params[:title]\n # artist_name = @artist.name\n #\n # discogs_api_key = ENV.fetch('DISCOGS_API_KEY')\n # discogs_secret_api_key = ENV.fetch('DISCOGS_SECRET_API_KEY')\n #\n # response = HTTParty.get(\"https://api.discogs.com/database/search?release_title=#{release_title}&artist=#{artist_name}&key=#{discogs_api_key}&secret=#{discogs_secret_api_key}\")\n\n # byebug\n\n response['results'].each do |result|\n if result['format'].include? \"Vinyl\"\n @release.artist_id = @artist\n\n release_title = response['title'].split(' - ').last\n @release.title = release_title\n\n format_array = response['format'].split(' ')\n format_type = format_array.select { |format| format == \"LP\" }\n @release.format = format_type.join\n\n @release.released_at = response['year']\n @release.image_data = response['images'][0]['resource_url']\n @release.country_code = response['id']\n @release.format = response['id']\n @release.artist_id = response['id']\n end\n end\n\n respond_to do |format|\n if @release.save\n format.html { redirect_to @release, notice: 'Release was successfully created.' }\n format.json { render :show, status: :created, location: @release }\n else\n format.html { render :new }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @release = @environment.releases.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @release }\n end\n end", "def github_release_task\n sh git, 'push', '--tags', remote, remote_branch\n end", "def release_params\n params.require(:statuses_step_release).permit(:status)\n end", "def index\n @title = \"News and Events - Think India NITR club\"\n @press_releases = PressRelease.all.order(\"created_at desc\")\n end", "def release_params\n params.require(:release).permit(:locale_id)\n end", "def new\n @os_release = OsRelease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @os_release }\n end\n end", "def release\n warn 'Rhino does not yet support --release' if options[:release]\n 'rhino1_7R2'\n end", "def releases\n self.class.releases\n end", "def releases\n self.class.releases\n end", "def set_press_release\n @press_release = PressRelease.friendly.find(params[:id])\n end", "def release_task\n puts\n puts \"Release successful.\"\n end", "def create_softwarerepository_release_with_http_info(softwarerepository_release, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SoftwarerepositoryApi.create_softwarerepository_release ...'\n end\n # verify the required parameter 'softwarerepository_release' is set\n if @api_client.config.client_side_validation && softwarerepository_release.nil?\n fail ArgumentError, \"Missing the required parameter 'softwarerepository_release' when calling SoftwarerepositoryApi.create_softwarerepository_release\"\n end\n # resource path\n local_var_path = '/api/v1/softwarerepository/Releases'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(softwarerepository_release)\n\n # return_type\n return_type = opts[:debug_return_type] || 'SoftwarerepositoryRelease'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"SoftwarerepositoryApi.create_softwarerepository_release\",\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: SoftwarerepositoryApi#create_softwarerepository_release\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def releases\n all(QTest::Release, project: @id)\n end" ]
[ "0.73085606", "0.7037447", "0.69663423", "0.6809089", "0.6587195", "0.6525527", "0.64633775", "0.6419327", "0.63655436", "0.6363195", "0.63465405", "0.6331807", "0.6322181", "0.62916243", "0.62629634", "0.6254705", "0.6224615", "0.61817414", "0.61716056", "0.6141196", "0.6071047", "0.5988999", "0.59709895", "0.5969963", "0.59362346", "0.59336615", "0.5923154", "0.59195423", "0.58721864", "0.58635384", "0.58612496", "0.58568424", "0.58568424", "0.5851413", "0.5851413", "0.5840147", "0.5835111", "0.58176523", "0.58173394", "0.5804056", "0.57899433", "0.5781605", "0.57572025", "0.57407516", "0.5732206", "0.5725401", "0.5713896", "0.5696867", "0.5678727", "0.5676513", "0.5668486", "0.56652063", "0.5663542", "0.56473523", "0.5636257", "0.56334966", "0.5621639", "0.5617089", "0.56045276", "0.5575487", "0.55502355", "0.55313", "0.55303156", "0.5529702", "0.55293655", "0.55240524", "0.5519247", "0.5516976", "0.55115515", "0.55056447", "0.5505516", "0.55017126", "0.5494668", "0.54697365", "0.54694754", "0.5448987", "0.5445422", "0.5441146", "0.54344964", "0.5432631", "0.5430311", "0.54291767", "0.54219425", "0.5404746", "0.5392531", "0.53717965", "0.5369473", "0.5361553", "0.53459334", "0.53157157", "0.53044295", "0.53020394", "0.52860594", "0.5285921", "0.5264695", "0.5264695", "0.52577704", "0.5251084", "0.52455187", "0.5244107" ]
0.6893645
3
PATCH/PUT /press_releases/1 PATCH/PUT /press_releases/1.json
def update respond_to do |format| if @press_release.update(press_release_params) format.html { redirect_to @press_release, notice: 'Press release was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @press_release.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @release = @environment.releases.find(params[:id])\n\n respond_to do |format|\n if @release.update_attributes(params[:release])\n format.html { redirect_to @release, notice: 'Release was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @press_release.update(press_release_params)\n format.html { redirect_to @press_release, notice: 'Press release was successfully updated.' }\n format.json { render :show, status: :ok, location: @press_release }\n else\n format.html { render :edit }\n format.json { render json: @press_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit(*args)\n arguments(args, required: [:owner, :repo, :id])\n\n patch_request(\"/repos/#{arguments.owner}/#{arguments.repo}/releases/#{arguments.id}\", arguments.params)\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @release = Release.find(params[:id])\n\n respond_to do |format|\n if @release.update_attributes(params[:release])\n format.html { redirect_to cashier_release_path(current_user), notice: 'Release was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @release.update(release_params)\n format.html { redirect_to @release, notice: 'Release was successfully updated.' }\n format.json { render :show, status: :ok, location: @release }\n else\n format.html { render :edit }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @patch_deployments = args[:patch_deployments] if args.key?(:patch_deployments)\n end", "def update\n @os_release = OsRelease.find(params[:id])\n\n respond_to do |format|\n if @os_release.update_attributes(params[:os_release])\n format.html { redirect_to @os_release, notice: 'Os release was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @os_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end", "def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end", "def update!(**args)\n @versions = args[:versions] if args.key?(:versions)\n end", "def add_aos_version(args = {}) \n post(\"/aosversions.json/\", args)\nend", "def execute_ruby_release(type:)\n version_regex = %r{.version\\s*=\\s*'([\\d\\.]+)'}\n gemspec_path = Dir.glob(\"*.gemspec\").first\n gemspec_contents = File.read(gemspec_path)\n version = gemspec_contents.match(version_regex)[1]\n version = Semverse::Version.new(version)\n new_version = \"0.0.5\"\n gemspec_contents = gemspec_contents.sub(version_regex, \".version = '#{new_version}'\")\n\n gemspec_folder_obj = octokit.contents(@originating_repo,)\n gemspec_file_obj = gemspec_folder_obj.find { |file| file[:name] == gemspec_path }\n gemspec_file = octokit.blob(@originating_repo, gemspec_file_obj[:sha])\n gemspec_obj = octokit.contents(@originating_repo, path: gemspec_path)\n gemspec_sha = gemspec_file['sha']\n contents = Base64.encode64(gemspec_contents)\n json = {\n message: \"Updating to #{new_version}\",\n content: contents,\n sha: gemspec_sha\n }.to_json\n\n gemspec_file_obj = octokit.update_contents(@originating_repo, gemspec_path, \"Release #{new_version}\", gemspec_sha, gemspec_contents)\n octokit.add_comment(@originating_repo, @pr_number, \"Thanks! This is now out in #{new_version}\")\n end", "def update_release(stuff, release, fields)\r\n\trelease.update(fields)\r\nend", "def update\n @press = Press.find(params[:id])\n\n respond_to do |format|\n if @press.update_attributes(params[:press])\n format.html { redirect_to @press, notice: 'Press was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @press.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client_release = ClientRelease.find(params[:id])\n\n respond_to do |format|\n if @client_release.update_attributes(params[:client_release])\n format.html { redirect_to @client_release, notice: 'Client release was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @release = Release.find(params[:id])\n \n if current_user.id != @release.user.id\n respond_to do |format|\n format.html { redirect_to @release, notice: \"You do not have permission to edit this release\" }\n format.json { head :no_content }\n end\n end\n\n respond_to do |format|\n if @release.update_attributes(:name => params[:release][:name], :description => params[:release][:description])\n format.html { redirect_to @release, notice: 'Release was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @deployment.update(deployment_params)\n services_params(@deployment).each do |service_name, version_name|\n version = Version.find_by(name: version_name)\n @deployment.versions << version if version\n end\n @deployment.save\n format.html { redirect_to @deployment, notice: 'Deployment was successfully updated.' }\n format.json { render :show, status: :ok, location: @deployment }\n else\n format.html { render :edit }\n format.json { render json: @deployment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @object_release.update(object_release_params)\n format.html { redirect_to @object_release, notice: 'Object release was successfully updated.' }\n format.json { render :show, status: :ok, location: @object_release }\n else\n format.html { render :edit }\n format.json { render json: @object_release.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 respond_to do |format|\n if @release.update(release_params)\n format.html { redirect_to [@project, @release], notice: 'Release atualizada com sucesso.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @persons_release = PersonsRelease.find(params[:id])\n\n respond_to do |format|\n if @persons_release.update_attributes(params[:persons_release])\n format.html { redirect_to @persons_release, notice: 'Persons release was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persons_release.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @api_version = ApiVersion.find(params[:id])\n\n respond_to do |format|\n if @api_version.update_attributes(params[:api_version])\n format.html { redirect_to admin_api_versions_path, flash: {success: t('app.msgs.success_updated', :obj => t('mongoid.models.api_version.one'))} }\n format.json { head :no_content }\n else\n set_tabbed_translation_form_settings('advanced')\n format.html { render action: \"edit\" }\n format.json { render json: @api_version.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sprint.update!(sprint_params)\n json_response(@sprint)\n end", "def update\n self.publish_json\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def update!(**args)\n @version_id = args[:version_id] if args.key?(:version_id)\n end", "def update!(**args)\n @version_id = args[:version_id] if args.key?(:version_id)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @cancel_requested = args[:cancel_requested] if args.key?(:cancel_requested)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @status_detail = args[:status_detail] if args.key?(:status_detail)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @revision = args[:revision] if args.key?(:revision)\n @service = args[:service] if args.key?(:service)\n @service_urls = args[:service_urls] if args.key?(:service_urls)\n end", "def update\n put :update\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @kind = args[:kind] if args.key?(:kind)\n @metadata = args[:metadata] if args.key?(:metadata)\n @spec = args[:spec] if args.key?(:spec)\n end", "def update!(**args)\n @api_signatures = args[:api_signatures] if args.key?(:api_signatures)\n @unique_apis = args[:unique_apis] if args.key?(:unique_apis)\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update(*args)\n put(*args)\n end", "def update(*args)\n put(*args)\n end", "def update!(**args)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @releases = args[:releases] if args.key?(:releases)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def update!(**args)\n @bundles = args[:bundles] if args.key?(:bundles)\n @platform_version = args[:platform_version] if args.key?(:platform_version)\n @required_platform_version = args[:required_platform_version] if args.key?(:required_platform_version)\n @status = args[:status] if args.key?(:status)\n end", "def test_bump_preview_to_release\n value_ = ::Versionomy.create(:major => 2, :tiny => 1, :release_type => :preview)\n value_ = value_.bump(:release_type)\n assert_equal(2, value_.major)\n assert_equal(0, value_.minor)\n assert_equal(1, value_.tiny)\n assert_equal(0, value_.tiny2)\n assert_equal(:final, value_.release_type)\n assert_equal(0, value_.patchlevel)\n assert_equal(0, value_.patchlevel_minor)\n end", "def add_aos_version_box(args = {}) \n post(\"/aosversions.json/aosversionbox\", args)\nend", "def update\n respond_to do |format|\n if @package_version.update(package_version_params)\n format.html { redirect_to @package_version, success: 'Package version was successfully updated.' }\n format.json { render :show, status: :ok, location: @package_version }\n else\n format.html { render :edit }\n format.json { render json: @package_version.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n head :ok\n end", "def update\n respond_to do |format|\n if @version.update(version_params)\n format.html { redirect_to @version, notice: 'Version was successfully updated.' }\n format.json { render :show, status: :ok, location: @version }\n else\n format.html { render :edit }\n format.json { render json: @version.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_releases\n api_call(\"https://api.spotify.com/\",\"/v1/browse/new-releases\")\n end", "def update\n respond_to do |format|\n if @release_main.update(release_main_params)\n format.html { redirect_to @release_main, notice: 'Release main was successfully updated.' }\n format.json { render :show, status: :ok, location: @release_main }\n else\n format.html { render :edit }\n format.json { render json: @release_main.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @api_version = ApiVersion.find(params[:id])\n\n @api_version.assign_attributes(params[:api_version])\n\n add_missing_translation_content(@api_version.api_version_translations)\n\n respond_to do |format|\n if @api_version.save\n format.html { redirect_to admin_api_versions_path, notice: t('app.msgs.success_updated', :obj => t('activerecord.models.api_version')) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_version.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @apks = args[:apks] unless args[:apks].nil?\n @kind = args[:kind] unless args[:kind].nil?\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @versions = args[:versions] if args.key?(:versions)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @versions = args[:versions] if args.key?(:versions)\n end", "def update\n # cyber-dojo.sh does actual [update]\nend", "def update!(**args)\n @resource_type = args[:resource_type] if args.key?(:resource_type)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end", "def create\n # Extract the version info\n release = params[:release]\n version = params[:release][:version]\n release.delete(\"version\")\n \n # Validate input\n if (release[:name] == \"\")\n flash[:notice] = \"You must supply a name for the release\"\n respond_to do |format|\n format.html { redirect_to :action => 'new' }\n format.json { head :no_content }\n end\n elsif (release[:source_url] == \"\")\n flash[:notice] = \"You must supply a source URL\"\n respond_to do |format|\n format.html { redirect_to :action => 'new' }\n format.json { head :no_content }\n end\n else\n # Add http:// prefix to source_url if it doesn't already exist\n release[:source_url] = \"http://#{release[:source_url]}\" if not release[:source_url].starts_with? \"http://\" and not release[:source_url].starts_with? \"https://\"\n \n @release = Release.new(release)\n @release.user = current_user\n \n # Add the version info\n # If the URL doesn't start with http:// or https://, add it\n version[:download_url] = \"http://#{version[:download_url]}\" if not version[:download_url].starts_with? \"http://\" and not version[:download_url].starts_with? \"https://\"\n \n @version = Version.new(version)\n @version.version_number = 1\n @version.release = @release\n @release.versions << @version\n\n respond_to do |format|\n if @release.save\n format.html { redirect_to @release, notice: 'Release was successfully created.' }\n format.json { render json: @release, status: :created, location: @release }\n else\n format.html { render action: \"new\" }\n format.json { render json: @release.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def put(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.put(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def post_release_v2(app_name, slug, dyno_types, user, token,\n slug_url, repo_size)\n slug_url_regex = /https:\\/\\/(.+?)\\.s3\\.amazonaws\\.com\\/(.+?)\\?/\n _, slug_put_key, slug_put_bucket = slug_url.match(slug_url_regex).to_a\n start = Time.now\n payload = {\n # \"head\" => head,\n # \"prev_head\" => commit_hash,\n # \"current_seq\" => current_seq,\n \"slug_put_key\" => slug_put_key,\n \"slug_put_bucket\" => slug_put_bucket,\n \"repo_size\" => repo_size,\n \"release_descr\" => \"sokoban-built release\", # punting for v2\n \"language_pack\" => \"Sokoban\", # punting for v2\n \"buildpack\" => \"Sokoban\", # punting for v2\n \"slug_version\" => 2,\n \"slug_size\" => File.size(slug),\n \"stack\" => \"cedar\",\n \"user\" => user,\n \"process_types\" => dyno_types,\n \"git_log\" => \"\",\n \"run_deploy_hooks\" => false,\n \"addons\" => {},\n \"config_vars\" => {}}\n\n release_name =\n Timeout.timeout(30) do\n uri = URI.parse(release_uri(app_name))\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri)\n if uri.scheme == \"https\"\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n request.basic_auth(user, token)\n request[\"Content-Type\"] = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request.body = JSON.unparse(payload)\n response = http.request(request)\n if (response.code != \"200\")\n error_message = begin\n response.body && JSON.parse(response.body)[\"error\"] || \"failure releasing code\"\n rescue Timeout::Error\n \"timed out releasing code\"\n rescue\n \"failure releasing code\"\n end\n raise(error_message)\n end\n response.body\n end\n release_name\n end", "def update!(**args)\n @deployment = args[:deployment] if args.key?(:deployment)\n @http_route = args[:http_route] if args.key?(:http_route)\n @route_update_wait_time = args[:route_update_wait_time] if args.key?(:route_update_wait_time)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @create_time = args[:create_time] if args.key?(:create_time)\n @end_time = args[:end_time] if args.key?(:end_time)\n @requested_cancellation = args[:requested_cancellation] if args.key?(:requested_cancellation)\n @status_message = args[:status_message] if args.key?(:status_message)\n @target = args[:target] if args.key?(:target)\n @verb = args[:verb] if args.key?(:verb)\n end", "def update\n\n respond_to do |format|\n if @press_kit_entry.update(press_kit_entry_params)\n format.html { redirect_to backstage_press_kit_entries_url, notice: 'press_kit_entry was successfully updated.' }\n # format.json { render :show, status: :ok, location: @press_kit_entry }\n else\n format.html { render :edit }\n # format.json { render json: @press_kit_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @concrete_package_version.update(concrete_package_version_params)\n format.html { redirect_to @concrete_package_version, success: 'Concrete package version was successfully updated.' }\n format.json { render :show, status: :ok, location: @concrete_package_version }\n else\n format.html { render :edit }\n format.json { render json: @concrete_package_version.errors, status: :unprocessable_entity }\n end\n end\n end", "def vagrant_json_update(image_name, version_entry)\n # Load the vagrant JSON file\n json_file = File.new(\"#{Packer::OUTPUT_DIR}/#{image_name}.json\", 'w+')\n json_str = json_file.read\n \n # Load the JSON data\n begin\n json_data = JSON.load json_str\n rescue JSON::ParserError\n json_data = {\n \"name\" => image_name,\n \"versions\" => []\n }\n end\n\n # This will make sure there are no duplicate\n # entries for each box version specified in the\n # JSON file\n json_data['versions'].each_index do |i|\n box_version = json_data['versions'][i]\n if box_version['version'] == version_entry['version']\n json_data['versions'][i].delete\n break\n end\n end\n\n # Insert the new version entry\n json_data['versions'].push version_entry\n \n # Write the thing\n json_file.puts JSON.dump json_data\nend", "def update\n @revision = Revision.find(params[:id])\n\n if @revision.update(params[:revision])\n head :no_content\n else\n render json: @revision.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n @metadata = args[:metadata] if args.key?(:metadata)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def put!\n request! :put\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n respond_to do |format|\n if @release_item.update(release_item_params)\n format.html { redirect_to @release_item, notice: 'Release item was successfully updated.' }\n format.json { render :show, status: :ok, location: @release_item }\n else\n format.html { render :edit }\n format.json { render json: @release_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update!(**args)\n @deployments = args[:deployments] if args.key?(:deployments)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @deployments = args[:deployments] if args.key?(:deployments)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @deployments = args[:deployments] if args.key?(:deployments)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @percentages = args[:percentages] if args.key?(:percentages)\n @postdeploy = args[:postdeploy] if args.key?(:postdeploy)\n @predeploy = args[:predeploy] if args.key?(:predeploy)\n @verify = args[:verify] if args.key?(:verify)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end", "def update!(**args)\n @requested_policy_version = args[:requested_policy_version] if args.key?(:requested_policy_version)\n end" ]
[ "0.6913919", "0.6802158", "0.6421727", "0.6371001", "0.62898666", "0.62263525", "0.61692053", "0.6138312", "0.609467", "0.609467", "0.609467", "0.6094625", "0.6075729", "0.6054036", "0.6035197", "0.5976594", "0.59492695", "0.5931169", "0.5907302", "0.5887518", "0.5882795", "0.586493", "0.58461195", "0.58364415", "0.5786601", "0.5785127", "0.57835966", "0.57609314", "0.5740464", "0.5740464", "0.5728029", "0.5728029", "0.5728029", "0.5728029", "0.5728029", "0.5728029", "0.57262456", "0.5719155", "0.5716094", "0.5686788", "0.5685991", "0.5684467", "0.5684467", "0.56746256", "0.5661283", "0.56590044", "0.5657614", "0.5654549", "0.56491834", "0.56459725", "0.56407785", "0.5623806", "0.5620153", "0.5618051", "0.5607458", "0.56048554", "0.56048554", "0.5594686", "0.55922097", "0.55821663", "0.5570074", "0.5566643", "0.55630106", "0.55627626", "0.55595464", "0.55595464", "0.55595464", "0.55595464", "0.55595464", "0.55595464", "0.55595464", "0.55595464", "0.55595464", "0.55595464", "0.55595464", "0.55595464", "0.55595464", "0.55595464", "0.55595464", "0.55595464", "0.55585456", "0.5548271", "0.5547173", "0.5546545", "0.5545863", "0.5543923", "0.5540413", "0.5533114", "0.552527", "0.5520605", "0.5520605", "0.5520605", "0.55171996", "0.5514242", "0.5514242", "0.5514242", "0.5514242", "0.5514242", "0.5514242", "0.5514242" ]
0.68432117
1
DELETE /press_releases/1 DELETE /press_releases/1.json
def destroy @press_release.destroy respond_to do |format| format.html { redirect_to press_releases_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @release = @environment.releases.find(params[:id])\n @release.destroy\n\n respond_to do |format|\n format.html { redirect_to releases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @press_release.destroy\n respond_to do |format|\n format.html { redirect_to press_releases_url, notice: 'Press release was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @os_release = OsRelease.find(params[:id])\n @os_release.destroy\n\n respond_to do |format|\n format.html { redirect_to os_releases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_release = ClientRelease.find(params[:id])\n @client_release.destroy\n\n respond_to do |format|\n format.html { redirect_to client_releases_url }\n format.json { head :ok }\n end\n end", "def destroy\n @release.destroy\n respond_to do |format|\n format.html { redirect_to project_releases_path(@project), notice: 'Release deletada.' }\n end\n end", "def destroy\n @release.destroy\n respond_to do |format|\n format.html { redirect_to releases_url, notice: 'Release was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @press = Press.find(params[:id])\n @press.destroy\n\n respond_to do |format|\n format.html { redirect_to presses_url }\n format.json { head :no_content }\n end\n end", "def delete(*args)\n arguments(args, required: [:owner, :repo, :id]).params\n\n delete_request(\"/repos/#{arguments.owner}/#{arguments.repo}/releases/#{arguments.id}\", arguments.params)\n end", "def destroy\n @persons_release = PersonsRelease.find(params[:id])\n @persons_release.destroy\n\n respond_to do |format|\n format.html { redirect_to persons_releases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n repo = assets_repo\n repo.destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to v_assets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @distro.destroy\n respond_to do |format|\n format.html { redirect_to distros_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ver.destroy\n respond_to do |format|\n format.html { redirect_to vers_url, notice: 'Ver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_version = ApiVersion.find(params[:id])\n @api_version.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_api_versions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @release_main.destroy\n respond_to do |format|\n format.html { redirect_to release_mains_url, notice: 'Release main was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @version.destroy\n respond_to do |format|\n format.html { redirect_to alfred_module_url(@a_module), notice: 'Version was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @object_release.destroy\n respond_to do |format|\n format.html { redirect_to object_releases_url, notice: 'Object release was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @package_version.destroy\n respond_to do |format|\n format.html { redirect_to package_versions_url, success: 'Package version was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @press = Press.find(params[:id])\n @press.destroy\n\n respond_to do |format|\n format.html { redirect_to(presses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @release_item.destroy\n respond_to do |format|\n format.html { redirect_to release_items_url, notice: 'Release item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_story_version(id)\n @client.raw('delete', \"/content/story-versions/#{id}\")\n end", "def destroy\n @version = Version.find(params[:id])\n @version.destroy\n\n respond_to do |format|\n format.html { redirect_to versions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @distro = Distro.find(params[:id])\n @distro.destroy\n\n respond_to do |format|\n format.html { redirect_to distros_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @version.destroy\n respond_to do |format|\n format.html { redirect_to user_app_path(@user, @app), notice: 'Version was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @press_entry.destroy\n respond_to do |format|\n format.html { redirect_to admin_press_entries_url, notice: 'Press entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @version = Version.find(params[:id])\n @versionconfig = @version.version_configurations.destroy_all\n @version.destroy\n\n respond_to do |format|\n format.html { redirect_to [@application, @version] }\n format.json { head :no_content }\n end\n end", "def destroy\n @concrete_package_version.destroy\n respond_to do |format|\n format.html { redirect_to concrete_package_versions_url, success: 'Concrete package version was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @deployment = Deployment.find(params[:id])\n @deployment.destroy\n\n respond_to do |format|\n format.html { redirect_to deployments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_version = ApiVersion.find(params[:id])\n @api_version.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_api_versions_url, flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.api_version.one'))} }\n format.json { head :no_content }\n end\n end", "def destroy\n @design_version.destroy\n respond_to do |format|\n format.html { redirect_to design_versions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_xampp_version.destroy\n respond_to do |format|\n format.html { redirect_to admin_xampp_versions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @translations_versions_test.destroy\n respond_to do |format|\n format.html { redirect_to translations_versions_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @package.status = nil\n @package.save!\n respond_to do |format|\n format.html { redirect_to packages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @manage_app_version.destroy\n respond_to do |format|\n format.html { redirect_to manage_app_versions_url, notice: 'App version was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = Site.first\n @press_kit = @site.press_kit\n\n @press_kit_entry.destroy\n respond_to do |format|\n format.html { redirect_to backstage_press_kit_entries_url, notice: 'First Time Entry was successfully destroyed.' }\n # format.json { head :no_content }\n end\n\n end", "def destroy\n @file_version = FileVersion.find(params[:id])\n @file_version.destroy\n\n respond_to do |format|\n format.html { redirect_to file_versions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @installation.destroy\n respond_to do |format|\n format.html { redirect_to installations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @td_version.destroy\n respond_to do |format|\n format.html { redirect_to td_versions_url, notice: 'Td version was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_api_revision(name, rev)\n delete(\"/apis/#{name}/revision/#{rev}\")\n end", "def destroy\n @release = Release.find(params[:id])\n \n if current_user.id == @release.user.id\n @release.destroy\n respond_to do |format|\n format.html { redirect_to \"/releases\" }\n format.json { head :no_content }\n end\n else\n # Do not have permission to delete this release\n respond_to do |format|\n format.html { redirect_to @release, notice: 'You do not have permission to delete this release'}\n format.json { head :no_content }\n end\n end \n end", "def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end", "def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def destroy\n @file_version.destroy\n head :no_content\n end", "def destroy\n @distro = Distro.find(params[:id])\n removefromaccount(\"distros\", @distro)\n @distro.destroy\n\n respond_to do |format|\n format.html { redirect_to distros_url }\n format.json { head :ok }\n end\n end", "def destroy\n @fileversion = Fileversion.find(params[:id])\n @fileversion.destroy\n\n respond_to do |format|\n format.html { redirect_to fileversions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @api_post.destroy\n\n head :no_content\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @revision = Revision.find(params[:id])\n @revision.destroy\n\n head :no_content\n end", "def unrelease_version\n unrelease_version_btn.click\n unrelease_modal_btn.click\n end", "def destroy\n @cp_press = CpPress.find(params[:id])\n @cp_press.destroy\n\n respond_to do |format|\n format.html { redirect_to cp_presses_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @revision = Revision.find(params[:id])\n @revision.destroy\n\n respond_to do |format|\n format.html { redirect_to @revision.page }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_post_vote = PostVote.find(params[:id])\n @api_v1_post_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_post_votes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sub_package.destroy\n respond_to do |format|\n format.html { redirect_to sub_packages_url, notice: 'Sub package was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @asserted_distribution.destroy\n respond_to do |format|\n format.html { redirect_to asserted_distributions_url, notice: 'Asserted distribution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_download = ProjectDownload.find(params[:id])\n @project_download.destroy\n\n respond_to do |format|\n format.html { redirect_to project_downloads_url }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n @instrument_version.destroy\n\n respond_to do |format|\n format.html { redirect_to(instrument_versions_url) }\n format.xml { head :ok }\n end\n end", "def delversion(version, project=self.project)\n post('delversion.json', project: project, version: version)\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @api_v1_progress.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_progresses_url, notice: 'Progress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n repo = ProjectRepo.new current_user\n repo.destroy params[:id]\n\n respond_to do |format|\n format.html { redirect_to v_projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @version_control.destroy\n respond_to do |format|\n format.html { redirect_to version_controls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @featured_project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @api_method = ApiMethod.find(params[:id])\n @api_method.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_api_versions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @deployment.destroy\n respond_to do |format|\n format.html { redirect_to deployments_url, notice: 'Deployment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @membership_pkg.destroy\n respond_to do |format|\n format.html { redirect_to membership_pkgs_url, notice: 'Membership pkg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n path = format_path(path)\n bucket_path = get_bucket_path(path)\n date = gmtdate\n headers = {\n 'Host' => @aliyun_upload_host,\n 'Date' => date,\n 'Authorization' => sign('DELETE', bucket_path, '', '', date)\n }\n url = path_to_url(path)\n response = RestClient.delete(url, headers)\n response.code == 204 ? url : nil\n end", "def destroy\n @purchase.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n get_context!\n @deploy_heroku_api_key.destroy\n\n respond_to do |format|\n format.html { redirect_to deploy_heroku_api_keys_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @publish = Publish.find(params[:id])\n @publish.destroy\n\n respond_to do |format|\n format.html { redirect_to publishes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nuage_version.destroy\n respond_to do |format|\n format.html { redirect_to nuage_versions_url, notice: \"Nuage version was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @tour_package.destroy\n respond_to do |format|\n format.html { redirect_to tour_packages_url, notice: 'Tour package was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cleanup_release\n if ssh.directory_exists?(release_path)\n ssh.run(\"rm -rf #{release_path}\")\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete\n object.delete(:version_id => @version_id)\n end", "def destroy\n @service_version = ServiceVersion.find(params[:id])\n @service_version.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_versions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @apk_bin = ApkBin.find(params[:id])\n @apk_bin.destroy\n\n respond_to do |format|\n format.html { redirect_to apk_bins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @published = Published.find(params[:id])\n @published.destroy\n\n respond_to do |format|\n format.html { redirect_to publisheds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/deployed_containers/\"+params[:id].to_s+\"/destroy_deployed.json\"), (sesh :current_token))\n json_respond response.body\n\n end", "def destroy \n @release = Release.find(params[:id])\n #update_cashier(@release.value * -1)\n @release.view = false\n @release.save\n \n respond_to do |format|\n format.html { redirect_to cashier_path(params[:cashier_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @nvs_pack = NvsPack.find(params[:id])\n @nvs_pack.destroy\n\n respond_to do |format|\n format.html { redirect_to nvs_packs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @package = Package.find(params[:id])\n @package.destroy\n\n respond_to do |format|\n format.html { redirect_to packages_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project.destroy\n head :no_content\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\n format.html { redirect_to deployment_path(@node.deployment_id) }\n format.json { render api_delete @node }\n end\n end", "def destroy\n @budget_approver.destroy\n respond_to do |format|\n format.html { redirect_to budget_approvers_url, notice: 'Budget approver page was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @package.destroy\n respond_to do |format|\n format.html { redirect_to @package, notice: 'Package was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @api_state.destroy\n\n head :no_content\n end", "def destroy\n @barangay_bridge_project.destroy\n respond_to do |format|\n format.html { redirect_to barangay_bridge_projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Project.find_by_slug(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "def destroy\n # find ALL servings associated with this purchase and delete them\n all_servings = Serving.where(purchase_id: @purchase.id)\n puts \"all servings associated with this purchase: #{all_servings}\"\n all_servings.destroy_all\n puts \"deleted servings\"\n @purchase.destroy\n puts \"deleted purchase\"\n render json: {status: 204, purchase: @purchase}\n end", "def destroy\n @repo.destroy\n respond_to do |format|\n format.html { redirect_to repos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @built_with.destroy\n respond_to do |format|\n format.html { redirect_to built_withs_url, notice: 'Built with was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7599978", "0.75830764", "0.7331728", "0.7280199", "0.7220094", "0.70564556", "0.6923868", "0.6849098", "0.6839502", "0.6747978", "0.656011", "0.65568537", "0.6553798", "0.6550093", "0.65451354", "0.65429795", "0.65362513", "0.6534813", "0.6520899", "0.6494363", "0.64369124", "0.64367497", "0.6428008", "0.64209294", "0.63997316", "0.6378968", "0.6371239", "0.6365627", "0.6362252", "0.63451916", "0.63320124", "0.6328477", "0.63153404", "0.6292862", "0.6290985", "0.62874216", "0.62763673", "0.6273005", "0.6267577", "0.626486", "0.6258103", "0.62546325", "0.6248562", "0.6242892", "0.6240857", "0.6230146", "0.6230095", "0.62210375", "0.62191343", "0.62097794", "0.6184533", "0.6173746", "0.61664754", "0.6160632", "0.61485225", "0.6147717", "0.6138677", "0.61371934", "0.6135963", "0.6134481", "0.6134481", "0.6134481", "0.6134481", "0.612915", "0.6127895", "0.6127146", "0.6124238", "0.61059624", "0.6099121", "0.6080991", "0.6079146", "0.6078519", "0.60746217", "0.60738736", "0.6073683", "0.6071852", "0.6070628", "0.6069581", "0.6059388", "0.60535634", "0.60526985", "0.6051494", "0.60385126", "0.6027679", "0.601497", "0.6013398", "0.6012361", "0.6008405", "0.6006285", "0.5993216", "0.5987434", "0.5985239", "0.5982012", "0.59793884", "0.59765935", "0.5974628", "0.5974265", "0.5970232", "0.5969748", "0.59693044" ]
0.7823809
0
Use callbacks to share common setup or constraints between actions.
def set_press_release @press_release = PressRelease.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup\n #implement in subclass;\n end", "def after_set_callback; end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def around_hooks; end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.53314966", "0.53114754", "0.52984965", "0.52977055", "0.5296272", "0.5260649", "0.5245076", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.5235081", "0.52321917", "0.5228592", "0.5220735", "0.52198535", "0.52139324", "0.5208539", "0.5206585", "0.5178542", "0.5175199", "0.5173538", "0.5167041", "0.51614195", "0.51577675", "0.5153909", "0.51528823", "0.5152225", "0.51429904", "0.5141399", "0.51345575", "0.51145", "0.5114052", "0.5114052", "0.5110216", "0.5108656", "0.50935394", "0.5089196", "0.5081936", "0.5079627", "0.50675833", "0.5056105", "0.5053687", "0.5050475", "0.5050475", "0.503471", "0.5028311", "0.501982", "0.50157547", "0.5013552", "0.50014806", "0.50011593", "0.49976763", "0.4990292", "0.4990292", "0.49882022", "0.4981269", "0.49792367", "0.49766538", "0.4967978", "0.49667212", "0.4958987", "0.49572337", "0.49550423", "0.4954479", "0.4952353", "0.494726", "0.4944055", "0.4935437", "0.4931248", "0.49283475", "0.49281213", "0.49268973", "0.4921738", "0.49204507", "0.4918924", "0.49182287", "0.4916538", "0.49158585", "0.49156788" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def press_release_params params.require(:press_release).permit(:media_type, :media_name, :url, :published_at, :abstract) 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
deprecated not in use
def build_from_new(predicted_winners_by_match_id) @winners = {} predicted_winners_by_match_id.each do |match_id, match| @winners[match_id.to_i] = Predictable::Championship::Team.find(match[:winner].to_i) end @root.matches.each{|match| match.winner = @winners[match.id]} @root end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def internal; end", "def deprecated_key=(_arg0); end", "def refutal()\n end", "def extra; end", "def raise_deprecations; end", "def custom; end", "def custom; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def schubert; end", "def private_method\n end", "def wrapper; end", "def usage; end", "def usage; end", "def silence_deprecations; end", "def probers; end", "def missing; end", "def verdi; end", "def terpene; end", "def extended(*) end", "def alias_of; end", "def deprecated_tag(text); end", "def suivre; end", "def trd; end", "def who_we_are\r\n end", "def diagnostic; end", "def used?; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def outdated; end", "def weber; end", "def _deprecation\n @link['deprecation']\n end", "def deprecated?\n false\n end", "def warnings; end", "def warnings; end", "def warnings; end", "def warnings; end", "def warnings; end", "def warnings; end", "def warnings; end", "def warnings; end", "def implementation; end", "def implementation; end", "def reserved; end", "def initialize\n p \"deprecated method, instance should be creat by getNewGroup\"\n end", "def hidden_apis=(_arg0); end", "def external; end", "def original; end", "def disabled_warnings; end", "def extra_state; end", "def isolated; end", "def isolated; end", "def internal?; end", "def unused\n end", "def ibu; end", "def raise_deprecations=(_arg0); end", "def deprecated(msg, src)\n red(msg)\n green(\"Called from \" + src)\n end", "def overload; end", "def hidden_apis; end", "def blg; end", "def stderrs; end", "def from; end", "def from; end", "def from; end", "def from; end", "def dh; end", "def deprecate(old, new = T.unsafe(nil), id: T.unsafe(nil), reference: T.unsafe(nil), &block); end", "def villian; end", "def lsi; end", "def deprecated\n attributes.fetch(:deprecated)\n end", "def deprecated\n attributes.fetch(:deprecated)\n end", "def one_gradable_ex_only\n end", "def gounod; end", "def support\n raise \"Not implemented\"\n end", "def public; end", "def public; end", "def silly_adjective; end", "def public_method; end", "def ext; end", "def ext; end", "def old_name; end", "def sld; end", "def available; end", "def available; end", "def helpers; end", "def helpers; end", "def helpers; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def tld; end", "def tld; end", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def yoda; end", "def dev_minor() end", "def oldmtd\r\n \"old method\"\r\nend" ]
[ "0.7746214", "0.6687754", "0.6614516", "0.653184", "0.65142274", "0.6499014", "0.64858407", "0.64858407", "0.6446763", "0.6446763", "0.6446763", "0.6446763", "0.64296836", "0.6395863", "0.63799524", "0.63671374", "0.63671374", "0.6311634", "0.63098085", "0.62855035", "0.6269937", "0.61627585", "0.6159643", "0.612969", "0.6128571", "0.61173135", "0.6104546", "0.6097594", "0.6083508", "0.6069532", "0.6058278", "0.6058278", "0.6058278", "0.6039969", "0.6025699", "0.60215735", "0.6021451", "0.6004109", "0.6004109", "0.6004109", "0.6004109", "0.6004109", "0.6004109", "0.6004109", "0.6004109", "0.5991084", "0.5991084", "0.5985655", "0.59750354", "0.5974827", "0.59675604", "0.5949885", "0.59405005", "0.5937791", "0.5908102", "0.5908102", "0.58991736", "0.58883584", "0.5887669", "0.58806103", "0.587976", "0.58795136", "0.5868932", "0.5862749", "0.58567184", "0.58553493", "0.58553493", "0.58553493", "0.58553493", "0.58478403", "0.5844139", "0.5837876", "0.58367753", "0.5836747", "0.5836747", "0.5833539", "0.58331233", "0.5831732", "0.58272946", "0.58272946", "0.5822485", "0.58184415", "0.5814492", "0.5814492", "0.5812899", "0.5804171", "0.58037007", "0.58037007", "0.5800442", "0.5800442", "0.5800442", "0.5798763", "0.5798763", "0.5798763", "0.5798763", "0.57978696", "0.57978696", "0.5795227", "0.5794687", "0.57926035", "0.5791763" ]
0.0
-1
Exposes the linked list structure in an Enumerablecompatible format
def each return enum_for(:each) unless block_given? pointer = self loop do break if pointer.null? yield pointer pointer = pointer.next end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map\n # make a copy of List\n mapped = SinglyLinkedList.new\n self.each do |n|\n mapped.append n.value\n end\n # now map\n mapped.each do |n|\n n.value = yield n.value\n end\n mapped\n end", "def each\n #if head is not nil we have a list and can interate.\n #simply iterate and yield data from each node\n if [email protected]?\n current = @head\n while current.next_node != nil\n yield current.data\n current = current.next_node\n end\n yield current.data\n\n end\n end", "def ll_create()\n return Linked_List.new()\nend", "def map_to_linked_list(fn)\n result = LinkedList.new\n current = @head\n index = 0\n until current.nil?\n result.append(fn.call(current.value, index))\n current = current.next\n index += 1\n end\n result\n end", "def traverse_list\n return self unless block_given?\n x = @head\n until x.nil?\n yield x\n x = x.next_node\n end\n end", "def create_list\n list = SinglyLinkedList.new\n list.insert_at_start 1\n list.insert_at_start 2\n list.insert_at_start 3\n list.insert_at_end 4\n list.insert_at_start 4\n list.insert_at_end 5\n list\nend", "def create_list\n list = SinglyLinkedList.new\n list.insert_at_end 1\n list.insert_at_end 2\n list.insert_at_end 3\n list.insert_at_end 4\n list.insert_at_end 5\n list.insert_at_end 6\n list.insert_at_end 7\n list\nend", "def return_list\n entries = []\n current_node = @head\n\n while current_node.next != nil\n entries << current_node.value\n current_node = current_node.next\n end\n entries << current_node.value\n end", "def list\n return @enumerable\n end", "def unordered_list; end", "def list(*) end", "def deep_copy(obj)\n super\n n = obj.first\n until n.nil? do\n if n.value.is_a? Linkedlist\n k = Linkedlist.new\n self.addToList(k.deep_copy(n.value))\n else\n self.addToList(n.value)\n end\n n = n.next\n end\n return self\n end", "def each\n if @length > 0\n item = @head\n begin\n yield item.object\n item = item.next\n end until item.nil?\n end\n end", "def visit\r\n if !@head \r\n return \"empty list\"\r\n end\r\n \r\n printout = \"LL = #{@head.data}\"\r\n curr = @head.next \r\n \r\n while curr \r\n printout += \" -> #{curr.data}\"\r\n curr = curr.next\r\n end\r\n \r\n return printout\r\n end", "def nodelist; end", "def nodelist; end", "def each\n return nil if @head.nil?\n entry = @head\n until entry.nil?\n yield entry, \n entry = entry.next \n end\n end", "def combine_ins(obj)\n super\n if obj.type != 'list'\n temp = Node.new_x(obj.first.value)\n temp.next = self.first\n self.first = temp\n else\n temp = Node.new_x(obj)\n temp.next = self.first\n self.first = temp\n end\n @size += 1\n end", "def each\n \n nodo = @head\n while nodo != nil\n \n yield nodo.value\n nodo = nodo.next\n \n end\n \n end", "def each\n return if @head.nil?\n curr = @head\n until curr.nil?\n yield curr.data\n curr = curr.nxt\n end\n end", "def each\n\t\treturn nil unless block_given?\n\n\t\tcurrent = self.head\n\t\twhile current\n\t\t\tyield current\n\t\t\tcurrent = current.next\n\t\tend\n\tend", "def each\n\t\taux = @head\n while aux != nil do\n\t\t\tyield aux.value\n aux = aux.next\n\n end\n\n\tend", "def build_list(nodes)\n return nil if nodes.length == 0\n list = ListNode.new(nodes.last)\n ite = list\n i = nodes.length - 2\n while i>=0\n ite.next = ListNode.new(nodes[i])\n ite = ite.next\n i -= 1\n end\n list\nend", "def display\n current = @head\n full_list = []\n while current.next != nil\n full_list += [current.data.to_s]\n current = current.next\n end\n full_list += [current.data.to_s]\n puts full_list.join(\"->\")\n end", "def each\n\t\taux = @head\n\t\twhile (aux != nil) do\n\t\t\tyield aux[\"value\"]\n\t\t\taux = aux[\"next\"]\n\t\tend\n\tend", "def create_list arr\n list = SinglyLinkedList.new\n arr.each do |i|\n list.insert_at_end i\n end\n list\nend", "def create_list arr\n list = SinglyLinkedList.new\n arr.each do |i|\n list.insert_at_end i\n end\n list\nend", "def create_list arr\n list = SinglyLinkedList.new\n arr.each do |i|\n list.insert_at_end i\n end\n list\nend", "def each\n current_node = @head\n (0..@size - 1).each do |_i|\n yield current_node.data\n current_node = current_node.next\n end\n end", "def return_list\n list = []\n current_node = @head\n\n while current_node != nil\n node = current_node\n case node\n when @head\n node = [\"HEAD - value: #{current_node.value}, next: #{current_node.next_node}, random: #{current_node.random.value}\"]\n else\n node = [\"NODE - value: #{current_node.value}, next: #{current_node.next_node}, random: #{current_node.random.value}\"]\n end\n list << node\n current_node = current_node.next_node\n end\n return list\n end", "def display\n\t\tcurrent_node = @head\n\t\tlinked_list_array = []\n\t\twhile current_node != nil\n\t\t\t\n\t\t\tlinked_list_array << current_node.value\n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tlinked_list_array\n\tend", "def each &block\n return enum_for(:each) unless block_given?\n ptr = @head\n while ptr\n yield ptr.value\n ptr = ptr.nxt\n end\n nil\n end", "def each\n\t\taux = @head\n\t\twhile aux != nil\n\t\t\tyield aux.value\n\t\t\taux = aux.next\n\t\tend\n\tend", "def each\n return nil unless block_given?\n\n current = self.head\n while current\n yield current\n current = current.next\n end\n end", "def each \n node=@head\n while node != nil do\n yield node.value\n node = node.next\n end\n end", "def list; end", "def list; end", "def list; end", "def list; end", "def list; end", "def each\n current_node = @head\n while current_node\n yield(current_node.value) if block_given?\n current_node = current_node.next\n end\n end", "def each\n\t\tcurrent = @head\n\t\twhile current != nil\n\t\t\tyield current.value\n\t\t\tcurrent = current.next\n\t\tend\n\tend", "def print\n current_node = head\n list = []\n while current_node\n list.push(current_node.value)\n current_node = current_node.next\n end\n puts list.join(\"->\")\n end", "def map\n cur = self\n while cur\n yield(cur)\n cur = cur.next\n end\n self\n end", "def next(pointer); end", "def next(pointer); end", "def each\n node = @head\n while node\n yield node\n node = node.next_node\n end\n end", "def each\r\n actual = @head\r\n while actual != nil do\r\n yield actual.value\r\n actual = actual.next\r\n end\r\n end", "def next_element; end", "def each\n aux = @head\n while aux!=nil\n yield aux.value\n aux=aux.nest\n end\n end", "def print_list(list)\n while list\n puts list[:data] #print out the value assigned to the data key for each node in the list\n list = list[:next] #assign the next node to the list variables\n end #this means that the next time list[:data] is printed the next value down the node will be puts to stdout\nend", "def create_linked_list(values)\n nodes = []\n\n previous_node = nil\n values.each do |num|\n previous_node = ListNode.new(num, previous_node)\n nodes.push(previous_node)\n end\n\n nodes.reverse\nend", "def begin_iterator\n ListIterator.new @head, self\n end", "def visit\n current = @head\n while current != nil\n print \"#{current.data} \"\n current = current.next\n end\n puts\n end", "def list\n raise NotImplementedError\n end", "def ordered_list; end", "def each_with_index\n return nil if @head.nil?\n node_index = 1 #I'll consider first node as 1 \n entry = @head\n until entry.nil?\n yield entry, node_index\n entry = entry.next\n node_index +=1\n end\n end", "def each(node=@head)\n until node.nil?\n result = yield(node)\n node = node.next_node\n end\n result\n end", "def each\n\t\titerator = @head\n\t\twhile iterator != nil do\n\t\t\tyield iterator.value\n\t\t\titerator = iterator.next\n\t\tend\n\tend", "def print_list\n current_node = @head\n\n until current_node == nil\n\t print \"#{current_node.value} -> \"\n\t current_node = current_node.next\n end\n\n puts '' \t\n end", "def each_with_index\n each_linked_list_item_with_index do |node, index|\n yield node.payload, index\n end\n end", "def print_list\n\t\tcounter = 0\n\t\tcurrent_node = @head\n\t\tloop do\n\t\t\tputs \"Node at index #{counter}: #{current_node.data}\"\n\t\t\tbreak if current_node.next.nil?\n\t\t\tcurrent_node = current_node.next\n\t\t\tcounter += 1\n\t\tend\n\tend", "def print\n list_head = self.head\n next_node = list_head.next\n while next_node\n next_node = next_node.next unless next_node.next === false\n end\n end", "def each\n return to_enum(:each) unless block_given?\n\n seek(:head)\n yield current_entry while move_next\n end", "def each\n current = @head\n until current.nil?\n yield current.val\n current = current.nxt\n end\n end", "def next_l\n raise \"implement in subclass\"\n end", "def each # And define each on top of next\n loop {yield self.next }\n end", "def next_list\n @list_index += 1\n\n if @lists.size < @list_index\n @lists << []\n end\n\n @co_index = 1\n\n nil\n end", "def iterate\n current_node = self.head\n i = 0\n\n while current_node != nil\n yield(current_node, i)\n current_node = current_node.next\n i += 1\n end\n end", "def inspect\n result = 'Immutable::List['\n each_with_index { |obj, i| result << ', ' if i > 0; result << obj.inspect }\n result << ']'\n end", "def each\n current = @head\n while current != nil\n yield current.value\n current = current.next\n end\n end", "def clone()\n\t\ttemp = LinkedList.new()\n\t\tcurrent = @head\n\t\twhile (current)\n\t\t\ttemp.append(current.get_item())\n\t\t\tcurrent = current.get_next()\n\t\tend\n\t\treturn temp;\n\tend", "def traverse; end", "def convert_binary_tree_to_double_linked_list(root)\nend", "def head\n\t\t\[email protected]\n\t\tend", "def parse_list; end", "def parse_list; end", "def olist(node)\n noko { |xml| wrap_list :olist_naked, node, xml }\n end", "def to_a\n a = []\n while (item = self.next)\n a << item.item\n end\n a\n end", "def next() end", "def next() end", "def linked\n ret = []\n self.links.inject(ret){|arr , link| arr << link.target}\n self.incomming_links.inject(ret){|arr , link| arr << link.source}\n ret\n end", "def traversal\n list_array = []\n curr_node = @head\n while curr_node do\n list_array << curr_node\n curr_node = curr_node.next\n end\n\n list_array\n end", "def printList(node)\n if node == nil\n print \"end\\n\"\n return\n else\n print node.val, \"->\"\n end\n printList(node.next)\nend", "def each\n enum = @head\n while (enum != nil) \n yield enum.value\n enum = enum.next\n end\n end", "def each\r\n head = @node[:head]\r\n tail = @node[:tail]\r\n if !head.nil?\r\n while !tail.empty?\r\n yield head\r\n x_xs = tail.x_xs()\r\n head = x_xs[:x]\r\n tail = x_xs[:xs]\r\n end\r\n yield head\r\n end\r\n end", "def linked_list_from_num(n)\n current = Node.new()\n head = current\n parent = nil\n n.digits.each do |d|\n current.val = d \n parent = current\n current.next = Node.new()\n current = current.next\n end\n parent.next = nil\n head\nend", "def print_list; end", "def print\n current_head = self.head\n current_tail = self.tail\n if current_head == current_tail\n puts \"The linked list has one member: #{current_head.data}\"\n else\n current = current_head\n string = \"\"\n until current == current_tail\n string += \"#{current.data}\\n\"\n current = current.next\n end\n string += \"#{current.data}\\n\"\n puts string\n end\n\n end", "def _list\n if @_structure_changed \n @list = nil\n @_structure_changed = false\n end\n unless @list\n $log.debug \" XXX recreating _list\"\n convert_to_list @treemodel\n #$log.debug \" XXXX list: #{@list.size} : #{@list} \"\n $log.debug \" XXXX list: #{@list.size} \"\n end\n return @list\n end", "def deep_each\n \n end", "def linked_list_per_depth\n list = Array.new(height)\n each_depth do |layer, depth|\n n = layer.size - 1\n list[depth] = (0..n).reduce(nil) do |acc, i|\n layer[n-i].nil? ? acc : LinkedList.new(layer[n-i].value, acc)\n end\n end\n list\n end", "def to_linked_list(node = @root)\n return if node.nil?\n\n to_linked_list(node.right)\n\n node.next = @head\n\n if (@head)\n @head.prev = node\n end\n\n @head = node\n\n to_linked_list(node.left)\n end", "def print\n if self.head != nil\n current = self.head\n while current != nil\n current = current.next\n end\n end\n end", "def print\n \tlist = ''\n \tcurrent = @head\n \twhile !current.nil?\n list = list + \"#{current.value}\"\n list = list + ' ' if current.next != nil \n current = current.next\n \tend\n \tlist\n end", "def each\n return to_enum unless block_given?\n list = self\n until list.empty?\n yield(list.head)\n list = list.tail\n end\n end", "def to_a; @list; end", "def list\n @list_helper ||= ListWrapper.new(self)\n end", "def list\n @list\n end", "def each\n nodo1 = @lista_alimentos.head\n nodo2 = @gramos.head\n while (nodo1 != nil && nodo2 != nil)\n yield nodo1.value\n nodo1 = nodo1.next\n nodo2 = nodo2.next\n end\n end", "def print_list(node)\n puts \"\\nTraversal in forward direction\"\n while node != nil\n puts node.data\n last = node\n node = node.next_node\n end\n\n puts \"\\nTraversal in reverse direction\"\n while last != nil\n puts last.data\n last = last.prev_node\n end\n end" ]
[ "0.65045196", "0.6359072", "0.6093369", "0.60287637", "0.6013337", "0.6000312", "0.5978901", "0.5971415", "0.5952695", "0.59513843", "0.5950208", "0.593889", "0.58454627", "0.58424884", "0.5824475", "0.5824475", "0.5797832", "0.5776844", "0.5772678", "0.5752801", "0.5745249", "0.57256806", "0.57160026", "0.570975", "0.5701552", "0.56986755", "0.56986755", "0.56986755", "0.5688112", "0.56833714", "0.56748205", "0.56705314", "0.56547403", "0.5653391", "0.5648554", "0.56375384", "0.56375384", "0.56375384", "0.56375384", "0.56375384", "0.5635641", "0.5620386", "0.5619834", "0.56155694", "0.5611455", "0.5611455", "0.56087077", "0.56049496", "0.56028694", "0.5572462", "0.55628127", "0.5524478", "0.55206364", "0.5517816", "0.5517522", "0.549544", "0.5492597", "0.54828304", "0.5482559", "0.5474404", "0.54688686", "0.5451528", "0.5448978", "0.54475707", "0.544298", "0.54198074", "0.5407642", "0.5389806", "0.53813636", "0.5381357", "0.5381035", "0.5378137", "0.5375928", "0.5371558", "0.53670466", "0.53534895", "0.53534895", "0.53466696", "0.53457665", "0.53289384", "0.53289384", "0.5322811", "0.53162676", "0.5311773", "0.53018063", "0.5299455", "0.5296728", "0.52914095", "0.5290935", "0.5289884", "0.5283911", "0.527978", "0.5275712", "0.52754164", "0.5270079", "0.52694196", "0.5261589", "0.5256727", "0.5255228", "0.5252884", "0.52414817" ]
0.0
-1
Returns a unique, deterministically reproducible index into an array We are hashing based on strings, let's use the ascii value of each string as a starting point.
def index(key, size) key.sum % size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_unique(array)\n unique_id = 0\n\n array.each do |num|\n unique_id ^= num\n end\n\n unique_id\nend", "def generateKey(string)\r\n key = {}\r\n stringIterator = 0\r\n\r\n (string.length).times do\r\n charactersIterator = string[stringIterator] - 1\r\n divisorsIterator = 0\r\n divisors = {} # Possible divisors of the array's numbers\r\n\r\n # Check which numbers are possible divisors\r\n while charactersIterator > 0\r\n\r\n if string[stringIterator] % charactersIterator == 0\r\n divisors[divisorsIterator] = charactersIterator\r\n divisorsIterator += 1\r\n end\r\n charactersIterator -= 1\r\n end\r\n key[stringIterator] = divisors[rand(divisors.length)] # Choosing random divisor to be the primary key\r\n stringIterator += 1\r\n end\r\n\r\n return key\r\nend", "def dupe_indices(array)\n hash = Hash.new{ |k, v| k[v] = [] }\n\n array.each_with_index do |char, i|\n hash[char] << i\n end\n\n return hash.select { |k, v| v.length > 1 }\n\nend", "def index(key, size)\n MurmurHash3::V32.str_hash(key.to_s, size) % size\n end", "def index(key, size)\n hash_code = 0\n array_of_characters = key.split('')\n array_of_characters.each do |letter|\n hash_code += letter.ord\n end\n hash_code % size\n end", "def test_array_hash\r\n # a = %w(brendan baird billy)\r\n # assert_equal(1047868961, a.hash)\r\n end", "def hash_offset(array, offset)\r\n hash = {}\r\n \r\n i = 0\r\n while i < array.length \r\n if i >= (array.length - offset) #if i >= 22, in this case. So this condition applies for the last 4 elements of the array\r\n hash[array[i-array.length + offset]] = array[i] # hash[array[22-26+4]] --> hash[array[0]] --> hash[\"a\"]=array[22] --> hash[\"a\"]=\"w\"\r\n else\r\n hash[(array[i].ord + offset).chr] = array[i] #otherwise do the normal offset by 4\r\n end\r\n i += 1\r\n end\r\n return hash\r\nend", "def find_uniq_int(array)\n\tuniq_id = 0\n\n\tarray.each do |element|\n\t\tuniq_id ^= element\n\tend \n\n\treturn uniq_id\nend", "def first_non_repeating(input)\n input_array = input.chars\n index = 0\n input_hash = {}\n for char in input_array do\n # If it's not in the hash already\n if input_hash.key?(char)\n # add char as key to input_hash\n # increment 1 to value of the char key in input_hash\n input_hash[char] += 1\n else\n # create a new key in input_hash and assign value as one\n input_hash[char] = 1\n end\n end\n p input_hash.key(1)\nend", "def find_unique_integer(id_array)\n unique_id = 0 \n id_array.each do |id|\n unique_id ^= id\n end\n\n return unique_id\nend", "def generate_random_array \n big_array = []\n i = set_array_size.to_i\n \n while i >= 1 \n big_string = (0...50).map { ('a'..'z').to_a[rand(26)] }.join\n big_array << big_string\n i = i - 1 \n end\n big_array \n end", "def lookuptable\n res = Hash.new\n (0..255).each do |c|\n res[c] = unscramble(c)\n end\n res\n end", "def index(key, size)\n ascii_value = 0\n hash_key = 0\n\n key.split(\"\").each do |letter|\n ascii_value += letter.ord #Method to retrieve ascii\n end\n\n hash_key = ascii_value % size\n\n return hash_key\n end", "def random_hash(size)\n characters = ('A'..'Z').to_a + (2..9).to_a - [ 'I', 'O' ]\n Array.new(size) { characters[ rand(characters.size) ] }.join\n end", "def inject_evil_symbols(array)\n array.insert(\n rand(0..array.length),\n [rand(9999), 9999]\n ).flatten!\nend", "def index(key, size)\n #sums up the ascii values of each char in a string\n code = key.sum\n return code % size\n end", "def unoptimized_find_unique_integer(id_array)\n histogram = Hash.new(0)\n id_array.each do |id|\n histogram[id] += 1\n end\n histogram.keys.each do |key|\n return key if histogram[key] == 1\n end\n return nil\nend", "def array_to_indices_hash(array)\n array.inject({}) {|hash,e| hash[hash.size] = e; hash }\n end", "def index(key, size)\n #true_index = hash(key) % k\n code = 0\n key.split(%r{\\s*}).each do |letter|\n code += letter.ord \n end\n puts code\n return code % size\n\n end", "def random_string_in(arr)\n return nil if arr.empty?\n index = random_number(0, arr.length-1)\n arr[index]\n end", "def where_to_put_secret(index)\n (0...48).each do |b|\n if index[b] == 1\n return b\n end\n end\n # I = 0, this is the seed.\n 48\n end", "def dupe_indices(array)\n #ht = Hash.new {|h,k| h[k]=[]}\n #ht[\"cats\"] << \"Jellicle\"\n #ht[\"cats\"] << \"Mr. Mistoffelees\"\n hash = Hash.new { |h,k| h[k]=[] }\n array.each_with_index do |char, i|\n hash[char] << i\n end\n \n # puts \"Hash b select form : #{b.select{|key, value| value < 200}}\\n\\n\n hash.select{ |k,v| v.length > 1}\n\n\nend", "def my_uniq(arr)\n answer = Hash.new\n arr.each_with_index do |el, i|\n answer[el] = 1\n end\n answer.keys\nend", "def to_indices_hash(arr)\n #::Hash[*(0..arr.length - 1).to_a.zip(arr).flatten]\n arr.inject({}) {|hash,e| hash[hash.size] = e; hash }\n end", "def hashify(key)\n array = key.split('')\n count = array.count\n index = array.inject(0) do |object,char|\n object += char.ord ** count\n count -= 1\n object\n end\n index % 89\n end", "def index(key, size)\n # Takes the string 'key', creates an array of individual characters (split), maps to an array of ascii values (map), and then sums them (reduce)\n # Reaminder from dividing above amount by array size produces the array index\n (key.split(//).map { |char| char.ord }.reduce(:+)) % size\n 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 random_index(len)\n rand(1..len) - 1\nend", "def hashit\n n = 0\t \n (\"A\"..\"Z\").each do |x|\n @rotor_hash[x] = @rotor_array[n]\n n += 1\n end \n return @rotor_hash\n end", "def uniqueness_dictionary\n [*(:A..:Z), *(:a..:z), *(0..9)].map(&:to_s)\n end", "def uniques(array)\n hash = Hash[array.map {|x| [x, nil]}]\n print hash.keys\nend", "def from_index\n Indexer.index[probably_unique_id]\n end", "def weighted_random_index(array)\n idx = rand(array.length)\nend", "def my_uniq(arr)\n hashed = arr.map {|value| [value, arr.count(value)]}.flatten\n return Hash[*hashed].keys\nend", "def hash()\n #This is a stub, used for indexing\nend", "def create_key_a\n @key_chars[0..1].join.to_i\n end", "def my_uniq(arr)\n hash = Hash.new(0)\n arr.each {|el| hash[el] = 1} #value doesnt matter this case\n hash.keys\nend", "def hash()\n #This is a stub, used for indexing\n end", "def hashit\n n = 0\n Chars.split(\"\").each do |x|\n @rotor_hash[x] = @rotor_array[n]\n n += 1\n end \n @rotor_hash\n end", "def my_uniq(arr)\n hsh = Hash.new(0)\n arr.each do |el|\n hsh[el] += 1\n end\n hsh.keys\nend", "def generate_unique_key\n # not doing uppercase as url is case insensitive\n charset = ::Shortener.key_chars\n (0...::Shortener.unique_key_length).map{ charset[rand(charset.size)] }.join\n end", "def rand_index\n SecureRandom.random_number(size)\n end", "def unique_elements(array)\n hash = Hash.new(0)\n array.each { |ele| hash[ele] += 1 }\n\n hash.keys\nend", "def uniq_integer(input_array)\n unique = 0\n input_array.each do |num|\n unique = unique ^ num\n end\n\n unique\nend", "def ifind_magic(arr)\n return false if arr.size == 0\n s = arr[0]\n e = arr[-1]\n magic_arr = []\n i = 0\n while s < e\n return magic_arr if arr[i] != i\n if arr[i] == i\n magic_arr[i] = i\n end\n i += 1\n end\nend", "def gen_first_path(path_length)\n # we will now generate an array with path_length number of elements\n # the elements will be randomly selected numbers from (1.. path_length ^ 2)\n # to avoid duplicate numbers we will kepp track of which ones have already been used\n # in another local array\n\n used = []\n\n path = {}\n\n path_length.times do |k, v|\n random = gen_uniq_rand(path_length ** 2, used)\n used << random\n path[random] = 0\n end\n\n path\nend", "def create_index1(word)\n word.chars.sort!.join\n end", "def random_entry(arr)\n arr[rand(arr.size)]\n end", "def first_unique_char(s)\n\n hash = Hash.new(0)\n\n s.each_char.with_index(0) {|char, i|\n if hash[char] != nil\n hash[char] = hash[char] + 1\n else\n hash[char] = 1\n end\n\n # p hash\n }\n\n s.each_char.with_index(0) {|char, i|\n if hash[char] == 1\n return i\n end\n }\n return -1\n\nend", "def initialize(seed)\n @index = 0\n @mt = []\n @mt[0] = seed\n (1...ARRAY_LENGTH).each do |i|\n @mt[i] = (2 **32 -1) & (INIT_CONST * (@mt[i-1] ^ (@mt[i-1] >> 30)) + i)\n end\n end", "def generate_unique_id\n Digest::SHA256.hexdigest unique_id_elements.join\n end", "def get_auto_hash\n hash = get_hash(Time.now.to_s)\n zeros = rand(5)\n (0..zeros).each do |z|\n hash[z] = \"0\"\n end\n\n return hash\nend", "def dupe_indices(arr)\n idxs = Hash.new { |h, k| h[k] = [] }\n \n arr.each_with_index do |ele, i|\n idxs[ele] << i\n end\n\n return idxs.select { |ele, arr| arr.length > 1 }\nend", "def make_artist unique_index\n artist_name = (0...8).map{ 65.+(rand(26)).chr }.join\n return \"INSERT INTO artists VALUES (#{rand(500)}, '#{artist_name}');\"\nend", "def SHA256 arr\n Digest::SHA256.digest(arr.map(&:chr).join).bytes\nend", "def array_to_hash(array) \n count=0\n\n hash = Hash.new\n (array.length).times do \n hash[count+1] = array[count]\n count += 1\n end\n return hash\n end", "def magic_slow(arr)\n arr.each_with_index do |val, index|\n return index if val === index\n end\nend", "def unique_in_order(string)\n string.each_char.with_index.reduce([]) do |arr, (el, i)|\n if el == string.chars[i+1]\n arr\n else\n arr << el\n end\n end\nend", "def array_gen(hash)\n array = []\n hash.each do |key, value|\n value.times do\n array << key.to_s\n end\n end\n return array\nend", "def index(key, size)\n ascii = 0\n \n key.each_byte do |x|\n ascii += x\n end\n \n return ascii % size\n end", "def unique_elements(arr)\n hash = Hash.new(0)\n arr.each {|el| hash[el] += 1}\n return hash.keys\n\nend", "def weighted_random_index(array)\n\nend", "def unique_in_order(iterable) \n# create an empty array\ncontent = []\n\n # check each letter/number of `iterable` \n for e in (0..iterable.length()-1) \n\n# compare current element to previous element\n# if array is empty\n if e == 0 or \n# \n# if current element is not the same with previous element, push current index to content array\n iterable[e] != iterable[e-1] \n content.push(iterable[e])\n end\n end\n# return new content array\n return content\nend", "def unique_index\n @unique_index\n end", "def index(key, size)\n char_value = 0\n # Adds together all of the ASCII values for each character into char_value.\n for letter in key.chars do\n char_value += letter.ord\n end\n # Increments char_value until its length equals desired size.\n until char_value.to_s.length == 7\n char_value*=11\n end\n\n return char_value%size\n end", "def get_first_recurring_char(arr)\n hash = {}\n\n arr.each do |ele|\n key = ele.is_a?(Integer) ? ele.to_s : ele.to_sym\n return ele if hash[key]\n\n hash[key] = 'e'\n end\n 'The array is unique. No recurring character!!!'\nend", "def tiles_array_to_hash(array)\n tiles = Hash.new\n i = 0\n until i == array.length\n tiles[array[i]] = i\n i += 1\n end\n tiles\nend", "def index(key, size)\n hash_code = 0\n key.each_byte do |c|\n hash_code += c\n end\n hash_code % @size\n end", "def unique_elements(arr)\n hash = Hash.new(0)\n arr.each { |ele| hash[ele] += 1}\n hash.keys\nend", "def my_uniq(arr)\n counter = Hash.new(0)\n arr.each do |x|\n counter[x] += 1\n end\n counter.keys\nend", "def Unique(string)\n\n # assumes alphabet of size 128\n return false if string.length > 128\n \n hash={}\n \n for i in 0..string.length-1\n return false if hash[string[i]] \n hash[string[i]]=true\n end\n \n \nreturn true\n\nend", "def hashing(i)\n \n return ALPHABET[0] if i == 0\n hash = ''\n base = ALPHABET.length\n while i > 0\n hash<< ALPHABET[i.modulo(base)]\n i /= base\n end\n hash.reverse\n end", "def index_of(item)\n hash_value = 0\n item.each_byte { |byte| hash_value += byte }\n hash_value % @table.size\n end", "def index(key, size)\n ascii_sum = 0\n key.split(\"\").each do |word|\n ascii_sum += word.ord\n end\n ascii_sum % size\n end", "def index(key, size)\n sum = 0\n\n key.split(\"\").each do |char|\n if char.ord == 0\n next\n end\n\n sum = sum + char.ord\n end\n\n\n sum % size\n\n end", "def magic_slow(arr)\n arr.each_with_index do |val, index|\n if val === index\n return index\n end\n end\nend", "def using_uniq(array)\n\n \nend", "def initialize(seed=42)\n @arr = []\n @size = 0\n r = Random.new(seed)\n @cardinality = 1000\n @hash_a = ((r.rand(PRIME_NUMBER-1)+1)%PRIME_NUMBER) % @cardinality\n @hash_b = r.rand(PRIME_NUMBER)\n end", "def make_hash\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n string = \"\"\n 20.times do\n string << chars[rand(chars.size-1)]\n end\n hash = Digest::SHA2.hexdigest(string)\n end", "def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end", "def index(key, size)\n sum = 0\n\n key.split(\"\").each do |char|\n if char.ord == 0\n next\n end\n\n sum = sum + char.ord\n end\n\n\n sum % size\n end", "def index(key, size)\n sum = 0\n\n key.split(\"\").each do |char|\n if char.ord == 0\n next\n end\n\n sum = sum + char.ord\n end\n\n\n sum % size\n end", "def yale_row_as_hash i\n h = yale_nd_row(i, :hash)\n return h if i >= self.shape[1] || self[i,i].nil? || self[i,i] == 0\n h[i] = self[i,i]\n end", "def Hash_Func( str )\n hash = 0\n i = 0\n while i < str.length\n c = str[i]\n hash = hash * 31 + c.ord\n i = i + 1\n end\n hash = hash.abs\n return PaddGUID( hash )\n end", "def test_index_one_repeated_word\n #assert false # bogus assert -- remove or comment out\n @concordance.index!(['zero','zero','zero'])\n assert_equal({'zero'=>[1]},@concordance.hash)\n end", "def non_repeating_char_index(string) \n hash = {}\n\n string.length.times do |i|\n if !hash.has_key?(string[i])\n hash[string[i]] = 1\n else\n hash[string[i]] += 1\n end\n end\n\n char = hash.select { |char, occurence| occurence == 1}\n .map { |char, occurence| char }[0]\n\n return string.index(char) \nend", "def hard(string)\n hasher = KnotHash.new(256, string.bytes + [17, 31, 73, 47, 23])\n 64.times { hasher.round }\n hasher.hash\nend", "def test_index_array\r\n\t\tarr = [\"a\", \"b\", \"c\", \"a\", \"b\", \"d\", \"c\"]\r\n\t\tassert_equal({\"a\"=>[0,3], \"b\"=>[1,4], \"c\"=>[2,6], \"d\"=>[5]}, arr.find_values_index())\r\n\tend", "def index(key, size)\n sum = 0\n\n key.split(\"\").each do |char|\n if char.ord == 0\n next\n end\n\n sum = sum + char.ord\n end\n\n sum % size\n end", "def key_for_string str\n Digest::MD5.hexdigest(str).to_i(16) & KEY_MAX\n end", "def first_uniq_char(s)\n hash_table = {}\n (0..s.length-1).each do |i|\n if hash_table.include? (s[i])\n hash_table[s[i]] = hash_table[s[i]] + 1\n else\n hash_table[s[i]] = 1\n end\n end\n\n (0..s.length-1).each do |i|\n if hash_table[s[i]] == 1\n return i\n end\n end\n return -1\nend", "def generate_unique_key\n\n # @TODO:need to update the algo. Right now it's very simple algo\n length = self.url.length\n rand(36**length).to_s(36)\n end", "def random_key\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n (0...8).map { o[rand(o.length)] }.join\n end", "def my_uniq(arr)\n \n output = []\n hash = Hash.new(false)\n \n arr.each do |x|\n output << x if !hash[x]\n hash[x] = true\n end\n output\n end", "def index(key, size)\n value = ascii_value(key) % size\n return value\n end", "def unique(arr)\n uniq = Hash.new(0)\n arr.each { |x| uniq[x] += 1 }\n uniq.select { |k, v| v == 1 }.keys\nend", "def find_unique_elements (arr)\n n = Hash.new(0)\n return_array = []\n arr.each do |element|\n n[element] += 1\n end\n n.each_pair { |k,v| \n if v == 1\n return_array << k\n end\n }\n \n return return_array\nend", "def generate_key(size = 6)\n charset = %w{ 2 3 4 6 7 9 A C D E F G H J K L M N P Q R T V W X Y Z}\n (0...size).map{ charset.to_a[rand(charset.size)] }.join\nend", "def gimme(input_array)\n input_array.index(input_array.sort[1])\nend", "def index\n @array = [45, 6, 32, 0]\n end", "def unique_elements(arr)\n my_hash = Hash.new(0)\n arr.each do |element|\n my_hash[element] += 1\n end\n return my_hash.keys\nend" ]
[ "0.63831186", "0.6240291", "0.6142978", "0.6100088", "0.60602856", "0.60466117", "0.6042421", "0.60271215", "0.59920084", "0.5906661", "0.5872396", "0.5838743", "0.5826113", "0.5816591", "0.57661915", "0.575281", "0.57520026", "0.5740316", "0.573151", "0.57115084", "0.5710239", "0.5702436", "0.57000333", "0.5682168", "0.56713295", "0.5659387", "0.5617679", "0.5612602", "0.5611522", "0.5609429", "0.55877906", "0.556069", "0.55559057", "0.5540219", "0.553639", "0.55338424", "0.5519851", "0.55137026", "0.5508655", "0.550243", "0.54936284", "0.54928684", "0.548981", "0.5486688", "0.54670995", "0.54535294", "0.5448307", "0.54439324", "0.5437039", "0.54303586", "0.54299474", "0.5429574", "0.5429304", "0.54236114", "0.5419913", "0.5416589", "0.5416557", "0.54152507", "0.5410619", "0.540723", "0.54053247", "0.5405175", "0.53960896", "0.53909504", "0.5389311", "0.53890544", "0.5382372", "0.5379476", "0.5368015", "0.5362644", "0.53588706", "0.5358157", "0.53541297", "0.5351719", "0.53503495", "0.5316144", "0.5309172", "0.53031117", "0.52977383", "0.5295245", "0.52945185", "0.52945185", "0.5287685", "0.5285562", "0.5284554", "0.5283536", "0.5269303", "0.5269089", "0.5268127", "0.5267054", "0.52667093", "0.5266481", "0.52564746", "0.52552485", "0.52540493", "0.52502745", "0.5248794", "0.52473456", "0.52436227", "0.5239129", "0.52384627" ]
0.0
-1
Simple method to return the number of items in the hash
def size @nodes.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n return @hash.length\n end", "def length\n hash.keys.length\n end", "def size\n @hash.size\n end", "def size\n @hash.size\n end", "def size\n @hash.size\n end", "def size\n @hash_array.length\n end", "def size\n @hash_array.length\n end", "def size\n @hash_table.keys.length\n end", "def size\n keys.size\n end", "def length\n @internal_hash.length\n end", "def count\n @hash_tags.count\n end", "def count(list)\n list.each do |hash|\n total += 1\n end\n return total\n end", "def length()\n return self.keys.get_length()\n end", "def size\n @keys.size\n end", "def hlen(key); end", "def hlen(key); end", "def length()\n return @i_keys.get_length()\n end", "def length\n keys.length\n end", "def num_keys\n end", "def length\n return @ghash.length\n end", "def value_count(hash, value)\n hash.select { |_k, v| v == value }.length\nend", "def test_Hash_InstanceMethods_size\n\t\th={1=>'a', 2=>'b', 3=>'c'}\n\t\tassert_equal(3, h.size)\n\tend", "def count\r\n items.size\r\n end", "def size\n @hash.size + @converted.size\n end", "def hash_size\n hashref_size * num_hashes\n end", "def length\n @driver_instance.count_list_value(@key)\n end", "def nitems() end", "def count_objects\n count = 0\n @objects.keys.each do |key|\n count += @objects[key].length\n end\n\n return count\n end", "def size\n @redis.llen @key\n end", "def item_count\n item_values.values.compact.sum { |v| v.is_a?(Array) ? v.size : 1 }\n end", "def size\n @buckets.length\n end", "def get_size\n @buckets.length\n end", "def count_items\n @items.size\n end", "def item_count\n @items.length \n end", "def size\n self.data.keys.size\n end", "def size\n @index.keys.uniq.count\n end", "def length\n @results.keys.length\n end", "def item_count\n @items.length\n end", "def count\n redis { |conn| conn.llen(key) }\n end", "def count; @value.size; end", "def size\n @store.keys.count { |k| Time.now - @store[k].stamp < @lifetime }\n end", "def count\n @item_list.size\n end", "def count\n values.inject(0){|m, v| m + v.length}\n end", "def size\n @keys.length - 1\n end", "def size(hash1=self.orderJSON)\n sum = 0\n unless hash1.class == Hash\n hash1 = eval(hash1)\n end\n hash1.each do |k1,v1|\n v1.each do |k2,v2|\n sum += v2.to_i\n end\n end\n return sum \n end", "def length\n stash.length\n end", "def value_count(hash, value)\n count = 0\n hash.each { |elem| count += 1 if elem[1]==value }\n count\nend", "def key_count\n $capitals.keys.length\nend", "def size\n @items.count\n end", "def size\n @items.count\n end", "def count\n each.size\n end", "def count(data)\n return data.length\n end", "def size\n return @items.size\n end", "def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end", "def size\n return @items.length\n end", "def size\n return @items.length\n end", "def size\n return @items.length\n end", "def size\n return @items.length\n end", "def size\n return @items.length\n end", "def size\n return @items.length\n end", "def size\n return @items.length\n end", "def size\n entries.length\n end", "def hit_count\n item_hash.deep_find(:hit_count, 0)\n end", "def hashref_size\n hashptr_size + length_size\n end", "def size\n\t\treturn @items.size\n end", "def size\n return @items.size\n end", "def size\n entries.size\n end", "def size\n @references_to_keys_map.count do |_, ref|\n ref.object\n end\n end", "def count_items(name)\n @items[name].size\n end", "def size\n counter = 0\n @items.each do |item|\n if item.nil?\n counter += 1\n else\n counter += item.length - 1\n end\n end\n counter\n end", "def size\n return @items.length\n end", "def print_counts(hash)\n hash.each { |key, count| puts \"#{key} -- #{count}\\n---------\\n\" }\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 count\n @data.size\n end", "def item_count()\n @names.count\n end", "def size\n @count\n end", "def size\n @count\n end", "def customer_pet_count(customer_hash)\n return customer_hash[:pets].length\nend", "def num_buckets\n @store.length\n end", "def size\n data.values.inject(0){|m,v| m+=v.size}\n end", "def length\n each.count\n end", "def count\n to_a.size\n end", "def count\n to_a.size\n end", "def size\n items.size\n end", "def size\n items.size\n end", "def item_count\n collection.length\n end", "def size\n @clients.keys.length\n end", "def my_count\n if block_given?\n num = 0\n self.my_each{|item| num += 1 if yield(item)}\n num\n else\n # if no block given return size of array\n self.length\n end\n end", "def size\n\n @items.size\n end", "def count\n @map.count\n end", "def size\n entries.length\n end", "def count\n items.compact.count.to_d\n end", "def item_count\n @collection.length\n end", "def size\n @size ||= (@key_map || @row || []).size\n end", "def count\n @obj['count'].to_i\n end", "def size\n entries.size\n end", "def size\n entries.size\n end", "def cardinality\n redis.hget(bucket_key, RedisBackend::COUNT_FIELD).to_i\n end", "def size\n @items.length\n end", "def size\n @items.length \n end", "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" ]
[ "0.82830465", "0.82106954", "0.8109915", "0.8109915", "0.8109915", "0.79695594", "0.79695594", "0.78124315", "0.77486163", "0.76849425", "0.7678069", "0.7656559", "0.7636084", "0.76298493", "0.761464", "0.761464", "0.7574793", "0.7569945", "0.7478816", "0.7444118", "0.7398974", "0.7347107", "0.7325141", "0.73046833", "0.7278303", "0.7254247", "0.72418344", "0.72181946", "0.7218174", "0.7212672", "0.7163285", "0.7155209", "0.71543235", "0.7141862", "0.7141228", "0.7114565", "0.7113586", "0.70941246", "0.70929605", "0.7078681", "0.7075524", "0.70673853", "0.704924", "0.7045759", "0.7036195", "0.7036063", "0.70260674", "0.7013333", "0.7007178", "0.7007178", "0.6999955", "0.69869804", "0.69839865", "0.69832903", "0.6981746", "0.6981746", "0.6981746", "0.6981746", "0.6981746", "0.6981746", "0.6981746", "0.698101", "0.6957832", "0.69537604", "0.6951404", "0.69499755", "0.6942363", "0.69395435", "0.6938698", "0.6935908", "0.6935669", "0.6932399", "0.6930644", "0.69240755", "0.69203275", "0.6903333", "0.6903333", "0.6896567", "0.68949735", "0.6894421", "0.68883306", "0.6887863", "0.6887863", "0.6878182", "0.6878182", "0.687759", "0.6873718", "0.6871754", "0.6845873", "0.6842765", "0.683874", "0.68387157", "0.68368727", "0.6836297", "0.6833241", "0.68303066", "0.68303066", "0.68206984", "0.68202174", "0.68190515", "0.6816045" ]
0.0
-1
Checks if the pepXML file used namespaces
def hasNamespace if @doc.xpath("msms_pipeline_analysis").to_s.length == 0 true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_namespaces?\n @strip_namespaces != false\n end", "def namespace?\n node_type == NAMESPACE_DECL\n end", "def use_namespaces?\n extensions.count > 1\n end", "def owned_namespaces?\n namespaces?.reject {|key,value| !value.owner}\n end", "def validNs?(namespace, base)\n namespace && !namespace.empty? && namespace.to_sym != base\nend", "def namespace_directive?\n @name == '@namespace'\n end", "def namespace_matches?(xml_node, ns)\n return false unless xml_node.respond_to?(:namespace)\n\n return xml_node.namespace.to_s == ns || ns == '*'\n end", "def validate_namespace\n return unless namespace = @project&.kubernetes_namespace&.name\n\n namespaces = []\n @elements.each { |e| namespaces << e.dig(:metadata, :namespace) if e[:metadata].key?(:namespace) }\n namespaces.uniq!\n return if namespaces.empty? || namespaces == [namespace]\n\n @errors << \"Only use configured namespace #{namespace.inspect}, not #{namespaces.inspect}\"\n end", "def namespace_exists?(name, context = T.unsafe(nil)); end", "def namespace_still_defined?(namespace)\n parent = Object\n outer_namespace_parts = []\n namespace.to_s.split(\"::\").each do |part|\n return false unless parent.const_defined?(part)\n\n outer_namespace_parts.push(part)\n parent = outer_namespace_parts.join(\"::\").constantize\n end\n true\n end", "def namespace?(x)\n if x.namespace && x.namespace.prefix\n self.class.namespace?(x.namespace.prefix)\n else\n true\n end\n end", "def period_in_ns?\n !@period_in_ns.nil?\n end", "def valid_namespace?(ns)\n return true if [String, Symbol, NilClass].include?(ns.class)\n return false unless ns.is_a?(Array)\n\n # check array for invalid objects\n return false if ns.select(&:blank?).present?\n return false if ns.select{|o| ![String, Symbol].include?(o.class)}.present?\n\n return true\n end", "def validates?\n doc = Nokogiri::XML(File.read(@filename))\n\n schema_version = PROIEL::PROIELXML::Schema.check_schema_version_of_xml_file(@filename)\n\n schema = PROIEL::PROIELXML::Schema.load_proiel_xml_schema(schema_version)\n r = schema.validate(doc)\n\n if r.empty?\n true\n else\n @errors += r.map { |e| \"Line #{e.line}: #{e.message}\" }\n\n false\n end\n end", "def namespace_removable?(namespace, parts, parent)\n parent.const_defined?(parts.last) && namespace.defined_by_temping?\n rescue NoMethodError\n false\n end", "def namespace?(namespace)\n @namespaces.keys.include? namespace\n end", "def has_rop?(rop_name)\n File.exist?(File.join(@base_path, \"#{rop_name}.xml\"))\n end", "def ensure_absolute_namespace namespace\n namespace.start_with?(\"::\") ? namespace : \"::#{namespace}\"\n end", "def wellformed?\n Nokogiri::XML(File.read(@filename)) { |config| config.strict }\n\n true\n rescue Nokogiri::XML::SyntaxError => _\n @errors << 'XML file is not wellformed'\n\n false\n end", "def unattend_exists?(xml_path)\n x = session.fs.file.stat(xml_path) rescue nil\n return !!x\n end", "def schema_compliant?\n \n xml_files = Dir.glob(File.join(package_path, 'rxp-*.xml'))\n xml_files.each do |file|\n \n # FIXME: Ignore empty rights file for now to pass validation\n unless file == File.join(package_path, 'rxp-rights.xml')\n # java code\n jfile = JFILE.new file\n jchecker = VALIDATOR.validate jfile\n \n # formedness errors\n (0...jchecker.getFatals.size).each do |n|\n f = jchecker.getFatals.elementAt(n)\n msg = \"File: #{file}, Line: #{f.getLineNumber}, \" +\n \"Column #{f.getColumnNumber}: \" + f.getMessage\n errors.add :schema, msg\n end\n \n # validation errors\n (0...jchecker.getErrors.size).each do |n|\n e = jchecker.getErrors.elementAt(n)\n msg = \"File: #{file}, Line: #{e.getLineNumber}, \" +\n \"Column #{e.getColumnNumber}: \" + e.getMessage\n errors.add :schema, msg\n end\n end \n end\n errors.on(:schema).nil?\n \n end", "def namespace_module?\n return false if exp.type == :casgn\n contents = exp.children.last\n contents && contents.find_nodes([:def, :defs], [:casgn, :class, :module]).empty?\n end", "def assertNamespace(fullName)\n ns, base = DataMetaDom::splitNameSpace(fullName)\n [DataMetaDom.validNs?(ns, base) ? ns : '', base]\n end", "def assertNamespace(fullName)\n ns, base = DataMetaDom::splitNameSpace(fullName)\n [DataMetaDom.validNs?(ns, base) ? ns : '', base]\n end", "def check_xml(filename)\n # TODO verursacht bei rule2 ein problem\n document = LibXML::XML::Document.file(filename)\n schema = LibXML::XML::Schema.new(@fits_xsd)\n result = document.validate_schema(schema) do |message,flag|\n puts \"!!! error found: #{message}\"\n exit\n end\nend", "def parsingNamespace \n \"parsingNamespace\" \n end", "def cleanup_namespaces\n namespaces.reject! { |namespace| namespace['prefix'].blank? || namespace['uri'].blank? } if namespaces.present?\n end", "def ensure_dc_namespace_exists!\n unless ng_xml.namespaces.key? 'xmlns:dc'\n ng_xml.root.add_namespace_definition('dc', DC_ELEMENTS)\n end\n end", "def personal_namespace?(namespace)\n return false unless User.find_by(namespace: namespace)\n\n @error = \"Cannot remove personal namespace\"\n true\n end", "def private_namespaces?\n owned_namespaces?.reject {|key,value| value.shareMode!=:Private}\n end", "def include?(my_namespace)\n namespace_names.include?(my_namespace)\n end", "def xmlns\n {\n 'xs' => 'http://www.w3.org/2001/XMLSchema',\n 'ncs' => 'http://www.nationalchildrensstudy.gov',\n 'ncsdoc' => 'http://www.nationalchildrensstudy.gov/doc'\n }\n end", "def xmlns\n {\n 'xs' => 'http://www.w3.org/2001/XMLSchema',\n 'ncs' => 'http://www.nationalchildrensstudy.gov',\n 'ncsdoc' => 'http://www.nationalchildrensstudy.gov/doc'\n }\n end", "def has_xmldecl?\n children.each {|c| return true if c.xmldecl? }\n false\n end", "def hidden_namespaces; end", "def namespaces; end", "def namespaces; end", "def namespaces; end", "def namespaces; end", "def valid_filename(filename, prefix)\n return false if filename == nil\n\n match = filename.match(/[\\w.\\- ]+\\.xml/)\n if match == nil || match.to_s != filename\n return false\n end\n\n if prefix != nil\n if !filename.start_with?(prefix + \"-\")\n return false\n end\n end\n true\n end", "def required?\n !!if self.namespace\n self.find_first 'ns:required', :ns => self.namespace.href\n else\n self.find_first 'required'\n end\n end", "def validate(input_file)\n \n # open(input_file).read().match(/xsi:schemaLocation=\"[^\"]*(http[^\"]*)\"/)\n # \n # require 'net/http'\n # \n # uri = URI($1)\n # xsd_file = Net::HTTP.get(uri)\n # \n # xsd = Nokogiri::XML::Schema(xsd_file)\n # doc = Nokogiri::XML(File.read(input_file))\n # \n # xsd.validate(doc).each do |error|\n # end\n \n end", "def valid?\n @xml.xpath('//weather/problem_cause').size == 0\n end", "def validate_presence_of_paragraph_style(kd_el, xml_node)\n if 'ParagraphStyle/$ID/[No paragraph style]' == xml_node['AppliedParagraphStyle']\n @validation_errors << ::Repositext::Validation::Reportable.error(\n {\n filename: @validation_file_descriptor,\n line: xml_node.line,\n context: sprintf(\"story %5s\", story_name_for_xml_node(xml_node)),\n },\n [\n 'Invalid paragraph style',\n \"'ParagraphStyle/$ID/[No paragraph style]'\"\n ]\n )\n end\n end", "def namespaced_property?(name)\n respond_to?(:namespace) && name =~ /^(.+)__(.+)$/\n end", "def xmldecl?\n @contents[0] == :xmldecl\n end", "def valid?\n prefix = File.expand_path(root_path)\n prefix == File.expand_path(@file)[0...prefix.size]\n end", "def is_xml_valid?(xml_text)\n return true #FIXME\n end", "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 validate_xml f\n\n # make a document builder\n factory = javax.xml.parsers.DocumentBuilderFactory.newInstance\n factory.setNamespaceAware true\n factory.setAttribute \"http://xml.org/sax/features/validation\", true\n factory.setAttribute \"http://apache.org/xml/features/validation/schema\", true\n factory.setAttribute \"http://apache.org/xml/features/validation/schema-full-checking\", true\n factory.setAttribute \"http://apache.org/xml/features/nonvalidating/load-external-dtd\", true\n builder = factory.newDocumentBuilder\n\n # parse the xml to get any errors\n checker = Checker.new\n builder.setErrorHandler checker\n builder.parse f\n checker.results\n end", "def ns?(name)\n sub = registry[name.to_sym]\n ArtifactNamespace === sub\n end", "def verified_namespace?(hash, expected_name)\n hash.respond_to?(:has_key?) && hash.has_key?(expected_name.to_s)\n end", "def collection?\n if @xml_document\n validity = true\n missing = {}\n @proof.collections.each do |collection, locator_array|\n missing[collection] = locator_array.dup\n locator_array.each do |locator|\n namespace = locator[0]\n xpath = locator[1]\n REXML::XPath.each(@xml_document, xpath) do |element_or_attribute|\n missing[collection].delete([namespace, xpath]) if element_or_attribute.inherited_namespace == namespace\n end\n end\n end\n missing.each do |collection, locator_array|\n if not locator_array.empty?\n validity = false\n error = \"COLLECTION #{collection}\"\n @errors << [locator_array[0][0], locator_array[0][1], error]\n end\n end\n return validity\n else\n raise \"no XML document provided to validate collections against\"\n end\n end", "def fpCheck(fpXmlFile=\"./xpath_webapps.xml\",xmlXsdPath)\n\t@fpXmlFile = fpXmlFile\n\t@xmlXsdPath = xmlXsdPath\n\n\tif File.exists?(@fpXmlFile) # => @fpXmlFile = true\n\t\tbegin\n\t\t\tvalidate(@fpXmlFile, @xmlXsdPath, 'container').each do |error|\n\t\t\t\tputs error.message\n\t\t\tend\n\t\tend\n\telse\n\t\tputs \"\\n**\tThe #{@fpXmlFile} file is missing and the finger print description may not be validated\\n\\n\"\n\tend\nend", "def test_namespaces\n with_feed(:from_file => 'wellformed/rss/rss_namespace_1.xml') { |feed|\n assert_equal(\"Example description\", feed.description)\n assert_equal(nil, feed.title)\n }\n with_feed(:from_file => 'wellformed/rss/rss_namespace_2.xml') { |feed|\n assert_equal(\"Example description\", feed.description)\n assert_equal(nil, feed.title)\n }\n with_feed(:from_file => 'wellformed/rss/rss_namespace_3.xml') { |feed|\n assert_equal(\"Example description\", feed.description)\n assert_equal(nil, feed.title)\n }\n with_feed(:from_file => 'wellformed/rss/rss_namespace_4.xml') { |feed|\n assert_equal(\"Example description\", feed.description)\n assert_equal(nil, feed.title)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_090.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(0.9, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_091_netscape.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(0.91, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_091_userland.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(0.91, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_092.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(0.92, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_093.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(0.93, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_094.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(0.94, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_20.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(2.0, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_201.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(2.0, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_21.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(2.0, feed.feed_version)\n }\n with_feed(:from_file => 'wellformed/rss/rss_version_missing.xml') { |feed|\n assert_equal(\"rss\", feed.feed_type)\n assert_equal(nil, feed.feed_version)\n }\n end", "def test_xmls?\n repository.application.service_library? ||\n !test_persistence_file_content_fragments.empty?||\n !test_persistence_file_fragments.empty? ||\n !test_artifact_fragments.empty? ||\n !test_orm_file_fragments.empty?\n end", "def validate_schema\n \n # open(\"http://www.sat.gob.mx/cfd/3/cfdv32.xsd\")\n \n #puts \"KEYS: \" + doc.root.keys.to_s\n #puts \"Schema: \" + doc.root[\"xsi:schemaLocation\"]\n #puts doc.xpath(\"//*[@xsi:schemaLocation]\")\n #puts doc.collect_namespaces\n # Hash[ doc.root[\"xsi:schemaLocation\"].scan(/(\\S+)\\s+(\\S+)/) ]\n \n schema_final = \"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' elementFormDefault='qualified' attributeFormDefault='unqualified'>\"\n @doc.xpath(\"//*[@xsi:schemaLocation]\").each do |element|\n \n \t schemata_by_ns = Hash[ element[\"xsi:schemaLocation\"].scan(/(\\S+)\\s+(\\S+)/) ]\n\n \t schemata_by_ns.each do |ns,xsd_uri|\n \t xsd = Nokogiri::XML::Schema(open(xsd_uri))\n \t #puts \"NS: #{ns} --- URI: #{xsd_uri}\"\n \t #puts \"VALID: \" + xsd.valid?(doc).to_s\n \t schema_final += \"<xs:import namespace='#{ns}' schemaLocation='#{xsd_uri}'/>\"\n\n \t end\n\n end\n schema_final += \"</xs:schema>\"\n #puts \"SCHEMA FINAL: \" + schema_final\n schema2 = Nokogiri::XML::Schema.new(schema_final)\n \n #puts \">>>>> VALID? \" + schema2.valid?(doc).to_s\n #schema2.validate(doc).each do |error|\n # puts error.message\n #end\n \n if schema2.valid?(doc) == true\n \treturn true\n else\n \treturn schema2.validate(doc)\n end\n \n end", "def qualify?(options)\n options[:element_form_default] == :qualified && options[:namespace]\n end", "def apply_needed?(existing_namespace, manifest)\n return true unless existing_namespace\n [[:metadata, :annotations], [:metadata, :labels]].any? do |path|\n actual = existing_namespace.dig(*path) || {}\n expected = manifest.dig(*path) || (next false)\n !(expected <= actual) # rubocop:disable Style/InverseMethods\n end\n end", "def check_validate_epex(file_epex)\n doc = Docx::Document.open(file_epex.to_s)\n if doc.paragraphs[8].text[-10..-1] != \"#{$day}/#{$month}/#{$year}\"\n @errore << \"La data all'interno del file #{file_epex.to_s} non coincide con la data selezionata\"\n end\n end", "def load_namespaces\n\t\t\tnamespace_instructions = []\n\t\t\tns_pi = self.find_all { |i| i.is_a? REXML::Instruction and i.target == 'xml:ns' }\n\t\t\tns_pi.each do |i|\n\t\t\t\tif i.attributes.has_key?('name')\n i.attributes['prefix'] = i.attributes['name']\n elsif i.attributes.has_key?('prefix')\n i.attributes['name'] = i.attributes['prefix']\n else\n raise \"parse error namespace instruction missing required name or prefix attribute.\"\n end\n if i.attributes.has_key?('space')\n i.attributes['uri'] = i.attributes['space']\n elsif i.attributes.has_key?('uri')\n i.attributes['space'] = i.attributes['uri']\n else\n\t\t\t\t\traise \"parse error namespace instruction missing required space or uri attribute.\"\n\t\t\t\tend\n namespace_instructions << i\n\t\t\tend\n\t\t\treturn namespace_instructions\n\t\tend", "def global_index_namespace?\n false\n end", "def valid_xml?(file_name, schema)\n # Do the appropriate validation based on the file type\n return validate_against_xsd(file_name, schema) if schema.downcase.ends_with?('.xsd')\n\n validate_against_dtd(file_name, schema)\n end", "def userns_enabled?\n return false if cmd_exec('cat /proc/sys/user/max_user_namespaces').to_s.strip.eql? '0'\n return false if cmd_exec('cat /proc/sys/kernel/unprivileged_userns_clone').to_s.strip.eql? '0'\n true\n rescue\n raise 'Could not determine userns status'\n end", "def namespaces?\n [email protected](\"account\",\"namespaces\")\n if(t_namespaces[\"status\"].to_sym == :success)\n out={}\n t_namespaces[\"namespaces\"].each do |namespace|\n nm=Namespace.new(@linker,namespace[\"name\"],namespace[\"size\"],namespace[\"share_mode\"].to_sym,namespace[\"owner\"])\n out[nm.name]=nm\n end\n return out\n else\n return {}\n end\n end", "def netcore?\n ! @proj_xml_node.css('Project').attr('Sdk').nil?\n end", "def valid?\n build_xml\n\n validation = RelaxNGSchema.instance.validate(@xml.document)\n if validation.empty?\n true\n else\n logger.error validation.map(&:message).join(\"\\n\")\n logger.debug @xml.to_s\n false\n end\n end", "def node_ns_definition(node, ns)\n prefix = ns.is_a?(Nokogiri::XML::Namespace) ? ns.prefix : ns\n node.namespace_definitions.find { |n| n.prefix == prefix }\n end", "def assertNamespace(name)\n ns, base = DataMetaDom.splitNameSpace(name)\n scalaPackage = DataMetaDom.validNs?(ns, base) ? ns : ''\n packagePath = scalaPackage.empty? ? '' : scalaPackage.gsub('.', File::SEPARATOR)\n\n [scalaPackage, base, packagePath]\n end", "def exists?\n info(\"Checking policy for #{resource[:name]}...\")\n @kernel_version_major = Facter.kernelmajversion.to_i\n # Normalize the XML content by removing any whitespace fore and aft\n @policy = policy.split(\"\\n\").collect { |line| line.strip }.join(\"\\n\")\n @config = mcxexport.split(\"\\n\").collect { |line| line.strip }.join(\"\\n\")\n return false unless @config.eql?(@policy)\n true\n end", "def application_xmls?\n !repository.application.service_library? && !repository.application.standalone_model_library?\n end", "def is_complete?\n # puts @xml.root.attributes['complete']\n xml = Document.new(File.open(@xmlfile))\n return 'yes' == xml.root.attributes['complete']\n end", "def check\n prefix = File.basename(@file)\n if File.exist?(@file)\n @message = \"#{prefix} : Expected file exists\"\n true\n else\n @message = \"#{prefix} : Expected file not found.\"\n false\n end\n end", "def validate\n @schema ||= Dir.chdir(File.dirname(__FILE__) + \"/schemas\") { Nokogiri::XML::Schema(File.read('akomantoso20.xsd')) }\n @schema.validate(@doc)\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 allowed?(payload)\n !!determine_namespace(payload)\n end", "def conflicting_ci_namespace_requested?(namespace_record)\n build.expanded_kubernetes_namespace.present? &&\n namespace_record.namespace != build.expanded_kubernetes_namespace\n end", "def valid?\n !( @definition.nil? && @uri.nil? )\n end", "def valid_xml?(xml)\n create_document(xml) != nil\nend", "def get_xml_of_type( asdcp_type, file )\n begin\n xml = Nokogiri::XML( open file )\n rescue Exception => e\n @logger.info \"#{ file }: #{ e.message }\"\n return FALSE\n end\n unless xml.errors.empty?\n xml.errors.each do |error|\n # expected errors from non-xml\n next if error.message =~ /Start tag expected/ or error.message =~ /Document is empty/\n @logger.info \"Syntax error: #{ file }: #{ error }\"\n end\n return FALSE\n end\n\n case xml.root.node_name\n when asdcp_type\n return xml\n else\n return FALSE\n end\nend", "def namespaces\n @namespaces ||= {\n wse: Akami::WSSE::WSE_NAMESPACE,\n ds: 'http://www.w3.org/2000/09/xmldsig#',\n wsu: Akami::WSSE::WSU_NAMESPACE,\n }\n end", "def namespaces\n @namespaces ||= {\n wse: Akami::WSSE::WSE_NAMESPACE,\n ds: 'http://www.w3.org/2000/09/xmldsig#',\n wsu: Akami::WSSE::WSU_NAMESPACE,\n }\n end", "def validation_hook_during_parsing(kd_el, xml_node)\n case xml_node.name\n when 'ParagraphStyleRange'\n validate_presence_of_paragraph_style(kd_el, xml_node)\n when 'CharacterStyleRange'\n validate_presence_of_character_style(kd_el, xml_node)\n else\n puts \"Unknown name: #{ xml_node.name}\"\n end\n log_removal_of_element(kd_el, xml_node)\n end", "def test_getAttributeNodeNS01\n namespaceURI = \"http://www.nist.gov\";\n localName = \"invalidlocalname\";\n doc = nil\n elementList = nil\n testAddr = nil\n attribute = nil\n doc = load_document(\"staffNS\", false)\n elementList = doc.getElementsByTagName(\"emp:address\")\n testAddr = elementList.item(0)\n assert_not_nil(testAddr, \"empAddrNotNull\")\n attribute = testAddr.getAttributeNodeNS(namespaceURI, localName)\n assert_nil(attribute, \"throw_Null\")\n \n end", "def xml_fragment_should_validate_against_schema(xml, schema_name, xmlns={})\n xml = xml.is_a?(String) ? xml : xml.to_s\n doc = Nokogiri::XML(xml)\n doc.root.send(:[]=, *xmlns.first)\n xml_data_should_validate_against_schema(doc, schema_name)\n end", "def package_namespaces\n namespaces = [EPUB2_NAMESPACES]\n namespaces << EPUB3_NAMESPACES if @target.epub_version >= 3\n namespaces << IBOOKS_NAMESPACES if @target.epub_version >= 3 && @target.ibooks?\n namespaces.reduce(:merge)\n end", "def amd_with_template_namespace\n @amd_with_template_namespace || false\n end", "def notationdecl?\n @contents[0] == :notationdecl\n end", "def test_not_defined_as_namespace\n N::URI.shortcut(:not_namespace, \"http://iamnotanamespace/\")\n assert_equal(nil, N::URI.new(\"http://iamnotanamespace/\").namespace)\n end", "def xml_ns\r\n { \"rdf\" => \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\",\r\n \"rss\" => \"http://purl.org/rss/1.0/\",\r\n \"prism\"=>\"http://prismstandard.org/namespaces/1.2/basic/\",\r\n \"dc\"=>\"http://purl.org/dc/elements/1.1/\",\r\n \"mn\"=>\"http://usefulinc.com/rss/manifest/\",\r\n \"content\"=>\"http://purl.org/rss/1.0/modules/content/\"\r\n }\r\n end", "def isxml?(xml)\n xml.lstrip.start_with?('<')\n end", "def fix_namespaces(doc)\n if is_jruby?\n # Only needed in jruby, nokogiri's jruby implementation isn't weird\n # around namespaces in exactly the same way as MRI. We need to keep\n # track of the namespaces in outer contexts ourselves, and then see\n # if they are needed ourselves. :(\n namespaces = namespaces_stack.compact.reduce({}, :merge)\n default_ns = namespaces.delete(\"xmlns\")\n\n namespaces.each_pair do |attrib, uri|\n ns_prefix = attrib.sub(/\\Axmlns:/, '')\n\n # gotta make sure it's actually used in the doc to not add it\n # unecessarily. GAH.\n if doc.xpath(\"//*[starts-with(name(), '#{ns_prefix}:')][1]\").empty? &&\n doc.xpath(\"//@*[starts-with(name(), '#{ns_prefix}:')][1]\").empty?\n next\n end\n doc.root.add_namespace_definition(ns_prefix, uri)\n end\n\n if default_ns\n doc.root.default_namespace = default_ns\n # OMG nokogiri, really?\n default_ns = doc.root.namespace\n doc.xpath(\"//*[namespace-uri()='']\").each do |node|\n node.namespace = default_ns\n end\n end\n\n end\n return doc\n end", "def schematron_compliant?\n \n rxp = File.join(package_path, 'rxp.xml')\n results = stron_validate(rxp, RXP_STRON)\n \n # rxp rights, skip an empty rights file\n rights = File.join(package_path, 'rxp-rights.xml') \n if File.exist?(rights) and not(File.zero?(rights))\n results |= stron_validate(rights, RXP_RIGHTS)\n end\n \n # rxp provenance\n prov = File.join(package_path, 'rxp-digiprov.xml')\n results |= stron_validate(prov, RXP_DIGIPROV_STRON)\n \n # representations and representation provenance\n reps = Dir.glob(File.join(package_path, 'rxp-rep-*.xml'))\n rep_prov = reps.select { |f| f =~ /digiprov\\.xml/ }\n reps.reject! { |f| f =~ /digiprov\\.xml/ }\n \n reps.each { |rep| results |= stron_validate(rep, REP_STRON) }\n rep_prov.each { |rp| results |= stron_validate(rp, REP_DIGIPROV_STRON) }\n \n results.each { |e| errors.add :schematron, \"Line \" + e[:line].to_s + ':' + e[:message] }\n errors.on(:schematron).nil?\n end", "def namespace_declarations(ctx); end", "def namespace_declarations(ctx); end", "def validate!\n unless File.exist?(path)\n raise NoPackageFile.new(path)\n end\n\n unless File.exist?(metadata.path)\n raise NoPackageMetadataFile.new(metadata.path)\n end\n\n true\n end", "def element_exists(document,element_name,lang)\n xpath = REXML::XPath\n xpath.first(document, \"//metadata[@name='#{element_name}'][@xml:lang='#{lang}']\") != nil\nend", "def global_namespace_cannot_be_private\n if global? && visibility_private?\n errors.add(:visibility, \"global namespace cannot be private\")\n return false\n end\n true\n end", "def narration_present?\n content_types_xml = nil\n pres_doc = @files.file.open '[Content_Types].xml' rescue nil\n content_types_xml = Nokogiri::XML::Document.parse(pres_doc) if pres_doc\n content = content_types_xml.xpath('//@Extension')\n if content.to_s.include?('m4a')\n @type = 'm4a'\n @narration = true\n end\n if content.to_s.include?('wav')\n @type = 'wav'\n @narration = true\n end\n end", "def is_valid_type?(namespace_prefix, template_name = \"default\")\n get_child_types(namespace_prefix).each do\n |template|\n return true if template.template.to_s.strip == template_name.strip && !template.hidden\n end\n false\n end" ]
[ "0.6545117", "0.648211", "0.6339166", "0.619855", "0.6112893", "0.60282046", "0.6005299", "0.599883", "0.59535015", "0.5848154", "0.5816137", "0.57943016", "0.57752913", "0.57722217", "0.5729719", "0.5725884", "0.56560165", "0.5650701", "0.5600112", "0.5592591", "0.55850565", "0.55668133", "0.5540814", "0.5540814", "0.5518429", "0.54970664", "0.5490101", "0.54770803", "0.54748535", "0.54603183", "0.54570127", "0.5410579", "0.5410579", "0.5338349", "0.5333217", "0.53328824", "0.53328824", "0.53328824", "0.53328824", "0.5315211", "0.53094596", "0.5290719", "0.5267242", "0.524579", "0.5235689", "0.52315575", "0.5224085", "0.5217204", "0.52045435", "0.52022403", "0.5201314", "0.51881653", "0.5174947", "0.5166211", "0.51641023", "0.5153511", "0.514506", "0.513794", "0.5125241", "0.5098008", "0.5095728", "0.5093046", "0.50914586", "0.5074211", "0.5069012", "0.505499", "0.50504", "0.5045992", "0.5040583", "0.5039596", "0.50388384", "0.50289494", "0.5008331", "0.4994385", "0.49890572", "0.49850821", "0.49788725", "0.4974599", "0.4971576", "0.4964265", "0.49627542", "0.49627542", "0.495672", "0.4950795", "0.49494353", "0.49464697", "0.4943145", "0.49390402", "0.49261305", "0.49254814", "0.49205345", "0.4915574", "0.48940632", "0.48900977", "0.48900977", "0.48817003", "0.48773772", "0.4874882", "0.48660254", "0.48554996" ]
0.68506736
0
Finds all peptide locations and puts them in an array in the format: [[peptide, protein, start, end]]
def findAllPepLocations hits = @doc.xpath("//#{@xmlns}search_hit") all = [] @locations = [] i = 0 # Parses out each peptide and protein hits.each do |hit| all << [hit.xpath("./@peptide").to_s, proteinID(hit.xpath("./@protein").to_s)] i += 1 end all.uniq! dataHash = Hash.new Ms::Fasta.foreach(@database) do |entry| @sequences += 1 pID = proteinID(entry.header) dataHash[pID] = entry.sequence @proteinIndices << pID end all.each do |set| if dataHash[set[1]] != nil startVal = dataHash[set[1]].scan_i(set[0])[0] if startVal != nil @locations << [set[0], set[1], startVal + 1, startVal + set[0].length] end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attach_npc_positions_to_path_arrays\n paths = find_each_path_rectangle\n\n iterate_over_each_character_in_array_of_lines(@map_in_lines) do |y, x|\n c = @map_in_lines[y][x]\n\n next if c == '.' or c == 'p'\n\n if c == 'N'\n paths.each do |e|\n if y >= e[0][0] and y <= e[1][0]\n if x >= e[0][1] and x <= e[1][1]\n e.push([y, x])\n end\n end\n end\n end\n end\n\n @paths = paths\n end", "def locations\n unless defined?(@locations)\n @locations=[]\n for loc in Location.order(\"id ASC\").includes(:bottom_right_coordinate, :top_left_coordinate)\n @locations << loc if do_overlap_with?(loc.area)\n end \n end \n @locations\n end", "def get_points_for(trip)\n points = Array.new\n trip.destinations.each do |d|\n if d.has_location?\n points << LatLonPoint.new([d.location.lat, d.location.lng])\n end\n end\n points\n end", "def coords\n coord_list = []\n (@x..(@x + @size_x - 1)).each do |i|\n (@y..(@y + @size_y - 1)).each do |j|\n coord = [i, j]\n coord_list << coord\n end\n end\n\n return coord_list\n end", "def map_locs\n itineraries.collect(&:location)\n end", "def to_a\r\n @locs.dup\r\n end", "def locations\n\t\t[]\n\tend", "def get_addresses apts\n return apts.map { |apt| apt.address }\n end", "def map_locs\n [location]\n end", "def map_locs\n [location]\n end", "def locations\n self.veterinarians.pluck(:name, :location).map {|x| x.join(\" \")}\n end", "def coordinates\n arr = []\n (0...@size).each do |row|\n (0...@size).each do |column|\n arr << Coordinate.new(x: row,y: column)\n end\n end\n arr\n end", "def peptides\n\t\[email protected](\"//#{MZID_NS_PREFIX}:PeptideHypothesis\",\"#{MZID_NS_PREFIX}:#{MZID_NS}\")\n\tend", "def get_favorite_locations_array\n favorite_locations = StartLocation.all.select do |start_location|\n start_location.favorite == true\n end.map {|favorite_location| favorite_location.name }\n\n EndLocation.all.select do |end_location|\n favorite_locations << end_location.name if end_location.favorite == true\n end\n favorite_locations.uniq\nend", "def find_all_paths\n found_paths = []\n \n explore(found_paths, nil, @start_node)\n \n found_paths\n end", "def coordinates\n coordinates = Array.new\n \n coordinates.push self.lat\n coordinates.push self.lng\n \n return coordinates\n end", "def locate_pins(location); end", "def positions(passes) = passes.map { find_position(_1) }", "def to_array\n @points.collect { |p| [p.x, p.y] }\n end", "def parse_positions(line)\n positions = bracket_positions(line)\n positions.flatten\n end", "def coordinate_array\n\t\t[latitude,longitude]\n\tend", "def get_geoloc(ip)\n\t\trec = self.get_all ip\n\t\treturn [rec.longitude,rec.latitude]\n\tend", "def sliced_pids(pids)\n pids.each_slice(100).to_a\n end", "def locations\n return @locations\n end", "def locations\n return @locations\n end", "def to_marker_arr(array)\n [array[0].marker, array[1].marker, array[2].marker]\n end", "def get_princess_position(grid_size)\n princess_position = nil\n grid = Array.new(grid_size)\n (0...grid_size).each do |i|\n grid_row = gets.split\n princess_position = [i, grid_row.index('p')] if grid_row.include? 'p'\n grid[i] = grid_row\n end\n princess_position\nend", "def get_locations\n\n spaces_with_players = []\n @spaces.each do |space|\n if !space.is_empty\n spaces_with_players.push(space)\n end\n end\n return spaces_with_players\n end", "def get_lots_coordinates\n xml = get_lots\n coords = xml.xpath '/ArrayOflot/lot/latitude | /ArrayOflot/lot/longitude'\n coords.each_slice(2).to_a.map { |p| [p[0].text, p[1].text] }\n end", "def employees\n employee_array = []\n locations.each do |location|\n location.employees.each do |employee|\n employee_array << employee\n end\n end\n employee_array\n end", "def mine_locations\n mine_array = []\n until mine_array.length == 9\n row = (0..9).to_a.sample\n column = (0..9).to_a.sample\n unless mine_array.include?([row,column])\n mine_array << [row, column]\n end\n end\n mine_array\n end", "def get_braille_arrays\n string = braille_to_string\n lines = string.scan(/.{1,80}/)\n pairs = lines.map do |string|\n string.scan(/../)\n end\n end", "def coordinates\n [@y_location, @x_location]\n end", "def all_indexes\n\t\tindex_list = []\n\t\tfor y_index in 0..7\n\t\t\tfor x_index in 0..7\n\t\t\t\tindex_list << [y_index, x_index]\n\t\t\tend\n\t\tend\n\t\tindex_list\n\tend", "def locations\n locations_res.data.locations.map {|loc| location_res_to_map(loc)}\n end", "def mineLocation field\n location=[]\n field.each_with_index do |row,index|\n if row.include?(1)\n location << index\n row.each_with_index do |col, idx|\n if col==1\n location << idx\n end\n end\n end\n end\n return location\nend", "def waypoint_list\n return [] unless self.geo and self.geo.waypoints\n self.geo.waypoints.collect { |waypoint| [waypoint.lat, waypoint.lon] }\n end", "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 getFtsLoc\n location = ARGV[1]\n loc = location.split(\"..\")\n @gb.each_cds do |ft|\n ftH = ft.to_hash\n ftloc = ft.locations\n if ftloc[0].from == loc[0].to_i && ftloc[0].to == loc[1].to_i\n gene = []\n product = []\n gene = ftH[\"gene\"] if !ftH[\"gene\"].nil?\n product = ftH[\"product\"] if !ftH[\"product\"].nil?\n loc = \"c#{location}\" if ftloc[0].strand == -1\n dna = getDna(ft,@gb.to_biosequence)\n seqout = dna.output_fasta(\"#{@accession}|#{loc}|#{ftH[\"protein_id\"][0]}|#{gene[0]}|#{product[0]}|#{@org}\",60)\n puts seqout\n end\n end\nend", "def getLocations\n # create locations table\n locations = Array.new\n \n # turn page into Nokogiri object\n parsed_page = Nokogiri::HTML(@page)\n\n # get table of drop info from page\n locations = parsed_page.css(\"#mw-content-text\").css(\"ul\").css(\"li\").css(\"a\").children.map { |r| r.text }\n\n # prints table for debugging\n# puts(\"table = #{locations}\")\n\n # save locations globally\n @locations = locations\n end", "def king_positions\n king_locations = []\n @@piece_locations.each do |piece, details|\n if details[\"type\"] == \"king\"\n king_locations << piece\n end\n end\n return king_locations\n end", "def sections\n (1..section_size).inject([]) do |array, row_offset|\n (1..section_size).inject(array) do |array, column_offset|\n array << section_coordinates(row_offset - 1, column_offset - 1)\n end\n end\n end", "def coordinates\n [latitude, longitude]\n end", "def x_points\n points = [[], []]\n (0...height).each do |y|\n (0...width).each do |x|\n if (array[y][x]).nonzero? && (x - 1 < 0 || (array[y][x - 1]).zero?)\n points[0] << Point.new(x - 1, y) + @position\n end\n\n if (array[y][x]).nonzero? && (x + 1 >= length || (array[y][x + 1]).zero?)\n points[1] << Point.new(x + 1, y) + @position\n end\n end\n end\n\n points\n end", "def get_peptides_for_protein(protein_node)\n\t\tself.find(protein_node,\"PeptideHypothesis\")\n\tend", "def locations\n @locations ||= Array(@grpc.locations).map do |l|\n Location.from_grpc l.lat_lng\n end\n end", "def locations; end", "def to_a\n [lat,lng]\n end", "def expand_peptides(peptides)\n amh = amino_acid_mass_hash()\n exp_pep = []\n if peptides.empty?\n return amh.keys\n else \n peptides.each do |pep|\n amh.keys.each do |aa|\n exp_pep << (pep + aa)\n end\n end\n end \n return exp_pep\n end", "def get_locationsCurrent(par)\n locationsCurrent = []\n par.each do |key, value|\n if value === 'current' \n loc = key[0..-9]\n locationsCurrent.push(loc)\n end\n end\n return locationsCurrent\n end", "def getFtsLoc\n location = ARGV[1]\n loc = location.split(\"..\")\n protId = \"\"\n @gbkObj.each_cds do |ft|\n ftH = ft.to_hash\n ftloc = ft.locations\n if ftloc[0].from == loc[0].to_i && ftloc[0].to == loc[1].to_i\n gene = []\n product = []\n gene = ftH[\"gene\"] if !ftH[\"gene\"].nil?\n product = ftH[\"product\"] if !ftH[\"product\"].nil?\n protId = ftH[\"protein_id\"][0] if !ftH[\"protein_id\"].nil?\n location = \"c#{location}\" if ftloc[0].strand == -1\n dna = getDna(ft,@gbkObj.to_biosequence)\n seqout = dna.output_fasta(\"#{@accession}|#{location}|#{protId}|#{gene[0]}|#{product[0]}\",60)\n puts seqout\n end\n end\n end", "def array_paragraphs fragments\n [fragments]\n end", "def mineLocation field\n coords = []\n field.each_index do | i |\n field[i].each_index do | j |\n if field[i][j] == 1\n coords << i\n coords << j\n end\n end\n end\n coords\nend", "def locations\n @locations = Location.where(fragment: @scenario.fragments).order(:id).page params[:page]\n end", "def start_coords\n marker_coords('S')\n end", "def proteinlist\n\n end", "def get_arrays(line)\n pairs = line.chomp.split(',')\n arrys = pairs.map do |range|\n indeces = range.split('-').map(&:to_i)\n (indeces.first..indeces.last).to_a\n end\nend", "def get_locationsAdded(par)\n locationsAdded = []\n par.each do |key, value|\n if value === 'on' \n locationsAdded.push(key)\n end\n end\n return locationsAdded\n end", "def positions_of_agents\n positions = []\n @figures.each {|f| positions << f.position}\n positions.shift\n positions\n end", "def get_locations(lines, filename, params)\n positions = Hash.new\n missing_pos = Array.new\n first = true\n\t\n\tif(params[:has_positions])\n\t\tlines.each do |line|\n\t\t\tif first\n\t\t\t\tfirst = false\n\t\t\t\tnext\n\t\t\tend\n\t\t\tdata = strip_and_split(line)\n\t\t\tsnpid = data[@snpid]\n\t\t\tif data[@location] =~ /\\d/\n\t\t\t\tpositions[snpid] = Hash.new\n\t\t\t\tpositions[snpid]['chr'] = data[@chromnum]\n\t\t\t\tpositions[snpid]['chr'] =~ /(\\d+)/ or positions[snpid]['chr'] =~ /(\\w+)/\n\t\t\t\tpositions[snpid]['chr'] = $1\n\t\t\t\tpositions[snpid]['pos'] = data[@location]\n\t\t\telsif data[@snpid] =~ /\\w/\n\t\t\t\t# missing so will try to get information from database\n\t\t\t\tmissing_pos << snpid\n\t\t\tend\n\t\tend\n\n\t\t# if any missing try database for location if have mysql support\n\t\tif @@mysql_support and !missing_pos.empty?\n\t\t\tfinder = SNPpos.new\n\t\t\tsnpsinfo = finder.get_pos(missing_pos)\n\t\t\tstill_missing = Array.new\n\t\t\tmissing_pos.each do |rsid|\n\t\t\t\tif snpsinfo.has_key?(rsid) and snpsinfo[rsid]['chr'] != nil\n\t\t\t\t\tpositions[rsid] = snpsinfo[rsid]\n\t\t\t\telse\n\t\t\t\t\tstill_missing << rsid\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tmissing_pos = still_missing\n\t\tend\n\n\t\tif !missing_pos.empty?\n\t\t\twrite_missing_log(filename, missing_pos)\n\t\tend\n\telse\n\t\t# set arbitrary positions in order of input\n\t\tpos=1\n\t\tlines.each do |line|\n\t\t\tif first\n\t\t\t\tfirst = false\n\t\t\t\tnext\n\t\t\tend\n\t\t\tdata = strip_and_split(line)\n\t\t\tsnpid = data[@snp1] + '_' + data[@snp2]\n\t\t\tnext if positions.has_key?(snpid)\n\t\t\tpositions[snpid] = Hash.new\n\t\t\tpositions[snpid]['chr'] = 1\n\t\t\tpositions[snpid]['pos'] = pos\n\t\t\tpos += 1\n\t\tend\n\tend\n\n return positions\nend", "def points\n [top_left, top_right, bottom_left, bottom_right]\n end", "def coord_array\n _coords.dup\n end", "def position_coordinates(character)\n which_row = []\n which_cell = []\n (0...@n).each { |i| prepare_set(i, character, which_row, which_cell) }\n [which_row, which_cell]\n end", "def split_coords(placements)\n coords = []\n placements.map do |coord|\n split_up_coords = coord.split('')\n if split_up_coords.size == 3\n coords << split_up_coords[0]\n coords << split_up_coords[1..2].join\n elsif split_up_coords.size == 4\n coords << split_up_coords[0]\n coords << split_up_coords[1..3].join\n else\n coords << split_up_coords[0]\n coords << split_up_coords[1]\n end\n end\n end", "def find_in_setups\n positions = []\n self.category.setup.venture.setups.each do |setup|\n positions << setup.positions.where(name: self.name).first\n end\n positions.compact\n end", "def find_locations(letter)\n locations = [] # array for the index (position) of all instances of the letter in the word\n last_index = 0 # dual-purpose variable that holds the index (position) of the letter and the .index offset\n occurrences = $word.count letter # variable used to control do loop iteration count\n occurrences.times do # for every occurrence of the letter in the word\n last_index = $word.index(letter, last_index) # determine the position of the letter in the word\n locations.push(last_index) # push the position of the letter to the location array\n last_index += 1 # increment last_index by 1 to target the next occurrence of the letter (via .index offset)\n end\n add_letter(letter, locations) # pass the user-specified letter and array of locations to add_letter()\n # return locations # use for test 15\nend", "def encode_peptide(genome, amino_acid)\n # We say that a DNA string Pattern encodes an amino acid string Peptide if the \n # RNA string transcribed from either Pattern or its reverse complement Pattern translates into Peptide. \n # For example, the DNA string GAAACT is transcribed into GAAACU and translated into ET. \n # The reverse complement of this DNA string, AGTTTC, is transcribed into AGUUUC and translated into SF. \n # Thus, GAAACT encodes both ET and SF.”\n\n # Peptide Encoding Problem: Find substrings of a genome encoding a given amino acid sequence.\n # Input: A DNA string Text, an amino acid string Peptide, and the array GeneticCode.\n # Output: All substrings of Text encoding Peptide (if any such substrings exist). \n\n match_dna = []\n codon_length = 3\n rna_seq_length = (amino_acid.length * codon_length)\n \n rna = dna_to_rna(genome)\n i = 0\n while (rna_seq = rna.slice(i, rna_seq_length )) do\n # puts rna_seq\n match_dna << rna_to_dna(rna_seq) if rna_peptide_match?(rna_seq, amino_acid)\n i += 1\n end\n\n rna = dna_to_rna(reverse_complement(genome))\n # puts rna\n i = 0\n while (rna_seq = rna.slice(i, rna_seq_length )) do\n # puts rna_seq\n match_dna << reverse_complement(rna_to_dna(rna_seq)) if rna_peptide_match?(rna_seq, amino_acid)\n i += 1\n end\n\n match_dna\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 find_transcript_pbs(fasta)\n proteins = {}\n fasta = (fasta || '').gsub(/(n|N)/, '')\n unless fasta.empty?\n begin\n uri = URI(@config[:rbpdb][:url] + @config[:rbpdb][:pbs_path])\n res = Net::HTTP.post_form(\n uri,\n 'thresh' => 0.8,\n 'seq' => fasta\n )\n page = Nokogiri::HTML(res.body)\n page.css('table.pme-main tr.pme-row-0, table.pme-main tr.pme-row-1').each do |row|\n # Fetch base data.\n pos = Container::Position.new(\n score: row.children[1].text[0...-1].to_i,\n start: row.children[3].text.to_i,\n end: row.children[4].text.to_i,\n seq: row.children[5].text\n )\n\n # Fetch protein name and build result structure.\n prot = row.children[2].children[0].text.upcase\n proteins[prot] ||= Container::Protein.new(name: prot)\n proteins[prot].positions << pos\n end\n rescue StandardError => e\n puts e.message, e.backtrace\n retry\n end\n end\n proteins\n end", "def indexes(substr)\n outarray = nil\n if (i = self.index(substr))\n outarray = []\n while i\n outarray << i\n i = self.index(substr,i+1)\n end\n end\n outarray\n end", "def current_locations\n []\n end", "def sub_arrays\n result = []\n self.each_index do |i|\n self.each_index do |j|\n result << self[i..j] if j >= i\n end\n end\n result\n end", "def path\n coordinates = steps.map(&:start_location)\n coordinates << legs.last.steps.last.end_location\n coordinates\n end", "def get_cell_at_xy(input_array)\n input_array.map do |coord|\n x = coord[0]\n y = coord[1]\n at_coord(x, y)\n end\n end", "def loop_midpoints(addr)\n midpoints = []\n 0.upto(addr.length - 2 ) do | index|\n addr1 = addr[index]\n addr2 = addr[index + 1]\n midpoints << find_midpoint(addr1,addr2)\n end\n return midpoints\n end", "def y_points\n points = []\n (0...width).each do |x|\n (0...height).reverse_each do |y|\n if (array[y][x]).nonzero? && (y + 1 >= height || (array[y + 1][x]).zero?)\n points << Point.new(x, y + 1) + @position\n end\n end\n end\n\n points\n end", "def get_locations\n location_references =\n lighthouse_appointments.each_with_object({}) do |appt, acc|\n reference = appt.resource.participant.first.actor.reference\n location_id = reference.match(ID_MATCHER)[1]\n\n acc[location_id] ||= []\n acc[location_id] << appt\n end\n\n clinic_identifiers = location_references&.keys&.join(',')\n location_response = location_service.search(_id: clinic_identifiers, _count: '100')\n\n location_response&.resource&.entry\n end", "def scan_symbol_positions(symbol)\n positions = []\n @board.grid.each do |i|\n i.each do |cell|\n if cell.symbol == symbol\n positions << cell.position\n end\n end\n end\n positions\n end", "def get_uniq_locations\n start_array = StartLocation.all.map { |start_location| start_location.name }\n EndLocation.all.each { |end_location| start_array << end_location.name }\n uniq_arr = start_array.uniq\n uniq_arr\nend", "def find_end_points(x, y, chip)\n end_points = @DIR_DELTAS.keys.map { |dir| end_point_in_direction(x, y, chip, dir) }\n end_points.uniq { |point| point.take(2) }\n end", "def get_all_locations\n @locations = []\n\n Location.all.each do|loc|\n @locations << loc.to_hash\n end\n end", "def panoramics(landmarks)\n result = []\n landmarks.each_with_index do |landmark, idx|\n next_landmark = landmarks[idx + 1] || landmarks[0]\n result << [landmark, next_landmark]\n end\n result\nend", "def attacking_coordinates(piece_type = 'Queen')\n attacking_pairs(piece_type).map { |pair| pair.map(&:coordinates) }\n end", "def addresses\n Array(@addresses)\n end", "def get_all_locations\n @locations = []\n Location.all.each do |loc|\n @locations << loc.to_hash\n end\n end", "def to_a\n [lat, lng]\n end", "def to_a\n [lat, lng]\n end", "def editable_location_ids\n return Location.all if is_super_admin?\n if self.region\n res = []\n region.locations.each do |lok|\n res += [lok.id.to_s] + lok.locations.map{|l| l.id.to_s}\n end\n res\n elsif self.location\n [location.id.to_s] + self.location.locations.map{|l|l.id.to_s}\n else\n []\n end\n end", "def paint_coordinates\n result = []\n areas.each do |a|\n # TODO: This is a hack so that only land is painted.\n # Fix this up with a mapping in from type => col the\n # XML file.\n result |= a.coordinates if a.type == 'a'\n end\n result\n end", "def find_features_at_position(biosequence, *positions)\n positions.flatten!\n features = Array.new\n biosequence.features.each do |feature|\n out_of_range = 0\n positions.each do |position|\n if position >= feature.locations.span.first && position <= feature.locations.span.last\n features << feature unless feature.feature == \"source\" || features.include?(feature)\n elsif feature.locations.span.first > position\n out_of_range += 1\n end\n end\n break if out_of_range == positions.size\n end\n return features\nend", "def coordinates(image)\n image.each_with_index.flat_map do |row,x|\n (0...row.length).find_all{|i| row[i] == @char }.map{|y| [x,y] }\n end\n end", "def relative_locations\n relative_location_strategy.collect { |loc| loc.piecewise(self.position, :+) }\n end", "def sun_locations(loc)\r\n range = (@width / 4) - 1\r\n loc1 = loc - range\r\n\tloc2 = loc + range\r\n\tloc1 = (@width + loc1) if loc1 < 1\r\n\tloc2 = loc2 - @width if loc2 > @width\r\n #puts \"\"\r\n\t#puts loc1\r\n\t#puts loc\r\n\t#puts loc2\r\n\t\r\n\t#t = [loc1,loc2]\r\n\t\r\n\tss = []\r\n\tif loc1 < @sun_location\r\n\t [*loc1...(@sun_location)].each do |k|\r\n\t ss << k\r\n\t end\r\n\telsif (@sun_location+1) < loc1\r\n\t [*loc1..@width].each do |k|\r\n\t ss << k\r\n\t end\r\n\t [*1..(@sun_location-1)].each do |k|\r\n\t ss << k\r\n\t end\r\n\tend\r\n\t\r\n\tif @sun_location < loc2\r\n\t [*(@sun_location+1)..loc2].each do |k|\r\n\t ss << k\r\n\t end\r\n\telsif loc2 < @sun_location\r\n\t [*1..loc2].each do |k|\r\n\t ss << k\r\n\t end\r\n\t [*(@sun_location+1)..@width].each do |k|\r\n\t ss << k\r\n\t end\r\n\tend\r\n\t#puts ss\r\n\tss\r\n end", "def find_stations(mta, start_station, end_station)\n\n # Find the lines the stations are on\n lines = find_lines mta, start_station, end_station\n\n # Find the indexes on the found lines\n origin_index = mta[lines[0]].index(start_station)\n origin_union_index = mta[lines[0]].index(\"Union Square\")\n dest_union_index = mta[lines[1]].index(\"Union Square\")\n dest_index = mta[lines[1]].index(end_station)\n\n # Return an array of the results\n stations = [lines[0], origin_index, origin_union_index, lines[1], dest_union_index, dest_index]\nend", "def taken_dots\n @placements.map {|p| placement_dots(p) }.flatten(1)\n end", "def vi_locations\n vi_locations_list ? vi_locations_list.collection : []\n end", "def find_start_and_finish\n grid.each_with_index do |row, row_idx|\n row.each_with_index do |spot, col_idx|\n if spot == START_MARK\n @start = [row_idx, col_idx]\n elsif spot == END_MARK\n @finish = [row_idx, col_idx]\n end\n end\n end\n end", "def my_array_finding_method(i_want_pets, thing_to_find)\n new_array = []\n i_want_pets.each do |word|\n range = word.to_s.downcase[0..-1]\n if range.include?(thing_to_find)\n new_array << word\n end\n end\n return new_array\nend", "def coords_ahead\n dx = (dir_index - 2).remainder(2).to_i\n dy = (dir_index - 1).remainder(2).to_i\n [posx - dx, posy - dy]\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" ]
[ "0.5870837", "0.57908106", "0.5693682", "0.56321305", "0.5608253", "0.55918765", "0.55516934", "0.553264", "0.5480601", "0.5480601", "0.5477308", "0.54442006", "0.5438578", "0.5372567", "0.5370879", "0.5364156", "0.53538746", "0.53369963", "0.5331086", "0.5281115", "0.5275048", "0.5264498", "0.5245772", "0.52062774", "0.52062774", "0.5197236", "0.5191273", "0.5184916", "0.5184736", "0.51315135", "0.51207125", "0.51201063", "0.51190436", "0.5096017", "0.5078486", "0.50751454", "0.5060572", "0.5060218", "0.50311804", "0.5020923", "0.501737", "0.50095266", "0.50067055", "0.50017285", "0.49950725", "0.49938866", "0.49813655", "0.497627", "0.49725583", "0.49706072", "0.4969423", "0.49593395", "0.49592525", "0.49551448", "0.4954915", "0.4953406", "0.4951111", "0.49444145", "0.49415407", "0.49407586", "0.49381387", "0.49372643", "0.4930855", "0.4930666", "0.49304438", "0.49261448", "0.4925223", "0.49250755", "0.4923984", "0.49152154", "0.49125284", "0.49119025", "0.49092144", "0.49030384", "0.49027273", "0.48892024", "0.48849052", "0.48837155", "0.48698193", "0.48684767", "0.4865621", "0.4863456", "0.486203", "0.4861588", "0.4856782", "0.48552868", "0.48552868", "0.4855164", "0.4851876", "0.4851302", "0.4849955", "0.4846991", "0.48438555", "0.48422348", "0.4836063", "0.48338708", "0.48301584", "0.4821852", "0.48191607", "0.48115215" ]
0.75177836
0
Not all pepXML files simply list the protein ID, so this method obtains it. Are there other cases to cover?
def proteinID(protein) #If a protein ID contains a "|", then it contains more than just the ID if protein.include?('|') arr = protein.split("|")[1].split(":") if arr.length == 1 arr[0] else arr[1] end #If there's no characters, then it's an index. I don't fully understand regexp, but this works. elsif (protein =~ /[A-Z]/) == nil @proteinIndices[protein.to_i] else protein end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_prot_id(pep_ev_id) \n #dbref = @pep_ev_h_dbseqRef[pep_ev_id]\n dbref = @pep_ev_h[pep_ev_id].get_db_seq_ref\n prot_id = @db_seq_h[dbref]\n prot_id\n end", "def getFtProtID\n protein_id = ARGV[1]\n protId = \"\"\n @gbkObj.each_cds do |ft|\n ftH = ft.to_hash\n ftloc = ft.locations\n if ftH[\"protein_id\"][0].include? protein_id\n gene = []\n product = []\n gene = ftH[\"gene\"] if !ftH[\"gene\"].nil?\n product = ftH[\"product\"] if !ftH[\"product\"].nil?\n protId = ftH[\"protein_id\"][0] if !ftH[\"protein_id\"].nil?\n locustag = ftH[\"locus_tag\"][0] if !ftH[\"locus_tag\"].nil?\n if ftloc[0].strand == -1\n location = \"c#{ftloc[0].from}..#{ftloc[0].to}\"\n else\n location = \"#{ftloc[0].from}..#{ftloc[0].to}\"\n end\n dna = getDna(ft,@gbkObj.to_biosequence)\n seqout = dna.output_fasta(\"#{@accession}|#{location}|#{protId}|#{locustag}|#{gene[0]}|#{product[0]}\",60)\n puts seqout\n end\n end\n end", "def obtain_id(polyA)\n polyA = polyA.split(\"\\t\")\n id = polyA[8].match(/gene=(.+);/)[1]\n return (id)\nend", "def ncbi_protein_lookup(ids)\n results = Bio::NCBI::REST::EFetch.protein(ids, 'fasta')\n parsed_results = Bio::FlatFile.new(Bio::FastaFormat, StringIO.new(results))\n parsed_results.entries\n end", "def get_peptides_for_protein(protein_node)\n\t\tself.find(protein_node,\"PeptideHypothesis\")\n\tend", "def info()\n @pe_id = @id.to_i if @id\n return nil\n end", "def proteinInfo2hash (xmlRes)\n\n#\t\txmlDoc = Document.new xmlRes\n#\t\tentries = xmlDoc.elements.collect('uniprot/entry') { |ent| ent }\n\t\txmlDoc = Nokogiri::XML(xmlRes)\n\t\tentries = xmlDoc.css('uniprot > entry')\n# just take the very first entry\n\t\tmain_entry = entries.first\n\n\t\trecommended_name = main_entry.css('protein > recommendedName > fullName').collect {\n\t\t\t|node| node.text\n\t\t}\n\t\tsynonyms = main_entry.css('protein > alternativeName > fullName').collect {\n\t\t\t|alt_name| alt_name.text\n\t\t}\n\t\tkeywords = main_entry.css('keyword').collect { |keyw| keyw.text }\n\n\t\torganism = main_entry.css('organism > name').collect { |org|\n\t\t\tif org['type'] == 'scientific' then org.text end\n\t\t}\n\t\tfunction = main_entry.css(\"comment[type='function']\").collect { |func|\n\t\t\tfunc.text\n\t\t}\n\t\tlocation = main_entry.css(\"comment[type='subcellular location'] > subcellularLocation > location\").collect { |loc|\n\t\t\tloc.text\n\t\t}\n\n\t\tmolWeight = nil\n\t\tseqLength = nil\n\t\tseq = nil\n\t\tmain_entry.css(\"/sequence\").collect { |theSeq|\n\t\t\tmolWeight = theSeq.attributes['mass'].value\n\t\t\tseqLength = theSeq.attributes['length'].value\n\t\t\tseq = theSeq.text\n\t\t}\n\n# the very first pdb reference is got. a comparison based on resolution can improve the choice\n\t\tpdbs = main_entry.css(\"dbReference[type='PDB']\").collect { |pdb|\n\t\t\tpdb\n\t\t}\n\t\tpdbNodeMalformed = false\n\t\tpdbs.each { |node|\n\t\t\tresolution = node.css(\"property[type='resolution']\")\n\t\t\tif resolution.nil? || resolution.length == 0 then\n\t\t\t\tpdbNodeMalformed = true\n\t\t\t\tbreak\n\t\t\tend\n\t\t}\n\t\tif pdbs.empty? == false && pdbNodeMalformed == false\n# sort by value resolution to get the element with lowes resolution value\n\t\t\tpdbs = pdbs.sort_by{ |node|\n\t\t\t\tnode.css(\"property[type='resolution']\").first['value']\n\t\t\t}\n\t\tend\n\n\n\t\tpdbResult = ''\n\t\tif pdbs.empty? == false\n\t\t\tpdbResult = 'http://www.pdb.org/pdb/explore/explore.do?structureId='\n#\t\t\tpdbResult += pdbs[0].css(\"property[type='resolution']\").first['value']\n\t\t\tpdbResult += pdbs[0].attributes['id'].value\n\t\tend\n\t\thash_result = Hash.new\n\t\thash_result[:target_name] = \"#{recommended_name[0]} (#{organism[0]})\"\n\t\thash_result[:target_type] = 'PROTEIN'\n\t\thash_result[:description] = recommended_name[0]\n\t\thash_result[:synonyms] = synonyms.join('; ')\n\t\thash_result[:organism] = organism[0]\n\t\thash_result[:keywords] = keywords.join('; ')\n\t\thash_result[:cellularLocations] = location.join('; ')\n\t\thash_result[:molecularWeight] = molWeight\n\t\thash_result[:numberOfResidues] = seqLength\n\t\thash_result[:sequence] = seq\n\t\thash_result[:specificFunction] = function.join('; ')\n\t\thash_result[:pdbIdPage] = pdbResult\n\t\thash_result[:theoreticalPi] = nil\n\n\t\thash_result\n\tend", "def peptides\n\t\[email protected](\"//#{MZID_NS_PREFIX}:PeptideHypothesis\",\"#{MZID_NS_PREFIX}:#{MZID_NS}\")\n\tend", "def get_protID(my_gene)\n address=\"http://togows.org/entry/ebi-uniprot/#{my_gene}/accessions.json\"\n response = fetch(address) \n if response # if there is a response to calling that URI\n body = response.body # get the \"body\" of the response\n data = JSON.parse(response.body)\n return data[0]\n end\nend", "def getpid\n sax_document = SaxDocumentGetNextPID.new\n pid_doc = @repository.next_pid(:namespace => @namespace)\n Nokogiri::XML::SAX::Parser.new(sax_document).parse(pid_doc)\n return sax_document.pids.shift\n end", "def get_id \n part_number = PartNumber.get_part_number(self)\n part_number.id if part_number\n end", "def id\n @pe_id\n end", "def id\n return @poco_data[:id] unless @poco_data == nil\n pick_first_node(@poco.xpath('./poco:id'))\n end", "def set_protein\r\n @protein = Protein.find(params[:id])\r\n end", "def pid\n @pid ||= AX.pid_of_element @ref\n end", "def id\n read_attribute(:pf_id)\n end", "def parse_pid(pr)\n pr.split[1]\n end", "def proteinlist\n\n end", "def producer\n #f = @properties.field('PRODID')\n #f && f.to_text\n @properties.text('PRODID').first\n end", "def get_profile_id( pp )\n File.open(pp,\"r\") {|f|\n raw = f.read\n nice = raw.gsub(\"\\n\",\"\").gsub(\"\\r\",\"\").\n gsub(\"\\t\",\"\").gsub(\" \",\"\")\n matches = nice.scan(/UUID<\\/key><string>(.*)<\\/string>/)\n return matches.first.first\n }\n log(\"Couldn't find UUID in: \" + pp)\n abort(\"Couldn't find UUID in: \" + pp)\nend", "def get_id(node)\n node.parent.parent.attributes[\"id\"].value\n end", "def get_item_id\n @doc.css('.subtext > .age > a:first-child').map{|ele| ele['href']}.map {|x| x[/\\d+/]}.join\n end", "def format_parcel_id(pid)\n \"#{pid[0..1]} #{pid[2..3]} #{pid[4..5]} #{pid[6]} #{pid[7..9]} #{pid[10..12]}.#{pid[13..15]}\"\n end", "def get_ingest_id( filename )\n\n begin\n File.open( \"#{filename}.id\", 'r') do |file|\n id = file.read( )\n return id\n end\n rescue => e\n end\n return ''\n end", "def protein_seq\n return Bio::Sequence::NA.new(self.cds_seq).translate.seq\n end", "def lookupRepecID(elemPubID)\n if !$repecIDs.key?(elemPubID)\n # The only way we know of to get the RePEc ID is to ask the Elements API.\n apiHost = ENV['ELEMENTS_API_URL'] || raise(\"missing env ELEMENTS_API_URL\")\n resp = HTTParty.get(\"#{apiHost}/publications/#{elemPubID}\", :basic_auth =>\n { :username => ENV['ELEMENTS_API_USERNAME'] || raise(\"missing env ELEMENTS_API_USERNAME\"),\n :password => ENV['ELEMENTS_API_PASSWORD'] || raise(\"missing env ELEMENTS_API_PASSWORD\") })\n resp.code == 404 and return nil # sometimes Elements does meta update on non-existent pub, e.g 2577213. Weird.\n resp.code == 410 and return nil # sometimes Elements does meta update on deleted pub, e.g 2564054. Weird.\n resp.code == 200 or raise(\"Updated message : Got error from Elements API #{apiHost} for pub #{elemPubID}: #{resp}\")\n\n data = Nokogiri::XML(resp.body).remove_namespaces!\n repecID = data.xpath(\"//record[@source-name='repec']\").map{ |r| r['id-at-source'] }.compact[0]\n\n $repecIDs.size >= MAX_USER_ERRORS and $repecIDs.shift\n $repecIDs[elemPubID] = repecID\n end\n return $repecIDs[elemPubID]\nend", "def extractAndrewID(filename)\n underscoreInd = filename.index(\"_\")\n if !underscoreInd.nil? \n return filename[0...underscoreInd]\n end\n return nil \n end", "def id_from_record(record)\n f907 = record.find {|f| f.tag == \"907\"}\n f907.subfields.find {|s| s.code == \"a\"}.value\nend", "def as_pepxml()\n\t\talt_node = XML::Node.new('alternative_protein')\n\t\talt_node['protein']=self.protein\n\t\talt_node['protein_descr']=self.protein_descr\n\t\talt_node['peptide_prev_aa']=self.peptide_prev_aa\n\t\talt_node['peptide_next_aa']=self.peptide_next_aa\n\n\n\t\talt_node\n\tend", "def gene_id\n description.andand.match(/ GN=(\\w+) ?/)[1]\n end", "def pbt_id\n val = pbt\n val ? send(\"#{val}_id\") : nil\n end", "def set_proteinname\n @proteinname = Proteinname.find(params[:id])\n end", "def id(prog); @progs[prog]; end", "def alien_number\n vlp_documents.select{|doc| doc.alien_number.present? }.first.try(:alien_number)\n end", "def identifier\n @document.xpath('/xmlns:mediapackage/@id', {'xmlns' => XML_NS_MEDIAPACKAGE}).first.value\n end", "def cpid\n first_mpi_claim = @eobs.detect{|eob| eob.claim_information}\n if first_mpi_claim && first_mpi_claim.claim_information.payid\n first_mpi_claim.claim_information.payid\n else\n payer_id\n end\n end", "def prodid_property\n @prodid_property ||= RiCal::PropertyValue::Text.convert(self, \"-//com.denhaven2/NONSGML ri_cal gem//EN\")\n end", "def get_parent_newspaper_id\n all_newspaper_ids = {}\n\n Utils.get_newspaper_pids(@config).each do |object_id|\n all_newspaper_ids[object_id] = true if object_id =~ /^#{@namespace}\\:/\n end\n\n manifest_newspaper_ids = []\n @manifest.collections.each do |collection_id|\n manifest_newspaper_ids.push collection_id if all_newspaper_ids[collection_id]\n end\n\n case\n when manifest_newspaper_ids.empty?\n error \"The collection element in the manifest.xml for this package doesn't include a parent newspaper object for #{@owning_institution}.\"\n error \"There must be exactly one collection that is this issue's parent newspaper object.\"\n when manifest_newspaper_ids.length > 1\n error \"The manifest.xml for this package includes too many parent newspaper objects for #{@owning_institution}: #{manifest_newspaper_ids.sort.join(', ')}.\"\n error \"There must be exactly one collection that is this issue's parent newspaper object.\"\n else\n return manifest_newspaper_ids.pop\n end\n\n rescue => exception\n oops exception\n end", "def get_protein_probability(protein_node)\n\n\t\t#MS:1002403\n\t\tis_group_representative=(self.get_cvParam(protein_node,\"MS:1002403\")!=nil)\n\t\tif is_group_representative\n\t\t\treturn \tself.get_cvParam(protein_node.parent,\"MS:1002470\").attributes['value'].to_f*0.01\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend", "def pfile_digits\n PFILE_REGEX_MATCHING.match(scanned_file)[1]\n end", "def pid\n @fields.first\n end", "def source_record_id_proc\n @source_record_id_proc ||= lambda do |source_xml_record|\n if ( source_xml_record &&\n source_xml_record.kind_of?(Nokogiri::XML::Node) )\n source_xml_record['id'] || (el = source_xml_record.at_xpath('./id') && el.text)\n end\n end\n end", "def find_soffice_pid\n %x(pgrep #{soffice_pname}).presence&.to_i\n end", "def getpostypeid()\r\n return getvalue(SVTags::POS_TYPE_ID)\r\n end", "def cache_ids(use_pbar = @use_pbar)\n num_pep, num_db_seq, num_pep_ev = get_num_elements(nil)\n \n @pep_h = Hash.new\n @mod_h = Hash.new\n pbar1 = ProgressBar.new(\"peptides\", num_pep/2) if use_pbar\n reader = Nokogiri::XML::Reader(File.open(@mzid_file))\n reader.each do |node|\n # parse Peptide items\n if node.name == \"Peptide\" then\n # parse local peptide entry\n tmp_node = Nokogiri::XML.parse(node.outer_xml)\n tmp_node.remove_namespaces!\n root = tmp_node.root \n pep_id = root[\"id\"].to_sym\n # skip if already handled PepID\n next if @pep_h.has_key?(pep_id)\n # parse sequence/mods if haven't seen it yet\n pep_seq = get_peptide_sequence(root)\n mod_line = get_modifications(root)\n @pep_h[pep_id] = pep_seq\n @mod_h[pep_id] = mod_line\n pbar1.inc if use_pbar\n end\n end\n pbar1.finish if use_pbar\n # now parse DBSequence items\n dbseq_re = Regexp.new(/^\\s*<DBSequence\\s/)\n pbar2 = ProgressBar.new(\"db_seq\", num_db_seq) if use_pbar\n IO.foreach(@mzid_file) do |line|\n next if !dbseq_re.match(line)\n \n prot_id = line.match(/accession=\\\"([\\w|\\|]+)/)[1]\n db_id = line.match(/id=\\\"(\\w+)/)[1]\n \n @db_seq_h[db_id.to_sym] = prot_id.to_sym\n pbar2.inc if use_pbar\n end\n pbar2.finish if use_pbar\n # now parse PeptideEvidence items\n pepev_re = Regexp.new(/^\\s*<PeptideEvidence\\s/)\n pbar3 = ProgressBar.new(\"pep_ev\", num_pep_ev) if use_pbar\n IO.foreach(@mzid_file) do |line|\n next if !pepev_re.match(line)\n \n db_id = line.match(/dBSequence_ref=\\\"(\\w+)/)[1]\n start_pos = line.match(/start=\\\"(\\d+)/)[1].to_i\n end_pos = line.match(/end=\\\"(\\d+)/)[1].to_i\n pep_ev = line.match(/id=\\\"(\\w+)/)[1]\n is_decoy = line.match(/isDecoy=\\\"(\\w+)\\\"/)[1]\n # @pep_ev_h_dbseqRef[pep_ev.to_sym] = db_id.to_sym\n @pep_ev_h[pep_ev.to_sym] = PeptideEvidence.new(:db_seq_ref => db_id.to_sym,\n :start_pos => start_pos,\n :end_pos => end_pos,\n :is_decoy => is_decoy)\n pbar3.inc if use_pbar\n end\n pbar3.finish if use_pbar \n end", "def page_id page_resource_node\n image_id_nodes = page_resource_node.xpath('file[@mimetype=\"image/jp2\"]/@id')\n if image_id_nodes.size == 1\n full_id = image_id_nodes.first.text\n if full_id && !full_id.strip.empty?\n t = full_id.strip.gsub(/\\s+/, ' ')\n if t.match(/^(.+).jp2$/i)\n return $1\n else\n logger.warn(\"Unable to parse page id from <file> in contentMetadata: #{full_id}\")\n end\n else\n logger.warn(\"no @id attribute found for page <file> in contentMetadata: #{image_id_nodes.first.to_xml}\")\n end\n else\n logger.warn(\"couldn't find jp2 <file> element in <resource> for page in contentMetadata: #{page_resource_node.to_xml}\")\n end\n nil\n end", "def extract_invoice_id\n invoice_id = Converter.xml_get('Betreff_NR', self.order)\n if invoice_id && invoice_id.match(/Rechnung Nr/)\n self.id = invoice_id.match(/\\d+/)[0]\n end\n end", "def process_id\n\n\t\t::Pantheios::Core.process_id\n\tend", "def identifier\n children[0]\n end", "def identifier\n children[0]\n end", "def identifier\n children[0]\n end", "def primary_key(table_name) #:nodoc:\r\n sql = \"SELECT COLUMN_NAME FROM (EXECUTE PROCEDURE sp_GetBestRowIdentifier( NULL, NULL, '#{table_name}', NULL, FALSE)) as gbri\"\r\n rs = select(sql)\r\n if !rs.nil? and !rs[0].nil?\r\n strip_or_self(rs[0]['COLUMN_NAME'])\r\n else\r\n nil\r\n end\r\n end", "def pids_for_type(type)\n pids_from(pid_file_for(type))\n end", "def get_pid\n File.exists?(@pid_file) ? File.read(@pid_file).strip : 0\n end", "def getPep (cds, seq)\n\nend", "def primary_pack_id\n data[:primary_pack_id]\n end", "def extract_manifest_id(prm)\n item = prm[:manifest_id] || prm[:manifest]\n item = item.id if item.is_a?(Manifest)\n item.presence\n end", "def pid\n File.read(@pid_file).strip.to_i\n end", "def _pid_file_pid\n /^(\\d*)$/ =~ _pid_file_content\n return $1.blank? ? nil : $1.to_i\n end", "def identifier\n @identifiers[0]\n end", "def target_id; genomic.entry_id; end", "def parent_pid(pid)\n\tstat = File.open(\"/proc/#{pid}/stat\") { |i| i.read }\n\tstat.gsub!(/^.*\\)\\s.\\s/, '')\n\tstat.split[0].to_i\nend", "def pid()\n #This is a stub, used for indexing\n end", "def service_prov_identification\n code, qual = nil, nil\n claim = eob.claim_information\n\n if (claim && !claim.provider_npi.blank?)\n code = claim.provider_npi\n qual = 'XX'\n Output835.log.info \"Provider NPI from the 837 is chosen\"\n elsif (claim && !claim.provider_ein.blank?)\n code = claim.provider_ein\n qual = 'FI'\n Output835.log.info \"Provider TIN from 837 is chosen\"\n elsif !facility.facility_npi.blank?\n code = facility.facility_npi\n qual = 'XX'\n Output835.log.info \"facility NPI from FC is chosen\"\n elsif !facility.facility_tin.blank?\n code = facility.facility_tin\n qual = 'FI'\n Output835.log.info \"facility TIN from FC is chosen\"\n end\n\n return code, qual\n end", "def nature_id\n return @nature\n end", "def extract_delivery_note_id\n delivery_note = Converter.xml_get('Betreff_NR', self.order)\n if delivery_note && delivery_note.match(/Lieferschein/)\n self.delivery_note_id = delivery_note.match(/\\d+/)[0]\n return (self.delivery_note_id ? true : false)\n end\n end", "def show\n @peptide = Peptide.find(params[:id])\n logger.info(\"PEPTIDE: (#{params[:id]}) #{@peptide.pep_seq}\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @peptide }\n end\n end", "def findAllPepLocations\n hits = @doc.xpath(\"//#{@xmlns}search_hit\")\n all = []\n @locations = []\n i = 0\n \n # Parses out each peptide and protein\n hits.each do |hit|\n all << [hit.xpath(\"./@peptide\").to_s, proteinID(hit.xpath(\"./@protein\").to_s)]\n i += 1\n end\n \n all.uniq!\n dataHash = Hash.new\n \n Ms::Fasta.foreach(@database) do |entry|\n @sequences += 1\n pID = proteinID(entry.header)\n dataHash[pID] = entry.sequence\n @proteinIndices << pID\n end\n \n all.each do |set|\n if dataHash[set[1]] != nil\n startVal = dataHash[set[1]].scan_i(set[0])[0]\n \n if startVal != nil\n @locations << [set[0], set[1], startVal + 1, startVal + set[0].length]\n end\n end\n end\n end", "def read_pid\n File.read(pid_path).to_i\n end", "def read_pid\n File.read(pid_path).to_i\n end", "def extract_id_uri\n @id_uri = @meta.at_xpath('./a:identification/a:FRBRWork/a:FRBRuri', a: NS)['value']\n empty, @country, @nature, date, @num = @id_uri.split('/')\n\n # yyyy-mm-dd\n @year = date.split('-', 2)[0]\n end", "def proposal_from_attrs(attrs)\n Proposal.find_by(id: attrs[:proposal_id])\n end", "def extract_product_id(order_line_product_id)\n api.lookup_product(order_line_product_id)['number']\n end", "def pcb_number\n pnum=PartNum.get_bde_pcb_part_number(self.id)\n if pnum\n pnum.name_string\n else\n \"\"\n end\n end", "def code_dbpedia_id\n query_root_node(\"fao:codeDBPediaID/text()\", @@NAMESPACES).to_s\n end", "def tourney_get_id(name)\n name = name.gsub(/[^\\w\\d\\s]/,\"\")\n Dir.glob(\"#{TOURNEY_DATA_DIR}/tourney**/tourneyinfo\") do |filename|\n File.open(\"#{filename}\", \"r\") do |f|\n tourney_name = f.read.split(\"\\n\")[0].split\n tourney_name.shift # remove the \"Tourney Name: \"\n tourney_name.shift\n tourney_name = tourney_name.join(\" \")\n if(name.downcase.eql?(tourney_name.downcase))\n\t\t\t\t# get the id off of the file name: exploits the fact that the file path is only/letters/tourney1111111111/tourneyinfo to get the numbers\n # I can feel my programming practices prof crying as I type.\n\t\t\t\tfields = filename.split('/')\n\t\t\t\tid = fields[fields.length - 2].split('y').pop.to_i\n\t\t\t\tputs \"id: #{id}\"\n\t\t\t\treturn id\n end\n end\n end\n return \"\"\nend", "def code_list_id\n @entry.at_xpath(@code_list_xpath).value\n end", "def select_cdm_identifier(record, _context)\n uri = record.xpath(ID_XPATH, NS).map(&:text).reject(&:blank?)\n uri.first if uri.any?\n end", "def on_ident(node, compiled_grammar)\n return node.children[0]\n end", "def pp_uuid(ppfile)\n\t \tProvisioningProfile.new(ppfile, @apple_cert_file)['UUID']\n\t end", "def pid\n File.read(@pid_file).to_i\n end", "def parent_id\n self.tagvalues[\"is_a\"].first\n end", "def id\n read_attribute(:pg_page_id)\n end", "def prince_resolve\n puts \"\\n--------------------------------\"\n puts \"Resolving isoforms...\\n\\n\"\n \n header = %w(title search_engines pep qvalue)\n cutoff = config_value(\"//Refiner/@cutoff\").to_f\n files = []\n \n @samples.each do |key, value|\n value.combined.each {|file| files << file}\n end\n \n official_filenames = []\n all_prots_by_id = {}\n peptide_hits = files.map do |file|\n base = File.basename(file).chomp(File.extname(file))\n official_filenames << base\n IO.readlines(file).map do |line|\n t = line.chomp.split(\"\\t\")\n pep = t[2].to_f\n if pep < cutoff\n hit = PeptideHit.new\n hit.title = t[0]\n hit.search_engines = t[1].split('+')\n hit.charge = t[0].split('.')[-1]\n hit.pep = pep\n hit.qvalue = t[3].to_f\n hit.aaseq = t[4]\n hit.prots = t[5..-1].map do |id|\n prot = \n if all_prots_by_id.key?(id)\n all_prots_by_id[id]\n else\n all_prots_by_id[id] = Protein.new(id, nil, [])\n end\n prot.peps << hit\n prot\n end\n hit.filename = base\n hit\n end\n end.compact\n end\n \n minimum_proteins!(peptide_hits.flatten)\n end", "def id(source_file); end", "def test_entitygetpublicid\n doc = nil\n docType = nil\n entityList = nil\n entityNode = nil\n publicId = nil\n systemId = nil\n notation = nil\n doc = load_document(\"staff\", false)\n docType = doc.doctype()\n assert_not_nil(docType, \"docTypeNotNull\")\n entityList = docType.entities()\n assert_not_nil(entityList, \"entitiesNotNull\")\n entityNode = entityList.getNamedItem(\"ent5\")\n \n publicId = entityNode.publicId()\n assert_equal(\"entityURI\", publicId, \"publicId\")\n \n systemId = entityNode.systemId()\n assertURIEquals(\"systemId\", nil, nil, nil, \"entityFile\", nil, nil, nil, nil, systemId)\n \n notation = entityNode.notationName()\n assert_equal(\"notation1\", notation, \"notation\")\n \n end", "def pstore_idpath_to_id\n @pstore_idpath_to_id ||= File.join('.', 'data', 'pstore', 'articles_idpath_to_id.pstore')\n end", "def map_tgup_by_proteinid()\n # output unmatch list for map by gene_id (prefix of gene_id is first char of gene_id. (\"1\", \"2\", ..))\n refg_output = {}\n FileUtils.mkdir_p(\"#{$prepare_dir}/refg\") unless File.exist?(\"#{$prepare_dir}/refg\")\n (1..9).each do |prefix|\n refg_output[prefix.to_s] = File.open(\"#{$prepare_dir}/refg/#{prefix.to_s}.dat\", \"w\")\n end\n\n output_header\n\n # try mapping the same prefix of RefSeq data and UniProt data(for performance)\n Dir.glob(\"#{$prepare_dir}/refp/*.dat\") do |input_file|\n # parse data\n refseq_gene_list = []\n protein_id_prefix = input_file.split(\"/\").last.split(\"\\.\").first\n puts \"protein_id prefix: #{protein_id_prefix}\"\n File.open(input_file) do |f|\n f.each_line do |line|\n columns = line.chomp.strip.split(\"\\t\")\n gene_id_prefix = columns[4].nil? ? \"\" : columns[4][0]\n refseq_gene_list.push({taxid: columns[0], gene_rsrc: columns[1], gene_label: columns[2], protein_id: columns[3], gene_id: columns[4], gene_id_prefix: gene_id_prefix})\n end\n end\n\n $count_nc += refseq_gene_list.size if protein_id_prefix == \"no_protein_id\" # no protein_id on RefSeq\n up_list = load_up_refp(protein_id_prefix) # get same prefix data from UniProt\n\n refseq_gene_list.each do |refseq_data|\n match = false\n output_tax(refseq_data) # output all gene-tax turtle\n unless up_list.nil? # exist prefix on UniProt\n match_list = up_list[refseq_data[:protein_id]]\n unless match_list.nil? # match some uniprot_ids\n match_list.each do |up_info|\n if refseq_data[:taxid] == up_info[:taxid] # ignore unmatch tax\n output_idmap(refseq_data, up_info[:upid])\n match = true\n else # match protein_id but not match tax_id\n output_uptax(up_info)\n $taxup_list[up_info[:taxid]] = true\n $tax_mismatch[\"#{refseq_data[:taxid]}-#{up_info[:taxid]} : #{refseq_data[:protein_id]}\"] = true\n end\n end\n end\n end\n if match == false\n if refseq_data[:gene_id_prefix].nil? ||refseq_data[:gene_id_prefix] == \"\" # can't salvage it by gene_id.\n $no_up += 1\n else # output a file to each prefix of gene_id that can be salvaged by gene_id\n line = [refseq_data[:taxid], refseq_data[:gene_rsrc], refseq_data[:gene_label], refseq_data[:protein_id], refseq_data[:gene_id], refseq_data[:gene_id_prefix]]\n refg_output[refseq_data[:gene_id_prefix]].puts(line.join(\"\\t\"))\n end\n end\n $count += 1\n end\n end\n refg_output.each do |k, v|\n v.flush\n v.close\n end\nend", "def get_id_of_first_result\n if @items.size > 0\n @items[0].each_element_with_attribute('name', 'id' ) { |element| return element.text() }\n end\n end", "def pids\n @pids ||= @lines.keys\n end", "def find_princess_position\n position_coordinates('p')\n end", "def ppid\n Process.ppid\n end", "def identifier\n @info.identifier\n end", "def identifier\n @info.identifier\n end", "def set_is_aprotein\n @is_aprotein = IsAprotein.find(params[:id])\n end", "def get_legacy_ingest_id( dirname )\n\n begin\n f = File.join( dirname, TaskHelpers::INGEST_ID_FILE )\n File.open( f, 'r') do |file|\n id = file.read( )\n return id\n end\n rescue => e\n end\n return ''\n\n end", "def get_parent_id\n\n manifest_parent_ids = []\n @manifest.collections.each do |collection_id|\n manifest_parent_ids.push collection_id if collection_id =~ /^#{@namespace}\\:/\n end\n\n case\n when manifest_parent_ids.empty?\n error \"The collection element in the manifest.xml for this package doesn't include a parent object for #{@owning_institution}.\"\n error \"There must be exactly one collection that is the parent object for the set of pages.\"\n when manifest_parent_ids.length > 1\n error \"The manifest.xml for this package includes too many parent objects for #{@owning_institution}: #{manifest_parent_ids.sort.join(', ')}.\"\n error \"There must be exactly one collection that is the parent object for the set of pages.\"\n else\n return manifest_parent_ids.pop\n end\n\n rescue => exception\n oops exception\n end", "def get_pdf_list_item_id(pdf_upload_response)\n uri = pdf_upload_response.body['d']['ListItemAllFields']['__deferred']['uri']\n path = uri.slice(uri.index(base_path)..-1)\n\n with_monitoring do\n get_item_response = sharepoint_connection.get(path)\n\n list_item_id = get_item_response.body.dig('d', 'ID')\n raise ListItemNotFound if list_item_id.nil?\n\n list_item_id\n end\n end", "def prodid\n prodid_property ? prodid_property.ruby_value : nil\n end", "def makeKeggTaxonId(file)\n out = File.new(file, \"w\")\n keggtaxurl = \"http://www.genome.jp/kegg-bin/get_htext?query=&htext=Organisms&filedir=&option=-e&extend=F65F548C25-2E42-3&uploadfile=&format=&wrap=&length=&open=&close=&hier=18&oneclick=on\"\n out = File.new(\"kegg_taxon_ids.txt\", \"w\")\n File.new(open(keggtaxurl)).each do |line|\n if line =~/([^\\>]*)<\\/I>.*id=([0-9]*).*>([a-z]*)</\n sp, taxid, name = $1, $2, $3\n out.printf(\"%s\\t%d\\t%s\\n\", name, taxid, sp)\n end\n end\n out.close\nend" ]
[ "0.6808757", "0.62427807", "0.6039692", "0.5979965", "0.58701205", "0.5824189", "0.5798599", "0.5735441", "0.5715364", "0.5696525", "0.56889135", "0.5687096", "0.56840736", "0.56196", "0.55708706", "0.55544865", "0.55068547", "0.5498481", "0.5469759", "0.54546547", "0.5446748", "0.5442868", "0.5401", "0.5398578", "0.535004", "0.5344609", "0.53426695", "0.5338112", "0.53287464", "0.5327667", "0.52916235", "0.52875745", "0.5282849", "0.52724946", "0.52671385", "0.5253331", "0.5247629", "0.5244829", "0.5227987", "0.52186626", "0.5214575", "0.52082765", "0.5205522", "0.5198578", "0.5185709", "0.5184055", "0.5179083", "0.5157676", "0.5149185", "0.5149185", "0.5149185", "0.514589", "0.514382", "0.51410615", "0.5134642", "0.5129583", "0.51287365", "0.5103922", "0.51020116", "0.50884956", "0.50779736", "0.5060601", "0.5060102", "0.5055546", "0.5043542", "0.50330293", "0.5032043", "0.50307405", "0.5025755", "0.5025755", "0.5024873", "0.50241846", "0.5013977", "0.50129896", "0.5001437", "0.4993963", "0.49938804", "0.49936205", "0.49855113", "0.49731642", "0.49712473", "0.49686766", "0.49685532", "0.4961106", "0.49591857", "0.49579212", "0.49574104", "0.49507415", "0.49426502", "0.49306056", "0.49284694", "0.49272493", "0.49254903", "0.49254903", "0.49217716", "0.49173534", "0.4915066", "0.4912437", "0.49114022", "0.4906695" ]
0.69392115
0
GET /tenant_users/1 GET /tenant_users/1.json
def show @tenant_user = TenantUser.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @tenant_user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_users_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend", "def get_user_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def get_user_for_tenant_by_email(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users/email/#{args[:email]}\", args)\nend", "def get_user_by_email_for_current_tenant(args = {}) \n get(\"/users.json/email/#{args[:email]}\", args)\nend", "def get_user_by_email_for_current_tenant(args = {}) \n get(\"/users.json/email/#{args[:email]}\", args)\nend", "def index\n #@users = User.all\n @users = User.where(tenant_id: current_tenant.id)\n render json: {\n message: 'Your All Users',\n user: @users\n }\n end", "def add_user_for_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend", "def get_current_tenant \n get(\"/tenants.json/current\")\nend", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def users_for_a_project\n uri = \"#{@api_url}/#{@project_id}/users?access_token=#{@access_token}\"\n get uri\n end", "def get_tenant_by_name(args = {}) \n get(\"/tenants.json/name/#{args[:tenantName]}\", args)\nend", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def list_users\n self.class.get('/users')\n end", "def tenant_get(tenant_id)\n\t\t\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/tenants/#{tenant_id}\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\t#TODO -- it's working when you pass it an id in the url...figure out how to make it work when passed just the name???\n\t\tputs \"invoking tenant-get...\"\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 show\n @tenant = keystone.get_tenant(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tenant }\n end\n end", "def show\n if (current_user.tenant?)\n @tenant = current_user.tenant\n if (@tenant == nil)\n @tenant=Tenant.first\n params[:notice]=\"No user could be found with that email.\"\n end\n end\n end", "def get_user(id, accountId, options={}) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n get(path, options, AvaTax::VERSION) end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def index\n @tenants = Tenant.get_tenant_list(current_user)\n @tenants = @tenants.paginate(:page => params[:page],:per_page => 10).order('id DESC')\n end", "def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end", "def new\n @tenant_user = TenantUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenant_user }\n end\n end", "def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def user_management_get_single_user id\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users/{id}\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\n \"id\" => id,\n }\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.get query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif response.code == 404\n raise APIException.new \"Not Found\", 404, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end", "def show\n @tenant = Tenant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tenant }\n end\n end", "def get_user(id)\n @client.raw('get', \"/config/users/#{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 users\n get('get_users')\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def get_users(request); end", "def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end", "def for_id(user_id)\n Iterable.request(conf, \"/users/byUserId/#{user_id}\").get\n end", "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end", "def get_tenant_by_erp_id(args = {}) \n get(\"/tenants.json/erp-id/#{args[:erpId]}\", args)\nend", "def list_users()\n response = HTTParty.get(\"https://graph.microsoft.com/v1.0/users\", { \n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com' \n }\n })\n return JSON.parse response.read_body\n end", "def get \n render :json => User.find(params[:id])\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def index\n @tenants = current_user.tenants\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 index\n json_response(User.all) \n end", "def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end", "def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end", "def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def index\n render json: current_org.users\n end", "def account_user(id)\n get(\"accountuser/#{id}\")\n end", "def list_tenants_for_circle(args = {}) \n get(\"/tenantcircles.json/tenants\", args)\nend", "def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end", "def show\n @tenant=Tenant.find(params[:tenant_id])\n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def get(user_id)\n User.find user_id\n end", "def index\n r = @api.get_users\n response = JSON.parse(r.body)\n if r.code == 200\n @users = response\n else\n redirect_to login_sign_in_admin_path, alert: response['message']\n end\n end", "def get_user_info(user)\n if user.respond_to? :id\n username = Digest::MD5.hexdigest(user.id.to_s)\n else\n username = user\n end\n\n begin\n url = \"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}\"\n response = RestClient.get(url, \"Authorization\" => \"Bearer #{access_token}\", content_type: :json, accept: :json)\n res = JSON.parse(response.body)\n p res[\"entities\"]\n rescue => e\n puts e.response\n end\n end", "def index\n @v1_users = V1::User.all\n end", "def index\n @tenants = Tenant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tenants }\n end\n end", "def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end", "def get_users(options)\n @client.raw('get', '/config/users', options)\n end", "def destroy\n @tenant_user = TenantUser.find(params[:id])\n @tenant_user.destroy\n\n respond_to do |format|\n format.html { redirect_to tenant_users_url }\n format.json { head :no_content }\n end\n end", "def get_current_logged_in_user \n get(\"/users.json/current\")\nend", "def get_current_logged_in_user \n get(\"/users.json/current\")\nend", "def index\n users = User.all\n json_response(users)\n end", "def get_client_summary_for_tenant(args = {}) \n get(\"/tenants.json/backoffice/clients/summary/#{args[:tenantId]}\", args)\nend", "def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def user(user_id = nil)\n user_id = username if user_id.nil? || user_id == \"\"\n if user_id.to_i.to_s == user_id.to_s\n users = connection.get(connection.build_url('users', :userids => user_id)).body\n else\n users = connection.get(connection.build_url('users', :logins => user_id)).body\n end\n users.map!{|hash| hash.values.first}\n users.first\n end", "def show\n\t begin\n @user = current_user.company.users.find(params[:id])\n\t rescue Exception => e\n\t\t redirect_to root_path, alert: \"This user does not exist.\"\n\t\t\treturn\n\t\tend\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def index\n @users = User.not_deleted.where(:client_id => nil).order(:role_id, :name).page(params[:page]).per(15)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = UserService.all_users\n end", "def index\n @users = @department.users\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def get_user_info(list)\n\trequire 'net/http'\n\tNet::HTTP.get(ENV[\"VERITAS-USER-SERVER\"] + \"/users?user_ids=#{list}\")\nend", "def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end", "def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end", "def all_users(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'users', params)\n end", "def list_arrays_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend", "def project_users\n request :user\n end", "def retrieve_user(username)\n\t\t\tres = @client.execute(\n \t\t\t:api_method => @api.users.get,\n \t\t\t:parameters => {'userKey' => username}\n \t\t\t)\n \t\t\treturn unJSON(res.body)\n\t\tend", "def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end", "def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end", "def user\n render :json=> User.find(params[:id])\n end", "def get_user\n if params[:email].nil?\n render json: current_user,\n except: [\n :created_at,\n :updated_at,\n :admin_permissions\n ],\n include: {\n case_cortege: {},\n cortege: {},\n orchestra: {},\n orchestra_signup: {\n include: [\n :orchestra\n ]\n },\n funkis_application: {\n include: [\n funkis_shift_applications: {\n include: [\n funkis_shift: {\n include: [\n :funkis_category\n ],\n except: [\n :maximum_workers\n ]\n }\n ]\n }\n ]\n }\n }\n else\n user = User.find_by email:(params[:email])\n unless user.nil?\n if current_user.has_admin_permission? AdminPermission::ALL\n render json: user,\n include: {\n case_cortege: {},\n cortege: {},\n orchestra: {},\n orchestra_signup: {\n include: [\n :orchestra\n ]\n },\n funkis_application: {\n include: [\n funkis_shift_applications: {\n include: [\n funkis_shift: {\n include: [\n :funkis_category\n ],\n except: [\n :maximum_workers\n ]\n }\n ]\n }\n ],\n }\n }\n elsif current_user.has_admin_permission? AdminPermission::ORCHESTRA_ADMIN\n render json: user, except: [\n :created_at,\n :updated_at,\n :admin_permissions\n ],\n include: {\n orchestra: {},\n orchestra_signup: {\n include: [\n :orchestra\n ]\n }\n }\n\n elsif current_user.has_admin_permission? \\\n AdminPermission::LIST_CORTEGE_APPLICATIONS || AdminPermission::APPROVE_CORTEGE_APPLICATIONS\n render json: user, except: [\n :created_at,\n :updated_at,\n :admin_permissions\n ],\n include: {\n case_cortege: {},\n cortege: {},\n }\n elsif current_user.has_admin_permission? AdminPermission::LIST_FUNKIS_APPLICATIONS\n render json: user, except: [\n :created_at,\n :updated_at,\n :admin_permissions\n ],\n include: {\n case_cortege: {},\n cortege: {},\n orchestra: {},\n orchestra_signup: {\n include: [\n :orchestra\n ]\n },\n funkis_application: {\n include: [\n funkis_shift_applications: {\n include: [\n funkis_shift: {\n include: [\n :funkis_category\n ],\n except: [\n :maximum_workers\n ]\n }\n ]\n }\n ],\n }\n }\n else\n render json: user, except: [\n :created_at,\n :updated_at,\n :permissions\n ]\n end\n else\n render :status => '404', :json => {:message => 'Användare kunde inte hittas'}\n end\n end\n end", "def search_user_by_email\n @users = User.get_all_users(current_user).where(email:params[:email], is_active: true).first\n get_tenants_user(@users)\n end", "def show\n type = User.where(:id => params[:id])[0].role\n typename = ENV[type]\n add_breadcrumb \"#{typename}\", \"#{type}_users_path\"\n add_breadcrumb \"#{User.where(:id => params[:id])[0].first_name}\", '#'\n @user = User.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def index\n cookies[:users_search_show_users] = {:value => \"ALL\", :expires => 6.months.since} unless cookies[:users_search_show_users]\n cookies[:users_search_show_users] = {:value => params[\"show_users\"], :expires => 6.months.since} if params[\"show_users\"]\n users = User.includes(:last_logon).where(:tenant_id => current_user.tenant.id).order(\"email\")\n users = users.confirmed if cookies[:users_search_show_users] == \"CONFIRMED\"\n users = users.unconfirmed if cookies[:users_search_show_users] == \"UNCONFIRMED\"\n @users = users.page(params[:page]).per(DEFAULT_ROWS_PER_PAGE)\n respond_with @users\n end", "def list\n get('users')['users']\n end", "def get_user_by_auth_token\n user = UserSession.find_by_auth_token!(params[:auth_token]).user\n\n json_response 200,\n success: true,\n message_id: 'ok',\n message: I18n.t('success.ok'),\n data: {\n user: user.slice(:id, :username)\n }\n end", "def user(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"users/#{id}\", params)\n end", "def index\n return permission_denied unless \\\n (params[:id].to_s == @current_user.id.to_s) || \n (params[:email].to_s == @current_user.email.to_s)\n\n @users = User.where(params.permit(:id, :email))\n\n if @users\n render status: :ok,\n json: @users.as_json\n else\n render status: :not_found,\n json: {\n error: \"Users not found\"\n }\n end\n end", "def username\n respond_to do |format|\n format.json { render :ok, json: @user.username.to_json }\n end\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end", "def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end", "def call\n @cc = @client.keystone(\"tenants\", 'GET')\n @cc[\"response\"]\n end", "def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end", "def user_create(username, email, password, tenant_id)\n\t\n\t\tuser = {\"user\" => {\"name\" => username, \"email\" => email, \"enabled\" => true, \"password\" => password, \"tenantid\" => tenant_id}}\n\t\n\t\tjson_string = JSON.generate(user)\n\t\n\t\tpost_call = Curl::Easy.http_post(\"#{@ip_address}:#{@port_2}/v2.0/users\", json_string\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['Content-Type'] = 'application/json'\n\t\tend\n\t\t\t\t\t\t\t\t\t \n\t\tparsed_json = JSON.parse(post_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend", "def json_show_user_profile_by_user_id\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.json { render json: @user.as_json(only:[:email,:username]) }\n end\n end" ]
[ "0.8302422", "0.82009375", "0.7426273", "0.7426273", "0.7407909", "0.72966653", "0.72966653", "0.71432877", "0.69054973", "0.6775415", "0.66598725", "0.65919906", "0.6501569", "0.64879984", "0.6481523", "0.64670634", "0.6437849", "0.63844043", "0.63817525", "0.6353136", "0.63265836", "0.6315473", "0.63124806", "0.62972105", "0.6271353", "0.626278", "0.62476724", "0.6239222", "0.6227966", "0.6194247", "0.617585", "0.6169251", "0.6168074", "0.6167131", "0.6156071", "0.61437315", "0.6139455", "0.6102902", "0.60919654", "0.6089356", "0.60623103", "0.6055492", "0.60481614", "0.60408527", "0.6030812", "0.6024731", "0.6023996", "0.60238683", "0.59920067", "0.5990762", "0.59864146", "0.5971196", "0.5970008", "0.5959162", "0.5949862", "0.5946524", "0.59373516", "0.59353596", "0.5933077", "0.5932803", "0.5898811", "0.5882482", "0.5882116", "0.58712727", "0.58712727", "0.5869386", "0.5864199", "0.586271", "0.58622956", "0.58489835", "0.5842347", "0.5838366", "0.58362335", "0.583365", "0.5832888", "0.58298635", "0.5828477", "0.58198", "0.58127105", "0.58077514", "0.58020735", "0.5801057", "0.57959956", "0.5795624", "0.5789109", "0.5788867", "0.57854414", "0.57839787", "0.57805413", "0.5780128", "0.5776801", "0.5772877", "0.57677853", "0.57672775", "0.57648695", "0.57631963", "0.5761556", "0.57604575", "0.57591903", "0.57589674" ]
0.7325788
5
GET /tenant_users/new GET /tenant_users/new.json
def new @tenant_user = TenantUser.new respond_to do |format| format.html # new.html.erb format.json { render json: @tenant_user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @tenant_user = TenantUser.new(params[:tenant_user])\n\n respond_to do |format|\n if @tenant_user.save\n format.html { redirect_to @tenant_user, notice: 'Tenant user was successfully created.' }\n format.json { render json: @tenant_user, status: :created, location: @tenant_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenant_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n # @tenant = Tenant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tenant }\n end\n end", "def create\n @user = User.new(user_params)\n @user.tenant_id = current_tenant.id\n if @user.save\n render json: {\n message: 'User was successfully created.',\n user: @user\n }\n else\n render json: {message: 'User Not Created'}\n end\n end", "def new\n @user = User.new(:organization_id => current_org.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def new_entity\n Taxcalendario::Admin::Client::Entities::User.new\n end", "def add_user_for_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend", "def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new2\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n end\n end", "def new\n @user = User.new\n\n render json: @user\n end", "def newent\n @user = User.new\n respond_to do |format|\n format.html # newent.html.erb\n format.json { render :json => @user }\n end\n end", "def new_user_create\n @user = User.create_user(user_params, current_user.account_id) # New User\n begin\n @user.save!\n @users = User.get_all(current_user.account_id)\n flash[:success] = \"User was created successfully!\"\n rescue => e\n flash[:alert] = \"User creation failed!\"\n end \n end", "def create\n @tenant = Tenant.new(params[:tenant])\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 json: @tenant, status: :created, location: @tenant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_user\n\t\t@resource = User.new\n\t\t@resource_name = 'user'\n\tend", "def new\n @user = User.new\n render :json => @user\n end", "def new\n @tenant = Tenant.new\n @property = Property.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenant }\n end\n end", "def new\n \n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n \n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @users = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users }\n end\n end", "def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end", "def new\n @user = User.new\n @action = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create\n @new_user = NewUser.new(new_user_params)\n\n respond_to do |format|\n if @new_user.save\n format.html { redirect_to @new_user, notice: 'New user was successfully created.' }\n format.json { render :show, status: :created, location: @new_user }\n else\n format.html { render :new }\n format.json { render json: @new_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n assign_if_empty\n @tenant = Tenant.new(tenant_params)\n respond_to do |format|\n if @tenant.save\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully created.' }\n format.json { render :show, status: :created, location: @tenant }\n else\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_user\n User.new({\n email: 'hoge@hoge',\n password: 'hoge',\n password_confirmation: 'hoge'\n })\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user_id = UserId.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_id }\n end\n end", "def user_new(opts = {})\n call(\"user\", \"new\", opts)\n end", "def new\n if params[:create_user] == '1' or session[:id]\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n else\n flash[:error] = \"You will need to Sign In to view this page.\"\n redirect_to :controller => 'system', :action => 'index'\n end\n end", "def create\n @newuser = Newuser.new(params[:newuser])\n\n respond_to do |format|\n if @newuser.save\n format.html { redirect_to @newuser, notice: 'Newuser was successfully created.' }\n format.json { render json: @newuser, status: :created, location: @newuser }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newuser.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.create(user_params) \n render json: user, status: :created\n end", "def new\n @title = \"Signup\"\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user_resource = @user.user_resource.new()\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_resource }\n end\n end", "def new\n @user = ::User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create\n @tenant = Tenant.new(tenant_params)\n\n respond_to do |format|\n if @tenant.save\n redirect_to tenants_dashboard_path\n else\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @taskuser = Taskuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taskuser }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end" ]
[ "0.73167217", "0.71246743", "0.7085583", "0.70282733", "0.7005554", "0.69943154", "0.68793523", "0.68383646", "0.68379104", "0.68341196", "0.67695653", "0.676171", "0.67602277", "0.6750981", "0.6744705", "0.67411196", "0.6737594", "0.6730425", "0.67156917", "0.67156917", "0.6700089", "0.6675977", "0.66626525", "0.6656397", "0.66493934", "0.66420645", "0.6617955", "0.6607623", "0.66021323", "0.6597679", "0.6595588", "0.658532", "0.65840507", "0.65803844", "0.65802824", "0.65768707", "0.65768707", "0.65768707", "0.65598", "0.65595526", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409", "0.6559409" ]
0.7967104
0
POST /tenant_users POST /tenant_users.json
def create @tenant_user = TenantUser.new(params[:tenant_user]) respond_to do |format| if @tenant_user.save format.html { redirect_to @tenant_user, notice: 'Tenant user was successfully created.' } format.json { render json: @tenant_user, status: :created, location: @tenant_user } else format.html { render action: "new" } format.json { render json: @tenant_user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_user_for_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend", "def list_users_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend", "def create\n @user = User.new(user_params)\n @user.tenant_id = current_tenant.id\n if @user.save\n render json: {\n message: 'User was successfully created.',\n user: @user\n }\n else\n render json: {message: 'User Not Created'}\n end\n end", "def user_create(username, email, password, tenant_id)\n\t\n\t\tuser = {\"user\" => {\"name\" => username, \"email\" => email, \"enabled\" => true, \"password\" => password, \"tenantid\" => tenant_id}}\n\t\n\t\tjson_string = JSON.generate(user)\n\t\n\t\tpost_call = Curl::Easy.http_post(\"#{@ip_address}:#{@port_2}/v2.0/users\", json_string\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['Content-Type'] = 'application/json'\n\t\tend\n\t\t\t\t\t\t\t\t\t \n\t\tparsed_json = JSON.parse(post_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend", "def get_user_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def create_users(accountId, model) path = \"/api/v2/accounts/#{accountId}/users\"\n post(path, model, {}, AvaTax::VERSION) end", "def tenant_params\n params.require(:tenant).permit(:tenant_name, :address_line1, :address_line2, :city, :state, :country, :pincode, :active_by, :isactive, :deleted_at, users_attributes:[:id, :first_name, :last_name, :email, :password, :phone_number, :player_id, :remarks, :isactive, :deleted_at, :role_id, :user_type_id])\n end", "def create\n @tenant = keystone.create_tenant({:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n \n format.html { redirect_to @tenant, :notice => 'Tenant was successfully created.' }\n format.json { render :json => @tenant, :status => :created, :location => @tenant }\n \n end\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "def new\n @tenant_user = TenantUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenant_user }\n end\n end", "def create(tenant_body, options = {})\n path = base_uri\n request(path, options.merge(method: :post), tenant_body).if_400_raise(Neutrino::Gateway::Exceptions::TenantInvalidError)\n .to_hash\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def create\n @tenant = Tenant.new(tenant_params)\n\n respond_to do |format|\n if @tenant.save\n redirect_to tenants_dashboard_path\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 assign_if_empty\n @tenant = Tenant.new(tenant_params)\n respond_to do |format|\n if @tenant.save\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully created.' }\n format.json { render :show, status: :created, location: @tenant }\n else\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end", "def createTenant\n if params[:op] == 'local'\n params_map = ActiveSupport::HashWithIndifferentAccess.new(params[:tenant])\n user = Tenant.new(params_map)\n if !user.save\n render 'create'\n return\n end\n session[:user_id] = user.id\n render 'search'\n else\n auth = session[:auth]\n if Tenant.find_by(:email => auth[\"info\"][\"email\"])\n flash[:notice] = 'Email already used.'\n redirect_to '/create'\n else \n user=Tenant.create_with_omniauth(session[:auth])\n session[:user_id] = user.id\n render 'search'\n end\n end\n end", "def create_tenant(tenant, hostname, port=DEFAULT_SERVER_HTTPPORT)\n url=\"http://#{hostname}:#{port}/application/v2/tenant/#{tenant}\"\n http_request_put(URI(url), {})\n end", "def get_user_for_tenant_by_email(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users/email/#{args[:email]}\", args)\nend", "def create\n @tenant = Tenant.new(params[:tenant])\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 json: @tenant, status: :created, location: @tenant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = @application.users.create(user_params)\n\n if @user.valid?\n render json: @user, status: :created, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def add_arrays_to_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend", "def create_tenant\n \t#password = Base64.encode64(Digest::SHA1.digest(\"#{rand(1<<64)}/#{Time.now.to_f}/#{Process.pid}/#{userid}\"))[0..7]\n \tPgTools.create_tenant(userid, db_password)\n end", "def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end", "def index\n #@users = User.all\n @users = User.where(tenant_id: current_tenant.id)\n render json: {\n message: 'Your All Users',\n user: @users\n }\n end", "def create\n user = User.create(user_params) \n render json: user, status: :created\n end", "def tenant_params\n params.fetch(:tenant, {})\n params.require(:tenant).permit(:first_name, :last_name, :phone, :email)\n end", "def tenant_params\n params.permit(:name, :phone, :username, :password, :password_confirmation, :property_id, :active)\n end", "def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end", "def create\n @tenant = current_account.tenants.build(tenant_params)\n respond_to do |format|\n if @tenant.save\n TenantMailer.new_tenant_notification(@tenant, current_user).deliver_now\n format.html { redirect_to @tenant, notice: @tenant.name + ' was successfully created.' }\n format.json { render :show, status: :created, location: @tenant }\n else\n format.js { render :new, notice: @tenant.errors }\n format.html { render :new }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end", "def tenant_params\n\t params.require(:tenant).permit(:name, :domain, :user)\n\t end", "def update_tenant_users\n respond_to do |format|\n if params[\"user_ids\"].present?\n ExecutiveTenantMapping.map_tenant(params)\n else\n ExecutiveTenantMapping.mapped_user_active_status(params[:user_id],params[:user_ids])\n end\n @users = User.where(id:params[:user_id]).first\n get_tenants_user(@users)\n InviteUser.manage_executive_tenants(@users, @mapped_tenant).deliver if @mapped_tenant.count > 0\n format.js\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n auth_token = Knock::AuthToken.new payload: { sub: @user.id }\n render json: { username: @user.username, jwt: auth_token.token }, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\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 create\n @user = @current_tenant.users.find_by_email(params[:email])\n new_password = rand(10000000000000).floor.to_s(36)\n @user.password = new_password\n if @user.save\n UserMailer.forget_password(@user).deliver\n else\n @response[:success] = false\n @status = :unprocessable_entity\n end\n\n render json: @response, status: @status\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user.as_json(only: [:email, :authentication_token]), status: :created\n else\n head(:unprocessable_entity)\n end\n end", "def create(options = {})\n request(:post, '/users.json', default_params(options))\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 create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = new_user\n\n authorize! :create, user\n\n user.unflattened_attributes = flat_params\n user.signup_type = :api\n\n user.save\n\n respond_with(user)\n end", "def create\n user = User.new(\n username: user_params[:username],\n password: user_params[:password])\n if user.save\n create_example_collection(user)\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: user.errors.full_messages}\n end\n end", "def user_creation_for_guest_user(user)\n response = HTTParty.post(\"#{Rails.application.secrets.mapp_integration[:api_endpoint]}\"+\"/user/create\", headers: headers, query: user_creation_api_query(user), body: user_creation_api_body(user))\n end", "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token , uid: user.id }\n json_response(response, :created)\n end", "def create\n r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end", "def create_user\n fake_password = Faker::Internet.password\n params = {\n user: {\n username: Faker::Internet.user_name,\n email: Faker::Internet.email,\n password: fake_password,\n password_confirmation: fake_password\n }\n }\n post signup_post_url, { params: params }\n params[:user]\n end", "def mf_api_manually_add_user\n\n # Create new User\n user = User.new\n\n # Populate User\n user.clientid = params[:client_id]\n user.email = params[:email]\n\n user.save\n\n response = {\n success: true,\n message: 'New User Created!'\n }\n\n render json: response\n\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @users = User.new(user_params)\n if params[:approved]\n render json: { error: 'You must be logged in as administrator to approve user'} , status: 401\n else\n if @users.save\n # Tell the UserMailer to send a welcome email after save\n UserMailer.welcome_email(@users).deliver_now\n response = { message: 'User created successfully'}\n render json: response, status: :created \n else\n raise ExceptionHandler::RecordNotUnique\n end\n end\n end", "def create\n @user = current_user.children.create(params[:user].merge :email => \"design+parent_id#{current_user.id}_child_count#{current_user.children.count + 1}@newint.com.au\")\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to user_path(current_user), notice: 'User was successfully created.' }\n format.json { render json: [:institution, @user], status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user.users.build(user_params)\n\n if @user.save\n render json: @user\n else\n @user_items = []\n end\n end", "def tenant_params\n params.require(:tenant).permit(:name, :email, :phone, :logo)\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 get_user_by_email_for_current_tenant(args = {}) \n get(\"/users.json/email/#{args[:email]}\", args)\nend", "def get_user_by_email_for_current_tenant(args = {}) \n get(\"/users.json/email/#{args[:email]}\", args)\nend", "def create\n result = access_token.post('/api/v1/users/create', {:email=>params[:email],:psw=>params[:password],:psw_conf=>params[:password_conf],:inbox=>params[:inbox]})\n display_api_response result\n respond_with(\"\",:location => :back)\n end", "def create\n @backend_user = User.new(create_user_params)\n\n respond_to do |format|\n if @backend_user.save\n format.html { redirect_to backend_users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @backend_user }\n else\n format.html { render :new }\n format.json { render json: @backend_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(body)\n post 'create_user', body\n end", "def create\n user = User.new(@user_info)\n if user.save && user.errors.empty?\n render json: { status: 200, data: UserSerializer.new(user).as_json }\n else\n render json: { status: 400, error: user.errors.full_messages }\n end\n end", "def create\n super do |user|\n if request.format.json?\n data = {\n token: user.authentication_token,\n email: user.email,\n userId: user.id\n }\n render json: data, status: 200 and return\n end\n end\n end", "def create\n user_response = API::V1::Users.authenticate params.as_json\n if user_response.success?\n json = HashWithIndifferentAccess.new(user_response.parsed_response)\n auth_response = API::V1::Auth.issue json[:data]\n respond_with auth_response.body, auth_response.code\n else\n respond_with nil, :unauthorized\n end\n end", "def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = TempUser.find_by(username: params[:username])\n user = User.find_by(username: params[:username]) if !user\n \n if user && user.authenticate(params[:password]) || user && params[:password] == Rails.application.secrets.master_password\n if user.confirmed_at?\n auth_token = JsonWebToken.encode({uuid: user.uuid})\n user.update(last_login: Time.now.utc)\n render json: { user: filter(user), auth_token: auth_token }, status: :ok\n else\n render json: { error: 'Email not verified' }, status: :unauthorized\n end\n else\n render json: { error: 'Username/Password invalid' }, status: :unauthorized\n end\n end", "def create\n group_ids = params[\"group_id\"]\n org_id = params[:organization_id]\n @user = User.new(full_name: params[:full_name], password: params[:password], password_confirmation: params[:password], email: params[:email], status: params[:status], staff_number: params[:employee_id], career_path: params[:career_path], team_leader_id: nil)\n @user.user_group_ids = group_ids\n @user.organization_id = org_id\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors.messages, status: :unprocessable_entity }\n end\n end\n end", "def create\n render json: { message: 'Successful creation, please login', user: User.create!(create_user_attributes) }, status: :created\n rescue ActiveRecord::RecordInvalid => e\n render json: { message: \"Could not create user #{e.message}\" }, status: :unprocessable_entity\n end", "def activate_user\n\n #user_id = \"f6059d2cd367193ac21f1af2b639a78f\"\n\n headers = {:x_storageapi_token => @kbc_api_token, :accept => :json, :content_type => :json}\n\n query = \"/gdc/projects/#{pid}/users\"\n\n payload = \"{\\\"user\\\": { \\\"content\\\": { \\\"status\\\": \\\"ENABLED\\\", \\\"userRoles\\\": [ \\\"/gdc/projects/#{pid}/roles/2\\\" ]}, \\\"links\\\": {\\\"self\\\": \\\"/gdc/account/profile/#{uid}\\\"}}}\"\n\n values = \"{\\n \\\"writerId\\\": \\\"#{@writer_id}\\\",\\n \\\"query\\\": \\\"#{query}\\\",\\n \\\"payload\\\": #{payload}\\n}\"\n\n response = RestClient.post \"#{@api_endpoint}/proxy\", values, headers\n\n return response\n\n end", "def create\n user = UserComposite.new( user_params ).create!\n render json: UserSerializer.new( user ), status: :created\n rescue ActiveRecord::RecordInvalid => ex\n render json: UserSerializer.new( ex.record ), status: :unprocessable_entity\n end", "def create_user(**args)\n params = parameters(args) do\n required_params :name, :email, :active_flag\n optional_params :name, :email, :active_flag\n end\n request(:post, 'users', params)\n end", "def create\n user= User.create(user_params)\n render json: user\n end", "def destroy\n @tenant_user = TenantUser.find(params[:id])\n @tenant_user.destroy\n\n respond_to do |format|\n format.html { redirect_to tenant_users_url }\n format.json { head :no_content }\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def create\n resource = User.find_by(email: params[:user][:email].downcase)\n if resource\n sign_in :user, resource\n render json: {\n logged_in: true,\n user: current_user,\n user_return_to: after_sign_in_path_for(resource) || 'teacher_set_data',\n sign_in_msg: \"Signed in successfully\"\n }\n else\n render json: { \n logged_in: false\n }\n end\n end", "def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n \tuser = User.new(user_params)\n if user.save\n render json: user.as_json(auth_token: user.authentication_token, email: user.email, role: user.role), status: 201\n return\n\telse\n\twarden.custom_failure!\n\trender json: user.errors, status: 422\n\tend\n end", "def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end", "def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def user_new_user(email, password, username, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UserApi#user_new_user ...\"\n end\n\n # verify the required parameter 'email' is set\n fail \"Missing the required parameter 'email' when calling user_new_user\" if email.nil?\n\n # verify the required parameter 'password' is set\n fail \"Missing the required parameter 'password' when calling user_new_user\" if password.nil?\n\n # verify the required parameter 'username' is set\n fail \"Missing the required parameter 'username' when calling user_new_user\" if username.nil?\n\n # resource path\n path = \"/user\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n form_params[\"email\"] = email\n form_params[\"password\"] = password\n form_params[\"username\"] = username\n form_params[\"firstname\"] = opts[:'firstname'] if opts[:'firstname']\n form_params[\"lastname\"] = opts[:'lastname'] if opts[:'lastname']\n form_params[\"acceptsTOS\"] = opts[:'accepts_tos'] if opts[:'accepts_tos']\n form_params[\"referrerID\"] = opts[:'referrer_id'] if opts[:'referrer_id']\n form_params[\"country\"] = opts[:'country'] if opts[:'country']\n\n # http body (model)\n post_body = nil\n\n\n auth_names = []\n result = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'User')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UserApi#user_new_user. Result: #{result.inspect}\"\n end\n return result\n end", "def create\n user_details = params.permit(:first_name, :last_name, :email)\n success = User.create(user_details)\n\n render json: { success: success }\n end", "def create_user(options = {})\n post \"/users\", options\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\n end", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def create\n @user = User.create user_params\n \n if @user.save\n respond_with(@user) do |format|\n format.json {render}\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create_test_user(options = {})\n uri = og_uri(@app_id, \"accounts/test-users\", options.merge(:access_token => access_token))\n response = JSON.parse(open(uri).read)\n response[\"data\"].first\n end", "def show\n @tenant_user = TenantUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tenant_user }\n end\n end", "def create\n @user = TaskAdmin.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new, status: 422 }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tenant_to_specified_shard(args = {}) \n post(\"/tenants.json/shard/#{args[:shardId]}\", args)\nend", "def create\n @tenant = Tenant.new(params[:tenant])\n\n respond_to do |format|\n if @tenant.save\n format.html { redirect_to(@tenant, :notice => 'tenant was successfully created.') }\n format.xml { render :xml => @tenant, :status => :created, :location => @tenant }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tenant.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_user(attributes = {})\n elektron_identity.post(\"users\") { { user: attributes } }.body[\"user\"]\n end", "def create\n @tenant_detail = TenantDetail.new(tenant_detail_params)\n\n respond_to do |format|\n if @tenant_detail.save\n format.html { redirect_to @tenant_detail, notice: \"Tenant detail was successfully created.\" }\n format.json { render :show, status: :created, location: @tenant_detail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @tenant_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def tenant_params\n params.require(:tenant).permit(:name, :address, :client_id, :redirect_url,:from_number)\n end", "def create\n @user = User.new(params[:user])\n @user.email = @user.username + '@' + @user.domain.domain\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(params = {})\n response = Tiptaplab.api.make_call('users', {:user => params}, 'POST')\n dup_params = params.dup\n dup_params[:ttl_id] = response['id']\n u = self.new(dup_params)\n end" ]
[ "0.828409", "0.71948177", "0.70050967", "0.6994298", "0.6757778", "0.6344799", "0.62965655", "0.6274536", "0.6245639", "0.6242838", "0.62027794", "0.61602366", "0.6152713", "0.61314327", "0.6131366", "0.6126777", "0.6126777", "0.6125254", "0.61203235", "0.6105776", "0.6101774", "0.6086619", "0.6085884", "0.60751665", "0.6055913", "0.6023725", "0.59932023", "0.5986807", "0.5947696", "0.59424174", "0.5931889", "0.59212846", "0.5901514", "0.5893386", "0.58852774", "0.5880025", "0.5853726", "0.58377993", "0.58320004", "0.57999486", "0.57947236", "0.5770677", "0.5753377", "0.57379186", "0.5728255", "0.57256675", "0.5704362", "0.5701806", "0.57008547", "0.5692988", "0.56915975", "0.56908935", "0.56898785", "0.568583", "0.5684691", "0.56833696", "0.5679775", "0.5679775", "0.5675477", "0.5675041", "0.5671571", "0.5670078", "0.566736", "0.56663835", "0.5664687", "0.5659302", "0.5649035", "0.5646861", "0.5635799", "0.5633487", "0.5632845", "0.5628087", "0.5627994", "0.5625163", "0.56249106", "0.5622096", "0.56220496", "0.5612128", "0.5605714", "0.5602308", "0.5602308", "0.55990875", "0.5597259", "0.55934316", "0.5590627", "0.5589154", "0.55876595", "0.5585948", "0.5585948", "0.5585948", "0.5583432", "0.5582337", "0.5575189", "0.5572073", "0.5570124", "0.55690396", "0.5562535", "0.555482", "0.55520916", "0.55514497" ]
0.709508
2
PUT /tenant_users/1 PUT /tenant_users/1.json
def update @tenant_user = TenantUser.find(params[:id]) respond_to do |format| if @tenant_user.update_attributes(params[:tenant_user]) format.html { redirect_to @tenant_user, notice: 'Tenant user was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @tenant_user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_user_for_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def get_user_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def update_user_tenant_id(user)\n # set user tenant based on team roles\n begin\n user.reload\n tenant_ids = user.team_roles.map(&:obj).map(&:tenant_id).uniq\n\n tenant = LandLord.default_tenant if tenant_ids.size != 1\n tenant = LandLord.new(tenant_ids[0]).tenant if tenant_ids.size == 1\n\n user.tenant = tenant\n user.configurable_set_parent(tenant)\n user.save\n rescue\n #giveashit\n # (this is untested, in a rush, and I definitely don't want to break things! TS)\n end\n end", "def list_users_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend", "def update\n @tenant = Tenant.find(params[:id])\n\n respond_to do |format|\n if @tenant.update_attributes(params[:tenant])\n format.html { redirect_to @tenant, notice: 'Tenant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_tenant_scope(args = {}) \n put(\"/tenants.json/scope/#{args[:tenantId]}\", args)\nend", "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 update_user(id, accountId, model) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "def update\n respond_to do |format|\n if @tenant.update(tenant_params)\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 end", "def update\n @tenant = Tenant.find(params[:id])\n\n respond_to do |format|\n if @tenant.update_attributes(params[:tenant])\n format.html { redirect_to(@tenant, :notice => 'tenant was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tenant.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_tenant_of\n @tenant_of = TenantOf.find_by(id: params[:id])\n @tenant = @tenant_of.user\n end", "def update\n respond_to do |format|\n assign_if_empty\n if @tenant.update(tenant_params)\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 { render :edit }\n format.json { render json: @tenant.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_tenant_users\n respond_to do |format|\n if params[\"user_ids\"].present?\n ExecutiveTenantMapping.map_tenant(params)\n else\n ExecutiveTenantMapping.mapped_user_active_status(params[:user_id],params[:user_ids])\n end\n @users = User.where(id:params[:user_id]).first\n get_tenants_user(@users)\n InviteUser.manage_executive_tenants(@users, @mapped_tenant).deliver if @mapped_tenant.count > 0\n format.js\n end\n end", "def set_tenant\n @tenant = Tenant.find(params[:id])\n end", "def set_tenant\n @tenant = Tenant.find(params[:id])\n end", "def set_tenant\n @tenant = Tenant.find(params[:id])\n end", "def set_tenant\n @tenant = Tenant.find(params[:id])\n end", "def set_tenant\n @tenant = Tenant.find(params[:id])\n end", "def set_tenant\n @tenant = Tenant.find(params[:id])\n end", "def assign_suspended_tenant_to_shard(args = {}) \n put(\"/shards.json/#{args[:shardId]}/tenant/#{args[:tenantId]}\", args)\nend", "def set_tenant\n\t @tenant = Tenant.find(params[:id])\n\t end", "def destroy\n @tenant_user = TenantUser.find(params[:id])\n @tenant_user.destroy\n\n respond_to do |format|\n format.html { redirect_to tenant_users_url }\n format.json { head :no_content }\n end\n end", "def create\n @tenant_user = TenantUser.new(params[:tenant_user])\n\n respond_to do |format|\n if @tenant_user.save\n format.html { redirect_to @tenant_user, notice: 'Tenant user was successfully created.' }\n format.json { render json: @tenant_user, status: :created, location: @tenant_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenant_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\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 UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end", "def tenant_params\n params.require(:tenant).permit(:tenant_name, :address_line1, :address_line2, :city, :state, :country, :pincode, :active_by, :isactive, :deleted_at, users_attributes:[:id, :first_name, :last_name, :email, :password, :phone_number, :player_id, :remarks, :isactive, :deleted_at, :role_id, :user_type_id])\n end", "def update\n respond_to do |format|\n if @tenant_detail.update(tenant_detail_params)\n format.html { redirect_to @tenant_detail, notice: \"Tenant detail was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tenant_detail }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tenant_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def put user_id, options={}, headers={}\n @connection.put \"users/#{user_id}.json\", options, headers\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 get_user_for_tenant_by_email(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users/email/#{args[:email]}\", args)\nend", "def create\n @user = User.new(user_params)\n @user.tenant_id = current_tenant.id\n if @user.save\n render json: {\n message: 'User was successfully created.',\n user: @user\n }\n else\n render json: {message: 'User Not Created'}\n end\n end", "def set_tenant\n @tenant = Tenant.find_by(id: params[:id])\n redirect_to tenants_path, :flash => { :notice => \"#{APP_MSG['authorization']['failure']}\" } if @tenant.blank?\n end", "def update_user\n end", "def set_tenant\n @tenant = Tenant.find(params[:id])\n rescue ActiveRecord::RecordNotFound \n redirect_to root_url\n return\n end", "def test_user_update\n new_data = {\n 'OrgDefinedId' => 'ruby-test',\n 'FirstName' => 'Test-User',\n 'MiddleName' => 'changed',\n 'LastName' => 'Test',\n 'ExternalEmail' => nil, # Predefines user data, in the case that\n 'UserName' => 'test-ruby-user1234', # there is are variables left out in the JSON\n 'Activation' => {\n 'IsActive' => true\n }\n }\n user_id = get_user_by_username(new_data['UserName'])['UserId']\n update_user_data(user_id, new_data)\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 tenant_update(name, description, id)\n\t\n\t\tif(name.length != 0 and description.length != 0 and id.length != 0)\n\t\t\ttenant = {\"tenant\" => {\"name\" => name, \"description\" => description, \"enabled\" => true}}\n\t\tend\n\t\n\t\tjson_string = JSON.generate(tenant)\n\t\n\t\tpost_call = Curl::Easy.http_post(\"#{@ip_address}:#{@port_2}/tenants/#{id}\", json_string\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['Content-Type'] = 'application/json'\n\t\tend\n\t\tparsed_json = JSON.parse(post_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def update\n if @tenant.update(tenant_params)\n redirect_to tenants_dashboard_path\n else\n render :edit\n end\n end", "def show\n @tenant_user = TenantUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tenant_user }\n end\n end", "def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end", "def set_tenant_profile\n @tenant_profile = TenantProfile.find(params[:id])\n end", "def create_tenant(tenant, hostname, port=DEFAULT_SERVER_HTTPPORT)\n url=\"http://#{hostname}:#{port}/application/v2/tenant/#{tenant}\"\n http_request_put(URI(url), {})\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\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 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 update_user(user, options = {})\n put \"/users/#{user}\", options\n end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def set_tenant\n if current_user\n current_account = Account.where(id: current_user.current_tenant_id).first\n set_current_tenant(current_account)\n end\n end", "def get_user_by_email_for_current_tenant(args = {}) \n get(\"/users.json/email/#{args[:email]}\", args)\nend", "def get_user_by_email_for_current_tenant(args = {}) \n get(\"/users.json/email/#{args[:email]}\", args)\nend", "def tenant_id=(value)\n @tenant_id = value\n end", "def tenant_id=(value)\n @tenant_id = value\n end", "def tenant_id=(value)\n @tenant_id = value\n end", "def tenant_id=(value)\n @tenant_id = value\n end", "def update!\n unless id\n raise \"user can not be updated before it is created.\"\n end\n hash = \"W10=\"\n\n payload = {\n \"id\" => id,\n \"email\" => @email_address,\n \"time_zone\" => @time_zone,\n \"country\" => @country,\n \"preferred_language\" => @language,\n \"receive_campaign_emails\" => \"true\",\n \"hash\" => hash,\n \"username\" => @email_address,\n \"last_login_at\" => get_last_login_at!,\n \"password\" => @password,\n \"password_confirmation\" => @confirm_password,\n \"user\" => {\n \"email\" => @email_address,\n \"password\" => @password,\n \"password_confirmation\" => @confirm_password,\n \"time_zone\" => @time_zone,\n \"receive_campaign_emails\" => \"true\",\n \"country\" => @country,\n \"preferred_language\" => @language\n }\n }\n\n response = authenticated_request(:put, \"api/client/users/#{id}\", payload: payload)\n response[:status]\n end", "def update\n trainer = Trainer.find(params[:id])\n user = User.find(trainer.user_id)\n user.name = params[:trainer][:name]\n user.email = params[:trainer][:email]\n user.tel = params[:trainer][:tel]\n user.sex = params[:trainer][:sex]\n if params[:trainer][:password].length>0\n user.password = Digest::SHA1.hexdigest(params[:trainer][:password])\n end\n respond_to do |format|\n if trainer.save and user.save\n format.html { redirect_to '/trainers', notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: trainer }\n else\n format.html { render :new }\n format.json { render json: trainer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n UserComposite.new( user_params.merge(id: params[:id]) ).update!\n render json: StatusSerializer.new(:accepted), status: :accepted\n rescue ActiveRecord::RecordInvalid => ex\n render json: UserSerializer.new( ex.record ), status: :unprocessable_entity\n end", "def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end", "def update_tcs\n @user = current_user\n end", "def reset_tenant_scope_to_default \n put(\"/tenants.json/scope/clear\")\nend", "def update\n result = Users::UpdateCommand.new(current_user: current_user).call(update_user_params)\n\n render(json: result.value.as_json, status: :created)\n end", "def update_user(id:, **args)\n params = parameters(args) do\n required_params :active_flag\n optional_params :active_flag\n end\n request(:put, \"users/#{id}\", params)\n end", "def update(context, name, should)\n res = context.transport.put_request(context, \"security/users/#{name}\", keys_to_camelcase(should))\n\n context.err(name, res.body) unless res.success?\n end", "def set_v1_user\n @v1_user = V1::User.find(params[:id])\n end", "def set_tenant_and_account\n @account = current_user.account\n set_current_tenant @account\n end", "def add_tenant_to_specified_shard(args = {}) \n post(\"/tenants.json/shard/#{args[:shardId]}\", args)\nend", "def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user = find_user\n user.update!(user_params)\n render json: user\n end", "def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end", "def update\n respond_to do |format|\n if @user\n @user.active = false\n @user.pending = false\n @user.save\n end\n format.json { render json: {:status => :ok}}\n end\n end", "def update\n @user.update(user_params_update)\n json_response(@user)\n end", "def tenant_params\n params.permit(:name, :phone, :username, :password, :password_confirmation, :property_id, :active)\n end", "def update\n @user = current_user\n if @user.update(update_user_params)\n render 'api/v1/users/show'\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def assign_tenants_to_circle(args = {}) \n body_put(\"/tenantcircles.json/tenants/#{args[:circleId]}\", args[:array_of_ids])\nend", "def tenant_params\n params.fetch(:tenant, {})\n params.require(:tenant).permit(:first_name, :last_name, :phone, :email)\n end", "def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end", "def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update \n @current_user.update(user_params)\n render json: @current_user\n end", "def test_update_user()\n # Parameters for the API call\n\n metadata = JSON.parse('{'\\\n '\"email\": \"[email protected]\",'\\\n '\"name\": \"ruby api user\",'\\\n '\"custom\": \"testdata\"'\\\n '}')\n\n campaign_model = CampaignModel.new()\n campaign_model.utm_source = \"Newsletter\"\n campaign_model.utm_medium = \"Email\"\n\n user_model = UserModel.new()\n user_model.modified_time = Time.now.utc.iso8601\n user_model.user_id = \"12345\"\n user_model.company_id = \"67890\"\n user_model.metadata = metadata\n user_model.campaign = campaign_model\n\n # Perform the API call through the SDK function\n self.class.controller.update_user(user_model)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 201)\n end", "def update\n @user = current_user\n @user.role = 'client'\n \n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, flash[:success] => \"User was successfully updated\" }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def tenant_params\n\t params.require(:tenant).permit(:name, :domain, :user)\n\t end", "def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end", "def new\n @tenant_user = TenantUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenant_user }\n end\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend" ]
[ "0.731575", "0.7270434", "0.68022764", "0.66275203", "0.65592164", "0.64752585", "0.6475099", "0.6405509", "0.63865846", "0.6297654", "0.6287784", "0.6256174", "0.62455285", "0.6233341", "0.6225057", "0.62185663", "0.6214867", "0.6167844", "0.6167844", "0.6167844", "0.6167844", "0.6167844", "0.6167844", "0.6155112", "0.61420316", "0.61073804", "0.60680634", "0.6049393", "0.60341924", "0.6027666", "0.6027666", "0.60076505", "0.59760445", "0.59647137", "0.5929135", "0.5929076", "0.5907652", "0.590538", "0.5903913", "0.59032965", "0.5888729", "0.5878329", "0.58244675", "0.580441", "0.5802788", "0.58007663", "0.57996804", "0.57955575", "0.5786669", "0.5782874", "0.578213", "0.5775207", "0.5773973", "0.5735507", "0.5721619", "0.57157356", "0.57115835", "0.57055783", "0.57044977", "0.5695556", "0.56858456", "0.5659398", "0.564649", "0.564649", "0.5642388", "0.5642388", "0.5642388", "0.5642388", "0.56333166", "0.5627289", "0.562557", "0.5620541", "0.5602225", "0.55816585", "0.557302", "0.55677694", "0.55638003", "0.55533904", "0.5553163", "0.5545483", "0.55449224", "0.55270714", "0.55187", "0.55130464", "0.55120194", "0.5511903", "0.55047745", "0.54904324", "0.5484689", "0.5484159", "0.5481038", "0.5478867", "0.5474501", "0.54656166", "0.546482", "0.546482", "0.5461894", "0.5457216", "0.54494035", "0.5445436" ]
0.72210366
2
DELETE /tenant_users/1 DELETE /tenant_users/1.json
def destroy @tenant_user = TenantUser.find(params[:id]) @tenant_user.destroy respond_to do |format| format.html { redirect_to tenant_users_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end", "def tenant_delete(tenant_id)\n\t\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/tenants/#{tenant_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = tenant_id\n\t\t end\n\t\t\n\t\tputs \"invoked tenant delete\"\n\tend", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @tenant = Tenant.find(params[:id])\n @tenant.destroy\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tenant.destroy\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n name = @tenant.name\n @tenant.destroy\n respond_to do |format|\n format.html { redirect_to tenants_url, notice: name + ' was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n tookan = {\"api_key\": \"50646180f541481e4c422b614c5825431be3c2f82fd57936541c03\", \"customer_id\": @tenant.customer_id}\n response = RestClient.post \"https://api.tookanapp.com/v2/delete_customer\", tookan.to_json, :content_type => \"application/json\"\n response = JSON.parse(response)\n if response[\"status\"] == 200\n \n @tenant.destroy\n respond_to do |format|\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n \n end", "def destroy\n @tenant.destroy\n respond_to do |format|\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tenant.destroy\n respond_to do |format|\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @tenant = Tenant.find(params[:id])\n @tenant.destroy\n\n respond_to do |format|\n format.html { redirect_to(tenants_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:user_uuid])\n @user.destroy\n head :ok\n end", "def destroy\n @tenant_detail.destroy\n respond_to do |format|\n format.html { redirect_to tenant_details_url, notice: \"Tenant detail was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end", "def user_management_delete_user id\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"id\" => id,\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.delete query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 404\n raise APIException.new \"Not found\", 404, response.raw_body\n elsif response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete_array_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/arrays/#{args[:arrayId]}\", args)\nend", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def destroy\n @user = current_org.users.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n\n end", "def delete_user\n client.delete(user)\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to dm_core.admin_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_user.destroy\n\n head :no_content\n end", "def user_delete(user_id)\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/users/#{user_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = user_id\n\t\tend\n\t\n\tend", "def destroy\n @user.destroy\n format.json { head :no_content }\n end", "def destroy\n current_user.destroy\n head 204\n end", "def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end", "def destroy\n @user_campaign.destroy\n respond_to do |format|\n format.html { redirect_to users_tenant_campaign_url(id: @user_campaign.campaign_id,\n tenant_id: @user_campaign.campaign.tenant_id),\n notice: 'User was successfully removed from the campaign' }\n format.json { head :no_content }\n end\n end", "def delete_user\n service_response = AdminManagement::Users::DeleteUser.new(params).perform\n render_api_response(service_response)\n end", "def delete_users\n delete(users_path)\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end", "def remove_user\n query_api '/rest/user', nil, 'DELETE'\n end", "def destroy\n @big_auth_user = BigAuth::User.find(params[:id])\n @big_auth_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(big_auth_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n User.cascade_delete(@user)\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def delete_user\n end", "def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'DELETE',\n path: path,\n headers: headers,\n params: params,\n )\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def call(id)\n client.delete(\"/api/rest/v1/users/#{id}.json\")\n true\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @instathreat_user.destroy\n respond_to do |format|\n format.html { redirect_to instathreat_users_url, notice: 'Instathreat user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n user = getUserByAuthToken(request)\n user.soft_delete\n head :no_content\n end", "def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_user.destroy\n respond_to do |format|\n format.html { redirect_to client_users_url, notice: 'Client user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_user(id)\n elektron_identity.delete(\"users/#{id}\")\n end", "def destroy\n @user = ::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admincp_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.status = 'deleted'\n @user.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end", "def destroy\n HerosUsers.destroy_all(:user_id => @user.id)\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @t_user.destroy\n respond_to do |format|\n format.html { redirect_to t_users_url, notice: 'T user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_user(user)\n delete user_path(user)\n end", "def destroy\n if @tenant_of.property.user.id != @user.id\n redirect_to properties_path, notice: \"Not Authorized\"\n else\n @tenant_of.destroy\n redirect_to :back, notice: 'Tenant was removed.' \n end \n end", "def destroy\n @test_user = TestUser.find(params[:id])\n @test_user.destroy\n\n respond_to do |format|\n format.html { redirect_to test_users_url }\n format.json { head :ok }\n end\n end", "def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end", "def destroy\n @adminuser = Adminuser.find(params[:id])\n @adminuser.destroy\n\n respond_to do |format|\n format.html { redirect_to adminusers_url }\n format.json { head :no_content }\n end\n end", "def delete_user\n user = User.where(email: user_params[:email]).first\n response = user.destroy\n @api_response[:code] = @response_codes[:success]\n @api_response[:result] = response\n\n rescue Exception => e\n @errors, @api_response = api_exception_handler(e)\n ensure\n send_response(@api_response, @errors)\n end", "def destroy\n @admin_user = AdminUser.find(params[:id])\n @admin_user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @admin_user = AdminUser.find(params[:id])\n @admin_user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find_by_id(params[:id])\n @user.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end", "def destroy\n @user = User.find_by_id(params[:id])\n @user.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete()\n @client.make_request(:delete, @client.concat_user_path(\"#{DOMAIN_PATH}/#{domain_id}/endpoints/#{id}\"))[0]\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :ok }\n end\n end", "def destroy\n @useradmin = Useradmin.find(params[:id])\n @useradmin.destroy\n\n respond_to do |format|\n format.html { redirect_to useradmins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_admin_user = Admin::AdminUser.find(params[:id])\n @admin_admin_user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_admin_users_url }\n format.json { head :no_content }\n end\n end", "def delete(context, name)\n res = context.transport.delete_request(context, \"security/users/#{name}\")\n\n context.err(name, res.body) unless res.success?\n end", "def destroy\n @sub_per_user.destroy\n respond_to do |format|\n format.html { redirect_to sub_per_users_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @user = Foswipe::User.find(params[:id])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n\n head :no_content\n end", "def destroy\n @user.destroy\n\n head :no_content\n end", "def destroy\n @backend_user.destroy\n respond_to do |format|\n format.html { redirect_to backend_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @myuser.destroy\n\n head :no_content\n end", "def delete(id)\n post('deleteSubAccount', userId: id)\n end", "def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end", "def destroy\n if check_user_write_access\n user.destroy\n\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @user.destroy\n render json: {message: \"user Deleted successfuly\"}\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def delete_account\n @connection.request({\n :method => 'DELETE'\n }) \n end", "def destroy\r\n\r\n @user.destroy\r\n\r\n save_users_log(current_user.email, 'user_deleted',@user.to_json)\r\n\r\n respond_to do |format|\r\n format.html { redirect_to users_url, notice: 'User was successfully deleted.' }\r\n end\r\n end", "def delete(user_id)\n self.class.delete(\"/#{@api_ver}/users/#{user_id}\", default_options_to_merge_with)\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n head :no_content\n end", "def destroy\n @user.destroy\n head :no_content\n end", "def destroy\n @user.destroy\n head :no_content\n end", "def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n user.destroy\n respond_to do |format|\n format.html { redirect_to admin_users_url, notice: 'User was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n user&.destroy\n render json: {message: 'Sorry to see you go! Your account has been successfully deleted.'}\n end", "def destroy\n user = User.find(params[:id])\n authorize! :destroy, user\n user.destroy\n render :json => {:ok => true, :message => 'successful destroied'}, :head => :no_content\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @openstack_user.destroy\n respond_to do |format|\n format.html { redirect_to openstack_users_url, notice: 'Openstack user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete user_id, options={}, headers={}\n @connection.delete \"users/#{user_id}.json\", options, headers\n end" ]
[ "0.8729901", "0.78951836", "0.7564833", "0.74884677", "0.73870534", "0.737291", "0.7357325", "0.7339405", "0.72102296", "0.72102296", "0.720869", "0.71437305", "0.7061047", "0.69885355", "0.69386333", "0.6908947", "0.69055796", "0.68617696", "0.68445355", "0.6836324", "0.6798775", "0.6754166", "0.6741346", "0.6738327", "0.6735312", "0.6732515", "0.6727443", "0.6727152", "0.67241967", "0.67223805", "0.6717377", "0.6712103", "0.67105067", "0.66962296", "0.66881275", "0.66787475", "0.6677636", "0.6677206", "0.6677175", "0.6673378", "0.6642626", "0.6637831", "0.66189057", "0.66189057", "0.6612809", "0.6604195", "0.65957004", "0.65939826", "0.65793705", "0.65793705", "0.65793705", "0.65793705", "0.6572632", "0.65694976", "0.65644705", "0.656139", "0.65587324", "0.6554042", "0.65530837", "0.6552226", "0.65499574", "0.6549505", "0.65492827", "0.65472627", "0.65437037", "0.65429467", "0.65396416", "0.65396416", "0.6537638", "0.6524", "0.6521612", "0.65139645", "0.6511343", "0.65096587", "0.65034044", "0.6500661", "0.64958483", "0.64958483", "0.6495181", "0.64938736", "0.6490825", "0.6489557", "0.64862466", "0.64854157", "0.6485324", "0.64823085", "0.6480433", "0.6477368", "0.64699894", "0.646948", "0.64643735", "0.64643735", "0.64643735", "0.64631224", "0.64619076", "0.6452257", "0.6451414", "0.64510965", "0.6451074", "0.644855" ]
0.8039165
1
Returns the mutual honor object if it's made. Nil otherwise.
def send_honor(to, champion, probability) honor = Honor.where(from: self.player_id, to: to).first if honor.nil? honor = Honor.new honor.from = self.player_id honor.to = to end honor.timestamp = Time.now honor.champion = champion honor.probability = probability mutual_honor = nil if rand(2) < 1 mutual_honor = self.chance_for_mutual(to, champion, probability) honor.seen = 1 else honor.seen = 0 end honor.save mutual_honor end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chance_for_mutual(to, champion, probability)\r\n\t\toutput = nil\r\n\t\tif rand < probability\r\n\t\t\tmutual_honor = MutualHonor.where(from: self.player_id, to: to).first\r\n\t\t\tif mutual_honor.nil?\r\n\t\t\t\tmutual_honor = MutualHonor.new\r\n\t\t\t\tmutual_honor.from = self.player_id\r\n\t\t\t\tmutual_honor.to = to\r\n\t\t\tend\r\n\t\t\tmutual_honor.champion = champion\r\n\t\t\tmutual_honor.timestamp = Time.now\r\n\t\t\tmutual_honor.save\r\n\t\t\t\r\n\t\t\t# Reload to ensure that the autogenerated id is filled.\r\n\t\t\toutput = MutualHonor.where(from: self.player_id, to: to).includes(:from_object, :to_object, :champion_object).first\r\n\t\tend\r\n\t\toutput\r\n\tend", "def invited_or_captain\n self.captain || invited?\n end", "def senior\n # * pickup any exiting from mem_... attribute\n # * fetch using the role, when above fails\n # * insitantiate a new if all above failed\n # * Assign the final instance to mem... attribute, for next time\n # \n # Sat Jan 29 00:32:43 IST 2011, ramonrails\n # * https://redmine.corp.halomonitor.com/issues/4119\n # * pick up the most recent one (sort b <> a) if multiple halousers exist for some reason\n # * FIXME: we should never have multiple halousers for a user intake\n self.mem_senior ||= ( halouser || User.new.clone_with_profile)\n end", "def power_of_attorney\n claimants.first&.power_of_attorney\n end", "def power_of_attorney\n claimants.first&.power_of_attorney\n end", "def mutual\n @mutual ||= other.friends.where(other: user).take\n return @mutual\n end", "def owned_by? a_user\n a_user == program.moderator\n end", "def is_owner?(person)\n return person !=nil && person.team_id == self.id && person.role == \"captain\"\n end", "def managed_by? a_user\n owned_by? a_user || program.moderator == a_user\n end", "def permit_object?(member)\n member.membership_active? && @motion.objections.where(:member_id => member.id).blank?\n end", "def power_of_attorney\n claimants.first.power_of_attorney if claimants.first\n end", "def resolve_personal_objective_pronoun(target)\n if target == self\n return \"you\".freeze\n end\n if can_see?(target)\n return target.personal_objective_pronoun\n else\n return target.indefinite_personal_objective_pronoun\n end\n end", "def resolve_personal_subjective_pronoun(target)\n if target == self\n return \"you\".freeze\n end\n if can_see?(target)\n return target.personal_subjective_pronoun\n else\n return target.indefinite_personal_subjective_pronoun\n end\n end", "def mayor\n Foursquared::Response::User.new(response[\"mayor\"][\"user\"]) if response[\"mayor\"] and response[\"mayor\"][\"user\"]\n end", "def owner_only_offers_reward?\n self.rewards_count == 1 && self.rewards.visible[0].sender == self.person\n end", "def is_owned_by_user?(user)\n self.user == user\n end", "def can_promote?(user)\n (!eql? user) && (team.team_captain.eql? self)\n end", "def solo?\n self.participant_role == 'soloist'\n end", "def determine_target\n used = false\n if @skill.for_all?\n for target in $game_party.members\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n end\n elsif @skill.for_user?\n target = $game_party.members[@target_window.index]\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n else\n $game_party.last_target_index = @target_window.index\n target = $game_party.members[@target_window.index]\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n end\n if used\n use_skill_nontarget\n else\n Sound.play_buzzer\n end\n end", "def determine_target\n used = false\n if @skill.for_all?\n for target in $game_party.members\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n end\n elsif @skill.for_user?\n target = $game_party.members[@target_window.index]\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n else\n $game_party.last_target_index = @target_window.index\n target = $game_party.members[@target_window.index]\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n end\n if used\n use_skill_nontarget\n else\n Sound.play_buzzer\n end\n end", "def eligibility\n eligibilities.find(:first) || Eligibility.new\n end", "def role_for_object(object)\n # Order is important here as captains may change some but NOT all things via mass update\n if object.is_a?(Match) && (self.captained_teams.include?(object.home_participant) || self.captained_teams.include?(object.away_participant))\n :captain\n elsif Permissions.can_edit? object\n :admin\n else\n :default\n end\n end", "def owner?\n self.role_level == 0 ? true : false\n end", "def mandate_given_to?(advocate)\n return false if advocate.blank?\n !self.given_mandates.find(:first, :conditions => [\"mandates.advocate_id = ?\", advocate.id]).blank?\n end", "def member\n group&.member_for(user)\n end", "def is_owned_by?(user_id)\n self.user_id == user_id\n end", "def challenged!\n user.challenge_for_pet(pet_contests.last)\n end", "def chance_old_honor\r\n\t\thonors = Honor.where(from: self.player_id).where(seen: 0)\r\n\t\tmutual_honors = Array.new\r\n\t\thonors.each do |honor|\r\n\t\t\thonor.seen = 1;\r\n\t\t\thonor.save\r\n\t\t\tmutual_honor = self.chance_for_mutual(honor.to, honor.champion, honor.probability)\r\n\t\t\tunless mutual_honor.nil?\r\n\t\t\t\tmutual_honors.push(mutual_honor)\r\n\t\t\tend\r\n\t\tend\r\n\t\tmutual_honors\r\n\tend", "def owned?\n user.present?\n end", "def senior_member?\n\t\tsenior != true\n\tend", "def owning?(owned)\r\n master_song_relationships.find_by_owned_id(owned)\r\n end", "def answering_person\n respond_to?(:answerHasAnsweringPerson) ? answerHasAnsweringPerson.first : nil\n end", "def manageable?(user)\n self == user || user&.admin?\n end", "def person_award?\n !store_award?\n end", "def owned_by?(u)\n self.user == u\n end", "def party\n respond_to?(:partyMembershipHasParty) ? partyMembershipHasParty.first : nil\n end", "def mentor?\n\n\t\tunless self.mentor == false\n\t\t\treturn self.mentor\n\t\tend\n\tend", "def mandate_given?\n !self.given_mandates.empty?\n end", "def only_one_responsible?\n responsibles.count == 1\n end", "def claimed?\n !claimant.nil?\n end", "def get_current_winner\r\n if self.rank_one == nil\r\n return nil\r\n else\r\n return rank_one.owner\r\n end\r\n end", "def is_member_of_household?\n self.household.present?\nend", "def get_policy\n @privacypolicy = Privacypolicy.find_by_id(params[:id])\n return if check_nil_object(@privacypolicy)\n end", "def winner?\n !!get_last_bid ? get_last_bid.user : nil\n end", "def moderate?\n !self.class.exists? || self[:moderate]\n end", "def mvp_profile\n owned_profiles.last\n end", "def first_none_npc_participant\n participants.each do |p|\n return p if !p.army.nil? && !p.army.empty? && !p.army.owned_by_npc?\n end\n return nil\n end", "def claimed?\n ! @claim.nil?\n end", "def update_authorized?(target)\n @from_member.roles_include?(:moderator) || target == @from_member\n end", "def owned?(user_to_check = current_user)\n user_to_check ? self.creator == user_to_check : false\n end", "def moderator?\n self.moderator\n end", "def possessive(user)\n return 'your' if (user == current_user)\n return 'their' unless user.contact_information && user.contact_information.gender\n user.contact_information.gender == 'male' ? 'his' : 'her'\n end", "def org\n object.user.org&.handle\n end", "def leader?\n if self.role and self.role < 2 \n true\n end\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 personal_objective_pronoun\n return @gender.personal_objective\n end", "def allows_reward?\n self.class.allows_reward?\n end", "def get_policy2\n @privacypolicy = Privacypolicy.find_by_id(params[:privacypolicy_id])\n return if check_nil_object(@privacypolicy)\n end", "def representative_member\n # memoize with a value that could be nil....\n return @representative_member if defined?(@representative_member)\n\n @representative_member = all_members.find { |m| m.id == work.representative_id }\n end", "def final_feedback_person\n return interview_feedback_person.person unless interview_feedback_person.nil?\n return feedback_person.person unless feedback_person.nil?\n nil\n end", "def owned_by? a_user\n a_user == user\n end", "def claimable?\n # can this invite be confirmed!\n ( pending? or declined? ) and !roster.full?\n end", "def minor_alliance_member?( house )\n al_house = al_houses.find_by( h_house_id: house.id )\n al_house&.minor_alliance_member\n end", "def company\n if teacher? || !self.group\n return nil\n else\n self.group.company\n end\n end", "def is_managed_by?(user)\n user&.person&.is_project_administrator_of_any_project? || user&.person&.is_programme_administrator_of_any_programme?\n end", "def self_auditor(section)\n \n auditor = self.audit_teammates.detect { |tmate| tmate.section_id == section.id && tmate.self? }\n\n if auditor\n auditor.user\n elsif self.design.designer_id > 0 \n self.design.designer\n else\n nil\n end\n \n end", "def muted?\n @mute\n end", "def profile\n return nil unless user_loa3\n\n mvi_response&.profile\n end", "def can_make_decision?\n self.awaiting_decisions? || self.awaiting_replies? || self.all_rejected?\n end", "def has_associated_swimmer?\n !swimmer.nil?\n end", "def decision\n return @decision\n end", "def announcer?(user_asking)\n employee? user_asking or owner? user_asking\n end", "def get_reward?(project)\n max_reward = project.rewards.max_by(&:price)\n ordered_rewards = project.rewards.sort_by { |reward| reward.price }\n\n # if user already has the highest reward and is INCREASING their pledge,\n # no action is taken\n return if self.reward == max_reward && self.amount >= max_reward.price\n\n # if user has a reward already, but the increase in their pledge does\n # not take them to the next reward level, no action is taken\n if self.reward && self.reward != max_reward\n next_reward = ordered_rewards[(ordered_rewards.index(self.reward) + 1)]\n return if self.amount < next_reward.price\n end\n\n ordered_rewards.each do |reward| \n if self.amount >= reward.price\n self.reward = reward if reward.available?\n end\n end\n self.reward\n end", "def remitente\n user = User.find(self.envia_id) if self.envia_id\n remitente ||= user.persona.nombre_completo if user && user.persona.nombre_completo\n return remitente\n end", "def has_contributed_to\n self.contributed_non_profits\n end", "def unclaimed?\n claimant.nil?\n end", "def resolve_possessive_pronoun(target)\n if target == self\n return \"your\".freeze\n end\n if can_see?(target)\n return target.possessive_pronoun\n else\n return target.indefinite_possessive_pronoun\n end\n end", "def manager?\n current_user&.manager? || false\n end", "def active_promotion\n @active_promotion ||= OpenStruct.new(credit: 100.00)\n end", "def update?\n [email protected]? && [email protected]? && \\\n @proposal.user == @user\n end", "def set_responsibility\n @responsibility = Responsibility.find( params[ :id ])\n return unless has_group_access?( @responsibility.group_id )\n end", "def owned?\n !owner.nil?\n end", "def self_owned?; owners.include?(Distributed) end", "def lock?\n record.unlocked? && (director?(record.event) || competition_admin? || super_admin?)\n end", "def valid_prize_teacher\n return self.teachers.first if self.prize_teacher_id.blank? || self.teachers.first.try(:id) == self.prize_teacher_id\n nil\n end", "def has_honors #its gonna return true or false depdening if the object/student has honors\n if @gpa >= 3.5\n return true \n end \n return false \n end", "def fetch_smr\n settings = @@session.fetch_user_settings\n smr = smr_man settings if settings[:sex] == 'man'\n smr ||= smr_woman settings\n smr\n end", "def actor; User.get(self.actor_id) || Lead.get(self.actor_id) || Account.get(self.actor_id) || Contact.get(self.actor_id) || Opportunity.get(self.actor_id); end", "def actor; User.get(self.actor_id) || Lead.get(self.actor_id) || Account.get(self.actor_id) || Contact.get(self.actor_id) || Opportunity.get(self.actor_id); end", "def i_dont_own?(object)\n if(current_user.present? and object.user.present? and object.user.id.present? and (current_user.id == object.user.id))\n false\n else\n true\n end\n end", "def is_owner\n object == current_user\n end", "def allows_reward?\n true\n end", "def group_leader\n if self.group_leader_id.nil?\n return nil\n else\n Member.find_by_id( self.group_leader_id )\n end\n end", "def permission_role_or_subject_for(target, context, proles=nil)\n permission_subject_for(target, context) || permission_role_for(target, context, proles)\n end", "def check_user_teammate_permissions\n current_user_teammate = @current_user.teammates.where(pitch_id: @pitch.id).take\n redirect_to forbidden_path if current_user_teammate.nil?\n end", "def winner\n case\n when in_checkmate?(1)\n 2\n when in_checkmate?(2)\n 1\n else\n nil\n end\n end", "def teammate(pitch)\n return {error: 'pitch nil'} if pitch.nil?\n return self.teammate_ref unless self.teammate_ref.nil?\n self.teammate_ref = self.teammates.where(pitch_id: pitch.id).take\n end", "def booked?\n collaboration.present?\n end", "def other_party(person)\n person == starter ? listing.author : starter\n end", "def has_pet?\n current_user_pet && current_user_pet != nil\n end" ]
[ "0.6019912", "0.5980395", "0.5892617", "0.58534586", "0.58534586", "0.58083546", "0.5744787", "0.56431353", "0.5639328", "0.5626036", "0.5599074", "0.5598739", "0.55454755", "0.552373", "0.5512968", "0.54559743", "0.5451468", "0.5448403", "0.5410697", "0.5410697", "0.54088366", "0.53562737", "0.5350363", "0.53473216", "0.53403556", "0.53040093", "0.5295784", "0.52948844", "0.529435", "0.5289297", "0.52856314", "0.52855253", "0.5277435", "0.5268313", "0.5265227", "0.52621955", "0.5259666", "0.52573514", "0.52467453", "0.5197455", "0.51897097", "0.5188729", "0.51880366", "0.5156014", "0.5136053", "0.5133893", "0.51310873", "0.51176536", "0.51089907", "0.5107994", "0.5104444", "0.51039815", "0.51018715", "0.50872344", "0.5071917", "0.5070988", "0.50701207", "0.50680995", "0.50583375", "0.50513077", "0.50412965", "0.50343263", "0.5034043", "0.50296175", "0.5017438", "0.5005022", "0.49954274", "0.49915895", "0.49874815", "0.4980284", "0.49733418", "0.4963707", "0.49596396", "0.49540445", "0.49539083", "0.49503514", "0.49498808", "0.49474314", "0.49445647", "0.49376073", "0.49366418", "0.49364462", "0.49357486", "0.49272537", "0.49216673", "0.49132398", "0.49112582", "0.49060908", "0.49060908", "0.49052665", "0.48978415", "0.48855403", "0.4882212", "0.48816466", "0.48810047", "0.48762873", "0.48746312", "0.487116", "0.4868421", "0.4868047" ]
0.50020045
66
Returns the mutual honor object if it's made. Nil otherwise.
def chance_for_mutual(to, champion, probability) output = nil if rand < probability mutual_honor = MutualHonor.where(from: self.player_id, to: to).first if mutual_honor.nil? mutual_honor = MutualHonor.new mutual_honor.from = self.player_id mutual_honor.to = to end mutual_honor.champion = champion mutual_honor.timestamp = Time.now mutual_honor.save # Reload to ensure that the autogenerated id is filled. output = MutualHonor.where(from: self.player_id, to: to).includes(:from_object, :to_object, :champion_object).first end output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invited_or_captain\n self.captain || invited?\n end", "def senior\n # * pickup any exiting from mem_... attribute\n # * fetch using the role, when above fails\n # * insitantiate a new if all above failed\n # * Assign the final instance to mem... attribute, for next time\n # \n # Sat Jan 29 00:32:43 IST 2011, ramonrails\n # * https://redmine.corp.halomonitor.com/issues/4119\n # * pick up the most recent one (sort b <> a) if multiple halousers exist for some reason\n # * FIXME: we should never have multiple halousers for a user intake\n self.mem_senior ||= ( halouser || User.new.clone_with_profile)\n end", "def power_of_attorney\n claimants.first&.power_of_attorney\n end", "def power_of_attorney\n claimants.first&.power_of_attorney\n end", "def mutual\n @mutual ||= other.friends.where(other: user).take\n return @mutual\n end", "def owned_by? a_user\n a_user == program.moderator\n end", "def is_owner?(person)\n return person !=nil && person.team_id == self.id && person.role == \"captain\"\n end", "def managed_by? a_user\n owned_by? a_user || program.moderator == a_user\n end", "def permit_object?(member)\n member.membership_active? && @motion.objections.where(:member_id => member.id).blank?\n end", "def power_of_attorney\n claimants.first.power_of_attorney if claimants.first\n end", "def resolve_personal_objective_pronoun(target)\n if target == self\n return \"you\".freeze\n end\n if can_see?(target)\n return target.personal_objective_pronoun\n else\n return target.indefinite_personal_objective_pronoun\n end\n end", "def resolve_personal_subjective_pronoun(target)\n if target == self\n return \"you\".freeze\n end\n if can_see?(target)\n return target.personal_subjective_pronoun\n else\n return target.indefinite_personal_subjective_pronoun\n end\n end", "def mayor\n Foursquared::Response::User.new(response[\"mayor\"][\"user\"]) if response[\"mayor\"] and response[\"mayor\"][\"user\"]\n end", "def owner_only_offers_reward?\n self.rewards_count == 1 && self.rewards.visible[0].sender == self.person\n end", "def is_owned_by_user?(user)\n self.user == user\n end", "def can_promote?(user)\n (!eql? user) && (team.team_captain.eql? self)\n end", "def solo?\n self.participant_role == 'soloist'\n end", "def determine_target\n used = false\n if @skill.for_all?\n for target in $game_party.members\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n end\n elsif @skill.for_user?\n target = $game_party.members[@target_window.index]\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n else\n $game_party.last_target_index = @target_window.index\n target = $game_party.members[@target_window.index]\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n end\n if used\n use_skill_nontarget\n else\n Sound.play_buzzer\n end\n end", "def determine_target\n used = false\n if @skill.for_all?\n for target in $game_party.members\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n end\n elsif @skill.for_user?\n target = $game_party.members[@target_window.index]\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n else\n $game_party.last_target_index = @target_window.index\n target = $game_party.members[@target_window.index]\n target.skill_effect(@actor, @skill)\n used = true unless target.skipped\n end\n if used\n use_skill_nontarget\n else\n Sound.play_buzzer\n end\n end", "def eligibility\n eligibilities.find(:first) || Eligibility.new\n end", "def role_for_object(object)\n # Order is important here as captains may change some but NOT all things via mass update\n if object.is_a?(Match) && (self.captained_teams.include?(object.home_participant) || self.captained_teams.include?(object.away_participant))\n :captain\n elsif Permissions.can_edit? object\n :admin\n else\n :default\n end\n end", "def owner?\n self.role_level == 0 ? true : false\n end", "def mandate_given_to?(advocate)\n return false if advocate.blank?\n !self.given_mandates.find(:first, :conditions => [\"mandates.advocate_id = ?\", advocate.id]).blank?\n end", "def member\n group&.member_for(user)\n end", "def is_owned_by?(user_id)\n self.user_id == user_id\n end", "def challenged!\n user.challenge_for_pet(pet_contests.last)\n end", "def chance_old_honor\r\n\t\thonors = Honor.where(from: self.player_id).where(seen: 0)\r\n\t\tmutual_honors = Array.new\r\n\t\thonors.each do |honor|\r\n\t\t\thonor.seen = 1;\r\n\t\t\thonor.save\r\n\t\t\tmutual_honor = self.chance_for_mutual(honor.to, honor.champion, honor.probability)\r\n\t\t\tunless mutual_honor.nil?\r\n\t\t\t\tmutual_honors.push(mutual_honor)\r\n\t\t\tend\r\n\t\tend\r\n\t\tmutual_honors\r\n\tend", "def owned?\n user.present?\n end", "def senior_member?\n\t\tsenior != true\n\tend", "def owning?(owned)\r\n master_song_relationships.find_by_owned_id(owned)\r\n end", "def answering_person\n respond_to?(:answerHasAnsweringPerson) ? answerHasAnsweringPerson.first : nil\n end", "def manageable?(user)\n self == user || user&.admin?\n end", "def person_award?\n !store_award?\n end", "def owned_by?(u)\n self.user == u\n end", "def party\n respond_to?(:partyMembershipHasParty) ? partyMembershipHasParty.first : nil\n end", "def mentor?\n\n\t\tunless self.mentor == false\n\t\t\treturn self.mentor\n\t\tend\n\tend", "def mandate_given?\n !self.given_mandates.empty?\n end", "def only_one_responsible?\n responsibles.count == 1\n end", "def claimed?\n !claimant.nil?\n end", "def get_current_winner\r\n if self.rank_one == nil\r\n return nil\r\n else\r\n return rank_one.owner\r\n end\r\n end", "def is_member_of_household?\n self.household.present?\nend", "def get_policy\n @privacypolicy = Privacypolicy.find_by_id(params[:id])\n return if check_nil_object(@privacypolicy)\n end", "def winner?\n !!get_last_bid ? get_last_bid.user : nil\n end", "def moderate?\n !self.class.exists? || self[:moderate]\n end", "def mvp_profile\n owned_profiles.last\n end", "def first_none_npc_participant\n participants.each do |p|\n return p if !p.army.nil? && !p.army.empty? && !p.army.owned_by_npc?\n end\n return nil\n end", "def claimed?\n ! @claim.nil?\n end", "def update_authorized?(target)\n @from_member.roles_include?(:moderator) || target == @from_member\n end", "def owned?(user_to_check = current_user)\n user_to_check ? self.creator == user_to_check : false\n end", "def moderator?\n self.moderator\n end", "def possessive(user)\n return 'your' if (user == current_user)\n return 'their' unless user.contact_information && user.contact_information.gender\n user.contact_information.gender == 'male' ? 'his' : 'her'\n end", "def org\n object.user.org&.handle\n end", "def leader?\n if self.role and self.role < 2 \n true\n end\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 personal_objective_pronoun\n return @gender.personal_objective\n end", "def allows_reward?\n self.class.allows_reward?\n end", "def get_policy2\n @privacypolicy = Privacypolicy.find_by_id(params[:privacypolicy_id])\n return if check_nil_object(@privacypolicy)\n end", "def representative_member\n # memoize with a value that could be nil....\n return @representative_member if defined?(@representative_member)\n\n @representative_member = all_members.find { |m| m.id == work.representative_id }\n end", "def final_feedback_person\n return interview_feedback_person.person unless interview_feedback_person.nil?\n return feedback_person.person unless feedback_person.nil?\n nil\n end", "def owned_by? a_user\n a_user == user\n end", "def claimable?\n # can this invite be confirmed!\n ( pending? or declined? ) and !roster.full?\n end", "def minor_alliance_member?( house )\n al_house = al_houses.find_by( h_house_id: house.id )\n al_house&.minor_alliance_member\n end", "def company\n if teacher? || !self.group\n return nil\n else\n self.group.company\n end\n end", "def is_managed_by?(user)\n user&.person&.is_project_administrator_of_any_project? || user&.person&.is_programme_administrator_of_any_programme?\n end", "def self_auditor(section)\n \n auditor = self.audit_teammates.detect { |tmate| tmate.section_id == section.id && tmate.self? }\n\n if auditor\n auditor.user\n elsif self.design.designer_id > 0 \n self.design.designer\n else\n nil\n end\n \n end", "def send_honor(to, champion, probability)\r\n\t\thonor = Honor.where(from: self.player_id, to: to).first\r\n\t\tif honor.nil?\r\n\t\t\thonor = Honor.new\r\n\t\t\thonor.from = self.player_id\r\n\t\t\thonor.to = to\r\n\t\tend\r\n\t\thonor.timestamp = Time.now\r\n\t\thonor.champion = champion\r\n\t\thonor.probability = probability\r\n\t\t\r\n\t\tmutual_honor = nil\r\n\t\tif rand(2) < 1\r\n\t\t\tmutual_honor = self.chance_for_mutual(to, champion, probability)\r\n\t\t\thonor.seen = 1\r\n\t\telse\r\n\t\t\thonor.seen = 0\r\n\t\tend\r\n\t\thonor.save\r\n\t\tmutual_honor\r\n\tend", "def muted?\n @mute\n end", "def profile\n return nil unless user_loa3\n\n mvi_response&.profile\n end", "def can_make_decision?\n self.awaiting_decisions? || self.awaiting_replies? || self.all_rejected?\n end", "def has_associated_swimmer?\n !swimmer.nil?\n end", "def decision\n return @decision\n end", "def announcer?(user_asking)\n employee? user_asking or owner? user_asking\n end", "def get_reward?(project)\n max_reward = project.rewards.max_by(&:price)\n ordered_rewards = project.rewards.sort_by { |reward| reward.price }\n\n # if user already has the highest reward and is INCREASING their pledge,\n # no action is taken\n return if self.reward == max_reward && self.amount >= max_reward.price\n\n # if user has a reward already, but the increase in their pledge does\n # not take them to the next reward level, no action is taken\n if self.reward && self.reward != max_reward\n next_reward = ordered_rewards[(ordered_rewards.index(self.reward) + 1)]\n return if self.amount < next_reward.price\n end\n\n ordered_rewards.each do |reward| \n if self.amount >= reward.price\n self.reward = reward if reward.available?\n end\n end\n self.reward\n end", "def remitente\n user = User.find(self.envia_id) if self.envia_id\n remitente ||= user.persona.nombre_completo if user && user.persona.nombre_completo\n return remitente\n end", "def has_contributed_to\n self.contributed_non_profits\n end", "def unclaimed?\n claimant.nil?\n end", "def resolve_possessive_pronoun(target)\n if target == self\n return \"your\".freeze\n end\n if can_see?(target)\n return target.possessive_pronoun\n else\n return target.indefinite_possessive_pronoun\n end\n end", "def manager?\n current_user&.manager? || false\n end", "def active_promotion\n @active_promotion ||= OpenStruct.new(credit: 100.00)\n end", "def update?\n [email protected]? && [email protected]? && \\\n @proposal.user == @user\n end", "def set_responsibility\n @responsibility = Responsibility.find( params[ :id ])\n return unless has_group_access?( @responsibility.group_id )\n end", "def owned?\n !owner.nil?\n end", "def self_owned?; owners.include?(Distributed) end", "def lock?\n record.unlocked? && (director?(record.event) || competition_admin? || super_admin?)\n end", "def valid_prize_teacher\n return self.teachers.first if self.prize_teacher_id.blank? || self.teachers.first.try(:id) == self.prize_teacher_id\n nil\n end", "def has_honors #its gonna return true or false depdening if the object/student has honors\n if @gpa >= 3.5\n return true \n end \n return false \n end", "def fetch_smr\n settings = @@session.fetch_user_settings\n smr = smr_man settings if settings[:sex] == 'man'\n smr ||= smr_woman settings\n smr\n end", "def actor; User.get(self.actor_id) || Lead.get(self.actor_id) || Account.get(self.actor_id) || Contact.get(self.actor_id) || Opportunity.get(self.actor_id); end", "def actor; User.get(self.actor_id) || Lead.get(self.actor_id) || Account.get(self.actor_id) || Contact.get(self.actor_id) || Opportunity.get(self.actor_id); end", "def i_dont_own?(object)\n if(current_user.present? and object.user.present? and object.user.id.present? and (current_user.id == object.user.id))\n false\n else\n true\n end\n end", "def is_owner\n object == current_user\n end", "def allows_reward?\n true\n end", "def group_leader\n if self.group_leader_id.nil?\n return nil\n else\n Member.find_by_id( self.group_leader_id )\n end\n end", "def permission_role_or_subject_for(target, context, proles=nil)\n permission_subject_for(target, context) || permission_role_for(target, context, proles)\n end", "def check_user_teammate_permissions\n current_user_teammate = @current_user.teammates.where(pitch_id: @pitch.id).take\n redirect_to forbidden_path if current_user_teammate.nil?\n end", "def winner\n case\n when in_checkmate?(1)\n 2\n when in_checkmate?(2)\n 1\n else\n nil\n end\n end", "def teammate(pitch)\n return {error: 'pitch nil'} if pitch.nil?\n return self.teammate_ref unless self.teammate_ref.nil?\n self.teammate_ref = self.teammates.where(pitch_id: pitch.id).take\n end", "def booked?\n collaboration.present?\n end", "def other_party(person)\n person == starter ? listing.author : starter\n end", "def has_pet?\n current_user_pet && current_user_pet != nil\n end" ]
[ "0.5980395", "0.5892617", "0.58534586", "0.58534586", "0.58083546", "0.5744787", "0.56431353", "0.5639328", "0.5626036", "0.5599074", "0.5598739", "0.55454755", "0.552373", "0.5512968", "0.54559743", "0.5451468", "0.5448403", "0.5410697", "0.5410697", "0.54088366", "0.53562737", "0.5350363", "0.53473216", "0.53403556", "0.53040093", "0.5295784", "0.52948844", "0.529435", "0.5289297", "0.52856314", "0.52855253", "0.5277435", "0.5268313", "0.5265227", "0.52621955", "0.5259666", "0.52573514", "0.52467453", "0.5197455", "0.51897097", "0.5188729", "0.51880366", "0.5156014", "0.5136053", "0.5133893", "0.51310873", "0.51176536", "0.51089907", "0.5107994", "0.5104444", "0.51039815", "0.51018715", "0.50872344", "0.5071917", "0.5070988", "0.50701207", "0.50680995", "0.50583375", "0.50513077", "0.50412965", "0.50343263", "0.5034043", "0.50296175", "0.5017438", "0.5005022", "0.50020045", "0.49954274", "0.49915895", "0.49874815", "0.4980284", "0.49733418", "0.4963707", "0.49596396", "0.49540445", "0.49539083", "0.49503514", "0.49498808", "0.49474314", "0.49445647", "0.49376073", "0.49366418", "0.49364462", "0.49357486", "0.49272537", "0.49216673", "0.49132398", "0.49112582", "0.49060908", "0.49060908", "0.49052665", "0.48978415", "0.48855403", "0.4882212", "0.48816466", "0.48810047", "0.48762873", "0.48746312", "0.487116", "0.4868421", "0.4868047" ]
0.6019912
0
Returns an array of successful mutual honors
def chance_old_honor honors = Honor.where(from: self.player_id).where(seen: 0) mutual_honors = Array.new honors.each do |honor| honor.seen = 1; honor.save mutual_honor = self.chance_for_mutual(honor.to, honor.champion, honor.probability) unless mutual_honor.nil? mutual_honors.push(mutual_honor) end end mutual_honors end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chat_participants \n friends.map do |friend|\n friend.combination(2).to_a\n end.flatten(1)\nend", "def successors\n return @successors if @successors\n @successors = (data['successors']||[]).map { |s| function.blocks.by_name(s) }.uniq.freeze\n end", "def potential_pairs\n potentials = []\n teams.each do |team|\n team.members.each do |member|\n if member != self && member != self.last_pair && member.paired == false\n potentials << member\n end\n end\n end\n potentials\n end", "def current_opponent_effect_descriptors\n []\n end", "def victor\n return @attack_initiator if @attack_initiator.soldiers_alive.count > 0\n return @other_army if @other_army.soldiers_alive.count > 0\n end", "def corals\n @corals ||= [@first_coral, @second_coral].sort\n end", "def phase_one\r\n # start with empty elimination array\r\n council_elimination = []\r\n # loop 8 times (game mechanics)\r\n 8.times do\r\n # tribe which has lost the challenge\r\n loosing_tribe = @borneo.immunity_challenge\r\n # tribal council for the loosing tribe will eliminate one participants\r\n council_elimination << loosing_tribe.tribal_council\r\n end\r\n # return all eliminations (used for the test szenario)\r\n return council_elimination.length\r\nend", "def player_win_condition_checkers\n (1..@player_count).map { |player| player_win_condition_checker(player) }\n end", "def responses\n participants.flat_map(&:responses)\n end", "def mots_uniques\n @mots_uniques ||= begin\n self.select do |mot_min, arr_indexes|\n arr_indexes.count == 1\n end.keys\n end\n end", "def make_conveyors\n ([email protected] - 1).step(3) do |n|\n (@conveyor_array ||= []) << Conveyor.new(@schematics[n - 2],\n @schematics[n - 1],\n @schematics[n])\n end\n end", "def light_switches(num)\n lights_arr = []\n 1.upto(num) do |n|\n lights_arr.push([n, true])\n end\n\n 2.upto(num) do |n|\n lights_arr.each do |light|\n light[1] = !light[1] if light[0] % n == 0\n end\n end\n\n lights_on = []\n lights_arr.each do |arr|\n lights_on << arr[0] if arr[1]\n end\n return lights_on\nend", "def divisors\n [self] + self.factors << 1\n end", "def valid_combinations\n\t\treturn @@valid_combinations\n\tend", "def mutual_follows\n self.followees.to_a.select { |followee| followee.is_following?(self) }\n end", "def balls\r\n @pitches.select{|pitch| pitch.outcome == 'B'}\r\n end", "def lights(num)\n switches = Array.new(num, false)\n num.times do |n|\n switches = switches.each_with_index.map do |el, i|\n if ((i + 1) % (n + 1)).zero?\n !el\n else\n el\n end\n end\n end\n switches.each_with_index.map { |el, i| i + 1 if el }.select { |el| el }\nend", "def switches(n)\n lights = Array.new(n) { |el| el = false }\n\n 1.upto(n) do |i|\n lights = lights.map.with_index do |light, idx|\n (idx + 1) % i == 0 ? !light : light\n end\n end\n\n lights_on = []\n lights.each_with_index do |light, idx|\n lights_on << (idx + 1) if light\n end\n\n lights_on\nend", "def participating_advocates\n result = []\n result << self.mandated_advocate if self.mandated_advocate\n result += self.responses.visible.map(&:person)\n result += self.accessors\n result.uniq!\n result\n end", "def each_touch_reachable_state\n if @touch_reachable.nil?\n # Set to avoid duplicates.\n @touch_reachable = Set[]\n\n player = @players[@turn]\n opponent_num = (@turn + 1) % 2\n opponent = @players[opponent_num]\n\n for player_hand in [Left, Right] do\n for opponent_hand in [Left, Right] do\n if hand_alive?(@turn, player_hand) and\n hand_alive?(opponent_num, opponent_hand)\n op = opponent.clone # because touch modifies it\n State.touch(player, player_hand, op, opponent_hand)\n if @turn == Player1\n @touch_reachable << State.new(player, op, opponent_num, self)\n else\n @touch_reachable << State.new(op, player, opponent_num, self)\n end\n end\n end\n end\n end\n\n @touch_reachable.each { |r| yield r }\n end", "def list_all_reactors\n end", "def testHamilton()\n marque = Hash.new(false)\n stack = Array.new()\n\n stack.push(@sommets.first)\n while !stack.empty? do\n temp = stack.shift\n temp.getVoisins().each do |v|\n if(marque[v] == false) then stack.push(v) end\n end\n marque[temp] = true\n end\n if(marque.count != self.nbSommets()) then return false\n else return true end\n end", "def colliBall_h(balls)\r\n for molecule, mol_col_chk in balls.combination(2)\r\n if mol_col_chk.collide?(molecule) && (! molecule.noCollideList.include?(mol_col_chk))\r\n if @crn.reactions.key?([molecule.species, mol_col_chk.species]) \r\n @balls += split(@balls, [molecule, mol_col_chk], @crn.reactions[[molecule.species, mol_col_chk.species]][1])\r\n else \r\n #bounce around when it is not a reaction\r\n temp = Marshal.load(Marshal.dump(molecule.v))\r\n molecule.v = Marshal.load(Marshal.dump(mol_col_chk.v))\r\n mol_col_chk.v = temp\r\n end #no coList\r\n else\r\n molecule.noCollideList = molecule.noCollideList - [mol_col_chk]\r\n mol_col_chk.noCollideList = mol_col_chk.noCollideList - [molecule]\r\n end # if collide\r\n end #for\r\n end", "def player_card_minors(_player)\n []\n end", "def divisors(num)\n divisors = Array.new\n counter = 1\n while counter <= num\n divisors << counter if num % counter == 0\n counter += 1\n end\n divisors\nend", "def opponent_effect_sources\n []\n end", "def dead_opponents(battler = $game_player)\n opponents = []\n @action_battlers.each do |key, members|\n next if key == battler.team_id\n members.compact.each do |member|\n next unless member.dead?\n opponents.push(member)\n end\n end\n return opponents\n end", "def has_multiple_hands\n return 1 if @hands.length > 1\n return nil\n end", "def divisors(num)\n results = []\n \n 1.upto(num) do |current_num|\n results << current_num if num % current_num == 0\n end\n \n results\nend", "def requested_modalities\n return @requested_modalities\n end", "def mentor_matches(mentee)\n mentors = Mentor.all.shuffle\n matches = []\n count = mentors.count\n \n # Coding out while loop for faster debugging purposes, \n # though for refactor it's important to consider cases\n # where no matches are found\n # while matches.length <= 1\n until matches.length == 3 || count < 1 do\n mentors.each do |mentor|\n if mentor.race == mentee.race\n matches.push(mentor)\n elsif mentor.socioeconomic_background == mentee.socioeconomic_background\n matches.push(mentor)\n elsif mentor.gender == mentee.gender\n matches.push(mentor)\n elsif mentor.orientation == mentee.orientation\n matches.push(mentor)\n end\n count -= 1\n end\n end\n matches\n end", "def coin_array; end", "def get_divisors(number)\n\tresult = []\n\n \tfor counter in 1..number / 2\n \tresult.push(counter) if number % counter == 0\n \tend\n\n \tresult.push(number)\n \tresult\nend", "def lights_on(n)\n lights_on = []\n lights = [*1..n]\n counter = 1\n\n while counter <= n\n lights.each do |light|\n if light % counter == 0\n lights_on.include?(light) ? lights_on.delete(light) : lights_on << light\n end\n end\n counter += 1\n end\n\n lights_on\nend", "def armors_hash()\n return @armors\n end", "def optionals\r\n %w[\r\n participant\r\n token\r\n ]\r\n end", "def presence_once\n [false, (0..0), false,\n ->(a) { true },\n ->(v) { v ? [''] : [] }\n ]\n end", "def circular_sequences\n to_return = []\n connections.each do |conn|\n if conn.probe1.sequence_index == conn.probe2.sequence_index and\n conn.probe1.side != conn.probe2.side and\n @graph.edges[conn.probe1.to_settable].length == 1 and\n @graph.edges[conn.probe2.to_settable].length == 1\n\n to_return.push conn.probe1.sequence_index\n end\n end\n return to_return\n end", "def unconnected_probes\n observed_connections = Set.new\n connections.each do |conn|\n observed_connections << conn.probe1.to_settable\n observed_connections << conn.probe2.to_settable\n end\n to_return = []\n @sequence_ids.each do |index|\n [:start, :end].each do |side|\n probe = Probe.new\n probe.sequence_index = index\n probe.side = side\n unless observed_connections.include?(probe.to_settable)\n to_return.push probe\n end\n end\n end\n return to_return\n end", "def current_astronauts\n missions.map {|mission| mission.astronaut}.uniq\n \n end", "def phase_one\n introduction\n title \"Phase One\"\n losers = 0\n immune_members = []\n 8.times do\n losing_tribe = @borneo.tribes.shuffle.first\n puts \"The losing tribe is #{losing_tribe}\".red\n loser = losing_tribe.tribal_council()#no immune members\n puts \" The loser member is #{loser}\"\n losers += 1\n counting = 0\n @borneo.tribes.each{|tribe| counting += tribe.members.length}\n puts \" #{losers} gone!\"\n puts \" #{counting} remaining players\"\n end\nend", "def each_clap_reachable_state\n if @clap_reachable.nil?\n # Set to avoid duplicates.\n @clap_reachable = Set[]\n player = @players[@turn]\n opponent_num = (@turn + 1) % 2\n opponent = @players[opponent_num]\n\n # Clap rules.\n for source_hand in [Left, Right] do\n target_hand = (source_hand == Left ? Right : Left)\n # The first line is the number that can be removed from the source.\n # The second is the number that can be added to the target without\n # killing it.\n max_transfer = [player[source_hand],\n (FingersPerHand - player[target_hand] - 1)].min\n (1..max_transfer).each do |i|\n # skip transfers that just flip the hands\n next if (player[source_hand] - i) == player[target_hand]\n\n p = player.clone\n p[source_hand] -= i\n p[target_hand] += i\n if @turn == Player1\n @clap_reachable << State.new(p, opponent.clone, opponent_num, self)\n else\n @clap_reachable << State.new(opponent.clone, p, opponent_num, self)\n end\n end\n end\n end\n\n @clap_reachable.each { |r| yield r }\n end", "def phase_one\n\tputs \"\\nPhase One\".colorize(:color => :blue, :background => :white)\n\t eliminated_members = []\n\t 8.times do\n\t \tlosing_tribe = @borneo.immunity_challenge\n\t \t# losing_tribe = @borneo.get_losing_tribe(immune_tribe)\n\t \teliminated_member = losing_tribe.tribal_council()\n\t \t# losing_tribe.members.delete(eliminated_member)\n\t \teliminated_members.push(eliminated_member)\n\t end\n\teliminated_members.length\nend", "def scoreScissors m\n\t\t[0,1] \n\tend", "def effects\n results = []\n \n if @difficulty\n results << \"Success\" if result >= @difficulty\n end\n \n @possibilities.each do |poss|\n results.concat(check(poss))\n end\n \n results.compact!\n\n if results.empty?\n results = nil\n end\n results\n end", "def outcomes\n return @outcomes\n end", "def players; [@hunter, @prey] end", "def lights(n)\n arr = Array.new(n, false)\n n.times do |count|\n arr.each_with_index { |element, idx| arr[idx] = !element if (idx + 1) % (count + 1) == 0}\n end\n result =[]\n arr.each_with_index { |element, idx| result << idx+1 if element }\n result\nend", "def mergeable_private_mines(entity)\n if entity == @hw\n @minors.select { |m| m.owner && @players.include?(m.owner) && @minor_info[m][:vor_harzer] }\n else\n @minors.select { |m| m.owner && @players.include?(m.owner) }\n end\n end", "def mutation\r\n @population += @mutation.times.map do\r\n mask = 0\r\n 0.upto(@length-1) do |i|\r\n mask += 1<<i if rand < @flip\r\n end\r\n individual = @population[rand(@population.length)][:value]\r\n value = individual ^ mask\r\n # puts (\"%.#{@length}b\" % individual) + ' xor ' + (\"%.#{@length}b\" % mask) + ' --> ' + (\"%.#{@length}b\" % value)\r\n bear(value)\r\n end\r\n end", "def light_switches(n)\n light_hash = {}\n 1.upto(n) { |i| light_hash[i] = true }\n 2.upto(n) do |current_pass|\n light_hash.map do |light, state|\n light_hash[light] = !state if light % current_pass == 0\n end\n end\n lights_left_on = light_hash.select do |_, state|\n state\n end\n result = []\n lights_left_on.to_a.flatten.each_with_index do |element, index|\n result << element if index.even?\n end\n result\nend", "def scoreScissors m\n\t\t[1,0]\n\tend", "def fetch_homologues(type=nil) # default: all type of homologues, or else orthologues or paralogues (ortho, para) \n answer = self.homology_members.collect{|hm| hm.homology} \n answer = answer.select{|h| h.description.include?(\"#{type.downcase}\")} unless type.nil? # filter for a particular kind of homology \n return answer.collect{|h| h.homology_members.select{|hm| hm.member_id != self.id and hm.member.genome_db_id != self.genome_db_id }}.flatten.collect{|hm| hm.member } \n end", "def participants\n people.select{|person| !person.guide }\n end", "def gene_list\n answer = []\n self.homology_members.each { |hm| answer.push(hm.member)}\n return answer\n end", "def hivercs\n members_inject {|member| member.hivercs}\n end", "def get_potential_wins(wins, forker, forkee)\n potential_wins = []\n wins.each do |win|\n potential_wins.push(win) if (forker & win).size > 0 && (forkee & win).size == 0\n end\n return potential_wins\n end", "def getResult\n \t@hands[0].checkHand\n end", "def lifters\n # binding.pry\n memberships.map { |membership| membership.lifter }.uniq\n end", "def satisfied\n Array((operands.detect {|op| op.is_a?(Array) && op[0] == :satisfied} || [:satisfied])[1..-1])\n end", "def all_endorsers_of_candidate(user)\n candidate = Candidate.find_by(user: user)\n p endorsements = all_endorsements.map { |endorsement| endorsement.candidate == candidate }\n endorsements = all_endorsements.select { |endorsement| endorsement.candidate == candidate }\n endorsements.map { |endorsement| endorsement.user.twitteruser }\n end", "def generate_successors\n @successors =\n [Move.new(x + 2, y + 1, self)] +\n [Move.new(x + 2, y - 1, self)] +\n [Move.new(x - 2, y + 1, self)] +\n [Move.new(x - 2, y - 1, self)] +\n [Move.new(x + 1, y + 2, self)] +\n [Move.new(x + 1, y - 2, self)] +\n [Move.new(x - 1, y + 2, self)] +\n [Move.new(x - 1, y - 2, self)]\n successors_copy = []\n @successors.each do |successor|\n successors_copy += [successor] if (0..7) === successor.x && (0..7) === successor.y\n end\n @successors = successors_copy\n end", "def ways \n return [] \n end", "def player_action\n @players.each{ |p|\n linebreak('-')\n p.hands.each_with_index{ |hand, index|\n hit = true\n double = p.wallet >= hand.bet\n while hit\n splittable = hand.pair? && p.wallet >= hand.bet\n status(p)\n hit, split = player_decision(p, hand, index, double, splittable)\n double = false unless split\n linebreak\n end\n }\n }\n end", "def divisors(n)\n return (1..n/2).select { |i| (n % i) == 0 }\nend", "def opponent_battler(battler = $game_player)\n opponents = []\n @action_battlers.each do |key, members|\n next if key == battler.team_id\n members.compact.each do |member|\n next if member.dead?\n opponents.push(member)\n end\n end\n return opponents\n end", "def gym_lifters\n memberships.map(&:lifter).uniq\n end", "def cats_in_hats\n # your code here\n hats = Array.new(100, false) # hat status of 100 cats\n result = [] # result array contains indices of cats with hats\n \n # iterate 100 rounds of visiting cats\n (0..99).each do |j|\n round = j+1\n i = j\n while i < 100\n if hats[i] == true\n hats[i] = false\n else\n hats[i] = true\n end\n i += round\n end\n end\n \n \n hats.each_with_index do |h, i|\n result << i+1 if h == true\n end\n result\nend", "def pairs\n @pieces.combination(2).to_a\n end", "def pairs\n @pieces.combination(2).to_a\n end", "def active_team_pitches\n self.pitches.joins(:teammates).where(teammates: {verified: true})\n end", "def waiters\n meals.map {|m| m.waiter}\n end", "def get_MCV(unassigned, times)\n\t\tmcv = []\n\t\tmax_clashes = -1\n\t\tunassigned.each do |member|\n\t\t\tcommitments = member.commitments\n\t\t\tclashes = 0\n\t\t\tfor time in times\n\t\t\t\tif commitments[time] == 1\n\t\t\t\t\tclashes += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\tif clashes > max_clashes\n\t\t\t\tmax_clashes = clashes\n\t\t\t\tmcv = [member]\n\t\t\telsif clashes == max_clashes\n\t\t\t\tmcv << member\n\t\t\tend\n\t\tend\n\n\t\tmcv = mcv.sample\n\t\treturn mcv\n\tend", "def right_bot\n\t\t[ cl[0]+1, cl[1]+1 ]\n\tend", "def acts_of_homonymy_for_ref\n syn = self.proj.sensus.by_label(self.label_id).by_ref(self.ref_id).ordered_by_label.collect{|s| s.ontology_class}.uniq\n syns = []\n syn.each_with_index do |s1,i|\n syn[(i+1)..(syn.size)].each do |s2|\n syns << [s1, s2]\n end\n end\n syns\n end", "def involved_people\n # [self.user, self.answerers, self.commenters].flatten.uniq\n [self.user].flatten.uniq\n end", "def different_committers\n lambda do |es|\n es.each_cons(2)\n .count {|b,a| a.method_length < b.method_length && a.committer == b.committer }\n end\nend", "def other_household_members\n return [] if period.nil?\n ids = chooser.household.users.pluck(:id) - [chooser.id]\n period.shares.nonzero.where(user_id: ids).includes(:user).map(&:user)\n end", "def each_reachable_state\n each_touch_reachable_state { |r| yield r }\n each_clap_reachable_state { |r| yield r }\n end", "def busy_pink_cabs\n arr = []\n @pink_cabs.select { |pink_cab| arr << pink_cab if (pink_cab.available == false) }\n return arr\n end", "def buyable_private_mines(entity)\n if entity == @hw\n @minors.select { |m| (!m.owner || @players.include?(m.owner)) && @minor_info[m][:vor_harzer] }\n else\n @minors.select { |m| !m.owner || @players.include?(m.owner) }\n end\n end", "def modalities\n return @modalities\n end", "def phase_one\n 8.times do\n @borneo.immunity_challenge.tribal_council()\n puts\n end\nend", "def match_maker(opposites_attract, *elements) #method takes a boolean, and any number of booleans\n to_return = [] #creating an empty array\n elements.each_slice 2 do |first, last| #splits the array into an array of pairs\n first = !!first #conversion to boolean\n last = !! last\n result = if opposites_attract\n first != last #first does not equal last\n else\n first ==last #or they equal\n end\n to_return << result #append result \nend \nto_return\nend", "def divisors(num)\n divisors = []\n (1..num).each do |div|\n divisors << div if (num % div).zero?\n end\n return divisors\nend", "def lehman_peralta(numero)\n num=numero.to_i\n n_aleatorios=[]\n t_primo=[]\n i=1\n exponente=(num-1)/2\n contador=0 #contador para contar si todos los modulos son = a 1 y rechazar que sea primo\n while i<num\n n_aleatorios[i]=rand(1..num-1)\n #puts \"aleatorio creado: #{n_aleatorios[i]}\"\n i+=1\n end\n for j in 1...num\n t_primo[j]=(n_aleatorios[j]**exponente)%num\n #condicion para que de -1 en caso de que de la operacion con el modulo un numero (num-1).Ej 6%7\n if(t_primo[j]>1)\n t_primo[j]=t_primo[j]-num\n end\n end\n\n #puts \"t_primo=#{t_primo}\"\n\n for j in 1...t_primo.length\n #puts \"t_primo[j]=#{t_primo[j]}\"\n if(t_primo[j]==1)\n contador+=1\n elsif t_primo[j]!=1 && t_primo[j]!=-1\n @primo=false\n\n end\n end\n if contador==t_primo.length-1\n @primo=false\n\n end\n @primo\n end", "def edge_array\n\t\t\t to_return = @responses.collect { |item| item.sollutions }\n\t\t\t return to_return\n\t\tend", "def collisions\n [collided_bombs, collided_rubies]\n end", "def awaiting_candidate_events\n candidate_events.select(&:awaiting_candidate?)\n end", "def make_enemy_union\n for battler in $game_troop.enemies\n action = battler.current_action\n if action.kind == 1 and Combination_Skill['Union'] != nil and Combination_Skill['Union'].is_a?(Hash) and\n Combination_Skill['Union'].keys.include?([battler.type_name, action.skill_id])\n combination = Combination_Skill['Union'][[battler.type_name, action.skill_id]]\n for enemy in $game_troop.enemies\n enemy.union_leader = true if enemy.id == combination.keys.first\n next if battler.union_members.include?(enemy)\n battler.union_members << enemy if combination.keys.include?(enemy.id)\n end\n end\n end\n end", "def hunks\n each_hunk.to_a\n end", "def hidratos \n\t\t@hidratos = @azucares + @polialcoles + @almidon\n\t\treturn @hidratos\n\tend", "def chord_pairs\n pairs = []\n @chords.each_cons(2) { |c, d| pairs << [c, d] }\n return pairs\n end", "def paired_engineers\n pairings.flat_map(&:members)\n end", "def challenges; end", "def allpseuds\n works.collect(&:pseuds).flatten.compact.uniq.sort\n end", "def mill_motor_housing\r\n # # # # # # # # #\r\n end", "def parties(location, state)\n if location == :north\n soldiers_at(:north, state).map { |soldier| [soldier] } # one guy\n else\n soldiers_at(:south, state).combination(2).to_a # two guys\n end\nend", "def performPathologyTests_biopsy_unnecessary(patient)\n yield [] if @state[COMMITMENT].any? {|terms| terms.size == 4 and terms[0] == C1 and terms[3] == patient and state(PATIENT, patient) and state(PHYSICIAN, terms[2])}\nend", "def lehman_peralta(numero)\n num=numero.to_i\n n_aleatorios,t_primo,i,exponente,contador=[],[],1,(num-1)/2,0\n while i<num\n n_aleatorios[i]=rand(1..num-1)\n #puts \"aleatorio creado: #{n_aleatorios[i]}\"\n i+=1\n end\n for j in 1...num\n t_primo[j]=(n_aleatorios[j]**exponente)%num\n #condicion para que de -1 en caso de que de la operacion con el modulo un numero (num-1).Ej 6%7\n if(t_primo[j]>1)\n t_primo[j]=t_primo[j]-num\n end\n end\n #puts \"t_primo=#{t_primo}\"\n for j in 1...t_primo.length\n #puts \"t_primo[j]=#{t_primo[j]}\"\n if(t_primo[j]==1)\n contador+=1\n elsif t_primo[j]!=1 && t_primo[j]!=-1\n @primo=false\n end\n end\n if contador==t_primo.length-1\n @primo=false\n end\n @primo\n end" ]
[ "0.52789223", "0.52411467", "0.5210182", "0.51161635", "0.5051965", "0.50228256", "0.5008176", "0.50039065", "0.49947527", "0.4969605", "0.49670795", "0.49561384", "0.49518645", "0.4934573", "0.49289706", "0.4916604", "0.49164742", "0.4908686", "0.48940137", "0.4893727", "0.4888473", "0.4882707", "0.48768985", "0.4872314", "0.48569122", "0.48517665", "0.48493373", "0.48492295", "0.48388645", "0.4815184", "0.48129824", "0.48115116", "0.48115012", "0.48098218", "0.48091647", "0.48071712", "0.47814646", "0.47787905", "0.4775593", "0.47693717", "0.47684848", "0.4737354", "0.47319072", "0.47307247", "0.47294343", "0.47258472", "0.4721434", "0.47183272", "0.47136545", "0.470601", "0.4702992", "0.46987784", "0.46978953", "0.46969217", "0.46948913", "0.46896628", "0.4686798", "0.46859455", "0.46726772", "0.46723828", "0.46656916", "0.465874", "0.4646916", "0.46424636", "0.4639685", "0.46366075", "0.4636071", "0.46347633", "0.46271604", "0.46271604", "0.46193767", "0.46177188", "0.46163282", "0.46158797", "0.46058685", "0.4604587", "0.46042836", "0.46020266", "0.45982787", "0.4597608", "0.45836085", "0.4582294", "0.4579722", "0.4579336", "0.457212", "0.45707223", "0.45658085", "0.45657167", "0.45640036", "0.45573986", "0.45542422", "0.45540172", "0.45511696", "0.45509624", "0.4550173", "0.4549575", "0.45454", "0.45450532", "0.45429096", "0.4536338" ]
0.535338
0
GET /guardianships GET /guardianships.json
def index @guardianships = Guardianship.all respond_to do |format| format.html # index.html.erb format.json { render json: @guardianships } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @guardianship = Guardianship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guardianship }\n end\n end", "def index\n @guardianships = Guardianship.all\n end", "def new\n @guardianship = Guardianship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guardianship }\n end\n end", "def create\n @guardianship = Guardianship.new(params[:guardianship])\n\n respond_to do |format|\n if @guardianship.save\n format.html { redirect_to @guardianship, notice: 'Guardianship was successfully created.' }\n format.json { render json: @guardianship, status: :created, location: @guardianship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_guardianship\n @guardianship = Guardianship.find(params[:id])\n end", "def set_guardianship\n @guardianship = Guardianship.find(params[:id])\n end", "def create\n @guardianship = Guardianship.new(guardianship_params)\n @guardianship.user_id = current_user.id\n\n respond_to do |format|\n if @guardianship.save\n format.html { redirect_to root_path, notice: 'Guardianship was successfully created.' }\n format.json { render :show, status: :created, location: @guardianship }\n else\n format.html { render root }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @guardianships = Guardianship.where(endtime: nil)\n if user_signed_in?\n @user_guardianship = Guardianship.where(user_id: current_user.id).where(endtime: nil).take\n end\n end", "def index\n @guardians = Guardian.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @guardians }\n end\n end", "def destroy\n @guardianship = Guardianship.find(params[:id])\n @guardianship.destroy\n\n respond_to do |format|\n format.html { redirect_to guardianships_url }\n format.json { head :no_content }\n end\n end", "def index_hosting\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.hosted_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def guardianship_params\n params.require(:guardianship).permit(:guardian_id, :user_id)\n end", "def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end", "def student_guardian_show\n guardians=MgStudentGuardian.where(:mg_student_id=>params[:id],:mg_school_id=>session[:current_user_school_id],:is_deleted=>0).order(:mg_guardians_id)\n # @student_id=params[:id]\n @student=MgStudent.find(params[:id])\n @student_guardian=Array.new\n guardians.each do |guardian|\n @student_guardian << MgGuardian.find(guardian.mg_guardians_id)\n end\n if request.xhr?\n render :layout => false\n end\nend", "def index\n puts \"user: #{@current_user.json_hash[:id]}\"\n hosted_dinners = []\n attended_dinners = []\n @hosted_dinners = @current_user.hosted_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n hosted_dinners << dinner.all_info\n end\n @attended_dinners = @current_user.attended_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n attended_dinners << dinner.all_info\n end\n render json: {\n hosting: hosted_dinners,\n attending: attended_dinners\n }\n end", "def index\n @routes = Route.where(:verified => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routes }\n end\n end", "def index\n @farms = current_user.farms\n set_page_title\n\n @barn = []\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @farms }\n end\n end", "def index\n @girlfriends = Girlfriend.all\n render json: @girlfriends, status: 200 \n end", "def get_user_homes\n # @user_homes = UserHome.where(\"user_id =?\",current_user[:id])\n\n @homes = User.get_user_homes current_user[:id]\n if @homes\n render json:@homes\n else\n render json: @homes.errors\n end\n end", "def show\n @galaxies_lenticular_galaxy = Galaxies::LenticularGalaxy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @galaxies_lenticular_galaxy }\n end\n end", "def destroy\n @guardianship.destroy\n respond_to do |format|\n format.html { redirect_to guardianships_url, notice: 'Guardianship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @search_guardians = SearchGuardian.all\n end", "def index\n @clientships = current_user.clientships.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientships }\n end\n end", "def index\n @fellowships = Fellowship.all\n end", "def index\n\t\tsurgery_locations = SurgeryLocation.all\n\t\tif surgery_locations.present?\n\t # response to the JSON\n\t render json: { success: true, response: surgery_locations.map{ |f| SurgeryLocationSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Surgery Location is not present.\" },:status=> 203\n\t end \n\tend", "def surgery_name_list\n\t\tsurgeries = current_user.surgeries\n\t\tif surgeries.present?\n\t\t# response to the JSON\n \t render json: { success: true, response: {surgeries: surgeries.collect(&:name).as_json } },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"Surgeries are not present\" },:status=> 203\n\t end \n\tend", "def index\n @friendships = @user.friendships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def show\n @child_guardian_relationship = ChildGuardianRelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @child_guardian_relationship }\n end\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def index\n @followships = Follower.all\n render json: @followships\n end", "def get_finding_info\n\t\tidDec = params[:idDec].to_i\n\t\tidMap = params[:idMap].to_i\n\t\thallazgo = Finding.where(\"decision_map_id = ? AND governance_decision_id = ?\", idMap, idDec).first\n\t\trespond_to do |format|\n\t\t\tformat.json {render json: hallazgo}\n \tend\n\tend", "def show\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gasto }\n end\n end", "def farms\n user = User.find(params[:id])\n\n @farms = []\n # Find which farms this user is authorized to access\n if (user.is_hog_owner?)\n @farms = user.owner.farms\n elsif user.is_barn_manager?\n @farms << user.owner.barn.location.farm\n elsif user.is_site_manager?\n @farms << user.owner.location.farm\n elsif user.is_farm_owner?\n @farms << user.owner.farm\n elsif user.is_admin?\n @farms = Farm.all\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @farms }\n end\n end", "def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end", "def show\n @guardian = Guardian.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @guardian }\n end\n end", "def update\n respond_to do |format|\n if @guardianship.update(guardianship_params)\n format.html { redirect_to @guardianship, notice: 'Guardianship was successfully updated.' }\n format.json { render :show, status: :ok, location: @guardianship }\n else\n format.html { render :edit }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def index\n @registrations = Tournament.find(params[:tournament_id]).registrations\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations }\n end\n end", "def index\n @organisms = Organism.find(:all, :conditions => {:has_proteins => true})\n @dataset = params[:dataset]\n proteins = Protein.find(:all, :conditions => {:has_hits_public => true})\n @h_proteins = {}\n proteins.map{|p| @h_proteins[p.id]=p}\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organisms }\n end\n end", "def index\n @upcoming_harvests = Harvest.upcoming\n @past_harvests = Harvest.past\n\n if params[:person_id]\n @person = Person.find(params[:person_id])\n @upcoming_harvests = @person.upcoming_harvests\n @past_harvests = @person.past_harvests\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvests }\n end\n end", "def show\n @sundry_grn = SundryGrn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sundry_grn }\n end\n end", "def locations\n farm = Farm.find(params[:id])\n\n @locations = []\n # Find which locations this user is authorized to access\n if (current_user.is_hog_owner? || current_user.is_farm_owner? || current_user.is_admin?)\n @locations = farm.locations\n elsif current_user.is_barn_manager?\n @locations << current_user.owner.barn.location\n elsif current_user.is_site_manager?\n @locations << current_user.owner.location\n end\n\n @page_title = \"Sites\"\n @header_icon_class = \"icon-road\"\n @page_subtitle = \"\"\n \n respond_to do |format|\n format.html { render '/locations/index' }\n format.json { render json: @locations }\n end\n end", "def show\n @gastracker = Gastracker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gastracker }\n end\n end", "def index\n @dairy_plans = DairyPlan.where(:student_id => @student.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dairy_plans }\n end\n end", "def show\n @book_usership = BookUsership.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_usership }\n end\n end", "def index\n @breeding_pairs = current_user.breeding_pairs.all\n\n respond_to do |format|\n format.json { render json: @breeding_pairs }\n end\n end", "def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end", "def index\n @garnishes = Garnish.where(\"LOWER(name) like ?\", \"%#{params[:q] ? params[:q].downcase : ''}%\").paginate(:page => params[:page], :per_page => 198).order(:name)\n respond_to do |format|\n format.html\n format.json {render :json => @garnishes.map(&:attributes)}\n end\n end", "def index\n @jido_guardian_rels = JidoGuardianRel.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jido_guardian_rels }\n end\n end", "def index\n gon.yourID = current_user.id\n current_user.game == nil ? @games = Game.all : @games = Game.find(current_user.game.id)\n @team1 = @games.team1.users if @games.try :team1\n @team2 = @games.team2.users if @games.try :team2\n respond_to do |format|\n format.html\n format.json { render :json => { :games => @games.to_json(:include => [:users]),\n :user => current_user.game,\n :will => current_user.will,\n :team1 => @team1,\n :team2 => @team2 }\n }\n end\n end", "def index\n @guardians = Guardian.all.includes(family: [:community]).order(\"communities.code ASC\", \"families.name ASC\")\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 show\n @user = User.find_by_id(params[:id])\n\n if @user\n render json: @user.to_json(include: [:games]), status: 200\n else\n render json: {error: \"User not found\"}, status: 404\n end\n end", "def index\n puts \"<><><><><><><><><><><><><><><><><><><><><>\"\n p params\n puts \"<><><><><><><><><><><><><><><><><><><><><>\"\n # @journeys = current_user.journeys\n @journeys = User.find_by_id(params[:user_id]).journeys\n render json: @journeys.to_a\n end", "def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def index\n @friendships = Friendship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def index\n @goals = @user.goals\n \n render json: @goals\n end", "def show\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shichoson }\n end\n end", "def show\n @village = Village.find(params[:id])\n @collections = @village.collections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @village }\n end\n end", "def allergies\n raise UserNotAuthenticated unless access_token\n\n get('records/allergies')\n end", "def show\n render json: @league, status: :ok\n end", "def index\n # Vudo - Need to remove soft-deleted matchups\n @matchups = Matchup.includes(:home_team, :away_team).all\n render :json => @matchups, :include => [:home_team, :away_team]\n end", "def index\n\t\t@households = current_user.households\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @households }\n\t\tend\n\tend", "def index_by_user\n @gifts = @current_user.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end", "def index\n @championships = Championship.all\n\n render json: @championships\n end", "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\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 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 index\n # @locations = Location.all\n\n #po dodaniu has_many @locations, :through => @firms\n @locations = current_user.locations if signed_in?\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end", "def show\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golfer }\n end\n end", "def index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\n end", "def show\n dinosaurs = Dinosaur.filter_by_species(params[:species])\n\n if dinosaurs\n render json: dinosaurs\n else\n render json: dinosaurs.errors, status: :unprocessable_entity\n end\n end", "def index\n logger.info(\"-------------->index Friendship session #{session[:login]}\");\n if request.format.json?\n friendships_instance =Friendship.new\n @friendships = friendships_instance.getMyfriends(session[:login]); \n else \n @friendships=Friendship.where(user_id: session[:login])\n end\n\n end", "def index\n @ganhos = Ganho.all\n end", "def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\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 index\n @ganhos = Ganho.find_by_user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganhos }\n end\n end", "def get_all\n hitches = ::Hitch.where(shared?: true).where(\"submit_time > now()\").near([params[:user_latitude],params[:user_longitude]], 20)\n\n serializer = HitchSerializer.new(hitches, { params: { user_latitude: params[:user_latitude], user_longitude: params[:user_longitude] } })\n render json: serializer.serializable_hash\n end", "def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end", "def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end", "def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end", "def index\n @user_locations = ::Users::UserLocation.where(user_id: auth_user.id).order('is_primary desc')\n @page_title = 'Your Addresses'\n\n respond_to do|format|\n format.html\n format.json { render json: @user_locations }\n end\n end", "def show\n render json: @championship\n end", "def index\n if current_user.district_id and !current_user.admin?\n district = District.find(current_user.district_id)\n @hes = district.hes\n else\n @hes = He.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hes }\n end\n end", "def index\n session[:admin] = true\n @badges = Badge.order('approved_at desc,id')\n @fri_count = Badge.select { |b| b.friday? }.size\n @sat_count = Badge.select { |b| b.saturday? }.size\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @badges }\n end\n end", "def index\n check_authorization\n #@badges = Badge.find(:all, :conditions => [\"organization_id = ? and segment_id = ?\", @organization.id, @segment.id ] )\n @badges = Badge.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @badges }\n end\n end", "def index\n @goals = Goal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n @guests = Guest.all.order(:last_name)\n respond_with(@guests) do |format|\n format.to_json { @guests.to_json(:include => [:party, :group]) }\n end\n end", "def show\n respond_to do |format|\n if current_user==nil\n render json: {error: 'No estas logeado'}, status: 401\n elsif @family==nil\n format.json { render json: {error: \"El familiar no existe\"}, status: :not_found }\n elsif current_user.families.include?(@family)==false\n format.json { render json: {error: 'No posees permisos para ver a esta persona'}, status: 401 }\n else\n format.json { render json: {family: @family, intolerances: @family.intolerances} }\n end\n format.html {}\n end\n end", "def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end", "def get_static_assests\n types = LocationType.all\n facilities = Facility.all\n type_array = []\n facility_array = []\n types.each do |type|\n type_array << type.name\n end\n facilities.each do |facility|\n facility_array << facility.name\n end\n render json: { location_types: type_array, location_facilities: facility_array }\n end", "def all_followships\n followships = User.find(params[:user_id]).followships\n render :json => followships\n end", "def index\n @daily_horoscopes = DailyHoroscope.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @daily_horoscopes }\n end\n end", "def show\n @zombie_sighting = ZombieSighting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zombie_sighting }\n end\n end", "def index\n @lifeguards = Lifeguard.all\n end", "def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end", "def show\n render json: @games_leaderboard\n end", "def index\n @navigations = Navigation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @navigations }\n end\n end", "def index\n @results = FourSquare.new(foursquare_params).search\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end" ]
[ "0.7731873", "0.73670226", "0.6843749", "0.6412813", "0.6354523", "0.6354523", "0.6223187", "0.6172545", "0.61429626", "0.611875", "0.6010319", "0.59876794", "0.585261", "0.5822683", "0.5817951", "0.57909894", "0.5771006", "0.5758456", "0.5745943", "0.5745722", "0.5736845", "0.5719022", "0.5660171", "0.5655112", "0.5654556", "0.5647964", "0.5642865", "0.56428564", "0.56296456", "0.56064594", "0.5602163", "0.5597248", "0.55945164", "0.55806524", "0.5574574", "0.5571723", "0.5570221", "0.55664885", "0.5564517", "0.55578905", "0.5557889", "0.55558544", "0.5538439", "0.5535557", "0.55293816", "0.5518764", "0.55096006", "0.5508057", "0.5506539", "0.54892397", "0.5482306", "0.5478796", "0.5474612", "0.5470324", "0.5470142", "0.5470142", "0.54674965", "0.54649734", "0.5460891", "0.54608446", "0.545907", "0.54579866", "0.545686", "0.54447085", "0.5440532", "0.5433577", "0.5427845", "0.5424769", "0.5423465", "0.54233617", "0.5421885", "0.5421402", "0.5412707", "0.54122746", "0.5410525", "0.5408516", "0.54083073", "0.54079556", "0.54067755", "0.54036754", "0.5396767", "0.5394679", "0.5386407", "0.5385777", "0.5384969", "0.5382393", "0.538202", "0.53800887", "0.53799474", "0.53793037", "0.53754425", "0.5374403", "0.5373373", "0.5368542", "0.5364602", "0.5360309", "0.53602785", "0.53585994", "0.53583694", "0.5357803" ]
0.78329575
0
GET /guardianships/1 GET /guardianships/1.json
def show @guardianship = Guardianship.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @guardianship } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @guardianships = Guardianship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guardianships }\n end\n end", "def index\n @guardianships = Guardianship.all\n end", "def new\n @guardianship = Guardianship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guardianship }\n end\n end", "def set_guardianship\n @guardianship = Guardianship.find(params[:id])\n end", "def set_guardianship\n @guardianship = Guardianship.find(params[:id])\n end", "def create\n @guardianship = Guardianship.new(params[:guardianship])\n\n respond_to do |format|\n if @guardianship.save\n format.html { redirect_to @guardianship, notice: 'Guardianship was successfully created.' }\n format.json { render json: @guardianship, status: :created, location: @guardianship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @guardianship = Guardianship.new(guardianship_params)\n @guardianship.user_id = current_user.id\n\n respond_to do |format|\n if @guardianship.save\n format.html { redirect_to root_path, notice: 'Guardianship was successfully created.' }\n format.json { render :show, status: :created, location: @guardianship }\n else\n format.html { render root }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @guardians = Guardian.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @guardians }\n end\n end", "def destroy\n @guardianship = Guardianship.find(params[:id])\n @guardianship.destroy\n\n respond_to do |format|\n format.html { redirect_to guardianships_url }\n format.json { head :no_content }\n end\n end", "def index\n @guardianships = Guardianship.where(endtime: nil)\n if user_signed_in?\n @user_guardianship = Guardianship.where(user_id: current_user.id).where(endtime: nil).take\n end\n end", "def show\n @child_guardian_relationship = ChildGuardianRelationship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @child_guardian_relationship }\n end\n end", "def show\n @guardian = Guardian.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @guardian }\n end\n end", "def show\n @galaxies_lenticular_galaxy = Galaxies::LenticularGalaxy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @galaxies_lenticular_galaxy }\n end\n end", "def guardianship_params\n params.require(:guardianship).permit(:guardian_id, :user_id)\n end", "def show\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gasto }\n end\n end", "def show\n @sundry_grn = SundryGrn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sundry_grn }\n end\n end", "def show\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shichoson }\n end\n end", "def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end", "def show\n @gastracker = Gastracker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gastracker }\n end\n end", "def index\n @registrations = Tournament.find(params[:tournament_id]).registrations\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations }\n end\n end", "def index_hosting\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.hosted_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def student_guardian_show\n guardians=MgStudentGuardian.where(:mg_student_id=>params[:id],:mg_school_id=>session[:current_user_school_id],:is_deleted=>0).order(:mg_guardians_id)\n # @student_id=params[:id]\n @student=MgStudent.find(params[:id])\n @student_guardian=Array.new\n guardians.each do |guardian|\n @student_guardian << MgGuardian.find(guardian.mg_guardians_id)\n end\n if request.xhr?\n render :layout => false\n end\nend", "def show\n @warrior = Warrior.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @warrior }\n end\n end", "def show\n @warrior = Warrior.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @warrior }\n end\n end", "def show\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @golfer }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n render json: @goal\n end", "def get_finding_info\n\t\tidDec = params[:idDec].to_i\n\t\tidMap = params[:idMap].to_i\n\t\thallazgo = Finding.where(\"decision_map_id = ? AND governance_decision_id = ?\", idMap, idDec).first\n\t\trespond_to do |format|\n\t\t\tformat.json {render json: hallazgo}\n \tend\n\tend", "def show\n @gopy = Gopy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gopy }\n end\n end", "def index\n @guys = Guy.all\n respond_to do |format|\n format.json { render json: @guys }\n end\n end", "def show\n @zombie_sighting = ZombieSighting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zombie_sighting }\n end\n end", "def destroy\n @guardianship.destroy\n respond_to do |format|\n format.html { redirect_to guardianships_url, notice: 'Guardianship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @routes = Route.where(:verified => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routes }\n end\n end", "def index\n @farms = current_user.farms\n set_page_title\n\n @barn = []\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @farms }\n end\n end", "def show\n @hospital = Hospital.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospital }\n end\n end", "def show\n @book_usership = BookUsership.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_usership }\n end\n end", "def index\n @clientships = current_user.clientships.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientships }\n end\n end", "def show\n @hospitalization = Hospitalization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospitalization }\n end\n end", "def show\n @admin_village = Admin::Village.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_village }\n end\n end", "def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def index\n @girlfriends = Girlfriend.all\n render json: @girlfriends, status: 200 \n end", "def index\n puts \"user: #{@current_user.json_hash[:id]}\"\n hosted_dinners = []\n attended_dinners = []\n @hosted_dinners = @current_user.hosted_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n hosted_dinners << dinner.all_info\n end\n @attended_dinners = @current_user.attended_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n attended_dinners << dinner.all_info\n end\n render json: {\n hosting: hosted_dinners,\n attending: attended_dinners\n }\n end", "def show\n goal = Goal.find(params[:id])\n render json: goal,status: :ok\n end", "def update\n respond_to do |format|\n if @guardianship.update(guardianship_params)\n format.html { redirect_to @guardianship, notice: 'Guardianship was successfully updated.' }\n format.json { render :show, status: :ok, location: @guardianship }\n else\n format.html { render :edit }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @galaxy = Galaxy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @galaxy }\n end\n end", "def show\n @clientship = current_user.clientships.find(params[:id]) \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientship }\n end\n end", "def index\n @dairy_plans = DairyPlan.where(:student_id => @student.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dairy_plans }\n end\n end", "def show\n @galeria = Galeria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galeria }\n end\n end", "def show\n @village = Village.find(params[:id])\n @collections = @village.collections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @village }\n end\n end", "def show\n @surgery = Surgery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @surgery }\n end\n end", "def index\n\n @goals = Goal.by_person_as_student(current_user.person)\n @goals = @goals.by_plan(params[:plan_id]) if params[:plan_id].present?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def show\n @horace = Horace.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @horace }\n end\n end", "def show\n @global_goal = GlobalGoal.find(params[:id])\n\n respond_to do |format|\n format.html # global_goal.html.erb\n format.json { render json: @global_goal }\n end\n end", "def show\n @hasil = Hasil.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hasil }\n end\n end", "def show\n @user = User.find_by_id(params[:id])\n\n if @user\n render json: @user.to_json(include: [:games]), status: 200\n else\n render json: {error: \"User not found\"}, status: 404\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @analyst = Analyst.find(params[:id])\n\n render json: @analyst\n end", "def show\n @governor = Governor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @governor }\n end\n end", "def show\n @generation = Generation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generation }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def index\n @search_guardians = SearchGuardian.all\n end", "def show\n # puts \"PARAMSSSSS CONTROLLER #{params[:id]}\"\n url = \"https://api-2445582011268.apicast.io/games/#{params[:id]}\"\n response = HTTParty.get(url, headers: {\"user-key\" => Figaro.env.igdb_api_key, \"Accept\": \"application/json\"})\n @game_response = response.parsed_response\n end", "def index\n @jido_guardian_rels = JidoGuardianRel.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jido_guardian_rels }\n end\n end", "def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end", "def get_user_homes\n # @user_homes = UserHome.where(\"user_id =?\",current_user[:id])\n\n @homes = User.get_user_homes current_user[:id]\n if @homes\n render json:@homes\n else\n render json: @homes.errors\n end\n end", "def show\n @v_goal = VGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_goal }\n end\n end", "def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gpath }\n end\n end", "def show\n @goal_state = GoalState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal_state }\n end\n end", "def show\n @nail_salon = NailSalon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nail_salon }\n end\n end", "def index\n @ganhos = Ganho.find_by_user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganhos }\n end\n end", "def index\n @upcoming_harvests = Harvest.upcoming\n @past_harvests = Harvest.past\n\n if params[:person_id]\n @person = Person.find(params[:person_id])\n @upcoming_harvests = @person.upcoming_harvests\n @past_harvests = @person.past_harvests\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @harvests }\n end\n end", "def show\n @gid2name = Gid2name.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gid2name }\n end\n end", "def index\n @admin_villages = Admin::Village.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_villages }\n end\n end", "def index\n @friendships = @user.friendships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def show\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spaethi }\n end\n end", "def show\n @rooster = Rooster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rooster }\n end\n end", "def show\n @roster = Roster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @roster }\n end\n end", "def show\n @guille = Guille.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guille }\n end\n end", "def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end", "def show\n render json: @league, status: :ok\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 @generator_info = GeneratorInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generator_info }\n end\n end", "def show\n @neighborhood = Neighborhood.find(params[:id])\n\n render json: @neighborhood\n end", "def show\n @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sabio }\n end\n end", "def update\n @guardianship = Guardianship.find(params[:id])\n\n respond_to do |format|\n if @guardianship.update_attributes(params[:guardianship])\n format.html { redirect_to @guardianship, notice: 'Guardianship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def index_by_user\n @gifts = @current_user.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def show\n @game_tournament = GameTournament.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_tournament }\n end\n end", "def show\n @island = Island.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @island }\n end\n end", "def show\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end", "def show\n @insurance = load_insurance\n\n respond_to do |format|\n format.html\n format.json\n end \n end", "def index\n @fellowships = Fellowship.all\n end", "def show\n render json: @championship\n end", "def index\n @goals = @user.goals\n \n render json: @goals\n end", "def show\n @game = Game.find(params[:id])\n @home_team = Team.find(@game.home_team_id)\n @away_team = Team.find(@game.away_team_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end", "def show\n\t\t@hall = Hall.find(params[:id])\n\t\trender json: @hall\n\tend", "def show\n @pony = Pony.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pony }\n end\n end", "def show\n @spaceship = Spaceship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spaceship }\n end\n end" ]
[ "0.77268803", "0.72183675", "0.7133891", "0.6539829", "0.6539829", "0.6520422", "0.6391949", "0.62239563", "0.62183845", "0.60981375", "0.6095303", "0.60427356", "0.6033489", "0.5976163", "0.59457904", "0.59131396", "0.5902558", "0.589335", "0.5887191", "0.58724594", "0.5858524", "0.58531654", "0.584119", "0.584119", "0.58267176", "0.5824527", "0.5823608", "0.57750535", "0.5759276", "0.5754851", "0.57277846", "0.571632", "0.57115597", "0.5709726", "0.57080036", "0.57076687", "0.5700918", "0.56926566", "0.56840116", "0.56805676", "0.5677491", "0.567251", "0.5667141", "0.56645834", "0.5661243", "0.5656613", "0.5652908", "0.5649659", "0.5645222", "0.564112", "0.5633477", "0.56284547", "0.56279194", "0.5622251", "0.56183636", "0.5609412", "0.5609412", "0.5609412", "0.5609412", "0.5606413", "0.56019944", "0.55998373", "0.5595747", "0.5590556", "0.5585263", "0.55758655", "0.55725116", "0.55701107", "0.55699027", "0.5559369", "0.55507296", "0.55496943", "0.55463904", "0.5544733", "0.5539106", "0.5538812", "0.5536603", "0.5534364", "0.5530754", "0.5530729", "0.5528772", "0.55265695", "0.55252755", "0.5523534", "0.55212694", "0.5514161", "0.55126435", "0.55082345", "0.55080783", "0.550765", "0.55046016", "0.55000335", "0.5498936", "0.5498936", "0.5498422", "0.5497118", "0.54970735", "0.5496274", "0.5494657", "0.5489093" ]
0.79683775
0
GET /guardianships/new GET /guardianships/new.json
def new @guardianship = Guardianship.new respond_to do |format| format.html # new.html.erb format.json { render json: @guardianship } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @guardianship = Guardianship.new(params[:guardianship])\n\n respond_to do |format|\n if @guardianship.save\n format.html { redirect_to @guardianship, notice: 'Guardianship was successfully created.' }\n format.json { render json: @guardianship, status: :created, location: @guardianship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @guardianship = Guardianship.new(guardianship_params)\n @guardianship.user_id = current_user.id\n\n respond_to do |format|\n if @guardianship.save\n format.html { redirect_to root_path, notice: 'Guardianship was successfully created.' }\n format.json { render :show, status: :created, location: @guardianship }\n else\n format.html { render root }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @village = Village.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @village }\n end\n end", "def new\n @routing = Routing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routing }\n end\n end", "def new\n @spawner = Spawner.new\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spawner }\n end\n end", "def new\n @hasil = Hasil.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hasil }\n end\n end", "def new\n @gossip = Gossip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gossip }\n end\n end", "def new\n @generation = Generation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generation }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @pony = Pony.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pony }\n end\n end", "def new\n @landing = Landing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @landing }\n end\n end", "def new\n @inning = Inning.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inning }\n end\n end", "def new\n @where_to_stay = WhereToStay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @where_to_stay }\n end\n end", "def new\n @guardseason = Guardseason.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guardseason }\n end\n end", "def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end", "def new\n @ninja = Ninja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ninja }\n end\n end", "def new\n @v_goal = VGoal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @v_goal }\n end\n end", "def new\n @gasto = Gasto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gasto }\n end\n end", "def create\n @guardian = Guardian.new(params[:guardian])\n\n respond_to do |format|\n if @guardian.save\n flash[:notice] = 'Guardian was successfully created.'\n format.html { redirect_to(@guardian) }\n format.xml { render :xml => @guardian, :status => :created, :location => @guardian }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @guardian.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @galaxy = Galaxy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @galaxy }\n end\n end", "def new\n @nail_salon = NailSalon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nail_salon }\n end\n end", "def new\n @spaceship = Spaceship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spaceship }\n end\n end", "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end", "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\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 @sitio = Sitio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio }\n end\n end", "def new\n @goat = Goat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goat }\n end\n end", "def new\n @hospital = Hospital.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hospital }\n end\n end", "def new\n @girltype = Girltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @girltype }\n end\n end", "def new\n @nurse = Nurse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nurse }\n end\n end", "def new\n @stone = Stone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stone }\n end\n end", "def new\n @generator_info = GeneratorInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generator_info }\n end\n end", "def new\n @gopy = Gopy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gopy }\n end\n end", "def new\n @hoge = Hoge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hoge }\n end\n end", "def new\n @site = Site.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\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 new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end", "def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end", "def create\n @guardian = Guardian.new(guardian_params)\n\n respond_to do |format|\n if @guardian.save\n format.html { redirect_to @guardian, notice: tr(\"guardian_created\") }\n else\n format.html { render :new }\n end\n end\n end", "def new\n @baton = Baton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baton }\n end\n end", "def new\n @spaethi = Spaethi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spaethi }\n end\n end", "def new\n @arrival = Arrival.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival }\n end\n end", "def new\n @arrival = Arrival.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival }\n end\n end", "def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @historial = Historial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial }\n end\n end", "def new\n @checklocation = Checklocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @checklocation }\n end\n end", "def new\n @needed_good = NeededGood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @needed_good }\n end\n end", "def new\n @ginasio = Ginasio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ginasio }\n end\n end", "def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end", "def create\n @new_ = New.new(new__params)\n\n respond_to do |format|\n if @new_.save\n format.html { redirect_to @new_, notice: \"New was successfully created.\" }\n format.json { render :show, status: :created, location: @new_ }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @new_.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @pushup = Pushup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pushup }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @organism = Organism.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organism }\n end\n end", "def new\n @spieler = Spieler.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spieler }\n end\n end", "def new\n @hospitalization = Hospitalization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hospitalization }\n end\n end", "def new\n @tournament = Tournament.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tournament }\n end\n end", "def new\n if not check_logged_in then\n return\n end\n \n @plant = Plant.new\n \n @created_from_user = false\n if params[:came_from] then\n @created_from_user = true\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plant }\n end\n end", "def new\n @golfer = Golfer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @golfer }\n end\n end", "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @island = Island.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @island }\n end\n end", "def new\n @goal_state = GoalState.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal_state }\n end\n end", "def new\n @horace = Horace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @horace }\n end\n end", "def new\n @galaxies_lenticular_galaxy = Galaxies::LenticularGalaxy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @galaxies_lenticular_galaxy }\n end\n end", "def new\n @aspirant = Aspirant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @aspirant }\n end\n end", "def new\n @registration = Registration.new\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 @home = Home.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @home }\n end\n end", "def new\n @home = Home.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @home }\n end\n end", "def new\n @friendship = Friendship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @friendship }\n end\n end", "def new\n @friendship = Friendship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @friendship }\n end\n end", "def new\n @hijo = Hijo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hijo }\n end\n end", "def new\n @studio = Studio.new\n\t\t@venues = Venue.all\n \n\t\tsession[:return_to] ||= request.referer # record where the user came from so we can return them there after the save\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @studio }\n end\n end", "def new\n @family_crest = FamilyCrest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_crest }\n end\n end", "def new\n @gid2name = Gid2name.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gid2name }\n end\n end", "def new\n @tournament = Tournament.new(:date_started => Date.today)\n authorize! :create, @tournament\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tournament }\n end\n end", "def new\n @zombie_sighting = ZombieSighting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zombie_sighting }\n end\n end", "def new\n @spiel = Spiel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spiel }\n end\n end", "def new\n @ourproject = Ourproject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ourproject }\n end\n end", "def new\n @nightclub = Nightclub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nightclub }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alley }\n end\n end", "def new\n @fishing_method = FishingMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fishing_method }\n end\n end", "def new\n authorize! :create, Project\n \n @project = Project.new\n puts @project\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @gpath = Gpath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gpath }\n end\n end", "def new\n @howner = Howner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @howner }\n end\n end", "def new\n @primary = current_user\n @friendship = Friendship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @friendship }\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 new\n @life_insurance = LifeInsurance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @life_insurance }\n end\n end", "def new\n @internship = Internship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internship }\n end\n end", "def new\n @internship = Internship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internship }\n end\n end", "def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\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 @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end", "def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end" ]
[ "0.7794247", "0.7305265", "0.69828546", "0.6950017", "0.68569696", "0.6828653", "0.68091786", "0.6796393", "0.6743946", "0.6743946", "0.6743946", "0.67363465", "0.67339295", "0.66844666", "0.66827255", "0.6679456", "0.66728425", "0.6666971", "0.66616154", "0.6658567", "0.66560674", "0.66496366", "0.6641868", "0.6635228", "0.6634716", "0.6634716", "0.6623717", "0.661806", "0.66079074", "0.660746", "0.6601813", "0.6597479", "0.65903395", "0.65888214", "0.6585273", "0.6577053", "0.657651", "0.6574199", "0.6574148", "0.6574148", "0.65630066", "0.65630066", "0.6560256", "0.655895", "0.65531766", "0.6552085", "0.6552085", "0.6551945", "0.6550214", "0.65431494", "0.65430874", "0.6542114", "0.65412843", "0.653964", "0.6538477", "0.6537184", "0.6537184", "0.6537184", "0.6537184", "0.65365744", "0.65251845", "0.65245354", "0.65241575", "0.65239507", "0.65210176", "0.6520464", "0.6520464", "0.6519208", "0.6517322", "0.6515816", "0.65154636", "0.65154254", "0.6510136", "0.6505839", "0.6505461", "0.6504814", "0.6504814", "0.6503644", "0.6500769", "0.65005296", "0.6498781", "0.64973605", "0.6495276", "0.64927363", "0.6491143", "0.6490501", "0.6489936", "0.64899087", "0.64877355", "0.6486647", "0.6485825", "0.6485678", "0.6482696", "0.64816225", "0.6478805", "0.6478805", "0.64715266", "0.6467938", "0.64663327", "0.64644206" ]
0.82165366
0
POST /guardianships POST /guardianships.json
def create @guardianship = Guardianship.new(params[:guardianship]) respond_to do |format| if @guardianship.save format.html { redirect_to @guardianship, notice: 'Guardianship was successfully created.' } format.json { render json: @guardianship, status: :created, location: @guardianship } else format.html { render action: "new" } format.json { render json: @guardianship.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @guardianship = Guardianship.new(guardianship_params)\n @guardianship.user_id = current_user.id\n\n respond_to do |format|\n if @guardianship.save\n format.html { redirect_to root_path, notice: 'Guardianship was successfully created.' }\n format.json { render :show, status: :created, location: @guardianship }\n else\n format.html { render root }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def guardianship_params\n params.require(:guardianship).permit(:guardian_id, :user_id)\n end", "def new\n @guardianship = Guardianship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guardianship }\n end\n end", "def index\n @guardianships = Guardianship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guardianships }\n end\n end", "def index\n @guardianships = Guardianship.all\n end", "def set_guardianship\n @guardianship = Guardianship.find(params[:id])\n end", "def set_guardianship\n @guardianship = Guardianship.find(params[:id])\n end", "def show\n @guardianship = Guardianship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guardianship }\n end\n end", "def create\n @souvenior = Souvenior.new(souvenior_params)\n\n respond_to do |format|\n if @souvenior.save\n format.html { redirect_to root_path, notice: 'Souvenior was successfully created.' }\n format.json { render :show, status: :created, location: @souvenior }\n else\n format.html { render :new }\n format.json { render json: @souvenior.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @guardianship.update(guardianship_params)\n format.html { redirect_to @guardianship, notice: 'Guardianship was successfully updated.' }\n format.json { render :show, status: :ok, location: @guardianship }\n else\n format.html { render :edit }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shogi = Shogi.new(shogi_params)\n\n respond_to do |format|\n if @shogi.save\n format.html { redirect_to @shogi, notice: 'Shogi was successfully created.' }\n format.json { render :show, status: :created, location: @shogi }\n else\n format.html { render :new }\n format.json { render json: @shogi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @guardian = Guardian.new(guardian_params)\n\n respond_to do |format|\n if @guardian.save\n format.html { redirect_to @guardian, notice: tr(\"guardian_created\") }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @guardian = Guardian.new(params[:guardian])\n\n respond_to do |format|\n if @guardian.save\n flash[:notice] = 'Guardian was successfully created.'\n format.html { redirect_to(@guardian) }\n format.xml { render :xml => @guardian, :status => :created, :location => @guardian }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @guardian.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ganho = Ganho.new(ganho_params)\n\n respond_to do |format|\n if @ganho.save\n format.html { redirect_to ganhos_path, notice: 'Ganho was successfully created.' }\n format.json { render :show, status: :created, location: @ganho }\n else\n format.html { render :new }\n format.json { render json: @ganho.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @guardianship = Guardianship.find(params[:id])\n @guardianship.destroy\n\n respond_to do |format|\n format.html { redirect_to guardianships_url }\n format.json { head :no_content }\n end\n end", "def create\n @child_guardian_relationship = ChildGuardianRelationship.new(params[:child_guardian_relationship])\n\n respond_to do |format|\n if @child_guardian_relationship.save\n format.html { redirect_to @child_guardian_relationship, notice: 'Child guardian relationship was successfully created.' }\n format.json { render json: @child_guardian_relationship, status: :created, location: @child_guardian_relationship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @child_guardian_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book_usership = BookUsership.new(params[:book_usership])\n\n respond_to do |format|\n if @book_usership.save\n format.html { redirect_to @book_usership, notice: 'Book usership was successfully created.' }\n format.json { render json: @book_usership, status: :created, location: @book_usership }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_usership.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @guardianship.destroy\n respond_to do |format|\n format.html { redirect_to guardianships_url, notice: 'Guardianship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @surah = Surah.new(surah_params)\n\n respond_to do |format|\n if @surah.save\n format.html { redirect_to @surah, notice: 'Surah was successfully created.' }\n format.json { render action: 'show', status: :created, location: @surah }\n else\n format.html { render action: 'new' }\n format.json { render json: @surah.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shichoson = Shichoson.new(params[:shichoson])\n\n respond_to do |format|\n if @shichoson.save\n format.html { redirect_to @shichoson, notice: 'Shichoson was successfully created.' }\n format.json { render json: @shichoson, status: :created, location: @shichoson }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shichoson.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hospice = Hospice.new(hospice_params)\n\n respond_to do |format|\n if @hospice.save\n format.html { redirect_to @hospice, notice: 'Hospice was successfully created.' }\n format.json { render :show, status: :created, location: @hospice }\n else\n format.html { render :new }\n format.json { render json: @hospice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @seihinn = Seihinn.new(seihinn_params)\n\n respond_to do |format|\n if @seihinn.save\n format.html { redirect_to @seihinn, notice: \"Seihinn was successfully created.\" }\n format.json { render :show, status: :created, location: @seihinn }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @seihinn.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @g_game_board = GGameBoard.new(g_game_board_params)\n\n # By default : stark vs lannister\n major_houses_code_name = %w( stark lannister )\n\n respond_to do |format|\n if @g_game_board.save\n HHouse.suzerains.each do |house|\n if major_houses_code_name.include?( house.code_name )\n @g_game_board.declare_major_houses( house )\n else\n @g_game_board.declare_minor_houses( house )\n end\n end\n\n @g_game_board.refresh_tokens\n\n format.html { redirect_to @g_game_board, notice: 'G game board was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @spaethi = Spaethi.new(params[:spaethi])\n\n respond_to do |format|\n if @spaethi.save\n format.html { redirect_to @spaethi, notice: 'Spaethi was successfully created.' }\n format.json { render json: @spaethi, status: :created, location: @spaethi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spaethi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def create\n @fellowship = Fellowship.new(fellowship_params)\n @fellowship.users << current_user\n\n # Capitalize fellowship name\n @fellowship.fellowship_name = @fellowship.fellowship_name.titleize\n\n respond_to do |format|\n if @fellowship.save\n format.html { redirect_to @fellowship, notice: 'Fellowship was successfully created.' }\n format.json { render :show, status: :created, location: @fellowship }\n else\n format.html { render :new }\n format.json { render json: @fellowship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sinh_vien = SinhVien.new(params[:sinh_vien])\n\n respond_to do |format|\n if @sinh_vien.save \n format.json { render json: @sinh_vien, status: :created, location: @sinh_vien }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pingguodingshirenwu = Pingguodingshirenwu.new(pingguodingshirenwu_params)\n\n respond_to do |format|\n if @pingguodingshirenwu.save\n format.html { redirect_to @pingguodingshirenwu, notice: 'Pingguodingshirenwu was successfully created.' }\n format.json { render :show, status: :created, location: @pingguodingshirenwu }\n else\n format.html { render :new }\n format.json { render json: @pingguodingshirenwu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def create\n @groomsman = Groomsman.new(groomsman_params)\n\n respond_to do |format|\n if @groomsman.save\n format.html { redirect_to @groomsman, notice: 'Groomsman was successfully created.' }\n format.json { render :show, status: :created, location: @groomsman }\n else\n format.html { render :new }\n format.json { render json: @groomsman.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @friendship = current_person.friendships.build(:granter_id => params[:granter_id], :accepted => params[:accepted])\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to people_url, notice: 'A friend request has been sent to ' + Person.find(params[:granter_id]).name }\n format.json { render :show, status: :created, location: @friendship }\n else\n format.html { render :new }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @orphan_sponsorship = OrphanSponsorship.new(orphan_sponsorship_params)\n\n respond_to do |format|\n if @orphan_sponsorship.save\n format.html { redirect_to @orphan_sponsorship, notice: 'Orphan sponsorship was successfully created.' }\n format.json { render :show, status: :created, location: @orphan_sponsorship }\n else\n format.html { render :new }\n format.json { render json: @orphan_sponsorship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(data)\n data.each do |response|\n puts person = @person_repository.create_or_find(response)\n homeworld_response = StarwarsService.get_response(response[\"homeworld\"])\n planet = @planet_repository.find(homeworld_response[\"name\"]).first\n person.planet_id = planet.id\n\n if response[\"species\"].empty? == false\n species_response = StarwarsService.get_response(response[\"species\"].first)\n specie = @specie_repository.find(species_response[\"name\"]).first\n person.specie_id = specie.id\n end\n person.save\n end\n end", "def create\n #Makes an innings associated with a given match\n @innings = Innings.new(innings_params)\n\n respond_to do |format|\n if @innings.save\n format.html { redirect_to match_path(@match), notice: 'Innings was successfully created.' }\n format.json { render :show, status: :created, location: @innings }\n else\n format.html { render :new }\n format.json { render json: @innings.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student_improveship = StudentImproveship.new(params[:student_improveship])\n\n respond_to do |format|\n if @student_improveship.save\n format.html { redirect_to(@student_improveship, :notice => 'Student improveship was successfully created.') }\n format.xml { render :xml => @student_improveship, :status => :created, :location => @student_improveship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_improveship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @guardianship = Guardianship.find(params[:id])\n\n respond_to do |format|\n if @guardianship.update_attributes(params[:guardianship])\n format.html { redirect_to @guardianship, notice: 'Guardianship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sundry_grn = SundryGrn.new(params[:sundry_grn])\n\n respond_to do |format|\n if @sundry_grn.save\n format.html { redirect_to @sundry_grn, :notice => 'Sundry grn was successfully created.' }\n format.json { render :json => @sundry_grn, :status => :created, :location => @sundry_grn }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sundry_grn.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @sinnoh = Sinnoh.new(sinnoh_params)\n\n respond_to do |format|\n if @sinnoh.save\n format.html { redirect_to @sinnoh, notice: 'Sinnoh was successfully created.' }\n format.json { render :show, status: :created, location: @sinnoh }\n else\n format.html { render :new }\n format.json { render json: @sinnoh.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student_howuknowusship = StudentHowuknowusship.new(params[:student_howuknowusship])\n\n respond_to do |format|\n if @student_howuknowusship.save\n format.html { redirect_to(@student_howuknowusship, :notice => 'Student howuknowusship was successfully created.') }\n format.xml { render :xml => @student_howuknowusship, :status => :created, :location => @student_howuknowusship }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_howuknowusship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @shouldersbiceps1 = Shouldersbiceps1.new(shouldersbiceps1_params)\n\n respond_to do |format|\n if @shouldersbiceps1.save\n format.html { redirect_to @shouldersbiceps1, notice: 'Shouldersbiceps1 was successfully created.' }\n format.json { render :show, status: :created, location: @shouldersbiceps1 }\n else\n format.html { render :new }\n format.json { render json: @shouldersbiceps1.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stinsfo = Stinsfo.new(stinsfo_params)\n\n respond_to do |format|\n if @stinsfo.save\n format.html { redirect_to @stinsfo, notice: 'Stinsfo was successfully created.' }\n format.json { render :show, status: :created, location: @stinsfo }\n else\n format.html { render :new }\n format.json { render json: @stinsfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @surgery = Surgery.new(params[:surgery])\n\n respond_to do |format|\n if @surgery.save\n format.html { redirect_to @surgery, notice: 'Surgery was successfully created.' }\n format.json { render json: @surgery, status: :created, location: @surgery }\n else\n format.html { render action: \"new\" }\n format.json { render json: @surgery.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hasuk_house = HasukHouse.new(hasuk_house_params)\n\n respond_to do |format|\n if @hasuk_house.save\n format.html { redirect_to @hasuk_house, notice: 'Hasuk house was successfully created.' }\n format.json { render :show, status: :created, location: @hasuk_house }\n else\n format.html { render :new }\n format.json { render json: @hasuk_house.errors, status: :unprocessable_entity }\n end\n end\n end", "def guardianship_params\n params.require(:guardianship).permit(:endtime)\n end", "def create\n @hamster = Hamster.new(hamster_params)\n\n respond_to do |format|\n if @hamster.save\n format.html { redirect_to @hamster, notice: 'Hamster was successfully created.' }\n format.json { render :show, status: :created, location: @hamster }\n else\n format.html { render :new }\n format.json { render json: @hamster.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search_guardian = SearchGuardian.new(search_guardian_params)\n\n respond_to do |format|\n if @search_guardian.save\n format.html { redirect_to admin_search_guardian_path(@search_guardian), notice: 'Search guardian was successfully created.' }\n format.json { render :show, status: :created, location: @search_guardian }\n else\n format.html { render :new }\n format.json { render json: @search_guardian.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @friendship = @user.friendships.new(params[:friendship])\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to [@game, @user, @friendship], notice: 'Friendship was successfully created.' }\n format.json { render json: [@game, @user, @friendship], status: :created, location: [@game, @user, @friendship] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @game = current_or_guest_user.games.create\n render json: @game, status: 201\n end", "def create\n @village = Village.new(params[:village])\n\n respond_to do |format|\n if @village.save\n format.html { redirect_to @village, notice: 'Village was successfully created.' }\n format.json { render json: @village, status: :created, location: @village }\n else\n format.html { render action: \"new\" }\n format.json { render json: @village.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gatha = Gatha.new(gatha_params)\n\n respond_to do |format|\n if @gatha.save\n format.html { redirect_to @gatha, notice: 'Gatha was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gatha }\n else\n format.html { render action: 'new' }\n format.json { render json: @gatha.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @grooming = Grooming.new(grooming_params)\n\n respond_to do |format|\n if @grooming.save\n format.html { redirect_to @grooming, notice: 'Visit was successfully created.' }\n format.json { render :show, status: :created, location: @grooming }\n else\n format.html { render :new }\n format.json { render json: @grooming.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ginasio = Ginasio.new(params[:ginasio])\n\n respond_to do |format|\n if @ginasio.save\n format.html { redirect_to @ginasio, :flash => { :success => 'Ginasio criado com sucesso!' } }\n format.json { render :json => @ginasio, :status => :created, :location => @ginasio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def guardian_params\n params.require(:guardian).permit(:family_id, :relationship, :active, :primary, :given_name1, :given_name2, :family_name1, :family_name2, :preferred_name, :primary_phone, :secondary_phone)\n end", "def create\n sighting = Sighting.create(sighting_params)\n if sighting.valid?\n render json: sighting\n else\n render json: sighting.errors\n end\n end", "def create\n @hackathon = Hackathon.new(hackathon_params)\n\n respond_to do |format|\n if @hackathon.save\n format.html { redirect_to @hackathon, notice: 'Hackathon was successfully created.' }\n format.json { render :show, status: :created, location: @hackathon }\n else\n format.html { render :new }\n format.json { render json: @hackathon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group_youth = GroupYouth.new(group_youth_params)\n\n respond_to do |format|\n if @group_youth.save\n format.html { redirect_to @group_youth, success: 'El grupo fue <strong>registrado</strong> exitosamente.' }\n format.json { render :show, status: :created, location: @group_youth }\n else\n format.html { render :new }\n format.json { render json: @group_youth.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sighting = Sighting.new(params[:sighting])\n\n respond_to do |format|\n if @sighting.save\n format.html { redirect_to \"/static_pages/home\", notice: 'Sighting was successfully created.' }\n format.json { render json: @sighting, status: :created, location: @sighting }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sighting.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gasto = Gasto.new(params[:gasto])\n\n respond_to do |format|\n if @gasto.save\n format.html { redirect_to @gasto, notice: 'Gasto was successfully created.' }\n format.json { render json: @gasto, status: :created, location: @gasto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gasto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @giang_vien = GiangVien.new(params[:giang_vien])\n\n respond_to do |format|\n if @giang_vien.save \n format.json { render json: @giang_vien, status: :created, location: @giang_vien }\n else \n format.json { render json: @giang_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @village = Village.new(village_params)\n\n respond_to do |format|\n if @village.save\n format.html { redirect_to @village, notice: 'Village was successfully created.' }\n format.json { render :show, status: :created, location: @village }\n else\n format.html { render :new }\n format.json { render json: @village.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @division_pai = DivisionPai.new(division_pai_params)\n\n respond_to do |format|\n if @division_pai.save\n format.html { redirect_to @division_pai, notice: 'Division pais creada exitosamente.' }\n format.json { render :show, status: :created, location: @division_pai }\n else\n format.html { render :new }\n format.json { render json: @division_pai.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @surgery_state = SurgeryState.new(surgery_state_params)\n\n respond_to do |format|\n if @surgery_state.save\n format.html { redirect_to @surgery_state, notice: 'Surgery state was successfully created.' }\n format.json { render :show, status: :created, location: @surgery_state }\n else\n format.html { render :new }\n format.json { render json: @surgery_state.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sloth = Sloth.new(sloth_params)\n\n respond_to do |format|\n if @sloth.save\n format.html { redirect_to @sloth, notice: 'Sloth was successfully created.' }\n format.json { render :show, status: :created, location: @sloth }\n else\n format.html { render :new }\n format.json { render json: @sloth.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@pasien = Pasien.find(params[:pasien_id])\n #@hasil = @pasien.hasils.create(params[:hasil])\n #redirect_to pasien_path(@post)\n @hasil = Hasil.create(params[:hasil])\n\n respond_to do |format|\n if @hasil.save\n format.html { redirect_to @hasil, notice: 'Hasil was successfully created.' }\n format.json { render json: @hasil, status: :created, location: @hasil }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hasil.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @anuphat = Anuphat.new(anuphat_params)\n\n respond_to do |format|\n if @anuphat.save\n format.html { redirect_to @anuphat, notice: 'Anuphat was successfully created.' }\n format.json { render :show, status: :created, location: @anuphat }\n else\n format.html { render :new }\n format.json { render json: @anuphat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @supaagent = Supaagent.new(supaagent_params)\n\n respond_to do |format|\n if @supaagent.save\n format.html { redirect_to action: \"thank_you\", notice: 'Supaagent was successfully created.' }\n format.json { render :show, status: :created, location: @supaagent }\n else\n format.html { render :new }\n format.json { render json: @supaagent.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @the_loai_sach = TheLoaiSach.new(the_loai_sach_params)\n\n respond_to do |format|\n if @the_loai_sach.save\n format.html { redirect_to @the_loai_sach, notice: \"The loai sach was successfully created.\" }\n format.json { render :show, status: :created, location: @the_loai_sach }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @the_loai_sach.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hood = Hood.new(hood_params)\n\n respond_to do |format|\n if @hood.save\n format.html { redirect_to @hood, notice: 'Hood was successfully created.' }\n format.json { render action: 'show', status: :created, location: @hood }\n else\n format.html { render action: 'new' }\n format.json { render json: @hood.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nguoi_dung = NguoiDung.new(params[:nguoi_dung])\n\n respond_to do |format|\n if @nguoi_dung.save\n format.html { redirect_to @nguoi_dung, notice: 'Nguoi dung was successfully created.' }\n format.json { render json: @nguoi_dung, status: :created, location: @nguoi_dung }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nguoi_dung.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @surgery = Surgery.new(surgery_params)\n\n respond_to do |format|\n if @surgery.save\n format.html { redirect_to @surgery, notice: 'Surgery was successfully created.' }\n format.json { render :show, status: :created, location: @surgery }\n else\n format.html { render :new }\n format.json { render json: @surgery.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diagnoz = Diagnoz.new(params[:diagnoz])\n @woman = Woman.find(params[:woman_id])\n @woman.diagnozs << @diagnoz\n respond_to do |format|\n if @diagnoz.save\n params[:diamkhs].each do |p|\n @diamkh = Diamkh.new\n @diamkh.mkh_id = p\n @diamkh.diagnoz_id = @diagnoz.id\n @diamkh.save\n end\n format.html { redirect_to [@woman,@diagnoz], notice: 'Diagnoz was successfully created.' }\n format.json { render json: @diagnoz, status: :created, location: @diagnoz }\n else\n format.html { render action: \"new\" }\n format.json { render json: @diagnoz.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @homily = current_user.homilies.build(homily_params)\n\n respond_to do |format|\n if @homily.save\n format.html { redirect_to @homily, notice: 'Homily was successfully created.' }\n format.json { render :show, status: :created, location: @homily }\n else\n format.html { render :new }\n format.json { render json: @homily.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profesor = Profesor.new(profesor_params)\n\n if @profesor.save\n render json: @profesor, status: :created, location: @profesor\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end", "def create\n @injhas_special_biryani_dish = InjhasSpecialBiryaniDish.new(injhas_special_biryani_dish_params)\n\n respond_to do |format|\n if @injhas_special_biryani_dish.save\n format.html { redirect_to @injhas_special_biryani_dish, notice: 'Injhas special biryani dish was successfully created.' }\n format.json { render :show, status: :created, location: @injhas_special_biryani_dish }\n else\n format.html { render :new }\n format.json { render json: @injhas_special_biryani_dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @seminar = Seminar.find(params[:seminar_id])\n\n @signup = Signup.new(signup_params)\n\n respond_to do |format|\n if @signup.save\n format.html { redirect_to @seminar, notice: \"Signup was successfully created.\" }\n format.json { render :show, status: :created, location: @seminar }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @signup.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sponsorship = Sponsorship.new(sponsorship_params)\n\n respond_to do |format|\n if @sponsorship.save\n format.html { redirect_to \"/sponsorships/new\", notice: 'Thanks for contacting. We will get back to you as soon as possible.' }\n format.json { render :new, status: :created, location: @sponsorship }\n else\n format.html { render :new }\n format.json { render json: @sponsorship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stone = Stone.new(stone_params)\n\n \n if @stone.save\n respond_with @stone\n else\n render json: @stone.errors, status: :unprocessable_entity \n end\n \n \n end", "def create\n \n\n respond_to do |format|\n if @huati.save\n format.html { redirect_to @huati, notice: 'Huati was successfully created.' }\n format.json { render json: @huati, status: :created, location: @huati }\n else\n format.html { render action: \"new\" }\n format.json { render json: @huati.errors, status: :unprocessable_entity }\n end\n end\n end", "def process_post\n service.sign_up_fisherman(\n JSON.parse(request.body.to_s).symbolize_keys\n ).on(\n fishing_application_succeeded: ->(result) {\n response.headers['Content-Type'] = \"application/json\"\n response.body = result.to_json\n true\n },\n fishing_application_conflicts: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 409\n },\n fishing_application_invalid: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 422\n }\n )\n end", "def create\n @giohang = Giohang.new(giohang_params)\n\n respond_to do |format|\n if @giohang.save\n format.html { redirect_to @giohang, notice: \"Giohang was successfully created.\" }\n format.json { render :show, status: :created, location: @giohang }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @giohang.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nail_salon = NailSalon.new(params[:nail_salon])\n\n respond_to do |format|\n if @nail_salon.save\n format.html { redirect_to @nail_salon, notice: 'Nail salon was successfully created.' }\n format.json { render json: @nail_salon, status: :created, location: @nail_salon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nail_salon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spawner = Spawner.new(spawner_params)\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n if @spawner.save\n format.html { redirect_to @spawner, notice: 'Spawner was successfully created.' }\n format.json { render json: @spawner, status: :created, location: @spawner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spawner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @garnish = Garnish.new(garnish_params)\n\n respond_to do |format|\n if @garnish.save\n format.html { redirect_to garnishes_url, notice: 'Garnish was successfully created.' }\n format.json { render :show, status: :created, location: @garnish }\n else\n format.html { render :new }\n format.json { render json: @garnish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @garrison = Garrison.new(garrison_params)\n @garrison.kingdom_id = current_user.current_kingdom.id\n @garrison.recruted = true\n\n respond_to do |format|\n if @garrison.save\n format.html { redirect_to @garrison, notice: 'Garrison was successfully created.' }\n format.json { render action: 'show', status: :created, location: @garrison }\n else\n format.html { render action: 'new' }\n format.json { render json: @garrison.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shower = Shower.new(shower_params)\n\n respond_to do |format|\n if @shower.save\n format.html { redirect_to @shower, notice: 'Shower was successfully created.' }\n format.json { render :show, status: :created, location: @shower }\n else\n format.html { render :new }\n format.json { render json: @shower.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @samochod = Samochod.new(samochod_params)\n\n respond_to do |format|\n if @samochod.save\n format.html { redirect_to @samochod, notice: 'Samochod was successfully created.' }\n format.json { render :show, status: :created, location: @samochod }\n else\n format.html { render :new }\n format.json { render json: @samochod.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n sheeps = params[:sheeps]\n return if params_are_empty(sheeps)\n \n @activity = Activity.new date: convert_date_to_i(params[:date]), comment: params[:comment], a_type: params[:type_of_a], total_costs:params[:total_costs], location: 'farma'\n sheeps.each do |p|\n @vacination = Vacination.new sheep_id:p[:sheep_id], reason: params[:reason], vaccin_name: params[:vaccin_name]\n @activity.vacinations.push(@vacination)\n end\n \n respond_to do |format|\n if @activity.save\n desrtoy_activity(params[:activity_id])\n format.html { redirect_to '/vacinations/'+ @activity.id.to_s, notice: 'Vacination was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vacination }\n else\n format.html { render action: 'new' }\n format.json { render json: @vacination.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @franchise = @location.franchises.new(franchise_params)\n\n respond_to do |format|\n if @franchise.save\n format.html { redirect_to [@client, @location, @franchise], notice: 'Franchise was successfully created.' }\n format.json { render action: 'show', status: :created, location: @franchise }\n else\n format.html { render action: 'new' }\n format.json { render json: @franchise.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bathroom = Bathroom.new(bathroom_params.except(:stalls))\n num_stalls = bathroom_params[:stalls].to_i\n\n respond_to do |format|\n if @bathroom.save\n (0..(num_stalls - 1)).each do |i|\n Stall.new({ bathroom_id: @bathroom.id, state: false, number: @bathroom.stalls.count }).save\n end\n format.html { redirect_to @bathroom, notice: 'Bathroom was successfully created.' }\n format.json { render :show, status: :created, location: @bathroom }\n else\n format.html { render :new }\n format.json { render json: @bathroom.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @guardseason = Guardseason.new(params[:guardseason])\n\n respond_to do |format|\n if @guardseason.save\n format.html { redirect_to @guardseason, notice: 'Vartiokausi luotu.' }\n format.json { render json: @guardseason, status: :created, location: @guardseason }\n else\n format.html { render action: \"new\" }\n format.json { render json: @guardseason.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sinistro = Sinistro.new(sinistro_params)\n\n respond_to do |format|\n if @sinistro.save\n format.html { redirect_to @sinistro, notice: 'Sinistro was successfully created.' }\n format.json { render :show, status: :created, location: @sinistro }\n else\n format.html { render :new }\n format.json { render json: @sinistro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @island = Island.new(params[:island])\n\n respond_to do |format|\n if @island.save\n format.html { redirect_to @island, notice: 'Island was successfully created.' }\n format.json { render json: @island, status: :created, location: @island }\n else\n format.html { render action: \"new\" }\n format.json { render json: @island.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @soatseguro = Soatseguro.new(soatseguro_params)\n\n respond_to do |format|\n if @soatseguro.save\n format.html { redirect_to @soatseguro, notice: 'Soatseguro was successfully created.' }\n format.json { render :show, status: :created, location: @soatseguro }\n else\n format.html { render :new }\n format.json { render json: @soatseguro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @neighborhood = Neighborhood.new(params[:neighborhood])\n\n respond_to do |format|\n if @neighborhood.save\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully created.' }\n format.json { render json: @neighborhood, status: :created, location: @neighborhood }\n else\n format.html { render action: \"new\" }\n format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @neighborhood = Neighborhood.new(params[:neighborhood])\n\n respond_to do |format|\n if @neighborhood.save\n format.html { redirect_to @neighborhood, notice: 'Neighborhood was successfully created.' }\n format.json { render json: @neighborhood, status: :created, location: @neighborhood }\n else\n format.html { render action: \"new\" }\n format.json { render json: @neighborhood.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hoge = Hoge.new(params[:hoge])\n\n respond_to do |format|\n if @hoge.save\n format.html { redirect_to @hoge, notice: 'Hoge was successfully created.' }\n format.json { render json: @hoge, status: :created, location: @hoge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hoge.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @himalaya = Himalaya.new(params[:himalaya])\n\n respond_to do |format|\n if @himalaya.save\n format.html { redirect_to @himalaya, notice: 'Himalaya was successfully created.' }\n format.json { render json: @himalaya, status: :created, location: @himalaya }\n else\n format.html { render action: \"new\" }\n format.json { render json: @himalaya.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hospitalization = Hospitalization.new(hospitalization_params)\n\n respond_to do |format|\n if @hospitalization.save\n format.html { redirect_to @hospitalization, notice: 'Hospitalization was successfully created.' }\n format.json { render :show, status: :created, location: @hospitalization }\n else\n format.html { render :new }\n format.json { render json: @hospitalization.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @zombie_sighting = ZombieSighting.new(lat: params[:lat],\n lng: params[:lng])\n\n respond_to do |format|\n if @zombie_sighting.save\n format.html { redirect_to action: \"index\", notice: 'Zombie sighting was successfully created.' }\n format.json { render json: @zombie_sighting, status: :created, location: @zombie_sighting }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zombie_sighting.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @souvenir = Souvenir.new(souvenir_params)\n\n respond_to do |format|\n if @souvenir.save\n format.html { redirect_to @souvenir, notice: 'Souvenir was successfully created.' }\n format.json { render :show, status: :created, location: @souvenir }\n else\n format.html { render :new }\n format.json { render json: @souvenir.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.75782794", "0.71038777", "0.6781831", "0.65669876", "0.6303177", "0.62367153", "0.62367153", "0.6186352", "0.6071257", "0.59728646", "0.59707654", "0.5968699", "0.5927449", "0.58966047", "0.588447", "0.5864133", "0.58359873", "0.581296", "0.57867855", "0.57743037", "0.5769143", "0.5747138", "0.57468504", "0.5740136", "0.57221466", "0.57181334", "0.5691023", "0.56623346", "0.56614184", "0.5651224", "0.5641665", "0.5636349", "0.5623617", "0.5621767", "0.56118697", "0.56089526", "0.56042016", "0.56030434", "0.5601835", "0.5595341", "0.55697316", "0.5567371", "0.5560921", "0.5559528", "0.5543129", "0.5539896", "0.5537902", "0.5536368", "0.5521855", "0.5519931", "0.5519281", "0.5513587", "0.5513028", "0.5510979", "0.54920083", "0.54881346", "0.5481352", "0.548093", "0.5477756", "0.5474584", "0.54725313", "0.5471751", "0.5455335", "0.5452174", "0.5451728", "0.5449486", "0.5444352", "0.5440961", "0.5438327", "0.54378176", "0.5437564", "0.54360867", "0.5431793", "0.5426479", "0.5425468", "0.5421642", "0.5420562", "0.54196477", "0.54194206", "0.5418316", "0.541113", "0.5409625", "0.54087156", "0.5406698", "0.5404084", "0.5402446", "0.5401611", "0.5393226", "0.5391576", "0.53893495", "0.5387725", "0.53865016", "0.5385231", "0.5383527", "0.5383527", "0.5382358", "0.5381746", "0.5378337", "0.5375865", "0.53754747" ]
0.79171264
0
PUT /guardianships/1 PUT /guardianships/1.json
def update @guardianship = Guardianship.find(params[:id]) respond_to do |format| if @guardianship.update_attributes(params[:guardianship]) format.html { redirect_to @guardianship, notice: 'Guardianship was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @guardianship.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @guardianship.update(guardianship_params)\n format.html { redirect_to @guardianship, notice: 'Guardianship was successfully updated.' }\n format.json { render :show, status: :ok, location: @guardianship }\n else\n format.html { render :edit }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_guardianship\n @guardianship = Guardianship.find(params[:id])\n end", "def set_guardianship\n @guardianship = Guardianship.find(params[:id])\n end", "def create\n @guardianship = Guardianship.new(guardianship_params)\n @guardianship.user_id = current_user.id\n\n respond_to do |format|\n if @guardianship.save\n format.html { redirect_to root_path, notice: 'Guardianship was successfully created.' }\n format.json { render :show, status: :created, location: @guardianship }\n else\n format.html { render root }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @guardianship = Guardianship.new(params[:guardianship])\n\n respond_to do |format|\n if @guardianship.save\n format.html { redirect_to @guardianship, notice: 'Guardianship was successfully created.' }\n format.json { render json: @guardianship, status: :created, location: @guardianship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @guardianship.errors, status: :unprocessable_entity }\n end\n end\n end", "def guardianship_params\n params.require(:guardianship).permit(:guardian_id, :user_id)\n end", "def show\n @guardianship = Guardianship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guardianship }\n end\n end", "def destroy\n @guardianship = Guardianship.find(params[:id])\n @guardianship.destroy\n\n respond_to do |format|\n format.html { redirect_to guardianships_url }\n format.json { head :no_content }\n end\n end", "def new\n @guardianship = Guardianship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @guardianship }\n end\n end", "def update\n @guardian = Guardian.find(params[:id])\n\n respond_to do |format|\n if @guardian.update_attributes(params[:guardian])\n flash[:notice] = 'Guardian was successfully updated.'\n format.html { redirect_to(@guardian) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @guardian.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @guardian.update(guardian_params)\n format.html { redirect_to @guardian, notice: tr(\"guardian_updated\") }\n else\n format.html { render :edit }\n end\n end\n end", "def index\n @guardianships = Guardianship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guardianships }\n end\n end", "def update\n respond_to do |format|\n if @shouldersbiceps1.update(shouldersbiceps1_params)\n format.html { redirect_to \"/shouldersbiceps1s\"}\n format.json { render :show, status: :ok, location: @shouldersbiceps1 }\n else\n format.html { render :edit }\n format.json { render json: @shouldersbiceps1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @guardian_id = args[:guardian_id] if args.key?(:guardian_id)\n @guardian_profile = args[:guardian_profile] if args.key?(:guardian_profile)\n @invited_email_address = args[:invited_email_address] if args.key?(:invited_email_address)\n @student_id = args[:student_id] if args.key?(:student_id)\n end", "def destroy\n @guardianship.destroy\n respond_to do |format|\n format.html { redirect_to guardianships_url, notice: 'Guardianship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @guardianships = Guardianship.all\n end", "def update\n respond_to do |format|\n if @souvenior.update(souvenior_params)\n format.html { redirect_to @souvenior, notice: 'Souvenior was successfully updated.' }\n format.json { render :show, status: :ok, location: @souvenior }\n else\n format.html { render :edit }\n format.json { render json: @souvenior.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n tournament = Tournament.find(params[:id])\n status = nil\n\n if params[:tournament][:is_checked]\n registrator = UserRegistrator.new(current_user, tournament)\n signup = registrator.checkin\n\n status = registrator.post_status(signup)\n elsif params[:tournament][:is_registered]\n registrator = UserRegistrator.new(current_user, tournament)\n signup = registrator.signup\n\n status = registrator.post_status(signup)\n elsif !params[:tournament][:is_checked] && !params[:tournament][:is_registered]\n tournament.unregister(current_user)\n end\n\n if params[:tournament][:starts_at]\n attributes = params[:tournament].extract!(:starts_at, :name, :bo_preset, :map_preset)\n tournament.update_attributes(attributes)\n end\n\n render json: tournament\n end", "def update\n respond_to do |format|\n if @shogi.update(shogi_params)\n format.html { redirect_to @shogi, notice: 'Shogi was successfully updated.' }\n format.json { render :show, status: :ok, location: @shogi }\n else\n format.html { render :edit }\n format.json { render json: @shogi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n if @shichoson.update_attributes(params[:shichoson])\n format.html { redirect_to @shichoson, notice: 'Shichoson was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shichoson.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_guardian\n @guardian = Guardian.find(params[:id])\n end", "def update\n goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end", "def update\n respond_to do |format|\n if @orphan_sponsorship.update(orphan_sponsorship_params)\n format.html { redirect_to @orphan_sponsorship, notice: 'Orphan sponsorship was successfully updated.' }\n format.json { render :show, status: :ok, location: @orphan_sponsorship }\n else\n format.html { render :edit }\n format.json { render json: @orphan_sponsorship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @child_guardian_relationship = ChildGuardianRelationship.find(params[:id])\n\n respond_to do |format|\n if @child_guardian_relationship.update_attributes(params[:child_guardian_relationship])\n format.html { redirect_to @child_guardian_relationship, notice: 'Child guardian relationship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @child_guardian_relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shelf.update(shelf_params)\n format.html { redirect_to house_shelves_path(params[:house_id]), notice: 'Shelf was successfully created.' } \n format.json { render :show, status: :ok, location: @shelf }\n else\n format.html { render :edit }\n format.json { render json: @shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hospice.update(hospice_params)\n format.html { redirect_to @hospice, notice: 'Hospice was successfully updated.' }\n format.json { render :show, status: :ok, location: @hospice }\n else\n format.html { render :edit }\n format.json { render json: @hospice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @guardians = args[:guardians] if args.key?(:guardians)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n if @gasto.update_attributes(params[:gasto])\n format.html { redirect_to @gasto, notice: 'Gasto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gasto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @souvenior = Souvenior.new(souvenior_params)\n\n respond_to do |format|\n if @souvenior.save\n format.html { redirect_to root_path, notice: 'Souvenior was successfully created.' }\n format.json { render :show, status: :created, location: @souvenior }\n else\n format.html { render :new }\n format.json { render json: @souvenior.errors, status: :unprocessable_entity }\n end\n end\n end", "def guardian_params\n params.require(:guardian).permit(:family_id, :relationship, :active, :primary, :given_name1, :given_name2, :family_name1, :family_name2, :preferred_name, :primary_phone, :secondary_phone)\n end", "def update\n respond_to do |format|\n if @shiva.update(shiva_params)\n format.html { redirect_to @shiva, notice: 'Shiva was successfully updated.' }\n format.json { render :show, status: :ok, location: @shiva }\n else\n format.html { render :edit }\n format.json { render json: @shiva.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n if @ginasio.update_attributes(params[:ginasio])\n format.html { redirect_to @ginasio, :flash => { :success => 'Dados do ginasio alterados com successo!' } }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ginasio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ganho.update(ganho_params)\n format.html { redirect_to @ganho, notice: 'Ganho was successfully updated.' }\n format.json { render :show, status: :ok, location: @ganho }\n else\n format.html { render :edit }\n format.json { render json: @ganho.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single family based on the id\n family = Family.find_by(id: the_id)\n\n # update it\n if family.update!(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end", "def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end", "def create\n @guardian = Guardian.new(guardian_params)\n\n respond_to do |format|\n if @guardian.save\n format.html { redirect_to @guardian, notice: tr(\"guardian_created\") }\n else\n format.html { render :new }\n end\n end\n end", "def update\n respond_to do |format|\n if @sponsorship.update(sponsorship_params)\n format.html { redirect_to @sponsorship, notice: 'Sponsorship was successfully updated.' }\n format.json { render :show, status: :ok, location: @sponsorship }\n else\n format.html { render :edit }\n format.json { render json: @sponsorship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @guard = Guard.find(params[:id])\n\n respond_to do |format|\n if @guard.update_attributes(params[:guard])\n flash[:notice] = 'Guard was successfully updated.'\n format.html { redirect_to(@guard) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @guard.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lifeguard.update(lifeguard_params)\n format.html { redirect_to @lifeguard, notice: 'Lifeguard was successfully updated.' }\n format.json { render :show, status: :ok, location: @lifeguard }\n else\n format.html { render :edit }\n format.json { render json: @lifeguard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shain.update(shain_params)\n format.html { redirect_to @shain.becomes(Shain), notice: 'Shain was successfully updated.' }\n format.json { render :show, status: :ok, location: @shain.becomes(Shain) }\n else\n format.html { render :edit }\n format.json { render json: @shain.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @groomsman.update(groomsman_params)\n format.html { redirect_to @groomsman, notice: 'Groomsman was successfully updated.' }\n format.json { render :show, status: :ok, location: @groomsman }\n else\n format.html { render :edit }\n format.json { render json: @groomsman.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sinh_vien = SinhVien.find(params[:id])\n\n respond_to do |format|\n if @sinh_vien.update_attributes(params[:sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @search_guardian.update(search_guardian_params)\n format.html { redirect_to admin_search_guardian_path(@search_guardian), notice: 'Search guardian was successfully updated.' }\n format.json { render :show, status: :ok, location: @search_guardian }\n else\n format.html { render :edit }\n format.json { render json: @search_guardian.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fellowship.update(fellowship_params)\n format.html { redirect_to @fellowship, notice: 'Fellowship was successfully updated.' }\n format.json { render :show, status: :ok, location: @fellowship }\n else\n format.html { render :edit }\n format.json { render json: @fellowship.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 @shower.update(shower_params)\n format.html { redirect_to @shower, notice: 'Shower was successfully updated.' }\n format.json { render :show, status: :ok, location: @shower }\n else\n format.html { render :edit }\n format.json { render json: @shower.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end", "def update\n respond_to do |format|\n if @hamster.update(hamster_params)\n format.html { redirect_to @hamster, notice: 'Hamster was successfully updated.' }\n format.json { render :show, status: :ok, location: @hamster }\n else\n format.html { render :edit }\n format.json { render json: @hamster.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @organization_shebao.update(organization_shebao_params)\n format.html { redirect_to @organization_shebao, notice: 'Organization shebao was successfully updated.' }\n format.json { render :show, status: :ok, location: @organization_shebao }\n else\n format.html { render :edit }\n format.json { render json: @organization_shebao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @consists_of.update(consists_of_params)\n format.html { redirect_to @consists_of, notice: 'Consists of was successfully updated.' }\n format.json { render :show, status: :ok, location: @consists_of }\n else\n format.html { render :edit }\n format.json { render json: @consists_of.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spaethi = Spaethi.find(params[:id])\n\n respond_to do |format|\n if @spaethi.update_attributes(params[:spaethi])\n format.html { redirect_to @spaethi, notice: 'Spaethi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spaethi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @horace = Horace.find(params[:id])\n\n respond_to do |format|\n if @horace.update_attributes(params[:horace])\n format.html { redirect_to @horace, notice: 'Horace was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @horace.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #update venues trought users controller\n\n @user = User.find_by(authentication_token: request.headers['Authorization'])\n\n if @user.is_venue?\n @user.venue.update(venue_params)\n if @user.venue.update(venue_params)\n render json: {status: :ok}\n else\n render json: {msg: 'Invalid params'}\n end\n else\n render json: {msg: 'You dont own a venue'}, status: :error\n end\n \n\n end", "def create\n @guardian = Guardian.new(params[:guardian])\n\n respond_to do |format|\n if @guardian.save\n flash[:notice] = 'Guardian was successfully created.'\n format.html { redirect_to(@guardian) }\n format.xml { render :xml => @guardian, :status => :created, :location => @guardian }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @guardian.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @registro_guardium.update(registro_guardium_params)\n format.html { redirect_to @registro_guardium, notice: 'Registro guardium was successfully updated.' }\n format.json { render :show, status: :ok, location: @registro_guardium }\n else\n format.html { render :edit }\n format.json { render json: @registro_guardium.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n respond_to do |format|\n if @hood.update(hood_params)\n format.html { redirect_to @hood, notice: 'Hood was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hood.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shouldersbicepshome3.update(shouldersbicepshome3_params)\n format.html { redirect_to \"/shouldersbicepshome3s\"}\n format.json { render :show, status: :ok, location: @shouldersbicepshome3 }\n else\n format.html { render :edit }\n format.json { render json: @shouldersbicepshome3.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n data = {\n \"slug\" => @slug,\n \"title\" => @title,\n \"ephem\" => @ephem || false,\n \"panic\" => @panic || 86400,\n \"secret\" => @secret || false,\n \"datapublic\" => @datapublic || false,\n }\n data['roadall'] = @roadall if @roadall\n\n @user.put_document \"users/me/goals/#{@slug}.json\", data\n end", "def update\n @village = Village.find(params[:id])\n\n respond_to do |format|\n if @village.update_attributes(params[:village])\n format.html { redirect_to @village, notice: 'Village was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @village.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n friendship_new = Friendship.new\n friendship_new.user1_id = @friendship.user2_id\n friendship_new.user2_id = @friendship.user1_id\n friendship_new.approved = true\n friendship_new.save!\n @friendship.approved = true\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to back_page, flash: { :success => 'Friendship was approved.' } }\n format.json { render :index, status: :ok, location: @friendship }\n else\n set_index_friendships\n format.html { render :index }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update_almacen,Sigesp::Solicitud\n if @sigesp_solicitud.update(sigesp_solicitud_alamcen_params)\n return render json: { url: sigesp_solicitudsalmacen_path(@sigesp_solicitud)} \n else\n return render json:@sigesp_solicitud.errors ,status: :unprocessable_entity\n end \n end", "def update\n respond_to do |format|\n if @gameroom.update(gameroom_params)\n format.html { redirect_to @gameroom, notice: 'Gameroom was successfully updated.' }\n format.json { render :show, status: :ok, location: @gameroom }\n else\n format.html { render :edit }\n format.json { render json: @gameroom.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(obj, which=:groups)\n path = \"/#{which}\"\n path += \"/#{obj['ID']}\" unless obj['ID'].nil? \n resp = self.class.post(path, { :body => obj })\n check_errors resp\n res = resp.parsed_response['Response']['Entry']\n rebuild_groups! res\n res\n end", "def create\n @sherlock = Sherlock.new(params[:sherlock])\n\t\tactive_required = []\n\t\tactive_desired = []\n\t\tactive_nots = []\n\t\tparams[:required].each { |k,v| if v==\"1\" then active_required << k end }\n\t\tparams[:desired].each { |k,v| if v==\"1\" then active_desired << k end }\n\t\tparams[:nots].each { |k,v| if v==\"1\" then active_nots << k end }\n\t\[email protected] = active_required\n\t\[email protected] = active_desired\n\t\[email protected] = active_nots\n\n respond_to do |format|\n if @sherlock.save\n format.html { redirect_to(@sherlock) }\n format.xml { render :xml => @sherlock, :status => :created, :location => @sherlock }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sherlock.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sinnoh.update(sinnoh_params)\n format.html { redirect_to @sinnoh, notice: 'Sinnoh was successfully updated.' }\n format.json { render :show, status: :ok, location: @sinnoh }\n else\n format.html { render :edit }\n format.json { render json: @sinnoh.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shindan.update(shindan_params)\n format.html { redirect_to @shindan, notice: 'Shindan was successfully updated.' }\n format.json { render :show, status: :ok, location: @shindan }\n else\n format.html { render :edit }\n format.json { render json: @shindan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @supaagent.update(supaagent_params)\n format.html { redirect_to edit_supaagent_path(@supaagent.id+1), notice: 'Supaagent was successfully updated.' }\n format.json { render :show, status: :ok, location: @supaagent }\n else\n format.html { render :edit }\n format.json { render json: @supaagent.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shogi = Shogi.new(shogi_params)\n\n respond_to do |format|\n if @shogi.save\n format.html { redirect_to @shogi, notice: 'Shogi was successfully created.' }\n format.json { render :show, status: :created, location: @shogi }\n else\n format.html { render :new }\n format.json { render json: @shogi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @male_shot_put_head.update(male_shot_put_head_params)\n format.html { redirect_to @male_shot_put_head, notice: 'Male shot put head was successfully updated.' }\n format.json { render :show, status: :ok, location: @male_shot_put_head }\n else\n format.html { render :edit }\n format.json { render json: @male_shot_put_head.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @grooming.update(grooming_params)\n format.html { redirect_to @grooming, notice: 'Visit was successfully updated.' }\n format.json { render :show, status: :ok, location: @grooming }\n else\n format.html { render :edit }\n format.json { render json: @grooming.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @galaxies_lenticular_galaxy = Galaxies::LenticularGalaxy.find(params[:id])\n\n respond_to do |format|\n if @galaxies_lenticular_galaxy.update_attributes(params[:galaxies_lenticular_galaxy])\n format.html { redirect_to @galaxies_lenticular_galaxy, :notice => 'Lenticular galaxy was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @galaxies_lenticular_galaxy.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @samochod.update(samochod_params)\n format.html { redirect_to @samochod, notice: 'Samochod was successfully updated.' }\n format.json { render :show, status: :ok, location: @samochod }\n else\n format.html { render :edit }\n format.json { render json: @samochod.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gossip = Gossip.find(params[:id])\n\n respond_to do |format|\n if @gossip.update_attributes(params[:gossip])\n format.html { redirect_to @gossip, notice: 'Gossip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gossip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @sighting.update(sighting_params)\n render json: @sighting, status: :ok, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def update\n @client = Client.find(params[:client_id])\n @horse = @client.horses.find(params[:id])\n\n respond_to do |format|\n if @horse.update(horse_params)\n format.html { redirect_to client_horse_path(@client, @horse), notice: 'Horse was successfully updated.' }\n format.json { render :show, status: :ok, location: @horse }\n else\n format.html { render :edit }\n format.json { render json: @horse.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if @vineyard.user == current_user\n if @vineyard.update(vineyard_params)\n render json: @vineyard\n else\n render json: @vineyard.errors, status: :unprocessable_entity\n end\n else\n render json: { errors: [\"Unauthorized\"] }, status: 401\n end\n end", "def update\n respond_to do |format|\n if @village.update(village_params)\n format.html { redirect_to @village, notice: 'Village was successfully updated.' }\n format.json { render :show, status: :ok, location: @village }\n else\n format.html { render :edit }\n format.json { render json: @village.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, Hospital\n respond_to do |format|\n if @hospital.update(hospital_params)\n format.html { redirect_to @hospital, notice: 'Hospital was successfully updated.' }\n format.json { render :show, status: :ok, location: @hospital }\n else\n format.html { render :edit }\n format.json { render json: @hospital.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sloth.update(sloth_params)\n format.html { redirect_to @sloth, notice: 'Sloth was successfully updated.' }\n format.json { render :show, status: :ok, location: @sloth }\n else\n format.html { render :edit }\n format.json { render json: @sloth.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @squire.update(squire_params)\n format.html { redirect_to @squire, notice: 'Squire was successfully updated.' }\n format.json { render :show, status: :ok, location: @squire }\n else\n format.html { render :edit }\n format.json { render json: @squire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sponsor.update(sponsor_params)\n format.html { redirect_to sponsors_url, notice: 'El auspiciante se actualizó correctamente.' }\n format.json { render :show, status: :ok, location: sponsors_url }\n else\n format.html { render :edit }\n format.json { render json: @sponsor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @family.slug=nil\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'La familia fue actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sousgroupe.update(sousgroupe_params)\n format.html { redirect_to @sousgroupe, notice: 'Sousgroupe was successfully updated.' }\n format.json { render :show, status: :ok, location: @sousgroupe }\n else\n format.html { render :edit }\n format.json { render json: @sousgroupe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hackathon.update(hackathon_params)\n format.html { redirect_to @hackathon, notice: 'Hackathon was successfully updated.' }\n format.json { render :show, status: :ok, location: @hackathon }\n else\n format.html { render :edit }\n format.json { render json: @hackathon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hackathon.update(hackathon_params)\n format.html { redirect_to @hackathon, notice: 'Hackathon was successfully updated.' }\n format.json { render :show, status: :ok, location: @hackathon }\n else\n format.html { render :edit }\n format.json { render json: @hackathon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instagramposter.update(instagramposter_params)\n format.html { redirect_to [:admin, @instagramposter], notice: 'Instagramposter was successfully updated.' }\n format.json { render :show, status: :ok, location: @instagramposter }\n else\n format.html { render :edit }\n format.json { render json: @instagramposter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\n authorize! :update, HoursRegistration\n respond_to do |format|\n if @hours_registration.update(hours_registration_params)\n format.html { redirect_to @hours_registration, notice: 'Hours registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @hours_registration }\n else\n format.html { render :edit }\n format.json { render json: @hours_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @studenthousinginfo = Studenthousinginfo.new(studenthousinginfo_params)\n @studenthousinginfo.status = 'Waiting for Approval'\n\n respond_to do |format|\n if @studenthousinginfo.save\n format.html { redirect_to @studenthousinginfo, notice: 'Studenthousinginfo was successfully created.' }\n format.json { render :show, status: :created, location: @studenthousinginfo }\n else\n format.html { render :new }\n format.json { render json: @studenthousinginfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hospice = Hospice.new(hospice_params)\n\n respond_to do |format|\n if @hospice.save\n format.html { redirect_to @hospice, notice: 'Hospice was successfully created.' }\n format.json { render :show, status: :created, location: @hospice }\n else\n format.html { render :new }\n format.json { render json: @hospice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book_usership = BookUsership.find(params[:id])\n\n respond_to do |format|\n if @book_usership.update_attributes(params[:book_usership])\n format.html { redirect_to @book_usership, notice: 'Book usership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_usership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @guardseason = Guardseason.find(params[:id])\n\n respond_to do |format|\n if @guardseason.update_attributes(params[:guardseason])\n format.html { redirect_to @guardseason, notice: 'Vartiokausi päivitetty.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @guardseason.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @souvenir.update(souvenir_params)\n format.html { redirect_to @souvenir, notice: 'Souvenir was successfully updated.' }\n format.json { render json: { user: @souvenir, status: 200, description: 'Souvenir was successfully updated.' }, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: { user: @souvenir, status: 500, description: 'Internal server error : faliled to save' }, status: :internal_server_error }\n end\n end\n end", "def update\n respond_to do |format|\n if @stinsfo.update(stinsfo_params)\n format.html { redirect_to @stinsfo, notice: 'Stinsfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @stinsfo }\n else\n format.html { render :edit }\n format.json { render json: @stinsfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sinistro.update(sinistro_params)\n format.html { redirect_to @sinistro, notice: 'Sinistro was successfully updated.' }\n format.json { render :show, status: :ok, location: @sinistro }\n else\n format.html { render :edit }\n format.json { render json: @sinistro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @single_housing.update(single_housing_params)\n format.html { redirect_to @single_housing, notice: 'Single housing was successfully updated.' }\n format.json { render :show, status: :ok, location: @single_housing }\n else\n format.html { render :edit }\n format.json { render json: @single_housing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # if @tournament.update(tournament_params)\n # render :show, status: :ok, location: @tournament\n # else\n # render json: @tournament.errors, status: :unprocessable_entity\n # end\n end", "def update\n if params[:place_id]\n @safe_house = Place.find(params[:place_id])\n place_id_present = true\n end\n\n respond_to do |format|\n if place_id_present && @safe_house.update_attributes( :name => params[:name],\n :zombie_probability => params[:zombie_probability],\n :latitude => params[:latitude],\n :longitude => params[:longitude],\n :has_weapons => params[:has_weapons],\n :has_food => params[:has_food],\n :has_people => params[:has_people])\n format.json { render :json => { :status => \"OK\", :response => {:updated => true} }}\n else\n format.json { render :json => { :status => \"Error\", :response => {} }}\n end\n end\n end", "def update\n if @physician.update(survey_params)\n head :no_content\n else\n render json: @physician.errors, status: :unprocessable_entity\n end\n end" ]
[ "0.7333053", "0.6891642", "0.6891642", "0.6852429", "0.6841136", "0.67517424", "0.6175291", "0.61095816", "0.6083545", "0.60093784", "0.5902715", "0.5810329", "0.57628214", "0.57432055", "0.5726148", "0.5717856", "0.5712531", "0.5668891", "0.5657254", "0.5639566", "0.561592", "0.5609235", "0.55852073", "0.55104345", "0.550851", "0.55007577", "0.54840755", "0.54586583", "0.5441431", "0.5416169", "0.5415691", "0.5411122", "0.5408518", "0.5408086", "0.5403726", "0.53990704", "0.53983057", "0.5397148", "0.53845304", "0.5380973", "0.53791875", "0.5361875", "0.53490764", "0.53333336", "0.5333158", "0.5322116", "0.53216356", "0.5313581", "0.53023535", "0.53005576", "0.52978545", "0.5294324", "0.5292034", "0.52867407", "0.52862066", "0.52825356", "0.5282442", "0.5282411", "0.52811974", "0.52807224", "0.5279048", "0.5273145", "0.5269145", "0.52682966", "0.52682024", "0.52630895", "0.5258133", "0.5255481", "0.5252807", "0.5252762", "0.52516913", "0.52480036", "0.5230523", "0.52208155", "0.5220579", "0.52204716", "0.52200717", "0.5211153", "0.5204639", "0.520433", "0.5204158", "0.5202965", "0.52027494", "0.5194265", "0.519047", "0.519047", "0.51889104", "0.51874715", "0.5185352", "0.51844144", "0.51790124", "0.5177866", "0.51771647", "0.5175422", "0.5170315", "0.51681393", "0.5167808", "0.5166028", "0.5165005", "0.51635426" ]
0.7311316
1
DELETE /guardianships/1 DELETE /guardianships/1.json
def destroy @guardianship = Guardianship.find(params[:id]) @guardianship.destroy respond_to do |format| format.html { redirect_to guardianships_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @guardianship.destroy\n respond_to do |format|\n format.html { redirect_to guardianships_url, notice: 'Guardianship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @guardian = Guardian.find(params[:id])\n @guardian.destroy\n\n respond_to do |format|\n format.html { redirect_to(guardians_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shouldersbiceps1.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbiceps1s_url, notice: 'Shouldersbiceps1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shichoson = Shichoson.find(params[:id])\n @shichoson.destroy\n\n respond_to do |format|\n format.html { redirect_to shichosons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @child_guardian_relationship = ChildGuardianRelationship.find(params[:id])\n @child_guardian_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to child_guardian_relationships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @surah.destroy\n respond_to do |format|\n format.html { redirect_to surahs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @jido_guardian_rel = JidoGuardianRel.find(params[:id])\n @jido_guardian_rel.destroy\n\n respond_to do |format|\n format.html { redirect_to(jido_guardian_rels_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @garantium.destroy\n respond_to do |format|\n format.html { redirect_to garantia_url, notice: 'Garantium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gatha.destroy\n respond_to do |format|\n format.html { redirect_to gathas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asthenium.destroy\n respond_to do |format|\n format.html { redirect_to asthenia_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gasto = Gasto.find(params[:id])\n @gasto.destroy\n\n respond_to do |format|\n format.html { redirect_to gastos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ginasio = Ginasio.find(params[:id])\n @ginasio.destroy\n\n respond_to do |format|\n format.html { redirect_to ginasios_url, :flash => { :notice => 'Ginasio apagado.' } }\n format.json { head :ok }\n end\n end", "def destroy\n @gopy = Gopy.find(params[:id])\n @gopy.destroy\n\n respond_to do |format|\n #format.html { redirect_to gopies_url }\n format.html { redirect_to hienthi_gopies_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @gastronomium.destroy\n respond_to do |format|\n format.html { redirect_to gastronomia_url, notice: 'Gastronomium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ganho.destroy\n respond_to do |format|\n format.html { redirect_to ganhos_url, notice: 'Ganho was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @guard = Guard.find(params[:id])\n @guard.destroy\n\n respond_to do |format|\n format.html { redirect_to(guards_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @historial = Historial.find(params[:id])\n @historial.destroy\n\n respond_to do |format|\n format.html { redirect_to historials_url }\n format.json { head :ok }\n end\n end", "def delete_pathway\n pathway = Pathway.find(params[:pathway_par])\n current_user.pathways.delete(pathway)\n if current_user.pathways.size < 1\n respond_to do |format|\n format.html { redirect_to '/saved#pathways' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @hospital = Hospital.find(params[:id])\n @hospital.destroy\n\n respond_to do |format|\n format.html { redirect_to hospitals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lifeguard.destroy\n respond_to do |format|\n format.html { redirect_to lifeguards_url, notice: 'Lifeguard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sabio = Sabio.find(params[:id])\n @sabio.destroy\n\n respond_to do |format|\n format.html { redirect_to sabios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @franchise.destroy\n respond_to do |format|\n format.html { redirect_to client_location_franchises_path(@client, @location) }\n format.json { head :no_content }\n end\n end", "def destroy\n franchise.destroy\n\n respond_to do |format|\n format.html { redirect_to franchises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @garrison.destroy\n respond_to do |format|\n format.html { redirect_to garrisons_path_for(@garrison) }\n format.json { head :no_content }\n end\n end", "def destroy\n @gameroom = Gameroom.find(params[:id])\n if @gameroom.destroy\n render json: @gameroom, status: :accepted\n else\n render json: {errors: @gameroom.errors.full_messages}, status: :unprocessable_entity\n end\n end", "def destroy\n @rishabh.destroy\n respond_to do |format|\n format.html { redirect_to rishabhs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @horace = Horace.find(params[:id])\n @horace.destroy\n\n respond_to do |format|\n format.html { redirect_to horaces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @samochod.destroy\n respond_to do |format|\n format.html { redirect_to samochods_url, notice: 'Samochod was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @registro_guardium.destroy\n respond_to do |format|\n format.html { redirect_to registro_guardia_url, notice: 'Registro guardium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hospice.destroy\n respond_to do |format|\n format.html { redirect_to hospices_url, notice: 'Hospice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @galinha.destroy\n respond_to do |format|\n format.html { redirect_to galinhas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hoge = Hoge.find(params[:id])\n @hoge.destroy\n\n respond_to do |format|\n format.html { redirect_to hoges_url }\n format.json { head :ok }\n end\n end", "def destroy\n @hood.destroy\n respond_to do |format|\n format.html { redirect_to hoods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end", "def destroy\n @gpath = Gpath.find(params[:id])\n @gpath.destroy\n\n respond_to do |format|\n format.html { redirect_to gpaths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to gigs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @golfer = Golfer.find(params[:id])\n @golfer.destroy\n\n respond_to do |format|\n format.html { redirect_to golfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @homily.destroy\n respond_to do |format|\n format.html { redirect_to homilies_url, notice: 'Homily was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gaz_assay = GazAssay.find(params[:id])\n @gaz_assay.destroy\n\n respond_to do |format|\n format.html { redirect_to gaz_assays_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @shogi.destroy\n respond_to do |format|\n format.html { redirect_to shogis_url, notice: 'Shogi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hackathon.destroy\n respond_to do |format|\n format.html { redirect_to hackathons_url, notice: 'Hackathon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @grupa = Grupa.find(params[:id])\n @grupa.destroy\n\n respond_to do |format|\n format.html { redirect_to grupy_url }\n format.json { head :no_content }\n end\n end", "def destroy\n self.auth_admin\n @hall = Hall.where(name: @item.location)\n @item.destroy\n respond_to do |format|\n format.html { redirect_to halls_path(@hall), notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fellowship.destroy\n respond_to do |format|\n format.html { redirect_to fellowships_url, notice: 'Fellowship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @grooming.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Visit was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hamster.destroy\n respond_to do |format|\n format.html { redirect_to hamsters_url, notice: 'Hamster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @habitant.destroy\n respond_to do |format|\n format.html { redirect_to habitants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @zombie_sighting = ZombieSighting.find(params[:id])\n @zombie_sighting.destroy\n\n respond_to do |format|\n format.html { redirect_to zombie_sightings_url }\n format.json { head :ok }\n end\n end", "def destroy\n @hospitalization = Hospitalization.find(params[:id])\n @hospitalization.destroy\n\n respond_to do |format|\n format.html { redirect_to client_hospitalizations_url(@client) }\n format.json { head :ok }\n end\n end", "def destroy\r\n @sivic_ministerio.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_ministerios_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @four.destroy\n respond_to do |format|\n format.html { redirect_to fours_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bracket_golfer.destroy\n respond_to do |format|\n format.html { redirect_to bracket_golfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @healthpro.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @shain.destroy\n respond_to do |format|\n format.html { redirect_to shains_url, notice: 'Shain was successfully destroyed.' }\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 @uginuce.sheep.update status:'na farmi'\n @uginuce.destroy\n respond_to do |format|\n format.html { redirect_to uginuces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dataload_ga = DataloadGa.find(params[:id])\n @dataload_ga.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_gas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @galaxies_lenticular_galaxy = Galaxies::LenticularGalaxy.find(params[:id])\n @galaxies_lenticular_galaxy.destroy\n\n respond_to do |format|\n format.html { redirect_to galaxies_lenticular_galaxies_url }\n format.json { head :ok }\n end\n end", "def delete\n supprimer = SondageService.instance.supprimerSondage(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\nend", "def destroy\n @six.destroy\n respond_to do |format|\n format.html { redirect_to sixes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @groomsman.destroy\n respond_to do |format|\n format.html { redirect_to groomsmen_url, notice: 'Groomsman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @guardario.destroy\n respond_to do |format|\n format.html { redirect_to guardarios_url, notice: 'Guardario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @baz72.destroy\n respond_to do |format|\n format.html { redirect_to baz72s_url, notice: \"Baz72 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @anuncio.destroy\n respond_to do |format|\n format.html { redirect_to @street, notice: 'Anuncio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @himalaya.destroy\n\n respond_to do |format|\n format.html { redirect_to himalayas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shouldersbicepshome3.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbicepshome3s_url, notice: 'Shouldersbicepshome3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @socio_rg.destroy\n respond_to do |format|\n format.html { redirect_to socio_rgs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ref_sanatorium = Ref::Sanatorium.find(params[:id])\n @ref_sanatorium.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_sanatoria_url }\n format.json { head :ok }\n end\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ninja = Ninja.find(params[:id])\n @ninja.destroy\n\n respond_to do |format|\n format.html { redirect_to ninjas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @farmacium.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end", "def destroy\n @admin_village = Admin::Village.find(params[:id])\n @admin_village.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_villages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @garply.destroy\n respond_to do |format|\n format.html { redirect_to garplies_url, notice: 'Garply was successfully destroyed.' }\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 @nightclub.destroy\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sitio = Sitio.find(params[:id])\n @sitio.destroy\n\n respond_to do |format|\n format.html { redirect_to sitios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nail_salon = NailSalon.find(params[:id])\n @nail_salon.destroy\n\n respond_to do |format|\n format.html { redirect_to nail_salons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hospital_general.destroy\n respond_to do |format|\n format.html { redirect_to hospital_generals_url, notice: 'Hospital general was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to ministerios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_url, notice: 'El plato se ha eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @aspirant = Aspirant.find(params[:id])\n @aspirant.destroy\n\n respond_to do |format|\n format.html { redirect_to aspirants_url }\n format.json { head :ok }\n end\n end", "def destroy\n @village = Village.find(params[:id])\n @village.destroy\n\n respond_to do |format|\n format.html { redirect_to villages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @discipleship.destroy\n respond_to do |format|\n format.html { redirect_to discipleships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @female3000mtsobstacle.destroy\n respond_to do |format|\n format.html { redirect_to female3000mtsobstacles_url, notice: 'Female3000mtsobstacle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @club_path = ClubPath.find(params[:id])\n @club_path.destroy\n\n respond_to do |format|\n format.html { redirect_to club_paths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sundry_grn = SundryGrn.find(params[:id])\n @sundry_grn.destroy\n\n respond_to do |format|\n format.html { redirect_to sundry_grns_url }\n format.json { head :ok }\n end\n end", "def destroy\n @ganho = Ganho.find(params[:id])\n @ganho.destroy\n\n respond_to do |format|\n format.html { redirect_to(ganhos_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.7551266", "0.6966094", "0.67274165", "0.67274165", "0.6716747", "0.67054224", "0.6698005", "0.66936904", "0.6638706", "0.66364527", "0.6633589", "0.6632886", "0.6626076", "0.6624628", "0.66208225", "0.6617505", "0.6611876", "0.6609789", "0.65932065", "0.6571866", "0.6565211", "0.65533006", "0.6542157", "0.65414596", "0.6538365", "0.65379804", "0.6535177", "0.652449", "0.6521759", "0.6515718", "0.65146846", "0.65115", "0.65101844", "0.6502506", "0.64988434", "0.6495562", "0.6489215", "0.6488003", "0.6483681", "0.64817995", "0.64798945", "0.6479574", "0.64767504", "0.64757925", "0.6475749", "0.647434", "0.6473308", "0.64731735", "0.64729226", "0.64698493", "0.6467033", "0.64633423", "0.64561486", "0.6446663", "0.6446048", "0.6444111", "0.6443202", "0.644253", "0.644143", "0.64399624", "0.6438757", "0.6438555", "0.6437343", "0.6435756", "0.6431358", "0.643134", "0.6428493", "0.6427179", "0.64270115", "0.64267194", "0.6423429", "0.6420806", "0.6420121", "0.6419467", "0.64162153", "0.6416028", "0.64146495", "0.64140683", "0.64137846", "0.6412915", "0.64127547", "0.6412545", "0.64117897", "0.6411029", "0.64096844", "0.64066017", "0.64065886", "0.6405669", "0.6405402", "0.6404742", "0.640304", "0.6399779", "0.63993204", "0.6397679", "0.6396907", "0.63966703", "0.6395333", "0.6394768", "0.63946694", "0.63928" ]
0.78139114
0
Evaluates a block in the context of a DSL instance
def evaluate!(scope, &block) new(scope).evaluate(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval\n @block.eval\n end", "def evaluate(&block)\n instance_eval(&block)\n end", "def evaluate\n context = Context.new(self, node)\n context.instance_exec(&block)\n node\n end", "def dsl_eval(block)\n @dsl ||= DSL.new(self)\n @dsl.instance_eval(&block)\n self\n end", "def evaluate(&block)\n if block.arity > 0\n yield self\n else\n instance_exec(&block)\n end\n end", "def evaluate(block, *args)\n return if block.nil?\n if block.is_a? Symbol\n instance_exec(self, *args, &block)\n else\n instance_exec(*args, &block)\n end\n end", "def evaluate(&block)\n if block.arity.zero?\n instance_eval(&block)\n else\n yield(self)\n end\n end", "def evaluate(&block)\n self.original_self = eval \"self\", block.binding\n instance_eval &block\n end", "def execute(&block)\n DSLHelper.new(Class => [:&, :|, :not]) do\n Kernel.load(File.join(File.dirname(__FILE__), 'dsl_ruby_extensions.rb'))\n self.instance_eval(&block)\n end\n end", "def dsl_eval_with_block_return(dsl, *args, **_arg2, &block); end", "def dsl_eval_with_block_return(dsl, *args, **_arg2, &block); end", "def eval\n yield self\n end", "def evaluate(*args, &block)\n self.class.evaluate(self, *args, &block)\n self\n end", "def call(&block)\n instance_eval(&block)\n end", "def call(&block)\n instance_eval(&block)\n end", "def call(&block)\n instance_eval(&block)\n end", "def dsl_eval(dsl, *args, **_arg2, &block); end", "def evaluate(scope, locals, &block); end", "def in_the(instance, &block)\n instance.instance_eval(&block)\n end", "def context_for_eval; end", "def evaluate(&block)\n begin\n module_eval(&block)\n rescue NameError => e\n if e.name && evaluator.respond_to?(e.name)\n raise NonBlockBuilderReference.new(\n \"You must use a builder block in order to reference other Fixjour creation methods.\"\n )\n else\n raise e\n end\n end\n end", "def execute_block(block)\n case\n when block.is_a?(Symbol)\n send(block)\n when block.respond_to?(:call) && (block.arity == 1 || block.arity == -1)\n block.call(self)\n else\n block\n end \n end", "def evaluate_block_with_bindings(closure_scope, args_hash, plan)\n plan_result = closure_scope.with_local_scope(args_hash) do |scope|\n plan.steps.each do |step|\n step_result = dispatch_step(scope, step)\n\n scope.setvar(step.name, step_result) if step.name\n end\n\n evaluate_code_blocks(scope, plan.return)\n end\n\n throw :return, Puppet::Pops::Evaluator::Return.new(plan_result, nil, nil)\n end", "def context(&block); end", "def context(&block); end", "def kungfuigure &block\n instance_eval(&block)\n end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def run_stored_block\n self.run_in_context @stored_block if @stored_block\n end", "def test_instance_eval_behavior\n hash_ = Hash.new\n context_self_ = self\n @my_instance_variable_test = :hello\n block_ = proc do\n set_value1('a', 1)\n set_value2('b'){ 2 }\n set_value3('c', 3)\n context_self_.assert_raise(NoMethodError){ set_value3_dslversion('d', 4) }\n context_self_.assert_raise(NoMethodError){ helper_method() }\n context_self_.assert(!instance_variable_defined?(:@my_instance_variable_test))\n context_self_.assert_instance_of(Target1, self)\n end\n Blockenspiel.invoke(block_, Target1.new(hash_), :parameterless => :instance)\n assert_equal(1, hash_['a1'])\n assert_equal(2, hash_['b2'])\n assert_equal(3, hash_['c3'])\n end", "def accept(evaluator)\n evaluator.block(self)\n end", "def yield_inside(&block)\n module_eval &block\n end", "def run_block\n if @block\n _block = @block\n @block = nil\n instance_eval &_block\n true\n end\n end", "def call\n if @block\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self)\n end\n self\n end", "def block_node; end", "def block_node; end", "def eval_context(context, node); end", "def context(nodes, &block); end", "def dsl_eval_with_block_return(dsl, *args, &block)\n exec_in_proxy_context(dsl, FallbackContextProxy, *args, &block)\n end", "def _exec block, *args\n instance_exec(*args, &block)\n end", "def call\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self) if @block\n self\n end", "def client(&block)\n eval('self', block.binding)\n end", "def block?; end", "def block_given?() end", "def __execute(&block)\n self.instance_eval(&block)\n end", "def rucas &block\n self.instance_eval(&block)\n end", "def run\n block.call\n end", "def block(sexp)\n statements(sexp)\n end", "def execute(&block)\n\tblock\nend", "def execute(&block)\n\tblock\nend", "def dsl_eval_immutable(dsl, *args, **_arg2, &block); end", "def dsl_eval_immutable(dsl, *args, **_arg2, &block); end", "def build(&block)\n instance_eval(&block)\n end", "def run\n if @block.arity >= 1\n @block.call self\n else\n @block.call\n end\n end", "def run_block\n yield\nend", "def in_context(context_type, &block)\n context_type.new.instance_eval(&block)\n end", "def test_4_mix_of_lambdas_and_blocks_can_call_each_other\n result = interpret <<EOC\nl1=->() {1}\nb1=:{%l1()}\nl2=->() {%b1}\nm2=:{%l2}\n%m2\nEOC\n assert_eq result, 1\n end", "def client(&block)\n eval('self', block.binding) if block_given?\n end", "def walk(&block)\n instance_eval(&block)\nend", "def build(&block)\n Util.instance_eval_or_call(dsl, &block)\n self\n end", "def build(&block)\n Util.instance_eval_or_call(dsl, &block)\n self\n end", "def perform(&run_interp)\n @resolved_modifier = yield modifier\n @resolved_type = yield type\n expressions.each {|e| e.perform(&run_interp)}\n end", "def test_blocks_legacy\n hash_ = ::Hash.new\n block_ = ::Proc.new do\n set_value(:a){ 1 }\n end\n ::Blockenspiel.invoke(block_) do\n add_method(:set_value, :receive_block => true) do |key_, bl_|\n hash_[key_] = bl_.call\n end\n end\n assert_equal(1, hash_[:a])\n end", "def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end", "def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end", "def update(&block)\n instance_eval(&block)\n end", "def execute(block)\n model = @wrapper.object\n block.call model\n end", "def execute(&block)\n block\n #puts block #This shows the object I think.\nend", "def execute_block(&block)\n @currently_executing_block = true\n output \"tell session id #{name}_tty\"\n self.instance_eval(&block)\n output \"end tell\"\n @currently_executing_block = false\n end", "def execute(&block)\r\n block\r\nend", "def run(&blk)\n raise(\"A block is needed to run\") unless block_given?\n @run_logic = blk\n end", "def parse(data, &block)\n parse_dsl(data, false, &block)\n end", "def content\n if @block\n instance_eval(&@block)\n end\n end", "def from_block\n options = new\n dsl = ExecutionOptionsDSL.new(options)\n yield dsl\n options\n end", "def block_example(&block)\n does block\n end", "def with_block(&block)\n end", "def call_block\n @_block.call(self) if @_block\n end", "def evaluates(&block)\n @predicate << Rule.new(self, block)\n self\n end", "def run(&block)\n end", "def capture(&block)\n instance_eval(&block)\n end", "def execute(block)\n block.call\nend", "def execute(block)\n block.call\nend" ]
[ "0.7760194", "0.7685161", "0.76149297", "0.75146145", "0.7363156", "0.7172347", "0.7151496", "0.7133446", "0.7110556", "0.69198334", "0.69198334", "0.6900511", "0.671066", "0.6696336", "0.6696336", "0.6696336", "0.6664486", "0.65856606", "0.6571115", "0.65255344", "0.6457061", "0.6378728", "0.636507", "0.6350555", "0.6350555", "0.63498694", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6283841", "0.6276392", "0.6271737", "0.6256473", "0.6246671", "0.6245682", "0.6226448", "0.6223661", "0.6223661", "0.6205861", "0.618038", "0.61656946", "0.61446077", "0.6133114", "0.61268073", "0.6112461", "0.60941285", "0.6086012", "0.60778975", "0.60666156", "0.6055749", "0.6050367", "0.6050367", "0.60436475", "0.60436475", "0.60317415", "0.60152453", "0.60128", "0.60118026", "0.6004267", "0.59885466", "0.59767586", "0.5971791", "0.5971791", "0.59707403", "0.59643334", "0.5952555", "0.5952555", "0.5938944", "0.5936856", "0.593618", "0.5922166", "0.591857", "0.5917923", "0.59160465", "0.590477", "0.59014225", "0.5901404", "0.5897165", "0.5893926", "0.58870935", "0.58865285", "0.58810496", "0.58794904", "0.58794904" ]
0.6677027
16
Evaluates a block specifically for a join. In this case, we'll return an array of Arel join nodes and a list of bind parameters.
def evaluate_joins(scope, &block) dependency = evaluate!(scope, &block)._arel join_arel = Nodes.unwrap(dependency._arel) [join_arel, dependency.bind_values] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def joins(&block)\n scope.joins(*build_join_path(&block))\n end", "def visit_Arel_Nodes_JoinSource o, collector\n if o.right.any?\n # We need to visit the right to get remove bind values, but we don't\n # add it to the collector\n collector.join_source << inject_join(o.right, collector, ' ')\n end\n collector\n end", "def append_join(join)\n @clause[:join] << join.string \n @clause[:join] << join.implicit_joins\n end", "def collect_join_chain\n [self]\n end", "def assign_joins join_dependency, ancestries = nil\n ancestries ||= join_dependency.join_associations.map{|ja| ja.ancestry }\n unless @conditions.empty?\n my_association = unless @path.blank?\n join_dependency.join_associations[ancestries.index(@path)]\n else\n join_dependency.join_base\n end\n @conditions.each do |column|\n column.assign_join(my_association)\n end\n end\n @condition_blocks.each do |association|\n association.assign_joins(join_dependency, ancestries)\n end\n end", "def joins\n @joins\n end", "def using(key, &block)\n if @type == :natural then cmd = 'JOIN '\n elsif @type == :left then cmd = 'LEFT JOIN '\n elsif @type == :right then cmd = 'RIGHT JOIN '\n end\n key = key.to_s\n using_string = \"#{@base_klass.table_name}.#{key} = \"\n using_string << \"#{@join_klass.table_name}.#{key}\"\n @string = \"\\n\" << cmd << @join_klass.table_name << ' ON (' << using_string << ') '\n @clause_parser.append_join(self)\n yield @clause_parser # use extended clause parser for inner block argument\n end", "def add_join(join)\n @clause[:final_join] = join.implicit_joins\n end", "def joins\n []\n end", "def joins\n []\n end", "def get_joins\n join_sources = @model.arel_table.\n join(@associated.source).\n on(@associated.filters).\n join_sources\n return @model.joins(@members + join_sources)\n end", "def join(*) end", "def join(join_clause)\n @joins.push join_clause\n self\n end", "def joins\n @joins ||= [@options[:joins]].flatten.compact\n end", "def joins_on\n # join(relations).on(conditions)\n condition = deals.join(clients)\n .on(deals[:advertiser_id].eq(clients[:id]))\n workflow_criterions.each do |wc|\n case wc.field\n when 'currencies'\n condition = condition\n .join(currencies)\n .on(deals[:curr_cd].eq(currencies[:curr_cd]))\n when 'deal_type'\n condition = condition\n .join(values)\n .on(deals[:id].eq(values[:subject_id]))\n .join(options)\n .on(values[:option_id].eq(options[:id]))\n when 'deal_initiative'\n condition = condition\n .join(initiatives)\n .on(deals[:initiative_id].eq(initiatives[:id]))\n when 'teams'\n condition = condition\n .join(deal_members)\n .on(deal_members[:deal_id].eq(deals[:id]))\n .join(users)\n .on(users[:id].eq(deal_members[:user_id]))\n .join(teams)\n .on(teams[:id].eq(users[:team_id]).or(teams[:leader_id].eq(users[:id])))\n when 'client_segments'\n condition = condition\n .join(client_segments)\n .on(clients[:client_segment_id].eq(client_segments[:id]))\n when 'client_regions'\n condition = condition\n .join(client_regions)\n .on(clients[:client_region_id].eq(client_regions[:id]))\n when 'client_categories'\n condition = condition\n .join(client_categories)\n .on(clients[:client_category_id].eq(client_categories[:id]))\n when 'client_subcategories'\n condition = condition\n .join(client_subcategories)\n .on(clients[:client_subcategory_id].eq(client_subcategories[:id]))\n when 'share'\n condition = condition\n .join(deal_members)\n .on(deal_members[:deal_id].eq(deals[:id]))\n end\n case wc.base_object\n when 'Account Custom Fields'\n unless condition.to_sql.include?(\"INNER JOIN \\\"account_cfs\\\"\")\n condition = condition\n .join(account_cfs)\n .on(clients[:id].eq(account_cfs[:client_id]))\n end\n when 'Deal Custom Fields'\n unless condition.to_sql.include?(\"INNER JOIN \\\"deal_custom_fields\\\"\")\n condition = condition\n .join(deal_custom_fields)\n .on(deals[:id].eq(deal_custom_fields[:deal_id]))\n end\n when 'Deal Members'\n condition = condition\n .join(deal_members)\n .on(deal_members[:deal_id].eq(deals[:id]))\n .join(values)\n .on(values[:subject_id].eq(deal_members[:id]))\n .join(fields)\n .on(values[:field_id].eq(fields[:id]))\n .join(member_roles)\n .on(fields[:id].eq(member_roles[:field_id])) if wc.field.eql?('role')\n end\n end\n condition\n end", "def joins\n\t\tprivate_methods(false).grep(/_joins$/).sort.map { |m| send(m) }.compact\n\tend", "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 join_rows(rows)\n return @join_rows if defined? @join_rows\n\n conn = @model.connection\n join_table = conn.quote_table_name @ref.join_table\n assoc_fkey = conn.quote_column_name @ref.association_foreign_key\n fkey = conn.quote_column_name @ref.foreign_key\n quoted_ids = rows.map { |r| conn.quote r.send @ref.active_record_primary_key }\n\n @join_rows = conn.\n exec_query(\"SELECT #{fkey}, #{assoc_fkey} FROM #{join_table} WHERE #{fkey} IN (#{quoted_ids.join ','})\").\n rows\n end", "def read_join_relations(obj, res_row, row, join_relations)\n offset = obj.class.serializable_attributes.size\n\n for rel in join_relations\n rel_obj = rel[:target_class].og_allocate(res_row, row)\n rel_obj.og_read(res_row, row, offset)\n offset += rel_obj.class.serializable_attributes.size\n obj.instance_variable_set(\"@#{rel[:name]}\", rel_obj)\n end\n end", "def join(&block)\n self.class.join(@processes.values, &block)\n end", "def join(*args)\n\t\tif args.count > 1\n\t\t\tjoins = args.map { |arg| \"INNER JOIN #{arg} ON #{arg}.#{table}_id = #{table}.id\"}.join(\" \")\n\t\t\trows = connection.execute <<-SQL \n\t\t\t\tSELECT * FROM #{table} #{joins};\n\t\t\tSQL\n\t\telse\n\t\t\tcase args.first\n\t\t\twhen String\n\t\t\t\trows = connection.execute <<-SQL\n\t\t\t\t\tSELECT * FROM #{table} #{BlocRecord::Utility.sql_strings(args.first)};\n\t\t\t\tSQL\n\t\t\twhen Symbol\n\t\t\t\trows = connection.execute <<-SQL \n\t\t\t\t\tSELECT * FROM #{table}\n\t\t\t\t\tINNER JOIN #{args.first} ON #{arg.first}.#{table}_id = #{table}.id;\n\t\t\t\tSQL\n\t\t\twhen Hash \n\t\t\t\t#extract the options from the hash\n\t\t\t\tsecond_table = args[0].keys.first \n\t\t\t\tthird_table = args[0].keys.first\n\t\t\t\trows = connection.execute <<-SQL \n\t\t\t\t\tSELECT * FROM #{table}\n\t\t\t\t\tINNER JOIN #{second_table} ON #{second_table}.#{table}_id = #{table}.id\n\t\t\t\t\tINNER JOIN #{third_table} ON #{third_table}.#{second_table}_id = #{second_table}.id;\n\t\t\t\tSQL\n\n\t\t\tend \n\t\tend\n\t\trows_to_array(rows)\n\tend", "def build_join_expression(exps, other, type)\n return ['true', []] if type == :cross\n\n a_heads = headers\n b_heads = other.headers\n common_heads = a_heads & b_heads\n b_common_heads = []\n if exps.empty?\n if common_heads.empty?\n msg = \"#{type}-join with no common column names needs join expression\"\n raise UserError, msg\n else\n # A Natural join on all common heads\n common_heads.each do |h|\n ensure_common_types!(self_h: h, other_h: h, other: other)\n end\n nat_exp = common_heads.map { |h| \"(#{h}_a == #{h}_b)\" }.join(' && ')\n [nat_exp, common_heads]\n end\n else\n # We have join expressions to evaluate\n and_conds = []\n partial_result = nil\n last_sym = nil\n exps.each do |exp|\n case exp\n when Symbol\n case exp.to_s.clean\n when /\\A(?<sy>.*)_a\\z/\n a_head = Regexp.last_match[:sy].to_sym\n unless a_heads.include?(a_head)\n raise UserError, \"no column '#{a_head}' in table\"\n end\n\n if partial_result\n # Second of a pair\n ensure_common_types!(self_h: a_head,\n other_h: last_sym,\n other: other)\n partial_result << \"#{a_head}_a)\"\n and_conds << partial_result\n partial_result = nil\n else\n # First of a pair of _a or _b\n partial_result = +\"(#{a_head}_a == \"\n end\n last_sym = a_head\n when /\\A(?<sy>.*)_b\\z/\n b_head = Regexp.last_match[:sy].to_sym\n unless b_heads.include?(b_head)\n raise UserError, \"no column '#{b_head}' in second table\"\n end\n\n if partial_result\n # Second of a pair\n ensure_common_types!(self_h: last_sym,\n other_h: b_head,\n other: other)\n partial_result << \"#{b_head}_b)\"\n and_conds << partial_result\n partial_result = nil\n else\n # First of a pair of _a or _b\n partial_result = +\"(#{b_head}_b == \"\n end\n b_common_heads << b_head\n last_sym = b_head\n else\n # No modifier, so must be one of the common columns\n unless partial_result.nil?\n # We were expecting the second of a modified pair, but got an\n # unmodified symbol instead.\n msg =\n \"follow '#{last_sym}' by qualified exp from the other table\"\n raise UserError, msg\n end\n # We have an unqualified symbol that must appear in both tables\n unless common_heads.include?(exp)\n msg = \"unqualified column '#{exp}' must occur in both tables\"\n raise UserError, msg\n end\n ensure_common_types!(self_h: exp, other_h: exp, other: other)\n and_conds << \"(#{exp}_a == #{exp}_b)\"\n b_common_heads << exp\n end\n when String\n # We have a string expression in which all column references must be\n # qualified.\n and_conds << \"(#{exp})\"\n else\n msg = \"invalid join expression '#{exp}' of class #{exp.class}\"\n raise UserError, msg\n end\n end\n [and_conds.join(' && '), b_common_heads]\n end\n end", "def relation_method\n :join\n end", "def joins\n joins_hash = {}\n @rules.each do |rule|\n associations_hash = rule.custom_where_conditions ? rule.conditions : rule.associations_hash\n merge_joins(joins_hash, associations_hash)\n end\n if joins_hash.empty?\n [joins_hash, []]\n else\n clean_joins(joins_hash)\n end\n end", "def calc_join_conditions(from, to, done = [from.to_s])\n result = []\n from = from.to_s\n case to\n when Hash\n to.each do |key, val|\n result += calc_join_condition(from, key.to_s, done)\n result += calc_join_conditions(key.to_s, val, done)\n end\n when Array\n result += to.map { |x| calc_join_conditions(from, x, done) }.flatten\n else\n result += calc_join_condition(from, to.to_s, done)\n end\n result\n end", "def create_joiners(j, c, p)\n js = j.split(';').collect { |j| j.split('=').collect { |j| j.to_i } }\n cs = c.split(';').collect { |c| c.split(',').collect { |c| c.to_i } }\n ps = col_positions(p, cs)\n\n @joiners = []\n (0...js.size).each do |i| \n @joiners << Joiner.new(js[i], ps[i], cs[i], { rows: { } }) \n end \n\n ps.flatten\n end", "def join_table(type, table, expr=nil, options=OPTS, &block)\n if expr.is_a?(SQL::AliasedExpression) && expr.expression.is_a?(Array) && !expr.expression.empty? && expr.expression.all?\n options = options.merge(:join_using=>true)\n end\n super\n end", "def test_parse_join\n msg = Message.parse(@join_message)\n assert_equal @join_message, msg.raw_message\n assert_equal CMD_JOIN, msg.message_type\n assert_equal ['#chan'], msg.params\n end", "def fk_join_arr\n result = []\n groups.each_with_index do |group, idx|\n group_alias = \"#{group.parent_table}_#{idx}\"\n group_query = group_query_builder(group)\n result.push \"JOIN (\\n#{group_query}\\n\\t) AS #{group_alias}_fk\"\n result.push \"ON #{group_alias}_fk.#{FKEYS[group.parent_table]}=#{group.parent_table}.#{group.parent_table_pk}\"\n if idx > 0\n groups.each_with_index do |x_group, x_idx|\n #next if x_idx < idx\n x_group_alias = \"#{x_group.parent_table}_#{x_idx}\"\n result.push \"\\tAND #{x_group_alias}_fk.year = #{group_alias}_fk.year\"\n break\n end\n end\n end\n return result\n end", "def join\n end", "def joins\n j = []\n associations.each do |association|\n next if association.conditions.blank?\n association_joins = association.joins\n j << (association_joins.blank? ? association.relationship_name.to_sym : {association.relationship_name.to_sym => association_joins})\n end\n j.blank? ? nil : (j.size == 1 ? j.first : j)\n end", "def test_join1\n\t\tr = prep(\"program foo;\\nfoo(A,B) :- bar(A,B);\\n\")\n\t\t\n\t\t# set up schema table's predicate\n\t\t## require 'ruby-debug'; debugger\n\t\tterm_schema = @terms.schema_of\n\t\tterm_pred = Predicate.new(false,@terms.name,@terms,term_schema.variables)\n\t\tterm_pred.set(r, \"global\", \"r3\", 1)\n\t\t\n\t\tsj = ScanJoin.new(r, term_pred, @preds.schema_of)\t\n\t\tts = TupleSet.new(\"pred\", *@preds.tuples)\n\t\tres = sj.evaluate(ts)\n\n\t\tassert_equal(2, res.tups.length)\n\tend", "def join; end", "def join_for(user)\n joins.find_by_user_id(user)\n end", "def fetch_join_rows(rows)\n conn = @model.connection\n join_table = conn.quote_table_name @ref.join_table\n assoc_fkey = conn.quote_column_name @ref.association_foreign_key\n fkey = conn.quote_column_name @ref.foreign_key\n quoted_ids = rows.map { |row|\n begin\n id = row.send @ref.active_record_primary_key\n rescue NoMethodError => e\n raise MissingColumnError.new(row, e.name)\n end\n conn.quote id\n }\n\n quoted_ids.any? ? conn.\n exec_query(\"SELECT #{fkey}, #{assoc_fkey} FROM #{join_table} WHERE #{fkey} IN (#{quoted_ids.join ','})\").\n rows : []\n end", "def handle_joins fields, select = nil\n ret = select || scoped\n fields.each do |qualified_field|\n assoc, foreign_table, field = parse_field(qualified_field)\n ret = ret.joins(join_string(assoc, foreign_table)) if assoc\n end\n ret\n end", "def pull_join\n raise NotImplementedError\n end", "def join()\n raise \"Missing implementation 'join'\"\n end", "def join_dependency\n @join_dependency ||= (\n build_join_dependency(\n Arel::SelectManager.new(table.engine, table),\n joins_values\n ) && @join_dependency\n )\n end", "def add_joins(*joins)\n joins.each do |join|\n case join.class.to_s\n when \"String\"\n add_join_clause(join)\n when \"Symbol\",\"Hash\"\n add_include(join)\n else\n raise ArgumentError.new(\"#{join.class} is not a String or Symbol\")\n end\n end\n end", "def query(rows)\n join_rows = fetch_join_rows(rows)\n assoc_ids = join_rows.map { |row| row[1] }.compact.uniq\n yield assoc_ids.any? ? base_scope.where(@ref.association_primary_key => assoc_ids) : nil, join_rows\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 merge_using(source, join_condition)\n clone(:merge_using => [source, join_condition].freeze)\n end", "def visit_Arel_Nodes_Or(object)\n visited = [object.left, object.right].map(&method(:visit))\n if visited.all? { |v| INNER_JOIN == v }\n INNER_JOIN\n elsif visited.any?\n OUTER_JOIN\n end\n end", "def join_context(context_data, options = {})\n join_column = options[:join_column] || :branch_id\n\n versioned_table = opts[:last_joined_table] || opts[:from].first\n\n ds = join(context_data, { :branch_id => join_column }, options) do |j, lj|\n Sequel.expr(Sequel.qualify(j, :version) => nil) |\n (Sequel.qualify(lj, :version) <= Sequel.qualify(j, :version))\n end\n ds.opts[:versioned_table] = versioned_table\n #ds.opts[:last_record_id] = Sequel.qualify(versioned_table, :record_id)\n ds.opts[:order_columns] = (ds.opts[:order_columns] || []) +\n [Sequel.qualify(ds.opts[:last_joined_table], :depth),\n Sequel.qualify(versioned_table, :version).desc]\n ds\n end", "def to_clause( join_string, compact_nils = DONT_COMPACT_NILS )\n # The clause items and the values have to be in the same order.\n keys_ = keys\n if block_given?\n mapping = keys_.map { |field| yield field }\n else\n mapping = keys_.map { |field| \"#{field} = ?\" }\n end\n clause = mapping.join( join_string )\n values_ = keys_.map { |key|\n self[ key ]\n }\n if compact_nils\n values_.compact!\n end\n [ clause, values_ ]\n end", "def join\n @acceptor.join if @acceptor\n end", "def join(other, *exps, join_type: :inner)\n unless other.is_a?(Table)\n raise UserError, 'need other table as first argument to join'\n end\n unless JOIN_TYPES.include?(join_type)\n raise UserError, \"join_type may only be: #{JOIN_TYPES.join(', ')}\"\n end\n\n # These may be needed for outer joins.\n self_row_nils = headers.map { |h| [h, nil] }.to_h\n other_row_nils = other.headers.map { |h| [h, nil] }.to_h\n join_exp, other_common_heads =\n build_join_expression(exps, other, join_type)\n ev = Evaluator.new\n result = empty_dup\n other_rows = other.rows\n other_row_matches = Array.new(other_rows.size, false)\n rows.each do |self_row|\n self_row_matched = false\n other_rows.each_with_index do |other_row, k|\n # Same as other_row, but with keys that are common with self and equal\n # in value, removed, so the output table need not repeat them.\n locals = build_locals_hash(row_a: self_row, row_b: other_row)\n matches = ev.evaluate(join_exp, locals: locals)\n next unless matches\n\n self_row_matched = other_row_matches[k] = true\n out_row = build_out_row(row_a: self_row, row_b: other_row,\n common_heads: other_common_heads,\n type: join_type)\n result << out_row\n end\n next unless [:left, :full].include?(join_type)\n next if self_row_matched\n\n result << build_out_row(row_a: self_row,\n row_b: other_row_nils,\n type: join_type)\n end\n if [:right, :full].include?(join_type)\n other_rows.each_with_index do |other_row, k|\n next if other_row_matches[k]\n\n result << build_out_row(row_a: self_row_nils,\n row_b: other_row,\n type: join_type)\n end\n end\n result.normalize_boundaries\n result\n end", "def joins(args={})\n # If showing pending, do not joins question responses\n return args[:show_pending] ? nil : :question_responses\n end", "def joinall\n @connections.each do |k,v|\n\tv[:thread].join\n end\n end", "def print_join\r\n if get_tables.size < 2\r\n puts \"you do not have enough tables to join\"\r\n return nil\r\n end\r\n to_join = []\r\n puts \"choose 2 of these tables to join\"\r\n print_table_names\r\n until to_join.length == 2\r\n puts \"what is your first table you would like to join?\" if to_join.length == 0\r\n puts \"what is your second table you would like to join?\" if to_join.length == 1\r\n answer = gets.chomp\r\n to_join << answer if table_exists?(answer)\r\n end\r\n if references(to_join[1]).include?(to_join[0])\r\n execute = @db.execute(\"SELECT * FROM #{to_join[0]} JOIN #{to_join[1]}\r\n ON #{to_join[0]}.#{to_join[1]}_id = #{to_join[1]}.id ;\")\r\n print_execute_titles(execute)\r\n print_execute(execute)\r\n elsif references(to_join[0]).include?(to_join[1])\r\n execute = @db.execute(\"SELECT * FROM #{to_join[1]} JOIN #{to_join[0]}\r\n ON #{to_join[1]}.#{to_join[0]}_id = #{to_join[0]}.id ;\")\r\n print_execute_titles(execute)\r\n print_execute(execute)\r\n else\r\n puts \"Those two tables are incompatible and cannot be joined\"\r\n end\r\n end", "def join(table, field1, field2, join_type = 'INNER JOIN')\n @join = \" #{join_type} #{table} ON #{@from}.#{field1}=#{table}.#{field2}\"\n\n self\n end", "def ntest_left_outer_join\n program = CombosBud.new('localhost', 12345)\n assert_nothing_raised( RuntimeError) { program.tick }\n loj_outs = program.loj_out.map{|t| t}\n assert_equal(3, loj_outs.length)\n assert_equal(loj_outs.inspect, '[[\"z\", nil, 1, nil], [\"v\", nil, 1, nil], [\"a\", \"a\", 1, 1]]')\n end", "def join(args, joiner=nil)\n raise Error, 'argument to Sequel.join must be an array' unless args.is_a?(Array)\n if joiner\n args = args.zip([joiner]*args.length).flatten\n args.pop\n end\n\n return SQL::StringExpression.new(:NOOP, '') if args.empty?\n\n args = args.map do |a|\n case a\n when Symbol, ::Sequel::SQL::Expression, ::Sequel::LiteralString, TrueClass, FalseClass, NilClass\n a\n else\n a.to_s\n end\n end\n SQL::StringExpression.new(:'||', *args)\n end", "def test_join\n assert_equal('1 2 Assign 4 Buzz Assign 7 8 Assign Buzz 11 Assign 13 14 AssignBuzz', @ab.join)\n end", "def prepend_join(join)\n @clause[:join] = join.string << @clause[:join]\n @clause[:join] << join.implicit_joins\n end", "def _join_table_dataset(opts)\n ds = model.db.from(opts.join_table_source)\n opts[:join_table_block] ? opts[:join_table_block].call(ds) : ds\n end", "def apply_join(query, join)\n validate_query(query)\n query.joins(join)\n end", "def relation(*args)\n source_node.join(target_node, *args)\n end", "def needs_join_table(table_name1, type, table_name2, clause, join_name = nil)\n join_name ||= \"#{table_name1}=#{type}=#{table_name2}\"\n @needed_join_tables[join_name] ||= {}\n @needed_join_tables[join_name][table] ||= begin\n # define join for this part ('table' = unique for each part)\n\n # don't add to list of tables, just get unique alias name\n second_table = get_alias(table_name2)\n\n # create join\n first_table = table(table_name1)\n\n @join_tables[first_table] ||= []\n @join_tables[first_table] << \"#{type} JOIN #{second_table} ON #{clause.gsub('TABLE1',first_table).gsub('TABLE2',second_table)}\"\n second_table\n end\n end", "def _association_join(type, associations)\n clone(:join=>clone(:graph_from_self=>false).eager_graph_with_options(associations, :join_type=>type, :join_only=>true).opts[:join])\n end", "def association name, &blk\n name = name.to_s.intern\n ref = @model.reflect_on_association(name)\n @condition_blocks << ConditionGroup.new(ref.klass, logical_join, binding, @from, path, ref.name, &blk)\n @condition_blocks.last\n end", "def join\n @executions.each do |execution|\n execution.join\n end\n end", "def join_table_source\n cached_fetch(:join_table_source){split_join_table_alias[0]}\n end", "def joins_with_conditions\n @memoized_joins ||= merge_joins(joins_without_conditions, conditions.joins)\n end", "def join\n @listeners.values.each {|s| s.acceptor.join }\n end", "def render_output_of_join(join_data, df_data)\n # join_data is of the format:\n # {\n # \"delimiter\" => \",\",\n # \"pieces\" => [\"{{field_name1}}\", \"{{field_name2.value}}\", \"{{field_name3}}\", ...]\n # }\n # OR\n # {\n # \"delimiter\" => \",\",\n # \"pieces\" => [\n # {\n # \"ternary\": [\n # \"location_shelf_location_box_number\",\n # \"Box no. {{location_shelf_location_box_number}}\",\n # \"\"\n # ]\n # },\n # {\n # \"ternary\": [\n # \"location_shelf_location_folder_number\",\n # \"Folder no. {{location_shelf_location_folder_number}}\",\n # \"\"\n # ]\n # },\n # ...\n # ]\n # }\n pieces = join_data['pieces'].map do |piece|\n if piece.is_a?(String)\n value_with_substitutions(piece, df_data)\n elsif piece.is_a?(Hash) && piece['ternary'].present?\n value_with_substitutions(render_output_of_ternary(piece['ternary'], df_data), df_data)\n end\n end\n pieces.delete_if(&:blank?).join(join_data['delimiter'])\n end", "def search_joins\n @search_joins || @includes\n end", "def inject_join list, collector, join_str\n list.each_with_index.inject([]) { |c, (x,_)|\n c + [visit(x, collector)]\n }\n end", "def includes(&block)\n scope.includes(*build_join_path(&block))\n end", "def pk_join_arr\n result = []\n joined_tables = [groups.first.parent_table]\n groups.each_with_index do |group, idx|\n next if idx == 0\n next if joined_tables.include? group.parent_table\n joined_tables.push group.parent_table\n group_alias = \"#{group.parent_table}_#{idx}\"\n result.push \"\\nJOIN #{group.parent_table}\\n\\tON #{group.parent_table}.#{PKEYS[group.parent_table]} = #{group.parent_group.parent_table}.#{group.parent_group.parent_table_pk}\\n\"\n end\n return result\n end", "def flatten_joins(arg = join, keep_qualifiers = true)\n result = []\n case arg\n when Hash\n arg.each do |key, val|\n key = key.to_s.sub(/\\..*/, \"\") unless keep_qualifiers\n result << key.to_s\n result += flatten_joins(val)\n end\n # elsif arg.is_a?(Array)\n when Array\n result += arg.map { |x| flatten_joins(x) }.flatten\n else\n arg = arg.to_s.sub(/\\..*/, \"\") unless keep_qualifiers\n result << arg.to_s\n end\n result\n end", "def join(event)\n @join.each do |field, separator|\n value = event.get(field)\n if value.is_a?(Array)\n event.set(field, value.join(separator))\n end\n end\n end", "def join_rule\n client.api.get_room_join_rules(id)[:join_rule].to_sym\n end", "def method_missing ( method, *args )\n # Handle all [*_]join calls:\n return _addJoin( method, *args ) if method =~ /^[a-z_]*join$/\n super\n end", "def join(force = false)\n post 'join'\n end", "def source_join_details(type=nil)\n if source_relationship\n related_resource_klass = type ? resource_klass.resource_klass_for(type) : source_relationship.resource_klass\n segment = PathSegment::Relationship.new(relationship: source_relationship, resource_klass: related_resource_klass)\n details = @join_details[segment]\n else\n if type\n details = @join_details[\"##{type}\"]\n else\n details = @join_details['']\n end\n end\n details\n end", "def read_statements(graph_element, &block)\n graph_name = read_graph(graph_element)\n graph_name = base_uri.join(graph_name) if\n base_uri && graph_name && graph_name.relative?\n triple_elements(graph_element).each do |triple_element|\n block.call(read_triple(triple_element, graph_name: graph_name))\n end\n end", "def join(host, port, only_join=false)\n puts \"Join request is received from (#{host}, #{port})\"\n tmp_remote_nodes = @calendar_network.remote_nodes.dup\n \n # add given node to the list\n @calendar_network.remote_nodes |= [Node.new(host, port)]\n\n # change the calendar_network to online mode if it is not\n @calendar_network.offline_mode = false\n\n if only_join\n # this means requester does not need list of (host, port)\n # it just asks remote node to add given (host, port) pair to their list\n puts \"Joining is done. \" + @calendar_network.remote_nodes.inspect\n return true\n else\n puts \"Informing other remote nodes...\"\n # inform other online nodes\n tmp_remote_nodes.each do |remote_node|\n\tputs \"Informing #{remote_node.to_s}\"\n remote_server = xml_rpc_client(remote_node.address, @calendar_network.config[\"path\"], remote_node.port)\n remote_server.call(\"calendar_network.join\", host, port, true)\n end\n\n puts \"Joining is done. \" + @calendar_network.remote_nodes.inspect\n return tmp_remote_nodes.collect{|node| [node.address, node.port]}\n end\n rescue Exception => e\n puts e.message\n return false\n end", "def join( c, how = 'AND' )\n\t\t@conditions = self.class.join( conditions, c, how )\n\t\tself\n\tend", "def capture_map_join_nowrap(list, *args, &block)\n options = args.extract_options!\n capture_map_join(list, *args, options.merge(:nowrap => true), &block)\n end", "def join_request\n \n end", "def join_to(base_join)\n parent.join_to(base_join) if parent && parent.join.nil?\n \n @join ||= ::ActiveRecord::Associations::ClassMethods::JoinDependency::JoinAssociation.new(\n @reflection, base_join, parent ? parent.join : base_join.joins.first\n )\n end", "def initialize model, logical_join, binding, from_record = nil, path = nil, reflection = nil, &blk\n @model = model\n @from = from_record\n @logical_join = logical_join\n @conditions = []\n @condition_blocks = []\n @reflection = reflection\n @path = [ path, reflection ].compact.flatten\n @binding = binding\n @order = []\n @negative = false\n @paginator = false\n @block = blk\n \n existing_methods = self.class.instance_methods(false)\n (model.column_names - existing_methods).each do |col|\n (class << self; self; end).class_eval do\n define_method(col.to_s.intern) do\n column(col)\n end\n end\n end\n (model.reflections.keys - existing_methods).each do |assn|\n (class << self; self; end).class_eval do\n define_method(assn.to_s.intern) do\n association(assn)\n end\n end\n end\n \n execute_block\n end", "def capture_map_join(list, *args, &block)\n if respond_to?(:is_haml?) && is_haml?\n # don't let haml insert unwanted whitespaces\n map_join(list, *args) {|item| raw capture(item, &block).chomp }\n else\n map_join(list, *args) {|item| capture item, &block }\n end\n end", "def index_joins\n @rails.choice[:joins]\n end", "def joins\n full_joins = columns.map(&:joins).flatten.uniq\n @joins ||= remove_through_model(full_joins - includes)\n end", "def table_aliases_from_join_fragment(sql)\r\n return [] if sql.blank?\r\n return sql.scan(/JOIN\\s+(`[^`]+`|\"[^\"]+\"|\\[[^\\]]+\\]|\\S+)(?:\\s+(?:AS\\s+)?(`[^`]+`|\"[^\"]+\"|\\[[^\\]]+\\]|\\S+))?/i).collect do |name|\r\n ((name[1] =~ /^ON$/i) ? name[0] : (name[1] || name[0])).gsub(/^[`\"\\[]?(.*)[`\"\\]]?$/, '\\1')\r\n end\r\n end", "def _arel\n if _on\n [_join.new(_table, _on)]\n else\n @associations.each.with_index.inject([]) do |joins, (assoc, i)|\n construct @associations[0..i], joins, assoc._join\n end\n end\n end", "def supports_modifying_joins?\n true\n end", "def join_from_sql(type, sql)\n if(from = @opts[:from][1..-1]).empty?\n raise(Error, 'Need multiple FROM tables if updating/deleting a dataset with JOINs') if @opts[:join]\n else\n sql << SPACE << type.to_s << SPACE\n source_list_append(sql, from)\n select_join_sql(sql)\n end\n end", "def build_arel(*)\n arel = super\n subqueries = build_auxiliary_statements(arel)\n subqueries.nil? ? arel : arel.with(subqueries)\n end", "def test_join\n assert_equal('1 2 Bar 4 Baz Bar 7 8 Bar Baz 11 Bar 13 14 BarBaz', @kbb.join)\n end", "def calculate_edges\n es = [{:left_table=>self[:model].table_name, :left_key=>self[:left_primary_key_column]}]\n self[:through].each do |t|\n es.last.merge!(:right_key=>t[:left], :right_table=>t[:table], :join_type=>t[:join_type]||self[:graph_join_type], :conditions=>(t[:conditions]||[]).to_a, :block=>t[:block])\n es.last[:only_conditions] = t[:only_conditions] if t.include?(:only_conditions)\n es << {:left_table=>t[:table], :left_key=>t[:right]}\n end\n es.last.merge!(:right_key=>right_primary_key, :right_table=>associated_class.table_name)\n edges = es.map do |e| \n h = {:table=>e[:right_table], :left=>e[:left_key], :right=>e[:right_key], :conditions=>e[:conditions], :join_type=>e[:join_type], :block=>e[:block]}\n h[:only_conditions] = e[:only_conditions] if e.include?(:only_conditions)\n h\n end\n reverse_edges = es.reverse.map{|e| {:table=>e[:left_table], :left=>e[:left_key], :right=>e[:right_key]}}\n reverse_edges.pop\n calculate_reverse_edge_aliases(reverse_edges)\n final_reverse_edge = reverse_edges.pop\n final_reverse_alias = final_reverse_edge[:alias]\n\n h = {:final_edge=>edges.pop,\n :final_reverse_edge=>final_reverse_edge,\n :edges=>edges,\n :reverse_edges=>reverse_edges,\n :predicate_key=>qualify(final_reverse_alias, edges.first[:right]),\n :associated_key_table=>final_reverse_edge[:alias],\n }\n h.each{|k, v| cached_set(k, v)}\n h\n end", "def sql_clauses(hash, join: :and, connector: join)\n result = hash.map { |k, v| sql_clause(k, v) }.compact_blank!\n connector &&= connector.to_s.strip.upcase\n connector ? result.join(\" #{connector} \") : result\n end", "def _eval_join(*args)\n args = args.compact\n args.delete_if &:empty?\n args.slice(1, args.size).to_a.inject(args.first) do |memo, item|\n if item.start_with?(\"[\")\n memo += item\n else\n memo += \".#{item}\"\n end\n end\n end", "def join(*relations)\n relations.all?{|r| is_relation!(r)}\n relations.inject(nil){|memo,r| memo.nil? ? r : memo.join(r)}\n end", "def join(outs) ; nil ; end", "def joinAs _obj, _args\n \"_obj joinAs _args;\" \n end", "def inner_join(sym, **props)\n join(sym, **props.merge(type: :inner))\n end" ]
[ "0.66821665", "0.6243861", "0.5804078", "0.57838035", "0.5401465", "0.5396925", "0.5388532", "0.5353458", "0.5314748", "0.5286763", "0.52793914", "0.524661", "0.51993847", "0.5176329", "0.51732635", "0.5156276", "0.5137817", "0.5104237", "0.5100834", "0.5095799", "0.50930595", "0.5092859", "0.5056809", "0.5051086", "0.50250363", "0.49923286", "0.49912742", "0.49883232", "0.4981814", "0.49752128", "0.49624988", "0.4959975", "0.4947483", "0.4932189", "0.49210292", "0.48918706", "0.48792428", "0.48443276", "0.48418477", "0.47860813", "0.47820535", "0.4776606", "0.47685584", "0.47652498", "0.4758273", "0.47500595", "0.4728379", "0.47262362", "0.4725322", "0.4702491", "0.46937683", "0.4690389", "0.4689895", "0.4687829", "0.46836808", "0.4678056", "0.46650097", "0.46445757", "0.46394235", "0.46355027", "0.46335685", "0.4623314", "0.4616914", "0.4585526", "0.45844302", "0.45782888", "0.4577243", "0.45768076", "0.4576147", "0.45758802", "0.45637202", "0.45561713", "0.4548203", "0.45428547", "0.45368677", "0.45367378", "0.45193392", "0.45123658", "0.45019335", "0.4496167", "0.44953522", "0.4485144", "0.44812176", "0.44770792", "0.4473655", "0.44691408", "0.4454313", "0.44514906", "0.44455087", "0.4441325", "0.443781", "0.44346774", "0.44116035", "0.44113484", "0.44055414", "0.43984896", "0.4398317", "0.43907595", "0.43812767", "0.4379882" ]
0.78211224
0
Evaluates a block in the context of a new DSL instance and passes all arguments to the block.
def evaluate_sifter(scope, *args, &block) evaluate scope do |root| root.instance_exec(*args, &block) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dsl_eval_with_block_return(dsl, *args, **_arg2, &block); end", "def dsl_eval_with_block_return(dsl, *args, **_arg2, &block); end", "def dsl_eval(block)\n @dsl ||= DSL.new(self)\n @dsl.instance_eval(&block)\n self\n end", "def evaluate(block, *args)\n return if block.nil?\n if block.is_a? Symbol\n instance_exec(self, *args, &block)\n else\n instance_exec(*args, &block)\n end\n end", "def evaluate\n context = Context.new(self, node)\n context.instance_exec(&block)\n node\n end", "def eval\n @block.eval\n end", "def evaluate(&block)\n instance_eval(&block)\n end", "def evaluate(&block)\n if block.arity > 0\n yield self\n else\n instance_exec(&block)\n end\n end", "def evaluate(&block)\n self.original_self = eval \"self\", block.binding\n instance_eval &block\n end", "def call(&block)\n instance_eval(&block)\n end", "def call(&block)\n instance_eval(&block)\n end", "def call(&block)\n instance_eval(&block)\n end", "def evaluate(&block)\n if block.arity.zero?\n instance_eval(&block)\n else\n yield(self)\n end\n end", "def execute(&block)\n DSLHelper.new(Class => [:&, :|, :not]) do\n Kernel.load(File.join(File.dirname(__FILE__), 'dsl_ruby_extensions.rb'))\n self.instance_eval(&block)\n end\n end", "def dsl_eval(dsl, *args, **_arg2, &block); end", "def evaluate(*args, &block)\n self.class.evaluate(self, *args, &block)\n self\n end", "def build(&block)\n instance_eval(&block)\n end", "def call\n if @block\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self)\n end\n self\n end", "def from_block\n options = new\n dsl = ExecutionOptionsDSL.new(options)\n yield dsl\n options\n end", "def evaluate!(scope, &block)\n new(scope).evaluate(&block)\n end", "def call\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self) if @block\n self\n end", "def eval\n yield self\n end", "def build(&block)\n Util.instance_eval_or_call(dsl, &block)\n self\n end", "def build(&block)\n Util.instance_eval_or_call(dsl, &block)\n self\n end", "def _exec block, *args\n instance_exec(*args, &block)\n end", "def with(&block)\n raise ArgumentError.new(\"Must pass a block\") unless block_given?\n case block.arity\n when 1\n yield self\n when 0\n instance_methods_eval(&block)\n else\n raise \"block arity must be 0 or 1\"\n end\n end", "def client(&block)\n eval('self', block.binding)\n end", "def evaluate_block_with_arguments(block, args)\n # If block.arity < 0, when a block takes a variable number of args,\n # the one's complement (-n-1) is the number of required arguments\n required_arguments = block.arity < 0 ? ~block.arity : block.arity\n if args.length >= required_arguments\n if block.arity < 0\n instance_exec(*args, &block)\n else\n instance_exec(*args.first(block.arity), &block)\n end\n else\n raise ArgumentError.new(\"wrong number of arguments (#{args.size} for #{required_arguments})\")\n end\n end", "def dsl_eval_immutable(dsl, *args, **_arg2, &block); end", "def dsl_eval_immutable(dsl, *args, **_arg2, &block); end", "def and_yield(*args)\n yield eval_context = Object.new if block_given?\n @plan = Proc.new do |&block|\n eval_context.instance_exec(*args, &block)\n end\n self\n end", "def __execute(&block)\n self.instance_eval(&block)\n end", "def run\n if @block.arity >= 1\n @block.call self\n else\n @block.call\n end\n end", "def client(&block)\n eval('self', block.binding) if block_given?\n end", "def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end", "def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end", "def context(nodes, &block); end", "def evaluate(&block)\n begin\n module_eval(&block)\n rescue NameError => e\n if e.name && evaluator.respond_to?(e.name)\n raise NonBlockBuilderReference.new(\n \"You must use a builder block in order to reference other Fixjour creation methods.\"\n )\n else\n raise e\n end\n end\n end", "def new_block_el(*args); end", "def execute_block(block)\n case\n when block.is_a?(Symbol)\n send(block)\n when block.respond_to?(:call) && (block.arity == 1 || block.arity == -1)\n block.call(self)\n else\n block\n end \n end", "def evaluate_block_with_bindings(closure_scope, args_hash, plan)\n plan_result = closure_scope.with_local_scope(args_hash) do |scope|\n plan.steps.each do |step|\n step_result = dispatch_step(scope, step)\n\n scope.setvar(step.name, step_result) if step.name\n end\n\n evaluate_code_blocks(scope, plan.return)\n end\n\n throw :return, Puppet::Pops::Evaluator::Return.new(plan_result, nil, nil)\n end", "def initialize(&block)\n instance_eval(&block) if block_given?\n end", "def call(*args)\n instance_exec(*correct_arg_arity(block.arity, args), &block)\n end", "def initialize(&block)\n instance_eval(&block) if block_given?\n end", "def instance_eval(*args, &block)\n file, line = __find_caller__(caller())\n $__gen_code__[[file, line]] = {\n :binding => self, \n :kind => :instance_eval, \n :code => args[0]\n }\n if block_given?\n $__instance_eval__.bind(self).call(&block)\n else\n $__instance_eval__.bind(self).call(*args)\n end\n end", "def dsl_eval_with_block_return(dsl, *args, &block)\n exec_in_proxy_context(dsl, FallbackContextProxy, *args, &block)\n end", "def capture(&block)\n instance_eval(&block)\n end", "def context(&block); end", "def context(&block); end", "def with *args, &block\n @current.args = args\n @current.block = block\n self\n end", "def define &block\n new block\n end", "def call(*args, &block)\n @block.call *args, &block\n end", "def evaluate(scope, locals, &block); end", "def run(*args,&ruby_block)\n # Gain access to the runner as local variable.\n runner_proc = @runner_proc\n # Execute the code generating the accesser in context.\n HDLRuby::High.space_push(@namespace)\n HDLRuby::High.cur_block.open do\n instance_exec(ruby_block,*args,&runner_proc)\n end\n HDLRuby::High.space_pop\n end", "def call(*args)\n block.call(*args)\n end", "def run_stored_block\n self.run_in_context @stored_block if @stored_block\n end", "def block=(_arg0); end", "def block=(_arg0); end", "def initialize (&block)\n instance_exec(&block)\n end", "def compile_yield(scope, args, block)\n @e.comment(\"yield begin\")\n args ||= []\n args = [args] if !args.is_a?(Array) # FIXME: It's probably better to make the parser consistently pass an array\n args = [0] + args # FIXME: No chaining of blocks. Is chaining of blocks legal? Never used it. Anyway, we don't support it\n\n compile_callm_args(scope, :self, args) do\n reg = @e.load(:arg, 1) # The block parameter\n @e.call(reg)\n end\n @e.comment(\"yield end\")\n return [:subexpr]\n end", "def yield_inside(&block)\n module_eval &block\n end", "def execute\n yield self if block_given?\n end", "def execute(block)\n model = @wrapper.object\n block.call model\n end", "def run(*args,&ruby_block)\n # Gain access to the accesser as local variable.\n runner_proc = @runner_proc\n # Execute the code generating the accesser in context.\n HDLRuby::High.space_push(@namespace)\n HDLRuby::High.cur_block.open do\n instance_exec(ruby_block,*args,&runner_proc)\n end\n HDLRuby::High.space_pop\n end", "def populate &block\n instance_eval(&block)\n self\n end", "def run\n block.call\n end", "def configure(&block)\n instance_eval(&block)\n end", "def configure(&block)\n instance_eval(&block)\n end", "def initialize(&block)\n instance_exec(&block) if block_given?\n end", "def execute(&block)\n\tblock\nend", "def execute(&block)\n\tblock\nend", "def run(*args,&ruby_block)\n # Gain access to the runner as local variable.\n runner_proc = @runner_proc\n # # The context is the one of the reader.\n # Execute the code generating the reader in context.\n HDLRuby::High.space_push(@namespace)\n HDLRuby::High.cur_block.open do\n instance_exec(ruby_block,*args,&runner_proc)\n end\n HDLRuby::High.space_pop\n end", "def run(&block)\n end", "def with_block(&block)\n end", "def create_block_object(&block)\n block\nend", "def initialize(&block)\n @rules = []\n DSL.new(self).execute(&block) unless block.nil?\n end", "def call(&block)\n execute(&block) if valid?\n execution_attempted!\n self\n end", "def accept(evaluator)\n evaluator.block(self)\n end", "def ruby(&block)\n @ruby_block = block\n end", "def call\n @block.call(*values)\n end", "def dsl_eval_immutable(dsl, *args, &block)\n exec_in_proxy_context(dsl, ChainingFallbackContextProxy, *args, &block)\n end", "def context_for_eval; end", "def build(&block)\n # provide access to 'this' in configuration block\n self.instance_exec(&block)\n end", "def kungfuigure &block\n instance_eval(&block)\n end", "def execute\n if @block\n instance_eval(&@block)\n else\n raise MRubyTestSkip, \"(Not implemented)\"\n end\n end", "def test_instance_eval_behavior\n hash_ = Hash.new\n context_self_ = self\n @my_instance_variable_test = :hello\n block_ = proc do\n set_value1('a', 1)\n set_value2('b'){ 2 }\n set_value3('c', 3)\n context_self_.assert_raise(NoMethodError){ set_value3_dslversion('d', 4) }\n context_self_.assert_raise(NoMethodError){ helper_method() }\n context_self_.assert(!instance_variable_defined?(:@my_instance_variable_test))\n context_self_.assert_instance_of(Target1, self)\n end\n Blockenspiel.invoke(block_, Target1.new(hash_), :parameterless => :instance)\n assert_equal(1, hash_['a1'])\n assert_equal(2, hash_['b2'])\n assert_equal(3, hash_['c3'])\n end", "def in_the(instance, &block)\n instance.instance_eval(&block)\n end", "def execute(&block)\n\tblock.call\nend", "def execute(&block)\n\tblock.call\nend", "def execute(&block)\n\tblock.call\nend", "def call(*args)\n block.call(*args) if block\n end", "def execute(&block)\n\tblock.call\nend", "def yield_or_eval &block\n case block.arity\n # ruby bug for -1\n when 0, -1 then instance_eval(&block)\n when 1 then yield(self)\n else raise ArgumentError, \"too many arguments required by block\"\n end\n end", "def initialize(&block)\n @block = block\n end", "def execute(&block)\r\n block\r\nend", "def initialize(&block)\n @block = block\n end", "def initialize(&block)\n @block = block\n end", "def execute(&block)\n block.call\n end", "def execute(&block)\n block.call\n end", "def execute(&block)\n block\nend", "def execute(&block)\n block\nend" ]
[ "0.71977603", "0.71977603", "0.7172122", "0.7123822", "0.71037036", "0.7076061", "0.70251554", "0.7014804", "0.70136887", "0.6946778", "0.6946778", "0.6946778", "0.6900622", "0.687367", "0.6840213", "0.6749934", "0.6707413", "0.6672536", "0.66624534", "0.65511286", "0.6537895", "0.6515525", "0.6474098", "0.6474098", "0.64669424", "0.6464839", "0.6406591", "0.63651234", "0.6360884", "0.6360884", "0.6360524", "0.6340052", "0.6323036", "0.63143265", "0.6276264", "0.6276264", "0.6267549", "0.62646055", "0.6248592", "0.6218157", "0.6206476", "0.6196568", "0.61941177", "0.61865115", "0.6185277", "0.6184045", "0.6178272", "0.61656785", "0.61656785", "0.6159005", "0.6157496", "0.61467147", "0.61341983", "0.612092", "0.6119676", "0.6105744", "0.6092713", "0.6092713", "0.6089431", "0.6086914", "0.6080496", "0.60797143", "0.607231", "0.60643077", "0.605465", "0.6051474", "0.6049564", "0.6049564", "0.60494906", "0.6049314", "0.6049314", "0.6030261", "0.60261685", "0.6016677", "0.601525", "0.60059273", "0.59938425", "0.5991192", "0.59883934", "0.5968621", "0.5966246", "0.5962335", "0.5961811", "0.59607786", "0.59556234", "0.5947508", "0.59363073", "0.5933825", "0.5933825", "0.5933825", "0.59334767", "0.5932482", "0.5916201", "0.5907831", "0.5904145", "0.59035873", "0.59035873", "0.58965576", "0.58965576", "0.5891008", "0.5891008" ]
0.0
-1
Quotes a string and marks it as SQL
def quoted(value) sql _scope.connection.quote(value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quote_string(string)\n @logger.unknown(\"ODBCAdapter#quote_string>\") if @trace\n\n # MySQL requires backslashes to be escaped\t\t\t\t\n string.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\")\n end", "def sql_string(value)\n \"'#{value.gsub(\"'\", \"''\")}'\" \nend", "def quote(s, column = nil)\n dummy_conn.quote(s)\n end", "def sql_quoted(value)\n Arel::Nodes.build_quoted(value)\n end", "def escape_for_cql_double_quotes(str)\n str = str.gsub('\"', \" \")\n str = str.gsub(\"'\", \"''\")\n\n return str\n end", "def quoted_string; end", "def dquote( str ) #:nodoc:\n unless str =~ /^\".*?\"$/\n '\"' + str.gsub(/[\"\\\\]/n) {|s| '\\\\' + s } + '\"'\n else\n str\n end\n end", "def q(str)\n str.class == String ? ActiveRecord::Base.connection.quote_string(str) : str\n end", "def quote(s)\n \"\\\"#{s}\\\"\"\n end", "def format_quote(q)\n if q == \"'\"\n '\"\\'\"'\n else\n \"'#{q}'\"\n end\n end", "def quote_string(s) #:nodoc:\n s.gsub(/'/, \"''\") # ' (for ruby-mode)\n end", "def sql(string)\n ::Arel::Nodes::SqlLiteral.new(string)\n end", "def quote_string(s) #:nodoc:\n @connection.escape(s)\n end", "def quote_string( s ) #:nodoc:\n @connection.escape( s )\n end", "def generate_sql_escape(token)\n escaped_token = token.gsub(/\\\\|'/, '\\0\\0\\0\\0').gsub(\"?\", \"\\\\\\\\77\")\n \"'\" + escaped_token + \"'\"\n end", "def escape_sql(args)\n return @text if args.empty?\n sql = @text.dup\n vars = args.dup\n\n replacements = 0\n mismatch = false\n\n sql.gsub!(/'[^']*'|\"[^\"]*\"|`[^`]*`|\\?/) do |x|\n next x unless x == '?'\n replacements += 1\n if vars.empty?\n mismatch = true\n else\n var = vars.shift\n connection.quote_value(var)\n end\n end\n\n if !vars.empty? || mismatch\n raise ArgumentError, \"Binding mismatch: #{args.size} for #{replacements}\"\n else\n sql\n end\n end", "def escape_for_single_quotes(str)\n str.gsub \"'\", \"''\"\n end", "def add_quotes_to_string(string)\n string = \"'#{string}'\"\n end", "def quote(value); end", "def _format_sql(sql)\n sql = sql.delete '\"'\n sql.downcase\n end", "def quote\n %q[(?:\"|')?]\n end", "def literal_string_append(sql, s)\n sql << \"'\" << db.synchronize(@opts[:server]){|c| c.escape(s)} << \"'\"\n end", "def quote_string(string)\n string.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\") \n end", "def quote_string(s)\n @provider.quote_string(s)\n end", "def quote_string(s)\n @provider.quote_string(s)\n end", "def quoted_identifier_append(sql, c)\n sql << '`%s`' % c\n end", "def quote_string(string)\n string.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\")\n end", "def literal_string_append(sql, v)\n sql << \"'\" << v.gsub(\"'\", \"''\") << \"'\"\n end", "def escape_str_field(str)\n str = str.to_s.sub(/\\`/,'')\n @mysql.escape(str)\n end", "def escape(string)\n # This code is taken directly from the documentation so we dont have to rely on the SQLite3::Database class. This way it can also be used with JRuby and IronRuby...\n # http://sqlite-ruby.rubyforge.org/classes/SQLite/Database.html\n string.to_s.gsub(\"'\", \"''\")\n end", "def escape(str)\n return ActiveRecord::Base.connection.quote_string(str)\n end", "def make_sql_friendly( name )\n return name.strip.gsub( \"'\", \"''\" )\n end", "def double_quote(value)\n return if value.nil?\n\n case value.to_s\n # Ignore keys that contain double quotes or a Arel.star (*)[all columns]\n # or if a table has already been explicitly declared (ex: users.id)\n when \"*\", /((^\".+\"$)|(^[[:alpha:]]+\\.[[:alnum:]]+)|\\(.+\\))/\n value\n else\n PG::Connection.quote_ident(value.to_s)\n end\n end", "def quoted(string)\n if string.to_s.match(/[\\t\\n\\r]/)\n string = string.gsub('\\\\', '\\\\\\\\\\\\\\\\').gsub('\"\"\"', '\\\\\"\\\\\"\\\\\"')\n %(\"\"\"#{string}\"\"\")\n else\n \"\\\"#{escaped(string)}\\\"\"\n end\n end", "def sql_quote(value)\n value = value.to_s.downcase if %i[nil null NULL].include?(value)\n # noinspection RubyMismatchedReturnType\n case value\n when nil, 'nil', 'null', 'NULL' then nil\n when /^-?\\d+$/ then value.to_i\n when SQL_NUMBER then value.to_f\n when String, Symbol then \"'#{value}'\"\n else value\n end\n end", "def quote_str(s)\n s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\")\n end", "def quote_string(value)\n \"'#{value.gsub(\"'\", \"''\")}'\"\n end", "def quote_string(s)\n s.gsub('\\\\'.freeze, '\\&\\&'.freeze).gsub(\"'\".freeze, \"''\".freeze) # ' (for ruby-mode)\n end", "def quote_string(string)\n with_raw_connection(allow_retry: true, materialize_transactions: false) do |connection|\n connection.escape(string)\n end\n end", "def quote_string(s)\n s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\") # ' (for ruby-mode)\n end", "def _quoteString ( str )\n str.gsub( /\\\\/, '\\&\\&' ).gsub( /'/, \"''\" ) # ' (for ruby-mode)\n end", "def to_quote(str)\n case str\n when /'/\n \"'\" + str.to_s.gsub(\"'\"){ \"\\\\'\" } + \"'\"\n else\n \"'\" + str.to_s + \"'\"\n end\n end", "def quote(string)\n\t\t\tstring.nil? ? \"NULL\" : \"'#{super}'\"\n\t\tend", "def quote( val )\n\t\treturn %q{\"%s\"} % [ val.to_s.gsub(/\"/, '\\\\\"') ]\n\tend", "def quote(val, column=nil)\n return val unless val.is_a?(String)\n \"'#{val.gsub(/\\'/, \"\\\\\\\\'\")}'\" # \" <= for Emacs font-lock\n end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end" ]
[ "0.75477934", "0.7530987", "0.75047475", "0.7425209", "0.7389419", "0.7336978", "0.7282331", "0.7279858", "0.7233335", "0.7217757", "0.7178834", "0.7145263", "0.7130365", "0.7124313", "0.71122277", "0.7110103", "0.70954", "0.7064483", "0.7049399", "0.7046927", "0.70350045", "0.70180994", "0.700127", "0.6969653", "0.6969653", "0.6966905", "0.69667435", "0.69562876", "0.6932098", "0.69283015", "0.6922462", "0.6920033", "0.6899592", "0.6897705", "0.68814623", "0.6876285", "0.6875656", "0.68478197", "0.6847416", "0.6846962", "0.68449", "0.6824915", "0.68199015", "0.6815195", "0.67919964", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737", "0.67910737" ]
0.74910843
4
Evaluates a DSL block. If arity is given, this method `yield` itself, rather than `instance_eval`.
def evaluate(&block) if block.arity.zero? instance_eval(&block) else yield(self) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(&block)\n if block.arity > 0\n yield self\n else\n instance_exec(&block)\n end\n end", "def dsl_eval(dsl, *args, **_arg2, &block); end", "def arity_based &block\n block.arity == 0 ? proc { |obj| obj.instance_eval &block }\n : block\n end", "def dsl_eval_with_block_return(dsl, *args, **_arg2, &block); end", "def dsl_eval_with_block_return(dsl, *args, **_arg2, &block); end", "def dsl_eval(block)\n @dsl ||= DSL.new(self)\n @dsl.instance_eval(&block)\n self\n end", "def yield_or_eval &block\n case block.arity\n # ruby bug for -1\n when 0, -1 then instance_eval(&block)\n when 1 then yield(self)\n else raise ArgumentError, \"too many arguments required by block\"\n end\n end", "def evaluate(block, *args)\n return if block.nil?\n if block.is_a? Symbol\n instance_exec(self, *args, &block)\n else\n instance_exec(*args, &block)\n end\n end", "def eval\n @block.eval\n end", "def dsl_eval_immutable(dsl, *args, **_arg2, &block); end", "def dsl_eval_immutable(dsl, *args, **_arg2, &block); end", "def eval\n yield self\n end", "def evaluate(*args, &block)\n self.class.evaluate(self, *args, &block)\n self\n end", "def evaluate\n context = Context.new(self, node)\n context.instance_exec(&block)\n node\n end", "def evaluate(&block)\n instance_eval(&block)\n end", "def call\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self) if @block\n self\n end", "def call(*args)\n instance_exec(*correct_arg_arity(block.arity, args), &block)\n end", "def call\n if @block\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self)\n end\n self\n end", "def dsl_eval_immutable(dsl, *args, &block)\n exec_in_proxy_context(dsl, ChainingFallbackContextProxy, *args, &block)\n end", "def and_yield(*args)\n yield eval_context = Object.new if block_given?\n @plan = Proc.new do |&block|\n eval_context.instance_exec(*args, &block)\n end\n self\n end", "def compile_yield(scope, args, block)\n @e.comment(\"yield begin\")\n args ||= []\n args = [args] if !args.is_a?(Array) # FIXME: It's probably better to make the parser consistently pass an array\n args = [0] + args # FIXME: No chaining of blocks. Is chaining of blocks legal? Never used it. Anyway, we don't support it\n\n compile_callm_args(scope, :self, args) do\n reg = @e.load(:arg, 1) # The block parameter\n @e.call(reg)\n end\n @e.comment(\"yield end\")\n return [:subexpr]\n end", "def execute(&block)\n DSLHelper.new(Class => [:&, :|, :not]) do\n Kernel.load(File.join(File.dirname(__FILE__), 'dsl_ruby_extensions.rb'))\n self.instance_eval(&block)\n end\n end", "def evaluate_block_with_arguments(block, args)\n # If block.arity < 0, when a block takes a variable number of args,\n # the one's complement (-n-1) is the number of required arguments\n required_arguments = block.arity < 0 ? ~block.arity : block.arity\n if args.length >= required_arguments\n if block.arity < 0\n instance_exec(*args, &block)\n else\n instance_exec(*args.first(block.arity), &block)\n end\n else\n raise ArgumentError.new(\"wrong number of arguments (#{args.size} for #{required_arguments})\")\n end\n end", "def with(&block)\n raise ArgumentError.new(\"Must pass a block\") unless block_given?\n case block.arity\n when 1\n yield self\n when 0\n instance_methods_eval(&block)\n else\n raise \"block arity must be 0 or 1\"\n end\n end", "def run\n if @block.arity >= 1\n @block.call self\n else\n @block.call\n end\n end", "def _exec block, *args\n instance_exec(*args, &block)\n end", "def evaluate_sifter(scope, *args, &block)\n evaluate scope do |root|\n root.instance_exec(*args, &block)\n end\n end", "def dsl_eval_with_block_return(dsl, *args, &block)\n exec_in_proxy_context(dsl, FallbackContextProxy, *args, &block)\n end", "def dsl_eval(dsl, *args, &block)\n exec_in_proxy_context(dsl, FallbackContextProxy, *args, &block)\n dsl\n end", "def arity_match\n begin \n @arity_match = true\n yield\n ensure\n @arity_match = false\n end\n end", "def evaluate(&block)\n self.original_self = eval \"self\", block.binding\n instance_eval &block\n end", "def call(&block)\n instance_eval(&block)\n end", "def call(&block)\n instance_eval(&block)\n end", "def call(&block)\n instance_eval(&block)\n end", "def evaluate!(scope, &block)\n new(scope).evaluate(&block)\n end", "def block_args\n expect :iter\n if self[2] == 0 # ?! See https://github.com/presidentbeef/railroader/issues/331\n return Sexp.new(:args)\n else\n self[2]\n end\n end", "def invoke(args, block)\n \n handle_order_constraint\n\n begin\n Kernel::raise @exception_to_raise.new unless @exception_to_raise.nil?\n Kernel::throw @symbol_to_throw unless @symbol_to_throw.nil?\n\n if !@method_block.nil?\n return invoke_method_block(args)\n elsif !@args_to_yield.nil?\n return invoke_with_yield(block)\n else\n return invoke_return_block(args, block)\n end\n ensure\n @received_count += 1\n end\n end", "def arity\n @block ? @block.arity : 0\n end", "def arity\n @block ? @block.arity : 0\n end", "def instance_eval(*args, &block)\n file, line = __find_caller__(caller())\n $__gen_code__[[file, line]] = {\n :binding => self, \n :kind => :instance_eval, \n :code => args[0]\n }\n if block_given?\n $__instance_eval__.bind(self).call(&block)\n else\n $__instance_eval__.bind(self).call(*args)\n end\n end", "def apply(&blk)\n Rubylude.new ->() {\n while value = @generator.resume\n Fiber.yield blk.call(value)\n end\n }\n end", "def rblock\n if block_given?\n # yield execute the block\n yield\n else\n puts \"No block\"\n end\n end", "def execute\n yield self if block_given?\n end", "def build(&block)\n Util.instance_eval_or_call(dsl, &block)\n self\n end", "def build(&block)\n Util.instance_eval_or_call(dsl, &block)\n self\n end", "def yields *args\n @yields = args\n self\n end", "def run(*args,&ruby_block)\n # Gain access to the runner as local variable.\n runner_proc = @runner_proc\n # # The context is the one of the reader.\n # Execute the code generating the reader in context.\n HDLRuby::High.space_push(@namespace)\n HDLRuby::High.cur_block.open do\n instance_exec(ruby_block,*args,&runner_proc)\n end\n HDLRuby::High.space_pop\n end", "def evaluate(scope, locals, &block); end", "def each\n @block_args.each do |arg|\n yield arg\n end\n end", "def walk(&block)\n instance_eval(&block)\nend", "def each(*args, &block)\n @body.each(*args, &block)\n ensure\n unless @closed\n @closed = true\n @block.call\n end\n end", "def shard_eval(&block)\n all_shards.each do |shard|\n shard.class_eval(&block)\n end\n end", "def call(*args)\n block.call(*args)\n end", "def call(*args, &block)\n @block.call *args, &block\n end", "def run(*args,&ruby_block)\n # Gain access to the runner as local variable.\n runner_proc = @runner_proc\n # Execute the code generating the accesser in context.\n HDLRuby::High.space_push(@namespace)\n HDLRuby::High.cur_block.open do\n instance_exec(ruby_block,*args,&runner_proc)\n end\n HDLRuby::High.space_pop\n end", "def execute\n if @block\n instance_eval(&@block)\n else\n raise MRubyTestSkip, \"(Not implemented)\"\n end\n end", "def run(*args,&ruby_block)\n # Gain access to the accesser as local variable.\n runner_proc = @runner_proc\n # Execute the code generating the accesser in context.\n HDLRuby::High.space_push(@namespace)\n HDLRuby::High.cur_block.open do\n instance_exec(ruby_block,*args,&runner_proc)\n end\n HDLRuby::High.space_pop\n end", "def body(&block)\n call_once\n if block_given?\n yield body\n else\n @body\n end\n end", "def call(*args)\n block.call(*args) if block\n end", "def each\n enclosed_yield = Proc.new { |*args| yield *args }\n\n @proc.call Yielder.new(&enclosed_yield)\n end", "def match(*, &match_dsl)\n instance_eval(&match_dsl) if match_dsl\n end", "def yield_inside(&block)\n module_eval &block\n end", "def rucas &block\n self.instance_eval(&block)\n end", "def process_yield(exp)\n value = exp.shift\n\n str = without_result do\n want_expression do\n block_name() + \"(\" + (value ? process(value) : '') + \")\"\n end\n end\n resultify(str)\n end", "def method_missing(method_sym, *arguments, &_block)\n @dsl.send(method_sym, *arguments)\n end", "def __execute(&block)\n self.instance_eval(&block)\n end", "def process_iter exp\n process_default exp\n\n call = exp.block_call\n\n if call? call\n target = call.target\n method = call.method\n arg = exp.block_args.first_param\n block = exp.block\n\n # Check for e.g. Model.find.each do ... end\n if method == :each and arg and block and model = get_model_target(target)\n if arg.is_a? Symbol\n if model == target.target\n env[Sexp.new(:lvar, arg)] = Sexp.new(:call, model, :new)\n else\n env[Sexp.new(:lvar, arg)] = UNKNOWN_MODEL_CALL\n end\n\n process block if sexp? block\n end\n elsif FORM_METHODS.include? method\n if arg.is_a? Symbol\n env[Sexp.new(:lvar, arg)] = FORM_BUILDER_CALL\n\n process block if sexp? block\n end\n end\n end\n\n exp\n end", "def number_evaluation(num1, num2, num3)\n puts \"Inside the method\"\n yield(num1, num2, num3)\n # puts \"Block inside the method!\"\nend", "def perform(&run_interp)\n @resolved_modifier = yield modifier\n @resolved_type = yield type\n expressions.each {|e| e.perform(&run_interp)}\n end", "def accept(evaluator)\n evaluator.block(self)\n end", "def yield_call(compiler)\n method_check(compiler) << yield_arg_block(compiler)\n end", "def yield!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 85 )\n\n type = YIELD\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 206:9: 'yield'\n match( \"yield\" )\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__, 85 )\n\n end", "def each(&block)\n if block\n @block = block\n @parser.parse(@handle)\n else\n enum_for(:each)\n end\n end", "def evaluate_block_with_bindings(closure_scope, args_hash, plan)\n plan_result = closure_scope.with_local_scope(args_hash) do |scope|\n plan.steps.each do |step|\n step_result = dispatch_step(scope, step)\n\n scope.setvar(step.name, step_result) if step.name\n end\n\n evaluate_code_blocks(scope, plan.return)\n end\n\n throw :return, Puppet::Pops::Evaluator::Return.new(plan_result, nil, nil)\n end", "def from_block\n options = new\n dsl = ExecutionOptionsDSL.new(options)\n yield dsl\n options\n end", "def run_block\n # yields control to the passed block.\n yield(10) if block_given?\nend", "def accept(evaluator)\n evaluator.for_loop(self)\n end", "def context_for_eval; end", "def test_instance_eval_behavior\n hash_ = Hash.new\n context_self_ = self\n @my_instance_variable_test = :hello\n block_ = proc do\n set_value1('a', 1)\n set_value2('b'){ 2 }\n set_value3('c', 3)\n context_self_.assert_raise(NoMethodError){ set_value3_dslversion('d', 4) }\n context_self_.assert_raise(NoMethodError){ helper_method() }\n context_self_.assert(!instance_variable_defined?(:@my_instance_variable_test))\n context_self_.assert_instance_of(Target1, self)\n end\n Blockenspiel.invoke(block_, Target1.new(hash_), :parameterless => :instance)\n assert_equal(1, hash_['a1'])\n assert_equal(2, hash_['b2'])\n assert_equal(3, hash_['c3'])\n end", "def ar\n yield if block_given? && ar?\n end", "def run_block\n yield\nend", "def execute_block(block)\n case\n when block.is_a?(Symbol)\n send(block)\n when block.respond_to?(:call) && (block.arity == 1 || block.arity == -1)\n block.call(self)\n else\n block\n end \n end", "def exec_in_proxy_context(dsl, proxy_type, *args, **_arg3, &block); end", "def accept(evaluator)\n evaluator.loop(self)\n end", "def yield(*args)\n block = block_for_frame(yield_frame)\n if( block.nil? )\n raise LocalJumpError, \"No block given to yield to.\", caller\n else\n begin\n # If the block call has a context yield inside, resolve that one frame up.\n # This turns out to be what we usually want as we are forwarding a\n # yielded value in the call.\n @yield_frame_depth += 1\n block.call(*args)\n ensure\n @yield_frame_depth -= 1\n end\n end\n end", "def run\n @ctx.call(self,&@blk) if @blk\n end", "def build(&block)\n instance_eval(&block)\n end", "def run\n block.call\n end", "def each(&block)\n return enum_for(:each) unless block_given?\n visit { |node| yield node }\n self\n end", "def roby_execute(&block)\n execution_engine.execute(&block)\n end", "def call\n @block.call(*values)\n end", "def test_4_mix_of_lambdas_and_blocks_can_call_each_other\n result = interpret <<EOC\nl1=->() {1}\nb1=:{%l1()}\nl2=->() {%b1}\nm2=:{%l2}\n%m2\nEOC\n assert_eq result, 1\n end", "def bound_method(block)\n type = self.type\n arity = block.arity\n arity += 1 if arity >= 0 # Make sure the object gets passed\n arity += 1 if arity == 1 && type == :around # Make sure the block gets passed\n\n method = lambda { |object, *args| object.instance_exec(*args, &block) }\n\n\n # Proxy arity to the original block\n (\n class << method;\n self;\n end).class_eval do\n define_method(:arity) { arity }\n end\n\n method\n end", "def gsub_yield line, t, dtype, line_number=nil, filename=nil\n match = line.match YIELD_REGEX\n while !match.nil?\n\n statement = match[0][4...-2]\n result = self.send :eval, statement, binding, filename, line_number\n line[\"%%= #{statement}%%\"] = result.to_s\n\n match = line.match YIELD_REGEX\n end\n line\n end", "def each(*args, &block)\n @stmt.each(*args, &block)\n end", "def evaluate context = nil\n if Functions.available.include? self.to_sym\n send to_sym, *@args\n else\n args = @args.map { |e|\n e.parent = self.parent\n e = e.evaluate(context) if e.respond_to?(:evaluate)\n e.to_css\n } * ', '\n Node::Anonymous.new(\"#{to_sym}(#{args})\")\n end\n end", "def process *args, &block\n yield(args)\n end", "def next_block_will_be_binary\n @block_arity = 2\n end", "def eval(*args); end", "def evaluate(instance, *args, &block)\n cleanroom.new(instance).instance_eval(*args, &block)\n end" ]
[ "0.69986343", "0.6847398", "0.6840901", "0.67608947", "0.67608947", "0.67580175", "0.67006016", "0.66018623", "0.65191615", "0.6502285", "0.6502285", "0.64812857", "0.62827003", "0.6244749", "0.6189365", "0.6166125", "0.6133801", "0.6113563", "0.6112431", "0.6071587", "0.60298693", "0.6028767", "0.59888464", "0.5947988", "0.5914512", "0.58853", "0.5791064", "0.5787739", "0.5779403", "0.5701545", "0.56901574", "0.563216", "0.563216", "0.563216", "0.5630337", "0.5625164", "0.56126493", "0.5604205", "0.5604205", "0.5580563", "0.5487914", "0.54849297", "0.5477119", "0.5437134", "0.5437134", "0.5425407", "0.5416555", "0.54120165", "0.5402392", "0.5402077", "0.5400365", "0.537953", "0.53494346", "0.5342902", "0.53408575", "0.5327701", "0.52789456", "0.52773565", "0.5266761", "0.52557105", "0.52553356", "0.5240024", "0.52274173", "0.5220784", "0.5219815", "0.5219138", "0.5213797", "0.5207868", "0.52007294", "0.51994747", "0.5194168", "0.51919067", "0.5180361", "0.51741487", "0.5174124", "0.5140337", "0.51391053", "0.5130364", "0.51283383", "0.5111441", "0.5108054", "0.51074904", "0.5107453", "0.5105264", "0.51018476", "0.50995857", "0.50941724", "0.5082257", "0.5073798", "0.5065991", "0.50623083", "0.5061725", "0.5055879", "0.50548214", "0.50516593", "0.50488585", "0.504256", "0.5037784", "0.5034838", "0.5034385" ]
0.68368673
3
REVIEW: change/remove this when status.py is doing the updating
def update_dip(id, uuid) dataset = Dlibhydra::Dataset.find(id) @dip = dataset.aips[0] dip_info = get_dip_details(uuid) ingest_dip(dip_info['current_path']) dip_current_path(dip_info['current_path']) dip_uuid(dip_info['uuid']) dip_status(dip_info['status']) dip_size(dip_info['size']) dip_current_location(dip_info['current_location']) # api location dip_resource_uri(dip_info['resource_uri']) # api uri dip_size(dip_info['size']) dip_origin_pipeline(dip_info['origin_pipeline']) save_dip 'AIP updated with dissemination objects' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outdated; end", "def update_status_to_processed\n fail 'child class to implement'\n end", "def update() end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def change_status(status)\n #not implemented \n end", "def status=(status); 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_status_timestamp\n self.overall_status_modified_at = Time.zone.now\n end", "def update_status(status)\n @status = status\n @last_status_change = Time.now\n update_statusfile\n end", "def update_status() \n ContentProviderStatusItem.update(self)\n end", "def last_status; end", "def update\n\t\t# Left empty intentionally.\n\tend", "def auto_update_status \n if self.status == \"To Be Published\"\n self.status = \"Published\"\n end \n end", "def status_update(_event)\n @submitted = false\n @filed = false\n end", "def status\n super\n end", "def update\n # Not generally used\n end", "def update\n # Not generally used\n end", "def refresh_status!\n update!(:status => 'new') if status.nil?\n update!(:status => 'ack') if acked?\n update!(:status => 'nack') if nacked?\n update!(:status => 'push') if pushed?\n end", "def outdated?; end", "def updated_data; end", "def update\n \n end", "def statuses; end", "def auto_update_status\n if self.criminal_date && self.child_abuse_date && self.fbi_date\n if self.status < 2\n self.status = 2\n end\n elsif self.status == 2\n self.status = 1\n end\n end", "def replace_update_me\n end", "def after_update; end", "def after_update; end", "def changed\n @status = true\n end", "def force_update_status(status) #rails' behaviour when saving a attribute in a background thread is very weird and unpredictable..\n \t\tself.update_attribute(:status , status)\n \t\tself.update_attributes(:status => status)\n \t\tself.status = status\n \t\tself.save\n end", "def update_completed? ; false ; end", "def status(*) end", "def update\n \n end", "def dirty; end", "def status\n end", "def status\n end", "def status\n end", "def status\n end", "def update_status\n @completed_status = !completed_status\n puts \"#{description} Completed\"\n end", "def update_status\r\n self.reload\r\n jobs = self.jobs\r\n complete_jobs = get_complete_jobs(jobs, JobStatus::COMPLETED, ProcessorStatus::COMPLETED) \r\n incomplete_jobs = get_complete_jobs(jobs, JobStatus::INCOMPLETED, ProcessorStatus::INCOMPLETED) unless self.facility.client.name == 'UNIVERSITY OF PITTSBURGH MEDICAL CENTER'\r\n incomplete_jobs = get_upmc_incomplete_jobs(jobs, JobStatus::INCOMPLETED) if self.facility.client.name == 'UNIVERSITY OF PITTSBURGH MEDICAL CENTER'\r\n complete_output_ready_jobs = get_output_ready_jobs(jobs, JobStatus::COMPLETED, ProcessorStatus::COMPLETED, QaStatus::COMPLETED) \r\n incomplete_output_ready_jobs = get_output_ready_jobs(jobs, JobStatus::INCOMPLETED, ProcessorStatus::INCOMPLETED, QaStatus::INCOMPLETED)\r\n\r\n excluded_jobs = jobs.select do |job|\r\n job.job_status.upcase == JobStatus::EXCLUDED\r\n end\r\n \r\n new_jobs = jobs.select do |job|\r\n job.job_status == JobStatus::NEW\r\n end\r\n\r\n allocated_jobs = jobs.select do |job|\r\n job.job_status == JobStatus::PROCESSING\r\n end\r\n\r\n excluded_processing_or_new_jobs = jobs.select do |job|\r\n ((job.job_status == JobStatus::NEW || job.job_status == JobStatus::PROCESSING) &&\r\n job.is_excluded == true)\r\n end\r\n\r\n previous_status = self.status\r\n if jobs.size == new_jobs.size or jobs.size == 0\r\n self.status = BatchStatus::NEW\r\n self.completion_time = nil\r\n elsif jobs.size == (complete_output_ready_jobs.size + excluded_jobs.size +\r\n incomplete_output_ready_jobs.size + excluded_processing_or_new_jobs.size)\r\n self.completion_time = Time.now\r\n self.status = BatchStatus::OUTPUT_READY\r\n elsif jobs.size == (complete_jobs.size + excluded_jobs.size +\r\n incomplete_jobs.size + excluded_processing_or_new_jobs.size)\r\n self.completion_time = Time.now\r\n self.status = BatchStatus::COMPLETED\r\n else\r\n self.status = BatchStatus::PROCESSING\r\n self.completion_time = nil\r\n end\r\n if previous_status == BatchStatus::NEW && self.status == BatchStatus::PROCESSING &&\r\n self.processing_start_time.blank?\r\n self.processing_start_time = Time.now\r\n end\r\n if previous_status == BatchStatus::PROCESSING && self.status == BatchStatus::COMPLETED\r\n self.processing_end_time = Time.now\r\n end\r\n set_qa_status\r\n self.save \r\n end", "def update\n \t\n end", "def update\n \t\n end", "def update\n #Nothing necessary\n end", "def correctly_update_status\n\t\terrors.add(:base, 'La transaccion no fue exitosa') if self.invalid_status\n\tend", "def on_update; end", "def modified; status[:modified]; end", "def update;end", "def status\n original.status || nil\n end", "def status\n original.status || nil\n end", "def update; end", "def update()\n end", "def update_status status\n @job.set({\n custom_status: status,\n pinged_at: Time.now\n })\n end", "def update_local\n # TODO\n end", "def update_status\n self.status = board.status\n end", "def update\n ;\n end", "def munge\n add_status_to_resource_status\n add_missing_metrics\n recalculate_report_status\n self\n end", "def modified; status[:modified] || []; end", "def before_update; end", "def update\n super\n end", "def updated_data\n\tend", "def prepare_for_update(updated_by_id, status)\n self.version += 1\n self.updated_by = updated_by_id\n self.donation_status = status\n self.updated_at = Date.current\n end", "def mte_prepare_updating; send_request_to_mite(\"update\"); end", "def after_update(updated)\n # not required\n end", "def update\n # TODO: implement update\n end", "def after_update\n end", "def after_update\n end", "def update_api_status()\n api_status = generate_api_status()\n if !api_status.nil? and !api_status.empty?\n HelperFunctions.write_file(HEALTH_FILE, api_status)\n end\n end", "def added; status[:added]; end", "def update\r\n\r\n end", "def update\n\t\t\n\t\tend", "def prepare_for_update(updated_by_id, status)\n self.version += 1\n self.updated_by = updated_by_id\n self.donation_status = status\n self.updated_at = Time.now\n end", "def update!(**args)\n @new_status = args[:new_status] if args.key?(:new_status)\n end", "def handle_status_change\n return nil unless self.new_status.present?\n self.status = self.new_status\n if self.new_status == 'active'\n # the user wants to make the ad active now so push out the inactive and deletion dates\n self.inactive_date = Time.now + 2.months\n self.delete_date = Time.now + 4.months\n elsif self.new_status == 'inactive'\n # the user wants to make the ad inactive now so make the inactive date to day and deletion in 2 months\n self.inactive_date = Time.now\n self.delete_date = Time.now + 2.months\n end\n end", "def update\n #\n # NO-OP\n #\n end", "def status\n @sync.synchronize{super}\n end", "def set_status!(status)\n ## FIXME_NISH Fix this.\n ## FIXED\n update(status: (status == 'true'))\n end", "def modified?; end", "def set_status\n self.status = 1\n end", "def old_sync; end", "def update \n end", "def update\n true\n end", "def update \n end", "def refresh_live_status\n self.status.live?\n end", "def update\r\n end", "def update\r\n end", "def update\r\n end", "def update\r\n end" ]
[ "0.69088715", "0.68517333", "0.684086", "0.6826766", "0.6826766", "0.6826766", "0.6826766", "0.6826766", "0.6826766", "0.6826766", "0.6826766", "0.6826766", "0.68116415", "0.6779681", "0.676772", "0.67179084", "0.67179084", "0.67179084", "0.67179084", "0.67179084", "0.67179084", "0.67179084", "0.67179084", "0.6711914", "0.6676978", "0.66640645", "0.6637668", "0.6625583", "0.656979", "0.6541711", "0.6523626", "0.6516625", "0.6516625", "0.6505777", "0.650268", "0.6502023", "0.64858085", "0.64734966", "0.64715534", "0.6460157", "0.645752", "0.645752", "0.6453583", "0.6443915", "0.6436651", "0.6430537", "0.6415606", "0.63876605", "0.6349374", "0.6349374", "0.6349374", "0.6349374", "0.63462836", "0.6335863", "0.63290125", "0.63290125", "0.62852585", "0.6277748", "0.6275985", "0.62730706", "0.62539625", "0.6250002", "0.6250002", "0.6242543", "0.62334704", "0.62247354", "0.6219799", "0.62092155", "0.6195365", "0.6180856", "0.61732", "0.61589193", "0.615623", "0.61422014", "0.6133975", "0.61153466", "0.6114441", "0.61045486", "0.61031336", "0.61031336", "0.6101219", "0.6098175", "0.6095422", "0.60847944", "0.60843325", "0.6080398", "0.6070359", "0.6069653", "0.60684556", "0.6057046", "0.60561", "0.60550123", "0.6049231", "0.60459226", "0.6029144", "0.6025225", "0.6018611", "0.60130507", "0.60130507", "0.60130507", "0.60130507" ]
0.0
-1
inside the dip location folder, there will be: a folder called "objects" containing the actual files of the dip a folder called "thumbnails" containing thumbnails for each file in the dip a file called "METS.xxxx.xml" a file called "ProcessingMCP.xml" Need to create a FileSet for METS.xxxx.xml, a FileSet for Processing.MCP.xml, and a FileSet for each actual file in the dip (which will consist of a primary file (in "objects") and an additional file (in "thumbnails"))
def ingest_dip(dip_location) # uncomment the next 2 lines, and add 2nd parameter "dataid" to the function spec in order to call this method standalone # dataset = Dlibhydra::Dataset.find(dataid) # @dip = dataset.aips[0] location = File.join(ENV['DIP_LOCATION'], dip_location) # for each file/folder in the dip location Dir.foreach(location) do |item| # if it's the "objects" folder if File.directory?(File.join(location, item)) && item == 'objects' # for each file in the "objects" folder Dir.foreach(File.join(location, item)) do |object| # skip any directories inside the objects folder next if File.directory?(File.join(location, item, object)) # create a new FileSet obj_fs = Dlibhydra::FileSet.new # add this file to the FileSet obj_fs.preflabel = object path = File.join(location, item, object) f = open(path) Hydra::Works::UploadFileToFileSet.call(obj_fs, f) # get the first 36 characters of the filename - the "thumbnail" and "ocr text" corresponding to this file will have this prefix prefix = object[0..35] # find the "thumbnail" that corresponds to this file (it'll have the same filename prefix) if it exists and add it to the FileSet thumbnail_file = prefix + '.jpg' thumbnail_path = File.join(location, 'thumbnails', thumbnail_file) if File.file?(thumbnail_path) f2 = open(thumbnail_path) Hydra::Works::AddFileToFileSet.call(obj_fs, f2, :thumbnail, update_existing: false) end # find the OCR file that corresponds to this file if it exists and add it to the FileSet ocrfile = prefix + '.txt' ocrfile_path = File.join(location, 'OCRfiles', ocrfile) if File.file?(ocrfile_path) f3 = open(ocrfile_path) Hydra::Works::AddFileToFileSet.call(obj_fs, f3, :extracted_text, update_existing: false) end # add this FileSet to the dip obj_fs.save @dip.members << obj_fs save_dip end # otherwise, if it's a file (not a folder) elsif File.file?(File.join(location, item)) # create a new FileSet obj_fs = Dlibhydra::FileSet.new # add this file to the FileSet obj_fs.preflabel = item f = open(File.join(location, item)) Hydra::Works::UploadFileToFileSet.call(obj_fs, f) # add this FileSet to the dip obj_fs.save @dip.members << obj_fs save_dip end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_filesets_for_export(object_files, include_files = true)\n %w[metadata text].inject([]) do |ret, fileset_type|\n next ret if object_files[fileset_type.to_sym].blank?\n object_fileset = {\n created_at: create_date,\n updated_at: modified_date,\n file_set_of: { ark_id: pid },\n file_set_type: fileset_type,\n file_name_base: \"#{pid}_#{fileset_type}\",\n metastreams: {\n administrative: { access_edit_group: rightsMetadata.access(2).machine.group },\n workflow: {\n ingest_origin: ingest_origin_for_workflow,\n processing_state: workflowMetadata.item_status.state[0] == 'published' ? 'complete' : 'derivatives'\n }.compact\n }\n }\n exemplary_ids = []\n relationships.each_statement do |statement|\n if statement.predicate =~ /isExemplaryImageOf/\n exemplary_ids << statement.object.to_s.gsub(/info:fedora\\//,'')\n end\n end\n unless exemplary_ids.blank?\n object_fileset[:exemplary_image_of] = []\n exemplary_ids.uniq.each do |pid|\n object_fileset[:exemplary_image_of] << { ark_id: pid }\n end\n end\n object_fileset[:files] = object_files[fileset_type.to_sym] if include_files\n ret << { file_set: object_fileset }\n end\n end", "def build_file_sets\n return if file_nodes.empty? || processing_derivatives?\n file_nodes.each_with_index.map do |node, index|\n file_set = create_file_set(node, files[index])\n file_set\n end\n end", "def create_fileset(paths, label='', prune=true, lookup=false)\n if HDB.verbose\n puts \"Creating list of files (this can take a long time) in...\"\n paths.each() { |p| puts p }\n end\n return fs = FileSet.new.make!(paths, label, (lookup ? self : nil))\n end", "def build_file_set(path, filename=nil)\n fname = filename || File.basename(path)\n file = File.open(path)\n fs = FileSet.new()\n fs.apply_depositor_metadata(user_key)\n fs.save!\n Hydra::Works::UploadFileToFileSet.call(fs, file)\n Hydra::Works::CharacterizationService.run(fs)\n # Add title and filename\n fs.filename = fname\n fs.title = Array(fname)\n fs.label = fname\n fs.date_uploaded = Date.today.strftime('%F')\n fs.save\n return fs\n end", "def process_images(pat, sp_name)\n sp = ServicePack.find_or_create_by_name(sp_name)\n images = ImagePath.find(:all, :conditions => \"path like '#{pat}'\")\n length = images.length\n images.each_with_index do |image, index|\n # puts \"processing image #{index} of #{length}\"\n image.package.filesets.each do |fileset|\n ServicePackFilesetMap.find_or_create_by_service_pack_id_and_fileset_id(sp.id, fileset.id)\n end\n end\nend", "def collect_files(set)\n printf(\"@I:Collect Files\\n\")\n \n # Make Director\n Common.make_dir(\"#{@SRC_DIR}\")\n printf(\"@I:Make direcory to save src- %s\\n\",@SRC_DIR)\n @set = set\n \n # Expand Path\n @MACROData.each do |tmp|\n tmp2 = tmp[1]\n tmp2.each do |tmp3|\n result = /^\\$\\{(\\w*)\\}.*/ =~ tmp3[1]\n if result == 0\n path = @set[\"#{$1}\"]\n if path == nil\n $ERROR_CNT += 1\n printf(\"@E:Not found environment path\\(\\$\\{%s\\}\\), pleae chek parameter file\\n\",$1)\n print_summary\n exit\n end\n macro = \"${\" + $1 + \"}\"\n tmp3[1] = tmp3[1].sub(\"#{macro}\",\"#{path}\")\n end\n end\n end\n \n # Copy files to work direcotry & make Readme.txt\n readme = @SRC_DIR + \"/00Readme.txt\"\n f = open(readme,\"w\")\n print_file_header(f,\"Copied files from parts file\")\n f.printf(\"#\\n\");\n f.printf(\"# Execute Information\\n\")\n f.printf(\"#\\n\")\n f.printf(\"# [PARAMETER]\");f.printf(\"%s\\n\",$PARAMETER_FILE) \n f.printf(\"# [REPORT ]\");f.printf(\"%s\\n\",$REPORT_FILE) \n f.printf(\"# [PARTS ]\");f.printf(\"%s\\n\",$PARTS_FILE) \n f.printf(\"# [CONNECT ]\");f.printf(\"%s\\n\",$CONNECT_FILE) \n f.printf(\"#\\n\");\n @MACROData.each do |tmp|\n tmp2 = tmp[1]\n tmp2.each do |file|\n if File::exists?(file[1]) == true\n FileUtils.install(file[1],@SRC_DIR + \"/\" + File.basename(file[1]), :mode => 0400 )\n f.printf(\"[MACRO Name]%s: %s\\n\", tmp[0], file[1])\n else\n $WARNING_CNT += 1\n printf(\"@W-parts001:%s is not exist\\n\",file[1])\n f.printf(\"[MACRO Name]%s: %s\\n -!!CAUTION!!There is no original file.\\n\", tmp[0],file[1])\n end\n end\n end\n f.close\n if $VERBOSE == true\n printf(\"@I:Print copied file\\n\")\n system (\"ls -al #{@SRC_DIR}\")\n end\n \n printf(\"@I:Collect Files Done\\n\")\n \n end", "def build_file_sets\n return [] if file_nodes.empty?\n file_nodes.each_with_index.map do |node, index|\n file_set = create_file_set(node, files[index])\n file_set\n end\n end", "def create_image_files_where_needed()\n @file_info.data.each do |line|\n uri, filename = line\n process_file_info(uri, filename)\n end\n end", "def file_set_append\n # Append the array of file metadata values to any FileSets with new FileNodes being appended\n parent.file_metadata += file_nodes\n file_nodes\n end", "def create_set\n x = 1\n while Dir.exists?(File.join(@path, \"Packages Set %d\" % x)) do\n x = x.next\n end\n\n package_set = File.join(@path, \"Packages Set %d\" % x)\n Dir.mkdir(package_set)\n end", "def file_sets_for(work)\n Hyrax.custom_queries.find_child_file_sets(resource: work)\n end", "def create_file_set(file_node, file)\n attributes = {\n title: file_node.original_filename,\n file_metadata: [file_node],\n processing_status: \"in process\"\n }.merge(\n file.try(:container_attributes) || {}\n )\n persister.save(resource: FileSet.new(attributes))\n end", "def category_result_files\n crs = self.data_directory.find_all { |name| name =~ /^multi_.*\\.htm\\.yml$/ }\n crs.collect { |fn| File.join(self.data_directory.path, fn) }\n end", "def filesets_for_export(include_files = true)\n filesets = []\n has_ereader_files = false\n # get file-level filesets (image, document, video, etc); remove ereader (do 'em separately)\n all_files = Bplmodels::Finder.getFiles(pid)\n\n ereader_files = all_files.delete(:ereader) || []\n\n ## all_files.delete(:images) # uncomment for easier testing of IA objects\n # Make all non ereader files part of a \"lazy\" eumerator see Enumerator::Lazy at https://ruby-doc.org/core-2.6.8/Enumerator/Lazy.html\n # Note all_files.values.reduce(:+) will flatten the values in the all_files hash into a single array\n filesets = filesets_for_files_lazy(all_files.values.reduce(:+), include_files)\n # get EReader filesets and combine, make EPub the 'primary'\n if ereader_files.present?\n has_ereader_files = true\n ereader_fileset_for_export = nil\n if include_files\n ereader_filesets = filesets_for_files(ereader_files, include_files)\n ereader_filesets.each_with_index do |er_fileset, index|\n if er_fileset[:file_set][:files][0][:content_type] == 'application/epub+zip'\n ereader_fileset_for_export = er_fileset\n ereader_filesets.delete_at(index)\n end\n end\n ereader_filesets.each do |er_fileset|\n er_fileset[:file_set][:files].each do |er_file|\n next unless er_file[:file_type].match?(/ebook_access/)\n\n ereader_fileset_for_export[:file_set][:files] << er_file\n end\n end\n else\n ereader_files = ereader_files.select { |erf| erf[\"mime_type_tesim\"].include?(\"application/epub+zip\") }\n if ereader_files.present?\n ereader_fileset_obj = Bplmodels::File.find(ereader_files.first['id'])\n ereader_fileset_for_export = ereader_fileset_obj.export_data_for_curator_api(include_files)\n end\n end\n\n # have to modify keys of ebook_access_mobi and ebook_access_daisy files to use epub pid\n # NOTE on moving this up from below\n # Instead of reiterating through all of the fileset objects to check for the ereader object we just added...\n # modify the one we are adding before putting it into the filesets enum\n if ereader_fileset_for_export.present?\n pid_for_key = ereader_fileset_for_export.dig(:file_set, :ark_id)\n ereader_fileset_for_export[:file_set][:files].each do |file|\n if file[:file_type] == 'ebook_access_daisy' || file[:file_type] == 'ebook_access_mobi'\n key_parts = file[:key].split('/')\n key_parts[1] = pid_for_key if key_parts[1].match?(/[\\w-]*:[0-9a-z]*/)\n file[:key] = key_parts.join('/')\n end\n end\n end\n # NOTE since filesets is a Enumerator::Lazy object the << operator does not work anymore\n # Instead you have to wrap the object into a Enumerator subtype(Array in this case) and add(+) it\n # This will create an Enumerator::Chain object\n filesets = filesets + Array.wrap(ereader_fileset_for_export)\n end\n\n # if has_ereader_files\n # filesets.each do |fs|\n # fileset = fs[:file_set]\n # next unless fileset[:file_set_type] == 'ereader'\n #\n # pid_for_key = fileset[:ark_id]\n # fileset[:files].each do |file|\n # if file[:file_type] == 'ebook_access_daisy' || file[:file_type] == 'ebook_access_mobi'\n # key_parts = file[:key].split('/')\n # key_parts[1] = pid_for_key if key_parts[1].match?(/[\\w-]*:[0-9a-z]*/)\n # file[:key] = key_parts.join('/')\n # end\n # end\n # end\n # end\n # get the object-level filesets (metadata, plainText, etc)\n object_filesets = object_filesets_for_export(object_filestreams_for_export)\n filesets + object_filesets\n end", "def create_file_set(file_node, file)\n attributes = {\n title: fileset_title(file_node.original_filename.first),\n file_metadata: [file_node],\n processing_status: \"in process\"\n }.merge(\n file.try(:container_attributes) || {}\n )\n file_set = FileSet.new(attributes)\n change_set = ChangeSet.for(file_set)\n change_set_persister.save(change_set: change_set)\n end", "def find_files(file_set:)\n if file_set.respond_to?(:file_ids)\n return [] if file_set.file_ids.blank?\n query_service.custom_queries.find_many_file_metadata_by_ids(ids: file_set.file_ids)\n else\n raise ::Valkyrie::Persistence::ObjectNotFoundError,\n \"#{file_set.internal_resource} is not a `Hydra::FileSet` implementer\"\n end\n end", "def find_files(file_set:)\n if file_set.respond_to?(:file_ids)\n return [] unless file_set.file_ids.present?\n query_service.custom_queries.find_many_file_metadata_by_ids(ids: file_set.file_ids)\n else\n raise ::Valkyrie::Persistence::ObjectNotFoundError,\n \"#{file_set.internal_resource} is not a `Hydra::FileSet` implementer\"\n end\n end", "def path2instances(request, *paths)\n filesets = paths.collect do |path|\n # Filesets support indirector requests as an options collection\n Puppet::FileServing::Fileset.new(path, request)\n end\n\n Puppet::FileServing::Fileset.merge(*filesets).collect do |file, base_path|\n path2instance(request, base_path, :relative_path => file)\n end\n end", "def load_workset( filename )\n\n md_filename = ''\n asset_files = []\n File.open( filename, 'r').each do |line|\n if /^metadata : /.match( line )\n md_filename = /^metadata : (.*)$/.match( line ).captures[ 0 ]\n end\n\n if /^asset : /.match( line )\n asset_files << /^asset : (.*)$/.match( line ).captures[ 0 ]\n end\n end\n\n return md_filename, asset_files\n end", "def cat_files file_groups\n file_groups.each do |group|\n check_exists(group[:paths])\n # this is the Illumina recommended approach to combining these fastq files.\n # See the Casava 1.8 Users Guide for proof\n files_list = group[:paths].join(\" \")\n command = \"cat #{files_list} > #{group[:path]}\"\n execute command\n end\n end", "def file_set\n @file_set ||= begin\n member_id = resource_decorator.thumbnail_id.try(:first)\n return nil unless member_id\n members = resource_decorator.geo_members.select { |m| m.id == member_id }\n members.first.decorate unless members.empty?\n end\n end", "def generate_data_files\n files = {}\n\n # extracted data\n @classes.each do |category|\n files[category] = {}\n folder = File.join(@res, 'data', category.to_s, 'extracted')\n\n files[category][:extracted] = File.join(folder, \"#{category}.json\")\n end\n\n # divided data\n @classes.each do |category|\n files[category][:divided] = {}\n folder = File.join(@res, 'data', category.to_s, 'divided')\n\n @subsets.each do |subset|\n files[category][:divided][subset] = File.join(folder,\n \"#{category}_#{subset}.json\")\n end\n end\n\n # preprocessed data\n @classes.each do |category|\n files[category][:preprocessed] = {}\n\n @preproc.each do |preprocess|\n folder = File.join(\n @res, 'data', category.to_s, 'preprocessed', preprocess.to_s)\n\n files[category][:preprocessed][preprocess] = {}\n\n @subsets.each do |subset|\n files[category][:preprocessed][preprocess][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n\n # transformed data\n if @trans.size > 0\n @classes.each do |category|\n files[category][:transformed] = {}\n\n @trans.each do |transformation|\n @preproc.each do |preprocess|\n ctrans = :\"#{transformation}_#{preprocess}\"\n\n folder = File.join(\n @res, 'data', category.to_s, 'transformed', ctrans.to_s)\n\n files[category][:transformed][ctrans] = {}\n\n @subsets.each do |subset|\n files[category][:transformed][ctrans][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n end\n end\n\n # classified data\n if @classifs.size > 0\n @classes.each do |category|\n files[category][:classified] = {}\n\n @classifs.each do |classifier|\n @trans.each do |transformation|\n @preproc.each do |preprocess|\n ctrans = :\"#{classifier}_#{transformation}_#{preprocess}\"\n\n folder = File.join(\n @res, 'data', category.to_s, 'classified', ctrans.to_s)\n\n files[category][:classified][ctrans] = {}\n\n @subsets.each do |subset|\n files[category][:classified][ctrans][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n end\n end\n end\n files\n end", "def generate(site)\n return unless site.config['mini_magick']\n\n site.config['mini_magick'].each_pair do |name, preset|\n \n Dir.chdir preset['source'] do\n if preset['recursive'] == false \n #false\n root = '.'\n else\n #true or nil\n root = '**'\n end\n\n puts 'Add images for later processing:'\n puts Dir.pwd\n Dir.glob(File.join(root, \"*.{png,jpg,jpeg,gif,PNG,JPG,JPEG,GIF}\")) do |source|\n puts ' ' + source\n site.static_files << GeneratedImageFile.new(site, site.source, preset['destination'], source, preset.clone)\n end\n end\n end\n end", "def create_from_files_in(base, klass)\n all_files_in(base).map do |base_filename, (meta_ext, content_ext)|\n # Get filenames\n meta_filename = meta_ext ? base_filename + '.' + meta_ext : nil\n content_filename = content_ext ? base_filename + '.' + content_ext : nil\n\n # Get meta and content\n meta = (meta_filename ? YAML.load_file(meta_filename) : nil) || {}\n content = (content_filename ? File.read(content_filename) : nil) || ''\n\n # Get attributes\n attributes = {}\n attributes[:file] = Nanoc3::Extra::FileProxy.new(content_filename) if content_filename\n attributes[:extension] = File.extname(content_filename)[1..-1] if content_filename\n attributes.merge!(meta)\n\n # Get identifier\n if meta_filename\n identifier = identifier_for_filename(meta_filename[(base.length+1)..-1])\n elsif content_filename\n identifier = identifier_for_filename(content_filename[(base.length+1)..-1])\n else\n raise RuntimeError, \"meta_filename and content_filename are both nil\"\n end\n\n # Get modification times\n meta_mtime = meta_filename ? File.stat(meta_filename).mtime : nil\n content_mtime = content_filename ? File.stat(content_filename).mtime : nil\n if meta_mtime && content_mtime\n mtime = meta_mtime > content_mtime ? meta_mtime : content_mtime\n elsif meta_mtime\n mtime = meta_mtime\n elsif content_mtime\n mtime = content_mtime\n else\n raise RuntimeError, \"meta_mtime and content_mtime are both nil\"\n end\n\n # Create layout object\n klass.new(content, attributes, identifier, mtime)\n end\n end", "def get_files_to_upload(file_dir, dom)\n @log.info 'Figuring out which files to upload'\n\n uploaded_files = []\n\n # xpath variables\n premis_ns = { 'premis' => 'http://www.loc.gov/standards/premis' }\n mets_ns = { 'mets' => 'http://www.loc.gov/METS/' }\n checksum_xpath = 'premis:objectCharacteristics/premis:fixity/premis:messageDigest'\n original_name_xpath = 'premis:originalName'\n\n # loop over the files listed in the METS\n file_md5_list = dom.xpath('//premis:object', premis_ns)\n file_md5_list.each do |fptr|\n # file location info\n file_checksum = fptr.at_xpath(checksum_xpath, premis_ns).inner_html\n flocat_xpath = \"//mets:file[@CHECKSUM='\" + file_checksum + \"']/mets:FLocat\"\n file_location = dom.at_xpath(flocat_xpath, mets_ns)\n\n # the name of the file in the aip package and its original name\n aip_filename = file_location.attr('xlink:href')\n orig_filename = fptr.at_xpath(original_name_xpath, premis_ns).inner_html\n\n # type of file\n file_type = file_location.parent.parent.attr('USE')\n\n case file_type\n when 'THUMBNAIL'\n if @config['include_thumbnail']\n uploaded_file = upload_file(file_dir, orig_filename, aip_filename, 'thumbnail')\n uploaded_files.push(uploaded_file) unless uploaded_file.nil?\n end\n when 'ORIGINAL'\n uploaded_file = upload_file(file_dir, orig_filename, aip_filename, 'bitstream')\n uploaded_files.push(uploaded_file) unless uploaded_file.nil?\n end\n end\n\n uploaded_files\nend", "def files\n file_sets.map{|fs| fs.files }.flatten\n end", "def add_fileset(doc, lib_id, fileset_id, dir, includes)\n library = REXML::Element.new('library', doc)\n library.add_attribute('id', lib_id)\n fileset = REXML::Element.new('fileset', library)\n fileset.add_attribute('id', fileset_id)\n fileset.add_attribute('dir', dir)\n fileset.add_attribute('includes', includes)\n end", "def prepare_files\n return if temp_files.blank?\n\n restrict_to_single_file! if pagefile?\n\n temp_files.each do |file|\n files.build(\n site: blockable.site,\n dimensions: tag.try(:dimensions),\n file: file\n )\n end\n end", "def populate_list_of_files_from_file(file_list, entry)\n logger.debug \"\\\"#{entry}\\\" is a file. Processing...\"\n file_list << entry\n # Find images if any\n Find.find(File.dirname(entry)) do |file|\n file_list << file if (File.file?(file) && is_image?(file))\n end\n end", "def add_fileset\n\n # grab the parameters\n work_id = params[:work]\n file_id = params[:file]\n label = params[:label]\n\n # validate them\n if work_id.blank? == false && file_id.blank? == false && label.blank? == false\n work = get_the_work( work_id )\n if work.nil? == false\n filename = APIV1FilesetsController.cache_contents( file_id )\n if filename.blank? == false\n fileset = ::FileSet.new\n fileset.title << label\n file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, @api_user )\n file_actor.create_metadata( work )\n file_actor.create_content( File.open( filename ) )\n fileset.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n fileset.save!\n\n # audit the information\n #audit_log( \"File #{label} for work id #{work_id} (#{work.identifier}) added by #{User.cid_from_email( @api_user.email)}\" )\n WorkAudit.audit( work_id, User.cid_from_email( @api_user.email), \"File #{File.basename( filename )}/#{label} added\" )\n\n render_standard_response( :ok )\n else\n render_standard_response( :not_found, 'File not found' )\n end\n else\n render_standard_response( :not_found, 'Work not found' )\n end\n else\n render_standard_response( :unauthorized, 'Missing work identifier or file identifier or file label' )\n end\n\n end", "def write_meta_files\r\n @files.each do |file|\r\n template = ERB.new(\r\n File.new(File.join(@dirs[:templates],file[:template])).read,\r\n nil, \"%\")\r\n output_file = File.new(file[:path], \"w+\")\r\n output_file.write(template.result(binding))\r\n output_file.close\r\n end\r\n end", "def grouped(files); end", "def generate\n files = Dir.glob \"#{Settings[:direcotry]}#{Settings[:mask]}\"\n files.each do |f|\n if (!File.directory?(f) && !File.symlink?(f))\n puts \"processing #{f}\"\n begin \n i = Image.new f\n # this will skip anything that imagemagick doesn't like, GIGO\n rescue MiniMagick::Invalid\n puts \"#{f} is not an image, skipping\"\n next\n end\n\n if @list[i.md5]\n @list[i.md5].filename.push f\n else\n @list[i.md5] = i\n end\n end\n end\n end", "def find_thumbnail(file_set:)\n find_exactly_one_file_by_use(\n file_set: file_set,\n use: Hyrax::FileMetadata::Use::THUMBNAIL\n )\n end", "def file_sets\n @file_sets ||= begin\n geo_concern.geo_file_set_presenters\n end\n end", "def file_sets\n @iss_file.file_sets.select {|fs| fs.components.include? name }\n end", "def replace_image_files(file, collection)\n FileUtils.mkpath(::File.join(file.tmp_dir, Images::IMAGE_DIR_NAME))\n \n collection.each do |name, path|\n file.update(name) do |content|\n content.replace ::File.read(path)\n end\n end\n file.update('META-INF/manifest.xml') do |manifest_file|\n txt = Nokogiri::XML(manifest_file)\n manifest_node = txt.xpath('manifest:manifest').first()\n collection.each do |name, _|\n file_text = '<manifest:file-entry manifest:full-path=\"' << name << '\"/>'\n manifest_node.add_child file_text\n end\n manifest_file.replace txt.to_s\n end\n end", "def file_set\n @file_set ||= ::FileSet.find(id)\n end", "def file_set\n @file_set ||= begin\n representative_id = geo_work.solr_document.representative_id\n file_set_id = [representative_id]\n geo_work.member_presenters(file_set_id).first\n end\n end", "def output_files\n @output_files ||= Fileset.new()\n end", "def collection_dir(*files); end", "def set_thumbnail\n dir_name = File.dirname(@path)\n\n if File.exists?(dir_name + '/thumbnails/' + @file_name)\n @thumbnail = dir_name + '/thumbnails/' + @file_name\n @relative_thumbnail_path = @thumbnail.sub(Home::CONTENT_ROOT_DIRECTORY_REGEXP, '')\n else\n @thumbnail = @path\n @relative_thumbnail_path = @relative_path\n end\n end", "def thumbnails\n\n @thumbnails ||= ThumbnailSet.new(self, {\n :small => { :dimensions => { :width => '40', \n :height => '40' }, :crop => true },\n :medium => { :dimensions => { :width => '150',\n :height => '150' }},\n :large => { :dimensions => { :width => '800',\n :height => '800'}, :format => :jpg }\n })\n\n end", "def output_files\n @output_files ||= Fileset.new\n end", "def output_files\n @output_files ||= Fileset.new\n end", "def create_collection\n Dir.mkdir @src_path\n end", "def create_uploads(dirs)\n u = UploadImage.new\n dirs.map do |dir|\n UploadInspection.new(\"./inspections/\"+dir, u)\n end\n end", "def files_for(klass); end", "def create_file_set(import_url: nil, label: nil)\n file_set = FileSet.new(import_url: import_url, label: label)\n\n file_set.apply_depositor_metadata(user)\n now = CurationConcerns::TimeService.time_in_utc\n file_set.date_uploaded = now\n file_set.date_modified = now\n file_set.creator = [user.user_key]\n\n visibility_params = {\n visbility: work.visibility,\n embargo_release_date: work.embargo_release_date,\n lease_expiration_date: work.lease_expiration_date\n }.compact\n if visibility_params.present?\n CurationConcerns::Actors::ActorStack.new(file_set, user, [CurationConcerns::Actors::InterpretVisibilityActor]).create(visibility_params)\n end\n\n # We have a weird hard to reproduce bug involving\n # NoMethodError: undefined method 'update' for nil:NilClass at\n # hydra-access-controls-10.4.0/app/models/hydra/access_control.rb:31 :in 'block in permissions_attributes=``\n #\n # Can't reproduce on demand, not sure what's going on, but hoping that maybe\n # saving the file_set _before_ trying to set permissions will be helpful.\n file_set.save!\n\n work_permissions = work.permissions.map(&:to_hash)\n if work_permissions.present?\n file_set.permissions_attributes = work_permissions\n # no additional save seems necessary after doing permissions_attributes=, seems to do it's own save of what's\n # needed...\n end\n\n return file_set\n end", "def files; end", "def files; end", "def files; end", "def files; end", "def files; end", "def files; end", "def prepare_config_files\n #Create .config dir\n #Create tucotuco dir\n #Create short dir\n #Create info file\n end", "def initialize(groupdir)\n groupdir = Pathname.new(groupdir)\n if not groupdir.directory?\n groupdir.exist? and raise ArgumentError, \"#{groupdir} non-existent\"\n groupdir.mkdir\n end\n @groupdir = groupdir.to_s\n @filesets = {}\n\n # Scan the groupdir and load all the FileSet objects it finds in\n # there (will recurse into subdirs).\n Find.find(@groupdir) do |f|\n if File.file?(f)\n HDB.verbose and print \"Loading FileSet #{f}... \"\n STDOUT.flush # to print to screen while we read\n fs = FileSet.new().read!(f)\n HDB.verbose and puts \"label=#{fs.label} #files=#{fs.files.length}\"\n # TODO: Print the label of each fileset after we read it.\n f[@groupdir + File::SEPARATOR] = ''\n HDB.debug and puts \"Normalized name as #{f}\"\n @filesets[f] = fs\n end\n end\n end", "def set_files(input = \"./sample1.txt\",output = './dest1.txt')\n @input_file = input\n @output_file = output\n @extract = load_file(@input_file,PATTERNS)\n end", "def bilder(type)\n Dir[\"output/bilder/#{type}/*.*\"].map do |bild|\n \"<a class='fancybox' rel='#{type}' href='/bilder/#{type}/#{File.basename(bild)}'><img src='/bilder/#{type}/thumbs/#{File.basename(bild)}' alt='' /></a>\"\n end.join(\"\")\nend", "def find_thumbnail(file_set:)\n if file_set.respond_to?(:thumbnail_id)\n raise ::Valkyrie::Persistence::ObjectNotFoundError, \"File set's thumbnail is blank\" if file_set.thumbnail_id.blank?\n query_service.custom_queries.find_file_metadata_by(id: file_set.thumbnail_id)\n else\n raise ::Valkyrie::Persistence::ObjectNotFoundError,\n \"#{file_set.internal_resource} is not a `Hydra::FileSet` implementer\"\n end\n end", "def files_set\n if settings.fs_created + 12 < Time.now\n settings.fs = FuzzySet.new(repo.files)\n settings.fs_created = Time.now\n end\n settings.fs\n end", "def file_set(file_expression='lib/**/*.rb', label=:default)\n log \"file sets before: #{@file_sets}\"\n log \"file set label #{label}\"\n new_style = Style.new\n\n yield new_style if block_given?\n\n @file_sets[label] = FileSet.new(file_expression, new_style)\n log \"file sets after: #{@file_sets}\"\n end", "def generate(site)\n return unless site.config['mini_magick'] && site.config['mini_magick_enabled']\n versions = site.config['mini_magick']['versions']\n\n site.config['mini_magick']['galleries'].each do |gallery|\n path = \"/Users/adam/code/blogs/adamfortuna.com-images/images/galleries/#{gallery}\"\n\n # Loop through all images in this gallery\n Dir.glob(File.join(path, \"*.{png,jpg,jpeg,gif,JPG}\")) do |source|\n versions.each_pair do |version, options|\n settings = options.clone\n settings['source'] = path\n settings['destination'] = File.join(path, version)\n\n if site.config['mini_magick_regererate'] || !File.exists?(File.join(path, version, File.basename(source)))\n site.static_files << GeneratedImageFile.new(site, path, settings['destination'], File.basename(source), settings)\n end\n end\n end\n end\n end", "def attach_files(files)\n files = [files] unless(files.is_a?(Array))\n files.each do |file|\n file.to_options!\n filename = file[:url]\n assit(filename)\n options = file[:options] || {}\n # BEGIN BY RIK\n talia_file = TaliaFile.new\n talia_file.assign_random_id\n talia_file[N::RDFS.label] << File.basename(filename)\n records = TaliaCore::DataTypes::FileRecord.create_from_url(filename, options)\n records.each do |rec|\n talia_file.data_records << rec\n end\n talia_file[N::TALIA.isFileOf] = self\n self[N::TALIA.hasFile] << talia_file\n # talia_file.save!\n # END BY RIK\n end\n end", "def generate_images\n Docsplit.extract_images(@files.to_s)\n end", "def create_collage\n # load the template\n \n \n img_path = \"#{::Rails.root.to_s}/tmp/sets/\"\n img_name = \"set_#{self.id}_#{Time.now.to_i}\"\n \n #template \n # template = Magick::Image.read(\"#{RAILS_ROOT}/public/images/set_template.png\").first\n # or blank white image\n template = Magick::Image.new(600, 480){\n self.background_color = '#ffffff'\n }\n \n template.format = 'png'\n # template.filename = img_name\n \n # go through all set items by z_index and add lay it over the template\n for item in self.set_items.order(\"z_index asc\")\n photo = Magick::Image.read(item.product.assets.first.image.url(:thumb).to_s).first\n photo = photo.scale(item.width, item.height)\n photo = photo.rotate(item.rotation)\n # composite item over template offsetting pos_x and pos_y for the template border\n template.composite!(photo, item.pos_x, item.pos_y, Magick::OverCompositeOp)\n end\n\n # create temp file \n \n tmp_image = Tempfile.new([img_name, '.png'])\n \n # write rmagick image in tempfile\n \n template.write(tmp_image.path)\n \n # save & upload with carrierwave\n \n self.blog_image = tmp_image\n \n # self.blog_image.store!(template)\n \n self.write_blog_image_identifier\n \n self.save!\n \n #File.delete(img_path + img_name)\n \n tmp_image.delete\n \n end", "def run_file_set(set)\n run_tests(config.file_sets[set], nil)\n end", "def images_for(brand, sku, type=\"jpg\")\n sku_images_path = File.expand_path(Pathname.new(@dir_path_map[brand]) + sku)\n if File.exist?(sku_images_path)\n Dir.glob(File.join(sku_images_path, \"*.#{type}\")).each do |f_path|\n #File.open(f_path)\n f_path\n end\n else\n puts \"[#{brand}] images SKU #{sku_images_path} directory not exist\"\n end\nend", "def mediafiles\n source_node.xpath('.//MediaFile').to_a.collect do |node|\n Mediafile.new(node)\n end\n end", "def make_new_file\n\t\tmetadata_file_data = \"\"\n\t\tmetadata_file_data << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?><cp:coreProperties\"\n\t\tmetadata_file_data << \" xmlns:cp=\\\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\\\" \"\n\t\tmetadata_file_data << \"xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\" xmlns:dcterms=\\\"http://purl.org/dc/terms/\\\" \"\n\t\tmetadata_file_data << \"xmlns:dcmitype=\\\"http://purl.org/dc/dcmitype/\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"\n\t\tmetadata_file_data << \"<dc:creator>#{datastore['DOCAUTHOR']}</dc:creator><cp:lastModifiedBy>#{datastore['DOCAUTHOR']}\"\n\t\tmetadata_file_data << \"</cp:lastModifiedBy><cp:revision>1</cp:revision><dcterms:created xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:created><dcterms:modified xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:modified></cp:coreProperties>\"\n\n\t\t#where to find the skeleton files required for creating an empty document\n\t\tdata_dir = File.join(Msf::Config.install_root, \"data\", \"exploits\", \"docx\")\n\n\t\t#making the actual docx\n\t\tdocx = Rex::Zip::Archive.new\n\t\t#add skeleton files\n\t\tvprint_status(\"Adding skeleton files from #{data_dir}\")\n\t\tDir[\"#{data_dir}/**/**\"].each do |file|\n\t\t\tif not File.directory?(file)\n\t\t\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t\tend\n\t\tend\n\t\t#add on-the-fly created documents\n\t\tvprint_status(\"Adding injected files\")\n\t\tdocx.add_file(\"docProps/core.xml\", metadata_file_data)\n\t\tdocx.add_file(\"word/_rels/settings.xml.rels\", @rels_file_data)\n\t\t#add the otherwise skipped \"hidden\" file\n\t\tfile = \"#{data_dir}/_rels/.rels\"\n\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t#and lets create the file\n\t\tfile_create(docx.pack)\n\tend", "def populate_files(path:)\n files = list_files(path: path)\n populated = []\n files.each do |file|\n populated << Manifests::FileEntry.new(file: { filepath: IngestUtils.relative_path(file, path) })\n end\n populated\n end", "def get_file_sets_from_cli_opts\n return if @runtime_file_list.nil? || @runtime_file_list.empty?\n\n # Only use options set for the :default file set because the user gave\n # a different set of files to measure.\n @file_sets.delete_if { |k, _| k != :default }\n\n if @file_sets.include? :default\n @file_sets[:default].file_list = @runtime_file_list\n else\n @file_sets = { default: FileSet.new(@runtime_file_list) }\n end\n end", "def find_metadata(*args)\n results = []\n @filesets.each do |volid, fileset|\n results += fileset.find_metadata(*args)\n end\n return results\n end", "def extract_files\n while file = @package_file.next_header\n if file.pathname == \"control.tar.gz\"\n control_tar_gz = Archive.read_open_memory(@package_file.read_data)\n while control_entry = control_tar_gz.next_header\n case control_entry.pathname\n when \"./control\"\n @control_file_contents = control_tar_gz.read_data\n when \"./preinst\"\n @preinst_contents = control_tar_gz.read_data\n when \"./prerm\"\n @prerm_contents = control_tar_gz.read_data\n when \"./postinst\"\n @postinst_contents = control_tar_gz.read_data\n when \"./postrm\"\n @postrm_contents = control_tar_gz.read_data\n end\n end\n end\n if file.pathname == \"data.tar.gz\"\n data_tar_gz = Archive.read_open_memory(@package_file.read_data)\n while data_entry = data_tar_gz.next_header\n # Skip dirs; they're listed with a / as the last character\n @filelist << data_entry.pathname.sub(/^\\./, \"\") unless data_entry.pathname =~ /\\/$/\n end\n end\n end\n end", "def find_thumbnail_id(file_sets)\n return if parent.thumbnail_id.present?\n file_sets.each do |file_set|\n extension = File.extname(file_set.primary_file.original_filename.first)\n return file_set.id unless no_thumbnail_extensions.include?(extension)\n end\n\n nil\n end", "def files(options = {})\n resize_images_if_needed \n files = get_children(\"file\").collect do |file| \n Dirk.new(file, { :attr_file => file.basename.to_s.gsub(file.extname, '.txt') })\n end\n \n files.sort! { |a, b| a.send(options[:sort]).to_s <=> b.send(options[:sort]).to_s } if options[:sort]\n files\n end", "def insert_new_file(files_hash, file_ingest_source, institution_pid, set_exemplary=nil)\n puts files_hash.to_s\n\n raise 'Missing insert_new_file params' if files_hash.first[:file_path].blank? || files_hash.first[:datastream].blank? || files_hash.first[:file_name].blank?\n\n production_master = files_hash.select{ |hash| hash[:datastream] == 'productionMaster' }.first\n\n if production_master[:file_name].downcase.include?('.tif')\n self.descMetadata.insert_media_type('image/tiff')\n self.descMetadata.insert_media_type('image/jpeg')\n self.descMetadata.insert_media_type('image/jp2')\n inserted_obj = self.insert_new_image_file(files_hash, institution_pid,set_exemplary)\n elsif production_master[:file_name].downcase.include?('.jp2')\n self.descMetadata.insert_media_type('image/jpeg')\n self.descMetadata.insert_media_type('image/jp2')\n inserted_obj = self.insert_new_image_file(files_hash, institution_pid,set_exemplary)\n elsif production_master[:file_name].downcase.include?('.png')\n self.descMetadata.insert_media_type('image/png')\n self.descMetadata.insert_media_type('image/jpeg')\n self.descMetadata.insert_media_type('image/jp2')\n inserted_obj = self.insert_new_image_file(files_hash, institution_pid,set_exemplary)\n elsif production_master[:file_name].downcase.include?('.mp3')\n self.descMetadata.insert_media_type('audio/mpeg')\n inserted_obj = self.insert_new_audio_file(files_hash, institution_pid)\n elsif production_master[:file_name].downcase.include?('.wav')\n self.descMetadata.insert_media_type('audio/x-wav')\n inserted_obj = self.insert_new_audio_file(files_hash, institution_pid)\n elsif production_master[:file_name].downcase.include?('.aif')\n self.descMetadata.insert_media_type('audio/x-aiff')\n inserted_obj = self.insert_new_audio_file(files_hash, institution_pid)\n elsif production_master[:file_name].downcase.include?('.pdf')\n self.descMetadata.insert_media_type('application/pdf')\n ocr_preproduction_master = files_hash.select{ |hash| hash[:datastream] == 'preProductionNegativeMaster' }.first\n=begin\n if ocr_preproduction_master.present?\n self.descMetadata.insert_media_type('application/vnd.openxmlformats-officedocument.wordprocessingml.document')\n end\n=end\n inserted_obj = self.insert_new_document_file(files_hash, institution_pid,set_exemplary)\n elsif production_master[:file_name].downcase.include?('.txt')\n self.descMetadata.insert_media_type('text/plain')\n inserted_obj = self.insert_new_document_file(files_hash, institution_pid, false)\n elsif production_master[:file_name].downcase.include?('.epub')\n self.descMetadata.insert_media_type('application/epub+zip')\n inserted_obj = self.insert_new_ereader_file(files_hash, institution_pid)\n elsif production_master[:file_name].downcase.include?('.mobi')\n self.descMetadata.insert_media_type('application/x-mobipocket-ebook')\n inserted_obj = self.insert_new_ereader_file(files_hash, institution_pid)\n elsif production_master[:file_name].downcase.include?('daisy.zip')\n self.descMetadata.insert_media_type('application/zip')\n inserted_obj = self.insert_new_ereader_file(files_hash, institution_pid)\n elsif production_master[:file_name].downcase.include?('.mov')\n self.descMetadata.insert_media_type('video/quicktime')\n inserted_obj =self.insert_new_video_file(files_hash, institution_pid,set_exemplary)\n elsif productionMaster[:file_name].downcase.include?('.avi')\n self.descMetadata.insert_media_type('video/x-msvideo')\n inserted_obj =self.insert_new_video_file(files_hash, institution_pid, set_exemplary)\n else\n self.descMetadata.insert_media_type('image/jpeg')\n self.descMetadata.insert_media_type('image/jp2')\n inserted_obj = self.insert_new_image_file(files_hash, institution_pid,set_exemplary)\n end\n\n self.workflowMetadata.item_source.ingest_origin = file_ingest_source if self.workflowMetadata.item_source.ingest_origin.blank?\n files_hash.each do |file|\n original_file_location = file[:original_file_location]\n original_file_location ||= file[:file_path]\n self.workflowMetadata.insert_file_source(original_file_location,file[:file_name],file[:datastream])\n end\n inserted_obj\n end", "def entry_files\n @entry_files = base_files @entry_path\n end", "def get_file_groups globs\n \t\t pos = 1\n \t\t file_groups = { groups: [] }\n \t\t \n globs.each do |glob|\n # e.g { group1: { path: '*.*', files: [file1, file2]} }\n group_name = \"group#{pos}\"\n files_raw = Dir.glob(glob)\n\t\t\t\tfiles = files_raw.map do |f|\n\t \tURI.escape f\n end\n file_group_object = { name: group_name, path: glob, files: files , files_raw: files_raw}\n file_groups[group_name.to_sym] = file_group_object\n file_groups[:groups].push file_group_object\n pos += 1 \n end\n file_groups\n \t\tend", "def create_page_filename_list\n\n missing, expected = [], []\n\n unless @has_mets\n\n # Without METS, there's no way to find out which files should be present, so we won't be able to figure out if something is missing.\n # We also lack knowing what order they should be in. Ah well...\n\n @datafiles.sort!\n @datafiles = @datafiles.sort_by { |x| x[/\\d+/].to_i } # sort by number\n expected += @datafiles.select { |name| name =~ /\\.tiff$|\\.tif$|\\.jp2$|\\.jp2k$|\\.jpg$|\\.jpeg$/i }\n\n else\n\n # This checks the filenames in the list @datafiles (what's in the\n # package directory, less the metadata files) against the\n # filenames declared in the METS file table of contents (a\n # structmap). While datafiles is a simple list of filenames, the\n # table of contents provies a Struct::Page with slots :title,\n # :level, :image_filename, :image_mimetype, and :valid_repeat.\n # A :valid_repeat file is ignored.\n\n @table_of_contents.pages.each do |entry|\n next if entry.valid_repeat\n expected.push entry.image_filename\n missing.push entry.image_filename if @datafiles.grep(entry.image_filename).empty?\n end\n end\n\n unexpected = @datafiles - expected\n unexpected.delete_if { |x| x =~ /^Thumbs.db$/i } # common cruft\n\n unless unexpected.empty?\n warning \"The #{pretty_class_name} #{@directory_name} has the following #{unexpected.count} unexpected #{ unexpected.length == 1 ? 'file' : 'files'} that will not be processed:\"\n warning unexpected.map { |name| \" - #{name}\" }.sort\n end\n\n ## TODO: bug here reporting an error, 'name' somehow gets nil, see FSU's package FSU_Flambeau_04301979 started 2017-08-09 14:41:39\n\n unless missing.empty?\n error \"The #{pretty_class_name} #{@directory_name} is missing the following #{missing.count} required #{ missing.length == 1 ? 'file' : 'files'} declared in the mets.xml file:\"\n error missing.map { |name| \" - #{name}\" }.sort\n return false\n end\n\n @page_filenames = expected - missing\n end", "def galleries\n galleries = []\n Dir.glob(\"#{@options.cache_dir}/*\").each do |path| \n name = path.split('/').last\n puts name\n gallery = {}\n gallery[:title] = name.gsub(/[_]/, ' ').capitalize\n puts (gallery[:path] = \"gallery/#{name}\")\n thumb = Dir.glob(\"#{path}/*/thumb.*\").first\n thumb = Dir.glob(\"#{path}/*/*.*\").first unless thumb # else take the first image.\n thumb = thumb.split('/').last\n puts (gallery[:thumb] = \"image/m/#{name}/#{thumb}\")\n galleries << gallery\n end\n galleries\n end", "def find_thumbnail_file\n map_set = MapSet.find(geo_work.id)\n image_work = map_set.thumbnail\n return unless image_work\n image_work_presenter = ImageWorkShowPresenter.new(SolrDocument.new(image_work.to_solr), nil)\n file_set_id = image_work_presenter.solr_document.representative_id\n @file_set = image_work_presenter.geo_file_set_presenters.find { |presenter| presenter.id == file_set_id }\n end", "def make_thumbnail(result, main_obj, input_obj)\n thumb_rep = nil\n input_obj['files'].each do |finfo|\n if finfo.is_a?(String)\n fname = finfo\n finfo = { 'files' => [fname] }\n else\n fname = finfo['files'].first\n raise NoFile if fname.nil?\n end\n finfo['rights'] ||= input_obj['rights']\n finfo['owner'] ||= input_obj['owner']\n finfo['bendo-item'] ||= input_obj['bendo-item']\n finfo['metadata'] ||= {\n '@context' => ROF::RdfContext\n }\n finfo['metadata']['dc:title'] ||= fname\n mimetype = MIME::Types.of(fname)\n mimetype = mimetype.empty? ? 'application/octet-stream' : mimetype.first.content_type\n f_obj = {\n 'type' => 'fobject',\n 'af-model' => 'GenericFile',\n 'pid' => finfo['pid'],\n 'bendo-item' => finfo['bendo-item'],\n 'rights' => finfo['rights'],\n 'properties' => ROF::Utility.prop_ds(finfo['owner']),\n 'properties-meta' => {\n 'mime-type' => 'text/xml'\n },\n 'rels-ext' => {\n 'isPartOf' => [main_obj['pid']]\n },\n 'content-file' => fname,\n 'content-meta' => {\n 'label' => fname,\n 'mime-type' => mimetype\n },\n 'collections' => finfo['collections'],\n 'metadata' => finfo['metadata']\n }\n f_obj.delete_if { |_k, v| v.nil? }\n if thumb_rep.nil?\n thumb_rep = f_obj['pid']\n if thumb_rep.nil?\n thumb_rep = @utility.next_label\n f_obj['pid'] = thumb_rep\n end\n main_obj['properties'] = ROF::Utility.prop_ds(input_obj['owner'], thumb_rep)\n end\n result << f_obj\n end\n result\n end", "def object_files\n @object_files = get_files(params[:id]) if controller_name == 'catalog' || controller_name == 'image_viewer'\n end", "def ingest_object(row)\n\n @touch = File.join(\"/tmp\", row[\"exportedAs\"])\n \n unless File.exists?(@touch)\n obj = File.join(@directory, File.basename(row[\"exportedAs\"].gsub('\\\\', '/')))\n sourceFile = File.join(obj,File.basename(row[\"exportedAs\"].gsub('\\\\', '/')))\n \n if File.exists?(obj)\n # Gets a new PID\n pid = Nokogiri::XML(open(@fedora_uri + \"/management/getNextPID?xml=true&namespace=#{@fedora_ns}\", {:http_basic_authentication=>[@fedora_user, @fedora_pass]})).xpath(\"//pid\").text\n \n #testing stuff\n #pid = \"druid:1\"\n \n fedora_obj = AimsDocument.new(:pid => pid)\n fedora_obj.label = File.basename(obj)\n fedora_obj.save\n print obj + \" ===> \"\n # now glob the object directory and makes datastreams for each of the files and add them as datastream to the fedora object.\n # fedora_obj.save\n \n dsid = 'rightsMetadata'\n xml_content = fedora_obj.datastreams_in_memory[dsid].content\n ds = Hydra::RightsMetadata.from_xml(xml_content)\n pid = fedora_obj.pid\n ds.pid = pid\n ds.dsid = dsid\n fedora_obj.datastreams_in_memory[dsid] = ds\n permissions = {\"group\"=>{\"public\"=>\"read\", \"archivist\" => \"edit\", \"researcher\" => \"read\", \"patron\" => 'read', \"donor\" => 'edit' }, \"person\" => {\"archivist1\" => \"edit\"}}\n ds.update_permissions(permissions)\n permissions = {\"group\" => {\"public\"=>\"read\"}}\n ds.update_permissions(permissions)\n \n fedora_obj.save\n \n Dir[\"#{obj}/**/**\"].each do |f|\n \n #damn OS X spotlight. \n unless f.include?('DS_Store')\n \n # text files and jp2000s get added as datastreams in the object. the wordperfect files get added as their own objects\n if f =~ /(.*)\\.(txt)/\n fedora_obj.add_datastream(create_file_ds(f, File.basename(f), File.basename(f)))\n \n elsif f =~ /(.*)\\.(pdf)/\n fedora_obj.add_datastream(create_file_ds(f, 'pdf', \"#{File.basename(f)}.pdf\"))\n elsif f =~ /(.*)\\.(jp2)/\n # Below is if you want to not have the jp2 imported into fedora. it will just move them to a directory.\n #jp2_dir = File.join('/tmp', fedora_obj.pid.gsub(\"druid:\", \"druid_\"))\n #FileUtils.mkdir_p(jp2_dir) unless File.directory?(jp2_dir)\n #FileUtils.cp(f, jp2_dir, :verbose => true)\n # Below this adds the jp2000s into fedora.\n fedora_obj.add_datastream(create_file_ds(f, File.basename(f), File.basename(f)))\n\t\t elsif f == sourceFile #source file gets its own fedora object. \n cpid = Nokogiri::XML(open(@fedora_uri + \"/management/getNextPID?xml=true&namespace=#{@fedora_ns}\", {:http_basic_authentication=>[@fedora_user, @fedora_pass]})).xpath(\"//pid\").text\n \n child_obj = FileAsset.new(:pid => cpid)\n child_obj.label = File.basename(f)\n dc = child_obj.datastreams['descMetadata']\n dc.extent_values << File.size(f)\n \n \n fedora_obj.add_relationship(:has_part, child_obj )\n fedora_obj.add_relationship(:has_collection_member, child_obj)\n puts \"processing:#{f} for objectID #{cpid}\"\n ext = File.extname(f)\n id = \"DS1\"\n label = File.basename(f)\n child_obj.add_datastream(create_file_ds(f, id, label ))\n child_obj.save\n print f + \"\\n\"\n else\n puts \"not a file to ingest ==> #{f}\"\n end #if\n end #unless\n end #dir\n \n dm = fedora_obj.datastreams[\"descMetadata\"]\n prop = fedora_obj.datastreams[\"properties\"]\n \n labels = row[\"labels\"].split(',')\n \n loutput = {\"subjects\" => [], \"access\" => []}\n doc_values = { \"D\" => \"Document\", \"S\" => \"Spreadsheet\", \"E\" => \"Email\", \"IM\" => \"Image\", \"V\" => \"Video\", \"SO\" => \"Sound\"} \n comp_values = {\"CM:5.25\" => \"5.25 inch. floppy diskettes\", \"CM:3.5\" => \"3.5 inch. floppy diskettes\", \"CM:P\" => \"Punch cards\", \"CM:T\" => \"Tape\" }\n access_values = {\"O\" => \"owner\", \"A\" => \"Archivists\", \"I\" => \"Invited\", \"P\" =>\"Public\", \"M\"=>\"Reading\"}\n \n \n labels.each do |l|\n if doc_values.has_key?(l)\n loutput[\"doctype\"] = doc_values[l]\n elsif comp_values.has_key?(l)\n loutput[\"mediatype\"] = comp_values[l]\n elsif access_values.has_key?(l)\n loutput[\"access\"] << access_values[l]\n elsif l.include?(\"S:\")\n loutput[\"subjects\"] << l.gsub(\"S:\", '') \n end #if\n end #do\n \n pp(loutput)\n prop.collection_values << \"Steven J. Gould\"\n prop.pages_values << number_of_pages(fedora_obj)\n prop.path_values << row['path']\n prop.file_size_values << row['size']\n prop.md5_values << row['md5']\n prop.sha1_values << row['sha1']\n prop.file_type_values << row['type']\n prop.filename_values << File.basename(obj)\n \n dm.isPartOf_values = row[\"subseries\"].gsub(/[0-9]|Bookmark:|\\./,\"\").strip\n dm.source_values << row['filename']\n dm.type_values << loutput['doctype']\n dm.format_values << loutput[\"mediatype\"]\n \n \n \n loutput['subjects'].each { |s| dm.subject_values << s.gsub(\"S:\", \"\") }\n \n dm.save\n prop.save\n fedora_obj.save\n\n solr_doc = fedora_obj.to_solr\n solr_doc << Solr::Field.new( :discover_access_group_t => \"public\" )\n ActiveFedora::SolrService.instance.conn.update(solr_doc)\n FileUtils.mkdir_p(@touch)\n end #unless\n end #if exists? \n rescue Exception => e \n puts e.backtrace\n\tputs \"erroring....\"\n sleep(300)\n return nil\n rescue Timeout::Error => e\n puts \"timeout error ....\" \n sleep(350)\n\n \n end", "def file_set\n @file_set ||= begin\n members = resource_decorator.geo_members\n members.first.decorate unless members.empty?\n end\n end", "def setup\n\n for i in 1..ROOT_FILES_X\n File.open(\"/rootfilex#{i}.txt\", 'w+').chmod(0777) #Just using random permissions aside from having world execute bit included or not\n # puts \"rootfilex#{i}.txt\"\n end\n\n for i in (ROOT_FILES_X + 1)..(ROOT_FILES + ROOT_FILES_X)\n File.open(\"/rootfile#{i}.txt\", 'w+').chmod(0660)\n # puts \"rootfile#{i}.txt\"\n end\n\n for i in 1..HIDDEN_FILES_X\n File.open(\"/.hiddenfilex#{i}\", 'w+').chmod(0555)\n # puts \".hiddenfile#{i}\"\n end\n\n for i in (HIDDEN_FILES_X + 1)..(HIDDEN_FILES + HIDDEN_FILES)\n File.open(\"/.hiddenfile#{i}\", 'w+').chmod(0442)\n # puts \".hiddenfile#{i}\"\n end\n\n make_test_dirs_with_files(\"/\", 1)\n\n end", "def create_files\n tests.each do |test|\n FileUtils.mkdir(test.id.to_s) unless Dir.exist?(test.id.to_s) if test.option[:dir]\n files = []\n files << test.action.split('?').first\n files += test.option[:implicit]\n files << test.result_rdf if test.result_rdf\n files << test.result_json if test.result_json\n files.compact.select {|f| !File.exist?(f)}.each do |f|\n File.open(f, \"w\") {|io| io.puts( f.end_with?('.json') ? \"{}\" : \"\")}\n end\n end\n end", "def get_media_per_user\n playlist_array = []\n current_user.workout_sets.each do |set|\n set.media.each do |v|\n sources_array = []\n videos_hash = {}\n sources_array << {\n src: rails_blob_path(v.video),\n type: 'video/mp4'\n }\n videos_hash[:name] = v.title\n videos_hash[:sources] = sources_array\n playlist_array << videos_hash\n end\n end\n gon.mediaSets = playlist_array\n end", "def file_set\n @file_set ||= resource_decorator.geo_members&.first\n end", "def new_files\n @new_files ||= Set.new.tap do |files|\n site.each_site_file { |item| files << item.destination(site.dest) }\n end\n end", "def setup()\n create_directories\n end", "def group_files file_data, output_path, options = {:prefix => \"L\", :suffix => \".fastq.gz\", :exclude_undetermined => true}\n\t\t\t\t# alternatively inherit the parent class and call super???? \n\t\t\t\t# super \n\t\t\t\t# \t\n groups = {}\n file_data.each do |data|\n if data[:barcode] == \"Undetermined\" and options[:exclude_undetermined]\n log \"# Undetermined sample lane: #{data[:lane]} - name: #{data[:sample_name]}. Skipping\"\n next\n end\n \n group_key = name_for_data data, options\n \n if groups.include? group_key\n if groups[group_key][:sample_name] != data[:sample_name]\n raise \"ERROR: sample names not matching #{group_key} - #{data[:path]}:#{data[:sample_name]}vs#{groups[group_key][:sample_name]}\"\n end\n if groups[group_key][:lane] != data[:lane]\n raise \"ERROR: lanes not matching #{group_key} - #{data[:path]}\"\n end\n groups[group_key][:files] << data\n else\n group_path = File.join(output_path, group_key)\n groups[group_key] = {:group_name => group_key,\n :path => group_path,\n :sample_name => data[:sample_name],\n :read => data[:read],\n :lane => data[:lane],\n :files => [data]\n }\n end\n end\n \n # sort based on read set\n groups.each do |key, group|\n group[:files] = group[:files].sort {|x,y| x[:set] <=> y[:set]}\n group[:paths] = group[:files].collect {|data| data[:path]}\n end\n groups.values\n end", "def create_output_files\n return unless @option_output_path\n return if @collected_nodes.empty?\n @collected_nodes.each do |certname, properties|\n next if properties['settings'].empty?\n output_file = \"#{@option_output_path}/nodes/#{certname}.yaml\"\n File.write(output_file, properties['settings'].to_yaml)\n output(\"## Wrote Hiera YAML file: #{output_file}\\n\\n\")\n end\n return if @common_settings.empty?\n output_file = \"#{@option_output_path}/common.yaml\"\n File.write(output_file, @common_settings.to_yaml)\n end", "def temp\n # Find all files in the system\n allFiles = Devfile.find(:all)\n \n metadatatype = MetadataType.find_by_name(\"backup_recovery_path\")\n if metadatatype == nil\n render :text => \"Metadatatype was not found\", :status => 404\n return\n end\n \n # Go through each file and add metadata to it\n allFiles.each do |x|\n metadatavalue = '/home/user/MyDocs/DCIM/'+x.name\n Metadata.find_or_create_by_metadata_type_id_and_devfile_id(:metadata_type_id => metadatatype.id,\n :value => metadatavalue,\n :devfile_id => x.id) \n end\n \n render :text => \"Metadata added to all files in the system\", :status => 201\n return\n end", "def main_files\n retrieve_files_in_main_dir\n end", "def prepare_pod_groups\n file_accessors.each do |file_accessor|\n pod_name = file_accessor.spec.name\n next unless sandbox.local?(pod_name)\n root_name = Specification.root_name(pod_name)\n path = file_accessor.root\n group = pods_project.group_for_spec(root_name)\n group.set_path(path) unless group.path == path\n end\n end", "def files_json_seed(json, entry)\n Pageflow.config.file_types.each do |file_type|\n json.set!(file_type.collection_name) do\n json.array!(entry.find_files(file_type.model)) do |file|\n json.partial!('pageflow/files/file', file: file, file_type: file_type)\n end\n end\n end\n end", "def file_set_ids\n @file_set_ids ||= Hyrax::SolrService.query(\"{!field f=has_model_ssim}FileSet\",\n rows: 10_000,\n fl: Hyrax.config.id_field,\n fq: \"{!join from=ordered_targets_ssim to=id}id:\\\"#{id}/list_source\\\"\")\n .flat_map { |x| x.fetch(Hyrax.config.id_field, []) }\n end", "def install_images(object)\n generated_name = Storage.generated_file_name(object)\n install_main_image(object.has_image_id, generated_name)\n generate_thumbnails(object.has_image_id, generated_name) if thumbnails_needed?\n return generated_name\n ensure \n @temp_file.close! if !@temp_file.closed?\n @temp_file = nil\n end" ]
[ "0.60919565", "0.6091542", "0.60529244", "0.5971123", "0.5943735", "0.5939176", "0.5922606", "0.5859848", "0.58018744", "0.5798016", "0.57485", "0.573722", "0.5709881", "0.5688754", "0.5650202", "0.564628", "0.56439203", "0.562648", "0.5622234", "0.5590091", "0.5572442", "0.5565882", "0.55553836", "0.5552899", "0.5527808", "0.55259156", "0.552233", "0.55160177", "0.5484607", "0.54796135", "0.5476835", "0.5460915", "0.5459153", "0.54487205", "0.5444503", "0.54393053", "0.54362667", "0.5406475", "0.53697616", "0.53626776", "0.536109", "0.5319914", "0.53152716", "0.5308753", "0.5308753", "0.53044325", "0.5263248", "0.52541167", "0.5241549", "0.5238263", "0.5238263", "0.5238263", "0.5238263", "0.5238263", "0.5238263", "0.522969", "0.52250636", "0.5217296", "0.5217159", "0.5206056", "0.5201917", "0.5196822", "0.51918423", "0.5190896", "0.5189677", "0.51864654", "0.5186401", "0.5185395", "0.5184301", "0.5174368", "0.5160503", "0.51554835", "0.51382834", "0.51349896", "0.5133273", "0.5122691", "0.51219517", "0.5112328", "0.51105815", "0.5103433", "0.51003796", "0.50973904", "0.5095937", "0.5088003", "0.50807613", "0.5072146", "0.5071837", "0.50657505", "0.5065695", "0.5065688", "0.5060874", "0.5043591", "0.5034914", "0.5033603", "0.50324744", "0.5030266", "0.50215423", "0.50192547", "0.50186193", "0.50185674" ]
0.5753249
10
REVIEW: may not be needed after status.py update
def get_dip_details(uuid) url = ENV['ARCHIVEMATICA_SS_URL'] conn = Faraday.new(url: url) do |faraday| faraday.request :url_encoded # form-encode POST params faraday.response :logger # log requests to STDOUT faraday.adapter Faraday.default_adapter # make requests with Net::HTTP end params = { 'username' => ENV['ARCHIVEMATICA_SS_USER'], 'api_key' => ENV['ARCHIVEMATICA_SS_API_KEY'] } response = conn.get do |req| req.url '/api/v2/file/' + uuid + '/' req.headers['Accept'] = 'application/json' req.params = params end JSON.parse(response.body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status(*) end", "def statuses; end", "def last_status; end", "def status=(status); end", "def status_message; end", "def status\n end", "def status\n end", "def status\n end", "def status\n end", "def change_status(status)\n #not implemented \n end", "def status\n super\n end", "def transform_status(status); end", "def status_effect; end", "def retrieve_status\n \n end", "def statuscmd\n end", "def status\n raise NotImplementedError\n end", "def map_status\n end", "def custom_status\n {}\n end", "def status\n original.status || nil\n end", "def status\n original.status || nil\n end", "def status_code; end", "def get_status\n\t\tstatus\n\tend", "def status(_number)\n nil\n end", "def extend_status(_status)\n end", "def status_object\n @status\n end", "def human_status\n raise NotImplementedError\n end", "def outdated; end", "def private; end", "def do_status\n return pretty_status(current_status)\n end", "def status\n @status\n end", "def status\n @status\n end", "def status\n @__status\n end", "def status\n 'unknown'\n end", "def update_status(status)\n @status = status\n @last_status_change = Time.now\n update_statusfile\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def status\n \"#{@description} #{@status}\"\n end", "def status\n inspect\n end", "def pending?; end", "def status()\n puts @status\n end", "def checkstatus()\n merge(checkstatus: 'true')\n end", "def status\n STATUSES[self.status_id]\n end", "def update_status_to_processed\n fail 'child class to implement'\n end", "def status\n raise NotImplementedError, _(\"%{class} has not implemented method %{method}\") % {class: self.class, method: __method__}\n end", "def status\n STATUSES[self.status_id || 0]\n end", "def getStatus\n call(STATUS_PATH)\n end", "def status_code(*)\n end", "def status\n ActiveSupport::StringInquirer.new(self[:status] || \"\")\n end", "def modified; status[:modified]; end", "def submodule_statuses(options = T.unsafe(nil)); end", "def submodule_statuses(options = T.unsafe(nil)); end", "def status_type_char; end", "def status_description\n self.status::DESCRIPTION\n end", "def getStatus\n @@statuses[@status]\n end", "def status\n @status\n end", "def status\n @status\n end", "def get_status\n fetch_status unless status == :completed\n status\n end", "def get_status\n fetch_status unless status == :completed\n status\n end", "def display_name\n status\n end", "def status\n @status ||= @repo.status(:unknown => true)\n end", "def unknown; status[:unknown]; end", "def refresh_status!\n update!(:status => 'new') if status.nil?\n update!(:status => 'ack') if acked?\n update!(:status => 'nack') if nacked?\n update!(:status => 'push') if pushed?\n end", "def status\n unless source.nil? or source.empty?\n refresh_status\n else\n self.description = \"Status is currently unavailable\"\n end\n self.description.first\n end", "def status\n\t\treturn @status\n\tend", "def commit_status(sha, ref)\n # implement inside child\n end", "def outdated?; end", "def status_params\n end", "def status\n info['status']\n end", "def update_status_timestamp\n self.overall_status_modified_at = Time.zone.now\n end", "def active; end", "def active; end", "def good\n @status\n end", "def status? status\n read_attribute(:status) == fetch_status_code(status)\n end", "def status\n instance_get(:status)\n end", "def status\r\n case status_id\r\n when 1; \"Sending\"\r\n when 2; \"Sent\"\r\n when 3; \"Bounced\"\r\n when 4; \"Opened\"\r\n when 5; \"Downloaded\"\r\n when 6; \"Send Failed\"\r\n else; \"Processing\"\r\n end\r\n end", "def status\n # We must provide a string version here: https://github.com/sul-dlss/dor-workflow-client/issues/169\n @status ||= WorkflowClientFactory.build.status(druid: cocina.externalIdentifier, version: cocina.version.to_s).status_code\n end", "def status\n version.status\n end", "def status\n version.status\n end", "def pending_requests; end", "def pending_requests; end", "def pending_requests; end", "def get_Status()\n \t return @outputs[\"Status\"]\n \tend", "def status\n Status.find(self.status_id).name\n end", "def status\n status_async.value!\n end", "def added; status[:added]; end", "def status_name\n STATUS[self.status_id][0]\n end", "def convert_status(old_status)\n old_status.nil? ? \"active\" : old_status\n end", "def status\n super || StatusType.active\n end", "def statuses\n statuses = {\n \"Not started\" => 1,\n \"In Progress\" => 2,\n \"Finished\" => 3\n }\n return statuses\n end", "def correctly_update_status\n\t\terrors.add(:base, 'La transaccion no fue exitosa') if self.invalid_status\n\tend", "def print_status(msg='')\n end", "def check_status_change\n if self.status_id != @current_status\n sc = StatusChange.new\n sc.submission_id = self.id\n sc.status_id = self.status_id\n sc.changed_at = @current_time\n sc.comments = status_comments\n sc.save\n #give sub a global id if approved\n if self.status.eq?('approved')\n self.guid = generate_guid(@current_time)\n end\n end\n end" ]
[ "0.7393665", "0.7393665", "0.7393665", "0.7393665", "0.7393665", "0.7393665", "0.7393665", "0.7393665", "0.7393665", "0.7347041", "0.7080498", "0.69859135", "0.6947157", "0.68530875", "0.68003523", "0.68003523", "0.68003523", "0.68003523", "0.66600287", "0.6611623", "0.6526449", "0.64914405", "0.64901626", "0.6480405", "0.64574724", "0.6443581", "0.6389085", "0.63641536", "0.63641536", "0.63134855", "0.63055223", "0.6275691", "0.6258126", "0.6230649", "0.6214866", "0.6210076", "0.6207525", "0.61190283", "0.6111358", "0.6111358", "0.61052245", "0.6063896", "0.6035141", "0.60274416", "0.60274416", "0.6009692", "0.6008721", "0.6005095", "0.60029763", "0.5997737", "0.59975666", "0.59758", "0.5968434", "0.59591246", "0.59525603", "0.5944009", "0.59433377", "0.5942183", "0.59411013", "0.59411013", "0.59305745", "0.5922291", "0.59203696", "0.59087574", "0.59087574", "0.5895182", "0.5895182", "0.588812", "0.5879637", "0.5873968", "0.58732986", "0.5853007", "0.5844303", "0.5842563", "0.58397186", "0.583182", "0.5827984", "0.5826889", "0.58195233", "0.58195233", "0.5809648", "0.5806106", "0.58030707", "0.5801965", "0.57989395", "0.5798445", "0.5798445", "0.5796292", "0.5796292", "0.5796292", "0.57896644", "0.57825553", "0.57757396", "0.5775386", "0.5767978", "0.5767342", "0.5763083", "0.5757443", "0.57569253", "0.57533956", "0.575319" ]
0.0
-1
Return a has of aip_uuids where dip creation has been approved but the dip has yet to be uploaded
def waiting_for_dips q = 'dip_status_tesim:APPROVED' dips = {} num_results = get_number_of_results(q) unless num_results == 0 solr_query_short(q, 'id,aip_uuid_tesim', num_results)['docs'].each do | aip | dips[aip['id']] = aip['aip_uuid_tesim'].first end end dips end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pending_invoices\n database.select { |id, invoice| !invoice.successful? }\n end", "def not_approved?\n status_map = employee_vacation_responses.map(&:status).uniq\n status_map.size == 1 && status_map.include?(\"not_approved\")\n end", "def no_appts_avail?\n appointments.empty?\n end", "def approved_purchase_requests\n PurchaseRequest.find(:all,:conditions => {\n :purchase_requester_id => self.id ,\n :is_purchase_order_created => true \n })\n end", "def any_requested_booking_not_confirmed?\n count = 0\n index\n @requested_bookings.each do |booking|\n count += 1 if !booking.confirmed\n end\n true if count.positive?\n end", "def awaiting_admin_events\n candidate_events.select(&:awaiting_admin?)\n end", "def any_requested_booking_confirmed_not_completed?\n count = 0\n index\n @requested_bookings.each do |booking|\n count += 1 if booking.confirmed && !booking.completed\n end\n true if count.positive?\n end", "def existing_reservations?\n !existing_reservations.empty?\n end", "def verificaciones_approved\n return false unless self.verificaciones_valid?\n self.verificaciones_valid.collect { |i|\n i if i['resultado'] != 'RECHAZO'\n }.compact \n end", "def approval\n @appointments = Appointment.in_clinic(@admin).requests.\n order_by_time.includes(:doctor, :patient).not_past\n end", "def approvable_users\n @approvable_users ||= (controllable_users + editable_request_applicants + controllable_users.map{|uu|uu.editable_request_applicants}).flatten.uniq\n end", "def approved?\n status_map = employee_vacation_responses.map(&:status).uniq\n status_map.size == 1 && status_map.include?(\"approved\")\n end", "def alreadyReviewed\n ip = request.remote_ip\n ret = {}\n ret[:ip] = ip\n prof_id = params[:review][:prof_id] if params[:review]!=nil\n prof_id = params[:prof_id][\"0\"] if prof_id==nil and params[:prof_id]!=nil\n prof_id = params[:id] if params[:id]!= nil and prof_id==nil\n if Review.where(:prof_id=>prof_id).where(:ip=>ip).any?\n # Ip exists\n ret[:exist] = true\n else\n # Ip does not exist in db with this prof_id\n ret[:exist] = false\n end\n return ret\n end", "def plan_ids_with_unviewed\r\n\r\n #MES- Select plan IDs for plans that are on our calendar,\r\n # that are taking place in the future, that we've accepted,\r\n # and that have relevant changes that took place AFTER we\r\n # viewed the plan\r\n sql = <<-END_OF_STRING\r\n SELECT\r\n plans.id AS id, count(*) as count\r\n FROM\r\n plans, planners_plans, plan_changes\r\n WHERE\r\n plans.id = planners_plans.plan_id AND\r\n planners_plans.planner_id = ? AND\r\n planners_plans.cal_pln_status IN (?) AND\r\n plans.fuzzy_start > UTC_TIMESTAMP() AND\r\n plan_changes.plan_id = planners_plans.plan_id AND\r\n (\r\n plan_changes.change_type IN (?) OR\r\n (plan_changes.change_type = ? AND plan_changes.comment IS NOT NULL)\r\n ) AND\r\n ((plan_changes.updated_at > planners_plans.viewed_at) OR planners_plans.viewed_at IS NULL) AND\r\n plan_changes.owner_id != ?\r\n GROUP BY plans.id\r\n END_OF_STRING\r\n\r\n res = {}\r\n rows = perform_select_all_sql([sql, self.id, Plan::STATUSES_ACCEPTED, PlanChange::CHANGE_TYPES_COMMENTS_AND_CHANGES, PlanChange::CHANGE_TYPE_RSVP, self.user_id])\r\n rows.each do | row |\r\n res[row['id'].to_i] = row['count'].to_i\r\n end\r\n return res\r\n end", "def complete?\n statuses = appointments.pluck(:type)\n statuses.uniq!\n statuses_to_check = %w[\n InProgessAppointment\n OpenAppointment\n ScheduledAppointment\n ]\n\n if (statuses_to_check & statuses).any?\n false\n else\n true\n end\n end", "def overlapping_approved_requests\n overlapping_requests.where(status: \"APPROVED\")\n end", "def can_show_invite_volunteer?\n last_invited_volunteer? ? false : ((PublicActivity::Activity.group('DATE_TRUNC(\\'day\\', created_at)').where(owner_id: id, created_at: 4.days.ago.beginning_of_day..Time.current).count.keys + contents.where(created_at: 4.days.ago.beginning_of_day..Time.current).group('DATE_TRUNC(\\'day\\', created_at)').count.keys).uniq.count == 4)\n end", "def unassigned_approvers_for_contract(contract)\n\n # todo: shouldnt have to use select here... theres a better way\n user_ids = contract.approver_users.map {|user| user.id}\n self.approver_users.select {|user| !user_ids.include?(user.id)}\n\n end", "def financial_aid_approved?\n !financial_aid_approved_at.blank?\n end", "def timetable_activated \n wts=Weeklytimetable.find(:all, :conditions =>['is_submitted is true and hod_approved is true'], :select => 'format1, format2')\n activated=Array.new\n wts.each{|x|activated << x.format1 << x.format2}\n if activated.uniq.include?(id)\n return true\n else\n return false\n end\n end", "def frauded\n Event.click.one_day.where('id != ? AND (ip = ? or uniqueuser = ?)', self.id, self.ip, self.uniqueuser)\n end", "def dangling?\n shares.count < 1 && invitations.active.count < 1\n end", "def events_that_are_available_to_me\nevents_i_can_see = []\nevents_i_can_see = events_i_can_see + self.events_friends_attending.pluck(:id)\nevents_i_can_see = events_i_can_see + self.events_friends_created.pluck(:id)\nreturn Event.where(:id => events_i_can_see)\nend", "def is_approved?\n (self.approved_feeds.count > 0) && ((self.pending_feeds.count + self.denied_feeds.count) == 0)\n end", "def eligible_appeals\n active_fully_compensation_appeals.select(&:eligible_for_ramp?)\n end", "def not_scheduled_applications\n accepted_applications.select do |a|\n been_in_stage_for(a, 7.days.ago)\n end\n end", "def list_existing_apts\n a = self.apts.map {|apt| apt.a_name}\n return \"(Already-existing apts: {#{a.join(\", \")}})\"\n end", "def ids_to_accept\n git_log_delivered_story_ids & pivotal_tracker_delivered_story_ids\n end", "def is_working?\n !self.aircraft_unavailabilities.where('? BETWEEN start_at AND end_at', DateTime.now).any?\n end", "def valid\n available.where(:generation.ne => nil).to_a\n end", "def inactive_approvers\n recently_promoted_approvers = UserFeedback.where(\"created_at >= ?\", APPROVAL_PERIOD.ago).where_like(:body, \"*You gained the ability to approve posts*\").pluck(:user_id) # XXX remove in two months\n recently_promoted_approvers += UserFeedback.where(\"created_at >= ?\", APPROVAL_PERIOD.ago).where_like(:body, \"*You have been promoted to an Approver*\").pluck(:user_id)\n\n approvers = User.where(level: User::Levels::APPROVER).where.not(id: recently_promoted_approvers)\n approvers.select do |approver|\n approver.post_approvals.where(\"created_at >= ?\", APPROVAL_PERIOD.ago).count < MINIMUM_APPROVALS\n end\n end", "def unidentified?\n @unidentified ||= ids.values.all?(&:blank?)\n end", "def dean_approved?\n !approved_at.blank?\n end", "def claimed_chore?\n tasks.where(completion_status: \"pending\").count > 0\n end", "def approved?\n !approved_on.nil?\n end", "def invoices_all_paid?\n self.invoices.pluck(:paid_at).map {|i| not i.nil?}.reduce(:&)\n end", "def any_approved_loans?\n Applicant.where(email: @email, recommendation: Applicant::recommendations[:approve]).exists?\n end", "def responded_with_availability?\n !interview_availabilities.empty?\n end", "def not_pending\n if user.incoming_friend_requests.pluck(:user_id).include?(friend_id)\n errors.add(:friend, 'already requested friendship')\n end\n end", "def deletable?\n return pallets.includes(:reservations).all.all? do |pallet|\n (customer.last_count.nil? or pallet.arrived_at > customer.last_count) and pallet.reservations.empty?\n end\n end", "def friend_requests\n FriendRequest.all.select do |req|\n req.to_user_id == self.id && req.pending\n end\n end", "def approved?\n return @approved unless @approved.nil?\n\n approving_users = self.approvals.map { |a| a.approved_by }\n\n unsatisfied = owners_contents.select do |owners|\n (owners & approving_users).empty?\n end\n\n @approved = unsatisfied.empty?\n @approved\n end", "def alert_already_exists?\n BlockedEditsAlert.where('created_at >= ?', 8.hours.ago).exists?\n end", "def has_an_approved_account_set?\n all_monetary_processor_accounts.was_verified.any?\n end", "def appointment_unique_with_doctor_in_clinic\n times_taken = []\n begin\n self.doctor.appointments.confirmed.each do |appt|\n unless appt.id == self.id\n times_taken << appt.appointment_time\n end\n end\n rescue NoMethodError\n errors.add(:doctor_id, 'No doctor specified')\n end\n errors.add(:appointment_time, \"Time not available\") if times_taken.include?(appointment_time)\n end", "def missed_appointments\n appointments = Observation.joins(:encounter)\n .merge(appointment_encounters)\n .where.not(person_id: referral_patients.select(:person_id))\n .where(concept: ConceptName.where(name: 'Appointment date').select(:concept_id))\n .where('value_datetime BETWEEN ? AND ? AND encounter.program_id = ?',\n @start_date.strftime('%Y-%m-%d 00:00:00'),\n @end_date.strftime('%Y-%m-%d 23:59:59'), 1)\n .group(:person_id)\n\n appointments.each_with_object([]) do |appointment, patients|\n patient = missed_appointment?(appointment)\n\n patients << patient unless patient.blank?\n end\n end", "def get_done_requests\n r = Request.where(:assigned => self , :done => true).to_a\n return r\n end", "def validate_airdrop_done\n\n client_chain_interactions = CriticalChainInteractionLog.of_activity_type(GlobalConstant::CriticalChainInteractions.\n airdrop_users_activity_type).where(client_id: @client_id).group_by(&:status)\n\n # No requests present\n return success if client_chain_interactions.blank?\n\n # Pending requests present then send error\n return error_with_data(\n 'e_adu_3',\n 'pending_grant_requests',\n GlobalConstant::ErrorAction.default\n ) if (client_chain_interactions.keys & [GlobalConstant::CriticalChainInteractions.queued_status,\n GlobalConstant::CriticalChainInteractions.pending_status]).present?\n\n # TODO: Do we have to apply any other checks\n\n success\n\n end", "def pending_accept\n received_requests.where(confirmed: nil)\n end", "def viewable_users\n @viewable_users ||= (controllable_users + request_applicants + controllable_users.map{|uu|uu.request_applicants}).flatten.uniq\n end", "def awaiting_candidate_events\n candidate_events.select(&:awaiting_candidate?)\n end", "def get_pending_requests\n r = Request.where(:assigned => self , :done => false).to_a\n return r\n end", "def used?\n !InterviewerUser.joins(:candidates_interviews).where(:interviewer_users => {:interviewer_id => id}).empty?\n end", "def new_activity_check(account_id)\n users = Account.find(account_id).users\n ids = []\n users.each do |user|\n ids.push(user.id)\n end\n\n last_activity = self.activities.where(:activity.ne => \"exchange_agreement.viewed\").order_by(:created_at, :desc).first\n if ids.include?( last_activity.user_id )\n return false\n end\n return last_activity\n end", "def users_with_pending_input\n users_with_pending_days = []\n self.users.each do |user|\n users_with_pending_days << user if user.pending_input?\n end\n users_with_pending_days\n end", "def account_used\n\n\t\tif Booking.where(location_id: Location.where(company_id: self.id).pluck(:id)).where('created_at > ?', DateTime.now - 1.weeks).count > 0\n\t\t\treturn true\n\t\tend\n\n\t\treturn false\n\n\tend", "def has_appt?\n !appt_date.blank?\n end", "def collect_eligible(items)\n items.select{|item| eligible?(item) }\n end", "def visible_request_ids_for_approver\n visible_states = [ApprovalStates::NOTIFIED_STATE, ApprovalStates::COMPLETED_STATE]\n Request.where(:workflow_id => workflow_ids, :state => visible_states).pluck(:id)\n end", "def found_and_pending?\n findings.any? { |f| f.state == \"pending\" }\n end", "def aircraft_ready_for_frontend?(aircraft)\n @aircraft_images_count[aircraft.id].present? and @aircraft_images_count[aircraft.id] > 0 and aircraft.admin_verified?\n end", "def is_appointments_not_empty\n\t\tAppointment.all.present? \n\tend", "def patients_in_ipp_and_greater\n Patient.find(gather_patient_ids).keep_if do |p|\n p.patient_relevant?(measures.pluck(:_id), ['IPP'])\n end.pluck(:_id)\n end", "def check_station_visibility\n station.update(hidden: station.access_control_gates.where.not(id: id).pluck(:hidden).push(hidden).uniq.all?) if hidden_changed?\n end", "def friendships_pending\n friendships_pending = []\n friendships.where(confirmed: false).each { |fs| friendships_pending << User.find(fs.friend_id) }\n friendships_pending\n end", "def any_received_booking_confirmed_not_completed?\n count = 0\n index\n @received_bookings.each do |booking|\n count += 1 if booking.confirmed && !booking.completed\n end\n true if count.positive?\n end", "def approver_id_list(resource)\n visible_request_ids = visible_request_ids_for_approver\n Rails.logger.debug { \"Final accessible request ids: #{visible_request_ids}\" }\n\n case resource\n when \"requests\"\n visible_request_ids\n when \"actions\"\n Action.where(:request_id => visible_request_ids).pluck(:id).sort\n else\n raise ArgumentError, \"Unknown resource type: #{resource}\"\n end\n end", "def filter_by_accepting_proposals(collection)\n collection.where(\"request_for_proposals.state = ?\", 'pending')\n end", "def ip_exist?\n return false if current_resource.addresses.nil?\n current_resource.addresses.include?(new_resource.address)\n end", "def eligible_owners\n User.where('users.id != ?', @cookbook.user_id)\n end", "def abandoned?\n status == Game::ABANDONED && abandoned_at.present?\n end", "def approved?\n !pending\n end", "def check_uniqueness \n has_visits = pat.visits.where(doc_id: OWNER_DOC_ID).order(entry_ts: :desc).first.entry_ts.today? rescue nil #where('date(entry_ts)=?', self.entry_ts.to_date)\n errors.add(:reason, \"Only 1 visit is allowed by OHIP per patient per day\") if has_visits\n end", "def approved_flights\n pireps.approved\n end", "def candidates_applied\n users.where('users.status <> :s', s: USER_STATUS_DELETED)\n end", "def is_pending?\n generated_at.nil? && !paid_on.nil?\n end", "def pending_acceptance\n inverse_friendships.map(&:user_id) - friendships.map(&:friend_id)\n end", "def approved?\n !self.pending\n end", "def pending_edits\n \tself.edits.where(:is_approved => nil)\n end", "def action_pad_and_link_blocking(activity)\n if activity.class.to_s == \"MatterTask\" || activity.assigned_to_user_id==get_employee_user_id\n return [true,true,true]\n else\n if activity.mark_as==\"PUB\"\n return [true,true,true]\n else\n return [false,false,false]\n end\n end\n end", "def candidates_forwarded_or_rejected\n users.where('users.status <> :us AND user_campaigns.status in (:cs)', us: USER_STATUS_DELETED, cs: [USER_CAMPAIGN_STATUS_FORWARDED, USER_CAMPAIGN_STATUS_REJECTED])\n end", "def is_false_duplicate?\n payment_complete? && has_completed_duplicates?\n end", "def check_if_approval_is_required\n check_by_families || check_by_supplier || check_by_project ||\n check_by_office || check_by_company || check_by_zone\n end", "def get_incomplete\n @task_list.select { |task| task.status == \"incomplete\" }\n end", "def include_unrevealed?\n options[:collection_ids].present? || collected?\n end", "def not_delivered\n PeriodDocument.scanned.where(\"scanned_at >= ?\", 30.days.ago).select do |scan|\n result = false\n\n temp_pack = TempPack.where(name: scan.name).first\n\n if temp_pack\n # NOTE minus 10 days because PPP delivers a few days before entering the information inside iDocus\n result = temp_pack.temp_documents.scan.where(\"created_at >= ?\", scan.scanned_at-10.days).empty?\n else\n result = true\n end\n\n print (result ? '!' : '.')\n\n result\n end.map(&:name)\n end", "def checked_out?\n !reservations.find(:all, :conditions => [\"status = ? OR status = ?\", 'late', 'checked_out']).empty?\n end", "def attendTest_no_show_imaging(patient)\n yield [] if @state[IAPPOINTMENTREQUESTED].any? {|terms| terms.size == 2 and terms[0] == patient and state(PATIENT, patient) and state(RADIOLOGIST, terms[1]) and not state(IAPPOINTMENTKEPT, patient, terms[1])}\nend", "def approved?\n activated_at || activation_code\n end", "def any_requested_booking_completed?\n count = 0\n index\n @requested_bookings.each { |booking| count += 1 if booking.completed }\n true if count.positive?\n end", "def verificaciones_valid\n return false unless self.verificaciones?\n self.verificaciones.collect { |i|\n i if i['cancelado'] == 'NO'\n }.compact\n end", "def onsite_holdings\n holdings.select do |holding|\n !is_offsite_location_code?(holding[:location_code])\n # !LOCATIONS['offsite_locations'].include? holding[:location_code]\n end\n end", "def check_availability(params, campsites)\n # make array of inputed dates\n user_dates = (params[:start]..params[:end]).to_a\n\n # get all start and end dates of ALL bookings\n temp_campsites = []\n taken_dates = []\n\n campsites.each do |campsite|\n taken_dates = []\n campsite.bookings.each do |booking|\n # all taken dates for 1 campsite\n taken_dates << ((booking[:start_date].strftime(\"%Y-%m-%d\"))..booking[:end_date].strftime(\"%Y-%m-%d\")).to_a\n end\n\n taken_dates = taken_dates.flatten\n # p user_dates\n # p taken_dates\n if taken_dates[0].nil?\n puts \"No bookings made by anyone - all dates avaiable\"\n temp_campsites << campsite\n elsif user_dates.all? { |date| taken_dates.include?(date)}\n puts \"NO AVAILABLITY\"\n elsif user_dates.all? { |date| !taken_dates.include?(date)}\n puts \"All days avaiable\"\n temp_campsites << campsite\n else\n puts \"some dates avaiable\"\n temp_campsites << campsite\n end\n end\n\n return temp_campsites\n end", "def not_created_instances\n pending_instances_count = wanted_instances - filtered_pods_by_track.count\n\n return [] if pending_instances_count <= 0\n\n Array.new(pending_instances_count, deployment_instance(pod_name: 'Not provided', pod_status: 'Pending'))\n end", "def archive\n # Only show reservations that were ever actually checked out\n @reservations = Reservation.where('checked_out_time is not null')\n end", "def aasm_states_to_check\n created? ||\n (planned? && !aasm_state_changed? ) || # exclude validation on transition from created to planned\n started? ||\n ignore_states\n end", "def pending_eps?\n pending = open_claims.any? { |claim| claim['base_end_product_code'] == '020' }\n save_metadata(offramp_reason: 'pending_ep') if pending\n pending\n end", "def allow_id_info_changes_only_in_eligible_state\n if (ssn_changed? || dob_changed?) && !ELIGIBLE_STATES.include?(aasm_state)\n message = \"An employee's identifying information may change only when in 'eligible' status. \"\n errors.add(:base, message)\n end\n end", "def my_task_accepted_by_another_user_id # accepted_by_id, != nil\n @my_id = current_user.id\n @tasks = Task.where(user_id: @my_id, accepted_by_id: any?) # if !empty? doens't work != nil may\n end", "def check_for_completeness\n purch_states = purchases.pluck(:state)\n unique_states = purch_states.uniq\n return unless unique_states.size.eql? 1\n purchases_state = unique_states.first\n complete(Time.now) if purchases_state.eql? 'completed'\n end" ]
[ "0.59087116", "0.58684665", "0.5666443", "0.55964154", "0.5565137", "0.5564552", "0.5557245", "0.5556968", "0.55232847", "0.547609", "0.546023", "0.5448225", "0.5441946", "0.5435489", "0.5429253", "0.5421272", "0.54135066", "0.5396769", "0.53853375", "0.5371271", "0.53607255", "0.5354195", "0.5352895", "0.5335445", "0.5322177", "0.52958006", "0.52933866", "0.5284293", "0.527821", "0.5251101", "0.5242966", "0.52391326", "0.52217835", "0.52094305", "0.5203101", "0.51941925", "0.5193796", "0.5187603", "0.51831305", "0.51830643", "0.51812124", "0.5180388", "0.5176665", "0.5172168", "0.51690054", "0.5155144", "0.5146397", "0.51407313", "0.51396745", "0.51332766", "0.51320994", "0.5123156", "0.51130414", "0.51095486", "0.50988793", "0.5091818", "0.5089745", "0.5089434", "0.508904", "0.50823206", "0.50743026", "0.5065029", "0.50634664", "0.5062643", "0.506244", "0.5061753", "0.5059456", "0.50546616", "0.50494194", "0.50484717", "0.50476235", "0.50399625", "0.5039825", "0.50381833", "0.5037848", "0.50361323", "0.5034349", "0.503417", "0.50305295", "0.5030091", "0.50299835", "0.5028681", "0.5028108", "0.5026642", "0.50254506", "0.5022085", "0.5016567", "0.5015339", "0.500985", "0.5008923", "0.50086164", "0.49977672", "0.4996158", "0.49875826", "0.49748984", "0.49675816", "0.4952452", "0.4942554", "0.49420536", "0.49403718" ]
0.5952063
0
Use callbacks to share common setup or constraints between actions.
def set_recruitment @recruitment = Recruitment.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup\n #implement in subclass;\n end", "def after_set_callback; end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def around_hooks; end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.53314966", "0.53114754", "0.52984965", "0.52977055", "0.5296272", "0.5260649", "0.5245076", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.5235081", "0.52321917", "0.5228592", "0.5220735", "0.52198535", "0.52139324", "0.5208539", "0.5206585", "0.5178542", "0.5175199", "0.5173538", "0.5167041", "0.51614195", "0.51577675", "0.5153909", "0.51528823", "0.5152225", "0.51429904", "0.5141399", "0.51345575", "0.51145", "0.5114052", "0.5114052", "0.5110216", "0.5108656", "0.50935394", "0.5089196", "0.5081936", "0.5079627", "0.50675833", "0.5056105", "0.5053687", "0.5050475", "0.5050475", "0.503471", "0.5028311", "0.501982", "0.50157547", "0.5013552", "0.50014806", "0.50011593", "0.49976763", "0.4990292", "0.4990292", "0.49882022", "0.4981269", "0.49792367", "0.49766538", "0.4967978", "0.49667212", "0.4958987", "0.49572337", "0.49550423", "0.4954479", "0.4952353", "0.494726", "0.4944055", "0.4935437", "0.4931248", "0.49283475", "0.49281213", "0.49268973", "0.4921738", "0.49204507", "0.4918924", "0.49182287", "0.4916538", "0.49158585", "0.49156788" ]
0.0
-1
Return the project root path.
def root_path Pathname.new(File.expand_path(File.join(__dir__, '..', '..'))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_root\n return File.join('/root/path', SETTINGS[:project])\n end", "def project_root\n if server_environment\n server_environment['project-root'] || ''\n end\n end", "def root_path\n ENV['TM_PROJECT_DIRECTORY'] || File.join(ENV['TM_DIRECTORY'], \"..\")\n end", "def root_path\n @root_path ||= File.expand_path(File.join('.', '../..'))\n end", "def project_root()\n return @project_root_path if @project_root_path\n \n @project_root_path = Common::find_root_of(\"tiapp.xml\", Common::project_path)\n end", "def project_root\n @project_root ||= find_project_root\n end", "def project_root\n @project_root ||= find_project_root\n end", "def project_root\n File.expand_path(\"#{__dir__}/..\")\n end", "def root_path\n @root_path ||= `git rev-parse --show-toplevel`.chomp\n end", "def root\n File.expand_path(File.dirname(File.dirname(File.dirname(__dir__))))\n end", "def root\n @root ||= Pathname.new(__FILE__).dirname.dirname.expand_path.to_s\n end", "def root_dir\n is_rails? ? Rails.root.to_s : Dir.pwd.to_s\n end", "def root(path = nil)\n base = File.expand_path(File.dirname(__FILE__))\n path ? File.join(base, path) : base\n end", "def root\n Pathname.new(ENV[\"RAILS_ROOT\"] || Dir.pwd)\n end", "def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end", "def project_root; end", "def project_root; end", "def project_root(path)\n @project_root = path\n end", "def root\n Pathname.new(File.dirname(__dir__))\n end", "def get_project_path\n return File.absolute_path File.join(root_dir, src)\n end", "def root\n @root ||= Pathname.new(File.expand_path('../../../../', __FILE__))\n end", "def root\n Dir.pwd\n end", "def root\n Pathname.new File.expand_path('../../', File.dirname(__FILE__))\n end", "def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end", "def root\n @root ||= Pathname.new(File.expand_path('../../../', __FILE__))\n end", "def root(config = Pantry.config)\n Pathname.new(config.root_dir)\n end", "def root_path\n path = File.join(File.dirname(__FILE__), '../')\n Pathname.new(path).realpath\nend", "def project_dir\n config.project_dir\n end", "def root\n root = ENV['JETS_ROOT'].to_s\n root = '.' if root == ''\n root = \"#{root}/\" unless root.ends_with?('/')\n Pathname.new(root)\n end", "def root\n @root ||= Pathname.new(File.expand_path(\"..\", __dir__))\n end", "def root\n File.expand_path(File.dirname(__dir__))\n end", "def build_root()\n \"#{project_root}/build\"\n end", "def root\n find_single_directory || @app_dir\n end", "def root_path\n RUBYCOCOA_ROOT.to_s\n end", "def root; Pathname(__dir__).parent; end", "def root\n File.dirname(__FILE__)\n end", "def root\n File.expand_path '../../..', __FILE__\n end", "def root_path(path) File.join(root, path) end", "def project_root_dir\n File.expand_path(File.join(File.dirname(__FILE__), '..'))\nend", "def root\n File.dirname __dir__\n end", "def root\n File.dirname __dir__\n end", "def root\n @root ||= Pathname.new(File.expand_path('../../', __FILE__))\n end", "def root\n @root ||= Pathname.new(File.expand_path(\"../../\", __FILE__))\n end", "def root_project\n self.projects.first.root\n end", "def root path\n File.dirname(find_dotjam(path))\n end", "def root\n Rails.root || Pathname.new(ENV[\"RAILS_ROOT\"] || Dir.pwd)\n end", "def root\n Rails.root || Pathname.new(ENV[\"RAILS_ROOT\"] || Dir.pwd)\n end", "def root\n application && application.config.root\n end", "def app_root\n if defined?(Rails)\n ::Rails.root\n else\n Dir.pwd\n end\n end", "def get_root_directory\n return @@root_directory\n end", "def get_root_directory\n return @@root_directory\n end", "def root\n '/projects/my_rails_project'\n end", "def project_root\n this_file_path.ascend do |p|\n rakefile = p.join( 'Rakefile' )\n return p if rakefile.exist?\n end\n end", "def root\n @root ||= Pathname.new(\"#{__dir__}/../../../..\").cleanpath\n end", "def root\n settings[:basedir]\n end", "def construct_document_root\n return Dir.pwd + \"/public\"\n end", "def project_path path, strict=true\n path_under 'root', path, strict\n end", "def root\n File.expand_path(options[:root] || Dir.pwd)\n end", "def root\n File.dirname __dir__\n end", "def base_path\n Dir.pwd + \"/\"\n end", "def root_path\n environment.paths.detect { |path| pathname.to_s[path] }\n end", "def root\n \"#{File.dirname(__FILE__)}/..\"\nend", "def root_path(full = true)\n\n if full\n path = Rails.root.join ProgramsDir\n else\n path = Pathname.new ProgramsDir\n end\n\n path.join self.name\n end", "def root_path\n defined?(Rails) && Rails.root ||\n defined?(Sinatra::Application) && Pathname.new(Sinatra::Application.root) ||\n defined?(ROOT_DIR) && Pathname.new(ROOT_DIR)\n end", "def npm_root_path\n @npm_root_path ||= npm_path_for(\"root\")\n end", "def rootDir\n if @workflow[:root_dir]\n OpenStudio.toPath(@workflow[:root_dir])\n else\n OpenStudio.toPath(@osw_dir)\n end\n end", "def resources_root()\n \"#{project_root}/Resources\"\n end", "def base_path\n @base_path ||= server_path(File.expand_path(Dir.pwd))\n end", "def path\n @path ||= @project.dir.path\n end", "def paths_from_project_root\n @paths_from_project_root ||=\n [Config.project_root]\n end", "def rails_root\n @path\n end", "def siteroot\n \"/var/www/gforge-projects\"\n end", "def root_path\n Pathname.new(upload_path_value).join(search_directory)\n end", "def root\n return \".\".expand_path unless app_file?\n return @root if @root\n @guessed_root ||= begin\n dir = app_file.expand_path.dirname\n if dir.basename == \"lib\" and not (dir / \"lib\").directory?\n dir.dirname\n else\n dir\n end\n end\n end", "def root_path \n @root_path\n end", "def root\n @root ||= Pathname.new('.')\nend", "def rails_root\n `pwd`.gsub(\"\\n\", \"\")\n end", "def rails_root\n `pwd`.gsub(\"\\n\", \"\")\n end", "def root_dir\n File.join(self.runner.path, 'public')\n end", "def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\n end", "def sys_root\n '/'\n end", "def root\n '../' * file.count('/')\n end", "def root_file_path; end", "def root_dir\n self.class.plays_dir.join script_name\n end", "def repository_root\n File.expand_path(@repo.path + \"/../\")\n end", "def file_root(path = '')\n File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', path))\n end", "def root\n @root || Merb::Config[:merb_root] || File.expand_path(Dir.pwd)\n end", "def root\n @site.root\n end", "def script_root\n @script_root ||= File.dirname(__FILE__)\n end", "def gitpusshuten_root\n File.expand_path(File.join(Dir.pwd, '.gitpusshuten'))\n end", "def path_to_root\n path_to_script = Pathname.new(File.expand_path $PROGRAM_NAME)\n path_to_parent = path_to_script.parent\n\n if path_to_parent.basename.to_s == 'bin'\n path_to_parent = path_to_parent.parent\n end\n path_to_parent\n end", "def talia_root(path = '')\n File.join('..', '..', '..', '..', path)\n end", "def server_root\r\n File.expand_path(\"#{rails_root}/public/\")\r\n end", "def curr_srcdir\n \"#{srcdir_root()}/#{relpath()}\"\n end", "def relativize_root_path(path)\n path.to_s.sub(/^#{Regexp.escape(@root)}/, '$root')\n end", "def repo_path\n @config.get_value('GIT_REPO_ROOT')\n end", "def curr_srcdir\n \"#{srcdir_root()}/#{relpath()}\"\n end", "def curr_srcdir\n \"#{srcdir_root()}/#{relpath()}\"\n end", "def integration_cwd\n root.to_s\n end", "def project_path( *relative_path )\n project_root.join( *relative_path )\n end" ]
[ "0.9091598", "0.8452685", "0.8442884", "0.8190616", "0.8175919", "0.8128879", "0.8128879", "0.81154823", "0.802166", "0.78954184", "0.7878617", "0.7870664", "0.78443", "0.7843973", "0.78417397", "0.78324455", "0.78324455", "0.78191453", "0.78130984", "0.77910084", "0.77773994", "0.77749723", "0.777386", "0.77593875", "0.7750707", "0.7731467", "0.7711103", "0.7707084", "0.7676655", "0.76578254", "0.7634553", "0.76107115", "0.7602355", "0.75896794", "0.75749", "0.7573134", "0.7546489", "0.75448424", "0.75385934", "0.75148195", "0.75148195", "0.74991745", "0.7486903", "0.74818426", "0.74480665", "0.74472976", "0.74472976", "0.7441258", "0.743621", "0.742784", "0.742784", "0.7426631", "0.74188703", "0.74114215", "0.7367585", "0.7325966", "0.73170114", "0.7294398", "0.7291734", "0.7290418", "0.72429276", "0.7236788", "0.722738", "0.72061664", "0.7190699", "0.71824974", "0.71702844", "0.71540254", "0.7140565", "0.711401", "0.71123505", "0.70843697", "0.70836276", "0.70824635", "0.70799476", "0.7078949", "0.7075206", "0.7075206", "0.70718116", "0.7066005", "0.7058341", "0.7033222", "0.7026922", "0.70152193", "0.700775", "0.70055556", "0.7003992", "0.6981843", "0.6969979", "0.69681793", "0.69667006", "0.69445586", "0.6904169", "0.68887347", "0.68878865", "0.6881637", "0.6873222", "0.6873222", "0.6871437", "0.6863453" ]
0.7738341
25
Return the test suite temporary path.
def tmp_path root_path.join('tmp') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def temporary_directory\n \"#{ROOT}/spec/tmp\"\n end", "def get_temp_directory\n defined?(Rails) ? \"#{Rails.root}/tmp\" : \"/tmp\"\n end", "def tmp_path\n File.join gem_root, 'tmp'\n end", "def temp_dir\n name = 'tmp_' + rand.to_s.gsub(/\\D/, '')\n File.join(@temp_root, name)\n end", "def get_tmp_dir\n return \"#{Dir.tmpdir}/FilesRebuilder\"\n end", "def tempdir #:doc:\n Dir.tmpdir\n end", "def tmp_path\n Berkshelf.root.join(\"spec/tmp\")\n end", "def tmp_dir\n return Dir.tmpdir if path_of('tmp_dir').nil?\n return path_of('tmp_dir')\n end", "def get_tmp_path\n \"#{Dir.tmpdir}/#{Time.now.to_i * rand}\"\n end", "def get_tmp_path(temp_path)\n if not temp_path\n temp_path = Dir.tmpdir\n end\n\n Mongolicious.logger.info(\"Using #{temp_path} as root for our temp backup.\")\n return \"#{temp_path}/#{Time.now.to_i}\"\n end", "def scratch_folder()\n return File.expand_path(File.join(File.dirname(__dir__), \"tmp\", \"scratch-folder-for-testing\"))\nend", "def tmp_dir\n File.expand_path(self.relative_tmp_dir, @options[:root_dir])\n end", "def local_path\n TMP_PATH\n end", "def test_path\n File.join(root_path, \"test\")\n end", "def tempdir_name\n dir = File.join(Dir.tmpdir, SecureRandom.uuid)\n refute(Dir.exists?(dir))\n dir\n end", "def app_tmp_dir\n base_dir = app_sandbox_dir\n if base_dir.nil?\n nil\n else\n File.join(base_dir, 'tmp')\n end\n end", "def temporary_path(filename)\n Global.temporary_directory + filename\n end", "def temporary_output_path\n Gym.cache[:temporary_output_path] ||= File.join(\"/tmp\", Time.now.to_i.to_s)\n end", "def tmp_root_path\n @tmp_root_path ||= File.realpath(Dir.mktmpdir)\n end", "def tmp_dir\n @tmp_dir ||= root / 'tmp'\n end", "def getOtherLocation\n return \"#{Dir.tmpdir}/RDITest\"\n end", "def temporary_output_path\n Gym.cache[:temporary_output_path] ||= Dir.mktmpdir('gym_output')\n end", "def generate_temp_path\n path = Tempfile.new($$).path\n rm_f path\n path\n end", "def relative_tmp_dir\n parse_dir_options(:tmp_dir)\n end", "def temp_dir\n if @temp_dir.nil?\n @@get_temp_dir_api = Win32::API.new('GetTempPath', 'LP', 'L') unless @@get_temp_dir_api\n buffer = 0.chr * MAX_PATH\n @@get_temp_dir_api.call(buffer.length, buffer)\n @temp_dir = pretty_path(buffer.unpack('A*').first.chomp('\\\\'))\n end\n rescue\n @temp_dir = File.join(Dir::WINDOWS, \"temp\")\n ensure\n return @temp_dir\n end", "def tmp_path(path)\n return File.expand_path(File.join(@@config['tmpPath'], path))\n end", "def tmp_path\n return @tmp_path if @tmp_path\n\n raise NotImplementedError.new (\"implement this before running on the cluster!\")\n\n end", "def work_dir\n AYTests.work_dir\n end", "def tmp_path\n File.join(TMP_PATH, TRIGGER)\n end", "def tests_dir\n Pathname.new(path) + \"test\"\n end", "def tmp_path(*dirs)\n File.join(File.dirname(__FILE__), '..', 'tmp', 'spec', *dirs)\n end", "def temp_path\n @temp_path ||= generate_temp_path\n FileUtils.cp(polei.path, @temp_path) unless File.exist?(@temp_path)\n @temp_path\n end", "def path\n \"#{Dir.tmpdir}/#{name}\"\n end", "def suite_test_folder\n @suite_test_folder ||= File.join(test_folder, config[:suite_name])\n end", "def tmp_path\n File.expand_path(@dirs.first.to_s)\nend", "def mountpoint\n \"#{spec[:temp_dir]}\"\n end", "def get_free_file_path\n tempfile = Tempfile.new('foo', \"#{Rails.root}/test/fixtures/data/upload\")\n res = tempfile.path\n tempfile.close\n tempfile.unlink\n res\n end", "def lotemix_tempdir\n if File.exist?('/dev/null') #si es linux\n tf = \"/tmp/lotfiles/\"\n else\n tf = 'c:\\\\temp\\\\'\n end\n\tif not File.exist?(tf)\n FileUtils.mkdir(tf)\n end\n\n return tf \n end", "def __path__\n File.join(root, 'tmp', 'build')\n end", "def default_test_base_path\n File.join(kitchen_root, Kitchen::DEFAULT_TEST_DIR)\n end", "def get_test_path\n\n if @current_test_repeat == 1\n @test_path = @test_paths_absolute.shift\n end\n\n if @current_test_repeat == @test_repeats\n @current_test_repeat = 1\n else\n @current_test_repeat += 1\n end\n\n @test_path\n end", "def temporary_path\n trimmed_name = name.sub(/(papyri|litpap).info\\/#{IDENTIFIER_NAMESPACE}\\//, '')\n components = trimmed_name.split(';')\n return File.join(self.class::PATH_PREFIX, components[0..-2], \"#{components[-1]}.xml\")\n end", "def get_test_file_path(host, file_rel_path)\n File.join(@host_test_tmp_dirs[host.name], file_rel_path)\nend", "def get_test_file_path(host, file_rel_path)\n File.join(@host_test_tmp_dirs[host.name], file_rel_path)\nend", "def publish_tmp_dir_path()\n user_tmp_dir_container = ENV['DOCS_TMP_DIR_CONTAINER']\n if (not user_tmp_dir_container.nil?) && user_tmp_dir_container.length > 0\n subdir = File.join(\n user_tmp_dir_container,\n SecureRandom.uuid\n )\n else\n subdir = SecureRandom.uuid\n end\n\n return File.join(\n Dir.tmpdir(),\n subdir\n )\n end", "def work_path\n @work_path ||= tmp_path.join(name)\n end", "def path\n Path.new(@tmpname)\n end", "def gen_tempfile_path\n tf = Tempfile.new('filechanges.tgz')\n tf_path = tf.path\n tf.close\n tf.unlink\n tf_path\n end", "def path\n tempfile.path\n end", "def remote_tmp_path\n '/tmp'\n end", "def test_results_dir\n dir = \"#{@base_dir}/test_results\"\n FileUtils.mkdir_p dir unless Dir.exist? dir\n\n return dir\n end", "def tempdir\n @tmpdir ||= Dir.mktmpdir(\"dockerfile\")\n File.realpath(@tmpdir)\nend", "def lock_dir\n File.join(Dir.home, \"tmp\")\n end", "def tmpdir\n @tmpdir ||= File.join(Dir.tmpdir, 'sample_file', 'image')\n end", "def temporary_file\n # Ensure this is unique so that is doesn't clash with parallel compile processes\n Pathname.new \"#{Origen.root}/tmp/compiler_#{Process.pid}_#{Time.now.to_f}\"\n end", "def generate_temp_dir\n empty_directory File.join(Rails.root, \"tmp\", \"fusioncharts\")\n end", "def tmp_filename(user = current_user)\n \"#{ENCLOSURE_PATH}tmp_#{user.login}\"\n end", "def temp_path(filename)\n \"#{Rails.root}/tmp/import-#{filename}.xlsx\"\n end", "def temp (extension)\n path = \"#{FileUtils::Config.tmp_dir}/tmp.#{extension}\"\n id = 1\n while File.exists?(path)\n path = \"#{FileUtils::Config.tmp_dir}/tmp.#{id}.#{extension}\"\n id += 1\n end\n\n path\n end", "def tmpdir\n File.join(Dir.tmpdir, 'ruby')\n end", "def tmpdir\n @tmpdir ||= configuration[:copy_dir] || Dir.tmpdir\n end", "def tmpdir\n @tmpdir ||= configuration[:copy_dir] || Dir.tmpdir\n end", "def new_tempfile\n intopdir = Pathname.new(Tempfile.new('dummy').path)\n subdir = intopdir.parent + 'manual/'\n subdir.mkpath\n Pathname.new(Tempfile.new(['data-ids', '.csv'], subdir).path)\nend", "def temporary_file(contents=nil)\n f = Tempfile.new(\"vagrant-unit\")\n\n if contents\n f.write(contents)\n f.flush\n end\n\n # Store the tempfile in an instance variable so that it is not\n # garbage collected, so that the tempfile is not unlinked.\n @_temp_files << f\n\n return Pathname.new(f.path)\n end", "def prepare_cache_path\n cache = Tempfile.new(\"\", Global.file_cache_directory)\n path = cache.path\n cache.close(true)\n return path\n end", "def fixture_dir\n runtime_config.fixture_dir\n end", "def fixture_path\n if File.exists?(FIXTURE_DIR)\n FIXTURE_DIR\n else\n File.join(Rails.root, 'test', 'fixtures')\n end\n end", "def fixture_path\n if File.exists?(FIXTURE_DIR)\n FIXTURE_DIR\n else\n File.join(Rails.root, 'test', 'fixtures')\n end\n end", "def temp_file(extension)\n File.join(@temp_dir, ::SecureRandom.hex(7) + '.' + extension.trim('.', '')).to_s\n end", "def best_local_dumps_path\n spare_storage && spare_storage.local? ? spare_storage.path : Dir.tmpdir\n end", "def dir_path\n RAILS_ROOT + '/temp_files/' + Digest::MD5.hexdigest(self.id.to_s)[0..1] + '/'\n end", "def path\n @tmpname\n end", "def tmpdir(base=nil)\n if base\n ::File.join(Dir.tmpdir, 'smeagol', base)\n else\n ::File.join(Dir.tmpdir, 'smeagol', Time.now.year.to_s)\n end\n end", "def clean_dir_root\n File.join(root_dir, \"test\", \"tmp\", \"cleanreps\")\n end", "def tmpdir\n used? ? File.join(DOCKER_MACHINE_DOCKER_HOME, 'tmp', Dir.tmpdir) : Dir.tmpdir\n end", "def tmpdir; end", "def tmpdir\n @tmpdir ||= begin\n Dir.mktmpdir\n end\n end", "def pathname\n @pathname ||= TEMP_PATHNAME + filename\n end", "def tf(file)\n File.join(@test_dir, file)\n end", "def full_test_dir\n @full_test_dir ||= full_class_dir.gsub(src_dir, model.spec_dir)\n end", "def get_web_sample_path()\n\t\treturn backslashify(File.join(Dir.pwd, WEB_SAMPLE_DIR))\n\tend", "def suite_name\n files.map{ |path| File.dirname(path).sub(Dir.pwd+'/','') }.uniq.join(',')\n end", "def test_directories(suite)\n absolute_paths_for(\"spec/#{suite}\")\n end", "def tmp_resource_dir(path)\n @tmp_resource_dir = \"#{tmp_dir}/#{path}\" unless path.blank?\n end", "def mk_tmp_dir\n Dir.mktmpdir('janna-tmp-download-', '/tmp')\n end", "def test_folder\n config[:test_folder].nil? ? config[:test_base_path] : absolute_test_folder\n end", "def chef_file_path\n File.join(RIGHT_LINK_SPEC_HELPER_TEMP_PATH, '__chef.js')\n end", "def resource_path(resource)\n \"#{test_dir}/#{resource}\"\n end", "def package_tmp\n config.package_tmp\n end", "def temp_dir(f = nil)\n @temp_dir ||= \"#{Dir.mktmpdir(\"apidoc\")}/\"\n form_file_name @temp_dir, f\n end", "def tst_folder_path\n self.class.instance_variable_get(\"@test_folder_path\")\n end", "def temp_bags_directory\n ENV.fetch('RAILS_TMP', 'tmp')\n end", "def staging_dir\n File.expand_path(\"#{Config.package_tmp}/#{underscore_name}\")\n end", "def beaker_test_path(junit_file_path, junit_result)\n beaker_folder_path = junit_result[:classname]\n test_filename = junit_result[:name]\n\n File.join(File.dirname(junit_file_path), \"../../../\", beaker_folder_path, test_filename)\n end", "def resource_dir\n @resource_dir ||= \"#{test_dir}\"\n end", "def temp_dir\n dir = make_temp_dir\n chown(dir, user)\n dir\n end", "def gen_tmp_filename\n Dir::Tmpname.make_tmpname ['/tmp/ruby-sox', \".#{MEDIATE_TYPE}\"], nil\n end", "def integration_cwd\n root.to_s\n end", "def create_tmp_prj_dir\n begin\n Dir.mkdir(@test_tmp,0777)\n Dir.mkdir(@test_prj_dir,0777)\n rescue Exception => e\n puts \"Could not make #{@test_tmp} dirs at #{Dir.getwd} - #{e.to_s}\"\n end\n @test_prj_dir \n end", "def temp_mounted_path\n mounted_path.sub(\"#{archive_file_name}#{ArchiveMountSuffix}\", \".tmp-#{archive_file_name}#{ArchiveMountSuffix}\")\n end" ]
[ "0.7789942", "0.75857866", "0.7583217", "0.75632066", "0.75362986", "0.7337198", "0.7322641", "0.73212314", "0.72998583", "0.72806257", "0.716804", "0.7135022", "0.7122463", "0.70994043", "0.70462507", "0.70259434", "0.70247626", "0.69757235", "0.69269514", "0.68636906", "0.6839433", "0.683359", "0.6803588", "0.6728427", "0.67115426", "0.67037725", "0.66998017", "0.66986835", "0.6695765", "0.66912687", "0.6683849", "0.6669403", "0.66582626", "0.66361976", "0.66298884", "0.65930873", "0.6572436", "0.65682906", "0.6564319", "0.6527888", "0.6505026", "0.65031564", "0.6479669", "0.6479669", "0.646666", "0.6458165", "0.6416903", "0.63880223", "0.6374347", "0.63392144", "0.6338517", "0.63303536", "0.6326381", "0.63255286", "0.63235676", "0.62997913", "0.6298084", "0.6295773", "0.6268489", "0.6244319", "0.62424546", "0.62424546", "0.62334126", "0.6233379", "0.6206929", "0.6171761", "0.61535054", "0.61535054", "0.6139272", "0.6135911", "0.612017", "0.6114317", "0.6110437", "0.6083309", "0.6066902", "0.6058328", "0.6054879", "0.6044842", "0.6040276", "0.6037781", "0.6033851", "0.60337967", "0.6024669", "0.60181844", "0.60118383", "0.6010471", "0.6008482", "0.60032433", "0.5997497", "0.5983485", "0.59434503", "0.59160686", "0.59095836", "0.5908392", "0.590348", "0.5903403", "0.59032214", "0.58972806", "0.5896483", "0.5891396" ]
0.68609
20
Return the test suite fixtures path.
def fixtures_path root_path.join('spec', 'fixtures') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_path\n if File.exists?(FIXTURE_DIR)\n FIXTURE_DIR\n else\n File.join(Rails.root, 'test', 'fixtures')\n end\n end", "def fixture_path\n if File.exists?(FIXTURE_DIR)\n FIXTURE_DIR\n else\n File.join(Rails.root, 'test', 'fixtures')\n end\n end", "def fixtures_path\n Berkshelf.root.join(\"spec/fixtures\")\n end", "def fixture_dir\n runtime_config.fixture_dir\n end", "def fixture_path\n File.expand_path('fixtures', 'spec')\n end", "def fixture_path\n File.join(__dir__, '../chef/fixtures')\n end", "def fixture_path\n File.expand_path('../fixtures', __FILE__)\nend", "def fixture_dir\n File.join File.dirname(__FILE__), 'fixture'\nend", "def fixture_path(filename)\n File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)\nend", "def fixture_path\n @fixture_path ||=\n File.expand_path(File.join(__dir__, '..', '..', 'fixtures', 'files'))\nend", "def fixture(path)\n File.join(FIXTURES_ROOT, path)\nend", "def fixture_path(path)\n return File.join(File.expand_path('../../fixtures', __FILE__), path)\nend", "def fixture_directories\n @_fixture_directories ||= absolute_paths_for('fixtures')\n end", "def path_for(config); File.expand_path(File.join('../fixtures', config), __FILE__) ;end", "def fixture_path(name, extension=\"xml\")\n project_root_path.join(\"spec\", \"fixtures\", \"#{name}.#{extension}\")\n end", "def fixture(name)\n File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', name))\n end", "def fixture(name)\n File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', name))\n end", "def fixtures_directory\n unless @fixtures_directory\n candidates = config.fixtures_directories.map { |dir| File.join(root_directory, dir) }\n @fixtures_directory = candidates.find { |d| Aruba::Platform.directory? d }\n\n fail \"No existing fixtures directory found in #{candidates.map { |d| format('\"%s\"', d) }.join(', ')}. \" unless @fixtures_directory\n end\n\n fail %(Fixtures directory \"#{@fixtures_directory}\" is not a directory) unless Aruba::Platform.directory?(@fixtures_directory)\n\n ArubaPath.new(@fixtures_directory)\n end", "def module_fixtures_dir\n dir = module_root\n File.join(module_root, 'spec', 'fixtures') unless dir.nil?\n end", "def fixture_filename(filename)\n File.expand_path(File.join(\"fixtures\", filename), File.dirname(__FILE__))\nend", "def app_template_fixture(name)\n File.expand_path(\"fixtures/#{name}\",File.dirname(__FILE__))\n end", "def fixtures\n @fixtures ||= Dir[Rails.root.join(\"spec\", \"fixtures\", \"*/*\")]\n end", "def roby_app_fixture_path\n File.expand_path(\n File.join(\"..\", \"..\", \"..\", \"test\", \"app\", \"fixtures\"),\n __dir__\n )\n end", "def source_paths\n fixtures_directory = Pathname.new(__dir__).join('..', 'spec', 'fixtures')\n [__dir__, fixtures_directory] + Array(super)\nend", "def capistrano_configuration_fixtures_path\n File.join gem_root, 'spec', 'fixtures', 'capistrano', 'configuration'\n end", "def fixture_path\n File.join(PROJECT_ROOT, 'spec', 'fixtures', 'integration', 'git')\n end", "def fixture_file_path(filename)\n Rails.root.join('test', 'fixtures', 'files', filename).to_s\n end", "def fixture_path\n # @_fixture_path ||= \"#{Emerson.fixture_path || RSpec.configuration.fixture_path}/responses\"\n @_fixture_path ||= File.join(Emerson.fixture_path, 'responses')\n end", "def test_path\n File.join(root_path, \"test\")\n end", "def tests_dir\n Pathname.new(path) + \"test\"\n end", "def fixture(filename)\n File.join(FIXTURES_PATH, filename)\n end", "def path_to_fixture(fixture_name)\n Pathname.new(File.join(SAMPLE_ROOT, fixture_name))\n end", "def file_fixture(path)\n return File.expand_path(File.join(File.dirname(__dir__), \"test\", \"fixtures\", \"files\", path))\nend", "def file_fixture(path)\n return File.expand_path(File.join(File.dirname(__dir__), \"test\", \"fixtures\", \"files\", path))\nend", "def file_fixture(path)\n return File.expand_path(File.join(File.dirname(__dir__), \"test\", \"fixtures\", \"files\", path))\nend", "def fixture(name)\n File.open(File.expand_path(File.dirname(__FILE__) + \"/fixtures/#{name}\"))\nend", "def fixture(name)\r\n File.read \"test/fixtures/#{name}\"\r\n end", "def fixture_module(name)\n File.join(fixture_dir, name)\nend", "def default_test_base_path\n File.join(kitchen_root, Kitchen::DEFAULT_TEST_DIR)\n end", "def fixture_file(filename)\n File.join fixtures_dir, \"#{filename}.yml\"\n end", "def config_filepath(name)\n File.expand_path(\"../fixtures/configs/#{name}.yaml\", __dir__)\nend", "def fixture(name)\n File.read(fixture_location(name))\nend", "def actual_fixture_path(base_name)\n data = { filename: File.basename(base_name, '.yml'), ext: '.yml' }\n FIXTURE_FILE_PATTERNS.each do |type|\n path = MagicPath.send(type).resolve(data)\n return path if File.exist? \"#{MagicPath.fixture_path}/#{path}\"\n end\n raise \"Could not find fixture to match #{base_name}\"\n end", "def datadir\n \"#{Rails.root}/test/data\"\n end", "def template_path\n File.join gem_root, 'spec', 'fixtures', 'application'\n end", "def file_fixture_path(filename)\n File.expand_path(File.dirname(__FILE__) + \"/../fixtures/Upload/#{ filename }\")\nend", "def test_config_filename\n File.join File.dirname(__FILE__), 'config.yml'\nend", "def get_test_data_path_for(test_data_sub_path)\n File.expand_path(File.dirname(__FILE__) + \"/../test_data/#{ test_data_sub_path }\")\nend", "def data_root\n File.expand_path(\"spec/data\", Dir.pwd)\n end", "def json_fixture(path)\n File.read(Rails.root.join(*%W[spec fixtures #{path}.json]))\nend", "def default_fixture_filename\n 'madison_square_garden.json'\n end", "def repository_path(name)\n File.expand_path(\"../fixtures/#{name}\", __FILE__)\n end", "def test_directories(suite)\n absolute_paths_for(\"spec/#{suite}\")\n end", "def entities_fixture_dir\n File.join(fixture_path, 'entities')\nend", "def read_fixture( path )\n File.read(\"#{ fixtures_folder }/#{ path }\")\nend", "def fixture(name, extension=\"json\")\n File.read(Rails.root.join(\"test\", \"fixtures\", \"#{name}.#{extension}\"))\nend", "def fixture name\n cwd = File.expand_path(File.dirname(__FILE__))\n File.read(File.join(cwd, \"../fixtures/ten_hs_server/#{name}\"))\n end", "def spec_path(path)\n path = (path.split('/') - ['fixtures']).join('/')\n split_path = full_path(path).split('/')\n\n split_path.pop\n split_path.join('/') + '_spec.rb'\n end", "def fixture_file(filename)\n return '' if filename == ''\n File.expand_path(RAILS_ROOT + '/features/fakeweb/' + filename)\n end", "def fixture_io(name)\r\n File.open File.join(File.dirname(__FILE__), 'fixtures', name)\r\n end", "def data_path\n if ENV[\"RACK_ENV\"] == \"test\"\n File.expand_path(\"../test/data\", __FILE__)\n else\n File.expand_path(\"../data\", __FILE__)\n end\nend", "def data_path\n if ENV[\"RACK_ENV\"] == \"test\"\n File.expand_path(\"../test/data\", __FILE__)\n else\n File.expand_path(\"../data\", __FILE__)\n end\nend", "def data_path\n if ENV[\"RACK_ENV\"] == \"test\"\n File.expand_path(\"../test/data\", __FILE__)\n else\n File.expand_path(\"../data\", __FILE__)\n end\nend", "def suite_test_folder\n @suite_test_folder ||= File.join(test_folder, config[:suite_name])\n end", "def default_fixture_filename\n \"#{fixture_prefix}_madison_square_garden\"\n end", "def file_fixture(name)\n File.read(File.join(File.dirname(__FILE__), \"file_fixtures\", name))\n end", "def fixture(path)\n return File.read(fixture_path(path))\nend", "def base_dir\n AYTests.base_dir\n end", "def data_path name\n File.join File.dirname(__FILE__), 'data', \"#{ name }.yml\"\nend", "def work_dir\n AYTests.work_dir\n end", "def data_bags_path\n\t# These can occur on suite-level, provisioner-level, verifier or at the default location\n kitchen_provisioner_config[:data_bags_path] || kitchen_verifier_config[:data_bags_path] || File.join('test', 'data_bags')\n end", "def read_fixture(name)\n IO.read(File.dirname(__FILE__) + \"/fixtures/#{name}.json\")\nend", "def file_fixture(filename)\n filename = File.join(File.dirname(__FILE__), 'fixtures', filename.to_s)\n File.open(filename).read\nend", "def test_folder\n config[:test_folder].nil? ? config[:test_base_path] : absolute_test_folder\n end", "def plugin_test_root\n \"#{plugin_root}/test\"\n end", "def fixture\n pwd = FileUtils.pwd\n path = File.expand_path(File.join(pwd, \"spec/.fixtures/#{rand(99999)}\"))\n\n FileUtils.mkdir_p(path)\n FileUtils.cd(path)\n\n yield(path)\n\n ensure\n FileUtils.cd pwd\n FileUtils.rm_rf(path) if File.exists?(path)\n end", "def fixture(file)\n File.new(fixture_path + '/' + file)\nend", "def testdata\n prefix/\"test\"\n end", "def setup\n File.expand_path(File.dirname(__FILE__) + '/data/')\n end", "def fixture_contents(fixture)\n fixture_file = Dir.entries(fixture_path).find { |e| /^#{fixture}$|#{fixture}\\.[a-z]/.match?(e) }\n File.read(\"#{fixture_path}/#{fixture_file}\")\nend", "def tmp_path\n Berkshelf.root.join(\"spec/tmp\")\n end", "def dot_kitchen_yml\n File.join(Dir.pwd, \".kitchen.yml\")\n end", "def fixture(name)\n file = File.join(__dir__, 'fixtures', \"#{name}.json\")\n File.read(file)\n end", "def read_fixture(file)\n File.read(File.join(File.dirname(__FILE__), \"fixtures\", file))\nend", "def read_fixture(file)\n File.read(File.join(File.dirname(__FILE__), \"fixtures\", file))\nend", "def fixture_content(filename)\n path = File.expand_path(\"../fixtures/#{filename}\", __FILE__)\n File.read(path)\nend", "def fixtures_route_dir(kind, epoch)\n ::File.join(\n @fixtures_dir,\n epoch.to_s,\n @route_data[:subdir],\n kind.to_s)\n end", "def resource_dir\n @resource_dir ||= \"#{test_dir}\"\n end", "def local_suite_files\n base = File.join(config[:test_base_path], config[:suite_name])\n Util.safe_glob(base, \"*/**/*\").reject do |f|\n chef_data_dir?(base, f) || File.directory?(f)\n end\n end", "def get_fixture(name)\n #JSON.parse(File.read(File.expand_path(\"../fixtures/#{name}\", __FILE__)))\n File.read(File.expand_path(\"../fixtures/#{name}\", __FILE__))\nend", "def datafile_path(env)\n env[:machine].data_dir.join(\"berkshelf\")\n end", "def api_fixture(path, ext: :json)\n File.read(\"spec/fixtures/#{path}.#{ext.to_s}\")\n end", "def list_path\n if ENV['GMAN_STUB_DOMAINS']\n File.expand_path '../test/fixtures/domains.txt', File.dirname(__FILE__)\n else\n File.expand_path 'domains.txt', config_path\n end\n end", "def fixture(name)\r\n fixture_io(name).read\r\n end", "def uses_fixture(fixture_name)\n require File.join(File.dirname(__FILE__), 'fixtures', fixture_name.to_s)\nend", "def kitchen_yml\n File.join(Dir.pwd, \"kitchen.yml\")\n end", "def install_fixtures\n fixtures = String.new\n if @config[@origin].has_key?('fixtures')\n fixtures = @config[@origin]['fixtures'].to_yaml.chop.gsub(\"---\\n\", '').gsub(\"\\n\", \"\\n \")\n end\n\n subs = {\n '##FIXTURES##' => fixtures,\n '##SHORT_NAME##' => @short_name,\n }\n\n install_template(\n [\"#{@templates}/.fixtures.yml\"], '.fixtures.yml', subs)\n end", "def local_suite_files\n base = File.join(config[:test_base_path], config[:suite_name])\n glob = File.join(base, '*/**/*')\n Dir.glob(glob).reject do |f|\n chef_data_dir?(base, f) || File.directory?(f)\n end\n end", "def config_path\n test? ? \"config-test.yml\" : \"config.yml\"\n end", "def fixture_file(filename)\n return \"\" if filename == \"\"\n file_path = File.expand_path(File.dirname(__FILE__) + \"/fixtures/\" + filename)\n File.read(file_path)\nend" ]
[ "0.85671073", "0.85671073", "0.8338028", "0.8310602", "0.82196265", "0.81024873", "0.8061822", "0.794122", "0.77860004", "0.77853763", "0.77752167", "0.77457446", "0.7687394", "0.7658605", "0.7624142", "0.7597632", "0.7597632", "0.74827266", "0.7481996", "0.7476985", "0.74534655", "0.7438153", "0.74318916", "0.7387136", "0.7344168", "0.7274374", "0.7213984", "0.713595", "0.711119", "0.70270896", "0.6993966", "0.69849783", "0.6966045", "0.6966045", "0.6966045", "0.69579655", "0.6948712", "0.693715", "0.6934683", "0.6934444", "0.68774754", "0.6834501", "0.68142825", "0.6784748", "0.6731941", "0.6705182", "0.6677934", "0.66744864", "0.6653045", "0.6647637", "0.6646077", "0.66405016", "0.66355187", "0.6633262", "0.65806514", "0.6561425", "0.6552787", "0.6547245", "0.65202004", "0.6445756", "0.64404285", "0.64404285", "0.64404285", "0.6430806", "0.6409227", "0.64051723", "0.64034784", "0.63936436", "0.63837785", "0.63754994", "0.6357193", "0.6340441", "0.6335068", "0.63301295", "0.6286586", "0.62805575", "0.62630224", "0.62519836", "0.6235201", "0.62164414", "0.6200823", "0.61899066", "0.61748207", "0.61115813", "0.61115813", "0.6094489", "0.60933113", "0.60750824", "0.60639125", "0.6060506", "0.60454065", "0.6042718", "0.60401255", "0.6021478", "0.6016021", "0.5995703", "0.59707725", "0.5962102", "0.5957936", "0.59480125" ]
0.8261674
4
the length of the Collatz Conjecture for any given n.
def collatz(n, arr = []) while n != 1 arr << n n = n.even? ? n/2 : n*3+1 end arr.push(1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collatz(n)\r\n\t\t\tlen = 0\r\n\t\t\twhile n > 1\r\n\t\t\t\tn = 3*n + 1 if n%2 != 0\r\n\t\t\t\tn = n/2 if n%2 == 0\r\n\t\t\t\tlen += 1\r\n\t\t\tend\r\n\t\t\treturn len\r\n\t\tend", "def collatz(n)\n sequence = [n]\n length = 1\n\twhile n != 1\n\t\tn = n.even? ? n/2 : n*3 + 1\n\t\tsequence << n\n\t\tlength += 1\n\tend\n\tlength\n\t# sequence.join('->') + \" -- length is #{length}\"\nend", "def collatz(n)\n\treturn 1 if n == 1\n\tcounter = collatz(collatz_helper(n)) + 1\nend", "def collatz_length(number)\n sequence_length = 1\n \n while number != 1\n number.even? ? number = (number / 2) : number = (3 * number) + 1\n sequence_length += 1\n end\n\n sequence_length\nend", "def collatz_step(n)\n\n # TODO: Solve it!\n\n end", "def coat_length; end", "def length_of_column n\n length_of_largest_cell_in_column n \n end", "def length_of_single_columns_where_multicolumn_is(n,length)\n total_length = 0\n spacing_length = (3 * (length - 1))\n total_length = total_length + spacing_length\n n.upto(n + length - 1) do |i|\n total_length = total_length + length_of_largest_single_column_cell_in_column(i)\n end\n return total_length\n end", "def find_next_collatz(n)\n\tif n == 1\n\t\treturn 1\n\telsif n % 2 == 0\n\t\tn = n / 2\n\t\treturn n\n\telse\n\t\tn = (3 * n) + 1\n\t\treturn n\n\tend\nend", "def count_collatz(number = 1_000_000)\n max = 0\n number.downto(1) do |number|\n result = Collatz.new(number)\n max = result if result > max\n end\n max\nend", "def next_collatz(n)\n\tn.even? ? n / 2 : 3 * n + 1\nend", "def length\n Math.sqrt(@x * @x + @y * @y + @z * @z)\n end", "def char_length\n @char_length ||= (@n**2 / 10) + 1\n end", "def collatz_count(num)\n case\n when num == 1\n 0\n when num.even?\n 1 + collatz_count(num / 2)\n when num.odd?\n 1 + collatz_count(3 * num + 1)\n end\nend", "def collatz(n)\n sequence = []\n sequence << n\n\n until sequence.last == 1\n if sequence.last.even?\n sequence << sequence.last / 2\n else sequence.last\n sequence << 3 * sequence.last + 1\n end\n end\n sequence\nend", "def collatz(n)\n if n.even? then\n # blocco eseguito se n e` numero pari\n return n/2 # esco restituendo il valore n/2\n else\n # blocco eseguito se n e` numero dispari\n return 3*n+1 # esco restituendo il valore 3*n+1\n end\nend", "def cveclen(u)\n\tMath.sqrt(u[0,0]**2+u[1,0]**2+u[2,0]**2)\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 n\n x.size\n end", "def chain_length(memo, n)\n chain_length, d = 0, n # record chain length\n while ! memo.has_key?(d) # don't redo computations\n chain_length += 1\n if d % 2 == 0\n d = d / 2\n else\n d = 3*d + 1\n end\n end\n chain_length += memo[d]\n return chain_length\nend", "def max_cycle_length\n scc_kosaraju.map{|scc| scc.size}.max\n end", "def n\n @clensing_data.size\n end", "def collatz_sequence\n n = self\n results = []\n\n until n == 1\n results << n\n n = n.even? ? n / 2 : n * 3 + 1\n end\n\n results\n end", "def n_constant\n 1.0 / basis_functions.length\n end", "def collatz(num)\n\tcount = 0\n\twhile num > 1 do\n\t\tif num.even?\n\t\t\tnum /= 2\n\t\t\tcount += 1\n\t\telse\n\t\t\tnum = (num * 3) + 1\n\t\t\tcount += 1\n\t\tend\n\tend\n\tp \"Number of steps: #{count}\" \nend", "def collatz(n)\n newList = [n]\n while n != 1\n if n % 2 == 0\n n = n / 2\n else\n n = n * 3 + 1\n\t\tend\n newList.push(n)\n\tend\n return newList\nend", "def nnz\n @nz.size \n end", "def sols( n, sq, cb )\n count = 0\n\n # Subtract cubes until they're too big to produce a positive difference.\n cb.each do |c|\n break if c > n - 1\n count += 1 if sq.has_key?( n - c )\n end\n \n count\n end", "def collatz_evaluate_term(n)\n if n % 2 == 0 \n @result = n/2\n else\n @result = 3*n + 1\n end \n @terms << @result\n \n if @result == 1 \n @collatz_solved = true\n end\nend", "def bc_count\n \[email protected] + @initial.size + @final.size + @cyclic.size\n end", "def count_bits(n)\n # TODO: Program me\n bits = []\n while n >= 1\n\n if n % 2 == 1\n bits.unshift(1)\n end\n \n n /= 2\n end\n bits.length\nend", "def utopian_tree_size(n)\n\n\t# Using the formula above, the solution is quite simple\n\t# (n) = (2^(m+1) - 2) + 1(1 - n mod 2), where m = ( n + n mod 2) / 2\n\n\t# Find the max M \n\tm = ( n + n % 2) / 2\n\n\t# Get the result \n\t(2**(m+1) - 2 + 1*(1 - n % 2))\nend", "def collatz num\n max_count=1\n winning_num=1\n\n (1..num).each do |x|\n\n start=x\n counter=1\n\n until x==1\n x.even? ? x/=2 : x=3*x+1\n counter+=1\n end\n\n if counter>max_count\n max_count=counter\n winning_num=start\n end\n end\n \"#{winning_num} has a loop of size #{max_count}\"\nend", "def size\n @n\n end", "def size\n @n\n end", "def length\n grid_shape.length\n end", "def get_bit_length(n)\n if n == 0\n # we require no bit to store 0.\n # That is, absence of bit is considered 0.\n return 0\n else \n return 1 + get_bit_length(n >> 1)\n end\nend", "def count(n)\n sum = 1\n n.prime_division.each do |x|\n sum *= (x[1] + 1)\n end\n sum\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 scm_vector_length\n Rubeme.rb2scm_number(@value.length)\n end", "def number_of_bits_up_to(n)\n Math.frexp(n - 1)[1]\n end", "def length; count end", "def solve(n)\n\ttotal = 1\n\t(3...n+1).step(2) do |x|\n\t\t# Upper right corner is x**, the other corners are each x-1 less. Simplify and we've got:\n\t\ttotal += 4*x**2 - 6*x + 6\n\tend\n\treturn total\nend", "def cycle_length(n,d)\n remainders = [n.remainder(d) * 10]\n finished = false\n\n until remainders.include?(remainders.last.remainder(d) * 10)\n remainders << remainders.last.remainder(d) * 10\n end\n return remainders[remainders.index(remainders.last.remainder(d) * 10)..remainders.size - 1].size\n end", "def longest_consec(arr, n)\n return '' if (n < 1 || n > arr.length)\n\n record = 0\n best_idx = 0\n arr.each_index do |idx|\n crop = arr[idx...(idx + n)]\n current = crop.reduce(0) { |acc, el| acc += el.length }\n if current > record\n record = current \n best_idx = idx\n end\n end\n\n arr[best_idx...(best_idx + n)].join('')\nend", "def length\n 3\n end", "def length\n 3\n end", "def length n\n Math.log10(n).floor \nend", "def solution(n)\n array = Array.new\n (1..n).each do\n array.push(0)\n end\n while (array.length >= 16)\n (1..16).each do\n array.pop\n end \n end\n array.length\nend", "def triagonal_number(n)\r\n\t(n*(n+1))/2\r\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 queens_size\n # Special case to handle a bitset of 64 bits\n if @size == 8\n bits = 0\n (@size * @size).times { |i|\n if @state[i]\n bits += 1\n end\n }\n return bits\n end\n\n return @state.cardinality\n end", "def length_of_largest_cell_in_column n\n column_with_headings(n).map do |cell|\n if cell.is_a? Hash\n if cell[:colspan] && cell[:colspan] > 1\n if (cell[:value].to_s.length <= length_of_single_columns_where_multicolumn_is(cell[:start_index],cell[:colspan]))\n 0\n else\n spacing_length = (3 * (cell[:colspan] - 1))\n length_in_columns = (cell[:value].to_s.length - spacing_length)\n (length_in_columns.to_f / cell[:colspan]).ceil\n end\n else\n cell[:value].to_s.length\n end\n else\n cell.to_s.length\n end\n end.sort.last\n end", "def number_of_factors(n)\n # bruteforce, simplest\n # least efficient way\n count = 0\n\n (1..n).each do |i|\n if n % i == 0\n count += 1\n end\n end\n\n count\nend", "def length\n if z\n Math.sqrt(x * x + y * y + z * z)\n elsif x && y\n Math.sqrt(x * x + y * y)\n else\n nil\n end\n end", "def bit_length\n (negative? ? -self : self + ONE).log2.ceil\n end", "def corner_sum(n)\n return 1 if n == 1\n # n*n + n*n - (n-1) + n*n - 2*(n-1) + n*n - 3*(n-1) \n return 4*n*n - 6*(n-1)\nend", "def volume_of_a_cube(n)\n return n**3\nend", "def length_squared\n @x * @x + @y * @y + @z * @z\n end", "def length\n reduce(0) {|sum,_| sum + 1 }\n end", "def length_of_largest_single_column_cell_in_column n\n column_with_headings(n).map do |cell|\n if cell.is_a? Hash\n if cell[:colspan] && cell[:colspan] > 1\n 0\n else\n cell[:value].to_s.length\n end\n else\n cell.to_s.length\n end\n end.sort.last\n end", "def subpeptides_in_linear_peptide(n)\n # How many subpeptides does a linear peptide of given length n have? (Include the empty peptide and the entire peptide.)\n # Input: An integer n.\n # Output: The number of subpeptides of a linear peptide of length n.\n\n return ( ((n*(n+1))/2) + 1 )\n end", "def collatz(num)\n collatz_int(num,0)\nend", "def size\n NMatrix.size(self.shape)\n end", "def ctof(n) \n c=1.8\n return ((n*c)+32).to_i \nend", "def how_many_most_often(n)\n a = count_most_often(n)\n lrj = a.join(',')\n c = 0\n [self.n1, self.n2, self.n3, self.n4, self.n5].each do |n|\n c += 1 if a.include?(n)\n end\n return [c, a.size]\n end", "def column_width n\n column_widths[n] || 0\n end", "def volume_of_cube(n)\n return n * n * n\nend", "def size\n (@bit_length*@length*@count)/8.0\n end", "def cindgen(n)\n NVector.seq(n, :complex64)\n end", "def prop_c\n bases_c / length.to_f\n end", "def numberOf1Bits(n)\n res = 0\n while n != 0\n n &= (n - 1)\n res += 1\n end\n return res\nend", "def length\n ->(xs) {\n C.fold.(0, ->(acc, _) { acc + 1 }, xs)\n }\n end", "def num_prime_factors(num)\n (prime_factors(num)).length\nend", "def shapeArea(n)\n return (n*n) + ((n-1)*(n-1))\nend", "def number_combinations(n, k)\n\tnumberOfCombinations = (factorial(n))/(factorial(k) * factorial(n - k))\n\treturn numberOfCombinations\nend", "def solve( n = 1_000 )\n (1..n).inject( 0 ) {|sum, i| sum + i.in_words.delete(' -').length}\n end", "def num_prime_factors(num)\n\tprime_factors(num).length\nend", "def cols_len\n (0...column_size).collect {|j| max_len_column(j)}\n end", "def get_length(i, count)\n\t\t#End condition is that i is a power of two\n\t\tif ((Math.log2(i)%100).zero?)\n\t\t\treturn (1 + count + Math.log2(i))\n\t\telse\n\t\t\treturn get_length(self.seq(i), 1 + count)\n\t\tend\n\tend", "def num_prime_factors(num)\n prime_factors(num).length\nend", "def bottom_up_cut_rod n, p, c\n r = [0]\n (1..n).each do |l|\n r << ((1..l-1).map { |i| p[i-1] + r[l-i] - c} << p[l-1]).max\n end\n return r[n]\nend", "def collatz(num)\n set = Array.new(0)\n set << num\n until set[-1] == 1\n if set[-1].even?\n set << set[-1] / 2\n else\n set << ((3 * set[-1]) + 1)\n end\n end\n set\nend", "def num_prime_factors(num)\n prime_factors(num).length\nend", "def num_prime_factors(num)\n prime_factors(num).length\nend", "def num_prime_factors(num)\n prime_factors(num).length\nend", "def count_bits(n)\n return 0 if n == 0\n return 1 if n == 1\n return count_bits(n/2) + n%2\nend", "def coll_conject(int)\n num = int\n steps = 0\n while num > 1\n if num.even?\n num = num / 2\n else\n num = (num * 3) + 1\n end\n steps += 1\n end\n return steps\nend", "def flatlandSpaceStations(n,c,m)\r\n answer = 0\r\n cc = c.sort()\r\n\r\n for i in (0..cc.size-2) do\r\n answer = [answer,(cc[i+1]-cc[i])/2].max\r\n end\r\n answer = [answer, cc[0], n-1 - cc[-1]].max\r\nend", "def sequence\r\n n = 1000000\r\n l = 1\r\n digit = 1\r\n n.times do |i|\r\n templ = collatz(i+1)\r\n if templ > l\r\n l = templ\r\n digit = i+1\r\n end\r\n end\r\n puts \"The longest sequence was #{l} from number #{digit}\"\r\nend", "def nth_octagonal(nth)\n nth * (3 * nth - 2)\nend", "def num_prime_factors(num)\n return prime_factors(num).length\nend", "def num_prime_factors(num)\n return prime_factors(num).length\nend", "def max_x( n )\n (Math.sqrt( 6*n ) / 6).to_i\n end", "def length() end", "def length() end", "def length() end", "def length() end", "def bit_length\n @bit_length ||= ECDSA.bit_length(field.prime)\n end", "def num_factors(n)\n pf = prime_factors(n)\n freq = Hash.new(0)\n pf.each{ |i| freq[i] += 1 }\n freq.inject(1){ |t,(k,v)| t * (v+1) }\nend", "def count_matches( n )\n i = 1\n p = n\n while p.to_s.size == i\n p *= n\n i += 1\n end\n i - 1\n end" ]
[ "0.8271018", "0.7529633", "0.7418252", "0.713448", "0.6872021", "0.6770015", "0.66174567", "0.6572476", "0.65473706", "0.6490807", "0.6466627", "0.64247847", "0.6362093", "0.6351804", "0.6339196", "0.6303988", "0.61476034", "0.61274683", "0.6097332", "0.60653675", "0.60489094", "0.6031357", "0.60158825", "0.5995107", "0.59858143", "0.5977324", "0.5974367", "0.59069484", "0.58815545", "0.58804595", "0.5839244", "0.58242124", "0.5795186", "0.5790532", "0.5790532", "0.5775484", "0.5774765", "0.57681143", "0.5766465", "0.57545805", "0.57383937", "0.57121253", "0.5707048", "0.568733", "0.5678902", "0.5658406", "0.5658406", "0.5645038", "0.5637864", "0.56334066", "0.5631822", "0.56230557", "0.5622947", "0.56228286", "0.5603207", "0.5598331", "0.5572327", "0.55615216", "0.55522186", "0.55322576", "0.5527675", "0.5515452", "0.55143064", "0.5513392", "0.55123895", "0.5506682", "0.5505008", "0.5495401", "0.54944885", "0.54909086", "0.5489265", "0.54887575", "0.5485052", "0.5481421", "0.54788196", "0.54755783", "0.54736567", "0.5473517", "0.5472938", "0.54664457", "0.5464628", "0.5450573", "0.5445517", "0.5444076", "0.5444076", "0.5444076", "0.5443298", "0.54407", "0.5440486", "0.5434546", "0.5423918", "0.54152113", "0.54152113", "0.5414267", "0.5404207", "0.5404207", "0.5404207", "0.5404207", "0.5403776", "0.5401421", "0.5393564" ]
0.0
-1
Write a method that will take a string and return an array of vowels used in that string. Difficulty: 4/10 Example: count_vowels("The quick brown fox") should return ["e","u","i","o","o"] count_vowels("Hello World") should return ["e","o","o"] Check your solution by running the tests: ruby tests/04_vowels_test.rb
def vowels (string) vowel_list = ["a", "e", "i", "o", "u"] result = [] string.split("").each do |letter| if vowel_list.include? letter.downcase result.push letter end end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vowels (string)\n vowels_arr = []\n count_vowels = string.scan(/[aeoui]/)\n vowels_arr << count_vowels\n puts vowels_arr\nend", "def count_vowels(str)\n vowels = 0\n str.split('').each do |char|\n vowels += 1 if ['a', 'e', 'i', 'o', 'u'].include? char\n end\n vowels\nend", "def count_vowels (string)\n\n # Downcase for case insensitivity, get vowels, drop non-unique, count\n return string.downcase.scan(/[aeiou]/).uniq.count\n\nend", "def vowel_count(str)\n str.split('').select { |a| a =~ /[aeiouAEIOU]/ }.length\nend", "def get_vowel_count(string)\n vowels = [\"a\",\"e\", \"i\", \"o\", \"u\"]\n vowel_count = 0\n string.each_char do |char|\n vowel_count += 1 if vowels.include?(char)\n end\n vowel_count\nend", "def num_vowels(str)\n str.downcase.scan(/[aeiou]/).count\nend", "def vowels (string)\r\n<<<<<<< HEAD\r\n # commented stuff is to return the values when the program is run; question asks to have the return value available in the test\r\n # vowels = []\r\n count_vowels = string.scan(/[aeiou]/i)\r\n # vowels << count_vowels\r\n # print vowels\r\nend", "def vowels(str)\n the_vowels = ['a', 'e', 'i', 'o', 'u']\n vowel_count = 0\n str.split('').each { |char|\n if the_vowels.include?(char.downcase)\n vowel_count += 1\n end\n }\n\n vowel_count\nend", "def count_vowels(string)\n\t\n\tvowel_counter = 0\n\tstring_splitter = string.split(\"\")\n\t\n\tstring_splitter.each do |letter|\n\t\tif letter.include?(\"a\") \n\t\t\tvowel_counter += 1\n\t\telsif letter.include?(\"e\") \n\t\t\tvowel_counter += 1\n\t\telsif letter.include?(\"i\") \n\t\t\tvowel_counter += 1\n\t\telsif letter.include?(\"o\") \n\t\t\tvowel_counter += 1\n\t\telsif letter.include?(\"u\") \n\t\t\tvowel_counter += 1\n\t\telsif letter.include?(\"y\") \n\t\t\tvowel_counter += 1\n\t\tend\n\tend\nvowel_counter\nend", "def vowels (string)\r\n vowels = []\r\n string.chomp.split(//).each do |letter|\r\n if letter == \"a\" || letter == \"e\" || letter == \"i\" || letter == \"o\" || letter == \"u\" || letter == \"A\" || letter == \"E\" || letter == \"I\" || letter == \"O\" || letter == \"U\"\r\n vowels.push(letter)\r\n end\r\n end\r\n return vowels\r\nend", "def vowel_count (str)\n sentence = str.downcase\n letters = sentence.split(\"\")\n count = 0\n vowels = %w{a e i o u}\n letters.each do |letter|\n if vowels.include?(letter) \n count += 1\n end\n end\n puts count\nend", "def count_vowels (string)\r\n array = []\r\n letters = string.split(\"\")\r\n array << letters\r\n array.each do | letters |\r\n vowels = []\r\n if letters == \"a\"\r\n vowels << letters\r\n elsif letters == \"e\"\r\n vowels << letters\r\n elsif letters == \"i\"\r\n vowels << letters\r\n elsif letters == \"o\"\r\n vowels << letters\r\n elsif letters == \"u\"\r\n else\r\n puts \"no\"\r\n end\r\n #puts array.include?(\"a\")\r\n end\r\nend", "def count_vowels(string)\n num_vowels = 0\n\n i = 0\n while i < string.length\n if (string[i] == \"a\" || string[i] == \"e\" || string[i] == \"i\" || string[i] == \"o\" || string[i] == \"u\")\n num_vowels += 1\n end\n\n i += 1\n end\n\n return num_vowels\nend", "def count_vowels(string)\ni = 0\nvowels = 0\n while i<string.length do\n if string[i] == \"a\" || string[i] == \"e\" || string[i] == \"i\" || string[i] == \"o\" || string[i] == \"u\"\n vowels += 1\n end\n i += 1\n end\nputs vowels\nend", "def count_vowels(string)\n string.downcase.count('aeiou')\nend", "def vowels(str)\n arr_of_vowels = []\n vowels = \"aeiou\"\n str.each_char do |char|\n if vowels.include?(char)\n arr_of_vowels << char\n end\n end\n arr_of_vowels\nend", "def num_vowels(str)\r\n # your code goes here\r\n\r\n vowels = [\"a\",\"A\",\"e\",\"E\",\"i\",\"I\",\"o\",\"u\",\"U\"]\r\n num_vowels = 0\r\n\r\n i = 0\r\n while i < str.length\r\n if vowels.include?(str[i])\r\n num_vowels += 1\r\n end\r\n i += 1\r\n\r\n end\r\n num_vowels\r\nend", "def VowelCount(str)\n\n # code goes here\n vowel = ['a','e','i','o','u']\n ary = str.split(//)\n counter = 0\n ary.each do |letter|\n if vowel.include? letter\n counter += 1\n end\n end\n return counter\n \nend", "def vowels (string)\r\n #Initialising empty vowels array\r\n vowels = []\r\n\r\n letters = string.split(\"\")\r\n letters.each do |vow|\r\n if vow == \"a\" || vow == \"e\" || vow == \"i\" || vow == \"o\" || vow == \"u\" || vow == \"A\" || vow == \"E\" || vow == \"I\" || vow == \"O\" || vow == \"U\"\r\n vowels.push(vow)\r\n end\r\n end\r\n return vowels\r\nend", "def vowels2(string)\r\n vowels_array = []\r\n string.scan(/[aeiouAEIOU]/) { |letter| vowels_array.push(letter)}\r\n return vowels_array\r\nend", "def num_vowels(str)\r\n # your code goes here\r\n vowels = ['a', 'e', 'i', 'o', 'u']\r\n num_vowels = 0\r\n str = str.downcase\r\n\r\n i = 0\r\n while i < str.length\r\n if vowels.include?(str[i])\r\n num_vowels += 1\r\n end\r\n i += 1\r\n end\r\n num_vowels\r\n\r\nend", "def count_vowels(str)\n str.count(\"aeoui\")\nend", "def getCount(inputStr)\n vowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n count = 0\n \n letters = inputStr.split(\"\")\n letters.each { |letter|\n if vowels.include?(letter)\n count += 1\n end\n }\n count\nend", "def count_vowels(str)\n str.chars.map do |letter|\n if vowel? letter\n letter = 1\n else\n letter = 0\n end\n end.reduce(0, :+)\nend", "def num_vowels(str)\n str.count(VOWELS)\nend", "def count_vowels(s)\n\tp s.count('aeiou')\nend", "def count_vowels(string)\n x = 0\n vowelcount = 0\n while string.length > x\n it = string[x]\n if it == \"a\" || it == \"e\" || it == \"i\" || it == \"o\" || it == \"u\"\n vowelcount += 1\n end\n x += 1\n end\n return vowelcount\nend", "def VowelCount(str)\n count = 0\n i = 0\n str = str.downcase.split(\"\")\n while i < str.length\n if str[i] == \"a\" || str[i] == \"e\" || str[i] == \"i\" || str[i] == \"o\" || str[i] == \"u\"\n count += 1\n end\n i += 1\n end\n return count\nend", "def countVowels(str='')\n str.scan(/[aeiou]/i).size\nend", "def num_vowels(str)\n vowels = 'aeiou'\n count = 0\n str.downcase.each_char do |char|\n count += 1 if vowels.include?(char)\n end\n count\nend", "def num_vowels(str)\n vowels = \"aeiou\"\n count = 0\n str.downcase.each_char do |char|\n if vowels.include?(char)\n count += 1\n end\n end\n return count\nend", "def num_vowels(str)\n vowels = \"aeiou\"\n count = 0\n str.downcase.each_char {|ch| count += 1 if vowels.include?(ch)}\n count\nend", "def num_vowels(str)\n # your code goes here\n vowel_count = 0\n vowels = 'aeiou'\n str.downcase.each_char do |ch|\n if vowels.include?(ch)\n vowel_count += 1\n end\n end\n vowel_count\nend", "def Vowel_Count(string)\n a_count=0\n e_count=0\n i_count=0\n o_count=0\n u_count=0\n for pos in 0..string.length\n word=string[pos]\n if (word==\"a\")\n a_count = a_count+1\n elsif(word==\"e\")\n e_count = e_count+1\n elsif(word==\"i\")\n i_count = i_count+1\n elsif(word==\"o\")\n o_count = o_count+1\n elsif(word==\"u\")\n u_count = u_count+1\n end\n end\n puts \"Number of A = #{a_count}\"\n puts \"Number of E = #{e_count}\"\n puts \"Number of I = #{i_count}\"\n puts \"Number of O = #{o_count}\"\n puts \"Number of U = #{u_count}\"\nend", "def vowel_count(string)\n\tcounter = 0\n\tletters = string.split(\"\")\n\tletters.each do |letter|\n\t\tif letter == \"a\"\n\t\t\tcounter += 1\n\t\telsif letter == \"e\"\n\t\t\tcounter += 1\n\t\telsif letter == \"i\"\n\t\t\tcounter += 1\n\t\telsif letter == \"o\"\n\t\t\tcounter += 1\n\t\telsif letter == \"u\"\n\t\t\tcounter += 1\n\t\tend\n\tend\n\tp counter\nend", "def vowel_recognition input\n\tinput, count = input.split(\"\").map! {|x| x =~ /[a,e,i,o,u,A,E,I,O,U]/ ? x = 1 : x = 0 }, 0\n\tinput.each_with_index { |x, ind| x == 0 ? 0 : count += ((ind + 1) * (input.length - ind)) } \n\tp count\nend", "def count_vowels(word)\nend", "def count_vowels(string)\r\n list = {}\r\n a = string.count(\"a\")\r\n e = string.count(\"e\")\r\n i = string.count(\"i\")\r\n o = string.count(\"o\")\r\n u = string.count(\"u\")\r\n list[\"a\"] = a\r\n list[\"e\"] = e\r\n list[\"i\"] = i\r\n list[\"o\"] = o\r\n list[\"u\"] = u\r\n list\r\nend", "def num_vowels(str)\n result = 0\n str.each_char do |chr|\n VOWELS.each do |vow|\n if chr == vow\n result +=1\n end\n end\n end\n result\nend", "def vowels\n return [\"a\", \"e\", \"i\", \"o\", \"u\", \"A\", \"E\", \"I\", \"O\", \"U\"]\nend", "def vowel_count (string)\n\n vowel_number = 0\n i = 0\n\n while( string.length() > i )\n\n if( (string[i] == \"a\") || (string[i] == \"e\") || (string[i] == \"i\") || (string[i] == \"o\") || (string[i] == \"u\") )\n vowel_number += 1\n end\n\n i += 1\n end\n\n return vowel_number\nend", "def num_vowels(str)\n # your code goes here\n new_str = str.downcase\n vowels ='aeiou'\n count = 0\n new_str.each_char do |char|\n if vowels.include?(char)\n count += 1\n end\n end\n\n count\nend", "def VowelCount(str)\n str.scan(/[aeiouAEIOU]/).count\nend", "def VowelCount(str)\n str.count \"aeiou\" \nend", "def VowelCount(str)\ncount=0\n\tarr=str.split(//)\n \tarr.each{|x| count=count+1 if x.match(/[aeiou]/) }\n \treturn count\nend", "def num_vowels(word)\r\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n word.chars.count {|ch| vowels.include?(ch.downcase)}\r\nend", "def number_of_vowels(string)\r\n count = string.downcase.scan(/[aeiou]/).size\r\n \r\n case count\r\n when 1\r\n \"There is 1 vowel in this word\"\r\n when 0 \r\n \"There are no vowels in this word\"\r\n else\r\n \"There are #{count} number of vowels\"\r\n end\r\n \r\nend", "def num_vowels(str)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\", \"A\", \"E\", \"I\",\"O\", \"U\"]\n count = 0\n\n chars = str.chars\n\n chars.each do |le|\n if vowels.index(le) != nil\n count += 1\n end\n\n end\n\n count\nend", "def VowelCount(str)\n count = 0\n \n str.each_char do |c|\n count += 1 if c =~ /[aeiou]/\n end\n \n return count\nend", "def vowel_count(str)\n str.downcase.count('aeiou')\nend", "def vowel_count(string)\n\t\n\tstring.downcase.count \"aeiou\"\n\t\nend", "def count_vowels(word)\n counter = 0\n i = 0\n while i < word.length\n if word[i] == 'a' ||\n word[i] == 'e' ||\n word[i] == 'i' ||\n word[i] == 'o' ||\n word[i] == 'u'\n counter += 1\n end\n i += 1\n end\n return counter\nend", "def num_vowels(str)\n # your code goes here\n str.downcase!\n str.count(\"aeiou\")\nend", "def vowels(line)\n vowels = 0\n line.each_char do |c|\n if c.scan(/[aeiou]/) != []\n vowels += 1\n end\n end\n\n return vowels\nend", "def count_vowels(word)\n\tcounter = 0\n \ti = 0\n \twhile i < word.length\n vowel = word[i]\n if vowel == \"a\" || vowel == \"e\" || vowel == \"i\" || vowel == \"o\" || vowel == \"u\"\n counter += 1\n end\n i += 1\n end\n return counter\nend", "def vowelCount(str)\n\tcount = 0\n\tstr = str.split('').each{|x| count += 1 if(%(a e i o u).include?(x))}\n\treturn count\nend", "def vowels\r\n matches = []\r\n self.split(//).each do |c| \r\n VOWELS.include?(c) ? (matches << c) : nil\r\n end\r\n matches\r\n end", "def vowel_count(word)\n count = 0 \n vowels = \"aeiou\"\n word.each_char do |char|\n if vowels.include?(char)\n count += 1\n end\n end\n\n return count\nend", "def vowels (string)\r\n # Your code here\r\n vowels = ['a','e','i','o','u']\r\n find = []\r\n for letter in string.chars\r\n find << letter if \r\n vowels.include?(letter.downcase)\r\nend\r\nreturn find\r\nend", "def VowelCount(str)\n\n # code goes here\n count = 0\n \n str.each_char do |letter|\n if letter =~ /[aeiou]/\n count += 1 \n end\n end\n \n return count\n \nend", "def vowels (string)\n # Your code here\n vowel_arr = []\n i = 0\n loop do\n vowel_arr.push(string[i]) if ['a','A','e','E','i','I','o','O','u','U'].include? string[i]\n return vowel_arr if string[i] == nil\n i +=1\n end \nend", "def vowel_count(word)\n count = 0\n vowels = \"aeiouAEIOU\"\n word.each_char do |char|\n if vowels.include?(char)\n count += 1\n end\n end\n return count\nend", "def vowel_recognition(s)\n (0...s.size).map {|i| s[i] =~ /[aeiou]/i ? (s.size - i) * (i + 1) : 0}.sum\nend", "def count_vowels(word)\n count = 0 \n \n i = 0 \n while i < word.length\n char = word[i]\n \n if char == \"a\" || char == \"e\" || char == \"i\" || char == \"o\" || char == \"u\"\n count += 1\n end\n\n i += 1\n end\n\n return count\nend", "def getCount(inputStr)\n vowels_arr=['a','e','i','o','u']\n num=0\n input_arr=inputStr.split(//)\n input_arr.each do |elem|\n vowels_arr.each do |elem2|\n if elem==elem2\n num+=1\n end\n end\n\n end\n\n return num\n\n\nend", "def vowel_counter(word)\n count = 0\n vowels = \"aeiouAEIOU\"\n word.each_char do |char|\n if vowels.include?(char)\n count += 1\n end\n end\n count\nend", "def vowels(string)\r\n new_string = []\r\n string.split(\"\").each do |letter|\r\n if letter == \"a\" || letter == \"e\" || letter == \"i\" || letter == \"o\" || letter == \"u\" ||letter == \"A\" || letter == \"E\" || letter == \"I\" || letter == \"O\" || letter == \"U\"\r\n new_string.push(letter)\r\n end\r\n end\r\n return new_string\r\nend", "def vowels(text)\n vowels = %w(A E I O U)\n chars = text.upcase.split('')\n vowel_count = 0\n\n chars.each { |c| vowel_count += 1 if vowels.include? c }\n\n vowel_count.to_f / text.length\n end", "def getCount(str)\n # str = \"abracadabra\" => 5\n vowels = [\"a\", \"i\", \"e\", \"o\", \"u\"]\n str.split(\"\").filter { |letter| vowels.include?(letter) }.count # filter is an alias for select\nend", "def count_vowels(word)\n\tvowels = [\"a\",\"e\",\"i\",\"o\",\"u\",\"A\",\"E\",\"I\",\"O\",\"U\"]\n \ti = 0\n \tcount = 0\n \twhile ( i < word.length)\n if( vowels.include? word[i] )\n count+=1\n end\n i+=1\n end\n return count\nend", "def vowels (string)\r\n if string.class == String\r\n vowels(string.split(\"\").concat([ [] ]))\r\n else \r\n if string[0].class == String \r\n case string[0]\r\n when \"A\",\"a\",\"E\",\"e\",\"I\",\"i\",\"O\",\"o\",\"U\",\"u\"\r\n vowels(string.slice(1..-2).concat( [string[-1].concat([string[0]])] ))\r\n else\r\n vowels(string.drop(1)) \r\n end \r\n else\r\n return string[0]\r\n end\r\n end\r\nend", "def VowelCount(str)\n\n counter = 0\n str.each_char do |x|\n if(x.match(/[aieou]/))\n counter += 1\n end\n end\n return counter\n \nend", "def solve(string)\n vowels = 'aeiou'\n string_of_chars = string.chars\n \n count = 0\n counted = []\n \n string_of_chars.each do |char|\n if vowels.include?(char)\n count += 1\n else\n count = 0\n end\n counted << [count]\n end\n counted.max.first\n end", "def count_vowels\n text.scan(/[aeoui]/).length\n end", "def vowel_counter(string, vowels_array, syllable_counter)\n string_by_word = string.split(' ')\n p string_by_word\n string_by_word.each do |word|\n p word\n vowels_array.each do |char|\n syllable_counter += word.count(char)\n end\n binding.pry\n # if word ends in E\n if word[-1] === 'e'\n syllable_counter -= 1\n end\n # if word ends in ES\n if word[-1] === 's'\n if word[-2] === 'e'\n syllable_counter -= 1\n end\n end\n # if word has 'AE'\n if word.include?('ae')\n syllable_counter -= 1\n end\n # if word has 'AI'\n if word.include?('ai')\n syllable_counter -= 1\n end\n # if word has 'DGE'\n if word.include?('dge')\n syllable_counter -= 1\n end\n # if word has 'EA'\n if word.include?('ea')\n syllable_counter -= 1\n end\n # if word has 'EI'\n if word.include?('ei')\n syllable_counter -= 1\n end\n # if word has 'GE'\n if word.include?('ge')\n syllable_counter -= 1\n end\n # if word has 'IE'\n if word.include?('ie')\n syllable_counter -= 1\n end\n # if word has 'OA'\n if word.include?('oa')\n syllable_counter -= 1\n end\n # if word has 'OI'\n if word.include?('oi')\n syllable_counter -= 1\n end\n # if word has 'OU'\n if word.include?('ou')\n syllable_counter -= 1\n end\n end\n # remove 21\n p syllable_counter\n end", "def count_vowels(word)\n totvow = 0 \n i = 0\n\n while i < word.length\n if word[i] == 'a' || word[i] == 'e' || word[i] == 'i' || word[i] == 'o' || word[i] == 'u'\n totvow += 1\n end\n\n i += 1\n end\n\n return totvow\nend", "def vowels (string)\n # Your code here\nend", "def getCount(input_str)\n regex = /[aeiou]/\n input_str.split('').select { |char| char if char =~ regex }.count\nend", "def vowel_cipher(string)\n vowels = \"aeiou\"\n print string.split(\"\")\nend", "def count_vowels(word)\n count = 0\n i = 0\n vowels = ['a', 'e', 'i', 'o', 'u']\n \n while i < word.length\n if vowels.include? word.downcase[i] # or char == \"a\" || char == \"e\" etc.\n count += 1\n end\n i += 1\n end\n \n return count\nend", "def vowel(*argString)\n strArray = []\n argString.each {|x|if x.scan(/[aeiou]/).count>=2\n strArray << x\n end}\n print strArray\n puts\nend", "def ordered_vowels(str)\n\tresult = []\nx = \"cat\"\ny = \"dog\"\n\tresult = (x..y).to_a\n\tresult\nend", "def ordered_vowel_words(str)\n\nvowels = [\"a\",\"e\",\"i\",\"o\",\"u\",\"y\"]\nsplitted_str = str.split(\"\")\narr = []\nresults = []\n\nsplitted_str.each { |letter| arr << letter if vowels.include?(letter)}\njust_vowels = arr.uniq.join(\"\")\narr_of_vowels = vowels.combination(just_vowels.length).to_a\n\n arr_of_vowels.each { |arr| results = str if arr.join(\"\") == just_vowels }\n results = \"\" if results.empty?\n results\nend", "def vowel_indices(word)\n word.enum_for(:scan, /[aeiouy]/i).map { Regexp.last_match.offset(0).first + 1 }\nend", "def vowels(string)\r\n # Your code here\r\n text = string.split(//)\r\n temp = []\r\n VOWELS.each do |v|\r\n text.each do |c|\r\n if v == c \r\n temp << c \r\n end\r\n end\r\n end\r\n temp \r\nend", "def count_vowels(datacontent)\n #initalize vowel_array\n vowel_list ={'a'=>0, 'e'=>0, 'i'=>0, 'o'=> 0, 'u'=>0}\n sum_of_vowels = 0\n datacontent.each_char do |i| \n vowel_list.each_key do |a|\n if i == a\n sum_of_vowels += 1\n vowel_list[i] += 1 \n end\n end\n end\n return vowel_list,sum_of_vowels\nend", "def count_of_upper_case_vowels\n strings = @new_content.map(&:capitalize).join.scan(/[#{VOWELS}][^#{VOWELS}]*/)\n total = 0\n\n (1..strings.size - 1).each do |index|\n prev_string = strings[index - 1]\n next unless prev_string.match(/[#{CONSONANTS.upcase}]/).nil?\n char = strings[index][0]\n next unless capitalized?(char) || (capitalized?(prev_string[0]) && prev_string.size > 2)\n total += 1\n strings[index][0] = char.upcase\n end\n total\n end", "def getCount(inputStr)\n inputStr.scan(/[aeiou]/).count\nend", "def vowels_6(words)\n words.downcase.match(/a|e|i|o|u/).to_s\nend", "def getCount(inputStr)\n inputStr.scan(/[aeiou]/i).size\nend", "def getCount(inputStr)\n inputStr.scan(/[aeiou]/i).size\nend", "def getCount(inputStr)\n inputStr.chars.count{|letter| letter=~/[aeiou]/}\nend", "def get_count(input_str)\n input_str.count \"aeiou\"\nend", "def vowel_finder(word)\n words_vowels = []\n vowel = \"aeiuo\"\n\n word.each_char.with_index do |char,i|\n if vowel.include?(char)\n words_vowels << i\n end\n end\n words_vowels\nend", "def location_of_vowels (the_name)\n\tlengthofname = the_name.length \n\ti = 0\n\tvowels_i=[]\n\twhile i < lengthofname\n\tif (the_name[i] == \"a\" || the_name[i] ==\"e\" || \n\tthe_name[i] == \"i\" || the_name[i] == \"o\" || \n\tthe_name[i] == \"u\")\n\tvowels_i << i \n\tend \n\ti+=1 \nend \nvowels_i\nend", "def checkvowel(str)\n vowels = {'a' => 0, 'e' => 0, 'i' => 0, 'o' => 0, 'u' => 0}\n count = 0\n str.split(\"\").each do|char|\n if !vowels[char].nil?\n vowels[char] += 1\n count += 1\n end\n end\n puts \"Vowels found: #{count}\"\n vowels.each do |k,v|\n puts \"#{k}: #{v}\"\n end\nend", "def get_count(input_str)\n input_str.downcase.count(\"aeiou\")\nend", "def getCount(inputStr)\n inputStr.count('aeiou')\nend", "def getCount(inputStr)\n inputStr.count('aeiou')\nend", "def getCount(inputStr)\n return inputStr.count(\"aeiou\")\nend" ]
[ "0.8288056", "0.8010037", "0.8001394", "0.78326744", "0.78217447", "0.77840394", "0.77683365", "0.77438056", "0.77401686", "0.771902", "0.7703744", "0.76755446", "0.76733327", "0.7657911", "0.76565087", "0.76490843", "0.7635598", "0.76141167", "0.76066214", "0.7603718", "0.7602933", "0.7595933", "0.7573183", "0.7572492", "0.75613755", "0.7558063", "0.75360614", "0.7535358", "0.7531385", "0.7526168", "0.7521494", "0.7510449", "0.7503823", "0.7494274", "0.7491652", "0.74898887", "0.7485617", "0.7474689", "0.74578816", "0.7412123", "0.74069405", "0.74009866", "0.73873967", "0.73767143", "0.73726934", "0.73489004", "0.7348188", "0.7309387", "0.7305611", "0.7300455", "0.7299932", "0.7299613", "0.7283761", "0.72833854", "0.7276581", "0.7268711", "0.726042", "0.7258636", "0.72531", "0.725294", "0.7246359", "0.72325325", "0.7232207", "0.7226374", "0.72235835", "0.72226256", "0.7208288", "0.72062606", "0.71908045", "0.71791345", "0.7175071", "0.71519077", "0.71278584", "0.7127404", "0.712543", "0.7114235", "0.6992776", "0.69813514", "0.697937", "0.69769484", "0.69702965", "0.6969979", "0.6937515", "0.69362617", "0.6897412", "0.6897237", "0.68727607", "0.6866868", "0.6861162", "0.6808035", "0.6808035", "0.67616373", "0.6758975", "0.6753168", "0.6751585", "0.67277205", "0.6699692", "0.66957176", "0.66957176", "0.66881645" ]
0.7597729
21
example move = (a2:a3), move piece at (6, 0) to square at (5, 0)
def move_piece(move, color) squares = find_start_and_end(move) # [start, end] return false if @display[squares[0][0]][squares[0][1]].guest == ' ' start_piece = @display[squares[0][0]][squares[0][1]].guest return false if start_piece.color != color moves = get_legal_moves(squares[0], start_piece, start_piece.poss_moves(squares[0])) if moves.include?(squares[1]) # castling if start_piece.id == 'king' && start_piece.color == 'white' && squares[1] == [7, 1] make_move(squares[0], squares[1], start_piece) make_move([7, 0], [7, 2], @display[0][0].guest) elsif start_piece.id == 'king' && start_piece.color == 'black' && squares[1] == [] make_move(squares[0], squares[1], start_piece) make_move([0, 0], [0, 2], @display[7][0].guest) # pawn -> queen upgrade elsif start_piece.id == 'pawn' && start_piece.color == 'white' && squares[1][0].zero? make_move(squares[0], squares[1], Queen.new('white')) elsif start_piece.id == 'pawn' && start_piece.color == 'black' && squares[1][0] == 7 make_move(squares[0], squares[1], Queen.new('black')) else make_move(squares[0], squares[1], start_piece) end else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_piece(from, to)\n return move_piece_in_square(@board[from], @board[to])\n end", "def move_piece(from, to)\n return move_piece_in_square(@board[from], @board[to])\n end", "def move_piece(org,dest)\n # remove catured piece if capture move\n if (dest[0] - org[0]).abs == 2\n captured_box = [org[0] + (dest[0]-org[0])/2 , org[1] + (dest[1]-org[1])/2]\n @pieces[captured_box[0]][captured_box[1]].remove\n end\n\n @pieces[org[0]][org[1]].remove\n @pieces[dest[0]][dest[1]] = draw_piece(dest[0],dest[1],@board.state[dest[0]][dest[1]])\nend", "def move(dest, crown?) # called in :turn > active_piece.move()\n # updates dest in board array\n # updates piece with new coordinates\n # updates jumped pieces?\nend", "def moves\n # All pieces can stay in place\n [[0,0]]\n end", "def move_piece(start_pos,end_pos)\n begin \n raise \"No piece here to move\" if grid[start_pos[0]][start_pos[1]].nil?\n raise \"Can't move to this spot\" if end_pos[0] > 7 || end_pos[0] < 0 || end_pos[1] > 7 || end_pos[1] < 0 \n self[start_pos], self[end_pos] = self[end_pos],self[start_pos]\n end\n end", "def do_the_move(move)\n @log.debug \"do_the_move #{move.move_to_str}\"\n color, row_s, col_s, row_e, col_e, movetype = strip_pos_argument(move)\n \n if check_if_moveisvalid(move) == :invalid\n @log.debug \"invalid move #{argument}, info#{@last_move_error}\"\n return\n end\n start_item = @infosquare[row_s][col_s]\n end_item = @infosquare[row_e][col_e]\n if movetype == :shortcastle or movetype ==:longcastle\n move_castle(start_item, end_item)\n elsif movetype == :enpassant\n col_enp = end_item.column_start\n row_enp = start_item.row_start\n eated_item = @infosquare[row_enp][col_enp]\n eated_item.clear\n BoardInfoItem.exchange(start_item, end_item)\n elsif movetype == :promotion\n BoardInfoItem.exchange(start_item, end_item)\n end_item.setinfo(move.promoted, move.color)\n else\n if @infosquare[row_s][col_s].type_piece == :vuoto\n raise \"Invalid board state, try to move an empty cell\"\n end\n BoardInfoItem.exchange(start_item, end_item)\n end\n move.fen_after_move = calculate_current_fen\n \n @last_moved_item = end_item\n @moves_in_match << move\n end", "def moves(board, start_pos)\n end", "def make_move start_pos, end_pos\n piece = get_board_piece(start_pos)\n @board[end_pos[0]][end_pos[1]] = piece\n piece.position = end_pos\n @board[start_pos[0]][start_pos[1]] = nil\n end", "def move\n move_by a, m\n end", "def move_pieces(move_pos)\n current_pos, next_pos = move_pos\n\n @board[next_pos[0]][next_pos[1]] = @board[current_pos[0]][current_pos[1]]\n @board[current_pos[0]][current_pos[1]] = nil\n end", "def move_pieces(move_pos)\n current_pos, next_pos = move_pos\n\n @board[next_pos[0]][next_pos[1]] = @board[current_pos[0]][current_pos[1]]\n @board[current_pos[0]][current_pos[1]] = nil\n end", "def move_to(x, y); end", "def perform_move(move)\n start_location = move[0]\n destination = move[1]\n i,j = start_location\n a,b = destination\n jumped = false\n #unless on_board?(destination)\n #raise error\n\n piece = @rows[i][j]\n all_possible_moves = piece.slide_moves(@rows) + piece.jump_moves(@rows)\n\n unless !all_possible_moves.include?(destination)#change to throw error\n\n jump = piece.jump_moves(@rows)\n if jump.include?(destination)\n jumped = true\n #removes jumped piece from board\n add = (piece.color == :white ? -1 : 1)\n if destination[1] > start_location[1]\n middle_b = destination[1] - 1\n middle_a = destination[0] + add\n delete_piece = @rows[middle_a][middle_b]\n delete_piece.location = nil\n @rows[middle_a][middle_b] = nil\n else\n middle_b = destination[1] + 1\n middle_a = destination[0] + add\n delete_piece = @rows[middle_a][middle_b]\n delete_piece.location = nil\n @rows[middle_a][middle_b] = nil\n end\n end\n\n @rows[i][j] = nil\n piece.location = [a,b]\n @rows[a][b] = piece\n end\n #checks if moved piece should be kinged, if so sets king to true\n piece.make_king\n if jumped\n #go_again unless (@rows[a][b]).jump_moves(@rows).nil?\n end\n end", "def move_piece(from, to)\n\t\tmoving_piece = @board.squares[from]\n\t\tputs \"Moved #{moving_piece.owner.color} #{moving_piece.rank} from #{from} to #{to}\"\n\t\tif @board.squares[to]\n\t\t\tcaptured_piece = @board.squares[to]\n\t\t\tputs \"Captured #{captured_piece.owner.color} #{captured_piece.rank}\"\n\t\tend\n\t\[email protected][to] = moving_piece\n\t\[email protected][from] = nil\n\tend", "def move_piece(position, origin, destination)\n # verbose way\n ro, co = origin\n piece = position[ro][co]\n position[ro][co] = EMPTY_SQUARE\n rd, cd = destination\n position[rd][cd] = piece\n # original way\n # piece = square_at(origin)\n # square_at(origin) = '_'\n # square_at(destination) = piece\n piece.location = destination\n piece.first_move if piece.is_a?(Pawn)\n position\n end", "def movement(row1, col1, board)\n\n possible_moves=Array.new\n if @color==\"white\"\n # checking square in front\n if row1+1<8 && board.get_square(row1+1,col1).occupied==false\n possible_moves <<[row1+1,col1]\n\n #checking 2 squares forward\n if @position==\"initial\" && !board.get_square(row1+2,col1).occupied\n possible_moves <<[row1+2,col1]\n end\n end\n\n # checking attacking squares\n if row1+1<8 && col1-1>=0\n atk_sq1 = board.get_square(row1+1,col1-1)\n\n if atk_sq1.occupied && atk_sq1.piece.color != @color || !atk_sq1.occupied && atk_sq1.en_passanted\n possible_moves <<[row1+1,col1-1]\n end\n end\n if row1+1<8 && col1+1<8\n atk_sq2 = board.get_square(row1+1,col1+1)\n if atk_sq2.occupied && atk_sq2.piece.color != @color || !atk_sq2.occupied && atk_sq2.en_passanted\n possible_moves <<[row1+1,col1+1]\n end\n end\n\n elsif @color==\"black\"\n # checking square in front\n if row1-1>=0 && board.get_square(row1-1,col1).occupied==false\n possible_moves <<[row1-1,col1]\n\n # checking for 2 squares forward\n if @position==\"initial\" && board.get_square(row1-2,col1).occupied==false\n possible_moves <<[row1-2,col1]\n end\n end\n\n # checking attacking squares\n if row1-1>=0 && col1-1>=0\n atk_sq1 = board.get_square(row1-1,col1-1)\n if (atk_sq1.occupied && atk_sq1.piece.color != @color) || (!atk_sq1.occupied && atk_sq1.en_passanted)\n possible_moves <<[row1-1,col1-1]\n end\n end\n if row1-1>=0 && col1+1<8\n atk_sq2 = board.get_square(row1-1,col1+1)\n if (atk_sq2.occupied && atk_sq2.piece.color != @color) || (!atk_sq2.occupied && atk_sq2.en_passanted)\n possible_moves <<[row1-1,col1+1]\n end\n end\n end\n\n #removing moves that go off the board\n possible_moves = possible_moves.select do |a|\n a[0]>=0 && a[0]<8 && a[1]>=0 && a[1]<8\n end\n\n return possible_moves\n\n end", "def move_to to\n\t\td = Distance.get( @square, to)\n\t\tmove d.dir( @square), to\n\tend", "def set_move(player, square_number)\n board_iterate do |element, row, col|\n @board[row][col] = player.piece if element == square_number\n end\n end", "def perform_move(move)\n @board[*move] = self\n @board[*@location] = nil\n @location = move\n @king = true if in_end_row?\n move\n end", "def move!(move)\n from = move[0]\n to = move[1]\n piece = self[from]\n\n #puts 'Moving piece from ' + from.to_s + ' to ' + to.to_s\n\n clear!(to)\n self[to] = piece\n self[from] = nil\n\n self\n end", "def move_piece(coord)\n @game.move_piece_to(coord)\n end", "def move_player (start, stop, piece)\r\n $board[stop[0]][stop[1]] = piece\r\n $board[start[0]][start[1]] = nil \r\n $board[stop[0]][stop[1]].turn += 1\r\n @prev_coord= [stop[0], stop[1]]\r\n @prev_delta_y = (stop[1] - start[1]).abs\r\n if piece.class == Pawn and (stop[1] == 7 or stop[1] == 0)\r\n promotion(stop, piece)\r\n end \r\n end", "def move(board)\n end", "def move(piece, column, row) \n piece.column = column\n piece.row = row\n @board[piece.column][piece.row] = piece\n end", "def do_the_move(argument)\r\n color, row_s, col_s, row_e, col_e = strip_pos_argument(argument)\r\n start_item = @infosquare[row_s][col_s]\r\n end_item = @infosquare[row_e][col_e]\r\n if movetype == :shortcastle or movetype ==:longcastle\r\n move_castle(start_item, end_item)\r\n elsif movetype == :enpassant\r\n col_enp = end_item.col\r\n row_enp = start_item.row\r\n eated_item = @infosquare[row_enp][col_enp]\r\n eated_item.clear\r\n else\r\n BoardInfoItem.exchange(start_item, end_item)\r\n end\r\n @last_moved_item = end_item\r\n \r\n end", "def move_piece!(from_pos, to_pos)\n piece = self[from_pos]\n raise 'piece cannot move like that' unless piece.moves.include?(to_pos)\n\n piece.prev_pos = from_pos\n piece.moved_during_match ||= true\n\n self[to_pos] = piece\n self[from_pos] = nil\n piece.pos = to_pos\n\n nil\n end", "def initiate_move(input)\n from_sq = board.squares[input[0]]\n to_sq = board.squares[input[1]]\n\n piece = from_sq.value\n\n piece.move(to_sq)\n end", "def make_move(moves)\n if moves[1][1].is_a?(Array)\n return multiple_jumps(moves)\n end\n\n check_input(moves)\n\n from, to = moves\n y,x = from\n\n piece = @rows[y][x]\n y,x = to\n\n # check if it can slide\n if piece.possible_slide?(y,x)\n # if it can slide... SLIDE IT!\n piece.slide_to(y,x)\n else\n # check if it can jump\n if valid_jump?(moves)\n # if can jump... JUMP IT!\n piece.jump_to(y,x)\n between = between(from, to)\n # kill the piece in between\n self[between].current_pos = nil\n else\n raise \"Invalid move.\"\n end\n end\n end", "def make_move(left,top)\n # get destination selected\n dest = get_clicked_box(left,top)\n # try to make the move on the board; @game.user_move returns false if move is not allowed\n if @game.user_move(@selected_piece, dest)\n # move the piece on the GUI boars\n move_piece(@selected_piece,dest)\n de_highlight(@selected_piece)\n deselect_piece\n # switch player turn after the move\n @game.switch_turn\n else\n # if move not allowed deselect and de highlight the piece\n de_highlight(@selected_piece)\n deselect_piece\n end\nend", "def move_piece(piece, start_arr, finish_arr)\n\t\tputs \"#{piece} at #{start_arr} moves to #{finish_arr}.\"\n\t\t@board[finish_arr] = @board[start_arr]\n\t\t@board[start_arr] = \"*\"\t\t\n\tend", "def get_move\n cols = %w(a b c d e f g h)\n rows = %w(8 7 6 5 4 3 2 1)\n\n from_pos, to_pos = nil, nil\n until from_pos && to_pos\n @display.draw\n if from_pos\n row, col = from_pos\n piece = @display.board[from_pos].class\n puts \"#{piece} at #{cols[col]}#{rows[row]} selected. Where to move to?\"\n to_pos = @display.get_keyboard_input\n else\n @display.reset_errors_notification\n puts \"#{@color.capitalize}'s move\"\n puts 'What piece do you want to move?'\n selection = @display.get_keyboard_input\n from_pos = selection if selection && valid_selection?(selection)\n end\n end\n [from_pos, to_pos]\n end", "def move; end", "def move; end", "def make_move(player)\n while true \n from, to = player.get_move\n break if valid_move?(from, to, player)\n puts \"Invalid move\"\n end\n move_piece(from, to)\n end", "def move_piece(board, move)\n # norm: <file_start><rank_start></file_end><rank_end>\n file_start = move.notation[0]\n rank_start = move.notation[1].to_i\n file_end = move.notation[2]\n rank_end = move.notation[3].to_i\n board[file_end][rank_end - 1] = board[file_start][rank_start - 1]\n board[file_start][rank_start - 1] = nil\n\n board\n end", "def moves\n\n end", "def move_piece(from_row, from_column, to_row, to_column)\n piece = @state[from_row][from_column] \n new_location = [to_row, to_column]\n @state[to_row][to_column] = piece.class.new(piece.color, new_location)\n @state[from_row][from_column] = nil\n \n moved_piece = @state[to_row][to_column]\n if moved_piece.class == Pawn\n special_pawn_rules(moved_piece, from_row, to_column)\n end\n # Once a move has been made, disallow\n disallow_all_en_passant(piece.color) # taking en_passant on enemy pawns \n end", "def move_piece(position_array)\n\n old_position = position_array[0]\n piece_to_move = board_obj.board[old_position[0]][old_position[1]]\n\n castling_move(position_array) if piece_to_move.instance_of?(King)\n pawn_move_two(position_array) if piece_to_move.instance_of?(Pawn)\n\n board_obj.board[old_position[0]][old_position[1]] = \" \"\n\n new_position = position_array[1]\n\n piece_to_move.new_position(new_position)\n new_square = board_obj.board[new_position[0]][new_position[1]]\n\n if enpassant_square(new_position)\n rank = new_position[0]\n file = new_position[1]\n\n adjust = piece_to_move.colour == 'WHITE' ? -1 : 1\n if board_obj.board[rank + adjust][file].instance_of?(Pawn)\n remove_piece(board_obj.board[rank+adjust][file])\n board_obj.board[rank + adjust][file] = ' '\n end\n\n end\n\n if new_square != \" \"\n remove_piece(new_square)\n @piece_taken = true\n else\n @piece_taken = false\n end\n\n board_obj.board[new_position[0]][new_position[1]] = piece_to_move\n end", "def move_piece(start_pos,end_pos)\n # debugger\n raise \"No piece at start position\" if self[start_pos].is_a?(NullPiece)\n raise \"Piece can not move there\" unless valid_move?(start_pos)\n current_piece = self[start_pos]\n\n self[end_pos] = current_piece\n self[start_pos] = NullPiece.instance\n end", "def moves\n end", "def move_piece2(from, to)\n # validate moves, if okay then move\n #\n #\n\n if get_piece(from[0], from[1]).valid_moves.include?(to)\n\n #piece_next_location = piece_current_location\n# get_piece(to[0], to[1]) = get_piece(from[0], from[1])\n #piece_current_location = nil\n# get_piece(from[0], from[1]) = nil\n else\n puts \"Invalid move, try again\"\n end\n end", "def move_piece(from, to)\n raise 'needs implementation'\n end", "def putmove(movetype,column,gen) #column refers to leftmost column in move\n #put pieces on board\n if movetype == 1\n @board.droppiece(currpieces[0],column)\n @board.droppiece(currpieces[1],column)\n elsif movetype == 2\n @board.droppiece(currpieces[1],column)\n @board.droppiece(currpieces[0],column)\n elsif movetype == 3\n @board.droppiece(currpieces[0],column)\n @board.droppiece(currpieces[1],column+1)\n elsif movetype == 4\n @board.droppiece(currpieces[1],column)\n @board.droppiece(currpieces[0],column+1)\n end \n setcurr(@nextpieces[0],@nextpieces[1])\n if gen\n gennext\n end\n end", "def make_move(square,char)\n @win_vecs[(square-1)/3].squares[(square-1)%3].fill=char\n end", "def move(current_position, desired_square)\n board.move(current_position, desired_square, current_player)\n end", "def move(move)\n\n \n \n \n \n\n if @rules.isCastleShort?(move)\n if move.piece.colour == :white\n r = \"h1\" ; r2 = \"f1\";\n else\n r = \"h8\"; r2= \"f8\";\n end\n m = Move.new(self, self.getSquare(r).occupancy, r2, r)\n self.move(m)\n elsif @rules.isCastleLong?(move)\n if move.piece.colour == :white\n r = \"a1\" ; r2 = \"d1\";\n else\n r = \"a8\"; r2= \"d8\";\n end\n m = Move.new(self, self.getSquare(r).occupancy, r2, r)\n self.move(m)\n end\n\n @pieces[move.piece.colour][move.piece.class.to_s.to_sym].delete(move.from)\n setSquare(move.from, nil)\n move.piece.firstMove = false\n setSquare(move.to, move.piece)\n\n return self\n end", "def move(board)\nend", "def move( from_square, to_square, promote_to = nil )\n\t\t\t@squares[to_square] = @squares[from_square]\n\t\t\t@squares[from_square] = nil\n\t\t\n\t\t\t@squares[to_square].square = to_square\n\n\t\t\t# handle en-passant captures\n\t\t\tif @squares[to_square].is_a?(Pawn) and to_square == @en_passant\n\t\t\t\t@squares[\"#{to_square[0, 1]}#{from_square[1, 1]}\"] = nil\n\t\t\tend\n\t\t\t# track last move for future en-passant captures\n\t\t\tif @squares[to_square].is_a?(Pawn) and\n\t\t\t (from_square[1, 1].to_i - to_square[1, 1].to_i).abs == 2\n\t\t\t\tif from_square[1, 1] == \"2\"\n\t\t\t\t\t@en_passant = \"#{from_square[0, 1]}3\"\n\t\t\t\telse\n\t\t\t\t\t@en_passant = \"#{from_square[0, 1]}6\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t@en_passant = nil\n\t\t\tend\n\t\t\t\n\t\t\tif @squares[to_square].is_a?(King) and # queenside castles\n\t\t\t from_square[0, 1] == \"e\" and to_square[0, 1] == \"c\"\n\t\t\t\trank = to_square[1, 1]\n\t\t\t\t@squares[\"d#{rank}\"] = @squares[\"a#{rank}\"]\n\t\t\t\t@squares[\"a#{rank}\"] = nil\n\n\t\t\t\t@squares[\"d#{rank}\"].square = \"d#{rank}\"\n\t\t\telsif @squares[to_square].is_a?(King) and # kingside castles\n\t\t\t from_square[0, 1] == \"e\" and to_square[0, 1] == \"g\"\n\t\t\t\trank = to_square[1, 1]\n\t\t\t\t@squares[\"f#{rank}\"] = @squares[\"h#{rank}\"]\n\t\t\t \t@squares[\"h#{rank}\"] = nil\n\n\t\t\t\t@squares[\"f#{rank}\"].square = \"f#{rank}\"\n\t\t\telsif not promote_to.nil? # pawn promotion\n\t\t\t\t@squares[to_square] = promote_to.new(self, to_square, @turn)\n\t\t\tend\n\t\t\t\n\t\t\t# advance the turn indicator\n\t\t\tnext_turn\n\t\t\t\n\t\t\tself\n\t\tend", "def make_move(move)\n\t\t@board[move]= $current_player\n\tend", "def play_move!( m )\n self.delete_if { |pos, piece| pos == m.to_coord || pos == m.captured_piece_coord }\n\n piece_moved = self.delete(m.from_coord)\n self[m.to_coord] = piece_moved\n\n if m.castled==1\n castling_rank = m.to_coord.rank.to_s\n [['g', 'f', 'h'], ['c', 'd', 'a']].each do |king_file, new_rook_file, orig_rook_file|\n #update the position of the rook corresponding to the square the king landed on\n\tif m.to_coord.file == king_file \n\t rook = self.delete(\"#{orig_rook_file}#{castling_rank}\")\n\t self[\"#{new_rook_file}#{castling_rank}\"] = rook\n\tend\n end\n end\n \n #TODO investigate why this method is getting called multiply per moves << Move.new\n return unless piece_moved\n ep_from_rank, ep_to_rank, ep_rank = EN_PASSANT_CONFIG[ piece_moved.side ]\n @en_passant_square = ( piece_moved.function == :pawn &&\n m.from_coord.rank == ep_from_rank && \n m.to_coord.rank == ep_to_rank ) ? m.from_coord.file + ep_rank.to_s : nil\n\n #reflect promotion\n if piece_moved && piece_moved.function == :pawn && m.to_coord.to_s.rank == piece_moved.promotion_rank\n self.delete(m.to_coord)\n self[m.to_coord] = Queen.new(piece_moved.side, :promoted)\n #puts self.to_s if m.to_coord == 'a8'\n #debugger if m.to_coord == 'a8'\n end\n \n self\n end", "def move board\n free_pieces = board.free_pieces\n piece = free_pieces.random\n moves = board.possible_moves(piece)\n return [piece.x, piece.y], moves.random \n end", "def move(piece, offset)\n raise 'Board already complete' if full?\n raise 'Square already occupied' unless @board[offset].nil?\n raise 'Game is over' unless @state == STATE_OK\n raise 'Not your turn' if piece == @last_piece_moved\n\n new_piece_array = @board.dup\n new_piece_array[offset] = piece\n Board.new(new_piece_array, piece, @computers_piece)\n end", "def move(start, end_pos)\n piece = self[start]\n available_moves = piece.valid_moves\n raise MoveNotAvailableError unless available_moves.include?(end_pos)\n piece.move_to(end_pos)\n rescue MoveNotAvailableError => e\n puts \"Piece cannot move to that location!\"\n raise e\n end", "def calculate_moves(piece, location)\n @x = location[0].to_i\n @y = location[1].to_i\n @possible_moves = []\n\n def add_straight_line_moves(index)\n move = \"#{@x + (index + 1)}#{@y}\" # Right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x}#{@y + (index + 1)}\" # Up\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y}\" # Left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x}#{@y - (index + 1)}\" # Down\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n end\n\n def add_diagonal_moves(index)\n move = \"#{@x + (index + 1)}#{@y + (index + 1)}\" # Up right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y - (index + 1)}\" # Down left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x + (index + 1)}#{@y - (index + 1)}\" # Down right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y + (index + 1)}\" # Up left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n end\n\n case piece\n\n when \"WhitePawn\"\n # 1 step forward\n move = \"#{@x}#{@y + 1}\"\n @possible_moves << move unless @board[move] != nil \n # Attack forward right\n move = \"#{@x + 1}#{@y + 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent \n @possible_moves << move \n end \n # Attack forward left\n move = \"#{@x - 1}#{@y + 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent \n @possible_moves << move \n end \n # 2 steps forward if its in the starting point\n move = \"#{@x}#{@y + 2}\"\n @possible_moves << move unless @y != 2 || path_blocked?(move) ||\n @board[move] != nil\n\n when \"BlackPawn\"\n # Same moves of the WhitePawn but reversed\n move = \"#{@x}#{@y - 1}\"\n @possible_moves << move unless @board[move] != nil \n \n move = \"#{@x + 1}#{@y - 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent\n @possible_moves << move \n end\n \n move = \"#{@x - 1}#{@y - 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent\n @possible_moves << move\n end\n \n move = \"#{@x}#{@y - 2}\"\n @possible_moves << move unless @y != 7 || path_blocked?(move) || @board[move]\n\n when \"Rook\"\n # 7 is the max distance between squares\n # The method is called 7 times to have a list of all possible targets ready\n 7.times { |index| add_straight_line_moves(index) }\n\n when \"Knight\"\n knight_moves = [[@x + 1, @y + 2], [@x + 2, @y + 1], \n [@x + 2, @y - 1], [@x + 1, @y - 2], \n [@x - 1, @y - 2], [@x - 2, @y - 1], \n [@x - 2, @y + 1], [@x - 1, @y + 2]]\n \n knight_moves.each do |move|\n move = \"#{move[0]}#{move[1]}\" \n @possible_moves << move unless out_of_bounds?(move) || friendly_piece?(move)\n end\n\n when \"Bishop\"\n 7.times { |index| add_diagonal_moves(index) }\n \n when \"Queen\"\n 7.times do |index|\n add_straight_line_moves(index)\n add_diagonal_moves(index)\n end\n \n when \"King\"\n # The King can move only 1 square away so the methods are called just once\n add_straight_line_moves(0)\n add_diagonal_moves(0)\n else\n\n end\n end", "def move_piece(start_pos, end_pos)\n raise InvalidMoveError unless valid_move?(start_pos, end_pos)\n if capture_move?(start_pos, end_pos)\n self[end_pos] = self[start_pos]\n self[start_pos] = NullPiece.instance\n else\n self[end_pos], self[start_pos] = self[start_pos], self[end_pos]\n end\n self[end_pos].pos = end_pos\n end", "def move!(start, end_pos)\n if self[start].moves.include?(end_pos)\n self[end_pos] = self[start]\n self[end_pos].pos = end_pos\n self[start] = NullPiece.new\n else\n puts \"Invalid Move! Try again.\"\n sleep(2)\n end\n end", "def make_move(move)\n if @max_depth == @prev_rows.size\n puts(\"max_depth of #{@max_depth} reached\") if @verbose\n return nil\n end\n\n offset = move[GS_PLAY_IDX]\n from = move[GS_PLAY_PAT]\n to = move[GS_PLAY_REPL]\n\n if @cur_row.index(from, offset) != offset\n dump_plays\n raise \"invalid replacement: cur_row=#{@cur_row}, from=#{from}, offset=#{offset}\"\n end\n raise \"too wide: maxwidth= #{@max_width}\" if @cur_row.size - from.size + to.size > max_width\n\n cached_move = move.dup\n\n cached_raw_row = @cur_raw_row.dup\n @prev_rows.push(cached_raw_row)\n @played_moves.push(cached_move)\n @cur_raw_row[offset...offset + from.size] = to\n @cur_row = compute_cur_row(@cur_raw_row)\n cached_row = @cur_row.dup\n cached_move[GS_PLAY_RESULT] = cached_row\n @cur_row\n end", "def move_piece_in_square(from_square, to_square)\n to_square.checker_piece = from_square.checker_piece\n from_square.checker_piece = nil\n end", "def move_piece_in_square(from_square, to_square)\n to_square.checker_piece = from_square.checker_piece\n from_square.checker_piece = nil\n end", "def move(board)\n \trandom_move(board)\n\tend", "def moves_pawn(color, a, b)\n \t_moves = []\n \tif color == :white\n \t\tif @board[a][b].piece.double == \"true\"\n \t\t\t_moves << [a, b + 2] if @board[a][b + 2].piece == nil \t\t\n \t\tend\n\n \t\tx, y = up(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << up(a, b) if @board[x][y].piece == nil\n \t\tend\n\n \t\tx, y = up_left(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << up_left(a, b) if (@board[x][y].piece != nil && @board[x][y].piece.color != color) || en_passant_left(a, b)\n \t\tend\n \t\t\n \t\tx, y = up_right(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << up_right(a, b) if (@board[x][y].piece != nil && @board[x][y].piece.color != color) || en_passant_right(a, b)\n \t\tend\n\n \telse\n \t\tif @board[a][b].piece.double == \"true\"\n \t\t\t_moves << [a, b - 2] if @board[a][b - 2].piece == nil\n \t\tend\n\n \t\tx, y = down(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << down(a, b) if @board[x][y].piece == nil\n \t\tend\n\n \t\tx, y = down_left(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << down_left(a, b) if (@board[x][y].piece != nil || @board[a][b].piece.color != color) || en_passant_left(a, b)\n \t\tend\n\n \t\tx, y = down_right(a, b)\n \t\tif off_board(x, y) == false\n \t\t\t_moves << down_right(a, b) if (@board[x][y].piece != nil || @board[a][b].piece.color != color) || en_passant_right(a, b)\n \t\tend\n \tend\n \treturn _moves.compact\n end", "def move_to!(x, y, z)\n @a1[0] = @a2[0] = @b1[0] = @b2[0] = x\n @a1[1] = @a2[1] = @d1[1] = @d2[1] = y\n @a1[2] = @b1[2] = @c1[2] = @d1[2] = z\n @a2[2] = @b2[2] = @c2[2] = @d2[2] = @a2[2] + z\n @b1[1] = @b2[1] = @c1[1] = @c2[1] = @b2[1] + y\n @c1[0] = @c2[0] = @d1[0] = @d2[0] = @d2[0] + x\n self\n end", "def move_to!(new_x, new_y)\n transaction do\n raise ArgumentError, \"#{type} has not moved.\" unless real_move?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n raise ArgumentError, 'That is an invalid move. Cannot capture your own piece.' if same_color?(occupying_piece)\n capture_piece!(occupying_piece) if square_occupied?(new_x, new_y)\n update(x_position: new_x, y_position: new_y)\n end\n end", "def pawn_move\n position_index = Generic.find_square_index(en_passant_move, board)\n\n colour == 'White' ? pawn_move_white(position_index) : pawn_move_black(position_index)\n end", "def next_state(state, move)\n # Deep copy position (is this the easiest way?)\n position = Marshal.load(Marshal.dump(state[:position]))\n player = state[:player]\n opp = opponent(player)\n pieces = Marshal.load(Marshal.dump(state[:pieces]))\n from = move[0]\n to = move[1]\n force_analysis = false\n check = false\n moving_piece = pieces[player].find { |piece| piece.location == from }\n if !moving_piece\n puts \"ERROR--no piece to move!\"\n end\n # Check for capture\n if position[to[0]][to[1]] != \".\"\n # Remove enemy piece\n pieces[opp].delete_if { |piece| piece.location == to }\n # Force AI to continue analysis\n force_analysis = true\n end\n # Check for promotion\n if moving_piece.class == Pawn && to[0] == end_row(player)\n # Replace pawn with queen\n # (Underpromotion not yet implemented)\n pieces[player].delete(moving_piece)\n moving_piece = Queen.new(self, to, player)\n pieces[player] << moving_piece\n end\n # Move piece\n position[from[0]][from[1]] = \".\"\n position[to[0]][to[1]] = moving_piece.icon\n moving_piece.location = to\n # Complete castling by moving rook\n if moving_piece.class == ChessKing && (from[1] - to[1]).abs == 2\n rook_column = to[1] == 6 ? 7 : 0\n castling_rook = pieces[player].find { |piece| piece.location == [from[0], rook_column] }\n if castling_rook\n rook_dest = to[1] == 6 ? 5 : 3\n position[from[0]][rook_column] = \".\"\n position[to[0]][rook_dest] = castling_rook.icon\n castling_rook.location = [to[0], rook_dest]\n else\n puts \"Castling error -- can't find rook!\"\n end\n end\n # Switch active player\n next_player = opp\n # # Create new state for testing whether king is in check\n # new_position_state = {\n # :position => position,\n # :player => player,\n # :pieces => pieces,\n # :check => false,\n # :force_analysis => false\n # }\n # # Test whether opponent's king is now in check\n # check = check?(new_position_state)\n # force_analysis = true if check\n # Return new state\n {\n :position => position,\n :player => next_player,\n :pieces => pieces,\n :check => check,\n :force_analysis => force_analysis\n }\n end", "def commit_move!(start_pos, end_pos, count = true)\n self.turn_count = 1 + turn_count.to_i if count\n current_piece = self[start_pos]\n self[end_pos].move_to([10,10]) if self[end_pos].is_a?(Piece)\n swap_positions(start_pos, end_pos, current_piece, EmptySquare.new, true)\n promote_last_lines\n end", "def move(start_pos, end_pos)\n return false unless valid_move?(start_pos, end_pos)\n\n moving_piece = piece_at(start_pos)\n\n @grid[end_pos[0]][end_pos[1]] = moving_piece\n @grid[start_pos[0]][start_pos[1]] = nil\n\n moving_piece.moved = true if moving_piece.is_a?(Pawn)\n true\n end", "def nextMove(n,r,c,grid)\n # place m on grid at r,c\n actions = generate_path(grid, 'm','p')\n puts actions[0]\n grid[r][c] = '-'\n if actions[0] == 'LEFT'\n grid[r][c-1]='m'\n elsif actions[0] == 'RIGHT'\n grid[r][c+1]='m'\n elsif actions[0] == 'UP'\n grid[r-1][c]='m'\n elsif actions[0] == 'DOWN'\n grid[r+1][c]='m'\n end\n actions[0]\n end", "def move_piece(from, to)\n piece = self.at(from)\n self.set_at(from, nil)\n self.set_at(to, piece)\n end", "def move_piece!(start_pos, end_pos)\n piece = self[start_pos]\n raise 'piece cannot move like that' unless piece.moves.include?(end_pos)\n\n self[end_pos] = piece\n self[start_pos] = sentinel\n piece.pos = end_pos\n\n nil\n end", "def move_piece!(start_pos, end_pos)\n piece = self[start_pos]\n raise 'piece cannot move like that' unless piece.moves.include?(end_pos)\n\n self[end_pos] = piece\n self[start_pos] = sentinel\n piece.pos = end_pos\n\n nil\n end", "def apply_move(s)\n # puts \"\\nApplying move...\" #NICE TO HAVE\n s[:moves][s[:prospective_move][:y]][s[:prospective_move][:x]] = s[:m]\n derive_moves_metadata(s)\nend", "def moves; [] end", "def move(board)\n @board = board\n valid_moves = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"]\n\n case\n when winning_move\n (winning_move + 1).to_s\n when blocking_move\n (blocking_move + 1).to_s\n when center?\n \"5\"\n when opposite_corner\n opposite_corner\n when corner\n (corner + 1).to_s\n else\n until !board.taken?(input)\n valid_moves.sample\n end\n end\n end", "def move_piece(from, to)\n piece = @board[from[0]][from[1]]\n dest_piece = @board[to[0]][to[1]]\n\n dest_piece.player.pieces.delete(dest_piece) unless dest_piece.nil?\n @board[from[0]][from[1]] = nil\n @board[to[0]][to[1]] = piece\n \n piece.pos = [to[0], to[1]]\n end", "def move_piece!(start_pos, end_pos)\n null = NullPiece.instance\n if self[start_pos].class == King\n if self[start_pos].color == :black\n @black_king_pos = end_pos\n else\n @white_king_pos = end_pos\n end\n end\n if pawn_promotion?(start_pos, end_pos)\n color = self[start_pos].color\n self[start_pos] = null\n Queen.new(self, end_pos, color)\n else\n self[start_pos].pos = end_pos\n self[end_pos], self[start_pos] = self[start_pos], null\n end\n end", "def make_a_move(move, mat, y, x)\n if move == :up\n move_up(mat, y, x)\n elsif move == :down\n move_down(mat, y, x)\n elsif move == :right\n move_right(mat, y, x)\n else\n move_left(mat, y, x)\n end\nend", "def take_moves(pieces)\n\t\tarrPos = []\n\t\tif team == 1\n\t\t\tarrPos << [@xCord - 1, @yCord + 1] if square_taken_opponent?(pieces, [@xCord - 1, @yCord + 1])\n\t\t\tarrPos << [@xCord + 1, @yCord + 1] if square_taken_opponent?(pieces, [@xCord + 1, @yCord + 1])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord - 1, @yCord - 1] if square_taken_opponent?(pieces, [@xCord - 1, @yCord - 1])\n\t\t\tarrPos << [@xCord + 1, @yCord - 1] if square_taken_opponent?(pieces, [@xCord + 1, @yCord - 1])\n\t\tend\n\t\tarrPos\t\n\tend", "def move_to(piece)\r\n cols = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']\r\n rows = [1, 2, 3, 4, 5, 6, 7, 8]\r\n counter = 0; x = ''; y = ''\r\n until counter == 1\r\n print \"Enter destination coordinates: \"\r\n coordinate = STDIN.gets.chomp\r\n x = coordinate[0]; y = coordinate[1].to_i\r\n counter+=1 if ((cols.include? x) && (rows.include? y))\r\n end\r\n puts ''\r\n puts \"#{piece.class} to #{x}#{y}.\"\r\n stop = []\r\n stop[0] = cols.index(x)\r\n stop[1] = rows.index(y)\r\n stop \r\n end", "def move_piece(from, to)\n from = @browser.image(:id, /img_chessboard.*#{from}/)\n to = @browser.image(:id, /img_chessboard.*#{to}/)\n\n\n attempt = -> () do\n begin \n #Selenium race condition requires error handling\n return nil if (!from.exists? || !to.exists?) && (from.visible? && to.visible?)\n\n from.drag_and_drop_on(to)\n return 1\n rescue Selenium::WebDriver::Error::ObsoleteElementError, \n Watir::Exception::UnknownObjectException, \n Selenium::WebDriver::Error::MoveTargetOutOfBoundsError, \n Selenium::WebDriver::Error::UnknownError\n return nil\n end\n end\n\n count = 5\n while attempt.call == nil && count != 0\n count -= 1 #try again\n end\n end", "def move_piece(move)\n curr_piece = @board[move[0]]\n if curr_piece.non_check_moves.include?(move[1])\n #if en passant, remove captured piece\n if curr_piece.class == Pawn\n #puts curr_piece.can_en_passant?\n #puts \"HELKFDSJLFKD\"\n if curr_piece.can_en_passant?\n #puts \"HOMFDMSKFDFLSJFKDSLFJSDKLF JDSFKLSJFKLEJ FE FJSKLF\"\n rank = move[0][0]\n col = move[1][1]\n captured_pawn_pos = [rank,col]\n #puts captured_pawn_pos.inspect\n @board[captured_pawn_pos] = nil\n end\n end\n @board[move[1]] = curr_piece\n @board[move[0]] = nil\n curr_piece.move_history << move\n curr_piece.pos = move[1]\n #if castling, move rook too\n if curr_piece.class == King && (move[0][1] - move[1][1]).abs == 2\n #find the appropriate rook to move\n start_rank = move[0][0]\n start_file = move[1][1] == 2 ? 0 : 7\n start_pos = [start_rank, start_file]\n rook = @board[start_pos]\n #determine its final location, then move it.\n end_file = start_file == 0 ? 3 : 5\n end_pos = [start_rank, end_file]\n @board[end_pos] = rook\n @board[start_pos] = nil\n rook.move_history << end_pos\n rook.pos = end_pos\n end\n return true\n else\n puts \"Your king is still in check!\" if @board.in_check?(curr_piece.color)\n puts \"Not a legal move for this #{curr_piece.color} #{curr_piece.class}!\"\n puts\n return false\n end\n end", "def move(start, finish)\n\t\ta, b = start\n\t\tx, y = finish\n\t\tif @board[a][b].piece.class.name == \"Pawn\"\n\t\t\t@board[a][b].piece.double = \"false\"\n\t\t\tif y - b == 2 || y - b == -2\n\t\t\t\t@board[a][b].piece.en_passant = true\n\t\t\tend\n\t\tend\n\t\tif @board[a][b].piece.class.name == \"King\" || @board[a][b].piece.class.name == \"Rook\"\n\t\t\t@board[a][b].piece.castling = false\n\t\tend\n\t\tif @board[a][b].piece.class.name == \"King\" && (x - a >= 2 || x - a <= 2)\n\t\t\tif (x - a >= 2)\n\t\t\t\tcastle_right(a, b, x, y)\n\t\t\telse\n\t\t\t\tcastle_left(a, b, x, y)\n\t\t\tend\n\t\t\treturn\n\t\tend\n\t\t@board[x][y].piece = @board[a][b].piece\n\t\t@board[a][b].piece = nil\n\t\tremove_en_passant(x, y)\n\t\tif @board[x][y].piece.class.name == \"Pawn\"\n\t\t\tcheck_promotion(x, y)\n\t\tend\n\tend", "def move_piece!(start_pos,end_pos)\n piece=self[start_pos]\n raise 'Piece cannot move like that' unless piece.moves.include?(end_pos)\n self[end_pos]=piece\n self[start_pos]=sentinel\n piece.pos=end_pos\n nil\n end", "def slide_moves\n dirs = (@dir == :up ? UP_DIRS : DOWN_DIRS)\n dirs = DOWN_DIRS + UP_DIRS if king\n\n dirs.each_with_object([]) do |dir, moves|\n new_square = add_dir(pos, dir)\n unless [email protected]_board?(new_square) || @board[*new_square]\n moves << [pos, new_square]\n end\n end\n end", "def test_move_should_not_change_peice_properties\n board = RulesEngine.new()\n src = A2\n dest = A3\n board.move_piece(src, dest)\n assert(board.sq_at(src).piece.nil?)\n assert(!board.sq_at(dest).piece.nil?)\n assert(board.sq_at(dest).piece.colour.white?)\n assert(board.sq_at(dest).piece.name == Chess::Piece::PAWN)\n end", "def move\n puts \"The computer is playing...\".cyan\n sleep(0.5) #computer \"thinks\" for half a second, this seemed more realistic\n return if @game.game_over?\n space = (@game.available_moves & [1,3,5,7,9]).first\n if space.nil? \n space = @game.available_moves.first\n end\n @game.place_piece(space, @piece)\n end", "def move_piece!(color, from, to)\n raise \"There is no piece in that square\" if from.empty?\n raise \"Moving onto your own piece\" if color == self[to].color\n\n taken_piece = self[to].dup unless self[to].symbol == :n\n self[to] = NullPiece.instance # \"Take\" opponent's pieces\n self[from].pos = to\n self[from], self[to] = self[to], self[from]\n\n taken_piece\n end", "def each_move\n SQ.select { |i| @colors[i] == @mx }.each do |f|\n if @pieces[f] == PAWN\n t = f + UP[@mx]\n yield(f, t + 1) if @colors[t + 1] == @mn && SQ120[SQ64[t] + 1] != NULL\n yield(f, t - 1) if @colors[t - 1] == @mn && SQ120[SQ64[t] - 1] != NULL\n next unless @colors[t] == EMPTY\n yield(f, t)\n yield(f, t + UP[@mx]) if @colors[t + UP[@mx]] == EMPTY && (f >> 3) == (SIDE[@mx] - 1).abs\n next\n end\n STEPS[@pieces[f]].each do |s|\n t = SQ120[SQ64[f] + s]\n while t != NULL\n yield(f, t) if @colors[t] != @mx\n break if @pieces[f] == KING || @pieces[f] == KNIGHT || @colors[t] != EMPTY\n t = SQ120[SQ64[t] + s]\n end\n end\n end\n end", "def pawn_move? piece, square\n if piece.moved == false && two_squares_vertical?(piece.square, square) && square.piece.nil?\n true\n elsif (diagonal?(piece.square, square) && adjacent?(piece.square, square)) && square.piece != nil\n true\n elsif vertical?(piece.square, square) && adjacent?(piece.square, square)\n pawn_direction?(piece, square)\n else\n false\n end\n end", "def move\n\n end", "def update_move\n if [email protected]? && @moves.size > 0\n @moves.shift if proccess_move(@moves[0])\n end\n end", "def get_moves(pieces)\n\t\tarrPos = [] \n\t\tif team == 1\n\t\t\tarrPos << [@xCord, @yCord + 1] if square_is_open?(pieces, [@xCord, @yCord + 1])\n\t\t\tarrPos << [@xCord, @yCord + 2] if @yCord == 1 && square_is_open?(pieces, [@xCord, @yCord + 2])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord, @yCord - 1] if square_is_open?(pieces, [@xCord, @yCord - 1])\n\t\t\tarrPos << [@xCord, @yCord - 2] if @yCord == 6 && square_is_open?(pieces, [@xCord, @yCord - 2])\n\t\tend\n\t\tarrPos\n\tend", "def setup_move\n return TSBS.error(@acts[0], 4, @used_sequence) if @acts.size < 5\n stop_all_movements\n goto(@acts[1], @acts[2], @acts[3], @acts[4], @acts[5] || 0)\n end", "def user_move(start, finish)\n start , finish = Board.pos_to_coord(start), Board.pos_to_coord(finish)\n self[finish] = self[start]\n self[start] = NullPiece.instance\n self[finish].position = finish\n end", "def move(from, to, left_behind = ' ')\n piece = board[from[0]][from[1]]\n piece.position = [to[0], to[1]]\n piece.n = 0\n board[from[0]][from[1]] = left_behind\n board[to[0]][to[1]] = piece\n end", "def play_move(move)\n found_cell = false\n @state[move].map! do |cell|\n if (!found_cell && cell == :e)\n found_cell = true\n next_mover\n else\n cell\n end\n end\n \n @move_count += 1\n end", "def execute_move(start_pos, end_pos, turn_num)\n #check if piece at start_pos is of the right color (matches the turn number)\n\n color_to_move = (turn_num.even? ? :white : :black)\n if (@board[start_pos].color != color_to_move )\n raise InvalidMoveError.new(\"You must move a piece of your own color\")\n end\n\n @board.move(start_pos, end_pos)\n end", "def move\n \n end", "def move\n \n end" ]
[ "0.7368139", "0.7368139", "0.72732013", "0.7250606", "0.7248146", "0.72313404", "0.72233725", "0.7214407", "0.71581626", "0.71577424", "0.715606", "0.715606", "0.7111271", "0.7094672", "0.7074128", "0.7031068", "0.69940686", "0.69904965", "0.6987864", "0.69729817", "0.69569963", "0.6932801", "0.6932719", "0.6924224", "0.6918341", "0.69149673", "0.6913781", "0.6911058", "0.68954283", "0.68865526", "0.6871445", "0.6861553", "0.6848765", "0.6848765", "0.68478936", "0.6843557", "0.6840812", "0.68379354", "0.683069", "0.68256754", "0.68251276", "0.6818245", "0.68015015", "0.6797095", "0.6787457", "0.67860293", "0.6784444", "0.6776938", "0.67553204", "0.67492366", "0.6747722", "0.6735829", "0.6730971", "0.6730531", "0.6727724", "0.67201567", "0.67119443", "0.67109424", "0.66976625", "0.66976625", "0.6692984", "0.6687131", "0.66820884", "0.6672802", "0.6665936", "0.66637343", "0.66587365", "0.66482866", "0.66419494", "0.6628712", "0.6614042", "0.6614042", "0.6611942", "0.6609871", "0.6607025", "0.6601838", "0.6600985", "0.6599563", "0.6597475", "0.6594423", "0.65918696", "0.6581143", "0.6569015", "0.6566145", "0.6565345", "0.6558427", "0.65566933", "0.65389127", "0.6537167", "0.6526501", "0.65183616", "0.6517019", "0.65151167", "0.6513227", "0.6510941", "0.65058213", "0.6503376", "0.64938", "0.6489256", "0.6489256" ]
0.7035671
15
methods for moving a piece on the board
def find_start_and_end(move) mv_start = move[0..1].split('') mv_end = move[3..4].split('') start_row = 8 - mv_start[1].to_i start_col = @@horizontal_key[mv_start[0].downcase] start_location = [start_row, start_col] end_row = 8 - mv_end[1].to_i end_col = @@horizontal_key[mv_end[0].downcase] end_location = [end_row, end_col] [start_location, end_location] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(dest, crown?) # called in :turn > active_piece.move()\n # updates dest in board array\n # updates piece with new coordinates\n # updates jumped pieces?\nend", "def move_piece(coord)\n @game.move_piece_to(coord)\n end", "def move(piece, column, row) \n piece.column = column\n piece.row = row\n @board[piece.column][piece.row] = piece\n end", "def move_piece(from, to)\n return move_piece_in_square(@board[from], @board[to])\n end", "def move_piece(from, to)\n return move_piece_in_square(@board[from], @board[to])\n end", "def move(board)\n end", "def move_piece(from_row, from_column, to_row, to_column)\n piece = @state[from_row][from_column] \n new_location = [to_row, to_column]\n @state[to_row][to_column] = piece.class.new(piece.color, new_location)\n @state[from_row][from_column] = nil\n \n moved_piece = @state[to_row][to_column]\n if moved_piece.class == Pawn\n special_pawn_rules(moved_piece, from_row, to_column)\n end\n # Once a move has been made, disallow\n disallow_all_en_passant(piece.color) # taking en_passant on enemy pawns \n end", "def move_piece fr, fc, tr, tc\r\n puts \"Moving X from #{fr}, #{fc} to #{tr}, #{tc}\"\r\n current = @board[fr][fc]\r\n @board[fr][fc]= 0\r\n @board[tr][tc]=current\r\n\r\n end", "def move_piece(from, to)\n\t\tmoving_piece = @board.squares[from]\n\t\tputs \"Moved #{moving_piece.owner.color} #{moving_piece.rank} from #{from} to #{to}\"\n\t\tif @board.squares[to]\n\t\t\tcaptured_piece = @board.squares[to]\n\t\t\tputs \"Captured #{captured_piece.owner.color} #{captured_piece.rank}\"\n\t\tend\n\t\[email protected][to] = moving_piece\n\t\[email protected][from] = nil\n\tend", "def move\n puts \"The computer is playing...\".cyan\n sleep(0.5) #computer \"thinks\" for half a second, this seemed more realistic\n return if @game.game_over?\n space = (@game.available_moves & [1,3,5,7,9]).first\n if space.nil? \n space = @game.available_moves.first\n end\n @game.place_piece(space, @piece)\n end", "def move(board)\nend", "def move_piece(from, to)\n raise 'needs implementation'\n end", "def move_piece(row_new = @row_new, col_new = @col_new, row = @row, col = @col)\n @chess_board.board[row_new][col_new] = @chess_board.board[row][col]\n end", "def move_piece(start_pos,end_pos)\n begin \n raise \"No piece here to move\" if grid[start_pos[0]][start_pos[1]].nil?\n raise \"Can't move to this spot\" if end_pos[0] > 7 || end_pos[0] < 0 || end_pos[1] > 7 || end_pos[1] < 0 \n self[start_pos], self[end_pos] = self[end_pos],self[start_pos]\n end\n end", "def move_piece(position_array)\n\n old_position = position_array[0]\n piece_to_move = board_obj.board[old_position[0]][old_position[1]]\n\n castling_move(position_array) if piece_to_move.instance_of?(King)\n pawn_move_two(position_array) if piece_to_move.instance_of?(Pawn)\n\n board_obj.board[old_position[0]][old_position[1]] = \" \"\n\n new_position = position_array[1]\n\n piece_to_move.new_position(new_position)\n new_square = board_obj.board[new_position[0]][new_position[1]]\n\n if enpassant_square(new_position)\n rank = new_position[0]\n file = new_position[1]\n\n adjust = piece_to_move.colour == 'WHITE' ? -1 : 1\n if board_obj.board[rank + adjust][file].instance_of?(Pawn)\n remove_piece(board_obj.board[rank+adjust][file])\n board_obj.board[rank + adjust][file] = ' '\n end\n\n end\n\n if new_square != \" \"\n remove_piece(new_square)\n @piece_taken = true\n else\n @piece_taken = false\n end\n\n board_obj.board[new_position[0]][new_position[1]] = piece_to_move\n end", "def move_piece(start_pos,end_pos)\n # debugger\n raise \"No piece at start position\" if self[start_pos].is_a?(NullPiece)\n raise \"Piece can not move there\" unless valid_move?(start_pos)\n current_piece = self[start_pos]\n\n self[end_pos] = current_piece\n self[start_pos] = NullPiece.instance\n end", "def move(piece, offset)\n raise 'Board already complete' if full?\n raise 'Square already occupied' unless @board[offset].nil?\n raise 'Game is over' unless @state == STATE_OK\n raise 'Not your turn' if piece == @last_piece_moved\n\n new_piece_array = @board.dup\n new_piece_array[offset] = piece\n Board.new(new_piece_array, piece, @computers_piece)\n end", "def move_piece(move)\n curr_piece = @board[move[0]]\n if curr_piece.non_check_moves.include?(move[1])\n #if en passant, remove captured piece\n if curr_piece.class == Pawn\n #puts curr_piece.can_en_passant?\n #puts \"HELKFDSJLFKD\"\n if curr_piece.can_en_passant?\n #puts \"HOMFDMSKFDFLSJFKDSLFJSDKLF JDSFKLSJFKLEJ FE FJSKLF\"\n rank = move[0][0]\n col = move[1][1]\n captured_pawn_pos = [rank,col]\n #puts captured_pawn_pos.inspect\n @board[captured_pawn_pos] = nil\n end\n end\n @board[move[1]] = curr_piece\n @board[move[0]] = nil\n curr_piece.move_history << move\n curr_piece.pos = move[1]\n #if castling, move rook too\n if curr_piece.class == King && (move[0][1] - move[1][1]).abs == 2\n #find the appropriate rook to move\n start_rank = move[0][0]\n start_file = move[1][1] == 2 ? 0 : 7\n start_pos = [start_rank, start_file]\n rook = @board[start_pos]\n #determine its final location, then move it.\n end_file = start_file == 0 ? 3 : 5\n end_pos = [start_rank, end_file]\n @board[end_pos] = rook\n @board[start_pos] = nil\n rook.move_history << end_pos\n rook.pos = end_pos\n end\n return true\n else\n puts \"Your king is still in check!\" if @board.in_check?(curr_piece.color)\n puts \"Not a legal move for this #{curr_piece.color} #{curr_piece.class}!\"\n puts\n return false\n end\n end", "def move_piece(org,dest)\n # remove catured piece if capture move\n if (dest[0] - org[0]).abs == 2\n captured_box = [org[0] + (dest[0]-org[0])/2 , org[1] + (dest[1]-org[1])/2]\n @pieces[captured_box[0]][captured_box[1]].remove\n end\n\n @pieces[org[0]][org[1]].remove\n @pieces[dest[0]][dest[1]] = draw_piece(dest[0],dest[1],@board.state[dest[0]][dest[1]])\nend", "def moves(board, start_pos)\n end", "def move_player (start, stop, piece)\r\n $board[stop[0]][stop[1]] = piece\r\n $board[start[0]][start[1]] = nil \r\n $board[stop[0]][stop[1]].turn += 1\r\n @prev_coord= [stop[0], stop[1]]\r\n @prev_delta_y = (stop[1] - start[1]).abs\r\n if piece.class == Pawn and (stop[1] == 7 or stop[1] == 0)\r\n promotion(stop, piece)\r\n end \r\n end", "def move!(move)\n from = move[0]\n to = move[1]\n piece = self[from]\n\n #puts 'Moving piece from ' + from.to_s + ' to ' + to.to_s\n\n clear!(to)\n self[to] = piece\n self[from] = nil\n\n self\n end", "def move_piece(piece, start_arr, finish_arr)\n\t\tputs \"#{piece} at #{start_arr} moves to #{finish_arr}.\"\n\t\t@board[finish_arr] = @board[start_arr]\n\t\t@board[start_arr] = \"*\"\t\t\n\tend", "def move_piece!(from_pos, to_pos)\n piece = self[from_pos]\n raise 'piece cannot move like that' unless piece.moves.include?(to_pos)\n\n piece.prev_pos = from_pos\n piece.moved_during_match ||= true\n\n self[to_pos] = piece\n self[from_pos] = nil\n piece.pos = to_pos\n\n nil\n end", "def moves\n # All pieces can stay in place\n [[0,0]]\n end", "def move; end", "def move; end", "def moves\n end", "def perform_move(move)\n @board[*move] = self\n @board[*@location] = nil\n @location = move\n @king = true if in_end_row?\n move\n end", "def move_piece(from, to)\n piece = self.at(from)\n self.set_at(from, nil)\n self.set_at(to, piece)\n end", "def perform_move(move)\n start_location = move[0]\n destination = move[1]\n i,j = start_location\n a,b = destination\n jumped = false\n #unless on_board?(destination)\n #raise error\n\n piece = @rows[i][j]\n all_possible_moves = piece.slide_moves(@rows) + piece.jump_moves(@rows)\n\n unless !all_possible_moves.include?(destination)#change to throw error\n\n jump = piece.jump_moves(@rows)\n if jump.include?(destination)\n jumped = true\n #removes jumped piece from board\n add = (piece.color == :white ? -1 : 1)\n if destination[1] > start_location[1]\n middle_b = destination[1] - 1\n middle_a = destination[0] + add\n delete_piece = @rows[middle_a][middle_b]\n delete_piece.location = nil\n @rows[middle_a][middle_b] = nil\n else\n middle_b = destination[1] + 1\n middle_a = destination[0] + add\n delete_piece = @rows[middle_a][middle_b]\n delete_piece.location = nil\n @rows[middle_a][middle_b] = nil\n end\n end\n\n @rows[i][j] = nil\n piece.location = [a,b]\n @rows[a][b] = piece\n end\n #checks if moved piece should be kinged, if so sets king to true\n piece.make_king\n if jumped\n #go_again unless (@rows[a][b]).jump_moves(@rows).nil?\n end\n end", "def move\n\n end", "def moves\n\n end", "def move_pieces(move_pos)\n current_pos, next_pos = move_pos\n\n @board[next_pos[0]][next_pos[1]] = @board[current_pos[0]][current_pos[1]]\n @board[current_pos[0]][current_pos[1]] = nil\n end", "def move_pieces(move_pos)\n current_pos, next_pos = move_pos\n\n @board[next_pos[0]][next_pos[1]] = @board[current_pos[0]][current_pos[1]]\n @board[current_pos[0]][current_pos[1]] = nil\n end", "def move\n \n end", "def move\n \n end", "def update_move\n if [email protected]? && @moves.size > 0\n @moves.shift if proccess_move(@moves[0])\n end\n end", "def move(board)\n \trandom_move(board)\n\tend", "def go!\n send_position_to_engine\n move_piece(bestmove)\n end", "def make_move(left,top)\n # get destination selected\n dest = get_clicked_box(left,top)\n # try to make the move on the board; @game.user_move returns false if move is not allowed\n if @game.user_move(@selected_piece, dest)\n # move the piece on the GUI boars\n move_piece(@selected_piece,dest)\n de_highlight(@selected_piece)\n deselect_piece\n # switch player turn after the move\n @game.switch_turn\n else\n # if move not allowed deselect and de highlight the piece\n de_highlight(@selected_piece)\n deselect_piece\n end\nend", "def make_move start_pos, end_pos\n piece = get_board_piece(start_pos)\n @board[end_pos[0]][end_pos[1]] = piece\n piece.position = end_pos\n @board[start_pos[0]][start_pos[1]] = nil\n end", "def move_to!(new_x, new_y)\n transaction do\n raise ArgumentError, \"#{type} has not moved.\" unless real_move?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n raise ArgumentError, 'That is an invalid move. Cannot capture your own piece.' if same_color?(occupying_piece)\n capture_piece!(occupying_piece) if square_occupied?(new_x, new_y)\n update(x_position: new_x, y_position: new_y)\n end\n end", "def move_piece(from, to)\n piece = @board[from[0]][from[1]]\n dest_piece = @board[to[0]][to[1]]\n\n dest_piece.player.pieces.delete(dest_piece) unless dest_piece.nil?\n @board[from[0]][from[1]] = nil\n @board[to[0]][to[1]] = piece\n \n piece.pos = [to[0], to[1]]\n end", "def move_friendly_piece(x,y)\n update_attributes(position_x: x, position_y: y)\n end", "def move_friendly_piece(x,y)\n update_attributes(position_x: x, position_y: y)\n end", "def move_piece!(color, from, to)\n raise \"There is no piece in that square\" if from.empty?\n raise \"Moving onto your own piece\" if color == self[to].color\n\n taken_piece = self[to].dup unless self[to].symbol == :n\n self[to] = NullPiece.instance # \"Take\" opponent's pieces\n self[from].pos = to\n self[from], self[to] = self[to], self[from]\n\n taken_piece\n end", "def do_the_move(move)\n @log.debug \"do_the_move #{move.move_to_str}\"\n color, row_s, col_s, row_e, col_e, movetype = strip_pos_argument(move)\n \n if check_if_moveisvalid(move) == :invalid\n @log.debug \"invalid move #{argument}, info#{@last_move_error}\"\n return\n end\n start_item = @infosquare[row_s][col_s]\n end_item = @infosquare[row_e][col_e]\n if movetype == :shortcastle or movetype ==:longcastle\n move_castle(start_item, end_item)\n elsif movetype == :enpassant\n col_enp = end_item.column_start\n row_enp = start_item.row_start\n eated_item = @infosquare[row_enp][col_enp]\n eated_item.clear\n BoardInfoItem.exchange(start_item, end_item)\n elsif movetype == :promotion\n BoardInfoItem.exchange(start_item, end_item)\n end_item.setinfo(move.promoted, move.color)\n else\n if @infosquare[row_s][col_s].type_piece == :vuoto\n raise \"Invalid board state, try to move an empty cell\"\n end\n BoardInfoItem.exchange(start_item, end_item)\n end\n move.fen_after_move = calculate_current_fen\n \n @last_moved_item = end_item\n @moves_in_match << move\n end", "def move(player, x, y)\n\n end", "def move(current_position, desired_square)\n board.move(current_position, desired_square, current_player)\n end", "def move_piece(board, move)\n # norm: <file_start><rank_start></file_end><rank_end>\n file_start = move.notation[0]\n rank_start = move.notation[1].to_i\n file_end = move.notation[2]\n rank_end = move.notation[3].to_i\n board[file_end][rank_end - 1] = board[file_start][rank_start - 1]\n board[file_start][rank_start - 1] = nil\n\n board\n end", "def do_the_move(argument)\r\n color, row_s, col_s, row_e, col_e = strip_pos_argument(argument)\r\n start_item = @infosquare[row_s][col_s]\r\n end_item = @infosquare[row_e][col_e]\r\n if movetype == :shortcastle or movetype ==:longcastle\r\n move_castle(start_item, end_item)\r\n elsif movetype == :enpassant\r\n col_enp = end_item.col\r\n row_enp = start_item.row\r\n eated_item = @infosquare[row_enp][col_enp]\r\n eated_item.clear\r\n else\r\n BoardInfoItem.exchange(start_item, end_item)\r\n end\r\n @last_moved_item = end_item\r\n \r\n end", "def move_piece(position, origin, destination)\n # verbose way\n ro, co = origin\n piece = position[ro][co]\n position[ro][co] = EMPTY_SQUARE\n rd, cd = destination\n position[rd][cd] = piece\n # original way\n # piece = square_at(origin)\n # square_at(origin) = '_'\n # square_at(destination) = piece\n piece.location = destination\n piece.first_move if piece.is_a?(Pawn)\n position\n end", "def move_piece!(start_pos,end_pos)\n piece=self[start_pos]\n raise 'Piece cannot move like that' unless piece.moves.include?(end_pos)\n self[end_pos]=piece\n self[start_pos]=sentinel\n piece.pos=end_pos\n nil\n end", "def move_piece!(start_pos, end_pos)\n null = NullPiece.instance\n if self[start_pos].class == King\n if self[start_pos].color == :black\n @black_king_pos = end_pos\n else\n @white_king_pos = end_pos\n end\n end\n if pawn_promotion?(start_pos, end_pos)\n color = self[start_pos].color\n self[start_pos] = null\n Queen.new(self, end_pos, color)\n else\n self[start_pos].pos = end_pos\n self[end_pos], self[start_pos] = self[start_pos], null\n end\n end", "def pawn_move\n position_index = Generic.find_square_index(en_passant_move, board)\n\n colour == 'White' ? pawn_move_white(position_index) : pawn_move_black(position_index)\n end", "def moving!\n end", "def move pos\n new_board = nil\n next_player = @current_player == :x ? :o : :x\n new_board = @board.make_move @current_player, pos\n State.new new_board, next_player, @computer_player\n end", "def move_piece(move, color) \n squares = find_start_and_end(move) # [start, end]\n\n return false if @display[squares[0][0]][squares[0][1]].guest == ' '\n\n start_piece = @display[squares[0][0]][squares[0][1]].guest\n\n return false if start_piece.color != color \n\n moves = get_legal_moves(squares[0], start_piece, start_piece.poss_moves(squares[0]))\n\n\n if moves.include?(squares[1])\n\n # castling\n if start_piece.id == 'king' && start_piece.color == 'white' && squares[1] == [7, 1] \n make_move(squares[0], squares[1], start_piece)\n make_move([7, 0], [7, 2], @display[0][0].guest)\n elsif start_piece.id == 'king' && start_piece.color == 'black' && squares[1] == []\n make_move(squares[0], squares[1], start_piece)\n make_move([0, 0], [0, 2], @display[7][0].guest)\n\n # pawn -> queen upgrade\n elsif start_piece.id == 'pawn' && start_piece.color == 'white' && squares[1][0].zero?\n make_move(squares[0], squares[1], Queen.new('white'))\n elsif start_piece.id == 'pawn' && start_piece.color == 'black' && squares[1][0] == 7\n make_move(squares[0], squares[1], Queen.new('black'))\n\n else\n make_move(squares[0], squares[1], start_piece)\n end\n else\n false\n end\n end", "def move_piece!(start_pos, end_pos)\n piece = self[start_pos]\n raise 'piece cannot move like that' unless piece.moves.include?(end_pos)\n\n self[end_pos] = piece\n self[start_pos] = sentinel\n piece.pos = end_pos\n\n nil\n end", "def move_piece!(start_pos, end_pos)\n piece = self[start_pos]\n raise 'piece cannot move like that' unless piece.moves.include?(end_pos)\n\n self[end_pos] = piece\n self[start_pos] = sentinel\n piece.pos = end_pos\n\n nil\n end", "def move(start_pos, end_pos, cur_player_color, other_player)\n piece = self[start_pos]\n if piece == nil\n raise StandardError.new(\"no piece in starting position\")\n end\n unless piece.color == cur_player_color\n raise StandardError.new(\"cannot move enemy piece\")\n end\n if !piece.valid_moves.include?(end_pos)\n raise StandardError.new(\"piece cannot move to end location\")\n end\n\n @last_board = deep_dup\n\n if (piece.type == \"Ki\" && piece.moved == false)\n handle_castling(piece, end_pos)\n end\n\n self[start_pos] = nil\n self[end_pos] = piece\n\n piece.update_position(end_pos)\n\n #if a pawn moved two places, check for en_passant\n #Return true if should be next player's turn\n if (piece.type == \"P \" && (start_pos[0] - end_pos[0]).abs == 2)\n return handle_en_passant(piece, start_pos, end_pos, other_player)\n else\n return true\n end\n end", "def move board\n free_pieces = board.free_pieces\n piece = free_pieces.random\n moves = board.possible_moves(piece)\n return [piece.x, piece.y], moves.random \n end", "def move_value(from,to)\n #add that piece to location 'to'\n @board[to.first][to.last].chess_piece = get(from.first,from.last)\n #remove piece in location 'from'\n @board[from.first][from.last].chess_piece = nil\n end", "def move_to(x, y); end", "def move_to!(new_x, new_y, real_move = true)\n return false unless game.current_player == color\n return false unless valid_move?(new_x, new_y)\n\n if (destination_piece = game.piece_at(new_x, new_y))\n return capture_piece!(new_x, new_y, destination_piece, real_move)\n end\n\n update_piece_attributes(new_x, new_y, real_move)\n end", "def move!(start, end_pos)\n # move without checking if it puts you in check\n old_x, old_y = start\n new_x, new_y = end_pos\n piece = @board[old_x][old_y]\n piece.position = end_pos\n \n # update board\n @board[new_x][new_y] = piece\n @board[old_x][old_y] = nil\n end", "def move(from, to, left_behind = ' ')\n piece = board[from[0]][from[1]]\n piece.position = [to[0], to[1]]\n piece.n = 0\n board[from[0]][from[1]] = left_behind\n board[to[0]][to[1]] = piece\n end", "def calculate_moves(piece, location)\n @x = location[0].to_i\n @y = location[1].to_i\n @possible_moves = []\n\n def add_straight_line_moves(index)\n move = \"#{@x + (index + 1)}#{@y}\" # Right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x}#{@y + (index + 1)}\" # Up\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y}\" # Left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x}#{@y - (index + 1)}\" # Down\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n end\n\n def add_diagonal_moves(index)\n move = \"#{@x + (index + 1)}#{@y + (index + 1)}\" # Up right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y - (index + 1)}\" # Down left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x + (index + 1)}#{@y - (index + 1)}\" # Down right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y + (index + 1)}\" # Up left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n end\n\n case piece\n\n when \"WhitePawn\"\n # 1 step forward\n move = \"#{@x}#{@y + 1}\"\n @possible_moves << move unless @board[move] != nil \n # Attack forward right\n move = \"#{@x + 1}#{@y + 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent \n @possible_moves << move \n end \n # Attack forward left\n move = \"#{@x - 1}#{@y + 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent \n @possible_moves << move \n end \n # 2 steps forward if its in the starting point\n move = \"#{@x}#{@y + 2}\"\n @possible_moves << move unless @y != 2 || path_blocked?(move) ||\n @board[move] != nil\n\n when \"BlackPawn\"\n # Same moves of the WhitePawn but reversed\n move = \"#{@x}#{@y - 1}\"\n @possible_moves << move unless @board[move] != nil \n \n move = \"#{@x + 1}#{@y - 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent\n @possible_moves << move \n end\n \n move = \"#{@x - 1}#{@y - 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent\n @possible_moves << move\n end\n \n move = \"#{@x}#{@y - 2}\"\n @possible_moves << move unless @y != 7 || path_blocked?(move) || @board[move]\n\n when \"Rook\"\n # 7 is the max distance between squares\n # The method is called 7 times to have a list of all possible targets ready\n 7.times { |index| add_straight_line_moves(index) }\n\n when \"Knight\"\n knight_moves = [[@x + 1, @y + 2], [@x + 2, @y + 1], \n [@x + 2, @y - 1], [@x + 1, @y - 2], \n [@x - 1, @y - 2], [@x - 2, @y - 1], \n [@x - 2, @y + 1], [@x - 1, @y + 2]]\n \n knight_moves.each do |move|\n move = \"#{move[0]}#{move[1]}\" \n @possible_moves << move unless out_of_bounds?(move) || friendly_piece?(move)\n end\n\n when \"Bishop\"\n 7.times { |index| add_diagonal_moves(index) }\n \n when \"Queen\"\n 7.times do |index|\n add_straight_line_moves(index)\n add_diagonal_moves(index)\n end\n \n when \"King\"\n # The King can move only 1 square away so the methods are called just once\n add_straight_line_moves(0)\n add_diagonal_moves(0)\n else\n\n end\n end", "def move\n start_show_thinking\n @board.move(best_moves.first)\n stop_show_thinking\n board.last_move\n end", "def legal_move?(new_x, new_y)\n return false unless actual_move?(new_x, new_y)\n return_val = false\n piece_moved_start_x = x_position\n piece_moved_start_y = y_position\n piece_captured = nil\n piece_captured_x = nil\n piece_captured_y = nil\n # check if you are moving pawn in en passant capture of enemy pawn\n if type == PAWN && !square_occupied?(new_x, new_y)\n if (new_x - piece_moved_start_x).abs == 1 && (new_y - piece_moved_start_y).abs == 1\n piece_captured = game.get_piece_at_coor(new_x, piece_moved_start_y)\n piece_captured_x = new_x\n piece_captured_y = piece_moved_start_y\n end\n end\n # return false if move is invalid for this piece for any of the reasons checked in piece #valid_move?\n return false unless valid_move?(new_x, new_y)\n # If square is occupied, respond according to whether piece is occupied by friend or foe\n if square_occupied?(new_x, new_y)\n occupying_piece = game.get_piece_at_coor(new_x, new_y)\n return false if (occupying_piece.is_white && is_white?) || (!occupying_piece.is_white && !is_white?)\n # since player is trying to capture a friendly piece\n piece_captured = occupying_piece\n piece_captured_x = occupying_piece.x_position\n piece_captured_y = occupying_piece.y_position\n capture_piece(occupying_piece)\n end\n # only here do we update coordinates of piece moved, once we have saved all starting coordinates of piece moved and any piece it captured\n update(x_position: new_x, y_position: new_y)\n increment_move\n return_val = true unless game.check?(is_white)\n update(x_position: piece_moved_start_x, y_position: piece_moved_start_y)\n piece_captured.update(x_position: piece_captured_x, y_position: piece_captured_y) unless piece_captured.nil?\n decrement_move\n return_val\n end", "def play_move!( m )\n self.delete_if { |pos, piece| pos == m.to_coord || pos == m.captured_piece_coord }\n\n piece_moved = self.delete(m.from_coord)\n self[m.to_coord] = piece_moved\n\n if m.castled==1\n castling_rank = m.to_coord.rank.to_s\n [['g', 'f', 'h'], ['c', 'd', 'a']].each do |king_file, new_rook_file, orig_rook_file|\n #update the position of the rook corresponding to the square the king landed on\n\tif m.to_coord.file == king_file \n\t rook = self.delete(\"#{orig_rook_file}#{castling_rank}\")\n\t self[\"#{new_rook_file}#{castling_rank}\"] = rook\n\tend\n end\n end\n \n #TODO investigate why this method is getting called multiply per moves << Move.new\n return unless piece_moved\n ep_from_rank, ep_to_rank, ep_rank = EN_PASSANT_CONFIG[ piece_moved.side ]\n @en_passant_square = ( piece_moved.function == :pawn &&\n m.from_coord.rank == ep_from_rank && \n m.to_coord.rank == ep_to_rank ) ? m.from_coord.file + ep_rank.to_s : nil\n\n #reflect promotion\n if piece_moved && piece_moved.function == :pawn && m.to_coord.to_s.rank == piece_moved.promotion_rank\n self.delete(m.to_coord)\n self[m.to_coord] = Queen.new(piece_moved.side, :promoted)\n #puts self.to_s if m.to_coord == 'a8'\n #debugger if m.to_coord == 'a8'\n end\n \n self\n end", "def move_piece_back\n @chess_board.board[@row][@col] = @chess_board.board[@row_new][@col_new]\n end", "def set_piece(player,location) #takes the arguments player and location\n\t\t@piece=player.piece #defines piece as the player's number (either 1 or 2)\n\t\trow=(location-1)/4 #takes the value of location (1-16) and converts it into a row coordinate 0, 1, 2, or 3\n\t\tcolumn=(location+3)%4 #takes the value of location (1-16) and converts it into a column coordinate 0, 1, 2, or 3\n\t\t@board[row][column]=@piece #defines the cell that the player has just selected as the player's number (1 or 2)\n\t\t@size+=1 #we count each move after its been made which is used in the function below, check_full?\n\tend", "def move!(start_pos, end_pos, cur_player_color)\n if self[start_pos] == nil\n raise StandardError.new(\"no piece in starting position\")\n end\n unless self[start_pos].color == cur_player_color\n raise StandardError.new(\"cannot move enemy piece\")\n end\n piece = self[start_pos]\n if !piece.moves.include?(end_pos)\n raise StandardError.new(\"piece cannot move to end location\")\n end\n\n self[start_pos] = nil\n self[end_pos] = piece\n\n piece.update_position(end_pos)\n end", "def move(start, end_pos)\n piece = self[start]\n available_moves = piece.valid_moves\n raise MoveNotAvailableError unless available_moves.include?(end_pos)\n piece.move_to(end_pos)\n rescue MoveNotAvailableError => e\n puts \"Piece cannot move to that location!\"\n raise e\n end", "def apply_move piece, origin, dest\n node_at(origin).remove_piece\n\n dest_node = node_at(dest)\n dest_node.piece_captured_by(piece) if dest_node.occupied?\n dest_node.update_piece piece\n @last_move = { piece: piece, origin: origin, dest: dest }\n end", "def move_piece(start_pos, end_pos)\n raise InvalidMoveError unless valid_move?(start_pos, end_pos)\n if capture_move?(start_pos, end_pos)\n self[end_pos] = self[start_pos]\n self[start_pos] = NullPiece.instance\n else\n self[end_pos], self[start_pos] = self[start_pos], self[end_pos]\n end\n self[end_pos].pos = end_pos\n end", "def move_piece(curr_pos, dest, player)\n\t\t@successful_move = false\n\n\t\tboard_snapshot = create_snapshot(@board)\n\t\ttaken_pieces_snapshot = create_snapshot(@taken_pieces)\n\n\t\tcontent(curr_pos).class.to_s == 'Pawn' ? pawn_cond = check_pawn_condition(curr_pos, dest, player) : pawn_cond = nil\n\n\t\tmessage = generate_message(curr_pos, dest, pawn_cond, player)\n\n\t\tif !message\n\t\t\tupdate_taken_pieces(dest) if taking_opponent_piece?(curr_pos, dest, player) # order is important here :(\n\t\t\tmove_action(curr_pos, dest)\n\n\n\t\t\tif self_in_check?(player)\n\t\t\t\tputs \"Invalid move. You must not still be in check.\"\n\t\t\t\t@board = board_snapshot\n\t\t\t\t@taken_pieces = taken_pieces_snapshot\n\t\t\telse\n\t\t\t\t@successful_move = true\n\t\t\t\tprint_board\n\t\t\t\tupdate_player_status(get_opponent(player))\n\t\t\tend\n\t\telse\n\t\t\tputs message\n\t\tend\n\tend", "def move\n\t\tif @direction == \"N\"\n\t\t\t@y += 1\n\t\telsif @direction == \"W\"\n\t\t\t@x -= 1\n\t\telsif @direction == \"E\"\n\t\t\t@x += 1\n\t\telsif @direction == \"S\"\n\t\t\t@y -= 1\n\t\tend\n\tend", "def movePiece(piece, newLocation)\n if piece.instance_of?(Piece) && newLocation.instance_of?(Location)\n if newLocation.isEmpty\n if piece.location != nil\n piece.location.removePiece\n end\n newLocation.addPiece(piece)\n piece.location = newLocation\n end\n end\n end", "def get_move\n cols = %w(a b c d e f g h)\n rows = %w(8 7 6 5 4 3 2 1)\n\n from_pos, to_pos = nil, nil\n until from_pos && to_pos\n @display.draw\n if from_pos\n row, col = from_pos\n piece = @display.board[from_pos].class\n puts \"#{piece} at #{cols[col]}#{rows[row]} selected. Where to move to?\"\n to_pos = @display.get_keyboard_input\n else\n @display.reset_errors_notification\n puts \"#{@color.capitalize}'s move\"\n puts 'What piece do you want to move?'\n selection = @display.get_keyboard_input\n from_pos = selection if selection && valid_selection?(selection)\n end\n end\n [from_pos, to_pos]\n end", "def move_castling(short, color)\n\n if short\n if color == 'black'\n board[0][5].piece, board[0][6].piece = board[0][7].piece, board[0][4].piece\n board[0][7].piece, board[0][4].piece = nil, nil\n board[0][5].piece.position, board[0][6].piece.position = [0,5], [0,6]\n update_possible_movement_all_pieces()\n turns[board[0][5].piece.COLOR.to_sym] += 1\n board[0][5].piece.number_of_move += 1 if board[0][5].piece.instance_of?(Rook)\n board[0][6].piece.number_of_move += 1 if board[0][6].piece.instance_of?(King)\n \n return board[0][5].piece\n else\n board[7][5].piece, board[7][6].piece = board[7][7].piece, board[7][4].piece\n board[7][7].piece, board[7][4].piece = nil, nil\n board[7][5].piece.position, board[7][6].piece.position = [7,5], [7,6]\n update_possible_movement_all_pieces()\n turns[board[7][5].piece.COLOR.to_sym] += 1\n board[7][5].piece.number_of_move += 1 if board[7][5].piece.instance_of?(Rook)\n board[7][6].piece.number_of_move += 1 if board[7][6].piece.instance_of?(King)\n \n return board[7][5].piece\n end\n else\n if color == 'black'\n board[0][3].piece, board[0][2].piece = board[0][0].piece, board[0][4].piece\n board[0][0].piece, board[0][4].piece = nil, nil\n board[0][3].piece.position, board[0][2].piece.position = [0,3], [0,2]\n update_possible_movement_all_pieces()\n\n turns[board[0][3].piece.COLOR.to_sym] += 1\n board[0][3].piece.number_of_move += 1 if board[0][3].piece.instance_of?(Rook)\n board[0][2].piece.number_of_move += 1 if board[0][2].piece.instance_of?(King)\n\n return board[0][3].piece\n else\n board[7][3].piece, board[7][2].piece = board[7][0].piece, board[7][4].piece\n board[7][0].piece, board[7][4].piece = nil, nil\n board[7][3].piece.position, board[7][2].piece.position = [7,3], [7,2]\n update_possible_movement_all_pieces()\n \n turns[board[7][3].piece.COLOR.to_sym] += 1\n board[7][3].piece.number_of_move += 1 if board[7][3].piece.instance_of?(Rook)\n board[7][2].piece.number_of_move += 1 if board[7][2].piece.instance_of?(King)\n\n return board[7][3].piece\n end\n end\n\n end", "def move(start, finish)\n\t\ta, b = start\n\t\tx, y = finish\n\t\tif @board[a][b].piece.class.name == \"Pawn\"\n\t\t\t@board[a][b].piece.double = \"false\"\n\t\t\tif y - b == 2 || y - b == -2\n\t\t\t\t@board[a][b].piece.en_passant = true\n\t\t\tend\n\t\tend\n\t\tif @board[a][b].piece.class.name == \"King\" || @board[a][b].piece.class.name == \"Rook\"\n\t\t\t@board[a][b].piece.castling = false\n\t\tend\n\t\tif @board[a][b].piece.class.name == \"King\" && (x - a >= 2 || x - a <= 2)\n\t\t\tif (x - a >= 2)\n\t\t\t\tcastle_right(a, b, x, y)\n\t\t\telse\n\t\t\t\tcastle_left(a, b, x, y)\n\t\t\tend\n\t\t\treturn\n\t\tend\n\t\t@board[x][y].piece = @board[a][b].piece\n\t\t@board[a][b].piece = nil\n\t\tremove_en_passant(x, y)\n\t\tif @board[x][y].piece.class.name == \"Pawn\"\n\t\t\tcheck_promotion(x, y)\n\t\tend\n\tend", "def move_piece(start_pos, end_pos)\n if self[start_pos].is_a?(NullPiece)\n raise StandardError.new(\"There is no piece at this start position\")\n end\n unless valid_pos?(end_pos)\n raise StandardError.new(\"End position does not exist\")\n end\n\n current_piece = self[start_pos]\n self[end_pos] = current_piece\n self[start_pos] = NullPiece.new\n end", "def move\n case @direction\n when \"N\"\n @y_coord += 1\n when \"S\"\n @y_coord -= 1\n when \"W\"\n @x_coord += 1\n when \"E\"\n @x_coord -= 1\n end\n end", "def play_move(from, to)\n #create duplicate of board, to correct pass by reference error\n #add top disk on from tower to the top of to tower\n to_dup = @board[to].dup\n to_dup.unshift(@board[from][0]) \n @board[to] = to_dup\n @board[from].shift\n \n if won?\n render\n puts \"congratulations you won!\\n\\n\"\n else\n get_move\n end\n end", "def make_move(move)\n\t\t@board[move]= $current_player\n\tend", "def move_piece(start_pos, end_pos, color)\n # p self[start_pos].is_a?(NullPiece)\n # p self[end_pos].is_a?(NullPiece)\n # p self[start_pos]\n if !self[start_pos].is_a?(NullPiece) && self[end_pos].is_a?(NullPiece)\n piece = self[start_pos]\n # Piece no longer in that position / set to Null Piece\n self[start_pos] = NullPiece.new(nil, self, start_pos)\n piece.pos = end_pos\n # Update end position with position of piece\n self[end_pos] = piece\n elsif self[start_pos].is_a? (NullPiece)\n raise \"No piece at pos #{start_pos}\" \n elsif !self[end_pos].is_a?(NullPiece)\n raise \"Space occupied\"\n end\n end", "def commit_move!(start_pos, end_pos, count = true)\n self.turn_count = 1 + turn_count.to_i if count\n current_piece = self[start_pos]\n self[end_pos].move_to([10,10]) if self[end_pos].is_a?(Piece)\n swap_positions(start_pos, end_pos, current_piece, EmptySquare.new, true)\n promote_last_lines\n end", "def move!(start_pos, end_pos)\n #save removed piece and then remove it\n @removed_pieces << self[end_pos]\n self[end_pos] = NullPiece.instance\n\n self[start_pos], self[end_pos] = self[end_pos], self[start_pos]\n\n self[end_pos].position = end_pos\n end", "def add_piece(board, move, piece=\"R\")\n spot = board[move].rindex(nil)\n board[move][spot] = piece\n board\n end", "def move(board)\n @board = board\n valid_moves = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"]\n\n case\n when winning_move\n (winning_move + 1).to_s\n when blocking_move\n (blocking_move + 1).to_s\n when center?\n \"5\"\n when opposite_corner\n opposite_corner\n when corner\n (corner + 1).to_s\n else\n until !board.taken?(input)\n valid_moves.sample\n end\n end\n end", "def make_move(player)\n while true \n from, to = player.get_move\n break if valid_move?(from, to, player)\n puts \"Invalid move\"\n end\n move_piece(from, to)\n end", "def move\n if inside_table?(next_move_x_y(next_move))\n update_position!(next_move_x_y(next_move))\n else\n almost_die\n end\n end", "def make_move(row: , column: )\n symbol = current_symbol\n raise 'Round finished' if finished?\n raise 'Move already taken' if board(row: row, column: column) != '_'\n board_state[index_from_row_column(row, column)] = symbol\n self.update(board_state: board_state, current_player: next_player)\n end", "def move(move)\n\n \n \n \n \n\n if @rules.isCastleShort?(move)\n if move.piece.colour == :white\n r = \"h1\" ; r2 = \"f1\";\n else\n r = \"h8\"; r2= \"f8\";\n end\n m = Move.new(self, self.getSquare(r).occupancy, r2, r)\n self.move(m)\n elsif @rules.isCastleLong?(move)\n if move.piece.colour == :white\n r = \"a1\" ; r2 = \"d1\";\n else\n r = \"a8\"; r2= \"d8\";\n end\n m = Move.new(self, self.getSquare(r).occupancy, r2, r)\n self.move(m)\n end\n\n @pieces[move.piece.colour][move.piece.class.to_s.to_sym].delete(move.from)\n setSquare(move.from, nil)\n move.piece.firstMove = false\n setSquare(move.to, move.piece)\n\n return self\n end", "def move_piece(candidate_board, start, finish)\n piece = candidate_board[start]\n \n original_position = piece.position\n \n candidate_board[start] = nil\n \n piece.position = finish\n \n captured_piece = candidate_board.occupied?(finish) ? remove_captured_piece(candidate_board[finish]) : nil\n \n candidate_board[finish] = piece #finish position now contains the new piece\n\n look_ahead(candidate_board, piece, captured_piece, original_position) if self.is_virtual?(candidate_board)\n end", "def test_move(piece, piece_initial_position, piece_movement, movement, color)\n result = true\n move(piece_initial_position, movement)\n result = false unless check?(color)\n move(movement, piece_initial_position, piece_movement)\n board[piece_initial_position[0]][piece_initial_position[1]].n = 1 if piece.n == 1\n result\n end", "def update_move(board, player, position)\n\tboard[position.to_i - 1] = player\n\tboard\nend", "def move\n\tputs \"Where would you like to move this king? Enter the coords as a 2-digit number\"\n\tnew_pos=gets.chomp\n\tx=new_pos[0].to_i\n\ty=new_pos[1].to_i\n\tif @moves.include? ([x,y])\n\t board[x][y]=self.sym\n\t board[self.pos[0]][self.pos[1]]=\"___\"\n\t self.pos=[x,y]\n\telse\t \n\t move\n\tend\nend" ]
[ "0.8251823", "0.82434034", "0.8092314", "0.8057756", "0.8057756", "0.8026749", "0.7932612", "0.7877355", "0.78575456", "0.78403425", "0.7788185", "0.7773487", "0.766082", "0.7654612", "0.7633349", "0.76228595", "0.76084495", "0.7542641", "0.75411", "0.7532961", "0.7516527", "0.7480801", "0.7458975", "0.7457998", "0.7454961", "0.7446446", "0.7446446", "0.7443938", "0.7440218", "0.74386495", "0.7433331", "0.74249905", "0.7417715", "0.7414152", "0.7414152", "0.7408876", "0.7408876", "0.7407366", "0.7399502", "0.7394227", "0.7377302", "0.7344622", "0.7342616", "0.73392606", "0.7337417", "0.7337417", "0.7296299", "0.72863376", "0.72831506", "0.7258534", "0.72532314", "0.72468054", "0.72291857", "0.7221005", "0.72200274", "0.7217673", "0.7211459", "0.7206422", "0.7182689", "0.717149", "0.717149", "0.7170922", "0.7169616", "0.71645707", "0.716204", "0.7154705", "0.7146813", "0.714196", "0.7128695", "0.7122119", "0.7119144", "0.7114201", "0.7083475", "0.70795965", "0.70691246", "0.7060464", "0.70594794", "0.70546424", "0.7054189", "0.7053852", "0.7047467", "0.7044613", "0.7036557", "0.703185", "0.70226383", "0.70176333", "0.70142615", "0.700032", "0.6987059", "0.6986869", "0.6985102", "0.69829243", "0.6982732", "0.69740456", "0.69721174", "0.6963665", "0.6958326", "0.69579065", "0.69553405", "0.6953717", "0.6950572" ]
0.0
-1
resets background colors after showing possible moves in different color
def reset_background(colors, moves) moves.each do |move| (0..7).each do |row| (0..7).each do |col| @display[row][col].background = colors.shift if move == [row, col] end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart\n pbBGMStop(0)\n 51.times do\n @viewport.tone.red-=5\n @viewport.tone.green-=5\n @viewport.tone.blue-=5\n self.updateElements\n Graphics.update\n end\n raise Reset.new\n end", "def colorize!(fg, bg)\n set_colors(fg, bg)\n num = @cwin.maxx * @cwin.maxy\n self.home\n self.go(0, 0) { @cwin.addstr(' '*num) }\n @cwin.refresh\n end", "def reset_board_variables\r\n @color_on_turn = :white\r\n @pieces = {:white => [], :black => []} \r\n @last_moved_item = BoardInfoItem.new(0,0)\r\n @infosquare.each do |row_square|\r\n row_square.each do |cell|\r\n cell.clear\r\n end\r\n end\r\n #p @infosquare\r\n end", "def reset_board_variables\n @color_on_turn = :white\n @fifty_counter = 0\n @pieces = {:white => [], :black => []} \n @last_moved_item = BoardInfoItem.new(0,0)\n @infosquare.each do |row_square|\n row_square.each do |cell|\n cell.clear\n end\n end\n #p @infosquare\n end", "def reset!\n @color = @@colors[:white]\n end", "def points_gfx_reset_colors\r\n @players_on_match.each do |pl_single|\r\n player_label1 = pl_single.name.to_sym\r\n @points_status[player_label1][:widg_scopa].font_color = Fox.FXRGB(0, 0, 0)\r\n end\r\n end", "def update_pre_transition_flash\n if @counter % 15 == 0\n col = @viewport.color.red == 0 ? 255 : 0\n @viewport.color.set(col, col, col)\n end\n @viewport.color.alpha = (Math.sin(2 * Math::PI * @counter / 30).abs2.round(2) * 180).to_i\n end", "def color_reset!(fill)\n save = background_color\n # Change the background color _outside_ the begin block\n # so that if this object is frozen the exeception will be\n # raised before we have to handle it explicitly.\n self.background_color = fill\n begin\n erase!\n ensure\n self.background_color = save\n end\n self\n end", "def revert_unit_colors\n $game_map.units.each{|u|\n next if @unit_sprites[u.sprite_id].disposed?\n @unit_sprites[u.sprite_id].color.set(0, 0, 0, 0)\n u.acted = false\n }\n end", "def setup_pieces\n setup_color(:white)\n setup_color(:black)\n end", "def starting_board\n init_rows([0, 2], :black)\n init_rows([5, 7], :red)\n end", "def switch_background(color)\n color == [248,250,210] ? [215,188,149] : [248,250,210]\n end", "def populate_board\n rows_of_pieces = (size - 2) / 2\n make_pieces([0, 1], 'red', rows_of_pieces, 1)\n make_pieces([size - 1, 0], 'black', rows_of_pieces, -1)\n end", "def setcolorrep(*)\n super\n end", "def display(move = [])\n cls\n\n bg1 = COLORS[:light]\n bg2 = COLORS[:dark]\n border = COLORS[:border]\n\n top_bot_border = \" #{('A'..'Z').to_a.take(WIDTH).join(' ')} \"\n .colorize(:background => border)\n puts top_bot_border\n\n color = bg1\n\n @grid.each_with_index do |row, idx|\n print \"#{' ' if WIDTH - idx < 10}#{WIDTH - idx} \".\n colorize(:background => border)\n\n row.each_with_index do |space, space_idx|\n back = move.include?([idx, space_idx]) ? COLORS[:highlight] : color\n\n if space.nil?\n print \" \".colorize(:background => back)\n else\n print \" #{space.render} \".colorize(:background => back)\n end\n color = color == bg1 ? bg2 : bg1\n end\n color = color == bg1 ? bg2 : bg1 unless WIDTH.odd?\n print \" #{WIDTH - idx}#{' ' if WIDTH - idx < 10}\\n\".\n colorize(:background => border)\n end\n puts top_bot_border\n nil\n end", "def reset_attack(defender_color)\n\n for row in 0..7\n for col in 0..7\n if(defender_color==\"white\")\n get_square(row,col).attacked_black=false\n elsif defender_color==\"black\"\n get_square(row,col).attacked_white=false\n end\n\n\n end\n end\n end", "def setBackground\r\n r = g = b = a = 0.0\r\n case $background\r\n when 0\r\n r = g = b = 0.0\r\n when 1\r\n r = g = b = 1.0\r\n when 2\r\n r = 0.1\r\n g = 0.3\r\n b = 0.6\r\n when 3\r\n r = g = b = 0.5\r\n else\r\n r = g = b = 0.0\r\n end\r\n a = 1.0\r\n glClearColor(r,g,b,a)\r\nend", "def colorize!; @colors = true; end", "def reset\n @max_color_distance = @color_distance_limit ? 0 : nil\n @left = @top = @right = @bottom = nil\n end", "def updateBackground\n\t\tdrawMap()\n\tend", "def show\n @bg_gray = true\n\n end", "def reset_use_color\n @use_color = true\n end", "def obstacle!\n @color = @@colors[:grey]\n end", "def setup_grid\n empty_rows\n [:white, :light_yellow].each do |color|\n back_rows(color)\n pawn_rows(color)\n end\n end", "def set_chamber_done(grid, chamber)\n (0..chamber.height - 1).each do |j|\n (0..chamber.width - 1).each do |i|\n grid[chamber.grid_y + j][chamber.grid_x + i].show_base_background = true\n end\n end\nend", "def init_white_panel!\n grid.cells[grid.pos] = 1\n end", "def render_background\n render_unvisited\n render_grid_lines\n end", "def recolorise_enemy\n @enemies.each do |i|\n # i.color.alpha -= 10\n end\n end", "def updateBackground\n\t\tif @redraw\n\t\t\[email protected]\n\t\t\[email protected] { |sprite|\n\t\t\t\tsprite.draw(@screen)\n\t\t\t}\n\t\t\[email protected] { |box|\n\t\t\t\tbox.draw\n\t\t\t}\n\t\t\t@redraw = false\n\t\tend\n\tend", "def setup_easier\n (1...ROWS).each do |row|\n (1...COLUMNS).each do |col|\n set_neighbour_colour(col, row) if rand(-1...COLOR_TABLE.size) == -1\n end\n end\n end", "def setup_ghost_colors(num, color)\n # Add 10 to each num to create a new number and assign the opacity-altered color values\n opacity = 0.5\n num += 10\n\n Curses.init_color(num, *color.map { |c| ((c * opacity) / 255.0 * 1000).to_i })\n Curses.init_pair(num, num, num)\nend", "def setfillcolorind(*)\n super\n end", "def reset\n @victory = false\n @win = false\n drawFromPixmap\n end", "def reset(cols, rows)\n\n\t@cols = cols.to_i.abs\n\t@rows = rows.to_i.abs\n\t@created = true\n\n\tx = 0\n\tuntil x > @rows\n\t y = 0\n\t until y > @cols\n\t\tset_pixel(\"#{y}-#{x}\", COLOR_WHITE)\n\t\ty = y+1\n\t end\n\t x = x+1\n\tend\n\n end", "def paint_fill(screen, point, new_color)\n seen = {}\n old_color = color(point, screen)\n to_fill = [point]\n\n until to_fill.empty? do\n current_point = to_fill.shift\n screen[current_point[0]][current_point[1]] = new_color\n neighbors(current_point, screen.length, screen.first.length).each do |neighbor|\n if !seen[neighbor] && color(neighbor, screen) == old_color\n to_fill.push(neighbor)\n seen[neighbor] = true\n end\n end\n end\n\n render screen\nend", "def render_unvisited\n outputs.solids << scale_up(grid.rect).merge(unvisited_color)\n outputs.solids << move_and_scale_up(grid.rect).merge(unvisited_color)\n end", "def clear\n @pixels.fill WHITE\n end", "def set_bg\n STDOUT.write \"\\033[48;5;#{to_xterm}m\"\n end", "def change_bg_color(color)\n @bg_color = color\n self.bitmap.fill_rect(self.bitmap.rect,color)\n end", "def change_color\n @color = Gosu::Color.rgb(rand * 255, rand * 255, rand * 255)\n end", "def reset_board\n # Reset the board\n\t\t9.times do |i|\n\t\t\t@buttons[i].set_text(\"\")\n\t\t\t@board[i] = C_V\n\t\tend\n end", "def no_bg_color\n reset_prev_formatting self, :bg_color\n end", "def background_color(color); end", "def on_49(_) { fg: fg_color(9) } end", "def render\n system(\"clear\")\n board.each_with_index do |row,i1|\n complete_row = []\n row.each_with_index do |col,i2|\n pos = [i1, i2]\n # debugger\n if pos == cursor.cursor_pos\n complete_row << board[i1][i2].symbol.colorize(:color => :white, :background => :black)\n else\n complete_row << board[i1][i2].symbol.colorize(:color => :white, :background => :red)\n end\n end\n puts complete_row.join\n end\n end", "def update_background\n @background.x, @background.y, @background.z = 0,0,self.z - 1 #self.x, self.y, self.z - 1\n end", "def reset_state_at_page_start\n @state_stack.each do |state|\n fill_color! state.fill_color\n stroke_color! state.stroke_color\n text_render_style! state.text_render_style\n stroke_style! state.stroke_style\n add_content(\"\\nq\")\n end\n end", "def setup\n super\n @background_colour = @colour\n @foreground_colour = Palette.white\n end", "def set_to_begin\n # Reset color_map\n @color_map = Hash.new(:WHITE)\n color_map[@start_vertex] = :GRAY\n @waiting = [@start_vertex] # a queue\n handle_tree_edge(nil, @start_vertex) # discovers start vertex\n self\n end", "def set_to_begin\n # Reset color_map\n @color_map = Hash.new(:WHITE)\n color_map[@start_vertex] = :GRAY\n @waiting = [@start_vertex] # a queue\n handle_tree_edge(nil, @start_vertex) # discovers start vertex\n self\n end", "def clear\n self.color = COLOR_CLEAR unless self.color == COLOR_CLEAR\n end", "def backgroundcolor\n colors = {\n \"#E50914\" => \"#282581\", \"#FF0000\" => \"#0A0D44\", \"#00FF8F\" => \"#0A00A4\", \"#FFF300\" => \"#E80000\", \"#00E8C5\" => \"#5A009C\", \"#FF9E00\" => \"#5A009C\", \"#FFEC00\" => \"#FF00A6\", \"#51FF00\" => \"#7400BF\"}\n color1, color2 = colors.to_a.sample\n session[:color1] = color1\n session[:color2] = color2\n end", "def clear\n\t\[email protected]_rect 0, 0, @width, @height, @color_bg\n\tend", "def clear_board\n FXDCWindow.new(@image) do |dc|\n dc.foreground = BACK_COLOR\n dc.fillRectangle(0, 0, IMG_WIDTH, IMG_HEIGHT)\n end\n board_draw\n end", "def draw\n lastpixel = RuTui::Pixel.new(rand(255), rand(255), \".\")\n @map = Marshal.load( Marshal.dump( @smap )) # Deep copy\n\n # get all the objects\n @objects.each do |o|\n next if o.x.nil? or o.y.nil?\n o.each do |ri,ci,pixel|\n if !pixel.nil? and o.y+ri >= 0 and o.x+ci >= 0 and o.y+ri < @map.size and o.x+ci < @map[0].size\n # -1 enables a \"transparent\" effect\n if pixel.bg == -1\n pixel.bg = @map[o.y + ri][o.x + ci].bg if !@map[o.y + ri][o.x + ci].nil?\n pixel.bg = RuTui::Theme.get(:background).bg if pixel.bg == -1\n end\n if pixel.fg == -1\n pixel.fg = @map[o.y + ri][o.x + ci].fg if !@map[o.y + ri][o.x + ci].nil?\n pixel.fg = RuTui::Theme.get(:background).fg if pixel.fg == -1\n end\n\n @map[o.y + ri][o.x + ci] = pixel\n end\n end\n end\n\n out = \"\" # Color.go_home\n # and DRAW!\n @map.each do |line|\n line.each do |pixel|\n if lastpixel != pixel\n # out += RuTui::Ansi.clear_color if lastpixel != 0\n out << RuTui::Ansi.clear_color if lastpixel != 0\n if pixel.nil?\n # out += \"#{RuTui::Ansi.bg(@default.bg)}#{RuTui::Ansi.fg(@default.fg)}#{@default.symbol}\"\n out << \"#{RuTui::Ansi.bg(@default.bg)}#{RuTui::Ansi.fg(@default.fg)}#{@default.symbol}\"\n else\n # out += \"#{RuTui::Ansi.bg(pixel.bg)}#{RuTui::Ansi.fg(pixel.fg)}#{pixel.symbol}\"\n out << \"#{RuTui::Ansi.bg(pixel.bg)}#{RuTui::Ansi.fg(pixel.fg)}#{pixel.symbol}\"\n end\n lastpixel = pixel\n else\n if pixel.nil?\n # out += @default.symbol\n out << @default.symbol\n else\n # out += pixel.symbol\n out << pixel.symbol\n end\n end\n end\n end\n\n # draw out\n print out.chomp\n $stdout.flush\n end", "def finish\n return if self.disposed?\n @viewport.color = Color.new(0, 0, 0, 0)\n 16.delta_add.times do\n @viewport.color.alpha += 32/self.delta\n self.wait\n end\n @viewport.color = Color.black\n self.dispose\n end", "def initialize_colors\n Ncurses.start_color\n [[Ncurses::COLOR_RED, Ncurses::COLOR_WHITE],\n [Ncurses::COLOR_GREEN, Ncurses::COLOR_BLACK],\n [Ncurses::COLOR_YELLOW, Ncurses::COLOR_BLACK],\n [Ncurses::COLOR_BLUE, Ncurses::COLOR_WHITE],\n [Ncurses::COLOR_MAGENTA, Ncurses::COLOR_BLACK],\n [Ncurses::COLOR_CYAN, Ncurses::COLOR_BLACK],\n [Ncurses::COLOR_WHITE, Ncurses::COLOR_BLACK]\n ].each.with_index(1) do |pair, i|\n # Initialize color.\n Ncurses.init_pair(i, pair[0], Ncurses::COLOR_BLACK)\n # Initialize reversed color.\n Ncurses.init_pair(i + 8, pair[1], pair[0])\n end\n Ncurses.init_pair(8, Ncurses::COLOR_BLACK, Ncurses::COLOR_WHITE)\n end", "def reset\n # color is enabled by default, can be turned of by switch --no-color\n Term::ANSIColor.coloring = true\n end", "def reset_board\n\t\t@secret_board = []\n\t\tMastermind::BOARD_WIDTH.times { @secret_board << Mastermind::COLORS[:blank] }\n\t\t@decoding_board = blank_board\n\t\t@rating_board = blank_board\n\tend", "def show_board\n @grid.each_with_index do |row, row_index|\n row.each_with_index do |square, col_index|\n piece = self[row_index, col_index]\n if row_index.even? && col_index.even?\n print \" #{piece.display} \".colorize( :color => :black, :background => :white ) if (piece && piece.color == :black)\n print \" #{piece.display} \".colorize( :color => :red, :background => :white ) if (piece && piece.color == :red)\n print \" \".colorize( :background => :white ) if piece.nil?\n elsif row_index.even? && col_index.odd? \n print \" #{piece.display} \".colorize( :color => :black, :background => :light_white ) if (piece && piece.color == :black)\n print \" #{piece.display} \".colorize( :color => :red, :background => :light_white ) if (piece && piece.color == :red)\n print \" \".colorize( :background => :light_white ) if piece.nil?\n elsif row_index.odd? && col_index.even? \n print \" #{piece.display} \".colorize( :color => :black, :background => :light_white ) if (piece && piece.color == :black)\n print \" #{piece.display} \".colorize( :color => :red, :background => :light_white ) if (piece && piece.color == :red)\n print \" \".colorize( :background => :light_white ) if piece.nil?\n elsif row_index.odd? && col_index.odd?\n print \" #{piece.display} \".colorize( :color => :black, :background => :white ) if (piece && piece.color == :black)\n print \" #{piece.display} \".colorize( :color => :red, :background => :white ) if (piece && piece.color == :red)\n print \" \".colorize( :background => :white ) if piece.nil?\n end\n end\n puts \"\"\n end\n end", "def draw_next_phase\n if (@color_pair)\n if Ncurses.respond_to?(:color_set)\n @window.color_set(@color_pair, nil)\n else\n @window.attrset(Ncurses.COLOR_PAIR(@color_pair))\n end\n end\n @window.mvaddstr(@y, @x, \"O\")\n end", "def background_fill\n @background_fill ||= begin\n digest = \"0.#{Digest::MD5.hexdigest(@name).to_i(16).to_s}\".to_f\n index = (digest * (@background_colors.length - 1)).round\n @background_colors[index]\n end\n end", "def upload_state\n 0.upto(ROWS - 1) do |row|\n 0.upto(COLUMNS - 1) do |column|\n state = @cell_state[row * ROWS + column]\n @lp.set_led_colors(column, row, *@colors[state])\n end\n end\n @lp.set_led_colors(0, -1, *((@iteration % 2) == 0) ? [1,3] : [3,3])\n @lp.update\n @lp.flip_buffers\n end", "def update_menu_background\n end", "def move_pos_off\n @move_pos_selecting = false\n remove_show_hls\n # @spriteset.remove_group(DISPLAY_TB) # @spriteset.dispose_highlights_tb\n end", "def swap_colors(map)\n self.bitmap.swapColors(map) if self.bitmap\n end", "def run\n failed_attempts = 0\n failed_white_attempts = 0\n x = 0\n y = 0\n loop do\n # If white just sail through until we hit another color\n if @current_color == 1\n x_next, y_next = move_direction(x, y)\n\n # If in white and hit boundary or black then step through dp\n if restricted?(x_next, y_next)\n toggle_cc\n step_dp\n failed_white_attempts += 1\n else\n x = x_next\n y = y_next\n @current_color = @image.color(x, y)\n failed_attempts = 0\n failed_white_attempts = 0\n end\n\n break if failed_white_attempts == 4\n else\n @size = 0\n temp_x = x\n temp_y = y\n x, y, @size = block_fill(x, y)\n # puts \"CURR: #{temp_x+1}, #{temp_y+1}, NEXT: #{x+1}, #{y+1}\"\n x_next, y_next = move_direction(x, y)\n # If we are hitting the edge or a black codel try another direction\n if restricted?(x_next, y_next)\n update_movement(failed_attempts)\n failed_attempts += 1\n else # here we move into the next color block after processing the action\n next_color = @image.color(x_next, y_next)\n process_action(@current_color, next_color)\n x = x_next\n y = y_next\n @current_color = next_color\n failed_attempts = 0\n failed_white_attempts = 0\n end\n\n break if failed_attempts == 8\n end\n end\n end", "def init_pos\r\n reset_board_variables\r\n colors = {:white => 0, :black => 7}\r\n pieces = {:torr => [0,7], :cav => [1,6], :alf => [2,5], :reg => [3], :re => [4]}\r\n key_pieces = {:white => [:w1, :w2, :w3, :w4, :w5, :w6, :w7, :w8, :w9, :w10, :w11, :w12, :w13, :w14, :w15, :w16],\r\n :black => [:b1, :b2, :b3, :b4, :b5, :b6, :b7, :b8, :b9, :b10, :b11, :b12, :b13, :b14, :b15, :b16]}\r\n # set pieces \r\n colors.each do |k_col, v_col|\r\n # iterate each color\r\n key_color_array = key_pieces[k_col]\r\n pieces.each do |k_pie, v_pie|\r\n # iterate each piece\r\n v_pie.each do |ix_piece|\r\n #p v_col, ix_piece, k_pie, k_col\r\n @infosquare[v_col][ix_piece].setinfo(k_pie, k_col)\r\n #kk_p = key_color_array.pop\r\n @pieces[k_col] << @infosquare[v_col][ix_piece] \r\n end\r\n end#end pieces\r\n \r\n # now set pawn for this color\r\n ix_col = 1\r\n ix_col = 6 if k_col == :black\r\n [0,1,2,3,4,5,6,7].each do |ix_piece|\r\n #p ix_col, ix_piece\r\n @infosquare[ix_col][ix_piece].setinfo(:ped, k_col)\r\n #kk_p = key_color_array.pop\r\n @pieces[k_col] << @infosquare[ix_col][ix_piece] \r\n end\r\n end \r\n #p @pieces\r\n #p @infosquare\r\n #p @pieces.size\r\n #p @pieces[:white].first\r\n end", "def move_increments\n @move_increments = case @color\n when :white\n [[-1, 0], [-2, 0]]\n when :black\n [[1, 0], [2, 0]]\n end\n end", "def draw_background\r\n Gosu.draw_rect 0, 0, self.width, self.height, Gosu::Color::BLACK\r\n end", "def update_color\n self.color.set(@battler.state_color) if @color_flash.alpha == 0\n # Note: @color_flash taken from my Basic Modules v1.5b (Clone image)\n end", "def reset\n Style.clear_index\n reset_color_scheme\n reset_use_color\n end", "def unmake_move(m)\n @ply -= 1\n @mx, @mn = @mn, @mx\n @colors[m.from], @pieces[m.from] = @mx, m.piece\n @colors[m.to], @pieces[m.to] = m.target == EMPTY ? EMPTY : @mn, m.target\n @kings[@mx] = m.from if m.piece == KING\n end", "def add_colors\n\tNcurses.start_color\n\tcolors = %w[RED BLUE GREEN MAGENTA CYAN YELLOW]\n\tcolors.each { |color|\n\t\teval \"Ncurses.init_color( Ncurses::COLOR_#{color}, #{rand(0..1000)}, #{rand(0..1000)}, #{rand(0..1000)} )\"\n\t}\n\t#Ncurses.init_pair( PAIR_NUMBER, BORDER_LINE_COLOR, BORDER_COLOR)\n\trandom_color = eval \"Ncurses::COLOR_#{colors.sample}\"\n\tNcurses.init_pair(2, random_color, Ncurses::COLOR_RED)\n\tNcurses.init_pair(3, random_color, Ncurses::COLOR_BLUE)\n\tNcurses.init_pair(4, random_color, Ncurses::COLOR_GREEN)\n\tNcurses.init_pair(5, random_color, Ncurses::COLOR_MAGENTA)\n\tNcurses.init_pair(6, random_color, Ncurses::COLOR_CYAN)\n\tNcurses.init_pair(7, random_color, Ncurses::COLOR_YELLOW)\nend", "def reset_colors\n @color_output ||= true\n\n # Build the default colors\n Term::ANSIColorHI.coloring = color_output\n c = Term::ANSIColorHI\n @color_app_info = c.intense_white + c.bold\n @color_app_exe = c.intense_green + c.bold\n @color_command = c.intense_yellow\n @color_description = c.intense_white\n @color_parameter = c.intense_cyan\n @color_usage = c.intense_black + c.bold\n \n @color_error_word = c.intense_black + c.bold\n @color_error_name = c.intense_red + c.bold\n @color_error_description = c.intense_white + c.bold\n \n @color_bold = c.bold\n @color_reset = c.reset\n @screen_clear = \"\\e[H\\e[2J\"\n end", "def setDefaultColor\n self.changeColor A_NORMAL, COLOR_WHITE, COLOR_BLACK\n end", "def clear_screen_and_display_board\n clear\n display_board\n end", "def background_color\n @background_color ||= [0, 0, 0]\n end", "def white!\n self.color = :white\n end", "def _context_set_bgcolor!(rgb)\n $gimp_iface.gimp_context_set_background(rgb)\nend", "def input_move(move, color)\n move = move.to_i\n index = 0\n until @board[move][index] == 0\n index += 1\n end\n @board[move][index] = color\n end", "def populate_pad\n @_populate_needed = false\n\n create_pad\n\n # clearstring is the string required to clear the pad to background color\n @clearstring = nil\n $log.debug \" populate pad color = #{@color} , bg = #{@bgcolor} \"\n #cp = get_color($datacolor, color(), bgcolor())\n # commenting off next line meant that textdialog had a black background 2014-05-01 - 23:37\n #@cp = FFI::NCurses.COLOR_PAIR(cp)\n # we seem to be clearing always since a pad is often reused. so making the variable whenever pad created.\n\n @repaint_all = true\n\n end", "def set_color(piece)\n # sets color to red if at cursor [row, col]\n if cursor.cursor_pos == piece.position\n to_color = {:color => :light_blue, :background => :red}\n # otherwise color is blue\n else\n to_color = :blue\n end\n\n to_color\n end", "def reset\n @grid.reset_pulses\n end", "def refresh_states(force = false)\n if force or @actor != @states_act or @actor.states != @states\n @states_act = @actor\n x = 0\n y = self.contents.height-24\n @states = @actor.states.clone\n draw_states(x,y,@states, [])\n end\n end", "def setColors(boardGame, newColor, oldColor, i, j) \n #checks if the pointer is within the bounds of the array and the colour that needs to be replaced \n #but not the new colour as this can lead to a stackoverflow\n if (i >= 0 and i <= boardGame.length - 1) and (j >= 0 and j <= boardGame[i].length - 1) and (boardGame[i][j] == oldColor) and (newColor != oldColor) then \n boardGame[i][j] = setColors boardGame, newColor, oldColor, i - 1, j\n boardGame[i][j] = setColors boardGame, newColor, oldColor, i + 1, j\n boardGame[i][j] = setColors boardGame, newColor, oldColor, i, j + 1\n boardGame[i][j] = setColors boardGame, newColor, oldColor, i, j - 1 \n else\n return newColor\n end\nend", "def setup_board\n (1..64).each do |location|\n @@piece_locations[location] = {\"type\" => \" \", \"number\" => nil, \"color\" => nil}\n end\n\n # Black Pieces\n @@piece_locations[1] = {\"type\" => \"rook\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[2] = {\"type\" => \"knight\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[3] = {\"type\" => \"bishop\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[4] = {\"type\" => \"queen\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[5] = {\"type\" => \"king\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[6] = {\"type\" => \"bishop\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[7] = {\"type\" => \"knight\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[8] = {\"type\" => \"rook\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n (1..8).each do |col|\n @@piece_locations[col + 8] = {\"type\" => \"pawn\", \"number\" => col, \"color\" => \"black\", \"moved\" => false}\n end\n\n # White Pieces\n @@piece_locations[57] = {\"type\" => \"rook\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[58] = {\"type\" => \"knight\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[59] = {\"type\" => \"bishop\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[60] = {\"type\" => \"queen\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[61] = {\"type\" => \"king\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[62] = {\"type\" => \"bishop\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[63] = {\"type\" => \"knight\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[64] = {\"type\" => \"rook\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n (1..8).each do |col|\n @@piece_locations[col + 48] = {\"type\" => \"pawn\", \"number\" => col, \"color\" => \"red\", \"moved\" => false}\n end\n end", "def init_pos\n reset_board_variables\n colors = {:white => 0, :black => 7}\n pieces = {:torr => [0,7], :cav => [1,6], :alf => [2,5], :reg => [3], :re => [4]}\n key_pieces = {:white => [:w1, :w2, :w3, :w4, :w5, :w6, :w7, :w8, :w9, :w10, :w11, :w12, :w13, :w14, :w15, :w16],\n :black => [:b1, :b2, :b3, :b4, :b5, :b6, :b7, :b8, :b9, :b10, :b11, :b12, :b13, :b14, :b15, :b16]}\n # set pieces \n colors.each do |k_col, v_col|\n # iterate each color\n key_color_array = key_pieces[k_col]\n pieces.each do |k_pie, v_pie|\n # iterate each piece\n v_pie.each do |ix_piece|\n #p v_col, ix_piece, k_pie, k_col\n @infosquare[v_col][ix_piece].setinfo(k_pie, k_col)\n #kk_p = key_color_array.pop\n @pieces[k_col] << @infosquare[v_col][ix_piece] \n end\n end#end pieces\n \n # now set pawn for this color\n ix_col = 1\n ix_col = 6 if k_col == :black\n [0,1,2,3,4,5,6,7].each do |ix_piece|\n #p ix_col, ix_piece\n @infosquare[ix_col][ix_piece].setinfo(:ped, k_col)\n #kk_p = key_color_array.pop\n @pieces[k_col] << @infosquare[ix_col][ix_piece] \n end\n end \n #p @pieces\n #p @infosquare\n #p @pieces.size\n #p @pieces[:white].first\n end", "def colors_for(i, j)\n mode = :default\n if [i, j] == @cursor\n bg = @board.piece_in_hand.is_a?(NullPiece) ? :yellow : :light_blue\n # mode = :blink\n # elsif @board.piece_in_hand.filter_moves.include?([i,j])\n # bg = :white\n elsif (i + j).odd?\n bg = :white\n bg = :green if highlight && @board.piece_in_hand.filter_moves.include?([i,j])\n elsif (i + j).even?\n bg = :light_white\n bg = :light_green if highlight && @board.piece_in_hand.filter_moves.include?([i,j])\n end\n\n { background: bg, color: :black, mode: mode } #@board[[i, j]].color\n end", "def display_board(board)\n (0..board.length - 1).each do |i|\n (0..board[i].length - 1).each do |j|\n print \" \".colorize(:background => board[i][j])\n end\n puts\n end\nend", "def compact_pieces\n @recheck = false\n for i in (0..@width-1)\n for j in (0..@height-1)\n if @board[i][j] and @board[i][j+1].nil? #drop pieces down\n @recheck = true\n @board[i][j+1] = @board[i][j]\n @board[i][j] = nil \n elsif j == 0 and @board[i][j].nil? #replace pieces at top\n @recheck = true\n @board[i][j] = Piece.new\n end\n end\n end\n if @startup and @recheck #fast setup of board before update + anim loops start\n compact_pieces\n clear_matches\n end \n end", "def reset_game\n @cur_board.clear_board\n @cur_board.setup_board\n @turn = 1\n @player_to_move = \"w\"\n end", "def clear c = :black\n fast_rect 0, 0, w, h, c\n end", "def clear c = :black\n fast_rect 0, 0, w, h, c\n end", "def recycle_colors(color_index)\n #\"or\" used for control flow\n colors[i+1] or 0\n end", "def recycle_colors(color_index)\n #\"or\" used for control flow\n colors[i+1] or 0\n end", "def render_background\n render_unvisited\n render_grid_lines\n render_labels\n end", "def update_pokemon_alpha_down\n max_alpha_time = POKEMON_ALPHA_DOWN_END - POKEMON_ALPHA_DOWN_START\n current_time = max_alpha_time - (@counter - POKEMON_ALPHA_DOWN_START)\n @pokemon_color.alpha = MAX_POKEMON_ALPHA * current_time / max_alpha_time\n @pokemon_sprite.set_color(@pokemon_color)\n end", "def invalidate_color_components\n @color_components = nil\n end", "def invalidate_color_components\n @color_components = nil\n end" ]
[ "0.67560405", "0.6548178", "0.64613676", "0.6415993", "0.6356734", "0.6325662", "0.63128746", "0.6224831", "0.62128246", "0.61966574", "0.6182825", "0.61577314", "0.61432576", "0.61271137", "0.6081569", "0.60767955", "0.6067993", "0.60555184", "0.605529", "0.5979636", "0.5978365", "0.5965027", "0.592907", "0.5923271", "0.59118086", "0.5854845", "0.58515805", "0.5847953", "0.58403593", "0.58291113", "0.5826644", "0.57931024", "0.578534", "0.57826173", "0.5780744", "0.5770217", "0.5766512", "0.57621235", "0.57613915", "0.5754122", "0.57499814", "0.5747127", "0.57310826", "0.5721852", "0.57192516", "0.5710146", "0.5692516", "0.56867504", "0.5684483", "0.5684483", "0.56726277", "0.5671241", "0.56635517", "0.56546557", "0.5645573", "0.56387925", "0.56375015", "0.5625106", "0.56068206", "0.5599436", "0.5594953", "0.5593904", "0.55865693", "0.5578249", "0.5574", "0.5569029", "0.55689615", "0.5562192", "0.5561722", "0.55603594", "0.5557497", "0.5543576", "0.55417556", "0.5541378", "0.55413145", "0.5534399", "0.5533513", "0.55312324", "0.5520085", "0.5515138", "0.55142266", "0.5512055", "0.55117536", "0.55093324", "0.5494395", "0.54915005", "0.5491384", "0.5489135", "0.54864407", "0.54853606", "0.5481708", "0.54786247", "0.5474064", "0.5474064", "0.54712653", "0.54712653", "0.54556996", "0.5451897", "0.5428197", "0.5428197" ]
0.8452587
0
methods for building the initial board
def build_first_row(board) (0..7).each do |col| if col.zero? board[1][col] = BoardSquare.new('cyan', Rook.new('white'), 1) elsif col == 7 board[1][col] = BoardSquare.new('magenta', Rook.new('white')) elsif col == 1 board[1][col] = BoardSquare.new('magenta', Knight.new('white')) elsif col == 6 board[1][col] = BoardSquare.new('cyan', Knight.new('white')) elsif col == 2 board[1][col] = BoardSquare.new('cyan', Bishop.new('white')) elsif col == 5 board[1][col] = BoardSquare.new('magenta', Bishop.new('white')) elsif col == 3 board[1][col] = BoardSquare.new('magenta', King.new('white')) elsif col == 4 board[1][col] = BoardSquare.new('cyan', Queen.new('white')) end end board end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_board\n make_blank_board\n populate_board\n end", "def setup_board\n gameboard.build_board\n build_white_side\n build_black_side\n end", "def initialize\n self.make_board\n end", "def initialize_board\n init_board = \"-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1\"\n if self.update(board: init_board)\n return [[ 0,-1,0,-1,0,-1, 0,-1 ],[-1,0,-1,0,-1,0,-1,0],[0,-1,0,-1,0,-1,0,-1],\n [0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],\n [1,0,1,0,1,0,1,0],[0,1,0,1,0,1,0,1],[1,0,1,0,1,0,1,0]]\n end\n end", "def initialize\n @board = (0...8).map { [nil] * 8 }\n populate_board\n\n\tend", "def build_board\n @original_board\n @working_board.collect! { |row|\n row.collect! { |cell|\n cell = @original_board.shift\n }\n }\n @working_board\n end", "def starting_board\n init_rows([0, 2], :black)\n init_rows([5, 7], :red)\n end", "def initialize \n @rows = 8\n @columns = 8\n @grid = create_board\n end", "def initialize_board\n board = Array.new(8) {Array.new(8)}\n populate_board(board)\n end", "def board_setup\n\t\tinitial_position = [\"rook\", \"knight\", \"bishop\", \"queen\", \"king\", \"bishop\", \"knight\", \"rook\"]\n\t\tspecial_position = [8,1]\n\t\tpawn_position = [7,2]\n\t\tinitial_color = [\"black\",\"white\"]\n\t\ti = 0\n\t\tx = 0\n\t\t#loops through ranks 8 and 1 setting each class piece in his corresponding position.\n\t\tspecial_position.each do |num|\n\t\t\t(\"a\"..\"h\").each do |letter|\n\t\t\t\t@board[letter+num.to_s].name = initial_position[i]\n\t\t\t\t@board[letter+num.to_s].color = initial_color[x]\n\t\t\t\ti += 1\n\t\t\tend\n\t\t\ti = 0\n\t\t\tx += 1\n\t\tend\n\n\t\ty = 0\n\t\t#loos through ranks 7 and 2 setting the pawn's pieces in his corresponding position.\n\t\tpawn_position.each do |num|\n\t\t\t(\"a\"..\"h\").each do |letter|\n\t\t\t\t@board[letter+num.to_s].name = \"pawn\"\n\t\t\t\t@board[letter+num.to_s].color = initial_color[y]\n\t\t\tend\n\t\t\ty += 1\n\t\tend\n\tend", "def setup_board\r\n place_pawns\r\n place_bishops\r\n place_rooks\r\n place_knights\r\n place_queens\r\n place_kings\r\n end", "def initializeBoard()\n\t\tfor i in ([email protected])\n\t\t\tfor j in ([email protected])\n\t\t\t\t@board[i][j] = EMPTY\n\t\t\tend\n\t\tend\n\n\t\t@board[@size/2][@size/2] = BLACK\n\t\t@board[@size/2 - 1][@size/2 - 1] = BLACK\n\t\t@board[@size/2 - 1][@size/2] = WHITE\n\t\t@board[@size/2][@size/2 - 1] = WHITE\n\n end", "def generate_board\n [0, 1, 2].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :B) if offset.odd?\n end\n end\n\n [5, 6, 7].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :W) if offset.odd?\n end\n end\n end", "def initialize\n create_board\n end", "def setup_board\n @startup = true\n @board = @board.map{|col| col.map{|piece| Piece.new if piece.nil?}}\n clear_matches\n @startup = false\n @pieces_removed = 0\n end", "def initializeBoard()\n\n # TO DO: COMPLETE THIS METHOD\n maxMid = @size / 2\n minMid = @size / 2 - 1\n for i in 0..size-1\n for j in 0..size-1\n if i == maxMid && j == maxMid\n @board[i][j] = \"B\"\n elsif i == minMid && j == minMid\n @board[i][j] = \"B\"\n elsif (i == minMid || i == maxMid) && (j == maxMid || j == minMid)\n @board[i][j] = \"W\"\n else\n @board[i][j] = \"-\";\n end\n end\n end\n end", "def setup_board!\n\t\t@board = Array.new($dimensions[:y]){ Array.new($dimensions[:x]) {:empty} }\n\tend", "def populate_board(board)\n #Fills in the top and bottom rows\n [0, 7].each do |row|\n 4.times do |col|\n board[row][col] = create_piece(row, col)\n board[row][(7-col)] = create_piece(row, (7-col))\n end\n end\n\n #Fills in the pawns\n 8.times do |col|\n board[1][col] = BlackPawn.new(1, col)\n board[6][col] = WhitePawn.new(6, col)\n end\n\n board\n end", "def initialize\n\t\treset_board\n\tend", "def init_board\n @board = Board.new\n @board.display_board\n end", "def create_board\n\t\t8.times{|x| @board.push([nil,nil,nil,nil,nil,nil,nil,nil])}\n\t\tpopulate_board\n\tend", "def populate_board\n rows_of_pieces = (size - 2) / 2\n make_pieces([0, 1], 'red', rows_of_pieces, 1)\n make_pieces([size - 1, 0], 'black', rows_of_pieces, -1)\n end", "def populate_board\n back_row = [Rook, Knight, Bishop, Queen, King, Bishop, Knight, Rook]\n\n black_back_row = []\n back_row.each_with_index do |piece_class, j|\n black_back_row << piece_class.new(self, :black, [0, j])\n end\n board[0] = black_back_row\n \n black_front_row = []\n (0..7).each {|idx| black_front_row << Pawn.new(self, :black, [1, idx])}\n board[1] = black_front_row\n \n (2..5).each do |row|\n board[row] = Array.new(8) {NullPiece.instance} \n end\n \n white_front_row = []\n 8.times {|idx| white_front_row << Pawn.new(self, :white, [6, idx])}\n board[6] = white_front_row\n \n white_back_row = []\n back_row.each_with_index do |piece_class, j|\n white_back_row << piece_class.new(self, :white, [7, j])\n end\n board[7] = white_back_row\n end", "def init_board\n @board =\n if board_state.present?\n Board.new(width: rows, height: cols, mines_count: mines).tap do |b|\n b.load_state!(board_state)\n end\n else\n Board.new(width: rows, height: cols, mines_count: mines).tap do |b|\n b.setup!\n end\n end\n end", "def populate_board\n\t\t8.times{|x|\t@board[x][6] = Pawn.new([x, 6], \"black\", @board)}\n\t\t@board[0][7] = Rook.new([0, 7], \"black\", @board)\t\n\t\t@board[1][7] = Knight.new([1, 7], \"black\", @board)\n\t\t@board[2][7] = Bishop.new([2, 7], \"black\", @board)\n\t\t@board[3][7] = Queen.new([3, 7], \"black\", @board)\n\t\t@board[4][7] = King.new([4, 7], \"black\", @board)\t\t\n\t\t@board[5][7] = Bishop.new([5, 7], \"black\", @board)\n\t\t@board[6][7] = Knight.new([6, 7], \"black\", @board)\n\t\t@board[7][7] = Rook.new([7, 7], \"black\", @board)\n\t\t\t\t\n\t\t 8.times{|x|\t@board[x][1] = Pawn.new([x, 1], \"white\", @board)}\n\t\t@board[0][0] = Rook.new([0, 0], \"white\", @board)\t\n\t\t@board[1][0] = Knight.new([1, 0], \"white\", @board)\n\t\t@board[2][0] = Bishop.new([2, 0], \"white\", @board)\n\t\t@board[3][0] = Queen.new([3, 0], \"white\", @board)\n\t\t@board[4][0] = King.new([4, 0], \"white\", @board)\t\t\n\t\t@board[5][0] = Bishop.new([5, 0], \"white\", @board)\n\t\t@board[6][0] = Knight.new([6, 0], \"white\", @board)\n\t\t@board[7][0] = Rook.new([7, 0], \"white\", @board)\n\tend", "def initialize_board\n # Building out white pieces\n (0..7).each do |x|\n Pawn.create(is_black: false, x_position: x, y_position: 1, game_id: id, user_id: user_id_white, status: 'active')\n end\n\n Rook.create(is_black: false, x_position: 0, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n Rook.create(is_black: false, x_position: 7, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n\n Knight.create(is_black: false, x_position: 1, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n Knight.create(is_black: false, x_position: 6, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n\n Bishop.create(is_black: false, x_position: 2, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n Bishop.create(is_black: false, x_position: 5, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n\n King.create(is_black: false, x_position: 4, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n Queen.create(is_black: false, x_position: 3, y_position: 0, game_id: id, user_id: user_id_white, status: 'active')\n\n # Building out the black pieces\n (0..7).each do |x|\n Pawn.create(is_black: true, x_position: x, y_position: 6, game_id: id, user_id: user_id_black, status: 'active')\n end\n\n Rook.create(is_black: true, x_position: 0, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n Rook.create(is_black: true, x_position: 7, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n\n Knight.create(is_black: true, x_position: 1, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n Knight.create(is_black: true, x_position: 6, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n\n Bishop.create(is_black: true, x_position: 2, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n Bishop.create(is_black: true, x_position: 5, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n\n King.create(is_black: true, x_position: 4, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n Queen.create(is_black: true, x_position: 3, y_position: 7, game_id: id, user_id: user_id_black, status: 'active')\n end", "def initialize()\n grid = BOARD_NUMBERS.map{ |x| BOARD_ALPHABET.map{ |y| y + x}}.flatten\n @board = Hash[grid.collect { |k| [k, EMPTY]} ]\n end", "def initializeBoard()\n #\n # TO DO: complete this method\n #\n for j in 0...@size\n for i in 0...@size\n @board[j][i]=EMPTY\n end\n end\n center = (@size/2)-1\n @board[center][center] = BLACK\n @board[center+1][center+1] = BLACK\n @board[center+1][center] = WHITE\n @board[center][center+1] = WHITE\n\n\n\n\n end", "def setup(board)\n ('a'..'h').each_with_index do |column, index|\n # Set up the home rows\n [[1, :white], [8, :black]].each do |row, color|\n piece = HOME_ROW[index].new(color)\n board.place( Square.new(column, row), piece )\n end\n \n # Setup the pawns\n [[2, :white], [7,:black]].each do |row, color|\n piece = Pawn.new(color)\n board.place( Square.new(column, row), piece)\n end\n end\n end", "def init_board(size=5, handicap=0)\n @game = GameLogic.new\n @game.new_game(size, handicap)\n @goban = @game.goban\n @grid = Grid.new(size)\n @filler = ZoneFiller.new(@goban, @grid)\n end", "def fill_board\n\t\tfill_row_pieces(0, 'b')\n\t\tfill_row_pawn(1, 'b')\n\t\tfill_row_pieces(7, 'w')\n\t\tfill_row_pawn(6, 'w')\n\tend", "def initialize #if module this method could be set_board\n @row_a = [\"A\"] + [\" \"]* 8\n @row_b = [\"B\"] + [\" \"]* 8\n @row_c = [\"C\"] + [\" \"]* 8\n @row_d = [\"D\"] + [\" \"]* 8\n empty_board\n two_unit_valid_places\n three_unit_valid_places\n end", "def initialize\n\t\t@board=Hash.new \n\t\t(0..6).each{ |i|\n\t\t\t(0..6).each{ |j|\n\t\t\t\t@board[[i,j]]=Cell.new(0,0,\"\")\n\t\t\t}\n\t\t}\n\t\t#==== intitial cells\n\t\t@board[[1,1]].value=2\n\t\t@board[[2,3]].value=4\n\t\t@move_result=0\n\tend", "def initialize\n @board_array = [[],[],[],[],[],[],[],[],[],[]]\n # tile_board\n # set_mines\n end", "def newBoard\n\t\t\t[['r', 'n', 'b', 'k', 'q', 'b', 'n', 'r'],\n\t\t\t ['p', 'p', 'p', 'p', 'p', 'p', 'p', 'p'],\n\t\t\t ['', '', '', '', '', '', '', ''],\n\t\t\t ['', '', '', '', '', '', '', ''],\n\t\t\t ['', '', '', '', '', '', '', ''],\n\t\t\t ['', '', '', '', '', '', '', ''],\n\t\t\t ['P', 'P', 'P', 'P', 'P', 'P', 'P', 'P'],\n\t\t\t ['R', 'N', 'B', 'K', 'Q', 'B', 'N', 'R']]\n\tend", "def initialize\n @board=Array.new(9) {Array.new(9, false)}\n self.populate_mines\n self.fill_up_board_with_tiles\n @game_over = false\n end", "def initialize\n @board = Array[]\n initializeTop\n initializeMiddle\n initializeBottom\n end", "def initialize board\n @board = board\n end", "def initialize(setup = true)\n @board = Array.new(8) {Array.new(8)}\n setup_board if setup\n end", "def initialize\n @grid = empty_board\n end", "def populate_board\n black = \"black\"\n white = \"white\"\n\n white_pawns = [\"A2\", \"B2\", \"C2\", \"D2\", \"E2\", \"F2\", \"G2\", \"H2\"]\n black_pawns = [\"A7\", \"B7\", \"C7\", \"D7\", \"E7\", \"F7\", \"G7\", \"H7\"]\n\n # create white pawns\n white_pawns.each do |pos|\n @board.nodes[pos].piece = create_pawn(white, pos)\n end\n\n # create white pieces\n @board.nodes[\"E1\"].piece = create_king(white, \"E1\")\n @board.nodes[\"D1\"].piece = create_queen(white, \"D1\")\n @board.nodes[\"C1\"].piece = create_bishop(white, \"C1\")\n @board.nodes[\"F1\"].piece = create_bishop(white, \"F1\")\n @board.nodes[\"B1\"].piece = create_knight(white, \"B1\")\n @board.nodes[\"G1\"].piece = create_knight(white, \"G1\")\n @board.nodes[\"A1\"].piece = create_rook(white, \"A1\")\n @board.nodes[\"H1\"].piece = create_rook(white, \"H1\")\n\n # create black pawns\n black_pawns.each do |pos|\n @board.nodes[pos].piece = create_pawn(black, pos)\n end\n\n # create black pieces\n @board.nodes[\"E8\"].piece = create_king(black, \"E8\")\n @board.nodes[\"D8\"].piece = create_queen(black, \"D8\")\n @board.nodes[\"C8\"].piece = create_bishop(black, \"C8\")\n @board.nodes[\"F8\"].piece = create_bishop(black, \"F8\")\n @board.nodes[\"B8\"].piece = create_knight(black, \"B8\")\n @board.nodes[\"G8\"].piece = create_knight(black, \"G8\")\n @board.nodes[\"A8\"].piece = create_rook(black, \"A8\")\n @board.nodes[\"H8\"].piece = create_rook(black, \"H8\")\n\n end", "def create_board\n\n 8.times do |row|\n 8.times do |col|\n new_cell = Cell.new([col + 1, row + 1])\n @@cells.push(new_cell)\n end\n end\n\n end", "def initBoard\n cellNum = 0\n while cellNum < (@columns * @rows)\n @board.push(rand < @genWeighting ? 1 : 0)\n cellNum += 1\n end\n @board\n end", "def setup_game\n name_player = set_name_player\n number_columns = set_number_columns\n number_rabbits = set_number_rabbits(number_columns)\n number_foxs = set_number_foxs(number_columns)\n\n board = build_board(number_columns)\n rabbit_collection = build_rabbit_collection(number_columns, number_rabbits)\n fox_collection = build_fox_collection(number_columns, number_foxs)\n\n\n [ board, name_player, number_columns, rabbit_collection, fox_collection ]\nend", "def create_board\n @board[\"18\"] = Rook.new(\"Blacks\")\n @board[\"28\"] = Knight.new(\"Blacks\")\n @board[\"38\"] = Bishop.new(\"Blacks\")\n @board[\"48\"] = Queen.new(\"Blacks\")\n @board[\"58\"] = King.new(\"Blacks\")\n @board[\"68\"] = Bishop.new(\"Blacks\")\n @board[\"78\"] = Knight.new(\"Blacks\")\n @board[\"88\"] = Rook.new(\"Blacks\") \n 8.times { |index| @board[\"#{index + 1}7\"] = BlackPawn.new(\"Blacks\") } \n\n 8.times { |index| @board[\"#{index + 1}6\"] = nil }\n 8.times { |index| @board[\"#{index + 1}5\"] = nil }\n 8.times { |index| @board[\"#{index + 1}4\"] = nil }\n 8.times { |index| @board[\"#{index + 1}3\"] = nil }\n\n 8.times { |index| @board[\"#{index + 1}2\"] = WhitePawn.new(\"Whites\") } \n @board[\"11\"] = Rook.new(\"Whites\") \n @board[\"21\"] = Knight.new(\"Whites\")\n @board[\"31\"] = Bishop.new(\"Whites\")\n @board[\"41\"] = Queen.new(\"Whites\")\n @board[\"51\"] = King.new(\"Whites\")\n @board[\"61\"] = Bishop.new(\"Whites\")\n @board[\"71\"] = Knight.new(\"Whites\")\n @board[\"81\"] = Rook.new(\"Whites\")\n end", "def initialize\n @board = Array.new(8) { Array.new(8) }\n @all_pieces = []\n @board_history = []\n @move_record = []\n end", "def create\n (0..7).each do |row|\n @board << []\n (0..7).each do |col| \n @board[row] << \"[ ]\"\n end\n end\n end", "def initialize()\n @board = {}\n colors = [Square::BLACK, Square::WHITE]\n\n (1..8).each do |row|\n (1..8).each do |col|\n\n # Place starting pieces on board\n if (1..3).include?(row) && Square.new(colors[0]).color == Square::BLACK\n Square.new(colors[0]).checker_piece = Piece.new(Piece::BLACK)\n elsif (6..8).include?(row) && Square.new(colors[0]).color == Square::BLACK\n Square.new(colors[0]).checker_piece = Piece.new(Piece::RED)\n end\n\n @board[[row,col]] = Square.new(colors[0])\n\n colors << colors.delete_at(0) unless col == 8\n end\n end\n end", "def initialize(fill_board = true)\n @grid = Array.new(8) { Array.new(8) }\n\n setup_grid if fill_board\n end", "def board\n end", "def new_round\n init_board()\n end", "def initialize()\n @board = {}\n colors = [Square::BLACK, Square::WHITE]\n \n (1..8).each do |row|\n (1..8).each do |col|\n sq = Square.new(colors[0])\n\n # Place starting pieces on board\n if (1..3).include?(row) && sq.color == Square::BLACK\n sq.checker_piece = Piece.new(Piece::BLACK)\n elsif (6..8).include?(row) && sq.color == Square::BLACK\n sq.checker_piece = Piece.new(Piece::RED)\n end\n \n @board[[row,col]] = sq\n \n colors << colors.delete_at(0) unless col == 8\n end\n end\n end", "def new_board\n board = []\n 8.times do |row|\n board << case row\n when 0\n add_back_row(\"white\", row)\n when 1\n add_pawn_row(\"white\", row)\n when 6\n add_pawn_row(\"black\", row)\n when 7\n add_back_row(\"black\", row)\n else\n Array.new(8)\n end\n end \n board\n end", "def initialize\n\t\t\t@empty_cell = '_'\n\t\t\t@board = Array.new(3) {Array.new(3,@empty_cell)}\n\t\tend", "def board\n\n end", "def create_board\n (1..(@width * @width).to_i).each do |i|\n values = i <= @amount_mines ? @bomb : @empty\n @board.push({\n value: values,\n revealed?: false\n })\n end\n @board.shuffle!\n @board\n end", "def create_board\n cols = Array.new(7) { Array.new(6, 0) }\n cols\n end", "def initialize_baord\n new_board = {}\n (1..9).each { |num| new_board[num] = INITIAL_MARKER }\n new_board # this is the return value so you can call it through the display board\nend", "def initialize(fill_board = true)\n @sentinel = Null_piece.instance\n\n @rows = Array.new(8) { Array.new(8, @sentinel) }\n\n fill_board_tiles if fill_board\n end", "def initialize\n @board = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\n end", "def make_board\n @grid = Array.new(9) { | row | Array.new(9) { | col | Tile.new(self, [row, col]) } }\n self.place_bombs\n @grid.map.with_index do | row, rowIndx |\n row.map.with_index { | tile, colIndx | tile.neighbors_bomb_count if !(self.is_a_bomb?([rowIndx, colIndx])) }\n end\n end", "def initialize\n \t@board = Array.new(10) { Array.new(10) }\n \t@hash = {} #for letter conversion\n \tsetup \n \tsetup_keys\n end", "def setup\n (1..12).each do |num|\n @board[num] = %W[_ _ _ _]\n end\n end", "def generateBoard()\n board = []\n\n ([email protected]).each do |r|\n row = []\n ([email protected]).each { |c| row.push('X') }\n board.push(row)\n end\n\n board\n end", "def setup_board\n (1..64).each do |location|\n @@piece_locations[location] = {\"type\" => \" \", \"number\" => nil, \"color\" => nil}\n end\n\n # Black Pieces\n @@piece_locations[1] = {\"type\" => \"rook\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[2] = {\"type\" => \"knight\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[3] = {\"type\" => \"bishop\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[4] = {\"type\" => \"queen\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[5] = {\"type\" => \"king\", \"number\" => 1, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[6] = {\"type\" => \"bishop\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[7] = {\"type\" => \"knight\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n @@piece_locations[8] = {\"type\" => \"rook\", \"number\" => 2, \"color\" => \"black\", \"moved\" => false}\n (1..8).each do |col|\n @@piece_locations[col + 8] = {\"type\" => \"pawn\", \"number\" => col, \"color\" => \"black\", \"moved\" => false}\n end\n\n # White Pieces\n @@piece_locations[57] = {\"type\" => \"rook\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[58] = {\"type\" => \"knight\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[59] = {\"type\" => \"bishop\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[60] = {\"type\" => \"queen\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[61] = {\"type\" => \"king\", \"number\" => 1, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[62] = {\"type\" => \"bishop\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[63] = {\"type\" => \"knight\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n @@piece_locations[64] = {\"type\" => \"rook\", \"number\" => 2, \"color\" => \"red\", \"moved\" => false}\n (1..8).each do |col|\n @@piece_locations[col + 48] = {\"type\" => \"pawn\", \"number\" => col, \"color\" => \"red\", \"moved\" => false}\n end\n end", "def test_init\n #@board[0][5].piece = Bishop.new(@board[0][5], \"♗\", \"white\")\n @board[0][4].piece = King.new(@board[0][4], \"♔\", 'white')\n\n @board[7][4].piece = Queen.new(@board[7][4], \"♛\", \"black\" )\n @board[7][3].piece = Rook.new(@board[7][3], \"♜\", \"black\")\n @board[7][5].piece = Rook.new(@board[7][5], \"♜\", \"black\")\n end", "def initialize ()\n\t\t@board = [\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \" ,\" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" X \", \" O \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" O \", \" X \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \"]\n\t\t@board_arr\t\t= Array([email protected])\n\t\t@board_height\t= 8\n\t\t@board_width \t= 8\n\tend", "def transform_initialboard(lines)\n board = []\n 9.times do |i|\n line = []\n 9.times do |j|\n line << lines[j][8 - i]\n end\n board << line\n end\n { 'preset' => 'OTHER', 'data' => { 'board' => board } }\n end", "def populate_board!\n # white pieces\n # creates the 8 pawn pieces across the board\n 8.times do |i|\n # sets game_id in Piece model to current id in Game\n # color is boolean - true for white, false for black\n Pawn.create(game_id: id, x_coord: i, y_coord: 1, color: true, captured: false)\n end\n # creates the 2 rook, knight, and bishop pieces on opposite sides of the board\n (0..7).step(7) do |i|\n Rook.create(game_id: id, x_coord: i, y_coord: 0, color: true, captured: false)\n end\n (1..7).step(5) do |i|\n Knight.create(game_id: id, x_coord: i, y_coord: 0, color: true, captured: false)\n end\n (2..7).step(3) do |i|\n Bishop.create(game_id: id, x_coord: i, y_coord: 0, color: true, captured: false)\n end\n\n Queen.create(game_id: id, x_coord: 3, y_coord: 0, color: true, captured: false)\n King.create(game_id: id, x_coord: 4, y_coord: 0, color: true, captured: false)\n\n # black pieces\n 8.times do |i|\n Pawn.create(game_id: id, x_coord: i, y_coord: 6, color: false, captured: false)\n end\n (0..7).step(7) do |i|\n Rook.create(game_id: id, x_coord: i, y_coord: 7, color: false, captured: false)\n end\n (1..7).step(5) do |i|\n Knight.create(game_id: id, x_coord: i, y_coord: 7, color: false, captured: false)\n end\n (2..7).step(3) do |i|\n Bishop.create(game_id: id, x_coord: i, y_coord: 7, color: false, captured: false)\n end\n Queen.create(game_id: id, x_coord: 3, y_coord: 7, color: false, captured: false)\n King.create(game_id: id, x_coord: 4, y_coord: 7, color: false, captured: false)\n end", "def initialize\n\n\t\t# Set up some default values here; things like the size of board,\n\t\t# level of complexity and suchlike.\n\t\t@board_size = :small\n\t\t@board_level = 1\n\t\tsize \n\t\trender_board\n\n\tend", "def initialize\n @@BOARD_SIZE = 8\n @board = create_board\n @god_mode = false\n end", "def initialize\n super\n self.board = Array.new(3).map{[nil, nil, nil]}\n end", "def initialize(initial_board=nil)\n\t\t@size = initial_board && initial_board.length || 10\n\t\t@initial_board = initial_board # used when existing patterns are passed\n\t\t@cells = []\n\t\t\n\t\tif @initial_board\n\t\t\[email protected] do |x|\n\t\t\t\[email protected]([])\n\t\t\t\[email protected] do |y|\n\t\t\t\t\t@cells[x].push(Cell.new(self, x, y, @initial_board[x][y]))\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\[email protected] do |x|\n\t\t\t\[email protected]([])\n\t\t\t\[email protected] do |y|\n\t\t\t\t\t@cells[x].push(Cell.new(self, x, y))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\tend", "def initialize\n @@cells = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n display_board\n end", "def initialize_board\n b = {} # let's just call this 'b' because it's a local variable\n (1..9).each {|position| b[position] = ' '} # builds hash structure\n return b\nend", "def board \n\t\t@board = {\n\t\t \"a1\"=>'',\"a2\"=>'',\"a3\"=>'',\n\t\t \"b1\"=>'',\"b2\"=>'',\"b3\"=>'',\n\t\t \"c1\"=>'',\"c2\"=>'',\"c3\"=>''\n\t\t}\n\tend", "def initialize\n @board = Array.new(3) { Array.new(3) }\n end", "def initialize\n @board = Array.new(3) { Array.new(3) }\n end", "def new_board\n @board = {'a1'=>' ','a2'=>' ','a3'=>' ','b1'=>' ','b2'=>' ','b3'=>' ','c1'=>' ','c2'=>' ','c3'=>' '}\n end", "def initialize_game\n setup_boards\n end", "def initialize_board\n # Non-pawns for black player:\n Rook.create(x_position: 1, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n Knight.create(x_position: 2, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n Bishop.create(x_position: 3, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n Queen.create(x_position: 4, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n King.create(x_position: 5, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n Bishop.create(x_position: 6, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n Knight.create(x_position: 7, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n Rook.create(x_position: 8, y_position: 1, game_id: id, color: \"black\", player_id: black_player_id)\n\n # Non-pawns for white player:\n Rook.create(x_position: 1, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n Knight.create(x_position: 2, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n Bishop.create(x_position: 3, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n Queen.create(x_position: 4, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n King.create(x_position: 5, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n Bishop.create(x_position: 6, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n Knight.create(x_position: 7, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n Rook.create(x_position: 8, y_position: 8, game_id: id, color: \"white\", player_id: white_player_id)\n\n # Pawns for both players:\n for i in 1..8\n Pawn.create(color: \"black\", x_position: i, y_position: 2, game_id: id, player_id: black_player_id)\n Pawn.create(color: \"white\", x_position: i, y_position: 7, game_id: id, player_id: white_player_id)\n end\n\n self.counter = 0\n # Saves the counter to the database.\n self.save\n end", "def populate\n @board[7][0] = ChessPiece.new \"w_rook_1\", \"\\u2656\"\n @board[7][1] = ChessPiece.new \"w_knight_1\", \"\\u2658\"\n @board[7][2] = ChessPiece.new \"w_bishop_1\", \"\\u2657\"\n @board[7][3] = ChessPiece.new \"w_queen\", \"\\u2655\"\n @board[7][4] = ChessPiece.new \"w_king\", \"\\u2654\"\n @board[7][5] = ChessPiece.new \"w_bishop_2\", \"\\u2657\"\n @board[7][6] = ChessPiece.new \"w_knight_2\", \"\\u2658\"\n @board[7][7] = ChessPiece.new \"w_rook_2\", \"\\u2656\"\n @board[0][0] = ChessPiece.new \"b_rook_1\", \"\\u265C\"\n @board[0][1] = ChessPiece.new \"b_knight_1\", \"\\u265E\"\n @board[0][2] = ChessPiece.new \"b_bishop_1\", \"\\u265D\"\n @board[0][3] = ChessPiece.new \"b_queen\", \"\\u265B\"\n @board[0][4] = ChessPiece.new \"b_king\", \"\\u265A\"\n @board[0][5] = ChessPiece.new \"b_bishop_2\", \"\\u265D\"\n @board[0][6] = ChessPiece.new \"b_knight_2\", \"\\u265E\"\n @board[0][7] = ChessPiece.new \"b_rook_2\", \"\\u265C\"\n (0..7).each do |id|\n @board[6][id] = ChessPiece.new \"w_pawn_#{id+1}\", \"\\u2659\"\n @board[1][id] = ChessPiece.new \"b_pawn_#{id+1}\", \"\\u265F\"\n end \n end", "def initialize\n @board = @@the_board.clone\n end", "def create_board\n\t\t@board = Hash.new\n\t\t(0..7).each do |x|\n\t\t\t@board[x] = []\n\t\t\t(0..7).each do |y|\n\t\t\t\t@board[x][y] = Square.new([x, y])\n\t\t\tend\n\t\tend\n\tend", "def initialize\n # The board is an array of rows, each containing an array of cells\n @board = Array.new(BOARD_HEIGHT){Array.new(BOARD_WIDTH)}\n @board.each_with_index do |y, yi|\n y.each_with_index do |x, xi|\n @board[yi][xi] = \".\"\n end\n end\n end", "def make_board\n board = Array.new(8) { Array.new(8) { Array.new(2) } }\n board.each_with_index do |row, row_i|\n row.each_with_index { |column, column_i| column[0], column[1] = row_i, column_i }\n end\n end", "def initialize_board\r\n board = {}\r\n (1..9).each {|position| board[position] = ' '}\r\n board\r\nend", "def initialize_board\n b = []\n 9.times { b << ' ' } \n b\nend", "def create_board\n\t@a1 = Cases.new(\"a1\", \" \") \n\t@a2 = Cases.new(\"a2\", \" \")\n\t@a3 = Cases.new(\"a3\", \" \")\n\t@b1 = Cases.new(\"b1\", \" \")\n\t@b2 = Cases.new(\"b2\", \" \")\n\t@b3 = Cases.new(\"b3\", \" \")\n\t@c1 = Cases.new(\"c1\", \" \")\n\t@c2 = Cases.new(\"c2\", \" \")\n\t@c3 = Cases.new(\"c3\", \" \")\n\n puts \" ________________________________________________________________________________________________________ \"\n puts \" | __ ___ __ ________ __ ________ ________ ___ ___ ________ | \"\n puts \" | l l l l l l l ______l l l l _____l l __ l l l l l l ______l | \"\n puts \" | l l l _ l l l l l__ l l l l l l l l l l l l l l__ | \"\n puts \" | l l_l l l l_l l l __l l l l l l l l l l l_l l_l l_l l l ___l | \"\n puts \" | l l l l l l_____ l l_____ l l_____ l l__l l l l l l l l l l_____ | \"\n puts \" | l___l l___l l________l l________l l________l l________l l__l l___l l__l l________l | \"\n puts \" |____________________________________________ TO ______________________________________________| \"\n puts \" | TIC TAC TOE | \"\n puts \" |_________________________________________________________________________________________________________| \"\n\n #On cree un Board et on definit ses 9 variables (voir Classe Board) comme etant la valeur de nos 9 cases, soit \" \"\n #on affiche un Board, qui sera vide\n #on cree un array avec toutes nos cases, qui sert a garder a jour les valeurs des cases au fur et a mesure de l'avancee du jeu\n\t@the_board = Board.new(@a1.position, @a2.position, @a3.position, @b1.position, @b2.position, @b3.position, @c1.position, @c2.position, @c3.position) \n\t@the_board.display \n\t@array = [@a1, @a2, @a3, @b1, @b2, @b3, @c1, @c2, @c3] \n end", "def generate_board\n board_array = @board_string.split(\"\")\n @board = Array.new(9){board_array.shift(9)}\n for row in [email protected]\n for col in [email protected]\n @board[row][col] = Square.new(@board[row][col], row, col)\n end\n end\n create_starting_numbers\n @board\n end", "def build_grid\n header = [\" \", \" a \", \" b \", \" c \", \" d \", \" e \", \" f \", \" g \", \" h \"]\n grid_display = @board.grid.map.with_index do |row, index|\n [8 - index] + build_row(row, index)\n end\n grid_display.unshift(header)\n end", "def initialize\n @board = Board.new\n end", "def initialize\n\t\t@board = Board.new\n\t\t\n\tend", "def build_board(board_length, board_height)\n (board_height).times do\n row = []\n (board_length).times do\n row << \" \"\n end\n @board << row\n end\n end", "def gen_board\n\n (\"A\"..\"I\").each do |row|\n (0..8).each_with_index { |column, value| @board.merge!( { \"#{row}#{column}\".to_sym => @board_array.shift.to_i } ) }\n end\n return @board\n end", "def board\n board = Board.new(true)\n grid do |p|\n new_position = p\n new_color = p.color\n new_piece = p.class.new(new_position, new_color, board )\n board[p.pos] = new_piece\n end\n board\n end", "def create_board\n temp_index = 0\n temp_column1 = Array.new(4) { 'O' }\n temp_column2 = Array.new(4) { 'O' }\n @board = []\n 10.times do\n @board << [temp_column1, temp_column2, \"Turn:#{temp_index += 1}\"]\n end\n @board\n end", "def initialize(empty = false)\n @white_points = []\n @black_points = []\n return if empty\n\n @board = []\n 8.times do\n col = []\n 8.times do\n col << SPOT_OPEN\n end\n @board << col\n end\n\n # Add the starting pieces\n mark(3, 3, SPOT_WHITE)\n mark(4, 3, SPOT_BLACK)\n mark(4, 4, SPOT_WHITE)\n mark(3, 4, SPOT_BLACK)\n end", "def initialize\n @board = Array.new(64, 0)\n @black_king_side_castling = true\n @white_king_side_castling = true\n @black_queen_side_castling = true\n @white_queen_side_castling = true\n @last_move = [64,64]\n\n # place pawns\n for i in (8..15)\n @board[i] = -1\n end\n for i in (48..55)\n @board[i] = 1\n end\n\n # place other pieces\n black = [-4, -2, -3, -5, -6, -3, -2, -4]\n white = [4, 2, 3, 5, 6, 3, 2, 4]\n for i in (0..7)\n @board[i] = black.shift\n end\n for i in (56..63)\n @board[i] = white.shift\n end\n end", "def initialize(board)\n @board = board\n end" ]
[ "0.799483", "0.78477526", "0.77917165", "0.76924646", "0.76711076", "0.7647136", "0.76423115", "0.7590954", "0.75210196", "0.75131404", "0.7510589", "0.7496093", "0.74956876", "0.74854535", "0.74476683", "0.74391794", "0.7429478", "0.74101645", "0.74012136", "0.7385538", "0.73782694", "0.7370722", "0.73689616", "0.73652136", "0.73588073", "0.7334398", "0.73247445", "0.73183084", "0.7318274", "0.73076266", "0.72943795", "0.72845566", "0.7276046", "0.7249633", "0.72327006", "0.7215602", "0.7207022", "0.7204493", "0.7198975", "0.7191837", "0.71883553", "0.7149601", "0.7148394", "0.7138906", "0.71353686", "0.71243954", "0.71234787", "0.7105521", "0.7104966", "0.710097", "0.7086043", "0.7084699", "0.7062459", "0.70430785", "0.70329684", "0.7032599", "0.7019622", "0.70109975", "0.70064753", "0.69982326", "0.6987738", "0.69873697", "0.69721437", "0.69666946", "0.6957968", "0.69527245", "0.69488186", "0.69368166", "0.692148", "0.69129544", "0.6911709", "0.69052243", "0.6894005", "0.6891506", "0.688543", "0.6884123", "0.6882366", "0.6882366", "0.68740517", "0.68650854", "0.6855674", "0.6851084", "0.68472177", "0.68338513", "0.6830184", "0.6828118", "0.6816818", "0.68153775", "0.68048483", "0.68040586", "0.6801061", "0.6800733", "0.67656916", "0.6755285", "0.67535126", "0.67517567", "0.6748724", "0.6744083", "0.6742459", "0.6734247" ]
0.7049156
53
methods for filtering possible moves
def filter(location, guest, poss_moves) case guest.id when 'pawn' filter_pawn(location, guest, poss_moves) when 'rook' filter_rook(location, guest, poss_moves) when 'knight' filter_knight(location, guest, poss_moves) when 'bishop' filter_bishop(location, guest, poss_moves) when 'queen' filter_queen(location, guest, poss_moves) when 'king' filter_king(location, guest, poss_moves) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def possible_moves\n # p possible_non_attack_moves\n # p possible_attack_moves\n moves = possible_non_attack_moves + possible_attack_moves\n moves.reject! { |move| move.any? { |c| c < 0 || c > 7} }\n moves\n end", "def get_valid_moves\n possible_moves.select do |dir, moves| \n moves.select! { |mov| check_bounds(mov[0], mov[1]) }\n !moves.empty? && move_directions.include?(dir)\n end\n end", "def valid_moves(from)\r\n\tpossible_moves(from).select { |move| valid_position?(move) }\r\nend", "def valid_moves # do this method with the board#dup and all that and check if in check. Hah, it is indeed very straightforward lol\n all_moves = moves\n all_moves.reject { |move| move_into_check?(move) } # damn code is easy to write when it's good this should just check if a move leaves you in check and if so reject all the moves for which this is true\n end", "def valid_moves\n moves.reject {|move| move_into_check?(move)}\n end", "def valid_moves\n moves.reject { |end_pos| move_into_check?(end_pos) }\n end", "def filterMoves (board)\n\t\[email protected] do |i|\n\t\t\ti.each do |j|\n\t\t\t\tx = j / 8\n\t\t\t\ty = j % 8\n\t\t\t\tif (board[x][y] != nil)\n\t\t\t\t\tif (board[x][y].color == self.color)\n\t\t\t\t\t\ti.delete(j)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# remove empty arrays as a result of the filtering\n\t\[email protected]([])\n\tend", "def valid_moves\n valid_moves = moves.reject do |move|\n move_into_check?(move)\n end\n\n valid_moves\n end", "def valid_moves(from)\n\tpossible_moves(from).select { |move| valid_position?(move) }\nend", "def force_check_filter(board, moves)\n force_check_moves = Hash.new { |hash, key| hash[key] = [] }\n\n moves.each do |start_pos, end_positions|\n end_positions.each do |end_pos|\n new_board = DeepClone.clone(board)\n new_board.move_piece(start_pos, end_pos)\n if new_board.in_checkmate?(opponent_color)\n @end_pos = end_pos\n return start_pos\n elsif new_board.in_check?(opponent_color)\n force_check_moves[start_pos] << end_pos\n end\n end\n end\n\n new_moves = force_check_moves.empty? ? moves : force_check_moves\n highest_value_capture_filter(board, new_moves)\n end", "def legal_moves(state)\n move_list = pre_check_legal_moves(state)\n # # Eliminate moves which leave player in check\n # # move_list.delete_if { |move| check?(next_state(state, move)) }\n # move_list.each do |move| \n # if check?(next_state(state, move))\n # print \".\"\n # move_list.delete(move)\n # end\n # end\n move_list\n end", "def possible_moves\n return []\n end", "def valid_moves(board, current_pos)\n array_of_moves = moves(current_pos)\n\n array_of_moves.delete_if {|pair| pair.min < 0 || pair.max > 7}\n array_of_moves.delete_if {|pair| pair == current_pos}\n\n # array_of_moves = array_of_moves.select {|pos| obstructed?(current_pos,pos,board)} if slider\n #\n # puts array_of_moves\n # sleep 2\n\n end", "def find_possible_moves\n @possible_moves = []\n\n @moveset.each do |move, value|\n x = @x + value[0]\n y = @y + value[1]\n\n next unless ChessBoard.check_boundaries(x, y) && !visited_coordinates.include?([x, y])\n\n @possible_moves << move\n end\n end", "def valid_moves\n\n end", "def possible_moves\n all_moves = []\n x, y = @position\n moves = [[x, y-1], [x-1, y-1], [x-1, y], [x-1, y+1], [x, y+1], [x+1, y+1], [x+1, y], [x+1, y-1]]\n moves.each do |position|\n all_moves << [position] if position.all? { |number| number.between?(0,7) }\n end\n all_moves\n end", "def filter_out_board_edges(possible_moves)\n inbound_moves = possible_moves.map do |move_stretch|\n move_stretch.select do |move|\n move.first.between?(0,7) && move.last.between?(0,7)\n end\n end\n\n inbound_moves.delete([])\n inbound_moves\n end", "def prune_possible_moves(board, possible_moves)\n possible_moves.reject { |move| (board & move) != 0 }\n end", "def scan_moves\n @white_moves = []\n @black_moves = []\n\n r = 0\n while r <= 7\n c = 1\n while c <= 8\n if selected_piece_type(r, c) != 'Piece' && selected_piece_type(r, c) != 'King'\n if selected_piece_colour(r, c) == Board::B\n @black_moves << possible_moves(r, c)\n elsif selected_piece_colour(r, c) == Board::W\n @white_moves << possible_moves(r, c)\n end\n end\n c += 1\n end\n r += 1\n end\n end", "def get_poss_moves\n x = @location[0] #x is row\n y = @location[1] #y is column\n\n move_list = [] #quarter circle forward punch\n\n if @colour == \"white\"\n move_list = white_pawn_moves(x,y)\n else\n move_list = black_pawn_moves(x,y)\n end\n\n possible_moves = move_list.select { |e|\n (e[0] >= 0) && (e[0] <= 7) && (e[1] >= 0) && (e[1] <= 7)\n }\n possible_moves\n end", "def valid_moves\n # call #moves of the object\n # self.moves.select\n end", "def filter_for_self_check(pieces, moves, color)\n\t\t\tcolor = (color == \"w\") ? \"white\" : \"black\"\n\t\t\topp_color = (color == \"white\") ? \"b\" : \"w\"\n splices = []\n king = pieces.find { |p| p.name == \"king\" && p.color == color }\n return [] if king.nil? \n\n # for each move we generated go through and see if any opponent moves put color king in check\n moves.each_index do | i |\n mover = pieces.index { |p| p.position == moves[i].from }\n next if mover.nil?\n\n # is the mover the king? update the king position\n if (pieces[mover].position == king.position)\n king.position = moves[i].to\n end\n\n\t\t\t\tboard = Board.new\n\t\t\t\tboard.game = self.game\n\t\t\t\tboard.set self.fen\n\t\t\t\tboard.do_move(moves[i])\n opp_moves = board.moves(opp_color)\n\n opp_moves.each do | omove |\n if (omove.to == king.position)\n # splice out the current move & break... only 1 needs to be found\n splices << moves[i]\n break\n end\n end\n\n if (pieces[mover].position == king.position)\n king.position = moves[i].from\n end\n\n end\n\n moves.delete_if { |i|\n splices.include?(i)\n }\n\n\t\t\treturn nil if moves.length == 0\n return moves\n end", "def possible_moves(location)\n # something that returns legal_destinations, minus blocked paths\n # print \"legal dest are: #{legal_destinations(location)}\\n\"\n possible_moves = legal_destinations(location).select do |legal_move|\n # print \"current legal move is #{legal_move}\\n\"\n legal_move_obj = @board[legal_move]\n no_piece_in_the_way?(location, legal_move) &&\n (legal_move_obj == nil || legal_move_obj.color != self.color) &&\n legal_move.all? { |coord| coord >= 0 && coord <= 8 }\n end\n\n possible_moves\n end", "def possible_moves\n possible_moves = []\n\n # move up\n up_right = [start[X] + 1, start[Y] + 2]\n possible_moves << up_right\n\n up_left = [start[X] - 1, start[Y] + 2]\n possible_moves << up_left\n\n # move right\n right_up = [start[X] + 2, start[Y] + 1]\n possible_moves << right_up\n\n right_down = [start[X] + 2, start[Y] - 1]\n possible_moves << right_down\n\n # move down\n down_right = [start[X] + 1, start[Y] - 2]\n possible_moves << down_right\n\n down_left = [start[X] - 1, start[Y] - 2]\n possible_moves << down_left\n\n # move left\n left_up = [start[X] - 2, start[Y] + 1]\n possible_moves << left_up\n\n left_down = [start[X] - 2, start[Y] - 1]\n possible_moves << left_down\n\n possible_moves.select { |move| @board.valid_position?(move) }\n\n end", "def legal_moves\n # Fill this in\n end", "def possible_moves\n possibles = []\n @state.each_with_index do |column, i|\n possibles << i if column[5] == :e\n end\n possibles\n end", "def available_moves(position = player.position, all: false)\n [\n Point.new(position.x - 1, position.y),\n Point.new(position.x, position.y - 1),\n Point.new(position.x + 1, position.y),\n Point.new(position.x, position.y + 1),\n ].select { |point| all || is_legit_move?(point) }\n end", "def filterSlidingMoves (board)\n\t\tfor i in [email protected]\n\t\t\tfor j in 0..@legalMoves[i].length-2\n\t\t\t\tx = @legalMoves[i][j] / 8\n\t\t\t\ty = @legalMoves[i][j] % 8\n\n\t\t\t\tif (board[x][y] != nil)\n\t\t\t\t\t@legalMoves[i].slice!(j+1..@legalMoves[i].length-1)\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tfor i in [email protected]\n\t\t\tx = @legalMoves[i][-1] / 8\n\t\t\ty = @legalMoves[i][-1] % 8\n\n\t\t\tif (board[x][y] != nil)\n\t\t\t\tif (board[x][y].color == self.color)\n\t\t\t\t\t@legalMoves[i].delete(@legalMoves[i][-1])\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\[email protected]([])\n\tend", "def getPossibleFrom move\n possibleFrom = []\n move.board.pieces[move.piece.colour][move.piece.class.to_s.to_sym].each do |coord, piece|\n possibleFrom << coord\n end\n possibleFrom\n end", "def moves\n all_moves = []\n self.move_dirs.each do |move| \n if ((0..7).include?(self.pos[0] + move[0]) && (0..7).include?(self.pos[1] + move[1])) && !(@board[(self.pos[0] + move[0]), (self.pos[1] + move[1])].is_a?(Piece)) #|| self.color == \n all_moves << [(self.pos[0] + move[0]), (self.pos[1] + move[1])]\n end \n end\n all_moves\n end", "def find_possible_moves(board)\n possibilities = []\n move_set.each do |move|\n rank = @location[0] + move[0]\n file = @location[1] + move[1]\n next unless valid_location?(rank, file)\n\n possibilities << [rank, file] unless board.data[rank][file]\n end\n possibilities\n end", "def moves\n output = []\n move_one = false\n @directions = @directions.take(3) if position != @initial_position\n directions.each_index do |index|\n possible_position = [position[0] + directions[index][0],position[1] + directions[index][1]]\n if index.even?\n if board.in_bounds?(possible_position) && occupied?(possible_position)\n output << possible_position unless board[possible_position].color == board[position].color\n end\n elsif index == 1\n if board.in_bounds?(possible_position) && !occupied?(possible_position)\n output << possible_position\n move_one = true\n end\n elsif board.in_bounds?(possible_position) && !occupied?(possible_position)\n output << possible_position if move_one\n end\n end\n output\n end", "def possible_moves\r\n return [] if won?\r\n (0..8).select {|i| board.cells[i] == \" \"}\r\n end", "def get_moves\n [\n { row: @row + 1, col: @col + 2 },\n { row: @row + 1, col: @col - 2 },\n { row: @row + 2, col: @col + 1 },\n { row: @row + 2, col: @col - 1 },\n { row: @row - 1, col: @col + 2 },\n { row: @row - 1, col: @col - 2 },\n { row: @row - 2, col: @col + 1 },\n { row: @row - 2, col: @col - 1 }\n ].select do |move|\n [:blank_space, :enemy_piece].include? describe_location(move[:row], move[:col])\n end\n end", "def valid_moves\n valid = []\n all_moves = self.moves\n\n all_moves.each do |end_pos|\n valid << end_pos unless move_into_check(end_pos)\n end\n \n valid\n end", "def generate_possible_moves(state)\n end", "def valid_moves(temp_board)\n moves.select do |end_pos|\n temp_board.valid_pos?(end_pos) && temp_board.empty?(end_pos)\n end\n end", "def possible_moves(board)\n poss_move_array = []\n current_square = @history.last\n current_coords = parse_coord(current_square)\n\n poss_move_array.push(single_march(current_coords, board)) if single_march(current_coords, board)\n\n poss_move_array.push(double_march(current_coords, board)) if first_move? && double_march(current_coords, board)\n\n valid_diagonals(current_coords, board).each { |move| poss_move_array.push(move) }\n\n # en passant only allowed opportunity first created\n poss_move_array.push(en_passant?(current_coords, board)) if en_passant?(current_coords, board)\n\n poss_move_array\n end", "def regular_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n \n # looks at the two forward diagonal positions and adds them to moves array if there are no pieces there\n pos1 = [@x_pos + 1, @y_pos + dir]\n moves << pos1 if Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 1, @y_pos + dir]\n moves << pos2 if Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves \n end", "def moves\n\n #\n all_moves = sigma_deltas().map {|delta| transform(delta)}\n # all_moves.select { |move| board.on_board?(move)}\n end", "def get_all_possible_moves\n possible_moves = []\n @MOVES.each do |arr|\n possible_moves += get_possible_moves(arr)\n end\n possible_moves\n end", "def moves\n possible_moves = []\n\n self.move_dirs.each do |dir|\n num_steps = 1\n blocked = false\n\n until blocked\n next_step = [dir[0]*num_steps, dir[1]*num_steps]\n next_pos = [self.pos[0] + next_step[0], self.pos[1] + next_step[1]]\n\n break unless next_pos.all? { |i| i.between?(0,7) }\n\n if self.board[next_pos]\n blocked = true\n possible_moves << next_pos unless self.color == self.board[next_pos].color\n else\n possible_moves << next_pos\n num_steps += 1\n end\n end\n end\n\n possible_moves\n end", "def pre_check_legal_moves(state)\n player = state[:player]\n piece_list = state[:pieces][player]\n move_list = []\n # Loop over pieces\n piece_list.each do |piece|\n move_list += piece.legal_moves(state)\n end\n move_list\n end", "def possible_king_moves(start_arr)\n\t\tx = start_arr[0]\n\t\ty = start_arr[1]\n\t\tcandidates = []\n\t\tcandidates << [x+1,y]\n\t\tcandidates << [x-1,y]\t\t\n\t\tcandidates << [x,y+1]\t\t\t\t\n\t\tcandidates << [x,y-1]\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\tcandidates << [x+1,y+1]\n\t\tcandidates << [x-1,y-1]\t\n\t\tcandidates << [x-1,y+1]\t\t\t\t\n\t\tcandidates << [x+1,y-1]\t\t\t\t\n\t\tchildren = candidates.select { |pos| pos[0] >= 0 && pos[1] >= 0 && pos[0] <= 7 && pos[1] <= 7}\n\t\tchildren.delete_if do |child|\n\t\t\tif !(@board[child] == \"*\")\n\t\t\t\t# If pieces not same color\n\t\t\t\tif @board[child].color == @board[start_arr].color\n\t\t\t\t\tif occupied(child)\n\t\t\t\t\t\tcan_do = true\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tchildren\n\tend", "def get_possible_moves\n moves = \n\t @@offsets.collect do |move| \n\t row = @position[:row] + move[0]\n\t col = @position[:col] + move[1]\n\t\t[row, col] if row.between?(0, 7) && col.between?(0, 7)\n\t end\n\tmoves.compact\n end", "def possible_moves(spaces)\n possible_moves = []\n if ((@position + 1) % 8 == 0)\n @moves = [8,7,-1,-9,-8]\n elsif (@position % 8 == 0)\n @moves = [-8,-7,1,9,8]\n end\n @moves.each do |move|\n possible_moves << (@position + move)\n end\n possible_moves.select! { |move| (0..63).include?(move) }\n possible_moves.select! do |move| \n spaces[move].class == Fixnum or spaces[move].side_id != @side_id ? true : false\n end\n possible_moves\n end", "def valid_moves\n super\n end", "def select_legal_moves(moves)\n legal_moves = []\n moves.each do |move|\n description = describe_location(move[:row], move[:col])\n \n if [:blank_space, :enemy_piece].include? description\n legal_moves << move\n end\n\n break if description != :blank_space\n end\n return legal_moves\n end", "def getPossibleMoves(move)\n board = move.board\n possibleMoves = []\n if move.from.nil?\n possibleFrom = getPossibleFrom(move)\n possibleFrom.each do |from|\n possibleMove = Move.new(board, move.board.getSquare(from).occupancy, move.to, from)\n possibleMoves << possibleMove\n end\n else\n # Make sure the piece trying to be moved exists\n if(board.getSquare(move.from).occupied? &&\n board.getSquare(move.from).occupancy.class == move.piece.class &&\n board.getSquare(move.from).occupancy.colour == move.piece.colour)\n move.piece = move.board.getSquare(move.from).occupancy\n possibleMoves << move\n end\n end\n possibleMoves\n end", "def moves\n poss_moves = []\n determine_moves.each do |diff| #array of directions\n poss_moves += grow_unblocked_moves_in_dir(diff[0],diff[1])\n end\n poss_moves\n end", "def valid_moves\n (slide_moves + jump_moves).select { |move| valid_move_seq?([move]) }\n end", "def select_moves(position, posibles)\n moves = []\n posibles.each { |move| moves << [position[0] + move[0], position[1] + move[1]] }\n moves = moves.select { |move| move[0].between?(1,8) && move[1].between?(1,8) }\nend", "def get_possible_moves_for(position)\n possible = []\n x = position.square[0]\n y = position.square[1]\n moves = [\n Placement.new([x-1,y-2], position), \n Placement.new([x-1,y+2], position), \n Placement.new([x-2,y-1], position), \n Placement.new([x-2,y+1], position), \n Placement.new([x+1,y+2], position), \n Placement.new([x+1,y-2], position), \n Placement.new([x+2,y-1], position), \n Placement.new([x+2,y+1], position)\n ]\n moves.each do |move|\n possible << move unless Chess.not_on_board?(move)\n end\n possible\n end", "def group_possible_moves_rook(pm)\n result = []\n\n result << pm.select do |p|\n p[0] == position[0] && p[1] < position[1]\n end\n\n result << pm.select do |p|\n p[0] == position[0] && p[1] > position[1]\n end\n\n result << pm.select do |p|\n p[1] == position[1] && p[0] < position[0]\n end\n\n result << pm.select do |p|\n p[1] == position[1] && p[0] > position[0]\n end\n result[0].reverse!\n result[2].reverse!\n result\n end", "def prune_king_revealers player, moves\n\t\tkpiece = player==WHITE ? WKING : BKING\n\t\tmoves.select do |to_try|\n\t\t\tmove to_try[0], to_try[1], to_try[2], false\n\t\t\tnext_moves = gen_moves @to_play\n\t\t\tking, = bits_to_positions(@bitboards[kpiece])\n\t\t\tret = true\n\t\t\tnext_moves.each do |m|\n\t\t\t\tif m[1] == king\n\t\t\t\t\tret = false\t\t\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tundo 1\n\t\t\tret\n\t\tend\n\tend", "def destinations(board)\n #selects destinations that are on the board\n dest_array = @moves.select do |move|\n move = [move[0] + @pos[0], move[1] + @pos[1]]\n move.all? {|i| (0..7).include?(i)}\n end\n\n #selects only destinations that are empty or have the opponents piece on it\n dest_array = dest_array.select do |pos|\n piece = board[pos[0]][pos[1]]\n piece.nil? || piece.player != @player\n end \n end", "def all_moves harmless\n\t\t# NOTE: harmless test disabled\n\t\tharmless = false\n\n\t\tmoves = {} \n\n\t\tif moved? or next_to_enemy?\n\t\t\tmoves[ :STAY ] = pos\n\t\t\treturn moves\n\t\tend\n\n\t\tlam = lambda do |dir| \n\t\t\t# Test movement of collective\n\t\t\tif can_pass? dir, false\n\t\t\t\tmoves[ dir ] = square.neighbor dir\n\t\t\tend\n\t\tend\n\n\t\t# Note that we don't bother with orientation so close to conflict\t\n\n\t\tif harmless\n\t\t\t$logger.info { \"#{ self } attackers harmless; staying is not an option\" }\n\t\telse\n\t\t\tmoves[ :STAY ] = square\n\t\tend\n\t\tlam.call :N\n\t\tlam.call :E\n\t\tlam.call :S\n\t\tlam.call :W\n\n\t\tif moves.empty?\n\t\t\t$logger.info \"We are stuck, apparently; staying anyway.\"\n\t\t\tmoves[ :STAY ] = square\n\t\tend\n\n\t\t$logger.info { \"possible moves: #{ moves }\" }\n\n\t\tmoves\n\tend", "def valid_moves\n moves = []\n\n # go in all directions\n (-1..1).each do |_x_step|\n (-1..1).each do |_y_step|\n # start walking in that direction\n (1..7).each do |steps|\n x = x_coordinate + steps * x_direction\n y = y_coordinate + steps * y_direction\n\n # stop walking if you hit a wall\n break unless valid_move?(x, y)\n\n # remember the valid moves\n moves.push(Move.new(x, y))\n end\n end\n end\n moves\n end", "def find_possible_moves(board)\n possible_moves = []\n move_mechanics.each do |move|\n rank = @location[0] + move[0]\n file = @location[1] + move[1]\n next unless valid_location?(rank, file)\n\n possible_moves << [rank, file] unless board.data[rank][file]\n end\n possible_moves\n end", "def available_moves\n @board.reject { |x| x.is_a?(String) }\n end", "def allowed_moves(from_cell, chessboard)\n map_chess_move_array(from_cell, allowed_cells(from_cell, chessboard))\n end", "def all_valid_moves(location, moves)\n moves.select do |move|\n valid_move?(location[0], location[1], move[0], move[1])\n end\n end", "def new_move_positions(pos)\n candidates = KnightPathFinder.valid_moves(pos)\n candidates = candidates.select { |e| !@considered_positions.include?(e) }\n @considered_positions.concat(candidates)\n return candidates\n #@considered_positions = (@considered_positions.concat(candidates)).uniq\n end", "def options\n pieces = @board.pieces(@current_player)\n moves = []\n pieces.each do |location|\n piece = @board[location]\n piece.moves.each do |direction|\n neighbor1 = @board.neighbors(location)[direction] if @board.neighbors(location)\n neighbor2 = @board.neighbors(neighbor1)[direction] if @board.neighbors(neighbor1)\n moves << move_factory(location, neighbor1, neighbor2)\n end\n end\n moves.delete_if(&:nil?)\n\n if moves.map(&:class).include?(Checkers::Jump)\n moves.delete_if { |move| move.class == Checkers::Move }\n unless @moves.empty? || @current_player != @moves.last.owner\n # There are still jumps leftover\n moves.keep_if { |jump| jump.src == @moves.last.dest }\n end\n end\n \n moves\n end", "def get_moves\n reset_moves\n jump_moves\n base_moves if @valid_moves.empty?\n end", "def valid_moves\n moves = []\n # If the floor is on the bottom or top floor, it can only go One Direction\n if @current_floor == 0\n # Has to go up\n # We can take up just this item\n @floors[@current_floor].items.compact.each do |item|\n new_building = self.dup\n destination_floor = new_building.floors[@current_floor+1]\n\n if destination_floor.can_have?([item])\n # Valid move\n new_building.floors[@current_floor].items[item] = nil\n new_building.floors[@current_floor+1].items[item] = item\n moves << new_building\n end\n end\n\n # Or we can take two items\n @floors[@current_floor].items.compact.permutation(2).each do |items|\n new_building = self.dup\n destination_floor = new_building.floors[@current_floor+1]\n\n if destination_floor.can_have?(items)\n # Valid move\n items.each do |item|\n new_building.floors[@current_floor].items[item] = nil\n new_building.floors[@current_floor+1].items[item] = item\n end\n moves << new_building\n end\n end\n elsif @current_floor == 3\n # Has to go down\n else\n # Can go up or down\n end\n\n moves\n end", "def smart_move(oppo_steps, steps)\n WINNING_LINE.each do |win_line|\n filter_line = win_line.select do |win_num|\n !oppo_steps.include?(win_num)\n end\n if filter_line.size == 1\n return filter_line[0] unless steps.include?(filter_line[0])\n end\n end\n 0\nend", "def possible_moves(pos, board)\n moves = @moves.reduce([]) { |all_moves, move| all_moves.push(move.valid_moves(pos, board, @owner)) }\n moves.flatten(1)\n end", "def selected_valid_moves(x, y)\n return [] if self[x, y].nil?\n @selected_valids ||= self[x, y].valid_moves([x, y])\n end", "def legal_moves\n out = Set.new\n board = self.unrolled\n mark = next_turn_taker(board)\n \n board.each_with_index do |space, i|\n if space == @@MARKS[:empty]\n new_state = GameState.new(self.board_bits)\n new_state.mark_index i, mark\n out << new_state\n end\n end\n \n return out\n end", "def get_moves(start)\n x = start.x\n y = start.y\n moves = []\n moves << Node.new(x+2, y+1)\n moves << Node.new(x+2, y-1)\n moves << Node.new(x+1, y+2)\n moves << Node.new(x+1, y-2)\n moves << Node.new(x-1, y+2)\n moves << Node.new(x-1, y-2)\n moves << Node.new(x-2, y+1)\n moves << Node.new(x-2, y-1)\n moves = moves.reject do |node|\n node.x < 0 || node.x > 8\n end\n moves = moves.reject do |node|\n node.y < 0 || node.y > 8\n end\n moves.each { |move| move.next_node = start }\nend", "def moves( who = @turn )\n\t\t\tmoves = find_all { |(sq, pc)| pc and pc.color == who }.\n\t\t\t map { |(sq, pc)| [sq, (pc.captures + pc.moves).sort] }\n\t\t\tmoves.each do |(from, tos)|\n\t\t\t\ttos.delete_if { |to| dup.move(from, to).in_check?(who) }\n\t\t\tend\n\t\t\tmoves.delete_if { |(from, tos)| tos.empty? }\n\t\t\tmoves.sort\n\t\tend", "def available_moves\n adjacent_tiles(*@hole)\n end", "def possible_moves(start_node, destination)\n\t\n\t\tif start_node.value == destination\n\t\t\treturn start_node\n\t\telse\n\t\t\tgame.visited << start_node\n\t\t\tgame.unvisited = game.unvisited + (set_parent(start_node, possible_positions(start_node.value)) - game.visited)\n\t\t\tgame.unvisited.each do |position_node|\n\t\t\t\tif position_node.value == destination\n\t\t\t\t\treturn position_node\n\t\t\t\tend\n\t\t\t\tgame.visited << position_node\n\t\t\tend\n\t\t\tpossible_moves(game.unvisited.shift,destination) if game.unvisited.first != nil \n\t\tend\n\tend", "def moves; [] end", "def determine_moves(loc)\n\n piece = @spaces[loc]\n\n moveset = []\n attackset = []\n new_moves = []\n\n x = loc[0]\n y = loc[1]\n\n enemy_king_checked = false\n\n\n case piece.type\n\n when \"pawn\"\n\n if piece.color == \"white\"\n\n new_moves << [x, y+1]\n new_moves << [x,y+2] if y == 1\n\n if @spaces[new_moves[0]].nil?\n\n moveset << new_moves[0]\n moveset << new_moves[1] if y == 1\n\n end\n\n atk_moves = [[x+1, y+1], [x-1, y+1]]\n atk_moves.each do |move|\n attackset << move if @spaces[move].nil?.! and @spaces[move].color == \"black\"\n if @spaces[move].nil?.!\n enemy_king_checked = true if @spaces[move].color == \"black\" and @spaces[move].type == \"king\"\n end\n end\n \n\n elsif piece.color == \"black\"\n\n new_moves = [[x, y-1]]\n new_moves << [x,y-2] if y == 6\n\n if @spaces[new_moves[0]].nil?\n\n moveset << new_moves[0]\n moveset << new_moves[1] if loc[1] == 6\n\n end\n\n atk_moves = [[x+1, y-1], [x-1, y-1]]\n atk_moves.each do |move|\n attackset << move if @spaces[move].nil?.! and @spaces[move].color == \"white\"\n if @spaces[move].nil?.!\n enemy_king_checked = true if @spaces[move].color == \"white\" and @spaces[move].type == \"king\"\n end\n end\n end\n\n @spaces[loc].moveset = moveset\n @spaces[loc].attackset = attackset\n \n\n when \"rook\"\n\n runner(loc, :north)\n runner(loc, :east)\n runner(loc, :south)\n runner(loc, :west)\n\n when \"knight\"\n\n possible_directions =\n [ [x+1, y+2],\n [x+1, y-2],\n [x-1, y+2],\n [x-1, y-2],\n [x+2, y+1],\n [x+2, y-1],\n [x-2, y+1],\n [x-2, y-1] ]\n\n moveset = possible_directions.select do |d|\n (d[0].between?(0,7) & d[1].between?(0,7)) and @spaces[d].nil?\n end\n\n attackset = possible_directions.select do |d|\n (d[0].between?(0,7) & d[1].between?(0,7)) and (@spaces[d].nil?.! and @spaces[d].color != @spaces[loc].color)\n end\n\n @spaces[loc].moveset = moveset\n @spaces[loc].attackset = attackset\n\n\n when \"bishop\"\n\n runner(loc, :northeast)\n runner(loc, :southeast)\n runner(loc, :northwest)\n runner(loc, :southwest)\n\n\n when \"queen\"\n\n runner(loc, :north)\n runner(loc, :northeast)\n runner(loc, :east)\n runner(loc, :southeast)\n runner(loc, :south)\n runner(loc, :southwest)\n runner(loc, :west)\n runner(loc, :northwest)\n\n\n when \"king\"\n\n runner(loc, :north, 1)\n runner(loc, :northeast, 1)\n runner(loc, :east, 1)\n runner(loc, :southeast, 1)\n runner(loc, :south, 1)\n runner(loc, :southwest, 1)\n runner(loc, :west, 1)\n runner(loc, :northwest, 1)\n\n end\n\n\n end", "def all_possible_moves(pieces)\n\t\tpossible_moves = []\n\t\tpieces.each do |piece|\n\t\t\tif piece[0].type == 'pawn'\n\t\t\t\tpossible_moves << possible_pawn_moves(piece[1])\n\t\t\telsif piece[0].type == 'rook'\n\t\t\t\tpossible_moves << possible_rook_moves(piece[1])\n\t\t\telsif piece[0].type == 'bishop'\n\t\t\t\tpossible_moves << possible_bishop_moves(piece[1])\t\t\t\t\n\t\t\telsif piece[0].type == 'knight'\n\t\t\t\tpossible_moves << possible_knight_moves(piece[1])\t\t\n\t\t\telsif piece[0].type == 'queen'\n\t\t\t\tpossible_moves << possible_queen_moves(piece[1])\t\t\n\t\t\telse \n\t\t\t\tpossible_moves << possible_king_moves(piece[1])\n\t\t\tend\t\t\t\t\t\t\n\t\tend\n\t\tpossible_moves =possible_moves.flatten(1).uniq.sort\n\tend", "def moves\n possible_moves = []\n\n move_dirs.each do |dir|\n possible_moves.concat(grow_unblocked_moves_in_dir(dir[0], dir[1])) \n end\n\n possible_moves \n end", "def moves!\n total_possible_moves = []\n total_possible_moves.concat(diag_moves(diag_initializer))\n total_possible_moves.concat(straight_moves(move_initializer))\n total_possible_moves.select { |move| self.valid_move?(move) }\n end", "def jump_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n\n # looks at the two forward far diagonal positions and adds them to moves array if there are no pieces there and an opponent piece in between\n pos1 = [@x_pos + 2, @y_pos + 2*dir]\n moves << pos1 if Piece.all.find{|p| p.x_pos == @x_pos + 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 2, @y_pos + 2*dir]\n moves << pos2 if Piece.all.find{|p| p.x_pos == @x_pos - 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n\n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves\n end", "def moves(*move_dirs)\n possible_moves = []\n\n end", "def listLegalMoveAll\n result = [] ;\n for x in 0..3\n for y in 0..3\n from = Pos.new(x,y) ;\n r = self.listLegalMoveFrom(from) ;\n r.shift ;\n result += r ;\n end\n end\n return result ;\n end", "def favor_corners(moves) # array of moves: [ a1, b2, c3, ... ]\n a = []\n moves.each { |e| a.push(e) if CORNERS.include?(e) }\n\n if a.length == 0\n moves\n else\n a\n end\nend", "def possible_moves(p1, manifest, castling = false)\n allowed = []\n type = manifest[p1][\"type\"]\n my_color = manifest[p1][\"color\"]\n constants(manifest, my_color, type)\n\n unless unoccupied?(p1)\n\n if type == \"king\"\n allowed += [move_lateral(p1, 1)].flatten\n allowed += [move_diagonal(p1, 1)].flatten\n allowed += [castle(p1)].flatten if castling\n\n elsif type == \"queen\"\n allowed += [move_lateral(p1)].flatten\n allowed += [move_diagonal(p1)].flatten\n\n elsif type == \"rook\"\n allowed += [move_lateral(p1)].flatten\n\n elsif type == \"bishop\"\n allowed += [move_diagonal(p1)].flatten\n\n elsif type == \"pawn\"\n allowed += [pawn(p1)].flatten\n\n elsif type == \"knight\"\n allowed += [knight(p1)].flatten\n end\n\n end\n return allowed\n end", "def valid_moves(from)\n piece = @board.at(from)\n if piece.king? || piece.knight?\n piece.moves.map do |move|\n to = relative_coords(from, move)\n to if possible_move?(to)\n end.compact\n elsif piece.pawn?\n pawn_valid_moves(from)\n else\n valid_moves_recursive(from)\n end\n end", "def possible_moves(from)\n\tpositions = []\n\tpair = { 1 => [2, -2], 2 => [1, -1] }\n row_change = [-2, -1, 1, 2]\n row_change.each do |change|\n \tpositions << add_positions(from, [change, pair[change.abs][0]])\n \tpositions << add_positions(from, [change, pair[change.abs][1]])\n end\n\tpositions\nend", "def possible_moves\n\t\[email protected]_index { |piece, idx| piece == \"-\" ? idx : nil }.compact\n\tend", "def get_moves_2(piece, board)\n valid_col = case piece.name\n when ?A then 3\n when ?B then 5\n when ?C then 7\n when ?D then 9\n else 11\n end\n moves = []\n\n # If in hallway\n if piece.row == 1\n cols = valid_col < piece.col ? (valid_col...piece.col).to_a : (piece.col+1..valid_col).to_a\n if cols.count{|c| board[[1, c]] == ?.} == cols.length\n if board[[2, valid_col]] == ?. && board[[3, valid_col]] == piece.name && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[2, valid_col], (cols.count + 1) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == piece.name && board[[5, valid_col]] == piece.name\n moves << [[3, valid_col], (cols.count + 2) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == piece.name\n moves << [[4, valid_col], (cols.count + 3) * piece.cost]\n elsif board[[2, valid_col]] == ?. && board[[3, valid_col]] == ?. && board[[4, valid_col]] == ?. && board[[5, valid_col]] == ?.\n moves << [[5, valid_col], (cols.count + 4) * piece.cost]\n end\n end\n # If right column and something is underneath and nothing above\n # If in wrong column completely and nothing above\n elsif piece.row >= 2\n below = (piece.row+1..5).to_a\n above = (2..piece.row-1).to_a\n if ((piece.col == valid_col && below.count{|c| board[[c, piece.col]] != piece.name} != 0 && below.length != 0) || (piece.col != valid_col)) && (above.count{|c| board[[c, piece.col]] == ?.} == above.length)\n 2.times do |t|\n dir = t == 0 ? -1 : 1\n curr = piece.col\n steps = 1 + above.length\n while board[[1, curr]] == ?.\n moves << [[1, curr], steps * piece.cost] if ![3, 5, 7, 9].include?(curr)\n steps += 1\n curr += dir\n end\n end\n end\n end\n moves\nend", "def valid_move?(move)\n # Array of all posiible moves , check the board and map out the possible moves from there.\n end", "def possible_moves(from)\r\n\tpositions = []\r\n\tpair = { 1 => [2, -2], 2 => [1, -1] }\r\n row_change = [-2, -1, 1, 2]\r\n row_change.each do |change|\r\n \tpositions << add_positions(from, [change, pair[change.abs][0]])\r\n \tpositions << add_positions(from, [change, pair[change.abs][1]])\r\n end\r\n\tpositions\r\nend", "def moves\n possible_moves = []\n dir do |dir|\n possible_moves += MyDirections(pos, dir)\n end\n possible_moves\n end", "def filter_path(path)\n best_possible_path = [path[-1]]\n current_target = path.pop\n update_possible_moves(current_target)\n while path.length > 0\n candidate = path.pop\n if @moves.include?(candidate) \n best_possible_path << candidate\n current_target = candidate\n update_possible_moves(current_target)\n end\n end\n best_possible_path.reverse\n end", "def valid_moves(pos)\n valid_moves =[]\n DELTAS.each do |delta_pair|\n valid_moves << [delta_pair[0] + pos[0], delta_pair[1] + pos[1]]\n end\n valid_moves.reject! { |coord| coord.any? { |x| x < 0 || x > 8} }\n end", "def possible_moves(starting_position, actual_piece, turn = @turn, board = @board)\n row = starting_position[0]\n column = starting_position[1]\n potential_moves = []\n\n active_pieces = []\n enemy_pieces = []\n\n if turn == 1\n active_pieces = @w_pieces\n enemy_pieces = @b_pieces\n else\n active_pieces = @b_pieces\n enemy_pieces = @w_pieces\n end\n\n # moves available for white pawns\n if actual_piece == $w_pawn\n # if the white pawn is in its original spot, then it can move two spots or one spot\n return if row == 7\n\n if row == 1\n potential_moves << [row+1, column] if board[row+1][column] == ' '\n potential_moves << [row+2, column] if board[row+2][column] == ' '\n else\n potential_moves << [row+1, column] if board[row+1][column] == ' '\n end\n\n # can take black pieces, but only if they are available diagonally\n potential_moves << [row+1, column+1] if @b_pieces.include?(board[row+1][column+1])\n potential_moves << [row+1, column-1] if @b_pieces.include?(board[row+1][column-1])\n\n # can take black pawns under special en-passant rule\n if @en_passant_piece != []\n passant_row = invert_position_converter(@en_passant_piece)[0]\n passant_col = invert_position_converter(@en_passant_piece)[1]\n if passant_row == row && (passant_col == column + 1 || passant_col == column - 1)\n # it must be empty in order for us to do en-passant (otherwise the pawn can just take)\n if @board[passant_row+1][passant_col] = ' '\n potential_moves << [passant_row+1, passant_col]\n end\n end\n end\n end \n\n # moves available for black pawns\n if actual_piece == $b_pawn\n # if the black pawn is in its original spot, then it can move two spots or one spot\n return if row == 0\n\n if row == 6\n potential_moves << [row-1, column] if board[row-1][column] == ' '\n potential_moves << [row-2, column] if board[row-2][column] == ' '\n else\n potential_moves << [row-1, column] if board[row-1][column] == ' '\n end\n\n # can take white pieces\n potential_moves << [row-1, column+1] if @b_pieces.include?(board[row-1][column+1])\n potential_moves << [row-1, column-1] if @b_pieces.include?(board[row-1][column-1])\n\n # can take white pawns under special en-passant rule\n\n if @en_passant_piece != []\n passant_row = invert_position_converter(@en_passant_piece)[0]\n passant_col = invert_position_converter(@en_passant_piece)[1]\n if passant_row == row && (passant_col == column + 1 || passant_col == column - 1)\n if @board[passant_row-1][passant_col] = ' '\n potential_moves << [passant_row-1, passant_col]\n end\n end\n end\n end\n\n # moves available for rooks\n if actual_piece == $w_rook || actual_piece == $b_rook\n\n i_row = row\n i_col = column\n\n # returns all potential moves north of the starting position\n until i_row+1 == 8 || active_pieces.include?(board[i_row+1][i_col])\n if enemy_pieces.include?(board[i_row+1][i_col])\n potential_moves << [i_row+1,i_col]\n break\n else\n potential_moves << [i_row+1,i_col]\n end\n i_row += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moves south of the starting position\n until active_pieces.include?(board[i_row-1][i_col]) || i_row-1 == -1\n if enemy_pieces.include?(board[i_row-1][i_col])\n potential_moves << [i_row-1,i_col]\n break\n else\n potential_moves << [i_row-1,i_col]\n end\n i_row -= 1\n end\n\n i_row = row\n i_col = column\n \n\n # returns all potential moves right of the starting position\n until active_pieces.include?(board[i_row][i_col+1]) || i_col+1 == 8\n if enemy_pieces.include?(board[i_row][i_col+1])\n potential_moves << [i_row,i_col+1]\n break\n else\n potential_moves << [i_row,i_col+1]\n end\n i_col += 1\n end\n\n i_row = row\n i_col = column\n \n # returns all potential moves left of the starting position\n until active_pieces.include?(board[i_row][i_col-1]) || i_col-1 == -1\n if enemy_pieces.include?(board[i_row][i_col-1])\n potential_moves << [i_row,i_col-1]\n break\n else\n potential_moves << [i_row,i_col-1]\n end\n i_col -= 1\n end\n\n i_row = row\n i_col = column\n\n end\n\n # moves available for knights\n if actual_piece == $w_knig || actual_piece == $b_knig\n\n # returns all potential moves\n potential_moves << [row+2, column+1]\n potential_moves << [row+1, column+2]\n potential_moves << [row-1, column+2]\n potential_moves << [row-2, column+1]\n potential_moves << [row-2, column-1]\n potential_moves << [row-1, column-2]\n potential_moves << [row+1, column-2]\n potential_moves << [row+2, column-1]\n\n end\n\n # moves available for bishops\n if actual_piece == $w_bish || actual_piece == $b_bish\n\n i_row = row\n i_col = column\n\n # returns all potential moving north-east of the starting position\n\n until i_row+1 == 8 || i_col+1 == 8 || active_pieces.include?(board[i_row+1][i_col+1])\n if enemy_pieces.include?(board[i_row+1][i_col+1])\n potential_moves << [i_row+1,i_col+1]\n break\n else\n potential_moves << [i_row+1,i_col+1]\n end\n i_row += 1\n i_col += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moving south-east of the starting position\n until i_row-1 == -1 || i_col+1 ==8 || active_pieces.include?(board[i_row-1][i_col+1])\n if enemy_pieces.include?(board[i_row-1][i_col+1])\n potential_moves << [i_row-1,i_col+1]\n break\n else\n potential_moves << [i_row-1,i_col+1]\n end\n i_row -= 1\n i_col += 1\n end\n \n i_row = row\n i_col = column \n\n # returns all potential moving south-west of the starting position\n until i_row-1 == -1 || i_col-1 == -1 || active_pieces.include?(board[i_row-1][i_col-1])\n if enemy_pieces.include?(board[i_row-1][i_col-1])\n potential_moves << [i_row-1,i_col-1]\n break\n else\n potential_moves << [i_row-1,i_col-1]\n end\n i_row -= 1\n i_col -= 1\n end\n \n i_row = row\n i_col = column \n \n # returns all potential moving north-east of the starting position\n until i_row+1 == 8 || i_col-1 == -1 || active_pieces.include?(board[i_row+1][i_col-1])\n if enemy_pieces.include?(board[i_row+1][i_col-1])\n potential_moves << [i_row+1,i_col-1]\n break\n else\n potential_moves << [i_row+1,i_col-1]\n end\n i_row += 1\n i_col -= 1\n end\n \n i_row = row\n i_col = column \n\n end\n\n # moves available for queens\n if actual_piece == $w_quee || actual_piece == $b_quee\n if actual_piece == $w_quee\n potential_moves.concat(possible_moves(starting_position, $w_rook, turn = 1))\n potential_moves.concat(possible_moves(starting_position, $w_bish, turn = 1))\n end\n if actual_piece == $b_quee\n potential_moves.concat(possible_moves(starting_position, $b_rook, turn = 2))\n potential_moves.concat(possible_moves(starting_position, $b_bish, turn = 2))\n end\n end\n\n # moves available for kings\n if actual_piece == $w_king || actual_piece == $b_king\n i_row = row\n i_col = column\n\n potential_moves << [i_row+1, i_col]\n potential_moves << [i_row+1, i_col+1]\n potential_moves << [i_row, i_col+1]\n potential_moves << [i_row-1, i_col-1]\n potential_moves << [i_row-1, i_col]\n potential_moves << [i_row-1, i_col+1]\n potential_moves << [i_row, i_col-1]\n potential_moves << [i_row+1, i_col-1]\n\n # castling conditions\n # The king does not move over a square that is attacked by an enemy piece during the castling move, i.e., when castling, there may not be an enemy piece that can move (in case of pawns: by diagonal movement) to a square that is moved over by the king.\n\n # The king cannot be in check if they are trying to castle\n if !@check_condition\n if actual_piece == $w_king\n # checks for left rook potential\n if board[0][1] == ' ' && board[0][2] == ' ' && board[0][3] == ' '\n binding.pry\n if @w_king_move == \"not moved\" && @w_rook_left == \"not moved\"\n if !enemy_positions.include?([0, 3])\n potential_moves << [0, 2]\n end\n end\n #checks for right rook potential\n elsif board[0][5] == ' ' && board[0][6] == ' '\n if @w_king_move == \"not moved\" && @w_rook_right == \"not moved\"\n if !enemy_positions.include?([0, 5])\n potential_moves << [0, 6]\n end\n end\n end\n end\n if actual_piece == $b_king\n # checks for left rook potential\n if board[7][1] == ' ' && board[7][2] == ' ' && board[7][3] == ' '\n if @b_king_move == \"not moved\" && @b_rook_left == \"not moved\"\n if !enemy_positions.include?([7, 3])\n potential_moves << [7, 2]\n end \n end\n #checks for right rook potential\n elsif board[7][5] == ' ' && board[7][6] == ' '\n if @b_king_move == \"not moved\" && @b_rook_right == \"not moved\"\n if !enemy_positions.include?([7, 5])\n potential_moves << [7, 6] \n end\n end\n end\n end\n end\n\n end\n\n potential_moves = potential_moves.select { |pos| valid_move?(pos, turn)}\n\n potential_moves\n\n end", "def get_valid_moves\n # delta = color == :white ? 1 : -1\n pos = [position[0] + direction, position[1]]\n validated_moves = capture_spaces\n validated_moves << pos if valid_move?(pos)\n unless @moved || !validated_moves.include?(pos)\n\n pos = [position[0] + (2*direction), position[1]]\n validated_moves += valid_move?(pos) ? [pos] : []\n end\n\n validated_moves\n end", "def moves\n return [] if @position.empty?\n possible_moves = []\n move_dirs.each do |dir| #[-1,-1]\n test_pos = @position #[1,3] - current position\n valid = true\n while valid\n x = dir.first + test_pos.first\n y = dir.last + test_pos.last\n test_pos = [x,y]\n valid = valid_move?([x,y])\n possible_moves << [x,y] if valid\n valid = false if valid == :attack\n end\n end\n possible_moves\n end", "def possible_moves_in_board(position)\n POSSIBLE_MOVES.select do |move|\n x = position[0] + move[0]\n y = position[1] + move[1]\n\n within_board?(x, y)\n end\n end", "def get_valid_moves(pos)\n piece = self[pos]\n color = piece.color\n potential_moves = piece.potential_moves\n valid_moves = []\n potential_moves.each do |to_pos|\n if self.valid_move?(pos, to_pos, color)\n valid_moves << to_pos\n end\n end\n valid_moves\n end", "def legal_moves(color)\n moves = []\n\n # do on all_moves instead of all_normal_moves\n # check each piece replacement for unknown promotion\n\n # can use #select on all_possible_moves\n all_moves(color).filter do |m|\n # - make the move\n # - test if it result in a self check\n # - undo the move\n m.make(@board)\n moves << m unless in_check?(enemy)\n m.make(@board, true)\n end\n\n moves\n end", "def moves_available\n # return what moves are available to this piec\n end" ]
[ "0.7418731", "0.7177759", "0.7100945", "0.7054787", "0.7049459", "0.70133805", "0.69971395", "0.6990848", "0.687329", "0.6829647", "0.6810687", "0.6809835", "0.67858315", "0.67723745", "0.67313313", "0.67286664", "0.6703829", "0.669497", "0.6693276", "0.66212094", "0.65952224", "0.6581383", "0.6576859", "0.6568413", "0.65643394", "0.6563779", "0.6553291", "0.6538949", "0.6536544", "0.65255994", "0.6521001", "0.65140444", "0.65114003", "0.65009606", "0.6497445", "0.64818406", "0.64577276", "0.6446548", "0.64380616", "0.64299464", "0.6424677", "0.6411345", "0.63986737", "0.6394707", "0.63914984", "0.6370016", "0.636987", "0.6344504", "0.6322549", "0.6303763", "0.63027847", "0.62777126", "0.62675977", "0.6262076", "0.6257196", "0.6253248", "0.62519765", "0.6248394", "0.6245358", "0.6197915", "0.61948735", "0.6194069", "0.61927724", "0.6186828", "0.61802405", "0.6153887", "0.61497724", "0.6133605", "0.61290807", "0.61286", "0.6113076", "0.6077142", "0.60654265", "0.606372", "0.6055068", "0.6045425", "0.6044433", "0.60428923", "0.6042557", "0.6041681", "0.603758", "0.603707", "0.603058", "0.60283077", "0.6023452", "0.60156375", "0.60103625", "0.60044444", "0.6003262", "0.5996487", "0.59934527", "0.59900063", "0.5987412", "0.598415", "0.5971663", "0.59598136", "0.59575063", "0.5955727", "0.5954372", "0.5953654" ]
0.67162275
16
Number of documents stored locally via nightly RetrieveDocumentsForReaderJob. Fall back to count from VBMS if no local documents are found.
def number_of_documents_from_caseflow count = Document.where(file_number: veteran_file_number).size (count != 0) ? count : number_of_documents end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_docs\n @client[:documents].count\n end", "def num_docs\n @client[DOCUMENTS_COLLECTION].count\n end", "def get_all_documents_count\n get_all_documents_ids.count\n end", "def num_corpus_documents\n @corpus_size ||= begin\n solr_query = {}\n solr_query[:q] = '*:*'\n solr_query[:qt] = 'precise'\n solr_query[:rows] = 1\n solr_query[:start] = 0\n \n solr_response = Solr::Connection.find solr_query\n \n if solr_response[\"response\"] &&\n solr_response[\"response\"][\"numFound\"]\n solr_response[\"response\"][\"numFound\"]\n else\n # FIXME: Should we raise an error here?\n 1\n end\n end\n end", "def count_documents\n size = 0\n @data.each_value do |documents|\n size += documents.size\n end\n\n size\n end", "def count\n @count ||= documents.size\n end", "def count\n @documents.count\n end", "def get_all_uploaded_documents_count\n client = @current_advisor.clients_as_advisor.find_by(id: @client_id)\n if client.consumer_id\n Document.where(:consumer_id => client.consumer_id).count\n else\n client.document_ownerships.count\n end\n end", "def returned_count\n reply.documents.length\n end", "def num_records\n num_urls + num_docs\n end", "def num_records\n num_urls + num_docs\n end", "def size\n @documents.size\n end", "def query_7\n document_ids = Perpetuity[Document].select {|document| document.id}.to_a\n return document_ids.size\nend", "def count; info['doc_count']; end", "def count_documents(model)\n conditions = params.empty? ? {} : make_conditions(params, model)\n model.count(conditions)\n end", "def size\n reader.doccount\n end", "def count\n @document.page_count\n end", "def total\n @doclist['numFound']\n end", "def get_DocumentCount()\n \t return @outputs[\"DocumentCount\"]\n \tend", "def system_documents_count_get(opts = {})\n data, _status_code, _headers = system_documents_count_get_with_http_info(opts)\n return data\n end", "def counts\n reply.documents[0][COUNTS]\n end", "def count_documents(filter = {}, options = {})\n View.new(self, filter, options).count_documents(options)\n end", "def written_count\n if acknowledged?\n first_document[N] || 0\n else\n 0\n end\n end", "def count\n load_page(1) if @num_records.nil? # load pagination metadata\n @num_records\n end", "def count\n Driver.client[coll_name].find.count\n end", "def document_counts\n @document_count ||= solr_response.facet_queries.each_with_object({}) do |(k, v), h|\n h[k.split(/:/).first] = v\n end\n end", "def length\n docs.length\n end", "def primary_data_file_count\n study_file_count = self.study_files.primary_data.size\n directory_listing_count = self.directory_listings.primary_data.map {|d| d.files.size}.reduce(0, :+)\n study_file_count + directory_listing_count\n end", "def retrieved_records\n results.count\n end", "def estimated_document_count(options = {})\n View.new(self, {}, options).estimated_document_count(options)\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify #{path}].split(image.filename).length-1 rescue nil #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify #{path}].split(image.filename).length-1 rescue nil #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def get_total_document_count_to_update(options = {})\n path = \"#{base_uri}/total_count_to_update\"\n request(path, options).to_s\n end", "def system_documents_count_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DocumentsApi.system_documents_count_get ...\"\n end\n if @api_client.config.client_side_validation && opts[:'record_type'] && !['Agreement', 'Company', 'Configuration', 'Contact', 'Expense', 'HTMLTemplate', 'Opportunity', 'Project', 'PurchaseOrder', 'Rma', 'SalesOrder', 'Ticket', 'ServiceTemplate', 'KnowledgeBase', 'ToolbarIcon', 'Meeting', 'MeetingNote', 'ProductSetup', 'ProjectTemplateTicket', 'WordTemplate', 'Member'].include?(opts[:'record_type'])\n fail ArgumentError, 'invalid value for \"record_type\", must be one of Agreement, Company, Configuration, Contact, Expense, HTMLTemplate, Opportunity, Project, PurchaseOrder, Rma, SalesOrder, Ticket, ServiceTemplate, KnowledgeBase, ToolbarIcon, Meeting, MeetingNote, ProductSetup, ProjectTemplateTicket, WordTemplate, Member'\n end\n # resource path\n local_var_path = \"/system/documents/count\"\n\n # query parameters\n query_params = {}\n query_params[:'recordType'] = opts[:'record_type'] if !opts[:'record_type'].nil?\n query_params[:'recordId'] = opts[:'record_id'] if !opts[:'record_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Count')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DocumentsApi#system_documents_count_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/Parser/Images/#{image.filename}\").first\n count += %x[identify \"#{path}\"].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def count\n folder.data_objects.all(parameters).count\n end", "def count_documents rdf_type, allowed_groups = nil\n sparql_query = <<SPARQL\n SELECT (COUNT(?doc) AS ?count) WHERE {\n ?doc a <#{rdf_type}>\n }\nSPARQL\n\n log.debug \"Counting documents for #{allowed_groups}\"\n\n query_result =\n if allowed_groups\n authorized_query sparql_query, allowed_groups\n else\n request_authorized_query sparql_query\n end\n\n documents_count = query_result.first[\"count\"].to_i\n\n log.info \"Found #{documents_count} documents for #{allowed_groups}.\"\n\n documents_count\nend", "def number_of_pages job\r\n count = 0\r\n pages = job.client_images_to_jobs.length\r\n if (@facility.image_type == 1) && (pages < 2)\r\n job.images_for_jobs.each do |image|\r\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\r\n count += %x[identify \"#{path}\"].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\r\n end\r\n pages = count\r\n end\r\n pages\r\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify \"#{path}\"].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n path = Dir.glob(\"#{@location}/**/#{image.filename}\").first\n count += %x[identify #{path}].split(image.filename).length-1 #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def count_documents_function\n \"function(keys, values) {\n return values.length;\n }\"\n end", "def total_file_count\n self.study_files.non_primary_data.count + self.primary_data_file_count\n end", "def number_of_pages job\n count = 0\n pages = job.client_images_to_jobs.length\n if (@facility.image_type == 1) && (pages < 2)\n job.images_for_jobs.each do |image|\n image_path = @image_folder.detect{|image_string| image_string.downcase == \"#{@image_path}/#{image.image_file_name}\".downcase}\n count += %x[identify #{image_path}].split(image.image_file_name).length-1 rescue nil #command for retrieve number of pages in a tiff file (multi/single)\n end\n pages = count\n end\n pages\n end", "def total_record_count\n ldpath = config.total_count_ldpath\n service_uri = RDF::URI.new(config.service_uri)\n return I18n.t(\"qa.linked_data.search.total_not_reported\") unless ldpath && service_uri\n prefixes = config.prefixes\n ldpath_program = ldpath_service.ldpath_program(ldpath: ldpath, prefixes: prefixes)\n values = ldpath_service.ldpath_evaluate(program: ldpath_program, graph: graph, subject_uri: service_uri)\n values.map!(&:to_i)\n values.first || I18n.t(\"qa.linked_data.search.total_not_reported\")\n end", "def records_count\n cached_collection.count\n end", "def count\n self.at('/RETS/COUNT')['Records'].to_i\n end", "def refresh\n return data.length if data.length > 0\n if next_page\n @doc = get next_page\n elsif last_page?\n return 0\n else\n @doc = get(collection, params={:count => per_page, :start => start}.update(@opts['extra_args']))\n end\n return data.length\n end", "def total_results\n records&.size || 0\n end", "def num_records\n @opened ? @num_records : nil\n end", "def num_files_total\n command_string = 'find '+@install_root+' | wc -l'\n inspec.bash(command_string).stdout.split(\"\\n\")[0].strip.to_i\n end", "def get_work_download_count( work )\n return 0 if work.filesets.blank?\n sum = 0\n work.filesets.each { |fs|\n sum += get_file_download_count( fs.id )\n }\n return sum\n end", "def get_collections_count()\n uri = build_uri('info/collection_counts')\n @tools.process_get_request(uri, @user_obj.encrypted_login, @user_pwd).body\n end", "def objects_count\n @objects_count ||= objects.size\n end", "def count_records **args\n logger.progname = 'RestOperations#CountRecords'\n query = OrientSupport::OrientQuery.new args\n \tquery.projection << 'COUNT (*)'\n \tresult = get_records raw: true, query: query\n begin\n result.first['COUNT']\n rescue\n return 0\n end\n end", "def get_slide_count(storage_type='',folder_name = '',storage_name='')\n \n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n str_uri = $product_uri + '/slides/' + @filename + '/slides'\n if !folder_name.empty?\n str_uri += '?folder=' + folder_name\n end\n if !storage_name.empty?\n str_uri += '&storage=' + storage_name\n end\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n return stream_hash['Slides']['SlideList'].length\n \n rescue Exception=>e\n print e\n end\n \n end", "def records_total_count\n Rails.cache.fetch('raw_count') { get_raw_records.count(:all) }\n end", "def count\n resource = @client.send(:head, self.next, **@options)\n resource.get_response.total_records\n end", "def dor_resource_count\n public_xml_doc.xpath('//contentMetadata/resource').count\n end", "def num_urls\n @client[URLS_COLLECTION].count\n end", "def num_members\n solr_document[\"member_ids_ssim\"].try(:length) || 0\n end", "def document_number\n hits = self.class.ferret_index.search(query_for_self)\n return hits.hits.first.doc if hits.total_hits == 1\n raise \"cannot determine document number from primary key: #{self}\"\n end", "def count(opts = {})\n view = opts[:view] || @opts[:view]\n client.view(view,\n limit: 0,\n include_docs: false,\n stream: true).total_rows\n end", "def count_view(options)\n search_fields = search_fields(options)\n \n if database.version > 0.8\n view_name = get_view_name(search_fields)\n else\n view_name = get_view_name(search_fields, \"count\")\n end\n \n options[:return_json] = true\n result = generic_view(view_name, find_by_function(search_fields), count_documents_function, options)\n \n result['rows'].first['value'] rescue 0\n end", "def parent_collection_count\n parent_collections.nil? ? 0 : parent_collections.documents.size\n end", "def getNumberOfPages(doc)\n numberOfPages = 1\n\n doc.search(\"Document > View > ScrollView > VBoxView > View > MatrixView > VBoxView:nth(0) > HBoxView > TextView > SetFontStyle > b\").each do |e|\n # Parse the last number in the string, e.g. the 99 in \"Page 3 of 99\"\n numberOfPages = e.inner_html[/[0-9]+$/].to_i\n end\n\n return numberOfPages\nend", "def num_results(_args = {})\n @num_results ||= result_ids&.count || 0\n end", "def count()\n if @count == -1\n params = @params.clone\n params['count'] = 1\n\n res = @api.do_request(\"GET\", @path, params)\n @count = res['count'].to_i\n end\n @count\n end", "def total\n @total ||= solr_response['numFound'] || 0\n end", "def total\n @total ||= solr_response['numFound'] || 0\n end", "def get_bookmarks_count\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n \n str_uri = $product_uri + '/pdf/' + @filename + '/bookmarks'\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n return stream_hash['Bookmarks']['List'].length\n \n \n rescue Exception=>e\n print e\n end\n end", "def get_attachments_count\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n \n str_uri = $product_uri + '/pdf/' + @filename + '/attachments'\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n\n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n stream_hash = JSON.parse(response_stream)\n \n return stream_hash['Attachments']['List'].length\n \n \n rescue Exception=>e\n print e\n end\n end", "def standard_document_size\n object.standard_document ? object.standard_document.size : nil\n end", "def get_resultcount\n\t\treturn @resultcount || Afasgem.default_results\n\tend", "def query_1\n document_ids = Perpetuity[Document].all.to_a.map(&:id)\n index_num = [ 42, 76, 44, 90, 8, 12, 4, 77, 43, 99]\n all_ids = []\n index_num.each do |num|\n all_ids << document_ids[num]\n end\n\n processed_number = 0\n all_ids.each do |id|\n Perpetuity[Document].find(id)\n processed_number+=1\n end\n return processed_number\nend", "def count_objects\n ObjectSpace.count_objects\n end", "def get_workers_records_count(resource_configuration, params = {})\n get_workers_records_cursor(resource_configuration, params).count\n end", "def page_count\n load_page(1) if @num_records.nil? # load pagination metadata\n @num_pages\n end", "def harvest_number_of_records(page)\n records = ''\n page.body.each_line do |line|\n if line.include?('var allContactsCount')\n records = line.split('= ')[1].gsub(/;/, '')\n end\n end\n return records.to_i\nend", "def num_found\n\n if @solr_response[\"response\"] != nil\n # Normal Solr query\n return @solr_response[\"response\"][\"numFound\"]\n end\n\n if @solr_response[\"grouped\"] != nil\n # Grouped Solr query.\n total = 0\n @solr_response[\"grouped\"].keys.each do |key|\n total += @solr_response[\"grouped\"][key][\"matches\"]\n end\n return total\n end\n\n return 0\n rescue\n 0\n end", "def count\n if paginated?\n to_hash['results'].nil? ? 0 : to_hash['results'].size\n else\n to_hash['count']\n end\n end", "def number_of_pages(fedora_obj)\n len = []\n fedora_obj.datastreams.keys.each do |x|\n len << x if x.include?('.txt')\n end\n len.length\n end", "def count\n @collection.count(Scope.new(@collection, @selector, @opts))\n end", "def size\n\n fetch_all(:count => true)\n end", "def count( query )\n data = index_request({ \"q\" => query })\n return data[\"response\"][\"numFound\"]\n end", "def total_parent_collections\n parent_collections.nil? ? 0 : parent_collections.response['numFound']\n end", "def page_count; pages.count; end", "def workspace_unread_count\n unread = 0\n workspaces = WorkspaceLancer.or(\n { employer_username: self.username },\n { freelancer_username: self.username },\n { service_provider_username: self.username }\n )\n\n\n # Count each message as unread\n if workspaces.any?\n workspaces.each do |w|\n u = w.events.where(\n read: false,\n :member_id.ne => self.id\n ).count\n\n unread = unread + u\n end\n end\n\n return unread\n end", "def returned_sheets\n return 0 if course.profs.empty? || form.get_tutor_question.nil?\n tutor_db_column = form.get_tutor_question.db_column.to_sym\n RT.count(form.db_table, {:barcode => course.barcodes, \\\n tutor_db_column => tutnum})\n end", "def internalRepItemCount\n return @delegate.rowCount\n end", "def page_count\n if collection.length < page_size\n 1\n else\n (collection.length / page_size) + 1\n end\n end", "def doc_stats collection\n visible = collection.select { |item| item.display? }\n [visible.length, visible.count { |item| not item.documented? }]\n end", "def images_count\r\n images_count = 0\r\n jobs.each do |job|\r\n images_count += job.images_for_jobs.count\r\n end\r\n images_count\r\n end", "def count\n @count ||= @query.count\n end", "def query_3\n start_date = '2014-01-10'\n end_date = '2014-01-18'\n documents = Perpetuity[Document].select { |document| document.revision_date.in (start_date.to_time..end_date.to_time)}\n return documents.to_a.size\nend", "def get_size\n return @content_objects.count\n end", "def size\n loaded? ? @records.length : count\n end", "def count\n Integer(parsed_body['meta']['total_results'])\n end", "def total_records\n record.records.count\n end", "def query_count(query, idx, type = 'document')\n response = request(\n :count,\n index: idx,\n type: type,\n body: query)\n response['count'].to_i || 0\n end", "def count_records\n count = scoped.count\n\n # If there's nothing in the database and @target has no new records\n # we are certain the current target is an empty array. This is a\n # documented side-effect of the method that may avoid an extra SELECT.\n @target ||= [] && loaded! if count == 0\n\n count\n end" ]
[ "0.7815855", "0.77930063", "0.72505826", "0.71302795", "0.7117782", "0.7039338", "0.7025306", "0.69475865", "0.685938", "0.66659313", "0.66659313", "0.65283287", "0.6460925", "0.64382344", "0.64263386", "0.6393648", "0.6374159", "0.63524085", "0.6345766", "0.6345496", "0.6247539", "0.6193541", "0.61404413", "0.6127454", "0.61160624", "0.6098482", "0.6073871", "0.60259706", "0.60160226", "0.6013496", "0.59735286", "0.59735286", "0.59703076", "0.5966577", "0.5952221", "0.59491724", "0.59477264", "0.5939072", "0.5931598", "0.59303826", "0.5890681", "0.5888137", "0.58829474", "0.5869843", "0.5865696", "0.58555317", "0.5854636", "0.58531195", "0.584506", "0.5827204", "0.5825114", "0.57998276", "0.5799752", "0.579701", "0.5769698", "0.5768614", "0.57543397", "0.574169", "0.57355744", "0.57215774", "0.5718086", "0.57145333", "0.5708848", "0.5703479", "0.5693395", "0.5681443", "0.56721306", "0.56672287", "0.56672287", "0.566462", "0.56246144", "0.562176", "0.5620641", "0.561952", "0.5615696", "0.5608301", "0.5605806", "0.5599025", "0.5594927", "0.55879647", "0.55742234", "0.5573965", "0.5567593", "0.55637074", "0.5553269", "0.5552367", "0.5544896", "0.5543764", "0.5536662", "0.5528385", "0.5523542", "0.5507373", "0.5502963", "0.55014175", "0.5501262", "0.548552", "0.5484864", "0.5477278", "0.54771984", "0.54752946" ]
0.71291035
4
Returns the most directly responsible party for an appeal when it is at the Board, mirroring Legacy Appeals' location code in VACOLS rubocop:disable Metrics/PerceivedComplexity
def location_code location_code = nil if root_task && root_task.status == Constants.TASK_STATUSES.completed location_code = COPY::CASE_LIST_TABLE_POST_DECISION_LABEL else active_tasks = tasks.where(status: [Constants.TASK_STATUSES.in_progress, Constants.TASK_STATUSES.assigned]) if active_tasks == [root_task] location_code = COPY::CASE_LIST_TABLE_CASE_STORAGE_LABEL elsif !active_tasks.empty? most_recent_assignee = active_tasks.order(updated_at: :desc).first.assigned_to location_code = if most_recent_assignee.is_a?(Organization) most_recent_assignee.name else most_recent_assignee.css_id end end end location_code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coalition_leader(party)\n natural_leader = @parties.find {|p| p.id == party.natural_leader_id }\n natural_leader || @parties.max_by(&:seats_won)\n end", "def best_offense\n offense_suite\n best_offense_id = @average_goals_by_id.invert.max[1]\n @team_name_by_id[best_offense_id]\n end", "def party\n parties.first\n end", "def offensive_row_for_ai(board)\n offensive_play = {}\n WINNING_COMBINATIONS.each { |offense| offensive_play[offense] = 0 }\n WINNING_COMBINATIONS.each do |offense|\n offense.each do |is_x|\n offensive_play[offense] += 1 if board[is_x] == COMPUTER_MARKER\n if board[is_x] == PLAYER_MARKER\n offensive_play[offense] = 0\n break\n end\n end\n end\n offensive_play\nend", "def party\n respond_to?(:partyMembershipHasParty) ? partyMembershipHasParty.first : nil\n end", "def get_avail_cor(player, opponent)\n taken = player + opponent # all occupied board positions\n avail_cor = @corners - (@corners & taken) # determine which corners are taken\n if avail_cor.size > 0 # if there are any open corners\n position = avail_cor.sample # take one of them\n else\n position = get_avail_edg(player, opponent) # otherwise take an open edge\n end\n end", "def house()\n\t\tadmin = self.parties.where{type == AdminParty.to_s}.first\n\t\traise \"administrator party not found\" if admin.nil?\n\t\tadmin\n\tend", "def fo_tool\n return actor.equips[0] if actor.primary_use == 1\n return actor.equips[1] if actor.primary_use == 2\n return actor.assigned_item if actor.primary_use == 3\n return actor.assigned_item2 if actor.primary_use == 4\n return actor.assigned_item3 if actor.primary_use == 5\n return actor.assigned_item4 if actor.primary_use == 6\n return actor.assigned_skill if actor.primary_use == 7\n return actor.assigned_skill2 if actor.primary_use == 8\n return actor.assigned_skill3 if actor.primary_use == 9\n return actor.assigned_skill4 if actor.primary_use == 10\n end", "def authoritative_company\n @authoritative_company ||= begin\n if self.badge&.company_id.present?\n Company.unscoped { self.badge.company }\n\n # System user senders include anniversaries and the first ambassador badge\n # It is an edge case for anniversaries because they should have custom badges enabled\n # and thus should hit the above conditional\n # However, recognitions for the ambassador badge are sent during signup\n # and thus do not have custom badges enabled yet\n # Regardless, pick the first user recipient\n elsif self.sender&.system_user?\n # there are definitely odd cases where the recognition is left around\n # but the recipients have deleted_at set\n # We don't care about that here. If we have a recognition object,\n # return the recipients even if they have been \"deleted\"\n Company.unscoped { User.unscoped{ self.user_recipients.first&.company }}\n else\n # This is a bit of a weird branch. Not sure if or when we'll hit this\n # But the latter part of the || was added to get a test to pass spec/models/recognition_spec.rb\n Company.unscoped{ self.sender_company || self.sender&.company}\n end\n end\n end", "def target_position(investigator)\n max_confidence = @positions.values.max\n position = @positions.select {|key, value| value == max_confidence }.keys.reject{ |e| e == investigator.location }.sample\n position = @cities.random_city(exclusion = investigator.location) unless position\n position\n end", "def best_offense\n @teams.max_by { |team| team.average_goals_scored }.team_name\n end", "def party_for(user)\n\t\tparties = self.parties.joins{contact}.where{contact.user_id == user.id}\n\t\tparties.first\n\tend", "def on_the_offensive(brd)\n attack = []\n WINNING_LINES.each do |line|\n current_line = brd.values_at(*line)\n if current_line.count(COMPUTER_MARKER) == 2\n attack = line\n end\n attack # returns array that is the best attack vector\nend\n\ndef determine_threat(brd)\n threat_line = []\n WINNING_LINES.each do |line|\n current_line = brd.values_at(*line)\n if current_line.any?(COMPUTER_MARKER)\n next\n elsif current_line.count(PLAYER_MARKER) == 2\n threat_line = line\n end\n end\n threat_line\nend", "def office\n offices.first\n end", "def biggest_council\n return if payer_breakdown.blank? || payer_breakdown.all?{ |o| o[:organisation_type] != 'Council' }\n council_details = payer_breakdown.select{ |o| o[:organisation_type] == 'Council'}.sort{|a,b| b[:total_spend] <=> a[:total_spend]}.first\n Council.find_by_id(council_details[:organisation_id])\n end", "def agency\n\t\treturn @agency if @agency_loaded\n\t\t@agency_loaded = true\n\t\tcc = cost_center.to_s[0, 2]\n\t\tagens = Agency.find(:all, :conditions => ['find_in_set(?, vacancy_data_codes)', cc])\n\t\t@agency = agens[0] if agens.size == 1\n\t\t@agency ||= Agency.find_by_abbreviation('MC')\n\tend", "def get_target(map, loc)\n owned = nil\n owned_min = 1000\n GameMap::CARDINALS.each do |l|\n new_loc = map.find_location(loc, l)\n site = map.site(new_loc)\n if site.owner != $tag && site.strength < owned_min\n owned_min = site.strength\n owned = l\n end\n end\n owned\nend", "def hipaa_code_related_to_partner_and_payment_condition(crosswalk_record)\n if crosswalk_record\n if @zero_payment && is_partner_bac\n if crosswalk_record.denied_hipaa_code_id.present? && crosswalk_record.crosswalk_record_id.present?\n rc_crosswalk = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if rc_crosswalk.present?\n @denied_hipaa_code_record = rc_crosswalk.denied_hipaa_code\n @hipaa_code = @denied_hipaa_code_record.hipaa_adjustment_code if @denied_hipaa_code_record\n end\n end\n else\n rcc_log.debug \"Obtaining HIPAA CODE.\"\n if crosswalk_record.hipaa_code_active_indicator\n @hipaa_code = crosswalk_record.hipaa_adjustment_code\n elsif crosswalk_record.crosswalk_record_id.present?\n rcc_log.debug \"hipaa_code_active_indicator is false. Obtaining the hipaa_record\"\n rc_crosswalk = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if rc_crosswalk.present?\n @hipaa_code_record = rc_crosswalk.hipaa_code\n if @hipaa_code_record && @hipaa_code_record.eligible_for_output?(get_eob)\n @hipaa_code = @hipaa_code_record.hipaa_adjustment_code if @hipaa_code_record.present?\n end\n end\n end\n end\n end\n rcc_log.debug \"HIPAA CODE : #{@hipaa_code}\"\n @hipaa_code.to_s.upcase\n end", "def likely_organization\n match_keys = [[:telephone_number], [:fax_number], [:first_line, :second_line, :postal_code]]\n [mailing_address, practice_location_address].each do |address|\n match_keys.each do |mk|\n matcher = address.slice(*mk).reject { |k, v| v.blank? }\n if matcher.size > 0 && org_address = Address.where(matcher.merge(entity_type: 'Organization')).first\n return org_address.entity\n end\n end\n end\n return nil\n end", "def opponent_board\n boards.opponent.first\n end", "def primary_funder(data_management_plan:)\n return nil unless data_management_plan.present? && data_management_plan.project.present?\n\n funders = data_management_plan.project.fundings.map(&:affiliation)\n return nil unless funders.any?\n\n funders.last\n end", "def appeals\n @appeals ||= begin\n legacy_appeals = find_appeals_ready_for_geomatching(\n LegacyAppeal,\n select_fields: [:vacols_id]\n ).first(QUERY_LIMIT / 2)\n\n ama_appeals = find_appeals_ready_for_geomatching(Appeal).first(QUERY_LIMIT / 2)\n legacy_appeals + ama_appeals\n end\n end", "def actual_accommodation\r\n return self.accommodation_histories.last\r\n end", "def get_best_mir_for_event(event_type, pool_type)\n @swimmer.meeting_individual_results.for_pool_type(pool_type).for_event_type(event_type).is_not_disqualified.exists? ?\n @swimmer.meeting_individual_results.for_pool_type(pool_type).for_event_type(event_type).is_personal_best.first :\n nil\n end", "def dealer\n first_dealer = self.game.first_dealer\n if not first_dealer\n return nil\n end\n first_dealer_position = self.game.first_dealer.position\n p = self.position + first_dealer_position\n while p > self.game.size - 1\n p = p - self.game.size\n end\n return self.game.game_players.where(position: p).first\n end", "def threat_row_for_ai(board)\n defend_spaces = {}\n WINNING_COMBINATIONS.each { |threat| defend_spaces[threat] = 0 }\n WINNING_COMBINATIONS.each do |threat|\n threat.each do |is_x|\n defend_spaces[threat] += 1 if board[is_x] == PLAYER_MARKER\n if board[is_x] == COMPUTER_MARKER\n defend_spaces[threat] = 0\n break\n end\n end\n end\n defend_spaces\nend", "def worst_offense\n @teams.min_by { |team| team.average_goals_scored }.team_name\n end", "def player_index\n\t\t\[email protected]_index do |row|\n\t\t\t\t@grid[row].each_index do |col|\n\t\t\t\t\tif @grid[row][col].respond_to?(:resident) && Person === @grid[row][col].resident\n\t\t\t\t\t\treturn [row, col]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tnil\n\t\tend", "def electronic_holding_location\n @electronic_holding_location ||= holdings&.find { |h| (h.dig('holdingsType', 'name') || h.dig('location', 'effectiveLocation', 'details', 'holdingsTypeName')) == 'Electronic' }\n end", "def round1_my_party_cand\n Candidate.all.select do |can|\n if can.party == self.party and can.level_of_governments == \"Local Election\"\n puts''\n puts\" \"\n puts\" #{can.name} \"\n puts\" \"\n puts\" State: #{can.state} \"\n puts\" Party: #{can.party} \"\n puts\" Age: #{can.age} \"\n puts\" Years of Experience: #{can.years_of_experience} \"\n puts\" Level of Government: #{can.level_of_governments} \"\n puts\" \"\n puts' ==================================================='\n end\n end\n end", "def get_opportunity_followup_overdue(cid, eid)\n get_my_overdue_opportunity(cid, eid)\n end", "def highest_earner(drivers)\n # hash data for the highest earning driver\n highest_earner_data = drivers.max { |a, b| a[:total_earned] <=> b[:total_earned]}\n # extracts the driver ID\n highest_earner = highest_earner_data[:driver_id]\n return highest_earner\nend", "def who_is_winner(pieces_position_list)\n representation = create_representation(pieces_position_list)\n\n diagonal = get_diagonal(representation)\n on_row = by_row(representation)\n on_column = by_column(representation)\n\n [diagonal, on_column, on_row].select { |x| x != 'Draw' }.first\nend", "def choose_elevator\n elevator_scores = []\n\n for elevator in @column.elevator_list do\n \n # Initialize score to 0\n score = 0\n floor_difference = elevator.current_floor - @floor\n\n # Prevents use of any offline/under-maintenance elevators\n if elevator.status != \"online\"\n score = -1\n elevator_scores.append(score)\n else\n\n # Bonify score based on difference in floors\n if floor_difference == 0\n score += 5000\n else\n score += 5000/(floor_difference.abs() + 1)\n end\n \n # Bonify score based on direction (highest priority)\n if elevator.movement != \"idle\"\n if floor_difference >= 0 and @direction == \"down\" and elevator.movement == \"down\"\n \n # Paths are crossed going down, therefore favor this elevator\n score += 10000\n \n elsif floor_difference <= 0 and @direction == \"up\" and elevator.movement == \"up\"\n\n # Paths are crossed going down, therefore favor this elevator\n score += 10000\n \n else\n \n # Paths are not crossed, therefore try avoiding the use of this elevator\n score = 0\n \n # Give redemption points, in worst case scenario where all elevators never cross paths\n next_floor_difference = elevator.next_floor - @floor\n if next_floor_difference == 0\n score += 500\n else\n score += 500/(next_floor_difference.abs() + 1)\n end\n end\n end\n\n # Bonify score on request queue size (the smaller number of pre-existing requests, the faster therefore the better)\n if elevator.requests_queue.length() <= 3\n score += 1000\n elsif elevator.requests_queue.length() <= 7\n score += 250\n end\n \n # Send total score of elevator to the scores list\n elevator_scores.append(score)\n end\n end\n\n # Get value of highest score\n highest_score = -1\n for score in elevator_scores do\n if (score > highest_score)\n highest_score = score\n end\n end\n \n # Get elevator with the highest score (or nil if all elevators were offline\n chosen_elevator = nil\n if (highest_score > -1)\n chosen_elevator = @column.elevator_list[elevator_scores.find_index(highest_score)]\n puts \"Chosen elevator: Elevator #{chosen_elevator.id}\"\n end\n return chosen_elevator\n end", "def highest_degree_offered\n degree = {\n '0' => nil, '1' => '4-year', '2' => '4-year', '3' => '4-year',\n '4' => '2-year' \n }\n\n !facility_code.nil? && degree.keys.include?(facility_code[1]) ? degree[facility_code[1]] : 'NCD'\n end", "def company_code\n if self.yard.present? && self.yard.facility.present? && self.yard.facility.country.present?\n country = self.yard.facility.country\n \"COPART#{country.code}\".upcase\n else\n \"\"\n end\n end", "def find_organism\n return self.dnafrag.genome_db\n end", "def hazardRoom\n return @@hazardRoom[self.number-1]\n end", "def get_avail_edg(player, opponent)\n taken = player + opponent # all occupied board positions\n avail_edg = @edges - (@edges & taken) # determine which edges are taken\n position = avail_edg.sample # take one of them\n end", "def counter_party\n if @estimate.client == signed_in_client\n other_party = @account.clients.find(:first, :conditions => {:is_account_master => true})\n else\n other_party = @estimate.client\n end\n other_party\n end", "def suggested_sales_area\n if advert=self.advertiser\n # offer = self.offers.last\n if advert.address and zc = advert.address.zip_code_obj\n zc.sales_area\n end\n end\n end", "def parties(location, state)\n if location == :north\n soldiers_at(:north, state).map { |soldier| [soldier] } # one guy\n else\n soldiers_at(:south, state).combination(2).to_a # two guys\n end\nend", "def whole_affil (new_party_affiliation)\n if new_party_affiliation == \"d\"\n \"Democrat\"\n else new_party_affiliation == \"r\"\n \"Republican\"\n end\n end", "def sel_avail_cor(player, opponent)\n taken = player + opponent # all occupied board positions\n # determine which corners are taken and take a random corner from the open opcor pair\n (taken & @opcor_1).size == 2 ? position = @opcor_2.sample : position = @opcor_1.sample\n end", "def offense\n offensive_pieces = if game_of_piece.current_color == 'white'\n Piece.where(color: 'white', game_id: game_id, active: true)\n else\n Piece.where(color: 'black', game_id: game_id, active: true)\n end\n offensive_pieces\n end", "def get_best_mir_for_meeting(meeting, event_type, pool_type)\n @swimmer.meeting_individual_results.for_meeting_editions(meeting).for_pool_type(pool_type).for_event_type(event_type).is_not_disqualified.exists? ?\n @swimmer.meeting_individual_results.for_meeting_editions(meeting).for_pool_type(pool_type).for_event_type(event_type).is_not_disqualified.sort_by_timing('ASC').first :\n nil\n end", "def party(str)\n Party.where(name: str).first\nend", "def getChipsMatch\n @chips.each_index.select{|i| @chips[i] == @elevatorFloor}\n end", "def get_hipaa_code_for_adjustment_reason(adjustment_reason)\n adjustment_hipaa_code_id = \"#{adjustment_reason}_hipaa_code_id\"\n hipaa_code_id_from_entity = entity.send(adjustment_hipaa_code_id)\n if hipaa_code_id_from_entity.present?\n hipaa_code_array = HipaaCode.get_active_code_details_given_ids([hipaa_code_id_from_entity])\n if hipaa_code_array.present?\n hipaa_id_and_code_and_description = hipaa_code_array.first\n if hipaa_id_and_code_and_description.present?\n hipaa_code = hipaa_id_and_code_and_description[1]\n end\n end\n end\n hipaa_code = hipaa_code.to_s.upcase\n rcc_log.debug \"Getting HIPAA code directly from the entity table : #{hipaa_code}\"\n hipaa_code\n end", "def company\n alliance_company\n end", "def return_solution_found\n @open.select(&:goal).first\n end", "def alien_species\n # 2. for those Colonies, get the information about the species\n self.colonies.map do |colony_instance|\n colony_instance.alien_species\n end\n end", "def find_most_dangerous_enemy(warrior)\n # archers or wizards in any direction?\n if %w{ Wizard Archer }.include? nearest_enemy( warrior, opposite_direction() ).to_s\n opposite_direction()\n elsif %w{ Wizard Archer }.include? nearest_enemy( warrior, @@direction ).to_s\n @@direction\n elsif enemies_ahead?( warrior, opposite_direction() )\n opposite_direction()\n else\n @@direction \n end\n end", "def party_worth\n get_worth_of( shared_inventory + actors_inventory )\n end", "def constituency\n constituencies.first\n end", "def pbFirstTarget(idxBattler,target_data)\r\n case target_data.id\r\n when :NearAlly\r\n @battle.eachSameSideBattler(idxBattler) do |b|\r\n next if b.index==idxBattler || [email protected]?(b,idxBattler)\r\n next if b.fainted?\r\n return b.index\r\n end\r\n @battle.eachSameSideBattler(idxBattler) do |b|\r\n next if b.index==idxBattler || [email protected]?(b,idxBattler)\r\n return b.index\r\n end\r\n when :NearFoe, :NearOther\r\n indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)\r\n indices.each { |i| return i if @battle.nearBattlers?(i,idxBattler) && [email protected][i].fainted? }\r\n indices.each { |i| return i if @battle.nearBattlers?(i,idxBattler) }\r\n when :Foe, :Other\r\n indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)\r\n indices.each { |i| return i if [email protected][i].fainted? }\r\n indices.each { |i| return i }\r\n end\r\n return idxBattler # Target the user initially\r\n end", "def find_candidate_for_guessing\n unassigned_cells.sort_by { |cell|\n [cell.available_values.size, to_s]\n }.first\n end", "def most_profitable_role\n @agent_roles.max_by { |role| @trade_tracker.profitability_of(role) }\n end", "def most_money(rideshare)\n highest_earned = 0.0\n high_earner = \"\"\n # call method from #2\n money_made(rideshare).map do |driver, cost|\n if cost > highest_earned\n highest_earned = cost\n high_earner = driver\n end\n end\n return high_earner\nend", "def detect_winner(brd)\n Board::WINNING_LINES.each do |line|\n if brd.position_values[line[0]] == Board::PLAYER_MARKER &&\n brd.position_values[line[1]] == Board::PLAYER_MARKER &&\n brd.position_values[line[2]] == Board::PLAYER_MARKER\n return 'Player'\n elsif brd.position_values[line[0]] == Board::CPU_MARKER &&\n brd.position_values[line[1]] == Board::CPU_MARKER &&\n brd.position_values[line[2]] == Board::CPU_MARKER\n return 'CPU'\n end\n end\n nil\n end", "def compute_client_code(facility_specific_payees, facility)\n client_code = nil\n unless patient_account_number.blank?\n unless facility_specific_payees.blank?\n facility_specific_payees.each do |payee|\n identifier_index = patient_account_number.upcase.index(\"#{payee.db_identifier}\")\n case payee.match_criteria\n when 'like'\n if identifier_index && identifier_index >= 1\n client_code = payee.xpeditor_client_code\n break\n end\n when 'start_with'\n if identifier_index && identifier_index == 0\n client_code = payee.xpeditor_client_code\n break\n end\n when 'equals'\n if payee.db_identifier == patient_account_number\n client_code = payee.xpeditor_client_code\n break\n end\n when 'length'\n if payee.db_identifier.to_i == patient_account_number.length\n client_code = payee.xpeditor_client_code\n break\n end\n when 'start_with_and_length_8'\n if identifier_index && identifier_index == 0 && patient_account_number.length == 8\n client_code = payee.xpeditor_client_code\n break\n end\n when 'all_numeric'\n if patient_account_number.match(/^[0-9]*$/)\n client_code = payee.xpeditor_client_code\n break\n end\n else\n client_code = payee.xpeditor_client_code\n break\n end\n end\n else\n client_code = facility.sitecode\n end\n end\n\n client_code\n end", "def hash_for_location(offense); end", "def pieces_per_location\n @pieces_per_location ||= pieces.group_by { |piece| holdings_by_id[piece['holdingId']]&.dig('location', 'effectiveLocation', 'code') }\n end", "def best_tipper\n meal_with_highest_tip = meals.max do |meal_a, meal_b|\n meal_a.tip <=> meal_b.tip\n end\n\n meal_with_highest_tip.customer \n end", "def party_owner\n if !self.account_id.nil?\n self.account.name\n elsif !self.vendor_id.nil?\n self.vendor.name\n elsif !self.user_id.nil?\n \"Personal Contact\"\n else\n \"-\"\n end\n end", "def staff_agency\n agencies.last\n end", "def winter_olympics_sport; end", "def office_country_code\n self.dig_for_string(\"agentSummary\", \"office\", \"officeAddress\", \"countryCode\")\n end", "def plan\n calculate_scores_and_attendabilities\n \n highest_attendability_value = @attendabilities.sort {|a,b| a[1] <=> b[1]}.reverse[0][1]\n best_attendabilities = @attendabilities.to_a.select {|a| (a[1] == highest_attendability_value)}\n pairs_with_best_attendabilities = best_attendabilities.collect {|b| b[0]}\n best_scores = @scores.to_a.select {|s| pairs_with_best_attendabilities.include?(s[0])}.sort {|a,b| a[1] <=> b[1]}.reverse\n \n produce_roster(:monday, best_scores[0][0][0])\n produce_roster(:wednesday, best_scores[0][0][1])\n end", "def get_oute_judgement(sente, board)\n if sente > 0\n role_value = Piece::OU\n opponent_kiki = board.gote_kikis\n else\n role_value = - Piece::OU\n opponent_kiki = board.sente_kikis\n end\n 11.upto(99).each do |point|\n piece = board.board[point]\n next if piece == Piece::WALL\n next unless piece != Piece::NONE && piece == role_value\n # this piece is ou\n # check if oute?\n move_kikis = opponent_kiki.get_move_kikis(point)\n jump_kikis = opponent_kiki.get_jump_kikis(point)\n if move_kikis.size > 0 || jump_kikis.size > 0\n return [point, move_kikis, jump_kikis]\n end\n end\n nil\n end", "def best_candidate\n self.by_quality.first\n end", "def find_best_mir_for_event(event_type, pool_type)\n @swimmer.meeting_individual_results.for_pool_type(pool_type).for_event_type(event_type).is_not_disqualified.exists? ?\n @swimmer.meeting_individual_results.for_pool_type(pool_type).for_event_type(event_type).is_not_disqualified.sort_by_timing('ASC').first :\n nil\n end", "def best_target\n far_enough = competitors.select do |competitor|\n competitor.projected_position_at(current_tick_index).distance(self.sensors.position) >= RTanque::Bot::Turret::LENGTH\n end\n far_enough.sort_by do |competitor|\n competitor.projected_position_at(current_tick_index).distance(self.sensors.position) +\n (competitor.name == NAME ? 1000 : 0)\n end.first\n end", "def corporate_disqualified(officer_id)\n client.get(\"/disqualified-officers/corporate/#{officer_id}\")\n end", "def get_partner_account_id(current_user_account_id)\n \n self.parties.each do |party|\n if party != current_user_account_id then\n return party\n end\n end\n \n return nil\n end", "def favorite_opponent(team_id)\n team_id = team_id.to_i\n team = @teams.select { |each_team| each_team.team_id == team_id }.first\n favorite_opponent_id = team.matchup_win_percentage.max_by{|each_team, percentage| percentage}.first\n @teams.select { |each_team| each_team.team_id == favorite_opponent_id }.first.team_name\n end", "def pbRoamingAreas(index)\n data=RoamingSpecies[index]\n return data[5] if data && data[5]\n return RoamingAreas\nend", "def summer_olympics_sport; end", "def denied_hipaa_code(crosswalk_record)\n rcc_log.debug \"Obtaining Denied HIPAA CODE for zero payment.\"\n if crosswalk_record.denied_hipaa_code_id.present? && crosswalk_record.crosswalk_record_id.present?\n if @denied_hipaa_code_record.blank?\n rc_crosswalk = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if rc_crosswalk.present?\n @denied_hipaa_code_record = rc_crosswalk.denied_hipaa_code\n end\n end\n denied_hipaa_code = @denied_hipaa_code_record.hipaa_adjustment_code if @denied_hipaa_code_record\n end\n rcc_log.debug \"Denied HIPAA CODE : #{denied_hipaa_code}\"\n denied_hipaa_code.to_s.upcase\n end", "def client_code(crosswalk_record)\n rcc_log.debug \"Obtaining CLIENT CODE.\"\n if crosswalk_record && crosswalk_record.crosswalk_record_id.present?\n crosswalk_record = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if crosswalk_record.present?\n client_code_association_records = crosswalk_record.reason_codes_clients_facilities_set_names_client_codes.\n select{|rcfsc| rcfsc.category != 'DENIED' or rcfsc.category == nil}\n client_code_record = client_code_association_records.first.client_code if client_code_association_records.present?\n if client_code_record.present?\n client_code = client_code_record.adjustment_code\n rcc_log.debug \"CLIENT CODE : #{client_code}, having ID : #{client_code_record.id}\"\n end\n end\n end\n client_code.to_s.upcase\n end", "def round2_my_party_cand\n Candidate.all.select do |can|\n if can.party == self.party and can.level_of_governments == \"State Election\"\n puts''\n puts\" \"\n puts\" #{can.name} \"\n puts\" \"\n puts\" State: #{can.state} \"\n puts\" Party: #{can.party} \"\n puts\" Age: #{can.age} \"\n puts\" Years of Experience: #{can.years_of_experience} \"\n puts\" Level of Government: #{can.level_of_governments} \"\n puts\" \"\n puts' ==================================================='\n end\n end\n end", "def round3_my_party_cand\n Candidate.all.select do |can|\n if can.party == self.party and can.level_of_governments == \"National Election\"\n puts''\n puts\" \"\n puts\" #{can.name} \"\n puts\" \"\n puts\" State: #{can.state} \"\n puts\" Party: #{can.party} \"\n puts\" Age: #{can.age} \"\n puts\" Years of Experience: #{can.years_of_experience} \"\n puts\" Level of Government: #{can.level_of_governments} \"\n puts\" \"\n puts' ==================================================='\n end\n end\n end", "def secondary_address\n addresses.select{ |a| a.address_rank_code == 2 }.first\n end", "def handle_completly_uncontested!\n\n # sole party get three seats\n sole_party = @parties.first\n sole_party.award(3)\n\n # TODO: fix this demeter violation\n other_major = sole_party.null_opposing_major\n other_major.award(1)\n @parties << other_major\n\n # one seat to third party\n # TODO: fix this demeter violation\n third_party = sole_party.null_coalition_minor\n third_party.award(1)\n @parties << third_party\n end", "def location_of(item)\r\n return @pack if @pack.has?(item)\r\n @rooms.each { |id, r|\r\n return r if r.has?(item)\r\n }\r\n return nil\r\n end", "def office\n CabooseRets::Office.where(:lo_mls_id => self.mls_id).first\n end", "def get_parent_for_local_education_agency(local_education_agency)\n parent_id = local_education_agency[\"parent\"]\n parent = @world[\"leas\"].detect {|lea| lea[\"id\"] == parent_id}\n # if parent is nil --> no parent found under \"leas\"\n parent = @world[\"seas\"].detect {|sea| sea[\"id\"] == parent_id} if parent.nil?\n parent\n end", "def winner_col\n for col_index in 0..BOARD_MAX_INDEX\n first_symbol=@board[0][col_index]\n\n for row_index in 1..BOARD_MAX_INDEX\n if first_symbol !=@board[row_index][col_index]\n break\n elsif\n row_index == BOARD_MAX_INDEX and first_symbol !=EMPTY_POS\n return first_symbol\n end\n end\n end\n return \n end", "def offending_player(king_loc, player, board)\r\n board.each_with_index do |row, i|\r\n row.each_with_index do |piece, j|\r\n next if board[i][j].nil?\r\n if board[i][j].color != player && board[i][j].valid_move([i, j], king_loc, board) == true \r\n return [board[i][j], [i, j]] \r\n end\r\n end\r\n end\r\n return nil\r\n end", "def occupied_by\n @occupied_by\n end", "def computer_places_piece(brd)\n square = nil\n # offense first choice\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, COMPUTER_MARKER)\n break if square\n end\n # defense second choice\n if !square\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, PLAYER_MARKER)\n break if square\n end\n end\n # pick square #5 if available, third choice\n if !square\n square = 5 if brd[5] == INITIAL_MARKER\n end\n # just pick a square last choice\n if !square\n square = empty_squares(brd).sample\n end\n\n brd[square] = COMPUTER_MARKER\nend", "def item_target_actors\n [$game_party.members[0]]\n end", "def service_payee_identification\n code, qual = nil, nil\n claim = eob.claim_information\n fac = facility\n\n if (claim && !claim.payee_npi.blank?)\n code = claim.payee_npi\n qual = 'XX'\n Output835.log.info \"Payee NPI from the 837 is chosen\"\n elsif (claim && !claim.payee_tin.blank?)\n code = claim.payee_tin\n qual = 'FI'\n Output835.log.info \"Payee TIN from 837 is chosen\"\n elsif !fac.facility_npi.blank?\n code = fac.facility_npi\n qual = 'XX'\n Output835.log.info \"facility NPI from FC is chosen\"\n elsif !fac.facility_tin.blank?\n code = fac.facility_tin\n qual = 'FI'\n Output835.log.info \"facility TIN from FC is chosen\"\n end\n\n return code, qual\n end", "def best_tipper\n best_tipped_meal = meals.max do | meal_a, meal_b |\n meal_a.tip <=> meal_b.tip\n end\n best_tipped_meal.customer\n end", "def getTargetLocation(sourceRow, sourceCol, desiredRow, desiredCol)\n visited = Set.new()\n toVisit = []\n\n toVisit << {:row => desiredRow, :col => desiredCol}\n\n while (!toVisit.empty?)\n current = toVisit.shift()\n visited.add(current)\n\n if ([email protected]?(current[:row], current[:col]))\n return current\n end\n\n # TODO(eriq): Ideally, locations closer to the player will be\n # chosen/examined first.\n toVisit.concat(getNeighbors(@board, current))\n end\n\n # There is nowhere to move :(\n return nil\n end", "def resolve_personal_objective_pronoun(target)\n if target == self\n return \"you\".freeze\n end\n if can_see?(target)\n return target.personal_objective_pronoun\n else\n return target.indefinite_personal_objective_pronoun\n end\n end", "def opponent\n\t\thomeaway=='H' ? self.contest.awaycontestant : self.contest.homecontestant\n\tend", "def computer_index\n if turn_count == 0\n return CORNERS.sample\n elsif turn_count == 2\n return CORNERS.sample\n elsif turn_count == 4\n empty = nil\n WIN_COMBINATIONS.each do |combo|\n if @board[combo[0]] == \"X\" && @board[combo[1]] == \"X\" && (@board[combo[2]] == \" \" || @board[combo[2]] == \"\")\n empty = combo[2]\n return combo[2]\n elsif @board[combo[1]] == \"X\" && @board[combo[2]] == \"X\" && (@board[combo[0]] == \" \" || @board[combo[0]] == \"\")\n empty = combo[0]\n return combo[0]\n elsif @board[combo[0]] == \"X\" && @board[combo[2]] == \"X\" && (@board[combo[1]] == \" \" || @board[combo[1]] == \"\")\n empty = combo[1]\n return combo[1]\n elsif @board[combo[0]] == \"O\" && @board[combo[1]] == \"O\" && (@board[combo[2]] == \" \" || @board[combo[2]] == \"\")\n empty = combo[2]\n return combo[2]\n elsif @board[combo[1]] == \"O\" && @board[combo[2]] == \"O\" && (@board[combo[0]] == \" \" || @board[combo[0]] == \"\")\n empty = combo[0]\n return combo[0]\n elsif @board[combo[0]] == \"O\" && @board[combo[2]] == \"O\" && (@board[combo[1]] == \" \" || @board[combo[1]] == \"\")\n empty = combo[1]\n return combo[1]\n end\n end\n return CORNERS.sample if !empty\n elsif turn_count == 6\n empty = nil\n WIN_COMBINATIONS.each do |combo|\n if @board[combo[0]] == \"X\" && @board[combo[1]] == \"X\" && (@board[combo[2]] == \" \" || @board[combo[2]] == \"\")\n empty = combo[2]\n return combo[2]\n elsif @board[combo[1]] == \"X\" && @board[combo[2]] == \"X\" && (@board[combo[0]] == \" \" || @board[combo[0]] == \"\")\n empty = combo[0]\n return combo[0]\n elsif @board[combo[0]] == \"X\" && @board[combo[2]] == \"X\" && (@board[combo[1]] == \" \" || @board[combo[1]] == \"\")\n empty = combo[1]\n return combo[1]\n end\n end\n WIN_COMBINATIONS.each do |combo|\n if @board[combo[0]] == \"O\" && @board[combo[1]] == \"O\" && (@board[combo[2]] == \" \" || @board[combo[2]] == \"\")\n empty = combo[2]\n return combo[2]\n elsif @board[combo[1]] == \"O\" && @board[combo[2]] == \"O\" && (@board[combo[0]] == \" \" || @board[combo[0]] == \"\")\n empty = combo[0]\n return combo[0]\n elsif @board[combo[0]] == \"O\" && @board[combo[2]] == \"O\" && (@board[combo[1]] == \" \" || @board[combo[1]] == \"\")\n empty = combo[1]\n return combo[1]\n end\n end\n return CORNERS.sample if !empty\n else\n @board.each do |space|\n if space == \" \" || space == \"\"\n return @board.index(space)\n end\n end\n end\n end", "def denied_client_code(crosswalk_record)\n rcc_log.debug \"Obtaining Denied CLIENT CODE for zero payment.\"\n if crosswalk_record && crosswalk_record.crosswalk_record_id.present?\n crosswalk_record = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if crosswalk_record.present?\n client_code_association_records = crosswalk_record.reason_codes_clients_facilities_set_names_client_codes.\n select{|rcfsc| rcfsc.category == 'DENIED'}\n client_code_record = client_code_association_records.first.client_code if client_code_association_records.present?\n if client_code_record.present?\n denied_client_code = client_code_record.adjustment_code\n rcc_log.debug \"Denied CLIENT CODE : #{denied_client_code}, having ID : #{client_code_record.id}\"\n end\n end\n end\n denied_client_code.to_s.upcase\n end", "def get_best_side_to_the_bomb\n return false if !check_for_a_bomb\n @captive_unit = nil\n @enemy_unit = nil\n warrior.listen.each do |unit|\n if Captives.include? unit.to_s.to_sym and unit.ticking? #Captive with bomb found\n if warrior.feel(warrior.direction_of(unit)).empty? or warrior.feel(warrior.direction_of(unit)).captive?\n puts \"Captive is accesible to the #{warrior.direction_of(unit)}\"\n return warrior.direction_of(unit)\n elsif warrior.feel(warrior.direction_of(unit)).enemy? or warrior.feel(warrior.direction_of(unit)).stairs?\n @enemy_unit = unit\n Directions.each do |dir|\n return dir if warrior.feel(dir).empty? and !warrior.feel(dir).wall? and\n !warrior.feel(dir).stairs? and dir != warrior.direction_of(@enemy_unit)\n !is_oposite_direction(dir, warrior.direction_of(unit)) \n end\n end\n end \n end\n return false\n end", "def prefered_vendor\n vendors_array = vendors\n\n highest_revenue = 0\n best_vendor = nil\n\n vendors_array.each do |vendor|\n vendor_revenue = vendor.revenue\n if vendor_revenue > highest_revenue\n highest_revenue = vendor_revenue\n best_vendor = vendor\n end\n end\n\n return best_vendor\n end" ]
[ "0.61755145", "0.5874454", "0.5757729", "0.5729524", "0.55956674", "0.55607194", "0.5408324", "0.5389137", "0.5289591", "0.52733123", "0.5269336", "0.5259253", "0.5203752", "0.5182173", "0.5168103", "0.5142838", "0.5141149", "0.5095498", "0.5095276", "0.5091457", "0.5049188", "0.5038432", "0.5017726", "0.49761072", "0.49705896", "0.4967988", "0.49651724", "0.4960799", "0.49605834", "0.49486557", "0.4946732", "0.49401113", "0.49387452", "0.49379063", "0.4934823", "0.4924988", "0.49248618", "0.4919033", "0.49140698", "0.4913751", "0.49094498", "0.4890188", "0.48816413", "0.48732883", "0.48572645", "0.48565212", "0.4847108", "0.48407125", "0.48367012", "0.4827425", "0.48266843", "0.48221472", "0.48058414", "0.48000875", "0.47937962", "0.47902843", "0.47859076", "0.47779953", "0.4767093", "0.47651747", "0.47607267", "0.47568938", "0.47564638", "0.47561374", "0.47558796", "0.4744282", "0.47436023", "0.47399437", "0.47396034", "0.47380748", "0.47377345", "0.47348025", "0.47293293", "0.47281492", "0.47272447", "0.47200102", "0.4719482", "0.47141275", "0.47121027", "0.47099835", "0.4702364", "0.47019324", "0.4695568", "0.46948734", "0.4693155", "0.4689518", "0.46881458", "0.4687462", "0.46861783", "0.46810332", "0.46787587", "0.46768227", "0.46737185", "0.4673682", "0.46723533", "0.46712345", "0.46705052", "0.4668825", "0.46659178", "0.46645397", "0.46642205" ]
0.0
-1
For now power_of_attorney returns the first claimant's power of attorney
def power_of_attorney claimants.first&.power_of_attorney end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power_of_attorney\n claimants.first.power_of_attorney if claimants.first\n end", "def calc_am_pure_power(user, target)\n 2\n end", "def object_of_power; end", "def power\n data.power\n end", "def power\r\n return @access >> 26\r\n end", "def metric_power\n #noinspection RubyYardReturnMatch\n metric_prefixes.map.with_index { |_item, index| (1000**(index + 1)).to_i }\n end", "def power_bonus(att_id)\n\t\t\t@cid = att_id\n\t\t\tpb = Rollem.new\n\t\t\t@att_bonus = pb.rollspread(19,23)\n\t#\t\tputs \" #{@gladiator[@cid]} for slot #{@att_bonus} has an attack bonus of #{@stat[@cid][@att_bonus]} a #{@stat_name[@cid][@att_bonus]} \"\t\n\t\t\tputs \" \"\n\t\tend", "def skill_effect_power(user, skill)\r\n power = skill.power + user.atk * skill.atk_f / 100\r\n if power > 0\r\n power -= self.pdef * skill.pdef_f / 200\r\n power -= self.mdef * skill.mdef_f / 200\r\n power = [power, 0].max\r\n end\r\n return power\r\n end", "def digit_nth_powers(n)\r\n\t# collect all integers which are the sum of the digits to the nth power\r\n\tnth_power_sums = (10..find_max_nth_power(n)).select do |prospect|\r\n\t\tprospect == prospect.to_s.chars.map{|digit| digit.to_i ** n}.inject(:+)\r\n\tend\r\n\r\n\t# return sum of these numbers\r\n\tnth_power_sums.inject(:+)\r\nend", "def metric_power\n metric_prefixes.map.with_index { |_item, index| (1000**(index + 1)).to_i }\nend", "def skill_power(skillname, player, usage)\n p \"==>calc #{player.name} skill power of #{skillname} for #{usage}:\"\n skill = player.query_skill(skillname)\n if (skill == nil)\n #logger.info(\"user #{player[:id]}-#{player.ext[:name]} doesn't have skill '#{skillname}'\")\n return 1\n end\n # p = skill.power(context)\n level = skill.data[:level]\n p \"=>level=#{level} apply_attack=#{player.tmp[:apply_attack]} apply_dodge=#{player.tmp[:apply_dodge]}\"\n \n if (usage == \"attack\" && player.tmp[:apply_attack] != nil)\n level += player.tmp[:apply_attack]\n end\n \n if (usage == \"dodge\" && player.tmp[:apply_dodge] != nil)\n # level += player.tmp[:apply_dodge]\n level = level * ( (100 + player.tmp[:apply_dodge]/10 ).to_f / 100 )\n end \n \n # if (usage == \"parry\" && player.tmp[:apply_defense] != nil)\n # level += player.tmp[:apply_dodge]\n # end \n jingli_bonus = 50 + player.tmp[:jingli]/ (player.tmp[:max_jl]+1) * 50\n if (jingli_bonus > 150)\n jingli_bonus = 150\n end\n \n total_exp = calc_total_exp(player.tmp[:level])\n p \"level=#{level} jingli_bonus=#{jingli_bonus}, total exp #{total_exp}\"\n if( level<1 ) \n return (total_exp/20.0 * (jingli_bonus/10) ).to_i\n end\n\n \n p =level**3/3 \n str = player.tmp[:str]\n dext = player.tmp[:dext]\n # p \"===>#{player.tmp.inspect}\"\n \n p \"==>p=#{p}, level=#{level} str=#{str} dext=#{dext} \"\n if (usage == \"attack\" || usage == \"parry\")\n p = (p + total_exp +1) / 30 * (( str+1)/10)\n else\n p = (p + total_exp +1) / 30 * (( dext+1)/10)\n end\n \n p = p.to_i\n p \"==>skill power=#{p}\"\n \n if p <= 1\n return 1\n else\n return p\n end\n end", "def power(base, power)\n base ** power\nend", "def power(a,p)\n\ti=1\n\tpow=1\n\twhile i<=p do\n\t\tpow = pow*a\n\t\ti +=1\n\tend\n\tputs pow\nend", "def power(num,pow)\n if pow == 0\n num\n else\n total = 1\n count = 0\n while count < pow\n total *= num\n count += 1\n end\n return total\n end\nend", "def power(base, power)\r\n base ** multiply(power, 1)\r\nend", "def self_powers\n series = Enumerator.new do |y|\n s = 1\n\n loop do \n y << s ** s\n s += 1\n end\n end\n \n collect = 0 \n until series.peek > (1000 ** 1000 ) do\n collect += series.next\n end\n\n i = collect.to_s.length - 1\n collect.to_s.slice(i - 9..i) \nend", "def power(curr_value, to_power)\n curr_value**to_power\nend", "def how_high(energy)\n energy * energy\nend", "def pow base, p\n base ** p\n end", "def pow (base_num , pow_num)\n results=1\n pow_num.times do \n results*=base_num\n end \n results\nend", "def power_detection(n, largest_exp = true)\r\n\t\tx, k = n, 1\r\n\r\n\t\tlimit = ilog2(n)\r\n\t\t(2..limit).each_prime do |exp|\r\n\t\t\tbreak if limit < exp\r\n\r\n\t\t\troot, pow = iroot(n, exp, true)\r\n\t\t\tif pow == n\r\n\t\t\t\treturn root, exp unless largest_exp\r\n\r\n\t\t\t\tn = x = root\r\n\t\t\t\tk *= exp\r\n\t\t\t\tlimit = ilog2(n)\r\n\t\t\t\tredo\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\treturn x, k\r\n\tend", "def expotential(num, power)\n result = 1\n loop do\n result = multiply(result, num)\n power -= 1\n break if power == 0\n end\n result\nend", "def power(num, power)\r\n num ** power\r\nend", "def power_to_the(power, num)\n result = multiply(num, num)\n if power >=3\n (power - 2).times { result = result * num }\n end\n result\nend", "def pow(base_num, pow_num)\n result = 1\n pow_num.times do |index|\n result = result * base_num\n end\n\n return result\nend", "def dig_pow(n, p)\n sum = n.digits.reverse.map.with_index { |digit, i| digit ** (p + i) }.sum\n sum % n == 0 ? sum / n : -1\nend", "def self_powers_2\n (1..1000).map {|i| i**i}.reduce(:+) % (10**10)\nend", "def power(n)\n n ** 2\nend", "def power_to_the_n(num, power)\n if power == 0\n 1\n elsif power == 1\n num\n else \n counter = 2\n total = multiply(num, num)\n while counter < power\n total = multiply(total, num)\n counter += 1\n end\n total \n end \nend", "def dig_pow(n, p)\n power_arr = []\n\n digit_arr = n.to_s.chars.map(&:to_i)\n\n digit_arr.each do |digit|\n power_arr << (digit ** p)\n p += 1\n end\n\n\n if power_arr.sum % n == 0\n k = power_arr.sum / n\n else\n -1\n end\nend", "def power(num, power)\n\tnum**power\nend", "def pow(base, exponent) #(3, 4) ==> 3 * 3 * 3 * 3 = \n return 1 if exponent == 0 \n #return base if exponent == 1\n base * pow(base, exponent - 1)\nend", "def exponent1(base, power)\n # if power equals zero , then 1 else (base * method(base,power - 1))\n if power == 0\n return 1\n else\n (base * exponent1(base, power - 1))\n end\nend", "def perfect_power(n)\n\nend", "def pow(n,p)\n ans = 1\n while p!=0 do\n ans = ans*n%BASE if p&1==1\n n=n*n%BASE\n p=p>>1\n end\n ans\n end", "def sum_of_power(p)\n result = []\n powers = 0.upto(10).map {|n| n**p}\n 2.upto(p.get_max_num) do |i|\n num = i.get_base_array(10).map {|n| powers[n]}\n if i == num.inject(0) {|t,n| t + n}\n result << i\n end\n end\n return result\nend", "def powerI(power, base)\n acc = 1\n power.times { acc *= base }\n return acc\nend", "def power(n, exp)\n total = 1\n 1.upto(exp) do |num|\n total = multiply(n, total)\n end\n total\nend", "def pow(base_num, pow_num)\n result = 1\n pow_num.times do |index|#loop trough the code ex: if pow_num is = 3, the loop will trough 3 times.\n result = result * base_num\n end\n return result\nend", "def getMilkPowder\n @milk_powder\n end", "def power(a,b)\n @a=a\n @b=b\n\n return @a**@b\n\nend", "def power(x,n)\n n == 0 ? (return 1) : x*power(x,n-1)\n\nend", "def pow(power)\n return nil if power == 0\n cloned_unit = self.clone\n return cloned_unit if power == 1\n if power > 0\n new_unit = self.clone\n (power - 1).times { new_unit *= cloned_unit }\n elsif power < 0\n new_unit = reciprocalize\n ((power.abs) - 1).times { new_unit /= cloned_unit }\n end\n return new_unit\n end", "def power(nb1, nb2)\n return nb1 ** nb2\nend", "def power_to_the_n(number, power)\n return 1 if power == 0\n result = 1\n while power > 0\n result = multiply(result, number)\n power -= 1\n end\n result\nend", "def pow(a,b)\n power=1\n for i in 1..b\n power=power*a\n end\n return power\nend", "def general_power(n, x)\n multiply(n, 1)**(x)\nend", "def power_of_n(number, power)\n array = [number] * power\n base_number = 1\n array.each do |num|\n base_number = multiply(base_number, num)\n end\n base_number\nend", "def power_of(num, exponent)\n product = multiply(num, num)\n \n (exponent - 2).times { product *= num }\n\n product\nend", "def pow(base_num, pow_num)\n result = 1\n pow_num.times do\n result = result * base_num\n end\n return result\nend", "def how_high\n energy * energy\nend", "def num_to_power(num, power)\n # count = 1\n return 1 if power == 0\n return num if power == 1\n num_multiply = power / 2\n product = 1\n num_multiply.times do\n product *= multiply(num, num)\n end\n if power % 2 == 1\n product *= num\n end\n product\nend", "def raise_to_power_brute(x, y)\n result = x\n\n while y > 1\n result *= x\n y -= 1\n end\n\n result\nend", "def power(x,y)\n x**y\nend", "def power(x,y)\n\treturn x**y\nend", "def power!(p0) end", "def my_pow(x, n)\n return x if n == 1\n return x * x if n == 2\n return x / x if n == -2\n\n if n > 0\n x * my_pow(x, n - 1)\n else\n my_pow(x, n + 1)\n end\nend", "def dig_pow(n, p)\n # your code\n num = n.to_s\n total = 0\n for i in (0..(num.size - 1))\n total += (num[i].to_i) ** (p + i)\n end\n\n\n if total % n == 0\n total / n\n else\n -1\n end\nend", "def dig_pow(n, p)\n # your code\n num = n.to_s\n total = 0\n for i in (0..(num.size - 1))\n total += (num[i].to_i) ** (p + i)\n end\n\n\n if total % n == 0\n total / n\n else\n -1\n end\nend", "def power_fact(m, u)\n (u ** m).to_f / fact(m).to_f\n end", "def rpower(n) end", "def power(a, b)\n return a**b\nend", "def nth_powers(n)\n (1..9).to_a.map {|num| num**n}\nend", "def pow!(power)\n make_dimensionless if power == 0\n return self if power == 1\n if power < 0\n self.reciprocalize!\n power *= -1\n end\n return self if power == 1 #reciprocalized self\n original_dimensions = self.clone\n (power - 1).times { self.multiply!(original_dimensions) }\n get_description\n return self\n end", "def move_power(move)\n @el.expr['attacks'].each do |type, attacks|\n if attacks.include?(move)\n idx = @el.expr['attacks'][type].index(move)\n idx /= 2.0 if type == 'Normal'\n return ((120 * Math.log10((idx + 1).to_f / 2 + 1)) + 1).ceil # 170\n end\n end\n end", "def get_difficulty\n if self.power < 3\n difficulty = 1\n elsif self.power >= 3 && self.power < 6\n difficulty = 2\n else\n difficulty = 3\n end\n end", "def rec_exp_1(base, power)\nend", "def power(bas,exponent)\n i = 1\n resultat = bas\n while i < exponent\n resultat *= bas\n i += 1\n end\n return resultat\nend", "def expo_1(number, power)\n return 1 if power == 0\n return number if power == 1 \n\n number * expo(number, power - 1)\nend", "def power(base, exp)\n return base ** exp\nend", "def power (*base_and_power)\n base_and_power.inject(:**)\nend", "def pow( x, n)\n if (n == 0)\n return (1)\n elsif (n % 2 == 0)\n value = pow(x, n / 2)\n return (value * value)\n else\n value = pow(x, n / 2)\n return (x * value * value)\n end\nend", "def exponent_1(base, power)\n\treturn 1 if power == 0\n\tlesser_power = power - 1\n\tbase_to_the_lesser_power = exponent_1(base, lesser_power)\n\tbase * base_to_the_lesser_power\nend", "def power_of_n(num, exponent)\n num ** exponent\nend", "def powers1(n)\n n.to_s(2).to_i.digits.map.with_index { |c, i| c.to_i * 2**i }.reject(&:zero?)\nend", "def power_level(x, y)\n ((((x + 10) * y ) + $serial_num) * (x + 10)).digits[2] - 5\nend", "def power_level(x, y)\n ((((x + 10) * y ) + $serial_num) * (x + 10)).digits[2] - 5\nend", "def factor_out_powers_of(exponent)\n [1, self]\n end", "def getSpecialValue\n maxBonus\n end", "def dig_pow(n, p)\n sum = n.digits.reverse.each_with_index.sum { |d, index| d**(p + index) }\n (sum % n).zero? ? sum.div(n) : -1\nend", "def pow1pm1(x, y)\n (x <= -1) ? ((1 + x) ** y) - 1 : Math.exp(y * Math.log(1.0 + x)) - 1\n end", "def calculatePower x,y\n\n # For example, to find the power level of the fuel cell at 3,5 in a grid with serial number 8\n # Find the fuel cell's rack ID, which is its X coordinate plus 10.\n # == The rack ID is 3 + 10 = 13.\n rackID = x + 10\n\n # Begin with a power level of the rack ID times the Y coordinate.\n # Increase the power level by the value of the grid serial number (your puzzle input).\n # Set the power level to itself multiplied by the rack ID.\n # == The power level starts at 13 * 5 = 65.\n # == Adding the serial number produces 65 + 8 = 73.\n # == Multiplying by the rack ID produces 73 * 13 = 949.\n powerLevel = (rackID * y + $serialNumber) * rackID\n\n # Keep only the hundreds digit of the power level (so 12345 becomes 3; numbers with no hundreds digit become 0).\n # The hundreds digit of 949 is 9.\n # Subtract 5 from the power level.\n # Subtracting 5 produces 9 - 5 = 4.\n powerLevel = powerLevel.to_s[-3].to_i-5\n\nend", "def boatswain\n return self.swabbie unless self.swabbie.nil?\n highval = 0\n self.axe.each do |flotsam|\n counter = self.filibuster(flotsam)\n highval = ((highval <=> counter) == 1) ? highval : counter\n end\n \".#{highval + 1}\"\n end", "def prediction_power( token )\n e1 = 0.0\n e0 = 0.0\n system_total = get_system_total\n max_token_count = get_max_system_token_count\n e0 = system_total - max_token_count[1]\n \n get_pool_names.each do |pool_name|\n\te1 += ( get_token_total(token) - get_token_counts(token, pool_name) )\n end\n return [e1,e0,1-(e1/e0)]\n end", "def #power(a,b)\n\ta ** b\nend", "def highest_attack_power_weapon\n weapon = self.weapons.sort_by do |weapon|\n weapon.attack_power\n end.last\n weapon\n end", "def dig_pow(n, p)\n sum = 0\n n.to_s.split('').map(&:to_i).each do |digit|\n sum += digit**p\n p += 1\n end\n (sum % n).zero? ? sum.to_f / n : -1\nend", "def power(n, e)\n if e == 0\n return 1\n elsif e == 1 \n return n\n else\n multiply(n, n**(e - 1))\n end\nend", "def power_of_n(n, power)\n result = 1\n power.times {result = multiply(n, result)} # similar to recursion\n result\nend", "def desired_xp\n return (200 * level * (level + 1)).to_i\n end", "def pow(x, n)\n if n == 0\n return 1\n elsif n % 2 == 0\n return pow(x, n/2) * pow(x, n/2)\n else\n return x*pow(x, n-1)\n end\nend", "def power_it(number_1, number_2)\n number_1 ** number_2\nend", "def masterwork_prob_bonus; 0; end", "def power (x,y)\n return x**y \nend", "def probA1(bit, sampleSum, remainingSamples, geneSum, remainingGenes, mutsRemaining, bitsRemaining)\n\n ar = sampleSum.to_f/remainingSamples.to_f\n ac = geneSum.to_f/remainingGenes.to_f\n a = mutsRemaining.to_f/bitsRemaining.to_f\n\n prob = nil\n if a == 1 #avoid division by zero problem in prob calculation\n prob = 1\n else\n prob = (ar*ac)/(a*(((1-ar)*(1-ac)/(1-a))+(ar*ac/a)))\n end\n\n #avoid division by zero problem in d calculation\n if prob == 1 \n prob = 0.999999\n elsif prob == 0\n prob = 0.000001\n end\n\n if bit == 1 \n return prob\n end\n return 1-prob\nend", "def pow(power)\n Dimensions.new(self.to_hash).pow!(power)\n end", "def power(integer, power)\n number_collection = []\n return nil if power < 0\n return 1 if power == 0\n \n power.times do\n number_collection << integer\n end\n \n number_collection.reduce(:*)\nend", "def calculate_proof_of_work\n\t\treturn self.pow_strategy.find( self.previous_block.proof, self.previous_hash )\n\tend", "def probA0(bit)\n\n # not quite zero, to avoid paying infinitely large\n # penalty when calculating score (div by zero)\n if bit == 0\n return 0.999999\n else #bit == 1\n # This value can be used to tweak coverage vs\n # exclusivity of modules\n return 0.000005\n end\nend" ]
[ "0.82922316", "0.6229766", "0.6150345", "0.5959085", "0.59275705", "0.59242177", "0.5920765", "0.5908395", "0.5874283", "0.5845044", "0.58187234", "0.580003", "0.5796094", "0.5777687", "0.5770085", "0.57449734", "0.5740305", "0.5722346", "0.5712445", "0.57023597", "0.5692533", "0.5686492", "0.5680851", "0.5670803", "0.5666962", "0.5653305", "0.5647385", "0.5641728", "0.56389797", "0.56344414", "0.563275", "0.562622", "0.5621889", "0.5618319", "0.5599146", "0.5591709", "0.5586924", "0.5575604", "0.55608577", "0.5558092", "0.55579853", "0.5552843", "0.5548435", "0.5543472", "0.55425423", "0.55341107", "0.55330735", "0.5529427", "0.55265635", "0.55257493", "0.55248255", "0.5520407", "0.5516392", "0.55049366", "0.54962844", "0.549381", "0.549224", "0.54907066", "0.54907066", "0.54892516", "0.54888135", "0.5483096", "0.5470288", "0.54593605", "0.54588526", "0.5458334", "0.54511446", "0.54482657", "0.54426867", "0.54382527", "0.5432949", "0.54301935", "0.54279846", "0.5423988", "0.54229534", "0.54223555", "0.54223555", "0.54204404", "0.5407958", "0.54073304", "0.54012245", "0.5398938", "0.53961736", "0.5391086", "0.53846186", "0.5376879", "0.5376672", "0.53755087", "0.53697", "0.5360847", "0.5360199", "0.53538674", "0.535149", "0.53490883", "0.5343138", "0.5342045", "0.5335081", "0.5332646", "0.53275937" ]
0.787793
1
Only select completed tasks because incomplete tasks will appear elsewhere on case details page. Tasks are sometimes assigned to organizations for tracking, these will appear as duplicates if they have child tasks, so we do not return those organization tasks.
def tasks_for_timeline tasks.where(status: Constants.TASK_STATUSES.completed).order("completed_at DESC") .reject { |t| t.assigned_to.is_a?(Organization) && t.children.pluck(:assigned_to_type).include?(User.name) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def incomplete_tasks\n\t\ttasks.select{ |t| !t.completed? }\n\tend", "def completed_tasks\n self.tasks.where('is_completed =?', is_completed = true)\n end", "def complete_tasks\n # Give me all the tasks such that the task is complete\n # results = @tasks.select { |task| task.complete? }\n # results.sort_by { |task| task.completed_at }\n #\n # We can combine this into a single line\n \n @tasks.select { |task| task.complete? }.sort_by { |task| task.completed_at }\n end", "def complete_tasks\n sublist { |task| task.complete? }.sort_by { |task| task.completed_at }\n end", "def incomplete_tasks\n # Give me all the tasks such that the task is incomplete\n @tasks.select { |task| task.incomplete? }.sort_by { |task| task.created_at }\n end", "def incomplete_tasks\n sublist { |task| task.incomplete? }.sort_by { |task| task.created_at }\n end", "def active_tasks(tasks)\n tasks.select { |task| task.completed_at.nil? }\n end", "def get_incomplete\n @task_list.select { |task| task.status == \"incomplete\" }\n end", "def in_progress_tasks\n Task.joins('inner join task_statuses on tasks.task_status_id = task_statuses.id').where('tasks.person_id' => id, 'task_statuses.finish' => false).order('created_at DESC')\n end", "def final_completed_tasks\n self.tasks.order(\"created_at DESC\").group_by {|t| t.id }.map { |k, v| v.first }\n end", "def set_complete_incomplete\n @tasks_incomplete = @tasks.where(\"completed = 'f'\").order('tasks.created_at DESC')\n @tasks_complete = @tasks.where(\"completed = 't'\").order('tasks.created_at DESC')\n end", "def all_subtasks_completed?(task)\n raw_subtasks = raw_subtasks(task)\n active_subtasks = @projects.active_tasks(raw_subtasks)\n # anything left should be a section\n active_subtasks.all? { |subtask| subtask_section?(subtask) }\n end", "def update_task_if_children_tasks_are_completed\n if type == EducationDocumentSearchTask.name && children.last.completed?\n update!(status: Constants.TASK_STATUSES.completed)\n else\n update!(status: Constants.TASK_STATUSES.assigned)\n end\n end", "def client_tasks_overdue\n self.find_all {|e| (e.completed.nil? or !e.completed) and e.complete_by < Time.zone.now }\n end", "def related_tasks\n Task.where('(agent_id = ? OR user_id = ?) OR (department_id = ? AND for_department = ?)',self.id, self.id, self.department_id, true)\n end", "def all_complete\n self.tasks.count == self.tasks.done.count\n end", "def get_finished\n @task_list.select { |task| task.status == \"finished\" }\n end", "def active_tasks\n @tasks.select { | task | task.active }\n end", "def next_tasks\n\t\tincomplete_tasks.select{ |t| !t.blocked? }\n\tend", "def inactive_tasks\n @tasks.select { | task | ! task.active }\n end", "def actionable_tasks\n\t\tnext_tasks.select{ |t| !t.deferred? }\n\tend", "def assigned_tasks_include_departments\n Task.where('(agent_id = ?) OR (department_id = ? AND for_department = ?)',self.id, self.department.id, true)\n end", "def tasks_uncompleted\n tasks_uncompleted = assigned_tasks.uncompleted.order(\"deadline DESC\")\n tasks_uncompleted += executed_tasks.uncompleted.order(\"deadline DESC\")\n tasks_uncompleted.sort_by { |h| h[:deadline] }.reverse!\n end", "def selectIncomplete\n @to_do_items.select {|item| item.done? == 'Item incomplete'}\n end", "def complete\n task_id = params[:id]\n task = @current_user.tasks.find(task_id)\n \n # if uncompleting a task belonging to a project, uncomplete the project as well\n if task.project && task.completed\n task.project.update({completed: false})\n end\n\n if task.update({ completed: !task.completed })\n render json: TaskSerializer.new(task, {include: [:project]}).serializable_hash.to_json\n else\n render status: :unprocessable_entity\n end\n end", "def failed_tasks\n each_task.select do |task|\n task.status == :failed\n end\n end", "def index\n @incomplete_tasks = Task.where(complete: false)\n @complete_tasks = Task.where(complete: true) \n end", "def get_tasks_from_todoist\n return Todoist::Task.uncompleted(PROGRAMMING_PROJECT_ID)\n end", "def selectComplete\n @to_do_items.select {|item| item.done? == 'Item complete'}\n end", "def tasks_by_section_for_my_tasks(project,\n only_uncompleted: true,\n extra_fields: [])\n raw_tasks = projects.tasks_from_project(project,\n only_uncompleted: only_uncompleted,\n extra_fields: extra_fields + ['assignee_section.name'])\n active_tasks = projects.active_tasks(raw_tasks)\n by_my_tasks_section(active_tasks, project.gid)\n end", "def done\n done_ids = @tasks.keys.find_all do |id|\n @tasks[id].done?\n end\n done_tasks = done_ids.inject({}) do |map, id|\n map[id] = @tasks[id]\n map\n end\n done_ids.each do |id|\n @tasks.delete(id)\n end\n return done_tasks\n end", "def find_completed\n self.all(\n :completed_at.not => nil, \n :order => [:title])\n end", "def tasks\n if @tasks.nil?\n @tasks ||= (filtering_by_tags? ? tasks_by_tags : tasks_by_filters)\n @tasks = filter_by_properties(@tasks)\n @tasks = sort_tasks(@tasks)\n end\n\n return @tasks\n end", "def tasks_from_project(project,\n only_uncompleted: true,\n extra_fields: [])\n options = task_options\n options[:completed_since] = '9999-12-01' if only_uncompleted\n options[:project] = project.gid\n options[:options][:fields] += extra_fields\n client.tasks.find_all(**options)\n end", "def show_completed_items\n return @to_do_item.select { |x| x.is_done? == true }\n end", "def complete_task(list_id, task_id, is_completed)\n path = \"lists/#{list_id}/tasks/#{task_id}\"\n if is_completed\n completed = 1\n else\n completed = 0\n end\n params = {task: {is_completed: completed}}\n request(path, params, :put)\n\n # output full list again\n show_list(list_id)\n end", "def done_task(events)\n\tids = []\n\ttask = []\n\tevents.each do |e|\n\t\tif e.to_h[:event_type] == 'ActivityTaskCompleted'\n\t\t\tids << e.to_h[:attributes][:scheduled_event_id]\n\t\telsif e.to_h[:event_type] == 'ActivityTaskScheduled' && ids.include?(e.to_h[:event_id])\n\t\t\ttask << e.to_h[:attributes][:activity_type].name\n\t\tend\n\tend\n\treturn task\nend", "def client_tasks_open\n self.find_all {|e| e.completed.nil? or !e.completed }\n end", "def completed_weekly_tasks\n self.weekly_tasks.where(\n :is_weekly_attendance_marking_done => true ,\n :is_weekly_payment_collection_finalized => true, \n :is_weekly_payment_approved_by_cashier => true \n )\n end", "def tasks\n if @tasks.nil?\n @tasks = tasks_by_filters\n @tasks = filter_by_tags(@tasks)\n @tasks += unread_tasks if session[:show_all_unread].to_i > 0\n @tasks = sort_tasks(@tasks)\n end\n\n return @tasks\n end", "def complete\n task = Task.find(params[:id])\n task.completed = false\n unless task.save\n flash[:error] = \"Unable to mark task as completed\"\n end\n @tasks = Task.open_tasks\n render :partial => \"task_list\", :layout => false\n end", "def filter_by_tags(tasks)\n return tasks if !filtering_by_tags?\n\n res = []\n tasks.each do |task|\n selected_tags.each do |tag|\n res << task if task.has_tag?(tag)\n end\n end\n \n return res.uniq\n end", "def get_sorted_list_of_tasks\r\n tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => false, :active_task => true})\r\n unstarted_tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => false, :started_at => nil}).sort_by {|t| t.created_at}\r\n finished_tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => true}).sort_by {|t| t.created_at}\r\n\r\n tasks.concat(unstarted_tasks).concat(finished_tasks)\r\n return tasks\r\n end", "def tasks_for_definition(task_def)\n tasks.where(task_definition_id: task_def.id)\n end", "def capable_tasks() @capable_tasks ||= Task.children; end", "def index\n @tasks = current_user.tasks.order(sort_column + ' ' + sort_direction).where(completed: nil) \n\n @tasks_completed = current_user.tasks.order(sort_column + ' ' + sort_direction).where(completed: true)\n end", "def show_not_done\n task = Task.where(done: false).all\nend", "def non_completed_task_ids\n\n # Define a range over the first task to the last task\n first_task = lesson.tasks.first.id\n last_task = lesson.tasks.last.id\n lesson_task_ids = (first_task..last_task).to_a\n\n # Non completed tasks are the difference between all task id's and the completed tasks\n return lesson_task_ids - completed_task_ids\n end", "def successful_tasks\n @successful_tasks ||= @tasks_results.select(&:success?)\n end", "def failed_tasks\n @failed_tasks ||= @tasks_results.select(&:failure?)\n end", "def pending_tasks?\n hash = pending_tasks\n return nil unless hash.key? \"tasks\"\n hash[\"tasks\"].length > 0\n end", "def tasks\n\t\t@tasks ||= if self.id.nil?\n\t\t\t[]\n\t\telse\n\t\t\tt_arr = document.tasks.select(container_id: self.id)\n\t\t\ti = 0\n\t\t\twhile i < t_arr.size\n\t\t\t\ttask = t_arr[i]\n\t\t\t\tif task.has_subtasks?\n\t\t\t\t\tt_arr += t_arr.delete_at(i).tasks\n\t\t\t\telse\n\t\t\t\t\ti += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\tt_arr\n\t\tend\n\tend", "def get_completed_todos\n return Todo.where({\"user_id\" => self.id, \"completed\" => true})\n end", "def tasks_remain?\n\t\ttasks.any?{ |t| t.completed.nil? }\n\tend", "def show_not_completed_items\n return @to_do_item.select { |x| x.is_done? == false }\n end", "def tasks_complete(list)\n completed = list[:todos].select do |item|\n item[:completed] == true\n end.size\n end", "def own_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_creator, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end", "def sort_all_incomplete\n @due_date_task_list.sort! { |duedatetask1, duedatetask2| duedatetask1.due_date <=> duedatetask2.due_date }\n @combined_list = @due_date_task_list + @task_list\n @combined_list.select { |duedatetask| (duedatetask.status == \"incomplete\") }\n end", "def tasks\n colocated_tasks_grouped = ColocatedTask.where(assigned_by: user).group_by(&:appeal_id)\n on_hold_legacy_tasks = colocated_tasks_grouped.each_with_object([]) do |(_k, value), result|\n # Attorneys can assign multiple admin actions per appeal, we assume a case is still on hold\n # if not all admin actions are completed\n next if value.map(&:status).uniq == [Constants.TASK_STATUSES.completed]\n result << value.each do |record|\n record.placed_on_hold_at = record.assigned_at\n record.status = Constants.TASK_STATUSES.on_hold\n end\n result\n end\n ama_tasks = Task.incomplete_or_recently_completed\n .where(assigned_to: user, type: [AttorneyTask.name, QualityReviewTask.name])\n (on_hold_legacy_tasks + ama_tasks).flatten\n end", "def show_done\n task = Task.where(done: true).all\nend", "def client_tasks_closed\n self.find_all {|e| e.completed }\n end", "def completed_task_id?(task_id)\n completed_task_ids.include? task_id\n end", "def tasks_status(tasks)\n return 'passing' if tasks.all?(&:passing?)\n return 'failing' if tasks.any?(&:failing?)\n return 'errored' if tasks.any?(&:errored?)\n return 'pending' if tasks.any?(&:pending?)\n return 'incomplete' if tasks.any?(&:incomplete?)\n\n 'unstarted'\n end", "def index\n @todolist = Todolist.find(params[:todolist_id])\n @task = @todolist.tasks.find(params[:id])\n\n @tasks = @todolist.tasks.where(completed: false).order('created_at ASC')\n @completed_tasks = @todolist.tasks.where(completed: true).order('updated_at')\n end", "def incorrect_tasks_type_2_ids\n order_tasks_ids = order.tasks.without_expenses.without_resolver.pluck(:external_id)\n children_tasks_ids = order.sub_orders.includes(:tasks).flat_map do |sub_order|\n sub_order.tasks\n .select { |t| !t.expenses? && !t.resolver.present? }\n .map(&:external_id)\n end\n order_tasks_ids + children_tasks_ids\n end", "def active_tasks\n output = []\n @@task_types.each do |association_symbol|\n output = output + self.send(association_symbol).active\n end\n output\n end", "def filter_tasks(cards)\n cards = Array(cards) unless cards.respond_to?(:count)\n return cards.select { |card| Task.first(:name => card.name).nil? } #TODO: move this to method with descriptive name\n end", "def incorrect_tasks_type_1_ids\n order_tasks_ids = order.tasks.with_expenses.with_resolver.pluck(:external_id)\n children_tasks_ids = order.sub_orders.includes(:tasks).flat_map do |sub_order|\n sub_order.tasks\n .select { |t| t.expenses? && t.resolver.present? }\n .map(&:external_id)\n end\n order_tasks_ids + children_tasks_ids\n end", "def all_tasks_to_run\n self.all_tasks - all_tasks_previously_run - all_tasks_duplicates\n end", "def total_complete\n tasks.select { |task| task.complete? }.count\n end", "def print_tasks completed, tasks, colors\n\t\t\t\tpriority = {\n\t\t\t\t\t0 => \"**\",\n\t\t\t\t\t1 => \"*\",\n\t\t\t\t\t2 => \"\"\n\t\t\t\t}\n\t\t\t\ttasks.each do |task|\n\t\t\t\t\tnext if task[:Completed] == completed\n\t\t\t\t\tprintf \"%2s\".colorize(colors[:magenta]), priority[task[:Priority]]\n\t\t\t\t\tprintf \"%3d. \".to_s.colorize(colors[:yellow]), task[:Task_number]\n\t\t\t\t\tsplit_v = split task[:Name], Config[:width]-7\n\t\t\t\t\tputs split_v[0]\n\t\t\t\t\tsplit_v.shift\n\t\t\t\t\tsplit_v.each do |line|\n\t\t\t\t\t\tprintf \" %s\\n\", \" \" + line\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend", "def fetch_tasks\n tasks = BgTask.all\n tasks = load_tasks if tasks.nil? || tasks.empty?\n tasks\n end", "def getSubtasks\r\n\t\t\t\t\treturn @tasks\r\n\t\t\t\tend", "def get_available_tasks\n tasks_to_return = []\n @tasks_names.each{ |t_name|\n tasks_to_return.push(@tasks[t_name])\n } \n return tasks_to_return\n end", "def tasks(completed_since: nil, per_page: 20, options: {})\n params = { completed_since: completed_since, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/user_task_lists/#{gid}/tasks\", params: params, options: options)), type: Task, client: client)\n end", "def all_tasks\n @all_tasks ||= []\n end", "def empty?; tasks.empty? end", "def index\n @date = params[:date] ? Time.parse(params[:date]).in_time_zone : Time.zone.now\n @start = @date.beginning_of_day.in_time_zone\n @finish = @date.end_of_day.in_time_zone\n @tense = determine_tense @date\n @day_name = @start == @now.beginning_of_day ? \"Today\" : @start.strftime(\"%a, %b %-d\")\n \n @tasks = case @tense\n when \"past\"\n @member.tasks.where(\"(complete = :false and due_at >= :start and due_at <= :finish) or (complete = :true and completed_at >= :start and completed_at <= :finish)\", \n true: true,\n false: false,\n nil: nil,\n start: @start,\n finish: @finish\n )\n when \"present\", \"future\"\n @member.tasks.where(\"(due_at is :nil and complete = :false) or (complete = :false and due_at is not :nil and due_at >= :start and due_at <= :finish) or (complete = :true and completed_at is not :nil and completed_at >= :start and completed_at <= :finish)\",\n true: true,\n false: false,\n nil: nil,\n start: @start,\n finish: @finish\n )\n end\n \n @incomplete = @member.tasks.where(\"due_at < ?\", @start).incomplete.by_ordinal.order(:due_at).group_by{ |t| p t.due_at.to_date }\n @complete = @tasks.complete.by_completed_at\n end", "def get_completed_by(task)\n task.completed_by.full_name rescue '-'\n end", "def tasks\n @db[:tasks].keys.compact.uniq || []\n end", "def tasks(extra_conditions = nil, limit_tasks = true)\n limit = (limit_tasks ? 500 : nil)\n return user.company.tasks.all(:conditions => conditions(extra_conditions),\n :include => to_include,\n :limit => limit)\n end", "def tasks_completed(user)\n\t\ttime_range = set_time\n\t\tuser.tasks.where(complete: true, updated_at: time_range).count\n\tend", "def task_options\n {\n per_page: 100,\n options: {\n fields: %w[name completed_at start_at start_on due_at due_on tags\n memberships.project.gid memberships.section.name dependencies],\n },\n }\n end", "def pending_tasks(params = {})\n response = client.get \"/_cluster/pending_tasks\", params.merge(action: \"cluster.pending_tasks\", rest_api: \"cluster.pending_tasks\")\n response.body\n end", "def tasks\n @tasks ||= Task.find(self.task_ids)\n end", "def tasks\n @tasks.values.sort_by { |t| t.name }\n end", "def task_names \n\t\t\tHelpers::DATABASE[:Tasks].join(:Task_list, :Tasks__Id => :Task_list__Task_Id).join(\n\t\t\t:Lists, :Lists__Id => :Task_list__List_id).select(:Tasks__Id, :Tasks__Task_number, \n\t\t\t:Tasks__Name, :Tasks__Completed, :Tasks__Priority).filter(:Lists__Name => Config[:working_list_name])\n\t\tend", "def show # Show tasks method\n all_tasks.map.with_index { |l, i| \"(#{i.next}): #{l}\"} # Show all tasks array in numerical order and whether a task is completed\n end", "def find_completed(conditions = {})\n self.all({\n :completed_at.not => nil, \n :order => [:completed_at.desc]\n }.merge(conditions))\n end", "def finished\n @tasks = @project.tasks.finished(true).paginate(:page => params[:page])\n @allow_reordering = false\n @final = true\n \n respond_to do |format|\n format.html # finished.html.erb\n end\n end", "def tasks_by_filters\n to_include = [ :users, :tags, :sheets, :todos, :dependencies, \n :milestone, :notifications, :watchers, \n :customers ]\n to_include << { :work_logs => :user }\n to_include << { :company => :properties }\n to_include << { :project => :customer }\n to_include << { :task_property_values => { :property_value => :property } }\n to_include << { :dependants => [:users, :tags, :sheets, :todos, \n { :project => :customer }, :milestone ] }\n\n conditions = filter\n conditions += \" AND tasks.project_id in (#{ @select_project_ids })\"\n conditions += \" AND #{ @extra_conditions }\" if !@extra_conditions.blank?\n\n Task.find(:all, \n :conditions => [ conditions ],\n :include => to_include, \n :limit => 250,\n :order => \"tasks.id desc\")\n end", "def index\n if params[:search]\n @search = Task.search { fulltext params[:search] }\n @tasks = Task.where(id: @search.results.map(&:id), completed: params.include?(:completed)).page(params[:page])\n else\n @tasks = Task.eager.where(completed: params.include?(:completed)).order(:due_at).page(params[:page])\n end\n\n Task.eager.mark_as_read! @tasks.to_a, :for => current_user\n end", "def show_due_tasks\n task = Task.where.not(due_date: nil).all\nend", "def get_pending\n Rutodo::Database::Todo.where(done: false).map(&:as_entity)\n end", "def complete!(task_id)\n @tasks[task_id - 1].complete!\n end", "def complete!(task_id)\n @tasks[task_id - 1].complete!\n end", "def tasks\n task_list.tasks\n end", "def complete_children\n if self.category.eql?('todo') and self.completed\n if self.children\n children = self.get_all_children\n children.each do |child|\n if child.completed.blank? or !child.completed\n child.update_attributes(:completed => true, :completed_at => self.completed_at, :zimbra_task_status => true)\n # MatterTask.update_all({:completed => true, :completed_at => self.completed_at}, {:id => child.id})\n end\n end\n end\n end\n end", "def all_tasks\n @task = Task.get_all_tasks_user_can_see(current_user)\n end", "def tasks_all(parameters={ })\n parameters[:conditions]=conditions(parameters[:conditions])\n parameters[:include]= to_include + (parameters[:include]||[])\n return user.company.tasks.all(parameters)\n end" ]
[ "0.75408995", "0.7515006", "0.7407701", "0.7174434", "0.715693", "0.7050861", "0.6972618", "0.69623095", "0.6813828", "0.6795062", "0.6708203", "0.64747894", "0.6360759", "0.63596976", "0.6359295", "0.6345468", "0.63160175", "0.62811273", "0.6279875", "0.627403", "0.6246177", "0.6216348", "0.6144095", "0.61393887", "0.61297506", "0.6129647", "0.6114746", "0.61032265", "0.6101695", "0.60966116", "0.6087255", "0.6047995", "0.6002578", "0.5982836", "0.5969895", "0.5959813", "0.5957484", "0.59562963", "0.59432787", "0.5923655", "0.5893963", "0.5881765", "0.5880353", "0.5880069", "0.5879108", "0.5871291", "0.5852496", "0.5847779", "0.5840482", "0.5829175", "0.5821909", "0.5811599", "0.58107173", "0.5808359", "0.57915515", "0.57913494", "0.5780658", "0.576423", "0.5764179", "0.5716831", "0.5710121", "0.57082224", "0.5699328", "0.56915313", "0.56798166", "0.566155", "0.5648458", "0.56474394", "0.5638654", "0.5637557", "0.5626504", "0.5624645", "0.56239396", "0.5614134", "0.5613889", "0.5611186", "0.56093985", "0.56068236", "0.56044227", "0.5598646", "0.55898315", "0.5588128", "0.5584914", "0.5576303", "0.5570548", "0.5568464", "0.5564669", "0.5564365", "0.55455214", "0.5537862", "0.5537369", "0.55241424", "0.5522744", "0.5522027", "0.55207556", "0.55207556", "0.55167764", "0.55166763", "0.5514434", "0.55134064" ]
0.71969795
3
we always want to show ratings on intake
def can_contest_rating_issues? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n set_rating\n end", "def rating\n review.rating if review\n end", "def num_ratings \n 5\n end", "def rating\n rating_calculator.rate(raters)\n end", "def rating\r\n\t\t@rating\r\n\tend", "def rating\n 0\n end", "def rating\n @rating\n end", "def rating\n # review = Review.where(user_id: user.id, video_id: video.id).first\n #review = Review.find_by(user_id: user.id, video_id: video.id)\n review.rating if review\n end", "def rating #Getter\n @rating\n end", "def set_rating\n food_reviews = self.food_reviews\n if self.has_rating\n totrating = 0\n food_reviews.each do |food_review|\n totrating = totrating + food_review.rating\n end\n avg_rating = totrating.to_f/food_reviews.length\n @food_rating = avg_rating.round(2)\n return\n end\n @food_rating = 0.0\n end", "def show\n @overall = overall_rating\n end", "def show\n @movie = Movie.find(params[:id])\n @current_users_rating ||= @movie.ratings.where(user: current_user).pick(:rating)\n \n if @movie.ratings.any?\n @average_rating = @movie.ratings.average(:rating).round(2) \n @ratings_count = @movie.ratings.count(:rating)\n end\n end", "def show\n @rating = UserRating.where(movie_id: @movie.id).average(:rating)\n if @rating\n @rating = @rating.round(1)\n else\n @rating = 0\n end\n end", "def show\n @reviews = Review.where(tutor_profile_id: @tutor_profile.id).order(\"created_at DESC\")\n if @reviews.blank?\n avg_rating = 0 \n else\n @avg_rating = @reviews.average(:rating).round(2) \n end\n end", "def ratings_query\n super\n end", "def set_rating\n all_ratings = []\n self.reviews.each { |review| all_ratings << review.overall_rating }\n self.rating = all_ratings.reduce(:+) / (all_ratings.length * 1.0)\n self.save\n end", "def rating\n cached_rating\n end", "def ratings\n Birdman::Requester.get(\"movies/#{id}/ratings\")\n end", "def show\n @tv_episode = TvEpisode.find(params[:id])\n @IMDBrating = Rating.rating(\"TvEpisode\",\"tv_episodes\",params[:id],'IMDB').to_a[0]\n @TVDBrating = Rating.rating(\"TvEpisode\",\"tv_episodes\",params[:id],'TVDB').to_a[0]\n\n\n if [email protected]?\n @IMDBrating = @IMDBrating.average[0..2]\n else\n @IMDBrating = \"N/A\"\n end\n\n if [email protected]?\n @TVDBrating = @TVDBrating.average[0..2]\n else\n @TVDBrating = \"N/A\"\n end\n\n @reviews = TvEpisode.reviews(@tv_episode.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tv_episode }\n end\n end", "def update_ratings\n tournament.rater.update_ratings(self)\n end", "def rating\n return nil unless ratings.length > 0\n (ratings.average(:value) / 0.25).round * 0.25\n end", "def show\n @average = Review.where(:omise_id => params[:id]).average(:rating)\n\n if Review.where(:omise_id => params[:id]).count == 0\n @average_show = 0\n elsif Review.where(:omise_id => params[:id]).count == 1\n\n @average_show = @average\n else\n @average_show = @average.round(1)\n end\n\n end", "def index\n @ratings = Rating.all\n end", "def index\n @ratings = Rating.all\n end", "def index\n @ratings = Rating.all\n end", "def show\n movies_search = Movie.search_rating(@movie.name)\n unless(movies_search['total']==0)\n @rating = movies_search['movies'][0]['ratings']['audience_score']\n @poster = movies_search['movies'][0]['posters']['original']\n @movie.poster = @poster\n @movie.save\n end\n end", "def show\n @review = Review.new\n\n if @listing.reviews.blank?\n @avg_rating = 0\n else\n @avg_rating = @listing.reviews.average(:rating).round(2)\n end\n\n end", "def rating\n if average_rating?\n # Integerize it for now -- no fractional average ratings\n (the_ratings = ratings.average(:rating)) ? the_ratings.round : 0.0\n else\n self.old_rating.nil? ? nil : self.old_rating.rating\n end\n end", "def rating\n return @rating\n end", "def rating\n reviews.average(:rating)\n end", "def rating _args\n \"rating _args;\" \n end", "def ratings\n\t\tself.reviews.map{|review| review.rating}\n\tend", "def show\n @reviews = Review.where(videogame_id: @videogame.id).order(\"created_at DESC\")\n \n if @reviews.blank?\n @avg_rating = 0\n else\n @avg_rating = @reviews.average(:rating).round(2)\n end\n end", "def show\n @reviews = @album.reviews.order(\"created_at DESC\")\n unless @reviews.present?\n @avg_review = 0\n else\n @avg_review = @reviews.average(:rating).present? ? @reviews.average(:rating).round(2) : 0\n end\n end", "def rating\n rating_id.get_object.name\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def set_rating\n @rating = Rating.find(params[:id])\n end", "def show\n @rating = Rating.new\n @rating.beer = @beer\n end", "def ratings(number_of_reviews)\n\t\treturn true if number_of_reviews > 0\n\tend", "def ratings_count\n ratings.count\n end", "def indesign_review_stars( article )\n if article.review? && (article.review_rating.to_i > 0)\n text = \"<ParaStyle:Reviews\\\\:Review Rating>\"\n text << (0..article.review_rating.to_i-1).collect{|n| \"r\"}.join\n return text.html_safe\n else\n return \"\"\n end\n end", "def show\n @user = @profile.user.id \n @reviews = Review.where(:profile_id => @profile.id).order(\"created_at DESC\")\n @average_rating = @reviews.average(:rating)\n end", "def rating\n rat = Rating.average(:rating, :conditions => [\"photo_id = ?\", self.id])\n if rat\n rat\n else\n 0\n end\n end", "def show\n @reviews = Review.where(music_id: @music.id).order(\"created_at DESC\")\n\n if @reviews.blank?\n @avg_review = 0\n else\n @avg_review = @reviews.average(:rating).round(2)\n end\n end", "def set_idea_rating\n @idea_rating = IdeaRating.find(params[:id])\n end", "def show\n @review = Review.new\n # @landmark = Landmark.find(params[:id])\n @review.landmark = @landmark\n @star_ratings = StarRating.where(landmark_id: @landmark)\n @star_rating = StarRating.new\n\n if @star_ratings.blank?\n @avg_rating = 0\n else\n @avg_rating = @star_ratings.average(:rating).round(2)\n end\n\n end", "def show\n @dev = User.find(params[:id])\n @ratings = RatingService::get_ratings(@dev)\n end", "def rating\n @ole.Rating\n end", "def show\n\t\t@widget = Widget.find(params[:id])\n\t\t@rate = @widget.ratings.average :rate\n\tend", "def index_ratings\n @rating = Rating.all\n end", "def show\n @myRating= Rating.find_by_wine_id_and_user_id(@wine.id,current_user.id);\n @myRating= Rating.new(user_id: current_user.id) if @myRating.nil?\n \n User.all.each do |i|\n if(! @wine.ratings.any?{|r| r.user_id==i.id})\n curr= Rating.find_by_wine_id_and_user_id(params[:wine_id],current_user.id);\n if(curr.nil?)\n curr= Rating.new()\n curr[:wine_id]= params[@wine.id]\n curr[:user_id]= i.id\n end\n \n @wine.ratings.push(curr)\n end\n end\n \n end", "def rating\n Rating.average(:rating, :conditions => [\"sight_id = ?\", self.id])\n end", "def show\n if @book.reviews.blank?\n # if no reviews set this val to none\n @average_review = 0;\n else\n # round the reviews by half a star approx\n @average_review = @book.reviews.average(:rating).round(2)\n end\n end", "def rating\n if self.rating_sum > 0 && self.rating_count > 0\n (self.rating_sum / self.rating_count).round(2)\n end\n end", "def average_ratings\n ratings = 0\n self.ratings.each {|r| ratings += r.score}\n avg = votes == 0 ? 0 : ratings.to_f/votes.to_f\n \"%.1f\" % avg\n end", "def average_ratings\n ratings = 0\n self.ratings.each {|r| ratings += r.score}\n avg = votes == 0 ? 0 : ratings.to_f/votes.to_f\n \"%.1f\" % avg\n end", "def show\n @reviews = @dog.reviews\n @rating = Review.get_average_rating(@dog)\n end", "def rate(rating)\n @nb_ratings += 1\n @sum_ratings += rating\n @average_rating = @sum_ratings / @nb_ratings\n end", "def show\n goodreads = Goodreads.new.book_by_isbn(@book.isbn)\n @rating = goodreads.average_rating.to_f\n @num_ratings = goodreads.work.ratings_count\n rescue\n @rating = 0.0\n @ratings_count = 0\n end", "def ratings_count\n rating && rating.ratings_count || 0\n end", "def add_rating(rating)\n if @count < TRAINING_SET_SIZE\n add_movie(rating)\n add_user(rating)\n @count += 1\n else\n @test_set << rating\n end\n end", "def rating\n return @rating if @rating\n result = PublicEarth::Db::Collection.one.rating(self.id)\n @rating = { :average_rating => result['average_rating'].to_f, :rating_count => result['rating_count'].to_i } rescue nil\n end", "def show\n @items = Item.order(\"item_price ASC\").where(\"restaurant_id == ? \",params[:id])\n @restaurant = Restaurant.find(params[:id])\n @reviews = Review.find_all_by_restaurant_id(params[:id])\n if customersigned_in?\n @review = current_customer.reviews.build(restaurant_id: params[:id])\n @rating = current_customer.ratings.find_by_restaurant_id(params[:id])\n if @rating.nil?\n @rating = current_customer.ratings.build(restaurant_id: params[:id], user_rating: 0)\n end\n end\n\n end", "def update_rating\n ratings = reviews.pluck(:rating)\n value = ratings.empty? ? 0 : (ratings.reduce(:+).to_f / ratings.size)\n update(rating: value)\n end", "def show\n @article = Article.find(params[:id])\n @rating = Rating.new\n \n #limited to first 5\n @related_articles = @article.find_related_tags.limit(5)\n \n @ratings = @article.ratings\n @quality = quality_avg(@ratings)\n @interest = interest_avg(@ratings)\n @readagain = readagain_avg(@ratings)\n @words = get_words(@ratings)\n \n \n \n @title = \"Specialties of the Day\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def review(rating)\n user = User.new\n user.read_creddentials\n user.login\n response = user.review rating\n if response\n puts 'Last food reviewed!'\n else\n puts 'Nothing to review'\n end\n end", "def show\n @project = @design.project_id\n @reviews = Review.where(design_id: @design.id).order(\"created_at DESC\")\n if @reviews.blank?\n @avg_rating = 0\n else\n @avg_rating = @reviews.average(:rating).round(2)\n end\n end", "def avg_rating\n @avg = self.ratings.average(:rating) \n @avg ? @avg : 0\n end", "def count_ratings\n\t\tself.ratings.all.count\n\tend", "def show\n @anecdote = Anecdote.find(params[:id])\n \n @ratings = @anecdote.ratings.reverse_order\n end", "def show\n @comment = Comment.new\n @comment.user = current_user\n @comment.tvshow = @tvshow\n\n if (current_user != nil)\n @rating = Rating.find_by(user_id: current_user.id, tvshow_id: @tvshow.id)\n\n if @rating == nil\n @rating = Rating.new\n @rating.score = 0\n end\n end\n\n\n @total = @tvshow.ratings.length\n @moyenne = 0\n @pourcentage = 0\n\n for rate in @tvshow.ratings\n @moyenne += rate.score\n end\n\n if @total > 0\n @moyenne = @moyenne/@total\n @pourcentage = @moyenne / 5.0 * 100.0\n else\n @moyenne = 0\n @pourcentage = 0\n end\n\n end", "def show\n @reviews = Review.select { |review| review.item_id == @item.id }\n @review = Review.new(item_id: @item.id)\n @ratingSum = 0.0\n @reviews.each do |review|\n @ratingSum = @ratingSum + review.rating\n end\n @avgRating = (@ratingSum/@reviews.count).round(1)\n if logged_in?\n @isPrevRented = Rental.find_by(user_id: current_user.id, history: true, item_id: params[:id])\n @isPrevReviewed = Review.find_by(user_id: current_user, item_id: params[:id])\n end\n @rentals = Rental.where(item_id: params[:id], history: true)\n end", "def rating\n average = 0.0\n ratings.each { |r|\n average = average + r.rating\n }\n if ratings.size != 0\n average = average / ratings.size\n end\n average\n end", "def rating\n r = Rating.create_from_database(rating_id.to_i)\n r.rating\n end", "def check_rating\n if self.rating == nil \n self.rating = 0\n end \n end", "def show\n @fooddrinks = Fooddrink.all\n Fooddrink.update_avg_qty(@fooddrink)\n @recommends = Fooddrink.where(user_id: @fooddrink.user_id).where.not(id: @fooddrink.id).order(created_at: :desc)\n end", "def listing_ratings\n review_ids = Review.where(listing_id: listings.select(:id).collect(&:id)).select(&:id).collect(&:id)\n ReviewRating.where(review_id: review_ids)\n end", "def set_rating\n @rating = Rating.find_by_name(params[:id])\n end", "def show\n if @game.reviews.blank?\n @average_review = 0\n else\n @average_review = @game.reviews.average(:rating).round(2)\n end\n end", "def swagger \n critiq_rating + like_rating\n end", "def show\n if current_launcher\n @comment = @coin_ico.comments.build(launcher_id:current_launcher.id) \n @rating = Rating.where(coin_ico_id: @coin_ico.id, launcher_id: @current_launcher.id).first\n unless @rating\n @rating = Rating.create(coin_ico_id: @coin_ico.id, launcher_id: @current_launcher.id, score: 0)\n end\n puts \"-------#{@rating.errors.inspect}-----------\"\n end\n end", "def rated_by?( user )\n\t\t\t\t\tratings.detect {|r| r.user_id == user.id }\n\t\t\t\tend", "def getUserStarRating(u, e)\n return (getUserRating(u, e) != \"None\") ? reviewRating(getUserRating(u, e)) : \"None\".html_safe\n end", "def index\n @reviews_and_ratings = ReviewsAndRating.all\n end", "def show\n @rating1 = @question.answers.where(count: 1).count\n @rating2 = @question.answers.where(count: 2).count\n @rating3 = @question.answers.where(count: 3).count\n @rating4 = @question.answers.where(count: 4).count\n @rating5 = @question.answers.where(count: 5).count\n\n end", "def num_ratings\n ratings.count\nend", "def show\n # Update the view counter if the viewer has a unique session hash\n impressionist(@post, nil, { unique: [:session_hash] })\n\n # Checks if the current trader is allowed to buy the item in this post\n if current_trader\n @in_buy_cat = ApprovedBuyCat.where(trader_id: current_trader.id).where(status: \"1\").exists?(:buy_cat_id => @post.subcategory_id)\n end\n @bid = Bid.new(post_id: @post.id)\n\n # Get the rating for the post\n ratings = Trade.includes(:post).where(posts: { trader_id: @post.trader_id } ).collect{|m| m.rating.to_i}.compact\n length = ratings.collect{|m| if m != 0\n m\n end}.compact.length\n\n @rating = ratings.sum.to_f / (length == 0? 1 : length)\n if @rating == nil\n @rating = 0\n end\n\n end", "def show\n # @todo comment this out and replace with proper user 'deleted' flag\n if User.where(id: @book.user_id.to_s.to_i).exists?(conditions = :none)\n @book_user = User.find(@book.user_id)\n else\n @book_user = User.find_by(username: 'removedUser')\n end\n @rating = Rate.where(rateable_id: @book.id)\n unless @rating.empty?\n @sum = 0\n @rating.each do |rate|\n @sum += rate.stars_num\n end\n @final_rating = @sum / @rating.length\n @remaining_stars = 5 - @final_rating\n end\n end" ]
[ "0.73354393", "0.7094088", "0.7022072", "0.692056", "0.68658984", "0.68464655", "0.6789711", "0.6786944", "0.6776948", "0.6765893", "0.6749371", "0.67395765", "0.67303157", "0.6727587", "0.67110884", "0.65848255", "0.6529498", "0.6514811", "0.650233", "0.6497202", "0.64861625", "0.64584297", "0.6436996", "0.6436996", "0.6436996", "0.64307654", "0.64082384", "0.6405509", "0.64052975", "0.6398078", "0.63929635", "0.6383364", "0.6383346", "0.637532", "0.6363683", "0.63631016", "0.63631016", "0.63631016", "0.63593787", "0.6348468", "0.6345977", "0.6345977", "0.6345977", "0.6345977", "0.6345977", "0.6345977", "0.6345977", "0.6345977", "0.6345977", "0.6345977", "0.63449097", "0.6333063", "0.6326463", "0.6323087", "0.63128996", "0.63069737", "0.6296142", "0.6292027", "0.6290019", "0.6289857", "0.6287421", "0.6280718", "0.6279254", "0.6274921", "0.6274902", "0.62673634", "0.6267109", "0.6256888", "0.6256888", "0.6237485", "0.6235111", "0.6233914", "0.6232784", "0.62186426", "0.6217255", "0.6216211", "0.62146044", "0.6206911", "0.6205187", "0.62043065", "0.6198096", "0.6192576", "0.61753786", "0.61633587", "0.61571723", "0.61551595", "0.61500907", "0.61493534", "0.61466545", "0.6142685", "0.6135146", "0.6131048", "0.61229175", "0.612291", "0.6119458", "0.61136585", "0.6109347", "0.61092407", "0.60983783", "0.60980374", "0.6097864" ]
0.0
-1
clean up string so it can be a sql identifier
def s(string) string.to_s.gsub('[].:', '') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_2_id( a_string ) \n return a_string.gsub(\"[\",\"_\").gsub(\"]\",\"\");\n end", "def clean_identifier(str)\n str = str.to_s.gsub(%r{[[:blank:]]+}, \"\")\n str =~ %r{@} ? \"<#{str.gsub(%r{(<|>)}, \"\")}>\" : str.upcase\n end", "def normalizeField(string)\n string.gsub /_id|_/, \" \"\n end", "def make_sql_friendly( name )\n return name.strip.gsub( \"'\", \"''\" )\n end", "def sanitize_for_id(unsanitized_string)\n unsanitized_string.gsub(\" \", \"_\").downcase\n end", "def sanitize_sql_name(*name)\n name.join('_').presence&.gsub(/\\d/) { |d| DIGIT_TO_ALPHA[d] || '_' }\n end", "def db_sanitize_name(name)\n (i = name.index(';')) and name = name[0...i]\n name.scan(/[\\w\\s]+/).join\nend", "def with_quoted_identifiers(s)\n s.gsub(/\"(\\w+)\"/) { |m|\n if ActiveRecord::Base.configurations[:test]['adapter'] =~ /oracle/i\n m.upcase\n else\n m\n end\n }\n end", "def _format_sql(sql)\n sql = sql.delete '\"'\n sql.downcase\n end", "def convert_sql(sql, definition)\n sql.gsub(/\\b\\d+\\b/, ':int').gsub(/`([^`]+)`/, '\\1').gsub(/'[^']*'/, ':string').rstrip\n end", "def scout_sanitize_sql(sql)\n return nil if sql.length > 1000 # safeguard - don't sanitize large SQL statements\n sql = sql.dup\n sql.gsub!(/\\\\\"/, '') # removing escaping double quotes\n sql.gsub!(/\\\\'/, '') # removing escaping single quotes\n sql.gsub!(/'(?:[^']|'')*'/, '?') # removing strings (single quote)\n sql.gsub!(/\"(?:[^\"]|\"\")*\"/, '?') # removing strings (double quote)\n sql.gsub!(/\\b\\d+\\b/, '?') # removing integers\n sql.gsub!(/\\?(,\\?)+/,'?') # replace multiple ? w/a single ?\n sql\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def id_safe(text)\n\t\ttext.gsub(/[ .?!]/, ' ' => '-', '.' => '', '?' => '', '!' => '').gsub(/-{2,}/, '-').downcase.to_s\n\tend", "def normalize_object_id_strings(str, options)\n str = str.gsub(/#<(.*?):0x[a-f\\d]+/, '#<\\1:placeholder_id') unless options[:skip_standard]\n str = str.gsub(/BSON::ObjectId\\('[a-f\\d]{24}'\\)/, 'placeholder_bson_id') unless options[:skip_bson]\n str\nend", "def normalize_object_id_strings(str, options)\n str = str.gsub(/#<(.*?):0x[a-f\\d]+/, '#<\\1:placeholder_id') unless options[:skip_standard]\n str = str.gsub(/BSON::ObjectId\\('[a-f\\d]{24}'\\)/, 'placeholder_bson_id') unless options[:skip_bson]\n str\nend", "def gen_inst_id_str(inst_str)\n return inst_str.gsub(/[\\.:\\[\\]]/,'_').upcase\nend", "def remove_identifier_delimiters(keyword)\n keyword.to_s.tr(\"\\]\\[\\\"\", '')\n end", "def unquoted_string(str)\n Sass::Script::String.new(str, :identifier)\n end", "def normalized_cache_key(sql)\n \"influxer:#{sql.gsub(/\\s*/, '')}\"\n end", "def clean_id(id)\n if id != nil\n id.gsub!(/-|\\s|\\t/,'')\n id.downcase!\n end\n return id\n end", "def str2id(s)\n s.id.delete('/hostedzone/')\nend", "def extract_dbid_an(id)\n dbid, an = id.split('__')\n [dbid, an.to_s.tr('_', '.')]\n end", "def query_id\n query.downcase.gsub(\" \", \"-\")\n end", "def id_for_string( table_sym, string )\r\n @db[table_sym][(table_sym.to_s[0..-2].to_sym)=>string][:id]\r\n rescue\r\n @db[table_sym].insert((table_sym.to_s[0..-2].to_sym)=>string)\r\n end", "def prepare_statement_sub(sql)\n sql.gsub(/\\$\\d+/, '?')\n end", "def quote_column_name(str)\n str.to_s\n end", "def sanitize(sql_query)\n sql_query[0..22].downcase.split('').each.select {|w| w =~ /[a-z]|[áéíóúü]/i}.join('') \nend", "def clean_for_search(id)\n id.gsub(/[^\\w\\-]/, '')\n end", "def quote_identifier(v)\n schema_utility_dataset.quote_identifier(v)\n end", "def quote_identifier(v)\n schema_utility_dataset.quote_identifier(v)\n end", "def field_id(str)\n cleaned = if @view.present?\n \"#{clean_str(@view)}-#{clean_str(str)}\"\n else\n clean_str(str)\n end\n cleaned.tr('_', '-')\n end", "def unquote( str )\n str =~ /^\"(.*?)\"$/ ? $1 : str\n end", "def sql_string(value)\n \"'#{value.gsub(\"'\", \"''\")}'\" \nend", "def cleanup_id(url) # :nodoc:\n url.gsub(/(\\-{2,}|[\\W^-_]+)/, '-').gsub(/(\\A\\-|\\-\\Z)/, \"\").strip\n end", "def id_and_name_from(string)\n string =~ /[^0-9a-f]/i ? [nil, string] : [string, nil]\n end", "def mkInternalTraceId(string)\r\n string.gsub(\"_\",\"-\")\r\n end", "def quote_identifier(v)\n schema_utility_dataset.quote_identifier(v)\n end", "def quote_identifier(v)\n schema_utility_dataset.quote_identifier(v)\n end", "def id_str\n @id.nil? ? '' : \"[#{@id.gsub(/(\\[|\\])/){|s|\"\\\\#{s}\"}}]\"\n end", "def table_name_for(str, metadata)\n str = str.to_s.gsub(/::/, '_')\n if metadata.stores_lower_case_identifiers\n str.downcase\n elsif metadata.stores_upper_case_identifiers\n str.upcase\n else\n str\n end\n end", "def tokenize_quoted_identifier(&block) # :yields: SQLTree::Token::Identifier\n variable = ''\n until next_char.nil? || current_char == SQLTree.identifier_quote_char # TODO: allow MySQL quoting mode\n variable << (current_char == \"\\\\\" ? next_char : current_char)\n end\n handle_token(SQLTree::Token::Identifier.new(variable), &block)\n end", "def db_string_regex(type)\n \"--#{type}='?([a-zA-Z0-9!@\\#$%^&*-=+]+)'?\\s\"\nend", "def sanitize_order_string(string)\n s = string.gsub(/\\s*,\\s*/, ',')\n s = s.gsub(/[\\w-]+/) { |m| \"#{self.table_name}.#{m}\" }\n end", "def to_id\n\t\treturn self.\n\t\t\tgsub(\"::\", \"\").\n\t\t\tgsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n\t\t\tgsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n\t\t\tdowncase.\n\t\t\tgsub(\"_\", \"-\")\n\tend", "def sanitize_sql_like(string, escape_character = '\\\\')\n pattern = Regexp.union(escape_character, '%', '_')\n string.gsub(pattern) { |x| [escape_character, x].join }\n end", "def mysql_comment_keywords\n if self =~ /(select)/i\n foo=$1\n newstr = self.gsub(foo, \"/*!#{foo}*/\")\n else\n newstr = self\n end\n if newstr =~ /(update)/i\n foo=$1\n newstr = newstr.gsub!(foo, \"/*!#{foo}*/\")\n end\n if newstr =~ /(insert)/i\n foo=$1\n newstr = newstr.gsub!(foo, \"/*!#{foo}*/\")\n end\n if newstr =~ /(delete)/i\n foo=$1\n newstr = newstr.gsub!(foo, \"/*!#{foo}*/\")\n end\n if newstr =~ /(union)/i\n foo=$1\n newstr = newstr.gsub!(foo, \"/*!#{foo}*/\")\n end\n if newstr =~ /[, ](concat)/i\n foo=$1\n newstr = newstr.gsub!(foo, \"/*!#{foo}*/\")\n end\n if newstr =~ /(group_concat)/i\n foo=$1\n newstr = newstr.gsub!(foo, \"/*!#{foo}*/\")\n end\n if newstr =~ /(information_schema)/i\n foo=$1\n newstr = newstr.gsub!(foo, \"/*!#{foo}*/\")\n end\n if newstr =~ /(cast)/i\n foo=$1\n newstr = newstr.gsub!(foo, \"/*!#{foo}*/\")\n end\n if newstr =~ /(convert)/i\n foo=$1\n newstr = newstr.gsub!(foo, \"/*!#{foo}*/\")\n end\n if newstr =~ /(substring)/i\n foo=$1\n newstr = newstr.gsub!(foo, \"/*!#{foo}*/\")\n end\n if newstr =~ /(sleep)/i\n foo=$1\n newstr = newstr.gsub!(foo, \"/*!#{foo}*/\")\n end\n if newstr =~ /(benchmark)/i\n foo=$1\n newstr = newstr.gsub!(foo, \"/*!#{foo}*/\")\n end\n return newstr\n end", "def sanitize_projection_alias(value)\n value.gsub(/[^0-9a-zA-Z_]/)\n end", "def id\n name && name.gsub(' ', '').downcase\n end", "def header_to_id(given)\n return '' unless given.is_a?(String)\n return '' unless given.match(/\\A[a-z\\d]{16,32}\\z/i)\n given\n end", "def name_cleaner(raw_string)\n return raw_string.gsub(/[^A-Za-z0-9_\\-\\.]/, '_')\n end", "def quote_table_name(str)\n str.to_s\n end", "def identifier_regex\n /^[\\w\\-:]+$/\n end", "def quoted_identifier(name)\n \"\\\"#{name.to_s.upcase}\\\"\"\n end", "def extract_id(str)\n str.to_s.scan(/\\d+/)\n end", "def convert_identifier(identifier)\n case identifier\n when SQL::Identifier\n identifier.value.to_s\n else\n identifier\n end\n end", "def identifier_normalize identifier\n if /[A-Z]/ =~ identifier\n use_identifier = identifier.downcase\n else\n use_identifier = identifier\n end\n use_identifier\n end", "def prepared_query(str)\n str.gsub(/\\,/, ' ')\n end", "def prepared_query(str)\n str.gsub(/\\,/, ' ')\n end", "def unquote(part)\n return part if part.blank?\n\n part.start_with?('\"') ? part[1..-2] : part\n end", "def sanitize_row(record)\n cleaned_record = {}\n record.each_pair do |k, v| # this might remove too much info...\n cleaned_record.store(k,\n v.to_s.gsub(/\\//i, '-').gsub(/[^ [:word:]\\-\\. ]/i, ''))\n # first exchanges \\ for - then removes everything not[^ ] :word or - or . or space\n # put sql problem chars here only.gsub(/\\W+/, \"\"))\n end\n cleaned_record\n end", "def double_quote(value)\n return if value.nil?\n\n case value.to_s\n # Ignore keys that contain double quotes or a Arel.star (*)[all columns]\n # or if a table has already been explicitly declared (ex: users.id)\n when \"*\", /((^\".+\"$)|(^[[:alpha:]]+\\.[[:alnum:]]+)|\\(.+\\))/\n value\n else\n PG::Connection.quote_ident(value.to_s)\n end\n end", "def get_id str\n\t\treturn str if is_id? str\n\t\tif is_metadata? str\n\t\t\tif str.include? SEP\n\t\t\t\t# Origin~[meta]\n\t\t\t\torigin, str = str.split(SEP) \n\t\t\tend\n\t\t\t# Split to get address, and rebuild\n\t\t\tkeys = keysplit(str)\n\t\t\treturn build_id origin, keys[\"address\"]\n\n\t\telsif is_metric_id? str\n\t\t\treturn build_id @origin_id, str\n\t\tend\n\tend", "def sanitise(str)\n str.gsub(/[^a-zA-Z0-1]+/, \"_\")[0, 20]\n end", "def sqlized(string)\n string.gsub(/[\\s`]/, '')\n end", "def _prepareName ( name )\n name.to_s.gsub /[\\W]/, ''\n end", "def sanitize_string(value)\n value.sub(/\\A['\"](.*)['\"]\\Z/, '\\1').gsub(/\\\\\"|\"|'/, '\"')\n end", "def quoted_identifier_append(sql, c)\n sql << '`%s`' % c\n end", "def unprepare_sqlserver_statement(sql)\n if sql.starts_with?(SQLSERVER_STATEMENT_PREFIX)\n executesql = sql.from(SQLSERVER_STATEMENT_PREFIX.length)\n args = executesql.split(', ')\n unprepared_sql = args.shift.strip.match(SQLSERVER_NATIONAL_STRING_MATCHER)[1]\n unprepared_sql = Utils.unquote_string(unprepared_sql)\n args = args.from(args.length / 2)\n args.each_with_index do |arg, index|\n value = arg.match(SQLSERVER_PARAM_MATCHER)[1]\n unprepared_sql.sub! \"@#{index}\", value\n end\n unprepared_sql\n else\n sql\n end\n end", "def generate_id(str); end", "def sub_id() @tag.sub( /.*_/, '' ) end", "def sub_id() @tag.sub( /.*_/, '' ) end", "def normalize_friendly_id(string); string.upcase.gsub(\"-\", \".\") end", "def identifier_for identifier\n \"#{name.gsub(/^.*::/,'').downcase}s.#{identifier}\"\n end", "def quote_identifier(name)\n quote_identifiers? ? quoted_identifier(name) : name.to_s\n end", "def i(s)\n connection.quote_column_name(s)\n end", "def name_as_id\n self.name.downcase.gsub(/\\s/, '-')\n end", "def escape_col(name)\n raise \"Possible SQL injection hack: '#{name}'.\" unless name.to_s.match(/\\A[A-z\\d_]+\\Z/)\n return name\n end", "def remove_interpunction!(str)\n str.gsub!(/\\A['\"]+|[!,.\"']+\\Z/, '')\n str\n end", "def make_identifier_suffix( url )\n\t\treturn url.to_s.gsub( /\\W+/, '-' )\n\tend", "def safefield(fieldname)\n fieldname.gsub(/[^a-zA-Z0-9_]/, '') # TODO: Correct pattern for a valid fieldname. Must deny leading numbers.\n end", "def escape_str_field(str)\n str = str.to_s.sub(/\\`/,'')\n @mysql.escape(str)\n end", "def extract_table_ref_from_update_sql(sql)\n sql[/update\\s(\"[A-Za-z0-9_.\"\\[\\]\\s]+\"|[A-Za-z0-9_.\"\\[\\]]+)\\s*set/im]\n Regexp.last_match(1)&.strip\n end", "def unquote_string(value)\n return value unless value.is_a?(String) && !variable_expression?(value)\n\n ((unquoted_match = /'(.*)'/.match(value)) && unquoted_match[1]) || value\n end", "def parse_string_or_id(msg, quoted: nil, final: nil, remove: false)\n name, msg = parse_term(msg, quoted: quoted, remove: true)\n return (remove ? [name, msg] : name) if !name.empty?\n name, msg = parse_term(msg, final: final, remove: true)\n name = name.strip.to_i if is_num(name)\n return (remove ? [name, msg] : name)\nrescue\n remove ? ['', msg] : ''\nend", "def sanitize_fragment_with_id(url)\n url.gsub(%r{^(/?[^/]*/[^/]*/)(?:[^\\?/\\d]*[\\d]+[^\\?/]*)}, ID_PLACEHOLDER)\n end", "def handle_prefixes\n return identifier if identifier.blank?\n identifier.strip!\n identifier.gsub!(DOI_MATCH, '') if identifier\n end", "def sanitized_object_name(object_name)\n object_name.gsub(/\\]\\[|[^-a-zA-Z0-9:.]/, '_').sub(/_$/, '')\n end", "def sanitized_object_name(object_name)\n object_name.gsub(/\\]\\[|[^-a-zA-Z0-9:.]/, '_').sub(/_$/, '')\n end", "def prepare_for_insert(s)\n s.gsub(/'/,\"\\\\\\\\'\").chomp.split(/\\t/).map {|str| \"'#{str}'\"}.join(\", \")\n end", "def set_identifier\n self.identifier = self.name.downcase.gsub(/[^a-zA-Z0-9]+/, '-').chomp('-')\n end", "def as_sql(expression, aliaz)\n \"#{expression} #{quote_identifier(aliaz)}\"\n end", "def row_values(string) \n string.gsub!(/INSERT INTO (.*?) VALUES/, '')\n splitted = string.split(\"),(\")\n splitted.each do |s| \n s.gsub!(\"(\", '') if splitted.first == s\n s.gsub!(\")\", '') if splitted.last == s\n s.gsub!(s, \"(#{s})\")\n end\n splitted\n end", "def normalize_parameter_name(name)\n name.gsub(/[\\&\\*\\$\\[\\]\\:]/, '')\n end", "def sql(string)\n ::Arel::Nodes::SqlLiteral.new(string)\n end", "def clean(string, type)\n char = case type\n when :path then '\\?'\n when :query then '\\A'\n else raise ArgumentError, \"type #{type.inspect} not supported\"\n end\n\n string.sub(/(#{char}|&)_asd=[^&]*(&?)/) { $1 unless $2.empty? }\n end", "def sanitize_name(str)\n str.gsub(' ','_').downcase.gsub(\"&\", \"and\")\n end", "def cleanse(args)\n # Clean sql, need to add code to escape quotes and prevent deletions without conditions\n @sql\n end", "def sanitize_sql_like(text, escape_character = '\\\\')\n text.to_s.gsub(/(^|.)([%_])/) do |s|\n ($1 == escape_character) ? s : [$1, escape_character, $2].compact.join\n end\n end", "def clean_sql\n self.sql=SqlText.clean(sql) if sql.present?\n end", "def is_id? str\n match = [KVP,DELIM]\n return false if match.any? {|w| str.include? w}\n return true\n end" ]
[ "0.69503653", "0.6942258", "0.6762436", "0.664475", "0.6626908", "0.662426", "0.6535243", "0.6520202", "0.64824134", "0.6382899", "0.6310478", "0.63102615", "0.63102615", "0.6255674", "0.62167317", "0.62167317", "0.62117255", "0.620411", "0.6160723", "0.6117888", "0.6085733", "0.6077199", "0.60201776", "0.6016236", "0.5972424", "0.59463614", "0.59291553", "0.5926463", "0.5925393", "0.59181434", "0.59181434", "0.59055275", "0.58997816", "0.58929497", "0.5890059", "0.5874081", "0.5849657", "0.58439916", "0.58439916", "0.5810179", "0.58059496", "0.5798941", "0.57979053", "0.5794422", "0.57942605", "0.5789451", "0.5748611", "0.5748387", "0.5740584", "0.5721757", "0.5718664", "0.5713782", "0.5700632", "0.56831557", "0.5681296", "0.5672827", "0.56674975", "0.5629288", "0.5629288", "0.56196207", "0.5606157", "0.56004465", "0.55955195", "0.5580819", "0.5574593", "0.55597746", "0.55487776", "0.5526268", "0.5520859", "0.5520778", "0.5518939", "0.5518939", "0.55170196", "0.5501323", "0.54958946", "0.549568", "0.54859203", "0.54804075", "0.54664314", "0.54557407", "0.54393935", "0.54357386", "0.54325765", "0.5410705", "0.5402731", "0.5397473", "0.53972185", "0.53950214", "0.53950214", "0.5379928", "0.5379125", "0.53788954", "0.5376911", "0.53750765", "0.5372265", "0.53714925", "0.53709847", "0.5367558", "0.5366989", "0.5363514", "0.5361142" ]
0.0
-1
The version the program is currently in
def version '1.5.1.2' # Version number <major>.<minor>.<patch>.<monthly commit> end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_version\n version_number rev\n end", "def current_version\n @version\n end", "def version\n \"\\e[36mThis program is currently in version number: #{v_num}\\e[0m\"\n end", "def current_version\r\n version = File.read(\"VERSION\").strip\r\n fail \"Invalid version information\" unless version =~ /\\./\r\n version\r\nend", "def ver\n if v = version\n str = +\"#{program_name} #{[v].join('.')}\"\n str << \" (#{v})\" if v = release\n str\n end\n end", "def version\n VERSION\n end", "def version\n @version ||= File.read(path('version.txt')).strip\n end", "def version\n VERSION\n end", "def version\n return last_version if versionable?\n version_number\n end", "def version\n Launcher::Log.info Launcher::VERSION\n end", "def get_version\n\t\tend", "def version\n VERSION\n end", "def version\n VERSION\n end", "def version\n VERSION\n end", "def version\n @version ||= File.read(path('version.txt')).strip\n end", "def version\n cmd(COMMANDS[:version], 2)\n end", "def get_version()\n\t\tend", "def version\n execute_string(\"-version\")\n end", "def version\n output = @filer.invoke(\"system-get-version\")\n if(output.results_errno() != 0)\n r = output.results_reason()\n raise \"Failed : \\n\" + r\n else \n output.child_get_string(\"version\")\n end\n end", "def version\n exec('--version').match(/^Ledger (.*),/)[1]\n end", "def application_version\n read('application_version')\n end", "def version\n puts \"v0.3\"\n end", "def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend", "def version\n @version || 0\n end", "def version\n @version ||= __determine_version\n end", "def version\n @version\n end", "def version\n next_version\n end", "def current_version\n versions.first\n end", "def version_number\n @version\n end", "def version\n version_file = File.join(RAILS_ROOT, \"config\", \"version.ini\")\n current_version = if File.exists? version_file\n File.read(version_file)\n else\n \"0.0.1\"\n end\n current_version.strip\n end", "def version\n @version ||= version_hex.to_s(16).chars.entries.join('.')\n end", "def current_version\n self._version ||= 0\n end", "def version\n p\n version = File.read(HOSTER_PATH+\"/hoster.version\")\n puts PROGNAME + \" version \" + version\nend", "def version\n read_property 'Version'\n end", "def version\n 0\n end", "def version_info\n # thanks to Roger Pack on ruby-forum for how to get to the version\n # file\n filename = File.open(File.dirname(__FILE__) + \"/../../../VERSION\")\n v = nil\n if File.exists?(filename)\n v = File.open(filename).read.chomp if File.exists?(filename)\n #else\n #$stderr.puts \"could not locate file #{filename}. \" \n #puts `pwd`\n end\n v\n end", "def version\n @__version\n end", "def version\n case @version\n when Module\n \"#{@version::Major}.#{@version::Minor}.#{@version::Release}\"\n when Proc # not sure about this\n @version.call\n when NilClass\n 'unknown'\n else\n @version\n end\n end", "def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n build_string\n end", "def version_info\n # thanks to Roger Pack on ruby-forum for how to get to the version\n # file\n filename = File.open(File.dirname(__FILE__) + \"/../../VERSION\")\n v = nil\n if File.exists?(filename)\n v = File.open(filename).read.chomp if File.exists?(filename)\n #else\n #$stderr.puts \"could not locate file #{filename}. \" \n #puts `pwd`\n end\n v\n end", "def version\n self.class.name + ' ' + VERSION\n end", "def version_number\n return @version_number\n end", "def version\n (version_from_class.to_f / 10).to_s\n end", "def version\n @version ||= '1.0'\n end", "def current_version\n find( :first, :order => 'number DESC' )\n end", "def version\n if browser == \"Chrome\"\n chrome.version\n elsif product = detect_product(\"Version\")\n product.version\n else\n BuildVersions[build]\n end\n end", "def version\n VersionInfo.new(command(\"Browser.getVersion\"))\n end", "def major_version; end", "def version\n [@major_version, @minor_version].join('.')\n end", "def version\n path = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__\n dir = File.dirname(path)\n if File.exist?(dir+'/version.stamp')\n version = File.read(dir+'/version.stamp')\n else\n version = \"Unknown version\"\n end\n version\n end", "def version_number\n \"#{self.major}.#{self.minor}\"\n end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version\n @version ||= '1.0'\n end", "def major ; version.major ; end", "def version\n @version ||= config(\"version\", \"0.0.1\")\n end", "def output_version\n puts \"#{File.basename($0)} version #{BM_VERSION}\"\n end", "def version\n name.split('_')[1]\n end", "def version\n @version_helper.to_s\n end", "def version\n @version_helper.to_s\n end", "def get_version\n request('getVersion')\n end", "def version\n @version ||= create_version\n end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end" ]
[ "0.8156844", "0.8008359", "0.7921632", "0.7915961", "0.78845674", "0.78776705", "0.7871148", "0.78511965", "0.7819416", "0.7805027", "0.77695876", "0.7768347", "0.7768347", "0.7768347", "0.77643967", "0.7704105", "0.76999456", "0.76666564", "0.7640471", "0.76345366", "0.76334625", "0.7616819", "0.76087856", "0.76051754", "0.76050895", "0.76043266", "0.7594955", "0.7588783", "0.75667155", "0.75577915", "0.75441575", "0.75270146", "0.75009966", "0.75000286", "0.7479517", "0.7474344", "0.7469243", "0.74649584", "0.7461923", "0.7461923", "0.74607146", "0.74603504", "0.74603504", "0.74603504", "0.74603504", "0.74603504", "0.74603504", "0.74603504", "0.74603504", "0.74603504", "0.7447882", "0.7437469", "0.7419985", "0.74145573", "0.7410144", "0.7404908", "0.7404239", "0.73974437", "0.73895276", "0.738861", "0.73778325", "0.73658216", "0.7365193", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.7362034", "0.73618364", "0.734514", "0.7331026", "0.73245746", "0.73209894", "0.7314784", "0.7314784", "0.7313206", "0.7312742", "0.730931", "0.730931", "0.730931", "0.730931", "0.730931" ]
0.73705095
61
Constructs a new instance of a database connection with the specified options hash. Accepts the following options: :default_string_column_size :: The default size of string columns, 255 by default. :identifier_mangling :: Whether to support nondefault identifier mangling for the current database. :logger :: A specific logger to use. :loggers :: An array of loggers to use. :name :: A name to use for the Database object. :preconnect :: Whether to automatically connect to the maximum number of servers. :quote_identifiers :: Whether to quote identifiers. :servers :: A hash specifying a server/shard specific options, keyed by shard symbol . :single_threaded :: Whether to use a singlethreaded connection pool. :sql_log_level :: Method to use to log SQL to a logger, :info by default. All options given are also passed to the connection pool.
def initialize(opts = OPTS) @opts ||= opts @opts = connection_pool_default_options.merge(@opts) @loggers = Array(@opts[:logger]) + Array(@opts[:loggers]) @opts[:servers] = {} if @opts[:servers].is_a?(String) @sharded = !!@opts[:servers] @opts[:adapter_class] = self.class @opts[:single_threaded] = @single_threaded = typecast_value_boolean(@opts.fetch(:single_threaded, Sequel.single_threaded)) @default_string_column_size = @opts[:default_string_column_size] || DEFAULT_STRING_COLUMN_SIZE @schemas = {} @prepared_statements = {} @transactions = {} @symbol_literal_cache = {} @timezone = nil @dataset_class = dataset_class_default @cache_schema = typecast_value_boolean(@opts.fetch(:cache_schema, true)) @dataset_modules = [] @loaded_extensions = [] @schema_type_classes = SCHEMA_TYPE_CLASSES.dup self.sql_log_level = @opts[:sql_log_level] ? @opts[:sql_log_level].to_sym : :info self.log_warn_duration = @opts[:log_warn_duration] self.log_connection_info = typecast_value_boolean(@opts[:log_connection_info]) @pool = ConnectionPool.get_pool(self, @opts) reset_default_dataset adapter_initialize if typecast_value_boolean(@opts.fetch(:identifier_mangling, true)) # SEQUEL5: Remove extension(:_deprecated_identifier_mangling) end unless typecast_value_boolean(@opts[:keep_reference]) == false Sequel.synchronize{::Sequel::DATABASES.push(self)} end Sequel::Database.run_after_initialize(self) if typecast_value_boolean(@opts[:preconnect]) && @pool.respond_to?(:preconnect, true) concurrent = typecast_value_string(@opts[:preconnect]) == "concurrently" @pool.send(:preconnect, concurrent) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize options\n host = options['host'] || 'localhost'\n port = options['port'] || 5432\n database = options['database']\n username = options['username']\n\n # always reuse an existing connection if it matches on these connection options\n conn_options = {:host => host, :port => port, :database => database, :username => username}\n existing_connection = self.class.persisted_connection(conn_options)\n\n if existing_connection.nil?\n # create and persist a new connection\n @connection = PG::Connection.new(\n host,\n port,\n nil,\n nil,\n database,\n username,\n options['password'] || ''\n )\n @connection.set_notice_processor do |msg|\n if msg =~ /^ERROR:/\n LOG.error('psql') { msg.gsub(/\\n/,'; ') }\n else\n LOG.info('psql') { msg.gsub(/\\n/,'; ') }\n end\n end\n self.class.persist_connection(@connection, conn_options)\n else\n # reuse an existing connection\n @connection = existing_connection\n end\n\n # set up trackig if it isn't set up already\n set_up_tracking if !tracking_tables?\n end", "def initialize(options = {})\n reset_values\n\n @options = {}\n options.each { |key, value| @options[key.to_s.to_sym] = value }\n @options[:port] ||= 5433\n\n @row_style = @options[:row_style] ? @options[:row_style] : :hash\n unless options[:skip_startup]\n startup_connection\n initialize_connection\n end\n end", "def initialize(opts = {})\n opts = {\n :host => nil,\n :name => nil,\n :user => nil,\n :password => nil\n }.merge(opts)\n\n @name = opts[:name]\n @host = opts[:host]\n @user = opts[:user]\n @password = opts[:password]\n\n @dbh = Mysql2::Client.new(:host => opts[:host], \n :username => opts[:user], \n :password => opts[:password], \n :database => opts[:name])\n end", "def db(db_name, options={})\n DB.new(db_name, self, options.merge(:logger => @logger))\n end", "def initialize(opts = {}, &block)\n @opts = opts\n \n @quote_identifiers = opts[:quote_identifiers] || @@quote_identifiers\n @single_threaded = opts[:single_threaded] || @@single_threaded\n @schemas = nil\n @pool = (@single_threaded ? SingleThreadedPool : ConnectionPool).new(connection_pool_default_options.merge(opts), &block)\n @pool.connection_proc = proc {connect} unless block\n\n @loggers = Array(opts[:logger]) + Array(opts[:loggers])\n ::Sequel::DATABASES.push(self)\n end", "def initialize(options)\n raise 'Missing config username on output.mysql' unless options.key? :username\n raise 'Missing config database on output.mysql' unless options.key? :database\n raise 'Missing config table on output.mysql' unless options.key? :table\n conf = DEFAULT_MYSQL.merge options\n @table = conf.delete :table\n conf[:port] = conf[:port].to_i\n conf[:password] = conf[:password].to_s\n @encoding = conf[:encoding]\n conf[:ssl_mode] = :disabled if conf[:ssl_mode] != :enabled\n @mysql = Mysql2::Client.new conf\n @mysql_conf = conf\n create_table_if_not_exists\n @sqls = Hash.new { |hash, key| hash[key] = generate_batch_sql key }\n end", "def create_database(name, options = {})\n options = { :encoding => 'utf8' }.merge!(options.symbolize_keys)\n\n option_string = options.sum do |key, value|\n case key\n when :owner\n \" OWNER = \\\"#{value}\\\"\"\n when :template\n \" TEMPLATE = \\\"#{value}\\\"\"\n when :encoding\n \" ENCODING = '#{value}'\"\n when :collation\n \" LC_COLLATE = '#{value}'\"\n when :ctype\n \" LC_CTYPE = '#{value}'\"\n when :tablespace\n \" TABLESPACE = \\\"#{value}\\\"\"\n when :connection_limit\n \" CONNECTION LIMIT = #{value}\"\n else\n \"\"\n end\n end\n\n execute \"CREATE DATABASE #{quote_table_name(name)}#{option_string}\"\n end", "def initialize(args)\n @sql = args[:sql] || nil\n \n #Mandatory args:\n req(:required => [:connection_name],\n :args_object => args)\n @dbh = Mysqladmin::Pool.connections[args[:connection_name]][:dbh]\n end", "def establish_connection(database_url_or_options = {}, options = {})\n\n case database_url_or_options\n when String\n uri = URI.parse(database_url_or_options)\n @table_name = options.fetch(:table_name, \"application_cache\").freeze\n @pg = PG::Connection.new(\n host: uri.host,\n port: uri.port,\n user: uri.user,\n password: uri.password,\n dbname: uri.path.tr(\"/\",\"\"),\n sslmode: \"prefer\",\n )\n else\n @table_name = database_url_or_options.fetch(:table_name, \"application_cache\").freeze\n @pg = PG::Connection.new(\n host: database_url_or_options[:host],\n port: database_url_or_options[:port],\n user: database_url_or_options[:username],\n password: database_url_or_options[:password],\n dbname: database_url_or_options[:database],\n sslmode: \"prefer\",\n )\n end\n\n end", "def initialize(opts = {}, &block)\n @opts = opts\n \n # Determine if the DB is single threaded or multi threaded\n @single_threaded = opts[:single_threaded] || @@single_threaded\n # Construct pool\n if @single_threaded\n @pool = SingleThreadedPool.new(&block)\n else\n @pool = ConnectionPool.new(opts[:max_connections] || 4, &block)\n end\n @pool.connection_proc = block || proc {connect}\n\n @logger = opts[:logger]\n ::Sequel::DATABASES.push(self)\n end", "def create_database(name, options = {})\n if options[:collation]\n execute \"CREATE DATABASE #{quote_table_name(name)} DEFAULT COLLATE #{quote_table_name(options[:collation])}\"\n elsif options[:charset]\n execute \"CREATE DATABASE #{quote_table_name(name)} DEFAULT CHARACTER SET #{quote_table_name(options[:charset])}\"\n elsif row_format_dynamic_by_default?\n execute \"CREATE DATABASE #{quote_table_name(name)} DEFAULT CHARACTER SET `utf8mb4`\"\n else\n raise \"Configure a supported :charset and ensure innodb_large_prefix is enabled to support indexes on varchar(255) string columns.\"\n end\n end", "def initialize options\n self.db_host, self.db_port = options[:uri].to_s.split(':')\n super options\n end", "def create_database(name, options = {})\n options = options.reverse_merge(:encoding => \"utf8\")\n\n option_string = options.symbolize_keys.sum do |key, value|\n case key\n when :owner\n \" OWNER = \\\"#{value}\\\"\"\n when :template\n \" TEMPLATE = \\\"#{value}\\\"\"\n when :encoding\n \" ENCODING = '#{value}'\"\n when :tablespace\n \" TABLESPACE = \\\"#{value}\\\"\"\n when :connection_limit\n \" CONNECTION LIMIT = #{value}\"\n else\n \"\"\n end\n end\n\n execute \"CREATE DATABASE #{quote_table_name(name)}#{option_string}\"\n end", "def create_database(name, options = {})\n options = options.reverse_merge(encoding: 'utf8')\n\n option_string = options.symbolize_keys.sum do |key, value|\n case key\n when :owner\n \" OWNER = \\\"#{value}\\\"\"\n when :template\n \" TEMPLATE = \\\"#{value}\\\"\"\n when :encoding\n \" ENCODING = '#{value}'\"\n when :tablespace\n \" TABLESPACE = \\\"#{value}\\\"\"\n when :connection_limit\n \" CONNECTION LIMIT = #{value}\"\n else\n ''\n end\n end\n\n execute(\"CREATE DATABASE #{quote_table_name(name)}#{option_string}\")\n end", "def initialize(host: nil, port: 5433, username: nil, password: nil, database: nil, interruptable: false, ssl: false, read_timeout: 600, debug: false, role: nil, search_path: nil, timezone: nil, autocommit: false, skip_startup: false, skip_initialize: false, user: nil)\n reset_state\n @notice_handler = nil\n\n @options = {\n host: host,\n port: port.to_i,\n username: username || user,\n password: password,\n database: database,\n debug: debug,\n ssl: ssl,\n interruptable: interruptable,\n read_timeout: read_timeout,\n role: role,\n search_path: search_path,\n timezone: timezone,\n autocommit: autocommit,\n }\n\n boot_connection(skip_initialize: skip_initialize) unless skip_startup\n end", "def initialize(options = {})\n self.output_dir = options[:output_dir]\n self.mysql_options = options[:mysql_options]\n self.db_connection = options[:db_connection]\n self.column_filters = (options[:column_filters] || {}).stringify_keys!\n self.table_filters = (options[:table_filters] || []).map(&:to_s)\n\n self.post_dump_command = options[:post_dump_command]\n self.file_extension = options[:file_extension] || \".sql\"\n end", "def initialize(db, opts)\n connect_opts = {\n :host => opts[:host] || 'localhost',\n :port => opts[:port] || 15432,\n :dbname => opts[:database],\n :user => opts[:user],\n :password => opts[:password],\n :hostaddr => opts[:hostaddr],\n :connect_timeout => opts[:connect_timeout] || 20,\n :sslmode => opts[:sslmode]\n }.delete_if{|key, value| value.nil? or (value.respond_to?(:empty?) and value.empty?)}\n\tsuper(connect_opts)\n\n @db = db\n @prepared_statements = {}\n\n if opts[:notice_receiver]\n set_notice_receiver(opts[:notice_receiver])\n else\n # Swallow warnings\n set_notice_receiver{|proc| }\n end\n end", "def initialize(connect_options)\n connect_options = keys_to_symbol(connect_options)\n\n raise ArgumentError, 'database adapter is required' unless connect_options.has_key?(:adapter)\n raise ArgumentError, 'database host is required' unless connect_options.has_key?(:host)\n raise ArgumentError, 'database port is required' unless connect_options.has_key?(:port)\n raise ArgumentError, 'database username is required' unless connect_options.has_key?(:username)\n raise ArgumentError, 'database password is required' unless connect_options.has_key?(:password)\n raise ArgumentError, 'database database is required' unless connect_options.has_key?(:database)\n\n if connect_options[:adapter].eql? \"mysql2\"\n @client = Mysql2::Client.new(\n host: connect_options[:host],\n port: connect_options[:port],\n username: connect_options[:username],\n password: connect_options[:password],\n database: connect_options[:database]\n )\n else\n raise ArgumentError, 'for a while only mysql2 adapter is supported'\n end\n \n end", "def initialize(options={})\n @connection = Connection.new(options)\n end", "def initialize(**options)\n unless Object.const_defined?(:PG)\n raise(ArgumentError, \"unable to require 'pg' gem\")\n end\n\n unknown_keys = options.keys - OPTIONS_ENV_NAME_MAP.keys\n if unknown_keys.any?\n raise(ArgumentError, \"unkown keys: #{unknown_keys.join(', ')}\")\n end\n\n @options = options_config_env(options)\n @connection = nil\n end", "def db(options = {})\n @_sequelizer_db ||= new_db(options)\n end", "def initialize( options={} )\n @shard_lookup = options[ :shard_lookup ]\n\n @shard_definitions = []\n @connection_pools = ConnectionPoolHash.new( self )\n @schema_pools = {}\n end", "def initialize(options) # @todo: Refactor using factory method Connection.build_producer\n super # takes declared attributes only, skipping brokers and client_id\n brokers = options.fetch(:brokers)\n client = options.fetch(:client_id)\n @connection = DRIVER.new(brokers, client, attributes)\n @mutex = Mutex.new\n end", "def initialize(options={})\n @name = options[:name] || 'PersistentHTTP'\n @idle_timeout = options[:idle_timeout] || 10\n @logger = options[:logger]\n @pool_timeout = options[:pool_timeout]\n @pool_size = options[:pool_size] || 1\n @warn_timeout = options[:warn_timeout] || 0.5\n @default_path = options[:default_path]\n @host = options[:host]\n @port = options[:port]\n url = options[:url]\n if url\n url = URI.parse(url) if url.kind_of? String\n @default_path ||= url.request_uri\n @host ||= url.host\n @port ||= url.port\n end\n\n @pool = GenePool.new(:name => name,\n :pool_size => @pool_size,\n :timeout => @pool_timeout,\n :warn_timeout => @warn_timeout,\n :idle_timeout => @idle_timeout,\n :close_proc => :finish,\n :logger => @logger) do\n @logger.debug { \"#{name}: Creating connection\" } if @logger\n Connection.new(options)\n end\n end", "def initialize(db, opts = OPTS)\n super\n @max_size = Integer(opts[:max_connections] || 4)\n raise(Sequel::Error, ':max_connections must be positive') if @max_size < 1\n @mutex = Mutex.new \n @connection_handling = opts[:connection_handling]\n @available_connections = []\n @allocated = {}\n @allocated.compare_by_identity\n @timeout = Float(opts[:pool_timeout] || 5)\n @waiter = ConditionVariable.new\n end", "def initialize(servers = nil, options = {}, thrift_options = {})\n @servers = servers || '127.0.0.1:9160'\n @options = options.merge(cql_version: '3.0.0')\n @thrift_options = thrift_options.dup\n @instrumenter = @options.delete(:instrumenter)\n @retry_strategy = @options.delete(:retry_strategy)\n\n @driver = CassandraCQL::Database.new(@servers, @options, @thrift_options)\n\n @executor = Cassanity::Executors::CassandraCql.new({\n driver: @driver,\n instrumenter: @instrumenter,\n retry_strategy: @retry_strategy,\n })\n\n @connection = Cassanity::Connection.new({\n executor: @executor,\n })\n end", "def set_db_options(options)\n\t\t\t\toptions[:collection]=options[:collection] || MongoozHash.get_class_name_without_namespace(self)\n\t\t\t\toptions[:db]=options[:db] || Mongooz.DEFAULT_DB\n\t\t\t\toptions[:host]=options[:host] || Mongooz.DEFAULT_HOST\n\t\t\t\toptions[:port]=options[:port] || Mongooz.DEFAULT_PORT\n\t\t\tend", "def initialize(options={})\n @logger = options.delete(:logger) || self.class.default_logger\n @options = options\n options.host = '127.0.0.1' if options.host.nil? || options.host == 'localhost'\n options.port ||= 9312\n\n # If you use localhost, MySQL insists on a socket connection, but Sphinx\n # requires a TCP connection. Using 127.0.0.1 fixes that.\n # so does passing in the socket file e.g. socket:'/usr/local/sphinx/var/run/sphinx.sock'\n # nb: sphinx.conf listen definition must specify mysql41 as the protocol, e.g.,\n # listen = localhost:9312:mysql41\n\n super( { symbolize_keys: true, database_timezone: :utc, application_timezone: :local }.merge( options ) )\n end", "def new_db(options = {})\n cached = find_cached(options)\n return cached if cached && !options[:force_new]\n @cache[options] = ConnectionMaker.new(options).connection\n end", "def initialize(options = {})\n @registry = options.fetch(:registry) { Restforce::DB::Registry }\n @interval = options.fetch(:interval) { DEFAULT_INTERVAL }\n @delay = options.fetch(:delay) { DEFAULT_DELAY }\n @verbose = options.fetch(:verbose) { false }\n @logger = options.fetch(:logger)\n @tracker = options.fetch(:tracker)\n @runner = options.fetch(:runner)\n @exit = options.fetch(:run_once)\n @history = options.fetch(:history)\n\n DB.reset\n DB.configure { |config| config.parse(options[:config]) }\n end", "def initialize(options={})\n config = options.fetch(:config) { Wrapped::PoolConfig.new }\n host = options.fetch(:host, Wrapped::Protocol::DEFAULT_HOST)\n port = options.fetch(:post, Wrapped::Protocol::DEFAULT_PORT)\n connection_timeout = options.fetch(:connection_timeout, Wrapped::Protocol::DEFAULT_TIMEOUT)\n password = options.fetch(:password, nil)\n database = options.fetch(:database, Wrapped::Protocol::DEFAULT_DATABASE)\n client_name = options.fetch(:client_name, nil)\n\n @convert_objects = options.fetch(:convert_objects, false)\n\n @connection_pool = Wrapped::Pool.new(\n config,\n host,\n port,\n connection_timeout,\n password,\n database,\n client_name\n )\n end", "def connection_options\n opts = {}\n\n if @wtimeout\n warn \"Using wtimeout in a URI is deprecated, please use wtimeoutMS. It will be removed in v2.0.\"\n opts[:wtimeout] = @wtimeout\n end\n opts[:wtimeout] = @wtimeoutms if @wtimeoutms\n\n opts[:w] = 1 if @safe\n opts[:w] = @w if @w\n opts[:j] = @journal if @journal\n opts[:fsync] = @fsync if @fsync\n\n opts[:connect_timeout] = @connecttimeoutms if @connecttimeoutms\n opts[:op_timeout] = @sockettimeoutms if @sockettimeoutms\n opts[:pool_size] = @pool_size if @pool_size\n opts[:read] = @readpreference if @readpreference\n\n if @slaveok && !@readpreference\n unless replicaset?\n opts[:slave_ok] = true\n else\n opts[:read] = :secondary_preferred\n end\n end\n\n if replicaset.is_a?(String)\n opts[:name] = replicaset\n end\n\n opts[:db_name] = @db_name if @db_name\n opts[:auths] = @auths if @auths\n opts[:ssl] = @ssl if @ssl\n opts[:connect] = connect?\n\n opts\n end", "def initialize(\n printable_name:,\n host:,\n port: '3306',\n database_name:,\n username:,\n password:,\n sslca: nil\n )\n @printable_name = printable_name\n @username = username\n @password = password\n @host = host\n @database_name = database_name\n @port = port\n @sslca = sslca\n end", "def initialize(config)\n self.connection = ConnectionExtenders.db_connect config\n self.config = config\n self.manual_primary_keys = {}\n end", "def initialize(options)\n @options = options\n @params = {}\n @connection = build_connection\n end", "def initialize( options={} )\n\t\toptions = DEFAULT_OPTIONS.merge( options )\n\n\t\t@host = options[:host]\n\t\t@port = options[:port]\n\t\t@connect_type = options[:connect_type]\n\t\t@results_class = options[:results_class]\n\n\t\t@conn = nil\n\t\t@bound_user = nil\n\n\n\t\t@object_conversions = DEFAULT_OBJECT_CONVERSIONS.dup\n\t\t@attribute_conversions = DEFAULT_ATTRIBUTE_CONVERSIONS.dup\n\t\t@registered_controls = []\n\n\t\t@base_dn = options[:base_dn] || self.get_default_base_dn\n\t\t@base = nil\n\n\t\t# Immediately bind if credentials are passed to the initializer.\n\t\tif ( options[:bind_dn] && options[:pass] )\n\t\t\tself.bind( options[:bind_dn], options[:pass] )\n\t\tend\n\tend", "def initialize(options)\n defaults = { :port => 22, :paranoid => false }\n options = defaults.merge(options)\n\n # Options need to be in a final state before we call the parent initializer\n super(options)\n\n @connection_options = options\n\n end", "def db(db_name, options={})\n XGen::Mongo::Driver::DB.new(db_name, @pair, @options.merge(options))\n end", "def initialize( *args )\n\t\turi = if args.empty?\n\t\t\t\tWordNet::Lexicon.default_db_uri\n\t\t\telsif args.first.is_a?( String )\n\t\t\t\targs.shift\n\t\t\telse\n\t\t\t\tnil\n\t\t\tend\n\n\t\toptions = WordNet::DEFAULT_DB_OPTIONS.merge( args.shift || {} )\n\n\t\tif uri\n\t\t\tself.log.debug \"Connecting using uri + options style: uri = %s, options = %p\" %\n\t\t\t\t[ uri, options ]\n\t\t\t@db = Sequel.connect( uri, options )\n\t\telse\n\t\t\tself.log.debug \"Connecting using hash style connect: options = %p\" % [ options ]\n\t\t\t@db = Sequel.connect( options )\n\t\tend\n\n\t\t@uri = @db.uri\n\t\tself.log.debug \" setting model db to: %s\" % [ @uri ]\n\n\t\[email protected]_log_level = :debug\n\t\tWordNet::Model.db = @db\n\tend", "def create_database(name, options = {})\n options = { encoding: 'utf8' }.merge!(options.symbolize_keys)\n\n option_string = options.inject(\"\") do |memo, (key, value)|\n memo += case key\n when :owner\n \" OWNER = \\\"#{value}\\\"\"\n else\n \"\"\n end\n end\n\n execute \"CREATE DATABASE #{quote_table_name(name)}#{option_string}\"\n end", "def initialize(db, opts = OPTS)\n super\n @max_size = Integer(opts[:max_connections] || 4)\n raise(Sequel::Error, ':max_connections must be positive') if @max_size < 1\n @mutex = Mutex.new \n # Size inside array so this still works while the pool is frozen.\n @size = [0]\n @allocated = {}\n @allocated.compare_by_identity\n @timeout = Float(opts[:pool_timeout] || 5)\n @queue = Queue.new\n end", "def initialize( options )\n\t\tLoggability.format_as( :color ) if $stderr.tty?\n\t\t@options = options\n\n\t\tif @options.debug\n\t\t\t$DEBUG = true\n\t\t\t$VERBOSE = true\n\t\t\tLoggability.level = Logger::DEBUG\n\t\telsif @options.loglevel\n\t\t\tLoggability.level = @options.loglevel\n\t\tend\n\n\t\tMongrel2::Config.configure( :configdb => @options.config )\n\tend", "def connect_to_database(options)\n connection_hash = {:adapter => 'postgres',\n :database => options[:database_name],\n :user => options[:database_user],\n :password => options[:database_password],\n :test => true}\n\n if options[:database_host]\n connection_hash[:host] = options[:database_host]\n end\n\n @connection = Sequel.connect(connection_hash)\n end", "def initialize(args)\n case args\n when Hash\n @connection = ConnectionPool.new(interface: self.class)\n @connection.data_layer_options = args\n\n when ConnectionPool\n @connection = args\n\n else\n raise ArgumentError, \"Bad Argument\"\n end\n\n sc = self.class\n raise(Pod4Error, 'no call to set_db in the interface definition') if sc.db.nil?\n raise(Pod4Error, 'no call to set_table in the interface definition') if sc.table.nil?\n raise(Pod4Error, 'no call to set_id_fld in the interface definition') if sc.id_fld.nil?\n\n TinyTds::Client.default_query_options[:as] = :hash\n TinyTds::Client.default_query_options[:symbolize_keys] = true\n\n rescue => e\n handle_error(e)\n end", "def initialize(options = {})\n if options.is_a?(String)\n @options = YAML.load_file(options)\n else\n @options = options\n end\n @options.symbolize_keys!\n\n if ENV['DATABASE_COM_URL']\n url = URI.parse(ENV['DATABASE_COM_URL'])\n url_options = Hash[url.query.split(\"&\").map{|q| q.split(\"=\")}].symbolize_keys!\n self.host = url.host\n self.client_id = url_options[:oauth_key]\n self.client_secret = url_options[:oauth_secret]\n self.username = url_options[:user]\n self.password = url_options[:password]\n else\n self.client_id = ENV['DATABASEDOTCOM_CLIENT_ID'] || @options[:client_id]\n self.client_secret = ENV['DATABASEDOTCOM_CLIENT_SECRET'] || @options[:client_secret]\n self.host = ENV['DATABASEDOTCOM_HOST'] || @options[:host] || \"login.salesforce.com\"\n end\n self.debugging = ENV['DATABASEDOTCOM_DEBUGGING'] || @options[:debugging]\n self.version = ENV['DATABASEDOTCOM_VERSION'] || @options[:version]\n self.version = self.version.to_s if self.version\n self.sobject_module = ENV['DATABASEDOTCOM_SOBJECT_MODULE'] || @options[:sobject_module]\n end", "def initialize(options = {})\n @database = options[:database]\n @grid = ::Mongo::Grid.new(@database)\n end", "def connect_database\n options_file = @config.persist_options_file\n logger.debug \"Loading options from file '#{$config_file_path}/#{options_file}'\"\n # if a persist_options_file parameter was included in the server configuration,\n # then load it (as YAML) into the 'options' Hash map\n options = {}\n if options_file && !(options_file.empty?)\n full_path_to_file = \"#{$app_root}/config/#{options_file}\"\n raise RuntimeError.new \"Options file '#{full_path_to_file}' from server configuration does not exist\" unless File.file?(full_path_to_file)\n begin\n options = YAML::load(File.open(full_path_to_file))\n rescue Error => e\n raise RuntimeError.new \"Failed to load options file (#{e.class}): #{e.message}\"\n end\n raise RuntimeError.new \"Options file '#{full_path_to_file}' from server configuration is not a YAML file\" unless options.class == Hash\n end\n # now, check for any \"old-style\" configuration parameters, and merge them\n # with any options that may have been read from an options file (above).\n # Note that values specified in an options file (read above) will override\n # the \"old-style\" options read here\n if @config.persist_mode == :cassandra\n options = { 'hosts' => @config.persist_host, 'username' => @config.persist_username,\n 'password' => @config.persist_password, 'port' => @config.persist_port,\n 'timeout' => @config.persist_timeout, 'keyspace' => @config.persist_dbname}.merge(options)\n elsif [:mongo, :postgres].include?(@config.persist_mode)\n options = { 'host' => @config.persist_host, 'username' => @config.persist_username,\n 'password' => @config.persist_password, 'port' => @config.persist_port,\n 'timeout' => @config.persist_timeout, 'dbname' => @config.persist_dbname}.merge(options)\n end\n @database.connect(options)\n end", "def initialize(instance, name)\n @connection = instance.connection\n @instance = instance\n @name = name\n @dbmgmthost = @connection.dbmgmthost\n @dbmgmtpath = @connection.dbmgmtpath\n @dbmgmtport = @connection.dbmgmtport\n @dbmgmtscheme = @connection.dbmgmtscheme\n self\n end", "def initialize(db)\n @db = db\n @options = {\n symbolize_keys: true,\n cast_booleans: true\n }\n\n db.opts.each do |key, value|\n case (key)\n when :database, :username, :password, :host, :port, :socket, :encoding, :charset, :compress, :timeout\n @options[key] = value\n when :user\n @options[:username] = value\n when :loggers\n if (value and !value.empty?)\n @options[:logging] = true\n @options[:logger] = value.first\n end\n end\n end\n \n @query_queue = [ ]\n\n @connections = { }\n @connection_pool = [ ]\n @connections_active = { }\n \n @connection_limit = db.opts[:connections] || self.class.size\n \n if (EventMachine.reactor_running? and self.class.trace?)\n EventMachine::PeriodicTimer.new(1) do\n dump_file = \"#{self.class.trace}.#{@options[:database]}\"\n \n File.open(dump_file, 'w') do |f|\n f.puts @options[:database]\n\n @connections.each do |c, x|\n next unless (x)\n \n f.puts \"\\t#{c.inspect} -> #{x.inspect}\"\n end\n @connection_pool.each do |c|\n f.puts \"\\t#{c.inspect} (pool)\"\n end\n \n @query_queue.each do |query, callback|\n f.puts \"\\t#{query}\"\n end\n end\n end\n end\n end", "def initialize(options = {})\n raise ArgumentError unless options_are_valid?(options)\n @cluster = options[:cluster]\n @keyspace = options[:keyspace].gsub(\"-\", \"_\")\n @table = options[:table].gsub(\"-\", \"_\")\n @semaphore = Mutex.new\n @options = options\n @timeuuid_generator = Cassandra::Uuid::Generator.new\n @logger = @options[:logger] ||= Logger.new(STDOUT).tap { |l| l.level = Logger::INFO }\n end", "def initialize(options)\n super\n\n # The default Ruby <-> SQL type mappings, should be valid\n # for most RDBM systems.\n @typemap = {\n Integer => \"integer\",\n Fixnum => \"integer\",\n Float => \"float\",\n String => \"text\",\n Time => \"timestamp\",\n Date => \"date\",\n TrueClass => \"boolean\",\n Object => \"text\",\n Array => \"text\",\n Hash => \"text\"\n }\n end", "def initialize(name, options={})\n @name = name.to_sym\n @options = options\n @columns = []\n @indexes = []\n end", "def initialize(dbname = Namey.db_path) \n @db = Sequel.connect(dbname)\n end", "def create_db(options)\n info \"Created database '#{options[:name]}'\"\n end", "def initialize *args\n opts = args.last.is_a?(Hash) ? args.last : {}\n @host = opts[:host] || \"localhost\"\n @port = opts[:port] || 8086\n @username = opts[:username] || \"root\"\n @password = opts[:password] || \"root\"\n @database = args.first\n @http = Net::HTTP.new(@host, @port)\n @queue = InfluxDB::MaxQueue.new\n spawn_threads!\n end", "def initialize(options = {})\n self.class.options ||= Ramaze::Cache::Sequel.trait[:default].merge(options)\n @options = options.merge(self.class.options)\n end", "def add(options)\n\n\n\n column_names = options.keys\n \n values = options.values\n \n column_names_for_sql = column_names.join(\", \")\n \n individual_values_for_sql = []\n \n values.each do |value|\n if value.is_a?(String)\n individual_values_for_sql << \"'#{value}'\"\n else\n individual_values_for_sql << value\n end\n end\n \n values_for_sql = individual_values_for_sql.join(\", \")\n \n table_name = self.to_s.pluralize\n \n \n results = CONNECTION.execute(\"INSERT INTO #{table_name} (#{column_names_for_sql}) VALUES (#{values_for_sql});\")\n \n \n id = CONNECTION.last_insert_row_id\n options[\"id\"] = id\n \n self.new(options)\n \n\n end", "def configure(host = 'localhost',\n port = 6379,\n db = 0,\n password = nil,\n driver: nil,\n url: nil,\n connect_timeout: 0.5,\n read_timeout: 1,\n write_timeout: 0.5)\n if !url.nil?\n @config = {}\n @config[:url] = url\n @config[:db] = db\n else\n @config = { host: host, port: port, db: db }\n end\n\n @config[:password] = password unless password.nil?\n @config[:driver] = driver unless driver.nil?\n\n @config[:connect_timeout] = connect_timeout\n @config[:read_timeout] = read_timeout\n @config[:write_timeout] = write_timeout\n connection_pool.config = @config\n end", "def initialize(app, options={})\n options = {:db => options } if options.is_a? ::Sequel::Database\n super\n @mutex = Mutex.new\n setup_database\n end", "def connect(*args)\n @@connection = FluidDB::Connection.new(*args)\n end", "def initialize(params = {})\n @host = params[:host] || 'localhost'\n @port = (params[:port] || 3306).to_i\n @user = params[:username] || 'root'\n @password = params[:password] || 'pwd'\n @database = params[:database] || 'ithingy'\n @adapter = params[:adapter] || 'mysql'\n self.connect\n end", "def initialize(options = {})\n self.class.options ||= Ramaze::Cache::Sequel.trait[:default].merge(\n options\n )\n\n @options = options.merge(self.class.options)\n end", "def initialize(options={})\n @database = options[:database] || -> { ::Sequel::Model.db }\n @migration_directory = options[:migration_directory] || 'db/migrate'\n end", "def initialize(app, options={})\n super\n\n host, port, db_name, cltn_name = parse_server_desc( @default_options[:server] )\n \n @mutex = Mutex.new \n @connection = ::Mongo::Connection.new( \n host, \n port,\n :pool_size => @default_options[:pool_size],\n :timeout => @default_options[:pool_timeout] )\n @db = @connection.db( db_name )\n @sessions = @db[cltn_name]\n\n @logger = ::Logger.new( $stdout )\n @logger.level = set_log_level( @default_options[:log_level] )\n end", "def [](db_name)\n DB.new(db_name, self, :logger => @logger)\n end", "def add(options={})\n # Example: {\"name\" => \"Sumeet\", \"age\" => 500}\n \n column_names = options.keys\n values = options.values\n \n column_names_for_sql = column_names.join(\", \")\n \n individual_values_for_sql = []\n \n values.each do |value|\n if value.is_a?(String)\n individual_values_for_sql << \"'#{value}'\"\n else \n individual_values_for_sql << value\n end \n end\n values_for_sql = individual_values_for_sql.join(\", \")\n CONNECTION.execute(\"INSERT INTO #{table_name} (#{column_names_for_sql}) VALUES (#{values_for_sql});\")\n\n id = CONNECTION.last_insert_row_id\n options[\"id\"] = id\n\n self.new(options)\n \n end", "def database(options = nil)\n unless options.nil?\n @database = options\n ::DataMapper.setup(:default, @database)\n end\n @database\n end", "def connect(args)\n begin\n # sensible? defaults\n args[:host] ||= 'localhost'\n args[:port] ||= 3306\n args[:user] ||= 'root'\n args[:password] ||= ''\n \n db = Mysql.connect(args[:host], args[:user], args[:password], args[:name], args[:port])\n @debug and puts \"-- #{args[:host]} #{args[:name]} server version: \" + db.get_server_info\n return db\n rescue Mysql::Error => e\n $stderr.puts \"Error code: #{e.errno}\"\n $stderr.puts \"Error message: #{e.error}\"\n $stderr.puts \"Error SQLSTATE: #{e.sqlstate}\" if e.respond_to?(\"sqlstate\")\n exit\n end\n end", "def initialize(args={})\n @connection_name = args[:connection_name] || nil\n end", "def setup( opts = {} )\n\n @db.disconnect if @db\n\n log = RJack::SLF4J[ \"iudex.da.sequel\" ]\n conf = CONFIG.merge( opts )\n conf = Hooker.merge( [ :iudex, :connect_props ], conf )\n\n conf[ :loggers ] = [ log ] if conf[ :log ]\n\n cstr = ( \"%s://%s/%s?%s\" %\n [ conf[ :adapter ],\n [ conf[ :host ], conf[ :port ] ].compact.join( ':' ),\n conf[ :database ],\n params( conf ) ] )\n\n log.info { \"Connecting: #{cstr}\" }\n log.debug { \"Full Params: #{ conf.inspect }\" }\n\n @db = Sequel.connect( cstr, conf )\n\n end", "def connect(options = {})\n return @pool = options[:pool] if options[:pool]\n options = options.dup\n timeout = options.delete(:timeout) || 5\n pool_size = options.delete(:pool_size) || 1\n @pool = Squirm::Pool.new(timeout)\n pool_size.times do\n conn = PG::Connection.open(options)\n yield conn if block_given?\n @pool.checkin conn\n end\n end", "def initialize(options={})\n self.query = Query.new\n self.query.table = options.delete(:table)\n self.query.limit = options.delete(:limit)\n self.query.offset = options.delete(:offset)\n self.query.select = options.delete(:select)\n self.query.conditions = options.delete(:conditions) || []\n self.query.uses = options.delete(:uses) || []\n self.query.tail = options.delete(:tail)\n self.query.truncate = options.delete(:truncate)\n self.query.reverse = options.delete(:reverse)\n self.query.unique = options.delete(:unique)\n self.query.sanitize = options.delete(:sanitize)\n self.query.remote_limit = options.delete(:remote_limit)\n self.query.remote_offset = options.delete(:remote_offset)\n end", "def initialize(options = {:retry_auth => true})\n @authuser = options[:username] || (raise CloudDB::Exception::Authentication, \"Must supply a :username\")\n @authkey = options[:api_key] || (raise CloudDB::Exception::Authentication, \"Must supply an :api_key\")\n @region = options[:region] || (raise CloudDB::Exception::Authentication, \"Must supply a :region\")\n @retry_auth = options[:retry_auth]\n @auth_url = options[:auth_url] || CloudDB::AUTH_USA\n @snet = ENV['RACKSPACE_SERVICENET'] || options[:snet]\n @authok = false\n @http = {}\n CloudDB::Authentication.new(self)\n end", "def initialize(options = {:retry_auth => true}) \n @authuser = options[:username] || (raise CloudDB::Exception::Authentication, \"Must supply a :username\")\n @authkey = options[:api_key] || (raise CloudDB::Exception::Authentication, \"Must supply an :api_key\")\n @region = options[:region] || (raise CloudDB::Exception::Authentication, \"Must supply a :region\")\n @retry_auth = options[:retry_auth]\n @auth_url = options[:auth_url] || CloudDB::AUTH_USA\n @snet = ENV['RACKSPACE_SERVICENET'] || options[:snet]\n @authok = false\n @http = {}\n CloudDB::Authentication.new(self)\n end", "def initialize(options)\n @name = options[\"name\"]\n @id = options[\"id\"]\n @table = \"dinnerclubs\"\n end", "def initialize(name, options={})\n @name = name\n @host = options[:host]\n @port = options[:port] || 22\n @user = options[:user]\n @password = options[:password]\n @deploy_to = options[:deploy_to]\n end", "def initialize(info = {})\n super\n\n # Register the options that all Postgres exploits may make use of.\n register_options(\n [\n Opt::RHOST,\n Opt::RPORT(5432),\n OptString.new('DATABASE', [ true, 'The database to authenticate against', 'template1']),\n OptString.new('USERNAME', [ true, 'The username to authenticate as', 'postgres']),\n OptString.new('PASSWORD', [ false, 'The password for the specified username. Leave blank for a random password.', 'postgres']),\n OptBool.new('VERBOSE', [false, 'Enable verbose output', false]),\n OptString.new('SQL', [ false, 'The SQL query to execute', 'select version()']),\n OptBool.new('RETURN_ROWSET', [false, \"Set to true to see query result sets\", true])\n ], Msf::Exploit::Remote::Postgres)\n\n register_autofilter_ports([ 5432 ])\n register_autofilter_services(%W{ postgres })\n end", "def with_options(options)\n self.class.new(@table, @options.merge(options), @col_types).freeze\n end", "def initialize(interpreter, opts={})\n self.interpreter = interpreter\n self.default_db = opts[:default_db] || \"mysql\"\n self.dba = opts[:dba] || \"root\"\n\n end", "def initialize(options, connection)\n @options = options\n @connection = connection\n end", "def initialize(options = {})\n url = options.delete(:url) { determine_redis_provider }\n namespace = options.delete(:namespace)\n driver = options.delete(:driver)\n @redis_connection = initialize_conection(url, namespace, driver)\n @redis_client = @redis_connection.client\n @redis_connection\n end", "def db_settings(_options = {})\n raise Sqreen::NotImplementedYet\n end", "def initialize(options = {})\n @connections =\n if options.key?(:puppetdb_url)\n urls = options[:puppetdb_url].is_a?(Array) ? options[:puppetdb_url] : [options[:puppetdb_url]]\n urls.map { |url| parse_url(url) }\n elsif options.key?(:puppetdb_host)\n is_ssl = options.fetch(:puppetdb_ssl, true)\n default_port = is_ssl ? URI::HTTPS::DEFAULT_PORT : URI::HTTP::DEFAULT_PORT\n port = options.fetch(:puppetdb_port, default_port).to_i\n [{ ssl: is_ssl, host: options[:puppetdb_host], port: port }]\n elsif ENV['PUPPETDB_URL'] && !ENV['PUPPETDB_URL'].empty?\n [parse_url(ENV['PUPPETDB_URL'])]\n elsif ENV['PUPPETDB_HOST'] && !ENV['PUPPETDB_HOST'].empty?\n # Because environment variables are strings...\n # This will get the env var and see if it equals 'true'; the result\n # of this == comparison is the true/false boolean we need.\n is_ssl = ENV.fetch('PUPPETDB_SSL', 'true') == 'true'\n default_port = is_ssl ? URI::HTTPS::DEFAULT_PORT : URI::HTTP::DEFAULT_PORT\n port = ENV.fetch('PUPPETDB_PORT', default_port).to_i\n [{ ssl: is_ssl, host: ENV['PUPPETDB_HOST'], port: port }]\n else\n []\n end\n @timeout = options.fetch(:timeout, 10)\n @options = options\n end", "def mongodb_connection(options={}, &block)\n return @mongodb_conncetion if @mongodb_connection and !block_given?\n options.stringify_keys!\n options['adapter'] ||= 'mongodb'\n @mongodb_connection = no_sql_connection(options, &block)\n end", "def new_connection(params)\n Pod4.logger.info(__FILE__){ \"Connecting to DB\" }\n client = TinyTds::Client.new(params)\n raise \"Bad Connection\" unless client.active?\n\n client.execute(\"use [#{self.class.db}]\").do\n\n client\n\n rescue => e\n handle_error(e)\n end", "def initialize(manifest_reader, sql_reader, options = {})\n @log = Logging.logger[self]\n @connection_hash = options\n @manifest = nil\n @builder_version = nil\n @manifest_reader = manifest_reader\n @sql_reader = sql_reader\n end", "def get_db_connection\n config = read_database_config\n if config.dig(:adapter) == 'postgresql'\n config[:user] = config.delete(:username) if config[:username]\n config[:dbname] = config.delete(:database) if config[:database]\n config.delete(:adapter)\n valid_param_keys = PG::Connection.conndefaults_hash.keys + [:requiressl]\n config.slice!(*valid_param_keys)\n @db ||= PG::Connection.new(config)\n elsif config.dig(:adapter) == 'mysql2'\n @db ||= Mysql2::Client.new(config)\n else\n @db ||= SQLite3::Database.open(\"spectacles-#{Rails.env}.db\")\n end\n end", "def initialize(connection, options)\n self.connection = connection\n self.options = options.clone\n end", "def connect\n config = @connection_options\n @connection = case config[:mode]\n when :dblib\n appname = config[:appname] || configure_application_name || Rails.application.class.name.split('::').first rescue nil\n login_timeout = config[:login_timeout].present? ? config[:login_timeout].to_i : nil\n timeout = config[:timeout].present? ? config[:timeout].to_i/1000 : nil\n encoding = config[:encoding].present? ? config[:encoding] : nil\n TinyTds::Client.new({\n :dataserver => config[:dataserver],\n :host => config[:host],\n :port => config[:port],\n :username => config[:username],\n :password => config[:password],\n :database => config[:database],\n :appname => appname,\n :login_timeout => login_timeout,\n :timeout => timeout,\n :encoding => encoding,\n :azure => config[:azure]\n }).tap do |client|\n if config[:azure]\n client.execute(\"SET ANSI_NULLS ON\").do\n client.execute(\"SET CURSOR_CLOSE_ON_COMMIT OFF\").do\n client.execute(\"SET ANSI_NULL_DFLT_ON ON\").do\n client.execute(\"SET IMPLICIT_TRANSACTIONS OFF\").do\n client.execute(\"SET ANSI_PADDING ON\").do\n client.execute(\"SET QUOTED_IDENTIFIER ON\")\n client.execute(\"SET ANSI_WARNINGS ON\").do\n else\n client.execute(\"SET ANSI_DEFAULTS ON\").do\n client.execute(\"SET CURSOR_CLOSE_ON_COMMIT OFF\").do\n client.execute(\"SET IMPLICIT_TRANSACTIONS OFF\").do\n end\n client.execute(\"SET TEXTSIZE 2147483647\").do\n end\n when :odbc\n if config[:dsn].include?(';')\n driver = ODBC::Driver.new.tap do |d|\n d.name = config[:dsn_name] || 'Driver1'\n d.attrs = config[:dsn].split(';').map{ |atr| atr.split('=') }.reject{ |kv| kv.size != 2 }.inject({}){ |h,kv| k,v = kv ; h[k] = v ; h }\n end\n ODBC::Database.new.drvconnect(driver)\n else\n ODBC.connect config[:dsn], config[:username], config[:password]\n end.tap do |c|\n begin\n c.use_time = true\n c.use_utc = ActiveRecord::Base.default_timezone == :utc\n rescue Exception => e\n warn \"Ruby ODBC v0.99992 or higher is required.\"\n end\n end\n end\n @spid = _raw_select('SELECT @@SPID', fetch: :rows).first.first\n configure_connection\n rescue\n raise unless @auto_connecting\n end", "def initialize(user_options)\n\n # configure default options\n @options = {\n :project => user_options[:project] || \"default\",\n :port => user_options[:port] || 55553,\n :user => user_options[:rpc_user],\n :pass => user_options[:rpc_pass],\n :db_host => user_options[:db_host] || \"localhost\",\n :db_user => user_options[:db_user],\n :db_pass => user_options[:db_pass],\n :db_name => user_options[:db_name] || \"msf\"\n }\n\n @options.merge!(user_options)\n\n #\n # Connect to the RPC daemon using the default client\n #\n @client = Msf::RPC::Client.new(@options)\n\n # connect to the database \n _connect_database\n end", "def initialize(options={})\n @options = {:host => nil,\n :vendor => \"Dell\",\n :model => nil,\n :version => \"2c\",\n :community => \"public\"\n }\n @options.merge!(options) if options.is_a?(Hash)\n @debug = false\n end", "def initialize(connection_param)\n @conn = if connection_param.class == String\n IBM_DB.connect(connection_param, '', '')\n else # connect using catalog \n IBM_DB.connect(*connection_param)\n end\n\n self.autocommit = true\n @prepared_statements = {}\n end", "def initialize(options = {})\n raise \"Redis connection not set\" unless @redis = options[:redis]\n raise \"Entity name not set\" unless @name = options[:name]\n @id = options[:id]\n @logger = options[:logger]\n end", "def connection_pool_default_options\n o = super.dup\n # Default to only a single connection if a memory database is used,\n # because otherwise each connection will get a separate database\n o[:max_connections] = 1 if @opts[:database] == ':memory:' || blank_object?(@opts[:database])\n o\n end", "def initialize(opts={})\n @keyspace = (opts[:keyspace] || raise(\"missing param: keyspace\")).to_s\n @servers = Array(opts[:servers] || '127.0.0.1:9160')\n @options = {}\n @options[:retries] = (opts[:retries] || DEFAULT_RETRIES).to_i\n @options[:timeout] = (opts[:timeout] || DEFAULT_TIMEOUT).to_f\n @options[:connect_timeout] = \n (opts[:connect_timeout] || DEFAULT_CONNECT_TIMEOUT).to_f\n @pool_size = (opts[:pool_size] || DEFAULT_POOL_SIZE).to_i\n @interval = (opts[:interval] || DEFAULT_INTERVAL).to_f\n @started = false\n @processing = false\n @timer = nil\n @queue = nil\n @pool = nil\n @proxy = nil\n @healthy = nil\n @semaphore = Mutex.new\n end", "def initialize(name, options = {})\n @name = name\n @description = options[:description] || name\n @version = options[:version] || ''\n @size = options[:size] || 2 * 1024 * 1024\n\n super(`window.openDatabase(#{name}, #{@version}, #{@description}, #{@size})`)\n end", "def initialize\n @database = Sequel.connect(ENV['DATABASE_URL'])\n end", "def initialize(db, options={})\n @db = db\n @db_tables = Schema::DbSchemaParser.for_db(db).parse_db_schema\n @db_table_names = @db.tables\n @indent = 0\n @result = []\n @separate_alter_table_statements = !!options[:separate_alter_table_statements]\n # Columns are only added and dropped, never altered. This helps\n # us support Redshift.\n @immutable_columns = !!options[:immutable_columns]\n end", "def initialize(options = {})\n @infile = options[:infile]\n @outfile = options[:outfile]\n @source = options[:source]\n @row_filter = RowFilter.new(options[:rows], df: options[:df])\n @positions = create_joiners(options[:joins], \n options[:cols], \n options[:pos])\n @headerless = options[:headerless].nil? ? false : options[:headerless]\n @header = Header.new(options[:header] || '*', \n pos: @positions, \n insert: options[:insert_header])\n create_lookup_table\n end", "def initialize(database, name)\n @database, @name = database, name.to_s\n end" ]
[ "0.7521988", "0.7294382", "0.67854095", "0.6767909", "0.6699676", "0.6573191", "0.64947", "0.64589053", "0.6436071", "0.6434783", "0.6425981", "0.6361566", "0.6345742", "0.63254035", "0.62744004", "0.6253118", "0.62489694", "0.62476593", "0.6246423", "0.62409467", "0.6236418", "0.6202532", "0.6168586", "0.6143567", "0.6128666", "0.61191356", "0.61052674", "0.60779923", "0.6068786", "0.6063693", "0.60567945", "0.6004927", "0.6002872", "0.59984946", "0.5998287", "0.59862083", "0.5958285", "0.59434956", "0.5935252", "0.5921738", "0.5908096", "0.5905385", "0.59041953", "0.58676594", "0.5854239", "0.5840594", "0.5824078", "0.5806772", "0.57943654", "0.57942605", "0.5771382", "0.5757916", "0.57230926", "0.5722419", "0.5710776", "0.5706766", "0.57017326", "0.5689612", "0.5679504", "0.5675645", "0.56720376", "0.5671618", "0.56574965", "0.5656889", "0.5655698", "0.5618928", "0.5598365", "0.5595721", "0.55942327", "0.55896145", "0.55851126", "0.5581197", "0.5578611", "0.55639863", "0.55558807", "0.55538976", "0.55347717", "0.5528917", "0.5526966", "0.55244875", "0.5520302", "0.5514573", "0.5503798", "0.55014855", "0.54942626", "0.5492682", "0.54900616", "0.5485682", "0.54831225", "0.5481682", "0.547959", "0.54789996", "0.5466113", "0.5465661", "0.54651475", "0.5463297", "0.54625297", "0.54550475", "0.545501", "0.5451955" ]
0.64364636
8
Freeze internal data structures for the Database instance.
def freeze valid_connection_sql metadata_dataset @opts.freeze @loggers.freeze @pool.freeze @dataset_class.freeze @dataset_modules.freeze @schema_type_classes.freeze @loaded_extensions.freeze # SEQUEL5: Frozen by default, remove this @default_dataset.freeze metadata_dataset.freeze super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freeze\n dataset_module.freeze\n overridable_methods_module.freeze\n\n @finder_loaders.freeze # SEQUEL5: Remove\n\n if @dataset\n @dataset.freeze\n @instance_dataset.freeze\n db_schema.freeze.each_value(&:freeze)\n columns.freeze\n setter_methods.freeze\n @finder_loaders.each_key{|k| finder_for(k)} # SEQUEL5: Remove\n else\n @setter_methods = [].freeze\n end\n\n @dataset_method_modules.freeze\n @default_set_fields_options.freeze\n @finders.freeze # SEQUEL5: Remove\n @plugins.freeze\n @allowed_columns.freeze if @allowed_columns # SEQUEL5: Remove\n\n super\n end", "def unfreeze; end", "def freeze\n return self if frozen?\n dataset_module.freeze\n overridable_methods_module.freeze\n\n if @dataset\n db_schema.freeze.each_value(&:freeze)\n columns.freeze\n setter_methods.freeze\n else\n @setter_methods = [].freeze\n end\n\n @dataset_method_modules.freeze\n @default_set_fields_options.freeze\n @plugins.freeze\n\n super\n end", "def flush_db\n [ 'active_sources', 'data_records', 'semantic_properties', 'semantic_relations', 'workflows'].reverse.each { |f| ActiveRecord::Base.connection.execute \"DELETE FROM #{f}\" }\n # Also remove the \"unsaved cache\" for the wrappers (may be important during testing)\n TaliaCore::SemanticCollectionWrapper.instance_variable_set(:'@unsaved_source_cache', {})\n end", "def close_database\n @database = nil\n @writable_database = nil\n GC.start\n end", "def close_database\n @database = nil\n @writable_database = nil\n GC.start\n end", "def freeze() end", "def freeze() end", "def freeze\n super\n\n @instance_insert_dataset.freeze if @instance_insert_dataset\n self\n end", "def freeze\n @row_types.freeze\n @row_schema_types.freeze\n @row_type_method_module.freeze\n super\n end", "def freeze; end", "def unfreeze\r\n self.update_attribute(:is_freezed, false)\r\n end", "def freeze\n @frozen = true\n end", "def unfreeze_all\n begin\n @model.start_operation \"Unfreeze everything\"\n puts \"Unfreezing everything...\" if @debug\n @entities.each { |e| \n if e.is_a? Sketchup::Group or e.is_a? Sketchup::ComponentInstance\n if e.locked? and not e.visible?\n puts \"Making '#{e}' entity visible and unlocked...\" if @debug\n e.locked = false\n e.visible = true\n end\n end\n }\n @model.commit_operation\n rescue Exception => e\n puts \"Error encountered: #{e}\" # Show even if debuggnig is off.\n @model.abort_operation\n end\n end", "def freeze!\n @frozen = true\n end", "def reinitialize_db\n drop_db\n initialize_db\n end", "def freeze\n @association_reflections.freeze.each_value(&:freeze)\n @autoreloading_associations.freeze.each_value(&:freeze)\n @default_association_options.freeze\n @default_association_type_options.freeze\n @default_association_type_options.each_value(&:freeze)\n\n super\n end", "def unfreeze(&block); end", "def freeze\n @get_column_conflicts.freeze\n @set_column_conflicts.freeze\n\n super\n end", "def freeze_data!\n @data = @data.to_smash(:freeze).freeze\n end", "def freeze\n @associations.freeze\n @definitions.freeze\n @scopes.freeze\n\n super\n end", "def database_reset\n @database = nil\n end", "def freeze\n @input_transformers.freeze\n @input_transformer_order.freeze\n @skip_input_transformer_columns.freeze.each_value(&:freeze)\n\n super\n end", "def freeze()\n gibbler_debug :FREEZE, self.class, caller[0] if Gibbler.debug?\n self.gibbler\n super\n self\n end", "def freeze!\n instance_variables.each {|v| eval(\"#{v}.freeze\")}\n self\n end", "def freeze\n @deserialization_map.freeze\n @serialization_map.freeze\n @serialization_module.freeze if @serialization_module\n\n super\n end", "def flushdb; end", "def freeze\n values.freeze\n changed_columns.freeze\n unless errors.frozen?\n validate\n errors.freeze\n end\n this.freeze if !new? && model.primary_key\n super\n end", "def freeze\n @auto_validate_not_null_columns.freeze\n @auto_validate_explicit_not_null_columns.freeze\n @auto_validate_max_length_columns.freeze\n @auto_validate_unique_columns.freeze\n\n super\n end", "def purge!\n db.transaction do |transaction|\n transaction.execute(\"DELETE FROM 'heap_objects'\")\n transaction.execute(\"DELETE FROM 'references'\")\n end\n self\n end", "def flushdb\n end", "def freeze\r\n self.update_attribute(:is_freezed, true)\r\n end", "def freeze\n end", "def freeze\n end", "def freeze\n reindex unless @clean\n super\n end", "def freeze\n @attributes.freeze; self\n end", "def freeze\n @attributes.freeze; self\n end", "def freeze\n values.freeze\n changed_columns.freeze\n unless errors.frozen?\n validate\n errors.freeze\n end\n this if !new? && model.primary_key\n super\n end", "def freeze\n initial_values.freeze\n missing_initial_values.freeze\n @previous_changes.freeze if @previous_changes\n super\n end", "def freeze\n super\n\n tools.hsh.deep_freeze(@to_h)\n\n self\n end", "def clean\n disable_referential_integrity do\n tables_cache.keys.reverse_each do |table|\n ActiveRecord::Base.connection.execute %(\n DELETE FROM #{table}\n )\n end\n end\n end", "def freeze\n @nested_attributes_module.freeze if @nested_attributes_module\n\n super\n end", "def reload(options = nil)\n clear_changes\n clear_relationships\n clear_composition_cache\n reset_attributes\n unless reload_from_database\n set_deleted_properties\n freeze\n end\n self\n end", "def freeze\n super\n # Nothing to do here\n extend Freezer\n self\n end", "def freeze\n @attributes.freeze\n self\n end", "def update_db\n ## Sequel\n drop_table\n create_table\n db.transaction do\n table.delete_sql\n install_manual\n install_updates\n end\n ## AR\n # self.transaction do\n # self.delete_all\n # self.install_manual\n # self.install_updates\n # end\n end", "def freeze_total_records_collection\n\t\tself.update_all(frozen_flag: true)\n\tend", "def freeze\n self\n end", "def reload!\n Aura.models.each { |m| m.send :set_columns, nil }\n end", "def compact\n load\n with_tmpfile do |path, file|\n # Compactified database has the same size -> return\n return self if @pos == file.write(dump(yield, @format.header))\n with_flock(File::LOCK_EX) do\n # Database was replaced (cleared or compactified) in the meantime\n if @pos != nil\n # Append changed journal records if the database changed during compactification\n file.write(read)\n file.close\n File.rename(path, @file)\n end\n end\n end\n open\n replay\n end", "def clear\n\t\t@data_base = {}\n\t\tupdate_database\n\tend", "def database\n database = @writable_database || (@database ||= Xapian::Database.new(path))\n \n if self.expired?\n puts 'reloaded'\n database.reopen \n end\n \n database\n end", "def sync_data\n\t\tSYNC_TABLES.each do |sync|\n\t\t\tself.sync_table(sync)\n\t\tend\n\tend", "def freeze\n freeze_all_instance_variables\n\n super\n end", "def freeze\n @hash.freeze\n end", "def freeze\n freeze!\n attributes.freeze\n super\n end", "def freeze\n unless frozen?\n @left.freeze\n @middle.freeze\n @right.freeze\n @frozen = true\n end\n self\n end", "def deep_freeze!\n replace deep_thaw.deep_freeze\n end", "def hard_clean!\n open_db\n @file.truncate(PREAMBLE_SIZE)\n write_fresh_database\n end", "def close\n @dbman.close\n @dbprot.clear\n end", "def freeze()\n deep_freeze(@contents)\n super\n end", "def freeze\n @typecast_on_load_columns.freeze\n\n super\n end", "def reload(*)\n super.tap do\n @mutations_before_last_save = nil\n @mutations_from_database = nil\n end\n end", "def clear_caches\n ar_stubs.each(&:reset_column_information)\n ActiveRecord::Base.connection.schema_cache.clear!\n end", "def clean_db\n\n puts \"Caching wikipedia links\"\n @wikipedia_cache = {}\n Artist.all\n .where('wikilink IS NOT NULL')\n .pluck( 'name' , 'wikilink' )\n .each { |result| @wikipedia_cache[ key_name(result[0]) ] = result[1] }\n\n puts \"Cleaning db\"\n PlayerState.delete_all\n PlayListSong.delete_all\n Song.delete_all\n Album.delete_all\n Artist.delete_all\n end", "def rebuild\n @logger.debug('rebuild()')\n self.destroy\n self.up\n end", "def commit\n # Nothing to do for an in memory database\n end", "def reset\n synchronize do\n @table = nil\n @instances = nil\n @codes = nil\n end\n end", "def initialize_database\n @db = SQLite3::Database.new @database_path\n File.chmod 0600, @database_path\n begin\n @db.execute 'drop table if exists host;'\n @db.execute <<-SQL\n create table host (\n id INT,\n name varchar(254)\n );\n SQL\n sync_host_table\n rescue\n File.unlink @database_path\n raise\n end\n end", "def _sync\n # Reset the stash map to ensure that it's reset before the next\n # transaction is being started.\n @_stash_map = nil\n\n db_obj = {\n 'class_id' => @store.class_map.class_to_id(self.class.to_s),\n 'data' => _serialize\n }\n @store.db.put_object(db_obj, @_id)\n end", "def clear\n @db.clear\n self\n end", "def freeze\n attributes.freeze\n end", "def flushdb(options = T.unsafe(nil)); end", "def unstarted_db\n @db ||= Database.new\n raise \"database was already started\" if @db.running?\n @db\n end", "def frozen!\n @frozen = true\n end", "def flushdb\n on_each_node :flushdb\n end", "def exit\n if @cache && @cache.in_transaction?\n @cache.abort_transaction\n @cache.flush\n @db.close if @db\n PEROBS.log.fatal \"You cannot call exit() during a transaction: #{Kernel.caller}\"\n end\n @cache.flush if @cache\n @db.close if @db\n\n GC.start\n if @stats\n unless @stats[:created_objects] == @stats[:collected_objects] +\n @in_memory_objects.length\n PEROGS.log.fatal \"Created objects count \" +\n \"(#{@stats[:created_objects]})\" +\n \" is not equal to the collected count \" +\n \"(#{@stats[:collected_objects]}) + in_memory_objects count \" +\n \"(#{@in_memory_objects.length})\"\n end\n end\n\n @db = @class_map = @in_memory_objects = @stats = @cache =\n @root_objects = nil\n end", "def finalize!\n return self if frozen?\n\n super\n freeze\n end", "def freeze\n @properties.freeze; self\n end", "def freeze\n @original_deserialized_values ||= {}\n @original_deserialized_values.freeze\n super\n end", "def clean!\n @data = freezer(@data.merge(@dirty))\n @dirty.clear\n self\n end", "def freeze\n associations\n super\n associations.freeze\n self\n end", "def flush_database\n\t\t\tp \"Flushing Database\"\n\t\t\tAdmin.destroy_all\n\t\t\tCountry.destroy_all\n\t\t\tDoorkeeper::Application.destroy_all\n\t\tend", "def unload!\n @versions = nil\n @version_json = {}\n @last_update = {}\n @maps = {}\n @mappings = nil\n end", "def flush_schema_cache\n raw_cache_control.flushSchemaCache\n end", "def down\n Widget.update_all data_table_id: nil\n\n [DataTableDataset, DataRow, DataTable].each do |clazz|\n clazz.delete_all\n end\n end", "def dematerialize ; end", "def reset_db\n \n end", "def reset!\n hold do |conn|\n conn.exec 'DROP TABLE IF EXISTS message_bus'\n create_table(conn)\n end\n end", "def flush\n conn.transaction do\n buffer.flatten.each do |row|\n # check to see if this row's compound key constraint already exists\n # note that the compound key constraint may not utilize virtual fields\n next unless row_allowed?(row)\n\n # add any virtual fields\n add_virtuals!(row)\n \n names = []\n values = []\n order.each do |name|\n names << \"`#{name}`\"\n values << conn.quote(row[name]) # TODO: this is probably not database agnostic\n end\n q = \"INSERT INTO `#{table_name}` (#{names.join(',')}) VALUES (#{values.join(',')})\"\n ETL::Engine.logger.debug(\"Executing insert: #{q}\")\n conn.insert(q, \"Insert row #{current_row}\")\n @current_row += 1\n end\n buffer.clear\n end\n end", "def db_setup\n log_debug\n db_file = find_db\n db_tmp = '/tmp/plex_missing_tmp.db'\n @db = ''\n \n # cp to tmp as the db is locked if being used\n `cp \"#{db_file}\" #{db_tmp}`\n \n # not too sure why but i was having a problem where a 0 byte file was cp'd\n # def a local issue i assume but the check was needed\n if test ?s, db_tmp\n @db = SQLite3::Database.new db_tmp\n else \n puts \"error-> can not open #{db_tmp} for reasing\"\n exit 2\n end\n end", "def out_of_band()\n @workspace.database.transact_with(@workspace) do |transaction|\n yield(transaction)\n end\n end", "def unstarted_db\n @db ||= Neo4j::Core::Database.new\n raise \"database was already started\" if @db.running?\n @db\n end", "def teardown\n @db.close\n super\n end", "def fill_out\n @build = {}\n descend(@schema, [])\n @build\n end", "def pack\r\n raise \"Do not execute this method in client/server mode!\" if \\\r\n @db.client?\r\n\r\n lines_deleted = @db.engine.pack_table(self)\r\n\r\n update_header_vars\r\n\r\n @db.engine.remove_recno_index(@name)\r\n @db.engine.remove_indexes(@name)\r\n create_indexes\r\n create_table_class unless @db.server?\r\n\r\n return lines_deleted\r\n end", "def db_clear\n [Project, Milestone, Category, Version, LoaderRelease].each(&:delete_all)\n end", "def reset_data\n @pg_data_table = {}\n @gameview_data_table = {}\n @userlist_table = {}\n @last_parsed_pglist_data = []\n @last_parsed_userlist_data = []\n end", "def flush_schema\n if raw_mondrian_connection && (rolap_schema = raw_mondrian_connection.getSchema)\n raw_cache_control.flushSchema(rolap_schema)\n end\n end", "def shutdown\n\n @db.connection.close\n end" ]
[ "0.6765147", "0.6468942", "0.63098174", "0.6265448", "0.6214151", "0.6214151", "0.61635923", "0.61635923", "0.6125169", "0.6117258", "0.60580003", "0.6024745", "0.60143214", "0.6008031", "0.5987939", "0.59844863", "0.59752005", "0.59534615", "0.5897359", "0.5877466", "0.58736295", "0.58322096", "0.58096963", "0.5805915", "0.5747933", "0.5747458", "0.5740595", "0.5733418", "0.5673653", "0.5662462", "0.5653595", "0.55949855", "0.557864", "0.557864", "0.5553629", "0.5550522", "0.5550522", "0.5550345", "0.5534044", "0.5491467", "0.5479057", "0.5460309", "0.54584783", "0.5458333", "0.54566157", "0.5454547", "0.54440707", "0.54413885", "0.5437481", "0.5428495", "0.5413148", "0.5405173", "0.53756756", "0.5367564", "0.5366853", "0.5343296", "0.533241", "0.5325631", "0.53163594", "0.525595", "0.5254895", "0.5225128", "0.52250546", "0.52227354", "0.52159274", "0.5199705", "0.51877534", "0.51841414", "0.5183259", "0.51777834", "0.51768446", "0.51748896", "0.51734495", "0.51722974", "0.51704013", "0.51639295", "0.5152639", "0.5149982", "0.5149717", "0.51479715", "0.51413023", "0.51350164", "0.5134465", "0.5124438", "0.5120466", "0.51111495", "0.5104332", "0.5102713", "0.51010674", "0.50908285", "0.5085292", "0.50845456", "0.5079874", "0.5078015", "0.5075842", "0.5068567", "0.5066181", "0.50648826", "0.5044859", "0.50447536" ]
0.67266506
1
Cast the given type to a literal type DB.cast_type_literal(Float) double precision DB.cast_type_literal(:foo) foo
def cast_type_literal(type) type_literal(:type=>type) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arel_cast(value, type, quote_value: true, literalize_type: true)\n value = arel_quoted(value) if quote_value\n type = Arel.sql(type) if literalize_type\n\n as_expr = Arel::Nodes::As.new value, type\n\n arel_fn 'CAST', as_expr\n end", "def cast(val, type)\n val = Convert(val)\n kind = val.type.kind\n type = LLVM::Script::Validate(type, :type)\n if kind == :integer && type.kind == :integer\n @builder.int_cast(val, type)\n elsif LLVM::Script::Decimal(kind) && LLVM::Script::Decimal(type.kind)\n @builder.fp_cast(val, type)\n elsif kind == :pointer && type.kind == :pointer\n @builder.pointer_cast(val, type)\n else\n raise ArgumentError, \"Value and type passed to cast are not both of Integer, Float, or Pointer.\"\n end\n end", "def type_literal_generic_float(column)\n :\"double precision\"\n end", "def type_literal(column)\n case column[:type]\n when Class\n type_literal_generic(column)\n when :Bignum\n type_literal_generic_bignum_symbol(column)\n else\n type_literal_specific(column)\n end\n end", "def type_cast(value, type)\n return nil if value.nil?\n case type\n when :string then value\n when :text then value\n when :money then string_to_money(value)\n when :integer then value.to_i rescue value ? 1 : 0\n when :float then value.to_f\n when :datetime then string_to_time(value)\n when :timestamp then string_to_time(value)\n when :time then string_to_dummy_time(value)\n when :date then string_to_date(value)\n when :boolean then value_to_boolean(value)\n else value\n end\n end", "def cast(arg, sql_type)\n SQL::Cast.new(arg, sql_type)\n end", "def type_literal(t)\n t.is_a?(Symbol) ? t.to_s : literal(t)\n end", "def cast(value, type)\n case type\n when :string\n value\n when :integer\n value.to_i\n when :float\n value.to_f\n when :percent\n value.to_f\n when :currency\n BigDecimal(value)\n when :time\n value.to_i\n when :date\n parse_date(value)\n end\n end", "def type_cast(value)\r\n @column_definition.type_cast(value)\r\n end", "def typecast_value(column_type, value)\n return nil if value.nil?\n case column_type\n when :integer\n Integer(value)\n when :string\n value.to_s\n when :float\n Float(value)\n when :decimal\n case value\n when BigDecimal\n value\n when String, Float\n value.to_d\n when Integer\n value.to_s.to_d\n else\n raise ArgumentError, \"invalid value for BigDecimal: #{value.inspect}\"\n end\n when :boolean\n case value\n when false, 0, \"0\", /\\Af(alse)?\\z/i\n false\n else\n value.blank? ? nil : true\n end\n when :date\n case value\n when Date\n value\n when DateTime, Time\n Date.new(value.year, value.month, value.day)\n when String\n value.to_date\n else\n raise ArgumentError, \"invalid value for Date: #{value.inspect}\"\n end\n when :time\n case value\n when Time\n value\n when String\n value.to_time\n else\n raise ArgumentError, \"invalid value for Time: #{value.inspect}\"\n end\n when :datetime\n raise(ArgumentError, \"invalid value for #{tc}: #{value.inspect}\") unless value.is_one_of?(DateTime, Date, Time, String)\n if Sequel.datetime_class === value\n # Already the correct class, no need to convert\n value\n else\n # First convert it to standard ISO 8601 time, then\n # parse that string using the time class.\n (Time === value ? value.iso8601 : value.to_s).to_sequel_time\n end\n else\n value\n end\n end", "def type_cast(value)\n case type\n when 'N' # number\n unpack_number(value)\n when 'I' # integer\n unpack_unsigned_long(value)\n when 'F' # float\n unpack_float(value)\n when 'D' # date\n decode_date(value)\n when 'T' # datetime\n decode_datetime(value)\n when 'L' # logical\n boolean(value)\n else\n value.to_s.strip\n end\n end", "def from_database_type(obj)\n case obj\n when String, Float, Integer, NilClass, TrueClass, FalseClass\n obj\n when java.sql.Date, java.sql.Time, java.sql.Timestamp\n Time.at(obj.time/1000)\n when java.sql.Blob\n String.from_java_bytes(obj.get_bytes(1,obj.length))\n when java.sql.Clob\n obj.get_sub_string(1, obj.length)\n when java.math.BigDecimal\n BigDecimal.new(obj.to_s)\n else\n raise \"Can't find correct type to convert #{obj.inspect} into\"\n end\n end", "def type_cast(value, type = self.type)\n case type\n when :counter\n type_cast(value, :integer).to_i\n when :integer\n Kernel::Integer(value) rescue nil if value\n when :float\n Kernel::Float(value) rescue nil if value\n when :timestamp\n value = type_cast(value, :integer)\n Time.at(value) if value\n else\n value\n end\n end", "def type_literal_base(column)\n TYPES[column[:type]]\n end", "def type_literal_generic_bigdecimal(column)\n type_literal_generic_numeric(column)\n end", "def ruby_from_volt(val, type)\n return nil if val.nil?\n\n case type\n when Types::DECIMAL then dec_from_str(val)\n when Types::TIMESTAMP then time_from_milli_epoch(val)\n else val\n end\n end", "def cast_string(arg, sql_type = nil)\n cast(arg, sql_type || String).sql_string\n end", "def type_literal_specific(column)\n type = column[:type]\n type = \"double precision\" if type.to_s == 'double'\n column[:size] ||= default_string_column_size if type.to_s == 'varchar'\n elements = column[:size] || column[:elements]\n \"#{type}#{literal(Array(elements)) if elements}#{' UNSIGNED' if column[:unsigned]}\"\n end", "def type_literal(column)\n type = type_literal_base(column)\n column[:size] ||= 255 if type.to_s == 'varchar'\n elements = column[:size] || column[:elements]\n \"#{type}#{literal(Array(elements)) if elements}#{UNSIGNED if column[:unsigned]}\"\n end", "def type_literal_generic_object(column)\n type_literal_generic_string(column)\n end", "def typecast(value)\n return type.typecast(value, self) if type.respond_to?(:typecast)\n return value if value.kind_of?(primitive) || value.nil?\n begin\n # TODO: optimize this using a Hash lookup table\n if primitive == Integer\n # only typecast a String that looks like a number\n value.to_s =~ /\\A(-?(?:0+|[1-9]\\d*)(?:\\.\\d+)?)\\z/ ? $1.to_i : value\n elsif primitive == String then value.to_s\n elsif primitive == TrueClass then %w[ true 1 t ].include?(value.to_s.downcase)\n elsif primitive == BigDecimal then BigDecimal(value.to_s)\n elsif primitive == Float then value.to_f\n elsif primitive == DateTime then typecast_to_datetime(value)\n elsif primitive == Time then typecast_to_time(value)\n elsif primitive == Date then typecast_to_date(value)\n elsif primitive == Class then self.class.find_const(value)\n else\n value\n end\n rescue\n value\n end\n end", "def type_literal_base(column)\n TYPES[column[:type]]\n end", "def type_literal_generic_symbol(column)\n type_literal_generic_string(column)\n end", "def cast_numeric(arg, sql_type = nil)\n cast(arg, sql_type || Integer).sql_number\n end", "def convert_to_data_type_from_string(type, value)\n case type\n when \"boolean\"\n # Since we've determined this is a boolean data type, we can assume that:\n # If the value as an int is 1, return true\n # If the value as an int is 0 (not 1), return false\n value.to_i == 1\n when \"integer\"\n value.to_i\n when \"float\"\n value.to_f\n when \"string\", \"dictionary\"\n value\n when nil\n \"\"\n else\n raise \"Unknown or unsupported data type: #{type.class}\"\n end\n end", "def cast_value(value)\n case value_type\n when 'integer' then value.to_i\n when 'float' then value.to_f\n when 'string' then value.to_s\n else raise_invalid_type\n end\n end", "def type_literal(column)\n column[:size] ||= 255 if column[:type] == :varchar\n elements = column[:size] || column[:elements]\n \"#{type_literal_base(column)}#{literal(Array(elements)) if elements}#{UNSIGNED if column[:unsigned]}\"\n end", "def typecaster(val, type)\n case type.to_sym\n when :string then val.to_s\n when :integer then val.to_i\n else\n raise \"Typecaster: i don't know this type: #{type}.\"\n end\n end", "def sql_cast_as(new_type, castable)\n casting = Arel::Nodes::As.new castable, Arel::Nodes::SqlLiteral.new(new_type.to_s.upcase)\n Arel::Nodes::NamedFunction.new 'CAST', [casting]\n end", "def typecast(value)\n value\n end", "def type_literal_generic_module(column)\n type_literal_generic_string(column)\n end", "def handle_float(float, lineno_column)\n Literal.new float.to_f\n end", "def cast_string(sql_type = nil)\n cast(sql_type || :text).sql_string\n end", "def typecast(type, thing, opt={})\n # Nothing to do\n return thing if type.is_a?(Class) && thing.is_a?(type)\n\n # Nothing wrong with nil for our purposes; it's always allowed\n return thing if thing.nil?\n\n # For all current cases, attempting to typecast a blank string should return nil\n return nil if thing =~ /\\A\\s*\\Z/ \n\n # The order we try these in matters\n return tc_bigdecimal(thing) if type == BigDecimal \n return tc_float(thing) if type == Float \n return tc_integer(thing) if type == Integer \n return tc_date(thing) if type == Date \n return tc_time(thing) if type == Time \n return tc_boolean(thing) if type == :boolean \n\n fail Pod4Error, \"Bad type passed to typecast()\"\n rescue ArgumentError\n return (opt[:strict] ? nil : thing)\n end", "def cast_numeric(sql_type = nil)\n cast(sql_type || :integer).sql_number\n end", "def type_conversion(value_data, type) \n case type\n when 'boolean'\n return to_boolean(value_data) \n when 'int'\n val = Integer(value_data)\n if (val < -2147483648) || (val > 2147483647)\n raise \"Integer out of range: #{val}\" \n end\n return val\n when 'long'\n val = Integer(value_data)\n if (val < -9223372036854775808) || (val > 9223372036854775807)\n raise \"Long out of range: #{val}\" \n end\n return val\n when 'double'\n return Float(value_data)\n when 'string'\n return value_data\n else\n raise \"Unsupported type: #{type}\" \n end \n end", "def cast(data_type)\n case data_type\n when String\n new_jcolumn = jcolumn.cast(data_type)\n when DataType\n jdata_type = JDataType.fromJson(data_type.json)\n new_jcolumn = jcolumn.cast(jdata_type)\n else\n raise ArgumentError, \"Unsupported type: #{data_type.class}\"\n end\n\n Column.new(new_jcolumn)\n end", "def revert_type_literal_internal( type, ruby_type )\n return :boolean, :default_size => 1 if ruby_type == :boolean\n\n method = \"revert_#{db.database_type}_type\"\n specific_type = send( method, type ) if respond_to?( method, true )\n\n specific_type || revert_generic_type( type ) || ruby_type\n end", "def bitcast(val, type)\n @builder.bit_cast(Convert(val), LLVM::Script::Validate(type, :type))\n end", "def typecast(value)\n value\n end", "def type_literal_generic_numeric(column)\n column[:size] ? \"numeric(#{Array(column[:size]).join(', ')})\" : :numeric\n end", "def type_literal_generic_fixnum(column)\n type_literal_generic_integer(column)\n end", "def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n if type == :decimal\n # Force an explicit scale if none supplied to specify the fixed\n # point form of Virtuoso's DECIMAL type. If no scale is specified,\n # the Virtuoso DECIMAL type stores floating point values.\n precision ||= 32\n scale ||= 0\n end\n super(type, limit, precision, scale)\n end", "def revert_type_literal( type, ruby_type )\n\n case type\n when /\\(\\s*(\\d+)\\s*\\)/\n size = $1.to_i\n when /\\(([\\s\\d,]+)\\)/\n size = $1.split( ',' ).map{ |x| x.to_i }\n end\n\n type, opts = revert_type_literal_internal( type, ruby_type )\n\n opts ||= {}\n\n default_size = opts.delete( :default_size )\n\n if size and size != default_size\n opts[ :size ] = size\n end\n\n [ type, opts ]\n end", "def cast(param, type)\n if param.nil?\n return nil\n elsif type == Integer\n return Integer(param)\n elsif type == String\n return String(param)\n elsif type == Float\n return Float(param)\n elsif type == Date\n return Date.parse(param)\n elsif type == Time\n return Time.parse(param)\n end\n rescue ArgumentError\n errors.append(I18n.t('digget.cast', param: param, type: type))\n end", "def cast_attribute(value, type_name)\n case type_name\n when :integer then value.to_i\n when :float then value.to_f\n when :boolean then !!value\n else value\n end\n end", "def convert_to_type(value, type)\n return nil if value.nil?\n\n #Not keen on type hack for case statement\n case type.to_s\n when \"String\"\n value.to_s\n when \"Integer\"\n value.to_i\n when \"Float\"\n value.to_f\n when \"DateTime\"\n DateTime.parse(value.to_s)\n when \"Time\"\n Time.at(value.to_f)\n when \"Date\"\n Date.new(value.year, value.month, value.day)\n when \"TrueClass\"\n convert_boolean(value)\n when \"Boolean\"\n convert_boolean(value)\n else\n type.from_json(value) rescue value\n end\n end", "def as_literal(object)\n case object\n when Float\n literal = RDF::Literal(object, canonicalize: true)\n literal.instance_variable_set(:@string, literal.to_s.downcase)\n literal\n else\n RDF::Literal(object, canonicalize: true)\n end\n end", "def revert_postgres_type( type )\n case type\n when /\\Acharacter varying/\n return :String, :default_size => 255\n when /\\Acharacter/\n return :String, :fixed => true, :default_size => 255\n when /\\Atext\\z/\n return :String, :text => true\n when /\\Abytea\\z/\n return :blob\n when /\\Atimestamp/\n return :timestamp\n end\n end", "def type_cast(value, type)\n case value\n when Array\n value.collect { |v| type_cast(v, type) }\n else\n # Let's leverage ActiveRecord's type casting, so that casting is consistent\n # with the other models.\n column_for_type_cast = ::ActiveRecord::ConnectionAdapters::Column.new(\"\", nil)\n column_for_type_cast.instance_variable_set(:@type, type)\n value = column_for_type_cast.type_cast(value)\n Time.zone && value.is_a?(Time) ? value.in_time_zone : value\n end\n end", "def typecast(value)\n return value if type === value || (value.nil? && type != TrueClass)\n\n if type == TrueClass then %w[ true 1 t ].include?(value.to_s.downcase)\n elsif type == String then value.to_s\n elsif type == Float then value.to_f\n elsif type == Fixnum then value.to_i\n elsif type == BigDecimal then BigDecimal(value.to_s)\n elsif type == DateTime then DateTime.parse(value.to_s)\n elsif type == Date then Date.parse(value.to_s)\n elsif type == Class then find_const(value)\n end\n end", "def type_literal_generic(column)\n meth = \"type_literal_generic_#{column[:type].name.to_s.downcase}\"\n if respond_to?(meth, true)\n # Allow calling private methods as per type literal generic methods are private\n send(meth, column)\n else\n raise Error, \"Unsupported ruby class used as database type: #{column[:type]}\"\n end\n end", "def type_to_sql(type, limit: nil, precision: nil, scale: nil, **) # :nodoc:\n # MSSQL's NVARCHAR(n | max) column supports either a number between 1 and\n # 4000, or the word \"MAX\", which corresponds to 2**30-1 UCS-2 characters.\n #\n # It does not accept NVARCHAR(1073741823) here, so we have to change it\n # to NVARCHAR(MAX), even though they are logically equivalent.\n #\n # See: http://msdn.microsoft.com/en-us/library/ms186939.aspx\n #\n type = type.to_sym if type\n native = native_database_types[type]\n\n if type == :string && limit == 1_073_741_823\n 'nvarchar(max)'\n elsif NO_LIMIT_TYPES.include?(type)\n super(type)\n elsif %i[int integer].include?(type)\n if limit.nil? || limit == 4\n 'int'\n elsif limit == 2\n 'smallint'\n elsif limit == 1\n 'tinyint'\n else\n 'bigint'\n end\n elsif type == :uniqueidentifier\n 'uniqueidentifier'\n elsif %i[datetime time].include?(type)\n precision ||= 7\n column_type_sql = (native.is_a?(Hash) ? native[:name] : native).dup\n if (0..7).include?(precision)\n column_type_sql << \"(#{precision})\"\n else\n raise(\n ArgumentError,\n \"No #{native[:name]} type has precision of #{precision}. The \" \\\n 'allowed range of precision is from 0 to 7, even though the ' \\\n 'sql type precision is 7 this adapter will persist up to 6 ' \\\n 'precision only.'\n )\n end\n else\n super\n end\n end", "def cast(sval)\n case sid\n when 'integer' then sval.to_i\n when 'string', 'text' then sval\n when 'boolean' then BoolTrueReps.member?(sval.to_s)\n when 'float' then sval.to_f\n when 'date' then sval && Date.parse(sval)\n else raise \"Don't know how to handle MetaPropertyType with sid '#{sid}'.\"\n end\n end", "def convert(value, type)\n begin\n case type\n when 'json' then JSON.parse(value)\n when 'base64' then JSON.parse(Base64.decode64(value))\n when 'integer' then Integer(value)\n when 'number' then Float(value)\n else\n value.to_s\n end\n rescue ArgumentError\n value.to_s\n end\n end", "def type_of literal\n case literal.sexp_type\n when :true, :false\n 'unsigned char'\n when :array\n \"#{ type_of(literal.sexp_body.first) }[#{ literal.sexp_body.count }]\"\n when :lit\n case literal.sexp_body.first.class.name\n when 'NilClass', 'Fixnum', 'Bignum'\n 'signed long'\n when 'Float'\n 'float'\n else\n raise \"Unsupported type #{literal.sexp_body.first.class.name} used: #{literal.sexp_body.first}\"\n end\n end\n end", "def literal(v)\n case v\n when LiteralString\n v\n when String\n \"'#{v.gsub(/\\\\/, \"\\\\\\\\\\\\\\\\\").gsub(/'/, \"''\")}'\"\n when Integer, Float\n v.to_s\n when BigDecimal\n v.to_s(\"F\")\n when NilClass\n NULL\n when TrueClass\n BOOL_TRUE\n when FalseClass\n BOOL_FALSE\n when Symbol\n symbol_to_column_ref(v)\n when ::Sequel::SQL::Expression\n v.to_s(self)\n when Array\n v.all_two_pairs? ? literal(v.sql_expr) : (v.empty? ? '(NULL)' : \"(#{v.collect{|i| literal(i)}.join(COMMA_SEPARATOR)})\")\n when Hash\n literal(v.sql_expr)\n when Time, DateTime\n v.strftime(TIMESTAMP_FORMAT)\n when Date\n v.strftime(DATE_FORMAT)\n when Dataset\n \"(#{v.sql})\"\n else\n raise Error, \"can't express #{v.inspect} as a SQL literal\"\n end\n end", "def get_value(literal)\n if literal.typed?\n literal.humanize\n else\n # Hack to fix incorrect dattime\n case literal.to_s\n when RDF::Literal::Duration::GRAMMAR\n get_value(RDF::Literal::Duration.new(literal))\n when RDF::Literal::Date::GRAMMAR\n get_value(RDF::Literal::Date.new(literal))\n when RDF::Literal::Time::GRAMMAR\n get_value(RDF::Literal::Time.new(literal))\n when RDF::Literal::DateTime::GRAMMAR\n get_value(RDF::Literal::DateTime.new(literal))\n when %r(\\A-?\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2})?(\\.\\d+)?(([\\+\\-]\\d{2}:\\d{2})|UTC|Z)?\\Z)\n # Hack to fix incorrect DateTimes in examples:\n get_value(RDF::Literal::DateTime.new(literal))\n else\n literal.to_s\n end\n end\n end", "def column_type(type_indicator)\n case type_indicator\n when :eval; :text\n when :text; :text\n when :string; :string\n when :sec; :double\n when :msec; :double\n when :duration; :double\n when :float; :double\n when :double; :double\n when :integer; :integer\n when :int; :int\n when :timestamp; :datetime\n when :datetime; :datetime\n when :date; :date\n else :string\n end\n end", "def typecast(value)\n case value\n when %r{\\Atrue\\z}i then true\n when %r{\\Afalse\\z}i then false\n when %r{\\A\\s*\\z}i then nil\n else\n begin\n begin\n Integer(value)\n rescue StandardError\n Float(value)\n end\n rescue StandardError\n unescape_value(value)\n end\n end\n end", "def typecast_value(column, value)\n return value unless typecast_on_assignment && db_schema && (col_schema = db_schema[column])\n value = nil if '' == value and typecast_empty_string_to_nil and col_schema[:type] and ![:string, :blob].include?(col_schema[:type])\n raise(InvalidValue, \"nil/NULL is not allowed for the #{column} column\") if raise_on_typecast_failure && value.nil? && (col_schema[:allow_null] == false)\n begin\n model.db.typecast_value(col_schema[:type], value)\n rescue InvalidValue\n raise_on_typecast_failure ? raise : value\n end\n end", "def typecast_value(column, value)\n return value unless typecast_on_assignment && db_schema && (col_schema = db_schema[column])\n value = nil if '' == value and typecast_empty_string_to_nil and col_schema[:type] and ![:string, :blob].include?(col_schema[:type])\n raise(InvalidValue, \"nil/NULL is not allowed for the #{column} column\") if raise_on_typecast_failure && value.nil? && (col_schema[:allow_null] == false)\n begin\n model.db.typecast_value(col_schema[:type], value)\n rescue InvalidValue\n raise_on_typecast_failure ? raise : value\n end\n end", "def type_to_sql(*args); connection.type_to_sql(*args); end", "def type_literal_generic_string(column)\n if column[:text]\n uses_clob_for_text? ? :clob : :text\n elsif column[:fixed]\n \"char(#{column[:size]||default_string_column_size})\"\n else\n \"varchar(#{column[:size]||default_string_column_size})\"\n end\n end", "def typecast_value(column, value)\n return value unless typecast_on_assignment && db_schema && (col_schema = db_schema[column]) && !model.serialized?(column)\n value = nil if value == '' and typecast_empty_string_to_nil and col_schema[:type] and ![:string, :blob].include?(col_schema[:type])\n raise(Error::InvalidValue, \"nil/NULL is not allowed for the #{column} column\") if raise_on_typecast_failure && value.nil? && (col_schema[:allow_null] == false)\n begin\n model.db.typecast_value(col_schema[:type], value)\n rescue Error::InvalidValue\n if raise_on_typecast_failure\n raise\n else\n value\n end\n end\n end", "def type2type(type)\n case type\n when :char, :int8\n Fiddle::TYPE_CHAR\n when :uchar, :uint8\n -Fiddle::TYPE_CHAR\n when :short, :int16\n Fiddle::TYPE_SHORT\n when :ushort, :uint16\n -Fiddle::TYPE_SHORT\n when :int, :int32\n Fiddle::TYPE_INT\n when :uint, :uint32\n -Fiddle::TYPE_INT\n when :bool\n Fiddle::TYPE_INT\n when :long\n Fiddle::TYPE_LONG\n when :ulong\n -Fiddle::TYPE_LONG\n when :long_long, :int64\n Fiddle::TYPE_LONG_LONG\n when :ulong_long, :uint64\n -Fiddle::TYPE_LONG_LONG\n when :float\n Fiddle::TYPE_FLOAT\n when :double\n Fiddle::TYPE_DOUBLE\n when :size_t\n Fiddle::TYPE_SIZE_T\n when :string, :pointer\n Fiddle::TYPE_VOIDP\n when :void\n Fiddle::TYPE_VOID\n else\n raise \"unknown type #{type}\"\n end\n end", "def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless NO_LIMIT_TYPES.include?(t = type.to_s.downcase.to_sym)\n\n native_type = NATIVE_DATABASE_TYPES[t]\n native_type.is_a?(Hash) ? native_type[:name] : native_type\n end", "def type_literal_generic_string(column)\n if column[:text]\n :text\n elsif column[:fixed]\n \"char(#{column[:size]||default_string_column_size})\"\n elsif column[:text] == false || column[:size]\n \"varchar(#{column[:size]||default_string_column_size})\"\n else\n :text\n end\n end", "def cast_string(sql_type = nil)\n Cast.new(self, sql_type || String).sql_string\n end", "def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = false)\n case type.to_s\n when 'binary'\n case limit\n when 0..0xfff; \"varbinary(#{limit})\"\n when nil; \"blob\"\n when 0x1000..0xffffffff; \"blob(#{limit})\"\n else raise(ActiveRecordError, \"No binary type has character length #{limit}\")\n end\n when 'integer'\n case limit\n when 1\n 'tinyint' + (unsigned ? ' unsigned' : '')\n when 2\n 'smallint' + (unsigned ? ' unsigned' : '')\n when 3\n 'mediumint' + (unsigned ? ' unsigned' : '')\n when nil, 4, 11 # compatibility with MySQL default\n if unsigned\n 'int(10) unsigned'\n else\n 'int(10)'\n end\n when 5..8\n 'bigint' + (unsigned ? ' unsigned' : '')\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}\")\n end\n when 'text'\n case limit\n when 0..0xff; 'tinytext'\n when nil, 0x100..0xffff; 'text'\n when 0x10000..0xffffff; 'mediumtext'\n when 0x1000000..0xffffffff; 'longtext'\n else raise(ActiveRecordError, \"No text type has character length #{limit}\")\n end\n else\n super\n end\n end", "def coerce_type_to_symbol\n @type = @type.to_sym\n end", "def cast_type(name)\n sphinx_attribute(name).type\n end", "def type_literal_generic_set(column)\n type_literal_generic_string(column)\n end", "def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super if defined?(::Jdbc::H2) || type.to_s != 'integer' || limit == nil\n\n type\n end", "def schema_column_type(db_type)\n case db_type\n when /\\Ainterval\\z/io\n :interval\n when /\\Acitext\\z/io\n :string\n else\n super\n end\n end", "def normalise_type(type, length)\n sql_type = case type\n when /^Auto ?Counter$/\n 'int'\n\n when /^Unsigned ?Integer$/,\n /^Signed ?Integer$/,\n /^Unsigned ?Small ?Integer$/,\n /^Signed ?Small ?Integer$/,\n /^Unsigned ?Tiny ?Integer$/\n s = case\n when length == nil\n 'int'\n when length <= 8\n 'tinyint'\n when length <= 16\n 'smallint'\n when length <= 32\n 'int'\n else\n 'bigint'\n end\n length = nil\n s\n\n when /^Decimal$/\n 'decimal'\n\n when /^Fixed ?Length ?Text$/, /^Char$/\n 'char'\n when /^Variable ?Length ?Text$/, /^String$/\n 'varchar'\n when /^Large ?Length ?Text$/, /^Text$/\n 'text'\n\n when /^Date ?And ?Time$/, /^Date ?Time$/\n 'datetime'\n when /^Date$/\n 'datetime' # SQLSVR 2K5: 'date'\n when /^Time$/\n 'datetime' # SQLSVR 2K5: 'time'\n when /^Auto ?Time ?Stamp$/\n 'timestamp'\n\n when /^Guid$/\n 'uniqueidentifier'\n when /^Money$/\n 'decimal'\n when /^Picture ?Raw ?Data$/, /^Image$/\n 'image'\n when /^Variable ?Length ?Raw ?Data$/, /^Blob$/\n 'varbinary'\n when /^BIT$/\n 'bit'\n when /^BOOLEAN$/\n 'boolean'\n else type # raise \"SQL type unknown for standard type #{type}\"\n end\n [sql_type, length]\n end", "def test_float_literal\n check(C::FloatLiteral, <<-EOS)\n |1.0\n EOS\n end", "def normalise_type(type, length)\n sql_type = case type\n when /^Auto ?Counter$/\n 'int'\n\n when /^Unsigned ?Integer$/,\n /^Signed ?Integer$/,\n /^Unsigned ?Small ?Integer$/,\n /^Signed ?Small ?Integer$/,\n /^Unsigned ?Tiny ?Integer$/\n s = case\n when length == nil\n 'int'\n when length <= 8\n 'tinyint'\n when length <= 16\n 'smallint'\n when length <= 32\n 'int'\n else\n 'bigint'\n end\n length = nil\n s\n\n when /^Decimal$/\n 'decimal'\n\n when /^Fixed ?Length ?Text$/, /^Char$/\n 'char'\n when /^Variable ?Length ?Text$/, /^String$/\n 'varchar'\n when /^Large ?Length ?Text$/, /^Text$/\n 'text'\n\n when /^Date ?And ?Time$/, /^Date ?Time$/\n 'datetime'\n when /^Date$/\n 'datetime' # SQLSVR 2K5: 'date'\n when /^Time$/\n 'datetime' # SQLSVR 2K5: 'time'\n when /^Auto ?Time ?Stamp$/\n 'timestamp'\n\n when /^Guid$/\n 'uniqueidentifier'\n when /^Money$/\n 'decimal'\n when /^Picture ?Raw ?Data$/, /^Image$/\n 'image'\n when /^Variable ?Length ?Raw ?Data$/, /^Blob$/\n 'varbinary'\n when /^BIT$/\n 'bit'\n else type # raise \"SQL type unknown for standard type #{type}\"\n end\n [sql_type, length]\n end", "def get_value(literal)\n if literal.typed?\n literal.humanize\n else\n # Hack to fix incorrect dattime\n case literal.to_s\n when RDF::Literal::Duration::GRAMMAR\n get_value(RDF::Literal::Duration.new(literal))\n when RDF::Literal::Date::GRAMMAR\n get_value(RDF::Literal::Date.new(literal))\n when RDF::Literal::Time::GRAMMAR\n get_value(RDF::Literal::Time.new(literal))\n when RDF::Literal::DateTime::GRAMMAR\n get_value(RDF::Literal::DateTime.new(literal))\n when %r(\\A-?\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2})?(\\.\\d+)?(([\\+\\-]\\d{2}:\\d{2})|UTC|Z)?\\Z)\n # Hack to fix incorrect DateTimes in examples:\n get_value(RDF::Literal::DateTime.new(literal))\n else\n literal.humanize\n end\n end\n end", "def cast_numeric(sql_type = nil)\n Cast.new(self, sql_type || Integer).sql_number\n end", "def cast_types; end", "def typecast_value(type, value)\n if value.is_a?(ActiveAttr::MultiAttr)\n typecast_multiattr(type, value)\n elsif typecaster = TYPECASTERS[type]\n typecaster.new.call(value)\n end\n end", "def bitcast_to(type)\n ConstantExpr.from_ptr(C.LLVMConstBitCast(self, type))\n end", "def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless type.to_s == 'integer'\n \n if limit.nil? || limit == 4\n 'integer'\n elsif limit < 4\n 'smallint'\n else\n 'bigint'\n end\n end", "def normalise_type(type_name, length, value_constraint)\n type = MM::DataType.normalise(type_name)\n\n case type\n when MM::DataType::TYPE_Boolean; data_type_context.boolean_type\n when MM::DataType::TYPE_Integer\n if type_name =~ /^Auto ?Counter$/i\n MM::DataType.normalise_int_length('int', data_type_context.default_surrogate_length, value_constraint, data_type_context)[0]\n else\n v, = MM::DataType.normalise_int_length(type_name, length, value_constraint, data_type_context)\n v\n end\n when MM::DataType::TYPE_Real;\n [\"FLOAT\", data_type_context.default_length(type, type_name)]\n when MM::DataType::TYPE_Decimal; 'DECIMAL'\n when MM::DataType::TYPE_Money; 'DECIMAL'\n when MM::DataType::TYPE_Char; [data_type_context.default_char_type, length || data_type_context.char_default_length]\n when MM::DataType::TYPE_String; [data_type_context.default_varchar_type, length || data_type_context.varchar_default_length]\n when MM::DataType::TYPE_Text; [data_type_context.default_text_type, length || 'MAX']\n when MM::DataType::TYPE_Date; 'DATE' # SQLSVR 2K5: 'date'\n when MM::DataType::TYPE_Time; 'TIME' # SQLSVR 2K5: 'time'\n when MM::DataType::TYPE_DateTime; 'TIMESTAMP'\n when MM::DataType::TYPE_Timestamp;'TIMESTAMP'\n when MM::DataType::TYPE_Binary;\n length ||= 16 if type_name =~ /^(guid|uuid)$/i\n if length\n ['BINARY', length]\n else\n 'VARBINARY'\n end\n else\n type_name\n end\n end", "def type_cast_for_cql3(value, dest_type = nil)\n return nil if value.nil?\n return coder.dump(value) if encoded?\n\n case (dest_type || type)\n when :uuid then value.is_a?(::Cql::Uuid) ? value : self.class.value_to_uuid(value)\n when :time, :datetime, :timestamp then value.to_time.utc\n when :date then value.to_time.utc\n when :set then Set.new(list_to_cql3_value(value))\n when :list then list_to_cql3_value(value)\n when :map then map_to_cql3_value(value)\n else value\n end\n end", "def oracle_data_type_conversion(in_var, data_type, data_scale)\n \n case\n when data_type == \"VARCHAR2\"\n if in_var.nil? or in_var.empty?\n in_var = \"\"\n end\n this_in_var = in_var.to_s\n this_data_type = String\n \n when data_type == \"CHAR\"\n if in_var.nil? or in_var.empty?\n in_var = \"\"\n end\n this_in_var = in_var.to_s\n this_data_type = String\n \n when data_type == \"NUMBER\"\n if !data_scale.nil? and data_scale > 0\n \n this_in_var = in_var.to_f\n this_data_type = Float\n else\n this_in_var = in_var.to_i\n this_data_type = Fixnum\n end\n \n when data_type == \"TIMESTAMP\"\n this_in_var = in_var\n this_data_type = DateTime\n \n when data_type == \"DATE\"\n this_in_var = in_var\n this_data_type = DateTime\n \n else nil\n end \n \n return this_in_var, this_data_type \n end", "def query_literal(args)\n case (s = args[0])\n when LiteralString, SQL::Blob\n nil\n when String\n if args.length == 1\n LiteralString.new(s)\n else\n SQL::PlaceholderLiteralString.new(s, args[1..-1])\n end\n end\n end", "def type_cast(typ, force: false)\n new_typ = if typ.is_a? RDL::Type::Type then typ else RDL.parser.scan_str \"#T #{typ}\" end\n raise RuntimeError, \"type cast error: self not a member of #{new_typ}\" unless force || typ.member?(self)\n obj = SimpleDelegator.new(self)\n obj.instance_variable_set('@__rdl_type', new_typ)\n obj\n end", "def dbms_type_cast(columns, values)\n int_column = {}\n columns.each_with_index do |c, i|\n int_column[i] = c.type == 3 && c.scale == 0\n end\n\n float_column = {}\n columns.each_with_index do |c, i|\n float_column[i] = c.type == 3 && c.scale != 0\n end\n\n values.each do |row|\n row.each_index do |idx|\n val = row[idx]\n if val\n if int_column[idx]\n row[idx] = val.to_i\n elsif float_column[idx]\n row[idx] = val.to_f\n elsif val.is_a?(String)\n row[idx] = val.force_encoding('UTF-8')\n end\n end\n end\n end\n end", "def type_to_sql_with_notext(*args)\n type = type_to_sql_without_notext(*args)\n if type =~ /(text|blob)/\n 'varchar(2500)' # If this is bigger than about 21000 it always fails, and sometimes hits a row limit anyway if too large\n else\n type\n end\n end", "def typecast(value)\n if value.kind_of?(Range) then Range.new(typecast(value.first), typecast(value.last))\n elsif value.kind_of?(Array) then value.map{|v| typecast(v)}\n elsif primitive == BigDecimal then super(value).to_f\n elsif primitive == DateTime then Time.parse(super(value).to_s).to_i\n elsif primitive == Date then Time.parse(super(value).to_s).to_i\n elsif primitive == Time then super(value).to_i\n else\n super(value) # Good luck\n end\n end", "def convert_to(value, type, path = nil)\n path = Path.new(path) unless path.kind_of?(Path)\n case type.object_id\n when Integer.object_id\n raise Error.new(Error::WrongType, path) unless value.respond_to?(:to_i)\n value.to_i\n when Float.object_id\n raise Error.new(Error::WrongType, path) unless value.respond_to?(:to_f)\n value.to_f\n when Array.object_id\n # FIXME: Should allow more flexible kinds of lists (with spaces).\n value.to_s.split\n when String.object_id\n value.to_s\n else\n raise Error.new(Error::WrongType, path) unless type.respond_to?(:from_str)\n type.from_str(value)\n end\n end", "def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = false, auto_increment = false)\n case type.to_s\n when 'integer'\n case limit\n when 1\n 'tinyint' + (unsigned ? ' unsigned' : '') + (auto_increment ? ' AUTO_INCREMENT' : '')\n when 2\n 'smallint' + (unsigned ? ' unsigned' : '') + (auto_increment ? ' AUTO_INCREMENT' : '')\n when 3\n 'mediumint' + (unsigned ? ' unsigned' : '') + (auto_increment ? ' AUTO_INCREMENT' : '')\n when nil, 4, 11 # compatibility with MySQL default\n if unsigned\n 'int(10) unsigned' + (auto_increment ? ' AUTO_INCREMENT' : '')\n else\n 'int(10)'\n end\n when 5..8\n 'bigint' + (unsigned ? ' unsigned' : '') + (auto_increment ? ' AUTO_INCREMENT' : '')\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}\")\n end\n when 'text'\n case limit\n when 0..0xff; 'tinytext'\n when nil, 0x100..0xffff; 'text'\n when 0x10000..0xffffff; 'mediumtext'\n when 0x1000000..0xffffffff; 'longtext'\n else raise(ActiveRecordError, \"No text type has character length #{limit}\")\n end\n else\n super\n end\n end", "def cast(value)\n value\n end", "def cast(*params)\n if (params.size > 0 && params[0].is_a?(Hash))\n opts = {\n :stype => self.stype,\n :dtype => self.dtype,\n :default => self.stype == :dense ? 0 : self.default_value\n }.merge(params[0])\n\n self.cast_full(opts[:stype], opts[:dtype], opts[:default])\n else\n params << self.stype if params.size == 0\n params << self.dtype if params.size == 1\n #HACK: the default value can cause an exception if dtype is not complex\n #and default_value is. (The ruby C code apparently won't convert these.)\n #Perhaps this should be fixed in the C code (in rubyval_to_cval).\n default_value = maybe_get_noncomplex_default_value(params[1])\n params << (self.stype == :dense ? 0 : default_value) if params.size == 2\n self.cast_full(*params)\n end\n\n end", "def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc:\n if type == :enum\n native = native_database_types[type]\n column_type_sql = native[:name] || 'enum'\n \n column_type_sql << \"(#{limit.map { |v| quote(v) }.join(',')})\"\n column_type_sql \n else\n # Edge rails fallback for Rails 1.1.6. We can remove the\n # rescue once everyone has upgraded to 1.2.\n begin\n __type_to_sql_enum(type, limit, precision, scale)\n rescue ArgumentError\n __type_to_sql_enum(type, limit)\n end\n end\n end", "def value_from( value )\n #----------------------\n #raise MongoODM::Errors::TypeCastMissing.new(value, @type) unless @type.respond_to?(:type_cast)\n @type.from( value )\n end", "def process_lit(exp)\n # TODO what about floats and big numbers?\n\n value = exp.shift\n c_type = exp.c_type\n case c_type\n when CType.long, CType.float then\n return value.to_s\n when CType.symbol then\n return value.to_s.inspect # HACK wrong! write test!\n else\n raise \"Bug! no: Unknown literal #{value}:#{value.class}\"\n end\n end", "def cast(input, dtype, name: nil)\n _op(:cast, input, nil, data_type: dtype, name: name)\n end" ]
[ "0.6988179", "0.6824231", "0.67499065", "0.6748528", "0.67441684", "0.6679899", "0.6561403", "0.6512974", "0.6347855", "0.6207837", "0.61929905", "0.6082754", "0.60521156", "0.603328", "0.60105735", "0.60089767", "0.5997157", "0.59802514", "0.5967669", "0.59590304", "0.59521955", "0.59441644", "0.5942812", "0.5922718", "0.5919774", "0.59185266", "0.5892276", "0.588136", "0.58783513", "0.58757246", "0.58733743", "0.5854575", "0.5829925", "0.5791663", "0.57913357", "0.5777003", "0.57756335", "0.57650375", "0.5750787", "0.57405454", "0.57037044", "0.56860626", "0.5685718", "0.5676121", "0.56698644", "0.56545866", "0.5644928", "0.5643302", "0.56333214", "0.5627763", "0.55968696", "0.55941737", "0.556307", "0.5549851", "0.55475086", "0.5508413", "0.54948884", "0.54814327", "0.54750896", "0.5470823", "0.5441505", "0.5441505", "0.54323584", "0.54316765", "0.5428677", "0.54242915", "0.5419071", "0.5418169", "0.5406684", "0.5394982", "0.53930074", "0.538886", "0.53872925", "0.5383915", "0.53799284", "0.53709716", "0.5368551", "0.53656375", "0.5360823", "0.5360769", "0.53482735", "0.53381175", "0.5337529", "0.53272426", "0.53260666", "0.5323734", "0.53176737", "0.53157896", "0.5310245", "0.5308578", "0.53062063", "0.5302357", "0.52862185", "0.5284016", "0.52758414", "0.5271638", "0.5270704", "0.5265312", "0.525251", "0.52350074" ]
0.8148927
0
Convert the given timestamp from the application's timezone, to the databases's timezone or the default database timezone if the database does not have a timezone.
def from_application_timestamp(v) Sequel.convert_output_timestamp(v, timezone) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timezone\n @timezone || Sequel.database_timezone\n end", "def to_application_timestamp(v)\n Sequel.convert_timestamp(v, timezone)\n end", "def convert_timestamp(timestamp)\n timestamp = db.to_application_timestamp(timestamp) if timestamp.is_a?(String)\n timestamp\n end", "def convert_datetime_timezone(dt, timezone)\n case timezone\n when :utc, \"utc\"\n dt.new_offset(0)\n when :local, \"local\"\n dt.new_offset(FmRest::V1.local_offset_for_datetime(dt))\n when nil\n dt\n end\n end", "def to_time\n preserve_timezone ? getlocal(utc_offset) : getlocal\n end", "def to_local(time_zone = Time.zone.try(:name))\n return if __getobj__.nil? || time_zone.nil?\n converted_timestamp = ActiveSupport::TimeZone.new(time_zone).local_to_utc(__getobj__)\n converted_timestamp.in_time_zone(time_zone) if converted_timestamp.respond_to? :in_time_zone\n end", "def set_timezone(timezone); end", "def set_timezone(timezone); end", "def set_timezone(timezone); end", "def set_timezone(timezone); end", "def set_timezone(timezone); end", "def to_user_tz(&block)\n Time.use_zone(current_user.time_zone, &block)\n end", "def get_time_zone\n return nil if new_record?\n time_zone || lambda{\n _zone = nil\n _zone = GeoIP.new(Rails.root.join('lib', 'geoip_files', 'GeoLiteCity.dat')).city(last_sign_in_ip).try(:timezone) if last_sign_in_ip\n update_column(:time_zone, _zone) if _zone\n _zone\n }.call\n end", "def with_timezone\n Time.use_zone(current_user_timezone) { yield }\n end", "def with_timezone\n Time.use_zone(current_user.try(:get_time_zone)) { yield }\n end", "def time_zone=(_arg0); end", "def time_zone=(_arg0); end", "def initialize_time_zone\n if configuration.time_zone\n zone_default = Time.__send__(:get_zone, configuration.time_zone)\n\n unless zone_default\n raise \\\n 'Value assigned to config.time_zone not recognized.' +\n 'Run \"rake -D time\" for a list of tasks for finding appropriate time zone names.'\n end\n\n Time.zone_default = zone_default\n\n if defined?(ActiveRecord)\n ActiveRecord::Base.time_zone_aware_attributes = true\n ActiveRecord::Base.default_timezone = :utc\n end\n end\n end", "def convert_timezone(time, to_timezone, from_timezone, **options)\n converted_time = time + timezone_difference_in_seconds(to_timezone, from_timezone)\n timezone_with_offset(converted_time, to_timezone, options[:date])\n end", "def set_timezone\n tz = Profile.find_by_user_id(current_user.id).timezone\n @timezone = Time.now.in_time_zone(tz).strftime('%z')\n if current_user\n User.current = current_user\n end\n end", "def timestamp_to_user(user_id, timestamp)\n tz = get_user_timezone(user_id)\n timestamp = TZInfo::Timestamp.utc(timestamp)\n return tz.utc_to_local(timestamp).to_datetime\n end", "def set_timezone\n Time.zone = current_user.try(:time_zone) || 'Eastern Time (US & Canada)'\n end", "def setup_timezone\n timezone = config.dig(\"timezone\").split(\"-\").first.chomp(\" \")\n\n application nil do\n <<~CONFS\n # Default timezone\n config.time_zone = \"#{timezone}\"\n\n CONFS\n end\n end", "def to_time\n if preserve_timezone\n @to_time_with_instance_offset ||= getlocal(utc_offset)\n else\n @to_time_with_system_offset ||= getlocal\n end\n end", "def set_timezone\n Time.zone = if user_signed_in?\n current_user.timezone\n else\n 'Eastern Time (US & Canada)'\n end\n end", "def set_timezone\n Time.zone = current_account.time_zone if current_account.time_zone\n end", "def set_timezone\n Time.zone = Time.zone_default\n end", "def set_user_time_zone\n Time.zone = current_user.time_zone if current_user.try(:time_zone)\n end", "def set_timezone\n tz = current_user ? current_user.time_zone : nil\n Time.zone = tz || ActiveSupport::TimeZone[\"UTC\"]\n end", "def time_convertion(time, time_zone)\n time.getutc.getlocal(time_zone)\n end", "def current_user_timezone\n app_get_geo_data_by_ip.try(:timezone) || \"America/La_Paz\"\n end", "def in_time_zone(zone = ::Time.zone)\n if zone\n ::Time.find_zone!(zone).local(year, month, day)\n else\n to_time\n end\n end", "def set_time_zone\n # Make sure blank is always nil\n self.time_zone = nil if time_zone.blank?\n # If there are coordinates, use them to set the time zone, and reject\n # changes to the time zone if the coordinates have not changed\n if georeferenced?\n if coordinates_changed?\n lat = ( latitude_changed? || private_latitude.blank? ) ? latitude : private_latitude\n lng = ( longitude_changed? || private_longitude.blank? ) ? longitude : private_longitude\n self.time_zone = TimeZoneGeometry.time_zone_from_lat_lng( lat, lng ).try(:name)\n self.zic_time_zone = ActiveSupport::TimeZone::MAPPING[time_zone] unless time_zone.blank?\n elsif time_zone_changed?\n self.time_zone = time_zone_was\n self.zic_time_zone = zic_time_zone_was\n end\n end\n # Try to assign a reasonable default time zone\n if time_zone.blank?\n self.time_zone = nil\n self.time_zone ||= user.time_zone if user && !user.time_zone.blank?\n self.time_zone ||= Time.zone.try(:name) unless time_observed_at.blank?\n self.time_zone ||= 'UTC'\n end\n if !time_zone.blank? && !ActiveSupport::TimeZone::MAPPING[time_zone] && ActiveSupport::TimeZone[time_zone]\n # We've got a zic time zone\n self.zic_time_zone = time_zone\n self.time_zone = if rails_tz = ActiveSupport::TimeZone::MAPPING.invert[time_zone]\n rails_tz\n elsif ActiveSupport::TimeZone::INAT_MAPPING[time_zone]\n # Now we're in trouble, b/c the client specified a valid IANA time\n # zone that TZInfo knows about, but it's one Rails chooses to ignore\n # and doesn't provide any mapping for so... we have to map it\n ActiveSupport::TimeZone::INAT_MAPPING[time_zone]\n elsif time_zone =~ /^Etc\\//\n # If we don't have custom mapping and there's no fancy Rails wrapper\n # and it's one of these weird oceanic Etc zones, use that as the\n # time_zone. Rails can use that to cast times into other zones, even\n # if it doesn't recognize it as its own zone\n time_zone\n else\n ActiveSupport::TimeZone[time_zone].name\n end\n end\n self.time_zone ||= user.time_zone if user && !user.time_zone.blank?\n self.zic_time_zone ||= ActiveSupport::TimeZone::MAPPING[time_zone] unless time_zone.blank?\n if !zic_time_zone.blank? && ActiveSupport::TimeZone::MAPPING[zic_time_zone] && ActiveSupport::TimeZone[zic_time_zone]\n self.zic_time_zone = ActiveSupport::TimeZone::MAPPING[zic_time_zone]\n end\n true\n end", "def time_zone\n @options[:use_default_time_zone] ? Time.zone_default : Time.zone\n end", "def set_timezone()\n current_tz = Time.zone\n if logged_in?\n Time.zone = current_user.timezone\n end\n ensure\n Time.zone = current_tz\n end", "def use_zone(time_zone)\n old_zone, ::Time.zone = ::Time.zone, get_zone(time_zone)\n yield\n ensure\n ::Time.zone = old_zone\n end", "def set_timezone\n if user_signed_in?\n Time.zone = current_user.timezone\n else\n Time.zone = 'Eastern Time (US & Canada)'\n end\n end", "def set_user_time_zone\n Time.zone = current_user.time_zone unless current_user.nil?\n end", "def set_timezone\n Time.zone = @user.time_zone if has_session?\n end", "def set_time_zone\n old_time_zone = Time.zone\n\n new_time_zone = user_time_zone()\n \n Time.zone = new_time_zone if new_time_zone\n\n yield\n ensure # make sure we restore old time zone\n Time.zone = old_time_zone\n end", "def tz_timezone ; timezone? ? TZInfo::Timezone.get(@timezone) : nil ; end", "def time_zone\n addresses.primary.blank? || addresses.primary.time_zone.blank? ? nil : addresses.primary.time_zone\n end", "def tz\n ActiveSupport::TimeZone.new timezone\n end", "def timezone\n @history.objects.find { |o| o.name == \"tz\" }.val\n end", "def set_time_zone\n Time.zone = current_user.time_zone\n end", "def set_timezone\n u = User.find_by_id(current_user.id)\n u.timezone = params[:timezone]\n u.save\n render :layout => false\n end", "def set_time_zone\n Time.use_zone(current_user.time_zone) { yield }\n end", "def set_user_time_zone\n user = current_user || (params[:user_name].presence && User.find_by(:userid => params[:user_name]))\n session[:user_tz] = Time.zone = (user ? user.get_timezone : server_timezone)\n end", "def set_user_time_zone\n Time.zone = current_user.time_zone if current_user\n end", "def timezone\n TimeZoneHelper.info_hash(tzinfo_tz, rails_tz)\n end", "def user_time_zone(&block)\n Time.use_zone(current_user.time_zone, &block)\n end", "def default_timezone\n @default_timezone || :local\n end", "def populate_timezones\n if new_record?\n self.created_at_timezone ||= Time.zone.name\n else\n if self.deleted?\n self.deleted_at_timezone ||= Time.zone.name\n end\n end\n end", "def user_time_zone(&block)\n Time.use_zone(current_user.time_zone, &block)\n end", "def timezone\n data[:timezone]\n end", "def supports_timestamp_timezones?\n true\n end", "def supports_timestamp_timezones?\n true\n end", "def supports_timestamp_timezones?\n true\n end", "def set_time_zone\n Time.use_zone('Europe/Moscow') { yield }\n end", "def set_timezone\n offset = [Time.now.beginning_of_year.utc_offset, Time.now.beginning_of_year.change(month: 7).utc_offset].min\n offset *= 3600 if offset.abs < 13\n Time.zone = ActiveSupport::TimeZone.all.select { |zone| zone.utc_offset == offset }.first\nend", "def curr_date_in_timezone\n Time.now.getlocal(address_timezone_offset)\n end", "def timezone(opts = {})\n logger = opts[:logger]\n\n tz_string = @redis.get(\"contact_tz:#{self.id}\")\n tz = opts[:default] if (tz_string.nil? || tz_string.empty?)\n\n if tz.nil?\n begin\n tz = ActiveSupport::TimeZone.new(tz_string)\n rescue ArgumentError\n if logger\n logger.warn(\"Invalid timezone string set for contact #{self.id} or TZ (#{tz_string}), using 'UTC'!\")\n end\n tz = ActiveSupport::TimeZone.new('UTC')\n end\n end\n tz\n end", "def time_zone=(value)\n if value.is_a? ActiveSupport::TimeZone\n super\n else\n zone = ::Time.find_zone(value) # nil if can't find time zone\n super zone\n end\n end", "def timezone\n return call('Bugzilla.tomezone')\n end", "def set_timezone\n loc = Location.find(self.location_id)\n self.time_zone, self.localGMToffset = loc.time_zone, loc.localGMToffset\n end", "def set_timezone\n offset = [ Time.now.beginning_of_year.utc_offset, Time.now.beginning_of_year.change(:month => 7).utc_offset ].min\n offset *= 3600 if offset.abs < 13\n Time.zone = ActiveSupport::TimeZone.all.select { |zone| zone.utc_offset == offset }.first\n end", "def timezone=(timezone)\n if !timezone.nil?\n @timezone = ActiveSupport::TimeZone[timezone]\n else\n @timezone = ActiveSupport::TimeZone['Etc/UTC']\n end\n end", "def lastseen_to_current_users_timezone(lastseen)\n if lastseen\n t = Time.zone.parse(lastseen)\n t.in_time_zone(session_user.timezone).to_s(:FHM)\n else\n \"n/a\"\n end\n end", "def time_in_zone\n # Time.zone should be UTC\n Time.zone.at((time+utc_offset)/1000)\n end", "def set_user_time_zone\n if logged_in? && !current_user.time_zone.nil?\n Time.zone = current_user.time_zone\n else\n Time.zone = 'Eastern Time (US & Canada)'\n end\n end", "def in_zone(zone_name, &block)\n\n EtOrbi.class_eval do\n @local_tzone = nil\n @local_tzone_tz = nil\n @local_tzone_loaded_at = nil\n end\n\n prev_tz = ENV['TZ']\n\n if zone_name == :no_env_tz\n ENV.delete('TZ')\n elsif zone_name == nil\n ENV['TZ'] = EtOrbi.os_tz\n else\n zone_name = EtOrbi.to_windows_tz(zone_name) if Gem.win_platform?\n ENV['TZ'] = zone_name\n end\n\n block.call\n\nensure\n\n ENV['TZ'] = prev_tz\nend", "def get_timestamp\n \"[#{(Time.now.in_time_zone(TIME_ZONE_PACIFIC)).strftime('%m/%d/%y %l:%M%p')}]\"\nend", "def time_zone; end", "def time_zone; end", "def time_zone; end", "def time_zone; end", "def time_zone; end", "def before_setup\n @original_time_zone = Time.zone\n super\n end", "def set_user_time_zone\n Time.zone = current_user.time_zone if signed_in?\n end", "def tz\n # logger.debug(\"CHC: customer tz called from #{caller.join(\"\\n\")}\")\n if tzb = time_zone_binary\n tzb.to_r / MINS_PER_DAY\n else\n nil\n end\n end", "def convert(local_time, from_time_zone=nil)\n if from_time_zone\n b = self.class.new(from_time_zone)\n t = b.at(local_time).getutc\n utc(t.year, t.month, t.day, t.hour, t.min, t.sec, t.usec)\n elsif local_time.respond_to?(:getutc)\n t = local_time.getutc\n utc(t.year, t.month, t.day, t.hour, t.min, t.sec, t.usec)\n else\n nil\n end\n end", "def tz\n time_zone_adjustment.to_r / (24 * 60)\n end", "def tz\n time_zone_adjustment.to_r / (24 * 60)\n end", "def create_time_in_tz(datetime, tz = nil)\n if tz && (Time.zone.nil? || tz != Time.zone.name) # If tz passed in and not default tz\n saved_tz = Time.zone\n Time.zone = tz # Temporarily convert to new tz and create the time object\n t = Time.zone.parse(datetime) # Create the time object\n Time.zone = saved_tz # Restore original default\n else # tz not passed in or matches current tz\n t = Time.zone.parse(datetime) # Create the time object\n end\n t\n end", "def timezone(identifier); end", "def timezone(identifier); end", "def timezone(identifier); end", "def set_time_zone(&block)\n time_zone = if user_signed_in?\n current_user.user_location.try(:time_zone) || 'UTC'\n else\n 'UTC'\n end\n Time.use_zone(time_zone, &block)\n end", "def time_zone\n super\n end", "def timezone\n @@tz || @@tz = TZInfo::Timezone.get(Time.now.zone)\n end", "def tenant_default_timezone\n return @tenant_default_timezone\n end", "def v_time_zone_inutilisee\n @time_zone ||= (self.time_zone.blank? ? nil : ActiveSupport::TimeZone[self.time_zone])\n end", "def timezone(input)\n if Time.parse(input.to_s).isdst\n case input.zone\n when \"-04:00\" then \"EDT\"\n when \"-05:00\" then \"CDT\"\n when \"-06:00\" then \"MDT\"\n when \"-07:00\" then \"PDT\"\n else input.zone\n end\n else\n case input.zone\n when \"-05:00\" then \"EST\"\n when \"-06:00\" then \"CST\"\n when \"-07:00\" then \"MST\"\n when \"-08:00\" then \"PST\"\n else input.zone\n end\n end\n end", "def user_timezone(&block)\n return yield unless current_user\n\n Time.use_zone(current_user.timezone, &block)\n end", "def set_timezone(force = false)\n if self.current_sign_in_ip && (force || self.time_zone.blank?)\n coordinates = Geocoder.search(self.current_sign_in_ip).first.coordinates\n timezone = Timezone::Zone.new(latlon: coordinates) unless [0.0, 0.0]\n self.update_attribute(:time_zone, timezone) if timezone\n end\n end", "def date_time_to_db_format(date, time)\n finish_date_time = date + \" \" + time\n # format datetime for the database\n postgrestimestamp = DateTime::strptime(finish_date_time, '%d %b %Y %H:%M').to_time\n return postgrestimestamp\n end", "def data_timezone(identifier); end", "def data_timezone(identifier); end", "def parsed_time(timezone = patient.timezone)\n self.datetime.in_time_zone(timezone)\n end", "def timezone\n ret = {}\n if logged_in?\n puts 'SET TIMEZONE ' + params.inspect\n tz = ActiveSupport::TimeZone[params[:offset].to_i]\n if tz\n puts 'tz=' + tz.name\n current_user.time_zone = tz.name\n current_user.save(:dirty=>true)\n ret[:timezone] = tz.name\n end\n end\n render :json=>ret\n end" ]
[ "0.64990586", "0.64090383", "0.6375464", "0.6200379", "0.5950318", "0.58946115", "0.5882815", "0.5882815", "0.5882815", "0.5882815", "0.5882815", "0.5874864", "0.5866882", "0.58243126", "0.58108205", "0.5778377", "0.5778377", "0.57736176", "0.5762536", "0.57400864", "0.5738408", "0.57209706", "0.5710394", "0.5681749", "0.5656792", "0.5638953", "0.5630722", "0.560516", "0.5601986", "0.56005", "0.5600237", "0.5588332", "0.5587541", "0.5576153", "0.55729705", "0.55659354", "0.5547482", "0.5526661", "0.5524388", "0.5518853", "0.5518722", "0.5509878", "0.5503984", "0.5502823", "0.5497619", "0.5485828", "0.548262", "0.54738516", "0.5460578", "0.54541373", "0.54469097", "0.544617", "0.5445353", "0.5445226", "0.54443365", "0.54397756", "0.54397756", "0.54397756", "0.54293156", "0.5422278", "0.54131645", "0.5405213", "0.5404623", "0.54017204", "0.54016906", "0.5390749", "0.5382694", "0.53823507", "0.53779995", "0.53678155", "0.53548956", "0.5351748", "0.5350728", "0.5350728", "0.5350728", "0.5350728", "0.5350728", "0.53429425", "0.5339092", "0.53371006", "0.5325257", "0.53237486", "0.53237486", "0.5322017", "0.53219867", "0.53219867", "0.53219867", "0.53211975", "0.53125954", "0.5309523", "0.52921706", "0.5289427", "0.52845275", "0.5277261", "0.5249798", "0.5247668", "0.5240282", "0.5240282", "0.52267015", "0.52224666" ]
0.63362724
3
Returns a string representation of the database object including the class name and connection URI and options used when connecting (if any).
def inspect a = [] a << uri.inspect if uri if (oo = opts[:orig_opts]) && !oo.empty? a << oo.inspect end "#<#{self.class}: #{a.join(' ')}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n \"RDS DBInstance: #{@dbi_name}\"\n end", "def to_s\n \"RDS DBInstance: #{@dbi_name}\"\n end", "def database_name # :nodoc:\n return nil unless Module.constants.include? 'DataMapper' or Module.constants.include? :DataMapper\n raise \"No such database connection #{options[:database]}\" if options[:database] and DataMapper::Repository.adapters[options[:database]].nil?\n # Custom database connection specified\n return options[:database].to_sym if options[:database]\n # Leaf config name\n return leaf_name.to_sym if DataMapper::Repository.adapters[leaf_name.to_sym]\n # Leaf config name, underscored\n return leaf_name.methodize.to_sym if DataMapper::Repository.adapters[leaf_name.methodize.to_sym]\n # Leaf class name\n return self.class.to_s.to_sym if DataMapper::Repository.adapters[self.class.to_s.to_sym]\n # Leaf class name, underscored\n return self.class.to_s.methodize.to_sym if DataMapper::Repository.adapters[self.class.to_s.methodize.to_sym]\n # I give up\n return nil\n end", "def to_s\n\t\tconn_str = \n\t\t\tsprintf(\"#%s%s:%x\\n%s%s\\n%s%s\\n%s%s\\n%s%s\\n%s%s\\n%s%s\\n%s%s\\n\",\n\t\t\t\t\"Class:id.......... = \", self.class, self.object_id, \n\t\t\t\t\" @socket.......... = \", @socket.inspect, \n\t\t\t\t\" @host............ = \", @host.inspect, \n\t\t\t\t\" @port............ = \", @port.inspect, \n\t\t\t\t\" @username........ = \", @username.inspect,\n\t\t\t\t\" @authenticated... = \", @authenticated.inspect,\n\t\t\t\t\" @show_full_names. = \", @show_full_names.inspect,\n\t\t\t\t\" @groups.......... = \", @groups.inspect)\n\t\treturn conn_str\n\tend", "def to_s()\n @sql ||= print_to(Printer.new()).to_s()\n end", "def determine_database\n self.class.database \n end", "def db_info\n @conn.query({url_path: \"#{database}\", method: :get})\n end", "def to_s\n out = ''\n database.each_value do |v|\n out+= \"#{v}\"\n end\n\n out\n end", "def name\n @db_name\n end", "def db_interface\n self.class.database_interface\n end", "def database\n self.class.database\n end", "def print\n $stdout.puts(\"DB #{@context.getDBConnection.toString}\")\n end", "def database_name\n @dbi.db_name\n end", "def database_name\n @dbi.db_name\n end", "def database\n self.class_database || CouchRest::Model.default_database\n end", "def out_database_name\n if options[:out]\n if options[:out].respond_to?(:keys) && (db = options[:out][:db])\n db\n else\n database.name\n end\n end\n end", "def database_name\n @database_name\n end", "def database\n \"--db='#{ name }'\"\n end", "def db\n self.class.db\n end", "def to_s\n \"From #{@description} [#{@database}]:\\n\\n\" +\n \"#{@definition.inject(''){ |s, l| s << ' ' << l }}\\n\\n\"\n end", "def database\n @database ||= self.class.database\n end", "def get_database_object\n\t\t\t\t\t$TRACE.debug 5, \"getting database object #{self.database_object} for object #{self.class}:#{self.id}, called by #{caller[0]}\"\n\t\t\t\t\tself.database_object\n\t\t\t\tend", "def database\n @database || self.class.database\n end", "def inspect\n\t\treturn %{#<%s:0x%0x %s:%d (%s) base_dn=%p, bound as=%s, schema=%s>} % [\n\t\t\tself.class.name,\n\t\t\tself.object_id / 2,\n\t\t\tself.host,\n\t\t\tself.port,\n\t\t\t@conn ? \"connected\" : \"not connected\",\n\t\t\tself.base_dn,\n\t\t\t@bound_user ? @bound_user.dump : \"anonymous\",\n\t\t\t@schema ? @schema.inspect : \"(schema not loaded)\",\n\t\t]\n\tend", "def database\n @database ||= determine_database\n end", "def database\n @database || self.class.database\n end", "def database\n @database\n end", "def database\n @database\n end", "def to_s\n \"Default DataSource\"\n end", "def inspect\n \"#<#{self.class}: #{sql.inspect}>\"\n end", "def name\n db_name = URI.parse(uri(self)).path.to_s.sub(\"/\", \"\")\n db_name.blank? ? database : db_name\n end", "def to_s\n \"#{DbAgile::RubyTools::unqualified_class_name(self.class)}: #{name} #{definition.inspect}\"\n end", "def database\n database_name ? connection.db(database_name) : nil\n end", "def structure\r\n ptr = Api.proj_context_get_database_structure(self.context, nil)\r\n Strings.new(ptr)\r\n end", "def database\n \"--db='#{ name }'\" if name\n end", "def db(db_name, options={})\n DB.new(db_name, self, options.merge(:logger => @logger))\n end", "def database\n @@db\n end", "def database_name\n @opts[:database]\n end", "def database\n Jrodb::Database[:default]\n end", "def info\n specified_db_or_all { |db| display_db_info db }\n end", "def uri\n uri = URI::Generic.new(\n self.class.adapter_scheme.to_s,\n nil,\n @opts[:host],\n @opts[:port],\n nil,\n \"/#{@opts[:database]}\",\n nil,\n nil,\n nil\n )\n uri.user = @opts[:user]\n uri.password = @opts[:password] if uri.user\n uri.to_s\n end", "def uri\n uri = URI::Generic.new(\n self.class.adapter_scheme.to_s,\n nil,\n @opts[:host],\n @opts[:port],\n nil,\n \"/#{@opts[:database]}\",\n nil,\n nil,\n nil\n )\n uri.user = @opts[:user]\n uri.password = @opts[:password] if uri.user\n uri.to_s\n end", "def databaseInfo\n if (File.exist?(File.join(@path, \"config\", \"database.yml\")))\n info = YAML.load_file(File.join(@path, \"config\", \"database.yml\"))[@environment || \"development\"]\n\n \"#{info['adapter']} database `#{info['database']}`\"\n elsif (File.exist?(File.join(@path, \"config\", \"mongo.yml\")))\n \"MongoDB database\"\n else\n \"Unknown\"\n end\n end", "def connection_data\n opts = { database: self.database, adapter: self.adapter }.merge(self.connection)\n # We ensure we have a string for the adapter\n opts[:adapter] = opts[:adapter].to_s\n # If we have a symbol for the database and the adapter is sqlite3, we create a string and add '.sqlite3' to the end\n opts[:database] = \"#{opts[:database]}.sqlite3\" if opts[:adapter] == 'sqlite3' and opts[:database].class == Symbol\n opts\n end", "def inspect\n \"#<#{self.class.name}: #{sql.inspect}>\"\n end", "def info\n specified_db_or_all { |db| display_db_info db }\n end", "def to_s\n \"#{DbAgile::RubyTools::unqualified_class_name(self.class)}: #{name}\"\n end", "def database_name\n data[:database_name]\n end", "def db\n Doozer::Configs.db_conn\n end", "def db\n Doozer::Configs.db_conn\n end", "def get_db(dbname)\n Database.new(dbname, @socket, self)\n end", "def db\n return self.class.db\n end", "def path\n @options[:database_path]\n end", "def path\n @options[:database_path]\n end", "def sequel_url\n\n return '' unless db_type\n\n # Start our connection string\n connect_string = db_type + '://'\n\n # Add user:password if supplied\n unless db_user.nil?\n connect_string += db_user\n\n # Add either a @ or / depending on if a host was provided too\n connect_string += db_host ? '@' : '/'\n\n # Add host:port if supplied\n connect_string += db_host + '/' if db_host\n end\n\n connect_string + db_name\n end", "def db_instance_class\n data[:db_instance_class]\n end", "def db_name\n data[:db_name]\n end", "def getDatabaseType\n return ActiveRecord::Base.connection.adapter_name\n end", "def to_s\n \"#<Mongify::Mongoid::Model::#{name} fields=#{@fields.keys} relations=#{@relations.map{|r| \"#{r.name} :#{r.association}\"}}>\"\n end", "def database(name)\n Database.new(connection.db(name))\n end", "def instance_class\n @dbi.db_instance_class\n end", "def instance_class\n @dbi.db_instance_class\n end", "def db\n self.class.db\n end", "def db\n @db == true ? TABLE : @db.try(:parameterize, separator: \"_\")\n end", "def inspect\n safe_options = @options.reject { |name, _| name == :password }\n \"#<Vertica::Connection:#{object_id} @parameters=#{@parameters.inspect} @backend_pid=#{@backend_pid}, @backend_key=#{@backend_key}, @transaction_status=#{@transaction_status}, @socket=#{@socket}, @options=#{safe_options.inspect}>\"\n end", "def database\n config[\"database\"]\n end", "def db_instance_class\n data.db_instance_class\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 connection_string\n return @connection_params.values.compact.join(';')\n end", "def database_info(dbname, options = {})\n version = options.fetch(:t, '-')\n get db_url(dbname, version) + \"/\", :Accept => 'application/edn'\n end", "def sql_string\n self\n end", "def database name\n CouchRest::Database.new(self, name)\n end", "def database\n @database ||= opts.fetch(:database, parsed_uri.path[1..-1])\n end", "def database_name\n database&.name\n end", "def to_s\n str = ''.dup\n if @scheme\n str << @scheme\n str << ':'\n end\n\n if @opaque\n str << @opaque\n else\n if @host || %w[file postgres].include?(@scheme)\n str << '//'\n end\n if self.userinfo\n str << self.userinfo\n str << '@'\n end\n if @host\n str << @host\n end\n if @port && @port != self.default_port\n str << ':'\n str << @port.to_s\n end\n str << @path\n if @query\n str << '?'\n str << @query\n end\n end\n if @fragment\n str << '#'\n str << @fragment\n end\n str\n end", "def database(name)\n Database.new(self, name)\n end", "def print_properties\n orientdb.print_class_properties self\n end", "def inspect\n\t\tstr = self.to_s\n\t\tstr[-1,0] = if finished?\n\t\t\t\" finished\"\n\t\telse\n\t\t\tstats = []\n\t\t\tstats << \" status=#{ PG.constants.grep(/CONNECTION_/).find{|c| PG.const_get(c) == status} }\" if status != CONNECTION_OK\n\t\t\tstats << \" transaction_status=#{ PG.constants.grep(/PQTRANS_/).find{|c| PG.const_get(c) == transaction_status} }\" if transaction_status != PG::PQTRANS_IDLE\n\t\t\tstats << \" nonblocking=#{ isnonblocking }\" if isnonblocking\n\t\t\tstats << \" pipeline_status=#{ PG.constants.grep(/PQ_PIPELINE_/).find{|c| PG.const_get(c) == pipeline_status} }\" if respond_to?(:pipeline_status) && pipeline_status != PG::PQ_PIPELINE_OFF\n\t\t\tstats << \" client_encoding=#{ get_client_encoding }\" if get_client_encoding != \"UTF8\"\n\t\t\tstats << \" type_map_for_results=#{ type_map_for_results.to_s }\" unless type_map_for_results.is_a?(PG::TypeMapAllStrings)\n\t\t\tstats << \" type_map_for_queries=#{ type_map_for_queries.to_s }\" unless type_map_for_queries.is_a?(PG::TypeMapAllStrings)\n\t\t\tstats << \" encoder_for_put_copy_data=#{ encoder_for_put_copy_data.to_s }\" if encoder_for_put_copy_data\n\t\t\tstats << \" decoder_for_get_copy_data=#{ decoder_for_get_copy_data.to_s }\" if decoder_for_get_copy_data\n\t\t\t\" host=#{host} port=#{port} user=#{user}#{stats.join}\"\n\t\tend\n\t\treturn str\n\tend", "def inspect\n\t\treturn \"#<%p:0x%016x conn: %p>\" % [\n\t\t\tself.class,\n\t\t\tself.object_id * 2,\n\t\t\tself.conn,\n\t\t]\n\tend", "def get_connection_string(url)\n conn = Utils.parse_connection_url(url)\n str = \"host=#{conn[:host]} dbname=#{conn[:db]}\"\n str << \" port=#{conn[:port]}\" if conn[:port].present?\n str << \" user=#{conn[:user]}\" if conn[:user].present?\n str << \" password=#{conn[:pass]}\" if conn[:pass].present?\n str\n end", "def default_database_name\n self.name.tableize\n end", "def db\n self.config[:db]\n end", "def db\n collection.db\n end", "def db\n collection.db\n end", "def db\n collection.db\n end", "def db\n @db ||= Database.new\n end", "def db(options = {})\n @_sequelizer_db ||= new_db(options)\n end", "def to_s\n\t\tparts = [ self.oid ]\n\n\t\tparts << \"NAME %s\" % Treequel::Schema.qdescrs( self.names ) unless self.names.empty?\n\n\t\tparts << \"DESC '%s'\" % [ self.desc ] if self.desc\n\t\tparts << \"OBSOLETE\" if self.obsolete?\n\t\tparts << \"APPLIES %s\" % [ Treequel::Schema.oids(self.attr_oids) ]\n\t\tparts << self.extensions.strip unless self.extensions.empty?\n\n\t\treturn \"( %s )\" % [ parts.join(' ') ]\n\tend", "def create_dsn_string\n @dsn = \"dbi:#{@driver}:#{@database}\" if @driver\n end", "def database\n if database_name.nil?\n MongoMapper.database\n else\n connection.db(database_name)\n end\n end", "def database(options = nil)\n unless options.nil?\n @database = options\n ::DataMapper.setup(:default, @database)\n end\n @database\n end", "def getDB\n @db\n end", "def db\n @db ||= new_connection\n end", "def db\n @connection.pg rescue nil\n end", "def description\n \"Derelict::Connection at '#{path}' using #{instance.description}\"\n end", "def db_path\n @db\n end", "def db\n return @db if @db\n @db = self == Model ? Sequel.synchronize{DATABASES.first} : superclass.db\n raise(Error, \"No database associated with #{self}: have you called Sequel.connect or #{self}.db= ?\") unless @db\n @db\n end", "def db\n return @db if @db\n @db = self == Model ? Sequel.synchronize{DATABASES.first} : superclass.db\n raise(Error, \"No database associated with #{self}: have you called Sequel.connect or #{self}.db= ?\") unless @db\n @db\n end", "def opendb\n db = Rho::Database.new(Rho::Application.databaseFilePath('local'), 'local')\n render :json => db.to_s\n return db.to_s\n end", "def db\n unless @db\n @db = ::Sequel.connect(uri)\n @db.logger = @options[:sequel_logger]\n end\n @db\n end" ]
[ "0.6682262", "0.6682262", "0.65253216", "0.6491473", "0.6462967", "0.64000726", "0.62670565", "0.62350756", "0.61628574", "0.61399853", "0.61307466", "0.61161053", "0.6096781", "0.6096781", "0.6061487", "0.60310984", "0.60263556", "0.600335", "0.5995143", "0.5969432", "0.59687054", "0.59578854", "0.59390396", "0.59124947", "0.5895111", "0.5892393", "0.58854383", "0.58854383", "0.58845377", "0.5872343", "0.5870833", "0.58633953", "0.584543", "0.584081", "0.58168274", "0.5815164", "0.5802701", "0.58015364", "0.57885325", "0.57861733", "0.5778386", "0.5778386", "0.5766145", "0.57450545", "0.5725175", "0.5721803", "0.5720626", "0.57083327", "0.57027566", "0.57027566", "0.56966656", "0.5684214", "0.5664603", "0.5664603", "0.5663899", "0.5661873", "0.56543064", "0.56408274", "0.5638244", "0.56353474", "0.5614924", "0.5614924", "0.56043655", "0.5604142", "0.5602413", "0.559787", "0.55920374", "0.5590297", "0.5590297", "0.55652297", "0.55453974", "0.55360603", "0.5528127", "0.5526013", "0.55225354", "0.5509096", "0.550805", "0.5507881", "0.54970056", "0.5495126", "0.5482891", "0.5482739", "0.54814017", "0.54759246", "0.54759246", "0.54759246", "0.5470057", "0.5463151", "0.54630774", "0.54555017", "0.545184", "0.5441684", "0.543934", "0.54317576", "0.54312056", "0.5427131", "0.5424723", "0.5421772", "0.5421772", "0.541876", "0.54080856" ]
0.0
-1
Proxy the literal call to the dataset. DB.literal(1) 1 DB.literal(:a) a DB.literal('a') 'a'
def literal(v) schema_utility_dataset.literal(v) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def literal(v)\n schema_utility_dataset.literal(v)\n end", "def literal(v)\n schema_utility_dataset.literal(v)\n end", "def sql_literal(*)\n @dataset.sql\n end", "def sql_literal(ds)\n ds.literal(sql_expr)\n end", "def literal; end", "def literal(v)\n case v\n when LiteralString\n v\n when String\n \"'#{v.gsub(/\\\\/, \"\\\\\\\\\\\\\\\\\").gsub(/'/, \"''\")}'\"\n when Integer, Float\n v.to_s\n when BigDecimal\n v.to_s(\"F\")\n when NilClass\n NULL\n when TrueClass\n BOOL_TRUE\n when FalseClass\n BOOL_FALSE\n when Symbol\n symbol_to_column_ref(v)\n when ::Sequel::SQL::Expression\n v.to_s(self)\n when Array\n v.all_two_pairs? ? literal(v.sql_expr) : (v.empty? ? '(NULL)' : \"(#{v.collect{|i| literal(i)}.join(COMMA_SEPARATOR)})\")\n when Hash\n literal(v.sql_expr)\n when Time, DateTime\n v.strftime(TIMESTAMP_FORMAT)\n when Date\n v.strftime(DATE_FORMAT)\n when Dataset\n \"(#{v.sql})\"\n else\n raise Error, \"can't express #{v.inspect} as a SQL literal\"\n end\n end", "def sql_literal(object)\n object.literal(to_s)\n end", "def emit_literal\n text = literal_run.join\n self.literal_run = nil\n emit(:literal, :literal, text)\n end", "def sql_literal(value)\n Arel::Nodes::SqlLiteral.new(value)\n end", "def query_literal(args)\n case (s = args[0])\n when LiteralString, SQL::Blob\n nil\n when String\n if args.length == 1\n LiteralString.new(s)\n else\n SQL::PlaceholderLiteralString.new(s, args[1..-1])\n end\n end\n end", "def literal(value)\n end", "def `(s)\n Sequel::Deprecation.deprecate(\"Using Sequel#VirtualRow#` to create a literal SQL fragment\", \"Use Sequel.lit instead\")\n Sequel::LiteralString.new(s)\n end", "def emit_literal\n text = literal.join\n self.literal = nil\n emit(:literal, :literal, text)\n end", "def sql_of( expr, dataset)\n dataset.send :literal_expression_append, rv=String.new, expr\n rv\n end", "def emit_literal\n ts, te = literal.first[1], literal.last[2]\n text = literal.map {|t| t[0]}.join\n\n text.force_encoding('utf-8') if text.respond_to?(:force_encoding)\n\n self.literal = nil\n emit(:literal, :literal, text, ts, te)\n end", "def emit_literal\n ts, te = literal.first[1], literal.last[2]\n text = literal.map {|t| t[0]}.join\n\n text.force_encoding('utf-8') if text.respond_to?(:force_encoding)\n\n self.literal = nil\n emit(:literal, :literal, text, ts, te)\n end", "def lit(*args)\n args.empty? ? LiteralString.new(self) : SQL::PlaceholderLiteralString.new(self, args)\n end", "def lit(*args)\n args.empty? ? self : SQL::PlaceholderLiteralString.new(self, args)\n end", "def `(value)\n ::Sequel.lit(value)\n end", "def _literal\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_number)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_string)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_literal unless _tmp\n return _tmp\n end", "def literal(buffer)\n reader = lambda { |string = ''|\n buffer.major_mode.read(1) do |event|\n if unicode = event.unicode\n string += unicode # copy\n buffer.message string.inspect\n\n case result = literal_handle(buffer, string)\n when nil\n reader.call(string)\n when String\n literal_insert(buffer, result)\n end\n else\n return # Unverrichteter Dinge\n end\n end\n }\n\n reader.call\n end", "def visit_Squeel_Nodes_Literal(o, parent)\n Arel.sql(o.expr)\n end", "def append_literal(data, ts, te)\n self.literal = literal || []\n literal << text(data, ts, te)\n end", "def append_literal(data, ts, te)\n self.literal = literal || []\n literal << text(data, ts, te)\n end", "def literal_value(param)\n case param[:type]\n when \"integer\", \"decimal\", \"boolean\"\n param[:value][:value]\n else\n \"\\\"#{param[:value][:value]}\\\"\"\n end\n end", "def append_literal(data, ts, te)\n self.literal = literal || []\n literal << copy(data, ts, te)\n end", "def literalize(name); end", "def lit\n Sequel::Deprecation.deprecate(\"Sequel::SQL::Expression#lit\", \"This method returns self, so just use the receiver\")\n self\n end", "def append_literal(data, ts, te)\n (self.literal_run ||= []) << copy(data, ts, te)\n end", "def set_literal\n <<-CODE\n next_int;\n tuple_put(state, cpu_current_literals(state, c), _int, stack_top());\n CODE\n end", "def literal\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 22 )\n\n\n value = nil\n\n\n a = nil\n\n\n begin\n # at line 142:3: (a= INTEGER |a= FLOAT |a= BOOLEAN |a= STRING |a= CHAR )\n alt_38 = 5\n case look_38 = @input.peek( 1 )\n when INTEGER then alt_38 = 1\n when FLOAT then alt_38 = 2\n when BOOLEAN then alt_38 = 3\n when STRING then alt_38 = 4\n when CHAR then alt_38 = 5\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 38, 0 )\n\n end\n case alt_38\n when 1\n # at line 142:5: a= INTEGER\n a = match( INTEGER, TOKENS_FOLLOWING_INTEGER_IN_literal_1037 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = LiteralEval.new(:Int, a.text) \n # <-- action\n end\n\n\n when 2\n # at line 143:5: a= FLOAT\n a = match( FLOAT, TOKENS_FOLLOWING_FLOAT_IN_literal_1047 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = LiteralEval.new(:Float, a.text) \n # <-- action\n end\n\n\n when 3\n # at line 144:5: a= BOOLEAN\n a = match( BOOLEAN, TOKENS_FOLLOWING_BOOLEAN_IN_literal_1059 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = LiteralEval.new(:Bool, a.text) \n # <-- action\n end\n\n\n when 4\n # at line 145:5: a= STRING\n a = match( STRING, TOKENS_FOLLOWING_STRING_IN_literal_1069 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = LiteralEval.new(:String, a.text) \n # <-- action\n end\n\n\n when 5\n # at line 146:5: a= CHAR\n a = match( CHAR, TOKENS_FOLLOWING_CHAR_IN_literal_1080 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = LiteralEval.new(:Char, a.text) \n # <-- action\n end\n\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 22 )\n\n\n end\n\n return value\n end", "def literal(m, thing)\n thing.downcase!\n if @@learning_db.has_key? thing\n info = @@learning_db[thing]\n m.reply \"#{thing} =is= #{info}.\"\n else\n m.reply \"No entry for #{thing}\"\n end\n end", "def literal_string(v)\n db.synchronize{|c| \"'#{c.escape(v)}'\"}\n end", "def initialize(literal)\n @literal = literal\n @lemmata = []\n end", "def sql(string)\n ::Arel::Nodes::SqlLiteral.new(string)\n end", "def to_sparql(**options)\n \"isLiteral(\" + operands.first.to_sparql(**options) + \")\"\n end", "def get_literal(rdf_uri, predicate)\n Rails.logger.debug(\"RdfQuery::get_literal(#{rdf_uri}, #{predicate})\") if @@trace_on == true\n\n vars = Hash[:literal => RDF::Literal]\n statements = Array.[](\n \"<#{rdf_uri}> <#{predicate}> ?literal\"\n )\n rows = execute_select(vars, statements, nil, nil, nil)\n\n Rails.logger.debug(\"RdfQuery::get_literal json_result = #{rows}\") if @@trace_on == true\n\n literal = nil\n literal = RDF::Literal.new(rows[0][:literal]) if !rows.empty?\n literal\n end", "def sql_literal_append(ds, sql)\n sql << 'ROW'\n ds.literal_append(sql, to_a)\n if db_type\n sql << '::'\n ds.quote_schema_table_append(sql, db_type)\n end\n end", "def init_value(aLiteral)\n self.value = aLiteral.dup\n end", "def literal_string_append(sql, v)\n sql << APOS << db.synchronize{|c| c.escape_string(v)} << APOS\n end", "def db(*args); data(1, args); end", "def literal_blob_append(sql, v)\n sql << \"'\" << v.gsub(/[\\000-\\037\\047\\134\\177-\\377]/n){|b| \"\\\\#{(\"%o\" % b[0..1].unpack(\"C\")[0]).rjust(3, '0')}\"} << \"'\"\n end", "def to_ruby_literal\n \"Alf::Relation([\" + tuples.map{|t| Support.to_ruby_literal(t) }.join(', ') + \"])\"\n end", "def escape_literal(text)\n text\n end", "def literal_Factory(o) # rubocop:disable Naming/UncommunicativeMethodParamName\n literal(o.model)\n end", "def serialize_literal(value)\n case value\n when NilClass, FalseClass, TrueClass, String, Numeric\n value\n when Symbol\n value.to_s\n when Array\n function(:array, *value.map { |v| serialize_literal(v) })\n when Hash\n function(:object, *value.map { |k, v| [k.to_s, serialize_literal(v)] }.flatten(1))\n else\n Sequel.object_to_json(value)\n end\n end", "def literal(*args)\n\t\t\tif args.length==1 && args[0].is_a?(Hash)\n\t\t\t\t# Hashes - literal(frog: 1, bill: 2)\n\t\t\t\tCondition.new.from_list(:literal, [args[0]])\n\t\t\telse\n\t\t\t\t# Arrays - literal(1,2,3)\n\t\t\t\tCondition.new.from_list(:literal, [args])\n\t\t\tend\n\t\tend", "def sql_literal_append(ds, sql)\n check_columns!\n sql << 'ROW'\n ds.literal_append(sql, values_at(*columns))\n if db_type\n sql << '::'\n ds.quote_schema_table_append(sql, db_type)\n end\n end", "def literal_string_append(sql, v)\n sql << \"'\" << ::Mysql.quote(v) << \"'\"\n end", "def literal_string_append(sql, v)\n sql << \"'\" << db.synchronize(@opts[:server]){|c| c.escape_string(v)} << \"'\"\n end", "def literal_string_append(sql, v)\n db.synchronize(@opts[:server]){|c| sql << c.quote(v)}\n end", "def literal_string_append(sql, v)\n sql << \"'\" << db.synchronize(@opts[:server]){|c| c.escape(v)} << \"'\"\n end", "def type_literal(t)\n t.is_a?(Symbol) ? t.to_s : literal(t)\n end", "def literal_blob_append(sql, v)\n if v.empty?\n sql << \"''\"\n else\n sql << \"x'#{v.unpack('H*').first}'\"\n end\n end", "def bind_data(statement,data)\n\t\tif !data.nil?\n\t\t\tdata.to_enum.with_index(1) do |value,index|\n\t\t\t\tcase value\n\t\t\t\twhen Fixnum, Bignum\n\t\t\t\t\tstatement.setLong(index,value)\n\t\t\t\twhen Float\n\t\t\t\t\t#Ruby floats are double precision\n\t\t\t\t\tstatement.setDouble(index,value)\n\t\t\t\twhen TrueClass, FalseClass\n\t\t\t\t\tstatement.setBoolean(index,value)\n\t\t\t\twhen String\n\t\t\t\t\tstatement.setString(index,value)\n\t\t\t\twhen Java::byte[]\n\t\t\t\t\tstatement.setBytes(index,value)\n\t\t\t\telse\n\t\t\t\t\tstatement.setString(index,value.to_s)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def string_literal!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 42)\n\n type = STRING_LITERAL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 486:4: '\\\\'' LITERAL_CHAR ( LITERAL_CHAR )* '\\\\''\n match(?\\')\n literal_char!\n # at line 486:22: ( LITERAL_CHAR )*\n loop do #loop 5\n alt_5 = 2\n look_5_0 = @input.peek(1)\n\n if (look_5_0.between?(0x0000, ?&) || look_5_0.between?(?(, 0xFFFF)) \n alt_5 = 1\n\n end\n case alt_5\n when 1\n # at line 486:22: LITERAL_CHAR\n literal_char!\n\n else\n break #loop 5\n end\n end\n match(?\\')\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__, 42)\n\n end", "def literal_string_append(sql, v)\n sql << \"'\" << v.gsub(\"'\", \"''\") << \"'\"\n end", "def literal_string_append(sql, s)\n sql << APOS << s.to_s.gsub(STRING_ESCAPE_RE){|m| STRING_ESCAPES[m]} << APOS\n end", "def parse_literal(expr)\n val = expr[1][1][1]\n val = val.to_sym if expr[0] == :symbol_literal ||\n expr[0] == :assoc_new\n val\n end", "def literal\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 33 )\n return_value = LiteralReturnValue.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_literal267 = nil\n __IVAR268__ = nil\n __ID269__ = nil\n string_literal270 = nil\n string_literal271 = nil\n string_literal272 = nil\n string_literal273 = nil\n __NUMBER274__ = nil\n __STRING275__ = nil\n __DOC276__ = nil\n __REGEX277__ = nil\n __ARRAY278__ = nil\n __OBJECT280__ = nil\n string_literal282 = nil\n __ID283__ = nil\n string_literal286 = nil\n argument279 = nil\n property_definition281 = nil\n parameters284 = nil\n statement_block285 = nil\n parameters287 = nil\n statement_block288 = nil\n\n tree_for_string_literal267 = nil\n tree_for_IVAR268 = nil\n tree_for_ID269 = nil\n tree_for_string_literal270 = nil\n tree_for_string_literal271 = nil\n tree_for_string_literal272 = nil\n tree_for_string_literal273 = nil\n tree_for_NUMBER274 = nil\n tree_for_STRING275 = nil\n tree_for_DOC276 = nil\n tree_for_REGEX277 = nil\n tree_for_ARRAY278 = nil\n tree_for_OBJECT280 = nil\n tree_for_string_literal282 = nil\n tree_for_ID283 = nil\n tree_for_string_literal286 = nil\n\n begin\n # at line 229:3: ( 'this' | IVAR | ID | 'null' | 'true' | 'false' | 'undefined' | NUMBER | STRING | DOC | REGEX | ^( ARRAY ( argument )* ) | ^( OBJECT ( property_definition )* ) | ^( 'function' ( ID )? parameters statement_block ) | ^( '->' ( parameters )? statement_block ) )\n alt_41 = 15\n case look_41 = @input.peek( 1 )\n when THIS then alt_41 = 1\n when IVAR then alt_41 = 2\n when ID then alt_41 = 3\n when NULL then alt_41 = 4\n when TRUE then alt_41 = 5\n when FALSE then alt_41 = 6\n when UNDEFINED then alt_41 = 7\n when NUMBER then alt_41 = 8\n when STRING then alt_41 = 9\n when DOC then alt_41 = 10\n when REGEX then alt_41 = 11\n when ARRAY then alt_41 = 12\n when OBJECT then alt_41 = 13\n when FUNCTION then alt_41 = 14\n when ARROW then alt_41 = 15\n else\n raise NoViableAlternative( \"\", 41, 0 )\n end\n case alt_41\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 229:5: 'this'\n _last = @input.look\n string_literal267 = match( THIS, TOKENS_FOLLOWING_THIS_IN_literal_1643 )\n\n tree_for_string_literal267 = @adaptor.copy_node( string_literal267 )\n\n @adaptor.add_child( root_0, tree_for_string_literal267 )\n\n\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 230:5: IVAR\n _last = @input.look\n __IVAR268__ = match( IVAR, TOKENS_FOLLOWING_IVAR_IN_literal_1649 )\n\n tree_for_IVAR268 = @adaptor.copy_node( __IVAR268__ )\n\n @adaptor.add_child( root_0, tree_for_IVAR268 )\n\n\n\n when 3\n root_0 = @adaptor.create_flat_list\n\n\n # at line 231:5: ID\n _last = @input.look\n __ID269__ = match( ID, TOKENS_FOLLOWING_ID_IN_literal_1655 )\n\n tree_for_ID269 = @adaptor.copy_node( __ID269__ )\n\n @adaptor.add_child( root_0, tree_for_ID269 )\n\n\n\n when 4\n root_0 = @adaptor.create_flat_list\n\n\n # at line 232:5: 'null'\n _last = @input.look\n string_literal270 = match( NULL, TOKENS_FOLLOWING_NULL_IN_literal_1661 )\n\n tree_for_string_literal270 = @adaptor.copy_node( string_literal270 )\n\n @adaptor.add_child( root_0, tree_for_string_literal270 )\n\n\n\n when 5\n root_0 = @adaptor.create_flat_list\n\n\n # at line 233:5: 'true'\n _last = @input.look\n string_literal271 = match( TRUE, TOKENS_FOLLOWING_TRUE_IN_literal_1667 )\n\n tree_for_string_literal271 = @adaptor.copy_node( string_literal271 )\n\n @adaptor.add_child( root_0, tree_for_string_literal271 )\n\n\n\n when 6\n root_0 = @adaptor.create_flat_list\n\n\n # at line 234:5: 'false'\n _last = @input.look\n string_literal272 = match( FALSE, TOKENS_FOLLOWING_FALSE_IN_literal_1673 )\n\n tree_for_string_literal272 = @adaptor.copy_node( string_literal272 )\n\n @adaptor.add_child( root_0, tree_for_string_literal272 )\n\n\n\n when 7\n root_0 = @adaptor.create_flat_list\n\n\n # at line 235:5: 'undefined'\n _last = @input.look\n string_literal273 = match( UNDEFINED, TOKENS_FOLLOWING_UNDEFINED_IN_literal_1679 )\n\n tree_for_string_literal273 = @adaptor.copy_node( string_literal273 )\n\n @adaptor.add_child( root_0, tree_for_string_literal273 )\n\n\n\n when 8\n root_0 = @adaptor.create_flat_list\n\n\n # at line 236:5: NUMBER\n _last = @input.look\n __NUMBER274__ = match( NUMBER, TOKENS_FOLLOWING_NUMBER_IN_literal_1685 )\n\n tree_for_NUMBER274 = @adaptor.copy_node( __NUMBER274__ )\n\n @adaptor.add_child( root_0, tree_for_NUMBER274 )\n\n\n\n when 9\n root_0 = @adaptor.create_flat_list\n\n\n # at line 237:5: STRING\n _last = @input.look\n __STRING275__ = match( STRING, TOKENS_FOLLOWING_STRING_IN_literal_1691 )\n\n tree_for_STRING275 = @adaptor.copy_node( __STRING275__ )\n\n @adaptor.add_child( root_0, tree_for_STRING275 )\n\n\n\n when 10\n root_0 = @adaptor.create_flat_list\n\n\n # at line 238:5: DOC\n _last = @input.look\n __DOC276__ = match( DOC, TOKENS_FOLLOWING_DOC_IN_literal_1697 )\n\n tree_for_DOC276 = @adaptor.copy_node( __DOC276__ )\n\n @adaptor.add_child( root_0, tree_for_DOC276 )\n\n\n\n when 11\n root_0 = @adaptor.create_flat_list\n\n\n # at line 239:5: REGEX\n _last = @input.look\n __REGEX277__ = match( REGEX, TOKENS_FOLLOWING_REGEX_IN_literal_1703 )\n\n tree_for_REGEX277 = @adaptor.copy_node( __REGEX277__ )\n\n @adaptor.add_child( root_0, tree_for_REGEX277 )\n\n\n\n when 12\n root_0 = @adaptor.create_flat_list\n\n\n # at line 240:5: ^( ARRAY ( argument )* )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __ARRAY278__ = match( ARRAY, TOKENS_FOLLOWING_ARRAY_IN_literal_1711 )\n\n tree_for_ARRAY278 = @adaptor.copy_node( __ARRAY278__ )\n\n root_1 = @adaptor.become_root( tree_for_ARRAY278, root_1 )\n\n\n\n if @input.peek == DOWN\n match( DOWN, nil )\n # at line 240:14: ( argument )*\n while true # decision 37\n alt_37 = 2\n look_37_0 = @input.peek( 1 )\n\n if ( look_37_0.between?( AMP, AMP_ASGN ) || look_37_0 == POST_DECR || look_37_0.between?( GEQ, AREF ) || look_37_0.between?( GREATER, HAT ) || look_37_0.between?( ARROW, HAT_ASGN ) || look_37_0 == ASGN || look_37_0 == REGEX || look_37_0 == IN || look_37_0 == INCR || look_37_0.between?( INSTANCEOF, RSHIFT3 ) || look_37_0 == RSHIFT3_ASGN || look_37_0.between?( RSHIFT_ASGN, COLON ) || look_37_0 == LEQ || look_37_0.between?( LESS, SLASH ) || look_37_0 == SLASH_ASGN || look_37_0.between?( STAR, DECR ) || look_37_0 == STAR_ASGN || look_37_0 == LSHIFT || look_37_0.between?( DELETE, THIS ) || look_37_0.between?( MINUS, TILDE ) || look_37_0.between?( MINUS_ASGN, MOD ) || look_37_0.between?( MOD_ASGN, TYPEOF ) || look_37_0.between?( NEQ, UMINUS ) || look_37_0.between?( NEQQ, UNDEFINED ) || look_37_0 == NEW || look_37_0 == NOT || look_37_0.between?( NULL, UPLUS ) || look_37_0 == OBJECT || look_37_0.between?( EQ, OR_ASGN ) || look_37_0 == FALSE || look_37_0 == PIPE || look_37_0 == PIPE_ASGN || look_37_0 == PLUS || look_37_0.between?( ID, DOC ) )\n alt_37 = 1\n\n end\n case alt_37\n when 1\n # at line 240:14: argument\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_argument_IN_literal_1713 )\n argument279 = argument\n @state.following.pop\n\n @adaptor.add_child( root_1, argument279.tree )\n\n\n else\n break # out of loop for decision 37\n end\n end # loop for decision 37\n\n match( UP, nil )\n end\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 13\n root_0 = @adaptor.create_flat_list\n\n\n # at line 241:5: ^( OBJECT ( property_definition )* )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __OBJECT280__ = match( OBJECT, TOKENS_FOLLOWING_OBJECT_IN_literal_1724 )\n\n tree_for_OBJECT280 = @adaptor.copy_node( __OBJECT280__ )\n\n root_1 = @adaptor.become_root( tree_for_OBJECT280, root_1 )\n\n\n\n if @input.peek == DOWN\n match( DOWN, nil )\n # at line 241:15: ( property_definition )*\n while true # decision 38\n alt_38 = 2\n look_38_0 = @input.peek( 1 )\n\n if ( look_38_0 == GET || look_38_0 == COLON || look_38_0 == SET )\n alt_38 = 1\n\n end\n case alt_38\n when 1\n # at line 241:15: property_definition\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_property_definition_IN_literal_1726 )\n property_definition281 = property_definition\n @state.following.pop\n\n @adaptor.add_child( root_1, property_definition281.tree )\n\n\n else\n break # out of loop for decision 38\n end\n end # loop for decision 38\n\n match( UP, nil )\n end\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 14\n root_0 = @adaptor.create_flat_list\n\n\n # at line 242:5: ^( 'function' ( ID )? parameters 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_literal282 = match( FUNCTION, TOKENS_FOLLOWING_FUNCTION_IN_literal_1737 )\n\n tree_for_string_literal282 = @adaptor.copy_node( string_literal282 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal282, root_1 )\n\n\n\n match( DOWN, nil )\n # at line 242:19: ( ID )?\n alt_39 = 2\n look_39_0 = @input.peek( 1 )\n\n if ( look_39_0 == ID )\n alt_39 = 1\n end\n case alt_39\n when 1\n # at line 242:19: ID\n _last = @input.look\n __ID283__ = match( ID, TOKENS_FOLLOWING_ID_IN_literal_1739 )\n\n tree_for_ID283 = @adaptor.copy_node( __ID283__ )\n\n @adaptor.add_child( root_1, tree_for_ID283 )\n\n\n\n end\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_parameters_IN_literal_1742 )\n parameters284 = parameters\n @state.following.pop\n\n @adaptor.add_child( root_1, parameters284.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_literal_1744 )\n statement_block285 = statement_block\n @state.following.pop\n\n @adaptor.add_child( root_1, statement_block285.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 15\n root_0 = @adaptor.create_flat_list\n\n\n # at line 243:5: ^( '->' ( parameters )? 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_literal286 = match( ARROW, TOKENS_FOLLOWING_ARROW_IN_literal_1754 )\n\n tree_for_string_literal286 = @adaptor.copy_node( string_literal286 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal286, root_1 )\n\n\n\n match( DOWN, nil )\n # at line 243:13: ( parameters )?\n alt_40 = 2\n look_40_0 = @input.peek( 1 )\n\n if ( look_40_0 == PARAMS )\n alt_40 = 1\n end\n case alt_40\n when 1\n # at line 243:13: parameters\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_parameters_IN_literal_1756 )\n parameters287 = parameters\n @state.following.pop\n\n @adaptor.add_child( root_1, parameters287.tree )\n\n\n end\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_statement_block_IN_literal_1759 )\n statement_block288 = statement_block\n @state.following.pop\n\n @adaptor.add_child( root_1, statement_block288.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__, 33 )\n\n end\n \n return return_value\n end", "def push_literal(*args)\n new_literal = Literal.new(self, *args)\n @literal_stack.push(new_literal)\n\n if new_literal.words? && new_literal.backslash_delimited?\n if new_literal.interpolate?\n self.class.lex_en_interp_backslash_delimited_words\n else\n self.class.lex_en_plain_backslash_delimited_words\n end\n elsif new_literal.words? && !new_literal.backslash_delimited?\n if new_literal.interpolate?\n self.class.lex_en_interp_words\n else\n self.class.lex_en_plain_words\n end\n elsif !new_literal.words? && new_literal.backslash_delimited?\n if new_literal.interpolate?\n self.class.lex_en_interp_backslash_delimited\n else\n self.class.lex_en_plain_backslash_delimited\n end\n else\n if new_literal.interpolate?\n self.class.lex_en_interp_string\n else\n self.class.lex_en_plain_string\n end\n end\n end", "def push_literal(*args); end", "def push_literal(*args); end", "def push_literal(*args); end", "def bound_variable_arg(arg, conn)\n case arg\n when Sequel::SQL::Blob\n {:value=>arg, :type=>17, :format=>1}\n when Sequel::SQLTime\n literal(arg)\n when DateTime, Time\n literal(arg)\n else\n arg\n end\n end", "def to_ruby_literal\n \"Alf::Relation[\" +\n tuples.collect{|t| Tools.to_ruby_literal(t)}.join(', ') + \"]\"\n end", "def literal_blob_append(sql, v)\n sql << \"'\" << db.synchronize(@opts[:server]){|c| c.escape_bytea(v)} << \"'\"\n end", "def apply(value, langTag, **options)\n raise TypeError, \"Literal #{value.inspect} is not simple\" unless value.simple?\n RDF::Literal.new(value.to_s, language: langTag.to_s)\n end", "def as_literal(object)\n case object\n when Float\n literal = RDF::Literal(object, canonicalize: true)\n literal.instance_variable_set(:@string, literal.to_s.downcase)\n literal\n else\n RDF::Literal(object, canonicalize: true)\n end\n end", "def type_literal(column)\n case column[:type]\n when Class\n type_literal_generic(column)\n when :Bignum\n type_literal_generic_bignum_symbol(column)\n else\n type_literal_specific(column)\n end\n end", "def lit *values\r\n if values.size == 1\r\n build_piece Literal, nil, values.first\r\n else\r\n one{\r\n for v in values\r\n build_piece Literal, nil, v\r\n end\r\n }\r\n end\r\n end", "def literal_string(v)\n \"N#{super}\"\n end", "def literal?\n false\n end", "def literal?\n false\n end", "def literal?\n false\n end", "def literal_string_append(sql, s)\n sql << \"'\" << db.synchronize(@opts[:server]){|c| c.escape(s)} << \"'\"\n end", "def type_literal_generic_set(column)\n type_literal_generic_string(column)\n end", "def literal_validation; end", "def literal_validation; end", "def push_literal(*args)\n new_literal = Literal.new(self, *args)\n @literal_stack.push(new_literal)\n\n if new_literal.words?\n if new_literal.interpolate?\n self.class.lex_en_interp_words\n else\n self.class.lex_en_plain_words\n end\n else\n if new_literal.interpolate?\n self.class.lex_en_interp_string\n else\n self.class.lex_en_plain_string\n end\n end\n end", "def type_literal_generic_object(column)\n type_literal_generic_string(column)\n end", "def send_literal(literal, command)\n when_not_awaiting_continuation do\n begin\n send_line_buffered \"{\" + literal.size.to_s + \"}\" + CRLF\n rescue => e\n command.fail e\n end\n waiter = await_continuations do\n begin\n send_data literal\n rescue => e\n command.fail e\n end\n waiter.stop\n end\n command.errback{ waiter.stop }\n end\n end", "def convert_input_dataset(ds)\n case ds\n when Symbol, SQL::Identifier, SQL::QualifiedIdentifier, SQL::AliasedExpression, LiteralString\n self.simple_table = db.literal(ds).freeze\n ds = db.from(ds)\n when Dataset\n ds = ds.from_self(:alias=>ds.first_source) if ds.joined_dataset?\n\n self.simple_table = if ds.send(:simple_select_all?)\n ds.literal(ds.first_source_table).freeze\n end\n @db = ds.db\n else\n raise(Error, \"Model.set_dataset takes one of the following classes as an argument: Symbol, LiteralString, SQL::Identifier, SQL::QualifiedIdentifier, SQL::AliasedExpression, Dataset\")\n end\n\n set_dataset_row_proc(ds.clone(:model=>self))\n end", "def sql_string\n StringExpression.new(:NOOP, self)\n end", "def sql_string\n StringExpression.new(:NOOP, self)\n end", "def with_sql(sql, *args)\n if sql.is_a?(Symbol)\n sql = public_send(sql, *args)\n else\n sql = SQL::PlaceholderLiteralString.new(sql, args) unless args.empty?\n end\n clone(:sql=>sql)\n end", "def literal?\n @value.is_a?(String) || @value.is_a?(Integer)\n end", "def push_literal\n <<-CODE\n next_int;\n t1 = cpu_current_literals(state, c);\n t2 = fast_fetch(t1, _int);\n stack_push(t2);\n CODE\n end", "def type_literal_generic(column)\n meth = \"type_literal_generic_#{column[:type].name.to_s.downcase}\"\n if respond_to?(meth, true)\n # Allow calling private methods as per type literal generic methods are private\n send(meth, column)\n else\n raise Error, \"Unsupported ruby class used as database type: #{column[:type]}\"\n end\n end", "def map_primitive(name, ident, &block)\n lang_eval do\n @prim_ident[name.to_sym] = ident.to_s\n @prim_to_lit[name.to_sym] = block\n end\n nil\n end", "def literal?(node); end", "def literal_symbol(sym)\n Sequel.synchronize{@symbol_literal_cache[sym]}\n end", "def to_cql_literal(value)\n return 'NULL' if value.nil?\n return \"'#{escape_special_chars(value)}'\" if value.is_a?(String)\n return \"'#{value}'\" if value.is_a?(Symbol)\n return \"#{value}\" if value.is_a?(Numeric)\n return \"'#{value.strftime(CQL_TIMESTAMP_FORMAT)}'\" if value.is_a?(Time) || value.is_a?(DateTime)\n #return \"#{value.to_i * 1000}\" if value.is_a?(Time) || value.is_a?(DateTime)\n\n # Set\n if value.is_a?(Set)\n return \"{#{value.map {|v| to_cql_literal(v)}.join(',')}}\"\n end\n\n # Map\n if value.is_a?(Hash)\n keys = value.keys\n return \"{#{keys.map {|k| \"#{to_cql_literal(k)} : #{to_cql_literal(value[k])}\" }.join(',')} }\"\n end\n\n # List\n return \"[#{value.map {|v| to_cql_literal(v)}.join(',')}]\" if value.is_a?(Array)\n\n return nil\n end", "def char_literal!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 41)\n\n type = CHAR_LITERAL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 482:4: '\\\\'' LITERAL_CHAR '\\\\''\n match(?\\')\n literal_char!\n match(?\\')\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__, 41)\n\n end", "def get(expr)\n dataset.get(expr)\n end", "def get(expr)\n dataset.get(expr)\n end", "def process_lit(exp)\n # TODO what about floats and big numbers?\n\n value = exp.shift\n c_type = exp.c_type\n case c_type\n when CType.long, CType.float then\n return value.to_s\n when CType.symbol then\n return value.to_s.inspect # HACK wrong! write test!\n else\n raise \"Bug! no: Unknown literal #{value}:#{value.class}\"\n end\n end", "def process_lit(exp)\n # TODO: audit against obfuscator\n value = exp.shift\n case value\n when Integer then\n return \"LONG2NUM(#{value})\"\n when Float then\n return \"rb_float_new(#{value})\"\n when Symbol\n return \"ID2SYM(rb_intern(#{value.to_s.inspect}))\"\n when Range\n f = process_lit [ value.first ]\n l = process_lit [ value.last ]\n x = 0\n x = 1 if value.exclude_end?\n\n return \"rb_range_new(#{f}, #{l}, #{x})\"\n when Regexp\n src = value.source\n return \"rb_reg_new(#{src.inspect}, #{src.size}, #{value.options})\"\n else\n raise \"Bug! no: Unknown literal #{value}:#{value.class}\"\n end\n return nil\n end", "def evaluate_literal(ast)\n catch :not_literal do\n return Puppet::Pops::Evaluator::LiteralEvaluator.new().literal(ast)\n end\n # TRANSLATORS, the 'ast' is the name of a parameter, do not translate\n raise ArgumentError, _(\"The given 'ast' does not represent a literal value\")\n end", "def literals_list\n @literals ||= \"\"\n end" ]
[ "0.7359322", "0.7359322", "0.72207606", "0.7206215", "0.69728357", "0.6900053", "0.6765317", "0.6736966", "0.6736953", "0.6721731", "0.6721001", "0.66926277", "0.6649559", "0.66234446", "0.6593598", "0.6593598", "0.64249414", "0.6328042", "0.6297928", "0.600468", "0.59647393", "0.5963342", "0.59430385", "0.59430385", "0.592608", "0.586906", "0.58365834", "0.57548326", "0.5741398", "0.57259107", "0.57139003", "0.5705132", "0.5700312", "0.5666149", "0.56532353", "0.56337386", "0.56285006", "0.55662966", "0.55602115", "0.55471987", "0.5542836", "0.55163527", "0.549335", "0.5426229", "0.5419957", "0.5405404", "0.53984505", "0.5392372", "0.53898454", "0.5388288", "0.5382242", "0.5380213", "0.53751737", "0.53716266", "0.5365158", "0.5340216", "0.5338237", "0.532834", "0.5314738", "0.53141534", "0.53139365", "0.53126824", "0.53126824", "0.53126824", "0.52995545", "0.5291712", "0.5291036", "0.5280793", "0.5277444", "0.52578217", "0.5255078", "0.52472997", "0.5229963", "0.5229963", "0.5229963", "0.5219739", "0.52082384", "0.51952475", "0.51952475", "0.51941794", "0.5181163", "0.51799357", "0.51726294", "0.5172328", "0.5172328", "0.5168658", "0.5162901", "0.51614696", "0.5159607", "0.5156842", "0.5151641", "0.5149898", "0.51280904", "0.51260775", "0.5121916", "0.5121916", "0.5116912", "0.5115235", "0.50913143", "0.50758314" ]
0.734128
2
Return the literalized version of the symbol if cached, or nil if it is not cached.
def literal_symbol(sym) Sequel.synchronize{@symbol_literal_cache[sym]} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing sym, *args\n response = ( [email protected]? && @cache.has_key?(sym) )? @cache[sym] : @ref.send(sym)\n return (response.nil?) ? String.new : response\n end", "def simple_get(symbol)\n @engine.get(symbol.to_s, nil, false)\n end", "def cache_get(key)\n nil\n end", "def cache key\n begin\n if expired?(key)\n content = Proc.new { yield }.call\n set( key, content )\n end\n content ||= get( key )\n return content\n rescue LocalJumpError\n return nil\n end\n end", "def get_cache(var, default = nil)\n stored = Rails.cache.read(var)\n stored == nil ? default : stored\nend", "def lookup(symbol)\n symbol = symbol.to_s\n sym_size = { 32 => 16, 64 => 24 }[@elfclass]\n # Leak GNU_HASH section header.\n nbuckets = @leak.d(hshtab)\n symndx = @leak.d(hshtab + 4)\n maskwords = @leak.d(hshtab + 8)\n\n l_gnu_buckets = hshtab + 16 + (@elfword * maskwords)\n l_gnu_chain_zero = l_gnu_buckets + (4 * nbuckets) - (4 * symndx)\n\n hsh = gnu_hash(symbol)\n bucket = hsh % nbuckets\n\n i = @leak.d(l_gnu_buckets + bucket * 4)\n return nil if i.zero?\n\n hsh2 = 0\n while (hsh2 & 1).zero?\n hsh2 = @leak.d(l_gnu_chain_zero + i * 4)\n if ((hsh ^ hsh2) >> 1).zero?\n sym = symtab + sym_size * i\n st_name = @leak.d(sym)\n name = @leak.n(strtab + st_name, symbol.length + 1)\n if name == (\"#{symbol}\\x00\")\n offset = { 32 => 4, 64 => 8 }[@elfclass]\n st_value = unpack(@leak.n(sym + offset, @elfword))\n return @libbase + st_value\n end\n end\n i += 1\n end\n nil\n end", "def literal_symbol_set(sym, lit)\n Sequel.synchronize{@symbol_literal_cache[sym] = lit}\n end", "def get!(key)\n record = object(key)\n return nil unless record\n record.rewrite_cache\n record.value\n end", "def force_get(key)\n # Return nothing if not in the cache or it has expired.\n return if key.nil?\n\n entry = @cache[key]\n return unless entry\n entry.object\n end", "def lookup(path)\n unless @cached.has_key?(path)\n @cached[path] = _lookup!(path)\n end\n return @cached[path]\n end", "def fetch_template_from_local_cache\n @@cache ||= {}\n \n return nil unless @@cache[@template_name]\n\n expiration = @@cache[@template_name][:expiration].to_i\n\n if expiration <= Time.now.to_i\n Rails.logger.debug( \"Local cache entry is too old, removing!\" )\n @@cache.delete( @template_name )\n return nil\n end\n\n Rails.logger.debug( \"Local cache still valid, expiring in #{expiration.inspect}\" )\n\n return @@cache[@template_name][:template]\n end", "def [](string)\n return nil unless cache_on?\n\n @mutex.synchronize { @cache[string] }\n end", "def get(key)\n code = @backend.get(key)\n return nil unless code\n parser.decode(code)\n rescue ::Memcached::Error\n nil\n end", "def getcached(url)\n _cached = instance_variable_get \"@cached_#{hashed(url)}\"\n return _cached unless _cached.nil?\n path = CACHE_FILE + \"#{hashed(url)}.json\"\n if File.exists?(path)\n f = File.open(path)\n _cached = JSON.parse(f.read)\n instance_variable_set(\"@cached_#{hashed(url)}\", _cached)\n return _cached\n end\n return nil\n end", "def getcached(url)\n _cached = instance_variable_get \"@cached_#{hashed(url)}\"\n return _cached unless _cached.nil?\n path = CACHE_FILE + \"#{hashed(url)}.json\"\n if File.exists?(path)\n f = File.open(path)\n _cached = JSON.parse(f.read)\n instance_variable_set(\"@cached_#{hashed(url)}\", _cached)\n return _cached\n end\n return nil\n end", "def getcached(url)\n _cached = instance_variable_get \"@cached_#{hashed(url)}\"\n return _cached unless _cached.nil?\n path = CACHE_FILE + \"#{hashed(url)}.json\"\n if File.exists?(path)\n f = File.open(path)\n _cached = JSON.parse(f.read)\n instance_variable_set(\"@cached_#{hashed(url)}\", _cached)\n return _cached\n end\n return nil\n end", "def getcached(url)\n _cached = instance_variable_get \"@cached_#{hashed(url)}\"\n return _cached unless _cached.nil?\n path = CACHE_FILE + \"#{hashed(url)}.json\"\n if File.exists?(path)\n f = File.open(path)\n _cached = JSON.parse(f.read)\n instance_variable_set(\"@cached_#{hashed(url)}\", _cached)\n return _cached\n end\n return nil\n end", "def getcached(url)\n _cached = instance_variable_get \"@cached_#{hashed(url)}\"\n return _cached unless _cached.nil?\n path = CACHE_FILE + \"#{hashed(url)}.json\"\n if File.exists?(path)\n f = File.open(path)\n _cached = JSON.parse(f.read)\n instance_variable_set(\"@cached_#{hashed(url)}\", _cached)\n return _cached\n end\n return nil\n end", "def getcached(url)\n _cached = instance_variable_get \"@cached_#{hashed(url)}\"\n return _cached unless _cached.nil?\n path = CACHE_FILE + \"#{hashed(url)}.json\"\n if File.exists?(path)\n f = File.open(path)\n _cached = JSON.parse(f.read)\n instance_variable_set(\"@cached_#{hashed(url)}\", _cached)\n return _cached\n end\n return nil\n end", "def getcached(url)\n _cached = instance_variable_get \"@cached_#{hashed(url)}\"\n return _cached unless _cached.nil?\n path = CACHE_FILE + \"#{hashed(url)}.json\"\n if File.exists?(path)\n f = File.open(path)\n _cached = JSON.parse(f.read)\n instance_variable_set(\"@cached_#{hashed(url)}\", _cached)\n return _cached\n end\n return nil\n end", "def getcached(url)\n _cached = instance_variable_get \"@cached_#{hashed(url)}\"\n return _cached unless _cached.nil?\n path = CACHE_FILE + \"#{hashed(url)}.json\"\n if File.exists?(path)\n f = File.open(path)\n _cached = JSON.parse(f.read)\n instance_variable_set(\"@cached_#{hashed(url)}\", _cached)\n return _cached\n end\n return nil\n end", "def getcached(url)\n _cached = instance_variable_get \"@cached_#{hashed(url)}\"\n return _cached unless _cached.nil?\n path = CACHE_FILE + \"#{hashed(url)}.json\"\n if File.exists?(path)\n f = File.open(path)\n _cached = JSON.parse(f.read)\n instance_variable_set(\"@cached_#{hashed(url)}\", _cached)\n return _cached\n end\n return nil\n end", "def getcached(url)\n _cached = instance_variable_get \"@cached_#{hashed(url)}\"\n return _cached unless _cached.nil?\n path = CACHE_FILE + \"#{hashed(url)}.json\"\n if File.exists?(path)\n File.open(path, \"r:UTF-8\") do |f|\n _cached = JSON.parse(f.read)\n instance_variable_set(\"@cached_#{hashed(url)}\", _cached)\n return _cached\n end \n end\n return nil\n end", "def get(key)\n @cache[key]\n end", "def get_cache(key: nil, prefix: nil, **additional_args)\n fallback = additional_args[:fallback]\n key = \"#{prefix}::#{key}\" if prefix\n value = @cache.get(key) if @cache\n value || fallback\n end", "def cache_fetch(key, default = nil)\n value = @client.get(key)\n value.nil? ? default : ::Marshal.load(value)\n end", "def cache_get(ck)\n cache_op(:get, ck)\n end", "def cache_fetch(key, default = nil)\n # Retrieve the data and return it\n record = @store[:key => namespaced(key)]\n record.value rescue default\n end", "def cache_fetch(key, default = nil)\n @moneta.fetch(key, default)\n end", "def get(key)\n @cache[key]\n end", "def cache_literal(polytex, format = :html)\n output = []\n lines = polytex.split(\"\\n\")\n cache_literal_environments(lines, output, format)\n output.join(\"\\n\")\n end", "def get(symbol)\n sym_key = [self.class, symbol]\n @@sym_map[sym_key] = new(symbol) unless @@sym_map[sym_key]\n @@sym_map[sym_key]\n end", "def cached(key)\n return nil unless cache?(key)\n auth_objects_cache[key]\n end", "def get\n @cached_value ||= RedisModel::Base.connection.get(key_label)\n end", "def lookup_uncached(val); end", "def lookup_uncached(val); end", "def cached\n @cached ||= Rails.cache.read(self.cache_key, opts_for_cache)\n end", "def cache_fetch(key, default = nil)\n value = @store[key]\n value.nil? ? default : value\n rescue ::MemCache::MemCacheError => e\n Log.error(e)\n nil\n end", "def fetch(key, default = nil)\n return default unless entry = @cache[\"#{@cache_name}:#{key}\"]\n return entry[:value] if entry[:expires].nil? || entry[:expires] > Time.now\n @cache.delete(\"#{@cache_name}:#{key}\")\n default\n end", "def get(key)\n # Return nothing if not in the cache or it has expired.\n return if key.nil?\n\n entry = @cache[key]\n return unless entry\n return if entry.expired?\n\n # Otherwise return the cached object.\n # We don't delete the cached entry because we might need to force its use if its expired and offline\n entry.object\n end", "def to_feature_with_caching(feature_or_symbol)\n if !caches_features?\n to_feature_without_caching(feature_or_symbol)\n elsif feature_or_symbol.kind_of?(Arturo::Feature)\n feature_or_symbol\n else\n symbol = feature_or_symbol.to_sym\n feature_caching_strategy.fetch(feature_cache, symbol) { to_feature_without_caching(symbol) }\n end\n end", "def fetch_stash(locale, name)\r\n value = stash.read(locale, name)\r\n return value if value\r\n return nil\r\n end", "def [](var_name)\n cache.fetch(cache_key(var_name), cache_options) do\n if (var = target(var_name)).present?\n var.value\n else\n defaults[var_name.to_sym]\n end\n end\n end", "def cached?; end", "def read\n output_str = ''\n loop do\n output_str = @cache[@current_symbol] || quote\n next_symbol\n break unless output_str.include?('$-')\n end\n output_str\n end", "def cache_get(k)\n synchronize{@cache[k]}\n end", "def get_cached(cache_key, proc, expiry_time = 5.minute)\n @data = Rails.cache.fetch(cache_key) || proc.call\n @data && Rails.cache.write(cache_key, @data, expires_in: expiry_time)\n\n @data\n end", "def get_if_cached(classname, id)\n classname = classname.to_sym\n id = id.to_i\n\n if @objects[classname] and obj = Wref::Map.get!(id)\n return obj\n end\n\n return nil\n end", "def find_literal(literal)\n @literals_map[literal]\n end", "def get(sym)\n call(sym)\n end", "def cache_value?; end", "def lookup(locale, key)\n cache_key = Translation.ck(locale, key)\n if @cache_store.exist?(cache_key) && value = @cache_store.read(cache_key)\n return value\n else\n translations = locale.translations.find_all_by_key(Translation.hk(key))\n case translations.size\n when 0\n value = nil\n when 1\n value = translations.first.value_or_default\n else\n value = translations.inject([]) do |values, t| \n values[t.pluralization_index] = t.value_or_default\n values\n end\n end\n\n @cache_store.write(cache_key, (value.nil? ? nil : value))\n return value\n end\n end", "def instance_variable_get_nil symbol\n begin\n instance_variable_get(symbol)\n rescue NameError\n nil\n end\n end", "def get(key)\n @compiler.get(key)\n end", "def symbol_or_code\n symbol || code\n end", "def memoize_expansion(symbol)\n memos[symbol] ||= expand(symbol).evaluate(@options)\n end", "def cached_instance\n @cached_instance ||= read_instance\n end", "def [](key)\n File.read(cache_path(key))\n rescue Errno::ENOENT\n nil\n end", "def fetch_node_nt(key)\n res = get_cache(key)\n return res if res\n canonicalize(key, fetch_node_from_db(key))\n end", "def get(resource, key)\n @cache[resource][key]\n end", "def cache key, opts = {}\n if opts[:ttl]\n # cache globaly if ttl provided\n Lux.cache.fetch(key, opts) { yield }\n else\n data = @var[:cache] ||= {}\n data = @var[:cache][key]\n return data if data\n @var[:cache][key] = yield\n end\n end", "def skip_symbol_cache?\n true\n end", "def lookup(name)\n begin\n eval(sanitize(name));\n rescue NameError\n return nil\n end\n end", "def [](key)\n\thash = hash(key)\n\n\tvalue = nil\n\tif File.exist?(File.join(@cache_dir, hash))\n\t value = ''\n\t File.open(File.join(@cache_dir, hash), 'rb') { |f|\n\t\tvalue += f.read\n\t }\n\tend\n\n\treturn value\n end", "def getq(sym)\n\t\tret_val = lisp_eval \"(vl-symbol-value \\'#{sym.to_s} )\"\n\tend", "def get_hash_val(name)\n\t\tfetch(name) if has_key?(name)\n\tend", "def load_sym(name)\n functions = (self.__cached_functions__ ||= {})\n functions[name] ||= begin\n symfunc = self.loader.load_sym(name, GL_COMMAND_TYPES[name])\n\n if symfunc.nil?\n raise NoMethodError, \"GL function #{name} could not be loaded\"\n end\n\n symfunc\n end\n end", "def cache_key; @cache.to_sym; end", "def [](key)\n key = key.to_s if key.is_a? Symbol\n self.old_fetch(key) rescue return nil\n end", "def cached_lookup(key, default, &block)\n if cache_has_key(key)\n retval = cached_value(key)\n else\n retval = yield key, default\n cache(key, retval)\n end\n retval\nend", "def cached\n raise NotImplementedError\n end", "def get_cached(args)\n cache_key = gen_cache_key(args)\n\n begin\n cached_val = MongoMapper::Document.redis.get(cache_key)\n rescue Exception\n cached_val = nil\n end\n\n unless cached_val\n res = where(args)\n result_count = res.count\n if result_count == 0\n return nil\n elsif result_count == 1\n cached_val = Octo::Utils.serialize(res.first)\n MongoMapper::Document.redis.setex(cache_key, get_ttl, cached_val)\n elsif result_count > 1\n cached_val = Octo::Utils.serialize(res)\n MongoMapper::Document.redis.setex(cache_key, get_ttl, cached_val)\n end\n end\n begin\n Octo::Utils.deserialize(cached_val)\n rescue Exception => e\n Octo.logger.error e\n nil\n end\n end", "def cached_value(name, object=nil, force=false)\n if force || Cache.fetch(name).nil?\n Cache[name] = object\n return_value = yield object\n Cache[name] = return_value if object.nil?\n end\n Cache.fetch(name)\n end", "def force!\n return @value if defined?(@value) and @memoized\n @value = Heist.evaluate(@expression, @scope)\n end", "def cached?(key)\n false\n end", "def cache_name\n self.name.methodize\n end", "def get_cached_value(key)\n case key\n when String\n key =~ /^\\$/ ? @cached_values.fetch(key.gsub(/[\\$\\{\\}]/, ''), key) : key\n when Hash\n key.inject({}) do |hash, (k, v)|\n k = k.to_s if [Float, Integer].include? k.class\n if v.is_a?(String)\n hash.merge(@cached_values.fetch(k.gsub(/[\\$\\{\\}]/, ''), k) => @cached_values.fetch(v.gsub(/[\\$\\{\\}]/, ''), v))\n else\n hash.merge(@cached_values.fetch(k.gsub(/[\\$\\{\\}]/, ''), k) => v)\n end\n end\n when Array\n key.collect do |k|\n k.is_a?(String) ? @cached_values.fetch(k.gsub(/[\\$\\{\\}]/, ''), k) : k\n end\n else\n key\n end\n end", "def fetch_from_cache\n get_cache_object().get make_key\n end", "def []( attrname )\n\t\tattrsym = attrname.to_sym\n\n\t\tif @values.key?( attrsym )\n\t\t\t# self.log.debug \" value for %p is cached (%p).\" % [ attrname, @values[attrsym] ]\n\t\telse\n\t\t\tself.log.debug \" value for %p is NOT cached.\" % [ attrsym ]\n\t\t\tvalue = self.get_converted_object( attrsym )\n\t\t\tself.log.debug \" converted value is: %p\" % [ value ]\n\t\t\tvalue.freeze if\n\t\t\t\tself.class.freeze_converted_values? &&\n\t\t\t\tvalue.respond_to?( :freeze )\n\t\t\t@values[ attrsym ] = value if value\n\t\tend\n\n\t\treturn @values[ attrsym ]\n\tend", "def get(key_or_constant = nil)\n if key_or_constant\n if key_or_constant.is_a?(Symbol)\n timing_functions[key_or_constant] || timing_functions[:default]\n else\n CAMediaTimingFunction.functionWithName(key_or_constant)\n end\n else\n timing_functions[:default]\n end\n end", "def simple_cache\n @@cache_store\n end", "def current_symbol\n current_data ? current_data[:symbol] : nil\n end", "def getcached(url)\n return @cached_json if !@cached_json.nil?\n path = CACHE_FILE + url + \".json\"\n if File.exists?(path)\n f = File.open(path)\n return JSON.parse(f.read)\n end\n return nil\n end", "def current_symbol\r\n current_data ? current_data[:symbol] : nil\r\n end", "def fetch(name)\n load_cache(name)\n end", "def get_cache(subset)\n instance_variable_get(\"@#{subset}\") || Rambling::Trie.create\n end", "def sym(name)\n SymEngine::Symbol.new(name)\nend", "def cached\n self\n end", "def read(key)\n @cache[key]\n end", "def version_for_cache\n @version_for_cache ||= if real_version\n real_version\n else\n log.warn(log_key) do\n \"No version given! Git caching disabled.\" \\\n end\n\n \"0.0.0\"\n end\n end", "def __read_memoize(attribute, at_attribute, callable, **opts)\n var = instance_variable_get(at_attribute)\n return var if var && !__reload?(opts)\n\n with_lock { __assign_value(attribute, at_attribute, callable, **opts) }\n instance_variable_get(at_attribute)\n end", "def ptr(ip)\n # use cache if ip was already resolved\n return @cache[ip] if @cache[ip]\n\n begin\n name = @hypedns.getname(ip).to_s\n @cache[ip] = name\n return name\n rescue Resolv::ResolvError, SocketError\n return nil\n end\n end", "def cache_lookup var_name, paginated = false, page = 1, per_page = TibbrResource.per_page\n cache_hit = (paginated) ? (paginated_collection_lookup(cache_get(var_name), page, per_page)) : cache_get(var_name)\n (cache_hit.nil? and block_given?) ? cache_set(var_name, yield) : cache_hit\n end", "def fetch_library_method(s)\n\n m = @pointer.__lib_method_cache[s]\n return m if m\n\n @pointer.__lib_method_cache[s] =\n loadstring_and_call(\"return #{s}\", nil, nil, nil)\n end", "def sym_lookup(line)\n out = ''\n if @st.key?(line[1..-1].to_sym) # if varible is already in table, replace with value\n out = \"@#{@st[line[1..-1].to_sym]}\"\n else\n @st[line[1..-1].to_sym] = @sym_address # add variable to table with current free address\n out = \"@#{@sym_address}\" # replace with value\n @sym_address += 1 # increment address\n end\n out\n end", "def get(uri)\n # check cached or not\n unless @table.has_key?(uri)\n # prepare cache path\n path = prepare_cache_path\n\n # link the resource file to cache path\n Resource[uri].link_to(path)\n @table[uri.to_s] = path\n end\n\n return @table[uri.to_s]\n end", "def extract_frozen_string_literal; end", "def get(key, lifetime: 2**32, dirty: false, &block)\n if block_given?\n return @hash[key][:value] if (dirty || @dirty) && locked? && expired?(key) && @hash.key?(key)\n synchronized { calc(key, lifetime, &block) }\n else\n rec = @hash[key]\n if expired?(key)\n return rec[:value] if dirty || @dirty\n @hash.delete(key)\n rec = nil\n end\n raise 'The key is absent in the cache' if rec.nil?\n rec[:value]\n end\n end", "def cache_variable_name\n end", "def cache_get(key)\n if @cache.key?(key)\n _data, _expire = *cache_read(key)\n if _expire.nil? || Time.now < _expire\n Merb.logger.info(\"cache: hit (#{key})\")\n return _data\n end\n @mutex.synchronize do @cache.delete(key) end\n end\n Merb.logger.info(\"cache: miss (#{key})\")\n nil\n end" ]
[ "0.6284992", "0.60796434", "0.55420995", "0.552674", "0.5505356", "0.5468994", "0.543161", "0.53786135", "0.5328546", "0.5303015", "0.52315605", "0.5215582", "0.51968235", "0.5171067", "0.5171067", "0.5171067", "0.5171067", "0.5171067", "0.5171067", "0.5171067", "0.5171067", "0.5171067", "0.51403224", "0.5114036", "0.51123655", "0.509664", "0.5090058", "0.50722116", "0.5068188", "0.5051905", "0.50334144", "0.50248235", "0.5022052", "0.50082034", "0.49992833", "0.49992833", "0.49711183", "0.49611607", "0.49597326", "0.4956201", "0.49506786", "0.49438137", "0.4917352", "0.49121833", "0.4896852", "0.48953992", "0.48822907", "0.4874782", "0.48642862", "0.48598763", "0.48459053", "0.4845386", "0.48436725", "0.48373273", "0.4817248", "0.4816615", "0.48068416", "0.47980416", "0.4777549", "0.47696942", "0.47634462", "0.4761074", "0.47575814", "0.4750098", "0.47443298", "0.473074", "0.47302127", "0.4702687", "0.47006324", "0.46964967", "0.46862152", "0.46794656", "0.46793795", "0.4674069", "0.46659675", "0.46588123", "0.4658447", "0.46466765", "0.46337235", "0.46266267", "0.4626122", "0.46210536", "0.4617296", "0.46154153", "0.4615188", "0.46135196", "0.4605277", "0.459507", "0.45933852", "0.45863178", "0.45815238", "0.45815015", "0.45701435", "0.45627025", "0.45601395", "0.45565027", "0.45533007", "0.4552233", "0.45490122", "0.45488298" ]
0.6670135
0
Set the cached value of the literal symbol.
def literal_symbol_set(sym, lit) Sequel.synchronize{@symbol_literal_cache[sym] = lit} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def literal_symbol(sym)\n Sequel.synchronize{@symbol_literal_cache[sym]}\n end", "def init_value(aLiteral)\n self.value = aLiteral.dup\n end", "def set_literal\n <<-CODE\n next_int;\n tuple_put(state, cpu_current_literals(state, c), _int, stack_top());\n CODE\n end", "def set_const\n <<-CODE\n next_literal;\n t1 = stack_pop();\n t2 = staticscope_get_module(cpu_current_scope(state, c));\n stack_push(cpu_const_set(state, c, _lit, t1, t2));\n CODE\n end", "def set_const_at\n <<-CODE\n next_literal;\n t2 = stack_pop();\n t3 = stack_pop();\n stack_push(cpu_const_set(state, c, _lit, t2, t3));\n CODE\n end", "def simple_assign(symbol, rexp)\n @engine.assign(symbol.to_s, rexp, nil)\n end", "def value= literal\r\n # Make sure regular expressions check at the beginnig of the string\r\n literal = correct_regexp literal if literal.is_a? Regexp\r\n @value = literal\r\n end", "def set_cache(value); end", "def set_cache(value); end", "def set_ivar\n <<-CODE\n next_literal;\n t2 = stack_pop();\n object_set_ivar(state, c->self, _lit, t2);\n stack_push(t2);\n CODE\n end", "def []= string, value\n return value unless @cache_on\n @mutex.synchronize { @cache[string] = value }\n end", "def set(sym, val)\n root = EM::Rserve::R::RubytoR::Translator.ruby_to_r val\n\n assign(sym, root) do |req|\n req.errback do |err|\n fiber.resume nil\n end\n req.callback do |msg|\n fiber.resume val\n end\n end\n\n Fiber.yield\n end", "def literal(value)\n end", "def []=(key,val)\n key = key.to_sym\n cache[key] = values[key] = val\n end", "def []=(key,val)\n key = key.to_sym\n cache[key] = values[key] = val\n end", "def []=(key,val)\n key = key.to_sym\n cache[key] = values[key] = val\n end", "def []=(string, value)\n return value unless cache_on?\n\n @mutex.synchronize { @cache[string] = value }\n end", "def liner_set(key, value)\n key = key.to_sym\n with_valid_attribute(key) do\n instance_variable_set \"@#{key}\", value\n end\n end", "def set_flag(symbol)\n @flags.add(symbol)\n end", "def symbol=(symbol)\n symbol = symbol.to_s.remove_underscores\n @symbol = Unit.use_superscript_characters? ? symbol.with_superscript_characters : symbol.without_superscript_characters\n end", "def set_cache\n cache_key = self.class.cache_key(self.key)\n Rails.cache.write(cache_key, self.actual_value)\n end", "def set(thing)\n @cache[section(thing)][key(thing)] = digest(thing)\n end", "def set(hash, &block)\n @compiler.set(hash, &block)\n end", "def tag_set(p_tag_sym, p_val) tag.send(\"#{p_tag_sym.to_s}=\", p_val) end", "def []=(key, val)\n Thread.current[:_alter_binding_local_] = val\n eval(\"#{key} = Thread.current[:_alter_binding_local_]\")\n Thread.current[:_alter_binding_local_] = nil\n end", "def set(key, value)\n @cache[key] = value\n end", "def set_local(name, value_node)\n @locals << name unless @locals.include?(name)\n emit \"#{name} = \"\n value_node.compile(self)\n end", "def set_char(attr, val); end", "def literal; end", "def cached_set(key, value)\n return unless h = self[:cache]\n Sequel.synchronize{h[key] = value}\n end", "def set(key, value, mtime)\n @cache[key] = {\n value: value,\n mtime: mtime\n }\n end", "def class_variable_set(sym,val) end", "def memoize_expansion(symbol)\n memos[symbol] ||= expand(symbol).evaluate(@options)\n end", "def set key, force=nil, &block\n return if (!force) && cache.include?(key)\n cache_val, store_val = block.call()\n return unless cache_val\n cache.set_nr key, cache_val # update cache\n store << store_val # save value\n self.misses += 1 # track the cache miss\n store_val\n end", "def set(opt,val)\n if opt.is_a?(Symbol)\n setopt(sym2curl(opt), val)\n else\n setopt(opt.to_i, val)\n end\n end", "def set key, value\n @reverse_cache[value.object_id] = key\n @cache[key] = value.object_id\n ObjectSpace.define_finalizer(value, @finalize)\n end", "def cache_set(k, v)\n synchronize{@cache[k] = v}\n end", "def []=(key, value)\n key, val = key.to_s, encode_value(value)\n record = find_or_create_by_hkey(key)\n record.update_attribute(\"hvalue\", val)\n save_cache(key, value)\n end", "def []=(key, value)\n @cache.put key, Base64.encode64(Marshal.dump(value))\n value\n end", "def []=(var_name, value)\n record = target_scoped.where(:var => var_name.to_s).first\n record ||= new(:var => var_name.to_s)\n\n record.value = value\n record.save!\n cache.write(cache_key(var_name), value, cache_options)\n value\n end", "def set(v)\n @val = v\n end", "def internal_set(symbol, value)\n if configurables.key?(symbol)\n configurables[symbol].set(configuration, value)\n elsif config_contexts.key?(symbol)\n config_contexts[symbol].restore(value.to_hash)\n else\n if config_strict_mode == :warn\n Chef::Log.warn(\"Setting unsupported config value #{symbol}.\")\n elsif config_strict_mode\n raise UnknownConfigOptionError, \"Cannot set unsupported config value #{symbol}.\"\n end\n configuration[symbol] = value\n end\n end", "def cache_inline_math(output)\n output.gsub!(/(?:\\\\\\((.*?)\\\\\\)|([^\\\\]|^)\\$(.*?[^\\\\])\\$)/m) do\n math = \"\\\\( #{$1 || $3} \\\\)\"\n key = digest(math)\n literal_cache[key] = math\n $2.to_s + xmlelement('inline') { key }\n end\n end", "def []=(key, value)\n invalidate_caches\n @keys[key.to_sym] = value\n end", "def with_value(symbol, value)\n previous = self[symbol]\n self[symbol] = value if value\n yield\n self[symbol] = previous\n end", "def []=( name, value )\n\t\t\t@locals[ name.to_sym ] = value\n\t\tend", "def set(value, options = {})\n @cached_value = nil\n\n RedisModel::Base.connection.set(key_label, value, options)\n end", "def const_set(p0, p1) end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def changeCell(cell, symbol)\n\t\t@field[cell].value = symbol\n\tend", "def value=(val); end", "def []=(k, v)\n\n load_onto_stack\n\n stack_push(k)\n stack_push(v)\n Lib.lua_settable(@pointer, -3)\n\n v\n end", "def user_symbol=(new_value)\n @user_symbol = new_value unless const_defined?(:UserSymbol)\n end", "def code_rc_set(expr)\n code js_set(:rc => expr)\n end", "def []=(key,value)\n ruby_set(key&&key.to_s, value)\n end", "def set(key, dec, force: false)\n key = normalize(key) or return\n if force || !table[key]\n table[key] = dec\n key\n end\n end", "def set_attribute(rule, attribute, value)\n begin\n rule.send(\"#{attribute}=\".to_sym, value)\n rescue NoMethodError\n raise AtomMarshallingError.new(\"Attribute #{attribute} unsupported in Atom #{rule_type_name(rule)}.\")\n end\n end", "def test_set_eval\n set = SetVariableEval.new(@int_var, @int_lit)\n set.eval\n assert_equal \"SET [Y+9], 10\\n\", MPPCompiler.last\n end", "def cache_set(ck, obj)\n @cache_store.set(ck, obj, @cache_ttl)\n end", "def lut_set_proc(lut_key, block)\n lut_proc[lut_key.to_sym] = block\n end", "def set named, type\n raise VariableError, \"Tried to set variable #{named} before initializing with a constant\" unless type or @vars[named]\n if @vars.key? named\n raise VariableError, \"Variable '#{named}' was previously set to a #{ @vars[named] } but is now being set to a #{type}\" if @vars[named] != type\n return refurbish(named)\n else\n @vars[named] = type\n return refurbish(named)\n end\n end", "def []=(name, value)\n ::Kernel.raise TypeError, \"name #{name} must convert to_sym\" unless name and name.respond_to?(:to_sym)\n @locals[name.to_sym] = value\n end", "def __const_set__(name, value)\n const_scope = env.constant_scope.module\n const_scope.__send__(:__const_set__, name, value)\n end", "def def_symbol(name, address, memory_type = nil)\n @symbol_set.def_symbol name, address, memory_type\n end", "def set(key, value)\n case key\n when Symbol\n return instance_variable_set(\"@#{key}\", value)\n when String\n return instance_variable_set(\"@#{key}\", value)\n end\n end", "def value=(_); end", "def put(cache_method, value)\n cache.send(\"#{cache_method}=\", value)\n end", "def set(key, value, ttl: ShopifyClient.config.cache_ttl)\n raise NotImplementedError\n end", "def []=(key, value)\n key = key.to_s if key.is_a? Symbol\n self.old_store(key, value)\n end", "def cache_literal(polytex, format = :html)\n output = []\n lines = polytex.split(\"\\n\")\n cache_literal_environments(lines, output, format)\n output.join(\"\\n\")\n end", "def __assign_value(attribute, at_attribute, callable, **opts)\n # reload the value of +var+ because we are now inside a synchronize block\n var = instance_variable_get(at_attribute)\n return var if var && !__reload?(opts)\n\n # now call whatever `was defined on +attr_memoized+ to get the actual value\n case callable\n when Symbol\n send(callable, **opts)\n when Method\n callable.call(**opts)\n when Proc\n instance_exec(&callable)\n else\n raise ArgumentError, \"expected one of #{AttrMemoized::SUPPORTED_INIT_TYPES.map(&:to_s).join(', ')} for attribute #{attribute}, got #{callable.class}\"\n end.tap do |result|\n instance_variable_set(at_attribute, result)\n end\n end", "def all=(symbol)\n [:symbol, :long_symbol, :name, :long_name].each do |field|\n send(field.to_s + '=', symbol.to_s)\n end\n end", "def assign_bytecode(g, value)\n g.compile_error \"Can't change the value of self\" if @name == :self\n\n g.push_cpath_top\n g.find_const :Apricot\n g.send :current_namespace, 0\n g.push_literal @name\n value.bytecode(g)\n g.send :set_var, 2\n end", "def []=(symbol_or_name, value)\n setting = find_setting(symbol_or_name)\n if value.nil?\n setting.delete if setting\n else\n if setting.nil?\n if @owner.respond_to?(:new_record?) && @owner.new_record?\n setting = @association.build(:name => symbol_or_name.to_s, :value => value)\n else\n setting = @association.find_or_create_by_name(symbol_or_name.to_s){ |s| s.value = value }\n end\n else\n setting.update_attributes(:value => value)\n end\n end\n end", "def update(symbol,identifier,value)\n\t\tif @symbols.has_key?(identifier)\n\t\t\t@symbols[identifier] = [symbol,value]\n\t\telse\n\t\t\tputs \"Identificador: #{identifier}, no se encuentra en ningun alcance\"\n\t\tend\n\tend", "def raw=(_); end", "def code= (_code)\r\n @code = _code\r\n #@code_count = Hash.new(0)\r\n count_code\r\n #puts \"Referee.code setter called\"\r\n end", "def []=(key, val)\n setAttribute(key.to_s, val)\n end", "def []=(key, val)\n setAttribute(key.to_s, val)\n end", "def []=(key, val)\n setAttribute(key.to_s, val)\n end", "def _set(name, value)\n @current_rules[name.to_s] = value\n nil\n end", "def variable_set(ref, val)\n _val = val.kind_of?(Variable) ? setup_package_id(val) : val\n variable_table.set(setup_package_id(ref), val)\n end", "def cache(key, value)\n @cache[key] = value\n end", "def []=(sha, attrs)\n cache[sha] = attrs\n end", "def set(option, value)\n @context.send \"#{option}=\".to_sym, value\n end", "def k_set!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 63 )\n\n\n\n type = K_SET\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 505:3: 'set'\n match( \"set\" )\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__, 63 )\n\n\n end", "def []=(name, value)\n @symbols[to_name(name)] = value\n value.name = name if Function === value\n value\n end", "def set_variable(expr, value)\n @variables[expr] = value.to_s.force_encoding(Encoding::UTF_8)\n end", "def set!(resource, value)\n resource.instance_variable_set(instance_variable_name, value)\n end", "def set_global!(type, name, new_value)\n addr = handler.sym(name)\n raise(Fiddle::DLError, \"cannot find symbol #{name}\") unless addr\n s = struct([\"#{type} value\"])\n tmp = s.new(addr)\n tmp.value = new_value\n tmp.value\n end", "def _setter_method\n :\"_#{self[:name]}=\"\n end", "def set key, value, exp\n @redis.setex key, exp, value\n end", "def _setter_method\n :\"_#{self[:name]}=\"\n end", "def set_native_reference(native)\n `#{native}.$$opal_native_cached = #{self}`\n @native = native\n end", "def set(key, value)\n @emphasis[key.to_sym] = value\n end", "def set_auth_token_cache(auth_token, raw_token)\n Authentication::RedisStore.instance.set(auth_token, raw_token)\n end", "def setMyULchar(character)\n @entry_field.setULchar(character)\n end" ]
[ "0.7176819", "0.6463257", "0.62933266", "0.6242512", "0.61245036", "0.58722264", "0.5863681", "0.5821044", "0.5821044", "0.57240736", "0.56877947", "0.5682074", "0.55532146", "0.5492333", "0.5492333", "0.54681176", "0.5458696", "0.54348177", "0.54327965", "0.54003865", "0.53690356", "0.53454614", "0.5344196", "0.5295924", "0.5281104", "0.52759963", "0.52277404", "0.52273464", "0.52219", "0.51939124", "0.51702327", "0.5165079", "0.5159247", "0.51344776", "0.5110536", "0.5101178", "0.51007473", "0.50872254", "0.50370926", "0.5027364", "0.50184184", "0.50180453", "0.5016631", "0.50077003", "0.50051594", "0.50028414", "0.49785417", "0.49686778", "0.4967097", "0.4967097", "0.4967097", "0.4967097", "0.49566028", "0.49424064", "0.49143338", "0.49025607", "0.49012083", "0.4899312", "0.4889493", "0.48892406", "0.48841637", "0.48755726", "0.48714888", "0.48690206", "0.4854263", "0.48469132", "0.48468706", "0.48386642", "0.48353127", "0.48230577", "0.48198873", "0.48035678", "0.4802184", "0.47997203", "0.47968557", "0.47888964", "0.47862893", "0.47793972", "0.4778089", "0.47776923", "0.47637606", "0.47637606", "0.47637606", "0.4760494", "0.4760415", "0.47586954", "0.47574484", "0.47539803", "0.47536024", "0.4749914", "0.47498044", "0.4741541", "0.47379246", "0.47350073", "0.47289315", "0.47262093", "0.4725495", "0.47212586", "0.47148833", "0.471448" ]
0.8097506
0