query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Approve a particular Store in the database
def approve_store_app(uid) Store.unlock.where(uid: uid) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm\n begin\n accept = params[:accept].eql?('true')\n st = StoreTransaction.where(id: params[:request_id], store: current_user.stores.find(params[:store_id])).first\n if accept\n st.status = 1\n st.store.owner = st.requester\n st.store.save!\n else\n st.status = 2\n end\n st.save!\n render json: st.sanitize_attributes, status: :ok\n rescue => e\n render json: {error: e}, status: :ok\n end\n end", "def approve!\n self.approved = true\n self.save\n end", "def seller_document_approve\n\t\t# send params to model\n\t\tSellerDocument.document_approve(params[:user_id],params[:approve_type])\n\t\t# redirect to the same page\n\t\tredirect_to :back\n\tend", "def approve\n if @ad.mark_as_approved!\n render_success_message 'AD successfully approved!'\n else\n render_error_model @ad\n end\n end", "def approve\n @profile.approved = true\n @profile.save!\n redirect_to profiles_path(status: 'prohibited')\n end", "def approve\n order = current_user.restaurant.orders.find(params[:id])\n order.update(status: 1)\n render json: {is_success: true}, status: :ok\n end", "def approve!\n update_attribute(:active, true)\n end", "def auto_approve!\n update_attribute(:approved_at,DateTime.now)\n update_attribute(:approved_by, User.APPLICATION)\n write_key!\n end", "def approve\n @company = Company.find(params[:id])\n if @company.approve!\n respond_with @company\n else\n respond_with @company, status: :unprocessable_entity\n end\n end", "def approve!\n self.approved_at = Time.now\n registration.approve\n save!\n end", "def confirm_sales_order\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @sales_order.confirm( current_user ) \n end", "def approve\n @booking = Booking.find(params[:id])\n @booking.status = \"accepted\"\n @booking.save\n\n authorize @booking\n redirect_to owned_consoles_path\n end", "def admin_approve_user\n @user.update(approved: true)\n redirect_to admin_path, notice: \"User Approved\"\n end", "def approve!(options = {})\n persist = options.fetch(:persist, true)\n transaction do\n self.approved = true\n self.approved_at = Time.now\n save! if persist\n AfterApprovalJob.enqueue(self.id)\n end\n end", "def confirm\n approval = Approval.find_by(id: params[:id])\n approval.approval = true\n approval.save\n redirect_to users_path\n end", "def approve_org\n @organization = Organization.find(params[:id])\n if admin_user_signed_in?\n @organization.approved = true\n if @organization.save\n flash[:notice] = \"#{@organization.name} approved\"\n else \n \n end\n redirect_to '/admin'\n end\n end", "def approve_order order\n @order = order\n @user = @order.user\n\n mail to: @user.mail, subject: \"Approve Order\"\n end", "def approve(user)\n if !self.approved?\n self.approved = true\n self.manager = user\n self.approved_at = Time.now\n end\n end", "def approve\n get_event\n @application.update_attributes(status: 'approved')\n add_to_approved_tickets_count\n redirect_to admin_event_path(@application.event_id),\n notice: \"#{ @application.name}'s application has been approved\"\n end", "def approve(options = {})\n commit_api.approve(hash, options)\n end", "def approve\n params[:tab] = 'pending'\n @page_title = @owner ? \"Approve #{@owner.display_name.titleize}'s Items\" : 'Approve Items'\n @menu_title = \"Review Item\"\n\n index\n end", "def edit_store(edited_store)\n store = Store.find(edited_store.uid)\n store.attributes = edited_store.attributes\n store.save!\n end", "def status\n @review = Review.find(params[:id])\n @review.update_attribute(:approved_id, current_user.id)\n flash[:info] = \"Review is approved!\"\n redirect_to admin_home_path\n end", "def approve!\n self.update_attribute(:status, ConfigCenter::User::APPROVED)\n end", "def change_status\n\t\tauthorize ShopProfile\n \t\t@shop = ShopProfile.find(params[:shop_profile_id])\n \t \n \t #Calling method approve_shop from Model\n \t ShopProfile.approve_shop(@shop, flash)\n \t redirect_to request.referrer || root_path\n \tend", "def approve\n self.update(status: \"APPROVED\")\n end", "def approve_revision revision\n current_revision.store if current_revision\n self.update_attribute(:revision_id, revision.id)\n end", "def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:admin_store])\n format.html { redirect_to([:admin,@store], :notice => 'Store was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end", "def approve_user\n @user = User.find(params[:id])\n\n @user.approved_torcida = true\n @user.save(validate: false)\n redirect_to root_path\n end", "def approve\n @group_user.approve!\n respond_to do |format|\n flash[:notice] = 'Membership approved.'\n format.html { redirect_to @group_user.group }\n format.xml { head :ok }\n end\n end", "def update_status_approved\n @transaction=Transaction.find(params[:id])\n @book=Book.find(@transaction.book_id)\n @transaction.update_attribute(:issued_to, @transaction.requested_by )\n @transaction.update_attribute(:issued_to_id, @transaction.requested_by_id )\n @transaction.update_attribute(:issue_date, Date.today)\n @transaction.update_attribute(:status, 1)\n @book.update_attribute(:quantity, @book.quantity-1)\n redirect_to @book, notice: \"Book approved to the student\"\nend", "def approve_user\n # set the enabled flag to true for the user\n # send out approval notification\n end", "def save\n self.approved = true\n super\n end", "def approve_setup_fee_collection( current_user )\n self.is_setup_fee_collection_approved = true \n self.setup_fee_collection_approver_id = current_user.id \n self.save\n \n # create all those payment payable : loan disbursement \n end", "def approve\n @asset_info_adjustment = AssetInfoAdjustment.accessible_by(current_ability, :approve).find(params[:id])\n if @asset_info_adjustment.approve!(current_user)\n respond_to do |format|\n format.html { redirect_to asset_info_adjustments_url, notice: I18n.t('controllers.approve_success', name: @asset_info_adjustment.class.model_name.human) } \n format.json { head :no_content }\n format.xml { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to asset_info_adjustments_url, flash: {error: @asset_info_adjustment.errors} }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end\n end", "def agree\n stage = Stage.find(params[:id])\n user = StageUser.find(:first, :conditions => [\"asset_user_id = ? AND stage_id =?\", current_user.id, stage.id])\n user.has_agreed_to_contract = true\n if user.save\n redirect_to asset_manager_stage_path(stage)\n else\n redirect_to contract_asset_manager_stage_path(stage)\n end\n end", "def approve!\n inventory.restock!(self, Time.current, inventory_check)\n update!(adjustment: difference)\n end", "def approve(real_amount)\n self.real_amount = real_amount\n set_ok!\n end", "def approve(real_amount)\n self.real_amount = real_amount\n set_ok!\n end", "def approve_user\n user = User.find(params[:id])\n user.update_attributes(coop_id: params[:coop_id])\n flash[:success] = \"#{user.name} has been admitted to \\\n #{Coop.find(user.coop_id).name}. Thanks MemCo!\"\n\n redirect_to root_url\n notify_user_approval(user, params[:coop_id])\n end", "def approve\n respond_to do |format|\n if @ad.update_as_approved_by(authed_user)\n format.html { redirect_to ops_ads_path, notice: 'Ad was successfully approved.' }\n format.json { render :show, status: :ok, location: ops_ads_path }\n else\n format.html { redirect_to edit_org_ad_path(@ad.org, @ad) }\n format.json { render json: @ad.errors, status: :unprocessable_entity }\n end\n end\n end", "def approve_me\n self.update!(status: 'APPROVED')\n end", "def set_store_status\n @store_status = StoreStatus.find(params[:id])\n end", "def approve\n set_service_request_status(ServiceProvider, ServiceRequest.statuses[:approved])\n\n # notify client\n NotificationsService.send_notification(@current_user, @service_request.service.client, NOTIFICATION_TYPE[:approved_your_request], @service_request.service_id)\n end", "def approve!\n self.update_attribute(:status, APPROVED)\n self.registration.update_attribute(:status, Registration::VERIFIED) if self.registration\n end", "def approve \n @job = Job.find(params[:id])\n\n respond_to do |format|\n if @job.approve \n flash[:notice] = 'Job was successfully approved.'\n format.html { redirect_to(@job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"show\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end", "def store\n if (Store.ids.include?(params[:id].to_i))\n @store=Store.find(params[:id])\n else\n redirect_to root_path\n end\n end", "def approve\n @reservation.is_approved = true\n @reservation.status = :approved\n @reservation.admin_response_time = Time.now\n respond_to do |format|\n if @reservation.save\n notify_approved\n format.html { redirect_to @reservation, flash: { success: 'Reservation has been approved' } }\n format.json { render :show, status: :ok, location: @reservation }\n else\n respond_to_errors :show, format\n end\n end\n end", "def update\n show = Show.find params[:id]\n if show.update approved_params\n flash[:notice] = \"Show Updated!\"\n redirect_to \"/admins/admin/#{current_admin.id}\"\n else\n render :edit\n end\n end", "def approve\n @user.state = User::ENABLED\n @user.save\n \n respond_to do |format|\n format.html { redirect_to(registrations_users_path, :notice => \"User registration was successfully approved.\") }\n format.xml { head :ok }\n end\n end", "def approve\n email = Email.find(params[:id])\n email.state = \"Approved\"\n # Send email\n if email.save!\n email.send_email!\n head :no_content\n else\n respond_with email, status: :unprocessable_entity\n end\n end", "def email_approve(params)\n http_helper.send_post_request(\"#{@url_prefix}/#{get_user_id!(params)}/email/approve\", params)\n end", "def auto_approve\n user=photo.user or return nil\n if user.admin?\n photo.approver_id=user.id\n photo.status = Photo::STATUS_APPROVED\n end\n end", "def set_store\n @store = current_account.stores.find(params[:id])\n end", "def set_store\n @store = current_account.stores.find(params[:id])\n end", "def escalate_approval\n if !self.user.manager_id.nil?\n if self.manager.manager_id.nil?\n self.auto_approve()\n else\n UserMailer.escalate_approval_email(self).deliver\n self.is_escalated = true\n self.save\n end\n end\n end", "def create\n @store = Store.new(store_params)\n @store.user_id = current_user.id\n current_user.update!(type: \"Owner\")\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to myStore_stores_path, notice: 'Store was successfully created.' }\n format.json { render :show, status: :created, location: @store }\n else\n format.html { render :new }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def approve\n if Interface.first.nil?\n redirect_to root_url and return\n end\n\n n = Notification.find_by(id: params[:notif])\n n.actor.organization.update_attribute(:approved, true)\n n.actor.update_attribute(:approved, true)\n UserMailer.approved_org(n.actor.email, n.actor.organization.name).deliver_now\n end", "def accept \n order = Order.find(params[:orderid])\n order.status = \"Accepted\"\n order.save!\n if order.artwork.sold == false\n order.artwork.toggle!(:sold)\n end\n Order.find_all_by_artwork_id(order.artwork.id).each do |f|\n if f.status != \"Accepted\"\n f.status = \"Declined\"\n f.save!\n end\n end\n redirect_to [:admin, User.find(params[:id])]\n end", "def set_store_transaction\n @store_transaction = StoreTransaction.find(params[:id])\n end", "def alteration_approve\n UserNotifier.deliver_in_process(self, user)\n end", "def status\n @post = Post.find(params[:id])\n @post.update_attribute(:approved_id, current_user.id)\n flash[:info] = \"Advertisement is approved!\"\n redirect_to admin_home_path\n end", "def approve_clutch\n @clutch.approved = !@clutch.approved\n if @clutch.save\n redirect_to users_path\n else\n redirect_to users_path, alert: \"Error! Failed to Approve!\"\n end\n end", "def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to(@store, :notice => 'Store was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end", "def approve_user(user_id)\n post(\"/users/#{user_id}/approve\")\n end", "def update\n\t\t\t\t @store = Store.find(params[:id])\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t if @store.update_attributes(params[:store])\n\t\t\t\t\tformat.html { redirect_to @store, notice: 'Store was successfully updated.' }\n\t\t\t\t\tformat.json { head :no_content }\n\t\t\t\t else\n\t\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\t\tformat.json { render json: @store.errors, status: :unprocessable_entity }\n\t\t\t\t end\n\t\t\t\t end\n\t\t\t\t end", "def approve\n return render_json_forbidden(:unknown_keeper) if @keeper.nil?\n return render_json_forbidden(:company_not_present) if @keeper.company.nil?\n\n @company = @keeper.company\n\n if @company.update(approved: true)\n render_json\n else\n render_json_unprocessable(error: :invalid, issues: @company.errors.details)\n end\n end", "def approve\n registration = Registration.find(params[:id])\n if (params[:assigned_points].present? || registration.evidence.points)\n registration.update(assigned_points: params[:assigned_points])\n registration.update(approved: true)\n end\n redirect_to :registrations\n end", "def set_store\n @store = Store.find(params[:store_id]) if params[:store_id]\n end", "def approve!\n raise 'not pending' unless self.status == 'PENDING'\n\n transaction do\n self.status = 'APPROVED'\n self.save!\n overlapping_pending_requests.update_all(status: 'DENIED')\n end\n end", "def apply_approve\n \t# condition for check the cancelled flag then update flag as false else update only apply approve\n @product.cancelled ? @product.update(apply_approve: true,cancelled: false) : @product.update(apply_approve: true)\n @product.update(apply_approve: true)\n respond_to do |format|\n format.html { redirect_to publish_product_url(@product)}\n format.json { head :no_content }\n end\n end", "def set_store_order\n @store_order = StoreOrder.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def approve\n transition_to :approved\n end", "def sepa\n mandate = @user.mandates.last\n if mandate.present? && mandate.ready?\n redirect_to_for_user_or_admin and return\n end\n redirect_to mandate.slimpay_approval_url and return if mandate && mandate.waiting?\n mandate = Mandate.sign(@user)\n if mandate.present?\n redirect_to mandate.slimpay_approval_url\n else\n redirect_to_for_user_or_admin(true)\n end\n end", "def grant\n self.status = 'granted'\n save\n end", "def approve\n logger.info(\"in approvals controller: approve\")\n\n logger.info(\"in approvals controller: approve?\")\n if @changeset.approved?\n logger.info(\"in approvals controller: approve? yep!\")\n flash[:notice] = l(:approved_already)\n else\n logger.info(\"in approvals controller: approve? nope!\")\n begin\n @changeset.approve(User.current)\n\n logger.info(\"User #{User.current.login} approved revision ##{@changeset.revision} in repository #{@changeset.repository.url}\")\n flash[:notice] = l(:revision_approved, :rev => \"#{@changeset.revision}\")\n\n rescue => e\n flash[:error] = e.message\n end\n end\n\n respond_to do |format|\n format.html { redirect_to request.referer || '/' }\n format.js\n format.api\n end\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def confirm_delivery\n @delivery = Delivery.find_by_id params[:delivery_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @delivery.confirm( current_user ) \n @delivery.reload\n end", "def show\n # @store_details =StoreDetailPolicy.new(current_user, @store_detail).new?\n # @store_detail = StoreDetail.find(params[:id])\n #authorize @store_detail, :show?\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def commit\n offer = Offer.find(params[:id])\n if offer\n if offer.product.user_id == @current_user.id\n if offer.offer_status != Offer.OFFER_COMPLETED\n conversation = offer.conversation\n conversation_id = conversation.id\n conversation.destroy\n\n product = offer.product\n product.sold_status = Product.SOLD_SOLD\n product.save\n\n SearchEntry.destroy_index product\n \n offer.offer_status = Offer.OFFER_COMPLETED\n offer.save\n\n notify(\"NOTIF_TRANSACTION_FINISHED\", {\n conversation: conversation_id,\n user: {\n id: @current_user.id,\n username: @current_user.username,\n first_name: @current_user.first_name,\n last_name: @current_user.last_name\n },\n product: {\n id: product.id,\n product_name: product.product_name\n },\n offer: {\n price: offer.price\n }\n }, offer.user_id)\n\n render status: 200, json: {error: false, id: offer.id}\n else\n render status: 471, json: {error: true}\n end\n else\n render status: 472, json: {error: true}\n end\n else\n render status: 404, json: {error: true}\n end\n end", "def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to '/stores/admin', notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def success\n # using find to find exact result that matches the conditions(params with correct eventId)\n @product_listing = ProductListing.find(params[\"eventId\"])\n @sale = Payment.create(user_id: current_user.id, buyer_email: current_user.email, seller_email: @product_listing.user.email, product_listing_id: @product_listing.id, amount: @product_listing.price)\n @product_listing.approved = false\n @product_listing.save!\n\n\n end", "def approve!\n\t\tif self.status == \"active\"\n\t\t\traise \"ERROR in approving an already active member\"\n\t\telsif self.status == \"rejected\"\n\t\t\traise \"ERROR cannot approve rejected member\"\n\t\telse\n\t\t\tself.update!(status: \"active\")\n\t\tend\n\tend", "def check_for_approve\n @invite = CollaborationInvitation.find(params[:id])\n @magazine = Magazine.find(@invite.Magazine_id)\n @magazine.users << current_user\n @invite.destroy\n @invite.save\n redirect_to collaboration_invitations_path\n end", "def activate\n show = Show.find params[:id]\n show.active = true\n show.save\n\n flash[:notice] = \"Show Activated!\"\n redirect_to \"/admins/shows\"\n end", "def disapprove!(options = {})\n persist = options.fetch(:persist, true)\n transaction do\n self.approved = false\n self.approved_at = Time.now\n save! if persist\n AfterDisapprovalJob.enqueue(self.id)\n end\n end", "def confirm_sales_return\n @sales_return = SalesReturn.find_by_id params[:sales_return_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @sales_return.confirm( current_user )\n @sales_return.reload \n # sleep 5 \n end" ]
[ "0.65584135", "0.65475833", "0.65280986", "0.6248958", "0.61926055", "0.61558306", "0.61183625", "0.6085756", "0.6069497", "0.60578406", "0.60577106", "0.6045045", "0.604113", "0.60335875", "0.60078955", "0.59879804", "0.59736264", "0.5972359", "0.5959627", "0.59538823", "0.5940196", "0.58979666", "0.589643", "0.585982", "0.5840206", "0.5827142", "0.5822197", "0.5795321", "0.5793356", "0.57902867", "0.5784785", "0.57731014", "0.5766318", "0.576574", "0.57643163", "0.57582235", "0.57396764", "0.57157665", "0.57157665", "0.57102174", "0.5698892", "0.5697476", "0.5696112", "0.5694877", "0.56913126", "0.5690994", "0.56891537", "0.56640583", "0.56631494", "0.56624013", "0.5661556", "0.565711", "0.5654831", "0.56280154", "0.56280154", "0.5625341", "0.56233424", "0.56184924", "0.56181645", "0.5616308", "0.55907536", "0.55864066", "0.5584654", "0.5580657", "0.55731106", "0.5569812", "0.5564458", "0.5556409", "0.55508137", "0.5548147", "0.5544514", "0.5541483", "0.55375636", "0.55375636", "0.55375636", "0.55375636", "0.55358946", "0.5525375", "0.55243176", "0.55221325", "0.55095345", "0.55009294", "0.5497535", "0.5483615", "0.5483615", "0.5483615", "0.5483615", "0.5483615", "0.5483615", "0.5483615", "0.5483615", "0.5483615", "0.54802257", "0.5473686", "0.5472198", "0.54694563", "0.54679227", "0.5458709", "0.5456773", "0.54554385" ]
0.6592211
0
Reject a particular Store in the database
def reject_store_app(uid) Store.lock.where(uid: uid) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reject\n self[:status] = \"Reject\"\n save\n end", "def reject_offer\n @auction = @current_user.auctions.find(params[:auction_id])\n @offer = @auction.offers.find(params[:offer_id])\n Alert.transaction do\n Alert.offer_to_reject_response!(@offer, @decision)\n if @decision\n @offer.reject!\n end\n end\n end", "def reject(id)\n end", "def reject\n @assignment.active_offer.rejected!\n render_success @assignment.active_offer\n end", "def reject!\n return false if self.approved == true\n self.destroy\n end", "def approve_store_app(uid)\n Store.unlock.where(uid: uid)\n end", "def reject\n @company = Company.find(params[:id])\n if @company.reject!\n respond_with @company\n else\n respond_with @company, status: :unprocessable_entity\n end\n end", "def reject?(sender)\r\n false\r\n end", "def reject\n copy self.class.reject(@id)\n true\n end", "def reject\n copy self.class.reject(@id)\n true\n end", "def reject\n throw :reject\n end", "def reject!\n raise RejectMessage\n end", "def reject?(sender)\n false\n end", "def reject?(sender)\n false\n end", "def reject\n email = Email.find(params[:id])\n email.state = \"Rejected\"\n email.reject_reason = params[:reject_reason]\n if email.save!\n head :no_content\n else\n respond_with email, status: :unprocessable_entity\n end\n end", "def reject\n fog_model.reject\n end", "def confirm\n begin\n accept = params[:accept].eql?('true')\n st = StoreTransaction.where(id: params[:request_id], store: current_user.stores.find(params[:store_id])).first\n if accept\n st.status = 1\n st.store.owner = st.requester\n st.store.save!\n else\n st.status = 2\n end\n st.save!\n render json: st.sanitize_attributes, status: :ok\n rescue => e\n render json: {error: e}, status: :ok\n end\n end", "def reject\n @application.update_attributes(status: 'rejected')\n redirect_to admin_event_path(@application.event_id),\n flash: { info: \"#{ @application.name}'s application has been rejected\" }\n end", "def reject(deal)\n @deal, @merchant = deal, deal.merchant\n @deal_url = merchant_promo_url(@merchant, @deal)\n \n mail :to => deal.merchant.email\n end", "def reject\n transition_to :rejected\n end", "def reject\n register_change\n PristinePermission.delete(id) unless id.nil?\n end", "def reject! &block\n stash.reject! &block\n end", "def make_store_unknown\n self.store_id = nil\n save!\n end", "def reject\n\t\t@post =Post.find(params[:id])\n\t\t@request =Request.find_by(post_id: @post.id)\n\tend", "def reject(*)\n super.tap do\n __debug_sim('USER must make change(s) to complete the submission.')\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.status = 'rejected'\n @transaction.save\n end", "def reject\n @group_user.reject!\n respond_to do |format|\n flash[:notice] = 'Membership rejected.'\n format.html { redirect_to @group_user.group }\n format.xml { head :ok }\n end\n end", "def reject\n self.update_attributes(:status => REJECTED)\n end", "def call_reject(accpt)\n @accept_model = accpt\n reject!\n end", "def reject!(user = nil)\n run_callbacks :rejection do\n self.rejected_at = Time.now\n self.rejecter = user if user\n self.status = 'rejected'\n self.save!\n self.order_items.each(&:reject!)\n deliver_rejected_order_email\n end\n end", "def employee_belongs_to_only_store\n errors.add(:location_id, \"Employee does not belong to a store\") if Location.find(location_id).location_type == \"shelf\"\n end", "def show\n @transaction = Transaction.find(params[:id])\n @transaction.status = 'rejected'\n @transaction.save\n end", "def reject(&block)\n @reject = block if block\n @reject\n end", "def reject\n\t\t@article = Article.find(params[:id])\n\n\t\tif @article.state == 1\n\t if params[:article][:message]\n\t @article.state = 2\n\t @article.message = params[:article][:message] \n\t @article.freezebody = @article.title + \"\\n\\n\" + @article.teaser + \"\\n\\n\" + @article.body + \"\\n\\n\" + @article.version + \"\\n\\n\" + @article.changelog\n\t \n\t if @article.save\n\t flash[:notice] = \"The artile was rejected.\"\n\t redirect_to :action => 'articles', :state => 1\n\t else\n\t render :action => \"editreject\"\n\t end \n\t else\n\t flash[:notice] = \"No reject without reject message.\"\n\t redirect_to :action => 'articles', :state => 1\n\t end\n\t else\n\t flash[:notice] = \"Only submitted articles can be rejected.\"\n\t redirect_to :action => 'articles', :state => 1\n\t end \n\tend", "def reject( id, reedo = false, do_amt_reject = false )\n connection.put( \"#{resource_uri}/#{id}/reject\", :headers => { \"Content-Length\" => \"0\" }, :body => { :redo => reedo ? \"true\" : \"false\", :do_amt_reject => do_amt_reject ? \"true\" : \"false\" } )\n end", "def reject\n if request.post?\n if @ad.mark_as_disapproved!(params[:reason])\n flash[:notice] = 'AD successfully rejected!'\n else\n flash_errors_model @ad\n end\n redirect_to url_for(action: :index)\n end\n end", "def no_repeat_employee_store\r\n if !self.employee.nil?\r\n self.employee.employee_stores.each do |employee_store|\r\n if self.store.store_name.upcase == employee_store.store.store_name.upcase\r\n errors.add(:employee, \"is already assigned to that store\")\r\n end\r\n end\r\n end\r\n end", "def reject(&block); end", "def destroy\n if @store.destroy\n render :show, status: :ok\n else\n @message = @store.errors\n render :error, status: :unprocessable_entity\n end\n end", "def editreject\n\t\t@article = Article.find(params[:id])\n\t\t# only submitted articles can be rejected\n\t\tif @article.state != 1\n\t\t\tflash[:notice] = 'Only submitted articles can be rejected.'\n\t\t\tredirect_to :action => 'articles', :state => 1\n\t\tend\n\tend", "def reject\n @locale_entry.approved = false\n @locale_entry.reviewer = current_user\n @locale_entry.save!\n\n respond_with @source_entry, @locale_entry, location: glossary_source_locales_url\n end", "def reject( & block )\n\n load_parent_state\n \n return super\n\n end", "def deny\n self.status = 'denied'\n save\n end", "def reject_order order\n @order = order\n @user = @order.user\n\n mail to: @user.email, subject: \"Reject Order\"\n end", "def reject?\r\n\t\tfalse\r\n\tend", "def store\n if (Store.ids.include?(params[:id].to_i))\n @store=Store.find(params[:id])\n else\n redirect_to root_path\n end\n end", "def reject(&blk); end", "def reject\n # Grab the target user by phone_id\n @target = User.where(phone_id: params[:phone_id]).first\n # Grab the slap record by slap_id\n @slap = Slap.find(params[:slap_id])\n # Compare target_id to target user's phone_id to make sure she's legit\n if @target.id == @slap.target_id\n #Update the slap record's status to \"rejected\"\n @slap.update(status: \"rejected\")\n end\n render :json => { status: \"ok\" }, :status => 200\n end", "def reject!(response_data={})\n @client.post(\"#{path}/reject\", response_data)\n end", "def check_for_reject\n @record = CollaborationInvitation.find(params[:id])\n @record.destroy\n redirect_to collaboration_invitations_path\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n if @store.destroyed?\n flash[:notice] = \"El almacen fue eliminado.\"\n redirect_to stores_path\n else\n flash[:warning] = \"El almacen no puede ser eliminado debido a que tiene datos relacionados.\"\n redirect_to @store\n end\n\n end", "def reject\n self['reject']||{}\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def deny\n throw(:return)\n end", "def reject(reason = nil)\n log(2, \"Action: reject: \" + reason.to_s)\n raise DeliveryReject.new(reason.to_s)\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/admin/stores\" }\n format.json { head :no_content }\n end\n end", "def reject_user\n # set the enabled flag to false for the user\n # clear activation code (prevents user from showing up as pending user)\n # send out rejection notification\n end", "def reject(current_member, reason='', send_mail=true)\n General::ChangeStatusService.new(self, StatusLancer::REJECTED, current_member, reason).change\n\n if self.save\n # if send_mail == true\n # MemberMailerWorker.perform_async(job_id: self.id.to_s, perform: :send_job_rejection)\n # end\n return true\n else\n return false\n end\n end", "def reject!(&block); end", "def should_check_user_store(user)\n if !user.store? and user.should_be_store?\n user.update(store: true)\n else\n # noop\n end\n rescue Exception => e\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to(stores_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t@store = current_account.stores.find(params[:id])\n @store.destroy\n respond_to do |format|\n format.html { redirect_to account_stores_path(account_id: current_account.id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to(stores_url) }\n format.xml { head :ok }\n end\n end", "def deny\n @issue = Issue.find(params[:id])\n @issue.resolved = 0\n old_submitter = @issue.submitter_id\n @issue.submitter_id = nil\n project = Project.find(@issue.project_id)\n if @issue.save\n flash[:warning] = \"The Solution was Rejected\"\n UserMailer.resolution_denied(@issue, old_submitter).deliver\n redirect_to project_issue_path(project.slug,@issue.id)\n else\n flash[:error] = \"Error in Saving. Please retry.\"\n redirect_to project_issue_path(project.slug,@issue.id)\n end\n end", "def raises_uniqueness_violation?(&block)\n transaction(:savepoint=>:only, &block)\n false\n rescue unique_constraint_violation_class => e\n e\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def reject!\n super { |r| yield(r) && orphan_resource(r) }\n end", "def price_exception_for_store(store)\n return if store.nil?\n price_exceptions.try(:[], 'stores')&.find do |h|\n return h if h[\"store_id\"].to_i == store.id\n end.presence\n end", "def reject_promotion_if_basket_empty\n if BasketItem.where(basket_id: @basket_item.basket_id).empty?\n flash[:danger] = \"Basket is empty - promotion cannot be applied!\"\n @reject = true\n end\n end", "def destroy\n @store.destroy\n redirect_to store_path, notice: \"store destroyed.\"\n end", "def reject\n\tRelationship.where(:accessed_id => params[:id], :accessor_id => params[:request_id]).first.destroy\n\tredirect_to(requests_user_path(current_user))\n end", "def destroy\n @user_invite.status = :Rejected\n @user_invite.save\n redirect_back(fallback_location: user_root_path, notice: I18n.t('invites.rejected_successful'))\n end", "def reject\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to(registrations_users_path, :notice => \"User registration was successfully rejected and deleted.\") }\n format.xml { head :ok }\n end\n end", "def deny!(kind, name, attributes = {})\n deny(kind, name, attributes).save\n end", "def reject\n log_debug { \"Rejecting job with jid: #{item[JID_KEY]} already running\" }\n send_to_deadset\n end", "def can_be_rejected?\n self.applied?\n end", "def app_store_blocked\n return @app_store_blocked\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to '/stores/admin' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t\t\t @store = Store.find(params[:id])\n\t\t\t\t @store.destroy\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t format.html { redirect_to stores_url }\n\t\t\t\t format.json { head :no_content }\n\t\t\t\t end\n\t\t\t\t end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url notice: 'Store was successfully deleted.'}\n format.json { head :no_content }\n end\n end", "def reject\n app = options[:app]\n if app != nil\n if app.reject_version_if_possible!\n UI.success(\"Successfully rejected previous version!\")\n else\n UI.error(\"Application cannot be rejected\")\n end\n end\n end", "def reject(reason)\n Q.reject(@reactor, reason)\n end", "def deny\n @reservation.is_denied = true\n @reservation.status = :denied\n @reservation.admin_response_time = Time.now\n respond_to do |format|\n if @reservation.update(reservation_params)\n notify_denied\n format.html { redirect_to @reservation, flash: { error: 'Reservation has been denied' } }\n format.json { render :show, status: :ok, location: @reservation }\n else\n respond_to_errors :show, format\n end\n end\n end", "def reject\n respond_to do |format|\n if @version.reject!\n UserMailer.rejection_notification(current_user, @version.versionable.node, @version.editor, params[:reason], :host => request.host).deliver if @version.editor\n format.xml { head :ok }\n else\n format.xml { head :internal_server_error }\n end\n end\n end", "def check_res!\n unless EnergySystem.find_by_id(@current_res)\n flash[:alert] = \"Please select an energy system or create a new one.\"\n redirect_to(root_path)\n end\n end", "def destroy\n authorize @store_detail, :destroy?\n @store_detail.destroy\n respond_to do |format|\n format.html { redirect_to store_details_url, notice: 'Store detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def rejected?\n state == 'rejected'\n end", "def reject\n @invite = Invite.find_by_id(params[:id])\n if @invite\n authorize! :reject, @invite\n if @invite.delete\n respond_to do |format|\n format.js { render json: {result: \"Приглашение отклонено\", status: 200 } }\n end\n else\n respond_to do |format|\n format.js { render json: {result: \"Ошибка отклонения приглашения\", status: 500 } }\n end\n end\n else\n respond_to do |format|\n format.js { render json: {result: \"Приглашение не найдено\", status: 404 } }\n end\n end\n end", "def reject\n #@asset_categorization = AssetCategorization.find(params[:id])\n @asset_categorization = AssetCategorization.accessible_by(current_ability, :reject).where(id: params[:id]).first\n if @asset_categorization && @asset_categorization.reject!(current_user)\n respond_to do |format|\n format.html { redirect_to asset_categorizations_url, notice: I18n.t('controllers.reject_success', name: @asset_categorization.class.model_name.human) }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to asset_categorizations_url, flash: { error: @asset_categorization.errors.messages.values.join } }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end\n end", "def reject_car_part\n id = params[:car_part_id]\n car_part = CarPart.find( id )\n car_part.reject\n car_part.save\n render json: { description: car_part.description }\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store_owner = StoreOwner.find(params[:id])\n\n authorize! :destroy, @store_owner\n\n @store_owner.destroy\n\n respond_to do |format|\n flash[:notice] = \"Store Owner #{@store_owner.user.display_name} was removed.\"\n format.html { redirect_to group_store_path(@group, @store) }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserve.destroy\n #flash[:notice] = t('reserve.reservation_was_canceled')\n\n if @reserve.manifestation.is_reserved?\n if @reserve.item\n retain = @reserve.item.retain(User.find(1)) # TODO: システムからの送信ユーザの設定\n if retain.nil?\n flash[:message] = t('reserve.this_item_is_not_reserved')\n end\n end\n end\n\n respond_to do |format|\n format.html { redirect_to reserves_url, :notice => t('controller.successfully_deleted', :model => t('activerecord.models.reserve')) }\n format.json { head :no_content }\n end\n end", "def rejected?\n state == :rejected\n end" ]
[ "0.62324977", "0.6155242", "0.59718937", "0.5971266", "0.595649", "0.5921772", "0.5840953", "0.5774094", "0.5736666", "0.5736666", "0.57346123", "0.57309073", "0.571686", "0.571686", "0.57054085", "0.5700467", "0.56686306", "0.5590971", "0.55640686", "0.55594414", "0.55526054", "0.5544597", "0.5511325", "0.5496439", "0.5451569", "0.54466367", "0.54429", "0.5427457", "0.5418199", "0.54081315", "0.53955853", "0.5392834", "0.5387612", "0.5380084", "0.5353386", "0.53511775", "0.5337176", "0.53178823", "0.5315758", "0.52994823", "0.5289318", "0.52869016", "0.52811843", "0.5278192", "0.5276508", "0.52717716", "0.52685285", "0.5265447", "0.5260126", "0.52562517", "0.5227602", "0.5183546", "0.5181298", "0.5164786", "0.5161181", "0.5153351", "0.5149052", "0.51450527", "0.51371944", "0.5131586", "0.51293033", "0.5127375", "0.5112784", "0.5110132", "0.5105807", "0.50925046", "0.50925046", "0.50925046", "0.50925046", "0.508875", "0.508697", "0.50838935", "0.50815046", "0.5072473", "0.5064946", "0.5056783", "0.50562125", "0.50533646", "0.5046027", "0.5044338", "0.5039837", "0.502996", "0.5024725", "0.50184786", "0.50103873", "0.5008309", "0.49954286", "0.499133", "0.49801868", "0.49751404", "0.49708366", "0.49683684", "0.4965914", "0.49653193", "0.49653193", "0.49653193", "0.49653193", "0.49592853", "0.49589586", "0.49522573" ]
0.6388437
0
Edit a particular Store in the database
def edit_store(edited_store) store = Store.find(edited_store.uid) store.attributes = edited_store.attributes store.save! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\t\t\t\t @store = Store.find(params[:id])\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t if @store.update_attributes(params[:store])\n\t\t\t\t\tformat.html { redirect_to @store, notice: 'Store was successfully updated.' }\n\t\t\t\t\tformat.json { head :no_content }\n\t\t\t\t else\n\t\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\t\tformat.json { render json: @store.errors, status: :unprocessable_entity }\n\t\t\t\t end\n\t\t\t\t end\n\t\t\t\t end", "def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to '/stores/admin', notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_store = Admin::Store.find(params[:id])\n\n respond_to do |format|\n if @admin_store.update_attributes(params[:admin_store])\n format.html { redirect_to @admin_store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to(@store, :notice => 'Store was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:admin_store])\n format.html { redirect_to([:admin,@store], :notice => 'Store was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to stores_path, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to @store, :notice => 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @store.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params.require(:store).permit(:break_even, :capacity, :city, :county_id, :manager_id,\n :name, :number, :number_of_lifts, :phone, :region_id,\n :state_id, :street_address, :zip))\n format.html { redirect_to stores_url,\n notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n prepFormVariables\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\tif @store.update(store_params)\n\t\t\tredirect_to @store, notice: 'La Tienda fue actualizada de forma exitosa.'\n\t\telse\n\t\t\trender :edit\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store }\n format.json { render :show, status: :ok, store: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to admin_pin_path(@store), notice: t('views.admin.stores.pin_edited_successfully') }\n else\n flash.now[:alert] = @store.errors.full_messages\n format.html { render :edit }\n end\n end\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store_detail\n @store_detail = StoreDetail.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to account_stores_path(account_id: current_account.id), notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_store\n @store = Store.find(params[:store_id]) if params[:store_id]\n end", "def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to [:phone, @store], notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def update\n respond_to do |format|\n if @admin_store.update(admin_store_params)\n format.html { redirect_to @admin_store, notice: 'Store was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_store }\n else\n format.html { render :edit }\n format.json { render json: @admin_store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to action 'show', notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_store\n @store = current_account.stores.find(params[:id])\n end", "def set_store\n @store = current_account.stores.find(params[:id])\n end", "def set_storeinfo\n @storeinfo = Storeinfo.find(params[:id])\n end", "def update\n authorize @store_detail, :update?\n respond_to do |format|\n if @store_detail.update(store_detail_params)\n format.html { redirect_to @store_detail, notice: 'Store detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_detail }\n else\n format.html { render :edit }\n format.json { render json: @store_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_store_item\n @store_item = StoreItem.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.friendly.find(params[:id])\n end", "def set_store\n @store = Stock.find(params[:id])\n end", "def update\n @data_store = DataStore.find(params[:id])\n\n respond_to do |format|\n if @data_store.update_attributes(params[:data_store])\n format.html { redirect_to @data_store.data_source, notice: 'Data store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @store.slug=nil\n if @store.update(store_params)\n format.html { redirect_to owner_commerce_stores_path(@store.commerce.slug), notice: 'Tienda actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_store\n @store = Store.friendly.find(params[:id])\n end", "def set_store\n @store = Store.find_by name: (params[:store_name])\n end", "def set_store\n if !params[:store_id].nil?\n @store = Store.find(params[:store_id])\n else\n @store = @item.store\n end\n end", "def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store, notice: \"Loja atualizada com sucesso!\" }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @store.update(store_params)\n render json: @store\n else\n render json: @store.errors, status: :unprocessable_entity\n end\n end", "def update\n if @store.update(store_update_params)\n render :show, status: :ok\n else\n @message = @store.errors\n render :error, status: :unprocessable_entity\n end\n end", "def update\n @online_store = OnlineStore.find(params[:id])\n\n respond_to do |format|\n if @online_store.update_attributes(online_store_params)\n format.html { redirect_to @online_store, notice: 'Online store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @online_store.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_store_add\n @store_add = StoreAdd.find(params[:id])\n end", "def update\n respond_to do |format|\n if @itemstore.update(item_store_params)\n format.html { redirect_to @itemstore, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @itemstore }\n else\n format.html { render :edit }\n format.json { render json: @itemstore.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_admin_store\n @admin_store = Store.find(params[:id])\n end", "def update\n @image_store = ImageStore.find(params[:id])\n\n respond_to do |format|\n if @image_store.update_attributes(params[:image_store])\n format.html { redirect_to(@image_store, :notice => 'Image store was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image_store.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_store_product\n @store_product = StoreProduct.find(params[:id])\n end", "def update\n begin\n @api_v1_store.update!(api_v1_store_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "def update\n @store_detail = StoreDetail.find(params[:store_detail_id])\n @addon = Addon.find(params[:id])\n respond_to do |format|\n if @addon.update(addon_params)\n format.html { redirect_to store_detail_addon_url, notice: 'addon detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @addon }\n else\n format.html { render :edit }\n format.json { render json: @addon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book_store.update(book_store_params)\n format.html { redirect_to @book_store, notice: 'Book store was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_store }\n else\n format.html { render :edit }\n format.json { render json: @book_store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @store_type = StoreType.find(params[:id])\n\n respond_to do |format|\n if @store_type.update_attributes(params[:store_type])\n flash[:notice] = 'Store Type was successfully updated.'\n format.html { redirect_to(store_types_path) }\n format.xml { head :ok }\n else\n @store_types = StoreType.active\n format.html { render :action => \"index\" }\n format.xml { render :xml => @store_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @store.update(store_params)\n @stores = Store.by_id\n format.js {render layout: false, notice: 'Se modificó el estado de la tienda.'}\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_store_book\n @store_book = StoreBook.find(params[:id])\n end", "def update\n respond_to do |format|\n if @storeinfo.update(storeinfo_params)\n format.html { redirect_to @storeinfo, notice: 'Storeinfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @storeinfo }\n else\n format.html { render :edit }\n format.json { render json: @storeinfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_store\n @store = Store.where(id: params[:id]).take\n end", "def store\n if (Store.ids.include?(params[:id].to_i))\n @store=Store.find(params[:id])\n else\n redirect_to root_path\n end\n end", "def update\n respond_to do |format|\n if @cakestore.update(cakestore_params)\n format.html { redirect_to @cakestore, notice: 'Cakestore was successfully updated.' }\n format.json { render :show, status: :ok, location: @cakestore }\n else\n format.html { render :edit }\n format.json { render json: @cakestore.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @store_item.update(store_item_params)\n format.html { redirect_to @store_item, notice: 'Store item was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_item }\n else\n format.html { render :edit }\n format.json { render json: @store_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @store_add.update(store_add_params)\n format.html { redirect_to @store_add, notice: 'Store add was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_add }\n else\n format.html { render :edit }\n format.json { render json: @store_add.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_store\n\t\t\t@store = Store.includes(stocks: :item).find(params[:id])\n\t\tend", "def edit_sales_order\n begin\n @sale = Sale.find(params[:id])\n rescue\n end\n end", "def update\n respond_to do |format|\n if @mstore.update(mstore_params)\n format.html { redirect_to @mstore, notice: 'Mstore was successfully updated.' }\n format.json { render :show, status: :ok, location: @mstore }\n else\n format.html { render :edit }\n format.json { render json: @mstore.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @store_section = StoreSection.find(params[:id])\n\n respond_to do |format|\n if @store_section.update_attributes(params[:store_section])\n format.html { redirect_to @store_section, notice: 'Store section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n stores = []\n if params[:product][:store_ids].present?\n params[:product][:store_ids].each do |store_id|\n unless store_id.empty?\n store = Store.find(store_id)\n stores << store\n end\n end\n end\n\n unless stores.empty?\n @product.stores = stores\n else\n @product.stores.clear\n end\n \n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: \"Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @store_manager.update(store_manager_params)\n format.html { redirect_to @store_manager, notice: 'Store manager was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_manager }\n else\n format.html { render :edit }\n format.json { render json: @store_manager.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_store_order\n @store_order = StoreOrder.find(params[:id])\n end", "def set_item_store\n @itemstore = ItemStore.find(params[:id])\n end", "def edit\n @show = Show.find params[:id]\n end", "def edit\n\t@itemmaster = Itemmaster.find(:all)\t\t#Show all Itemmasters\n\t@department = Department.find(:all)\t\t#Show all Departments\n\t@storecunsumption = Storecunsumption.find(params[:id])\n\tend", "def set_store_status\n @store_status = StoreStatus.find(params[:id])\n end", "def update\n @shop_ose = ShopOse.find(params[:id])\n\n respond_to do |format|\n if @shop_ose.update_attributes(params[:shop_ose])\n format.html { redirect_to @shop_ose, notice: 'Shop ose was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_ose.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @shop.update(shop_params)\n redirect_to new_shop_item_path(@shop), notice: t(\"shop.create.notice\"), notice: t(\"shop.update.notice\")\n else\n render action: 'edit'\n end\n end", "def update\n respond_to do |format|\n if @electronics_store.update(electronics_store_params)\n format.html { redirect_to @electronics_store, notice: 'Electronics store was successfully updated.' }\n format.json { render :show, status: :ok, location: @electronics_store }\n else\n format.html { render :edit }\n format.json { render json: @electronics_store.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_mstore\n @mstore = Mstore.find(params[:id])\n end", "def set_store_order_item\n @store_order_item = StoreOrderItem.find(params[:id])\n end", "def update\n respond_to do |format|\n if @store.update(stock_params)\n format.html { redirect_to @store, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_store_transaction\n @store_transaction = StoreTransaction.find(params[:id])\n end", "def set_store\n @store = current_user.stores.find_by_id(params[:id]) ||\n Store.find_by_id_and_organization_id!(\n params[:id],\n current_user.organizations.map(&:id)\n )\n end", "def update\n @promo = Promo.find(params[:id])\n brand = Brand.find(params[:promo][:brand_id])\n @promo.stores = brand.stores\n respond_to do |format|\n if @promo.update_attributes(params[:promo])\n format.html { redirect_to @promo, notice: 'Promo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @promo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contact_store.update(contact_store_params)\n format.html { redirect_to @contact_store, notice: 'Contact store was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact_store }\n else\n format.html { render :edit }\n format.json { render json: @contact_store.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @supplier = Supplier.find(params[:id])\n end", "def update\n respond_to do |format|\n if @store_transaction.update(store_transaction_params)\n format.html { redirect_to @store_transaction, notice: 'Store transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_transaction }\n else\n format.html { render :edit }\n format.json { render json: @store_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to @store, notice: 'Store was successfully updated.' }\n params[:books].each{\n |id|\n StoreBook.create(:store_id=>@store.id,:book_id=>id)\n }\n format.json { render :show, status: :ok, location: @store }\n else\n format.html { render :edit }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_book_store\n @book_store = BookStore.find(params[:id])\n end", "def edit\n @show = Show.find(params[:id])\n end", "def set_store_tab\n @store_tab = StoreTab.find(params[:id])\n end", "def edit\n @show = Show.find(params[:id])\n\t@title = \"Editing \" + @show.name\n end" ]
[ "0.7630424", "0.7570387", "0.753359", "0.75034577", "0.74710655", "0.74640095", "0.74640095", "0.74640095", "0.74640095", "0.74589825", "0.74499995", "0.74494755", "0.7435615", "0.71426547", "0.7111787", "0.7111787", "0.71071357", "0.70999485", "0.70999485", "0.70999485", "0.70999485", "0.70906365", "0.70827866", "0.70827866", "0.70827866", "0.70827866", "0.70827866", "0.70827866", "0.70827866", "0.70827866", "0.70827866", "0.70722765", "0.707219", "0.7067845", "0.70587206", "0.70517415", "0.7043774", "0.7029576", "0.6996516", "0.6996516", "0.69757175", "0.69541687", "0.69472325", "0.6924612", "0.6865481", "0.683249", "0.68202376", "0.6811445", "0.68018967", "0.6787833", "0.6786466", "0.6743605", "0.67260265", "0.67214334", "0.6718189", "0.667746", "0.6644309", "0.66422737", "0.6628884", "0.65934485", "0.6579186", "0.65776545", "0.6573743", "0.65697384", "0.6561926", "0.65556", "0.65484864", "0.6522585", "0.65125203", "0.6508202", "0.6488716", "0.6437754", "0.64259475", "0.6385134", "0.63674116", "0.63649803", "0.6353501", "0.63468367", "0.6341025", "0.63310534", "0.631917", "0.63132524", "0.6304843", "0.6289769", "0.62879014", "0.6275779", "0.6268542", "0.6267195", "0.62652266", "0.6247943", "0.62466073", "0.6241543", "0.6231569", "0.6231487", "0.62307596", "0.6230465", "0.62246996", "0.6218892", "0.6215705", "0.6214835" ]
0.83347523
0
Delete a particular Store in the database
def delete_store(uid) store = Store.find(uid) store.delete! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @store.destroy\n redirect_to store_path, notice: \"store destroyed.\"\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n if @store.destroyed?\n flash[:notice] = \"El almacen fue eliminado.\"\n redirect_to stores_path\n else\n flash[:warning] = \"El almacen no puede ser eliminado debido a que tiene datos relacionados.\"\n redirect_to @store\n end\n\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/admin/stores\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_store = Store.find(params[:id])\n @admin_store.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_stores_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_store = Admin::Store.find(params[:id])\n @admin_store.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to(stores_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to(stores_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to '/stores/admin' }\n format.json { head :no_content }\n end\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url notice: 'Store was successfully deleted.'}\n format.json { head :no_content }\n end\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t@store = current_account.stores.find(params[:id])\n @store.destroy\n respond_to do |format|\n format.html { redirect_to account_stores_path(account_id: current_account.id) }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t\t\t @store = Store.find(params[:id])\n\t\t\t\t @store.destroy\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t format.html { redirect_to stores_url }\n\t\t\t\t format.json { head :no_content }\n\t\t\t\t end\n\t\t\t\t end", "def delete\n raise StoreError, 'No store provided' unless self.store\n\n error_ptr = Pointer.new(:id)\n self.store.removeObject(self, error: error_ptr)\n raise StoreError, error_ptr[0].description if error_ptr[0]\n self\n end", "def destroy\n\t\t@store.destroy\n\t\tredirect_to stores_url, notice: 'La Tienda fue borrada de forma exitosa.'\n\tend", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def delete\n self.store -= self\n end", "def delete\n @@data_store.delete(self)\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to phone_stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_store.destroy\n respond_to do |format|\n format.html { redirect_to admin_stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @store.destroy\n\n render json: @store\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n begin\n @api_v1_store.destroy!\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stores_url, notice: \"Loja deletada com sucesso!\" }\n format.json { head :no_content }\n end\n end", "def delete\n out = _delete(id) if @store\n @id = nil\n @store = nil\n out\n end", "def delete_store!\n FileUtils.remove_dir( self.send(:store_path), :force )\n expire_selector\n end", "def destroy\n if @store.destroy\n render :show, status: :ok\n else\n @message = @store.errors\n render :error, status: :unprocessable_entity\n end\n end", "def delete(key)\n @store.delete(key)\n end", "def delete(uri)\n store\n\n @store.delete(uri)\n end", "def destroy\n\n #也要處理相關tags的刪除?\n\n @store.destroy\n respond_to do |format|\n format.html { redirect_to admin_stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store = Store.find(params[:id])\n #tib_res = Tibbr::ExternalResource.find_by_resource_key({:resource => {:key => \"ID_#{@store.id}\", :resource_type => \"ad:store\"}, :client_id => session[:app_id]})\n # tib_res.destroy\n @store.destroy\n \n \n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end", "def store_delete\n Store.remove(\n object: 'Ticket::Article',\n o_id: id,\n )\n Store.remove(\n object: 'Ticket::Article::Mail',\n o_id: id,\n )\n end", "def delete(p)\n @store.delete(p)\n end", "def destroy\n @store_add.destroy\n respond_to do |format|\n format.html { redirect_to store_adds_url, notice: 'Store add was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @store_to_visit.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Store to visit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete!\n Model.model_store.delete!(self)\n end", "def destroy\n @datastore = Datastore.find(params[:id])\n @datastore.destroy\n\n respond_to do |format|\n format.html { redirect_to datastores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cakestore.destroy\n respond_to do |format|\n format.html { redirect_to cakestores_url, notice: 'Cakestore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def user_stores_delete_single_store user_id, 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/{user_id}/stores/{id}\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\n \"user_id\" => user_id,\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.delete 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 == 500\n raise APIException.new \"Internal Server Error\", 500, 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(model)\n id = model.primary_key_value\n store.delete(id, table: table_name)\n end", "def delete(key)\n @store.delete(key)\n end", "def destroy\n authorize @store_detail, :destroy?\n @store_detail.destroy\n respond_to do |format|\n format.html { redirect_to store_details_url, notice: 'Store detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n\tStorecunsumption.find(params[:id]).destroy\n\tredirect_to :action => 'list'\n\tend", "def delete_at(index)\n @store.delete_at(index)\n end", "def destroy\n @shop.destroy\n end", "def destroy\n @online_store = OnlineStore.find(params[:id])\n @online_store.destroy\n\n respond_to do |format|\n format.html { redirect_to online_stores_url }\n format.json { head :no_content }\n end\n end", "def ext_destroy(opts = {})\n ext_api = ActiveExtAPI::StoreDestroy.new self\n ext_api.destroy opts\n end", "def destroy\n @data_store = DataStore.find(params[:id])\n @data_store.destroy\n\n respond_to do |format|\n format.html { redirect_to data_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store_manager.destroy\n respond_to do |format|\n format.html { redirect_to store_managers_url, notice: 'Store manager was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mstore.destroy\n respond_to do |format|\n format.html { redirect_to mstores_url, notice: 'Mstore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store = StoreProduct.find(params[:id])\n @store.destroy\n respond_to do |format|\n format.html { redirect_to store_products_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\nend", "def delete(el)\n store.delete(el)\n end", "def destroy\n @image_store = ImageStore.find(params[:id])\n @image_store.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_stores_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @book_store.destroy\n respond_to do |format|\n format.html { redirect_to book_stores_url, notice: 'Book store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @storeinfo.destroy\n respond_to do |format|\n format.html { redirect_to storeinfos_url, notice: 'Storeinfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @store_section = StoreSection.find(params[:id])\n @store_section.destroy\n\n respond_to do |format|\n format.html { redirect_to store_sections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store_price = Variant.find(params[:id])\n @store_price.destroy\n\n end", "def destroy\n @store_owner = StoreOwner.find(params[:id])\n\n authorize! :destroy, @store_owner\n\n @store_owner.destroy\n\n respond_to do |format|\n flash[:notice] = \"Store Owner #{@store_owner.user.display_name} was removed.\"\n format.html { redirect_to group_store_path(@group, @store) }\n format.json { head :no_content }\n end\n end", "def destroy\n @store = Store.find(params[:store_id])\n @menu = @store.menus.find(params[:id])\n @menu.destroy\n\n respond_to do |format|\n format.html { redirect_to store_menus_url(@store) }\n format.json { head :no_content }\n end\n end", "def destroy\n @keyword_store.destroy\n respond_to do |format|\n format.html { redirect_to keyword_stores_url, notice: 'Keyword store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @store_type = StoreType.find(params[:id])\n if @store_type.can_be_deleted?\n @store_type.update_attributes(:is_deleted => true)\n flash[:notice] = 'Store Type was successfully deleted.'\n else\n flash[:warn_notice]=\"<p>Store Type is in use and cannot be deleted</p>\"\n end\n respond_to do |format|\n format.html { redirect_to(store_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @drug_store.destroy\n respond_to do |format|\n format.html { redirect_to drug_stores_url, notice: 'Drug store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shop.destroy\n\n head :no_content\n end", "def destroy\n @store_detail = StoreDetail.find(params[:store_detail_id])\n @addon = Addon.find(params[:id])\n @addon.destroy\n respond_to do |format|\n format.html { redirect_to store_detail_addons_path(@store_detail), notice: 'addon detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(context, name)\n res = context.transport.delete_request(context, \"blobstores/#{name}\")\n\n context.err(res.body) unless res.success?\n end", "def delete_store\n @lock.synchronize do\n @db.delete_database\n @db = @class_map = @in_memory_objects = @stats = @cache =\n @root_objects = nil\n end\n end", "def destroy\n query_params = save_query_params\n @store.destroy\n respond_to do |format|\n format.html do\n redirect_to admin_pins_path + query_params, notice: t('views.admin.stores.pin_deleted_successfully')\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @store_item.destroy\n respond_to do |format|\n format.html { redirect_to store_items_url, notice: 'Store item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bread_store.destroy\n respond_to do |format|\n format.html { redirect_to bread_store_managers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @electronics_store.destroy\n respond_to do |format|\n format.html { redirect_to electronics_stores_url, notice: 'Electronics store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @posm_store_inventory.destroy\n end", "def delete(token)\n @store.delete(key_for(token))\n end", "def destroy\n @tweet_store.destroy\n respond_to do |format|\n format.html { redirect_to tweet_stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store_transaction.destroy\n respond_to do |format|\n format.html { redirect_to store_transactions_url, notice: 'Store transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ps = ProductsStore.find(params[:id])\n @ps.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product was successfully removed from store.' }\n format.json { head :ok }\n end\n end", "def destroy\n @store_manager_order = Store::Manager::Order.find(params[:id])\n @store_manager_order.destroy\n\n respond_to do |format|\n format.html { redirect_to store_manager_orders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact_store.destroy\n respond_to do |format|\n format.html { redirect_to contact_stores_url, notice: 'Contact store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_store(sellerId=nil)\n if sellerId.class == String && block_given?\n return @j_del.java_method(:removeStore, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(sellerId,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))\n end\n raise ArgumentError, \"Invalid arguments when calling remove_store(sellerId)\"\n end", "def destroy\n @sale.destroy\n\n head :no_content\n end", "def destroy\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.find(params[:id])\n @dish_discount.destroy\n\n respond_to do |format|\n format.html { redirect_to store_dish_discounts_url(@store) }\n format.json { head :no_content }\n end\n end", "def destroy\n @storepromotion.destroy\n respond_to do |format|\n format.html { redirect_to storepromotions_url, notice: 'Storepromotion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n file_store = FileStore.find_by_sha1_hash!(params[:id])\n if user['id'] == file_store.user_id || user['role'] == 'admin' ||\n (user['uname'] == 'file_store' && user['role'] == 'system')\n file_store.destroy\n head :no_content\n else\n render_error 403\n end\n end", "def delete_all\n store.delete(KEY)\n self\n end", "def destroy\n @store_order.destroy\n respond_to do |format|\n format.html { redirect_to store_orders_url, notice: 'Store order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @store_manager_statistic = Store::Manager::Statistic.find(params[:id])\n @store_manager_statistic.destroy\n\n respond_to do |format|\n format.html { redirect_to store_manager_statistics_url }\n format.json { head :no_content }\n end\n end", "def db_deleter(database, id)\n database.execute(\"DELETE FROM wine_cellar where id=#{id}\")\nend", "def destroy\n @stores_report = Stores::Report.find(params[:id])\n @stores_report.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store_manager_policy = Store::Manager::Policy.find(params[:id])\n @store_manager_policy.destroy\n\n respond_to do |format|\n format.html { redirect_to store_manager_policies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @store = Store.find(params[:store_id])\n @dish_choice = @store.dish_choices.find(params[:id])\n @dish_choice.destroy\n\n respond_to do |format|\n format.html { redirect_to store_dish_choices_url(@store) }\n format.json { head :no_content }\n end\n end", "def destroy\n if correct_ts_user\n @tire_store = TireStore.find(params[:id]) unless @tire_store\n @tire_store.destroy\n\n respond_to do |format|\n ref_url = request.referer\n if ref_url.include?(\"?\")\n ref_url += \"&start_tab=my_stores\"\n else\n ref_url += \"?start_tab=my_stores\"\n end\n format.html { redirect_to ref_url }\n format.json { head :no_content }\n end\n else\n redirect_to root_path, :alert => \"You do not have access to that page.\"\n end \n end" ]
[ "0.787363", "0.7869649", "0.78203076", "0.7595794", "0.75738734", "0.75329024", "0.7502063", "0.7495493", "0.7469896", "0.7456329", "0.74345654", "0.74345654", "0.74345654", "0.74345654", "0.74328136", "0.74072427", "0.7378357", "0.733771", "0.7279009", "0.7279009", "0.7279009", "0.7279009", "0.7190343", "0.71714294", "0.7145609", "0.71392715", "0.711433", "0.7112542", "0.7112542", "0.7112542", "0.7112542", "0.7045877", "0.70399565", "0.70064324", "0.6987779", "0.6985423", "0.69778544", "0.69725186", "0.6966557", "0.6958588", "0.6912044", "0.69037366", "0.68943", "0.6892889", "0.68635094", "0.6832902", "0.6811835", "0.68114823", "0.6801728", "0.67963946", "0.6793827", "0.6744383", "0.6740483", "0.673868", "0.6730569", "0.6729908", "0.6691913", "0.66910535", "0.6667518", "0.6654885", "0.66540664", "0.6633207", "0.66292787", "0.66255367", "0.66191477", "0.66107136", "0.66070414", "0.6601856", "0.659827", "0.6596155", "0.6589121", "0.65451366", "0.6537912", "0.65015733", "0.6499775", "0.648735", "0.6487255", "0.6485695", "0.6451958", "0.6434708", "0.6417043", "0.6389084", "0.6373565", "0.6368843", "0.6355746", "0.6349392", "0.63463306", "0.6338635", "0.6332502", "0.63213897", "0.6307149", "0.62827295", "0.6266825", "0.62464094", "0.6236746", "0.6218228", "0.6197161", "0.61846054", "0.6183424", "0.6174492" ]
0.7872565
1
Create a new User in the database
def create_user(name, email, password) # Password is hashed automatically user = User.new(name: name, email: email, password: password) user.save! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user\n User.create name: \"test\", email: \"test@example.com\", password: \"123456\"\n end", "def create\n\t\t\t\t@user = User.create!(create_user_params)\n\t\t\tend", "def create_user\n User.create name: 'test', email: 'test@example.com', password: '123456'\n end", "def create_user\n User.create name: 'test', email: 'test@example.com', password: '123456'\n end", "def create\n @user = User.new(user_attributes)\n if @user.save\n created(@user)\n else\n validation_errors(@user)\n end\n end", "def new_user(name)\n User.create(name: name)\nend", "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path\n else\n redirect_to new_user_path\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_user(user_hash={})\n @user = User.new(user_hash)\n @user.save\n end", "def create_user(user_hash={})\n @user = User.new(user_hash)\n @user.save\n end", "def create\n user = User.new(user_params)\n msg = if user.save\n 'User has successfully created.'\n else\n set_error(:unprocessable_entity, user)\n end\n common_response(msg, user: user)\n end", "def create\n @user = User.new(user_params)\n if @user.save\n redirect_to '/enter'\n puts \"User created & saved to db\"\n else\n redirect_to '/enter'\n puts \"User not saved\"\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tredirect_to sign_in_path\n\t\telse\n\t\t\tredirect_to sign_up_path\n\t\tend\n\tend", "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "def create\n\t\t@user = User.new(params[:user])\n\t\tif @user.save\n\t\t\tredirect_to root_url, notice: \"Added new user to the database\"\n\t\telse\n\t\t\trender \"new\"\n\t\tend\n\tend", "def create_user\n @user = User.new(params[:user])\n @user.save\n \n redirect_to :action => :users\n end", "def create_user(options = {})\n\t\trecord = Factory.build(:user,options)\n\t\trecord.save\n\t\trecord\n\tend", "def create_user(options = {})\n\t\trecord = Factory.build(:user,options)\n\t\trecord.save\n\t\trecord\n\tend", "def new_user\n User.new({\n email: 'hoge@hoge',\n password: 'hoge',\n password_confirmation: 'hoge'\n })\n end", "def create\n @user = User.create( user_params )\nend", "def create\n @user = User.new(user_to_be_created)\n\n error = @user.validate_user?\n\n if error.nil? && @user.save\n handler_notice('Usuário cadastrado com sucesso!', login_path)\n else\n handler_notice_error(error, new_user_path)\n end\n end", "def create\n @user = User.new(user_params)\n\n # save was requested by either current_user or else must be a new registration\n if @user.save(current_user)\n redirect_to users_path\n else\n render('new', status: :unprocessable_entity)\n end\n end", "def create_user(options={})\n\t\t\tUser.create({\n\t\t\t\tusername: \"user example\",\n\t\t\t\temail: \"example@email.com\",\n\t\t\t\tpassword: \"password\",\n\t\t\t\tpassword_confirmation: \"password\"\n\t\t\t}.merge(options))\n\t\tend", "def new_user\n\t @user = User.new\t \n\tend", "def createUser(nickname) \n usr = User.new(nickname)\n backend_addUser(usr) \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 create_user(options = {})\n post \"/users\", options\n end", "def create\n @user = User.new(user_params)\n if @user.save\n\n redirect_to edit_user_path(@user.id)\n else\n redirect_to sign_up_path\n end\n end", "def create_new_user\n username = find_username\n @user = User.new(\n email: auth_email,\n username: username,\n password: Devise.friendly_token[0, 20]\n )\n @user.skip_confirmation!\n @user.save!\n\n @user\n end", "def create\n\n @new_user = User.new\n\n new_user = @new_user.add(params['user_name'], params['pswd1'], params['email'], params['full_name'])\n\n if new_user.errors.any?\n redirect_to \"/\", :flash => { :error => 'User already exists'}\n else\n redirect_to \"/main\"\n end\n end", "def create\n\t\t@user = User.create(user_params)\n\t\tlogin(@user)\n\t\tredirect_to root_path\n\tend", "def create\n first_name, last_name, email, password = *params.values_at(:first_name, :last_name, :email, :password)\n\n if [first_name, last_name, email, password].any?(&:blank?)\n return render_success({status:\"error\", message: 'invalid create parameters'})\n end\n\n #User already exists\n if User.exists?(email: email.downcase)\n return render_success({status:\"error\", message:\"user already exists\"})\n end\n #create user\n User.transaction do\n @user = User.new(\n name: (first_name + \" \" + last_name).titleize,\n email: email.downcase,\n password: password,\n password_confirmation: password\n )\n if @user.save!\n render_success({status:\"success\", message:\"created\"})\n else\n render_success({status:\"error\", message:\"user creation failed\"})\n end\n end\n end", "def create\n # Note this is different to the usual situation where anybody can create\n # an account. Here, only administrators can create accounts for others;\n # and doing so does not log them out.\n unless current_user.admin?\n flash[:error] = \"Users can only be created by administrators.\"\n redirect_to (request.env[\"HTTP_REFERER\"] || root_path) and return\n end\n \n @user = User.new(params[:user])\n success = @user && @user.save\n if success && @user.errors.empty?\n # Protects against session fixation attacks, causes request forgery\n # protection if visitor resubmits an earlier form using back\n # button. Uncomment if you understand the tradeoffs.\n # reset session\n redirect_to users_path\n flash[:notice] = \"The account #{ERB::Util.h @user.login} has been setup for #{ERB::Util.h @user.name}.\"\n else\n flash.now[:error] = \"We couldn't set up that account, sorry.\"\n render :action => 'new'\n end\n end", "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def create\n name = params[:name]\n email = params[:email]\n password = params[:password]\n new_user = User.create!(\n name: name,\n email: email,\n password: password,\n )\n\n response = \"Hey #{name}, You are registered successfully!\"\n render plain: response\n end", "def create_user(input)\n User.create(name: input)\n end", "def createNewUser(userName, initialGroup, userEmail, fname, lname, password)\n\n password = password.encrypt\n user = {\"login\" => userName,\n \"group0\" => initialGroup,\n \"email\" => userEmail,\n \"fname\" => fname,\n \"lname\" => lname,\n \"password\" => password,\n \"orga\" => \"0\"}\n saveUser(userName, user)\n end", "def create_user\n params = {\n client_id: @client_id,\n email: @email\n }\n @user = User.using_client_shard(client: @client).create!(params)\n end", "def create\n\t\t@user = User.new(user_params)\n\t\t\n\t\tif @user.save\n\t\t\tredirect_to users_path\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend", "def create\n @user = User.new(user_params)\n\n if @user.save\n redirect_to root_path, notice: 'User was successfully created'\n else\n render action: 'new'\n end\n end", "def create\n @user = User.create(params[:user])\n # redirect_to\n end", "def create\n @user = User.new(params[:user])\n\n if @user.save\n flash[:notice] = t('users.create.notice')\n redirect_to users_path\n else\n render :action => \"new\"\n end\n end", "def create\n User.create(name: params[:name])\n redirect_to \"/users\"\n end", "def create_user_if_none_exist\n return if User.exists?\n puts \"Creating Users...\"\n\n User.create :email => \"test@test.com\", :password => \"welcome1\", :password_confirmation => \"welcome1\"\n end", "def create\n puts \"******* create *******\"\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:success] = 'User created!'\n redirect_to login_path\n else\n flash[:danger] = @user.errors.full_messages\n redirect_to signup_path\n end\n end", "def create\n @user = User.new(params[:user])\n\n if @user.save\n redirect_to(root_url, :notice => 'User was successfully created.')\n else\n render :action => \"new\"\n end\n end", "def create\n @user = User.new(params[:user])\n redirect_to @user if @user.save\n end", "def do_create\n begin\n raise 'Passwords do not match' unless request[:password] == request[:checkpass]\n user = Models::User.new\n user.username = request[:username]\n user.email = request[:email]\n user.name = request[:name]\n user.password = request[:password]\n user.save\n flash[:success] = 'New user has been added.'\n redirect('/admin')\n rescue Object => boom\n flash[:error] = \"Error encountered while saving: #{boom}\"\n redirect_referer\n end\n end", "def create\n\t\tuser_params = params.require(:user).permit(:first_name, :last_name, :email, :password)\n\t\t@user = User.create(user_params)\n\t\tlogin(@user) #log in user\n\t\tredirect_to \"/users/#{@user.id}\" #go to show\n\tend", "def create\n\n #.create is a method we get from AR.\n #it returns a new object in local memory with the specified params\n #it then saves the hash object in the database.\n @user = User.create user_params\n if @user.save\n session[:user_id] = @user.id.to_s\n flash['alert-success'] = \"You have been registered #{@user.username}, please login.\"\n redirect_to new_session_path\n else\n flash['alert-warning'] = 'Unable to create a user account.'\n redirect_to new_user_path\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end", "def perform(name, email, password)\n User.create(\n name: name,\n email: email,\n password: password,\n password_confirmation: password\n )\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end", "def create\n #@user = User.create(params[:user])\nend", "def new_user\n @user = User.new\n end", "def create_user\n\t \to = [('a'..'z'), ('1'..'9')].map { |i| i.to_a }.flatten\n\t \tstring = (0...9).map { o[rand(o.length)] }.join\n\t \t@user = User.create( username: params[:user][:username],password: string ,rol: params[:user][:rol], name: params[:user][:name], carrier: params[:user][:carrier], email: params[:user][:email], landline: params[:user][:landline], cell_phone: params[:user][:cell_phone], container: params[:user][:cell_phone], liquid_charge: params[:user][:liquid_charge], dry_charge: params[:user][:dry_charge] )\n\t \trespond_to do |format|\n\t \t\tif @user.save\n\t \t\t\tflash[:notice] = 'Se ha creado un nuevo usuario'\n\t \t\t\tformat.html { redirect_to users_path }\n\t \t\t\tformat.js {}\n\t \t\t\tformat.json { render :show, status: :created, location: @user }\n\t \t\telse\n\t \t\t\twarden.custom_failure!\n\t \t\t\tformat.html { render :new }\n\t \t\t\tformat.json { render json: @user.errors, status: :unprocessable_entity }\n\t \t\tend\n\t \tend\n\t end", "def create\n @user = User.new_user(params[:user])\n @user.attributes.each do |attr, val|\n logger.debug(\"attr: #{attr}, val: #{val}\")\n end\n\n if @user.save\n flash[:success] = \"Successfully created account, please sign in\"\n redirect_to login_path\n else\n flash[:warning] = \"Couldn't process the user\"\n render action: \"new\"\n end\n\n end", "def create\n user = User.new(user_params)\n if user.save\n auth_token = AuthenticateUser.new(user.email, user.password)\n .call\n # send email using welcome template\n UserMailer.welcome_email(user).deliver_now\n response = { message: Message.account_created, token: auth_token }\n json_response(response, :created)\n else\n json_response(user.errors, :unprocessable_entity)\n end\n end", "def create_user(db, user_name)\n\tdb.execute(\"INSERT INTO users (user_name) VALUES (?)\", [user_name])\n\tputs \"added new user\"\nend", "def create\n logger.debug(\"user create\")\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n format.html { redirect_to home_path, 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_user(name, password_digest, rank, security, mail)\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"INSERT INTO users (name, password, rank, security_level, mail) VALUES (?,?,?,?,?)\", name, password_digest, rank, security, mail)\n\n end", "def create\n @user = User.new(email:session[:userinfo].info.email,\n name:session[:userinfo].info.name,\n uid:session[:userinfo].uid)\n if @user.save\n @user.save\n redirect_to @user, notice: \"Welcome #{@user.name}!\"\n else\n redirect_to root_path, status: \"Something went wrong. Let's try this again.\"\n end\n end", "def create\n user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password]\n )\n if user.save\n session[:current_user_id] = user.id\n redirect_to \"/\"\n else\n flash[:error] = user.errors.full_messages.join(\". \")\n redirect_to new_user_path\n end\n end", "def create_user\n # provide the interface asking for name, destination and duration\n # then, create and store the User object\n end", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:success] = \"正常に保存されました。\"\n redirect_to users_url\n else\n render 'new'\n end\n end", "def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_user(database, username)\n\tdatabase.execute(\"INSERT INTO users (name) VALUES ( ? )\",[username])\nend", "def create\n user = User.new(username: params[:username])\n user.password = params[:password]\n user.save\n\n redirect_to root_url\n end", "def create\n @user = User.new(user_params)\n @user.save\n if @user.save\n redirect_to root_path, :notice => \"Signed up!\"\n else\n redirect_to signup_path\n end\n end", "def create\n @user = User.new user_params #authenticating the user's information. fill in the db with these values.\n if @user.save #if it saves,\n redirect_to \"/users/#{ @user.id }\" #redirect to their profile page\n else\n render :new #if not new form.\n end\n end", "def create\n \n user = User.new(user_params)\n\n if user.save\n\n render json: {status: 200, msg: 'User was created.'}\n\n else \n render json: {\n errors: user.errors.full_messages\n }, status: :unprocessable_entity\n\n end\n\n end", "def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end", "def register\n @user = User.new(user_id: params[:user_id], password: params[:password])\n @user.save\n end", "def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end", "def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end", "def create\n @user = User.new(user_params)\n if @user.save\n flash[:user] = t('user_create')\n redirect_to user_path(@user)\n else\n render 'new'\n end\n end", "def create_user(user_hash={})\n @user = User.new(user_hash)\n if @user.save\n return true\n else\n return false\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t\t# If user was save with succes, then sign in automaticly, else, render new.\n\t\tif @user.save\n\t\t\tsign_in @user\n\t\t \tflash[:sucess] = \"Seja bem-vindo!\"\n\t\t\tredirect_to :action => :show, :id => @user.id\n\t\t\tCUSTOM_LOGGER.info(\"Created and associated user to params #{@user.to_yaml}\")\n\t\telse\n\t\t\trender 'new'\n\t\t\tCUSTOM_LOGGER.error(\"Not created and associated user to params #{@user.to_yaml}\")\n\t\tend\n\tend", "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\t\t\n\t\treg_params = params.require(:user).permit(\n\t\t\t:name, :email, :password, :password_confirmation\n\t\t)\n\n\t\tname = reg_params[:name]\n\t\temail = reg_params[:email]\n\t\tpassword = reg_params[:password]\n\t\tpassword_confirmation = reg_params[:password_confirmation]\n\n\t\tnew_user = User.new(\n\t\t\tname: name,\n\t\t\temail: email,\n\t\t\tpassword: password,\n\t\t\tpassword_confirmation: password_confirmation\n\t\t)\n\n\t\tif new_user.valid?\n\t\t\tnew_user.save(validate: false)\n\t\t\tflash[:success] = \"Account successfully created.\"\n\t\telse\n\t\t\tflash[:error] = new_user.errors.full_messages\n\t\tend\n\t\tredirect_to root_path\n\tend", "def create_user\n # first insert into user_secrets and use it's id in users table\n @user_secret = UserSecret.using_client_shard(client: @client).create!(login_salt: @login_salt_hash[:ciphertext_blob])\n\n password_e = User.using_client_shard(client: @client).get_encrypted_password(@password, @login_salt_hash[:plaintext])\n\n @user = User.using_client_shard(client: @client).new(\n client_id: @client_id,\n email: @email,\n password: password_e,\n user_secret_id: @user_secret.id,\n status: GlobalConstant::User.active_status,\n last_logged_in_at: Time.now.to_i\n )\n\n @user.send(\"set_\" + GlobalConstant::User.doptin_mail_sent_property) if @client.is_verify_page_active_for_client?\n @user.save!\n end", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\tredirect_to login_path\n\t\telse\n\t\t\trender :new\n\t\tend\n\tend", "def create\n @user = User.new(user_params)\n\n valid = @user.valid?\n\n if valid\n sql_parts = [\"INSERT INTO users (username, email, age, firstname, lastname, phone, password_digest, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)\",\n @user.username, @user.email, @user.age, @user.firstname, @user.lastname, @user.phone, @user.password_digest, Time.now, Time.now]\n sql = ApplicationRecord.send(:sanitize_sql_array, sql_parts)\n id = ApplicationRecord.connection.insert(sql)\n end\n\n respond_to do |format|\n if valid && id\n format.html { redirect_to '/signin', notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_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.new(params[:user])\n if @user.save\n redirect_to users_path, notice: t('users.update.updated')\n else\n @page_title = t(\"actions.new_user\")\n render action: 'new'\n end\n end", "def createUser(data)\n\t\tUsuario.create(:login => data['login'], :password => data['password'],\n\t\t\t:nombre => data['nombre'], :apellidos => data['apellidos'])\n\tend", "def create\n @user = User.new(user_params)\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 :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t if @user.save\n\t \tsession[:user_id] = @user.id\n\t \tredirect_to user_url(@user)\n\t else\n\t \tflash.notice = \"User Registration failed. Try again.\"\n\t \trender 'new'\n\t end\n\tend", "def create\n @user = User.new(user_params)\n if @user.save\n redirect_to user_path(@user)\n else\n render :new\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n redirect_to users_path, notice: \"ユーザが保存されました\"\n else\n render :new\n end\n end", "def create_user(email, name, pw)\n user = User.find_or_create_by(username: name) do |u|\n u.email = email\n u.username = name\n u.password = pw\n u.password_confirmation = pw\n end\n user\nend", "def create\n @user = User.new(params[:user])\n @user.attributes = params[:user]\n if @user.save\n flash[:success] = I18n.t('users.created')\n redirect_to users_path\n else\n self.bread\n add_crumb(I18n.t('users.new'),new_user_path)\n render 'new'\n end\n end", "def create\n user=User.new(user_params)\n if user.save\n flash[:notice]=\"new user was created\"\n redirect_to \"/users\"\n else\n flash[:notice]=\"new user creation ERROR, please try again\"\n\t\t\tredirect_to \"/users\"\n end\n\tend", "def create\n raise\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'Usuário foi inserido com sucesso' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\n\t\tif @user.save\n\t\t\tsession[:user_id] = @user.id\n\t\t\t# If user account is successfully created, log user in\n\t\t\tsign_in @user\n\t\t\tredirect_to events_path, :notice => \"Welcome #{@user.firstname}!\"\n\t\telse\n\t\t\t# Else redirect to home page\n\t\t\tredirect_to root_url\n\t\tend\n\tend", "def create\n # creates a new user with attributes params[:user]\n @user = User.create params[:user]\n\n # redirect to show action\n redirect_to @user\n end", "def create\n @user = User.new(user_params)\n if @user.save\n redirect_to @user, notice: 'Se creo un usuario exitosamente.'\n else\n render :new\n end\n end", "def create_new_user\r\n touch(\"* id:'#{add}'\")\r\n end" ]
[ "0.82827437", "0.82550865", "0.8250606", "0.80635464", "0.8017084", "0.7909887", "0.7801407", "0.77754986", "0.7733913", "0.7733913", "0.7733564", "0.7732228", "0.772994", "0.77292323", "0.7729019", "0.77122927", "0.77013797", "0.7692896", "0.7692896", "0.7683531", "0.76808316", "0.7651276", "0.7636802", "0.76317346", "0.7614358", "0.7602865", "0.7599635", "0.7587284", "0.75837284", "0.75805664", "0.7578508", "0.7578033", "0.7576036", "0.7522746", "0.7517363", "0.7512341", "0.7511978", "0.750313", "0.75013864", "0.7500779", "0.7479487", "0.7478777", "0.74775445", "0.74764735", "0.747614", "0.7472121", "0.7469301", "0.7467099", "0.74596363", "0.74563", "0.7449975", "0.74444544", "0.7438483", "0.74332356", "0.74306303", "0.7419572", "0.74094486", "0.7402962", "0.7399863", "0.7388193", "0.7384581", "0.7379569", "0.7377456", "0.7372949", "0.7369865", "0.7364251", "0.73612016", "0.73601496", "0.73567384", "0.7353503", "0.73465323", "0.7344682", "0.7344125", "0.73385566", "0.7337188", "0.73366505", "0.7332411", "0.73314214", "0.7328984", "0.7328974", "0.7327761", "0.7325874", "0.7324228", "0.7324165", "0.73209023", "0.7316948", "0.7315993", "0.73134756", "0.7311911", "0.73026484", "0.730207", "0.73020506", "0.7299657", "0.7299562", "0.7299483", "0.7297007", "0.7296398", "0.72926784", "0.72915655", "0.72878516" ]
0.79190993
5
Edit a User in the database
def edit_user(edited_user) user = User.find(edited_user.email) user.attributes = edited_user.attributes user.save! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n \n @user = User.find(params[:id])\n \n end", "def edit\n @user = User.find(params[:id])\n @user.update(user_params)\n end", "def edit\n @user = User.find(params[:id])\n # @user は編集対象のユーザー\n # current_user はログインしているユーザー \n\n end", "def edit\n # loads user from the database\n @user = User.find(params[:id])\n end", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n\t@user = User.find(params[:id])\n\t@title = \"Edit user\"\n end", "def edit\n @user = User.find(params[:user_id])\n end", "def edit\n @user = User.find(params[:user_id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n # finds user with id of params[:id]\n @user = User.find params[:id]\n end", "def edit\n\t\t@user = User.find(params(:id))\n\tend", "def edit\n # find the user we want to edit by id\n # this will send the @user to the edit page with a form\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n\t\tthe_user_id = params[\"id\"]\n \t@user = User.find_by(:id => the_user_id)\n\tend", "def edit\n # return an HTML form for editing a specific user\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find params[:id]\n end", "def edit\n @userToEdit = User.find(params[:id])\n end", "def edit\n # @user = User.find(params[:id]) -- not needed bc of correct_user\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit\n \t@user = User.find params[:id]\n end", "def edit\n\t@user = User.find(params[:id])\nend", "def edit\n # this finds the current user\n @user = User.find params[:id]\n end", "def edit\n @user = User.find(params[:id])\n end", "def edit_user\n if (@user = find_user(params[:id]))\n @all_roles = Role.find_all.select { |r| r.name != UserEngine.config(:guest_role_name) }\n case request.method\n when :get\n when :post\n @user.attributes = params[:user].delete_if { |k,v| not LoginEngine.config(:changeable_fields).include?(k) }\n if @user.save\n flash.now[:notice] = \"Details for user '#{@user.login}' have been updated\"\n else\n flash.now[:warning] = \"Details could not be updated!\"\n end\n end\n else\n redirect_back_or_default :action => 'list'\n end\n end", "def edit\n @title = \"Edit user\"\n @user = User.find(params[:id])\n\n end", "def edit\n @user = User.find(session[:user_id])\n end", "def edit\n # @user = User.find(params[:id])\n # already in correct_user\n end", "def edit\n @page_title = 'Edit user'\n @user = User.find(params[:id])\n end", "def edit\n @user=User.find(params[:id])\n end", "def edit\n # @user is already set by correct_user\n # @user = User.find(params[:id])\n end", "def edit\n @user= User.find_by_id(current_user.id)\n end", "def edit\n set_user\n end", "def edit\n # find the user by the user id in the route params\n # (this will likely be moved to its own before method)\n @user = User.find(params[:id])\n end", "def edit\n @user = User.find(params[:id])\n\n deny_wrong_user if !current_user?(@user)\n end", "def update_user\n end", "def edit\n # @user は編集対象のユーザー\n # current_user はログインしているユーザー \n @user = User.find(params[:id])\n if (current_user != @user)\n redirect_to root_path\n end\n end", "def update\n @user = User.shod(params[:id])\n if @user.update(user_params)\n flash[:notice] = t('user_update')\n redirect_to user_path(@user)\n else\n render 'edit'\n end\n end", "def edit\n @user = User.find_by(user_name: params[:user_name])\n end", "def edit\n if params[:id].present?\n @user = User.find(params[:id])\n else\n super\n end\n end", "def edit\n \"\"\"\n @user = User.find(params[:id])\n \"\"\"\n end", "def update\n # find and update a specific user\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User updated'\n redirect_to users_path\n else\n flash[:error] = 'Update error'\n render :action => \"edit\", :id => @user\n end\n end", "def update\n # finds user with id of params[:id]\n @user = User.find params[:id]\n\n # updates the attributes of this user to whatever values are stored in\n # params[:user]\n @user.update params[:user]\n\n # redirect to edit action\n redirect_to edit_user_path\n end", "def edit\n\t @user = User.find(params[:id])\n\t redirect_to root_path unless current_user.is_admin? or @user == current_user\n\tend", "def update\n @user = User.find(params[:id])\n end", "def edit\n if (session[:user_id] != nil)\n @user = User.find_by(id: session[:user_id])\n else\n redirect_to login_path\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n redirect_to @user\n else\n render action: 'edit'\n end\n end", "def edit\r\n \t@user = current_user\r\n end", "def edit\n @user = current_user\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(params.require(:user).permit(:username, :email))\n redirect_to users_path\n else\n render 'edit'\n end\n end", "def edit\n # @user = User.find(params[:id]) <-- not needed; @user defined in correct_user\n end", "def update\n \t@user = User.find params[:id]\n\n \tif @user.update_attributes(user_params)\n \t\tredirect_to users_path, status: 303\n \telse\n \t\trender :edit\n \tend\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n flash[:success] = \"successfully updated\"\n redirect_to @user \n else\n @title = \"Edit User\"\n render action: \"edit\" \n end\n end", "def update\n @user = User.find_by(id: params[:id])\n if @user.update_attributes :username => user_params[:username], :email => user_params[:email], :password => user_params[:password]\n render :show\n else\n render :edit\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n redirect_to @user\n else\n render 'edit'\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n flash[:success] = \"Updated user\"\n redirect_to user_url(@user)\n else\n flash.now[:errors] = @user.errors.full_messages\n render :edit\n end\n end", "def update\n @user = User.find(params[:id])\n unless @account.admin || @account.username==@user.username\n flash[:warning] = \"You do not have enough access rights to edit this user.\"\n redirect_to root_path\n return\n end\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(root_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n redirect_to @user, :notice => 'User was successfully updated.'\n else\n render :action => \"edit\"\n end\n end", "def update\n #@user = User.find params[:id]\n if @user.update_attributes(user_params)\n redirect_to show_user_path(id: @user.id)\n else\n render \"edit\"\n end\n end", "def update\n @user = find_user(params[:username])\n\n if @user.update(user_params, current_user)\n redirect_to users_path\n else\n render('edit', status: :unprocessable_entity)\n end\n end", "def edit\n @user = find_user(params[:username])\n end" ]
[ "0.82974344", "0.8265234", "0.8246112", "0.8167307", "0.8166744", "0.8166744", "0.8166744", "0.8166744", "0.812911", "0.80982524", "0.80982524", "0.80937004", "0.80937004", "0.80921304", "0.80813485", "0.8062237", "0.80555034", "0.80549896", "0.8046673", "0.80171055", "0.8013001", "0.8011122", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.80060244", "0.8000571", "0.7989713", "0.7986069", "0.79225844", "0.79213923", "0.7907565", "0.78955704", "0.7840142", "0.78244466", "0.77640694", "0.7751371", "0.77263886", "0.77069503", "0.77041715", "0.7684513", "0.76796174", "0.76242274", "0.7613106", "0.7608097", "0.75867194", "0.7563304", "0.75529563", "0.7537762", "0.7520936", "0.7503485", "0.75029474", "0.74887943", "0.74856305", "0.74757195", "0.74706954", "0.747067", "0.74698114", "0.7469423", "0.74562275", "0.7447432", "0.74463385", "0.7443532", "0.7439471", "0.74309033", "0.7425865", "0.74185383" ]
0.7616486
76
Delete a particular User in the database
def delete_user(user_email) user = User.all.where(email: user_email) user.delete! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_user\n client.delete(user)\n end", "def delete_user(id)\n @user = User.destroy(id)\n end", "def destroy(user)\n unless user.id\n self.class.invalid_object!(\"Cannot save user #{user.username} without a valid id\")\n end\n\n unless execute_sql(:validate, :user) { table.select(:id).filter(:id => user.id).any? }\n raise RecordNotFound, \"Can't delete user #{user.username} because it doesn't exist\"\n end\n\n execute_sql(:delete, :user) { table.filter(:id => user.id).delete }\n end", "def delete_user(user)\n delete user_path(user)\n end", "def delete_user\n end", "def delete_user (db, user_name)\n\tdb.execute(\"DELETE FROM users WHERE user_name=?\", [user_name])\nend", "def delete_user(userid) \n $db.execute('DELETE FROM users WHERE userid=?', userid)\n end", "def delete\n @user = User.find(params[:id])\n @user.delete\n redirect_to root_path\n end", "def delete_user(id)\n get_user_byid(id).destroy\n end", "def delete\n @user = User.find(params[:id])\n end", "def delete\n @user = User.find(params[:id])\n end", "def delete\n connection.delete_user id\n nil\n end", "def delete_user(id)\n # accept an id input parameter\n # use the User Model class to remove the User associated with the `id` primary key from the database\n # (no return is required)\n (User.find_by(id: id)).destroy\n end", "def delete_user(id)\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"DELETE FROM posts WHERE user_id = ?\", id)\n \n db.execute(\"DELETE FROM users WHERE id = ?\", id)\n\n end", "def delete\n CONNECTION.execute(\"DELETE FROM users WHERE id = #{self.id};\")\n end", "def delete_user(id)\n elektron_identity.delete(\"users/#{id}\")\n end", "def destroy\n @user = User.find(params[:id])\n @user.deleted = true\n if @user.save\n redirect_to(users_path, :alert => 'User deleted successfully.')\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n record_activity(\"deleted user: \" + @user.email)\n redirect_to users_path, :notice => \"User deleted\"\n end", "def delete_user\n if (@user = find_user(params[:id]))\n do_delete_user(@user)\n flash[:notice] = \"User '#{@user.login}' has been deleted.\"\n end\n redirect_to :action => 'list'\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n redirect_to users_path, :notice => \"User deleted.\"\n end", "def destroy\n\t\t@user.delete\n\tend", "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 end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n end", "def destroy\n @user = User.find(params[:id])\n @user.delete!\n\n redirect_to admin_users_path\n end", "def destroy\n @user = User.find(params[:id])\n @user.delete!\n\n redirect_to admin_users_path\n end", "def delete_user(user_id:, params:)\n connection.delete(\"users/#{user_id}\", params).body\n end", "def destroy\n @user = User.find(params[:id])\n \n if admon_user\n flash[:notice] = 'La cuenta ha sido eliminada'\n redirect_to users_path\n else\n flash[:notice] = 'Su cuenta ha sido eliminada'\n redirect_to signup_path\n current_user_session.destroy\n end\n\n @user.destroy\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n redirect_to users_path, :notice => 'User was successfully deleted.'\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n flash[:notice] = \"User deleted successfully.\"\n redirect_to admin_user_path\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n head :no_content\n end", "def deleteUser(id) \n user_to_remove = getUserByID(id)\n\n if user_to_remove != nil \n @Users.delete(user_to_remove)\n else\n puts \"No such user.\"\n end \n end", "def destroy\n @user = User.find(params[:id]).destroy\n flash[:success] = \"User deleted!\"\n redirect_to users_url\n end", "def delete user_id, options={}, headers={}\n @connection.delete \"users/#{user_id}.json\", options, headers\n end", "def destroy\n @user = User.find(params[:user])\n @user.destroy\n redirect_to users_path\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n redirect_to users_path\n end", "def destroy\n\t\t@user = User.find(params[:id])\n\t\t@user.destroy\n\n\t\tredirect_to users_path\n\tend", "def destroy\n @user = User.find(params[:id])\n @user.delete\n flash[:notice] = t('users.destroyed')\n redirect_to admin_users_url\n end", "def destroy\n @user = User.find(params[:id])\n if @user.destroy\n flash[:success] = \"User has been deleted!\"\n redirect_to users_url\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n redirect_to(users_url)\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to root_path\n end", "def destroy\n @user = User.find_by_id(params[:id])\n @user.destroy\n end", "def delete_user(user_id)\n Result.new(call(CMD_DEL_USER % user_id))\n end", "def remove_user\n query_api \"/rest/user\", nil, \"DELETE\"\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to root_url\n end", "def delete_user(user_id)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n path = \"#{users_path}/#{user_id}\"\n delete(path)\n end", "def destroy\n @user = User.find(params[:id]).destroy\n redirect_to users_path\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n flash[:error] = \"Delete User #{user.userName}\"\n redirect_to '/users'\n end", "def delete_user\n User.delete(params[:id])\n render :text => \"\"\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n redirect_to(root_path)\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted :(\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\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\t\tUser.find(params[:id]).destroy\n\t\tflash[:success] = \"User deleted\"\n\t\tredirect_to users_url\n\tend", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n redirect_to users_path\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n redirect_to users_path\n end", "def destroy\n @user = User.find params[:id]\n @user.destroy\n redirect_to users_path\n end", "def delete_user(uid)\n @client.post(with_path(\"accounts:delete\"), {localId: validate_uid(uid, required: true)})\n end", "def destroy\n\t @user = User.find(params[:id])\n\t @user.destroy\n\t redirect_to '/users'\n\tend", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_path\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 User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted\"\n redirect_to users_url\n end", "def delete\n @user = User.find(params[:id])\n @user.destroy if @user!=nil # TODO maybe set status to 0 as deleted instead of removing entry\n flash[:notice] = \"User '#{@user.username}' deleted successfully.\"\n\n # when admin delete himself\n if session[:user_id]== @user.id\n session[:user_id] = nil\n session[:username] = nil\n end\n redirect_to(:action => 'list')\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end", "def destroy\n user.destroy\n end", "def destroy\n @user = User.shod(params[:id])\n authorize! :delete, @user\n @user.destroy\n flash[:user_delete] = t('user_delete')\n redirect_to users_path\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 @user.destroy\n head :no_content\n end", "def delete_user(user_name:)\n validate_user_name(:user_name, user_name)\n\n wrap_response(@connection.delete(user_path(user_name))).fmap { |r| SftpgoClient::ApiResponse.new(r.body) }\n end", "def delete_old_user(user_id = nil)\n unless user_id.nil?\n user = User.find(user_id)\n user.delete\n end\n end", "def destroy\n @user = User.find(params[:id]) rescue nil\n\n if !@user.nil?\n @user.destroy\n redirect_to users_path\n else\n redirect_to users_path, alert: 'Erro ao deletar usuário'\n end\n end", "def destroy\n query_params = save_query_params\n @user.destroy\n respond_to do |format|\n format.html { redirect_to admin_users_path + query_params, notice: t('views.admin.users.user_deleted_successfully') }\n end\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted user #{@user.name}\")\n end", "def destroy\n userToBeRemoved = User.find(params[:id])\n userToBeRemoved.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\t@user = User.find(params[:id])\n \t\t@user.destroy\n\t \tredirect_to '/logout'\n\tend", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n flash[:notice] = 'User was successfully deleted.'\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n \tuser = User.find params[:id]\n \tuser.destroy\n\n \tredirect_to users_path, status: 303\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted successfully.\"\n redirect_to users_url\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 @user = User.find(params[:id])\n if current_user?(@user)\n redirect_to users_path, notice: \"Admins are not able to delete themselves.\"\n else\n @user.destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end\n end", "def remove_user(user)\n self.users.destroy(user)\n end", "def destroy\n user = User.find(params[:id])\n\tuser.destroy\n\tflash[:success] = \"User #{user.name} was deleted\"\n\tredirect_to users_url\n end", "def destroy\n @user = User.find(params[:id]).destroy\n # @user.destroy\n redirect_to root_path\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n redirect_to root_path, status: 303\n \n end", "def destroy\n\t\tUser.find(params[:id]).delete\n\t\tflash[:success] = \"Deleted current user\"\n\t\tredirect_to users_path\n\tend", "def destroy\n @user.destroy\n redirect_to users_path, notice: (I18n.t :act_delete)\n end", "def destroy\n authorize! :destroy, @user, :message => 'You are not authorized to perform this operation.'\n user = User.find(params[:id])\n unless user == current_user\n user.destroy\n redirect_to users_path, :notice => \"User deleted. #{undo_link}\"\n else\n redirect_to users_path, :notice => \"Can't delete yourself.\"\n end\n\n end", "def destroy\n User.find(params[:id]).destroy\n redirect_to users_path\n end", "def destroy\n @user.destroy\n end", "def destroy\n \tUser.find(params[:id]).destroy\n \tflash[:success] = \"User deleted\"\n \tredirect_to users_url\n end", "def destroy\n @user.destroy\n end", "def destroy\n @user.destroy\n end", "def destroy\n @user.destroy\n end" ]
[ "0.84923565", "0.83225894", "0.82545865", "0.8222498", "0.81965995", "0.817622", "0.8161376", "0.8089328", "0.8053631", "0.80528075", "0.80528075", "0.8042526", "0.79831606", "0.7947526", "0.7941018", "0.79282117", "0.79037184", "0.7887739", "0.7882867", "0.78773665", "0.7843082", "0.7828442", "0.78192574", "0.78192574", "0.78192574", "0.78192574", "0.7805683", "0.7805683", "0.7797159", "0.77933943", "0.7790849", "0.7782388", "0.7775023", "0.7763784", "0.7760646", "0.77594787", "0.77589345", "0.7751928", "0.7736014", "0.7723212", "0.7699765", "0.7698096", "0.7689053", "0.768862", "0.7680403", "0.767878", "0.76599026", "0.7658237", "0.7657822", "0.76561284", "0.76557004", "0.76545966", "0.7649583", "0.76301694", "0.76301694", "0.7627988", "0.76248825", "0.7623121", "0.7623121", "0.7621512", "0.76201266", "0.7617183", "0.7615801", "0.76102215", "0.76102215", "0.76097727", "0.76097727", "0.76097727", "0.76097727", "0.760685", "0.7605296", "0.7601265", "0.759934", "0.7595954", "0.758178", "0.75815594", "0.757791", "0.7576422", "0.75751895", "0.75723624", "0.75620437", "0.75620216", "0.7559298", "0.75548553", "0.75524485", "0.7544789", "0.75407076", "0.7538336", "0.75378144", "0.75374424", "0.75359833", "0.75298405", "0.7525537", "0.75246334", "0.75243294", "0.7522333", "0.75221586", "0.7521745", "0.7521745", "0.7521745" ]
0.77848023
31
vai pegar os componentes e as quantidade de cada produto/componente
def iterando_nos_componente_enviados quantidade = params[:produto_quantidade] i = 1 for i in quantidade.to_i do @componentesenviados << Produto.all(params[:exibeformcomponente_id]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_produits_used\n sum = 0\n self.protofactures.each { |p| sum += p.prix_unit * (p.quantite - p.stock) }\n sum\n end", "def sum_produits_assoc\n # TODO URGENT facture 46 la valeur renvoyee est fausse\n sum = 0\n # logger.error \"facture : #{self.id}\"\n self.protofactures.each do |p| \n # logger.error \"produit #{p.produit.name}\"\n # logger.error \"\\tquantite: #{p.quantite}\"\n # logger.error \"\\tused: #{p.get_used}\"\n # logger.error \"\\tstock: #{p.quantite - p.get_used}\"\n sum += p.prix_unit * p.quantite\n end\n # logger.error \"\\tsum_produits_assoc : #{sum}\"\n sum\n end", "def price_definition_set_by_components(quantity,value_quarter_sheet,component,color_mode,options={})\n accumulate_t = 0\n accumulate_tr = 0\n \n \n if options[:by_price_definition_set]\n result = eval(\"raw_material_price_definition_set_#{color_mode}_by_components\").first(:conditions => [\"component_id = ? AND component_type = ?\",component.id,component.class.to_s])\n if result\n accumulate_t = result.amount_t*quantity\n accumulate_tr = result.amount_tr*quantity\n else\n result = eval(\"raw_material_price_definition_set_#{color_mode}_by_components\").first(:conditions => [\"component_type = ? AND base_amount = ?\",component.class.to_s,true])\n accumulate_t = result.amount_t*value_quarter_sheet\n accumulate_tr = result.amount_tr*value_quarter_sheet\n end\n else\n result = eval(\"raw_material_price_definition_set_#{color_mode}_by_components\").first(:conditions => [\"component_type = ? AND base_amount = ?\",component.class.to_s,true])\n accumulate_t = result.amount_t*value_quarter_sheet\n accumulate_tr = result.amount_tr*value_quarter_sheet\n end\n {:t =>accumulate_t.round(2),:tr => accumulate_tr.round(2)}\n end", "def preco_total\n produto.preco * quantidade\n end", "def get_cout_ha_produits\n\t sum = 0\n\t self.putoparcelles.each do |putoparcelle|\n \t\tputoparcelle.pulve.putoproduits.each do |putoproduit|\n \t\t\tsum += putoproduit.get_cout_ha_parcelle(self)\n end\n end\n sum\n end", "def sum_produits_stock\n sum = 0\n self.protofactures.each { |p| sum += p.prix_unit * p.stock }\n sum\n end", "def items_cesta()\n @total_cesta_cables = 0\n @items_cesta = 0\n CestaCable.all.each{|c| t=TipoMaterial.find_by_id(c.tipo_material_id);c.cantidad =1 unless !c.cantidad.blank?; suma= t.costo * c.cantidad unless t.nil?; @total_cesta_cables += suma unless t.nil?; @items_cesta += 1 unless t.nil?}\n\n return @items_cesta\nend", "def get_cout_total_produits\n\t sum = 0\n\t self.putoparcelles.each do |putoparcelle|\n \t\tputoparcelle.pulve.putoproduits.each do |putoproduit|\n \t\t\tsum += putoproduit.get_cout_total_parcelle(self)\n end\n end\n sum\n end", "def increment_units\n contents.each do |key,content|\n id = content[\"_id\"] || content[\"item_id\"]\n begin\n \n product = shop.products.find(id)\n return false if product.nil? || product.dont_track_quantities?\n\n new_pv = []\n\n if product.price_variants.length==1\n\n new_pv = product.price_variants.first\n new_pv['quantity'] = new_pv['quantity'].to_i+content['quantity'].to_i\n product.num_orders = [product.num_orders-content['quantity'].to_i].max\n product.price_variants = [ new_pv ]\n\n else\n\n product.price_variants.each do |pv|\n name = [pv['primary'],pv['secondary']].join(\" \").downcase.trim\n name = \"\" if name==\" \"\n if name==content['variant_name'].trim.downcase && !pv['quantity'].blank?\n new_pv << pv.merge( 'quantity' => (pv['quantity'].to_i+content['quantity'].to_i) )\n else \n new_pv << pv\n end\n end\n product.num_orders = [product.num_orders-content['quantity'].to_i].max\n product.price_variants = new_pv\n\n end\n product.save\n\n rescue Exception => e\n ::Exceptional::Catcher.handle(e)\n # raise(e)\n end\n end\n end", "def calcular_valores_parciais(items, items_quantidade, items_valor, modo_calcular_servico = nil)\n valor_total_calculado = 0.0\n items.each_pair { |id, booleano|\n puts(\"Percorrendo Array[id]: \"+id+\", booleando=\"+booleano.to_s)\n if(booleano) then\n item = obter_item_por_produto_id(id)\n item_qtd = items_quantidade.fetch(id)\n puts(\"Item no Loop: \"+item.produto.descricao+\", valor_unit=\"+item.valor_unitario.to_s+\", qtd=\"+item_qtd.to_s)\n if (!modo_calcular_servico) then\n items_valor[id] = (item.valor_unitario * item_qtd)\n valor_total_calculado += items_valor.fetch(id)\n elsif (item.produto.adiciona_taxa_servico)\n valor_total_calculado += (item.valor_unitario * item_qtd * 0.1)\n end\n end\n }\n valor_total_calculado\nend", "def quantity_of(product_or_supply_item)\n quantity = 0\n lines.each do |l|\n if l.product.componentized?\n l.product.product_sets.each do |ps|\n quantity = ps.quantity if ps.component == product_or_supply_item\n end\n else\n quantity = l.quantity if l.product == product_or_supply_item\n end\n end\n\n return quantity\n end", "def formula_for(qty, desired_element)\n el = @elements[desired_element]\n qty += 1 while (qty % el.min_qty).positive? # Have to create in min quantity multiples\n scale = [qty / el.min_qty, 1].max # Then see if we need to multiply\n\n el.building_blocks.sort { |b, a| a[0].max_reactions <=> b[0].max_reactions }.map do |component, component_qty|\n [component.name, component_qty * scale]\n end\n end", "def calculate_component_pricing\n purchase_price = BigDecimal.new(\"0\")\n price = BigDecimal.new(\"0\")\n margin = BigDecimal.new(\"0\")\n # Safeguard to prevent calculation on straightforward simple products\n if componentized? \n self.product_sets.each do |ps|\n # Components can disappear if their supply items disappear.\n # This is handled more elegantly by disabling these components from outside\n # when this occurs, but let's check for this here just to be safe.\n unless ps.component.nil?\n purchase_price += ps.purchase_price # Convenience method that does ps.quantity * ps.component.purchase_price\n end\n end\n\n margin = (purchase_price / BigDecimal.new(\"100.0\")) * self.applicable_margin_percentage_for_price(purchase_price) # Must not call through self.margin_percentage, because otherwise an infinite loop occurs\n gross_price = purchase_price + margin\n margin = BigDecimal.new(margin.to_s)\n gross_price = BigDecimal.new(gross_price.to_s)\n end\n @component_pricing ||= [gross_price, margin, purchase_price]\n return @component_pricing\n end", "def total\n total_amount = 0\n @order.each do |product, quantity|\n prod_price = PRODUCTS[product]\n if @pricing_rules.key?(product)\n rule = @pricing_rules[product]\n n = rule[1]\n type = rule[0]\n case type\n when \"Nx1\"\n total_amount += prod_price*( quantity/n + quantity%n )\n when \"BULK\"\n disccount_price = rule[2]\n total_amount += quantity * (quantity < n ? prod_price : disccount_price) #disccount price\n end\n else\n total_amount += prod_price * quantity\n end\n end\n total_amount\n end", "def total_nutrientes\n\t\ti = 0\n\t\tproteinas = carbohidratos = lipidos = 0.0\n\t\twhile i < @lista_alimentos.size do\n\t\t\tproteinas += (@lista_alimentos[i].proteinas)*(@lista_cantidades[i])\n\t\t\tcarbohidratos += (@lista_alimentos[i].carbohidratos)*(@lista_cantidades[i])\n\t\t\tlipidos += (@lista_alimentos[i].lipidos)*(@lista_cantidades[i])\n\t\t i+= 1\n\t\tend\n\t\treturn proteinas + lipidos + carbohidratos\n\tend", "def calc_calorie\n self.ingredients.map {|x| x.calories * x.qty }.sum\n end", "def total_cost\n \tingredients_cost + components_cost\n end", "def bought\n cart = JSON.parse(self.cart, object_class: OpenStruct)\n count = Hash.new(0)\n cart.items.each do |item|\n count[item.id] += item.quantity\n end\n cart.combos.each do |item|\n combo = Combo.find(item.id)\n products = JSON.parse(combo.products)\n pointer = 0\n products.each do |i|\n if i.kind_of?(Array)\n count[i[item.selected[pointer]]] += 1\n pointer += 1\n else\n count[i] += 1\n end\n end\n end\n count\n end", "def cantidad_casas_hoteles\n aux = 0\n \n @propiedades.each do |i|\n aux += i.cantidad_casas_hoteles\n end\n \n return aux\n end", "def calculate_produit_by_cat_for_parcelle(parcelle)\n # init\n sum = Hash.new\n sum[:total] = Hash.new\n sum[:ha] = Hash.new\n sum[:total][:total] = 0\n sum[:ha][:total] = 0\n Category.produits_cats.each do |cat|\n \t cat.subtree.each do |sub_cat|\n \t sum[:ha][\"#{sub_cat.code.to_sym}\"] = 0\n \t sum[:total][\"#{sub_cat.code.to_sym}\"] = 0\n end\n end\n # calcul\n Category.produits_cats.each do |cat|\n \tsum = calculate_produit_by_cat_for_parcelle_recurs(sum, cat, parcelle)\n end\n # calcul du total\n sum = calculate_produit_by_cat_for_parcelle_total(sum, parcelle)\n return sum\n end", "def precio_total_compras\n compras.sum(:precio_total)\n #p = 0\n #compras.each do |compra|\n #p += (compra.precio_total || 0)\n #end\n #return p\n end", "def total\n # Calculo el total sin descuentos\n self.total_prize = @products.map {|p| p.prize }.inject :+\n\n # Aplico todos los descuentos dinamicamente\n @discounts.each do |discount|\n discount.call self\n end\n\n self.total_prize # Retorno el precio final\n end", "def crear_productos_contratados\n @lis_products = Sale::ProductQuotation.where(sale_quotation_id: self.sale_quotation_id)\n @lis_products.each do |product|\n product.quantity.times do\n Payment::ContractedProduct.create(\n plan_id: self.id,\n product_product_id: product.product_product_id,\n price_contracted: product.product_product.price,\n valid_until: Date.today + product.product_product.valid_days,\n user_created_id: self.user_created_id)\n end\n end\n end", "def producao (quantidade, tamanho: :M, cor: :azul) #não precisa obdecer a ordem de tamanho e cor, pq tem chave e valor\n puts \"Produzindo #{quantidade} de roupas tamanho #{tamanho} e cor #{cor}\"\nend", "def totalPrazo(cp,quant)\n\t\treg = cp.size - 1\n\t\tret = 0\n\t\tfor ct in (0..reg)\n\t\t\tret = ret + (desconto(Produt.find(cp[ct]).prazo, Produt.find(cp[ct]).id) * quant[ct])\n\t\tend\n\t\treturn ret\n\tend", "def component_total(components, total = 0)\n components.each do |comp|\n total += impact_total(comp) if comp['impacts'].present?\n total += component_total(comp['components']) if comp['components'].present?\n end\n total\n end", "def calculo \n self.minutos_reales = 5 * 480 #cantidad de OPERARIOS * Jornada de Trabajo(Turnos)\n self.costo_minuto = 89 #Costo Real por minuto\n self.otros_costos = 540 * 89 #Tiempo Total(Minutos) * Costo Real por Minutos\n self.costo_mano_obra = 420 * 5 * 89 # Jornada Minutos * Cantidad Operarios * Costo Real por minutos \n self.manoObraPlaneada = 650.000 * 5 # Salario Total * Cantidad de operarios \n end", "def quantity\n map(&:quantity).sum\n end", "def cartas_por_valor\n @valores = []\n @valores = @mi_mano.group_by{|k, v| v[:valor]}.map{|k, v| [k, v.count]}\n end", "def quantity\n consumables.size\n end", "def carbohidratos\n\t\treturn @carbohidratos*@cantidad\n\tend", "def quantified_items\n products.map { |product| [product.variant, product.quantity] }\n end", "def carbo \n grtotal = 0\n sum = 0\n\t\t#itera en las dos listas a la vez para poder calcular las \n #cabrohidratos dependiendo de la cantidad y tambien suma\n #todas las cantidades para poder calcular el porcentaje\n #despues\n @lista.zip(@listagr).each do |normal, gr|\n grtotal += gr\n cant = gr/1000.0\n sum += normal.carbo*cant\n end\n (sum*100)/grtotal\n end", "def initialize(nombre,ingredientes)\r\n @nombre = nombre\r\n @ingredientes = ingredientes;\r\n @grTotal = 0;\r\n @grProteinas = 0;\r\n @grCarbohidratos = 0;\r\n @grLipidos = 0;\r\n\r\n @ingredientes.each{|a|\r\n @grTotal = @grTotal + a.nPorciones*100.0\r\n @grProteinas = @grProteinas + a.proteinas\r\n @grCarbohidratos = @grCarbohidratos + a.carbohidratos\r\n @grLipidos = @grLipidos + a.lipidos\r\n }\r\n end", "def total_cost\n ingredients_cost + components_cost\n end", "def ponderado(pesos)\n @promedio = @p.zip(pesos).inject(0) do |suma, coordenada, peso| {suma+coordenada*peso }\n end\nend", "def addComponents components\r\n\t\t\r\n\t\t\tif components.is_a? IncrementalValue\r\n\t\t\t\tcomponents = components.get_value self\r\n\t\t\tend\r\n\t\t\r\n\t\t\tcomponents.each do |x|\r\n\t\t\t\t@component.addItem x\r\n\t\t\tend\r\n\t\t\r\n\t\tend", "def create\n @produto_pedido = ProdutoPedido.new(produto_pedido_params)\n @produto_pedido.valor_unitario = Produto.find_by(nome: params[:produto_pedido][:nome]).preco\n @produto_pedido.valor_total = @produto_pedido.valor_unitario * Integer(params[:produto_pedido][:quantidade])\n\n respond_to do |format|\n if @produto_pedido.save\n @pedido.quantidade_itens += @produto_pedido.quantidade\n @pedido.valor_pedido += @produto_pedido.valor_total\n @pedido.save\n format.html { redirect_to @pedido, notice: 'Produto pedido was successfully created.' }\n format.json { render :show, status: :created, location: @pedido }\n else\n format.html { render :new }\n format.json { render json: @produto_pedido.errors, status: :unprocessable_entity }\n end\n end\n end", "def product_count\n self.items.inject(0) {|sum, item| sum + item.quantity}\n end", "def tas_poser_1_carte joueur\n # Examine tous les tas déjà posés un par un\n self.ta12s.each do |tas|\n # Abandonne l'examen des différents tas quand plus qu'une carte\n break if joueur.cartes.size == 1\n # Evite de compléter la tierce franche lors de la 1° pose\n unless joueur.a_atteint_51?\n next if tas.nom_joueur == joueur.nom + \"_tf\"\n end\n # Regarde si on peut ajouter une carte au tas\n joueur.cartes.each do |carte|\n # Regarde si la carte peut aller sur le tas\n if tas.complete_le_tas? carte\n type = tas.combinaison.type\n # Pose la carte\n self.traces << \" tas <= #{tas.to_s} + [ #{carte.to_s} ]\"\n poser_sur_tas joueur, tas, carte\n # On ne peut plus compléter le tas si c'est une série de plus de 3 cartes\n break if tas.cartes.size > 3\n # on ne peut plus compléter le tas si ce n'est pas une série\n break if type != :serie\n end\n end\n end\n end", "def mostrar_partidos\n \n puts \" \"\n puts \"Quantidade de votos por partido\"\n \n for partido in @partido\n partido.mostrar_dados \n end\n end", "def total_quantity\n total = 0.0\n self.quantities.each do |quantity|\n total = total + quantity.number\n end\n total\n end", "def totalValueProducts(quantity)\n total = self.products.map {|product| product.getValue(quantity)}.reduce(:+)\n return total\n end", "def cartas_por_pinta\n @pintas = []\n @pintas = @mi_mano.group_by{|k, v| v[:pinta]}.map{|k, v| [k, v.count]}\n end", "def component_stock\n stock_levels = []\n product_sets.each do |ps|\n # If any component's stock is below the required quantity, we can impossibly\n # put together this product, so stock becomes immediately 0 as soon as we\n # hit one of these combinations.\n if ps.quantity > ps.component.stock\n stock_levels = [0]\n break \n else\n # Since we are computing stock from integers, we will always receive the maximum\n # number of constructable products per component from the division.\n # Just as if we had used this more explicit calcluation:\n # (ps.component.stock.to_f / ps.quantity.to_f).floor\n stock_levels << (ps.component.stock.to_i / ps.quantity.to_i)\n end\n end\n return stock_levels.min\n end", "def count(products) #este nome pode ser o que nós quisermos porque só está dentro do método\n products.count\nend", "def calculate_total(ingredients, property, count_1, count_2, count_3, count_4)\n ingredients[0][property] * count_1 + ingredients[1][property] * count_2 +\n ingredients[2][property] * count_3 + ingredients[3][property] * count_4\nend", "def vct\n grtotal = 0\n sum = 0\n\t\t#recorre las dos listas a la vez para sacar el valor\n\t\t#nutricional de cada ingrediente segun el peso de este\n @lista.zip(@listagr).each do |normal, gr|\n cant = gr/1000.0\n sum += normal.val_en*cant\n end\n sum\n end", "def parts_cost\n asset_event_asset_subsystems.map(&:parts_cost).compact.reduce(0, :+)\n end", "def components\n arr = Arrays.new(@nb) { [] }\n (0...@component.size).each { |v| arr[@component[v]] << v }\n end", "def components\n arr = Arrays.new(@nb) { [] }\n (0...@component.size).each { |v| arr[@component[v]] << v }\n end", "def atribuirValor\n\t\t@@compras.each do |produto|\n\t\t\ti = @@compras.index(produto)\n\t\t\tcase produto\n\t\t\t\twhen \"par de meias\"\n\t\t\t\t\t@@compras[i] = 11.99\n\t\t\t\twhen \"camiseta\"\n\t\t\t\t\t@@compras[i] = 29.99\n\t\t\t\twhen \"chinelo\"\n\t\t\t\t\t@@compras[i] = 24.99\n\t\t\t\telse\n\t\t\t\t\tthrow \"Produto não consta.\"\n\t\t\tend\n\t\tend\n\tend", "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 suma_valores\n resultados = {}\n self.totales = {}\n self.totales_por_comprobante = {}\n\n # revisa todas las monedas\n EmpCuentab.monedas.each do |moneda, id_moneda|\n resultados[moneda] = {\n valor: 0.0,\n descuento: 0.0,\n desc_general: 0.0,\n subtotal: 0.0,\n iva: 0.0,\n ieps: 0.0,\n total: 0.0,\n }\n \n com_det_compra.where(moneda: moneda).each do |cdc|\n valor = cdc.precio * cdc.cantidad\n desc_cdc = valor * (cdc.descuento / 100)\n subtotal_temp = valor - desc_cdc\n desc_gral = subtotal_temp * (descuento / 100)\n subtotal = valor - desc_cdc - desc_gral\n iva = subtotal * (cdc.iva / 100)\n ieps = subtotal * (cdc.ieps / 100)\n total = subtotal + iva + ieps\n\n resultados[moneda][:valor] += valor\n resultados[moneda][:descuento] += desc_cdc\n resultados[moneda][:desc_general] += desc_gral\n resultados[moneda][:subtotal] += subtotal\n resultados[moneda][:iva] += iva\n resultados[moneda][:ieps] += ieps\n resultados[moneda][:total] += total\n\n # actualiza totales\n totales[moneda] = 0.0 unless totales[moneda]\n totales[moneda] += total\n\n # actualiza totales por comprobante\n comprobante = cdc.comprobante ? cdc.comprobante : \"Sin comprobante\"\n tipo_comp = cdc.tipo_comprobante ? cdc.tipo_comprobante : nil\n # total, moneda, nombre del departamento, id del departamento, comprobante, tipo de comprobante\n totales_por_comprobante[comprobante] = [0.0, nil, nil, nil, nil] unless totales_por_comprobante[comprobante]\n totales_por_comprobante[comprobante][0] += total\n totales_por_comprobante[comprobante][1] = cdc.moneda\n totales_por_comprobante[comprobante][2] = cdc.emp_locacion.nombre\n totales_por_comprobante[comprobante][3] = cdc.emp_locacion.id\n totales_por_comprobante[comprobante][4] = comprobante\n totales_por_comprobante[comprobante][5] = tipo_comp\n end\n end\n\n resultados\n end", "def totalSimplificado\n @biblioteca.livrosComoLista.map(&:preco).inject(0){|total, preco| total += preco}\n end", "def initialize(nombre,ingredientes)\r\n super(nombre,ingredientes)\r\n @geiTotal=0\r\n @terrenoTotal=0\r\n\r\n @ingredientes.each{|a|\r\n @geiTotal = @geiTotal + a.gei\r\n @terrenoTotal = @terrenoTotal + a.terreno\r\n }\r\n end", "def emisiones\n grtotal = 0\n sum = 0\n\t\t#recorre las dos listas a la vez para sacar los gases emitidos\n\t\t# de cada ingrediente segun el peso de este\n @lista.zip(@listagr).each do |normal, gr|\n cant = gr/1000.0\n sum += normal.gases*cant\n end\n @gei = sum\n\n end", "def total_quantity\n category_quantity = 0 \n self.products.each do |product|\n category_quantity += product.quantity\n end\n category_quantity\n end", "def valor_energetico\n (@proteinas * 4) + (@glucidos * 4) + (@grasas * 9)\n end", "def total_products\n self.carts.sum(:quantity)\n end", "def pricing_quantity_and_unit\n product_property = unit_pricing_property\n return nil if product_property.nil? || product_property.value.nil?\n unit = product_property.property.measurement_unit\n quantity = product_property.value_f * unit.factor\n [quantity, unit.pricing_base]\n end", "def items_count\n counter = 0\n self.line_items.each do |item|\n if item.sellable && item.sellable.respond_to?(:quantity)\n counter += item.sellable.quantity\n else\n counter += 1\n end\n end\n counter\n end", "def cant_productos(opcion)\n lines = read()\n\n if opcion == \"a\"\n lines.each do |x|\n arr = x.split(\" \")\n existencia = arr[3].to_i + arr[2].to_i + arr[1].to_i\n puts \"#{arr[0]} hay #{existencia} productos\"\n end\n elsif opcion == \"b\"\n tienda1 = 0\n tienda2 = 0\n tienda3 = 0\n lines.each do |x|\n arr = x.split(\" \")\n tienda1 += arr[1].to_i\n tienda2 += arr[2].to_i\n tienda3 += arr[3].to_i\n end\n puts \"tienda 1 hay un total de #{tienda1} productos\\ntienda 2 hay un total de #{tienda2} productos\\ntienda 3 hay un total de #{tienda3} productos\\n\"\n elsif opcion == \"c\"\n total = 0\n lines.each do |x|\n arr = x.split(\" \")\n total += (arr[1].to_i + arr[2].to_i + arr[3].to_i)\n end\n puts \"en total hay #{total} productos en todas las tiendas\"\n end\nend", "def procesar_posible_pago(jugadalot, entrada)\n entrada = entrada[1..(entrada.size-1)] # \".250 => 250\" ok sacar monto apostado ok.\n apostado = entrada.to_f\n \n jugadas = Jugadalot.where(:ticket_id => jugadalot) || []\n \n if (jugadas == []) # esto es posible en rails probado ok. Si no hay jugadas returnal nil para que envie mensaje de realizar jugadas primero ok ted. Ver la logica del progrma que invoca esta funcion ok.\n return nil \n\n else\n #Hay jugadas para procesar la formula del parlay de posible pago ok:\\\n #ganancia = apostado * [coeficiente_jugada_parley_1] * [coeficiente_jugada_parley_2] * [coeficiente_jugada_parley_n] - apostado\n coeficiente_jugada_parley = []\n \n jugadas.each do |jugada|\n b = jugada.ml.to_s\n if( b[0] == \"-\" )# < 0 # -125 mando gavela macho, -110, -170\n coeficiente = (1.to_f + (100.to_f / b.to_f.abs)).to_f.round(4) # trabajar a 4 cifras decimales.\n else\n coeficiente = (1.to_f + ((b.to_f.abs) / 100.to_f)).to_f.round(4) # trabajar a 4 cifras decimales.\n end\n #puts coeficiente\n #debugger\n coeficiente_jugada_parley << coeficiente.to_f.round(4)\n end\n\n #multiplicar los elementos del array para obtener el coeficiente resultante\n #setear algunos casting primero, de string a int para multiplicar con inject\n #coeficiente_jugada_parley.map!(&:to_f) #inject(:*).round(4)\n # coeficiente_resultante = coeficiente_jugada_parley.inject(:*).round(4) # multiplica todos los elementos del array #sacado link:https://stackoverflow.com/questions/7050869/ruby-multiply-all-elements-of-an-array \n \n \n resultante_multiplicar = 1.to_f # 1 es el elemento neutro de la multiplicacion ok ted.\n \n coeficiente_jugada_parley.each do |coeficiente|\n resultante_multiplicar = (resultante_multiplicar.to_f * coeficiente.to_f.round(4)).round(4)\n end\n \n coeficiente_resultante = resultante_multiplicar.to_f.round(4)\n\n ganacia = ( (apostado.to_f * coeficiente_resultante.to_f) - apostado.to_f).to_i\n #ganacia = 18\n acobrar = (apostado + ganacia).to_i\n #lo de abajo comentado es para debug only ok. ted.\n #return apostado, \"#{ganacia}, ticketid:#{jugadalot}, ticketlines: #{jugadas.all.count}, apostado:#{apostado}, coeficiente:#{coeficiente_resultante}, aray:#{coeficiente_jugada_parley.join(\"|\")}, jugadas: #{jugadas.all.count}\", acobrar\n return apostado.to_i, ganacia, acobrar\n\n end # fin del if else end block ok\n \n\n end", "def crea(a)\n procs=[]\n a.each do\n |riga|\n (at,mt,et,sflo,sfhi,mf,ne,metro,nr)=riga\n delta=60.0/metro\n #brevettato\n 1.upto(nr) do\n procs << Processo.new(at,mt,et,sflo,sfhi,mf,ne)\n at += delta \n mt += delta\n et += delta\n #brevettato fino a qui\n end\n end\n procs\n end", "def total_value\n category_value = 0 \n self.products.each do |product|\n category_value += (product.price * product.quantity)\n end\n category_value\n end", "def get_qtd_notas(reais, array_com_notas:nil)\n qtde_notas = {\n '100': 0,\n '50': 0,\n '20': 0,\n '10': 0,\n '5': 0,\n '2': 0,\n '1': 0,\n '0.5': 0,\n '0.25': 0,\n '0.1': 0,\n '0.01': 0\n }\n if array_com_notas.nil?\n array_com_notas=qtde_notas\n end\n return calcular_qtde_notas(reais, array_com_notas);\n end", "def get_energia\n\t\t\t\t@lipidos * 9 + @proteins * 4 + @carbs * 4\n\t\t\tend", "def create\n produto_pedido = ProdutoPedido.new(produto_pedido_params)\n if produto_pedido.save\n \n @pedido = produto_pedido.pedido\n @produto_pedido = ProdutoPedido.new(pedido: @pedido)\n @total = 0.0\n @pedido.produto_pedidos.each { |pp| @total += pp.produto.preco*pp.quantidade }\n render 'create.js'\n else\n render 'create.js'\n end\n end", "def ahorrodinero(año)\n\n i = 0\n final = Array.new \n final1 = Array.new \n final2 = Array.new \n \n\n datos = Valore.where(:año => año)\n \n datos.each do |datos|\n \n \n final[i] = datos.read_attribute(\"es\")\n final1[i] = datos.read_attribute(\"tarifa\")\n final2[i] = final1[i]*final[i]\n \n i = i +1\n \n \n end\n \n return final2\n\n\n\n end", "def calculo_valor_energetico\n\t\t\t(@carbohidratos*4) + (@lipidos*9) + (@proteinas*4)\n\t\tend", "def supp_quantity \n\n supp_quantity = 0.0\n \n self.receptions.each do |mr|\n supp_quantity += mr.quantity ? mr.quantity : 0.0 # en caso de que no se haya definido el quantity\n end\n\n return supp_quantity\n\n end", "def valor\n\t\t@valor = 0\n\t\tself.parts.each do |p|\n\t\t\t@valor += p.valor\n\t\tend\n\t\t@valor\n\tend", "def product_cost\n product_with_unit_cost + product_without_unit_cost\n end", "def bought_products\n order_details.sum(:quantity)\n end", "def proteinas\n\t\treturn @proteinas*@cantidad\n\tend", "def excede_control_de_pago_global()\n @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global = 0 # inicializacionn de variable sumatoria en cero ok\n #La idea aqui es verificar si la sumatoria de posible pago de todas las jugadas de todos los tipos de tickets activos de hoy no excede el limite globar de riesgo del sistema ok\n \n #limite GLOBAL = 1 ADMINISTRATIVO OK Y TIPOJUGADA TAMBIEN MANUAL = GLOBAL OK TED. POPULATE IT IN DATABASE PRODUCTION OK:\n control_monto_max_pago_global = Controldepagogt.where(:tipojugada => \"global\" ).first.limiteglobal.to_i || 1 # setear un valor default ok \n\n t_ids = Ticket.today.where(:activo => \"si\").ids # todos los ticket actio de hoy con ese parlay ok\n \n @listado_sumatoria_posible_pago = Jugadalot.where(:ticket_id => t_ids)# postrges casting erro string ok .sum(:posiblepago).to_i\n \n if not @listado_sumatoria_posible_pago.nil?\n @listado_sumatoria_posible_pago.each do |jugada|\n @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global += jugada.posiblepago.to_i\n end\n \n end\n \n \n #Sumar posible pago de esas jugadas de cada ticket parlay ok.\n# @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global = 0\n# t.each do |ticket|\n# @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global += Jugadalot.where(:ticket_id => ticket.id).last.posiblepago.to_i\n# end\n\n if @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global.to_i <= control_monto_max_pago_global.to_i\n # si es menor todo ok\n false # no excede\n else\n true #si excede \n end\n\n\n end", "def precio_total_comprar\n precio_compra = @coste + ((@num_casas + @num_hoteles) * @titulo.precio_edificar).to_i\n \n return precio_compra\n end", "def items_count\n counter = 0\n self.line_items.each do |item|\n if item.sellable && item.sellable.respond_to?(:quantity)\n counter += item.sellable.quantity\n else\n counter += 1\n end\n end\n counter\n end", "def total_price\n res = product.price * count\n if product_options.any?\n res = res + product_options.map { |po| po.price }.sum * count\n end\n res\n end", "def products\n @products ||= begin\n items = []\n\n for i in (1..params[\"NumItens\"].to_i)\n items << {\n :id => params[\"ProdID_#{i}\"],\n :description => params[\"ProdDescricao_#{i}\"],\n :quantity => params[\"ProdQuantidade_#{i}\"].to_i,\n :price => to_price(params[\"ProdValor_#{i}\"]),\n :shipping => to_price(params[\"ProdFrete_#{i}\"]),\n :fees => to_price(params[\"ProdExtras_#{i}\"])\n }\n end\n\n items\n end\n end", "def calculate_amount_coupon\n sales_id = params[:sale_id_coupon]\n products_ids = params[:info_product_id]\n products_quantity = params[:info_product_quantity]\n products_end_var = Hash.new(\"products\")\n products_new_sale = Hash.new(\"products to new sale\")\n products_coupon = Hash.new(\"products coupon\")\n count = 0\n sale_amount = 0\n limit_date = Date.today + 3.days\n @sale_old = Sale.where(id: sales_id.to_i)\n @sale_old.each do |s|\n @sale_old_id = s.id\n @sale_old_customer= s.customer_id\n end\n\n for i in 0..products_ids.length-1\n j=0\n begin\n j +=1\n products_end_var[products_ids[i]]=products_quantity[count]\n count +=1\n end until j > 0\n end\n\n products_end_var.each_with_index do |(key, value), index|\n if value.to_i >0\n products_coupon[key] = value\n else\n products_new_sale[key] = value\n end\n end\n respond_to do |format|\n #Se crea la nueva venta y los items\n unless products_new_sale.empty?\n @sale = Sale.new\n @sale.user_id = current_user.id\n @sale.discount = 0\n @sale.limit_date = limit_date.strftime('%F')\n @sale.save\n products_new_sale.each_with_index do |(key, value), index|\n id_product= key.to_i\n product = Product.where(id: id_product)\n product.each do |p|\n item = Item.where sale_id: sales_id.to_i, product_id: p.id\n item.each do |i|\n sale_amount += p.price * i.quantity\n @item_created = Item.create product_id: p.id, sale_id: @sale.id ,quantity: i.quantity\n end\n end\n end\n @sale.customer_id = @sale_old_customer\n @sale.amount = sale_amount\n @sale.total_amount = sale_amount\n @sale.save\n end\n\n #Se crea el coupon y los item_coupons\n unless products_coupon.empty?\n coupon_amount = 0\n @coupon = Coupon.new\n @coupon.amount = 1\n @coupon.save\n products_coupon.each_with_index do |(key, value), index|\n id_product= key.to_i\n value_product = value.to_i\n product = Product.where(id: id_product)\n product.each do |p|\n coupon_amount += p.price * value_product\n new_stock_product = p.stock + value_product\n p.update stock: new_stock_product\n item = Item.where sale_id: sales_id.to_i, product_id: p.id\n item.each do |i|\n if i.quantity == value_product\n @new_item_coupon = ItemCoupon.create sale_id: @sale_old_id, coupon_id: @coupon.id, quantity: value_product\n @new_item_coupon.save\n else\n new_item_quantity = i.quantity - value_product\n if new_item_quantity >= 0\n if @sale.nil?\n @sale = Sale.new\n @sale.user_id = current_user.id\n @sale.discount = 0\n @sale.limit_date = limit_date.strftime('%F')\n @sale.save\n end\n @item_created = Item.create product_id: p.id, sale_id: @sale.id ,quantity: new_item_quantity\n @new_item_coupon = ItemCoupon.create sale_id: @sale_old_id, coupon_id: @coupon.id , quantity: value_product\n @new_item_coupon.save\n @item_created.save\n sale_amount += p.price * new_item_quantity\n else\n unless @sale.nil?\n Sale.last.destroy\n end\n Coupon.last.destroy\n @coupon_create = \"no\"\n end\n end\n end\n end\n end\n @coupon.amount = coupon_amount\n @coupon.user_id = current_user.id\n @coupon.save\n unless @sale.nil?\n @sale.amount = sale_amount\n @sale.total_amount = sale_amount\n @sale.state = \"pago\"\n @sale.save\n end\n end\n if @coupon_create == \"no\"\n format.html { redirect_to coupons_url, alert: 'No se pudo realizar el cambio, la cantidad de productos a cambiar es inválida.' }\n format.json { head :no_content }\n elsif @sale.nil?\n #format.js { render :js => \"window.open('/coupons/generate_sale_pdf.pdf?param1=\"+@coupon.id+\"&param2=\"+@sale.id+\"&param3=\"+@sale_old_id+\"&param4=\"+@coupon.amount+\"'),'_blank',window.location.href='/coupons'\"}\n format.html{redirect_to url_for(:controller => :coupons,format: :pdf ,:action => :generate_pdf, :param1 => @coupon, :param2 => @sale, :param3 => @sale_old_id, :param4 => @coupon.amount)}\n @sale_old.each do |sale_old|\n sale_old.anulada!\n end\n else\n unless @coupon.nil?\n #format.js { render :js => \"window.open('/coupons/generate_sale_pdf.pdf?param1=\"+@coupon.id+\"&param2=\"+@sale.id+\"&param3=\"+@sale_old_id+\"&param4=\"+@coupon.amount+\"'),'_blank',window.location.href='/coupons'\"}\n format.html{redirect_to url_for(:controller => :coupons,format: :pdf ,:action => :generate_pdf, :param1 => @coupon, :param2 => @sale, :param3 => @sale_old_id, :param4 => @coupon.amount)}\n @sale_old.each do |sale_old|\n sale_old.anulada!\n end\n end\n format.html { redirect_to coupons_url, alert: 'No se pudo realizar el cambio, no hay productos seleccionados.' }\n end\n end\n end", "def quantity_product(type)\n self.items.includes(:dealing).where(\"dealings.type_deal\", type)\n # quantity_array = Product.find_by_sql(\"SELECT products.name SUM(quantity) FROM items \" +\n # \"JOIN products ON (items.product_id = products.id) \" +\n # \"JOIN dealings ON (items.dealing_id = dealings.id)\" +\n # \"WHERE dealings.type_deal = '#{type}' \" +\n # \"AND products.id = #{self.id};\")\n # puts \"!!!return from quantity_products self.id = #{self.id}\"\n # p quantity_array.first.sum\n # p quantity_array\n # quantity_array.first\n end", "def component_total_price(product)\n entries = product.component_entries\n return Price.zero if entries.empty?\n entries.map { |entry|\n final_price(entry.component) * entry.quantity\n }.sum\n end", "def calories(combo)\n combo.map.with_index do |teaspoons, i|\n teaspoons * @ingredients[i][4]\n end.reduce(:+)\n end", "def total_items\r\n\t\t@items.inject(0) { |sum, i| sum + i.quantity }\r\n\tend", "def create\n \n \n @orden_product = OrdenProduct.new(orden_product_params)\n \n @orden_product.orden_id = @orden.id \n \n @orden_product.avisodetail_id = 131\n @orden_product.price = (@orden_product.tarifa / 30 * @orden.tiempo )\n @company = Company.find(1)\n sum_dias = (@orden_product.d01 + @orden_product.d02 + @orden_product.d03 + @orden_product.d04+ \n @orden_product.d05 + @orden_product.d06 + @orden_product.d07 + @orden_product.d08+\n @orden_product.d09 + @orden_product.d10 + @orden_product.d11 + @orden_product.d12+\n @orden_product.d13 + @orden_product.d14 + @orden_product.d15 + @orden_product.d16+\n @orden_product.d17 + @orden_product.d18 + @orden_product.d19 + @orden_product.d20+\n @orden_product.d21 + @orden_product.d22 + @orden_product.d23 + @orden_product.d24+\n @orden_product.d25 + @orden_product.d26 + @orden_product.d27 + @orden_product.d28+\n @orden_product.d29 + @orden_product.d30 + @orden_product.d31)\n @orden_product.quantity = sum_dias \n @orden_product.total = @orden_product.price * sum_dias\n\n \n \n respond_to do |format|\n if @orden_product.save\n \n @orden[:subtotal] = @orden.get_subtotal(\"subtotal\")\n @orden[:tax] = @orden.get_subtotal(\"tax\")\n @orden[:total] = @orden[:subtotal] + @orden[:tax]\n \n @orden.update_attributes(:subtotal=> @orden[:subtotal])\n \n \n \n \n format.html { redirect_to @orden, notice: 'Orden product was successfully created.' }\n format.json { render :show, status: :created, location: @orden }\n \n else\n format.html { render :new }\n format.json { render json: @orden.errors, status: :unprocessable_entity }\n end\n end\n end", "def total_item_number\n @quantity * product.result_n\n end", "def sample_products_list(facturama)\n puts \"===== Obtener los productos - Inicio =====\"\n\n lst_products = facturama.products.list # Se obtiene una lista con todos los productos\n lst_products_count = lst_products.count # Cantidad inicial de productos\n\n puts \"Cantidad inicial de productos: \" + lst_products_count.to_s\n\n puts \"===== Obtener los productos - Fin =====\"\n end", "def totalProteina \n\t\tprot = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\tprot += alimento.proteinas\n\t\tend\n\t\treturn prot.round(2)\n\tend", "def ppptotal\n pppquantity + pppquality + pppontime + pppeffective + \n pppknowledge + ppprules + pppcommunication +\n pppleader + pppmanage + pppdiscipline + pppproactive + ppprelate + \n pppparttwo\n end", "def ppptotal\n pppquantity + pppquality + pppontime + pppeffective + \n pppknowledge + ppprules + pppcommunication +\n pppleader + pppmanage + pppdiscipline + pppproactive + ppprelate + \n pppparttwo\n end", "def set_importe_total\n self.importe_total = 0\n self.detalles.each do |detalle|\n self.importe_total += detalle.precio_unitario * detalle.cantidad unless detalle.marked_for_destruction?\n end\n end", "def por_carbohidratos\n \taux_carbohidratos = 0.0\n\t\ti = 1\n\t \twhile i < @lista_alimentos.size do\n\t\t\taux_carbohidratos += @lista_alimentos[i].carbohidratos * @lista_cantidades[i]\n\t\t\ti+=1\n\t\tend\n\t\treturn ((aux_carbohidratos/total_nutrientes)*100.0).round(2)\n\tend", "def products_aggregate\n quantities = GroupBoxContent.sum(:quantity,group: :product_id)\n quantities.delete_if {|key, value| value == 0 } \n\n products = Product.find(quantities.keys)\n @products_quantities = {}\n products.each do |product|\n @products_quantities[product] = quantities[product.id]\n end\n\n respond_to do |format|\n format.html # products_aggregate.html.erb\n format.json { render json: @groups }\n end\n end", "def get_comps_avg\n # p self.property.zillowId\n comps ||= Rubillow::PropertyDetails.deep_comps( {zpid: self.property.zillowId, count: 3} )\n # p comps.principal.zpid\n # p comps.comparables.size\n comp_list = []\n comps.comparables.each do |c|\n comp_list << (c.last.price.to_f/c.last.finished_square_feet.to_f)\n # p c.last.price\n # p \"-\" + c.last.finished_square_feet\n end unless !comps.success?\n #take the sum of\n self.comp_avg_per_sq_ft = comp_list.inject{ |sum, el| sum + el }.to_f / comp_list.size\n # p self.comp_avg_per_sq_ft.to_f\n end", "def valor_energetico\n @proteinas * 4.0 + @carbohidratos * 4.0 + @lipidos * 9.0\n end", "def total_per_component(&block)\n @scms.sort.each do | name, linehash |\n output name, 0, linehash.values.sum, &block\n end\n end", "def total_per_big_component(&block)\n @scms.sort.each do | name, linehash |\n size = linehash.values.sum\n output name, 0, size, &block if !size.nil? and size > 20000\n end\n end", "def summary\n @project = Project.find(params[:id])\n procs=Array.new #empty array for the total number of procs for the project\n @totsize=0\n @totprice=0\n @totequip=(Basket.find_all_by_project_id(@project)).count #total equipment belonging to a project\n \n @project.baskets.each do |b| \n if not procs.include?(b.procedurex_id) #if the procedure array does not include the basket's procedure\n procs.push(b.procedurex_id) #add the basket procedure_id to the array\n end\n if not b.equipment.price.nil? #if the basket equipment price is not nil\n @totprice=@totprice+(b.equipment.price*b.quantity) #add the price X quantity to the total price\n end\n if (not b.equipment.width.nil?) and (not b.equipment.depth.nil?) #if width and depth are not nil\n @totsize=@totsize+ (b.equipment.width*b.equipment.depth*b.quantity) #calculate surface area, multiply by quantity and add to total\n end \n end\n \n @totprocs=procs.count #total procedures for this project\n \n #if you wish to display all the procedures for the project, use the array of ids in procs to access them\n \n @totprice=sprintf \"%.02f\", @totprice.round(2) #round to 2 decimal places for currency\n \n respond_to do |format|\n format.html # summary.html.erb\n format.json { render json: @project }\n end\n end" ]
[ "0.6829691", "0.65202075", "0.63435733", "0.63397264", "0.6316852", "0.6309619", "0.6217147", "0.61361855", "0.6131325", "0.6002625", "0.60023963", "0.59801996", "0.59752125", "0.597436", "0.59686685", "0.59464395", "0.5934944", "0.5916231", "0.5909422", "0.5890826", "0.58889276", "0.58368105", "0.5821733", "0.5819577", "0.5805915", "0.5802091", "0.57945526", "0.57929885", "0.5783571", "0.5775082", "0.5760966", "0.5752648", "0.57434446", "0.57377416", "0.573589", "0.573339", "0.5731532", "0.57144016", "0.57127225", "0.57057035", "0.57025784", "0.56912905", "0.56895036", "0.56839806", "0.5681527", "0.5680863", "0.5664438", "0.5648406", "0.56288004", "0.56268406", "0.56268406", "0.5624883", "0.56200594", "0.56127936", "0.55962014", "0.55913335", "0.55910826", "0.5588541", "0.5580581", "0.555949", "0.55591786", "0.55445206", "0.5542729", "0.5534716", "0.55334103", "0.55312", "0.55099005", "0.5501626", "0.5500285", "0.549904", "0.5495428", "0.54803485", "0.5479814", "0.54796004", "0.5479373", "0.54656327", "0.5457824", "0.54436356", "0.54389554", "0.54379135", "0.54368377", "0.54300284", "0.5428065", "0.5427814", "0.5426532", "0.5424682", "0.5410434", "0.5406631", "0.5404774", "0.54026467", "0.5400527", "0.5400527", "0.5399322", "0.5396314", "0.5395144", "0.53950894", "0.5379898", "0.53771436", "0.53718287", "0.5371763" ]
0.7346988
0
parameters has been used
def address_params params.permit(:company, :address) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def param; end", "def param; end", "def get_parameters; end", "def get_parameters; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def parameters=(_arg0); end", "def parameters=(_); end", "def check_params; true; end", "def available_parameters( params, runs )\n @runs = runs\n\n Maadi::post_message(:More, \"Organizer (#{@type}) Parameters are ready\")\n return true\n end", "def variables; end", "def variables; end", "def params=(_arg0); end", "def params=(_arg0); end", "def params=(_); end", "def check_parameters\n update_param_version_ar()\n @param_version_db = @bot_dbaccess.read_parameter_with_default('PARAM_VERSION', 0)\n compare_and_write_parameters()\n end", "def accumulator_param_assigned_to?(body, args); end", "def parameters\n nil\n end", "def params=(value); end", "def arguments; end", "def arguments; end", "def arguments; end", "def unsolved_params\n \n end", "def uses_par?(parameter); @params.values.include?(parameter); end", "def passed?; end", "def passed?; end", "def passed?; end", "def parse_parameters; end", "def cnt; xparam(6); end", "def passes; end", "def passes; end", "def used?; end", "def atk; param(2); end", "def check_parameters\n\n # read the parameter version in the database and in the device \n read_parameter_from_device(0)\n @params.each do |p|\n if p['id'] == 0\n @param_version_ar = p['value_ar']\n end\n end\n\n @param_version_db = @bot_dbaccess.read_parameter_with_default('PARAM_VERSION', 0)\n\n # if the parameters in the device is different from the database parameter version\n # read and compare each parameter and write to device is different\n if @param_version_db != @param_version_ar\n load_param_values_non_arduino()\n differences_found_total = false\n @params.each do |p|\n if p['id'] > 0\n difference = check_and_write_parameter(p)\n if difference then\n @params_in_sync = false\n differences_found_total = true\n end\n end\n end\n if !differences_found_total\n @params_in_sync = true\n write_parameter_to_device(0, @param_version_db)\n else\n @params_in_sync = false\n end\n end\n end", "def agi; param(6); end", "def request_parameters; end", "def parameters\n @parameters\n end", "def probers=(_arg0); end", "def parameters\n @parameters ||= {}\n end", "def parameters\n @parameters ||= {}\n end", "def parameter_rule?; end", "def used_names=(_arg0); end", "def has_param?(name)\n\n end", "def valid_params?; end", "def get_parameters\r\n @parameters\r\n end", "def all_params; end", "def filter_parameters; end", "def filter_parameters; end", "def filtered_parameters; end", "def profile_parameter=(_arg0); end", "def filter_parameters=(_arg0); end", "def filter_parameters=(_arg0); end", "def parameters\n @parameters || []\n end", "def validate_params\n\n categories.each() do |key, value|\n throw RuntimeError.new(\"ERROR: category '#{key}' contains more than #{maximum_numbers_per_category} parameters. Reduce parameter count.\") if value.size >maximum_numbers_per_category\n end\n\n keys=[]\n numbers=[]\n # slicer contains parameter with number 0... therefore valid parameter numbers starts at 0\n valid_param_numbers=SetupConfiguration.parameter_range()\n\n self.parameters().each() do |p|\n\n $stderr.puts \"WARNING: parameter number 404 is reserved for machine type. you are using it for '#{p.key}'.\" if p.number.eql?(404)\n throw RuntimeError.new(\"ERROR: parameter number '#{p.number}' not supported. Number must be in range #{valid_param_numbers}.\") unless valid_param_numbers.member?(p.number)\n\n if p.param?\n if keys.include? p.key\n raise RuntimeError.new(\"ERROR: parameter key '#{p.key}' defined more than once\")\n else\n keys << p.key\n end\n\n\n if numbers.include? p.number\n raise RuntimeError.new(\"ERROR: parameter number '#{p.number}' defined more than once\")\n else\n numbers << p.number\n end\n else\n assign_param_ref(p)\n end#p.param?\n\n end\n #force fresh sort of parameters\n @parameters = nil\n end", "def probers; end", "def num_parameters\n @parameters.size\n end", "def valid_params_request?; end", "def update_params\n raise 'Sovrascrivi in figli'\n end", "def do_something(par_1, par_2, par_3)\n\n\nend", "def params(*); {}; end", "def check_params\n true\n end", "def example_passed(example)\n end", "def set_caller_params\n end", "def change(params); end", "def parameter!\n @parameter = true\n self\n end", "def check_parameter_occurrence\n if (@repository.parameters[:section])\n check_occurrence(:section, :coord)\n end\n end", "def do_something parameter1, parameter2, parameter3\nend", "def check_params\n self.number = \"#{get_next_number}/#{Time.now.year}\"\n self.status = 2\n end", "def query_parameters; end", "def calls; end", "def calls; end", "def validate_parameters?(op)\n temp_params = op.temporary[:plan_params]\n errors_noted = \"The following parameters for plan #{op.plan.id} have errors: \"\n er = false\n if temp_params[:fluorescent_marker]\n errors_noted.concat(\"dark_light invalid\") && er = true if !static_params[:dark_light_options].include? temp_params[:dark_light]\n errors_noted.concat(\"marker_type not supported\") && er = true if !static_params[:marker_type_options].include? temp_params[:marker_type]\n end\n op.error :invalid_parameters, errors_noted if er\n op.temporary[:valid_params?] = !er\n end", "def inputParameters paramsnum \n\n\n #input parameters \n\t\n\n \t\n #input must not have limit info\n puts \"has (must not have type) limit? please input 0 or 1(0 means no limit,1 means has limit)\"\n haslimit = gets\n if haslimit.to_i == 1\n @haslimit = true\n puts \"please input the group num of limitValue\"\n gnum = gets\n inputMustNotHaveLimitValues gnum.to_i\n else\n @haslimit = false\n end\n\n\n #input must have limit info\n=begin puts \"has (must have type) limit? please input 0 or 1(0 means no limit,1 means has limit)\"\n musthavelimit = gets\n if musthavelimit.to_i == 1\n @musthavelimit = true\n puts \"please input the group num of limitValue\"\n gnum = gets\n inputMustHaveLimitValues gnum.to_i\n else\n @musthavelimit = false\n end\n=end\n \n\n end", "def query_parameters\n end", "def ctr; sparam(3); end", "def parameter_types; end", "def update!(**args)\n @parameter = args[:parameter] if args.key?(:parameter)\n end", "def update!(**args)\n @parameter = args[:parameter] if args.key?(:parameter)\n end" ]
[ "0.7270058", "0.7270058", "0.7270058", "0.7270058", "0.7270058", "0.7270058", "0.7270058", "0.7270058", "0.6769667", "0.6769667", "0.6641361", "0.6641361", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.65773", "0.65308046", "0.64799273", "0.6441245", "0.61356723", "0.61356723", "0.61143696", "0.61143696", "0.609069", "0.60856277", "0.6038861", "0.6010702", "0.60057074", "0.60026217", "0.60026217", "0.60026217", "0.60004586", "0.59989226", "0.59737945", "0.59737945", "0.59737945", "0.5965894", "0.5949674", "0.59441775", "0.59441775", "0.5922258", "0.5908737", "0.5860894", "0.5850806", "0.5805251", "0.5795622", "0.5794641", "0.5766511", "0.5766511", "0.5761393", "0.57560384", "0.5748846", "0.57455766", "0.5734142", "0.5726977", "0.5710955", "0.5710955", "0.56804043", "0.5659461", "0.563956", "0.563956", "0.5638462", "0.5636695", "0.5636477", "0.563152", "0.5631333", "0.56151944", "0.5603686", "0.5603677", "0.55812687", "0.5575089", "0.5572936", "0.55691254", "0.5552847", "0.55418795", "0.554069", "0.5537516", "0.5534784", "0.5533337", "0.5533337", "0.55287725", "0.5488109", "0.54828095", "0.54798937", "0.54744345", "0.54732865", "0.54732865" ]
0.0
-1
the credentials.json file that Firebase provides has newlines embedded in the private_key value these need to become real newlines in the database
def replace_newlines(s) (s || "").gsub('\n', "\n") # single quoted strings in Ruby are literals, double quoted are escaped end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private_key; end", "def private_key; end", "def key_pem; end", "def encode_secrets(data)\n data[:credentials] = Base64.encode64(data[:credentials]) if data[:credentials]\n data['credentials'] = Base64.encode64(data['credentials']) if data['credentials']\n data\n end", "def private_key\n\t '-----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,3D37CD3A313CADA2 7c1TAxzv6Gn2OmZzVNtEnU9lqrEwRL65huGc9ewQQ7senY3rkBgIqBzqVarAfS0I 6OMimI57q7XywAiFn7CZ+L7fbXdNuvmGx5JDNRwylgGWR+hPi9JMKEAP1yjdJPRS 608pDXIliz5bO0GdvufQxQ91MPjE4Bs5AT8TIE3bzuFllBYJD/mLpkK4bOjLHswI 7W7afVctpYaRAwzb64Z+gUQZL0BIcQzG2wYvFU3vAs5sCtEy9o7riY/bBi78EEH6 go01DkgYLt8M7ApTwblJNJR0G/8bwy3oDgdieM42sFLzftxwjeBhIiF1ExH+KuYA ftAcROOfr8rduvNNc6jJcx2lyze+4joPjHDBXZr27bg3o3SwOQCIXUHe0DHG0PHn TbZkL2btHH36mTMq0j6P9R4t1wLhJ8Pq2LjLDwLhXw3Tb8aIX1tpShxyy9Yv8F84 Q6dfBLe4yqmvW1Db2nGmZ++gPua2OGWuNXwjivt2XrZ0fGAGri5j9bsqyvDsHwUS aRs8PaG97rgmyRGHYUoicBdgeFZhBHSLlU5F6RNUTOgK9QAHP4+bdKbMQxvhveh8 +v9o7Xa7BlqEvUYXIfBwEbHZoJx4t90XSndSS3chlfoEb6vcxOBmplUZlWs55aSL U7dW1MaE48Afav6TtM2VsN9RzwU8QSplpm7z9C9xkYVBMN6UcKIbnHH1yXdhTGEG uaEvPrtSh+BroAx1OmMjkmb0s1PjgDqLEtaYifP1OXgSS3uTqPBcpgUZDnuYQZmW Ihv7SvGdyWVQUgpv5LukyZPhXdlsCQ+8TlEYn4MOl87uxqo3KCVzVdmhAx2PWS/q wLcyOq0wJuvgAAtmI4/EnXVaP5P6WQ7rixfxdDfR1nI5TnDQkgs2xquyb0cms0J+ hXkIGvQOMAzq2Js3Ad7qyiklDASR20zZt6JPKTgZpLq682Fx+LJCCryAqjye2nAI 0w5SHEd80J/lAUEYo/HrNDBWS0JzD4lfERwUxgXxvynFI1ak38h0YP9RR2ka0pMI DJ8G6/w3Ir1qgLM/E+bTvp1YE683J/j1+vdYC/eoAbki2wgJAitYFdexLpw/qMvj xonY4iyhVkgzQb0GObesjPhr0CQ1gRC8p/A68Pk4cXejKTO95gUnD682Mu6lgYXQ e3rEnNVUruiPEzMKbkPLIsaWfUKfGRb0okQmuISXEfjyLfjkUgD6bxes+9KuHdvj pZze3dOgB1W6ZGsbrQ8ooXAOewYbhDcEqVsPOItVBoZ14CmCSd1X8RiW1dnfZBLa 5W8L7HaVLgiKUWlu2N6BE3etMK/fzhLh1K8WT6PxqzqVfJZZ9TYwVSYbcJuej0Hf ioHwYgqO22aZrp+ciJplCyOooFOKVVW45iLPtSHX64aE6FKbdPEPcndIOl0J9ah0 Hwicaw0ADP4STb83NysAZdHO2UVNEERkp2P4XmgeeH3gYHhPv3xCbbDejrrRJjeq VRer8i6HxiuJ/SxNKvbiwztF/44nWJ+9m2FoNqumTITdQAx7VU3681uEsO9ZbsJU Lbt0zwxna4X6WEtjdy5ExqLlU+wnzWgG+I11vgXSarye2oTuGPK8wjBkfEqdRTxs -----END RSA PRIVATE KEY----- '\n\tend", "def public_key\n # Base64 encode without line feeds\n Base64.strict_encode64(public_key_raw)\n end", "def create_client_secret_file\n File.exist?(KEY_FILE.to_s) && File.delete(KEY_FILE.to_s)\n File.open(KEY_FILE.to_s, 'w') do |f|\n f.write(CLIENT_SECRET.to_json.gsub('\\\\\\\\', '\\\\'))\n end\n end", "def read_encrypted_secrets; end", "def read_encrypted_secrets; end", "def public_key_string\n [@public_key.to_s].pack(\"m*\").gsub(\"\\n\", \"\")\n end", "def private_key_string(privatekey)\n private_key_names=[\"primesinverses\",\"d_set\", \"primes\"]\n private_key_string=\"privatekey=[\"\n for i in 0..privatekey.length-1\n private_key_string << private_key_names[i]+\"=[\"\n for x in 0..privatekey[i].length-1\n private_key_string << privatekey[i][x].to_s+\",\"\n end\n private_key_string << \"],\\n\"\n end\n private_key_string << \"]\"\n private_key_string\n end", "def write_user_credentials(username, password)\n File.open(credentials_path, 'a') do |users|\n users.write(Psych.dump(\"#{username}\": encrypt_password(password)))\n end\n clean_yaml\nend", "def private_key=(private_key); end", "def privatize(txt)\n private_properties unless defined?(@private_props)\n @private_props.each{|v| txt.gsub!(v,\"-private-\") }\n txt.gsub!(decrypt_string_with_prefix(SS_integration_password_enc), \"-private-\") if defined?(SS_integration_password)\n txt\n end", "def to_json_value\n @cert.to_pem.gsub(/\\n/, \"\\\\n\")\n end", "def ssh_key_nice\n nice_key = \"\"\n ssh_key.split(\"\\n\").each do |key_slice|\n if key_slice.size < 20\n nice_key += key_slice + \"\\n\"\n else\n i = 0\n while i < key_slice.size\n nice_key += key_slice.slice(i..i+20) + \"\\n\"\n i += 21\n end\n end\n end \n return nice_key\n end", "def client_secret_privacy\n return nil if client_secret.nil?\n return \"*****\" if client_secret.length < 10\n \"*****#{client_secret.last(3)}\"\n end", "def create_secret_text(**args)\n\t\t\t\t\tjson_body = {\n\t\t\t\t\t\t'' => '3',\n\t\t\t\t\t\tcredentials: args.merge(\n\t\t\t\t\t\t\t'$class' => 'org.jenkinsci.plugins.plaincredentials.impl.StringCredentialsImpl'\n\t\t\t\t\t\t)\n\t\t\t\t\t}.to_json\n\t\t\t\t\tcreate_(\"json=#{::CGI.escape json_body}\")\n\t\t\t\tend", "def decode_credentials; end", "def public_key\n Base64.encode64(\"conversation_#{id}\").gsub(/(=|\\n)/, '') << id.to_s.last\n end", "def encoding\n Dotenv.load #Charge les cles depuis le .env#\n keys = \"#{ENV[\"Client_ID\"]}:#{ENV[\"Client_Secret\"]}\"\n key_encoded = Base64.strict_encode64(keys)\n key_encoded = \"Basic #{key_encoded}\"\n return key_encoded\nend", "def encrypt(data)\n return nil if !@key\n Base64::encode64(@key.private_encrypt(data)).delete(\"\\n\").strip\n end", "def get_secret_key\n secret_key = ''\n return '' unless File.file? SECRET_KEY_FILE\n open(SECRET_KEY_FILE) do |file|\n file.each do |line|\n if line.include? 'TKTAuthSecret'\n secret_key = line.gsub('TKTAuthSecret', '').strip.gsub(\"\\\"\", '')\n break\n end\n end\n end\n secret_key\n end", "def aws_credentials(access_key, secret_access_key)\n unless access_key.empty? || secret_access_key.empty?\n credentials = { access_key_id: access_key, secret_access_key: secret_access_key }\n File.write('../.credentials.yml', credentials.to_yaml)\n $preferences_window.destroy\n else \n Tk.messageBox('type' => 'ok',\n 'icon' => 'error',\n 'title' => 'Keys',\n 'message' => 'Access and secret keys must not be empty') \n end \n end", "def raw_key\n key = read['pem']\n raise \"There is no key for some reason for user @#{@login}\" if key.nil?\n key\n end", "def example2\n 'ca679660018162' \\\n 'eyJhbGciOiJIUzI1NiIsImtpZCI6IjE6ODE5MjpjYTY3OTY6QUFBQUFBQUFBQUFBIiw' \\\n 'idHlwIjoiSldUIn0.' \\\n 'eyJjb2RlIjoiZXhhbXBsZS5jb20iLCJmbGciOjk2LCJsZW4iOjEyLCJtc2siOiJfX19' \\\n 'fX19fX19fX19fX19fIiwidmVyIjoyfQ.' \\\n '7YhYmorl6qcKy2LeKfJDKrSi-d5r6c8VL8adJxNPfbY' \\\n 'example.com'\n end", "def get_keys\n access_key = USER_DATA[0].to_s.strip\n secret_access_key = USER_DATA[1].to_s.strip\n keys = { :access_key_id => access_key,\n :secret_access_key => secret_access_key}\nend", "def namespaced_keyed_filename\n full_path_to_credential_file\n end", "def handle_sync_key enc_key\n PRIVATE_KEY.private_decrypt enc_key\n end", "def read_credentials\n File.readlines(USERPASS_FILE).each do |line|\n user, pass = line.split\n pass = \"\" if pass == '(none)'\n @crends << [\"#{user}\", pass]\n end\n end", "def credentials_file\n dir['credentials']\n end", "def process_key_auth(options)\n if options[:google_json_key_location]\n json_key = File.read(File.expand_path(options[:google_json_key_location]))\n elsif options[:google_json_key_string]\n json_key = options[:google_json_key_string]\n end\n\n validate_json_credentials(json_key)\n\n ::Google::Auth::ServiceAccountCredentials.make_creds(\n :json_key_io => StringIO.new(json_key),\n :scope => options[:google_api_scope_url]\n )\n end", "def handle_auth data\n CERTIFICATE.to_pem\n end", "def password\n open(@credentials_file, 'r').readlines.last.strip if valid_file?(@credentials_file)\n end", "def read_encrypted_secrets=(_arg0); end", "def read_encrypted_secrets=(_arg0); end", "def credentials_show\n %x(cat ros/services/iam/tmp/#{Settings.platform.environment.partition_name}/postman/222_222_222-Admin_2.json)\n end", "def write_to_json(raw_input, create_filename)\n input_hash = raw_input.split(\"\\n\").map do |line|\n string = line.split(\" \")\n {\"required\" => string[0], \"character\" => string[1].gsub(':', ''), \"password\" => string[2]}\n end\n File.open(\"#{create_filename}\", \"w\") do |f| \n f.write(JSON.pretty_generate(input_hash))\n end\nend", "def decode_pass_word val\n Sequel.lit \"\\ncrypt(\\n?\\n, pswd_hash)\", val\n end", "def create_keys_files(config_data,external_private_key_path,internal_private_key_path,internal_public_key_path)\n if !File.exist?(external_private_key_path) and !File.exist?(internal_private_key_path)\n File.open(external_private_key_path, \"w\") do |f|\n config_data['keys']['external_private_key'].each { |element| f.puts(element) }\n end\n File.chmod(0600,external_private_key_path)\n File.open(internal_private_key_path, \"w\") do |f|\n config_data['keys']['internal_private_key'].each { |element| f.puts(element) }\n end\n File.chmod(0600,internal_private_key_path)\n end\n if !File.exist?(internal_public_key_path)\n shell_cmd = \"ssh-keygen -y -f #{internal_private_key_path}\"\n generated_key = %x[ #{shell_cmd} ]\n File.open(internal_public_key_path, \"w\") do |f|\n f.puts(generated_key)\n end\n end\nend", "def dot_key_values(hash)\n hash.map{|k,v| \n \"#{k}=\\\"#{ v.to_s.gsub(/\"/, \"''\" ).gsub(\"\\n\",' ') }\\\"\" \n }.join(', ') rescue \"boh1235: #{$!}\"\n end", "def keys\n JSON.parse get('/users/ssh_keys', :accept => 'json').to_s\n end", "def secret_key\n \"\"\n end", "def extract_login\n if self.valid\n key_pieces = self.key.split(\" \")\n self.login = key_pieces[2] if key_pieces.size == 3\n end\n self.save\n end", "def extra_fields_to_set\n {\n decrypted_secret_key: decrypted_secret_key\n }\n end", "def public_key; end", "def public_key; end", "def public_key; end", "def child_get_string_encrypted(name, key = nil)\n if (key == nil)\n key = DEFAULT_KEY\n end\n if (key.length != 16)\n abort(\"Invalid key, key length sholud be 16\")\n end\n value = child_get_string(name)\n value_array = value.lines.to_a\n plaintext = RC4(key, value_array.pack('H*'))\n plaintext\n end", "def keyfile(key)\n keyfile = Tempfile.new(\"ec2_private.key\")\n key_material = \"\"\n key.split(\"\\n\").each { |line| key_material+=\"#{line.strip}\\n\" if line.strip.size>0 }\n keyfile.write(key_material) && keyfile.close\n puts \"[*] Using #{keyfile.path} as private key\"\n keyfile.path\n end", "def user_to_private_keys(home, private_keys)\n private_keys.map do |filename, data|\n {\n 'fn' => \"#{home}/.ssh/#{filename}\",\n 'content' => data\n }\n end\nend", "def formatted_login\n [ZerigoDNS.config.user, ZerigoDNS.config.api_key].join(':')\n end", "def get_client_key_path\n File.open(client_key_path, 'w'){ |f| f.write(client_key) }\n client_key_path\n end", "def client_key\n tmp = Dir.mktmpdir\n path = File.join(tmp, \"client.pem\")\n File.open(path, \"wb\") { |f| f.write(ChefZero::PRIVATE_KEY) }\n at_exit { FileUtils.rm_rf(tmp) }\n path\n end", "def passphrase\n Digistore24.configuration.passphrase\n end", "def output_key(key)\n STDOUT.write \"# Private key (d, n): #{'%X' % key.d} #{'%X' % key.n}\\n\"\n STDOUT.write \"key #{'%X' % key.e} #{'%X' % key.n}\\n\"\nend", "def secret_key; end", "def secret_key\n credentials['secret_key']\n end", "def secret_key\n credentials['secret_key']\n end", "def before_save\n super\n unless(self.values[:credentials])\n self.values[:credentials] = {}\n end\n random_sec = 3.times.map{ SecureRandom.urlsafe_base64 }.join\n self.user.run_state.random_sec = random_sec\n self.credentials = Utils::Cipher.encrypt(\n JSON.dump(self[:credentials]),\n :key => [\n SALTER,\n self.user.username,\n self.user.run_state.random_sec\n ].join(SALTER_JOINER),\n :iv => self.user.run_state.random_sec\n )\n self.extras = Sequel.pg_json(self.extras)\n self.infos = Sequel.pg_json(self.infos)\n if(password)\n self.password_digest = checksum(password)\n end\n end", "def load_private_key_password\n Puppet::FileSystem.read(Puppet[:passfile], :encoding => Encoding::BINARY)\n rescue Errno::ENOENT\n nil\n end", "def private_key_pem\n @private_key.to_pem\n end", "def ssl_private_key\n @ssl_private_key ||= OpenSSL::PKey::RSA.new <<-KEY\n-----BEGIN RSA PRIVATE KEY-----\nMIG7AgEAAkEA8pmEfmP0Ibir91x6pbts4JmmsVZd3xvD5p347EFvBCbhBW1nv1Gs\nbCBEFlSiT1q2qvxGb5IlbrfdhdgyqdTXUQIBAQIBAQIhAPumXslvf6YasXa1hni3\np80joKOug2UUgqOLD2GUSO//AiEA9ssY6AFxjHWuwo/+/rkLmkfO2s1Lz3OeUEWq\n6DiHOK8CAQECAQECIQDt8bc4vS6wh9VXApNSKIpVygtxSFe/IwLeX26n77j6Qg==\n-----END RSA PRIVATE KEY-----\n KEY\n end", "def key_credentials=(value)\n @key_credentials = value\n end", "def secret\n @options[:credential2]\n end", "def store_keys_in_file\n unless access_key.nil? || secret_access_key.nil?\n write_to_file( key_file_locations.first, YAML::dump({:access_key => access_key, :secret_access_key => secret_access_key})) \n end\n end", "def store_keys_in_file\n unless access_key.nil? || secret_access_key.nil?\n write_to_file( key_file_locations.first, YAML::dump({:access_key => access_key, :secret_access_key => secret_access_key})) \n end\n end", "def format_with_quotes(key, value)\n value = remove_open_quotes(value)\n # Remove leading and trailing single quotes so we don't quote twice\n # if this key is flagged to be wrapped or it contains a special character\n # and it's not a full text field, such as About You\n if !value.nil? && !KEYS_TO_EXCLUDE_FROM_QUOTES.include?(key) && (KEYS_TO_WRAP_IN_QUOTES.include?(key) || /(\\[|\\]|\\(|\\)|: )/ === value)\n return \"'#{value.chomp(\"'\").reverse.chomp(\"'\").reverse}'\"\n else\n return value\n end\n end", "def encode_credentials(username, password)\n \"\\0#{username}\\0#{password}\"\n end", "def google_creds_filepath\n unless File.exist?(GOOGLE_DRIVE_CREDS_FILEPATH)\n File.open(GOOGLE_DRIVE_CREDS_FILEPATH, 'wb') do |f|\n f << GOOGLE_DRIVE_CREDS.to_json\n end\n end\n GOOGLE_DRIVE_CREDS_FILEPATH\n end", "def to_s\n hide_password(fetch.dup).to_yaml\n end", "def private_keys\n [private_key_path]\n end", "def private_key\n @private_key ||= load_key(@private_key_file)\n end", "def test_json_locked_entry\n new_entry = EntryCrypto::PasswordEntry.new \"www.google.ca\", \"test_user\"\n new_user = EntryCrypto::User.new \"master_user\", 1234, \"12345678901234567890123456789012\"\n\n new_user.lock(\"fake_pass\")\n new_user.unlock(\"fake_pass\")\n\n new_entry.lock_password(new_user, \"password1234\")\n\n entry_json = new_entry.to_json\n\n parsed = JSON.parse entry_json\n\n assert parsed[\"json_class\"] == \"PasswordEntry\"\n assert parsed[\"iv\"].length == 24\n assert parsed[\"user_name\"] == \"test_user\"\n assert parsed[\"site_name\"] == \"www.google.ca\"\n # Double length since the stored string is a byte string\n assert parsed[\"encrypted_password\"].length == \"password1234\".length * 2\n assert parsed[\"auth_tag\"].length == 32\n\n end", "def key_contents(path, options = {})\n # Check if key exists first. Otherwise we could return some\n # weird strings. Also, raise error if user is trying to get a\n # private key.\n key_content_type = key_metadata(path, options).rundeck_content_type\n if key_content_type == content_type('private')\n fail Error::Unauthorized,\n 'You are not allowed to retrieve the contents of a private key'\n end\n\n options.merge!(format: :plain,\n headers: { 'Accept' => 'application/pgp-keys' })\n key = get(\"#{STORAGE_KEYS_PATH}/#{path}\", options)\n objectify 'public_key' => key\n end", "def private_key\n @priv\n end", "def encrypt(text)\n Base64.encode64(@public_key.public_encrypt(text)).gsub(/\\n/, \"\") if text\n end", "def encrypt(text)\n Base64.encode64(@public_key.public_encrypt(text)).gsub(/\\n/, \"\") if text\n end", "def write_to_json(raw_input, create_filename)\n input_hash = raw_input.split(\"\\n\").map do |line|\n string = line.split(\" \")\n {\"first_index\" => string[0].split(\"-\")[0].to_i, \"second_index\" => string[0].split(\"-\")[1].to_i, \"character\" => string[1].gsub(':', ''), \"password\" => string[2]}\n end\n File.open(\"#{create_filename}\", \"w\") do |f| \n f.write(JSON.pretty_generate(input_hash))\n end\nend", "def to_s\n %[#<password safe>]\n end", "def to_s\n %[#<password safe>]\n end", "def deep_link_pw\n return nil unless (extended_deep_link_pw = read_attribute(:deep_link_pw))\n encrypt_remove_pre_and_postfix(extended_deep_link_pw, 'deep_link_pw', 38)\n end", "def test_credentials_for_fetches_credentials_for_provider\n ensure_gpg_version!\n\n fixture_content = File.read(yaml_fixture)\n assert_equal 'foo', ::YAML.load(fixture_content)[:provider]['key'], \"Yaml fixture doesn't contain the required value, test will fail for the wrong reason\"\n encryptor.encrypt(fixture_content, symmetric: true, output: cred_file_location)\n\n assert_equal 'foo', subject.credentials_for(:provider)['key'], \"The key either doesn't exist or the file did not decrypt properly\"\n end", "def encrypted_private_key\n return private_key unless passphrase\n key_object.to_pem(OpenSSL::Cipher.new(\"AES-128-CBC\"), passphrase)\n end", "def client_secrets\n Google::APIClient::ClientSecrets.load(\n 'client_secrets.json').to_authorization\nend", "def validate_json_credentials(json_key)\n json_key_hash = Fog::JSON.decode(json_key)\n\n unless json_key_hash.key?(\"client_email\") || json_key_hash.key?(\"private_key\")\n raise ArgumentError.new(\"Invalid Google JSON key\")\n end\n end", "def root_keys; <<~EOS\n . IN DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5\n . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d\n EOS\n end", "def priv_key\n key = master_ext_key.derive(PURPOSE_TYPE, true).derive(Tapyrus.chain_params.bip44_coin_type, true)\n\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(key) { |key, p| key.derive(p) }\n end", "def encode_credentials(username, password)\n \"\"\n end", "def remove_control_characters\n # Don't mess with existing keys (since cannot change key text anyway)\n return if !new_record?\n\n # First -- let the first control char or space stand (to divide key type from key)\n # Really, this is catching a special case in which there is a \\n between type and key.\n # Most common case turns first space back into space....\n self.key = key.sub(/[ \\r\\n\\t]/, ' ')\n\n # Next, if comment divided from key by control char, let that one stand as well\n # We can only tell this if there is an \"=\" in the key. So, won't help 1/3 times.\n self.key = key.sub(/=[ \\r\\n\\t]/, '= ')\n\n # Delete any remaining control characters....\n self.key = key.gsub(/[\\a\\r\\n\\t]/, '').strip\n end", "def ssh_data\n <<-SSH_DATA\n ssh-keys = \"#{@user}:#{@public_key_value}}\"\n enable-oslogin = \"FALSE\"\n SSH_DATA\n end", "def build_and_copy_heartbeat_authkeys_file\n write_to_file_for(\"authkeys\") do\n open(Application.heartbeat_authkeys_config_file).read\n end\n end", "def access_key\n credentials['access_key']\n end", "def private_key_16_string\n @mask_1[0..15]\n end", "def authentication_string\n pwd = escape(@account.password)\n user = escape(@account.username)\n sig = escape(@account.signature) \n \"PWD=#{pwd}&USER=#{user}&SIGNATURE=#{sig}\"\n end", "def load_public_key(filename); end", "def public_key=(_); end", "def public_key=(_); end", "def dot_key_code_wrapped dot_key_code\n if dot_key_code.nil? || dot_key_code.length < 20 then\n return dot_key_code\n else\n arr= dot_key_code.split('.')\n chars=0\n sep = '.'\n str = nil\n #puts 'a:' + arr.to_s\n arr.each do |part|\n #debugger\n #puts 'p:' + part\n chars += part.length\n if chars > 20 then\n sep='.<br>'\n chars =0\n end\n #puts 'c:' + chars.to_s\n if str.nil? then\n str = part\n else\n str += (sep + part)\n end\n #puts 's:' + str\n end\n #puts 'se:' + str\n return str.html_safe\n #line = dot_key_code[20..(dot_key_code.length - 1)]\n #index = line.replace( line.index('.')\n end\n end", "def private_key\n return self.authentication.private_key\n end", "def private_key\n return self.authentication.private_key\n end" ]
[ "0.5791224", "0.5791224", "0.57139206", "0.57085174", "0.56565887", "0.56399906", "0.5605948", "0.5580012", "0.5580012", "0.5571749", "0.5546464", "0.5534472", "0.5531251", "0.54332507", "0.5401355", "0.5356815", "0.53346014", "0.53215516", "0.5311636", "0.52885395", "0.52724516", "0.5259685", "0.52519274", "0.5215671", "0.52036935", "0.51869756", "0.51801944", "0.5151884", "0.5134539", "0.5128649", "0.51220936", "0.51186556", "0.5102476", "0.5083806", "0.50785893", "0.50785893", "0.50727797", "0.50693905", "0.50583386", "0.5055966", "0.5055562", "0.50409544", "0.50401366", "0.5035478", "0.5034482", "0.50319046", "0.50319046", "0.50319046", "0.50235265", "0.5014592", "0.5009737", "0.50073695", "0.49894282", "0.49768963", "0.49598205", "0.4953736", "0.49464783", "0.49455643", "0.49455643", "0.4933744", "0.49280745", "0.4921854", "0.49143678", "0.49080375", "0.4905904", "0.48981184", "0.48981184", "0.48934457", "0.4889063", "0.48872033", "0.487873", "0.4866387", "0.4859683", "0.48571634", "0.4852856", "0.48441923", "0.48242375", "0.48242375", "0.48225018", "0.48135644", "0.48135644", "0.48129487", "0.4810329", "0.48099056", "0.4809206", "0.4798635", "0.47983003", "0.47927803", "0.47900605", "0.47891754", "0.47838423", "0.47778565", "0.4777336", "0.47744158", "0.47728792", "0.4771013", "0.4767206", "0.4767206", "0.47651276", "0.47600386", "0.47600386" ]
0.0
-1
GET /backend/conf_activities GET /backend/conf_activities.json
def index @backend_conf_activities = Conf::Activity.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activities\n get_call(\"1/activities.json\")\n end", "def activities(params = {})\n scope 'default'\n get('activities/', params)\n end", "def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body(response)\n end", "def activities(id)\n get(\"/accounts/#{id}/activities\")['activities']\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end", "def set_backend_conf_activity\n @backend_conf_activity = Conf::Activity.find(params[:id])\n end", "def frequent_activities\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end", "def frequent_activities()\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end", "def index\n @activities = Activity.all\n render json: @activities\n end", "def activities\n @activities = if @project\n @project.activities\n else\n User.current.projects.all(:include => :time_entry_activities).map(&:time_entry_activities).flatten + TimeEntryActivity.shared.active\n end\n\n respond_to do |format|\n format.xml\n end\n end", "def get_activities_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.get_activities ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_template'] = opts[:'filter_template'] if !opts[:'filter_template'].nil?\n query_params[:'filter_name'] = opts[:'filter_name'] if !opts[:'filter_name'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceBareActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#get_activities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tracker_activities\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities = JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n while next_ind.positive? do\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&offset=#{next_ind}&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities += JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n end\n end", "def recent_activities()\n get(\"/user/#{@user_id}/activities/recent.json\")\n end", "def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end", "def create\n @backend_conf_activity = Conf::Activity.new(backend_conf_activity_params)\n\n respond_to do |format|\n if @backend_conf_activity.save\n format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully created.' }\n format.json { render :show, status: :created, location: backend_conf_activity_path(@backend_conf_activity) }\n else\n format.html { render :new }\n format.json { render json: @backend_conf_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activities(options = {})\n get('/user/activities', query: options)\n end", "def activities=(value)\n @activities = value\n end", "def index\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects'))\n @activities = @response\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}\n end\n end", "def activities\n add_to_query restrict_kind: 'activity'\n end", "def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end", "def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end", "def fetch_activities(token, params)\n params.to_options!\n\n # Setup params.\n setup_params_logic = lambda do |last_request, params|\n if !last_request.blank?\n params[:occurred_since_date] = last_request\n end\n end\n\n # Parse the response.\n response_parse_logic = lambda do |response|\n content_keys = {}\n doc = Nokogiri::XML(response.body)\n\n doc.xpath(\"/activities//activity\").each do |act|\n id = act.search('id').first.inner_html\n content_keys[id] = act.to_s\n end\n content_keys\n end\n\n url = format_project_url(get_api_url('activities'), params[:project_id])\n fetch(::PivotalTracker::Activity, token, url,\n response_parse_logic, setup_params_logic, true)\n end", "def activities_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.activities_get ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'done'] = opts[:'done'] if !opts[:'done'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#activities_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def get_activities\n @params=task_params\n @project=current_user.projects.find(@params[:project_id])\n counter=0\n @res=[]\n @project.activities.each do |p|\n if p.users.include? current_user\n @res[counter]={\n activity_id: p.id, \n name: p.name\n }\n counter+=1\n end\n end\n respond_to do |format|\n format.json {render json: @res.uniq}\n end\n end", "def show\n @activities = Activity.where('schedule_id': params[:id])\n render json: @activities.as_json\n end", "def index\n @activities = current_user.attending_activities\n render :index\n end", "def index\n \t@activities = Activity.all(limit: ActivitiesController::MAX_SEARCH_RESULTS)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activities }\n end\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def favorite_activities\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def favorite_activities()\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def get_project_activities(project_id_or_key, params = {})\n get(\"projects/#{project_id_or_key}/activities\", params)\n end", "def activities(options)\n activities_request build_url_parameters(options).merge(detailed: true)\n end", "def index(user)\n activities = []\n json = eval(RestClient.get(ENDPOINT + \"/activities?user_id=#{user}\").to_s)\n json.each do |attributes|\n activities << Activity.new(attributes)\n end\n activities\n end", "def index\n @activities = current_user.activities\n @profile = current_user.profile # Comeback too\n @categories = Category.all\n respond_to do |format|\n format.html\n format.json { render json: @activities }\n end\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = current_user.activities\n end", "def backend_conf_activity_params\n params.require(:conf_activity).permit(:attendee_id, :event_id, :happened_at)\n end", "def activities_get(opts = {})\n activities_get_with_http_info(opts)\n end", "def show\n begin\n @activity = PublicActivity::Activity.all.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n return render_errors(['No activity found.'])\n end\n\n return render :json => {:status => 1, :activities => @activities}\n end", "def show\n @activity = current_user.activities.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def index\n @status_activities = StatusActivity.all\n end", "def garmin_connect_activities\n @activities = GarminConnectFinderService.new(current_user).recent_activities(page: 1, per_page: 7).reverse\n respond_to do |format|\n format.js\n end\n end", "def show\n render json: @activity\n end", "def show\n @activity = current_user.user_activities.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def index\n @activities_lists = ActivitiesList.all\n end", "def all_activities(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :type, :start, :limit, :start_date, :end_date, :done\n end\n request(:get, 'activities', params)\n end", "def activities\n\t activity_feed.activities\n\tend", "def get_all_activties_for_user\n\n\t@activities = Activity.all(:user_id => params[:user_id]) \n\n\t#get json format\n\tarr = Array(@activities) \n @json_format ={ 'Activities' => arr}.to_json\n\t@title = \"All Activities for ##{params[:user_id]}\"\n\t#redirect to home page\n\terb :home\nend", "def fetch(activity_id)\n RubyRedtail::Query.run(\"calendar/activities/#{activity_id}\", @api_hash, \"GET\")\n end", "def activity\n\n params = fields_hash[\"params\"]\n return nil unless params\n params[\"activity\"]\n end", "def activity\n\n params = fields_hash[\"params\"]\n return nil unless params\n params[\"activity\"]\n end", "def activities\n return @activities\n end", "def index\n @activity_award_cfgs = ActivityAwardCfg.all\n end", "def show\n @qa_client = QaClient.find(params[:id])\n @qa_activities = @qa_client.qa_activities\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qa_client }\n end\n end", "def index\n if logged_in? && current_user.identity.eql?(1)\n @activities = Activity.all\n else\n not_found\n end\n end", "def index\n @current_activities = CurrentActivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @current_activities }\n end\n end", "def get_activities(opts = {})\n data, _status_code, _headers = get_activities_with_http_info(opts)\n return data\n end", "def activities(params = {})\n rv = []\n try_again = true\n fetched = 0\n p = params.dup\n p[:offset] = 0\n\n while try_again do\n result = api_call(ROOT_ACTIVITIES, p)\n return nil if result.nil?\n rv += result[:results]\n\n meta = result[:meta]\n fetched += meta[:count]\n if fetched >= meta[:total]\n try_again = false\n else\n p[:offset] += meta[:count]\n end\n end\n\n rv\n end", "def activities(per_page: nil, page: nil)\n if page || per_page\n get_activities(per_page: per_page, page: page)\n else\n get_activities if @activities.empty?\n @activities.values\n end\n end", "def index\n @project_activities = ProjectActivity.all\n end", "def set_activities_list\n @activities_list = ActivitiesList.find(params[:id])\n end", "def statuses\n request(:get, \"applicant_tracking/statuses\")\n end", "def index\n\t@activities = Activity.all :order => :id.desc\n\tif @activities.empty?\n\t\tflash[:error] = 'No Activities found.'\n\tend \n\t@title = 'All Activities for all users'\n\n\t#get json format for array of activities\n\tarr = Array(Activity.all)\n @json_format ={ 'Activities' => arr}.to_json\n\n\t#redirect to home page\n\terb :home\nend", "def index\n render json: TeachingActivity.all\n end", "def index\n @app = App.find(params[:app_id])\n @activities = @app.activities.all(:order => 'updated_at DESC')\n @activity = @app.activities.build\n @base_versions = [Activity::NO_BASE_VERSION]\n\n respond_to do |format|\n format.html do # index.html.erb\n if request.xhr?\n render :partial => 'index', :locals => {:app => @app, :activities => @activities}\n end\n end\n format.xml { render :xml => @activities }\n format.atom # index.atom.builder\n end\n end", "def list_activities\n GooglePlus::Activity.for_person(id)\n end", "def kind\n :activity\n end", "def index\n @activity_applications = ActivityApplication.all\n end", "def get_activities\n\t\tviewer = nil\n\t\tviewer = User.find_by_id(params[:user_id]) if (params.has_key?(:user_id))\n\t\t\n @activities = Activity.getActivitiesBy2(params[:category_id], params[:user_id])\n\t\t(0...@activities.length).each {|ndx| @activities[ndx].viewer = viewer}\n render :json => @activities\n end", "def list_respond_to_atom\n @configurations = Configuration.find(:all, :order => 'configurations.id DESC', :limit => Configuration.find_retry(:name => \"atom.max_entries\", :namespace => \"Configuration\").to_i)\n\n respond_to do |format|\n format.atom\n end\n end", "def update\n respond_to do |format|\n if @backend_conf_activity.update(backend_conf_activity_params)\n format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully updated.' }\n format.json { render :show, status: :ok, location: backend_conf_activity_path(@backend_conf_activity) }\n else\n format.html { render :edit }\n format.json { render json: @backend_conf_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render json: @day, include: [:activities]\n end", "def index\n @activities = @learning_unit.activities\n end", "def index\n fetch_activity_logs\n\n respond_to do |format|\n format.html\n format.js\n format.json do\n query = params[:query]\n if query\n actions = ActivityLog.all_actions(query)\n render json: actions\n else\n render json: @activity_logs\n end\n end\n end\n end", "def index\n @backend_conf_events = Conf::Event.all\n end", "def activitytypes\n build_settings_array RubyRedtail::Query.run(\"settings/activitytypes\", @api_hash, \"GET\")\n end", "def activities\n children('activities')\n end", "def url\n activity_path(self)\n end", "def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @activity}\n end\n end", "def index\n @project = Project.with_api_key(params[:api_key]).first\n if @project\n @activities = @project.activities.page(params[:page]).per(PER_PAGE).order('created_at desc')\n flash.now[:notice] = \"Set WebHooks to external services. See #{ActionController::Base.helpers.link_to 'all hook list', project_hooks_path(@project.api_key)}.\" if @activities.empty?\n else\n render text: 'Project not found', status: 404\n end\n end", "def show\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @project = Project.find(params[:id])\n @activities = PublicActivity::Activity.order('created_at desc').where(:project_id=>@project.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def get_activities_by_interval()\n return MicrosoftGraph::Shares::Item::List::Items::Item::GetActivitiesByInterval::GetActivitiesByIntervalRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def index\n @user_activities = UserActivity.all\n end", "def index\n @user_activities = UserActivity.all\n end", "def index\n @user_activities = UserActivity.all\n end", "def activity\n require \"launchy\"\n\n if app = optional_app\n Launchy.open(\"https://dashboard.heroku.com/apps/#{app}/activity\")\n else\n Launchy.open(\"https://dashboard.heroku.com/activity\") # doesn't work yet, but hey\n end\n end", "def strava_activities\n @activities = StravaFinderService.new(current_user).activities_after(@search_date.to_time, per_page: 7)\n respond_to do |format|\n format.js\n end\n end" ]
[ "0.75542724", "0.68641347", "0.6809054", "0.66842586", "0.6663225", "0.6663225", "0.6567038", "0.63987267", "0.63709867", "0.63617444", "0.6338498", "0.6294427", "0.6257422", "0.6244506", "0.62327194", "0.6232272", "0.62228", "0.6211288", "0.6186235", "0.6180784", "0.61680305", "0.6150132", "0.6150132", "0.61432886", "0.612748", "0.6119835", "0.607611", "0.60667473", "0.6063801", "0.60528", "0.60518265", "0.6047278", "0.60427386", "0.60308236", "0.60306513", "0.6018627", "0.6015261", "0.5995397", "0.5995397", "0.5995397", "0.5995397", "0.5995397", "0.5995397", "0.5995397", "0.5995397", "0.5995397", "0.5995397", "0.5992355", "0.5991398", "0.5945315", "0.59037584", "0.58901095", "0.587274", "0.58620816", "0.5861755", "0.58603203", "0.5858274", "0.58320767", "0.5826527", "0.5814134", "0.58121836", "0.58059025", "0.58059025", "0.575937", "0.5753188", "0.573731", "0.57314885", "0.57300735", "0.5721512", "0.5713925", "0.5705788", "0.56824225", "0.56823885", "0.5681059", "0.5666204", "0.56603706", "0.5653568", "0.5645586", "0.5638744", "0.5634866", "0.56230855", "0.56185657", "0.5608511", "0.55965054", "0.5590409", "0.5566588", "0.5549421", "0.5539502", "0.5537817", "0.55337447", "0.5530645", "0.5521332", "0.55188173", "0.55168605", "0.55118", "0.5511192", "0.5511192", "0.5511192", "0.5505007", "0.548945" ]
0.79817796
0
GET /backend/conf_activities/1 GET /backend/conf_activities/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @backend_conf_activities = Conf::Activity.all\n end", "def activities\n get_call(\"1/activities.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def set_backend_conf_activity\n @backend_conf_activity = Conf::Activity.find(params[:id])\n end", "def activities(params = {})\n scope 'default'\n get('activities/', params)\n end", "def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end", "def index\n @activities = Activity.all\n render json: @activities\n end", "def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body(response)\n end", "def create\n @backend_conf_activity = Conf::Activity.new(backend_conf_activity_params)\n\n respond_to do |format|\n if @backend_conf_activity.save\n format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully created.' }\n format.json { render :show, status: :created, location: backend_conf_activity_path(@backend_conf_activity) }\n else\n format.html { render :new }\n format.json { render json: @backend_conf_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @activities = Activity.where('schedule_id': params[:id])\n render json: @activities.as_json\n end", "def frequent_activities\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end", "def frequent_activities()\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end", "def activities(id)\n get(\"/accounts/#{id}/activities\")['activities']\n end", "def get_activities\n @params=task_params\n @project=current_user.projects.find(@params[:project_id])\n counter=0\n @res=[]\n @project.activities.each do |p|\n if p.users.include? current_user\n @res[counter]={\n activity_id: p.id, \n name: p.name\n }\n counter+=1\n end\n end\n respond_to do |format|\n format.json {render json: @res.uniq}\n end\n end", "def show\n begin\n @activity = PublicActivity::Activity.all.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n return render_errors(['No activity found.'])\n end\n\n return render :json => {:status => 1, :activities => @activities}\n end", "def index\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects'))\n @activities = @response\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}\n end\n end", "def show\n render json: @activity\n end", "def show\n @activity = current_user.activities.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def get_activities_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.get_activities ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_template'] = opts[:'filter_template'] if !opts[:'filter_template'].nil?\n query_params[:'filter_name'] = opts[:'filter_name'] if !opts[:'filter_name'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceBareActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#get_activities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end", "def recent_activities()\n get(\"/user/#{@user_id}/activities/recent.json\")\n end", "def show\n @activity = current_user.user_activities.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def activities_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.activities_get ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'done'] = opts[:'done'] if !opts[:'done'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#activities_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def show\n @qa_client = QaClient.find(params[:id])\n @qa_activities = @qa_client.qa_activities\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qa_client }\n end\n end", "def tracker_activities\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities = JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n while next_ind.positive? do\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&offset=#{next_ind}&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities += JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n end\n end", "def index\n \t@activities = Activity.all(limit: ActivitiesController::MAX_SEARCH_RESULTS)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activities }\n end\n end", "def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end", "def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end", "def fetch_activities(token, params)\n params.to_options!\n\n # Setup params.\n setup_params_logic = lambda do |last_request, params|\n if !last_request.blank?\n params[:occurred_since_date] = last_request\n end\n end\n\n # Parse the response.\n response_parse_logic = lambda do |response|\n content_keys = {}\n doc = Nokogiri::XML(response.body)\n\n doc.xpath(\"/activities//activity\").each do |act|\n id = act.search('id').first.inner_html\n content_keys[id] = act.to_s\n end\n content_keys\n end\n\n url = format_project_url(get_api_url('activities'), params[:project_id])\n fetch(::PivotalTracker::Activity, token, url,\n response_parse_logic, setup_params_logic, true)\n end", "def fetch(activity_id)\n RubyRedtail::Query.run(\"calendar/activities/#{activity_id}\", @api_hash, \"GET\")\n end", "def index\n @activities = current_user.activities\n @profile = current_user.profile # Comeback too\n @categories = Category.all\n respond_to do |format|\n format.html\n format.json { render json: @activities }\n end\n end", "def activities\n @activities = if @project\n @project.activities\n else\n User.current.projects.all(:include => :time_entry_activities).map(&:time_entry_activities).flatten + TimeEntryActivity.shared.active\n end\n\n respond_to do |format|\n format.xml\n end\n end", "def favorite_activities\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def index(user)\n activities = []\n json = eval(RestClient.get(ENDPOINT + \"/activities?user_id=#{user}\").to_s)\n json.each do |attributes|\n activities << Activity.new(attributes)\n end\n activities\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @activity}\n end\n end", "def favorite_activities()\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def show\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @project = Project.find(params[:id])\n @activities = PublicActivity::Activity.order('created_at desc').where(:project_id=>@project.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def get_project_activities(project_id_or_key, params = {})\n get(\"projects/#{project_id_or_key}/activities\", params)\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def update\n respond_to do |format|\n if @backend_conf_activity.update(backend_conf_activity_params)\n format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully updated.' }\n format.json { render :show, status: :ok, location: backend_conf_activity_path(@backend_conf_activity) }\n else\n format.html { render :edit }\n format.json { render json: @backend_conf_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @conf = Conf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conf }\n end\n end", "def backend_conf_activity_params\n params.require(:conf_activity).permit(:attendee_id, :event_id, :happened_at)\n end", "def index\n @status_activities = StatusActivity.all\n end", "def activity\n\n params = fields_hash[\"params\"]\n return nil unless params\n params[\"activity\"]\n end", "def activity\n\n params = fields_hash[\"params\"]\n return nil unless params\n params[\"activity\"]\n end", "def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def index\n render json: TeachingActivity.all\n end", "def get_all_activties_for_user\n\n\t@activities = Activity.all(:user_id => params[:user_id]) \n\n\t#get json format\n\tarr = Array(@activities) \n @json_format ={ 'Activities' => arr}.to_json\n\t@title = \"All Activities for ##{params[:user_id]}\"\n\t#redirect to home page\n\terb :home\nend", "def index\n @activities = current_user.attending_activities\n render :index\n end", "def show\n @my_activity = MyActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_activity }\n end\n end", "def activities=(value)\n @activities = value\n end", "def show\n render json: @day, include: [:activities]\n end", "def index\n @activities = current_user.activities\n end", "def kind\n :activity\n end", "def garmin_connect_activities\n @activities = GarminConnectFinderService.new(current_user).recent_activities(page: 1, per_page: 7).reverse\n respond_to do |format|\n format.js\n end\n end", "def activities(options = {})\n get('/user/activities', query: options)\n end", "def index\n @app = App.find(params[:app_id])\n @activities = @app.activities.all(:order => 'updated_at DESC')\n @activity = @app.activities.build\n @base_versions = [Activity::NO_BASE_VERSION]\n\n respond_to do |format|\n format.html do # index.html.erb\n if request.xhr?\n render :partial => 'index', :locals => {:app => @app, :activities => @activities}\n end\n end\n format.xml { render :xml => @activities }\n format.atom # index.atom.builder\n end\n end", "def index\n @current_activities = CurrentActivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @current_activities }\n end\n end", "def index\n @activities_lists = ActivitiesList.all\n end", "def index\n\t@activities = Activity.all :order => :id.desc\n\tif @activities.empty?\n\t\tflash[:error] = 'No Activities found.'\n\tend \n\t@title = 'All Activities for all users'\n\n\t#get json format for array of activities\n\tarr = Array(Activity.all)\n @json_format ={ 'Activities' => arr}.to_json\n\n\t#redirect to home page\n\terb :home\nend", "def activities\n add_to_query restrict_kind: 'activity'\n end", "def index\n @project_activities = ProjectActivity.all\n end", "def show\n @activity_type = ActivityType.find(params[:id]) \n @activitypage = @activity_type.activities.page(params[:page]).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_type }\n end\n end", "def get_activities_by_object_type_and_id(object_type, id)\n return @client.raw(\"get\", \"/helpers/activities/#{object_type}/#{id}\")\n end", "def show\n @selected_user = User.find_by_id(params[:id])\n @activities = @selected_user.activities.order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activities }\n end\n end", "def index\n @activities = Activity.all\n @clients_names = {}\n @activities.each do |value|\n @clients_names[value.client_id] = Client.find(value.client_id)\n .complete_name\n end\n end", "def activity_detail(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"activities/#{id}\", params)\n end", "def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html { redirect_to activity_comments_url(@activity) }\n format.xml { render :xml => @activity.to_xml(:include => :user, :except => NB_CONFIG['api_exclude_fields']) }\n format.json { render :json => @activity.to_json(:include => :user, :except => NB_CONFIG['api_exclude_fields']) } \n end \n end", "def new\n @my_activity = MyActivity.new\n @all_activites = MyActivity.where(\"user_id =?\", current_user.id).order('created_at DESC').limit(10)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_activity }\n end\n end", "def get_activities_by_object_type_and_id(object_type, id)\n @client.raw('get', \"/helpers/activities/#{object_type}/#{id}\")\n end", "def get_activities\n\t\tviewer = nil\n\t\tviewer = User.find_by_id(params[:user_id]) if (params.has_key?(:user_id))\n\t\t\n @activities = Activity.getActivitiesBy2(params[:category_id], params[:user_id])\n\t\t(0...@activities.length).each {|ndx| @activities[ndx].viewer = viewer}\n render :json => @activities\n end", "def index\n fetch_activity_logs\n\n respond_to do |format|\n format.html\n format.js\n format.json do\n query = params[:query]\n if query\n actions = ActivityLog.all_actions(query)\n render json: actions\n else\n render json: @activity_logs\n end\n end\n end\n end", "def index\n if logged_in? && current_user.identity.eql?(1)\n @activities = Activity.all\n else\n not_found\n end\n end", "def index\n @activities = @learning_unit.activities\n end", "def url\n activity_path(self)\n end", "def activity\n if params[:project_token]\n @project = Project.find_by_api_access_token(params[:project_token])\n if @project\n render '/projects/api/v1/activity'\n else\n render file: \"#{Rails.root}/public/404.html\", layout: false, status: :not_found\n end\n end\n end", "def show\n @step_activity = StepActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step_activity }\n end\n end", "def activities_get(opts = {})\n activities_get_with_http_info(opts)\n end", "def statuses\n request(:get, \"applicant_tracking/statuses\")\n end", "def show\n @work_activity = WorkActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_activity }\n end\n end", "def index\n @project = Project.with_api_key(params[:api_key]).first\n if @project\n @activities = @project.activities.page(params[:page]).per(PER_PAGE).order('created_at desc')\n flash.now[:notice] = \"Set WebHooks to external services. See #{ActionController::Base.helpers.link_to 'all hook list', project_hooks_path(@project.api_key)}.\" if @activities.empty?\n else\n render text: 'Project not found', status: 404\n end\n end", "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def index\n @activity_applications = ActivityApplication.all\n end", "def new\n @activity = Activity.new\n @series = get_series('activities')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def set_activities_list\n @activities_list = ActivitiesList.find(params[:id])\n end", "def activities(options)\n activities_request build_url_parameters(options).merge(detailed: true)\n end", "def index\n @activity_award_cfgs = ActivityAwardCfg.all\n end" ]
[ "0.7706899", "0.7218805", "0.6850805", "0.6850805", "0.65292907", "0.6494476", "0.6490101", "0.64245725", "0.6351569", "0.63404524", "0.62851685", "0.62740874", "0.6252528", "0.62339854", "0.61476827", "0.61410487", "0.6127833", "0.61059123", "0.60932356", "0.608994", "0.6083936", "0.6065605", "0.60533434", "0.60515726", "0.6031502", "0.6024831", "0.6011336", "0.59666735", "0.59666735", "0.59573877", "0.59117484", "0.59025216", "0.5893064", "0.5891689", "0.5887189", "0.5885889", "0.58843285", "0.58800817", "0.5861169", "0.5852389", "0.5833619", "0.581263", "0.58102566", "0.58102566", "0.58102566", "0.58102566", "0.58102566", "0.58102566", "0.58102566", "0.58102566", "0.58102566", "0.58102566", "0.57867676", "0.5779136", "0.57751626", "0.5769732", "0.57675356", "0.57675356", "0.57654965", "0.57654965", "0.57540166", "0.57424015", "0.57353824", "0.57344246", "0.5713992", "0.57102937", "0.56808406", "0.5665143", "0.56348825", "0.56310785", "0.5624042", "0.5616624", "0.5610333", "0.5607068", "0.55990136", "0.55939305", "0.55864304", "0.5559516", "0.55483735", "0.55435985", "0.5540523", "0.5539696", "0.55388767", "0.55387056", "0.5528537", "0.5527545", "0.55057824", "0.5495338", "0.54907256", "0.5486441", "0.548559", "0.5461412", "0.54609334", "0.54584813", "0.5452851", "0.54455537", "0.54348123", "0.54341495", "0.54323596", "0.54318625", "0.54306096" ]
0.0
-1
POST /backend/conf_activities POST /backend/conf_activities.json
def create @backend_conf_activity = Conf::Activity.new(backend_conf_activity_params) respond_to do |format| if @backend_conf_activity.save format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully created.' } format.json { render :show, status: :created, location: backend_conf_activity_path(@backend_conf_activity) } else format.html { render :new } format.json { render json: @backend_conf_activity.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backend_conf_activity_params\n params.require(:conf_activity).permit(:attendee_id, :event_id, :happened_at)\n end", "def index\n @backend_conf_activities = Conf::Activity.all\n end", "def activities=(value)\n @activities = value\n end", "def activity_params\n params.require(:activity).permit(:description, :is_done, :observations, :activity_type, :deadline)\n end", "def set_backend_conf_activity\n @backend_conf_activity = Conf::Activity.find(params[:id])\n end", "def create\n data = reload(get_series('activities'), str(Date.strptime(params[:activity].values.join(\"-\"))))\n saved = false\n get_series('activities').each do |s|\n puts \"Updating series=#{s}\"\n data[s].each do |day|\n @activity = for_date(day['dateTime'])\n @activity.send(s.partition('/')[2] + '=', day['value'])\n saved = @activity.save\n if not saved\n flash[:error] = @activity.errors\n end\n end\n end\n\n respond_to do |format|\n flash[:success] = 'Activity was successfully created.'\n format.html { redirect_to @activity }\n format.json { render json: @activity, status: :created, location: @activity }\n end\n end", "def activities\n get_call(\"1/activities.json\")\n end", "def create\n @activity = Activity.create activity_params\n status = @activity.new_record? ? 400 : 201\n if @activity.recurrence\n render json: @activity.activity_factory.activities.as_json, status:status\n else\n respond_with @activity, status:status\n end\n end", "def create\n Activity.for_user(current_user).active.each do |a|\n a.end = Time.now\n a.save\n end\n\n @activity = Activity.new(params.permit(:description))\n @activity.user = current_user\n @activity.start = Time.now\n @activity.save!\n\n render json: @activity\n end", "def create\n @activity = current_user.activities.new(activity_params)\n @activity.supplier_id = current_user.id\n #@activity.status = Activity::SETTING if @activity.activity_type.is_show?\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to edit_activity_path(@activity), notice: 'Activity was successfully created.' }\n format.json { render action: 'edit', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.find(params[:app_id])\n @activity = @app.activities.build(params[:activity])\n @activity.state = Activity::STATE_DEVELOPMENT\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html do\n if request.xhr?\n render :partial => 'shared/activity_row', :collection => @app.activities, :as => 'activity'\n else\n redirect_to app_activity_path(@app, @activity)\n end\n end\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html do\n @base_versions = ['1_1_0']\n \n if request.xhr?\n render :partial => 'new', :locals => {:activity => @activity, :app => @app}, :status => :unprocessable_entity\n else\n render :action => \"new\"\n end\n end\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:name, :description, :location, :start, :end, :deadline, :reminder_at, :subgroup_division_enabled, :no_response_action)\n end", "def activity_params\n params.require(:activity).permit(:title, :started_at, :stopped_at, :applied_at, :number_limit, :pay_type, :province, :city, :district, :location, :approval, :condition)\n end", "def activities_params\n params.require(:activity).permit(:action, :trackable)\n end", "def create\n authorize Activity\n @activity = Activity.new(params[:activity])\n @activity.user = current_visitor\n\n if params[:update_material_properties]\n # set the material_properties tags\n @activity.material_property_list = (params[:material_properties] || [])\n end\n\n if params[:update_cohorts]\n # set the cohorts\n @activity.set_cohorts_by_id(params[:cohort_ids] || [])\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @activity.grade_level_list = (params[:grade_levels] || [])\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @activity.subject_area_list = (params[:subject_areas] || [])\n end\n\n respond_to do |format|\n if @activity.save\n format.js # render the js file\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to(@activity) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @dev_activity = current_user.dev_activities.create(dev_activity_params)\n\n respond_to do |format|\n if @dev_activity.save\n format.html { redirect_to user_dev_activities_path(current_user), notice: 'The Development Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dev_activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @dev_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = @user.activities.create(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Exercise event was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:events].nil?\n else\n params[:events].each do |e|\n if Activity.exists?(uuid: params[:events][e][:id])\n @activity = Activity.find_by uuid: params[:events][e][:id]\n @activity.update({\n start_time: params[:events][e][:start].in_time_zone,\n end_time: params[:events][e][:end].in_time_zone,\n })\n next\n else\n @activity = Activity.new({\n start_time: params[:events][e][:start].in_time_zone,\n end_time: params[:events][e][:end].in_time_zone,\n uuid: params[:events][e][:id],\n name: params[:events][e][:name],\n place: params[:events][e][:google_id],\n schedule_id: params[:schedule_id]\n })\n\n @activity.save\n end\n end\n end\n end", "def create\n activity_params = params.require(:activity).permit(:title, :body,\n tags_attributes:\n [:category_id])\n @activity = Activity.create(activity_params)\n current_user.activities << @activity\n respond_to do |format|\n format.html\n format.json { render json: @activity }\n end\n end", "def create\n activity_contents = params[:activity][:activity_contents]\n params = activity_params\n @activity = Activity.new(starter_id: current_user_id,\n activity_date: params[:activity_date],\n activity_end_time: params[:activity_end_time],\n place: params[:place],\n content: params[:content],\n activity_type_id: params[:activity_type_id],\n status: params[:status])\n\n\n respond_to do |format|\n if @activity.validate\n @activity.save\n ActivityParticipant.create(user_id: current_user_id,\n activity_id: @activity.id,\n identity: 1)\n activity_contents = JSON.parse(activity_contents)\n activity_contents.each do |content|\n ActivityContent.create(activity_id: @activity.id,\n sport_option: content[\"sport_option\"],\n quantity: content[\"quantity\"])\n\n end\n format.html {redirect_to @activity, notice: 'Activity was successfully created.'}\n format.json {render :show, status: :created, location: @activity}\n starter = @activity.starter\n starter.follower.each do |user|\n MessageChannel.broadcast_to(user, {type: 1, count: 1, msg: {\n title: \"<i class='fas fa-plus-circle'></i> New Poster from #{starter.user_name}\",\n text: 'A new poster has been posted', type: 'info'}})\n end\n format.js {render 'users/create_activity'}\n\n else\n #format.js {render json: {status: 2}}\n # unless @activity.activity_date.nil?\n # @activity.activity_date = @activity.activity_date.strftime('%m/%d/%Y %H:%M')\n # end\n format.html {render :new}\n format.json {render json: @activity.errors, status: :unprocessable_entity}\n format.js {render layout: false, content_type: 'text/javascript'}\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n respond_to do |format|\n if @activity.save\n #Guardamos todos los objectivos\n params[:objectives].split(\",\").each do |objective|\n puts objective\n obj = Objective.create(description: objective, is_done: false)\n @activity.objectives << obj\n end\n #Guardamos al usuario correspondiente\n params[:users].each do |user_id|\n ActivitiesUser.create(activity_id: @activity.id, user_id: user_id)\n \n end\n @plan = Plan.find(params[:plan_id])\n @plan.activities << @activity\n format.html { redirect_to planslink_path(@activity.plan.family_group.id), notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n @attcategories = Attcategory.all\n \n @activity.duration = params[:activity_hours].to_i * 60\n @activity.duration += params[:activity_minutes].to_i\n \n @activity.user = current_user\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to :action => :change_actattributes, :id => @activity }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:type_activity, :description, :work_hours, :extra, :sheetfile_id, :project_id)\n end", "def create_params\n params.require(:activity_log).permit(:baby_id, :assistant_id, :activity_id, :start_time, :stop_time, :duration, :comments, :status)\n end", "def activity_params\n params.require(:activity).permit(:project_id, :task_id, :subtask_id, :user_id, :start, :ended, :duration, :description, :week, :year, :chargeable, :charged, :charged_date, :charged_code)\n end", "def add_activity(activity)\n act = activity.as_json\n write_feed.add_activity(act)\n end", "def tracker_activities\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities = JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n while next_ind.positive? do\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&offset=#{next_ind}&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities += JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n end\n end", "def update_activities!\n _, _, host, = URI.split url\n PublicActivity::Activity.where(trackable: self).update_all(\n parameters: {\n namespace_id: namespace.id,\n namespace_name: namespace.clean_name,\n webhook_url: url,\n webhook_host: host\n }\n )\n end", "def activity_params\n params.require(:activity).permit(:theme_id, :code, :uni_module_id, :name,\n :name_abrv, :user_id, :archived, :in_drive, :notes, programme_ids:[],\n activity_assess_attributes: [:id, :num_assess, :pre_assess_type_id, :during_assess_type_id,\n :post_assess_type_id, :post_lab_type_id, :assess_weight, :notes],\n activity_tech_attributes: [:id, :tech_lead_id, :tech_ustudy_id, :last_risk_assess, :next_risk_assess,\n :equip_needed, :cost_per_student],\n activity_teaching_attributes: [:id, :user_id, :mole_pub_link, :g_drive_link, :resit_priority_id],\n activity_gta_attributes: [:id, :staff_ratio, :marking_time, :job_desc, :jobshop_desc, :criteria,\n gta_invites_attributes:[:id, :user_id, :_destroy]],\n activity_timetable_attributes: [:id, :same_as_prev_year, :checked_on_timetable, :capacity, :min_week_num, :max_week_num,\n :duration, :setup_time, :series_setup_time, :takedown_time, :kit_prep_time, :notes, :pref_room_id, room_ids:[]],\n objective_linkers_attributes:[:id, :activity_objective_id, :obj_programme, :_destroy])\n end", "def activity_params\n params.fetch(:activity, {}).permit(:name, :date, :calories, :description, :activity => [:hours, :minutes, :seconds])\n end", "def create\n # byebug\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to root_path, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \tRails.logger.info params\n @activity = Activity.new(params[:activity])\n @activity.user = current_user\n\n if params.has_key?('hidden-activity') and params['hidden-activity'].has_key?('tag_list')\n \t@activity.tag_list = params['hidden-activity'][:tag_list]\n end\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n # Delete images post invalidation\n @activity.activity_images.map(&:destroy)\n @activity.activity_images = []\n ActivitiesController::MAX_IMAGES.times { @activity.activity_images.build }\n\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:content, :start, :title, :title_id)\n end", "def activity_params\n params.require(:activity).permit(:tag_list, :id, :name, :start_date, :end_date, :venue, :description, :speaker, :speakerbio, :biolink, :keytakeaway, :prerequisite, :maxattendee, :tags, :resources, :speaker_img, :activity_img)\n end", "def activity_params\n params.fetch(:activity, {}).permit(\n :name,\n :start,\n :duration,\n :activity_type_id\n )\n end", "def activity_params\n params.require(:activity).permit(:name, :deal_id, :team_id, :person_id, :organization_id, :type_id, :note, :date, :time, :length, :user_id, :done)\n end", "def create\n if current_user\n if params[:format] == \"json\"\n @activity = current_user.activities.new_from_json(params)\n if params[:activity][:auto_title] == true\n @activity.auto_title!\n end\n else\n @activity = current_user.activities.new(params[:activity])\n end\n else\n @activity = Activity.new(params[:activity])\n end\n respond_to do |format|\n if @activity.save\n format.html { redirect_to(@activity, :notice => 'Activity was successfully created.') }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n format.json { render :json => @activity.to_json, :status => :created, :location => @activity }\n else\n logger.info @activity.errors.inspect\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n format.json { render :json => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def activity_params\n params[:activity].permit!\n end", "def create\n @activity = Activity.new(params[:activity])\n respond_to do |format|\n if @activity.save\n @activity.update_attribute(:enabled,params[:activity][:enabled])\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to([:manage, @activity]) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :activity => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @backend_conf_activity.update(backend_conf_activity_params)\n format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully updated.' }\n format.json { render :show, status: :ok, location: backend_conf_activity_path(@backend_conf_activity) }\n else\n format.html { render :edit }\n format.json { render json: @backend_conf_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_activity(**args)\n params = parameters(args) do\n required_params :subject, :type\n optional_params :subject, :type, :done, :due_date, :due_time, :duration, :user_id, :deal_id, :person_id, :participants, :org_id, :note\n end\n request(:post, 'activities', params)\n end", "def activity_params\n params.require(:activity).permit(:exercise_type_id, :exercise_unit_id, :intensity_id, :date, :num_units)\n end", "def programme_activity_params\n params.require( :programme_activity ).permit( :project_id, :activity_id, :activity_label, :start_date, :finish_date )\n end", "def activity_params\n params.require(:activity).permit(:description, :status, :case_id, {attachments: []})\n end", "def activities\n add_to_query restrict_kind: 'activity'\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to [@course, @learning_unit, @activity], notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def trip_activity_params\n params.permit(:activity, :trip_request_id, :user_id, :mark_as_responded)\n end", "def activity_params\n params.require(:activity).permit(:num_hours, :worker_id, :task_id, :observation, :date_activity, :month, :year, :worker, :task)\n end", "def create\n @activity = current_user.activities.new(activity_params)\n @activity.name = params[:name]\n @activity.date = Date.civil(params[:date][:year].to_i, params[:date][:month].to_i, params[:date][:day].to_i)\n @activity.duration = params[:activity][:hour] + ':' + params[:activity][:minute] + ':' + params[:activity][:second]\n \n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_activity_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.create_activity ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'activity_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#create_activity\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @status_activity = StatusActivity.new(status_activity_params)\n\n respond_to do |format|\n if @status_activity.save\n format.html { redirect_to @status_activity, notice: 'Status activity was successfully created.' }\n format.json { render :show, status: :created, location: @status_activity }\n else\n format.html { render :new }\n format.json { render json: @status_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:canvas_scoring_item_id, :canvas_user_id, :reason, :delta)\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.js { render partial: 'activity', locals: {activities: [@activity], is_filted: false} }\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.js { render partial: 'activity', notice: @activity.errors }\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:name, :user_id, :location, :time, :nrofpeopleinvited, :description)\n end", "def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n flash[:success] = 'Activity was successfully created.'\n format.html { redirect_to activities_path }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_activity(activity)\n self.activities << activity\n end", "def activity_params\n params.require(:activity).permit(:title, :description, :starttime, :endtime, :place, :number_of_people, :pay_type, :average_cost, :user_id, :tags, :apply_up_limit)\n end", "def activity\n\n params = fields_hash[\"params\"]\n return nil unless params\n params[\"activity\"]\n end", "def activity\n\n params = fields_hash[\"params\"]\n return nil unless params\n params[\"activity\"]\n end", "def create\n\n @title = Title.find(activity_params[:title_id])\n @event = Event.find(@title[:event_id])\n @activity = Activity.new(activity_params)\n @title.activities << @activity\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to \"/events/#{@event.id}\", notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params[:activity]\n end", "def create_activity\n player = Player.find_or_create_by(email:req_params[:email])\n project = Project.find_by(name:req_params[:project])\n event = req_params[:event]\n count = req_params[:count]\n @activity = Activity.get_activity_type(player,event,project,count)\n\n end", "def add_accounts_from_activities\n # need to get the Token!\n #\n tok = Helpers::Fixtures.load_fixture('authorization_server_api') # creds file\n @creds = tok['api']\n @token = APIHelper.get_auth_token(@creds)\n\n header_params = APIHelper.header_params(@token)\n policy_api = PolicyAPI::GeneralInfoApi.new\n\n activities_needing_removed.each do |act|\n STDOUT.puts \"Looking up account for activity ID #{act}\"\n begin\n raw = policy_api.get(act, header_params)\n id = raw.to_hash[:basicPolicyInfo][:accountId]\n STDOUT.puts \"Marking this policy: #{act} and this account: #{id} for deletion!\"\n #id = policy_api.policies_get_policy_activity_by_activity_id(act)[:AccountId]\n accounts_needing_removed << id unless id.to_s.empty?\n id unless id.to_s.empty?\n msg = \"#{id}\\n\"\n File.write(file_to_save, msg, mode: 'a')\n rescue Exception => ex\n STDOUT.puts \"Failed to fetch accounts from activity #{act} #{ex.message}\"\n end\n end\n end", "def update_activities(arr)\n self.activities.destroy_all\n arr.each do |atts|\n self.activities.create!(atts.merge({\n :start_at => sync_time(atts[:start_at]),\n :end_at => sync_time(atts[:end_at])\n }))\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @opportunity = Opportunity.new(opportunity_params)\n @opportunity.organisation = @organisation\n\n unless opportunity_params[:new_activity].blank?\n activity = Activity.find_by_title(opportunity_params[:new_activity])\n if activity.nil?\n activity = Activity.new(:title => opportunity_params[:new_activity])\n activity.save\n end\n @opportunity.activity = activity\n end\n\n unless opportunity_params[:new_sub_activity].blank?\n sub_activity = @opportunity.activity.sub_activities.find_by_title(opportunity_params[:new_sub_activity])\n if sub_activity.nil?\n sub_activity = @opportunity.activity.sub_activities.new(:title => opportunity_params[:new_sub_activity])\n sub_activity.save\n end\n @opportunity.sub_activity = sub_activity\n end\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity }\n else\n @activities = Activity.all\n @sub_activities = []\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @course = Course.find(params[:course_id])\n @activity = @course.activities.build(params[:activity])\n @participants = @activity.participants.collect\n @activity.participants = []\n respond_to do |format|\n if @activity.save\n save_participants\n format.html { redirect_to( course_path(params[:course_id]), :notice => 'Lista de presença salva com sucesso') }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n @javascript_hash = @course.participants_as_javascript_hash\n 80.times { @activity.participants.build }\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:type)\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:user_id, :category_id, :name, :due_date, :description, :priority, :order)\n end", "def user_activity\n device_id = request.headers['device_id']\n string = request.body.read\n activity = ActiveSupport::JSON.decode(string)\n a_ids = []\n if !activity.empty?\n begin\n activity.each do |a|\n if a['user_id'].nil?\n a['device_id'] = device_id\n end\n id = a['event_id']\n a.delete('event_id')\n logger.info\"=====#{a}\"\n UserActivity.create(a)\n a_ids << id\n end\n rescue Exception => e\n logger.info \"===Exception in creating usage #{e}\"\n # @error = \"#{e.message} for #{e.try(:record).try(:class).try(:name)}\"\n end\n respond_to do |format|\n format.json { render json: a_ids }\n end\n end\n\nend", "def set_activities_list\n @activities_list = ActivitiesList.find(params[:id])\n end", "def activity_params\n params.require(:activity).permit(:reference, :name, :user_id, :start_time, :end_time, :sport, :owner, :entry, :is_proxy)\n end", "def activity_params\n params.require(:activity).permit(:issue_id, :activity_id, :date_time, :activity_type, :activity_note, :hours, :minutes, :entered_by)\n end", "def create\n @activities_list = ActivitiesList.new(activities_list_params)\n\n respond_to do |format|\n if @activities_list.save\n format.html { redirect_to @activities_list, notice: 'Activities list was successfully created.' }\n format.json { render :show, status: :created, location: @activities_list }\n else\n format.html { render :new }\n format.json { render json: @activities_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.fetch(:activity, {})\n end", "def create\n #奖项设置\n unless activity_award_cfg_params.blank?\n @activity_award_cfg = ActivityAwardCfg.new(activity_award_cfg_params) \n\n respond_to do |format|\n if @activity_award_cfg.save\n @activity = Activity.new\n format.html { redirect_to admin_activities_path(show_page: Const::ACTIVITY_SHOW_PAGE[:award]) }\n else\n\n end\n end\n end\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activity_params\n params[:activity]\n end", "def create\n @activity = @activity_type.activity_class.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_path(@activity_type.table_name, @activity), notice: \"#{@activity_type.name.humanize} was successfully created.\" }\n format.json { render :show, status: :created, location: @activity }\n format.js { render :create }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n format.js { render :new }\n end\n end\n end", "def add_activity(data)\n add_child('activity', data)\n end", "def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_activity(activity)\n create_or_update(activity, nil,\n 'activity', 'activities')\n end", "def create\n @activity = Activity.new(params[:activity])\n @activity[:user_id] = current_user.id\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_path, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body(response)\n end", "def create\n authorize ExternalActivity\n @external_activity = ExternalActivity.new(external_activity_strong_params(params[:external_activity]))\n @external_activity.user = current_visitor\n\n if params[:update_material_properties]\n # set the material_properties tags\n @external_activity.material_property_list = (params[:material_properties] || [])\n end\n\n if params[:update_cohorts]\n # set the cohorts\n @external_activity.set_cohorts_by_id(params[:cohort_ids] || [])\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @external_activity.grade_level_list = (params[:grade_levels] || [])\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @external_activity.subject_area_list = (params[:subject_areas] || [])\n end\n\n if params[:update_sensors]\n # set the sensor tags\n @external_activity.sensor_list = (params[:sensors] || [])\n end\n\n if params[:update_projects]\n # set the projects\n @external_activity.projects = Admin::Project.where(id: params[:project_ids] || [])\n end\n\n if params[:update_external_reports]\n # set the external reports\n @external_activity.external_report_ids= (params[:external_reports] || [])\n end\n\n respond_to do |format|\n if @external_activity.save\n format.js # render the js file\n flash['notice'] = 'ExternalActivity was successfully created.'\n format.html { redirect_to(@external_activity) }\n format.xml { render :xml => @external_activity, :status => :created, :location => @external_activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @external_activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @type_activity = TypeActivity.new(type_activity_params)\n\n respond_to do |format|\n if @type_activity.save\n format.html { redirect_to @type_activity, notice: 'Type activity was successfully created.' }\n format.json { render :show, status: :created, location: @type_activity }\n else\n format.html { render :new }\n format.json { render json: @type_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params[:activity]\n end", "def kind\n :activity\n end", "def create\n @external_activity = ExternalActivity.new(params[:external_activity])\n @external_activity.user = current_visitor\n\n if params[:update_cohorts]\n # set the cohort tags\n @external_activity.cohort_list = (params[:cohorts] || [])\n end\n\n respond_to do |format|\n if @external_activity.save\n format.js # render the js file\n flash[:notice] = 'ExternalActivity was successfully created.'\n format.html { redirect_to(@external_activity) }\n format.xml { render :xml => @external_activity, :status => :created, :location => @external_activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @external_activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def dev_activity_params\n params.require(:dev_activity).permit(:user_id, :dev_type, :activity_completed_at, :time_taken, :development_subject, :self_directed, :key_learning_point)\n end", "def activity\n end", "def activity_params\n params[:activity].permit(:title, :description, :pdf_url, :case_id)\n end", "def apply_activity_params\n params.require(:apply_activity).permit(:open_id, :activity_id)\n end", "def create\n @step_activity = StepActivity.new(params[:step_activity])\n\n respond_to do |format|\n if @step_activity.save\n format.html { redirect_to @step_activity, notice: 'Step activity was successfully created.' }\n format.json { render json: @step_activity, status: :created, location: @step_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step_activity.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6811024", "0.6766937", "0.63630164", "0.6263741", "0.6192873", "0.6184391", "0.60916066", "0.60900486", "0.6074553", "0.60535264", "0.59931517", "0.59700567", "0.5950243", "0.59490144", "0.5913923", "0.586265", "0.58443826", "0.5834276", "0.5823087", "0.5748127", "0.5738983", "0.57323205", "0.57138455", "0.5711995", "0.5700542", "0.56808627", "0.5678987", "0.56764317", "0.5653744", "0.5646749", "0.5646187", "0.56408155", "0.5627256", "0.56095666", "0.5599375", "0.55949956", "0.55870426", "0.5582737", "0.5580053", "0.55781394", "0.5573417", "0.5572934", "0.5553779", "0.55430084", "0.55291045", "0.5521053", "0.55209786", "0.5514678", "0.55126095", "0.5492032", "0.5488242", "0.54878974", "0.5468417", "0.5467218", "0.5462039", "0.5460593", "0.5456869", "0.54555017", "0.54555017", "0.5455149", "0.5454984", "0.5450751", "0.5447653", "0.54468316", "0.5438918", "0.54374194", "0.5427742", "0.5423038", "0.5422547", "0.5420729", "0.54176885", "0.5415825", "0.54129785", "0.5403576", "0.53974116", "0.5396726", "0.5396589", "0.5383517", "0.5383517", "0.53800327", "0.5368835", "0.5367515", "0.53650284", "0.5364903", "0.536469", "0.536469", "0.5359474", "0.53589636", "0.5355899", "0.5354099", "0.5349282", "0.5347456", "0.5340605", "0.53397644", "0.53335536", "0.5330671", "0.53264683", "0.5321449", "0.5319886", "0.53186256" ]
0.73101914
0
PATCH/PUT /backend/conf_activities/1 PATCH/PUT /backend/conf_activities/1.json
def update respond_to do |format| if @backend_conf_activity.update(backend_conf_activity_params) format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully updated.' } format.json { render :show, status: :ok, location: backend_conf_activity_path(@backend_conf_activity) } else format.html { render :edit } format.json { render json: @backend_conf_activity.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n @activity.status = Activity::SETTED if @activity.setting?\n if @activity.update(activity_params)\n format.html { redirect_to activities_url, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_backend_conf_activity\n @backend_conf_activity = Conf::Activity.find(params[:id])\n end", "def update\n @activity = Activity.where(:user_id => current_user.id).find(params[:id])\n\n respond_to do |format|\n if params[:activity][:force_update]\n \n params[:activity][:force_update] = nil\n @activity.completed = params[:activity][:completed]\n \n if @activity.save(:validate => false)\n flash[:success] = \"Activity updated\"\n format.html { redirect_to(request.env[\"HTTP_REFERER\"]) }\n format.xml { head :ok }\n end\n \n elsif @activity.update_attributes(params[:activity])\n flash[:success] = \"Activity updated\"\n \n format.js { render :text => 'OK' }\n format.html { redirect_to( activities_path , :success => 'Activity updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.js { render :text => 'KO' }\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n format.json { render :json => @activity.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 @app = App.find(params[:app_id])\n @activity = @app.activities.find(params[:id])\n\n if params[:cancel_edit_activity_button]\n respond_to do |format|\n format.html do\n if request.xhr? \n render :partial => 'shared/activity', :locals => { :activity => @activity }\n else\n redirect_to apps_url\n end\n end\n \n format.xml { head :ok }\n end\n \n return\n end\n\n @vscm = Brazil::AppSchemaVersionControl.new(:vc_type => Brazil::AppSchemaVersionControl::TYPE_SUBVERSION, :vc_path => @app.vc_path, :vc_uri => ::AppConfig.vc_uri) \n @base_versions = @vscm.find_versions(params[:arg])\n @base_versions << Activity::NO_BASE_VERSION if @base_versions.count == 0\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html do\n if request.xhr?\n render :partial => \"shared/activity\", :locals => {:activity => @activity}\n else\n redirect_to app_activity_path(@app, @activity)\n end\n end\n format.xml { head :ok }\n else\n format.html do\n if request.xhr?\n render :action => \"edit\", :layout => false, :status => :unprocessable_entity\n else\n render :action => \"edit\"\n end\n end\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n #remove all existed contents first\n @activity.activity_contents.destroy_all\n activity_contents = JSON.parse(params[:activity][:activity_contents])\n activity_contents.each do |content|\n ActivityContent.create(activity_id: @activity.id,\n sport_option: content[\"sport_option\"],\n quantity: content[\"quantity\"])\n end\n format.html {redirect_to @activity, notice: 'Activity was successfully updated.'}\n format.json {render :show, status: :ok, location: @activity}\n format.js {render 'users/create_activity'}\n else\n format.html {render :edit}\n format.json {render json: @activity.errors, status: :unprocessable_entity}\n format.js {render 'activities/create', layout: false, content_type: 'text/javascript'}\n end\n end\n end", "def update\n if @activity.nil?\n send_error_json( @activity.id, \"Param 'activity' missing\", 400)\n return\n end\n\n fav = true\n if params['activity'].nil? || params['activity']['favourite'].nil? || params['activity']['favourite']=='false'\n fav = false\n end\n update_hash = {:favourite => fav}\n\n if params['activity'] && params['activity']['intensity']\n update_hash[:intensity] = params['activity']['intensity'].to_f\n end\n\n if params['activity'] && params['activity']['group']\n update_hash[:group] = params['activity']['group']\n end\n\n if params['activity'] && params['activity']['name']\n at = ActivityType.where(name: params['activity']['name']).first\n if !at.nil?\n update_hash[:activity_type_id] = at.id\n else\n send_error_json(@activity.id, \"Invalid activity type\", 400)\n return\n end\n end\n\n if @activity.update_attributes(update_hash)\n send_success_json(@activity.id)\n else\n send_error_json(@activity.id, @activity.errors.full_messages.to_sentence, 400)\n end\n\n end", "def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end", "def update\n cancel = params[:commit] == \"Cancel\"\n @external_activity = ExternalActivity.find(params[:id])\n authorize @external_activity\n\n if params[:update_material_properties]\n # set the material_properties tags\n @external_activity.material_property_list = (params[:material_properties] || [])\n @external_activity.save\n end\n\n if params[:update_cohorts]\n # set the cohort tags\n @external_activity.set_cohorts_by_id(params[:cohort_ids] || [])\n @external_activity.save\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @external_activity.grade_level_list = (params[:grade_levels] || [])\n @external_activity.save\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @external_activity.subject_area_list = (params[:subject_areas] || [])\n @external_activity.save\n end\n\n if params[:update_sensors]\n # set the sensor tags\n @external_activity.sensor_list = (params[:sensors] || [])\n @external_activity.save\n end\n\n if params[:update_projects]\n # set the projects\n @external_activity.projects = Admin::Project.where(id: params[:project_ids] || [])\n @external_activity.save\n end\n\n if params[:update_external_reports]\n # set the external reports\n @external_activity.external_report_ids= (params[:external_reports] || [])\n @external_activity.save\n end\n\n respond_to do |format|\n # allow for params[:external_activity] to not exist while other update_* params to update\n if !params[:external_activity] || @external_activity.update(external_activity_strong_params(params[:external_activity]))\n flash['notice'] = 'ExternalActivity was successfully updated.'\n # redirect to browse path instead of show page since the show page is deprecated\n format.html { redirect_to(browse_external_activity_path(@external_activity)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @external_activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dev_activity.update(dev_activity_params)\n format.html { redirect_to @dev_activity, notice: 'The Development Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dev_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def backend_conf_activity_params\n params.require(:conf_activity).permit(:attendee_id, :event_id, :happened_at)\n end", "def update\n cancel = params[:commit] == \"Cancel\"\n @activity = Activity.find(params[:id])\n authorize @activity\n\n if params[:update_material_properties]\n # set the material_properties tags\n @activity.material_property_list = (params[:material_properties] || [])\n @activity.save\n end\n\n if params[:update_cohorts]\n # set the cohort tags\n @activity.set_cohorts_by_id(params[:cohort_ids] || [])\n @activity.save\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @activity.grade_level_list = (params[:grade_levels] || [])\n @activity.save\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @activity.subject_area_list = (params[:subject_areas] || [])\n @activity.save\n end\n\n if request.xhr?\n if cancel || @activity.update_attributes(params[:activity])\n render :partial => 'shared/activity_header', :locals => { :activity => @activity }\n else\n render :xml => @activity.errors, :status => :unprocessable_entity\n end\n else\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n for i in 0..@activity.objectives.length()-1\n objective = @activity.objectives[i]\n objective.is_done = params[:objective][i.to_s()]\n objective.save!\n end\n format.html { redirect_to planslink_path(@activity.plan.family_group.id), notice: '¡Actividad actualizada!.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to activities_path, notice: 'Exercise event was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to project_activity_url(@project, @activity), notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @conf = Conf.find(params[:id])\n\n respond_to do |format|\n if @conf.update_attributes(params[:conf])\n format.html { redirect_to @conf, notice: 'Conf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @google_account_activity.update(google_account_activity_params)\n format.html { redirect_to google_account_activities_path }\n response = {status: 200}\n format.json { render json: response, status: response[:status] }\n else\n format.html { render action: 'edit' }\n format.json { render json: @google_account_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def sync_setting_update\n \n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in sync_setting_update\"\n begin\n params.permit!\n\n schedule_time = (params[\"sync_setting\"][\"schedule_time\"] == nil)? [] : params[\"sync_setting\"][\"schedule_time\"]\n if schedule_time.present?\n id=params[:id]\n else\n id=params[\"sync_setting\"][\"id\"]\n end\n\n\n data= SyncSetting.find(id).update(job_name: params[\"sync_setting\"][\"job_name\"], schedule: params[\"sync_setting\"][\"schedule\"], schedule_period: params[\"sync_setting\"][\"schedule_period\"],schedule_time: schedule_time, last_sync:params[\"last_sync\"])\n \n render json: data\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} sync_setting_controller sync_setting_update method\" }\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to activities_path, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [@course, @learning_unit, @activity], notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_activities!\n _, _, host, = URI.split url\n PublicActivity::Activity.where(trackable: self).update_all(\n parameters: {\n namespace_id: namespace.id,\n namespace_name: namespace.clean_name,\n webhook_url: url,\n webhook_host: host\n }\n )\n end", "def update\n # make sure that user have access to activity else raise execption\n current_user.user_activities.find(params[:id])\n \n # re query from database beacuse user_activities call have joins operation that make the record readony\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activity_path(@activity), notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @active_launchable_activities = args[:active_launchable_activities] if args.key?(:active_launchable_activities)\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @status_activity.update(status_activity_params)\n format.html { redirect_to @status_activity, notice: 'Status activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @status_activity }\n else\n format.html { render :edit }\n format.json { render json: @status_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @workflow\n respond_to do |format|\n if @workflow.update(workflow_params)\n @workflow.create_activity(:update, owner: current_user) if @workflow.log_update_activity?\n format.html { redirect_to @workflow, notice: 'Workflow was successfully updated.' }\n format.json { render :show, status: :ok, location: @workflow }\n else\n format.html { render :edit }\n format.json { render json: @workflow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:success] = 'Activity was successfully updated.'\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @supported_activities = args[:supported_activities] if args.key?(:supported_activities)\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", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n redirect = group_activity_path(@group, @activity)\n redirect = edit_group_activity_path(@group, @activity) if params.key?('commit-continue')\n\n format.html do\n redirect_to redirect\n flash_message(:info, I18n.t('activities.updated'))\n end\n format.json { render :show, status: :ok, location: @activity }\n else\n set_edit_parameters!\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # make sure that user have access to activity else raise execption\n # current_user.user_activities.find(params[:id])\n \n # re query from database beacuse user_activities call have joins operation that make the record readony\n @activity = Activity.find(params[:id])\n params[:activity][:date] = change_date_format(params[:activity][:date]) if !(params[:activity][:date]).blank?\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activity_path(@activity), notice: 'Data was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [:phone, @activity], notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @activity = args[:activity] if args.key?(:activity)\n @activity_type = args[:activity_type] if args.key?(:activity_type)\n @full_resource_name = args[:full_resource_name] if args.key?(:full_resource_name)\n @observation_period = args[:observation_period] if args.key?(:observation_period)\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to current_user, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n @activity.update_attribute(:enabled,params[:activity][:enabled])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to([:manage, @activity]) }\n format.xml { head :ok }\n else\n format.html { render :activity => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project_activity.update(project_activity_params)\n format.html { redirect_to @project_activity, notice: 'Project activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_activity }\n else\n format.html { render :edit }\n format.json { render json: @project_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @step_activity = StepActivity.find(params[:id])\n\n respond_to do |format|\n if @step_activity.update_attributes(params[:step_activity])\n format.html { redirect_to @step_activity, notice: 'Step activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n if params.has_key?('hidden-activity') and params['hidden-activity'].has_key?('tag_list')\n \tparams[:activity][:tag_list] = params['hidden-activity'][:tag_list]\n end\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n \n if @activity.created_at < 1.day.ago\n \tauthorize! :edit, @activity\n end\n end", "def update\n respond_to do |format|\n if @task.update(task_params)\n @task.whenever_reset unless task_params[:every].blank? && task_params[:at].blank?\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to activities_path(@activity_type.table_name, @activity.id), notice: \"#{@activity_type.name.humanize} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @activity }\n format.js { render :update }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n format.js { render :edit }\n end\n end\n end", "def update\n # only the owner can edit his / her activity\n if current_user.id == @activity.user_id\n respond_to do |format|\n if @activity.update(activity_params)\n format.json { render :json => {:success=>true, :message=>\"Activity was successfully updated.\"} }\n else\n format.json { render :json => {:success=>false, :message=>\"Something went wrong. Could not update activity.\"} }\n end\n end\n else\n respond_to do |format|\n format.json { render :json => {:success=>false, :message=>\"You are not the owner of this activity.\"} }\n end\n end\n end", "def update_activity(id:, **args)\n params = parameters(args) do\n optional_params :subject, :type, :done, :due_date, :due_time, :duration, :user_id, :deal_id, :person_id, :participants, :org_id, :note\n end\n request(:put, \"activities/#{id}\", params)\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\n @my_activity = MyActivity.find(params[:id])\n\n respond_to do |format|\n if @my_activity.update_attributes(params[:my_activity])\n #format.html { redirect_to @my_activity, notice: 'My activity was successfully updated.' }\n #format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @backend_conf_activity = Conf::Activity.new(backend_conf_activity_params)\n\n respond_to do |format|\n if @backend_conf_activity.save\n format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully created.' }\n format.json { render :show, status: :created, location: backend_conf_activity_path(@backend_conf_activity) }\n else\n format.html { render :new }\n format.json { render json: @backend_conf_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n# format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.html { redirect_to \"/activities/nanjingstart\", notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:presentacion][:activo]\n id = params[:id]\n Presentacion.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n @activity_type = ActivityType.find(params[:id])\n\n respond_to do |format|\n if @activity_type.update_attributes(params[:activity_type])\n format.html { redirect_to @activity_type, notice: 'Activity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [@group, @activity], notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity_kind.update(activity_kind_params)\n format.html { redirect_to @activity_kind, notice: 'Activity kind was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity_kind }\n else\n format.html { render :edit }\n format.json { render json: @activity_kind.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @extension_activity\n respond_to do |format|\n if @extension_activity.update!(extension_activity_params)\n format.html { redirect_to @extension_activity, notice: 'La dedicación se ha modificado correctamente.' }\n format.json { render :show, status: :ok, location: @extension_activity }\n else\n @extension_activity_types = ExtensionActivityType.all\n format.html { render :edit }\n format.json { render json: @extension_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @conf.update(conf_params)\n format.html { redirect_to @conf, notice: 'Conf was successfully updated.' }\n format.json { render :show, status: :ok, location: @conf }\n else\n format.html { render :edit }\n format.json { render json: @conf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @conf.update(conf_params)\n format.html { redirect_to @conf, notice: 'Conf was successfully updated.' }\n format.json { render :show, status: :ok, location: @conf }\n else\n format.html { render :edit }\n format.json { render json: @conf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @backend_conf_event.update(backend_conf_event_params)\n format.html { redirect_to backend_conf_event_path(@backend_conf_event), notice: 'Conf event was successfully updated.' }\n format.json { render :show, status: :ok, location: backend_conf_event_path(@backend_conf_event) }\n else\n format.html { render :edit }\n format.json { render json: @backend_conf_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n respond_to do |format|\n if @apply_activity.update(apply_activity_params)\n format.html { redirect_to @apply_activity, notice: 'Apply activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @apply_activity }\n else\n format.html { render :edit }\n format.json { render json: @apply_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @breadcrumb = 'update'\n @activity = Activity.find(params[:id])\n @activity.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity,\n notice: (crud_notice('updated', @activity) + \"#{undo_link(@activity)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n params = opportunity_params\n\n unless params[:new_activity].blank?\n activity = Activity.find_by_title(params[:new_activity])\n if activity.nil?\n activity = Activity.new(:title => params[:new_activity])\n activity.save\n end\n params[:activity_id] = activity.id\n end\n\n unless params[:new_sub_activity].blank?\n sub_activity = @opportunity.activity.sub_activities.find_by_title(params[:new_sub_activity])\n if sub_activity.nil?\n sub_activity = @opportunity.activity.sub_activities.new(:title => params[:new_sub_activity])\n sub_activity.save\n end\n params[:sub_activity_id] = sub_activity.id\n end\n respond_to do |format|\n if @opportunity.update(params)\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully updated.' }\n format.json { render :show, status: :ok, location: @opportunity }\n else\n @activities = Activity.all\n @sub_activities = @opportunity.activity.sub_activities.order(:title)\n format.html { render :edit }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n\n @client.redirect_urls << client_params[:add_redirect_url] if client_params[:add_redirect_url]\n \n @client.app_ids << BSON::ObjectId.new.to_s if client_params[:add_app_id]\n \n \n @client.versioned_update({\"redirect_urls\" => 1, \"app_ids\" => 1})\n\n if @client.op_success?\n render \"show\"\n else\n render \"edit\"\n end\n \n end", "def update\n respond_to do |format|\n if @complex_task.update(complex_task_params)\n format.html { redirect_to @complex_task, notice: 'Complex task was successfully updated.' }\n format.json { render :show, status: :ok, location: @complex_task }\n else\n format.html { render :edit }\n format.json { render json: @complex_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n @attcategories = Attcategory.find(:all)\n \n duration = params[:activity_hours].to_i * 60\n duration += params[:activity_minutes].to_i\n \n args = params[:activity].merge!({\"duration\" => duration})\n \n # Work around - initialize attributes to zero every\n # time before filling them back in\n @activity.update_attributes(:actattribute_ids => [])\n\n respond_to do |format|\n if @activity.update_attributes(args)\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n cancel = params[:commit] == \"Cancel\"\n @external_activity = ExternalActivity.find(params[:id])\n\n if params[:update_cohorts]\n # set the cohort tags\n @external_activity.cohort_list = (params[:cohorts] || [])\n @external_activity.save\n end\n\n if request.xhr?\n if cancel || @external_activity.update_attributes(params[:external_activity])\n render :partial => 'shared/external_activity_header', :locals => { :external_activity => @external_activity }\n else\n render :xml => @external_activity.errors, :status => :unprocessable_entity\n end\n else\n respond_to do |format|\n if @external_activity.update_attributes(params[:external_activity])\n flash[:notice] = 'ExternalActivity was successfully updated.'\n format.html { redirect_to(@external_activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @external_activity.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @workflow.update(workflow_params)\n format.json { render json: @workflow, :layout => false }\n else\n #format.json { render json: @workflow.errors, status: :unprocessable_entity, :layout => false }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n flash[:success] = 'Activity was successfully updated.'\n correct_execution format, :ok\n else\n error_execution format, :edit\n end\n end\n end", "def update\n if @day.update(update_params)\n render json: @day, include: [:activities]\n else \n render json: @day.errors\n end\n end", "def update!(**args)\n @activity_title = args[:activity_title] if args.key?(:activity_title)\n @co_activity_app = args[:co_activity_app] if args.key?(:co_activity_app)\n end", "def update\n respond_to do |format|\n if @activities_list.update(activities_list_params)\n format.html { redirect_to @activities_list, notice: 'Activities list was successfully updated.' }\n format.json { render :show, status: :ok, location: @activities_list }\n else\n format.html { render :edit }\n format.json { render json: @activities_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n \n @act = Act.find(params[:id])\n\n respond_to do |format|\n if @act.update_attributes(params[:act])\n format.html { redirect_to acts_path, notice: 'act was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @act.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n activo = params[:lab_far][:activo]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n LabFar.where(laboratorio_id: id, farmacium_id:farmacia_id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n respond_to do |format|\n if @activity_award_cfg.update(activity_award_cfg_params)\n format.html { redirect_to [:admin, @activity_award_cfg], notice: 'Activity award cfg was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity_award_cfg.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 respond_to do |format|\n if @type_activity.update(type_activity_params)\n format.html { redirect_to @type_activity, notice: 'Type activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_activity }\n else\n format.html { render :edit }\n format.json { render json: @type_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def update\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activities_path }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors.to_xml }\n end\n end\n end", "def set_activity_by_cid( id, work )\n url = \"#{self.url}/cid/#{id}/activity?auth=#{self.authtoken}\"\n payload = self.construct_activity_payload( work )\n status, response = rest_put( url, payload )\n return status, response['update_code'] if ok?( status ) && response['update_code']\n return status, ''\n end", "def update_activity_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.update_activity ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ActivitiesApi.update_activity\"\n end\n # resource path\n local_var_path = \"/activities/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'activity_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'ActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#update_activity\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @activity_type_f.update(activity_type_f_params)\n format.html { redirect_to @activity_type_f, notice: 'Activity type f was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity_type_f }\n else\n format.html { render :edit }\n format.json { render json: @activity_type_f.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n attachment = Attachment.find_by!(:slug => params[:id],\n :conversation_id => current_account.conversation_ids + [nil])\n\n if params[:task_list] and !params[:task_list][:tasks].empty?\n attachment.update_attribute(:tasks, params[:task_list][:tasks])\n end\n\n render :json => attachment\n end", "def update\n if @activity\n if @activity.delete\n head :no_content\n else\n head :gone\n end\n else\n head :unprocessable_entity\n end\n\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(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def update\n @question = Question.find(params[:question_id])\n respond_to do |format|\n if @question.update(question_params)\n @question.create_activity :update, owner: (current_user)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_task.update(api_task_params)\n format.html { redirect_to @api_task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_task }\n else\n format.html { render :edit }\n format.json { render json: @api_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n intent_request = @api_ai_client.create_intents_request\n response = intent_request.update(@category.intent_id, param_options)\n\n if response.is_a?(Hash) && response[:status][:code].eql?(200)\n\n contexts_templates = { contexts: category_params[:contexts].split(\",\"), templates: category_params[:templates].split(\",\") }\n\n if @category.update(category_params.merge(contexts_templates))\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n else\n @notice = response.message\n\n format.html { render :new }\n format.json { render json: { error: response.message }, status: response.code}\n end\n end\n end" ]
[ "0.6343709", "0.6178252", "0.61266", "0.6083994", "0.6046057", "0.59535855", "0.5950184", "0.5949612", "0.5922814", "0.58745855", "0.5852685", "0.58491933", "0.58481866", "0.5836546", "0.5828746", "0.5822278", "0.5822278", "0.5822278", "0.5822278", "0.5822278", "0.5818107", "0.5750931", "0.5741383", "0.573764", "0.57255554", "0.5723413", "0.5715084", "0.57130796", "0.5705949", "0.5705601", "0.570362", "0.569681", "0.5690683", "0.56877804", "0.56827134", "0.56778115", "0.56762266", "0.56762266", "0.56762266", "0.5670527", "0.5665366", "0.5665077", "0.56607425", "0.5660487", "0.5656575", "0.56539476", "0.5649904", "0.56394625", "0.56390977", "0.5638404", "0.56278276", "0.56187844", "0.5606727", "0.560627", "0.5590597", "0.5585136", "0.5582703", "0.5581595", "0.5579039", "0.55786854", "0.5570312", "0.5560285", "0.55591106", "0.5558657", "0.5547009", "0.5542202", "0.55392706", "0.55346334", "0.55328035", "0.5530056", "0.5529237", "0.55246884", "0.55228394", "0.55192244", "0.55186135", "0.55171007", "0.55168283", "0.5513645", "0.5509307", "0.55081207", "0.5487735", "0.5484488", "0.548173", "0.5480284", "0.5478373", "0.54744285", "0.5473493", "0.54722863", "0.54722863", "0.5470113", "0.54595387", "0.54579324", "0.5444381", "0.5444275", "0.5441369", "0.5440804", "0.54359895", "0.5434038", "0.54327536", "0.54190475" ]
0.7072661
0
DELETE /backend/conf_activities/1 DELETE /backend/conf_activities/1.json
def destroy @backend_conf_activity.destroy respond_to do |format| format.html { redirect_to backend_conf_activities_url, notice: 'Conf activity was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @dev_activity.destroy\n respond_to do |format|\n format.html { redirect_to dev_activities_url }\n format.json { head :no_content }\n end\n end", "def delete_activity(db, act_id)\n\tdb.execute(\"DELETE FROM activities WHERE id=?\", [act_id])\nend", "def destroy\n @conf = Conf.find(params[:id])\n @conf.destroy\n\n respond_to do |format|\n format.html { redirect_to confs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_award_cfg.destroy\n respond_to do |format|\n format.html { redirect_to admin_activity_award_cfgs_url, notice: 'Activity award cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n if @activity.nil?\n send_error_json(nil, \"Delete error\", 400)\n return\n end\n\n currid = @activity.id\n\n if @activity.destroy\n send_success_json(currid, {})\n else\n send_error_json(currid, \"Delete error\", 400)\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n conf.delete 'dashboard'\n end", "def destroy\n conf.delete 'api'\n end", "def destroy\n @step_activity = StepActivity.find(params[:id])\n @step_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to step_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @conf.destroy\n respond_to do |format|\n format.html { redirect_to confs_url, notice: 'Conf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @conf.destroy\n respond_to do |format|\n format.html { redirect_to confs_url, notice: 'Conf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_activity = MyActivity.find(params[:id])\n @my_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to my_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = current_user.activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :ok }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to :back}\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\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 @activity.destroy\n respond_to do |format|\n format.html { redirect_to project_activities_url(@project), notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy \n @activity = current_user.user_activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n end\n end", "def destroy \n @activity = current_user.user_activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_activity.destroy\n respond_to do |format|\n format.html { redirect_to status_activities_url, notice: 'Status activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_configuration = MyConfiguration.find(params[:id])\n @my_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to my_configurations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Exercise event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to [@course, @learning_unit], notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @current_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to api_activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to team_activities_path(@team) }\n format.json { head :no_content }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @activity_notice.destroy\n respond_to do |format|\n format.html { redirect_to activity_notices_url }\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => :plan_chart }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to phone_activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_intent(base_path)\n delete_json(intent_url(base_path))\n rescue GdsApi::HTTPNotFound => e\n e\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html {redirect_to activities_url, notice: 'Activity was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_group_url(@group) }\n format.json { head :no_content }\n end\n end", "def destroy\n @activite = Activite.find(params[:id])\n @activite.destroy\n\n respond_to do |format|\n format.html { redirect_to activites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @extension_activity\n @extension_activity.destroy\n respond_to do |format|\n format.html { redirect_to extension_activities_url, notice: 'La dedicación de ha eliminado correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @judge_activity.destroy\n respond_to do |format|\n format.html { redirect_to judge_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @backend_conf_event.destroy\n respond_to do |format|\n format.html { redirect_to backend_conf_events_url, notice: 'Conf event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cfg.destroy\n respond_to do |format|\n format.html { redirect_to cfgs_url, notice: 'Cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete_activities\n self.activities.delete_all\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html do\n flash[:success] = 'Activity was successfully destroyed.'\n redirect_to activities_url\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_sequence = ActivitySequence.find(params[:id]) \n strategy = @activity_sequence.strategy\n @activity_sequence.destroy\n\n respond_to do |format|\n if (strategy.type == \"UserStrategy\")\n # assumes can only remove activity form activity sequence in course\n format.html { redirect_to myp_path, notice: \"Activity Sequence were successfully deleted\" }\n format.json { head :no_content }\n else\n # assumes can only remove activity form activity sequence in course\n format.html { redirect_to course_plan_edit_path(course), notice: \"Activity was successfully deleted\" }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @activity_type = ActivityType.find(params[:id])\n @activity_type.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sm_backend_config = SmBackendConfig.find(params[:id])\n @sm_backend_config.destroy\n\n respond_to do |format|\n format.html { redirect_to sm_backend_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = current_user.activities.find(params[:id])\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end", "def destroy\n @activity_log.destroy\n respond_to do |format|\n format.html { redirect_to activity_logs_url, notice: 'Activity log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to([:manage, activities_url]) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_path(@activity_type.table_name), notice: \"#{@activity_type.name.humanize} was successfully deleted.\" }\n format.json { head :no_content }\n format.js { render :destroy }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n \n respond_to do |format|\n format.html { redirect_to activities_url }\n format.xml { render :nothing => true }\n end\n end", "def destroy\n @backend_stat = Backend::Stat.find(params[:id])\n @backend_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to backend_stats_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project_activity.destroy\n respond_to do |format|\n format.html { redirect_to project_activities_url, notice: 'Project activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activities_list.destroy\n respond_to do |format|\n format.html { redirect_to activities_lists_url, notice: 'Activities list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @graphium_configuration.destroy\n respond_to do |format|\n format.html { redirect_to graphium_configurations_url, notice: 'Configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n activity_type.destroy\n respond_to do |format|\n format.html { redirect_to activity_types_url, notice: 'activity_type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_with_http_info(policy_activity_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyActivitiesApi.delete ...'\n end\n # verify the required parameter 'policy_activity_id' is set\n if @api_client.config.client_side_validation && policy_activity_id.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_activity_id' when calling PolicyActivitiesApi.delete\"\n end\n # resource path\n local_var_path = '/v1/policy_activities/{policyActivityId}'.sub('{' + 'policyActivityId' + '}', policy_activity_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Bearer']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyActivitiesApi#delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n if Activity.exists?(uuid: params[:id])\n @activity = Activity.find_by(uuid: params[:id])\n @activity.destroy\n end\n end", "def destroy\n #@activity = Activity.find(params[:id])\n @activity = Activity.find_by_permalink(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity_category.destroy\n respond_to do |format|\n format.html { redirect_to activity_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def destroy\n @confrence = Confrence.find(params[:id])\n @confrence.destroy\n\n respond_to do |format|\n format.html { redirect_to confrences_url }\n format.json { head :no_content }\n end\n end", "def delete_activities(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'activities', params)\n end", "def destroy\n @activity.destroy\n @title = Title.find(@activity[:title_id])\n @event = Event.find(@title[:event_id])\n respond_to do |format|\n format.html { redirect_to event_path(@event), notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # activity categories should be marked inactive rather than deleted\n # this method does NOT delete the activity category\n # @activity_category.destroy\n respond_to do |format|\n format.html { redirect_to activity_categories_url, notice: 'Activity category not deleted' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_type_f.destroy\n respond_to do |format|\n format.html { redirect_to activity_type_fs_url, notice: 'Activity type f was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy_activity\n @activity = Activity.find(params[:id])\n @activity.destroy\n end", "def destroy\n @activity_kind.destroy\n respond_to do |format|\n format.html { redirect_to activity_kinds_url, notice: 'Activity kind was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_activity(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:delete, \"activities/#{id}\", params)\n end", "def destroy\n @course = Course.find(params[:id])\n @course.create_activity :delete, owner: current_user\n @course.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path(current_user), notice: 'Course was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @configuration_key.destroy\n respond_to do |format|\n format.html { redirect_to configuration_keys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @type_activity.destroy\n respond_to do |format|\n format.html { redirect_to type_activities_url, notice: 'Type activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @evactivity = Evactivity.find(params[:id])\n @evactivity.destroy\n\n respond_to do |format|\n format.html { redirect_to(evactivities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @connector = Connector.find(params[:id])\n @connector.destroy unless @connector.nil?\n\n respond_to do |format|\n format.html { render 'status/index'}\n format.json { render nothing: true }\n end\n\n push_app_status\n\n end", "def destroy\n @doc_type_am_configuration = DocTypeAmConfiguration.find(params[:id])\n @doc_type_am_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to doc_type_am_configurations_url }\n format.json { head :ok }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end" ]
[ "0.6913661", "0.67800796", "0.67069674", "0.6680008", "0.66371924", "0.65827173", "0.65827173", "0.65827173", "0.65827173", "0.65827173", "0.6514017", "0.65045214", "0.64559835", "0.6423752", "0.6423752", "0.6419196", "0.64056045", "0.64056045", "0.64015996", "0.63698447", "0.63568264", "0.6346791", "0.6333884", "0.6333884", "0.6333884", "0.6333884", "0.6331695", "0.632984", "0.632984", "0.6324854", "0.6314921", "0.6295712", "0.6294834", "0.62851495", "0.62836325", "0.62701356", "0.6264005", "0.6255157", "0.6243058", "0.62425977", "0.62425977", "0.62425977", "0.62425977", "0.62425977", "0.62425977", "0.62423277", "0.6241315", "0.62123305", "0.6200673", "0.61978745", "0.61914885", "0.61849153", "0.6181851", "0.6167995", "0.6165201", "0.6145594", "0.6142516", "0.61368555", "0.61368364", "0.6135393", "0.61339575", "0.61316323", "0.6130243", "0.6129421", "0.6124437", "0.61220205", "0.61156845", "0.611495", "0.611431", "0.6108795", "0.6108371", "0.61065924", "0.61063945", "0.610632", "0.60997224", "0.6096987", "0.60948503", "0.60898644", "0.60898644", "0.60898644", "0.60898644", "0.6088196", "0.60866374", "0.6085465", "0.60765433", "0.6073534", "0.6066896", "0.60668445", "0.60577464", "0.60541755", "0.6053149", "0.6053097", "0.60475016", "0.6044788", "0.60428095", "0.6041388", "0.60408354", "0.6040158", "0.60396785", "0.60342425" ]
0.7667125
0
Use callbacks to share common setup or constraints between actions.
def set_backend_conf_activity @backend_conf_activity = Conf::Activity.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def backend_conf_activity_params params.require(:conf_activity).permit(:attendee_id, :event_id, :happened_at) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \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 model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def 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 url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004", "0.6290563", "0.6284484", "0.62436926", "0.6239928", "0.62184125", "0.62158304", "0.6210187", "0.6194002", "0.61786795", "0.61759156", "0.617342", "0.6162248", "0.61528504", "0.61527", "0.6146735", "0.6122714", "0.61169004", "0.61082125", "0.61052656", "0.6091036", "0.60807735", "0.6070328", "0.60634184", "0.60213035", "0.6017676", "0.6013606", "0.601112", "0.6007318", "0.6007318", "0.6001461", "0.6001135", "0.59966296", "0.5992013", "0.59919006", "0.599182", "0.5980991", "0.59676576", "0.5960269", "0.59588194", "0.59585214", "0.59578323", "0.5953503", "0.5952524", "0.59432703", "0.5939858", "0.59388995", "0.59388995", "0.5933866", "0.5930038", "0.5925672", "0.5924214", "0.59169805", "0.59106255", "0.5910254", "0.59086037", "0.5906149", "0.5898294", "0.58981514", "0.5896171", "0.58944154", "0.58943397", "0.5892325", "0.5887239", "0.58842856", "0.5880209", "0.5874584", "0.58694917", "0.5868719", "0.58669394", "0.5866552", "0.58662945", "0.5864085", "0.58623236", "0.5862258", "0.58597904", "0.58579135", "0.58542645", "0.5853335", "0.58517563", "0.5850614" ]
0.0
-1
Override to ensure compatibility with Tree::TreeNode.
def term self.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child_node=(_); end", "def child_node; end", "def get_tree_adaptor\n raise NotImplementedError\n end", "def for_node; end", "def tree\r\n @rootNode\r\n end", "def parsed_tree; end", "def root_node; end", "def leaf?; false end", "def tree\n Tree.new(self)\n end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def tree\n\n h.updated_tree || h.original_tree\n end", "def is_leaf\n true\n end", "def is_leaf\n true\n end", "def make_tree_for(position)\n root = TreeNode.new(nil, position)\n\n\nend", "def get_tree_source\n raise NotImplementedError\n end", "def tree\n @tree ||= build_tree\n end", "def tree\n h.updated_tree || h.original_tree\n end", "def node()\n self.root.node()\n end", "def leaf?; @leaf; end", "def valid_tree?\n false\n end", "def node=(_); end", "def node=(_); end", "def raw_node; end", "def node_type; end", "def node_type; end", "def is_valid_tree(tree)\n\nend", "def same_tree(node)\n same_tree_support(self.root, node)\n end", "def valid_tree?\n true\n end", "def valid_tree?\n true\n end", "def show_tree\n\tend", "def children=(node_or_tags); end", "def children=(node_or_tags); end", "def leaf(node, tag)\r\n end", "def tree\n root = Node.new(1)\n root.left = Node.new(2)\n root.right = Node.new(3)\n root.left.left = Node.new(4)\n root.left.right = Node.new(5)\n root.right.left = Node.new(6)\n root.right.right = Node.new(7)\n root.right.right.right = Node.new(8)\n root\nend", "def mirror_tree\n mirror_tree_support(self.root)\n display_support(self.root)\n end", "def test_add_node_to_self_as_child\n root = Tree::TreeNode.new(\"root\")\n\n # Lets check the direct parentage scenario\n assert_raise(ArgumentError) {root << root}\n\n # And now a scenario where the node addition is done down the hierarchy\n # @todo This scenario is not yet fixed.\n child = Tree::TreeNode.new(\"child\")\n root << child << root\n # puts root # This will throw a stack trace\n end", "def to_node\n self\n end", "def ascii_tree; end", "def allowed_type?(parent_node); end", "def node\r\n\t\t\tparent\r\n\t\tend", "def initialize(semantic_value, *types)\n super(types)\n raise ArgumentError, \"Semantic value of leaf nodes may not be a Node\"\\\n if Node===semantic_value\n @semantic_value = semantic_value\n end", "def build_tree(arr)\n\tend", "def touch\n get_leaf_nodes.each do |leaf|\n leaf.parent.touch\n end\n end", "def Node(value)\n case value\n when Node\n value\n else\n Node.new(value)\n end\nend", "def valid_tree?\n true\n end", "def node\n @node\n end", "def node\n @node\n end", "def node=(_arg0); end", "def parent=(parent_node); end", "def parent=(parent_node); end", "def leaf?\n true\n end", "def convert(tree, options = T.unsafe(nil)); end", "def update_tree(element); end", "def wrap_node_with_error(tree)\n new_tree = [:error, tree.dup]\n tree.replace(new_tree)\n end", "def nodes; end", "def nodes; end", "def nodes; end", "def new_node\n\t\t\traise NotImplementedError.new('#new_node must be implemented')\n\t\tend", "def create_node(t)\n raise NotImplementedError\n end", "def render_tag_tree(tree_node=@tree.root)\n string = \" \" * 2 * tree_node.depth\n string += \"<#{tree_node.info.type}\"\n string += \" class=#{tree_node.info.classes}\" unless tree_node.info.classes.nil?\n string += \" id=#{tree_node.info.id}\" unless tree_node.info.id.nil?\n string += \" name=#{tree_node.info.name}\" unless tree_node.info.name.nil?\n string += \">\"\n string += \" #{tree_node.info.text}\"\n puts string\n\n tree_node.children.each do |child|\n render_tag_tree(child)\n end\n end", "def node; changeset.node; end", "def nodes_field\n define_nodes_field\n end", "def create_tree(node, elem, level, parent)\n node.level = level\n elemtype = check_type(elem[1])\n case elemtype\n when \"array\"\n node.kind = \"array\"\n node.arrsize = elem[1][\".array_size\"].to_i\n if elem[1].has_key?(\".subtype\") && elem[1][\".subtype\"].has_key?(\".members\")\n elem[1][\".subtype\"][\".members\"].each do |m|\n x = Tree.new(m[0], item_type(elem[1]), node)\n node.create_child(x)\n create_tree(x, m, level+1, node)\n end\n if elem[1][\".subtype\"].has_key?(\".type_or_id_name\")\n elem[1][\".subtype\"][\".type_or_id_name\"] =~ /\\((.+)\\): (\\w+)/\n node.s_u_name = $2.clone\n else\n node.s_u_name = \"__ANON__\"\n end\n node.basetype = node.data = elem[1][\".subtype\"][\".type\"].clone\n else\n subkind = check_type(elem[1][\".subtype\"])\n case subkind\n when \"enum\"\n node.basetype = \"enum\"\n node.data = {\".type\" => elem[1][\".subtype\"][\".type\"]}\n node.data[\".type_or_id_name\"] = elem[1][\".subtype\"][\".type_or_id_name\"]\n arr = []\n elem[1][\".subtype\"][\".values\"].each { |k,v| arr << [k,v] }\n node.data[\".values\"] = arr.clone\n node.data[\".values\"].sort! { |a,b| a[1] <=> b[1] }\n when \"numeric_ose\", \"boolean\"\n elem[1][\".subtype\"][\".type_or_id_name\"] =~ /\\((.+)\\): (\\w+)/\n node.basetype = $2.clone\n when \"native\", \"numeric_other\"\n node.basetype = \"OTHER\"\n node.data = {\".type\" => elem[1][\".subtype\"][\".type\"]}\n if elem[1][\".subtype\"].has_key?(\".signed\")\n node.data[\".signed\"] = elem[1][\".subtype\"][\".signed\"] \n end\n if elem[1][\".subtype\"].has_key?(\".type_or_id_name\")\n node.data[\".type_or_id_name\"] = elem[1][\".subtype\"][\".type_or_id_name\"]\n end\n end\n node.leaf = true\n end\n when \"struct\", \"union\"\n node.kind = elemtype\n if is_anon?(elem[1])\n node.s_u_name = \"__ANON__\"\n else\n node.s_u_name = item_name(elem[1])\n end\n elem[1][\".members\"].each do |m|\n x = Tree.new(m[0], item_type(elem[1]), node)\n node.create_child(x)\n create_tree(x, m, level+1, node)\n end\n when \"enum\"\n node.kind = \"enum\"\n node.basetype = \"enum\"\n node.s_u_name = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n arr = []\n elem[1][\".values\"].each { |k,v| arr << [k,v] }\n node.data = arr.clone\n node.data.sort! { |a,b| a[1] <=> b[1] }\n when \"numeric_ose\"\n node.kind = \"numeric\"\n node.basetype = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n when \"boolean\"\n node.kind = \"boolean\"\n node.basetype = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n when \"native\", \"numeric_other\"\n node.kind = \"numeric\"\n node.basetype = \"OTHER\"\n node.data = {'.type' => elem[1][\".type\"]}\n node.data[\".signed\"] = elem[1][\".signed\"] if elem[1].has_key?(\".signed\")\n if elem[1].has_key?(\".type_or_id_name\")\n node.data[\".type_or_id_name\"] = elem[1][\".type_or_id_name\"]\n end\n node.parent = parent\n node.leaf = true\n else\n raise \"Node #{node.name} contains erroneous data\" \n end\n end", "def node=(val)\r\n case val\r\n when Node, NilClass\r\n @node = val\r\n end\r\n end", "def mirror_tree_support(node)\n return if node.nil?\n tmp = node.left\n node.left = node.right\n node.right = tmp\n mirror_tree_support(node.left)\n mirror_tree_support(node.right)\n end", "def show_tree\n\t\t@root_node.show\n\tend", "def trees_to_html(trees)\nend", "def node(node)\n true\n end", "def tree(node, *children, **typed_children)\n children += children_for(typed_children)\n children = children.flatten.grep(Tree)\n infos = sub(0, node.start), sub(node.start, node.length), sub(node.stop..-1)\n description = Hansi.render(THEME[:green], node.type.to_s.tr(\"_\", \" \"))\n after = Hansi.render(TEMPLATE, *infos, theme: THEME, tags: true)\n Tree.new(description, *children, after: after, prefix_color: PREFIX_COLOR)\n end", "def method_missing method, *args\n @node.send method, *args\n end", "def tree_at_path(_path, with_attrs: true)\n raise NotImplementedError\n end", "def apply_transform(tree)\n raise \"Abstract method called\"\n end", "def tree(data_path, options = {})\n\t\t\t\tresult = \"\"\n\n\t\t\t\t# Unique hash\n\t\t\t\t@hash = Digest::SHA1.hexdigest(data_path.to_s)\n\n\t\t\t\t# Options\n\t\t\t\t@options = options.nil? ? {} : options\n\n\t\t\t\t# Clipboard\n\t\t\t\tif @options[:clipboard_attrs]\n\t\t\t\t\tclipboard = true\n\t\t\t\t\t@options[:clipboard_attrs] = [@options[:clipboard_attrs]] if !@options[:clipboard_attrs].is_a?(Array)\n\t\t\t\t\tclipboard_attrs_js = \"[\" + @options[:clipboard_attrs].map { |item| \"'#{item}'\" }.join(\",\") + \"]\"\n\t\t\t\telse\n\t\t\t\t\tclipboard = false\n\t\t\t\t\tclipboard_attrs_js = \"[]\"\n\t\t\t\tend\n\n\t\t\t\t# Actions\n\t\t\t\tif @options[:actions]\n\t\t\t\t\tactions_js = \"[\"\n\t\t\t\t\toptions[:actions].each do |key, action|\n\t\t\t\t\t\tactions_js += %{\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\turl: '#{action[:path] ? @path_resolver.resolve(action[:path], \":id\") : \"\"}',\n\t\t\t\t\t\t\t\ticon: '#{action[:icon]}',\n\t\t\t\t\t\t\t\tlabel: '#{action[:label]}',\n\t\t\t\t\t\t\t\tcollapsed: #{action[:collapsed] == true ? \"true\" : \"false\"},\n\t\t\t\t\t\t\t\tstyle: '#{action[:style] ? action[:style] : \"default\"}',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tactions_js += \"]\"\n\t\t\t\telse\n\t\t\t\t\tactions_js = \"[]\"\n\t\t\t\tend\n\n\t\t\t\t# Parent\n\t\t\t\tparent = (options[:parent] ? options[:parent] : nil)\n\n\t\t\t\t# Save state\n\t\t\t\tsave_state = (options[:save_state] ? options[:save_state] : :simple)\n\n\t\t\t\t# Application JS\n\t\t\t\tresult += @template.javascript_tag(%{\n\t\t\t\t\tvar rug_tree_#{@hash} = null;\n\t\t\t\t\t$(document).ready(function() {\n\t\t\t\t\t\trug_tree_#{@hash} = new RugTree('#{@hash}', {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Model\n\t\t\t\t\t\t\tmodel: 'node',\n\n\t\t\t\t\t\t\t// State\n\t\t\t\t\t\t\tsaveState: '#{save_state.to_s}',\n\n\t\t\t\t\t\t\t// Parent element\n\t\t\t\t\t\t\tparent: '#{parent.to_s}',\n\n\t\t\t\t\t\t\t// Icons\n\t\t\t\t\t\t\tclosedIcon: '#{@icon_builder.render(@options[:closed_icon] ? @options[:closed_icon] : \"chevron-right\")}',\n\t\t\t\t\t\t\topenedIcon: '#{@icon_builder.render(@options[:opened_icon] ? @options[:opened_icon] : \"chevron-down\")}',\n\n\t\t\t\t\t\t\t// Show\n\t\t\t\t\t\t\tshow: #{check_show(@options) ? 'true' : 'false'},\n\t\t\t\t\t\t\tshowEvent: '#{@options[:show_event] && @options[:show_event].to_sym == :double_click ? \"dblclick\" : \"click\"}',\n\t\t\t\t\t\t\tshowUrl: '#{@path_resolver.resolve(@options[:paths][:show], \":id\")}',\n\n\t\t\t\t\t\t\t// Create\n\t\t\t\t\t\t\tcreate: #{check_create(@options) ? 'true' : 'false'}, \n\t\t\t\t\t\t\tcreateUrl: '#{@path_resolver.resolve(@options[:paths][:create])}',\n\t\t\t\t\t\t\tcreateIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"plus\")}',\n\t\t\t\t\t\t\tcreateLabel: '#{I18n.t(\"general.action.create_child\").upcase_first}',\n\t\t\t\t\t\t\tcreateActionCollapsed: #{@options[:create_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\tcreateSuccessMessage: '#{I18n.t(\"general.messages.create.success\")}',\n\n\t\t\t\t\t\t\t// Update\n\t\t\t\t\t\t\tupdate: #{check_update(@options) ? 'true' : 'false'}, \n\t\t\t\t\t\t\tupdateUrl: '#{@path_resolver.resolve(@options[:paths][:update], \":id\")}', \n\t\t\t\t\t\t\tupdateIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"pencil\")}',\n\t\t\t\t\t\t\tupdateLabel: '#{I18n.t(\"general.action.update\").upcase_first}',\n\t\t\t\t\t\t\tupdateActionCollapsed: #{@options[:update_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\tupdateSuccessMessage: '#{I18n.t(\"general.messages.create.success\")}',\n\n\t\t\t\t\t\t\t// Destroy\n\t\t\t\t\t\t\tdestroy: #{check_destroy(@options) ? 'true' : 'false'}, \n\t\t\t\t\t\t\tdestroyUrl: '#{@path_resolver.resolve(@options[:paths][:destroy], \":id\")}', \n\t\t\t\t\t\t\tdestroyIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"trash\")}',\n\t\t\t\t\t\t\tdestroyLabel: '#{I18n.t(\"general.action.destroy\").upcase_first}',\n\t\t\t\t\t\t\tdestroyActionCollapsed: #{@options[:destroy_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\tdestroyConfirmMessage: '#{I18n.t(\"general.are_you_sure\")}',\n\t\t\t\t\t\t\tdestroySuccessMessage: '#{I18n.t(\"general.messages.destroy.success\")}',\n\n\t\t\t\t\t\t\t// Moving\n\t\t\t\t\t\t\tmoving: #{check_moving(@options) ? 'true' : 'false'},\n\t\t\t\t\t\t\tmovingUrl: '#{@path_resolver.resolve(@options[:paths][:move], \":id\", \":relation\", \":destination_id\")}',\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Type\n\t\t\t\t\t\t\ttypeIconTemplate: '#{@icon_builder.render(\":icon\", class: \"jqtree-icon\")}',\n\t\t\t\t\t\t\ttypeIconAttr: '#{@options[:type_icon_attr]}',\n\n\t\t\t\t\t\t\t// Actions\n\t\t\t\t\t\t\tactions: #{actions_js},\n\t\t\t\t\t\t\tactionsIconTemplate: '#{@icon_builder.render(\":icon\")}',\n\n\t\t\t\t\t\t\t// Clipboard\n\t\t\t\t\t\t\tclipboard: #{clipboard ? 'true' : 'false'},\n\t\t\t\t\t\t\tclipboardIcon: '#{@icon_builder.render(@options[:clipboard_icon] ? @options[:clipboard_icon] : \"clipboard\")}',\n\t\t\t\t\t\t\tclipboardTemplate: \"#{clipboard ? (@options[:clipboard_template] ? @options[:clipboard_template].gsub('\"', \"'\") : \":\" + @options[:clipboard_attrs].first) : \"\"}\",\n\t\t\t\t\t\t\tclipboardAttrs: #{clipboard_attrs_js},\n\t\t\t\t\t\t\tclipboardActionCollapsed: #{@options[:clipboard_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Select\n\t\t\t\t\t\t\tselectByDefault: #{@options[:select_by_default] ? @options[:select_by_default].to_i : \"null\"},\n\n\t\t\t\t\t\t\t// Reload\n\t\t\t\t\t\t\treloadIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"refresh\")}',\n\t\t\t\t\t\t\treloadLabel: '#{I18n.t(\"general.action.reload\").upcase_first}',\n\t\t\t\t\t\t});\n\t\t\t\t\t\trug_tree_#{@hash}.ready();\n\t\t\t\t\t});\n\t\t\t\t\t$(document).on('turbolinks:load', function() {\n\t\t\t\t\t\trug_tree_#{@hash}.repair();\n\t\t\t\t\t});\n\t\t\t\t})\n\n\t\t\t\tresult += %{\n\t\t\t\t\t<div id=\"tree-#{@hash}\" data-url=\"#{data_path.to_s}\"></div>\n\t\t\t\t}\n\n\t\t\t\treturn result.html_safe\n\t\t\tend", "def add_node(current_node, v)\n left = current_node.left if current_node.left\n right = current_node.right if current_node.right\n current_node.left = TreeNode.new(v)\n current_node.right = TreeNode.new(v)\n current_node.left.left = left\n current_node.right.right = right\nend", "def to_ptree_enum\n # How to implement?\n # One visits the forest => beware of dependency\n # At each visited item create a corresponding tree node.\n # At end of visit & stack not empty\n # Re-generate another ptree\n end" ]
[ "0.64129406", "0.63605046", "0.63375276", "0.6200004", "0.61469805", "0.6072916", "0.6034564", "0.603018", "0.60122037", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.59725326", "0.59502673", "0.59502673", "0.5931565", "0.5916887", "0.58914125", "0.5853431", "0.5825332", "0.5798938", "0.5792248", "0.5777545", "0.5777545", "0.5776804", "0.5768001", "0.5768001", "0.574871", "0.57439345", "0.57386494", "0.57386494", "0.5714321", "0.5704978", "0.5704978", "0.5696178", "0.5672662", "0.5662043", "0.56498915", "0.5627266", "0.5620036", "0.5593439", "0.5580503", "0.5552482", "0.5546854", "0.55255675", "0.5484714", "0.5468698", "0.5467433", "0.5467433", "0.54616606", "0.54511017", "0.54511017", "0.54324234", "0.54258156", "0.54234594", "0.5421358", "0.5400876", "0.5400876", "0.5400876", "0.5400574", "0.53923994", "0.5387714", "0.5377849", "0.53499365", "0.5337576", "0.53274006", "0.53253305", "0.5313786", "0.5306953", "0.5299321", "0.5294701", "0.52851915", "0.5284336", "0.52789414", "0.5277412", "0.5275081", "0.52741474" ]
0.0
-1
Override to ensure compatibility with Tree::TreeNode.
def term_name self.content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child_node=(_); end", "def child_node; end", "def get_tree_adaptor\n raise NotImplementedError\n end", "def for_node; end", "def tree\r\n @rootNode\r\n end", "def parsed_tree; end", "def root_node; end", "def leaf?; false end", "def tree\n Tree.new(self)\n end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def tree\n\n h.updated_tree || h.original_tree\n end", "def is_leaf\n true\n end", "def is_leaf\n true\n end", "def make_tree_for(position)\n root = TreeNode.new(nil, position)\n\n\nend", "def get_tree_source\n raise NotImplementedError\n end", "def tree\n @tree ||= build_tree\n end", "def tree\n h.updated_tree || h.original_tree\n end", "def node()\n self.root.node()\n end", "def leaf?; @leaf; end", "def valid_tree?\n false\n end", "def node=(_); end", "def node=(_); end", "def raw_node; end", "def node_type; end", "def node_type; end", "def is_valid_tree(tree)\n\nend", "def same_tree(node)\n same_tree_support(self.root, node)\n end", "def valid_tree?\n true\n end", "def valid_tree?\n true\n end", "def show_tree\n\tend", "def children=(node_or_tags); end", "def children=(node_or_tags); end", "def leaf(node, tag)\r\n end", "def tree\n root = Node.new(1)\n root.left = Node.new(2)\n root.right = Node.new(3)\n root.left.left = Node.new(4)\n root.left.right = Node.new(5)\n root.right.left = Node.new(6)\n root.right.right = Node.new(7)\n root.right.right.right = Node.new(8)\n root\nend", "def mirror_tree\n mirror_tree_support(self.root)\n display_support(self.root)\n end", "def test_add_node_to_self_as_child\n root = Tree::TreeNode.new(\"root\")\n\n # Lets check the direct parentage scenario\n assert_raise(ArgumentError) {root << root}\n\n # And now a scenario where the node addition is done down the hierarchy\n # @todo This scenario is not yet fixed.\n child = Tree::TreeNode.new(\"child\")\n root << child << root\n # puts root # This will throw a stack trace\n end", "def to_node\n self\n end", "def ascii_tree; end", "def allowed_type?(parent_node); end", "def node\r\n\t\t\tparent\r\n\t\tend", "def initialize(semantic_value, *types)\n super(types)\n raise ArgumentError, \"Semantic value of leaf nodes may not be a Node\"\\\n if Node===semantic_value\n @semantic_value = semantic_value\n end", "def build_tree(arr)\n\tend", "def touch\n get_leaf_nodes.each do |leaf|\n leaf.parent.touch\n end\n end", "def Node(value)\n case value\n when Node\n value\n else\n Node.new(value)\n end\nend", "def valid_tree?\n true\n end", "def node\n @node\n end", "def node\n @node\n end", "def node=(_arg0); end", "def parent=(parent_node); end", "def parent=(parent_node); end", "def leaf?\n true\n end", "def convert(tree, options = T.unsafe(nil)); end", "def update_tree(element); end", "def wrap_node_with_error(tree)\n new_tree = [:error, tree.dup]\n tree.replace(new_tree)\n end", "def nodes; end", "def nodes; end", "def nodes; end", "def new_node\n\t\t\traise NotImplementedError.new('#new_node must be implemented')\n\t\tend", "def create_node(t)\n raise NotImplementedError\n end", "def render_tag_tree(tree_node=@tree.root)\n string = \" \" * 2 * tree_node.depth\n string += \"<#{tree_node.info.type}\"\n string += \" class=#{tree_node.info.classes}\" unless tree_node.info.classes.nil?\n string += \" id=#{tree_node.info.id}\" unless tree_node.info.id.nil?\n string += \" name=#{tree_node.info.name}\" unless tree_node.info.name.nil?\n string += \">\"\n string += \" #{tree_node.info.text}\"\n puts string\n\n tree_node.children.each do |child|\n render_tag_tree(child)\n end\n end", "def node; changeset.node; end", "def nodes_field\n define_nodes_field\n end", "def create_tree(node, elem, level, parent)\n node.level = level\n elemtype = check_type(elem[1])\n case elemtype\n when \"array\"\n node.kind = \"array\"\n node.arrsize = elem[1][\".array_size\"].to_i\n if elem[1].has_key?(\".subtype\") && elem[1][\".subtype\"].has_key?(\".members\")\n elem[1][\".subtype\"][\".members\"].each do |m|\n x = Tree.new(m[0], item_type(elem[1]), node)\n node.create_child(x)\n create_tree(x, m, level+1, node)\n end\n if elem[1][\".subtype\"].has_key?(\".type_or_id_name\")\n elem[1][\".subtype\"][\".type_or_id_name\"] =~ /\\((.+)\\): (\\w+)/\n node.s_u_name = $2.clone\n else\n node.s_u_name = \"__ANON__\"\n end\n node.basetype = node.data = elem[1][\".subtype\"][\".type\"].clone\n else\n subkind = check_type(elem[1][\".subtype\"])\n case subkind\n when \"enum\"\n node.basetype = \"enum\"\n node.data = {\".type\" => elem[1][\".subtype\"][\".type\"]}\n node.data[\".type_or_id_name\"] = elem[1][\".subtype\"][\".type_or_id_name\"]\n arr = []\n elem[1][\".subtype\"][\".values\"].each { |k,v| arr << [k,v] }\n node.data[\".values\"] = arr.clone\n node.data[\".values\"].sort! { |a,b| a[1] <=> b[1] }\n when \"numeric_ose\", \"boolean\"\n elem[1][\".subtype\"][\".type_or_id_name\"] =~ /\\((.+)\\): (\\w+)/\n node.basetype = $2.clone\n when \"native\", \"numeric_other\"\n node.basetype = \"OTHER\"\n node.data = {\".type\" => elem[1][\".subtype\"][\".type\"]}\n if elem[1][\".subtype\"].has_key?(\".signed\")\n node.data[\".signed\"] = elem[1][\".subtype\"][\".signed\"] \n end\n if elem[1][\".subtype\"].has_key?(\".type_or_id_name\")\n node.data[\".type_or_id_name\"] = elem[1][\".subtype\"][\".type_or_id_name\"]\n end\n end\n node.leaf = true\n end\n when \"struct\", \"union\"\n node.kind = elemtype\n if is_anon?(elem[1])\n node.s_u_name = \"__ANON__\"\n else\n node.s_u_name = item_name(elem[1])\n end\n elem[1][\".members\"].each do |m|\n x = Tree.new(m[0], item_type(elem[1]), node)\n node.create_child(x)\n create_tree(x, m, level+1, node)\n end\n when \"enum\"\n node.kind = \"enum\"\n node.basetype = \"enum\"\n node.s_u_name = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n arr = []\n elem[1][\".values\"].each { |k,v| arr << [k,v] }\n node.data = arr.clone\n node.data.sort! { |a,b| a[1] <=> b[1] }\n when \"numeric_ose\"\n node.kind = \"numeric\"\n node.basetype = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n when \"boolean\"\n node.kind = \"boolean\"\n node.basetype = item_name(elem[1])\n node.parent = parent\n node.leaf = true\n when \"native\", \"numeric_other\"\n node.kind = \"numeric\"\n node.basetype = \"OTHER\"\n node.data = {'.type' => elem[1][\".type\"]}\n node.data[\".signed\"] = elem[1][\".signed\"] if elem[1].has_key?(\".signed\")\n if elem[1].has_key?(\".type_or_id_name\")\n node.data[\".type_or_id_name\"] = elem[1][\".type_or_id_name\"]\n end\n node.parent = parent\n node.leaf = true\n else\n raise \"Node #{node.name} contains erroneous data\" \n end\n end", "def node=(val)\r\n case val\r\n when Node, NilClass\r\n @node = val\r\n end\r\n end", "def mirror_tree_support(node)\n return if node.nil?\n tmp = node.left\n node.left = node.right\n node.right = tmp\n mirror_tree_support(node.left)\n mirror_tree_support(node.right)\n end", "def show_tree\n\t\t@root_node.show\n\tend", "def trees_to_html(trees)\nend", "def node(node)\n true\n end", "def tree(node, *children, **typed_children)\n children += children_for(typed_children)\n children = children.flatten.grep(Tree)\n infos = sub(0, node.start), sub(node.start, node.length), sub(node.stop..-1)\n description = Hansi.render(THEME[:green], node.type.to_s.tr(\"_\", \" \"))\n after = Hansi.render(TEMPLATE, *infos, theme: THEME, tags: true)\n Tree.new(description, *children, after: after, prefix_color: PREFIX_COLOR)\n end", "def method_missing method, *args\n @node.send method, *args\n end", "def tree_at_path(_path, with_attrs: true)\n raise NotImplementedError\n end", "def apply_transform(tree)\n raise \"Abstract method called\"\n end", "def tree(data_path, options = {})\n\t\t\t\tresult = \"\"\n\n\t\t\t\t# Unique hash\n\t\t\t\t@hash = Digest::SHA1.hexdigest(data_path.to_s)\n\n\t\t\t\t# Options\n\t\t\t\t@options = options.nil? ? {} : options\n\n\t\t\t\t# Clipboard\n\t\t\t\tif @options[:clipboard_attrs]\n\t\t\t\t\tclipboard = true\n\t\t\t\t\t@options[:clipboard_attrs] = [@options[:clipboard_attrs]] if !@options[:clipboard_attrs].is_a?(Array)\n\t\t\t\t\tclipboard_attrs_js = \"[\" + @options[:clipboard_attrs].map { |item| \"'#{item}'\" }.join(\",\") + \"]\"\n\t\t\t\telse\n\t\t\t\t\tclipboard = false\n\t\t\t\t\tclipboard_attrs_js = \"[]\"\n\t\t\t\tend\n\n\t\t\t\t# Actions\n\t\t\t\tif @options[:actions]\n\t\t\t\t\tactions_js = \"[\"\n\t\t\t\t\toptions[:actions].each do |key, action|\n\t\t\t\t\t\tactions_js += %{\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\turl: '#{action[:path] ? @path_resolver.resolve(action[:path], \":id\") : \"\"}',\n\t\t\t\t\t\t\t\ticon: '#{action[:icon]}',\n\t\t\t\t\t\t\t\tlabel: '#{action[:label]}',\n\t\t\t\t\t\t\t\tcollapsed: #{action[:collapsed] == true ? \"true\" : \"false\"},\n\t\t\t\t\t\t\t\tstyle: '#{action[:style] ? action[:style] : \"default\"}',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tactions_js += \"]\"\n\t\t\t\telse\n\t\t\t\t\tactions_js = \"[]\"\n\t\t\t\tend\n\n\t\t\t\t# Parent\n\t\t\t\tparent = (options[:parent] ? options[:parent] : nil)\n\n\t\t\t\t# Save state\n\t\t\t\tsave_state = (options[:save_state] ? options[:save_state] : :simple)\n\n\t\t\t\t# Application JS\n\t\t\t\tresult += @template.javascript_tag(%{\n\t\t\t\t\tvar rug_tree_#{@hash} = null;\n\t\t\t\t\t$(document).ready(function() {\n\t\t\t\t\t\trug_tree_#{@hash} = new RugTree('#{@hash}', {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Model\n\t\t\t\t\t\t\tmodel: 'node',\n\n\t\t\t\t\t\t\t// State\n\t\t\t\t\t\t\tsaveState: '#{save_state.to_s}',\n\n\t\t\t\t\t\t\t// Parent element\n\t\t\t\t\t\t\tparent: '#{parent.to_s}',\n\n\t\t\t\t\t\t\t// Icons\n\t\t\t\t\t\t\tclosedIcon: '#{@icon_builder.render(@options[:closed_icon] ? @options[:closed_icon] : \"chevron-right\")}',\n\t\t\t\t\t\t\topenedIcon: '#{@icon_builder.render(@options[:opened_icon] ? @options[:opened_icon] : \"chevron-down\")}',\n\n\t\t\t\t\t\t\t// Show\n\t\t\t\t\t\t\tshow: #{check_show(@options) ? 'true' : 'false'},\n\t\t\t\t\t\t\tshowEvent: '#{@options[:show_event] && @options[:show_event].to_sym == :double_click ? \"dblclick\" : \"click\"}',\n\t\t\t\t\t\t\tshowUrl: '#{@path_resolver.resolve(@options[:paths][:show], \":id\")}',\n\n\t\t\t\t\t\t\t// Create\n\t\t\t\t\t\t\tcreate: #{check_create(@options) ? 'true' : 'false'}, \n\t\t\t\t\t\t\tcreateUrl: '#{@path_resolver.resolve(@options[:paths][:create])}',\n\t\t\t\t\t\t\tcreateIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"plus\")}',\n\t\t\t\t\t\t\tcreateLabel: '#{I18n.t(\"general.action.create_child\").upcase_first}',\n\t\t\t\t\t\t\tcreateActionCollapsed: #{@options[:create_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\tcreateSuccessMessage: '#{I18n.t(\"general.messages.create.success\")}',\n\n\t\t\t\t\t\t\t// Update\n\t\t\t\t\t\t\tupdate: #{check_update(@options) ? 'true' : 'false'}, \n\t\t\t\t\t\t\tupdateUrl: '#{@path_resolver.resolve(@options[:paths][:update], \":id\")}', \n\t\t\t\t\t\t\tupdateIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"pencil\")}',\n\t\t\t\t\t\t\tupdateLabel: '#{I18n.t(\"general.action.update\").upcase_first}',\n\t\t\t\t\t\t\tupdateActionCollapsed: #{@options[:update_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\tupdateSuccessMessage: '#{I18n.t(\"general.messages.create.success\")}',\n\n\t\t\t\t\t\t\t// Destroy\n\t\t\t\t\t\t\tdestroy: #{check_destroy(@options) ? 'true' : 'false'}, \n\t\t\t\t\t\t\tdestroyUrl: '#{@path_resolver.resolve(@options[:paths][:destroy], \":id\")}', \n\t\t\t\t\t\t\tdestroyIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"trash\")}',\n\t\t\t\t\t\t\tdestroyLabel: '#{I18n.t(\"general.action.destroy\").upcase_first}',\n\t\t\t\t\t\t\tdestroyActionCollapsed: #{@options[:destroy_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\tdestroyConfirmMessage: '#{I18n.t(\"general.are_you_sure\")}',\n\t\t\t\t\t\t\tdestroySuccessMessage: '#{I18n.t(\"general.messages.destroy.success\")}',\n\n\t\t\t\t\t\t\t// Moving\n\t\t\t\t\t\t\tmoving: #{check_moving(@options) ? 'true' : 'false'},\n\t\t\t\t\t\t\tmovingUrl: '#{@path_resolver.resolve(@options[:paths][:move], \":id\", \":relation\", \":destination_id\")}',\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Type\n\t\t\t\t\t\t\ttypeIconTemplate: '#{@icon_builder.render(\":icon\", class: \"jqtree-icon\")}',\n\t\t\t\t\t\t\ttypeIconAttr: '#{@options[:type_icon_attr]}',\n\n\t\t\t\t\t\t\t// Actions\n\t\t\t\t\t\t\tactions: #{actions_js},\n\t\t\t\t\t\t\tactionsIconTemplate: '#{@icon_builder.render(\":icon\")}',\n\n\t\t\t\t\t\t\t// Clipboard\n\t\t\t\t\t\t\tclipboard: #{clipboard ? 'true' : 'false'},\n\t\t\t\t\t\t\tclipboardIcon: '#{@icon_builder.render(@options[:clipboard_icon] ? @options[:clipboard_icon] : \"clipboard\")}',\n\t\t\t\t\t\t\tclipboardTemplate: \"#{clipboard ? (@options[:clipboard_template] ? @options[:clipboard_template].gsub('\"', \"'\") : \":\" + @options[:clipboard_attrs].first) : \"\"}\",\n\t\t\t\t\t\t\tclipboardAttrs: #{clipboard_attrs_js},\n\t\t\t\t\t\t\tclipboardActionCollapsed: #{@options[:clipboard_action_collapsed] == true ? 'true' : 'false'}, \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// Select\n\t\t\t\t\t\t\tselectByDefault: #{@options[:select_by_default] ? @options[:select_by_default].to_i : \"null\"},\n\n\t\t\t\t\t\t\t// Reload\n\t\t\t\t\t\t\treloadIcon: '#{@icon_builder.render(@options[:update_icon] ? @options[:update_icon] : \"refresh\")}',\n\t\t\t\t\t\t\treloadLabel: '#{I18n.t(\"general.action.reload\").upcase_first}',\n\t\t\t\t\t\t});\n\t\t\t\t\t\trug_tree_#{@hash}.ready();\n\t\t\t\t\t});\n\t\t\t\t\t$(document).on('turbolinks:load', function() {\n\t\t\t\t\t\trug_tree_#{@hash}.repair();\n\t\t\t\t\t});\n\t\t\t\t})\n\n\t\t\t\tresult += %{\n\t\t\t\t\t<div id=\"tree-#{@hash}\" data-url=\"#{data_path.to_s}\"></div>\n\t\t\t\t}\n\n\t\t\t\treturn result.html_safe\n\t\t\tend", "def add_node(current_node, v)\n left = current_node.left if current_node.left\n right = current_node.right if current_node.right\n current_node.left = TreeNode.new(v)\n current_node.right = TreeNode.new(v)\n current_node.left.left = left\n current_node.right.right = right\nend", "def to_ptree_enum\n # How to implement?\n # One visits the forest => beware of dependency\n # At each visited item create a corresponding tree node.\n # At end of visit & stack not empty\n # Re-generate another ptree\n end" ]
[ "0.64129406", "0.63605046", "0.63375276", "0.6200004", "0.61469805", "0.6072916", "0.6034564", "0.603018", "0.60122037", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.59725326", "0.59502673", "0.59502673", "0.5931565", "0.5916887", "0.58914125", "0.5853431", "0.5825332", "0.5798938", "0.5792248", "0.5777545", "0.5777545", "0.5776804", "0.5768001", "0.5768001", "0.574871", "0.57439345", "0.57386494", "0.57386494", "0.5714321", "0.5704978", "0.5704978", "0.5696178", "0.5672662", "0.5662043", "0.56498915", "0.5627266", "0.5620036", "0.5593439", "0.5580503", "0.5552482", "0.5546854", "0.55255675", "0.5484714", "0.5468698", "0.5467433", "0.5467433", "0.54616606", "0.54511017", "0.54511017", "0.54324234", "0.54258156", "0.54234594", "0.5421358", "0.5400876", "0.5400876", "0.5400876", "0.5400574", "0.53923994", "0.5387714", "0.5377849", "0.53499365", "0.5337576", "0.53274006", "0.53253305", "0.5313786", "0.5306953", "0.5299321", "0.5294701", "0.52851915", "0.5284336", "0.52789414", "0.5277412", "0.5275081", "0.52741474" ]
0.0
-1
Returns an array of the parents of this term.
def parentage get_parents unless @already_fetched_parents @already_fetched_parents = true super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parents\n @parents ||= parent ? parent.parents + Array(parent) : []\n end", "def get_parents\n return @parents\n end", "def ancestors\n parents = []\n\n this_parent = self.parent\n\n while this_parent != nil\n parents << this_parent\n this_parent = this_parent.parent\n end\n parents\n end", "def parents\n unless @parents\n @parents = []\n object = self\n while object.respond_to?(:parent) && object.parent\n @parents << object.parent\n object = object.parent\n end\n end\n @parents\n end", "def ancestors\n []\n end", "def get_parents( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_term\n from\n term_relationship tr\n join term as subject_term \ton tr.subject_term_pk = subject_term.term_pk\n join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk\n join term as object_term on tr.object_term_pk = object_term.term_pk\n where\n predicate_term.term_name in ('part_of','is_a','develops_from')\n and subject_term.identifier = ?\n SQL\n \n OLS_DB[ sql, node.term ].each do |row|\n parent = OntologyTerm.new( row[:parent_identifier], row[:parent_term] )\n parent << node\n get_parents( parent )\n end\n end", "def parents_and_self\n ret = []\n if self.parent\n ret.concat(self.parent.parents_and_self)\n end\n ret << self\n ret\n end", "def parents_and_self\n ret = []\n if self.parent\n ret.concat(self.parent.parents_and_self)\n end\n ret << self\n ret\n end", "def parents\n page, parents = self, Array.new\n while page.parent\n page = page.parent\n parents << page\n end\n parents\n end", "def parents\n\n TapirLogger.instance.log \"Finding parents for #{self}\"\n parents = []\n self.entity_mappings.each do |mapping|\n\n # Go through each associated entity mapping, and find mappings where the child_id is us \n # which means that the parent_id is some other entity, and it's a parent\n \n # the to_s is important, otherwise self.id returns a :Moped::BSON::ObjectId\n parents << mapping.get_parent if mapping.child_id == self.id.to_s \n\n # TODO - what happens if parent_id and child_id are the same. We'll\n # end up grabbing it. Could that break any assumptions?\n\n end\n parents\n end", "def parents_and_self\n ret = []\n ret.concat(parent.parents_and_self) if parent\n ret << self\n ret\n end", "def parents\n references\n end", "def ancestors\n parents + parents.map(&:ancestors).flatten\n end", "def ancestors \n \t\tres=parents\n \t\tparents.each {|c| res += c.ancestors}\n \t\treturn res.uniq\n \tend", "def ancestors\n []\n end", "def parents\n self.class.where(id: parent_ids)\n end", "def ancestors\n parent ? [parent, parent.ancestors].flatten : []\n end", "def getAllParents\n parents = []\n parent = self.getParentRec\n self_code = self.code.split('.')\n self_code.pop(1)\n while self_code.length > 0 do\n puts \"self_code: #{self_code}\"\n if parent.present?\n parents << parent\n parent = parent.getParentRec\n self_code.pop(1)\n else\n parents << nil\n self_code.pop(1)\n parent = Tree.where(\n tree_type_id: self.tree_type_id,\n version_id: self.version_id,\n subject_id: self.subject_id,\n grade_band_id: self.grade_band_id,\n code: self_code.join(\".\")\n ).first\n end\n end\n Rails.logger.debug(\"*** tree parents: #{parents.inspect}\")\n return parents\n end", "def parents\n if parent.nil?\n [self]\n else\n parent.parents + [self]\n end\n end", "def ancestors\n if parent.nil?\n []\n else\n parent.ancestors + [parent]\n end\n end", "def parents\n @key.nil? ? [] : [@group.parents, @group].compact.flatten\n end", "def ancestors\n parent ? [parent, *parent.ancestors].reverse : []\n end", "def parent_rel_ids\n rel = relationships\n if rel.kind_of?(Array) || rel.try(:loaded?)\n rel.reject { |x| x.ancestry.blank? }.collect(&:parent_id)\n else\n rel.where.not(:ancestry => [nil, \"\"]).select(:ancestry).collect(&:parent_id)\n end\n end", "def parents\n EarLogger.instance.log \"Finding parents for #{self}\"\n ObjectManager.instance.find_parents(self.id, self.class.to_s)\n end", "def references\n @parents.keys\n end", "def ancestors\n return [] if root?\n tree_search_class.find(self[tree_path_field])\n end", "def ancestors\n itr = self\n res = []\n until itr.top_level?\n itr = itr.parents.first\n res << itr\n end\n res\n end", "def ancestors_r(*args)\n # fetch all parents\n pending = [self]\n ans = []\n while !pending.empty?\n e = pending.pop\n e.parents(*args).each do |p|\n if !ans.include?(p)\n ans << p\n pending.push(p)\n end\n end\n end\n ans\n end", "def ancestors\n node_ancestors.map(&:ancestor)\n end", "def ancestors\n node, nodes = self, []\n nodes << node = node.parent while node.parent\n nodes\n end", "def parents\n anc = if @this.respond_to?(:ancestors)\n if @this.ancestors.include?(@this)\n @this.ancestors[1..-1]\n else\n # singletons have no doodle_parents (they're orphans)\n []\n end\n else\n @this.class.ancestors\n end\n anc.select{|x| x.kind_of?(Class)}\n end", "def ancestors\n ancestors = []\n current_ancestor = self\n \n while !current_ancestor.nil?\n \n if current_ancestor.respond_to?(:parent)\n ancestors << current_ancestor\n current_ancestor = current_ancestor.parent\n else\n current_ancestor = nil\n end\n \n end\n \n ancestors\n end", "def crumb_parents\n []\n end", "def parents\n parse!\n @parents\n end", "def ancestors\n node, nodes = self, []\n nodes << node = node.parent while node.parent\n nodes\n end", "def ancestors\n node, nodes = self, []\n nodes << node = node.parent while node.parent\n nodes\n end", "def ancestors_ids\n node, nodes = self, []\n while node.parent\n node = node.parent\n nodes << node.id\n end\n nodes\n end", "def parents\n check_commit\n @parents \n end", "def parents\n @parents ||= begin\n p = @repo.dirstate.parents\n p = [p[0]] if p[1] == NULL_ID\n p.map {|x| Changeset.new(@repo, x) }\n end\n end", "def parents\n options['parents'] || []\n end", "def all_parents\n parents(all: true)\n end", "def parents\n @parents || (parse! && @parents)\n end", "def ancestors\n @ancestors ||= parent ? parent.ancestors + [parent] : []\n end", "def find_all_parents\n end", "def parents(*args)\n find_parents(:all, *args)\n end", "def get_parents\n parents = Array.new\n seen = Hash.new\n\n current = self.id\n \n while current\n role = Role.find(current)\n if role \n if not seen.has_key?(role.id)\n parents << role\n seen[role.id] = true\n current = role.parent_id\n else\n current = nil\n end\n else\n current = nil\n end\n end\n\n return parents\n end", "def ancestors\n node, nodes = self, []\n nodes << node = node.parent while node.parent\n nodes\n end", "def ancestors\n node, nodes = self, []\n nodes << node = node.parent while node.parent\n nodes\n end", "def parent_ids\n if ancestor_ids.empty? then\n []\n else\n branches.map { |branch| cast_primary_key(branch.split('/').last) }.uniq\n end\n end", "def parents_by_nomenclature(otu)\n above = [ ]\n if otu.taxon_name_id\n TaxonName.ancestors_of(otu.taxon_name)\n .select('taxon_names.*, taxon_name_hierarchies.generations')\n .that_is_valid.joins(:otus)\n .distinct\n .reorder('taxon_name_hierarchies.generations DESC, taxon_names.cached_valid_taxon_name_id').each do |t|\n above.push [t.cached, t.otus.to_a] # TODO: to_a vs. pluck\n end\n end\n above\n end", "def ancestors\n \tif parent_name.blank?\n\t \tancestors = [] \n \telse\n \t\tp = Category.where(name: parent_name).first\n \t\tancestors = p.ancestors\n \t\tancestors << parent_name\n \tend\n \tancestors\n end", "def parents # rubocop:disable MethodLength\n return @_parents if defined?(@_parents)\n return @_parents = [::Object] if singleton_class?\n\n @_parents = []\n\n to_s.split('::').tap do |arr|\n arr.pop\n\n until arr.empty?\n @_parents << ::Object.const_get(arr.join('::'), false)\n arr.pop\n end\n\n @_parents << ::Object\n end\n\n @_parents.freeze\n end", "def parent\n map do |q|\n q.get_parent_element\n end\n end", "def ancestors\n @ancestors ||= [self] + (self.parent.try(:ancestors) || [])\n end", "def parents\n respond_to?(:collectionHasParent) ? collectionHasParent : []\n end", "def find_parents\n parents = {}\n\n # iterate through the set of tokens and identify each token's parent\n @untagged_tokens.each_with_index do |str|\n pat = @parsed_sentence.getAllNodesByWordPattern(str).to_a.first\n parent = @parsed_sentence.getParents(pat).to_a.first\n\n unless parent.nil?\n # extracting the name of the parent (since it is in the foramt-> \"name/POS\")\n parents[str] = parent.to_s.split(\"/\").first\n end\n end\n\n parents\n end", "def parents\n self.class.where('forestify_left_position < ?', self.forestify_left_position).where('forestify_right_position > ?', self.forestify_right_position)\n end", "def parents; end", "def parents\n in_edges.each{|e| e.src}\n end", "def pbt_parents\n if poly?\n Array[pbt_parent].compact\n else\n self.class.pbts.map do |i|\n try{ \"#{i}\".camelize.constantize.where(id: send(\"#{i}_id\")).first }\n end.compact\n end\n end", "def parents(target)\n\t\tancestors = [target]\n\t\tcurrent_ancestor = target\n\t\tmoves = []\n\t\tuntil current_ancestor==nil\n\t\t\tcurrent_ancestor = current_ancestor.parent\n\t\t\tancestors << current_ancestor unless current_ancestor.nil?\n\t\tend\n\t\tancestors.each {|node| moves << node.value}\n\t\treturn moves.reverse\n\tend", "def parents\n parent_objects(Dependency)\n end", "def hierarchy\n parents = []\n parent = self.parent\n\n while parent && !parent.parent_id.nil?\n parents << parent\n parent = parent.parent\n end\n\n return parents.reverse\n end", "def useful_parents\n ret_parents = self.parents\n if ret_parents[1].nil?\n if ret_parents[0].revision >= self.revision - 1\n ret_parents = []\n else\n ret_parents = [ret_parents[0]]\n end\n end\n ret_parents\n end", "def ancestors_through_parents(result = [self], start = self)\n if start.parent.nil?\n return result.reverse\n else\n result << start.parent\n ancestors_through_parents(result, start.parent)\n end\n end", "def parent_ids\n []\n end", "def ancestors\n self_and_ancestors - [self]\n end", "def parent_categories\n c = self\n categories = []\n until c.parent.blank? do\n c = c.parent\n categories.unshift c\n end\n categories\n end", "def parents\n return @parents if !@parents.nil?\n @parents = []\n path_components = self.path.split('/')\n path_components.each_with_index do |path,i|\n parent_path = path_components[0,i].join('/')\n @parents.push(PhotoCollection.find_by_path(parent_path)) if parent_path != ''\n end\n @parents.reverse!\n end", "def parent_ids(*args)\n return Array.wrap(parent_id(*args)) if use_ancestry?\n\n Relationship.resource_pairs(parent_rels(*args))\n end", "def parent_ids\n if ancestor_ids.empty? then\n nil\n else\n branches.map { |branch| cast_primary_key(branch.split('/').last) }\n end\n end", "def living_parents\n dirstate.parents.select {|p| p != NULL_ID }\n end", "def ancestors(labels=[])\n ancs = []\n if primary_label and !labels.include?(primary_label.id)\n ancs << primary_label\n ancs = primary_label.ancestors(labels << primary_label.id) + ancs\n end\n ancs\n end", "def ancestors\n end", "def ancestors\n self.root? ? [] : self.parent.ancestors_and_self\n end", "def parent_list\n parents = []\n if @attributes.key?('parentCollectionList') then\n parents = DSpaceObj.convert_value(nil, @attributes['parentCollectionList'])\n end\n if @attributes['parentCommunity'] then\n com = DSpaceObj.convert_value(nil, @attributes['parentCommunity'])\n parents << com if com\n end\n if @attributes.key?('parentCommunityList') then\n list = DSpaceObj.convert_value(nil, @attributes['parentCommunityList'])\n parents += list if list\n end\n parents\n end", "def parents(all: false)\n parents = []\n\n # Start with infrageneric and genus names.\n # Get rid of quoted words and ssp., var., f., etc.\n words = text_name.split - %w[group clade complex]\n words.pop\n until words.empty?\n name = words.join(\" \")\n words.pop\n next if name == text_name || name[-1] == \".\"\n\n parent = Name.best_match(name)\n parents << parent if parent\n return [parent] if !all && parent && !parent.deprecated\n end\n\n # Next grab the names out of the classification string.\n lines = try(&:parse_classification) || []\n lines.reverse_each do |(_line_rank, line_name)|\n parent = Name.best_match(line_name)\n parents << parent if parent\n return [parent] if !all && !parent.deprecated\n end\n\n # Get rid of deprecated names unless all the results are deprecated.\n parents.reject!(&:deprecated) unless parents.all?(&:deprecated)\n\n # Return single parent as an array for backwards compatibility.\n return parents if all\n return [] unless parents.any?\n\n [parents.first]\n end", "def parent_dependencies\n @parents\n end", "def matching_ancestors\n []\n end", "def ancestors; end", "def ancestors; end", "def ancestors; end", "def ancestors; end", "def parent_objects\n return [] if parents.empty?\n return @parent_objects if @parent_objects\n\n first = parent_models[0].find(parent_params[0])\n @parent_objects = [first]\n parent_params.zip(parents)[1..-1].inject(first) do |memo, arr|\n id, name = arr\n @parent_objects << memo.send(name.pluralize).find(id)\n end\n @parent_objects\n end", "def all_ancestor_ids\n ancestors.pluck(:id)\n end", "def current_parents\n self.class\n .for_target(self.target)\n .where(group_id: group_id)\n end", "def self_and_parents\n p = [self]\n parent = self.parent \n \n while parent do\n p << parent\n parent = parent.parent \n end\n p\n end", "def ancestors() end", "def self_and_ancestors\n \t\tres = [self] + self.ancestors\n \t\treturn res.uniq\n \tend", "def parents(*classes)\n result = []\n ancestor = self.parent\n until ancestor.nil?\n # Filter ancestors by class\n if classes.nil? || classes.empty? || classes.include?(ancestor.class)\n # If a block is given, it must return true for the ancestor to be included\n result.push(ancestor) unless block_given? && !yield(ancestor)\n end\n ancestor = ancestor.parent\n end\n result\n end", "def path\n result = []\n obj = self\n while obj\n result.unshift(obj.__parent_name)\n obj = obj.__parent_struct\n end\n result.shift # we alwas add a nil for one-after-the-root\n result\n end", "def ancestors(scope = {})\n self_and_ancestors(scope) - [self]\n end", "def parents\n return Resource.joins(:resource_hierarchies).where(\"child_resource_id = ?\", self.id)\n end", "def ancestors\n @ancestors ||=\n begin\n x = [ self ]\n if ss = superstate\n x.push(*ss.ancestors)\n end\n NamedArray.new(x.freeze, :state)\n end\n end", "def ancestors\n TreeNode.find(:all,\n :from => \"cms_treenode_ancestors(#{self.id}, #{AuthenticationModel.current_user}) tree_nodes\") rescue []\n end", "def ancestors\n self.class.ancestors_of(self)\n end", "def taxonomy_ids\n taxon_and_ancestors.map(&:taxonomy_id).flatten.uniq\n end", "def self_and_parent_menus(options={})\n\t\t\tarr = [self]\n\t\t\tfather = self.parent\n\t\t\twhile father.present?\n\t\t\t\tarr << father\n\t\t\t\tfather = father.parent\n\t\t\tend\n\n\t\t\treturn arr.reverse\n\t\tend", "def ancestor_ids\n read_attribute(self.base_class.ancestry_column).to_s.split(%r|[,/]|).uniq.map { |id| cast_primary_key(id) }\n end", "def get_parent_relation_keys(parent)\n parents = Array(parent)\n\n reflect_on_all_associations.inject([]) do |result, relation|\n result << relation.foreign_key if parents.include?(relation.name)\n\n result\n end\n end", "def ancestors\n @space.ancestors\n end" ]
[ "0.7702646", "0.76784796", "0.7666384", "0.7637204", "0.7487671", "0.74422425", "0.7316737", "0.7316485", "0.72727317", "0.7235021", "0.722944", "0.7174065", "0.7155565", "0.7148483", "0.7139109", "0.7110975", "0.70872486", "0.7056806", "0.70553386", "0.70390075", "0.70279646", "0.70224816", "0.6997149", "0.6981709", "0.6960433", "0.69481057", "0.69470847", "0.69197035", "0.688245", "0.6879468", "0.68759906", "0.6850328", "0.68463266", "0.6841035", "0.68406075", "0.68406075", "0.6824387", "0.6817903", "0.68143016", "0.68142474", "0.6806736", "0.6767278", "0.67502517", "0.67243606", "0.67075557", "0.66945124", "0.66717416", "0.66717416", "0.6663219", "0.6658911", "0.6653183", "0.66513246", "0.6649704", "0.66410893", "0.6625709", "0.66088295", "0.659515", "0.6594014", "0.6586246", "0.65524536", "0.65434486", "0.6520432", "0.65182304", "0.64779234", "0.646793", "0.6464289", "0.64443195", "0.64428276", "0.63970333", "0.63885367", "0.6386071", "0.6355136", "0.6342509", "0.6330738", "0.6312815", "0.6303835", "0.62980896", "0.6293643", "0.62750584", "0.6266749", "0.6266749", "0.6266749", "0.6266749", "0.62566024", "0.6242647", "0.6230469", "0.6211783", "0.6177316", "0.61679876", "0.61530215", "0.61345035", "0.61258215", "0.6123503", "0.6117426", "0.6116492", "0.61128074", "0.61001915", "0.6082732", "0.60800743", "0.60771614", "0.60758424" ]
0.0
-1
Returns the children of this term as a tree. Will include the current term as the 'root' of the tree.
def child_tree child_check child_tree = self.clone child_tree.removeFromParent! child_tree end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree\n return [self] if @children.empty?\n\n @children.each_with_object([self]) do |child, tree|\n tree.concat(child.tree)\n end\n end", "def get_children( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_term\n from\n term_relationship tr\n join term as subject_term on tr.subject_term_pk = subject_term.term_pk\n join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk\n join term as object_term on tr.object_term_pk = object_term.term_pk\n where\n predicate_term.term_name in ('part_of','is_a','develops_from')\n and object_term.identifier = ?\n SQL\n \n OLS_DB[sql,node.term].each do |row|\n child = OntologyTerm.new( row[:child_identifier], row[:child_term] )\n node << child\n end\n end", "def children\n children_tree.values\n end", "def children\n children_tree.values\n end", "def children\n tree_search_class.where(tree_parent_id_field => self._id).sort(self.class.tree_sort_order()).all\n end", "def children\n\t\treturn children_of @current_node\n\tend", "def all_child_terms\n get_all_child_lists\n return @all_child_terms\n end", "def get_children\n return children\n end", "def get_children\n return @children\n end", "def children\n node.children\n end", "def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end", "def tree_children\n\n tree[2]\n end", "def getAllChildren\n children = Tree.where(\"tree_type_id = ? AND version_id = ? AND subject_id = ? AND grade_band_id = ? AND code like ?\", tree_type_id, version_id, subject_id, grade_band_id, code+'.%')\n Rails.logger.debug(\"*** tree children: #{children.inspect}\")\n return children\n end", "def children\n NodeSetProxy.new(@node.children, self)\n end", "def children\n _children\n end", "def children\n NodeSetProxy.new(@node.children, self)\n end", "def children\n @children ||= {}.with_indifferent_access\n end", "def _children\n @children\n end", "def tree\n Tree.new(self)\n end", "def get_children()\n return @space.get_children()\n end", "def children\n [] if leaf?\n self.class.where('forestify_left_position > ?', self.forestify_left_position).where('forestify_right_position < ?', self.forestify_right_position)\n end", "def children\n @root.children & @initial_contents\n end", "def children\n list = NodeSet.new(document)\n document.decorate(list)\n\n first = self.child\n return list unless first # Empty list\n\n list << first unless first.blank?\n while first = first.next\n list << first unless first.blank?\n end\n list\n end", "def _children\n @children\n end", "def to_tree\n if term?\n [type, *args]\n else\n [type, *args.map(&:to_tree)]\n end\n end", "def children\n @children ||= begin\n nodes =\n if comment?\n []\n elsif defined?(@value.class::ParseTreeVisitor)\n @value.class::ParseTreeVisitor.new(@value, {}).children\n elsif @value.respond_to?(:nodelist)\n Array(@value.nodelist)\n else\n []\n end\n # Work around a bug in Liquid::Variable::ParseTreeVisitor that doesn't return\n # the args in a hash as children nodes.\n nodes = nodes.flat_map do |node|\n case node\n when Hash\n node.values\n else\n node\n end\n end\n nodes.map { |node| Node.new(node, self, @template) }\n end\n end", "def children\n @children ||= []\n end", "def trees\n contents.select { |v| v.kind_of? Tree }\n end", "def children\n []\n end", "def children\n []\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def all_children\n @all_children ||= children + children.inject([]) {|records, child| records + child.all_children}\n end", "def children\n entries\n end", "def get_children\n @children\n end", "def children\n result = []\n @children.each do |_, child_group|\n result.concat(child_group)\n end\n\n result\n end", "def deep_branch_children\n if self.branch?\n arr = []\n children.each do |child|\n if child.branch?\n arr.concat child.deep_branch_children\n end\n end\n arr.push self\n arr\n else\n nil # caller shouldn't be asking for branch children anyway\n end\n end", "def children\n children = []\n\n unless leaf?\n zipper = down\n children << zipper\n\n until zipper.last?\n zipper = zipper.next\n children << zipper\n end\n end\n\n children\n end", "def with_children\n [self].tap do |self_with_children|\n if children\n self_with_children.concat(child_nodes)\n end\n end\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:parent_column]} = #{self.id}\", :order => acts_as_nested_set_options[:left_column])\n end", "def get_all_child_lists\n child_check\n \n if @all_child_terms.nil? and @all_child_names.nil?\n @all_child_terms = []\n @all_child_names = []\n \n self.children.each do |child|\n @all_child_terms.push( child.term )\n @all_child_terms.push( child.all_child_terms )\n @all_child_names.push( child.term_name )\n @all_child_names.push( child.all_child_names )\n end\n \n @all_child_terms = @all_child_terms.flatten.uniq\n @all_child_names = @all_child_names.flatten.uniq\n end\n end", "def children\n []\n end", "def tree\n @tree ||= build_tree\n end", "def get_children\n \t@children\n end", "def children\n nested_set_class.find_with_nested_set_scope(:all, :conditions => \"#{nested_set_parent} = #{self.id}\", :order => nested_set_left)\n end", "def children\n Array.new\n end", "def children\n attributes.fetch(:children)\n end", "def children\n EarLogger.instance.log \"Finding children for #{self}\"\n ObjectManager.instance.find_children(self.id, self.class.to_s)\n end", "def subtrees!\n trees = Array.new\n subtrees {|tree| trees.push(tree)}\n return trees\n end", "def tree(node, *children, **typed_children)\n children += children_for(typed_children)\n children = children.flatten.grep(Tree)\n infos = sub(0, node.start), sub(node.start, node.length), sub(node.stop..-1)\n description = Hansi.render(THEME[:green], node.type.to_s.tr(\"_\", \" \"))\n after = Hansi.render(TEMPLATE, *infos, theme: THEME, tags: true)\n Tree.new(description, *children, after: after, prefix_color: PREFIX_COLOR)\n end", "def children\n self.class.children(self) \n end", "def children\n @children\n end", "def children\n @children\n end", "def children\n self.node.children.collect(&:content)\n end", "def subtrees\n yield self\n each do |child|\n if child.kind_of? Tree\n child.subtrees do |tree|\n yield tree\n end\n end\n end\n end", "def children\n kids = []\n each_child { |kid| kids << kid }\n kids\n end", "def children\n @ref.children.to_ruby\n end", "def children\n params[:scope] ||= \"private\"\n\n children = if params[:scope] == Scopes::SCOPE_PRIVATE\n @folder&.children ||\n current_user.nodes.where(parent_folder_id: nil)\n elsif params[:scope] == Scopes::SCOPE_PUBLIC\n @folder&.children ||\n Node.where(scope: params[:scope], parent_folder_id: nil)\n end\n\n if [Scopes::SCOPE_PRIVATE, Scopes::SCOPE_PUBLIC].include?(params[:scope])\n children = children.where.not(sti_type: \"Asset\")\n end\n\n children = children.where(scope: params[:scope]).order(:sti_type, :name)\n\n render json: children, root: \"nodes\", adapter: :json\n end", "def children_get()\n @children\n end", "def all_children\n children(all: true)\n end", "def descendants\n return [] if new_record?\n tree_search_class.where(tree_path_field => self._id).sort(self.class.tree_sort_order()).all\n end", "def code_tree\n kids = j_instance.getChildren\n\n kids.each_with_object([]) do |kid, acc|\n data = { type: kid.getType, parent_type: j_instance.getType, token: kid.toString }\n subtree = self.class.new(kid).code_tree\n data[:children] = subtree unless subtree.empty?\n acc << data\n end\n end", "def tree\r\n @rootNode\r\n end", "def all_children\n\n yielded_self = if block_given?\n yield self\n end\n\n return ( yielded_self || self ) if self.children.empty?\n _child = self.children.map do |child|\n _name = (yield child if block_given?) || self\n if child.children.empty?\n _name\n else\n [_name, child.all_children{ |this_child| yield this_child if block_given? }]\n end\n end\n return _child\n end", "def trees\n nests.map do |tree_instance|\n tree_isntance.tree\n end\n end", "def descendants\n children + children.map(&:children).flatten\n end", "def leaves\n #FIXME this is probably a bit newbish\n the_leaves = []\n each do |child|\n if child.kind_of? Tree\n the_leaves.push(child)\n else\n the_leaves = the leaves + (child.leaves)\n end\n end\n\n the_leaves\n end", "def children\n []\n end", "def tree\n while token = @tokens.next\n case token.type\n when :operator\n token.build(@nodes.pop, tree).tap do |node|\n @nodes.push(node)\n end\n when :value\n token.build.tap do |leaf|\n @nodes.push(leaf)\n end\n end\n end\n rescue StopIteration\n @nodes.last || Lexeme::Null.new\n end", "def current_children\n children.map {|c| c.current }\n end", "def children\n if no_child?\n []\n else\n [ body ]\n end\n end", "def children\n self.class.find(:all, \n :select => \"a.*\",\n :joins => \"a join #{self.class.bridge_class.table_name} b on a.id = b.#{self.class.parent_foreign_key}\", \n :conditions => [\"b.#{self.class.child_foreign_key} = ? and b.#{self.class.levels_from_parent} = 1\", self.id])\n end", "def all_children\n reload\n nodes = []\n queue = children.to_a\n until queue.empty?\n node = queue.pop\n nodes.push(node)\n queue += node.children.to_a\n queue.flatten!\n end\n nodes\n end", "def get_childs(recursive, ret_obj)\n\n return self.class.get_childs(self.id, recursive, ret_obj)\n end", "def descendants\n children.inject([]) { |m,child|\n m << child\n m += child.descendants\n }\n end", "def children\n \n TapirLogger.instance.log \"Finding children for #{self}\"\n children = []\n EntityMapping.all.each do |mapping| \n\n # Go through each associated entity mapping, and find mappings where the parent_id is us\n # which means that the child_id is some other entity, and it's a child\n \n # the to_s is important, otherwise self.id returns a :Moped::BSON::ObjectID\n children << mapping.get_child if mapping.parent_id == self.id.to_s\n\n # TODO - what happens if parent_id and child_id are the same. We'll\n # end up grabbing it. Could that break any assumptions?\n end\n \n children\n end", "def generateChildTree(quest)\n\n data = {:id => quest.id, :attr => { :name => quest.name, :description => quest.description, :url => '/quests/' + quest.id.to_s, :status => quest.status}}\n if(quest.quests.size == 0)\n return data\n else\n data[:children] = children = []\n quest.quests.each {|quest|\n children << generateChildTree(quest)\n }\n end\n return data\n end", "def values\n @children\n end", "def tree(path)\n children = match(\"#{path}/*\").map { |p| tree(p) }\n Node.new(path, get(path), children)\n end", "def grand_children\n []\n end", "def all_children(scope = {})\n full_set(scope) - [self]\n end", "def children\n @resource.children\n end", "def each\n return enum_for :each unless block_given?\n\n yield as_word if terminal?\n\n children_tree.each_value do |child|\n child.each do |word|\n yield word\n end\n end\n\n self\n end", "def self_and_siblings\n parent ? parent.children : self.class.roots\n end", "def to_string_tree\n if ((@children).nil? || (@children.size).equal?(0))\n return self.to_s\n end\n buf = StringBuffer.new\n if (!is_nil)\n buf.append(\"(\")\n buf.append(self.to_s)\n buf.append(Character.new(?\\s.ord))\n end\n i = 0\n while !(@children).nil? && i < @children.size\n t = @children.get(i)\n if (i > 0)\n buf.append(Character.new(?\\s.ord))\n end\n buf.append(t.to_string_tree)\n i += 1\n end\n if (!is_nil)\n buf.append(\")\")\n end\n return buf.to_s\n end", "def node_tree\n @node_tree ||= Node.all({:fields => \"title, permalink, parent_id, _id, path, _type\", :published_at => { :$lte => Time.zone.now }, :published_to => { :$gte => Time.zone.now }, :order => 'parent_id ASC, position ASC'}).group_by{|n| n.parent_id.to_s }\n end", "def tree_root\n repo.tree\n end", "def self_and_siblings\n parent ? parent.children : self.class.roots\n end", "def self_and_siblings\n parent ? parent.children : self.class.roots\n end", "def children\n elements = []\n\n %x{\n var children = #@native.children;\n for(var i = 0; i < children.length; i++) {\n elements[i] = #{Element.new(`children[i]`)};\n }\n }\n\n elements\n end", "def all_children\n find_all_children_with_dotted_ids\n end", "def get_leaves\n if @subtrees.is_a? Array\n return @subtrees.collect do |tree|\n tree.get_leaves()\n end.flatten\n else\n # We are a part of speech tag\n return [@head]\n end\n end", "def children\n Children.new({\n cc_conditions: self.association( :cc_conditions),\n cc_loops: self.association( :cc_loops),\n cc_questions: self.association( :cc_questions),\n cc_sequences: self.association( :cc_sequences),\n cc_statements: self.association( :cc_statements)\n })\n end", "def page_tree\n @tree ||= [self.root_page.tree_hash_value]\n @tree\n end", "def all_children(options = {})\n conditions = \"(#{nested_set_left} > #{self[nested_set_left]}) and (#{nested_set_right} < #{self[nested_set_right]})\"\n if options[:exclude]\n transaction do\n # exclude some items and all their children\n options[:exclude] = [options[:exclude]] if !options[:exclude].is_a?(Array)\n # get objects for ids\n options[:exclude].collect! {|s| s.is_a?(nested_set_class) ? s : nested_set_class.find(s)}\n # get all subtrees and flatten the list\n exclude_list = options[:exclude].map{|e| e.full_set.map{|ee| ee.id}}.flatten.uniq\n conditions += \" AND id NOT IN (#{exclude_list.join(',')})\" unless exclude_list.empty?\n end\n end\n nested_set_class.find_with_nested_set_scope(:all, :conditions => conditions, :order => nested_set_left)\n end" ]
[ "0.7477105", "0.6980335", "0.6952803", "0.6952803", "0.69264483", "0.68283695", "0.67265224", "0.66345876", "0.66075677", "0.6587981", "0.6529466", "0.65288013", "0.6493495", "0.64042854", "0.6400683", "0.6369082", "0.6340871", "0.63233024", "0.63094026", "0.6305005", "0.6299673", "0.6295461", "0.62666965", "0.625795", "0.62558526", "0.6232835", "0.620883", "0.6149191", "0.6121215", "0.6121215", "0.611222", "0.611222", "0.611222", "0.611222", "0.6103427", "0.60963255", "0.6087295", "0.6085664", "0.6085314", "0.60826916", "0.6067802", "0.6056665", "0.6056665", "0.6056665", "0.6050336", "0.603614", "0.6014228", "0.60084903", "0.6000176", "0.5998523", "0.59967256", "0.5977283", "0.59653366", "0.5961039", "0.59413123", "0.5930729", "0.5923692", "0.5923692", "0.592334", "0.59131795", "0.5886686", "0.58817047", "0.5871721", "0.585132", "0.58355457", "0.58225167", "0.58205855", "0.57967585", "0.57927954", "0.57892793", "0.5769006", "0.57656074", "0.5737082", "0.569066", "0.56843567", "0.5684075", "0.5649558", "0.5644947", "0.56443834", "0.56170136", "0.56154126", "0.5609499", "0.56034595", "0.559542", "0.5592609", "0.55847996", "0.5557277", "0.5553569", "0.5540746", "0.5516428", "0.5512677", "0.5508539", "0.5508472", "0.5508472", "0.5508391", "0.5505355", "0.54924047", "0.54795474", "0.54733473", "0.54728496" ]
0.56411684
79
Returns an array of the direct children of this term.
def children child_check super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end", "def children\n Array.new\n end", "def children\n children_tree.values\n end", "def children\n children_tree.values\n end", "def get_children\n return @children\n end", "def children\n kids = []\n each_child { |kid| kids << kid }\n kids\n end", "def get_children\n return children\n end", "def children\n\t\treturn children_of @current_node\n\tend", "def children\n []\n end", "def children\n []\n end", "def children\n _children\n end", "def children\n result = []\n @children.each do |_, child_group|\n result.concat(child_group)\n end\n\n result\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n entries\n end", "def all_child_terms\n get_all_child_lists\n return @all_child_terms\n end", "def children\n []\n end", "def _children\n @children\n end", "def children\n node.children\n end", "def children\n @children ||= []\n end", "def get_children( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_term\n from\n term_relationship tr\n join term as subject_term on tr.subject_term_pk = subject_term.term_pk\n join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk\n join term as object_term on tr.object_term_pk = object_term.term_pk\n where\n predicate_term.term_name in ('part_of','is_a','develops_from')\n and object_term.identifier = ?\n SQL\n \n OLS_DB[sql,node.term].each do |row|\n child = OntologyTerm.new( row[:child_identifier], row[:child_term] )\n node << child\n end\n end", "def _children\n @children\n end", "def children\n @ref.children.to_ruby\n end", "def children\n [] if leaf?\n self.class.where('forestify_left_position > ?', self.forestify_left_position).where('forestify_right_position < ?', self.forestify_right_position)\n end", "def get_children()\n return @space.get_children()\n end", "def children\n @children ||= {}.with_indifferent_access\n end", "def children\n ary = normal_children.dup\n ary << fallback_child if fallback_child\n ary\n end", "def children\n @children\n end", "def children\n @children\n end", "def values\n @children\n end", "def children\n \n TapirLogger.instance.log \"Finding children for #{self}\"\n children = []\n EntityMapping.all.each do |mapping| \n\n # Go through each associated entity mapping, and find mappings where the parent_id is us\n # which means that the child_id is some other entity, and it's a child\n \n # the to_s is important, otherwise self.id returns a :Moped::BSON::ObjectID\n children << mapping.get_child if mapping.parent_id == self.id.to_s\n\n # TODO - what happens if parent_id and child_id are the same. We'll\n # end up grabbing it. Could that break any assumptions?\n end\n \n children\n end", "def children_get()\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def children\n children = []\n\n unless leaf?\n zipper = down\n children << zipper\n\n until zipper.last?\n zipper = zipper.next\n children << zipper\n end\n end\n\n children\n end", "def get_children\n @children\n end", "def children\n EarLogger.instance.log \"Finding children for #{self}\"\n ObjectManager.instance.find_children(self.id, self.class.to_s)\n end", "def children\n list = NodeSet.new(document)\n document.decorate(list)\n\n first = self.child\n return list unless first # Empty list\n\n list << first unless first.blank?\n while first = first.next\n list << first unless first.blank?\n end\n list\n end", "def children()\n bag.ls(path).map { |pat| bag.get(pat) }.compact\n end", "def children\n attributes.fetch(:children)\n end", "def children\n []\n end", "def descendants\n children + children.map(&:children).flatten\n end", "def all_children\n find_all_children_with_dotted_ids\n end", "def to_array\n children.each_with_object( [ self ] ) { |child, memo|\n memo.concat( child.to_array )\n }.flatten\n end", "def grand_children\n []\n end", "def children\n tree_search_class.where(tree_parent_id_field => self._id).sort(self.class.tree_sort_order()).all\n end", "def children\n [@before, @mid, @after].compact\n end", "def children\n [@before, @mid, @after].compact\n end", "def get_children\n \t@children\n end", "def children\n self.node.children.collect(&:content)\n end", "def node_children(node)\n children = @navigator.call(node)\n return Array::EMPTY_ARRAY if children.nil?\n Enumerable === children ? children.to_a.compact : [children]\n end", "def descendants\n return [] if new_record?\n tree_search_class.where(tree_path_field => self._id).sort(self.class.tree_sort_order()).all\n end", "def descendants\n list = []\n children.each do |child|\n list << child\n list.concat(child.descendants)\n end\n list\n end", "def descendants\n list = []\n children.each do |child|\n list << child\n list.concat(child.descendants)\n end\n list\n end", "def descendants\n children.inject([]) { |m,child|\n m << child\n m += child.descendants\n }\n end", "def get_all_child_lists\n child_check\n \n if @all_child_terms.nil? and @all_child_names.nil?\n @all_child_terms = []\n @all_child_names = []\n \n self.children.each do |child|\n @all_child_terms.push( child.term )\n @all_child_terms.push( child.all_child_terms )\n @all_child_names.push( child.term_name )\n @all_child_names.push( child.all_child_names )\n end\n \n @all_child_terms = @all_child_terms.flatten.uniq\n @all_child_names = @all_child_names.flatten.uniq\n end\n end", "def children\n elements = []\n\n %x{\n var children = #@native.children;\n for(var i = 0; i < children.length; i++) {\n elements[i] = #{Element.new(`children[i]`)};\n }\n }\n\n elements\n end", "def children\n NotImplemented\n end", "def children\n NotImplemented\n end", "def children\n self.class.children(self) \n end", "def children\n if no_child?\n []\n else\n [ body ]\n end\n end", "def descendants\n children + children.map(&:descendants).flatten\n end", "def children\n @root.children & @initial_contents\n end", "def children(all: false)\n scoped_children =\n if at_or_below_genus?\n Name.with_correct_spelling.subtaxa_of_genus_or_below(text_name)\n else\n Name.with_correct_spelling.\n with_rank_and_name_in_classification(rank, text_name)\n end\n\n return scoped_children.to_a if all\n\n Name.all_ranks.reverse_each do |rank2|\n next if rank_index(rank2) >= rank_index(rank)\n\n matches = scoped_children.with_rank(rank2)\n return matches.to_a if matches.any?\n end\n []\n end", "def child_ids\n\n children.collect { |cfei| Ruote.extract_child_id(cfei) }\n end", "def children\n NodeSetProxy.new(@node.children, self)\n end", "def children\n NodeSetProxy.new(@node.children, self)\n end", "def tree_children\n\n tree[2]\n end", "def children\n\t\treturn self.search( :one, '(objectClass=*)' )\n\tend", "def children\n [@operand]\n end", "def all_children\n @all_children ||= children + children.inject([]) {|records, child| records + child.all_children}\n end", "def children\n @resource.children\n end", "def children()\r\n raise \"get_children is not implemented for class #{self.class}\"\r\n end", "def get_children_array\n\t\t\tarr = []\n\t\t\tself.children.get_active.each do |child_1|\n\t\t\t\tarr << {menu: child_1, class: 'parent'}\n\t\t\t\tchild_1.children.get_active.each do |child_2|\n\t\t\t\t\tarr << {menu: child_2, class: 'child'}\n\t\t\t\tend\n\t\t\tend\n\t\t\tarr\n\t\tend", "def all_children\n children(all: true)\n end", "def descendents\n\n\t\t #children.preload(:parent).each do |child| child.descendents end\n\t\t children.each do |child|\n\t [child] + child.descendents\n\t end\n end", "def children\n self.class.where('? = ANY(parent_ids)', id.to_s)\n end", "def descendents\n respond_to?(:values) ? values.map { |d| d.branch }.flatten : []\n end", "def children\n raise NotImplementedError\n end", "def children\n children = []\n children << up_child unless up_child.nil?\n children << down_child unless down_child.nil?\n children << left_child unless left_child.nil?\n children << right_child unless right_child.nil?\n children\n end", "def current_children\n children.map {|c| c.current }\n end", "def children\n dataset.nested.filter(self.class.qualified_parent_column => self.id)\n end", "def children_names; @children.keys; end", "def descendants\n _descendants = children(true)\n children.each do |child|\n _descendants = _descendants + child.descendants\n end\n _descendants\n end", "def child_ids\n ids = [self.id]\n self.children.each do |child|\n ids += child.child_ids\n end\n ids\n end", "def children\n rows\n end", "def descendants_and_self\r\n result = [self]\r\n children.each { |child| result << child.descendants_and_self }\r\n result.flatten!\r\n return result\r\n end", "def get_childs\n childs = Category.any_in(parent_ids: [parent.id])\n\n results = Array.new\n childs.each do |child|\n results << child\n end\n\n results\n end", "def onlychildren_list\n if matches.length == 1\n [self] + matches[0].onlychildren_list\n else\n [self]\n end\n end", "def children\n self.class.find(:all, \n :select => \"a.*\",\n :joins => \"a join #{self.class.bridge_class.table_name} b on a.id = b.#{self.class.parent_foreign_key}\", \n :conditions => [\"b.#{self.class.child_foreign_key} = ? and b.#{self.class.levels_from_parent} = 1\", self.id])\n end", "def children; []; end", "def children(*args)\n self.class.send(:with_scope, :find=>{:conditions=>['parent_node_id=?', self.child_node_id]}) do\n self.class.find(:all, *args)\n end\n end", "def deep_branch_children\n if self.branch?\n arr = []\n children.each do |child|\n if child.branch?\n arr.concat child.deep_branch_children\n end\n end\n arr.push self\n arr\n else\n nil # caller shouldn't be asking for branch children anyway\n end\n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end" ]
[ "0.7708992", "0.74148446", "0.74059296", "0.74059296", "0.73882806", "0.7384135", "0.7378472", "0.72532994", "0.7248968", "0.7248968", "0.72476405", "0.72332263", "0.7197464", "0.7197464", "0.7197464", "0.7196735", "0.71606714", "0.7094202", "0.7089693", "0.70896477", "0.70551574", "0.7030953", "0.70213443", "0.70136714", "0.6993695", "0.6982453", "0.69348496", "0.69301915", "0.692879", "0.692879", "0.6917343", "0.6912764", "0.69082975", "0.69004697", "0.69004697", "0.69004697", "0.69004697", "0.68796605", "0.6877395", "0.68544906", "0.6834429", "0.679688", "0.67863363", "0.6777813", "0.6753674", "0.6735619", "0.6685365", "0.6671011", "0.66371214", "0.6627698", "0.6627698", "0.66094357", "0.6594725", "0.65722847", "0.65715396", "0.6570261", "0.6570261", "0.65417755", "0.6540914", "0.6536394", "0.6532055", "0.6532055", "0.6482246", "0.6481308", "0.6475139", "0.6455924", "0.64512825", "0.6447453", "0.64459425", "0.6440182", "0.64264405", "0.6409207", "0.63906676", "0.6384778", "0.6384767", "0.63844615", "0.6377672", "0.6370874", "0.6357236", "0.63386506", "0.633486", "0.6325596", "0.63173616", "0.6314483", "0.6305251", "0.63008916", "0.62899184", "0.62837905", "0.62819654", "0.6252751", "0.6252209", "0.6241643", "0.6233399", "0.6208471", "0.6176596", "0.6167833", "0.61634845", "0.61634845", "0.61634845", "0.61634845", "0.61634845" ]
0.0
-1
Returns a flat array containing all the possible child terms for this given ontology term
def all_child_terms get_all_child_lists return @all_child_terms end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_children( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_term\n from\n term_relationship tr\n join term as subject_term on tr.subject_term_pk = subject_term.term_pk\n join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk\n join term as object_term on tr.object_term_pk = object_term.term_pk\n where\n predicate_term.term_name in ('part_of','is_a','develops_from')\n and object_term.identifier = ?\n SQL\n \n OLS_DB[sql,node.term].each do |row|\n child = OntologyTerm.new( row[:child_identifier], row[:child_term] )\n node << child\n end\n end", "def get_all_child_lists\n child_check\n \n if @all_child_terms.nil? and @all_child_names.nil?\n @all_child_terms = []\n @all_child_names = []\n \n self.children.each do |child|\n @all_child_terms.push( child.term )\n @all_child_terms.push( child.all_child_terms )\n @all_child_names.push( child.term_name )\n @all_child_names.push( child.all_child_names )\n end\n \n @all_child_terms = @all_child_terms.flatten.uniq\n @all_child_names = @all_child_names.flatten.uniq\n end\n end", "def terms\n @term_hash.values\n end", "def children\n kids = []\n each_child { |kid| kids << kid }\n kids\n end", "def descendents\n respond_to?(:values) ? values.map { |d| d.branch }.flatten : []\n end", "def terms\n @data.map(&:uniq).flatten\n end", "def term_list\n terms = Array.new\n\n self.notes.each do |note|\n note.scrubbed_notes.each do |word|\n term_index = terms.index(word)\n if term_index.nil?\n terms.push(word)\n end\n end\n end\n terms\n end", "def children\n Array.new\n end", "def terms\n @locations.map(&:term).uniq\n end", "def terms\n [self]\n end", "def terms\n @data.flatten.uniq\n end", "def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end", "def descendants\n children + children.map(&:children).flatten\n end", "def secondary_terms\n []\n end", "def secondary_terms\n []\n end", "def secondary_terms\n []\n end", "def grand_children\n []\n end", "def to_array\n children.each_with_object( [ self ] ) { |child, memo|\n memo.concat( child.to_array )\n }.flatten\n end", "def descendants\n children.inject([]) { |m,child|\n m << child\n m += child.descendants\n }\n end", "def children\n children_tree.values\n end", "def children\n children_tree.values\n end", "def word_list\n # Returning only the terms of each definition as an array.\n list_of_terms = @words.map do |key, definition_instance|\n definition_instance.term\n end\n end", "def descendants\n list = []\n children.each do |child|\n list << child\n list.concat(child.descendants)\n end\n list\n end", "def descendants\n list = []\n children.each do |child|\n list << child\n list.concat(child.descendants)\n end\n list\n end", "def children(all: false)\n scoped_children =\n if at_or_below_genus?\n Name.with_correct_spelling.subtaxa_of_genus_or_below(text_name)\n else\n Name.with_correct_spelling.\n with_rank_and_name_in_classification(rank, text_name)\n end\n\n return scoped_children.to_a if all\n\n Name.all_ranks.reverse_each do |rank2|\n next if rank_index(rank2) >= rank_index(rank)\n\n matches = scoped_children.with_rank(rank2)\n return matches.to_a if matches.any?\n end\n []\n end", "def children\n result = []\n @children.each do |_, child_group|\n result.concat(child_group)\n end\n\n result\n end", "def terms\n @terms ||= wayfinder.decorated_ephemera_terms.sort_by(&:label)\n end", "def secondary_terms\n []\n end", "def children()\n bag.ls(path).map { |pat| bag.get(pat) }.compact\n end", "def descendants\n \t descendants = []\n \t self.children.each { |child|\n \t descendants += [child] if child.permitted?\n \t descendants += child.descendants\n \t } unless self.children.empty?\n \t descendants \n \tend", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def values\n @children\n end", "def children\n []\n end", "def children\n []\n end", "def descendants\n children + children.map(&:descendants).flatten\n end", "def children\n @children ||= {}.with_indifferent_access\n end", "def descendants\n desc = []\n children.each do |tc|\n desc << tc\n desc += tc.descendants if tc.parent?\n end\n desc\n end", "def terms_for_field(name)\n get_for_field(name).map(&:term).uniq\n end", "def children\n [@operand]\n end", "def children\n []\n end", "def all_children_deep(flag=nil)\n\t\tarr = []\n\t\tall_children(flag).each do |c|\n\t\t\tarr << c\n\t\t\tc.all_children_deep(flag).each do |cc|\n\t\t\t\tarr << cc\n\t\t\tend\n\t\tend\t\t\t\n\t\tarr\n\tend", "def terms\n values.map(&:to_s)\n end", "def words\n terms.collect { |t| t.word }\n end", "def get_childs\n childs = Category.any_in(parent_ids: [parent.id])\n\n results = Array.new\n childs.each do |child|\n results << child\n end\n\n results\n end", "def children\n @children ||= []\n end", "def children\n ary = normal_children.dup\n ary << fallback_child if fallback_child\n ary\n end", "def children\n entries\n end", "def get_children\n return children\n end", "def search_children(node, attribute, search_term)\n matches = []\n end", "def children\n @ref.children.to_ruby\n end", "def all_children\n find_all_children_with_dotted_ids\n end", "def children\n _children\n end", "def deep_branch_children\n if self.branch?\n arr = []\n children.each do |child|\n if child.branch?\n arr.concat child.deep_branch_children\n end\n end\n arr.push self\n arr\n else\n nil # caller shouldn't be asking for branch children anyway\n end\n end", "def to_tree\n if term?\n [type, *args]\n else\n [type, *args.map(&:to_tree)]\n end\n end", "def _children\n @children\n end", "def extract_children_from(obj)\n\t\tif obj.nil? then\n\t\t\treturn []\n\t\tend\n\t\t\n\t\toutput = []\n\t\tset = obj.children\n\t\tset.each do |node|\n\t\t\toutput << node\n\t\tend\n\t\t\n\t\treturn output\n\tend", "def get_children_array\n\t\t\tarr = []\n\t\t\tself.children.get_active.each do |child_1|\n\t\t\t\tarr << {menu: child_1, class: 'parent'}\n\t\t\t\tchild_1.children.get_active.each do |child_2|\n\t\t\t\t\tarr << {menu: child_2, class: 'child'}\n\t\t\t\tend\n\t\t\tend\n\t\t\tarr\n\t\tend", "def get_children\n return @children\n end", "def descendants\n _descendants = children(true)\n children.each do |child|\n _descendants = _descendants + child.descendants\n end\n _descendants\n end", "def descendants\n \t\tres=children\n \t\tchildren.each {|c| res += c.descendants}\n \t\treturn res.uniq\n \tend", "def children\n []\n end", "def children\n node.children\n end", "def descendents\n\n\t\t #children.preload(:parent).each do |child| child.descendents end\n\t\t children.each do |child|\n\t [child] + child.descendents\n\t end\n end", "def children; []; end", "def term\n children[0]\n end", "def get_terms(repositoryName='ComputerScience_test')\n repo = set_repository(repositoryName)\n \n # SparQL queries\n @repository.query.language = :sparql\n res = @repository.query.perform \"SELECT distinct ?Class ?Subclass WHERE { ?Subclass rdfs:subClassOf ?Class . } Order by ?Class \"\n terms = Set.new\n # I know this could be done more efficiently...\n res['values'].each do |pair|\n terms.add(pair[0])\n terms.add(pair[1]) \n end\n terms \n end", "def _children\n @children\n end", "def terms\n TermsList.new(@contents.values)\n end", "def children\n \n TapirLogger.instance.log \"Finding children for #{self}\"\n children = []\n EntityMapping.all.each do |mapping| \n\n # Go through each associated entity mapping, and find mappings where the parent_id is us\n # which means that the child_id is some other entity, and it's a child\n \n # the to_s is important, otherwise self.id returns a :Moped::BSON::ObjectID\n children << mapping.get_child if mapping.parent_id == self.id.to_s\n\n # TODO - what happens if parent_id and child_id are the same. We'll\n # end up grabbing it. Could that break any assumptions?\n end\n \n children\n end", "def children\n\t\treturn children_of @current_node\n\tend", "def all_children\n @all_children ||= children + children.inject([]) {|records, child| records + child.all_children}\n end", "def children\n list = NodeSet.new(document)\n document.decorate(list)\n\n first = self.child\n return list unless first # Empty list\n\n list << first unless first.blank?\n while first = first.next\n list << first unless first.blank?\n end\n list\n end", "def map_child\n array = []\n @children.each_pair { |_, child| array << (yield child) }\n array\n end", "def get_children()\n return @space.get_children()\n end", "def descendants\n return [] if new_record?\n tree_search_class.where(tree_path_field => self._id).sort(self.class.tree_sort_order()).all\n end", "def get_parents( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_term\n from\n term_relationship tr\n join term as subject_term \ton tr.subject_term_pk = subject_term.term_pk\n join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk\n join term as object_term on tr.object_term_pk = object_term.term_pk\n where\n predicate_term.term_name in ('part_of','is_a','develops_from')\n and subject_term.identifier = ?\n SQL\n \n OLS_DB[ sql, node.term ].each do |row|\n parent = OntologyTerm.new( row[:parent_identifier], row[:parent_term] )\n parent << node\n get_parents( parent )\n end\n end", "def children\n instance_variables.each do |var|\n child = instance_variable_get var\n if child.kind_of? Node\n yield child\n elsif child.kind_of? Array\n child.each { |x| yield x if x.kind_of? Node }\n end\n end\n end", "def all_child_names\n get_all_child_lists\n return @all_child_names\n end", "def child_labels\n self.meta_definition.children.map { |c| c.label }\n end", "def taxons_including_children_ids\n taxons.inject([]) { |ids, taxon| ids += taxon.self_and_descendants.ids }\n end", "def build_term_values\n term_values = fetch_facet_terms_for(@key)\n # Return basic elasticsearch result terms if we dont have method defined\n return generate_facet_terms_by_result unless term_values\n\n term_values.map { |term| FacetTerm.new(group: self, id: term.fetch(:id), term: term.fetch(:term), count: fetch_count_for( term.fetch(:id) ) ) }\n end", "def child_ids\n\n children.collect { |cfei| Ruote.extract_child_id(cfei) }\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def build(terminology=nil)\n self.resolve_refs!\n if term.self.settings.has_key?(:proxy)\n term = OM::XML::NamedTermProxy.new(self.name, self.settings[:proxy], terminology, self.settings)\n else\n term = OM::XML::Term.new(self.name, {}, terminology)\n\n self.settings.each do |name, values|\n if term.respond_to?(name.to_s+\"=\")\n term.instance_variable_set(\"@#{name}\", values)\n end\n end\n @children.each_value do |child|\n term.add_child child.build(terminology)\n end\n term.generate_xpath_queries!\n end\n\n return term\n end", "def terms\n raise NotImplementedError\n end", "def get_all_children(catalog)\n catalog.descendant_catalogs\n end", "def children() []; end", "def children\n elements = []\n\n %x{\n var children = #@native.children;\n for(var i = 0; i < children.length; i++) {\n elements[i] = #{Element.new(`children[i]`)};\n }\n }\n\n elements\n end", "def child_tags\n return @child_tags\n end", "def descendants_and_self\r\n result = [self]\r\n children.each { |child| result << child.descendants_and_self }\r\n result.flatten!\r\n return result\r\n end", "def descendants\n _descendants.flatten.uniq\n end", "def subtrees!\n trees = Array.new\n subtrees {|tree| trees.push(tree)}\n return trees\n end", "def children\n attributes.fetch(:children)\n end", "def children\n bibliography && bibliography.q(\"@entry[crossref=#{key}]\") or []\n end", "def getAllChildren\n children = Tree.where(\"tree_type_id = ? AND version_id = ? AND subject_id = ? AND grade_band_id = ? AND code like ?\", tree_type_id, version_id, subject_id, grade_band_id, code+'.%')\n Rails.logger.debug(\"*** tree children: #{children.inspect}\")\n return children\n end" ]
[ "0.71345043", "0.70961", "0.65151185", "0.62965214", "0.61568606", "0.6139526", "0.61349463", "0.61024165", "0.6081994", "0.60605055", "0.60132635", "0.6008063", "0.60002565", "0.59987664", "0.59987664", "0.59987664", "0.59980315", "0.59953696", "0.59926134", "0.5988252", "0.5988252", "0.5961931", "0.5945726", "0.5945726", "0.594383", "0.59212065", "0.5918185", "0.5917741", "0.5906398", "0.5863241", "0.58477354", "0.58477354", "0.58477354", "0.58426034", "0.5830683", "0.5830683", "0.5826732", "0.57670456", "0.5753923", "0.5744562", "0.57142895", "0.57108486", "0.57096356", "0.56812316", "0.5680979", "0.56680506", "0.5665701", "0.56630236", "0.56486267", "0.5635859", "0.5623524", "0.5605995", "0.55931634", "0.55919313", "0.5585774", "0.55799174", "0.5577215", "0.55739427", "0.5571811", "0.5566975", "0.5566464", "0.5550445", "0.5548784", "0.55434364", "0.55320907", "0.55284864", "0.5528324", "0.55178446", "0.55005777", "0.5499604", "0.5488256", "0.5482693", "0.54693407", "0.5466856", "0.5454117", "0.5453109", "0.5452034", "0.54504067", "0.54382443", "0.54363275", "0.5422854", "0.542209", "0.5411937", "0.540929", "0.54084975", "0.54084975", "0.54084975", "0.54084975", "0.5405483", "0.5398766", "0.53973436", "0.5393932", "0.5390769", "0.5388747", "0.53861225", "0.53788584", "0.5374753", "0.537452", "0.5366375", "0.53647465" ]
0.7743936
0
Returns a flat array containing all the possible child term names for this given ontology term
def all_child_names get_all_child_lists return @all_child_names end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_child_terms\n get_all_child_lists\n return @all_child_terms\n end", "def get_children( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_term\n from\n term_relationship tr\n join term as subject_term on tr.subject_term_pk = subject_term.term_pk\n join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk\n join term as object_term on tr.object_term_pk = object_term.term_pk\n where\n predicate_term.term_name in ('part_of','is_a','develops_from')\n and object_term.identifier = ?\n SQL\n \n OLS_DB[sql,node.term].each do |row|\n child = OntologyTerm.new( row[:child_identifier], row[:child_term] )\n node << child\n end\n end", "def get_all_child_lists\n child_check\n \n if @all_child_terms.nil? and @all_child_names.nil?\n @all_child_terms = []\n @all_child_names = []\n \n self.children.each do |child|\n @all_child_terms.push( child.term )\n @all_child_terms.push( child.all_child_terms )\n @all_child_names.push( child.term_name )\n @all_child_names.push( child.all_child_names )\n end\n \n @all_child_terms = @all_child_terms.flatten.uniq\n @all_child_names = @all_child_names.flatten.uniq\n end\n end", "def terms\n @term_hash.values\n end", "def descendent_names\n self_and_descendents.map(&:name).flatten \n end", "def children_names; @children.keys; end", "def terms_for_field(name)\n get_for_field(name).map(&:term).uniq\n end", "def terms\n @locations.map(&:term).uniq\n end", "def get_child_names(node)\n\n child_names = []\n node.children.each { |child| child_names << child.name }\n child_names.join(\", \")\n\n end", "def words\n terms.collect { |t| t.word }\n end", "def child_labels\n self.meta_definition.children.map { |c| c.label }\n end", "def term_list\n terms = Array.new\n\n self.notes.each do |note|\n note.scrubbed_notes.each do |word|\n term_index = terms.index(word)\n if term_index.nil?\n terms.push(word)\n end\n end\n end\n terms\n end", "def word_list\n # Returning only the terms of each definition as an array.\n list_of_terms = @words.map do |key, definition_instance|\n definition_instance.term\n end\n end", "def children(all: false)\n scoped_children =\n if at_or_below_genus?\n Name.with_correct_spelling.subtaxa_of_genus_or_below(text_name)\n else\n Name.with_correct_spelling.\n with_rank_and_name_in_classification(rank, text_name)\n end\n\n return scoped_children.to_a if all\n\n Name.all_ranks.reverse_each do |rank2|\n next if rank_index(rank2) >= rank_index(rank)\n\n matches = scoped_children.with_rank(rank2)\n return matches.to_a if matches.any?\n end\n []\n end", "def secondary_terms\n []\n end", "def secondary_terms\n []\n end", "def secondary_terms\n []\n end", "def child_names(path, query_result)\n return @child_names_override.call(self, path, query_result) if @child_names_override\n child_names = []\n sub_values = query_result.gsub(\"\\r\\n\", \"\\n\").split(@child_name_delimiter)\n sub_values.each do |sub_value|\n sub_value.strip!\n (child_names << sub_value) unless sub_value.empty?\n end\n return child_names\n end", "def terms\n @data.map(&:uniq).flatten\n end", "def terms\n @terms ||= wayfinder.decorated_ephemera_terms.sort_by(&:label)\n end", "def secondary_terms\n []\n end", "def object_taxon_name_ids\n return taxon_name_id if !taxon_name_id.empty?\n return object_taxon_name_id if !object_taxon_name_id.empty?\n return []\n end", "def terms\n values.map(&:to_s)\n end", "def childs_names\n\t\t[first_name, middle_name, maiden_name, last_name ]\n\tend", "def terms\n @data.flatten.uniq\n end", "def children\n kids = []\n each_child { |kid| kids << kid }\n kids\n end", "def term\n children[0]\n end", "def terms\n [self]\n end", "def names\n map(&:names).flatten\n end", "def term_name\n self.content\n end", "def get_child_element_names(mods_node)\n return [] if mods_node == nil\n child_element_names = mods_node.children.map {|x| x.name}.uniq.reject {|y| y == 'text'}.compact\n end", "def term\n self.name\n end", "def keys\n @children.map(&:title)\n end", "def subject_taxon_name_ids\n return taxon_name_id if !taxon_name_id.empty? # only one or the other supposed to be sent\n return subject_taxon_name_id if !subject_taxon_name_id.empty?\n return []\n end", "def descendants\n desc = []\n children.each do |tc|\n desc << tc\n desc += tc.descendants if tc.parent?\n end\n desc\n end", "def descendents\n respond_to?(:values) ? values.map { |d| d.branch }.flatten : []\n end", "def _tags\n tags = []\n categories.find_each do |category|\n tags << category.self_and_ancestors.pluck(:name)\n end\n tags.flatten.uniq\n end", "def term_to_name_string(term)\n self.search_string ? sstring = self.search_string : sstring = terms[term]\n if not sstring.blank?\n names = sstring.split(/, +|[,\\^\\- ]/).collect do |e|\n Regexp.escape(e)\n end\n names.uniq\n else\n []\n end\n end", "def cyclic_child_name(many = true)\n (\"child_#{self.name.demodulize.underscore.send(many ? :pluralize : :singularize)}\").to_sym\n end", "def each_term\n\t\t\tself.to_terms.each do |term|\n\t\t\t\tyield term.stem\n\t\t\tend\n\t\tend", "def get_terms(repositoryName='ComputerScience_test')\n repo = set_repository(repositoryName)\n \n # SparQL queries\n @repository.query.language = :sparql\n res = @repository.query.perform \"SELECT distinct ?Class ?Subclass WHERE { ?Subclass rdfs:subClassOf ?Class . } Order by ?Class \"\n terms = Set.new\n # I know this could be done more efficiently...\n res['values'].each do |pair|\n terms.add(pair[0])\n terms.add(pair[1]) \n end\n terms \n end", "def children\n children_tree.values\n end", "def children\n children_tree.values\n end", "def names\n map(&:name)\n end", "def get_parents( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_term\n from\n term_relationship tr\n join term as subject_term \ton tr.subject_term_pk = subject_term.term_pk\n join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk\n join term as object_term on tr.object_term_pk = object_term.term_pk\n where\n predicate_term.term_name in ('part_of','is_a','develops_from')\n and subject_term.identifier = ?\n SQL\n \n OLS_DB[ sql, node.term ].each do |row|\n parent = OntologyTerm.new( row[:parent_identifier], row[:parent_term] )\n parent << node\n get_parents( parent )\n end\n end", "def children()\n bag.ls(path).map { |pat| bag.get(pat) }.compact\n end", "def names\n @nodes.map(&:name)\n end", "def nomenclator_array\n case @rank\n when 'variety'\n return [parent_name_at_rank('genus'), (parent_name_at_rank('subgenus') ? \"(#{parent_name_at_rank('subgenus')})\" : nil), parent_name_at_rank('species'), parent_name_at_rank('subspecies'), \"var. #{@name}\"]\n when 'species', 'subspecies'\n return [parent_name_at_rank('genus'), (parent_name_at_rank('subgenus') ? \"(#{parent_name_at_rank('subgenus')})\" : nil), parent_name_at_rank('species'), parent_name_at_rank('subspecies'), nil]\n when 'subgenus'\n return [parent_name_at_rank('genus'), \"(#{@name})\", nil, nil, nil]\n when 'genus'\n return [@name, nil, nil, nil, nil]\n else\n return false\n end\n \n end", "def return_names_array(doc)\n names = doc.css(\".search-content .teaser-item__title a span\")\n recipe_names = []\n names.each do |element|\n recipe_names << element.text\n end\n return recipe_names\n end", "def names\n map(&:name)\n end", "def characterization_terms(omdoc)\n h = {}\n omdoc.class.terminology.terms.each_pair do |key, target|\n # a key is a proxy if its target responds to proxied_term\n next unless target.respond_to? :proxied_term\n begin\n h[key] = omdoc.send(key)\n rescue NoMethodError\n next\n end\n end\n h.delete_if { |_k, v| v.empty? }\n end", "def descendants\n list = []\n children.each do |child|\n list << child\n list.concat(child.descendants)\n end\n list\n end", "def descendants\n list = []\n children.each do |child|\n list << child\n list.concat(child.descendants)\n end\n list\n end", "def get_sub_word(node, prefix)\n return [] if !starts_with(prefix)\n keys = node.children.keys\n result = []\n keys.each do |char|\n if node.children[char].end_of_word\n result << prefix + char\n end\n result.concat(get_sub_word(node.children[char], prefix + char))\n end\n result\n end", "def as_names\n __getobj__.map { |i| i.name }\n end", "def child_tags\n return @child_tags\n end", "def find_terms(doc)\n terms_match = @terms.select { |term| doc.join('').match(term.to_s) }\n\n terms_match.map do |term, definition|\n \"*[#{term}]: #{definition}\".delete(\"\\t\\r\\n\").squeeze(' ').strip\n end\nend", "def taxonomy_ids\n taxon_and_ancestors.map(&:taxonomy_id).flatten.uniq\n end", "def grand_children\n []\n end", "def names\n collect { |a| a.name }\n end", "def names\n all.map { |item| item.name_sym }\n end", "def descendants\n children.inject([]) { |m,child|\n m << child\n m += child.descendants\n }\n end", "def tag_names\n self.tags.map(&:name).join(\", \")\n #The & symbol is used to tell Ruby that the following argument\n #should be given as a block to the method. So the line:\n #self.tags.map(&.:name).join(\", \") is equal to\n #self.tags.map { |t| t.name.join(\", \")}\n #So the above will iterate over tyhe collection of elf.tags\n #and build an array with the resukts of the name method\n #called on every item\n end", "def values\n @children\n end", "def search_children(node, attribute, search_term)\n matches = []\n end", "def descendants\n children + children.map(&:children).flatten\n end", "def collapse\n a = []\n n = self\n begin\n return false if n.children.size != 1\n a << n.term\n n = n.children.first\n end while not n.children.empty?\n a << n.term\n @term = a.join(' ')\n @children = []\n end", "def brief_terms\n [\n #:relation,\n :asset_type,\n :uid,\n :pref_label\n ]\n end", "def getTags node\n array = [] #array to hold working collection\n \n node.children.each do |child|\n array << Hash[child.name,child.inner_text] unless child.name == 'text' #text \n end\n \n return array\n end", "def children\n [@operand]\n end", "def class_names\n descendants.map(&:name)\n end", "def names\n Array(@name)\n end", "def taxonomies_json\n @taxons_json = []\n query_string = \"%#{params[:term]}%\"\n @taxons = Spree::Taxonomy.categories.taxons#.where(\"name like ? OR id like ?\", query_string, query_string)\n @taxons.collect{ |taxon|\n if (taxon.parent.present? && taxon.parent.parent.present? && taxon.parent.parent.parent.present?)\n name = (taxon.parent.parent.name+\" -> \"+taxon.parent.name+\" -> \"+taxon.name)\n @taxons_json << {'label' => name, 'id' => taxon.id} if name.downcase.include? params[:term].downcase\n end\n }\n render :json=>@taxons_json.to_json\n end", "def query(word)\n node = @the_node\n results = []\n word.split(\"\").each do |letter|\n next_node = node[letter]\n if next_node != nil\n node = next_node\n next\n else\n return ['']\n end\n end\n results << Word.new(word, node.final)\n results += get_childs(node).map{|s| Word.new(word) + s}\n results.select{|r| r.final}.map{|r| r.to_s }\n end", "def expressed_taxon_names\n self.expression_matrix_files\n .map {|f| f.taxon.try(:scientific_name) }\n .uniq\n end", "def characterization_terms(doc)\n h = {}\n\n doc.class.terminology.terms.each_pair do |key, _target|\n h[key] = doc.public_send(key)\n rescue NoMethodError\n next\n end\n\n h.compact\n end", "def build_term_values\n term_values = fetch_facet_terms_for(@key)\n # Return basic elasticsearch result terms if we dont have method defined\n return generate_facet_terms_by_result unless term_values\n\n term_values.map { |term| FacetTerm.new(group: self, id: term.fetch(:id), term: term.fetch(:term), count: fetch_count_for( term.fetch(:id) ) ) }\n end", "def node_names\n map do |node|\n node.name\n end.sort\n end", "def get_search_breadcrumb_terms(q_param)\n q_param.scan(/(\"[^\"]+\"|\\w+)/).flatten\n end", "def children\n result = []\n @children.each do |_, child_group|\n result.concat(child_group)\n end\n\n result\n end", "def to_tree\n if term?\n [type, *args]\n else\n [type, *args.map(&:to_tree)]\n end\n end", "def each &block\n enumerator = Enumerator.new do |words|\n words << as_word if terminal?\n children.each { |child| child.each { |word| words << word } }\n end\n\n block.nil? ? enumerator : enumerator.each(&block)\n end", "def children\n Array.new\n end", "def descendants\n children + children.map(&:descendants).flatten\n end", "def tag_names\n # only return the name from the associated tag object\n object.tags.map(&:name)\n end", "def terms\n raise NotImplementedError\n end", "def descendants\n \t descendants = []\n \t self.children.each { |child|\n \t descendants += [child] if child.permitted?\n \t descendants += child.descendants\n \t } unless self.children.empty?\n \t descendants \n \tend", "def descendants\n \t\tres=children\n \t\tchildren.each {|c| res += c.descendants}\n \t\treturn res.uniq\n \tend", "def initials\n\t\tchilds_names.delete_if(&:blank?).collect{|s|s.chars.first}.join()\n\tend", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def go_terms\n go_db_id = ExternalDb.find_by_db_name('GO').id\n return self.all_xrefs.select{|x| x.external_db_id == go_db_id}.collect{|x| x.dbprimary_acc}.uniq\n end", "def question_names\n self.catalogs.reduce([]) do |names, catalog|\n questions = \"#{catalog.capitalize}Catalog\".constantize.const_get(\"QUESTIONS\")\n namespaced_questions = questions.map{|question| \"#{catalog}_#{question}\".to_sym }\n\n names + namespaced_questions\n end\n end", "def search_terms\n return @search_terms\n end", "def children\n []\n end", "def children\n []\n end", "def children\n entries\n end", "def term(name)\n element(name, :class=>:term)\n end", "def children\n @ref.children.to_ruby\n end" ]
[ "0.7035232", "0.65570384", "0.648097", "0.642691", "0.6403646", "0.6261387", "0.6214521", "0.620101", "0.6112723", "0.604649", "0.6018305", "0.6001394", "0.59830844", "0.5955058", "0.59232795", "0.59232795", "0.59232795", "0.5882703", "0.58734363", "0.5861731", "0.5852528", "0.5846799", "0.5828737", "0.5786057", "0.5782082", "0.5744104", "0.5737467", "0.5725971", "0.5718272", "0.5674101", "0.5602421", "0.558924", "0.5561145", "0.5483379", "0.5476498", "0.5471294", "0.5456373", "0.54383564", "0.5396336", "0.5367541", "0.53627896", "0.53515345", "0.53515345", "0.5349914", "0.53449404", "0.5333875", "0.5323074", "0.5320594", "0.53068596", "0.5300144", "0.52989674", "0.52953607", "0.52953607", "0.5288227", "0.5286893", "0.5278144", "0.52720356", "0.52671844", "0.52590424", "0.52187914", "0.52088815", "0.52009505", "0.51990414", "0.51982796", "0.5183803", "0.5175893", "0.5158329", "0.515716", "0.5151473", "0.51422656", "0.51329654", "0.51208735", "0.51202273", "0.5114544", "0.51136076", "0.50991905", "0.5093073", "0.50874776", "0.5086783", "0.50854564", "0.5085027", "0.50849587", "0.5083844", "0.5081434", "0.50807315", "0.5073912", "0.5066992", "0.5061796", "0.5061493", "0.5051571", "0.5051571", "0.5051571", "0.50416714", "0.50342387", "0.503322", "0.50326747", "0.50326747", "0.5030441", "0.5023156", "0.5014627" ]
0.626335
5
Helper function to query the OLS database and grab the full details of the ontology term.
def get_term_details # This query ensures we look at the most recent fully loaded ontologies sql = <<-SQL select term.* from term join ontology on ontology.ontology_id = term.ontology_id where term.identifier = ? order by ontology.fully_loaded desc, ontology.load_date asc SQL term_set = OLS_DB[ sql, @name ].all() if term_set.size == 0 get_term_from_synonym else subject = term_set.first @content = subject[:term_name] @term_pk = subject[:term_pk] @ontology_id = subject[:ontology_id] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_term_from_synonym\n sql = <<-SQL\n select term.*\n from term\n join ontology on ontology.ontology_id = term.ontology_id\n join term_synonym on term.term_pk = term_synonym.term_pk\n where term_synonym.synonym_value = ?\n order by ontology.fully_loaded desc, ontology.load_date asc\n SQL\n \n term_set = OLS_DB[ sql, @name ].all()\n \n raise OntologyTermNotFoundError, \"Unable to find the term '#{@name}' in the OLS database.\" \\\n if term_set.size == 0\n \n subject = term_set.first\n @name = subject[:identifier]\n @content = subject[:term_name]\n @term_pk = subject[:term_pk]\n @ontology_id = subject[:ontology_id]\n end", "def ontology; ontologies.first; end", "def ontology; ontologies.first; end", "def term\n Term.find(self.term_id)\n end", "def get_ontology_terms(repositoryName = \"ComputerScience\")\n puts \"get_ontology_terms from catalog: \" + repositoryName\n # Repository management\n server = AllegroGraph::Server.new :username => $AGRAPH['user'], :password => $AGRAPH['pass'], :host => $AGRAPH['host'], :port => $AGRAPH['port']\n repository = AllegroGraph::Repository.new server, repositoryName\n repository.create_if_missing!\n\n # SparQL queries\n repository.query.language = :sparql\n res = repository.query.perform \"SELECT distinct ?Class ?Subclass WHERE { ?Subclass rdfs:subClassOf ?Class . } Order by ?Class \"\n\n terms = Set.new\n # I know this could be done more efficiently...\n res['values'].each do |pair|\n terms.add(clean_uri(pair[0]))\n terms.add(clean_uri(pair[1])) \n end\n \n terms\n \nend", "def ontology\n load_ontology if @ontology.nil?\n @ontology\n end", "def term\n @term\n end", "def fetch_thesauri\n doc = create_doc('gaz-thesauri/administrativeThesaurus.xml')\n ## loop through each <term> element in the thesaurus\n vocabs=[]\n (doc/\"thesaurus/root/term\").each do |term|\n STDOUT << puts \n STDOUT << term.inspect\n STDOUT << puts \n\n end\n vocabs\n end", "def so_term(feature)\n if hash = @data[feature]\n return hash[\"so_term\"]\n end\n end", "def find_glossary_term!\n @glossary_term = find_or_goto_index(GlossaryTerm,\n params[:id].to_s)\n end", "def book_info_open_library\n client = Openlibrary::Client.new\n results = client.search(params[:q])\n rescue\n []\n end", "def fetch_rdf\n @doc = Nokogiri::XML(open(@url))\n @root_node = @doc.xpath(\"/rdf:RDF/rdf:Description\", @@NAMESPACES)\n end", "def book_info_open_library\n client = Openlibrary::Client.new\n results = client.search(params[:q])\n end", "def book_info_open_library\n client = Openlibrary::Client.new\n results = client.search(params[:q])\n end", "def term\n self.name\n end", "def fetch_term(qid)\n (t = Wikisnakker::Item.find(qid)) || raise('No such item')\n name = t.label('en')\n data = {\n id: name[/^(\\d+)/, 1],\n name: name,\n start_date: %w[P580 P571].map { |p| t.send(p).to_s }.reject(&:empty?).first,\n end_date: %w[P582 P576].map { |p| t.send(p).to_s }.reject(&:empty?).first,\n wikidata: qid,\n }\n puts data.values.to_csv\n\n if prev = t.P155 || t.P1365\n fetch_term(prev.value.id)\n end\nend", "def merritt_object_info\n repo = APP_CONFIG[:repository]\n collection = repo.endpoint.match(%r{[^/]+$}).to_s\n enc_doi = ERB::Util.url_encode(to_s)\n resp = HTTP.basic_auth(user: repo.username, pass: repo.password)\n .headers(accept: 'application/json')\n .get(\"#{repo.domain}/api/#{collection}/local_id_search?terms=#{enc_doi}\")\n return resp.parse if resp.headers['content-type'].start_with?('application/json')\n\n {}\n rescue HTTP::Error, JSON::ParserError\n {}\n end", "def term\n return unless lecture.present?\n lecture.term\n end", "def get(lang, term)\n query = \"#{lang}/#{term}\"\n @response = @conn.get query\n @response.body\n end", "def term_name\n self.content\n end", "def index_ontology_terms( ontology_term_conf, doc, data_row_obj, map_data )\n ontology_term_conf.each do |term_conf|\n attribute = term_conf[\"attr\"]\n value_to_index = extract_value_to_index( attribute, data_row_obj[attribute], map_data[:attribute_map], { attribute => data_row_obj[attribute] } )\n \n if value_to_index and !value_to_index.gsub(\" \",\"\").empty?\n cached_data = @ontology_cache[value_to_index]\n if cached_data != nil\n index_ontology_terms_from_cache( doc, term_conf, cached_data )\n else\n index_ontology_terms_from_fresh( doc, term_conf, value_to_index )\n end\n end\n end\n end", "def index\n @admin_terms = Admin::Term.search(params[:query]).order('lower(title) ASC').page(params[:page]).per(32)\n #@admin_terms = Admin::Term.all\n end", "def glossary_term_show(account_id, glossary_id, id, opts = {})\n data, _status_code, _headers = glossary_term_show_with_http_info(account_id, glossary_id, id, opts)\n data\n end", "def index\n @ontologies = Ontology.all\n end", "def retrieve_ontology(uri)\n case uri\n when CPO_URI\n file_path = \"/home/grosscol/workspace/ontologies/cpo/cpo.owl\"\n when PSDO_URI\n file_path = \"/home/grosscol/workspace/ontologies/psdo/psdo.owl\"\n else\n puts \"bad uri\"\n abort\n end\n\n #File.read file_path\nend", "def get_terms(repositoryName='ComputerScience_test')\n repo = set_repository(repositoryName)\n \n # SparQL queries\n @repository.query.language = :sparql\n res = @repository.query.perform \"SELECT distinct ?Class ?Subclass WHERE { ?Subclass rdfs:subClassOf ?Class . } Order by ?Class \"\n terms = Set.new\n # I know this could be done more efficiently...\n res['values'].each do |pair|\n terms.add(pair[0])\n terms.add(pair[1]) \n end\n terms \n end", "def terms_for_display\n # 'type' is the RDF.type assertion, which is not present by default, but may be\n # provided in some RDF schemas\n self.descMetadata.class.fields + [:tags] - [:tag]\n end", "def query(term, opts = {})\n parse_response(Defcli.read_url(search_url(term)), opts)\n end", "def brief_terms\n [\n #:relation,\n :asset_type,\n :uid,\n :pref_label\n ]\n end", "def index_ontology_terms_from_fresh( doc, term_conf, value_to_index )\n begin\n ontolo_term = OntologyTerm.new( value_to_index )\n parent_terms = ontolo_term.parentage\n\n terms_to_index = [ ontolo_term.term ]\n names_to_index = [ ontolo_term.term_name ]\n\n unless parent_terms.nil?\n parent_terms.each do |term|\n terms_to_index.unshift( term.term )\n names_to_index.unshift( term.term_name )\n end\n end\n\n # Remove the \"top-level\" ontology name - there's no need to have this \n # in the search index...\n names_to_index.shift\n\n # Store these terms to the cache for future use...\n data_to_cache = { :term => terms_to_index, :term_name => names_to_index }\n @ontology_cache[value_to_index] = data_to_cache\n \n # Write the data to the doc...\n index_ontology_terms_from_cache( doc, term_conf, data_to_cache )\n rescue OntologyTermNotFoundError => error\n # The ontology term couldn't be found - no worries, just move on...\n end\n end", "def terms_id\n parse_terms_id_response(SolrQuery.new.solr_query(q='rdftype_tesim:\"http://www.w3.org/2004/02/skos/core#ConceptScheme\" AND preflabel_tesim:\"places\"'))\n end", "def index\n @term_relationships = TermRelationship.all\n end", "def index_ontology_terms_from_cache( doc, term_conf, cached_data )\n [:term,:term_name].each do |term_or_name|\n cached_data[term_or_name].each do |target|\n doc[ term_conf[\"idx\"][term_or_name.to_s].to_sym ].push( target )\n end\n doc[ term_conf[\"idx\"][\"breadcrumb\"].to_sym ].push( cached_data[term_or_name].join(\" | \") )\n end\n end", "def go_terms\n go_db_id = ExternalDb.find_by_db_name('GO').id\n return self.all_xrefs.select{|x| x.external_db_id == go_db_id}.collect{|x| x.dbprimary_acc}.uniq\n end", "def term(attributes = nil)\r\n body = { query: { term: attributes } }\r\n result = client.search index: index, type: type, body: body\r\n\r\n result_instance(result)\r\n end", "def astronomy\n attribute('yweather:astronomy')\n end", "def index\n\t\t@ontologies = Ontology.all\n\tend", "def show_selected_glossary_terms(query, args = {})\n includes = @user ? { thumb_image: :image_votes } : :thumb_image\n args = {\n action: :index,\n letters: \"glossary_terms.name\",\n num_per_page: 50,\n include: includes\n }.merge(args)\n\n show_index_of_objects(query, args)\n end", "def to_term\n Upl::Term.new to_term_t\n end", "def secondary_terms\n [:gw_affiliation, :date_created,\n :description, :keyword,\n :identifier, :contributor, :publisher, :language,\n :based_near, :related_url, :bibliographic_citation]\n end", "def searchterm\r\n @@st.get_searchterm(referer)\r\n end", "def terms\n @terms ||= wayfinder.decorated_ephemera_terms.sort_by(&:label)\n end", "def autocomplete(term)\n get(\"/catalog/titles/autocomplete?term=#{term}\")\n end", "def to_term\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['toTerm']) if @data['toTerm']\n end", "def to_term\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['toTerm']) if @data['toTerm']\n end", "def from_term\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['fromTerm']) if @data['fromTerm']\n end", "def from_term\n ::HubEdos::StudentApi::V2::Term::Term.new(@data['fromTerm']) if @data['fromTerm']\n end", "def fetch_related_oids( oid )\n\t\toid = normalize_oid( oid )\n\t\tself.log.debug \"Fetching OIDs of resources related to %s\" % [ oid ]\n\t\treturn self.search( :criteria => {:relation => oid}, :include_related => true )\n\tend", "def ontology_based?\n source_ontology.present? && ols_root_term_uri.present?\n end", "def show\n# @term = Term.find(params[:id])\n @term = Term.where(:name=>params[:name]).first\n\t\tif @term.nil?\n @term = Term.new\n redirect_to( @term, :notice => \"Term '#{params[:name]}' not exists yet\" )\n return\n\t\tend\n\n @entries = @term.entries\n logger.debug \"entries #{@entries}\"\n @entries.each do |entry|\n logger.debug \"entry.id #{entry.id}\"\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @term }\n end\n end", "def term_values(*term_pointer)\n # TODO if we can add primary_solr_name onto OmDatastream, we may be able to do away with get_values_from_solr.\n if @internal_solr_doc\n #lazy load values from solr on demand\n get_values_from_solr(*term_pointer)\n else\n om_term_values(*term_pointer)\n end\n end", "def set_ontology\n @ontology = Ontology.find(params[:id])\n end", "def index\n @terms = Term.all\n end", "def show\n @term = Term.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @term }\n end\n end", "def show\n @term = Term.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @term }\n end\n end", "def get_terms(retina_name=nil, term=nil, get_fingerprint=nil, start_index=0, max_results=10)\n resource_path = '/terms'\n verb = 'GET'\n query_params = { 'retina_name' => retina_name, 'term' => term, 'start_index' => start_index,\n 'max_results' => max_results, 'get_fingerprint' => get_fingerprint }\n post_data = nil\n headers = {'Accept' => 'Application/json', 'Content-Type' => 'application/json'}\n\n response = @api_client.call_api(resource_path, verb, query_params,post_data, headers)\n JSON.parse(response.body, symbolize_names: true).map { |r| RetinaSDK::Model::Term.new(r) }\n end", "def set_ontology\n\t\t\t@ontology = Ontology.find(params[:id])\n\t\tend", "def get_trainer(uri)\n sparql = \"SELECT DISTINCT ?uri ?name ?surname ?givenName ?fullname ?birth_date ?image_url ?thumbnail_url ?abstract ?team_uri\n WHERE {\n ?uri <http://dbpedia.org/property/name> ?name .\n <#{uri}> <http://dbpedia.org/property/name> ?name .\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/surname> ?surname }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/givenName> ?givenName }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/fullname> ?fullname }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/birthDate> ?birth_date . }.\n OPTIONAL { <#{uri}> <http://xmlns.com/foaf/0.1/depiction> ?image_url . }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/ontology/thumbnail> ?thumbnail_url . }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/ontology/abstract> ?abstract . FILTER ( LANG(?abstract) = 'de' ) }.\n OPTIONAL { ?team_uri <http://dbpedia.org/ontology/coach> <#{uri}> . }.\n }\"\n solution = DBPEDIA.query(sparql).first\n end", "def show\n # if params[:value]\n # @occasion = Occasion.find(params[:value])\n\n # @results1 = Tradename.find_by_contents(query, :models => [Tradename, Client], :limit => :all)\n # if @results1.empty? \n # @results2 = Word.find_by_contents(query, :models => [Word, Tradename, Client], :limit => :all)\n # if @results2.empty?\n # @results = Client.find_by_contents(query, :models => [Client], :limit => :all)\n # else\n # @results = @results2\n # end\n # else\n # @results = @results1\n # end\n\n # end\n end", "def getSolrDescription\n uri = URI.parse(\"http://#{@host}:#{@port}/solr/admin/cores\")\n out = Net::HTTP.get_response(uri)\n if out.code.to_i == 200 \n return out.body\n else \n STDERR.puts \"Error reaching Solr: \" + \n \"#{out.header.code} -- #{out.header.message}\"\n return nil\n end \n end", "def retrieve_terms(key, id, reader, options)\n raise \"more_like_this atm only works on saved records\" if key.nil?\n document_number = document_number(key) rescue nil\n field_names = options[:field_names]\n max_num_tokens = options[:max_num_tokens]\n term_freq_map = Hash.new(0)\n doc = nil\n record = nil\n field_names.each do |field|\n #puts \"field: #{field}\"\n term_freq_vector = reader.term_vector(document_number, field) if document_number\n #if false\n if term_freq_vector\n # use stored term vector\n # puts 'using stored term vector'\n term_freq_vector.terms.each do |term|\n term_freq_map[term.text] += term.positions.size unless noise_word?(term.text, options)\n end\n else\n # puts 'no stored term vector'\n # no term vector stored, but we have stored the contents in the index\n # -> extract terms from there\n content = nil\n if document_number\n doc = reader[document_number]\n content = doc[field]\n end\n unless content\n # no term vector, no stored content, so try content from this instance\n record ||= options[:base_class].constantize.find(id)\n content = record.content_for_field_name(field.to_s)\n end\n puts \"have doc: #{doc[:id]} with #{field} == #{content}\"\n token_count = 0\n \n ts = options[:analyzer].token_stream(field, content)\n while token = ts.next\n break if (token_count+=1) > max_num_tokens\n next if noise_word?(token.text, options)\n term_freq_map[token.text] += 1\n end\n end\n end\n term_freq_map\n end", "def index\n @term_item_terms = TermItemTerm.all\n end", "def get_stadium(uri)\n sparql = \"\n SELECT DISTINCT ?uri ?name ?city_uri ?city ?population ?lat ?long ?capacity ?seatingCapacity ?image_url ?thumbnail_url ?abstract\n WHERE {\n ?uri <#{RDF::RDFS.label}> ?name .\n <#{uri}> <#{RDF::RDFS.label}> ?name .\n <#{uri}> <http://dbpedia.org/ontology/location> ?city_uri .\n ?city_uri <#{RDF::RDFS.label}> ?city .\n ?city_uri <http://dbpedia.org/ontology/populationTotal> ?population .\n <#{uri}> <http://www.w3.org/2003/01/geo/wgs84_pos#lat> ?lat .\n <#{uri}> <http://www.w3.org/2003/01/geo/wgs84_pos#long> ?long .\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/capacity> ?capacity }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/property/seatingCapacity> ?seatingCapacity }.\n OPTIONAL { <#{uri}> <http://xmlns.com/foaf/0.1/depiction> ?image_url }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/ontology/thumbnail> ?thumbnail_url }.\n OPTIONAL { <#{uri}> <http://dbpedia.org/ontology/abstract> ?abstract }.\n FILTER (str(?uri) = '#{uri}' && lang(?city) = 'en' && lang(?name) = 'en' && ?population > 5000)\n }\n \"\n solutions = DBPEDIA.query(sparql).find_all { |sol| !sol.city_uri.to_s.eql?('http://dbpedia.org/resource/Brazil') }.first\n end", "def terms\n end", "def tb_status\n Concept.find(Observation.find(:first, \n :order => \"obs_datetime DESC,date_created DESC\",\n :conditions => [\"person_id = ? AND concept_id = ? AND value_coded IS NOT NULL\", self.id, \n ConceptName.find_by_name(\"TB STATUS\").concept_id]).value_coded).fullname rescue \"UNKNOWN\"\n end", "def term\n eat_ws_and_comments\n if peek == \"'\" # quoted\n return quote_term\n elsif peek == \"`\" # quasiquote\n return quasi_term\n elsif peek == \",\"\n return unquote_term\n elsif str = string_term\n return str\n end\n # We begin by trying the various collections\n [:list_term, :array_term, :hash_term].each do |coll|\n coll = method coll\n value = coll.call\n return value unless value.nil?\n end\n # Then it must be a basic term\n naive_term\n end", "def term(name)\n element(name, :class=>:term)\n end", "def terms\n\n end", "def terms\n\n end", "def get_info(id)\n url = \"http://www.omdbapi.com/?i=#{id}&y=&plot=short&r=json\"\n return_result(url)\n end", "def get_library_location_names\n results = Blacklight.solr.find( { :q => \"id:*\", })\n end", "def get_library_location_names\n results = Blacklight.solr.find( { :q => \"id:*\", })\n end", "def query_def; @hit.mrna.definition; end", "def get_opensearch_response(field=nil, extra_controller_params={})\n solr_params = solr_opensearch_params(extra_controller_params)\n response = Blacklight.solr.find(solr_params)\n a = [solr_params[:q]]\n a << response.docs.map {|doc| doc[solr_params[:fl]].to_s }\n end", "def list_books(api_object)\n puts \"Current Books:\"\n doc = Nokogiri::XML.parse api_object.read\n names = doc.xpath('books/book/title').collect {|e| e.text }\n puts names.join(\", \")\n puts \"\"\nend", "def omdb_pull(search_key, search_val)\n\n result = Typhoeus.get(\"http://www.omdbapi.com/\", :params => {search_key => search_val})\n result = JSON.parse(result.body)\n result\n\nend", "def extractDatabase(type)\n Nokogiri::XML(IO.read(\"#{$path}../../databases/taxonomy.xml\")).xpath(\"//taxon[@label=\\\"#{type}\\\"]//file/@URL\").to_s\nend", "def full_paper_info(keywords, searchType)\n keyword = concat_keywords(keywords, searchType)\n uri = URI('https://api.labs.cognitive.microsoft.com/academic/v1.0/evaluate')\n query = URI.encode_www_form({\n 'expr' => keyword,\n 'model' => 'latest',\n 'count' => '50',\n 'offset' => '0',\n 'attributes' => 'Id,Ti,AA.AuN,Y,D,F.FN,E,RId'\n })\n\n if uri.query && uri.query.length > 0\n uri.query += '&' + query\n else\n uri.query = query\n end\n\n get(uri)\n end", "def term\r\n Riddle::Query.escape params[:term]\r\n end", "def term\r\n Riddle::Query.escape params[:term]\r\n end", "def show\n @gene_ontology = GeneOntology.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def extract_rels_ext( text, solr_doc=Solr::Document.new )\n # TODO: only read in this file once\n map = YAML.load(File.open(File.join(Rails.root, \"config/hydra_types.yml\")))\n \n doc = Nokogiri::XML(text)\n doc.xpath( '//foo:hasModel', 'foo' => 'info:fedora/fedora-system:def/model#' ).each do |element|\n cmodel = element.attributes['resource'].to_s\n solr_doc << Solr::Field.new( :cmodel_t => cmodel )\n \n if map.has_key?(cmodel)\n solr_doc << Solr::Field.new( :hydra_type_t => map[cmodel] )\n end\n end\n\n return solr_doc\n end", "def show\n results = Dbpedia.sparql.query(\"SELECT ?person ?abstract ?name WHERE {\n ?person rdf:type <http://dbpedia.org/ontology/Person>.\n ?person foaf:name ?name.\n ?person dbpedia-owl:abstract ?abstract .\n FILTER (LANG(?abstract)='pl' && ?name=\\\"\"+@author.full_name+\"\\\"@en)\n }\")\n if results.first != nil\n @bio=results.first[:abstract] \n end\n end", "def index\n @common_terms = CommonTerm.all\n end", "def index\n @terms = Term.where(:user_id => session[:user_id])\n end", "def last_term\n entry = entries.last\n entry ? entry.term : nil\n end", "def observations_of_related_taxa\n query = create_query(:Observation, :all,\n names: parents(params[:name]),\n include_subtaxa: true,\n by: :confidence)\n show_selected_observations(query)\n end", "def to_term_record(term_or_word)\n return term_or_word if term_or_word.respond_to?(:word)\n return @term_hash[term_or_word]\n end", "def data\n what = searched_for(@term)\n where = searched_in(@filter)\n {\n term: @term,\n title: (what + where).sub(/\\sin\\s|\\sfor\\s/, ''), # strip out opening ' in ' or ' for '\n cpvs: @cpvs,\n keywords: @term,\n countries: @filter.countries,\n what: what,\n where: where,\n }\n end", "def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\n end", "def find_terms(doc)\n terms_match = @terms.select { |term| doc.join('').match(term.to_s) }\n\n terms_match.map do |term, definition|\n \"*[#{term}]: #{definition}\".delete(\"\\t\\r\\n\").squeeze(' ').strip\n end\nend", "def terms artist\n url = URI.parse(\"http://developer.echonest.com/api/v4/artist/terms?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json\")\nend", "def search_all_terms\n render json: Article.with_all_terms(params[:query]).map(&:title)\n end", "def term; end", "def terms\n @term_hash.values\n end", "def show\n @go_term = GoTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @go_term }\n end\n end", "def to_term\n subject\n end", "def description\n fetch('restaurant.description')\n end", "def get_document_frequency(term)\n\t\t\t@term_hash[term]\n\t\tend", "def terms\n\tend" ]
[ "0.68499243", "0.6329367", "0.6329367", "0.62658453", "0.62274903", "0.61576813", "0.6092739", "0.59762514", "0.5881532", "0.58179694", "0.5768398", "0.57119757", "0.5704081", "0.5704081", "0.5675916", "0.5651722", "0.55973685", "0.5560954", "0.5536284", "0.5526757", "0.54803866", "0.5366501", "0.53536963", "0.53069645", "0.53047967", "0.530295", "0.5299924", "0.5295084", "0.52919567", "0.5291903", "0.5288112", "0.5275726", "0.52744293", "0.52707225", "0.5264148", "0.52573395", "0.52567124", "0.52565444", "0.52279246", "0.521364", "0.5195711", "0.5179094", "0.51660866", "0.5152977", "0.5152977", "0.51521987", "0.51521987", "0.5139643", "0.5135714", "0.5135048", "0.5129912", "0.5128022", "0.51259357", "0.5116878", "0.5116878", "0.5110736", "0.50834835", "0.50753284", "0.5073805", "0.5063496", "0.5041647", "0.50303215", "0.5029051", "0.5024318", "0.5011581", "0.5001138", "0.49901515", "0.4990045", "0.4990045", "0.49834013", "0.49656788", "0.49656788", "0.49580327", "0.49539262", "0.49520254", "0.49480978", "0.49456894", "0.49356338", "0.49287158", "0.49287158", "0.4926446", "0.49173293", "0.49160746", "0.4914974", "0.49092144", "0.4905161", "0.48926774", "0.48878402", "0.48864973", "0.4881622", "0.4874601", "0.4869996", "0.4855929", "0.4854798", "0.4845999", "0.48453647", "0.48444507", "0.4843859", "0.4838843", "0.4838547" ]
0.8191284
0
Helper function to try to find an ontology term via a synonym.
def get_term_from_synonym sql = <<-SQL select term.* from term join ontology on ontology.ontology_id = term.ontology_id join term_synonym on term.term_pk = term_synonym.term_pk where term_synonym.synonym_value = ? order by ontology.fully_loaded desc, ontology.load_date asc SQL term_set = OLS_DB[ sql, @name ].all() raise OntologyTermNotFoundError, "Unable to find the term '#{@name}' in the OLS database." \ if term_set.size == 0 subject = term_set.first @name = subject[:identifier] @content = subject[:term_name] @term_pk = subject[:term_pk] @ontology_id = subject[:ontology_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_synonyms(synonyms)\n return self.find_helper(@start_node, synonyms)\n end", "def get_synonym(property, key)\n return unless property[:synonyms] && property[:synonyms].include?(key)\n property[:synonyms][key]\n end", "def find_glossary_term!\n @glossary_term = find_or_goto_index(GlossaryTerm,\n params[:id].to_s)\n end", "def get_institution_synonym(affi_string)\n found_inst = nil\n $institution_synonyms.keys.each do |inst_key|\n if affi_string.include?(inst_key.to_s) then\n if found_inst == nil then\n found_inst = inst_key.to_s\n elsif found_inst.length < inst_key.to_s.length then\n found_inst = inst_key.to_s\n end\n end\n end\n return found_inst\nend", "def synonym(existing_word, *synonyms)\n existing_word = existing_word.to_s\n raise \"'#{existing_word}' is not in the vocabulary\" if type(existing_word).nil?\n reduced_form = reduce(existing_word)\n [synonyms].flatten.each do |syn|\n syn = syn.to_s\n existing_definition = @type_map[syn]\n if existing_definition.nil?\n @type_map[syn] = reduced_form\n elsif existing_definition != reduced_form\n raise \"'#{syn}' is already defined and is incompatible as a synonym of #{existing_word}\"\n end\n end\n end", "def get_synonym_for(word, country = nil, age_from = nil, age_to = nil,\n gender = nil, education = nil)\n keyword = Keyword.find_by_name(word)\n\n if keyword.blank?\n Keyword.add_keyword_to_database(word)\n return nil\n end\n\n if self.project.present?\n prefered_synonym = PreferedSynonym\n .where(keyword_id: keyword.id, project_id: self.project.id).first\n return prefered_synonym.synonym if prefered_synonym.present?\n\n country = self.project.country unless country.present?\n age_from = self.project.minAge unless age_from.present?\n age_to = self.project.maxAge unless age_to.present?\n gender = self.project.gender unless gender.present?\n education = self.project.education_level unless education.present?\n end\n\n synonym_list, votes_count =\n keyword.retrieve_synonyms(country, age_from, age_to, gender, education)\n synonym_list.first\n end", "def []( word, *args )\n\t\tif word.is_a?( Integer )\n\t\t\t# :TODO: Assumes Synset IDs are all >= 100_000_000\n\t\t\tif word.to_s.length > 8\n\t\t\t\treturn WordNet::Synset[ word ]\n\t\t\telse\n\t\t\t\treturn WordNet::Word[ word ]\n\t\t\tend\n\t\telse\n\t\t\treturn self.lookup_synsets( word, 1, *args ).first\n\t\tend\n\tend", "def find_by_word(word)\n @wordlist[word] if word_exists?(word)\n end", "def find_by_word(word, root, root_namespace, options = nil)\n xquery = <<-GENERATED\n import module namespace search = \"http://marklogic.com/appservices/search\" at \"/MarkLogic/appservices/search/search.xqy\";\n search:search(\"#{word}\",\n GENERATED\n search_options = setup_options(options, root, root_namespace)\n xquery << search_options.to_s\n xquery << ')'\n end", "def lookup(word)\r\n @word.each do |h|\r\n if h[:Word] == word.to_s\r\n return h[:Definition]\r\n end\r\n end\r\n end", "def resolve(resource, position:)\n RDF::Literal(resource.to_s.downcase) if resource.term?\n end", "def resolve(resource, position:)\n RDF::Literal(resource.to_s.downcase) if resource.term?\n end", "def find_by_term(str)\n idx = @children.map(&:term).index(str)\n return nil if idx.nil?\n @children[idx]\n end", "def get_country_synonym(affi_string)\n cleared_affi_string = country_exclude(affi_string)\n $country_synonyms.keys.each do |ctry_key|\n if cleared_affi_string.include?(ctry_key.to_s)\n return ctry_key.to_s\n end\n end\n return nil\nend", "def find_word(lexical_item)\n \n end", "def lookup(word)\n word.gsub!(/\\s/, \"+\")\n meaning_file = initialize_files(word)[0]\n f = File.open(meaning_file)\n begin\n extract_text(f)\n rescue Exception\n raise\n end\n\n end", "def describe_synonym(schema_name, synonym_name) #:nodoc:\n raise NoMethodError, \"Not implemented for this raw driver\"\n end", "def set_lesson_word_synonym\n begin\n @course = Course.find(params[:course_id])\n @lesson = Lesson.find(params[:lesson_id])\n @lesson_word_synonym = LessonWordSynonym.find_by!(synonym_id: params[:synonym_id], lesson_word_id: params[:lesson_word_id])\n end\n end", "def look_up(term)\n # First, let's convert our user input to lowercase.\n term = term.downcase\n # If the word doesn't exist in my hash, let the user know.\n if !@words[term] \n return \"Sorry, I don't have a definition for \\\"#{term}\\\"...\"\n # Otherwise, spit out my definition. \n else\n @words[term].definition\n end\n\n end", "def get_term(term)\n term = term.gsub(Regex::ESCAPE) { |x| \"#{Regex::ESCAPECHAR}#{x}\" }\n tmp = SearchType::SEARCH_START\n search_type = SearchType::SEARCH_START | SearchType::SEARCH_END\n\n term = \"#{Regex::WILDCARD}#{term}\" if (search_type | tmp) == search_type\n tmp = SearchType::SEARCH_END\n term += Regex::WILDCARD.to_s if (search_type | tmp) == search_type\n term\n end", "def wordnet_lookup_syns(lemma, pos)\n # Convert back to wordnet format\n lemma = lemma.tr(' ', '_')\n if (wordnet_lemma = WordNet::Lemma.find(lemma, pos))\n # Fetch all synonyms (combining all senses of the word)\n wordnet_lemma.synsets.flat_map(&:words).map do |w|\n # Clean up the output\n # - Adjectives can have an adjective marker at their end which needs be\n # stripped. Eg. beautiful(ip), beautiful(p), beautiful(a)\n # - Replace underscores with spaces\n w.gsub(/\\([a-z]*\\)$/, '').tr('_', ' ')\n end\n else\n []\n end\n end", "def term\n Term.find(self.term_id)\n end", "def get_synonym_set(engine_name, id)\n get(\"engines/#{engine_name}/synonyms/#{id}\")\n end", "def find(thing)\n case thing\n when Symbol\n find_by_tag(thing)\n when String\n find_by_string(thing)\n when Array\n find_by_string(thing.join(' '))\n when Node\n thing\n end\n end", "def synonyms; end", "def lookup(meaning, should_invent=false)\n word = nil\n unless meaning.empty?\n rules = grammar.lookup(meaning)\n if rules.empty?\n if should_invent\n word = utter_randomly\n # self.learn Utterance.new meaning, word\n end\n else\n rules.sort_by! do |rule|\n rule.meaning.missing_parts.count\n end.reverse!\n rules.each do |rule|\n if rule.meaning.full?\n word = rule.word\n break\n else\n current = rule.clone\n current.meaning.missing_parts.each do |index, part|\n required = Meaning.new\n required[part] = meaning[part]\n res = lookup(required, should_invent)\n if res.nil?\n word = nil\n break\n else\n current.embed!(part, index, res)\n end\n end\n if current.meaning.full?\n word = current.word\n break\n end\n end\n end\n end\n end\n word\n end", "def search(term)\n all.select do |unit|\n unit.aliases.any? { |str| Regexp.new(term).match(str) }\n end\n end", "def get_term_details\n # This query ensures we look at the most recent fully loaded ontologies\n sql = <<-SQL\n select term.*\n from term\n join ontology on ontology.ontology_id = term.ontology_id\n where term.identifier = ?\n order by ontology.fully_loaded desc, ontology.load_date asc\n SQL\n \n term_set = OLS_DB[ sql, @name ].all()\n \n if term_set.size == 0\n get_term_from_synonym\n else\n subject = term_set.first\n @content = subject[:term_name]\n @term_pk = subject[:term_pk]\n @ontology_id = subject[:ontology_id]\n end\n end", "def singular?(word, term: :noun)\n case term.to_sym\n when :noun, :n\n Noun[word].singular?\n when :verb, :v\n Verb[word].singular?\n else\n raise Error, \"Unknown option '#{term}' as a term\"\n end\n end", "def find(word)\n findBy :word_text, word\n end", "def get_rhymable_word(atoms)\n atoms.reverse_each do |atom|\n if (!atom.match(/^[,:;.?!]+$/))\n return atom\n end\n end\n end", "def search(word)\n last = word.each_char.inject(@root) do |curr, char|\n curr.is_a?(TrieNode) ? curr[char] : nil\n end \n last && last[:_] || false \n end", "def search_for_word(search_word)\n index_of_search_word = words.find_index { |obj| obj.word == search_word }\n words[index_of_search_word]\n end", "def find_word(word, node = @root)\n if word == \"\" && node.end_of_word\n return node\n else\n child = node.find_child(word[0])\n child ? find_word(word[1..-1], child) : nil\n end\n end", "def badword_QualifiedName(o)\n if o.value == 'bigly'\n acceptor.accept(Issues::INVALID_WORD, o, :text => o.value)\n end\n end", "def search(word)\n search_prefix(root, word, 0)\n end", "def search(word)\n Parser.new(query(word)).parse\n end", "def process_term(element, value, **options)\n if options[:vocab]\n # If there is a local default vocabulary, the IRI is obtained by concatenating that value and the term\n return uri(options[:vocab] + value)\n elsif options[:term_mappings].is_a?(Hash)\n # If the term is in the local term mappings, use the associated URI (case sensitive).\n return uri(options[:term_mappings][value.to_s.to_sym]) if options[:term_mappings].has_key?(value.to_s.to_sym)\n\n # Otherwise, check for case-insensitive match\n options[:term_mappings].each_pair do |term, uri|\n return uri(uri) if term.to_s.downcase == value.to_s.downcase\n end\n end\n\n # Finally, if there is no local default vocabulary, the term has no associated URI and must be ignored.\n add_warning(element, \"Term #{value} is not defined\", RDF::RDFA.UnresolvedTerm)\n nil\n end", "def find_document( field, search_term )\n if field == @config[\"schema\"][\"unique_key\"].to_sym\n return get_document( search_term )\n else\n map_term = @document_cache_lookup[field][search_term]\n if map_term\n return get_document( map_term )\n else\n return nil\n end\n end\n end", "def lookup_synsets( word, *args )\n\t\tdataset = WordNet::Synset.filter( :words => WordNet::Word.filter(lemma: word.to_s) )\n\t\tself.log.debug \"Looking up synsets for %p\" % [ word.to_s ]\n\n\t\t# Add filters to the dataset for each argument\n\t\targs.each do |arg|\n\t\t\tself.log.debug \" constraint arg: %p\" % [ arg ]\n\t\t\tcase arg\n\n\t\t\twhen Integer\n\t\t\t\tself.log.debug \" limiting to sense %d\" % [ arg ]\n\t\t\t\tdataset = dataset.limit( 1, arg-1 )\n\n\t\t\twhen Range\n\t\t\t\tself.log.debug \" limiting to range of senses: %p\" % [ arg ]\n\t\t\t\tdataset = dataset.limit( arg.end - arg.begin, arg.begin - 1 )\n\n\t\t\twhen Regexp\n\t\t\t\tself.log.debug \" filter: definition =~ %p\" % [ arg ]\n\t\t\t\tdataset = dataset.filter( definition: arg )\n\n\t\t\twhen Symbol, String\n\t\t\t\t# Lexical domain, e.g., \"verb.motion\"\n\t\t\t\tif domain = WordNet::Synset.lexdomains[ arg.to_s ]\n\t\t\t\t\tself.log.debug \" filter: lex domain: %s (%d)\" % [ arg, domain[:lexdomainid] ]\n\t\t\t\t\tdataset = dataset.filter( lexdomainid: domain[:lexdomainid] )\n\n\t\t\t\t# Part of speech symbol, e.g., \"v\"\n\t\t\t\telsif WordNet::Synset.postype_table.key?( arg.to_sym )\n\t\t\t\t\tself.log.debug \" filter: part of speech: %s\" % [ arg ]\n\t\t\t\t\tdataset = dataset.filter( pos: arg.to_s )\n\n\t\t\t\t# Part of speech name, e.g., \"verb\"\n\t\t\t\telsif pos = WordNet::Synset.postypes[ arg.to_s ]\n\t\t\t\t\tself.log.debug \" filter: part of speech: %s\" % [ pos.to_s ]\n\t\t\t\t\tdataset = dataset.filter( pos: pos.to_s )\n\n\t\t\t\t# Assume it's a definition match\n\t\t\t\telse\n\t\t\t\t\tpattern = \"%%%s%%\" % [ arg ]\n\t\t\t\t\tself.log.debug \" filter: definition LIKE %p\" % [ pattern ]\n\t\t\t\t\tdataset = dataset.filter { :definition.like(pattern) }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\treturn dataset.all\n\tend", "def Noun(word)\n Noun[word]\n end", "def find_word_in_project(project_id, keyword_id, optional = false)\n keyword = PreferedSynonym.where(\"project_id = ? AND keyword_id = ?\", project_id, keyword_id).first\n if keyword != nil\n if !optional\n return true\n else\n return true, Keyword.find_by_id(keyword.keyword_id)\n end \n else\n if !optional\n return false\n else\n return false, nil\n end\n end \n end", "def property_for(term)\n if mapping.key?(term) && metadata.respond_to?(mapping[term])\n mapping[term]\n elsif metadata.respond_to?(term)\n term\n end\n end", "def find_terms(doc)\n terms_match = @terms.select { |term| doc.join('').match(term.to_s) }\n\n terms_match.map do |term, definition|\n \"*[#{term}]: #{definition}\".delete(\"\\t\\r\\n\").squeeze(' ').strip\n end\nend", "def find_external_alias(name, singleton)\n @external_aliases.find { |m| m.name == name && m.singleton == singleton }\n end", "def so_term(feature)\n if hash = @data[feature]\n return hash[\"so_term\"]\n end\n end", "def singularize(word, term: :noun)\n case term\n when :noun, :n\n Noun[word].singular\n when :verb, :v\n Verb[word].singular\n end\n end", "def for_term(query_term)\n SubstringRules.for(query_term)\n end", "def synonyms #:nodoc:\n select_all(\"SELECT synonym_name, table_owner, table_name, db_link FROM all_synonyms where owner = SYS_CONTEXT('userenv', 'session_user')\").collect do |row|\n OracleEnhanced::SynonymDefinition.new(oracle_downcase(row[\"synonym_name\"]),\n oracle_downcase(row[\"table_owner\"]), oracle_downcase(row[\"table_name\"]), oracle_downcase(row[\"db_link\"]))\n end\n end", "def searchterm\r\n @@st.get_searchterm(referer)\r\n end", "def find_word(word)\n chars = word.chars\n current = @root\n\n word_found =\n chars.all? { |c| current = current.children.find { |n| n.value == c } }\n yield word_found, current if block_given?\n\n current\n end", "def find_keyword(*args)\n body, list = _extract_token_search_args(args)\n list.map! {|x| x.to_s}\n lexed = lex(body)\n lexed.find.with_index do |tok, idx|\n is_keyword = tok[1] == :on_kw && list.include?(tok[2])\n is_not_symbol = idx == 0 || lexed[idx-1][1] != :on_symbeg\n is_keyword && is_not_symbol\n end\n end", "def find_word( word )\n word_str = word.to_s\n found_word = nil\n if @words_set.include? word_str\n found_word = word_str\n elsif @words_set.include? word_str.capitalize\n found_word = word_str.capitalize\n elsif @words_set.include? word_str.downcase\n found_word = word_str.downcase\n end\n found_word\n end", "def search(word)\n result = find(word)\n !!(result && result.isend)\n end", "def resolve_word(name)\n @vm.log(:verbose, \"resolve_word(#{name})\")\n nm = canonical(name)\n if @dict[nm].nil?\n need(nm, true)\n resolve_references do |token|\n @vm.log(:verbose, \" compiling resolved token #{token}\")\n compile_word(@dict[token])\n end\n end\n nm\n end", "def term_param(name)\n term_params.select {|t| t.name == name}[0]\n end", "def find_node(options)\n options[:id] = options.delete(:stem) if options[:stem]\n\n unless options[:word] || options[:id]\n raise ArgumentError, 'no find option specified'\n end\n\n if options[:word]\n word = options[:word].mb_chars.downcase.to_s\n nodes.find do |n|\n n.words.include?(word)\n end\n else\n id = options[:id].mb_chars.downcase.to_s\n nodes.find do |n|\n n.id == id\n end\n end\n end", "def term\n @term\n end", "def config_for_term_or_uri(term)\n return properties[term.to_s] unless\n term.is_a?(RDF::Resource) && !term.is_a?(RDFSource)\n properties.each_value { |v| return v if v.predicate == term.to_uri }\n end", "def findName(podling, list)\n if list.include?(podling.name)\n return podling.name\n end\n podling.resourceAliases.each do |a|\n if list.include? a\n return a\n end\n end\n return nil\nend", "def synonyms\n @synonyms ||= {\n /^awesome$/i => %w[great excellent cool awesome splendid],\n /^okay$/i => %w[okay great alright],\n /^hello$/i => %w[hello hi greetings],\n /^yes$/i => %w[yes affirmative definitely correct certainly],\n /^no$/i => %w[no negative incorrect false],\n /^update$/i => %w[update change modify revise alter edit adjust],\n /^updated$/i => %w[updated changed modified revised altered edited adjusted],\n /^add$/i => %w[add create],\n /^added$/i => %w[added created],\n /^what|how$/i => %w[how what]\n }\n end", "def is?(term, type_sym)\n return term[:type] == type_sym\n end", "def find_by_token(name, token)\n token = find_token(:name => \"#{name}\", :token => token)\n token.object if token\n end", "def find_words words\n\t\t\t\twords.empty? ? [] : App.rdf_collection.find({\n\t\t\t\t\t:\"$or\" => words.map {|i| {:o => i}},\n\t\t\t\t\t:p => RDF::RDFS.label.to_s}).map do |data|\n\t\t\t\t\tRDF::Statement.from_mongo(data)\n\t\t\t\tend\n\t\t\tend", "def find_word(word)\n\t\tfc = word[0,1].downcase\n\t\t# check if it's a vowel\n\t\tif fc =~ /[aeiou]/\n\t\t\t# if so, then check in each bucket\n\t\t\t\"aeiou\".split(//).map do |letter|\n\t\t\t\tfind_matches(@dictionary[letter], word)\n\t\t\tend.flatten\n\t\telse\n\t\t\t# else we do the search directly\n\t\t\tfind_matches(@dictionary[fc], word)\n\t\tend\n\tend", "def term(name)\n element(name, :class=>:term)\n end", "def find_term_references(doc, terms)\n logger.info(\"+ Finding references to terms\")\n\n i = 0\n\n # sort terms by the length of the defined term, desc,\n # so that we don't find short terms inside longer\n # terms\n terms = terms.to_a.sort_by { |pair| -pair[1].size }\n\n # look for each term\n for term_id, term in terms\n doc.xpath('//a:body//text()', a: NS).each do |text|\n # replace all occurrences in this text node\n\n # unless we're already inside a def or term element\n next if ([\"def\", \"term\"].include?(text.parent.name))\n\n # don't link to a term inside its own definition\n owner = find_up(text, 'subsection')\n next if owner and owner.at_xpath(\".//a:def[@refersTo='##{term_id}']\", a: NS)\n\n while posn = (text.content =~ /\\b#{Regexp::escape(term)}\\b/)\n # <p>A delegation under subsection (1) shall not prevent the <term refersTo=\"#term-Minister\" id=\"trm357\">Minister</term> from exercising the power himself or herself.</p>\n node = doc.create_element('term', term, refersTo: \"##{term_id}\", id: \"trm#{i}\")\n\n pre = (posn > 0) ? text.content[0..posn-1] : nil\n post = text.content[posn+term.length..-1]\n\n text.before(node)\n node.before(doc.create_text_node(pre)) if pre\n text.content = post\n\n i += 1\n end\n end\n end\n end", "def term\n eat_ws_and_comments\n if peek == \"'\" # quoted\n return quote_term\n elsif peek == \"`\" # quasiquote\n return quasi_term\n elsif peek == \",\"\n return unquote_term\n elsif str = string_term\n return str\n end\n # We begin by trying the various collections\n [:list_term, :array_term, :hash_term].each do |coll|\n coll = method coll\n value = coll.call\n return value unless value.nil?\n end\n # Then it must be a basic term\n naive_term\n end", "def search_word\n @words =\n if login?\n current_user.words.search params[:term]\n else\n Word.search params[:term]\n end\n end", "def twitter_search(term)\n TwitterClient.new.search(term)\n end", "def semantic_find\n self.class.semantic_resource.find(params[:id])\n end", "def search(word)\n node = @root\n word.each_char do |c|\n node = node[c]\n return false if node.nil?\n end\n !node[END_OF_WORD].nil?\n end", "def find_token(*args)\n body, list = _extract_token_search_args(args)\n lexed = lex(body)\n lexed.find.with_index do |tok, idx|\n is_token = list.include?(tok[1])\n is_not_symbol = idx == 0 || lexed[idx-1][1] != :on_symbeg\n is_token && is_not_symbol\n end\n end", "def find_surgery_term surgeryterm\n # Search the surgery terms\n Surgery.where(user_type: \"admin\").any_of({ :name => /^#{surgeryterm}/i }) \n end", "def mentor_term_for_mentor(mentor)\n mentor_term = mentor_terms.find_by_mentor_id(mentor.id) rescue nil\n mentor_term ||= deleted_mentor_terms.find_by_mentor_id(mentor.id) rescue nil\n return mentor_term\n end", "def config_for_term_or_uri(term)\n return properties[term.to_s] unless term.kind_of? RDF::Resource\n properties.each_value { |v| return v if v.predicate == term.to_uri }\n end", "def search(word)\n \n end", "def word\n if @sym == SYM_ATOM || @sym == SYM_QTEXT\n save_text\n get\n else\n\t error \"expected word, got #{@sym.inspect}\"\n\tend\n end", "def find(name); end", "def search(term)\n raise NoSearchTermException, \"No search term specified\" if term.nil?\n connection do\n client.search(term)\n end \n end", "def terms_id\n parse_terms_id_response(SolrQuery.new.solr_query(q='rdftype_tesim:\"http://www.w3.org/2004/02/skos/core#ConceptScheme\" AND preflabel_tesim:\"places\"'))\n end", "def search(term)\n raise \"Must be overridden\"\n end", "def do_search(term = nil)\n @terms = term unless term.nil? #replace saved term with argument, if passed\n @attempts += 1\n @doc = Nokogiri::XML(open(build_call(@terms)))\n parse\n end", "def term\r\n Riddle::Query.escape params[:term]\r\n end", "def term\r\n Riddle::Query.escape params[:term]\r\n end", "def set_molecule_synonym\n @molecule_synonym = MoleculeSynonym.find(params[:id])\n end", "def hint(word)\n\t\tget_definition(word) \n\tend", "def set_term\n @term = UriService.client.find_term_by_internal_id(params[:id])\n raise ActionController::RoutingError, \"Could not find Term with internal_id: #{params[:id]}\" if @term.nil?\n end", "def property_for(term)\n if mapping.key?(term) && object.respond_to?(mapping[term])\n mapping[term]\n elsif object.respond_to?(term)\n term\n end\n end", "def synonyms(opts = {})\n self.meanings.uniq.collect { |ref| ref.tags }.flatten.uniq\n end", "def word\n Word.find_by(text: params[:text])\n end", "def find_territory\n Territory.find_by_slug(params[:slug])\n end", "def search(word, options)\n session.options = adapt_to_dev_env(options)\n session.get(\"/publications?keyword=#{CGI.escape(word)}\")\n end", "def search_person(name = \"\")\n\t\t@nutshell.search_person(name)\n\tend", "def lookup!(id_or_slug)\n lookup(id_or_slug) || (raise Mongoid::Errors::DocumentNotFound.new(self, id_or_slug))\n end", "def term\n self.name\n end", "def _word\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_atom)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_quoted_string)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_word unless _tmp\n return _tmp\n end", "def find_by_alias(alias_to_find)\n SERVERS.fetch(\"#{alias_to_find}\")\nend", "def find(typed_name)\n nil\n end", "def find(word, node = @root)\n new_node = nil\n word.each_char do |char|\n new_node = node.find_child_node(char)\n if new_node == nil\n return nil\n end\n node = new_node\n end\n node\n end" ]
[ "0.63477594", "0.6241856", "0.59999985", "0.5946214", "0.588208", "0.584254", "0.5829018", "0.57326806", "0.5687308", "0.5675328", "0.5636151", "0.5636151", "0.56210554", "0.5585503", "0.55471754", "0.5498107", "0.5492347", "0.5476299", "0.54601806", "0.5453996", "0.5452583", "0.54502046", "0.5435765", "0.54217535", "0.5409602", "0.54004043", "0.53960043", "0.5369925", "0.5365866", "0.53607136", "0.5338549", "0.5312655", "0.5305711", "0.53020954", "0.52985215", "0.5297097", "0.5271234", "0.52661026", "0.5259417", "0.5258725", "0.52401257", "0.52238697", "0.5223011", "0.521281", "0.52057785", "0.5194498", "0.51875246", "0.5185466", "0.5144093", "0.513466", "0.51233995", "0.51198876", "0.510978", "0.5109657", "0.51049274", "0.50873804", "0.5084792", "0.5068541", "0.506027", "0.50570434", "0.5045121", "0.50271636", "0.5023827", "0.5022939", "0.50113577", "0.50098836", "0.5009343", "0.50073326", "0.5004763", "0.5002622", "0.49942863", "0.49897853", "0.49878278", "0.49840552", "0.4973092", "0.49726087", "0.4970051", "0.49626595", "0.4942267", "0.4941997", "0.49395442", "0.49373826", "0.4924874", "0.49207637", "0.49207637", "0.49057376", "0.49036956", "0.48974875", "0.48952776", "0.4893051", "0.4892829", "0.4888327", "0.48700964", "0.48695156", "0.48630303", "0.48512253", "0.48495626", "0.4842871", "0.48415318", "0.48370627" ]
0.73792243
0
Recursive function to query the OLS database and collect all of
def get_parents( node=self ) sql = <<-SQL select subject_term.identifier as child_identifier, subject_term.term_name as child_term, predicate_term.term_name as relation, object_term.identifier as parent_identifier, object_term.term_name as parent_term from term_relationship tr join term as subject_term on tr.subject_term_pk = subject_term.term_pk join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk join term as object_term on tr.object_term_pk = object_term.term_pk where predicate_term.term_name in ('part_of','is_a','develops_from') and subject_term.identifier = ? SQL OLS_DB[ sql, node.term ].each do |row| parent = OntologyTerm.new( row[:parent_identifier], row[:parent_term] ) parent << node get_parents( parent ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all\n \n end", "def find_all_parents\n end", "def recurse_result_set(result, options = {}, &block)\n return result unless block_given? \n inner_recursion = options.delete(:inner_recursion)\n result_set = inner_recursion ? result : result.dup\n \n parent_id = (options.delete(:parent_id) || result_set.first[result_set.first.parent_col_name]) rescue nil\n options[:level] ||= 0\n options[:nested] = true unless options.key?(:nested)\n \n siblings = options[:nested] ? result_set.select { |s| s.parent_id == parent_id } : result_set \n siblings.sort! {|a,b| a.send(options[:sort_on]) <=> b.send(options[:sort_on])} if options[:sort_on]\n siblings.each do |sibling|\n result_set.delete(sibling) \n block.call(sibling, options[:level])\n opts = { :parent_id => sibling.id, :level => options[:level] + 1, :inner_recursion => true, :sort_on => options[:sort_on]} \n recurse_result_set(result_set, opts, &block) if options[:nested]\n end\n result_set.each { |orphan| block.call(orphan, options[:level]) } unless inner_recursion\n end", "def query\n resource_id = @params.fetch(:resourceId)\n all_children_ids = db[:archival_object]\n .filter(:root_record_id => resource_id)\n .select(:id)\n db[:instance]\n .inner_join(:sub_container, :instance_id => :instance__id)\n .inner_join(:top_container_link_rlshp, :sub_container_id => :sub_container__id)\n .inner_join(:top_container, :id => :top_container_link_rlshp__top_container_id)\n .left_outer_join(:top_container_profile_rlshp, :top_container_id => :top_container__id)\n .left_outer_join(:container_profile, :id => :top_container_profile_rlshp__container_profile_id)\n .filter {\n Sequel.|({:instance__resource_id => resource_id},\n :instance__archival_object_id => all_children_ids)\n }\n .select(Sequel.as(Sequel.lit(\"CONCAT(COALESCE(container_profile.name, ''), ' ', top_container.indicator)\"), :container),\n Sequel.as(Sequel.lit(\"GetEnumValueUF(sub_container.type_2_id)\"), :container2Type),\n Sequel.as(:sub_container__indicator_2, :container2Indicator),\n Sequel.as(Sequel.lit(\"GetEnumValueUF(sub_container.type_3_id)\"), :container3Type),\n Sequel.as(:sub_container__indicator_3, :container3Indicator))\n .distinct\n end", "def get_children(params)\n scope_data_class(params) do\n params[:limit] = config[:rows_per_page] if config[:enable_pagination] && (params[:id].nil? || params[:id] == 'root')\n params[:scope] = config[:scope]\n data_adapter.get_records(params, final_columns)\n end\n end", "def find_all\n end", "def all_objects\n processed_rows.collect { |_i, rp| rp.all_objects }.flatten\n end", "def get_results(with_root = false)\n ret = []\n\n # Iterate over all occupied descendants and create chain data\n @occupied_descendants.each do |node|\n ret << [node.data, node.get_chain(with_root)]\n end\n\n # Return\n ret\n end", "def all\n @store.transaction do\n @store.roots.map {|id| @store[id] }\n end\n end", "def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => self.service_id).all\n end", "def fetch_all\n fetch_many0(nil, Array)\n end", "def aws_ou_list\n output = {}\n root_ou_id = @aws_org_client.list_roots.roots[0].id\n\n ou_recurse = lambda do |ous|\n ous.each do |ou_name, ou_id|\n children = aws_ou_list_children(ou_id, ou_name)\n unless children.empty?\n output.merge!(children)\n ou_recurse.call(children)\n end\n end\n end\n ou_recurse.call(root: root_ou_id)\n\n output\n end", "def db_queries_operate__samples\n db_queries_operate__samples_non_recursive +\n db_queries_operate__samples_recursive\n end", "def find_all(conditions)\n @root.find_all(conditions)\n end", "def db_queries_operate__samples_recursive\n non_rec = db_queries_operate__samples_non_recursive\n sample_1 = [ non_rec, \"AND\", :recursive ]\n sample_2 = [ [\"E\", sample_1], \"OR\", :recursive ]\n r = [\n sample_1,\n sample_2,\n ]\n\n end", "def find_all\n execute_sql(:read, :user) { table.map {|u| inflate_model(u) } }\n end", "def collect_objects\n results = []\n begin\n object_ids.each do |model_name, ids|\n results << model_name.to_s.constantize.find(ids)\n end\n results.flatten\n # rescue ActiveRecord::RecordNotFound\n # generate_objects!\n # collect_objects\n end\n end", "def find_each\n return enum_for(:find_each) unless block_given?\n\n client = IronBank.client\n query_string = IronBank::QueryBuilder.zoql(object_name, query_fields)\n query_result = client.query(query_string) # up to 2k records from Zuora\n\n loop do\n query_result[:records].each { |data| yield new(data) }\n break if query_result[:done]\n\n query_result = client.query_more(query_result[:queryLocator])\n end\n end", "def all(query); end", "def all_objects\n objects = []\n each_namespace{|n| objects << n}\n each_namespace{|n| \n n.each_relvar{|r| objects << r}\n }\n each_namespace{|n| \n n.each_relvar{|r| r.each_candidate_key{|k| objects << k}}\n }\n each_namespace{|n| \n n.each_relvar{|r| r.each_foreign_key{|k| objects << k}}\n }\n objects\n end", "def all_items(ead)\n ead.reader.archdesc.dsc.c01s.each do |c01|\n c01.c02s.each do |c02|\n puts \"#{c01.level}:#{c01.identifier} -> #{c02.level}:#{c02.identifier} -> #{c02.dao.try(:href)} | #{print_types(c02)}\"\n c02.c03s.each do |c03|\n puts \"#{c01.level}:#{c01.identifier} -> #{c02.level}:#{c02.identifier} -> #{c03.level}:#{c03.identifier} -> #{c03.dao.try(:href)} | #{print_types(c03)}\"\n c03.c04s.each do |c04|\n puts \"#{c01.level}:#{c01.identifier} -> #{c02.level}:#{c02.identifier} -> #{c03.level}:#{c03.identifier} -> #{c04.level}:#{c04.identifier} -> #{c04.dao.try(:href)} | #{print_types(c04)}\"\n end\n end\n end\n puts \"\\n\"\n end\nend", "def roots(*args)\n #return find_by_sql(\"select a.* from #{table_name} as a left join #{table_name} b on a.parent_node_id = b.child_node_id where b.child_node_id IS NULL\")\n conditions=['b.child_node_id IS NULL']\n joins=\"LEFT JOIN #{table_name} b ON #{table_name}.parent_node_id = b.child_node_id\"\n with_scope(:find=>{:conditions=>conditions, :joins=>joins, :select=>'#{table_name}.*', :from=>\"#{table_name} #{table_name}\"}) do\n find(:all, *args)\n end\n end", "def roots\n base_set_class.find(:all, :conditions => \"#{scope_condition} AND (#{parent_col_name} IS NULL OR #{parent_col_name} = 0)\", :order => \"#{left_col_name}\")\n end", "def all\n results = query '*::*::*::*'\n (results.each {|r| yield r}) if block_given?\n results\n end", "def collect_objects\n results = []\n generate_objects! if object_ids.nil?\n begin\n object_ids.each do |model_name, ids|\n results << model_name.to_s.constantize.find(ids)\n end\n results.flatten\n rescue ActiveRecord::RecordNotFound\n generate_objects!\n collect_objects\n end\n end", "def all(options = {})\n unlinked = options[:unlinked] || false\n\n results = run\n nodes = QL.from_bindings_to_nodes(results, @last_query_context, :unlinked => unlinked)\n nodes\n #sets = @last_query_context.query_keys\n #nodes.select do |node|\n # valid = false\n # c = 0\n # while(!valid && c<sets.length)\n # sets_keys, sets_query = sets[c]\n # valid = (sets_keys.empty?) || sets_keys.inject(true) do |ac,k|\n # value = nil\n # if (sets_query[k].is_a?(Hash) || (sets_query[k].is_a?(Symbol)))\n # value = ac && node[k]\n # end\n # if(value.nil? && @reasoning == true)\n # value = ac && node.values.include?(sets_query[k])\n # end\n # if (value.nil? && sets_query[k].is_a?(String) && sets_query[k].index(\"@id(\"))\n # value = ac && node[k]\n # end\n # if(value.nil?)\n # ac && node[k] == sets_query[k]\n # else\n # value\n # end\n # end\n # c += 1\n # end\n # valid\n #end\n end", "def roots(relation)\n\t @result_set = plan.query_roots(result_set, relation)\n\t self\n\tend", "def collection_query\n perform_with_session_expire_retry {\n auth_login unless logged_in?\n raise(PhotoShelterError, \"Collection query access not available for this account or organization.\") unless can_collection_query?\n path = BSAPI+\"mem/collection/root/children?format=xml\"\n headers = get_default_headers\n http = @http\n resp = http.get(path, headers)\n handle_server_response(path, resp, resp.body)\n#@last_response_xml.write($stderr, 0)\n PSTree.new(@last_response_xml, self)\n }\n end", "def get_all_children(catalog)\n catalog.descendant_catalogs\n end", "def traversal_6\n\n all_people = Perpetuity[Person].select {|person| person.profile_type == \"TeamMember\" }.to_a\n docs = 0\n all_people.each do |person|\n projects = []\n team_member = Perpetuity[TeamMember].find(person.profile.id)\n projects_team_members = Perpetuity[ProjectsTeamMember].select {|ptm| ptm.team_member.id == team_member.id}.to_a\n Perpetuity[ProjectsTeamMember].load_association! projects_team_members, :projects\n\n projects_team_members.each do |projtm|\n projects << projtm.project unless projects.include?(projtm.project)\n end\n projects.each do |project|\n documents = Perpetuity[Document].select {|document| document.project.id == project.id }.to_a\n documents.each do |doc|\n #visiting instead of returning the size\n docs += 1\n end\n end\n end\n return docs\nend", "def all\n # Accessing the store requires a transaction \n @store.transaction do\n # Create an array with the values for each key \n @store.roots.map { |id| @store[id] }\n end\n end", "def get_all_child_lists\n child_check\n \n if @all_child_terms.nil? and @all_child_names.nil?\n @all_child_terms = []\n @all_child_names = []\n \n self.children.each do |child|\n @all_child_terms.push( child.term )\n @all_child_terms.push( child.all_child_terms )\n @all_child_names.push( child.term_name )\n @all_child_names.push( child.all_child_names )\n end\n \n @all_child_terms = @all_child_terms.flatten.uniq\n @all_child_names = @all_child_names.flatten.uniq\n end\n end", "def collect\n base_finder = @base_class.includes(@dependency_tree)\n # If there are dependencies to load, we reduce the the batch size to compensate for\n # the increased memory of loading all the associations at the same time.\n batch_size = @dependency_tree.blank? ? DEFAULT_BATCH_SIZE : DEFAULT_BATCH_SIZE / 10\n enumerable = Enumerator.new do |yielder|\n @ids.each_slice(batch_size).with_index do |batch_of_ids, batch_index|\n with_sql_subscription do\n base_finder.where(@base_class.primary_key => batch_of_ids).load\n end\n # Expose this batch of SELECTs to the enumerator\n yielder.yield(@selects)\n # Reset the accumulator for the next batch (don't hog memory!)\n @selects.clear\n end\n end\n # By using a lazy enumerator, we make it possible to garbage collect records\n # as we process a batch, so long as the end user accesses the data via #each\n # and does not maintain references to previous rows. Example:\n # Polo.explore(klass, ids, associations).each { |row| file.puts(row) }\n enumerable.to_enum.lazy\n end", "def recur_all_referees\n if referees.blank?\n []\n else\n recur_referees = [referees]\n referees.each do |referee|\n recur_referees << referee.recur_all_referees\n end\n recur_referees.flatten!\n end\n end", "def children(options={:type => nil, :get_dataset => false, :recursive => false, :keep_cache => true, :reload => false, :preconditions => {:hidden => false}})\n return @children_cache if @children_cache and !options[:get_dataset] and !options[:reload]\n klass = Ecore::db[:documents]\n if options[:type]\n raise(TypeError, \":type must be an Ecore::DocumentResource\") unless options[:type].respond_to?(:table_name)\n klass = Ecore::db[:\"#{options[:type].table_name}\"]\n end\n query = klass.store_preconditions((@user_obj || @group_ids || @user_id),nil,self,nil,(options[:preconditions] || {:hidden => false}))\n query = ( options[:recursive] ? query.where(:path.like(\"#{absolute_path}%\")) : query.where(:path => absolute_path) )\n return query if options[:get_dataset]\n children_cache = query.order(:position,:name).receive(:all)\n return children_cache if options[:keep_cache]\n @children_cache = children_cache\n end", "def generate_all_connections!\n organisation_level_connections = []\n\n self.has_members.each do |member_uri|\n member = Person.find(member_uri)\n organisation_level_connections << member.get_connections!\n end\n\n organisation_level_connections.flatten\n end", "def getAllLocations()\n coll = self.coll_locations\n puts coll.find()\n coll.find.each { |row| puts row.inspect }\n end", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n # TODO put these lines back in and create another method to turn results_as_objects array of \n # objects in to array of hashes!!!!!!!\n results_as_objects = []\n\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def all\n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n results_as_objects(results)\n \n end", "def all_children(accummulator=[])\n return accummulator if children.size == 0\n children.each do |child_id|\n child = Folder.get(child_id)\n accummulator << child\n child.all_children(accummulator)\n end\n accummulator\n end", "def collect_branches_iter(query, vars, end_cursor, all_branches = [])\n \n # Shortcut during dev\n if vars[:stopafter] then\n $stdout.puts \" stopping early due to 'stopafter', have #{all_branches.size} branches\"\n return all_branches if (all_branches.size() > vars[:stopafter].to_i)\n end\n \n $stdout.puts \" fetching (currently have #{all_branches.size} branches)\"\n \n if end_cursor then\n vars[:after] = end_cursor\n end\n result = @client.query(query, variables: vars)\n # pp result\n \n all_branches += result.data.repository.refs.nodes\n paging = result.data.repository.refs.page_info\n if (paging.has_next_page) then\n collect_branches_iter(query, vars, paging.end_cursor, all_branches)\n else\n return all_branches\n end\n end", "def iterative_dfs\n (1..@map.cities.count).each do |i| # Path can't be longer than # cities\n result = dls(i)\n return result if result\n end\n return nil\n end", "def x_get_tree_roots\n objects = []\n objects.push(configured_systems)\n count_only_or_objects(false, objects + FILTERS.values)\n end", "def all\n \n end", "def all_descendent_members\n raise TypeError.new(\"can only call on a persisted object\") unless persisted? && id.present?\n\n sql = <<~EOS\n id IN (WITH RECURSIVE tree AS (\n SELECT id, ARRAY[]::UUID[] AS ancestors\n FROM kithe_models WHERE id = '#{self.id}'\n\n UNION ALL\n\n SELECT kithe_models.id, tree.ancestors || kithe_models.parent_id\n FROM kithe_models, tree\n WHERE kithe_models.parent_id = tree.id\n ) SELECT id FROM tree WHERE id != '#{self.id}')\n EOS\n\n\n Kithe::Model.where(sql)\n end", "def fetch_all!\n fetch_all(true)\n end", "def recursive => nil", "def subentries\n\t\t# If we have our own subentries, use them.\n\t\town_subentries = Subentry.joins(:etymotheses).where(:etymotheses => {:etymology_id => id}).all\n\t\treturn own_subentries if own_subentries.present?\n\t\t\n\t\t# If we are next etymon of anything else, use that etymon's subentries.\n\t\tprev_etymon = Etymology.where(:next_etymon_id => id).first\n\t\treturn prev_etymon.subentries if prev_etymon\n\t\t\n\t\t# Default response\n\t\t[]\n\tend", "def all\n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n\n results_as_objects(results)\n\n end", "def all() \n @sql = @default_sql\n query(@sql) unless @a\n @a\n end", "def read_all(res, klass, options = nil)\n return [] if res.blank?\n\n if options and join_relations = options[:include]\n join_relations = [join_relations].flatten.collect do |n|\n klass.relation(n)\n end\n end\n\n objects = []\n\n if options and options[:select]\n res.each_row do |res_row, row|\n obj = klass.og_allocate(res_row, row)\n read_row(obj, res, res_row, row)\n objects << obj\n end\n else\n res.each_row do |res_row, row|\n obj = klass.og_allocate(res_row, row)\n obj.og_read(res_row, row)\n read_join_relations(obj, res_row, row, join_relations) if join_relations\n objects << obj\n end\n end\n\n return objects\n\n ensure\n res.close\n end", "def nested_set_recurse(&block)\n self.each do |x| \n x.nested_set_recurse(self, &block)\n end\n end", "def subentries\n # If we have our own subentries, use them.\n own_subentries = Subentry.joins(:etymotheses).where(etymotheses: { etymology_id: id })\n return own_subentries if own_subentries.exists?\n\n # If we are next etymon of anything else, use that etymon's subentries.\n prev_etymon = Etymology.where(next_etymon_id: id).first\n return prev_etymon.subentries if prev_etymon\n\n # Default response\n []\n end", "def each(&block)\n squish = lambda do |tree, list|\n new_children = tree.children.reduce(list) { |acc, elem| squish.call(elem, acc) }\n [tree.root].lazy_append(new_children)\n end\n\n squish.call(self, [])\n\n # base = [root]\n # recursive = children.map(&:each)\n # res = base.lazy_append(recursive)\n\n # return res.each(&block) if block_given?\n\n # res\n\n # res = [[root], children.flat_map(&:each)].lazy.flat_map(&:lazy)\n # res = res.map(&block) if block_given?\n # res\n end", "def related_resources_recursive(result = [])\n Array(related_resources).each do |related_resource|\n unless result.include?(related_resource)\n result << related_resource\n if related_resource.respond_to?(:related_resources_recursive)\n related_resource.related_resources_recursive(result)\n end\n end\n end\n return result\n end", "def all_children(special=nil)\n if special && special[:exclude]\n transaction do\n # exclude some items and all their children\n special[:exclude] = [special[:exclude]] if !special[:exclude].is_a?(Array)\n # get objects for ids\n special[:exclude].collect! {|s| s.is_a?(self.class) ? s : self.class.find(s)}\n # get all subtrees and flatten the list\n exclude_list = special[:exclude].map{|e| e.full_set.map{|ee| ee.id}}.flatten.uniq.join(',')\n if exclude_list.blank?\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND (#{acts_as_nested_set_options[:left_column]} > #{self[acts_as_nested_set_options[:left_column]]}) and (#{acts_as_nested_set_options[:right_column]} < #{self[acts_as_nested_set_options[:right_column]]})\", :order => acts_as_nested_set_options[:left_column])\n else\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND id NOT IN (#{exclude_list}) AND (#{acts_as_nested_set_options[:left_column]} > #{self[acts_as_nested_set_options[:left_column]]}) and (#{acts_as_nested_set_options[:right_column]} < #{self[acts_as_nested_set_options[:right_column]]})\", :order => acts_as_nested_set_options[:left_column])\n end\n end\n else\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND (#{acts_as_nested_set_options[:left_column]} > #{self[acts_as_nested_set_options[:left_column]]}) and (#{acts_as_nested_set_options[:right_column]} < #{self[acts_as_nested_set_options[:right_column]]})\", :order => acts_as_nested_set_options[:left_column])\n end\n end", "def all \n results = CONNECTION.execute(\"SELECT * FROM #{self.table_name}\")\n \n return self.results_as_objects(results)\n end", "def all_children\n find_all_children_with_dotted_ids\n end", "def get_childs(recursive, ret_obj)\n\n return self.class.get_childs(self.id, recursive, ret_obj)\n end", "def x_get_tree_roots\n count_only_or_objects(false, PxeServer.all, \"name\")\n end", "def fetch\n handled_collection = build_from_parent_products\n parent_ids = handled_collection.map { |p| p[:id] }\n\n handled_collection + build_from_missing_parents(parent_ids)\n end", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n \n return results_as_objects\n end", "def all_children\n @all_children ||= children + children.inject([]) {|records, child| records + child.all_children}\n end", "def fetch_children\n @children = []\n for item in self.listex\n if item[\"type\"] == \"folder\" and item[\"id\"]!=@id #sharefile API includes self in list\n @children << Folder.new(item[\"id\"], @authid, @subdomain, false, item)\n elsif item[\"type\"] == \"file\"\n @children << File.new(item[\"id\"], @authid, @subdomain, item)\n end\n end\n end", "def relations \n @roots = Category.roots \n @categories = Category.has_children \n @expense_types = ExpenseType.all\n @payment_methods = PaymentMethod.all\n end", "def get_contents uri,user,password,recursive=false\n \n found=[]\n\n content = propfind uri,user,password,1\n\n parser = LibXML::XML::Parser.string(content,:encoding => LibXML::XML::Encoding::UTF_8)\n\n document = parser.parse\n\n href_nodes = document.find(\"ns:response\",\"ns:DAV:\")\n \n href_nodes.each do |node|\n unless node == href_nodes.first \n href_node=node.find_first(\"ns:href\",\"ns:DAV:\")\n last_modified_node = node.find_first(\"*/ns:prop\",\"ns:DAV:\").find_first(\"ns:getlastmodified\",\"ns:DAV:\")\n creation_date_node = node.find_first(\"*/ns:prop\",\"ns:DAV:\").find_first(\"ns:creationdate\",\"ns:DAV:\")\n content_type_node = node.find_first(\"*/ns:prop\",\"ns:DAV:\").find_first(\"ns:getcontenttype\",\"ns:DAV:\")\n\n attributes={ \n :containing_path=>uri.to_s,\n :full_path=>uri.merge(href_node.inner_xml).to_s,\n :updated_at=>DateTime.parse(last_modified_node.inner_xml).to_s,\n :created_at=>DateTime.parse(creation_date_node.inner_xml).to_s,\n :is_directory=>is_dir?(href_node,content_type_node)\n }\n found << attributes\n end\n end\n \n found.select{|a| a[:is_directory]}.each do |dir_tuple|\n child_uri=URI.parse(dir_tuple[:full_path])\n children=get_contents child_uri,user,password,true\n dir_tuple[:children]=children\n end if recursive\n \n return found\n \n end", "def fetch_all(key); end", "def all_as_objects\n table_name = self.to_s.pluralize\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name};\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n \n results_as_objects << self.new(result_hash)\n \n end\n \n return results_as_objects\n \n end", "def result_to_array(result, options = {}, &block)\n array = []\n inner_recursion = options.delete(:inner_recursion)\n result_set = inner_recursion ? result : result.dup\n \n parent_id = (options.delete(:parent_id) || result_set.first[result_set.first.parent_col_name]) rescue nil\n level = options[:level] || 0\n options[:children] ||= 'children'\n options[:methods] ||= []\n options[:nested] = true unless options.key?(:nested)\n options[:symbolize_keys] = true unless options.key?(:symbolize_keys)\n \n if options[:only].blank? && options[:except].blank?\n options[:except] = [:left_column, :right_column, :parent_column].inject([]) do |ex, opt|\n column = acts_as_nested_set_options[opt].to_sym\n ex << column unless ex.include?(column)\n ex\n end\n end\n \n siblings = options[:nested] ? result_set.select { |s| s.parent_id == parent_id } : result_set\n siblings.each do |sibling|\n result_set.delete(sibling)\n node = block_given? ? block.call(sibling, level) : sibling.attributes(:only => options[:only], :except => options[:except]) \n options[:methods].inject(node) { |enum, m| enum[m.to_s] = sibling.send(m) if sibling.respond_to?(m); enum } \n if options[:nested] \n opts = options.merge(:parent_id => sibling.id, :level => level + 1, :inner_recursion => true)\n childnodes = result_to_array(result_set, opts, &block)\n node[ options[:children] ] = childnodes if !childnodes.empty? && node.respond_to?(:[]=)\n end\n array << (options[:symbolize_keys] && node.respond_to?(:symbolize_keys) ? node.symbolize_keys : node)\n end\n unless inner_recursion\n result_set.each do |orphan| \n node = (block_given? ? block.call(orphan, level) : orphan.attributes(:only => options[:only], :except => options[:except])) \n options[:methods].inject(node) { |enum, m| enum[m.to_s] = orphan.send(m) if orphan.respond_to?(m); enum }\n array << (options[:symbolize_keys] && node.respond_to?(:symbolize_keys) ? node.symbolize_keys : node)\n end\n end \n array\n end", "def findChildren (parent, structure)\n #search for items in structure where item.manager = parent\n children = []\n \n #puts parent\n \n structure.each do |employee|\n \n #puts '> ' + employee.join(', ')\n \n if employee[2].eql? parent\n \n #puts 'got it!'\n \n children << employee\n end\n end\n \n return children\n\nend", "def get_everything!\n self.update!\n\n prev = @prev\n while prev\n prev.update!\n\n self.merge_entries! prev\n prev = prev.prev\n end\n\n nxt = @next\n while nxt\n nxt.update!\n\n self.merge_entries! nxt\n nxt = nxt.next\n end\n\n self\n end", "def get_subc(category)\n retval = []\n #Category.where(category_id: category.id).each do |c| \n category.categories.each do |c| \n retval += [c] + get_subc(c)\n end\n retval\n end", "def traversal_2a\n all_people = Perpetuity[Person].select {|person| person.profile_type == \"TeamMember\" }.to_a\n doc_num = 0\n all_people.each do |person|\n projects = []\n team_member = Perpetuity[TeamMember].find(person.profile.id)\n projects_team_members = Perpetuity[ProjectsTeamMember].select {|ptm| ptm.team_member.id == team_member.id}.to_a\n Perpetuity[ProjectsTeamMember].load_association! projects_team_members, :projects\n\n projects_team_members.each do |projtm|\n projects << projtm.project\n end\n projects.each do |project|\n doc_index = 0\n documents = Perpetuity[Document].select {|document| document.project.id == project.id }.to_a\n documents.each do |doc|\n #visiting instead of returning the size\n doc_num += 1\n if doc_index == 0\n type = doc.doc_type\n name = doc.doc_name\n doc.doc_type = name\n doc.doc_name = type\n Perpetuity[Document].save doc\n end\n doc_index +=1\n end\n end\n end\n return doc_num\nend", "def x_get_tree_roots\n count_only_or_objects(false, MiqPolicySet.all, :description)\n end", "def list_items(ead)\n ead.reader.archdesc.dsc.c01s.each do |c01|\n c01.c02s.each do |c02|\n puts \"#{c01.level}:#{c01.identifier} \\t #{c02.level}:#{c02.identifier} \\t #{c02.dao.try(:href)} \\t #{print_types(c02)}\"\n c02.c03s.each do |c03|\n puts \"#{c01.level}:#{c01.identifier} \\t #{c02.level}:#{c02.identifier} \\t #{c03.level}:#{c03.identifier} \\t #{c03.dao.try(:href)} \\t #{print_types(c03)}\"\n c03.c04s.each do |c04|\n puts \"#{c01.level}:#{c01.identifier} \\t #{c02.level}:#{c02.identifier} \\t #{c03.level}:#{c03.identifier} \\t #{c04.level}:#{c04.identifier} \\t #{c04.dao.try(:href)} \\t #{print_types(c04)}\"\n end\n end\n end\n puts \"\\n\"\n end\nend", "def print_all\n @foodDB.foodbase.each_value do | item |\n icl_print( item )\n end\n end", "def get_all_entries()\n jso = Hash.new()\n \n # Connect to database\n dbe = MIDB::API::Dbengine.new(@engine.config, @db)\n dblink = dbe.connect()\n rows = dbe.query(dblink, \"SELECT * FROM #{self.get_structure.values[0].split('/')[0]};\")\n if rows == false\n return MIDB::Interface::Server.json_error(400, \"Bad Request\")\n end\n # Iterate over all rows of this table\n rows.each do |row|\n jso[row[\"id\"]] = self.get_structure\n self.get_structure.each do |name, dbi|\n table = dbi.split(\"/\")[0]\n field = dbi.split(\"/\")[1]\n # Must-match relations (\"table2/field/table2-field->row-field\")\n if dbi.split(\"/\").length > 2\n match = dbi.split(\"/\")[2]\n matching_field = match.split(\"->\")[0]\n row_field = match.split(\"->\")[1]\n query = dbe.query(dblink, \"SELECT #{field} FROM #{table} WHERE #{matching_field}=#{row[row_field]};\")\n else\n query = dbe.query(dblink, \"SELECT #{field} from #{table} WHERE id=#{row['id']};\")\n end\n if query == false\n return MIDB::Interface::Server.json_error(400, \"Bad Request\")\n end\n jso[row[\"id\"]][name] = dbe.length(query) > 0 ? dbe.extract(query,field) : \"unknown\"\n jso[row[\"id\"]][name] = @hooks.format_field(name, jso[row[\"id\"]][name])\n end\n end\n @hooks.after_get_all_entries(dbe.length(rows))\n return jso\n end", "def get_all_records\r\n nodes = []\r\n time_blocks = generate_time_blocks( DEFAULT_OPTIONS[:erp_start_time].dup, Time.now )\r\n \r\n # time_blocks.each do |pair|\r\n # result = search_by_modified_date( pair.first, pair.last )\r\n # nodes.concat result unless result.empty?\r\n # end\r\n \r\n ERP::ThreadPool.new(@options[:threads], time_blocks).start do |pair|\r\n sleep(1 * rand)\r\n result = search_by_modified_date( pair.first, pair.last )\r\n nodes.concat result unless result.empty?\r\n end\r\n \r\n output_log \"#{nodes.size} records received!\"\r\n return nodes\r\n end", "def display_all_data(collection, keys)\n rc_list = []\n parts = collection.parts\n parts.each do |part|\n rc_list += collection.find(part)\n end\n display_data(collection, rc_list, keys)\n end", "def all\n results = CONNECTION.execute(\"SELECT * FROM #{get_table_name}\")\n\n results_as_objects = []\n\n results.each do |results_hash|\n results_as_objects << self.new(results_hash)\n end\n\n return results_as_objects\n end", "def deep_each\n \n end", "def roots\n acts_as_nested_set_options[:class].find(:all, :conditions => \"(#{acts_as_nested_set_options[:parent_column]} IS NULL OR #{acts_as_nested_set_options[:parent_column]} = 0)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end", "def resultset; end", "def roots\n self.find(:all, :conditions => \"(#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:parent_column]} IS NULL)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end", "def get_all_from_database\n model.all\n end", "def flattened_entities\n results = []\n \n # Add this organization's entities\n entities.where(:type == 'Person').each do |e|\n results << e\n end\n\n # Add all children organization's entities\n child_organizations.all.each do |o|\n o.flattened_entities.each do |e|\n results << e\n end\n end\n\n # Only return a unique list\n results.uniq{ |x| x.id }\n end", "def list\n storage.transaction {return storage.roots}\n end", "def roots\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND (#{acts_as_nested_set_options[:parent_column]} IS NULL)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end", "def getAllChildren\n children = Tree.where(\"tree_type_id = ? AND version_id = ? AND subject_id = ? AND grade_band_id = ? AND code like ?\", tree_type_id, version_id, subject_id, grade_band_id, code+'.%')\n Rails.logger.debug(\"*** tree children: #{children.inspect}\")\n return children\n end", "def roots\n self.ontology_classes(force_reload=true).select{|c| c.isroot?}\n end", "def find_relations\n puts '2nd pass: find relations'\n find :relations\n self\n end", "def roots\n select\n end", "def each_with_level(objects)\n path = [nil]\n objects.sort_by(&left_column_name.to_sym).each do |o|\n if o._parent_id != path.last\n # we are on a new level, did we decent or ascent?\n if path.include?(o._parent_id)\n # remove wrong wrong tailing paths elements\n path.pop while path.last != o._parent_id\n else\n path << o._parent_id\n end\n end\n yield(o, path.length - 1)\n end\n end", "def load_all_data\n @students = Student.all\n @employees = Employee.all\n @routes = Route.in_academic_year(academic_year_id).all(:include => :vehicle_stops)\n end", "def children\n base_set_class.find(:all, :conditions => \"#{scope_condition} AND #{parent_col_name} = #{self.id}\", :order => left_col_name)\n end", "def each_root_relation\n\t for rel in relations\n\t\tyield(rel) unless rel.parent\n\t end\n\tend", "def all_objects; end", "def all\n table_name = self.to_s.pluralize.underscore\n results = DATABASE.execute(\"SELECT * FROM #{table_name}\")\n \n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def all\r\n copy_and_return(@records)\r\n end", "def all_in_tree\n accounts = Array.new\n accounts += ancestors\n accounts += sibling_accounts\n accounts += children\n accounts << self\n return accounts\n end", "def recurse(record)\n raise \"This gem only knows how to extract stuff w ActiveRecord\" unless record.kind_of? ActiveRecord::Base\n key = record.class.base_class.to_s # the base_class is key for correctly handling STI\n @output_hash[key] ||= Set.new # Set ensures no duplicates\n return if @output_hash[key].include?(record) # Prevent infinite loops as association cache on record with inverse_of will cause this method to stack overflow\n @output_hash[key].add(record)\n record.association_cache.each_pair do |assoc_name,association_def|\n Array(association_def.target).each do |a|\n self.recurse(a)\n end\n end\n end" ]
[ "0.583575", "0.57899743", "0.5709545", "0.56984794", "0.56750304", "0.5670683", "0.5655277", "0.561711", "0.5610376", "0.55660915", "0.5563774", "0.55381554", "0.5502065", "0.5495922", "0.54824597", "0.54707813", "0.546622", "0.5464629", "0.54591435", "0.5455437", "0.54546404", "0.5454018", "0.5451007", "0.5437149", "0.5422992", "0.54074776", "0.5406624", "0.5402034", "0.53836447", "0.53811204", "0.53652644", "0.5360226", "0.5358308", "0.53508955", "0.5346073", "0.5338503", "0.5337607", "0.5333703", "0.532728", "0.5292259", "0.52921957", "0.5282944", "0.5282234", "0.5271715", "0.52639115", "0.52510726", "0.52473015", "0.52399105", "0.5233398", "0.52325344", "0.52308834", "0.5224918", "0.5219301", "0.5205073", "0.51977307", "0.5196539", "0.51951003", "0.5186356", "0.5173494", "0.5173096", "0.51694", "0.51690084", "0.5166365", "0.5165705", "0.51633316", "0.51609534", "0.5160473", "0.51594627", "0.5151097", "0.51470554", "0.5144588", "0.51436096", "0.5141307", "0.51373166", "0.5136215", "0.513054", "0.51276344", "0.51247925", "0.5123576", "0.5117568", "0.5112869", "0.50984645", "0.5098351", "0.5095838", "0.5093998", "0.5092641", "0.5092499", "0.50838035", "0.50804293", "0.5076772", "0.50716084", "0.50698876", "0.50675046", "0.5061009", "0.50580454", "0.50577", "0.5055464", "0.50487256", "0.50476575", "0.50400275", "0.5037917" ]
0.0
-1
Recursive function to query the OLS database and collect all of the child objects and build up a tree of OntologyTerm's.
def get_children( node=self ) sql = <<-SQL select subject_term.identifier as child_identifier, subject_term.term_name as child_term, predicate_term.term_name as relation, object_term.identifier as parent_identifier, object_term.term_name as parent_term from term_relationship tr join term as subject_term on tr.subject_term_pk = subject_term.term_pk join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk join term as object_term on tr.object_term_pk = object_term.term_pk where predicate_term.term_name in ('part_of','is_a','develops_from') and object_term.identifier = ? SQL OLS_DB[sql,node.term].each do |row| child = OntologyTerm.new( row[:child_identifier], row[:child_term] ) node << child end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_child_lists\n child_check\n \n if @all_child_terms.nil? and @all_child_names.nil?\n @all_child_terms = []\n @all_child_names = []\n \n self.children.each do |child|\n @all_child_terms.push( child.term )\n @all_child_terms.push( child.all_child_terms )\n @all_child_names.push( child.term_name )\n @all_child_names.push( child.all_child_names )\n end\n \n @all_child_terms = @all_child_terms.flatten.uniq\n @all_child_names = @all_child_names.flatten.uniq\n end\n end", "def all_child_terms\n get_all_child_lists\n return @all_child_terms\n end", "def get_all_children(catalog)\n catalog.descendant_catalogs\n end", "def getAllChildren\n children = Tree.where(\"tree_type_id = ? AND version_id = ? AND subject_id = ? AND grade_band_id = ? AND code like ?\", tree_type_id, version_id, subject_id, grade_band_id, code+'.%')\n Rails.logger.debug(\"*** tree children: #{children.inspect}\")\n return children\n end", "def roots\n self.ontology_classes(force_reload=true).select{|c| c.isroot?}\n end", "def all_children\n @all_children ||= children + children.inject([]) {|records, child| records + child.all_children}\n end", "def build_hierarchy\n root = LetterNode.new(nil)\n\n # TODO: Limit word table to 50,000 highest ranking words\n\n words.each do |word|\n wl = root\n word.spelling.each_char do |letter|\n wl = wl.add(letter, word.count)\n end\n wl.word!(word.count)\n end\n\n root\n end", "def rebuild_hierarchies!\n query(\"MATCH (:Page)-[parent:parent]->(:Page) DELETE parent\")\n query(\"MATCH (:Page)-[in_clade:in_clade]->(:Page) DELETE in_clade\")\n missing = {}\n related = {}\n # HACK HACK HACK HACK: We want to use Resource.native here, NOT ITIS!\n itis = Resource.where(name: \"Integrated Taxonomic Information System (ITIS)\").first\n raise \" I tried to use ITIS as the native node for the relationships, but it wasn't there.\" unless itis\n Node.where([\"resource_id = ? AND parent_id IS NOT NULL AND page_id IS NOT NULL\",\n itis.id]).\n includes(:parent).\n find_each do |node|\n page_id = node.page_id\n parent_id = node.parent.page_id\n next if missing.has_key?(page_id) || missing.has_key?(parent_id)\n page = page_exists?(page_id)\n page = page.first if page\n if page\n relate(\"in_clade\", page, page)\n end\n next if related.has_key?(page_id)\n parent = page_exists?(parent_id)\n parent = parent.first if parent\n if page && parent\n if page_id == parent_id\n puts \"** OOPS! Attempted to add #{page_id} as a parent of itself!\"\n else\n relate(\"parent\", page, parent)\n relate(\"in_clade\", page, parent)\n related[page_id] = parent_id\n # puts(\"#{page_id}-[:parent]->#{parent_id}\")\n end\n else\n missing[page_id] = true unless page\n missing[parent_id] = true unless parent\n end\n end\n related.each do |page, parent|\n puts(\"#{page}-[:in_clade*]->#{parent}\")\n end\n puts \"Missing pages in TraitBank: #{missing.keys.sort.join(\", \")}\"\n end", "def get_childs(recursive, ret_obj)\n\n return self.class.get_childs(self.id, recursive, ret_obj)\n end", "def descendents\n\n\t\t #children.preload(:parent).each do |child| child.descendents end\n\t\t children.each do |child|\n\t [child] + child.descendents\n\t end\n end", "def recurse_otml_dirs(&block)\n return unless self.has_otmls\n yield(self)\n self.children.each do |child|\n child.recurse_otml_dirs(&block)\n end\nend", "def relations \n @roots = Category.roots \n @categories = Category.has_children \n @expense_types = ExpenseType.all\n @payment_methods = PaymentMethod.all\n end", "def child_ontology_relationships(options = {}) # :yields: Array of OntologyRelationships\n opt = {\n :relationship_type => 'all' # or a ObjectRelationships#id\n }.merge!(options.symbolize_keys)\n\n # TODO: modify to sort by first(top) label\n if opt[:relationship_type] == 'all'\n OntologyRelationship.find(:all, :include => [:ontology_class1, :object_relationship, :ontology_class2], :conditions => ['ontology_class2_id = ?', self.id]) # .sort{|x,y| x.ontology_class1.preferred_label.name <=> y.ontology_class1.preferred_label.name}\n else\n OntologyRelationship.find(:all, :include => [:ontology_class1, :object_relationship, :ontology_class2], :conditions => ['ontology_class2_id = ? AND object_relationship_id = ?', self.id, opt[:relationship_type]]) # .sort{|x,y| x.ontology_class1.preferred_label.name <=> y.ontology_class1.preferred_label.name}\n end\n end", "def list_children(taxons_collection)\n taxons_collection.sort_by {|p| p.hierarchy}\n html_var = \"\"\n taxons_collection.each do |t|\n if not t.children.empty?\n html_var << \"<li><i class='icon-plus'> </i>\" << link_to(t.name, t) << \"<ul>\" << list_children(t.children) << \"</ul>\"\n else\n html_var << \"<li><i class='icon-white' style='visibility: hidden;'> </i>\" << link_to(t.name, t)\n end\n html_var << \"</li>\\n\"\n end\n return html_var.html_safe\nend", "def object_tree\n head, *rest = array_tree\n object_subtree(head,rest)\n end", "def get_parents( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_term\n from\n term_relationship tr\n join term as subject_term \ton tr.subject_term_pk = subject_term.term_pk\n join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk\n join term as object_term on tr.object_term_pk = object_term.term_pk\n where\n predicate_term.term_name in ('part_of','is_a','develops_from')\n and subject_term.identifier = ?\n SQL\n \n OLS_DB[ sql, node.term ].each do |row|\n parent = OntologyTerm.new( row[:parent_identifier], row[:parent_term] )\n parent << node\n get_parents( parent )\n end\n end", "def tree_results(word_data)\n #get the data ready for d3 view\n tree_data = {\"name\"=> (@topic.name), \"info\" => \"tst\", \"children\" => []}\n \n word_data.each do |text, v|\n tree_data[\"children\"].push({\"name\" => text.to_s, \"children\" => []})\n end\n \n tree_data[\"children\"][0][\"children\"] << Hash[\"name\", word_data[:word]]\n \n word_data[:definitions].each do |text|\n tree_data[\"children\"][1][\"children\"] << Hash[\"name\", text[\"text\"]]\n end\n \n word_data[:word_associations].each do |text|\n tree_data[\"children\"][2][\"children\"] << Hash[\"name\", text[\"relationshipType\"], \"children\", []]\n end \n if word_data[:reverse_definitions][\"results\"].nil? \n tree_data[\"children\"][3][\"children\"] << nil\n else\n word_data[:reverse_definitions][\"results\"].each do |result| \n tree_data[\"children\"][3][\"children\"] << Hash[\"name\", result[\"text\"]]\n end\n end\n i = 0\n word_data[:word_associations].each do |text|\n text[\"words\"].each do |word|\n tree_data[\"children\"][2][\"children\"][i][\"children\"] << Hash[\"name\", word]\n end\n i+=1\n end\n #reduce duplicates in word_association hash\n tree_data[\"children\"][3][\"children\"].uniq!\n tree_data[\"children\"][2][\"children\"].uniq!\n return tree_data\n end", "def children\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:parent_column]} = #{self.id}\", :order => acts_as_nested_set_options[:left_column])\n end", "def create_tree(father,tree)\n tree.each do |name|\n n = Meta::create_class(father, name[0], name[1])\n create_tree(n, name[2])\n end\nend", "def tree\n @treetop = @proj.default_ontology_class\n @proj.ontology_classes.first if !@treetop\n redirect_to :action => :new, :controller => :ontology_classes and return if !@treetop\n @colored_object_relationships = @proj.object_relationships.with_color_set\n @all_object_relationships = @proj.object_relationships \n render :action => 'ontology/tree/index'\n end", "def cascadable_children(kind)\n [].tap do |children|\n relations.each_pair do |name, metadata|\n next unless metadata.cascading_callbacks?\n delayed_pulls = delayed_atomic_pulls[name]\n children.concat(delayed_pulls) if delayed_pulls\n child = send(name)\n Array.wrap(child).each do |doc|\n children.push(doc) if cascadable_child?(kind, doc)\n children.concat(doc.send(:cascadable_children, kind))\n end\n end\n end\n end", "def children\n tree_search_class.where(tree_parent_id_field => self._id).sort(self.class.tree_sort_order()).all\n end", "def location_tree\n #@locations = Location.all\n # puts \"location_tree\"\n @locations = Location.where(ancestry: nil).order(location_type: :desc)\n #@locations = Location.where(id: 1)\n end", "def all_children\n find_all_children_with_dotted_ids\n end", "def lba_children\n \tif (params[:id] == 'root') then\n @lbas = Lba.roots\n else\n \tif (params[:rel] == 'lba') then\n \t lba = Lba.find(params[:id])\n \t @lbas = lba.children\n \t @lbos = lba.lbos\n \t @interfaces = lba.interfaces\n \t @build_features = lba.build_features\n @mapped_features = @feature.build_features\n \telsif (params[:rel] == 'lbo') then\n \t lbo = Lbo.find(params[:id])\n \t @build_features = lbo.build_features\n \t @logical_entities = lbo.logical_entities\n @mapped_features = @feature.build_features\n \telsif (params[:rel] == 'le') then\n \t le = LogicalEntity.find(params[:id])\n \t @logical_entity_attributes = le.logical_entity_attributes\n \telsif (params[:rel] == 'build_feature') then\n \t bf = BuildFeature.find(params[:id])\n \t @build_features = bf.children\n # @mapped_features = @feature.build_features\n end\n end\n puts \"build_features\"\n ap @build_features\n puts \"mapped_features\"\n ap @mapped_features\n\n\t\trespond_to do |format|\n format.html { render :partial => 'lbas/lba_children',\n :locals => {:lbas => @lbas,\n :lbos => @lbos,\n :bfs => @build_features,\n \t\t\t:mapped_features => @mapped_features,\n :les => @logical_entities,\n :le_attributes => @logical_entity_attributes,\n :interfaces => @interfaces\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}}\n end\n end", "def children\n self.class.find(:all, \n :select => \"a.*\",\n :joins => \"a join #{self.class.bridge_class.table_name} b on a.id = b.#{self.class.parent_foreign_key}\", \n :conditions => [\"b.#{self.class.child_foreign_key} = ? and b.#{self.class.levels_from_parent} = 1\", self.id])\n end", "def roots(*args)\n #return find_by_sql(\"select a.* from #{table_name} as a left join #{table_name} b on a.parent_node_id = b.child_node_id where b.child_node_id IS NULL\")\n conditions=['b.child_node_id IS NULL']\n joins=\"LEFT JOIN #{table_name} b ON #{table_name}.parent_node_id = b.child_node_id\"\n with_scope(:find=>{:conditions=>conditions, :joins=>joins, :select=>'#{table_name}.*', :from=>\"#{table_name} #{table_name}\"}) do\n find(:all, *args)\n end\n end", "def children\n\t\treturn self.search( :one, '(objectClass=*)' )\n\tend", "def indented_child_options type, parent, depth=0, selected_id\n\n result = []\n unless parent.children.empty?\n parent.children.sort { |a, b| a.title.downcase <=> b.title.downcase }.each do |child|\n child_path = send(\"#{type.model_name.underscore}s_path\", :uri=>child.term_uri, :label=> child.title)\n assay_stat = child.assays.size == 0 ? \"\" : \"<span style='color: #666666;'>(#{child.assays.count} assays)</span>\".html_safe\n ontology_term_li = link_to(child.title, child_path).html_safe\n user_defined_term_li = link_to(child.title, child_path, {:style => \"color:green;font-style:italic\"}) + \"*\" + \" \" +\n (child.can_edit? ? link_to(image(\"edit\"), edit_polymorphic_path(child), {:style => \"vertical-align:middle\"}) : \"\") + \" \" +\n (child.can_destroy? ? (child.assays.count == 0 && child.children.empty? ? link_to(image(\"destroy\"), child, :confirm =>\n \"Are you sure you want to remove this #{child.class.name}? This cannot be undone.\",\n :method => :delete, :style => \"vertical-align:middle\") : \"\") : \"\").html_safe\n child_link = (child.respond_to?(:is_user_defined) && child.is_user_defined) ? user_defined_term_li : ontology_term_li\n\n result << (\"<li style=\\\"margin-left:#{12*depth}px;#{child.id == selected_id ? \"background-color: lightblue;\" : \"\"}\\\">\"+ (depth>0 ? \"└ \" : \" \") + child_link + assay_stat +\n \"</li>\")\n result = result + indented_child_options(type, child, depth+1,selected_id) if child.has_children?\n end\n end\n return result\n end", "def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => self.service_id).all\n end", "def all_children(options = {})\n conditions = \"(#{nested_set_left} > #{self[nested_set_left]}) and (#{nested_set_right} < #{self[nested_set_right]})\"\n if options[:exclude]\n transaction do\n # exclude some items and all their children\n options[:exclude] = [options[:exclude]] if !options[:exclude].is_a?(Array)\n # get objects for ids\n options[:exclude].collect! {|s| s.is_a?(nested_set_class) ? s : nested_set_class.find(s)}\n # get all subtrees and flatten the list\n exclude_list = options[:exclude].map{|e| e.full_set.map{|ee| ee.id}}.flatten.uniq\n conditions += \" AND id NOT IN (#{exclude_list.join(',')})\" unless exclude_list.empty?\n end\n end\n nested_set_class.find_with_nested_set_scope(:all, :conditions => conditions, :order => nested_set_left)\n end", "def walkTerm(statement, sublevel, entity = nil, parentFunction = nil, argidx = nil)\n \n # Map subject and object when walkTerm is called non-recursively \n \n if entity == :subject\n element = \"cause\"\n unless statement.nestedStatement\n statement.currentobj = statement.obj.subject\n else\n statement.currentobj = statement.nestedStatement.subject\n end\n elsif entity == :object\n element = \"theme\"\n unless statement.nestedStatement\n statement.currentobj = statement.obj.object\n else\n statement.currentobj = statement.nestedStatement.object\n end\n end\n \n # Shorthand assignments\n obj = statement.currentobj\n document = statement.document\n passage = statement.passage\n debug = statement.debug\n includeBEL = statement.includeBEL\n \n unless statement.nestedStatement\n relation = statement.relation\n relationTriple = statement.relationTriple\n else\n relation = statement.nestedRelation\n relationTriple = statement.nestedrelationTriple\n end\n \n if !obj.nil? and !statement.obj.relationship.nil?\n if sublevel == 0\n # Statements are relations unless they are unary\n unless !obj.instance_of?(BEL::Language::Statement) and \n statement.keeptogether and \n obj.arguments.length == 1 and \n obj.arguments[0].instance_of?(BEL::Language::Parameter)\n \n relationTriple[element].refid = \"r\" + String($relationId)\n else\n relationTriple[element].refid = \"a\" + String($annotationId)\n end\n if includeBEL\n # Substitute elements for relative original BEL string\n substitutionString = relation.infons[\"BEL (relative)\"].sub String(obj), relationTriple[element].refid\n if entity == :object\n #strip remaining brackets\n substitutionString = substitutionString.tr('()','')\n end\n relation.infons[\"BEL (relative)\"] = substitutionString\n end\n end\n \n #\n # Map terms\n #\n if obj.instance_of?(BEL::Language::Term)\n mapTerms(statement, sublevel, parentFunction, argidx)\n \n #\n # Map parameters\n #\n elsif obj.instance_of?(BEL::Language::Parameter)\n mapParameters(statement, parentFunction, argidx)\n \n #\n # Map statements\n #\n \n elsif obj.instance_of?(BEL::Language::Statement)\n statement.nestedStatement = obj\n statement.insideNestedStatement = true\n walkStatement(statement)\n end\n elsif statement.obj.relationship.nil?\n puts \"Note: Skipping #{statement.obj}, single-term statements not (yet) supported.\"\n end\n end", "def index\n @traumatized_children = TraumatizedChild.all\n end", "def x_get_tree_roots\n count_only_or_objects(false, MiqPolicySet.all, :description)\n end", "def children\n EarLogger.instance.log \"Finding children for #{self}\"\n ObjectManager.instance.find_children(self.id, self.class.to_s)\n end", "def get_children(params)\n scope_data_class(params) do\n params[:limit] = config[:rows_per_page] if config[:enable_pagination] && (params[:id].nil? || params[:id] == 'root')\n params[:scope] = config[:scope]\n data_adapter.get_records(params, final_columns)\n end\n end", "def all_children(special=nil)\n if special && special[:exclude]\n transaction do\n # exclude some items and all their children\n special[:exclude] = [special[:exclude]] if !special[:exclude].is_a?(Array)\n # get objects for ids\n special[:exclude].collect! {|s| s.is_a?(self.class) ? s : self.class.find(s)}\n # get all subtrees and flatten the list\n exclude_list = special[:exclude].map{|e| e.full_set.map{|ee| ee.id}}.flatten.uniq.join(',')\n if exclude_list.blank?\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND (#{acts_as_nested_set_options[:left_column]} > #{self[acts_as_nested_set_options[:left_column]]}) and (#{acts_as_nested_set_options[:right_column]} < #{self[acts_as_nested_set_options[:right_column]]})\", :order => acts_as_nested_set_options[:left_column])\n else\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND id NOT IN (#{exclude_list}) AND (#{acts_as_nested_set_options[:left_column]} > #{self[acts_as_nested_set_options[:left_column]]}) and (#{acts_as_nested_set_options[:right_column]} < #{self[acts_as_nested_set_options[:right_column]]})\", :order => acts_as_nested_set_options[:left_column])\n end\n end\n else\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND (#{acts_as_nested_set_options[:left_column]} > #{self[acts_as_nested_set_options[:left_column]]}) and (#{acts_as_nested_set_options[:right_column]} < #{self[acts_as_nested_set_options[:right_column]]})\", :order => acts_as_nested_set_options[:left_column])\n end\n end", "def get_ontology_terms(repositoryName = \"ComputerScience\")\n puts \"get_ontology_terms from catalog: \" + repositoryName\n # Repository management\n server = AllegroGraph::Server.new :username => $AGRAPH['user'], :password => $AGRAPH['pass'], :host => $AGRAPH['host'], :port => $AGRAPH['port']\n repository = AllegroGraph::Repository.new server, repositoryName\n repository.create_if_missing!\n\n # SparQL queries\n repository.query.language = :sparql\n res = repository.query.perform \"SELECT distinct ?Class ?Subclass WHERE { ?Subclass rdfs:subClassOf ?Class . } Order by ?Class \"\n\n terms = Set.new\n # I know this could be done more efficiently...\n res['values'].each do |pair|\n terms.add(clean_uri(pair[0]))\n terms.add(clean_uri(pair[1])) \n end\n \n terms\n \nend", "def fetch_children\n @children = []\n for item in self.listex\n if item[\"type\"] == \"folder\" and item[\"id\"]!=@id #sharefile API includes self in list\n @children << Folder.new(item[\"id\"], @authid, @subdomain, false, item)\n elsif item[\"type\"] == \"file\"\n @children << File.new(item[\"id\"], @authid, @subdomain, item)\n end\n end\n end", "def children_table; end", "def render_recursively(output_path, title, obj, parent = '')\n renderer.render(output_path, parent, title, obj.get_thumbs, obj.filter)\n\n # For Doc object, returns a list of makes. For the NodeSet object, returns a list of models.\n obj.filter.each do |key|\n # Only recurse if not the same as the parent to avoid an infinite loop\n if title != key\n nodes = obj.search('work:contains(\"' + key + '\")')\n render_recursively(output_path, key, nodes, title)\n end\n end\n end", "def children_objects(type, opts = {})\n self.clone_copy_output.children_objects(level(type), type, opts)\n end", "def all_objects\n objects = []\n each_namespace{|n| objects << n}\n each_namespace{|n| \n n.each_relvar{|r| objects << r}\n }\n each_namespace{|n| \n n.each_relvar{|r| r.each_candidate_key{|k| objects << k}}\n }\n each_namespace{|n| \n n.each_relvar{|r| r.each_foreign_key{|k| objects << k}}\n }\n objects\n end", "def descendants\n return [] if new_record?\n tree_search_class.where(tree_path_field => self._id).sort(self.class.tree_sort_order()).all\n end", "def all_descendent_members\n raise TypeError.new(\"can only call on a persisted object\") unless persisted? && id.present?\n\n sql = <<~EOS\n id IN (WITH RECURSIVE tree AS (\n SELECT id, ARRAY[]::UUID[] AS ancestors\n FROM kithe_models WHERE id = '#{self.id}'\n\n UNION ALL\n\n SELECT kithe_models.id, tree.ancestors || kithe_models.parent_id\n FROM kithe_models, tree\n WHERE kithe_models.parent_id = tree.id\n ) SELECT id FROM tree WHERE id != '#{self.id}')\n EOS\n\n\n Kithe::Model.where(sql)\n end", "def children\n @children ||= {}.with_indifferent_access\n end", "def _tree_navigate_through_child\n @ontology_class = OntologyClass.find_by_id(params[:id])\n \n @object_relationship = ObjectRelationship.find(params[:parent_relationship]) if !params[:parent_relationship].blank?\n @object_relationship == 'root' if !@object_relationship \n \n # close 1 1; open 0 1; open false (close); true (open) \n render :update do |page|\n page.replace \"level_#{@ontology_class.id}\", :partial => 'ontology/tree/tree_recurser', :locals => {\n :level => (params[:close] ? 1 : 0),\n :max_depth => 1,\n :parent_node => @ontology_class,\n :open => (params[:close] ? false : true),\n :relationship => @object_relationship,\n :relationship_type => params[:relationship_type] }\n end and return \n end", "def objects\n return @objects unless @objects.nil?\n objs = []\n dict = @instance.getDictionary\n (0 ... dict.getChildCount).each do |i|\n obj = dict.getChildAt(i)\n objs << {\n :name => obj.getName,\n :qual => obj.getQualification.toString.downcase.to_sym,\n :type => obj.getType.toString.downcase.to_sym,\n :object => obj,\n }\n end\n @objects = objs\n end", "def children(options={:type => nil, :get_dataset => false, :recursive => false, :keep_cache => true, :reload => false, :preconditions => {:hidden => false}})\n return @children_cache if @children_cache and !options[:get_dataset] and !options[:reload]\n klass = Ecore::db[:documents]\n if options[:type]\n raise(TypeError, \":type must be an Ecore::DocumentResource\") unless options[:type].respond_to?(:table_name)\n klass = Ecore::db[:\"#{options[:type].table_name}\"]\n end\n query = klass.store_preconditions((@user_obj || @group_ids || @user_id),nil,self,nil,(options[:preconditions] || {:hidden => false}))\n query = ( options[:recursive] ? query.where(:path.like(\"#{absolute_path}%\")) : query.where(:path => absolute_path) )\n return query if options[:get_dataset]\n children_cache = query.order(:position,:name).receive(:all)\n return children_cache if options[:keep_cache]\n @children_cache = children_cache\n end", "def index\n @blogs = Blog.all\n @parents = Category.all.where(ancestry: nil)\n # binding.pry\n # @grandchilds = Category.where(ancestry: \"1/3\")\n # @grandchilds2 = Category.where(ancestry: \"2/4\")\n end", "def models\n children = []\n Mongoid.models.each do |model|\n children << model.to_s\n model.descendants.each do |child|\n inh = [child.to_s]\n sk = child.superclass\n while sk != model\n inh << sk.to_s\n sk = sk.superclass\n raise '!' if sk == Object\n end\n\n children << ' ' + inh.reverse.join(' < ')\n end\n end\n children\nend", "def getObjectChildren _obj, _args\n \"_obj getObjectChildren _args;\" \n end", "def roots\n acts_as_nested_set_options[:class].find(:all, :conditions => \"(#{acts_as_nested_set_options[:parent_column]} IS NULL OR #{acts_as_nested_set_options[:parent_column]} = 0)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end", "def children\n nested_set_class.find_with_nested_set_scope(:all, :conditions => \"#{nested_set_parent} = #{self.id}\", :order => nested_set_left)\n end", "def children\n dataset.nested.filter(self.class.qualified_parent_column => self.id)\n end", "def refresh_subresources\n %w( projects categories ).each do |attr|\n self[attr] = API.instance.ontology_resource(acronym, attr).map{|h| h['acronym']}.join(\"\\n\")\n end\n end", "def build(terminology=nil)\n self.resolve_refs!\n if term.self.settings.has_key?(:proxy)\n term = OM::XML::NamedTermProxy.new(self.name, self.settings[:proxy], terminology, self.settings)\n else\n term = OM::XML::Term.new(self.name, {}, terminology)\n\n self.settings.each do |name, values|\n if term.respond_to?(name.to_s+\"=\")\n term.instance_variable_set(\"@#{name}\", values)\n end\n end\n @children.each_value do |child|\n term.add_child child.build(terminology)\n end\n term.generate_xpath_queries!\n end\n\n return term\n end", "def all_children\n children(all: true)\n end", "def x_get_tree_roots\n objects = []\n objects << {:id => \"compliance\", :text => _(\"Compliance Policies\"), :icon => \"pficon pficon-history\", :tip => _(\"Compliance Policies\")}\n objects << {:id => \"control\", :text => _(\"Control Policies\"), :icon => \"fa fa-shield\", :tip => _(\"Control Policies\")}\n\n # Push folder node ids onto open_nodes array\n objects.each { |o| open_node(\"xx-#{o[:id]}\") }\n\n count_only_or_objects(false, objects)\n end", "def apply_children\n \n end", "def all_children(accummulator=[])\n return accummulator if children.size == 0\n children.each do |child_id|\n child = Folder.get(child_id)\n accummulator << child\n child.all_children(accummulator)\n end\n accummulator\n end", "def index_ontology_terms_from_fresh( doc, term_conf, value_to_index )\n begin\n ontolo_term = OntologyTerm.new( value_to_index )\n parent_terms = ontolo_term.parentage\n\n terms_to_index = [ ontolo_term.term ]\n names_to_index = [ ontolo_term.term_name ]\n\n unless parent_terms.nil?\n parent_terms.each do |term|\n terms_to_index.unshift( term.term )\n names_to_index.unshift( term.term_name )\n end\n end\n\n # Remove the \"top-level\" ontology name - there's no need to have this \n # in the search index...\n names_to_index.shift\n\n # Store these terms to the cache for future use...\n data_to_cache = { :term => terms_to_index, :term_name => names_to_index }\n @ontology_cache[value_to_index] = data_to_cache\n \n # Write the data to the doc...\n index_ontology_terms_from_cache( doc, term_conf, data_to_cache )\n rescue OntologyTermNotFoundError => error\n # The ontology term couldn't be found - no worries, just move on...\n end\n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def roots\n nested.filter(self.model_classes[nil].qualified_parent_column => nil)\n end", "def to_tree\n if term?\n [type, *args]\n else\n [type, *args.map(&:to_tree)]\n end\n end", "def get_feature_reviews_roots\n @trees ||= self.product.category.self_and_ancestors.collect { |cat| [cat, Feature.node_roots(:include => :feature_reviews, :conditions => [\"features.category_id=? AND feature_reviews.review_id=?\", cat.id, id])] }\n end", "def children\n \n TapirLogger.instance.log \"Finding children for #{self}\"\n children = []\n EntityMapping.all.each do |mapping| \n\n # Go through each associated entity mapping, and find mappings where the parent_id is us\n # which means that the child_id is some other entity, and it's a child\n \n # the to_s is important, otherwise self.id returns a :Moped::BSON::ObjectID\n children << mapping.get_child if mapping.parent_id == self.id.to_s\n\n # TODO - what happens if parent_id and child_id are the same. We'll\n # end up grabbing it. Could that break any assumptions?\n end\n \n children\n end", "def compute_tree_children_occurences(result_occurences)\n result_occurences.add_up(@occurences)\n\n @tree_children.each do |child_cluster|\n child_cluster.compute_tree_children_occurences(result_occurences)\n end\n end", "def generate_toc_tree(toc, type, attr); end", "def each(&block)\n squish = lambda do |tree, list|\n new_children = tree.children.reduce(list) { |acc, elem| squish.call(elem, acc) }\n [tree.root].lazy_append(new_children)\n end\n\n squish.call(self, [])\n\n # base = [root]\n # recursive = children.map(&:each)\n # res = base.lazy_append(recursive)\n\n # return res.each(&block) if block_given?\n\n # res\n\n # res = [[root], children.flat_map(&:each)].lazy.flat_map(&:lazy)\n # res = res.map(&block) if block_given?\n # res\n end", "def js_flat_hash(options = {}) # :yield: String\n @opt = {\n :max_depth => 999,\n :depth => 0,\n :children => [],\n :relationship_type => 'all' # or an Isa#id\n }.merge!(options.symbolize_keys)\n @opt[:depth] = @opt[:depth] + 1\n if @opt[:depth] < @opt[:max_depth]\n self.child_ontology_relationships(@opt).each do |n|\n @opt[:children] << n\n n.ontology_class1.js_flat_hash(@opt)\n end\n end\n return @opt[:children]\n end", "def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend", "def self_and_descendants\n records = fetch_self_and_descendants\n\n ActsAsOrderedTree::Relation::Preloaded.new(self.class).\n where(:id => records.map(&:id)).\n extending(Arrangeable).\n records(records)\n end", "def get_kids(obj)\n # if it's a hash, then there are more layers\n if(obj.class.to_s == \"Hash\")\n # drill down and keep getting kids\n obj.keys.map{|name| {:name=>name, :children=> get_kids(obj[name])}}\n else\n # Otherwise, we're at the edge. Just build an array of \"name\" hashes.\n obj.map{|name| {:name=>name}}\n end\nend", "def hojas_arbol_nodo\n children_array = []\n\n nivel_categoria = @especie.categoria_taxonomica.nivel1\n ancestry = @especie.is_root? ? @especie.id : \"#{@especie.ancestry_ascendente_directo}/%#{@especie.id}%\"\n\n taxones = Especie.select_basico(['ancestry_ascendente_directo', 'conteo', 'categorias_taxonomicas.nivel1']).datos_basicos.\n categoria_conteo_join.where(\"categoria='7_00' OR categoria IS NULL\").where(\"ancestry_ascendente_directo LIKE '#{ancestry}'\").\n where(\"nombre_categoria_taxonomica IN ('#{CategoriaTaxonomica::CATEGORIAS_OBLIGATORIAS.join(\"','\")}')\").\n where(\"nivel1=#{nivel_categoria + 1} AND nivel3=0 AND nivel4=0\"). # Con estas condiciones de niveles aseguro que es una categoria principal\n where(estatus: 2)\n\n taxones.each do |t|\n children_hash = hash_arbol_nodo(t)\n\n # Acumula el resultado del json anterior una posicion antes de la actual\n children_array << children_hash\n end\n\n render :json => children_array.to_json\n end", "def build_tree\n t = RDTree.new\n t.add_node(0, DummyRoot)\n root = root_node_of\n t.add_edge(0, root.attributes[\"ID\"])\n do_build_tree(root, 1, t) \n t\n end", "def children\n list = NodeSet.new(document)\n document.decorate(list)\n\n first = self.child\n return list unless first # Empty list\n\n list << first unless first.blank?\n while first = first.next\n list << first unless first.blank?\n end\n list\n end", "def children\n @id = fix_id(params[:id], params[:format], params[:extra])\n if params[:root]==\"source\" then\n @isRoot = true;\n @work = DcmWork.new(@id)\n @children = [@work.pi]\n else\n @isRoot = false;\n @children = get_children(\"nla.\"+params[:root])\n end\n render :action => \"children.json\"\n end", "def query\n resource_id = @params.fetch(:resourceId)\n all_children_ids = db[:archival_object]\n .filter(:root_record_id => resource_id)\n .select(:id)\n db[:instance]\n .inner_join(:sub_container, :instance_id => :instance__id)\n .inner_join(:top_container_link_rlshp, :sub_container_id => :sub_container__id)\n .inner_join(:top_container, :id => :top_container_link_rlshp__top_container_id)\n .left_outer_join(:top_container_profile_rlshp, :top_container_id => :top_container__id)\n .left_outer_join(:container_profile, :id => :top_container_profile_rlshp__container_profile_id)\n .filter {\n Sequel.|({:instance__resource_id => resource_id},\n :instance__archival_object_id => all_children_ids)\n }\n .select(Sequel.as(Sequel.lit(\"CONCAT(COALESCE(container_profile.name, ''), ' ', top_container.indicator)\"), :container),\n Sequel.as(Sequel.lit(\"GetEnumValueUF(sub_container.type_2_id)\"), :container2Type),\n Sequel.as(:sub_container__indicator_2, :container2Indicator),\n Sequel.as(Sequel.lit(\"GetEnumValueUF(sub_container.type_3_id)\"), :container3Type),\n Sequel.as(:sub_container__indicator_3, :container3Indicator))\n .distinct\n end", "def order\n # This will already have been deserialized by Rails, and is thus likely to\n # be an array (though maybe a Hash if there's only one of them).\n new_order = params[:order]\n new_order = [new_order] if new_order.is_a?(Hash)\n\n # Loop the roots and make them roots, then recursively set their children\n new_order.each do |h|\n id = h['id']\n category = Documents::Category.find(id)\n category.parent = nil\n category.save\n\n set_children_for(category, h)\n end\n\n head :no_content\n end", "def subtrees\n yield self\n each do |child|\n if child.kind_of? Tree\n child.subtrees do |tree|\n yield tree\n end\n end\n end\n end", "def class_hierarchy\n @class_hierarchy ||= process_ontology_hierarchy\n end", "def build_current_children_and_evaluate! opts={}\n these_asserts\n @current.clear\n if (@start_offset > final_offset) # see :note3\n @done = true\n evaluate_ok!\n return nil\n end\n @ok = nil\n @done = false\n @children_productions = production.children\n @ctxt = parse_context\n (start_offset..@children.length-1).each do |idx|\n @current.push idx\n break unless build_this_child_and_keep_going?(idx, opts)\n end\n @children_productions = nil\n @ctxt = nil\n evaluate_ok!\n nil\n end", "def subtree\n model_base_class.scoped(:conditions => subtree_conditions)\n end", "def roots\n self.find(:all, :conditions => \"(#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:parent_column]} IS NULL)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end", "def build_db_tree( parent_id, zone ) \n sub_root = nil\n connect_for( zone ) do |con|\n root = Node.make_node( \"home\" )\n sub_root = Node.new( parent_id, zone )\n \n root << sub_root\n \n count = 0\n data = { :dyna => true }\n database_names( con ).each do |db_name|\n db = con.db( db_name, :strict => true )\n cltns = collection_names( db ).size \n node = Node.new( \"#{zone}_#{count}\", \"#{db_name}(#{cltns})\", data.clone )\n sub_root << node\n count += 1\n end\n end\n sub_root\n end", "def roots\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND (#{acts_as_nested_set_options[:parent_column]} IS NULL)\", :order => \"#{acts_as_nested_set_options[:left_column]}\")\n end", "def traverse obj=self, &block\n case\n when obj.respond_to?(:parent?) && obj.respond_to?(:child?)\n block.call obj\n obj.children.each { |c| traverse(c, &block) }\n when obj.respond_to?(:parent?)\n obj.children.each { |c| traverse(c, &block) }\n when obj.respond_to?(:child?)\n block.call obj\n end\n end", "def children\n base_set_class.find(:all, :conditions => \"#{scope_condition} AND #{parent_col_name} = #{self.id}\", :order => left_col_name)\n end" ]
[ "0.644452", "0.6351324", "0.57664204", "0.564825", "0.56353563", "0.56243473", "0.56204253", "0.5588224", "0.55802494", "0.5546854", "0.5520916", "0.54795843", "0.5453274", "0.5447956", "0.54171306", "0.53714335", "0.5342707", "0.5337988", "0.53153515", "0.5310372", "0.5288083", "0.52870566", "0.52808344", "0.5263364", "0.52548075", "0.5254671", "0.5248671", "0.52460146", "0.522979", "0.5227577", "0.5218414", "0.5200868", "0.51981646", "0.51865786", "0.5185819", "0.5165806", "0.51603705", "0.5159601", "0.51571643", "0.51552933", "0.51503766", "0.51494163", "0.5149236", "0.5148411", "0.5140077", "0.5120421", "0.5118573", "0.5112227", "0.5092732", "0.50883514", "0.5086418", "0.5082587", "0.50789577", "0.50765115", "0.5066946", "0.5064924", "0.5062118", "0.5055171", "0.5051624", "0.5042466", "0.50417024", "0.5026744", "0.5026052", "0.5026052", "0.5026052", "0.5026052", "0.5026052", "0.5026052", "0.5026052", "0.5026052", "0.5026052", "0.5026052", "0.5026052", "0.5026052", "0.50210285", "0.5007938", "0.5004829", "0.4994233", "0.49938068", "0.49916136", "0.4985063", "0.49692985", "0.4968748", "0.49680108", "0.49581212", "0.4957145", "0.49556345", "0.49526745", "0.494654", "0.49444634", "0.49399632", "0.49356753", "0.49158403", "0.49128672", "0.4909211", "0.49053565", "0.4904811", "0.4903517", "0.48979813", "0.4897862" ]
0.6723604
0
Helper function to check whether the children have already been found or not.
def child_check if @children.nil? or @children.empty? get_children unless @already_fetched_children @already_fetched_children = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def have_children?\n children.count != 0\n end", "def children_exist?\n\tend", "def has_children?\n children.size > 0\n end", "def has_children?\n children.size > 0\n end", "def has_children?\n !children.empty?\n end", "def check_if_has_children\n self.lookups.count == 0\n end", "def has_children?\n children.size > 0\n end", "def has_children?\n children.size > 0\n end", "def children?\n !children.empty?\n end", "def children?\n !children.empty?\n end", "def children?\n !children.empty?\n end", "def has_children?\n self.children.size > 0\n end", "def has_children?\n self.children.size > 0\n end", "def has_children?\n self.children.size > 0\n end", "def has_children?\n self.children.size > 0\n end", "def has_children?\n @children.length > 0\n end", "def has_children?\n self.children.size > 0 \n end", "def has_children?\n self.children.size > 0 \n end", "def has_children?\n self.children.size > 0 \n end", "def has_children?\n self.children.size > 0 \n end", "def has_children?\n false\n end", "def has_children?\n children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def hasChildren?\n children = getChildren\n return false if children.empty? or children.nil?\n return true\n end", "def has_child?\n !@children.empty?\n end", "def children?\n !@children.empty?\n end", "def children?\n self.children.any?\n end", "def children?\n return false if @children.length == 0\n end", "def has_children?\n !self.children.empty?\n end", "def children?\n\t\t\treturn children.size > 0\n\t\tend", "def has_children()\n return 1 if(@children.length > 0)\n 0\n end", "def children?\n\t\t\t@children && !@children.empty?\n\t\tend", "def has_children?\n\t return true unless self.child_a.nil? || self.child_b.nil? \n\tend", "def has_children?\n @nodes && !@nodes.empty?\n end", "def children?\n return false if ((self.children == nil) || (self.children == []))\n return true\n end", "def children?\n\t\t\t@children.size > 0 ? true : false\n\t\tend", "def has_children?\n bag.has_children?(path)\n end", "def has_children?\n !leaf?\n end", "def has_children?\n @nokogiri.children.any? {|child| child.kind_of? Nokogiri::XML::Element }\n end", "def has_children?(path)\n return false if (! path_exist? path)\n # prune at level 2 (direct children) and ignore the hit for self\n @content_tree.subtree(path, nil, 2, true).count > 1\n end", "def any_child_open?\n self.children.each do |e|\n return true unless e.completed\n end\n false\n end", "def hasChild?\n @path.size > 1\n end", "def children?\n @contents.children?\n end", "def has_children?\n ( self[:has_children] == 1 )\n end", "def has_child_nodes()\n if @child_nodes.first_child.nil? then\n return false\n else\n return true\n end\n end", "def empty?\n @children.empty?\n end", "def is_only_child?\n return false if parent.nil? # root\n 1 == parent.children.size\n end", "def any_results_including_children?\n races.any?(&:any_results?) || children.any?(&:any_results_including_children?)\n end", "def exists?\n if @exists.nil?\n @exists = parent.children.any? { |child| child.name == name }\n end\n @exists\n end", "def completed?\n children.present? && (children_with_results.size == children.count)\n end", "def has_children?\n return call_ancestry_method(:has_children?) if use_ancestry?\n\n relationships.any?(&:has_children?)\n end", "def terminated?\n children.empty?\n end", "def child_of?(parent); end", "def hasChildren\n if (@left == nil) && (@right == nil)\n return 0\n elsif (@left != nil) && (@right != nil)\n return 2\n else\n return 1\n end\n end", "def leaf?\n children.empty?\n end", "def focusable?\n @children.any?\n end", "def nested_child?\n @elements.last.class.method_defined?('add_element') && @elements.last.container\n end", "def children_with_results\n children.select(&:any_results_including_children?)\n end", "def child?\n !root?\n end", "def child?\n !root?\n end", "def check_children\n # We take care of our children. If someone kill one, me made another one.\n # PS: Is a hard work :P\n loop do\n pid = Process.wait\n @child_pids.delete(pid)\n @child_pids << spawn_child\n end\n end", "def any_template_instance_children?\n Collection.in_collection(id).where.not(template_id: nil).any?\n end", "def has_childs\n access = Access.where(:parent_id=>id).first\n if access.blank?\n return false\n else\n return true\n end\n end", "def leaf?\n @children.empty?\n end", "def has_children?\n `#@native.hasChildren()`\n end", "def replied_to?\n self.children.length > 0\n end", "def leaf?\n @children.length.zero?\n end", "def valid?\n ((ca.cached_amount >= ca.sum_of_children) ||\n (ca.sum_of_children == 0 && children.empty?)) &&\n children.detect{|node| node.valid? == false} == nil # should be explicitely nil !!\n end", "def unknown?\n !root? && !child?\n end", "def unknown?\n !root? && !child?\n end", "def unknown?\n !root? && !child?\n end", "def check_children(ast)\n check_has_only_assoc_children ast\n ast.children.each do |child_ast|\n check_assoc_child_has_two_children child_ast\n end\n end", "def children_are_leaves?\n unless leaf?\n @children[0].leaf?\n end\n end", "def children\n child_check\n super\n end", "def useless?\n content.nil? and children.empty?\n end", "def leaf?\n self.children.size == 0\n end", "def same_children? other\n child_ids = @children.map(&:span_id)\n other_child_ids = other.children.map(&:span_id)\n ::Set.new(child_ids) == ::Set.new(other_child_ids)\n end", "def render_children_for_page?(page, depth)\n depth.succ <= @_options[:depth].to_i && children_of(page).any?\n end", "def child?\n !root?\n end", "def child?\n !root?\n end", "def leaf?\n children.where(parent_id: self.id).empty?\n end", "def has_children?(type=\"page\", content=nil)\n node = content || @content || Content.get(params[:id]) || nil\n \n if ( node && Content.all(:parent => node.id, :content_type => type).count > 0 )\n return true\n else\n return false\n end \n \n end", "def parent?\n !children.empty?\n end", "def invalid_child?(child)\n false\n end", "def invalid_child?(child)\n false\n end", "def invalid_child?(child)\n false\n end", "def nested_child?\n @options.last.last.class.method_defined?('add_element') && @options.last.last.container\n end", "def valid_child(le)\n\t\t\treturn false\n\t\tend", "def preserve_children?\n false\n end", "def rearrange_children?\n !!@rearrange_children\n end", "def leaf?\n persisted? && if children_counter_cache_column\n self[children_counter_cache_column] == 0\n else\n children.count == 0\n end\n end", "def empty?\n @errors.empty? && @children.all?(&:empty?)\n end" ]
[ "0.7792547", "0.7750983", "0.77417713", "0.77417713", "0.7729542", "0.7724229", "0.7707363", "0.7707363", "0.76941514", "0.76941514", "0.76425475", "0.7638289", "0.7638289", "0.7638289", "0.7638289", "0.7638189", "0.7626998", "0.7626998", "0.7626998", "0.7626998", "0.76057714", "0.7602235", "0.7567192", "0.7567192", "0.7567192", "0.7567192", "0.7567192", "0.7567192", "0.7567192", "0.7567192", "0.7567192", "0.7563774", "0.7563387", "0.75585175", "0.75556904", "0.7500156", "0.7488134", "0.7437813", "0.7348932", "0.72996575", "0.72866315", "0.7227465", "0.7222266", "0.72195303", "0.7213594", "0.71405554", "0.70638245", "0.70551354", "0.7006253", "0.69980824", "0.6971619", "0.69708204", "0.691684", "0.68294096", "0.680285", "0.678172", "0.6768197", "0.67396605", "0.6731684", "0.67131865", "0.6706138", "0.6690227", "0.6688453", "0.66846526", "0.6656342", "0.66166997", "0.66101944", "0.66101944", "0.6603461", "0.66004413", "0.65784025", "0.65552646", "0.6543393", "0.65432775", "0.6536808", "0.6524715", "0.65230674", "0.65230674", "0.65230674", "0.65221196", "0.65215415", "0.65188926", "0.65138286", "0.65084255", "0.6488272", "0.6484511", "0.64834607", "0.6479775", "0.6461795", "0.64610255", "0.6450537", "0.64445126", "0.64445126", "0.64445126", "0.64283264", "0.64083076", "0.64077455", "0.6398556", "0.6391356", "0.6374631" ]
0.8091491
0
Helper function to produce the flat lists of all the child terms and names.
def get_all_child_lists child_check if @all_child_terms.nil? and @all_child_names.nil? @all_child_terms = [] @all_child_names = [] self.children.each do |child| @all_child_terms.push( child.term ) @all_child_terms.push( child.all_child_terms ) @all_child_names.push( child.term_name ) @all_child_names.push( child.all_child_names ) end @all_child_terms = @all_child_terms.flatten.uniq @all_child_names = @all_child_names.flatten.uniq end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_child_terms\n get_all_child_lists\n return @all_child_terms\n end", "def all_child_names\n get_all_child_lists\n return @all_child_names\n end", "def children_names; @children.keys; end", "def descendent_names\n self_and_descendents.map(&:name).flatten \n end", "def get_child_names(node)\n\n child_names = []\n node.children.each { |child| child_names << child.name }\n child_names.join(\", \")\n\n end", "def get_children( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_term\n from\n term_relationship tr\n join term as subject_term on tr.subject_term_pk = subject_term.term_pk\n join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk\n join term as object_term on tr.object_term_pk = object_term.term_pk\n where\n predicate_term.term_name in ('part_of','is_a','develops_from')\n and object_term.identifier = ?\n SQL\n \n OLS_DB[sql,node.term].each do |row|\n child = OntologyTerm.new( row[:child_identifier], row[:child_term] )\n node << child\n end\n end", "def grand_children\n []\n end", "def childs_names\n\t\t[first_name, middle_name, maiden_name, last_name ]\n\tend", "def children\n result = []\n @children.each do |_, child_group|\n result.concat(child_group)\n end\n\n result\n end", "def children\n kids = []\n each_child { |kid| kids << kid }\n kids\n end", "def word_list\n # Returning only the terms of each definition as an array.\n list_of_terms = @words.map do |key, definition_instance|\n definition_instance.term\n end\n end", "def list_children(taxons_collection)\n taxons_collection.sort_by {|p| p.hierarchy}\n html_var = \"\"\n taxons_collection.each do |t|\n if not t.children.empty?\n html_var << \"<li><i class='icon-plus'> </i>\" << link_to(t.name, t) << \"<ul>\" << list_children(t.children) << \"</ul>\"\n else\n html_var << \"<li><i class='icon-white' style='visibility: hidden;'> </i>\" << link_to(t.name, t)\n end\n html_var << \"</li>\\n\"\n end\n return html_var.html_safe\nend", "def terms\n @data.map(&:uniq).flatten\n end", "def children_for(list)\n list.map do |key, value|\n value = Array(value).flatten\n if value.any?\n after = \" \" * string.inspect.length + \" \"\n description = Hansi.render(THEME[:orange], key.to_s)\n Tree.new(description, *value, after: after, prefix_color: PREFIX_COLOR)\n end\n end\n end", "def children(all: false)\n scoped_children =\n if at_or_below_genus?\n Name.with_correct_spelling.subtaxa_of_genus_or_below(text_name)\n else\n Name.with_correct_spelling.\n with_rank_and_name_in_classification(rank, text_name)\n end\n\n return scoped_children.to_a if all\n\n Name.all_ranks.reverse_each do |rank2|\n next if rank_index(rank2) >= rank_index(rank)\n\n matches = scoped_children.with_rank(rank2)\n return matches.to_a if matches.any?\n end\n []\n end", "def child_labels\n self.meta_definition.children.map { |c| c.label }\n end", "def descendants\n list = []\n children.each do |child|\n list << child\n list.concat(child.descendants)\n end\n list\n end", "def descendants\n list = []\n children.each do |child|\n list << child\n list.concat(child.descendants)\n end\n list\n end", "def terms\n @data.flatten.uniq\n end", "def descendants\n children.inject([]) { |m,child|\n m << child\n m += child.descendants\n }\n end", "def child_names(path, query_result)\n return @child_names_override.call(self, path, query_result) if @child_names_override\n child_names = []\n sub_values = query_result.gsub(\"\\r\\n\", \"\\n\").split(@child_name_delimiter)\n sub_values.each do |sub_value|\n sub_value.strip!\n (child_names << sub_value) unless sub_value.empty?\n end\n return child_names\n end", "def names\n map(&:names).flatten\n end", "def descendants\n children + children.map(&:children).flatten\n end", "def terms\n @term_hash.values\n end", "def show_all_children_info\n descendants.map(&:to_s)\n end", "def to_tree\n if term?\n [type, *args]\n else\n [type, *args.map(&:to_tree)]\n end\n end", "def descendents\n\n\t\t #children.preload(:parent).each do |child| child.descendents end\n\t\t children.each do |child|\n\t [child] + child.descendents\n\t end\n end", "def descendants\n desc = []\n children.each do |tc|\n desc << tc\n desc += tc.descendants if tc.parent?\n end\n desc\n end", "def term_list\n terms = Array.new\n\n self.notes.each do |note|\n note.scrubbed_notes.each do |word|\n term_index = terms.index(word)\n if term_index.nil?\n terms.push(word)\n end\n end\n end\n terms\n end", "def secondary_terms\n []\n end", "def secondary_terms\n []\n end", "def secondary_terms\n []\n end", "def children() []; end", "def terms\n values.map(&:to_s)\n end", "def descendants\n children + children.map(&:descendants).flatten\n end", "def collapse\n a = []\n n = self\n begin\n return false if n.children.size != 1\n a << n.term\n n = n.children.first\n end while not n.children.empty?\n a << n.term\n @term = a.join(' ')\n @children = []\n end", "def secondary_terms\n []\n end", "def descendents\n respond_to?(:values) ? values.map { |d| d.branch }.flatten : []\n end", "def children; []; end", "def terms_for_field(name)\n get_for_field(name).map(&:term).uniq\n end", "def terms\n [self]\n end", "def get_childs\n access = Access.where(:parent_id=>id)\n childs=\"\"\n access.each do |item|\n if childs.empty?\n if item.get_childs.empty?\n childs=item.id.to_s\n else\n childs=item.id.to_s+\",\"+item.get_childs\n end\n else\n if item.get_childs.empty?\n childs= childs+\",\"+item.id.to_s\n else\n childs= childs+\",\"+item.id.to_s+\",\"+item.get_childs.to_s\n end\n end\n end\n return childs\n end", "def terms\n @locations.map(&:term).uniq\n end", "def child_keys() []; end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def get_child_element_names(mods_node)\n return [] if mods_node == nil\n child_element_names = mods_node.children.map {|x| x.name}.uniq.reject {|y| y == 'text'}.compact\n end", "def onlychildren_list\n if matches.length == 1\n [self] + matches[0].onlychildren_list\n else\n [self]\n end\n end", "def descendants\n \t descendants = []\n \t self.children.each { |child|\n \t descendants += [child] if child.permitted?\n \t descendants += child.descendants\n \t } unless self.children.empty?\n \t descendants \n \tend", "def children\n entries\n end", "def children\n []\n end", "def children\n []\n end", "def children\n Brand.where(:parent => self.name).order('sort_order, name')\n end", "def children\n children_tree.values\n end", "def children\n children_tree.values\n end", "def terms\n @terms ||= wayfinder.decorated_ephemera_terms.sort_by(&:label)\n end", "def children\n []\n end", "def descendants\n \t\tres=children\n \t\tchildren.each {|c| res += c.descendants}\n \t\treturn res.uniq\n \tend", "def values\n @children\n end", "def to_array\n children.each_with_object( [ self ] ) { |child, memo|\n memo.concat( child.to_array )\n }.flatten\n end", "def my_squirrels\n # which one knows about BOTH the trees and the nests?\n my_nests.map do |nest|\n nest.squirrel.name\n end\n end", "def each &block\n enumerator = Enumerator.new do |words|\n words << as_word if terminal?\n children.each { |child| child.each { |word| words << word } }\n end\n\n block.nil? ? enumerator : enumerator.each(&block)\n end", "def getTags node\n array = [] #array to hold working collection\n \n node.children.each do |child|\n array << Hash[child.name,child.inner_text] unless child.name == 'text' #text \n end\n \n return array\n end", "def map_child\n array = []\n @children.each_pair { |_, child| array << (yield child) }\n array\n end", "def children\n []\n end", "def get_parents( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_term\n from\n term_relationship tr\n join term as subject_term \ton tr.subject_term_pk = subject_term.term_pk\n join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk\n join term as object_term on tr.object_term_pk = object_term.term_pk\n where\n predicate_term.term_name in ('part_of','is_a','develops_from')\n and subject_term.identifier = ?\n SQL\n \n OLS_DB[ sql, node.term ].each do |row|\n parent = OntologyTerm.new( row[:parent_identifier], row[:parent_term] )\n parent << node\n get_parents( parent )\n end\n end", "def children\n @ref.children.to_ruby\n end", "def all_children\n\n yielded_self = if block_given?\n yield self\n end\n\n return ( yielded_self || self ) if self.children.empty?\n _child = self.children.map do |child|\n _name = (yield child if block_given?) || self\n if child.children.empty?\n _name\n else\n [_name, child.all_children{ |this_child| yield this_child if block_given? }]\n end\n end\n return _child\n end", "def directors\n directors = []\n self.children.each { |m|\n m.directors.slice(0,1).each { |d| directors.push(d) }\n }\n directors.uniq\n end", "def names\n @nodes.map(&:name)\n end", "def keys\n @children.map(&:title)\n end", "def words\n terms.collect { |t| t.word }\n end", "def children\n list = NodeSet.new(document)\n document.decorate(list)\n\n first = self.child\n return list unless first # Empty list\n\n list << first unless first.blank?\n while first = first.next\n list << first unless first.blank?\n end\n list\n end", "def all_children\n @all_children ||= children + children.inject([]) {|records, child| records + child.all_children}\n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def all_children_deep(flag=nil)\n\t\tarr = []\n\t\tall_children(flag).each do |c|\n\t\t\tarr << c\n\t\t\tc.all_children_deep(flag).each do |cc|\n\t\t\t\tarr << cc\n\t\t\tend\n\t\tend\t\t\t\n\t\tarr\n\tend", "def flattened_children\n no_frags = []\n children.each do |node|\n if node.is_a? Rxhp::Fragment\n no_frags += node.children\n else\n no_frags.push node\n end\n end\n\n previous = nil\n no_consecutive_strings = []\n no_frags.each do |node|\n if node.is_a?(String) && previous.is_a?(String)\n previous << node\n else\n no_consecutive_strings.push node\n previous = node\n end\n end\n\n no_consecutive_strings\n end", "def descendants\n _descendants = children(true)\n children.each do |child|\n _descendants = _descendants + child.descendants\n end\n _descendants\n end", "def subjects_for_csv\n roots = []\n if comments.any?\n comments.map do |comment|\n roots += comment.subjects.roots\n end\n end\n if roots.empty?\n structures.map do |structure|\n roots += structure.subjects.roots\n end\n end\n subjects_to_array_for_csv roots.uniq.map(&:name)\n end", "def taxons_including_children_ids\n taxons.inject([]) { |ids, taxon| ids += taxon.self_and_descendants.ids }\n end", "def extract_children_from(obj)\n\t\tif obj.nil? then\n\t\t\treturn []\n\t\tend\n\t\t\n\t\toutput = []\n\t\tset = obj.children\n\t\tset.each do |node|\n\t\t\toutput << node\n\t\tend\n\t\t\n\t\treturn output\n\tend", "def children\n children = []\n\n unless leaf?\n zipper = down\n children << zipper\n\n until zipper.last?\n zipper = zipper.next\n children << zipper\n end\n end\n\n children\n end", "def descendants_and_self\r\n result = [self]\r\n children.each { |child| result << child.descendants_and_self }\r\n result.flatten!\r\n return result\r\n end", "def list_all_toys\n\tchild_ids = LootBag.toy_bag.keys\n\tnames = child_ids.map {|key| hash_query(key, Children[\"children\"], \"child_id\", \"child_name\")}\n\ttoys = []\n\tchild_ids.each_with_index do |id, index|\n\t\ttoys = LootBag.toy_bag[id].map {|key| hash_query(key, Toys[\"toys\"], \"toy_id\", \"toy_name\")}\n\t\tputs \"#{names[index]} wants:\"\n\t\tputs toys\n\tend\nend", "def get_all_child_collections_names()\r\n #Remember there are fields begininf with \"<\" which has to be excluded\r\n names = @db_interface.get_all_hash_fields(@certain_coll_key)\r\n names ||= []\r\n return names\r\n end", "def all_children\n find_all_children_with_dotted_ids\n end", "def children\n @children ||= {}.with_indifferent_access\n end", "def bag_list(node)\n node.children.flat_map do |child|\n [child.color] + bag_list(child)\n end\n end" ]
[ "0.7798765", "0.710421", "0.66812056", "0.6411084", "0.6400847", "0.63181674", "0.6286913", "0.6132601", "0.6062827", "0.605796", "0.60351855", "0.60266215", "0.5994999", "0.59936947", "0.5935", "0.5894351", "0.5881827", "0.5881827", "0.5877281", "0.58642775", "0.5859277", "0.5843171", "0.58181167", "0.5796786", "0.5786796", "0.57663417", "0.5765419", "0.57530904", "0.5752417", "0.57467353", "0.57467353", "0.57467353", "0.5742528", "0.57350975", "0.5717339", "0.5713494", "0.57095575", "0.56993234", "0.5659678", "0.56285274", "0.5624799", "0.56138164", "0.56113636", "0.5601618", "0.55932987", "0.55932987", "0.55932987", "0.5589351", "0.55789196", "0.5558892", "0.55523455", "0.55425984", "0.55425984", "0.55377656", "0.5514044", "0.5514044", "0.5506655", "0.55051243", "0.54930073", "0.5485475", "0.5478042", "0.54590935", "0.5458827", "0.5457895", "0.5452133", "0.54486006", "0.54464066", "0.5446053", "0.5440198", "0.54401577", "0.5436455", "0.5434548", "0.5428639", "0.5423722", "0.5423661", "0.5415335", "0.5415335", "0.5415335", "0.5415335", "0.5415335", "0.5415335", "0.5415335", "0.5415335", "0.5415335", "0.5415335", "0.5415335", "0.5415335", "0.5409094", "0.54077786", "0.5405762", "0.53855383", "0.5385374", "0.53791684", "0.53614676", "0.5355734", "0.5354628", "0.53536093", "0.53463197", "0.5345227", "0.534227" ]
0.79793257
0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Write message vbs script on host
def write_msg_to_target(message) print_status("Writting message script on host...") location = session.sys.config.getenv('TEMP') msgvbs = "#{location}\\messenger.vbs" mg = @client.fs.file.new(msgvbs, "wb") mg.write("msgbox(\"#{message}\")") mg.close return msgvbs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(text)\n end", "def send_message(msg); end", "def send_message(message, wparam = 0, lparam = 0)\n with_handle { User32.SendMessage(@handle, User32::EditMessage[message], wparam, lparam) }\n end", "def send_message(message); end", "def send_message(message); end", "def remote_msg(sender, body)\n add_msg(\"|#{sender}| #{body}\", :notice)\nend", "def _server_control(command, body = nil)\n @connection.comm.server_message(\"#{command} #{body}\")\nend", "def loadingMessage()\n puts \"\\n\"\n print \"Thank you #{$_userNameVar}. Now I will do work for you :)\"\n sleep(1)\n print '.'\n sleep(1)\n print '.'\n sleep(1)\n print '.'\n sleep(1)\n puts '.'\nend", "def send(message)\n info(\"[Smartfocus] Send -> #{message}\")\n end", "def send_mess(mess)\n\t@client.puts(mess)\t\nend", "def sendM(message)\n\t\t@conexion.puts(message)\t\n\tend", "def bye_message\n message = \"Panacea's work is done, enjoy!\"\n say \"\\n\\n\\e[34m#{message}\\e[0m\"\n end", "def message(dest)\n\tprint_status \"Network Enumerator Meterpreter Script \"\n\tprint_status \"Log file being saved in #{dest}\"\nend", "def send_message(body)\n # checksum\n body << ((~body.sum+1) & 0x7F)\n\n # sysex wrapper and header\n msg = [\n 0xF0,\n 0x00,0x01,0x73,0x7E, # header: iConnectivity's manufacturer ID and message class\n *body,\n 0xF7\n ]\n\n # send sysex\n output = UniMIDI::Output.first\n output.puts(msg)\nend", "def pbSetTextMessages\r\n Graphics.update\r\n begin\r\n t = Time.now.to_i\r\n texts=[]\r\n for script in $RGSS_SCRIPTS\r\n if Time.now.to_i - t >= 5\r\n t = Time.now.to_i\r\n Graphics.update\r\n end\r\n scr=Zlib::Inflate.inflate(script[2])\r\n pbAddRgssScriptTexts(texts,scr)\r\n end\r\n if safeExists?(\"Data/PluginScripts.rxdata\")\r\n plugin_scripts = load_data(\"Data/PluginScripts.rxdata\")\r\n for plugin in plugin_scripts\r\n for script in plugin[2]\r\n if Time.now.to_i - t >= 5\r\n t = Time.now.to_i\r\n Graphics.update\r\n end\r\n scr = Zlib::Inflate.inflate(script[1]).force_encoding(Encoding::UTF_8)\r\n pbAddRgssScriptTexts(texts,scr)\r\n end\r\n end\r\n end\r\n # Must add messages because this code is used by both game system and Editor\r\n MessageTypes.addMessagesAsHash(MessageTypes::ScriptTexts,texts)\r\n commonevents = load_data(\"Data/CommonEvents.rxdata\")\r\n items=[]\r\n choices=[]\r\n for event in commonevents.compact\r\n if Time.now.to_i - t >= 5\r\n t = Time.now.to_i\r\n Graphics.update\r\n end\r\n begin\r\n neednewline=false\r\n lastitem=\"\"\r\n for j in 0...event.list.size\r\n list = event.list[j]\r\n if neednewline && list.code!=401\r\n if lastitem!=\"\"\r\n lastitem.gsub!(/([^\\.\\!\\?])\\s\\s+/) { |m| $1+\" \" }\r\n items.push(lastitem)\r\n lastitem=\"\"\r\n end\r\n neednewline=false\r\n end\r\n if list.code == 101\r\n lastitem+=\"#{list.parameters[0]}\"\r\n neednewline=true\r\n elsif list.code == 102\r\n for k in 0...list.parameters[0].length\r\n choices.push(list.parameters[0][k])\r\n end\r\n neednewline=false\r\n elsif list.code == 401\r\n lastitem+=\" \" if lastitem!=\"\"\r\n lastitem+=\"#{list.parameters[0]}\"\r\n neednewline=true\r\n elsif list.code == 355 || list.code == 655\r\n pbAddScriptTexts(items,list.parameters[0])\r\n elsif list.code == 111 && list.parameters[0]==12\r\n pbAddScriptTexts(items,list.parameters[1])\r\n elsif list.code == 209\r\n route=list.parameters[1]\r\n for k in 0...route.list.size\r\n if route.list[k].code == 45\r\n pbAddScriptTexts(items,route.list[k].parameters[0])\r\n end\r\n end\r\n end\r\n end\r\n if neednewline\r\n if lastitem!=\"\"\r\n items.push(lastitem)\r\n lastitem=\"\"\r\n end\r\n end\r\n end\r\n end\r\n if Time.now.to_i - t >= 5\r\n t = Time.now.to_i\r\n Graphics.update\r\n end\r\n items|=[]\r\n choices|=[]\r\n items.concat(choices)\r\n MessageTypes.setMapMessagesAsHash(0,items)\r\n mapinfos = pbLoadMapInfos\r\n mapnames=[]\r\n for id in mapinfos.keys\r\n mapnames[id]=mapinfos[id].name\r\n end\r\n MessageTypes.setMessages(MessageTypes::MapNames,mapnames)\r\n for id in mapinfos.keys\r\n if Time.now.to_i - t >= 5\r\n t = Time.now.to_i\r\n Graphics.update\r\n end\r\n filename=sprintf(\"Data/Map%03d.rxdata\",id)\r\n next if !pbRgssExists?(filename)\r\n map = load_data(filename)\r\n items=[]\r\n choices=[]\r\n for event in map.events.values\r\n if Time.now.to_i - t >= 5\r\n t = Time.now.to_i\r\n Graphics.update\r\n end\r\n begin\r\n for i in 0...event.pages.size\r\n neednewline=false\r\n lastitem=\"\"\r\n for j in 0...event.pages[i].list.size\r\n list = event.pages[i].list[j]\r\n if neednewline && list.code!=401\r\n if lastitem!=\"\"\r\n lastitem.gsub!(/([^\\.\\!\\?])\\s\\s+/) { |m| $1+\" \" }\r\n items.push(lastitem)\r\n lastitem=\"\"\r\n end\r\n neednewline=false\r\n end\r\n if list.code == 101\r\n lastitem+=\"#{list.parameters[0]}\"\r\n neednewline=true\r\n elsif list.code == 102\r\n for k in 0...list.parameters[0].length\r\n choices.push(list.parameters[0][k])\r\n end\r\n neednewline=false\r\n elsif list.code == 401\r\n lastitem+=\" \" if lastitem!=\"\"\r\n lastitem+=\"#{list.parameters[0]}\"\r\n neednewline=true\r\n elsif list.code == 355 || list.code==655\r\n pbAddScriptTexts(items,list.parameters[0])\r\n elsif list.code == 111 && list.parameters[0]==12\r\n pbAddScriptTexts(items,list.parameters[1])\r\n elsif list.code==209\r\n route=list.parameters[1]\r\n for k in 0...route.list.size\r\n if route.list[k].code==45\r\n pbAddScriptTexts(items,route.list[k].parameters[0])\r\n end\r\n end\r\n end\r\n end\r\n if neednewline\r\n if lastitem!=\"\"\r\n items.push(lastitem)\r\n lastitem=\"\"\r\n end\r\n end\r\n end\r\n end\r\n end\r\n if Time.now.to_i - t >= 5\r\n t = Time.now.to_i\r\n Graphics.update\r\n end\r\n items|=[]\r\n choices|=[]\r\n items.concat(choices)\r\n MessageTypes.setMapMessagesAsHash(id,items)\r\n if Time.now.to_i - t >= 5\r\n t = Time.now.to_i\r\n Graphics.update\r\n end\r\n end\r\n rescue Hangup\r\n end\r\n Graphics.update\r\nend", "def on_message data\n\t\t# broadcast sends an asynchronous message to all sibling instances, but not to self.\n\t\tdata = ERB::Util.html_escape data\n\t\tbroadcast :_print_out, data\n\t\tresponse << \"You said: #{data}\"\n\t\tresponse << (request.ssl? ? \"FYI: Yes, This is an SSL connection...\" : \"FYI: Nope, this isn't an SSL connection (clear text).\") if data.match /ssl\\?/i\nend", "def send_whisper(user, message)\n @bot.message_queue.push(\"PRIVMSG #jtv :/w #{user} #{message}\")\n end", "def raw_send(message)\n TalkerBase.instance.output << \"#{id} send #{message}\"\n end", "def echo message\r\n command 'echo', message\r\n end", "def say(msg)\n print msg + \"\\r\\n\"\n end", "def write(text)\n shell.write(text)\n end", "def add_message(text,name=nil)\n debug \"add message\"\n puts \"WWWTHUNHEOUTSN\"\n puts @glade['scrolledwindow1'].hadjustment.value\n puts @glade['scrolledwindow1'].hadjustment.upper\n puts @glade['scrolledwindow1'].hadjustment.lower\n @talk.buffer.insert @talk.buffer.end_iter,\"#{name || @contact.name}: \", @nickname_tag\n @talk.buffer.insert @talk.buffer.end_iter, \"#{text}\\n\"\n end", "def run_script\n %[timeout $((PBS_WALLTIME-300)) \"#{script}\"]\n end", "def say\n send_text \"You just said: #{params}\"\n end", "def send_text\n\nend", "def show_5min_notification\n #message_box \"Ваше время истечет через 5 минут!\"\n message_box_nonblk 1\n system Gem.ruby, File.expand_path(\"msgbox.rb\", File.dirname(__FILE__)), '1'\nend", "def send_message(msg)\n send_data({:type => :message, :body => msg})\n end", "def message(msg)\n STDOUT.puts msg\n end", "def send_text_message(body)\n app = current_application\n if app.present?\n app.send_text_message body\n end\n end", "def serve( connection )\n connection.puts( \"220 #{@host} MailTrap ready ESTMP\" )\n helo = connection.get_line # whoever they are\n\n if helo =~ /^EHLO\\s+/\n connection.puts \"250-#{@host} offers just ONE extension my pretty\"\n connection.puts \"250 HELP\"\n end\n\n # Accept MAIL FROM:\n from = connection.get_line\n connection.puts( \"250 OK\" )\n\n to_list = []\n\n # Accept RCPT TO: until we see DATA\n loop do\n to = connection.get_line\n break if to.nil?\n\n if to =~ /^DATA/\n connection.puts( \"354 Start your message\" )\n break\n else\n to_list << to\n connection.puts( \"250 OK\" )\n end\n end\n\n # Capture the message body terminated by <CR>.<CR>\n lines = []\n loop do\n line = connection.get_line\n break if line.nil? || line == \".\"\n lines << line\n end\n\n # We expect the client will go away now\n connection.puts( \"250 OK\" )\n connection.gets # Quit\n connection.puts \"221 Seeya\"\n connection.close\n\n write( from, to_list, lines.join( \"\\n\" ) )\n end", "def write_remote(code, msg)\n # FIXME change into write_xxx\n @inout.writeline(code + msg)\n end", "def send_it!\n raise DialogNotFoundError, \"No system dialog could be found for: #{self}\" unless system_dialog\n\n system_dialog.write sender_type, message \n end", "def send_message(message)\n check_parenthesis(message)\n puts \"Send: #{message}\" if @debug\n connection{|c| c.write(message)}\n end", "def systemmsg(head, message)\n send_command(:systemmsg, head: head, message: message )\n end", "def speak_text(texttospeak)\r\n fixedmessage = texttospeak\r\n fixedmessage = fixedmessage.gsub(\"\\r\", \" \")\r\n fixedmessage = fixedmessage.gsub(\"\\n\", \" \")\r\n fixedmessage = fixedmessage.strip\r\n exec(\"AGI\", \"speak_text.agi|\\\"\" + fixedmessage + \"\\\"\")\r\n\tend", "def ed_write(msg)\n Aas::Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage \"\\n\" + msg\n end", "def welcome_message\n puts \"Welcome to Shiqing's Secret Number Game! \\nShiqing created this game.\"\nend", "def send_string(text)\n ping player_url+\"/application/sendString?text=#{CGI::escape(text.to_s)}&#{plex_token}\"\n end", "def send_message\n current_div.button(:id=>\"send_message\").click\n wait_for_ajax\n end", "def welcome_message\n system('clear')\n puts \" _ _ _ _ \"\n sleep 0.1\n puts \"| | | | ___| | | ___ \"\n sleep 0.1\n puts \"| |_| |/ _ | |/ _ \\ \"\n sleep 0.1\n puts \"| _ | __/ | | (_) |\"\n sleep 0.1\n puts \"|_| |_| ___|_|_| ___/ \"\n sleep 0.1\n puts \"\" \n puts \"bienvenue dans mon jeu du morpion\"\n puts \"\\nAvant de commencer entre le nom des deux joueurs qui vont s'affronter\"\n end", "def button1_responder( msg, value )\n script_button_handler( msg, value, 'bin/foo1.sh' )\n end", "def send( text )\n checkConnection()\n @conn.write( text + EOL )\n end", "def send( text )\n checkConnection()\n @conn.write( text + EOL )\n end", "def respond(client, text)\n NSLog \"#{client.object_id}:#{@port} > #{text}\"\n client.write text\n rescue\n NSLog \"#{client.object_id}:#{@port} ! #{$!}\"\n client.close\n end", "def send_msg(conn,args)\n p = @app.get_client(conn) #pega objeto Player da lista de clientes\n unless p.nil?\n @app.broadcast(Message.new('chat','txt',\n {'author' => CGI::escapeHTML(p.to_s), 'msg' => CGI::escapeHTML(args['msg'])}\n )) #envia a mensagem para todos os clientes\n end\n end", "def send_messages(_target, strings)\n strings = Array(strings)\n strings.reject!(&:empty?)\n unless RbConfig::CONFIG[\"host_os\"] =~ /mswin|mingw/ || !$stdout.tty?\n strings.map! { |string| \"\\e[32m#{string}\\e[0m\" }\n end\n puts strings\n end", "def write(msg)\n @handle.puts(msg)\n end", "def send_sms\n Sms.send_sms(session[:zeepusername], params[:sendmsg][:messagebody])\n \n @zeep_response = \"Message sent to #{session[:zeepusername]}!\"\n \n render :action => \"testloop\"\n \n end", "def send(user, number, message, phone=nil)\n phone = Behaviour.select_phone(number, user['behaviour']) if phone.nil?\n if phone #se fizer match com os existentes\n `gammu-smsd-inject -c ~/.sms/gammu-smsdrc-#{phone} TEXT #{number} -text \"#{message}\"` # send to daemon\n #LOGIT que foi para a fila\n else \n #LOGIT que alguem tentou mas nao foi para a fila\n end\n end", "def echo(message)\n run 'echo', message\n end", "def send(message, options={})\n content_window.send(message, options)\n end", "def personalChat\n puts \"This is a Personal Chat\"\n # puts message\n end", "def echo(message)\n puts message\n end", "def send_to_vm(command)\n socket = UNIXSocket.new(socket_file)\n socket.puts(command)\n socket.close\n end", "def send(message)\n info(\"[Emailvision] Send -> #{message}\")\n end", "def send_message(bot, server, channel, user, message)\n lang = @config[:lang]\n name = Digest::SHA256.hexdigest (message.to_s + lang)\n message.gsub!(/^\\s+/, \"\")\n if !Dir.exists?(@config[:cache_directory])\n system(\"mkdir -p \\\"#{@config[:cache_directory]}\\\"\")\n end\n\n file = File.join(@config[:cache_directory], \"#{name}\")\n\n # popen3\n if !File.exists?(\"#{file}.mp3\")\n File.write \"#{file}.txt\", message\n\n Open3.popen3(\"perl\", \"simple-google-tts/speak.pl\", lang, \"#{file}.txt\", \"#{file}.mp3\") do |stdin, stdout, stderr, thread|\n error = stderr.read\n message = stdout.read\n if thread.value != 0\n # TODO: Billbot tries to log own DMs and enters a loop\n # user.pm \"Error writing a message for you. Please report this to an admin.\"\n # user.pm \"STDOUT\\n```#{message}```\"\n # user.pm \"STDERR\\n```#{error}```\"\n puts \"Error writing message\"\n puts \"STDOUT\\n#{message}\\n\\nSTDERR\\n#{error}\\n\\n\"\n\n system(\"rm -f \\\"#{file}.txt\\\"\")\n return\n end\n end\n\n system(\"rm \\\"#{file}.txt\\\"\")\n end\n\n if !@voice_queue.has_key?(server)\n @voice_queue[server] = []\n end\n\n if @voice_queue[server].select { |v| v.owner == user }.size >= @QUEUE_SIZE\n puts \"Limit reached for \\\"#{user.username}\\\" on \\\"#{channel}\\\"\"\n return\n end\n\n message = VoiceMessage.new(user, channel, \"#{file}.mp3\")\n message.volume = 1.0\n @voice_queue[server] << message\n end", "def message text\n $status_message.value = text # trying out 2011-10-9 \n end", "def ezm_link_to_send_message\r\n link_to \"Write\", compose_url\r\n end", "def reply msg\n\t\t# get message from user\n\t\trep = @@client.message(msg)\n\t\t# handle the message\n\t\tputs handle_message(rep)\n\t\t\n\t\t# interactive Wit\n\t\t#@@client.interactive(method(:handle_message))\n\tend", "def say s\n write \"PRIVMSG ##{config[:channel]} :#{s[0..450]}\"\n log \"<#{config[:nick]}> #{s}\"\n sleep 1\n end", "def send_message(message_text)\n @selected.send_message(message_text)\n end", "def show_test_message\r\n cc 0x02\r\n puts \"Testing script #{@script}\"\r\n cc 0x07\r\n puts \"Type : \"\r\n puts \"reload to reload the script\"\r\n puts \"restart to restart the scene\"\r\n puts \"quit to quit the test\"\r\n print \"Commande : \"\r\n end", "def partner\n @chat_win = ChatWindow.find\n lclick_at(@partner_tab)\n sleep 1\n loop do\n cmd = wait_for_cmd\n if cmd\n response = eval cmd\n @chat_win.say \"#{ACK}#{response}\" \n end\n sleep 1\n end\n end", "def execute\n # Generate the shell script that will run WEACEExecute.\n File.open(\"#{@ProviderEnv[:Shell][:InternalDirectory]}/Test_Broadcast.sh\", 'w') do |oFile|\n oFile << \"\\#!/bin/sh\n#{@ProviderEnv[:WEACEExecuteCmd]} MasterServer --user Scripts_Tester --process Test_Broadcast -- --comment $1\n\"\n end\n\n return nil\n end", "def dialog(title, txt)\n system %Q(say '#{title}')\n system %Q(osascript -e 'tell app \"System Events\" to display dialog \"#{txt}\"')\n # or if you have 'ruby-growl' gem installed\n # system \"growl -h localhost -m '#{txt}'\"\nend", "def get_messages\n %{\n <script>\n if (navigator.appName!=\"Microsoft Internet Explorer\") {\n #{Sinatra::Messages.get}\n #{@console}\n }\n </script>\n }\n end", "def trigger_on_message(msg); @app.on_message(msg); end", "def say(dat, sender)\n UI.dump(sender.name, self.name, dat)\n end", "def notify(type, title, body, time: 5)\n require 'cgi'\n\n puts \"[#{type}] #{title}\"\n puts \" #{body}\"\n\n time_in_ms = time * 1000\n\n cmd = [\"notify-send\"]\n cmd << \"--expire-time=#{time_in_ms}\"\n cmd << \"--app-name=play\"\n cmd << \"--icon=#{type}\"\n cmd += [title, body].map {|s| CGI.escapeHTML s }\n\n system *cmd\nend", "def message\n self.message_button\n self.wait_until { self.text.include? \"Send Message\" }\n self.class.class_eval { include SendMessagePopUp }\n end", "def user_message_end(msg)\n user_message(msg, 0, \"<<<\")\n end", "def serve(connection)\n connection.puts(\"220 #{@host} MailTrap ready ESTMP\")\n helo = connection.get_line # whoever they are\n\n if helo =~ /^EHLO\\s+/\n connection.puts \"250-#{@host} offers just ONE extension my pretty\"\n connection.puts '250 HELP'\n end\n\n # Accept MAIL FROM:\n from = connection.get_line\n connection.puts('250 OK')\n\n to_list = []\n\n # Accept RCPT TO: until we see DATA\n loop do\n to = connection.get_line\n break if to.nil?\n\n if to =~ /^DATA/\n connection.puts('354 Start your message')\n break\n else\n to_list << to\n connection.puts('250 OK')\n end\n end\n\n # Capture the message body terminated by <CR>.<CR>\n lines = []\n loop do\n line = connection.get_line\n break if line.nil? || line == '.'\n lines << line\n end\n\n # We expect the client will go away now\n connection.puts('250 OK')\n connection.gets # Quit\n connection.puts '221 Seeya'\n connection.close\n\n write(from, to_list, lines.join(\"\\n\"))\n end", "def send(content)\n @comm.send({method: \"custom\", content: content})\n end", "def sendmsg(s)\n @sock.send \"#{s}\\n\", 0 \n end", "def send_sms\n puts \"Send a message.\"\nend", "def send_page\n send_message(\"page\")\n end", "def action(message)\n print(6, message)\n end", "def write (text)\n @client.puts(text)\n end", "def send_message(message)\n message = JSON.generate(message)\n @log.debug(\"Sending #{message}\")\n @ws.send(message)\n end", "def remote_motd(sender, body)\n return nil unless sender == 'server'\n room = @connection.room_names[body[0,8]]\n username = _user_name(body[8,8])\n body[0,16] = ''\n _notice \"-- MOTD (#{username}) --\\n#{body}\", room\nend", "def write text=\"\"\n\t\t@message.text = @msg = text.to_s\n\tend", "def send_bmessage(msg, from = nil)\n msg = \"#{msg} (@#{from})\" unless from.nil?\n @auth_required ? @after_auth.push({:mb => msg}) : send_data({:mb => msg})\n end", "def alert=(message); end", "def alert=(message); end", "def send_text(command)\n @session.connection.puts(command)\n end", "def send_text\n Rails.logger.info \"Sending \\\"#{text}\\\" to #{number}...\"\n Twilio::Sms.message(TWILIO_CONFIG['caller_id'], number, text)\n end", "def secure_chat(message) \n puts \"This is a secure Chat\" \n puts message \n end", "def broadcast_msg( msg )\n\t\t@users.each do |cl|\n\t\t\tcl.add_output( msg )\n\t\tend\n\tend", "def speak_into(msg)\n require 'net/http'\n channel = \"/0001\"\n\n message = {:channel => channel, :data => msg}\n uri = URI.parse(\"http://localhost:#{FAYE_PORT}/faye\")\n begin\n Net::HTTP.post_form(uri, :message => message.to_json)\n rescue Exception => e\n $stderr.puts \"failed to send message to faye server and thus webclient\"\n $stderr.puts e.message\n return false\n end\n true\n end", "def pbMessage(message,commands=nil,cmdIfCancel=0,skin=nil,defaultCmd=0,&block)\r\n ret = 0\r\n msgwindow = pbCreateMessageWindow(nil,skin)\r\n if commands\r\n ret = pbMessageDisplay(msgwindow,message,true,\r\n proc { |msgwindow|\r\n next Kernel.pbShowCommands(msgwindow,commands,cmdIfCancel,defaultCmd,&block)\r\n },&block)\r\n else\r\n pbMessageDisplay(msgwindow,message,&block)\r\n end\r\n pbDisposeMessageWindow(msgwindow)\r\n Input.update\r\n return ret\r\nend", "def notice(message)\n system(\"echo $'\\\\e[1G-----> #{message}'\")\nend", "def wallops(message)\n send_data(\"WALLOPS :#{message}\")\n end", "def send(message)\n message\n end", "def secureChat\n puts \"This is a secure Chat\"\n puts message\n end", "def attack(msg)\n puts \"\\n\\ntrudy esta conectado y va atacar!\\n\\n\" \n msg += \"MensajeTocado!\"\n end", "def output\n\t\tif @@message_box.length < 5 \n\t\t\t(5 - @@message_box.length).times { @@message_box << \"\\n\" }\n\t\tend\n\t\tputs @@message_box[0] \n\t\tputs @@message_box[1]\n\t\tputs @@v_row.join \n\t\tputs @@message_box[2]\n\t\tputs @@message_box[3]\n\t\tputs @@message_box[4]\n\tend", "def msg(message)\n stdout.puts message\n end", "def say(message)\n IO.popen(\n \"say -v Ralph '#{message}'\"\n ) if RbConfig::CONFIG['host_os'].match(/darwin|mac os/)\n end", "def store_body_text variable_name\r\n command 'storeBodyText', variable_name\r\n end", "def broadcastMsg( msg )\n\t\t@users.each {|cl|\n\t\t\tcl.addOutput( msg )\n\t\t}\n\tend" ]
[ "0.57655805", "0.5720912", "0.5712792", "0.56096125", "0.56096125", "0.545295", "0.5438206", "0.5435702", "0.5426623", "0.5412409", "0.5395258", "0.53720206", "0.5353252", "0.5350981", "0.5300604", "0.52930784", "0.52925056", "0.5282761", "0.5280771", "0.52484435", "0.5237092", "0.52284205", "0.51946896", "0.5193214", "0.5177432", "0.51772064", "0.5171891", "0.5168038", "0.5162175", "0.5144983", "0.5143283", "0.5141356", "0.5140127", "0.5136298", "0.51334625", "0.5133049", "0.5122764", "0.5121701", "0.51197594", "0.5112115", "0.51111156", "0.51088923", "0.51088923", "0.51028943", "0.5100004", "0.5099747", "0.50977653", "0.50939894", "0.50920874", "0.50892264", "0.50877607", "0.5086139", "0.50854605", "0.5083511", "0.5080543", "0.50772995", "0.50712854", "0.50693554", "0.5066754", "0.50649446", "0.5063025", "0.50619996", "0.5057532", "0.5053972", "0.50503707", "0.5047793", "0.50443715", "0.5026608", "0.502505", "0.5023108", "0.5022321", "0.50183517", "0.50153255", "0.5013625", "0.5012772", "0.5010484", "0.5004929", "0.49990153", "0.499707", "0.49949366", "0.49884653", "0.49878266", "0.49809426", "0.49809426", "0.4977412", "0.49722677", "0.49715707", "0.49710932", "0.4970232", "0.4968232", "0.4964264", "0.49640438", "0.49613503", "0.496108", "0.4959922", "0.4956527", "0.49548078", "0.49505514", "0.49344566", "0.49324456" ]
0.8221114
0
characters when determining whether it should uppercase or lowercase each letter. The nonalphabetic characters should still be included in the return value; they just don't count when toggling the desired case.
def staggered_case(str) # moving to new string capital_letter = true new_str = '' str.each_char do |letter| if letter =~ /[^a-z]/i new_str << letter else capital_letter ? letter.upcase! : letter.downcase! new_str << letter capital_letter = !capital_letter end end new_str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letters_only(case_matters=false)\n just_letters = split('').find_all do |char| \n DUAL_CASE_ALPHABET.include?(char) \n end.join('')\n return just_letters if (case_matters)\n return just_letters.downcase\n end", "def destructive_uppercase(str)\n upcase_only = \"\"\n str.each_char do |char|\n upcase_only += char unless char.downcase == char\n end\n upcase_only\nend", "def is_uppercase?(word)\nend", "def staggered_case_not_count_non_alphabetic(string)\n need_upper = true\n string.split('').map do |char| \n if char =~ /[a-zA-z]/\n transformed_char = need_upper ? char.upcase : char.downcase\n need_upper = !need_upper\n transformed_char\n else\n char\n end\n end.join\nend", "def is_upercase?(char)\n if char==char.upcase then\n return \"true\"\n else\n return \"false\"\n end\nend", "def not_in_alphabet?(letter)\n !UPPERCASE.include?(letter) && !LOWERCASE.include?(letter)\nend", "def letters(arg)\n return tuc(arg.sub(/[eiou]/, 'a')) != \"\"\n end", "def destructive_uppercase(str)\n output_str = ''\n\n str.each_char do |char|\n if char.upcase == char\n output_str += char\n end\n end\n output_str\nend", "def destructive_uppercase(str)\n\t(str.split(\"\").select { |c| (\"a\"..\"z\").include?(c) == false } ).join\nend", "def is_lower?(c)\n return c != c.capitalize\n end", "def translate_char(char)\r\n\talphabet = \"abcdefghijklmnopqrstuvqxyz\"\r\n\thalfway = alphabet.length / 2\t# or you can type 13\r\n\tis_capitalized = (char.upcase == char)\r\n\r\n\tif alphabet.index(char.downcase) == nil # or put !alphabet.index(char.downcase)\r\n\t\t\"boing\"\r\n\telsif is_capitalized && alphabet.index(char.downcase) < halfway\r\n\t\t\"bloop\"\r\n\telsif is_capitalized || char == \"e\"\r\n\t\t\"buzz\"\t\t\t\r\n\telse\r\n\t\t\"beep\"\r\n\tend\r\nend", "def destructive_uppercase(str)\n result = \"\"\n str.each_char {|ch| result << ch if ch < \"a\"}\n result\nend", "def alt_caps(string)\n case\n when string.length > 10\n string.upcase\n else\n string\n end\nend", "def destructive_uppercase(str)\n letters = (\"a\"..\"z\").to_a\n our_str = str.chars\n x = our_str.select {|x| !letters.include?(x)}\n x.join\nend", "def upper?(char)\n char == char.upcase\nend", "def is_upcase?(char)\n downcased_char = char.downcase\n downcased_char != char\nend", "def staggered_case_decide(string, use_all_char=false)\n alt_cap = ''\n need_upper = true\n split_str = string.chars\n split_str.each do |char|\n if use_all_char\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n else\n if char =~ /[^A-z]/\n alt_cap << char\n else\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n end\n end\n end\n alt_cap\nend", "def vowels_with_case(letter)\n case letter\n when \"a\",\"e\",\"i\",\"o\",\"u\"\n return true\n else\n return false\n end\nend", "def is_capital?(char_int)\n char_int >= 65 && char_int <= 90 ? true : false\nend", "def staggered_case(string)\n iterator = 0\n characters = string.chars.map do |char|\n iterator += 1 if char =~ /[a-zA-Z]/\n #if char =~ /[a-z]/i <--LS\n if iterator.odd?\n char.upcase\n elsif iterator.even?\n char.downcase\n else\n char\n end\n end\n characters.join\nend", "def valid?(char_int)\n is_capital?(char_int) || is_lowercase?(char_int) ? true : false\nend", "def titlecase_char?(char)\n TITLECASE_LETTER_SET.include?(char.ord)\n end", "def staggered_case_include_non_alpha(string, upcase_or_downcase=\"upcase\")\n # new_array = []\n # string.chars.each_with_index do |char, index|\n # new_array[index] = index.even? ? char.upcase : char.downcase\n # end\n # new_array.join\n result = ''\n need_upper = upcase_or_downcase == \"upcase\"\n string.chars.each do |char|\n result += if need_upper\n char.upcase\n else\n char.downcase\n end\n need_upper = !need_upper\n end\n result\nend", "def letter_cases(allow_prefixed_underscores: true)\n LuckyCase.cases self, allow_prefixed_underscores: allow_prefixed_underscores\n end", "def staggered_case(str, non_alph = true) # Further Exp\n count = 0\n new_str = ''\n str.each_char do |el|\n if el =~ /[A-Za-z]/\n if count.even?\n new_str += el.upcase\n elsif count.odd?\n new_str += el.downcase\n end\n count += 1\n else\n new_str += el\n count += 1 if non_alph == true\n end\n end\n new_str\nend", "def destructive_uppercase(str)\n str.each_char {|x| str.delete!(x) if x == x.downcase}\n str\nend", "def reduce_any_uppercase(_production, _range, _tokens, _children)\n ch_range = char_range('A', 'Z')\n char_class(false, ch_range)\n end", "def letters\n self.chars.select { |c| c.match(/[a-z]/i) }.join\nend", "def capChar_with_even_ascii(input)\n input.select do |c|\n c.upcase.ord.even?\n end\n end", "def destructive_uppercase(str)\n result = \"\"\n (0...str.length).each do |idx|\n result << str[idx] if str[idx] != str[idx].downcase\n end\n result\nend", "def destructive_uppercase(str)\n str.each_char do |c|\n str.delete!(c) if c == c.downcase\n end\nend", "def isAlpha(c)\n ('A' .. 'Z').include?(c.capitalize)\nend", "def alpha(x)\n c = x.downcase\n is_alpha?(c) ? c : false\n end", "def destructive_uppercase(str)\n str.each_char do |chr|\n if chr == chr.downcase\n str.delete!(chr)\n end\n end\nend", "def LetterChanges(str)\n str = str.split(\"\")\n \n str.each do |c|\n c.next! if c =~ /[a-z]/\n c.upcase! if c =~ /[aeiou]/\n end\n \n return str.join\nend", "def downcase() end", "def LetterChanges(str)\r\n str = str.split(\"\")\r\n str.each do |x|\r\n x.next! if x =~ /[a-z]/\r\n x.upcase! if x =~ /[aeiou]/\r\n end\r\n return str.join(\"\")\r\nend", "def is_lowecase letter\n if letter == letter.downcase\n return true\n else\n return false\n end\n\nend", "def string_behavior (strings)\n\n strings.each do |str|\n if not str =~ /[A-Z]/ and str.length > 4\n puts \"long and lowercase\"\n elsif not str =~ /[A-Z]/\n puts \"lowercase\"\n elsif str.length > 4\n puts \"long\"\n\n else\n puts str\n end\n end\n end", "def solve s\n s.chars.map{|letter| letter.upcase == letter ? 'upper' : 'lower'}.count('upper') > 0.5*s.length ? s.upcase : s.downcase\nend", "def LetterChanges(str)\n filtered = \"\"\n result = \"\"\n\n str.each_char do |i|\n if /[a-yA-Y]/ =~ i\n filtered << i.next\n elsif i == \"z\"\n filtered << \"a\"\n elsif i == \"Z\"\n filtered << \"A\"\n else\n filtered << i\n end\n end\n\n filtered.each_char do |i|\n if /[aeiou]/ =~ i\n result << i.upcase\n else\n result << i\n end\n end\n\n result\nend", "def do_magic(str)\n str.gsub!(/[^A-Z]/, '').to_s #delete small leters and uprinted sumbols\n str.downcase.to_s #make all leters small\nend", "def isLetter(c) \n /[A-Za-z]/ =~ c\n #return ((?a <= c and c <= ?z) or (?A <= c and c <= ?Z))\n end", "def translate_char(char)\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\" # list of possible characters\n\thalfway = alphabet.length/2 \n\tis_capitalized = (char.upcase == char) # checks if character has already been capitalized or not\n\tif alphabet.index(char.downcase) == nil # if character is a letter at all\n\t\t\"boing\"\n\telsif is_capitalized && alphabet.index(char.downcase) < halfway # checks if letter is capitalized and in first half of alphabet\n\t\t\"bloop\"\n\telsif is_capitalized || char == \"e\" # checks if letter is capitalized or \"e\"\n\t\t\"buzz\"\n\telse\n\t\t\"beep\"\n\tend\n\nend", "def downcase; end", "def conditional_allcaps(input_str)\n if input_str.length > 10\n input_str.upcase\n else\n input_str\n end\nend", "def is_upper? str; str == str.upcase; end", "def is_upper?(c)\n return c == c.capitalize\n end", "def uppercase_char?(char)\n PROP_UPPERCASE_SET.include?(char.ord)\n end", "def weirdcase(str)\n is_upcase = false\n new_str = ''\n str.chars.each do |ch|\n if is_upcase\n new_str += ch.upcase\n else\n new_str += ch.downcase\n end\n is_upcase = !is_upcase\n end\n new_str\nend", "def translate_char(char)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n halfway = alphabet.length / 2\n is_capitalized = (char.upcase == char)\n index_of_char = alphabet.index(char.downcase)\n\n if !index_of_char\n \"boing\"\n elsif is_capitalized && index_of_char < halfway\n \"bloop\"\n elsif is_capitalized || char == \"e\"\n \"buzz\"\n else\n \"beep\"\n end\nend", "def is_upper(letter)\n letter == letter.upcase\nend", "def conditional_caps(phrase)\n if phrase.length > 10\n phrase.upcase\n else \n phrase\n end\nend", "def downcase!() end", "def destructive_uppercase(str)\n my_str = \"\"\n str.chars{|ch| my_str += ch if ch.upcase == ch}\n my_str\nend", "def mostly_uppercase?(statement)\n upper, lower = statement.scan(/[[:alpha:]]/).partition {|x| x.upcase == x}\n ratio = upper.length.to_f / lower.length.to_f\n ratio > SHOUTING_THRESHOLD\n end", "def is_upper?(character)\n /[[:upper:]]/.match(character) ? true : false\nend", "def is_lower?\n r = 'a'..'z'\n self.split('').keep_if{ |c| r.include?(c) }.count == self.length\n end", "def isAlpha(char)\n alph = \"abcdefghijklmnopqrstuvwxyz\"\n for ch in (0..alph.length - 1)\n\tif ((char.to_s.downcase <=> alph[ch]) == 0)\n\t return true\n\tend\n end\n return false\nend", "def destructive_uppercase(str)\n new_string = str.chars.select {|el| el == el.upcase}\n new_string.join(\"\")\nend", "def proper(word)\n /[[:upper:]]/.match(word) != nil\n end", "def translate_char(char)\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\thalfway = alphabet.length / 2\n\tis_capitalized = (char.upcase == char)\n\t\n\tif alphabet.index(char.downcase) == nil\n\t\t\"boing\"\n\telsif \n\t\tis_capitalized && alphabet.index(char.downcase) < halfway\n\t\t\"bloop\"\n\telsif \n\t\tis_capitalized || char == \"e\"\n\t\t\"buzz\"\n\telse \n\t\t\"beep\" \n\tend \nend", "def translate_char(char)\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\thalfway = alphabet.length / 2\n\tis_capitalized = (char.upcase == char)\n\tindex_of_char = alphabet.index(char.downcase)\n\n\t#if !alphabet.index(char.downcase)\n\tif !index_of_char\n\t\t\"boing\"\n\t#elsif is_capitalized && alphabet.index(char.downcase) < halfway\n\telsif is_capitalized && index_of_char < halfway\n\t\t\"bloop\"\n\telsif is_capitalized || char == \"e\"\n\t\t\"buzz\"\n\telse\n\t\t\"beep\"\n\tend\nend", "def screaming?\n upcase == self && self =~ /[A-Z]/\n end", "def vowels_with_no_if_or_case(letter)\n while vowels.include? letter \n # alternatively, use a text string of potential vowel options\n return true\n end\n return false\nend", "def translate_char(char)\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\thalfway = alphabet.length / 2\n\tis_capitalized = (char.upcase == char)\n\n\tif !alphabet.index(char.downcase)\n\t\t\"boing\"\n\telsif is_capitalized && alphabet.index(char.downcase) < halfway\n\t\t\"bloop\"\n\telsif is_capitalized || char == \"e\" \n\t\t\"buzz\"\n\telse\n\t\t\"beep\"\n\tend\nend", "def staggered_case(str)\narray = str.split(\"\")\nneed_upper = true\nresult = []\narray.each do |char|\n if char.match(/[a-zA-Z]/) && need_upper == true\n result.push(char.upcase)\n need_upper = !need_upper\n elsif char.match(/[a-zA-Z]/)\n result.push(char.downcase)\n need_upper = !need_upper\n else result.push(char) \n end\n \nend\nresult.join(\"\")\nend", "def all_caps(string)\n\tif string.length > 10\n\t return string.upcase!\n \telse\n \t return string\n \tend\nend", "def reduce_any_lowercase(_production, _range, _tokens, _children)\n ch_range = char_range('a', 'z')\n char_class(false, ch_range)\n end", "def staggered_case(str)\n alt_cap = ''\n need_upper = true\n split_str = str.chars\n split_str.each do |char|\n if char =~ /[^A-z]/\n alt_cap << char\n else\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n end\n end\n alt_cap\nend", "def charIsAlpha\n c = getChar\n return ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))\n end", "def alphabetical?(str)\r\n ('A'..'Z').to_a.include? str.upcase\r\nend", "def isLower(char)\n alph = \"abcdefghijklmnopqrstuvwxyz\"\n if isAlpha(char)\n\tif (char <=> char.downcase) == 0\n\t return true\n\tend\n end\n return false\nend", "def detect_capital_use(word)\n var1 = word.upcase\n var2 = word.downcase\n var3 = word.capitalize\n return true if word == var1\n return true if word == var2\n return true if word == var3\n false\nend", "def verify_lowercase(password)\n lowercase_letters = ('a'..'z')\n lowercase = false\n password.split(\"\").each do |letter|\n if lowercase_letters.include?(letter)\n lowercase = true\n end\n end\n return lowercase\nend", "def uppercase_alt?(str)\n str == str.upcase\nend", "def missing_letter(word)\n # your code goes here\n alpha = ('a'..'z').to_a\n index = alpha.index word.first.downcase\n word.each do |letter|\n if letter.downcase != alpha[index]\n alpha[index] < letter ? (return alpha[index]) : (return alpha[index].upcase)\n end\n index +=1\n end\n\nend", "def vowels_2(letter)\n case letter.downcase\n when \"a\" then true\n when \"e\" then true\n when \"i\" then true\n when \"o\" then true\n when \"u\" then true\n else false\n end\nend", "def is_upper_case?\n self == self.upcase ? 'true' : 'false'\n end", "def all_caps(word)\n if word.length >= 10\n return word.upcase\n end\n word\nend", "def test_3_rejects_all_upper_case_passwords\n result = at_least_one_downcase?(\"1abjils&a\")\n assert(result, \"'1abjils&a' should be invalid because it contains no upcase\")\n #assert(result == false, \".same message as above\")\n end", "def staggered_case(string, ignore_non_alphabetic = true)\n result = ''\n need_upper = true\n string.chars.each do |char|\n if char =~ /[a-zA-Z]/ || !ignore_non_alphabetic\n if need_upper\n result << char.upcase\n else\n result << char.downcase\n end\n need_upper = !need_upper \n else\n result << char\n end\n end\n result\nend", "def is_upper_case?\n self == self.upcase ? 'True' : 'False'\n end", "def weirdcase(str)\n result = \"\"\n str.downcase.each_char.with_index do |char, i|\n i.even? ? result += char.downcase : result += char.upcase\n end\n result\nend", "def is_capitalized?(word)\n return true if word == word.upcase\n return false\n end", "def cap_all_characters(input)\n input.map do |c|\n c.upcase\n end\nend", "def destructive_uppercase(str)\r\n # your code goes here\r\n temp = \"\"\r\n i = 0\r\n while i < str.length\r\n if str[i].upcase.include?(str[i]) == false\r\n temp << str[i]\r\n end\r\n i += 1\r\n end\r\n temp\r\nend", "def verify_capital(password)\n capital = false\n uppercase_letters = ('A'..'Z')\n password.split(\"\").each do |letter|\n if uppercase_letters.include?(letter)\n capital = true\n end\n end\n return capital\nend", "def uppercase3?(string)\n #p string.scan(/[a-z]/i)\n !string.scan(/[A-Z]/).empty? && string.scan(/[A-Z]/) == string.scan(/[a-z]/i)\nend", "def letter_case_count(str)\n h = { lowercase: 0, uppercase: 0, neither: 0 }\n str.each_char do |c|\n if c.between?('a', 'z')\n # if char =~ /[a-z]/\n h[:lowercase] += 1\n elsif c.between?('A', 'Z')\n # elsif char =~ /[A-Z]/\n h[:uppercase] += 1\n else\n h[:neither] += 1\n end\n end\n h\nend", "def get_case(str)\n return 'upper' if str.upcase == str\n return 'lower' if str.downcase == str\n 'mixed'\nend", "def staggered_case(string)\n result = ''\n need_upper = true\n string.chars.each do |char|\n if need_upper && char =~ /[a-zA-Z]/\n result += char.upcase\n need_upper = !need_upper\n elsif !need_upper && char =~ /[a-zA-Z]/\n result += char.downcase\n need_upper = !need_upper\n else\n result += char\n end\n end\n result\nend", "def uppercase?(str)\n str.each_char do |char|\n return false if char != char.upcase\n end\n true\nend", "def case_insensitive(input)\n return 1 unless input\n\n input.split(\"\").each do |i|\n return 0 if /[[:upper:]]/ =~ i\n end\n\n return 1\n end", "def letter_changes(str)\n str.each_char.with_index do |char, idx|\n if char =~ /[A-Za-z]/\n if char =~ /[Zz]/\n str[idx] = 'a'\n else\n str[idx] = (char.ord + 1).chr\n end\n end\n end\n str.each_char.with_index do |char, idx|\n str[idx] = char.upcase if char =~ /[aeiou]/\n end\n str\nend", "def weirdcase(str)\n result = \"\"\n str.chars.each_with_index do |ch, i|\n result += i.odd? ? ch.upcase : ch.downcase\n end\n result\nend", "def staggered_case_opt(string, ignore_non_alpha: true)\n process = true\n\n result = string.chars.map do |char|\n if ignore_non_alpha && char =~ /[a-z]/i\n process ? char.upcase! : char.downcase!\n process = !process\n elsif !ignore_non_alpha\n process ? char.upcase! : char.downcase!\n process = !process\n end\n char\n end\n\n result.join\nend", "def contains_only_capital_letters\n if ! Configs.get_config('allow_capitalssubj').to_bool && ! (self.title =~ /^([0-9\\32-\\64\\[\\]\\/\\^\\_\\`\\{\\}\\|\\~]*[\\75-\\77]*[A-Z]+[0-9\\32-\\64\\[\\]\\/\\^\\_\\`\\{\\}\\|\\~]*)+$/).nil?\n self.errors.add('title', I18n.t(:cap_letters))\n end\n end", "def weirdcase(str)\n new_str = \"\"\n str.chars.each_with_index do |c, i|\n if i%2==0 #reverse because odd characters have even indices\n new_str += c.downcase\n else\n new_str += c.upcase\n end\n end\n return new_str\nend", "def letter_case_count(str)\n lowercase_str = 'a-z'\n uppercase_str = 'A-Z'\n neither_str = '^A-Za-z'\n\n lowercase_count = str.count(lowercase_str)\n uppercase_count = str.count(uppercase_str)\n neither_count = str.count(neither_str)\n\n puts \"{ lowercase: #{lowercase_count}, uppercase: #{uppercase_count}, neither: #{neither_count} }\"\nend" ]
[ "0.7205663", "0.70656484", "0.7018733", "0.6968633", "0.6950401", "0.6932238", "0.68766975", "0.6848055", "0.67992973", "0.6795128", "0.6786035", "0.6773397", "0.6771247", "0.676461", "0.67575693", "0.6754278", "0.67424095", "0.67363924", "0.668742", "0.66725236", "0.6662644", "0.66336745", "0.66272753", "0.6619459", "0.6614431", "0.6609847", "0.66077197", "0.6601904", "0.6578802", "0.6566053", "0.65322167", "0.65262854", "0.65145975", "0.6513383", "0.65074366", "0.64979583", "0.64933646", "0.64930093", "0.64921737", "0.64916563", "0.6483477", "0.64794785", "0.6476385", "0.64694506", "0.6464151", "0.6464126", "0.6456299", "0.6452892", "0.64488935", "0.6427706", "0.64265513", "0.6424818", "0.6418361", "0.64082575", "0.640622", "0.6404286", "0.6401868", "0.639486", "0.6388634", "0.63883096", "0.63855743", "0.6368117", "0.6366888", "0.6348482", "0.6347139", "0.634628", "0.63371193", "0.6318026", "0.63144994", "0.63082594", "0.6296339", "0.62912625", "0.62695146", "0.62692684", "0.62689507", "0.62663513", "0.6265314", "0.62578356", "0.62510103", "0.6248316", "0.6247046", "0.6244118", "0.62405604", "0.62354296", "0.62336755", "0.6232657", "0.622979", "0.62256664", "0.62249994", "0.6223077", "0.6204822", "0.6203169", "0.6198839", "0.6198516", "0.61930346", "0.6190812", "0.618673", "0.6183483", "0.6179467", "0.6177061" ]
0.6355261
63
Override answered? to ensure last answer was not the user resetting the selection to the default unselected state.
def answered? if answers.length == 0 return false end if answers.last.rationale_choices.size > 0 # # The last answer is a list containing only one item, and it # does not contain a key for :choice_id. This is the answer we # generated in the case of unselecting a previous selection. # I.e. user is resetting to the default unselected state. # {:answer=>"not answered"} # return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_yes_no_question\n answer = %w[Yes No].sample\n @user.session[:last_answer] = answer\n say answer\n end", "def selected?; false; end", "def selected?; false; end", "def touch_multi_choice_answer\n touch if question_type == \"MultiChoiceQuestion\"\n end", "def answered?\n return @answered\n end", "def set_incorrect_answer\r\n set_question_and_answer\r\n @answer.correct = 0\r\n save_answer_and_render\r\n end", "def selected?; end", "def selected?; end", "def question_asked\n redirect_to game_question_url unless question?\n end", "def update_choice_skip\n return false\n end", "def answered?\n !(%w(answered) & flags).empty?\n end", "def set_correct_answer\r\n set_question_and_answer\r\n @answer.correct = 1\r\n save_answer_and_render\r\n end", "def for_new_question\n @for_new_question ||= false\n end", "def concluded?\n state == :answered || state == :canceled\n end", "def correct?\n @correct ||= (answer == correct_answer)\n end", "def correct_answer\n @correct_answer ||= question.correct\n end", "def unanswered\n answers.blank?\n end", "def pending_answer?\r\n\t\t\treturn (@type == 'answer' && @state == 're')\r\n\t\tend", "def check_answer(answer)\n # if answer == self.select(:answer)\n if answer == self.answer\n return true\n else\n return false\n end\n end", "def answered?\n !answered_at.nil?\n end", "def prevQuestion()\n return if $intQuestionOnScreen == 0 || $intQuestionOnScreen == 1\n $btnNext.state = 'enabled'\n $intQuestionOnScreen -= 1\n if $intQuestionOnScreen == 1\n $btnPrev.state = 'disabled'\n end\n destroyChoicesOnScreen()\n resetAnswerLabelColors()\n printQuestionOnScreen()\n printAnswersOnScreen()\n printChoicesOnScreen()\n printUsersChoiceOnScreen()\nend", "def answer_choice\n most_recent_answer = question_stats.selections.order('question_stats.created_at DESC').limit(1).first\n\n # unanswered question, default to 0\n return false if most_recent_answer.blank?\n\n # chose combo, so choose the combo\n if most_recent_answer.combo?\n return 'Combo' if most_recent_answer.selected?\n return false # the person did not select anything so return 0\n end\n\n # choose good, so must find the bundle the user selected\n if most_recent_answer.good?\n last_time_chose_combo = question_stats.combo.order('question_stats.created_at DESC').limit(1).first\n\n # only look at goods chosen after the last time a combo was chosen\n candidates = if last_time_chose_combo.blank?\n question_stats.good.order('question_stats.created_at DESC')\n else\n question_stats.good.created_after(last_time_chose_combo.created_at).order('question_stats.created_at DESC')\n end\n\n # find value of the last time each good was selected (but not necessarily true)\n selected_goods = {}\n candidates.each do |candidate|\n selected_good = candidate.good_number\n if selected_goods[selected_good].blank?\n selected_goods[selected_good] = candidate\n end\n end\n\n # the actual goods that were selected and whose values are true\n chosen_good_numbers = []\n selected_goods.each do |k,v|\n chosen_good_numbers.push(k) if v.selected?\n end\n\n return false if chosen_good_numbers.empty?\n return chosen_good_numbers.sort\n end\n\n # should never be reached, sanity check\n raise Exception.new('Something went wrong with this method, fix it')\n end", "def first_answer?( )\n not @first_answer.nil?\n end", "def set_selected_answer\n @selected_answer = SelectedAnswer.find(params[:id])\n end", "def user_answered?(question_idurl, choice_idurl, value_answered)\n raise \"wrong answered value=#{value_answered}\" unless [\"ok\", \"ko\"].include?(value_answered)\n recorded_answer = user_last_answer(question_idurl, :last)\n recorded_answer.get_answer_code_for(choice_idurl) == value_answered if recorded_answer\n end", "def selected?\n @selected\n end", "def first_answer( )\n @first_answer\n ensure\n @first_answer = nil\n end", "def selected?\n return @selected\n end", "def clear_answer\n \t\tself.answer = nil\n \tend", "def has_correct_choice\n if !quiz_question_choices.any? { |choice| choice.iscorrect }\n errors.add :correct_choice, 'Please select a correct answer for all questions'\n end\n end", "def true_false_answer(answer)\n answer.upcase=~/t/i ? index = 0 : index = 1\n frm.radio(:name=>/deliverTrueFalse/, :index=>index).set\n end", "def answered\n @user = current_user\n return false unless @user\n @answer = Answer.find(:first, :conditions => {:user_id => @user.id, \n :letter_id => self.id})\n return false unless @answer\n return @answer.answered\n end", "def accepted_answer?(answer)\n answer.id == answer.question.accepted_answer_id\n end", "def answer_correct?(answer)\n @correct_answer == answer\n end", "def will_answer?\n return true\n end", "def answered?\n !(%w(answered) & flags).empty?\n end", "def select_prev_answer(amount = 1)\n if current_db_value <= 0\n # failed/no choice → no choice\n self.current_db_value = 0\n else # n-th box\n index = current_boxes.find_index { |b| b.choice == current_db_value }\n # don't go out of bounds\n new_index = Math.max(index - amount, -1)\n if new_index >=0\n self.current_db_value = current_boxes[new_index].choice\n else\n # first box → nochoice\n self.current_db_value = 0\n end\n end\n end", "def answer?\n return @answer\n end", "def mark_correct\n self.update_attribute(:option_id, self.question.options.where(correct: true).first.id)\n end", "def switch_best\n Answer.transaction do\n self.question.answers.best.update_all(best: false) unless self.best?\n self.update!(best: !best)\n end \n end", "def reset_answers\n\tputs \"Would you like to clear all user input answers? Type 'yes' or 'no'.\"\n\twhile true\n\t\treset = gets.strip.downcase\n\t\tif reset == \"yes\"\n\t\t\t@questions[:misc].delete_if { |item| item.include?(\"USERANSWER\")}\n\t\t\tputs \"Success! All answers are factory fresh!\"\n\t\t\tputs \"Let's get back to asking questions!\"\n\t\t\tinput_eval\n\t\telsif reset == \"no\"\n\t\t\tputs \"Your answers are still there!\"\n\t\t\tinput_eval\n\t\telse\n\t\t\tputs \"I didn't quite catch that. Type 'yes' or 'no'.\"\n\t\tend\n\tend\nend", "def answered?\n return false if question.blank?\n # If the question is option based then see if any options were selected\n return question_options.any? if question.question_format.option_based?\n # Strip out any white space and see if the text is empty\n return text.gsub(%r{</?p>}, '').gsub(%r{<br\\s?/?>}, '').chomp.present? if text.present?\n\n false\n end", "def no_answer?\n return true if @no_answer.nil?\n @no_answer\n end", "def ask_again\n\n end", "def unanswered\n request('unanswered')\n end", "def answer_exists\n redirect_to game_question_url unless current_answers.include?(params[:answer])\n end", "def set_asked_to_answer\n @asked_to_answer = AskedToAnswer.find(params[:id])\n end", "def ask_yes_no(question, default = nil)\n ui.ask_yes_no question, default\n end", "def nextQuestion()\n return if $intQuestionOnScreen == 0 || $intQuestionOnScreen == $intTotalQuestions\n $intQuestionOnScreen += 1\n if $intQuestionOnScreen == $intTotalQuestions\n $btnNext.state = 'disabled'\n end\n destroyChoicesOnScreen()\n resetAnswerLabelColors()\n printQuestionOnScreen()\n printAnswersOnScreen()\n printChoicesOnScreen()\n printUsersChoiceOnScreen()\n $btnPrev.state = 'enabled'\nend", "def ungraded_answers(submission)\n submission.reload.current_answers.select { |a| a.attempting? || a.submitted? }\n end", "def solved?\n !!self.answers.select {|x| x.correct}[0]\n end", "def refresh_question?\n question_responses >= refresh_question_after\n end", "def has_selected?\n selected?\n end", "def greet_and_selection\r\n @view.greeting\r\n exit = true\r\n while exit\r\n user_selection = @view.selection\r\n if(user_selection != 1 && user_selection != 2)\r\n @view.wrong_answer\r\n else\r\n exit = false\r\n end\r\n end\r\n return user_selection\r\n end", "def update_choice_skip\n unless @wait_input\n terminate_message\n return true\n end\n return false\n end", "def answer\n if answered?\n answers.last.answer\n else\n [{:answer => \"not answered\"}]\n end\n end", "def answer_present\n if self.question.qtype == 'one_response' && self.response_id.nil?\n errors.add(:base, 'Please fill in an answer before leaving this page.' )\n return false\n elsif self.question.qtype == 'likert_scale' && self.response_id.nil?\n errors.add(:base, 'Please fill in an answer before leaving this page.' )\n return false\n\n elsif self.question.qtype == 'rank_three' \n responses = self.multianswers.map( &:rank ).compact\n if responses.length == 3 \n array_wanted = [1, 2, 3]\n if array_wanted == responses.sort\n return true\n else \n errors.add(:base, 'Please ensure all items are unique.' )\n return false\n end \n else \n errors.add(:base, 'Please ensure 3 items are ranked.' )\n return false\n end\n\n elsif self.question.qtype == 'rank_five' \n responses = self.multianswers.map( &:rank ).compact\n if responses.length == 5 \n array_wanted = [1, 2, 3, 4, 5]\n if array_wanted == responses.sort\n return true\n else \n errors.add(:base, 'Please ensure all items are unique.' )\n return false\n end \n else \n errors.add(:base, 'Please ensure 5 items are ranked.' )\n return false\n end\n end\n end", "def is_correct?(answer)\r\n self.answer.to_s == answer\r\n end", "def wrong_answer\n @score -= 1\n end", "def selected\n !self.new_record?\n end", "def mark_choice_as_active\n next_active = @choices[@input.to_i - 1]\n\n if next_active && next_active.disabled?\n # noop\n elsif (@input.to_i > 0) && next_active\n @active = @input.to_i\n else\n @active = @default\n end\n @page_active = @active\n end", "def answer\n @choices[@active - 1].value\n end", "def ocare_child_previously_collected_and_equals_one?(question)\n answer_for(question, ocare_child_response_is_one?)\n end", "def no_choice_skill?\n return TargetNoAsk.include?(target)\n end", "def questionGradable (question)\n return true if question.input.is_a? org.concord.otrunk.ui.OTChoice and question.correctAnswer \nend", "def questionGradable (question)\n return true if question.input.is_a? org.concord.otrunk.ui.OTChoice and question.correctAnswer \nend", "def grade_answer(answer)\n raise ArgumentError if answer.changed?\n\n answer.auto_grade!(reduce_priority: true)\n # Catch errors if answer is in attempting state, caused by a race condition where\n # a new attempting answer is created while the submission is finalised, but before the\n # autograding job is executed.\n rescue IllegalStateError\n answer.finalise!\n answer.save!\n answer.auto_grade!(reduce_priority: true)\n end", "def selected\r\n assert_exists\r\n #@option.selected\r\n option_selected\r\n end", "def ask\n\t\tbegin\n\t\t\tputs self\n\t\t\tprint \"Su respuesta: \" \n\t\t\tanswerno = gets.to_i - 1\n\t\tend while (answerno < 0 or answerno >= @answers.length)\n\t\t#Comprobamos si es correcta la respuesta\n\t\t@answers[answerno].is_right? \n\tend", "def confirm_without_exit(question, append_instructions = true, default_choice = nil)\n return true if config[:yes]\n\n stdout.print question\n stdout.print confirmation_instructions(default_choice) if append_instructions\n\n answer = stdin.readline\n answer.chomp!\n\n case answer\n when \"Y\", \"y\"\n true\n when \"N\", \"n\"\n msg(\"You said no, so I'm done here.\")\n false\n when \"\"\n unless default_choice.nil?\n default_choice\n else\n msg(\"I have no idea what to do with '#{answer}'\")\n msg(\"Just say Y or N, please.\")\n confirm_without_exit(question, append_instructions, default_choice)\n end\n else\n msg(\"I have no idea what to do with '#{answer}'\")\n msg(\"Just say Y or N, please.\")\n confirm_without_exit(question, append_instructions, default_choice)\n end\n end", "def select_intended\n select intended\n end", "def select_intended\n select intended\n end", "def correct_mcq(correct_choice_id, wrong_choice_id = nil, value = 1.0)\n if correct_choice_id.nil? || !correct_choice_id.is_a?(Integer)\n puts \"Invalid Choice ID\"\n return false\n end\n \n exercise_version_id = self.id\n correct_choice = Choice.find(correct_choice_id)\n wrong_choice = nil \n if wrong_choice_id.nil?\n all_choices = Choice.where(multiple_choice_prompt: correct_choice.multiple_choice_prompt)\n all_choices.each do |c|\n wrong_choice = c if c.value == 1.0 \n end\n binding.pry\n end \n wrong_choice ||= wrong_choice_id ? Choice.find(wrong_choice_id) : nil \n \n if correct_choice.multiple_choice_prompt_id != wrong_choice.multiple_choice_prompt_id\n puts \"Choices are not from the same question\"\n return false\n end\n correct_choice.reset_value(value)\n wrong_choice.reset_value(0.0) if wrong_choice\n \n attempts.each do |attempt|\n delta = 0.0\n if correct_choice_id == attempt.prompt_answers[0].specific.choices[0].id && attempt.score <= 0.0\n delta = value\n elsif wrong_choice && wrong_choice.id == attempt.prompt_answers[0].specific.choices[0].id && attempt.score > 0.0\n delta = -1.0 * value\n end\n binding.pry\n puts attempt.id,\"\\n DELTA: \\n\", delta\n if attempt.workout_score\n multiplier = ExerciseWorkout.find_by(exercise: exercise, workout: attempt.workout_score.workout).points\n if attempt.active_score\n attempt.active_score.rescore(delta * multiplier)\n end\n else\n multiplier = 10.0\n end\n attempt.rescore(delta * multiplier)\n end\n return true\n end", "def grade\n @question = self.question\n #only grade if they've responded\n if self.responded == true\n self.correct = (response == self.question.solution) \n self.blank = self.response == nil\n end\n self.save\n end", "def checked?; end", "def reset_branching_when_changed\n if self.branch_question_id_changed?\n old_branch_question = QuizQuestion.find(self.branch_question_id_was)\n old_branch_question.quiz_answers.each do |answer|\n answer.update_attributes(:next_quiz_phase_id => nil)\n end\n end\n rescue Exception => exc\n puts \"Error in resetting next_quiz_phase---> #{exc}\"\n return true\n end", "def all_correct_answers\n self.all_answered_options.select{|answer| answer.correct}\n end", "def selected; end", "def answered?\n !body.blank?\n end", "def validate_event_complete(_options = {})\n # 0: user has never saved this thus when baptized_at_home_parish will not show yes or no as selected\n # 1: user has saved a selection for baptized_at_home_parish\n # if baptized_at_home_parish == true then done\n # if baptized_at_home_parish == false then baptized_catholic will not show yes or no as selected\n # 2: User has chosen baptized_catholic(true or false)\n case show_empty_radio\n when 0\n errors.add(:base, I18n.t('messages.error.baptized_should_be_checked', home_parish: Visitor.home_parish))\n false\n when 1\n basic_valid = validate_basic_info\n church_info = validate_other_church_info\n return basic_valid && church_info if baptized_at_home_parish\n\n errors.add(:base, I18n.t('messages.error.baptized_catholic_should_be_checked'))\n\n false\n when 2\n basic_valid = validate_basic_info\n church_info = validate_other_church_info\n\n if baptized_catholic\n church_info && basic_valid\n else\n validate_profession_of_faith && church_info && basic_valid\n end\n else\n raise(I18n.t('messages.error.unknown_show_empty_radio', show_empty_radio: show_empty_radio))\n end\n end", "def update_answers\n last_user_answers.each do |lua|\n lua.correct= (lua.response.to_f == self.response.to_f)\n lua.save!\n end\n end", "def choice?\r\n @choices.size > 0\r\n end", "def ask?\n !bid?\n end", "def ask?\n !bid?\n end", "def set_defaults\n self.completed ||= false\n end", "def correct_guess?(letter)\n if @word_selected.include?(letter)\n if @correct_guesses.empty?\n @correct_guesses << letter\n elsif @correct_guesses.include?(letter)\n puts 'Letter already guessed! try another one!'\n else\n @correct_guesses << letter\n end\n return true\n end\n false\n end", "def questionCorrect (question)\n return nil unless question.correctAnswer\n\n return nil if question.input.is_a? org.concord.otrunk.ui.OTText\n\n if question.input.is_a? org.concord.otrunk.ui.OTChoice\n if question.input.currentChoice == nil\n return nil\n else\n\t return question.correctAnswer == question.input.currentChoice\n end\n end\nend", "def update_choice\n if @contents_showing\n return (terminate_message || true) if stop_message_process?\n @choice_window.update if @choice_window\n # If there's no choice\n if $game_temp.choice_max <= 0\n return true if update_choice_skip\n self.pause = true\n if Input.trigger?(:A) or (Mouse.trigger?(:left) and simple_mouse_in?)\n $game_system.se_play($data_system.cursor_se)\n terminate_message\n elsif update_choice_auto_skip || panel_skip?\n terminate_message\n end\n else\n # Cancelation\n if $game_temp.choice_cancel_type > 0 and Input.trigger?(:B)\n $game_system.se_play($data_system.cancel_se)\n $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)\n terminate_message\n # Validation\n elsif @choice_window.validated?\n $game_system.se_play($data_system.decision_se)\n $game_temp.choice_proc.call(@choice_window.index)\n terminate_message\n end\n end\n return true\n end\n return false\n end", "def compare_answer\n\n if @question.answer == @user_answer \n return true\n end\n\n # return false if incorrect\n false\n\n end", "def correct?\n @correct || false\n end", "def completed?\n if self.completed == true\n true\n end\n\n if( self.user_quiz_answers.count == self.quiz.quiz_phases.collect{ |p| p.quiz_questions }.size )\n self.completed = true\n true\n else\n false\n end\n end", "def revealed?\n @revealed\n end", "def ask(question)\n session[:question_id] = question.id\n session[:correct_answer] = question.answer_correct\n session[:current_answers] = [@question.answer_correct, @question.answer_wrong_1, @question.answer_wrong_2, @question.answer_wrong_3].shuffle\n end", "def last_unanswered_questionnaire\r\n last_unanswered = unanswered_questionnaires.last rescue nil\r\n the_very_last = Questionnaire.by_language_published(I18n.locale).last\r\n last_unanswered == the_very_last ? last_unanswered : nil\r\n end", "def right_answer\n \t\tif !(answer.downcase == $answer.downcase) && \n !(answer.downcase == $word_answer.downcase)\n \t\t\terrors.add(:answer, \"\")\n \t\tend\n \tend", "def friendPickerDoneButtonWasPressed( sender )\n\n\t\tself.navigationController.popViewControllerAnimated( true )\n\n\t\tif @friendPickerController.selection.count == 0 \n\t\t message = \"<No Friends Selected>\"\n\t\telse\n\t\t # we pick up the users from the selection, and create a string that we use to update the text view\n\t\t # at the bottom of the display; note that self.selection is a property inherited from our base class\n\t\t text = ''\n\t\t for user in @friendPickerController.selection\n\t\t if text.length > 1\n\t\t text.appendString( \", \" )\n\t\t end\n\n\t\t text.appendString( user[ :name ] )\n\t\t end\n\n\t\t message = text\n\t end\n\t \n\t UIAlertView.alloc.initWithTitle( \n\t\t\t\"You Picked:\",\n\t\t\tmessage: message,\n\t\t\tdelegate: nil,\n\t\t\tcancelButtonTitle: \"OK\",\n\t\t\totherButtonTitles: nil).show()\n\tend", "def view_completed_question\n nil\n end", "def view_completed_question\n nil\n end", "def past_answers(answers_to_load)\n answers.\n unscope(:order).\n order(created_at: :desc).\n where('workflow_state != ? '\\\n 'OR (workflow_state = ? AND current_answer IS false)', 'attempting', 'attempting').\n first(answers_to_load)\n end", "def has_dob_been_previously_collected?(question)\n ri = false\n if person.person_dob_date\n ri = true\n elsif most_recent_response = person.responses_for(\"PARTICIPANT_VERIF.PERSON_DOB\").last\n ri = true unless %w(neg_1 neg_2).include?(most_recent_response.try(:answer).try(:reference_identifier).to_s)\n elsif person.person_dob_date.nil?\n ri = false\n end\n answer_for(question, ri)\n end" ]
[ "0.61158395", "0.6039257", "0.6039257", "0.58651316", "0.58648473", "0.58588004", "0.58179134", "0.58179134", "0.5811476", "0.5802728", "0.5781643", "0.57788855", "0.5752496", "0.5738389", "0.57280004", "0.5725222", "0.57241035", "0.5646508", "0.56231046", "0.55913544", "0.5565846", "0.5552805", "0.5547517", "0.55250597", "0.55235595", "0.5516002", "0.5451504", "0.54304135", "0.5424217", "0.5383831", "0.53417546", "0.53415805", "0.5330202", "0.53260577", "0.532503", "0.5310214", "0.5302429", "0.52899766", "0.5242765", "0.5240796", "0.5231392", "0.5231005", "0.5203435", "0.51996124", "0.51976913", "0.5197627", "0.5191307", "0.5181474", "0.51742435", "0.5166913", "0.5164765", "0.5163774", "0.5137502", "0.51278406", "0.5118245", "0.51027596", "0.50873107", "0.5066948", "0.5063485", "0.5052302", "0.5050166", "0.5046529", "0.50376797", "0.5037065", "0.5024085", "0.5024085", "0.502066", "0.5009379", "0.5007112", "0.50046605", "0.4999792", "0.4999792", "0.49861166", "0.49785087", "0.49768367", "0.497096", "0.49699256", "0.49675044", "0.49628374", "0.49492463", "0.49453506", "0.49447832", "0.49441966", "0.49441966", "0.49435103", "0.4939121", "0.49376997", "0.49332237", "0.49326336", "0.49262777", "0.4920826", "0.49204344", "0.49187616", "0.49150887", "0.49060133", "0.49056697", "0.49055368", "0.49055368", "0.49049747", "0.48971516" ]
0.7103728
0
TODO: We shouldn't need to special case this. But we do. We should use saveable.rbanswer, but because we are sending an array of answers, it doesn't work.
def answer if answered? answers.last.answer else [{:answer => "not answered"}] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end", "def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end", "def evaluate_answers\n self.answers.each do |a|\n q = a.question\n a.correct = (a.answer_mask == q.answer_mask)\n a.save(:validate=>false)\n end\n end", "def answers\n request('answers')\n end", "def generate_answers\n raise \"This should be handled by subclasses!\"\n end", "def answers\n @answers ||= {}\n end", "def answers=(value)\n @answers = value\n end", "def answer_question(i, answer)\n @answers[i] = answer\n end", "def answer(ans_body,by_who)\n @answer = Answer.new\n @answer.ask_id = self.id\n @answer.user_id = by_who.id\n @answer.body = ans_body\n [@answer.save,@answer]\n end", "def answers\n @answers ||= generate_answers\n end", "def answers\n [answer_1, answer_2]\n end", "def get_answers\n @answers\n end", "def answer\n\t\tanswer = MultipleChoiceAnswer.find(params[:mcid])\n\t\tquestionjson = answer.multiple_choice_question.audience.broadcast\n\t\t#make below JSON the broadcat once broadcast sets\n\t\tif answer.multiple_choice_question.audience.isBroadcasting(answer.multiple_choice_question)\n\t\t\t#save answer\n\t\t\trender :text => 'save'\n\t\telse\n\t\t\trender :text => 'error'\n\t\tend\n\tend", "def update_answers\n last_user_answers.each do |lua|\n lua.correct= (lua.response.to_f == self.response.to_f)\n lua.save!\n end\n end", "def add_answer(name, type, klass)\n self.payload += self.add_record(name, type, klass).encode\n self.answer_rr += 1\n end", "def validate_answer(answer)\n end", "def answers\n []\n end", "def store( *answers )\n idx = @all_answers[ :lastid ] += 1\n @all_answers[ idx ] = Answer.new( *answers )\n serialize\n idx\n end", "def answers=(ans)\n @answers = ans.map { |a| Answer.new(a) }\n end", "def record_answer(knowledge_idurl, question_idurl, choice_idurls_ok)\n answer = Answer.new(:knowledge_idurl => knowledge_idurl,\n :question_idurl => question_idurl,\n :choice_idurls_ok => choice_idurls_ok,\n :time_stamp => Time.now)\n (hash_answered_question_answers[question_idurl] ||= []) << answer\n answers << answer\n answer\n end", "def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end", "def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end", "def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end", "def set_answers!(params)\n SurveyQuestion.with_question.find_all_by_survey_id(survey_id).each do |question| # iterate through all survey questions\n if params[question.id.to_s].blank? # if the question hasn't been answered\n remove_answer(question.id)\n else\n set_answer(question, params[question.id.to_s]) # save the answer\n end\n end\n save\n end", "def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end", "def set_answer\n\t\t#@answer = Survey.find(params[:id])\n\tend", "def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end", "def correct_answer(text)\n answer = Answer.new(text, true)\n @errorReporter.register answer\n @test.last_question.add_answer answer\nend", "def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end", "def question\n answer.question\n end", "def answer(answers:[], question:nil)\n question = question || @questions[0]\n\n return Packet.new(\n trn_id: @trn_id,\n qr: QR_RESPONSE,\n opcode: OPCODE_QUERY,\n flags: FLAG_RD | FLAG_RA,\n rcode: RCODE_SUCCESS,\n questions: [question],\n answers: answers,\n )\n end", "def post_process(answer)\n answer\n end", "def b_answer_params\n params.require(:b_answer).permit(:answer)\n end", "def add_answer\n request('answers/add')\n end", "def save_answers(params)\n answers = []\n params.each do |question_id, answer|\n brief_question = StartupBriefQuestion.find_by(id: question_id)\n if brief_question.single? \n answers << StartupBriefSummary.new(question_id: brief_question.id,\n answer_id: answer,\n startup_id: self.startup_id)\n elsif brief_question.multi? && !brief_question.detail\n answer.each do |answer_id|\n answers << StartupBriefSummary.new(question_id: brief_question.id,\n answer_id: answer_id,\n startup_id: self.startup_id)\n end\n elsif brief_question.multi? && brief_question.detail\n answer[:answer_ids].try(:each) do |answer_id|\n answers << StartupBriefSummary.new(question_id: brief_question.id,\n answer_id: answer_id,\n detail_text: answer[:detail].first(TEXT_LENGTH),\n startup_id: self.startup_id)\n end\n else\n answers << StartupBriefSummary.new(question_id: brief_question.id,\n answer_text: answer.first(TEXT_LENGTH),\n startup_id: self.startup_id)\n end \n end\n answers.each { |a| a.run_callbacks(:save) { false } }\n StartupBriefSummary.import answers \n end", "def update\n @problem_set = ProblemSet.find(params[:problem_set_id])\n @question = Question.where(:id => params[:id], :problem_set_id => params[:problem_set_id]).first\n @answers = Answer.where(:question_id => @question.id)\n\n ans = [:answer1, :answer2, :answer3, :answer4]\n respond_to do |format|\n if @question.update_attributes(params[:question])\n \n @answers.each_with_index do |a, i|\n a.answer = params[ans[i]][:answer]\n a.correct = params[ans[i]][:correct]\n a.save\n end\n\n if @answers.size < 4 and params[ans[@answers.size]][:answer] != \"\"\n for i in @answers.size..4\n if params[ans[i]][:answer] != \"\"\n a = Answer.new(params[ans[i-1]])\n a.question_id = @question.id\n a.save\n end\n end\n end\n format.html { redirect_to(edit_problem_set_question_path(@problem_set.id, @question.count), :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def question\n @question = params[:question]\n @answer = %w[yes no].sample\n end", "def process_answers\n if self.answers.present?\n fields.each do |field|\n # remove nil values\n if field.field_type_checkbox?\n self.answers[field.id.to_s] = if self.answers[field.id.to_s].is_a?(String)\n JSON.parse(self.answers[field.id.to_s]).reject(&:blank?).uniq\n elsif self.answers[field.id.to_s].is_a?(Array)\n self.answers[field.id.to_s].reject(&:blank?).uniq\n end\n\n # Process to store attachment file\n elsif field.field_type_file?\n data = self.answers[field.id.to_s]\n if data.present?\n uploader = AttachmentUploader.new\n uploader.question_id = field.id.to_s\n uploader.form_id = form_id\n uploader.store!(data)\n self.answers[field.id.to_s] = uploader.url\n end\n end\n end\n end\n end", "def save_user_responses(resp)\n @response = Response.find(resp[:id])\n @question = @response.question\n resp_val_string = Response::EMPTY_RESPONSE_VALUE\n if (@question.question_type == Question::TYPES['short_answer'])\n resp_val_string = resp[:response_value]\n elsif (@question.question_type == Question::TYPES['multiple_choice'] || @question.question_type == Question::TYPES['scale'])\n # look through the multiple choice options and see which one is selected\n # note: for now these are implemented in the same way. in the future, scale may be a slider.\n resp_val_string = resp[:response_value]\n elsif (@question.question_type == Question::TYPES['multiple_select'])\n # look through the multiple select options and see which one(s) are selected\n\t @option_count = 0\n\t @option_arr = []\n\t while(@option_count < @response.question.question_options.length)\n\t\tputs \"** OPTION \" + @option_count.to_s + \" ***\"\n\t\t@index = @option_count.to_s\n\t\tif(resp[\"response_values\"][@index] != \"\")\n\t\t\t@option_arr << resp[\"response_values\"][@index]\n\t\tend\n\t\t@option_count += 1\n\t end\n resp_val_string = @option_arr.join(\",\")\n end\n \n puts \"RESPONSE VALUE STRING: #{resp_val_string}\"\n \n if (resp_val_string == \"\")\n return false\n else\n # update the stuff here\n @response.response_value = resp_val_string\n @response.save!\n return true\n end\n end", "def answers(options={})\n parse_answers(request(singular(id) + \"answers\", options))\n end", "def yourAnswer()\n if $strAnswer.length == 1\n $arrUserAnswers[$intQuestionOnScreen - 1, 1] = $radioChoice\n else\n $arrUserAnswers[$intQuestionOnScreen - 1] = ($option_one.to_s + $option_two.to_s + $option_three.to_s + $option_four.to_s).gsub(\"0\", \"\")\n end\nend", "def find_answer(options={})\n\toptions[:answer]\nend", "def create_answer(answer_text,question_id,tenant_id,question_bank_id,answer_status)\n answer = Answer.new\n answer.answer_text = answer_text\n answer.question_id = question_id\n answer.question_bank_id = question_bank_id\n answer.tenant_id = tenant_id\n answer.answer_status = answer_status\n answer.save\n return answer\n end", "def add_answer(ans_attr)\n return nil if answers.find_by_question_id(ans_attr[:question_id])\n ans = answers.build(ans_attr)\n if ans.question_option_id && option = ans.question.options.find(ans.question_option_id)\n ans.points = option.points_to_award\n ans.correct = option.correct?\n ans.entry_id = option.entry_id\n end \n ans.save\n reload\n ans\n end", "def set_b_answer\n @b_answer = BAnswer.find(params[:id])\n end", "def answer_params\n params.require(:answer).permit(:answer, :response, :survey_id, :question_id, :response_id, :user_id)\n end", "def answer_params\n params.require(:answer).permit(:content, :question_id, :response_id)\n end", "def update\n # Do not support updating an answer for now\n # Once you have answered there is no return\n end", "def answer_params\n params.require(:answer).permit(:body)\n end", "def as_json(*args)\n super(*args).merge(answers: answers.map(&:content))\n end", "def save_exam_answer_for!(exam, question_answered, user_answers=[], answer=false)\n custom_exam_answer = CustomExamAnswer.find_or_create_by(custom_exam: exam, flashcard: self)\n\n custom_exam_answer.update(answered: question_answered, correct: answer, answered_correct_in_exam: answer, user_answers: user_answers)\n end", "def answer_params\n params.require(:answer).permit(:user_id, :question_id, :content, :book_id, :title, :is_tweet, :is_anonymous)\n end", "def answer_present\n if self.question.qtype == 'one_response' && self.response_id.nil?\n errors.add(:base, 'Please fill in an answer before leaving this page.' )\n return false\n elsif self.question.qtype == 'likert_scale' && self.response_id.nil?\n errors.add(:base, 'Please fill in an answer before leaving this page.' )\n return false\n\n elsif self.question.qtype == 'rank_three' \n responses = self.multianswers.map( &:rank ).compact\n if responses.length == 3 \n array_wanted = [1, 2, 3]\n if array_wanted == responses.sort\n return true\n else \n errors.add(:base, 'Please ensure all items are unique.' )\n return false\n end \n else \n errors.add(:base, 'Please ensure 3 items are ranked.' )\n return false\n end\n\n elsif self.question.qtype == 'rank_five' \n responses = self.multianswers.map( &:rank ).compact\n if responses.length == 5 \n array_wanted = [1, 2, 3, 4, 5]\n if array_wanted == responses.sort\n return true\n else \n errors.add(:base, 'Please ensure all items are unique.' )\n return false\n end \n else \n errors.add(:base, 'Please ensure 5 items are ranked.' )\n return false\n end\n end\n end", "def answer\n @question = params[:questions]\n # we need to get the value from params in order to store the question.\n if @question.eql? 'I am going to work'\n @answer = 'Great!'\n elsif @question.end_with?('?')\n @answer = 'Silly question, get dressed and go to work!'\n else\n @answer = \"I don't care, get dressed and go to work!\"\n # we create @ = instance variable in order to use outside of the method.\n end\n end", "def fake_answer_params\n params.require(:fake_answer).permit(:answer, :question_id, :quiz_id)\n end", "def incorrect_answer(text)\n answer = Answer.new(text, false)\n @errorReporter.register answer\n @test.last_question.add_answer answer\nend", "def response\n\t\tputs @answers[rand(@answers.length - 1)]\n\tend", "def create_answers_if\n if self.type.name == 'satisfaction-100'\n 5.times do |n|\n Answer.create(question: self, value: (n*25).to_s + \"%\")\n end\n end\n if self.type.name == 'free-text'\n Answer.create(question: self, value: \"textarea\")\n end\n end", "def find_answer\nend", "def possible_answer_params\n params.require(:possible_answer).permit(:question_id, :order, :answer_text, :is_text, :boolean)\n end", "def post_execute\n save({'answer' => @datastore['answer']})\n end", "def post_execute\n save({'answer' => @datastore['answer']})\n end", "def answers(options={})\n self.class.parse_answers(request(singular(user_id) + \"/answers\", options))\n end", "def get_answer(answer)\n # In case the Chair did not answer this question.\n return 'No response provided.' if answer.nil?\n\n case answer.answer_type\n when 'Multiple Choice' # If multiple choice, show selected answer.\n answer.multiple_choice\n when 'True/False' # If true false, show either true or false.\n answer.true_false ? 'True' : 'False'\n when 'Numeric' # If numeric, show selected number.\n answer.numeric\n else # If short answer, show response.\n answer.short_answer\n end\n end", "def answer_params\n params.require(:answer).permit(:body, :question_id)\n end", "def answer_params\n params.require(:answer).permit(:body, :question_id, :status)\n end", "def answer(params={})\n matching_answer_class.new(params.merge(question: self))\n end", "def answer_texts\n self.answers.map { |a| a.choice }\n end", "def answer_texts\n self.answers.map { |a| a.choice }\n end", "def answer_params\n params[:answer]\n end", "def answer_params\n params[:answer]\n end", "def answer\n @question = params[:question]\n if @question == 'I am going to work' then @answer = 'Great!'\n elsif @question.include? '?'\n then @answer = 'Silly question, get dressed and go to work'\n else @answer = \"I don't care, get dressed and go to work!\"\n end\n end", "def answer\n params[:answers].each do |question_id, value|\n answer = Answer.find_or_initialize_by_question_id_and_user_id(question_id, current_user.id)\n answer.content = value[:content]\n answer.save\n end if params[:answers]\n\n survey = Survey.find(params[:id])\n redirect_to survey.next_url || root_url, :notice => survey.confirmation\n end", "def answers(options={})\n @answers = self.class.parse_answers(request(singular(question_id) + \"/answers\", options))\n end", "def set_answer\n @answer = @question.answers.find(params[:id])\n end", "def record_answer(knowledge, quizze, question, choices_idurls_selected_ok)\n choices_idurls_selected_ok ||= []\n quizze_instance = get_latest_quizze_instance\n raise \"error\" unless quizze_instance and quizze_instance.get_quizze == quizze\n choices_ok = question.get_choice_ok_from_idurls(choices_idurls_selected_ok)\n knowledge.trigger_recommendations(quizze_instance, question, quizze.products, choices_ok, false)\n question.record_answer(self, choices_ok, false)\n end", "def answer_to question\n session_data(:answered)[question.id.to_s]\n end", "def question_answered(data, user, answer, _options_string)\n @user = user\n @username = @user.name\n @answer = answer\n @question_title = @answer.question.text.to_s\n @plan_title = @answer.plan.title.to_s\n @template_title = @answer.plan.template.title.to_s\n @data = data\n @recipient_name = @data['name'].to_s\n @message = @data['message'].to_s\n @answer_text = @options_string.to_s\n @helpdesk_email = helpdesk_email(org: @user.org)\n\n I18n.with_locale I18n.default_locale do\n mail(to: data['email'],\n subject: data['subject'])\n end\n end", "def answer_params\n params.require(:answer).permit(:user_id, :question_id, :content, :is_tweet, :is_anonymous)\n end", "def save_choices(questionnaire_id)\n\n if params[:new_question] and params[:new_choices]\n questions = Question.find_all_by_questionnaire_id(questionnaire_id)\n i = 1\n for question in questions\n for choice_key in params[:new_choices][i.to_s].keys\n\n if choice_key == params[:new_question][i.to_s][\"weight\"]\n score = 1\n else\n score = 0\n end\n q = QuestionAdvice.new(:score => score, :advice => params[:new_choices][i.to_s][choice_key], :question_id => question.id)\n q.save\n end\n i += 1\n question.weight = 1\n question.true_false = false\n end\n end\n end", "def ask\n\t\tbegin\n\t\t\tputs self\n\t\t\tprint \"Su respuesta: \" \n\t\t\tanswerno = gets.to_i - 1\n\t\tend while (answerno < 0 or answerno >= @answers.length)\n\t\t#Comprobamos si es correcta la respuesta\n\t\t@answers[answerno].is_right? \n\tend", "def post_params\n params.require(:answer).permit(:answer)\n end", "def answered\n @the_question = Question.find(params[:id])\n @the_question.answered = true\n @the_question.save\n render json: [{question: @the_question}]\n end", "def update\n respond_to do |format|\n if @quiz.update(quiz_params)\n format.html { redirect_to @quiz, notice: \"Quiz was successfully updated.\" }\n format.json { render :show, status: :ok, location: @quiz }\n\t\tmy_array = []\n my_array << @quiz.option1\n my_array << @quiz.option2\n my_array << @quiz.option3\n my_array << @quiz.option4\n\n correct_respo = my_array[@quiz.correct_response.to_i - 1]\n @quiz.correct_response_text = correct_respo\n @quiz.save\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "def questionAnswer(question)\n answer = questionAnswerRaw(question)\n \n answer = \"No Answer\" if answer == nil\n return answer\nend", "def answer_params\n\t params.require(:answer).permit(:title, :description)\n\t end", "def auto_add_answers\n\t\tperson_names = %w(john micheal jordan arya tyrion sansa khal joffrey ramsay)\n\t\tanswers = [\"Very likely\",\"Somewhat likely\",\"Neutral\",\"Somewhat unlikely\",\"Very unlikely\",\"Very satisfied\",\"Somewhat satisfied\",\"Neutral\",\"Somewhat dissatisfied\",\"Very dissatisfied\"]\n\n\t\t(1..3).to_a.each do |num|\n\t\t\tperson_name = person_names.shuffle.first\n\t\t\tanswer = answers.shuffle.first\n\t\t\tself.answers.create(person_name: person_name, answer: answer)\n\t\tend\n\tend", "def quiz_answer(quiz)\n if quiz.answer_type == 'multi'\n show_multi_answer(quiz.answers.first.text, quiz.answer_input)\n elsif quiz.answer_type == 'check'\n show_check_answer(quiz.answers.first.text, quiz.answer_input)\n else\n quiz.answers.first.text\n end\n end", "def get_question(answer)\n answer.is_a?(Answer) ? answer.question : answer\n end", "def answer(obj)\n @answered = true\n @args[:process].answer(@args[:id], obj)\n end", "def update_answer_type_params\n scalar_params = [].tap do |result|\n result.push(:answer_text) # Text response answer\n end\n # Parameters that must be an array of permitted values\n array_params = {}.tap do |result|\n result[:option_ids] = [] # MRQ answer\n result[:files_attributes] = [:id, :_destroy, :filename, :content] # Programming answer\n end\n scalar_params.push(array_params)\n end", "def answer_params\n params.require(:answer).permit(:content)\n end", "def answer_params\n params.require(:answer).permit(:content)\n end", "def create\n @question = Question.new(text: \"Default\")\n @answer = @question.answers.build(text: \"Answer1\", color: \"red\", score: 100)\n @answer.save\n @answer = @question.answers.build(text: \"Answer2\", color: \"green\", score: 50)\n @answer.save\n @answer = @question.answers.build(text: \"Answer3\", color: \"blue\", score: 0)\n @answer.save\n #This sets all of the default answers to have a score of 0\n GenPackage.all.each do |package|\n @answer_value = package.answer_values.build(score: 0, question_id: @question.id)\n @answer_value.save\n end\n\n #This qill try and save the question, and if it succeeds, then it alerts the use that the question had been created\n respond_to do |format|\n if @question.save\n format.html { redirect_to :planner, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: :planner }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def answer_params\n params.require(:answer).permit(:contents,:accept)\n end", "def create\n @submitted_answer = SubmittedAnswer.new(submitted_answer_params)\n @question = Question.find_by_id(submitted_answer_params[:question_id])\n if @question.answers.first.name.downcase == @submitted_answer.answer.downcase\n @submitted_answer.score = 4\n else\n @submitted_answer.score = -1\n end\n\n respond_to do |format|\n if @submitted_answer.save\n format.html { redirect_to @question, notice: 'Submitted answer was successfully created.' }\n format.json { render :show, status: :created, location: @submitted_answer }\n else\n format.html { render :new }\n format.json { render json: @submitted_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_answer_type_params\n scalar_params = [].tap do |result|\n result.push(:answer_text) # Text response answer\n result.push(attachments_params) # User uploaded files\n end\n # Parameters that must be an array of permitted values\n array_params = {}.tap do |result|\n result[:option_ids] = [] # MRQ answer\n result[:files_attributes] = [:id, :_destroy, :filename, :content] # Programming answer\n # Forum Post Response answer\n forum_post_attributes = [:id, :text, :creatorId, :updatedAt]\n result[:selected_post_packs] = [corePost: forum_post_attributes, parentPost: forum_post_attributes, topic: [:id]]\n end\n scalar_params.push(array_params)\n end", "def answer_params\n params.require(:answer).permit(:ans, :user_id, :question_id)\n end", "def answer_params\n params.require(:answer).permit(:question_number, :question_response, :taker_id, :question_id)\n end", "def answer_params\n params.permit(:body, :user_id, :question_id, :question_accepted_id)\n end" ]
[ "0.6771099", "0.6771099", "0.64499485", "0.64402765", "0.63951606", "0.63804525", "0.63658524", "0.6356687", "0.6273625", "0.62662", "0.6231626", "0.6191971", "0.61853206", "0.6155456", "0.61478585", "0.61211216", "0.60808533", "0.60705227", "0.60419357", "0.6037303", "0.60342467", "0.60342467", "0.60342467", "0.60342306", "0.6033568", "0.6005772", "0.5993007", "0.5972195", "0.5931373", "0.5926239", "0.5915897", "0.5912735", "0.5902916", "0.59003884", "0.58970475", "0.5889659", "0.5877526", "0.58665043", "0.5861734", "0.5854708", "0.5854472", "0.58478254", "0.58457637", "0.584477", "0.58196497", "0.5810578", "0.5797137", "0.57955325", "0.57908475", "0.57904017", "0.578361", "0.57764417", "0.5773735", "0.57643956", "0.5755237", "0.57413244", "0.57356995", "0.57344186", "0.5734189", "0.57318646", "0.57310414", "0.57310414", "0.57306767", "0.5730243", "0.57240164", "0.5721011", "0.5711225", "0.5710147", "0.5710147", "0.5704957", "0.5704957", "0.5704867", "0.5704333", "0.5699641", "0.5699237", "0.5698953", "0.5695218", "0.5694746", "0.569237", "0.56887835", "0.568296", "0.5681148", "0.56795985", "0.5672805", "0.5667055", "0.566333", "0.5659079", "0.5650433", "0.5643715", "0.56435794", "0.5640443", "0.5636716", "0.5636716", "0.562984", "0.56245905", "0.5621914", "0.56191164", "0.5611946", "0.5610966", "0.56086206" ]
0.66345304
2
TODO_IMP: Prevent delete if it has active enrollments TODO: Can add calendar year leaves and working days for the firm and can calculate end_date accordingly TODO: Ensure end_date > start_date
def seats_available? (capacity - total_enrollments) > 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_range_integrity\n super\n\n # TODO: remove this after tie-in to Settings\n return\n\n open_enrollment_term_maximum = Settings.aca.shop_market.open_enrollment.maximum_length.months.months\n if open_enrollment_term.end > (open_enrollment_term.begin + open_enrollment_term_maximum)\n errors.add(:open_enrollment_term, \"may not exceed #{open_enrollment_term_maximum} months\")\n end\n\n open_enrollment_term_earliest_begin = effective_term.begin - open_enrollment_term_maximum\n if open_enrollment_term.begin < open_enrollment_term_earliest_begin\n errors.add(:open_enrollment_begin_on, \"may not begin more than #{open_enrollment_term_maximum} months sooner than effective date\") \n end\n\n initial_application_earliest_start_date = effective_term.begin + Settings.aca.shop_market.initial_application.earliest_start_prior_to_effective_on.months.months\n if initial_application_earliest_start_date > TimeKeeper.date_of_record\n errors.add(:effective_term, \"may not start application before #{initial_application_earliest_start_date.to_date} with #{effective_term.begin} effective date\")\n end\n\n if !['canceled', 'suspended', 'terminated','termination_pending'].include?(aasm_state)\n benefit_term_minimum = Settings.aca.shop_market.benefit_period.length_minimum.year.years\n if end_on != (effective_term.begin + benefit_term_minimum - 1.day)\n errors.add(:effective_term, \"application term period should be #{duration_in_days(benefit_term_minimum)} days\")\n end\n end\n end", "def calculate_dates\n self.inactive_date = Time.now + 2.months\n self.delete_date = Time.now + 4.months\n end", "def safe_renewal_application_dates(status)\n case status\n when :draft, :enrollment_open\n current_effective_date (TimeKeeper.date_of_record + 2.months).beginning_of_month.prev_year\n when :enrollment_closed, :enrollment_eligible, :enrollment_extended\n current_effective_date (TimeKeeper.date_of_record + 1.months).beginning_of_month.prev_year\n when :active, :terminated, :termination_pending, :expired\n if TimeKeeper.date_of_record.month > 10\n current_effective_date (TimeKeeper.date_of_record - 3.months).beginning_of_month.prev_year\n elsif TimeKeeper.date_of_record.month == 1\n current_effective_date TimeKeeper.date_of_record.beginning_of_month.prev_year\n else\n current_effective_date (TimeKeeper.date_of_record - 1.months).beginning_of_month.prev_year\n end\n end\n end", "def add_days_remaining\n return unless self.absence_type_id == AbsenceTypeConstants::ABSENCE_TYPE_HOLIDAY\n holiday_allowance = self.user.get_holiday_allowance_for_dates self.date_from, self.date_to\n holiday_allowance.days_remaining += self.working_days_used\n holiday_allowance.save\n end", "def check_end_date\n # if self.category.eql?(\"appointment\")\n unless self.start_date.nil? or self.end_date.nil?\n if (self.end_date < self.start_date)\n self.category.eql?(\"appointment\")? self.errors.add(' ', 'End Date can\\'t be before Start Date') : self.errors.add(' ', 'Due Date can\\'t be before Start Date')\n end\n if self.end_date == self.start_date\n self.errors.add(' ', 'End Time can not be before start time') if (self.end_date.to_time < self.start_date.to_time)\n end\n end\n # end\n end", "def workdays(calendar = Spok.default_calendar)\n (@start_date..@end_date).to_a.delete_if{ |date| Workday.restday?(date, calendar: calendar) }\n end", "def end_date\n return ends if support_deal.nil?\n self.ends ||= support_deal.end_date\n return support_deal.end_date < ends ? support_deal.end_date : ends\n end", "def deletedays_RETIRED\n ###################################################################\n # DO NOT USE\n # DOES NOT HANDLE CHAINS CORRECTLY\n ###################################################################\n\n #logger.debug \"entering deletedays\"\n #logger.debug \"deletedays_params: \" + deletedays_params.inspect\n #sf = 5 # signigicant figures\n mystartdeletedate = deletedays_params[\"from\"].to_date\n myenddeletedate = deletedays_params[\"from\"].to_date + deletedays_params[\"num_days\"].to_i\n @options = Hash.new\n @options[:startdate] = mystartdeletedate\n @options[:enddate] = myenddeletedate\n @cal = calendar_read_display1f(@options)\n if @cal.empty?\n # these days are empty - show error and return\n flash[:notice] = \"These days are empty - nothing to delete!!!\"\n redirect_to deletedaysedit_path(deletedays_params)\n end\n # get to here, we are set up to do deletes\n # @cal contains the info to be deleted.\n @results = Array.new\n# Each site has an array\n# @cal{sitename}[0][] -> [0] = {value = site name}\n# [1] = {value = date}\n# @cal{sitename}[1][] -> [0] = {value = session_time} e.g. \"03-3- PM\"\n# [1] = {slotid = nnnn\n# id_dom = \"CAL201804041530\"\n# values[] -> [0] = object #<Lesson>\n# [1] = object #<Lesson>\n# ....\n @cal.each do |site, sitevalue| \n # Now work through the slots for this site and day\n siteName = siteDate = \"\" # control scope\n sitevalue.each_with_index do |bankslots, bankslotindex|\n if bankslotindex == 0 \n siteName = bankslots[0]['value']\n siteDate = siteDateBankFrom = bankslots[1]['value']\n n = siteDate.match(/(\\d+.*)/)\n siteDate = n[1]\n if bankslots[2] == nil\n @results.push \"processing #{siteName} #{siteDateBankFrom}\"\n else\n siteDateBankTo = bankslots[2]['value']\n @results.push \"processing #{siteName} #{siteDateBankFrom} to #{siteDateBankTo}\"\n end\n else\n bankslots.each_with_index do |slot, slotindex|\n if slotindex == 0\n next # simply holds the slot time - will get from found slot\n end\n thisslotid = slot['slotid']\n # if not a valid slot, go to next iteration.\n if thisslotid == nil\n next\n end\n @results.push \"Slotid: #{thisslotid}\"\n thisslot = Slot.find(thisslotid)\n @results.push \"Check slot \" + thisslot.inspect \n # Now to look at each lession in each slot\n if slot['values'].respond_to?(:each) then\n slot['values'].each do |lesson|\n logger.debug \"lesson: \" + lesson.inspect\n @results.push \"Check lesson \" + lesson.inspect \n # Now find all the tutors in this lesson\n if lesson.tutors.respond_to?(:each) then\n lesson.tutors.sort_by {|obj| obj.pname }.each do |tutor|\n tutroles = tutor.tutroles.where(lesson_id: lesson.id)\n tutroles.each do |tutrole|\n if tutrole.destroy\n @results.push \"Removed tutrole #{tutor.pname} \" + \n tutrole.inspect \n else\n @results.push \"FAILED removing tutrole #{tutor.pname} \" +\n tutrole.inspect + \n \"ERROR: \" + tutrole.errors.messages.inspect\n end\n end\n end\n end\n \n # Now find all the students in this lesson\n if lesson.students.respond_to?(:each) then\n lesson.students.sort_by {|obj| obj.pname }.each do |student|\n roles = student.roles.where(lesson_id: lesson.id)\n roles.each do |role|\n if role.destroy\n @results.push \"Removed role #{student.pname} \" + role.inspect\n else\n @results.push \"FAILED removing role #{student.pname} \" +\n role.inspect + \n \"ERROR: \" + role.errors.messages.inspect\n end\n end\n end\n end\n # Now remove the lesson the tutors and students were in\n mylesson = Lesson.find(lesson.id)\n if mylesson.destroy\n @results.push \"Removed lesson \" + \n mylesson.inspect \n else\n @results.push \"FAILED removing lesson \" + mylesson.inspect + \n \"ERROR: \" + mylesson.errors.messages.inspect\n end\n end # looping lessons\n end\n # Now remove the slot the lessons were in.\n if thisslot.destroy\n @results.push \"Removed slot \" + thisslot.inspect \n else\n @results.push \"FAILED removing slot \" + thisslot.inspect + \n \"ERROR: \" + thisslot.errors.messages.inspect\n end\n end\n end\n end\n end\n end", "def complete_termination\n self.deleted_at = Time.now.utc\n self.end_date = Date.today\n end", "def autoselect_entries!\n if employee_entries.present?\n raise 'This PayrollPeriod already has employee_entries! Can’t autoselect_entries!'\n end\n \n tickets = Ticket::Ticket.where(first_employee_entry: start_date..end_date)\n tickets.each do |ticket|\n ticket.employee_entries.each do |employee_entry|\n if employee_entry.payroll_period\n raise 'PayrollPeriod.autoselect_entries! was called for a date range that already has payroll data.'\n end\n employee_entry.payroll_period = self\n if not employee_entry.save\n raise employee_entry.errors.inspect\n end\n end\n end\n \n calculate!\n end", "def book_sales(period='enddate', basis, exclude)\n royalty_period = Period.where([\"currentperiod = ? and client_id = ?\", true, self.client_id])\n if period == 'startdate'\n self.calculate_book_royalties(self, royalty_period.first.enddate, royalty_period.first.startdate, basis, exclude)\n else #if period isn't 'startdate'\n self.calculate_book_royalties(self, royalty_period.first.enddate, \"1900-01-01\", basis, exclude)\n end\n end", "def expense_list_update\n if params[:start_date].present? and params[:end_date].present?\n if (params[:start_date].to_date > params[:end_date].to_date)\n flash[:warn_notice] = \"#{t('flash17')}\"\n redirect_to :action => 'expense_list'\n end\n\n @start_date = (params[:start_date]).to_date\n @end_date = (params[:end_date]).to_date\n @expenses = FinanceTransaction.expenses(@start_date, @end_date)\n else\n redirect_to :action => 'expense_list'\n end\n end", "def calcs_for_date_range(start_date, end_date, abandon_rate)\n puts \"\\tFrom #{start_date} to #{end_date} inclusive:\"\n\n total_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day\n ).count\n total_registrations_s = number_with_delimiter(total_registrations)\n puts \"\\tTotal registrations: #{total_registrations}, of which:\"\n\n assisted_digital_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day,\n assistance_mode: \"full\"\n ).count\n assisted_digital_registrations_s = number_with_delimiter(assisted_digital_registrations)\n puts \"\\t... assisted digital: #{assisted_digital_registrations_s}\"\n\n fully_digital_registrations = WasteExemptionsEngine::Registration.where(\n created_at: start_date.beginning_of_day..end_date.end_of_day,\n assistance_mode: nil\n ).count\n fully_digital_registrations_s = number_with_delimiter(fully_digital_registrations)\n puts \"\\t... fully digital: #{fully_digital_registrations}\"\n\n delta = total_registrations - assisted_digital_registrations - fully_digital_registrations\n puts \"\\t(delta of #{delta} is due to some registrations not having metaData.route set)\" unless delta.zero?\n\n abandon_rate_s = number_to_percentage(100.0 * abandon_rate, precision: 0)\n non_abandon_rate_s = number_to_percentage(100.0 * (1 - abandon_rate), precision: 0)\n\n total_registrations_started = (total_registrations / (1.0 - abandon_rate)).round(0)\n total_registrations_started_s = number_with_delimiter(total_registrations_started.to_i)\n\n total_registrations_completed = fully_digital_registrations + assisted_digital_registrations + delta\n total_registrations_completed_s = number_with_delimiter(total_registrations_completed)\n\n total_registrations_started_online = (fully_digital_registrations / (1.0 - abandon_rate)).round(0)\n total_registrations_started_online_s = number_with_delimiter(total_registrations_started_online)\n\n total_registrations_abandoned = total_registrations_started - total_registrations_completed\n total_registrations_abandoned_s = number_with_delimiter(total_registrations_abandoned)\n\n puts \"\\tSo including abandoned attempts, estimated orders started = \" \\\n \"#{total_registrations_s} / (1 - #{abandon_rate_s}) = #{total_registrations_started_s}, of which: \"\n puts \"\\t... completed: #{total_registrations_completed_s}\"\n puts \"\\t... abandoned: #{total_registrations_abandoned_s}\"\n\n puts \"\\nSummary:\"\n puts \"\\t1. Total number of transactions started and completed online only: #{fully_digital_registrations_s}\"\n puts \"\\t2. Total number of transactions started online: ESTIMATED: #{total_registrations_started_online_s}\"\n puts \"\\t\\t(Estimated dropoff rate for the last 30 days: #{abandon_rate_s}\"\n puts \"\\t\\t so estimated completion (non-abandoned) rate for the last 30 days: #{non_abandon_rate_s}\"\n puts \"\\t\\t so given #{fully_digital_registrations_s} fully digital orders, \" \\\n \"estimated total orders started online = \" \\\n \"(#{fully_digital_registrations_s}/#{non_abandon_rate_s}) = #{total_registrations_started_online_s})\"\n puts \"\\t3. Number of online claims: #{fully_digital_registrations_s}\"\n puts \"\\t4. Total number of claims (online + offline + unknown): \" \\\n \"#{fully_digital_registrations_s} + #{assisted_digital_registrations_s} + \" \\\n \"#{delta} = #{total_registrations_completed_s}\"\n\n puts \"====================================================================================================\"\n end", "def in_renewal_span?\n (0..7).include?(end_date.to_date - Time.zone.now.to_date)\n end", "def check_rest_days\n\n\t\temp=Employee.find(employee_id)\n\t\tcalendar=Calendar.where(:department_id => emp.department_id,:anio => Date.parse(desde.to_s).year.to_i).first\n if !calendar.nil?\n\n \t\tdias_requested=weekdays_in_date_range(desde..hasta,calendar)\n \t\trt=RequestType.find(request_type_id)\n \t\tdias=0\n \t\t#get all requests from employee\n requests=Request.joins(:request_type).where(:employee_id => employee_id,status: [1,2],:request_type_id => request_type_id).where('extract(year from desde)= ?',\"#{desde.year.to_i}\")\n\n \t #working days requested.\n \t requests.each do |rq| \n \t dias+=weekdays_in_date_range(rq.desde..rq.hasta,calendar)\n \t end\n\n \t #get rest days\n \t num_dias_max=Request.rest_days(desde.year.to_i,employee_id,rt.num_dias_max)\n\n \t if dias_requested>(num_dias_max-dias)\n \t errors.add(:desde,\"Debe seleccionar un periodo igual o inferior a los días restantes. (#{(num_dias_max-dias)} dias)\")\n \t end\n end\n\tend", "def index\n @year = params[:year].to_i\n employment_start_date = @user.sorted_employments.first.startDate\n if @year == 0\n @year = calculate_working_year_start(Date.today, employment_start_date).year\n end\n\n @working_year_start = calculate_working_year_start(Date.new(@year, 12, 31), employment_start_date)\n @working_year_end = calculate_working_year_start(Date.new(@year+1, 12, 31), employment_start_date) - 1.day\n begin\n @leave_days = LeaveDay.where(user_id: @user.id, date: (@working_year_start..@working_year_end)).order('date ASC')\n\n working_year_start_employment = employment_for_date(@working_year_start, @user.employments)\n if working_year_start_employment.nil?\n raise ArgumentError, \"Leave days calculation not available prior to employment start\"\n end\n @leave_days_consumed = calculate_consumed_leave_days(@working_year_end, @user.employments, @user.leave_days)\n @leave_days_available = calculate_available_leave_days(@working_year_end, @user.employments, @user.leave_days)\n @leave_days_working_year_start = @leave_days_available + @leave_days_consumed\n rescue ArgumentError\n render \"leave_days_unavailable\"\n end\n end", "def validate\n carrier_fk = carrier_id if carrier_fk.nil?\n if id.nil?\n date_array = FeeSchedule.find(:all,:conditions=>[\"carrier_id =? and practice_id = ? \",carrier_fk,practice_id]).collect{|x|[x.start_date,x.end_date]} if carrier_fk != 0\n else\n date_array = FeeSchedule.find(:all,:conditions=>[\"carrier_id =? and practice_id = ? and id != ? \",carrier_fk,practice_id,id]).collect{|x|[x.start_date,x.end_date]} if carrier_fk != 0\n end\n start_error = \"\"\n if !date_array.nil?\n for start_d,end_d in date_array\n unless start_date.nil?\n if start_date.to_date >= start_d.to_date and start_date.to_date <= end_d.to_date\n start_error =\"error\"\n end\n end \n unless end_date.nil?\n if end_date.to_date >= start_d.to_date and end_date.to_date <= end_d.to_date\n start_error =\"error\"\n end\n end \n end\n end\n errors.add(\"Selected Date Range already Exists for the Carrier. selected date range for the carrier\") unless start_error.empty?\n unless start_date.nil?\n unless end_date.nil?\n errors.add(\"End date should be greater than start date, End Date \") unless end_date.to_date > start_date.to_date\n end\n end\n if charge_type == 'Standard'\n if id.nil?\n dat_array_charge_type = FeeSchedule.find(:all,:conditions=>[\"charge_type =? and practice_id = ? \",\"Standard\",practice_id]).collect{|x|[x.start_date,x.end_date]}\n else\n dat_array_charge_type = FeeSchedule.find(:all,:conditions=>[\"charge_type =? and practice_id = ? and id != ?\",\"Standard\",practice_id,id]).collect{|x|[x.start_date,x.end_date]}\n end\n start_error_charge_type = \"\"\n for start_d_charge_type,end_d_charge_type in dat_array_charge_type\n unless start_date.nil?\n if start_date.to_date >= start_d_charge_type.to_date and start_date.to_date <= end_d_charge_type.to_date\n start_error_charge_type =\"error\"\n end\n end\n unless end_date.nil?\n if end_date.to_date >= start_d_charge_type.to_date and end_date.to_date <= end_d_charge_type.to_date\n start_error_charge_type =\"error\"\n end\n end \n end \n errors.add(\"Selected Date Range already Exists for the Practice. selected Date range for the Practice\") unless start_error_charge_type.empty? \n end\n end", "def leave_settlement\n if @faculty.eligible_for_leave_settlement?(@generation_date)\n leaves_to_encash = LeaveEncashment.employee_leave_encashments(@faculty, @generation_date.year.to_s).first.try(:no_of_leaves_to_be_encashed).to_i\n ((basic.to_f/@generation_date.end_of_month.day) * leaves_to_encash)\n end\n end", "def valid_end_date\n self.end_date - self.start_date > 0 ? true : false\n end", "def approve_absence(type_id, date = Date.today)\n person = self.person\n absence_type = AbsenceType.find_by_type_id_and_company_id( type_id, person.company_id)\n if absence_type.type_id == 6\n date_end = date + 89.days\n while (date < date_end)\n absence = person.absences.new\n absence.absence_type = absence_type\n absence.company_id = person.company_id\n absence.absence_date = date\n absence.absence_reason = \"Cuti Melahirkan\"\n absence.save!\n date = date.tomorrow\n end\n end\n if absence_type.type_id == 2\n if person.employee_leaves.find_by_leave_date(self.absence_date).nil?\n leave = person.employee_leaves.new\n leave.company_id = person.company_id\n leave.leave_date = self.absence_date\n leave.leave_description = \"Dicutikan\"\n leave.leave_status = \"Approved\"\n leave.save!\n end\n self.absence_reason = \"Dicutikan\"\n self.save!\n else\n self.absence_type = absence_type\n self.absence_reason = \"Dianggap Izin\"\n leave = person.employee_leaves.find_by_leave_date( self.absence_date)\n if leave\n leave.destroy!\n end\n self.save!\n end\n end", "def invoiceable?\n has_user_id = self.user.present?\n grace_date = self.created_at.to_date + GRACE_PERIOD\n\n self.employee? && has_user_id && grace_date < Date.today\n end", "def invoiceable?\n has_user_id = self.user.present?\n grace_date = self.created_at.to_date + GRACE_PERIOD\n\n self.employee? && has_user_id && grace_date < Date.today\n end", "def estimated_end_date\n Date.today + remaining_days\n end", "def check_dates\r\n self.start_time -= 8.hours\r\n self.end_time -= 8.hours\r\n end", "def overdue?\n if is_appointment?\n start_date.to_date < Time.zone.now.to_date\n else\n open? && end_date.to_date < Time.zone.now.to_date\n end\n end", "def determine_end_date\n self.end_date = start_date.next_month.yesterday\n end", "def remove_assessment_data_if_employee_not_assessed\n # if is_not_assessed?\n # active_assessment = Assessment.active.last\n # if active_assessment.present?\n # employee_goals.where(assessment_id: active_assessment.id).delete_all\n # attendances.where(\"extract(year from date) = ?\", active_assessment.year).delete_all\n # employees_assessments.where(assessment_id: active_assessment.id).where(manual: false).delete_all\n # end\n # end\n end", "def workshop_period\n @event = Event.first\n if (@event.activity_begin_day < DateTime.now && DateTime.now < @event.activity_end_day) || !current_user.adm?\n redirect_to workshops_path\n flash[:info] = \"Workshop nao disponivel!\"\n end\n end", "def correct_calendar\n @calcheck=Department.find(Calendar.find(params[:id]).department_id)\n redirect_to(calendars_url) unless current_emp.id==@calcheck.enterprise_id || current_user.role>3 \n end", "def check_end_date\n if end_date < Date.today\n \n errors.add(:end_date, \"End Date can only be later than today\")\n end\n end", "def check_for_workdays\n if not work_days.empty?\n errors.add(:base, :cannot_delete)\n return false\n end\n end", "def get_not_worked_days start_date, end_date, employee_id\n not_worked_days = []\n if start_date != \"\" && end_date != \"\"\n start_date = DateTime.parse(start_date)\n end_date = DateTime.parse(end_date)\n for i in 0..get_difference_days(start_date, end_date) + 1\n current_date = start_date + i.days\n if !is_weekend?(current_date) && didnt_come_to_work?(employee_id, current_date)\n not_worked_days << current_date\n end\n end\n end\n return not_worked_days\n end", "def enrollment_dates\n if start_date\n \"#{start_date_formatted} - #{end_date_formatted}\"\n end\n end", "def reservation_dates_must_make_sense\n\t if end_date <= start_date\n\t\t errors.add(:start_date, \"has to be before the end date\")\n\t end\n\tend", "def estimated_end_date\n start_date + 12.days\n end", "def find_expirations\n expired_embargoes = []\n expiration_date = solrize_date(@date)\n\n @work_types.each do |work_type|\n expired_works = work_type.where(\"embargo_release_date_dtsi:[* TO #{RSolr.solr_escape(expiration_date)}]\")\n expired_embargoes << expired_works\n end\n\n expired_embargoes.flatten\n end", "def set_termination_date\n if effective_date and approved_details.try(:duration) and (effective_date_changed? or approved_details_id_changed?)\n self.termination_date = Date.new(\n effective_date.year + approved_details.duration,\n effective_date.month,\n effective_date.day )\n end\n end", "def update_holidays(id_usr , mode)\n #Trae todos los usuarios activos\n @users = User.find(id_usr)\n \n #Busca registro del usuario en tabla general\n holidays_general = Holidays.find(:all , :conditions => [\"period = ? and user_id = ?\" , @@today_year , @users.id]).first\n \n \n if mode == 'consumed' then\n #Sql para recuperar dias de vacaciones en el periodo\n sql_days =\" SELECT ifnull( sum( days ) , 0 )\n FROM holidays_users\n WHERE holidays_users.id_user = \" + id_usr.to_s + \"\n AND (date_from >= '\" + (@@today_year-1).to_s + \"-10-31')\n AND (date_to <= '\" + @@today_year.to_s + \"-10-31')\"\n \n #obtengo cantidad de dias del periodo\n sql_days_result = ActiveRecord::Base.connection.execute(sql_days)\n sql_days_result.each do | days |\n #Actualizo dias usados en el periodo\n holidays_general.days_consumed = days[0]\n end\n else\n #Sql para recuperar dias otorgados al usuario\n sql_free_days =\"SELECT ifnull( sum( days ) , 0 )\n FROM holidays_adds\n WHERE user_id = \" + id_usr.to_s + \"\n AND (date >= '\" + (@@today_year-1).to_s + \"-10-31')\n AND (date <= '\" + @@today_year.to_s + \"-10-31')\"\n \n #obtengo cantidad de dias del periodo\n sql_free_days_result = ActiveRecord::Base.connection.execute(sql_free_days)\n sql_free_days_result.each do | days |\n #Actualizo dias otorgados en el periodo\n holidays_general.days_free = days[0]\n end\n end\n \n #Actualizo dias totales\n holidays_general.diff = holidays_general.days + holidays_general.days_acum + holidays_general.days_free - holidays_general.days_consumed\n #Guardo\n holidays_general.save\n \n end", "def calculate!\n # When expanding the application to support multi-week pay periods, this code must be modified\n minutes_this_week = []\n daily_limit = 8 * 60 # in minutes\n weekly_limit = 40 * 60 # in minutes\n\n entries = employee_entries.reload # TODO: sort logic here \n \n entries.each do |e|\n duration = e.duration || 0\n date = e.payroll_worked_date = e.ticket.first_employee_entry\n \n minutes_this_week[e.employee_id] ||= { total: 0 }\n minutes_this_week[e.employee_id][date] ||= 0\n minutes_this_week[e.employee_id][date] += duration\n minutes_this_week[e.employee_id][:total] += duration\n \n overtime_today = minutes_this_week[e.employee_id][date] - daily_limit\n overtime_this_week = minutes_this_week[e.employee_id][:total] - weekly_limit\n overtime_max = [overtime_today, overtime_this_week, 0].max\n \n e.payroll_duration_standard = duration - overtime_max\n e.payroll_duration_standard = 0 if e.payroll_duration_standard < 0\n e.payroll_duration_overtime = duration - e.payroll_duration_standard\n \n e.payroll_bill_to = e.ticket.bill_to\n e.payroll_job_id = e.ticket.job_id\n e.payroll_status = if e.on_the_job? and e.payroll_job_id\n :bill_to_job\n else\n :overhead\n end\n e.payroll_pay_rate = if e.ticket.job\n e.ticket.pay_rate\n else\n :day_pay\n end\n \n e.payroll_category_string = \"#{e.employee_id} - #{e.payroll_bill_to} - #{e.payroll_job_id} - #{e.payroll_pay_rate} - #{e.payroll_status}\"\n \n e.save!\n end\n end", "def date_verify\n if end_date && start_date.nil?\n errors.add(:end_date, \"cannot only specify end date\")\n elsif all_day && start_date.nil?\n errors.add(:all_day, \"cannot specify without date\")\n elsif (start_date && end_date) && (start_date > end_date)\n errors.add(:start_date, \"cannot larger than end date\")\n end\n end", "def valid_effective_end_date?\n\n if effective_end_date.present?\n if effective_end_date < Date.civil(1900, 1, 1)\n errors[:base] << \"End date must be after 1900.\"\n return false\n else\n # Rule: Employment Master End date should be greater than current date.\n # Employment data entry is needed to know if client is currently working or not, so End date should be null or if entered it should be greater than current date.\n if effective_end_date > Date.today\n return true\n else\n errors[:base] << \"Currently working employment should have future end date\"\n end\n\n end\n else\n return true\n end\n end", "def active_expiration_dates\n active_adjustments.map do |adjustment|\n if adjustment&.expiration_year.present?\n Date.new.change(day: 1, month: adjustment.expiration_month || 1, year: adjustment.expiration_year)\n end\n end.compact.uniq.sort\n end", "def autoselect_all_possible_entries!\n if employee_entries.present?\n raise 'This PayrollPeriod already has employee_entries! Can’t autoselect_entries!'\n end\n \n entries = Ticket::EmployeeEntry.where(payroll_period_id: nil)\n\n tickets = Set.new\n entries.each do |entry|\n if entry.ticket.admin_approved?\n tickets << entry.ticket\n end\n end\n \n earliest_date = nil\n latest_date = nil\n\n tickets.each do |ticket|\n ticket.employee_entries.each do |employee_entry|\n if employee_entry.payroll_period\n raise 'autoselect_all_possible_entries! is working on a ticket that already has a payroll period. More nuanced control is required here.'\n end\n \n if (not earliest_date) or (earliest_date > employee_entry.time)\n earliest_date = employee_entry.time\n end\n if (not latest_date) or (latest_date < employee_entry.time)\n latest_date = employee_entry.time\n end\n \n employee_entry.payroll_period = self\n if not employee_entry.save\n raise employee_entry.errors.inspect\n end\n end\n end\n \n self.start_date = earliest_date\n self.end_date = latest_date\n self.save\n \n calculate!\n end", "def during_enrollment?(dte=promotion.current_date)\r\n dte.between?(enrollment_starts_on,enrollment_ends_on)\r\n end", "def due_by\n #occurring_days = ae_definition.occurring_days\n dob = profile.kids_type.birthdate.to_date\n dob + (ae_definition.occurring_days + ae_definition.due_by_days )\n end", "def adjust_order_end_dates(_patient, orders, optimized_hanging_pills)\n orders.each do |order|\n drug_order = order.drug_order\n drug = drug_order&.drug\n next unless drug_order && drug\n\n next unless drug&.tb_drug? && optimized_hanging_pills[drug.id]\n\n hanging_pills = optimized_hanging_pills[drug.id]&.to_f\n\n additional_days = (hanging_pills / order.drug_order&.equivalent_daily_dose || 0).to_i\n next unless additional_days >= 1\n\n order.void_reason = order.auto_expire_date\n # We assume the patient starts taking drugs today thus we subtract one day\n order.auto_expire_date = order.start_date + (additional_days + drug_order.quantity_duration - 1).days\n\n order.save\n drug_order.save\n end\n end", "def perform()\n # Booking.where('enddate <?',d)\n @bookings = Booking.where('enddate <?',Date.today.strftime)\n\n @bookings.each do |book|\n \tBooking.delete(book.id)\n end\n end", "def is_expired?\n self.end_date < DateTime.now\n end", "def create_calendar_dates(interval, ed_org_id)\n calendar_dates = []\n begin_date = interval.get_begin_date\n end_date = interval.get_end_date\n holidays = interval.get_holidays\n (begin_date..end_date).step(1) do |date|\n if DataUtility.rand_float_to_int(@prng, @scenarioYAML['HACK_PERCENTAGE_CALENDAR_DATES'] || 1) > 0\n if holidays.include?(date)\n calendar_dates << {\"date\" => date, \"event\" => :HOLIDAY, \"ed_org_id\" => ed_org_id}\n else\n calendar_dates << {\"date\" => date, \"event\" => :INSTRUCTIONAL_DAY, \"ed_org_id\" => ed_org_id} if date.wday != 0 and date.wday != 6\n end\n end\n end\n calendar_dates\n end", "def delete_enrollments(enrollment_scope=self.enrollments)\n courses_to_update = enrollment_scope.active.distinct.pluck(:course_id)\n Enrollment.suspend_callbacks(:set_update_cached_due_dates) do\n enrollment_scope.preload(:course, :enrollment_state).each{ |e| e.destroy }\n end\n user_ids = enrollment_scope.pluck(:user_id).uniq\n courses_to_update.each do |course|\n DueDateCacher.recompute_users_for_course(user_ids, course)\n end\n end", "def save_expiry_date_period(month, year, day, product_id, part_number)\n\n \t# First we check if the date is already in the table\n \tif(Calendar.where(year: year, month: month).blank?)\n \t c = Calendar.new(year: year, month: month)\n \t c.info = get_info(day, product_id, part_number)\n \t c.save\n \telse\n \t c = Calendar.where(month: month, year: year)\n \t string = c.info\n \t c.info = get_info(day, product_id, part_number, string)\n \t c.info.save\n \tend\n end", "def must_pay_to_avoid_cancellation\n\t\tif @event.start_date < (Time.now + 1.week) && @event.paid == false \n\t\t\t#cannot book event\n\t\tend\n\tend", "def extend_empty_end_date\n if self.end_date == self.start_date && !self.repeat_mode.rule.empty?\n self.end_date = Date.today + 10.year\n end\n return self\n end", "def insurance_dates_validator\n errors.add(:end_date, 'cannot be before start date.') if start_date > end_date\n end", "def safe_initial_application_dates(status)\n case status\n when :draft, :enrollment_open\n if TimeKeeper.date_of_record.month == 11 && TimeKeeper.date_of_record.day < 16\n current_effective_date TimeKeeper.date_of_record.beginning_of_month\n else\n current_effective_date (TimeKeeper.date_of_record + 2.months).beginning_of_month\n end\n when :enrollment_closed, :enrollment_eligible, :enrollment_extended\n current_effective_date (TimeKeeper.date_of_record + 1.months).beginning_of_month\n when :active, :terminated, :termination_pending, :expired\n current_effective_date (TimeKeeper.date_of_record - 2.months).beginning_of_month\n end\n end", "def mark_complete\n self.recorded_on ||= Date.today\n self.update_column(:cleared_on, Date.today)\n if self.lender\n self.lender.calculate_days_to_complete!\n end\n\t\tunless self.job.open_products.where.not(id: self.id).count > 0\n\t\t\tself.job.mark_complete! if self.job.can_mark_complete?\n\t\tend\n\tend", "def create_or_update_booking_dates\n if check_in_changed? || check_out_changed?\n # Delete all booking dates if check in or check out changed\n booking_dates.delete_all\n # Adding all the dates of the check_in and check_out range into the reserved dates\n (check_in..check_out).each do |reserved_date| \n # Createing booking dates with specified reserved_date\n booking_dates.create(reserved_date: reserved_date)\n end\n end\n end", "def update_end_date(ds)\n actual_duration = (self.end_date - self.start_date).to_i\n days_worked = self.advance_percentage / 100.0 * (actual_duration) \n if delay_end(end_date + ds.days)\n self.update(advance_percentage: (days_worked / (actual_duration + ds) * 100).to_i)\n dependent_tasks_id = Precedent.where(predecessor_id: id).pluck(:dependent_id)\n dependent_tasks_id.each do |t_id|\n Task.find(t_id).update_start_date(end_date)\n end\n # else \n # if advance(end_date + ds.days)\n # dependent_tasks_id = Precedent.select(:dependent_id).where(predecessor_id: id)\n # dependent_tasks_id.each do |t_id|\n # t = Task.find(t_id)\n # end\n # end\n end\n end", "def days_remaining\n enrollment.days_to_due_date - 1\n end", "def calendar_open\n\t\tcal=Calendar.where(:anio => Date.parse(desde.to_s).year,:department_id => Employee.find(employee_id).department.id).first\n\t\tif cal.nil? || cal.status!=true\n\t\t\t\terrors.add(:desde,\"El calendario para las fechas seleccionadas esta cerrado por su auditor.\")\n\t\tend\n\tend", "def get_end_date\n \n \nend", "def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end", "def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end", "def schedulable?(start_date, end_date)\n !scheduled?(start_date - lead_days, end_date)\n end", "def end_previous_assignment\n if self.employee.current_assignment != nil then \n current = self.employee.current_assignment\n current.end_date = self.start_date\n current.save!\n end\n end", "def get_all_paydates_on_days(start_date, end_date, valid_days)\r\n #end the range here instead of end_date so that any payday failling between end_date and this will be included, which will then get paid inside start_date...end_date\r\n first_valid_payday_outside_range = get_next_valid_paydate(end_date)\r\n\r\n result = (start_date..first_valid_payday_outside_range).to_a.select! {|day| is_corresponding_paydate?(valid_days, day)}\r\n result.map! {|day| get_last_valid_paydate(day)}\r\n result.keep_if {|day| (start_date...end_date).cover?(day) }\r\n end", "def can_be_deactivated?\n active? && end_date && actionable_date && actionable_date > end_date\n end", "def destroy\n\n u = @current_user.id\n d = DateTime.strptime(params[:date], '%s')\n s = params[:id]\n\n e = Enrollment.find_by user_id: u, date: d, schedule_id: s\n\n if e.present?\n e.destroy\n end\n\n redirect_to bookings_path\n\n end", "def check_overlaps_cargo_department\n\t\t# if some day of availabilityes overlaps whith new period availability.\t\n\t\tav=Availability.where(:department_id => department_id).where('upper(cargo) like ?',\"#{cargo.upcase}\")\n\t\t\t.where(\"((desde - ?) * (? - hasta)) >= 0\", hasta, desde).where(:status => true)\n\n\t\tif av.count>0 # availabilit\n\t\t\t\t\terrors.add(:cargo,\" Ya existe un periodo de disponibilidad mínima para el cargo: '#{cargo}' cuyas fechas coinciden.\")\t\n\t\tend\n\tend", "def edad\n hoy = Date.today\n hoy.year - fecha_de_nacimiento.year -\n ((hoy.month > fecha_de_nacimiento.month ||\n (hoy.month == fecha_de_nacimiento.month && hoy.day >= fecha_de_nacimiento.day)) ? 0 : 1)\n end", "def unavailable_dates\n errors[:base] << \"Unavailable dates.(-1)\" if start_date.present? && start_date < Time.zone.today\n errors[:base] << \"Unavailable dates.(-2)\" if (start_date.present? && end_date.present?) && start_date >= end_date\n errors[:base] << \"Unavailable dates.(-3)\" if (start_time.present? && end_time.present?) && start_time >= end_time\n errors[:base] << \"Unavailable dates.(-4)\" if (day_of_week.present? && week_of_month.present?) && ([0,1].exclude?(day_of_week) && week_of_month == 6)\n end", "def validate\n if self.start_date.present? && self.due_date.present?\n errors.add_to_base :start_date_cant_be_after_due_date if self.start_date > self.due_date\n # errors.add_to_base :start_date_cant_be_after_due_date if self.start_date > self.due_date\n # errors.add_to_base :end_date_cant_be_after_due_date if self.end_date > self.due_date\n if self.financial_year_id == '0'\n if (FinancialYear.last(:conditions => [\"start_date BETWEEN ? AND ? OR end_date BETWEEN ? AND ?\",\n self.start_date, self.due_date, self.start_date, self.due_date])).present?\n\n end\n self.financial_year_id = nil\n elsif self.financial_year_id.present?\n fy = FinancialYear.find_by_id(self.financial_year_id)\n errors.add_to_base :financial_year_must_be_set unless fy.present?\n errors.add_to_base :date_range_must_be_within_financial_year if fy.present? and\n !(self.start_date >= fy.try(:start_date) && self.due_date <= fy.try(:end_date))\n else\n # errors.add_to_base :financial_year_must_be_set\n end\n else\n\n end\n end", "def edate()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Edate::EdateRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def remaining_days\n self.paid_through - Date.today\n end", "def create\n @availability = Availability.new(params[:availability])\n @availability.user= current_user\n \n\n @availability.begin = @availability.begin.change(:day => params[:availability][:begin], :month => 4, :year => 2012)\n @availability.end = @availability.end.change(:day => params[:availability][:end], :month => 4, :year => 2012)\n\n respond_to do |format|\n if @availability.save\n format.html { redirect_to @availability.user, notice: 'Availability was successfully created.' }\n format.json { render json: @availability, status: :created, location: @availability }\n else\n format.html { render action: \"new\" }\n format.json { render json: @availability.errors, status: :unprocessable_entity }\n end\n end\n end", "def safe_application_effective_on(status)\n case status\n when :draft, :enrollment_open\n current_effective_date((TimeKeeper.date_of_record + 2.months).beginning_of_month)\n when :enrollment_closed, :enrollment_eligible, :enrollment_extended\n current_effective_date((TimeKeeper.date_of_record + 1.months).beginning_of_month)\n when :active, :terminated, :termination_pending, :expired\n if TimeKeeper.date_of_record.month > 10\n current_effective_date(TimeKeeper.date_of_record.beginning_of_month.prev_year)\n else\n current_effective_date((TimeKeeper.date_of_record + 2.months).beginning_of_month.prev_year)\n end\n end\n end", "def add_to_dates(start_date, end_date, new_occupancy)\n current_date = start_date.dup\n \n until current_date == end_date\n date_obj = find_date(current_date)\n \n if date_obj \n date_obj.add_occupancy(new_occupancy)\n else\n new_date_obj = Hotel::Date.new(current_date)\n @dates << new_date_obj\n new_date_obj.add_occupancy(new_occupancy)\n end\n \n current_date += 1\n end\n end", "def puede_coger_vacaciones\n if start_time.past?\n errors.add(:pasado, \": aun no inventamos vacaciones al pasado\")\n end\n\n if empleado.periodo_vacacionals.count > 0\n if empleado.periodo_vacacionals.count > 1\n errors.add(:periodos, \": tienes demasiados\")\n else\n primer_periodo = empleado.periodo_vacacionals.first\n dias_restantes = (primer_periodo.end_time - primer_periodo.start_time).to_int\n if dias_restantes < 8\n errors.add(:dias, \": has pedido demasiados\")\n end\n end\n\n acts_en_periodo = empleado.actividads\n .where(\"start_time <= ?\", end_time)\n .where(\"end_time >= ?\", start_time)\n .where(finalizado: false)\n .count\n\n vacs_en_periodo = empleado.periodo_vacacionals\n .where(\"start_time <= ?\", end_time)\n .where(\"end_time >= ?\", start_time)\n .count\n\n if acts_en_periodo > 0 && vacs_en_periodo > 0\n errors.add(:tareas, \": tienes tareas pendientes esas fechas\")\n end\n end\n end", "def expired?(range: :now)\n return false unless persisted?\n return false if cancelled? || archived? || complete?\n case range\n when :all\n !!(start_date <= Time.now && end_date <= Time.now)\n else\n !!(start_date <= Time.now)\n end\n end", "def delete\n @free_day = @free_days.first :date => params[:date]\n if @free_day && @free_day.destroy\n render_success \"Vacation at #{params[:date]} was removed\"\n else\n render_failure \"Couldn't remove vacation\"\n end\n end", "def invalid_dates\n self.listing.reservations.each do |reservation|\n existing_reservations = reservation.checkin..reservation.checkout \n if existing_reservations.include?(self.checkin) || existing_reservations.include?(self.checkout)\n errors.add(:checkin_taken, \"The date is already taken\")\n end\n end \n end", "def days_left\n if hw_coverage_end_date.present?\n diff = hw_coverage_end_date.to_date - Time.now.to_date\n diff.to_i\n end\n end", "def days_left\n if hw_coverage_end_date.present?\n diff = hw_coverage_end_date.to_date - Time.now.to_date\n diff.to_i\n end\n end", "def working_days_after(start_date, num_working_days)\n start_date = to_date(start_date)\n populate_public_holiday_collection_for_year(start_date.year)\n working_days_offset(start_date, num_working_days, :forward)\n end", "def in_force?\n if self.effective_date.nil?\n false\n elsif self.termination_date.nil?\n Date.today >= effective_date\n else\n Date.today >= effective_date and Date.today < termination_date\n end\n end", "def effective_end_date_has_passed\n if effective_end_date.present? && (effective_end_date > Time.zone.now)\n errors.add(:effective_end_date, 'must be in the past')\n end\n end", "def selected_company_invoice_dates\n company = Company.find(params[:company_id])\n if company.billingdate \n end_month = Time.zone.now.to_date.month.to_i\n @end_date = (company.billingdate.to_date - ((company.billingdate.to_date.month.to_i - end_month.to_i)).months).to_date\n @start_date = (company.billingdate.to_date - ((company.billingdate.to_date.month.to_i + 1 - end_month.to_i)).months).to_date + 1.days\n else\n render :nothing=>true\n end\n end", "def holiday_available(staff)\n\t\t@staff = staff\n\t\t@used_days = 0\n\t\t@remaining = 0\n\t\t@allowance = current_holiday_entitlement_id(@staff).try(:holiday_days)\n\t\tused = Holiday.joins('LEFT OUTER JOIN leave_types ON holidays.leave_type_id = leave_types.id').select('distinct leave_types.title, leave_types.paid, holidays.start_date, holidays.end_date').where(\"holidays.staff_id = ? AND holidays.start_date >= ? AND holidays.end_date <= ? AND leave_types.paid = ?\", @staff.id, current_holiday_entitlement_id(@staff).holiday_year_start, current_holiday_entitlement_id(@staff).holiday_year_end, true)\n\t\tused.each do |h|\n\t\t\tdate1 = Date.parse(h.start_date.strftime(\"%Y-%m-%d\"))\n\t\t\tdate2 = Date.parse(h.end_date.strftime(\"%Y-%m-%d\"))\n\t\t\t@used_days = @used_days + date1.business_days_until(date2).to_i\n\t\tend\n\t\t@remaining = @allowance - @used_days\n\t\t@remaining\t\t\n\tend", "def potential_working_days(start_date, end_date)\n days_worked = (start_date..end_date).select do |day|\n day = day.strftime(\"%A\").downcase.to_sym\n works_on?(day)\n end\n days_worked.count\n end", "def time_period_for_room_reservation\n time_period = (self.start_date.year * 12 + self.start_date.month) - (Date.today.year * 12 + Date.today.month)\n errors.add(:start_date, \"you can book your room before 6 months only\") if time_period > 6\n end", "def edutor_jobs\n if params[:start_date] and params[:end_date]\n @jobs = Job.where(\"startdate > :s and enddate < :e and hostname = :h\", :s=>params[:start_date].to_datetime,:e=>params[:end_date].to_datetime.next,:h=>\"M6650M453\").order('jobid desc')\n else\n @jobs = edutor_latest_jobs\n end\n end", "def check_dates\n calendar = Line.find(self.line_id).calendar\n\n # check empty fields\n if self.start_month.nil? \n unless self.start_date.nil?\n errors.add(:start_date, \"can't be filled if month is empty\")\n end \n else\n if self.start_month <= calendar.months.count\n unless self.start_date <= max_days = calendar.months.find_by(number: self.start_month).days_normal\n errors.add(:start_date, \"can't exceed number of days in the month (#{max_days})\")\n end\n else\n errors.add(:start_month, \"can't be greater than number of months (#{calendar.months.count})\")\n end\n\n end\n\n if self.end_month.nil? \n unless self.end_date.nil?\n errors.add(:end_date, \"can't be filled if month is empty\")\n errors.add(:end_month, \"must not be empty\")\n end \n else\n if self.end_year.nil?\n errors.add(:end_month, \"can't be filled if year is empty\")\n errors.add(:end_year, \"must not be empty\")\n else\n if self.end_year < self.start_year\n errors.add(:end_year, \"can't precede start year\")\n end\n end\n\n if self.end_month <= calendar.months.count\n if self.end_month < self.start_month\n errors.add(:end_month, \"can't precede start month\")\n end\n\n unless self.end_date.nil?\n if self.end_date > max_days = calendar.months.find_by(number: self.end_month).days_normal\n errors.add(:end_date, \"can't exceed number of days in the month (#{max_days})\")\n else\n if self.end_date < self.start_date\n errors.add(:end_date, \"can't precede start date\")\n end\n end\n end\n else\n errors.add(:end_month, \"can't be greater than number of months (#{calendar.months.count})\")\n end\n \n end\n end", "def incomplete\n # check if an individual rep, complete reps of day if not\n if self.rep_parent.nil?\n self.repititions.\n where(:show_date => Date.current).each do |rep|\n rep.incomplete\n end\n return\n end\n\n if self.state == Activity::COMPLETE\n # only set as incomplete if before expiration\n if self.expiration_date.nil? or \n self.expiration_date >= Date.current \n self.state = Activity::INCOMPLETE\n else\n self.state = Activity::EXPIRED\n end\n self.completed_date = nil\n self.save!\n self.rep_parent.count = self.rep_parent.count - 1\n self.rep_parent.save!\n end\n end", "def test_end_date_after_start_date\r\n @moderated_search.start_date = Date.today\r\n @moderated_search.end_date = Date.tomorrow\r\n @moderated_search.cobrand_id = Cobrand.root.id\r\n @moderated_search.save\r\n \r\n assert @moderated_search.errors.size == 0\r\n end", "def update_occurrences\n occurrences.destroy_all\n if recurrence_rules.any?\n recurrence_horizon = Time.now + (Radiant::Config['event_calendar.recurrence_horizon'] || 10).to_i.years\n to_ri_cal.occurrences(:before => recurrence_horizon).each do |occ|\n occurrences.create!(self.attributes.merge(:start_date => occ.dtstart, :end_date => occ.dtend, :uuid => nil)) unless occ.dtstart == self.start_date\n end\n end\n end", "def remove_depricated\n self.articles.each do |a|\n unless ((a.created_at + 3.days) > Date.today) \n self.articles.delete(a)\n end\n end\n\tend", "def calendar_updation\n\t\tcommit = params[:body][:commit]\n\t\tp \"$$$$$$$$$$$$$$$$$$$$$$$$\"\n\t\tp commit\n\t\tdate=[]\n\t\t@date=params[:body][:date]\n\t\t@property_type=params[:body][:property_type]\n\t\tcase commit\n\t\t\twhen \"Booked\"\n\t\t\t@date.each do|date|\n\t\t @room_booking = RoomBooking.new(:room_id=>@property_type,:check_in=>date.to_date, :check_out=>date.to_date)\n\t\t\t @room_booking.is_accepted=true\n\t\t @room_booking.save\n\t\t\tend\n\t\t\t render :json=>{:response=>\"Booked\"}\n\t\t when \"Available\"\n\t\t\t@date.each do|date|\n\t\t @room_booking = RoomBooking.new(:room_id=>@property_type,:check_in=>date.to_date, :check_out=>date.to_date)\n \t\t\t@room_booking.is_accepted=false\n\t\t\t\t@room_booking.save\n\t\t\tend\n\t\t\t render :json=>{:response=>\"Available\"}\n\t\t when \"Un-Available\"\n\t\t\t@date.each do|date|\n\t\t @room_booking = RoomBooking.new(:room_id=>@property_type,:check_in=>date.to_date, :check_out=>date.to_date)\n\t\t\t\t@room_booking.is_unavailable=true\n\t\t\t\t@room_booking.save\n\t\t\tend\n\t\t\trender :json=>{:response=>\"Un-Available\"}\n\t\tend\n\tend", "def length_of_stay\n (self.date_end.to_date - self.date_start.to_date).to_i - 1\n end", "def destroy\n @user_day = UserDay.find(params[:id])\n @allowance = @user_day.user.get_holiday_allowance_for_dates Date.today, Date.today\n @allowance.days_remaining -= @user_day.no_days\n @user_day.destroy\n @allowance.save\n respond_to do |format|\n format.html { redirect_to(user_days_url) }\n format.xml { head :ok }\n end\n end", "def valid_dates\n device_request = DeviceRequest.find(device_request_id)\n current_date = Date.today\n if self.on_date.present?\n self.errors.add :on_date, \"Quotation date can't be future\" if self.on_date > current_date\n self.errors.add :on_date, \"Quotation date should be onwards #{device_request.on_date}\" if self.on_date < device_request.on_date\n end\n end", "def committed_days\n @committed_days ||= begin\n days = []\n items.each do |item|\n self.class.committed?(item) && \n days << Time.zone.parse(item['created_at']).to_date\n end\n days.uniq!\n days\n end\n end" ]
[ "0.64424163", "0.627514", "0.59605473", "0.58377886", "0.5809442", "0.5705934", "0.56759226", "0.56735575", "0.5672888", "0.56650317", "0.5657773", "0.56558424", "0.56329674", "0.56061536", "0.55992657", "0.5579513", "0.55788326", "0.5573325", "0.5560626", "0.5548161", "0.5546638", "0.5546638", "0.55464596", "0.5540666", "0.5527864", "0.55127734", "0.55079556", "0.54943216", "0.5468057", "0.5457363", "0.54562557", "0.5448612", "0.5448298", "0.5447131", "0.54453945", "0.54436064", "0.5432955", "0.5428025", "0.542589", "0.5425342", "0.5422354", "0.54190105", "0.5416971", "0.5396388", "0.53950953", "0.5394209", "0.53902614", "0.5381529", "0.5381302", "0.5375989", "0.536938", "0.53688675", "0.53644085", "0.5359006", "0.5348677", "0.53475654", "0.5344969", "0.5339431", "0.5332753", "0.531866", "0.5317306", "0.53108263", "0.53108263", "0.53108263", "0.53056085", "0.5298803", "0.5294189", "0.5292804", "0.5290643", "0.5289548", "0.5289372", "0.5287897", "0.52838635", "0.52760357", "0.5273842", "0.52699953", "0.5264543", "0.52632654", "0.5263095", "0.52614486", "0.52532905", "0.52510655", "0.52510655", "0.5248311", "0.52433795", "0.5237592", "0.5236836", "0.52354217", "0.5227891", "0.52140546", "0.52122957", "0.5202345", "0.51998925", "0.5197776", "0.51954824", "0.5189086", "0.51842654", "0.5183647", "0.5179099", "0.5176373", "0.51759166" ]
0.0
-1
Este test estaba antes cuando habia objetos que salian de new y objetos que salian de new_mock Podriamos borrarlo
def testear_que_no_se_ensucia_la_clase_mockeada PersonalHome.mockear(:cantidad_personas) do 100 end respuesta = PersonalHome.new.cantidad_personas respuesta.deberia ser 100 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_object\n sut.send(:new)\n end", "def test_new_creates_something\n @response = MnemeAPIResponse.new(@@empty_response)\n refute_nil @response, \"get object\"\n refute_nil @@testFileDir, \"locate test file directory\"\n end", "def stubs_create()\n Usuario.stub!(:find_by_ci).with(anything()).and_return(mock_model(Usuario, :nombre_completo => '', :ci => ''))\n Registro.stub!(:new).with(kind_of(Hash)).and_return(mock_registro(:save => true, :tipo_print => '', :created_at => ''))\n Registro.stub!(:new).and_return(mock_registro())\n I18n.stub!(:l).with(anything(), kind_of(Hash)).and_return(\"\")\n end", "def stubs_create_wrong()\n Usuario.stub!(:find_by_ci).with(anything()).and_return(nil)\n Registro.stub!(:new).and_return(mock_registro())\n I18n.stub!(:l).with(anything(), kind_of(Hash)).and_return(\"\")\n end", "def test_new\n\t\tassert_instance_of(Panneau,@panNoPlace,\"Erreur classe d'instance panneau\")\n\t\tassert_equal(0,@panNoPlace.placeUsed,\"Erreur texte du panneau\")\n\t\tassert_equal(0,@panNoPlace.placeTot,\"Erreur texte du panneau\")\n\t\t\n\t\tassert_instance_of(Panneau,@pan,\"Erreur classe d'instance panneau\")\n\t\tassert_equal(0,@pan.placeUsed,\"Erreur texte du panneau\")\n\t\tassert_equal(3,@pan.placeTot,\"Erreur texte du panneau\")\n\tend", "def test_handler(parameters, identifier, obj_name, create_object)\n m = MockTimeSync.new\n case obj_name\n\n when 'time'\n if create_object\n # return mock_rimesync.create_time(parameters)\n return m.create_time(parameters)\n else\n # return mock_rimesync.update_time(parameters, identifier)\n return m.update_time(parameters, identifier)\n end\n when 'project'\n if create_object\n # return mock_rimesync.create_project(parameters)\n return m.create_project(parameters)\n else\n # return mock_rimesync.update_project(parameters, identifier)\n return m.update_project(parameters, identifier)\n end\n when 'activity'\n if create_object\n # return mock_rimesync.create_activity(parameters)\n return m.create_activity(parameters)\n else\n # return mock_rimesync.update_activity(parameters, identifier)\n return m.update_activity(parameters, identifier)\n end\n when 'user'\n if create_object\n # return mock_rimesync.create_user(parameters)\n return m.create_user(parameters)\n else\n # return mock_rimesync.update_user(parameters, identifier)\n return m.update_user(parameters, identifier)\n end\n end\n end", "def test_new\n\t\tassert_instance_of(Acces, @acces, \"Erreur creation acces\")\n\tend", "def test_multiples_non_objectable_types_with_default_new_method\n cat1 = 'Amelia'\n cat2 = 'Gorbypuff'\n cats = [cat1, cat2]\n test_object = ObjTestClasses::TestObject.new(menagerie: cats)\n\n test_object.menagerie.each do |animal|\n assert_instance_of(ObjTestClasses::Cat, animal)\n end\n\n cats.each do |cat|\n assert_includes(test_object.menagerie, ObjTestClasses::Cat.new(cat))\n end\n end", "def setup\n flexmock(Woofer).new_instances.should_receive(:woof => :grrr)\n end", "def test_new\n quote_details = SAMPLE_QUOTE_DETAILS.deep_dup\n quote_details['fixed_price_services_requested']['price'] = 1200\n params_hash = {\n udprn: SAMPLE_UDPRN,\n services_required: SAMPLE_SERVICES_REQUIRED,\n payment_terms: SAMPLE_PAYMENT_TERMS,\n quote_details: quote_details.to_json\n }\n first_params_hash = params_hash.deep_dup\n first_params_hash[:quote_details] = SAMPLE_QUOTE_DETAILS.to_json\n post :new_quote_for_property, first_params_hash\n prev_quote_count = Agents::Branches::AssignedAgents::Quote.count\n post :new, params_hash\n assert_response 200\n assert_equal Agents::Branches::AssignedAgents::Quote.count, (prev_quote_count + 1)\n end", "def test_new_creates_something\n @response = CToolsDirectResponse.new(@@empty_response, Hash.new)\n refute_nil @response, \"get connector object\"\n refute_nil @@testFileDir, \"locate test file directory\"\n end", "def test_add_resource_hillman\n driver = Minitest::Mock.new(\"Driver\")\n location = Minitest::Mock.new(\"Location\")\n def location.name; \"Hillman\"; end\n driver.expect :add_book, nil\n @c.add_resource(driver, location)\n assert_mock driver\n end", "def as_new_record\n instance.stubs(:new_record?).returns(true)\n end", "def test_create\n create_new_objects\n assert_kind_of(Observation, observations(:minimal_unknown_obs))\n assert_kind_of(Observation, @cc_obs)\n assert_kind_of(Naming, namings(:minimal_unknown_naming))\n assert_kind_of(Naming, @cc_nam)\n assert_save(@cc_obs)\n assert_save(@cc_nam)\n end", "def test_car\n new_car = Car.new :make => cars(:new_car).make,\n :model => cars(:new_car).model,\n :Vin => cars(:new_car).Vin,\n :created_at => cars(:new_car).created_at\n assert new_car.save\n\n end", "def add_stack_mocks(obj)\n allow(obj).to receive(:read_template).and_return(MOCK_TEMPALTE)\nend", "def __mock_reset; end", "def test_add_resource_museum\n driver = Minitest::Mock.new(\"Driver\")\n location = Minitest::Mock.new(\"Location\")\n def location.name; \"Museum\"; end\n driver.expect :add_dino, nil\n @c.add_resource(driver, location)\n assert_mock driver\n end", "def test_note\n instance = Note.create('Link')\n assert_equal('Link', instance.class.name)\n\n Note.stub(:input_index, 1) do\n instance = Note.create\n assert_equal('Task', instance.class.name)\n end\n end", "def test_new\n assert( @p != nil, \"New failed: #{@p}\" )\n end", "def mock_model(model,method,expected)\n expected=case\n# See ActiveRecord::Base method, '==='. Another way is to use object_id:\n when DirectoryPicture==model then Picture\n when FileTag ==model then Tag\n end.all.map &method if :all==expected\n model.expects(:all).at_least_once.returns(expected.sort.reverse.\n map{|e| (p=model.new).expects(method).at_least_once.returns e; p} )\n end", "def test_new\n assert_raises(NoMethodError) do\n Tigger.new\n end\n end", "def create_mock( name )\n return flexmock( name )\n\tend", "def test_add_resource_cathedral\n driver = Minitest::Mock.new(\"Driver\")\n location = Minitest::Mock.new(\"Location\")\n def location.name; \"Cathedral\"; end\n driver.expect :add_class, nil\n @c.add_resource(driver, location)\n assert_mock driver\n end", "def new\n @smoke_test = SmokeTest.new\n # package builders\n @smoke_test.build_nova_package_builder\n @smoke_test.nova_package_builder.merge_trunk = false\n @smoke_test.build_glance_package_builder\n @smoke_test.glance_package_builder.merge_trunk = false\n @smoke_test.build_keystone_package_builder\n @smoke_test.keystone_package_builder.merge_trunk = false\n @smoke_test.build_swift_package_builder\n @smoke_test.swift_package_builder.merge_trunk = false\n @smoke_test.build_cinder_package_builder\n @smoke_test.cinder_package_builder.merge_trunk = false\n @smoke_test.build_neutron_package_builder\n @smoke_test.neutron_package_builder.merge_trunk = false\n @smoke_test.build_ceilometer_package_builder\n @smoke_test.ceilometer_package_builder.merge_trunk = false\n @smoke_test.build_heat_package_builder\n @smoke_test.heat_package_builder.merge_trunk = false\n\n # config modules\n @smoke_test.build_nova_config_module\n @smoke_test.nova_config_module.merge_trunk = false\n @smoke_test.build_glance_config_module\n @smoke_test.glance_config_module.merge_trunk = false\n @smoke_test.build_keystone_config_module\n @smoke_test.keystone_config_module.merge_trunk = false\n @smoke_test.build_swift_config_module\n @smoke_test.swift_config_module.merge_trunk = false\n @smoke_test.build_cinder_config_module\n @smoke_test.cinder_config_module.merge_trunk = false\n @smoke_test.build_neutron_config_module\n @smoke_test.neutron_config_module.merge_trunk = false\n @smoke_test.build_ceilometer_config_module\n @smoke_test.ceilometer_config_module.merge_trunk = false\n @smoke_test.build_heat_config_module\n @smoke_test.heat_config_module.merge_trunk = false\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @smoke_test }\n format.xml { render :xml => @smoke_test }\n end\n end", "def test_new\n # clone\n browser = Browser.new :name => browsers(:first).name,\n :path => browsers(:first).path,\n :selenium_name => browsers(:first).selenium_name\n # Non-unique name should fail a save\n assert !browser.save\n browser.name = \"Test\"\n\n # working save\n assert browser.save\n\n assert browser == Browser.find(browser.id)\n\n assert browser.created_on = \"2008-10-02 17:23:43\"\n\n # test update\n assert browser.update\n\n assert browser.destroy\n end", "def test_should_create_post\n Post.any_instance.stubs(:save).returns(true)\n Post.any_instance.stubs(:id).returns(1)\n Post.any_instance.stubs(:to_param).returns(\"1\")\n Post.any_instance.stubs(:new_record?).returns(false)\n post :create, :post => { }\n assert_redirected_to post_path(assigns(:post))\n end", "def test_new_location_mock_zero\r\n random = Minitest::Mock.new(\"test_random\")\r\n def random.rand(num); 5; end\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.neighbor_count(index); 0; end\r\n def location.find_neighbor(index, new_index); 2; end\r\n assert_equal 2, @g.new_location(0, random, location)\r\n end", "def test_campfire_room_method\n assert_nothing_raised do\n room = mock()\n g = God::Contacts::Campfire.new\n g.instance_variable_set(:@room,room)\n assert_equal g.send(:room), room\n end\n end", "def test_create_my_cars\n assert_equal(@test_car.speed, 0, 'Speed of new car should be 0')\n assert_equal(MyCar.new.model, '')\n assert_equal(MyCar.new.year, 1999)\n assert_equal(MyCar.new.color, 'primer')\n assert_equal(MyCar.new(model:TEST_CAR_MODEL).model, TEST_CAR_MODEL)\n assert_equal(MyCar.new(year:TEST_CAR_YEAR).year, TEST_CAR_YEAR)\n assert_equal(MyCar.new(color:TEST_CAR_COLOR).color, TEST_CAR_COLOR)\n end", "def test_change_curr_location_any\n \tlocation_stub = Minitest::Mock.new('Mock Location')\n \tpro = Prospector.new(1)\n \tdef location_stub.loc\n \"Laboon Lake\"\n end\n def location_stub.max_rubies\n 1\n end\n def location_stub.max_fake_rubies\n 1\n end\n def location_stub.neighbor_list\n [\"Sean's Bowser Castle\", \"Kitty's Cozy Condo\"]\n end\n pro.change_curr_location(location_stub)\n assert pro.curr_location.loc == \"Laboon Lake\"\n assert pro.curr_location.max_rubies == 1\n assert pro.curr_location.max_fake_rubies == 1\n assert pro.curr_location.neighbor_list.length == 2\n assert pro.curr_location.neighbor_list.include? \"Sean's Bowser Castle\"\n assert pro.curr_location.neighbor_list.include? \"Kitty's Cozy Condo\"\n end", "def test_clone_creates_a_different_object\n obj = Object.new\n copy = obj.clone\n\n assert_equal true, obj != copy\n assert_equal true, obj.object_id != copy.object_id\n end", "def test_new_rent\n quote_details = SAMPLE_QUOTE_DETAILS.deep_dup\n quote_details['fixed_price_services_requested']['price'] = 1200\n params_hash = {\n udprn: '123456',\n services_required: SAMPLE_SERVICES_REQUIRED,\n payment_terms: SAMPLE_PAYMENT_TERMS,\n quote_details: quote_details.to_json\n }\n first_params_hash = params_hash.deep_dup\n first_params_hash[:quote_details] = SAMPLE_QUOTE_DETAILS.to_json\n post :new_quote_for_property, first_params_hash\n prev_quote_count = Agents::Branches::AssignedAgents::Quote.count\n post :new, params_hash\n assert_response 200\n assert_equal Agents::Branches::AssignedAgents::Quote.count, (prev_quote_count + 1)\n end", "def test_create_new_test\n # Create a new template\n # Create three questions\n # Create a new test\n # Assert that method returns a hash\n\n create_template(\"Test Template\")\n template_id = find_last_template_id\n create_template_question(\"Question 1\", template_id)\n create_template_question(\"Question 2\", template_id)\n create_template_question(\"Question 3\", template_id)\n\n test = @db.create_new_test(template_id)\n assert_instance_of(Hash, test)\n\n delete_template(template_id)\n end", "def flexmock_created_mocks\n @flexmock_created_mocks ||= []\n end", "def test_add_location_name_already_used_cities_length\n loc = MiniTest::Mock.new(\"location 1\")\n def loc.name; @delegator; end\n @mp.add_location loc\n\n c2 = MiniTest::Mock.new(\"location 1\")\n def c2.name; @delegator; end\n @mp.add_location c2\n\n assert_equal 1, @mp.locations.length\n end", "def create_new_mocked_object(allocate_method, args, recorder, block)\n new_obj = flexmock_invoke_original(allocate_method, args)\n mock = flexmock_container.flexmock(new_obj)\n block.call(mock) unless block.nil?\n recorder.apply(mock)\n new_obj\n end", "def mock_browser_at_creation mock_browser = nil\n puts \"MOCKING BROWSER\"\n if mock_browser.nil?\n allow_any_instance_of(AdminModule::Pages).to receive(:browser).and_return(HardBrowserMock.new)\n else\n allow_any_instance_of(AdminModule::Pages).to receive(:browser).and_return(mock_browser)\n end\nend", "def skip_test_inmutable\n #they come fully loaded\n Status.load_inmutable_instances\n status1 = Status.where.all.sort_by { |s| s.code }\n status2 = Status.where.all.sort_by { |s| s.code }\n assert status1.length == 4\n assert status2.length == 4\n #same referencs\n status1.each_index do |i|\n assert status1[i].object_id==status2[i].object_id \n end\n\n #create a new object\n stt = Status.new(code: \"xx\", description: (\"xx\" + \" some desc\"))\n stt.save\n\n status1 = Status.where.all.sort_by { |s| s.code }\n status2 = Status.where.all.sort_by { |s| s.code }\n assert status1.length == 5\n assert status2.length == 5\n #same referencs\n status1.each_index do |i|\n assert status1[i].object_id==status2[i].object_id \n end \n\n status1.each do |st|\n assert st.code\n assert st.description\n end\n\n marr = Status.find(\"divorced\").first\n assert marr.code == \"divorced\"\n assert marr.description\n assert marr.object_id == status1.first.object_id\n\n people = Person.where.include(:name, status: [ :code, :description ]).all\n people.each do |p|\n assert p.status.object_id == status1.select { |st| st.id == p.status.id }.first.object_id\n assert p.status.code\n assert p.status.description\n end\n end", "def test_shovel \r\n new_todo = Todo.new('Walk the dog')\r\n @list << new_todo# TodoList object\r\n @todos << new_todo # array of Todo objects\r\n\r\n assert_equal(@todos, @list.to_a)\r\n end", "def test_prospect_move_no_neighbors\n \tlocation_stub = Minitest::Mock.new('Mock Location')\n \tpro = Prospector.new(1)\n \tdef location_stub.loc\n \"Laboon Lake\"\n end\n def location_stub.max_rubies\n 1\n end\n def location_stub.max_fake_rubies\n 1\n end\n def location_stub.neighbor_list\n []\n end\n pro.change_curr_location(location_stub)\n assert pro.curr_location.loc == \"Laboon Lake\"\n end", "def test_add_driver\n driver = Minitest::Mock.new \"Driver 1\"\n @c.add_driver(driver)\n assert_equal 1, @c.drivers.count\n end", "def test_driver_goes_to_other_place\r\n\t\tdriver = Driver.new(1)\r\n\t\tdriver.curr_location = \"Monroeville\"\r\n\t\tmock_driver = Minitest::Mock::new\r\n\t\tdef mock_driver.check_driver_done; 1; end\r\n\t\tdriver_status = driver.check_driver_done(driver)\r\n\t\tassert_equal driver_status, mock_driver.check_driver_done\r\n\tend", "def test_initialize_with_arguments\n assert_instance_of Product, Product.new(\"arg1\", \"arg2\")\n end", "def test_Cathedral_one_class\n\td = Minitest::Mock:: new \"Driver\"\n\tdef d.location; \"Cathedral\"; \n\tend\n\td.expect :numberOfClasses, 1\n\tdef d.numberOfClasses=(n); n;\n\tend\n\tassert_equal checkItems(d), 2\nend", "def mock_build(successful)\n project = new_mock\n project.__setup(:name) {\"TestProject\"}\n \n setup_changes\n revisions = RSCM::Revisions.new\n revisions.add(@change1)\n revisions.add(@change2)\n revisions.add(@change3)\n revisions.add(@change4)\n revisions.add(@change5)\n revisions.add(@change6)\n revisions.add(@change7)\n revisions.each{|revision| revision.project = project}\n \n build = new_mock\n build.__setup(:project) {project}\n build.__setup(:successful?) {successful}\n build.__setup(:revision) {revisions[3]}\n build.__setup(:status_message) {successful ? \"Successful\" : \"Failed\"}\n build\n end", "def test_new\n %w(email address twitter facebook google linkedin xing).each do |provider|\n get :new, :provider => provider\n assert_response :success\n assert_template 'new'\n assert assigns(:identity).new_record?\n assert assigns(:identity).kind_of?(Identity.provider(provider.to_sym))\n end\n end", "def test_Cathedral_four_classes\n\td = Minitest::Mock:: new \"Driver\"\n\tdef d.location; \"Cathedral\"; \n\tend\n\td.expect :numberOfClasses, 4\n\tdef d.numberOfClasses=(n); n;\n\tend\n\tassert_equal checkItems(d), 8\nend", "def test_new_location_low\r\n random = Minitest::Mock.new(\"test_random\")\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n assert_raises('Invalid Index!') { @g.new_location(-1, random, location) }\r\n end", "def test_add_invoice\n kwhite17 = members(:kwhite17)\n tank = members(:tank)\n invoices_expected = Array.new\n \n invoice1 = invoices(:one)\n group_purchase1 = group_purchases(:one)\n invoice1.group_purchase = group_purchase1\n invoice1.debtor = kwhite17\n invoice1.save\n\n invoices_expected.push(invoice1)\n\n assert_equal group_purchase1.invoices, invoices_expected, \"Test adding invoice\"\n \n end", "def mock_model(klass, stubs = {})\n @@model_id ||= 0\n id = ( @@model_id += 1 )\n m = mock(\"#{klass.name.underscore}_#{id}\")\n m.stubs(:id).returns(id)\n m.stubs(:to_param).returns(id.to_s)\n m.stubs(:class).returns(klass)\n m.stubs(:new_record?).returns(false)\n m.stubs(:is_a?).returns(false)\n m.stubs(:is_a?).with(klass).returns(true)\n m.stubs(:valid?).returns(true)\n m.stubs(:errors).returns( stub('errors', :count => 0) )\n m.stubs(stubs)\n m\n end", "def test_create_user_temperament\n @user.temperament = Temperament.new('Artisan','estp')\n @user.temperament = Temperament.new('Guardian','estj')\n @user.temperament = Temperament.new('Idealist','enfj')\n @user.temperament = Temperament.new('Rational','entj')\n end", "def growl(times)\n growl = mock(Growl)\n Growl.should_receive(:new).at_least(1).times.and_return(growl)\n growl.should_receive(:notify).exactly(times).times\nend", "def test_move\n mock_loc = Minitest::Mock.new \"mock_loc\"\n\tdef mock_loc.name;\"previous location\";end\n\tmock_loc2 = Minitest::Mock.new \"mock_loc2\"\n\tdef mock_loc2.name;\"next location\";end\n\tmap = Map.new\n\tmap.nodes = [mock_loc, mock_loc2]\n\tdummy_rng = Minitest::Mock.new(\"dummy_rng\")\n\tdef mock_loc.choose_neighbor(a);1;end\n p = Prospector.new(0, mock_loc, 0)\n\tp.move(dummy_rng, map)\n\tassert_equal mock_loc2, p.current_loc\n\tassert_equal 1, p.current_loc_id\n end", "def mock_model(model_class, options_and_stubs = {})\n null = options_and_stubs.delete(:null_object)\n stubs = options_and_stubs\n id = @@model_id\n @@model_id += 1\n m = mock(\"#{model_class.name}_#{id}\", :null_object => null)\n m.stub!(:id).and_return(id)\n m.stub!(:to_param).and_return(id.to_s)\n m.stub!(:new_record?).and_return(false)\n m.stub!(:errors).and_return(stub(\"errors\", :count => 0))\n m.send(:__mock_proxy).instance_eval <<-CODE\n def @target.is_a?(other)\n #{model_class}.ancestors.include?(other)\n end\n def @target.kind_of?(other)\n #{model_class}.ancestors.include?(other)\n end\n def @target.instance_of?(other)\n other == #{model_class}\n end\n def @target.class\n #{model_class}\n end\n CODE\n add_stubs(m, stubs)\n yield m if block_given?\n m\n end", "def test_add_account\r\n mocked_account_tracker = Minitest::Mock.new(\"test_account_tracker\")\r\n mocked_account_tracker.expect(:account_exists?, true, [\"123456\"])\r\n mocked_account_tracker.expect(:add_balance, 1, [\"123456\", 5])\r\n\r\n @g.add_account(mocked_account_tracker, \"123456\", 5)\r\n assert_mock mocked_account_tracker\r\n end", "def test_new_location_high\r\n random = Minitest::Mock.new(\"test_random\")\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n assert_raises('Invalid index!') { @g.new_location(7, random, location) }\r\n end", "def test_new\n\n # inputs.\n attr_in = @testee.param_attr( :in )\n assert_equal( [:param_in_real], attr_in )\n assert_equal( nil, @testee.param_in_real ) # check initial value.\n\n # options.\n attr_opt = @testee.param_attr( :opt )\n assert_equal( [:param_opt_in_fast_period,\n :param_opt_in_fast_ma_type,\n :param_opt_in_slow_period,\n :param_opt_in_slow_ma_type,\n :param_opt_in_signal_period,\n :param_opt_in_signal_ma_type], attr_opt )\n\n # outputs.\n attr_out = @testee.param_attr( :out )\n assert_equal( [:param_out_macd,\n :param_out_macd_signal,\n :param_out_macd_hist], attr_out )\n assert_equal( nil, @testee.param_out_macd )\n assert_equal( nil, @testee.param_out_macd_signal )\n assert_equal( nil, @testee.param_out_macd_hist )\n\n #\n tmp = [0.0, 1.0, 2.0]\n assert_raise(RuntimeError){ @testee.param_in_real( tmp ) }\n\n #\n #pp @testee.singleton_methods\n @testee.param_in_real = tmp\n assert_equal( tmp, @testee.param_in_real )\n\n ret = @testee.param_out_setting\n assert_equal( [nil,nil,nil], @testee.param_out_macd )\n assert_equal( { :param_out_macd => [nil,nil,nil],\n :param_out_macd_signal => [nil,nil,nil],\n :param_out_macd_hist => [nil,nil,nil],\n }, ret )\n\n\n end", "def test_Hillman_one_book\n\td = Minitest::Mock::new \"Driver\"\n\tdef d.location; \"Hillman\";\n\tend\n\td.expect :numberOfBooks, 1\n\tdef d.numberOfBooks=(n); n;\n\tend\n\tassert_equal checkItems(d), 2\nend", "def test_create\n\n admin_session = cathy_admin_session\n # Verify that a platform can be added. The number of platforms will\n # increase by one.\n assert_equal(5, Platform.count)\n\n new_platform = { 'active' => '1', 'name' => 'Thunderbird' }\n\n post(:create, { :new_platform => new_platform }, admin_session)\n assert_equal(6, Platform.count)\n assert_equal(\"Platform #{new_platform['name']} added\", flash['notice'])\n assert_redirected_to(:action => 'list')\n \n # Try to add a second platform with the same name.\n # It should not get added.\n post(:create, { :new_platform => new_platform }, admin_session)\n assert_equal(6, Platform.count)\n #assert_equal(\"Name has already been taken\", flash['notice'])\n assert_redirected_to(:action => 'add')\n\n\n # Try to add a platform withhout a name.\n # It should not get added.\n post(:create, { :new_platform => { 'active' => '1', 'name' => '' } }, admin_session)\n assert_equal(6, Platform.count)\n #assert_equal(\"Name can't be blank\", flash['notice'])\n assert_redirected_to(:action => 'add')\n\n end", "def test_it_can_create_a_new_invoice_when_sent_create_with_params\n previous_invoice_count = @instance.all.count\n customer1 = @instance.engine.customer_repository.find_by_id(1)\n merchant1 = @instance.engine.merchant_repository.find_by_id(1)\n item1 = @instance.engine.item_repository.find_by_id(1)\n item2 = @instance.engine.item_repository.find_by_id(2)\n @instance.create(customer: customer1,\n merchant: merchant1,\n status: \"shipped\",\n items: [item1, item1, item2])\n assert_equal previous_invoice_count + 1, @instance.all.count\n end", "def really_new\n return self.new\n end", "def test_get_location_no_exist\n (1..30).each do |i|\n location = MiniTest::Mock.new(\"location #{i}\")\n def location.name; @delegator; end\n @mp.add_location location\n end\n assert_nil @mp.get_location(\"test location\")\n end", "def newObject(tape, javaClass)\n\tm = SubMachine.stub \"newObject-#{tape},#{javaClass.name}\"\n\tm.simpleMerge scan(:objects, :right, BlankSymbol)\n\tm.simpleMerge scanBefore(:objects, :left, :loc)\n\tm.simpleMerge copy(:objects, tape)\n\tm.simpleMerge writeConstant(:ra, 1)\n\tm.simpleMerge add(tape, :ra)\n\tm.simpleMerge scan(:objects, :right, BlankSymbol)\n\tm.simpleMerge writeSymbol(:objects, :loc)\n\tm.simpleMerge copy(tape, :objects)\n\tm.simpleMerge moveDistance(:objects, BitWidth, :right)\n\n\tvars = Array.new\n\tclassObject = javaClass\n\twhile true\n\t\tclassObject.env.each_key{ |k|\n\t\t\tunless classObject.env[k].class == JavaVariable\n\t\t\t\tnext\n\t\t\tend\n\n\t\t\tunless vars.include? k\n\t\t\t\tvars.push k\n\t\t\tend\n\t\t}\n\n\t\tif classObject.env[:super]\n\t\t\tclassObject = $GlobalEnv[classObject.env[:super]]\n\t\telse\n\t\t\tbreak\n\t\tend\n\n\tend\n\n\n\tvars.each { |k|\n\n\t\tm.simpleMerge writeSymbol(:objects, k)\n\t\tm.simpleMerge writeConstant(:objects, 0)\n\t\tm.simpleMerge moveDistance(:objects, BitWidth, :right)\n\t}\n\n\tm.simpleMerge moveDistance(:objects, BitWidth, :left)\n\n\tm\nend", "def initialize(obj, mock, safe_mode)\n @obj = obj\n @mock = mock\n @method_definitions = {}\n @methods_proxied = []\n unless safe_mode\n add_mock_method(:should_receive)\n MOCK_METHODS.each do |sym|\n unless @obj.respond_to?(sym)\n add_mock_method(sym)\n end\n end\n end\n end", "def setup_base_mocks\n RunGit.any_instance.expects(:git).with(:init)\n RunGit.any_instance.expects(:git).with(:add => \".\")\n end", "def test_add_location_name_already_used\n loc = MiniTest::Mock.new(\"location 1\")\n def loc.name; @delegator; end\n @mp.add_location loc\n\n c2 = MiniTest::Mock.new(\"location 1\")\n def c2.name; @delegator; end\n @mp.add_location c2\n\n assert_equal c2, @mp.get_location(\"location 1\")\n end", "def mas_net_http_post(obj_stubs = {})\n request = Spec::Mocks::Mock.new(Net::HTTP::Post)\n Net::HTTP::Post.stub!(:new).and_return(request)\n obj_stubs.each do |method, value|\n request.stub!(method).and_return(value)\n end\n request\nend", "def test_magic_ball_new_not_nil\n magic_ball = Predictor.new\n refute_nil magic_ball\n end", "def mock_model(model_class, options_and_stubs={})\n \n options_and_stubs = {\n :id => rand(1000), \n :new_record? => false, \n :errors => stub(\"errors\", :count => 0)\n }.update(options_and_stubs)\n \n m = mock([model_class.name, options_and_stubs[:id]].join(\"_\"), options_and_stubs)\n \n m.send(:__mock_proxy).instance_eval <<-CODE\n def @target.is_a?(other)\n #{model_class}.ancestors.include?(other)\n end\n def @target.kind_of?(other)\n #{model_class}.ancestors.include?(other)\n end\n def @target.instance_of?(other)\n other == #{model_class}\n end\n def @target.class\n #{model_class}\n end\n CODE\n \n yield(m) if block_given?\n \n return m\n \nend", "def test_add_location\n loc = MiniTest::Mock.new(\"location 1\")\n def loc.name; @delegator; end\n @mp.add_location loc\n assert_equal 1, @mp.locations.length\n end", "def test_get_location_many\n loc = MiniTest::Mock.new(\"target location\")\n def loc.name; @delegator; end\n @mp.add_location loc\n\n (1..30).each do |i|\n location = MiniTest::Mock.new(\"location #{i}\")\n def location.name; @delegator; end\n @mp.add_location location\n end\n\n assert_equal loc, @mp.get_location(\"target location\")\n end", "def mock_model(model_class, stubs = {})\n id = @@model_id\n @@model_id += 1\n m = mock(\"#{model_class.name}_#{id}\")\n m.stub!(:id).and_return(id)\n m.stub!(:to_param).and_return(id.to_s)\n m.stub!(:new_record?).and_return(false)\n m.send(:__mock_handler).instance_eval <<-CODE\n def @target.is_a?(other)\n other == #{model_class}\n end\n def @target.class\n #{model_class}\n end\n CODE\n add_stubs(m, stubs)\n yield m if block_given?\n m\n end", "def prepare_test\n\n u = User.order(:id).first\n if u.nil?\n u = FactoryGirl.create(:valid_user, id: 1)\n end\n $user_id = u.id\n\n p = Project.order(:id).first\n if p.nil?\n p = FactoryGirl.create(:valid_project, id: 1)\n end\n $project_id = p.id\n\nend", "def stub_new(klass, options = {})\n define_implicit_request :new\n stub_initialize klass, options\n end", "def test_prospect_search_no_fakes\n \tlocation_stub = Minitest::Mock.new('Mock Location')\n pro = Prospector.new(1)\n def location_stub.loc\n \"Laboon Lake\"\n end\n def location_stub.max_rubies\n 1\n end\n def location_stub.max_fake_rubies\n 0\n end\n def location_stub.neighbor_list\n [\"Sean's Bowser Castle\", \"Kitty's Cozy Condo\"]\n end\n pro.change_curr_location(location_stub)\n pro.prospect_search(1)\n assert pro.total_fake_rubies == 0\n end", "def test_new_list\n ll = List::LinkedList.new\n assert_equal(nil, ll.head, \"Head should be nil for a new list\")\n end", "def create_objects\n# Create a new \"Mash\" object and assign it to \"awesome\"\n awesome Mash.new\n end", "def create_object(options = {})\n#\t\trecord = Factory.build(:sample_type,options)\n#\tThe normal sample_type factory creates a parent \n#\twhich seems to cause some testing issues unless\n#\tthis was expected so ....\n\t\trecord = Factory.build(:sample_type_parent,options)\n\t\trecord.save\n\t\trecord\n\tend", "def create_target_mock\n ref = self.service_name.downcase.gsub(/ /, '-')\n create_row = {\n ref: ref,\n display_name: self.service_name,\n type: 'instance',\n iaas_type: 'ec2',\n iaas_properties: {},\n project_id: self.project.id\n }\n Model.create_from_row(self.project.model_handle(:target), create_row, convert: true, ret_obj: { model_name: :target_instance })\n end", "def init(opts = {})\n RSpec::Mocks::setup(self)\n\n # Disable observers to improve test speed\n #\n # You can enable it in whole test case where needed by next string:\n #\n # before(:each) { enable_observers }\n #\n disable_observers if opts[:observers] == false\n\n # Disable mailer for spinach tests\n disable_mailer if opts[:mailer] == false\n\n\n # Use tmp dir for FS manipulations\n repos_path = Rails.root.join('tmp', 'test-git-base-path')\n Gitlab.config.gitlab_shell.stub(repos_path: repos_path)\n Gitlab::Git::Repository.stub(repos_path: repos_path)\n\n GollumWiki.any_instance.stub(:init_repo) do |path|\n create_temp_repo(File.join(repos_path, \"#{path}.git\"))\n end\n\n Gitlab::Shell.any_instance.stub(\n add_repository: true,\n mv_repository: true,\n remove_repository: true,\n add_key: true,\n remove_key: true\n )\n\n Gitlab::Satellite::Satellite.any_instance.stub(\n exists?: true,\n destroy: true,\n create: true\n )\n\n MergeRequest.any_instance.stub(\n check_if_can_be_merged: true\n )\n\n Repository.any_instance.stub(\n size: 12.45\n )\n\n # Remove tmp/test-git-base-path\n FileUtils.rm_rf Gitlab.config.gitlab_shell.repos_path\n\n # Recreate tmp/test-git-base-path\n FileUtils.mkdir_p Gitlab.config.gitlab_shell.repos_path\n\n # Symlink tmp/repositories/gitlabhq to tmp/test-git-base-path/gitlabhq\n seed_repo = Rails.root.join('tmp', 'repositories', 'gitlabhq')\n target_repo = File.join(repos_path, 'gitlabhq.git')\n system(\"ln -s #{seed_repo} #{target_repo}\")\n end", "def test_creates_a_new_guess\n card = Card.new(question: \"What is the capital of Alaska?\", answer: \"Juneau\")\n guess = Guess.new(\"Juneau\", card)\n assert_instance_of(guess)\n end", "def test_Museum_one_toy\n\td = Minitest::Mock::new \"Driver\"\n\tdef d.location; \"Museum\";\n\tend\n\td.expect :numberOfDinoToys, 1\n\tdef d.numberOfDinoToys=(n); n;\n\tend\n\tassert_equal checkItems(d), 2\nend", "def test_Hillman_four_books\n\td = Minitest::Mock::new \"Driver\"\n\tdef d.location; \"Hillman\";\n\tend\n\td.expect :numberOfBooks, 4\n\tdef d.numberOfBooks=(n); n;\n\tend\n\tassert_equal checkItems(d), 5\nend", "def test_can_create_instance_of_class_via_bang_method \n cars = Lumberjack.construct do\n vehicle :name => 'Prius (are owned by rich hippies)' do\n person! 'Ryan' do # i so put my foot in here, i'm not a rich hippy!\n age 25\n end\n end\n end\n assert_kind_of Person, cars[0].person\n assert_equal 'Ryan', cars[0].person.given_name\n assert_equal 25, cars[0].person.age\n end", "def mock(*args)\n Spec::Mocks::Mock.new(*args)\n end", "def initialize(obj, mock, safe_mode)\n @obj = obj\n @mock = mock\n @method_definitions = {}\n @methods_proxied = []\n unless safe_mode\n add_mock_method(@obj, :should_receive)\n MOCK_METHODS.each do |sym|\n unless @obj.respond_to?(sym)\n add_mock_method(@obj, sym)\n end\n end\n end\n end", "def setup_expectation(obj, method)\n # If we want to know whether the method was called successfully, we need\n # to raise an error that will tell us when we failed to call the method.\n # To do that we also need to store whether we expected the method to be called\n $expectations << [obj, method]\n # This code add a method `hello` to ONLY this particular instance\n obj.singleton_class.send(:define_method, method) do\n # Let's records in a GLOBAL HASH $calls, that a `define_method` was called.\n $calls[obj] << method\n end\nend", "def test_create_valid\n #TODO: reenable this once we can figure out how to remove any_instance\n # Ingredient.any_instance.stubs(:valid?).returns(true)\n target = Factory.build(:ingredient)\n post :create, \n :recipe_id => Factory.create(:recipe).id, \n :ingredient => target.attributes\n assert_redirected_to ingredient_url(assigns(:ingredient))\n end", "def test_add_book\n @library = Library.new(@books_array)\n new_book = {\n title: \"lord_of_the_fading_lands\",\n rental_details: {\n student_name: \"\",\n date: \"\"\n }\n }\n\n @library.add_book(\"lord_of_the_fading_lands\")\n\n assert_equal(new_book, @library.book_info(\"lord_of_the_fading_lands\"))\n assert_equal(4, @books_array.count)\n end", "def test_new_location_invalid\r\n random = Minitest::Mock.new(\"test_random\")\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n assert_raises('Index must be an integer!') { @g.new_location('a', random, location) }\r\n end", "def test_seven_location_mine\n mock_map = Minitest::Mock.new('Mock Map')\n mock_map_finder = Minitest::Mock.new('Mock Map Finder')\n joe = Prospector.new(mock_map, mock_map_finder)\n assert_nil joe.mine(1, 7)\n end", "def test_Hillman_zero_books\n\td = Minitest::Mock::new \"Driver\"\n\tdef d.location; \"Hillman\";\n\tend\n\td.expect :numberOfBooks, 0\n\tdef d.numberOfBooks=(n); n;\n\tend\n\tassert_equal checkItems(d), 1\nend", "def test_initialize_miners\n\t\tg = Game.new(0,0,0)\n\t\tmocked_miner = Minitest::Mock.new(\"mocked miner\")\n\t\tdef mocked_miner.new; nil; end\n\n\t\tassert_equal(2, (g.initialize_miners(2)).size)\n\tend", "def test_add_new_book\n @library.add_new_book(\"catch_22\")\n expected = {\n title: 'catch_22',\n rental_details: {\n student_name: '',\n date: ''\n }\n }\n assert_equal(expected, @library.get_book('catch_22'))\n end", "def test_all_done# #all_done returns an new TodoList object (meets criteria)\r\n @todo1.done!\r\n new_obj = @list.all_done\r\n assert_equal([@todo1], new_obj.to_a)\r\n end", "def new\n\t\t\t\"Should we make something new?\"\n\t\tend", "def before_product_image_reorder(product,ids,value,notice)\n # stub new method to return our mock object \n # stub new_record? method to always pass\n # stub model field accessors\n if(value)\n before_product_view_helper(product,\n [@category,@category],\n [@image,@image],\n [@supplier,@supplier])\n else\n has_accessor(Product,:find,product,:twice)\n end\n has_accessor(ProductImage,:reorder_images,value)\n post 'reorder', :product_id => product.id, :all_images => ids\n assigns[:reorder_url].should == reorder_product_images_url(product)\n assert_flash(notice)\n product\nend", "def test_invalid_location\n\td = Minitest::Mock:: new \"Driver\"\n\tdef d.location; \"All Other Cases\";\n\tend\n\td.expect :numberOfClasses, 0\n\tdef d. numberOfClasses=(n); n;\n\tend\n\tassert_nil checkItems(d)\n\tend", "def test_new_location_mock_high_bound\r\n random = Minitest::Mock.new(\"test_random\")\r\n def random.rand(num); 0; end\r\n location = Minitest::Mock.new(\"test_location_arr\")\r\n def location.neighbor_count(index); 2; end\r\n def location.find_neighbor(index, new_index); 4; end\r\n assert_equal 4, @g.new_location(6, random, location)\r\n end" ]
[ "0.6939625", "0.6667902", "0.66436285", "0.6628323", "0.65261674", "0.63150376", "0.630806", "0.626953", "0.6257717", "0.62574464", "0.62503266", "0.62450635", "0.62436575", "0.6164831", "0.60916495", "0.6090912", "0.608212", "0.60414183", "0.60354203", "0.60279787", "0.6014351", "0.601383", "0.5992684", "0.5988623", "0.5979027", "0.596349", "0.594738", "0.5941714", "0.591916", "0.59069806", "0.5896978", "0.5895132", "0.58923775", "0.58887255", "0.588022", "0.5856313", "0.58390754", "0.5835143", "0.5801503", "0.5800657", "0.5781159", "0.57793206", "0.57756907", "0.57720786", "0.5764521", "0.5764462", "0.57453215", "0.57419455", "0.5741892", "0.57267815", "0.56988823", "0.5697252", "0.5667088", "0.56419283", "0.5625448", "0.56192213", "0.56174684", "0.56054336", "0.5604605", "0.560346", "0.5598754", "0.55984515", "0.5594142", "0.55920255", "0.5590124", "0.5588187", "0.55872345", "0.5578191", "0.5577577", "0.5573494", "0.55709964", "0.5555933", "0.55508816", "0.55490655", "0.55469275", "0.5541471", "0.55403376", "0.55395895", "0.5538505", "0.55346566", "0.5527908", "0.55247754", "0.55224603", "0.5517557", "0.5516913", "0.5513321", "0.5511125", "0.5508819", "0.55056", "0.55054957", "0.54916173", "0.5490972", "0.5487677", "0.5485143", "0.54839164", "0.5481079", "0.5479936", "0.54768366", "0.54737335", "0.54714847" ]
0.6634959
3
Displays some text while you do something in the background
def infobox(msg, title, height = 5, width = 40) @dialog.title = "\"#{title}\"" @dialog.infobox("\n" + msg, height, width) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process\n @viewport.visible = true\n while Core::LOCK.locked?\n Graphics.update\n @text.text = @texts[Graphics.frame_count % 60 / 20] if Graphics.frame_count % 20 == 0\n end\n @viewport.visible = false\n end", "def display_message!(*lines)\n display_message(*lines)\n sleep 0.01 until message_drawn?\n end", "def intro\n clr\n puts\"\n████████╗██╗ ██████╗████████╗ █████╗ ██████╗████████╗ ██████╗ ███████╗\n╚══██╔══╝██║██╔════╝╚══██╔══╝██╔══██╗██╔════╝╚══██╔══╝██╔═══██╗██╔════╝\n ██║ ██║██║ ██║ ███████║██║ ██║ ██║ ██║█████╗ \n ██║ ██║██║ ██║ ██╔══██║██║ ██║ ██║ ██║██╔══╝ \n ██║ ██║╚██████╗ ██║ ██║ ██║╚██████╗ ██║ ╚██████╔╝███████╗\n ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚══════╝\n \"\n sleep 2\n end", "def shownext\n if @session.current_screen and @session.current_screen.stdin\n display @session.current_screen\n @session.next\n else\n print Paint[\"... \", :cyan]\n @playprompt = false\n @lastelapsed = 0\n end\nend", "def display_word\n system \"clear\"\n wave_display\n puts \"Watch carefully and remember...\"\n puts \" \" + fetch_current_word + \" \\r\"\n # time_limit\n sleep($hide_speed)\n player_input_word\nend", "def background; end", "def show_draw\n puts 'No more avalaible spaces, consider it a draw'\n puts 'The game will be re-started'\n puts 'loading................'\n puts 'Press any key to continue'\nend", "def loadingMessage()\n puts \"\\n\"\n print \"Thank you #{$_userNameVar}. Now I will do work for you :)\"\n sleep(1)\n print '.'\n sleep(1)\n print '.'\n sleep(1)\n print '.'\n sleep(1)\n puts '.'\nend", "def init_text\n puts 'Iniciando programa'\n print '.'\n sleep(0.3)\n print '.'\n sleep(0.3)\n print '.'\n print \"\\n\"\nend", "def about\n puts \"Created by: Frank Rycak Jr.\" + \" \" + \"\\u00A9\" + \" \" + \"2016\" + \" \" + \"Wyncode Cohort 8\"\n sleep(3)\nend", "def display\n wrap_in_border do\n print_space(:before)\n puts formatted_message\n print_space(:after)\n end\n sleep @display_seconds if !@display_seconds.nil?\n clear if @clear_after_display\n @message\n end", "def write_to_screen!; end", "def write_to_screen!; end", "def pause; end", "def intro\n clear_screen\n print \"Today is \"\n puts Time.now\n sleep(2)\n puts\"\\nYou are travelling by motorcycle on a dirt road in Thailand, when all of a sudden you swerve and hit a ditch. Knocking yourself unconcious...\\n\\n\"\n sleep (5)\nend", "def intro\nputs\"You are sent to prison for a crime you are not responsable, but soon a path is showing up...\"\nsleep (5)\nend", "def status_line(switch_on = true)\n if switch_on\n set_vars :_display_busy => 1, :_display_status => 1\n else # switch off\n set_vars :_display_busy => 0, :_display_status => 0\n end\n sleep 1\n exec 'redisplay;'\n end", "def redisplay_delay\r\n 20\r\n end", "def slow_scroll()\r\n 10.times do\r\n sleep 0.05\r\n puts \"\"\r\n end\r\nend", "def perform \n sleep 1\n puts \" joooo\"\n end", "def pause\n end", "def pause\n end", "def pause\n end", "def printComeBackMessage\n puts \"Then come back and run the program again.\"\n end", "def pbDisplayMessage(msg)\n self.visible = false\n @scene.pbDisplayMessage(msg)\n @scene.clearMessageWindow\n self.visible = true\n end", "def display_current(game_hash)\n\treset_screen\n\tputs pretty_board(hash_to_array(game_hash))\n\tsleep(0.001)\nend", "def start\n display = Swt::Widgets::Display.get_current\n while !@shell.isDisposed\n display.sleep unless display.read_and_dispatch\n end\n\n display.dispose\n end", "def try_again\n wave_display\n puts \"Here's the word again...\"\n\tputs $current_word.colorize(:color => :black, :background => :green) + \"\\r\"\n sleep($hide_speed)\n player_input_word\nend", "def half_refresh\n contents.clear_rect(24, 0, contents_width - 24, line_height)\n draw_text(24, 0, contents_width - 24, line_height, $game_system.playtime_s, 2)\n end", "def run\n Curses.init_screen\n\n init_style\n\n Curses.noecho\n Curses.curs_set 0 # invisible\n\n @message = RDoc::RI::Browser::Message.new\n\n @display = RDoc::RI::Browser::Display.new self\n @display.show HELP, nil, false\n\n trap_resume do\n event_loop\n end\n end", "def pause\n\n end", "def run(background = T.unsafe(nil)); end", "def update_message\n # Show the \"What?\" message\n if @counter == 0\n @message_window.auto_skip = true\n @message_window.stay_visible = true\n display_message(text_get(36, 37))\n elsif @counter == POKEMON_ALPHA_DOWN_END\n @message_window.auto_skip = false\n Audio.bgm_play(Evolve::EVOLVED_MUSIC)\n PFM::Text.set_pkname(@pokemon, 0)\n display_message(text_get(36, 38))\n elsif @counter > POKEMON_ALPHA_DOWN_END\n show_rename_choice\n Audio.bgm_stop\n $game_system.bgm_restore2\n $pokedex.mark_seen(@pokemon.id, @pokemon.form, forced: true)\n $pokedex.mark_captured(@pokemon.id)\n $pokedex.pokemon_fought_inc(@pokemon.id)\n $pokedex.pokemon_captured_inc(@pokemon.id)\n @running = false\n end\n end", "def pbDisplayMessage(msg,brief=false)\r\n pbWaitMessage\r\n pbShowWindow(MESSAGE_BOX)\r\n cw = @sprites[\"messageWindow\"]\r\n cw.setText(msg)\r\n PBDebug.log(msg)\r\n yielded = false\r\n i = 0\r\n loop do\r\n pbUpdate(cw)\r\n if !cw.busy?\r\n if !yielded\r\n yield if block_given? # For playing SE as soon as the message is all shown\r\n yielded = true\r\n end\r\n if brief\r\n # NOTE: A brief message lingers on-screen while other things happen. A\r\n # regular message has to end before the game can continue.\r\n @briefMessage = true\r\n break\r\n end\r\n if i>=MESSAGE_PAUSE_TIME # Autoclose after 1 second\r\n cw.text = \"\"\r\n cw.visible = false\r\n break\r\n end\r\n i += 1\r\n end\r\n if Input.trigger?(Input::BACK) || Input.trigger?(Input::USE) || @abortable\r\n if cw.busy?\r\n pbPlayDecisionSE if cw.pausing? && !@abortable\r\n cw.skipAhead\r\n elsif !@abortable\r\n cw.text = \"\"\r\n cw.visible = false\r\n break\r\n end\r\n end\r\n end\r\n end", "def intro\n loading_2\n puts `clear`\n puts \"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"\n puts \"\".center(236).blue_on_green\n print \"Welcome to Restaurant Sleuth!\".center(118).blue_on_green\n puts \"\".center(236).blue_on_green\n sleep 1\n print \" Please enter your city:\".center(118).blue_on_green\n puts \"\".center(236).blue_on_green\n puts \"\\n\\n\"\nend", "def pbDisplayPausedMessage(msg)\r\n pbWaitMessage\r\n pbShowWindow(MESSAGE_BOX)\r\n cw = @sprites[\"messageWindow\"]\r\n cw.text = _INTL(\"{1}\\1\",msg)\r\n PBDebug.log(msg)\r\n yielded = false\r\n i = 0\r\n loop do\r\n pbUpdate(cw)\r\n if !cw.busy?\r\n if !yielded\r\n yield if block_given? # For playing SE as soon as the message is all shown\r\n yielded = true\r\n end\r\n if !@battleEnd\r\n if i>=MESSAGE_PAUSE_TIME*3 # Autoclose after 3 seconds\r\n cw.text = \"\"\r\n cw.visible = false\r\n break\r\n end\r\n i += 1\r\n end\r\n end\r\n if Input.trigger?(Input::BACK) || Input.trigger?(Input::USE) || @abortable\r\n if cw.busy?\r\n pbPlayDecisionSE if cw.pausing? && !@abortable\r\n cw.skipAhead\r\n elsif !@abortable\r\n cw.text = \"\"\r\n pbPlayDecisionSE\r\n break\r\n end\r\n end\r\n end\r\n end", "def message(input)\r\n start_line\r\n puts input.colorize(:light_blue)\r\n sleep(1.5)\r\n end", "def update_text_draw\n if @fade_out == false && !$game_temp.message_text.nil?\n @contents_showing = true\n $game_temp.message_window_showing = true\n @text_stack.dispose\n set_origin(0, 0)\n @fade_in = true\n self.visible = true\n init_window\n @name_window.contents_opacity = self.contents_opacity = 0\n @name_window.opacity = self.opacity = $game_temp.message_text.size == 0 ? 0 : 255\n refresh\n return true\n end\n return false\n end", "def println(text)\n Platform.runLater(-> { @output.append_text(\"#{text.to_s}\\n\") })\n end", "def pbWaitMessage\r\n return if !@briefMessage\r\n pbShowWindow(MESSAGE_BOX)\r\n cw = @sprites[\"messageWindow\"]\r\n MESSAGE_PAUSE_TIME.times do\r\n pbUpdate(cw)\r\n end\r\n cw.text = \"\"\r\n cw.visible = false\r\n @briefMessage = false\r\n end", "def background(soundName) #unverified\r\n\t\texec(\"background\", soundName)\r\n\tend", "def update_screen(output)\n if output != $last_update\n clear_screen\n puts(output)\n end\nend", "def start\n restart\n update\n Tk.mainloop\n end", "def run\n send Rainbow('Running cpgui...').aqua\n @run = true\n input while @run\n end", "def pause()\r\n # nothing here\r\n end", "def put_hold_notice\n @io.puts\n @io.puts 'Pausing here -- run Ruby again to ' \\\n 'measure the next benchmark...'\n end", "def game_complete_text\n slow_type(\"\\nCongratulations, #{@new_player_name}! You have found your way out!\")\n pause(0.3)\n slow_type(\"Written, developed and coded by Adam Vaughan and Danny Smith.\")\n pause(0.3)\n slow_type(\"Stayed tuned for more levels!\")\n end", "def run\n greet_screen\n exit_screen\n end", "def display_countdown\n end_time = Time.now + @interval\n until Time.now > end_time\n print \"#{time_remaining(end_time)}\\r\"\n sleep 1\n end\n puts \"#{pomodoro_status} -- POSTED at #{current_time}\"\n end", "def greet2\n puts \"\\n\n We've looked up some interesting\\n\n facts about characters from the films,\\n\n and we invite you to learn some \\n\n more about them.\\n\"\n sleep 4\n end", "def close_text\n puts 'Cerrando programa'\n print '.'\n sleep(0.3)\n print '.'\n sleep(0.3)\n print '.'\n print \"\\n\"\nend", "def running; end", "def running; end", "def messagePrint(top, message, bottom)\r\n system(\"clear\")\r\n print top\r\n print message\r\n print bottom\r\n sleep(0.1)\r\nend", "def do\n unless done\n @text = \"x #{text}\".strip\n @done = true\n end\n end", "def background_music(song1, song2)\n puts \"The song, #{song1}, makes me want to work continuously.\"\n puts \"The song, #{song2}, makes me sleepy.\"\n puts \"I wsih every song made me feel like I could conqueor the world!\"\nend", "def ajax_wait_msg text_to_display='Processing...'\n return \"<img src=\\\"/images/waiting.gif\\\" alt=\\\"waiting\\\"> #{text_to_display}\"\n end", "def print(text)\n Platform.runLater(-> { @output.append_text(text.to_s) })\n end", "def let_mes_catch_up\n sleep 1\n end", "def draw\n return if @destoryed\n return unless @verbose\n unless DEBUG_PRINT_WAIT.nil?\n @string = get_debug_string\n end\n @hud_font.draw_text(@string, $program.width - 200, $program.height - 300, 100, 1, 1, 0xff_000000, :default)\n end", "def idle\n sleep(5) while running?\n end", "def show_start\n @start_time = Time.now\n puts TTY::Box.frame(self.class.name,\n \"Start : #{@start_time}\",\n width: TTY::Screen.width, padding: 1,\n border: { left: false, right: false })\n end", "def printSurrenderMessage\n puts \"Aww it's sad to see you go so early. Better luck next round!\"\n pressKeyToContinue\nend", "def victory_screen\n system 'clear'\n 'GAME OVER'\n Catpix::print_image \"victory_screen.jpg\",\n :limit_x => 1.0,\n :limit_y => 0,\n :center_x => true,\n :center_y => true,\n :bg => \"white\",\n :bg_fill => true\n abort(\"See you next time.\".red)\nend", "def running?; end", "def bg_thread\n @bg_thread\n end", "def log_action(initial_text, final_text=\"Done.\", &block)\n $stdout.sync = true\n print initial_text, \"...\"\n yield\n puts final_text\nend", "def play\n while(true)\n system('clear')\n render_board\n board_update\n sleep(5)\n end\n end", "def update\n if @think_time % 6 == 0\n self.bitmap.clear \n @think_text +=\".\" \n if self.bitmap.text_size(@think_text).width > self.width\n reset_text\n end\n self.bitmap.draw_outline_text(0, 0, self.width, self.height, @think_text)\n end\n super\n if @think_time > 0\n @think_time -= 1\n return true\n else\n return false\n end\n end", "def welcome \n\n system \"clear\"\n puts \"\n ██████╗░██████╗░░█████╗░██╗░░░██╗░██████╗░██╗░░██╗████████╗░██████╗\n ██╔══██╗██╔══██╗██╔══██╗██║░░░██║██╔════╝░██║░░██║╚══██╔══╝██╔════╝\n ██║░░██║██████╔╝███████║██║░░░██║██║░░██╗░███████║░░░██║░░░╚█████╗░\n ██║░░██║██╔══██╗██╔══██║██║░░░██║██║░░╚██╗██╔══██║░░░██║░░░░╚═══██╗\n ██████╔╝██║░░██║██║░░██║╚██████╔╝╚██████╔╝██║░░██║░░░██║░░░██████╔╝\n ╚═════╝░╚═╝░░╚═╝╚═╝░░╚═╝░╚═════╝░░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚═════╝░\\n\\n\\n\"\n\n # Progress bar\n bar = TTY::ProgressBar.new(\"[:bar]\", total: 74)\n 100.times do\n sleep(0.01)\n bar.advance(1)\n end\n\n main_menu\nend", "def pause; self.app.pause end", "def blink; end", "def blink; end", "def go()\n\n if block_given? then\n\n @window.activate(); sleep 1; yield(self); carriage_return()\n\n end\n\n end", "def show\n call Screen.setColor(true)\n call draw\n end", "def play\n \t@fragment = \"\"\n until @losses.keys.length == 1\n system(\"clear\")\n update_status\n play_round\n check_status\n puts \"Next round in 5 seconds...\".bold\n sleep(5)\n end\n final_status\n end", "def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while !@shell.isDisposed\n \n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n\n display.dispose\n end", "def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while !@shell.isDisposed\n \n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n\n display.dispose\n end", "def intro\n system 'clear'\n intro = PicDisplay.new\n intro.logo\n sleep(4)\n welcome\n end", "def intro\n puts \"\\n\\n#{\"Welcome to the Amiibo Selection!\".colorize(:cyan)}\\n\\n\"\n puts \"Gathering all Amiibo Results...one moment...\"\n puts \"How do you pronouce Amiibo? Hyphenate: A-me-bo\\n\\n\"\n puts \"--------------------------------------------------------------------------------\\n\\n\"\n sleep(1)\n end", "def wait_animation(message, time_seconds)\n print message\n print \" [ ]\"\n STDOUT.flush\n time_seconds.downto(1) do\n 1.upto(4) do |i|\n next_output = \"\\b\\b\\b\\b\\b\\b\\b\"\n case\n when i % 4 == 0\n next_output += \"[ = ]\"\n when i % 3 == 0\n next_output += \"[ = ]\"\n when i % 2 == 0\n next_output += \"[ = ]\"\n else\n next_output += \"[ = ]\"\n end\n\n print next_output\n STDOUT.flush\n sleep(0.25)\n end\n end\n # remove loading animation\n print \"\\b\\b\\b\\b\\b\\b\\bRefreshing...\"\n STDOUT.flush\n puts\n end", "def start_load_screenshot\n show_loading_bar\n Thread.new{extract_graphic}\n end", "def update\r\n # タイマー作動中なら可視に設定\r\n self.visible = $game_system.timer_working\r\n # タイマーを再描画する必要がある場合\r\n if $game_system.timer / 60 != @total_sec # Graphics.frame_rate\r\n # トータル秒数を計算\r\n @total_sec = $game_system.timer / 60#Graphics.frame_rate\r\n # タイマー表示用の文字列を作成\r\n min = @total_sec / 60\r\n sec = @total_sec % 60\r\n # タイマーを描画\r\n self.text = sprintf(\"%02d:%02d\", min, sec)\r\n end\r\n end", "def after_background(background)\n @in_background = false\n end", "def main_process\n while @running\n Graphics.update\n update\n end\n end", "def play_name_animation(name)\n 3.times do |i|\n puts \"\\e[H\\e[2J\" \n letterify_name(name)\n sleep(0.3)\n puts \"\\e[H\\e[2J\" \n blankify_name(name)\n sleep(0.3)\n end\nend", "def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while !@shell.isDisposed\n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n display.dispose\n end", "def turn_page\n puts \"Flipping the page...wow, you read fast!\"\nend", "def turn_page\n puts \"Flipping the page...wow, you read fast!\"\nend", "def turn_page\n puts \"Flipping the page...wow, you read fast!\"\nend", "def turn_page\n puts \"Flipping the page...wow, you read fast!\"\nend", "def wait_animation\n sleep 0.8\n end", "def draw_status_text\n draw_text(0, 0, contents_width, line_height, status_text, 1)\n end", "def loading_screen(string) \n string.length.times do |i| # Iterates over each index in a given string\n # Clear the screen to provide an animated effect.\n clear\n \n # Please wait header \n puts HEADER_LINE\n puts \"Please Wait...\".upcase.center(HEADER_LENGTH)\n puts HEADER_LINE\n puts\n \n # Displays all characters in the string up to the index being iterated over.\n puts string[0, i].center(HEADER_LENGTH)\n sleep(0.2)\n end\nend", "def go\n update\n borders\n display\n end", "def display_guts_text(target)\n Sound.play_guts_text\n add_text(sprintf(target.personal_guts_text, target.name))\n wait\n end", "def start(value)\n @value = value\n @show = 60\n self.opacity = 255\n self.zoom_x = 1.5\n self.zoom_y = 1.5\n bitmap.clear\n bitmap.draw_text(bitmap.rect, value, 1)\n end", "def update_text_draw\n unless $game_temp.message_text.nil?\n @contents_showing = true\n $game_temp.message_window_showing = true\n @text_stack.dispose\n set_origin(0, 0)\n self.visible = true\n init_window\n refresh\n return true\n end\n return false\n end", "def display_action_effects(target, obj = nil)\n unless target.skipped\n line_number = @message_window.line_number\n wait(5)\n display_critical(target, obj)\n display_damage(target, obj)\n display_state_changes(target, obj)\n display_scan(target, obj)\n if line_number == @message_window.line_number\n display_failure(target, obj) unless target.states_active?\n end\n if line_number != @message_window.line_number\n wait(30)\n end\n @message_window.back_to(line_number)\n end\n end", "def greet\n\tputs \"Hello there! Welcome back.\"\n\tsleep(1)\n\tputs \"Here are your options:\"\n\tsleep(1)\nend", "def welcome_message\n system('clear')\n puts \" _ _ _ _ \"\n sleep 0.1\n puts \"| | | | ___| | | ___ \"\n sleep 0.1\n puts \"| |_| |/ _ | |/ _ \\ \"\n sleep 0.1\n puts \"| _ | __/ | | (_) |\"\n sleep 0.1\n puts \"|_| |_| ___|_|_| ___/ \"\n sleep 0.1\n puts \"\" \n puts \"bienvenue dans mon jeu du morpion\"\n puts \"\\nAvant de commencer entre le nom des deux joueurs qui vont s'affronter\"\n end" ]
[ "0.68535686", "0.6686648", "0.64565796", "0.6444821", "0.6435856", "0.640916", "0.6366326", "0.6363932", "0.63607085", "0.6243724", "0.62209135", "0.61815363", "0.61815363", "0.61255866", "0.6111053", "0.60937893", "0.60768354", "0.6071271", "0.6024081", "0.6017232", "0.6011192", "0.6011192", "0.6011192", "0.60061246", "0.59573984", "0.59487325", "0.59449506", "0.59376377", "0.5932268", "0.5917606", "0.5909772", "0.59089583", "0.5896023", "0.58956873", "0.5884753", "0.5882851", "0.58790874", "0.5863836", "0.5855501", "0.5846692", "0.58464986", "0.5842219", "0.58413905", "0.5821845", "0.58213407", "0.581804", "0.58117557", "0.5802032", "0.5801315", "0.579574", "0.57953316", "0.5775079", "0.5775079", "0.5772769", "0.5772671", "0.57724935", "0.5766006", "0.5762622", "0.57595736", "0.5757613", "0.575251", "0.57507956", "0.574315", "0.57388866", "0.5737945", "0.5716219", "0.57159275", "0.57148206", "0.57104987", "0.5691788", "0.56799847", "0.56769294", "0.56769294", "0.5672486", "0.56614655", "0.5651622", "0.5647318", "0.56461185", "0.5645519", "0.5643836", "0.5636148", "0.5634874", "0.56306875", "0.56287473", "0.56285954", "0.5621727", "0.56201935", "0.5618308", "0.5618308", "0.5618308", "0.5618308", "0.56157327", "0.56152713", "0.56131846", "0.5607778", "0.56044924", "0.56009567", "0.559622", "0.5594842", "0.5592825", "0.5587393" ]
0.0
-1
Shows a list of options and lets the user choose one
def choose(choices, title) res = @dialog.menu(title, choices) raise CancelPressed.new unless res res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_from_list(question, list)\n ui.choose_from_list question, list\n end", "def present_menu_options\n space(1)\n puts \"Choose an option from the list below.\"\n space(1)\n puts '1. Search for events by city'\n puts '2. Search for events by artist or sports team'\n puts '3. See what I have coming up'\n puts '4. Delete my account'\n puts '5. Exit'\n space(1)\n pick_option\nend", "def printOptions\n puts \"\\nSelect one of the following options.\\n\"\n puts \"\n [0] Print All\n [1] Print Name\n [2] Find Prefix\n [3] New Food\n [4] New Recipe\n [5] Show Log\n [6] Show Today\n [7] Show Date\n [8] Log Today\n [9] Log Date\n [10] Log Delete\n [11] Save\n [12] Quit\\n\"\nend", "def list_option\n list_politicians\n list_voters\n puts\n puts \"(R)eturn to the main menu?\".center(80).green\n menu_return = gets\n end", "def play_options(prompt)\r\n choices = [\r\n {name: \"Hit\", value: 1},\r\n {name: \"Stand\", value: 2},\r\n {name: \"Exit\", value: 3}\r\n ]\r\n chosen_option = prompt.select(\"What would you like to do?\", choices, help_color: :yellow, help: \"(Use Keyboard Arrow Keys)\", show_help: :start, filter: true)\r\nend", "def print_menu_options\n\t\tputs \"----------------------------------------------\"\n\t\tputs \"1) Rename List | 2) Add task \"\n\t\tputs \"3) Complete task | 4) Uncomplete task\"\n\t\tputs \"5) Prioritize task | 6) Normalize task \"\n \t\tputs \"7) Add due date | 8) Remove due date\"\n\t\tputs \"9) Delete task | 0) Exit\"\n\t\tputs \"----------------------------------------------\"\n\t\tputs \"Enter choice: \"\n\t\tchoice = get_choice.to_i\n\t\toptions choice\n\tend", "def select_list\n require 'pashua'\n include Pashua\n\n config = \"\n *.title = personal time tracker\n cb.type = combobox\n cb.completion = 2\n cb.width = 400\n cb.default = surfing\n cb.tooltip = Choose from the list\n db.type = cancelbutton\n db.label = Cancel\n db.tooltip = Closes this window without taking action\" + \"\\n\"\n\n # insert list of all choices\n cust = get_custom_cats || []\n cat = (cust ? cust + Categories : Categories)\n cat.each { |c| config << \"cb.option = #{c}\\n\" }\n pagetmp = pashua_run config\n exit if pagetmp['cancel'] == 1 || pagetmp['cb'] == nil\n\n choice = pagetmp['cb'].strip\n notify_change(choice)\n log(choice)\n\n unless cat.index(choice)\n cust << choice\n write_custom_cats(cust)\n end\nend", "def display_options_menu\n prompt = TTY::Prompt.new\n display_options_menu = prompt.select('Please select an option:') do |menu| \n menu.choice 'Add Code'\n menu.choice 'Edit Code'\n menu.choice 'Remove Code'\n menu.choice 'Search'\n menu.choice 'Help'\n menu.choice 'Exit'\n end\nend", "def play_options(prompt)\n choices = [\n {name: \"Hit\", value: 1},\n {name: \"Stand\", value: 2},\n {name: \"Exit\", value: 3}\n ]\n chosen_option = prompt.select(\"What would you like to do?\", choices, help_color: :yellow, help: \"(Use Keybvoard keys)\", show_help: :start, filter: true)\nend", "def display\n return \"#{@type} (CHOOSE ONE: #{@items.join(', ')})\"\n end", "def interface\r\n clear\r\n menu_banner\r\n puts\r\n options = [\r\n { name: 'New Game', value: -> { get_user_selection } },\r\n { name: 'Custom quiz collections', value: -> { custom_collection } },\r\n { name: 'History', value: -> { history_select } },\r\n { name: 'Exit', value: lambda {\r\n clear\r\n exit_banner\r\n exit\r\n } }\r\n ]\r\n option = @prompt.select(\"Please select from the following options.\\n\\n\", options,\r\n help: \"(Select with pressing ↑/↓ arrow keys, and then pressing Enter)\\n\\n\", show_help: :always)\r\n end", "def display_menu\n puts \"Choose from the following options: \\n\n to find a candidate, type 'find id' (ex. find 1)\n to view all candidates, type 'all'\n to view all qualified candidates, type 'qualified'\n to exit, type 'quit' \n to view menu, type 'menu' \\n\\n\"\nend", "def select_option\n return $prompt.select(\"What's your option?\",\n [\"Ladder\", \"Team's info\", \"Play a game!\", \"Training\", \"Exit\"])\n \nend", "def form_escolher\n lst_from.select 'London'\n lst_on.select 'December'\n lst_month.select '20'\n lst_arriving.select 'Acapulco'\n lst_returning.select 'October'\n lst_month_returning.select '21'\n check_port.click\n lst_airline.select 'Blue Skies Airlines'\n end", "def display_available_options\n output.puts\n if user_package.model_info.has_selected_model?\n output.puts \"Available Options: \"\n output.puts CarOptionList.available_options.to_s(\"\\n\")\n else\n output.puts \"You need to select a model before adding options!\"\n end\n end", "def display_guest_options_menu\n prompt = TTY::Prompt.new\n display_options_menu = prompt.select('Please select an option:') do |menu| \n menu.choice 'Search'\n menu.choice 'Favourites'\n menu.choice 'Help'\n menu.choice 'Exit'\n end\nend", "def options\n puts \"Here are your options:\"\n puts \" \"\n puts \"1 : Create a new apartment.\"\n puts \"2 : Create a new person.\"\n puts \"3 : List all appartments in your building.\"\n puts \"4 : List all the people in an apartment.\"\n puts \"5 : Quit\"\n puts \" \"\n puts \"What would you like to? (Type a number)\"\nend", "def print_options\n # while true\n options = [\"1\",\"2\",\"3\",\"4\",\"5\"]\n puts \"1. Show user list\".yellow\n puts \"2. Add item to the user list\".green\n puts \"3. Edit item from the user list\".yellow\n puts \"4. Delete a item from the user list\".red\n puts \"5. Exit\".green.bold.underline\n print \"Select your option (1-5):\".light_blue\n input_option = gets.strip\n # This code isnt working so i have removed it. It was creating an inifite loop.\n # if !options.include?(input_option)\n # puts \"Sorry, I was expecting an integer: 1,2,3,4 OR 5\"\n # end\n # return options\n end", "def selected_options; end", "def selected_options; end", "def make_option_list\n end", "def make_option_list\n end", "def print_menu\n puts \"Select one of the following options:\"\n puts \"----//--------//------\"\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list of students\"\n puts \"4. Load the list of students\"\n puts \"9. Exit\" # 9 because we'll be adding more items\nend", "def main_menu\n options = [\"View recipe book\", \"Search by ingredient\", \"Quit app\"]\n answer = @prompt.select(\"Choose an option:\".colorize(:color => :blue), (options))\n if answer == options[0]\n select_recipe_from_book(@user.view_recipe_book)\n elsif answer == options[1]\n find_recipe\n elsif answer == options[2]\n puts ''\n puts \"Thanks for using Feed. See you next time!\".colorize(:color => :blue)\n system exit\n end\nend", "def option_select \n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"What would you like to do? Choose from the options below:\") do |menu|\n menu.choice 'View my favorite players' #MAIN MENU OPTION 1 - SHOWS USER'S FAVORITE PLAYERS\n menu.choice 'Add a new favorite player to my account' #MAIN MENU OPTION 2\n menu.choice 'Delete a favorite player from my account' #MAIN MENU OPTION 3\n menu.choice 'View all fans of a specifc player' #MAIN MENU OPTION 4\n menu.choice 'View favorite players of another fan' #MAIN MENU OPTION 5\n menu.choice 'View players from a specific club' #MAIN MENU OPTION 6\n menu.choice 'View most expensive player from a specifc premier league team' #MAIN MENU OPTION 7\n menu.choice 'I just got a season ticket. Update my club season ticket status.' #MAIN MENU OPTION 8\n menu.choice 'exit' #MAIN MENU OPTION EXIT\n end\n\nend", "def display_menu\n system('clear')\n arr = ['My List', 'Recommendations', 'Playlist', 'Account Details', 'Exit']\n @prompt.select(\"》 MAIN MENU 《\\n\".colorize(:light_green), arr)\n end", "def list_options\n puts \"Here is a list of available commands:\"\n puts \"new - Create a new contact\"\n puts \"list - List all contacts\"\n puts \"show - Show a contact\"\n puts \"search - Search contacts\"\n\n choice = gets.chomp\n\n case choice\n when \"list\"\n puts Contact.all\n when \"new\"\n puts \"Enter Name:\"\n new_name = gets.chomp\n puts \"Enter Email\"\n new_email = gets.chomp\n puts Contact.create(new_name, new_email)\n when \"show\"\n puts \"Enter ID:\"\n id = gets.chomp.to_i\n puts Contact.find(id)\n when \"search\"\n puts \"Enter a keyword\"\n term = gets.chomp\n puts Contact.search(term)\n end\n end", "def listOptions\r\n\r\n puts \"Hello. This calculator has the following options.\"\r\n\r\n while (!@check_action)\r\n puts \"\\nChoose what you want to calculate:\"\r\n listMethods\r\n action = gets.chomp.upcase\r\n case action\r\n when \"BMI\"\r\n bodyMassIndex\r\n when \"SPEED\"\r\n mediumSpeed\r\n when \"TRI\"\r\n triangleArea\r\n when \"EXIT\"\r\n @check_action = true\r\n else\r\n puts \"Not a valid entry. Please check again your options.\"\r\n end\r\n end\r\n\r\n puts \"Goodbye.\"\r\n end", "def display_options(list)\r\n\tputs \"Please select an option (by number):\"\r\n\tlist.each_with_index {|command, index| puts \"#{index+1}. #{command}\"}\r\n\tputs \"Enter 'q' to quit\"\r\nend", "def options_for_select\n choices.map do |choice|\n data = {}\n data[\"choice-category\"] = choice.category_id if choice.category_id\n\n content_tag(\n :option,\n choice.short_name,\n :value => choice.id,\n :selected => selected_choice?(item, choice),\n :data => data\n )\n end.join.html_safe\n end", "def show\n @menu = \"option\"\n @board = \"option\"\n @section = \"show\"\n \n @option = Option.get(params[:id])\n @optionsubs = @option.optionsubs.all(:order => [ :priority.asc ])\n \n render 'admin/options/option', :layout => false\n end", "def menu\n system('clear')\n selection = @prompt.select('》 PLAYLIST 《', ['Display', 'Add', 'Remove', 'Export To File', 'Back'])\n case selection\n when 'Display'\n list\n else\n case_menu(selection)\n end\n end", "def action_menu(choice,phonebook)\n case choice\n when \"1\"\n show_cities(phonebook)\n when \"2\"\n show_area_code(phonebook)\n else\n puts \"Invalid choice! Example: Type \\\"1\\\" to list all cities available. \\n\\n\"\n end\nend", "def listOptions\n\n if @assessment.has_partners then\n partnersListOptions()\n end\n \n if @assessment.has_svn then\n svnListOptions()\n end\n \n if @assessment.has_scoreboard then\n scoreboardListOptions()\n end\n end", "def list_choices\n state_names = []\n @states.each do |state|\n state_names << state.name\n end\n\n prompt = TTY::Prompt.new\n @user_selection = prompt.enum_select(\"Select a state by it's number\", state_names)\n end", "def display_values\n options.each do |option|\n update_ui option, read(option)\n end\n end", "def display_menu choices\n\t\tmenu_array = [\"\\nHangman Options\", \"===============\"] + choices\n\t\tmenu_array.each { |menu| puts menu }\t\t\n\tend", "def select_option\n print_menu\n @choice = gets.chomp\n perform_selection\n end", "def show_possible_values(options={})\n\t\t@operator.choose do |menu|\n\t\t\toptions.each do |key, value|\n\t\t\t\tmenu.choice(key) { value }\n\t\t\tend\n\t\tend\n\tend", "def menu_list \n puts \"Please select from the following options: \"\n puts \" Enter '1' to create a new donation!\"\n puts \" Enter '2' to see a list of the organizations accepting donations\"\n puts \" Enter 'exit' if you changed your mind and wish to leave the app\"\n puts \" To see the menu options again, please enter 'menu'\"\nend", "def show_possible_actions(options={})\n\t\t@operator.choose do |menu|\n\t\t\toptions.each do |key, value|\n\t\t\t\tmenu.choice(key) { send(*value) if value }\n\t\t\tend\n\t\tend\n\tend", "def user_select(items)\n h.choose do |menu|\n menu.index = :number\n menu.prompt = 'Please Choose One:'\n menu.select_by = :index_or_name\n items.each do |item|\n menu.choice item.to_sym do |command|\n ui.msg \"Using: #{command}\"\n selected = command.to_s\n end\n end\n menu.choice :all do return :all end\n menu.choice :exit do exit 1 end\n end\n end", "def menu\n puts \"#{dashes}\\n\n Choose from the following options - using the numbers (1-6) as your input:\\n\n - 1 - Create your user profile\n - 2 - Search for doctors by region\n - 3 - Search for doctors by specialty\n - 4 - Search for the doctors the user has visited\n - 5 - Does something else\n - 6 - Quit the application\n \"\n end", "def list(option)\n\t\tcase option\n\t\twhen \"1\" then logout\n\t\twhen \"2\" then products_list\n\t\twhen \"3\" then create_product\n\t\twhen \"4\" then users_index\n\t\tend\n\tend", "def menu\n puts \"\\n************************************************************\".colorize(:magenta).blink\n puts \"Select an option (1-5) from the menu below:\".colorize(:blue).bold\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"1. Don't want to think about what to cook? \\n Spin the RANDOM WHEEL OF RECIPES!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"2. Need some inspiration for cooking? \\n Find recipe by name OR \\n if you have leftover ingredients search your ingredients!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"3. Feeling creative? \\n Write and save your own recipe!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"4. View ALL your favorite recipes in 1 place!\".colorize(:blue)\n puts \"------------------------------------------------------------\".colorize(:cyan)\n puts \"5. You're done? Time to exit...\".colorize(:blue)\n puts \"************************************************************\\n \".colorize(:magenta).blink\n end", "def options\n\tputs \"[A]dd employee\"\n\tputs \"[D]isplay the employee details\"\n\tputs \"[Q]uit\"\n\tputs \"\"\nend", "def render_menu\n @choices.each_with_index do |choice, index|\n indicator = (index + 1 == @active) ? @marker : Symbols::SPACE\n indicator += Symbols::SPACE\n message = if @selected.include?(choice)\n selected = @prompt.decorate(Symbols::RADIO_CHECKED, :green)\n selected + Symbols::SPACE + choice.name\n else\n Symbols::RADIO_UNCHECKED + Symbols::SPACE + choice.name\n end\n newline = (index == @choices.length - 1) ? '' : \"\\n\"\n @prompt.print(indicator + message + newline)\n end\n end", "def present_menu\n puts \"-------------------\"\n puts t('select_features')\n puts t('feature_one')\n puts t('feature_two')\n puts t('feature_three')\n puts t('exit_option')\n\n selected_feature = gets.to_i\n\n case selected_feature\n when FEATURE_OPTION_MAJOR_STATES\n print_major_states\n when FEATURE_OPTION_AVERAGE_POP\n print_average_population_for_state\n when FEATURE_OPTION_BOUNDARY_CITIES\n print_boundary_cities_for_state\n when FEATURE_OPTION_EXIT\n return\n else\n puts t('invalid_option', option: selected_feature)\n run\n end\n end", "def select_fan_from_list(my_fans)\n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"Here's a list of the players: (you can type the name of the player to filter through the players)\", filter: true) do |menu|\n my_fans.each do |fan|\n menu.choice fan.name\n end\n end\n \nend", "def show_menu\n clear_screen\n\n puts \"[+] #{FreelancerFinder::Job.all.count} Jobs Scraped [+]\".magenta\n puts \"_____________________________________________________________\"\n return @prompt.select(\"Please Select a Menu Option: \") do |menu|\n menu.choice \"show recent\"\n menu.choice \"scrape more\"\n menu.choice \"search\"\n menu.choice \"search by pay\"\n if @last_results\n menu.choice \"results\"\n end\n menu.choice \"exit\"\n end\n\n end", "def my_list\n system('clear')\n selection = @prompt.select(\"》 MY LIST 《\\n\".colorize(:light_green), %w[Display Add Remove Back])\n mylist = MyList.new(@user)\n case_my_list(selection, mylist)\n end", "def presented_service_options(available_services, chosen_service, chosen_city)\n deal_choice = \"choice\"\n if available_services == []\n puts \"Unfortunately we have no offers for #{chosen_service} services in #{chosen_city} today.\"\n else\n puts \"Here are you offers for #{chosen_service} services in #{chosen_city}:\\n\\n\"\n deals = []\n counter = 1\n available_services.each do |service|\n deals << {name: \"Offer #{counter}:\n #{service.name} at '#{Merchant.find(service.merchant_id).name}'\n Costs just $#{service.deal_price}. Reduced from $#{service.list_price}. A #{service.discount.to_i}% saving!\n Call #{service.phone} for more information or come join us over at #{service.address} for immediate service!\n Visit us online at #{service.url} to learn more.\", value: service.url}\n counter += 1\n end\n deals << {name: \"Exit\", value: \"exit\"}\n prompt = TTY::Prompt.new\n deal_choice = prompt.select(\"Select a deal to view the offer online:\", deals)\n if deal_choice != \"exit\"\n Launchy.open(deal_choice)\n end\n end\n deal_choice\n end", "def show\n @choice_1 = (@situation.choice_1 && @situation.choice_1 != 0) ? @situation.choice_1 : \"new?oid=#{@situation.id}&obutton=1\"\n @choice_2 = (@situation.choice_2 && @situation.choice_2 != 0) ? @situation.choice_2 : \"new?oid=#{@situation.id}&obutton=2\"\n @choice_1_label = @situation.choice_1_label\n @choice_2_label = @situation.choice_2_label\n end", "def display_main_menu_choice\n #The disabled choice will be displayed with a cross ✘ character next to it and followed by an explanation:\n menu_choices = [\n 'First Time User, Want To Register',\n 'Already A Registered User, Want To Login',\n # { name: 'Goro', disabled: '(injury)' },\n 'Do Not Wish To Register, Just Browsing',\n 'Looking For Info About The App',\n 'Nothing Really, Spare Me Your @?%#&?|%!'\n ]\n choice_msg = 'What Will It Be, We Offer A Great Many Choices!'\n # system \"say #{choice_msg}\"\n main_menu_choice = prompt.select('What Will It Be, We Offer A Great Many Choices!'.colorize(:color => :light_blue), menu_choices)\nend", "def display_choices\n display = []\n VALID_CHOICES.each do |key, val|\n display << \"[#{val}]#{key.to_s.slice(val.length, key.length)}\"\n end\n display\nend", "def prompt_option_tag(type, options); end", "def hike_options\n system 'clear'\n puts \"-----MY HIKES-----\"\n menu = [\"Start New Hike\",\n \"End Hike\",\n \"Edit Hike\",\n \"List All My Hikes\",\n \"Exit\"]\n\n choice = @prompt.select(\"Which option would you like to take?\", menu)\n\n case choice\n when \"Start New Hike\"\n start_hike\n when \"End Hike\"\n end_hike\n when \"Edit Hike\"\n edit_options\n when \"List All My Hikes\"\n list_user_hikes\n end\n\n end", "def show\n initLists\n end", "def select_list; end", "def show_options\n head :ok\n end", "def view_by_category\n system \"clear\"\n prompt = TTY::Prompt.new\n prompt.select (\"Choose a category\") do |menu|\n menu.choice \"Action\", -> {show_games_by_category(\"Action\")}\n menu.choice \"Action-Adventure\", -> {show_games_by_category(\"Action-Adventure\")}\n menu.choice \"Adventure\", -> {show_games_by_category(\"Adventure\")}\n menu.choice \"Puzzle\", -> {show_games_by_category(\"Puzzle\")}\n menu.choice \"Role-playing\", -> {show_games_by_category(\"Role-playing\")}\n menu.choice \"Simulation\", -> {show_games_by_category(\"Simulation\")}\n menu.choice \"Sports\", -> {show_games_by_category(\"Sports\")}\n menu.choice \"Strategy\", -> {show_games_by_category(\"Strategy\")}\n end\n end", "def choose(choices, title)\n @dialog.title = \"\\\"#{title}\\\"\"\n res = @dialog.menu(title, choices)\n \n raise CancelPressed.new unless res\n \n res\n end", "def select_player_from_list(my_players)\n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"Here's a list of the players: \", filter: true) do |menu|\n my_players.each do |player|\n menu.choice player.name\n end\n end\nend", "def simple_selection_panel(value, options, t = nil)\n\t\trender :partial => \"shared/forms/panel/simple_selection\", :locals => { :value => value, :options => options, :title => t }\n\tend", "def chosen_options\n Option.find_all_by_id session[:chosen_options]\n end", "def show\n @option = Vger::Resources::Suitability::Option.find(params[:id], :factor_id => params[:factor_id], :item_id => params[:item_id], :methods => [:option_type])\n respond_to do |format|\n format.html\n end\n end", "def menu_options()\n print_message 'Select operation to perform'\n print_message '1. Add'\n print_message '2. Substract'\n print_message '3. Multiply'\n print_message '4. Divide'\n print_message \"Or press 'q' to exit calculator app\"\n end", "def show\n combo_producto\n combo_platillo\n end", "def index\n @options = Option.all\n end", "def index\n @options = Option.all\n end", "def index\n @options = Option.all\n end", "def index\n @options = Option.all\n end", "def index\n @options = Option.all\n end", "def index\n @options = Option.all\n end", "def menu\n ([[0, 'Choisir l’icarien…']] + User.values_select(type_icarien => true)).in_my_select(id: 'opuser_user_id', name: 'opuser[user_id]', selected: param_opuser[:user_id])\n end", "def menu_options\n puts \"Good morning, you have two options; you can either\"\n puts \"1. Add students to the directory\\n 2. View a list of students enrolled at Makers Academy\\n 3. Save the list of students to a file\\n 9. Exit the programme.\"\n puts \"Please type the option you would like?\"\nend", "def trail_options\n menu = [\"View All Trails\", \n \"Search for Trail\", \n \"Exit\"]\n system 'clear'\n puts \"------TRAILS------\"\n choice = @prompt.select(\"Which action would you like to take?\", menu)\n case choice\n when \"View All Trails\"\n print_trail_info(Trail.all)\n when \"Search for Trail\"\n search_for_trail(Trail.all)\n end\n @prompt.keypress(\"Press any key to continue\")\nend", "def options_menu(noteboard)\n @start_prompt = TTY::Prompt.new\n @start_prompt.select(\"What do you want to do now?\") do |menu|\n menu.choice \"Load existing noteboards\", -> {noteboard_menu}\n menu.choice \"Add new note\", -> {Noteboard.noteboard_add(add_note)}\n menu.choice \"Delete note\", -> {Noteboard.noteboard_delete(delete_note)}\n menu.choice \"Back\", -> {StartMenu.new}\n end\nend", "def user_select(items)\n choose do |menu|\n menu.index = :number\n menu.prompt = \"Please Choose One:\"\n menu.select_by = :index_or_name\n items.each do |item|\n menu.choice item.to_sym do |command| \n say \"Using: #{command}\" \n selected = command.to_s\n end\n end\n menu.choice :exit do exit 1 end\n end\n end", "def call_option(selected)\n case selected\n when 1\n Contact.add_contact\n when 2\n Contact.modify\n when 3\n Contact.delete_versions\n when 4\n Contact.display_contacts\n when 5\n Contact.search_by_attribute\n when 6\n puts \"Bye bye Sasha...\"\n exit\n end\n\n end", "def display_menu\n puts \"\\nEnter option: \"\n puts '1. List Existing Threads'\n puts '2. List Single Thread'\n puts '3. Create new Thread'\n puts 'Q. Quit'\n end", "def choose_club\n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"For which club?\", filter: true) do |menu|\n all_clubs.each do |club|\n menu.choice club.name\n end\n end\nend", "def menu_arrows\n PROMPT.select('choose from the following'.colorize(color: :blue)) do |menu|\n menu.choice({ name: 'receive a recommendation', value: '1' })\n menu.choice({ name: 'view all games', value: '2' })\n menu.choice({ name: 'add a game', value: '3' })\n menu.choice({ name: 'delete games', value: '4' })\n menu.choice({ name: 'time wasted on video games', value: '5' })\n menu.choice({ name: 'exit application', value: '6' })\n end\n end", "def manage_account_menu\n choice = @prompt.select(\"Please choose from the following options:\") do |menu|\n menu.choice 'Change my name'\n menu.choice 'Change my password'\n menu.choice 'Delete my account'.blue\n menu.choice \"Back to Main Menu\"\n end\n\n if choice == \"Change my name\"\n change_name\n elsif choice == \"Change my password\"\n change_password\n elsif choice == \"Delete my account\".blue\n delete_account\n elsif choice == \"Back to Main Menu\"\n start_menu\n end\nend", "def new\n @menu = \"option\"\n @board = \"option\"\n @section = \"new\"\n \n @option = Option.new\n @select_main_option = Option.all(:order => [ :priority.asc ]) \n\n render 'admin/options/option'\n end", "def get_choices()\n\n puts \"Player choice: #{@player_choice}\\n\\n\"\n puts \"Computer choice: #{@computer_choice}\\n\\n\"\n\n end", "def index\n @selected_options_of_pcs = SelectedOptionsOfPc.all\n end", "def show\n @choices = Choice.where(course_id: @course.id)\n end", "def secret_menu\n puts \"\"\n options = [\"View Character Dictionary\", \"View Spellbook\", \"View House\", \"View Classmates\", \"Quit\"]\n choice = PROMPT.select(\"Welcome to Hogwarts. Feel free to explore the following:\", options)\n case choice\n when options[0]\n character_dictionary\n when options[1]\n which_user_spellbook_and_path?\n secret_menu_or_quit\n when options[2]\n house_info\n secret_menu_or_quit\n when options[3]\n user_classmates\n when options[4]\n goodbye\n end\n end", "def list_opts(classname, args = {})\n Knj::ArrayExt.hash_sym(args)\n classname = classname.to_sym\n\n if args[:list_args].is_a?(Hash)\n list_args = args[:list_args]\n else\n list_args = {}\n end\n\n html = \"\"\n\n if args[:addnew] or args[:add]\n html << \"<option\"\n html << \" selected=\\\"selected\\\"\" if !args[:selected]\n html << \" value=\\\"\\\">#{_(\"Add new\")}</option>\"\n elsif args[:none]\n html << \"<option\"\n html << \" selected=\\\"selected\\\"\" if !args[:selected]\n html << \" value=\\\"\\\">#{_(\"None\")}</option>\"\n end\n\n self.list(classname, args[:list_args]) do |object|\n html << \"<option value=\\\"#{object.id.html}\\\"\"\n\n selected = false\n if args[:selected].is_a?(Array) and args[:selected].index(object) != nil\n selected = true\n elsif args[:selected] and args[:selected].respond_to?(\"is_knj?\") and args[:selected].id.to_s == object.id.to_s\n selected = true\n end\n\n html << \" selected=\\\"selected\\\"\" if selected\n\n obj_methods = object.class.instance_methods(false)\n\n begin\n if obj_methods.index(\"name\") != nil or obj_methods.index(:name) != nil\n objhtml = object.name.html\n elsif obj_methods.index(\"title\") != nil or obj_methods.index(:title) != nil\n objhtml = object.title.html\n elsif object.respond_to?(:data)\n obj_data = object.data\n\n if obj_data.key?(:name)\n objhtml = obj_data[:name]\n elsif obj_data.key?(:title)\n objhtml = obj_data[:title]\n end\n else\n objhtml = \"\"\n end\n\n raise \"Could not figure out which name-method to call?\" if !objhtml\n html << \">#{objhtml}</option>\"\n rescue => e\n html << \">[#{object.class.name}: #{e.message}]</option>\"\n end\n end\n\n return html\n end", "def main_menu_prompt\n welcome\n menu = [\n { name: \"View list of Recipes\", value: 1},\n { name: \"Input a new recipe into the recipe book\", value: 2},\n { name: \"Edit a recipe from the recipe book\", value: 3},\n { name: \"Display Help information\", value: 4},\n { name: \"Exit\", value: 5}\n ]\nmm_choice = $prompt.select(\"Please select an option\", menu)\nreturn mm_choice\nend", "def display_movie_list_and_movie_list_options\n puts format_movie_list\n movie_list_options_list\n end", "def house_menu\n puts \"\n ┬ ┬┌─┐┬ ┬┌─┐┌─┐ ┬┌┐┌┌─┐┌─┐\n ├─┤│ ││ │└─┐├┤ ││││├┤ │ │\n ┴ ┴└─┘└─┘└─┘└─┘ ┴┘└┘└ └─┘\n\n Please select an option from below:\n \"\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Find all characters of a house\",\n \" [2] Find largest houses\",\n \" [3] Find all houses of a region\",\n \" [4] Find info of a house\",\n \" [5] Wiki Menu\",\n \" [6] Main Menu\"\n ]\n prompt.select(\" \", menu_choices)\nend", "def situation_selection\n $prompt.select(\"Welcome to Ticket Master! What would you like to do?\") do |menu|\n menu.choice 'Sign up'\n menu.choice 'Login'\n menu.choice 'Terminate program'\n end\nend", "def show_options(message,options,default=nil,title=\"Options\")\r\n\tif default.nil?\r\n\t\tdefault = options[0]\r\n\tend\r\n\tchoice = JOptionPane.showInputDialog(nil,message,title,JOptionPane::PLAIN_MESSAGE,nil,options.to_java(:Object),default)\r\n\treturn choice\r\nend", "def edit_ingredients\n @prompt.select(\"Do you want to add or delete ingredients?\") do |menu|\n menu.choice \"Add ingredient(s)\", -> {add_ingredients}\n menu.choice \"Delete ingredient(s)\", -> {delete_ingredients}\n menu.choice \"Back to menu\", -> {nav_menu}\n end\n end", "def showOptions()\n\t\tif defined? @@opt\n\t\t\tgetOptions(@@opt)\n\t\telse\n\t\t\t# there is no option file on current path, maybe not a module path?\n\t\t\tputs \"[-]\".red + \" No options available. Are you using a module?\"\n\t\t\t\n\t\tend\n\tend", "def menu_selection\n PROMPT.select('Please make a selection!'.colorize(:magenta)) do |menu|\n menu.choice({ name: \"Track Today's Mood\", value: '1' })\n menu.choice({ name: 'View Tracked Moods', value: '2' })\n menu.choice({ name: 'Good Vibes Please', value: '3' })\n menu.choice({ name: 'Exit', value: '4' })\n end\n end", "def show_menu\n\n menu_pick = @prompt.select('Please select a menu option: ') do |menu|\n menu.choice 'Show Events by Country', 'find by country'\n menu.choice 'Show Events by City', 'find by city'\n menu.choice 'Show Events By Date', 'find by date'\n menu.choice 'Get Event Info By Name', 'find by name'\n menu.choice 'Exit', 'exit'\n end\n\n return menu_pick if menu_pick == 'exit'\n\n event = handle_input(menu_pick)\n\n display_info(event) if event\n\n end", "def apphelp_menu( values, method, options = {} )\n form = options.delete( :form )\n vals = values.dup # Don't alter passed-by-reference array from caller\n vals.unshift( options.delete( :include_blank ) ) if ( options.has_key?( :include_blank ) )\n\n if ( form.nil? )\n return select_tag(\n method,\n options_for_select(\n vals,\n options.delete( :selected ) || vals[ 0 ][ 1 ]\n ),\n options\n )\n else\n return form.select( method, vals, {}, options )\n end\n end", "def select_option_display\n display_value = self.name + \" [v.#{self.snapshot}]\"\n display_value += self.synopsis.present? ? \" (#{self.synopsis})\" : \"\"\n display_value\n end" ]
[ "0.7181122", "0.7048328", "0.70123655", "0.6892284", "0.68794775", "0.68792945", "0.6852025", "0.6832611", "0.6800041", "0.6772683", "0.6688377", "0.6677057", "0.6598785", "0.656241", "0.6561706", "0.65510786", "0.6516383", "0.6504605", "0.6499889", "0.6499889", "0.64774376", "0.64774376", "0.6469556", "0.6425434", "0.6408952", "0.64089394", "0.64010334", "0.6375776", "0.6364185", "0.63610023", "0.63583857", "0.63523215", "0.63324803", "0.63312906", "0.63261807", "0.6315785", "0.63135296", "0.6309716", "0.63089347", "0.6298003", "0.62858075", "0.62777907", "0.6258165", "0.6218553", "0.6215586", "0.61939234", "0.6167723", "0.615541", "0.61553967", "0.6142537", "0.61401325", "0.6125425", "0.61107916", "0.60974884", "0.60836524", "0.6080615", "0.60778844", "0.60647273", "0.60627127", "0.605117", "0.60380495", "0.6033985", "0.60261333", "0.6024191", "0.602183", "0.6009837", "0.59969926", "0.5996768", "0.59931153", "0.5987719", "0.5987719", "0.5987719", "0.5987719", "0.5987719", "0.5983262", "0.5974215", "0.5970952", "0.5960636", "0.59577996", "0.59572476", "0.595486", "0.5953286", "0.59511614", "0.59500355", "0.59479517", "0.5942833", "0.59411716", "0.59372", "0.5927836", "0.5922212", "0.59143716", "0.59137666", "0.59109586", "0.5902543", "0.5896922", "0.588766", "0.58829707", "0.58816445", "0.58812934", "0.5865453", "0.585899" ]
0.0
-1
read and write accessors
def initialize(name, city, year_built) @name = name @city = city @year_built = year_built @renovated_on = year_built end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getters; end", "def read\n raise NotImplementedError\n end", "def read\n end", "def read\n _read\n end", "def read\n end", "def read\n end", "def read\n end", "def read\n end", "def read\nend", "def value_read; end", "def name\n return @name\nend\ndef age\n return @age\nend\n#setters, allows you to change or set something\ndef name=(name)\n @name = name\nend", "def read\n\t\t\t\t\tnil\n\t\t\t\tend", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read; end", "def read_attribute\n record.public_send(attribute)\n end", "def read_field\n end", "def attr_reader(*)\n end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def read\n \n end", "def accessors\n self.class.accessors\n end", "def readwrite(*fields)\n readable(*fields)\n writable(*fields)\n allow(*fields)\n nil\n end", "def read\n super\n\n self.fetch\n\n self.items\n end", "def get()\n \n end", "def accessor\n @@accessor ||= nil\n @@accessor\n end", "def delegate_object_reader_method; end", "def read\n value = record.send(\"#{name}_data\")\n value unless value.nil? || value.empty?\n end", "def read_write?(name, tag)\n raise(\"Method not implemented for this class: #{@klass}\")\n end", "def field_accessors(name)\n field_reader(name)\n attr_writer(name)\n end", "def read(*args)\n #This is a stub, used for indexing\n end", "def read\n object.content\n end", "def read() end", "def method_missing(method, *args)\n return @reader.send(method, *args) if @reader.respond_to? method\n super\n end", "def definition\n case @rw\n when 'RW' then 'attr_accessor'\n when 'R' then 'attr_reader'\n when 'W' then 'attr_writer'\n end\n end", "def get\n raise NotImplementedError\n end", "def _read_attribute(key); end", "def reader; end", "def read_attribute\n Logging.debug \"Read attribute #{field_name}, got #{object.send(:read_attribute,field_name)} for #{object.inspect}\"\n object.send( :read_attribute, field_name )\n end", "def read(key)\n raise NotImplementedError, \"#{__method__} has not been implemented for this #{name} index\"\n end", "def attr; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def instance_read(attr)\n getter = :\"#{@name_string}_#{attr}\"\n instance.send(getter) if instance.respond_to?(getter)\n end", "def read\n read_object(read_byte)\n end", "def attributes; Common.attributes(@handle); end", "def instance_read(attr)\n getter = :\"#{name}_#{attr}\"\n responds = instance.respond_to?(getter)\n cached = self.instance_variable_get(\"@_#{getter}\")\n return cached if cached\n instance.send(getter) \n end", "def accessor(*definitions)\n reader(*definitions) && writer(*definitions)\n end", "def get(object); end", "def read\n @handle.read\n end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def read(length = nil)\n #This is a stub, used for indexing\n end", "def _read_attribute(attr)\n @attributes[attr]\n end", "def inject_acl_object_getter_setter(method_name)\n inject_acl_object_check(method_name, :read)\n inject_acl_object_check(\"#{method_name}=\",:write)\n end", "def md_accessor(*accessors)\n md_reader(*accessors)\n md_writer(*accessors)\n end", "def data\n raise NotImplementedError\n end", "def read(object, attribute, ivar = T.unsafe(nil)); end", "def read(_request)\n raise NotImplementedError, 'Implement this method in your strategy'\n end", "def read!\n self.update_attribute(:status, READ)\n end", "def set_read\n @read = Read.find(params[:id])\n end", "def edit\n @reader = current_reader\n end", "def read_only?; end", "def read_only?; end", "def key_accessor *keys\n key_writer *keys\n key_reader *keys\n end", "def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n write_attribute(attribute, args.first)\n else\n read_attribute(attribute)\n end\n else\n super(meth, *args, &blk)\n end\n end", "def attributes\n end", "def read\n load_column(read_attribute)\n end", "def read_state\n end", "def [](name)\n read_attribute(name)\n end", "def readonly?; true; end", "def readonly?; true; end", "def readonly?; true; end", "def read(attrs)\n new(attrs).instance_eval do\n @new_record = false\n @dirty = false\n self\n end\n end", "def key_attr_reader(key)\n define_method key do\n self[key]\n end\n end", "def setter_to_getter(node); end", "def attr_accessor_sybling(method)\n attr_reader?(method) ? to_attr_writer(method) : to_attr_reader(method)\n end" ]
[ "0.7230983", "0.7070723", "0.6883437", "0.68400717", "0.6785759", "0.6785759", "0.6785759", "0.6785759", "0.6716437", "0.6714612", "0.6668406", "0.6667101", "0.6536095", "0.6536095", "0.6536095", "0.6536095", "0.6536095", "0.6536095", "0.6536095", "0.6423896", "0.63686836", "0.6348272", "0.63262355", "0.63262355", "0.63262355", "0.63262355", "0.63262355", "0.63262355", "0.63262355", "0.63107175", "0.62826234", "0.6231482", "0.62090844", "0.6171519", "0.6170276", "0.6168228", "0.6159451", "0.6154702", "0.6122518", "0.6119592", "0.61185145", "0.61074185", "0.60727924", "0.6049648", "0.60372394", "0.6031025", "0.60302854", "0.60166985", "0.59988755", "0.5996046", "0.59902936", "0.59902936", "0.59902936", "0.59902936", "0.59902936", "0.59902936", "0.59902936", "0.59902936", "0.59902936", "0.59902936", "0.59902936", "0.5967254", "0.59601045", "0.5941117", "0.5934932", "0.5934217", "0.5914258", "0.59084976", "0.58848274", "0.58848274", "0.58848274", "0.58848274", "0.58848274", "0.58848274", "0.58848274", "0.58848274", "0.5876751", "0.5868424", "0.58602834", "0.5846138", "0.58304304", "0.5829489", "0.58288854", "0.58232695", "0.5806059", "0.5794566", "0.57915515", "0.57915515", "0.57904696", "0.5784826", "0.577368", "0.5767619", "0.57419866", "0.5741471", "0.57300466", "0.57300466", "0.57300466", "0.5725233", "0.5718063", "0.57175916", "0.5715754" ]
0.0
-1
num1 the first integer num2 the second integer num3 the third integer Examples max_of_three(2, 100, 1000) => 1000 Returns the biggest integer
def max_of_three(num1, num2, num3) return num1 if num1 > num2 && num1 > num3 return num2 if num2 > num3 && num2 > num1 return num3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_of_three num1, num2, num3\n\tif num1 > num2 && num1 > num3\n\t\treturn num1\n\telsif num2 > num1 && num2 > num3\n\t\treturn num2\n\telsif num3 > num1 && num3 > num2\n\t\treturn num3\n\tend\n\nend", "def max_of_three(num1, num2, num3)\n\t[num1, num2, num3].max\nend", "def max_of_three(num1, num2, num3)\n numbers = num1, num2, num3\n return numbers.max\nend", "def max_of_three num1, num2,num3\n if num1>num2 && num1> num3\n num1\n elsif num2>num1 && num2>num3\n num2\n end\n num3\nend", "def max_of_three(num1, num2, num3)\n largest = 0\n if num1 > num2\n largest = num1\n else \n largest = num2\n end\n\n if num3 > largest\n return num3\n else\n return largest\n end\nend", "def max_of_three(num1, num2, num3)\n output = 0\n if num1 > num2 and num1 > num3\n output = num1\n elsif num2 > num3 and num2 > num1\n output = num2\n else\n output = num3\n end\n return output\nend", "def max_of_three(num1, num2, num3)\n result = [num1, num2, num3].max\n return result\nend", "def max_of_three num1,num2,num3\n\t[num1, num2, num3].max\nend", "def max_of_three(max,num2, num3)\n if max < num2\n max = num2\n end\n if max < num3\n max = num3\n end\n return max\nend", "def max_of_three(num1,num2,num3)\n if max_of_two(num1,num2) <= num3\n return num3\n end\n return max_of_two(num1,num2)\nend", "def max(num1, num2, num3) \n\tif num1 >= num2 and num1 >= num3\n\t\treturn num1\n\telsif num2 >= num1 and num2 >= num3\n\t\treturn num2\n\telse\n\t\treturn num3\n\tend\nend", "def max_of_three(n1, n2, n3)\n largest = n1\n if n1 < n2\n largest = n2\n end\n if largest < n3\n largest = n3\n end\n return largest\nend", "def max_of_three(num1,num2,num3)\n return num1 if num1 > num2 && num1 > num3\n return num2 if num2 > num1 && num1 > num3 \n return num3\nend", "def max(num1,num2,num3)\n if num1>num2 and num1>num3\n return num1\n elsif num2>num1 and num2>num3\n return num2\n elsif num3>num1 and num3>num2\n return num3\n end\nend", "def max_of_three num1, num2, num3\n # if num1 < num2\n # num1, num2 = num2, num1\n # end\n # if num1 < num3\n # num1, num3 = num3, num1\n # end\n # num1\n [num1, num2, num3].max\nend", "def max_of_three num1, num2, num3\n\tarrayNumbers = [num1, num2, num3]\n\treturn arrayNumbers.max\nend", "def max_of_three n1, n2, n3\n [n1, n2, n3].max\nend", "def max(num1, num2, num3)\n if num1 >= num2 and num1 >= num3\n return num1\n elsif num2 >= num1 and num2 >= num3\n return num2\n else\n return num3\n \n end\nend", "def max_of_three(num1, num2, num3)\n i = 0\n arr = [num2, num3]\n max = num1\n while i < 2\n if max < arr[i]\n max = arr[i]\n end\n i += 1\n end\n return max\nend", "def max(num1, num2, num3)\r\n if num1 >= num2 && num1 >= num3\r\n return num1\r\n elsif num2 >= num1 && num2 >= num3\r\n return num2\r\n else\r\n return num3\r\n end\r\nend", "def max(num1, num2, num3)\n if (num1 >= num2) && (num1 >= num2)\n return num1\n elsif (num2 >= num1) && (num2 >= num3)\n return num2\n else \n return num3\n end \nend", "def min_of_three(num1, num2, num3)\n \n biggest = 0\n if num1 < num2 \n biggest = num2\n else \n biggest = num1\n end\n\n if biggest < num3\n return num3\n else \n return biggest\n end\nend", "def max_of_three(a,b,c)\n answer = [a,b,c].max\n return answer\nend", "def max_of_four(num1, num2, num3, num4)\n largest = 0\n if num1 > num2\n largest = num1\n else\n largest = num2\n end\n if largest > num3 && largest > num4\n return largest\n elsif num3 > largest\n largest = num3\n end\n return largest if largest > num4\n return num4\nend", "def max_of_four(number1, number2, number3, number4)\n if number1 > number2\n max1 = number1\n else\n max1 = number2\n end\n if number3 > number4\n max2 = number3\n else\n max2 = number4\n end\n if max1 > max2\n return max1\n else\n return max2\n end\nend", "def max(num1, num2, num3)\n if num1 >= num2 and num1 >= num3\n return num1\n elsif num2 >= num1 and num2 >= num3\n return num2\n else\n return num3\n # this is the end keyword for the if statement\n end\n\nend", "def largest_number (number_1, number_2)\n \n [number_1, number_2].max\n \nend", "def max_of_four(num1, num2, num3, num4)\n if num2 < num1\n if num3 < num1\n if num4 < num1\n return num1\n end\n end\n elsif num3 < num2\n if num4 < num2\n return num2\n end\n elsif num4 > num3\n return num4\n end\n return num3\nend", "def max_of_four(max,num2,num3,num4)\n if max < num2\n max = num2\n end\n if max < num3\n max = num3\n end\n if max < num4\n max = num4\n end\n\n return max\nend", "def max_of_four(n1, n2, n3, n4)\n max1 = n1\n max2 = n3\n\n if n2 > max1\n max1 = n2\n end\n if n4 > max2\n max2 = n4\n end\n if max2 > max1\n max1 = max2\n end\n return max2\nend", "def maxOfManyNumbers(firsParameter, *numbers, lastParameter)\n\tnumbers.max\nend", "def max_of_four(num1,num2,num3,num4)\n temp1 = num1 if num1 > num2\n temp1 = num2 if num2 > num1\n temp2 = num3 if num3 > num4\n temp1 = num4 if num4 > num3\n return temp1 if temp1 > temp2\n return temp2\nend", "def largest_integer(list_of_nums)\n return list_of_nums.max\nend", "def max3nb(nb1, nb2, nb3)\n if((nb1.is_a? Float) && (nb2.is_a? Float) && (nb3.is_a? Float))\n if(nb1 == nb2 && nb1 == nb3)\n puts \"Le maximum entre ces 3 nombres #{nb1}, #{nb2} et #{nb3} est #{nb3}.\"\n else if (nb1 <= nb2)\n if(nb2 <= nb3)\n puts \"Le maximum entre ces 3 nombres #{nb1}, #{nb2} et #{nb3} est #{nb3}.\"\n else puts \"Le maximum entre ces 3 nombres #{nb1}, #{nb2} et #{nb3} est #{nb2}.\"\n end\n else if(nb1 <= nb3)\n puts \"Le maximum entre ces 3 nombres #{nb1}, #{nb2} et #{nb3} est #{nb3}.\"\n else puts \"Le maximum entre ces 3 nombres #{nb1}, #{nb2} et #{nb3} est #{nb1}.\"\n end\n end\n end\n else puts \"Un ou des paramètres ne sont pas de type float.\"\n end\nend", "def maxNumber(first_param,*numbers, last_param)\n\treturn numbers.max\nend", "def third_max(nums)\n first = -Float::INFINITY\n second = -Float::INFINITY\n third = -Float::INFINITY\n nums.each do |num|\n if num > first\n third = second\n second = first\n first = num\n elsif num > second && num < first\n third = second\n second = num\n elsif num > third && num < second\n third = num\n end\n end\n third == -Float::INFINITY ? first : third\nend", "def biggest_number(array_of_integers)\n # TODO\nend", "def third_greatest(nums)\n num1 = nil\n num2 = nil\n num3 = nil\n idx = 0\n \n while idx < nums.length\n value = nums[idx]\n if num1 == nil || value > num1\n num3 = num2\n num2 = num1\n num1 = value\n elsif num2 == nil || value > num2\n num3 = num2\n num2 = value\n elsif num3 == nil || value > num3\n num3 = value\n end\n idx +=1\n end\n return num3\nend", "def max_of_three(term1, term2, term3)\n\n small = term2\n if term1 > small\n small = term1\n end\n \n if small < term3\n small = term3\n end\n return small\nend", "def find_largest_num(nums)\n\treturn nums.max()\nend", "def getMax4nb(nb1, nb2, nb3, nb4)\n return max2nbV2(max2nbV2(nb1, nb2), max2nbV2(nb3, nb4))\nend", "def third_greatest(nums)\n first, second, third = nil, nil, nil\n\n nums.each do |n|\n if first == nil or n > first\n first, second, third = n, first, second\n elsif second == nil or n > second\n second, third = n, second\n elsif third == nil or n > third\n third = n\n end\n end\n third\nend", "def third_greatest(nums)\n g1 = 0\n g2 = 0\n g3 = 0\n nums.each do |x|\n if x > g1\n g1 = x\n end\n end\n nums.each do |x|\n if (x<g1) and (x > g2)\n g2 = x\n end\n end\n nums.each do |x|\n if (x<g2) and (x>g3)\n g3 = x\n end\n end\n g3\nend", "def max(num1, num2, num3) #in the parentesis is specified the parameter.\n if num1 >= num2 and num1 >= num3 #this comparason is either true or false, so needs to use true or false to show comparison\n return num1\n elsif num2 > num1 and num2 >= num3\n return num2\n else \n return num3\n end \nend", "def largest_integer(list_of_nums)\n \tlen = list_of_nums.length\n\tlargest = list_of_nums[0]\n \tif len == 0\n\t\treturn nil\n \telsif len == 1\n \t\treturn largest\n \telse\n \t\tlist_of_nums.each do |num|\n \t\t\tif num > largest\n \t\t\t\tlargest = num\n \t\t \tend\n \t\tend\n \t\treturn largest\n \tend\nend", "def max_of_two(num1, num2)\n max = num1 \n if num2 > num1 \n max = num2\n end\n return max\nend", "def largest_integer(list_of_nums)\n# Your Solution Below\n# Refactored solution\n\treturn list_of_nums.max\nend", "def three_largest_numbers1(nums)\n return if nums.length < 3\n\n first = -Float::INFINITY\n second = - Float::INFINITY\n third = -Float::INFINITY\n nums.each do |num|\n if num > first\n third = second\n second = first\n first = num\n elsif num > second\n third = second\n second = num\n elsif num > first\n third = num\n end\n end\n [first, second, third]\nend", "def largest_integer(list_of_nums)\n max = nil\n max = list_of_nums[0]\n for i in 0...list_of_nums.length\n if list_of_nums[i] > max\n max = list_of_nums[i]\n end\n return max\n end\nend", "def three num\n max = 0\n acc = 1\n for i in 2..num\n if num % i == 0 #first check if i divides the number\n if isPrime?(i) #then check if it is prime (part of the prime factorization)\n max = i #keep the max so far\n temp = num #this loop is for numbers made up of many of the same prime i.e. 2^32\n while (temp % i == 0)\n temp = temp / i\n acc = acc * i\n if acc == num\n return max\n end\n end\n end\n end\n end\n return max\nend", "def largest_integer(list_of_nums)\n largest = nil\n list_of_nums.each do |num|\n if largest == nil\n largest = num\n end\n if num >= largest\n largest = num\n end\n end\n largest\nend", "def largest_integer(list_of_nums)\n largest = list_of_nums[0]\n for num in 1...list_of_nums.length\n \tif largest < list_of_nums[num] then\n \t\tlargest = list_of_nums[num];\n \tend\n end\n return largest;\nend", "def largest_integer(list_of_nums) #define method largest_integer with argument list_of_nums\n max = list_of_nums[0] #set the max as the first position of the array\n list_of_nums.each do |num| #iterate over each number of the array\n \tif \n \t\tmax < num # if max is less than a given number\n \t\tnum = max # the number is equal to max\n \tend # close the if statement\nend # close the method definition\n return max #return the max number\nend", "def third_greatest(nums)\n\t\n\tnums.sort!\n\treturn nums[-3]\nend", "def third_greatest(nums)\n \n first, second, third= nums[0..2].sort.reverse\n \n for num in nums[3..-1]\n if num>first\n # num>first\n first, second, third= num, first, second # #tricky\n # num<=first\n elsif num>second\n # second<num<=first\n second, third= num, second # #tricky\n # num<=second\n elsif num>third\n # third<num<=second\n third= num\n end\n end\n return third\nend", "def max_of_two(num1, num2)\n if num1 >= num2\n output = num1\n else output = num2\n end\n return output\nend", "def max_of_two(number1, number2)\n if number1 > number2\n return number1\n else \n return number2\n end\nend", "def max_of_two(number1,number2)\n if number1 < number2\n output = number2\n else\n output = number1\n end\n return output\nend", "def largest_integer(list_of_nums)\n largest = list_of_nums[0]\n list_of_nums.each do |thisNum|\n if thisNum > largest\n largest = thisNum\n end\n end\n return largest\nend", "def max_of_two(num1, num2)\n \n if num1 < num2\n return num2\n else \n return num1\n end\n end", "def max_of_two(num1, num2)\n if num1 > num2\n return num1\n end\n return num2\nend", "def largest_integer(list_of_nums)\n\treturn nil if(list_of_nums.length <= 0)\n\n\tlargest = list_of_nums[0]\n\tlist_of_nums.each {|x|\n\t\tif(x > largest)\n\t\t\tlargest = x\n\t\tend\n\t}\n\treturn largest\nend", "def largest_integer(list_of_nums)\n\treturn nil if list_of_nums == []\n\tlargest = list_of_nums[0]\n\tfor num in list_of_nums\n\t\tif num > largest\n\t\t\tlargest = num\n\t\tend\n\tend\n\treturn largest\nend", "def largest_num_1(x, y, z)\n\tif (x == x.to_i && y == y.to_i && z == z.to_i)\n\t\tif (x > y && x > z)\n\t\t\treturn puts \"x = #{x} is larger than y = #{y} and z = #{z}\"\n\t\telsif (y > x && y > z)\n\t\t\treturn puts \"x = #{y} is larger than x = #{x} and z = #{z}\"\n\t\telse\n\t\t\treturn puts \"z = #{z} is larger than x = #{x} and y = #{y}\"\n\t\tend\n\tend\nend", "def max_of_two(num1, num2)\n if num1 > num2\n return num1\n else\n return num2\n end\nend", "def max_of_two(num1, num2)\n if num1 > num2\n return num1\n else\n return num2\n end\nend", "def max_of_two(max,num2)\n if max > num2\n return max\n else\n return num2\n end\nend", "def max_of_two(num1, num2)\n output = num1\n if num1 < num2\n output = num2\n end\n return output\nend", "def largest_integer(list_of_nums)\n # Your code goes here!\n if list_of_nums.length == 0 then return nil end\n largest_num = list_of_nums.max\n return largest_num\nend", "def problem_three\n find_factors(600_851_475_143).max\n end", "def largest_number (number_1, number_2)\n if (number_1 == number_2)\n return number_1 # could also return number_2 here, doesn't matter which\n elsif (number_1 < number_2)\n return number_2\n elsif (number_1 > number_2)\n return number_1\n end\nend", "def min_of_three(num1, num2, num3)\n if num1 < num2 && num1 < num3\n return num1\n elsif num2 < num1 && num2 < num3\n return num2\n else\n return numm3\n end\nend", "def find_biggest_product_of_three(input)\n highest_product_o_3 = (input[0] * input[1] * input[2])\n a = input.shift\n b = input.shift\n highest = nil\n lowest = nil\n if a > b\n highest = a\n lowest = b\n else\n highest = b\n lowest = a\n end\n highest_product_o_2 = (a * b)\n highest = a\n lowest_product_o_2 = highest_product_o_2\n lowest = b\n input.each do |number|\n if (number * highest_product_o_2) > highest_product_o_3\n highest_product_o_3 = (number * highest_product_o_2)\n elsif (number * lowest_product_o_2) > highest_product_o_3\n highest_product_o_3 = (number * lowest_product_o_2)\n end\n if (number * highest) > highest_product_o_2\n highest_product_o_2 = (number * highest)\n elsif (number * lowest) < lowest_product_o_2\n lowest = number\n end\n if number > highest\n highest = number\n elsif number < lowest\n lowest = number\n end\n end\n p highest_product_o_3\nend", "def three_largest_numbers(nums)\n return if nums.length < 3\n\n largest = Array.new(3, -Float::INFINITY)\n nums.each do |value|\n if value > largest[2]\n shift_and_update(largest, value, 2)\n elsif value > largest[1]\n shift_and_update(largest, value, 1)\n elsif value > largest[0]\n shift_and_update(largest, value, 0)\n end\n end\n largest\nend", "def max_of_two(num1, num2)\n max_of_x([num1, num2]) \nend", "def max_int(in_first, in_second)\n\tcheck_pre(((in_first.int?) and (in_second.int?)))\n\t(in_first > in_second ? in_first : in_second)\nend", "def max (num1=0, num2=0, *rest)\n \tnum1 > num2 ? num1 : num2\nend", "def largest_int(numbers)\n\tnumbers.sort!\n\tnumbers[-1]\nend", "def max_of_two(max,num2)\n if max < num2\n max = num2\n end\n return max\nend", "def min_of_three(num1, num2, num3)\n if num1 < num2 and num1 < num3\n return num1\n end\n if num2 < num1 and num2 < num3\n return num2\n end\n return num3\nend", "def third_greatest(nums)\n a=nil\n b=nil\n c=nil\n \n idx=0\n while idx < nums.length\n d=nums[idx]\n if a==nil||d > a\n c=b\n b=a\n a=d\n elsif b==nil|| d>b\n c=b\n b=d\n elsif c==nil||d>c\n c=d\n end\n idx+=1\n end\n return c\nend", "def highest_product_of_three(arr)\n return arr.reduce(:*) if arr.length === 3\n\n smallest_negative = nil\n second_smallest_negative = nil\n\n largest_num = 0\n second_largest_num = 0\n third_largest_num = 0\n\n arr.each do |num|\n if num >= 0\n if num > largest_num\n third_largest_num = second_largest_num\n second_largest_num = largest_num\n largest_num = num\n elsif num > second_largest_num\n third_largest_num = second_largest_num\n second_largest_num = num\n elsif num > third_largest_num\n third_largest_num = num\n end\n else\n \n if smallest_negative.nil? || num < smallest_negative\n smallest_negative = num\n elsif second_smallest_negative.nil? || num < second_smallest_negative\n second_smallest_negative = num\n end\n end\n end\n\n option_1 = nil #two negatives, one positive\n option_2 = nil\n if smallest_negative && second_largest_num\n option_1 = smallest_negative * second_smallest_negative * largest_num\n option_2 = largest_num * second_largest_num * third_largest_num\n else\n return largest_num * second_largest_num * third_largest_num\n end\n option_1 > option_2 ? option_1 : option_2\nend", "def getMax2nb(nb1, nb2)\n if(nb1 != nb2)\n if (nb1 > nb2)\n return nb1\n else return nb2\n end\n else return nb2\n end\nend", "def max_of_two(num1, num2)\n return num1 if num1 > num2\n return num2\nend", "def min_of_three(num1, num2, num3)\n if num1 < num2\n if num1 < num3\n return num1\n end\n else\n if num2 < num3\n return num2\n end\n end\n return num3\nend", "def max_of_two(n1, n2)\n if n1 > n2\n return n1\n else\n return n2\n end\nend", "def largest_integer(list_of_nums)\n\t# Your code goes here!\n\tlist_of_nums.to_a.sort! {|firstNum,secondNum| firstNum.to_i <=> secondNum.to_i}\n \treturn list_of_nums[-1]\nend", "def minofthree(num1, num2, num3)\n if num1 > num2\n i = num2\n else \n i = num1\n end\n if num3 < i \n i = num3\n end\n return i\nend", "def min_of_three(min,num2,num3)\n if min > num2\n min = num2\n end\n if min > num3\n min = num3\n end\n return min\nend", "def largest_integer(list_of_nums)\n if list_of_nums.empty? \n return nil\n else \n big=list_of_nums[0]\n list_of_nums.each { |x| \n if x > big\n big=x\n end \n }\n return big\n end\nend", "def max_of_two(int1, int2)\n if !int1.is_a?(Integer) || !int2.is_a?(Integer)\n return nil\n else \n if int1 > int2\n return int1\n else \n return int2\n end\n end\nend", "def largest_integer(list_of_nums)\n return nil if list_of_nums.empty?\n largest = list_of_nums.pop\n list_of_nums.each {|x| largest = x if x > largest }\n largest\nend", "def largest_integer(list_of_numbers)\n # Return nil if the array doesn't have any element.\n return nil if list_of_numbers.length == 0\n # Define the variable to the first element of the array.\n largest_number = list_of_numbers[0]\n # Take the first number!! and store inside defined variable.\n list_of_numbers.each do |number|\n # Go ahead and take the next one\n # Compare that one with the stored number in the variable.\n if largest_number < number\n # Whichever is larger, keep that number inside the variable.\n largest_number = number\n end\n # Continue this process until the array is empty.\n end\n # Return the largest number.\n largest_number\nend", "def largest_number (number_1, number_2)\n if !number_1.kind_of?(Integer) || !number_2.kind_of?(Integer)\n return \"Not comparing Integers!\"\n else\n if number_1 > number_2\n\n return number_1\n \n elsif number_1 < number_2\n \n return number_2\n \n elsif number_1 == number_2\n \n return \"The numbers are equal\"\n \n end\n end\nend", "def decent_num num\n\n arr = []\n\n if num % 5 == 0\n arr << (\"3\"*num).to_i\n end\n\n num.downto(1).each do |fi|\n th = num - fi\n if th % 5 == 0 && fi % 3 == 0\n arr << (\"5\"*fi + \"3\"*th).to_i\n break\n end\n end\n\n\n if arr.empty?\n -1\n else\n arr.max\n end\n\nend", "def third_greatest(nums)\n i = 0\n first = nums[0]\n second = nums [1]\n third = nums[2]\n while i < nums.length\n if nums[i] > first\n first = nums[i]\n end\n i = i + 1\n end\n j = 0\n while j < nums.length\n if (first > nums[j]) && (nums[j] != first)\n second = nums[j]\n end\n j = j + 1\n end\n k = 0\n while k < nums.length\n if (first != nums[k]) && (second != nums[k]) && (nums[k] > third)\n third = nums[k]\n end\n k = k + 1\n end\n return third\nend", "def largest_integer(list_of_nums)\n list_of_nums.sort!\n return list_of_nums[-1]\nend", "def max_of_two(input1,input2)\n if input1 > input2\n output = input1\n else output = input2\n end\n return output\nend", "def maximum_sum_with_no_3_continuous_numbers_2(nums)\n len = nums.length\n x = nums[0]\n y = maximum(x, nums[1])\n z = maximum(x, maximum(y, nums[2]) )\n\n for i in (3...len)\n a = nums[i] + nums[i-1] + x\n b = nums[i] + y\n c = z\n\n temp = maximum(a, maximum(b, c))\n x = y\n y = z\n z = temp\n end\n z\nend", "def max_of_two(n1, n2)\n max = n1 \n if max < n2\n max = n2\n end\n return max\nend" ]
[ "0.85609585", "0.85447156", "0.85396665", "0.85310704", "0.84949017", "0.8492857", "0.8464573", "0.8419367", "0.84154755", "0.8301388", "0.8269331", "0.8266856", "0.8255911", "0.82335585", "0.82212365", "0.8211843", "0.80714935", "0.8038424", "0.7952443", "0.7951491", "0.7883567", "0.7882986", "0.78163534", "0.7609669", "0.7572702", "0.7552025", "0.75403553", "0.7478835", "0.7476364", "0.73919934", "0.73670995", "0.7349336", "0.73040587", "0.7274054", "0.7249444", "0.72096044", "0.7196626", "0.71882087", "0.71263117", "0.712619", "0.7111043", "0.71076846", "0.7089587", "0.70773125", "0.70763767", "0.7075321", "0.70724833", "0.70674384", "0.699047", "0.6987039", "0.697527", "0.69719005", "0.6956633", "0.69547915", "0.6949595", "0.69423115", "0.69378126", "0.693386", "0.69209117", "0.69144267", "0.69095707", "0.6897994", "0.6886426", "0.6879491", "0.68758184", "0.68758184", "0.6853349", "0.68452257", "0.68277156", "0.6827366", "0.6820047", "0.6804732", "0.6795023", "0.67937905", "0.67854017", "0.6764728", "0.67548674", "0.67528236", "0.6748297", "0.6742219", "0.67371047", "0.67298156", "0.67293483", "0.6727414", "0.6715922", "0.6700364", "0.6697936", "0.66928583", "0.6672744", "0.6656851", "0.662097", "0.66097176", "0.6607567", "0.66020346", "0.6601005", "0.658647", "0.6584718", "0.6583318", "0.6581255", "0.65566903" ]
0.83335364
9
List all user targets that will be integrated by this target.
def user_targets return [] unless user_project user_target_uuids.map do |uuid| native_target = user_project.objects_by_uuid[uuid] unless native_target raise Informative, '[Bug] Unable to find the target with ' \ "the `#{uuid}` UUID for the `#{self}` integration library" end native_target end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user_targets = UserTarget.all\n end", "def index\n @targets = current_user.targets\n end", "def users(target = nil)\n raw \"USERS #{target}\".strip << \"\\r\\n\"\n end", "def users(target = nil)\n send_data(\"USERS #{target}\".strip)\n end", "def index\n @targets = Target.all\n end", "def index\n @targets = Target.all\n end", "def index\n @targets = Target.all\n end", "def targets\n\t\tTarget.find(:all)\n\tend", "def get_targets\n {\n method: \"Target.getTargets\"\n }\n end", "def targets()\n if @target then\n return [self]\n else\n return []\n end\n end", "def targets\n return @targets\n end", "def targets\n return @targets\n end", "def users\n gateway_check\n @users\n end", "def targeted_users\r\n if groups.any?\r\n target = []\r\n groups.each do |group|\r\n target << group.active_members\r\n end\r\n\r\n target.flatten!\r\n target_ids = target.map{|u| u.id}\r\n\r\n target = User.where(id: target_ids)\r\n else\r\n target = enterprise.users.active\r\n end\r\n\r\n target = target.for_segments(segments) unless segments.empty?\r\n\r\n target.uniq{|u| u.id}\r\n end", "def targets\n @targets ||= []\n end", "def targets\n\t\t@targets ||= begin\n\t\t\tconfig_list('target(Enumerator)?$').map do |li|\n\t\t\t\tif li[0].downcase == 'target'\n\t\t\t\t\tli[1]\n\t\t\t\telsif li[0].downcase == 'targetenumerator'\n\t\t\t\t\trv = run_command(\"Enumerating targets using '#{li[1]}'\", li[1]).split(/\\s+/)\n\t\t\t\t\tif $?.exitstatus != 0\n\t\t\t\t\t\traise RuntimeError,\n\t\t\t\t\t\t\t\t\"Target enumeration failed. Aborting.\"\n\t\t\t\t\tend\n\t\t\t\t\trv\n\t\t\t\telse\n\t\t\t\t\traise RuntimeError,\n\t\t\t\t\t\t\t\"Unknown target expansion option: #{li[0]}\"\n\t\t\t\tend\n\t\t\tend.flatten\n\t\tend\n\tend", "def list_all_users\n\n end", "def list_targets\n # Date is the current date per RFC 2616, section 3.3.1,\n # rfc1123-date format, e.g.: Sun, 22 Apr #2012 08:49:37 GMT.\n date_timestamp = Time.now.httpdate # ruby provides this date format with httpdate method\n signature = build_signature(\"/targets\", nil, \"GET\", date_timestamp)\n raise ArgumentError.new(\"Signature returned nil. Aborting...\") if signature.nil?\n\n authorization_header = \"VWS \" + @accesskey + \":\" + signature\n begin\n RestClient.get(TARGETS_URL, Date: date_timestamp, Authorization: authorization_header)\n rescue => e\n e.response\n end\n end", "def list\n @all_users = User.find(:all)\n end", "def users\n @users\n end", "def targets\r\n @dispatch_targets\r\n end", "def index\n @targets = Target.all.page(params[:page])\n end", "def targets=(value)\n @targets = value\n end", "def targets=(value)\n @targets = value\n end", "def list_users\n tp @users, :real_name, :slack_id, :user_name => {:display_method => :name}\n end", "def list_users\n @users = User.find(:all)\n end", "def targets\n @targets = Array(@attrs[:targets]).map do |status|\n Twitter::Status.fetch_or_new(status)\n end\n end", "def users\n set_attributes_for(User)\n User.find(:all)\n end", "def include_targets=(value)\n @include_targets = value\n end", "def users\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::User)\n end", "def targets(options = {})\n run_command('targets', options)\n end", "def index\n @users = User.all\n end", "def index\n @users = current_user.users\n end", "def all_targets\n targets = []\n find('').sort.each do |file|\n targets << File.basename(file)\n end\n targets # return\n end", "def get_target_users\n\n users = []\n\n self.get_orders.each do |user_hash|\n\n user_ids = user_hash.keys\n\n users = users + user_ids unless user_ids.nil?\n end\n\n users.compact!\n\n return users\n end", "def target_list(_, site: nil)\n site ||= @site\n return unless Inspector.site_selected?(site, @console)\n site.reload\n @console.info self, TerminalSupport.table(site.hosts, :ip)\n end", "def users\n User.where(network_id: context[:current_network]&.id)\n end", "def targets\n\t\tWmapTarget.find(:all)\n\tend", "def list\n # ask the user_repository for a list of all the users\n users = @user_repository.all\n # pass that list to the view to display\n @view.list_users(users)\n end", "def include_targets\n return @include_targets\n end", "def list_users(workspace)\n puts \"\\nUser List\\n\\n\"\n tp workspace.users, \"id\", \"name\", \"real_name\", \"status_text\", \"status_emoji\"\nend", "def users\n @users_by_href.values\n end", "def index\n @join_user_to_assistants = JoinUserToAssistant.all\n end", "def index\n @urls = current_user.urls\n end", "def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end", "def users\n gateway_check\n unavailable_servers_check\n @users\n end", "def all\n @users = User.all\n end", "def list\n get('users')['users']\n end", "def list\n # ask the repo for a list of all the users\n users = @repo.all\n # pass that list to the view to display\n @view.list_users(users)\n end", "def index\n # specific_assigned_version_process(__callee__, params)\n @twitter_users = current_user.twitter_users.all\n end", "def getAllUsers()\n puts \"\\nUSERS:\"\n puts \"-------------------------------------------------\"\n @users.each {|user| puts \"ID: \" + user.id.to_s + \" Name: \" + user.name}\n puts \"-------------------------------------------------\"\n end", "def all_users()\n User.all\n end", "def users\n # TODO use SQL\n results = self.approvers + self.observers + [self.requester]\n results.compact\n end", "def discoverUsers \n\t\tUser.index\n\t\t# @users = User.all\n\tend", "def users\n return @users\n end", "def users\n watches_unique_by_user.map(&:user)\n end", "def get_targets\n targets = @active_battler.get_targets\n @cursor.set_targets(targets)\n return targets\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def users\n users = []\n if current_user.lead?\n users = object.users.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n elsif current_user.dev?\n vms_v = object.vms.select { |vm| vm.is_jenkins }\n users = vms_v.flat_map(&:user).uniq.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n else\n users <<= current_user\n end\n users.map { |u| u.id }\n end", "def index\n @trail_users = TrailUser.all\n end", "def index\n @t_users = TUser.all\n end", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n index! {\n @users = current_company.users\n }\n end", "def index\n @users = User.find_all_with_authorization(current_user)\n end", "def users\n get('get_users')\n end", "def index\n @target = Target.new\n @targets = action_state.targets\n end", "def index\n @project = Project.find(params[:project_id])\n @integrants = User.all\n end", "def index\n \t@all_users = User.all\n end", "def users\n @users = User.find(:all)\n end", "def index\n @user_users = User::User.all\n end", "def index\n @manage_users = Manage::User.all\n end", "def list_user_tasks\n\t\t@tasks = current_user.get_developer_tasks\n\tend", "def targets\n target.split(NAMESPACE_PATTERN)\n end", "def targets\n target.split(NAMESPACE_PATTERN)\n end", "def list_current_users *args\r\n puts \"not implemented yet\"\r\n end", "def targets\n\t\tKassociation.where( :target_id => self.id )\n\tend", "def index\n @user_workspaces = UserWorkspace.owned_by(current_user)\n end", "def view_all_users\n # !! get all user so can interact after viewing them? all_users\n # User.select(:username).each_with_index {|user, index| puts \"#{index+1}. #{user.username}\"}\n #??????\n User.select(:username).each {|user| puts user.username}\n end", "def users\n User.in(id: user_promotions.pluck(:user_id))\n end", "def target_objects\n return @target_objects\n end", "def target_objects\n return @target_objects\n end", "def project_users\n request :user\n end", "def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService.getUserList().sort_by { |user| #sort users by name\n (user.name && !user.name.empty?) ? user.name.downcase.split.values_at(-1, 0) : [''] \n }\n end\n @users\n end", "def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService.getUserList().sort_by { |user| #sort users by name\n (user.name && !user.name.empty?) ? user.name.downcase.split.values_at(-1, 0) : [''] \n }\n end\n @users\n end", "def index\n\t\t@users = AdminUser.sorted\n\tend", "def index\n # Replace TaskAdmin with User if we want SuperAdmin to manage all users\n @users = TaskAdmin.all\n end", "def index\n @devices = current_user.devices\n end", "def all\n response = conn.get do |request|\n request.url \"/v1/admin/users.json\"\n end\n\n response.body[\"users\"].map {|attributes| Nuwe::User.new(attributes)}\n end", "def get_targets(name=:target)\n ActivityTarget.where(:name => name, :activity_id => id).map{ |at| at.target }\n end", "def targets\n @targets ||= (data['targets'] || {})\n end", "def index\n @integrations = current_user.integrations\n @events = Event.by_user_limit current_user\n end", "def index\n @users = GuestUsers::User.where(host: current_user) || []\n end", "def index\n @users = User.all\n end" ]
[ "0.7615049", "0.7416185", "0.6919222", "0.6696222", "0.6306515", "0.6306515", "0.6306515", "0.63005334", "0.621244", "0.61536354", "0.61269253", "0.61269253", "0.60750526", "0.598214", "0.5953391", "0.5932337", "0.5873388", "0.58462155", "0.58194304", "0.58006716", "0.5792154", "0.57899094", "0.5777517", "0.5777517", "0.57736427", "0.57408524", "0.57365847", "0.57357055", "0.57127", "0.5712293", "0.57121474", "0.57000965", "0.5688588", "0.5687605", "0.5660318", "0.56500334", "0.56481385", "0.56460387", "0.5638943", "0.56310594", "0.56298935", "0.5622917", "0.55965835", "0.5594573", "0.55847234", "0.55558354", "0.5551824", "0.555094", "0.55499256", "0.5542985", "0.5535802", "0.55341977", "0.5529894", "0.5521873", "0.55192035", "0.55153483", "0.5514069", "0.5509196", "0.5509196", "0.5509196", "0.5497501", "0.5493374", "0.54782224", "0.5471775", "0.5471775", "0.5471775", "0.5471775", "0.5471775", "0.5471775", "0.5471246", "0.54661155", "0.544811", "0.5445013", "0.5442727", "0.5438546", "0.54310936", "0.5426742", "0.5425318", "0.5424477", "0.54126245", "0.54126245", "0.54014075", "0.5401139", "0.53987896", "0.53985214", "0.5398085", "0.5392387", "0.5392387", "0.5376233", "0.5361535", "0.5361535", "0.5347723", "0.53351545", "0.5334408", "0.5331075", "0.5325512", "0.53244984", "0.53228086", "0.5322678", "0.53222895" ]
0.7030201
2
PATCH/PUT /inspirations/1 def update
def destroy @inspiration.destroy render json: @inspiration end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @inspiration = current_user.inspirations.find(params[:id])\n\n respond_to do |format|\n if @inspiration.update_attributes(params[:inspiration])\n format.html { redirect_to @inspiration.discussion, notice: 'Inspiration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inspiration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @inspiration = Inspiration.find(params[:id])\n \n respond_to do |format|\n if @inspiration.update_attributes(params[:inspiration])\n format.html { redirect_to @inspiration, notice: 'Inspiration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inspiration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inspiration.update(inspiration_params)\n format.html { redirect_to @book, notice: 'Inspiration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inspiration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n standard_update(Interest, params[:id], interest_params)\n end", "def update\n @inspiration = Inspiration.find(params[:id])\n @project = Project.find(@inspiration.project_id)\n respond_to do |format|\n if @inspiration.update_attributes(params[:inspiration])\n format.html { redirect_to @project, notice: 'Inspiration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inspiration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, :notice => 'Interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, notice: 'Interest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @impuesto = Impuesto.find(params[:id])\n\n respond_to do |format|\n if @impuesto.update_attributes(params[:impuesto])\n format.html { redirect_to @impuesto, :notice => 'Impuesto was successfully updated.' }\n format.json { render json: @impuesto }\n else\n format.html { render :action => \"edit\" }\n format.json { render json: @impuesto.errors }\n end\n end\n end", "def update\n @event_interest = EventInterest.find(params[:id])\n\n respond_to do |format|\n if @event_interest.update_attributes(params[:event_interest])\n format.html { redirect_to @event_interest, notice: 'Event interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interview = Interview.find_by_slug(params[:id])\n\n respond_to do |format|\n if @interview.update_attributes(params[:interview])\n format.html { redirect_to admin_interviews_path, notice: 'Interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n @informe = Informe.find(params[:id])\n\n respond_to do |format|\n if @informe.update_attributes(params[:informe])\n format.html { redirect_to @informe, notice: 'Informe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @informe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident_proof.update(incident_proof_params)\n format.html { redirect_to @incident_proof, notice: 'Incident proof was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident_proof }\n else\n format.html { render :edit }\n format.json { render json: @incident_proof.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params.permit!\n @interviews_it = Interviews::It.find(params[:id])\n\n respond_to do |format|\n if @interviews_it.update_attributes(params[:interviews_it])\n format.html { redirect_to(@interviews_it, :notice => 'It was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interviews_it.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @explaination = Explaination.find(params[:id])\n\n respond_to do |format|\n if @explaination.update_attributes(params[:explaination])\n format.html { redirect_to @explaination, notice: 'Explaination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @explaination.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @indicativo = Indicativo.find(params[:id])\n\n respond_to do |format|\n if @indicativo.update_attributes(params[:indicativo])\n format.html { redirect_to @indicativo, notice: 'Indicativo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @indicativo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invent.update(invent_params)\n format.html { redirect_to @invent, notice: 'Invent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @impgen = Impgen.find(params[:id])\n\n respond_to do |format|\n if @impgen.update_attributes(params[:impgen])\n format.html { redirect_to @impgen, notice: 'Impgen was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @impgen.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @entrada_inventario = EntradaInventario.find(params[:id])\n\n respond_to do |format|\n if @entrada_inventario.update_attributes(params[:entrada_inventario])\n format.html { redirect_to @entrada_inventario, notice: 'Entrada inventario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entrada_inventario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n flash[:notice] = 'Interest was successfully updated.'\n format.html { redirect_to(@interest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @innovation.update(innovation_params)\n format.html { redirect_to @innovation, notice: 'Innovation was successfully updated.' }\n format.json { render :show, status: :ok, location: @innovation }\n else\n format.html { render :edit }\n format.json { render json: @innovation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incarnation.update(incarnation_params)\n format.html { redirect_to @incarnation, notice: 'Incarnation was successfully updated.' }\n format.json { render :show, status: :ok, location: @incarnation }\n else\n format.html { render :edit }\n format.json { render json: @incarnation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, :notice => 'Интересот е успешно ажуриран.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @intention = Intention.find(params[:id])\n\n respond_to do |format|\n if @intention.update_attributes(params[:intention])\n format.html { redirect_to @intention, notice: 'Intention was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @intention.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @impressum = Impressum.find(params[:id])\n\n respond_to do |format|\n if @impressum.update_attributes(params[:impressum])\n format.html { redirect_to impressums_url, notice: 'Impressum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @impressum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @institucional = Institucional.find(params[:id])\n\n respond_to do |format|\n if @institucional.update_attributes(params[:institucional])\n format.html { redirect_to @institucional, notice: 'Institucional was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @institucional.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @interview.update(interview_params)\n format.html { redirect_to interviews_url, notice: 'Interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n if @ingredient.update_attributes(params[:ingredient])\n format.html { redirect_to @ingredient, notice: 'Ingredient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incentive = Incentive.find(params[:id])\n\n respond_to do |format|\n if @incentive.update_attributes(params[:incentive])\n format.html { redirect_to(@incentive, :notice => 'Incentive was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incentive.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\n respond_to do |format|\n if @indivisual.update(indivisual_params)\n format.html { redirect_to @indivisual, notice: 'Indivisual was successfully updated.' }\n format.json { render :show, status: :ok, location: @indivisual }\n else\n format.html { render :edit }\n format.json { render json: @indivisual.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interview = Interview.find(params[:id])\n\n respond_to do |format|\n if @interview.update_attributes(params[:interview])\n @interview.activify\n format.html { redirect_to '/teacher_applications', notice: 'Interview details have been updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @opinion = Opinion.find(params[:id])\n\n respond_to do |format|\n if @opinion.update_attributes(params[:opinion])\n format.html { redirect_to @opinion, notice: 'Opinion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exprience = Exprience.find(params[:id])\n\n respond_to do |format|\n if @exprience.update_attributes(params[:exprience])\n format.html { redirect_to @exprience, notice: 'Exprience was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exprience.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inquiry.update(inquiry_params)\n format.html { redirect_to @inquiry, notice: 'Inquiry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @interest.update(interest_params)\n format.html { redirect_to @interest, notice: 'Interest was successfully updated.' }\n format.json { render :show, status: :ok, location: @interest }\n else\n format.html { render :edit }\n format.json { render json: @interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interviewing = Interviewing.find(params[:id])\n\n respond_to do |format|\n if @interviewing.update_attributes(params[:interviewing])\n flash[:notice] = 'Interviewing was successfully updated.'\n format.html { redirect_to hiring_interview_url(@interviewing.interview) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interviewing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opinion.update(opinion_params)\n format.html { redirect_to @opinion, notice: 'Opinion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_interview = Interview.find(params[:id])\n\n respond_to do |format|\n if @admin_interview.update_attributes(params[:interview])\n format.html { redirect_to [:admin, @admin_interview], notice: 'Entrevista atualizada com sucesso' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: [:admin, @admin_interview.erros], status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @icebreaker_answer.update(icebreaker_answer_params)\n format.html { redirect_to @icebreaker_answer, notice: 'Icebreaker answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @icebreaker_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n if @interested.update_attributes(params[:interested])\n format.html { redirect_to @interested, notice: 'Interested was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interested.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @breadcrumb = 'update'\n @insurance = Insurance.find(params[:id])\n @insurance.updated_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @insurance.update_attributes(params[:insurance])\n format.html { redirect_to @insurance,\n notice: (crud_notice('updated', @insurance) + \"#{undo_link(@insurance)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @insurance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exhibition = Exhibition.find(params[:id])\n\n respond_to do |format|\n if @exhibition.update_attributes(params[:exhibition])\n format.html { redirect_to @exhibition, notice: 'Exhibition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exhibition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @income = Income.find(params[:id])\n\n respond_to do |format|\n if @income.update_attributes(income_params)\n format.html { redirect_to @income, notice: 'Income was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n if @person_interest.update_attributes(params[:person_interest])\n format.html { redirect_to @person_interest, notice: 'Person interest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @life_insurance.update(life_insurance_params)\n format.html { redirect_to @life_insurance, notice: 'Life insurance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @life_insurance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @income_entry = IncomeEntry.find(params[:id])\n\n respond_to do |format|\n if @income_entry.update_attributes(params[:income_entry])\n format.html { redirect_to @income_entry, notice: 'Income entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @income_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expenditure = Expenditure.find(params[:id])\n\n respond_to do |format|\n if @expenditure.update_attributes(params[:expenditure])\n format.html { redirect_to @expenditure, notice: 'Expenditure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expenditure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @id_proof = IdProof.find(params[:id])\n\n respond_to do |format|\n if @id_proof.update_attributes(params[:id_proof])\n format.html { redirect_to @id_proof, notice: 'Id proof was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @id_proof.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @student_improveship = StudentImproveship.find(params[:id])\n\n respond_to do |format|\n if @student_improveship.update_attributes(params[:student_improveship])\n format.html { redirect_to(@student_improveship, :notice => 'Student improveship was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_improveship.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inproceedings.update(inproceedings_params)\n format.html { redirect_to @inproceedings, notice: 'Inproceedings was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inproceedings.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @idiom = Idiom.find(params[:id])\n\n respond_to do |format|\n if @idiom.update_attributes(params[:idiom])\n format.html { redirect_to @idiom, notice: 'Idiom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @idiom.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interview = Interview.find(params[:id])\n @interview.user_id = current_user.id\n respond_to do |format|\n if @interview.update_attributes(params[:interview])\n format.html { redirect_to(@interview, :notice => 'Interview was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interview.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @infection.update(infection_params)\n format.html { redirect_to @infection, notice: 'Infection was successfully updated.' }\n format.json { render :show, status: :ok, location: @infection }\n else\n format.html { render :edit }\n format.json { render json: @infection.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @inhabitant = Inhabitant.find_by_id(params[:id])\n\n respond_to do |format|\n if @inhabitant.update_attributes(params[:inhabitant])\n format.html { redirect_to inhabitants_url, notice: 'Inhabitant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inhabitant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @life_insurance.update_attributes(params[:life_insurance])\n format.html { redirect_to @life_insurance, notice: 'Life insurance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @life_insurance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @addimition = Addimition.find(params[:id])\n\n respond_to do |format|\n if @addimition.update_attributes(params[:addimition])\n format.html { redirect_to @addimition, notice: 'Addimition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @addimition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @interessado.update(interessado_params)\n \n\n format.html { redirect_to @interessado, notice: 'Interessado was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @interessado.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pedagogy_innovation.update(pedagogy_innovation_params)\n format.html { redirect_to @pedagogy_innovation, notice: 'Pedagogy innovation was successfully updated.' }\n format.json { render :show, status: :ok, location: @pedagogy_innovation }\n else\n format.html { render :edit }\n format.json { render json: @pedagogy_innovation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interests = Interests.for_person(@person)[0]\n\n respond_to do |format|\n if @interests.update_attributes(params[:interests])\n flash[:notice] = 'Interests updated.'\n format.html { redirect_to(person_path(:id => @person)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interests.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @indication_for_meal.update(indication_for_meal_params)\n format.html { redirect_to @indication_for_meal, notice: 'Indication for meal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @indication_for_meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @involvement = Involvement.find(params[:id])\n\n respond_to do |format|\n if @involvement.update_attributes(params[:involvement])\n flash[:notice] = 'Involvement was successfully updated.'\n format.html { redirect_to(@involvement) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @involvement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n \t\t@interested = Interested.find(params[:id])\n\n \t\trespond_to do |format|\n \t\t\tif @interested.update_attributes(params[:interested])\n \t\t\tformat.html { redirect_to @interested, notice: 'Interested was sucessfully updated.' }\n \t\t\tformat.json {head :no_content }\n \t\t\telse\n \t\t\t\tformat.html { render action: \"edit\" }\n \t\t\t\tformat.json { render json: @interested.error, status: :unprocessable_entity }\n \t\t\tend\n \t\tend\n \tend", "def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @irisplant.update(irisplant_params)\n format.html { redirect_to @irisplant, notice: 'Irisplant was successfully updated.' }\n format.json { render :show, status: :ok, location: @irisplant }\n else\n format.html { render :edit }\n format.json { render json: @irisplant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @inquiry\n\n if @inquiry.update(inquiry_params)\n head :no_content\n else\n render json: {errors:@inquiry.errors.messages}, status: :unprocessable_entity\n end\n\n end", "def update\n respond_to do |format|\n if @intervention.update(intervention_params)\n format.html { redirect_to @intervention, notice: 'Intervention was successfully updated.' }\n format.json { render :show, status: :ok, location: @intervention }\n else\n format.html { render :edit }\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @interest\n respond_to do |format|\n if @interest.update(interest_params)\n format.html { redirect_to @interest, notice: t('flash.notice.updated.') }\n format.json { render :show, status: :ok, location: @interest }\n else\n format.html { render :edit }\n format.json { render json: @interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n if @ingredient.update_attributes(params[:ingredient])\n format.html { redirect_to(@ingredient, :notice => 'Ingredient was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ingredient.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @itin = Itinerary.find_by_id(params[:id])\n\n @itin.update_attributes(itin_params) if @itin\n\n opts = {}\n opts[:include] = [:address]\n render success_response(@itin, opts)\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @unemployment_insurance.update(unemployment_insurance_params)\n format.html { redirect_to @unemployment_insurance, notice: 'Unemployment insurance was successfully updated.' }\n format.json { render :show, status: :ok, location: @unemployment_insurance }\n else\n format.html { render :edit }\n format.json { render json: @unemployment_insurance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.find(params[:event_id])\n @point_of_interest = PointOfInterest.find(params[:id])\n\n respond_to do |format|\n if @point_of_interest.update_attributes(params[:point_of_interest])\n format.html { redirect_to(event_point_of_interest_path, :notice => 'Point of interest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @point_of_interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @interest_area = InterestArea.find(params[:id])\n\n respond_to do |format|\n if @interest_area.update_attributes(params[:interest_area])\n format.html { redirect_to @interest_area, notice: 'Interest area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interest_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @apprentice = Apprentice.find(params[:id])\n\n respond_to do |format|\n if @apprentice.update_attributes(params[:apprentice])\n format.html { redirect_to @apprentice, notice: 'Apprentice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apprentice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interes = Interes.find(params[:id])\n\n respond_to do |format|\n if @interes.update_attributes(params[:interes])\n format.html { redirect_to(@interes, :notice => 'Interes was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interes.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @interview.update(interview_params)\n format.html { redirect_to interviews_path, notice: 'Interview was successfully updated.' }\n format.json { render :show, status: :ok, location: @interview }\n else\n format.html { render :edit }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @enhancement = Enhancement.find(params[:id])\n\n respond_to do |format|\n if @enhancement.update_attributes(params[:enhancement])\n format.html { redirect_to @enhancement, notice: 'Enhancement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enhancement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inchef_recommendation.update(inchef_recommendation_params)\n format.html { redirect_to @inchef_recommendation, notice: 'Inchef recommendation was successfully updated.' }\n format.json { render :show, status: :ok, location: @inchef_recommendation }\n else\n format.html { render :edit }\n format.json { render json: @inchef_recommendation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @intervention.update(intervention_params)\n format.html { redirect_to @intervention, notice: 'Intervention was successfully updated.' }\n format.json { render :show, status: :ok, location: @intervention }\n else\n format.html { render :edit }\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @intervention.update(intervention_params)\n format.html { redirect_to @intervention, notice: 'Intervention was successfully updated.' }\n format.json { render :show, status: :ok, location: @intervention }\n else\n format.html { render :edit }\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @intervention.update(intervention_params)\n format.html { redirect_to @intervention, notice: 'Intervention was successfully updated.' }\n format.json { render :show, status: :ok, location: @intervention }\n else\n format.html { render :edit }\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @proj_insp.update(proj_insp_params)\n format.html { redirect_to @proj_insp, notice: 'Project inspection was successfully updated.' }\n format.json { render :show, status: :ok, location: @proj_insp }\n else\n format.html { render :edit }\n format.json { render json: @proj_insp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @opinion = Opinion.find(params[:id])\n\n respond_to do |format|\n if @opinion.update_attributes(params[:opinion])\n format.html { redirect_to(@opinion, :notice => 'Opinion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @opinion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @inquiry = Inquiry.find(params[:id])\n\n respond_to do |format|\n if @inquiry.update_attributes(params[:inquiry])\n format.html { redirect_to(@inquiry, :notice => 'Inquiry was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inquiry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @income = current_company.incomes.find(params[:id])\n\n respond_to do |format|\n if @income.update_attributes(params[:income])\n format.html { redirect_to incomes_path, notice: 'Income was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n return if auth(\"website_administrator\")\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to @incident, :notice => 'Incident was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @iine.update(iine_params)\n format.html { redirect_to @iine, notice: 'Iine was successfully updated.' }\n format.json { render :show, status: :ok, location: @iine }\n else\n format.html { render :edit }\n format.json { render json: @iine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @repuestum = Repuestum.find(params[:id])\n\n respond_to do |format|\n if @repuestum.update_attributes(params[:repuestum])\n format.html { redirect_to @repuestum, notice: 'Repuestum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @repuestum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @insurance = @case.insurance\n\n respond_to do |format|\n if @insurance.update(insurance_params)\n format.html { redirect_to case_insurances_path(@case), notice: 'insurance was successfully updated.' }\n format.json { render :show, status: :ok, location: @insurance }\n else\n format.html { render :edit }\n format.json { render json: @insurance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @intervention.update(intervention_params)\r\n format.html { redirect_to @intervention, notice: 'Intervention was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @intervention }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @intervenant.update(intervenant_params)\n format.html { redirect_to @intervenant, notice: 'Intervenant was successfully updated.' }\n format.json { render :show, status: :ok, location: @intervenant }\n else\n format.html { render :edit }\n format.json { render json: @intervenant.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.79453176", "0.7823965", "0.76066864", "0.7356654", "0.73026735", "0.7299989", "0.72535944", "0.72444135", "0.71837467", "0.7160196", "0.7158514", "0.7155997", "0.7074445", "0.70742553", "0.70698965", "0.70228326", "0.70124054", "0.7006653", "0.69982404", "0.69954044", "0.6993542", "0.69791037", "0.6953065", "0.69530064", "0.6950843", "0.6949339", "0.69468784", "0.69455814", "0.69445777", "0.69427496", "0.6941747", "0.6938886", "0.6931604", "0.6926347", "0.6913176", "0.6912831", "0.69081724", "0.6905182", "0.6900971", "0.68890023", "0.68880606", "0.68870205", "0.6884433", "0.68806845", "0.68789816", "0.68762296", "0.6873416", "0.68707746", "0.68620294", "0.6851745", "0.6851745", "0.6842938", "0.68421197", "0.68337435", "0.6833656", "0.6832977", "0.6832806", "0.683074", "0.68301183", "0.6828529", "0.68172735", "0.6815637", "0.68130505", "0.6812969", "0.6810561", "0.68103737", "0.6809654", "0.68083405", "0.6806605", "0.6800285", "0.6794279", "0.67898345", "0.6788773", "0.6783834", "0.6782979", "0.67766345", "0.6776599", "0.67743134", "0.67678964", "0.6766941", "0.6766227", "0.6764814", "0.67646974", "0.67631495", "0.6759796", "0.67590296", "0.675898", "0.675898", "0.675898", "0.6758346", "0.67567396", "0.67551005", "0.6754549", "0.67542285", "0.67540026", "0.67514074", "0.6751045", "0.6750766", "0.67481935", "0.67461383", "0.67448103" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_inspiration @inspiration = Inspiration.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a list of trusted parameters through.
def inspiration_params params.require(:inspiration).permit(:name, :image, :bio) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def allow_params_authentication!; end", "def whitelisted_args\n args.select &:allowed\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def filtered_parameters; end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def expected_permitted_parameter_names; end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def param_whitelist\n [:rating, :review]\n end", "def check_params; true; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def allowed?(*_)\n true\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def valid_params?; end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def url_allowlist=(_arg0); end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def list_params\n params.permit(:list_name)\n end", "def valid_params_request?; end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "def safelists; end", "def authorize_own_lists\n authorize_lists current_user.lists\n end", "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "def check_params\n true\n end", "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def filter_parameters; end", "def filter_parameters; end", "def whitelist; end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.permit(:name)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def permitted_params\n []\n end", "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "def params(list)\n @declared_params = list\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "def allow(ids); end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def valid_for_params_auth?; end", "def default_param_whitelist\n [\"mode\"]\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def shopping_list_params\n params.require(:shopping_list).permit!\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "def url_allowlist; end", "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "def quote_params\n params.permit!\n end" ]
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.6326454", "0.63140553", "0.6299814", "0.62642586", "0.626006", "0.62578833", "0.6236823", "0.6227561", "0.6221758", "0.62200165", "0.620879", "0.61983657", "0.6195055", "0.6172993", "0.6156856", "0.61558664", "0.61521494", "0.6135789", "0.6121145", "0.61118174", "0.60736513", "0.6071645", "0.60632104", "0.60549796", "0.6043906", "0.6034662", "0.60207325", "0.6018568", "0.6016575", "0.60103434", "0.60084206", "0.600763", "0.6007443", "0.6003619", "0.6003619", "0.5995791", "0.5993301", "0.5993231", "0.5984926", "0.597122", "0.5968121", "0.5965808", "0.59640145", "0.59632224", "0.59602356", "0.59332967", "0.5927556", "0.5922805", "0.5909745", "0.5905083", "0.5904304", "0.5893434", "0.58888215", "0.58823985", "0.58823985", "0.58823985", "0.5873434", "0.58619875", "0.58533794", "0.5845531", "0.58426666", "0.58360124", "0.583218", "0.5828041", "0.5827927", "0.5816121", "0.5814705", "0.5812719", "0.581121", "0.5803423", "0.5803423", "0.57995003", "0.5794207", "0.5784923", "0.5781365", "0.5776385", "0.5774859", "0.57671493", "0.5766998", "0.57618684", "0.5758038" ]
0.0
-1
GET /types/1 GET /types/1.json
def show @amenity = Amenity.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @amenity } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end", "def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end", "def index\n render json: usage(params[:type])\n end", "def show\n @type = Type.find(params[:id])\n @things = @type.things\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type }\n end\n end", "def type\n @json['type']\n end", "def show\n @type = Type.find(params[:id])\n end", "def type\n @activities = Activity.tagged_with_on(:types,params[:type_name]).page params[:page]\n respond_with @activities\n end", "def show\n @api_v1_user_types = Api::V1::UserType.all\n end", "def index\n @types = Type.all\n end", "def type\n response[\"type\"]\n end", "def type\n response[\"type\"]\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end", "def find(id)\n response = RestClient.get(\"#{@type.Resource}/#{id}\")\n @type.from_json response['data']\n end", "def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end", "def show\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_type }\n end\n end", "def getPageInfoByIDType(id, type)\n request('getPageInfoByIDType', {'id' => id, 'type' => type})\nend", "def show\n @realty_type = RealtyType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @realty_type }\n end\n end", "def index\n @api_v1_user_types = Api::V1::UserType.all\n end", "def show\n @types_of_apprenticeship = TypesOfApprenticeship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @types_of_apprenticeship }\n end\n end", "def index\n @sample_types = SampleType.all.sort_by(&:name)\n @first = if @sample_types.any?\n @sample_types[0].name\n else\n 'no sample types'\n end\n\n respond_to do |format|\n format.html { render layout: 'aq2' }\n format.json do\n render json: @sample_types\n .sort { |a, b| a.name <=> b.name }\n .to_json(methods: :field_types)\n end\n end\n end", "def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end", "def show\n @type_person = TypePerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_person }\n end\n end", "def type\n @json_body['type']\n end", "def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end", "def show\n @page_type = PageType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_type }\n end\n end", "def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end", "def index\n @act_types = ActType.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @act_types }\n end\n end", "def getUser #GET\n if params[:type].present?\n if params[:type]==\"getUser\"\n @user = User.all\n render :json => @user\n else\n print \"Wrong Type\"\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Wrong Type\"}\n end\n else\n print \"Missing Attribute\"\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Missing Attribute\"}\n end\n end", "def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end", "def types\n @client.make_request :get, reports_path\n end", "def show\n @itype = Itype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itype }\n end\n end", "def show\n @entry_type = EntryType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry_type }\n end\n end", "def show\n render json: @specification_type, serializer: Web::V1::SpecificationTypeSerializer\n end", "def listing(type, **params)\n params[:t] = params.delete(:time) if params.key?(:time)\n @client.model(:get, \"/user/#{get_attribute(:name)}/#{type}.json\", params)\n end", "def listing(type, **params)\n params[:t] = params.delete(:time) if params.key?(:time)\n @client.model(:get, \"/user/#{get_attribute(:name)}/#{type}.json\", params)\n end", "def show\n @ctype = Ctype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ctype }\n end\n end", "def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types\n end", "def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end", "def index\n @types = ItemType.all\n end", "def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end", "def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end", "def index\n @resources = Resource.eager_load(:resource_type).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end", "def show\n @info_type = InfoType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @info_type }\n end\n end", "def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end", "def index\n @sample_types = SampleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sample_types }\n end\n end", "def show\n @crate_type = CrateType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate_type }\n end\n end", "def index\n @timerecord_types = TimerecordType.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timerecord_types }\n end\n end", "def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end", "def show\n @instance_type = InstanceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instance_type }\n end\n end", "def index\n @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end", "def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end", "def get_resource(id, type)\n\t\t@client.method(type).call.get(id)\n\tend", "def show\n @service_type = ServiceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_type }\n end\n end", "def show\n @question_type = QuestionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_type }\n end\n end", "def show\n @structure_type = StructureType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @structure_type }\n end\n end", "def get_lesson_types\n get \"lessonTypes.json\"\n end", "def show\n @act_type = ActType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @act_type }\n end\n end", "def show\n @category_type = CategoryType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_type }\n end\n end", "def show\n @reform_type = ReformType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reform_type }\n end\n end", "def show\n @producttype = Producttype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @producttype }\n end\n end", "def show\n @product_type = ProductType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_type }\n end\n end", "def show\n @event_type = EventType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_type }\n end\n end", "def get(type, id)\n info = json_get(@target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\",\n @key_style, headers)\n\n fake_client_id(info) if type == :client # hide client reply, not quite scim\n info\n end", "def show\n @sample_type = SampleType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_type }\n end\n end", "def get_type_with_http_info(uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.get_type ...\"\n end\n # verify the required parameter 'uuid' is set\n fail ArgumentError, \"Missing the required parameter 'uuid' when calling DefaultApi.get_type\" if uuid.nil?\n # resource path\n local_var_path = \"/{uuid}/type\".sub('{format}','json').sub('{' + 'uuid' + '}', uuid.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#get_type\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end", "def show\n @incident_type = IncidentType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident_type }\n end\n end", "def show\n @mtype = Mtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mtype }\n end\n end", "def request_type(*args)\n type\n end", "def type\r\n\t\t\t`#{BITS::BITSADMIN} /gettype {#{@id}}`\r\n\t\tend", "def show\n @ProfileType = ProfileType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @ProfileType }\n end\n end", "def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end", "def show\n @gl_type = GlType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gl_type }\n end\n end", "def index\n @food_type_id = @foodTypes.first\n\n if params['type']\n @foods = Food.includes(:type).includes(:nutritional_information).where( type_id: params['type']['type_id']).paginate(page: params[:page])\n else\n @foods = Food.includes(:type).includes(:nutritional_information).where( type_id: @food_type_id).paginate(page: params[:page])\n end\n\n respond_with @foods\n end", "def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end", "def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end", "def index\n @leavetypes = Leavetype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leavetypes }\n end\n end", "def show\n @tasktype = Tasktype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tasktype }\n end\n end", "def show\n @person = people_type.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def index\n @ftypes = Ftype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ftypes }\n end\n end", "def index\n @talk_types = TalkType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_types }\n end\n end", "def cmd_types argv\n setup argv\n response = @api.types\n msg response\n return response\n end", "def show\n @document_type = DocumentType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document_type }\n end\n end", "def index\n @typings = Typing.all\n end", "def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end", "def index\n @ctypes = Ctype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ctypes }\n end\n end", "def show\n @value_type = ValueType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @value_type }\n end\n end", "def show\n @site_type = SiteType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_type }\n end\n end", "def show\n @event_types = EventType.find(params[:id])\n respond_with @event_type\n end", "def types\n @types ||= Types.new(@client)\n end", "def show\n @fieldtype = Fieldtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fieldtype }\n end\n end", "def show\n @observation_type = ObservationType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observation_type }\n end\n end", "def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end", "def get_by_type(type, cookie_or_cookies = nil)\n add_cookie_to_http_header(cookie_or_cookies)\n return @client.get(\"#{@resource_uri}/type/#{type}\")\n end", "def show\n @girltype = Girltype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @girltype }\n end\n end", "def index\n @run_types = RunType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @run_types }\n end\n end", "def index\n @realty_types = RealtyType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @realty_types }\n end\n end", "def index\n @taxonomies = Taxonomy.find_all_by_taxonomy_type(params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomies }\n end\n end", "def index\n @identifier_types = IdentifierType.order(:position).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @identifier_types }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: @typegroup }\n end\n end", "def show\n @collection_type = CollectionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collection_type }\n end\n end" ]
[ "0.72724575", "0.7179091", "0.70928717", "0.70529896", "0.6886975", "0.6706508", "0.67046696", "0.66510755", "0.66487914", "0.6635179", "0.6635179", "0.66211784", "0.65380293", "0.6525202", "0.6501756", "0.6492074", "0.64882994", "0.6473578", "0.6469021", "0.6463662", "0.6447296", "0.64450395", "0.6436954", "0.6398023", "0.63880455", "0.63868093", "0.6374249", "0.6372945", "0.6356932", "0.63539326", "0.633625", "0.6332576", "0.63253814", "0.632328", "0.632328", "0.63170433", "0.63048106", "0.6287872", "0.6285663", "0.62730783", "0.62727535", "0.62508094", "0.62274843", "0.6226552", "0.6222754", "0.62172997", "0.62131745", "0.6209779", "0.6204856", "0.6190357", "0.6187425", "0.6181068", "0.6179677", "0.61781716", "0.6177996", "0.61773247", "0.61754227", "0.6172562", "0.61654216", "0.61592394", "0.6158653", "0.61561996", "0.6154243", "0.6150496", "0.61495113", "0.6147164", "0.6147005", "0.61417884", "0.6137346", "0.6135897", "0.6134513", "0.61328983", "0.6131169", "0.6129004", "0.61282974", "0.6126146", "0.6126146", "0.61190635", "0.61169577", "0.6116638", "0.6114766", "0.61128277", "0.61114496", "0.6111358", "0.6110418", "0.61094487", "0.61084014", "0.61075294", "0.6105192", "0.6102392", "0.610193", "0.61001015", "0.60946995", "0.6093073", "0.60926926", "0.6088912", "0.608884", "0.608823", "0.60876703", "0.60868746", "0.6084283" ]
0.0
-1
GET /types/new GET /types/new.json
def new @amenity = Amenity.new respond_to do |format| format.html # new.html.erb format.json { render json: @amenity } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end", "def new\n @resource_type = ResourceType.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_type }\n end\n end", "def new\n @ctype = Ctype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ctype }\n end\n end", "def new\n @type_person = TypePerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type_person }\n end\n end", "def new\n @mtype = Mtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mtype }\n end\n end", "def new\n @act_type = ActType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @act_type }\n end\n end", "def new\n @page_type = PageType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_type }\n end\n end", "def new\n @breadcrumb = 'create'\n @entity_type = EntityType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_type }\n end\n end", "def new\n @fieldtype = Fieldtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fieldtype }\n end\n end", "def new\n @info_type = InfoType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_type }\n end\n end", "def new\n @itype = Itype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @itype }\n end\n end", "def new\n @ftype = Ftype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ftype }\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 @resource = Resource.new\n @resource_types=ResourceType.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @realty_type = RealtyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @realty_type }\n end\n end", "def new\n @entry_type = EntryType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry_type }\n end\n end", "def new\n @client_type = ClientType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client_type }\n end\n end", "def new\n @person = people_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @site_type = SiteType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site_type }\n end\n end", "def new\n @collection_type = CollectionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection_type }\n end\n end", "def new\n @category_type = CategoryType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category_type }\n end\n end", "def new\n @gl_type = GlType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gl_type }\n end\n end", "def new\n @types_of_apprenticeship = TypesOfApprenticeship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @types_of_apprenticeship }\n end\n end", "def new\n @tasktype = Tasktype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tasktype }\n end\n end", "def new\n @breadcrumb = 'create'\n @product_type = ProductType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_type }\n end\n end", "def new\n @instance_type = InstanceType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance_type }\n end\n end", "def new\n @pubtype = Pubtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pubtype }\n end\n end", "def new\n @action_type = ActionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @action_type }\n end\n end", "def new\n @kind = Kind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kind }\n end\n end", "def new\n @trtype = Trtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trtype }\n end\n end", "def new\n @rtype = Rtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rtype }\n end\n end", "def new\n if current_user && current_user.admin?\n @page_type = PageType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_type }\n end\n \n else\n flash[:danger] = 'Only administrators can modify page_types! <a href=\"' + new_user_session_path + '\">Log in to continue.</a>'\n redirect_to root_path\n end\n end", "def new\n @producttype = Producttype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @producttype }\n end\n end", "def new\n @talktype = Talktype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talktype }\n end\n end", "def new\n @service_type = ServiceType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service_type }\n end\n end", "def new\n @all_field_type = AllFieldType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @all_field_type }\n end\n end", "def new\n @sample_type = SampleType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sample_type }\n end\n end", "def new\n @crate_type = CrateType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @crate_type }\n end\n end", "def new\n @identifier_type = IdentifierType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @identifier_type }\n end\n end", "def new\n @structure_type = StructureType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @structure_type }\n end\n end", "def new\n @type_of_cleaning_and_washing = TypeOfCleaningAndWashing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type_of_cleaning_and_washing }\n end\n end", "def new\n @task_type = TaskType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_type }\n end\n end", "def new\n @talk_type = TalkType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talk_type }\n end\n end", "def new\n @incident_type = IncidentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @incident_type }\n end\n end", "def new\n @reform_type = ReformType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reform_type }\n end\n end", "def new\n @daytype = Daytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daytype }\n end\n end", "def new\n @observation_type = ObservationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation_type }\n end\n end", "def new\n @member_type = MemberType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member_type }\n end\n end", "def new\n @fish_type = FishType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fish_type }\n end\n end", "def new\n @model_type = ModelType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @model_type }\n end\n end", "def new\n @type_course = TypeCourse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type_course }\n end\n end", "def new\n @paper_type = PaperType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paper_type }\n end\n end", "def new\n @travel_type = TravelType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @travel_type }\n end\n end", "def new\n @breadcrumb = 'create'\n @invoice_type = InvoiceType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_type }\n end\n end", "def new\n @talent = Talent.new\n @types = Type.all\n \n respond_to do |format|\n format.html \n format.json { render :json => @talent }\n end\n end", "def new\n @breadcrumb = 'create'\n @timerecord_type = TimerecordType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timerecord_type }\n end\n end", "def new\n @type_customer = TypeCustomer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type_customer }\n end\n end", "def new\n @question_type = QuestionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_type }\n end\n end", "def new\n @boxtype = Boxtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @boxtype }\n end\n end", "def new\n @newtype = params[:newtype]\n @ptbudget = Ptbudget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end", "def new\n @ProfileType = ProfileType.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @ProfileType }\n end\n end", "def new\n @value_type = ValueType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @value_type }\n end\n end", "def new\n @document_type = DocumentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_type }\n end\n end", "def new\n @taxonomy = Taxonomy.new(:taxonomy_type => params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @taxonomy }\n end\n end", "def new\n @os_type = OsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @os_type }\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @ip_type = IpType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ip_type }\n end\n end", "def new\n @log_type = LogType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @log_type }\n end\n end", "def new\n @tax_type = TaxType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tax_type }\n end\n end", "def new\n @page = Page.new\n\t\t@types = Type.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @item_type = ItemType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_type }\n end\n end", "def new\n @genotype = Genotype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @genotype }\n end\n end", "def new\n @servicetype = Servicetype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @servicetype }\n end\n end", "def new\n @reflection = Reflection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reflection }\n end\n end", "def new\n if params[:type]\n if @form = Form.create(params.slice(:type))\n @form.client = @client\n @form.date_submitted = Date.today\n @form.needs_review = true\n @form.herald = account.sca_name\n @form.heralds_email = account.contact_info\n respond_to do |format|\n format.text { render :text => @form.inspect }\n format.html # new.html.erb \n format.xml { render :xml => @form }\n end\n return\n else\n @error = \"Unknown type: #{params[:type]} from params #{params.inspect}\"\n end\n end\n @client = params[:client_id]\n @types = Form.types\n render :action => 'types'\n end", "def new\n @servicetype = Servicetype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @servicetype }\n end\n end", "def new\n @contract_type = ContractType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contract_type }\n end\n end", "def new\r\n @item_type = ItemType.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item_type }\r\n end\r\n end", "def new\n @edited << 'new'\n @expanded << 'new'\n\n respond_to do |format|\n format.html { render template: 'shared/new' }\n format.js { render 'reference_type' }\n format.json { render json: @reference_type }\n end\n end", "def new\n @breadcrumb = 'create'\n @reading_type = ReadingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reading_type }\n end\n end", "def new\n @stock_type = StockType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock_type }\n end\n end", "def new\n @costtype = Costtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @costtype }\n end\n end", "def new\n @fueltype = Fueltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fueltype }\n end\n end", "def new\n @addresstype = Addresstype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @addresstype }\n end\n end", "def new\n @special_needs_type = SpecialNeedsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @special_needs_type }\n end\n end", "def new\n @uri_type = UriType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uri_type }\n end\n end", "def new\n @breadcrumb = 'create'\n @tariff_type = TariffType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tariff_type }\n end\n end", "def new\n @genre_type = GenreType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @genre_type }\n end\n end", "def new\n @lotto_type = LottoType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lotto_type }\n end\n end", "def new\n @customer = Customer.new\n @customer_types = [CustomerType.new]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @content_type = ContentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_type }\n end\n end", "def new\n @content_type = ContentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_type }\n end\n end", "def new\n @discipline_type = DisciplineType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @discipline_type }\n end\n end", "def new\n @recipe_type = RecipeType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe_type }\n end\n end", "def new\n @election_type = ElectionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @election_type }\n end\n end", "def new\n @poi_type = PoiType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poi_type }\n end\n end", "def new\n @business_type = BusinessType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @business_type }\n end\n end", "def new\n @pageType = \"new\"\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end", "def new\n @realty_type = RealtyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @realty_type }\n end\n end", "def new\n @breadcrumb = 'create'\n @infrastructure_type = InfrastructureType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @infrastructure_type }\n end\n end", "def new\n @contractor_type = ContractorType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contractor_type }\n end\n end" ]
[ "0.8200252", "0.7512469", "0.7484872", "0.7386359", "0.73646295", "0.7362049", "0.73583746", "0.7338448", "0.733121", "0.72833586", "0.72791624", "0.7273098", "0.7257026", "0.7222662", "0.722143", "0.72157836", "0.7185158", "0.7178197", "0.7156113", "0.71510834", "0.71470594", "0.7144825", "0.7141692", "0.7136057", "0.7132812", "0.71182555", "0.71173936", "0.711592", "0.70643795", "0.7052244", "0.70378304", "0.7032534", "0.7022886", "0.7007566", "0.70027024", "0.70007133", "0.69963044", "0.69958895", "0.6994439", "0.69927186", "0.69901377", "0.6987481", "0.6974487", "0.69726974", "0.69361496", "0.6935142", "0.693048", "0.69261694", "0.69228506", "0.69228035", "0.69202995", "0.69157076", "0.691474", "0.69122994", "0.69027954", "0.6900732", "0.6890341", "0.6889226", "0.68802184", "0.6875597", "0.6865727", "0.6863887", "0.6862662", "0.68495023", "0.68488467", "0.6848638", "0.6823796", "0.6819627", "0.6813058", "0.68078077", "0.68061274", "0.68040246", "0.67999154", "0.6776677", "0.67736226", "0.6773387", "0.6772987", "0.6768835", "0.67627585", "0.6758403", "0.6757152", "0.6754195", "0.67480606", "0.67469704", "0.67439985", "0.67388034", "0.6738108", "0.6737206", "0.6732753", "0.6720896", "0.67191356", "0.67191356", "0.67186564", "0.6715843", "0.6711572", "0.670556", "0.6697814", "0.669253", "0.66867113", "0.66857964", "0.667656" ]
0.0
-1
POST /types POST /types.json
def create @amenity = Amenity.new(params[:amenity]) respond_to do |format| if @amenity.save format.html { redirect_to admin_amenity_path(@amenity), notice: 'Amenity was successfully created.' } format.json { render json: @amenity, status: :created, location: @amenity } else format.html { render action: "new" } format.json { render json: @amenity.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end", "def type_params\n params.require(:type).permit( :name)\n end", "def create\n @type = Type.new(type_params)\n\n unless @type.save\n render json: @type.errors, status: :unprocessable_entity\n end\n \n end", "def type_params\n params.require(:type).permit(:name)\n end", "def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end", "def evals_types\n call_path = \"evals/types\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end", "def add_dummy_type\n params[:data] ||= {}\n params[:data][:type] = resource_klass._type.to_s\n end", "def create_types\n\t[]\nend", "def create_types\n\t[]\nend", "def json_params\n params.require(:json).permit(:type, :data)\n end", "def create_types\n\t\t[]\n\tend", "def create_types\n\t\t[]\n\tend", "def type_params\n params.require(:type).permit(:name, :index)\n end", "def types\n commit('types', nil)\n end", "def create_type_params\n params.require(:create_type).permit(:name, :display_name, :note)\n end", "def type_name_params\n params.require(:type_name).permit(:type_id, :name)\n end", "def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end", "def create\n @method_type = MethodType.new(method_type_params)\n\n respond_to do |format|\n if @method_type.save\n format.html { redirect_to @method_type, notice: \"Method type was successfully created.\" }\n format.json { render :show, status: :created, location: @method_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @method_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @realty_type = RealtyType.new(params[:realty_type])\n\n respond_to do |format|\n if @realty_type.save\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully created.' }\n format.json { render json: @realty_type, status: :created, location: @realty_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nametype = Nametype.new(nametype_params)\n\n respond_to do |format|\n if @nametype.save\n format.html { redirect_to @nametype, notice: 'Nametype was successfully created.' }\n format.json { render :show, status: :created, location: @nametype }\n else\n format.html { render :new }\n format.json { render json: @nametype.errors, status: :unprocessable_entity }\n end\n end\n end", "def type\n @json_body['type']\n end", "def create\n @valid_type = ValidType.new(valid_type_params)\n @valid_type.typed = true\n\n respond_to do |format|\n if @valid_type.save\n format.html { redirect_to valid_types_path, notice: 'Entity Type was successfully created.' }\n format.json { render :show, status: :created, location: @valid_type }\n else\n format.html { render :new }\n format.js { render :new }\n format.json { render json: @valid_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def type_params\n params.require(:type).permit(:name, :image, :trash, :description, :image_id)\n end", "def create\n @novelty_type = NoveltyType.new(novelty_type_params)\n\n respond_to do |format|\n if @novelty_type.save\n format.html { redirect_to @novelty_type, notice: 'Novelty type was successfully created.' }\n format.json { render :show, status: :created, location: @novelty_type }\n else\n format.html { render :new }\n format.json { render json: @novelty_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @type = Type.new(type_params)\n @sub_types = params[:subtype_attributes]\n if @type.save\n @sub_types.each do |subtype|\n @subtype = @type.subtype.new\n @subtype.name = subtype[\"name\"]\n @subtype.code = subtype[\"code\"]\n @subtype.save\n end\n flash[:notice] = 'Type was successfully created.'\n redirect_to types_path\n else\n flash[:error] = @type.errors.full_messages\n render \"new\"\n end\n end", "def create\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type = EntryType.new(params[:entry_type])\n @entry_type.field_type_ids = field_type_ids\n @entry_type.form_code = build_form_code(@entry_type.field_types)\n @entry_type.model_code = build_model_code(@entry_type.name, @entry_type.field_types)\n @entry_type.model = build_model_from_code(@entry_type)\n\n respond_to do |format|\n if @entry_type.save\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully created.' }\n format.json { render json: @entry_type, status: :created, location: @entry_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student_type = StudentType.new(student_type_params)\n\n if @student_type.save\n render json: @student_type, status: :created, location: @student_type\n else\n render json: @student_type.errors, status: :unprocessable_entity\n end\n end", "def create_break_type(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/labor/break-types',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def create_map_type(map_type_body, options = {})\n path = base_uri\n request(path, options.merge(method: :post), map_type_body).to_s\n end", "def use_type_params\n params.require(:use_type).permit(:name)\n end", "def add_type(type)\n end", "def create\n @api_v1_user_type = Api::V1::UserType.new(api_v1_user_type_params)\n\n respond_to do |format|\n if @api_v1_user_type.save\n format.html { redirect_to @api_v1_user_type, notice: 'User type was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_user_type }\n else\n format.html { render :new }\n format.json { render json: @api_v1_user_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def type_params\n params.require(:type).permit(:common_name, :botanical_name, :info_panel, :count)\n end", "def create\n @typeofstatus = Typeofstatus.new(typeofstatus_params)\n\n respond_to do |format|\n if @typeofstatus.save\n format.html { redirect_to @typeofstatus, notice: 'Typeofstatus was successfully created.' }\n format.json { render :show, status: :created, location: @typeofstatus }\n else\n format.html { render :new }\n format.json { render json: @typeofstatus.errors, status: :unprocessable_entity }\n end\n end\n end", "def typeconge_params\n params.require(:typeconge).permit(:typeconge)\n end", "def create\n @recipe_type = RecipeType.new(recipe_type_params)\n\n respond_to do |format|\n if @recipe_type.save\n format.html { redirect_to @recipe_type, notice: \"Recipe type was successfully created.\" }\n format.json { render :show, status: :created, location: @recipe_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @recipe_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_type(type)\n\n # nothing to be done\n end", "def add_type(type)\n\n # nothing to be done\n end", "def create\n @spec_type = SpecType.new(spec_type_params)\n\n respond_to do |format|\n if @spec_type.save\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully created.' }\n format.json { render :show, status: :created, location: @spec_type }\n else\n format.html { render :new }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @act_type = ActType.new(params[:act_type])\n\n respond_to do |format|\n if @act_type.save\n format.html { redirect_to @act_type, notice: 'Тип документа успешно создан.' }\n format.json { render json: @act_type, status: :created, location: @act_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @act_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize :resquest_type, :create?\n @resquest_type = ResquestType.new(resquest_type_params)\n\n respond_to do |format|\n if @resquest_type.save\n format.html { redirect_to @resquest_type, notice: 'Resquest type was successfully created.' }\n format.json { render :show, status: :created, location: @resquest_type }\n else\n format.html { render :new }\n format.json { render json: @resquest_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @collection = current_user.collections.find(params[:collection_id])\n @entity_type = @collection.entity_types.new(params[:entity_type])\n\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'Type was successfully created.' }\n format.json { render json: @entity_type, status: :created, location: @entity_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trait_type = TraitType.new(trait_type_params)\n\n if @trait_type.save\n render json: @trait_type, status: :created, location: @trait_type\n else\n render json: @trait_type.errors, status: :unprocessable_entity\n end\n end", "def type\n @activities = Activity.tagged_with_on(:types,params[:type_name]).page params[:page]\n respond_with @activities\n end", "def flat_type_params\n params.require(:flat_type).permit(:name, :area, :status)\n end", "def create\n @modeltype = Modeltype.new(modeltype_params)\n\n respond_to do |format|\n if @modeltype.save\n format.html { redirect_to @modeltype, notice: 'Modeltype was successfully created.' }\n format.json { render :show, status: :created, location: @modeltype }\n else\n format.html { render :new }\n format.json { render json: @modeltype.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_type_params\n params.require(:test_type).permit(:name, :description, :data)\n end", "def create\n @types_of_apprenticeship = TypesOfApprenticeship.new(params[:types_of_apprenticeship])\n\n respond_to do |format|\n if @types_of_apprenticeship.save\n format.html { redirect_to @types_of_apprenticeship, notice: 'Types of apprenticeship was successfully created.' }\n format.json { render json: @types_of_apprenticeship, status: :created, location: @types_of_apprenticeship }\n else\n format.html { render action: \"new\" }\n format.json { render json: @types_of_apprenticeship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n image = {id: nil}\n if type_params[:image]\n image = Picture.create(name: type_params[:name], image: type_params[:image], description: \"Image of #{type_params[:name]} type\")\n else\n image = Picture.where(id: type_params[:image_id]).first if type_params[:image_id]\n end\n\n @type = Type.new(name: type_params[:name], description: type_params[:description], picture_id: image[:id])\n\n respond_to do |format|\n if @type.save\n format.html { redirect_to director_types_path, notice: 'Type was successfully created.' }\n format.json { render :show, status: :created, location: @type }\n else\n @pictures = Picture.where(trash: false)\n format.html { render :new }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @affected_type = AffectedType.new(affected_type_params)\n\n respond_to do |format|\n if @affected_type.save\n format.html { redirect_to @affected_type, notice: 'Affected type was successfully created.' }\n format.json { render :show, status: :created, location: @affected_type }\n else\n format.html { render :new }\n format.json { render json: @affected_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @observation_type = ObservationType.new(params[:observation_type])\n\n respond_to do |format|\n if @observation_type.save\n format.html { redirect_to @observation_type, notice: 'Observation type was successfully created.' }\n format.json { render json: @observation_type, status: :created, location: @observation_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @observation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def index_params\n params.permit(:type)\n end", "def resource_type_params\n params.require(:resource_type).permit(:name)\n end", "def create\n section_type_ids = params[:site_type].delete(\"section_type_ids\")\n @site_type = SiteType.new(params[:site_type])\n @site_type.section_type_ids = section_type_ids\n\n respond_to do |format|\n if @site_type.save\n format.html { redirect_to @site_type, notice: 'Site type was successfully created.' }\n format.json { render json: @site_type, status: :created, location: @site_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @typeconge = Typeconge.new(typeconge_params)\n\n respond_to do |format|\n if @typeconge.save\n format.html { redirect_to @typeconge, notice: 'Typeconge was successfully created.' }\n format.json { render :show, status: :created, location: @typeconge }\n else\n format.html { render :new }\n format.json { render json: @typeconge.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @entity_type = EntityType.new(entity_type_params)\n\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to @entity_type, notice: 'Entity type was successfully created.' }\n format.json { render :show, status: :created, location: @entity_type }\n else\n format.html { render :new }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page_type = PageType.new(params[:page_type])\n\n respond_to do |format|\n if @page_type.save\n format.html { redirect_to @page_type, notice: 'Page type was successfully created.' }\n format.json { render json: @page_type, status: :created, location: @page_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task_type = TaskType.new(task_type_params)\n\n respond_to do |format|\n if @task_type.save\n format.html { redirect_to task_types_path, notice: 'Task type was successfully created.' }\n format.json { render :show, status: :created, location: @task_type }\n else\n format.html { render :new }\n format.json { render json: @task_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @language_type = LanguageType.new(language_type_params)\n\n if @language_type.save\n render json: @language_type, status: :created, location: @language_type\n else\n render json: @language_type.errors, status: :unprocessable_entity\n end\n end", "def entity_type_params\n params.require(:entity_type).permit(:type)\n end", "def location_type_params\n params.require(:location_type).permit(:name,\n :location_types => [])\n end", "def create\n @use_type = UseType.new(use_type_params)\n\n respond_to do |format|\n if @use_type.save\n format.html { redirect_to @use_type, notice: 'Use type was successfully created.' }\n format.json { render :show, status: :created, location: @use_type }\n else\n format.html { render :new }\n format.json { render json: @use_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client_type = ClientType.new(params[:client_type])\n\n respond_to do |format|\n if @client_type.save\n format.html { redirect_to @client_type, notice: 'Client type was successfully created.' }\n format.json { render json: @client_type, status: :created, location: @client_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def housing_type_params\n params.require(:housing_type).permit(:name)\n end", "def recept_type_params\n params.require(:recept_type).permit(:name)\n end", "def create\n @type_identification = TypeIdentification.new(type_identification_params)\n\n respond_to do |format|\n if @type_identification.save\n format.html { redirect_to @type_identification, notice: 'Type identification was successfully created.' }\n format.json { render :show, status: :created, location: @type_identification }\n else\n format.html { render :new }\n format.json { render json: @type_identification.errors, status: :unprocessable_entity }\n end\n end\n end", "def cmd_types argv\n setup argv\n response = @api.types\n msg response\n return response\n end", "def create\n @reform_type = ReformType.new(params[:reform_type])\n\n respond_to do |format|\n if @reform_type.save\n format.html { redirect_to @reform_type, notice: 'Reform type was successfully created.' }\n format.json { render json: @reform_type, status: :created, location: @reform_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reform_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident_type = IncidentType.new(incident_type_params)\n\n respond_to do |format|\n if @incident_type.save\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully created.' }\n format.json { render :show, status: :created, location: @incident_type }\n else\n format.html { render :new }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testtype = Testtype.new(testtype_params)\n\n respond_to do |format|\n if @testtype.save\n format.html { redirect_to @testtype, notice: 'Testtype was successfully created.' }\n format.json { render action: 'show', status: :created, location: @testtype }\n else\n format.html { render action: 'new' }\n format.json { render json: @testtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def type\n @json['type']\n end", "def types(types); end", "def create\n @question_type = QuestionType.new(params[:question_type])\n\n respond_to do |format|\n if @question_type.save\n format.html { redirect_to @question_type, notice: 'Question type was successfully created.' }\n format.json { render json: @question_type, status: :created, location: @question_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def phones_type_params\n params.require(:phones_type).permit(:name)\n end", "def create\n @register_animal_type = Register::AnimalType.new(register_animal_type_params)\n\n respond_to do |format|\n if @register_animal_type.save\n format.html { redirect_to register_animal_types_path, success: 'O tipo de animal foi criado com sucesso.' }\n format.json { render :index, status: :created, location: @register_animal_type }\n else\n format.html { render :new }\n format.json { render json: @register_animal_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @itemtype = Itemtype.new(itemtype_params)\n\n respond_to do |format|\n if @itemtype.save\n format.html { redirect_to @itemtype, notice: 'Itemtype was successfully created.' }\n format.json { render :show, status: :created, location: @itemtype }\n else\n format.html { render :new }\n format.json { render json: @itemtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @entity_type = EntityType.new(entity_type_params)\n @entity_type.collection_id = @collection.id\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully created.' }\n format.json { render :show, status: :created, location: @entity_type }\n else\n format.html { render :new }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def method_type_params\n params.require(:method_type).permit(:description, :macroscopy, :diagnosis)\n end", "def create\n @type_test = TypeTest.new(type_test_params)\n\n respond_to do |format|\n if @type_test.save\n format.html { redirect_to @type_test, notice: 'Type test was successfully created.' }\n format.json { render :show, status: :created, location: @type_test }\n else\n format.html { render :new }\n format.json { render json: @type_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def route_type_params\n params.require(:route_type).permit(:name)\n end", "def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n @customer_types =\n CustomerType.new(\n :customer_type => params[:customer_type],\n :customer_type_name => params[:customer_type_name],\n :zip_number => params[:zip_number],\n :prefecture_cd => params[:prefecture_cd],\n :city => params[:city],\n :oaza => params[:oaza],\n :town => params[:town],\n :building_name => params[:building_name],\n :customer_type_memo => params[:customer_type_memo])\n\n @customer.customer_types << @customer_types\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: '以下の情報が登録されました。' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incident_type = IncidentType.new(params[:incident_type])\n\n respond_to do |format|\n if @incident_type.save\n format.html { redirect_to @incident_type, notice: 'Incident type was successfully created.' }\n format.json { render json: @incident_type, status: :created, location: @incident_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @typebourse = Typebourse.new(typebourse_params)\n\n respond_to do |format|\n if @typebourse.save\n format.html { redirect_to @typebourse, notice: 'Typebourse was successfully created.' }\n format.json { render :show, status: :created, location: @typebourse }\n else\n format.html { render :new }\n format.json { render json: @typebourse.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @q_type = QType.new(q_type_params)\n\n respond_to do |format|\n if @q_type.save\n format.html { redirect_to @q_type, notice: 'Q type was successfully created.' }\n format.json { render :show, status: :created, location: @q_type }\n else\n format.html { render :new }\n format.json { render json: @q_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def subscriptions\n update_subscriptions(params[:types]) if params[:types]\n @types = build_notification_types\n render :json => @types\n end", "def resquest_type_params\n params.require(:resquest_type).permit(:name, :description)\n end", "def create\n @type_person = TypePerson.new(params[:type_person])\n\n respond_to do |format|\n if @type_person.save\n format.html { redirect_to @type_person, notice: 'Type person was successfully created.' }\n format.json { render json: @type_person, status: :created, location: @type_person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @type_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def devicetype_params\n params.require(:devicetype).permit(:type)\n end", "def tctype_params\n params.require(:type).permit(:name, :description)\n end", "def entry_type_params\n\n params.require(:entry_type).permit(:id, :name, :type, :contra)\n\nend", "def api_v1_user_type_params\n params.require(:api_v1_user_type).permit(:name)\n end", "def create\n @receipt_item_type = current_account.receipt_item_types.create(receipt_item_type_params)\n if @receipt_item_type\n respond_with @receipt_item_type do |format|\n format.json { render :json => current_account.receipt_item_types.include_names.find(@receipt_item_type.id) }\n end\n else\n respond_with @receipt_item_type\n end\n end", "def create\n @intervention_type = InterventionType.new(intervention_type_params)\n\n respond_to do |format|\n if @intervention_type.save\n format.html { redirect_to intervention_types_path, notice: 'O tipo de intervenção foi criado.' }\n format.json { render :show, status: :created, location: @intervention_type }\n else\n format.html { render :new }\n format.json { render json: @intervention_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tag_type = TagType.new(tag_type_params)\n respond_to do |format|\n if @tag_type.save\n format.html { redirect_to @tag_type, notice: 'Tag type was successfully created.' }\n format.json { render :show, status: :created, location: @tag_type }\n else\n format.html { render :new }\n format.json { render json: @tag_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jewelry_type = JewelryType.new(params[:jewelry_type])\n\n respond_to do |format|\n if @jewelry_type.save\n format.html { redirect_to @jewelry_type, notice: 'Jewelry type was successfully created.' }\n format.json { render json: @jewelry_type, status: :created, location: @jewelry_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @jewelry_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def typebourse_params\n params.require(:typebourse).permit(:name)\n end", "def add_type(type)\n\n # does nothing, types are differentiated by the 'typ' column\n end", "def create\n @ftype = Ftype.create_ftype(params[:ftype], @user)\n if @ftype.save\n render json: {:code => 0}\n else\n render json: {:code => -1, :msg => \"params invalid\"}\n end\n end", "def create\n @typeofuser = Typeofuser.new(typeofuser_params)\n\n respond_to do |format|\n if @typeofuser.save\n format.html { redirect_to @typeofuser, notice: 'Typeofuser was successfully created.' }\n format.json { render :show, status: :created, location: @typeofuser }\n else\n format.html { render :new }\n format.json { render json: @typeofuser.errors, status: :unprocessable_entity }\n end\n end\n end", "def service_type_params\n params.require(:service_type).permit(:name)\n end" ]
[ "0.70687604", "0.65884984", "0.6485644", "0.6473384", "0.6444047", "0.63409996", "0.62612855", "0.6230885", "0.6230885", "0.6212527", "0.61901176", "0.61901176", "0.6152289", "0.61110187", "0.6088263", "0.60799885", "0.6067926", "0.60175115", "0.60133713", "0.5963181", "0.5957745", "0.59482723", "0.5924674", "0.5908861", "0.589088", "0.5887648", "0.58598256", "0.5847015", "0.58423936", "0.5842141", "0.58395666", "0.5818834", "0.5811792", "0.58005774", "0.57865995", "0.578548", "0.57760346", "0.57760346", "0.57708097", "0.5762152", "0.5759099", "0.57517856", "0.573993", "0.57361984", "0.57314545", "0.57193357", "0.5717205", "0.5715865", "0.5714445", "0.57108843", "0.5706527", "0.5692019", "0.56904864", "0.5677125", "0.56758535", "0.56747466", "0.5672658", "0.56645995", "0.5659584", "0.5650761", "0.5649526", "0.56486124", "0.56453204", "0.5632727", "0.56265485", "0.56242496", "0.5619121", "0.56180507", "0.5614826", "0.56128645", "0.5608302", "0.56055224", "0.5603254", "0.5599101", "0.55983704", "0.559702", "0.5595756", "0.5588346", "0.5581998", "0.5580806", "0.55795026", "0.55758876", "0.5573499", "0.5564095", "0.55553985", "0.555215", "0.55504805", "0.5550171", "0.554838", "0.5547501", "0.5544125", "0.55413204", "0.55402946", "0.5539456", "0.5538272", "0.5534761", "0.5534227", "0.5534089", "0.55327016", "0.55323106", "0.55305487" ]
0.0
-1
PUT /types/1 PUT /types/1.json
def update @amenity = Type.find(params[:id]) respond_to do |format| if @amenity.update_attributes(params[:amenity]) format.html { redirect_to admin_type_path(@amenity), notice: 'Amenity was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @amenity.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @type.update(type_params)\n end", "def change_type\n\t\t\trender json: User.update_type_by_id(params[:id], params[:type], params[:is])\n\t\tend", "def update\n\n raw = params[:sample_type]\n st = SampleType.find(raw[:id])\n\n st.name = raw[:name]\n st.description = raw[:description]\n st.save\n st.save_field_types raw[:field_types]\n\n render json: { sample_type: st }\n\n end", "def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def _update type, id, body\n @elasticsupport.client.update index: _index_for(type), type: type.to_s, id: id, body: body\n end", "def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end", "def update\n respond_to do |format|\n instance = get_instance\n set_meta instance\n if instance.update(type_params)\n # Redirect to index\n format.html { redirect_to redirect_address(@type), notice: \"#{type_label} was successfully updated.\" }\n else\n flash[:alert] = \"#{type_label} has not been saved.\"\n format.html { render sti_template(@type, :edit) }\n end\n end\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n end", "def set_type\n raise Error::NotFoundError unless (@type = Type.find(params[:id]))\n end", "def create_or_update type, params\n setup_connection\n\n id = params.delete(:id)\n url = [type, id].compact.join('/')\n\n payload = params\n payload[:format] = 'json'\n\n @last_response = if id.present?\n @conn.put(url, params)\n else\n @conn.post(url, params)\n end\n\n JSON.parse @last_response.body\n end", "def update\n respond_to do |format|\n if @model_type.update(model_type_params)\n format.html { redirect_to @model_type, notice: 'Model type was successfully updated.' }\n format.json { render :show, status: :ok, location: @model_type }\n else\n format.html { render :edit }\n format.json { render json: @model_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(name, type, options = {})\n Utils.stringify_keys!(options)\n path = \"/projects/#{project.name}/resources/#{name}\"\n\n headers = build_create_base_headers(name, type, options)\n body = build_create_base_body(options)\n\n !!client.put(path, headers: headers, body: body)\n end", "def set_type\n @type = Type.find(params[:id])\n\n end", "def update\n respond_to do |format|\n if @api_v1_admin_type.update(api_v1_admin_type_params)\n format.html { redirect_to @api_v1_admin_type, notice: 'Admin type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_admin_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_admin_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def type= new_type\n @gapi.update! type: verify_type(new_type)\n end", "def update\n respond_to do |format|\n if get_instance.update(type_params)\n # Redirect to index\n format.json { render sti_template(@type, :show), status: :ok, location: get_instance } # TODO: test\n else\n format.json { render json: get_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_type\n @type = Type.find(params[:id])\n end", "def update \t\n record = AssetType.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end", "def update_question_type\n form_params = params.require(:form).permit(:question_id, :question_type)\n\n render json: Question.update_question_type(form_params)\n end", "def update\n respond_to do |format|\n if @api_v1_user_type.update(api_v1_user_type_params)\n format.html { redirect_to @api_v1_user_type, notice: 'User type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_user_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_user_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_type\n @type = Type.find(params[:id])\n end", "def set_type\n @type = Type.find(params[:id])\n end", "def set_type\n @type = Type.find(params[:id])\n end", "def update\n respond_to do |format|\n if @type.update(type_params)\n format.html { redirect_to director_types_path, notice: 'Type was successfully updated.' }\n format.json { render :show, status: :ok, location: @director_type }\n else\n format.html { render :edit }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n if @os_type.update_attributes(params[:os_type])\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @method_type.update(method_type_params)\n format.html { redirect_to @method_type, notice: \"Method type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @method_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @method_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @use_type.update(use_type_params)\n format.html { redirect_to @use_type, notice: 'Use type was successfully updated.' }\n format.json { render :show, status: :ok, location: @use_type }\n else\n format.html { render :edit }\n format.json { render json: @use_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @trait_type = TraitType.find(params[:id])\n\n if @trait_type.update(trait_type_params)\n head :no_content\n else\n render json: @trait_type.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @novelty_type.update(novelty_type_params)\n format.html { redirect_to @novelty_type, notice: 'Novelty type was successfully updated.' }\n format.json { render :show, status: :ok, location: @novelty_type }\n else\n format.html { render :edit }\n format.json { render json: @novelty_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @spec_type.update(spec_type_params)\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully updated.' }\n format.json { render :show, status: :ok, location: @spec_type }\n else\n format.html { render :edit }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @os_type.update(os_type_params)\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_type }\n else\n format.html { render :edit }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @typeio.update(typeio_params)\n format.html { redirect_to @bulletin_board, notice: 'Typeio was successfully updated.' }\n format.json { render :show, status: :ok, location: @typeio }\n else\n format.html { render :edit }\n format.json { render json: @typeio.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end", "def update!(**args)\n @type = args[:type] if args.key?(:type)\n @id = args[:id] if args.key?(:id)\n end", "def update\n @student_type = StudentType.find(params[:id])\n\n if @student_type.update(student_type_params)\n head :no_content\n else\n render json: @student_type.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @instance_type.update(instance_type_params)\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @value_type = ValueType.find(params[:id])\n\n respond_to do |format|\n if @value_type.update_attributes(params[:value_type])\n format.html { redirect_to @value_type, notice: 'Value type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @value_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @realty_type = RealtyType.find(params[:id])\n\n respond_to do |format|\n if @realty_type.update_attributes(params[:realty_type])\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @affected_type.update(affected_type_params)\n format.html { redirect_to @affected_type, notice: 'Affected type was successfully updated.' }\n format.json { render :show, status: :ok, location: @affected_type }\n else\n format.html { render :edit }\n format.json { render json: @affected_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @intervention_type.update(intervention_type_params)\n format.html { redirect_to intervention_types_path, notice: 'O tipo de intervenção foi actualizado.' }\n format.json { render :show, status: :ok, location: @intervention_type }\n else\n format.html { render :edit }\n format.json { render json: @intervention_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @nametype.update(nametype_params)\n format.html { redirect_to @nametype, notice: 'Nametype was successfully updated.' }\n format.json { render :show, status: :ok, location: @nametype }\n else\n format.html { render :edit }\n format.json { render json: @nametype.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n if @client_type.update_attributes(params[:client_type])\n format.html { redirect_to @client_type, notice: 'Client type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @type = Type.find(params[:id])\n if params[:type]['temp_title'] && params[:type]['temp_description']\n @type.name = params[:type]['temp_title']\n @type.description = params[:type]['temp_description']\n @type.image = params[:type]['temp_image']\n end\n @type.active = true\n\n respond_to do |format|\n if @type.update_attributes(params[:type])\n format.html { redirect_to @type, notice: 'Type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @act_type = ActType.find(params[:id])\n\n respond_to do |format|\n if @act_type.update_attributes(params[:act_type])\n format.html { redirect_to @act_type, notice: 'Данные типа документа успешно обновлены.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @act_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_type\n puts \"set_type: #{params[:id]}\"\n @type = Type.where(id: params[:id]).first\n puts \"set_type, find: #{@type.id}\"\n end", "def update\n @incident_type = IncidentType.find(params[:id])\n\n respond_to do |format|\n if @incident_type.update_attributes(params[:incident_type])\n format.html { redirect_to @incident_type, notice: 'Incident type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task_type.update(task_type_params)\n format.html { redirect_to task_types_path, notice: 'Task type was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_type }\n else\n format.html { render :edit }\n format.json { render json: @task_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_break_type(id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/labor/break-types/{id}',\n 'default')\n .template_param(new_parameter(id, key: 'id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def update(type, _objects, _options = {})\n raise UndefinedUpdateStrategy, type\n end", "def update\n respond_to do |format|\n if @entity_type.update(entity_type_params)\n format.html { redirect_to @entity_type, notice: 'Entity type was successfully updated.' }\n format.json { render :show, status: :ok, location: @entity_type }\n else\n format.html { render :edit }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @instance_type = InstanceType.find(params[:id])\n\n respond_to do |format|\n if @instance_type.update_attributes(params[:instance_type])\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @observation_type = ObservationType.find(params[:id])\n\n respond_to do |format|\n if @observation_type.update_attributes(params[:observation_type])\n format.html { redirect_to @observation_type, notice: 'Observation type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @observation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n standard_update(OrganizationType, params[:id], organization_type_params)\n end", "def update\n respond_to do |format|\n if @route_type.update(route_type_params)\n format.html { redirect_to @route_type, notice: 'Route type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @route_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident_type.update(incident_type_params)\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident_type }\n else\n format.html { render :edit }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @modeltype.update(modeltype_params)\n format.html { redirect_to @modeltype, notice: 'Modeltype was successfully updated.' }\n format.json { render :show, status: :ok, location: @modeltype }\n else\n format.html { render :edit }\n format.json { render json: @modeltype.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gl_type = GlType.find(params[:id])\n\n respond_to do |format|\n if @gl_type.update_attributes(gl_type_params)\n format.html { redirect_to gl_types_path, notice: 'Gl type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gl_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @info_type = InfoType.find(params[:id])\n\n respond_to do |format|\n if @info_type.update_attributes(params[:info_type])\n format.html { redirect_to @info_type, notice: 'Info type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @info_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @typebourse.update(typebourse_params)\n format.html { redirect_to @typebourse, notice: 'Typebourse was successfully updated.' }\n format.json { render :show, status: :ok, location: @typebourse }\n else\n format.html { render :edit }\n format.json { render json: @typebourse.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_types\n\t[]\nend", "def update_types\n\t[]\nend" ]
[ "0.702886", "0.6754036", "0.6523385", "0.6511128", "0.6425218", "0.6421935", "0.63793814", "0.63169396", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.62724686", "0.6256044", "0.62383354", "0.62168777", "0.6211902", "0.6205092", "0.61970025", "0.6191111", "0.6183767", "0.61835873", "0.6178876", "0.61772275", "0.6156101", "0.6156101", "0.6156101", "0.6152036", "0.61318845", "0.6118107", "0.6102512", "0.6101876", "0.60974205", "0.6085994", "0.60500056", "0.60393673", "0.60269403", "0.6008169", "0.6000257", "0.5999507", "0.5981626", "0.5977523", "0.5964648", "0.596299", "0.59578633", "0.5943653", "0.59409773", "0.5935546", "0.59261054", "0.58984", "0.58977944", "0.5892144", "0.5886903", "0.5886709", "0.5884619", "0.5872013", "0.58705807", "0.5868639", "0.58668625", "0.5864718", "0.5863647", "0.586159", "0.58600706", "0.5858421", "0.5856044", "0.5856044" ]
0.0
-1
DELETE /types/1 DELETE /types/1.json
def destroy @amenity = Amenity.find(params[:id]) @amenity.destroy respond_to do |format| format.html { redirect_to admin_amenities_path } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @type = Type.find(params[:type])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to company_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dishtype.destroy\n respond_to do |format|\n format.html { redirect_to dishtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_admin_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_admin_types_url, notice: 'Admin type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n respond_to do |format|\n format.html { redirect_to client_types_url }\n format.json { head :no_content }\n end\n end", "def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end", "def destroy\n @api_v1_user_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_user_types_url, notice: 'User type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to realty_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testtype.destroy\n respond_to do |format|\n format.html { redirect_to testtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @affected_type.destroy\n respond_to do |format|\n format.html { redirect_to affected_types_url, notice: 'Affected type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reform_type = ReformType.find(params[:id])\n @reform_type.destroy\n\n respond_to do |format|\n format.html { redirect_to reform_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @act_type = ActType.find(params[:id])\n @act_type.destroy\n\n respond_to do |format|\n format.html { redirect_to act_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @girltype = Girltype.find(params[:id])\n @girltype.destroy\n\n respond_to do |format|\n format.html { redirect_to girltypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @novelty_type.destroy\n respond_to do |format|\n format.html { redirect_to novelty_types_url, notice: 'Novelty type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @addtype.destroy\n respond_to do |format|\n format.html { redirect_to addtypes_url, notice: '变动方式删除成功!.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dash_type = DashType.find(params[:id])\n @dash_type.destroy\n\n respond_to do |format|\n format.html { redirect_to dash_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_type.destroy\n respond_to do |format|\n format.html { redirect_to item_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @os_type = OsType.find(params[:id])\n @os_type.destroy\n\n respond_to do |format|\n format.html { redirect_to os_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fieldtype = Fieldtype.find(params[:id])\n @fieldtype.destroy\n\n respond_to do |format|\n format.html { redirect_to fieldtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @itype = Itype.find(params[:id])\n @itype.destroy\n\n respond_to do |format|\n format.html { redirect_to itypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n asset_type = AssetType.find(params[:id])\n asset_type.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rtype = Rtype.find(params[:id])\n @rtype.destroy\n\n respond_to do |format|\n format.html { redirect_to(rtypes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(realty_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @gl_type = GlType.find(params[:id])\n @gl_type.destroy\n\n respond_to do |format|\n format.html { redirect_to gl_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident_type = IncidentType.find(params[:id])\n @incident_type.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instance_type.destroy\n respond_to do |format|\n format.html { redirect_to instance_types_url }\n format.json { head :no_content }\n end\n end", "def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end", "def destroy\n @crate_type = CrateType.find(params[:id])\n @crate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to crate_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @jewelry_type = JewelryType.find(params[:id])\n @jewelry_type.destroy\n\n respond_to do |format|\n format.html { redirect_to jewelry_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @route_type.destroy\n respond_to do |format|\n format.html { redirect_to route_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model_type.destroy\n respond_to do |format|\n format.html { redirect_to model_types_url, notice: 'Model type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @structure_type = StructureType.find(params[:id])\n @structure_type.destroy\n\n respond_to do |format|\n format.html { redirect_to structure_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample_type = SampleType.find(params[:id])\n @sample_type.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ref_diagnostic_test_type = Ref::DiagnosticTestType.find(params[:id])\n @ref_diagnostic_test_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_diagnostic_test_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @identifier_type.destroy\n\n respond_to do |format|\n format.html { redirect_to identifier_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @all_field_type = AllFieldType.find(params[:id])\n @all_field_type.destroy\n\n respond_to do |format|\n format.html { redirect_to all_field_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mtype = Mtype.find(params[:id])\n @mtype.destroy\n\n respond_to do |format|\n format.html { redirect_to mtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat_type.destroy\n respond_to do |format|\n format.html { redirect_to flat_types_url, notice: 'Flat type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ad_type = AdType.find(params[:id])\n @ad_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ad_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @arc_type.destroy\n respond_to do |format|\n format.html { redirect_to arc_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tasktype = Tasktype.find(params[:id])\n @tasktype.destroy\n\n respond_to do |format|\n format.html { redirect_to tasktypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @method_type.destroy\n respond_to do |format|\n format.html { redirect_to method_types_url, notice: \"Method type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @entry_type = EntryType.find(params[:id])\n @entry_type.destroy\n\n respond_to do |format|\n format.html { redirect_to entry_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ftype = Ftype.find(params[:id])\n @ftype.destroy\n\n respond_to do |format|\n format.html { redirect_to ftypes_url }\n format.json { head :no_content }\n end\n end", "def remove(index, type, id)\n resp = delete do |req|\n req.url \"#{index}/#{type}/#{id}\"\n end\n resp.body\n end", "def destroy\n @awon_record_type.destroy\n respond_to do |format|\n format.html { redirect_to awon_record_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_type.destroy\n respond_to do |format|\n format.html { redirect_to client_types_url, notice: 'Tipo de Cliente deletado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @type.put_to_trash\n respond_to do |format|\n format.html { redirect_to director_types_path, notice: 'Type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @segment_type = SegmentType.find(params[:id])\n @segment_type.destroy\n\n respond_to do |format|\n format.html { redirect_to segment_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bs_type.destroy\n respond_to do |format|\n format.html { redirect_to bs_types_url, notice: 'Bs type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recept_type.destroy\n respond_to do |format|\n format.html { redirect_to recept_types_url, notice: 'Recept type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @typeconge.destroy\n respond_to do |format|\n format.html { redirect_to typeconges_url, notice: 'Typeconge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_type = ActivityType.find(params[:id])\n @activity_type.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @doi_type.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'El tipo de documento de identidad se eliminó satisfactoriamente.'\n redirect_to doi_types_path\n }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_type = ServiceType.find(params[:id])\n @service_type.destroy\n\n respond_to do |format|\n format.html { redirect_to service_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tax_type = TaxType.find(params[:id])\n @tax_type.destroy\n\n respond_to do |format|\n format.html { redirect_to tax_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instance_type = InstanceType.find(params[:id])\n @instance_type.destroy\n\n respond_to do |format|\n format.html { redirect_to instance_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @addresstype = Addresstype.find(params[:id])\n @addresstype.destroy\n\n respond_to do |format|\n format.html { redirect_to addresstypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @os_type.destroy\n respond_to do |format|\n format.html { redirect_to os_types_url, notice: 'Os type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_type = QuestionType.find(params[:id])\n @question_type.destroy\n\n respond_to do |format|\n format.html { redirect_to question_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @document_type = DocumentType.find(params[:id])\n @document_type.destroy\n\n respond_to do |format|\n format.html { redirect_to document_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @crossbowtype.destroy\n respond_to do |format|\n format.html { redirect_to crossbowtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish_type.destroy\n respond_to do |format|\n format.html { redirect_to dish_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize :resquest_type, :destroy?\n @resquest_type.destroy\n respond_to do |format|\n format.html { redirect_to resquest_types_url, notice: 'Resquest type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @info_type = InfoType.find(params[:id])\n @info_type.destroy\n\n respond_to do |format|\n format.html { redirect_to info_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @identity_type.destroy\n respond_to do |format|\n format.html { redirect_to identity_types_url, notice: 'Identity type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @use_type.destroy\n respond_to do |format|\n format.html { redirect_to use_types_url, notice: 'Use type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample_type.destroy\n respond_to do |format|\n format.html { redirect_to sample_types_url, notice: \"Sample type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @talktype = Talktype.find(params[:id])\n @talktype.destroy\n\n respond_to do |format|\n format.html { redirect_to talktypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ctype = Ctype.find(params[:id])\n @ctype.destroy\n\n respond_to do |format|\n format.html { redirect_to ctypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @az_simple_data_type = AzSimpleDataType.find(params[:id])\n @az_simple_data_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_simple_data_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page_type = PageType.find(params[:id])\n @page_type.destroy\n\n respond_to do |format|\n format.html { redirect_to page_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @itemtype.destroy\n respond_to do |format|\n format.html { redirect_to itemtypes_url, notice: 'Itemtype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tariff_type = TariffType.find(params[:id])\n @tariff_type.destroy\n\n respond_to do |format|\n format.html { redirect_to tariff_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spec_type.destroy\n respond_to do |format|\n format.html { redirect_to spec_types_url, notice: 'Spec type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @show_type.destroy\n respond_to do |format|\n format.html { redirect_to show_types_url, notice: 'Show type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @agency_type = AgencyType.find(params[:id])\n @agency_type.destroy\n\n respond_to do |format|\n format.html { redirect_to agency_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n begin\n if @resource_type.destroy\n respond_to do |format|\n format.html { redirect_to resource_types_url }\n format.json { head :no_content }\n end\n end \n rescue\n respond_to do |format|\n format.html { redirect_to \"index\", notice: \"Resource_type cann't delete.\" }\n end\n end\n end", "def destroy\n @modtype.destroy\n respond_to do |format|\n format.html { redirect_to modtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @entity_type = EntityType.find(params[:id])\n \n respond_to do |format|\n if @entity_type.destroy\n format.html { redirect_to entity_types_url,\n notice: (crud_notice('destroyed', @entity_type) + \"#{undo_link(@entity_type)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to entity_types_url, alert: \"#{@entity_type.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @observation_type = ObservationType.find(params[:id])\n @observation_type.destroy\n\n respond_to do |format|\n format.html { redirect_to observation_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @volume_type = VolumeType.find(params[:id])\n @volume_type.destroy\n\n respond_to do |format|\n format.html { redirect_to volume_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cdist_type = CdistType.find(params[:id])\n @cdist_type.destroy\n\n respond_to do |format|\n format.html { redirect_to cdist_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @travel_type = TravelType.find(params[:id])\n @travel_type.destroy\n\n respond_to do |format|\n format.html { redirect_to travel_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @fish_type = FishType.find(params[:id])\n @fish_type.destroy\n\n respond_to do |format|\n format.html { redirect_to fish_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shape_type = ShapeType.find(params[:id])\n @shape_type.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.shape_type'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_shape_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @modeltype.destroy\n respond_to do |format|\n format.html { redirect_to modeltypes_url, notice: 'Modeltype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admission_type = AdmissionType.find(params[:id])\n @admission_type.destroy\n\n respond_to do |format|\n format.html { redirect_to admission_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model_type = ModelType.find(params[:id])\n @model_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(model_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @talk_type = TalkType.find(params[:id])\n @talk_type.destroy\n\n respond_to do |format|\n format.html { redirect_to talk_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @value_type = ValueType.find(params[:id])\n @value_type.destroy\n\n respond_to do |format|\n format.html { redirect_to value_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trtype = Trtype.find(params[:id])\n @trtype.destroy\n\n respond_to do |format|\n format.html { redirect_to trtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @claim_type.destroy\n respond_to do |format|\n format.html { redirect_to claim_types_url, notice: 'Claim type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_task_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @collection_type = CollectionType.find(params[:id])\n @collection_type.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @type_identification.destroy\n respond_to do |format|\n format.html { redirect_to type_identifications_url, notice: 'Type identification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contract_type = ContractType.find(params[:id])\n @contract_type.destroy\n\n respond_to do |format|\n format.html { redirect_to contract_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @servicetype = Servicetype.find(params[:id])\n @servicetype.destroy\n\n respond_to do |format|\n format.html { redirect_to servicetypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @servicetype = Servicetype.find(params[:id])\n @servicetype.destroy\n\n respond_to do |format|\n format.html { redirect_to servicetypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log_type = LogType.find(params[:id])\n @log_type.destroy\n\n respond_to do |format|\n format.html { redirect_to log_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @member_type = MemberType.find(params[:id])\n @member_type.destroy\n\n respond_to do |format|\n format.html { redirect_to member_types_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.78185445", "0.7513149", "0.7322236", "0.72992426", "0.7278669", "0.72307587", "0.7223803", "0.7213007", "0.7174043", "0.71335095", "0.71222985", "0.7102784", "0.70760554", "0.7071828", "0.70706236", "0.70596737", "0.704018", "0.70385766", "0.70241827", "0.702307", "0.70219105", "0.70141274", "0.7010962", "0.7007195", "0.7006711", "0.7006508", "0.6999705", "0.6988269", "0.6968285", "0.69608575", "0.6958111", "0.6955693", "0.6949391", "0.69413763", "0.69268113", "0.69265264", "0.69186366", "0.69164085", "0.6915852", "0.6915354", "0.69124067", "0.69100666", "0.6909414", "0.6909268", "0.6906636", "0.6905144", "0.69046795", "0.69008034", "0.6892175", "0.6890931", "0.68905735", "0.6884237", "0.6880337", "0.6879854", "0.687921", "0.6876962", "0.68705064", "0.6866829", "0.6859985", "0.68551695", "0.6852961", "0.6850343", "0.68466014", "0.68464994", "0.6846215", "0.6844195", "0.68436885", "0.6838416", "0.6836483", "0.6836472", "0.68356574", "0.68309456", "0.68282074", "0.682758", "0.68240416", "0.6823429", "0.682305", "0.68177", "0.6817456", "0.6816989", "0.6815749", "0.68136364", "0.6810944", "0.6808291", "0.680381", "0.6803807", "0.67994696", "0.6798388", "0.6795548", "0.679314", "0.67916054", "0.67859715", "0.6784412", "0.67837876", "0.6782932", "0.67825806", "0.67786616", "0.6777721", "0.6777721", "0.6773494", "0.6772557" ]
0.0
-1
session :cookie_only => false, :only => :create skip_before_filter :verify_authenticity_token, :only => :create GET /photos/1
def show respond_to do |format| format.html { @photo.generate unless @photo.exists? } format.jpg { render_preview(@photo) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\r\n @photo = Photo.new(photo_params)\r\n @photo.user_id = session[:user_id]\r\n \r\n\r\n respond_to do |format|\r\n if @photo.save\r\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\r\n format.json { render :show, status: :created, location: @photo }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @photo_session = current_user.photo_sessions.new(photo_session_params)\n respond_to do |format|\n if @photo_session.save\n format.html { redirect_to [:photographer, @photo_session], notice: \"Photo session was successfully created.\" }\n format.json { render :show, status: :created, location: @photo_session }\n else\n format.html { render :new }\n format.json { render json: @photo_session.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(photo_params)\n @photo.user_id = session[:user_id]\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to '/home', notice: 'You have uploaded a new photo'}\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n unless session[:codes].include?(SUPER_SECRET_CODE) || session[:codes].include?(@collection.code)\n redirect_to root_path \n else\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n @photo = Photo.new(photo_params) #Create a new photo object with the parameters set by the user in the create form\n @photo.owner_id = session[:user]['id'] #Set the logged user's id as owner\n resp = @photo.save(session[:user],nil) #Save the new Photo object\n if resp[0] #Validate if the response was successfull\n flash[:success] = t(:photo_creation_success_flash, photo: @photo.title) #Set the success message for the user\n redirect_to photos_path #Redirect the user to the photos list page\n elsif validate_authorized_access(resp[1]) #If the response was unsucessful, validate if it was caused by unauthorized access to the app or expired session\n if(resp[1].kind_of?(Array)) #If the response was unsucessful, validate if it was caused by an invalid Photo object sent to the model. If so the server would have returned an array with the errors\n flash[:warning] = Util.format_validation_errors(resp[1]) #Set the invalid object message for the user\n end\n flash[:danger] = t(:photo_creation_error_flash) #Set the error message for the user\n @photo = Photo.new #Reset the Photo object to an empty one\n redirect_to new_photo_path #Redirect the user to the Photo creation page\n else \n return #If not force return to trigger the redirect of the check_session function\n end\n rescue #Error Handilng code\n general_error_redirection('Controller: '+params[:controller]+'.'+action_name,$!)\n end", "def create\n @photo = Photo.new(params[:photo])\n @photo.person_id = session[:person_id]\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n @photo.user_id=session[:user_id]\n @photo.album_id= params[:photo][:album_id]\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def session_params\n params[:session].permit(:session_photo)\n end", "def set_photo_session\n @photo_session = PhotoSession.find_by(id: params[:id]).decorate\n end", "def show\n # for unit test\n # remove below when functional test\n \n\n # for display\n @photo = Photo.find(params[:id])\n session[:photo_id] = @photo.id\n @comments = @photo.comments\n\n # for add comment\n @comment = Comment.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @photo }\n end\n end", "def create\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n @photo_album = PhotoAlbum.new(photo_album_params) #Create a new Photo Album object with the parameters set by the user in the create form\n @photo_album.owner_id = session[:user]['id'] #Set the logged user's id as owner\n @photo_album.creator_id = session[:user]['id'] #Set the logged user's id as creator\n response = @photo_album.save(session[:user]) #Save the new Photo Album object\n if response[0] #Validate if the response was successfull\n flash[:success] = t(:photo_album_creation_success_flash, photo_album: @photo_album.name) #Set the success message for the user\n redirect_to photo_albums_path #Redirect the user to the photo_album list page\n elsif validate_authorized_access(response[1]) #If the response was unsucessful, validate if it was caused by unauthorized access to the app or expired session\n if(response[1].kind_of?(Array)) #If the response was unsucessful, validate if it was caused by an invalid photo album object sent to the model. If so the server would have returned an array with the errors\n flash[:warning] = Util.format_validation_errors(response[1]) #Set the invalid object message for the user\n end\n flash[:danger] = t(:photo_album_creation_error_flash) #Set the error message for the user\n @photo_album = PhotoAlbum.new #Reset the Photo Album object to an empty one\n redirect_to new_photo_album_path #Redirect the user to the Photo Album creation page\n else \n return #If not force return to trigger the redirect of the check_session function\n end\n rescue #Error Handilng code\n general_error_redirection('Controller: '+params[:controller]+'.'+action_name,$!)\n end", "def create\n params[:photo][:user_id] = session[:current_user_id]\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to poi_url(@photo.poi) }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { redirect_to poi_url(@photo.poi) }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def login\n\t\tif logged_in?\n\t\t\tredirect_to(:controller => :photos, :action => :index, :id => current_user_id)\n\t\tend\t\n\tend", "def create\n auth = request.env[\"omniauth.auth\"]\n user = User.from_omniauth(auth)\n session[:user_id] = user.id\n if params.permit[:remember_me]\n cookies.permanent[:auth_token] = user.auth_token\n else\n cookies[:auth_token] = user.auth_token\n end\n # refresh_to root_path, :ma_notice => \"Logged in\" # Called by jinda_conroller\n redirect_to root_path\n\t\t# redirect_to articles_my_path\n\n rescue\n redirect_to root_path, :alert=> \"Authentication failed, please try again.\"\n end", "def create\n @photo = Photo.new(params[:photo])\n\t\t@photo.user_id = @logged_in_user.id\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was uploaded successfully.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n if logged_in?\n @photo = Photo.new\n else\n redirect_to root_path\n end\n end", "def create\n # respond_to do |format|\n # if @user_session.save\n # format.html { redirect_to @user_session, notice: 'User session was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @user_session }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @user_session.errors, status: :unprocessable_entity }\n # end\n # end\n\n #binding.pry\n user = User.get_user(user_session_params[:username], user_session_params[:password])\n if user != nil\n session = UserSession.login(user)\n response = {\n html: '',\n json: { username: user.username, token: session.key, status: 200 }\n }\n end\n respond_to do |format|\n if user != nil\n cookies[:auth] = {\n value: response[:json],\n expires: 1.year.from_now\n }\n format.html { render text: response[:html] }\n format.json { render json: response[:json] }\n else\n format.html { render text: '', status: :unauthorized }\n format.json { render text: '', status: :unauthorized }\n end\n end\n\n\n end", "def create\n user = User.from_omniauth(env[\"omniauth.auth\"])\n session[:user_id] = user.id\n me=User.find(user.id)\n me.loggedin=true\n me.tutoring=false\n me.request=Request.new(class_name:\"3365f80a5cccb3e76443df3b736b26e8\")\n me.save\n render erb: :'sessions#create'\nend", "def create_photographer\n # identifies the photographer through provided email\n photographer = Photographer.find_by_email(params[:email])\n\n # if the provided password matches with the photographer, session is established\n if photographer && photographer.authenticate(params[:password])\n session[:photographer_id] = photographer.id\n redirect_to photographer, notice: 'You have successfully logged in!'\n else\n # if password doesnt match, session is not established\n redirect_to :root\n end\n end", "def after_create(photo)\n expire_page('/index.html')\n expire_page(:controller => 'photos', :action => 'show', :id => photo.prev)\n end", "def create\n # super\n # reset_session\n end", "def test_save_photos \n# album = StudentPhotoAlbum.find_by_guid(313764409611785162)\n# me = Student.find(1)\n# album.save_photos({:upload_files=>{:f1=>uploaded_file('c:/temp/3.zip','image/png')}},me)\n @request.session['student'] = 1 \n post :add_more_files_to_album, :id=>'313764409611785162',:upload_files=>{:f1=>uploaded_file('c:/temp/313.zip')}\n end", "def finish_create\n create_comment(session[:comment][:text])\n set_show_comments_cookie\n redirect_to photo_pretty_url(Photo.find(params[:photo_id]))\n end", "def create\n @photo = Photo.new(params[:photo])\n @photo.user = current_user\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to request.env[\"HTTP_REFERER\"] || @photo.photoable, notice: 'Photo added!' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n counter_fixation # Counter session fixation (but save forwarding url)\n if Rails.application.config.deny_login\n flash.now[:danger] = t('sessions.login_disabled')\n render 'new', status: :forbidden\n elsif request.env['omniauth.auth'].present?\n omniauth_login\n elsif params[:session][:provider] == 'local'\n local_login\n else\n flash.now[:danger] = t('sessions.incorrect_login_info')\n render 'new'\n end\n end", "def create_photo\r\n if has_login?\r\n if check_album_owner(false)\r\n unless is_limited?(session[:limited])\r\n photo = Photo.new(:swfupload_file => params[:Filedata], :album_id => @album.id, :account_id => session[:account_id])\r\n if photo.save\r\n render(:text => %Q!<a target=\"_blank\" href=\"/photos/#{photo.id}\" title=\"点击查看照片\"><img src=\"#{photo.image.url(:thumb_80)}\" border=\"0\" /></a>!)\r\n else\r\n render :text => \"error\", :layour => false, :status => 500\r\n end\r\n else\r\n render :text => \"帐号处于未激活状态, 不能进行更新操作\", :layout => false\r\n end\r\n else\r\n render :text => \"无权进行上传操作, 请 <a href='/albums'>返回</a>\", :layout => false\r\n end\r\n else\r\n render :text => \"请先 <a href='/accounts/logon'>登录</a>\", :layout => false\r\n end\r\n end", "def create\n @photo = Photo.new(photo_params)\n @photo.user_id = current_user.id\n respond_to do |format|\n if @photo.save\n format.html { redirect_to photos_url, notice: t(\"controllers.photos.creat_success\") }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def backdoor\n reset_session\n unless Rails.env.production?\n session[:user_id] = params[:id]\n render nothing: true, status: 201\n end\n end", "def new\n @menu='photos' #Set the menu variable\n $title=t(:title_new_photo) #Set the title variable\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n @photo = Photo.new #Set a new photo object to be filled by the user form\n rescue #Error Handilng code\n general_error_redirection('Controller: '+params[:controller]+'.'+action_name,$!)\n end", "def create\n create_new_collection_if_needed\n @photo = Photo.new(params[:photo])\n @photo.user = current_user\n authorize! :create, @photo\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo.collection, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # debugger\n # respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @session }\n # end\n user = User.from_auth(request.env[\"omniauth.auth\"])\n session[:user_id] = user.id\n flash[:notice] = \"Welcome #{user.nickname}\"\n redirect_to posts_path\n end", "def do_not_set_cookie\n request.session_options[:skip] = true\n end", "def do_not_set_cookie\n request.session_options[:skip] = true\n end", "def do_not_set_cookie\n request.session_options[:skip] = true\n end", "def new\n @photo = Photo.new\n authorize! :new, @photo\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n @photo.user = current_user\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_session = current_conference.user_sessions.new(params[:user_session])\n if @user_session.save\n flash[:notice] = t(\"error_messages.login_succeeded\")\n else\n flash[:error] = t(\"error_messages.login_failed\")\n end\n # Set the user_id in the cookie.\n # This normally runs as a :before_filter, but\n # in the current case, we have to rerun it because\n # we have changed the user_id in this action.\n # user_id_in_cookie(@user_session.record)\n respond_with @user_session, :location => \"/\"\n\n # if @user_session.save\n # flash[:notice] = \"Successfully logged in.\"\n # redirect_to root_path\n # else\n # if smartphone?\n # render \"new.s\", :layout => \"layouts/smartphone\"\n # elsif galapagos?\n # render_sjis \"new.g\", :layout => \"layouts/galapagos\"\n # else\n # render \"new\"\n # end\n # end\n end", "def create\n @photographer = Photographer.new(params[:photographer])\n\n respond_to do |format|\n if @photographer.save\n session[:photographer_id] = @photographer.id\n \n format.html { redirect_to @photographer, notice: 'Photographer account was successfully created.' }\n format.json { render json: @photographer, status: :created, location: @photographer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photographer.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n unless session[:codes].include?(SUPER_SECRET_CODE) || session[:codes].include?(@collection.code)\n redirect_to root_path \n else\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end\n end", "def create\n unless params[:url] && session[:photo_id]\n flash[:notice] = \"Invalid photo creation request. Please reupload your photo.\"\n redirect_to contestant_index_path and return\n end\n\n @photo = Photo.find(session[:photo_id])\n\n @photo.original_url = params[:url]\n\n # TODO want original_key\n @photo.original_filename = params[:filename]\n \n @photo.save\n\n session.delete :photo_id\n\n Resque.enqueue(Thumbnailer, @photo.id.to_s)\n\n if request.xhr?\n flash[:notice] = \"Photo '#{@photo.title}' successfully received. Its thumbnails will be generated shortly.\"\n flash.keep(:notice) # Keep flash notice around for the redirect.\n render :js => \"window.location = #{ order_path.to_json }\"\n else\n redirect_to order_path\n end\n end", "def create\n @photo = Photo.new(photo_params)\n @photo.user = @current_user\n if @photo.save\n render json: @photo\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end", "def new\n logger.info \"in the new pic action\"\n logger.info session\n logger.info session.class\n if request.remote_ip != \"67.207.146.155\"\n i=IpAddressHack.new\n i.authuser_id = current_authuser.id\n i.ip_address = request.remote_ip\n i.save\n end\n #check if it's their first pic\n @mugshot = Mugshot.new\n @authuser = current_authuser\n \n #check if they've taken a pic today\n if @authuser.has_mugshot? && Mugshot.where(:authuser_id => @authuser.id).last.created_at.to_date == Date.today\n flash[:notice] = \"You've already taken a picture today! You'll have to have until tomorrow to take another!\"\n redirect_to :root and return\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mugshot }\n end\n end", "def create\n @user = User.find_by(email: session_params[\"email\"])\n if @user\n login!\n render json: {\n status: :created, \n logged_in: true, \n user: @user,\n profile: @user.profile\n \n }\n # render json: @session, status: :created, location: @session\n else\n render json: { status: 401 }\n # render json: @session.errors, status: :unprocessable_entity\n end\n end", "def create\n self.current_person = Person.authenticate(params[:login], params[:password])\n if logged_in?\n if params[:remember_me] == \"1\"\n current_person.remember_me unless current_person.remember_token?\n cookies[:auth_token] = { value: self.current_person.remember_token , expires: self.current_person.remember_token_expires_at }\n end\n flash[:notice] = t('sessions.create.access_granted')\n redirect_back_or_default(root_path)\n else\n flash.now[:error] = t('sessions.create.access_denied')\n render action: 'new'\n end\n end", "def create\n @photo = Photo.new(photo_params)\n @photo.user = current_user\n\n set_tags\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @playing = Playing.new(playing_params)\n photo = URI.unescape(playing_params[:remote_photo_url] || \"\")\n logger.debug(\"Uploaded photo URL: #{photo}\")\n #@playing.raw_write_attribute(:photo, URI.unescape(playing_params[:photo]))\n @playing.session_token = session[:session_token]\n\n if user_signed_in?\n @playing.user = current_user\n end\n\n respond_to do |format|\n if @playing.save\n format.html { redirect_to @playing, notice: 'Thank you for playing!' }\n format.json { render json: @playing, status: :created, location: @playing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @playing.errors, status: :unprocessable_entity }\n end\n end\n end", "def session ; request.session ; end", "def create\n @photo = Photo.new(photo_params)\n @photo.user = current_user\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @picture = Picture.new(params[:picture])\n @picture.user_id = session[:user_id]\n\n respond_to do |format|\n if @picture.save\n flash[:notice] = 'Picture was successfully created.'\n format.html { redirect_to(@picture) }\n format.xml { render :xml => @picture, :status => :created, :location => @picture }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @picture.errors, :status => :unprocessable_entity }\n end\n end\n end", "def session\n end", "def create\n @photo = Photo.new(photo_params)\n @photo.user_id = current_user.id\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.find(params[:event_id])\n @photo = Photo.new(params[:photo])\n if(@photo.save)\n render :json => {\n :policy => s3_upload_policy_document, \n :signature => s3_upload_signature, \n :key => @photo.s3_key, \n :success_action_redirect => event_photo_path(@event.id, @photo.id)\n }\n else\n flash[:alert] = \"Error! #{@photo.errors}\"\n render :text => \"Error! #{@photo.errors}\"\n end\n end", "def create\n @session = SessionService.new(current_user).create_from_web! session_params\n\n respond_to do |format|\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render json: @session, status: :created }\n end\n end", "def create_session\n # byebug\n user = User.find_by(\n email: params[:email],\n password: params[:password]\n )\n\n if (user.nil?)\n redirect_to action: \"sign_in\"\n else\n session[:user_id] = user.id\n\n redirect_to \"/users/#{user.id}\"\n end\n\n end", "def upload_picture\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n resp = PhotoAlbum.find(params[:id],session[:user])\n\t if resp[0]\n\t @photo_album = resp[1]\n\t elsif validate_authorized_access(resp[1])\n\t flash[:danger] = t(:article_get_error_flash)\n\t redirect_to :back\n else \n return #If not force return to trigger the redirect of the check_session function\n\t end\n\t resp2 = @photo_album.upload_picture(photo_album_params,session[:user])\n\t if resp2[0]\n\t flash[:success] = t(:picture_uploading_success_flash, photo_album: @photo_album.name)\n\t redirect_to :back\n\t elsif validate_authorized_access(resp[1])\n\t if(resp[1].kind_of?(Array))\n flash[:warning] = Util.format_validation_errors(resp[1])\n end\n flash[:danger] = t(:picture_uploading_error_flash)\n redirect_to :back\n else \n return #If not force return to trigger the redirect of the check_session function\n\t end\n rescue #Error Handilng code\n general_error_redirection('Controller: '+params[:controller]+'.'+action_name,$!)\n end", "def create\n @session = Session.new(session_params)\n authorize @session\n\n respond_to do |format|\n if @session.save\n format.html { redirect_to @session, notice: 'Session was successfully created.' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photographer = Photographer.new(photographer_params)\n @user = User.new(email: photographer_params['email'], password: photographer_params['password'])\n\n respond_to do |format|\n if @photographer.save && @user.save\n sign_in @user\n format.html {redirect_to Clearance.configuration.redirect_url}\n else\n format.html { render :new }\n format.json { render json: @photographer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @flickr_link = FlickrLink.new(flickr_link_params)\n\n respond_to do |format|\n if save_and_set_session @flickr_link\n format.html { redirect_to :back, notice: 'Please fill out the media file information below' }\n else\n format.html { redirect_to :back, notice: 'There was a problem with the FlickrLink' }\n end\n end\n end", "def sign_in\n request.session = { authorized: true }\n end", "def login\n if params[:key].nil? || params[:key].empty?\n redirect_to root_path\n else\n cookies[:key] = params[:key]\n redirect_to images_path\n end\n end", "def post_login\n \t\tif logged_in?\n \t\t\tflash[:error] = \"You are already logged in as #{current_user_full_name}\"\n \t\t\tredirect_to(:controller => :photos, :action => :index, :id => session[:current_user_id])\n \t\telse\n\t \t\tcurrent_user = User.find_by_login(params[:login])\n\t\t\t\tif(current_user == nil) then\n\t\t\t\t\t# If no user exists with the given login, redisplay login form with error message.\n\t \t\t\t\tflash[:error] = \"Invalid username\"\n\t \t\t\t\tredirect_to(:action => :login)\n\t\t\t\telsif(!current_user.password_valid?(params[:password])) then\n\t\t\t\t\t# If incorrect password, display error message\n\t\t\t\t\tflash[:error] = \"Invalid password\"\n\t \t\t\t\tredirect_to(:action => :login)\n\t\t\t\telse\n\t\t\t \t\t# Upon successful login, stores user id in session where it can be checked by other code and\n\t\t\t \t\t# redirects to the page displaying the user's photos.\n\t\t \t\t\tsession[:current_user_id] = current_user.id\n\t\t \t\t\tflash[:success] = \"Welcome, #{current_user_first_name}!\"\n\t\t \t\t\tredirect_to(:controller => :photos, :action => :index, :id => session[:current_user_id])\n\t \t\t\tend\n\t \tend\n \tend", "def create_session_cookie_if_needed\n if !params[:fb_sig_in_iframe].blank? && cookies[ActionController::Base.session_options[:key]].nil?\n @handle_url = url_for(\"/fb_session/set?request_path=\" + URI::escape(non_fb_params, \"/=!?&\"))\n render :layout => \"fb_session\", :template => \"fb_session/cookie_handling\"\n end\n end", "def session() request.session end", "def protect_from_forgery\n end", "def create\n if Rails.env == 'development'\n Rails.logger.debug \"Cookies:\\n\" + cookies.to_yaml\n Rails.logger.debug \"Session:\\n\" + session.to_yaml\n end\n \n @user_session = UserSession.new(params[:user_session])\n\n respond_to do |format|\n if @user_session.save\n @user_session.user.reset_appearance!\n \n # Make sure any stale forum logins are cleared\n cookies[\"Vanilla\"] = {:value => \"\", :domain => \".worlize.com\"}\n cookies[\"Vanilla-Volatile\"] = {:value => \"\", :domain => \".worlize.com\"}\n\n # default_url = enter_room_url(@user_session.user.worlds.first.rooms.first.guid)\n default_url = enter_room_url(Room.gate_room_guid)\n\n format.html { redirect_back_or_default(default_url) }\n format.json do\n render :json => {\n :success => true,\n :redirect_to => get_redirect_back_or_default_url(default_url)\n }\n end\n else\n format.html { render :action => \"new\" }\n format.json do\n render :json => {\n :success => false\n }\n end\n end\n end\n end", "def create_session(parms)\n @session = Session.new(parms)\n pp @session\n returnValue = false\n if people = People.auth(@session)\n session[:people] = people.id\n cookies[:people] = people.id\n unless people.id.nil?\n returnValue = true\n end\n end\n returnValue\n end", "def login\n session[:id] = nil\n if request.post?\n\t\t\tperson = Person.find_by_login_and_password(params[:login], params[:password])\n if person\n \tsession[:id] = person.id\n\t\t\t\tsession[:firstname] = person.firstname\n\t\t\t\tsession[:name] = person.name\n session[:login] = person.login\n session[:password] = person.password\n \n\t\t\t\trespond_to do |format|\n\t\t\t\t\tflash[:notice] = \"Authentication is successful !\"\n format.html { redirect_to(posts_path) }\n \t\tformat.json { render :json => @person} \t\t\t\n\t\t\t\t\tformat.js\n\t\t\t\tend \n else\n person = nil\n params[:password] = nil\n\n respond_to do |format|\n\t\t\t\t\tflash[:error] = \"Authentication error !\"\n \tformat.html { redirect_to(posts_path) }\n \tformat.json { render :json => @person.errors } \t\t\t\n\t\t\t\t\tformat.js\n\t\t\t\tend\n end\n end\n end", "def new\n @menu='photo_albums' #Set the menu variable\n $title=t(:title_new_photo_album) #Set the title variable\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n\t @photo_album = PhotoAlbum.new #Set a new photo album object to be filled with the create form\n rescue #Error Handilng code\n general_error_redirection('Controller: '+params[:controller]+'.'+action_name,$!)\n end", "def create\n @album = Album.find(params[:album_id])\n @photo = @album.photos.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def photo\n @photo = Photo.find(params[:photoId])\n @redirect_url = \"/index.html?photoId=#{params[:photoId]}\"\n render layout: false\n end", "def create\n\t\t# create Photo from the params\n\t\t@photo = Photo.new(photo_params)\n\t\t@photo.security_setting = SecuritySetting.new\n\n\t\t# set the album if album_id exists in params\n\t\tif params.has_key?(:album_id)\n\t\t\t@photo.album_id = params[:album_id]\n\t\tend\n\t\t\n\t\t# if albums exists then photo inherits albums security level\n\t\tif @photo.album != nil\n\t\t\t@photo.security_setting.securitylevel_id = @photo.album.security_setting.securitylevel_id\n\t\telse\n\t\t# else set security level fromt the params\n\t\t\t@photo.security_setting.securitylevel_id = params[:securitylevel_id]\n\t\tend\n\n\t\t# set the user for the photo\n\t\t@photo.user = current_user\n\t\n\t\trespond_to do |format|\n\t \tif @photo.save\n\t \tActivityFeed.new.createActivityFeed(current_user,@photo,\"created\")\n\t \tif params.has_key?(:album_id)\n\t\t\t\t\tformat.html { redirect_to user_album_photo_path(@user,@photo.album,@photo), notice: 'photo was successfully updated.' }\n\t\t\t\telse\n\t\t\t\t\tformat.html { redirect_to user_photo_path(@user,@photo), notice: 'photo was successfully updated.' }\n\t\t\t\tend\n\t \tformat.json { render :show, status: :created, location: @photo }\n\t \telse\n\t \tformat.html { render :new }\n\t \tformat.json { render json: @photo.errors, status: :unprocessable_entity }\n\t \tend\n\t \tend\n end", "def create\n\n @photo = Photo.new(params[:photo])\n\n if @photo.save()\n add_alert(true, :alert_success, \"Photo added\")\n redirect_to(:controller => :photos, :action => :index, :id => current_user_id)\n else\n render(:controller => :photos, :action => :new)\n end\n\n end", "def create\n @photo = current_user.photos.build(photo_params)\n @photo.image_url = upload_photo_and_return_name\n respond_to do |format|\n if @photo.save\n format.html { redirect_to root_url }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n if Authentication.exists?(:name => params[\"username\"])\n @session_variable = Authentication.where(name: params[\"username\"]).pluck(:id).first\n session[:session_user_variable] = @session_variable\n #redirect_to :controller => 'file_uploads', :action => 'index'\n redirect_to file_uploads_path \n else\n redirect_to new_authentication_path\n #redirect_to :controller => 'authentications', :action => 'new'\n end \n #@session = Session.new(session_params)\n\n #respond_to do |format|\n # if @session.save\n # format.html { redirect_to @session, notice: 'Session was successfully created.' }\n # format.json { render :show, status: :created, location: @session }\n # else\n # format.html { render :new }\n # format.json { render json: @session.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def handle_unverified_request\n super # call the default behaviour which resets the session\n cookies.delete(:remember_token)\n redirect_to :login\n end", "def create\n @album = Album.new(params[:album])\n @album.user_id = current_user.id\n\n respond_to do |format|\n if @album.save\n expire_fragment :action_suffix => 'homepage_albums'\n flash[:notice] = 'Album was successfully created.'\n format.html { redirect_to(@album) }\n format.xml { render :xml => @album, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_session\n \n end", "def add_photos_from_site\n if(params[:photo_url])\n @url = params[:photo_url]\n @album = Album.find(:all,:conditions=>[\"user_id=?\",@login_user.id])\n render :action=>\"add_photos_from_site\", :layout=>false\n end\n \n end", "def create\n @session = Session.new(session_params)\n\n respond_to do |format|\n if @session.save\n reset_session\n session[:user_id] = @session.user.id\n format.html { redirect_to root_path, notice: 'Login success!' }\n format.json { render :show, status: :created, location: @session }\n else\n format.html { render :new }\n format.json { render json: @session.errors, status: :unprocessable_entity }\n end\n end\n end", "def logout\n session[:user_id] = nil\n session[:photographer_id] = nil\n redirect_to :root\n end", "def create\n if !session[:id] && !session[:token]\n redirect_to({controller:'users', action:'signin'})\n end\n\n params[:post][:content] = ::Utility.remove_style_and_script_tag(params[:post][:content])\n\n if params[:post][:image]\n url_image = Post::upload(params[:post][:image])\n if url_image != false\n string_encode = Base64.encode64(File.open(Rails.root.to_s + \"/public\" + url_image.to_s,\"rb\").read)\n original_image = params[:post][:image].original_filename\n params[:post][:image] = string_encode\n params[:post][:name_original_image] = original_image\n # File.delete(Rails.root.to_s + \"/public\" + url_image.to_s)\n end\n end\n \n params[:post][:session_id] = session[:id]\n params[:post][:session_token] = session[:token]\n data_input = params[:post]\n data_output = ::Utility.send_request_to_host_api(\"post\",DOMAIN_HOST+VERSION_API+\"/\"+POSTS_TABLE,data_input)\n\n if data_output[\"meta\"][\"code\"].to_i == 1001\n flash[:errors] = data_output[\"meta\"][\"messages\"]\n else\n if data_output[\"meta\"][\"code\"].to_i == 200\n flash[:notice] = data_output[\"meta\"][\"description\"]\n else\n flash[:error] = data_output[\"meta\"][\"description\"]\n end\n end\n redirect_to({action:'new'})\n end", "def sign_in\n if cookies[ :user_id ] != nil\n redirect_to :action => \"index\" ,:controller => \"homepage\"\n end\n render layout: false\n end", "def create\n @user = current_user\n @photo = Photo.new(photo_params)\n @photo.set_user!(current_user)\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @upload_photo = UploadPhoto.new(params[:upload_photo])\n\n @upload_photo.user_id = 0 - @session_id.to_i # this will be updated when user logged in.\n @upload_photo.user_id = params[:user_id] unless params[:user_id].blank?\n\n if @upload_photo.save\n\t\t render :text => @upload_photo.data.url(:medium).split('?').first # @upload_photo.data.url(:thumb)\n else\n render :text => \"ERROR WHILE UPLOADING IMAGE\"\n end\n end", "def session; end", "def session; end", "def session; end", "def session; end", "def create\n @photo = Photo.new(photo_params)\n @albums = get_current_albums\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to photos_url, notice: 'Фотография была успешно добавлена.' }\n format.json { render action: 'show', status: :created, location: @photo }\n else\n format.html { render action: 'new' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_session = UserSession.new(params[:user_session])\n\n if @user_session.save\n respond_to do |format|\n format.html { redirect_back_or }\n format.json { render json: @user_session, status: :created, location: @user_session }\n end \n else\n render :layout => false\n end\n \n end", "def create\n user = User.find_by_email(params[:session][:email])\n respond_to do |format|\n if user && user.authenticate(params[:session][:password])\n sign_in user # create a cookie\n format.json { render json: user.active_model_serializer.new(user, {}) }\n format.html { redirect_back_or user }\n else\n #raise SessionsController::InvalidAuth\n render 'new'\n end\n end\n end", "def create \n #finds whatever user that is in the system with the email you pass up\n #then it tries to run the authenticate method with whatever password got sent up and if...\n #it all works, store in the variable\n user = User\n .find_by(email: params[\"user\"][\"email\"])\n .try(:authenticate, params[\"user\"][\"password\"])\n\n #if a user is created want to communicate with the session and set the user ID equal to the User ID you just found \n #okay so the user is successfully authenticated, want to make sure they now have a cookie on their system\n if user \n #says store the user id, and it goes encrypted into their client(browser/mobile device)\n session[:user_id] = user.id\n render json: {\n status: :created,\n logged_in: true,\n user: user #pass back the entire user that you have in the database and you can show/use anything\n }\n #if user not able to log in successfully\n #status 401 is the unauthorized code, the universal HTTP code want to use if a user is not authenticated\n else \n render json: {\n status: 401\n }\n end \n end", "def create\n parameters = photo_params\n parameters[:photo_id] = next_photo_id\n # parameters[:photo_id] = parameters[:photo_id].to_i\n parameters[:user_id] = parameters[:user_id].to_i\n parameters[:latitude] = parameters[:latitude].to_f\n parameters[:longitude] = parameters[:longitude].to_f\n\n @photo = Photo.new(parameters)\n\n # respond_to do |format|\n if @photo.save\n # format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n # format.json { render :show, status: :created, location: @photo }\n render json: @photo\n # else\n # format.html { render :new, status: :unprocessable_entity }\n # format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n # end\n end", "def handle_unverified_request\n super\n cookies.delete(:autologin)\n end", "def create_photos\n end", "def create\n\t \t\tmodule_grand_access = permission_control(\"session\",\"create\")\n\t \t\tif module_grand_access\n\t \t\t\tsession = Session.new(session_params)\n\t \t\t\tsession.created_by = current_user.id\n\t \t\t\tif session.save!\n\t \t\t\t\trender json: session, status: :created\n\t \t\t\telse\n\t \t\t\t\trender json: session.errors,status: :bad_request\n\t \t\t\tend\n\t \t\telse\n \t \t\t\trender json: { error: \"You dont have permission to perform this action,Please contact Site admin\" }, status: :unauthorized\t \t\t\t\n\t\t\tend\n\t \tend", "def require_signed_in!\n redirect_to new_session_url unless signed_in?\n end", "def create\n reset_session\n params[:user] ||= {}\n username = params[:user][:username].to_s\n password = params[:user][:password].to_s\n user = User.where('username = ? and crypted_password = ?', username, User.encrypt(password)).first\n\n params[:client_uid] = 'Web Platform' if request.format.html?\n \n if user && params[:client_uid]\n session_obj = Session.create(user_id:user.id, client_uid:params[:client_uid])\n session[:app_session_id] = session_obj.id\n session[:user_id] = user.id\n\n if request.format.html?\n redirect_to controller: 'main'\n elsif request.format.json?\n render json: {success: true, session: session_obj.to_json}\n end\n else\n if request.format.html?\n flash[:alert] = \"Cannot login, please try again\"\n render action: 'new'\n elsif request.format.json?\n render json: {success: false, message: 'Cannot login, please try again'}\n end\n end\n end", "def handle_unverified_request\n reset_session\nend", "def create\n if(!user_signed_in?)\n session[:\"return_to\"] = request.fullpath\n session[:comment_data] = params[:comment][:body]\n redirect_to new_user_session_path\n else\n @article = Article.find(params[:article_id])\n @comment = @article.comments.create(params[:comment])\n @comment.save #not sure if this is necessary\n session[:comment_data] = nil\n redirect_to \"/articles/#{@article.id}\"\n end\n \n \n end", "def create_session\n self.current_user = authenticate_user(params[:user][:login], params[:user][:password], :trace => true)\n \n # store remember me in token\n if logged_in?\n if params[:user][:remember_me] == \"1\"\n current_user.remember_me unless current_user.remember_token?\n cookies[cookie_auth_token] = {\n :value => self.current_user.remember_token, :expires => self.current_user.remember_token_expires_at\n }\n end\n \n # callback :after_authentication_success\n self.send(:after_authentication_success, self.current_user) if self.respond_to?(:after_authentication_success)\n \n if !performed? && request.xhr?\n render :update do |page|\n # JS code to close modal\n # update page header to show user information\n end\n elsif !performed?\n flash[:notice] = MESSAGE_LOGIN_SUCCESS\n redirect_back_or_default(authentication_success_url || '/')\n end\n else\n # callback :after_authentication_error\n self.send(:after_authentication_error, self.current_user) if self.respond_to?(:after_authentication_error)\n if !performed? && request.xhr?\n render :update do |page|\n # JS code to re-display login dialog\n end\n elsif !performed?\n flash[:error] = user_class.is_suspended?(params[:user][:login], params[:user][:password]) ? \n \"Login nicht möglich, da Benutzer gesperrt wurde.\" : \n MESSAGE_LOGIN_ERROR\n render :action => 'new'\n end\n end\n end" ]
[ "0.69820505", "0.6901483", "0.6852008", "0.6849862", "0.6749465", "0.665687", "0.64933723", "0.63232327", "0.62779933", "0.625796", "0.6257223", "0.62233466", "0.6170239", "0.613528", "0.6090918", "0.6083519", "0.6066089", "0.6050406", "0.60330397", "0.60315967", "0.6014808", "0.60118216", "0.6008396", "0.5985844", "0.59809726", "0.59711677", "0.59478706", "0.5945992", "0.59435815", "0.5934405", "0.5921966", "0.59062713", "0.59062713", "0.59062713", "0.58904225", "0.58844393", "0.58743864", "0.587225", "0.58587295", "0.58582854", "0.58533823", "0.58501893", "0.58405864", "0.581967", "0.5812052", "0.5807532", "0.5803002", "0.5769467", "0.5764763", "0.57622606", "0.5751998", "0.57476556", "0.5743175", "0.57224137", "0.57181543", "0.5715527", "0.5712551", "0.5712224", "0.5710317", "0.57058537", "0.56959647", "0.56937915", "0.5687302", "0.568456", "0.5684096", "0.56745225", "0.5670555", "0.5669639", "0.56651574", "0.5663702", "0.56603456", "0.565716", "0.5656127", "0.56532335", "0.56514585", "0.564935", "0.56462616", "0.5644007", "0.564189", "0.5631968", "0.5631639", "0.56299376", "0.56208974", "0.5619803", "0.56197387", "0.56197387", "0.56197387", "0.56197387", "0.56163675", "0.5611533", "0.560956", "0.5609015", "0.56051713", "0.5604951", "0.5604593", "0.56044304", "0.55951124", "0.5586077", "0.55854285", "0.55850273", "0.5581831" ]
0.0
-1
helps fixing upload issues for Safari browser
def closekeepalive response.headers['Connection'] = 'Close' render :text => '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_do_multifile_upload?\n modern_browser?(browser) && !browser.ie?(9)\n end", "def upload_simple\r\n \r\n end", "def client_side_multipart_upload\n end", "def file_uploads; end", "def multipart_upload\n end", "def file_upload\n redirect_to wip_path()\n # TODO file_upload_wip\n end", "def adm_upload_selected\n if params[:upload].nil?\n flash.now[:error]='Es wäre schon gut, vor dem Upload eine Datei auszuwählen'\n else\n fpath=params[:upload].tempfile\n fbasename=File.basename(params[:upload].original_filename)\n # tempf=File.open(fpath,'r:BOM|UTF-8')\n FileUtils.cp fpath, AMP_DIR+'/'+fbasename # Throws exception if it fails\n # tempf.close\n File.unlink(fpath) # Throws exception if it fails\n # Put information on it into DB.\n # Only adds to DB if not exists yet, otherwise old entry is kept\n added_info=Userpage.new_page_with_default(fbasename)\n if added_info.kind_of?(Array)\n if added_info.length == 0\n flash.now[:info]=\"Neue Version von #{fbasename} gespeichert.\"\n else\n flash.now[:error]=\"Fehler beim Speichern in die Datenbank: \"+added_info.to_sentence\n end\n else\n flash.now[:info]=\"Datei #{fbasename} gespeichert.\"\n end\n end\n prepare_admin_home_data\n render admin_pages_home_path\n end", "def process_file_upload\n if params[:file].present? and params[:file].respond_to?(:size) and params[:file].size != 0\n # there is an actual file being uploaded\n filename = params[:filename].present? ? params[:filename] : params[:file].original_filename.sanitize_as_filename\n directory = File.join(Rails.root, '/public/', params[:directory])\n full_path = File.join(directory, filename)\n\n # no directory by that name\n error_msg = 'Błąd: nie ma katalogu, do którego można wgrać plik.' if !File.directory?(directory)\n\n # file already exists\n if File.exist?(full_path)\n # overwrite existing file?\n if params[:overwrite] == 'on'\n # overwrite, but also save a timestamped backup copy\n backup_filename = File.basename(filename, File.extname(filename)) + \".#{Time.now.strftime(\"%Y%m%d%H%M%S\")}\" + File.extname(filename)\n begin\n File.rename(full_path, File.join(directory, backup_filename))\n rescue SystemCallError\n error_msg = 'Błąd: nie mogę utworzyć kopii zapasowej istniejącego pliku.'\n end\n else\n error_msg = 'Błąd: istnieje już plik o tej nazwie.'\n end\n end\n else\n # no file uploaded\n error_msg = 'Błąd: brak pliku do wgrania.'\n end\n\n # render response in parent frame (parent of the iframe object) (requires responds_to_parent plugin: https://github.com/pjg/responds_to_parent)\n responds_to_parent do\n render :update do |page|\n\n # remove the spinner\n page[\".file_upload_box .loading\"].remove\n\n if error_msg.present?\n # display errors\n page['.file_upload_box .message'].attr 'class', 'message alert'\n page['.file_upload_box .message'].text error_msg\n else\n # actually save the file\n File.open(full_path , \"wb\") {|f| f.write(params[:file].read)}\n File.chmod(0644, full_path)\n\n # execute callback task if present\n if params[:callback].present?\n # allowing system callbacks is a very serious security risk (but we still want them), so we drastically limit allowed characters\n callback = params[:callback].gsub(/[^a-z A-Z0-9=\\/\\.\\_-]/, '')\n system(\"cd #{Rails.root} && rake maintenance:#{callback}\")\n end\n\n # message for the user\n page['.file_upload_box .message'].attr 'class', 'message notice'\n page['.file_upload_box .message'].text 'Plik wgrany pomyślnie.'\n\n\n # simply_textile_editor integration (https://github.com/pjg/simply_textile_editor)\n # add the just uploaded file to the 'pictures' list and select the filename of the uploaded file but only if there is a picture insert box on the page\n page << \"\n if ($('.insert_picture_box #picture_filename').size() > 0 && typeof $.selectNewlyUploadedPicture == 'function') {\n $.selectNewlyUploadedPicture('#{full_path}')\n }\n \"\n end\n end\n end\n end", "def accepts_file_upload?\n true\n end", "def accepts_file_upload?\n true\n end", "def accepts_file_upload?\n true\n end", "def accepts_file_upload?\n true\n end", "def accepts_file_upload?\n true\n end", "def accepts_file_upload?\n true\n end", "def fix\n path = Rails.root.join(\"public/system/files/#{self.id}/original/#{self.file_file_name}\")\n Formatador.display_line(\"Uploading file at: [green]#{path}[/]\")\n if File.exists?(path)\n self.attached_file.store!(File.open(path))\n self.update_attribute(:attached_file, self.file_file_name)\n Formatador.display_line(\"[yellow]Done![/]\")\n else\n Formatador.display_line(\"[red]ERROR: [/]File does not exist!\")\n end\n end", "def multipart?; end", "def upload_file\n \n # remember the filename\n tempfile = params[\"file_to_upload\"]\n \n # wenn ich keinen string bekommen habe und auch ueberhaupt was ankam (kein tag_edit)\n unless tempfile.nil?\n \n # if just a string arrived\n if tempfile.instance_of?(String)\n flash[:notice] = \"please select a valid file\"\n redirect_to :action => \"index\"\n \n # when a file arrived\n elsif tempfile.instance_of?(Tempfile)\n \n # delete file if too big\n if File.size?(tempfile) > MAX_FILESIZE\n File.delete(tempfile.local_path)\n flash[:notice] = \"File too large (maximal 10 MB allowed)\"\n redirect_to :action => \"index\"\n\n # if it is a valid mp3\n else\n # save variable for view\n @original_name = tempfile.original_filename\n # read id3 information\n @tag = ID3Lib::Tag.new(tempfile.local_path)\n # copy the file to the upload directory\n FileUtils.copy(params[:file_to_upload].local_path, tmp_filename)\n logger.info(\"new file from #{current_user.login} copied to : #{tmp_filename}\")\n\n flash[:notice] = \"File Uploaded\"\n end\n end\n else\n \n # hier komme ich hin, wenn nichts hochgeladen wurde, sondern der tag editiert\n \n if params[\"original_name\"].nil?\n flash[:notice] = \"No File selected (depp)\"\n redirect_to :action => \"index\"\n else \n @original_name = params[\"original_name\"]\n @tag = ID3Lib::Tag.new(tmp_filename)\n end\n end\n end", "def upload\r\n \r\n end", "def file_upload_wip()\n logger.debug \"\\r\\n\\r\\n!! ------ in upload/file_upload -----\"\n logger.debug params[:datafile].original_filename\n logger.debug params\n logger.debug \"\\r\\n!! ===========================\\r\\n\"\n is_successful = true\n\n if params[:datafile]\n tmp = params[:datafile].tempfile\n file = File.join( \"public/uploads\", params[:datafile].original_filename )\n FileUtils.cp tmp.path, file\n# \n # name = params[:datafile].original_filename\n # directory = \"public/uploads\"\n # path = File.join(directory, name)\n # File.open(path, \"wb\") { |f|\n # f.write( params[:datafile].read )\n # }\n else\n is_successful = false\n end\n\n redirect_to upload_path()\n end", "def test_no_file_uploaded_with_safari\n e = Resource.new\n assert_nothing_raised { e.file = \"\" }\n assert_equal nil, e.file\n end", "def upload_file\n #TODO\n end", "def file_upload(criteria = T.unsafe(nil)); end", "def upload\n end", "def upload\n end", "def safari_fix\n\t\tif (params.has_key?(:redirect))\n\t\t\turl = params[:redirect]\n\t\t\turl += (url.include?('?'))?'&':'?'\n\t\t\turl += 'safari_fix=true'\n\t\telse\n\t\t\turl = :root\n\t\tend\n\t\t\n\t\tredirect_to url and return\n\tend", "def upload(_io, _path)\n false\n end", "def uploadicon=(file)\n unless( file.blank? )\n logger.info(\"original_filename: \" + file.original_filename )\n self.content_type = file.content_type.chomp\n logger.info(\"content_type: \" + self.content_type )\n filename = base_part_of( file.original_filename ) \n \n if(file.length < 300000 )\n @uploadfile = file \n self.was_upload_successful = true\n else\n self.was_upload_successful = false\n end\n \n end\n end", "def html_uploader\n # TODO\n end", "def clean_up_paperclip_errors\n errors.delete(:file) if errors[:file] == errors[:file_file_size]\n end", "def test_no_file_uploaded_with_safari\n e = Entry.new\n assert_nothing_raised { e.image = \"\" }\n assert_equal nil, e.image\n end", "def upload_process\n # アップロードファイルを取得\n file = params[:upfile]\n\n # ファイルのベース名(パスを除いた部分)を取得\n name = file.original_filename\n\n # 許可する拡張子を定義\n permits = ['.jpg', '.jpeg', '.gif', '.png']\n\n # 配列 permits にアップロードファイルの拡張子に合致するものがあるか\n if ! permits.include?(File.extname(name).downcase)\n render :text => \"アップロードできるのは画像ファイルのみ( \" + permits.join(', ') + \" )です。\"\n elsif file.size > 1.megabyte\n render :text => 'ファイルサイズは1MBまでです。'\n else\n # utf8 to sjis\n name = name.kconv(Kconv::SJIS, Kconv::UTF8)\n\n # /public/doc フォルダ配下にアップロードファイルを保存\n File.open(\"public/docs/#{name}\", 'wb') { |f| f.write(file.read) }\n render :text => \"#{name.toutf8}をアップロードしました。\"\n end\n end", "def validate_image_name\n name = upload_original_name.to_s\n name = name.sub(/^[a-zA-Z]:/, \"\")\n name = name.sub(%r{^.*[/\\\\]}, \"\")\n # name = '(uploaded at %s)' % Time.now.web_time if name.empty?\n name = name.truncate(120)\n return unless name.present? && User.current &&\n User.current.keep_filenames != \"toss\"\n\n self.original_name = name\n end", "def uploaded_data=(data)\n return if data.nil? #&& data.size > 0\n #set new values\n self.filename = data.original_filename.strip.gsub(/[^\\w\\d\\.\\-]+/, '_')\n self.disk_filename = Attachment.disk_filename(filename)\n #check for small files indicated by beeing a StringIO\n @uploaded_file = data\n end", "def multipart; end", "def safari_require_fraud_warning\n return @safari_require_fraud_warning\n end", "def swfupload_file=(data)\n data.content_type = MIME::Types.type_for(data.original_filename).to_s\n self.ufile = data\n end", "def can_upload?\n false\n end", "def fileupload(filename)\n unless filename &&\n (tempfile = filename[:tempfile]) &&\n (name = filename[:filename])\n @error = \"No file selected\"\n return false\n end\n p filename\n fileextension = filename[\"filename\"]\n if File.extname(\"#{fileextension}\") == \".png\" or File.extname(\"#{fileextension}\") == \".jpg\" or File.extname(\"#{fileextension}\") == \".jpeg\" or File.extname(\"#{fileextension}\") == \".gif\"\n puts \"Uploading file, original name #{name.inspect}\"\n target = \"public/img/#{name}\"\n slimroute = \"img/#{name}\"\n files = {target: target, slimroute: slimroute, tempfile: tempfile}\n return files\n else\n return false\n end\nend", "def upload_shell(cookie, check)\r\n\r\n res = send_request_cgi({\r\n 'method' => 'GET',\r\n 'uri' => normalize_uri(target_uri.path, \"bounce.php?course=\" + @course_id),\r\n 'headers' =>\r\n {\r\n 'Referer' => \"#{peer}#{datastore['TARGETURI']}users/index.php\",\r\n 'cookie' => cookie,\r\n },\r\n 'agent' => 'Mozilla'\r\n })\r\n\r\n ucookie = \"ATutorID=#{$2};\" if res.get_cookies =~ /ATutorID=(.*); ATutorID=(.*);/\r\n\r\n file_name = Rex::Text.rand_text_alpha_lower(8) + \".phP\"\r\n @fn = \"#{file_name}\"\r\n post_data = Rex::MIME::Message.new\r\n post_data.add_part('10485760', nil, nil, 'form-data; name=\"MAX_FILE_SIZE\"')\r\n post_data.add_part(payload.encoded, 'application/octet-stream', nil, \"form-data; name=\\\"uploadedfile\\\"; filename=\\\"#{file_name}\\\"\")\r\n post_data.add_part('Upload', nil, nil, 'form-data; name=\"submit\"')\r\n post_data.add_part('', nil, nil, 'form-data; name=\"pathext\"')\r\n\r\n data = post_data.to_s\r\n\r\n res = send_request_cgi({\r\n 'method' => 'POST', \r\n 'data' => data,\r\n 'agent' => 'Mozilla',\r\n 'ctype' => \"multipart/form-data; boundary=#{post_data.bound}\",\r\n 'cookie' => ucookie,\r\n 'uri' => normalize_uri(target_uri.path, \"mods\", \"_core\", \"file_manager\", \"upload.php\") \r\n })\r\n\r\n if res && res.code == 302 && res.redirection.to_s.include?('index.php?pathext')\r\n print_status(\"Trying to upload #{file_name}\")\r\n return true\r\n else\r\n print_status(\"Error occurred during uploading!\")\r\n return false\r\n end\r\n end", "def uploaded_file=(field)\n if field != \"\"\n mt = field.content_type || \"application/binary\"\n self.filename = base_part_of(field.original_filename) \n self.mime_type = mt\n path = get_path\n data = field.read\n self.size = data.length\n if ! File::exist? path\n Dir::mkdir(path)\n else \n # delete old images\n Dir::new(path).each do |oldfile|\n if oldfile[0].chr != '.'\n File::unlink(path+\"/\"+oldfile)\n end\n end\n end\n f = File.new(path + \"/\" + self.filename,\"w\")\n f << data\n f.close\n end\n end", "def upload\n if File.exists?(file_path = \"/home/redroid/motion_detection_images/#{params[:img]}.jpg\")\n send_403_forbidden\n else\n File.open(file_path, 'wb') { |file| file.write(request.raw_post)}\n send_200_ok\n end\nend", "def uploader_options\n end", "def swfupload_file=(data)\n data.content_type = MIME::Types.type_for(data.original_filename).to_s\n self.file = data\n end", "def swfupload_file=(data)\n data.content_type = MIME::Types.type_for(data.original_filename).to_s\n self.file = data\n end", "def upload_file(filename, file_path=\"\")\n frm.file_field(:id=>\"upload\").set(file_path + filename)\n if frm.div(:class=>\"alertMessage\").exist?\n sleep 2\n upload_file(filename)\n end\n end", "def attachment_with_upload_method\n if method == \"upload\" && !attachment?\n errors.add(:base, \"Please make sure to upload your prescription.\")\n end\n end", "def upload\n respond_to do |format|\n format.html # upload.html.erb\n end\n end", "def show\n @archivo = Archivo.find(params[:id])\n @var = @archivo.uploaded_file.path\n @var2 = @var.gsub(@archivo.uploaded_file_file_name, '');\n\n if @archivo.uploaded_file_content_type == 'application/pdf'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"application/pdf\", :x_sendfile=>true\n elsif @archivo.uploaded_file_content_type == 'application/zip'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"application/zip\", :x_sendfile=>true\n elsif @archivo.uploaded_file_content_type == 'image/jpeg' or @archivo.uploaded_file_content_type == 'image/jpg' or @archivo.uploaded_file_content_type == 'image/png' or @archivo.uploaded_file_content_type == 'image/gif'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"image/jpeg\", :x_sendfile=>true\n elsif @archivo.uploaded_file_content_type == 'application/doc'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"application/doc\", :x_sendfile=>true\n elsif @archivo.uploaded_file_content_type == 'text/plain'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"text/plain\", :x_sendfile=>true\n elsif @archivo.uploaded_file_content_type == 'application/msword'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"application/msword\", :x_sendfile=>true\n elsif @archivo.uploaded_file_content_type == 'application/vnd.ms-excel'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"application/vnd.ms-excel\", :x_sendfile=>true\n elsif @archivo.uploaded_file_content_type == 'text/csv'\n send_file Rails.root.join(@var2, @archivo.uploaded_file_file_name), :type=>\"text/csv\", :x_sendfile=>true\n end\n\n end", "def file_upload(upload)\n begin\n FileUtils.mkpath(upload_path) unless File.directory?(upload_path)\n if upload.kind_of?(StringIO)\n upload.rewind\n end\n\n orig_name = upload.original_filename\n base_name = File.basename(orig_name, \".*\") # 取得文件名字\n ext_name = File.extname(orig_name) # 取得文件扩展名\n if ext_name == \".xls\"\n # 重命名\n file_name = base_name + ext_name\n # 将文件写入磁盘\n File.open(upload_path(file_name), \"wb\") { |f| f.write(upload.read) }\n #\n store_data(\"upload/#{file_name.nil? ? '' : file_name}\")\n respond_to do |format|\n format.html { redirect_to root_url, notice: \"upload successfully!!\" }\n end\n else\n respond_to do |format|\n format.html { redirect_to root_url, notice: \"sorry, file type not '.xls' !\" }\n end\n end\n rescue\n raise\n end\n end", "def upload(major)\n unless File.exist?(major)\n puts \"File #{major} not found.\"\n return\n end\n major = File.absolute_path(major)\n response, success = ImgurAPI.upload(major)\n puts response unless success\n if success\n response = \"![#{options[:title].nil? ? 'Screenshot' : options[:title]}](#{response})\" if options[:markdown]\n response = build_HTML_response(response) if options[:html]\n puts \"Copied #{Platform.copy(response)} to clipboard\"\n end\n storage.save\n end", "def migrate_user url, user\n \n # make sure the url contains file stack\n return unless url.start_with? 'https://cdn.filepicker.io'\n\n open('migrated.jpg', 'wb') do |file|\n \n file << open(url).read\n \n #upload the file to the user\n attachment = ActionDispatch::Http::UploadedFile.new(tempfile: file, filename: \"migrated\", type: \"image/jpg\")\n user.avatar_src = attachment\n user.save!\t\n end\nend", "def upload_file_url\n \"file://#{upload_full_path}\"\n end", "def require_file_current_uploads\n the_type = @resource.upload_type\n return if %i[files unknown].include?(the_type)\n\n render json: { error:\n 'You may not submit a file by direct upload in the same version when you have submitted files by URL' }.to_json, status: 409\n end", "def check( _upload )\n @original = _upload\n path = File.join( @uploadDir, @original )\n res = UploadUtils.filename( path )\n @uploadPath = res['path']\n @ext = res['ext']\n @filename = res['filename']\n end", "def on_session_upload(session, local_path, remote_path)\n\tend", "def upload\n secure_silence_logs do\n return bad_request unless params[:file] && params[:title] && current_account\n is_file = params[:file].respond_to?(:path)\n if !is_file && !(URI.parse(params[:file]) rescue nil)\n return bad_request(:error => \"The 'file' parameter must be the contents of a file or a URL.\")\n end\n \n if params[:file_hash] && Document.accessible(current_account, current_organization).exists?(:file_hash=>params[:file_hash])\n return conflict(:error => \"This file is a duplicate of an existing one you have access to.\")\n end\n params[:url] = params[:file] unless is_file\n @response = Document.upload(params, current_account, current_organization).canonical\n render_cross_origin_json\n end\n end", "def update_upload_attributes\n if document.present? && document_changed?\n self.content_type = document.file.content_type\n self.file_size = document.file.size\n self.file_name = File.basename(document.url)\n end\n end", "def upload_file(file_dir, orig_filename, aip_filename, type)\n @log.info 'Uploading file ' + orig_filename\n @log.info \"Renaming #{type} #{aip_filename} -> #{orig_filename}\"\n\n File.rename(file_dir + '/' + aip_filename,\n file_dir + '/' + orig_filename)\n file = File.open(file_dir + '/' + orig_filename)\n\n uploaded_file = Hyrax::UploadedFile.create(file: file)\n uploaded_file.save\n\n file.close\n\n uploaded_file\nend", "def fix_filename\n unless self.filename.blank?\n self.filename.sub!(/^.*\\/([^\\/]*)$/, '\\1')\n self.filename += '.torrent' unless self.filename =~ /\\.torrent$/\n end\n end", "def upload\n uploaded_io = params[:file]\n File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'wb') do |file|\n file.write(uploaded_io.original_filename) \n end\n end", "def on_post(path)\n acct = I3.server.remote_account\n local_path = DocumentFile::DOC_FILE_PATH + path\n \n # Sanity checks\n unless File.directory?(local_path)\n send_uploaded_file_response I3::NotFoundException.new(\n :message => \"The path '#{path}' could not be found.\")\n return\n end #unless\n \n if DocumentPlatform.check_permission(:write, acct, local_path).empty?\n send_uploaded_file_response I3::SecurityException.new(\n :message => \"You do not have permission to write to folder '#{path}'\")\n return\n end #if\n \n # We are good to go so far, so let's grab the file\n file = I3.server.cgi[\"fileToUpload\"]\n filename = file.filename\n \n # Internet Explorer will sometimes send the whole path. We only want the filename.\n filename = filename.split(\"\\\\\").last if filename =~ /\\w:\\\\/\n \n begin\n response = UploadedFile.save_as(filename, file, local_path)\n send_uploaded_file_response response\n \n rescue I3::SecurityException\n log.warn \"User #{acct.account_name} tried to upload a file to '#{path}' and was denied.\"\n send_uploaded_file_response $!\n \n rescue FileAlreadyExistsException\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n response = $!.to_shared\n response.temp_file = UploadedFile.save_as_temp(file)\n response.path = path\n response.original_filename = filename\n response.overwritable = (not DocumentPlatform.check_permission(\n :write, acct, File.join(local_path, filename)).empty?)\n send_uploaded_file_response response\n rescue\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n send_uploaded_file_response I3::ServerException.new(\n :title => \"Could not save file\", \n :message => $!.message )\n end #begin\n \n end", "def file_upload(file)\n file[\"//\"] = \"/\"\n file = ENV['RED5_HOME'] + \"/webapps/encrev1/#{file}\"\n request_url = \"#{@url}/file/demo\"\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Request filename : #{request_url}\"\n response = RestClient.put request_url, \"\"\n $log.info \"--> Got reponse : #{response}\"\n file_name = JSON.parse(response.to_str)['result']\n if file_name\n $log.info \"--> Got filename : #{file_name}\"\n request_url = \"#{@url}/file/demo/\"\n request_url += file_name\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Upload (#{file}) to Encre : #{request_url}\"\n response = RestClient.put request_url, File.read(file), :content_type => 'application/x-shockwave-flash'\n $log.info \"Delete #{file} ...\"\n file = File.delete(file)\n else\n file_name = nil\n end\n rescue\n file_name = nil\n $log.info \"... failed ! (check exception below)\"\n $log.info $!\n end", "def photo=(file_data)\nunless file_data.blank?\n# store the uploaded data into a private instance variable\n@file_data = file_data\n# figure out the last part of the filename and use this as\n# the file extension. e.g., from \"me.jpg\" will return \"jpg\"\nself.extension = file_data.original_filename.split('.').last.downcase\n@ext=self.extension\nend\nend", "def skip_file_other_than_image\n #%w(image/gif image/jpeg image/bmp image/png image/pjpeg).include?(uploaded_content_type)\n uploaded_content_type=~/image/\n end", "def swf_uploaded_data=(data)\n data.content_type = MIME::Types.type_for(data.original_filename).first.to_s\n self.file = data\n end", "def swf_uploaded_data=(data)\n data.content_type = MIME::Types.type_for(data.original_filename).first.to_s\n self.file = data\n end", "def file_up(platform, dir)\r\n # specifying an extension by platform\r\n if platform == Msf::Module::Platform::Windows\r\n filex = \".bat\"\r\n else\r\n if payload.encoded =~ /sh/\r\n filex = \".sh\"\r\n elsif payload.encoded =~ /perl/\r\n filex = \".pl\"\r\n elsif payload.encoded =~ /python/\r\n filex = \".py\"\r\n elsif payload.encoded =~ /ruby/\r\n filex = \".rb\"\r\n else\r\n fail_with(Failure::Unknown, 'Payload type could not be checked!')\r\n end\r\n end\r\n \r\n @fname= rand_text_alpha(9 + rand(3)) + filex\r\n data = Rex::MIME::Message.new\r\n data.add_part('./', nil, nil, 'form-data; name=\"uploadDir\"')\r\n data.add_part(payload.encoded, 'application/octet-stream', nil, \"form-data; name=\\\"theFile\\\"; filename=\\\"#{@fname}\\\"\")\r\n \r\n res = send_request_cgi({\r\n 'method' => 'POST', \r\n 'data' => data.to_s,\r\n 'agent' => 'Mozilla',\r\n 'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\r\n 'cookie' => @cookie,\r\n 'uri' => normalize_uri(target_uri, \"Upload.do\") \r\n })\r\n \r\n if res && res.code == 200 && res.body.include?('icon_message_success') # Success icon control\r\n print_good(\"#{@fname} malicious file has been uploaded.\")\r\n create_exec_prog(dir, @fname) # Great. Let's send them somewhere else o_O\r\n else\r\n fail_with(Failure::Unknown, 'The file could not be uploaded!')\r\n end\r\n end", "def redirect_non_facebook_safari_requests\r\n redirect_to welcome_path if !cookies['safari_cookie_fix'] && request.env[\"HTTP_USER_AGENT\"] && request.env[\"HTTP_USER_AGENT\"][/Safari/] && request.referer !~ /\\/welcome/\r\n end", "def upload(_data)\n fail NotImplementedError\n end", "def swf_uploaded_data=(data)\n data.content_type = MIME::Types.type_for(data.original_filename)\n self.uploaded_data = data\n end", "def drop_in_dropzone(file_path)\n super file_path:,\n input_name: \"commissioning_document[upload][]\",\n container_selector: \".dropzone:first\"\n end", "def upload(file, someone)\n end", "def create\n\n #for plupload rename \"file\" to expected \"document[data]\" \n if(params[:file])\n params[:user_document] = params[:file]\n end\n\n @user = current_user\n @profile = @user.profile\n @user_document = @user.documents.create(:document=>params[:user_document])\n\n begin\n\n if @user_document.save\n\n unless @profile.document_links.has_key?(:profile_document)\n @profile.document_links.merge!(:profile_document => @user_document.id)\n @profile.save\n end\n\n respond_to do |format|\n format.json { render :json => [:document_gallery_item_id => @user_document.id, :created_document_url => @user_document.document.url(:large), :document_gallery_item => view_context.document_gallery_item_editable(@user_document)], :status => :ok }\n end\n\n else\n respond_to do |format|\n #format.html { redirect_to(edit_profile_url(@profile), :notice => 'There was an issue with video upload. Please try again') }\n format.json { render :json => [:error_message => 'conversion failure'], :status => :ok }\n end\n end\n\n rescue Paperclip::Errors::NotIdentifiedByImageMagickError\n respond_to do |format|\n #format.html { redirect_to(edit_profile_url(@profile), :notice => 'There was an issue with video upload. Please try again') }\n format.json { render :json => [:error_message => 'cannot convert filetype'], :status => :ok }\n end\n end\n\n end", "def send_uploaded_file_response(obj)\n request = I3.server.request\n if request.params[\"HTTP_USER_AGENT\"] =~ /MSIE/ # Internet Explorer\n obj = obj.to_shared if obj.is_a? I3::ServerException\n I3.server.send_object(obj, :type => \"text/html\")\n else\n I3.server.send_object(obj)\n end #if\n end", "def upload_file(file_path)\n # YUCK we need to use JS to remove the class that is disabling sending keys\n $driver.execute_script(\"$('#{INPUT_BOX[:css]}').removeAttr('class')\")\n send_keys INPUT_BOX, file_path\n end", "def store_file\n # TODO\n # - kick BOM if present\n # - convert to UTF-8 if a different encoding is given\n # - we should check double encoding because the tempfile is always read as utf8\n\n # writes the file binary/raw without taking encodings into account.\n # If we want to convert incoming files this should be done before\n File.open(full_filename, 'wb') do |f| #w:UTF-8\n f.write @uploaded_file.read\n end\n end", "def swfupload_file=(data)\r\n data.content_type = MIME::Types.type_for(data.original_filename).to_s if data\r\n self.image = data\r\n end", "def img_upload(file)\n\t \t# puts \"++++ #{file.inspect} ++++\"\n\t \tpath=File.dirname(__FILE__) + '/public/uploads/' + file[:filename]\n\t \t# puts \"///////\"\n\t \t# puts path\n\t \tFile.open(path, \"w\") do |upload|\n\t \t\tupload.write(file[:tempfile].read)\n\t end\n\t return file[:filename]\n\t end", "def upload_and_clean\n self.image.upload_and_clean\n end", "def upload_avatar\n @user = User.find(params[:id])\n @file = params[:avatar]\n\n # return render_error :avatar unless @file && @file.try(:content_type)\n if @file.content_type =~ /^image\\/jpeg|png|jpg/\n if @user.update_attributes(avatar: params[:avatar])\n redirect_to user_pa_organization_user_path\n end\n else \n flash[:alert] = \"Your file's type is invalid. Please try another one!\"\n redirect_to user_pa_organization_user_path\n # render_error :content_type, :type => @file.content_type\n end\n\n end", "def photo__mime_type\r\nif !self.photo__name.blank?\r\n mt = MIME::Types.of(File.extname(self.photo__name)).first\r\n return mt ? mt.content_type : \"application/octet-stream\"\r\nend\r\nend", "def upload_file\n filename = request.headers['X-Filename']\n if filename.blank?\n render plain: \"X-Filename header not provided\",\n status: :bad_request and return\n end\n input = request.env['rack.input']\n input.rewind\n input.set_encoding(Encoding::UTF_8)\n @import.save_file(file: input, filename: filename)\n head :no_content\n end", "def uploading_pictures\n end", "def upload\n redirect_to_groof_show = false\n @groof = Greenroof.find_by_id(params[:id])\n\n unless params[\"file-0\"].nil?\n\n # The path to the directory for the photos of the created greenroof.\n directory = \"/public/greenroofs/photos/\" + params[:id]\n\n # If the directory does not exists a new one will be created.\n FileUtils.mkdir_p Dir.pwd + directory if not File.directory? Dir.pwd + directory\n\n # The filename for the new photo.\n if not (@groof.images.first.nil?)\n photoFilename = @groof.images.first.photo\n redirect_to_groof_show = true\n else\n photoFilename = params[:id] + \"_\" + Time.now.to_i.to_s + \"_\" + Digest::MD5.hexdigest(params[\"file-0\"].original_filename)\n end\n # The full path for the photo.\n photoPath = Dir.pwd + directory + \"/\" + photoFilename\n\n file = File.read(params[\"file-0\"].tempfile) if params[\"file-0\"]\n f = File.new(photoPath, \"w+\")\n f.write file\n f.close\n\n # Filename for the thumbnail\n if not (@groof.images.first.nil?)\n thumbFilename = @groof.images.first.thumb\n else\n thumbFilename = params[:id] + \"_thumb_\" + Time.now.to_i.to_s + \"_\" + Digest::MD5.hexdigest(params[\"file-0\"].original_filename)\n end\n thumb = Magick::Image.read(photoPath).first\n thumb.crop_resized!(120, 120, Magick::NorthGravity)\n thumbPath = Dir.pwd + directory + \"/\" + thumbFilename\n thumb.write(thumbPath)\n\n # photo = \"/photos/\" + params[:id]\n\n img = Image.new(photo: photoFilename, thumb: thumbFilename)\n @groof.images.clear\n @groof.images << img\n end\n if @groof.save!\n flash[:success] = \"Viherkaton lisäys onnistui!\"\n\n render :js => \"window.location = '/greenroofs/\" << @groof.id.to_s << \"'\"\n\n end\n\n\n end", "def rm_uploaded_file\n deleatur=params[:name]\n # Plausibility check: must not go updir\n if deleatur.nil? or deleatur.include?('..')\n flash[:error]=\"Suspicious file! .... \"+deleatur.to_s\n else\n fpath=\"#{AMP_DIR}/#{deleatur}\"\n if File.file?(fpath)\n begin\n up=Userpage.find_by_filename(deleatur)\n up.destroy unless up.nil?\n File.delete(fpath)\n flash[:success]=\"Die Datei #{deleatur} ist entfernt worden\"\n rescue Errno::ENOENT\n flash[:warning]=\"Die Datei #{deleatur} ist in diesem Moment verschwunden\"\n rescue Exception => e\n flash[:error]=\"Exception #{e.class.to_s} : #{e.message}\"\n end\n else\n flash[:warning]=\"Die Datei #{deleatur} existiert nicht mehr\"\n end\n end\n prepare_admin_home_data\n redirect_to admin_pages_home_path\n end", "def drop_in_dropzone(file_path)\n super file_path:,\n input_name: \"uploaded_files[]\",\n container_selector: \".dropzone:first\"\n end", "def upload_shipped\n end", "def convert_files_for_upload(value)\n if value.kind_of?(ActionDispatch::Http::UploadedFile)\n upload_io = UploadIO.new(value.tempfile.path, value.content_type, value.original_filename)\n return upload_io\n else\n false\n end\n end", "def handle_async_upload_start( request )\n\t\tself.log.info \"Upload started: %s\" % [ request.header.x_mongrel2_upload_start ]\n\t\treturn nil # Do nothing\n\tend", "def upload_file(uploader, url)\n uri = URI.parse(url)\n if uri.host.nil?\n # Local, prepend url\n file = File.open(uploader.root + url)\n else\n # Add a scheme if the url is of the form \"//host.com/assets/\"\n uri.scheme = \"http\" if uri.scheme.nil?\n # Remote\n uploader.download!(uri.to_s)\n file = uploader.file\n end\n file\n end", "def upload\n # connected to upload.html.haml form\n # looks for :zernike in params, existence means file is attached\n # significant help from \"http://www.tutorialspoint.com/ruby-on-rails/rails-file-uploading.htm\"\n if params[:zernike]\n uploaded_file = params[:zernike][:attachment]\n file_name = uploaded_file.original_filename\n jsonified_file = uploaded_file.as_json[\"tempfile\"]\n extract_data = coefficients_extractor(jsonified_file)\n @file = extract_data\n \n if @file.nil? or @file.empty?\n flash[:warning] = \"Unable to upload file\"\n # made it a \"warning\" instead of \"notice\" so we can change the colors/text\n else\n flash[:notice] = \"File successfully uploaded!\"\n end\n \n redirect_to zernikes_path\n end\n \n # if not @file.nil?\n # byebug\n # end\n # self.content = [TEXT INSIDE test.txt]\n # @file = params[:file]\n # byebug\n # @zernike = Zernike.\n # if @zernike.save\n # flash[:notice] = \"File successfully uploaded!\"\n # redirect_to \n # else \n # flash[:notice] = \"Unable to upload file\"\n \n # byebug\n # @file = params[:file]\n # if @file.nil? or @file.empty? \n # flash[:notice] = \"File is empty!\"\n # else \n # flash[:notice] = \"File successfully uploaded!\"\n # end\n \n end", "def upload_referenced_images(filename, mime_type, nokodoc, locale)\n nokodoc.xpath(\"//img/@src\").each do |image|\n # portal_images are in the public directory\n unless (image.text.include? '/portal_images')\n begin\n @original_filename = filename\n case\n when (image.text =~ /^[^\\/].*/)\n mydirectory = @original_filename.match(/([^\\/]*)\\/(.*)/)[1]\n mypath = \"#{DOCSRCDIR}#{mydirectory}/#{image.text}\"\n fullpath = File.expand_path(mypath)\n begin\n mime_type = get_mime_type(fullpath[/(?:.*)(\\..*$)/, 1])\n rescue\n @mime_type = \"\"\n end\n begin\n if File.exist?(fullpath)\n then\n upload_attachment(filename,locale,fullpath,mime_type,image.text)\n else\n STDERR.puts \"Failed to find the file\\n\\t #{fullpath}\\n referenced by \\n\\t #{@original_filename}\"\n end\n rescue\n STDERR.puts \"Failed to upload file\\n\\t #{fullpath}\\n referenced by \\n\\t #{@original_filename}\"\n end\n when (image.text =~ /^[\\/].*/)\n fullpath = \"#{APPSRCDIR}#{image.text}\"\n begin\n mime_type = get_mime_type(fullpath[/(?:.*)(\\..*$)/, 1])\n rescue\n @mime_type = \"\"\n end\n begin\n if File.exist?(fullpath)\n then\n upload_attachment('app_image_document',locale,fullpath,mime_type,image.text)\n else\n STDERR.puts \"APPSRCDIR -> #{APPSRCDIR}\"\n STDERR.puts \"image.text -> #{image.text}\"\n STDERR.puts \"Failed to find the file\\n\\t #{fullpath}\\n referenced by \\n\\t #{@original_filename}\"\n end\n rescue\n STDERR.puts \"Failed to upload linked file\\n\\t #{fullpath}\\n referenced by \\n\\t #{@original_filename}\"\n end\n else\n STDERR.puts \"Failed to upload file\\n\\t #{fullpath}\\n referenced by \\n\\t #{@original_filename}\"\n end\n rescue\n STDERR.puts \"File\\n\\t #{image.text}\\n referenced by \\n\\t #{@original_filename} is not formatted in a way I understand.\"\n end\n end\n end\nend", "def create_file_to_upload\n file_path = $redis.get(\"tempfile_path_#{self.id}\")\n tempfile = File.open(file_path,'r')\n\n file = ActionDispatch::Http::UploadedFile.new({\n :tempfile => File.new(tempfile)\n })\n file.original_filename = File.basename(file_path).split(\"_\", 2).last\n file.content_type = \"application/#{File.basename(file_path).split('.').last}\" \n file\n end", "def safari_blocked\n return @safari_blocked\n end", "def file_options; end", "def before_save \n \n #\n # upload bundle image\n #\n if( @uploadfile )\n \n # clean up first all existing image files\n [\"jpeg\", \"gif\", \"png\"].each do |ext| \n f = fq_bundle_image_filename( ext )\n if File.exists?(f) \n File.delete(f)\n end\n end\n \n # write the upload file\n extention = @uploadfile.content_type.gsub(/^image\\//, '').downcase.chomp\n out = File.open( fq_bundle_image_filename( extention ), \"w\" )\n out.write( @uploadfile.read )\n out.close\n \n # integrate link in description\n desc = self.description \n # filter operations can be inserted later on\n updated_img_lnk = \"[[File:#{bundle_resouce_file_name}.#{extention}]]\"\n desc = desc.gsub( /\\[\\[file:.*?\\.((jpeg)|(jpg)|(png)|(gif))\\]\\]/i, updated_img_lnk )\n if( ! $~ )\n # if not already matched add link tag to the end of the description field\n desc << \"\\n\" + updated_img_lnk\n end\n self.description = desc\n end\n\n\n #\n # copy prompt sample for bundle description (/upload/audio)\n #\n if( @sample_file_id )\n audio_source = AudioSource.find_by_file_id( @sample_file_id, :conditions => { :bundle_source_id=>self.id } )\n logger.info( @sample_file_id )\n if( audio_source )\n # copy file\n audio_source = audio_source.fq_mp3_filename\n audio_target = \"public/upload/audio/\" + bundle_resouce_file_name + \".mp3\"\n \n %x[cp #{audio_source} #{audio_target}]\n sample_prompt_file_tag = \"[[File:#{bundle_resouce_file_name}.mp3]]\"\n \n # integrate prompt sample in description\n desc = self.description\n desc = desc.gsub( /\\[\\[file:.*?\\.((mp3))\\]\\]/i, sample_prompt_file_tag )\n\n if( ! $~ )\n # if not already matched add link tag to the end of the description field\n desc << \"\\n\" +sample_prompt_file_tag\n end\n \n self.description = desc \n end\n end\n\n end", "def create\n @pre_form = DocFile.new(doc_file_params)\n @doc_file = DocFile.correctionFile(@pre_form, current_user.student, File_URL)\n\n respond_to do |format|\n if DocFile.uploadFile(@pre_form.docOwner, @doc_file.name, current_user.student.fileNumber, File_URL) && @doc_file.save\n format.html { redirect_to @pre_form, notice: 'Archivo agregado correctamente.' }\n format.json { render action: 'index', status: :created, location: @pre_form }\n else\n begin\n File.delete( @doc_file.docOwner)\n rescue\n end\n format.html { render action: 'new' }\n format.json { render json: @doc_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def notest_should_remove_blank_char_from_filename\n\n document_field = CGI.new( :multipart => true )\n puts document_field.inspect\n document = Document.new(document_field)\n \n puts document.inspect\n \n \n end", "def check_and_correct_file_extension\n extension = File.extname(avatar_file_name).downcase\n self.avatar.instance_write(:file_name, \"#{avatar_file_name}.jpg\") if extension.blank?\n end", "def upload_from_ck\n begin\n #TODO translate, dynamics messages\n uploaded_item = params[:item_type].classify.constantize.new(:title => params[:upload].original_filename,\n :description => \"uploaded from FCK\",\n params[:item_type].to_sym => params[:upload],\n :user_id => current_user.id\n )\n # TODO containers\n if params[:ws_id].nil?\n uploaded_item.associated_workspaces = [@current_user.private_workspace.id.to_s]\n else\n uploaded_item.associated_workspaces = [@current_user.private_workspace.id.to_s, params[:ws_id]]\n end\n\n if uploaded_item.save\n\n #message contains the HTML code to insert in the ck editor\n case params[:item_type]\n when \"image\"\n message = upload_image(uploaded_item)\n when \"video\"\n \n message = upload_video(uploaded_item)\n when \"audio\"\n message = upload_audio(uploaded_item)\n else\n render :text => '<script type=\"text/javascript\">$(\\'#notice\\').showMessage(\"no type available\", 1500);</script>'\n end\n \n else\n render :text => '<script type=\"text/javascript\">$(\\'#notice\\').showMessage(\"error while saving\", 1500);</script>'\n end\n \n render :text => message\n \n rescue Exception => e\n logger.error(e.to_s + \"\\n\" + e.backtrace.collect { |trace|' ' + trace + \"\\n\" }.to_s)\n #TODO -> display error in notice on top (or error in fck erorrs) \n render :text => '<script type=\"text/javascript\">$(\\'#notice\\').showMessage(\"error during transfer\", 1500);</script>', :layout => false\n end\n end", "def upload_files\n params.each do |k,v|\n logger.debug(\"K: #{k} ,V: #{v}\")\n end\n \n ff = params['ajb'].original_filename\n \n mlh = ''\n ff.each_byte do |b|\n if b < 127\n mlh = mlh + b.chr\n else\n break\n end\n end\n \n qzh = params['qzh']\n dalb = params['dalb']\n \n dh = \"#{qzh}-#{dalb}-#{mlh}-%\"\n \n #delete any document connected to dh\n User.find_by_sql(\"delete from archive where dh like '#{dh}'; \")\n User.find_by_sql(\"delete from document where dh like '#{dh}'; \")\n\n user = User.find_by_sql(\"select * from d_dwdm where id=#{qzh};\")[0]\n dwdm = user.dwdm # find by sql query\n\n v = params['jnb']\n ff = File.new(\"./dady/tmp/#{v.original_filename}\",\"w+\")\n ff.write(v.tempfile.read)\n ff.close\n\n v = params['ajb']\n ff = File.new(\"./dady/tmp/#{v.original_filename}\",\"w+\")\n ff.write(v.tempfile.read)\n ff.close\n \n logger.debug \"ruby ./dady/bin/upload_mulu.rb #{v.original_filename} #{dwdm} #{qzh} #{dalb} &\"\n system (\"ruby ./dady/bin/upload_mulu.rb #{v.original_filename} #{dwdm} #{qzh} #{dalb} &\")\n \n render :text => \"{success:true}\"\n end" ]
[ "0.6423877", "0.60319906", "0.60127217", "0.59622204", "0.59221905", "0.588879", "0.58406985", "0.5809589", "0.57784325", "0.57784325", "0.57784325", "0.57784325", "0.57784325", "0.57784325", "0.57713974", "0.57693595", "0.57651883", "0.5750233", "0.57424724", "0.5724193", "0.5700012", "0.5696333", "0.5695507", "0.5695507", "0.5676851", "0.5669079", "0.5636127", "0.5635429", "0.55965114", "0.55731237", "0.5548225", "0.5546414", "0.5546045", "0.5545283", "0.5535164", "0.5534923", "0.5494356", "0.54941267", "0.54763454", "0.54671097", "0.5465589", "0.54576665", "0.54178447", "0.54178447", "0.5409604", "0.5392465", "0.5381718", "0.5378415", "0.5374628", "0.53719175", "0.5349855", "0.53469014", "0.53439", "0.5334242", "0.53220654", "0.532045", "0.5314603", "0.53031456", "0.5299237", "0.5291306", "0.52867407", "0.5286301", "0.527795", "0.52764535", "0.52742374", "0.52742374", "0.5261353", "0.5259092", "0.52547604", "0.52506095", "0.5250544", "0.52428913", "0.52404636", "0.5225771", "0.5213375", "0.5209834", "0.51962817", "0.5187852", "0.5184323", "0.5179784", "0.5175631", "0.5174909", "0.5169031", "0.51686895", "0.5166634", "0.51657444", "0.51657027", "0.51607585", "0.5153998", "0.5153294", "0.5149309", "0.5140359", "0.51397175", "0.5134619", "0.5125462", "0.51221853", "0.5119119", "0.5118106", "0.5106894", "0.51051235", "0.5104795" ]
0.0
-1
GET /ocorrencias GET /ocorrencias.json
def index @ocorrencias = Ocorrencia.all respond_to do |format| format.csv { send_data @ocorrencias.to_csv} format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end", "def index\n @ativo_outros = AtivoOutro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ativo_outros }\n end\n end", "def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordenes }\n end\n end", "def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @acuerdos = Acuerdo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acuerdos }\n end\n end", "def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end", "def index\n seleccionarMenu(:rondas)\n @rondas = Ronda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rondas }\n end\n end", "def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end", "def index\n @asociados = Asociado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asociados }\n end\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def index\n \n @controles_asistencias = ControlAsistencia.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @controles_asistencias }\n end\n end", "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "def index\n @restoras = Restora.all\n end", "def index\n @preparatoria_o_universidad_de_origens = PreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origens }\n end\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end", "def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @notadedebito = Notadedebito.find(params[:notadecredito_id])\n @renglon_notadebitos = @notadedebito.renglon_notadebitos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_notadebitos }\n end\n end", "def index \n @lancamentorapido = Lancamentorapido.new \n @lancamentorapidos = Lancamentorapido.all\n \n @categorias = Category.all\n @centrosdecusto = Centrodecusto.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lancamentorapidos }\n end\n end", "def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end", "def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\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 @contas = Conta.all\n respond_to do |format|\n format.json { render json: @contas.to_json, status: :ok }\n end\n end", "def index\n find_organismos\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @organismos }\n end\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def index\n @articulos = Articulo.where(\"tipo = 'articulo'\").order(\"created_at desc\") \n @noticias = Articulo.where(\"tipo = 'noticia' and mostrar_carrusel='1'\").order(\"created_at desc\").limit(3)\n @articulos = @articulos.page(params[:page]).per_page(5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articulos }\n end\n end", "def show\n @orgao = Orgao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orgao }\n end\n end", "def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end", "def index\n @prueba_jsons = PruebaJson.all\n end", "def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end", "def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end", "def index\n @archdioceses = Archdiocese.all\n\n render json: @archdioceses\n end", "def index\n @frais_repas = FraisRepa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_repas }\n end\n end", "def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end", "def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end", "def index\n @cadavres = Cadavre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cadavres }\n end\n end", "def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end", "def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end", "def index\n @contas = Conta.where(nil) #Inicia Escopo\n @contas = @contas.conta_numero(params[:contaNumero]) if params[:contaNumero].present?\n @contas = @contas.conta_descricao(params[:contaDescricao]) if params[:contaDescricao].present?\n @contas = @contas.agencia_numero(params[:agenciaNumero]) if params[:agenciaNumero].present?\n @contas = @contas.banco_id(params[:bancoId]) if params[:bancoId].present?\n\n @contas = @contas.paginate(:page => params[:page], :per_page => params[:per_page])\n respond_to do |format|\n format.html { render :index }\n format.json { render json: {contas: @contas.as_json(:include => [:banco], methods: [:conta, :agencia, :saldo]), total: @contas.total_entries}}\n end\n end", "def index\n @comprobantes = Comprobante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comprobantes }\n end\n end", "def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end", "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end", "def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end", "def index\n @reprogramaciones = Reprogramacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reprogramaciones }\n end\n end", "def index\n @tipo_usuarios = TipoUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_usuarios }\n end\n end", "def show\n @orden_cobro = OrdenCobro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orden_cobro }\n end\n end", "def show\n @orden_cobro = OrdenCobro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orden_cobro }\n end\n end", "def index\n @enderecos = Endereco.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enderecos }\n end\n end", "def index\n residencial = current_user.apartamento.residencial\n #@eventos = Evento.joins(:user => [{:apartamento => :residencial}])\n #.where(:residenciais => {:id => residencial.id})\n #.order(\"created_at DESC\")\n\n @eventos = Evento\n .where(:residencial_id => residencial.id)\n .order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eventos }\n end\n end", "def index\n @cursos = Curso.all_active\n @curso = Curso.new\n @programas = Programa.all_active\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cursos }\n end\n end", "def index\n @deporte_usuarios = DeporteUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deporte_usuarios }\n end\n end", "def index\n @articulocomps = Articulocomp.all\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @articulocomps }\n end\n end", "def index\n rol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"DN\" or rol.nombre == \"ACRM\"\n @colegiaturas = Colegiatura.all\n else\n @colegiaturas = Colegiatura.where(:sede_id=>current_user.sede)\n end \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegiaturas }\n end\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def show\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ativo_outro }\n end\n end", "def index\n @bitacoras = Bitacora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bitacoras }\n end\n end", "def index\n @municipio_de_la_preparatoria_o_universidad_de_origens = MunicipioDeLaPreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipio_de_la_preparatoria_o_universidad_de_origens }\n end\n end", "def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ultimo_grado_de_estudios }\n end\n end", "def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end", "def index\n @seguridad_usuarios = Seguridad::Usuario.order('usuario')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @seguridad_usuarios }\n end\n end", "def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end", "def index\n @foros = Foro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foros }\n end\n end", "def index\n @listas_contato = ListaContato.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listas_contato }\n end\n end", "def show\n @orador = Orador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orador }\n end\n end", "def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end", "def index\n @coasters = Coaster.all\n\n render json: @coasters\n end", "def index\n if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_propios = Usuario.find(params[:usuario_id]).negocios_propios\n render json: @negocios_propios,\n root: 'negocios_propios',\n each_serializer: NegocioPropioSerializer\n else\n @negocios = Negocio.all\n render json: @negocios\n end\n end", "def index\n @coordenador_estagios = CoordenadorEstagio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coordenador_estagios }\n end\n end", "def index\n #@arquivos = Arquivo.all\n\n residencial = current_user.apartamento.residencial\n @arquivos = Arquivo\n .where(:residencial_id => residencial.id)\n .order(\"created_at\")\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @arquivos }\n end\n end", "def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end", "def index\n @omatsuris = Omatsuri.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @omatsuris }\n format.json { render :json => @omatsuris }\n end\n end", "def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end", "def index\n @barrios = Barrio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @barrios }\n end\n end", "def index\n @empresas = Empresa.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empresas }\n end\n end", "def index\n @socios = Socio.where(['nome LIKE ?', \"%#{params[:nome]}%\"]).paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @socios }\n end\n end", "def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end", "def index\n @factura = Factura.find(params[:factura_id])\n @renglon_facturas = @factura.renglon_facturas\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @renglon_facturas }\n end\n end", "def index\n @finalidad_cultivos = FinalidadCultivo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @finalidad_cultivos }\n end\n end", "def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end", "def index\n @programa_de_interes = ProgramaDeIntere.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programa_de_interes }\n end\n end", "def index\n @status_ref_pago_inscs = StatusRefPagoInsc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_ref_pago_inscs }\n end\n end", "def index\n @tipoocorrencia = Tipoocorrencium.all\n end", "def show\n\n @evento = Evento.find(params[:id])\n @comentarios = Comentario.where(:comentavel_id => @evento.id, :comentavel_type => \"Evento\").order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evento }\n end\n end", "def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end", "def show\n @inscrito = Inscrito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inscrito }\n end\n end", "def index\n @municipios = Municipio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end", "def get_modelos\n marca = Marca.find(params[:marca_id])\n @modelos = Modelo.of_marca(marca.id)\n\n render json: @modelos\n\n end", "def show\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remito }\n end\n end", "def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end", "def index\n @calificaciones = Calificacion.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @calificaciones }\n end\n end", "def index\n @status_de_la_notificacions = StatusDeLaNotificacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_de_la_notificacions }\n end\n end", "def index\n @occasions = current_user.occasions.sorteddesc.all.paginate(page: params[:page], :per_page => 10)\n @products = Product.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occasions }\n end\n end" ]
[ "0.74326205", "0.70911896", "0.70768183", "0.70362973", "0.70298326", "0.7007676", "0.69892937", "0.69334525", "0.69301605", "0.6886616", "0.68755674", "0.686979", "0.68683445", "0.68623996", "0.6858598", "0.68554425", "0.68530595", "0.68424433", "0.68257844", "0.68129665", "0.6812524", "0.67962754", "0.67839456", "0.67773914", "0.67661554", "0.6736337", "0.67346126", "0.67244315", "0.67167306", "0.67109025", "0.6678791", "0.6665654", "0.6636124", "0.6632246", "0.6604626", "0.66038805", "0.66029286", "0.66009986", "0.65959615", "0.65862685", "0.6575285", "0.6568318", "0.6565982", "0.65585935", "0.65555274", "0.65465575", "0.65458506", "0.6544507", "0.65352404", "0.6535168", "0.6529273", "0.6522862", "0.6502422", "0.6502422", "0.6484385", "0.647808", "0.6477132", "0.64720476", "0.6470849", "0.6466374", "0.6460393", "0.64548695", "0.6448425", "0.6444168", "0.64432275", "0.6438136", "0.64370835", "0.64352703", "0.6428846", "0.6426793", "0.64214593", "0.6417227", "0.64146465", "0.6410277", "0.6405629", "0.63992465", "0.6396483", "0.6396369", "0.6393562", "0.63906616", "0.638518", "0.6384499", "0.6383733", "0.6375326", "0.63745373", "0.63723814", "0.63673294", "0.63673294", "0.6366227", "0.6362735", "0.6360197", "0.6359196", "0.63580966", "0.63566726", "0.63564533", "0.63534135", "0.63491905", "0.6345678", "0.6341778", "0.63401014", "0.63395166" ]
0.0
-1
GET /ocorrencias/1 GET /ocorrencias/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end", "def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end", "def show\n @orgao = Orgao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orgao }\n end\n end", "def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end", "def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end", "def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordenes }\n end\n end", "def index\n @ativo_outros = AtivoOutro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ativo_outros }\n end\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def index\n @asociados = Asociado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asociados }\n end\n end", "def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end", "def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end", "def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end", "def show\n @orden_cobro = OrdenCobro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orden_cobro }\n end\n end", "def show\n @orden_cobro = OrdenCobro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orden_cobro }\n end\n end", "def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def show\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ativo_outro }\n end\n end", "def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end", "def index\n @acuerdos = Acuerdo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acuerdos }\n end\n end", "def show\n @odontologia1 = Odontologia1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odontologia1 }\n end\n end", "def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end", "def index\n seleccionarMenu(:rondas)\n @rondas = Ronda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rondas }\n end\n end", "def index\n find_organismos\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @organismos }\n end\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def show\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observacao_vocacionada }\n end\n end", "def show\n @asociado = Asociado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asociado }\n end\n end", "def index\n @notadedebito = Notadedebito.find(params[:notadecredito_id])\n @renglon_notadebitos = @notadedebito.renglon_notadebitos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_notadebitos }\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 @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end", "def show\n @orador = Orador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orador }\n end\n end", "def show\n @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cargo_eleicao }\n end\n end", "def show\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remito }\n end\n end", "def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end", "def index\n \n @controles_asistencias = ControlAsistencia.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @controles_asistencias }\n end\n end", "def show\n @inscrito = Inscrito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inscrito }\n end\n end", "def index \n @lancamentorapido = Lancamentorapido.new \n @lancamentorapidos = Lancamentorapido.all\n \n @categorias = Category.all\n @centrosdecusto = Centrodecusto.all \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lancamentorapidos }\n end\n end", "def show\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concurso }\n end\n end", "def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\n end", "def show\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reconocimiento }\n end\n end", "def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end", "def index\n @contas = Conta.all\n respond_to do |format|\n format.json { render json: @contas.to_json, status: :ok }\n end\n end", "def index\n @restoras = Restora.all\n end", "def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end", "def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end", "def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end", "def index\n @articulos = Articulo.where(\"tipo = 'articulo'\").order(\"created_at desc\") \n @noticias = Articulo.where(\"tipo = 'noticia' and mostrar_carrusel='1'\").order(\"created_at desc\").limit(3)\n @articulos = @articulos.page(params[:page]).per_page(5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articulos }\n end\n end", "def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end", "def index\n @preparatoria_o_universidad_de_origens = PreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origens }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end", "def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end", "def show\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recurso }\n end\n end", "def show\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @consumo }\n end\n end", "def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end", "def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end", "def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end", "def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end", "def show\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @asiento }\n end\n end", "def index\n @subcategorias = Subcategoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @subcategorias }\n end\n end", "def show\n @relogio = Relogio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relogio }\n end\n end", "def show\n\n @evento = Evento.find(params[:id])\n @comentarios = Comentario.where(:comentavel_id => @evento.id, :comentavel_type => \"Evento\").order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evento }\n end\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end", "def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end", "def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end", "def show\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @selecao }\n end\n end", "def show\n @escola = Escola.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @escola }\n end\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def index\n @archdioceses = Archdiocese.all\n\n render json: @archdioceses\n end", "def index\n @categorias = Categoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @categorias }\n end\n end", "def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end", "def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end", "def show\n @ano = Ano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ano }\n end\n end", "def show\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ocat }\n end\n end", "def show\n @noto = Noto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @noto }\n end\n end", "def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end", "def index\n @comprobantes = Comprobante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comprobantes }\n end\n end", "def show\n @orc = Orc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orc }\n end\n end", "def ocRecibir\n id = params[:id]\n ocClass = Oc.new\n result = ocClass.recibirOC(id) \n render :json => {:aceptado => result, :idoc => id} \n\n end", "def show\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguro }\n end\n end", "def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end", "def index\n @prueba_jsons = PruebaJson.all\n end", "def index\n @contas = Conta.where(nil) #Inicia Escopo\n @contas = @contas.conta_numero(params[:contaNumero]) if params[:contaNumero].present?\n @contas = @contas.conta_descricao(params[:contaDescricao]) if params[:contaDescricao].present?\n @contas = @contas.agencia_numero(params[:agenciaNumero]) if params[:agenciaNumero].present?\n @contas = @contas.banco_id(params[:bancoId]) if params[:bancoId].present?\n\n @contas = @contas.paginate(:page => params[:page], :per_page => params[:per_page])\n respond_to do |format|\n format.html { render :index }\n format.json { render json: {contas: @contas.as_json(:include => [:banco], methods: [:conta, :agencia, :saldo]), total: @contas.total_entries}}\n end\n end", "def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end", "def index\n @formatos = Formato.where(ativo: true)\n \t\n render json: @formatos\n end", "def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end", "def show\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @coisa }\n end\n end", "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end", "def show\n @odontologo = Odontologo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odontologo }\n end\n end", "def index\n @frais_repas = FraisRepa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_repas }\n end\n end", "def index\n @cursos = Curso.all_active\n @curso = Curso.new\n @programas = Programa.all_active\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cursos }\n end\n end", "def index\n @cadavres = Cadavre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cadavres }\n end\n end", "def show\n @acao = Acao.find(params[:id])\n @risco = Risco.find(@acao.risco_id)\n @project = Project.find(@risco.project_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @acao }\n end\n end", "def show\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_negocio }\n end\n end", "def show\n @tipo_convenio = TipoConvenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_convenio }\n end\n end", "def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end" ]
[ "0.7362442", "0.7185649", "0.710891", "0.7103471", "0.7003312", "0.69888955", "0.69806415", "0.6957386", "0.6915646", "0.69155365", "0.6861175", "0.683773", "0.6825988", "0.682492", "0.6810571", "0.6803706", "0.6803706", "0.6798686", "0.67902774", "0.6784676", "0.67611396", "0.67535985", "0.6718564", "0.6714173", "0.67047715", "0.6701189", "0.6699694", "0.66893655", "0.66880554", "0.6683947", "0.66813517", "0.6680122", "0.66749966", "0.6672562", "0.666832", "0.6648077", "0.66472346", "0.6645407", "0.6638671", "0.66362274", "0.6627889", "0.6624111", "0.66227144", "0.66214424", "0.6620719", "0.6620448", "0.6617982", "0.66154635", "0.66154635", "0.6607463", "0.6607422", "0.6599277", "0.6594604", "0.65716594", "0.6568499", "0.6568499", "0.6563214", "0.6562145", "0.6560446", "0.655417", "0.6552431", "0.6543489", "0.6541274", "0.65406346", "0.65317804", "0.6531767", "0.6531387", "0.6526412", "0.6526257", "0.6526185", "0.6525568", "0.65154475", "0.65123165", "0.6508156", "0.65073186", "0.65071917", "0.65011925", "0.6498583", "0.6495639", "0.6494585", "0.64912325", "0.6485636", "0.6485042", "0.6482581", "0.6479852", "0.6476442", "0.6474777", "0.6472813", "0.647265", "0.6464623", "0.6462749", "0.6458684", "0.64569986", "0.64565974", "0.6454962", "0.64544404", "0.64473563", "0.6445694", "0.64433604", "0.64433014", "0.6442369" ]
0.0
-1
POST /ocorrencias POST /ocorrencias.json
def create @ocorrencia = Ocorrencia.new(ocorrencia_params) respond_to do |format| if @ocorrencia.save format.html { redirect_to @ocorrencia, notice: 'Ocorrencia was successfully created.' } format.json { render action: 'show', status: :created, location: @ocorrencia } else format.html { render action: 'new' } format.json { render json: @ocorrencia.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def create\n @ocupacion = Ocupacion.new(ocupacion_params)\n\n respond_to do |format|\n if @ocupacion.save\n format.html { redirect_to @ocupacion, notice: 'Ocupacion was successfully created.' }\n format.json { render :show, status: :created, location: @ocupacion }\n else\n format.html { render :new }\n format.json { render json: @ocupacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cargo_eleicao = CargoEleicao.new(params[:cargo_eleicao])\n\n respond_to do |format|\n if @cargo_eleicao.save\n format.html { redirect_to @cargo_eleicao, notice: 'Cargo eleicao was successfully created.' }\n format.json { render json: @cargo_eleicao, status: :created, location: @cargo_eleicao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cargo_eleicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "def create\n @orador = Orador.new(params[:orador])\n\n respond_to do |format|\n if @orador.save\n format.html { redirect_to @orador, notice: 'Orador was successfully created.' }\n format.json { render json: @orador, status: :created, location: @orador }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @restora = Restora.new(restora_params)\n\n respond_to do |format|\n if @restora.save\n format.html { redirect_to @restora, notice: 'Restora was successfully created.' }\n format.json { render :show, status: :created, location: @restora }\n else\n format.html { render :new }\n format.json { render json: @restora.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @objeto = Carpeta.new(carpeta_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Carpeta was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def troca\n @remetente = Sobrevivente.where(id: params[:de]).first\n @destinatario = Sobrevivente.where(id: params[:para]).first\n\n enviar = {agua: 1, comida: 2, medicamento: 3, municao: 4}\n receber = {agua: 0, comida: 2, medicamento: 3, municao: 8}\n\n trocou = @remetente.troca(@destinatario, enviar, receber)\n\n render json: { status: trocou }\n end", "def create\n @obra = Obra.new(params[:obra])\n\n respond_to do |format|\n if @obra.save\n format.html { redirect_to @obra, notice: 'Obra was successfully created.' }\n format.json { render json: @obra, status: :created, location: @obra }\n else\n format.html { render action: \"new\" }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ativo_outro = AtivoOutro.new(params[:ativo_outro])\n\n respond_to do |format|\n if @ativo_outro.save\n format.html { redirect_to @ativo_outro, notice: 'Ativo foi salvo com sucesso.' }\n format.json { render json: @ativo_outro, status: :created, location: @ativo_outro }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ativo_outro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reconocimiento = Reconocimiento.new(params[:reconocimiento])\n\n respond_to do |format|\n if @reconocimiento.save\n format.html { redirect_to @reconocimiento, :notice => 'Reconocimiento was successfully created.' }\n format.json { render :json => @reconocimiento, :status => :created, :location => @reconocimiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @reconocimiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @restricao = Restricao.new(restricao_params)\n\n respond_to do |format|\n if @restricao.save\n format.html { redirect_to restricaos_path, notice: 'Restrição foi Criada com Sucesso!' }\n # format.json { render :show, status: :created, location: @restricao }\n else\n format.html { render :new }\n format.json { render json: @restricao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @agronomiaquimica = Agronomiaquimica.new(params[:agronomiaquimica])\n\n respond_to do |format|\n if @agronomiaquimica.save\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully created.' }\n format.json { render json: @agronomiaquimica, status: :created, location: @agronomiaquimica }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @orden_cobro = OrdenCobro.new(params[:orden_cobro])\n\n respond_to do |format|\n if @orden_cobro.save\n format.html { redirect_to @orden_cobro, notice: 'Orden cobro was successfully created.' }\n format.json { render json: @orden_cobro, status: :created, location: @orden_cobro }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orden_cobro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @resto = Resto.new(resto_params)\n\n respond_to do |format|\n if @resto.save\n format.html { redirect_to @resto, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @resto }\n else\n format.html { render :new }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @orcamento = Orcamento.new(orcamento_params)\n\n respond_to do |format|\n if @orcamento.save\n format.html { redirect_to @orcamento, notice: 'Orcamento criado com sucesso!' }\n format.json { render :show, status: :created, location: @orcamento }\n else\n format.html { render :new }\n format.json { render json: @orcamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def crear\n # byebug\n ruta = Ruta.new\n ruta.nombre = params[:ruta][:nombre]\n ruta.descripcion = params[:ruta][:descripcion]\n ruta.subruta = params[:ruta][:subruta]\n ruta.save\n redirect_to action: \"index\"\n\n # respond_to do |format|\n # if @ruta.save\n # format.html { redirect_to @ruta, notice: \"Rutum was successfully created.\" }\n # format.json { render :show, status: :created, location: @ruta }\n # else\n # format.html { render :new }\n # format.json { render json: @ruta.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @reparticao = Reparticao.new(reparticao_params)\n\n respond_to do |format|\n if @reparticao.save\n format.html { redirect_to @reparticao, notice: 'Reparticao was successfully created.' }\n format.json { render :show, status: :created, location: @reparticao }\n else\n format.html { render :new }\n format.json { render json: @reparticao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @asiento = Asiento.new(params[:asiento])\n\n respond_to do |format|\n if @asiento.save\n format.html { redirect_to @asiento, :notice => 'El apunte fue creado.' }\n format.json { render :json => @asiento, :status => :created, :location => @asiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @obra = Obra.new(obra_params)\n\n respond_to do |format|\n if @obra.save\n format.html { redirect_to @obra, notice: 'Obra was successfully created.' }\n format.json { render action: 'show', status: :created, location: @obra }\n else\n format.html { render action: 'new' }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @socio = Socio.new(params[:socio])\n\n respond_to do |format|\n if @socio.save\n format.html { redirect_to @socio, :notice => 'Socio cadastrado com sucesso.' }\n format.json { render :json => @socio, :status => :created, :location => @socio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @regra_negocio = RegraNegocio.new(regra_negocio_params)\n\n respond_to do |format|\n if @regra_negocio.save\n format.html { redirect_to @regra_negocio, notice: 'Regra negocio was successfully created.' }\n format.json { render :show, status: :created, location: @regra_negocio }\n else\n format.html { render :new }\n format.json { render json: @regra_negocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @objeto = Caracteristica.new(caracteristica_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Caracteristica was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inventario_cosa = InventarioCosa.new(inventario_cosa_params)\n\n respond_to do |format|\n if @inventario_cosa.save\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully created.' }\n format.json { render :show, status: :created, location: @inventario_cosa }\n else\n format.html { render :new }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @opcao = Opcao.new(opcao_params)\n\n respond_to do |format|\n if @opcao.save\n format.html { redirect_to @opcao, notice: 'Opção criada com sucesso!' }\n format.json { render :show, status: :created, location: @opcao }\n else\n format.html { render :new }\n format.json { render json: @opcao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "def create\n @regraponto = Regraponto.new(regraponto_params)\n\n respond_to do |format|\n if @regraponto.save\n format.html { redirect_to @regraponto, notice: 'Regraponto was successfully created.' }\n format.json { render :show, status: :created, location: @regraponto }\n else\n format.html { render :new }\n format.json { render json: @regraponto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @oc_rcibida = OcRcibida.new(oc_rcibida_params)\n\n respond_to do |format|\n if @oc_rcibida.save\n format.html { redirect_to @oc_rcibida, notice: 'Oc rcibida was successfully created.' }\n format.json { render :show, status: :created, location: @oc_rcibida }\n else\n format.html { render :new }\n format.json { render json: @oc_rcibida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @oeuvre = Oeuvre.new(oeuvre_params)\n\n respond_to do |format|\n if @oeuvre.save\n format.html { redirect_to oeuvres_url, notice: 'Oeuvre was successfully created.' }\n format.json { render :show, status: :created, location: @oeuvre }\n else\n format.html { render :new }\n format.json { render json: @oeuvre.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @obra = Obra.new(obra_params)\n\n respond_to do |format|\n if @obra.save\n format.html { redirect_to @obra, notice: 'Obra foi criada com sucesso!' }\n format.json { render :show, status: :created, location: @obra }\n else\n format.html { render :new }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @corrida = Corrida.new(corrida_params)\n\n respond_to do |format|\n if @corrida.save\n format.html { redirect_to @corrida, notice: 'Corrida creada satisfactoriamente.' }\n format.json { render :show, status: :created, location: @corrida }\n else\n format.html { render :new }\n format.json { render json: @corrida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipoapreensao = Tipoapreensao.new(tipoapreensao_params)\n\n respond_to do |format|\n if @tipoapreensao.save\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoapreensao }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n seleccionarMenu(:rondas)\n @ronda = current_usuario.rondas.build(params[:ronda])\n\n respond_to do |format|\n if @ronda.save\n format.html { redirect_to @ronda, notice: 'Ronda creada satisfactoriamente.' }\n format.json { render json: @ronda, status: :created, location: @ronda }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ronda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recaudacion = Recaudacion.new(recaudacion_params)\n\n respond_to do |format|\n if @recaudacion.save\n format.html { redirect_to @recaudacion, notice: 'Recaudacion was successfully created.' }\n format.json { render :show, status: :created, location: @recaudacion }\n else\n format.html { render :new }\n format.json { render json: @recaudacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @atracao = Atracao.new(params[:atracao])\n\n respond_to do |format|\n if @atracao.save\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully created.' }\n format.json { render :json => @atracao, :status => :created, :location => @atracao }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @rego = Rego.new(rego_params)\n\n respond_to do |format|\n if @rego.save\n format.html { redirect_to @rego, notice: 'Rego was successfully created.' }\n format.json { render :show, status: :created, location: @rego }\n else\n format.html { render :new }\n format.json { render json: @rego.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ruolo = Ruolo.new(ruolo_params)\n\n respond_to do |format|\n if @ruolo.save\n format.html { redirect_to @ruolo, notice: 'Ruolo was successfully created.' }\n format.json { render :show, status: :created, location: @ruolo }\n else\n format.html { render :new }\n format.json { render json: @ruolo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @anteproyecto_observacion = AnteproyectoObservacion.new(anteproyecto_observacion_params)\n\n respond_to do |format|\n if @anteproyecto_observacion.save\n format.html { redirect_to @anteproyecto_observacion, notice: 'Anteproyecto observacion was successfully created.' }\n format.json { render :show, status: :created, location: @anteproyecto_observacion }\n else\n format.html { render :new }\n format.json { render json: @anteproyecto_observacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @escola = Escola.new(params[:escola])\n\n respond_to do |format|\n if @escola.save\n format.html { redirect_to @escola, :notice => 'Escola was successfully created.' }\n format.json { render :json => @escola, :status => :created, :location => @escola }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @escola.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @areco = Areco.new(params[:areco])\n\n respond_to do |format|\n if @areco.save\n format.html { redirect_to @areco, notice: 'Areco was successfully created.' }\n format.json { render json: @areco, status: :created, location: @areco }\n else\n format.html { render action: \"new\" }\n format.json { render json: @areco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @selecao = Selecao.new(params[:selecao])\n\n respond_to do |format|\n if @selecao.save\n format.html { redirect_to @selecao, notice: 'Selecao was successfully created.' }\n format.json { render json: @selecao, status: :created, location: @selecao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @selecao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @anuncio = Anuncio.new(anuncio_params)\n\n if @anuncio.save\n render :show, status: :created, location: @anuncio\n else\n render json: @anuncio.errors, status: :unprocessable_entity\n end\n end", "def create\n @ocs_generada = OcsGenerada.new(ocs_generada_params)\n\n respond_to do |format|\n if @ocs_generada.save\n format.html { redirect_to @ocs_generada, notice: 'Ocs generada was successfully created.' }\n format.json { render :show, status: :created, location: @ocs_generada }\n else\n format.html { render :new }\n format.json { render json: @ocs_generada.errors, status: :unprocessable_entity }\n end\n end\n end", "def criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end", "def create\n @cegreso = Cegreso.new(cegreso_params)\n\n respond_to do |format|\n if @cegreso.save\n format.html { redirect_to @cegreso, notice: 'Cegreso was successfully created.' }\n format.json { render :show, status: :created, location: @cegreso }\n else\n format.html { render :new }\n format.json { render json: @cegreso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @objeto = Revista.new(revista_params)\n\n respond_to do |format|\n if @objeto.save\n format.html { redirect_to @objeto, notice: 'Revista was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @prepagada = Prepagada.new({ :prepagada => params[:prepagada], :odontologo_id => params[:odontologo_id] })\n\n respond_to do |format|\n if @prepagada.save\n format.html { redirect_to @prepagada, notice: 'Prepagada was successfully created.' }\n format.json { render json: @prepagada, status: :created, location: @prepagada }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prepagada.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @consumo = Consumo.new(params[:consumo])\n\n respond_to do |format|\n if @consumo.save\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo adicionado com sucesso.' }\n format.json { render :json => @consumo, :status => :created, :location => @consumo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n client = Cliente.new\n\n client.nombre = params[:nombre]\n client.cedula = params[:cedula]\n client.pagina = params[:pagina]\n\n client.dirrecion = params[:dirrecion]\n client.telefono = params[:telefono]\n \n client.sector = params[:sector]\n \n\n if client.save\n \n\n render(json: client,status: 201 ,location: client)\n else\n\n render(json: client.errors,status: 422 )\n\n end\n end", "def create\n @tipoocorrencium = Tipoocorrencium.new(tipoocorrencium_params)\n\n respond_to do |format|\n if @tipoocorrencium.save\n format.html { redirect_to @tipoocorrencium, notice: 'Tipoocorrencium was successfully created.' }\n format.json { render :show, status: :created, location: @tipoocorrencium }\n else\n format.html { render :new }\n format.json { render json: @tipoocorrencium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params.permit(:intitule, :estObligatoire, :nombreDeCaractere, :ordre, :sondage_id)\n ajout = QuestionOuverteService.instance.creerQuestionOuverte(params[:intitule], params[:estObligatoire], params[:nombreDeCaractere], params[:ordre], params[:sondage_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def create\n @asociacion = Asociacion.new(asociacion_params)\n\n respond_to do |format|\n if @asociacion.save\n format.html { redirect_to @asociacion, notice: 'Asociacion was successfully created.' }\n format.json { render :show, status: :created, location: @asociacion }\n else\n format.html { render :new }\n format.json { render json: @asociacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cooperativa = Cooperativa.new(params[:cooperativa])\n\n respond_to do |format|\n if @cooperativa.save\n format.html { redirect_to [:admin, @cooperativa], :notice => 'Exemplo was successfully created.' }\n format.json { render :json => @cooperativa, :status => :created, :location => @cooperativa }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cooperativa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @recurso = Recurso.new(params[:recurso])\n\n respond_to do |format|\n if @recurso.save\n format.html { redirect_to @recurso, notice: 'O recurso de auto de infração foi criado com sucesso.' }\n format.json { render json: @recurso, status: :created, location: @recurso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @obra_proyecto = ObraProyecto.new(obra_proyecto_params)\n\n respond_to do |format|\n if @obra_proyecto.save\n format.html { redirect_to @obra_proyecto, notice: 'La obra/proyecto fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @obra_proyecto }\n else\n format.html { render :new }\n format.json { render json: @obra_proyecto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully created.' }\n format.json { render :json => @tecnico, :status => :created, :location => @tecnico }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @comentario = Comentario.new(comentario_params)\n\n respond_to do |format|\n if @comentario.save\n format.html { redirect_to restaurante_comentarios_path(@comentario), notice: 'Plato was successfully created.' }\n format.json { render :show, status: :created, location: @restaurante }\n else\n format.html { render :new }\n format.json { render json: @comentario.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 @congresso = Congresso.new(congresso_params)\n\n respond_to do |format|\n if @congresso.save\n format.html { redirect_to @congresso, notice: 'Congresso was successfully created.' }\n format.json { render :show, status: :created, location: @congresso }\n else\n format.html { render :new }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cliente = Cliente.new\n if params[:type] == \"PessoaFisica\"\n @cliente.pessoa = PessoaFisica.new\n else\n @cliente.pessoa = PessoaJuridica.new\n end\n @cliente.assign_attributes(cliente_params)\n respond_to do |format|\n if @cliente.save\n format.html { redirect_to action: \"index\"}\n format.json { render json: @cliente.to_json(include: [:pessoa]) }\n else\n format.html { render :new }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_orcamento\n @produto = Produto.new(produto_params)\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to edit_produto_path(@produto), notice: '' }\n format.json { render :show, status: :created, location: @produto }\n else\n format.html { render :new }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @informativo_obra = InformativoObra.new(informativo_obra_params)\n\n @status = Statusobra.find_by_statusobra_type(\"Salvo\")\n @informativo_obra.statusobra_id = @status.id\n\n respond_to do |format|\n if @informativo_obra.save\n format.html { redirect_to @informativo_obra, notice: 'Informativo de obra foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @informativo_obra }\n else\n format.html { render :new }\n format.json { render json: @informativo_obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @remito = Remito.new(params[:remito])\n\n respond_to do |format|\n if @remito.save\n format.html { redirect_to @remito, notice: 'Remito was successfully created.' }\n format.json { render json: @remito, status: :created, location: @remito }\n else\n format.html { render action: \"new\" }\n format.json { render json: @remito.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @acuerdo = Acuerdo.new(params[:acuerdo])\n\n respond_to do |format|\n if @acuerdo.save\n format.html { redirect_to @acuerdo, notice: 'Acuerdo was successfully created.' }\n format.json { render json: @acuerdo, status: :created, location: @acuerdo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @acuerdo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @troca_produto = TrocaProduto.new(troca_produto_params)\n\n respond_to do |format|\n if @troca_produto.save\n format.html { redirect_to @troca_produto, notice: \"Troca produto was successfully created.\" }\n format.json { render :show, status: :created, location: @troca_produto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @troca_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @uni_aso = UniAso.new(uni_aso_params)\n\n respond_to do |format|\n if @uni_aso.save\n format.html { redirect_to @uni_aso, notice: 'Uni aso was successfully created.' }\n format.json { render :show, status: :created, location: @uni_aso }\n else\n format.html { render :new }\n format.json { render json: @uni_aso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #return render json: params[:recursos]\n @area = Area.new(area_params)\n @count = 0\n save_multiples_recursos if params[:recursos][:status] == '1'\n respond_to do |format|\n if @area.save\n format.html { redirect_to areas_path, notice: 'El Área fue creada éxitosamente.' }\n format.json { render :show, status: :created, location: @area }\n else\n format.html { render :new }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @onda = Onda.new(onda_params)\n\n respond_to do |format|\n if @onda.save\n format.html { redirect_to ondas_path, notice: 'Onda was successfully created.' }\n format.json { render :show, status: :created, location: @onda }\n else\n format.html { render :new }\n format.json { render json: @onda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @carrera = Carrera.new(params[:carrera])\n\n respond_to do |format|\n if @carrera.save\n format.html { redirect_to @carrera, notice: 'Carrera was successfully created.' }\n format.json { render json: @carrera, status: :created, location: @carrera }\n else\n format.html { render action: \"new\" }\n format.json { render json: @carrera.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @objeto = Cliente.new(cliente_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Cliente was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @razones_sociale = RazonesSociale.find(params[:razones_comerciale][:razones_sociale_id])\n @razones_comerciale = @razones_sociale.razones_comerciales.build(razones_comerciale_params)\n\n respond_to do |format|\n if @razones_comerciale.save\n format.html { redirect_to @razones_comerciale, notice: 'Razones comerciale was successfully created.' }\n format.json { render :show, status: :created, location: @razones_comerciale }\n else\n format.html { render :new }\n format.json { render json: @razones_comerciale.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @accesorio = Accesorio.new(params[:accesorio])\n\n respond_to do |format|\n if @accesorio.save\n format.html { redirect_to @accesorio, notice: 'Accesorio was successfully created.' }\n format.json { render json: @accesorio, status: :created, location: @accesorio }\n else\n format.html { render \"new\" }\n format.json { render json: @accesorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, :notice => 'Premio was successfully created.' }\n format.json { render :json => @premio, :status => :created, :location => @premio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @competicao = Competicao.new(params[:competicao])\n\n respond_to do |format|\n if @competicao.save\n format.html { redirect_to @competicao, notice: 'Competicao was successfully created.' }\n format.json { render json: @competicao, status: :created, location: @competicao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n\r\n respond_to do |format|\r\n if @electronica_consejero.save\r\n format.html { redirect_to @electronica_consejero, notice: 'Se añadió un nombre de consejero de ingeniería electrónica correctamente.' }\r\n format.json { render :show, status: :created, location: @electronica_consejero }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @electronica_consejero.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @administracao_rota = Administracao::Rota.new(administracao_rota_params)\n\n respond_to do |format|\n if @administracao_rota.save\n format.html { redirect_to @administracao_rota, notice: 'Rota foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @administracao_rota }\n else\n format.html { render :new }\n format.json { render json: @administracao_rota.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n\r\n respond_to do |format|\r\n if @electrica_consejero.save\r\n format.html { redirect_to @electrica_consejero, notice: 'Se añadió un nombre de consejero de ingeniería eléctrica correctamente.' }\r\n format.json { render :show, status: :created, location: @electrica_consejero }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @electrica_consejero.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def ocorrencia_params\n params.require(:ocorrencia).permit(:ocolocal, :ocostatus, :ocomunicipio, :ocosentido, :ocodataocorrencia, :ocodataregistro, :ocotipo, :ococomid, :ocoidorigem, :ococpfretif, :ococpfretif)\n end", "def create\n @consorciot = Consorciot.new(consorciot_params)\n\n respond_to do |format|\n if @consorciot.save\n format.html { redirect_to @consorciot, notice: 'Consorciot was successfully created.' }\n format.json { render :show, status: :created, location: @consorciot }\n else\n format.html { render :new }\n format.json { render json: @consorciot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @oferta = Oferta.new(params[:oferta])\n\n respond_to do |format|\n if @oferta.save\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully created.' }\n format.json { render :json => @oferta, :status => :created, :location => @oferta }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @odontologia1 = Odontologia1.new(params[:odontologia1])\n\n respond_to do |format|\n if @odontologia1.save\n format.html { redirect_to @odontologia1, notice: 'Odontologia1 was successfully created.' }\n format.json { render json: @odontologia1, status: :created, location: @odontologia1 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @odontologia1.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @torneo_apartura = TorneoApartura.new(torneo_apartura_params)\n\n respond_to do |format|\n if @torneo_apartura.save\n format.html { redirect_to @torneo_apartura, notice: 'Torneo apartura was successfully created.' }\n format.json { render :show, status: :created, location: @torneo_apartura }\n else\n format.html { render :new }\n format.json { render json: @torneo_apartura.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_orden = TipoOrden.new(tipo_orden_params)\n\n respond_to do |format|\n if @tipo_orden.save\n format.html { redirect_to @tipo_orden, notice: 'Tipo orden was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_orden }\n else\n format.html { render :new }\n format.json { render json: @tipo_orden.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reparacion = Reparacion.new(params[:reparacion])\n\n respond_to do |format|\n if @reparacion.save\n format.html { redirect_to @reparacion, notice: 'Reparacion se ha creado con éxito.' }\n format.json { render json: @reparacion, status: :created, location: @reparacion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reparacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end", "def create\n @resa = Resa.new(resa_params)\n respond_to do |format|\n if @resa.save\n format.html { redirect_to edit_resa_path(@resa), notice: 'Mis à jour réussie' }\n format.json { render action: 'show', status: :created, location: @resa }\n else\n format.html { render action: 'new' }\n format.json { render json: @resa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @archdiocese = Archdiocese.new(archdiocese_params)\n\n if @archdiocese.save\n render json: @archdiocese, status: :created, location: @archdiocese\n else\n render json: @archdiocese.errors, status: :unprocessable_entity\n end\n end", "def create\n @acao = Acao.new(params[:acao])\n\n respond_to do |format|\n if @acao.save\n format.html { redirect_to @acao, notice: 'Acao criada.' }\n format.json { render json: @acao, status: :created, location: @acao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @acao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @carro = @patio.carros.new(carro_params)\n\n respond_to do |format|\n if @carro.save\n format.html { redirect_to [@unidade, @patio, @carro], notice: 'Carro was successfully created.' }\n format.json { render :show, status: :created, location: [@unidade, @patio, @carro] }\n else\n format.html { render :new }\n format.json { render json: @carro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @redacao = Redacao.new(redacao_params)\n\n respond_to do |format|\n if @redacao.save\n format.html { redirect_to @redacao, notice: 'Redacao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @redacao }\n else\n format.html { render action: 'new' }\n format.json { render json: @redacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @relogio = Relogio.new(params[:relogio])\n\n respond_to do |format|\n if @relogio.save\n format.html { redirect_to @relogio, notice: 'Relogio was successfully created.' }\n format.json { render json: @relogio, status: :created, location: @relogio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @relogio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estatuto = Estatuto.new(params[:estatuto])\n\n respond_to do |format|\n if @estatuto.save\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully created.' }\n format.json { render json: @estatuto, status: :created, location: @estatuto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ano = Ano.new(params[:ano])\n\n respond_to do |format|\n if @ano.save\n format.html { redirect_to @ano, notice: 'Ano was successfully created.' }\n format.json { render json: @ano, status: :created, location: @ano }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ano.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @safra_verdoso = SafraVerdoso.new(params[:safra_verdoso])\n\n respond_to do |format|\n if @safra_verdoso.save\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { render json: @safra_verdoso, status: :created, location: @safra_verdoso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, notice: 'Tecnico criado com sucesso.' }\n format.json { render json: @tecnico, status: :created, location: @tecnico }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aseguradora = Aseguradora.new(aseguradora_params)\n\n respond_to do |format|\n if @aseguradora.save\n format.html { redirect_to backoffice_aseguradoras_path, notice: 'Aseguradora creado con exito.' }\n format.json { render :show, status: :created, location: @aseguradora }\n else\n format.html { render :new }\n format.json { render json: @aseguradora.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n @lancamentorapido = Lancamentorapido.new(params[:lancamentorapido])\n \n #Validações padrão\n @lancamentorapido.tipo = :receita if @lancamentorapido.tipo.blank?\n @lancamentorapido.valor = 0 if @lancamentorapido.valor.blank? \n \n respond_to do |format|\n if @lancamentorapido.save\n format.html { redirect_to lancamentorapidos_path, notice: 'Lancamento was successfully created.' } \n# format.html { redirect_to '/lancamentorapidos'}\n format.json { render json: lancamentorapidos_path, status: :created, location: @lancamentorapido }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lancamentorapido.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @relatorio_pedagogicos = RelatorioPedagogico.all\n authorize @relatorio_pedagogicos\n\n @relatorio_pedagogico = RelatorioPedagogico.new(relatorio_pedagogico_params)\n\n respond_to do |format|\n if @relatorio_pedagogico.save\n format.html { redirect_to @relatorio_pedagogico, notice: 'Relatório pedagógico criado com sucesso!' }\n format.json { render :show, status: :created, location: @relatorio_pedagogico }\n else\n format.html { render :new }\n format.json { render json: @relatorio_pedagogico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sugerencia = Sugerencia.new(params[:sugerencia])\n\n respond_to do |format|\n if @sugerencia.save\n format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully created.' }\n format.json { render :json => @sugerencia, :status => :created, :location => @sugerencia }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sugerencia.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.69658506", "0.64515084", "0.64445317", "0.6438216", "0.6412335", "0.638665", "0.63558", "0.63437164", "0.63252586", "0.6308761", "0.6301593", "0.6300208", "0.62985927", "0.6287717", "0.62838745", "0.626511", "0.62568045", "0.62283695", "0.6221246", "0.6209818", "0.62061137", "0.61915714", "0.61912453", "0.61899793", "0.61792266", "0.6174283", "0.6164218", "0.6164083", "0.6162831", "0.6162547", "0.6153333", "0.61515534", "0.61486316", "0.6140621", "0.61345506", "0.613085", "0.6121194", "0.6118755", "0.6105806", "0.6103291", "0.6102791", "0.60927373", "0.6090479", "0.60815704", "0.6080347", "0.6072839", "0.60716575", "0.6071577", "0.6069501", "0.6063541", "0.60609686", "0.6054059", "0.60514754", "0.60491544", "0.60488", "0.60436505", "0.6032743", "0.6028252", "0.60223186", "0.60183287", "0.60166156", "0.60121757", "0.6009484", "0.6001787", "0.5996105", "0.5983385", "0.5976527", "0.5974678", "0.5973454", "0.59711057", "0.5969065", "0.59684587", "0.59653676", "0.59641266", "0.5962364", "0.5961575", "0.5956126", "0.5952958", "0.59494346", "0.59486735", "0.59468085", "0.59451455", "0.59444284", "0.59417", "0.59400874", "0.5938681", "0.5937292", "0.59369755", "0.593405", "0.5926965", "0.592656", "0.59248066", "0.59221226", "0.59177816", "0.5916227", "0.5914853", "0.59146905", "0.5911304", "0.5911133", "0.5905802" ]
0.66312194
1
PATCH/PUT /ocorrencias/1 PATCH/PUT /ocorrencias/1.json
def update respond_to do |format| if @ocorrencia.update(ocorrencia_params) format.html { redirect_to @ocorrencia, notice: 'Ocorrencia was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @ocorrencia.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redirect_to @resto, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @resto }\n else\n format.html { render :edit }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @opcao.update(opcao_params)\n format.html { redirect_to @opcao, notice: 'Opcao atualizada com sucesso!' }\n format.json { render :show, status: :ok, location: @opcao }\n else\n format.html { render :edit }\n format.json { render json: @opcao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(carpeta_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Carpeta was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n if @cargo_eleicao.update_attributes(params[:cargo_eleicao])\n format.html { redirect_to @cargo_eleicao, notice: 'Cargo eleicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cargo_eleicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @restora.update(restora_params)\n format.html { redirect_to @restora, notice: 'Restora was successfully updated.' }\n format.json { render :show, status: :ok, location: @restora }\n else\n format.html { render :edit }\n format.json { render json: @restora.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n if @recurso.update_attributes(params[:recurso])\n format.html { redirect_to @recurso, notice: 'O recurso de auto de infração foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @obra.update(obra_params)\n format.html { redirect_to @obra, notice: 'Obra was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(revista_params)\n format.html { redirect_to @objeto, notice: 'Revista was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n if @selecao.update_attributes(params[:selecao])\n format.html { redirect_to @selecao, notice: 'Selecao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @selecao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @corrida.update(corrida_params)\n format.html { redirect_to @corrida, notice: 'Corrida actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @corrida }\n else\n format.html { render :edit }\n format.json { render json: @corrida.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n if @atracao.update_attributes(params[:atracao])\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @caso.update_attributes(caso_params)\n format.html { redirect_to @caso, notice: 'Caso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @caso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n if @ativo_outro.update_attributes(params[:ativo_outro])\n format.html { redirect_to @ativo_outro, notice: 'Ativo foi salvo com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ativo_outro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @obra = Obra.find(params[:id])\n\n respond_to do |format|\n if @obra.update_attributes(params[:obra])\n format.html { redirect_to @obra, notice: 'Obra was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @obra.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 @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n if @asiento.update_attributes(params[:asiento])\n format.html { redirect_to @asiento, :notice => 'El apunte fue cambiado.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n @ore = Ore.find(params[:id])\n \n respond_to do |format|\n if @ore.update_attributes(params[:ore])\n format.html { redirect_to @ore, notice: 'Ore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ore.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update\n respond_to do |format|\n if @objeto.update(cliente_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apoio.update(apoio_params)\n format.html { redirect_to @apoio, notice: 'Apoio was successfully updated.' }\n format.json { render :show, status: :ok, location: @apoio }\n else\n format.html { render :edit }\n format.json { render json: @apoio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n if @safra_verdoso.update_attributes(params[:safra_verdoso])\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n if @caixa.update_attributes(params[:caixa])\n format.html { redirect_to @caixa, notice: 'Caixa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rotina.update(rotina_params)\n format.html { redirect_to rotinas_path, notice: 'Rotina atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rotina.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resa.update(resa_params)\n format.html { redirect_to edit_resa_path(@resa), notice: 'Resa was successfully updated.' }\n format.json { render json: @resa, status: :accepted }\n\n else\n format.html { render action: 'edit' }\n format.json { render json: @resa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n retorno = {erro: \"322\" ,body: \"\"}\n if @usuario.update(valid_request?)\n retorno = {erro: \"000\", body: {evento_id: @usuario.id, usuario_nome: @usuario.nome}}\n end\n render json: retorno.to_json\n end", "def update\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n if @pessoa.update_attributes(params[:pessoa])\n format.html { redirect_to pessoas_path, notice: 'Pessoa atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @acao = Acao.find(params[:id])\n\n respond_to do |format|\n if @acao.update_attributes(params[:acao])\n format.html { redirect_to acao_url(@acao), notice: 'Acao atualizada.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @acao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n if @os_tarefa.update(os_tarefa_params)\n #se as situacao da tarefa nao for aceita, altera a ordem_servico_pagamento para null\n if(@os_tarefa.situacao!=OsTarefa.situacoes[0] && @os_tarefa.situacao!=OsTarefa.situacoes[1])\n\n @os_tarefa.ordem_servico_pagamento=nil\n @os_tarefa.save\n end\n\n if @os_tarefa.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_tarefa.ordem_servico.id.to_s, notice: 'A Tarefa foi atualizado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_tarefa, notice: 'A Tarefa foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_tarefa }\n end\n else\n format.html { render :edit }\n format.json { render json: @os_tarefa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n if @areco.update_attributes(params[:areco])\n format.html { redirect_to @areco, notice: 'Areco was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @areco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @documentotipo = Documentotipo.find(params[:id])\n\n respond_to do |format|\n if @documentotipo.update_attributes(params[:documentotipo])\n format.html { redirect_to @documentotipo, notice: 'Documentotipo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @documentotipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ocorrencium.update(ocorrencium_params)\n format.html { redirect_to @ocorrencium, notice: 'Alteração realizada com sucesso.' }\n format.json { render :show, status: :ok, location: @ocorrencium }\n else\n format.html { render :edit }\n format.json { render json: @ocorrencium.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n if @competicao.update_attributes(params[:competicao])\n format.html { redirect_to @competicao, notice: 'Competicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @competicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cooperativa = Cooperativa.find(params[:id])\n\n respond_to do |format|\n if @cooperativa.update_attributes(params[:cooperativa])\n format.html { redirect_to [:admin, @cooperativa], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cooperativa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n if @socio.update_attributes(params[:socio])\n format.html { redirect_to @socio, :notice => 'Socio atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @socio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n \n respond_to do |format|\n if @conta.update(nome: conta_params[:nome], status: conta_params[:status], pai: pai) \n #format.json { render :show, status: :ok, location: @conta }\n format.json { render json: @conta.to_json, status: :ok }\n else \n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n if @tipo_negocio.update_attributes(params[:tipo_negocio])\n format.html { redirect_to @tipo_negocio, notice: 'Tipo negocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_negocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_celula.update(sivic_celula_params)\r\n format.html { redirect_to @sivic_celula, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_celula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n if @reconocimiento.update_attributes(params[:reconocimiento])\n format.html { redirect_to @reconocimiento, :notice => 'Reconocimiento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @reconocimiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @obra.update(obra_params)\n format.html { redirect_to @obra, notice: 'A obra foi atualizada com sucesso!' }\n format.json { render :show, status: :ok, location: @obra }\n else\n format.html { render :edit }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_compra.update(tipo_compra_params)\n format.html { redirect_to @tipo_compra, notice: 'Tipo compra was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_compra }\n else\n format.html { render :edit }\n format.json { render json: @tipo_compra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @administracao_rota.update(administracao_rota_params)\n format.html { redirect_to @administracao_rota, notice: 'Rota foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @administracao_rota }\n else\n format.html { render :edit }\n format.json { render json: @administracao_rota.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @protocolo.update(protocolo_params)\n addlog(\"Protocolo alterado\")\n format.html { redirect_to @protocolo, notice: 'Protocolo foi atualizado.' }\n format.json { render :show, status: :ok, location: @protocolo }\n else\n format.html { render :edit }\n format.json { render json: @protocolo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @parola.update(parola_params)\n format.html { redirect_to parolas_url, notice: 'Parola was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @parola.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @poligono.update(poligono_params)\n format.html { redirect_to @poligono, notice: 'Poligono was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @poligono.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pessoa.update(pessoa_params)\n format.html { redirect_to @pessoa, notice: 'Cadastro alterado com sucesso!.' }\n format.json { render :show, status: :ok, location: @pessoa }\n else\n format.html { render :edit }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(requisito_params)\n format.html { redirect_to @objeto, notice: \"Requisito was successfully updated.\" }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @compra_venta_normal.update(compra_venta_normal_params)\n format.html { redirect_to @compra_venta_normal, notice: 'Compra venta normal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @compra_venta_normal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @escola = Escola.find(params[:id])\n\n respond_to do |format|\n if @escola.update_attributes(params[:escola])\n format.html { redirect_to @escola, :notice => 'Escola was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @escola.errors, :status => :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(cita_params)\n format.html { redirect_to @objeto, notice: \"Cita was successfully updated.\" }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, Concepto\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map { |k, _v| k }\n else\n params[:concepto][:tipo_ids] = []\n end\n\n respond_to do |format|\n if @concepto.update(concepto_params)\n\n\n format.html { redirect_to @concepto, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos del concepto fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @concepto }\n else\n format.html { render :edit } if params[:concepto][:tipo_ids]\n format.json { render json: @concepto.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 @reparticao.update(reparticao_params)\n format.html { redirect_to @reparticao, notice: 'Reparticao was successfully updated.' }\n format.json { render :show, status: :ok, location: @reparticao }\n else\n format.html { render :edit }\n format.json { render json: @reparticao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @nota_tecnica.update(nota_tecnica_params)\n format.html { redirect_to @nota_tecnica, notice: 'Nota tecnica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nota_tecnica.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @colaborador.update(colaborador_params)\n format.html { redirect_to @colaborador, notice: 'Colaborador atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @colaborador.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @noto = Noto.find(params[:id])\n\n respond_to do |format|\n if @noto.update_attributes(params[:noto])\n format.html { redirect_to @noto, :notice => 'Noto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @noto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cegreso.update(cegreso_params)\n format.html { redirect_to @cegreso, notice: 'Cegreso was successfully updated.' }\n format.json { render :show, status: :ok, location: @cegreso }\n else\n format.html { render :edit }\n format.json { render json: @cegreso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n set_funcionario\n if @ordem_servico.update(ordem_servico_params)\n format.html { redirect_to @ordem_servico, notice: t('messages.cadastro_atualizado') }\n format.json { render :show, status: :ok, location: @ordem_servico }\n else\n format.html { render :edit }\n format.json { render json: @ordem_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @robo.update(robo_params)\n format.html { redirect_to @robo, notice: 'Robo was successfully updated.' }\n format.json { render :show, status: :ok, location: @robo }\n else\n format.html { render :edit }\n format.json { render json: @robo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n if @comentario.update_attributes(params[:comentario])\n format.html { redirect_to @comentario, notice: 'Comentario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comentario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @orador = Orador.find(params[:id])\n\n respond_to do |format|\n if @orador.update_attributes(params[:orador])\n format.html { redirect_to @orador, notice: 'Orador was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orador.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @aquisicao.update(aquisicao_params)\n format.html { redirect_to @aquisicao, notice: 'Aquisicao was successfully updated.' }\n format.json { render :show, status: :ok, location: @aquisicao }\n else\n format.html { render :edit }\n format.json { render json: @aquisicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @caixa.update(caixa_params)\n format.html { redirect_to @caixa, notice: 'Caixa was successfully updated.' }\n format.json { render :show, status: :ok, location: @caixa }\n else\n format.html { render :edit }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ocupacion.update(ocupacion_params)\n format.html { redirect_to @ocupacion, notice: 'Ocupacion was successfully updated.' }\n format.json { render :show, status: :ok, location: @ocupacion }\n else\n format.html { render :edit }\n format.json { render json: @ocupacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(etiqueta_params)\n format.html { redirect_to @objeto, notice: 'Etiqueta was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update\n @tipo_documento = TipoDocumento.find(params[:id])\n\n respond_to do |format|\n if @tipo_documento.update_attributes(params[:tipo_documento])\n format.html { redirect_to @tipo_documento, notice: 'Tipo documento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_documento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipoenvolvido.update(tipoenvolvido_params)\n format.html { redirect_to @tipoenvolvido, notice: 'Tipoenvolvido was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoenvolvido.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kodomo.update(kodomo_params)\n format.html { redirect_to @kodomo, notice: 'Kodomo was successfully updated.' }\n format.json { render :show, status: :ok, location: @kodomo }\n else\n format.html { render :edit }\n format.json { render json: @kodomo.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n if @remito.update_attributes(params[:remito])\n format.html { redirect_to @remito, notice: 'Remito was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @remito.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @anexo_relatorio_colaborador.update(anexo_relatorio_colaborador_params)\n format.html { redirect_to @anexo_relatorio_colaborador, notice: 'Anexo relatorio colaborador was successfully updated.' }\n format.json { render :show, status: :ok, location: @anexo_relatorio_colaborador }\n else\n format.html { render :edit }\n format.json { render json: @anexo_relatorio_colaborador.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @soatseguro.update(soatseguro_params)\n format.html { redirect_to @soatseguro, notice: 'Soatseguro was successfully updated.' }\n format.json { render :show, status: :ok, location: @soatseguro }\n else\n format.html { render :edit }\n format.json { render json: @soatseguro.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.65316164", "0.6483392", "0.6450348", "0.64107937", "0.6378865", "0.6342928", "0.63359034", "0.63143235", "0.63059163", "0.6296044", "0.6295954", "0.62866074", "0.6278884", "0.62715554", "0.62698233", "0.6269008", "0.62531286", "0.6251403", "0.6248422", "0.624783", "0.624637", "0.624637", "0.6245827", "0.62373215", "0.6219801", "0.6212434", "0.62118363", "0.6203595", "0.61998117", "0.619745", "0.619745", "0.6194832", "0.6194583", "0.6186506", "0.6186506", "0.6173723", "0.6169547", "0.6165657", "0.6164603", "0.615675", "0.6153213", "0.6151021", "0.6144695", "0.6140716", "0.6138098", "0.6135787", "0.6122413", "0.61212033", "0.6119929", "0.6115086", "0.6112412", "0.610821", "0.6107682", "0.6107266", "0.6106806", "0.6106737", "0.6106001", "0.6103766", "0.6102087", "0.6096981", "0.6092173", "0.6089144", "0.6084567", "0.6082446", "0.60787416", "0.60783076", "0.60779613", "0.60764205", "0.6076161", "0.6074504", "0.6071405", "0.60701895", "0.6068203", "0.6068037", "0.6065763", "0.6065024", "0.60601574", "0.60560703", "0.6053306", "0.6053253", "0.60510933", "0.60493547", "0.6046791", "0.604437", "0.6041132", "0.6038663", "0.60371864", "0.6036615", "0.6034779", "0.6034664", "0.6033493", "0.60326463", "0.60319257", "0.6031844", "0.6029686", "0.6029576", "0.6024572", "0.60233825", "0.60233027", "0.60222834" ]
0.6542112
0
DELETE /ocorrencias/1 DELETE /ocorrencias/1.json
def destroy @ocorrencia.destroy respond_to do |format| format.html { redirect_to ocorrencias_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_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 @obra.destroy\n respond_to do |format|\n format.html { redirect_to obras_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resto.destroy\n respond_to do |format|\n format.html { redirect_to restos_url, notice: 'Entry was deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end", "def destroy\n @remito = Remito.find(params[:id])\n @remito.destroy\n\n respond_to do |format|\n format.html { redirect_to remitos_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 @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ativo_outro = AtivoOutro.find(params[:id])\n @ativo_outro.destroy\n\n respond_to do |format|\n format.html { redirect_to ativo_outros_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @areco = Areco.find(params[:id])\n @areco.destroy\n\n respond_to do |format|\n format.html { redirect_to arecos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tapioca.destroy\n respond_to do |format|\n format.html { redirect_to tapiocas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resa.destroy\n respond_to do |format|\n format.html { redirect_to resas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ocupacion.destroy\n respond_to do |format|\n format.html { redirect_to ocupacions_url, notice: 'Ocupacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @atracao = Atracao.find(params[:id])\n @atracao.destroy\n\n respond_to do |format|\n format.html { redirect_to atracaos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asiento = Asiento.find(params[:id])\n @asiento.destroy\n\n respond_to do |format|\n format.html { redirect_to asientos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @redacao.destroy\n respond_to do |format|\n format.html { redirect_to redacaos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @escola = Escola.find(params[:id])\n @escola.destroy\n\n respond_to do |format|\n format.html { redirect_to escolas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restora.destroy\n respond_to do |format|\n format.html { redirect_to restoras_url, notice: 'Restora was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapreensoes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventario_cosa.destroy\n respond_to do |format|\n format.html { redirect_to inventario_cosas_url, notice: 'Inventario cosa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n @observacao_vocacionada.destroy\n\n respond_to do |format|\n format.html { redirect_to observacao_vocacionadas_url }\n format.json { head :no_content }\n end\n end", "def delete\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @obra.destroy\n respond_to do |format|\n format.html { redirect_to obras_url, notice: 'Obra removida com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n @lancamentorapido.destroy \n\n respond_to do |format|\n format.html { redirect_to lancamentorapidos_path }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @orcamento.destroy\n respond_to do |format|\n format.html { redirect_to orcamentos_url, notice: 'Orçamento apagado com sucesso!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @arquivo = Arquivo.find(params[:id])\n\n @comentarios = Comentario.where(:comentavel_id => @arquivo.id)\n\n if @comentarios\n @comentarios.delete_all\n end\n\n @arquivo.destroy\n\n respond_to do |format|\n format.html { redirect_to arquivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @antropo.destroy\n respond_to do |format|\n format.html { redirect_to antropos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to referencia_bases_url, notice: \"Referencia base was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @corrida.destroy\n respond_to do |format|\n format.html { redirect_to corridas_url, notice: 'Corrida eliminada correctamente.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ano = Ano.find(params[:id])\n @ano.destroy\n\n respond_to do |format|\n format.html { redirect_to anos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @recurso = Recurso.find(params[:id])\n @recurso.destroy\n\n respond_to do |format|\n format.html { redirect_to recursos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ocorrencium.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencia_url, notice: 'Registro excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @opcao.destroy\n respond_to do |format|\n format.html { redirect_to opcaos_url, notice: 'Opção Apagada com sucesso!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @orador = Orador.find(params[:id])\n @orador.destroy\n\n respond_to do |format|\n format.html { redirect_to oradores_url }\n format.json { head :ok }\n end\n end", "def destroy\n @veiculo = Veiculo.find(params[:id])\n @veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to veiculos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @asociacion.destroy\n respond_to do |format|\n format.html { redirect_to asociaciones_url, notice: 'Asociacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @razmer_go = RazmerGo.find(params[:id])\n @razmer_go.destroy\n\n respond_to do |format|\n format.html { redirect_to razmer_gos_url }\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 @cio.destroy\n respond_to do |format|\n format.html { redirect_to cios_url, notice: 'Cio excluido.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @selecao = Selecao.find(params[:id])\n @selecao.destroy\n\n respond_to do |format|\n format.html { redirect_to selecaos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @obra = Obra.find(params[:id])\n @obra.destroy\n\n respond_to do |format|\n format.html { redirect_to obras_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @safra_verdoso = SafraVerdoso.find(params[:id])\n @safra_verdoso.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n end\n end", "def destroy\n @asos_datum.destroy\n respond_to do |format|\n format.html { redirect_to asos_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @retroalimentacion.destroy\n\n respond_to do |format|\n format.html { redirect_to retroalimentacions_url }\n format.json { head :no_content }\n end\n end", "def delete(*rest) end", "def destroy\n @unidad.destroy\n respond_to do |format|\n format.html { redirect_to unidades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to tipo_referencia_bases_url, notice: \"Tipo referencia base was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @recaudacion.destroy\n respond_to do |format|\n format.html { redirect_to recaudacions_url, notice: 'Recaudacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @apoio_educacioanl.destroy\n respond_to do |format|\n format.html { redirect_to apoio_educacioanls_url, notice: 'Apoio educacioanal foi excluído com Sucesso !' }\n format.json { head :no_content }\n end\n end", "def destroy\n @consumo = Consumo.find(params[:id])\n @consumo.destroy\n\n respond_to do |format|\n format.html { redirect_to consumos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @regraponto.destroy\n respond_to do |format|\n format.html { redirect_to regrapontos_url, notice: 'Regraponto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n seleccionarMenu(:rondas)\n @ronda = Ronda.find(params[:id])\n @ronda.destroy\n\n respond_to do |format|\n format.html { redirect_to rondas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @caso.destroy\n respond_to do |format|\n format.html { redirect_to casos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n set_redireccion\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to @redireccion, notice: 'Cliente was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n arquivo = Arquivo.find(@pregoestitulosgrafico.arquivo_id)\n\n File.delete(arquivo.caminho)\n\n pregoestitulo = Pregoestitulo.find(@pregoestitulosgrafico.pregoestitulo_id)\n \n @pregoestitulosgrafico.destroy\n respond_to do |format|\n format.html { redirect_to pregoestitulo, notice: 'Arquivo excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ruta.destroy\n respond_to do |format|\n format.html { redirect_to rutas_url, notice: 'Ruta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to revistas_url, notice: 'Revista was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n set_redireccion\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to @redireccion, notice: 'Carpeta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @realiza = Realiza.find(params[:id])\n @realiza.destroy\n\n respond_to do |format|\n format.html { redirect_to realizas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @archivo.destroy\n respond_to do |format|\n format.html { redirect_to archivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_documento = TipoDocumento.find(params[:id])\n @tipo_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_documentos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @archivo = Archivo.find(params[:id])\n @archivo.destroy\n\n respond_to do |format|\n format.html { redirect_to archivos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @orcamento.destroy\n respond_to do |format|\n format.html { redirect_to orcamentos_url, notice: 'Orcamento foi excluído(a) com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @servico_pacote.destroy\n respond_to do |format|\n format.html { redirect_to servico_pacotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @anteproyecto_observacion.destroy\n respond_to do |format|\n format.html { redirect_to anteproyecto_observaciones_url, notice: 'Anteproyecto observacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lixotodo.destroy\n respond_to do |format|\n format.html {redirect_to lixotodos_url, notice: 'Registro excluído com sucesso.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @exura = Exura.find(params[:id])\n @exura.destroy\n\n respond_to do |format|\n format.html { redirect_to exuras_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @apologetic.destroy\n respond_to do |format|\n format.html { redirect_to apologetics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7249877", "0.7197048", "0.707396", "0.703247", "0.7018129", "0.70179844", "0.6993409", "0.6984617", "0.69833076", "0.6981152", "0.69762295", "0.6974523", "0.69669443", "0.6953194", "0.69510543", "0.6944849", "0.69321", "0.6928049", "0.69276994", "0.69267946", "0.6922505", "0.69202405", "0.69098437", "0.6909147", "0.69085705", "0.6908459", "0.689044", "0.68903434", "0.68873215", "0.68807834", "0.6876564", "0.6872635", "0.6867759", "0.6865708", "0.6859654", "0.6852606", "0.685073", "0.6849875", "0.6849723", "0.68495345", "0.6845567", "0.6843586", "0.6839634", "0.68354994", "0.68321097", "0.6831862", "0.683136", "0.6827637", "0.68255067", "0.6825317", "0.68249476", "0.6824678", "0.68237716", "0.68237716", "0.68237716", "0.68226403", "0.68226403", "0.6822427", "0.6819511", "0.6819452", "0.6807018", "0.68067646", "0.6806367", "0.6802673", "0.68023133", "0.6801474", "0.6800622", "0.68000066", "0.679585", "0.6795452", "0.6794842", "0.679443", "0.6789468", "0.67893374", "0.67879367", "0.6784784", "0.6783601", "0.6782115", "0.67798156", "0.6779448", "0.6777905", "0.6776246", "0.6775635", "0.6774875", "0.6774802", "0.67741823", "0.67725164", "0.6772167", "0.6771949", "0.67716", "0.6770745", "0.6770373", "0.67702055", "0.6769977", "0.6768019", "0.6765096", "0.67615455", "0.6760128", "0.67591935", "0.6757485" ]
0.71945083
2
Use callbacks to share common setup or constraints between actions.
def set_ocorrencia @ocorrencia = Ocorrencia.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def ocorrencia_params params.require(:ocorrencia).permit(:ocolocal, :ocostatus, :ocomunicipio, :ocosentido, :ocodataocorrencia, :ocodataregistro, :ocotipo, :ococomid, :ocoidorigem, :ococpfretif, :ococpfretif) 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
This method is used to get the exact number of days in a month, ex: it gives 29 days as output for the february month in a leap year
def daysinmonth(year, month) return (Date.new(year, 12, 31) << (12-month)).day end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_in_month\n raw = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][self.month]\n self.month == 2 && leap_year? ? raw + 1 : raw\n end", "def count_of_days_in(month)\n 28 + (month + (month / 8)) % 2 + 2 % month + 2 * (1 / month)\nend", "def days_in_month(month, year = current.year)\n if month == 2 && ::Date.gregorian_leap?(year)\n 29\n else\n COMMON_YEAR_DAYS_IN_MONTH[month]\n end\n end", "def days_in_month(month, year = Time.now.year)\n\t return 29 if month == 2 && Date.gregorian_leap?(year)\n\t return COMMON_YEAR_DAYS_IN_MONTH[month]\n\tend", "def days_in_month(month, year)\n (month == 2 && is_leap_year?(year)) ? 29 : DAYS_IN_A_MONTH[month]\n end", "def days_in_month(year, month)\n return (Date.new(year, 12, 31) << (12 - month)).day\n end", "def days_in_month(year, month)\n (Date.new(year, 12, 31) << (12-month)).day\n end", "def days_in_month(year, month)\n Date.new(year, month, -1).day\n end", "def days_in_month(month, year = Time.now.year)\n return 29 if month == 2 && Date.gregorian_leap?(year)\n DAYS_IN_MONTH[month]\n end", "def days_in_month(month, year = Time.now.year)\n return 29 if month == 2 && Date.gregorian_leap?(year)\n DAYS_IN_MONTH[month]\n end", "def get_days(year,month)\r\n # the number of days within a month is determined by the year\r\n case month\r\n when \"January\", \"March\", \"May\", \"July\", \"August\", \"October\", \"December\"\r\n days = 31\r\n when \"April\", \"June\", \"September\", \"November\"\r\n days = 30\r\n else\r\n if year.to_i % 400 == 0 # feb has 28 days when a year divisible by 400\r\n days = 28\r\n elsif year.to_i % 4 == 0\r\n days = 29\r\n else\r\n days = 28\r\n end\r\n end # end statement for case month when ...\r\n return days\r\n end", "def calc_days_in_month month, year\n months_with_30 = [4, 6, 9, 11]\n months_with_31 = [1, 3, 5, 7, 8, 10, 12]\n if months_with_30.include? month\n 30\n elsif months_with_31.include? month\n 31\n elsif (year % 4 == 0) && !(year % 100 == 0) || (year % 400 == 0)\n 29\n else\n 28\n end\n end", "def days_in_month\n @date_time_value.days_in_month\n end", "def days_in_month(month, year)\n days_per_month = { 1 => 31, 2 => 28 + (leap?(year) ? 1 : 0), 3 => 31, 4 => 30, 5 => 31, 6 => 30, 7 => 31, 8 => 31, 9 => 30, 10 => 31, 11 => 30, 12 => 31 } \n if (month == 0)\n return days_per_month[12]\n elsif (month < 0)\n return days_per_month[month % 13]\n else\n return days_per_month[month] \n end\n end", "def days_in_month\n Time.send(\"month_days\", self.year, self.month)\n end", "def days_in_month(month=nil)\n month ||= Date.today.month\n days_in_mon = Date.civil(Date.today.year, month, -1).day\n end", "def day_of_month\n return self.day_of_year if self.month == 1\n ((self.day_of_year - 1) - DAYS_IN_MONTH.slice(0, (month - 1)).inject(:+)) + 1\n end", "def monthDays(y, m)\n if ((@@lunar_info[y - 1900] & (0x10000 >> m)) == 0)\n return 29\n else\n return 30\n end\n end", "def test_01c_number_of_days_in_a_weird_leap_year\n cal = IndividualMonth.new(2000, 2)\n assert_equal(29, cal.number_days_in_a_month)\n end", "def test_01d_number_of_days_in_a_weird_leap_year\n cal = IndividualMonth.new(2100, 2)\n assert_equal(28, cal.number_days_in_a_month)\n end", "def get_number_of_month(m)\n (1..is_leap?[adjust_set_month(m)]).to_a\n end", "def test_01b_number_of_days_in_a_normal_nonleap_year \n cal = IndividualMonth.new(2013, 2)\n assert_equal(28, cal.number_days_in_a_month)\n end", "def days_in_current_month\n\t\t\tcurrent_month = Time.now.month\n\t\t\tcurrent_year = Time.now.year\n\n\t\t\treturn Time.days_in_month(current_month, current_year)\n\t\tend", "def days\n Advert.days_for_months(months)\n end", "def get_number_of_month\n (1..is_leap?[adjust_set_month]).to_a\n end", "def day_of_year\n count = @t_day\n @@days_in_months.each_index do |key|\n break if key >= @t_month\n val = @@days_in_months[key]\n \n if key == 2 and Datet.gregorian_leap?(@t_year)\n count += 29\n else\n count += val.to_i\n end\n end\n \n return count\n end", "def add_days_of_month(month, year)\n\tdays = 0\n\t[1,3,5,7,8,10,12].include?(month) ? days += 31 : nil\n\t[4,6,9,11].include?(month) ? days += 30 : nil\n\tif month == 2 \n\t\t((year % 4 == 0) && (year > 1900)) ? days += 29 : days += 28\n\t\tend\n\treturn days\n\tend", "def test_01e_number_of_days_in_some_months_will_be_31\n cal = IndividualMonth.new(2012, 3)\n assert_equal(31, cal.number_days_in_a_month)\n end", "def test_january\n jan = Month.new(1,2000)\n days = jan.num_of_days_in_month\n assert_equal 31, days\n end", "def get_days_month(date=nil)\n date ||= @date\n\n return @schedule.days if @schedule.days > 0\n\n if @schedule.days_month != 'specific'\n if @schedule.days_month == 'last' && @schedule.days_month_day == nil\n return 0b0 | (1 << date.at_end_of_month.day)\n end\n end\n\n return 0b0 | (1 << @schedule.start_date.day)\n end", "def test_01f_number_of_days_in_some_months_will_be_30\n cal = IndividualMonth.new(2012, 9)\n assert_equal(30, cal.number_days_in_a_month)\n end", "def monthly_dry_days(day)\n month_result_string(day).count('1')\n end", "def month_length(date)\n return Date.new(date.year, date.month, -1).day\n end", "def days\n @days ||= months.map(&:days).flatten\n end", "def nights_left_in_a_month(day,month,year)\n\n nights_left = days_in_month(month,year) - day \n return nights_left\n\nend", "def month\n running_days = 0\n DAYS_IN_MONTH.each_with_index do |days, idx|\n running_days += days\n return idx + 1 if self.day_of_year <= running_days\n end\n end", "def day_in_month(year, month, day)\n return Date.new(year, month, day).wday\n end", "def days_booked(yearmonth = nil)\n return days_booked_for_month(yearmonth) if !yearmonth.nil? \n\n curdate = self.planbeg\n days = 0\n until curdate > self.planend do\n days += days_booked_for_month(curdate)\n curdate = curdate >> 1\n end\n \n return days\n end", "def months() 30 * days end", "def days_in_year(year)\n ::Montrose::Utils.days_in_month(2, year) + 337\n end", "def thirty_days_month\n return @month == 4 || @month == 6 || @month == 9 || @month == 11\n end", "def days_in_year(year = current.year)\n days_in_month(2, year) + 337\n end", "def nwday_of_month(n)\n self + (nwday_day(n) - day).days\n end", "def test_days_in_month()\n first_month=days_in_month(1,2016)\n assert_equal(31,first_month)\n end", "def month_days(month = current_month)\n\t\tmonth_sum = month_summary(month)\n\t\tmonth_days = []\n\t\tmonth_sum.each { |day| month_days << short_date(day['date']) unless day['summary'].nil? }\n\t\tmonth_days\n\tend", "def find_days_from_sunday(year, month, date)\r\n\tresult = 0\r\n\tfull_years = year - 1900\r\n\t# add 365 for each full year\r\n\tresult += full_years * 365\r\n\t# add 1 for each full leap year\r\n\tresult += (full_years - 1) / 4\r\n\r\n\tmonth_days = [31,28,31,30,31,30,31,31,30,31,30,31]\r\n\t# add days for full months in final calendar year\r\n\tresult += month_days[0...(month - 1)].inject(0,:+)\r\n\t# add 1 for leap day in final calendar year\r\n\tresult += 1 if (month > 2) && (year % 4 == 0) && (year % 100 != 0)\r\n\r\n\t# add for number of days into final month\r\n\tresult += date\r\n\r\n\t# add one for dates Dec 31 1899 or earlier\r\n\tresult += 1 if year <= 1899\r\n\r\n\tresult\r\nend", "def days_until_xmas(date)\n return 0\nend", "def day_in_year\n day = self.day\n \n 1.upto(self.month - 1) do |month_no|\n day += Datet.days_in_month(self.year, month_no)\n end\n \n return day\n end", "def calc_months_till\n (calc_days_till / 31.0).round(2)\n end", "def leap_days(y)\n if (leap_month(y) != 0)\n if ((@@lunar_info[y - 1900] & 0x10000) != 0)\n return 30\n else\n return 29\n end\n else\n return 0\n end\n end", "def test_should_return_total_days_of_month\n assert_equal Month.april(2004).size, 30\n assert_equal Month.april(2004).length, 30 # alternate access\n end", "def get_num_feb_days_cur_yr(yr)\n\tif (0 == yr.to_i.modulo($leap_num_yr))\n\t\treturn $num_days_29feb\n\telse\n\t\treturn $num_days_28feb\n\tend\nend", "def daysInYear\n if leapYear?\n return 366\n else\n return 365\n end\n end", "def days(n)\n n * 3600 * 24\nend", "def length\n is_leap?[adjust_set_month]\n end", "def days\n self.to_i * 86_400\n end", "def getEndOfMonthDay\n Date.civil(@month1.strftime('%Y').to_i, @month1.strftime('%m').to_i, -1).day.to_i\n end", "def days_in_year(year)\n Time.days_in_month(2, year) + 337\n end", "def daysBetweenDates(year1, month1, day1, year2, month2, day2)\n 1 = 31", "def number_of_days\n return ( end_date - start_date ).to_i\n end", "def months ; self * 30.days ; end", "def ordinalDate\n ordinal = DAYS_THUS_FAR[@month].to_i + @day.to_i\n if leapYear? && @month > 2\n ordinal = ordinal + 1\n end\n return ordinal\n end", "def effective_months\n return 0 if start_date > end_date\n y = (end_date.year - start_date.year) * 12\n m = (end_date.mon - start_date.mon)\n last_month_days = ((end_date.day - end_date.beginning_of_month.day) + 1).to_f / end_date.end_of_month.day\n first_month_days = ((start_date.end_of_month.day - start_date.day) + 1).to_f / start_date.end_of_month.day\n first_and_last = start_date.day - 1 == end_date.day ? 1 : last_month_days + first_month_days\n (y + m + first_and_last) - 1\n end", "def ides_of_month(month)\n [MARCH, MAY, JULY, OCTOBER].include?(month) ? 15 : 13\n end", "def nth_negative_instance_of_day_in_month(date)\n # How many days are there in this month? We'll grab the first of next month, then roll\n # back a day to see.\n next_month = Time.utc(date.year, (date.month % 12) + 1)\n next_month = Time.utc(next_month.year + 1, next_month.month) if next_month < date\n month_days = (next_month - 86400).day\n return -1 - ((month_days - date.day) / 7)\n end", "def how_many_months(date1, date2)\n (date2.year - date1.year) * 12 + date2.month - date1.month - (date2.day >= date1.day ? 0 : 1)\n end", "def age_in_days(day, month, year)\n# TODO: return the age expressed in days given the day, month, and year of birth\n big_age = Date.today\n small_age = Date.parse(\"#{year}-#{month}-#{day}\")\n age = big_age - small_age\n return age.to_i\nend", "def day_number_of_the_year day, month, hash \n if month > 1\n for i in 1...month\n day += hash[i]\n end\n end\n day\nend", "def yday\n m = (@month-2 < 0) ? 0 : @month-2\n (@month==1) ? @day : @day + JDaysInMonth[0..m].inject(0) {|sum, n| sum + n }\n end", "def count_wdays_on_first_of_months(start_date, end_date, day_of_week)\n days_count = 0\n \n if start_date.mday > 1\n start_date = (start_date >> 1) - start_date.mday + 1 # move to the 1st day of next month\n end\n \n while start_date < end_date\n days_count += 1 if start_date.wday == day_of_week\n start_date = start_date >> 1\n end\n \n days_count \nend", "def find_day_of_month(day=@day, first_day_of_month=@first_day_of_month)\r\n day = ((day - 1) + first_day_of_month) % 7\r\n return 7 if day == 0\r\n day\r\n end", "def days(date_from, days)\n\n date_to = date_from + days\n\n from_year = date_from.year\n to_year = from_month <= to_month ? from_year : from_year + 1\n\n season_from_date = Date.civil(from_year, from_month, from_day)\n season_to_date = Date.civil(to_year, to_month, to_day)\n\n # It should be considered in the next year from the date_from\n if season_to_date < date_from \n season_from_date = Date.civil(from_year+1, from_month, from_day)\n season_to_date = Date.civil(from_year+1, to_month, to_day)\n end\n \n result = 0\n\n if Season.included_in_period?(season_from_date, season_to_date, date_from, date_to)\n c_from = [season_from_date, date_from].max()\n c_to = [season_to_date, date_to].min()\n result = (c_to - c_from).to_i\n if (date_to > season_to_date)\n result += 1\n end\n end\n\n return result\n\n end", "def days\n self * SECONDS_IN_DAY\n end", "def months\n\t\treturn self * 30.days\n\tend", "def months\n\t\treturn self * 30.days\n\tend", "def after_n_months(year, month)\n\tif year == nil\n\t\t\"year missing\"\n\telsif month == nil\n\t\t\"month missing\"\n\telse\n\t\t(year + month/12).to_i\n\tend\nend", "def maximum_number_of_months_to_recur\n self.period.length_in_months -\n self.period.month_for_date(date)\n end", "def make_days\n month = (1..@day_num).collect do |day|\n Day.new(Date.parse(\"#{@year}-#{@month}-#{day}\"))\n end\n\n month[0].date.wday.times { month.insert(0, Day.new(Date.new))}\n month\n end", "def absolute_day(month, day)\n\n mo = {\n 1 => 31,\n 2 => 28,\n 3 => 31,\n 4 => 30,\n 5 => 31,\n 6 => 30,\n 7 => 31,\n 8 => 31,\n 9 => 30,\n 10 => 31,\n 11 => 30,\n 12 => 31,\n }\n\n # hash v. loop of arrays, computation v. memory tradeoff\n\n total_days = 0\n\n\n (1...month).each do |i| #1...month is (month-1)\n total_days += mo[i]\n end\n\n total_days + day\n\nend", "def days_until_xmas(date = Date.today)\n xmas_day = Date.new(date.year, 12, 25)\n if xmas_day < date\n xmas_day = xmas_day.next_year\n end\n (xmas_day - date).to_i\nend", "def nth_wday_of_month(w, d)\n self + (nth_wday_day(w, d) - day).days\n end", "def wrong_day_number_in_month\n if thirty_days_month && @day > 30\n return true\n else\n return check_february\n end\n end", "def days_diff\n if self.end_at.nil? || self.start_at.nil?\n return 0\n end\n n = Integer(self.end_at - self.start_at) + 1\n return n\n end", "def month\n sunday = @monday + 6\n return 1 if sunday.month == 1 && sunday.year == @year\n return 12 if @monday.month == 12 && @monday.year == @year\n (@monday + 2).month\n end", "def days_in_year\n return Datet.days_in_year(@t_year)\n end", "def month_days_interval(first_month_day)\n last_month_day = first_month_day.end_of_month\n\n first_week_day = first_month_day.beginning_of_week(:monday)\n last_week_day = last_month_day.end_of_week(:monday)\n\n while (last_week_day - first_week_day).to_i + 1 < DAYS_PER_MONTH\n last_week_day = last_week_day + 1.week\n end\n\n first_week_day .. last_week_day\n end", "def nones_of_month(month)\n ides_of_month(month) - 8\n end", "def months_in_year\n 12\nend", "def increment_by_days count\n new_day = @day\n new_month = @month\n new_year = @year \n \n while count > 0\n days_to_next_month = days_in_month(new_month, new_year) - new_day + 1\n \n if (days_to_next_month > count)\n new_day = new_day + count\n count = 0 \n else\n new_day = 1\n new_month = new_month + 1\n if (new_month > 12)\n new_month = 1\n new_year = new_year + 1\n end\n \n count = count - days_to_next_month \n end\n end\n \n return MyDate.new new_day, new_month, new_year\n end", "def edad(fecha_actual, fecha_nacimiento)\n anno_nacimiento = fecha_nacimiento.year\n anno_actual = fecha_actual.year\n edad = 0\n if fecha_actual.month > fecha_nacimiento.month\n edad = (anno_actual - anno_nacimiento)\n elsif fecha_actual.month == fecha_nacimiento.month\n if fecha_actual.day >= fecha_nacimiento.day\n edad = anno_actual - anno_nacimiento\n else\n edad = (anno_actual - anno_nacimiento) - 1\n end\n else\n edad = (anno_actual - anno_nacimiento) - 1\n end\n return edad\n end", "def number_of_months(timeframe = nil)\n case timeframe\n # 1month is a special case, need same month's data from last year as well\n when \"1month\" then 13\n when \"3months\" then 3\n when \"2years\" then 24\n else 60\n end\n end", "def monthsDifference\n dates = formatDates\n ((dates[:start_date] - dates[:end_date]).to_i / 30).to_i\n end", "def days\n 1 + (@end_date - @start_date).to_i\n end", "def number_of_days(rental)\n\tnumber_of_days = (rental.end_date - rental.start_date)\n\tnumber_of_days = number_of_days.to_i + 1\nend", "def days\n monday..sunday\n end", "def days\n # +1 because end_date is included in the duration range\n ((end_date - start_date) / 3600 / 24).to_i + 1\n end", "def last_day_of_month(year, month)\n last_day_of_the_month = (Date.parse(year.to_s + \"-\" + (month.to_i + 1).to_s + \"-01\") - 1).mday().to_s rescue \"31\"\n \n return last_day_of_the_month.to_i\n end", "def get_num_months(param)\n if param == '3m'\n 3\n elsif param == '6m'\n 6\n elsif param == '1y'\n 12\n else\n 1\n end\n end", "def day_of_month(*days)\n merge(mday: days)\n end" ]
[ "0.84366363", "0.8279695", "0.8269624", "0.8151693", "0.80753505", "0.8057325", "0.8049237", "0.7999014", "0.79909474", "0.79909474", "0.7967224", "0.79505646", "0.78664964", "0.786536", "0.7844537", "0.78081536", "0.7693863", "0.7686297", "0.7633689", "0.7578224", "0.74998593", "0.7482444", "0.73534083", "0.7341644", "0.73409855", "0.7291839", "0.72871053", "0.7278436", "0.72396624", "0.71642625", "0.71461934", "0.7143749", "0.7124366", "0.7080445", "0.7074495", "0.6984893", "0.69469494", "0.6925942", "0.6912127", "0.6912039", "0.68979186", "0.68892014", "0.68866843", "0.6877658", "0.67651194", "0.67601824", "0.6747634", "0.67141306", "0.67076844", "0.6698469", "0.667681", "0.66727775", "0.6625137", "0.6609423", "0.6588504", "0.6563185", "0.6555082", "0.6550144", "0.65370816", "0.6482097", "0.647641", "0.64688486", "0.64218843", "0.63867205", "0.6377565", "0.6375235", "0.6368632", "0.6366494", "0.6364713", "0.6361099", "0.6333807", "0.6306194", "0.6298533", "0.6261411", "0.6261411", "0.6260499", "0.62547857", "0.6250775", "0.62426054", "0.6233289", "0.6229523", "0.62139654", "0.62085706", "0.619824", "0.619527", "0.6186695", "0.6185449", "0.6182325", "0.61513793", "0.6149242", "0.61399937", "0.61354923", "0.611791", "0.61165684", "0.6103518", "0.6096726", "0.6096111", "0.6090671", "0.60629255" ]
0.7213328
30
This method is used to construct query based on the parameter receives from the controller.
def generate_query(*args) #generate_query starts here begin @tablename=args[0].split('-')[0] @duration=args[0].split('-')[1] @report_type=args[1] @column1=args[2] @column2=args[3] @startdate=args[4] @enddate=args[5] @order=args[6] @limit=args[7] @column3=args[8] @page=(args[9]!=nil) ? args[9] : 0 #~ @start_year= Time.parse(@startdate).strftime("%Y-%m-%d").split('-')[0] if @startdate!=nil #selects only year #~ @start_day=Time.parse(@startdate).strftime("%Y-%m-%d").split('-')[2] if @startdate!=nil#selects only day #~ @start_month=Time.parse(@startdate).strftime("%Y-%m-%d").split('-')[1] if @startdate!=nil #~ @end_year=Time.parse(@enddate).strftime("%Y-%m-%d").split('-')[0] if @enddate!=nil #~ @end_month=Time.parse(@enddate).strftime("%Y-%m-%d").split('-')[1] if @enddate!=nil #~ @end_day=Time.parse(@enddate).strftime("%Y-%m-%d").split('-')[2] if @enddate!=nil #~ @ctr="((sum(clicks)/sum(impressions))*100)"#if @report_type!="Overall_Performance" #~ @ecpm='((sum(revenue)/sum(impressions))*1000)' #~ customize_column= @column3=='campaign_name' ? 'c.campaign_name' : @column3=='pub_name' ? 'p.publisher_name' : @column3=='advertiser_name' ? 'a.name' : '' #~ customize_table=@column3=='campaign_name' ? 'campaigns_summaries cs, campaigns c' : @column3=='pub_name' ? 'adclients_summaries ad,publishers p' : @column3=='advertiser_name' ? 'campaigns_summaries cs,advertisers a' : '' #~ customize_condition=@column3=='campaign_name' ? 'c.id=cs.campaign_id' : @column3=='pub_name' ? 'p.id=ad.pub_id' : @column3=='advertiser_name' ? 'a.id=cs.advertiser_id' : '' #~ customize_filter=@column3=='campaign_name' ? 'and (cs.impressions>0 or cs.clicks>0)' : @column3=='pub_name' ? 'and (ad.impressions>0 or ad.clicks>0)' : @column3=='advertiser_name' ? 'and (cs.impressions>0 or cs.clicks>0)' : '' #~ begin #~ # ---- Query Builder ---- #~ sub_query="select count(*) as count from #{@tablename}" #~ sub_query+=" where delivery_date>='#{(Time.parse(@startdate)).strftime("%Y-%m-%d")} 00:00:00' and delivery_date<='#{(Time.parse(@enddate)).strftime("%Y-%m-%d")} 23:59:59'" #~ #sub_query+="and #{@column1}!='ip' and #{@column1}!=''" #~ obj=@column3=='pub_name' ? 'ad.' :'cs.' #~ sql_query ="select #{customize_column} as #{@column3} , (#{(@column2=='ctr') ? @ctr : @column2=='ecpm' ? @ecpm : "sum(#{obj}#{@column2})"}) as #{@column2=='amount_spent' ? 'amt_spent' :@column2} from #{customize_table}" #~ sql_query+=" where delivery_date>='#{(Time.parse(@startdate)).strftime("%Y-%m-%d")} 00:00:00' and delivery_date<='#{(Time.parse(@enddate)).strftime("%Y-%m-%d")} 23:59:59' and #{customize_condition} #{customize_filter}" #~ sql_query+=" group by #{@column1} order by #{@column2=='amount_spent' ? 'amt_spent' :@column2} #{@order} limit #{@limit} offset #{@page}" if @report_type!="Overall_Performance" #~ sql_query+=" group by #{@column1} order by #{@column2=='amount_spent' ? 'amt_spent' :@column2} #{@order} " if @report_type=="Overall_Performance" #~ #following code is used to calculate modulas value if applicable #~ @add_month=0 #~ @no_day=(@end_day.to_i-@start_day.to_i)+1 #~ if @end_year.to_i!=@start_year.to_i #~ @add_month=@end_month.to_i+12 #~ @add_month=@add_month.to_i-@start_month.to_i #~ @no_day+=(@add_month*30) #~ elsif @end_month.to_i>@start_month.to_i #~ @add_month=@end_month.to_i-@start_month.to_i #~ @no_day+=(@add_month*30) #~ end #~ @modulas=@no_day/30 #~ @XML_xaxis='days' #~ @@date_count=Time.parse(@startdate) #~ rescue Exception=>e #~ puts "DEBUGGER :: Error:: in admin_xml_builder.rb - generate_query ::#{e.to_s}" #~ end @XML_xaxis='days' begin #~ @tablename=AdminCampaignWiseReport.show_data() #convert the string into model name #~ @tablename=@tablename.classify.constantize #convert the string into model name #~ @recordset=@tablename.find_by_sql(sql_query) # fetch the recordset from table @recordset=AdminCampaignWiseReport.top_campaigns_performance(@order,@startdate,@enddate) # fetch the recordset from table rescue Exception=>e puts "DEBUGGER :: ERROR :: in admin_xml_builder.rb - generate_query :: #{e.to_s}" end @anchor_color="anchorBgColor='FF0000'" count=0 othersValue=0.00 if @recordset.size !=0 #main If conditons starts here for recordset in @recordset #Check whether publisher request click or impression or revenuereport i=1 if args[3]!='imp vs clicks' #~ puts "-------------check 1---------" #~ generate_mutil_linechartXML(recordset.impressions,recordset.clicks,recordset.delivery_date,@startdate,@enddate,'Impression Vs Clicks',@no_day,@duration) #~ else count+=1 if (count.to_i<=@limit.to_i) #~ puts "-------------check 2----#{@report_type}-----" generate_piechartXML(recordset[@column3],recordset[@column2]) else othersValue+=recordset[@column2].to_f if (@recordset.size.to_i==count.to_i) generate_piechartXML('Others',othersValue) end end i+=1 end end #for loop ends here #to insert xml datas for which recordset are not available #~ if @report_type=='admin_campaign_wise_reports' and args[3].to_s!='imp vs clicks' #~ puts "-------------check 3---------" #~ if Time.parse(@enddate)>@@date_count #~ while Time.parse(@enddate)>=@@date_count #~ delivery_day=@@date_count.strftime("%Y-%m-%d").split('-')[2] #will return day #~ if Time.parse(@enddate)==@@date_count #~ @@strXML+= "<set name='#{@@date_count.strftime("%d-%b-%Y")}' value='0' #{@anchor_color if @duration.to_i==1}/>" #~ elsif delivery_day.to_i%@modulas==0 #~ @@strXML+= "<set name='#{@@date_count.strftime("%d-%b-%Y")}' value='0'/>" #~ end #~ @@date_count+=86400 #~ end #~ elsif Time.parse(@enddate)==@@date_count #~ @@strXML+= "<set name='#{@@date_count.strftime("%d-%b-%Y")}' value='0' #{@anchor_color if @duration.to_i==1}/>" #~ end #~ @@strXML+="<styles><definition><style name='myLabelsFont' type='font' font='Arial' size='12' color='000000' bold='1'/></definition><application><apply toObject='DataLabels' styles='myLabelsFont' /></application></styles>" #~ #to insert xml datas for impression vs click if recordsets are not available for specified date #~ elsif @report_type=='admin_campaign_wise_reports' && args[3].to_s=='imp vs clicks' #~ puts "-------------check 1-1--------" #~ if Time.parse(@enddate)>@@date_count #~ while Time.parse(@enddate)>=@@date_count #~ delivery_day=@@date_count.strftime("%Y-%m-%d").split('-')[2] #will return day #~ if Time.parse(@enddate)==@@date_count #~ @@strXML+= "<set value='0' #{@anchor_color if @duration.to_i==1}/>" #~ @@cat_strXML+="<category label='#{@@date_count.strftime("%d-%b-%Y")}'/>" #~ @@multi_strXML+="<set value='0' #{@anchor_color if @duration.to_i==1}/>" #~ elsif delivery_day.to_i%@modulas==0 #~ @@strXML+= "<set value='0'/>" #~ @@cat_strXML+="<category label='#{@@date_count.strftime("%d-%b-%Y")}'/>" #~ @@multi_strXML+="<set value='0'/>" #~ end #~ @@date_count+=86400 #~ end #~ elsif Time.parse(@enddate)==@@date_count #~ puts "-------------check 1--2-------" #~ @@strXML+= "<set value='0'/ #{@anchor_color if @duration.to_i==1}>" #~ @@cat_strXML+="<category label='#{@@date_count.strftime("%d-%b-%Y")}'/>" #~ @@multi_strXML+="<set value='0'/ #{@anchor_color if @duration.to_i==1}>" #~ end #~ @@multi_strXML+="</dataset>" #~ @@cat_strXML+="</categories>" #~ @@strXML+="</dataset>" #~ @@strXML+=@@cat_strXML #~ @@strXML+=@@multi_strXML #~ p @@strXML+="<styles><definition><style name='myLabelsFont' type='font' font='Arial' size='12' color='000000' bold='1'/></definition><application><apply toObject='DataLabels' styles='myLabelsFont' /></application></styles>" #~ end #~ if @report_type=='Traffic' #~ @@strXML+="</data>" #~ @@strXML+="<colorRange><color minValue='0' maxValue='#{(@@date_count-1).to_s}' displayValue='Low' color='F0FFE8' /><color minValue='#{(@@date_count.to_i-1).to_s}' maxValue='#{(@@date_count.to_i+1).to_s}' displayValue='High' color='009900' /></colorRange></map>" #~ end #~ if @report_type=='Ad_Wise' and args[5]=='imp vs clicks' #~ puts "-------------check 12---------" #~ @@multi_strXML+="</dataset>" #~ @@cat_strXML+="</categories>" #~ @@strXML+="</dataset>" #~ @@strXML+=@@cat_strXML #~ @@strXML+=@@multi_strXML #~ @@strXML+="<styles><definition><style name='myLabelsFont' type='font' font='Arial' size='12' color='000000' bold='1'/></definition><application><apply toObject='DataLabels' styles='myLabelsFont' /></application></styles>" #~ end #~ if @report_type=='Traffic_Continent' #~ puts "-------------check 14---------" #~ @@strXML+='</data>' #~ @@strXML+="<colorRange><color minValue='0' maxValue='#{(@@date_count-1).to_s}' displayValue='Low' color='F0FFE8' /><color minValue='#{(@@date_count.to_i-1).to_s}' maxValue='#{(@@date_count.to_i+1).to_s}' displayValue='High' color='009900' /></colorRange></map>" #~ end #~ if @report_type=='Keyword' #~ puts "-------------check 1-6--------" #~ @@strXML+="<styles><definition><style name='myValuesFont' type='font' size='16' color='000000' bold='1' font='Arial, Helvetica, sans-serif' /></definition><application><apply toObject='DataLabels' styles='myValuesFont' /></application></styles>" #~ end @@strXML = @@strXML + "</chart>" end #main If ends here #reinitialize flag, str variable and counters to construct next chart @@flag=true #~ @@xml_count=0 #~ @@date_count=0 @@color_count=0 @@mod=0 @returnstrXML=@@strXML @@strXML='' @@cat_strXML='' @@multi_strXML='' @@xml_hash=nil @@xml_hash={:xml_string=>@returnstrXML } return @@xml_hash rescue Exception=>e puts "DEBUGGER :: ERROR :: in admin_xml_builder under generate_query method. The error is #{e.to_s}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query ; @request.params ; end", "def retrieve_query\n if params[:set_filter] or !session[:query] or session[:query].project_id\n # Give it a name, required to be valid\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\n if params[:fields] and params[:fields].is_a? Array\n params[:fields].each do |field|\n @query.add_filter(field, params[:operators][field], params[:values][field])\n end\n else\n @query.available_filters.keys.each do |field|\n @query.add_short_filter(field, params[field]) if params[field]\n end\n end\n session[:query] = @query\n else\n @query = session[:query]\n end\n end", "def make_query\n run_callbacks :make_query do\n self.scope.search(get_query_params)\n end\n end", "def build_query(params)\n query = UserInteraction.includes(:user, :interaction, :answer)\n fields = get_fields()\n params.each do |filter|\n field_id = filter['field'].to_sym\n operator = filter['operand']\n operand = filter['value']\n if operator == FILTER_OPERATOR_CONTAINS\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), \"%\"+operand.to_s+\"%\" )\n else\n query = query.where( get_active_record_expression(fields[field_id]['column_name'], operator, fields[field_id]['model']), operand )\n end\n end\n return query \n end", "def query_params; end", "def query_params\n params.permit(:aql)\n end", "def query_parameters\n end", "def query\n case query_type_str\n when 'empty'\n return\n when 'iso'\n return iso_query_builder\n when 'multi'\n return multi_query_builder\n end\n end", "def query_param\n @query_param ||= QueryParamController.new config\n end", "def query_params=(_arg0); end", "def compile_query\r\n str = []\r\n\r\n str << \"controller|#{q[:controller]}|\" if q[:controller].present?\r\n str << \"action|#{q[:action]}|\" if q[:action].present?\r\n str << \"format|#{q[:format]}|\" if q[:format].present?\r\n str << \"status|#{q[:status]}|\" if q[:status].present?\r\n\r\n str << \"datetime|#{q[:on].strftime('%Y%m%d')}*|\" if q[:on].present?\r\n\r\n str << \"method|#{q[:method]}|\" if q[:method].present?\r\n str << \"path|#{q[:path]}|\" if q[:path].present?\r\n\r\n str.join(\"*\")\r\n end", "def get_query\n \n # Get query parameters passed\n query_params = request.query_parameters\n \n # Initialize query with country from route\n query = {'country' => params[:country]}\n \n # Allowed search terms, only these keys are searchable \n search_keys = ['name', 'a_id', 'pub_id', 'device', 'min_price', 'max_price',\n 'pub_name', 'min_app_rating', 'max_app_rating',\n 'category', 'sub_category', 'interests_only']\n \n # Iterate through the keys, determine if the params match the key and if so \n # add a condition to the query\n search_keys.each do |key|\n param = query_params[key]\n \n # Make sure the parameter is defined \n next unless param\n \n #logger.info('key %s, param %s' % [key, param])\n \n # handlers for different keys\n case key\n when 'a_id', 'pub_id'\n # IDs are floats so convert\n query[key] = query_params[key].to_f\n when 'name', 'pub_name'\n # Do regex match on names so you can match substring\n query[key] = /#{query_params[key]}/\n when 'min_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$gte] = param.to_f\n when 'max_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$lte] = param.to_f\n when 'min_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$gte] = param.to_f\n when 'max_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$lte] = param.to_f\n when 'interests_only'\n interest_query = []\n param.split(',').each do |interest|\n interest_query << {:interests => interest}\n end\n # And filter only the apps that have either one of the interests\n query[:$and] = [{:$or => interest_query}]\n else\n # Deals with all the parameters that are specified and match with\n # the model attributes\n query[key] = param\n end\n end\n \n return query\n end", "def query_parameters; end", "def query\n end", "def execute_query\n query_parameters = self.query_parameters\n query_parameters.delete(:redirect_controller)\n query_parameters.delete(:redirect_action)\n query_parameters.delete(:saved_search_id)\n #sql = \"#{query_parameters}\"\n sql = String.new\n query_parameters.each do |key,val|\n if val.class == TrueClass || val.class == FalseClass\n sql << \"#{key} == #{val} and \"\n else\n sql << \"#{key} like '#{val}' and \"\n end\n end\n sql = sql.slice(0, sql.length-4)\n self.last_query = sql\n self.save\n eval(self.model_name).where(sql)\n end", "def query ; @query ||= Waves::Request::Query.new( request.query ) ; end", "def query; end", "def build_query\n query = { key: @api_key }\n query.merge! @parameters if @parameters\n query.map { |k, v| \"#{k}=#{v}\" }.join('&')\n end", "def query_param\n params[:q]\n end", "def retrieve_query\r\n if !params[:query_id].blank?\r\n cond = \"project_id IS NULL\"\r\n cond << \" OR project_id = #{@project.id}\" if @project\r\n @query = Query.find(params[:query_id], :conditions => cond)\r\n @query.project = @project\r\n session[:query] = {:id => @query.id, :project_id => @query.project_id}\r\n else\r\n if params[:set_filter] || session[:query].nil? || session[:query][:project_id] != (@project ? @project.id : nil)\r\n # Give it a name, required to be valid\r\n @query = Query.new(:name => \"_\")\r\n @query.project = @project\r\n if params[:fields] and params[:fields].is_a? Array\r\n params[:fields].each do |field|\r\n @query.add_filter(field, params[:operators][field], params[:values][field])\r\n end\r\n else\r\n @query.available_filters.keys.each do |field|\r\n @query.add_short_filter(field, params[field]) if params[field]\r\n end\r\n end\r\n session[:query] = {:project_id => @query.project_id, :filters => @query.filters}\r\n else\r\n @query = Query.find_by_id(session[:query][:id]) if session[:query][:id]\r\n @query ||= Query.new(:name => \"_\", :project => @project, :filters => session[:query][:filters])\r\n @query.project = @project\r\n end\r\n end\r\n end", "def query_params\n\t\t\t\t{}\n\t\t\tend", "def retrieve_query\r\n if params[:query_id]\r\n @query = @project.queries.find(params[:query_id])\r\n @query.executed_by = logged_in_user\r\n session[:query] = @query\r\n else\r\n if params[:set_filter] or !session[:query] or session[:query].project_id != @project.id\r\n # Give it a name, required to be valid\r\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\r\n @query.project = @project\r\n if params[:fields] and params[:fields].is_a? Array\r\n params[:fields].each do |field|\r\n @query.add_filter(field, params[:operators][field], params[:values][field])\r\n end\r\n else\r\n @query.available_filters.keys.each do |field|\r\n @query.add_short_filter(field, params[field]) if params[field]\r\n end\r\n end\r\n session[:query] = @query\r\n else\r\n @query = session[:query]\r\n end\r\n end\r\n end", "def query_param\n {\n query: ::Kahn::JSON.decode(params.fetch('query', '{}')),\n fields: ::Kahn::JSON.decode(params.fetch('fields', '{}')),\n limit: params.fetch(:limit, 10),\n skip: params.fetch(:skip, 0)\n }\n end", "def load_query\n if params[:query] && params[:query].squish.present?\n @query = params[:query].squish.humanize + '%'\n else\n render json: { message: 'No Query Parameter' , status: :unprocessable_entity }\n return false\n end\n end", "def query\n params.sort.map { |k, v| \"#{k}=\" + escape(v) }.join('&')\n end", "def prepare_query\n if @taxon_concept && TaxonData.is_clade_searchable?(@taxon_concept)\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query_with_taxon_filter(@taxon_concept.id, inner_select_clause, where_clause, order_clause)\n else\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query(inner_select_clause, where_clause, order_clause, nil)\n end\n # this is strange, but in order to properly do sorts, limits, and offsets there should be a subquery\n # see http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtTipsAndTricksHowToHandleBandwidthLimitExceed\n EOL::Sparql::SearchQueryBuilder.build_query(outer_select_clause, inner_query, nil, limit_clause)\n end", "def query_params\n params.require(:query).permit(:name, :filters, :user_id, :type, :open)\n end", "def query\n @query || params[:q] || params[:tq]\n end", "def params_for_query\n params.merge(q: params[:cq])\n end", "def query_params\n params[:query]\n end", "def initial_query; end", "def to_query\n {\n params: query\n }\n end", "def to_query\n {\n params: query\n }\n end", "def prepare_query\n if @taxon_concept\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query_with_taxon_filter(@taxon_concept.id, inner_select_clause, where_clause, inner_order_clause)\n else\n inner_query = EOL::Sparql::SearchQueryBuilder.build_query(inner_select_clause, where_clause, inner_order_clause, nil)\n end\n # this is strange, but in order to properly do sorts, limits, and offsets there should be a subquery\n # see http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtTipsAndTricksHowToHandleBandwidthLimitExceed\n EOL::Sparql::SearchQueryBuilder.build_query(outer_select_clause, inner_query, outer_order_clause, limit_clause)\n end", "def initial_query=(_arg0); end", "def retrieve_query\n session_key = :resource_booking_query\n if params[:set_filter] || session[session_key].nil? || session[session_key][:project_id] != (@project ? @project.id : nil)\n # Give it a name, required to be valid\n @query = ResourceBookingQuery.new(name: '_', project: @project)\n @query.build_from_params(params)\n session[session_key] = { project_id: @query.project_id, filters: @query.filters, options: @query.options }\n else\n # retrieve from session\n session[session_key][:options][:date_from] = params[:date_from].to_date if params[:date_from]\n @query = ResourceBookingQuery.new(name: '_', filters: session[session_key][:filters], options: session[session_key][:options])\n @query.project = @project\n end\n @query\n end", "def query_params\n {\n name:,\n q: query,\n api_key:\n }\n end", "def _query(*params)\n fail 'not implemented'\n end", "def query_string\n end", "def query_params\n @query_params ||= QueryParamsController.new config\n end", "def query\n @query = Riddle::Query.escape params[:search]\n end", "def query\n super\n end", "def query\n @query = Riddle::Query.escape params[:search]\n end", "def index\n #@parameters = Parameter.all\n @q = Parameter.search(params[:q])\n @parameters = @q.result(:distinct => true).order(sort_column + ' ' + sort_direction).paginate( :page => params[:page])\n @q.build_condition\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parameters }\n end\n end", "def call(params)\n @controller = 'query'\n end", "def query_params()\n ActionController::Parameters.new({ })\n end", "def query\n @query ||= Waves::Request::Query.new( \n Waves::Request::Utilities.destructure( request.query ) )\n end", "def query\n sanitize search_params['query']\n end", "def query_params\n get_query_params\n end", "def build_query\n case query = build_query_values.inject{|q,v| query_coder.decode(q).deep_merge(query_coder.decode(v)) }\n when Hash\n query_coder.encode(query)\n when String, NilClass\n query\n else\n raise InvalidRepresentationError, 'expected Hash, String, or NilClass but got: '+query.class.name\n end\n end", "def query_params\n params.require(:query).permit(:name, :label, :description, :created_by, :sql, :conditions)\n end", "def initialize\n super(\"query\")\n end", "def query_params\n params.fetch(:query, {})\n end", "def query\n return if @item[:query].present? # when :query excplicitly defined then no need to resolve matchers\n @item[:query] = cleanup(Query::Builder.for(item: @item))\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def query\n\t\t\treturn @query if @query\n\n\t\t\t@query = CGI.parse(request.query_string)\n\t\t\t@query.default = nil # ruby/lib/cgi/core.rb:340 = den of iniquity.\n\t\t\t@query\n\t\tend", "def query(params)\n request(Resources::RESOURCE_QUERY, HTTP_METHOD_POST, params)\n end", "def query_params\n validate_params!\n \n qargs = {\n Ebay::Search::Api::OPERATION_NAME[:key] => Ebay::Search::Api::OPERATION_NAME[:value],\n Ebay::Search::Api::SERVICE_VERSION[:key] => Ebay::Search::Api::SERVICE_VERSION[:value],\n Ebay::Search::Api::SECURITY_APPNAME[:key] => self.app_name,\n Ebay::Search::Api::GLOBAL_ID[:key] => self.global_id,\n Ebay::Search::Api::RESPONSE_DATA_FORMAT[:key] => Ebay::Search::Api::RESPONSE_DATA_FORMAT[:value],\n Ebay::Search::Api::PER_PAGE[:key] => self.per_page,\n Ebay::Search::Api::KEYWORDS[:key] => self.keywords\n }\n \n query_formatter(qargs) do |params|\n params.join(\"&\")\n end\n end", "def query\n unless @query\n parse_query()\n end\n @query\n end", "def dh_api_query(command, params = ''); end", "def handle_query_param\n if params[:query].is_a? ActionController::Parameters \n params[:query].permit!\n params[:query].to_h\n else\n params[:query]\n end\n end", "def get_buy_requests_query\n s1='\"properties\".\"order_type\" = '+\"'#{params[:property][:order_type]}'\"\n if params[:property][:property_type] != 0 && params[:property][:property_type] != \"NILL\" && params[:property][:property_type].present?\n s1=s1+\" AND \"+'\"properties\".\"property_type\" = '+\"'#{params[:property][:property_type]}'\"\n end\n if params[:property][:property_location] != 0 && params[:property][:property_location] != \"NILL\" && params[:property][:property_location].present? \n s1=s1+\" AND \"+'\"properties\".\"property_location\" = '+\"'#{params[:property][:property_location]}'\"\n end\n if params[:property][:property_locality] != 0 && params[:property][:property_locality] != \"NILL\" && params[:property][:property_locality].present? \n s1=s1+\" AND \"+'\"properties\".\"property_locality\" = '+\"'#{params[:property][:property_locality]}'\" \n end \n return s1\n end", "def query\n @query ||= search.query\n end", "def query\n @operation = :query\n self\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def set_query\n\t\t@query = Query.find(params[:id])\n\tend", "def stringToQuery (val)\n\t\t\n\tend", "def query_params\n params.require(:query).permit(:date, :status, :note, :patient_id, :specialist_id)\n end", "def query\n ([query_for_one_keyword] * split_query_string.size).join(' AND ')\n end", "def query_builder table, search\n \n # Throw on some wildcards to make search more forgiving\n search_string = \"%#{search}%\"\n\n # Check to see if the search_string is a number, if it is, also search on numerical columns\n search_number = (is_number? search) ? Float(search) : nil\n\n search_date = parse_date(search)\n\n query = nil\n case table \n when :track\n query = infrastructure_query_builder(search_string, nil)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_track_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :guideway\n query = infrastructure_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :power_signal\n query = infrastructure_query_builder(search_string, nil)\n .or(org_query search_string)\n .or(asset_subtype_query search_string)\n .or(infrastructure_division_query search_string)\n .or(infrastructure_subdivision_query search_string)\n .or(infrastructure_track_query search_string)\n .or(infrastructure_segment_type_query search_string)\n .or(fta_asset_class_query search_string)\n when :capital_equipment\n query = transit_asset_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_equipment_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(fta_asset_class_query search_string)\n when :service_vehicle\n query = service_vehicle_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_vehicle_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(fta_asset_class_query search_string)\n .or(chassis_query search_string)\n .or(fuel_type_query search_string)\n when :bus, :rail_car, :ferry, :other_passenger_vehicle\n query = service_vehicle_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(manufacturer_query search_string)\n .or(manufacturer_model_query search_string)\n .or(fta_vehicle_type_query search_string)\n .or(asset_subtype_query search_string)\n .or(esl_category_query search_string)\n .or(fta_asset_class_query search_string)\n .or(chassis_query search_string)\n .or(fuel_type_query search_string)\n .or(fta_funding_type_query search_string)\n .or(fta_ownership_type_query search_string)\n when :passenger_facility, :maintenance_facility, :admin_facility, :parking_facility\n query = transit_asset_query_builder(search_string, search_number)\n .or(org_query search_string)\n .or(fta_equipment_type_query search_string)\n .or(asset_subtype_query search_string)\n end\n query = query.or(TransamAsset.arel_table[:in_service_date].eq(search_date)) if search_date\n query.or(ServiceStatusType.arel_table[:name].matches(search_string))\n .or(life_cycle_action_query search_string, search_date)\n .or(term_condition_rating_query search_string, search_number)\n end", "def query_params\n params.require(:query).permit(:name, :query_string)\n end", "def query_params\n {}\n end", "def build_query(builder)\n builder.OPTION {\n @option.each do |k, v|\n builder.PARAMETER k.to_s.upcase\n value = case v\n when Array then v.join(',')\n when Hash then v.map { |a| a.join(':') }.join(',')\n else\n v.to_s\n end\n\n # I don't know this is correct or not, but I think we should not\n # touch third party ID.\n value.upcase! unless k == :prefer_xid\n\n builder.VALUE value\n end\n }\n end", "def query\n\t\tQuery.new(\"true\")\n\tend", "def query_string\n return @query_string\n end", "def base_query\n DataServicesApi::QueryGenerator.new\n end", "def query_param\n return unless search_query\n \"search=#{search_query}&phrase=true\"\n end", "def query_params\n {}\n end", "def query_params\n {}\n end", "def query_builder_with_filter_from_hash(params)\n types = get_types_parameters\n\n validate_parameters(types, params)\n\n pattern = params[:q]\n\n only_liked = params[:only_liked] == 'true'\n only_shared = params[:only_shared] == 'true'\n only_subscriptions = params[:subscribed] == 'true'\n only_samples = params[:sample] == 'true'\n exclude_shared = params[:exclude_shared] == 'true'\n exclude_raster = params[:exclude_raster] == 'true'\n locked = params[:locked]\n shared = compose_shared(params[:shared], only_shared, exclude_shared)\n tags = params.fetch(:tags, '').split(',')\n tags = nil if tags.empty?\n bbox_parameter = params.fetch(:bbox,nil)\n privacy = params.fetch(:privacy,nil)\n only_with_display_name = params[:only_with_display_name] == 'true'\n with_dependent_visualizations = params[:with_dependent_visualizations].to_i\n only_published = params[:only_published] == 'true'\n\n vqb = VisualizationQueryBuilder.new\n .with_prefetch_user\n .with_prefetch_table\n .with_prefetch_permission\n .with_prefetch_synchronization\n .with_prefetch_external_source\n .with_types(types)\n .with_tags(tags)\n\n if !bbox_parameter.blank?\n vqb.with_bounding_box(Carto::BoundingBoxUtils.parse_bbox_parameters(bbox_parameter))\n end\n\n # FIXME Patch to exclude legacy visualization from data-library #5097\n if only_with_display_name\n vqb.with_display_name\n end\n\n vqb.with_published if only_published\n\n if current_user\n vqb.with_current_user_id(current_user.id)\n vqb.with_liked_by_user_id(current_user.id) if only_liked\n vqb.with_subscription if only_subscriptions\n vqb.with_sample if only_samples\n case shared\n when FILTER_SHARED_YES\n vqb.with_owned_by_or_shared_with_user_id(current_user.id)\n when FILTER_SHARED_NO\n vqb.with_user_id(current_user.id) if !only_liked\n when FILTER_SHARED_ONLY\n vqb.with_shared_with_user_id(current_user.id)\n .with_user_id_not(current_user.id)\n end\n\n vqb.without_raster if exclude_raster\n\n if locked == 'true'\n vqb.with_locked(true)\n elsif locked == 'false'\n vqb.with_locked(false)\n end\n\n if types.include? Carto::Visualization::TYPE_REMOTE\n vqb.without_synced_external_sources\n vqb.without_imported_remote_visualizations\n end\n\n vqb.with_privacy(privacy) unless privacy.nil?\n\n if with_dependent_visualizations.positive? && !current_user.has_feature_flag?('faster-dependencies')\n vqb.with_prefetch_dependent_visualizations\n end\n else\n user = Carto::User.where(username: CartoDB.extract_subdomain(request)).first\n raise Carto::ParamInvalidError.new(:username) unless user.present?\n vqb.with_user_id(user.id)\n .with_privacy(Carto::Visualization::PRIVACY_PUBLIC)\n end\n\n if pattern.present?\n vqb.with_partial_match(pattern)\n end\n\n vqb\n end", "def new\n @query = params[:query]\n end", "def query_params\n @query_params ||= params[:query].present? ? JSON.parse(params[:query].gsub('=>', ':')) : {}\n end", "def sql_query_params\n params.fetch(:sql_query, {})\n end", "def query_param\n ::Genghis::JSON.decode(params.fetch('q', '{}'))\n end", "def query_param\n ::Genghis::JSON.decode(params.fetch('q', '{}'))\n end", "def query\n get_query_object\n end", "def query\n attributes.fetch(:query)\n end", "def index\r\n @query_params = {}\r\n\r\n build_query_params(params)\r\n build_query_consultant_params\r\n\r\n @conditions = []\r\n @conditions << Consultant.arel_table[:name].matches(\"%#{@query_params[:name]}%\") if @query_params[:name]\r\n\r\n if @conditions.length > 0\r\n conditions = @conditions[0]\r\n @conditions.each_with_index do |item, index|\r\n conditions = conditions.or(item) if index > 0\r\n end\r\n @conditions = conditions\r\n end\r\n\r\n respond_to do |format|\r\n format.html { set_consultants_grid(@conditions) }\r\n format.json { render json: Consultant.where(@conditions) }\r\n end\r\n end", "def to_query\n return nil if config.nil? # not a whitelisted attr\n klass = JsonApiServer.filter_builder(builder_key) || raise(\"Query builder '#{builder_key}' doesn't exist.\")\n builder = klass.new(attr, casted_value, operator, config)\n builder.to_query(@model)\n end", "def prepare(params)\n @query = Escaping.escape(params[:keywords] || \"\")\n @sorting = params[:sorting]\n @taxons = params[:taxon] unless params[:taxon].nil?\n @browse_mode = params[:browse_mode] unless params[:browse_mode].nil?\n if params[:search]\n # price\n if params[:search][:price]\n @price_min = params[:search][:price][:min].to_f\n @price_max = params[:search][:price][:max].to_f\n end\n # discount_rate\n if params[:search][:discount]\n @discount_min = params[:search][:discount][:min].to_f\n @discount_max = params[:search][:discount][:max].to_f\n end\n # properties\n @properties = params[:search][:properties]\n end\n\n @per_page = (params[:per_page].to_i <= 0) ? Spree::Config[:products_per_page] : params[:per_page].to_i\n @page = (params[:page].to_i <= 0) ? 1 : params[:page].to_i\n end", "def get_search_params_and_query_string\n if !params[:tire_model_id].blank?\n @tire_store.tire_model_id = params[:tire_model_id]\n @search_query = \"tire_model_id=#{params[:tire_model_id].to_i}\"\n else\n if !params[:auto_options_id].blank?\n option = AutoOption.find(params[:auto_options_id])\n @tire_store.tire_size_id = option.tire_size_id if option\n elsif !params[:width].blank? && !params[:ratio].blank? && !params[:wheeldiameter].blank?\n # check and make sure the size is valid\n ts = TireSize.find_by_sizestr(\"#{params[:width].to_i}/#{params[:ratio].to_i}R#{params[:wheeldiameter].to_i}\")\n @tire_store.tire_size_id = ts.id if ts\n end\n \n if @tire_store.tire_size_id\n @search_query = \"tire_size_id=#{@tire_store.tire_size_id}\"\n \n #Don't include the manufacturer filter unless we have a valid size search going\n if !params[:tire_manufacturer_id].blank?\n @tire_store.tire_manufacturer_id_filter = params[:tire_manufacturer_id]\n @search_query += \"&tire_manufacturer_id_filter=#{params[:tire_manufacturer_id].to_i}\"\n end\n end\n end\n end", "def initial_query(arg)\n query = Hash.new\n query[:status_id] = arg[:status_id] if arg[:status_id].present?\n return query\n end", "def query query_object\n\t\tcase query_object.kind\n\t\t\twhen \"random\"\n\t\t\t\tget_random query_object\n\t\t\twhen \"query\"\n\t\t\t\tget_query query_object\n\t\t\twhen \"category_kind\"\n\t\t\t\tget_category query_object\n\t\t\telse\n\t\t\t\tset_error query_object\n\t\tend\n\n\t\tquery_object\n\tend", "def set_query\n @query = Query.find(params[:id])\n end", "def set_query\n @query = Query.find(params[:id])\n end", "def set_query\n @query = Query.find(params[:id])\n end" ]
[ "0.73308015", "0.6921461", "0.6907983", "0.6833503", "0.6820729", "0.6759445", "0.6717917", "0.67046714", "0.67030483", "0.66915774", "0.66683924", "0.66377103", "0.6634972", "0.6631745", "0.6623846", "0.65966046", "0.65668494", "0.6553683", "0.65521044", "0.6530581", "0.65080166", "0.6504441", "0.64795774", "0.64468694", "0.64437115", "0.64214814", "0.6414901", "0.6393525", "0.6388316", "0.6379859", "0.6378971", "0.63488114", "0.63488114", "0.63472456", "0.63457906", "0.6339059", "0.632771", "0.63275105", "0.6307357", "0.63026834", "0.63009137", "0.6299535", "0.6299036", "0.62988555", "0.629412", "0.6291986", "0.6274283", "0.6255508", "0.62439466", "0.62407064", "0.6237669", "0.6233281", "0.6225997", "0.6210499", "0.61947", "0.61947", "0.61947", "0.61947", "0.61892515", "0.617515", "0.61449885", "0.61445355", "0.61351264", "0.6129542", "0.61283576", "0.61205155", "0.6119615", "0.6111708", "0.6111708", "0.6111708", "0.6106954", "0.609551", "0.6093514", "0.6087274", "0.60841316", "0.6082598", "0.608022", "0.6074776", "0.60719", "0.60662377", "0.60582894", "0.6058174", "0.60535324", "0.60535324", "0.60481524", "0.6047922", "0.6046083", "0.6042973", "0.6041434", "0.6041434", "0.60302806", "0.60301304", "0.60299826", "0.60277903", "0.60260546", "0.6015305", "0.60092825", "0.60031646", "0.60023534", "0.60023534", "0.60023534" ]
0.0
-1
generate_query ends here this method is used to construct xml structure based on the recordset retrived from the database this method is used to construct xml structure for piechart
def generate_piechartXML(*args) begin @color_hash=Hash.new @color_hash={"0"=>"0C95BF","1"=>"12C400","2"=>"ECB800","3"=>"EB2300","4"=>"70808F","5"=>"000000","6"=>"800080","7"=>"FFFF00","8"=>"7FFFD4","9"=>"0377CA","10"=>"15C2F7"} if @@flag==true #~ @@strXML = "<chart decimals='2' defaultAnimation='0' use3DLighting='0' showPlotBorder='1' showShadow='0' plotGradientColor='0' showLabels='1' chartTopMargin='0' chartLeftMargin='0' chartRightMargin='0' chartBottomMargin='0' showValues='0' baseFontSize='12' isSliced='1' enableSmartLabels='1' bgColor='FFFFFF' showBorder='0' plotBorderThickness='0' startingAngle='80' canvasBorderColor ='cccccc' canvasBorderAlpha='0' canvasBorderThickness='0' showPercentageValues='1' pieRadious='100'>" if args[2]=='Device_Summary' or args[2]=="Carrier_Traffic" puts "hello" p @@strXML = "<chart decimals='2' defaultAnimation='0' use3DLighting='0' showPlotBorder='1' showShadow='0' plotGradientColor='0' showLabels='1' chartTopMargin='0' chartLeftMargin='0' chartRightMargin='0' chartBottomMargin='0' showValues='0' baseFontSize='12' isSliced='1' enableSmartLabels='1' bgColor='FFFFFF' showBorder='0' plotBorderThickness='0' startingAngle='80' canvasBorderColor ='cccccc' canvasBorderAlpha='0' canvasBorderThickness='0' showPercentageValues='1' pieRadious='100'>" #~ @@strXML = "<chart decimals='2' yAxisName='#{args[3].to_s=='ecpm' ? 'eCPM' : (args[3].to_s).upcase}' divLineColor='CCCCCC' numDivLines='2' alternateHGridColor='FFFFFF' anchorBorderColor='FFFFFF' defaultAnimation='0' use3DLighting='0' alternateVGridColor='FFFFFF' showPlotBorder='0' showShadow='0' plotGradientColor='' showLabels='1' chartTopMargin='10' chartLeftMargin='0' chartRightMargin='0' chartBottomMargin='10' showValues='0' canvasBorderColor ='FFFFFF' formatNumberScale='0' canvasBorderAlpha='0' canvasBorderThickness='0' pieRadious='100' baseFontSize='12' showBorder='0' plotBorderThickness='0' bgColor='FFFFFF' showPercentageValues='1' > " if args[3]=='ctr' || args[3]=='ecpm' @@flag=false end colour=@color_hash["#{@@color_count}"] limit = (args[3]=='ctr' || args[3]=='ecpm') ? 10 : 15 args[0]=(args[0]=='' || args[0]==nil) ? 'could not detect' : args[0] puts "---------------------34----------" p @@strXML=@@strXML+ "<set label='#{args[0]!=nil ? (truncate(args[0].split("'")[0].to_s,limit)).gsub(/([&%])/) do|s| @@getsymbol["#{s}"] end : 'NA' }' value='#{args[1].to_s}' color='#{(args[0].to_s=='Others') ? '000000' : colour.to_s}' />" if args[3]!='ctr' and args[2]!='URL' and args[3]!='ecpm' puts "---------------------35----------" #~ @@strXML+="<set label='#{args[0].to_s.gsub(/([&%])/) do|s| @@getsymbol["#{s}"] end}' value='#{args[1].to_s}' color='176D94'/>" if args[3]=='ctr' || args[3]=='ecpm' @@color_count+=1 rescue Exception=>e puts "DEBUGGER :: ERROR :: in AdminXmlBuilder Component under generate_piechartXML method. The Error is #{e.to_s}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_query_data(*args) #generate_query starts here\n begin\n @@XML_array=Array.new\n @pub_id=(args[0].split('-')[0]).to_i\n chk_filled=args[0].split('-')[1]\n @tablename=args[1]\n @report_type=args[2]\n @column1=args[3]\n @column2=args[4]\n @adclientid=args[5]\n @enddate=args[7]\n @startdate=args[6]\n @startdate= (args[8]=='0' and (@report_type=='Visitors' or @report_type=='Traffic_summary')) ? (Time.now - 2592000).to_s : (args[8]=='1' and (@report_type=='Visitors' or @report_type=='Traffic_summary')) ? (Time.now - 2678400).to_s : (((Time.parse(@startdate))==(Time.parse(@enddate))) && (@report_type=='Visitors' or @report_type=='Traffic_summary')) ? (((Time.parse(@enddate))-2592000).to_s) : args[6]\n controller=args[9]\n temp=args[10]\n type=args[11]\n #args[8] returns 1 or 0 in PieChart for smartLabel, in LineChart return 1 for duration\n @start_year= Time.parse(@startdate).strftime(\"%Y-%m-%d\").split('-')[0] #retrieves start year, selected by the publisher\n @start_day=Time.parse(@startdate).strftime(\"%Y-%m-%d\").split('-')[2] #retrives start day, selected by the publisher\n @start_month=Time.parse(@startdate).strftime(\"%Y-%m-%d\").split('-')[1] #retrives start month, selected by the publisher\n @end_year=Time.parse(@enddate).strftime(\"%Y-%m-%d\").split('-')[0] #retrives end year, selected by the publisher\n @end_month=Time.parse(@enddate).strftime(\"%Y-%m-%d\").split('-')[1] #retrives end month, selected by the publisher\n @end_day=Time.parse(@enddate).strftime(\"%Y-%m-%d\").split('-')[2] #retrives end day, selected by the publisher\n begin\n filter_column=chk_filled=='filled' ? (@tablename=='adclients_summaries' || @tablename=='publisher_handset_overviews' || @tablename=='pub_geolocations' || @tablename=='adclients_summaries') ? @report_type=='Traffic_summary' ? \"and (impressions>0 or clicks>0)\" : \"and requests>0\" : \"and requests>0\" : chk_filled=='unfilled' ? \"and fill_rate>0\" : (chk_filled=='both' && (@tablename=='adclients_summaries' || @tablename=='adclients_summaries')) ? \"and (impressions>0 or fill_rate>0 or clicks>0)\" : (chk_filled=='both' && ( @tablename=='publisher_handset_overviews' || @tablename=='publisher_traffic_contient_overviews')) ? \"and (impressions>0 or fill_rate>0)\" : \"and (requests>0 or fill_rate>0)\"\n #following code is used to frame query to retrieve recordset from the database\n continent_traffic=\"if(continent_code='CB','NA',continent_code) as continent\"\n continent_code=args[8].to_s=='NA' ? \"'NA' or continent_code='CB'\" : \"'#{args[8]}'\" if @report_type=='Traffic_Continent'\n if @report_type=='Visitors' || @report_type=='Traffic_summary'\n #following code is used to calculate modulas value if applicable\n @add_month=0\n @no_day=(@end_day.to_i-@start_day.to_i)+1\n if @end_year.to_i!=@start_year.to_i\n @add_month=@end_month.to_i+12\n @add_month=@add_month.to_i-@start_month.to_i\n @no_day+=(@add_month*30)\n elsif @end_month.to_i>@start_month.to_i\n @add_month=@end_month.to_i-@start_month.to_i\n @no_day+=(@add_month*30)\n end\n @modulas=@no_day/30>0 ? @no_day/30 : 1\n sql_query+=\" and if(((delivery_date='#{@start_year}-01-#{@start_day}') || (delivery_date='#{@end_year}-#{@end_month.to_i}-#{@end_day.to_i}')),Day(delivery_date),Day(delivery_date)%#{@modulas}=0)\" if @startdate!=nil and @startdate!=\"\" and @enddate!=nil and @enddate!=\"\" and @modulas.to_i>1\n sql_query+=\" group by delivery_date order by null\" \n @@date_count=Time.parse(@startdate)\n end\n rescue Exception=>e\n puts\"Error:: under query generator and the exception is:#{e.to_s}\"\n end\n begin\n @tablename=@tablename.classify.constantize #convert the string into model name\n puts \"sql_query:::::::#{@tablename}\"\n @recordset=@tablename.show_data(@pub_id,type) # fetch the recordset from table\n \n rescue Exception=>e\n puts \"DEBUGGER :: ERROR :: in publisher_xml.rb - generate query data :: #{e.to_s}\"\n end\n @@XML_array.clear\n @anchor_color=\"anchorBgColor='FF0000'\"\n count=0\n othersValue=0\n otherPercentage=0.00\n if @recordset!=nil #main If conditons starts here\n if @recordset.size !=0 #sub main If conditons starts here\n for recordset in @recordset \n #Checks report_type to call corresponding method to generate report.\n if @report_type=='Traffic'\n @@strXML+=\"</data>\"\n @@strXML+=\"<colorRange><color minValue='0' maxValue='#{(@@date_count/3)}' displayValue='Low' color='A7FF98' /><color minValue='#{((@@date_count/3))}' maxValue='#{(@@date_count-(@@date_count/3))}' displayValue='Moderate' color='2CCE00' /><color minValue='#{(@@date_count-(@@date_count/3))}' maxValue='#{(@@date_count)+1}' displayValue='High' color='007700' /></colorRange></map>\"\n end\n if @report_type=='Pie_chart'\n count+=1\n if (count.to_i<=5)\n generate_piechartXML(recordset[@column1],recordset[@column2],@column1,args[8],controller)\n \n else\n othersValue+=recordset.requests.to_i\n if (@recordset.size.to_i==count.to_i)\n generate_piechartXML('Others',othersValue,@column1,args[8],controller)\n end\n end\n elsif @report_type=='Visitors'\n generate_linechartXML(recordset[@column2],recordset[@column1],@startdate,@enddate,@report_type,@no_day,args[8]) \n elsif @report_type=='Traffic'\n puts 'Traffic'\n generate_contmapXML(recordset.continent_code,recordset.impression,@report_type,@pub_id,@adclientid,controller) \n end \n end #for loop ends here\n \n #following code is used to insert default xml values (zero) for which recordset are not available\n #checks if report type is hourly report and insert default for hourly report if records are not available in DB\n \n if @report_type=='Pie_chart'\n @@strXML+=\"<styles><definition><style name='myLabelsFont' type='font' font='Arial' size='14' color='404040' bold='0'/></definition><application><apply toObject='DataLabels' styles='myLabelsFont' /></application></styles>\" \n elsif @report_type=='Visitors' \n if Time.parse(@enddate).strftime(\"%Y-%m-%d\")>@@date_count.strftime(\"%Y-%m-%d\")\n while Time.parse(@enddate).strftime(\"%Y-%m-%d\")>=@@date_count.strftime(\"%Y-%m-%d\")\n delivery_day=@@date_count.strftime(\"%Y-%m-%d\").split('-')[2] #will return day\n if Time.parse(@enddate).strftime(\"%Y-%m-%d\")==@@date_count.strftime(\"%Y-%m-%d\")\n @@strXML+= \"<set name='#{@@date_count.strftime(\"%d-%b-%Y\")}' value='0' #{@anchor_color if args[8].to_s=='0'}/>\" \n elsif delivery_day.to_i%@modulas==0 \n @@strXML+= \"<set name='#{@@date_count.strftime(\"%d-%b-%Y\")}' value='0'/>\"\n end\n @@date_count+=86400\n end\n elsif Time.parse(@enddate).strftime(\"%Y-%m-%d\")==@@date_count.strftime(\"%Y-%m-%d\")\n @@strXML+= \"<set name='#{@@date_count.strftime(\"%d-%b-%Y\")}' value='0' #{@anchor_color if args[8].to_s=='0'}/>\" \n end\n @@strXML+=\"<styles><definition><style name='myLabelsFont' type='font' font='Arial' size='12' color='000000' bold='1'/></definition><application><apply toObject='DataLabels' styles='myLabelsFont' /></application></styles>\"\n end\n @@strXML = @@strXML + \"</chart>\" if @report_type!='Traffic'and @report_type!='Traffic_Continent'\n else\n #@@strXML=\"<chart chartTopMargin='1' chartLeftMargin='1' caption='Traffic' decimalPrecision='0' bgColor='ffffff' xAxisName='Days' yAxisName='#{args[4]}' showNames='1' rotateNames='1' labelDisplay='ROTATE' alternateHGridAlpha='40' numDivLines='5' divLineColor='CCCCCC' divLineThickness='1' alternateHGridColor='CCCCCC' showBorder='0'>\" if @report_type!='Traffic'and @report_type!='Traffic_Continent'\n # @@strXML+= \"<set name='No Data' value='0' color='666666'/>\"\n end #sub main If ends here\n end #main if ends here\n #reinitialize flag, str variable and counters to construct next chart.\n @@flag=true \n @@hour=0\n @@mod=0\n @@color_count=0\n @@date_count=0\n @returnstrXML=@@strXML #assigns chart string to instance varaible and reintialize the chart_class variable.\n @@strXML='' \n @@cat_strXML=''\n @@multi_strXML=''\n @@xml_hash=nil\n @@xml_hash={:xml_string=>@returnstrXML,:xml_array=>@@XML_array }\n return @@xml_hash\n \n rescue Exception=>e\n puts \"ERROR :: in PublisherXml Component and generate_query_data method. The error is #{e.to_s}\"\n end\n end", "def getperdidas\n\n buffer = ''\n builder = Builder::XmlMarkup.new(:target=>buffer, :indent=>2)\n builder.instruct!\n\n\t\t@periodos = Dato.where([\"distribuidora_id = ? and periodo >= ? and periodo <= ?\",params['distribuidora_id'],params['perinic'].to_i-100,params['perfin']]).select('distinct periodo').order('periodo')\n\n\t\tbuilder.init{\n\t\t\tbuilder.periodos {\n\t\t\t\t@periodos.each { |p|\n\t\t\t\t\tbuilder.periodo{\n\t\t\t\t\t\tbuilder.distribuidora_id(params['distribuidora_id'])\n\t\t\t\t\t\tbuilder.zona_id(params['zona_id'])\n\t\t\t\t\t\tbuilder.periodo(p.periodo)\n\n\t\t\t\t\t\t\tif (params['zona_id'].to_i == 1 || params['zona_id'].to_i || 9 && params['zona_id'].to_i == 18)\n\n\t\t\t\t\t\t\t tmp = Dato.where([\"tdato_id = 1 and zona_id not in (8,17,31) and distribuidora_id = ? and periodo = ?\",params['distribuidora_id'],p.periodo]).sum(:energia)\n\t\t\t\t\t\t\t tmp = tmp - Dato.where([\"tdato_id = 1 and zona_id in (8,17,31) and distribuidora_id = ? and periodo = ?\",params['distribuidora_id'],p.periodo]).sum(:energia)\n\t\t\t\t\t\t\t builder.MEM(tmp)\n\t\n\t\t\t\t\t\t\t\tbuilder.TER(Dato.where([\"tdato_id = 2 and distribuidora_id = ? and periodo = ?\",params['distribuidora_id'],p.periodo]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.GEN(Dato.where([\"tdato_id = 3 and distribuidora_id = ? and periodo = ?\",params['distribuidora_id'],p.periodo]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.DIS(Dato.where([\"tdato_id = 4 and distribuidora_id = ? and periodo = ?\",params['distribuidora_id'],p.periodo]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.GMA(Dato.where([\"tdato_id = 5 and distribuidora_id = ? and periodo = ?\",params['distribuidora_id'],p.periodo]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.GME(Dato.where([\"tdato_id = 6 and distribuidora_id = ? and periodo = ?\",params['distribuidora_id'],p.periodo]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.PRO(Dato.where([\"tdato_id = 7 and distribuidora_id = ? and periodo = ?\",params['distribuidora_id'],p.periodo]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.REC(Dato.where([\"tdato_id = 8 and distribuidora_id = ? and periodo = ?\",params['distribuidora_id'],p.periodo]).sum(:energia))\n\n\t\t\t\t\t\t\telsif (params['zona_id'].to_i == 7 || params['zona_id'].to_i == 16)\n\n\t\t\t\t\t\t\t builder.MEM(Dato.where([\"tdato_id = 1 and zona_id in (7,16) and distribuidora_id = ? and periodo = ?\",params['distribuidora_id'],p.periodo]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.TER(0)\n\t\t\t\t\t\t\t\tbuilder.GEN(0)\n\t\t\t\t\t\t\t builder.DIS(Dato.where([\"tdato_id = 1 and zona_id in (8,17) and distribuidora_id = ? and periodo = ?\",params['distribuidora_id'],p.periodo]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.GMA(0)\n\t\t\t\t\t\t\t\tbuilder.GME(0)\n\t\t\t\t\t\t\t\tbuilder.PRO(0)\n\t\t\t\t\t\t\t\tbuilder.REC(0)\n\n\t\t\t\t\t\t\telse\n\n\t\t\t \t\t\t\t builder.MEM(Dato.where([\"tdato_id = 1 and distribuidora_id = ? and periodo = ? and zona_id = ?\",params['distribuidora_id'],p.periodo,params['zona_id']]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.TER(Dato.where([\"tdato_id = 2 and distribuidora_id = ? and periodo = ? and zona_id = ?\",params['distribuidora_id'],p.periodo,params['zona_id']]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.GEN(Dato.where([\"tdato_id = 3 and distribuidora_id = ? and periodo = ? and zona_id = ?\",params['distribuidora_id'],p.periodo,params['zona_id']]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.DIS(Dato.where([\"tdato_id = 4 and distribuidora_id = ? and periodo = ? and zona_id = ?\",params['distribuidora_id'],p.periodo,params['zona_id']]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.GMA(Dato.where([\"tdato_id = 5 and distribuidora_id = ? and periodo = ? and zona_id = ?\",params['distribuidora_id'],p.periodo,params['zona_id']]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.GME(Dato.where([\"tdato_id = 6 and distribuidora_id = ? and periodo = ? and zona_id = ?\",params['distribuidora_id'],p.periodo,params['zona_id']]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.PRO(Dato.where([\"tdato_id = 7 and distribuidora_id = ? and periodo = ? and zona_id = ?\",params['distribuidora_id'],p.periodo,params['zona_id']]).sum(:energia))\n\t\t\t\t\t\t\t\tbuilder.REC(Dato.where([\"tdato_id = 8 and distribuidora_id = ? and periodo = ? and zona_id = ?\",params['distribuidora_id'],p.periodo,params['zona_id']]).sum(:energia))\n\n\t\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\trender :xml=> buffer\n\n\tend", "def generate_dataset\n return nil if query.nil?\n # execute the query\n data = Array ActiveRecord::Base.connection.execute(query)\n return [] if data.empty?\n # Convert the query into an easy to read format\n @dataset = [data.first.keys]+data.map{|dd|dd.values}\n return @dataset\n end", "def generate_xml( args={} )\n biomart_xml = \"\"\n xml = Builder::XmlMarkup.new( :target => biomart_xml, :indent => 2 )\n \n xml.instruct!\n xml.declare!( :DOCTYPE, :Query )\n xml.Query( :virtualSchemaName => \"default\", :formatter => \"TSV\", :header => \"0\", :uniqueRows => \"1\", :count => args[:count], :datasetConfigVersion => \"0.6\" ) {\n xml.Dataset( :name => @name, :interface => \"default\" ) {\n \n if args[:filters]\n args[:filters].each do |name,value|\n if value.is_a? Array\n value = value.join(\",\")\n end\n xml.Filter( :name => name, :value => value )\n end\n else\n self.filters.each do |name,filter|\n if filter.default\n xml.Filter( :name => name, :value => filter.default_value )\n end\n end\n end\n \n unless args[:count]\n if args[:attributes]\n args[:attributes].each do |name|\n xml.Attribute( :name => name )\n end\n else\n self.attributes.each do |name,attribute|\n if attribute.default\n xml.Attribute( :name => name )\n end\n end\n end\n end\n \n }\n }\n \n return biomart_xml\n end", "def generate_query(*args) #generate_query starts here\n begin\n @tablename=args[0].split('-')[0]\n @duration=args[0].split('-')[1]\n @report_type=args[1] \n @column1=args[2]\n @column2=args[3]\n @startdate=args[4]\n @enddate=args[5]\n @order=args[6]\n @limit=args[7]\n @column3=args[8]\n @page=(args[9]!=nil) ? args[9] : 0\n #~ @start_year= Time.parse(@startdate).strftime(\"%Y-%m-%d\").split('-')[0] if @startdate!=nil #selects only year\n #~ @start_day=Time.parse(@startdate).strftime(\"%Y-%m-%d\").split('-')[2] if @startdate!=nil#selects only day\n #~ @start_month=Time.parse(@startdate).strftime(\"%Y-%m-%d\").split('-')[1] if @startdate!=nil\n #~ @end_year=Time.parse(@enddate).strftime(\"%Y-%m-%d\").split('-')[0] if @enddate!=nil\n #~ @end_month=Time.parse(@enddate).strftime(\"%Y-%m-%d\").split('-')[1] if @enddate!=nil\n #~ @end_day=Time.parse(@enddate).strftime(\"%Y-%m-%d\").split('-')[2] if @enddate!=nil\n #~ @ctr=\"((sum(clicks)/sum(impressions))*100)\"#if @report_type!=\"Overall_Performance\"\n #~ @ecpm='((sum(revenue)/sum(impressions))*1000)'\n #~ customize_column= @column3=='campaign_name' ? 'c.campaign_name' : @column3=='pub_name' ? 'p.publisher_name' : @column3=='advertiser_name' ? 'a.name' : ''\n #~ customize_table=@column3=='campaign_name' ? 'campaigns_summaries cs, campaigns c' : @column3=='pub_name' ? 'adclients_summaries ad,publishers p' : @column3=='advertiser_name' ? 'campaigns_summaries cs,advertisers a' : ''\n #~ customize_condition=@column3=='campaign_name' ? 'c.id=cs.campaign_id' : @column3=='pub_name' ? 'p.id=ad.pub_id' : @column3=='advertiser_name' ? 'a.id=cs.advertiser_id' : ''\n #~ customize_filter=@column3=='campaign_name' ? 'and (cs.impressions>0 or cs.clicks>0)' : @column3=='pub_name' ? 'and (ad.impressions>0 or ad.clicks>0)' : @column3=='advertiser_name' ? 'and (cs.impressions>0 or cs.clicks>0)' : ''\n #~ begin\n #~ # ---- Query Builder ----\n #~ sub_query=\"select count(*) as count from #{@tablename}\"\n #~ sub_query+=\" where delivery_date>='#{(Time.parse(@startdate)).strftime(\"%Y-%m-%d\")} 00:00:00' and delivery_date<='#{(Time.parse(@enddate)).strftime(\"%Y-%m-%d\")} 23:59:59'\" \n #~ #sub_query+=\"and #{@column1}!='ip' and #{@column1}!=''\"\n #~ obj=@column3=='pub_name' ? 'ad.' :'cs.' \n #~ sql_query =\"select #{customize_column} as #{@column3} , (#{(@column2=='ctr') ? @ctr : @column2=='ecpm' ? @ecpm : \"sum(#{obj}#{@column2})\"}) as #{@column2=='amount_spent' ? 'amt_spent' :@column2} from #{customize_table}\" \n #~ sql_query+=\" where delivery_date>='#{(Time.parse(@startdate)).strftime(\"%Y-%m-%d\")} 00:00:00' and delivery_date<='#{(Time.parse(@enddate)).strftime(\"%Y-%m-%d\")} 23:59:59' and #{customize_condition} #{customize_filter}\" \n #~ sql_query+=\" group by #{@column1} order by #{@column2=='amount_spent' ? 'amt_spent' :@column2} #{@order} limit #{@limit} offset #{@page}\" if @report_type!=\"Overall_Performance\"\n #~ sql_query+=\" group by #{@column1} order by #{@column2=='amount_spent' ? 'amt_spent' :@column2} #{@order} \" if @report_type==\"Overall_Performance\"\n #~ #following code is used to calculate modulas value if applicable\n #~ @add_month=0\n #~ @no_day=(@end_day.to_i-@start_day.to_i)+1\n #~ if @end_year.to_i!=@start_year.to_i\n #~ @add_month=@end_month.to_i+12\n #~ @add_month=@add_month.to_i-@start_month.to_i\n #~ @no_day+=(@add_month*30)\n #~ elsif @end_month.to_i>@start_month.to_i\n #~ @add_month=@end_month.to_i-@start_month.to_i\n #~ @no_day+=(@add_month*30)\n #~ end\n #~ @modulas=@no_day/30\n #~ @XML_xaxis='days'\n #~ @@date_count=Time.parse(@startdate)\n #~ rescue Exception=>e\n #~ puts \"DEBUGGER :: Error:: in admin_xml_builder.rb - generate_query ::#{e.to_s}\"\n #~ end\n @XML_xaxis='days'\n begin\n #~ @tablename=AdminCampaignWiseReport.show_data() #convert the string into model name\n #~ @tablename=@tablename.classify.constantize #convert the string into model name\n #~ @recordset=@tablename.find_by_sql(sql_query) # fetch the recordset from table\n @recordset=AdminCampaignWiseReport.top_campaigns_performance(@order,@startdate,@enddate) # fetch the recordset from table\n rescue Exception=>e\n puts \"DEBUGGER :: ERROR :: in admin_xml_builder.rb - generate_query :: #{e.to_s}\"\n end\n @anchor_color=\"anchorBgColor='FF0000'\"\n count=0\n othersValue=0.00\n if @recordset.size !=0 #main If conditons starts here\n for recordset in @recordset \n #Check whether publisher request click or impression or revenuereport\n i=1\n if args[3]!='imp vs clicks'\n #~ puts \"-------------check 1---------\"\n #~ generate_mutil_linechartXML(recordset.impressions,recordset.clicks,recordset.delivery_date,@startdate,@enddate,'Impression Vs Clicks',@no_day,@duration) \n #~ else\n count+=1\n if (count.to_i<=@limit.to_i)\n #~ puts \"-------------check 2----#{@report_type}-----\"\n generate_piechartXML(recordset[@column3],recordset[@column2]) \n else\n othersValue+=recordset[@column2].to_f\n if (@recordset.size.to_i==count.to_i)\n generate_piechartXML('Others',othersValue)\n end\n end\n i+=1\n end\n end #for loop ends here\n\n #to insert xml datas for which recordset are not available\n #~ if @report_type=='admin_campaign_wise_reports' and args[3].to_s!='imp vs clicks'\n #~ puts \"-------------check 3---------\"\n #~ if Time.parse(@enddate)>@@date_count\n #~ while Time.parse(@enddate)>=@@date_count\n #~ delivery_day=@@date_count.strftime(\"%Y-%m-%d\").split('-')[2] #will return day\n #~ if Time.parse(@enddate)==@@date_count\n #~ @@strXML+= \"<set name='#{@@date_count.strftime(\"%d-%b-%Y\")}' value='0' #{@anchor_color if @duration.to_i==1}/>\" \n #~ elsif delivery_day.to_i%@modulas==0 \n #~ @@strXML+= \"<set name='#{@@date_count.strftime(\"%d-%b-%Y\")}' value='0'/>\"\n #~ end\n #~ @@date_count+=86400\n #~ end\n #~ elsif Time.parse(@enddate)==@@date_count\n #~ @@strXML+= \"<set name='#{@@date_count.strftime(\"%d-%b-%Y\")}' value='0' #{@anchor_color if @duration.to_i==1}/>\" \n #~ end\n #~ @@strXML+=\"<styles><definition><style name='myLabelsFont' type='font' font='Arial' size='12' color='000000' bold='1'/></definition><application><apply toObject='DataLabels' styles='myLabelsFont' /></application></styles>\"\n #~ #to insert xml datas for impression vs click if recordsets are not available for specified date\n #~ elsif @report_type=='admin_campaign_wise_reports' && args[3].to_s=='imp vs clicks'\n #~ puts \"-------------check 1-1--------\"\n #~ if Time.parse(@enddate)>@@date_count\n #~ while Time.parse(@enddate)>=@@date_count\n #~ delivery_day=@@date_count.strftime(\"%Y-%m-%d\").split('-')[2] #will return day\n #~ if Time.parse(@enddate)==@@date_count \n #~ @@strXML+= \"<set value='0' #{@anchor_color if @duration.to_i==1}/>\"\n #~ @@cat_strXML+=\"<category label='#{@@date_count.strftime(\"%d-%b-%Y\")}'/>\"\n #~ @@multi_strXML+=\"<set value='0' #{@anchor_color if @duration.to_i==1}/>\"\n #~ elsif delivery_day.to_i%@modulas==0\n #~ @@strXML+= \"<set value='0'/>\"\n #~ @@cat_strXML+=\"<category label='#{@@date_count.strftime(\"%d-%b-%Y\")}'/>\"\n #~ @@multi_strXML+=\"<set value='0'/>\"\n #~ end\n #~ @@date_count+=86400\n #~ end\n #~ elsif Time.parse(@enddate)==@@date_count\n #~ puts \"-------------check 1--2-------\"\n #~ @@strXML+= \"<set value='0'/ #{@anchor_color if @duration.to_i==1}>\"\n #~ @@cat_strXML+=\"<category label='#{@@date_count.strftime(\"%d-%b-%Y\")}'/>\"\n #~ @@multi_strXML+=\"<set value='0'/ #{@anchor_color if @duration.to_i==1}>\"\n #~ end\n #~ @@multi_strXML+=\"</dataset>\"\n #~ @@cat_strXML+=\"</categories>\"\n #~ @@strXML+=\"</dataset>\"\n #~ @@strXML+=@@cat_strXML\n #~ @@strXML+=@@multi_strXML\n #~ p @@strXML+=\"<styles><definition><style name='myLabelsFont' type='font' font='Arial' size='12' color='000000' bold='1'/></definition><application><apply toObject='DataLabels' styles='myLabelsFont' /></application></styles>\"\n #~ end\n #~ if @report_type=='Traffic'\n #~ @@strXML+=\"</data>\"\n #~ @@strXML+=\"<colorRange><color minValue='0' maxValue='#{(@@date_count-1).to_s}' displayValue='Low' color='F0FFE8' /><color minValue='#{(@@date_count.to_i-1).to_s}' maxValue='#{(@@date_count.to_i+1).to_s}' displayValue='High' color='009900' /></colorRange></map>\"\n #~ end\n #~ if @report_type=='Ad_Wise' and args[5]=='imp vs clicks'\n #~ puts \"-------------check 12---------\"\n #~ @@multi_strXML+=\"</dataset>\"\n #~ @@cat_strXML+=\"</categories>\"\n #~ @@strXML+=\"</dataset>\"\n #~ @@strXML+=@@cat_strXML\n #~ @@strXML+=@@multi_strXML\n #~ @@strXML+=\"<styles><definition><style name='myLabelsFont' type='font' font='Arial' size='12' color='000000' bold='1'/></definition><application><apply toObject='DataLabels' styles='myLabelsFont' /></application></styles>\"\n #~ end\n #~ if @report_type=='Traffic_Continent'\n #~ puts \"-------------check 14---------\"\n #~ @@strXML+='</data>'\n #~ @@strXML+=\"<colorRange><color minValue='0' maxValue='#{(@@date_count-1).to_s}' displayValue='Low' color='F0FFE8' /><color minValue='#{(@@date_count.to_i-1).to_s}' maxValue='#{(@@date_count.to_i+1).to_s}' displayValue='High' color='009900' /></colorRange></map>\"\n #~ end\n #~ if @report_type=='Keyword'\n #~ puts \"-------------check 1-6--------\"\n #~ @@strXML+=\"<styles><definition><style name='myValuesFont' type='font' size='16' color='000000' bold='1' font='Arial, Helvetica, sans-serif' /></definition><application><apply toObject='DataLabels' styles='myValuesFont' /></application></styles>\"\n #~ end\n @@strXML = @@strXML + \"</chart>\" \n end #main If ends here\n #reinitialize flag, str variable and counters to construct next chart\n @@flag=true \n #~ @@xml_count=0\n #~ @@date_count=0\n @@color_count=0 \n @@mod=0\n @returnstrXML=@@strXML\n @@strXML='' \n @@cat_strXML=''\n @@multi_strXML=''\n @@xml_hash=nil\n @@xml_hash={:xml_string=>@returnstrXML }\n return @@xml_hash\n rescue Exception=>e\n puts \"DEBUGGER :: ERROR :: in admin_xml_builder under generate_query method. The error is #{e.to_s}\"\n end\n end", "def create_classic_query(options)\n raise ArgumentError, \"Query name is not present\" unless options[:query_name]\n raise ArgumentError, \"Parent list id is not present\" unless options[:parent_list_id]\n raise ArgumentError, \"Criteria is required\" unless options[:criteria]\n\n options[:visibility] ||= 0\n\n request_body = ''\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n xml.instruct!\n\n xml.Envelope do\n xml.Body do\n xml.CreateQuery do\n xml.QUERY_NAME options[:query_name]\n xml.PARENT_LIST_ID options[:parent_list_id]\n xml.VISIBILITY options[:visibility]\n\n xml.PARENT_FOLDER_ID options[:parent_folder_id] if options.has_key?(:parent_folder_id)\n xml.SELECT_COLUMNS options[:select_columns] if options.has_key?(:select_columns)\n xml.ALLOW_FIELD_CHANGE options[:allow_field_change] if options.has_key?(:allow_field_change)\n\n xml.CRITERIA do\n xml.TYPE options[:criteria][:type] if options[:criteria].has_key?(:type)\n\n options[:criteria][:expressions].each do |exp|\n xml.EXPRESSION do\n xml.TYPE exp[:type] if exp.has_key?(:type)\n xml.COLUMN_NAME exp[:column_name] if exp.has_key?(:column_name)\n xml.OPERATORS exp[:operators] if exp.has_key?(:operators)\n xml.VALUES exp[:values] if exp.has_key?(:values)\n xml.TABLE_ID exp[:table_id] if exp.has_key?(:table_id)\n xml.LEFT_PARENS exp[:left_parens] if exp.has_key?(:left_parens)\n xml.RIGHT_PARENS exp[:right_parens] if exp.has_key?(:right_parens)\n xml.AND_OR exp[:and_or] if exp.has_key?(:and_or)\n if exp[:rt_expressions]\n exp[:rt_expressions].each do |rt_exp|\n xml.RT_EXPRESSION do\n xml.TYPE rt_exp[:type] if rt_exp.has_key?(:type)\n xml.COLUMN_NAME rt_exp[:column_name] if rt_exp.has_key?(:column_name)\n xml.OPERATORS rt_exp[:operators] if rt_exp.has_key?(:operators)\n xml.VALUES rt_exp[:values] if rt_exp.has_key?(:values)\n xml.LEFT_PARENS rt_exp[:left_parens] if rt_exp.has_key?(:left_parens)\n xml.RIGHT_PARENS rt_exp[:right_parens] if rt_exp.has_key?(:right_parens)\n xml.AND_OR rt_exp[:and_or] if rt_exp.has_key?(:and_or)\n end\n end\n end\n end\n end\n end\n\n if options[:behavior]\n xml.BEHAVIOR do\n xml.OPTION_OPERATOR options[:behavior] if options.has_key?(:behavior)\n xml.TYPE_OPERATOR options[:type_operator] if options.has_key?(:type_operator)\n xml.MAILING_ID options[:mailing_id] if options.has_key?(:mailing_id)\n xml.REPORT_ID options[:report_id] if options.has_key?(:report_id)\n xml.LINK_NAME options[:link_name] if options.has_key?(:link_name)\n xml.WHERE_OPERATOR options[:where_operator] if options.has_key?(:where_operator)\n xml.CRITERIA_OPERATOR options[:criteria_operator] if options.has_key?(:criteria_operator)\n xml.VALUES options[:values] if options.has_key?(:values)\n end\n end\n end\n end\n end\n\n doc = send_xml_api_request(request_body)\n result_dom(doc)['ListId']\n end", "def index\n @carreras = Carrera.all\n\n\n builder = Nokogiri::XML::Builder.new do |xml|\n\n xml.carreras {\n @carreras.each do |c|\n xml.carrera do\n xml.nombre c.nombre\n xml.codigo c.codigo\n xml.cantidadAniosAcreditada c.cantidadAniosAcreditada\n xml.capacidadAutoregulacion c.capacidadAutoregulacion\n xml.condicionOperacion c.condicionOperacion\n xml.perfilIngresoResultado c.perfilIngresoResultado\n end\n end\n }\n end\n\n\n data_table = GoogleVisualr::DataTable.new\n\n\n # Add Column Headers\ndata_table.new_column('string', 'Carrera' )\ndata_table.new_column('number', 'Años')\n\n\n# Add Rows and Values\n\n@carreras.each do |c|\n data_table.add_rows([[c.nombre + \" - \"+ c.sede.nombre + \" - \" + c.sede.universidad.nombre, c.cantidadAniosAcreditada]])\n end\n\n\n\noption = { width: 700, height: 300, title: 'Acreditacion de Carreras' }\n@chart = GoogleVisualr::Interactive::ColumnChart.new(data_table, option)\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @carreras }\n format.xml { render :xml =>\n builder.to_xml }\n end\n end", "def xml( filters_to_use, attributes_to_use, query )\n biomart_xml = \"\"\n xml = Builder::XmlMarkup.new( :target => biomart_xml, :indent => 2 )\n\n xml.instruct!\n xml.declare!( :DOCTYPE, :Query )\n xml.Query( :virtualSchemaName => \"default\", :formatter => \"TSV\", :header => \"0\", :uniqueRows => \"1\", :count => \"\", :datasetConfigVersion => \"0.6\" ) {\n xml.Dataset( :name => self.dataset, :interface => \"default\" ) {\n\n if filters_to_use\n filters_to_use.each do |f|\n xml.Filter( :name => f, :value => query )\n end\n end\n\n if attributes_to_use\n attributes_to_use.each do |a|\n xml.Attribute( :name => a )\n end\n else\n self.attributes.each do |a|\n xml.Attribute( :name => a )\n end\n end\n\n }\n }\n\n return biomart_xml\n end", "def generate_query\n unless databases.nil?\n databases.each do |db|\n create_query[db] = [\"create table #{tablename} (\"]\n end\n csv_column_datatypes.each do |header, datatype|\n append_to_query = build_query_for_datatype(header, datatype)\n append_to_query.each do |key, value|\n create_query[key].push(value)\n end\n end\n prepare_sql_statements\n prepare_import_csv\n # Pass the prepared statements to options varaible.\n # Which gets passed on to print_metadata_analysis\n options[:create_query] = create_query\n options[:import_query] = import_query\n end\n print_metadata_analysis\n end", "def drawGenderReportGraph(locationName,locationId,year)\n\n#January\n#Count the number of malaria cases for january \n\n#January\njanuary_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'january' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#February\nfebruary_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'february' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#March\nmarch_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'march' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#April\napril_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'april' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#May\nmay_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'may' and Year(date_diagnosed) = '2012' and location_id =#{locationId}\"\n#June\njune_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'june' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#july\njuly_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'july' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#August\naugust_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'august' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#September\nseptember_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'september' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#October\noctober_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'octomber' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#November\nnovember_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'november' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n#December\ndecember_sql = \"SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'december' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}\"\n\n\n@jan_hiv_cases = Hivcase.count_by_sql(january_sql)\n@feb_hiv_cases = Hivcase.count_by_sql(february_sql)\n@mar_hiv_cases = Hivcase.count_by_sql(march_sql)\n@apr_hiv_cases = Hivcase.count_by_sql(april_sql)\n@may_hiv_cases = Hivcase.count_by_sql(may_sql)\n@jun_hiv_cases = Hivcase.count_by_sql(june_sql)\n@jul_hiv_cases = Hivcase.count_by_sql(july_sql)\n@aug_hiv_cases = Hivcase.count_by_sql(august_sql)\n@sep_hiv_cases = Hivcase.count_by_sql(september_sql)\n@oct_hiv_cases = Hivcase.count_by_sql(october_sql)\n@nov_hiv_cases = Hivcase.count_by_sql(november_sql)\n@dec_hiv_cases = Hivcase.count_by_sql(december_sql)\n\n\n\n# Let's hack almost everything\ng = Gruff::Bar.new('900x500') # Define a custom size\ng.theme_pastel\ng.title = \"Location Name:\"+ locationName\n\ng.data \"Hiv Infections for \", [@jan_hiv_cases, @feb_hiv_cases, @mar_hiv_cases, @apr_hiv_cases, @may_hiv_cases,@jun_hiv_cases,@jul_hiv_cases,@aug_hiv_cases,@sep_hiv_cases,@oct_hiv_cases,@nov_hiv_cases,@dec_hiv_cases]\ng.labels = { 0 => \"Jan\", 1 => \"Feb\", 2 => \"March\", 3 => \"April\", 4 => \"May\", 5 => \"June\",6 => \"July\" ,\n7 => \"Aug\" ,8 => \"Sept\",9 => \"Oct\",10 => \"Nov\",11 => \"Dec\" }\ng.write('app/assets/images/hiv_location_report_pie.png')\nend", "def testingCircle( params ) \n result = {}\n cantidad = params[:cantidades].split('.')\n elemento = params[:elementos].split('.')\n \n select = params[:elementos]+' as elementos, count('+params[:cantidades]+') as cantidades '\n group_by = ' GROUP BY '+params[:elementos]\n ordenar_sql = ' ORDER BY '+params[:elementos]\n from = 'FROM '+make_form( elemento[0], cantidad[0], '' )\n \n type_col_cantidades = @aplicacion[:tablas][cantidad[0]]['columnas'][cantidad[1]][:data_type]\n \n #if ('varchar'.eql?(type_col_cantidades) || 'char'.eql?(type_col_cantidades))\n if ('int'.eql?(type_col_cantidades)) \n select = params[:elementos]+' as elementos, sum('+params[:cantidades]+') as cantidades '\n end\n \n if (from != 'FROM ' && @conexion)\n\n #puts 'SELECT '+select+' '+from+' '+group_by+' '+ordenar_sql\n #result = @conexion.query('SELECT '+select+' '+from+' '+group_by+' '+ordenar_sql)\n\n #puts 'SELECT '+select+' '+from+' '+group_by+' '+ordenar_sql\n result = @conexion['SELECT '+select+' '+from+' '+group_by+' '+ordenar_sql]\n end\n return result\n end", "def generate_piechartXML(*args)\n begin\n #color_hash is used to store default colors for pie-chart\n @aes = AESSecurity.new()\n @color_hash=Hash.new\n @keywordcolor_hash=Hash.new\n @pieRadius=\"pieRadius='100'\"\n @color_hash={\"0\"=>\"0C95BF\",\"1\"=>\"12C400\",\"2\"=>\"ECB800\",\"3\"=>\"EB2300\",\"4\"=>\"70808F\",\"5\"=>\"000000\",\"6\"=>\"800080\",\"7\"=>\"FFFF00\",\"8\"=>\"0377CA\"}\n if @@flag==true #checks whether the flag is true to add root xml element.\n @@strXML = \"<chart decimals='2' defaultAnimation='0' use3DLighting='0' showPlotBorder='1' plotGradientColor='' showShadow='0' showLabels='#{args[3]}' chartTopMargin='0' chartLeftMargin='0' chartRightMargin='0' chartBottomMargin='0' showValues='#{args[3]}' decimals='0' isSliced='0' enableSmartLabels='#{args[3]}' bgColor='FFFFFF' showBorder='0' plotBorderThickness='0' showPercentageValues='1' #{args[3].to_i==1 ? @pieRadius : \"\"} >\" if args[2]!='keywords'&& args[2]!='url' # this root xml element is used only for channel and handset pie-chart.\n @@flag=false #set flag as false\n end\n \n key='rh21nr8e0vav0h0v'\n iv='1pnee1ng36nuare8'\n getsymbol={\"&\"=>\"%7E\",\"%\"=>\"%25\"}\n args[0]=(args[0]=='' || args[0]==nil) ? 'Unknown' : args[0]\n #url_model=(args[2]=='handset') ? (args[0]!='Others' && args[0]!='Unknown') ? \"link='/#{args[4]}/publisher_handset_model%3Fhandset=#{args[0].to_s.gsub(/([&%])/) do|s| getsymbol[\"#{s}\"] end}'\" : \"\" : \"\"\n colour=@color_hash[\"#{@@color_count}\"] #get the color \n @@strXML+=\"<set label='#{args[0].to_s.gsub(/([&%])/) do|s| @@getsymbol[\"#{s}\"] end}' value='#{args[1].to_s}' color='#{colour.to_s}'/>\" if args[2]!='url'\n @@date_count+=args[1].to_i #increment the counter value\n @@XML_array[@@color_count]=[\"#{args[0]}\",args[1].to_i,colour,@@date_count] if args[2]!='handset_model' #store the label,value and color in the array \n @@color_count+=1\n \n rescue Exception=>e\n puts \"ERROR :: in ReportGenerator Component and generate_piechartXML method. The Error is #{e.to_s}\"\n end\n end", "def gen_xml \n @xml = Builder::XmlMarkup.new\n @parent_categories = CptCategory.find(:all, :conditions => [\"parent_id = 1002795\"])\n render :layout => false\n end", "def object_query_generator(data)\n # query header\n query = \"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n PREFIX owl: <http://www.w3.org/2002/07/owl#>\n PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n PREFIX : <http://www.semanticweb.org/simon/ontologies/2016/1/medienprojekt#>\n \n SELECT *\n {\"\n \n # combine the parameters with the query\n data.each {\n |hash| if hash.has_key?(:predicate)\n # its possible to have predicate and object parameters \n query = query << \"?name \" << hash[:predicate] << \" :\" << hash[:object] << \" .\\n\"\n else\n # or just an object parameter\n query = query << \"?name ?predicate :\" << hash[:object] << \" .\\n\"\n end\n }\n\n # query footer\n query = query << \" }\\nLIMIT 400\"\n # return the resulting query\n return query\n end", "def as_query(opts={})\n Tripod.logger.debug(\"TRIPOD: building select query for criteria...\")\n\n return_graph = opts.has_key?(:return_graph) ? opts[:return_graph] : true\n\n Tripod.logger.debug(\"TRIPOD: with return_graph: #{return_graph.inspect}\")\n\n select_query = \"SELECT DISTINCT ?uri \"\n\n if graph_lambdas.empty?\n\n if return_graph\n # if we are returning the graph, select it as a variable, and include either the <graph> or ?graph in the where clause\n if graph_uri\n select_query += \"(<#{graph_uri}> as ?graph) WHERE { GRAPH <#{graph_uri}> { \"\n else\n select_query += \"?graph WHERE { GRAPH ?graph { \"\n end\n else\n select_query += \"WHERE { \"\n # if we're not returning the graph, only restrict by the <graph> if there's one set at class level\n select_query += \"GRAPH <#{graph_uri}> { \" if graph_uri\n end\n\n select_query += self.query_where_clauses.join(\" . \")\n select_query += \" } \"\n select_query += \"} \" if return_graph || graph_uri # close the graph clause\n\n else\n # whip through the graph lambdas and add into the query\n # we have multiple graphs so the above does not apply\n select_query += \"WHERE { \"\n\n graph_lambdas.each do |lambda_item|\n select_query += \"GRAPH ?g { \"\n select_query += lambda_item.call\n select_query += \" } \"\n end\n\n select_query += self.query_where_clauses.join(\" . \")\n select_query += \" } \"\n end\n\n select_query += self.extra_clauses.join(\" \")\n\n select_query += [order_clause, limit_clause, offset_clause].join(\" \")\n\n select_query.strip\n end", "def invoices_report\n @d = ActiveRecord::Base.connection.execute(\"\nselect c.customer_id, c.name, o.order_id, o.order_date,p.description, ol.product_id, sum(ol.ordered_quantity) as quantity, p.standard_price, sum(p.standard_price*ol.ordered_quantity) as total from customers c inner join orders o on c.customer_id = o.customer_id inner join order_lines ol on ol.order_id = o.order_id inner join products p on p.product_id = ol.product_id where p.id <= 8 group by c.name\n\")\n end", "def graph_for_transaction_comparison\n\n start_date = (params[:start_date]).to_date\n end_date = (params[:end_date]).to_date\n employees = Employee.find(:all)\n\n hr = Configuration.find_by_config_value(\"HR\")\n donations_total = FinanceTransaction.donations_triggers(start_date, end_date)\n fees = FinanceTransaction.total_fees(start_date, end_date).map { |t| t.transaction_total.to_f }.sum\n income = FinanceTransaction.total_other_trans(start_date, end_date)[0]\n expense = FinanceTransaction.total_other_trans(start_date, end_date)[1]\n # other_transactions = FinanceTransaction.find(:all,\n # :conditions => [\"transaction_date >= '#{start_date}' and transaction_date <= '#{end_date}'and category_id !='#{3}' and category_id !='#{2}'and category_id !='#{1}'\"])\n\n\n x_labels = []\n data1 = []\n data2 = []\n\n largest_value =0\n\n unless hr.nil?\n salary = Employee.total_employees_salary(employees, start_date, end_date)\n end\n unless salary <= 0\n x_labels << \"#{t('salary')}\"\n data << salary-(salary*2)\n largest_value = salary if largest_value < salary\n end\n unless donations_total <= 0\n x_labels << \"#{t('donations')}\"\n data << donations_total\n largest_value = donations_total if largest_value < donations_total\n end\n\n unless fees <= 0\n x_labels << \"#{t('fees_text')}\"\n data << fees\n largest_value = fees if largest_value < fees\n end\n\n unless income <= 0\n x_labels << \"#{t('other_income')}\"\n data << income\n largest_value = income if largest_value < income\n end\n\n unless expense <= 0\n x_labels << \"#{t('other_expense')}\"\n data << expense\n largest_value = expense if largest_value < expense\n end\n\n # other_transactions.each do |trans|\n # x_labels << trans.title\n # if trans.category.is_income? and trans.master_transaction_id == 0\n # data << trans.amount\n # else\n # data << (\"-\"+trans.amount.to_s).to_i\n # end\n # largest_value = trans.amount if largest_value < trans.amount\n # end\n\n largest_value += 500\n\n bargraph = BarFilled.new()\n bargraph.width = 1;\n bargraph.colour = '#bb0000';\n bargraph.dot_size = 3;\n bargraph.text = \"#{t('amount')}\"\n bargraph.values = data\n\n x_axis = XAxis.new\n x_axis.labels = x_labels\n\n y_axis = YAxis.new\n y_axis.set_range(largest_value-(largest_value*2), largest_value, largest_value/5)\n\n title = Title.new(\"#{t('finance_transactions')}\")\n\n x_legend = XLegend.new(\"#{t('examination_name')}\")\n x_legend.set_style('{font-size: 14px; color: #778877}')\n\n y_legend = YLegend.new(\"#{t('marks')}\")\n y_legend.set_style('{font-size: 14px; color: #770077}')\n\n chart = OpenFlashChart.new\n chart.set_title(title)\n chart.set_x_legend = x_legend\n chart.set_y_legend = y_legend\n chart.y_axis = y_axis\n chart.x_axis = x_axis\n\n chart.add_element(bargraph)\n\n\n render :text => chart.render\n\n\n end", "def iso_query_builder\n group_alias = \"#{groups.first.parent_table}\"\n attrs = questions.map{|question|\"\\\"#{question.attribute_name}\\\"\"}.uniq\n return \"SELECT\n #{attrs.join(',')}, year\n FROM (#{group_query_builder groups.first}) AS #{group_alias}\"\n end", "def getRentBurdens(db, facets, partition)\n throw 'A partition must be specified' if partition.empty?\n partitionFilters = getFilters(partition)\n partitionColumns = partitionFilters.map { |filter| filter[:column] }\n\n\n whereSql = getWhereSql(db, facets)\n partitionSql = getWhereSql(db, partition)\n\n andWhere = whereSql.empty? ? '' : ' AND ' + whereSql\n\n sqlQuery = \"select #{columnNames[:rentburden]},\n sum(CASE WHEN #{partitionSql} THEN n END) as match,\n sum(CASE WHEN NOT #{partitionSql} THEN n END) as no_match\n FROM (select \n sum(perwt) as n, #{columnNames[:rentburden]}, #{partitionColumns.join(',')} \n from #{tableName}\n where #{columnNames[:rentburden]} is not null #{andWhere} \n group by #{columnNames[:rentburden]}, #{partitionColumns.join(',')}) grpip_by_partition\n group by #{columnNames[:rentburden]};\";\n\n puts sqlQuery #DELETE ME\n\n sqlResult = db.exec(sqlQuery)\n\n asArray = sqlResult.values()\n\n # totals for every column, the first is 0\n totals = Array.new(sqlResult.num_fields(), 0)\n\n # total each column \n asArray.each do |row|\n (1..row.length-1).each do |col|\n totals[col] += row[col].to_i\n end\n end\n\n #calculate percentages for each population\n asArray.map! do |row|\n (1..row.length-1).each do |col|\n colTotal = totals[col]\n if colTotal == 0\n row[col] = 0\n else\n row[col] = row[col].to_f/colTotal * 100\n end\n end\n row\n end\n\n\n {\n :results => asArray,\n :populationSize => totals[1..-1],\n :fields => sqlResult.fields, \n # :query => sqlQuery,\n :citation => 'American Community Survey 2010-2012, processed by BFAMFAPhD'\n }\n end", "def admin_query\n @ndays = params[:days] || 62\n\n days = (@ndays).to_i\n render :json => {\n :type => 'LineChart',\n :cols => [['string', 'Fecha'], ['number', 'pages']],\n :rows => (1..days).to_a.inject([]) do |memo, i|\n date = i.days.ago.to_date\n t = date.beginning_of_day\n pages = PageDataDay.where(\"day = #{t.strftime(\"%Y%m%d\").to_i}\").count\n memo << [date, pages]\n memo\n end.reverse,\n :options => {\n :chartArea => { :width => '90%', :height => '75%' , :backgroundColor => 'red' }, \n :hAxis => { :showTextEvery => 30 } \n }\n }\n end", "def generateDataset(dataDict)\n user_name = dataDict[:userName]\n fiscal_year = dataDict[:fiscalYear]; fiscal_quarter = dataDict[:fiscalQuarter]\n fiscal_month = dataDict[:fiscalMonth]; fiscal_week = dataDict[:fiscalWeek]\n bookingColl = dataDict[:bookingColl]; gdColl = dataDict[:gdColl];\n mongoEng = dataDict[:mongoEng]; dsObj = dataDict[:dsObj]\n doc = {\n :username => user_name,\n :periods => {\n :year => fiscal_year,\n :quarter => fiscal_quarter,\n :month => fiscal_month,\n :week => fiscal_week\n }\n }\n # Till date Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByHistory(),\n { :$sort => {:_id => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:tdBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n } \n else\n doc[:tdBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Architecture wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByArch2(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:archBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:archBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Vertical wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByVertical(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:verticalBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:verticalBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Technology wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByTechName(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:techBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:techBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # AT Attach wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByAtAttach(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:atAttachBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:atAttachBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Sub SCMS wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingBySubSCMS(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:subSCMSBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:subSCMSBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # GTMu wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByGTMu(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:gtmuBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:gtmuBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Region wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByRegion(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:regionBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:regionBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Customers Ranking by Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomer(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:topCustomerBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topCustomerBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Partner Ranking by Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:$and] = [\n {\n \"names.partner.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByPartner(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:topPartnerBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topPartnerBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Sales_Level_6 Ranking by Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingBySL6(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:topSL6Booking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topSL6Booking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Deals\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n },\n {\n \"references.sales_order_number_detail\" => {\n :$ne => nil \n }\n },\n {\n \"references.sales_order_number_detail\" => {\n :$ne => \"\" \n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomerSONumber(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggQryTopDeals(aggregateQuery, bookingColl)\n doc[:topDeals] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topDeals] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Billed Customers\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupByCustomers(),\n ]\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryBilled(aggregateQuery, bookingColl, 'customer')\n doc[:billedCustomers] = {\n :xAxis => returnedObj[:key],\n :yAxis => returnedObj[:value]\n }\n else\n doc[:billedCustomers] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n\n\n # Repeat/New & Dormant Customers \n if fiscal_quarter.nil? && fiscal_month.nil? && fiscal_week.nil?\n #if (false)\n prevYear1 = fiscal_year.to_i - 1\n matchObj2 = Marshal.load(Marshal.dump(matchObj))\n matchObj2[:$match][\"periods.year\"] = prevYear1.to_s\n matchObj2[:$match].delete(\"periods.quarter\")\n matchObj2[:$match].delete(\"periods.month\")\n matchObj2[:$match].delete(\"periods.week\")\n\n prevYear2 = fiscal_year.to_i - 2\n prevYear3 = fiscal_year.to_i - 3\n #puts \"Prev -1: #{prevYear1}, Prev - 2: #{prevYear2}, Prev - 3: #{prevYear3}\"\n matchObj3 = Marshal.load(Marshal.dump(matchObj2))\n matchObj3[:$match].delete(\"periods.year\")\n matchObj3[:$match][:$or] = [\n { \"periods.year\" => prevYear1.to_s },\n { \"periods.year\" => prevYear2.to_s },\n { \"periods.year\" => prevYear3.to_s },\n ]\n\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomer(),\n ]\n aggregateQuery2 = [\n matchObj2,\n dsObj.groupBookingByCustomer(),\n ]\n aggregateQuery3 = [\n matchObj3,\n dsObj.groupBookingByCustomer(),\n ]\n aggregateQueries = {\n :query1 => aggregateQuery,\n :query2 => aggregateQuery2,\n :query3 => aggregateQuery3,\n }\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryRepeatNew(aggregateQueries, bookingColl, 'customer')\n doc[:newAccounts] = {\n :xAxis => returnedObj[:obj1][:key],\n :yAxis0 => returnedObj[:obj1][:val],\n :yAxis => returnedObj[:obj1][:value],\n :yAxis2 => returnedObj[:obj1][:value2],\n :yAxis3 => returnedObj[:obj1][:value3],\n :yAxis4 => returnedObj[:obj2][:value2],\n :yAxis5 => returnedObj[:obj2][:value3],\n }\n doc[:repeatAccounts] = {\n :xAxis => returnedObj[:obj2][:key],\n :yAxis0 => returnedObj[:obj2][:val],\n :yAxis => returnedObj[:obj2][:value],\n :yAxis2 => returnedObj[:obj1][:value4],\n :yAxis3 => returnedObj[:obj1][:value5],\n :yAxis4 => returnedObj[:obj2][:value4],\n :yAxis5 => returnedObj[:obj2][:value5],\n }\n doc[:dormantAccounts] = {\n :xAxis => returnedObj[:obj3][:key],\n :yAxis0 => returnedObj[:obj3][:val],\n :yAxis => returnedObj[:obj3][:value],\n :yAxis2 => returnedObj[:obj3][:value2],\n :yAxis3 => returnedObj[:obj3][:value3],\n :yAxis4 => returnedObj[:obj3][:value4],\n :yAxis5 => returnedObj[:obj3][:value5],\n :yAxis6 => returnedObj[:obj3][:value6],\n }\n else\n doc[:newAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:repeatAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:dormantAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n :yAxis5 => [],\n :yAxis6 => [],\n } \n end # End of If condition\n else\n doc[:newAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:repeatAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:dormantAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n :yAxis5 => [],\n :yAxis6 => [],\n } \n end # End of checking whether the period criteria is for only YTD \n\n\n\n # Billed Partners\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:$and] = [\n {\n \"names.partner.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupByPartners(),\n ]\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryBilled(aggregateQuery, bookingColl, 'partner')\n doc[:billedPartners] = {\n :xAxis => returnedObj[:key],\n :yAxis => returnedObj[:value]\n }\n else\n doc[:billedPartners] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n\n # Technology Penetration\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomerTechnologies(),\n ]\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryTechPenetration(aggregateQuery, bookingColl)\n doc[:techPenetration] = {\n :xAxis => returnedObj[:key],\n :yAxis => returnedObj[:value],\n :yAxis2 => [ScalarCalculators.calculateRatio(doc[:tdBooking][:yAxis][0],returnedObj[:value][0]).to_f*THOUSAND]\n }\n else\n doc[:techPenetration] = {\n :xAxis => [],\n :yAxis => [],\n :yAxis2 => []\n } \n end # End of If condition\n\n\n # QoQ Booking\n tempQuarter = nil\n tempMonth = nil\n tempWeek = nil\n matchObj = dsObj.matchByMultipleParams(fiscal_year, tempQuarter, tempMonth, tempWeek, user_name)\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByQoQ(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:qoqBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:qoqBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # MoM Booking\n tempMonth = nil\n tempWeek = nil\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, tempMonth, tempWeek, user_name)\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByMoM(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:momBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:momBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # WoW Booking\n tempWeek = nil\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, tempWeek, user_name)\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByWoW(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:wowBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:wowBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Product Service Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByProductService()\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:prodSerBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:prodSerBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Average Discount of Archs\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingNetAndListByArchs()\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggQryDiscount(aggregateQuery, bookingColl)\n doc[:disArchsBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value],\n :yAxis2 => bookingObj[:value2],\n :yAxis3 => bookingObj[:value3],\n }\n else\n doc[:disArchsBooking] = {\n :xAxis => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n } \n end # End of If condition\n\n # Average Discount of Overall \n aggregateQuery = [\n matchObj,\n dsObj.groupExclusiveBookingNetAndList(),\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggQryDiscount(aggregateQuery, bookingColl)\n doc[:disAllBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value],\n :yAxis2 => bookingObj[:value2],\n :yAxis3 => bookingObj[:value3],\n }\n else\n doc[:disAllBooking] = {\n :xAxis => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n } \n end # End of If condition\n\n # Booking History\n tempYear = nil\n matchObj = dsObj.matchByMultipleParams(tempYear, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByHistory(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingHistoryObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n #ap bookingHistoryObj\n doc[:bookingHistory] = {\n :xAxis => bookingHistoryObj[:key],\n :yAxis => bookingHistoryObj[:value]\n }\n else\n doc[:bookingHistory] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Yield Per Customer\n if !doc[:tdBooking][:yAxis].empty?\n doc[:yieldPerCustomer] = {\n :xAxis => [doc[:billedCustomers][:xAxis]],\n :yAxis => [ScalarCalculators.calculateRatio(doc[:tdBooking][:yAxis][0],doc[:billedCustomers][:yAxis][0]).to_f*THOUSAND] \n }\n else\n doc[:yieldPerCustomer] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n if !doc[:tdBooking][:yAxis].empty?\n #puts \"Initializing mongo insertion for #{user_name} | #{fiscal_year} | #{fiscal_quarter} | #{fiscal_month} | #{fiscal_week}\"\n id = mongoEng.insertDocument(gdColl, doc) \n puts \"#{user_name} | #{fiscal_year} | #{fiscal_quarter} | #{fiscal_month} | #{fiscal_week} - insertion ID: #{id}\"\n end # End of if condition checking if there is any data\n #ap doc\n #puts \"#{doc}\"\n end", "def graph_for_transaction_comparison\n start_date = params[:start_date].to_date\n end_date = params[:end_date].to_date\n employees = Employee.find(:all)\n\n hr = Configuration.find_by_config_value('HR')\n donations_total = FinanceTransaction.donations_triggers(start_date, end_date)\n fees = FinanceTransaction.total_fees(start_date, end_date)\n income = FinanceTransaction.total_other_trans(start_date, end_date)[0]\n expense = FinanceTransaction.total_other_trans(start_date, end_date)[1]\n # other_transactions = FinanceTransaction.find(:all,\n # :conditions => [\"transaction_date >= '#{start_date}' and transaction_date <= '#{end_date}'and category_id !='#{3}' and category_id !='#{2}'and category_id !='#{1}'\"])\n\n x_labels = []\n data1 = []\n data2 = []\n\n largest_value = 0\n\n salary = Employee.total_employees_salary(employees, start_date, end_date) unless hr.nil?\n unless salary <= 0\n x_labels << t('salary').to_s\n data << salary - (salary * 2)\n largest_value = salary if largest_value < salary\n end\n unless donations_total <= 0\n x_labels << t('donations').to_s\n data << donations_total\n largest_value = donations_total if largest_value < donations_total\n end\n\n unless fees <= 0\n x_labels << t('fees_text').to_s\n data << fees\n largest_value = fees if largest_value < fees\n end\n\n unless income <= 0\n x_labels << t('other_income').to_s\n data << income\n largest_value = income if largest_value < income\n end\n\n unless expense <= 0\n x_labels << t('other_expense').to_s\n data << expense\n largest_value = expense if largest_value < expense\n end\n\n # other_transactions.each do |trans|\n # x_labels << trans.title\n # if trans.category.is_income? and trans.master_transaction_id == 0\n # data << trans.amount\n # else\n # data << (\"-\"+trans.amount.to_s).to_i\n # end\n # largest_value = trans.amount if largest_value < trans.amount\n # end\n\n largest_value += 500\n\n bargraph = BarFilled.new\n bargraph.width = 1\n bargraph.colour = '#bb0000'\n bargraph.dot_size = 3\n bargraph.text = t('amount').to_s\n bargraph.values = data\n\n x_axis = XAxis.new\n x_axis.labels = x_labels\n\n y_axis = YAxis.new\n y_axis.set_range(largest_value - (largest_value * 2), largest_value, largest_value / 5)\n\n title = Title.new(t('finance_transactions').to_s)\n\n x_legend = XLegend.new(t('examination_name').to_s)\n x_legend.set_style('{font-size: 14px; color: #778877}')\n\n y_legend = YLegend.new(t('marks').to_s)\n y_legend.set_style('{font-size: 14px; color: #770077}')\n\n chart = OpenFlashChart.new\n chart.set_title(title)\n chart.set_x_legend = x_legend\n chart.set_y_legend = y_legend\n chart.y_axis = y_axis\n chart.x_axis = x_axis\n\n chart.add_element(bargraph)\n\n render text: chart.render\n end", "def report\n filtered = apply_filter(self.relation)\n\n count = self.count(filtered) if @q.select.count?\n\n list = if @q.select.list?\n self.list(filtered)\n else\n []\n end\n\n calculations = self.calculations(filtered)\n Listing::Report.new(\n @q.options,\n list,\n calculations,\n count\n )\n end", "def create_query_html_response(base_query, partial: 'row', locals: {})\n resp_data = ts_ajax_handler.query_data(base_query)\n records = resp_data.delete(:records)\n resp_data[:data] = render_response_html(records, partial: partial, locals: locals)\n\n resp_data\n end", "def render_chart\n assert_privileges(\"view_graph\")\n\n if params[:report]\n rpt = MiqReport.for_user(current_user).find_by(:name => params[:report])\n rpt.generate_table(:userid => session[:userid])\n else\n rpt = if session[:report_result_id]\n MiqReportResult.for_user(current_user).find(session[:report_result_id]).report_results\n elsif session[:rpt_task_id].present?\n MiqTask.find(session[:rpt_task_id]).task_results\n else\n @report\n end\n end\n\n rpt.to_chart(settings(:display, :reporttheme), true, MiqReport.graph_options)\n rpt.chart\n end", "def generateProdSerDataset(dataDict)\n user_name = dataDict[:userName]\n fiscal_year = dataDict[:fiscalYear]; fiscal_quarter = dataDict[:fiscalQuarter]\n fiscal_month = dataDict[:fiscalMonth]; fiscal_week = dataDict[:fiscalWeek]; prod_ser = dataDict[:prodSer]\n bookingColl = dataDict[:bookingColl]; gdColl = dataDict[:gdColl];\n mongoEng = dataDict[:mongoEng]; dsObj = dataDict[:dsObj]\n doc = {\n :username => user_name,\n :periods => {\n :year => fiscal_year,\n :quarter => fiscal_quarter,\n :month => fiscal_month,\n :week => fiscal_week,\n :prod_ser => prod_ser,\n }\n }\n # Till date Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByHistory(),\n { :$sort => {:_id => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:tdBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n } \n else\n doc[:tdBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Architecture wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByArch2(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:archBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:archBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Vertical wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByVertical(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:verticalBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:verticalBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Technology wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByTechName(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:techBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:techBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # AT Attach wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByAtAttach(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:atAttachBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:atAttachBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Sub SCMS wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingBySubSCMS(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:subSCMSBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:subSCMSBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # GTMu wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByGTMu(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:gtmuBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:gtmuBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Region wise Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByRegion(),\n { :$sort => {:booking => -1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:regionBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:regionBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Customers Ranking by Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomer(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:topCustomerBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topCustomerBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Partner Ranking by Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n matchObj[:$match][:$and] = [\n {\n \"names.partner.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByPartner(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:topPartnerBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topPartnerBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Sales_Level_6 Ranking by Booking\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingBySL6(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:topSL6Booking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topSL6Booking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Top 10 Deals\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n },\n {\n \"references.sales_order_number_detail\" => {\n :$ne => nil \n }\n },\n {\n \"references.sales_order_number_detail\" => {\n :$ne => \"\" \n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomerSONumber(),\n { :$sort => {:booking => -1}},\n { :$limit => 10 }\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggQryTopDeals(aggregateQuery, bookingColl)\n doc[:topDeals] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:topDeals] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Billed Customers\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupByCustomers(),\n ]\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryBilled(aggregateQuery, bookingColl, 'customer')\n doc[:billedCustomers] = {\n :xAxis => returnedObj[:key],\n :yAxis => returnedObj[:value]\n }\n else\n doc[:billedCustomers] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n\n\n\n # Repeat/New & Dormant Customers \n if fiscal_quarter.nil? && fiscal_month.nil? && fiscal_week.nil?\n #if (false)\n prevYear1 = fiscal_year.to_i - 1\n matchObj2 = Marshal.load(Marshal.dump(matchObj))\n matchObj2[:$match][\"periods.year\"] = prevYear1.to_s\n matchObj2[:$match].delete(\"periods.quarter\")\n matchObj2[:$match].delete(\"periods.month\")\n matchObj2[:$match].delete(\"periods.week\")\n\n prevYear2 = fiscal_year.to_i - 2\n prevYear3 = fiscal_year.to_i - 3\n puts \"Prev -1: #{prevYear1}, Prev - 2: #{prevYear2}, Prev - 3: #{prevYear3}\"\n matchObj3 = Marshal.load(Marshal.dump(matchObj2))\n matchObj3[:$match].delete(\"periods.year\")\n matchObj3[:$match][:$or] = [\n { \"periods.year\" => prevYear1.to_s },\n { \"periods.year\" => prevYear2.to_s },\n { \"periods.year\" => prevYear3.to_s },\n ]\n\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomer(),\n ]\n aggregateQuery2 = [\n matchObj2,\n dsObj.groupBookingByCustomer(),\n ]\n aggregateQuery3 = [\n matchObj3,\n dsObj.groupBookingByCustomer(),\n ]\n aggregateQueries = {\n :query1 => aggregateQuery,\n :query2 => aggregateQuery2,\n :query3 => aggregateQuery3,\n }\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryRepeatNew(aggregateQueries, bookingColl, 'customer')\n doc[:newAccounts] = {\n :xAxis => returnedObj[:obj1][:key],\n :yAxis0 => returnedObj[:obj1][:val],\n :yAxis => returnedObj[:obj1][:value],\n :yAxis2 => returnedObj[:obj1][:value2],\n :yAxis3 => returnedObj[:obj1][:value3],\n :yAxis4 => returnedObj[:obj2][:value2],\n :yAxis5 => returnedObj[:obj2][:value3],\n }\n doc[:repeatAccounts] = {\n :xAxis => returnedObj[:obj2][:key],\n :yAxis0 => returnedObj[:obj2][:val],\n :yAxis => returnedObj[:obj2][:value],\n :yAxis2 => returnedObj[:obj1][:value4],\n :yAxis3 => returnedObj[:obj1][:value5],\n :yAxis4 => returnedObj[:obj2][:value4],\n :yAxis5 => returnedObj[:obj2][:value5],\n }\n doc[:dormantAccounts] = {\n :xAxis => returnedObj[:obj3][:key],\n :yAxis0 => returnedObj[:obj3][:val],\n :yAxis => returnedObj[:obj3][:value],\n :yAxis2 => returnedObj[:obj3][:value2],\n :yAxis3 => returnedObj[:obj3][:value3],\n :yAxis4 => returnedObj[:obj3][:value4],\n :yAxis5 => returnedObj[:obj3][:value5],\n :yAxis6 => returnedObj[:obj3][:value6],\n }\n else\n doc[:newAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:repeatAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:dormantAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n :yAxis5 => [],\n :yAxis6 => [],\n } \n end # End of If condition\n else\n doc[:newAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:repeatAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n } \n doc[:dormantAccounts] = {\n :xAxis => [],\n :yAxis0 => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n :yAxis4 => [],\n :yAxis5 => [],\n :yAxis6 => [],\n } \n end # End of checking whether the period criteria is for only YTD \n\n\n # Billed Partners\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n matchObj[:$match][:$and] = [\n {\n \"names.partner.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.partner.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupByPartners(),\n ]\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryBilled(aggregateQuery, bookingColl, 'partner')\n doc[:billedPartners] = {\n :xAxis => returnedObj[:key],\n :yAxis => returnedObj[:value]\n }\n else\n doc[:billedPartners] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n\n # Technology Penetration\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n matchObj[:$match][:$and] = [\n {\n \"names.customer.unique_name\" => {\n :$not => /^unknown/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^small busi/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^cobo una/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^run rate/i\n }\n },\n {\n \"names.customer.unique_name\" => {\n :$not => /^runrate/i\n }\n }\n ] \n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByCustomerTechnologies(),\n ]\n if !matchObj.nil?\n returnedObj = keyValuePairByAggQryTechPenetration(aggregateQuery, bookingColl)\n doc[:techPenetration] = {\n :xAxis => returnedObj[:key],\n :yAxis => returnedObj[:value],\n :yAxis2 => [ScalarCalculators.calculateRatio(doc[:tdBooking][:yAxis][0],returnedObj[:value][0]).to_f*THOUSAND]\n }\n else\n doc[:techPenetration] = {\n :xAxis => [],\n :yAxis => [],\n :yAxis2 => []\n } \n end # End of If condition\n\n\n # QoQ Booking\n tempQuarter = nil\n tempMonth = nil\n tempWeek = nil\n matchObj = dsObj.matchByMultipleParams(fiscal_year, tempQuarter, tempMonth, tempWeek, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByQoQ(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:qoqBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:qoqBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # MoM Booking\n tempMonth = nil\n tempWeek = nil\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, tempMonth, tempWeek, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByMoM(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:momBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:momBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # WoW Booking\n tempWeek = nil\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, tempWeek, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByWoW(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:wowBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:wowBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Product Service Booking\n matchObj = dsObj.matchByMultipleParams(fiscal_year, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByProductService()\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n doc[:prodSerBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value]\n }\n else\n doc[:prodSerBooking] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Average Discount of Archs\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingNetAndListByArchs()\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggQryDiscount(aggregateQuery, bookingColl)\n doc[:disArchsBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value],\n :yAxis2 => bookingObj[:value2],\n :yAxis3 => bookingObj[:value3],\n }\n else\n doc[:disArchsBooking] = {\n :xAxis => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n } \n end # End of If condition\n\n # Average Discount of Overall \n aggregateQuery = [\n matchObj,\n dsObj.groupExclusiveBookingNetAndList(),\n ]\n if !matchObj.nil?\n bookingObj = keyValuePairByAggQryDiscount(aggregateQuery, bookingColl)\n doc[:disAllBooking] = {\n :xAxis => bookingObj[:key],\n :yAxis => bookingObj[:value],\n :yAxis2 => bookingObj[:value2],\n :yAxis3 => bookingObj[:value3],\n }\n else\n doc[:disAllBooking] = {\n :xAxis => [],\n :yAxis => [],\n :yAxis2 => [],\n :yAxis3 => [],\n } \n end # End of If condition\n\n # Booking History\n tempYear = nil\n matchObj = dsObj.matchByMultipleParams(tempYear, fiscal_quarter, fiscal_month, fiscal_week, user_name)\n matchObj[:$match][:prod_ser] = prod_ser\n #ap matchObj\n aggregateQuery = [\n matchObj,\n dsObj.groupBookingByHistory(),\n { :$sort => {:_id => 1}}\n ]\n if !matchObj.nil?\n bookingHistoryObj = keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n #ap bookingHistoryObj\n doc[:bookingHistory] = {\n :xAxis => bookingHistoryObj[:key],\n :yAxis => bookingHistoryObj[:value]\n }\n else\n doc[:bookingHistory] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n # Yield Per Customer\n if !doc[:tdBooking][:yAxis].empty?\n doc[:yieldPerCustomer] = {\n :xAxis => [doc[:billedCustomers][:xAxis]],\n :yAxis => [ScalarCalculators.calculateRatio(doc[:tdBooking][:yAxis][0],doc[:billedCustomers][:yAxis][0]).to_f*THOUSAND] \n }\n else\n doc[:yieldPerCustomer] = {\n :xAxis => [],\n :yAxis => []\n } \n end # End of If condition\n\n if !doc[:tdBooking][:yAxis].empty?\n puts \"Initializing mongo insertion for #{user_name} | #{fiscal_year} | #{fiscal_quarter} | #{fiscal_month} | #{fiscal_week}\"\n id = mongoEng.insertDocument(gdColl, doc) \n puts \"#{user_name} | #{fiscal_year} | #{fiscal_quarter} | #{fiscal_month} | #{fiscal_week} - insertion ID: #{id}\"\n end # End of if condition checking if there is any data\n #ap doc\n #puts \"#{doc}\"\n end", "def query\n {:xml => xml}\n end", "def group_query_builder group\n query_arr = []\n g_question_names = questions_for_group(group).map{|question|sanitize(question.attribute_name)}.uniq\n\n entities_for_group(group).each do |entity|\n cols = []\n e_question_names = questions_for_entity(entity).map{|question|sanitize(question.attribute_name)}\n\n #\n g_question_names.each do |q_name|\n if e_question_names.include? q_name\n cols.push \"CAST(\\\"#{q_name}\\\" AS FLOAT) AS \\\"#{q_name}\\\"\"\n else\n cols.push \"CAST(888 AS FLOAT) AS #{q_name}\"\n end\n end\n\n #\n cols.push \"#{entity.reference_year} AS year\" unless entity.reference_year.nil?\n cols.push sanitize(entity.entity_type_fk)\n\n # convert to sql\n query_arr.push \"SELECT \\n\\t#{cols.join(\",\\n\\t\")} \\nFROM #{entity.entity_type}\"\n end\n\n return query_arr.join(\"\\nUNION ALL\\n\")\n end", "def graphs\n @final_load = []\n one_to_5_questions = Question.numerical_ids(current_user)\n one_to_5_questions.each_with_index do |question, n|\n series_data = Answer.sum_numerical_histogram(current_user,question)\n title = Question.find_by(id: question).content\n categories = ['1 Rating','2 Rating','3 Rating','4 Rating','5 Rating']\n @final_load << [series_data, title, categories]\n end\n yes_no_questions = Question.yes_no_ids(current_user)\n yes_no_questions.each_with_index do |question, n|\n series_data = Answer.sum_yes_no_histogram(current_user,question)\n title = Question.find_by(id: question).content\n categories = ['Yes','No']\n @final_load << [series_data, title, categories]\n end\n @final_load\n end", "def result_to_xml(result, options = {}, &block)\n inner_recursion = options.delete(:inner_recursion) \n result_set = inner_recursion ? result : result.dup\n \n parent_id = (options.delete(:parent_id) || result_set.first[result_set.first.parent_col_name]) rescue nil\n options[:nested] = true unless options.key?(:nested)\n \n options[:except] ||= []\n [:left_column, :right_column, :parent_column].each do |opt|\n column = acts_as_nested_set_options[opt].intern\n options[:except] << column unless options[:except].include?(column)\n end\n \n options[:indent] ||= 2\n options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])\n options[:builder].instruct! unless options.delete(:skip_instruct)\n \n record = options.delete(:record)\n root = options.delete(:root) || :nodes\n children = options.delete(:children) || :children\n \n attrs = {}\n attrs[:xmlns] = options[:namespace] if options[:namespace] \n \n siblings = options[:nested] ? result_set.select { |s| s.parent_id == parent_id } : result_set \n options[:builder].tag!(root, attrs) do\n siblings.each do |sibling|\n result_set.delete(sibling) if options[:nested] \n procs = options[:procs] ? options[:procs].dup : []\n procs << Proc.new { |opts| block.call(opts, sibling) } if block_given?\n if options[:nested] \n proc = Proc.new do |opts| \n proc_opts = opts.merge(:parent_id => sibling.id, :root => children, :record => record, :inner_recursion => true) \n proc_opts[:procs] ||= options[:procs] if options[:procs]\n proc_opts[:methods] ||= options[:methods] if options[:methods]\n sibling.class.result_to_xml(result_set, proc_opts, &block)\n end\n procs << proc\n end \n opts = options.merge(:procs => procs, :skip_instruct => true, :root => record) \n sibling.to_xml(opts)\n end\n end\n options[:builder].target!\n end", "def generate \n @project=Project.find(params[:project_id])\n retrieve_query \n logger.info \"Anzahl aus Query: #{@query.issue_count} Projekt: #{@project}\"\n sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)\n sort_update(@query.sortable_columns)\n if @query.valid?\n @limit = per_page_option\n @query.sort_criteria = sort_criteria.to_a\n @issue_count = @query.issue_count\n @issue_pages = Paginator.new @issue_count, @limit, params['page']\n @offset ||= @issue_pages.offset\n @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],\n :order => sort_clause,\n :offset => @offset,\n :limit => @limit)\n @issue_count_by_group = @query.issue_count_by_group \n end\n\n respond_to do |format|\n format.html { render :template => 'issues_report/report_list' } \n end\n end", "def to_sql\n sql = [\"select\"]\n select_values << \"*\" if select_values.empty?\n\n sql << select_values.uniq.join(\", \")\n\n sql << \"from #{build_series_name}\"\n\n sql << \"where #{where_values.join(\" and \")}\" unless where_values.empty?\n\n unless group_values.empty? && time_value.nil?\n group_fields = (time_value.nil? ? [] : [\"time(\" + @values[:time] + \")\"]) + group_values\n group_fields.uniq!\n sql << \"group by #{group_fields.join(\", \")}\"\n end\n\n sql << \"fill(#{fill_value})\" unless fill_value.nil?\n\n sql << \"order by #{order_values.uniq.join(\",\")}\" unless order_values.empty?\n\n sql << \"limit #{limit_value}\" unless limit_value.nil?\n sql << \"offset #{offset_value}\" unless offset_value.nil?\n sql << \"slimit #{slimit_value}\" unless slimit_value.nil?\n sql << \"soffset #{soffset_value}\" unless soffset_value.nil?\n sql << \"TZ('#{timezone_value}')\" unless timezone_value.blank?\n sql.join \" \"\n end", "def getPieChartDetails\r\n \t\r\n \t # Query the Table to perform the average netscore calcuations based on selections in combobox\r\n \r\n \tsentimentarray=[1,2]\r\n\t\t\t\t@piechartPositive =Feedback.count(:all, :conditions => [\"created_at >= ? and created_at <= ? and branch_id IN (?) and sentiment_id IN (?)\",@fromdate.beginning_of_day,@todate.end_of_day,@branchlistquery,sentimentarray]) \t\r\n\tsentimentarray=[4,5]\r\n\t\t\t\t@piechartNegative =Feedback.count(:all, :conditions => [\"created_at >= ? and created_at <= ? and branch_id IN (?) and sentiment_id IN (?)\",@fromdate.beginning_of_day,@todate.end_of_day,@branchlistquery,sentimentarray])\t\t\t\r\n sentimentarray=[3]\r\n\t\t\t\t@piechartNeutral =Feedback.count(:all, :conditions => [\"created_at >= ? and created_at <= ? and branch_id IN (?) and sentiment_id IN (?)\",@fromdate.beginning_of_day,@todate.end_of_day,@branchlistquery,sentimentarray])\t\t\t\t\r\n \r\n \t\r\n \t\r\n end", "def to_xml(builder=nil)\n xmlb = builder || Nokogiri::XML::Builder.new\n hash = {:base_name => base_name, :msManufacturer => ms_manufacturer, :msModel => ms_model, :msIonization => ms_ionization, :msMassAnalyzer => ms_mass_analyzer, :msDetector => ms_detector, :raw_data_type => raw_data_type, :raw_data => raw_data}\n hash.each {|k,v| hash.delete(k) unless v }\n xmlb.msms_run_summary(hash) do |xmlb|\n sample_enzyme.to_xml(xmlb) if sample_enzyme\n search_summary.to_xml(xmlb) if search_summary\n spectrum_queries.each_with_index do |sq,i| \n sq.index = i+1 unless sq.index\n sq.to_xml(xmlb)\n end\n end\n builder || xmlb.doc.root.to_xml\n end", "def as_pepxml()\n\t\thit_node = XML::Node.new('search_hit')\n\t\thit_node['peptide']=self.peptide.to_s\n\n\t\t# require 'byebug';byebug\n\t\tfirst_evidence = self.peptide_evidence.first\n\n\t\thit_node['peptide_prev_aa']=first_evidence.peptide_prev_aa\n\t\thit_node['peptide_next_aa']=first_evidence.peptide_next_aa\n\t\thit_node['protein']=first_evidence.protein\n\t\thit_node['protein_descr']=first_evidence.protein_descr\n\n\t\thit_node['num_tot_proteins']=self.peptide_evidence.length.to_s\n\n\t\talt_evidence = peptide_evidence.drop(1)\n\t\talt_evidence.each { |ae| hit_node << ae.as_pepxml }\n\n\t\tresult_node = XML::Node.new('search_result')\n\t\tresult_node << hit_node\n\t\tresult_node\n\tend", "def create_stats_tbl\n tblName = \"#{@table}_stat\"\n creationQuery = \"select ''::text as key, ''::text as value from t_result where 1 =2\"\n # puts creationQuery\n DBConn.tblCreation(tblName, 'key', creationQuery)\n\n parseTree = @parseTree\n\n # fromPT = parseTree['SELECT']['fromClause']\n originalTargeList = parseTree['SELECT']['targetList']\n # fields = DBConn.getAllRelFieldList(fromPT)\n keyList = []\n valueList = []\n selectList = []\n pkJoinList = []\n \n pkArray = @pkList.split(',').map { |col| col.delete(' ') }\n pkArray.each do |pkcol|\n originalTargeList.each do |targetCol|\n targetField = targetCol['RESTARGET']['val']['COLUMNREF']['fields']\n if targetField.count > 1 && targetField[1].to_s == pkcol\n pkJoinList << \"t.#{pkcol} = #{targetField[0]}.#{targetField[1]}\"\n pkArray.delete(pkcol)\n end\n end\n end\n\n stats = {\n \"min\": {\"func\": \"min($COLUMN)\", \"type\": \"text\" },\n \"max\": {\"func\": \"max($COLUMN)\", \"type\": \"text\" },\n \"count\": {\"func\": \"count($COLUMN)\", \"type\": \"int\" },\n \"dist_count\": {\"func\": \"count(distinct $COLUMN)\", \"type\": \"int\" }\n }\n @all_cols.each do |field|\n # puts field.colname\n rel_alias = field.relalias\n stats.each do |stat, info|\n # SELECT\n # UNNEST(ARRAY['address_id_max','address_id_min']) AS key,\n # UNNEST(ARRAY[max(address_id),min(address_id)]) AS value\n # FROM address\n # only add N(umeric) and D(ate) type fields\n if %w(N D).include? field.typcategory\n keyList << \"'#{field.relname}_#{field.colname}_#{stat}'\"\n value = info[:func].gsub('$COLUMN',\"result.#{field.relname}_#{field.colname}\")\n # if info[:type] == 'text'\n value = \"#{value}::text\"\n # end\n valueList << value\n # valueList << \"#{stat}(result.#{field.relname}_#{field.colname})::text\"\n end\n end\n selectList << \"#{rel_alias}.#{field.colname} as #{field.relname}_#{field.colname} \"\n\n # construnct pk join cond\n if pkArray.include?(field.colname)\n pkJoinList << \"#{@table}.#{field.colname} = #{rel_alias}.#{field.colname}\"\n end\n end\n\n # # remove the where clause in query and replace targetList\n whereClauseReplacement = []\n selectQuery = ReverseParseTree.reverseAndreplace(parseTree, selectList.join(','), whereClauseReplacement)\n resultQuery = %(with result as (#{selectQuery} join #{@table} on #{pkJoinList.join(' AND ')}))\n newTargetList = \"UNNEST(ARRAY[#{keyList.join(',')}]) AS key, UNNEST(ARRAY[#{valueList.join(',')}]) as value\"\n\n newQuery = %(#{resultQuery} SELECT #{newTargetList} FROM result)\n query = %(INSERT INTO #{tblName} #{newQuery})\n # puts query\n DBConn.exec(query)\n end", "def query_detailed_picked_up_products\n\n query = <<-QUERY\n select b.id, \n b.date_from, b.time_from, b.date_to, b.time_to,\n booking_item_stock_model, booking_item_stock_plate, booking_item_characteristic_1, booking_item_characteristic_2, booking_item_characteristic_3, booking_item_characteristic_4,\n b.driver_name, b.driver_surname, b.driver_document_id, b.driver_date_of_birth, b.driver_driving_license_number,\n a.street, a.number, a.complement, a.city, a.state, a.country, a.zip\n from bookds_bookings b\n join bookds_bookings_lines bl on bl.booking_id = b.id\n join bookds_bookings_lines_resources blr on blr.booking_line_id = bl.id\n join locds_address a on a.id = b.driver_address_id\n where b.date_from >= ? and b.date_from <= ? and b.status NOT IN (1,5)\n order by b.id;\n QUERY\n\n end", "def graph_data\n graph = @building_groups.reduce([]) do |data, bg|\n data.concat(graph_bg_row(bg))\n end\n building_rows = @buildings.reduce([]) do |memo, building|\n building_results = building.energy_profiles.reduce({}) do |building_data, energy_profile|\n consumption = energy_profile.yearly_data\n emission = Calculators::Conversion.kgCO2_from_kWh(energy_profile.profile_type, consumption)\n building_data[:consumption] ||= 0\n building_data[:consumption] += consumption\n building_data[:emission] ||= 0\n building_data[:emission] += emission\n building_data\n end\n calculated_data = calculate(building_results[:consumption], building_results[:emission], building.floor_area, building.number_of_occupants) \n rows_for_metrics = graph_row(calculated_data, building, {:year => building.energy_profiles.last.year}) # vile hack for year TODO\n memo.concat(rows_for_metrics)\n end\n {metrics: @options[:metrics], time_unit: \"yearly\", data: graph.concat(building_rows)}\n end", "def to_xml\n inner = String.new\n inner_builder = Builder::XmlMarkup.new(:target => inner, :indent => 2)\n \n # create the XML for the inner \"categories\" element(s)\n inner_builder.tag!(\"categories\") do\n categories.each do |category|\n inner_builder << category.to_xml\n end\n end\n \n # create the XML for the inner \"dataset\" element(s)\n inner_builder.tag!(\"dataset\") do\n dataSets.each do |dataset|\n inner_builder << dataset.to_xml\n end\n end\n \n # create the XML for this chart, including attributes defined in the Base chart type\n result = super(nil, inner)\n \n result\n end", "def clientPerformanceReport(month, year, typeOfReport, clientId, clientName, basedOn, orderBy, userId)\n begin \n image_name = \"client_performance_#{clientId}_#{typeOfReport}_#{month}_#{year}_#{basedOn}\"\n month_id = MONTH_HASH[month]\n impressions = Array.new #for all clients, impressions will be calculate per month and for a particular adclient, it will be calculate per week \n labels = Array.new\n label_hash = Hash.new\n title = \"Traffic of #{clientName} for the month of #{month}, #{year}\"\n axis_title = \"#{basedOn}\"\n puts sql = \"select sum(#{basedOn}) as #{basedOn}, dayofmonth(delivery_time) as day from adsdeliveries where client_id=#{clientId} and date_format(delivery_time, '%m')=#{month_id} and date_format(delivery_time, '%Y')=#{year} group by day\"\n #begin\n # impressions_sql = @dbh.prepare(sql)\n # impressions_sql.execute\n #rescue Exception=>e\n # puts \"An Exception was thrown while executing the sql in client performance report\"\n # @dbh = DBI.connect(DATABASE, USERNAME,PASSWORD)\n # #impressions_active=Addelivery.find_by_sql(sql)\n # impressions_sql = @dbh.prepare(sql)\n # impressions_sql.execute\n #end\n begin\n @impressions_active=Adsdelivery.find_by_sql(sql)\n rescue\n Adsdelivery.establish_connection( \n :adapter => \"mysql\", \n :host => \"192.168.1.4\", \n :database => \"zestadz_development\",\n :username => \"root\",\n :password => \"sqlworx@ch\"\n )\n @impressions_active=Adsdelivery.find_by_sql(sql)\n end\n #impressions_sql = @dbh.prepare(sql)\n #impressions_sql.execute\n puts \"the impressions size is #{@impressions_active.size}\"\n @impressions_active.each do |imp|\n puts impressions << imp.impressions if basedOn=='impressions'\n puts impressions << imp.clicks if basedOn=='clicks'\n labels << imp.day\n end\n \n # while row=impressions_sql.fetch do\n # impressions << row[0].to_i\n # labels << row[1].to_s\n # end\n for i in 0...labels.size\n label_hash[i] = labels[i].to_s\n end\n \n create_directory(\"#{@@rails_root}/public/images/reports/\", userId.to_s)\n if(typeOfReport=='Line')\n build_image image_name, userId, impressions, label_hash, title, axis_title, nil, 550, true \n elsif(typeOfReport=='Area')\n build_land_chart image_name, userId, impressions, label_hash, axis_title, title, nil, 550\n elsif(typeOfReport=='Pie')\n build_pie_chart image_name, userId, impressions, label_hash, axis_title, title, nil, 550\n elsif(typeOfReport=='Bar')\n build_bar_chart image_name, userId, impressions, label_hash, axis_title, title, nil, 550\n end\n print \"\\nSuccesfully generated the client performance report\"\n rescue Exception=>e\n puts \"An Exception was thrown in Client Performance Report\"\n end\n end", "def generate_subgraph(center_id)\n conditions = \"SELECT * FROM networks WHERE ds_score_#{@datasource} \" << (@score_thresh.class == Range ? \"BETWEEN #{@score_thresh.first} AND #{@score_thresh.last}\" : \">= #{@score_thresh}\") << \" AND \"\n (1..2).each {|i| conditions << \"protein_#{i}_id = #{center_id} OR \"}\n Network.find_by_sql conditions[0, conditions.length - \" OR \".length]\n end", "def graph_for_update_monthly_report\n start_date = (params[:start_date]).to_date\n end_date = (params[:end_date]).to_date\n\n expenses = Hash[params.select {|x,y| x.match /ECATEGORY(.)*/ }]\n incomes = Hash[params.select {|x,y| x.match /ICATEGORY(.)*/ }]\n other_expenses = Hash[params.select {|x,y| x.match /EOCATEGORY(.)*/ }]\n other_incomes = Hash[params.select {|x,y| x.match /IOCATEGORY(.)*/ }]\n\n donations_total = params[:donations].present? ? params[:donations].to_f : 0\n fees = params[:fees].present? ? params[:fees].to_f : 0\n salary = params[:salary].present? ? params[:salary].to_f : 0\n refund = params[:refund].present? ? params[:refund].to_f : 0\n\n income = expense = 0\n\n x_labels = []\n data = []\n largest_value = 0\n\n if salary > 0\n x_labels << \"#{t('employee_salary')}\"\n data << -(salary)\n largest_value = salary if largest_value < salary\n end\n\n if donations_total > 0\n x_labels << \"#{t('donations')}\"\n data << donations_total\n largest_value = donations_total if largest_value < donations_total\n end\n\n if fees > 0\n x_labels << \"#{t('student_fees')}\"\n data << FedenaPrecision.set_and_modify_precision(fees).to_f\n largest_value = fees if largest_value < fees\n end\n\n incomes.each_pair do |cat, amt|\n x_labels << \"#{t(cat.gsub('ICATEGORY',''))}\"\n data << amount = amt.to_f\n largest_value = amount if largest_value < amount\n end\n\n expenses.each_pair do |cat, amt|\n x_labels << \"#{t(cat.gsub('ECATEGORY',''))}\"\n data << amount = amt.to_f\n largest_value = amount if largest_value < amount\n end\n\n other_expenses.each_pair do |cat, amt|\n expense += amt.to_f\n end\n\n other_incomes.each_pair do |cat, amt|\n income += amt.to_f\n end\n\n if income > 0\n x_labels << \"#{t('other_income')}\"\n data << income\n largest_value = income if largest_value < income\n end\n\n if refund > 0\n x_labels << \"#{t('refund')}\"\n data << -(refund)\n largest_value = refund if largest_value < refund\n end\n\n if expense > 0\n x_labels << \"#{t('other_expense')}\"\n data << -(FedenaPrecision.set_and_modify_precision(expense).to_f)\n largest_value = expense if largest_value < expense\n end\n\n largest_value += 500\n\n bargraph = BarFilled.new()\n bargraph.width = 1;\n bargraph.colour = '#bb0000';\n bargraph.dot_size = 3;\n bargraph.text = \"#{t('amount')}\"\n bargraph.values = data\n\n x_axis = XAxis.new\n x_axis.labels = x_labels\n\n y_axis = YAxis.new\n y_axis.set_range(FedenaPrecision.set_and_modify_precision(-(largest_value)),\n FedenaPrecision.set_and_modify_precision(largest_value),\n FedenaPrecision.set_and_modify_precision(largest_value/5))\n\n title = Title.new(\"#{t('finance_transactions')}\")\n\n x_legend = XLegend.new(\"Examination name\")\n x_legend.set_style('{font-size: 14px; color: #778877}')\n\n y_legend = YLegend.new(\"Marks\")\n y_legend.set_style('{font-size: 14px; color: #770077}')\n\n chart = OpenFlashChart.new\n chart.set_title(title)\n chart.set_x_legend = x_legend\n chart.set_y_legend = y_legend\n chart.y_axis = y_axis\n chart.x_axis = x_axis\n chart.add_element(bargraph)\n render :text => chart.render\n end", "def render_for_webquery( statement, group_by_columns )\n\n report_state_hash = YAML.load(self.view_state)\n conn = User.connection\n recordset = conn.select_all(Globals.cleanup_where(statement))\n\n if group_by_columns.nil? || group_by_columns.empty?\n if report_state_hash[:columns_list].nil? || report_state_hash[:columns_list].empty?\n if recordset.empty?\n keys = ['No records found']\n else\n keys = recordset[0].keys\n end\n else\n # Use the provided list of columns.\n keys = report_state_hash[:columns_list].map {|k| k.gsub('\"', '').strip }\n end\n else\n keys = group_by_columns\n # Include the sum or count columns.\n unless recordset.empty?\n extra_cols = recordset[0].keys - keys\n keys += extra_cols\n end\n end\n\n s = \"<table><tr><th>#{keys.join('</th><th>')}</th></tr>\"\n recordset.each do |record|\n s << '<tr>'\n keys.each do |k|\n s << \"<td>#{format_for_spreadsheet(record[k])}</td>\"\n end\n s << '</tr>'\n end\n s << '</table>'\n end", "def build_query(builder)\n builder.OPTION {\n @option.each do |k, v|\n builder.PARAMETER k.to_s.upcase\n value = case v\n when Array then v.join(',')\n when Hash then v.map { |a| a.join(':') }.join(',')\n else\n v.to_s\n end\n\n # I don't know this is correct or not, but I think we should not\n # touch third party ID.\n value.upcase! unless k == :prefer_xid\n\n builder.VALUE value\n end\n }\n end", "def to_json_query \n # Body of main function\n\n json_query = ''\n field_ops = Array.new\n outfields = Array.new\n \n json_query += self.to_json_query_filter\n\n self.fields.each do |field|\n if field.respond_to?(:operator)\n field_ops << case field.operator\n when :count then\n if field.target.is_a?(DataMapper::Property)\n \"[?#{field.target.field}!=undefined].length\"\n else # field.target is all.\n \".length\"\n end\n when :min\n if field.target.kind_of?(DataMapper::Property::DateTime) || \n field.target.kind_of?(DataMapper::Property::Time) || \n field.target.kind_of?(DataMapper::Property::Date)\n \"[=#{field.target.field}]\"\n else\n \".min(?#{field.target.field})\"\n end\n when :max\n if field.target.kind_of?(DataMapper::Property::DateTime) || \n field.target.kind_of?(DataMapper::Property::Time) || \n field.target.kind_of?(DataMapper::Property::Date)\n \"[=#{field.target.field}]\"\n else\n \".max(?#{field.target.field})\"\n end\n when :sum\n \".sum(?#{field.target.field})\"\n when :avg\n \"[=#{field.target.field}]\"\n end\n else\n outfields << \"'#{field.field}':#{field.field}\"\n end\n end\n\n json_query += field_ops.join(\"\")\n\n json_query += self.to_json_query_ordering\n\n json_query += \"[={\" + outfields.join(',') + \"}]\" unless outfields.empty?\n\n\n # puts json_query, headers\n return json_query, self.json_query_headers\n end", "def graph_report\n @header = session[:tool1]\n @product = Product.find_by_id(params[:product_id])\n @array = []\n params[:value].each_with_index do |(key,val),index|\n if session[:tool1]['regions'] == key\n name = \"#{key}(Bench Mark)\"\n a = {name: name, y: val[:percentage].to_f.round(2), drilldown: key}\n @array[0] = a\n else\n session[:tool1]['bench_region'].each_with_index do |value, index| \n index = index + 1\n if value == key\n a = {name: key, y: val[:percentage].to_f.round(2), drilldown: key}\n @array[index] = a\n end\n end\n end\n \n end\n\n end", "def resultset; end", "def charges(date_from, date_to)\n\n sql = <<-SQL\n select * \n from (\n select pc.id, pc.amount, pc.date, pc.payment_method_id, \n 'booking' as source, \n bc.booking_id as source_id,\n 'booking' as source_link,\n b.customer_name as customer_name, b.customer_surname as customer_surname,\n b.driver_document_id as customer_document_id,\n case when pc.payment_type = 1 then 'charge' else 'payment' end as payment_type\n from payment_charges pc\n join bookds_booking_charges bc on bc.charge_id = pc.id\n join bookds_bookings b on bc.booking_id = b.id\n where pc.status = 4\n union\n select pc.id, pc.amount, pc.date, pc.payment_method_id, \n 'order' as source, \n oc.order_id as source_id,\n 'order' as source_link,\n o.customer_name as customer_name, o.customer_surname as customer_surname,\n o.customer_document_id as customer_document_id,\n case when pc.payment_type = 1 then 'charge' else 'payment' end as payment_type\n from payment_charges pc\n join orderds_order_charges oc on oc.charge_id = pc.id\n join orderds_orders o on oc.order_id = o.id\n where pc.status = 4\n union\n select pc.id, pc.amount, pc.date, pc.payment_method_id, \n case when pc.payment_type = 1 then 'customer_invoice' else 'customer_payment' end as source, \n cic.customer_invoice_id as source_id,\n case when pc.payment_type = 1 then 'customer_invoice' else 'customer_payment' end as source_link,\n ci.customer_full_name as customer_name, '' as customer_surname,\n ci.customer_document_id as customer_document_id,\n case when pc.payment_type = 1 then 'charge' else 'payment' end as payment_type\n from payment_charges pc\n join invoiceds_customer_invoice_charges cic on cic.charge_id = pc.id\n join invoiceds_customer_invoices ci on cic.customer_invoice_id = ci.id\n where pc.status = 4 \n ) as data_charges\n where data_charges.date >= ? and data_charges.date <= ?\n order by data_charges.date\n SQL\n\n charges = repository.adapter.select(sql, date_from, date_to)\n\n charges.each do |charge|\n charge.payment_method_id = case charge.payment_method_id\n when 'redsys256'\n BookingDataSystem.r18n.payment_method.payment_redsys256\n when 'paypal_standard'\n BookingDataSystem.r18n.payment_method.payment_paypal_standard\n when 'bank_transfer'\n BookingDataSystem.r18n.payment_method.payment_bank_transfer\n when 'credit_card'\n BookingDataSystem.r18n.payment_method.payment_credit_card\n when 'cash'\n BookingDataSystem.r18n.payment_method.payment_cash\n else\n charge.payment_method_id\n end\n if charge.source_link == 'booking'\n charge.source_link = \"<a href=\\\"/admin/booking/bookings/#{charge.source_id}\\\">#{BookingDataSystem.r18n.booking_model.charge_description(charge.source_id)}</a>\"\n charge.source = BookingDataSystem.r18n.booking_model.charge_description(charge.source_id)\n elsif charge.source_link == 'order'\n charge.source_link = \"<a href=\\\"/admin/order/orders/#{charge.source_id}\\\">Pedido #{BookingDataSystem.r18n.order_model.charge_description(charge.source_id)}</a>\"\n charge.source = BookingDataSystem.r18n.order_model.charge_description(charge.source_id)\n elsif charge.source_link == 'customer_invoice'\n charge.source_link = \"<a href=\\\"/admin/invoices/customer-invoices/#{charge.source_id}\\\">#{YsdPluginInvoices.r18n.t.customer_invoice_model.charge_description(charge.source_id)}</a>\"\n charge.source = YsdPluginInvoices.r18n.t.customer_invoice_model.charge_description(charge.source_id) \n elsif charge.source_link == 'customer_payment' \n charge.source_link = \"<a href=\\\"/admin/invoices/customer-invoices/#{charge.source_id}\\\">#{YsdPluginInvoices.r18n.t.customer_invoice_model.payment_description(charge.source_id)}</a>\"\n charge.source = YsdPluginInvoices.r18n.t.customer_invoice_model.payment_description(charge.source_id) \n end\n end\n\n return charges\n\n end", "def generate_xml\n\t\n\t\tbuilder = Nokogiri::XML::Builder.new do |xml|\n \t\t\txml.randomGeneratedData {\n \t\t\txml.parameters(nbStations: @inputs.nb_stations, nbDemands: @inputs.nb_demands)\n xml.stations {\n @list_stations.each do |s|\n\t\t\t\t\t\t\txml.station(\n\t\t\t\t\t\t\t\tid: s.id, \n\t\t\t\t\t\t\t\txPos: s.xPos, \n\t\t\t\t\t\t\t\tyPos: s.yPos,\n\t\t\t\t\t\t\t\tmaxSize: s.maxSize\n\t\t\t\t\t\t\t)\n end\n }\n \t\t\t\txml.demands {\n @list_demands.each do |d|\n \t\t\t\t\t\txml.demand(\n\t\t\t\t\t\t\t id: d.id,\n\t\t\t\t\t\t\t\tidsOrigin: d.sOrigin.id, \n\t\t\t\t\t\t\t\tidsDestination: d.sDestination.id, \n\t\t\t\t\t\t\t\tnbDemand: d.nbDemand,\n\t\t\t\t\t\t\t\tdepartureTime: d.departureTime_TS,\n\t\t\t\t\t\t\t\tarrivalTime: d.arrivalTime_TS\n \t\t\t\t\t\t)\n end\n \t\t\t\t}\n \t\t\t}\n\t\tend\n\t\t\n\t\treturn builder.to_xml\n\tend", "def write_pie_chart\n @writer.tag_elements('c:pieChart') do\n # Write the c:varyColors element.\n write_vary_colors\n # Write the series elements.\n @series.each {|s| write_series(s)}\n # Write the c:firstSliceAng element.\n write_first_slice_ang\n end\n end", "def multi_query_builder\n\n query = \"\n SELECT\n #{select_arr.join(\",\\n\\t\")}\n FROM \\t#{groups.first.parent_table}\n #{pk_join_arr.join(\"\\n\")}\n #{fk_join_arr.join(\"\\n\")};\"\n\n return query\n end", "def generate_graph\n end", "def generate_xml(row)\n xml = Builder::XmlMarkup.new\n xml.PAP_INTVSCH_RECORD do |d|\n d.appLseNumber(row[\"appNumber\"])\n d.enabled(\"Y\")\n (0..@config[\"lease_terms\"].to_i).each do |i|\n\n duedate = row[\"dueDate_#{i}\"].nil? ? '' : row[\"dueDate_#{i}\"]\n amount = row[\"amount_#{i}\"].nil? ? '' : row[\"amount_#{i}\"]\n\n d.__send__(\"dueDate_#{i}\") do\n d << duedate\n end\n d.__send__(\"amount_#{i}\") do\n d << amount\n end\n end\n end\n end", "def show\n @query = Query.find(params[:id])\n client = GridClientClass.new\n @modifier = @query.modifier\n @attributes = Array.new\n \n @cql1Result = client.getCQL1QueryXML(getGlobusCred, @query)\n puts @cql1Result\n \n @cql2Result = client.getCQL2QueryXML(getGlobusCred, @query)\n puts @cql2Result\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @query }\n end\n end", "def chart_data\n # date_from = (params[:q].nil? or params[:q][:issue_date_gteq].empty?) ? 30.days.ago.to_date : Date.parse(params[:q][:issue_date_gteq])\n # date_to = (params[:q].nil? or params[:q][:issue_date_lteq].empty?) ? Date.current : Date.parse(params[:q][:issue_date_lteq])\n\n # scope = @search.result\n # scope = scope.tagged_with(params[:tags].split(/\\s*,\\s*/)) if params[:tags].present?\n # scope = scope.select('issue_date, sum(gross_amount) as total').where(active: true).group('issue_date')\n\n # build all keys with 0 values for all\n @date_totals = {}\n\n # (date_from..date_to).each do |day|\n # @date_totals[day.to_formatted_s(:db)] = 0\n # end\n\n # scope.each do |inv|\n # @date_totals[inv.issue_date.to_formatted_s(:db)] = inv.total\n # end\n\n render\n end", "def index\n \n @question = Question.find(params[:question_id])\n @performance = @question.performances\n @performances = @question.performances.order(:created_at).paginate(:page => params[:page], :per_page =>20)\n \n \n\n @detail=Detail.find_by(question_id: @question.id)\n @average=@detail.average\n @highest=@detail.maximum\n @lowest=@detail.minimum\n @count=@detail.total_query\n @unavailable=@detail.total_fail\n @availability=@detail.status\n @fail=100-@availability\n\n \n #######For piechart ######\n @success1=@question.performances.where('created_at >=?',DateTime.now.beginning_of_day.localtime).where('created_at <=?',DateTime.now.end_of_day.localtime).count\n @success2=@question.performances.where('created_at >=?',DateTime.now.beginning_of_day.localtime-1.day).where('created_at <?',DateTime.now.beginning_of_day).count\n @success3=@question.performances.where('created_at >=?',DateTime.now.beginning_of_day.localtime-2.day).where('created_at <?',DateTime.now.beginning_of_day.localtime-1.day).count\n @success4=@question.performances.where('created_at >=?',DateTime.now.beginning_of_day.localtime-3.day).where('created_at <?',DateTime.now.beginning_of_day.localtime-2.day).count\n @success5=@question.performances.where('created_at >=?',DateTime.now.beginning_of_day.localtime-4.day).where('created_at <?',DateTime.now.beginning_of_day.localtime-3.day).count\n @success6=@question.performances.where('created_at >=?',DateTime.now.beginning_of_day.localtime-5.day).where('created_at <?',DateTime.now.beginning_of_day.localtime-4.day).count\n @success7=@question.performances.where('created_at >=?',DateTime.now.beginning_of_day.localtime-6.day).where('created_at <?',DateTime.now.beginning_of_day.localtime-5.day).count\n @weeksuccess=@question.performances.where('created_at >=?',Date.today.in_time_zone('Kuala Lumpur')-6.day).count\n @weekfail=@question.performances.where(responsetime: -1 ).where('created_at >=?',Date.today.in_time_zone('Kuala Lumpur')-6.day).count\n if @weeksuccess==0\n @weekAvailability=0\n else\n @weekAvailability=((@weeksuccess.round(2)-@weekfail.round(2))/@weeksuccess.round(2))*100\n end\n \n @success8=@question.performances.where('created_at >=?',1.week.ago).count\n @success9=@question.performances.where('created_at >=?',2.week.ago).where('created_at <=?',1.week.ago).count\n @success10=@question.performances.where('created_at >=?',3.week.ago).where('created_at <=?',2.week.ago).count\n @success11=@question.performances.where('created_at >=?',4.week.ago).where('created_at <=?',3.week.ago).count\n\n\n @fail1=@question.performances.where(responsetime: -1 ).where('created_at >=?',DateTime.now.beginning_of_day).count\n @fail2=@question.performances.where(responsetime: -1 ).where('created_at >=?',1.day.ago).where('created_at <=?',DateTime.now.beginning_of_day).count\n @fail3=@question.performances.where(responsetime: -1 ).where('created_at >=?',2.day.ago).where('created_at <=?',1.day.ago).count\n @fail4=@question.performances.where(responsetime: -1 ).where('created_at >=?',3.day.ago).where('created_at <=?',2.day.ago).count\n @fail5=@question.performances.where(responsetime: -1 ).where('created_at >=?',4.day.ago).where('created_at <=?',3.day.ago).count\n @fail6=@question.performances.where(responsetime: -1 ).where('created_at >=?',5.day.ago).where('created_at <=?',4.day.ago).count\n @fail7=@question.performances.where(responsetime: -1 ).where('created_at >=?',6.day.ago).where('created_at <=?',5.day.ago).count\n @fail8=@question.performances.where(responsetime: -1 ).where('created_at >=?',1.week.ago).count\n @fail9=@question.performances.where(responsetime: -1 ).where('created_at >=?',2.week.ago).where('created_at <=?',1.week.ago).count\n @fail10=@question.performances.where(responsetime: -1 ).where('created_at >=?',3.week.ago).where('created_at <=?',2.week.ago).count\n @fail11=@question.performances.where(responsetime: -1 ).where('created_at >=?',4.week.ago).where('created_at <=?',3.week.ago).count\n\n\n\n if @success1==0\n @status1=0\n \n else\n \n @status1=((@success1.round(2)-@fail1.round(2))/@success1.round(2))*100\n end\n\n if @success2==0\n @status2=0\n else\n @status2=((@success2.round(2)-@fail2.round(2))/@success2.round(2))*100\n end\n\n if @success3==0\n @status3=0\n else\n @status3=((@success3.round(2)-@fail3.round(2))/@success3.round(2))*100\n end\n\n if @success4==0\n @status4=0\n else\n @status4=((@success4.round(2)-@fail4.round(2))/@success4.round(2))*100\n end\n\n if @success5==0\n @status5=0\n else\n @status5=((@success5.round(2)-@fail5.round(2))/@success5.round(2))*100\n end\n\n if @success6==0\n @status6=0\n else\n @status6=((@success6.round(2)-@fail6.round(2))/@success6.round(2))*100\n end\n\n if @success7==0\n @status7=0\n else\n @status7=((@success7.round(2)-@fail7.round(2))/@success7.round(2))*100\n end\n\n if @success8==0\n @status8=0\n else\n @status8=((@success8.round(2)-@fail8.round(2))/@success8.round(2))*100\n end\n\n if @success9==0\n @status9=0\n else\n @status9=((@success9.round(2)-@fail9.round(2))/@success9.round(2))*100\n end\n\n if @success10==0\n @status10=0\n else\n @status10=((@success10.round(2)-@fail10.round(2))/@success10.round(2))*100\n end\n\n if @success11==0\n @status11=0\n else\n @status11=((@success11.round(2)-@fail11.round(2))/@success11.round(2))*100\n end\n\n #####################\n\n\n #####month###\n @monthsuccess=@question.performances.where('created_at >=?',4.week.ago).count\n \n @monthfail=@question.performances.where(responsetime: -1 ).where('created_at >=?',4.week.ago).count\n #@monthAvailability=((@monthsuccess-@monthfail)/@monthsuccess)*100\n\n ####yesterday####\n @yesterdayAV=@question.performances.where('created_at >=?',Date.yesterday.in_time_zone('Kuala Lumpur')).where('created_at <=?',Date.today.in_time_zone('Kuala Lumpur')).average(:responsetime)\n if @yesterdayAV==nil\n @yesterdayAV=0\n end\n\n @yesterdayTotal=@question.performances.where('created_at >=?',Date.yesterday.in_time_zone('Kuala Lumpur')).where('created_at <=?',Date.today.in_time_zone('Kuala Lumpur')).count(:responsetime)\n if @yesterdayTotal==nil\n @yesterdayTotal=0\n end\n\n @yesterdayFail=@question.performances.where(responsetime: -1 ).where('created_at >=?',Date.yesterday.in_time_zone('Kuala Lumpur')).where('created_at <=?',Date.today.in_time_zone('Kuala Lumpur')).count\n if @yesterdayAV==nil\n @yesterdayAV=0\n end\n\n if @yesterdayTotal==0\n @yesterdayAvai=0\n else\n @yesterdayAvai=((@yesterdayTotal-@yesterdayFail)/@yesterdayTotal)*100\n end\n\n @yesterdayHigh=@question.performances.where('created_at >=?',Date.yesterday.in_time_zone('Kuala Lumpur')).where('created_at <=?',Date.today.in_time_zone('Kuala Lumpur')).maximum(:responsetime)\n if @yesterdayHigh==nil\n @yesterdayHigh=0\n end\n\n @yesterdayLow=@question.performances.where('created_at >=?',Date.yesterday.in_time_zone('Kuala Lumpur')).where('created_at <=?',Date.today.in_time_zone('Kuala Lumpur')).where.not(responsetime: -1 ).minimum(:responsetime)\n if @yesterdayLow==nil\n @yesterdayLow=0\n end\n ####pastweek####\n \n @pastTotal1=@question.performances.where('created_at >=?',13.day.ago).where('created_at <=?',12.day.ago).count\n @pastTotal2=@question.performances.where('created_at >=?',12.day.ago).where('created_at <=?',11.day.ago).count\n @pastTotal3=@question.performances.where('created_at >=?',11.day.ago).where('created_at <=?',10.day.ago).count\n @pastTotal4=@question.performances.where('created_at >=?',10.day.ago).where('created_at <=?',9.day.ago).count\n @pastTotal5=@question.performances.where('created_at >=?',9.day.ago).where('created_at <=?',8.day.ago).count\n @pastTotal6=@question.performances.where('created_at >=?',8.day.ago).where('created_at <=?',7.day.ago).count\n @pastTotal7=@question.performances.where('created_at >=?',7.day.ago).where('created_at <=?',6.day.ago).count\n\n @pastFail1=@question.performances.where(responsetime: -1 ).where('created_at >=?',13.day.ago).where('created_at <=?',12.day.ago).count\n @pastFail2=@question.performances.where(responsetime: -1 ).where('created_at >=?',12.day.ago).where('created_at <=?',11.day.ago).count\n @pastFail3=@question.performances.where(responsetime: -1 ).where('created_at >=?',11.day.ago).where('created_at <=?',10.day.ago).count\n @pastFail4=@question.performances.where(responsetime: -1 ).where('created_at >=?',10.day.ago).where('created_at <=?',9.day.ago).count\n @pastFail5=@question.performances.where(responsetime: -1 ).where('created_at >=?',9.day.ago).where('created_at <=?',8.day.ago).count\n @pastFail6=@question.performances.where(responsetime: -1 ).where('created_at >=?',8.day.ago).where('created_at <=?',7.day.ago).count\n @pastFail7=@question.performances.where(responsetime: -1 ).where('created_at >=?',7.day.ago).where('created_at <=?',6.day.ago).count\n \n\n if @pastTotal1==0\n @pastAvai1=0\n else\n @pastAvai1=((@pastTotal1.round(2)-@pastFail1.round(2))/@pastTotal1.round(2))*100\n end\n\n if @pastTotal2==0\n @pastAvai2=0\n else\n @pastAvai2=((@pastTotal2.round(2)-@pastFail2.round(2))/@pastTotal2.round(2))*100\n end\n\n if @pastTotal3==0\n @pastAvai3=0\n else\n @pastAvai3=((@pastTotal3.round(2)-@pastFail3.round(2))/@pastTotal3.round(2))*100\n end\n\n if @pastTotal4==0\n @pastAvai4=0\n else\n @pastAvai4=((@pastTotal4.round(2)-@pastFail4.round(2))/@pastTotal4.round(2))*100\n end\n\n if @pastTotal5==0\n @pastAvai5=0\n else\n @pastAvai5=((@pastTotal5.round(2)-@pastFail5.round(2))/@pastTotal5.round(2))*100\n end\n\n if @pastTotal6==0\n @pastAvai6=0\n else\n @pastAvai6=((@pastTotal6.round(2)-@pastFail6.round(2))/@pastTotal6.round(2))*100\n end\n\n if @pastTotal7==0\n @pastAvai7=0\n else\n @pastAvai7=((@pastTotal7.round(2)-@pastFail7.round(2))/@pastTotal7.round(2))*100\n end\n \n \n ###today### \n\n @todayTotal=@question.performances.where('created_at >=?',Date.today.in_time_zone('Kuala Lumpur')).where('created_at <=?',(Date.today+1.day).in_time_zone('Kuala Lumpur')).count\n @todayAV=@question.performances.where('created_at >=?',Date.today.in_time_zone('Kuala Lumpur')).where('created_at <=?',(Date.today+1.day).in_time_zone('Kuala Lumpur')).average(:responsetime)\n @todayHigh=@question.performances.where('created_at >=?',Date.today.in_time_zone('Kuala Lumpur')).where('created_at <=?',(Date.today+1.day).in_time_zone('Kuala Lumpur')).maximum(:responsetime)\n @todayLow=@question.performances.where('created_at >=?',Date.today.in_time_zone('Kuala Lumpur')).where('created_at <=?',(Date.today+1.day).in_time_zone('Kuala Lumpur')).where.not(responsetime: -1 ).minimum(:responsetime)\n @todayFail=@question.performances.where(responsetime: -1 ).where('created_at >=?',Date.today.in_time_zone('Kuala Lumpur')).where('created_at <=?',(Date.today+1.day).in_time_zone('Kuala Lumpur')).count\n if @todayTotal==0\n @todayAvai=0\n else\n @todayAvai=((@todayTotal.round(2)-@todayFail.round(2))/@todayTotal.round(2))*100\n end\n\n ###pastmonth##\n @pastmonthTotal=@question.performances.where('created_at <=?',30.day.ago).where('created_at >=?',60.day.ago).count\n @pastmonthTotal=@question.performances.where('created_at <=?',30.day.ago).where('created_at >=?',60.day.ago).count\n @pastmonthTotal=@question.performances.where('created_at <=?',30.day.ago).where('created_at >=?',60.day.ago).count\n @pastmonthTotal=@question.performances.where('created_at <=?',30.day.ago).where('created_at >=?',60.day.ago).count\n @pastmonthFail=@question.performances.where(responsetime: -1 ).where('created_at <=?',30.day.ago).where('created_at >=?',60.day.ago).count\n @pastmonthFail=@question.performances.where(responsetime: -1 ).where('created_at <=?',30.day.ago).where('created_at >=?',60.day.ago).count\n @pastmonthFail=@question.performances.where(responsetime: -1 ).where('created_at <=?',30.day.ago).where('created_at >=?',60.day.ago).count\n @pastmonthFail=@question.performances.where(responsetime: -1 ).where('created_at <=?',30.day.ago).where('created_at >=?',60.day.ago).count\n \n\n\n if @pastmonthTotal==0\n @pastmonthAvai=0\n else\n @pastmonthAvai=((@pastmonthTotal.round(2)-@pastmonthFail.round(2))/@pastmonthTotal.round(2))*100\n end\n \n \n #/////////date/////\n @total1=@performance.group_by_week(:created_at, last: 4, time_zone: \"Kuala Lumpur\").average(:responsetime)\n \n @total=[]\n @performance.group_by_week(:created_at, last: 4).count(:responsetime).each do |a|\n @total.push a[1] \n end\n @total2=[]\n @performance.group_by_week(:created_at, last: 4).where(responsetime: -1 ).count(:responsetime).each do |a|\n @total2.push a[1] \n end\n\n \n end", "def campaignPerformanceReport(month, year, typeOfReport, campaignId, campaignName, basedOn, orderBy, userId)\n puts \"campaign performance is coming here to get the details\" \n #begin \n \n puts image_name = \"campaign_report_#{campaignId}_#{typeOfReport}_#{month}_#{year}_#{basedOn}\"\n \n month_id = MONTH_HASH[month]\n impressions = Array.new #for all campaign, impressions will be calculate per month and for a particular campaign, it will be calculate per week \n # clicks = Array.new #for all campaign, clicks will be calculate per month and for a particular campaign, it will be calculate per week \n labels = Array.new\n label_hash = Hash.new\n puts title = \"Performance of #{campaignName} for the month of #{month}, #{year}\"\n puts axis_title = \"#{basedOn}\"\n # sql = \"select sum(#{basedOn}) as #{basedOn}, dayofmonth(bill_date_time) as day from addeliveries where campaign_id=#{campaignId} and date_format(bill_date_time, '%m')=#{month_id} and date_format(bill_date_time, '%Y')=#{year} group by day\"\n # puts sql\n #begin\n #@dbh = DBI.connect(DATABASE, USERNAME,PASSWORD)\n puts \"executing sql before statement\"\n sql=\"select sum(#{basedOn}) as #{basedOn}, dayofmonth(delivery_time) as day from adsdeliveries where campaign_id=#{campaignId} and date_format(delivery_time, '%m')=#{month_id} and date_format(delivery_time, '%Y')=#{year} group by day\"\n puts \"start------- #{sql}\"\n begin\n @impressions_active=Adsdelivery.find_by_sql(sql)\n rescue\n Adsdelivery.establish_connection( \n :adapter => \"mysql\", \n :host => \"192.168.1.4\", \n :database => \"zestadz_development\",\n :username => \"root\",\n :password => \"sqlworx@ch\"\n )\n @impressions_active=Adsdelivery.find_by_sql(sql)\n end\n #impressions_sql = @dbh.prepare(sql)\n #impressions_sql.execute\n \n @impressions_active.each do |imp|\n impressions << imp.impressions if basedOn=='impressions'\n impressions << imp.clicks if basedOn=='clicks'\n labels << imp.day\n end\n #impressions_sql = @dbh.prepare(sql)\n puts \"running\"\n #impressions_sql.execute\n puts \"end\"\n #puts impressions_sql\n puts \"executing sql after statement\"\n \n puts \"executing while loop before statement\"\n # sth.fetch do |row|\n # printf \"ID: %d, Name: %s, Height: %.1f\\n\", row[0], row[1], row[2]\n # end\n # sth.finish\n \n \n # rescue Exception=>e\n # puts \"An Exception was thrown while sure executing the sql in campaign report\"+e.to_s\n # @dbh = DBI.connect(DATABASE, USERNAME,PASSWORD)\n # impressions_sql = @dbh.prepare(sql)\n # impressions_sql.execute\n # end\n ## puts \"user id is coming here #{userId.to_s}\"\n #while row=impressions_sql.fetch do\n #puts impressions << row[0].to_i\n # puts labels << row[1].to_s\n #end\n puts \"executing while loop after statement\"\n puts \"user id is coming here #{userId.to_s}\"\n for i in 0...labels.size\n label_hash[i] = labels[i].to_s\n end\n create_directory(\"#{@@rails_root}/public/images/reports/\", userId.to_s)\n if(typeOfReport=='Line')\n puts \"inside the function call\"\n build_image image_name, userId, impressions, label_hash, title, axis_title, nil, 550, true \n puts \"inside the function after call\"\n elsif(typeOfReport=='Area')\n build_land_chart image_name, userId, impressions, label_hash, title, axis_title, nil, 550\n elsif(typeOfReport=='Pie')\n build_pie_chart image_name, userId, impressions, label_hash, title, axis_title, nil, 550\n elsif(typeOfReport=='Bar')\n build_bar_chart image_name, userId, impressions, label_hash, title, axis_title, nil, 550\n end\n print \"\\nSuccesfully generated the campaign performance report\"\n #rescue Exception=>e\n # puts \"An Exception was thrown in Campaign Performance Report\"\n # end\n end", "def aggregated_over_time_query\n quantity_field = @country_ids.present? ? \"#{entity_quantity}_reported_quantity\" : \"#{@reported_by}_reported_quantity\"\n\n <<-SQL\n SELECT ROW_TO_JSON(row)\n FROM (\n SELECT JSON_AGG(JSON_BUILD_OBJECT('x', year, 'y', value) ORDER BY year) AS datapoints\n FROM (\n SELECT year, ROUND(SUM(#{quantity_field}::FLOAT)) AS value\n FROM #{shipments_table}\n #{child_taxa_join}\n WHERE #{@condition} AND #{quantity_field} IS NOT NULL AND #{country_condition}\n AND #{child_taxa_condition}\n GROUP BY year\n #{quantity_condition(quantity_field)}\n ORDER BY value DESC\n #{limit}\n ) t\n ) row\n SQL\n end", "def build\n records = []\n date = start_date\n while date <= end_date\n record = {}\n record[:date] = date.strftime(\"%Y-%m-%d\")\n record[:month] = Date::MONTHNAMES[date.month].downcase\n record[:day_of_week] = Date::DAYNAMES[date.wday].downcase\n record[:day_of_week_as_number] = date.wday\n record[:year] = date.year.to_s\n record[:year_and_month] = record[:year] + \"-\" + date.month.to_s.rjust(2,'0')\n record[:sql_date_stamp] = date\n record[:week] = \"week #{date.to_date.cweek}\"\n # compute quarter ourselves - available in Time but not in Date - anything better ?\n quarter = 1 + (date.month-1) / 3\n record[:quarter] = \"Q#{quarter}\"\n record[:semester] = \"S#{(quarter+1)/2}\"\n records << record\n date = date.next\n end\n records\n end", "def determineQuery(metric_param, time_window, time_period, series_length) \n \tif current_user\n user_id = MyRainBarrel.where(user_id: current_user.id).first\n else\n user_id = MyRainBarrel.where(id: 1).first\n end \n\n @total_metric = DailyWaterLog.find_by_sql([\"SELECT \n DISTINCT date_trunc(?, series.date)::date as date,\n id, \n #{metric_param.downcase.gsub(\" \", \"_\")},\n sum(COALESCE(#{metric_param.downcase.gsub(\" \", \"_\")}, 0)) OVER WIN as total_#{metric_param.downcase.gsub(\" \", \"_\")},\n overflowed, water_used, amount_overflown, ph, tds\n FROM (\n SELECT generate_series(?, 0) + (current_date-13)::date as date\n ) series \n LEFT OUTER JOIN \n daily_water_logs on series.date = daily_water_logs.created_at::date AND \n (daily_water_logs.created_at BETWEEN ? AND ?)\n WINDOW \n WIN AS (PARTITION BY date_trunc(?, series.date)::date)\n ORDER BY \n date ASC\", time_period, series_length, time_window, Time.now.tomorrow.midnight, time_period])\n end", "def string\n @sql_string = \"SELECT #{@select} FROM #{@from}#{@join} WHERE #{@where};\"\n end", "def generate_visualization(id, chart_type, table, options={})\n # Generate the js chart data\n output = \"chartData['#{id}'] = new google.visualization.DataTable();\"\n table.columns.each do |col|\n output += \"chartData['#{id}'].addColumn('#{table.column_types[col]}', '#{col}');\"\n end\n option_str = parse_options(options)\n\n output += %Q(\n chartData['#{id}'].addRows(#{table.format_data});\n visualizationCharts['#{id}'] = new google.visualization.#{chart_type.to_s.camelize}(document.getElementById('#{id}'));\n visualizationCharts['#{id}'].draw(chartData['#{id}'], {#{option_str}});\n )\n end", "def get_chart_info(visualization_id)\n data = Student.all;\n visualization = Visualization.find(visualization_id)\n chart_type = visualization.chart_type\n\n # Repeatedly apply each filter on the dataset\n total = 0\n visualization.filters.each_with_index do |filter, index|\n data = apply_filter(data, filter)\n total = total + summarize(data, 'count')\n puts \">> Applied filter #{index + 1}: #{filter.inspect}\"\n end\n\n # Reverse since for some reason it groups in the wrong order without reversing.\n visualization.variables.reverse.each_with_index do |variable, index|\n if (not variable.name.blank?)\n data = group_by_variable(data, variable)\n puts \">> Set variable #{index + 1} : #{variable.inspect}\"\n else\n puts \"Blank variable name encountered....Skipped grouping by that variable\"\n end\n end\n \n # Final summarization before rendering. Make this more dynamic in the future to support max, min, etc.\n #total = apply_filter(temp, visualization.filters.first).count\n data = summarize(data, 'count')\n \n variable_length = visualization.variables.length\n if (variable_length == 2)\n data.each do |key, value| # Building percentages for each subgroup. Ex. \"CSC\" in major1\n filter_hash = Hash.new # New hash to build a filter\n var = visualization.variables.first #major1 # Filter by the first variable - the \"Group By\" variable\n filter_hash[var.name] = key # Adding entry into hash\n total = Student.all.where(filter_hash).count # Calculates the total to divide the data entry (to produce percentages)\n data[key] = value/total.to_f\n end\n else # Else, divide all data entries by the # of all data entries.\n data.each do |key, value| # Ex. say there are 100 students. If we have \"Group by\" \"major1\", the CSC entry would be interpreted\n data[key] = value/total.to_f # as \"X % of students are CSC majors in major1\"\n end\n end\n\n chart_info = Hash.new # Building chart_info hash\n chart_info[:data] = data\n chart_info[:chart_type] = chart_type\n chart_info[:options] = get_chart_options(visualization_id)\n # Render visualization partial. This partial should have logic to determine which chart to graph\n return chart_info\n end", "def chart_data\n @tagid = params[:tag_id]\n @ideastagsall = IdeasTags.find(:all, :conditions => {:tag_id => @tagid})\n @ideasall = Idea.find(:all, :conditions => {:id => @ideastagsall.map(&:idea_id) }, :order=> 'num_votes desc', :limit=>20)\n @user_ideas = Idea.find(:all, :conditions => {:id => @ideastagsall.map(&:idea_id) , :user_id => current_user.id})\n @ideasall = (@ideasall + @user_ideas).uniq\n respond_to do |format|\n format.csv\n end\n end", "def xml_with_contracts\n results = query 'select \"sp_ID\" as id',\n ', \"sp_Kanton\" as kanton',\n ', \"sp_Name\" as name',\n ', \"sp_Ort\" as ort',\n ', \"sp_Aktiv\" as aktiv',\n ', count (\"vt_sp_ID\") as vertraege',\n 'from KOGU.\"StammSpital\"',\n 'left outer join KOGU.\"VertragMandantMitSpital\" on \"vt_sp_ID\" = \"sp_ID\" and \"vt_cd_LeMdFaktura\" = 1',\n 'where \"sp_Aktiv\" < 50 and \"sp_cd_LeXmlZertifiziert\" = 1',\n 'group by \"sp_ID\",\"sp_Kanton\", \"sp_Name\", \"sp_Ort\", \"sp_Aktiv\", \"sp_cd_LeXmlZertifiziert\"',\n 'order by \"sp_Kanton\", \"sp_Name\"'\n\n results.map { |data| self.new(data) }\n end", "def dot\n s = \"digraph query {\\n\"\n @operators.each { |op| \n desc = op.attributes.inspect.gsub(\"\\\"\", \"\\\\\\\"\")\n label = \"[#{op.index}] #{op.name}\"\n if op.performanceData\n duration = (op.performanceData[\"endTime\"] - op.performanceData[\"startTime\"]).to_f\n label += \" (#{duration} ms)\"\n end\n s += \" #{op.index} [label=\\\"#{label}\\n #{desc}\\\", shape=box];\\n\"\n op.dependencies.each { |dep|\n s += \" #{dep.index} -> #{op.index};\\n\"\n }\n } \n s += \"}\\n\"\n end", "def to_xml\n\t\t\tresult_string = String.new\n\t\t\tresult_string << \"<results>\\n\"\n\t\t\t@results.each do |result|\n\t\t\t\tresult_string << \"\\t<vtresult>\\n\"\n\t\t\t\tRESULT_FIELDS.each{|field|\n\t\t\t\t\tresult_string << \"\\t\\t<#{field.to_s}>#{result[field]}</#{field.to_s}>\\n\" unless field == :permalink and result['permalink'].nil?\n\t\t\t\t}\n\t\t\t\tresult_string << \"\\t</vtresult>\\n\"\n\t\t\tend if @results != nil\n\t\t\tresult_string << \"</results>\\n\"\n\n\t\t\tresult_string\n\t\tend", "def getMiniMeasurement\n#measurements\n\n\n @set= ChartItem.new(\"Total Inches\")\n\n for measurement in @measurement\n \n # id: integer, user_id: integer, chest: integer, belly_upper: integer, belly_lower: integer, hips: integer, thigh: integer, arm: integer, date: datetime, created_at: datetime, updated_at: datetime\n sum = measurement.chest + measurement.belly_upper + measurement.belly_lower + measurement.hips + measurement.thigh + measurement.arm\n \n @set.addPoint(measurement.date.to_time.to_i * 1000,sum)\n \n end \n# ----------------------------------\n# now start adding them to the chart\n# ---------------------------------- \n #if @chartoptions[:measurement][0]\n \n \n @miniMeasures.add(@set)\n\n\n#end # if @chartoptions[:measurments] \nend", "def compile_query\n #puts \"DATASET COMPILE self #{self}\"\n #puts \"DATASET COMPILE queries #{queries}\"\n \n # Old way: works but doesn't handle fmp compound queries.\n #query.each_with_object([{},{}]){|x,o| o[0].merge!(x[0] || {}); o[1].merge!(x[1] || {})}\n \n # New way: handles compound queries. Reqires ginjo-rfm 3.0.11.\n return unless queries # This should help introspecting dataset that results from record deletion. TODO: test this.\n queries.inject {|new_query,scope| apply_scope(new_query, scope)} ##puts \"SCOPE INJECTION scope:#{scope} new_query:#{new_query}\"; \n end", "def chart\n @chart = order(:start_at)\n \n filter = 'project_name_filter'\n filter_value = send(filter)\n filter_property = property_for_filter(filter)\n if !filter_value.to_s.empty?\n @chart = @chart.select do |task|\n value = task.send(filter_property)\n value.to_s.downcase.include?(filter_value.to_s.downcase)\n end\n end\n \n @chart\n end", "def charts\n # Get array of genres and number of movies of each genre.\n genres_and_movies = Genre.joins(:movie).\n select('genre.genre_id, genre.name as name, count(*) as count').\n group('genre.genre_id')\n\n @genre_and_movie_count = Array.new\n genres_and_movies.each do |genre|\n @genre_and_movie_count << [genre.name, genre.count]\n end \n\n # Get array of months and number of wishes in that month.\n wishlist_by_month = Wishlist.all.group_by { |w| w.wis_date.beginning_of_month }\n \n @month_and_wishes = Array.new\n wishlist_by_month.each do |date, wish| \n @month_and_wishes << [date, wish.length]\n end\n\n # Get array of months and number of ratings in that month\n ratings_by_month = Rating.all.group_by { |r| r.time.beginning_of_month }\n \n @month_and_ratings = Array.new\n ratings_by_month.each do |date, ratings| \n @month_and_ratings << [date.strftime('%B %Y'), ratings.length]\n end\n\n end", "def mainWidgetData\n\n\n\t\t\t# Set an empty array\n\t\t\tdata = []\n\t\t\t# Loop through the rawData\n\t\t\t@rawData.each do |day|\n\t\t\t\t# Set the empty array for each day\n\t\t\t\tdayHash = []\n\t\t\t\tdayHash << [day[:total_prayed], \"total\"]\t# Push in the key value pair [value, \"total\"]\n\t\t\t\tdayHash << [day[:fajr], \"fajr\"]\t\t\t\t# Push in the key value pair [value, \"fajr\"]\n\t\t\t\tdayHash << [day[:zuhr], \"duhr\"]\t\t\t\t# Same as above\n\t\t\t\tdayHash << [day[:asr], \"asr\"]\t\t\t\t# Same as above\n\t\t\t\tdayHash << [day[:maghrib], \"maghrib\"]\t\t# Same as above\n\t\t\t\tdayHash << [day[:isha], \"isha\"]\t\t\t\t# Same as above\n\t\t\t\tdata <<\tdayHash\t\t\t\t\t\t\t\t# Push in the dayHash into the main parent hash\n\t\t\tend\n\t\t\t# Generate a path for the dot chart svg\n\t\t\t# Set the initial value of the path\n\t\t\tpath = \"M10 20 \"\n\t\t\t\n\t\t\tif @timesRequestSent < 16\n\t\t\t\t# Loop through the entire data\n\t\t\t\t(0..(@timesRequestSent-1)).each do |i|\n\t\t\t\t\t# Add path based on the average per day prayer, using the \"total\" value\n\t\t\t\t\tpath += \"L#{30+ 60*i} #{20 - (data[i][0][0]/5.to_f)*20} \"\n\t\t\t\tend\n\t\t\t\tpath += \"L#{60*@timesRequestSent - 10} 20 Z\"\n\t\t\telse\n\t\t\t\tputs \"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\"\n\t\t\t\tdata = data[(@timesRequestSent-15),(@timesRequestSent-1)]\n\t\t\t\tputs data.count\n\t\t\t\t# Loop through the entire data\n\t\t\t\t(0..14).each do |i|\n\t\t\t\t\t# Add path based on the average per day prayer, using the \"total\" value\n\t\t\t\t\tpath += \"L#{30+ 60*i} #{20 - (data[i][0][0]/5.to_f)*20} \"\n\t\t\t\tend\n\t\t\t\tpath += \"L#{60*15 - 10} 20 Z\"\n\t\t\tend\n\t\t\t\n\t\t\t# Return both the path and the day array\n\t\t\t{ data: data, path: path }\n\t\tend", "def view\n @dial_results = DialResult.where(:dial_job_id => params[:id]).paginate(\n\t\t:page => params[:page], \n\t\t:order => 'number ASC',\n\t\t:per_page => 30\n\t)\t\t\n\t\n\tif(@dial_results)\n\t\t@g1 = Ezgraphix::Graphic.new(:c_type => 'col3d', :div_name => 'calls_pie1')\n\t\t@g1.render_options(:caption => 'Call Results', :w => 700, :h => 300)\n\n\t\t@g1.data = {\n\t\t\t:Timeout => DialResult.count(:conditions =>['dial_job_id = ? and completed = ?', params[:id], false]),\n\t\t\t:Busy => DialResult.count(:conditions =>['dial_job_id = ? and busy = ?', params[:id], true]),\n\t\t\t:Answered => DialResult.count(:conditions =>['dial_job_id = ? and completed = ?', params[:id], true]),\n\t\t}\n\tend\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dial_results }\n end\n end", "def prepare_piechart_json(utilization_date, record, key)\n titles, ids, data, links = [], [], [], []\n involved, total = 0, 0\n if key == 'team'\n # employees = Employee.where(team_id: id)\n # FIXME_AB: avoid using unless statements unless you really need it, as discussed\n # Fixed\n record.team_leads.active_on(utilization_date).each do |team_lead| \n #FIXME_AB: avoid using unless statements unless you really need it, as discussed\n titles << team_lead.name\n total, involved = find_involvement( team_lead, utilization_date )\n data = push_data( data, total, involved )\n ids << team_lead.id \n links << view_context.link_to(team_lead.name, employee_path(team_lead) )\n end\n elsif key == 'emp'\n record.subordinates.active_on(utilization_date).each do |employee|\n titles << employee.name\n total, involved = find_involvement(employee, utilization_date)\n data = push_data(data, total, involved)\n ids << employee.id\n links << view_context.link_to(employee.name, employee_path(employee))\n end\n end\n pie_report_hash = {'ids' => ids, 'data' => data, 'titles' => titles, 'links' => links}\n return pie_report_hash\n end", "def to_maql_create\n maql = \"# Create the '#{self.title}' data set\\n\"\n maql += \"CREATE DATASET {#{self.identifier}} VISUAL (TITLE \\\"#{self.title}\\\");\\n\\n\"\n [ attributes, facts, { 1 => @connection_point } ].each do |objects|\n objects.values.each do |obj|\n maql += \"# Create '#{obj.title}' and add it to the '#{self.title}' data set.\\n\"\n maql += obj.to_maql_create\n maql += \"ALTER DATASET {#{self.identifier}} ADD {#{obj.identifier}};\\n\\n\"\n end\n end\n\n labels.each do |label|\n maql += \"# Creating Labels\\n\"\n maql += label.to_maql_create\n end\n\n references.values.each do |ref|\n maql += \"# Creating references\\n\"\n maql += ref.to_maql_create\n end\n\n folders_maql = \"# Create folders\\n\"\n (folders[:attributes].values + folders[:facts].values).each { |folder| folders_maql += folder.to_maql_create }\n folders_maql + \"\\n\" + maql + \"SYNCHRONIZE {#{identifier}};\\n\"\n end", "def result_to_attributes_xml(result, options = {}, &block)\n inner_recursion = options.delete(:inner_recursion)\n result_set = inner_recursion ? result : result.dup\n \n parent_id = (options.delete(:parent_id) || result_set.first[result_set.first.parent_col_name]) rescue nil\n level = options[:level] || 0 \n options[:methods] ||= []\n options[:nested] = true unless options.key?(:nested)\n options[:dasherize] = true unless options.key?(:dasherize)\n \n if options[:only].blank? && options[:except].blank?\n options[:except] = [:left_column, :right_column, :parent_column].inject([]) do |ex, opt|\n column = acts_as_nested_set_options[opt].to_sym\n ex << column unless ex.include?(column)\n ex\n end\n end\n \n options[:indent] ||= 2\n options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])\n options[:builder].instruct! unless options.delete(:skip_instruct)\n \n parent_attrs = {}\n parent_attrs[:xmlns] = options[:namespace] if options[:namespace]\n \n siblings = options[:nested] ? result_set.select { |s| s.parent_id == parent_id } : result_set \n siblings.each do |sibling|\n result_set.delete(sibling)\n node_tag = (options[:record] || sibling[sibling.class.inheritance_column] || 'node').underscore\n node_tag = node_tag.dasherize unless options[:dasherize]\n attrs = block_given? ? block.call(sibling, level) : sibling.attributes(:only => options[:only], :except => options[:except])\n options[:methods].inject(attrs) { |enum, m| enum[m.to_s] = sibling.send(m) if sibling.respond_to?(m); enum }\n if options[:nested] && sibling.children?\n opts = options.merge(:parent_id => sibling.id, :level => level + 1, :inner_recursion => true, :skip_instruct => true) \n options[:builder].tag!(node_tag, attrs) { result_to_attributes_xml(result_set, opts, &block) }\n else\n options[:builder].tag!(node_tag, attrs)\n end\n end\n unless inner_recursion\n result_set.each do |orphan|\n node_tag = (options[:record] || orphan[orphan.class.inheritance_column] || 'node').underscore\n node_tag = node_tag.dasherize unless options[:dasherize] \n attrs = block_given? ? block.call(orphan, level) : orphan.attributes(:only => options[:only], :except => options[:except])\n options[:methods].inject(attrs) { |enum, m| enum[m.to_s] = orphan.send(m) if orphan.respond_to?(m); enum }\n options[:builder].tag!(node_tag, attrs)\n end\n end\n options[:builder].target!\n end", "def show\n @start_date = params[:start].try(:to_date) || 3.days.ago.to_date\n @end_date = params[:end].try(:to_date) || Time.now\n range = (@start_date..@end_date)\n\n chart_device_port = IprannetQosegressinterface.where(device_port: @iprannet_qosegressinterface.device_port).order(\"created_at ASC\").where(created_at: range)\n #@chard_discard_test = chart_device_port.pluck(:created_at, :queueId, :discard).map { |e| [ e[0].to_time, e[1], e[2] ] }.to_json.html_safe\n @chart_discard_1 = chart_device_port.where(queueId: 1).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_2 = chart_device_port.where(queueId: 2).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_3 = chart_device_port.where(queueId: 3).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_4 = chart_device_port.where(queueId: 4).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_5 = chart_device_port.where(queueId: 5).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_6 = chart_device_port.where(queueId: 6).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_7 = chart_device_port.where(queueId: 7).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_1 = chart_device_port.where(queueId: 1).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_2 = chart_device_port.where(queueId: 2).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_3 = chart_device_port.where(queueId: 3).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_4 = chart_device_port.where(queueId: 4).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_5 = chart_device_port.where(queueId: 5).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_6 = chart_device_port.where(queueId: 6).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_7 = chart_device_port.where(queueId: 7).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n end", "def sql\n report.cube.query_row_and_column(row_dimension, column_dimension, \n :conditions => report.conditions, \n :return => :sql )\n end", "def to_xml(builder, include_dims=true)\n builder.grid do |xml|\n xml.cube\n dims_to_xml(xml) if include_dims\n xml.slices do |xml|\n xml.slice :rows => @row_count, :cols => @col_count do |xml|\n xml.data do |xml|\n xml.range :start => 0, :end => @row_count * @col_count - 1 do\n xml.vals @vals.join('|')\n xml.types @types.join('|')\n end\n end\n end\n end\n end\n end", "def to_xml_fragment\n Exporters::XML::DDI::Fragment.export_3_2 Exporters::XML::DDI::QuestionGrid, self\n end", "def base_query\n DataServicesApi::QueryGenerator.new\n end", "def generate_sql(columns)\n [\"SELECT #{columns} FROM #{@from}\", @where, @group, @having, @order, @limit, @offset].join\n end", "def render\n\t\t\t@wiki_query.query_result.to_json\n\t\tend", "def to_gql\n result = ' ' * __depth + __name\n result += __params_to_s(__params, true) unless __params.empty?\n unless __nodes.empty?\n result += \" {\\n\"\n result += __nodes.map(&:to_gql).join(\"\\n\")\n result += \"\\n#{' ' * __depth}}\"\n end\n\n result\n end", "def export_xml\n @quo= Quotation.all\n send_data @quo.as_json.to_xml.to_s\n end", "def chart\n data = case params[:kind]\n when 'number_of_users'\n @title = 'Number of users '\n User.group('DATE_TRUNC(\\'month\\', created_at)').count\n when 'number_of_loves'\n @title = 'Number of Loves'\n ActsAsVotable::Vote.group('DATE_TRUNC(\\'month\\', created_at)').count\n when 'number_of_comments'\n @title = 'Number of comments'\n Comment.unscoped.group('DATE_TRUNC(\\'month\\', created_at)').count\n when 'number_of_shares'\n @title = 'Number of shares'\n Share.group('DATE_TRUNC(\\'month\\', created_at)').count\n when 'monthly_active_users'\n @title = 'Monthly active users'\n votes = ActsAsVotable::Vote.group('DATE_TRUNC(\\'month\\', created_at)').count\n comments = Comment.unscoped.group('DATE_TRUNC(\\'month\\', created_at)').count\n shares = Share.group('DATE_TRUNC(\\'month\\', created_at)').count\n votes\n .merge(comments) { |k, a_value, b_value| a_value + b_value }\n .merge(shares) { |k, a_value, b_value| a_value + b_value }\n when 'joined_last_month'\n @title = 'Joined last month'\n User.group('DATE_TRUNC(\\'day\\', created_at)').where(created_at: Date.today.beginning_of_month..Date.today.end_of_month).count\n else #net_promoter_score\n @title = 'Net promoter score'\n PhoneNumberInvitation.uniq.group('DATE_TRUNC(\\'month\\', created_at)').count(:user_id)\n end\n\n # data manipulation\n @data = []\n prev_key, year = nil, Time.current.year\n data.sort.each do |k ,v|\n k = k.to_date\n if params[:kind] == 'joined_last_month'\n (prev_key.next...k).each{|d| @data << [d.strftime('%d'), 0, \"#{d.to_s(:long)} = 0\"] } if prev_key.present?\n @data << [k.strftime('%d'), v, \"#{k.to_s(:long)} = #{v}\"]\n else\n k = k.beginning_of_month\n (prev_key.next..k.yesterday).select{|d| d.day == 1 }.each{|d| @data << [d.strftime(year == d.year ? '%m' : '%y/%-m'), 0, \"#{d.strftime(\"%B, %Y\")} = 0\"] } if prev_key.present?\n @data << [k.strftime(year == k.year ? '%m' : '%y/%-m'), v, \"#{k.strftime(\"%B, %Y\")} = #{v}\"]\n end\n prev_key = k\n end\n\n render partial: 'chart'\n end", "def revenueReport(month, year, typeOfReport, clientId, clientName, basedOn, orderBy, userId)\n #begin\n puts image_name = \"revenue_report_#{clientId}_#{typeOfReport}_#{month}_#{year}_#{basedOn}\"\n month_id = MONTH_HASH[month]\n amount = Array.new #for all clients, impressions will be calculate per month and for a particular adclient, it will be calculate per week \n labels = Array.new\n label_hash = Hash.new\n title = \"Revenue of #{clientName} for the month of #{month}, #{year}\"\n axis_title = \"Amount(in $)\"\n sql = \"select sum(cost) as amount, dayofmonth(delivery_time) as day from adsdeliveries where client_id=#{clientId} and date_format(delivery_time, '%m')=#{month_id} and date_format(delivery_time, '%Y')=#{year} and #{basedOn}=1 group by day\"\n puts \"publisher revenue report-----------#{sql}\"\n #begin\n #amount_sql = @dbh.prepare(sql)\n #amount_sql.execute\n #rescue Exception=>e\n # puts \"An Exception was thrown while executing the sql in revenue report\"\n # @dbh = DBI.connect(DATABASE, USERNAME,PASSWORD)\n # amount_sql.execute\n #end\n begin\n @impressions_active=Adsdelivery.find_by_sql(sql)\n rescue\n Adsdelivery.establish_connection( \n :adapter => \"mysql\", \n :host => \"192.168.1.4\", \n :database => \"zestadz_development\",\n :username => \"root\",\n :password => \"sqlworx@ch\"\n )\n @impressions_active=Adsdelivery.find_by_sql(sql)\n end\n #impressions_sql = @dbh.prepare(sql)\n #\n #impressions_sql.execute\n \n #amount=@impressions_active[0].amount.to_s\n \n \n #note: remove this loop\n @impressions_active.each do |imp|\n amount << imp.amount.to_s\n #impressions << imp.clicks if basedOn=='clicks'\n labels << imp.day\n end\n \n \n # while row=amount_sql.fetch do\n # amount << row[0].to_i\n # labels << row[1].to_s\n # end\n for i in 0...labels.size\n label_hash[i] = labels[i].to_s\n end\n \n create_directory(\"#{@@rails_root}/public/images/reports/\", userId.to_s)\n if(typeOfReport=='Line')\n build_image image_name, userId, amount, label_hash, title, axis_title, nil, 550, true \n elsif(typeOfReport=='Area')\n build_land_chart image_name, userId, amount, label_hash, title, axis_title, nil, 550\n elsif(typeOfReport=='Pie')\n build_pie_chart image_name, userId, amount, label_hash, title, axis_title, nil, 550\n elsif(typeOfReport=='Bar')\n build_bar_chart image_name, userId, amount, label_hash, title, axis_title, nil, 550\n end\n print \"\\nSuccesfully generated the revenue report\"\n #rescue Exception=>e\n # puts \"An Exception was thrown in Revenue Report\"\n #end\n end", "def index\n @page_charts = Usagerecord.select(\"homepage, count(id) as requests\" ).group(\"homepage\")\n\n #Order.select(\"date(created_at) as ordered_date, sum(price) as total_price\").group(\"date(created_at)\")\n\n #SELECT date(created_at) as ordered_date, sum(price) as total_price FROM orders GROUP BY date(created_at)\n\n #select browser, count(id) from usagerecords group by browser\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @page_charts }\n end\n\t\n end", "def query\n unless defined?(@query)\n d = @data\n @query = SeqDesc.new(d[4], d[5], d[9], d[10], d[11], d[12],\n split_comma(d[19]), split_comma(d[21]))\n end\n @query\n end", "def order_line_report\n #will have 4 columns from the OrderLine table. This goes through the OrderLine method\n @data = OrderLine.find(:all , :select => \"order_id as oid, product_id as pid, product_price as price, ordered_quantity as quantity\", :group => \"oid\")\n end", "def show\n @start_date = params[:start].try(:to_date) || 3.days.ago.to_date\n @end_date = params[:end].try(:to_date) || Time.now\n range = (@start_date..@end_date)\n\n port_sap = IpranaccessQosegressinterface.where(device_sap: @ipranaccess_qosegressinterface.device_sap).order(\"created_at ASC\").where(created_at: range)\n #@chard_discard_test = port_sap.pluck(:created_at, :queueId, :discard).map { |e| [ e[0].to_time, e[1], e[2] ] }.to_json.html_safe\n\n @chart_discard_1 = port_sap.where(queueId: 1).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_2 = port_sap.where(queueId: 2).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_3 = port_sap.where(queueId: 3).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_4 = port_sap.where(queueId: 4).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_5 = port_sap.where(queueId: 5).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_6 = port_sap.where(queueId: 6).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_discard_7 = port_sap.where(queueId: 7).pluck(:created_at, :discard).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_1 = port_sap.where(queueId: 1).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_2 = port_sap.where(queueId: 2).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_3 = port_sap.where(queueId: 3).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_4 = port_sap.where(queueId: 4).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_5 = port_sap.where(queueId: 5).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_6 = port_sap.where(queueId: 6).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n @chart_bps_max_7 = port_sap.where(queueId: 7).pluck(:created_at, :bps_max).map { |e| [ e[0].strftime(\"%d/%m - %H:00\"), e[1] ] }\n end", "def show\n url = \"#{request.base_url}/api/v1/company/#{@table.company.id}/table/#{@table.id}/all_products\"\n\n qrcode = RQRCode::QRCode.new(url)\n @svg = qrcode.as_svg(\n offset: 0,\n color: '000',\n shape_rendering: 'crispEdges',\n module_size: 6,\n standalone: true\n )\n end", "def generateReport(debug = false)\n\t\treturn generateReport(@connection, @config_id, debug)\n\tend", "def exercise3\n @content = ActiveRecord::Base.connection.execute(\"\n SELECT\n gr.name as group,\n u.name as name,\n SUM(m.mapviews) as views,\n CONCAT(CAST(ROUND((SUM(m.mapviews)*100)/SUM(SUM(m.mapviews)) OVER (PARTITION BY gr.name),2) as text), '%') as percent_of_group_views\n FROM (((users as u\n INNER JOIN groups_users as gu ON u.id=gu.user_id)\n INNER JOIN groups as gr ON gr.id = gu.group_id)\n INNER JOIN maps as m ON m.user_id = u.id)\n GROUP BY (gr.name, u.name)\n ORDER BY gr.name ASC, percent_of_group_views DESC;\");\n\n @results3 = []\n\n index = 0\n @content.each do |r|\n @results3[index] = Result3.new r\n index = index + 1;\n end\n\n return @results3\n end", "def performance\n @advert = Advert.find(params[:id])\n @start_date = Date.parse(params[:filters][:start_date]) rescue 1.month.ago\n @end_date = Date.parse(params[:filters][:end_date]) rescue Time.now\n report_days = (@end_date-@start_date)/1.day\n @report_data={}\n #generate aggregate data\n\n @report_data['totals'] = {}\n @report_data['totals']['impressions'] = @advert.impressions.between(@start_date,@end_date).count\n @report_data['totals']['clicks'] = @advert.clicks.between(@start_date,@end_date).count\n @report_data['totals']['impressions_day'] = @report_data['totals']['impressions']/report_days\n @report_data['totals']['clicks_day'] = @report_data['totals']['clicks']/report_days\n @report_data['totals']['conversion'] = 100.0*(@report_data['totals']['clicks'].to_f/@report_data['totals']['impressions'].to_f)\n #generate sereies data\n @report_data['series'] = {}\n @report_data['series']['impressions'] = @advert.impressions.between(@start_date,@end_date).by_day\n @report_data['series']['clicks'] = @advert.clicks.between(@start_date,@end_date).by_day\n \n #correlate/merge keys for date series \n @report_data['series']['merge']={}\n @report_data['series']['impressions'].each do |i|\n @report_data['series']['merge'][i.day]||={}\n @report_data['series']['merge'][i.day].update({'impressions'=>i.total})\n end\n @report_data['series']['clicks'].each do |c|\n @report_data['series']['merge'][c.day]||={}\n @report_data['series']['merge'][c.day].update({'clicks'=>c.total})\n end\n @graph_data={}\n \n #raise {'series'=>(@start_date.to_date..@end_date.to_date).collect {|d| d.strftime('%m/%d/%y'@report_data['series']['merge'].keys.inspect\n\n @graph_data['impressions']=(@start_date.to_date..@end_date.to_date).collect do |date|\n @report_data['series']['merge'][date.strftime(\"%Y-%m-%d\")]['impressions'].to_i rescue 0\n end\n @graph_data['clicks']=(@start_date.to_date..@end_date.to_date).collect do |date|\n @report_data['series']['merge'][date.strftime(\"%Y-%m-%d\")]['clicks'].to_i rescue 0\n end\n end", "def to_s\n\t\t\t\"<#{self.class.to_s} query=#{query} type=#{type} freq=#{frequency} delivery=#{delivery} domain=#{domain} search_query=#{search_query}>\"\n\t\tend", "def build_graph_generally(chart_type, categories, series, colors)\n graph = get_graph(chart_type)\n graph.add(:axis_category_text, categories)\n graph.add(:series, \"series legend label\", series)\n graph.add(:theme, \"vote\")\n graph.add(:user_data, :colors, colors.join(\",\"))\n graph.add(:user_data, :delay_count, series.size - 1)\n graph\n end", "def to_xml(options = {})\n collect\n options[:indent] ||= 2\n xml = options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])\n xml.instruct! unless options[:skip_instruct]\n xml.tag!(table_name) do\n if paginated?\n xml.total_entries(total_entries, :type => \"integer\")\n xml.page(current_page, :type => \"integer\")\n xml.per_page(per_page, :type => \"integer\")\n xml.total_pages(total_pages, :type => \"integer\")\n end\n xml.collection(:type => \"array\") do\n collection.each do |item|\n item.to_xml(:indent => options[:indent], :builder => xml, :skip_instruct => true)\n end\n end\n end\n end", "def to_xml_string(str = +'')\n return if empty?\n\n str << \"<tableParts count='#{size}'>\"\n each { |table| str << \"<tablePart r:id='#{table.rId}'/>\" }\n str << '</tableParts>'\n end", "def to_html(input_args=Hash.new)\n #puts \"to_html arg #{input_args}\"\n\n reset_chart(input_args)\n \n open_tag('script',script_content)\n open_tag('div',\"\",class: get_chart_size(input_args[:size])[:column]) do\n if @id\n if @do_not_save_chart\n open_tag('small',\"user generated json has no chart expand function\") \n else \n open_tag('small') do\n #open_tag('span','',class: 'chart_btn') do\n # open_tag('a',\"Expand\",href: \"/chart_expand/#{chart_url}\")\n #end\n #if @args[:time] # if time chart, srg wants to button user can click to show status last month\n # open_tag('span','',class: 'chart_btn') do\n # open_tag('a',\"last month\",href: \"/chart_last_month/#{chart_url}\")\n # end\n #end\n if @args[:title] # jason 111516, intentionally write the chart's title here. this one is useful when there are a lot of chart and people can search chart by using browser's search function\n open_tag('span',\"#{@args[:title]}\");\n end\n open_tag('span','',id: 'tooltip_info') do # this field gets populated when user hovers on tool tip\n end\n end\n end\n end\n open_tag('div',\"\",class: get_chart_size(input_args[:size])[:css]) do\n open_tag('canvas',\"\",id: \"#{@chart_id}\" ) do # matches the javascript code which expect to populate LineChart\n end \n end \n end\n @out\n end" ]
[ "0.6754907", "0.6137059", "0.60106975", "0.59371805", "0.5914314", "0.5776672", "0.5766882", "0.57645017", "0.57356685", "0.5694288", "0.5690197", "0.56722575", "0.562298", "0.56084913", "0.55933535", "0.54660743", "0.54639256", "0.545879", "0.54495037", "0.5425777", "0.5405491", "0.5390864", "0.5385708", "0.5383379", "0.5372914", "0.537078", "0.53326243", "0.53314424", "0.53291863", "0.53116024", "0.5311035", "0.5291357", "0.5253399", "0.5241987", "0.5230105", "0.52213925", "0.52173275", "0.5212922", "0.52063537", "0.51949066", "0.51948833", "0.51943755", "0.5181343", "0.517332", "0.51699215", "0.51572317", "0.5156682", "0.5154833", "0.5125048", "0.51250124", "0.5124803", "0.51243895", "0.5110669", "0.51048905", "0.5099828", "0.50863904", "0.508058", "0.5068695", "0.5066324", "0.50629735", "0.50569135", "0.504691", "0.5036656", "0.5022232", "0.5017834", "0.5014831", "0.500241", "0.49995092", "0.49967068", "0.49953184", "0.49932718", "0.49860588", "0.49854898", "0.49835667", "0.49646395", "0.49528745", "0.49495053", "0.49492475", "0.49486008", "0.49407786", "0.4938298", "0.49377626", "0.49322966", "0.4931917", "0.49290633", "0.49275655", "0.49217024", "0.49195936", "0.49186403", "0.49173245", "0.49161896", "0.49156946", "0.49115273", "0.49076125", "0.49049878", "0.49041662", "0.49022147", "0.48898163", "0.48876175", "0.4885475" ]
0.57169294
9
stage the file git add make a commit push to a github repo
def check_number(num) if num.include?('.') num.to_f.to_s == num else num.to_i.to_s == num end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def git_add_commit_push(host, branch, message, git_repo_path)\n git_add_everything(host, git_repo_path)\n git_commit_push(host, branch, message, git_repo_path)\nend", "def commit_to_git\n puts `git add .`\n puts `git commit -a -m \"New poshts for the syhtt\"`\n puts `git push blahg master`\n end", "def add!()\n git \"add #{@path}\"\n end", "def git_add(file, msg)\r\n `git add #{file} && git commit -m \\\"#{msg}\\\"`\r\nend", "def git_commit_and_push(cookbook_path, github_url)\n if File.exists?(File.join(cookbook_path, \".git\"))\n shell_out(\"git remote rm origin\", :cwd => cookbook_path)\n else\n shell_out!(\"git init\", :cwd => cookbook_path)\n end\n shell_out!(\"echo - $(date): Uploaded with knife github plugin. >> CHANGELOG.md \", :cwd => cookbook_path)\n shell_out!(\"git add .\", :cwd => cookbook_path)\n shell_out!(\"git commit -m 'creating initial cookbook structure from the knife-github plugin' \", :cwd => cookbook_path)\n shell_out!(\"git remote add origin #{github_url} \", :cwd => cookbook_path)\n shell_out!(\"git push -u origin master\", :cwd => cookbook_path)\n end", "def git_add_everything(host, git_repo_path)\n git_on(host, \"add #{git_repo_path}/*\", git_repo_path)\nend", "def stage_and_commit_file(repo_base_path, relpath_to_file, commit_message = nil)\n commit_message = \"Updated #{relpath_to_file} via website\" unless !commit_message.blank?\n gitRepo = Repo.new(repo_base_path)\n olddir = Dir.pwd\n Dir.chdir(repo_base_path)\n gitRepo.add(relpath_to_file)\n gitRepo.commit_index(commit_message)\n Dir.chdir(olddir)\n end", "def gitAddCommit\n @gop.add(:all => true)\n\n begin\n @gop.commit(\"Automatic version bump\")\n rescue Git::GitExecuteError => giterror\n # continue\n end\n end", "def git_push_commits\n shellout(\"git push #{config[:remote]} #{config[:branch]}\")\n end", "def commit\n system(\"cd #{repo_path};git commit -m 'to the cloud'\")\n end", "def stage\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_add_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} add -A\"\n log.info(x) { \"[git] add command => #{git_add_cmd}\" }\n %x[#{git_add_cmd}];\n log.info(x) { \"[git] has recursively added resources to version management.\" }\n\n end", "def git_commit gitconfig\n #change dir to preview path\n #terminal_add gitconfig, terminal_info(I18n.t('git.message.push'))\n terminal_add gitconfig, terminal_trigger(I18n.t('git.trigger.push'), \"\")\n preview_dir = Rails.configuration.scribae['preview']['target']\n repo_path = Rails.root.join(preview_dir, gitconfig.repo)\n if Dir.exist? repo_path\n Dir.chdir repo_path\n cmds = [\n [\"git add .\", nil, false],\n [\"git commit -m \\\"gh-pages commit\\\"\", nil, false],\n [\"git push origin gh-pages\", nil, true]\n ]\n cmd_res = run_commands cmds, gitconfig\n if cmd_res\n terminal_add gitconfig, terminal_trigger(I18n.t('git.trigger.pushed'), \"\")\n end\n end\n end", "def git_commit_push(host, branch, message, git_repo_path)\n git_on(host, \"commit -m \\\"#{message}\\\"\", git_repo_path)\n git_push(host, branch, git_repo_path)\nend", "def create_local_commit author: nil, branch:, file_name:, file_content:, message:, push: false\n on_branch(branch) do\n if (folder_name = File.dirname file_name) != '.'\n Dir.mkdir folder_name\n end\n File.write file_name, file_content\n run \"git add '#{file_name}'\"\n run \"git commit -m '#{message}' #{\"--author='#{author}'\" if author}\"\n run 'git push' if push\n end\nend", "def git_push(host, branch, git_repo_path)\n git_on(host, \"push origin #{branch}\", git_repo_path)\nend", "def git_commit_push(message)\n\t\t \t\tshell_command(\"git commit -a -m #{message}\")\n\t\t \t\tshell_command(\"git commit\")\n\t\t \tend", "def git_add\n `git add package.json npm-shrinkwrap.json`\n end", "def stage_files(*files)\n command = \"git add --all #{files.join(' ')}\"\n command_success?(command)\n end", "def push\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_push_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} push origin master\"\n log.info(x) { \"[git] push command => #{git_push_cmd}\" }\n system git_push_cmd\n log.info(x) { \"[git] has pushed outstanding commit bundles to the remote backend repository.\" }\n\n end", "def add(file)\n @file = file\n FileUtils.cp_r(file.path,folder_path)\n unless system(\"cd #{repo_path};git add .\")\n raise GitCloud::GitException.new(\"Add\")\n end\n end", "def commit\n @repo.commit\n end", "def add_file( file_path )\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_add_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} add #{file_path}\"\n log.info(x) { \"[git] single file add command => #{git_add_cmd}\" }\n %x[#{git_add_cmd}];\n log.info(x) { \"[git] has added #{file_path} into the git repository.\" }\n\n end", "def commit!\n git add: \".\"\n git commit: \"-m '#{config.dig('commit_msg')}'\"\n end", "def push(repo)\n before_push(repo)\n\n repo.cmd \"git remote add #{name} #{clone_url(repo)}\"\n repo.cmd \"git push --all #{name}\"\n after_push(repo)\n end", "def push\n ensure_git_and_cucumber_available\n ensure_repository\n\n puts \"Not implemented yet... pull request for push please!\"\n end", "def commit(msg = nil)\n require_dep! 'awesome_spawn'\n require_cmd! git_cmd\n\n in_repo { AwesomeSpawn.run \"#{git_cmd} add #{pkg_files.join(' ')}\" }\n super(msg.nil? ? \"updated to #{version}\" : msg)\n self\n end", "def apply\n #TODO: generate a better commit message\n @gl_admin.commit_index(\"Commit by gitolite gem\")\n @gl_admin.git.push({}, \"origin\", \"master\")\n end", "def git\n\tend", "def push()\n\t\tbegin\n\t\t\t@git.push('origin','master')\n\t\trescue Git::GitExecuteError => e\n\t\t\tif (e.to_s.include?(\"refspec master does not match any\"))\n\t\t\t\tLogger::log(@carpeta,Logger::INFO,\"No hay cambios para subir al servidor\")\n\t\t\telse\n\t\t\t\traise UploadException, \"Error al subir los cambios al servidor\" , caller\n\t\t\tend\n\t\tend\n\tend", "def update_github\n unless environment_is_production\n puts 'NOT updating github because environment is not production'\n return false\n end\n\n puts 'pushing database to github'\n\n @scraper_log.info \"------------------------------\"\n @scraper_log.info \"updating git\"\n @scraper_log.info \"------------------------------\"\n x = Subexec.run \"git add #{@db_dump_file} #{@status_file_name}\"\n x = Subexec.run \"git commit -m 'Updated database dump file and status.json with new hr.gov.ge data'\"\n x = Subexec.run \"git push origin master\"\nend", "def push_to_repo\n return if @remote_type == :none\n\n if @remote_type == :bitbucket\n puts 'Cannot automatically create BitBucket repository.'\n puts 'Please, open it manually at https://bitbucket.org/repo/create'\n `#{ENV['BROWSER']} https://bitbucket.org/repo/create`\n return\n end\n\n return unless %i[github].include?(@remote_type)\n\n gh_options = [\n @name,\n ]\n gh_options << '--team algolia' if @is_algolia\n\n if @is_private\n gh_options << '--private'\n else\n gh_options << '--public'\n end\n\n command = \"gh repo create #{gh_options.join(' ')}\"\n\n if command_success?(command)\n puts '✔ Creating GitHub repository'\n else\n puts '✘ Failed to create GitHub repository'\n exit 1\n end\n\n if command_success?('git push origin main')\n puts '✔ Pushed to repository'\n else\n puts '✘ Failed to push to repository'\n exit 1\n end\n end", "def push(_branch)\n puts 'TODO: Implement Git.push'\n end", "def initial_push_command\n \"git remote add origin git@github.com:#{owner.login}/#{name}.git &&\\n\" +\n \"git push origin master &&\\n\" +\n \"git config --add branch.master.remote origin &&\\n\" +\n \"git config --add branch.master.merge refs/heads/master\" \n end", "def push\n hg 'push'\n end", "def commit_to_test_proj!\n test_proj.add(full_report_path)\n result = test_proj.commit(\"#{proj_branch} #{report_name}\")\n notify.write(\"Pushing back to local repo\")\n test_proj.real_pull('origin', report_branch)\n test_proj.push('origin', report_branch)\n end", "def push_repo\n UI.puts \"\\nPushing the `#{@repo}' repo\\n\".yellow\n repo_git('push', 'origin', 'HEAD')\n end", "def commit(message)\n Dubya.logger.info \"Updating Git repository...\"\n system %(cd #{path} && git commit -am \"#{message}\" && git push)\n end", "def apply\n repo.push('origin', ['refs/heads/master'], credentials: credentials)\n end", "def git\n require 'parsedate'\n puts 'Doing local Git commit...'\n d = Time.new()\n git_comment = \"#{d}\"\n `git add ../.`\n `git commit ../. -m \"#{git_comment}\"`\nend", "def github_release_task\n sh git, 'push', '--tags', remote, remote_branch\n end", "def test_add_the_same_file_in_both_repos\n a.add(\"two\" => \"two content\").commit(\"a added two\")\n b.add(\"two\" => \"two content\").commit(\"b added two\")\n \n assert_equal \"two content\", a['two']\n assert_equal \"two content\", b['two']\n \n b.pull\n \n assert_equal \"two content\", a['two']\n assert_equal \"two content\", b['two']\n \n assert_log_equal [\n \"a added one\",\n \"a added two\", \n \"b added two\",\n \"gitgo merge of origin/gitgo into gitgo\"\n ], b\n end", "def push(repository)\n # add all files to the repository\n repository.add(all: true)\n\n # commit, but be aware: current version could be identical to previous version resulting in an error\n begin\n repository.commit('Application deployment via Nucleus')\n rescue Git::GitExecuteError => e\n # usually indicates that no files could be committed, repository is up to date\n log.debug(\"Git commit failed: #{e}\")\n end\n\n # repack to enhance compression\n repository.repack\n\n # force push, so that the push is executed even when all files remain unchanged\n repository.push('origin', @repo_branch, force: true)\n end", "def push_files(files, commit_msg, prefix)\n ui.info(\"Applying your repository changes\")\n commit_prefix = \"#{prefix}:\"\n first_add = true\n files.each do |file|\n file_path = File.expand_path(file)\n if prefix == \"db\"\n file_name = file_path.split('/').last(3).join('/')\n else\n file_name = file_path.split('/').last(2).join('/')\n end\n Dir.chdir(Chef::Config[:git_repo]) do\n if(!first_add)\n commit_prefix += \",\"\n end\n first_add = false\n commit_prefix += file_name.split('/').last\n ui.info(\"- #{file_name}\")\n git.add(\"#{file_name}\")\n end\n end\n Dir.chdir(Chef::Config[:git_repo]) do\n push(commit_prefix, commit_msg)\n end\n end", "def push_to_git\n response = @request.push_to_git\n redirect_to requests_path, response\n end", "def push\n unless system(\"cd #{repo_path};git push origin #{branch}\")\n raise GitCloud::GitException.new(\"Push\")\n end\n end", "def save\n require 'git'\n git = Git.open('.', :log => Logger.new($stdout))\n git.pull # origin master\n write_version_to_file\n git.add(Version.path)\n git.commit(\"Bump version to #{self}.\")\n git.add_tag(self.to_s)\n git.push('origin', 'master', true) # including tags\n notify_campfire(git)\n rescue LoadError\n raise LoadError, \"You must have the git gem installed to make a release.\"\n end", "def push_changes\n begin\n ui.info \"Pushing changes to repo...\"\n @git.push(@git.remote, @issue_key)\n add_comment\n rescue Git::GitExecuteError => e\n error_message = e.message.split(':').last\n ui.info error_message\n exit 1\n end\n end", "def add\n working_repo.add tree\n end", "def push_repo\n reference_point = git_branch_name || git_tag_name || 'master'\n callback(:push_repo) do\n notify(:push_repo, reference_point: reference_point, app_name: app_name, force: force)\n force_flag = force ? \"-f \" : \"\"\n system_call \"git push #{force_flag}#{deployment_remote} #{reference_point}:refs/heads/master\"\n end\n end", "def do_commit(version, push)\n cookbook_path = get_cookbook_path(@cookbook_path)\n Dir.chdir(\"#{cookbook_path}\")\n output = `git commit -a -m \"Deploy #{version}\" 2>&1`\n if $?.exitstatus != 0\n if output !~ /nothing to commit/\n Chef::Log.error(\"Could not commit #{@cookbook_name}\")\n puts output\n exit 1\n end\n end\n if push\n output = `git push --tags 2>&1`\n if $?.exitstatus != 0\n Chef::Log.error(\"Could not push tag for: #{@cookbook_name}\")\n exit 1\n end\n output = `git push 2>&1`\n end\n end", "def stage_all\n command = 'git add --all'\n command_success?(command)\n end", "def push!\n notify.write(\"Pushing to origin\")\n proj.push('origin', proj_branch)\n proj.push('origin', report_branch)\n end", "def commit_git_changes\n Dir.chdir(@repository_path) do\n status = @repo.status\n\n # Only add if we have untracked files\n if status.untracked.size > 0\n puts \"Adding new files to the repository...\"\n @repo.add(@repository_path + '/*')\n end\n\n commit_result = @repo.commit_all(\"Updating files\")\n\n # Attempt to push if anything was committed and we have a remote repo\n if commit_result !~ /working directory clean/\n if @remote\n puts \"Pushing repository changes...\"\n @repo.git.native(:push, {}, @remote, @branch)\n end\n else\n puts \"No changes committed.\"\n end\n end\n end", "def save_to_git\n FileUtils.makedirs File.dirname(blob_path(false)) unless File.exists? File.dirname(blob_path(false))\n File.open(blob_path(false), 'w') do |file|\n file.write to_yaml_git\n end\n if (repository.tree/blob_path).nil?\n add_blob\n end\n end", "def add_remote_files?(branch, add_remote_files_info)\n return if add_remote_files_info.nil?\n checkout(branch) do \n add_remote_files_info.add_files(git_repo_manager: self, branch: branch)\n end\n add_all_files_and_commit(branch: branch) if add_remote_files_info.git_add_needed?\n end", "def commit\n @git = YMDP::GitHelper.new\n @git.do_commit(@message)\n @git_hash = git.get_hash(options[:branch]) \n end", "def test_add_existing_file\n @gitit.add('hello.txt', 'Hello, dsyph3r')\n @gitit.commit('modifying hello world')\n\n file = @gitit.get_file('hello.txt')\n\n assert_not_nil(file)\n\n assert_equal('Hello, dsyph3r', file['data'], 'File data is incorrect')\n end", "def commit\n\t$VP.join('.git/refs/heads/master').read[0..8] rescue nil\nend", "def commit(author, message)\n GIT.add relative_path\n GIT.commit message, :author => \"#{ author.name } <#{ author.email }>\"\n end", "def repo_commit(msg)\n git :add => '-u'\n git :add => '.'\n git :commit => \"-m \\\"#{msg}\\\"\" \n end", "def call(path: Dir.pwd)\n git = git_open(path)\n return @error unless git\n\n remote = git.remotes.find { |r| r.name == @config['source_name'] }\n remote ||= git_remote_add(git)\n return @error unless remote\n\n return @error unless git_remote_update(remote)\n\n { success?: true }\n end", "def deploy!\n puts \"Adding and committing compiled output for deployment..\"\n puts %x[git add .]\n puts %x[git commit -a -m \"temporary commit for deployment\"]\n puts 'Deploying to Github pages..'\n puts %x[git push origin HEAD:gh-pages --force]\nend", "def upload!(file_path)\n raise GitCloud::FileException.new(\"NotFound\") unless File.exists? file_path\n file = File.new(File.expand_path(file_path))\n add(file)\n commit\n push\n end", "def deploySource\n verifyOS\n timeDate = Time.new\n vConfig(CONFIG['configWebsite'])\n read_json(CONFIG['configWebsite'])\n branchSource = @parse_json_config['deploy']['branch']['source']\n msgCommit = @parse_json_config['deploy']['github']['config']['commit']\n add_repo_git(\".\")\n add_remoteurl(\".\")\n pull_execute(branchSource, \".\")\n git_checkout(branchSource, \".\")\n system_commands(\"echo Deploy source files. Wait ...\")\n system_commands(\"git add .\")\n system_commands(\"git commit -m \\\"#{msgCommit} - #{timeDate.inspect}\\\"\")\n system_commands(\"git push origin -u #{branchSource}\")\n end", "def commit_and_push_to_repo(oauth_token, commit_message, \n tree_sha, head_sha, ref_name)\n client = Octokit::Client.new(access_token: oauth_token)\n sha_new_commit = client.create_commit(full_repo_name, commit_message, tree_sha, head_sha)[:sha]\n client.update_ref(full_repo_name, ref_name, sha_new_commit)\n end", "def commit_changes(description)\n git :add => '-A'\n git :commit => %Q(-qm \"thegarage-template: [#{@current_recipe}] #{description}\")\nend", "def push(remote_repo = remote, remote_branch = current_branch)\n git 'push', remote, current_branch\n end", "def push(remote_repo = remote, remote_branch = current_branch)\n git 'push', remote, current_branch\n end", "def deploy!\n puts \"Adding and committing compiled output for deployment..\"\n puts %x[git add .]\n puts %x[git commit -a -m \"temporary commit for deployment\"]\n puts 'Deploying to Heroku..'\n puts %x[git push heroku HEAD:master --force]\nend", "def deploy!\n puts \"Adding and committing compiled output for deployment..\"\n puts %x[git add .]\n puts %x[git commit -a -m \"temporary commit for deployment\"]\n puts 'Deploying to Heroku..'\n puts %x[git push heroku HEAD:master --force]\nend", "def save message\n Dir.chdir @root do\n cmd = \"git add --all && git commit -m \\\"#{message}\\\"\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n if /nothing to commit/.match stdout\n raise NothingToCommitError\n elsif /Not a git repository/.match stderr\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n end\n end", "def add_blob\n repository.add(blob_path)\n end", "def commit(m)\n git(:add => '.')\n git(:commit => \"-a -m 'Rails Template Commit: #{m}'\")\nend", "def git_push_if_changes( names ) ## optenfootball repo names e.g. world, england, etc.\n message = \"auto-update week #{Date.today.cweek}\"\n puts message\n\n names.each do |name|\n path = \"#{SportDb::Boot.root}/openfootball/#{name}\"\n\n Gitti::GitProject.open( path ) do |proj|\n puts ''\n puts \"###########################################\"\n puts \"## trying to commit & push repo in path >#{path}<\"\n puts \"Dir.getwd: #{Dir.getwd}\"\n output = proj.changes\n if output.empty?\n puts \"no changes found; skipping commit & push\"\n else\n proj.add( '.' )\n proj.commit( message )\n proj.push\n end\n end\n end\nend", "def add(path, param=File.split(path).last)\n unless self.has_repo?(param)\n begin\n list << Repo.new(path)\n rescue Rugged::RepositoryError\n logger.warn \"SKIPPING '#{path}' - not a git repository\"\n end\n end\n list\n end", "def git_commit(message)\n yield\n git add: '.'\n git commit: %{ -m #{message.inspect} }\n end", "def commit_and_tag(new_version)\n git = Git.init\n git.add([VERSION_FILE, \"Gemfile.lock\"])\n git.commit(\"Update to #{new_version}\")\n git.add_tag(new_version.to_s)\n end", "def image_commit(project, imagefile)\n if logged_in?\n commit project.path, imagefile.original_filename, imagefile.read, \"Add new file #{imagefile.original_filename}.\" \n end\n end", "def add_file(*args)\n context = args.pop\n file_path_hash_or_string, content, commit_msg = args\n file_path_hash = file_path_hash_form(file_path_hash_or_string)\n get_adapter_repo(context).add_file(file_path_hash, content, commit_msg)\n end", "def git_push(*remotes)\n remotes.each do |remote|\n git(:push => \"#{remote} master\")\n end\n end", "def commit_and_tag(bump_info)\n @logger.log '===> executing commands'\n @command.exec 'git add .'\n @command.exec \"git commit -m '#{bump_info.commit_message}'\"\n @command.exec \"git tag v#{bump_info.after_version}\"\n end", "def commit_modified_files_task\n really_modified = `#{git} ls-files -m #{modified_files.entries.join(' ')}`.split(\"\\n\")\n if really_modified.any?\n really_modified.each { |file| sh git, 'add', file }\n sh git, 'commit', '-m', \"Released #{gemspec.name} gem version #{gemspec.version}.\"\n end\n end", "def update\n Repository.new(self).add_git_remote\n Hook.new(self).setup\n end", "def create_git_tag\n assignment_repository.write do |git|\n git.add_tag git_tag\n end\n end", "def push_blob(item)\n Worochi::Log.debug \"Uploading #{item.path} (#{item.size} bytes) to GitHub...\"\n if item.size > options[:block_size]\n sha = stream_blob(item)\n else\n sha = @client.create_blob(repo, Base64.strict_encode64(item.read),\n 'base64')\n end\n Worochi::Log.debug \"Uploaded [#{sha}]\"\n sha\n end", "def git_commit_all message\n system \"git add --all .\"\n return false unless $?\n system \"git commit -q -m '#{message.gsub(/'/, \"\\'\")}'\"\n return $?\nend", "def commit\n head.commit\n end", "def git_push(remote = 'origin')\n mysystem(\"git push --set-upstream #{remote} #{git_current_branch}\")\n end", "def add(file)\n # add file to object db\n return false if !File.exists?(file)\n return false if !File.file?(file)\n \n sha = get_raw_repo.put_raw_object(File.read(file), 'blob')\n \n # add it to the index\n @git_index.add(file, sha)\n end", "def save(message)\n to_be_added = pending_changes.select{|f|\n f.untracked && f.type.nil?\n }\n git.add(git_opts, *to_be_added.map{|f| f.path})\n git.commit(git_opts(), '-a', '-m', message)\n self\n end", "def commit(name, message)\n git = git(name)\n\n git.config('user.name', GIT_AUTHOR[:name])\n git.config('user.email', GIT_AUTHOR[:email])\n\n git.add(all: true)\n git.commit(message)\n end", "def add_file entry, content = nil\n path = repo_path.join entry\n dir, filename = path.split unless entry.end_with? \"/\"\n\n FileUtils.mkdir_p dir.to_s == '.' ? repo_path : dir\n FileUtils.touch path if filename\n File.write path, content if filename && content\n end", "def do_hook(c)\n sp = c[\"head_commit\"][\"message\"].split \"#\"\n taskid = sp[-1].to_i\n da_task = self.tasks.find(taskid)\n\n if da_task then\n commit = Commit.new\n commit.author_email = c[\"head_commit\"][\"author\"][\"email\"]\n commit.author_name = c[\"head_commit\"][\"author\"][\"name\"]\n commit.message = c[\"head_commit\"][\"message\"]\n commit.url = c[\"head_commit\"][\"url\"]\n commit.sha = c[\"head_commit\"][\"id\"]\n commit.date = c[\"head_commit\"][\"timestamp\"]\n commit.task_id = taskid\n commit.save\n end\n end", "def git_add_all\n index.add_all\n index.write\n end", "def git_add_all\n index.add_all\n index.write\n end", "def push\n if @tags.empty?\n gash.send(:git, 'push', @push_to, @refspec)\n else\n gash.send(:git, 'push', '--tags', @push_to, @refspec)\n end\n end", "def git_remote_add(remote_name, remote_url)\n cmd = \"#{discover_git_executable} remote add upstream \\\"#{remote_url}\\\"\"\n debug \"Running #{cmd} 2>&1\"\n output = %x[#{cmd} 2>&1]\n raise RHC::GitException, \"Error while adding upstream remote - #{output}\" unless output.empty?\n end", "def push(remote)\n namehost, folder, _barefolder = split_url(remote.name)\n puts 'simple_push'\n simple_push(remote('origin'))\n puts 'bare_repo.push'\n bare_repo.push(remote)\n try_system %[ssh #{namehost} \"cd #{folder} && git pull origin\"]\n end", "def push(arg='')\n `git push #{arg} 2>&1`\n end", "def github_push(payload)\n\n pushType = payload[\"repository\"][\"full_name\"].split(\"/\")[1].split(\"-\")[0]\n if pushType == \"assignment\"\n TestGraderWorker.perform_async(payload)\n end\n\n org = payload[\"repository\"][\"organization\"]\n repo = payload[\"repository\"][\"name\"]\n repo_array = repo.split(\"-\")\n\n project_name = repo_array[0]\n type = repo_array[1]\n user = repo_array[2]\n\n expected_repo = \"#{org}/#{project_name}-expected\" \n student_repo = \"#{org}/#{project_name}-#{user}\"\n grade_repo = \"#{org}/#{project_name}-grade\"\n #results_repo = \"#{org}/#{project_name}-results-#{type}\"\n\n organization = Organization.new.github_client\n case type\n when \"grader\"\n if not organization.repository?(expected_repo)\n organization.create_repository(\n \"#{project_name}-expected\", organization: org, auto_init: true)\n end\n when \"expected\"\n when \"grade\"\n #when \"results\"\n # if not organization.repository?(grade_repo)\n # organization.create_repository(\n # \"#{project_name}-grade\", organization: org, auto_init: true)\n # end\n else\n if not organization.repository?(grade_repo)\n organization.create_repository(\n \"#{project_name}-grade\", organization: org, auto_init: true)\n end\n end\n\tend", "def push(builder)\n $stderr.puts Simple::Ansi.green(\n \"Pushing: #{builder.repo}\"\n )\n end" ]
[ "0.74996376", "0.7490692", "0.7366128", "0.73059666", "0.71267414", "0.70548695", "0.6877391", "0.686325", "0.68610436", "0.68302304", "0.68216634", "0.67689955", "0.67466503", "0.6706065", "0.66989535", "0.66948366", "0.66817766", "0.6666706", "0.66021025", "0.6581492", "0.6573023", "0.65586203", "0.6528536", "0.6513258", "0.6486084", "0.6482083", "0.6471595", "0.64435774", "0.64097387", "0.6402445", "0.634611", "0.63295", "0.6326148", "0.6301309", "0.6297802", "0.6261232", "0.62447923", "0.6234681", "0.6232473", "0.6223129", "0.6214056", "0.61985725", "0.6190313", "0.6190245", "0.618992", "0.61778617", "0.6177473", "0.6168648", "0.615485", "0.6153815", "0.61457425", "0.6137369", "0.61326796", "0.6131133", "0.6130423", "0.6127456", "0.61112463", "0.61011016", "0.60855365", "0.6085114", "0.6084081", "0.6077605", "0.6054487", "0.6040805", "0.6039903", "0.60244864", "0.6015719", "0.6015719", "0.6009989", "0.6009989", "0.59820634", "0.5979791", "0.595044", "0.59320235", "0.5923933", "0.5919812", "0.5917463", "0.5908391", "0.5877719", "0.5864112", "0.58632535", "0.58613455", "0.58524394", "0.5849048", "0.5829343", "0.5823579", "0.5813792", "0.5812711", "0.5809179", "0.58080095", "0.5804501", "0.5796512", "0.5778678", "0.5778347", "0.5772787", "0.5771518", "0.5770924", "0.5762653", "0.57566035", "0.57548624", "0.57447463" ]
0.0
-1
Blank fields become empty strings instead of nil.
def add_converter_for_blank_fields CSV::Converters[:blank] = lambda { |s| s || '' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_blank_strings\n attributes.each do |column, value|\n self[column] = nil if value.is_a? String and value.blank?\n end\n end", "def blank_out_fields(record, fields)\n fields.to_a.each do |field|\n record[field.to_sym] = '' if record[field.to_sym].nil?\n end\n record\n end", "def convert_blank_to_nil\n all_fields = self.get_array_of_symbolic_keys\n # updating record's field with nil for blank values\n all_fields.each do |field|\n if self[field].blank?\n self[field] = nil;\n end\n end\n end", "def nullify_fields\n user_fields = %W(\n name\n email\n address\n )\n\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = nil if self[field].empty?\n end\n end", "def empty_to_null\n attributes_before_type_cast.each do | key, value |\n write_attribute(key, nil) if value.kind_of?( String ) && value.empty?\n end\n end", "def nullify_fields\n user_fields = %W(\n comment\n )\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = nil if self[field].empty?\n end\n end", "def normalize_blank_values\n attributes.each do |column, value|\n self[column].present? || self[column] = nil\n end\n end", "def nil_blank_values\n\t\tself.description = nil if !self.description.nil? && self.description.blank?\n\t\tself.creator = nil if !self.creator.nil? && self.creator.blank?\n\tend", "def compact_blank; end", "def sql_null_to_blank\n self.map {|v| \"IFNULL(#{v}, '')\" }\n end", "def nullify_blanks\n self.author = nil if author.blank?\n end", "def transform_empty_to_nil stringVal\n stringVal = nil unless stringVal.nil? || stringVal.length > 0\n stringVal\n end", "def compact_blank!; end", "def trim_all_fields\n self.attributes.each{|a| a.strip! if a.class == 'String'}\n end", "def replace_nil_to_blank(data)\n data[data.index(nil)] = BLANK_CUSTOMER_OR_PACK_SIZE_NAME if data.index(nil)\n data[data.index('')] = BLANK_CUSTOMER_OR_PACK_SIZE_NAME if data.index('')\n data\n end", "def strip_blanks\n STRIP_ATTRS.each { |attr| self[attr] = self[attr].strip if !self[attr].blank? }\n end", "def compact_blank\n reject { |_k, v| v.blank? }\n end", "def compact_blank!\n reject! { |_k, v| v.blank? }\n end", "def empty_lines_to_nulls\n job.log 'replace empty strings by nulls?'\n column_id = column_name.to_sym\n column_type = nil\n db.schema(table_name).each do |colid, coldef|\n if colid == column_id\n column_type = coldef[:type]\n end\n end\n if column_type != nil && column_type == :string\n #TODO: @capture_exceptions\n job.log 'string column found, replacing'\n QueryBatcher.new(\n db, \n job, \n create_seq_field = true\n ).execute_update(\n %Q{\n UPDATE #{qualified_table_name}\n SET #{column_name}=NULL\n WHERE #{column_name}=''\n },\n schema, table_name\n )\n else\n job.log 'no string column found, nothing replaced'\n end\n end", "def clear_value_if_empty\n write_attribute(:value, nil) if self.value.is_a?(String) && self.value.empty?\n end", "def weed_nils\n subject.reject! { |s| s == \"\" } if subject.present?\n end", "def strip_blanks!\n @content.reject! { |item| item[:type] == :blank }\n end", "def remove_empty_fields\n self.each_pair do |k, v|\n if self[k].class == Hash\n self[k] = self[k].remove_empty_fields\n else\n self.delete(k) if v.to_s == \"\"\n end\n end\n self\n end", "def strip_blanks\n self.title = self.title.strip\n self.code = self.code.strip\n self.complement_title = self.complement_title.strip\n end", "def empty2nil(value)\n value unless value.is_a?(String) && value.empty? && !value.nil?\n end", "def assemble(values)\n if allow_blank\n values\n else\n values.delete_if(&:blank?)\n end\n end", "def strip_string_fields\n all_fields = self.get_array_of_symbolic_keys\n # stripping\n all_fields.each do |field|\n unless self[field].nil?\n if self[field].class == String\n self[field] = self[field].strip\n end\n end\n end\n end", "def effectively_empty( value )\n value.nil? || value.to_s.empty?\n end", "def empty_unused_fields\n if @publication.scientific_article?\n # Empty fields specific to categories other than scientific_article\n @publication.book_title = ''\n @publication.book_authors = ''\n @publication.book_publisher = ''\n @publication.url = ''\n else\n # Empty fields specific to scientific_article\n @publication.journal_id = 0\n @publication.new_journal_name = ''\n @publication.DOI = ''\n @publication.volume = ''\n @publication.issue = ''\n @publication.pages = ''\n unless @publication.chapter?\n # Empty fields specific to book_chapter\n @publication.book_title = ''\n @publication.book_authors = ''\n end\n end\n end", "def empty_lines_to_nulls\n # first timeout crash\n job.log 'replace empty strings by nulls?'\n column_id = column_name.to_sym\n column_type = nil\n db.schema(table_name).each do |colid, coldef|\n if colid == column_id\n column_type = coldef[:type]\n end\n end\n if column_type != nil && column_type == :string\n #TODO: @capture_exceptions\n job.log 'string column found, replacing'\n @user.db_service.in_database_direct_connection(statement_timeout: DIRECT_STATEMENT_TIMEOUT) do |user_direct_conn|\n user_direct_conn.run(%Q{\n UPDATE #{qualified_table_name}\n SET \"#{column_name}\"=NULL\n WHERE \"#{column_name}\"=''\n })\n end\n else\n job.log 'no string column found, nothing replaced'\n end\n end", "def concat_null(fields) # :nodoc:\n @concat.gsub(/\\%s/, subs(@nul, fields).join(','))\n end", "def strip_blanks\n self.title = self.title.strip\n self.unit = self.unit.strip\n end", "def null_controlled_fields!(attrs)\n ::ScoobySnacks::METADATA_SCHEMA.controlled_field_names.each do |field_name|\n # do not null fields that are not being changed\n next unless attrs.keys.include?(\"#{field_name}_attributes\")\n\n object.public_send(\"#{field_name}=\", [])\n end\n end", "def drop_blanks!\n\t\tdelete_if{|a|a.blank?}\n\tend", "def empty!\n self.replace(\"\")\n end", "def remove_blank_contacts\n self.details = details.select { |cd| !cd.value.blank? }\n end", "def filterout_empty_string_and_nil\n @scopes_hash.delete_if { |scope, arg| [\"\", nil].include? @formobj[scope] }\n end", "def clean_data( field )\n\tfield.to_s.strip\nend", "def blank_to_nil_params\n record_params.merge!(record_params){|k, v| v.blank? ? nil : v}\n end", "def nil_if_blank\n NULL_ATTRS.each { |attr| self[attr] = nil if self[attr].blank? }\n end", "def method_empty_first_name\n @first_name ||= '' #Equivalent to @first_name = '' unless @first_name and @first_name || ''\n @first_name\nend", "def nil_blank(array)\n if ( array.include?(nil) ) #replace nil with empty string\n array.map! {|e| e ? e : \"\"}\n end\n return array\n end", "def strip_blanks\n self.title = self.title.strip\n self.code = self.code.strip\n end", "def set_value_if_nil(field_type)\n case field_type\n when \"b\", :boolean: return \"false\"\n when \"s\", \"t\", \"d\", :date, :string, :text: return \"\"\n when \"f\", \"rf\", :float, :range_float: return 0.00\n when \"i\", \"ri\", :integer, :range_integer: return 0\n else\n return \"\"\n end\n end", "def _blank?(value)\n value.nil? || value == ''\n end", "def nil_if_empty(value)\n value = value.strip\n return nil if value.empty?\n return value\n end", "def blank?\n to_s.blank?\n end", "def strip_spaces \n # these are conditionalized because it is called before the validation\n # so the validation will make sure they are setup correctly\n if self.first_name? then self.first_name.strip! end \n if self.last_name? then self.last_name.strip! end \n if self.login? then self.login.strip! end \n if self.email? then self.email.strip! end \n end", "def empty?()\n fields.empty?\n end", "def optionalize\n without_values(nil)\n end", "def clear_default_fields\n reset_cleared_default_fields\n self.default_fields.each do |k, v|\n if respond_to?(\"#{k}=\") && unescape(self.send(\"#{k}\")) == unescape(v)\n add_to_cleared_default_fields(k, self.send(\"#{k}\")) and self.send(\"#{k}=\", \"\")\n end\n end\n end", "def blank_out\n\t\tself.write_attribute(:value, nil )\n\tend", "def nilOrEmpty(data, alt)\n \t\tif data == nil || data.length == 0\n \t\t\talt\n \t\telse\n \t\t\tdata\n \t\tend\n \tend", "def cleanup\n self.city = capwords(city) if (attribute_present?('city') && (self.city != nil))\n self.state = state.upcase if (attribute_present?('state') && (self.state != nil))\n self.street = street.split(\" \").map{|x| x.capitalize}.join(\" \") if (attribute_present?('street') && (street != nil))\n self.street_2 = street_2.split(\" \").map{|x| x.capitalize}.join(\" \") if (attribute_present?('street_2') && (street_2 != nil))\n self.phone = phone.split(\"-\").join(\"\").split(\".\").join(\"\") if (attribute_present?('phone') && (phone != nil))\n self.first_name = capwords(first_name) if (attribute_present?('first_name') && (first_name != nil))\n self.last_name = capwords(last_name) if (attribute_present?('last_name') && (last_name != nil))\n end", "def normalize_blank_assigned_form_types\n # Nil any blank elements from the list\n self.form_type_ids = self.form_type_ids.collect! {|ftid| ftid == \"\" ? nil : ftid }\n # Remove the nil elements\n self.form_type_ids.compact!\n end", "def blank?\n self.strip.empty?\n end", "def blank?(object)\n object.to_s.sub(/\\s+/, '') == ''\n end", "def clean!\r\n reject!(&:blank?)\r\n map!(&:strip)\r\n uniq!\r\n end", "def get_text(value, id, field, *args)\n opt = args.extract_options!\n value = value.to_s\n if value.eql?(\"\")\n msg = \"#{field} doit ne doit pas etre nul\"\n if (opt[:if_null].eql?(:error)) # generate an error if value == ''\n add_invalid(msg, id)\n nil\n elsif (opt[:if_null].eql?(:warning)) # generate an invalid if value == ''\n add_warning(msg, id)\n nil\n end\n end\n value\n end", "def blank_to_nil_params\n params[:nyucore].merge!(params[:nyucore]){|k, v| v.blank? ? nil : v.is_a?(Array) ? v.reject{|c| c.empty? } : v}\n end", "def skip_blanks?() @skip_blanks end", "def extract_nonblanks(str)\n Types.check( binding, { :str => ComposedString } )\n\n str.gsub(/(.*)/) do |text|\n NonBlank.new(text)\n end\n end", "def set_null(params)\n params == \"NA\" ? \"null\" : params\n end", "def blank?\n true\n end", "def blank?\n true\n end", "def blank?\n true\n end", "def singleq2null\n self.gsub(\"'\", '%00%27')\n end", "def nil_values(the_input, nil_keys_array = Array.new)\n the_input.select { |_, v| v.blank? }.each_key do |key|\n nil_keys_array << key.to_s\n end\n raise K2EmptyParams.new(nil_keys_array) unless nil_keys_array.blank?\n end", "def set_title_and_description_to_nil_if_blank\n self.title = nil if title.blank?\n self.description = nil if description.blank?\n end", "def leave_blank_name\n fill_in('name', :with => '')\nend", "def fix_nil_time_values\n if params[:response] && params[:response][:answers_attributes]\n params[:response][:answers_attributes].each do |key, attribs|\n if attribs[\"time_value(4i)\"].blank? && attribs[\"time_value(5i)\"].blank?\n %w[1 2 3].each { |i| params[:response][:answers_attributes][key][\"time_value(#{i}i)\"] = \"\" }\n end\n end\n end\n end", "def normalize(field)\n case field\n when \"true\" then true\n when \"false\" then false\n when \"\" then nil\n when \"null\" then nil\n else field\n end \n end", "def normalize(field)\n case field\n when \"true\" then true\n when \"false\" then false\n when \"\" then nil\n when \"null\" then nil\n else field\n end \n end", "def defaults_str\n \"\"\n end", "def blank?(value)\n value.nil? || value.to_s.empty?\n end", "def sanitize_input\n\t\t# to remove whitespace, use \n\t\t# self.<fieldname>.strip!\n\t\tself.homephone = self.homephone.gsub(/\\D/,'') if !self.homephone.blank?\n\t\tself.workphone = self.workphone.gsub(/\\D/,'') if !self.workphone.blank?\n\t\tself.cellphone = self.cellphone.gsub(/\\D/,'') if !self.cellphone.blank?\n\t\tself.fax = self.fax.gsub(/\\D/,'') if !self.fax.blank?\n\t\tself.prefcontactmethod = :Email if self.prefcontactmethod.blank?\n #\t\tself.email = self.email.downcase if self.email.present?\n\tend", "def clean!\n reject!(&:blank?)\n map!(&:strip)\n uniq!\n end", "def check_blank_patient_name(value)\n value.upcase.eql?('NONE') ? '' : value\n end", "def blank?\n false\n end", "def blank?\n false\n end", "def blank?\n false\n end", "def empty?\n @fields.empty?\n end", "def extract_blanks(str)\n Types.check( binding, { :str => ComposedString } )\n\n str.gsub(/(__(?:.*?)__)/) do |fragment|\n create_blank(fragment[2..-3])\n end \n end", "def process_value(value)\n if value.nil? || value.text.strip == ''\n nil\n else\n value.text.strip\n end\nend", "def normalize(field)\n case field\n when \"true\" then true\n when \"false\" then false\n when \"\" then nil\n when \"null\" then nil\n else field\n end\n end", "def initialize_fields\n terms_for_editing.each do |key|\n # if value is empty, we create an one element array to loop over for output \n self[key] = [''] if self[key].empty?\n end\n end", "def blanks\n self.blank.split('-')\n end", "def strip_empty_space\n self.title = title.strip if self.title\n self.preview = preview.strip if self.preview\n self.content = content.strip if self.content\n end", "def replace_null(value)\n return 'U' if value.nil?\n\n value\nend", "def set_email_to_nil_if_blank\n self.email = nil if email.blank?\n end", "def empty? t\n !t ? true : clean(t).gsub(' ','') == ''\nend", "def is_blank? item\n\titem.nil? || item.gsub(/\\s+/, \"\").empty?\nend", "def handle_empty_arrays\n @fields = {}.with_indifferent_access if @fields.length == 0\n @link_fields = {}.with_indifferent_access if @link_fields.length == 0\n end", "def handle_empty_arrays\n @fields = {}.with_indifferent_access if @fields.length == 0\n @link_fields = {}.with_indifferent_access if @link_fields.length == 0\n end", "def nil_address\n self.address_line1 = nil\n self.address_line2 = nil\n self.locality = nil\n self.county = nil\n self.country = nil\n self.postcode = nil\n end", "def blank?\n self.nil? || self.empty?\n end", "def strip_columns\n user_fields = %W(\n name\n email\n address\n )\n\n user_fields.each do |field|\n next if self[field].nil?\n self[field] = self[field].strip\n end\n end", "def missing_default_forged_as_empty_string?(default)\n type != :string && ! null && default == ''\n end", "def replace_empty(key, params, empty_str)\n params[key] = empty_str if [nil, '', '-'].include?(params[key])\n return params\n end", "def format_text(text, empty=\"Unknown\")\n text.blank? ? empty : text\n end" ]
[ "0.7942835", "0.77611476", "0.76865566", "0.7645719", "0.76156867", "0.7399313", "0.7228484", "0.7165962", "0.70984197", "0.70372784", "0.7016981", "0.70122755", "0.7003285", "0.6976444", "0.6932037", "0.6801326", "0.67795086", "0.6760287", "0.67593765", "0.67562544", "0.66957784", "0.66861105", "0.66559833", "0.6648424", "0.6548269", "0.65371805", "0.6535088", "0.6520502", "0.6515559", "0.65027785", "0.6499917", "0.64637387", "0.6456553", "0.6453556", "0.6439666", "0.64277595", "0.64165664", "0.64040464", "0.63555473", "0.6352957", "0.63362306", "0.6289532", "0.6264346", "0.6256181", "0.6254952", "0.62205744", "0.61991423", "0.61836296", "0.61687213", "0.61525095", "0.6145053", "0.61415154", "0.612093", "0.6095755", "0.6086384", "0.6083846", "0.60838336", "0.60552657", "0.6051037", "0.6048276", "0.6048204", "0.602689", "0.60231566", "0.60199463", "0.60199463", "0.60199463", "0.6015407", "0.6008538", "0.60072005", "0.6006915", "0.6004693", "0.6002097", "0.6002097", "0.5998373", "0.59861755", "0.5980645", "0.5975727", "0.5963489", "0.59496516", "0.59496516", "0.59496516", "0.5942825", "0.5934182", "0.59299964", "0.59284693", "0.5927027", "0.59072435", "0.58953595", "0.58780116", "0.58776706", "0.58686304", "0.58643657", "0.58591056", "0.58591056", "0.5846247", "0.5845586", "0.58415383", "0.5841247", "0.5830891", "0.5829253" ]
0.6936711
14
GET /discounts GET /discounts.json
def index @discounts = Discount.where(pricing_id: params[:id]).order(id: :desc) @pricings=Pricing.find(params[:id]) @discount_types=DiscountType.all @catalog_items=Catalog.where(pricing_id: params[:id],checked: true) @groups=Group.where(pricing_id: params[:id]) @resolution=ItemList.all # puts @catalog_items.as_json @array=@catalog_items.uniq.pluck(:item_list_id) @array1=@catalog_items.where(catalog_type: 'Custom').uniq.pluck(:id) puts @array @list_item_id_array = @array.sort{|a,b| a && b ? a <=> b : a ? -1 : 1 } # puts @list_item_id_array @discount_offer_types=DiscountOfferType.all @discount=Discount.new @discount_offers=DiscountOffer.all @discount_items_lists=DiscountItemsList.all @discount_groups_list=DiscountGroupsList.all @discount_bsgs_buy_items=DiscountBsgsBuyItem.all @discount_bsgs_get_items=DiscountBsgsGetItem.all @discount_cart_values=DiscountCartValue.all @package_discounts=PackageDiscount.where(discount_id: @discount.id) @package_discount_items=PackageDiscountItem.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @store = Store.find(params[:store_id])\n @dish_discounts = @store.dish_discounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_discounts }\n end\n end", "def discounts\n @discounts ||= hash[\"Discounts\"].map { |d| Merchant::Discount.new d }\n end", "def index\n @discounts = Discount.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @discounts }\n end\n end", "def discounts\n @discounts ||= [product.dig(:discounts, :item)].flatten(1).compact\n end", "def show\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish_discount }\n end\n end", "def index\n @dislike_counts = DislikeCount.all\n end", "def index\n @admin_discounts = Admin::Discount.all\n end", "def index\n @discounts_products = DiscountsProduct.all\n end", "def index\n @discounts = Discount.desc(:created_at).includes(:orders)\n if params[:discount_token].present?\n @discounts = @discounts.where(token: /.*#{params[:discount_token]}.*/)\n end\n if params[:name].present?\n @discounts = @discounts.where(name: /.*#{params[:name]}.*/)\n end\n if request.format.csv?\n render json: {status: :bad_request} if !params[:name].present?\n else\n @discounts = @discounts.page(params[:page])\n end\n respond_to do |format|\n format.html {\n }\n format.csv {\n csv_data = CSV.generate({}) do |csv|\n csv << [I18n.t(:discount_num), I18n.t(:name), I18n.t(:discount_percent), I18n.t(:expire_date), I18n.t(:service_types),I18n.t(:available_times),I18n.t(:total_times)]\n @discounts.each do |d|\n csv << [d.token, d.name, d.percent, d.expire_date, d.service_types.map{|s| s.name}.join(','), d.available_times, d.times]\n end\n end\n headers['Last-Modified'] = Time.now.httpdate\n send_data csv_data, :filename => (params[:name] || I18n.l(DateTime.now)) + '.csv'\n }\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 @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 index\n authorize! :read, Discharge\n @discharges = Discharge.all\n end", "def show\n @discount = Discount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @discount }\n end\n end", "def get_deals_count\r\n # the base uri for api requests\r\n query_builder = Configuration::BASE_URI.dup % [@version]\r\n\r\n # prepare query string for API call\r\n query_builder << \"/deals/count\"\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"APIMATIC 2.0\",\r\n \"accept\" => \"application/json\",\r\n \"X-Api-Key\" => @x_api_key\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers:headers\r\n\r\n #Error handling using HTTP status codes\r\n if !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def index\n @discs = Disc.all\n end", "def disc(id)\n get(\"/catalog/titles/discs/#{id.to_s}\")\n end", "def list_discounts_with_http_info(location_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1ItemsApi.list_discounts ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1ItemsApi.list_discounts\" if location_id.nil?\n # resource path\n local_var_path = \"/v1/{location_id}/discounts\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<V1Discount>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1ItemsApi#list_discounts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def credit\n handle_response(get(\"/credit.json\"))\n end", "def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end", "def index\n @quantity_discounts = QuantityDiscount.find(:all).paginate :per_page => 10, :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @quantity_discounts }\n end\n end", "def get_disputes(opts = {})\n data, _status_code, _headers = get_disputes_with_http_info(opts)\n data\n end", "def destroy\n @discount = Discount.find(params[:id])\n @discount.destroy\n\n respond_to do |format|\n format.html { redirect_to discounts_url }\n format.json { head :no_content }\n end\n end", "def index\n @discount_activities = DiscountActivity.all\n end", "def destroy\n @discount = Discount.find(params[:id])\n @discount.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_discounts_url }\n format.json { head :no_content }\n end\n end", "def new\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dish_discount }\n end\n end", "def show\n @cash_dispense = CashDispense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @cash_dispense }\n\n ret = \"\"\n val = 0\n @cash_dispense.calculate_break_down.each_with_index do |dom,index| \n if dom.size > 0 \n ret += \"#{dom.count} x #{CashDispense::DENOMINATIONS[index]}\\n\" \n val += (dom.count * CashDispense::DENOMINATIONS[index])\n end # if \n end # each \n\n ret += \"\\n#{val}\"\n\n format.json { render json: ret }\n\n end\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end", "def index\n @consents = Consent.all\n render json: @consents\n end", "def index\n authorize Donate\n @donates = Donate.order('id DESC').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @donates }\n end\n end", "def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charges }\n end\n end", "def index\n @disabilities = Disability.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disabilities }\n end\n end", "def index\n @title=\"Listing Discharges\"\n @discharges = Discharge.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @discharges }\n end\n end", "def get_disputes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_disputes ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DisputesApi.get_disputes, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling DisputesApi.get_disputes, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'skip'].nil? && opts[:'skip'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"skip\"]\" when calling DisputesApi.get_disputes, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/disputes'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'statuses'] = opts[:'statuses'] if !opts[:'statuses'].nil?\n query_params[:'payment_id'] = opts[:'payment_id'] if !opts[:'payment_id'].nil?\n query_params[:'payment_reference'] = opts[:'payment_reference'] if !opts[:'payment_reference'].nil?\n query_params[:'payment_arn'] = opts[:'payment_arn'] if !opts[:'payment_arn'].nil?\n query_params[:'this_channel_only'] = opts[:'this_channel_only'] if !opts[:'this_channel_only'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'DisputePaged'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.get_disputes\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DisputesApi#get_disputes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def credit\n handle_response(self.class.get(\"/credit.json\"))\n end", "def index\n if params[:news_id]\n @news = News.find(params[:news_id])\n @discusses = @news.discusses\n else\n @discusses = Discuss.all\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discusses }\n end\n end", "def index\n @purchases = Purchase.where(user_id: get_current_user.id.to_i)\n\n render json: @purchases\n end", "def show\n @discount = Discount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discount }\n end\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def discount\n params['discount']\n end", "def index\n return if !current_user.admin?\n @disfrazs = Disfraz.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disfrazs }\n end\n end", "def index\n @incidents = @quote.incidents.all\n respond_to do |format|\n format.json { render :json => @incidents }\n end\n end", "def discount\n params['discount']\n end", "def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end", "def index\n @purchases = Purchase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end", "def index\n @purchases = Purchase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end", "def all_discounts(scans)\n scans.map do |scan|\n product = scan.product\n next unless product.is_a?(BuyXGetXProduct) || product.is_a?(BulkProduct)\n discount_total = scan.discount_total\n next unless discount_total.positive?\n { title: discount_title(scan), amount: priceify_number(discount_total) }\n end.compact\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def index\n @crates = Crate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crates }\n end\n end", "def index\n @taxes = Tax.all\n\n render json: @taxes\n end", "def reset_discounts\n @discounts = []\n end", "def index\n @discount_codes = DiscountCode.all\n end", "def index\n @benefit_categories = BenefitCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @benefit_categories }\n end\n end", "def index\n @dishes = @restaurant.dishes\n end", "def index\n if current_user\n \t@debts = Debt.paginate(:page => params[:page], :per_page => 10)\n \trespond_to do |format|\n \tformat.html # index.html.erb\n \tformat.json { render json: @debts }\n \tend\n end\n end", "def index\n @trades = Trade\n .only(:created_at, :is_fair, :ash_pokemons, :brock_pokemons)\n respond_to do |format|\n format.json { render json: @trades }\n end\n end", "def index\n @purchases = Purchase.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end", "def index\n @trades = Trade.all\n render json: @trades\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def destroy\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.find(params[:id])\n @dish_discount.destroy\n\n respond_to do |format|\n format.html { redirect_to store_dish_discounts_url(@store) }\n format.json { head :no_content }\n end\n end", "def index\n @dices = Dice.all\n\n render json: @dices\n end", "def index\n @incomes = Income.all\n\n respond_to do |format|\n format.json { render json: @incomes }\n end\n end", "def index\n @dislikes = Dislike.all\n end", "def index\n @daily_deals = DailyDeal.all\n end", "def index\n @dis_ingredients = DisIngredient.all\n end", "def index\n @store = Store.find(params[:store_id])\n @dish_choices = @store.dish_choices\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_choices }\n end\n end", "def index\n @disciplines = Discipline.paginate(:page => params[:page], per_page: 30)\n @number = Discipline.count\n respond_to do |format|\n format.html\n format.json { render :json => Discipline.all.to_json(include: :department) }\n end\n end", "def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end", "def index\n @cryptocurrencies = Cryptocurrency.all\n\n require 'net/http'\n require 'json'\n\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_crypto = JSON.parse(@response)\n\n @profit_loss = 0\n end", "def index\n @expenses = find_expenses.all\n render json: @expenses\n end", "def index\n @funds = Fund.all\n\n render json: @funds\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 show\n @disability = Disability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disability }\n end\n end", "def _state_deals(state_id)\n get('state/deals', state_id, options: { type: :array })\n end", "def index\n @diaries = current_user.diaries.all\n respond_to do |format|\n format.html {render :index}\n format.json { render json: @diaries }\n end\n end", "def index\n @dishes = Dish.all\n end", "def index\n @dishes = Dish.all\n end", "def index\n @dishes = Dish.all\n end", "def index\n @coupons = Coupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coupons }\n end\n end", "def index\n @dislikes = Dislike.find_user_dislikes(params[:user_id])\n render :index\n end", "def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def get_coins\n get(\"/getcoins\")\n end", "def index\n @coupons = Coupon.where('shop_id = ?', params[:shop_id])\n\n respond_to do |format|\n format.html { show_from_resource('index', 'shop_index') }\n format.json { render json: @coupons }\n end\n end", "def counts\n @counts = UserCounts.new(@company, params)\n respond_to do |format|\n format.json { render json: @counts.user_counts }\n end\n end", "def index\n @notification_counts = NotificationCount.all\n\n render json: @notification_counts\n end", "def index\n # data for pie chart\n @data = @coupons.map{ |coupon| { coupon.name => coupon.registrations.count } }\n @data = Hash[*@data.collect{|h| h.to_a}.flatten]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coupons }\n end\n end", "def index\n render jsonapi: Seances::UseCases::FetchAll.new.call\n end", "def index\n @dis_additive_frequencies = DisAdditiveFrequency.all\n respond_to do |format|\n format.html\n format.json { render json:DisAdditiveFrequencieDatatable.new(view_context) }\n end\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refunds }\n end\n end", "def discount\n Discount.find_by_code(discount_code)\n end", "def list_discounts(location_id, opts = {})\n data, _status_code, _headers = list_discounts_with_http_info(location_id, opts)\n return data\n end", "def set_discounts_product\n @discounts_product = DiscountsProduct.find(params[:id])\n end", "def details\n @daily_deal = DailyDeal.find(params[:id])\n respond_to do |format|\n format.json do\n render with_api_version\n end\n end\n end", "def index\n @purchases = purchases.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end", "def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end", "def index\n @expenses = get_class.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end", "def create\n @discount = Discount.new(params[:discount])\n\n respond_to do |format|\n if @discount.save\n format.html { redirect_to administration_discounts_url, notice: 'Discount was successfully created.' }\n format.json { render json: @discount, status: :created, location: @discount }\n else\n format.html { render action: \"new\" }\n format.json { render json: @discount.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @descoverlies = Descoverly.all\n end", "def index\n @dispenses = Dispense.all\n end" ]
[ "0.6943867", "0.6804143", "0.66406983", "0.66127586", "0.6571965", "0.65084803", "0.6392808", "0.62904954", "0.62101614", "0.60305476", "0.60305476", "0.6023197", "0.5987936", "0.5928853", "0.5880489", "0.586941", "0.5851978", "0.5851745", "0.5842813", "0.58024865", "0.57988507", "0.5756494", "0.5744953", "0.5742526", "0.5713447", "0.5691704", "0.5690215", "0.5686075", "0.56715566", "0.5670903", "0.5660724", "0.56517947", "0.5647661", "0.56476104", "0.56474316", "0.5641322", "0.56401086", "0.5634649", "0.56216776", "0.5614407", "0.5613741", "0.5613198", "0.5592841", "0.5591769", "0.55887973", "0.55887973", "0.5586986", "0.55571854", "0.55435216", "0.5528699", "0.5525483", "0.5508528", "0.5501771", "0.5497593", "0.54969364", "0.54904735", "0.54778343", "0.54776055", "0.5473712", "0.54704213", "0.5469837", "0.5467198", "0.54658765", "0.54657155", "0.54654795", "0.54607713", "0.54558897", "0.54514813", "0.5451391", "0.5445523", "0.5440227", "0.5440107", "0.5440107", "0.54342", "0.54331094", "0.54320824", "0.5429948", "0.5429948", "0.5429948", "0.54284656", "0.5427111", "0.54223627", "0.5416971", "0.54107183", "0.5409825", "0.54052466", "0.5401623", "0.539864", "0.53984624", "0.53973633", "0.5396658", "0.5395336", "0.53901815", "0.53891844", "0.53858566", "0.5383126", "0.53811914", "0.53802216", "0.5368895", "0.536621", "0.5364502" ]
0.0
-1
GET /discounts/1 GET /discounts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @store = Store.find(params[:store_id])\n @dish_discounts = @store.dish_discounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_discounts }\n end\n end", "def show\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish_discount }\n end\n end", "def index\n @discounts = Discount.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @discounts }\n end\n end", "def discounts\n @discounts ||= [product.dig(:discounts, :item)].flatten(1).compact\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 disc(id)\n get(\"/catalog/titles/discs/#{id.to_s}\")\n end", "def index\n @dislike_counts = DislikeCount.all\n end", "def discounts\n @discounts ||= hash[\"Discounts\"].map { |d| Merchant::Discount.new d }\n end", "def show\n @discount = Discount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @discount }\n end\n end", "def index\n @admin_discounts = Admin::Discount.all\n end", "def index\n @discounts_products = DiscountsProduct.all\n end", "def index\n @discounts = Discount.desc(:created_at).includes(:orders)\n if params[:discount_token].present?\n @discounts = @discounts.where(token: /.*#{params[:discount_token]}.*/)\n end\n if params[:name].present?\n @discounts = @discounts.where(name: /.*#{params[:name]}.*/)\n end\n if request.format.csv?\n render json: {status: :bad_request} if !params[:name].present?\n else\n @discounts = @discounts.page(params[:page])\n end\n respond_to do |format|\n format.html {\n }\n format.csv {\n csv_data = CSV.generate({}) do |csv|\n csv << [I18n.t(:discount_num), I18n.t(:name), I18n.t(:discount_percent), I18n.t(:expire_date), I18n.t(:service_types),I18n.t(:available_times),I18n.t(:total_times)]\n @discounts.each do |d|\n csv << [d.token, d.name, d.percent, d.expire_date, d.service_types.map{|s| s.name}.join(','), d.available_times, d.times]\n end\n end\n headers['Last-Modified'] = Time.now.httpdate\n send_data csv_data, :filename => (params[:name] || I18n.l(DateTime.now)) + '.csv'\n }\n end\n end", "def show\n @discount = Discount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @discount }\n end\n end", "def new\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dish_discount }\n end\n end", "def index\n @discs = Disc.all\n end", "def credit\n handle_response(get(\"/credit.json\"))\n end", "def show\n @counter_order = CounterOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @counter_order }\n end\n end", "def destroy\n @discount = Discount.find(params[:id])\n @discount.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_discounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @discount = Discount.find(params[:id])\n @discount.destroy\n\n respond_to do |format|\n format.html { redirect_to discounts_url }\n format.json { head :no_content }\n end\n end", "def list_discounts_with_http_info(location_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1ItemsApi.list_discounts ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1ItemsApi.list_discounts\" if location_id.nil?\n # resource path\n local_var_path = \"/v1/{location_id}/discounts\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<V1Discount>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1ItemsApi#list_discounts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @disability = Disability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disability }\n end\n end", "def index\n authorize! :read, Discharge\n @discharges = Discharge.all\n end", "def details\n @daily_deal = DailyDeal.find(params[:id])\n respond_to do |format|\n format.json do\n render with_api_version\n end\n end\n end", "def index\n @incidents = @quote.incidents.all\n respond_to do |format|\n format.json { render :json => @incidents }\n end\n end", "def index\n @quantity_discounts = QuantityDiscount.find(:all).paginate :per_page => 10, :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @quantity_discounts }\n end\n end", "def get_deals_count\r\n # the base uri for api requests\r\n query_builder = Configuration::BASE_URI.dup % [@version]\r\n\r\n # prepare query string for API call\r\n query_builder << \"/deals/count\"\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"APIMATIC 2.0\",\r\n \"accept\" => \"application/json\",\r\n \"X-Api-Key\" => @x_api_key\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers:headers\r\n\r\n #Error handling using HTTP status codes\r\n if !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end", "def index\n @discount_activities = DiscountActivity.all\n end", "def index\n @purchases = Purchase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end", "def index\n @purchases = Purchase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def index\n @purchases = Purchase.where(user_id: get_current_user.id.to_i)\n\n render json: @purchases\n end", "def credit\n handle_response(self.class.get(\"/credit.json\"))\n end", "def index\n @consents = Consent.all\n render json: @consents\n end", "def show\n donation = Donation.find_by(id: params[:id])\n render json: donation.as_json\n end", "def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charges }\n end\n end", "def index\n @crates = Crate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crates }\n end\n end", "def index\n authorize Donate\n @donates = Donate.order('id DESC').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @donates }\n end\n end", "def index\n @coupons = Coupon.where('shop_id = ?', params[:shop_id])\n\n respond_to do |format|\n format.html { show_from_resource('index', 'shop_index') }\n format.json { render json: @coupons }\n end\n end", "def show\n @cash_dispense = CashDispense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @cash_dispense }\n\n ret = \"\"\n val = 0\n @cash_dispense.calculate_break_down.each_with_index do |dom,index| \n if dom.size > 0 \n ret += \"#{dom.count} x #{CashDispense::DENOMINATIONS[index]}\\n\" \n val += (dom.count * CashDispense::DENOMINATIONS[index])\n end # if \n end # each \n\n ret += \"\\n#{val}\"\n\n format.json { render json: ret }\n\n end\n end", "def discount\n Discount.find_by_code(discount_code)\n end", "def index\n @purchases = purchases.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end", "def find(id)\n response = client.get(\"discount_coupons/#{id}\")\n if response.success?\n DiscountCoupon.new(response.body, client: client)\n end\n end", "def show\r\n @discounts_on_location = DiscountsOnLocation.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @discounts_on_location }\r\n end\r\n end", "def index\n @taxes = Tax.all\n\n render json: @taxes\n end", "def index\n @disabilities = Disability.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disabilities }\n end\n end", "def show\n if @order\n respond_to do |format|\n format.html { @order }\n format.json { render json: @order.to_json(include: [:status, :package, :discount]) }\n end\n else\n redirect_to orders_path, notice: \"Order ID not found for that client.\"\n end\n end", "def show\n @consensu = Consensu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @consensu }\n end\n end", "def index\n @incomes = Income.all\n\n respond_to do |format|\n format.json { render json: @incomes }\n end\n end", "def index\n @dishes = @restaurant.dishes\n end", "def index\n @title=\"Listing Discharges\"\n @discharges = Discharge.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @discharges }\n end\n end", "def index\n @coupons = Coupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coupons }\n end\n end", "def show\n @cupon = Cupon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cupon }\n end\n end", "def index\n if params[:news_id]\n @news = News.find(params[:news_id])\n @discusses = @news.discusses\n else\n @discusses = Discuss.all\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @discusses }\n end\n end", "def show\n @restaurant_dish = Restaurant::Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant_dish }\n end\n end", "def show\n @coupon = Coupon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coupon }\n end\n end", "def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end", "def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end", "def index\n @store = Store.find(params[:store_id])\n @dish_choices = @store.dish_choices\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_choices }\n end\n end", "def show\n @feed_dislike = FeedDislike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed_dislike }\n end\n end", "def create\n @discount = Discount.new(params[:discount])\n\n respond_to do |format|\n if @discount.save\n format.html { redirect_to administration_discounts_url, notice: 'Discount was successfully created.' }\n format.json { render json: @discount, status: :created, location: @discount }\n else\n format.html { render action: \"new\" }\n format.json { render json: @discount.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @breadcrumb = 'read'\n @currency = Currency.find(params[:id])\n @currency_instruments = @currency.currency_instruments.by_value\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @currency }\n end\n end", "def show\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end", "def show\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund }\n end\n end", "def set_discounts_product\n @discounts_product = DiscountsProduct.find(params[:id])\n end", "def index\n @purchases = Purchase.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end", "def show\n @quantity_discount = QuantityDiscount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @quantity_discount }\n end\n end", "def index\n @dis_additive_frequencies = DisAdditiveFrequency.all\n respond_to do |format|\n format.html\n format.json { render json:DisAdditiveFrequencieDatatable.new(view_context) }\n end\n end", "def index\n @benefit_categories = BenefitCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @benefit_categories }\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 index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end", "def destroy\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.find(params[:id])\n @dish_discount.destroy\n\n respond_to do |format|\n format.html { redirect_to store_dish_discounts_url(@store) }\n format.json { head :no_content }\n end\n end", "def index\n @cryptocurrencies = Cryptocurrency.all\n\n require 'net/http'\n require 'json'\n\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_crypto = JSON.parse(@response)\n\n @profit_loss = 0\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def index\n @funds = Fund.all\n\n render json: @funds\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def get_rate(id:)\n @client.http_get(\"/#{@resource}/#{id}/rate\")\n end", "def show\n @daily_statistic = DailyStatistic.find(params[:id])\n\n render json: @daily_statistic\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def discount\n params['discount']\n end", "def index\n @dis_ingredients = DisIngredient.all\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def show\n @benefit_category = BenefitCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @benefit_category }\n end\n end", "def discount\n params['discount']\n end", "def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refunds }\n end\n end", "def show\n @financial_donation = FinancialDonation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_donation }\n end\n end", "def index\n @donations = Donation.order('created_at DESC').limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @donations }\n end\n end", "def show\n @revenue = Revenue.find(params[:id])\n\n render json: @revenue\n end", "def show\n @breadcrumb = 'read'\n @billing_frequency = BillingFrequency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @billing_frequency }\n end\n end", "def show\n @postdiscount = Postdiscount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @postdiscount }\n end\n end", "def show\n @distraction = Distraction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distraction }\n end\n end", "def index\n @restaurant = Restaurant.find(restaurant_id)\n @dishes = Dish.where(restaurant_id: restaurant_id).all\n end", "def show\n @yahoo_deal = YahooDeal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @yahoo_deal }\n end\n end", "def show\n @currency = Currency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @currency }\n end\n end", "def show\n @dish = Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end", "def show\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bidding }\n end\n end", "def index\n # data for pie chart\n @data = @coupons.map{ |coupon| { coupon.name => coupon.registrations.count } }\n @data = Hash[*@data.collect{|h| h.to_a}.flatten]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coupons }\n end\n end" ]
[ "0.6976709", "0.69058627", "0.65602225", "0.6406121", "0.6363159", "0.6363159", "0.636101", "0.63553894", "0.6326514", "0.6303807", "0.6245139", "0.61564684", "0.6110368", "0.60298824", "0.59950197", "0.59456486", "0.5896851", "0.58931494", "0.58792484", "0.5869454", "0.5868169", "0.58440053", "0.5836255", "0.5827743", "0.58127713", "0.5795009", "0.5792241", "0.57911944", "0.5785603", "0.5765311", "0.5765311", "0.5760586", "0.57552916", "0.5749171", "0.5745932", "0.57447195", "0.57342184", "0.5732794", "0.5716128", "0.5707107", "0.5692788", "0.5690385", "0.568471", "0.56745994", "0.5673673", "0.5669126", "0.56594163", "0.56579876", "0.56535834", "0.5652671", "0.5649359", "0.564146", "0.56309354", "0.562631", "0.562457", "0.56190354", "0.5617318", "0.5607129", "0.5607029", "0.56063384", "0.560611", "0.5602775", "0.55972075", "0.55941224", "0.55941224", "0.55933315", "0.5591675", "0.55915123", "0.5587205", "0.55849016", "0.557689", "0.557689", "0.5576755", "0.55648905", "0.5564384", "0.55639035", "0.5560332", "0.5556288", "0.55549914", "0.5544268", "0.5542888", "0.55406916", "0.5539673", "0.5537574", "0.5535165", "0.55347043", "0.55344486", "0.55310863", "0.55278575", "0.5523319", "0.5521228", "0.5520722", "0.5519383", "0.55172086", "0.55105376", "0.55033296", "0.54949975", "0.5494611", "0.5493649", "0.5491454", "0.548957" ]
0.0
-1
POST /discounts POST /discounts.json
def create @discount = Discount.new(discount_params) respond_to do |format| if @discount.save format.html { redirect_to @discount, notice: 'Discount was successfully created.' } format.json { render :show, status: :created, location: @discount } else format.html { render :new } format.json { render json: @discount.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @discount = Discount.new(params[:discount])\n\n respond_to do |format|\n if @discount.save\n format.html { redirect_to administration_discounts_url, notice: 'Discount was successfully created.' }\n format.json { render json: @discount, status: :created, location: @discount }\n else\n format.html { render action: \"new\" }\n format.json { render json: @discount.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n discounts = []\n (1..params[:discount_number].to_i).each do |i|\n @discount = Discount.new(params[:discount])\n @discount.generate_token params[:discount_six_length].to_i\n @discount.save\n discounts << @discount\n end\n respond_to do |format|\n format.html { redirect_to discounts_url, notice: I18n.t(:discount_created, n: params[:discount][:name], c: params[:discount_number] ) }\n format.json { render json: discounts, status: :created, location: discounts }\n end\n end", "def create\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.create(params[:dish_discount])\n\n respond_to do |format|\n if @dish_discount.save\n format.html { redirect_to store_dish_discounts_url(@store), notice: 'Dish discount was successfully created.' }\n format.json { render json: @dish_discount, status: :created, location: @dish_discount }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dish_discount.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_discount = Admin::Discount.new(admin_discount_params)\n\n respond_to do |format|\n if @admin_discount.save\n format.html { redirect_to @admin_discount, notice: 'Discount was successfully created.' }\n format.json { render :show, status: :created, location: @admin_discount }\n else\n format.html { render :new }\n format.json { render json: @admin_discount.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @discounts_product = DiscountsProduct.new(discounts_product_params)\n\n respond_to do |format|\n if @discounts_product.save\n format.html { redirect_to @discounts_product, notice: 'Discounts product was successfully created.' }\n format.json { render :show, status: :created, location: @discounts_product }\n else\n format.html { render :new }\n format.json { render json: @discounts_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def discounts\n @discounts ||= hash[\"Discounts\"].map { |d| Merchant::Discount.new d }\n end", "def create\n @discount = Discount.new(discount_params)\n\n respond_to do |format|\n if @discount.save\n format.html { redirect_to(@discount, :notice => 'Discount was successfully created.') }\n format.xml { render :xml => @discount, :status => :created, :location => @discount }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @discount.errors, :status => :unprocessable_entity }\n end\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 @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 @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dish_discount }\n end\n end", "def discount\n params['discount']\n end", "def create\n @postdiscount = Postdiscount.new(params[:postdiscount])\n\n respond_to do |format|\n if @postdiscount.save\n format.html { redirect_to(@postdiscount, :notice => 'Postdiscount was successfully created.') }\n format.xml { render :xml => @postdiscount, :status => :created, :location => @postdiscount }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @postdiscount.errors, :status => :unprocessable_entity }\n end\n end\n end", "def reset_discounts\n @discounts = []\n end", "def assign_discounts\n category.discounts.each do |discount|\n ShopDiscountable.create(:discount => discount, :discounted => self)\n end\n end", "def discount\n params['discount']\n end", "def add_discount_product(payload, register_id, client)\n {\n 'product_id'=> client.get_discount_product,\n 'register_id'=> register_id,\n 'sequence'=> '0',\n 'handle'=> 'vend-discount',\n 'sku'=> 'vend-discount',\n 'name'=> 'Discount',\n 'quantity'=> -1,\n 'price'=> payload['totals']['discount'],\n 'price_set'=> 1,\n 'discount'=> 0,\n 'loyalty_value'=> 0,\n 'price_total'=> payload['totals']['discount']*-1,\n 'display_retail_price_tax_inclusive'=> '1',\n 'status'=> 'CONFIRMED'\n }\n end", "def create\n @discount_activity = DiscountActivity.new(discount_activity_params)\n\n respond_to do |format|\n if @discount_activity.save\n format.html { redirect_to @discount_activity, notice: 'Discount activity was successfully created.' }\n format.json { render :show, status: :created, location: @discount_activity }\n else\n format.html { render :new }\n format.json { render json: @discount_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @discount = Discount.find(params[:id])\n @discount.destroy\n\n respond_to do |format|\n format.html { redirect_to discounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @discount = Discount.find(params[:id])\n @discount.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_discounts_url }\n format.json { head :no_content }\n end\n end", "def discounts_product_params\n params.require(:discounts_product).permit(:discount_id, :product_id, :status)\n end", "def create\n p params\n donation = Donation.new(\n amount: params[:amount],\n frequency: params[:frequency])\n # save the information from user input to create a new donation.\n donation.save!\n if donation.save!\n render json: donation.as_json\n else\n render json: {errors: donation.errors.full_messages}\n end\n end", "def create_insurance_discount_using_post(insurance_discount, opts = {})\n data, _status_code, _headers = create_insurance_discount_using_post_with_http_info(insurance_discount, opts)\n data\n end", "def create\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n @dispense = Dispense.new(dispense_params)\n\n respond_to do |format|\n if @dispense.save\n format.html { redirect_to @dispense, notice: 'Dispense was successfully created.' }\n format.json { render :show, status: :created, location: @dispense }\n else\n format.html { render :new }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end", "def discount_params\n params.fetch(:discount, {})\n end", "def create_insurance_discount_using_post_with_http_info(insurance_discount, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InsuranceApi.create_insurance_discount_using_post ...'\n end\n # verify the required parameter 'insurance_discount' is set\n if @api_client.config.client_side_validation && insurance_discount.nil?\n fail ArgumentError, \"Missing the required parameter 'insurance_discount' when calling InsuranceApi.create_insurance_discount_using_post\"\n end\n # resource path\n local_var_path = '/insurance_discount'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(insurance_discount)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InsuranceDiscount')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InsuranceApi#create_insurance_discount_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @dislike_counts = DislikeCount.all\n end", "def create\n client_params[:specialDiscount].to_s.gsub!(',', '.')\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n\n format.html { redirect_to @client, notice: 'El Cliente fue Creado Exitosamente.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def discounts\n @discounts ||= [product.dig(:discounts, :item)].flatten(1).compact\n end", "def discount_params\n params.require(:discount).permit(:category, :description, :discount_increase, :group_id)\n end", "def index\n @discounts = Discount.desc(:created_at).includes(:orders)\n if params[:discount_token].present?\n @discounts = @discounts.where(token: /.*#{params[:discount_token]}.*/)\n end\n if params[:name].present?\n @discounts = @discounts.where(name: /.*#{params[:name]}.*/)\n end\n if request.format.csv?\n render json: {status: :bad_request} if !params[:name].present?\n else\n @discounts = @discounts.page(params[:page])\n end\n respond_to do |format|\n format.html {\n }\n format.csv {\n csv_data = CSV.generate({}) do |csv|\n csv << [I18n.t(:discount_num), I18n.t(:name), I18n.t(:discount_percent), I18n.t(:expire_date), I18n.t(:service_types),I18n.t(:available_times),I18n.t(:total_times)]\n @discounts.each do |d|\n csv << [d.token, d.name, d.percent, d.expire_date, d.service_types.map{|s| s.name}.join(','), d.available_times, d.times]\n end\n end\n headers['Last-Modified'] = Time.now.httpdate\n send_data csv_data, :filename => (params[:name] || I18n.l(DateTime.now)) + '.csv'\n }\n end\n end", "def create\n\t\tuser = User.find_by(id: expense_params['user_id'])\n\t\tdebt = Debt.find_by(id: expense_params['debt_id'])\n\t\texpense = user.expenses.build(expense_params)\n\t\tif expense.save \n\t\t\tif debt\n\t\t\t\tdebt.expenses << expense\n\t\t\tend\n\t\t\trender json: user\n\t\telse\n\t\t\trender json: expense.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def create\n @quantity_discount = QuantityDiscount.new(params[:quantity_discount])\n\n respond_to do |format|\n if @quantity_discount.save\n flash[:notice] = 'QuantityDiscount was successfully created.'\n format.html { redirect_to(admin_quantity_discounts_path) }\n format.xml { render :xml => @quantity_discount, :status => :created, :location => @quantity_discount }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @quantity_discount.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @invoice = Invoice.new(params[:invoice])\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n @invoice.status = Invoice::DRAFT\n @invoice.year = @counter.year\n @invoice.invoice_id = @counter.number\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n begin\n charge = Stripe::Charge.create({\n amount: params[:amount],\n currency: 'sgd',\n customer: params[:customer_id],\n source: params[:card_id]\n })\n\n json_response(charge, :created)\n\n rescue Stripe::InvalidRequestError => exception\n response = Hash.new\n response[:error] = exception.message\n\n json_response(response, :bad_request)\n end\n end", "def set_discounts_product\n @discounts_product = DiscountsProduct.find(params[:id])\n end", "def create\n @insurance = load_insurance\n @group ||= load_group\n @discount = Discount.new(discount_params)\n @discount.group = @group\n\n respond_to do |format|\n if @discount.save\n format.html { redirect_to insurance_group_path(@insurance, @group), success: t('activerecord.messages.successfull.created', data: @discount.fullname) }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @discount.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @store = Store.find(params[:store_id])\n @dish_discounts = @store.dish_discounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_discounts }\n end\n end", "def create\n render json: Dish.create(dish_params)\n end", "def destroy\n @discount = Discount.find(params[:id])\n @discount.destroy\n\n respond_to do |format|\n format.html { redirect_to(discounts_url) }\n format.xml { head :ok }\n end\n end", "def create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end", "def index\n @discounts_products = DiscountsProduct.all\n end", "def index\n @discounts = Discount.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @discounts }\n end\n end", "def update_subscription_discount(subscription_id, discount_amount)\n #https://sandbox.braintreegateway.com/merchants/xghpmnxkg7skhfyg/subscriptions/ds69cr\n update_add_ons = {add: [], update: []}\n subscription = find_subscription(subscription_id)\n discounts = subscription.discounts\n index = discounts.map(&:id).index(ONE_TIME_DISCOUNT)\n result = {start_date: subscription.billing_period_start_date, end_date: subscription.billing_period_end_date, balance: subscription.balance,\n billing_cycle: subscription.current_billing_cycle, show_on: subscription.billing_period_end_date.to_date + 1}\n if index\n current_discount = discounts[index]\n update_add_ons[:update] << {existing_id: ONE_TIME_DISCOUNT, amount: current_discount.amount + discount_amount}\n else\n update_add_ons[:add] << {inherited_from_id: ONE_TIME_DISCOUNT, amount: discount_amount}\n end\n from_bt = Braintree::Subscription.update(subscription_id, discounts: update_add_ons)\n if from_bt.success?\n result.merge!(success: from_bt.success?)\n else\n puts \"====ERROR MESSAGE: #{from_bt.message} ===\"\n result.merge!(success: from_bt.success?, error: from_bt.message)\n end\n end", "def create\n recurring = params[:expense].delete(:recurring)\n statement = Statement.find(params[:statement_id])\n @expense = Expense.new(params[:expense])\n @expense.statement = statement\n @expense.recurring = recurring\n\n respond_to do |format|\n if @expense.save\n format.html { redirect_to @expense.statement, notice: 'Statement expense was successfully created.' }\n format.json { render json: @expense, status: :created, location: @expense }\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @admin_discount.destroy\n respond_to do |format|\n format.html { redirect_to admin_discounts_url, notice: 'Discount was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def set_discount\n @discount = Discount.find( params[:id] )\n end", "def create\n request = Request.put_xml(\"pre-approvals/#{code}/discount\", credentials, xml_params)\n\n Response.new(request, self).serialize\n\n self\n end", "def create\n @refund = Refund.new(params[:refund])\n @queued_coupon_refunds = Coupon.find(session[:queued_coupon_refunds])\n \n # create wtd credits\n if @refund.credit_amount > 0\n @credit = Credit.new\n @credit.promotion_code_id = PromotionCode::REFUND_CREDIT\n @credit.value = @refund.credit_amount\n @credit.user_id = @refund.purchase.user.id\n @credit.save\n @refund.credit_id = @credit.id\n end\n \n \n # connect with authorize.net\n @connect = true\n \n if @connect\n # mark coupons as refunded\n @queued_coupon_refunds.each do |coupon|\n coupon.refunded = true\n coupon.save\n end\n \n # clear session\n session[:queued_coupon_refunds] = []\n end\n \n if @refund.save\n flash[:notice] = 'Refund was successfully saved.'\n redirect_to(admin_refund_path(@refund))\n else\n render :action => \"new\"\n end\n end", "def create\n @dislike = current_user.dislikes.build(dislike_params)\n\n respond_to do |format|\n if @dislike.save\n format.html { redirect_to @dislike, notice: 'Dislike was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dislike }\n else\n format.html { render action: 'new' }\n format.json { render json: @dislike.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @disc = Disc.new(disc_params)\n\n respond_to do |format|\n if @disc.save\n format.html { redirect_to @disc, notice: 'Disc was successfully created.' }\n format.json { render :show, status: :created, location: @disc }\n else\n format.html { render :new }\n format.json { render json: @disc.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @pricing_id=@discount.pricing_id\n @discount.destroy\n respond_to do |format|\n format.html { redirect_to discounts_url(id: @pricing_id), notice: 'Discount was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @discount_code = DiscountCode.new(discount_code_params)\n if @discount_code.save\n redirect_to dashboard_discount_code_path(@discount_code), notice: 'Discount code was successfully created.'\n else\n render :new\n end\n end", "def destroy\n @postdiscount = Postdiscount.find(params[:id])\n @postdiscount.destroy\n\n respond_to do |format|\n format.html { redirect_to(postdiscounts_url) }\n format.xml { head :ok }\n end\n end", "def delete_discount\n resp, opts = execute_resource_request(:delete, resource_url + \"/discount\")\n Util.convert_to_stripe_object(resp.data, opts)\n end", "def set_dislike_count\n @dislike_count = DislikeCount.find(params[:id])\n end", "def create\n @dis_ingredient = DisIngredient.new(dis_ingredient_params)\n\n respond_to do |format|\n if @dis_ingredient.save\n format.html { redirect_to @dis_ingredient, notice: 'Dis ingredient was successfully created.' }\n format.json { render :show, status: :created, location: @dis_ingredient }\n else\n format.html { render :new }\n format.json { render json: @dis_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_discount\n @discount = Discount.find(params[:id])\n end", "def create\n @expense = Expense.new(expense_params)\n\n respond_to do |format|\n if @expense.save\n if !params[:expense_category].blank?\n category = ExpenseCategory.find_by name: params[:expense_category]\n if !category.nil?\n @expense.update(expense_category: category)\n if params[:expense_category] == \"Diesel\"\n company = DieselCompany.find(params[:diesel_company])\n DieselExpense.create! expense: @expense, diesel_company: company, litres: @expense.quantity\n end\n end\n # cash = Cash.today.first\n # cash.update(amount_out: (cash.amount_out + @expense.amount), balance: (cash.balance - @expense.amount))\n end\n format.html { redirect_to expenses_path, notice: 'Expense was successfully created.' }\n format.json { render :show, status: :created, location: @expense }\n else\n format.html { render :new }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @admin_discounts = Admin::Discount.all\n end", "def sale_discount\n\t\t@sale = Sale.find(params[:sale_discount][:sale_id])\n\n\t\t@sale.discount = params[:sale_discount][:discount]\n\t\t@sale.save\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend", "def create\n @daily_yard_count = DailyYardCount.new(daily_yard_count_params)\n\n respond_to do |format|\n if @daily_yard_count.save\n format.html { redirect_to @daily_yard_count, notice: 'Daily yard count was successfully created.' }\n format.json { render :show, status: :created, location: @daily_yard_count }\n else\n format.html { render :new }\n format.json { render json: @daily_yard_count.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @dislike_count.destroy\n respond_to do |format|\n format.html do\n redirect_to dislike_counts_url,\n notice: 'Dislike count was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "def create\n @debt = Debt.new(params[:debt])\n\n respond_to do |format|\n if @debt.save\n format.html { redirect_to @debt, :notice => 'Debt was successfully created.' }\n format.json { render :json => @debt, :status => :created, :location => @debt }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @debt.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # Get the variables passed in from params on create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense, status: :created, location: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end", "def create\n @debt = Debt.new(params[:debt])\n\n respond_to do |format|\n if @debt.save\n format.html { redirect_to @debt, notice: 'Debt was successfully created.' }\n format.json { render json: @debt, status: :created, location: @debt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @debt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end", "def destroy\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.find(params[:id])\n @dish_discount.destroy\n\n respond_to do |format|\n format.html { redirect_to store_dish_discounts_url(@store) }\n format.json { head :no_content }\n end\n end", "def new\n @discount = Discount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discount }\n end\n end", "def update\n @discount = Discount.find(params[:id])\n @discount.products = Product.find(params[:products].keys.select{|key| params[:products][key] != '0'})\n\n respond_to do |format|\n if @discount.update_attributes(params[:discount])\n format.html { redirect_to administration_discounts_url, notice: 'Discount was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discount.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @feed_dislike = FeedDislike.new(params[:feed_dislike])\n\n respond_to do |format|\n if @feed_dislike.save\n format.html { redirect_to @feed_dislike, notice: 'Feed dislike was successfully created.' }\n format.json { render json: @feed_dislike, status: :created, location: @feed_dislike }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feed_dislike.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @disclaimer = Disclaimer.new(params[:disclaimer])\n @disclaimers = Disclaimer.all\n\n respond_to do |format|\n if @disclaimer.save\n @disclaimers = Disclaimer.all\n format.html { redirect_to presets_path, notice: 'Disclaimer was successfully created.' }\n format.json { render json: @disclaimer, status: :created, location: @disclaimer }\n format.js\n else\n format.html { redirect_to presets_path, notice: 'Disclaimer was successfully created.' }\n format.json { render json: @disclaimer.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n render json: ::Transaction::CreditSerializer.new( do_credit! ), status: :created\n end", "def coupDiscounts\n\t\t@new_cart.each do |item, details|\n\t\t\tcase\n\t\t\t\twhen item == \"CHEESE\" && details[:coups] == 1 && details[:count] > 2\n\t\t\t\t\tdetails[:cost] = (((details[:count] / 3) * 15) + ((details[:count] % 3) * details[:price]))\n\t\t\t\twhen item == \"AVOCADO\" && details[:coups] == 1 && details[:count] > 1\n\t\t\t\t\tdetails[:cost] = (((details[:count] / 2) * 5) + ((details[:count] % 2) * details[:price]))\n\t\t\t\twhen item == \"BEER\" && details[:coups] == 1 && details[:count] > 1\n\t\t\t\t\tdetails[:cost] = (((details[:count] / 2) * 20) + ((details[:count] % 2) * details[:price]))\n\t\t\t\tend\t\t\t\t\n\t\tend\n\tend", "def create\n @budget = Budget.new(budget_params)\n @client = Client.new\n @clients = Client.all\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'El presupuesto se creó correctamente' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @discounts_product.destroy\n respond_to do |format|\n format.html { redirect_to discounts_products_url, notice: 'Discounts product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update\n params[:client][:discount_ids] ||=[]\n respond_to do |format|\n client_params[:specialDiscount].to_s.gsub!(',', '.')\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'El Cliente fue Actualizado Exitosamente.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @descoverly = Descoverly.new(descoverly_params)\n\n respond_to do |format|\n if @descoverly.save\n format.html { redirect_to @descoverly, notice: 'Descoverly was successfully created.' }\n format.json { render :show, status: :created, location: @descoverly }\n else\n format.html { render :new }\n format.json { render json: @descoverly.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dispute = Dispute.new(dispute_params)\n\n respond_to do |format|\n if @dispute.save\n format.html { redirect_to @dispute, notice: 'Dispute was successfully created.' }\n format.json { render :show, status: :created, location: @dispute }\n else\n format.html { render :new }\n format.json { render json: @dispute.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dumb_counter = DumbCounter.new(dumb_counter_params)\n\n respond_to do |format|\n if @dumb_counter.save\n format.html { redirect_to @dumb_counter, notice: 'Dumb counter was successfully created.' }\n format.json { render :show, status: :created, location: @dumb_counter }\n else\n format.html { render :new }\n format.json { render json: @dumb_counter.errors, status: :unprocessable_entity }\n end\n end\n end", "def discount=(amount)\n @discount = amount\n end", "def create\n @debt = Debt.new(debt_params)\n\n respond_to do |format|\n if @debt.save\n format.html { redirect_to @debt, notice: 'Debt was successfully created.' }\n format.json { render :show, status: :created, location: @debt }\n else\n format.html { render :new }\n format.json { render json: @debt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @repurchase = Repurchase.new(params[:repurchase])\n\n respond_to do |format|\n if @repurchase.save\n format.html { redirect_to @repurchase, notice: 'Repurchase was successfully created.' }\n format.json { render json: @repurchase, status: :created, location: @repurchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @repurchase.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, budget: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def resource_params\n params\n .require(:discount)\n .permit(\n :discount_type, :title, :description, :cost, :product_description,\n :starts_at, :ends_at, :active, :featured,\n :terms_and_conditions, :picture,\n steps_attributes: %i[id position text _destroy],\n segment_ids: []\n )\n end", "def create\n @disfraz = Disfraz.new(disfraz_params)\n\n respond_to do |format|\n if @disfraz.save\n format.html { redirect_to @disfraz, notice: 'Disfraz was successfully created.' }\n format.json { render :show, status: :created, location: @disfraz }\n else\n format.html { render :new }\n format.json { render json: @disfraz.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget_for_order = BudgetForOrder.new(budget_for_order_params)\n @budget_for_order.total=0\n respond_to do |format|\n if @budget_for_order.save\n format.html { redirect_to budget_new_add_path(@budget_for_order.id), notice: 'Favor de agregar los detalles' }\n format.json { render :show, status: :created, location: @budget_for_order }\n else\n format.html { render :new }\n format.json { render json: @budget_for_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @discount.update(discount_params)\n format.html { redirect_to @discount, notice: 'Discount was successfully updated.' }\n format.json { render :show, status: :ok, location: @discount }\n else\n format.html { render :edit }\n format.json { render json: @discount.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @debt = Debt.new(debt_params)\n\n respond_to do |format|\n if @debt.save\n format.html { redirect_to @debt, notice: 'Debt was successfully created.' }\n format.json { render action: 'show', status: :created, location: @debt }\n else\n format.html { render action: 'new' }\n format.json { render json: @debt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'Refund was successfully created.' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @discount = Discount.find(params[:id])\n\n respond_to do |format|\n if @discount.update_attributes(params[:discount])\n format.html { redirect_to @discount, notice: 'Discount was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discount.errors, status: :unprocessable_entity }\n end\n end\n end", "def predict_price_after_discounts!\n m_discounts = []\n f = build_discount_items :fixed_amount\n m_discounts += f\n \n self.price_after_fixed_discounts = (self.price * self.qty).to_i + m_discounts.each {|discount| discount.price_extend }.sum(&:price_extend).to_i\n\n p = build_discount_items :percentage\n m_discounts += p\n \n self.price_after_all_discounts = (self.price * self.qty).to_i + m_discounts.each {|discount| discount.price_extend }.sum(&:price_extend).to_i\n \n if self.price_after_all_discounts < 0\n discount_amount = self.price_after_all_discounts * -1\n discount_sku = Product.find_by_name(\"Discount\").sku\n discount_attributes = {:product_sku => discount_sku, :qty => 1, \n :currency_used => \"BTC\", \n :price => discount_amount, :price_extend => discount_amount,\n :description => \"Discount to prevent line_item from less than zero condition\" }\n \n self.discounts.create(discount_attributes)\n end\n \n [self.price_after_all_discounts, m_discounts]\n end", "def create\n @dis_additive_frequency = DisAdditiveFrequency.new(dis_additive_frequency_params)\n\n respond_to do |format|\n if @dis_additive_frequency.save\n format.html { redirect_to @dis_additive_frequency, notice: 'Dis additive frequency was successfully created.' }\n format.json { render :show, status: :created, location: @dis_additive_frequency }\n else\n format.html { render :new }\n format.json { render json: @dis_additive_frequency.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bid_expense = BidExpense.new(bid_expense_params)\n\n respond_to do |format|\n if @bid_expense.save\n format.html { redirect_to bid_expenses_path, notice: 'Bid expense was successfully created.' }\n format.json { render :show, status: :created, location: @bid_expense }\n else\n format.html { render :new }\n format.json { render json: @bid_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to budgets_path }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n num_days = (Date.parse(params['rent_info']['end_date']).mjd - Date.parse(params['rent_info']['start_date']).mjd) \n total = num_days * params['rent_info']['price_per_day']\n # byebug\n if User.find(params['rent_info']['owner_id'])\n user = User.find(params['rent_info']['owner_id'])\n user.money_made += total \n user.save\n end\n\n renter_post = RenterPost.create(\n renter_id: params['rent_info']['renter_id'],\n post_id: params['rent_info'][\"post_id\"],\n start_date: params['rent_info'][\"start_date\"],\n end_date: params['rent_info'][\"end_date\"],\n status: params['rent_info'][\"status\"]\n )\n if renter_post \n render json: renter_post\n else\n render json: {error: \"Could not create Renter Post\"}\n end\n end", "def create\n @disbursment = Disbursment.new(disbursment_params)\n @disbursment.case_id = @case.id\n respond_to do |format|\n if @disbursment.save\n format.html { redirect_to case_disbursment_path(@case, @disbursment), notice: 'Disbursment was successfully created.' }\n format.json { render :show, status: :created, location: @disbursment }\n else\n format.html { render :new }\n format.json { render json: @disbursment.errors, status: :unprocessable_entity }\n end\n end\n end", "def quick_discount\n\n return redirect_with_message(\"Error: invalid request.\", :action => 'index', :controller => 'store') unless @customer\n\n cart = Cart.create\n session[:anonymous_cart_id] = cart.id\n cart.add_product( params[:id], :discount => BigDecimal(\"2.0\"))\n newToken = OnepageAuthToken.create_token(@customer, 3, :controller => 'cart', :action => 'checkout')\n redirect_to :action => 'checkout', :token => newToken\n\n end", "def create\n @discharge = Discharge.new(params[:discharge])\n\n respond_to do |format|\n if @discharge.save\n flash[:notice] = 'Discharge was successfully created.'\n format.html { redirect_to(@discharge) }\n format.xml { render :xml => @discharge, :status => :created, :location => @discharge }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @discharge.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @review_count = ReviewCount.new(review_count_params)\n\n respond_to do |format|\n if @review_count.save\n format.html { redirect_to @review_count, notice: 'Review count was successfully created.' }\n format.json { render :show, status: :created, location: @review_count }\n else\n format.html { render :new }\n format.json { render json: @review_count.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @petty_cash_expense = PettyCashExpense.new(petty_cash_expense_params)\n\n respond_to do |format|\n if @petty_cash_expense.save\n format.json { render :show, status: :created, location: @petty_cash_expense }\n else\n format.json { render json: @petty_cash_expense.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6922074", "0.6826182", "0.6560772", "0.6477866", "0.6321534", "0.6138121", "0.6131779", "0.61306036", "0.61306036", "0.605085", "0.59038067", "0.5888664", "0.58489597", "0.5839619", "0.58395773", "0.58288944", "0.58156484", "0.5805577", "0.5802414", "0.5782759", "0.5760846", "0.5745945", "0.57368034", "0.5722264", "0.5698612", "0.5673965", "0.5658599", "0.56563413", "0.565135", "0.56066316", "0.56026614", "0.55738175", "0.5571074", "0.5563358", "0.55627066", "0.55142134", "0.54989624", "0.5486666", "0.54673874", "0.5465323", "0.5453551", "0.5422734", "0.5417639", "0.5407291", "0.53895694", "0.53862447", "0.53850275", "0.5377527", "0.5371012", "0.5365656", "0.53518885", "0.53390384", "0.533484", "0.53302324", "0.5327869", "0.53246266", "0.5322317", "0.5318738", "0.5313376", "0.5309648", "0.53024954", "0.52677983", "0.5265151", "0.5247015", "0.524328", "0.5240132", "0.523612", "0.52135175", "0.51965237", "0.51913035", "0.518777", "0.51864934", "0.5185719", "0.5181042", "0.51675266", "0.51549214", "0.51516753", "0.51423204", "0.5140403", "0.51303583", "0.512983", "0.5112129", "0.51016736", "0.51016384", "0.50949985", "0.5094715", "0.50925", "0.5089036", "0.50883335", "0.50872064", "0.50823724", "0.5076208", "0.5076074", "0.5072881", "0.5071652", "0.5069205", "0.5049617", "0.5037429", "0.50370485", "0.5031378" ]
0.68092644
2
PATCH/PUT /discounts/1 PATCH/PUT /discounts/1.json
def update respond_to do |format| if @discount.update(discount_params) format.html { redirect_to @discount, notice: 'Discount was successfully updated.' } format.json { render :show, status: :ok, location: @discount } else format.html { render :edit } format.json { render json: @discount.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @discount = Discount.find(params[:id])\n\n respond_to do |format|\n if @discount.update_attributes(params[:discount])\n format.html { redirect_to @discount, notice: 'Discount was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discount.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @discount = Discount.find(params[:id])\n @discount.products = Product.find(params[:products].keys.select{|key| params[:products][key] != '0'})\n\n respond_to do |format|\n if @discount.update_attributes(params[:discount])\n format.html { redirect_to administration_discounts_url, notice: 'Discount was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discount.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.find(params[:id])\n\n respond_to do |format|\n if @dish_discount.update_attributes(params[:dish_discount])\n format.html { redirect_to store_dish_discounts_url(@store), notice: 'Dish discount was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dish_discount.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:client][:discount_ids] ||=[]\n respond_to do |format|\n client_params[:specialDiscount].to_s.gsub!(',', '.')\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'El Cliente fue Actualizado Exitosamente.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end", "def update\n respond_to do |format|\n if @admin_discount.update(admin_discount_params)\n format.html { redirect_to @admin_discount, notice: 'Discount was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_discount }\n else\n format.html { render :edit }\n format.json { render json: @admin_discount.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @discount = Discount.find(params[:id])\n\n respond_to do |format|\n if @discount.update(discount_params)\n format.html { redirect_to(@discount, :notice => 'Discount was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @discount.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @invoice = Invoice.find(params[:id])\n @invoice.year = Date.today.year\n\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @discount_activity.update(discount_activity_params)\n format.html { redirect_to @discount_activity, notice: 'Discount activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @discount_activity }\n else\n format.html { render :edit }\n format.json { render json: @discount_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end", "def update\n @quantity_discount = QuantityDiscount.find(params[:id])\n\n respond_to do |format|\n if @quantity_discount.update_attributes(params[:quantity_discount])\n flash[:notice] = 'QuantityDiscount was successfully updated.'\n format.html { redirect_to(admin_quantity_discounts_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quantity_discount.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end", "def update\n @expense = Expense.find params.fetch(:id)\n\n if @expense.update(expense_params)\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @discounts_product.update(discounts_product_params)\n format.html { redirect_to @discounts_product, notice: 'Discounts product was successfully updated.' }\n format.json { render :show, status: :ok, location: @discounts_product }\n else\n format.html { render :edit }\n format.json { render json: @discounts_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cash_dispense = CashDispense.find(params[:id])\n\n respond_to do |format|\n if @cash_dispense.update_attributes(params[:cash_dispense])\n format.html { redirect_to @cash_dispense, notice: 'Cash dispense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cash_dispense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end", "def update\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n respond_to do |format|\n if @dispense.update(dispense_params)\n format.html { redirect_to @dispense, notice: 'Dispense was successfully updated.' }\n format.json { render :show, status: :ok, location: @dispense }\n else\n format.html { render :edit }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service.update(service_params.except(:counter))\n format.html { redirect_to @service, notice: 'Service was successfully updated.' }\n format.json { render :show, status: :ok, location: @service }\n else\n format.html { render :edit }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @bookkeeping.update(bookkeeping_params)\n head :no_content\n else\n render json: @bookkeeping.errors, status: :unprocessable_entity\n end\n end", "def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @cancellations = args[:cancellations] if args.key?(:cancellations)\n @id = args[:id] if args.key?(:id)\n @price = args[:price] if args.key?(:price)\n @product = args[:product] if args.key?(:product)\n @quantity_canceled = args[:quantity_canceled] if args.key?(:quantity_canceled)\n @quantity_delivered = args[:quantity_delivered] if args.key?(:quantity_delivered)\n @quantity_ordered = args[:quantity_ordered] if args.key?(:quantity_ordered)\n @quantity_pending = args[:quantity_pending] if args.key?(:quantity_pending)\n @quantity_returned = args[:quantity_returned] if args.key?(:quantity_returned)\n @quantity_shipped = args[:quantity_shipped] if args.key?(:quantity_shipped)\n @return_info = args[:return_info] if args.key?(:return_info)\n @returns = args[:returns] if args.key?(:returns)\n @shipping_details = args[:shipping_details] if args.key?(:shipping_details)\n @tax = args[:tax] if args.key?(:tax)\n end", "def update\n @counter_order = CounterOrder.find(params[:id])\n\n respond_to do |format|\n if @counter_order.update_attributes(params[:counter_order])\n format.html { redirect_to @counter_order, notice: 'Counter order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @counter_order.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 donation based on the id\n donation = Donation.find_by(id: the_id)\n\n # update it\n if donation.update!(\n amount: params[:amount],\n frequency: params[:frequency])\n render json: donation.as_json\n else\n render json: {errors: donation.errors.full_messages}\n end\n end", "def update\n put :update\n end", "def update\n authorize! :update, Discharge\n respond_to do |format|\n if @discharge.update(discharge_params)\n format.html { redirect_to @discharge, notice: 'Discharge was successfully updated.' }\n format.json { render :show, status: :ok, location: @discharge }\n else\n format.html { render :edit }\n format.json { render json: @discharge.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dislike_count.update(dislike_count_params)\n format.html do\n redirect_to @dislike_count,\n notice: 'Dislike count was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @dislike_count }\n else\n format.html { render :edit }\n format.json do\n render json: @dislike_count.errors,\n status: :unprocessable_entity\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.json { head :no_content }\n else\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update # PATCH\n raise NotImplementedError\n end", "def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def update\n @postdiscount = Postdiscount.find(params[:id])\n\n respond_to do |format|\n if @postdiscount.update_attributes(params[:postdiscount])\n format.html { redirect_to(@postdiscount, :notice => 'Postdiscount was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @postdiscount.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n # format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n @tax = Tax.find(params[:id])\n\n if @tax.update(tax_params)\n head :no_content\n else\n render json: @tax.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @discount_amount = args[:discount_amount] if args.key?(:discount_amount)\n @discount_ratio_micros = args[:discount_ratio_micros] if args.key?(:discount_ratio_micros)\n @recurrence_count = args[:recurrence_count] if args.key?(:recurrence_count)\n @region_code = args[:region_code] if args.key?(:region_code)\n end", "def update\n respond_to do |format|\n if @dumb_counter.update(dumb_counter_params)\n format.html { redirect_to @dumb_counter, notice: 'Dumb counter was successfully updated.' }\n format.json { render :show, status: :ok, location: @dumb_counter }\n else\n format.html { render :edit }\n format.json { render json: @dumb_counter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n standard_update(Interest, params[:id], interest_params)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n product = Product.find(params[:id])\n product_details = params.permit(:title, :inventory_count, :price)\n\n product.update(product_details)\n\n render json: product\n end", "def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n # if @bonus.update(bonus_params)\n # render :show, status: :ok, location: @bonus\n # else\n # render json: @bonus.errors, status: :unprocessable_entity\n # end\n end", "def update\n respond_to do |format|\n if @order.status == \"preparing\"\n format.json { render text: '', status: 409 }\n else\n if @order.update(order_params)\n @drink = Drink.where(drink: @order.drink).first\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n response_json = {drink: @drink.drink, cost: @drink.cost, additions: @order.additions, _links: { next: {profile: \"http://#{my_address}:3000/payment\", href: \"http://#{my_address}:3000/payments/order/#{@order.id}\", enctype: 'application/json'}}}\n format.json { render text: response_json, status: :created, location: @order }\n \n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end", "def update\n respond_to do |format|\n if @dis_ingredient.update(dis_ingredient_params)\n format.html { redirect_to @dis_ingredient, notice: 'Dis ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_ingredient }\n else\n format.html { render :edit }\n format.json { render json: @dis_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @insurance = load_insurance\n @group ||= load_group\n @discount = load_discount\n\n respond_to do |format|\n if @discount.update(discount_params)\n format.html { redirect_to insurance_group_path(@insurance, @group), success: t('activerecord.messages.successfull.updated', data: @discount.fullname) }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @discount.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_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n #format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :ok }\n else\n #format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @commission_fixing = CommissionFixing.find(params[:id])\n if @commission_fixing.update_attributes(params[:commission_fixing])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@commission_fixing.errors)\n end \n end", "def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to cookbook_path(@cookbook), notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_discount_with_http_info(location_id, discount_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1ItemsApi.update_discount ...\"\n end\n # verify the required parameter 'location_id' is set\n fail ArgumentError, \"Missing the required parameter 'location_id' when calling V1ItemsApi.update_discount\" if location_id.nil?\n # verify the required parameter 'discount_id' is set\n fail ArgumentError, \"Missing the required parameter 'discount_id' when calling V1ItemsApi.update_discount\" if discount_id.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling V1ItemsApi.update_discount\" if body.nil?\n # resource path\n local_var_path = \"/v1/{location_id}/discounts/{discount_id}\".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'discount_id' + '}', discount_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'V1Discount')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1ItemsApi#update_discount\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @counter.update(counter_params)\n format.html { redirect_to @counter, notice: 'Counter was successfully updated.' }\n format.json { render :show, status: :ok, location: @counter }\n else\n format.html { render :edit }\n format.json { render json: @counter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dislike.update(dislike_params)\n format.html { redirect_to @dislike, notice: 'Dislike was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dislike.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @petty_cash_expense.update(petty_cash_expense_params)\n format.json { render :show, status: :ok, location: @petty_cash_expense }\n else\n format.json { render json: @petty_cash_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end", "def update\n @cookbook = Cookbook.find(params[:id])\n\n respond_to do |format|\n if @cookbook.update_attributes(params[:cookbook])\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to @expense, notice: 'Expense was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n if @refund_request.update_attributes(params[:refund_request])\n format.html { redirect_to @refund_request, notice: 'Refund request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n if @refund.update_attributes(params[:refund])\n format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n calculate_nutrients \n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @total_closing.update(total_closing_params)\n format.html { redirect_to @total_closing, notice: 'Total closing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @total_closing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @consensu = Consensu.find(params[:id])\n\n respond_to do |format|\n if @consensu.update_attributes(params[:consensu])\n format.html { redirect_to @consensu, notice: 'Consensu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @consensu.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @expense_report\n\n\n @expense_report.actual_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @expense_report.trip.destination\n req.expense_type = 'actual'\n end\n end\n\n\n respond_to do |format|\n if @expense_report.update(expense_report_params)\n format.html { redirect_to @expense_report, notice: 'Expense report was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense_report }\n else\n format.html { render :edit }\n format.json { render json: @expense_report.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 patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update!(**args)\n @discount = args[:discount] if args.key?(:discount)\n @offer_ids = args[:offer_ids] if args.key?(:offer_ids)\n @sub_type = args[:sub_type] if args.key?(:sub_type)\n @tax_impact = args[:tax_impact] if args.key?(:tax_impact)\n @type = args[:type] if args.key?(:type)\n end", "def update\n @bill = Bill.find_by(uid:params[:id]).extend(Billit::BillRepresenter)\n @bill.from_json(request.body.read)\n @bill.save\n begin\n Sunspot.index!(@bill)\n rescue\n puts \"#{$!}\"\n puts \"unindexed bill: \" + @bill.uid\n end\n respond_with @bill, :represent_with => Billit::BillRepresenter\n end", "def update\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n if @bidding.update_attributes(params[:bidding])\n format.html { redirect_to @bidding, notice: 'Bidding was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bidding.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe = Recipe.find(params[:id])\n\n if recipe.user == current_user\n recipe.update(recipe_params)\n render json: { recipe: params[:id], deleted: true }\n else\n render json: { recipe: params[:id], deleted: false }\n end\n end", "def update\n @expense = Expense.find(params[:id])\n\n respond_to do |format|\n if @expense.update_attributes(params[:expense])\n format.html { redirect_to expenses_url, notice: 'Expense was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n current_user\n respond_to do |format|\n if @consumable.update(consumable_params)\n format.html { redirect_to @consumable, notice: 'Consumable was successfully updated.' }\n format.json { render :show, status: :ok, location: @consumable }\n else\n format.html { render :edit }\n logger.error \"There was an error updating the consumable\"\n logger.error json: @consumable.errors\n format.json { render json: @consumable.errors, status: :unprocessable_entity }\n end\n end\n Consumable.reindex\n end", "def update\n respond_to do |format|\n if @barrels_income.update(barrels_income_params)\n format.html { redirect_to @barrels_income, notice: 'Barrels income was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @barrels_income.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @inciting_incident.update(inciting_incident_params)\n render json: @inciting_incident\n else\n render json: @inciting_incident.errors, status: :unprocessable_entity\n end\n end", "def update\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n if @refund.update_attributes(params[:refund])\n format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @refund.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update_resource @ride, ride_params\n end", "def update\n @client.update(client_params)\n render json: @client\n end", "def update\n respond_to do |format|\n if @dish_in_basket.update(dish_in_basket_params)\n format.html { redirect_to @dish_in_basket, notice: 'Dish in basket was successfully updated.' }\n format.json { render :show, status: :ok, location: @dish_in_basket }\n else\n format.html { render :edit }\n format.json { render json: @dish_in_basket.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n respond_to do |format|\n if @counter_service.update(counter_service_params)\n format.html { redirect_to @counter_service, notice: 'Counter service was successfully updated.' }\n format.json { render :show, status: :ok, location: @counter_service }\n else\n format.html { render :edit }\n format.json { render json: @counter_service.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @incoming_service_tax\n\n respond_to do |format|\n if @incoming_service_tax.update(incoming_service_tax_params)\n format.html { redirect_to @incoming_service_tax, notice: 'Incoming service tax was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @incoming_service_tax.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n Item.where([\"budget_id = #{params[:id]}\"]).update_all(budget_id: nil)\n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: params[:id])\n end\n end\n format.html { redirect_to budgets_path, notice: \"Budget was successfully updated.\" }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @disclaimer = Disclaimer.find(params[:id])\n @disclaimers = Disclaimer.all\n\n respond_to do |format|\n if @disclaimer.update_attributes(params[:disclaimer])\n @disclaimers = Disclaimer.all\n format.html { redirect_to @disclaimer, notice: 'Disclaimer was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @disclaimer.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n @bill = Bill.find(params[:id])\n\n if @bill.update(params[:bill])\n head :no_content\n else\n render json: @bill.errors, status: :unprocessable_entity\n end\n end", "def update\n record = TaxRule.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end", "def update\n @finance = Finance.find(params[:id])\n\n respond_to do |format|\n if @finance.update_attributes(params[:finance])\n format.html { redirect_to @finance, notice: 'Finance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finance.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6797258", "0.6556416", "0.6543301", "0.63482124", "0.6324844", "0.6278978", "0.6264766", "0.6238197", "0.62347627", "0.61171615", "0.6073157", "0.606955", "0.6064991", "0.60589355", "0.60543275", "0.60539436", "0.60486466", "0.6045954", "0.6045203", "0.60366195", "0.599912", "0.5998961", "0.59654164", "0.5962743", "0.5950549", "0.59321237", "0.592578", "0.5923072", "0.5922069", "0.5918519", "0.5892894", "0.58914375", "0.58898556", "0.5889501", "0.5884762", "0.587881", "0.58745223", "0.58719313", "0.58671945", "0.5857234", "0.5855792", "0.5855792", "0.5854738", "0.58404595", "0.58393395", "0.58184505", "0.5805186", "0.5802162", "0.5795407", "0.5790833", "0.57859486", "0.57768095", "0.5768137", "0.57649547", "0.5762035", "0.5754346", "0.57450336", "0.57447726", "0.5732594", "0.5726829", "0.5721423", "0.5719006", "0.5716665", "0.5714468", "0.5709809", "0.5702459", "0.5694648", "0.5693192", "0.5688035", "0.5685318", "0.56741786", "0.5669908", "0.56671333", "0.5663466", "0.5662529", "0.56595206", "0.56578106", "0.565474", "0.56541467", "0.5651982", "0.5650921", "0.5647929", "0.56464666", "0.56460357", "0.5643836", "0.56437117", "0.56409365", "0.5639717", "0.5639543", "0.5638394", "0.56378675", "0.5636136", "0.5635408", "0.56350857", "0.5632501", "0.5629536", "0.56235045", "0.56192243", "0.5614874", "0.56134474" ]
0.6473997
3
DELETE /discounts/1 DELETE /discounts/1.json
def destroy @pricing_id=@discount.pricing_id @discount.destroy respond_to do |format| format.html { redirect_to discounts_url(id: @pricing_id), notice: 'Discount was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @discount = Discount.find(params[:id])\n @discount.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_discounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @discount = Discount.find(params[:id])\n @discount.destroy\n\n respond_to do |format|\n format.html { redirect_to discounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @discount = Discount.find(params[:id])\n @discount.destroy\n\n respond_to do |format|\n format.html { redirect_to(discounts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.find(params[:id])\n @dish_discount.destroy\n\n respond_to do |format|\n format.html { redirect_to store_dish_discounts_url(@store) }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @admin_discount.destroy\n respond_to do |format|\n format.html { redirect_to admin_discounts_url, notice: 'Discount was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quantity_discount = QuantityDiscount.find(params[:id])\n @quantity_discount.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_quantity_discounts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @discount_activity.destroy\n respond_to do |format|\n format.html { redirect_to discount_activities_url, notice: 'Discount activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @postdiscount = Postdiscount.find(params[:id])\n @postdiscount.destroy\n\n respond_to do |format|\n format.html { redirect_to(postdiscounts_url) }\n format.xml { head :ok }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete\n request(:delete)\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @dislike_count.destroy\n respond_to do |format|\n format.html do\n redirect_to dislike_counts_url,\n notice: 'Dislike count was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @cash_dispense = CashDispense.find(params[:id])\n @cash_dispense.destroy\n\n respond_to do |format|\n format.html { redirect_to cash_dispenses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @discounts_product.destroy\n respond_to do |format|\n format.html { redirect_to discounts_products_url, notice: 'Discounts product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @purchase.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @dish.destroy\n respond_to do |format|\n format.html { redirect_to dishes_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 }\n format.json { head :no_content }\n end\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(*args)\n request(:delete, *args)\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n authorize! :destroy, Discharge\n @discharge.destroy\n respond_to do |format|\n format.html { redirect_to discharges_url, notice: 'Discharge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @counter_order = CounterOrder.find(params[:id])\n @counter_order.destroy\n\n respond_to do |format|\n format.html { redirect_to counter_orders_url }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @dish = Dish.find(params[:id])\n @dish.destroy\n\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish = Dish.find(params[:id])\n @dish.destroy\n\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def destroy\n @restaurant_dish = Restaurant::Dish.find(params[:id])\n @restaurant_dish.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurant_dishes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @discharge = Discharge.find(params[:id])\n @discharge.destroy\n\n respond_to do |format|\n format.html { redirect_to(discharges_url) }\n format.xml { head :ok }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def destroy\n respond_with @expense.destroy, status: 204\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to account_statement_url(params[:account_id],params[:statement_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_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: 'Блюдо уничтожено.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @donate.destroy\n\n respond_to do |format|\n format.html { redirect_to(donates_url) }\n format.json { head :no_content }\n end\n end", "def destroy\n @donate.destroy\n\n respond_to do |format|\n format.html { redirect_to(donates_url) }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_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 @dish = Dish.find(params[:id])\n @dish.destroy\n\n respond_to do |format|\n format.html { redirect_to my_page_path }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete!\n request! :delete\n end", "def destroy\n @repurchase = Repurchase.find(params[:id])\n @repurchase.destroy\n\n respond_to do |format|\n format.html { redirect_to repurchases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_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 restaurant_dishes_path, notice: 'Dish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Like.delete(params[\"id\"])\n end", "def destroy\n @dispute.destroy\n respond_to do |format|\n format.html { redirect_to disputes_url, notice: 'Dispute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense = Expense.find params.fetch(:id)\n @expense.destroy\n head :no_content\n end", "def destroy\n @diapo = current_church.diapos.find(params[:id])\n @diapo.destroy\n\n respond_to do |format|\n format.html { redirect_to diapos_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n #binding.pry\n @balance = Balance.find(params[:id])\n @balance.destroy\n respond_to do |format|\n format.html { redirect_to balances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @much_withdraw.destroy\n respond_to do |format|\n format.html { redirect_to much_withdraws_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: 'Dish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def destroy\n if params[:id] =~ /\\d+/\n @budget = Budget.find(params[:id])\n ActiveRecord::Base.connection.execute(\"delete from budget_products where budget_id = #{params[:id]}\")\n @budget.destroy\n end\n \n respond_to do |format|\n format.html { redirect_to budgets_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 @tax_rate = TaxRate.find(params[:id])\n @tax_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to tax_rates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :ok }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :ok }\n end\n end", "def destroy\n @disc.destroy\n respond_to do |format|\n format.html { redirect_to discs_url, notice: 'Disc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchases.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Purchase deleted with success.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @census_count = CensusCount.find(params[:id])\n @census_count.destroy\n\n respond_to do |format|\n format.html { redirect_to census_counts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end", "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end", "def delete\n\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 @daily_data_payment.destroy\n respond_to do |format|\n format.html { redirect_to daily_data_payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recharge.destroy\n respond_to do |format|\n format.html { redirect_to recharges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7449483", "0.7434036", "0.7138962", "0.7128333", "0.7004147", "0.692219", "0.6820708", "0.67317945", "0.67166585", "0.6705001", "0.6704677", "0.66711086", "0.66711086", "0.66711086", "0.66711086", "0.6670657", "0.66672397", "0.66533476", "0.66445726", "0.6643081", "0.6643081", "0.6633452", "0.661675", "0.6613525", "0.6607362", "0.6583094", "0.6542556", "0.65361404", "0.6523878", "0.6513882", "0.6513882", "0.65082467", "0.6502803", "0.64912075", "0.6490899", "0.64852023", "0.648255", "0.64809436", "0.64809436", "0.6465636", "0.6464008", "0.645757", "0.645757", "0.6455744", "0.6442506", "0.6441191", "0.6431845", "0.64306825", "0.64251596", "0.64167035", "0.6415937", "0.6412324", "0.64094424", "0.6407396", "0.6407396", "0.6403418", "0.6401532", "0.6399511", "0.6393704", "0.6390526", "0.6383022", "0.63824403", "0.6381472", "0.6381333", "0.6378613", "0.63723326", "0.6371787", "0.6365953", "0.63539934", "0.63522655", "0.6352154", "0.63464093", "0.6345749", "0.6344536", "0.6343445", "0.63361144", "0.6335236", "0.632386", "0.63203216", "0.63203216", "0.6319973", "0.6316852", "0.6316783", "0.63153875", "0.6315167", "0.6315167", "0.6313858", "0.63132477", "0.63119483", "0.63114417", "0.63114417", "0.63114417", "0.63114417", "0.63114417", "0.6311379", "0.6310273", "0.6308794", "0.63048875", "0.63048875", "0.63048875" ]
0.68796676
6
Use callbacks to share common setup or constraints between actions.
def set_discount @discount = Discount.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def discount_params params.fetch(:discount, {}) 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
options :name :sleep timeout between spawns :log_file :sync_log :working_dir for log :after_fork
def initialize(opts = {}, &block) @opts = opts @block = block @opts[:sync_log] ||= true raise "block should be" unless block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_fork(options = {})\n return unless needs_after_fork_work?\n\n ::NewRelic::Agent.logger.debug(\"Starting the worker thread in #{Process.pid} (parent #{Process.ppid}) after forking.\")\n\n channel_id = options[:report_to_channel]\n install_pipe_service(channel_id) if channel_id\n\n # Clear out locks and stats left over from parent process\n reset_objects_with_locks\n drop_buffered_data\n\n setup_and_start_agent(options)\n end", "def after_fork\n end", "def before_fork; end", "def spawn(child_name)\n raise ArgumentError.new(\"empty child_name\") if child_name.to_s.empty?\n\n @child_loggers[child_name] ||= create_child_logger(child_name)\n @child_loggers[child_name]\n end", "def before_fork(&block); end", "def fork_and_work\n cpid = fork {setup_child; work}\n log(:at => :fork, :pid => cpid)\n Process.wait(cpid)\n end", "def worker_boot_timeout(timeout); end", "def after_fork\n end", "def spawn_sleepers(exp, cookie)\n Thread.new { system \"ruby test/fork_tree.rb -- #{exp} 100 #{cookie}\" }\n on_windows = RUBY_PLATFORM =~ /win/ && RUBY_PLATFORM !~ /darwin/\n sleep on_windows ? 0.5 : 0.1\n pid_file = \"#{cookie}.pid\"\n @pid_files ||= []\n @pid_files << pid_file\n pid = File.read(pid_file).to_i\n sleep on_windows ? 0.4 : 0.5\n return pid\n end", "def initialize(options={})\n @root = File.expand_path('../../../../../', __FILE__)\n \n if @log.nil?\n # @logdir = @root + \"/log/worker\"\n # FileUtils.mkdir_p @logdir\n # @logfile = @logdir + \"/#{self.class.to_s.downcase}.log\"\n # FileUtils.touch @logfile\n \n @log = Logger.new(STDOUT) #MultiDelegator.delegate(:write, :close).to(STDOUT, File.open(@logfile,'a'))\n @log.level = Logger::WARN # TODO Only log if development environment\n \n @log.formatter = proc do |severity, datetime, progname, msg|\n \"[#{severity}] - #{datetime}: #{msg}\\n\"\n end\n \n @log.info(\"Started logging in: #{@logfile}\")\n end\n \n return self\n end", "def spawn( options = {} )\n assert_valid_keys( options, :wait )\n wait = options[:wait]\n\n if ! wait then\n Hive::Worker.spawn kind, registry: registry, policy: policy, name: name\n return\n end\n\n before = registry.checked_workers( policy ).live\n\n Hive::Worker.spawn kind, registry: registry, policy: policy, name: name\n\n Hive::Idler.wait_until( 10 ) do\n after = registry.checked_workers( policy ).live\n diff = ( after - before ).select { |k| k.host == Hive::Key.local_host }\n diff.size > 0\n end\n end", "def forked\n call_hooks :after, :fork\n end", "def forked\n call_hooks :after, :fork\n end", "def run\n return if @files.empty?\n $stderr.write @files.inspect+\"\\n\"; $stderr.flush\n @cores.times do |c|\n @pipes << PipeDream.new\n @children << SafeFork.fork do\n Signal.trap(\"TERM\") { exit }\n Signal.trap(\"HUP\") { exit }\n pipe = @pipes.last\n pipe.identify_as_child\n pipe.write(\"[Worker #{c}] Booted\\n\")\n @result = Test::Unit::TestResult.new\n @result.add_listener(Test::Unit::TestResult::FAULT) do |value|\n $stderr.write value\n $stderr.write \"\\n\\n\"\n $stderr.flush\n end\n while !pipe.eof?\n file = pipe.gets.chomp\n begin\n pipe.write \"[Worker #{c} Starting: #{file}\\n\"\n start = Time.now\n\n klasses = Multitest.find_classes_in_file(file)\n klasses.each{|k| k.suite.run(@result){|status, name| ;}}\n \n finish = Time.now\n pipe.write \"[Worker #{c}] Completed: #{file} (#{finish-start})\\n\"\n rescue => ex\n pipe.write \"[Worker #{c}] Failed: #{file} - #{ex.to_s}\\n\"\n end\n end\n $stderr.write @result.to_s\n $stderr.write \"\\n\"\n $stderr.flush\n pipe.close\n end\n end\n\n total_files = @files.size\n @threads = []\n @pipes.each do |_p|\n @threads << Thread.new(_p) do |p|\n Signal.trap(\"TERM\") { exit }\n p.identify_as_parent\n # boot message\n p.gets\n while !@files.empty? \n # puts \"#{total_files - @files.size}/#{total_files}\"\n # send a file\n p.write(\"#{@files.pop}\\n\")\n # print the start message\n msg = p.gets\n # $stdout.write msg; $stdout.flush\n # wait for the complete message\n msg = p.gets\n # print complete message\n if msg =~ /Completed/\n # $stdout.write msg; $stdout.flush\n else\n $stderr.write msg; $stderr.flush\n end\n end\n p.close\n end\n end\n\n Signal.trap(\"TERM\") do\n puts \"Exiting\"\n @children.each{|c| Process.kill(\"TERM\",c)}\n @threads.each{|t| Thread.kill(t)}\n end\n\n @threads.each{|t| t.join}\n @children.each{|c| Process.wait(c)}\n end", "def after_fork(&block)\n end", "def before_fork\n \n end", "def initialize(options={})\n @verbosity = (options[:verbosity] || 0).to_i # verbosity level\n @zombie_term_wait = options[:zombie_term_wait] || 20 # time to wait before TERM\n @zombie_kill_wait = ENV['RESQUE_TERM_TIMEOUT'].to_i + @zombie_term_wait unless ENV['RESQUE_TERM_TIMEOUT'].nil?\n @zombie_kill_wait ||= options[:zombie_kill_wait] || 60 # time to wait before -9\n @hostile_takeover = options[:force] # kill running kewatcher?\n @rakefile = File.expand_path(options[:rakefile]) rescue nil\n @rakefile = File.exists?(@rakefile) ? @rakefile : nil if @rakefile\n @pidfile = File.expand_path(options[:pidfile]) rescue nil\n @pidfile = @pidfile =~ /\\.pid$/ ? @pidfile : @pidfile + '.pid' if @pidfile\n save_pid!\n\n @max_children = options[:max_children] || 10\n @hostname = `hostname -s`.chomp.downcase\n @hostname_full = `hostname`.chomp.downcase\n @pids = Hash.new # init pids array to track running children\n @need_queues = Array.new # keep track of pids that are needed\n @dead_queues = Array.new # keep track of pids that are dead\n @zombie_pids = Hash.new # keep track of zombie's we kill and dont watch(), with elapsed time we've waited for it to die\n @async = options[:async] || false # sync and wait by default\n @hupped = 0\n\n Resque.redis = case options[:config]\n when Hash\n [options[:config]['host'], options[:config]['port'], options[:config]['db'] || 0].join(':')\n else\n options[:config]\n end\n end", "def forking\n call_hooks :before, :fork\n end", "def forking\n call_hooks :before, :fork\n end", "def before_fork\n end", "def sys(str, log = nil)\n puts [str, log && log.color(:yellow)].compact.join(' > ')\n\n cmd = [str, log].compact.join(' > ')\n\n pid = Process.spawn(cmd)\n begin\n Timeout::timeout(TIMELIMIT) do\n Process.wait(pid)\n end\n rescue Timeout::Error\n puts \"command out of time, re-Run\".bright\n system(\"pkill -TERM -P #{pid}\")\n sys(str, log)\n end\nend", "def after_fork\n @after_fork ||= default_after_fork\n end", "def after_worker_fork(&block); end", "def _spawn\n t = Thread.new do\n catch(:die) do\n loop do\n begin\n io = IO.popen(\"#{@ruby} #{@tmp.path}\", 'r')\n cid = Integer(line = io.gets)\n\n @cids.sync {@cids << cid} if cid > 0\n Process.wait cid\n rescue SystemCallError # if the child has already died\n rescue Exception => err\n child_err = Marshal.load(line) rescue nil\n err = child_err unless child_err.nil?\n\n STDERR.puts err.inspect\n STDERR.puts err.backtrace.join(\"\\n\")\n throw :die\n ensure\n line = io.read\n child_err = Marshal.load(line) rescue nil\n\n io.close rescue nil\n @cids.sync {\n @cids.delete cid\n throw :die unless @cids.length < @spawn or child_err\n }\n raise child_err unless child_err.nil?\n end\n\n throw :die if @stop\n sleep @pause\n\n end # loop\n end # catch(:die)\n end # Thread.new\n\n @group.add t\n t\n end", "def join\n respawn = true\n last_check = Time.now\n\n proc_name 'master'\n logger.info \"master process ready\" # test_exec.rb relies on this message\n if @ready_pipe\n @ready_pipe.syswrite($$.to_s)\n @ready_pipe = @ready_pipe.close rescue nil\n end\n begin\n reap_all_workers\n case SIG_QUEUE.shift\n when nil\n # avoid murdering workers after our master process (or the\n # machine) comes out of suspend/hibernation\n if (last_check + @timeout) >= (last_check = Time.now)\n sleep_time = murder_lazy_workers\n else\n sleep_time = @timeout/2.0 + 1\n @logger.debug(\"waiting #{sleep_time}s after suspend/hibernation\")\n end\n maintain_worker_count if respawn\n master_sleep(sleep_time)\n when :QUIT # graceful shutdown\n break\n when :TERM, :INT # immediate shutdown\n stop(false)\n break\n when :USR1 # rotate logs\n logger.info \"master reopening logs...\"\n Unicorn::Util.reopen_logs\n logger.info \"master done reopening logs\"\n soft_kill_each_worker(:USR1)\n when :USR2 # exec binary, stay alive in case something went wrong\n reexec\n when :WINCH\n if Unicorn::Configurator::RACKUP[:daemonized]\n respawn = false\n logger.info \"gracefully stopping all workers\"\n soft_kill_each_worker(:QUIT)\n self.worker_processes = 0\n else\n logger.info \"SIGWINCH ignored because we're not daemonized\"\n end\n when :TTIN\n respawn = true\n self.worker_processes += 1\n when :TTOU\n self.worker_processes -= 1 if self.worker_processes > 0\n when :HUP\n respawn = true\n if config.config_file\n load_config!\n else # exec binary and exit if there's no config file\n logger.info \"config_file not present, reexecuting binary\"\n reexec\n end\n end\n rescue => e\n Unicorn.log_error(@logger, \"master loop error\", e)\n end while true\n stop # gracefully shutdown all workers on our way out\n logger.info \"master complete\"\n unlink_pid_safe(pid) if pid\n end", "def after_fork\n nil\n end", "def run_tests()\n Signal.trap(\"CLD\") {@process_counter += 1}\n for setting in @settings\n Process.wait if @process_counter <= 0\n @process_counter -= 1\n fork do\n temp_name, log = copy_and_edit(setting)\n puts \"Running: \" + setting[:material] + \" \" + setting[:length] + \"cm \" + setting[:energy] + \"MeV\"\n system(@output_dir + \"Hadr06 \" + temp_name + \" > \" + log)\n relocate(setting)\n clean()\n end\n end\nend", "def pause_before_fork_in_parent\n super\n end", "def run_tests()\r\n Signal.trap(\"CLD\") {@process_counter += 1}\r\n for setting in @settings\r\n Process.wait if @process_counter <= 0\r\n @process_counter -= 1\r\n fork do\r\n temp_name, log = copy_and_edit(setting)\r\n puts \"Running: \" + String(setting[0][:materials]) + \" \" + String(setting[0][:lengths]) + \"cm \" + String(setting[0][:energy]) + \"MeV\"\r\n cmd = String(@output_dir) + \"Hadr06 \" + String(temp_name) + \" > \" + String(log)\r\n system(@output_dir + \"Hadr06 \" + temp_name + \" > \" + log)\r\n relocate(setting)\r\n clean()\r\n end\r\n end\r\nend", "def pre_sleep; end", "def get_logger()\n sleep $options[:log_delay]\n return $logger\nend", "def worker_timeout(timeout); end", "def fork\n Daemons.daemonize @options\n loop do\n update_method.call\n sleep Settings[:timeout]\n end\n end", "def fork\n nil\n end", "def fork_master_child_and_monitor\n @fork_master_pid = Kernel.fork do\n at_exit_to_master_child_fork\n Process.die_with_parent\n BEANPICKER_FORK[:child_master] = true\n $0 = \"Beanpicker master child #{@job_name}##{@number}\"\n work_loop(self)\n end\n @loop = Thread.new(self) do |child|\n Process.waitpid @fork_master_pid\n child.fork_master_child_and_monitor if child.running?\n end\n end", "def sleepy_run; end", "def spawn_and_wait(instance)\n instance.register\n\n 20.times do\n instance.send(:connection_open?) ? break : sleep(0.1)\n end\n\n # Extra time to make sure the output can attach\n sleep 1\n end", "def on_worker_fork(&block); end", "def run_spork(options = [])\n pid = fork { Spork::Runner.run(options, $stdout, $stderr) }\n Process.detach(pid)\n pid\n end", "def test_master_process_should_get_log_of_agents\n $argv_dup = ['a_test_case.rb']\n suite = Test::Unit::TestSuite.new('test_master_process_should_get_log_of_agents')\n suite << ATestCase.suite\n assert_fork_process_exits_ok do\n runit(suite)\n end\n logs = @logger.logs.flatten.join(\"\\n\")\n assert(/From #{Socket.gethostname}: => Herald starts off\\.\\.\\./ =~ logs)\n assert(/From #{Socket.gethostname}: runner0: test files loaded/ =~ logs)\n #when use Delegator to implement UndumpedLogger, there are lots of 'nil' in the log\n assert(/nil/ !~ logs)\n end", "def spawn(name, crit, *args, &block)\n\t\tt = nil\n\n\t\tif block\n\t\t\tt = ::Thread.new(name, crit, caller, block, *args) do |*argv|\n\t\t\t\t::Thread.current[:tm_name] = argv.shift.to_s\n\t\t\t\t::Thread.current[:tm_crit] = argv.shift\n\t\t\t\t::Thread.current[:tm_call] = argv.shift\n\t\t\t\t::Thread.current[:tm_time] = Time.now\n\n\t\t\t\tbegin\n\t\t\t\t\targv.shift.call(*argv)\n\t\t\t\trescue ::Exception => e\n\t\t\t\t\telog(\"thread exception: #{::Thread.current[:tm_name]} critical=#{::Thread.current[:tm_crit]} error:#{e.class} #{e} source:#{::Thread.current[:tm_call].inspect}\")\n\t\t\t\t\telog(\"Call Stack\\n#{e.backtrace.join(\"\\n\")}\")\n\t\t\t\t\traise e\n\t\t\t\tensure\n\t\t\t\t\tif framework.db and framework.db.active\n\t\t\t\t\t\t# NOTE: despite the Deprecation Warning's advice, this should *NOT*\n\t\t\t\t\t\t# be ActiveRecord::Base.connection.close which causes unrelated\n\t\t\t\t\t\t# threads to raise ActiveRecord::StatementInvalid exceptions at\n\t\t\t\t\t\t# some point in the future, presumably due to the pool manager\n\t\t\t\t\t\t# believing that the connection is still usable and handing it out\n\t\t\t\t\t\t# to another thread.\n\t\t\t\t\t\t::ActiveRecord::Base.connection_pool.release_connection\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tt = ::Thread.new(name, crit, caller, *args) do |*argv|\n\t\t\t\t::Thread.current[:tm_name] = argv.shift\n\t\t\t\t::Thread.current[:tm_crit] = argv.shift\n\t\t\t\t::Thread.current[:tm_call] = argv.shift\n\t\t\t\t::Thread.current[:tm_time] = Time.now\n\t\t\t\t# Calling spawn without a block means we cannot force a database\n\t\t\t\t# connection release when the thread completes, so doing so can\n\t\t\t\t# potentially use up all database resources and starve all subsequent\n\t\t\t\t# threads that make use of the database. Log a warning so we can track\n\t\t\t\t# down this kind of usage.\n\t\t\t\tdlog(\"Thread spawned without a block!\")\n\t\t\t\tdlog(\"Call stack: \\n#{::Thread.current[:tm_call].join(\"\\n\")}\")\n\t\t\tend\n\t\tend\n\n\t\tself << t\n\t\tt\n\tend", "def fork\n raise \"httperf fork currently running\" if @fork_thr && @fork_thr.alive?\n @fork_out, @fork_err = ''\n @fork_thr = Open4::bg command, :stdin => nil, :stdout => @fork_out, :stderr => @fork_err\n @fork_thr\n end", "def fork_worker(after_requests = T.unsafe(nil)); end", "def spawn_detached(args); end", "def buildwise_montior_parallel_execution(build_id, opts = {}) \r\n start_time = Time.now \r\n \r\n default_opts = {:max_wait_time => 3600, :check_interval => 15}\r\n # default to checking ervery 10 seconds for one hour, unless specified\r\n the_opts = default_opts.merge(opts)\r\n \r\n max_wait_time = the_opts[:max_wait_time]\r\n check_interval = the_opts[:check_interval]\r\n \r\n max_wait_time = 1800 if max_wait_time < 60\r\n check_interval = 15 if check_interval < 5\r\n \r\n puts \"[buildwise.rake] Keep checking build |#{build_id} for max #{max_wait_time} for every #{check_interval} seconds\"\r\n \r\n fio = nil\r\n if ENV[\"ARTIFACT_DIR\"] && Dir.exist?(ENV[\"ARTIFACT_DIR\"])\r\n tmp_log_file = File.join(ENV[\"ARTIFACT_DIR\"], \"rake_parallel.log\") \r\n FileUtils.rm(tmp_log_file) if File.exist?(tmp_log_file)\r\n puts(\"[buildwise.rake] logging parallel monitoring to #{tmp_log_file}\")\r\n fio = File.open(tmp_log_file, \"a\") \r\n fio.puts(\"[#{Time.now}] Keep checking build |#{build_id}| for max #{max_wait_time} for every #{check_interval} seconds\")\r\n end\r\n \r\n begin \r\n Timeout::timeout(max_wait_time + 120) { \r\n \r\n $last_buildwise_server_build_status = nil\r\n while ((Time.now - start_time ) < max_wait_time) # test exeuction timeout\r\n the_build_status = buildwise_build_ui_test_status(build_id) rescue \"Pending\"\r\n if fio\r\n fio.puts(\"[#{Time.now}] build status => |#{the_build_status}|\")\r\n fio.flush\r\n end\r\n \r\n if ($last_buildwise_server_build_status != the_build_status)\r\n puts \"[Rake] #{Time.now} Checking build status: |#{the_build_status}|\"\r\n $last_buildwise_server_build_status = the_build_status\r\n end\r\n \r\n if the_build_status == \"OK\"\r\n fio.close\r\n exit 0\r\n elsif the_build_status == \"Failed\"\r\n fio.close\r\n exit -1\r\n else \r\n if (the_build_status != \"Pending\")\r\n puts(\"[Rake] functional testing status => #{the_build_status}, next check in #{check_interval} seconds\")\r\n end\r\n sleep check_interval # check the build status every minute\r\n end\r\n end\r\n \r\n }\r\n rescue Timeout::Error => e\r\n if fio\r\n fio.puts(\"[#{Time.now}] execution timeouts!\")\r\n fio.close\r\n end \r\n puts(\"[Rake] execution time outs!\")\r\n exit -3 \r\n end\r\n \r\n puts \"[Rake] Execution UI tests expired\"\r\n if fio\r\n fio.puts(\"[#{Time.now}] ends normally\")\r\n fio.close\r\n end\r\n exit -2\r\nend", "def log(msg)\n @script = File.basename $0 \n logfile = $config[\"settings\"][\"log_directory\"] + \"/#{@script}.log\"\n if $config[\"settings\"][\"log_file\"]\n File.open(logfile, 'a') do |file|\n now = Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")\n file.puts \"#{@script} #{now} -> #{msg}\"\n end\n end\n puts \"#{@script} -> #{msg}\"\nend", "def log_new(msg)\n @script = File.basename($0).split(/\\./)[0] \n logfile = $script_dir + \"/var/log/#{@script}_new.log\"\n logfile = $config[\"settings\"][\"log_directory\"] + \"/#{@script}_new.log\" if $config[\"settings\"].has_key? 'log_directory'\n if $config[\"settings\"][\"log_file\"]\n File.open(logfile, 'a') do |f|\n now = Time.new.strftime(\"%Y-%m-%d %H:%M:%S\")\n f.puts \"#{@script} #{now} -> #{msg}\"\n end\n end\n puts \"#{@script} -> #{msg}\"\nend", "def run\n while 1\n sleep(0.2)\n #puts \"bezim \"+@pid.to_s\n end\n end", "def background\n pid = fork do\n Process.setsid\n exit if fork\n\n Dir.chdir('/tmp')\n STDIN.reopen('/dev/null')\n STDOUT.reopen('/dev/null', 'a')\n STDERR.reopen('/dev/null', 'a')\n\n File.open(\"/var/run/puppetcommander.pid\", \"w\") do |pidfile|\n pidfile.puts $$\n end\n\n connect\n loop do\n begin\n log(\"Starting run: interval: #{@config[:interval]} concurrency: #{@config[:concurrency]}\")\n run(@config[:interval], @config[:concurrency])\n log(\"Run ended, restarting\")\n rescue Exception => e\n log(\"Runner raised an exception: #{e}\")\n log(e)\n sleep 5\n retry\n end\n end\n end\n\n Process.detach(pid)\nend", "def write_pid_file\n\t\texit(1) if File.exists?(\"#{RAILS_ROOT}/log/async-worker.#{PID_SUFFIX}.pid\")\n open(\"#{RAILS_ROOT}/log/async-worker.#{PID_SUFFIX}.pid\", \"w\") {|f| f << Process.pid << \"\\n\"}\n at_exit { File.unlink(\"#{RAILS_ROOT}/log/async-worker.#{PID_SUFFIX}.pid\") if read_pid_file == Process.pid }\n end", "def runlog_thread_filename(name)\n @filename + '-' + name.to_s\n end", "def fork # :nodoc\n @cant_fork = true\n nil # important due #work\n end", "def duplicity!(options ={})\n # this is just some idiom to declare some set of default options for the method\n # and adding whaterver overridden value comes down from the user.\n default_options = { single_step: false }\n default_options.merge!(options)\n\n duplicity_lock = \"#{run_dir}.duplicity.lock\"\n\n unless lock_file_present?(lock_file_name)\n begin\n unless lock_file_present?(duplicity_lock)\n logger.info \"#{duplicity_lock} not found, setting up a new duplicity remote backup.\"\n FileUtils.touch lock_file_name\n\n # Duplicity-specific log file\n dup_log_file_name = File.join(Conf.global_conf[:log_dir], \"#{run_name}.duplicity.log\")\n\n # Local tape archive location access data\n archive_user = Conf.global_conf[:mdc_archive_user]\n archive_host = Conf.global_conf[:mdc_archive_host]\n local_duplicity_cache = Conf.global_conf[:local_dup_cache_dir1]\n\n # Default set of flag/value pairs\n # the final line joins key-value pairs with a '=' char \n # i.e. '--ssh-backend=pexpect' and returns a list of such strings.\n duplicity_flags = {\n '--asynchronous-upload': nil,\n '--volsize': 1024,\n '--archive-dir': local_duplicity_cache,\n '--name': run_name,\n '--no-encryption': nil,\n '--tempdir': '/tmp',\n '--exclude': File.join(run_dir, 'demultiplexed_data'),\n '--verbosity': 8,\n '--allow-source-mismatch': nil\n }.collect{ |kv| kv.compact.join('=') }\n\n # The actual command line string being built\n cmd_line = ['duplicity']\n cmd_line += duplicity_flags\n cmd_line += [run_dir,\n \"pexpect+sftp://#{archive_user}@#{archive_host}/#{archive_dir}/#{run_name}\"]\n\n log_file = File.open(dup_log_file_name, 'a')\n\n logger.info \"Duplicity command line:\"\n logger.info cmd_line.join(' ')\n\n # Sub-process creation (see https://github.com/jarib/childprocess)\n duplicity_proc = ChildProcess.build(*cmd_line)\n\n # By default, the child process does not create a new\n # process group. This means there's no guarantee that the\n # entire process tree will die when the child process is\n # killed. To solve this we set \"leader\".\n duplicity_proc.leader = true\n\n # Assign output streams to the log file\n duplicity_proc.io.stdout = duplicity_proc.io.stderr = log_file\n\n # Start the data demultiplexing if we are not single\n # stepping and the samplesheet for the run exists.\n unless default_options[:single_step]\n if File.exists?(File.join(Conf.global_conf[:sample_sheets_dir], \"#{run_name}.csv\"))\n fork { demultiplex! }\n end\n end\n\n FileUtils.touch duplicity_lock\n\n # Start execution and wait for termination\n duplicity_proc.start\n logger.info \"Started duplicity remote backup procedure. See '#{dup_log_file_name}' for details.\"\n duplicity_proc.wait\n\n if duplicity_proc.exit_code == 0\n # Remove our duplicity-specific lock only on success\n FileUtils.rm duplicity_lock\n logger.info \"Duplicity successfully completed a remote backup.\"\n\n log_file.close if log_file\n FileUtils.rm lock_file_name if lock_file_present?(lock_file_name)\n\n # Call next step if allowed\n filter_data! unless default_options[:single_step]\n else\n raise Errors::DuplicityProcessError.new(\"'duplicity' exited with nonzero status\\ncheck '#{dup_log_file_name}' for details.\")\n end\n\n else\n raise Errors::DuplicityLockError.new(\"Duplicity lock file is still present! Aborting workflow.\")\n end\n rescue => e\n logger.error \"in duplicity backup function:\"\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n Mailer.notify_admins(self, \"duplicity_function\", e)\n ensure\n log_file.close if log_file\n FileUtils.rm lock_file_name if lock_file_present?(lock_file_name)\n end\n else\n logger.warn \"Main lock file \\\"#{lock_file_name}\\\" still there, skipping.\"\n end\n end", "def new_worker\n r_channel, w_channel = IO.pipe \n worker_number = @missing_workers.shift || @workers.length + 1 \n worker_pid = Process.fork do\n Process.egid= @options[:group]\n Process.euid= @options[:user]\n $0 = \"#{Orchestra::Configurator::DEFAULTS[:name]}_#{worker_number}\"\n # Close all sockets inherited from parent\n @workers.each_value { |worker| worker[:pipe].close }\n @workers = nil\n # Create a new musician \n r_channel.close\n logger = if @options[:daemonize]\n log_file = @options[:log_dir] + ::File::SEPARATOR + \"#{@options[:name]}.#{worker_number}.log\"\n Daemonize::redirect_io(log_file)\n Logger.new(log_file)\n else \n Logger.new(STDOUT)\n end\n worker = Musician.new(@servers, w_channel, logger )\n worker.run \n exit\n end\n @workers[worker_pid] = { :pipe => r_channel, :inactive => 0, :name => worker_number, :status => :ALIVE }\n @reactor.attach(:read, r_channel) do | pipe | \n begin\n pipe.sysread(1)\n @workers[worker_pid][:inactive] = 0\n rescue EOFError \n @reactor.detach(:read, pipe)\n @workers[worker_pid][:inactive] = @options[:timeout]\n end\n end\n end", "def initialize(aOptions)\n\t\t@options = aOptions\n\t\t@thread = nil\n\t\t@name = aOptions[:name] || random_word(8,8)\n\t\tif not @logger = aOptions[:logger]\n\t\t\t@logger = Logger.new(STDERR)\n\t\t\t@logger.level = Logger::DEBUG\n\t\tend\n\t\tself.start() if aOptions[:auto_start]\n\tend", "def log_worker(message)\n puts \"resque-pool-worker[#{Process.pid}]: #{message}\"\n #$stdout.fsync\n end", "def setup_child\n log(:at => \"setup_child\")\n end", "def open_process_log_file()\n if !File.directory?(LOG_DIRECTORY)\n FileUtils.mkdir_p(LOG_DIRECTORY)\n end\n success = false\n 3.times do |i|\n begin\n $process_file_path = get_open_process_log_filename()\n $process_file_descriptor = File.open($process_file_path, File::WRONLY|File::CREAT|File::EXCL)\n success = true\n break\n rescue Errno::EEXIST => exception \n sleep(0.01)\n end\n end\n unless success\n raise Exception.new('log file creation failed') # this exception should be captured by the standard rails production log\n end\n $process_file_size = 0 # incremented in event handler \n end", "def visit_fork_error\n puts(FORK_ERROR_MESSAGE)\n end", "def backup(frequency,dir,t,condition)\n frequency.each do |vm|\n break if (Time.now.hour >= 5) && (Time.now.hour <= 20)\n mkdir = system(\"mkdir #{BACKUP_DIR}#{dir}#{vm} > /dev/null 2>&1\")\n %x[/bin/rm #{BACKUP_DIR}#{dir}#{vm}/*.log] if (File.exist?(\"#{BACKUP_DIR}#{dir}#{vm}/#{frequency.last}-#{t.month}-#{t.year}.log\"))#{condition}\n next if File.exist?(\"#{BACKUP_DIR}#{dir}#{vm}/#{vm}-#{t.month}-#{t.year}.log\")\n @logger = Logger.new(\"#{BACKUP_DIR}#{dir}#{vm}/#{vm}-#{t.month}-#{t.year}.log\", LOG_AGE)\n @logger.info(\"Started running\")\n case true\n when DOE_POOL.include?(vm)\n server = ''\n pass = \"\"\n when DOMAIN_POOL.include?(vm)\n server = ''\n pass = \"\"\n when SAMBP_XEN.include?(vm)\n server = ''\n pass = \"\"\n when SUNFIRE_XEN.include?(vm)\n server = ''\n pass = \"\"\n end\n result = []\n run_time = Benchmark.realtime do\n begin\n @logger.info(\"Suspend start\")\n result << system(\"xe vm-suspend vm=#{vm} -s #{server} -u root -pw #{pass} >> #{BACKUP_DIR}#{dir}#{vm}/#{vm}-#{t.month}-#{t.year}.log 2>&1\") \n @logger.info(\"Backup start\")\n result << system(\"xe vm-export vm=#{vm} filename=#{BACKUP_DIR}#{dir}#{vm}/#{vm}-$(date +%d-%m-%Y).backup -s #{server} -u root -pw #{pass} >> #{BACKUP_DIR}#{dir}#{vm}/#{vm}-#{t.month}-#{t.year}.log 2>&1\")\n @logger.info(\"Resume start\")\n result << system(\"xe vm-resume vm=#{vm} -s #{server} -u root -pw #{pass} >> #{BACKUP_DIR}#{dir}#{vm}/#{vm}-#{t.month}-#{t.year}.log 2>&1\")\n end\n end\n @logger.info(\"Removing old backup\")\n %x[rm #{BACKUP_DIR}#{dir}#{vm}/`ls -t1r #{BACKUP_DIR}#{dir}#{vm} | head -n 1`] if (result[1] == true) && (mkdir != true)\n @logger.info(\"Finished running - Backup run time: #{run_time.to_s[0, 5]}\")\n send_email_with_log(vm,t,dir) if result.include?(false) \n end\nend", "def logging( log_str )\n begin\n file = open(File.expand_path('../_log_followers',__FILE__),'a')\n file.print Time.now.to_s, \"\\t\", log_str, \"\\n\"\n #STDOUT.sync = true\n #print Time.now.to_s, \"\\t\", log_str, \"\\n\"\n #STDOUT.sync = false\n ensure\n file.close\n end\nend", "def invoke_job\r\n\r\n # BgWorker.log(\"Worker: invoke job\")\r\n\r\n fork {\r\n\r\n # BgWorker.log(\"Worker: fork: system 'cd #{Rails.root}; rake #{self.name}'\")\r\n\r\n `cd #{Rails.root}; rake #{self.name}`\r\n\r\n # BgWorker.log(\"Worker: fork: closing job #{res ? 'OK' : 'KO'}, return code: #{$?}\")\r\n\r\n self.close_job($?)\r\n }\r\nend", "def perform config={}\n while\n log(\"[#{name}] Djinn is running.. and doing nothing worthwhile.\")\n sleep(5)\n end \n end", "def spork(&block)\n if empty?\n wait && fork_off(&block)\n else\n fork_off(&block)\n end\n end", "def sleep _args\n \"sleep _args;\" \n end", "def spawned; end", "def spawned; end", "def fork_err\n @fork_err\n end", "def autoflush_log; end", "def autoflush_log; end", "def run\n @stats[:start_time] = Time.now\n\n @@logger = case @options[:logger]\n when IO, String then Logger.new(@options[:logger])\n when Logger then @options[:logger]\n else; Logger.new(STDERR)\n end\n @@logger = SyslogLogger.new(@options[:syslog_channel]) if @options[:syslog_channel]\n\n @@logger.level = eval(\"Logger::#{@options[:log_level].upcase}\") rescue Logger::ERROR\n\n command = [\n \"memcacheq\",\n # (\"-d\" if daemonize?),\n \"-l #{@options[:host]}\",\n \"-H #{@options[:path]}\",\n # (\"-P #{@options[:pid_file]}\" if daemonize?), # can only be used if in daemonize mode\n \"-p #{@options[:port]}\",\n \"-t #{@options[:threads_number]}\",\n \">> #{}\"\n ].compact.join(' ')\n \n log(\"STARTING UP on #{address}\")\n log(\"with command #{command}\")\n \n begin \n @pid = fork{ exec(command) }\n rescue Errno::ENOENT => e\n log(\"ERROR while starting #{address}\", :error)\n raise e\n end\n end", "def spawn\n raise \"not yet implemented\"\n end", "def configure_logging\n Backdat::Log.init(Backdat::Config[:log_location])\n if ( Backdat::Config[:log_location] != STDOUT ) && STDOUT.tty? &&\n ( !Backdat::Config[:daemonize] )\n stdout_logger = Logger.new(STDOUT)\n STDOUT.sync = true\n stdout_logger.formatter = Backdat::Log.logger.formatter\n Backdat::Log.loggers << stdout_logger\n end\n Backdat::Log.level = Backdat::Config[:log_level]\n end", "def stats\n handle_fork\n _stats\n end", "def ps_setup(args, &block)\n output_file = nil\n c_time = 10\n @@command_opts.parse(args) do |opt, idx, val|\n case opt\n when '-o'\n output_file = val\n 2.times { args.shift }\n when '-t'\n begin\n c_time = Integer(val)\n print_warning(\"Output timeout: #{val} seconds\")\n 2.times { args.shift }\n rescue\n print_error \"#{val} is not a valid Integer.\"\n return false\n end\n when '-h'\n yield if block_given?\n end\n end \n output = \"#{rand(1000000)}\"\n ps_cmd = args.join(\" \")\n tmp_dir = client.fs.file.expand_path(\"%temp%\")\n tmp_file = \"#{tmp_dir}\\\\#{output}\"\n\n return output_file, c_time, ps_cmd, tmp_file\n end", "def get_worker_spawn_timeout\n if timeout = ENV['WORKER_SPAWN_TIMEOUT']\n puts \"WORKER_SPAWN_TIMEOUT=#{timeout}\"\n timeout.to_i\n else\n 4\n end\nend", "def log(message)\n puts \"resque-pool-manager[#{Process.pid}]: #{message}\"\n #$stdout.fsync\n end", "def spawn_worker(f)\n pid = fork do\n # Note: By default, Ruby will finalize C objects inside the fork. Because those C objects\n # are shared with the parent, this can cause database connections to disconnect in the\n # parent process. We need to double-fork for proper semantics, so we disable the GC and\n # exit! to avoid finalizing shared handles.\n #\n # We should continue to look for alternate solutions, and to determine whether there is\n # still a possible race between the fork and the GC disabling.\n ::GC.disable\n ::Process.setsid\n exit! if fork\n\n # Acquire exclusive file lock, exit otherwise\n unless f.flock(File::LOCK_EX | File::LOCK_NB)\n exit! 1\n end\n\n f.truncate(0)\n\n # Lock acquired, cleanup old sock files\n Dir[\"#{sockfile_path}/skylight-*.sock\"].each do |sf|\n File.unlink(sf) rescue nil\n end\n\n pid = Process.pid.to_s\n\n # Write the pid\n f.write(pid)\n f.flush\n\n sf = sockfile(pid)\n File.unlink(sf) rescue nil\n\n t { fmt \"opening a new socket; %s\", sf }\n srv = UNIXServer.new(sf)\n\n unless ENV[TRACE_ENV_KEY]\n null = File.open \"/dev/null\", File::RDWR\n STDIN.reopen null\n STDOUT.reopen null\n STDERR.reopen null\n end\n\n # Cleanup the ENV\n ENV['RUBYOPT'] = nil\n\n @server.exec(SUBPROCESS_CMD, @config, f, srv, lockfile)\n end\n\n Process.detach(pid)\n end", "def daemonize\n fork do\n Process.setsid\n exit if fork\n #Dir.chdir('/tmp')\n STDIN.reopen('/dev/null')\n STDOUT.reopen('/dev/null', 'a')\n STDERR.reopen('/dev/null', 'a')\n\n trap(\"TERM\") {\n exit\n }\n\n yield\n end\nend", "def after_fork(options = {})\n record_api_supportability_metric(:after_fork)\n # the following line needs else branch coverage\n agent.after_fork(options) if agent # rubocop:disable Style/SafeNavigation\n end", "def worker_shutdown_timeout(timeout); end", "def reopen_after_fork!\n logger.debug { \"#{self.class}##{__method__} fork detected!\" } if forked?\n\n @mutex = Monitor.new\n @dispatch_shutdown_cond = @mutex.new_cond\n @event_queue = QueueWithPipe.new\n\n @dispatcher = nil if @dispatcher and not @dispatcher.alive?\n\n update_pid! # from Forked\n end", "def main_to_worker\n \"main_to_worker\" # the pipes are created in the current working directory\nend", "def flush\n handle_fork\n _flush\n end", "def default_fork_every\n defined?(@@default_fork_every) ? @@default_fork_every : true\n end", "def checkTimeout_Flooding()\n\tsleep(2);\n\tputs \"time out!\";\n\n\nend", "def fork\n dup\n end", "def start(name, &block)\n\t\t\t\tThread.fork(name: name, &block)\n\t\t\tend", "def runCommandsOnCluster(commands, waitToFinish=false, name = \"\", output=false, priorityclass=\"eh\")\n\tt=Time.now\n\tdatetime = t.strftime(\"%Y-%m-%d %H-%M-%S\") # YYYY-MM-DD HH:MM:SS\n\ttodoFilename = \"#{tmpdir}#{name}-tmpAlgosToRun-#{datetime}-#{random_number_without_rand}\".gsub(/ /,\"\")\n\tFile.open(todoFilename, \"w\"){|f|\n\t\tfor command in commands\n\t\t\tf.puts \"#{command}\"\n\t\tend\n\t}\n\n\tshFilename = \"#{tmpdir}#{name}-tmpShFile-#{datetime}-#{random_number_without_rand}.sh\".gsub(/ /,\"\")\n\t#puts \"todoFilename: #{todoFilename}, shFilename: #{shFilename}\"\n\tFile.open(shFilename, \"w\"){|f|\n\t\tf.puts \"#!/bin/sh\"\n\t\tf.puts \"echo \\\"Here's what we know from the SGE environment\\\"\"\n\t\tf.puts \"echo HOME=$HOME\"\n\t\tf.puts \"echo USER=$USER\"\n\t\tf.puts \"echo JOB_ID=$JOB_ID\"\n\t\tf.puts \"echo JOB_NAME=$JOB_NAME\"\n\t\tf.puts \"echo HOSTNAME=$HOSTNAME\"\n\t\tf.puts \"echo SGE_TASK_ID=$SGE_TASK_ID\"\n\t\tf.puts \"echo STDOUT_FILE=$stdout\"\n\t\tf.puts \"echo STDERR_FILE=$stderr\"\n\t\tf.puts \"echo jobin=$jobin\"\n\t\tf.puts \"echo jobout=$jobout\"\n\t\tf.puts \"echo joberr=$joberr\"\n\t\tf.puts \"RUBYLIB=/ubc/cs/home/h/hutter/arrowspace/ParamILS/scripts:/cs/public/lib/pkg/ruby-1.8.2/lib/ruby/site_ruby/1.8:/.autofs/binaries/cspubliclib/pkg/ruby-mysql/mysql-ruby-2.7.1\"\n\t\tf.puts \"export RUBYLIB\"\n\t\t#/cs/local/bin in the PATH is absolutely necessary for JAVA, get java.lang.NoClassDefFoundError otherwise !!!\n\t\tf.puts \"PATH=/cs/beta/lib/pkg/sge-6.0u7_1/bin/lx24-x86:/cs/local/bin:/cs/local/generic/bin:/cs/local/bin/pbm+:/usr/local/bin:/usr/bin/X11:/bin:/usr/ucb:/usr/bin:/ubc/cs/home/h/hutter/bin:/ubc/cs/home/h/hutter/bin/ix86linux:/opt/kde3/bin:/opt/gnome/bin:/usr/games:/usr/sbin:/sbin:/usr/lib/java/bin:/cs/public/bin:/cs/public/generic/bin:/cs/public/bin/xwindows:/ubc/cs/home/h/hutter/ruby-scripts:/ubc/cs/home/h/hutter/ruby-scripts/autoparam/:/ubc/cs/home/h/hutter/bioinf/impl/scripts:/ubc/cs/home/h/hutter/lib:/ubc/cs/home/h/hutter/mcmc/bin/:/ubc/cs/home/h/hutter/arrowspace/ParamILS/testbed/scripts:/ubc/cs/home/h/hutter/arrowspace/ParamILS/scripts:/cs/public/lib/pkg/ruby-1.8.2/lib/ruby/site_ruby/1.8:/.autofs/binaries/cspubliclib/pkg/ruby-mysql/mysql-ruby-2.7.1:/ubc/cs/home/h/hutter/ant/bin:$SGE_BINARY_PATH:$PATH\"\n\t\tf.puts \"export PATH\"\n\t\tf.puts \"ILM_LICENSE_FILE=/cs/local/generic/lib/pkg/ilog/ilm/access.ilm\"\n\t\tf.puts \"ILOG_LICENSE_FILE=/cs/local/generic/lib/pkg/ilog/ilm/access.ilm\"\n\t\tif output\n\t\t\tf.puts \"#\\$ -o /ubc/cs/home/h/hutter/arrowspace/sgeout -e /ubc/cs/home/h/hutter/arrowspace/sgeout\"\n\t\telse\n\t\t\tf.puts \"#\\$ -o /dev/null -e /dev/null\"\n\t\tend\n\t\tf.puts \"line=`head -n $SGE_TASK_ID #{todoFilename} | tail -1`\t# Get line of todoFilename.\"\n\n\t\tcmd = \"cd #{$work_dir};\"\n\t\tf.puts \"echo Calling: #{cmd} #output\"\n\t\tf.puts cmd\n\n\t\t#cmd= \"pwd\"\n\t\t#f.puts \"echo Calling: #{cmd} #output\"\n\t\t#f.puts cmd\n\t\tcmd= \"$line\"\n\t\tf.puts \"echo Calling: #{cmd} #output\"\n\t\tf.puts cmd\n\t}\n\n\tif commands.length > 0\n\t\tconsumables = \"\"\n\t\tconsumables += \" -l dbheavy=1\" if $dbheavy\n\t\tconsumables += \" -l db=1\" if $dblight\n\t\tconsumables += \" -l cplex=1\" if $cplex\n#\t\tsge_cmd = \"qsub -cwd -m n -t 1-#{commands.length} -l memheavy=1 -P eh #{consumables} #{shFilename}\"\n\t\tsge_cmd = \"qsub -cwd -m n -t 1-#{commands.length} -P #{priorityclass} #{consumables} #{shFilename}\"\n\tend\n\n\tputs sge_cmd\n\tputs shFilename\n\tjobid = nil\n\t#=== Start job and remember job id.\n\tFile.popen(sge_cmd){|sge_response|\n\t\tline = sge_response.gets\n\t\tputs line\n\t\tif line =~ /Your job (\\d+)\\./\n\t\t\tjobid = $1.to_i\n\t\telsif line =~ /Your job (\\d+) \\(/\n\t\t\tjobid = $1.to_i\n\t\tend\n\t}\n##\tFile.delete(todoFilename)\n#\tFile.delete(shFilename)\n\n\tif waitToFinish\n\t#=== Sleep until job done.\n\t\tputs \"Waiting for SGE job #{jobid} to finish. TODO filename = #{todoFilename}\"\n\t\tstill_running = true\n\t\twhile still_running\n\t\t\tsleep(10)\n\t\t\tstill_running = false\n\t\t\tFile.popen(\"qstat\"){|qstat_output|\n\t\t\t\twhile line = qstat_output.gets\n\t\t\t\t\tstill_running = true if line =~ /^\\s*#{jobid}\\s*/\n\t\t\t\tend\n\t\t\t\tputs \"Waiting for SGE job #{jobid} to finish. TODO filename = #{todoFilename}\"\n\t\t\t}\n\t\tend\n\tend\n\treturn [jobid, todoFilename]\nend", "def safefork\n tryagain = true\n\n while tryagain\n tryagain = false\n begin\n if pid = fork\n return pid\n end\n rescue Errno::EWOULDBLOCK\n sleep 5\n tryagain = true\n end\n end\n end", "def configure_logger_for(name)\n logger = Logger.new(@logdev, @shift_age, @shift_size)\n logger.level = @level\n logger.progname = name\n logger.formatter = formatter\n logger\n end", "def logging( log_str )\n begin\n file = open(File.expand_path('../_log_watcher2',__FILE__),'a')\n file.print Time.now.to_s, \"\\t\", log_str, \"\\n\"\n STDOUT.sync = true\n print Time.now.to_s, \"\\t\", log_str, \"\\n\"\n STDOUT.sync = false\n ensure\n file.close\n end\nend", "def pause_before_fork_in_parent\n logger.debug { \"##{__method__}\" }\n @mutex.synchronize { stop_event_thread }\n end", "def delayed_exit delay=300\n log \"Exiting in #{delay} seconds\"\n sleep delay\n quit_all\nend", "def sleeper\n\t\tsleep(0.4)\n\tend", "def myputs(msg)\n if $options[:mode] == 'cron'\n puts msg\n else\n $progressbar.log msg\n end\nend", "def at_exit_to_every_child_fork\n at_exit do\n Thread.new do\n sleep 1\n Kernel.exit!\n end\n BEANPICKER_FORK[:job].bury rescue nil if BEANPICKER_FORK[:job]\n end\n end", "def with_log(&block)\n name = self.class.name.to_s\n log.info(\"Starting #{name}\")\n begin\n yield\n rescue StandardError => ex\n log.exception(ex)\n raise\n ensure\n log.info(\"Exiting #{name}\")\n end\n end", "def daemonize\n exit if fork\n Process.setsid\n exit if fork\n Dir.chdir \"/\"\n end", "def perform(*args)\n # *args means you can take an array of arguments.\n puts \"1.I'm starting the fake job\"\n sleep 5\n puts \"2.OK I'm done now\"\n puts \"3. BYEEEE\"\n end", "def run\n create_log_folder\n \n in_tmp_dir do\n start_frame = tmp_path START_FRAME\n extract_start_transition_frame(start_frame) # 1.\n \n end_frame = tmp_path END_FRAME\n extract_end_transition_frame(end_frame) # 2.\n \n transitions = tmp_path TRANSITIONS\n Cmd::GenerateTransitionFrames.new(start_frame, end_frame, transitions, INNER_FRAMES_AMOUNT).run! *logs('3_generate_transition_frames') # 3.\n \n Queue.run *FORMATS.map{ |format| proc{ transition(format) } }, close_connection_before_execution: true # 4.\n end\n \n outputs\n end" ]
[ "0.5993114", "0.58441323", "0.58128995", "0.5793069", "0.5731116", "0.5711288", "0.56880176", "0.56466854", "0.5572466", "0.5560918", "0.55388176", "0.5535151", "0.5535151", "0.5519311", "0.5407942", "0.5407018", "0.53903425", "0.53849745", "0.53849745", "0.5383673", "0.5364512", "0.5349924", "0.5292769", "0.52780527", "0.5254657", "0.52396494", "0.523695", "0.52262115", "0.5220642", "0.52057415", "0.5187173", "0.51785314", "0.51745325", "0.51651084", "0.5162639", "0.5162508", "0.5158313", "0.5153193", "0.5152902", "0.51526237", "0.51462066", "0.51405144", "0.5139527", "0.5135425", "0.5102174", "0.50954825", "0.5091143", "0.5078382", "0.50654435", "0.5059719", "0.50472486", "0.5045983", "0.50407267", "0.5031979", "0.50300235", "0.50176847", "0.50154483", "0.50099736", "0.50083387", "0.50034404", "0.50017434", "0.49942276", "0.49891162", "0.49803832", "0.4961012", "0.49609876", "0.49609876", "0.49520788", "0.4947305", "0.4947305", "0.49055967", "0.49042362", "0.49021715", "0.48998538", "0.48808333", "0.48733243", "0.48720804", "0.48720342", "0.4869805", "0.48687932", "0.4861204", "0.48601317", "0.48591998", "0.48590928", "0.4858979", "0.48589775", "0.48583612", "0.48554626", "0.48551917", "0.4855079", "0.4848662", "0.48463666", "0.48453397", "0.48401782", "0.4839313", "0.4838865", "0.48370534", "0.48346087", "0.48299468", "0.482681", "0.48227564" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_contact_info @contact_info = ContactInfo.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def contact_info_params params.require(:contact_info).permit( :person_id, :info_type, :phone_no_fixed, :phone_no_mobile, :department, :detail_location, :address_id ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \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 model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def 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 url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004", "0.6290563", "0.6284484", "0.62436926", "0.6239928", "0.62184125", "0.62158304", "0.6210187", "0.6194002", "0.61786795", "0.61759156", "0.617342", "0.6162248", "0.61528504", "0.61527", "0.6146735", "0.6122714", "0.61169004", "0.61082125", "0.61052656", "0.6091036", "0.60807735", "0.6070328", "0.60634184", "0.60213035", "0.6017676", "0.6013606", "0.601112", "0.6007318", "0.6007318", "0.6001461", "0.6001135", "0.59966296", "0.5992013", "0.59919006", "0.599182", "0.5980991", "0.59676576", "0.5960269", "0.59588194", "0.59585214", "0.59578323", "0.5953503", "0.5952524", "0.59432703", "0.5939858", "0.59388995", "0.59388995", "0.5933866", "0.5930038", "0.5925672", "0.5924214", "0.59169805", "0.59106255", "0.5910254", "0.59086037", "0.5906149", "0.5898294", "0.58981514", "0.5896171", "0.58944154", "0.58943397", "0.5892325", "0.5887239", "0.58842856", "0.5880209", "0.5874584", "0.58694917", "0.5868719", "0.58669394", "0.5866552", "0.58662945", "0.5864085", "0.58623236", "0.5862258", "0.58597904", "0.58579135", "0.58542645", "0.5853335", "0.58517563", "0.5850614" ]
0.0
-1
prepare list of addresses
def set_address_options @address_options = Address.all.map{ |a| [ a.label, a.id ]} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_address_list_from_params\n @address_list = []\n params.each do |key, value|\n next unless key.start_with? 'address_list_'\n\n address = Address.new.from_json(value)\n @address_list << address\n end\n end", "def extract_addresses(address_list)\n addresses = []\n address_list.each do |address|\n addresses << address[:address] if ['ipv4', 'hostname'].include?(address[:type])\n end\n addresses\nend", "def address_list_assign(field_name, addresses)\n if addresses.kind_of?(Array)\n value = addresses.collect { |e|\n if e.kind_of?(RMail::Address)\n e.format\n else\n RMail::Address.parse(e.to_str).collect { |a|\n a.format\n }\n end\n }.flatten.join(\", \")\n set(field_name, value)\n elsif addresses.kind_of?(RMail::Address)\n set(field_name, addresses.format)\n else\n address_list_assign(field_name,\n RMail::Address.parse(addresses.to_str))\n end\n end", "def build_addresses(v)\n # only create on address\n if v.kind_of? Hash\n return [Address.new(v)]\n # create multiple addresses\n elsif v.kind_of? Array\n # todo: multiple addresses\n end\n end", "def get_addresses apts\n return apts.map { |apt| apt.address }\n end", "def addresses\n collect { |a| a.address }\n end", "def addresses\n # prevent original array from being changed\n @addresses.dup\n end", "def addresses\n @addresses ||= init_addresses\n end", "def reserved_addresses\n IPSet.new(list_addresses.map{|a| a.address.to_host })\n end", "def generate_address_list\n adresses = super\n adresses.blank? ? [ \"#{request.host_with_port}/storage\" ] : adresses\n end", "def addresses; end", "def address_list_for(emails, retried = false)\n emails = emails * \", \"\n list = Mail::AddressList.new(self.class.unescape(emails))\n addrs = list.addresses.each { |a| a.decoded }\n addrs.uniq!\n addrs\n rescue Mail::Field::ParseError\n if retried\n raise\n else\n address_list_for(emails.scan(EMAIL_REGEX), true)\n end\n end", "def initialize\n @phone_numbers = []\n @addresses = []\n end", "def pick_address_from_list\n params.each_key do |key|\n next unless key.start_with? 'pick_address'\n\n index = key.to_s.delete_prefix('pick_address_').to_i\n\n @show_manual_address = true\n @address_read_only = true\n @address_summary = AddressSummary.new\n @address_detail = @address_list[index]\n break\n end\n end", "def call_address_service\n addresses = []\n success = call_ok?(:address_search, make_request) do |body|\n ServiceClient.iterate_element(body[:address_list]) do |address|\n add_address(addresses, address) unless address.nil?\n end\n end\n [success, addresses]\n end", "def to_addresses\n emails = interest_addresses.concat(focus_addresses)\n if emails.empty?\n emails << 'info@unglobalcompact.org'\n end\n emails.uniq\n end", "def addresses\n Array(@addresses)\n end", "def assign_addresses\n Optopus::Address.where(:network_id => nil).where('ip_address << ?', self.address.to_cidr).each do |address|\n self.addresses << address\n end\n\n # if we changed our cidr address, go through and update\n # addresses that are no longer part of this network\n if !self.new_record? && self.address_changed?\n self.addresses.where('NOT ip_address << ?', self.address.to_cidr).update_all('network_id = NULL')\n end\n end", "def add_email_addresses!(list_of_email_addresses)\n email_addresses = Expect.normalize_string_to_array(list_of_email_addresses)\n \n email_addresses.each do |email_address|\n add_email_address!(email_address)\n end\n end", "def initialize\n @phone_numbers = []\n #creamos un array vacio, al ser @ de instancia cualquier metodo puede acceder\n @addresses = []\n end", "def address\n [address_line_1, address_line_2, town_city, county, postcode].join(\", \")\n end", "def address_list_fetch(field_name)\n if values = fetch_all(field_name, nil)\n list = nil\n values.each { |value|\n if list\n list.concat(Address.parse(value))\n else\n list = Address.parse(value)\n end\n }\n if list and !list.empty?\n list\n end\n end or RMail::Address::List.new\n end", "def look_up_addresses\n if postcode.present?\n address_finder = AddressFinderService.new(postcode)\n self.temp_addresses = address_finder.search_by_postcode\n else\n self.temp_addresses = []\n end\n end", "def address\n address = []\n address << [address1] if !address1.blank?\n address << [address2] if !address2.blank?\n address << [city] if !city.blank?\n address << [province] if !province.blank?\n address << [region] if !region.blank?\n address << [zip_code] if !zip_code.blank?\n address.join(\", \")\n end", "def decompose_address(parts)\n addresses = parts || []\n address, city, zip, country_code = nil, nil, nil, nil\n\n if !addresses.empty?\n address = addresses[0] if addresses[0]\n zip, city = addresses[1].split(\" \", 2) if addresses[1]\n country_code = addresses[2] if addresses[2]\n end\n\n [address, city, zip, country_code]\n end", "def set_addresses=(v)\n self.addresses = build_addresses(v)\n end", "def add_ip_addresses(addresses, comment=\"\", list=\"GFWed\")\n logger.info \"addresses: #{addresses}\"\n message = \"\"\n counter = 0\n addresses.gsub!(\"\\r\", \"\")\n addresses.split(\"\\n\").each do |address|\n counter += 1\n message += add_ip_address(address, comment, list, false)\n end\n \n message = message == \"\" ? \"#{settings.rui_host}: #{counter} ip addresses add commands was sent.\" : message\n return message\n end", "def from_addresses=(value)\n @from_addresses = value\n end", "def address_list\n $tracer.trace(format_method(__method__))\n return ProfileAddressList.new(@tag.find.span.className(create_ats_regex_string(\"ats-addrpanel\")), format_method(__method__))\n end", "def init_addresses\n @@client.describe_addresses.addresses\n end", "def build_addresses(options={})\n raise \"override in purchase_order or sales_order\"\n end", "def address\n\t [inst_add1, inst_add2, inst_city, inst_state, inst_zip].compact.join(\", \")\n\tend", "def ship_to_address\n all = {}\n for key_out in [:city, :last_name, :first_name, :country, :zip, :address]\n all[key_out] = unescape params['x_ship_to_' + key_out.to_s]\n end\n \n all\n end", "def build_params_for_address()\n\n end", "def build_addresses(options={})\n raise \"override in purchase_order or sales_order\"\n end", "def addresses\n warn \"DEPRECATED: use postalAddress from a Person entry\"\n []\n end", "def add_address # rubocop:disable Metrics/AbcSize\n return unless @bib.place.any?\n\n reg = @bib.place[0].region[0].name if @bib.place[0].region.any?\n addr = [@bib.place[0].name, @bib.place[0].city, reg]\n @item.address = addr.compact.join(\", \")\n end", "def set_Addresses(value)\n set_input(\"Addresses\", value)\n end", "def set_Addresses(value)\n set_input(\"Addresses\", value)\n end", "def set_Addresses(value)\n set_input(\"Addresses\", value)\n end", "def create_address_objects\n\n # Initialize vars\n a_addresses = Array.new\n a_prefix_lists = Array.new\n config = String.new\n filterused = nil\n\n\n # Combining ipv4 and ipv6 filters to a single hash to process both simultaneously\n filters = $h_filters.merge($h_filters6)\n\n filters.each_key do |filtername|\n\n # check_if_filter_used returns 1 if this filter is used by an interface 0 if not\n filterused = check_if_filter_used(filtername)\n\n unless filterused\n p \"create_address_objects: filter is not used by an interface. skipping filtername: #{filtername}\"\\\n if $opts[:debug]\n next\n end\n\n filters[filtername].each_key do |termname|\n filters[filtername][termname][:source].each do |sourcename, sourcetype|\n if sourcetype == :'source-address' || sourcetype == :'destination-address'\n\n # Adding all to new hash in order to remove duplicates\n a_addresses << sourcename\n end\n\n # For rules reference prefix-lists need to find the prefix list and iterate through all of the\n # defined addressses, creating an address object for each\n if sourcetype == :'source-prefix-list' ||\\\n sourcetype == :'destination-prefix-list' ||\\\n sourcetype == :'prefix-list'\n a_prefix_lists << sourcename\n a_prefix_lists.uniq.each do |prefixlist|\n if $h_prefix_lists.has_key?(prefixlist)\n $h_prefix_lists[prefixlist].each do |prefixadds|\n a_addresses << prefixadds\n end\n else\n p \"create_address_objects: Referenced prefix #{sourcename} could not be found.\\\\\n Filter: #{filtername}, term: #{termname}\"\n end\n end\n end\n end\n end\n end\n\n # create a fg config entry for each uniq address identified\n config += \"#### Address Objects ####\\n\"\n config += \"config firewall address\\n\"\n a_addresses.uniq.each do |x|\n\n fgaddress = <<-EOS\n edit #{x}\n set type subnet\n set subnet #{x}\n next\n EOS\n\n # Add each output from Herdoc above to config var (will pass this back to main)\n config += fgaddress\n end\n\n config += \"end\\n\"\n config += \"#### Addresses Groups###\\n\"\n config += \"config firewall addrgroup\\n\"\n\n $h_prefix_lists.each do |prefixlist, prefixadds|\n\n # Convert array to string usable in addrgroup config\n adds = String.new\n prefixadds.each {|x| adds += \"#{x.to_s} \"}\n\n fggroups = <<-EOS\n edit #{prefixlist}\n set member #{adds}\n next\n EOS\n\n config += fggroups\n end\n\n # Return this pieces of FG config to main for additional methods to add to it\n config += \"end\\n\\n\"\n\nend", "def addresses\n @addresses\n end", "def address_form(address_parts)\n businessAddress = []\n address_parts.each do |part|\n part = part.text.strip\n if !part.blank?\n businessAddress << part\n end\n end\n\n businessAddress.join(\", \")\n end", "def address_lines(glue=',')\n lines = [\n address_line_1,\n address_line_2,\n address_line_3,\n address_line_4\n ]\n\n # Remove empty lines and join by parameter\n lines.select{|i|i.present?}.join glue\n end", "def process_addresses(params)\n assign_attributes(params)\n save(validate: false)\n add_email!\n add_addresses!\n save\n end", "def buildAddress(addrRaw)\n # Check if first address row contains P O Box substring\n isPoB = addrRaw['s'].include? \"P O Box\"\n location = Array.new\n\n fullLoc = (addrRaw['s'] == \"-\" || isPoB) ? \"\" : \"#{addrRaw['s']}, \"\n partialLoc = (addrRaw['s2'] == \"-\") ? \"\" : \"#{addrRaw['s2']},\" \n partialLoc += (addrRaw['l'] == \"-\") ? \"\" : \"#{addrRaw['l']}, \" \n partialLoc += (addrRaw['r'] == \"-\") ? \"\" : \"#{addrRaw['r']}, \" \n partialLoc += (addrRaw['z'] == \"-\") ? \"\" : \"#{addrRaw['z']}, \" \n partialLoc += (addrRaw['c'] == \"-\") ? \"\" : \"#{addrRaw['c']}\"\n\n fullLoc += partialLoc\n\n # If address does not contain an 'AU', it is added to the end of the address\n if fullLoc != \"\"\n if fullLoc.exclude? \"AU\"\n # Set fullLoc as well as partialLoc in case all address was contained in the first line\n fullLoc += \", AU\"\n partialLoc += \", AU\"\n end\n end\n \n location[0] = fullLoc\n location[1] = partialLoc\n \n return location\n end", "def address\n [address1, address2, city, state, zip].compact.join(', ')\n end", "def address\n [address1, address2, city, state, zip].compact.join(', ')\n end", "def to_addrs\n to ? [to].flatten : []\n end", "def address\n [address1, city, state, country, zip].compact.join(', ')\n end", "def display_address\n address_list = []\n address_list << city unless city.blank?\n address_list << state unless state.blank?\n address_list << country unless country.blank?\n address_list.join(\", \")\n end", "def build_addresses(address, mask)\n addresses = []\n mask.chars.each_with_index do |bit,idx|\n if bit == \"X\"\n addresses.concat build_addresses(address + \"0\", mask[idx+1..-1])\n addresses.concat build_addresses(address + \"1\", mask[idx+1..-1])\n return addresses\n else\n address = address + bit\n end\n end\n addresses << address\n return addresses\nend", "def fill_in(list, options=nil)\n known_args = [:Objectify, :Short]\n short = false\n objectify = false\n\n # validate list\n raise ArgumentError, \"Array expected for argument 'list' but #{list.class} provided.\" if (!list.kind_of?(Array) )\n\n # validate options\n if (options)\n raise ArgumentError, \"Hash expected for argument 'options' but \" +\n \"#{options.class} provided.\" if (!options.kind_of?(Hash) )\n NetAddr.validate_args(options.keys,known_args)\n\n if (options.has_key?(:Short) && options[:Short] == true)\n short = true\n end\n\n if (options.has_key?(:Objectify) && options[:Objectify] == true)\n objectify = true\n end\n end\n\n # validate each cidr and store in cidr_list\n cidr_list = []\n list.each do |obj|\n if (!obj.kind_of?(NetAddr::CIDR))\n begin\n obj = NetAddr::CIDR.create(obj)\n rescue Exception => error\n aise ArgumentError, \"A provided CIDR raised the following \" +\n \"errors: #{error}\"\n end\n end\n\n if (!obj.version == self.version)\n raise VersionError, \"#{obj.desc(:Short => true)} is not a version #{self.version} address.\"\n end\n\n # make sure we contain the cidr\n if ( self.contains?(obj) == false )\n raise \"#{obj.desc(:Short => true)} does not fit \" +\n \"within the bounds of #{self.desc(:Short => true)}.\"\n end\n cidr_list.push(obj)\n end\n\n complete_list = NetAddr.cidr_fill_in(self,cidr_list)\n if (!objectify)\n subnets = []\n complete_list.each {|entry| subnets.push(entry.desc(:Short => short))}\n return(subnets)\n else\n return(complete_list)\n end\n end", "def get_addresses\n return [get_pubkey_address] if is_pubkey?\n return [get_hash160_address] if is_hash160? || is_namecoin?\n return get_multisig_addresses if is_multisig?\n []\n end", "def each_address(&blk) # :yields: url\n addresses.each(&blk)\n end", "def address_for_geocode\n add = []\n add << self.address_1\n add << self.address_2 if self.address_2.present?\n add << self.address_3 if self.address_3.present?\n add << self.city if self.city.present?\n add << self.region if self.region.present?\n add << self.postcode if self.postcode.present?\n add << (self.country.present? ? self.country : 'United Kingdom')\n add.join(', ')\n end", "def address\n [street, [postal_code, l].join(' ')].join(\"\\n\")\n end", "def full_address_array\n [name, address1, address2, city_state_zip].compact\n end", "def full_address_array\n [name, address1, address2, city_state_zip].compact\n end", "def addresses\n @addresses ||= get_addresses.map do |address_tree|\n Mail::Address.new(address_tree)\n end\n end", "def split_addr\n address.insert( address.index(',')+1, \"<br />\")\n end", "def parse_recipients(addresses)\n list_addresses = addresses.gsub(/[\\r\\n]+/, '').gsub(/(@((?:[-a-z0-9]+\\.)+[a-z]{2,})(\\>)?)\\,/i, '\\1'+\"\\n\")\n list_addresses.split(\"\\n\").map{|full_address|\n {'name' => extract_name(full_address), 'email' => extract_email_address(full_address)}\n }\n end", "def fs_contact_addresses_array\n pre_format = fscontact.blank? ? evaluator : fscontact\n return [] if pre_format.nil?\n\n pre_format.split(',').map do |a|\n (a =~ /@/ ) ? a : a + '@' + SCs[:standard_mail_domain]\n end\n end", "def combine_address_fields\n %w[to cc bcc].map do |field|\n hash_addresses(@mail[field])\n end\n end", "def process_anchors_list(anchors_list)\n anchors = []\n anchors_list.each { |_type, list| anchors += list }\n anchors\n end", "def remove_all_original_addresses\n super\n end", "def from_addrs\n from ? [from].flatten : []\n end", "def addresses\n query(:address)\n end", "def addresses\n format_entities('gd$structuredPostalAddress', :format_address)\n end", "def address\n [street, city, state, country].compact.join(', ')\n end", "def parse\n @lexemes = []\n\t@tokens = []\n\t@addresses = RMail::Address::List.new\n\t@errors = 0\n\tnew_address\n get\n address_list\n\treset_errors\n\t@addresses.delete_if { |a|\n\t !a.local || !a.domain\n\t}\n end", "def fill_in_with_multiple_addresses!\n expect(page).to have_content(CHOOSE_EXISTING)\n page.first('#button-new-address').trigger('click')\n fill_in_checkout_address!\n page.first('.addresses__address-use a').trigger('click')\n end", "def address\n [street, city, zip, state].compact.join(\", \")\n end", "def consider_local(*args)\n local_addresses.concat(args.flatten.map { |a| IPAddr.new(a) })\n end", "def address_parts\n texts = @page.css('.claAngebot .claRight p').map(&:text)\n found_address = address_part(CITY_REGEXP, texts) || address_part(WEBSITE_REGEXP, texts) || ''\n found_address.split(\"\\n\").map { |line| clean_up_spaces(line) }\n end", "def all(options={})\n response = MLS.get('/addresses', options)\n MLS::Address::Parser.parse_collection(response.body)\n end", "def address\n [province_c, county_c, town_c].join(',')\n end", "def already_constructed_addresses\n @already_constructed_addresses ||= CSVFakeAddressesReader.read_from_csv_file(fake_addresses_csv_filename).shuffle\n end", "def full_address\n [self.address, \"Madrid\", \"Spain\"].compact.join(\", \") if self.address\n end", "def create_full_address\n \"#{address_line1}, #{city}, #{state} #{zip}\"\n end", "def expect_list_addresses(list, present=true)\n list.each do |a|\n if present\n expect(page).to have_content(content_regex(a))\n else\n expect(page).to have_no_content(content_regex(a))\n end\n end\n end", "def fs_contact_addresses\n fs_contact_addresses_array.join(',')\n end", "def street_address\n [\n house_number, \n street_predirection, \n street_name, \n street_type, \n street_postdirection, \n unit_type, \n unit_number\n ].compact.delete_if(&:empty?).join(' ')\n end", "def getaddresses(name)\n return [name] if ADDRESS_REGEX.match(name)\n @resolvers.each do |resolver|\n addresses = []\n resolver.each_address(name) { |address| addresses << address }\n return addresses unless addresses.empty?\n end\n []\n end", "def from_addresses\n return @from_addresses\n end", "def multi_addr(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/balance?noCache=1\")\n end", "def address_as_ids(type)\n ad = address(type)\n begin\n ad.nil? ? nil : \"#{ad.country.id}$#{ad.city.id}$#{ad.street1}$#{ad.street2}$#{ad.address_type}\"\n rescue\n \"0$0$0$0$0\"\n end\n end", "def addresses(aptArr)\n aptArr.each do |apt|\n #puts apt[:address]\n end\n end", "def address_nodes # :nodoc:\n @address_nodes\n end", "def get_address_list(order, user)\n if @order and @user\n # Non-guest order\n Spree::AddressBookList.new(@user, @order)\n elsif @order\n # Guest order\n Spree::AddressBookList.new(@order)\n elsif @user\n # User account\n Spree::AddressBookList.new(@user)\n else\n # Nothing; return a blank list\n Spree::AddressBookList.new(nil)\n end\n end", "def email_addresses\n emails.map(&:address)\n end", "def assign_addresses\n self.billing_address ||= Address.default(store)\n self.shipping_address ||= Address.default(store)\n\n if billing_group && billing_group.billing_address.present?\n billing_address.copy_from(billing_group.billing_address)\n end\n if shipping_group && shipping_group.shipping_address.present?\n shipping_address.copy_from(shipping_group.shipping_address)\n end\n check_separate_shipping_address\n end", "def list_addresses\n Address.list(@id)\n end", "def address\n\t\t\taddress = [self.address_1, self.try(:address_2), \"#{self.city} #{self.try(:state)}\", \"#{self.try(:zip)}\"].compact\n\t\t\taddress.delete(\"\")\n\t\t\taddress.join(\"<br/>\")\n\t\tend", "def ip_list\n super\n end", "def full_address\n addr = []\n addr << country.try(:name) if show_country\n addr << (state.try(:name).presence || state_name) if show_state\n addr << address1\n addr.compact.join(', ')\n end", "def network_objects_add_ip(rule_name,data)\n \n addr_list = data.split(',')\n self.msg(rule_name, :debug, 'network_objects_add_ip', \"addr_list\" +addr_list.to_s)\n \n addr_list.each do |ip_data|\n \n self.msg(rule_name, :debug, 'network_objects_add_ip', \"processing address\" +ip_data.to_s)\n @ff.link(:href, 'javascript:mimic_button(\\'add: ...\\', 1)').click\n @ff.select_list(:name, 'net_obj_type').select_value('1')\n \n if ip_data.size > 0\n \n self.msg(rule_name, :debug, 'network_objects_add_ip', \"set ip address\" +ip_data)\n str_ip_data = ip_data.strip\n octets=str_ip_data.split('.')\n @ff.text_field(:name, 'ip0').set(octets[0])\n @ff.text_field(:name, 'ip1').set(octets[1])\n @ff.text_field(:name, 'ip2').set(octets[2])\n @ff.text_field(:name, 'ip3').set(octets[3])\n @ff.link(:text, 'Apply').click\n \n end # end of if\n \n end # end of each\n \n end", "def build_hosts_list(env_vms)\n\n int_id = 10\n\n first = true\n env_vms.each do |vm, vmconfig|\n vmconfig[\"networks\"].each do |name, netcfg|\n if netcfg[\"type\"] == \"private\" then\n if netcfg['ip'].nil? then\n netcfg['ip'] = \"192.168.50.\" + int_id.to_s\n #add the default IP to the environment definnition\n env_vms[vm][\"networks\"][name][\"ip\"] = \"192.168.50.\" + int_id.to_s\n int_id += 1\n end\n if first then\n $base_vars = \"vms_hosts={\"\n $base_vars << \"\\\"#{netcfg['ip']}\\\":\\\"#{vm}\\\"\"\n first = false\n elsif\n $base_vars << \",\\\"#{netcfg['ip']}\\\":\\\"#{vm}\\\"\"\n end\n end\n end if vmconfig[\"networks\"]\n end\n $base_vars << \"}\" if $base_vars\nend", "def split_address(address)\n ary = address.split(/\\s+/)\n number = ary.shift\n street_type = (ary.pop || '').downcase.to_sym\n street_name = ary.join(' ')\n if StreetTypes::STREET_TYPES.key?(street_type)\n street_type = StreetTypes::STREET_TYPES[street_type]\n end\n [number, street_name.upcase, street_type.to_s.upcase]\n end", "def private_ipaddresses\n # Create an array to hold the addresses\n addresses = []\n\n # Iterate around the filter that has been populated\n entries.each do |entry|\n entry.ip_configurations.each do |ip_config|\n addresses << ip_config['private_ipaddress']\n end\n end\n\n # return the array to the calling function\n addresses\n end" ]
[ "0.75405616", "0.7061769", "0.6850537", "0.67182237", "0.6575284", "0.65727663", "0.65498775", "0.64918846", "0.6485239", "0.6473226", "0.64515823", "0.63484806", "0.6332715", "0.63140994", "0.6289869", "0.62185985", "0.6210023", "0.61692774", "0.61642265", "0.6154547", "0.61349875", "0.61184174", "0.6068002", "0.6063049", "0.6058695", "0.6039347", "0.60150605", "0.6000788", "0.59998643", "0.59766215", "0.59735763", "0.5953579", "0.5953336", "0.59444463", "0.59274954", "0.592658", "0.59175205", "0.5916909", "0.5916909", "0.5916909", "0.5900912", "0.58974934", "0.5886775", "0.5854833", "0.5854119", "0.5846438", "0.5837806", "0.58054346", "0.58001965", "0.57985336", "0.5777501", "0.5775845", "0.5772918", "0.5767877", "0.5767611", "0.57670736", "0.57619816", "0.57513386", "0.57513386", "0.5744892", "0.574486", "0.57387125", "0.57237685", "0.56968296", "0.5694286", "0.5686857", "0.5680532", "0.56584084", "0.5656625", "0.5645156", "0.5626726", "0.56260055", "0.5625983", "0.5616473", "0.5612409", "0.56092906", "0.5606238", "0.56026495", "0.5589157", "0.55876327", "0.5585459", "0.55837464", "0.5579691", "0.5579449", "0.55774707", "0.55745405", "0.55687493", "0.5566611", "0.5537692", "0.5525499", "0.5518388", "0.55156374", "0.5515239", "0.55023223", "0.5495962", "0.5491669", "0.54777884", "0.5463145", "0.54614586", "0.5458843" ]
0.6007502
27
def aggregate_schema(type, write: false) end
def aggregate_schema(type, write: false) in_dir, out_dir = get_dirs(type) jsons = aggregate(in_dir) schema = Convert.jsons_to_schema(jsons) if write path = "#{out_dir}/schema-#{Time.current.strftime('%s%2N')}.json" File.write(path, JSON.pretty_generate(schema)) end schema end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_schema(name, type, options={})\n raise NotImplementedError\n end", "def aggregate_db_storage_type; end", "def schema_composite_type(db_type)\n @row_schema_types[db_type] || super\n end", "def aggregate op, type = :fixnum\n check_closed\n\n aggregation_impl op, type\n end", "def schema\n []\n end", "def schema\n raise NotImplementedError\n end", "def apply_reporter_schema(name, type, options={})\n column name, type.to_s.downcase.to_sym, options\n end", "def schema_array_type(db_type)\n :array\n end", "def schema\n @schema ||= []\n end", "def type_schema\n steps.type_schema\n end", "def build_schema(**args)\n if object.respond_to?(:each)\n build_collection_schema(args)\n else\n Surrealist.build_schema(instance: self, **args)\n end\n end", "def store_aggregates\n raise NotImplementedError\n end", "def apply_devise_schema(name, type, options={})\n # type = Time if type == DateTime\n # field name, { :type => type }.merge!(options)\n end", "def build_schema(**args)\n if Helper.collection?(object)\n build_collection_schema(**args)\n else\n Surrealist.build_schema(instance: self, **args)\n end\n end", "def add_field_schema(name, type, schema)\n @field_names ||= [] ; @field_schemas ||= {}\n @field_names = @field_names | [name]\n schema = schema.symbolize_keys.merge({ :name => name })\n #\n # FIXME: this is terrible, especially given what's in TypeFactory anyway.\n #\n schema[:type] =\n case\n when type == Hash && schema.has_key?(:values) then Icss::Meta::TypeFactory.receive({ :type => :hash, :values => schema.delete(:values)})\n when type == Array && schema.has_key?(:items) then Icss::Meta::TypeFactory.receive({ :type => :array, :items => schema.delete(:items) })\n when type == Hash then IdenticalHashFactory\n when type == Array then IdenticalArrayFactory\n else\n Icss::Meta::TypeFactory.receive(type)\n end\n fld = (field_schemas[name] || make_field_schema).merge(schema)\n fld[:parent] = self\n @field_schemas[name] = fld\n end", "def types\n @types ||= inject({}) { |memo, schema| memo.merge(schema.types) }\n end", "def schema_definition\n of.schema_definition \n end", "def schema\n @_format.schema\n end", "def schema_multirange_type(db_type)\n :multirange\n end", "def aggregate\n []\n end", "def schema\n adapter.schema\n end", "def complete_schema(schema)\n schema = Marshal.load(Marshal.dump(schema))\n\n if %w[ minimum maximum ].any? {|key| schema.has_key?(key) }\n schema.merge(\"type\" => \"number\")\n elsif %w[ minLength maxLength pattern ].any? {|key| schema.has_key?(key) }\n schema.merge(\"type\" => \"string\")\n elsif %w[ items minItems maxItems uniqueItems ].any? {|key| schema.has_key?(key)}\n schema.merge(\"type\" => \"array\").tap do |s|\n if s[\"items\"]\n if s[\"items\"].is_a?(Array)\n s[\"items\"].map! {|e| complete_schema(e) }\n elsif s[\"items\"].is_a?(::JsonSchema::Schema)\n s[\"items\"] = complete_schema(e)\n end\n end\n end\n elsif %w[ minProperties maxProperties required properties additionalProperties patternProperties dependencies ].any? {|key| schema.has_key?(key) }\n schema.merge(\"type\" => \"object\").tap do |s|\n if s[\"properties\"]\n s[\"properties\"].values.map! {|e| complete_schema(e) }\n s[\"required\"] = s[\"properties\"].keys unless s[\"required\"]\n end\n end\n elsif %w[ oneOf anyOf allOf ].any? {|key| schema.has_key?(key) }\n schema.tap do |s|\n s[\"oneOf\"].map! {|e| complete_schema(e) } if s[\"oneOf\"]\n s[\"anyOf\"].map! {|e| complete_schema(e) } if s[\"anyOf\"]\n s[\"allOf\"].map! {|e| complete_schema(e) } if s[\"allOf\"]\n end\n else\n schema\n end\n end", "def schema_composite_type(db_type)\n :composite\n end", "def schema=(value); end", "def add_type(type)\n\n # does nothing, types are differentiated by the 'typ' column\n end", "def csharp_type_for_schema_definition( schema )\n types = {\n ::Respect::ArraySchema => \"List<string>\",\n ::Respect::BooleanSchema => \"bool#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::FloatSchema => \"float#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::HashSchema => \"Dictionary<string, object>\",\n ::Respect::IntegerSchema => \"long#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::StringSchema => \"string\",\n ::Respect::AnySchema => \"object\",\n ::Respect::GeoPointSchema => \"global::#{ base_api_namespace() }.Fields.GeoPoint\",\n ::Respect::AttachmentSchema => \"global::#{ base_api_namespace() }.Fields.Attachment\"\n }\n\n types = if options[:use_noda_time] == \"true\" || options[:use_noda_time] == \"1\"\n types.merge({\n ::Respect::DatetimeSchema => \"NodaTime.Instant#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::InstantSchema => \"NodaTime.Instant#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::DateSchema => \"NodaTime.LocalDate#{ schema.allow_nil? ? \"?\" : \"\" }\"\n })\n else\n types.merge({\n ::Respect::DatetimeSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::InstantSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::DateSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\"\n })\n end\n\n type = types[ schema.class ]\n\n custom = nil\n collection = false\n\n schema_item = schema.instance_variable_get(:@item)\n if type == \"List<string>\" && schema_item && schema_item.is_a?(::Respect::AnySchema)\n type = \"List<object>\"\n end\n\n if schema.is_a?(Respect::HasOneSchema)\n type = sanitize_model_namespace( schema.of ) + \".\" + sanitize_model_class( schema.of )\n custom = type\n collection = false\n end\n\n if schema.is_a?(Respect::EnumSchema)\n type = sanitize_model_namespace( schema.values_module ) + \".\" + sanitize_model_class( schema.values_module )\n custom = type\n collection = false\n\n emit_enum!( schema.values_module )\n end\n\n if schema.is_a?(Respect::HasManySchema)\n type = \"List<\" + sanitize_model_namespace( schema.of ) + \".\" + sanitize_model_class( schema.of ) + \">\"\n custom = type\n collection = true\n end\n\n return type, custom, collection\n end", "def apply_devise_schema(name, type, options={})\n type = Time if type == DateTime\n field name, { :type => type }.merge(options)\n end", "def format_model_schema(klass)\n hsh = klass.columns_hash.map { |column_name,column| [column_name, column.type] }.to_h\n format_schema_helper(hsh)\n end", "def new_aggregate(type,name, value)\n Models::Aggregate.new(\n :type => type,\n :parent_name => assessment_group.display_name,\n :parent_type => 'AssessmentGroup',\n :name => name,\n :value => value\n )\n end", "def print_schema(schema)\n print_filtered_schema(schema, method(:is_defined_type))\n end", "def apply_schema(name, type, options={})\n return unless Devise.apply_schema\n type = Time if type == DateTime\n key name, type, options\n end", "def aggrPyFull(aggr)\n case aggr\n when DataMetaDom::Field::LIST\n 'List'\n when DataMetaDom::Field::SET\n 'Set'\n when DataMetaDom::Field::DEQUE\n 'Deque' # note this is different from Java\n else\n raise ArgumentError, \"Aggregate type #{aggr} not supported for Python serialization\"\n end\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 add_schema(export_type = nil)\n mig_text = schema_generator_script(db_migration_schema, 'create')\n write_db_migration mig_text, \"#{db_migration_schema}_schema\", export_type: export_type\n end", "def push_schema(schema=nil)\n schema ||= jiak.bucket.schema\n jiak.client.set_schema(jiak.bucket.name,schema)\n end", "def schema\n @schema ||= GraphQL::Schema.define(\n query: graphql_query,\n mutation: graphql_mutation,\n resolve_type: ->(obj, _ctx) { @types[obj.class] }\n )\n end", "def schema_column_type(db_type)\n case db_type\n when 'json'\n :json\n when 'jsonb'\n :jsonb\n else\n super\n end\n end", "def schema\n self.class.schema\n end", "def schema\n self\n end", "def schema\n jiak.data.schema\n end", "def is_schemaless(options = {})\n options = { }.merge(options)\n # Add class-methods\n extend DataMapper::Is::Schemaless::ClassMethods\n # Add instance-methods\n include DataMapper::Is::Schemaless::InstanceMethods\n class_inheritable_accessor(:indexes)\n self.indexes ||= {}\n \n property :added_id, DataMapper::Types::Serial, :key => false \n property :id, DataMapper::Types::UUID, :unique => true, \n :nullable => false, \n :index => true,\n :default => Proc.new{ Guid.new.to_s }\n property :updated, DataMapper::Types::EpochTime, :key => true, \n :index => true, \n :default => Proc.new{ Time.now }\n property :body, DataMapper::Types::Json, :default => {}\n \n before :save, :add_model_type\n end", "def add_type(type)\n\n # does nothing, types are differentiated by the 'typ' column\n end", "def schema\n connection.schema\n end", "def create_aggregates(db: EventSourcery::Postgres.config.event_store_database,\n table_name: EventSourcery::Postgres.config.aggregates_table_name)\n db.create_table(table_name) do\n uuid :aggregate_id, primary_key: true\n column :version, :bigint, default: 1\n end\n end", "def schema\n OpenGraph::TYPES.each_pair do |schema, types|\n return schema if types.include?(type)\n end\n nil\n end", "def add_empty_json_ld_schema(edited_document, schema, schema_name, schema_type, yaml) #:nodoc\r\n data = {}\r\n doc = DcJsonLd.new\r\n doc.name = schema_name\r\n doc.type = schema_type\r\n \r\n edited_document.dc_json_lds << doc\r\n schema.each do |element_name, element|\r\n next if element_name == 'level' # skip level element\r\n if yaml[element['type']]\r\n if element['n'].to_s == '1'\r\n # single element\r\n doc_1 = yaml[element['type'] ]\r\n data[element_name] = doc_1\r\n else\r\n # array\r\n add_empty_json_ld_schema(doc, yaml[element['type']], element_name, element['type'], yaml)\r\n end\r\n else\r\n data[element_name] = element['text']\r\n end\r\n end\r\n doc.data = data.to_yaml\r\n doc.save\r\nend", "def run(conn, identifier)\n builder = DbAgile::Core::Schema::builder\n builder.schema(identifier){\n builder.logical{ load_logical_schema(conn, builder) }\n builder.physical{ load_physical_schema(conn, builder) }\n }\n builder._dump\n end", "def aggregate\n public_send aggregate_name\n end", "def schema_column_type(db_type)\n db_type =~ /\\Atinyint\\(1\\)/ ? :boolean : super\n end", "def build_collection_schema(**args)\n object.map { |object| self.class.new(object, context).build_schema(args) }\n end", "def schema_data_type\n case type\n when \"N\", \"F\"\n decimal > 0 ? \":float\" : \":integer\"\n when \"I\"\n \":integer\"\n when \"D\"\n \":date\"\n when \"T\"\n \":datetime\"\n when \"L\"\n \":boolean\"\n when \"M\"\n \":text\"\n else\n \":string, :limit => #{length}\"\n end\n end", "def _schema_ds\n @_schema_ds ||= begin\n ds = metadata_dataset.select{[\n pg_attribute[:attname].as(:name),\n SQL::Cast.new(pg_attribute[:atttypid], :integer).as(:oid),\n SQL::Cast.new(basetype[:oid], :integer).as(:base_oid),\n SQL::Function.new(:format_type, basetype[:oid], pg_type[:typtypmod]).as(:db_base_type),\n SQL::Function.new(:format_type, pg_type[:oid], pg_attribute[:atttypmod]).as(:db_type),\n SQL::Function.new(:pg_get_expr, pg_attrdef[:adbin], pg_class[:oid]).as(:default),\n SQL::BooleanExpression.new(:NOT, pg_attribute[:attnotnull]).as(:allow_null),\n SQL::Function.new(:COALESCE, SQL::BooleanExpression.from_value_pairs(pg_attribute[:attnum] => SQL::Function.new(:ANY, pg_index[:indkey])), false).as(:primary_key),\n Sequel[:pg_type][:typtype],\n (~Sequel[Sequel[:elementtype][:oid]=>nil]).as(:is_array),\n ]}.\n from(:pg_class).\n join(:pg_attribute, :attrelid=>:oid).\n join(:pg_type, :oid=>:atttypid).\n left_outer_join(Sequel[:pg_type].as(:basetype), :oid=>:typbasetype).\n left_outer_join(Sequel[:pg_type].as(:elementtype), :typarray=>Sequel[:pg_type][:oid]).\n left_outer_join(:pg_attrdef, :adrelid=>Sequel[:pg_class][:oid], :adnum=>Sequel[:pg_attribute][:attnum]).\n left_outer_join(:pg_index, :indrelid=>Sequel[:pg_class][:oid], :indisprimary=>true).\n where{{pg_attribute[:attisdropped]=>false}}.\n where{pg_attribute[:attnum] > 0}.\n order{pg_attribute[:attnum]}\n\n # :nocov:\n if server_version > 100000\n # :nocov:\n ds = ds.select_append{pg_attribute[:attidentity]}\n\n # :nocov:\n if server_version > 120000\n # :nocov:\n ds = ds.select_append{Sequel.~(pg_attribute[:attgenerated]=>'').as(:generated)}\n end\n end\n\n ds\n end\n end", "def schema\n return @schema\n end", "def persist_aggregate\n raise NotImplementedError\n end", "def types_to_update\n schemas.select do |index_name, schema|\n current_schema = fetch_index(index_name)\n @actual_schemas[index_name] = current_schema\n !has_same_index_structures?(current_schema.values.first || {}, schema.to_hash.values.first)\n end\n end", "def schema_column_type(db_type)\n if convert_smallint_to_bool && db_type =~ /smallint/i \n :boolean\n else\n super\n end\n end", "def resource_schema\n schemated = {}\n resource.columns_hash.each { |key, value| schemated[key] = value.type }\n schemated\n end", "def default_schema\n nil\n end", "def types\n load_schema! unless schema_loaded?\n @types\n end", "def functional_update_schema # abstract\n raise 'abstract'\n end", "def create_aggregate_table(base_name, dimension_fields, current_levels, options)\n # puts \"create_aggregate_table start: #{current_levels.inspect}\"\n\n table_name = aggregate_rollup_name(base_name, current_levels)\n table_options = options[:aggregate_table_options] || {}\n\n # # truncate if configured to, otherwise, just pile it on.\n if (options[:truncate] && write_connection.tables.include?(table_name))\n write_connection.drop_table(table_name)\n end\n\n unique_index_columns = []\n index_columns = []\n \n if !write_connection.tables.include?(table_name)\n aggregate_table_options = (options[:aggregate_table_options] || {}).merge({:id => false})\n # puts \"create_table: #{table_name}\"\n write_connection.create_table(table_name, aggregate_table_options) do |t|\n dimension_fields.each_with_index do |pair, i|\n dim = pair.first\n levels = pair.last\n max_level = current_levels[i]\n # puts \"dim.name = #{dim.name}, max = #{max_level}, i = #{i}\"\n levels.each_with_index do |field, j|\n break if (j >= max_level)\n column_options = {:null=>false}\n # unique_index_columns << field.label if (j == (max_level-1))\n\n # if it is a string or text column, then include the limit with the options\n if [:string, :text].include?(field.column_type)\n column_options[:limit] = field.limit\n column_options[:default] = ''\n elsif [:primary_key, :integer, :float, :decimal, :boolean].include?(field.column_type)\n column_options[:default] = 0\n end\n\n unique_index_columns << field.label\n index_columns << field.label\n t.column(field.label, field.column_type, column_options)\n end\n end\n\n aggregate_fields.each do |field|\n af_opts = {}\n\n # By default the aggregate field column type will be a count\n aggregate_type = :integer\n af_opts[:limit] = 8\n\n # But, if type is a decimal, and you do a sum or avg (not a count) then keep it a decimal\n if [:float, :decimal].include?(field.type) && field.strategy_name != :count\n af_opts[:limit] = field.type == :integer ? 8 : field.limit\n af_opts[:scale] = field.scale if field.scale\n af_opts[:precision] = field.precision if field.precision\n aggregate_type = field.column_type\n end\n\n t.column(field.label_for_table, aggregate_type, af_opts)\n end\n\n end\n\n # add index per dimension here (not for aggregate fields)\n index_columns.each{ |dimension_column|\n # puts \"making index for: #{table_name} on: #{dimension_column}\"\n write_connection.add_index(table_name, dimension_column, :name => \"by_#{dimension_column}\")\n }\n\n # Add a unique index for the \n unless unique_index_columns.empty?\n # puts \"making unique index for: #{table_name} on: #{unique_index_columns.inspect}\"\n write_connection.add_index(table_name, unique_index_columns, :unique => true, :name => \"by_unique_dims\") \n end\n\n # puts \"create_aggregate_table end\"\n table_name\n end\n\n end", "def schema\n @schema || (superclass.schema unless superclass == Model)\n end", "def audit_schema(as)\n @config[:audit_schema] = as\n end", "def schema(schema_name, stream)\n stream << \" create_schema \\\"#{schema_name}\\\"\\n\"\n end", "def build_collection_schema(**args)\n object.map { |object| self.class.new(object, **context).build_schema(**args) }\n end", "def schema\n @schema ||= metadata.ancestors('Schema').first\n end", "def aggregate(type, ts)\n Octo::Enterprise.each do |enterprise|\n aggregate_baseline enterprise.id, type, ts\n end\n end", "def user_defined_schemas(stream)\n return if (list = (@connection.user_defined_schemas - ['public'])).empty?\n\n stream.puts \" # Custom schemas defined in this database.\"\n list.each { |name| stream.puts \" create_schema \\\"#{name}\\\", force: :cascade\" }\n stream.puts\n end", "def aggregateAndWriteDocuments(collection, aggregateArray)\n collection.aggregate(aggregateArray)\n end", "def aggregate_fields\n cube_class.aggregate_fields\n end", "def apply_devise_schema(name, type, options={})\n return unless Devise.apply_schema\n property name, :cast_as => type\n end", "def fill_out\n @build = {}\n descend(@schema, [])\n @build\n end", "def property_schema_hash(repository, property)\n schema = super\n\n if property.serial?\n schema.delete(:default) # the sequence will be the default\n schema[:sequence_name] = sequence_name(repository, property)\n end\n\n # TODO: see if TypeMap can be updated to set specific attributes to nil\n # for different adapters. precision/scale are perfect examples for\n # Postgres floats\n\n # Postgres does not support precision and scale for Float\n if property.primitive == Float\n schema.delete(:precision)\n schema.delete(:scale)\n end\n\n schema\n end", "def build_type(type)\n return nil unless type.included_modules.include?(::Mongoid::Document)\n Rails.logger.debug \"Building Mongoid::Document type: #{type.name}\"\n\n # Build and cache the GraphQL type.\n # TODO: Map type inheritance to GraphQL interfaces.\n type_name = Types.to_type_name(type.name, namespace)\n types[type] = GraphQL::ObjectType.define do\n name type_name\n\n # Add the global node ID, if enabled; otherwise, document ID.\n if Rails.config.global_ids\n interfaces [NodeIdentification.interface]\n global_id_field :id\n else\n field :id do\n type -> { Types.resolve(BSON::ObjectId) }\n end\n end\n\n # Add each field from the document.\n # TODO: Support field exclusion and renaming.\n type.fields.each_value do |field_value|\n field Types.to_field_name(field_value.name) do\n property field_value.name.to_sym\n type -> { Types.resolve(field_value.type) }\n description field_value.label unless field_value.label.blank?\n end\n end\n\n # Add each relationship from the document as a Relay connection.\n type.relations.each_value do |relationship|\n # TODO: Add polymorphic support.\n if relationship.polymorphic?\n Rails.logger.warn(\n \"Skipping polymorphic relationship: #{relationship.name}\"\n )\n next\n end\n\n # Check that relationship has a valid type.\n begin\n klass = relationship.klass\n rescue\n Rails.logger.warn(\n \"Skipping relationship with invalid class: #{relationship.name}\"\n )\n next\n end\n\n if relationship.many?\n connection Types.to_field_name(relationship.name) do\n property relationship.name.to_sym\n type -> { Types.resolve(klass).connection_type }\n end\n else\n field Types.to_field_name(relationship.name) do\n property relationship.name.to_sym\n type -> { Types.resolve(klass) }\n end\n end\n end\n end\n end", "def types\n commit('types', nil)\n end", "def json_schema\n raise NotImplementedError\n end", "def json_schema\n raise NotImplementedError\n end", "def skip_schema_queries; end", "def create_aggregate( name, arity, step, finalize, type=nil )\n case type\n when :numeric\n type = SQLite::API::NUMERIC\n when :text\n type = SQLite::API::TEXT\n when :args\n type = SQLite::API::ARGS\n end\n\n step_callback = proc do |func,*args|\n ctx = SQLite::API.aggregate_context( func )\n step.call( FunctionProxy.new( func, ctx ), *args )\n end\n\n finalize_callback = proc do |func|\n ctx = SQLite::API.aggregate_context( func )\n finalize.call( FunctionProxy.new( func, ctx ) )\n end\n\n SQLite::API.create_aggregate( @handle, name, arity,\n step_callback, finalize_callback )\n\n SQLite::API.function_type( @handle, name, type ) if type\n\n self\n end", "def refresh_schema\n namespace = OData::NAMESPACE\n schema = OData::ActiveRecordSchema::Base\n .new(namespace, skip_require: true,\n skip_add_entity_types: true,\n transformers: {\n root: ->(*args) { transform_json_for_root(*args) },\n metadata: ->(*args) { transform_schema_for_metadata(*args) },\n feed: ->(*args) { transform_json_for_collection(*args) },\n entry: ->(*args) { transform_json_for_entry(*args) }\n })\n\n add_entity_types(schema, distinct_forms)\n\n ODataController.data_services.clear_schemas\n ODataController.data_services.append_schemas([schema])\n end", "def chooseSchema\n @metadata.chooseSchema\n end", "def to_schema\n self.value_to_schema unless self.value.blank?\n end", "def xmlschema(p1 = v1)\n #This is a stub, used for indexing\n end", "def define_schema\n yield schema if block_given?\n end", "def decorate_for_append(type_identifier, aggregate, stream)\n stream\n end", "def aggregate_types\n @references.map { |r| r.aggregate_type }.uniq.sort_by { |t| t.to_s }\n end", "def populate(options={})\n # puts \"PipelinedRolapAggregate::populate #{options.inspect}\"\n @new_records_record = nil\n\n # we need 2 connections\n # one to read, one to write\n self.read_connection = options[:read_connection] if options[:read_connection]\n self.write_connection = options[:write_connection] if options[:write_connection]\n\n # see if the options mean to do new records only\n if(options[:new_records_only])\n # need to know the name of the dimension and field to use to find new only\n @new_records_only = true\n @new_records_dimension = options[:new_records_only][:dimension] || :date\n @new_records_offset = options[:new_records_only][:buffer] || 1\n else\n @new_records_only = false\n end\n\n create_and_populate_aggregate(options)\n end", "def apply_devise_schema(name, type, options={})\n column name, type.to_s.downcase.to_sym, options\n end", "def create_schema schema_id, type, definition, options = {}\n schema = Google::Cloud::PubSub::V1::Schema.new(\n type: type,\n definition: definition\n )\n schemas.create_schema parent: project_path(options),\n schema: schema,\n schema_id: schema_id\n end", "def get_schema_level()\n\t\tend", "def aggregate\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :count => 0 },\n :reduce => Javascript.aggregate\n )\n end", "def create_aggregate_handler( handler )\n type = nil\n arity = -1\n\n type = handler.function_type if handler.respond_to?(:function_type)\n arity = handler.arity if handler.respond_to?(:arity)\n name = handler.name\n\n case type\n when :numeric\n type = SQLite::API::NUMERIC\n when :text\n type = SQLite::API::TEXT\n when :args\n type = SQLite::API::ARGS\n end\n\n step = proc do |func,*args|\n ctx = SQLite::API.aggregate_context( func )\n ctx[ :handler ] ||= handler.new\n ctx[ :handler ].step( FunctionProxy.new( func, ctx ), *args )\n end\n\n finalize = proc do |func|\n ctx = SQLite::API.aggregate_context( func )\n ctx[ :handler ] ||= handler.new\n begin\n ctx[ :handler ].finalize( FunctionProxy.new( func, ctx ) )\n rescue Exception => e\n STDERR.puts \"BUG: #{e.message} (#{e.class.name})\"\n STDERR.puts \"*** WARNING **** WARNING **** WARNING **** WARNING ****\"\n STDERR.puts \"*** THIS EXCEPTION SHOULD BE FATAL, BUT DUE TO\"\n STDERR.puts \"*** FRAGILITY IN THE FINALIZE CALLBACK IT WILL NOT\"\n STDERR.puts \"*** ABORT THE PROGRAM. PLEASE NOTIFY THE DEVELOPER OF\"\n STDERR.puts \"*** THIS APPLICATION AND ASK THEM TO CORRECT THE\"\n STDERR.puts \"*** PROBLEM.\"\n STDERR.puts \"*** WARNING **** WARNING **** WARNING **** WARNING ****\"\n STDERR.puts e.backtrace.join( \"\\n\" )\n end\n end\n\n SQLite::API.create_aggregate( @handle, name, arity, step, finalize )\n SQLite::API.function_type( @handle, name, type ) if type\n\n self\n end", "def aggregation?\n false\n end", "def default_schema\n # TODO: add parsing of available tags and measurements to put together\n # a default schema\n nil\n end", "def extend_schema(schema, file = nil, &block)\n Rubyrel::DDL::extend_schema(schema, file, &block)\n end", "def apply_schema_transformations\n # replace_exclusive_indicators_by_discriminators\n end", "def types; end", "def types; end", "def types; end", "def types; end" ]
[ "0.6682754", "0.6608514", "0.640476", "0.6218906", "0.61200637", "0.6013572", "0.59346664", "0.58826214", "0.58818483", "0.5806435", "0.58062404", "0.58002096", "0.57946223", "0.57759094", "0.57142127", "0.57091665", "0.5708315", "0.5666738", "0.565325", "0.56480676", "0.56270504", "0.5596971", "0.5592085", "0.5574423", "0.5573289", "0.5564413", "0.5553084", "0.5545957", "0.55275685", "0.5525789", "0.5525501", "0.55245304", "0.5521193", "0.5520286", "0.5519777", "0.55148554", "0.550781", "0.5506434", "0.54925716", "0.54817194", "0.5445585", "0.5436923", "0.54069096", "0.5398335", "0.5388745", "0.5386492", "0.53771377", "0.5373982", "0.5373219", "0.5371391", "0.53688747", "0.5368369", "0.5367204", "0.53660786", "0.53651774", "0.53608805", "0.5359065", "0.5357913", "0.5356988", "0.53567594", "0.5348624", "0.53446895", "0.5339869", "0.5330642", "0.53094274", "0.53038526", "0.52955264", "0.52953166", "0.5282637", "0.5281889", "0.52727133", "0.5237492", "0.52296597", "0.5221708", "0.52200645", "0.5214454", "0.5214454", "0.51977193", "0.5189883", "0.5184987", "0.5182632", "0.51816803", "0.51800764", "0.5179442", "0.51791245", "0.5173218", "0.5172585", "0.51721704", "0.5171533", "0.51694614", "0.51660556", "0.51600415", "0.51554453", "0.51447487", "0.51433265", "0.51403034", "0.51400054", "0.51400054", "0.51400054", "0.51400054" ]
0.80117494
0
GET /budgets GET /budgets.json
def index @budgets = Budget.where(:session => $sess_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def budgets\n # https://developer.xero.com/documentation/api/budgets\n # if you are having issues in adding the accounting.budgets.read scope, get in touch => api@xero.com\n @budgets = xero_client.accounting_api.get_budgets(current_user.active_tenant_id).budgets\n @budget = xero_client.accounting_api.get_budget(current_user.active_tenant_id, @budgets.sample.budget_id).budgets\n end", "def index\n get_budgets\n end", "def index\n @budgets = Budget.all\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end", "def get_budgets(opts = {})\n data, _status_code, _headers = get_budgets_with_http_info(opts)\n data\n end", "def get_budgets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budgets ...'\n end\n # resource path\n local_var_path = '/budgets'\n\n # query parameters\n query_params = {}\n query_params[:'include_accounts'] = opts[:'include_accounts'] if !opts[:'include_accounts'].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 = ['bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BudgetSummaryResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetsApi#get_budgets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @budget }\n end\n end", "def show\n load_budget\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end", "def get_budget_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetApi.get_budget_all_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/budget'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'currency_conversion'] = opts[:'currency_conversion'] if !opts[:'currency_conversion'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'PageBudget')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetApi#get_budget_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n # TODO: implement filters\n @budgets = Budget.order(\"budgets.starts_at DESC, budgets.number ASC\")\n .page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n #format.select2 { render json: { items: budgets.map(&:to_select2_json), total: @budgets.count} }\n #format.json { render json: @budgets }\n end\n end", "def index\n @budgets = Budget.all.paginate(page: params[:page], :per_page => 5).order(\"created_at DESC\")\n end", "def show\n @budget = Budget.find(params[:id])\n @other_budgets = current_user.budgets conditions: [\"id != ?\", @budget.id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to budgets_path }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def index\n @budgets = Budget.all\n @budgets = Budget.order(params[:by] + \" \" + params[:order]).page params[:page] if params[:sort] == \"true\"\n @budgets = Budget.order(:id).page params[:page]\n end", "def index\n @budget_approvers = BudgetApprover.all\n end", "def set_budget\n @budget = Budget.find(params[:id])\n\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def index\n\t\t@budget_id = params[:budget_id]\n\t\t@budget = Budget.find(@budget_id)\n\t\t@valorizations = @budget.valorizations\n\t\trender :index, :layout => false\n\tend", "def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n f = find_budgets\n format.ext_json { render :json => f.to_ext_json(:class => :budget, \n :count => f.length,\n :methods=>[:total_budget_costs,:total_budget_invoices,:total_budget_pricings],\n :include=>{:user=>{:only=>\"login\"}}) }\n \n end\n end", "def create\n @budget = Budget.new(budget_params)\n respond_to do |format|\n if @budget.save\n \n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: @budget.id)\n end\n end\n \n format.html { redirect_to budgets_path, notice: \"Budget was successfully created.\" }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, budget: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @budget = Budget.new\n @budgetProducts = []\n @customer = Customer.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end", "def show\n @budgetcategory = Budgetcategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budgetcategory }\n end\n end", "def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @budget }\n end\n end", "def banks_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: BanksApi#banks_get ...\"\n end\n \n # resource path\n path = \"/banks\".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']\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/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\n # http body (model)\n post_body = nil\n \n\n auth_names = ['khipu']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BanksResponse')\n if Configuration.debugging\n Configuration.logger.debug \"API called: BanksApi#banks_get. Result: #{result.inspect}\"\n end\n return result\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_budget_all_using_get(opts = {})\n data, _status_code, _headers = get_budget_all_using_get_with_http_info(opts)\n data\n end", "def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_budget_by_id_with_http_info(budget_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budget_by_id ...'\n end\n # verify the required parameter 'budget_id' is set\n if @api_client.config.client_side_validation && budget_id.nil?\n fail ArgumentError, \"Missing the required parameter 'budget_id' when calling BudgetsApi.get_budget_by_id\"\n end\n # resource path\n local_var_path = '/budgets/{budget_id}'.sub('{' + 'budget_id' + '}', budget_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'last_knowledge_of_server'] = opts[:'last_knowledge_of_server'] if !opts[:'last_knowledge_of_server'].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 = ['bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BudgetDetailResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetsApi#get_budget_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @budgetitems = Budgetitem.all.order(:name)\n end", "def index\n @budget_products = BudgetProduct.all\n end", "def get_budget_using_get_with_http_info(budget_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetApi.get_budget_using_get ...'\n end\n # verify the required parameter 'budget_id' is set\n if @api_client.config.client_side_validation && budget_id.nil?\n fail ArgumentError, \"Missing the required parameter 'budget_id' when calling BudgetApi.get_budget_using_get\"\n end\n # resource path\n local_var_path = '/nucleus/v1/budget/{budget_id}'.sub('{' + 'budget_id' + '}', budget_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'currency_conversion'] = opts[:'currency_conversion'] if !opts[:'currency_conversion'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'Budget')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetApi#get_budget_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_budgets(db)\r\n budgets = db.execute(\"SELECT * FROM budgets\")\r\nend", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def index\n @time = Time.new\n @prev_time = @time - 1.month\n @next_time = @time + 1.month\n @months = [@prev_time, @time, @next_time]\n @month_time_format = \"%B %Y\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def index\n @therapy_budgets = TherapyBudget.all\n end", "def index\n p \"#{params}\"\n @budget_lines = BudgetLine.all\n respond_to do |format|\n format.html\n format.js\n end\n end", "def bills(options = {})\n get('/bills', options)\n end", "def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end", "def show\n add_breadcrumb I18n.t('helpers.breadcrumbs.budgets.show')\n @budget_details = BudgetDetail.all\n\n @budget = Budget.find(params[:id])\n respond_to do |format|\n format.html\n format.pdf do\n pdf = BudgetPdf.new(@budget, view_context)\n send_data pdf.render,\n filename: \"budget_#{@budget.id}.pdf\",\n type: 'application/pdf',\n disposition: 'inline'\n end\n format.json {render json: @budget, include: :budget_details}\n end\n end", "def index\n @export_budgets = ExportBudget.all\n end", "def budget_params\n params.require(:budget).permit(:name, :from, :expires, :user_id, items: [:id])\n end", "def budget_params\n params.require(:budget).permit(:income, :savings, :housing, :utilities, :food, :food, :transportation, :clothing, :personal, :recreation, :debt, :kids, :session, :budget_name)\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def show\n @budgeting_type = BudgetingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budgeting_type }\n end\n end", "def budget_params\n params.require(:budget).permit(:name, :allotment, :start, :end)\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def index\n @budget_dispositions = BudgetDisposition.all\n end", "def create\n @budget = Budget.new(budget_params)\n @client = Client.new\n @clients = Client.all\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'El presupuesto se creó correctamente' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @banks = Bank.all\n render json: @banks\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def balances(id)\n get(\"/accounts/#{id}/balances\")\n end", "def get_banks\n HTTParty.get(BASE_URI + 'bank?country=ghana',\n headers: HEADERS).parsed_response\n end", "def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end", "def get_budget_by_id(budget_id, opts = {})\n data, _status_code, _headers = get_budget_by_id_with_http_info(budget_id, opts)\n data\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def index\n @bills = Bill.all_cached\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end", "def get_budget_using_get(budget_id, opts = {})\n data, _status_code, _headers = get_budget_using_get_with_http_info(budget_id, opts)\n data\n end", "def create\n @budget = Budget.new(params[:budget])\n @budget.user = current_user\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_budget_for_order\n @budget_for_order = BudgetForOrder.find(params[:id])\n @budgets=Budget.where([\"budget_for_order_id = ?\", \"#{params[:id]}\"])\n end", "def budget\n budget = Paystub.where(year: Time.now.year, month: Time.now.month).reorder('').pluck(Arel.sql('SUM(clinic_deduction)')).first\n\t budget ||= 0.0\n\t flash.now[:info] = \"This month's budget (sum of deductions of all active doctors): #{sprintf(\"$%.2f\",budget)} \"\n\t render inline: '', layout: true\n end", "def getbalance(args={})\n {\n :method=> \"GetBalances\"\n }.to_json\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n Item.where([\"budget_id = #{params[:id]}\"]).update_all(budget_id: nil)\n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: params[:id])\n end\n end\n format.html { redirect_to budgets_path, notice: \"Budget was successfully updated.\" }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @budgetcategory = Budgetcategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budgetcategory }\n end\n end", "def index\n @export_budgets = ExportBudget.get_export_budgets_by_user current_user\n @export_budgets = @export_budgets.page(params[:page]).per(25)\n end", "def balances()\n request(\"#{@base_url}/account/getbalances\")\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end", "def index\n # @budget_domains = current_user.budget_domains\n end", "def index\n if params[:page] == '1' and params[:per_page] == '10' and params[:sort_by] == 'count' and params[:order] == 'desc'\n burn_list = Rails.cache.fetch('burn_list') { CodeburnerUtil.get_burn_list }\n return render(:json => {count: Rails.cache.fetch('stats'){CodeburnerUtil.get_stats}[:burns], results: burn_list })\n end\n\n safe_sorts = ['id', 'service_id', 'service_name', 'revision', 'code_lang', 'repo_url', 'status']\n sort_by = 'burns.id'\n order = nil\n\n if params[:sort_by] == 'service_name'\n sort_by = \"services.pretty_name\"\n else\n sort_by = \"#{params[:sort_by]}\" if safe_sorts.include? params[:sort_by]\n end\n\n unless params[:order].nil?\n order = params[:order].upcase if ['ASC','DESC'].include? params[:order].upcase\n end\n\n burns = Burn.id(params[:id]) \\\n .service_id(params[:service_id]) \\\n .service_name(params[:service_name]) \\\n .revision(params[:revision]) \\\n .status(params[:status]) \\\n .order(\"#{sort_by} #{order}\") \\\n .page(params[:page]) \\\n .per(params[:per_page]) \\\n\n render(:json => {count: burns.total_count, results: burns})\n end", "def index\n @entries = current_user.entries.for_month(@date)\n @budgets = current_user.budgets\n end", "def index\n @funds = Fund.all\n\n render json: @funds\n end", "def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end", "def show\n @breadcrumb = 'read'\n @budget_heading = BudgetHeading.find(params[:id])\n @charge_groups = @budget_heading.charge_groups.paginate(:page => params[:page], :per_page => per_page).order(:group_code)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget_heading }\n end\n end", "def index\n @budget_for_orders = BudgetForOrder.all.order(\"created_at DESC\")\n end", "def bills\n data = []\n data.push AdaptedMiscFee.represent(miscellaneous_fees)\n data.push AdaptedExpense.represent(object.expenses)\n data.flatten.as_json\n end", "def banks_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.banks_get ...'\n end\n # resource path\n local_var_path = '/banks'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse2008')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#banks_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @buisinesses = Buisiness.all\n end", "def index\n @brave_bursts = BraveBurst.all\n end", "def get_balance (opts={})\n query_param_keys = []\n headerParams = {}\n\n \n \n # set default values and merge with input\n options = {\n \n }.merge(opts)\n\n #resource path\n path = \"/get-balance.json\".sub('{format}','json')\n \n # pull querystring keys from options\n queryopts = options.select do |key,value|\n query_param_keys.include? key\n end\n\n # header parameters\n headers = {}\n\n _header_accept = 'application/json'\n if _header_accept != ''\n headerParams['Accept'] = _header_accept\n end \n _header_content_type = ['application/x-www-form-urlencoded']\n headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'\n\n \n \n headers[:'Authorization'] = @api_key_secret\n\n # http body (model)\n post_body = nil\n \n # form parameters\n form_parameter_hash = {}\n \n \n \n Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make\n \n \n end", "def new\n @budget = Budget.new\n @budget.year = Time.new.year\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end", "def index\n @bucketlist_item = BucketlistItem.all\n # @bucketlist_item = @trip.bucketlist_item\n render json: @bucketlist_item\n end", "def index\n @ptbudgets = Ptbudget.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ptbudgets }\n end\n end", "def index\n @bids = Bid.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bids }\n end\n end", "def index\n render json: Bill.all\n end", "def get_accounts_with_http_info(budget_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AccountsApi.get_accounts ...'\n end\n # verify the required parameter 'budget_id' is set\n if @api_client.config.client_side_validation && budget_id.nil?\n fail ArgumentError, \"Missing the required parameter 'budget_id' when calling AccountsApi.get_accounts\"\n end\n # resource path\n local_var_path = '/budgets/{budget_id}/accounts'.sub('{' + 'budget_id' + '}', budget_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'last_knowledge_of_server'] = opts[:'last_knowledge_of_server'] if !opts[:'last_knowledge_of_server'].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 = ['bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#get_accounts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_bank_link_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.get_bank_link_all_using_get ...'\n end\n # resource path\n local_var_path = '/bank_link'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'PageBankLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingApi#get_bank_link_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @budget_item = BudgetItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @budget_item }\n end\n end", "def index\n @banks = Bank.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banks }\n end\n end" ]
[ "0.7769996", "0.77680784", "0.76790833", "0.739718", "0.7325283", "0.71915555", "0.7146855", "0.71041167", "0.70492715", "0.692903", "0.6864969", "0.6825186", "0.6761401", "0.6596338", "0.65764004", "0.6477175", "0.6459417", "0.6458338", "0.6431454", "0.6426355", "0.6417248", "0.6417248", "0.6417248", "0.6417248", "0.64165884", "0.64164", "0.64030504", "0.63625014", "0.6353747", "0.63443774", "0.63148355", "0.6296559", "0.6262398", "0.62623143", "0.625223", "0.62503594", "0.62469137", "0.6219244", "0.6203762", "0.61347824", "0.61234367", "0.6117745", "0.6099147", "0.6097498", "0.6080665", "0.60688007", "0.60551584", "0.60387754", "0.6032888", "0.6030239", "0.60156906", "0.6004826", "0.59798795", "0.5936623", "0.5932602", "0.5925215", "0.59130263", "0.5912349", "0.59072495", "0.5903028", "0.58839345", "0.5862721", "0.58383864", "0.5838349", "0.58309364", "0.58171165", "0.5814148", "0.57470506", "0.5742447", "0.5720855", "0.5714037", "0.57042205", "0.5703945", "0.56937355", "0.5692533", "0.5692533", "0.5681312", "0.56651247", "0.5660329", "0.564416", "0.5642915", "0.5627821", "0.5613365", "0.5610579", "0.56082207", "0.56061435", "0.5595166", "0.5592145", "0.55901676", "0.558298", "0.5575735", "0.5566237", "0.5555432", "0.5554019", "0.5546615", "0.55447173", "0.5544005", "0.5544005", "0.5537166", "0.55276155" ]
0.6327502
30
GET /budgets/1 GET /budgets/1.json
def show @budget = Budget.find(params[:id]) @incomev = @budget.income @savingv = @budget.income * 0.05 unless @budget.income.nil? @housingv = @budget.income * 0.24 unless @budget.income.nil? @utilitiev = @budget.income * 0.05 unless @budget.income.nil? @foodv = @budget.income * 0.08 unless @budget.income.nil? @transportationv = @budget.income * 0.09 unless @budget.income.nil? @clothingv = @budget.income * 0.07 unless @budget.income.nil? @personalv = @budget.income * 0.09 unless @budget.income.nil? @recreationv = @budget.income * 0.09 unless @budget.income.nil? @debtv = @budget.income * 0.09 unless @budget.income.nil? @kidv = @budget.income * 0.18 unless @budget.income.nil? @savingx = @budget.savings @housingx = @budget.housing @utilitiex = @budget.utilities @foodx = @budget.food @transportationx = @budget.transportation @clothingx = @budget.clothing @personalx = @budget.personal @recreationx = @budget.recreation @debtx = @budget.debt @kidx = @budget.kids @total_suggested = @savingv + @housingv + @utilitiev + @foodv + @transportationv + @clothingv + @personalv + @recreationv + @debtv + @kidv @total_actual = @savingx + @housingx + @utilitiex + @foodx + @transportationx + @clothingx + @personalx + @recreationx + @debtx + @kidx if @savingv > @savingx @savingz = (@savingv - @savingx) else @savingz = (@savingx - @savingv) end if @housingv > @housingx @housingz = (@housingv - @housingx) else @housingz = (@housingx - @housingv) end if @utilitiev > @utilitiex @utilitiez = (@utilitiev - @utilitiex) else @utilitiez = (@utilitiex - @utilitiev) end if @foodv > @foodx @foodz = (@foodv - @foodx) else @foodz = (@foodx - @foodv) end if @transportationv > @transportationx @transportationz = (@transportationv - @transportationx) else @transportationz = (@transportationx - @transportationv) end if @clothingv > @clothingx @clothingz = (@clothingv - @clothingx) else @clothingz = (@clothingx - @clothingv) end if @personalv > @personalx @personalz = (@personalv - @personalx) else @personalz = (@personalx - @personalv) end if @recreationv > @recreationx @recreationz = (@recreationv - @recreationx) else @recreationz = (@recreationx - @recreationv) end if @debtv > @debtx @debtz = (@debtv - @debtx) else @debtz = (@debtx - @debtv) end if @kidv > @kidx @kidz = (@kidv - @kidx) else @kidz = (@kidx - @kidv) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n get_budgets\n end", "def index\n @budgets = Budget.all\n end", "def show\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @budget }\n end\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def budgets\n # https://developer.xero.com/documentation/api/budgets\n # if you are having issues in adding the accounting.budgets.read scope, get in touch => api@xero.com\n @budgets = xero_client.accounting_api.get_budgets(current_user.active_tenant_id).budgets\n @budget = xero_client.accounting_api.get_budget(current_user.active_tenant_id, @budgets.sample.budget_id).budgets\n end", "def show\n load_budget\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end", "def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end", "def set_budget\n @budget = Budget.find(params[:id])\n\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to budgets_path }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @budget }\n end\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, budget: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @budget = Budget.find(params[:id])\n @other_budgets = current_user.budgets conditions: [\"id != ?\", @budget.id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end", "def get_budgets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budgets ...'\n end\n # resource path\n local_var_path = '/budgets'\n\n # query parameters\n query_params = {}\n query_params[:'include_accounts'] = opts[:'include_accounts'] if !opts[:'include_accounts'].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 = ['bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BudgetSummaryResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetsApi#get_budgets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @budgetcategory = Budgetcategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budgetcategory }\n end\n end", "def new\n @budget = Budget.new\n @budgetProducts = []\n @customer = Customer.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(budget_params)\n respond_to do |format|\n if @budget.save\n \n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: @budget.id)\n end\n end\n \n format.html { redirect_to budgets_path, notice: \"Budget was successfully created.\" }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_budget_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetApi.get_budget_all_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/budget'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'currency_conversion'] = opts[:'currency_conversion'] if !opts[:'currency_conversion'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'PageBudget')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetApi#get_budget_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_budget_by_id_with_http_info(budget_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budget_by_id ...'\n end\n # verify the required parameter 'budget_id' is set\n if @api_client.config.client_side_validation && budget_id.nil?\n fail ArgumentError, \"Missing the required parameter 'budget_id' when calling BudgetsApi.get_budget_by_id\"\n end\n # resource path\n local_var_path = '/budgets/{budget_id}'.sub('{' + 'budget_id' + '}', budget_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'last_knowledge_of_server'] = opts[:'last_knowledge_of_server'] if !opts[:'last_knowledge_of_server'].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 = ['bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BudgetDetailResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetsApi#get_budget_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n # TODO: implement filters\n @budgets = Budget.order(\"budgets.starts_at DESC, budgets.number ASC\")\n .page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n #format.select2 { render json: { items: budgets.map(&:to_select2_json), total: @budgets.count} }\n #format.json { render json: @budgets }\n end\n end", "def index\n @budgets = Budget.all.paginate(page: params[:page], :per_page => 5).order(\"created_at DESC\")\n end", "def show\n @budgeting_type = BudgetingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budgeting_type }\n end\n end", "def show\n add_breadcrumb I18n.t('helpers.breadcrumbs.budgets.show')\n @budget_details = BudgetDetail.all\n\n @budget = Budget.find(params[:id])\n respond_to do |format|\n format.html\n format.pdf do\n pdf = BudgetPdf.new(@budget, view_context)\n send_data pdf.render,\n filename: \"budget_#{@budget.id}.pdf\",\n type: 'application/pdf',\n disposition: 'inline'\n end\n format.json {render json: @budget, include: :budget_details}\n end\n end", "def get_budget_using_get_with_http_info(budget_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetApi.get_budget_using_get ...'\n end\n # verify the required parameter 'budget_id' is set\n if @api_client.config.client_side_validation && budget_id.nil?\n fail ArgumentError, \"Missing the required parameter 'budget_id' when calling BudgetApi.get_budget_using_get\"\n end\n # resource path\n local_var_path = '/nucleus/v1/budget/{budget_id}'.sub('{' + 'budget_id' + '}', budget_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'currency_conversion'] = opts[:'currency_conversion'] if !opts[:'currency_conversion'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'Budget')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetApi#get_budget_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_budgets(opts = {})\n data, _status_code, _headers = get_budgets_with_http_info(opts)\n data\n end", "def index\n @budget_approvers = BudgetApprover.all\n end", "def index\n\t\t@budget_id = params[:budget_id]\n\t\t@budget = Budget.find(@budget_id)\n\t\t@valorizations = @budget.valorizations\n\t\trender :index, :layout => false\n\tend", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def index\n @budgets = Budget.where(:session => $sess_name)\n\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def create\n @budget = Budget.new(params[:budget])\n @budget.user = current_user\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @budget = Budget.new\n @budget.year = Time.new.year\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end", "def create\n @budget = Budget.new(budget_params)\n @client = Client.new\n @clients = Client.all\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'El presupuesto se creó correctamente' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @budgets = Budget.all\n @budgets = Budget.order(params[:by] + \" \" + params[:order]).page params[:page] if params[:sort] == \"true\"\n @budgets = Budget.order(:id).page params[:page]\n end", "def get_budgets(db)\r\n budgets = db.execute(\"SELECT * FROM budgets\")\r\nend", "def new\n @budgetcategory = Budgetcategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budgetcategory }\n end\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n f = find_budgets\n format.ext_json { render :json => f.to_ext_json(:class => :budget, \n :count => f.length,\n :methods=>[:total_budget_costs,:total_budget_invoices,:total_budget_pricings],\n :include=>{:user=>{:only=>\"login\"}}) }\n \n end\n end", "def set_budgetitem\n @budgetitem = Budgetitem.find(params[:id])\n end", "def banks_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: BanksApi#banks_get ...\"\n end\n \n # resource path\n path = \"/banks\".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']\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/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\n # http body (model)\n post_body = nil\n \n\n auth_names = ['khipu']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BanksResponse')\n if Configuration.debugging\n Configuration.logger.debug \"API called: BanksApi#banks_get. Result: #{result.inspect}\"\n end\n return result\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def budget_params\n params.require(:budget).permit(:name, :from, :expires, :user_id, items: [:id])\n end", "def index\n @budget_products = BudgetProduct.all\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n # format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_budget_for_order\n @budget_for_order = BudgetForOrder.find(params[:id])\n @budgets=Budget.where([\"budget_for_order_id = ?\", \"#{params[:id]}\"])\n end", "def get_budget_by_id(budget_id, opts = {})\n data, _status_code, _headers = get_budget_by_id_with_http_info(budget_id, opts)\n data\n end", "def show\n @budget_item = BudgetItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @budget_item }\n end\n end", "def budget_params\n params.require(:budget).permit(:income, :savings, :housing, :utilities, :food, :food, :transportation, :clothing, :personal, :recreation, :debt, :kids, :session, :budget_name)\n end", "def index\n @budgetitems = Budgetitem.all.order(:name)\n end", "def new\n @budgeting_type = BudgetingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budgeting_type }\n end\n end", "def index\n @time = Time.new\n @prev_time = @time - 1.month\n @next_time = @time + 1.month\n @months = [@prev_time, @time, @next_time]\n @month_time_format = \"%B %Y\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n Item.where([\"budget_id = #{params[:id]}\"]).update_all(budget_id: nil)\n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: params[:id])\n end\n end\n format.html { redirect_to budgets_path, notice: \"Budget was successfully updated.\" }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def budget_params\n params.require(:budget).permit(:name, :allotment, :start, :end)\n end", "def new\n @breadcrumb = 'create'\n @budget_heading = BudgetHeading.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget_heading }\n end\n end", "def set_budget_request\n @budget_request = BudgetRequest.find(params[:id])\n end", "def index\n @therapy_budgets = TherapyBudget.all\n end", "def current_budget\n Budget.where(user_id: current_user.id).sort_by(&:created_at).last\n end", "def get_budget_using_get(budget_id, opts = {})\n data, _status_code, _headers = get_budget_using_get_with_http_info(budget_id, opts)\n data\n end", "def budget\n budget = Paystub.where(year: Time.now.year, month: Time.now.month).reorder('').pluck(Arel.sql('SUM(clinic_deduction)')).first\n\t budget ||= 0.0\n\t flash.now[:info] = \"This month's budget (sum of deductions of all active doctors): #{sprintf(\"$%.2f\",budget)} \"\n\t render inline: '', layout: true\n end", "def index\n p \"#{params}\"\n @budget_lines = BudgetLine.all\n respond_to do |format|\n format.html\n format.js\n end\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def index\n @budget_dispositions = BudgetDisposition.all\n end", "def index\n @export_budgets = ExportBudget.all\n end", "def show\n @breadcrumb = 'read'\n @budget_heading = BudgetHeading.find(params[:id])\n @charge_groups = @budget_heading.charge_groups.paginate(:page => params[:page], :per_page => per_page).order(:group_code)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget_heading }\n end\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def get_budget_settings_by_id_with_http_info(budget_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budget_settings_by_id ...'\n end\n # verify the required parameter 'budget_id' is set\n if @api_client.config.client_side_validation && budget_id.nil?\n fail ArgumentError, \"Missing the required parameter 'budget_id' when calling BudgetsApi.get_budget_settings_by_id\"\n end\n # resource path\n local_var_path = '/budgets/{budget_id}/settings'.sub('{' + 'budget_id' + '}', budget_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BudgetSettingsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetsApi#get_budget_settings_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @budgetitem = Budgetitem.new(budgetitem_params)\n\n respond_to do |format|\n if @budgetitem.save\n format.html { redirect_to @budgetitem, notice: 'Budgetitem was successfully created.' }\n format.json { render :show, status: :created, location: @budgetitem }\n else\n format.html { render :new }\n format.json { render json: @budgetitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @budget_item = BudgetItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @budget_item }\n end\n end", "def index\n @banks = Bank.all\n render json: @banks\n end", "def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end", "def getbalance(args={})\n {\n :method=> \"GetBalances\"\n }.to_json\n end", "def show\n @monthly_revenue_breakdown_item = MonthlyRevenueBreakdownItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly_revenue_breakdown_item }\n end\n end", "def get_balance (opts={})\n query_param_keys = []\n headerParams = {}\n\n \n \n # set default values and merge with input\n options = {\n \n }.merge(opts)\n\n #resource path\n path = \"/get-balance.json\".sub('{format}','json')\n \n # pull querystring keys from options\n queryopts = options.select do |key,value|\n query_param_keys.include? key\n end\n\n # header parameters\n headers = {}\n\n _header_accept = 'application/json'\n if _header_accept != ''\n headerParams['Accept'] = _header_accept\n end \n _header_content_type = ['application/x-www-form-urlencoded']\n headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'\n\n \n \n headers[:'Authorization'] = @api_key_secret\n\n # http body (model)\n post_body = nil\n \n # form parameters\n form_parameter_hash = {}\n \n \n \n Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make\n \n \n end", "def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end", "def show\n @budget_src = BudgetSrc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @budget_src }\n end\n end", "def get_budget_all_using_get(opts = {})\n data, _status_code, _headers = get_budget_all_using_get_with_http_info(opts)\n data\n end", "def index\n @bills = Bill.all_cached\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end", "def bills(options = {})\n get('/bills', options)\n end", "def show\n @year= @budget.budget_date.year\n @month= @budget.budget_date.month\n @budget.year= @year\n @budget.month = @month\n\n @ref = @budget.id\n @totalincome = Income.where(budget_id: @ref).sum(:amount)\n @totalexpense = Expense.where(budget_id: @ref).sum(:amount)\n\n @incomes = Income.where(budget_id: @ref)\n @expenses = Expense.where(budget_id: @ref)\n\n @balance = (@totalincome - @totalexpense)\n @budget.balance= @balance\n\n\n\n # Budget number\n @budget_number = (@budget.id + 10000 )\n @budget.budget_number = @budget_number\n\n @budget.save\n\n\n end", "def destroy\n if params[:id] =~ /\\d+/\n @budget = Budget.find(params[:id])\n ActiveRecord::Base.connection.execute(\"delete from budget_products where budget_id = #{params[:id]}\")\n @budget.destroy\n end\n \n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def update\n budget = Budget.find params[:budget_id]\n budget.status = false\n budget.save\n redirect_to budgets_path\n end", "def show\n @ptbudget = Ptbudget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end", "def show\n @ptbudget = Ptbudget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ptbudget }\n end\n end", "def balances(id)\n get(\"/accounts/#{id}/balances\")\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'El presupuesto se actualizó correctamente' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render \"api/v1/bounties/show\"\n end", "def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @debt }\n end\n end", "def create_budget_using_post_with_http_info(budget_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetApi.create_budget_using_post ...'\n end\n # verify the required parameter 'budget_request' is set\n if @api_client.config.client_side_validation && budget_request.nil?\n fail ArgumentError, \"Missing the required parameter 'budget_request' when calling BudgetApi.create_budget_using_post\"\n end\n # resource path\n local_var_path = '/nucleus/v1/budget'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(budget_request)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Budget')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetApi#create_budget_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @breakdown = Breakdown.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @breakdown }\n end\n end" ]
[ "0.7615787", "0.75374943", "0.7529997", "0.7425407", "0.72966695", "0.7277789", "0.7269815", "0.7213055", "0.7091219", "0.70826834", "0.70211214", "0.7009892", "0.7009892", "0.7009892", "0.7009892", "0.6993125", "0.69291615", "0.6853403", "0.68420106", "0.68058616", "0.6762416", "0.67546386", "0.67434245", "0.6691755", "0.6689713", "0.66890424", "0.6677295", "0.6672872", "0.65968406", "0.64825207", "0.6477445", "0.6439453", "0.6410351", "0.638704", "0.63260466", "0.6325526", "0.63140506", "0.6302482", "0.62943214", "0.62888235", "0.6274012", "0.6271236", "0.62666565", "0.61999017", "0.6199116", "0.61937183", "0.61937183", "0.61798114", "0.61749464", "0.61727166", "0.61673456", "0.61673456", "0.61628187", "0.6153897", "0.61447716", "0.6144368", "0.60746956", "0.6074386", "0.6073179", "0.6068948", "0.60623866", "0.6025242", "0.5999898", "0.5990785", "0.59807247", "0.5953809", "0.59371287", "0.5924717", "0.59168375", "0.59118307", "0.5883353", "0.5845518", "0.5840875", "0.5809395", "0.5804463", "0.57767224", "0.57673675", "0.5760071", "0.57550216", "0.5741791", "0.5710379", "0.56985784", "0.56939024", "0.56930286", "0.56814647", "0.5675819", "0.5661793", "0.5659102", "0.5647766", "0.56441975", "0.5638899", "0.5638702", "0.5635474", "0.56320643", "0.56320643", "0.56306034", "0.56259394", "0.5616036", "0.55902344", "0.5590123", "0.5589417" ]
0.0
-1
POST /budgets POST /budgets.json
def create @budget = Budget.new(budget_params) respond_to do |format| if @budget.save format.html { redirect_to @budget, notice: 'Budget was successfully created.' } format.json { render :show, status: :created, location: @budget } else format.html { render :new } format.json { render json: @budget.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to budgets_path }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(budget_params)\n respond_to do |format|\n if @budget.save\n \n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: @budget.id)\n end\n end\n \n format.html { redirect_to budgets_path, notice: \"Budget was successfully created.\" }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, budget: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(budget_params)\n @client = Client.new\n @clients = Client.all\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'El presupuesto se creó correctamente' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def budget_params\n params.require(:budget).permit(:income, :savings, :housing, :utilities, :food, :food, :transportation, :clothing, :personal, :recreation, :debt, :kids, :session, :budget_name)\n end", "def budget_params\n params.require(:budget).permit(:name, :allotment, :start, :end)\n end", "def create\n @budget = Budget.new(params[:budget])\n @budget.user = current_user\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def budget_params\n params.require(:budget).permit(:name, :from, :expires, :user_id, items: [:id])\n end", "def budgets\n # https://developer.xero.com/documentation/api/budgets\n # if you are having issues in adding the accounting.budgets.read scope, get in touch => api@xero.com\n @budgets = xero_client.accounting_api.get_budgets(current_user.active_tenant_id).budgets\n @budget = xero_client.accounting_api.get_budget(current_user.active_tenant_id, @budgets.sample.budget_id).budgets\n end", "def index\n @budgets = Budget.all\n end", "def create_budget_using_post_with_http_info(budget_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetApi.create_budget_using_post ...'\n end\n # verify the required parameter 'budget_request' is set\n if @api_client.config.client_side_validation && budget_request.nil?\n fail ArgumentError, \"Missing the required parameter 'budget_request' when calling BudgetApi.create_budget_using_post\"\n end\n # resource path\n local_var_path = '/nucleus/v1/budget'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(budget_request)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Budget')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetApi#create_budget_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n get_budgets\n end", "def set_budget\n @budget = Budget.find(params[:id])\n\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def create\n @budgetitem = Budgetitem.new(budgetitem_params)\n\n respond_to do |format|\n if @budgetitem.save\n format.html { redirect_to @budgetitem, notice: 'Budgetitem was successfully created.' }\n format.json { render :show, status: :created, location: @budgetitem }\n else\n format.html { render :new }\n format.json { render json: @budgetitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def new\n @budget = Budget.new\n @budgetProducts = []\n @customer = Customer.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end", "def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def budget_params\n params.require(:budget).permit(:client_id, :contract_id, :date, :description, :state, :total_amount, :name,\n budget_details_attributes: [:id, :rubro_id, :cost, :measurement_unit, :price, :quantity, :subtotal, :utility, :_destroy])\n end", "def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @budget }\n end\n end", "def create\n @item = Item.new(params[:item])\n @item.budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to after_save_redirection_path, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(budget_params)\n @budget1 = @budget\n respond_to do |format|\n if @budget.save\n BudgetMailer.budget_email(@budget1).deliver_now\n format.html { redirect_to reservation_requests_path, notice: 'Presupuesto creado exitosamente.' }\n else\n @my_reservation_requests = ReservationRequest.find(budget_params[:reservation_request_id])\n Rails.logger.debug \" conteo: #{1}\"\n @budget.budget_service_details.build\n @budget.budget_room_details.build\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def budget_params\n params.require(:budget).permit(:user_id, :month, :year, :budget_date, :name,\n incomes_attributes:[:id,:monthtitle_id,:yeartitle_id,\n :person_id,\n :inflowtype_id,:owner,:amount,:user_id,:details,:income_type,\n :month,:year,:_destroy],\n expenses_attributes:[:id,:monthtitle_id,:yeartitle_id, :outflowtype_id,:person_id,:owner, :amount, :user_id,\n :details,:expense_type,:month,:year ,:_destroy],\n comments_attributes:[:id,:user_id, :commentary,:_destroy])\n end", "def create\n @budget = Budget.find(params[:budget_id])\n @proposed_item = @budget.proposed_items.build(proposed_item_params)\n\n respond_to do |format|\n if @proposed_item.save\n format.html { redirect_to @budget, notice: 'Proposed item was successfully created.' }\n format.json { render :show, status: :created, location: @proposed_item }\n else\n format.html { render :new }\n format.json { render json: @proposed_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @therapy_budget = TherapyBudget.new(therapy_budget_params)\n\n respond_to do |format|\n if @therapy_budget.save\n format.html { redirect_to @therapy_budget, notice: 'Therapy budget was successfully created.' }\n format.json { render :show, status: :created, location: @therapy_budget }\n else\n format.html { render :new }\n format.json { render json: @therapy_budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_budget_using_post(budget_request, opts = {})\n data, _status_code, _headers = create_budget_using_post_with_http_info(budget_request, opts)\n data\n end", "def create\n budget = Budget.find(contract_params[:budget_id])\n @contract = Contract.new_by_budget(contract_params, budget)\n respond_to do |format|\n if @contract.save\n contract = Contract.find(@contract.id)\n budget.update(state: Budget.states[:approved], contract: @contract)\n format.html { redirect_to contract, notice: 'El contrato se creó correctamente.' }\n format.json { render :show, status: :created, location: @contract }\n else\n format.html { render :new }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget_approver = BudgetApprover.new(budget_approver_params)\n respond_to do |format|\n if @budget_approver.save\n format.html { redirect_to @budget_approver, notice: 'Budget approver page was successfully created.' }\n format.json { render :show, status: :created, location: @budget_approver }\n else\n format.html { render :new }\n format.json { render json: @budget_approver.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n pay_amount[] = params[:budget].pay_amount\n @pay_classifications.each do |id|\n\n Budget.new( ym: params[:budget].ymd,\n pay_classification: id,\n pay_amount: pay_amount[id],\n\n )\n\ncreate_table :budgets do |t|\n t.date :ym\n t.references :pay_classification, foreign_key: true\n t.integer :pay_amount\n t.references :income_classification, foreign_key: true\n t.integer :income_amount\n t.references :user, foreign_key: true\n\n t.timestamps\nend\n\n end\n\n @Budget = Budget.new(budget_params)\n @Budget.user_id = current_user.id if current_user\n \n if @JounalEntry.save\n redirect_to \"/\", notice: \"登録しました。\"\n else\n @paytypes = PayType.all\n render :new\n end\n \n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n Item.where([\"budget_id = #{params[:id]}\"]).update_all(budget_id: nil)\n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: params[:id])\n end\n end\n format.html { redirect_to budgets_path, notice: \"Budget was successfully updated.\" }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budgetcategory = Budgetcategory.new(params[:budgetcategory])\n\n respond_to do |format|\n if @budgetcategory.save\n format.html { redirect_to @budgetcategory, notice: 'Budgetcategory was successfully created.' }\n format.json { render json: @budgetcategory, status: :created, location: @budgetcategory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budgetcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_budget_for_order\n @budget_for_order = BudgetForOrder.find(params[:id])\n @budgets=Budget.where([\"budget_for_order_id = ?\", \"#{params[:id]}\"])\n end", "def create\n @budget_item = BudgetItem.new(params[:budget_item])\n\n respond_to do |format|\n if @budget_item.save\n format.html { redirect_to(@budget_item, :notice => 'Budget item was successfully created.') }\n format.xml { render :xml => @budget_item, :status => :created, :location => @budget_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @budget_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @budget_for_order = BudgetForOrder.new(budget_for_order_params)\n @budget_for_order.total=0\n respond_to do |format|\n if @budget_for_order.save\n format.html { redirect_to budget_new_add_path(@budget_for_order.id), notice: 'Favor de agregar los detalles' }\n format.json { render :show, status: :created, location: @budget_for_order }\n else\n format.html { render :new }\n format.json { render json: @budget_for_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def budget_params\n params.require(:budget).permit(:id,:reservation_request_id,:comfort_id,:check_in, :check_out,:comentario, :descuento, :total,:budget_room_details_attributes => [:id, :cantidad, :type_of_room_id, :subtotal, :_destroy], :budget_service_details_attributes => [:id, :cantidad, :service_id, :subtotal, :_destroy])\n end", "def budget_product_params\n params.require(:budget_product).permit(:quantity, :integer, :product_id, :budget)\n end", "def create_budget(budget_name)\r\n budget_name << \".db\"\r\n\r\n db = SQLite3::Database.new(\"#{budget_name}\")\r\n\r\n budget_tbl_cmd = <<-SQL\r\n CREATE TABLE IF NOT EXISTS budgets(\r\n id INTEGER PRIMARY KEY,\r\n category_name VARCHAR(255),\r\n amount REAL,\r\n due_date DATE NULL\r\n )\r\n SQL\r\n\r\n month_tbl_cmd = <<-SQL\r\n CREATE TABLE IF NOT EXISTS months(\r\n id INTEGER PRIMARY KEY,\r\n month INT,\r\n year INT\r\n )\r\n SQL\r\n\r\n budget_month_tbl_cmd = <<-SQL\r\n CREATE TABLE IF NOT EXISTS budget_months(\r\n id INTEGER PRIMARY KEY,\r\n budget_id INT,\r\n month_id INT,\r\n balance REAL,\r\n FOREIGN KEY (budget_id) REFERENCES budgets(id),\r\n FOREIGN KEY (month_id) REFERENCES months(id)\r\n )\r\n SQL\r\n\r\n expenses_tbl_cmd = <<-SQL\r\n CREATE TABLE IF NOT EXISTS expenses(\r\n id INTEGER PRIMARY KEY,\r\n budget_month_id INT,\r\n description VARCHAR(255),\r\n amount REAL,\r\n expense_date DATE,\r\n FOREIGN KEY (budget_month_id) REFERENCES budget_months(id)\r\n )\r\n SQL\r\n\r\n db.execute(budget_tbl_cmd)\r\n db.execute(month_tbl_cmd)\r\n db.execute(budget_month_tbl_cmd)\r\n db.execute(expenses_tbl_cmd)\r\n\r\n return db\r\nend", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def index\n @budgets = Budget.all.paginate(page: params[:page], :per_page => 5).order(\"created_at DESC\")\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def budgetitem_params\n params.require(:budgetitem).permit(:name, :codeitem)\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def create\n @item = BudgetItem.new(params[:budget_item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @budget_product = BudgetProduct.new(budget_product_params)\n\n respond_to do |format|\n if @budget_product.save\n format.html { redirect_to @budget_product, notice: 'Budget product was successfully created.' }\n format.json { render :show, status: :created, location: @budget_product }\n else\n format.html { render :new }\n format.json { render json: @budget_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_budget_request\n @budget_request = BudgetRequest.find(params[:id])\n end", "def index\n # TODO: implement filters\n @budgets = Budget.order(\"budgets.starts_at DESC, budgets.number ASC\")\n .page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n #format.select2 { render json: { items: budgets.map(&:to_select2_json), total: @budgets.count} }\n #format.json { render json: @budgets }\n end\n end", "def new\n @budgetcategory = Budgetcategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budgetcategory }\n end\n end", "def get_budgets(opts = {})\n data, _status_code, _headers = get_budgets_with_http_info(opts)\n data\n end", "def create\n @bill = Bill.find(params[:bill_id])\n @breakdown = @bill.breakdowns.build(params[:breakdown])\n @breakdown.save\n\n redirect_to @bill\n\n #respond_to do |format|\n #if @breakdown.save\n #format.html { redirect_to @breakdown, notice: 'Breakdown was successfully created.' }\n #format.json { render json: @breakdown, status: :created, location: @breakdown }\n #else\n #format.html { render action: \"new\" }\n #format.json { render json: @breakdown.errors, status: :unprocessable_entity }\n #end\n #end\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @line = Line.new(params[:line])\n @line.budget_id = params[:budget_id]\n @budget = @line.budget\n\n respond_to do |format|\n if @line.save\n format.html { redirect_to budget_path(@budget), notice: 'Line was successfully created.' }\n format.json { render json: @line, status: :created, location: @line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @budget_approvers = BudgetApprover.all\n end", "def create\n @ptbudget = Ptbudget.new(params[:ptbudget])\n\n respond_to do |format|\n if @ptbudget.save\n flash[:notice] = 'Ptbudget was successfully created.'\n format.html { redirect_to(@ptbudget) }\n format.xml { render :xml => @ptbudget, :status => :created, :location => @ptbudget }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ptbudget.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_budgetitem\n @budgetitem = Budgetitem.find(params[:id])\n end", "def update\n budget = Budget.find params[:budget_id]\n budget.status = false\n budget.save\n redirect_to budgets_path\n end", "def get_budgets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetsApi.get_budgets ...'\n end\n # resource path\n local_var_path = '/budgets'\n\n # query parameters\n query_params = {}\n query_params[:'include_accounts'] = opts[:'include_accounts'] if !opts[:'include_accounts'].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 = ['bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BudgetSummaryResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetsApi#get_budgets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def therapy_budget_params\n params.require(:therapy_budget).permit(:price)\n end", "def new\n @budget = Budget.new\n @budget.year = Time.new.year\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end", "def create\n megam_rest.post_billedhistories(to_hash)\n end", "def new\n @budgeting_type = BudgetingType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budgeting_type }\n end\n end", "def budget_account_params\n params.require(:budget_account).permit(:name, :description, :currency_code)\n end", "def create\n @export_budget = ExportBudget.new(export_budget_params)\n @export_budget.author = current_user\n respond_to do |format|\n if @export_budget.save\n format.html { redirect_to @export_budget, notice: 'Export budget was successfully created.' }\n format.js { }\n format.json { render :back, status: :created, location: @export_budget }\n else\n format.html { render :new }\n format.js { }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget_line = BudgetLine.new(budget_line_params)\n\n respond_to do |format|\n if @budget_line.save\n format.html { redirect_to @budget_line, notice: 'Budget line was successfully created.' }\n format.json { render :show, status: :created, location: @budget_line }\n else\n format.html { render :new }\n format.json { render json: @budget_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @budget }\n end\n end", "def create\n @budget_request = BudgetRequest.new(budget_request_params)\n\n respond_to do |format|\n if @budget_request.save\n purchase = @budget_request.purchase_request_id\n format.html { redirect_to edit_purchase_request_path(PurchaseRequest.find_by(id: purchase)), notice: 'Pedido de cotización actualizado.' }\n format.json { render :show, status: :created, location: @budget_request }\n else\n format.html { render :new }\n format.json { render json: @budget_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@id = params[:id]\n\t\t@list = params[:budget_source_project]\n\t\tif !@list.nil?\n\t\t@list.each do |key, value|\n\t\t@add = BudgetSourceProject.where(:budget_source_id => @id , :project_id => key)\n\t\t@add.update_all(:amount => value)\n\t\tend\n\tredirect_to(:controller => 'budget_sources', :action => 'list')\t\n\t\telse\n\tredirect_to(:controller => 'budget_sources', :action => 'list')\n\tend\n\t\tend", "def entry_params\n if params[:entry][:budgets_list]\n budgets_list = params[:entry][:budgets_list].split(\",\")\n budgets = Budget.where(description: budgets_list)\n params[:entry][:budget_ids] = budgets.map(&:id)\n\n params[:entry].delete(:budgets_list)\n end\n\n params.require(:entry).permit!\n end", "def new\n @breadcrumb = 'create'\n @budget_heading = BudgetHeading.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget_heading }\n end\n end", "def create\n @export_budget = ExportBudget.new(params[:export_budget])\n respond_to do |format|\n if @export_budget.save\n @result = 'save'\n format.html { redirect_to :back, notice: 'Export budget was successfully created.' }\n format.js { }\n format.json { render :back, status: :created, location: @export_budget }\n else\n @result = 'not_save'\n format.html { render :new }\n format.js { }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget_disposition = BudgetDisposition.new(budget_disposition_params)\n\n respond_to do |format|\n if @budget_disposition.save\n format.html { redirect_to @budget_disposition, notice: 'Budget disposition was successfully created.' }\n format.json { render :show, status: :created, location: @budget_disposition }\n else\n format.html { render :new }\n format.json { render json: @budget_disposition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n # format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @breakdown = Breakdown.new(params.require(:breakdown).permit(:bdate, :description, :vehicle_id))\n\n respond_to do |format|\n if @breakdown.save\n format.html { redirect_to breakdowns_url,\n notice: 'Breakdown was successfully created.' }\n format.json { render json: @breakdown, status: :created, location: @breakdown }\n else\n prepFormVariables\n format.html { render action: \"new\" }\n format.json { render json: @breakdown.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n load_budget\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end", "def index\n @budget_products = BudgetProduct.all\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'El presupuesto se actualizó correctamente' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @budgets = Budget.all\n @budgets = Budget.order(params[:by] + \" \" + params[:order]).page params[:page] if params[:sort] == \"true\"\n @budgets = Budget.order(:id).page params[:page]\n end", "def index\n @budget_dispositions = BudgetDisposition.all\n end", "def bussiness_params\n params.require(:bussiness).permit(:summary, :agenda, :services, :about, :industry, :website, :contact, :headquarter, :companysize, :founded, :facebook_link, :twitter_link, :youtube_link, :google_link, :tagline)\n end", "def create\n @brave_burst = BraveBurst.new(brave_burst_params)\n\n respond_to do |format|\n if @brave_burst.save\n format.html { redirect_to @brave_burst, notice: 'Brave burst was successfully created.' }\n format.json { render action: 'show', status: :created, location: @brave_burst }\n else\n format.html { render action: 'new' }\n format.json { render json: @brave_burst.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: \"Budget was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def create\n return render(:json => {error: \"bad request\"}, :status => 400) unless params.has_key?(:service_name) and params.has_key?(:revision) and params.has_key?(:repo_url)\n\n duplicate_burn = Burn.service_short_name(params[:service_name]).revision(params[:revision])\n if duplicate_burn.count > 0\n unless duplicate_burn.status('failed').count > 0 and duplicate_burn.status('done').count == 0\n return render(:json => {error: \"Already burning #{params[:service_name]} release #{params[:revision]}\"}, :status => 409)\n end\n end\n\n service = Service.find_by_short_name(params[:service_name])\n if service.nil?\n service = Service.create({:short_name => params[:service_name], :pretty_name => params[:service_name]})\n end\n\n burn = Burn.create({:service => service, :revision => params[:revision], :repo_url => params[:repo_url].gsub('.git',''), :status_reason => \"created on #{Time.now}\"})\n\n if params.has_key?(:notify)\n Notification.create({:burn => burn.id.to_s, :method => 'email', :destination => params[:notify]})\n end\n\n render(:json => {burn_id: burn.id, service_id: service.id, service_name: params[:service_name], revision: burn.revision, status: burn.status})\n\n BurnWorker.perform_async(burn.id)\n end", "def create\n @debt = Debt.new(params[:debt])\n\n respond_to do |format|\n if @debt.save\n format.html { redirect_to @debt, :notice => 'Debt was successfully created.' }\n format.json { render :json => @debt, :status => :created, :location => @debt }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @debt.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @budgetitems = Budgetitem.all.order(:name)\n end", "def create\n @project = Project.find(params[:project_id])\n @bidder_amount = @project.bidder_amounts.create(bidder_amount_params)\n\n respond_to do |format|\n if @bidder_amount.save\n format.html { redirect_to @project, notice: 'Bidder amount was successfully created.' }\n format.json { render :show, status: :created, location: @bidder_amount }\n else\n format.html { render :new }\n format.json { render json: @bidder_amount.errors, status: :unprocessable_entity }\n end\n end\n end", "def billable_params\n params.require(:billable).permit(:item_number, :visit_type, :min_visit, :max_visit, :core_fee, :category)\n end" ]
[ "0.75522953", "0.75473195", "0.7400839", "0.7374585", "0.7285448", "0.6889538", "0.67936605", "0.67759067", "0.67474437", "0.6740765", "0.6603135", "0.65819085", "0.65571755", "0.6493924", "0.64787555", "0.6478163", "0.6438241", "0.6424356", "0.6424356", "0.6424356", "0.6424356", "0.6403966", "0.6351562", "0.6346835", "0.6269753", "0.62345415", "0.62140274", "0.6195447", "0.6175702", "0.61234313", "0.6122637", "0.6115435", "0.6059229", "0.59973335", "0.59969765", "0.5975367", "0.59348387", "0.5928832", "0.59236825", "0.5901384", "0.5862993", "0.5851631", "0.58185166", "0.5815688", "0.5809407", "0.5804276", "0.57967824", "0.5795934", "0.5765349", "0.5745653", "0.5743476", "0.57052606", "0.57004696", "0.5694053", "0.5688979", "0.5687813", "0.5687813", "0.56826484", "0.56663495", "0.565888", "0.5641886", "0.5620952", "0.56130195", "0.55645514", "0.5558885", "0.5545888", "0.55363804", "0.55306554", "0.55304724", "0.55280775", "0.55210614", "0.55075467", "0.5504356", "0.54859877", "0.54812706", "0.54794884", "0.5477838", "0.5477838", "0.547773", "0.5473115", "0.54189163", "0.54133636", "0.54056716", "0.54050136", "0.5397849", "0.53936636", "0.539321", "0.539321", "0.539321", "0.53908205", "0.53905845", "0.53825057", "0.53808546", "0.53760463", "0.53752077", "0.5374488", "0.5349908", "0.5346838", "0.53300375" ]
0.7260562
6
PATCH/PUT /budgets/1 PATCH/PUT /budgets/1.json
def update respond_to do |format| if @budget.update(budget_params) format.html { redirect_to @budget, notice: 'Budget was successfully updated.' } format.json { render :show, status: :ok, location: @budget } else format.html { render :edit } format.json { render json: @budget.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n # format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n Item.where([\"budget_id = #{params[:id]}\"]).update_all(budget_id: nil)\n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: params[:id])\n end\n end\n format.html { redirect_to budgets_path, notice: \"Budget was successfully updated.\" }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'El presupuesto se actualizó correctamente' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n budget = Budget.find params[:budget_id]\n budget.status = false\n budget.save\n redirect_to budgets_path\n end", "def update\n @budget = Budget.find(params[:id])\n @budget1 = @budget\n respond_to do |format|\n if @budget.update(budget_params)\n BudgetMailer.budget_email(@budget1).deliver_now\n format.html { redirect_to reservation_requests_path, notice: 'Presupuesto modificado exitosamente.' }\n else\n @my_reservation_requests = ReservationRequest.find(budget_params[:reservation_request_id])\n @my_budget = Budget.find(params[:id])\n @services_details=@my_budget.budget_service_details\n @budget.budget_service_details.build\n @budget.budget_room_details.build\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget_approver.update(budget_approver_params)\n format.html { redirect_to @budget_approver, notice: 'Budget approver page was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_approver }\n else\n format.html { render :edit }\n format.json { render json: @budget_approver.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budgetitem.update(budgetitem_params)\n format.html { redirect_to @budgetitem, notice: 'Budgetitem was successfully updated.' }\n format.json { render :show, status: :ok, location: @budgetitem }\n else\n format.html { render :edit }\n format.json { render json: @budgetitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(budget_params)\n respond_to do |format|\n if @budget.save\n \n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: @budget.id)\n end\n end\n \n format.html { redirect_to budgets_path, notice: \"Budget was successfully created.\" }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_budget\n @budget = Budget.find(params[:id])\n\n end", "def update\n respond_to do |format|\n if @budget_for_order.update(budget_for_order_params)\n format.html { redirect_to @budget_for_order, notice: 'Budget for order was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_for_order }\n else\n format.html { render :edit }\n format.json { render json: @budget_for_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def update\n respond_to do |format|\n if @therapy_budget.update(therapy_budget_params)\n format.html { redirect_to @therapy_budget, notice: 'Therapy budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @therapy_budget }\n else\n format.html { render :edit }\n format.json { render json: @therapy_budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def set_budget\n @budget = Budget.find(params[:id])\n end", "def update\n @line = Line.find(params[:id])\n @budget = @line.budget\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to budget_path(@budget), notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @budget_item = BudgetItem.find(params[:id])\n\n respond_to do |format|\n if @budget_item.update_attributes(params[:budget_item])\n format.html { redirect_to(@budget_item, :notice => 'Budget item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @budget_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @export_budget.update(export_budget_params)\n format.html { redirect_to @export_budget, notice: 'Export budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @export_budget }\n else\n format.html { render :edit }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @export_budget.update(export_budget_params)\n format.html { redirect_to @export_budget, notice: 'Export budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @export_budget }\n else\n format.html { render :edit }\n format.json { render json: @export_budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget_file.update(budget_file_params)\n #if @revenue.update(revenue_params.merge({:tree_info => tree_info, :rows => rows}))\n # @budget_file.taxonomy.explanation = explanation\n # @budget_file.taxonomy.save\n\n format.html { redirect_to @budget_file, notice: t('budget_files_controller.save') }\n format.json { render :show, status: :ok, location: @budget_file }\n else\n format.html { render :edit }\n format.json { render json: @budget_file.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\n @budget_src = BudgetSrc.find(params[:id])\n\n respond_to do |format|\n if @budget_src.update_attributes(params[:budget_src])\n format.html { redirect_to(@budget_src, :notice => 'Budget src was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @budget_src.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget_request.update(budget_request_params)\n budget_request = BudgetRequest.find_by(id: @budget_request.id)\n budget_request.update_attribute(:state, BudgetRequest.state.finished)\n format.html {redirect_to edit_budget_request_path, notice: 'Pedido de Cotización actualizada.'}\n format.json {render :show, status: :ok, location: @order}\n else\n format.html { render :edit }\n format.json { render json: @budget_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @ptbudget = Ptbudget.find(params[:id])\n\n respond_to do |format|\n if @ptbudget.update_attributes(params[:ptbudget])\n flash[:notice] = 'Ptbudget was successfully updated.'\n format.html { redirect_to(@ptbudget) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ptbudget.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_budget_using_put_with_http_info(budget, budget_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetApi.update_budget_using_put ...'\n end\n # verify the required parameter 'budget' is set\n if @api_client.config.client_side_validation && budget.nil?\n fail ArgumentError, \"Missing the required parameter 'budget' when calling BudgetApi.update_budget_using_put\"\n end\n # verify the required parameter 'budget_id' is set\n if @api_client.config.client_side_validation && budget_id.nil?\n fail ArgumentError, \"Missing the required parameter 'budget_id' when calling BudgetApi.update_budget_using_put\"\n end\n # resource path\n local_var_path = '/nucleus/v1/budget/{budget_id}'.sub('{' + 'budget_id' + '}', budget_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(budget)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'Budget')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetApi#update_budget_using_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @item = BudgetItem.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:budget_item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @budgetcategory = Budgetcategory.find(params[:id])\n\n respond_to do |format|\n if @budgetcategory.update_attributes(params[:budgetcategory])\n format.html { redirect_to @budgetcategory, notice: 'Budgetcategory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budgetcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget_line.update(budget_line_params)\n format.html { redirect_to @budget_line, notice: 'Budget line was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_line }\n else\n format.html { render :edit }\n format.json { render json: @budget_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @breadcrumb = 'update'\n @budget_heading = BudgetHeading.find(params[:id])\n @budget_heading.updated_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @budget_heading.update_attributes(params[:budget_heading])\n format.html { redirect_to @budget_heading,\n notice: (crud_notice('updated', @budget_heading) + \"#{undo_link(@budget_heading)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget_heading.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @ptbudget = Ptbudget.find(params[:id])\n\n respond_to do |format|\n if @ptbudget.update_attributes(params[:ptbudget])\n flash[:notice] = t('ptbudget.title')+\" \"+t('updated')\n format.html { redirect_to(@ptbudget) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ptbudget.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_budget_request\n @budget_request = BudgetRequest.find(params[:id])\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @budget_product.update(budget_product_params)\n format.html { redirect_to @budget_product, notice: 'Budget product was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_product }\n else\n format.html { render :edit }\n format.json { render json: @budget_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @setbreak.update(setbreak_params)\n format.json { respond_with_bip @setbreak }\n else\n format.json { respond_with_bip @setbreak }\n end\n end\n end", "def set_budget_approver\n @budget_approver = BudgetApprover.find(params[:id])\n end", "def update\n respond_to do |format|\n if @brave_burst.update(brave_burst_params)\n format.html { redirect_to @brave_burst, notice: 'Brave burst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @brave_burst.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to budgets_path }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts \"update #{@need.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @need.update(updated_params)\n puts \"brucep update success\"\n format.html { redirect_to new_need_path }\n format.json { render :show, status: :ok, location: @need }\n else\n format.html { render :edit }\n format.json { render json: @need.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_budget_for_order\n @budget_for_order = BudgetForOrder.find(params[:id])\n @budgets=Budget.where([\"budget_for_order_id = ?\", \"#{params[:id]}\"])\n end", "def update\n respond_to do |format|\n if @bounty.update(bounty_params)\n format.html { redirect_to @bounty, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bill = Bill.find(params[:id])\n\n if @bill.update(params[:bill])\n head :no_content\n else\n render json: @bill.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @billable.update(billable_params)\n format.html { redirect_to @billable, notice: 'Billable was successfully updated.' }\n format.json { render :show, status: :ok, location: @billable }\n else\n format.html { render :edit }\n format.json { render json: @billable.errors, status: :unprocessable_entity }\n end\n end\n end", "def budget_params\n params.require(:budget).permit(:client_id, :contract_id, :date, :description, :state, :total_amount, :name,\n budget_details_attributes: [:id, :rubro_id, :cost, :measurement_unit, :price, :quantity, :subtotal, :utility, :_destroy])\n end", "def update\n @bundlesticker = Bundlesticker.find(params[:id])\n\n respond_to do |format|\n if @bundlesticker.update_attributes(params[:bundlesticker])\n format.html { redirect_to @bundlesticker, notice: 'Bundlesticker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundlesticker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n set_proposed_item\n\n respond_to do |format|\n if @proposed_item.update(proposed_item_params)\n format.html { redirect_to @budget, notice: 'Proposed item was successfully updated.' }\n format.json { render :show, status: :ok, location: @proposed_item }\n else\n format.html { render :edit }\n format.json { render json: @proposed_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end", "def update\n respond_to do |format|\n if @bond.update(bond_params)\n format.html { redirect_to bonds_path, notice: I18n.t('messages.updated_with', item: @bond.company) }\n format.json { render :show, status: :ok, location: @bond }\n else\n format.html { render :edit }\n format.json { render json: @bond.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n @bid = @swarm_request.bids.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to(swarm_request_bid_url(:id => @bid.to_param, :swarm_request_id => @swarm_request.to_param), :notice => 'Bid was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bid.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @funding_requirement.update(funding_requirement_params)\n format.html { redirect_to @funding_requirement, notice: 'Funding requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @funding_requirement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bundle = Bundle.find(params[:id])\n\n respond_to do |format|\n if @bundle.update_attributes(params[:bundle])\n format.html { redirect_to @bundle, notice: 'Bundle was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, budget: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(params[:bill])\n # Update all energy goals related to this bill\n updateEnergyGoals(@bill)\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end", "def update\n @monthly_overhead_breakdown_item = MonthlyOverheadBreakdownItem.find(params[:id])\n\n respond_to do |format|\n if @monthly_overhead_breakdown_item.update_attributes(params[:monthly_overhead_breakdown_item])\n format.html { redirect_to @monthly_overhead_breakdown_item, notice: 'Monthly overhead breakdown item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monthly_overhead_breakdown_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @disruption_budget = args[:disruption_budget] if args.key?(:disruption_budget)\n @min_wait_duration = args[:min_wait_duration] if args.key?(:min_wait_duration)\n end", "def update\n #@bundles_items_design = BundlesItemsDesign.find(params[:id])\n #\n #respond_to do |format|\n # if @bundles_items_design.update_attributes(params[:bundles_items_design])\n # format.html { redirect_to @bundles_items_design, notice: 'Bundles items design was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @bundles_items_design.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @breakdown = Breakdown.find(params[:id])\n\n respond_to do |format|\n if @breakdown.update_attributes(params[:breakdown])\n format.html { redirect_to @breakdown, notice: 'Breakdown was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @breakdown.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_budgetitem\n @budgetitem = Budgetitem.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 @budget_disposition.update(budget_disposition_params)\n format.html { redirect_to @budget_disposition, notice: 'Budget disposition was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_disposition }\n else\n format.html { render :edit }\n format.json { render json: @budget_disposition.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 destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def update\n @kb = Kb.find(params[:id])\n\n respond_to do |format|\n if @kb.update_attributes(params[:kb])\n format.html { redirect_to @kb, :notice => 'Kb was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @kb.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if @tenant_fee.update(tenant_fee_params)\n format.html { redirect_to @tenant_fee, notice: 'Tenant fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tenant_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def update\n 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 update\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n if @bet.update_attributes(params[:bet])\n format.html { redirect_to @bet, notice: 'Bet was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @breakdown = Breakdown.find(params[:id])\n\n respond_to do |format|\n if @breakdown.update_attributes(params.require(:breakdown).permit(:bdate, :description, :vehicle_id))\n format.html { redirect_to breakdowns_url,\n notice: 'Breakdown was successfully updated.' }\n format.json { head :no_content }\n else\n prepFormVariables\n format.html { render action: \"edit\" }\n format.json { render json: @breakdown.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end", "def patch!\n request! :patch\n end", "def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end", "def update\n respond_to do |format|\n if @ticketbill.update(ticketbill_params)\n format.html { redirect_to @ticketbill, notice: 'Ticketbill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticketbill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bid.update(bid_params)\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bussiness.update(bussiness_params)\n format.html { redirect_to current_user, notice: 'Business was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bussiness.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n get_projects\n\n @breadcrumb = 'update'\n @billable_item = BillableItem.find(params[:id])\n @billable_item.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @billable_item.update_attributes(params[:billable_item])\n format.html { redirect_to @billable_item,\n notice: (crud_notice('updated', @billable_item) + \"#{undo_link(@billable_item)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @billable_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @req_breakdown = ReqBreakdown.find(params[:id])\n\n respond_to do |format|\n if @req_breakdown.update_attributes(params[:req_breakdown])\n flash[:notice] = 'ReqBreakdown was successfully updated.'\n format.html { redirect_to(admin_req_breakdown_url(@req_breakdown)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @req_breakdown.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill_summary.update(bill_summary_params)\n format.html { redirect_to @bill_summary, notice: 'Bill summary was successfully updated.' }\n format.json { render :show, status: :ok, location: @bill_summary }\n else\n format.html { render :edit }\n format.json { render json: @bill_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def update_budget_rule_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetRulesApi.update_budget_rule ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling BudgetRulesApi.update_budget_rule\"\n end\n # resource path\n local_var_path = '/budget_rules/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'budget_rule'])\n auth_names = ['Basic']\n data, status_code, headers = @api_client.call_api(:PATCH, 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 => 'BudgetRule')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetRulesApi#update_budget_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n if @bid.update(bid_params)\n head :no_content\n else\n render json: @bid.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @need.update(need_params)\n format.html { redirect_to needs_path, notice: 'Need was successfully updated.' }\n format.json { head :no_content }\n else\n @cabins = Cabin.all\n format.html { render action: 'edit' }\n format.json { render json: @need.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sugar_bag = SugarBag.find(params[:id])\n\n respond_to do |format|\n if @sugar_bag.update_attributes(params[:sugar_bag])\n format.html { redirect_to @sugar_bag, notice: 'Sugar bag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sugar_bag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacancy.update(vacancy_params)\n update_skills\n format.html { redirect_to @vacancy, notice: 'Vacancy was successfully updated.' }\n format.json { render :show, status: :ok, location: @vacancy }\n else\n format.html { render :edit }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(params[:period])\n format.html { redirect_to @bill, notice: t('activerecord.attributes.bill.successfully') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @blueprint = Blueprint.find(params[:id])\n\n respond_to do |format|\n if @blueprint.update_attributes(params[:blueprint])\n format.html { redirect_to(blueprint_path(@blueprint), :notice => 'Blueprint was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @blueprint.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.8026648", "0.7396934", "0.7396934", "0.7361922", "0.72452253", "0.68626356", "0.67455447", "0.66521835", "0.66150564", "0.6505353", "0.64734066", "0.6431644", "0.6408572", "0.6406165", "0.6379921", "0.63385046", "0.63385046", "0.63385046", "0.63385046", "0.63208914", "0.6312289", "0.6263542", "0.6263542", "0.620338", "0.6163668", "0.6150866", "0.61394346", "0.61260146", "0.6104805", "0.6103887", "0.6093322", "0.6070886", "0.60654086", "0.6034628", "0.60028344", "0.5969855", "0.59681416", "0.59438455", "0.5931638", "0.5919896", "0.5908904", "0.5899342", "0.58897585", "0.5876624", "0.5871663", "0.5853477", "0.5817655", "0.5805366", "0.5804173", "0.58014643", "0.5799327", "0.5799131", "0.5784066", "0.57832825", "0.57828486", "0.5769873", "0.576747", "0.57600236", "0.57348055", "0.571542", "0.57136095", "0.5710762", "0.5709315", "0.5701383", "0.5696547", "0.569562", "0.5692378", "0.56916595", "0.5690929", "0.5681964", "0.56765056", "0.56744236", "0.56680095", "0.5666034", "0.56652707", "0.566447", "0.566443", "0.5663261", "0.5658931", "0.5657922", "0.56435674", "0.5643118", "0.5636849", "0.5632029", "0.56300324", "0.56292146", "0.5620928", "0.56165326", "0.56157756", "0.5612099", "0.5609233", "0.5603814", "0.5603524", "0.56034434", "0.5603017", "0.5601768", "0.560019", "0.5593604", "0.5591814" ]
0.7210185
6
DELETE /budgets/1 DELETE /budgets/1.json
def destroy @budget.destroy respond_to do |format| format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if params[:id] =~ /\\d+/\n @budget = Budget.find(params[:id])\n ActiveRecord::Base.connection.execute(\"delete from budget_products where budget_id = #{params[:id]}\")\n @budget.destroy\n end\n \n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: \"Budget was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(params[:budget_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget_request.destroy\n respond_to do |format|\n format.html { redirect_to budget_requests_url, notice: 'Budget request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @therapy_budget.destroy\n respond_to do |format|\n format.html { redirect_to therapy_budgets_url, notice: 'Therapy budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget_item = BudgetItem.find(params[:id])\n @budget_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @budgetcategory = Budgetcategory.find(params[:id])\n @budgetcategory.destroy\n\n respond_to do |format|\n format.html { redirect_to budgetcategories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget_src = BudgetSrc.find(params[:id])\n @budget_src.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_srcs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @budget_for_order.destroy\n respond_to do |format|\n format.html { redirect_to budget_for_orders_url, notice: 'Budget for order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ptbudget = Ptbudget.find(params[:id])\n @ptbudget.destroy\n\n respond_to do |format|\n format.html { redirect_to(ptbudgets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ptbudget = Ptbudget.find(params[:id])\n @ptbudget.destroy\n\n respond_to do |format|\n format.html { redirect_to(ptbudgets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(@line.budget) }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @export_budget.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Export budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @export_budget.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Export budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget_line.destroy\n respond_to do |format|\n format.html { redirect_to budget_lines_url, notice: 'Budget line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budgeting_type = BudgetingType.find(params[:id])\n @budgeting_type.destroy\n\n respond_to do |format|\n format.html { redirect_to budgeting_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n f_respond_destroy(@budgetitem.destroy, @budgetitem.name, budgetitems_url)\n# @budgetitem.destroy\n# respond_to do |format|\n# format.html { redirect_to budgetitems_url, notice: 'Budgetitem was successfully destroyed.' }\n# format.json { head :no_content }\n# end\n end", "def destroy\n @item = item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @budget_heading = BudgetHeading.find(params[:id])\n respond_to do |format|\n if @budget_heading.destroy\n format.html { redirect_to budget_headings_url,\n notice: (crud_notice('destroyed', @budget_heading) + \"#{undo_link(@budget_heading)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to budget_headings_url, alert: \"#{@budget_heading.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @budget_heading.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @brave_burst.destroy\n respond_to do |format|\n format.html { redirect_to brave_bursts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to bounties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\r\n @bill = Bill.find(params[:id])\r\n @bill.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to bills_url, only_path: true }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @bill = Bill.find(params[:id])\n # TODO: \"un-updateEnergyGoals\" related to this bill\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @bussiness.destroy\n respond_to do |format|\n format.html { redirect_to bussinesses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bank = Bank.find(params[:id])\n @bank.destroy\n\n respond_to do |format|\n format.html { redirect_to banks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_path }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n #binding.pry\n @balance = Balance.find(params[:id])\n @balance.destroy\n respond_to do |format|\n format.html { redirect_to balances_url }\n format.json { head :no_content }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @service_dependance = ServiceDependance.find(params[:id])\n @service_dependance.destroy\n\n respond_to do |format|\n format.html { redirect_to service_dependances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n set_proposed_item\n calculate_saving\n \n\n @proposed_item.destroy\n respond_to do |format|\n format.html { redirect_to @budget, notice: 'Proposed item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bank = Bank.find(params[:id])\n @bank.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_banks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bank = Bank.find(params[:id])\n @bank.destroy\n\n respond_to do |format|\n format.html { redirect_to banks_url, notice: t('view.banks.correctly_deleted') }\n format.json { head :ok }\n end\n end", "def destroy\n @budget_disposition.destroy\n respond_to do |format|\n format.html { redirect_to budget_dispositions_url, notice: 'Budget disposition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget_product.destroy\n respond_to do |format|\n format.html { redirect_to budget_products_url, notice: 'Budget product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @baggage = Baggage.find(params[:id])\n @baggage.destroy\n\n respond_to do |format|\n format.html { redirect_to baggages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @blast = Blast.find(params[:id])\n @blast.destroy\n\n respond_to do |format|\n format.html { redirect_to blasts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @debt = Debt.find(params[:id])\n @debt.destroy\n\n respond_to do |format|\n format.html { redirect_to debts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @cabinet_balancer.destroy\n respond_to do |format|\n format.html { redirect_to cabinet_balancers_path, notice: I18n.t('deleted') }\n format.json { head :no_content }\n end\n end", "def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end", "def delete_budget_using_delete_with_http_info(budget_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetApi.delete_budget_using_delete ...'\n end\n # verify the required parameter 'budget_id' is set\n if @api_client.config.client_side_validation && budget_id.nil?\n fail ArgumentError, \"Missing the required parameter 'budget_id' when calling BudgetApi.delete_budget_using_delete\"\n end\n # resource path\n local_var_path = '/nucleus/v1/budget/{budget_id}'.sub('{' + 'budget_id' + '}', budget_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetApi#delete_budget_using_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @bloom = Bloom.find(params[:id])\n @bloom.destroy\n\n respond_to do |format|\n format.html { redirect_to blooms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @barrels_income.destroy\n respond_to do |format|\n format.html { redirect_to barrels_incomes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @buisiness = Buisiness.find(params[:id])\n @buisiness.destroy\n respond_to do |format|\n format.html { redirect_to buisinesses_url, notice: 'Buisiness was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @b = B.find(params[:id])\n @b.destroy\n\n respond_to do |format|\n format.html { redirect_to bs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bb = Bb.find(params[:id])\n @bb.destroy\n\n respond_to do |format|\n format.html { redirect_to bbs_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @kb = Kb.find(params[:id])\n @kb.destroy\n\n respond_to do |format|\n format.html { redirect_to kbs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @bank.destroy\n respond_to do |format|\n format.html { redirect_to banks_url, notice: '' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @climb = Climb.find(params[:id])\n @climb.destroy\n\n respond_to do |format|\n format.html { redirect_to climbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @billable.destroy\n respond_to do |format|\n format.html { redirect_to billables_url, notice: 'Billable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/admin/transaction\" }\n format.json { head :no_content }\n end\n end", "def destroy\n\t@responsible.bills.each do |bill|\n\t\tbill.destroy\n\tend\n @responsible.destroy\n respond_to do |format|\n format.html { redirect_to responsibles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bicicletum.destroy\n respond_to do |format|\n format.html { redirect_to bicicleta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @climb_datum = ClimbDatum.find(params[:id])\n @climb_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to climb_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unpaid_debt = UnpaidDebt.find(params[:id])\n @unpaid_debt.destroy\n\n respond_to do |format|\n format.html { redirect_to unpaid_debts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bounty = Bounty.find(params[:id])\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to controller: 'home', action: 'bounty_market' }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sugar_bag = SugarBag.find(params[:id])\n @sugar_bag.destroy\n\n respond_to do |format|\n format.html { redirect_to sugar_bags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bet = Bet.find(params[:id])\n @bet.destroy\n\n respond_to do |format|\n format.html { redirect_to bets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bet = Bet.find(params[:id])\n @bet.destroy\n\n respond_to do |format|\n format.html { redirect_to bets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wait = Wait.find(params[:id])\n @wait.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @bidding = Bidding.find(params[:id])\n @bidding.destroy\n\n respond_to do |format|\n format.html { redirect_to biddings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget_file.destroy\n respond_to do |format|\n format.html { redirect_to budget_files_path, notice: 'BudgetFile was successfully destroyed.' }\n format.js\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 @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @blast_request.destroy\n respond_to do |format|\n format.html { redirect_to mc_blast_blast_requests_path, notice: 'Blast request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @monthly_revenue_breakdown_item = MonthlyRevenueBreakdownItem.find(params[:id])\n @monthly_revenue_breakdown_item.destroy\n\n respond_to do |format|\n format.html { redirect_to monthly_revenue_breakdown_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @debt.destroy\n respond_to do |format|\n format.html { redirect_to debts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @debt.destroy\n respond_to do |format|\n format.html { redirect_to debts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @funding_requirement.destroy\n respond_to do |format|\n format.html { redirect_to funding_requirements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @bill_quorum = BillQuorum.find(params[:id])\n @bill_quorum.destroy\n\n respond_to do |format|\n format.html { redirect_to bill_quorums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.destroy\n\n respond_to do |format|\n format.html { redirect_to bruschetta_url }\n format.json { head :ok }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @brag = Brag.find(params[:id])\n @brag.destroy\n\n respond_to do |format|\n format.html { redirect_to brags_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.80596507", "0.8052162", "0.7745417", "0.76833415", "0.7648094", "0.748794", "0.73072225", "0.72522795", "0.72057337", "0.72005427", "0.70806473", "0.6962823", "0.69600993", "0.69600993", "0.6938634", "0.69297326", "0.69276094", "0.6921499", "0.6921499", "0.68874925", "0.68547475", "0.6740247", "0.6723519", "0.67226714", "0.6673186", "0.66578", "0.66573566", "0.66189873", "0.6611407", "0.65622264", "0.65355283", "0.6533965", "0.6527909", "0.6523378", "0.6517916", "0.6517916", "0.6517916", "0.6516924", "0.65166825", "0.6514787", "0.6514787", "0.6514787", "0.6514787", "0.6493565", "0.64848906", "0.6483424", "0.64778304", "0.64778304", "0.6477103", "0.6471445", "0.6467733", "0.64661694", "0.6457598", "0.64540654", "0.6450065", "0.64490014", "0.6448928", "0.64479166", "0.6431278", "0.64249146", "0.64247644", "0.6424332", "0.6424196", "0.6419562", "0.6419388", "0.6417153", "0.64145577", "0.6409913", "0.6409697", "0.64058346", "0.64058346", "0.63995814", "0.63995755", "0.63980985", "0.6389959", "0.6380946", "0.63708127", "0.6366615", "0.63529056", "0.63516116", "0.63514787", "0.6348895", "0.63486904", "0.63486904", "0.6348611", "0.6348503", "0.6348168", "0.6347168", "0.6339331", "0.63379", "0.6336636", "0.6330782", "0.6330782", "0.63249654", "0.63215613", "0.63196766", "0.63190484", "0.6318457" ]
0.7660224
5
Use callbacks to share common setup or constraints between actions.
def set_budget @budget = Budget.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def budget_params params.require(:budget).permit(:income, :savings, :housing, :utilities, :food, :food, :transportation, :clothing, :personal, :recreation, :debt, :kids, :session, :budget_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def 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
var=? in Scheme implementation.
def vars_eq?(x1, x2) ; x1[0] == x2[0] ; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def var!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 75 )\n\n type = VAR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 196:7: 'var'\n match( \"var\" )\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__, 75 )\n\n end", "def k_var!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 26 )\n\n\n\n type = K_VAR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 357:4: 'var'\n match( \"var\" )\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__, 26 )\n\n\n end", "def var(id) \n\n # Zkus promennou najit nejprve v locals\n variable = @variables[id]\n\n if variable == :undeclared\n\n variable = @arguments[id]\n\n # Tak to jeste zkus v argumentech\n if variable == :undeclared\n # tak to fakt neznam \n return nil,:error\n else\n write_opcode(PAS) # budu zapisovat na zasobnik argument\n write_4B(variable) # jeho id\n return nil, nil \n end\n else \n write_opcode(PLS) # budu zapisovat na zasobnik lokalni promennou\n write_4B(variable) # jeji id\n return nil, nil\n end\n\n end", "def scheme=(_arg0); end", "def strict_variables=(_arg0); end", "def PRF02=(arg)", "def var!(id)\n variable = @variables[id]\n\n # pokud to neni promenna\n if variable == :undeclared\n\n # zkontroluje jestli to neni argument\n variable = @arguments[id]\n if variable != :undeclared\n write_opcode(PSA)\n write_4B(variable) # jeho id\n return nil, nil \n \n else \n return_value, msg = declare(id)\n return return_value, msg if msg != nil\n variable = return_value\n end\n end\n\n # spolecne pro nove \n # deklarovane, a uz\n # deklarovane \n\n # zapis obsah zasobniku \n # do lokalni promenne\n write_opcode(PSL)\n write_4B(variable)\n return nil, nil\n end", "def ruby_simplifier (sexp,var)\n \t#print \"\\n\\nruby_simplifier(\"\n \t#print sexp\n \t#puts \")\\n\\n\"\n\n if sexp and var and sexp[0] === :call and sexp[1] and sexp[1][0] === :lvar \\\n and sexp[1][1] === var then\n \t@@vars.add sexp[2]\n \t[:lvar, \"?\" + sexp[2].to_s]\n elsif sexp and sexp[0] === :call and sexp[1] and sexp[1][0] === :self then\n\t@@vars.add sexp[2]\n\t[:self, \"?\" + sexp[2].to_s]\n elsif sexp and sexp[0] === :call and sexp[1] and sexp[1][0] === :ivar and sexp[1][1] == :@attributes then\n\t@@vars.add sexp[3][1][1]\n\t[:ivar, \"?\" + sexp[3][1][1]]\n else\n \tsexp\n end\n end", "def var(key:, value:)\n add option: \"-var='#{key}=#{value}'\"\n end", "def PO113=(arg)", "def relvar(*args, &bl)\n alf_connection.relvar(*args, &bl)\n end", "def put_var_arg\nend", "def scheme=(_); end", "def var(option_key, default_value=:__UNDEFINED__, opts={}, &block)\n ret = _pair(option_key, default_value, opts, &block)\n return if ret[2] # ignore\n instance_variable_set(\"@#{ret[0]}\".to_sym, ret[1])\n ret[1]\n end", "def PO111=(arg)", "def PO101=(arg)", "def PRF03=(arg)", "def PRF01=(arg)", "def PO114=(arg)", "def class_variable_set(sym,val) end", "def SE02=(arg)", "def value=(_arg0); end", "def value=(_arg0); end", "def value=(_arg0); end", "def value=(_arg0); end", "def value=(_arg0); end", "def value=(_arg0); end", "def value=(_arg0); end", "def value=(_arg0); end", "def SAC07=(arg)", "def PO107=(arg)", "def PO112=(arg)", "def PO102=(arg)", "def var_statement(var_env)\n return nil unless eql_lit?(ECMA262::ID_VAR)\n\n if vl = var_decl_list(var_env, {}) and semicolon(var_env)\n #10.5\n vl.each do |v|\n dn = v[0]\n var_env.record.create_mutable_binding(dn, nil)\n var_env.record.set_mutable_binding(dn, :undefined, nil)\n end\n ECMA262::StVar.new(var_env, vl)\n else\n raise Minjs::ParseError.new(\"unexpected token\", lex)\n end\n end", "def var!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n\n\n\n type = VAR\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 24:6: 'ingrediente'\n match( \"ingrediente\" )\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__, 3 )\n\n\n end", "def _reduce_484(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = s(:block_arg, identifier.to_sym)\n \n result\nend", "def PRF04=(arg)", "def PO109=(arg)", "def var?(literal)\n literal.is_a?(Sass::Script::Value::String) && literal.value =~ /var\\(/\n end", "def SAC02=(arg)", "def var!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n type = VAR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 38:7: ( 'a' .. 'z' )+\n # at file 38:7: ( 'a' .. 'z' )+\n match_count_2 = 0\n while true\n alt_2 = 2\n look_2_0 = @input.peek( 1 )\n\n if ( look_2_0.between?( 0x61, 0x7a ) )\n alt_2 = 1\n\n end\n case alt_2\n when 1\n # at line 38:8: 'a' .. 'z'\n match_range( 0x61, 0x7a )\n\n else\n match_count_2 > 0 and break\n eee = EarlyExit(2)\n\n\n raise eee\n end\n match_count_2 += 1\n end\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 6 )\n\n end", "def instance_variable_set(p0, p1) end", "def _reduce_582(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "def _reduce_582(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "def _reduce_582(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "def PO108=(arg)", "def SAC03=(arg)", "def PO105=(arg)", "def lex_en_expr_variable=(_arg0); end", "def lex_en_expr_variable=(_arg0); end", "def lex_en_expr_variable=(_arg0); end", "def PO104=(arg)", "def variable; end", "def variable; end", "def _reduce_585(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "def _reduce_585(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "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 var *args\n TheDude::Variable.new(*args).register\n end", "def setVariable _obj, _args\n \"_obj setVariable _args;\" \n end", "def _reduce_542(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "def PO106=(arg)", "def export(k, v) make_var(k, v, true) end", "def test_compound_branch_w_3_terms_t_t_assign\n assert interpret('var=0; true && true || var=99; :var').zero?\n end", "def getq(sym)\n\t\tret_val = lisp_eval \"(vl-symbol-value \\'#{sym.to_s} )\"\n\tend", "def var\n\t\t@var ||= \"aljfhnkjlngdkjfj\" #ekvivalen na konstruktor po podrazbirane\n\tend", "def [](var_name)\n run(:true)[var_name]\n end", "def CTT07=(arg)", "def PO103=(arg)", "def replace_vars!(&block)\n map! do |op|\n case\n when op.respond_to?(:variable?) && op.variable?\n yield op\n when op.respond_to?(:replace_vars!)\n op.replace_vars!(&block) \n else\n op\n end\n end\n self\n end", "def var(vars)\n return Thread.current[:vars][vars] if vars.kind_of? Symbol\n return vars.each { |var, val| Thread.current[:vars][var] = val } if vars.kind_of? Hash\n raise ArgumentError, \"var must take a symbol or a hash\"\n end", "def _reduce_541(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend", "def SE01=(arg)", "def SAC12=(arg)", "def _reduce_609(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend", "def var name\n Symbolic.check_name name\n var = VarExpr.new(name)\n meta_def name do\n var\n end\n var\n end", "def variable_assignment_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n\n\n value = nil\n\n\n a = nil\n type = nil\n b = nil\n\n\n begin\n # at line 97:6: a= function_call_statement type= assignment_type b= expression\n @state.following.push( TOKENS_FOLLOWING_function_call_statement_IN_variable_assignment_statement_747 )\n a = function_call_statement\n @state.following.pop\n @state.following.push( TOKENS_FOLLOWING_assignment_type_IN_variable_assignment_statement_751 )\n type = assignment_type\n @state.following.pop\n @state.following.push( TOKENS_FOLLOWING_expression_IN_variable_assignment_statement_755 )\n b = expression\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = VariableAssignmentStatementEval.new(a, b, type) \n # <-- action\n end\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n\n end\n\n return value\n end", "def _reduce_485(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = s(:block_arg, identifier.to_sym)\n \n result\nend", "def _reduce_485(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = s(:block_arg, identifier.to_sym)\n \n result\nend", "def local_variables() end", "def value(vars=nil) @value_method.call(@pars_hash,vars); end", "def func_setq(args)\n p = args\n p2 = nil\n\n loop do\n p1 = car(p)\n p2 = _eval(car(cdr(p)))\n @o_man.set_object(p1, p2)\n p = cdr(cdr(p))\n break unless (p != @o_man.nil)\n end\n\n return p2\n end", "def _get_var(name)\n\t\treturn @replace_vars[name]\n\tend", "def value=(_); end", "def _reduce_552(val, _values, result)\n # TODO? if (!($$ = gettable(p, $1, &@$))) $$ = NEW_BEGIN(0, &@$);\n var, = val\n\n result = var\n\n result\nend", "def substitute(s)\n\n def substitute_variable(var, s)\n end_string = var.iend == s.length ? \"\" : s[var.iend..-1]\n value = get_variable(var.name, var.default)\n transformed = \n (var.istart == 0 ? \"\" : s[0..(var.istart-1)]) + value + end_string\n substitute(transformed)\n end\n\n # Locate the next variable reference.\n var = find_variable_ref(s)\n if var.nil?\n s\n else\n substitute_variable(var, s)\n end\n end", "def _reduce_603(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend", "def method_missing(name, *args, &block)\n if name =~ /(.*)=$/ # We're assigning\n self[$1.to_sym] = args[0]\n elsif name =~ /(.*)\\?$/ # We're asking\n (self[$1.to_sym] ? true : false)\n else\n self[name]\n end\n end", "def []=(var,value)\n raise 'var must be a string' unless var.is_a?(String)\n raise 'value must be a string' unless value.is_a?(String)\n svar=var.to_s\n var_name_ok?(var)\n @vars[svar]=value\n return value\n end", "def PO115=(arg)", "def _reduce_607(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend", "def _reduce_607(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend", "def isVariable(let)\n\t\t(0..@vars.size-1).each do |j| \n\t\t\tif let==@vars[j] \n\t\t\t\treturn(j)\n\t\t\tend\n\t\tend\n\t\treturn(-1)\n\tend", "def _reduce_573(val, _values, result)\n # TODO? if (!($$ = gettable(p, $1, &@$))) $$ = NEW_BEGIN(0, &@$);\n var, = val\n\n result = var\n\n result\nend", "def _reduce_649(val, _values, result)\n result = wrap :ivar, val[0]\n result\nend", "def CTT02=(arg)", "def get_local_var\n p $local_var #this is different than...\n local_var = \"Local Var\"\n p local_var #...this.\nend", "def variable_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n return_value = VariableStatementReturnValue.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_literal38 = nil\n variable_declaration39 = nil\n\n tree_for_string_literal38 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 70:5: ^( 'var' ( variable_declaration )+ )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal38 = match( VAR, TOKENS_FOLLOWING_VAR_IN_variable_statement_326 )\n\n tree_for_string_literal38 = @adaptor.copy_node( string_literal38 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal38, root_1 )\n\n\n\n match( DOWN, nil )\n # at file 70:14: ( variable_declaration )+\n match_count_8 = 0\n while true\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0 == ASGN || look_8_0 == ID )\n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line 70:14: variable_declaration\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_variable_declaration_IN_variable_statement_328 )\n variable_declaration39 = variable_declaration\n @state.following.pop\n\n @adaptor.add_child( root_1, variable_declaration39.tree )\n\n\n else\n match_count_8 > 0 and break\n eee = EarlyExit(8)\n\n\n raise eee\n end\n match_count_8 += 1\n end\n\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 11 )\n\n end\n \n return return_value\n end", "def _reduce_601(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend", "def _reduce_610(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend", "def variable?\n any? {|op| op.respond_to?(:variable?) && op.variable?}\n end" ]
[ "0.6310705", "0.59082776", "0.5795238", "0.57875204", "0.5737463", "0.5702177", "0.56899834", "0.56841046", "0.5675468", "0.56703615", "0.5648727", "0.5612485", "0.55929464", "0.5557159", "0.55551696", "0.55264926", "0.55113", "0.55103993", "0.5506074", "0.550127", "0.54743576", "0.54733455", "0.54733455", "0.54733455", "0.54733455", "0.54733455", "0.54733455", "0.54733455", "0.54733455", "0.54670984", "0.5466698", "0.5458813", "0.5457498", "0.5454893", "0.54502773", "0.54466426", "0.54317445", "0.54286367", "0.54057014", "0.54055053", "0.540201", "0.5399158", "0.5397682", "0.5397682", "0.5397682", "0.5389608", "0.538647", "0.538521", "0.5376324", "0.5376324", "0.5376324", "0.53688604", "0.5368378", "0.5368378", "0.5367688", "0.5367688", "0.5364083", "0.53630954", "0.5361456", "0.5358804", "0.53571385", "0.53431684", "0.5341262", "0.5314313", "0.5314225", "0.5310348", "0.53070396", "0.5306421", "0.5304545", "0.53006893", "0.5297", "0.5295796", "0.52930653", "0.5291611", "0.52826035", "0.5276", "0.52755237", "0.52755237", "0.5275207", "0.527341", "0.5270814", "0.5268769", "0.52636963", "0.5260785", "0.5258555", "0.52577156", "0.52457356", "0.5241087", "0.5235386", "0.5221975", "0.5221975", "0.5214712", "0.5214116", "0.5212019", "0.52105874", "0.52104485", "0.52099866", "0.52070445", "0.5206261", "0.51927185" ]
0.5204472
99
Walk environment S and look up value of U, if present.
def walk(u, s) if var?(u) pr = assp(-> (v) { u == v }, s) pr ? walk(cdr(pr), s) : u else u end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_prog env\n\t\tresults = env.select { |pair| pair[0] == @s }\n\t\tif results.length > 0\n=begin\n for i in 0..results.length-1\n puts results[i][0]\n puts results[i][1]\n puts \"\\n\"\n end\n=end\n results[0][1]\n\t\telse\n\t\t\traise (\"var not found: \" + @s)\n\t\tend\n\tend", "def look_up(variable)\n \ti = @@scope\n \twhile(i>=@@scope_base.last)\n \tif @@variables[i][variable] != nil\n \t\treturn @@variables[i][variable][0]\n \t\tputs \"#{@@variables[i][variable]} is found\" if (@@Debug)\n \t\t#return var[0]\n \tend\n \ti -= 1\n \tend\n \tputs \"Variable '#{variable}' does not exist.\"\n \t:FALSE\nend", "def find(uid, params)\n environments = list(params)\n environments.select { |e| e['uid'] == uid }\n end", "def look_up_variable(name, expr)\n distance = @locals[expr]\n if distance.nil?\n @globals[name]\n else\n @environment.get_at distance, name.lexeme\n end\n end", "def lookUp(name)\n if @currentPath.empty? then\n return nil unless self.keys.include? name\n return self[name]\n else\n entry = nil\n path = @currentPath.clone\n while !(path.empty?)\n cEntry = get(path)\n entry = cEntry.lookUpLocal(name)\n return entry if entry\n path.exitName\n end\n entry = self[name] if self.keys.include? name\n return entry if entry\n end\n nil\n end", "def lookup_variable(key)\n\n fexp.lookup_variable(key)\n end", "def getVar(tape, name)\n\tmFoundEnv = SubMachine.stub 'lookup3'\n\tmFoundEnv.simpleMerge copy(:env, tape)\n\tmFoundEnv.simpleMerge writeConstant(:ra, 0)\n\n\t# Scan to end of env\n\tmNotFound = scan(:env, :right, BlankSymbol)\n\n\t# look for this in env\n\tmNotFound.simpleMerge scanBefore(:env, :left, :this)\n\n\t# copy reference to current class\n\tmNotFound.simpleMerge copy(:env, tape)\n\n\t# scan to front of objects\n\tmNotFound.simpleMerge scanBefore(:objects, :left, BlankSymbol)\n\n\t# Scans for the right reference\n\tmNF2 = SubMachine.empty 'lookupThis'\n\n\t# checks if we're at the right reference\n\tcheckLoc = eq(tape, :objects)\n\tlink(checkLoc.states[checkLoc.lastFalse], mNF2.first)\n\tcheckLoc.mergeTrue writeConstant(:ra, 1)\n\tlink(checkLoc.states[checkLoc.lastTrue], mNF2.last)\n\n\terrorState = SubMachine.empty 'lookupError'\n\terrorState.simpleMerge writeConstant(:output, 1)\n\terrorState.simpleMerge invert(:output)\n\terrorState.simpleMerge output(:output)\n\tes2 = SubMachine.empty 'lookupErrorHalt'\n\tes2.states[es2.first].transitions = [\n\t\tTransition.new( Hash.new, [Action.new(:halt, nil)], es2.last)]\n\terrorState.simpleMerge es2\n\t\n\tmNF2.states[mNF2.first].transitions = [\n\t\tTransition.new({:objects=>:loc}, [Action.new(:right, :objects)], checkLoc.first ),\n\t\tTransition.new({:objects=>BlankSymbol}, Array.new, errorState.first ),\n\t\tTransition.new(Hash.new, [Action.new(:right, :objects)], mNF2.first)]\n\t\n\tmNF2.merge errorState\n\tmNF2.merge checkLoc\n\n\n\t# at this point mNotFound goes to the object that we're in\n\tmNotFound.simpleMerge mNF2\n\n\tmFoundObjects = copy(:objects, tape)\n\n\tmNF3 = SubMachine.empty 'lookupInObject'\n\tmNF3.states[mNF3.first].transitions = [\n\t\tTransition.new( {:objects => name}, [Action.new(:right, :objects)], mFoundObjects.first),\n\t\tTransition.new( Hash.new, [Action.new(:right, :objects)], mNF3.first)]\n\tmNF3.merge mFoundObjects\n\tlink(mFoundObjects.states[mFoundObjects.last], mNF3.last)\n\n\tmNotFound.simpleMerge mNF3\n\n\t# Go to end of env\n\tm = SubMachine.stub \"getVar-#{tape},#{name}\"\n\tm.simpleMerge scanBefore(:env, :right, BlankSymbol)\n\n\t# look for var in env\n\tm2 = SubMachine.empty 'lookup2'\n\tm2.merge mFoundEnv\n\tlink(mFoundEnv.states[mFoundEnv.last], m2.last)\n\tm2.merge mNotFound\n\tlink(mNotFound.states[mNotFound.last], m2.last)\n\tm2.states[m2.first].transitions = [\n\t\tTransition.new( {:env=> :methodScope}, Array.new, mNotFound.first),\n\t\tTransition.new( {:env=> name}, [Action.new(:right, :env)], mFoundEnv.first),\n\t\tTransition.new( Hash.new, [Action.new(:left, :env)], m2.first)]\n\tm.simpleMerge m2\n\n\tm\n\nend", "def find what = :var, path = []\n path.inject(self) do |branch, k| \n if what == :var && k == path.last\n branch[:variables][ k ]\n else\n branch = branch[ k ] or raise PathError, path.join(' > ')\n end\n end\n end", "def extract(key)\n key=key.to_s.strip\n global=nil\n global,key=\"global\",key[2..-1] if key[0,2]==\"::\"\n key=key[1..-1] if key[0,1]==\":\"\n key=keyMeth(key)\n keys=Envir.to_keys(key)\n#puts \"Envir:[]:keys,filter\";p keys;p self\n#puts \"keys\";p keys\n cur=nil\n if global\n return Envir.to_val(cur[keys[-1]]) if (cur=Envir.elt_defined?(@global,keys))\n else\n return Envir.to_val(cur[keys[-1]]) if (cur=elt_defined?(keys))\n end\n return nil\n end", "def deref(s)\n\n v = lookup_value(s)\n\n if Flor.is_tree?(v)\n\n ref =\n case v[0]\n when '_func' then true\n when '_proc' then v[1]['proc'] != s\n when '_tasker' then v[1]['tasker'] != s\n else false\n end\n\n v[1]['oref'] ||= v[1]['ref'] if ref && v[1]['ref']\n v[1]['ref'] = s if ref\n\n v\n\n else\n\n [ '_val', v, tree[2] ]\n end\n\n rescue KeyError => ke\n\n nil\n end", "def find_value(user, object)\n case object\n when Hash\n object.each.with_object({}) do |(key, value), hash|\n hash[key] = find_value(user, value)\n end\n when Array\n object.map do |value|\n find_value(user, value)\n end\n when Symbol\n if object == :name\n end\n user.public_send(object)\n else\n object\n end\n end", "def lookup_value(key, context=nil)\n [named_context[context] || {}, global].map {|c| c[key]}.compact.first\n end", "def parse_value(value)\n if value.include?('$env')\n fetch_environment_variable(value)\n else\n value\n end\n end", "def find_value hash\n @values_mapping[hash]\n end", "def find(val)\n return val if root?(val)\n parent[val] = find parent[val]\n end", "def find_value(calling_node, key)\n @router.touch(calling_node)\n value = @values[key.to_bin]\n return value unless value.nil?\n return find_node(key)\n end", "def subst(context, value)\n # if it's a Hash, call subst for each value\n if value.class == Hash\n new_hash = {}\n value.each do |key, val|\n new_val = subst(\"#{context}.#{key}\", val)\n # Only include non-nil values in ENC results..\n # This allows Puppet defaults to work.\n new_hash[key] = new_val unless new_val.nil?\n end\n return new_hash\n # if it's an Array, call subst for each item\n elsif value.class == Array\n new_value = []\n i=0\n value.each do |val|\n new_value << subst(\"#{context}.#{i}\", val)\n i += 1\n end\n return new_value\n end\n\n # only \n return value if value.class != String\n\n # if no variables, just return it\n return value unless value =~ /\\$\\{.*?\\}/\n\n # Iterate through all matches and perform \n # If there is only one variable, don't convert to a string.\n # \n # - NilClass (\"nil\" gets converted to nil)\n # - TrueClass (\"true\" gets converted to true)\n # - FalseClass (\"false\" gets converted to false)\n # - Any other type that YAML supports\n looked_up = {} # track our lookups to avoid recursion\n result = value\n begin\n while result.class == String && result =~ /\\$\\{.*?\\}/\n if result =~ /^\\$\\{([^}]+)\\}$/\n raise RecursionException if looked_up[$1]\n looked_up[$1] = true\n result = lookup(context, $1)\n else\n result = result.gsub(/\\$\\{([^}]+)\\}/) do\n raise RecursionException if looked_up[$1]\n looked_up[$1] = true\n lookup(context, $1).to_s\n end\n end\n end\n rescue RecursionException\n log(context, \"RecursionException (#{value} => nil)\")\n return nil\n end\n return result # finally!\n end", "def traverse_element(value, path)\n return unless value\n\n value_here = value\n el_parts = path.split('.')\n el_parts.each do |seg|\n if value_here.is_a?(Hash)\n value_here = value_here.stringify_keys[seg]\n elsif value_here.is_a?(Array)\n seg = 0 if seg == 'first'\n seg = seg.to_i\n value_here = value_here[seg]\n end\n end\n value_here\n end", "def locate val\n ArelExtensions::Nodes::Locate.new [self, val]\n end", "def get_local_value(current_locale, value_hash)\n return value_hash[current_locale.to_sym] if value_hash[current_locale.to_sym].present?\n value_hash.values.select{|v| v.present?}.first\n end", "def find_symbol(sym, ctx)\n ctx.each do |h|\n if val = resolve_in(h, sym)\n return val\n end\n end\n\n nil\n end", "def fn_find_in_map(value)\n map_holder = mappings[value[0]]\n if map_holder\n map_item = map_holder[dereference(value[1])]\n if map_item\n map_item[value[2]]\n else\n raise \"Failed to find mapping item! (#{value[0]} -> #{value[1]})\"\n end\n else\n raise \"Failed to find mapping! (#{value[0]})\"\n end\n end", "def get_systemI\n # Look for the owner from the name hierarchy.\n if self.ref.is_a?(RefName) then\n # Look in the parent hierachy for the sub reference name.\n parent = self.parent\n # puts \"self.ref.name=#{self.ref.name}\"\n while parent\n # puts \"parent=#{parent}\"\n if parent.respond_to?(:get_by_name) then\n found = parent.get_by_name(self.ref.name)\n # puts \"found is a :#{found.class}\"\n return found if found.is_a?(SystemI)\n end\n parent = parent.parent\n end\n # Not found, look further in the reference hierarchy.\n return self.ref.get_systemI\n end\n # Not from a systemI.\n # puts \"Not from systemI for #{self.name}\"\n return nil\n end", "def parse_and_resolve_variable(input)\n @stack[-1].get_variable(parse_variable(input))\n end", "def find_state_for_city(user_city)\n found = false\n $states.each do |statekey, stateinfo|\n if stateinfo[1].map{|x| x.downcase}.include?(user_city.downcase)\n found = statekey\n end\n end\n if found \n puts \"Ah #{user_city} is in #{found}\"\n else\n puts \"we didnt find your city, try again sucka!\"\n end\nend", "def extract_value\n \"#{local_name} = (hash[:#{key}] #{\"|| #{default.inspect}\" if default}).downcase\"\n end", "def lookup_variable_or_field_value (workitem)\n\n lookup_var_value(workitem) || lookup_field_value(workitem)\n end", "def value_of(key)\n @root.value_of(key)\n end", "def read_value(key)\n keys = key.split('.')\n result = @context\n keys.each do |k|\n return nil unless result\n result = result[k]\n end\n return result\n end", "def var(path, value = :NOT_PASSED)\n\t\t\t\tif path.is_a? Hash\n\t\t\t\t\tpath.each do |k,v|\n\t\t\t\t\t\tvar k.to_s.split(\".\"), v\n\t\t\t\t\tend\n\n\t\t\t\t\treturn path\n\t\t\t\tend\n\n\t\t\t\tpath = [ *path ]\n\t\t\t\traise ArgumentError.new(\"Invalid path\") if path.length == 0\n\n\t\t\t\t## vvv checking if value was passed. If not, we're trying to retrieve an existing value vvv\n\t\t\t\tif value == :NOT_PASSED\n\t\t\t\t\t@stack.reverse_each do |frame|\n\t\t\t\t\t\tif path.length > 1\n\t\t\t\t\t\t\t# vvv checking for all-but-last of path, as section name vvv\n\t\t\t\t\t\t\tif frame.has_section?( path[0..-2] )\n\t\t\t\t\t\t\t\t# vvv checking if that section contains the last component of the path vvv\n\t\t\t\t\t\t\t\tif frame.has_section_var?( path[0..-2], path.last.to_sym )\n\t\t\t\t\t\t\t\t\treturn frame.get_section_var( path[0..-2], path.last.to_sym )\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t# vvv only one component in path, check if the base of this frame has it as a var vvv\n\t\t\t\t\t\telsif frame.has_var?( path.last.to_sym )\n\t\t\t\t\t\t\treturn frame.get_var( path.last.to_sym )\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\t# vvv found nothing, error vvv\n\t\t\t\t\traise ArgumentError.new(\"Unknown path '#{path}'\")\n\t\t\t\tend\n\n\t\t\t\tif path.length > 1\n\t\t\t\t\t# vvv iterate over each element of the path, creating sections as needed vvv\n\t\t\t\t\t(1..(path.length - 1)).each do |i|\n\t\t\t\t\t\tif !@stack.last.has_section?( path[0..(-1 * i - 1)] )\n\t\t\t\t\t\t\t@stack.last.set_section( path[0..(-1 * i - 1)] )\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\treturn @stack.last.set_section_var( path[0..-2], path.last.to_sym, value )\n\t\t\t\tend\n\n\t\t\t\treturn @stack.last.set_var( path.last.to_sym, value )\n\t\t\tend", "def lookUpLocal(name)\n if @currentPath.empty? then\n return nil unless self.keys.include? name\n return self[name]\n else\n entry = get(@currentPath)\n raise RunTimeError, \"Unexisting symbol table path '#{path.to_s}'\" unless entry\n return entry.lookUpLocal(name)\n end\n end", "def search_local(name)\n if variable = variables[name]\n return variable.nested_reference\n end\n\n if variable = search_scopes(name)\n variables[name] = variable\n return variable.nested_reference\n end\n end", "def eval_program_under(program, env, stack_trace)\n\tvalue = nil\n\tprogram.each {|node| \n\t\tvalue, env = eval_node_under(node, env, stack_trace)\n\t}\n\treturn value, env\nend", "def find_in_scope scope, element\n scope.select do |struct|\n struct.keys.include?(element.to_sym)\n end.first\n end", "def parse_value(value)\n if value.include?('$env')\n fetch_environment_variable(value)\n elsif value.include?('$payload')\n fetch_payload_data(value)\n elsif value.instance_of?(Hash)\n parse_payload!(value)\n elsif value.instance_of?(Array)\n # TODO: Add support for accessing a single element\n value.map { |i| parse_payload!(i) }\n else\n value\n end\n end", "def visitLookup(elem, data)\r\n @@log.debug(\"XmlRuleVisitor::visitLookup\")\r\n @@log.debug(elem.inspect)\r\n\r\n lkName = elem.attributes['Name']\r\n lkParams = @context.getLookupParamNames(lkName)\r\n\r\n data += @template.lookup(lkName, lkParams[\"xparam\"], lkParams[\"yparam\"])\r\n\r\n return data\r\n\r\n lkup = @context.lookups[lkName]\r\n\r\n #puts lkup.inspect\r\n\r\n x = nil\r\n y = nil\r\n\r\n if (isPpmVar(lkup.xParam))\r\n x = @context.ppms[lkup.xParam.alias]\r\n else\r\n x = @context.dpms[lkup.xParam.alias]\r\n end # if PPM\r\n\r\n #puts x.inspect\r\n\r\n if (isPpmVar(lkup.yParam))\r\n y = @context.ppms[lkup.yParam.alias]\r\n else\r\n y = @context.dpms[lkup.yParam.alias]\r\n end # if PPM\r\n\r\n #puts y.inspect\r\n\r\n if (nil == x)\r\n raise \"Unable to find xParam (#{lkup.xParam.alias}) in lookup #{lkName}\"\r\n end # if nil\r\n\r\n if (nil == y)\r\n raise \"Unable to find yParam (#{lkup.yParam.alias}) in lookup #{lkName}\"\r\n end # if nil\r\n\r\n# data += lkup.toGdlRef()\r\n data += @template.lookup(lkName, x.name, y.name)\r\n\r\n return data\r\n end", "def _get_local_component(component)\n component = component.to_sym\n locals = @known_classes.values.map do |m|\n m[:pipeline_group][component]\n end.compact\n # TODO: Add a logger here..\n puts \"Found multiple bindings for: #{p}. Getting first found\" unless locals.size <= 1\n locals[0]\n end", "def search_local(name)\n if variable = variables[name]\n return variable.nested_reference\n end\n\n if variable = search_scopes(name)\n variables[name] = variable\n return variable.nested_reference\n end\n end", "def get_value(env, ref)\n unless ref.package_id\n raise ArgumentError.new(\"package id is invalid: %s\" % ref.inspect)\n end\n\n # when it is known reference\n if expr = @table[ref.package_id][ref.name]\n return expr\n end\n\n if bound?(ref.package_id, ref.name)\n # get value from parent table\n return @parent.get_value(env, ref) if @parent\n else\n # otherwise, find by parent package id\n env.find_ancestor_ids(ref.package_id).each do |ancestor_id|\n if val = get_value(env, ref.set(package_id: ancestor_id))\n return val\n end\n end\n end\n\n return nil\n end", "def value_to_lookup value\n return nil unless value.present?\n value.is_a?(Array) ? value.join(VALUE_JOINT) : value.to_s\n end", "def find_by_value(value)\n by_value[value]\n end", "def find_by_value(value)\n by_value[value]\n end", "def sub_lookup(key, context, segments, value)\n lookup_invocation = context.is_a?(Invocation) ? context : context.invocation\n lookup_invocation.with(:sub_lookup, segments) do\n segments.each do |segment|\n lookup_invocation.with(:segment, segment) do\n if value.nil?\n lookup_invocation.report_not_found(segment)\n throw :no_such_key\n end\n if segment.is_a?(Integer) && value.instance_of?(Array)\n unless segment >= 0 && segment < value.size\n lookup_invocation.report_not_found(segment)\n throw :no_such_key\n end\n else\n unless value.respond_to?(:'[]') && !(value.is_a?(Array) || value.instance_of?(String))\n raise Puppet::DataBinding::LookupError,\n _(\"Data Provider type mismatch: Got %{klass} when a hash-like object was expected to access value using '%{segment}' from key '%{key}'\") %\n { klass: value.class.name, segment: segment, key: key }\n end\n unless value.include?(segment)\n lookup_invocation.report_not_found(segment)\n throw :no_such_key\n end\n end\n value = value[segment]\n lookup_invocation.report_found(segment, value)\n end\n end\n value\n end\n end", "def pfind(name, location)\n result = nil\n [name, name.upcase, name.downcase].each do |n|\n next if result\n result = location[n].first if location[n] && location[n].size > 0\n end\n STDERR.puts \"found #{result} for #{name}\" if $test\n\n result\nend", "def lookup(key)\n @stack.reverse_each do |level|\n return level[key] if level.has_key?(key)\n end\n nil\n end", "def eval(env)\n env.variable_get(self)\n end", "def lookup(context, name)\n lookup = context\n name.split(\".\").each { |value| lookup = lookup[value] }\n lookup\n end", "def find_variable(key, raise_on_not_found: T.unsafe(nil)); end", "def lookup(source_or_key)\n case source_or_key\n when nil\n nil\n when String\n lookup(Tag[source_or_key])\n when Tag\n provides_map[source_or_key]\n when SourceFile\n source_or_key\n else\n raise \"Illegal lookup query. Expected String, Tag or SourceFile, \" <<\n \"given #{source_or_key.inspect}, an instance of #{source_or_key.class.name}.\"\n end\n end", "def user_get_value(element)\r\n begin\r\n key_processor(element)\r\n ****_get_text(@selector, @locator)\r\n rescue Exception => e\r\n raise e.message\r\n raise e.backtrace.inspect\r\n end\r\n end", "def find(key)\n node = find_node(key)\n (node == nil ? nil : node.value)\n end", "def get_value!(args)\n idx = -1\n args.each_index do |index|\n result = find_me(args[index])\n if result[0]\n if result[1]\n args[index] = result[1]\n else\n args.delete_at index\n end\n return result[0]\n end\n end\n @default_value\n end", "def find_ancestor_local_symbol symbol\n each_ancestor do |m|\n res = m.find_local_symbol(symbol)\n return res if res\n end\n\n nil\n end", "def find(key)\n # If we are already on nil, just add it here\n return nil if @root.nil?\n #Return the root value if it is the value we are looking for\n return @root.value if @root.key == key\n #Otherwise, call in reinforcements\n return find_helper(@root, key)\n end", "def evaluate_value(interpreter, arg_stack)\n arguments = arg_stack.pop\n sigils = XrefEntry.make_sigils(arguments)\n definition = interpreter.get_user_function(@name, sigils)\n\n # dummy variable names and their (now known) values\n params = definition.arguments\n param_names_values = params.zip(arguments)\n names_and_values = Hash[param_names_values]\n interpreter.define_user_var_values(names_and_values)\n\n begin\n expression = definition.expression\n results = expression.evaluate(interpreter)\n rescue BASICRuntimeError => e\n interpreter.clear_user_var_values\n\n raise e\n end\n\n interpreter.clear_user_var_values\n results[0]\n end", "def reduce(environment)\n environment[name]\n end", "def resolve_jinja_variables(vconfig)\n walk(vconfig) do |value|\n while value.is_a?(String) && value.match(/{{ .* }}/)\n value = value.gsub(/{{ (.*?) }}/) { vconfig[Regexp.last_match(1)] }\n end\n value\n end\n end", "def parse_value(v, locale)\n new_value = nil\n case v\n when Symbol then\n lk = Lit::LocalizationKey.where(:localization_key=>v.to_s).first\n if lk\n loca = Lit::Localization.where(:locale_id=>locale.id).\n where(:localization_key_id=>lk.id).first\n new_value = loca.get_value if loca and loca.get_value.present?\n end\n when String then\n new_value = v\n when Hash then\n new_value = nil\n when Proc then\n new_value = nil # was v.call - requires more love\n else\n new_value = v.to_s\n end\n new_value\n end", "def look_for(symbol)\n env = self.find {|e| e.symbol.equal? symbol}\n return env unless env.nil?\n raise NameError.new(\"#{symbol} not found\", symbol)\n end", "def lookup(key)\n if @data[\"vars\"] && @data[\"vars\"].has_key?(key)\n return true, @data[\"vars\"][key]\n end\n return false, nil\n end", "def find_variable_ref(s)\n m = @var_re.match(s)\n if m.nil?\n nil\n else\n Variable.new(m.begin(0), m.end(0), m[1], nil)\n end\n end", "def process_dasgn_curr(exp) # TODO: audit against obfuscator\n var = exp.shift\n @env.add var.to_sym, exp.c_type\n return var.to_s\n end", "def lookup(obj, pos); end", "def value_of(element, substitute = nil)\n value = element.to_a.join.strip\n value = value.gsub(/\\$\\{([^}]+)\\}/) { |key| Array(substitute[$1]).join.strip } if substitute\n value\n end", "def net_switch_port_lookup(site, node_uid, interface='')\n site[\"networks\"].each do |switch_uid, switch|\n switch[\"linecards\"].each do |lc_uid,lc|\n lc[\"ports\"].each do |port_uid,port|\n if port.is_a?(Hash)\n switch_remote_port = port[\"port\"] || lc[\"port\"] || \"\"\n switch_remote_uid = port[\"uid\"]\n else\n switch_remote_port = lc[\"port\"] || \"\"\n switch_remote_uid = port\n end\n if switch_remote_uid =~ /([a-z]*-[0-9]*)-(.*)/\n n, p = switch_remote_uid.match(/([a-z]*-[0-9]*)-(.*)/).captures\n switch_remote_uid = n\n switch_remote_port = p\n end\n if switch_remote_uid == node_uid and switch_remote_port == interface\n # Build port name from snmp_naming_pattern\n # Example: '3 2 GigabitEthernet%LINECARD%/%PORT%' -> 'GigabitEthernet3/2'\n pattern = port[\"snmp_pattern\"] || lc[\"snmp_pattern\"]\n port_name = pattern.sub(\"%LINECARD%\",lc_uid.to_s).sub(\"%PORT%\",port_uid.to_s)\n return switch_uid, port_name\n end\n end\n end\n end\n return nil\nend", "def read_value(from, key)\n return from if key.nil? or key == \"\"\n\n key.split(/\\./).reduce({}) do |acc, x|\n unless acc.nil?\n if acc.empty?\n # Initial run\n acc = from[x]\n else\n if acc.has_key?(x)\n acc = acc[x]\n else\n # Some intermediate key does not exist\n return nil\n end\n end\n else\n # Some intermediate key returned a null value\n # This indicates a malformed entry\n return nil\n end\n end\n end", "def extract(input = nil)\n input.present? ? local(input) : global\n end", "def parse_value(v, locale)\n new_value = nil\n case v\n when Symbol then\n lk = @localization_key_object_cache[v.to_s] || \\\n Lit::LocalizationKey.where(localization_key: v.to_s).first\n if lk\n loca = Lit::Localization.active.where(locale_id: locale.id).\n where(localization_key_id: lk.id).first\n new_value = loca.translation if loca && loca.translation.present?\n end\n when String then\n new_value = v\n when Hash then\n new_value = nil\n when Proc then\n new_value = nil # was v.call - requires more love\n else\n new_value = v.to_s\n end\n new_value\n end", "def lookup(key)\n @map.each { |k, v| return v if key == k }\n nil\n end", "def countingValleys(n, s)\n valleysNum = 0\n level = 0\n s.each_char do | step |\n step == \"D\" ? level -= 1 : level += 1\n valleysNum += 1 if (level == 0 && step == \"U\")\n end\n p valleysNum\nend", "def lookup_environment (varname)\n\n return [\n get_expression_pool.fetch_engine_environment, varname[2..-1]\n ] if varname[0, 2] == '//'\n\n return [\n get_environment.get_root_environment, varname[1..-1]\n ] if varname[0, 1] == '/'\n\n [ get_environment, varname ]\n end", "def lookUpVoid(name)\n path = @currentPath.clone\n globalPath = findGlobalPath\n if ! path.empty? then\n cEntry = get(path)\n entry = checkEntry(cEntry.lookUpLocal(name))\n return entry if entry\n while path != globalPath\n path.exitName\n cEntry = get(path)\n entry = checkEntry(cEntry.lookUpLocal(name)) if entry\n return entry if entry\n end\n if path.empty?\n entry = self[name] if self.keys.include? name\n entry = checkEntry(entry)\n return entry if entry\n end\n else\n entry = self[name] if self.keys.include? name\n entry = checkEntry(entry)\n return entry if entry\n end\n nil\n end", "def find_single_item(hash,lookup)\n if hash[lookup]==nil\n return nil\n else\n return hash[lookup][:item]\n end\nend", "def value_from_lookup string, type\n type == :multi_category ? string.split(VALUE_JOINT) : string\n end", "def visitLookup(elem, data)\r\n @@log.debug(\"XmlVisitor::visitLookup\")\r\n @@log.debug(elem.inspect)\r\n\r\n elem.each_element do |child|\r\n data = visit(child, data)\r\n end\r\n\r\n return data\r\n end", "def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end", "def find(value)\n end", "def retrieve(key, environment)\n environment ||= 'default'\n self.fetch(environment, {})[key.to_s]\n end", "def parse(env); env; end", "def get_variable_value(name)\n @scopes.reverse_each do |scope|\n value = scope.get_variable_value(name)\n if value != NOT_FOUND\n return value\n end\n end\n\n return NOT_FOUND\n end", "def local_variable_reads(node); end", "def resolve(val)\n return nil if not val\n return val if [String, Integer, Ruckus::Mutator::Mutator].kind_of_these? val\n return val if val == true\n return val if val == false\n\n o = {}\n\n if val.kind_of? Symbol\n o[:meth] = val\n elsif val.kind_of? Hash\n o = o.merge(val)\n end\n\n if (t = @from_tag) || (t = o[:from_tag])\n o[:source] = root.find_tag(t)\n raise \"can't find\" if not o[:source]\n end\n\n if (f = @from_field) || (f = o[:from_field])\n o[:source] = parent_struct.send f\n raise \"can't find field\" if not o[:source]\n end\n\n place = parent.place(self)\n\n if not o[:source]\n raise \"unparented\" if not parent\n\n o[:offset] ||= 1\n o[:offset] = 0 if o[:offset] == :this\n o[:offset] = -1 if o[:offset] == :prev\n o[:offset] = 1 if o[:offset] == :next\n\n loc = place + o[:offset]\n o[:source] = parent[loc]\n\n raise \"can't resolve #{ o } for #{ @name }\" if not o[:source]\n end\n\n if not o[:block]\n o[:meth] ||= :size\n\n if o[:source] == :rest\n r = 0\n ((place+1)..(parent.size)).each do |i|\n r += parent[i].send(o[:meth]) if parent[i]\n end\n else\n r = o[:source].send o[:meth]\n end\n else\n r = o[:block].call o[:source]\n end\n\n # cheat: if resolution returns a symbol --- which happens\n # with len/string pairs, because they depend on each other ---\n # return nil. This effectively unbounds the string during to_s.\n r = nil if r.kind_of? Symbol\n\n r = @modifier.call(self, r) if @modifier\n return r\n end", "def fetch_value(value); end", "def resolveSTR(command)\r\n splitString = command.split(' ')\r\n currSymbol = splitString[1]\r\n currIndex = findIndex(currSymbol)\r\n puts currIndex.to_s\r\n if(currIndex == -1)\r\n puts \"Symbol has not been declared or did not receive a symbol at all. Exiting.\"\r\n exit\r\n end\r\n @DecValues[currIndex] = @RegA\r\n temp = @DecValues[currIndex].to_s\r\n puts temp + \" has been loaded into \" + @Declarations[currIndex].to_s + \".\"\r\n end", "def value(user_query)\n user_query = user_query.to_s.downcase\n resolve_fact(user_query) unless @already_searched.include?(user_query)\n\n @already_searched[user_query]&.value\n end", "def get_value(path, hash)\n path.split('.').each do |key|\n hash = hash[key]\n end\n raise if hash.nil?\n\n hash\n rescue\n \"ValueNotFound\"\n end", "def countingValleys(n, s)\n vcount = 0\n level = 0\n n.times do |i|\n if s[i] == \"U\"\n level +=1\n vcount +=1 if level == 0\n elsif s[i] == \"D\"\n level -=1\n end\n end\n return vcount \nend", "def lookup(name)\n begin\n eval(sanitize(name));\n rescue NameError\n return nil\n end\n end", "def net_switch_port_lookup(site, node_uid, interface='')\n site[\"networks\"].each do |switch_uid, switch|\n #pp switch_uid\n switch[\"linecards\"].each do |lc_uid,lc|\n lc[\"ports\"].each do |port_uid,port|\n if port.is_a?(Hash)\n switch_remote_port = port[\"port\"] || lc[\"port\"] || \"\"\n switch_remote_uid = port[\"uid\"]\n else\n switch_remote_port = lc[\"port\"] || \"\"\n switch_remote_uid = port\n end\n if switch_remote_uid == node_uid and switch_remote_port == interface\n # Build port name from snmp_naming_pattern\n # Example: '3 2 GigabitEthernet%LINECARD%/%PORT%' -> 'GigabitEthernet3/2'\n port_name = lc[\"snmp_pattern\"].sub(\"%LINECARD%\",lc_uid.to_s).sub(\"%PORT%\",port_uid.to_s)\n return switch_uid, port_name\n end\n end\n end\n end\n return nil\nend", "def resolve(expr, depth)\n @locals[expr] = depth\n end", "def find(input, property, value); end", "def lookup_variable (varname)\n\n env, var = lookup_environment(varname)\n env[var]\n end", "def lookup_chain = locale(true).lookup", "def find_entry!(string)\n string = string.upcase\n [ string, words.get(string) ] if words.has_key?(string)\n end", "def find_user (map)\n user = []\n for i in 0..map.length-1\n for j in 0..map.length-1\n if map[i][j] == \" U \"\n user = [i,j]\n end\n end\n end\n user\n end", "def lookup target, *arg\n\t\t\toutput = arg[0] ? arg[0] : Array.new\n\t\t\tnode = @root\n\n\t\t\t# If this is a string process each character\n\t\t\tif String(target) == target\n\t\t\t\ttarget.each_char do |char|\n\t\t\t\t\t# Follow the failures until a goto transition is found\n\t\t\t\t\t# or we return to the root node.\n\t\t\t\t\twhile(!node.goto(char) and !node.eql? @root)\n\t\t\t\t\t\tnode = node.failure\n\t\t\t\t\tend\n\n\t\t\t\t\t# If there is a goto transition follow it; otherwise, \n\t\t\t\t\t# we can assume we are at the root node.\n\t\t\t\t\tif node.goto(char)\n\t\t\t\t\t\tnode = node.goto(char)\n\n\t\t\t\t\t\tif node.output\t\t\n\t\t\t\t\t\t\tif block_given?\n\t\t\t\t\t\t\t\toutput = yield output, node.output\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\toutput = output + node.output\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # Otherwise, target should support \"each\" method.\n\t\t\t\tfor item in target\n\t\t\t\t\t# Follow the failures until a goto transition is found\n\t\t\t\t\t# or we return to the root node.\n\t\t\t\t\twhile(!node.goto(item) and !node.eql? @root)\n\t\t\t\t\t\tnode = node.failure\n\t\t\t\t\tend\n\n\t\t\t\t\t# If there is a goto transition follow it; otherwise, \n\t\t\t\t\t# we can assume we are at the root node.\n\t\t\t\t\tif node.goto(item)\n\t\t\t\t\t\tnode = node.goto(item)\n\n\t\t\t\t\t\tif node.output\t\t\n\t\t\t\t\t\t\tif block_given?\n\t\t\t\t\t\t\t\toutput = yield output, node.output\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\toutput = output + node.output\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn output\n\t\tend", "def find_value(value)\n return find() do |item| # find is an enumerable that takes a block - passes each entry in enum to block\n item.data == value # and returns the first for which block is NOT false. So here we say return what we\n end # the first item of which the data matches the value\n end", "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 lookup(key=nil)\n silo = self.lookup_silo_name\n dict = nil\n ActiveRecord::Base.benchmark(\"Lookup: #{silo}#{key.ergo{'#'+to_s}}\") do\n dict = self.fetch_object(silo){\n # FIXME Exceptions within this block are silently swallowed by something. This is bad.\n self.find(:all, self.lookup_opts).inject(Dictionary.new){|s,v| s[v.send(self.lookup_key)] = v; s}\n }\n end\n return key ? dict[key.with{kind_of?(Symbol) ? to_s : self}] : (dict.values || [])\n end", "def lookup(context, name)\n lookup = context\n name.split(\".\").each { |value| lookup = lookup[value] }\n lookup\n end" ]
[ "0.5306887", "0.5068697", "0.48224854", "0.48092902", "0.47228032", "0.47023335", "0.46932405", "0.462838", "0.46265164", "0.46179718", "0.46034986", "0.4601371", "0.45819363", "0.4556256", "0.45244116", "0.4500404", "0.44843635", "0.44218725", "0.44159862", "0.44086206", "0.44080737", "0.43860355", "0.43759844", "0.4330963", "0.43165436", "0.43001857", "0.4299522", "0.42765853", "0.42697617", "0.42666256", "0.4265827", "0.4261095", "0.42517966", "0.42490625", "0.42430434", "0.4235847", "0.42149356", "0.42114562", "0.42105326", "0.42097363", "0.42068624", "0.42068624", "0.4200452", "0.41967425", "0.41937906", "0.41768998", "0.4176298", "0.41664267", "0.41622207", "0.41610193", "0.41478238", "0.41475624", "0.41457418", "0.41457087", "0.4145288", "0.41396177", "0.413693", "0.4131954", "0.41258186", "0.41257125", "0.41229272", "0.4122185", "0.41205558", "0.41188622", "0.41074812", "0.41061032", "0.4098947", "0.40986285", "0.40965405", "0.40940556", "0.40928847", "0.40900818", "0.40884376", "0.4080891", "0.40737066", "0.40722948", "0.40712562", "0.40708214", "0.40692014", "0.40684876", "0.4066018", "0.40624228", "0.40505818", "0.40482605", "0.40444872", "0.40414384", "0.403958", "0.4034028", "0.40323806", "0.4021578", "0.40138426", "0.4004903", "0.4003069", "0.39969164", "0.39959207", "0.39947397", "0.39945784", "0.39944226", "0.39942807", "0.3994045" ]
0.6504468
0
Call function f with a fresh variable.
def call_fresh(f) -> (s_c) { c = cdr(s_c) f.call(var(c)).call(cons(car(s_c), c + 1)) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f\n 1\n end", "def f1(x, x); end", "def f\n end", "def f() 1 end", "def f\n x = 3\n b = binding()\n b\nend", "def call(f)\n CAS::Help.assert(f, Hash)\n\n -1.0 * @x.call(f)\n end", "def f\n g\n end", "def f\n 0\n end", "def f2(x, x=0); end", "def bind(f)\n success? ? f.call(value) : self\n end", "def f(n)\n n += 1\nend", "def f(x)\n return x + 1\nend", "def call(f)\n CAS::Help.assert(f, Hash)\n\n s = (@x.call(f) >= 0 ? 1 : -1)\n return s * @x.call(f)\n end", "def f\n 0\n end", "def f\n 0\n end", "def f4(x)\n y = 100\n z = x + y\n return z\nend", "def f(*args)\n function.f(*args)\n end", "def f(b)\n b\n end", "def f(x0, y0)\n @f.call(x0, y0)\n end", "def change_it(val)\n val = 5\nend", "def fresh! \n @fresh = true\n end", "def farenheit=(temp_f)\n self.f = temp_f\n end", "def call(f)\n CAS::Help.assert(f, Hash)\n p = 0\n @x.each do |y|\n p = p.overloaded_plus(y.call(f))\n end\n p\n end", "def foo()\n x = 0\n p(x)\nend", "def f n\n a 0,n\nend", "def f\n yield\n end", "def f\n yield\n end", "def f\n yield\n end", "def call(f)\n CAS::Help.assert(f, Hash)\n Math::sin(@x.call(f))\n end", "def f(x)\n x*(x+1)\nend", "def f(i=1)\n i\n end", "def initialize(f, sub)\n @f = f\n @sub = sub\n freeze\n end", "def f i\n return i\n end", "def call_f(r)\n @f.arity > 1 ? @f.call(r, @attrs) : @f.call(r)\n end", "def function_eval(f,i)\n eval(f.gsub(\"x\",i.to_s))\nend", "def f\n F_COND()\n end", "def unit(f, *args)\n f[*args]\n end", "def g(x)\n -> (y) { f(x, y) }\nend", "def f\n (a = a) == nil or raise\n end", "def just_assignment(number)\n foo = number + 3 \nend", "def old_value=(_arg0); end", "def some_method (number)\n number = 7\nend", "def once=(tf)\n @once = tf\n end", "def just_assignment(number)\r\n foo = number + 3\r\nend", "def just_assignment(number)\n foo = number + 3\nend", "def just_assignment(number)\n foo = number + 3\nend", "def doubleit num\n num = num * 2\n return num\n num = 3 #this line won't ever run\nend", "def some_method\n\ta = 3\nend", "def update!(**args)\n @temporary_closure = args[:temporary_closure] if args.key?(:temporary_closure)\n end", "def partial=(_arg0); end", "def f5(x, x:); end", "def f( arg )\n \"output.push( 'f #{ arg }' )\"\n end", "def fiber=(_); end", "def fiber=(_); end", "def demo(a,b)\n\ta = a+2\n\tb = b+ 3\nend", "def process_function f, args, options = {}\n fn_reg = 'temp1'\n self_reg = 'temp2'\n args_reg = 'temp3'\n\n block = CompiledBlock.new\n CODE_MGR.add_block block\n block.add_instr [INIT]\n block.add_instr [WRITE, fn_reg, f]\n\n if options[:self]\n block.add_instr [WRITE, self_reg, options[:self]]\n end\n\n # Create argument object and add to a register\n args_obj = Gene::Lang::Object.new\n args_obj.data = args\n block.add_instr [WRITE, args_reg, args_obj]\n\n block.add_instr [DEFAULT, f.body]\n\n # Call function\n if options[:self]\n block.add_instr [CALL, 'default', {\n 'fn_reg' => fn_reg,\n 'self_reg' => self_reg,\n 'args_reg' => args_reg,\n 'return_reg' => 'default',\n }]\n else\n block.add_instr [CALL, 'default', {\n 'fn_reg' => fn_reg,\n 'args_reg' => args_reg,\n 'return_reg' => 'default',\n }]\n end\n\n process block, options\n end", "def call(f)\n CAS::Help.assert(f, Hash)\n p = 1\n @x.each do |y|\n p = p.overloaded_mul(y.call(f))\n end\n p\n end", "def f6(x, x: nil); end", "def f(x)\n 0.4 * x + 1\nend", "def exec_proc(fn)\n num = 1\n fn.call # 2 prints\nend", "def littlePest var\n var = nil\n puts 'HAHA! I ruined your variable!'\nend", "def bar\r\n a = 1\r\n foo {\r\n a\r\n }\r\nend", "def make_ct(f); f; end", "def call(f)\n CAS::Help.assert(f, Hash)\n\n Math::sqrt @x.call(f)\n end", "def defp &p\r\n $p = p\r\n g2 &p # this is ok\r\nend", "def x=(_arg0); end", "def x=(_arg0); end", "def x=(_arg0); end", "def a\r\n test = 123\r\nend", "def call(f)\n CAS::Help.assert(f, Hash)\n @x.call(f).overloaded_pow(@y.call(f))\n end", "def maybe(f)\n ->(value) { value.nil? ? nil : f.call(value) }\n end", "def reload_self(scope)\n t,a = get_arg(scope,:self)\n end", "def f(x, y=2)\n x + y\n end", "def &(f)\n return self.class::new( @val & f )\n end", "def fact\n n = 5\n f = 1\n 1.upto(n) do |v|\n f = f * v\n end\nend", "def my_func(f)\n\t(f - 32) * 5/9\nend", "def some_method\n a = 3 # variable inside the scope cannot change the variable outside.\nend", "def some_method\n a = 4\nend", "def flock(p0) end", "def file=(f)\n @file = f\n @internal = nil # force reload\n @file\n end", "def fld=(val); @fld = val end", "def update(closure: T.unsafe(nil), scope: T.unsafe(nil), visibility: T.unsafe(nil), lvars: T.unsafe(nil)); end", "def f(j)\n return j\nend", "def f7(x=0, x: nil); end", "def rewind(f)\n\t# moves to 0 byte of the file (beginning)\n\tf.seek(0)\n\t# ends the function\nend", "def initialize\n @@count += 1\n @count = @@count # instance variable\n fed = true # local variable\n end", "def initialize(f, *args)\n @f, @args = f, args\n end", "def local(*args); end", "def current_value=(_arg0); end", "def my_method\n greeting = \"hello\"\nend", "def myMethod var\n var = var + var\n var = var * 4\nend", "def doit val\n\t\t@doit = val\n\tend", "def initialize\n @@count += 1\n @count = @@count #@count is a instance variable- can be accessed outside of this method \n fed = true #local variable- cannot be accessed outside of this method \n end", "def f3(x:, x:); end", "def blah()\n my_var = \"my var has been defined\"\nend", "def clean_thread_locals=(_arg0); end", "def add_three_again(x)\r\n new_value = x + 3\r\n puts new_value # prints returned value\r\n new_value # == return new_value; implicitly returns\r\nend", "def call(f)\n CAS::Help.assert(f, Hash)\n\n @x.call(f).overloaded_div(@y.call(f))\n end", "def x() @x end", "def test(a, b)\n a = b - 1\n b = a + 3\nend" ]
[ "0.5863297", "0.5788108", "0.57575756", "0.5741883", "0.5687574", "0.567119", "0.5655669", "0.5622544", "0.5584153", "0.55774474", "0.55583775", "0.5495838", "0.5484879", "0.5452233", "0.5452233", "0.54283416", "0.5380214", "0.53436005", "0.53393865", "0.53299165", "0.5317281", "0.52662355", "0.5191246", "0.51794255", "0.5175394", "0.51520073", "0.51520073", "0.51520073", "0.5114703", "0.51024806", "0.5078545", "0.50654596", "0.50595963", "0.5032528", "0.49963957", "0.49939418", "0.49365813", "0.4925004", "0.49220112", "0.49202648", "0.49069047", "0.49017295", "0.4900238", "0.48951426", "0.48841047", "0.48841047", "0.48686323", "0.4859879", "0.4855085", "0.48452252", "0.48350757", "0.4825528", "0.4808623", "0.4808623", "0.48005992", "0.4798877", "0.47939983", "0.4785374", "0.47371677", "0.47346538", "0.47329593", "0.47243124", "0.47234434", "0.47224244", "0.47157958", "0.47046745", "0.47046745", "0.47046745", "0.47040528", "0.4697775", "0.4697763", "0.46945974", "0.4679959", "0.46649164", "0.46608514", "0.46598774", "0.46028915", "0.46005762", "0.45965633", "0.45689002", "0.45622918", "0.4562081", "0.45525104", "0.4545351", "0.4535352", "0.45332357", "0.45328528", "0.45303154", "0.45296237", "0.45292053", "0.45271423", "0.45086557", "0.4507865", "0.45078254", "0.45054853", "0.45037037", "0.4502429", "0.44950226", "0.44905165", "0.44726264" ]
0.67358845
0
Editer un restaurant s'il existe
def edit @restaurant = Restaurant.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_restaurante\n @restaurante = Restaurante.friendly.find(params[:id])\n end", "def set_restaurante\n\t\t@restaurante = Restaurante.find(params[:id])\t\n\tend", "def edit\n\t\t@restaurant = Restaurant.find(params[:id])\n\tend", "def set_restaurante\n @restaurante = Restaurante.find(params[:id])\n end", "def edit\n @role= current_user.Role\n @restaurant = Restaurant.find(params[:id])\n end", "def edit\n id = params[:id]\n @restaurant = Restaurant.find_by_id(id)\n if @restaurant.nil?\n raise ActionController::RoutingError.new('No such restaurant')\n end\n @foods = Food.where(\"restaurant_id = ?\", id)\n\n end", "def update\n @restaurant = Restaurant.find(params[:id])\n temp_restaurant = Restaurant.new(params[:restaurant])\n notice = 'Restaurant was successfully updated.'\n\n if (temp_restaurant.linkedRestaurator != '')\n @restaurant.restaurator_id = temp_restaurant.linkedRestaurator\n else\n notice = 'Vous avez modifie un restaurant sans lui assigner un restaurateur.'\n end\n\n if (current_user.clientType == Client::CLIENT_TYPES[:entrepreneur])\n @restaurant.entrepreneur_id = current_user.id\n end\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to @restaurant, notice: notice }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n \t@restaurant=Restaurant.find params[:id]\n end", "def set_restaurante\n @restaurante = Restaurante.find(params[:id])\n end", "def edit\n @restaurant = Restaurant.find(params[:restaurant_id])\n @food = Food.find(params[:id])\n end", "def add_restaurant\n @user = User.find(session[:user_id])\n restaurant_info = Open.find_restaurant params[:restaurant][:name], params[:restaurant][:city], params[:restaurant][:state], params[:restaurant][:open_table_id]\n if restaurant_info\n message = Crawler.url_check restaurant_info, @user\n message\n else\n flash[:notice] = \"Restaurant not found\"\n end\n redirect_to cues_path\n end", "def show # exibe um item específico\n @restaurante = Restaurante.find(params[:id])\n end", "def check_restaurant\n @restaurant = Restaurant.find_by name: (params[:restaurant_name])\n if @restaurant.nil?\n redirect_to root_url\n flash[:warning] = \"Restaurant does not exist\"\n end\n end", "def edificar_hotel (titulo)\n edificado = false\n \n if (puedo_edificar_hotel(titulo))\n coste_edificar_hotel = titulo.precio_edificar\n titulo.edificar_hotel\n modificar_saldo (-coste_edificar_hotel)\n edificado=true\n end\n \n return edificado\n end", "def favorite_restaurant\n Favorite.favorite_restaurant(current_user,Restaurant.find(params[:restaurant]), \"true\")\n redirect_to restaurants_url\n end", "def set_restauracje\n @restauracje = Restauracje.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.friendly.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.friendly.find(params[:id])\n end", "def ensure_remitente_exists\n begin\n Entidad.find(self.remitente_id)\n rescue ActiveRecord::RecordNotFound\n errors.add(:remitente,'Debe seleccionar un Remitente')\n end\n\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n # byebug\n end", "def set_restaurant\n @restaurant = Restaurant.find_by(uuid: params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def update\n # @restaurante = Restaurante.find params[:id]\n respond_to do |format|\n if @restaurante.update(restaurante_params)\n format.html { redirect_to @restaurante, notice: 'Restaurante editado com sucesso!.' }\n format.json { render :show, status: :ok, location: @restaurante }\n else\n format.html { render :edit }\n format.json { render json: @restaurante.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:restaurant_id] || params[:id])\n end", "def set_restauracja\n @restauracja = Restauracja.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n # i will put it inside the set restaurant method instead of\n # the show bc then it will be called for all of the before\n # actions set in my controller - that way i wont need to put\n # it everywhere keeping the code DRY\n authorize @restaurant\n end", "def set_restaurant\n @restaurant = Restaurant.find(params.require(:id))\n end", "def update\n if @restaurant.update(restaurant_params)\n redirect_to restaurants_path\n else\n render :edit\n end\nend", "def restaurant_in_db?(restaurant)\n restaurant.hostesses[0]\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n end", "def set_favorite_restaurant\n @favorite_restaurant = FavoriteRestaurant.find(params[:id])\n end", "def create\n @restaurant = Restaurant.find(params[:id])\n @beer = Beer.where(beer_params).first_or_create \n if @beer.save\n begin\n @beer.restaurants << @restaurant\n redirect_to restaurant_path(@restaurant.id)\n rescue\n flash[:warning] = \"The Beer already exists\"\n redirect_to restaurant_path(@restaurant.id)\n end\n\n else\n render :show\n end\n end", "def create\n @restaurant = Restaurant.new(params[:restaurant])\n notice = 'Restaurant was successfully created.'\n\n if (@restaurant.linkedRestaurator != '')\n @restaurant.restaurator_id = @restaurant.linkedRestaurator\n else\n notice = 'Vous avez ajoute un restaurant sans lui assigner un restaurateur.'\n end\n\n if (current_user.clientType == Client::CLIENT_TYPES[:entrepreneur])\n @restaurant.entrepreneur_id = current_user.id\n end\n\n respond_to do |format|\n if @restaurant.save\n\n format.html { redirect_to @restaurant, notice: notice }\n format.json { render json: @restaurant, status: :created, location: @restaurant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n\n if @restaurant.update!(restaurant_params)\n redirect_to @restaurant\n else\n render :edit\n end\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:restaurant_id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:restaurant_id])\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:restaurant_id])\n end", "def editar\n end", "def show\n @ordenes = Ordene.where(:id => params[:id])\n if @ordenes.exists?\n puts(\"HAY ORDEN\")\n else\n puts(\"No hay ordenes\")\n end\n end", "def set_admin_restaurant\n @admin_restaurant = Admin::Restaurant.find(params[:id])\n end", "def estante\n tipo = params[:tipo]\n\n if tipo == 'add'\n current_user.adicoes_estante << @livro\n redirect_to request.referrer, notice: \"#{@livro.nome} foi adicionado à sua estante!\"\n elsif tipo == 'del'\n current_user.adicoes_estante.delete(@livro)\n redirect_to request.referrer, notice: \"#{@livro.nome} foi removido da sua estante.\"\n else\n # nenhum tipo. nada deve acontecer.\n redirect_to livro_path(@book), alert: \"Oops! Algo deu errado. Tente novamente.\"\n end\n end", "def orden_repuesto_exists\n\n if self.id_orden_respuesto.blank?\n true\n else\n begin\n OrdenRepuesto.find(self.id_orden_respuesto)\n rescue ActiveRecord::RecordNotFound\n errors.add(:id_orden_respuesto, \"No existe la orden especificada\")\n false\n end\n end\n\n end", "def set_restaurant\n @restaurant = Restaurant.find_by(yelp_id: params[:yelp_id])\n end", "def add\n @restaurant = Restaurant.new\n @restaurants = User.find(session[:user_id]).restaurants\n end", "def create\n return if check_if_exists(params[:restaurant][:name])\n set_params\n @restaurant = Restaurant.new(params[:restaurant])\n @restaurant.save\n if (params[:restaurant][:status] == \"Exclusive\")\n send_request\n @restaurant.mark_pending(current_user.id)\n end\n set_menu_items_and_file\n super\n end", "def create? #restaurant instance\n true\n end", "def set_restaurant\n @restaurant = current_chef.manager.restaurant\n end", "def set_restaurant\n @restaurant = Restaurant.find_by_local_id!(params[:local_id])\n end", "def update\n if @fornecedor.update(fornecedor_params)\n redirect_to fornecedores_path, notice: \"O Fornecedor (#{@fornecedor.nome}) foi atualizado com sucesso!\"\n else\n render :edit\n end\n end", "def update\n update_restaurant\n end", "def update\n set_params\n @restaurant = Restaurant.find(params[:id])\n authorize! :update, @restaurant\n if (params[:restaurant][:status] == \"Exclusive\" &&\n @restaurant.owned_by != current_user.id)\n params[:restaurant][:status] = \"Pending Approval\"\n send_request\n @restaurant.mark_pending(current_user.id)\n end\n MenuItem.destroy_all(:restaurant_id => params[:id])\n set_menu_items_and_file\n super\n end", "def create\n\t @restaurante = Restaurante.new(params[:restaurante])\n\t\tif @restaurante.save\n\t\t\tredirect_to(action:'show', id:@restaurante)\t\t\n\t\telse\n\t\t\trender action:'new'\n\t\t\tend\n\tend", "def update\n @tipo_restaurante = TipoRestaurante.find(params[:id])\n\n respond_to do |format|\n if @tipo_restaurante.update_attributes(params[:tipo_restaurante])\n format.html { redirect_to(@tipo_restaurante, :notice => 'Tipo restaurante was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_restaurante.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_restaurant_for_create\n @restaurant = Restaurant.find(params[:restaurant][:id])\n end", "def create\n cour = Cour.find(params[:elefe][:ville_entrainement])\n u = current_user\n #info_ville = params[:elefe][:info_ville].join.to_i\n #params[:elefe][:info_ville] = info_ville\n # CAS DES FICHES EXISTANTES\n if @All_Eleves.exists?(:nom => params[:elefe][:nom], :prenom => params[:elefe][:prenom])\n @fiche_exist = @All_Eleves.find_by(:nom => params[:elefe][:nom], :prenom => params[:elefe][:prenom])\n params[:elefe][:info_ville] = params[:elefe][:info_ville].join(',') if params[:elefe][:info_ville] != nil\n params[:elefe][:prix] = @tarif[params[:elefe][:parentee].to_i] if params[:elefe][:parentee] != nil\n # Fusion de l'élève avec une fiche existante créée à partir des présences (officialisation)\n if !@fiche_exist.date_naissance\n puts \"On update eleve existant\"\n @elefe = @fiche_exist\n cours = @elefe.cours\n if !cours.detect { |b| b.id == cour.id }\n @elefe.cours << cour\n end\n u.eleves << @elefe\n u.commandes << Commande.create(description: 'Affiliation '+params[:elefe][:nom]+' '+params[:elefe][:prenom], montant: params[:elefe][:prix])\n @elefe.commandes << u.commandes.last\n respond_to do |format|\n if @elefe.update(elefe_params)\n format.html { redirect_to @elefe, notice: 'La fiche élève a bien été modifiée.' }\n format.json { render :show, status: :ok, location: @elefe }\n else\n format.html { render :edit }\n format.json { render json: @elefe.errors, status: :unprocessable_entity }\n end\n end\n else\n # Ne peut pas écraser une fiche existante\n redirect_back(fallback_location: :back, alert: 'Il existe déjà un élève inscrit avec le même nom et prénom. Peut-être pourriez-vous entrer un deuxième prénom pour vous différencier ?')\n end\n # CAS CLASSIQUE DE L'INSCRIPTION\n else\n params[:elefe][:info_ville] = params[:elefe][:info_ville].join(',') if params[:elefe][:info_ville] != nil\n params[:elefe][:prix] = @tarif[params[:elefe][:parentee].to_i] if params[:elefe][:parentee] != nil\n @elefe = Elefe.new(elefe_params)\n @elefe.cours << cour\n u.eleves << @elefe\n u.commandes << Commande.create(description: 'Affiliation '+params[:elefe][:nom]+' '+params[:elefe][:prenom], montant: params[:elefe][:prix])\n @elefe.commandes << u.commandes.last\n respond_to do |format|\n if @elefe.save\n format.html { redirect_to @elefe, notice: 'La fiche élève a bien été créée.' }\n format.json { render :show, status: :created, location: @elefe }\n else\n format.html { render :new }\n format.json { render json: @elefe.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n #parametros_autocomplete!(params[:estudiante][:persona])\n @estudiante = Estudiante.find(params[:id])\n \n begin\n @estudiante.persona_id = params[:persona][:id]\n rescue\n end\n\n respond_to do |format|\n if @estudiante.update_attributes(params[:estudiante])\n format.html { redirect_to @estudiante, notice: 'Estudiante actualizado' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estudiante.errors, status: :unprocessable_entity }\n end\n end\n end", "def sell_restaurant(restaurant, buyer)\n if restaurant_owner.include?(restaurant)\n #Then can sell to buyer / new restaurant owner \n Restaurant_owner.new(name, age)\n else #if current user does not own restaurant\n buyer_to_update = self.restaurant_owner.find { |buyer| buyer.restaurant == restaraunt_owner}\n buyer_to_update = restaraunt_owner\n end \n end", "def create\n @restaurant = Restaurant.new(restaurant_params)\n if @restaurant.save\n @restaurants = Restaurant.find(params[:id])\n else\n render 'create_error'\n end\n end", "def rescatar\n self.estado_id = 1 #salida si lo creo, entrada/foliado si lo redirijo\n self.estado_id = 3 if self.trazas.count(:conditions => 'movimiento_id in (2,7,8)') > 0\n if self.origen.externo\n RAILS_DEFAULT_LOGGER.info \"devolviendo de origen externo #{self.origen.to_label} a #{self.documento.buzon}\"\n self.buzon_id = self.documento.buzon_id\n else\n self.buzon_id = self.origen_id\n end\n self.add_traza(current_user.id, 14, current_user.puesto.buzon_id)\n self.save!\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:yelp_id])\n end", "def update\n if @restaurant.update(restaurant_params)\n @restaurants = Restaurant.all\n else\n render 'update_error'\n end\n end", "def update\n #Update my restaurant\n @restaurant = Restaurant.find(params[:id])\n @restaurant.update(restaurant_params)\n redirect_to restaurants_path\n end", "def set_order_restaurant\n @order_restaurant = OrderRestaurant.find(params[:id])\n end", "def find\n @restaurant = Restaurant.find(params[:id])\n end", "def find\n @restaurant = Restaurant.find(params[:id])\n end", "def RepetecionUsuarioUpdate(lista_usuario, nombre_usuario, apellidos_usuario ,id_usuario)\n val = true\n lista_usuario.each do |usuario|\n if usuario.nombre_usuario == nombre_usuario.upcase && usuario.apellidos_usuario == apellidos_usuario.upcase && usuario.id.to_i != id_usuario.to_i\n val = false\n break\n end\n end\n return val\n end", "def checkIdEscuelaForDirector\n if !self[:id_permission].nil? && self.user_permission.name == \"Director\"\n if !self[:escuela_id].nil?\n if !Escuela.exists?(id: self[:escuela_id])\n self.errors[:carrera_id] = \"La escuela seleccionada no se encuentra en el sistema.\"\n end\n else\n # El director creado no tiene una carrera asignada.\n self.errors[:escuela_id] = \"Debe seleccionar una escuela para el usuario director.\"\n end\n end\n end", "def create\n\n @var=params[:despachar]\n if !(params[:enviar].nil?)\n\n @ordenes=params[:enviar]\n @ordenes.each do |orden|\n if orden[1] != \"no\"\n @orden = Orden.find(orden[1])\n @orden.empleado_id = @var[\"recolector\"]\n @orden.estado = \"Asignada para Recoleccion\"\n NUESTRO_LOG.info \"Se despacho la orden correctamente\"\n @orden.save\n end\n end\n end\n @ordenprincipal = Orden.find(@var[\"orden\"])\n @ordenprincipal.estado = \"Asignada para Recoleccion\"\n @ordenprincipal.empleado_id = @var[\"recolector\"]\n @ordenprincipal.save\n redirect_to(despachador_path, :notice => t('rutarecolecciones'))\n\n end", "def update\n @fornecedor = Fornecedor.find(params[:id])\n \n if @fornecedor.update_attributes(params[:fornecedor])\n redirect_to fornecedores_path, notice: 'Fornecedor alterado com sucesso.' \n else\n render action: \"edit\" \n end\n end", "def update\n @fornecedor = Fornecedor.find(params[:id])\n \n if @fornecedor.update_attributes(params[:fornecedor])\n redirect_to fornecedores_path, notice: 'Fornecedor alterado com sucesso.'\n else\n render action: \"edit\" \n end \n end", "def update\n # Cambio de estado desde panel de usuario con rol de operations\n if params[:status]\n respond_to do |format|\n @restaurant.status = params[:status]\n @restaurant.save\n return redirect_to operations_restaurants_path\n end\n end\n\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to @restaurant, notice: 'Restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant }\n else\n format.html { render :edit }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n\tc = Endereco.find(:first, :conditions => [\"cliente_id=? and id=?\", session[:usuario_id], params[:id]])\n if c.nil?\n\t\tflash[:notice]=\"O acesso a esta url não é permitido.\"\n\t\tredirect_to \"/\"\n\telse\n\t\t@endereco = Endereco.find(params[:id])\n\t\tredirect_to \"/dados\"\n\tend\n\t\n \n end", "def update\n @restaurant = Restaurant.find(params[:id])\n respond_to do |format|\n if @restaurant.update(restaurant_params)\n format.html { redirect_to user_restaurant_url(current_user), notice: 'Restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant }\n else\n format.html { render :edit }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @restaurant=Restaurant.find params[:id]\n \tif @restaurant.update_attributes restaurant_params\n \t\tredirect_to @restaurant\n \telse\n redirect_to :back , notice: \"Make sure you have entered valid information\"\n \tend\n end", "def addRestaurant(restaurant)\n @restaurants << restaurant\n end", "def exec!(city, restaurant, link, *description)\n raise t(:you_are_not_an_admin) unless admin?\n\n city = City.find_by_name city\n res = city.restaurants.create!(name: restaurant, description: description.join(' '), dp_link: link)\n respond_with :message, text: res.inspect\n end", "def show\n\t\t@restaurant = Restaurant.find(params[:id])\n\tend", "def deny\n self.granted = -1\n restaurant = Restaurant.find(self.restaurant_id)\n restaurant.mark_collaborative\n end", "def favorite\n if current_user\n info = params[:recipe_id]\n @found = Favorite.find_by(recipe_id: info, user_id: current_user.id)\n if !@found\n @favorite = Favorite.new\n @favorite.recipe_id = info\n @favorite.user_id = current_user.id\n @favorite.save!\n head :ok\n end\n else\n redirect_to '/'\n end\n end" ]
[ "0.65328443", "0.6518577", "0.65048647", "0.6492974", "0.6468509", "0.6445383", "0.6430796", "0.64213914", "0.63960665", "0.63824886", "0.62744445", "0.62045354", "0.61802244", "0.6167812", "0.6159476", "0.6129182", "0.6104444", "0.6104444", "0.6104352", "0.609757", "0.6069907", "0.60602915", "0.604702", "0.6029512", "0.6029512", "0.6029512", "0.6029512", "0.6029512", "0.6029512", "0.6029512", "0.6029512", "0.6029512", "0.6029512", "0.6029512", "0.6029512", "0.6029512", "0.6029512", "0.6025919", "0.6025551", "0.6022532", "0.6017585", "0.59954375", "0.59715796", "0.59691525", "0.5958736", "0.5958736", "0.5958736", "0.5958736", "0.5958736", "0.59435606", "0.5914872", "0.59134895", "0.5903164", "0.5894966", "0.5894966", "0.5894966", "0.5894418", "0.5890972", "0.5886104", "0.58793485", "0.5818167", "0.5817157", "0.5811231", "0.57751596", "0.577319", "0.5767791", "0.5761571", "0.57513416", "0.5736744", "0.57276607", "0.5716406", "0.5711185", "0.5707957", "0.57003677", "0.5690501", "0.5687943", "0.5683148", "0.5670824", "0.56673604", "0.5663558", "0.5649844", "0.56473047", "0.5647131", "0.5646365", "0.5639126", "0.5603677", "0.56023204", "0.5600891", "0.55773586", "0.557735", "0.5565304", "0.5561998", "0.55586636", "0.5558051", "0.55422604", "0.5535717", "0.5529151", "0.55289763" ]
0.64130443
10
should return false =begin On line 5, the ternary operator evaluates the expression `odd_count = 3` before the `?`. In this expression, the local variable is reassigned to the Integer object with value `3`, which returns the value of odd_count, i.e. `3`. `3` is a truthy value, so it will always evaluate to true. Hence the whole line will always return `true`. Instead, we should use `odd_count == 3` as the expression to be evaluated. == checks whether the local variable `odd_count`'s value is `3`; if yes, it returns `true`, else it returns `false`'. In fact, we would not need to use the ternary operator at all; we can simply write the last statement as `odd_count == 3` =end
def valid_series?(nums) return false if nums.sum != 47 odd_count = nums.count { |n| n.odd? } odd_count == 3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oddness(count)\n count.odd? ? \"odd\" : \"even\"\n end", "def is_odd(x)\n x % 2 == 0 ? false : true\nend", "def is_odd(num)\n output = false\n if num % 2 != 0\n output = true\n end\n return output\nend", "def is_odd?(integer)\n integer % 2 == 0 ? false : true\nend", "def is_odd?(number)\n puts \"Is number #{number} an odd number?:\"\n number % 2 == 0 ? false : true\n\nend", "def even_odd(num)\n if num % 2 == 0\n \"#{num} is even\"\n else num % 2 != 0\n \"#{num} is odd\"\n # create a conditional statement that if num % 2 = 0 it will return the number as even. Use a bang operator in the else statement for odd numbers.\n end\nend", "def is_odd(number)\n output = false\n if (number % 2) != 0\n output = true\n end\n return output\nend", "def is_odd?(int) \n if int % 2 == 0\n return false\n else return true\n end\nend", "def is_odd(n)\n n % 1 == 0 && n.to_i.odd?\nend", "def is_odd(number)\n return true if number % 2 != 0\n return false if number % 2 == 0\nend", "def is_odd(number)\n if number%2 > 0\n return true\n end\n return false\nend", "def is_odd(num)\n if num % 2 == 0\n return false\n else\n return true\n end\nend", "def is_odd?(number)\n number % 2 == 1 # returned due to being last line in method + returns boolean due to operator\nend", "def is_odd(number)\n if number % 2== 1\n return true\n else \n return false\n end \nend", "def is_odd?(n)\n n % 2 == 1\nend", "def is_odd(tal)\n if tal % 2 != 0\n return true\n else\n return false\n end\nend", "def is_odd(num)\n return true if num % 2 != 0\n return false\nend", "def odd?(number)\n if number % 2 == 0\n false\n else \n true\n end\nend", "def is_odd(number)\n if number % 2 == 0\n return false\n end\n return true\nend", "def is_odd?(num)\n num % 2 != 0\nend", "def is_odd?(num)\n num % 2 != 0\nend", "def odd?\n odd\n end", "def oddCount n \r\n if (n % 2 == 0)\r\n return n / 2\r\n end\r\n return (n - 1) / 2\r\n end", "def is_odd?(number)\n number % 2 != 0\nend", "def is_odd(number)\n\tif(number%2 != 0)\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def is_odd(num)\n return ((num % 2) != 0)\nend", "def odd_integer(n)\n if n % 2 == 0 || n == 0\n return false\n else \n return true\n end\nend", "def is_odd3?(int)\n if int.remainder(2) == 0\n return false\n else\n return true\n end\nend", "def is_odd(x)\n # Use the logical results provided to you by Ruby already..\n x % 2 != 0\nend", "def is_odd?(int)\n int % 2 == 1\nend", "def is_odd?(num)\r\n num % 2 == 1\r\nend", "def is_odd?(num)\n return num.abs % 2 == 1 ? true : false\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd? number\n number % 2 == 1\nend", "def is_even(num3)\n if num3 %2 == 0 \n p \"#{num3} is true\"\n elsif num3 % 2 != 0 \n p \"#{num3} is false\"\n end\nend", "def is_odd?(number)\n number % 2 == 1\nend", "def is_odd?(number)\n\n\t#WHY WASN\"T MODULO WORKING?\n\t# if (number%2) != 0\n\t# \tputs \"true\"\n\t# \treturn true\n\tnumber = number.to_i\n\tif number.odd?\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def is_odd?(integer)\n integer % 2 != 0\nend", "def odd?\n return !even?\n end", "def odd_or_even_test(number)\n\n is_even = (number % 2 == 0)\n\n if is_even\n result = \"even\"\n else\n result = \"odd\"\n end\n\n puts \"#{number} is an #{result} number.\"\n\nend", "def is_odd(num)\n return num % 2 == 1\nend", "def odds\n return 1\n end", "def is_odd?(integer)\n integer % 2 == 1\nend", "def is_odd?(integer)\n integer % 2 == 1\nend", "def is_odd?(integer)\n integer % 2 == 1\nend", "def odd?\n !even?\n end", "def is_odd?(number)\n number.to_i.odd?\nend", "def is_odd?(num)\n num.abs.to_i % 2 != 0 && num.to_i == num\nend", "def test_odd?\n assert_equal(false, @main.odd?(0))\n assert_equal(true, @main.odd?(1))\n assert_equal(false, @main.odd?(2))\n assert_equal(true, @main.odd?(-1)) \n assert_equal(false, @main.odd?(-2))\n end", "def odd_or_even(number)\n number.odd? ? \"The number is odd\" : \"The number is even\"\nend", "def is_odd?(num)\n num.odd?\nend", "def is_odd?(num)\n num.odd?\nend", "def oddity(n)\n divisors = []\n (1..n).each do |num|\n divisors << num if n % num == 0\n end\n\n divisors.count.even? ? 'even' : 'odd'\nend", "def is_odd?(number)\n number.abs % 2 != 0 && number != 0\nend", "def odd_or_even(num)\n if num % 2 === 0\n return \"#{num} is even.\"\n else\n return \"#{num} is odd.\"\n end\nend", "def is_odd?(int)\n int.odd?\nend", "def even_or_odd(number)\n number % 2 == 0 ? (puts \"even\") : (puts \"odd\")\n end", "def is_odd?(num)\n # return false if num.zero?\n # num *= -1 if num < 0\n !(num % 2).zero?\n # !(num.remainder(2).zero?)\nend", "def is_odd?(n)\n n.abs % 2 != 0\nend", "def is_odd2?(int) \n if int < 0\n int = int * -1\n end\n int % 2 == 1\nend", "def odd(int)\n int % 2 == 1\nend", "def is_odd?(int)\n (int % 2).abs != 0\nend", "def is_also_odd?(param_integer)\n param_integer % 2 > 0\nend", "def odd (numb)\n return true if numb % 2 == 1\n return false\nend", "def is_even(n)\n !n.odd?\nend", "def is_even_or_odd(num)\n\treturn num.odd? ? 'odd' : 'even'\nend", "def is_odd?(input)\n\n if input % 2 == 1\n true\n else\n false\n end\n\nend", "def odd?\n\t\treturn @iterating && ( @iteration % 2 ).nonzero?\n\tend", "def is_odd?(num)\n # num.abs % 2 != 0 \n num % 2 == 1\n # ruby modulus operator always return non-negative result if num on right is positive\n # ie, % is a modulus operator and \"not a remainder operator as in some languages\"\n # my first line was correct, but more properly per the proposed problem\n # check if odd, do not check if not even\nend", "def odd_number?(number)\n number % 2 == 1\nend", "def odd_or_even(array)\n sum = 0\n array.each { |x| sum += x}\n if sum.even? == true\n p \"even\"\n else\n p \"odd\"\n end\nend", "def is_odd?(num)\n if num == 0 ||num.remainder(2) == 0\n false\n else\n true\n end\nend", "def three_even?(list)\n count = 0\n (list.size-2).times do |i| \n if(list[i]%2 == 0 && list[i+1]%2 == 0 && list[i+2]%2 == 0) #I checked three values at once to minimize the errors that could occur when using a method that checks one value at a time \n return true\n end\n end\n return false\nend", "def even_or_odd num\n if num%2 == 0\n \"#{num} is even\"\n else\n \"#{num} is odd\"\n end\nend", "def is_odd?(number)\n number.abs % 2 != 0\nend", "def is_odd?(number)\n number.abs % 2 != 0\nend", "def even_or_odd(number)\n number.even? ? 'That number is even ' : 'That number is odd'\nend", "def odd_or_even(number)\n if number.odd?\n \"That number is odd\"\n else\n \"That number is even\"\n end\nend", "def even_or_odd (num)\n if num.even? == true\n \"#{num} is even.\"\n else\n \"#{num} is odd.\"\n end \nend", "def oddball(arr)\n oddcount = evencount = 0\n arr.each do |num|\n if num % 2 == 0\n evencount +=1\n else\n oddcount +=1\n end\n if oddcount > 1 || evencount > 1\n break\n end\n end\n if oddcount > 1\n arr.each do |num| return num if num % 2 == 0 end\n elsif evencount > 1\n arr.each do |num| return num if num % 2 != 0 end\n end\nend", "def is_odd?(num)\n num.abs % 2 != 0\nend", "def is_odd?(num)\n num.remainder(2) == 1 || num.remainder(2) == -1\nend", "def odd_or_even(number)\n if number.odd?\n 'That number is odd'\n else\n 'that number is even'\n end\nend", "def still_odd?(num)\n num.remainder(2).abs == 1\nend", "def odd_or_even(number)\n if number.odd?\n \"odd\"\n else\n \"even\"\n end\nend", "def odd_or_even(number)\n if number.odd?\n \"That number is odd\"\n else\n \"Even\"\n end\nend", "def is_odd?(input)\n input % 2 != 0 # => true\nend", "def is_even(number)\n output = false\n if number % 2 ==0\n output = true\n end\nreturn output\nend", "def is_even?(n)\n\ttrue if n%2==0 else false\nend", "def is_even(num)\n if num % 2 == 0\n return num\n else\n return 0\n end\nend", "def is_odd?(num)\n num = num * -1 if num < 0 # get absolute value\n num.remainder(2) == 1 ? true: false\nend", "def is_odd?(int)\n int.abs % 2 == 1\nend", "def is_odd?(integer)\n\tinteger.abs % 2 == 1\n\t\nend", "def odd_or_even (number)\n if number % 2 == 0\n \"even\"\n elsif number % 2 == 1\n \"odd\"\n end\nend", "def is_odd?(number)\n number.remainder(2).abs > 0\nend", "def even_or_odd(number)\n number.even? ? \"Even\" : \"Odd\"\nend", "def is_odd?(num)\n num.remainder(2) != 0\nend" ]
[ "0.6825144", "0.6625457", "0.66202635", "0.66182435", "0.6593667", "0.65611786", "0.6557442", "0.6553553", "0.65033406", "0.64959615", "0.64919823", "0.6491229", "0.64878553", "0.64565444", "0.64199686", "0.6405991", "0.63954484", "0.6395214", "0.639399", "0.6362889", "0.6362889", "0.63594264", "0.63500625", "0.6339247", "0.63341886", "0.6331504", "0.63211447", "0.6315438", "0.6309418", "0.63054997", "0.6305483", "0.62998813", "0.62943214", "0.62943214", "0.62943214", "0.62943214", "0.62943214", "0.62938625", "0.62916666", "0.6289706", "0.628789", "0.628751", "0.6284228", "0.62813896", "0.62628376", "0.6260631", "0.62522274", "0.62522274", "0.62522274", "0.624029", "0.6238385", "0.6227406", "0.62192607", "0.6218831", "0.6200355", "0.6200355", "0.6180365", "0.6175962", "0.61749357", "0.6165522", "0.6160229", "0.6145641", "0.614211", "0.61362123", "0.613493", "0.6125698", "0.6124621", "0.6110429", "0.61099404", "0.610867", "0.6097116", "0.6095797", "0.6094122", "0.60829383", "0.6073538", "0.6073235", "0.6071052", "0.60509276", "0.6041564", "0.6041564", "0.60320765", "0.60290194", "0.6027123", "0.60264486", "0.60216683", "0.60198003", "0.6010598", "0.5990072", "0.59875214", "0.5983605", "0.59797275", "0.59796476", "0.59794515", "0.59755015", "0.5974326", "0.5974254", "0.5971575", "0.59646094", "0.5926499", "0.59245646", "0.5920498" ]
0.0
-1
Create an endpoint processor
def create_request_processor(swagger_endpoint) request_processor = Sinatra::SwaggerExposer::Processing::SwaggerRequestProcessor.new(swagger_endpoint.produces) swagger_endpoint.parameters.each do |parameter| if TYPE_FILE == parameter.type dispatcher = Sinatra::SwaggerExposer::Processing::SwaggerFileProcessorDispatcher.new( parameter.name, parameter.required ) else processor = create_parameter_value_processor(parameter) dispatcher = Sinatra::SwaggerExposer::Processing::SwaggerProcessorDispatcher.new( parameter.how_to_pass, processor ) end if dispatcher.useful? request_processor.add_dispatcher(dispatcher) end end swagger_endpoint.responses.each_pair do |code, endpoint_response| response_value_processor = create_response_value_processor(endpoint_response) response_processor = Sinatra::SwaggerExposer::Processing::SwaggerResponseProcessor.new( endpoint_response, response_value_processor ) request_processor.add_response_processor( code, response_processor.useful? ? response_processor : nil ) end request_processor end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_endpoint_processor(swagger_endpoint)\n request_preprocessor = Sinatra::SwaggerExposer::Processing::SwaggerRequestPreprocessor.new\n swagger_endpoint.parameters.each do |parameter|\n preprocessor = create_value_preprocessor(parameter)\n dispatcher = Sinatra::SwaggerExposer::Processing::SwaggerPreprocessorDispatcher.new(parameter.how_to_pass, preprocessor)\n if dispatcher.useful?\n request_preprocessor.add_dispatcher(dispatcher)\n end\n end\n request_preprocessor\n end", "def endpoint=(_arg0); end", "def _build_and_attach_node(endpoint_class, method_name=nil)\n # Create the new endpoint\n endpoint_instance = endpoint_class.new(@requester, method_name, self)\n # Attach the endpoint as an instance variable and method\n method_name ||= endpoint_class.name.demodulize.underscore\n self.instance_variable_set(\"@#{method_name}\", endpoint_instance)\n self.define_singleton_method(method_name.to_s) { endpoint_instance }\n endpoint_instance\n end", "def endpoint(name, &block)\n error = if @endpoints.find { |e| e.name == name }\n \"Endpoint :#{name} is declared twice.\"\n elsif !block_given?\n 'You must pass a block when calling `endpoint`.'\n end\n raise error unless error.nil?\n endpoint = Endpoint.new name\n @endpoints << endpoint\n endpoint.instance_eval(&block)\n end", "def register_endpoint(endpoint, app, opts={})\n raise TypeError unless app.respond_to?(:call)\n opts = {:exclusive=>true, :prefetch=>1}.merge(opts)\n\n # create receive queue for new RPC endpoint.\n endpoint_proc = proc { |header, data|\n\n data = Serializer.instance.unmarshal(data)\n\n resctx = if data[:oneshot]\n OneshotResponseContext.new(@endpoints[endpoint][:ch].response_exchange, header)\n else\n ResponseContext.new(@endpoints[endpoint][:ch].response_exchange, header)\n end\n begin\n req = Rack::Request.new({:sender=>header.reply_to['command-recv.'.size..-1],\n :message_id=>header.message_id\n }.merge(data))\n res = Rack::Response.new(resctx)\n ret = app.call(req, res)\n rescue ::Exception => e\n logger.error(e)\n resctx.response(e) unless resctx.responded?\n end\n }\n\n\n EventMachine.schedule {\n ch = node.create_channel\n\n ch.instance_eval %Q{\n def endpoint_queue\n self.queue(\"isono.rpc.endpoint.#{endpoint}\", {:exclusive=>false, :auto_delete=>true})\n end\n\n def response_exchange\n self.default_exchange\n end\n }\n ch.prefetch(opts[:prefetch].to_i) if opts[:prefetch].to_i > 0\n # stores hash here that is for thread safety.\n if !@endpoints.nil?\n @endpoints[endpoint]={:app=>app, :opts=>opts, :ch=>ch}\n\n ch.endpoint_queue.subscribe(:ack=>true, &endpoint_proc)\n event.publish('rpc/register', :args=>[endpoint])\n else\n logger.error(\"No such endpoints\")\n end\n }\n end", "def register_endpoint(endpoint)\n endpoints << endpoint\n register_method(endpoint)\n end", "def endpoint(endpoint)\n @endpoint = endpoint\n self\n end", "def create_resource_endpoint(endpoint_class, resource_id)\n endpoint_class.new(@requester, resource_id, self)\n end", "def processor\n @processor ||= Processor.new(options)\n end", "def create_operations_processor\n JSONAPI::ActiveRecordOperationsProcessor.new\n end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def initialize base_url, endpoint, params={}, &blk\n @url = base_url.dup\n @url.add_to_path endpoint.to_s\n @url.params.merge!(params)\n @_endpoint = Endpoint.new(@url)\n \n instance_eval &blk if block_given?\n end", "def generate_endpoint_response(request, endpoint_base, method_name)\n if request[:data].empty?\n empty_body_endpoint\n elsif endpoint_base.nil?\n main_endpoint\n elsif respond_to? method_name\n method(method_name).call request\n elsif request[:op].nil?\n not_found_endpoint\n else not_found_endpoint\n end\n end", "def dispatcher\n endpoint_dispatch(params[:address])\n end", "def ipn_endpoint=(_arg0); end", "def get_processor; end", "def method_missing(method, *params, &block)\n @endpoint_parts << method.to_s\n\n @endpoint_parts << params\n @endpoint_parts = @endpoint_parts.flatten!\n\n block&.call\n\n self || super\n end", "def endpoint\n raise NotImplementedError\n end", "def setup(endpoint, format = \"json\")\n case endpoint\n when :path_info\n @service_path = \"/ping/?format=#{format}\"\n when :path_data\n @service_path = \"/whoami/?format=#{format}\"\n when :session\n @service_path = \"/session/?format=#{format}\"\n when :ping\n @service_path = \"/ping/?format=#{format}\"\n when :whoami\n @service_path = \"/whoami/?format=#{format}\"\n when :session\n @service_path = \"/session/?format=#{format}\" \n end\n end", "def define_endpoints(&block)\n @grape_transformations_endpoints = block.to_proc\n end", "def add_endpoint(type, entity, init_x, init_y)\n ep = Endpoint.new\n ep.type = type\n ep.entity_parent = entity\n entity.endpoints << ep\n\n ep.set_bounds init_x, init_y, ENDPOINT_WIDTH, ENDPOINT_HEIGHT\n\n ep.reset_direction\n ep.reset_position\n\n @panel.add ep\n @cm.register_component ep\n\n ep.add_component_listener @move_action\n ep.add_mouse_listener @endpoint_mouse_action\n ep.add_mouse_listener @select_action\n\n @panel.repaint\n\n return ep\n end", "def endpoint(name=:default, &block)\n raise DuplicateEndpointNameError.new(name: name) if @endpoints[name]\n @default_endpoint_name ||= name\n @endpoints[name] = Endpoint.new(name,&block)\n end", "def add_endpoints_with(options = {})\n return unless @grape_transformations_endpoints.is_a? Proc\n entity = options[:entity] || entity_for_transformation(:default)\n @grape_transformations_endpoints.call(entity)\n end", "def initialize(&blk)\n @parameters = {}\n @endpoint = Endpoint.const_get(class_basename).new\n\n configure &blk if block_given?\n end", "def service_endpoint; end", "def service_endpoint; end", "def endpoint\n @endpoint ||= begin\n if self.endpoint_type && self.endpoint_id\n self.endpoint_type.constantize.find_by_id(self.endpoint_id)\n elsif self.route && self.route.mode == 'Endpoint'\n self.route.endpoint\n end\n end\n end", "def endpoint\n @endpoint ||= begin\n if self.endpoint_type && self.endpoint_id\n self.endpoint_type.constantize.find_by_id(self.endpoint_id)\n elsif self.route && self.route.mode == 'Endpoint'\n self.route.endpoint\n end\n end\n end", "def create_endpoint request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_endpoint_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::ServiceDirectory::V1beta1::Endpoint.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def use(processor)\n definition << processor\n processor\n end", "def get_endpoint()\n end", "def register(endpoint_id, verb, path)\n endpoint = Endpoint.new(\n service_id: id,\n service_uri: uri,\n endpoint_id: endpoint_id,\n verb: verb,\n path: path,\n )\n EndpointRegistry.instance.register(endpoint)\n end", "def processor; end", "def build_direct_endpoint\n app = Class.new(App)\n app.opts[:shrine_class] = self\n app.app\n end", "def build_direct_endpoint\n app = Class.new(App)\n app.opts[:shrine_class] = self\n app.app\n end", "def endpoints; end", "def ipn_endpoint; end", "def ipn_endpoint; end", "def create_response_value_processor(endpoint_response)\n response_type = endpoint_response.type\n if response_type == TYPE_ARRAY\n processor_for_values = create_processor_for_type('Response', endpoint_response.items, false)\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new('Response', true, processor_for_values)\n elsif response_type == TYPE_FILE\n # Don't validate the files' content\n nil\n elsif response_type\n create_processor_for_type('Response', response_type, false)\n else\n nil\n end\n end", "def << route\n raise \"Argument must be an Endpoint\" unless Endpoint === route\n _base, *subroute = route[:_path].split '/' # Split out first element\n if subroute.count == 0\n route[:_path] = \"\"\n @endpoints << route\n else\n route[:_path] = subroute.join '/'\n self[subroute[0]] << route\n end\n end", "def add_endpoints\n # transformable endpoints\n Grape::Transformations.transformations_for(@grape_transformations_target_class).each do |transformation|\n entity = entity_for_transformation transformation\n namespace transformation do\n add_endpoints_with entity: entity\n end\n end\n # normal api\n add_endpoints_with entity: entity_for_transformation(:default) if Grape::Transformations.simbolized_entities_for(@grape_transformations_target_class).include? :default\n add_non_transformable_endpoints\n end", "def method_missing *args, &blk\n if m = caller.first.match(/^(#{__FILE__}:\\d+):in `method_missing'$/) # protect against a typo within this function creating a stack overflow\n raise \"Method missing calling itself with #{args.first} in #{m[1]}\"\n end\n is_built_in = false\n # If you define a method named get,post,create,etc don't require the method type\n if Endpoint::BUILT_IN_METHODS.include?(args.first) && !Endpoint::BUILT_IN_METHODS.include?(args[1])\n name = args.shift\n\n if Endpoint::BUILT_IN_MAP.has_key?(name.to_sym)\n method = name.to_sym\n is_built_in = true\n else\n method = Endpoint::BULT_IN_MAP.find do |meth,aliases|\n aliases.include?(name)\n end\n\n method = method[0] if method\n end\n else\n name = args.shift\n method = args.shift if args.first.is_a?(Symbol)\n end\n name = name.to_sym\n\n method ||= :get\n \n options = args.shift||{}\n options[:requires] ||= []\n options[:requires] = [options[:requires]] unless options[:requires].is_a?(Array)\n options[:into] ||= blk if block_given?\n @_endpoint.method_inflate_into[name] = options[:into]\n\n @_endpoint.class_eval <<-RUBY, __FILE__, __LINE__\n def #{name} force_params={}, args={}\n params = #{(options[:default]||{}).inspect}.merge(force_params)\n #{(options[:requires]||[]).inspect}.each do |req|\n raise RequiredParameter, \"#{name} endpoint requires the \"<<req<<\" paramerter\" unless params.include?(req.to_sym) || params.include?(req.to_s)\n end\n\n if #{is_built_in.inspect}\n super(params,args)\n else\n transform_response(#{method}(params,args),method_inflate_into[#{name.inspect}])\n end\n end\n RUBY\n end", "def set_endpoint\n @endpoint = Endpoint.where(name: params[:request_name])\n .where(client_tag: params[:client_tag]).first\n end", "def apply_endpoint(obj, k, v)\n α = -> { endpoint(get(v).body) }\n β = -> { v }\n λ = url?(v) ? -> { α.call } : -> { β.call }\n obj.define_singleton_method(k, &λ) if url?(v)\n obj\n end", "def set_endpoint\n @endpoint = Endpoint.find(params[:id])\n end", "def set_endpoint\n @endpoint = Endpoint.find(params[:id])\n end", "def platform_endpoint=(_arg0); end", "def configure(&blk)\n yield @endpoint\n end", "def operation_for!(operation_class, options, &block)\n params = options[:params] || self.params # TODO: test params: parameter properly in all 4 methods.\n params = params!(params)\n process_params!(params) # deprecate or rename to #setup_params!\n\n res, op = Trailblazer::Endpoint.new(operation_class, params, request, options).(&block)\n setup_operation_instance_variables!(op, options)\n\n [res, op, options.merge(params: params)]\n end", "def endpoint\n @endpoint ||= subclass(:Endpoint).new @locale\n end", "def set_endpoint\n @endpoint = Endpoint.find params[:id]\n end", "def create\n respond_to do |format|\n @endpoint = current_user.endpoints.build(endpoint_params)\n\n # auto-trigger refresh\n @endpoint.last_refresh_request_at = Time.now\n\n if @endpoint.save\n RefreshEndpointWorker.perform_async RefreshSubmission.new(@endpoint.id)\n\n format.html { redirect_to root_url, notice: 'Endpoint was successfully created.' }\n format.json { head :created }\n else\n format.html { head :unprocessable_entity }\n format.json { render json: @endpoint.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n processor = Mailgun::WebHook::Processor.new(mailgun_params, self)\n processor.on_unhandled_mailgun_events = self.class.on_unhandled_mailgun_events!\n processor.run!\n block_given? ? yield : head(:ok)\n end", "def register_functions!(endpoint)\n unless endpoint.present? && (endpoint.starts_with?(\"http://\") || endpoint.starts_with?(\"https://\"))\n raise ArgumentError, \"The HOOKS_URL must be http/s: '#{endpoint}''\"\n end\n endpoint += \"/\" unless endpoint.ends_with?(\"/\")\n functionsMap = {}\n client.functions.results.each do |f|\n next unless f[\"url\"].present?\n functionsMap[f[\"functionName\"]] = f[\"url\"]\n end\n\n routes.function.keys.sort.each do |functionName|\n url = endpoint + functionName\n if functionsMap[functionName].present? #you may need to update\n next if functionsMap[functionName] == url\n client.update_function(functionName, url)\n else\n client.create_function(functionName, url)\n end\n yield(functionName) if block_given?\n end\n end", "def bootstrap_method method\n return proc do\n (class << self; self ; end).send :define_method, method do |*args|\n endpoints = [Vindicia.endpoint]\n\n if Vindicia.environment == 'production'\n endpoints << Vindicia.endpoint('fallback')\n end\n\n endpoints.each do |endpoint|\n response = self.soap_call(method, args.first, endpoint)\n\n if response.nil?\n next\n elsif response.http_error?\n next\n else\n return Vindicia.parse_response(response, method)\n end\n end\n end\n end\n end", "def endpoint(value = nil)\n if value\n @endpoint = value\n else\n @endpoint\n end\n end", "def process(context)\n request = context.request\n\n router = @processor_map[request.request_method.downcase.to_sym]\n return 404 unless router\n begin\n processor, params = router.routing(request.path)\n rescue FancyServer::PathRouter::NoRouteMatched\n return 404\n rescue FancyServer::PathRouter::DestinationDuplicated => ex\n return {:status => 503, :body => ex.message}\n end\n return 404 unless processor\n context.params.merge!(params)\n processor.respond_to?(:to_proc) ? context.instance_eval(&processor) : processor\n end", "def processor=(_arg0); end", "def define_endpoint\n endpoint_klass.instance_exec(\n opts.merge(this_resource: this_resource)\n ) do |opts|\n get \"/:id/#{opts[:relation]}\",\n { authorize: opts[:authorize] }.compact do\n\n status 200\n return opts[:block].call if opts.key?(:block)\n\n data = \"Kagu::Models::#{opts[:this_resource].camelize}\"\n .constantize\n .accessible_by(current_ability)\n .find(declared_params[:id])\n .send(opts[:relation])\n .unscoped\n\n present(data, with: Entities::Collection)\n end\n end\n end", "def custom_setup(args)\n if(args[:api_endpoint].to_s.end_with?('/'))\n args[:api_endpoint] = args[:api_endpoint][0, endpoint.length - 1]\n end\n end", "def add_endpoint(region, service_id, publicurl, adminurl, internalurl)\n data = {\n 'endpoint' => {\n 'region' => region,\n 'service_id' => service_id,\n 'publicurl' => publicurl,\n 'adminurl' => adminurl,\n 'internalurl' => internalurl\n }\n }\n return post_request(address(\"/endpoints\"), data, token())\n end", "def define_endpoint\n endpoint_klass.instance_exec(\n opts.merge(this_resource: this_resource)\n ) do |opts|\n get '/:id', { authorize: opts[:authorize] }.compact do\n status 200\n return opts[:block].call if opts.key?(:block)\n\n data = \"Kagu::Models::#{opts[:this_resource].camelize}\"\n .constantize\n .accessible_by(current_ability)\n .find(declared_params[:id])\n\n present(\n data, with: \"API::Entities::#{opts[:this_resource]}\".constantize\n )\n end\n end\n end", "def create\n feature_enable unless feature_enabled\n X__RESOURCE_NAME__X_router\n end", "def initialize app=nil\n @app = app\n\n self.class.endpoints.values.flatten.each do |endpoint|\n endpoint.action_handler ||= method :default_action\n endpoint.api_doc_handler ||= method :default_api_doc\n endpoint.error_handler ||= method :default_error\n endpoint.validation_error_handler ||= method :default_validation_error\n end\n end", "def set_Endpoint(value)\n set_input(\"Endpoint\", value)\n end", "def set_Endpoint(value)\n set_input(\"Endpoint\", value)\n end", "def set_Endpoint(value)\n set_input(\"Endpoint\", value)\n end", "def set_Endpoint(value)\n set_input(\"Endpoint\", value)\n end", "def set_Endpoint(value)\n set_input(\"Endpoint\", value)\n end", "def rest_endpoint=(_arg0); end", "def compose\n return unless @options[:templates] || @options[:stack_type] != :minimal\n\n add_gateway_rest_api\n add_custom_domain\n add_gateway_routes\n end", "def dcerpc_endpoint_list\n\t\tres = []\n\n\t\tprint_status(\"Connecting to the endpoint mapper service...\")\n\t\tbegin\n\t\t\teps = nil\n\t\t\tdport = nil\n\n\t\t\t[135, 593].each do |i|\n\t\t\t\tdport = i\n\t\t\t\tbegin\n\t\t\t\t\teps = Rex::Socket::Tcp.create(\n\t\t\t\t\t'PeerHost' => rhost,\n\t\t\t\t\t'PeerPort' => dport,\n\t\t\t\t\t'Proxies' => proxies,\n\t\t\t\t\t'Context' =>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'Msf' => framework,\n\t\t\t\t\t\t\t'MsfExploit' => self,\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\n\t\t\t\t\tbreak\n\n\t\t\t\trescue ::Exception\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif (not eps)\n\t\t\t\tprint_status(\"Could not connect to the endpoint mapper service\")\n\t\t\t\treturn nil\n\t\t\tend\n\n\t\t\teph = dcerpc_handle('e1af8308-5d1f-11c9-91a4-08002b14a0fa', '3.0', 'ncacn_ip_tcp', [dport])\n\t\t\topt = { 'Msf' => framework, 'MsfExploit' => self }\n\t\t\tdce = Rex::Proto::DCERPC::Client.new(eph, eps, opt)\n\n\t\t\thnd = nil\n\n\t\t\twhile(true)\n\n\t\t\t\t# Placeholders\n\t\t\t\tinfo =\n\t\t\t\t{\n\t\t\t\t\t:type => nil,\n\t\t\t\t\t:port => nil,\n\t\t\t\t\t:host => nil,\n\t\t\t\t\t:pipe => nil,\n\t\t\t\t\t:prot => nil,\n\t\t\t\t\t:uuid => nil,\n\t\t\t\t\t:vers => nil,\n\t\t\t\t\t:note => nil\n\t\t\t\t}\n\n\t\t\t\tdata = nil\n\n\t\t\t\tif(not hnd)\n\t\t\t\t\t# NULL handle to start with\n\t\t\t\t\tdata = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1].pack(\"V*\")\n\t\t\t\telse\n\t\t\t\t\t# Use the existing handle\n\t\t\t\t\tdata = [0, 0, 0, 0, 0].pack(\"V*\") + hnd\n\t\t\t\tend\n\n\t\t\t\tret = dce.call(2, data)\n\n\t\t\t\tif (\n\t\t\t\t\tdce.last_response == nil or\n\t\t\t\t\tdce.last_response.stub_data == nil or\n\t\t\t\t\tdce.last_response.stub_data.length < 40 or\n\t\t\t\t\tdce.last_response.stub_data[36,4] == \"\\xd6\\xa0\\xc9\\x16\"\n\t\t\t\t)\n\t\t\t\t\t# break from the parsing loop\n\t\t\t\t\tbreak\n\t\t\t\tend\n\n\t\t\t\t# Record the response data\n\t\t\t\tbuf = dce.last_response.stub_data\n\n\t\t\t\t# Record the handle if needed\n\t\t\t\thnd = buf[4, 20] if not hnd\n\n\t\t\t\t# Parse the response data\n\t\t\t\tnlen = buf[60, 4].unpack('V')[0]\n\t\t\t\tif (nlen > 1)\n\t\t\t\t\tinfo[:note] = buf[64, nlen - 1]\n\t\t\t\tend\n\n\t\t\t\t# Align the stub offset\n\t\t\t\tsoff = nlen + 72\n\t\t\t\twhile (soff % 4 != 0)\n\t\t\t\t\tsoff += 1\n\t\t\t\tend\n\n\t\t\t\t# Determine number of records\n\t\t\t\trcnt = buf[soff, 2].unpack('v')[0]\n\t\t\t\tsoff += 2\n\n\t\t\t\t# Parse the data from the stack\n\t\t\t\t1.upto(rcnt) do |i|\n\t\t\t\t\trlen = buf[soff, 2].unpack('v')[0]\n\t\t\t\t\tsoff += 2\n\n\t\t\t\t\tif (i == 1)\n\t\t\t\t\t\tinfo[:uuid] = Rex::Proto::DCERPC::UUID.uuid_unpack(buf[soff+1, 16])\n\t\t\t\t\t\tinfo[:vers] = buf[soff+17,2].unpack('CC').map{|s| s.to_s}.join(\".\")\n\t\t\t\t\tend\n\n\t\t\t\t\tif (i > 3)\n\t\t\t\t\t\tinfo[:type] = buf[soff, 1].unpack(\"C*\")[0]\n\t\t\t\t\tend\n\n\t\t\t\t\tsoff += rlen\n\n\t\t\t\t\txlen = buf[soff, 2].unpack('v')[0]\n\t\t\t\t\tsoff += 2\n\n\t\t\t\t\tcase info[:type]\n\t\t\t\t\twhen nil\n\n\t\t\t\t\t# TCP\n\t\t\t\t\twhen 7\n\t\t\t\t\t\tinfo[:prot] = 'tcp'\n\t\t\t\t\t\tinfo[:port] = buf[soff, 2].unpack('n')[0]\n\n\t\t\t\t\t# UDP\n\t\t\t\t\twhen 8\n\t\t\t\t\t\tinfo[:prot] = 'udp'\n\t\t\t\t\t\tinfo[:port] = buf[soff, 2].unpack('n')[0]\n\n\t\t\t\t\t# ADDR\n\t\t\t\t\twhen 9\n\t\t\t\t\t\tinfo[:host] = buf[soff, 4].unpack('C4').join('.')\n\n\t\t\t\t\t# PIPE\n\t\t\t\t\twhen 15\n\t\t\t\t\t\tinfo[:prot] = 'pipe'\n\t\t\t\t\t\tinfo[:pipe] = buf[soff, xlen].unpack(\"a*\")[0]\n\n\t\t\t\t\t# LRPC\n\t\t\t\t\twhen 16\n\t\t\t\t\t\tinfo[:prot] = 'lrpc'\n\t\t\t\t\t\tinfo[:pipe] = buf[soff, xlen].unpack(\"a*\")[0]\n\n\t\t\t\t\t# NETBIOS\n\t\t\t\t\twhen 17,24\n\t\t\t\t\t\tinfo[:host] = buf[soff, xlen].unpack(\"a*\")[0]\n\n\t\t\t\t\t# HTTP\n\t\t\t\t\twhen 31\n\t\t\t\t\t\tinfo[:prot] = 'http'\n\t\t\t\t\t\tinfo[:port] = buf[soff, 2].unpack('n')[0]\n\n\t\t\t\t\t# DYNAMIC?\n\t\t\t\t\twhen 22\n\t\t\t\t\t\t# not parsed\n\t\t\t\t\telse\n\t\t\t\t\t\tprint_status(\"EPM unknown type: #{info[:type]} #{buf[soff, xlen].unpack(\"H*\")[0]}\")\n\t\t\t\t\tend\n\n\t\t\t\t\tsoff += xlen\n\t\t\t\tend\n\n\t\t\t\tinfo[:pipe].gsub!(\"\\x00\", '') if info[:pipe]\n\t\t\t\tinfo[:host].gsub!(\"\\x00\", '') if info[:host]\n\n\t\t\t\tres << info\n\t\t\tend\n\n\t\trescue ::Interrupt\n\t\t\traise $!\n\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Could not obtain the endpoint list: #{e}\")\n\t\t\tres = nil\n\t\tend\n\n\t\tres\n\tend", "def adapter(name ,&block)\n endpoint() if @endpoints.empty?\n default_endpoint.use(name, &block)\n end", "def create_handler(curve_name, io)\n CurveHandler::AttachService.new(\n config_for(curve_name),\n io,\n scenario,\n metadata_parameters\n )\n end", "def initialize(endpoint)\n self.endpoint = URI(ROOT_URL + endpoint)\n end", "def create_processor_for_property(name, type_property, required)\n property_type = type_property.type\n if property_type == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? type_property.items\n processor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n name,\n false,\n type_property.items,\n type_property.properties[:default],\n type_property.properties\n )\n else\n processor_for_values = create_processor_for_type(name, type_property.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new(name, required, processor_for_values)\n elsif PRIMITIVE_TYPES.include? property_type\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n name,\n required,\n property_type,\n type_property.properties[:default],\n type_property.properties\n )\n else\n create_processor_for_type(name, property_type, required)\n end\n end", "def construct_endpoint(method_name, ids: {}, params: {})\n uri = Addressable::URI.new\n uri.query_values = params.merge(access_token: options[:access_token])\n resource = Canvas::Endpoints[method_name.to_sym] % ids\n \"#{@options[:host]}#{resource}?#{uri.query}\"\n end", "def initialize(service_id, endpoint_id, verb, callback)\n self.service_id = service_id\n self.endpoint_id = endpoint_id\n self.verb = verb\n self.callback = callback\n end", "def endpoint\n @endpoint||= \"#{@scheme}://#{@host}#{@path}\"\n end", "def service(uri, &block)\n service = ServiceBuilder.new(context())\n service.uri = uri\n __builders.push(service)\n service.instance_eval(&block) if block_given?\n return service\n end", "def endpoint\n raise StandardError, 'Please implement this method.'\n end", "def endpoint\n raise StandardError, 'Please implement this method.'\n end", "def secondary_endpoint(path, actions = DEFAULT_ACTIONS.dup)\n path = path.to_sym\n self.secondary_endpoints += [{\n path: path,\n full_path: full_path_for(path),\n url: url_for(path),\n actions: actions\n }]\n end", "def prepare_endpoint(endpoint)\n raise 'Endpoint not a valid URI' if (endpoint =~ URI::ABS_URI).nil?\n @endpoint = endpoint.chomp('/') + '/'\n end", "def endpoint_params\n params.require(:endpoint).permit(:description, :method_type, :url, :detail, :resource_id, :project_id)\n end", "def initialize(resource_creator = method(:create_resource))\n @routes = []\n @resource_creator = resource_creator\n end", "def create_url_template(rest_method)\n ServiceCatalographer::Util.generate_rest_endpoint_url_template(rest_method)\n end", "def set_Endpoint(value)\n set_input(\"Endpoint\", value)\n end", "def set_Endpoint(value)\n set_input(\"Endpoint\", value)\n end", "def set_Endpoint(value)\n set_input(\"Endpoint\", value)\n end", "def set_Endpoint(value)\n set_input(\"Endpoint\", value)\n end", "def set_Endpoint(value)\n set_input(\"Endpoint\", value)\n end", "def set_Endpoint(value)\n set_input(\"Endpoint\", value)\n end", "def setup_handler\n\t\t# Start the HTTP server service on this host/port\n\t\tself.service = Rex::ServiceManager.start(Rex::Proto::Http::Server,\n\t\t\tdatastore['PXPORT'].to_i, datastore['PXHOST'])\n\n\t\t# Add the new resource\n\t\tservice.add_resource(datastore['PXURI'],\n\t\t\t'Proc' => Proc.new { |cli, req|\n\t\t\t\ton_request(cli, req)\n\t\t\t},\n\t\t\t'VirtualDirectory' => true)\n\n\t\tdlog(\"PassiveX listener started on http://#{datastore['PXHOST']}:#{datastore['PXPORT']}#{datastore['PXURI']}\", 'core', LEV_2)\n\n\t\tprint_status(\"PassiveX listener started.\")\n\tend", "def initialize(controller_uri,use_acl,front_prober,port,proberoute_dir,output_dir=Prober::DEFAULT_TMP_OUTPUT_DIR)\n\t\tsuper(proberoute_dir,output_dir)\n\t\t@pid2fn = {}\n\t\t@front_prober=front_prober\n\t\t@port=port\n\t\t# setting in case we can't get the controller uri below\n\t\t# and it doesn't get set properly\n\t\t# need it set to something true so we know to use acl in the\n\t\t# future\n\t\t@acl=use_acl\n\t\t@controller_uri=nil\n\t\tbegin\n\t\t\tif controller_uri.nil?\n\t\t\t\tcontroller_uri = Prober::get_default_controller_uri\n\t\t\tend\n\t\trescue Exception\n\t\t\tself.log(\"Unable to fetch controller uri:\",$!)\n\t\tend\n\t\tbegin\n\t\t\tif controller_uri.nil?\n\t\t\t\tself.register\n\t\t\telse\n\t\t\t\tupdate_controller(controller_uri)\n\t\t\tend\n\t\trescue Exception\n\t\t\tself.log(\"Unable to register:\",$!)\n\t\tend\n\tend", "def manages_endpoint(endpoint_class)\n raise ArgumentError, \"The class #{endpoint_class.name} isn't a subclass of XClarityEndpoint\" unless endpoint_class < Endpoints::XclarityEndpoint\n\n define_method(:managed_resource) { endpoint_class }\n end", "def initialize(options = {})\n @endpoint = options[:endpoint]\n end" ]
[ "0.6852049", "0.6180102", "0.61758834", "0.60738254", "0.5909795", "0.5897608", "0.58657765", "0.58250624", "0.58187014", "0.5747947", "0.574435", "0.574435", "0.574435", "0.574435", "0.5719572", "0.57149154", "0.569486", "0.56530917", "0.56454515", "0.56450075", "0.5602877", "0.56026083", "0.55892205", "0.55799407", "0.55568886", "0.55429316", "0.5541598", "0.55340606", "0.55340606", "0.55215234", "0.55215234", "0.55084985", "0.54903203", "0.54828644", "0.547457", "0.54735845", "0.5416667", "0.5416667", "0.5415902", "0.54157364", "0.54157364", "0.5362216", "0.5358736", "0.534016", "0.5269908", "0.5250159", "0.52494013", "0.5240107", "0.5240107", "0.52356434", "0.5233784", "0.5204244", "0.52013713", "0.52009344", "0.5175675", "0.51628673", "0.5149275", "0.5135848", "0.51273847", "0.5115326", "0.51036716", "0.50965875", "0.5096514", "0.5080803", "0.5074909", "0.5068303", "0.5065866", "0.5049015", "0.5049015", "0.5049015", "0.5049015", "0.5049015", "0.50425196", "0.5019323", "0.5016874", "0.5011009", "0.4997014", "0.49934417", "0.4990617", "0.4987402", "0.49855012", "0.49853516", "0.49849164", "0.49780196", "0.49780196", "0.49755305", "0.4969565", "0.4969417", "0.49616522", "0.49515876", "0.49430758", "0.4942542", "0.4942542", "0.4942542", "0.4942542", "0.4942542", "0.49375805", "0.49364406", "0.49354044", "0.49339914" ]
0.6107682
3
Create a response processor
def create_response_value_processor(endpoint_response) response_type = endpoint_response.type if response_type == TYPE_ARRAY processor_for_values = create_processor_for_type('Response', endpoint_response.items, false) Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new('Response', true, processor_for_values) elsif response_type == TYPE_FILE # Don't validate the files' content nil elsif response_type create_processor_for_type('Response', response_type, false) else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_response( &block )\n @postprocessor = block\n end", "def create_response(request)\n response = Response.new\n end", "def response_parser; end", "def process_response(obj)\n end", "def response_factory(data)\n\t\t\t\t\t\treturn Response.new(data)\n\t\t\t\t\tend", "def call( env )\n resource_request = RESTRack::ResourceRequest.new( :request => Rack::Request.new(env) )\n unless @request_hook.nil? or (RESTRack::CONFIG.has_key?(:PRE_PROCESSOR_DISABLED) and RESTRack::CONFIG[:PRE_PROCESSOR_DISABLED])\n @request_hook.pre_processor(resource_request)\n end\n response = RESTRack::Response.new(resource_request)\n unless @request_hook.nil? or (RESTRack::CONFIG.has_key?(:POST_PROCESSOR_DISABLED) and RESTRack::CONFIG[:POST_PROCESSOR_DISABLED])\n @request_hook.post_processor(response)\n end\n return response.output\n end", "def process\n klass.new(request).process\n end", "def process!(response_data={})\n @client.post(\"#{path}/process\", response_data)\n end", "def response(&_)\n if block_given?\n @response ||= Response.new\n yield @response\n end\n @response\n end", "def handle_response(response); end", "def handle_response(response); end", "def response\n parse_request\n do_something\n put_response\n end", "def create\n processor = Mailgun::WebHook::Processor.new(mailgun_params, self)\n processor.on_unhandled_mailgun_events = self.class.on_unhandled_mailgun_events!\n processor.run!\n block_given? ? yield : head(:ok)\n end", "def processor; end", "def call_reponse_wrapper(response)\n response_wrapper.new(response)\n end", "def perform(request, response); end", "def response_block\n create_response_block\n end", "def response_block\n create_response_block\n end", "def parse_response!; end", "def new\n respond_with(transformation_yield)\n end", "def process(request); end", "def processor\n @processor ||= Processor.new(options)\n end", "def get_processor; end", "def process_response\n job = message.job\n job.data = message.data\n job.message = message.message\n\n if message.ok?\n job.proceed!\n else\n job.error!\n end\n end", "def response\n process\n @response.to_a\n end", "def build_response(connection, request); end", "def map_processed_lines(response)\n end", "def process_output\n return @output unless @output.nil?\n return @output = DocumentOutput.new(@response_output) unless @response_output.nil?\n \n raise \"The response output was not in it's usual places, please provide the output\" if @controller.nil? || @controller.body.empty?\n @response_output = @controller.body\n @output = DocumentOutput.new(@controller.body)\n end", "def handle_request( req )\n\t\tself.log.debug \"[:negotiation] Wrapping response with hypermedia presentation.\"\n\n\t\tresponse = super\n\t\tresponse.presenter = self.presenter\n\n\t\treturn response\n\tend", "def handle\n @response.response_code = response_code\n @response.content = view\n @response.layout = set_layout\n @response.output_format = @request.path_info.split(\".\").last\n end", "def on_response &b\n @response_proc = b\n self\n end", "def create_request_processor(swagger_endpoint)\n request_processor = Sinatra::SwaggerExposer::Processing::SwaggerRequestProcessor.new(swagger_endpoint.produces)\n\n swagger_endpoint.parameters.each do |parameter|\n if TYPE_FILE == parameter.type\n dispatcher = Sinatra::SwaggerExposer::Processing::SwaggerFileProcessorDispatcher.new(\n parameter.name,\n parameter.required\n )\n else\n processor = create_parameter_value_processor(parameter)\n dispatcher = Sinatra::SwaggerExposer::Processing::SwaggerProcessorDispatcher.new(\n parameter.how_to_pass,\n processor\n )\n end\n if dispatcher.useful?\n request_processor.add_dispatcher(dispatcher)\n end\n end\n\n swagger_endpoint.responses.each_pair do |code, endpoint_response|\n response_value_processor = create_response_value_processor(endpoint_response)\n response_processor = Sinatra::SwaggerExposer::Processing::SwaggerResponseProcessor.new(\n endpoint_response,\n response_value_processor\n )\n request_processor.add_response_processor(\n code,\n response_processor.useful? ? response_processor : nil\n )\n end\n\n request_processor\n end", "def respond_for usecase, &block\n resp = {\n object: usecase.build_object,\n errors: usecase.errors,\n message: usecase.errors? ? \"Error\" : \"Success\"\n }\n if block_given?\n pp yield(resp)\n end\n Response.new( resp )\n end", "def create_Found_Response(request_path)\n\tbody = File.read(request_path)\n\tinitial = generic_Generate_Initial(200)\n\theaders = generic_Generate_Headers(body)\n\tgeneric_Generate_Response(initial,headers,body)\nend", "def run\n @response ||= build_response catch_halt{ @handler.run }\n end", "def parse(response)\n\nend", "def prepare_response\n self.send(route, parse_query)\n end", "def build_response(resource_name)\n response = yield\n resource = response_successful?(response) ? resource_name : \"error\"\n\n response_object = Montage::Response.new(response.status, response.body, resource)\n\n set_token(response_object.token.value) if resource_name == \"token\" && response.success?\n\n response_object\n end", "def result( response )\n response.body\n .dig(:process_request_response, :process_request_result) \n end", "def generate_response(code, format)\n @message = \"Returning code #{code} in #{format} format\"\n response_data = case format\n when \"txt\"\n content_type 'text/plain'\n @message\n when \"json\"\n content_type 'application/json'\n { message: @message }.to_json\n when \"xml\"\n content_type 'application/xml'\n erb :'status.xml', layout: false\n else\n erb :status\n end\n [code.to_i, response_data]\nend", "def setup\n @response ||= {}\n end", "def process(external_request, response)\n # The response_wrapper stores the response and modifies it as a side effect.\n # The caller will use the original response\n response_wrapper = Puppet::Network::HTTP::Response.new(self, response)\n request = make_generic_request(external_request)\n\n set_puppet_version_header(response)\n\n respond_to_errors(response_wrapper) do\n with_request_profiling(request) do\n find_route_or_raise(request).process(request, response_wrapper)\n end\n end\n end", "def pre_process\n Goliath::Connection::AsyncResponse\n end", "def receive_response(response); end", "def create\n\n # load file and parameter from POST\n fileObj = params[:file]\n readerName = params[:reader]\n writerName = params[:writer]\n validation = params[:validate]\n showAllTags = false\n showAllTags = true if params[:showAllTags] == 'true'\n forceValid = true\n forceValid = false if params[:forceValid] == 'false'\n requestFormat = 'auto'\n requestFormat = params[:format] if params[:format]\n\n # call the ADIwg metadata translator\n @mdReturn = ADIWG::Mdtranslator.translate(\n file: fileObj, reader: readerName, validate: validation,\n writer: writerName, showAllTags: showAllTags, forceValid: forceValid)\n\n # return content based on:\n # ... response type 'auto' w/o errors - return output in native format\n # ... response type 'auto' w/ errors - return full object in native format\n # ... response type 'xml' - always return full object in XML format\n # ... response type 'json' - always return full object in JSON format\n\n # construct a hash to collect response content\n @responseInfo = {}\n @responseInfo[:success] = true\n @responseInfo[:readerStructureStatus] = 'OK'\n @responseInfo[:readerStructureMessages] = @mdReturn[:readerStructureMessages]\n @responseInfo[:readerValidationStatus] = 'OK'\n @responseInfo[:readerValidationMessages] = @mdReturn[:readerValidationMessages]\n @responseInfo[:readerExecutionStatus] = 'OK'\n @responseInfo[:readerExecutionMessages] = @mdReturn[:readerExecutionMessages]\n @responseInfo[:writerStatus] = 'OK'\n @responseInfo[:writerMessages] = @mdReturn[:writerMessages]\n @responseInfo[:readerRequested] = @mdReturn[:readerRequested]\n @responseInfo[:readerVersionRequested] = @mdReturn[:readerVersionRequested]\n @responseInfo[:readerVersionUsed] = @mdReturn[:readerVersionUsed]\n @responseInfo[:writerRequested] = @mdReturn[:writerRequested]\n @responseInfo[:writerVersion] = @mdReturn[:writerVersion]\n @responseInfo[:writerOutputFormat] = @mdReturn[:writerOutputFormat]\n @responseInfo[:writerForceValid] = @mdReturn[:writerForceValid]\n @responseInfo[:writerShowTags] = @mdReturn[:writerShowTags]\n @responseInfo[:writerCSSlink] = @mdReturn[:writerCSSlink]\n @responseInfo[:writerMissingIdCount] = @mdReturn[:writerMissingIdCount]\n @responseInfo[:translatorVersion] = @mdReturn[:translatorVersion]\n @responseInfo[:writerOutput] = @mdReturn[:writerOutput]\n\n # set messages Status (ERROR, WARNING, NOTICE, none)\n aSMess = @responseInfo[:readerStructureMessages]\n aVMess = @responseInfo[:readerValidationMessages]\n aEMess = @responseInfo[:readerExecutionMessages]\n aWMess = @responseInfo[:writerMessages]\n\n status = 'OK'\n status = 'NOTICE' if aSMess.any? {|s| s.include?('NOTICE')}\n status = 'WARNING' if aSMess.any? {|s| s.include?('WARNING')}\n status = 'ERROR' if aSMess.any? {|s| s.include?('ERROR')}\n @responseInfo[:readerStructureStatus] = status\n\n status = 'OK'\n status = 'NOTICE' if aVMess.any? {|s| s.include?('NOTICE')}\n status = 'WARNING' if aVMess.any? {|s| s.include?('WARNING')}\n status = 'ERROR' if aVMess.any? {|s| s.include?('ERROR')}\n @responseInfo[:readerValidationStatus] = status\n\n status = 'OK'\n status = 'NOTICE' if aEMess.any? {|s| s.include?('NOTICE')}\n status = 'WARNING' if aEMess.any? {|s| s.include?('WARNING')}\n status = 'ERROR' if aEMess.any? {|s| s.include?('ERROR')}\n @responseInfo[:readerExecutionStatus] = status\n\n status = 'OK'\n status = 'NOTICE' if aWMess.any? {|s| s.include?('NOTICE')}\n status = 'WARNING' if aWMess.any? {|s| s.include?('WARNING')}\n status = 'ERROR' if aWMess.any? {|s| s.include?('ERROR')}\n @responseInfo[:writerStatus] = status\n\n # check for errors returned by parser, validator, reader, and writer\n @responseInfo[:success] = false unless @mdReturn[:readerStructurePass]\n @responseInfo[:success] = false unless @mdReturn[:readerValidationPass]\n @responseInfo[:success] = false unless @mdReturn[:readerExecutionPass]\n @responseInfo[:success] = false unless @mdReturn[:writerPass]\n\n # the json schema validator returns expanded folder/file path names to gem\n # these path names may pose a security risk and are removed from the messages\n # find gem path and removed it from messages\n unless @responseInfo[:readerValidationStatus] == 'OK'\n each_recur(@responseInfo[:readerValidationMessages]) do |elem, idx, arr|\n arr[idx]=sanitize(elem)\n end\n end\n\n\n # NOTE: to format for expected v2 response\n responseV2 = {\n success: @responseInfo[:success],\n messages: {\n :readerRequested => @responseInfo[:readerRequested],\n :readerVersionRequested => @responseInfo[:readerVersionRequested],\n :readerVersionUsed =>@responseInfo[:readerVersionUsed],\n :readerStructurePass =>@responseInfo[:readerStructureStatus] != 'ERROR',\n :readerStructureMessages =>@responseInfo[:readerStructureMessages],\n :readerValidationLevel =>@responseInfo[:readerValidationLevel],\n :readerValidationPass =>@responseInfo[:readerValidationStatus] != 'ERROR',\n :readerValidationMessages =>@responseInfo[:readerValidationMessages],\n readerExecutionPass: @responseInfo[:readerExecutionStatus] != 'ERROR',\n readerExecutionMessages: @responseInfo[:readerExecutionMessages],\n writerRequested: @responseInfo[:writerRequested],\n writerVersion: @responseInfo[:writerVersion],\n writerPass: @responseInfo[:writerStatus] != 'ERROR',\n writerMessages: @responseInfo[:writerMessages],\n writerOutputFormat: @responseInfo[:writerOutputFormat],\n writerOutput: @responseInfo[:writerOutput],\n writerForceValid: @responseInfo[:writerForceValid],\n writerShowTags: @responseInfo[:writerShowTags],\n writerCSSlink: @responseInfo[:writerCSSlink],\n writerMissingIdCount: @responseInfo[:writerMissingIdCount],\n translatorVersion: @responseInfo[:translatorVersion] },\n data: @responseInfo[:writerOutput] }\n\n\n # build lightly formatted string for 'plain' text rendering\n sPlain = format_plain(responseV2).sub(\"messages:\\n\",'')\n\n #leave messages but don't replicate writerOutput\n responseV2[:messages].delete(:writerOutput)\n\n if requestFormat == 'auto'\n if @responseInfo[:success]\n render xml: @responseInfo[:writerOutput] if @responseInfo[:writerOutputFormat] == 'xml'\n render json: @responseInfo[:writerOutput] if @responseInfo[:writerOutputFormat] == 'json'\n render inline: @responseInfo[:writerOutput] if @responseInfo[:writerOutputFormat] == 'html'\n unless %w(xml json html).include?(@responseInfo[:writerOutputFormat])\n if writerName == ''\n render plain: sPlain\n else\n render plain: 'Requested format ' + @responseInfo[:writerOutputFormat] + ' not handled.'\n end\n end\n else\n render plain: sPlain\n end\n end\n\n render plain: sPlain if requestFormat == 'plain'\n render json: responseV2 if requestFormat == 'json'\n render xml: responseV2 if requestFormat == 'xml'\n end", "def response(arguments = {})\n Response.new(self, arguments)\n end", "def send_response\r\n if self.response.class.name == \"Proc\"\r\n return self.response.call\r\n end\r\n self.response\r\n end", "def process_response(response)\n content_type = content_type_for(response)\n result = process_body(response.body)\n\n if response.success?\n case content_type_for(response)\n when :csv\n OpenStruct.new(success?: true, status: response.status, content_type: content_type, body: CSV.parse(result))\n else\n OpenStruct.new(success?: true, status: response.status, content_type: content_type, body: parse_body(result))\n end\n else\n handle_error(result, response.status, content_type)\n end\n end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def wrap_response(response)\n\t\t\t\t\tif body = response.body\n\t\t\t\t\t\tresponse.body = parser_for(response).new(body)\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\treturn response\n\t\t\t\tend", "def response(status, headers, body = '')\n body = yield if block_given?\n [status, headers, [body]]\nend", "def call( env )\n resource_request = RESTRack::ResourceRequest.new( :request => Rack::Request.new(env) )\n unless @request_hook.nil? or (RESTRack::CONFIG.has_key?(:PRE_PROCESSOR_DISABLED) and RESTRack::CONFIG[:PRE_PROCESSOR_DISABLED])\n @request_hook.pre_processor(resource_request)\n end\n response = RESTRack::Response.new(resource_request)\n unless resource_request.requires_async_defer\n unless @request_hook.nil? or (RESTRack::CONFIG.has_key?(:POST_PROCESSOR_DISABLED) and RESTRack::CONFIG[:POST_PROCESSOR_DISABLED])\n @request_hook.post_processor(response)\n end\n env['async.callback'].call response.output\n end\n AsyncResponse\n end", "def process_request req, res\n req_headers = req.header\n req_query = req.query\n req_body = Oaf::HTTPServer.get_request_body req\n file = Oaf::Util.get_request_file(@options[:path], req.path,\n req.request_method, @options[:default_response])\n out = Oaf::Util.get_output(file, req.path, req_headers, req_body,\n req_query)\n res_headers, res_status, res_body = Oaf::HTTPServer.parse_response out\n Oaf::HTTPServer.set_response! res, res_headers, res_body, res_status\n end", "def response_proc(code=nil,&blk)\n Proc.new do | message |\n if code.nil? or code.empty? or code == message\n @logger.debug \"Calling proc. code: #{code} message: #{message}\"\n blk.call(message)\n end\n end\n end", "def create_response(response)\r\n\r\n#\r\n#\tSetup default response values.\r\n#\r\n message = nil\r\n authorization = nil\r\n success = false\r\n exception = nil\r\n#\r\n#\tExtract key elements from the response.\r\n#\r\n reasonCode = response.Get(RocketGate::GatewayResponse::REASON_CODE);\r\n message = @@response_codes[('r' + reasonCode).to_sym] || \"ERROR - \" + reasonCode\r\n responseCode = response.Get(RocketGate::GatewayResponse::RESPONSE_CODE);\r\n if ((responseCode != nil) && (responseCode == \"0\"))\r\n success = true; # Transaction succeeded\r\n authorization = response.Get(RocketGate::GatewayResponse::TRANSACT_ID);\r\n else\r\n exception = response.Get(RocketGate::GatewayResponse::EXCEPTION);\r\n end\r\n\r\n#\r\n#\tExtract values that are not dependent up success/failure.\r\n#\r\n avsResponse = response.Get(RocketGate::GatewayResponse::AVS_RESPONSE)\r\n cvv2Response = response.Get(RocketGate::GatewayResponse::CVV2_CODE)\r\n fraudResponse = response.Get(RocketGate::GatewayResponse::SCRUB_RESULTS)\r\n\r\n#\r\n#\tCreate the response object.\r\n#\r\n card_hash = response.Get(RocketGate::GatewayResponse::CARD_HASH)\r\n Response.new(success, message, {:result => responseCode, :exception => exception, :card_hash => card_hash},\r\n :test => test?,\r\n :authorization => authorization,\r\n :avs_result => {:code => avsResponse},\r\n :cvv_result => cvv2Response,\r\n :fraud_review => fraudResponse\r\n )\r\n end", "def response_handler( request, response )\n return response if response.scope.out? || !response.text? ||\n response.code == 304\n\n if ignore_responses?\n page = Page.from_data(\n url: response.url,\n response: response.to_h\n )\n else\n page = response.to_page\n end\n\n page = update_forms( page, request, response )\n\n print_info \" * #{page.forms.size} forms\"\n print_info \" * #{page.links.size} links\"\n print_info \" * #{page.cookies.size} cookies\"\n print_info \" * #{page.jsons.size} JSON\"\n print_info \" * #{page.xmls.size} XML\"\n\n @pages << page.dup\n end", "def post_process\n [status, headers, body]\n end", "def post_process\n [status, headers, body]\n end", "def create_process request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_process_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::DataCatalog::Lineage::V1::Process.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def create\n transformation_yield.valid?\n respond_with(transformation_yield)\n end", "def stream_response_handler(response)\n if gzip_disabled?\n Chef::Log.trace \"disable_gzip is set. \\\n Not using #{response[CONTENT_ENCODING]} \\\n and initializing noop stream deflator.\"\n NoopInflater.new\n else\n case response[CONTENT_ENCODING]\n when GZIP\n Chef::Log.trace \"Initializing gzip stream deflator\"\n GzipInflater.new\n when DEFLATE\n Chef::Log.trace \"Initializing deflate stream deflator\"\n DeflateInflater.new\n else\n Chef::Log.trace \"content_encoding = '#{response[CONTENT_ENCODING]}' \\\n initializing noop stream deflator.\"\n NoopInflater.new\n end\n end\n end", "def process(*args)\n req = Request.create self, *args\n req.apply\n req\n end", "def from_response(resource_class, response)\n case response['Content-Type']\n when nil\n response.body\n when %r{application/pdf}\n response.body\n when %r{text/html}\n response.body\n when %r{text/plain}\n response.body\n when %r{application/octet-stream}\n response.body\n when %r{text/xml}\n if response['location']\n response['location']\n else\n response.body\n end\n when %r{application/json}\n record = from_json resource_class, response.body\n if record.nil?\n record = resource_class.new\n record.uri = response['location']\n end\n\n session_id = extract_session_id(response)\n record.instance_eval {\n @clazz = resource_class\n @etag = response['ETag']\n @session_id = session_id\n @pagination_max_nb_records = response['X-Killbill-Pagination-MaxNbRecords'].to_i unless response['X-Killbill-Pagination-MaxNbRecords'].nil?\n @pagination_total_nb_records = response['X-Killbill-Pagination-TotalNbRecords'].to_i unless response['X-Killbill-Pagination-TotalNbRecords'].nil?\n @pagination_next_page = response['X-Killbill-Pagination-NextPageUri']\n @response = response\n }\n record\n else\n raise ArgumentError, \"#{response['Content-Type']} is not supported by the library\"\n end\n end", "def on_response request, response, block\n block.call(response.name, response.params)\n end", "def component_response(options, reuse_response)\r\n klass = component_class(options)\r\n request = request_for_component(klass.controller_path, options)\r\n new_response = reuse_response ? response : response.dup\r\n\r\n klass.process_with_components(request, new_response, self)\r\n end", "def response; return @response end", "def response\n return launch_response if @echo_request.launch_request?\n return end_session_response if @echo_request.session_ended_request?\n\n ResponseFactory.new(@echo_request, @echo_response).response\n # SessionFactory.new(@echo_request, @echo_response).response\n end", "def main(context, event)\n return Response.new(event.method) unless event.method == 'POST'\n case event.body\n when 'return_userdata'\n context.user_data\n when 'return_string'\n 'a string'\n when 'return_bytes'\n ByteBuffer.new('bytes')\n when 'return_response'\n Response.new('response body', headers: {h1: :v1, h2: :v2}, content_type: 'text/plain', status_code: 201)\n when 'log'\n context.logger.debug('Debug message')\n context.logger.info('Info message')\n context.logger.warn('Warn message')\n context.logger.error('Error message')\n\n [201, 'returned logs']\n when 'log_with'\n context.logger.error('Error message', source: :rabbit, weight: 7)\n\n [201, 'returned logs with']\n when 'return_fields'\n event.fields.to_a.map { |field| field.join('=') }.sort.join(',')\n when 'return_path'\n event.path\n when 'return_error'\n raise 'some error'\n else\n raise \"Unknown return mode: #{event.body}\"\n end\nend", "def raw_data_to_response_object(data)\n case data['status']\n when 'success'\n if data['flags']['paginated'] && data['data'].is_a?(Array)\n MoonropeClient::Responses::PaginatedCollection.new(self, data)\n else\n MoonropeClient::Responses::Success.new(self, data)\n end\n when 'parameter-error' then MoonropeClient::Responses::ParameterError.new(self, data)\n when 'access-denied' then MoonropeClient::Responses::AccessDenied.new(self, data)\n when 'validation-error' then MoonropeClient::Responses::ValidationError.new(self, data)\n else\n MoonropeClient::Response.new(self, data)\n end\n end", "def response_to(input)\nend", "def process(request_buffer=nil)\n raise NotImplementedError\n end", "def output\n # Refactor opportunity--figure out loop for this:\n header_1 = request[0].split(\" \")\n @verb = header_1[0]\n @path = header_1[1]\n @protocol = header_1[2]\n\n header_2 = request[1].split(\" \")\n @host = header_2[1].split(\":\")[0]\n @port = header_2[1].split(\":\")[1]\n\n @origin = host\n @accept = request[-3].split(\": \")[1]\n format_response(verb, path, protocol, host, port, origin, accept)\n end", "def process(context)\n request = context.request\n\n router = @processor_map[request.request_method.downcase.to_sym]\n return 404 unless router\n begin\n processor, params = router.routing(request.path)\n rescue FancyServer::PathRouter::NoRouteMatched\n return 404\n rescue FancyServer::PathRouter::DestinationDuplicated => ex\n return {:status => 503, :body => ex.message}\n end\n return 404 unless processor\n context.params.merge!(params)\n processor.respond_to?(:to_proc) ? context.instance_eval(&processor) : processor\n end", "def respond_with(klass, output)\n klass.new(self, output)\n end", "def respond_with(klass, output)\n klass.new(self, output)\n end", "def handler_request!\n response = Core::HandlerResponse.new(\n @req.body,\n @req.code,\n @req.header.to_hash.inspect\n )\n populate_properties! if response.request_successful? && check_request\n end", "def process(info, properties, payload)\n begin\n response = self.send(properties.type, parse_payload(payload))\n rescue JSON::ParserError => e\n response = InvalidPayload.new\n rescue NoMethodError => e\n response = InvalidMethod.new\n end\n\n respond(response, properties.reply_to, properties.correlation_id)\n raise UndeliverableResponse if @return_info\n end", "def render res_data\n trigger :postprocess, res_data\n\n body = @env['kiwi.serializer'].call res_data\n trigger :after, body\n\n [@status, @headers, body]\n end", "def prepare_response(response)\n response\n end", "def renderOutput(request, response, session, propertyLoader, xmlFileToRender, theme)\n @mySession = session\n @myPropertyLoader = propertyLoader\n @myTheme = theme\n rendererConfig = YAML.load_file( \"#{GlobalSettings.getGlobal(\"Server-ConfigPath\")}OutputRenderers/JSON_XMLRenderer.yaml\")\n cWorkArea = GlobalSettings.getCurrentWorkArea(session)\n docDataDir = GlobalSettings.getDocumentDataDirectory\n @FS = File::SEPARATOR\n xmlFileToRender = xmlFileToRender[0..xmlFileToRender.rindex(\".\")]+\"xml\" if xmlFileToRender.end_with? \".admin\"\n #puts \"\\n\\n----------------------------FileToRender: #{xmlFileToRender}--------------------\\n\\n\"\n file = \"#{cWorkArea}#{xmlFileToRender}\"\n file = GlobalSettings.changeFilePathToMatchSystem(file)\n fcms = nil\n myPage = nil\n if File.exists? file\n fcms = FileCMS.new(session, file, false)\n myPage = Page.new(fcms, -1, session, file)\n #puts \"\\n\\n-------------\\n\\nLoaded Page: #{myPage.title}\\n\\n---------------------------------------\"\n else\n fcms = FileCMS.new(session, file, true)\n end\n #puts \"Theme is: #{theme}\"\n themeTmp = request[\"template\"]\n templateDir = \"#{cWorkArea}#{@FS}system#{@FS}templates#{@FS}#{theme}\"\n\n puts \"TemplateDir exists? #{templateDir} -- #{File.exist?(templateDir)}\"\n if(!File.exist?(templateDir) && request[\"template\"] == nil)\n theme = \"default\"\n templateDir = \"#{cWorkArea}#{@FS}system#{@FS}templates#{@FS}#{theme}\"\n end\n\n version = -1\n if(request[\"version\"] != nil)\n version = request[\"version\"].to_i\n end\n\n # TO-DO: Implement Template system then this....\n\n myTemplate = JSONTemplate.new(templateDir, request[\"file_contents\"], myPage)\n myTemplate.setRenderer(self)\n #myTemplate.setHTMLRenderer(self)\n pageContent = myTemplate.getParsedTemplate\n pageModuleContent = \"\"\n if myTemplate.hasModuleTemplates\n\n\n file_contents = request[\"file_contents\"][:blocks]\n #puts \"HELLOOOOOO :::::: #{file_contents}\"\n file_contents.each{ |key|\n #puts \"Request :::::: #{key}\"\n if key.is_a? Array\n #modType = key[:type]\n at = 0\n modId = nil\n key.each{ |nkey|\n\n if at == 0\n modId = nkey\n at = at.next\n #puts \"Module ID::::: #{modId}\"\n elsif nkey.is_a? Hash\n\n modType = nkey[\"type\"]\n #puts \"\\n\\nNext module type: #{modType}\\n\\n\"\n if myTemplate.containsModuleTemplate(modType)\n\n #TO-DO: process needs to be implemented to support templates in modules....\n modTemplate = myTemplate.getModuleTemplate(modType)\n puts \"#{modType} :::: Data:::: #{nkey[\"data\"]}\"\n modParameters = nkey[\"data\"]\n modParameters[\"id\"] = \"#{modId}\"\n modParameters[\"visible\"] = \"true\"\n modParameters[\"descriptive_name\"] = \"#{modType.capitalize} module\"\n puts \"\\n\\nModule Parameters: #{modParameters}\\n\\n\"\n modTemplate.setModuleData(modParameters)\n #puts \"------------------>Processing module template: #{modType} :: #{modTemplate}\"\n #modTemplate.setModuleToRender(mod)\n pageModuleContent.concat(\"<module>\")\n pageModuleContent.concat(modTemplate.parseTemplate)\n pageModuleContent.concat(\"</module>\")\n #puts \"\\n\\n\\n#{pageModuleContent}\\n\\n\\n\"\n else\n pageModuleContent.concat(\"\\\"unsupported\\\": \\\"Module not supported:#{modType}\\\"\")\n end\n end\n }\n end\n }\n end\n #puts \"Test....\"\n pageContent = Parser.replaceAll(pageContent, \"*CONTENT*\", pageModuleContent)\n pageContent = Hub.applyFilters(request, response, session, pageContent)\n\n myFile = fcms.getFileForWrite# { |file|\n myFile.write( pageContent )\n myFile.close\n return \"{\\\"success\\\": \\\"Writing to #{fcms.getFileURL} success\\\"}\"\n\n end", "def build_response\n enrich_object(fawry_api_response)\n end", "def register_response(response, request)\n\n @active_requests[request.id][:arduino_responses][request.address[:name]] = response \n\n # if reponse is to an info_request then register services\n if request.id < 0 \n register_services request \n\n # else handle response like a normal resource request\n else \n requests = @active_requests[request.id][:arduino_requests].length\n responses = @active_requests[request.id][:arduino_responses].length\n puts \"[Controller:register_response] number of requests #{requests}, and responses #{responses}\"\n if responses >= requests\n puts \"[Controller:register_response] responses received, id: #{request.id}, content: #{@active_requests[request.id]}\"\n # process_response(@active_requests[request.id][:arduino_responses], request.id) \n process_response request.id\n # @active_requests.delete(request.id) \n end\n end\n end", "def output(request, result)\n compose(request, result.output)\n end", "def process_response(provider_response)\n nil\n end", "def process_response(provider_response)\n nil\n end", "def call(env)\n @s2cgi_page_id = self.generate_page_id\n @page_id = @s2cgi_page_id\n @env = env\n self.request = ::Rack::Request.new(env)\n self.response = ::Rack::Response.new\n @validate = Seasar::Validate::Context.new\n @tpl_stack = []\n @auto_render = true\n\n unless ::Rack::MethodOverride::HTTP_METHODS.member?(@request.request_method)\n raise \"unsupport request method. [#{@env['rack.methodoverride.original_method']} -> #{@request.request_method}]\"\n end\n\n self.init\n method_name = @request.request_method.downcase.to_sym\n validate_method_name = \"validate_#{method_name}\"\n\n validate_result = true\n validators = @@validators[self.class].nil? ? {} : @@validators[self.class]\n if validators.key?(:all)\n validate_result = self.instance_eval(&validators[:all])\n end\n\n if validate_result == true\n if validators.key?(method_name)\n validate_result = self.instance_eval(&validators[method_name])\n elsif self.respond_to?(validate_method_name)\n validate_result = self.method(validate_method_name).call\n end\n if validate_result == true && self.respond_to?(method_name)\n self.method(method_name).call\n end\n end\n\n render if @auto_render && @response.body.size == 0 && @response.status == 200\n return self.out\n end", "def initialize(req, res, route_params = {})\n @request, @response = req, res\n @params = Params.new(@request, route_params)\n @already_built_response = false\n end", "def response(env)\n response = Colloquy::Response.new\n\n begin\n parameters = {}\n parameters = validate_request(env)\n parameters = sanitize_parameters(parameters)\n logger.debug \"REQUEST flow: #{parameters[:flow_name]}, msisdn: #{parameters[:msisdn]}, \\\n session_id: #{parameters[:session_id]}, input: #{parameters[:input]}, other: #{parameters[:params].inspect}\"\n rescue Exception => e\n logger.error \"Exception #{e.inspect} when trying to validate request flow: #{parameters[:flow_name]}, \\\n msisdn: #{parameters[:msisdn]}, session_id: #{parameters[:session_id]}, input: #{parameters[:input]}\"\n logger.debug \"#{e.backtrace.inspect}\"\n logger.info 'Responding with default error message'\n\n response = Colloquy::Response.new(Colloquy::Renderer::DEFAULT_ERROR_MESSAGE)\n response.flow_state = :notify\n end\n\n response = @renderer.apply(parameters[:flow_name], parameters[:msisdn], parameters[:session_id], parameters[:input], parameters[:params]) if response.empty?\n\n body = case parameters[:params][:accept]\n when 'text/plain'\n response.to_s\n else\n Yajl.dump({ response: response, flow_state: response.flow_state })\n end\n\n [200, {}, body]\n end" ]
[ "0.6662526", "0.6638015", "0.6591317", "0.6546623", "0.6494686", "0.641557", "0.63104904", "0.6251861", "0.6226066", "0.61979103", "0.61979103", "0.6036747", "0.60179055", "0.6012466", "0.5982507", "0.5955824", "0.5943462", "0.5943462", "0.591904", "0.5898638", "0.5893349", "0.587167", "0.58535147", "0.5846126", "0.58238435", "0.58168846", "0.58103275", "0.5778951", "0.5774739", "0.5763279", "0.57530475", "0.57492507", "0.57400703", "0.5739743", "0.57392544", "0.5706042", "0.5705806", "0.5694003", "0.5688007", "0.56709754", "0.5661295", "0.56547874", "0.5653796", "0.5640649", "0.5635723", "0.5632951", "0.5621611", "0.5614412", "0.5614031", "0.5614031", "0.5614031", "0.5614031", "0.5614031", "0.5614031", "0.5614031", "0.5614031", "0.5614031", "0.5614031", "0.5614031", "0.5614031", "0.5614031", "0.560896", "0.5601856", "0.55998784", "0.5551258", "0.5539467", "0.552389", "0.5523169", "0.55226713", "0.55226713", "0.55224806", "0.5522402", "0.55152744", "0.55078304", "0.54986894", "0.5488443", "0.5481054", "0.5464242", "0.545379", "0.542655", "0.54227847", "0.54208744", "0.54169995", "0.5416658", "0.54151726", "0.5409278", "0.5409278", "0.54076356", "0.5407092", "0.5401989", "0.539938", "0.5398271", "0.5392534", "0.53893036", "0.5389116", "0.5387987", "0.5387987", "0.53843266", "0.5371999", "0.53700286" ]
0.7114406
0
Create a parameter processor for a parameter
def create_parameter_value_processor(parameter) type_name = parameter.type if type_name == TYPE_ARRAY if PRIMITIVE_TYPES.include? parameter.items processor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new( parameter.name, false, parameter.items, parameter.default, parameter.params ) else processor_for_values = create_processor_for_type(parameter.name, parameter.items, false) end Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new( parameter.name, parameter.required, processor_for_values ) elsif PRIMITIVE_TYPES.include? type_name Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new( parameter.name, parameter.required, type_name, parameter.default, parameter.params ) else create_processor_for_type(parameter.name, parameter.type, parameter.required) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_processor_for_type(parameter_name, parameter_type, parameter_required)\n attributes_processors = create_attributes_processors_for_type(parameter_type)\n Sinatra::SwaggerExposer::Processing::SwaggerTypeValueProcessor.new(\n parameter_name,\n parameter_required,\n attributes_processors\n )\n end", "def parameterize(value); end", "def create_value_preprocessor(parameter)\n type_name = parameter.type\n if type_name == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? parameter.items\n preprocessor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n parameter.name,\n false,\n parameter.items,\n parameter.default,\n parameter.params\n )\n else\n preprocessor_for_values = create_preprocessor_for_type(parameter.name, parameter.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValuePreprocessor.new(parameter.name, parameter.required, preprocessor_for_values)\n elsif PRIMITIVE_TYPES.include? type_name\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n parameter.name,\n parameter.required,\n type_name,\n parameter.default,\n parameter.params\n )\n else\n create_preprocessor_for_type(parameter.name, parameter.type, parameter.required)\n end\n end", "def create_processor_for_property(name, type_property, required)\n property_type = type_property.type\n if property_type == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? type_property.items\n processor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n name,\n false,\n type_property.items,\n type_property.properties[:default],\n type_property.properties\n )\n else\n processor_for_values = create_processor_for_type(name, type_property.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new(name, required, processor_for_values)\n elsif PRIMITIVE_TYPES.include? property_type\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n name,\n required,\n property_type,\n type_property.properties[:default],\n type_property.properties\n )\n else\n create_processor_for_type(name, property_type, required)\n end\n end", "def create_preprocessor_for_type(parameter_name, parameter_type, parameter_required)\n attributes_preprocessors = create_attributes_preprocessors_for_type(parameter_type)\n Sinatra::SwaggerExposer::Processing::SwaggerTypeValuePreprocessor.new(\n parameter_name,\n parameter_required,\n attributes_preprocessors\n )\n end", "def processor(params = T.unsafe(nil)); end", "def processor=(_arg0); end", "def define_parameter(name, parameter_data, &block)\n if RailsApiDoc::Controller::Request::Param.valid_nested?(parameter_data[:type], block_given?)\n parameter_data = nested_parameter(parameter_data, &block)\n elsif RailsApiDoc::Controller::Request::Param.valid_enum?(parameter_data[:type], parameter_data[:enum])\n parameter_data[:enum].map!(:to_s)\n end\n\n repo[name] = RailsApiDoc::Controller::Request::Param.new(name, parameter_data)\n end", "def parameter\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n return_value = ParameterReturnValue.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 __SPLAT261__ = nil\n __ID262__ = nil\n char_literal263 = nil\n __ID264__ = nil\n __ID266__ = nil\n expression265 = nil\n\n tree_for_SPLAT261 = nil\n tree_for_ID262 = nil\n tree_for_char_literal263 = nil\n tree_for_ID264 = nil\n tree_for_ID266 = nil\n\n begin\n # at line 219:3: ( ^( SPLAT ID ) | ^( '=' ID expression ) | ID )\n alt_36 = 3\n case look_36 = @input.peek( 1 )\n when SPLAT then alt_36 = 1\n when ASGN then alt_36 = 2\n when ID then alt_36 = 3\n else\n raise NoViableAlternative( \"\", 36, 0 )\n end\n case alt_36\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 219:5: ^( SPLAT ID )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __SPLAT261__ = match( SPLAT, TOKENS_FOLLOWING_SPLAT_IN_parameter_1602 )\n\n tree_for_SPLAT261 = @adaptor.copy_node( __SPLAT261__ )\n\n root_1 = @adaptor.become_root( tree_for_SPLAT261, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n __ID262__ = match( ID, TOKENS_FOLLOWING_ID_IN_parameter_1604 )\n\n tree_for_ID262 = @adaptor.copy_node( __ID262__ )\n\n @adaptor.add_child( root_1, tree_for_ID262 )\n\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 220:5: ^( '=' ID expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal263 = match( ASGN, TOKENS_FOLLOWING_ASGN_IN_parameter_1614 )\n\n tree_for_char_literal263 = @adaptor.copy_node( char_literal263 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal263, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n __ID264__ = match( ID, TOKENS_FOLLOWING_ID_IN_parameter_1616 )\n\n tree_for_ID264 = @adaptor.copy_node( __ID264__ )\n\n @adaptor.add_child( root_1, tree_for_ID264 )\n\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_parameter_1618 )\n expression265 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression265.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 3\n root_0 = @adaptor.create_flat_list\n\n\n # at line 221:5: ID\n _last = @input.look\n __ID266__ = match( ID, TOKENS_FOLLOWING_ID_IN_parameter_1626 )\n\n tree_for_ID266 = @adaptor.copy_node( __ID266__ )\n\n @adaptor.add_child( root_0, tree_for_ID266 )\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__, 32 )\n\n end\n \n return return_value\n end", "def create_proc_with_params\n proc = Proc.new { |a| puts a * 2 }\n #on check on numbers of paramaters\n proc.call(4,6)\n proc.call(5)\nend", "def parameter\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n __IDENTIFIER6__ = nil\n t = nil\n\n begin\n # at line 504:6: t= type IDENTIFIER\n @state.following.push( TOKENS_FOLLOWING_type_IN_parameter_509 )\n t = type\n @state.following.pop\n __IDENTIFIER6__ = match( IDENTIFIER, TOKENS_FOLLOWING_IDENTIFIER_IN_parameter_516 )\n # --> action\n\n @current_method.set_to_parameter_variables(__IDENTIFIER6__.text,VariableSymbol.new(__IDENTIFIER6__.text, t))\n \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n end\n \n return \n end", "def to_proc\n name, options, registry, variable_name = @name, @options, @registry, @iv_name\n Proc.new do\n build name => options\n registry.inject(instance_variable_get(:\"@#{variable_name}\")) do |value, (method, args, block)|\n value.send(method, *args, &block)\n end\n end\n end", "def param( name, *args, &block )\n\t\t\tself.log.debug \"New param %p\" % [ name ]\n\t\t\tself.log.debug \" adding parameter %p to %p\" % [ name, self.paramvalidator ]\n\t\t\tself.paramvalidator.add( name, *args, &block )\n\t\tend", "def preproc=(_arg0); end", "def param(value, param) #method\n @new_context[param] = get_value(value)\n end", "def add_arg_processor(ver,&block)\n raise InvalidArity.new(\"Argument processor must accept one parameter\") if block.arity !=1\n @arg_processors[ver]=block\n @default=ver\n end", "def parameter_filler(name, value)\n Proc.new do |result|\n result.add_parameter(name, value)\n end\n end", "def param(type, title, param)\n param_value(catalogue, type, title, param)\nend", "def param(type, title, param)\n param_value(catalogue, type, title, param)\nend", "def param(name, value, takes_arg, description)\n Task::Param.new(name, value, takes_arg, description)\n end", "def param(param_name, validator, desc_or_options = nil, options = {}, &block) #:doc:\n return unless Apipie.active_dsl?\n Apipie.last_dsl_data[:params] << Apipie::ParamDescription.new(param_name, validator, desc_or_options, options, &block)\n end", "def preproc; end", "def parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 74 )\n return_value = ParametersReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal356 = nil\n parameter355 = nil\n parameter357 = nil\n\n tree_for_char_literal356 = nil\n stream_COMMA = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token COMMA\" )\n stream_parameter = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule parameter\" )\n begin\n # at line 742:5: parameter ( ',' parameter )*\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_5248 )\n parameter355 = parameter\n @state.following.pop\n if @state.backtracking == 0\n stream_parameter.add( parameter355.tree )\n end\n # at line 742:15: ( ',' parameter )*\n while true # decision 91\n alt_91 = 2\n look_91_0 = @input.peek( 1 )\n\n if ( look_91_0 == COMMA )\n alt_91 = 1\n\n end\n case alt_91\n when 1\n # at line 742:18: ',' parameter\n char_literal356 = match( COMMA, TOKENS_FOLLOWING_COMMA_IN_parameters_5253 )\n if @state.backtracking == 0\n stream_COMMA.add( char_literal356 )\n end\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_5256 )\n parameter357 = parameter\n @state.following.pop\n if @state.backtracking == 0\n stream_parameter.add( parameter357.tree )\n end\n\n else\n break # out of loop for decision 91\n end\n end # loop for decision 91\n # AST Rewrite\n # elements: parameter\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 742:36: -> ( parameter )+\n # at line 742:39: ( parameter )+\n stream_parameter.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_parameter.has_next?\n @adaptor.add_child( root_0, stream_parameter.next_tree )\n\n end\n stream_parameter.reset\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 74 )\n\n end\n \n return return_value\n end", "def param; end", "def param; end", "def processor\n @processor ||= Processor.new(options)\n end", "def set_valued_pre_parameter\n @valued_pre_parameter = ValuedPreParameter.find(params[:id])\n end", "def parameterize\n __send__(:\"#{parameterize_config[:target]}=\", __send__(parameterize_config[:source]).to_s.parameterize)\n end", "def valued_pre_parameter_params\n params.require(:valued_pre_parameter).permit(:value, :parameter_id, :preprocessing_id)\n end", "def process_argument(arg)\n case arg\n when *@mapping[:aggregate] then @parameters[:aggregate] = true\n when *@mapping[:date] then create_argument_entry(:date)\n when *@mapping[:default] then create_defaults\n when *@mapping[:json] then @parameters[:json] = true\n when *@mapping[:locale] then create_argument_entry(:locale)\n when *@mapping[:offset] then create_argument_entry(:offset)\n when *@mapping[:period] then create_argument_entry(:period)\n when *@mapping[:save] then create_argument_entry(:save)\n else\n raise_invalid_parameter(arg)\n end\n nil\n end", "def parse_parameters; end", "def setupNewParam(_varied)\n _param = {} ;\n @scatterPolicy.each{|_paramName, _policy|\n _param[_paramName] = ( _varied.key?(_paramName) ?\n _varied[_paramName] :\n getValueByPolicy(_policy) ) ;\n }\n return _param ;\n end", "def get_param(name, value)\n Config::Param.new(name: name, value: value)\n end", "def visit(params = {})\n @parameters.visit params\n end", "def process(params, component)\n Info << \"#{component.name.to_s.upcase} -> #{self.class}\"\n @component = component.dup\n @meta = params[:meta]\n fields.each do |hand|\n @result[hand.name.to_sym] =\n if hand.is_a?(:field)\n value = run(hand, params)\n ret = hand.run( value, params, tlog )\n ret\n elsif hand.is_a?(:plugin)\n # create plugin instance\n field = hand.run(params, tlog)\n field.plugin.dispatch(field, self)\n field.plugin.prepare\n field.plugin\n end\n end\n self\n rescue\n self\n end", "def param(val)\n Build.param(val)\n end", "def buildParameter(name, value, type)\n pp [:got_buildParameter, name, value, type] if $DEBUG\n ptype = TYPE_HASH[ptype.to_s] unless ptype.kind_of?(Fixnum)\n Buby::Implants::Parameter.implant(__buildParameter(name, value, type))\n end", "def to_proc(spec=nil, &block)\n # Split the filter spec into a straight value => value hash and a pattern => value hash.\n ph, vh = spec.split { |k, v| k =~ REGEXP_PAT }\n # The Regexp => value hash is built from the pattern => value hash.\n reh = regexp_hash(ph)\n # The value proc.\n value_proc(reh, vh)\n end", "def process_params!(params, procedures)\n params ||= {}\n procedures ||= []\n params[\"processed\"] = true\n\n ops = params_field_ops(params)\n ops.each { |op, f|\n query_key, query_value = f\n # Fold the procedures onto the query value.\n params[query_key] = procedures.reduce(query_value) { |v, p| send(p, v, op) }\n }\n params\n end", "def parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 31 )\n return_value = ParametersReturnValue.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 __PARAMS259__ = nil\n parameter260 = nil\n\n tree_for_PARAMS259 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 215:5: ^( PARAMS ( parameter )* )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __PARAMS259__ = match( PARAMS, TOKENS_FOLLOWING_PARAMS_IN_parameters_1582 )\n\n tree_for_PARAMS259 = @adaptor.copy_node( __PARAMS259__ )\n\n root_1 = @adaptor.become_root( tree_for_PARAMS259, root_1 )\n\n\n\n if @input.peek == DOWN\n match( DOWN, nil )\n # at line 215:15: ( parameter )*\n while true # decision 35\n alt_35 = 2\n look_35_0 = @input.peek( 1 )\n\n if ( look_35_0 == ASGN || look_35_0 == SPLAT || look_35_0 == ID )\n alt_35 = 1\n\n end\n case alt_35\n when 1\n # at line 215:15: parameter\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_1584 )\n parameter260 = parameter\n @state.following.pop\n\n @adaptor.add_child( root_1, parameter260.tree )\n\n\n else\n break # out of loop for decision 35\n end\n end # loop for decision 35\n\n match( UP, nil )\n end\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 31 )\n\n end\n \n return return_value\n end", "def parameter_rule?; end", "def create_preprocessor_for_property(name, type_property, required)\n property_type = type_property.type\n if property_type == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? type_property.items\n preprocessor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n name,\n false,\n type_property.items,\n type_property.properties[:default],\n type_property.properties\n )\n else\n preprocessor_for_values = create_preprocessor_for_type(name, type_property.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValuePreprocessor.new(name, required, preprocessor_for_values)\n elsif PRIMITIVE_TYPES.include? property_type\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n name,\n required,\n property_type,\n type_property.properties[:default],\n type_property.properties\n )\n else\n create_preprocessor_for_type(name, property_type, required)\n end\n end", "def set_parameter(key, parameter)\n \n # parameter may be a splat or a single value\n parameter = parameter.first if parameter.is_a?(Array) and parameter.size == 1\n \n case key.to_s\n when /_deviation$/\n @deviation = parameter / 100.0\n when /_inertia$/\n @inertia = parameter / 100.0\n else\n @input = parameter\n end\n end", "def get_processor; end", "def pre_process(val)\n if self.class.xdef['procedure'] && val\n proc = eval \"lambda { #{self.class.xdef['procedure']} }\"\n val = proc.call(val)\n end\n \n if val == nil and self.class.xdef['default'] && !@object.send(\"#{self.class.property}\")\n val = self.class.xdef['default']\n end\n \n if val.is_a? String\n val.gsub!(/^[\\s\\t\\n]*/, '')\n val.gsub!(/[\\s\\t\\n]*$/, '')\n val = nil if val.empty?\n end\n \n val\n end", "def param_template\n \"# @param %{param} [Class] Write param definition here.\"\n end", "def pre_process(val)\n if self.class.xdef['procedure'] && val\n proc = eval \"lambda { #{self.class.xdef['procedure']} }\"\n val = proc.call(val)\n end\n \n if val == nil && self.class.xdef['default'] && !@object.send(\"#{self.class.property}\")\n val = self.class.xdef['default']\n end\n \n if val.is_a? String\n val.gsub!(/^[\\s\\t\\n]*/, '')\n val.gsub!(/[\\s\\t\\n]*$/, '')\n val = nil if val.empty?\n end\n \n val\n end", "def parameter_definition(method)\n \t_IDENTIFIER15 = nil\n\n\n\n\n \t parameter = ParameterDefinition.new\n\n\n # 325:5: variable_modifier type[parameter] IDENTIFIER\n variable_modifier()\n\n type(parameter)\n\n _IDENTIFIER15 = @input.look_ahead(1)\n match(:IDENTIFIER)\n\n parameter.name = _IDENTIFIER15.text\n method.add_parameter(parameter)\n \n\n\n\n end", "def map_parameters(instance, name, actual, format = true)\n method = instance.method(\"__hyper_trace_pre_#{name}\")\n map_with_specs(method, actual.dup, format) || map_without_specs(actual, format)\n end", "def param(name, validator, desc_or_options = nil, options = {}, &block)\n dsl_data[:params] << [name,\n validator,\n desc_or_options,\n options.merge(param_group: @current_param_group),\n block]\n end", "def param_class; param.source['class'].constantize; end", "def parameterize(value)\n value.respond_to?(:to_param) ? value.to_param : value\n end", "def add_parameter(id,handle,deriv_method) \n @params[id] = AmpParam.new(handle,deriv_method)\n end", "def processParam(params, changing_params)\n params.each do |key, value|\n makeIter(value, changing_params, key)\n end\n end", "def parameter\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 75 )\n return_value = ParameterReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal358 = nil\n char_literal361 = nil\n variable_name359 = nil\n variable_name360 = nil\n expression362 = nil\n\n tree_for_char_literal358 = nil\n tree_for_char_literal361 = nil\n stream_STAR = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token STAR\" )\n stream_ASGN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token ASGN\" )\n stream_expression = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule expression\" )\n stream_variable_name = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule variable_name\" )\n begin\n # at line 746:3: ( '*' variable_name -> ^( SPLAT['*'] variable_name ) | variable_name ( '=' expression -> ^( '=' variable_name expression ) | -> variable_name ) )\n alt_93 = 2\n look_93_0 = @input.peek( 1 )\n\n if ( look_93_0 == STAR )\n alt_93 = 1\n elsif ( look_93_0 == GET || look_93_0 == SET || look_93_0 == MACRO || look_93_0 == EACH || look_93_0.between?( DEF, OBJECT_DEF ) || look_93_0 == ID || look_93_0.between?( T__148, T__150 ) )\n alt_93 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 93, 0 )\n end\n case alt_93\n when 1\n # at line 746:5: '*' variable_name\n char_literal358 = match( STAR, TOKENS_FOLLOWING_STAR_IN_parameter_5277 )\n if @state.backtracking == 0\n stream_STAR.add( char_literal358 )\n end\n @state.following.push( TOKENS_FOLLOWING_variable_name_IN_parameter_5279 )\n variable_name359 = variable_name\n @state.following.pop\n if @state.backtracking == 0\n stream_variable_name.add( variable_name359.tree )\n end\n # AST Rewrite\n # elements: variable_name\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 746:24: -> ^( SPLAT['*'] variable_name )\n # at line 746:27: ^( SPLAT['*'] variable_name )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( SPLAT, '*' ), root_1 )\n\n @adaptor.add_child( root_1, stream_variable_name.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 747:5: variable_name ( '=' expression -> ^( '=' variable_name expression ) | -> variable_name )\n @state.following.push( TOKENS_FOLLOWING_variable_name_IN_parameter_5297 )\n variable_name360 = variable_name\n @state.following.pop\n if @state.backtracking == 0\n stream_variable_name.add( variable_name360.tree )\n end\n # at line 748:5: ( '=' expression -> ^( '=' variable_name expression ) | -> variable_name )\n alt_92 = 2\n look_92_0 = @input.peek( 1 )\n\n if ( look_92_0 == ASGN )\n alt_92 = 1\n elsif ( look_92_0 == RPAREN || look_92_0 == COMMA || look_92_0 == PIPE )\n alt_92 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 92, 0 )\n end\n case alt_92\n when 1\n # at line 748:7: '=' expression\n char_literal361 = match( ASGN, TOKENS_FOLLOWING_ASGN_IN_parameter_5305 )\n if @state.backtracking == 0\n stream_ASGN.add( char_literal361 )\n end\n @state.following.push( TOKENS_FOLLOWING_expression_IN_parameter_5307 )\n expression362 = expression\n @state.following.pop\n if @state.backtracking == 0\n stream_expression.add( expression362.tree )\n end\n # AST Rewrite\n # elements: ASGN, expression, variable_name\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 748:22: -> ^( '=' variable_name expression )\n # at line 748:25: ^( '=' variable_name expression )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_ASGN.next_node, root_1 )\n\n @adaptor.add_child( root_1, stream_variable_name.next_tree )\n @adaptor.add_child( root_1, stream_expression.next_tree )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 749:22: \n # AST Rewrite\n # elements: variable_name\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 749:22: -> variable_name\n @adaptor.add_child( root_0, stream_variable_name.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n end\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 75 )\n\n end\n \n return return_value\n end", "def parameter(name)\n @variables[name.to_sym] = :param\n end", "def visit_Parameter(o)\n { o.declarator.accept(self) =>\n { \"attribute\" => o.attribute.accept(self),\n \"type\" => o.type.accept(self) } }\n end", "def params_for(method_name, opts={}, &block)\n instance_eval do\n @_method_name = method_name.to_sym\n @params_validator = Parametron::ParamsValidator.new(opts)\n @params_validator.instance_eval(&block)\n end\n end", "def params=(value); end", "def parameter_type; end", "def parameter_type; end", "def blacklight_params\n params = super\n\n # This method needs to be idempotent.\n if params[\"processed\"]\n params\n else\n process_params!(params, params_process_chain)\n end\n end", "def to_param\n self.class.parametrize(name)\n end", "def affect_prepared_values!\n (upper(:@@preparers) || []).each do |preparer|\n @params[preparer[:key]] = preparer[:lambda].try(:call, @params[preparer[:key]])\n end\n end", "def to_proc\n ->(**properties) { perform(**properties) }\n end", "def parameter(*args, &block)\n key, name, delegate = parse_rule_declaration(*args, &block)\n rules[key] = [name, delegate]\n key\n end", "def create_endpoint_processor(swagger_endpoint)\n request_preprocessor = Sinatra::SwaggerExposer::Processing::SwaggerRequestPreprocessor.new\n swagger_endpoint.parameters.each do |parameter|\n preprocessor = create_value_preprocessor(parameter)\n dispatcher = Sinatra::SwaggerExposer::Processing::SwaggerPreprocessorDispatcher.new(parameter.how_to_pass, preprocessor)\n if dispatcher.useful?\n request_preprocessor.add_dispatcher(dispatcher)\n end\n end\n request_preprocessor\n end", "def processor; end", "def uses_par?(parameter); @params.values.include?(parameter); end", "def call_arg_processor(ver,params={})\n processor=get_arg_processor(ver)\n if processor.nil?\n params\n else\n processor.call(params)\n end\n end", "def profile_parameter=(_arg0); end", "def set_parameter\n @parameter = Parameter.pgnd(current_playground).find(params[:id])\n end", "def process_argument(arg)\n case arg\n when *@mapping[:all] then create_argument_entry(:all)\n when *@mapping[:coord] then create_two_argument_entry(:coord)\n when *@mapping[:delta] then create_two_argument_entry(:delta)\n when *@mapping[:extreme] then @parameters[:extreme] = true\n when *@mapping[:index] then create_argument_entry(:index)\n when *@mapping[:meta] then @parameters[:meta] = true\n when *@mapping[:option] then create_argument_entry(:option)\n when *@mapping[:range] then create_two_argument_entry(:range)\n when *@mapping[:section] then create_two_argument_entry(:section)\n when *@mapping[:time] then create_two_argument_entry(:time)\n else\n raise_invalid_parameter(arg)\n end\n end", "def to_proc() end", "def to_proc() end", "def to_param; end", "def each_parameter\n return if parameters.nil?\n parameters.each do |parameter|\n yield parameter\n end\n end", "def each_parameter\n return if parameters.nil?\n parameters.each do |parameter|\n yield parameter\n end\n end", "def process_params(exp)\n _, normal, defaults, splat, rest, kwargs, doublesplat, block = exp.shift 8\n\n args =\n handle_normal_arguments(normal) +\n handle_default_arguments(defaults) +\n handle_splat(splat) +\n handle_normal_arguments(rest) +\n handle_kwargs(kwargs) +\n handle_double_splat(doublesplat) +\n handle_block_argument(block)\n\n s(:args, *args)\n end", "def param(type, name, options)\n @children << ParamRules.new(settings, type.to_sym, name, options, self)\n end", "def param_attribute_for ref, attr, param\n param = param.to_axvalue if param.kind_of? Boxed\n process AX.param_attr_of_element(ref, attr, param)\n end", "def PRF01=(arg)", "def processor(&block)\n if !block_given? || block.arity != 2\n raise InvalidBlockSpecification, \"processor proc should have an arity of 2 (Array: values, ~ActiveRecord: record)\"\n end \n @options[:processor] = block\n end", "def set_parameter \n @parameter = Parameter.find(params[:parameter_id])\n end", "def param( value )\n @paramNum += 1\n @params[@paramNum.to_s] = value\n return \":\" + @paramNum.to_s\n end", "def add_parameter(tag)\n @parameters << Parameter.from_yard_tag(tag, self)\n end", "def newparam(name, options = {}, &block)\n raise ArgumentError, 'Expected a string or symbol for parameter name.' unless name.is_a?(String) || name.is_a?(Symbol)\n raise ArgumentError, 'Expected a hash for the options.' unless options.is_a?(Hash)\n\n name = name.intern\n raise ArgumentError, \"Resource type '#{self.name}' already has a property '#{name}'.\" if @properties.has_key?(name)\n raise ArgumentError, \"Resource type '#{self.name}' already has a parameter '#{name}'.\" if @parameters.has_key?(name)\n\n parameter = Parameter.create(name, options)\n parameter.class_eval(&block) unless block.nil?\n @parameters[name] = parameter\n nil\n end", "def add_parameter one\n # <leader>rap[name of param] from here\n # FIXME: make this work with g:ruby_refactoring_sans_superfluous_syntax and\n # ditch RAddParameterNB (would cause <leader>rap to respond immediately)\nend", "def synthesize_regexp(param, context = {})\n return if context[:value]\n\n captures = {}\n\n param['sources'].each do |_, source|\n # Trying to read values from a non-existent key. Return nil\n # and let another transform try.\n return unless lookup = context[:pallet][source['key']]\n\n # Save all named captures\n Regexp.new(source['regexp']).match(lookup) do |md|\n md.names.each do |name|\n captures[name] = md[name.to_sym]\n end\n end\n end\n\n synthesize_internal(param['produce'], captures)\n end", "def _wrap_parameters(parameters); end", "def to_proc\n ->(input) { call(input) }\n end", "def param(name, \n example: '', \n type: :string, \n required: false,\n description: '')\n @params << Apipony::Parameter.new(name, example, type, required, description)\n end", "def insert_param_based_on_quantity(param_name)\n insert_param_method_generic(param_name,\"quantity\")\n end", "def procedure_parms(token, word)\r\n if word.end_with?('{{')\r\n token.add(get_procedure_literal, [:procedure])\r\n end\r\n end", "def valid_processors; end", "def visit_ParameterNode(o)\n unless @preserved_identifiers.include?(o.value)\n o.value = JSObfu::Utils::random_var_encoding(rename_var(o.value))\n end\n\n super\n end", "def define_parameter(params)\n @properties[:parameters] = Hashie::Mash.new unless @properties.key?(:parameters)\n if params.kind_of? Hash\n @properties[:parameters].merge!(params)\n else\n error \"Cannot define parameter for app '#{self.name}'! Parameter \"+\n \"not passed as a Hash ('#{params.inspect}')\"\n end\n end", "def define_parameter(params)\n @properties[:parameters] = Hashie::Mash.new unless @properties.key?(:parameters)\n if params.kind_of? Hash\n @properties[:parameters].merge!(params)\n else\n error \"Cannot define parameter for app '#{self.name}'! Parameter \"+\n \"not passed as a Hash ('#{params.inspect}')\"\n end\n end", "def parameter(name, options = {})\n options = {:name => name}.merge(options)\n param = Parameter.new(options)\n parameters.push(param)\n param.apply_to(self)\n end", "def process_params(args = {})\r\n args ||= {}\r\n end" ]
[ "0.673584", "0.66540295", "0.64762616", "0.62489116", "0.6186723", "0.6050488", "0.60457397", "0.59999305", "0.5952087", "0.59322613", "0.5931921", "0.58731824", "0.5825732", "0.58170843", "0.5816643", "0.5796295", "0.577737", "0.57695746", "0.57695746", "0.5745455", "0.5741824", "0.57362604", "0.57300925", "0.57133144", "0.57133144", "0.5712857", "0.5709839", "0.57014704", "0.5697713", "0.5696858", "0.565452", "0.5647381", "0.5591467", "0.5556545", "0.555636", "0.5556098", "0.5554028", "0.55535877", "0.5548648", "0.5541076", "0.55340284", "0.5529635", "0.5527226", "0.5521985", "0.552036", "0.5518568", "0.55183506", "0.55162317", "0.5484909", "0.5470947", "0.5470942", "0.546517", "0.54620606", "0.5461915", "0.54532886", "0.54409826", "0.5437095", "0.5436434", "0.5435747", "0.5415765", "0.5415765", "0.5393425", "0.5388176", "0.53752965", "0.537379", "0.5359251", "0.53590107", "0.53589684", "0.53580344", "0.53526676", "0.53425205", "0.53418785", "0.5339912", "0.53214294", "0.53214294", "0.5320543", "0.5305651", "0.5305651", "0.52977914", "0.529751", "0.5286349", "0.52742535", "0.52695674", "0.52661395", "0.5252038", "0.52494025", "0.5249229", "0.5246692", "0.5239326", "0.5232785", "0.5229653", "0.5208555", "0.51959896", "0.51901823", "0.51848996", "0.5182733", "0.5180397", "0.5180397", "0.51693356", "0.51663226" ]
0.7743246
0
Create a type parameter processor for a type parameter
def create_processor_for_type(parameter_name, parameter_type, parameter_required) attributes_processors = create_attributes_processors_for_type(parameter_type) Sinatra::SwaggerExposer::Processing::SwaggerTypeValueProcessor.new( parameter_name, parameter_required, attributes_processors ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_preprocessor_for_type(parameter_name, parameter_type, parameter_required)\n attributes_preprocessors = create_attributes_preprocessors_for_type(parameter_type)\n Sinatra::SwaggerExposer::Processing::SwaggerTypeValuePreprocessor.new(\n parameter_name,\n parameter_required,\n attributes_preprocessors\n )\n end", "def create_parameter_value_processor(parameter)\n type_name = parameter.type\n if type_name == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? parameter.items\n processor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n parameter.name,\n false,\n parameter.items,\n parameter.default,\n parameter.params\n )\n else\n processor_for_values = create_processor_for_type(parameter.name, parameter.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new(\n parameter.name,\n parameter.required,\n processor_for_values\n )\n elsif PRIMITIVE_TYPES.include? type_name\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n parameter.name,\n parameter.required,\n type_name,\n parameter.default,\n parameter.params\n )\n else\n create_processor_for_type(parameter.name, parameter.type, parameter.required)\n end\n end", "def type_params; end", "def type_params; end", "def type_params; end", "def type_params; end", "def type_params; end", "def create_processor_for_property(name, type_property, required)\n property_type = type_property.type\n if property_type == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? type_property.items\n processor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n name,\n false,\n type_property.items,\n type_property.properties[:default],\n type_property.properties\n )\n else\n processor_for_values = create_processor_for_type(name, type_property.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new(name, required, processor_for_values)\n elsif PRIMITIVE_TYPES.include? property_type\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n name,\n required,\n property_type,\n type_property.properties[:default],\n type_property.properties\n )\n else\n create_processor_for_type(name, property_type, required)\n end\n end", "def type(*args); end", "def parameter_type; end", "def parameter_type; end", "def create_value_preprocessor(parameter)\n type_name = parameter.type\n if type_name == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? parameter.items\n preprocessor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n parameter.name,\n false,\n parameter.items,\n parameter.default,\n parameter.params\n )\n else\n preprocessor_for_values = create_preprocessor_for_type(parameter.name, parameter.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValuePreprocessor.new(parameter.name, parameter.required, preprocessor_for_values)\n elsif PRIMITIVE_TYPES.include? type_name\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n parameter.name,\n parameter.required,\n type_name,\n parameter.default,\n parameter.params\n )\n else\n create_preprocessor_for_type(parameter.name, parameter.type, parameter.required)\n end\n end", "def param_type(keys)\n puts \"Entering param_type '#{@sy}'\" if DEBUG\n type = nil\n \n if ParamType.first.include? @sy.text\n if @sy.type == TokenType::ARRAY_TOKEN\n type = param_array(keys | ParamType.follow)\n else\n type = @sy.text\n next_token\n end\n else\n error(\"Line #{@sy.line_number}: Invalid parameter type #{@sy.text}\", keys | ParamType.follow)\n end\n \n puts \"Leaving param_type '#{@sy}'\" if DEBUG\n return type if type.is_a? TypeNode\n TypeNode.new type\n end", "def register_spec_type(*args, &block); end", "def param_class; param.source['class'].constantize; end", "def type=(_arg0); end", "def type=(_arg0); end", "def type=(_arg0); end", "def type=(_arg0); end", "def type=(_arg0); end", "def type=(_arg0); end", "def type=(_arg0); end", "def type=(_arg0); end", "def type=(_arg0); end", "def type=(_arg0); end", "def type=(_arg0); end", "def type=(_arg0); end", "def type=(_arg0); end", "def processor(params = T.unsafe(nil)); end", "def prepare_type\n @type = params[:type]\n @klass = @type.constantize\n end", "def type(type); end", "def register_type_mapping(runtime_type, puppet_type_or_pattern, _ = nil)\n TypeAsserter.assert_assignable('First argument of type mapping', PRuntimeType::RUBY, runtime_type)\n expr = runtime_type.name_or_pattern\n if expr.is_a?(Array)\n TypeAsserter.assert_instance_of('Second argument of type mapping', TYPE_REGEXP_SUBST, puppet_type_or_pattern)\n register_implementation_regexp(puppet_type_or_pattern, expr)\n else\n TypeAsserter.assert_instance_of('Second argument of type mapping', PTypeType::DEFAULT, puppet_type_or_pattern)\n register_implementation(puppet_type_or_pattern, expr)\n end\n end", "def create_attributes_processors_for_type(type_name)\n type = @types[type_name]\n attributes_processors = []\n type.properties.each_pair do |property_name, property|\n attributes_processors <<\n create_processor_for_property(\n property_name,\n property,\n type.required.include?(property.name)\n )\n end\n if type.extends\n attributes_processors = attributes_processors + create_attributes_processors_for_type(type.extends)\n end\n attributes_processors\n end", "def spec_type(desc, *additional); end", "def parameterize(value); end", "def parameter_types; end", "def buildParameter(name, value, type)\n pp [:got_buildParameter, name, value, type] if $DEBUG\n ptype = TYPE_HASH[ptype.to_s] unless ptype.kind_of?(Fixnum)\n Buby::Implants::Parameter.implant(__buildParameter(name, value, type))\n end", "def second_argument_type_def(options, args)\n is_ok = second_argument_is_type?(args)\n\n return false unless is_ok\n param = args[0]\n options[:type] = args[1]\n\n define_parameter(param, options, &block)\n true\n end", "def params() @param_types end", "def type(node, type); end", "def create_preprocessor_for_property(name, type_property, required)\n property_type = type_property.type\n if property_type == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? type_property.items\n preprocessor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n name,\n false,\n type_property.items,\n type_property.properties[:default],\n type_property.properties\n )\n else\n preprocessor_for_values = create_preprocessor_for_type(name, type_property.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValuePreprocessor.new(name, required, preprocessor_for_values)\n elsif PRIMITIVE_TYPES.include? property_type\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n name,\n required,\n property_type,\n type_property.properties[:default],\n type_property.properties\n )\n else\n create_preprocessor_for_type(name, property_type, required)\n end\n end", "def type_klass=(_arg0); end", "def param_type\n param_type = type.to_sym\n param_type = fields.to_h { |field| [field.name.to_sym, field.param_type] } if record?\n param_type = [param_type] if repeated?\n param_type\n end", "def register_parser_type(type, parser_klass, extensions = T.unsafe(nil)); end", "def types=(_arg0); end", "def create_attributes_preprocessors_for_type(type_name)\n type = @types[type_name]\n attributes_preprocessors = []\n type.properties.each_pair do |property_name, property|\n attributes_preprocessors <<\n create_preprocessor_for_property(\n property_name,\n property,\n type.required.include?(property.name)\n )\n end\n if type.extends\n attributes_preprocessors = attributes_preprocessors + create_attributes_preprocessors_for_type(type.extends)\n end\n attributes_preprocessors\n end", "def validated_parser_type(type); end", "def visit_Parameter(o)\n { o.declarator.accept(self) =>\n { \"attribute\" => o.attribute.accept(self),\n \"type\" => o.type.accept(self) } }\n end", "def register_spec_type *args, &block\n if block then\n matcher, klass = block, args.first\n else\n matcher, klass = *args\n end\n TYPES.unshift [matcher, klass]\n end", "def validate_type(type, context:); end", "def define_parameter(name, parameter_data, &block)\n if RailsApiDoc::Controller::Request::Param.valid_nested?(parameter_data[:type], block_given?)\n parameter_data = nested_parameter(parameter_data, &block)\n elsif RailsApiDoc::Controller::Request::Param.valid_enum?(parameter_data[:type], parameter_data[:enum])\n parameter_data[:enum].map!(:to_s)\n end\n\n repo[name] = RailsApiDoc::Controller::Request::Param.new(name, parameter_data)\n end", "def register_postprocessor(mime_type, klass, proc = nil, &block)\n proc ||= block\n mutate_hash_config(:postprocessors, mime_type) do |processors|\n processors.push(wrap_processor(klass, proc))\n processors\n end\n end", "def type_argument(member)\n\n\n\n # 346:7: '<' ( member_special_identifier[member] )* '>'\n match(:LEFT_ANGULAR_BRACKET)\n member.type += '<' \n # 347:7: ( member_special_identifier[member] )*\n while true\n alt47 = 2\n alt47 = DFA47.predict(self, @input)\n case alt47\n when 1\n # 347:9: member_special_identifier[member]\n member_special_identifier(member)\n\n else\n break\n end\n end\n match(:RIGHT_ANGULAR_BRACKET)\n member.type += '>' \n\n\n\n end", "def polymorphic_type_param\n \"#{key}_type\".to_sym\n end", "def type\n Type.new(type_param).yard_type_string\n end", "def register_preprocessor(mime_type, klass, &block)\n expire_index!\n\n if block_given?\n name = klass.to_s\n klass = Class.new(Processor) do\n @name = name\n @processor = block\n end\n end\n\n @preprocessors[mime_type].push(klass)\n end", "def instance_type=(_arg0); end", "def fstype=(_arg0); end", "def type_for( name , ivars )\n l = Parfait::Type.allocate.compile_time_init\n l.send(:private_add_instance_variable , :type , name)\n ivars.each {|n,t| l.send(:private_add_instance_variable, n , t) }\n l\n end", "def type \n\t\n\t$cst.add_branch(\"type\")\n\t\n\tmatch_token(\"T_TYPE\", $tokens[$index])\n\t\n\t$cst.ascend\nend", "def to_ruby(type_name)\n SIMPLE_TYPES[type_name][1] || lambda {|param| param}\n end", "def source_type=(_arg0); end", "def set_parameter_types(object)\n # Ensure there is an actual parameter for each parameter tag\n tags = object.tags(:param)\n tags.each do |tag|\n next if statement.parameters.find { |p| tag.name == p.name }\n\n log.warn \"The @param tag for parameter '#{tag.name}' has no matching parameter at #{statement.file}:#{statement.line}.\" unless tag.name == 'name' || tag.name == 'title'\n end\n\n # Assign the types for the parameter\n statement.parameters.each do |parameter|\n tag = tags.find { |t| t.name == parameter.name }\n unless tag\n log.warn \"Missing @param tag for parameter '#{parameter.name}' near #{statement.file}:#{statement.line}.\" unless object.docstring.empty?\n\n # Add a tag with an empty docstring\n object.add_tag YARD::Tags::Tag.new(:param, '', [parameter.type || 'Any'], parameter.name)\n next\n end\n\n # Warn if the parameter type and tag types don't match\n if parameter.type && tag.types && !tag.types.empty? && parameter.type != tag.types[0]\n log.warn \"The type of the @param tag for parameter '#{parameter.name}' \" \\\n \"does not match the parameter type specification near #{statement.file}:#{statement.line}: \" \\\n 'ignoring in favor of parameter type information.'\n end\n\n if parameter.type\n tag.types = [parameter.type]\n elsif !tag.types\n tag.types = ['Any']\n end\n end\n end", "def add_type(type)\n end", "def type(val); @type = val; self; end", "def type _args\n \"type _args;\" \n end", "def register_preprocessor(mime_type, klass, &block)\n mutate_hash_config(:preprocessors, mime_type) do |processors|\n processors.push(wrap_processor(klass, block))\n processors\n end\n end", "def machine_type(name, number, range=nil)\n machine_type = MachineType.new(name, number, range)\n @machine_types << machine_type\n # generates a method with given machine type name in a module\n # this module is included in Parameter class so machine type dependencies can be\n # given with machine type names (in DSL) instead of binary numbers\n ParameterMachineTypeBridge.send(:define_method, name) do\n machine_type.binary_number\n end\n end", "def register_processor(pattern, klass, replace_all: T.unsafe(nil)); end", "def register_postprocessor(mime_type, klass, &block)\n expire_index!\n\n if block_given?\n name = klass.to_s\n klass = Class.new(Processor) do\n @name = name\n @processor = block\n end\n end\n\n @postprocessors[mime_type].push(klass)\n end", "def InitType(type, arg)\r\n if type == Integer\r\n return Integer(arg)\r\n elsif type == Float\r\n return Float(arg)\r\n else\r\n return type.new(arg)\r\n end\r\n end", "def register_type(type)\n DSL::Argument::register_argument_for_type(self, type)\n end", "def parameters\n @ast.parameters.map { |p| as_java_type(p.type) }\n end", "def klazz\n params[:type].camelize.constantize\n end", "def parameter\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n __IDENTIFIER6__ = nil\n t = nil\n\n begin\n # at line 504:6: t= type IDENTIFIER\n @state.following.push( TOKENS_FOLLOWING_type_IN_parameter_509 )\n t = type\n @state.following.pop\n __IDENTIFIER6__ = match( IDENTIFIER, TOKENS_FOLLOWING_IDENTIFIER_IN_parameter_516 )\n # --> action\n\n @current_method.set_to_parameter_variables(__IDENTIFIER6__.text,VariableSymbol.new(__IDENTIFIER6__.text, t))\n \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n end\n \n return \n end", "def handle(*types); end", "def buildtype_parameters(options={})\n assert_options(options)\n response = get(\"buildTypes/#{locator(options)}/parameters\")\n response['property']\n end", "def infer_PType(o)\n Types::PType.new()\n end", "def type\n if @type.is_a?(Proc)\n # lazy-eval it\n @type = @type.call\n end\n @type\n end", "def types(types); end", "def type_name_resolver; end", "def return_type_from_tag(member_tag); end", "def to_type()\n callables = dispatchers.map do | dispatch |\n t = Puppet::Pops::Types::PCallableType.new()\n # TODO: handle that dispatch.type may be an ArrayType instead of a TupleType\n t2 = dispatch.type\n t.param_types = Puppet::Pops::Types::TypeCalculator.copy_as_tuple(t2)\n # TODO: Function does not have a block type yet\n t\n end\n if callables.size > 1\n # multiple signatures, produce a Variant type of Callable1-n\n t = Puppet::Pops::Types::PVariantType.new()\n t.types = callables\n t\n else\n # single signature, produce single Callable\n callables.pop\n end\n end", "def add_named_conversion_proc(name, &block)\n unless oid = from(:pg_type).where(:typtype=>['b', 'e'], :typname=>name.to_s).get(:oid)\n raise Error, \"No matching type in pg_type for #{name.inspect}\"\n end\n add_conversion_proc(oid, block)\n end", "def register type, cls\n @@processors[type] = cls\n end", "def type=(_); end", "def type=(_); end", "def type=(_); end", "def type=(_); end", "def type=(_); end", "def method_missing(meth, *args, &block)\n if Puppet::Pops::Types::TypeFactory.respond_to?(meth)\n Puppet::Pops::Types::TypeFactory.send(meth, *args, &block)\n else\n super\n end\n end", "def get_type_parameters(n, algebraic_structure)\n params = TYPE_SYMBOLS.first(n).map{ |t| \"#{t.downcase}#{algebraic_structure} : #{algebraic_structure.capitalize}[#{t.upcase}]\"}\n params.join(\", \")\nend", "def type_for(value)\n case value\n when Numeric\n :numeric\n when String\n :string\n when true, false\n :logical\n when :add, :subtract, :multiply, :divide, :mod, :pow\n :operator\n when :open, :close, :comma\n :grouping\n when :lbracket, :rbracket\n :access\n when :le, :ge, :ne, :lt, :gt, :eq\n :comparator\n when :and, :or\n :combinator\n when :if, :round, :roundup, :rounddown, :not\n :function\n else\n :identifier\n end\nend", "def _param_agent name, type = nil, one_of: nil, all_of: nil, any_of: nil, not: nil, **schema_hash\n combined_schema = one_of || all_of || any_of || (_not = binding.local_variable_get(:not))\n type = schema_hash[:type] ||= type\n pp \"[ZRO] Syntax Error: param `#{name}` has no schema type!\" and return if type.nil? && combined_schema.nil?\n\n schema_hash = CombinedSchema.new(one_of: one_of, all_of: all_of, any_of: any_of, _not: _not) if combined_schema\n param @param_type.to_s.delete('!'), name, type, (@param_type['!'] ? :req : :opt), schema_hash\n end", "def infer_PTypeType(o)\n PTypeType.new(o)\n end", "def param(type, title, param)\n param_value(catalogue, type, title, param)\nend", "def param(type, title, param)\n param_value(catalogue, type, title, param)\nend", "def add_param(type, val)\n type = type.chr if type.kind_of?(Fixnum)\n @signature += type.to_s\n @params << [type, val]\n end", "def prelude_type(t)\n case t\n when :render\n RenderType.new\n when :sequence\n SequenceType.new\n else\n CustomType.new(t)\n end\nend", "def create_attribute_in(type, attribute_name, param_or_property, parent, options)\n type.send(param_or_property, attribute_name.to_sym, parent: parent) do\n if options[:desc]\n desc \"#{options[:desc]} (a #{options[:type]})\"\n end\n\n # The initialize method is called when puppet core starts building up\n # type objects. The core passes in a hash of shape { resource:\n # #<Puppet::Type::TypeName> }. We use this to pass through the\n # required configuration data to the parent (see\n # Puppet::ResourceApi::Property, Puppet::ResourceApi::Parameter and\n # Puppet::ResourceApi::ReadOnlyParameter).\n define_method(:initialize) do |resource_hash|\n super(type.name, self.class.data_type, attribute_name, resource_hash, type)\n end\n\n # get pops data type object for this parameter or property\n define_singleton_method(:data_type) do\n @rsapi_data_type ||= Puppet::ResourceApi::DataTypeHandling.parse_puppet_type(\n attribute_name,\n options[:type],\n )\n end\n\n # from ValueCreator call create_values which makes alias values and\n # default values for properties and params\n Puppet::ResourceApi::ValueCreator.create_values(\n self,\n data_type,\n param_or_property,\n options,\n )\n end\n end" ]
[ "0.69013447", "0.68304664", "0.61616504", "0.61616504", "0.61616504", "0.61616504", "0.61616504", "0.60246724", "0.59889245", "0.5960109", "0.5960109", "0.5891081", "0.5813403", "0.5799338", "0.5670359", "0.56024855", "0.56024855", "0.56024855", "0.56024855", "0.56024855", "0.56024855", "0.56024855", "0.56024855", "0.56024855", "0.56024855", "0.56024855", "0.56024855", "0.56024855", "0.55700815", "0.5563236", "0.5551555", "0.5548316", "0.55351895", "0.55276346", "0.5508279", "0.5507909", "0.5469023", "0.54354906", "0.54341954", "0.54047173", "0.53650194", "0.5307274", "0.5306782", "0.53049266", "0.52931595", "0.5282351", "0.52764636", "0.5254928", "0.5249713", "0.5236859", "0.5230862", "0.52273124", "0.5189324", "0.51857495", "0.5153619", "0.51305914", "0.5113605", "0.51120275", "0.511031", "0.5108287", "0.51060605", "0.5086452", "0.5034995", "0.50254446", "0.501106", "0.5010604", "0.5008877", "0.50086266", "0.49927884", "0.4992262", "0.49825302", "0.49817708", "0.4974853", "0.49580777", "0.49536994", "0.49522814", "0.49492145", "0.4948599", "0.4927246", "0.49248022", "0.4921595", "0.49154943", "0.49120802", "0.49024278", "0.4895054", "0.48872095", "0.48872095", "0.48872095", "0.48872095", "0.48872095", "0.48718035", "0.48617682", "0.48586625", "0.48434258", "0.48421434", "0.4841622", "0.4841622", "0.48401845", "0.48320413", "0.483138" ]
0.74645126
0
Get attributes processor for a type
def create_attributes_processors_for_type(type_name) type = @types[type_name] attributes_processors = [] type.properties.each_pair do |property_name, property| attributes_processors << create_processor_for_property( property_name, property, type.required.include?(property.name) ) end if type.extends attributes_processors = attributes_processors + create_attributes_processors_for_type(type.extends) end attributes_processors end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_attributes_preprocessors_for_type(type_name)\n type = @types[type_name]\n attributes_preprocessors = []\n type.properties.each_pair do |property_name, property|\n attributes_preprocessors <<\n create_preprocessor_for_property(\n property_name,\n property,\n type.required.include?(property.name)\n )\n end\n if type.extends\n attributes_preprocessors = attributes_preprocessors + create_attributes_preprocessors_for_type(type.extends)\n end\n attributes_preprocessors\n end", "def type\n @attributes[:type]\n end", "def type\n @attributes[:type]\n end", "def type\n @attributes[:type]\n end", "def type\n @attributes[:type]\n end", "def type\n @attributes.fetch('type', nil)\n end", "def attribute(name, type)\n @attributes ||= {}\n @attributes[name] = type.meta(name: name)\n end", "def type\n self.attributes[:type]\n end", "def type_for_attribute(attr_name, &block)\n attr_name = attr_name.to_s\n if block\n attribute_types.fetch(attr_name, &block)\n else\n attribute_types[attr_name]\n end\n end", "def attr_by_type(*arguments)\n arguments.each do |type|\n method_id = \"#{type}s\"\n define_method(method_id) { find_by_type(type) } unless respond_to?(method_id)\n end\n end", "def type\n read_attr :type, :to_sym\n end", "def create_processor_for_type(parameter_name, parameter_type, parameter_required)\n attributes_processors = create_attributes_processors_for_type(parameter_type)\n Sinatra::SwaggerExposer::Processing::SwaggerTypeValueProcessor.new(\n parameter_name,\n parameter_required,\n attributes_processors\n )\n end", "def _map_identify_mapping_handler(object_type)\n proc_name = PrcLib.model.meta_obj.rh_get(object_type,\n :lambdas, :get_attr_e)\n\n is_controller = PrcLib.model.meta_obj.rh_get(object_type,\n :options, :controller)\n\n return nil if !proc_name && !is_controller\n\n if proc_name\n map_handler = [@process.method(proc_name), proc_name, false]\n map_handler << @process.class\n return map_handler\n end\n\n [@controller.method(:get_attr), :get_attr, true, @controller.class]\n end", "def type\n attr_val('./@typeCode')\n end", "def type_definition_provider\n attributes.fetch(:typeDefinitionProvider)\n end", "def by_type(type)\n processors.values.detect { |v| v.prefix == type&.upcase }\n end", "def type\n \"AttributeDefinition\"\n end", "def attribute(name, type = nil, &block)\n if type.nil?\n type = type_from_block(name, &block)\n else\n raise ArgumentError unless type < Refined\n end\n\n @attributes << type\n @names << name\n\n define_method(name) do\n match.context.dig(:attributes, name)\n end\n end", "def attribute(name, type = nil, extra_opts={})\n @defined_attributes ||= {}\n @defined_attributes[name.to_sym] = [type, extra_opts]\n define_method(\"#{name}\") do\n return nil unless @attributes\n if type == :model\n @cached_attributes ||= {}\n @cached_attributes[name.to_sym] ||= begin\n model_id = @attributes[name.to_sym]\n klass = extra_opts[:class]\n if model_id && klass\n eval(klass.to_s.camelize).find(model_id)\n end\n end\n else\n @attributes[name.to_sym]\n end\n end\n define_method(\"#{name}=\") do |val|\n return nil unless @attributes\n if type == :model\n @cached_attributes ||= {}\n @cached_attributes.delete(name.to_sym)\n if val.respond_to?(:id)\n @attributes[name.to_sym] = val.id\n else\n @attributes.delete(name.to_sym)\n end\n else @attributes\n @attributes[name.to_sym] = val\n end\n end\n end", "def get_os_attrs(source, attr, source_type)\n begin\n # grab the product name from the template we are current provisioning from\n if source_type == 'prov'\n os_name = source.source.operating_system.product_name rescue nil\n elsif source_type == 'vm'\n os_name = source.operating_system.product_name rescue nil\n else\n raise \"Invalid source_type input\"\n end\n\n log(:info, \"get_os_attrs: Returning Operating System attribute <#{attr}> for Operating System <#{os_name}>\")\n # first we must truncate the product name in a camel case format\n # e.g. Red Hat Enterprise Linux 6 = RedHatEnterpriseLinux6\n truncated_product_name = os_name.split('(').first.delete(' ')\n\n # return the requested attribute\n $evm.instantiate(\"#{OS_CLASS}/#{truncated_product_name}\")[attr]\n rescue => err\n log(:error, \"get_os_attrs: <#{err}>: Unable to return proper attribute <#{attr}> from os_name <#{os_name}>. Returning nil.\")\n return nil\n end\nend", "def get_typePont\n return @typePont\n end", "def name_attr(type) type_info(type, :name_attr) end", "def type\n return attributes['type'] if attributes['type']\n \n # Lookups are in order of preference so if, for example, you set the uri but display_name and id are also\n # set, we'd rather go with the canonical representation.\n if display_name && id\n 'CanonicalUser'\n elsif email_address\n 'AmazonCustomerByEmail'\n elsif uri\n 'Group'\n end\n end", "def resource_attributes_by_type(ast)\n result = {}\n resources_by_type(ast).each do |type,resources|\n result[type] = resources.map{|resource| resource_attributes(resource)}\n end\n result\n end", "def resource_attributes_by_type(ast)\n result = {}\n resources_by_type(ast).each do |type,resources|\n result[type] = resources.map{|resource| resource_attributes(resource)}\n end\n result\n end", "def resource_attributes_by_type(ast)\n result = {}\n resources_by_type(ast).each do |type,resources|\n result[type] = resources.map{|resource| resource_attributes(resource)}\n end\n result\n end", "def attr_name_from_type_param(type)\n #ap \"type #{type}\"\n type\n .split(\":\")\n .last\n .gsub(/\\[.*:/, '')\n .gsub(/\\]/, '')\n .to_sym\n end", "def get_attributes(column, column_type, klass, options); end", "def get_type\n\n end", "def type_of_2fa\n @attributes[:type_of_2fa]\n end", "def find_attribute_type( name )\n\t\tattrtype = nil\n\n\t\t# Try both the name as-is, and the camelCased version of it\n\t\tcamelcased_sym = name.to_s.gsub( /_(\\w)/ ) { $1.upcase }.to_sym\n\t\tattrtype = self.valid_attribute_type( name ) ||\n\t\t self.valid_attribute_type( camelcased_sym )\n\n\t\treturn attrtype\n\tend", "def type\n @props[:type]\n end", "def attribute_type(x)\n self.class.attribute_type qualified_name(x)\n end", "def type\n read_attribute(:type) || Figaro.env.meal_types.split.first\n end", "def valid_attribute_type( attroid )\n\t\treturn self.valid_attribute_types.find {|attr_type| attr_type.valid_name?(attroid) }\n\tend", "def attr_hash\n\t\t\thash = {:sourcetype => @type}\n\t\t\tcase @type\n\t\t\twhen 'random_string'\n\t\t\t\thash[:length] = @length\n\t\t\twhen 'random_number'\n\t\t\t\thash[:start] = @start\n\t\t\t\thash[:end] = @end\n\t\t\twhen 'eval'\n\t\t\t\thash[:code] = @code.chomp.to_sym\t\t\t# symbolize it in order to prevent it from being escaped\n\t\t\twhen 'file'\n\t\t\t\thash[:fileid] = @fileid\n\t\t\t\thash[:delimiter] = @delimiter\n\t\t\t\thash[:order] = @order\n\t\t\tend\n\t\t\thash\n\t\tend", "def type_for_attribute(attr_name)\n attr_name = attr_name.to_s\n attribute_types[attr_name]\n end", "def type_for_attribute(attr_name)\n attr_name = attr_name.to_s\n attribute_types[attr_name]\n end", "def type_for_attribute(attr_name)\n attr_name = attr_name.to_s\n attribute_types[attr_name]\n end", "def attr_type_for(attribute)\n fields = self.class._module.fields\n field = fields[attribute]\n raise UninitializedModule, \"#{self.class.session.namespace_const}Module #{self.class._module.name} was not initialized properly (fields.length == 0)\" if fields.length == 0\n raise InvalidAttribute, \"#{self.class}._module.fields does not contain an entry for #{attribute} (of type: #{attribute.class})\\nValid fields: #{self.class._module.fields.keys.sort.join(\", \")}\" if field.nil?\n raise InvalidAttributeType, \"#{self.class}._module.fields[#{attribute}] does not have a key for \\'type\\'\" if field[\"type\"].nil?\n field[\"type\"].to_sym\n end", "def attributes\n @attributes ||= get_field_by_type(ATTRIBUTE_FIELDS)\n end", "def loadAttributes(attribType)\n result = []\n\n # ad is an attribute descriptor.\n @list.each do |ad|\n next unless ad['attrib_type'] == attribType\n\n # Load referenced attribute and add it to parent.\n result += @boot_sector.mftEntry(ad['mft']).loadAttributes(attribType)\n end\n\n result\n end", "def material_type\n attributes['material_type']\n end", "def material_type\n attributes['material_type']\n end", "def get_processor; end", "def create_processor_for_property(name, type_property, required)\n property_type = type_property.type\n if property_type == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? type_property.items\n processor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n name,\n false,\n type_property.items,\n type_property.properties[:default],\n type_property.properties\n )\n else\n processor_for_values = create_processor_for_type(name, type_property.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new(name, required, processor_for_values)\n elsif PRIMITIVE_TYPES.include? property_type\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n name,\n required,\n property_type,\n type_property.properties[:default],\n type_property.properties\n )\n else\n create_processor_for_type(name, property_type, required)\n end\n end", "def make_reader( attrtype )\n\t\tself.log.debug \"Generating an attribute reader for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\treturn lambda do |*args|\n\t\t\tif args.empty?\n\t\t\t\tself[ attrname ]\n\t\t\telse\n\t\t\t\tself.traverse_branch( attrname, *args )\n\t\t\tend\n\t\tend\n\tend", "def type_attribute_directory\n Pathname.new(puppet_lib) + 'type' + @name\n end", "def processor\n return @options[:processor]\n end", "def _type\n special_attribute('@type'.freeze)\n end", "def type\n @type ||= calculate_type\n end", "def loader_class\n attributes.loader_class\n end", "def process_attributes!\n if !@current_command_type.nil?\n @expression = Confinicky::Parsers::Expression.new(statement: @line.gsub(/\\A#{@current_command_type} /,\"\"))\n @name = @expression.name\n @value = @expression.value\n end\n end", "def type\n self['type']['type']\n end", "def attr_type(attr_name)\n raise NotImplementedError\n end", "def attr_get_sb4(attr_type, strict = true)\n #This is a stub, used for indexing\n end", "def attribute_types\n\t\treturn self.attr_oids.collect {|oid| self.schema.attribute_types[oid] }\n\tend", "def rrtype\n @attributes[:rrtype]\n end", "def record_type\n attributes['item_type']\n end", "def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end", "def reflection_or_attribute_name; end", "def for_type( type )\n model_method_list.find_all { |mm| mm.operator_type? type }\n end", "def reg_type\n attributes['reg_type'].downcase\n end", "def map_attributes(source, type, ctx)\n ctx.logger.debug(\"Mapping #{source.class} attributes\")\n enumerator = type.enumerator.enumerate(source, type, ctx)\n enumerator.map do |attribute, value, segment|\n local_ctx = segment.nil? ? ctx : ctx.advance(segment)\n mutated = map_attribute(value, attribute, local_ctx)\n changed = !mutated.equal?(value)\n if changed\n ctx.logger.debug(\"Attribute #{attribute.to_def} has changed\")\n end\n [changed, attribute, mutated, local_ctx]\n end\n end", "def setup_attribute_type(klass)\n klass.schema.each do |attr, config|\n klass._attribute_types[attr] = self.setup_layer_type(klass, config.split(/[|]/), 0)\n end\n end", "def attribute_for_audience_with_generic(attr, person_or_type)\n generic_attribute = read_attribute(attr)\n return generic_attribute if person_or_type.nil?\n aud = Event.process_audience(person_or_type)\n custom_attribute = attribute_for_audience(attr, aud)\n valid = block_given? ? yield(custom_attribute) : !custom_attribute.blank?\n valid ? custom_attribute : generic_attribute\n end", "def attr_get_sb2(attr_type, strict = true)\n #This is a stub, used for indexing\n end", "def get_style(type, id)\n if Weapon_style_by_attribute == true\n # BY ATTRIBUTE\n if type == 0\n item = $data_weapons[id]\n if item.element_set.include?(17)\n #this element means it requires the ability to wield swords\n return 'Sword'\n end\n if item.element_set.include?(18)\n #this element means it requires the ability to wield staffs\n return 'Staff'\n end\n \n end\n if type == 1\n item = $data_armors[id]\n if item.element_set.include?(17)\n #you can re-use elements for armour for example this can mean shield when tagged on armour\n return 'Shield'\n end\n if item.element_set.include?(19)\n #or to avoid confusion you can use differant ones\n return 'Armour'\n end\n end\n return nil\n else\n # BY ID\n if type == 0\n case id\n when 1\n return 'Sword'\n when 29\n return 'Staff' \n end\n end\n if type == 1\n case id\n when 1\n return 'Shield'\n end\n end\n return nil\n end\n end", "def calculate_based_attributes\n attributes_groups_by(type: 'based').each do |group|\n next unless group.character_attributes\n\n # TODO: remember to check if the attribute that is going to serve as\n # the base does not have a base too, or it can go down to a deadlock\n # this security check can be made on the controller, when the attributes\n # are saved\n group.character_attributes.each do |attribute|\n attribute.base_attribute = find_character_attribute(\n attribute.base_attribute_group,\n attribute.base_attribute_name\n )\n end\n end\n end", "def attribute_factory\n V01::Attributes\n end", "def get_generic(e, l)\n GENERIC_ATTRS.each { |a| l.push(e.attributes[a]) }\n end", "def type_hierarchy_provider\n attributes.fetch(:typeHierarchyProvider)\n end", "def create_attribute_in(type, attribute_name, param_or_property, parent, options)\n type.send(param_or_property, attribute_name.to_sym, parent: parent) do\n if options[:desc]\n desc \"#{options[:desc]} (a #{options[:type]})\"\n end\n\n # The initialize method is called when puppet core starts building up\n # type objects. The core passes in a hash of shape { resource:\n # #<Puppet::Type::TypeName> }. We use this to pass through the\n # required configuration data to the parent (see\n # Puppet::ResourceApi::Property, Puppet::ResourceApi::Parameter and\n # Puppet::ResourceApi::ReadOnlyParameter).\n define_method(:initialize) do |resource_hash|\n super(type.name, self.class.data_type, attribute_name, resource_hash, type)\n end\n\n # get pops data type object for this parameter or property\n define_singleton_method(:data_type) do\n @rsapi_data_type ||= Puppet::ResourceApi::DataTypeHandling.parse_puppet_type(\n attribute_name,\n options[:type],\n )\n end\n\n # from ValueCreator call create_values which makes alias values and\n # default values for properties and params\n Puppet::ResourceApi::ValueCreator.create_values(\n self,\n data_type,\n param_or_property,\n options,\n )\n end\n end", "def attributs()\n if block_given?\n rados_getxattrs.each { |key,value| \n yield key,value\n }\n else\n return rados_getxattrs\n end\n \n end", "def parse_attributes! #:nodoc:\n self.attributes = (attributes || []).map do |key_value|\n name, type = key_value.split(':')\n Rails::Generators::GeneratedAttribute.new(name, type)\n end\n end", "def get_attribute(name); end", "def get_attribute(name); end", "def make_predicate( attrtype )\n\t\tself.log.debug \"Generating an attribute predicate for %p\" % [ attrtype ]\n\t\tattrname = attrtype.name\n\t\tif attrtype.single?\n\t\t\tself.log.debug \" attribute is SINGLE, so generating a scalar predicate...\"\n\t\t\treturn lambda { self[attrname] ? true : false }\n\t\telse\n\t\t\tself.log.debug \" attribute isn't SINGLE, so generating an array predicate...\"\n\t\t\treturn lambda { self[attrname].any? {|val| val} }\n\t\tend\n\tend", "def value(instance = nil)\n if nil == instance\n return attribute_type\n end\n attribute_type.new(instance, @options.merge({\n :cls => model,\n :type => type,\n :name => name\n }))\n end", "def attribute_types\n {\n title: :string,\n body: :string,\n decidim_category_id: :category,\n decidim_scope_id: :scope,\n address: :string,\n latitude: :string,\n longitude: :string,\n state: :string\n }\n end", "def device_type\n self[:type]\n end", "def fetch_upstream_primitive(attr)\n registered_properties[attr].type\n end", "def type ; metadata[:type] ; end", "def read_attribute_before_type_cast(attr_name)\n return @attributes[attr_name.to_sym]\n end", "def by_type(*types)\n select { |attribute| types.include?(attribute.class) }\n end", "def map_type type\n type\n end", "def map_type type\n type\n end", "def read_attribute_before_type_cast(name)\n if prop = property(name)\n attributes_before_type_cast[prop.as]\n else\n attributes_before_type_cast[name.to_s]\n end\n end", "def attr_get_binary(attr_type, strict = true)\n #This is a stub, used for indexing\n end", "def attribute(key, type = nil)\n reader = :\"#{key}\"\n writer = :\"#{key}=\"\n\n define_method(reader) do\n self.attributes[reader]\n end\n\n define_method(writer) do |value|\n self.attributes[reader] = value\n end\n end", "def cached_attributes\n @cached_attributes ||=\n property_types.select{|k,v| attribute_types_cached_by_default.include?(v)}.map{|e| e.first.to_s}.to_set\n end", "def default_processor_type\n :base\n end", "def type\n return @type\n end", "def decorate!(klass, *attributes, **options)\n decorate(klass, *attributes, **options)\n attributes.flatten.map do |attribute|\n type = klass.attribute_types[attribute.to_s]\n lookup(type, klass, attribute.to_s)\n end\n end", "def attribute_path\n type_attribute_directory + \"#{@attribute_name}.rb\"\n end", "def editor_for_attr_type(type)\n attr_type_to_editor_map[type] || :textfield\n end", "def document_on_type_formatting_provider\n attributes.fetch(:documentOnTypeFormattingProvider)\n end", "def type\n requires_preauth\n app\n formation = get_formation\n changes = if args.any?{|arg| arg =~ /=/}\n args.map do |arg|\n if arg =~ /^([a-zA-Z0-9_]+)=([\\w-]+)$/\n type, new_size = $1, $2\n current_p = formation.find{|f| f[\"type\"] == type}\n if current_p.nil?\n error(\"Type '#{type}' not found in process formation.\")\n end\n p = current_p.clone\n p[\"size\"] = new_size\n p\n end\n end.compact\n elsif args.any?\n size = shift_argument.downcase\n validate_arguments!\n formation.map{|p| p[\"size\"] = size; p}\n end\n scale_dynos(formation, changes) if changes\n display_dyno_type_and_costs(get_formation)\n end", "def type\n self['type']\n end", "def attr_get_sb1(attr_type, strict = true)\n #This is a stub, used for indexing\n end" ]
[ "0.66234607", "0.6392467", "0.62843263", "0.62843263", "0.62843263", "0.61374766", "0.6047604", "0.5946742", "0.58670545", "0.5860231", "0.58024645", "0.5683741", "0.5634317", "0.5620199", "0.5611769", "0.5598919", "0.5570774", "0.5521515", "0.55020857", "0.547216", "0.546899", "0.5399785", "0.53712535", "0.5361262", "0.5361262", "0.5361262", "0.53542566", "0.53520834", "0.5350875", "0.53263605", "0.5285912", "0.52826655", "0.52817965", "0.526872", "0.5259459", "0.52537256", "0.52515876", "0.52515876", "0.52515876", "0.52513444", "0.52352345", "0.5224821", "0.52237374", "0.52237374", "0.52098477", "0.5183312", "0.5176117", "0.5173096", "0.51569664", "0.5146644", "0.51434624", "0.51396346", "0.5125457", "0.51094186", "0.5104542", "0.509082", "0.50854945", "0.50833994", "0.5082574", "0.5074571", "0.5029561", "0.50079966", "0.5003672", "0.49866593", "0.49849713", "0.49811462", "0.49745694", "0.49743834", "0.49722594", "0.49680826", "0.49679235", "0.49660164", "0.49645334", "0.49595717", "0.49547035", "0.49509278", "0.49509278", "0.49473727", "0.4946206", "0.49436858", "0.4943673", "0.494097", "0.49365675", "0.4933833", "0.49337348", "0.4933547", "0.4933547", "0.49330685", "0.49290064", "0.4924644", "0.4918495", "0.48988175", "0.48981166", "0.48902923", "0.48778278", "0.48776883", "0.48744184", "0.48690987", "0.48673436", "0.48628694" ]
0.734431
0
Create a processor for a type property
def create_processor_for_property(name, type_property, required) property_type = type_property.type if property_type == TYPE_ARRAY if PRIMITIVE_TYPES.include? type_property.items processor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new( name, false, type_property.items, type_property.properties[:default], type_property.properties ) else processor_for_values = create_processor_for_type(name, type_property.items, false) end Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new(name, required, processor_for_values) elsif PRIMITIVE_TYPES.include? property_type Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new( name, required, property_type, type_property.properties[:default], type_property.properties ) else create_processor_for_type(name, property_type, required) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_processor_for_type(parameter_name, parameter_type, parameter_required)\n attributes_processors = create_attributes_processors_for_type(parameter_type)\n Sinatra::SwaggerExposer::Processing::SwaggerTypeValueProcessor.new(\n parameter_name,\n parameter_required,\n attributes_processors\n )\n end", "def create_attributes_processors_for_type(type_name)\n type = @types[type_name]\n attributes_processors = []\n type.properties.each_pair do |property_name, property|\n attributes_processors <<\n create_processor_for_property(\n property_name,\n property,\n type.required.include?(property.name)\n )\n end\n if type.extends\n attributes_processors = attributes_processors + create_attributes_processors_for_type(type.extends)\n end\n attributes_processors\n end", "def create_preprocessor_for_property(name, type_property, required)\n property_type = type_property.type\n if property_type == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? type_property.items\n preprocessor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n name,\n false,\n type_property.items,\n type_property.properties[:default],\n type_property.properties\n )\n else\n preprocessor_for_values = create_preprocessor_for_type(name, type_property.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValuePreprocessor.new(name, required, preprocessor_for_values)\n elsif PRIMITIVE_TYPES.include? property_type\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n name,\n required,\n property_type,\n type_property.properties[:default],\n type_property.properties\n )\n else\n create_preprocessor_for_type(name, property_type, required)\n end\n end", "def create_attributes_preprocessors_for_type(type_name)\n type = @types[type_name]\n attributes_preprocessors = []\n type.properties.each_pair do |property_name, property|\n attributes_preprocessors <<\n create_preprocessor_for_property(\n property_name,\n property,\n type.required.include?(property.name)\n )\n end\n if type.extends\n attributes_preprocessors = attributes_preprocessors + create_attributes_preprocessors_for_type(type.extends)\n end\n attributes_preprocessors\n end", "def register type, cls\n @@processors[type] = cls\n end", "def value\n send property.type_field\n end", "def create_preprocessor_for_type(parameter_name, parameter_type, parameter_required)\n attributes_preprocessors = create_attributes_preprocessors_for_type(parameter_type)\n Sinatra::SwaggerExposer::Processing::SwaggerTypeValuePreprocessor.new(\n parameter_name,\n parameter_required,\n attributes_preprocessors\n )\n end", "def property_type(**options)\n Property.derive(**options)\n end", "def property_type(type)\n ensure_valid_parameter('property type', type, %w(houses flats))\n @request[:property_type] = type.to_s\n self\n end", "def set_property_type\n @property_type = PropertyType.find(params[:id])\n end", "def register_postprocessor(mime_type, klass, proc = nil, &block)\n proc ||= block\n mutate_hash_config(:postprocessors, mime_type) do |processors|\n processors.push(wrap_processor(klass, proc))\n processors\n end\n end", "def create_parameter_value_processor(parameter)\n type_name = parameter.type\n if type_name == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? parameter.items\n processor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n parameter.name,\n false,\n parameter.items,\n parameter.default,\n parameter.params\n )\n else\n processor_for_values = create_processor_for_type(parameter.name, parameter.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new(\n parameter.name,\n parameter.required,\n processor_for_values\n )\n elsif PRIMITIVE_TYPES.include? type_name\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(\n parameter.name,\n parameter.required,\n type_name,\n parameter.default,\n parameter.params\n )\n else\n create_processor_for_type(parameter.name, parameter.type, parameter.required)\n end\n end", "def register_postprocessor(mime_type, klass, &block)\n expire_index!\n\n if block_given?\n name = klass.to_s\n klass = Class.new(Processor) do\n @name = name\n @processor = block\n end\n end\n\n @postprocessors[mime_type].push(klass)\n end", "def set_property_type\n properties_array = Array(meta_data['PropertiesV1'])\n room_type_hash = properties_array.find { |data_hash| data_hash['TypeNumber'] == code_for(:property_type) }.to_h\n room_type_number = Array(room_type_hash['TypeContents']).first\n\n # There are also hotel (130), mill (172), tent lodge (175)\n # we ignore them and filter them out during property validation\n case room_type_number\n when 20 # Castle\n property.type = 'house'\n property.subtype = 'chateau'\n when 30 # Cottage\n property.type = 'house'\n property.subtype = 'cottage'\n when 40 # Mansion\n property.type = 'house'\n when 50 # Villa\n property.type = 'house'\n property.subtype = 'villa'\n when 60 # Chalet\n property.type = 'house'\n when 80 # Bungalow\n property.type = 'house'\n property.subtype = 'bungalow'\n when 110, 112 # Studio, Duplex\n property.type = 'apartment'\n property.subtype = 'studio_bachelor'\n when 120 # Penthouse\n property.type = 'apartment'\n property.subtype = 'luxury_apartment'\n when 140 # Lodge\n property.type = 'house'\n property.subtype = 'cabin'\n when 160 # Apartment\n property.type = 'apartment'\n when 70, 90, 95, 100, 145, 150, 170 # Farmhouse, Boat, House Boat, Holiday Home, Riad, Mobile Home, Cave house\n property.type = 'house'\n end\n end", "def register_preprocessor(mime_type, klass, &block)\n expire_index!\n\n if block_given?\n name = klass.to_s\n klass = Class.new(Processor) do\n @name = name\n @processor = block\n end\n end\n\n @preprocessors[mime_type].push(klass)\n end", "def mapping\n {\n type.to_sym => {\n properties: self.type_mapping\n }\n }\n end", "def create_property_method\n @resource.class.properties.each do |type|\n name = type.name\n self.class.send(:define_method, name) do\n get_value(name)\n end\n self.class.send(:define_method, \"#{name}=\") do |value|\n set_value(name,resource[name])\n end\n end\n end", "def type\n @props[:type]\n end", "def create_property(name, type, init: true)\n Orocos.load_typekit_for(type, false)\n orocos_type_name = Orocos.find_orocos_type_name_by_type(type)\n Orocos.load_typekit_for(orocos_type_name, true)\n\n local_property = @local_task.do_create_property(Property, name, orocos_type_name)\n @local_properties[local_property.name] = local_property\n @properties[local_property.name] = local_property\n if init\n local_property.write(local_property.new_sample)\n end\n local_property\n end", "def type\n if @type.is_a?(Proc)\n # lazy-eval it\n @type = @type.call\n end\n @type\n end", "def get_type(property_name, type)\n type ||= property_name\n type = type.to_s.classify if type.is_a?(Symbol)\n name = type.to_s\n base = name.demodulize.to_sym\n base = :Boolean if %i[TrueClass FalseClass].include?(base)\n if base.blank? || (base == :String)\n type = nil\n elsif SCALAR_TYPES.include?(base)\n type = \"Axiom::Types::#{base}\"\n elsif !name.include?('::')\n type = \"Ils::#{name}\"\n end\n type.is_a?(String) ? type.constantize : type\n end", "def get_property_type(entity_name, property_name)\n metadata.xpath(\"//EntityType[@Name='#{entity_name}']/Property[@Name='#{property_name}']\").first.attributes['Type'].value\n end", "def create_property(name, type, options = Hash.new)\n options = Kernel.validate_options options, :init => true\n\n orocos_type_name = find_orocos_type_name_by_type(type)\n Orocos.load_typekit_for orocos_type_name\n local_property = @local_task.do_create_property(Property, name, orocos_type_name)\n @local_properties[local_property.name] = local_property\n @properties[local_property.name] = local_property\n if options[:init]\n local_property.write(local_property.new_sample)\n end\n local_property\n end", "def property_type(property)\n if property.interhome_accommodation_id\n property_type_for_interhome(property.interhome_accommodation)\n else\n property_type_for_accommodation_type(property.accommodation_type)\n end\n end", "def register_preprocessor(mime_type, klass, &block)\n mutate_hash_config(:preprocessors, mime_type) do |processors|\n processors.push(wrap_processor(klass, block))\n processors\n end\n end", "def by_type(type)\n processors.values.detect { |v| v.prefix == type&.upcase }\n end", "def register_bundle_processor(mime_type, klass, &block)\n expire_index!\n\n if block_given?\n name = klass.to_s\n klass = Class.new(Processor) do\n @name = name\n @processor = block\n end\n end\n\n @bundle_processors[mime_type].push(klass)\n end", "def type(type); end", "def map_type type\n type\n end", "def map_type type\n type\n end", "def get_property_type column\n column.type\n end", "def get_property_type column\n column.type\n end", "def register_type_mapping(runtime_type, puppet_type_or_pattern, _ = nil)\n TypeAsserter.assert_assignable('First argument of type mapping', PRuntimeType::RUBY, runtime_type)\n expr = runtime_type.name_or_pattern\n if expr.is_a?(Array)\n TypeAsserter.assert_instance_of('Second argument of type mapping', TYPE_REGEXP_SUBST, puppet_type_or_pattern)\n register_implementation_regexp(puppet_type_or_pattern, expr)\n else\n TypeAsserter.assert_instance_of('Second argument of type mapping', PTypeType::DEFAULT, puppet_type_or_pattern)\n register_implementation(puppet_type_or_pattern, expr)\n end\n end", "def initialize(property)\n @name = Puppet::Pops::Types::StringConverter.convert(property.name.to_s, '%p')\n @type = self.class.get_puppet_type(property)\n @doc = property.doc.strip\n @is_namevar = property.isnamevar?\n end", "def generate_prop_type(key_name, props, current_depth, object_cache)\n case props\n when String\n STRING_PROP_TYPE + @is_required\n when NilClass\n ANY_PROP_TYPE\n when Numeric\n NUMBER_PROP_TYPE + @is_required\n when TrueClass, FalseClass\n BOOL_PROP_TYPE + @is_required\n when Array\n # this is wrong - it should do `shape()` if it's not a shape-name\n \"React.PropTypes.arrayOf(\" + generate_prop_type(nil, props[0], current_depth, object_cache) + \")\" + @is_required\n when Hash\n cached_shape = object_cache.cache(props) do\n prop_type = hash_to_prop_type(props, current_depth, object_cache)\n PropTypes::CachedShape.new(nil, prop_type, props, semicolon: @semicolon)\n end\n key_name && cached_shape.offer_name(\"#{key_name}Shape\")\n cached_shape.increment\n cached_shape.id + @is_required\n else\n raise \"Can't generate prop for #{props} (#{props.class})\"\n end\n end", "def cast(property, value)\n return nil if value.nil?\n type = property.type\n if value.instance_of?(type) || type == Object\n value\n elsif CASTABLE_TYPES.include?(type)\n send('typecast_to_'+type.to_s.downcase, value)\n else\n type.new(value)\n end\n end", "def write_attribute_with_type_conversion(property, value)\n @_properties_before_type_cast ||= {}\n @_properties_before_type_cast[property.to_sym]=value if self.class._props.has_key? property.to_sym\n conv_value = self.class._converter(property.to_sym).to_java(value)\n write_attribute_without_type_conversion(property, conv_value)\n end", "def type(node, type); end", "def initialize_has_property_composed_of(name, data_type)\n composed_of name, :class_name => data_type.name,\n # map the property name to the \"value\" property of the data type class\n :mapping => [name, :value],\n # as far as this is concerned, nulls are allowed --\n #the model can do a separate validates_presence_of() if desired\n :allow_nil => true,\n # create the data type instance automatically from the primitive value\n :converter => Proc.new { |value| data_type.new(value) }\n end", "def type\n @type ||= calculate_type\n end", "def set_property_service_type\n @property_service_type = PropertyServiceType.find(params[:id])\n end", "def typeof!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 61 )\n\n type = TYPEOF\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 182:10: 'typeof'\n match( \"typeof\" )\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__, 61 )\n\n end", "def processor\n @processor ||= Processor.new(options)\n end", "def create_from_properties(properties = {})\n check_property_value(properties, :type)\n\n require 'opsview_rest/entity'\n entity = OpsviewRest::Entity.new(properties[:type], properties)\n create(entity)\n end", "def set_herb_property_type\n @herb_property_type = HerbPropertyType.find(params[:id])\n end", "def create_script_processor(type, name)\n params = {\n :revision => {\n :clientId => \"\",\n :version => 0\n },\n :component => {\n :type => \"org.apache.nifi.processors.script.#{type}\",\n :name => name,\n :position => {\n :x => 0,\n :y => 0\n }\n }\n }\n\n data_params = JSON.pretty_generate(params)\n\n processor = send_request_raw({\n 'method' => 'POST',\n 'uri' => normalize_uri(datastore[\"NiFi-Path\"], '/process-groups/', $target_id, '/processors'),\n 'headers' => { 'Accept' => '*/*', 'Content-Type' => 'application/json;charset=UTF-8' },\n 'data' => data_params\n })\n return processor\n end", "def get_processor; end", "def write_attribute_with_type_conversion(property, value)\n @_properties_before_type_cast[property.to_sym]=value if self.class._decl_props.has_key? property.to_sym\n conv_value = self.class._converter(property.to_sym).to_java(value)\n write_attribute_without_type_conversion(property, conv_value)\n end", "def method_missing(meth, *args, &block)\n if Puppet::Pops::Types::TypeFactory.respond_to?(meth)\n Puppet::Pops::Types::TypeFactory.send(meth, *args, &block)\n else\n super\n end\n end", "def type_definition_provider\n attributes.fetch(:typeDefinitionProvider)\n end", "def postprocessors(mime_type = nil)\n if mime_type\n @postprocessors[mime_type].dup\n else\n deep_copy_hash(@postprocessors)\n end\n end", "def type(val); @type = val; self; end", "def create_command_processor(type, name)\n params = {\n :revision => {\n :clientId => \"\",\n :version => 0\n },\n :component => {\n :type => \"org.apache.nifi.processors.standard.#{type}\",\n :name => name,\n :position => {\n :x => 0,\n :y => 0\n }\n }\n }\n\n data_params = JSON.pretty_generate(params)\n\n processor = send_request_raw({\n 'method' => 'POST',\n 'uri' => normalize_uri(datastore[\"NiFi-Path\"], '/process-groups/', $target_id, '/processors'),\n 'headers' => { 'Accept' => '*/*', 'Content-Type' => 'application/json;charset=UTF-8' },\n 'data' => data_params\n\n })\n end", "def set_type(name)\n @type = name\n ProcessRecord::TYPE_TABLE[name] = self\n end", "def new\n @procedure_type = ProcedureType.new\n end", "def create; super(:type); end", "def map(input, property); end", "def register_bundle_processor(mime_type, klass, &block)\n mutate_hash_config(:bundle_processors, mime_type) do |processors|\n processors.push(wrap_processor(klass, block))\n processors\n end\n end", "def interpoltype=(value)\n @interpoltype = value\n if defined? @interpolators\n self.build_interpolators\n end\n end", "def set_type\n end", "def prepare_type\n @type = params[:type]\n @klass = @type.constantize\n end", "def type(*args); end", "def type\n Type.new(type_param).yard_type_string\n end", "def infer_PType(o)\n Types::PType.new()\n end", "def type=(type); end", "def cast_with_proc(obj, type)\n if (type == :proc || obj.is_a?(::Proc)) && obj.respond_to?(:to_source)\n :proc\n else\n cast_without_proc(obj, type)\n end\n end", "def register(mime_type, &blk)\n mime_type = MIME::Types[mime_type].first unless mime_type.is_a?(MIME::Type)\n meth = mime_type.sub_type.gsub(/-/, \"_\").to_sym\n (@index ||= {})[mime_type.to_s] = meth\n meta_def(meth, &blk)\n end", "def create_property(type, rent, status, address, landlord, tenant)\n @array.push(Property.new(type, rent, landlord, tenant, address, status))\n save_list(@file_path)\n end", "def type\n @type ||= \"#{as}_type\" if polymorphic?\n end", "def type_setter\n @type_setter ||= type.__setter__\n end", "def get_property_class(property, classname = nil)\n type = find_basic_type(property.type)\n\n # If type is Self (as per Spec) treat is as HostType\n # classname is always in camelcase\n type = classname if type == \"self\"\n type = \"List<#{type}>\" if property.array\n type\n end", "def property_types(property)\n if @vocabulary.properties.has_key?(property)\n @vocabulary.properties[property][:types]\n else\n @vocabulary.properties[:any][:types]\n end\n end", "def create_value_preprocessor(parameter)\n type_name = parameter.type\n if type_name == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? parameter.items\n preprocessor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n parameter.name,\n false,\n parameter.items,\n parameter.default,\n parameter.params\n )\n else\n preprocessor_for_values = create_preprocessor_for_type(parameter.name, parameter.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValuePreprocessor.new(parameter.name, parameter.required, preprocessor_for_values)\n elsif PRIMITIVE_TYPES.include? type_name\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n parameter.name,\n parameter.required,\n type_name,\n parameter.default,\n parameter.params\n )\n else\n create_preprocessor_for_type(parameter.name, parameter.type, parameter.required)\n end\n end", "def cast_as_value(as_type,as_property)\n if(as_type == :date)\n return \"XMLUtils.dateToXML(#{as_property})\"\n elsif(as_type == :datetime)\n return \"TolDateUtils.toTimeParam(#{as_property})\"\n else\n return as_property\n end\n end", "def initialize(instance, compendium)\n super(compendium)\n\n @instance = instance\n\n instance.class.properties(true).each do |property|\n if property.single?\n # Single valued properties are set by their name\n define_singleton_method property.name do |value = nil, &block|\n if value.is_a? Symbol\n value = compendium.type_instances[property.type][value] || raise(\"Could not find instance :#{value.to_s} in predefined #{property.type.name} types\")\n end\n\n begin\n instance.send \"#{property.name}=\", value\n rescue RuntimeError => e\n raise RuntimeError, \"Cannot set property '#{property.name}' of Type #{@instance.class.name}: #{e}\", e.backtrace\n end\n end\n else\n # Multi-valued properties are added to by their singular name\n define_singleton_method property.name.singularize do |*property_values, &block|\n existing_list = instance.send \"#{property.name}\"\n\n unless property_values.empty?\n # If there is just one parameter for a multi-valued property setter\n if property_values.length == 1\n # It could be a symbol, which would resolve to a predefined type instance of the same name\n if property_values[0].is_a?(Symbol)\n predefined_value = compendium.type_instances[property.type][property_values[0]]\n\n raise \"Could not find instance :#{property_values[0]} in predefined #{property.type.name} types\" unless predefined_value\n\n existing_list << compendium.type_instances[property.type][property_values[0]]\n # Or better: it could already be an instance of the type - e.g. when using the implemented #method_mssing\n elsif property_values[0].is_a? property.type\n existing_list << property_values[0]\n end\n else\n new_list_item = property.type.new\n\n set_value(property.type, new_list_item, *property_values)\n\n self.class.new(new_list_item, @compendium).instance_exec(&block) unless block.nil?\n\n existing_list << new_list_item\n end\n end\n end\n end\n end\n end", "def type ; metadata[:type] ; end", "def fetch_upstream_primitive(attr)\n registered_properties[attr].type\n end", "def create_property_getter(property)\n # meth = property.name\n class_eval <<-EOS, __FILE__, __LINE__ + 1\n def #{property.name}\n self['#{property.name}']\n end\n EOS\n\n if property.type == 'boolean'\n class_eval <<-EOS, __FILE__, __LINE__\n def #{property.name}?\n if self['#{property.name}'].nil? || self['#{property.name}'] == false || self['#{property.name}'].to_s.downcase == 'false'\n false\n else\n true\n end\n end\n EOS\n end\n\n if property.alias\n class_eval <<-EOS, __FILE__, __LINE__ + 1\n alias #{property.alias.to_sym} #{property.name.to_sym}\n EOS\n end\n end", "def each_type\n @mappings.each do |mapping|\n yield mapping.type\n end\n end", "def sproc_type=(type)\n @sproc_type = type\n @opts[:sql] = ''\n end", "def type\n requires_preauth\n app\n formation = get_formation\n changes = if args.any?{|arg| arg =~ /=/}\n args.map do |arg|\n if arg =~ /^([a-zA-Z0-9_]+)=([\\w-]+)$/\n type, new_size = $1, $2\n current_p = formation.find{|f| f[\"type\"] == type}\n if current_p.nil?\n error(\"Type '#{type}' not found in process formation.\")\n end\n p = current_p.clone\n p[\"size\"] = new_size\n p\n end\n end.compact\n elsif args.any?\n size = shift_argument.downcase\n validate_arguments!\n formation.map{|p| p[\"size\"] = size; p}\n end\n scale_dynos(formation, changes) if changes\n display_dyno_type_and_costs(get_formation)\n end", "def process_property\n property.strip!\n value.strip!\n\n self.value = Regexp.last_match(1) if value =~ %r{\\A\"(.*)(?<!\\\\)\"\\z}m\n\n section[property] = typecast(value)\n\n self.property = nil\n self.value = nil\n end", "def type\n :puppet_type\n end", "def process(exp)\n return nil if exp.nil?\n\n result = nil\n\n type = exp.first\n raise \"Type should be a Symbol, not: #{exp.first.inspect} in #{exp.inspect}\" unless Symbol === type\n\n in_context type do\n # now do a pass with the real processor (or generic)\n meth = @processors[type]\n if meth then\n result = self.send(meth, exp)\n else\n result = self.process_default(exp)\n end\n end\n\n raise SexpTypeError, \"Result must be a #{@expected}, was #{result.class}:#{result.inspect}\" unless @expected === result\n\n result\n end", "def register_type(type, &block)\n register CastWhenType.new(type, &block)\n end", "def get_type\n\n end", "def primitive_type(attr)\n case\n when serialized_properties.include?(attr)\n serialized_properties[attr]\n when magic_typecast_properties.include?(attr)\n magic_typecast_properties[attr]\n else\n fetch_upstream_primitive(attr)\n end\n end", "def property_type_params\n params.require(:property_type).permit(:property_type)\n end", "def type \n\t\n\t$cst.add_branch(\"type\")\n\t\n\tmatch_token(\"T_TYPE\", $tokens[$index])\n\t\n\t$cst.ascend\nend", "def type(type = nil, &block)\n return @type unless type\n @type = Apigen::Model.type type, &block\n end", "def validated_parser_type(type); end", "def define_type_on_metric_def_if_needed\n unless Hawkular::Metrics::MetricDefinition.respond_to? :type\n Hawkular::Metrics::MetricDefinition.class_eval do\n def type\n return @type\n end\n\n def type= (t)\n @type = t\n end\n end\n end\n end", "def default_processor_type\n :base\n end", "def type() end", "def file_type(property: 'file')\n params.dig property, :type\n end", "def use(processor)\n definition << processor\n processor\n end", "def type=(_); end", "def type=(_); end", "def type=(_); end", "def type=(_); end" ]
[ "0.7112839", "0.6958294", "0.6858634", "0.6238908", "0.6230018", "0.6227938", "0.6150707", "0.6118763", "0.6111717", "0.60464376", "0.60255194", "0.59862924", "0.59661144", "0.5879526", "0.57871073", "0.5760827", "0.56870794", "0.56554484", "0.5640617", "0.56213623", "0.5621172", "0.5605902", "0.5597978", "0.5583472", "0.55580074", "0.5537047", "0.5511244", "0.54196435", "0.5407351", "0.5407351", "0.5385962", "0.5385962", "0.53359485", "0.53318053", "0.53292865", "0.5322348", "0.5322133", "0.5309147", "0.5304918", "0.5302279", "0.5294136", "0.5292744", "0.52451575", "0.5240943", "0.5228203", "0.5217859", "0.5212074", "0.52111447", "0.521028", "0.52078754", "0.5175396", "0.51735044", "0.51725066", "0.51717126", "0.51710504", "0.5168216", "0.51630914", "0.516208", "0.51530993", "0.5140397", "0.5138832", "0.51231164", "0.5121758", "0.5117371", "0.5116463", "0.51116294", "0.5109814", "0.5103612", "0.5093923", "0.50857586", "0.50796455", "0.50675076", "0.5067151", "0.50525606", "0.5043782", "0.5035758", "0.5030109", "0.5024546", "0.5019815", "0.5012061", "0.5011015", "0.5009719", "0.5002479", "0.49916634", "0.49909818", "0.4986821", "0.4984751", "0.49826792", "0.49787223", "0.49783164", "0.49734014", "0.49713746", "0.49667755", "0.49639457", "0.4961614", "0.49587002", "0.49578473", "0.49578473", "0.49578473", "0.49578473" ]
0.80070204
0
Translate point coordinate [x,y] into Cell Index > Column equal as X axis > Row equal as Y axis
def cell(col, row) return nil if out_of_bound?(row, 0, Grid::MaxRow - 1) return nil if out_of_bound?(col, 0, Grid::MaxCol - 1) return (Grid::MaxCol * row) + col end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_for(x, y, coordinate_system=:row_col)\n case coordinate_system\n when :row_col\n x * 9 + y\n when :col_row\n y * 9 + x\n when :box\n [0,3,6,27,30,33,54,57,60][x] + [0,1,2,9,10,11,18,19,20][y]\n end\n end", "def cell_at_point(x, y)\n [x / Entity::WIDTH, y / Entity::HEIGHT ]\n end", "def idx(x, y)\n tx = x % @width\n ty = y % @height\n idx = tx + ty * @width\n end", "def index(x, y)\n (y - 1) * width + (x - 1)\n end", "def at(cell_x, cell_y)\n assert_ok_coords(cell_x, cell_y)\n @grid[cell_x - 1][cell_y - 1]\n end", "def coord_to_pos(row,col)\n return nil if row.even? && col.even? || row.odd? && col.odd? #these are always empty squares in checkers!\n return row*4+(col/2).floor+1\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 translate_index_to_grid_position(index)\n @grid_positions[index]\nend", "def get_cell(x, y)\n grid[x][y]\n end", "def xy_to_spot(x, y)\n spot = x + (y * @columns_size)\n end", "def point(index)\n return [index % Grid::MaxCol, index / Grid::MaxCol]\n end", "def cell(pos_x, pos_y)\n @board[pos_y][pos_x]\n end", "def [](row, col)\n #convert row values by * by 9\n @grid[row * 9 + col]\n end", "def position(input)\n cells[self.idx(input)]\n end", "def point_to_index(x,y)\n return (x*(bpp >> 3))+(y*((bpp >> 3)*(width)))\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 at(x, y)\n @codeGrid[y][x]\n end", "def right_cell_x_at(x); (x + WIDTH - 1) / WIDTH; end", "def at_index(x,y)\n @board[x][y]\n end", "def calc_coordinate(cell_name)\n col = COLUMNS.index(cell_name.slice /[A-Z]+/)\n row = (cell_name.slice /\\d+/).to_i - 1 # rows in drawings start with 0\n [row, col]\n end", "def xyz_to_index(x, y, z)\n case @cell_order\n when CELL_ORDER_COLS then (x % columns) +\n (y * columns) +\n (z * columns * rows)\n when CELL_ORDER_ROWS then (x * rows * layers) +\n (y % rows) +\n (z * rows)\n when CELL_ORDER_LAYS then (x * layers) +\n (y * layers * columns) +\n (z % layers)\n end\n end", "def from_xy(x, y)\n new(\n ((y - Constants::GRID_ORIGIN.y) / Constants::CELL_SIZE.height).floor,\n ((x - Constants::GRID_ORIGIN.x) / Constants::CELL_SIZE.width).floor\n )\n end", "def hint_idx_to_coord(i)\n j = i % SIZE\n\n if i >= 0 && i < SIZE\n # top\n r = (0..(SIZE-1)).to_a.map{ |a| {x: j, y: a} }\n elsif i >= SIZE && i < (SIZE * 2)\n r = (0..(SIZE-1)).to_a.reverse.map{ |a| {x: a, y: j} }\n elsif i >= (SIZE * 2) && i < (SIZE * 3)\n r = (0..(SIZE-1)).to_a.reverse.map{ |a| {x: (SIZE - 1) - j, y: a} }\n else\n r = (0..(SIZE-1)).to_a.map{ |a| {x: a, y: (SIZE - 1) - j} }\n end\n r\nend", "def hint_idx_to_coord(i)\n j = i % SIZE\n\n if i >= 0 && i < SIZE\n # top\n r = (0..(SIZE-1)).to_a.map{ |a| {x: j, y: a} }\n elsif i >= SIZE && i < (SIZE * 2)\n r = (0..(SIZE-1)).to_a.reverse.map{ |a| {x: a, y: j} }\n elsif i >= (SIZE * 2) && i < (SIZE * 3)\n r = (0..(SIZE-1)).to_a.reverse.map{ |a| {x: (SIZE - 1) - j, y: a} }\n else\n r = (0..(SIZE-1)).to_a.map{ |a| {x: a, y: (SIZE - 1) - j} }\n end\n r\nend", "def set_cell_coordinates\n x = 0\n while x < 6\n y = 0\n while y < 7\n grid[x][y].co_ord = [x + 1, y + 1]\n y += 1\n end\n x += 1\n end\n end", "def neighbor_cell_coordinates\n NEIGHBOR_OFFSETS.map { |coordinates| [row + coordinates[0], col + coordinates[1]] }\n end", "def getXYIndex(s)\n return s.y * @width + s.x;\n end", "def row(y)\n i = y - 1\n self.cells.where(y: i)\n end", "def cell_at(x, y)\n return nil if (x < 0 || y < 0)\n @cells[y][x] if @cells[y]\n end", "def position(pos)\n @cells[to_index(pos)]\n end", "def coordinate_list\n @board.each_index.inject([]) do |result,row_index|\n result.concat( \n @board[row_index].each_index.collect do |column_index|\n [row_index + 1, column_index + 1]\n end\n )\n end\n end", "def column(x)\n src.ysize.times.map { |y| src[x, y] }\n end", "def read_cell(x, y)\n offset = (y * @height) + x\n\n @cells[offset] if x >= 0 && y >= 0 && x < @width && y < @height\n end", "def position\n [row.position, column.position]\n end", "def cell(x, y)\n if x < 1 || x > DEFAULT_WIDTH || y < 1 || y > DEFAULT_WIDTH\n puts \"x and y should be between 1 and #{DEFAULT_WIDTH}\"\n return nil\n end\n cells[[x, y]]\n end", "def cell(row_num, col_num)\n return @puzzle[row_num][col_num]\n end", "def svg_coord(row, col)\n\t\t[col*10 + 5, row*10 + 5]\n\tend", "def coordinates_to_indices(x, y)\n [x - 1, y - 1]\n end", "def [](row,col)\n case col\n when 0...81\n @row_column[row][col]\n when 81...162\n @row_number[row][col - 81]\n when 162...243\n @column_number[row][col - 162]\n when 243...324\n @box_number[row][col - 243]\n else\n nil\n end\n end", "def row_ia(x, y)\n (0...layers).map { |z| xyz_toindex(x, y, z) }\n end", "def rowcol\n return self.row+@row_offset, self.col+@col_offset\n end", "def [](pos)\n row = pos.first\n col = pos.last\n @grid[row][col]\n end", "def coord2pos(x, y)\n (y % h)*w+(x % w)\n end", "def first_axis_index(index, coordinate_system=:row_col)\n case coordinate_system\n when :row_col\n (index / 9)\n when :col_row\n index % 9\n when :box\n (index / 27) * 3 + (index / 3) % 3\n end\n end", "def [](pos)\n x, y = pos\n grid[x][y]\n end", "def read(y, x)\n cy, cx = Vedeu::Geometry::Position[y, x].as_indices\n\n row = fetch(cells, cy)\n cell = fetch(row, cx)\n\n cell\n end", "def position(input)\n self.cells[self.input_to_index(input)]\n end", "def set_current_cell\n @current_cell = @map.cells_at[@x][@y]\n end", "def unit_at(x,y)\n cell = @cells.find {|cell| cell.x == x and cell.y == y }\n cell.unit.view if cell\n end", "def lookup(x, y, coordinate_system=:row_col)\n @board[index_for(x, y, coordinate_system)]\n end", "def [](pos)\n x, y = pos\n @grid[x][y]\n end", "def index_of x, y\n\t\tindex = (y* @width) + x\n\t\treturn index\n\tend", "def [](pos)\n x, y = pos\n @grid[x][y] \n end", "def [](pos) #pos = [1,2]\n # x, y = pos\n x = pos[0]\n y = pos[1]\n @rows[x][y] \n end", "def position(input)\n self.cells[input.to_i - 1]\n end", "def get_cell(x, y)\n get_cell_from_board(@board, x, y)\n end", "def index_of_position(row, col = 0)\n\t\tline_index(row) + col + 1\n\tend", "def position\n V[x, y]\n end", "def getMapIndex(x, y)\n return y * @width + x;\n end", "def position(input)\n\t\tcells[input.to_i - 1]\n\tend", "def [](pos)\n x, y = pos.first, pos[1]\n @grid[x][y]\n end", "def position(location)\n @cells[location.to_i - 1]\n end", "def position(location)\n @cells[location.to_i - 1]\n end", "def [](pos)\n x, y = pos\n @rows[x][y]\n end", "def coordinates\n row_values.product(col_values)\n end", "def position(input)\n @cells[input.to_i - 1]\n end", "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 column(x)\n i = x - 1\n self.cells.where(x: i)\n end", "def box_row_index\n\t\t\tcell / 27 \n\t\tend", "def piece_from(row_index, column_index)\n case direction\n when 'up'\n [row_index, column_index + 1]\n when 'down'\n [row_index, column_index - 1]\n when 'left'\n [row_index - 1, column_index]\n when 'right'\n [row_index + 1, column_index]\n when 'up-right'\n [row_index + 1, column_index + 1]\n when 'up-left'\n [row_index - 1, column_index + 1]\n when 'down-right'\n [row_index + 1, column_index - 1]\n when 'down-left'\n [row_index - 1, column_index - 1]\n when 'double-up'\n [row_index, column_index + 2]\n end\n end", "def position(input)\n cells[input.to_i-1]\n end", "def position(input)\n cells[input.to_i-1]\n end", "def [](pos)\n row, col = pos\n @grid[row][col]\n end", "def position(input)\n cells[input.to_i - 1]\n end", "def index_to_xyz(index)\n case @cell_order\n when CELL_ORDER_COLS then [(index) % columns,\n (index / columns) % rows,\n (index / (columns * rows)) % layers]\n when CELL_ORDER_ROWS then [(index / (rows * layers)) % columns,\n (index) % rows,\n (index / rows) % layers]\n when CELL_ORDER_LAYS then [(index / layers) % columns,\n ((index / (layers * columns)) % rows),\n (index) % layers]\n end\n end", "def get_coordinates(cell)\n row = @cell_coordinates[cell][0]\n col = @cell_coordinates[cell][1]\n [row, col]\n end", "def row(p)\n x = p * (p - 1)\n y = x + p - 1\n x.upto(y) {|i| cell(p.odd? ? x - i + y : i) }\n end", "def xy(offset_x, offset_y)\n @board[3 * offset_y + offset_x - 4]\n end", "def getCell(x, y)\n return @grid.getCell(x,y)\n end", "def cal_pos\n x, y = map_location(@grid_x, @grid_y)\n x += @tile_size/2\n y += @tile_size/2\n [x,y]\n end", "def indices2coords(i,j)\n row = i2row(i)\n col = j2col(j)\n \"#{row}#{col}\"\n end", "def index_line_and_col(index) \n\t\ti = 0\n\t\ti += 1 while index_of_position(i) <= index\n\t\ti -= 1\n\t\t[i, index - index_of_position(i)]\n\tend", "def realToIndex(x,y,z) \n @my_ii = Grid.nearest(x,@mD.xStart,@mD.xIncr)\n @my_jj = Grid.nearest(y,@mD.yStart,@mD.yIncr)\n @my_doy = z\n # puts \"realToIndex: x #{x}, xStart #{@mD.xStart}, xIncr #{@mD.xIncr} myX #{@my_ii}; y #{y}, myY #{@my_jj} z #{z}, myZ #{@my_doy}\"\n [@my_ii,@my_jj,@my_doy]\n end", "def [](pos)\n row, col = pos\n grid[row][col]\n end", "def [](pos)\n row, col = pos\n grid[row][col]\n end", "def get_at(point)\n board[coords_to_pos(point)]\n end", "def axis_index(index, coordinate_system)\n case coordinate_system\n when :row_col\n index\n when :col_row\n 9 + index\n when :box\n 18 + index\n end\n end", "def position(input)\n @cells[input.to_i-1]\n end", "def next_cell(grid)\n grid.each_with_index do |row, x|\n row.each_with_index do |cell, y|\n return x, y if cell.length > 1\n end\n end\n end", "def [](pos)\n self.grid[pos[1]][pos[0]]\n end", "def row_to_px row_number\n\n # Row 0 starts 5 units below the top of the grid.\n # Each row afterward is 20 units lower.\n grid.top.shift_down(5).shift_down(20 * row_number)\n end", "def new_coords(x, y)\n [x % GRID_WIDTH, y % GRID_HEIGHT]\n end", "def marker_coords(marker)\n row = @grid.find_index { |x| x.include?(marker) }\n col = @grid[row].index(marker)\n\n [col, row]\n end", "def [](pos)\n row, col = pos\n @grid[row][col]\n end", "def [](pos)\n row, col = pos \n @grid[row][col]\n end", "def position(input)\n cell_index_taken = input.to_i-1\n cells[cell_index_taken]\n end", "def tile(y, x, matrix)\n matrix[y - 1 .. y + 1].map {|line| line[x - 1 .. x + 1]}\n end", "def get_block_coords(x, y)\n return (@padding + x * @cell_size), (@padding + y * @cell_size)\n end", "def [](pos)\n r, c = pos[0],pos[1]\n grid[r][c]\n end", "def cell(row_index, column_index)\n row(row_index).cell(column_index)\n end" ]
[ "0.7506393", "0.7349322", "0.6882335", "0.68398154", "0.6835803", "0.6808199", "0.67710584", "0.6763946", "0.6744747", "0.6737701", "0.66860825", "0.66803294", "0.66571987", "0.66341007", "0.6610396", "0.6601868", "0.6540601", "0.653739", "0.6522508", "0.65207195", "0.6499667", "0.64928144", "0.6492491", "0.6492491", "0.648813", "0.647343", "0.64671475", "0.64640385", "0.64550567", "0.64453554", "0.64433324", "0.6442892", "0.64387727", "0.6427089", "0.64154893", "0.6398215", "0.6370657", "0.6358392", "0.63465774", "0.633185", "0.6321894", "0.63216454", "0.63188136", "0.6299648", "0.62933254", "0.6284492", "0.6281477", "0.628039", "0.62801147", "0.62774163", "0.6259916", "0.62590855", "0.6249704", "0.6248572", "0.6246649", "0.6237054", "0.6236094", "0.62312543", "0.6230087", "0.6224046", "0.6223132", "0.6221995", "0.6221995", "0.6220449", "0.62163836", "0.62153417", "0.6214989", "0.62148607", "0.6202542", "0.61999655", "0.6196058", "0.6196058", "0.61947167", "0.61868924", "0.6185468", "0.61847836", "0.6175704", "0.6175323", "0.615628", "0.6150285", "0.6143301", "0.61401075", "0.6139666", "0.6137891", "0.6137891", "0.61252636", "0.6122829", "0.611955", "0.6117118", "0.6115543", "0.6103435", "0.6096422", "0.60867137", "0.60856247", "0.6083862", "0.60828155", "0.60798436", "0.6078953", "0.6076783", "0.60761976" ]
0.6329584
40
Translate cell index into point [x,y]
def point(index) return [index % Grid::MaxCol, index / Grid::MaxCol] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cell_at_point(x, y)\n [x / Entity::WIDTH, y / Entity::HEIGHT ]\n end", "def translate_index_to_grid_position(index)\n @grid_positions[index]\nend", "def at(cell_x, cell_y)\n assert_ok_coords(cell_x, cell_y)\n @grid[cell_x - 1][cell_y - 1]\n end", "def index_for(x, y, coordinate_system=:row_col)\n case coordinate_system\n when :row_col\n x * 9 + y\n when :col_row\n y * 9 + x\n when :box\n [0,3,6,27,30,33,54,57,60][x] + [0,1,2,9,10,11,18,19,20][y]\n end\n end", "def position(input)\n cells[self.idx(input)]\n end", "def position(pos)\n @cells[to_index(pos)]\n end", "def cell_index_array\n use_default_index ? 0.upto(points - 1) : concatenate_data_arrays('index', 'cells')\n end", "def getCoords (index)\n return index%10, index/10\n end", "def cell(pos_x, pos_y)\n @board[pos_y][pos_x]\n end", "def get_coordinates(cell)\n row = @cell_coordinates[cell][0]\n col = @cell_coordinates[cell][1]\n [row, col]\n end", "def get_point(pos)\n @grid[pos[0]][pos[1]]\n end", "def point_to_index(x,y)\n return (x*(bpp >> 3))+(y*((bpp >> 3)*(width)))\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 get_cell(x, y)\n grid[x][y]\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 cell_at(x, y)\n return nil if (x < 0 || y < 0)\n @cells[y][x] if @cells[y]\n end", "def hint_idx_to_coord(i)\n j = i % SIZE\n\n if i >= 0 && i < SIZE\n # top\n r = (0..(SIZE-1)).to_a.map{ |a| {x: j, y: a} }\n elsif i >= SIZE && i < (SIZE * 2)\n r = (0..(SIZE-1)).to_a.reverse.map{ |a| {x: a, y: j} }\n elsif i >= (SIZE * 2) && i < (SIZE * 3)\n r = (0..(SIZE-1)).to_a.reverse.map{ |a| {x: (SIZE - 1) - j, y: a} }\n else\n r = (0..(SIZE-1)).to_a.map{ |a| {x: a, y: (SIZE - 1) - j} }\n end\n r\nend", "def hint_idx_to_coord(i)\n j = i % SIZE\n\n if i >= 0 && i < SIZE\n # top\n r = (0..(SIZE-1)).to_a.map{ |a| {x: j, y: a} }\n elsif i >= SIZE && i < (SIZE * 2)\n r = (0..(SIZE-1)).to_a.reverse.map{ |a| {x: a, y: j} }\n elsif i >= (SIZE * 2) && i < (SIZE * 3)\n r = (0..(SIZE-1)).to_a.reverse.map{ |a| {x: (SIZE - 1) - j, y: a} }\n else\n r = (0..(SIZE-1)).to_a.map{ |a| {x: a, y: (SIZE - 1) - j} }\n end\n r\nend", "def set_current_cell\n @current_cell = @map.cells_at[@x][@y]\n end", "def index(x, y)\n (y - 1) * width + (x - 1)\n end", "def index_to_xyz(index)\n case @cell_order\n when CELL_ORDER_COLS then [(index) % columns,\n (index / columns) % rows,\n (index / (columns * rows)) % layers]\n when CELL_ORDER_ROWS then [(index / (rows * layers)) % columns,\n (index) % rows,\n (index / rows) % layers]\n when CELL_ORDER_LAYS then [(index / layers) % columns,\n ((index / (layers * columns)) % rows),\n (index) % layers]\n end\n end", "def position(cell)\n index = cell.to_i - 1\n (index >= 0 && index <= 8) ? self.cells[index] : nil\n end", "def cell(row_num, col_num)\n return @puzzle[row_num][col_num]\n end", "def position\n V[x, y]\n end", "def at_index(x,y)\n @board[x][y]\n end", "def index2point(x)\n\t\treturn (@tam_ancho/2-x)\n\tend", "def get_at(point)\n board[coords_to_pos(point)]\n end", "def xy_to_spot(x, y)\n spot = x + (y * @columns_size)\n end", "def right_cell_x_at(x); (x + WIDTH - 1) / WIDTH; end", "def at(x, y)\n @codeGrid[y][x]\n end", "def cell(row_index, column_index)\n row(row_index).cell(column_index)\n end", "def position(location)\n @cells[location.to_i - 1]\n end", "def position(location)\n @cells[location.to_i - 1]\n end", "def svg_coord(row, col)\n\t\t[col*10 + 5, row*10 + 5]\n\tend", "def [](row, col)\n #convert row values by * by 9\n @grid[row * 9 + col]\n end", "def realToIndex(x,y,z) \n @my_ii = Grid.nearest(x,@mD.xStart,@mD.xIncr)\n @my_jj = Grid.nearest(y,@mD.yStart,@mD.yIncr)\n @my_doy = z\n # puts \"realToIndex: x #{x}, xStart #{@mD.xStart}, xIncr #{@mD.xIncr} myX #{@my_ii}; y #{y}, myY #{@my_jj} z #{z}, myZ #{@my_doy}\"\n [@my_ii,@my_jj,@my_doy]\n end", "def coord_to_pos(row,col)\n return nil if row.even? && col.even? || row.odd? && col.odd? #these are always empty squares in checkers!\n return row*4+(col/2).floor+1\n end", "def indices2coords(i,j)\n row = i2row(i)\n col = j2col(j)\n \"#{row}#{col}\"\n end", "def [](pos)\n self.grid[pos[1]][pos[0]]\n end", "def position(input)\n @cells[input.to_i - 1]\n end", "def calc_coordinate(cell_name)\n col = COLUMNS.index(cell_name.slice /[A-Z]+/)\n row = (cell_name.slice /\\d+/).to_i - 1 # rows in drawings start with 0\n [row, col]\n end", "def position(input)\n cell_index_taken = input.to_i-1\n cells[cell_index_taken]\n end", "def position(input)\n cells[input.to_i - 1]\n end", "def position(input)\n self.cells[input.to_i - 1]\n end", "def position(input)\n cells[input.to_i-1]\n end", "def position(input)\n cells[input.to_i-1]\n end", "def idx(x, y)\n tx = x % @width\n ty = y % @height\n idx = tx + ty * @width\n end", "def position(input)\n\t\tcells[input.to_i - 1]\n\tend", "def neighbor_cell_coordinates\n NEIGHBOR_OFFSETS.map { |coordinates| [row + coordinates[0], col + coordinates[1]] }\n end", "def piece_from(row_index, column_index)\n case direction\n when 'up'\n [row_index, column_index + 1]\n when 'down'\n [row_index, column_index - 1]\n when 'left'\n [row_index - 1, column_index]\n when 'right'\n [row_index + 1, column_index]\n when 'up-right'\n [row_index + 1, column_index + 1]\n when 'up-left'\n [row_index - 1, column_index + 1]\n when 'down-right'\n [row_index + 1, column_index - 1]\n when 'down-left'\n [row_index - 1, column_index - 1]\n when 'double-up'\n [row_index, column_index + 2]\n end\n end", "def getXYIndex(s)\n return s.y * @width + s.x;\n end", "def set_cell_coordinates\n x = 0\n while x < 6\n y = 0\n while y < 7\n grid[x][y].co_ord = [x + 1, y + 1]\n y += 1\n end\n x += 1\n end\n end", "def position(input)\n self.cells[self.input_to_index(input)]\n end", "def get_point_position(index)\n MSPhysics::Newton::CurvySlider.get_point_position(@address, index)\n end", "def get_point_position(index)\n MSPhysics::Newton::CurvySlider.get_point_position(@address, index)\n end", "def [](pos)\n x, y = pos\n @grid[x][y] \n end", "def [](pos)\n x, y = pos\n @grid[x][y]\n end", "def position(input)\n @cells[input.to_i-1]\n end", "def coords_to_pos(point)\n (size - 1 - point.y) * size + point.x\n end", "def cell(x, y)\n if x < 1 || x > DEFAULT_WIDTH || y < 1 || y > DEFAULT_WIDTH\n puts \"x and y should be between 1 and #{DEFAULT_WIDTH}\"\n return nil\n end\n cells[[x, y]]\n end", "def [](pos)\n x, y = pos\n grid[x][y]\n end", "def xyz_to_index(x, y, z)\n case @cell_order\n when CELL_ORDER_COLS then (x % columns) +\n (y * columns) +\n (z * columns * rows)\n when CELL_ORDER_ROWS then (x * rows * layers) +\n (y % rows) +\n (z * rows)\n when CELL_ORDER_LAYS then (x * layers) +\n (y * layers * columns) +\n (z % layers)\n end\n end", "def [](pos)\n x, y = pos.first, pos[1]\n @grid[x][y]\n end", "def piece_at(position)\n row = position[0]\n col = position[1]\n @grid[row][col]\n end", "def [](pos)\n row = pos.first\n col = pos.last\n @grid[row][col]\n end", "def cal_pos\n x, y = map_location(@grid_x, @grid_y)\n x += @tile_size/2\n y += @tile_size/2\n [x,y]\n end", "def grid_point_to_absolute(point)\n Point.new((@pos.x + point.x * @cellsize).to_i, (@pos.y + point.y * @cellsize).to_i)\n end", "def convert(loc)\n row = loc[1].to_i\n col = @hash[loc[0]]\n return [row,col]\n end", "def position\n [x, y]\n end", "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 cell(cell)\n @board[cell]\n end", "def getIndex (x,y)\n return y*10 + x\n end", "def coordinate_list\n @board.each_index.inject([]) do |result,row_index|\n result.concat( \n @board[row_index].each_index.collect do |column_index|\n [row_index + 1, column_index + 1]\n end\n )\n end\n end", "def cellAt(row, col)\n\t\treturn @rows[row][col]\n\tend", "def [](pos)\n row, col = pos\n @grid[row][col]\n end", "def [](index)\n case index\n when 0, -2 then @x # Index 0 (or -2) is the X coordinate\n when 1, -1 then @y # Index 1 (or -1) is the Y coordinate\n when :x, \"x\" then @x # Hash keys as symbol or string for X\n when :y, \"y\" then @y # Hash keys as symbol or string for Y\n else nil # Arrays and hashes just return nil on bad indexes\n end\n end", "def position\n [row.position, column.position]\n end", "def row_at(row_idx)\n @grid[row_idx]\n end", "def read_cell(x, y)\n offset = (y * @height) + x\n\n @cells[offset] if x >= 0 && y >= 0 && x < @width && y < @height\n end", "def getCell(x, y)\n return @grid.getCell(x,y)\n end", "def at(row = @row, col = @col)\n row, col = wrap(row, col)\n return nil unless in_bounds?(row, col)\n\n @cells[row][col]\n end", "def next_cell(grid)\n grid.each_with_index do |row, x|\n row.each_with_index do |cell, y|\n return x, y if cell.length > 1\n end\n end\n end", "def[](index)\n\t\tcase index\n\t\twhen 0, -2 then @x\n\t\twhen 1, -1 then @y\n\t\twhen :x, \"x\" then @x\n\t\twhen :y, \"y\" then @y\n\t\telse nil\n\t\tend\n\tend", "def[](index)\n\t\tcase index\n\t\twhen 0, -2 then @x\n\t\twhen 1, -1 then @y\n\t\twhen :x, \"x\" then @x\n\t\twhen :y, \"y\" then @y\n\t\telse nil\n\t\tend\n\tend", "def []( index )\n case index\n when 0\n @x\n when 1\n @y\n else\n nil\n end\n end", "def mouseover_cell(loc)\n mouse_cell_x = loc[:x].to_i / @box_side_length.to_i\n mouse_cell_y = loc[:y].to_i / @box_side_length.to_i\n {x: mouse_cell_x, y: mouse_cell_y, z: 0}\n end", "def cell(col, row)\n return nil if out_of_bound?(row, 0, Grid::MaxRow - 1)\n return nil if out_of_bound?(col, 0, Grid::MaxCol - 1)\n return (Grid::MaxCol * row) + col\n end", "def row(y)\n i = y - 1\n self.cells.where(y: i)\n end", "def coord_to_index(piece, board)\n all_coordinates = board.keys\n index = all_coordinates.index(piece.position.to_sym) \n end", "def position\n [ChessBoard.col_index(pos[0]), pos[1].to_i]\n end", "def set_cell(matrix,cell,state,x,y)\r\n cell=Cell.new(state,x,y)\r\n matrix[[cell.x,cell.y]]=cell\r\nend", "def [](pos)\n row, col = pos\n grid[row][col]\n end", "def [](pos)\n row, col = pos\n grid[row][col]\n end", "def [](pos)\n grid[pos[0]][pos[1]]\n end", "def column(x)\n i = x - 1\n self.cells.where(x: i)\n end", "def convert_to_piece_position(coordinates)\n alpha = ('a'..'h').to_a\n\n row_index, column_index = coordinates\n\n alpha[row_index-1] + column_index.to_s\n end", "def index(p0) end", "def index(p0) end", "def [](pos) #pos = [1,2]\n # x, y = pos\n x = pos[0]\n y = pos[1]\n @rows[x][y] \n end", "def cursor_value(row_idx: c_y, col_idx: c_x)\n map.value(row_idx, col_idx)\n end" ]
[ "0.73571724", "0.70152014", "0.6968396", "0.67127645", "0.66602886", "0.6650141", "0.6579846", "0.65721875", "0.6539108", "0.6531649", "0.65258586", "0.65044814", "0.64949375", "0.64486504", "0.6445936", "0.64458525", "0.64177966", "0.64177966", "0.6416286", "0.6414701", "0.64144003", "0.6402134", "0.6394633", "0.63886315", "0.636841", "0.6361715", "0.6343254", "0.63242805", "0.6308379", "0.629169", "0.6283366", "0.6261059", "0.6261059", "0.62290376", "0.6207408", "0.62038517", "0.6190329", "0.6189394", "0.61839646", "0.6183631", "0.618073", "0.6178378", "0.61750585", "0.6173476", "0.6169865", "0.6169865", "0.6155592", "0.6138931", "0.6133732", "0.613314", "0.6130918", "0.6128883", "0.6127755", "0.6120733", "0.6120733", "0.60692906", "0.6068315", "0.6064566", "0.606106", "0.60539454", "0.60268414", "0.60223925", "0.6019067", "0.60067236", "0.6000017", "0.5993165", "0.5991574", "0.59788656", "0.59706336", "0.5966038", "0.59659386", "0.5962143", "0.5959345", "0.5942286", "0.5934905", "0.59286135", "0.59254223", "0.59218866", "0.59179306", "0.5910181", "0.59074944", "0.59032667", "0.5898121", "0.5898121", "0.5896172", "0.587829", "0.58731824", "0.5872727", "0.5864987", "0.5864707", "0.58642656", "0.5863216", "0.5863216", "0.586285", "0.5860069", "0.5858304", "0.5846307", "0.5846307", "0.58436394", "0.5836025" ]
0.7227134
1
Simply check if the value is out of bound
def out_of_bound?(value, min, max) return value > max || value < min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def out_of_range?\n value < 1 || value > 12\n end", "def out_of_range?(v)\n v < 1 || v > 12\n end", "def check_bounds(value)\n return value >= self.bound.lower_bound && value <= self.bound.upper_bound\n end", "def check_value\n if var == \"limit\" && value.to_i < 1\n raise \"Limit should be at least 1\"\n end\n end", "def exceeds_limit?(limit_value)\n !!(limit_value && sliced_nodes.limit(limit_value + 1).count > limit_value)\n end", "def out_of_range(value, expected_range, msg = nil)\n raise ValueRangeError.exception(value, expected_range, msg)\n end", "def out_of_bounds?(x,y)\n x < 0 || y < 0 || x > @size - 1 || y > @size - 1\n end", "def limit_reached?\n end", "def within_bounds?\n !exceeded?\n end", "def valid_range?\n (0..@max_num).cover?(@number)\n end", "def out_of_bounds?\n current_page > page_count\n end", "def limit_reached?\n @count >= @max\n end", "def out_of_bounds?(x, y, lower_limit = 0, upper_limit = 4)\n (x < lower_limit or y < lower_limit) or (x > upper_limit or y > upper_limit)\n end", "def verify_limits(value, limit1, limit2) #method\n value = get_value(value)\n if !value.between?(limit1, limit2)\n puts \"Fatal Error: #{value} exceeds limit.\"\n exit\n end\n end", "def out_of_bounds?\n current_page > total_pages\n end", "def eligible?(n)\n n < @limit\n end", "def in_range?(index)\n index >= 0 and index < size\n end", "def greater_or_equal_to?(value, limit)\n integer?(value) && value >= limit\n end", "def out_of_bounds?\n current_page > total_pages\n end", "def exceeded?(amount = 1)\n used + amount > max\n end", "def index_out_of_bounds?(index)\n return false if index == 0\n count == 0 || !(-(count - 1)..(count - 1)).include?(index)\n end", "def amount_inside_the_pot_bounds\n return if pot.nil?\n return true if pot.upper_bound.nil?\n return true if amount <= pot.upper_bound\n errors.add(:amount, :amount_out_of_bounds)\n false\n end", "def out_of_bounds?(x, y)\n x < 0 || y < 0 || x > @width - 1 || y > @height - 1\n end", "def out_of_range?\n current_page > total_pages\n end", "def bound(length)\n 0 <= self && self < length\n end", "def __assert_bounds(k)\n\t\tif k < 0 || k >= size\n\t\t\traise IndexError.new(\"index out of bounds for #{size}: #{k}\")\n\t\tend\n\t\treturn\n\tend", "def limit?() @limit; end", "def pos_out_of_range(position)\n Error \"Position out of range! (#{position}) given, \" \\\n \"but the minefield is #{@num_cells} long.\"\n end", "def should_be_limited?\n @options[:limit] == true or (@options[:limit].is_a?(Fixnum) and @options[:limit] > 0)\n end", "def exceeded?\n count >= threshold\n end", "def check_input_range\n if @position > 9 || @position < 1\n return false\n else return true\n end\n end", "def limitcheck(num, lower, upper)\n (num >= lower and num <= upper) && num\n end", "def limitcheck(num, lower, upper)\n (num >= lower and num <= upper) && num\n end", "def test_bounds(val, min, max)\n val >= min && val <= max\n end", "def valid?(value)\n return value >= 0 && value <= 19\n end", "def check_limit\n if user.pins.count >= user.pins_limit\n errors[:base] << \"Pins limit reached\"\n end\n end", "def __assert_bounds(i)\n\t\tif i < 0 || i >= size\n\t\t\traise IndexError.new(\"index out of bounds for #{size}: #{i}\")\n\t\tend\n\t\treturn\n\tend", "def __assert_bounds(i)\n\t\tif i < 0 || i >= size\n\t\t\traise IndexError.new(\"index out of bounds for #{size}: #{i}\")\n\t\tend\n\t\treturn\n\tend", "def valid_index?(index)\n index >= 0 && index < self.length\n end", "def check_index(index)\n index = 0 if index == :all\n index = index.to_i\n raise \"Invalid index #{index}, valid values [1 - #{size}]\" \\\n if index.is_a?(Integer) && index > size\n index\n end", "def check_value_boundaries\n if (@lines < 9 || @columns < 20)\n raise ArgumentError, \" Error: The terminal size is to small for scaled output\".red\n end\n end", "def in_range (n)\n\tif n <1 || n> 10 \n\t\tfalse\n\telse\n\t\ttrue\n\tend\nend", "def empty?\n return false if @upper_bound.nil?\n @lower_bound > @upper_bound\n end", "def has_limit?\n !@options[:limit].blank?\n end", "def outofBounds\n\t\tif @x > @window.width || @y > @window.height || @x < 0 || @y < 0 then\n\t\t\treturn true\n\t\tend\n\t\treturn false\n\tend", "def validate_size\n @num_mines <= MAX_SIZE\n end", "def check_max_exits\n max = ts_max_exits || 1\n\n if max_destinations_for_time_segment < max\n errors.add(:max_destinations_for_time_segment, \"must be greater than or equal to #{max}, the maximum number of destinations on an already existing time segment\")\n end\n end", "def small_enough(a, limit)\n a.max <= limit\nend", "def valid_number?(num)\n (1..@length).freeze.include? num\n end", "def more_than_maximum?\n @maximum_values.each do |key, value|\n return false, :count => value unless bad?(value + 1, default_message_for(key))\n end\n true\n end", "def is_value?(value)\n\t\tvalue.to_i < 10\n\tend", "def small_enough(arr, limit)\n arr.max <= limit\nend", "def assert_in_range(index)\n raise IndexOutOfRange unless in_range? index\n end", "def _inbounds(index,matrix)\n if index[0] > matrix.row_size or index[0] < 0 or index[1] > matrix.column_size or index[1] < 0\n return false\n end\n return true\n end", "def param_check_nb(param, value)\n value = (param[:type] == 'int' ? value.to_i : value.to_f)\n if value < param[:min_value] || value > param[:max_value]\n write_output \"the value cannot be < #{param[:min_value]} or > #{param[:max_value]} for #{param[:string]} (#{param[:id]})\"\n return false\n end\n param_exec_value_change(param, value)\n end", "def check_range(start_byte, end_byte)\n if start_byte < 0 ||\n end_byte < 0 ||\n start_byte > end_byte ||\n start_byte > @length - 1 ||\n end_byte > @length - 1\n raise 'ByteArray :: out of range'\n end\n end", "def out_of_bounds?(line)\n line.each do |location|\n return true unless location[0].between?(0, 6)\n return true unless location[1].between?(0, 5)\n end\n false\n end", "def failed?\n @value == 0 || @value.to_i < 0\n end", "def checkError(n)\n\t\tif n > @error\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def out_of_bounds?\n (0..@grid_size[0]).cover?(@coordinates[0]) &&\n (0..@grid_size[1]).cover?(@coordinates[1])\n end", "def check_valid_num(index)\n (0..8).any?(index)\nend", "def bust?; value > 21; end", "def is_inbounds?(x, y)\n true unless y > @maze.max.size-1 or y < 0 or x > @maze.size-1 or x < 0\n end", "def out_of_bounds?(x, y)\n x >= (Game::Width - Game::Padding) || x <= (0 + Game::Padding) || y >= (Game::Height - Game::Padding) || y <= (0 + Game::Padding)\n end", "def arguments_valid?\n return false if @arguments.length != 2\n @number = @arguments[0].to_i\n @value = @arguments[1].to_i\n true if (@number > 0 && @value > (@number-1) && @value < (@number*6+1)) \n end", "def ubound(bound)\n self > bound ? bound : self\n end", "def valid_result_range\n self.result && self.result > -2 ? true : false\n end", "def value_limit\n if self.value < 30\n errors.add(:value, 'cannot be below R$ 50')\n elsif self.value > self.wallet\n errors.add(:value, 'cannot exceed your current wallet')\n elsif !self.value.%(50).zero?\n errors.add(:value, 'must be multiple of 50')\n elsif self.value > 5100\n errors.add(:value, 'cannot exceed R$ 5100')\n end\n end", "def max_value(value, pdef)\n if(value.to_i <= pdef['MaxValue'].to_i)\n true\n else\n \"Value must not be greater than #{pdef['MaxValue']}\"\n end\n end", "def valid_point_value?(value)\n value.is_a?(Integer) && value >= 0\n end", "def verify_range(value)\n a = (20...30) === value\n if a != true\n puts \"#{value} is not in range of 20 to 30\"\n else\n puts \"#{value} is in range of to 20 to 30\"\n end\nend", "def out_of_bounds?\n (0..@grid_size[0]).cover?(@coordinates[0]) &&\n (0..@grid_size[1]).cover?(@coordinates[1])\nend", "def in_range?( val )\n val = val.to_i\n (@above.nil? or val > @above) and\n (@below.nil? or val < @below) and\n (@valid_range.nil? or @valid_range.include?(val))\n end", "def in_range?( val )\n val = val.to_i\n (@above.nil? or val > @above) and\n (@below.nil? or val < @below) and\n (@valid_range.nil? or @valid_range.include?(val))\n end", "def restrict_to_bounds(value, lower = 1, upper = nil)\n value_i = value.to_i\n\n value_i = upper if !upper.blank? && value_i > upper\n value_i = lower if !lower.blank? && value_i < lower\n\n value_i\n end", "def upper_bound; end", "def get_upper_limit_of(range)\n range.max\nend", "def is_miss?\n sum < 10 && sum >= 0\n end", "def cashed_events_limit_not_reached?(max)\n max ? self.cashed_events_count < max : true\n end", "def lbound(arr,value)\r\n\tng,ok=-1,arr.size\r\n\twhile((ng-ok).abs>1) do\r\n\t\tmid=(ng+ok)/2\r\n\t\tif(arr[mid]>=value)\r\n\t\t\tok=mid\r\n\t\telse\r\n\t\t\tng=mid\r\n\t\tend\r\n\tend\r\n\treturn ok\r\nend", "def limit_exceeded(amount = 1)\n self if exceeded?(amount)\n end", "def out_of_bounds?(date)\n date < @available_date_range[:min] || date > @available_date_range[:max]\n end", "def size_exhausted?\n @size >= (MAX_BYTES - Defaults::Metric::MAX_BYTES)\n end", "def get_upper_limit_of(range)\n range.max\nend", "def is_in_limits? coordinate\n\t\t((coordinate[0][0] < @width) && (coordinate[0][1] < @height) && (coordinate[1][0] < @width) && (coordinate[1][1] < @height))\n\tend", "def validate_limit!(options)\r\n options[:limit] ||= MAXIMUM_LIMIT\r\n if options[:limit].to_i > MAXIMUM_LIMIT || options[:limit].to_i < 1\r\n raise InvalidLimit,\r\n \"limit must be a number between 1 and #{MAXIMUM_LIMIT}\"\r\n end\r\n\r\n options[:limit]\r\n end", "def valid_value?(value)\n @params.each_pair do |key, param|\n return false if key == :minimum && (value.nil? || value.length < param)\n return false if key == :maximum && !value.nil? && value.length > param\n return false if key == :exact && (value.nil? || value.length != param)\n end\n\n true\n end", "def is_out_of_boundary?(point)\n point.x < 0 || point.y < 0 || point.x >= @dimension || point.y >= @dimension\n end", "def in_range?\n self > LOWER_BOUND && self <= UPPER_BOUND\n end", "def over_limit?\n count > max_calls\n end", "def allow?(val = nil)\n val = val.nil? ? random_val : hashed_val(val)\n val < ramp_val\n end", "def allow?(val = nil)\n val = val.nil? ? random_val : hashed_val(val)\n val < ramp_val\n end", "def can_overflow?\n false\n end", "def below_limit?\n self.live_count < self::LIMIT\n end", "def between?(min, max)\n #This is a stub, used for indexing\n end", "def in_move_range?(v)\n (20..500).include? v\n end", "def validate_range(value)\n classname = value.class.to_s\n case classname\n when \"Range\" \n then value\n when \"Array\"\n then value\n else\n return (value..value)\n end\n end", "def is_within_limit\n unless self.artwork.has_room\n errors.add(:base, \"Artwork has too many images\")\n end\n end", "def _index_in_range?(i, max, min)\n !((i > max) || (i < min))\n end", "def get_upper_limit_of(range)\n range.end\nend" ]
[ "0.79258496", "0.75973123", "0.7396919", "0.7321022", "0.726353", "0.7210668", "0.71527046", "0.71438575", "0.7141677", "0.70944566", "0.7036176", "0.703582", "0.69669616", "0.69613254", "0.693714", "0.69370985", "0.6927298", "0.68954843", "0.6887002", "0.6816876", "0.67817044", "0.6759573", "0.6731503", "0.6710424", "0.6651764", "0.66416645", "0.6627127", "0.64963686", "0.649376", "0.6489449", "0.6487566", "0.6480775", "0.6480775", "0.64622116", "0.64588565", "0.64338", "0.6433439", "0.6433439", "0.64312524", "0.6430243", "0.6421375", "0.6416959", "0.63979197", "0.6392026", "0.63879645", "0.6361204", "0.635286", "0.633693", "0.63281685", "0.6310309", "0.62986004", "0.6295956", "0.629253", "0.62806445", "0.6267616", "0.6261087", "0.6252337", "0.624626", "0.62459576", "0.6245601", "0.62233335", "0.62077266", "0.6203385", "0.62024426", "0.6201889", "0.61885864", "0.6170382", "0.61522764", "0.61505294", "0.61498153", "0.6138644", "0.61360896", "0.6135716", "0.6135716", "0.6135193", "0.6133208", "0.61207026", "0.61132467", "0.6108828", "0.61047965", "0.61010677", "0.6097102", "0.60923904", "0.6089831", "0.6083747", "0.6069602", "0.60674876", "0.6061223", "0.60609424", "0.6057134", "0.6052859", "0.6052859", "0.6049491", "0.6049082", "0.60429025", "0.6039173", "0.6029796", "0.60247993", "0.60228384", "0.6022755" ]
0.7941162
0
TARGETING PART! Surrounding grid
def surrounding(index, directions = Grid::Movement, compact = true) result = directions.collect {|dir| neighbor(index, dir)} + [index] return result.compact.uniq if compact return result.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid(*)\n super\n end", "def carve_walls_from_point(x, y, grid)\n \nend", "def generate_surrounding_spaces(x, y)\n surround_array = []\n# Loop over 3x3 grid\n for i in x-1..x+1\n for j in y-1..y+1\n # Exclude the center square and ones not on the grid\n if ((i==x) && (j==y)) || !is_on_grid(i,j)\n next\n end\n surround_array.push([j, i])\n end\n end\n\n return surround_array\nend", "def fill_until(grid, target)\n limit = grid.size - 1\n # Four sides to do:\n # a b c\n # d • e\n # f g h\n\n # Right:\n (limit-1).downto(0) do |x|\n grid[x][limit] = [\n grid[x-1][limit-1].to_i, # a\n grid[x ][limit-1].to_i, # d\n grid[x+1][limit-1].to_i, # f\n grid[x+1][limit ].to_i, # g\n ].sum\n return grid[x][limit] if grid[x][limit] > target\n end\n\n # Top:\n (limit-1).downto(0) do |y|\n grid[0][y] = [\n grid[0 ][y+1].to_i, # e\n y.zero? ? 0 : grid[0+1][y-1].to_i, # f\n grid[0+1][y ].to_i, # g\n grid[0+1][y+1].to_i, # h\n ].sum\n return grid[0][y] if grid[0][y] > target\n end\n\n # Left:\n 1.upto(limit) do |x|\n grid[x][0] = [\n grid[x-1][0 ].to_i, # b\n grid[x-1][0+1].to_i, # c\n grid[x ][0+1].to_i, # e\n x == limit ? 0 : grid[x+1][0+1].to_i, # h\n ].sum\n return grid[x][0] if grid[x][0] > target\n end\n\n # Bottom:\n 1.upto(limit) do |y|\n grid[limit][y] = [\n y.zero? ? 0 : grid[limit-1][y-1].to_i, # a\n grid[limit-1][y ].to_i, # b\n grid[limit-1][y+1].to_i, # c\n y.zero? ? 0 : grid[limit ][y-1].to_i, # d\n ].sum\n return grid[limit][y] if grid[limit][y] > target\n end\n\n expand! grid\n fill_until(grid, target)\nend", "def grid\n if 1 <= poster_slot && poster_slot <= 66\n offset = 1\n number_per_row = 11\n total_rows = 6\n group = 1\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n elsif 67 <= poster_slot && poster_slot <= 96\n offset = 67\n number_per_row = 15\n group = 2\n total_rows = 2\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n elsif 97 <= poster_slot && poster_slot <= 144\n offset = 97\n number_per_row = 6\n group = 3\n total_rows = 8\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.odd? # invert\n elsif 145 <= poster_slot && poster_slot <= 184\n offset = 145\n number_per_row = 20\n group = 4\n total_rows = 2\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n elsif 185 <= poster_slot && poster_slot <= 284\n offset = 185\n number_per_row = 25\n group = 5\n total_rows = 4\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n elsif 285 <= poster_slot && poster_slot <= 314\n offset = 285\n number_per_row = 5\n group = 6\n total_rows = 6\n row = (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n else\n return nil\n end\n Grid.new(col, row, group)\n end", "def grid\n state.grid\n end", "def grid\n state.grid\n end", "def grid3d(*)\n super\n end", "def update\n update_grid = Array.new(@grid_height) { Array.new(@grid_width, 0) }\n update_grid.each_index do |row|\n update_grid[row].each_index do |col|\n num_neighbours = get_num_neighbours col, row\n if (@grid[row][col] == 1 && num_neighbours.between?(2, 3)) ||\n (@grid[row][col] == 0 && num_neighbours == 3)\n update_grid[row][col] = 1\n end\n end\n end\n @grid = update_grid\n end", "def drawGrid(cX, cY, gX, gY)\n\t# Convert number of intersections into city blocks that start at 0\n\tgX = gX - 2\n\tgY = gY - 2\n\t\n\tg = \"\\t\"\t\n\tfor i in 0..gY\n\t\tcY == 0 && cX == i ? g << \"X____\" : g << \" ____\"\n\tend\n\tg << \"\\n\\t\"\n\tfor i in 0..gY * 2\n\t\tif i % 2 == 0\n\t\t\tfor y in 0..gX\n\t\t\t\ty == gX ? g << \"| |\" : g << \"| \"\n\t\t\tend\n\t\telse\n\t\t\tfor y in 0..gX\n\t\t\t\ty == gX ? g << \"|____|\" : g << \"|____\"\n\t\t\tend\n\t\tend\n\t\tg << \"\\n\\t\"\n end\t\n\tfor i in 0..gY\n\t\ti == gY ? g << \"|____|\" : g << \"|____\"\t\n\tend\n\n\treturn g\nend", "def default_grid\n array = Array.new(8) { Array.new(8) }\n\n array[0][0] = Rook.new('white', [0,0], 'slide')\n array[1][0] = Knight.new('white', [1,0], 'step')\n array[2][0] = Bishop.new('white', [2,0], 'slide')\n array[3][0] = Queen.new('white', [3,0], 'slide')\n array[4][0] = King.new('white', [4,0], 'step')\n array[5][0] = Bishop.new('white', [5,0], 'slide')\n array[6][0] = Knight.new('white', [6,0], 'step')\n array[7][0] = Rook.new('white', [7,0], 'slide')\n array[0..7].each_with_index { |column, index| \n column[1] = Pawn.new('white', [index,1], 'step') }\n\n array[0][7] = Rook.new('black', [0,7], 'slide')\n array[1][7] = Knight.new('black', [1,7], 'step')\n array[2][7] = Bishop.new('black', [2,7], 'slide')\n array[3][7] = Queen.new('black', [3,7], 'slide')\n array[4][7] = King.new('black', [4,7], 'step')\n array[5][7] = Bishop.new('black', [5,7], 'slide')\n array[6][7] = Knight.new('black', [6,7], 'step')\n array[7][7] = Rook.new('black', [7,7], 'slide')\n array[0..7].each_with_index { |column, index| \n column[6] = Pawn.new('black', [index,6], 'step') }\n\n array\n end", "def connect_cells\n @grid.each_with_index do |columns, col_i|\n columns.each_with_index do |cell, cell_i|\n cell.left = @grid[col_i-1][cell_i] if col_i != 0 \n cell.up = @grid[col_i][cell_i+1] if cell_i + 1 < columns.length\n cell.right = @grid[col_i+1][cell_i] if col_i + 1 < @grid.length\n cell.down = @grid[col_i][cell_i-1] if cell_i != 0\n cell.lu = @grid[col_i-1][cell_i+1] if col_i != 0 && cell_i + 1 < columns.length\n cell.ld = @grid[col_i-1][cell_i-1] if col_i != 0 && cell_i != 0\n cell.ru = @grid[col_i+1][cell_i+1] if col_i + 1 < @grid.length && cell_i + 1 < columns.length\n cell.rd = @grid[col_i+1][cell_i-1] if col_i + 1 < @grid.length && cell_i != 0\n end\n end\n end", "def grid\n \t\t\tfinal, y = Array.new, 0\n \t\t\t@@axis.fetch(:y).times do\n \t\t\t\tfinal[y], x = Array.new, 0\n \t\t\t\t@@axis.fetch(:x).times do\n \t\t\t\t\tfinal[y][x] = init_coord(x, y)\n \t\t\t\t\tx += 1\n \t\t\t\tend\n \t\t\t\ty += 1\n\t\t\tend\n\t\t\tfinal.reverse\n\t\tend", "def up\n @y.positive? ? $theGrid[@y-1][@x] : nil\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 render_grid\n\t\t@grid_w.times.with_index do |x|\n\t\t\t@grid_h.times.with_index do |y|\n\t\t\t\tif !@has_enviroment_rendered\n \t \t\trender_wall x, y if @grid[x][y]==1\n\t\t\t\tend\n\t\t \trender_player x, y if @grid[x][y]==2\n \tend\n end\n #each_cell do |x, y, v|\n # render_wall x, y if !@has_environment_rendered && v == 1 \n # render_player x, y if v == 2\n #end\n\t\t@has_enviroment_rendered = true\n\tend", "def part2(grid)\n grid.non_overlapping.id\nend", "def draw_grid\n print_cap\n (0...@vertical).each do |vert_index|\n (0..@v_size).each do |block_height|\n (0...@horizontal).each do |horizontal_index|\n if block_height == (@v_size/2)\n print \"|\" + \" \"*(@h_size/2)\n \"#{print @contents[horizontal_index][vert_index]}|\"\n print \" \"*(@h_size/2-1)\n else\n print \"|\"; print \" \"*@h_size\n end\n end\n print \"|\\n\" \n \n end\n print_cap\n end\n end", "def sink(y, x, grid)\n return if grid[y][x] == 0\n grid[y][x] = 0\n sink(y - 1, x, grid) if y > 0\n sink(y, x - 1, grid) if x > 0\n sink(y + 1, x, grid) if y < grid.length - 1\n sink(y, x + 1, grid) if x < grid[y].length - 1\nend", "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 draw_grid\n case view\n when :south_east\n size_y.times do |y|\n size_x.times do |x|\n draw_tile(x, y, x, y)\n end\n end\n when :south_west\n size_x.times do |y|\n size_y.times do |x|\n draw_tile(x, y, size_x - 1 - y, x)\n end\n end\n when :north_west\n size_y.times do |y|\n size_x.times do |x|\n draw_tile(x, y, size_x - 1 - x, size_y - 1- y)\n end\n end\n when :north_east\n size_x.times do |y|\n size_y.times do |x|\n draw_tile(x, y, y, size_y - 1 - x)\n end\n end\n else\n throw Exception.new(\"view was out of bounds!\")\n end\n\n end", "def start_grid\n Array.new(@lines) { Array.new(@columns) { Cell.new } }\n end", "def surround_nums(row, col)\n # North\n @grid[row-1][col] += 1 if ((row - 1) > -1) && @grid[row-1][col] != :B \n # NE\n @grid[row - 1][col + 1] += 1 if ((row - 1) > -1) && ((col+1) < 9) && @grid[row - 1][col + 1] != :B \n # East\n @grid[row][col+1] += 1 if ((col+1) < 9) && @grid[row][col+1] != :B \n # SE\n @grid[row+1][col+1] += 1 if ((row + 1) < 9) && ((col+1) < 9) && @grid[row+1][col+1] != :B \n # South\n @grid[row + 1][col] += 1 if ((row + 1) < 9) && @grid[row + 1][col] != :B \n # SW\n @grid[row + 1][col - 1] += 1 if ((row + 1) < 9) && ((col-1) > -1) && @grid[row + 1][col - 1] != :B \n # West\n @grid[row][col - 1] += 1 if ((col - 1) > -1) && @grid[row][col - 1] != :B \n # NW\n @grid[row - 1][col - 1] += 1 if ((row - 1) > -1) && ((col - 1 ) > -1) && @grid[row - 1][col - 1] != :B\n end", "def populate_grid\n start_rows = { red: (0..2), black: (5..7) }\n\n 8.times do |x|\n 8.times do |y|\n [:red, :black].each do |color|\n if (x + y).even? && start_rows[color].include?(y)\n self[[x, y]] = Piece.new(color, [x, y], self)\n end\n end\n end\n end\n\n grid.each_with_index do |row, y|\n row.each_with_index do |cell, x|\n puts \"x=#{x}, y=#{y}, cell.class=#{cell.class}\"\n end\n end\n end", "def draw_internal_grid( view )\r\n subdivisions = final_subdivs()\r\n for patch in @patches\r\n patch.draw_internal_grid( subdivisions, view )\r\n end\r\n nil\r\n end", "def game_over \n # all the grid's cells are full and different numbers \n end", "def target_layout(target_ids, nodeset=@nodes, edgeset=@edges)\n groups = {'inc_targ'=>{}, 'dec_targ'=>{}, 'targ_inc'=>{}, 'targ_dec'=>{}, 'sup_targ'=>{}, 'targ_sup'=>{}} #sup_targ = top\n\n if nodeset.length > 0\n nodeset.each do |id, node| #build our groupings\n if !node.static\n edgeset.values.each do |edge|\n # check if node is related to something in target_ids\n if (node == edge.a and target_ids.include? edge.b.id) # means that node points at target\n g = edge.rel_type & MapvisualizationsHelper::INCREASES != 0 ? 'inc_targ' : (edge.rel_type & \n MapvisualizationsHelper::SUPERSET == 0 ? 'dec_targ' : 'sup_targ') #what group we go in\n groups[g][node.id] = node\n break #stop looking for edges for this node\n elsif (node == edge.b and target_ids.include? edge.a.id) #means that target points at node\n g = edge.rel_type & MapvisualizationsHelper::INCREASES != 0 ? 'targ_inc' : (edge.rel_type & \n MapvisualizationsHelper::SUPERSET == 0 ? 'targ_dec' : 'targ_sup') #what group we go in\n groups[g][node.id] = node\n break #stop looking for edges for this node\n end\n end\n end\n end \n\n set_static_nodes\n static_wheel_nodes\n\n # put the groups into little circles in their respective corners, so they can come out fighting\n radius = 50\n circle_nodes_at_point(groups['inc_targ'], Vector[0,@height], radius)\n circle_nodes_at_point(groups['dec_targ'], Vector[0,0], radius)\n circle_nodes_at_point(groups['sup_targ'], Vector[@width/2,0], radius)\n circle_nodes_at_point(groups['targ_inc'], Vector[@width,@height], radius)\n circle_nodes_at_point(groups['targ_dec'], Vector[@width,0], radius)\n circle_nodes_at_point(groups['targ_sup'], Vector[@width/2,@height], radius)\n \n #fruchterman_reingold(100) #fast, little bit of layout for now\n kamada_kawai\n normalize_graph\n else\n @nodes = NO_ITEM_ERROR\n end\n end", "def draw_canvas_border(grid)\n grid[0].each do |grid_cell|\n grid_cell.top_wall = true\n end\n grid[grid.length - 1].each do |grid_cell|\n grid_cell.bottom_wall = true\n end\n\n (0..grid.length - 1).each do |j|\n grid[j][0].left_wall = true\n grid[j][grid[j].length - 1].right_wall = true\n end\nend", "def grid_search grid, target\n match = []\n i = 0\n\n grid.each_with_index do |x,xi|\n x.each_with_index do |y,yi|\n if y == target[i][i] && grid[xi][yi+1] == target[i][i+1] && grid[xi][yi+2] == target[i][i+2]\n match << [xi,yi]\n end\n # if y == target[i+1][i] && grid[xi][yi+1] == target[i+1][i+1]\n # match << [xi,yi]\n # end\n end\n end\n match\n\n # if match.size == target.size\n # puts \"YES\"\n # else\n # puts 'NO'\n # end\nend", "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 gridhelper ()\n $helper = \"\"\n $g = 0\n items = MEASURES\n $LEN = items.length\n $parsed = 0\n\n until $g == $LEN\n $TYPE = items[$g]['TYPE']\n if $g == 0\n $NAME = \"default\"\n else\n $NAME = \"$bp-\" + items[$g]['NAME']\n end\n $FROM = items[$g]['FROM']\n $COLS = items[$g]['COLS']\n $FLUID = items[$g]['FLUID']\n $RATIOPREGOLDEN = items[$g]['RATIOPREGOLDEN']\n $GOLDEN = items[$g]['GOLDEN']\n $RATIO = $RATIOPREGOLDEN * $GOLDEN\n $COLW = items[$g]['COLW']\n $GUTW = items[$g]['GUTW']\n $MAXW = items[$g]['MAXW']\n $COLBG = items[$g]['COLBG']\n\n \n if $TYPE == \"grid_bp\"\n $helper += \"\\n/* %s GRID */\" % [$NAME]\n $helper += \"\\n@media (min-width: #$FROM){\"\n if $FLUID == \"f\" || $FLUID == \"F\"\n $HALW = \"cal(-#$MAXW/2)\"\n $GUTW = \"cal(100%/(#$COLS+(#$COLS*#$RATIO)))\"\n $MRGW = \"cal(50%/(#$COLS+(#$COLS*#$RATIO)))\"\n $COLW = \"cal(100%*#$RATIO/(#$COLS+(#$COLS*#$RATIO)))\" \n\n else \n $HALW = \"cal(-#$COLS/2*(#$COLW+#$GUTW))\"\n $MAXW = \"cal(#$COLS*(#$COLW+#$GUTW))\"\n $MRGW = \"cal(#$GUTW/2)\"\n end\n $helper += \"\n #grid {\n margin-left: #$HALW;\n max-width: #$MAXW; \n }\n #grid div.vert {\n background: #$COLBG;\n width: #$COLW;\n margin: 0 #$MRGW;\n }\n #grid div.vert.first-line {\n margin-left: #$MRGW;\n }\n #grid div.vert.cols#$COLS { /* this grid uses #$COLS cols */\n margin-right: 0;\n }\n \"\n if $parsed > 0\n $target = $parsed - 1\n $PREVCOLS = getPreviousGridCols ( $target )\n\n $helper += \"\n #grid div.vert.cols#$PREVCOLS { /* reset previous #$PREVCOLS cols grid */\n margin-right: #$MRGW;\n }\n \"\n end\n $helper += \"\\n}\"\n\n $parsed += 1\n else\n if $FLUID == \"f\" || $FLUID == \"F\"\n $HALW = \"cal(-#$MAXW/2)\"\n\n else\n $HALW = \"cal(-#$COLS/2*(#$COLW+#$GUTW))\"\n $MAXW = \"cal(#$COLS*(#$COLW+#$GUTW))\"\n end\n $helper += \"\n /* extra breakpoint */\n @media (min-width: #$FROM){\n #grid {\n margin-left: #$HALW;\n max-width: #$MAXW; \n }\n #grid div.vert {\n background: #$COLBG;\n }\n }\n \"\n end\n $g += 1\n end\n\nreturn $helper\nend", "def generate\n # Vælg et tilfældigt koordinat til at starte med.\n random_start = [@prng.rand(@width),@prng.rand(@height)]\n \n # Opret en stak og læg det tilfældige koordinat på stakken.\n stack = Array.new\n stack.push random_start\n until stack.empty?\n # Tag koordinaterne fra det øverste element på stakken.\n x,y = stack.last\n # Marker cellen som besøgt.\n @grid[y][x].visited = true\n # Gem alle cellens nabo-celler.\n neighbors = Array.new\n neighbors.push [x, y-1] unless y-1 < 0 # Nord\n neighbors.push [x+1, y] unless x+1 >= @width # Øst\n neighbors.push [x, y+1] unless y+1 >= @height # Syd\n neighbors.push [x-1, y] unless x-1 < 0 # Vest\n # Sorter de naboer fra der allerede er blevet besøgt af algoritmen.\n neighbors.delete_if {|x, y| @grid[y][x].visited }\n # tjek om der er nogle ubesøgte naboer.\n if neighbors.any?\n # Vælg en tilfældig ubesøgt nabo.\n random_neighbor = neighbors.sample(random:@prng)\n # Forbind denne celle med den tilfældige nabo.\n connect stack.last, random_neighbor\n # Læg den tilfældige nabo øverst på stakken.\n stack.push random_neighbor\n else\n # Hvis der ingen naboer er, så tager den en celle af stakken.\n stack.pop\n end\n end\n end", "def occupy_grid(from_x, from_y, the_direction, the_distance, wire_index, the_base_steps, in_grid_hash)\n if the_direction.upcase == \"U\"\n the_step_x, the_step_y = 0, 1\n elsif the_direction.upcase == \"D\"\n the_step_x, the_step_y = 0, -1\n elsif the_direction.upcase == \"L\"\n the_step_x, the_step_y = -1, 0\n elsif the_direction.upcase == \"R\"\n the_step_x, the_step_y = 1, 0\n end\n the_walk_x, the_walk_y = from_x, from_y\n\n 0.upto(the_distance - 1) do |the_step_num|\n the_key = \"#{the_walk_x}_#{the_walk_y}\"\n in_grid_hash[the_key] ||= [-1,-1]\n\n in_grid_hash[the_key][wire_index] = the_base_steps + the_step_num if in_grid_hash[the_key][wire_index] < 1\n\n the_walk_y += the_step_y\n the_walk_x += the_step_x\n end\n return the_walk_x, the_walk_y\nend", "def mouse_over_grid2?\n inputs.mouse.point.inside_rect?(move_and_scale_up(grid.rect))\n end", "def test_that_grid_generation_is_accurate\n end", "def live_neighbours_around_cell(cell)\n live_neighbours = []\n\n #check top cell\n if cell.x_axis > 0\n # puts \"Cell dimen1: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis - 1][cell.y_axis]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n #check right cell\n if cell.y_axis < (columns-1)\n # puts \"Cell dimen2: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis][cell.y_axis + 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n #check left cell\n if cell.y_axis > 0\n # puts \"Cell dimen3: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis][cell.y_axis - 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check bottom cell\n if cell.x_axis < (rows-1)\n # puts \"Cell dimen4: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis + 1][cell.y_axis]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check top left\n if cell.x_axis > 0 and cell.y_axis > 0\n # puts \"Cell dimen5: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis - 1][cell.y_axis - 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check top right\n if cell.x_axis > 0 and cell.y_axis < (columns-1)\n # puts \"Cell dimen6: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis - 1][cell.y_axis + 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check bottom left\n if cell.x_axis < (rows - 1) and cell.y_axis > 0\n # puts \"Cell dimen7: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis + 1][cell.y_axis - 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check bottom right\n if cell.x_axis < (rows - 1) and cell.y_axis < (columns - 1)\n # puts \"Cell dimen8: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis + 1][cell.y_axis + 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n live_neighbours\n end", "def cavity grid\n # copy_g = grid\n\n # # size = copy_g[0].length\n\n # copy_g.delete_at(size-1)\n # copy_g.delete_at(0)\n\n # copy_g[0].delete_at(size-1)\n # copy_g[0].delete_at(0)\n\n # # p copy_g\n\n # center = []\n\n # size = grid.size -1\n\n\n # (1..size).each do |i|\n # j = size - i\n # center << [i,j]\n # center << [i,j+1]\n # end\n # p center\n\ncenter = []\ncavity = []\nsize = grid.size-1\n\ncopy_g = grid\n\ngrid.each_with_index do |x, xi|\n x.each_with_index do |y, yi|\n\n\n if xi != 0 && yi != 0 && xi != size && yi != size\n # p \"element [#{xi}, #{yi}] is #{y}\"\n center << [xi, yi]\n\n if grid[xi][yi + 1] < y && grid[xi][yi - 1] < y\n cavity << [xi, yi]\n copy_g[xi][yi] = 'X'\n end\n\n end\n end\nend\n\np center\np cavity\np copy_g\n\nend", "def get_subgrid(cords)\n subgrid = []\n x_pos = cords[0] - cords[0] % 3\n (x_pos..x_pos + 2).each do |row_num|\n y_pos = cords[1] - cords[1] % 3\n subgrid += @grid[row_num][y_pos, 3]\n end\n subgrid\n end", "def finish_cell\n if options[:type] == :polar\n row = grid.rows-1\n columns = grid.columns row\n grid[row, columns.size / 2]\n else\n if !options[:solution] || options[:solution] == :auto\n column = grid.columns.times.find {|i| grid[grid.rows-1,grid.columns-1-i] }\n return grid[grid.rows-1,grid.columns-1-column] if column\n row = grid.rows.times.find {|i| grid[grid.rows-1-i,grid.columns-1] }\n return grid[grid.rows-1-row,grid.columns-1]\n else\n grid[*options[:solution]]\n end\n end\n end", "def traverse_grid(rows, cols, dead_zones, paths)\n paths ||= Array.new(rows) {Array.new(cols)}\n\n #recursive step\n return traverse_grid(rows-1, cols) || traverse_grid(rows, cols-1)\nend", "def prep_for_exploration\n self.grid.map! { |row| row.map! { |spot| spot == \"*\" ? -1 : 0 } }\n end", "def build_grid\n x = 0\n 10.times do\n row = []\n y = 0\n 10.times do\n row.push({display: \"~~\", ship: false, coord: [x, y]})\n y += 1\n end\n self.grid << row\n x += 1\n end\n p self.grid\n end", "def step_layers(outer, current, inner)\n step(current) do |x, y|\n bugs = neighbors(current, x, y)\n\n bugs << outer[1][2] if y == 0\n bugs << outer[2][3] if x == 4\n bugs << outer[3][2] if y == 4\n bugs << outer[2][1] if x == 0\n\n case [x, y]\n when [2, 1] then bugs += inner.first\n when [3, 2] then bugs += inner.map(&:last)\n when [2, 3] then bugs += inner.last\n when [1, 2] then bugs += inner.map(&:first)\n end\n\n bugs.count { |b| b == '#' }\n end\nend", "def mouse_over_grid?\n inputs.mouse.point.inside_rect?(scale_up(grid.rect))\n end", "def apply_rules_part2(grid)\n new_grid = deep_copy_grid(grid)\n (0..(grid.length - 1)).each do |row|\n (0..(grid[0].length - 1)).each do |col|\n\n if grid[row][col] == 'L' && num_visible_occupied(grid, row, col) == 0\n new_grid[row][col] = '#'\n elsif grid[row][col] == '#' && num_visible_occupied(grid, row, col) >= 5\n new_grid[row][col] = 'L'\n end\n\n end\n end\n\n new_grid\n end", "def split(evaluate=false)\n @inspect = false # no more ispection for this tile\n\n l=[0,1,2].map { |m| \n ((m+1)..2).to_a.map { |n| \n (@grd.vtxs[@vtx[m]-1].x-@grd.vtxs[@vtx[n]-1].x)**2+(@grd.vtxs[@vtx[m]-1].y-@grd.vtxs[@vtx[n]-1].y)**2\n }\n }.flatten.each_with_index.max[1]\n\n # introduce new vertex and record existing end points\n vtx1=-1\n vtx2=-1\n vtx3=-1\n vtx4=nil\n case l\n when 0 # longest edge is 0-1\n vtx1=vtx[0]\n vtx2=vtx[1]\n vtx3=vtx[2]\n when 1 # longest edge is 0-2\n vtx1=vtx[0]\n vtx2=vtx[2]\n vtx3=vtx[1]\n when 2 # longest edge is 1-2\n vtx1=vtx[1]\n vtx2=vtx[2]\n vtx3=vtx[0]\n end\n\n vtx_new = \n Vertex.new((@grd.vtxs[vtx1-1].x+@grd.vtxs[vtx2-1].x)/2.0, (@grd.vtxs[vtx1-1].y+@grd.vtxs[vtx2-1].y)/2.0, @grd)\n\n vtx_new.compute() if( evaluate ) \n\n @grd.vtxs << vtx_new\n\n # add two new tiles formed out of self\n\n t = Tile.new(@grd.vtxs.size,vtx3,vtx1, @grd)\n t.connect(@grd.tiles.append(t))\n\n t = Tile.new(vtx3,@grd.vtxs.size,vtx2, @grd)\n t.connect(@grd.tiles.append(t))\n\n # find adjacent tile\n adjacent = (@grd.vtxs[vtx1-1].tiles & @grd.vtxs[vtx2-1].tiles) - [self]\n if !adjacent.nil? and adjacent.size > 0\n adj_tile = adjacent[0]\n vtx4=(adj_tile.vtx - [vtx1, vtx2]).first\n\n # add two new tiles formed out of adjacent tile\n t = Tile.new(@grd.vtxs.size,vtx1,vtx4, @grd)\n t.connect(@grd.tiles.append(t))\n\n t = Tile.new(vtx4,vtx2,@grd.vtxs.size, @grd)\n t.connect(@grd.tiles.append(t))\n \n # unlink ajd_tile from the list\n adj_tile.unlink\n adj_tile.inspect = false\n @grd.vtxs[vtx1-1].remove_tile adj_tile\n @grd.vtxs[vtx2-1].remove_tile adj_tile\n @grd.vtxs[vtx4-1].remove_tile adj_tile\n end\n \n self.unlink\n \n @grd.vtxs[vtx1-1].remove_tile self\n @grd.vtxs[vtx2-1].remove_tile self\n @grd.vtxs[vtx3-1].remove_tile self\n end", "def initial_piece_placements\n self.grid.each_with_index do |row, row_idx|\n row.each_with_index do |cell, cell_idx|\n pos = [row_idx, cell_idx]\n if pos.all? {|coord| coord.even?} || pos.all? {|coord| coord.odd?}\n if row_idx < 3\n self[pos] = Piece.new(self, pos, :white)\n elsif row_idx >= 5\n self[pos] = Piece.new(self, pos, :black)\n end\n end\n end\n end\n end", "def mutate()\n\t\t# make a copy of grid and fill it with zeros\n\t\ttemp = Array.new(@rows)\n\t\tfor i in (0...@rows)\n\t\t\ttemp[i] = Array.new(@cols)\n\t\t\ttemp[i].fill(0)\n\t\tend\n\n #\n\t\t# TO DO: set values in temp grid to next generation\n\t\t#\n\t\tfor k in 0...@rows\n\t\t\tfor h in 0...@cols\n\t\t\t\tif (@grid[k][h]==1 && getNeighbors(k, h) < 2)\n\t\t\t\t\ttemp[k][h] = 0\n\t\t\t\telsif (@grid[k][h]==1 && getNeighbors(k, h) >3)\n\t\t\t\t\ttemp[k][h] = 0\n\t\t\t\telsif (@grid[k][h]==0 && getNeighbors(k, h) == 3)\n\t\t\t\t\ttemp[k][h] = 1\n\t\t\t\telse\n\t\t\t\t\ttemp[k][h] = @grid[k][h]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\n\n\n # DO NOT DELETE THE CODE BELOW\n\t\t@grid = temp\n\tend", "def draw_grid_square(x,y,color,z,padding=0,xmargin=@xmargin,ymargin=@ymargin)\n super\n end", "def assignGrid grid\n @grid = grid\n\n #if starting point of rover is at an obstacle, move rover over till hit free spot\n if @grid.obstacles.include?(@currentPos)\n print \"Grid has obstacle at rover starting position. Landed rover at (\"\n\n loop do\n moveForward\n break if !@grid.obstacles.include?(@currentPos)\n end\n\n print \"#{@currentPos.x}, #{@currentPos.y}) instead\\n\"\n end\n end", "def change_gridview(dx, dy)\n rec = @grid_viewport.rect\n @grid_viewport.rect.set(rec.x+dx,rec.y+dy,rec.width,rec.height)\n for row in @tiles\n for box in row\n box.moveby(dx, dy)\n end\n end\n end", "def cell_in_grid(y, x)\n return y >= 0 && x >= 0 && y < $grid.length && x < $grid.length\nend", "def grid_modified!\n end", "def build_grid size\n self.tiles.clear\n size.to_i.times do |row|\n size.to_i.times do |column|\n self.tiles.build({\n x: column,\n y: row\n })\n end\n end\n end", "def walk(grid, x, y)\n [N, S, E, W].shuffle.each do |dir|\n nx, ny = x + DX[dir], y + DY[dir]\n if nx >= 0 && ny >= 0 && ny < grid.length && nx < grid[ny].length && grid[ny][nx] == 0\n grid[y][x] |= dir\n grid[ny][nx] |= OPPOSITE[dir]\n \n return [nx, ny]\n end\n end\n \n nil\nend", "def hidden_ships_grid\n new_grid = @grid.map do |subarray|\n subarray.map do |ele|\n if ele == :S \n ele = :N \n else\n ele\n end\n end \n end\n new_grid\n end", "def p11\n\tgrid = Matrix[\n\t\t[8,\t2, 22,97,38,15,0, 40,0, 75,4, 5, 7, 78,52,12,50,77,91,8],\n\t\t[49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48,4, 56,62,0],\n\t\t[81,49,31,73,55,79,14,29,93,71,40,67,53,88,30,3, 49,13,36,65],\n\t\t[52,70,95,23,4, 60,11,42,69,24,68,56,1, 32,56,71,37,2, 36,91],\n\t\t[22,31,16,71,51,67,63,89,41,92,36,54,22,40,40,28,66,33,13,80],\n\t\t[24,47,32,60,99,3, 45,2, 44,75,33,53,78,36,84,20,35,17,12,50],\n\t\t[32,98,81,28,64,23,67,10,26,38,40,67,59,54,70,66,18,38,64,70],\n\t\t[67,26,20,68,2, 62,12,20,95,63,94,39,63,8, 40,91,66,49,94,21],\n\t\t[24,55,58,5, 66,73,99,26,97,17,78,78,96,83,14,88,34,89,63,72],\n\t\t[21,36,23,9, 75,0, 76,44,20,45,35,14,0, 61,33,97,34,31,33,95],\n\t\t[78,17,53,28,22,75,31,67,15,94,3, 80,4, 62,16,14,9, 53,56,92],\n\t\t[16,39,5, 42,96,35,31,47,55,58,88,24,0, 17,54,24,36,29,85,57],\n\t\t[86,56,0, 48,35,71,89,7, 5, 44,44,37,44,60,21,58,51,54,17,58],\n\t\t[19,80,81,68,5, 94,47,69,28,73,92,13,86,52,17,77,4, 89,55,40],\n\t\t[4,\t52,8, 83,97,35,99,16,7, 97,57,32,16,26,26,79,33,27,98,66],\n\t\t[88,36,68,87,57,62,20,72,3, 46,33,67,46,55,12,32,63,93,53,69],\n\t\t[4,\t42,16,73,38,25,39,11,24,94,72,18,8, 46,29,32,40,62,76,36],\n\t\t[20,69,36,41,72,30,23,88,34,62,99,69,82,67,59,85,74,4, 36,16],\n\t\t[20,73,35,29,78,31,90,1, 74,31,49,71,48,86,81,16,23,57,5, 54],\n\t\t[1,\t70,54,71,83,51,54,69,16,92,33,48,61,43,52,1, 89,19,67,48]\n\t]\n\tproducts = []\n\t(0...grid.row_count).each do |row|\n\t\t(0...grid.column_count).each do |col|\n\t\t\tright = col + 3 < grid.row_count\n\t\t\tdown = row + 3 < grid.column_count\n\t\t\tleft = col - 3 >= 0\n\t\t\tif right\n\t\t\t\tset = grid.minor(row..row,col..col+3)\n\t\t\t\tproducts << set.reduce(:*)\n\t\t\tend\n\t\t\tif down and right\n\t\t\t\tdiagonal = []\n\t\t\t\t(0..3).each do |x|\n\t\t\t\t\tdiagonal << grid.minor(row+x..row+x,col+x..col+x).component(0,0)\n\t\t\t\tend\n\t\t\t\tproducts << diagonal.reduce(:*)\n\t\t\tend\n\t\t\tif down\n\t\t\t\tset = grid.minor(row..row+3,col..col)\n\t\t\t\tproducts << set.reduce(:*)\n\t\t\tend\n\t\t\tif down and left\n\t\t\t\tdiagonal = []\n\t\t\t\t(0..3).each do |x|\n\t\t\t\t\tdiagonal << grid.minor(row+x..row+x,col-x..col-x).component(0,0)\n\t\t\t\tend\n\t\t\t\tproducts << diagonal.reduce(:*)\n\t\t\tend\n\t\tend\n\tend\n\tproducts.max\nend", "def gridpoints\n gridpoints = {'l' => @ngauss, 'e' => @negrid, 's' => @nspec}\n if @grid_option == \"single\"\n gridpoints.absorb({'x'=>1, 'y'=>1})\n else\n gridpoints.absorb({'x' => (@ntheta0 or (2.0 * (@nx - 1.0) / 3.0 + 1.0).floor), 'y' => (@naky or ((@ny - 1.0) / 3.0 + 1.0).floor)})\n end\n return gridpoints\nend", "def hflip\n g = Grid.new\n self.each do |point,v|\n g[Point.new( @width - point.x - 1, point.y )] = v \n end\n g\n end", "def gridit(xd, yd, zd, nx, ny)\n nd = equal_length(xd, yd, zd)\n inquiry [{ double: nx }, { double: ny }, { double: nx * ny }] do |px, py, pz|\n super(nd, xd, yd, zd, nx, ny, px, py, pz)\n end\n end", "def make_grid\n @grid = Array.new(4){Array.new(4)}\n end", "def search( grid, init , deltas, cost, goal , delta_names)\n # ----------------------------------------\n # insert code here and make sure it returns the appropriate result\n # ----------------------------------------\n closed = copy_array_dimensions grid\n expand = copy_array_dimensions grid #, -1\n action = copy_array_dimensions grid, -1\n\t#initalize starting location \n\tclosed[init[0]][init[1]] =1\n\n\tx = init[0]\n\ty = init[1]\n\tg = 0 \n\t\n\topen = [[g,x,y]]\n\tputss 'open', open\n\tputss closed\n\tprint_array expand\n\t#flags\n\tfound = false\n\tresign = false \n\t\n\twhile ( found == false && resign == false )\n\t\t\n\t\tif open.size == 0 \n\t\t\tresign = true \n\t\t\tputs 'fail'\n\t\t\tclosed.each do | row | \n\t\t\t\tputs row.inspect\n\t\t\tend\n\t\telse\n\t\t\topen.sort()\n\t\t\topen.reverse()\n\t\t\tnext_ = open.pop() #use unshift\n\t\t\tputss 'next', next_[0], next_[1]\n\t\t\tx = next_[1] \n\t\t\ty = next_[2]\n\t\t\tg = next_[0] \n\t\t\t\n\t\t\tif x == goal[0] && y == goal[1]\n\t\t\t\tfound = true \n\t\t\t\tputss 'done', next_\n\t\t\telse\n\t\t\t\t#apply action , nod eexpantion\n\t\t\t\tdeltas.each_with_index do | delta, i | \n\t\t\t\t\tx2 = x + delta[0]\n\t\t\t\t\ty2 = y + delta[1]\n\t\t\t\t\tif x2 >= 0 && x2 < grid.size &&\n\t\t\t\t\t\ty2 >= 0 && y2 < grid[0].size\n\t\t\t\t\t\t#putss 'add to open list', [ x2, y2]\n\t\t\t\t\t\t#if not closed and natvigable \n\t\t\t\t\t\tif closed[x2][y2] == 0 && grid[x2][y2] == 0 \n\t\t\t\t\t\t\tg2 = g + cost\n\t\t\t\t\t\t\topen << [g2, x2, y2]\n\t\t\t\t\t\t\texpand[x2][y2] = g2\n\t\t\t\t\t\t\t#putss 'add to open list', [ x2, y2]\n\t\t\t\t\t\t\tclosed[x2][y2] = 1\n\t\t\t\t\t\t\taction[x2][y2] = i\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif grid[x2][y2] != 0 \n\t\t\t\t\t\t\texpand[x2][y2] = -1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\t\n\t\n\t#\n\tpolicy = copy_array_dimensions grid, ' '\n\tx = goal[0]\n\ty = goal[1]\n\tpolicy[x][y] = '*'\n\t\n\tprint_array action\n\tputss init, x, y\n\t#return\n\tif resign != true\n\t\twhile ( x != init[0] && y != init[1] )\n\t\t\t#apply inverse action \n\t\t\tx2 = x - deltas[action[x][y]][0]\n\t\t\ty2 = y - deltas[action[x][y]][1]\n\t\t\tpolicy[x][y] = delta_names[action[x][y]]\n\t\t\tx = x2\n\t\t\ty = y2\n\t\tend\n\t\t\n\t\tprint_array policy\n\tend\n\texpand\nend", "def connect_spaces\n\n # set the tile-tile, tile-vtex, and tile-edge links\n @tiles.each do |tile|\n r, c = tile.row, tile.col\n\n # link the tile with its 6 neighboring tiles\n [[[ r-1 , c-1 ], :nw, :se],\n [[ r-1 , c ], :ne, :sw],\n [[ r , c+1 ], :e , :w ],\n [[ r+1 , c+1 ], :se, :nw],\n [[ r+1 , c ], :sw, :ne],\n [[ r , c-1 ], :w , :e ],\n ].each do |coords, dir1, dir2|\n other = @tile_map[coords]\n tile.set_tile(dir1, other)\n other.set_tile(dir2, tile) unless other.nil?\n end\n\n # link the tile with its 6 neighboring vertexes\n [[[ r-1 , c-1 , :down ], :nw, :se],\n [[ r , c , :up ], :n , :s ],\n [[ r-1 , c , :down ], :ne, :sw],\n [[ r+1 , c+1 , :up ], :se, :nw],\n [[ r , c , :down ], :s , :n ],\n [[ r+1 , c , :up ], :sw, :ne],\n ].each do |coords, dir1, dir2|\n vtex = @vtex_map[coords]\n tile.set_vtex(dir1, vtex)\n vtex.set_tile(dir2, tile) unless vtex.nil?\n end\n\n # link the tile with its 6 neighboring edges\n [[[ r , c , :vert ], :w , :e ],\n [[ r , c , :asc ], :nw, :se],\n [[ r , c , :desc ], :ne, :sw],\n [[ r , c+1 , :vert ], :e , :w ],\n [[ r+1 , c+1 , :asc ], :se, :nw],\n [[ r+1 , c , :desc ], :sw, :ne],\n ].each do |coords, dir1, dir2|\n edge = @edge_map[coords]\n tile.set_edge(dir1, edge)\n edge.set_tile(dir2, tile) unless edge.nil?\n end\n end\n\n # link the :up vertexes with neighboring edges\n @up_vtexs.each do |vtex|\n r, c = vtex.row, vtex.col\n [[[ r-1 , c , :vert ], :n , :s ],\n [[ r , c , :asc ], :sw, :ne],\n [[ r , c , :desc ], :se, :nw],\n ].each do |coords, dir1, dir2|\n edge = @edge_map[coords]\n vtex.set_edge(dir1, edge)\n edge.set_vtex(dir2, vtex) unless edge.nil?\n end\n end\n\n # link the :down vertexes with neighboring edges\n @down_vtexs.each do |vtex|\n r, c = vtex.row, vtex.col\n [[[ r+1 , c+1 , :vert ], :s , :n ],\n [[ r+1 , c+1 , :asc ], :ne, :sw],\n [[ r+1 , c , :desc ], :nw, :se],\n ].each do |coords, dir1, dir2|\n edge = @edge_map[coords]\n vtex.set_edge(dir1, edge)\n edge.set_vtex(dir2, vtex) unless edge.nil?\n end\n end\n end", "def cells_grid_1by1\n [\n [\n MazeMagic::Maze::Edge.instance,\n MazeMagic::Maze::HorizontalWall.instance,\n MazeMagic::Maze::Edge.instance\n ],\n [\n MazeMagic::Maze::VerticalWall.instance,\n MazeMagic::Maze::HorizontalWall.instance,\n MazeMagic::Maze::VerticalWall.instance\n ]\n ]\n end", "def open_up(row,col)\n return if @grid[row][col] == nil\n return if @known_empty.include? (row.to_s + col.to_s)\n numera = [1,2,3,4,5,6,7,8,9]\n if numera.include? @grid[row][col]\n @known_empty << (row.to_s + col.to_s)\n return \n end\n \n @known_empty << (row.to_s + col.to_s)\n # North\n open_up(row-1,col) if row-1 > -1\n # NE\n open_up(row - 1,col + 1) if (row > -1) && (col + 1 < 9) \n # East\n open_up(row,col+1) if (col+1 < 9)\n # SE\n open_up(row+1,col+1) if (row+1 < 9) && (col + 1 < 9) \n # South\n open_up(row + 1,col) if row + 1 < 9 \n # SW\n open_up(row + 1,col - 1) if (row + 1 < 9) && (col - 1 > -1)\n # West\n open_up(row,col - 1) if col - 1 > -1 \n # NW\n open_up(row - 1,col - 1) if (row -1 > -1) && (col - 1 > -1) \n\n return\n\n end", "def on_table?(x,y)\n (0 <= x && x < GRID_X) && (0 <= y && y < GRID_Y)\n end", "def grid; @parameters['GRiD']; end", "def set_cell_coordinates\n x = 0\n while x < 6\n y = 0\n while y < 7\n grid[x][y].co_ord = [x + 1, y + 1]\n y += 1\n end\n x += 1\n end\n end", "def translate_index_to_grid_position(index)\n @grid_positions[index]\nend", "def uncover (i,j)\t\t\t\n\t\tx_array = [i] \t\t\t\t\t\t\t\t\t\t\t#array containing x-indexes of clicked button which have 0 mines in the sorrounding\n\t\ty_array = [j]\t\t\t\t\t\t\t\t\t\t\t\t\t#y-index of clicked button \" \" \" \" \" \" \" \" \" \" \"\n\t\tx_array.each_with_index do |n,index|\t\n\t\t\ti = n\n\t\t\tj = y_array[index]\n\t\t\tfor x in i-1..i+1\n\t\t\t \tfor y in j-1..j+1\n\t\t\t\t\tif x>=0 && y >=0 && x < @rows && y < @cols\n\t\t\t\t\t\tnext if @buttons[x][y].state == \"insensitive\"\t# next iteration if this array index(button) has already been uncovered\n\t\t\t\t\t\t@buttons[x][y].label = @board[x][y].to_s\t\t\t\t\t\n\t\t\t\t\t\t@buttons[x][y].sensitive = false\n\t\t\t\t\t\t@clicks = @clicks + 1 \t\t\t\t\t#click count will be updated for every array index traversed\n\t\t\t\t\t\t@builder[\"window1\"].title = @clicks.to_s\n\t\t\t\t\t\tif @board[x][y] == 0 \t\t\t\t\t#if neighbours of the clicked button contain another 0 valued button,we will add that to our array\n\t\t\t\t\t\t\t@board[x][y] = \"-\"\t\t\t\t\t\t\n\t\t\t\t\t \t\tx_array << x\t\t\t\t\t\t\t\t#if another 0 is found in the neighbours, insert it in to uncover array\n\t\t\t\t\t\t\ty_array << y \t\t\t\t# same as above, saving y-index \n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t end \n\t\tend\n\tend", "def represent\n # grid_array will be an array of strings that represent our grid in NxN format\n grid_array=[]\n @h.times{|r| grid_array<<@grid[r*@w,@w].split('')*' '}\n grid_array\n end", "def update_grid_for_moved_entity(entity, old_x, old_y)\n cells_before = cells_overlapping(old_x, old_y)\n cells_after = cells_overlapping(entity.x, entity.y)\n\n (cells_before - cells_after).each do |s|\n raise \"#{entity} not where expected\" unless s.delete? entity\n end\n (cells_after - cells_before).each {|s| s << entity }\n end", "def update_canvas()\n for x in 0...$width\n for y in 0...$height\n \n neighbor_count = count_neighbors(x, y)\n\n if $canvas[x][y] == 1\n if neighbor_count < 2 or neighbor_count > 3\n $canvas[x][y] = 0\n end\n else\n if neighbor_count == 3\n $canvas[x][y] = 1\n end\n end\n end\n end\nend", "def grid\n rows = []\n (1..self.height).to_a.each do |h|\n rows << row(h)\n end\n rows.reverse\n end", "def inner_up\n # looking up at the bottom of the inner grid\n return 0 if inner.nil?\n # sum bottom edge\n (0..@size-1).map { |x| inner.get_loc(x, @size - 1) ? 1 : 0 }.sum\n end", "def cut_white_space_edges\n x1_array = Array.new\n x2_array = Array.new\n y1_array = Array.new\n y2_array = Array.new\n \n @groups.each do |g|\n x1_array << g.x_pos\n x2_array << g.x_pos + g.width\n y1_array << g.y_pos\n y2_array << g.y_pos + g.height\n end\n \n if @vertical\n #Normal position of the image (up)\n if values_bits[Constants::V_Image_position]< 4.5 \n @height = y2_array.max + @upper_margin\n #Alternative position(down)\n else \n new_height = @height - (y1_array.min-@upper_margin)\n \n @groups.each do |g|\n g.y_pos -= (@height - new_height)\n end\n @main_image.y_pos -= (@height - new_height)\n \n @height = new_height\n end\n else\n #Normal position of the image (left)\n if values_bits[Constants::V_Image_position]< 4.5\n @width = x2_array.max + @sides_margin\n #Alternative position of the image (right)\n else \n new_width = @width - (x1_array.min-@sides_margin)\n \n @groups.each do |g|\n g.x_pos -= (@width - new_width)\n end\n @main_image.x_pos -= (@width - new_width)\n \n @width = new_width\n end\n end\n end", "def print_grid\n puts\n puts \" 1 2 3\"\n puts \"A #{@a1} | #{@a2} | #{@a3} \"\n puts \" ---|---|---\"\n puts \"B #{@b1} | #{@b2} | #{@b3} \"\n puts \" ---|---|---\"\n puts \"C #{@c1} | #{@c2} | #{@c3} \"\n puts\n check_for_winner\n end", "def change_grid(x:, y:, color:)\n return if (x > max_x) || (x < 0)\n return if (y > max_y) || (y < 0)\n col = effective_color(x: x, y: y, color: color)\n grid_apply_color(x, y, col)\n end", "def grid_nodes_in_box(nodeset=@nodes, topleft=Vector[0,0], size=Vector[@width,@height], spacing=Vector[0,0])\n num_cols = (Math.sqrt(nodeset.length)*(size[0]/size[1].to_f)).round\n num_rows = (nodeset.length/num_cols.to_f).ceil\n col_len = size[0]/num_cols\n row_len = size[1]/num_rows\n nodeset.each_with_index{|(key, node), i| nodeset[key].location = \n Vector[topleft[0] + (0.5 + (i%num_cols))*col_len + spacing[0]*i, topleft[1] + (0.5 + (i/num_cols))*row_len + spacing[1]*i]}\n end", "def draw_board\n @board = stack do\n fill rgb(210,105,30)\n rect BOARD_SQUARE_POS[:board_start], BOARD_SQUARE_POS[:board_start], BLOCK_DIMENTION*CHECKERS_WIDTH , BLOCK_DIMENTION*CHECKERS_HEIGHT\n fill rgb(245,222,179)\n CHECKERS_HEIGHT.times do |x|\n CHECKERS_WIDTH.times do |y|\n rect BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*x, BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*y, BLOCK_DIMENTION,BLOCK_DIMENTION if x.even? && y.even?\n rect BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*x, BOARD_SQUARE_POS[:board_start] + BLOCK_DIMENTION*y, BLOCK_DIMENTION,BLOCK_DIMENTION if !x.even? && !y.even?\n end\n end\n end\nend", "def generate_grid\n grid = []\n @y.times do\n row = []\n @x.times do\n row << nil\n end\n grid << row\n end\n grid\n end", "def visibility(grid, row, column)\n n = grid.size # dimensionality\n c = 0 # counter\n \n # tmp values (row/column)\n tr, tc = row, column\n \n # go top\n while (tr-=1) >= 0\n break if grid[tr][column] <= 0\n c += 1\n end\n \n # go right\n while (tc+=1) < n\n break if grid[row][tc] <= 0\n c += 1\n end\n \n # go down\n tr = row # reset\n while (tr+=1) < n\n break if grid[tr][column] <= 0\n c += 1\n end\n \n # go left\n tc = column # reset\n while (tc-=1) >= 0\n break if grid[row][tc] <= 0\n c += 1\n end\n \n c # sum\nend", "def setup_grid(skip_render, skip_set_pieces)\n @grid = Array.new(8) { Array.new(8) { EmptySquare.new } }\n unless skip_set_pieces\n set_major_minor\n set_pawns\n end\n\n render unless skip_render\n end", "def render_gridlines_if_needed args\n if args.state.show_gridlines && args.static_lines.length == 0\n args.static_lines << 65.times.map do |i|\n [\n [CENTER_OFFSET + i * TINY_SCALE + 1, 0,\n CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128],\n [CENTER_OFFSET + i * TINY_SCALE, 0,\n CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128],\n [CENTER_OFFSET, 0 + i * TINY_SCALE,\n CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128],\n [CENTER_OFFSET, 1 + i * TINY_SCALE,\n CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128]\n ]\n end\n elsif !args.state.show_gridlines\n args.static_lines.clear\n end\nend", "def generate_initial_solution\n aux_groups = @groups.groups_deep_clone\n x=@white_space_x\n y=@white_space_y\n \n aux_groups.each do |g|\n g.allocate_this(x,y)\n y+=g.height\n end\n \n if values_bits[Constants::V_Type_of_BG] <= 4.5 #Image as background\n aux_groups << @interest_box\n end\n \n return aux_groups\n end", "def printGrid\n grid = []\n 15.times do\n grid.push '. . . . . . . . . . . . . . . '\n end\n\n Rules::LOCATIONS.each { |key, value| # get location labels with value as array of X, Y\n grid[value[1]][value[0]*2] = key # have to reverse how we access grid, so Y, X. Must double X due to spaces\n }\n\n (0..14).each_with_index do |i|\n \tputs grid[14-i] # Need to show lines in reverse order \n end\nend", "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 mouse_inside_grid?\n inputs.mouse.point.inside_rect?(scale_up(grid.rect))\n end", "def turn\n\t\tnew_grid = Array.new(@size + 1) { Array.new(@size + 1)}\n\t\t0.upto(@size) do |row|\n\t\t\t0.upto(@size) do |column|\n\t\t\t\tnew_grid[column][@size - row] = @grid[row][column]\n\t\t\tend\n\t\tend\n\t\t@grid = new_grid\n\tend", "def configure_cells\n\t\teach_cell do |cell|\n\t\t\trow, col = cell.row, cell.column\n\n\t\t\tcell.north = self[row - 1, col]\n\t\t\tcell.south = self[row + 1, col]\n\t\t\tcell.east = self[row, col + 1]\n\t\t\tcell.west = self[row, col - 1]\n\t\tend\n\tend", "def nebula; end", "def adjacent_mines(row, col)\n count = 0\n if col < @column_count-1\n count+=1 unless @grid[row][col+1].fill.nil?\n end\n if col > 0\n count +=1 unless @grid[row][col-1].fill.nil?\n end\n if row < @row_count-1\n count+=1 unless @grid[row+1][col].fill.nil?\n end\n if row > 0\n count+=1 unless @grid[row-1][col].fill.nil?\n end\n if row < @row_count-1 && col < @column_count-1\n count+=1 unless @grid[row+1][col+1].fill.nil?\n end\n if row > 0 && col > 0\n count+=1 unless @grid[row-1][col-1].fill.nil?\n end\n if row > 0 && col < @column_count-1\n count +=1 unless @grid[row-1][col+1].fill.nil?\n end\n if row < @row_count-1 && col > 0\n count +=1 unless @grid[row+1][col-1].fill.nil?\n end\n count\n end", "def render_block x,y,i,a=255\n boxsize = 30\n grid_x = (1280 - (@grid_w * boxsize)) / 2\n grid_y = (720 - ((@grid_h-2) * boxsize)) / 2\n @args.outputs.solids << [grid_x + (x*boxsize), (720-grid_y) - (y*boxsize),boxsize,boxsize,*@color_index[i],a]\n if i != 8\n @args.outputs.borders << [grid_x + (x*boxsize), (720-grid_y) - (y*boxsize),boxsize,boxsize,*@color_index[8],a]\n else\n @args.outputs.borders << [grid_x + (x*boxsize), (720-grid_y) - (y*boxsize),boxsize,boxsize,*@color_index[7],a]\n end\n end", "def start_cell\n if options[:type] == :polar\n grid[grid.rows-1, 0]\n else\n if !options[:distances] || options[:distances] == :auto\n column = grid.columns.times.find {|i| grid[0,i] }\n return grid[0,column] if column\n row = grid.rows.times.find {|i| grid[i,0] }\n return grid[row,0]\n else\n grid[*options[:distances]]\n end\n end\n end", "def crate?\n $theGrid.at(@x, @y).crate? ? self : nil\n end", "def make_grid(*points)\n self.convert_values()\n printed = \"\"\n if (@clear)\n system ('clear')\n end\n x_points = Array.new\n y_points = Array.new\n # Divide points\n (0..points.length - 1).each do |position|\n if (position % 2 == 0)\n x_points.push(points[position].to_i)\n else\n y_points.push(points[position].to_i)\n end\n end\n # Start loop\n (0..@y_size.to_i).each do |current_y|\n (0..@x_size.to_i).each do |current_x|\n # Setup\n print_fill = true\n relative_x = current_x - @x_offset\n relative_y = @y_offset - current_y\n point_amount = x_points.length - 1\n # Check point\n (0..point_amount.to_i).each do |position_point|\n if (x_points[position_point] == relative_x)\n if (y_points[position_point] == relative_y)\n printed << @point.to_s\n print_fill = false\n end\n end\n end\n # Fill\n if (print_fill)\n if (@x_offset == current_x)\n printed << \"|\"\n elsif (@y_offset == current_y)\n printed << \"-\"\n else\n printed << @blank_space.to_s\n end\n end\n if (y_offset == current_y && current_x != @x_size)\n printed << \"-\"\n else\n printed << \" \"\n end\n end\n printed << \"\\n\"\n end\n print printed\n return printed\n end", "def render\n render_background\n # render_heat_map\n render_walls\n # render_path\n # render_labels\n render_arrows\n render_star\n render_target\n unless grid.walls.has_key?(grid.target)\n render_trail\n end\n end", "def grid_nodes(width=@width, height=@height, nodeset=@nodes)\n num_cols = (Math.sqrt(nodeset.length)*(width/height)).ceil\n num_rows = (nodeset.length/num_cols.to_f).ceil\n col_len = width/num_cols\n row_len = height/num_rows\n nodeset.each_with_index{|(key, node), i| nodeset[key].location = \n Vector[(0.5 + (i%num_cols))*col_len,(0.5 + (i/num_cols))*row_len] if !nodeset[key].static}\n end", "def render_grid_lines\n outputs.lines << (0..grid.width).map { |x| vertical_line(x) }\n outputs.lines << (0..grid.width).map { |x| shifted_vertical_line(x) }\n outputs.lines << (0..grid.height).map { |y| horizontal_line(y) }\n outputs.lines << (0..grid.height).map { |y| shifted_horizontal_line(y) }\n end", "def draw_cell(window, cell, is_player, grid_length)\n cell_width = window.width / grid_length\n cell_draw_x = cell.grid_x * cell_width\n cell_draw_y = cell.grid_y * cell_width\n\n\n window.draw_rect(cell_draw_x, cell_draw_y, cell_width, cell_width, Gosu::Color.argb(DARK_GRAY_COLOR)) if cell.show_base_background\n\n if cell.grid_y == grid_length - 1 && cell.grid_x == grid_length - 1\n window.draw_rect(cell_draw_x + PLATFORM_MARGIN,\n cell_draw_y + PLATFORM_MARGIN,\n cell_width - + PLATFORM_MARGIN * 2,\n cell_width - PLATFORM_MARGIN * 2,\n Gosu::Color.argb(LIGHT_GREEN_COLOR))\n end\n\n if is_player\n window.draw_rect(cell_draw_x + PLAYER_MARGIN,\n cell_draw_y + PLAYER_MARGIN,\n cell_width - PLAYER_MARGIN * 2,\n cell_width - PLAYER_MARGIN * 2,\n Gosu::Color.argb(PLAYER_COLOR))\n end\n\n draw_cell_walls(window, cell, cell_width, MAZE_WALL_THICKNESS, Gosu::Color.argb(LIGHT_GRAY_COLOR))\n\nend", "def find_vertical\n\n\t\t# (x * g) + y where y = (1...g), x = (0...g-1)\n\n\t\t@grid_size.times do |y|\n\t\t\t@winner = true if\n\t\t\t\t(0..(@grid_size-1)).each do |x|\n\t\t\t\t\tvertical_hit = x * @grid_size + y + 1\n\t\t\t\t\tif !@hits.include? vertical_hit\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\tend" ]
[ "0.6187738", "0.6162783", "0.6158351", "0.61524725", "0.6121282", "0.6111624", "0.6111624", "0.60192966", "0.59997433", "0.59029144", "0.58752936", "0.5872623", "0.58701354", "0.5854581", "0.5819976", "0.5787717", "0.5757861", "0.57513267", "0.5741623", "0.5740996", "0.57377434", "0.5731338", "0.5720929", "0.5718661", "0.57079846", "0.569085", "0.568317", "0.5679566", "0.56780165", "0.5669611", "0.5659472", "0.5657962", "0.5647364", "0.5626262", "0.5610541", "0.5610315", "0.56035763", "0.5594204", "0.55816066", "0.5576414", "0.55756646", "0.5569063", "0.55656374", "0.5562604", "0.554721", "0.5545734", "0.55453885", "0.554276", "0.55394524", "0.55383426", "0.5537576", "0.55240273", "0.5522379", "0.5518467", "0.5513596", "0.5495014", "0.54949", "0.54894745", "0.54816145", "0.5475607", "0.5468649", "0.5452532", "0.54459894", "0.54383516", "0.5419672", "0.54148567", "0.5411932", "0.5402004", "0.53997403", "0.5398745", "0.5393341", "0.53906196", "0.5382978", "0.5373416", "0.5371792", "0.53716475", "0.5367702", "0.5359258", "0.53578115", "0.5343645", "0.53428674", "0.5338812", "0.5335527", "0.5331035", "0.53228074", "0.53206885", "0.5320337", "0.5317809", "0.53175676", "0.53158134", "0.5313227", "0.5311308", "0.5307389", "0.5299784", "0.5298883", "0.52896726", "0.5283386", "0.52812505", "0.52779984", "0.52742785", "0.5270255" ]
0.0
-1
Spread search. Expand node using BFS iteration
def spread(index, directions = Grid::Movement,limit = 1,compact = true) return [] unless index return [] if limit < 0 i = 0 result = [index] iteration = [index] until i == limit temp_res = [] iteration.each do |it| cells = surrounding(it, directions, compact) cells.delete_if {|c| result.include?(c)} temp_res += cells end temp_res.uniq! iteration = temp_res result += temp_res i += 1 end return result.compact.uniq if compact return result.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bfs_search(root)\n queue = []\n\n root.marked = true\n queue.push(root)\n\n while queue.length != 0\n current = queue.shift\n visit(current)\n\n current.adjacent.each do |node|\n if !node.marked\n node.marked = true\n queue.push(node)\n end\n end\n end\nend", "def bfs(starting_node, target_value)\n return starting_node if starting_node.value == target_value\n queue = [starting_node]\n until queue.empty?\n queue += starting_node.neighbors\n queue.each { |neighbor| bfs(neighbor, tar) }\n end\n nil\nend", "def expand_breadth(node) #:nodoc:\n cached_relations = []\n\n # 1. yield direct relations first\n relations_for(node).each do |rel|\n yield_node(rel)\n\n # memoize relation for next iteration\n cached_relations << rel unless @description.prune_node?(rel)\n end\n\n # 2. dig deeper\n cached_relations.each do |rel|\n expand_breadth(rel)\n end\n end", "def expand\n @state.neighbors.map{|n|\n AStarNode.new(n, self)\n }\n end", "def bfs_iterative(target)\n queue = [self]\n\n until queue.empty?\n node = queue.shift\n\n return node if node.value == target\n\n node.children.each do |child|\n queue << child\n end\n end\n\n nil\n end", "def bfs(root)\n # NOTE implement real queue for performance\n queue = []\n root.marked = true\n queue.push(root)\n\n while !queue.empty?\n node = queue.shift\n node.visit\n\n node.adjacent.each do |node|\n if node.marked == false\n node.marked = true\n queue.push(node)\n end\n end\n end\nend", "def floodfill_tree bn_id, &blk\n info \"Fill #{bn_id}\"\n return bn_id if node_visited?(bn_id)\n _q.push(bn_id)\n\n index = 0\n while _q.length > 0 do\n #bn = blk.call(bn_id)\n bns = Http.get_bns _q\n bns.each do |bn|\n bn_data = get_node_data_from_xml_doc(bn)\n set_node(bn_data)\n children = get_children_from_xml_doc(bn).map do |child_bn| \n get_node_data_from_xml_doc(child_bn)\n end\n children.each do |child|\n #floodfill_tree child[:id], &blk\n _q.push(child[:id])\n add_child bn_data[:id], child[:id]\n end\n ancestors = get_ancestors_from_xml_doc(bn)\n ancestors.each do |parent|\n parent_data = get_node_data_from_xml_doc parent\n #floodfill_tree parent_data[:id], &blk\n _q.push(parent_data[:id])\n add_ancestor bn_data[:id], parent_data[:id]\n # First 2 levels of ancestors are virtual nodes\n # Add them with this request\n current_parent_bn_id = parent_data[:id]\n grandparent = get_ancestors_from_xml_doc(parent)\n while grandparent.length > 0\n # MAybe Bug\n grandparent_data = get_node_data_from_xml_doc parent\n set_node grandparent_data\n add_ancestor current_parent_bn_id, grandparent_data[:id]\n current_parent_bn_id = grandparent_data[:id]\n grandparent = get_ancestors_from_xml_doc(grandparent)\n end\n end\n # a node is visited when all neighbours are visited\n visit_node bn_data[:id]\n end\n info \"To process #{_q.inspect}\"\n _q.reject!{|e| node_visited?(e)}\n info \"To process #{_q.length} node(s)\"\n index += 1\n save if (index%100 == 0)\n end\n save\n end", "def breadth_first\n return do_breadth_first( [Node.new(@start)], Set.new, @dest)\n end", "def bfs_search(queue, item)\n root = @tree.root\n queue.add(root)\n current_node = queue.pop\n until current_node == item || current_node.nil?\n queue.add(current_node.left_child)\n queue.add(current_node.add_child)\n current_node = queue.pop\n end\n return current_node\nend", "def traverse_bfs\n q = Queue.new\n q.push @tree\n \n loop do\n break if q.empty?\n node = q.shift\n if block_given?\n yield node\n else\n @visited << node.data\n end\n node.children.each{ |n| q.push n } if node.children\n end\n end", "def bfs( start, &block )\n start.distance = 0\n start.predecessor = nil\n start.gray!\n vq = Queue.new()\n vq.enqueue(start)\n while vq.size > 0\n current = vq.dequeue()\n current.get_connections.each do |nbr|\n if nbr.white?\n nbr.gray!\n nbr.distance = current.distance + 1\n nbr.predecessor = current\n vq.enqueue(nbr)\n end\n end\n current.black!\n yield current if block_given?\n end\n # clean up vertices attributes set during bfs\n @vertices.keys.each do |key|\n @vertices[key].distance = nil\n @vertices[key].predecessor = nil\n @vertices[key].color = nil\n end\n end", "def bfs(start, goal = :goalNode?)\n require 'set'\n visited = Set.new\n frontier = []\n frontier << start\n\n until frontier.empty?\n current = frontier.shift\n\n next if visited.include? current\n visited << current\n\n found = false\n found = if block_given?\n yield(current)\n else\n send(goal, current)\n end\n\n if !found\n current.connections.each do |node|\n frontier << node\n end\n else\n return current\n end\n end\n :goal_node_not_found\nend", "def bfs(tree)\n Enumerator.new do |yielder|\n queue = [tree]\n while !queue.empty?\n node = queue.shift\n children = node[1..-1]\n yielder << node.first\n children.each do |child|\n queue << child\n end\n end\n end\nend", "def bfs(target)\n queue = [self]\n until queue.empty?\n return queue.first if queue.first.position == target\n queue += queue.first.children\n queue.shift\n end \n end", "def bfs(starting_node, target_value)\n visited = Set.new()\n queue = [starting_node]\n until queue.empty?\n dequeued = queue.shift\n return dequeued if dequeued.val == target_value\n visited.add(dequeued)\n dequeued.neighbors.each do |neighbor|\n queue << neighbor unless visited.include?(neighbor)\n end\n end\n nil\nend", "def bfs(starting_node, target_value)\n queue = [starting_node]\n visited = Set.new()\n\n starting_node.neighbors.each do |neighb_nodes|\n\n return queue.first.value if queue.first.value == target_value\n\n visited.add(queue.shift) \n\n queue.push(neighb_nodes) unless visited.include?(neighb_nodes)\n \n end\n nil\nend", "def expand_children node=:current_index\n $multiplier = 999 if !$multiplier || $multiplier == 0\n node = row_to_node if node == :current_index\n return if node.children.empty? # or node.is_leaf?\n #node.children.each do |e| \n #expand_node e # this will keep expanding parents\n #expand_children e\n #end\n node.breadth_each($multiplier) do |e|\n expand_node e\n end\n $multiplier = 0\n _structure_changed true\n end", "def bfs(target_pos) #this is called on the root node \n tar_x, tar_y = target_pos \n\n arr = [self]\n\n until arr.empty?\n current_check = arr.shift \n return current_check if current_check.root_node == target_pos\n arr.concat(current_check.children)\n end\n nil\n end", "def node_search\n while (current_node = queue.shift).present? && final.nil?\n @processed += 1\n yield(current_node)\n log \"\\rProcessing #{start.name}.... %d / %d / %d / %d @ %ds - depth: %d\", @unmarked, @requeued, @processed, @steps, (Time.now - @started), current_node.depth\n end\n\n format_results\n save_results if final.present?\n self.final_path\n end", "def bfs(target)\n visited = {}\n @graph.keys.each { |key| visited[key] = false }\n node = @graph.keys[0]\n queue = Queue.new\n queue << node\n while !(queue.length == 0)\n visited[node] = true\n puts \"node is #{node}\"\n return node if node == target\n @graph[node].each do |nabe|\n queue << nabe unless visited[nabe] == true\n end\n node = queue.pop\n end\n end", "def bfs(starting_node, target_value)\n queue = [starting_node]\n checked_nodes = Set.new\n\n until queue.empty?\n current = queue.shift\n unless checked_nodes.include?(current)\n checked_nodes.add(current)\n return current if current.value == target_value\n queue += current.neighbors\n end\n end\n nil\nend", "def greedy2_fill!(remaining_partitions)\n remaining_partitions.each do |src_partition|\n src_partition.sites.each do |site|\n\n smallest_bin = self.update_bin_sizes!.min\n target_partition = smallest_bin.list[src_partition.name]\n if target_partition.nil?\n smallest_bin.add!([Partition.new(src_partition.name, [site], src_partition.tree)])\n else\n target_partition.incr_add_sites!([site])\n end\n\n end\n end\n end", "def bfs\n closed = []\n fringe = initialize_fringe\n\n loop do\n return nil if fringe.empty? # No solution\n current = fringe.pop\n city = current[:city]\n return current if done? city # Found the solution?\n unless closed.include? city # Expand if we haven't visited the city\n closed.push city\n expand(current).each do |c|\n fringe.unshift(c) # Add to front to ensure FIFO\n end\n end\n end\n end", "def bfs_search_tree_from(v)\n unless defined?(DirectedAdjacencyGraph)\n require 'rgl/adjacency'\n end\n bfs = bfs_iterator(v)\n tree = DirectedAdjacencyGraph.new\n\n bfs.set_tree_edge_event_handler do |from, to|\n tree.add_edge(from, to)\n end\n\n bfs.set_to_end # does the search\n tree\n end", "def depth_first_search!(node)\n node.marked = true\n node.type = \"M\"\n node.adj.each do |n|\n if n.marked == false\n depth_first_search(n)\n end\n end\n end", "def bfs_search_tree_from(v)\n require 'rgl/adjacency'\n bfs = bfs_iterator(v)\n tree = DirectedAdjacencyGraph.new\n\n bfs.set_tree_edge_event_handler do |from, to|\n tree.add_edge(from, to)\n end\n\n bfs.set_to_end # does the search\n tree\n end", "def bfs(start_node_num)\n node = find_node(start_node_num)\n _clear_visited\n ret_list = [node.value]\n # Your code here\n q = Queue.new\n q << node\n node.visited = true\n\n until q.empty?\n current = q.pop\n current.edges.each do |edge|\n next if edge.node_to.visited\n q << edge.node_to\n edge.node_to.visited = true\n ret_list << edge.node_to.value\n end\n end\n\n return ret_list\n end", "def breadth_first_search(node, search_val = nil)\n return unless node\n visit_queue = [node]\n\n while (!visit_queue.empty?)\n node = visit_queue.shift\n node.visit\n return node if node.value == search_val\n node.connections.each do |conn|\n next if conn.marked\n conn.marked = true\n visit_queue.push(conn)\n end\n end\nend", "def bfs\r\n q = Queue.new\r\n visited = Set.new\r\n\r\n q << [0, panda]\r\n visited << panda\r\n\r\n until q.empty?\r\n level, current_panda = q.shift\r\n unvisited = @members[current_panda].select { |v| !visited.include? v }\r\n unvisited.each do |v|\r\n q << [level + 1, v]\r\n visited << v\r\n end\r\n end\r\n end", "def traverse\n @result.clear\n @queue.clear\n\n @queue.enqueue(@node)\n @result.push @node\n\n\n while not @queue.empty?\n node = @queue.dequeue\n return @result unless node\n # puts \"Visiting node: #{node}\"\n return node if (@search and node==@search)\n node && node.children.each do |node|\n unless @result.include?(node)\n @result.push(node)\n @queue.enqueue(node)\n end\n end\n end\n return result\n end", "def expand(problem)\n # \"Return a list of nodes reachable from this node. [Fig. 3.8]\"\n expand = []\n #bpoint\n problem.successor(@state).each do | action_succ |\n act = action_succ[0]\n next_act = action_succ[1]\n expand << Node.new(next_act, self, act,problem.path_cost(@path_cost, @state, act, next_act))\n end\n return expand\n end", "def bfs(target)\n q = [self]\n until q.empty?\n shifted = q.shift\n return shifted if shifted.value == target\n q += shifted.children\n # debugger\n end\n nil\n end", "def bfs\n # this is 'really' a traversal, but this type of search is similar to what we'll be doing with graphs and it's called 'breadth first search'\n list = []\n return list if @root.nil?\n queue = [@root]\n\n until queue.empty?\n # big O of shift is O(n)\n current = queue.shift\n # how to check if current has a left subtree?\n queue.push(current.left) unless current.left.nil?\n queue.push(current.right) unless current.right.nil?\n\n list << { key: current.key, value: current.value}\n end\n end", "def breadthFirstSearch(target, node)\n\tqueue = []\n\tqueue << node # creates array\n\tqueue.each do |n| # checks each child\n\t\treturn n if n.data == target\n\t\tn.children.each { |c| queue.push(c) }\n\tend\n\treturn nil # return if found nothing\nend", "def expand(val)\n trail = @sset[val]\n OPS[trail.dir ].each do |op|\n result= self.send(op,val)\n if result\n newpath = trail.grow(op)\n if (foundpath = @sset[result] )\n if foundpath.dir != newpath.dir\n cost = foundpath.cost+newpath.cost\n @match= [newpath,result, cost] if (!@match || (cost < @match.last))\n elsif foundpath.cost > newpath.cost\n @sset[result] = newpath\n end\n else\n @sset[result] = newpath\n if (!@match || (newpath.cost+@depth) < @match.last)\n @newvals.push(result) #only check if total cost can be less than match cost\n end\n end\n end\n end\n end", "def expand\n expanding_vertices, @apical_vertices, @dist_thresh = @apical_vertices.clone, [], @dist_thresh.next\n expanding_vertices.each {|vertex| merge_with_edges(generate_subgraph(vertex))}\n self\n end", "def bfs(val) \n queue = [self] \n\n until queue.empty? \n if queue.first.value == val\n return queue.first\n else\n queue.concat(queue.shift.children) #you add [] + children's children\n end\n end\n nil #if noting == val\n end", "def bfs(graph, starting_point)\n q = Queue.new()\n q.enq(starting_point)\n visited = [] \n loop do \n node = q.deq\n visited.push(node) unless visited.include?(node) \n graph.values[node].each{ |x| q.enq(x) }\n break if visited.length == graph.length\n end \n visited\n end", "def dfs(target)\n return self if self.value == target\n # debugger\n self.children.each do |node|\n dfs(node)\n # if node.value == target\n # return node\n # else\n # node.dfs(target)\n # end\n end\n return nil if self.children.empty?\n p new_arr\n end", "def move_node!(tg,tga,i)\n #first just add node i in\n tga[0].each_index do |ii|\n if (i == tga[0][ii][0])\n tg[0].push(tga[0][ii])\n tga[0][ii] = nil\n break\n end\n end\n #then add the edges, only add edges for which both nodes exist in tg \n tga[1].each_index do |ii|\n if tg[0].index{|item| item[0] == tga[1][ii][0]} && tg[0].index{|item| item[0] == tga[1][ii][1]}\n tg[1].push(tga[1][ii])\n tga[1][ii] = nil\n end\n end\n tga[0].compact!\n tga[1].compact!\nend", "def tree_search(problem, fringe)\n # \"\"\"Search through the successors of a problem to find a goal.\n # The argument fringe should be an empty queue.\n # Don't worry about repeated paths to a state. [Fig. 3.8]\"\"\"\n # Since we dont worry about repeated paths this can lead to infinite loops\n fringe.append(Node.new(problem.initial))\n while fringe.len > 0\n node = fringe.pop()\n return node if problem.goal_test(node.state) if node\n fringe.extend(node.expand(problem)) if node\n end\n return nil\nend", "def bfs(root, target)\n queue = []\n queue << root\n\n until queue.empty?\n current = queue.shift\n\n next if current.nil?\n return true if current.val == target\n\n queue << current.left\n queue << current.right\n end\n\n return false\nend", "def use_breadth_first(item, graph, logic_function = ->(x){graph[x].empty?} , returned = \"steps\" )\r\n search_queue = []\r\n steps = {}\r\n search_queue = search_queue.concat(graph[item])\r\n searched = []\r\n #Setting up initial steps \r\n if !search_queue.empty?\r\n search_queue.each do |term|\r\n steps[term] = 1\r\n end\r\n end\r\n #Here goes the graph algorithm\r\n while !search_queue.empty?\r\n person = search_queue.shift()\r\n if !( searched.include?(person) )\r\n\r\n if logic_function.call(person)\r\n if returned == \"steps\"\r\n return steps[person]\r\n end\r\n if returned == \"found\"\r\n return true\r\n end\r\n else\r\n if !(graph[person].nil?) \r\n graph[person].each do |related|\r\n steps[related] = steps[person] + 1 #Setting up the steps of parents of the current element in the queue\r\n end\r\n search_queue = search_queue.concat(graph[person])\r\n end\r\n end\r\n\r\n end\r\n end\r\n return false\r\nend", "def busqueda(g, d, h, nro_nodos, nodos_visitados, nro_nodos_en_caminos)\r\n #Luego, en esta variable dependiendo de si estamos en un objeto DFS o BFS, se definira el orden\r\n #en el que se seleccionaran los nodos para la busqueda. Ademas, esta variable tendra los elementos\r\n #adyacentes del nodo d ya sea en una pila o en una cola. \r\n pila_o_cola = self.orden_nodos(g,d)\r\n\r\n #pila_o_cola.estructura.each {|elem| puts elem}\r\n\r\n #Verificamos si la pila o cola, de adyacentes, incluye a \"h\"\r\n if pila_o_cola.estructura.include? h \r\n\r\n #De ser asi, se incluye el numero de nodos del recorrido que llevo a \"h\"\r\n nro_nodos_en_caminos << nro_nodos\r\n\r\n #Si la pila o cola no incluye a \"h\"\r\n else\r\n\r\n #Entonces mientras no este vacia, se recorre la estructura\r\n while not(pila_o_cola.vacio)\r\n\r\n #Luego se remueve un nodo de la estructura, que sera el siguiente que se usara\r\n #como \"inicio\" de la busqueda\r\n siguiente_nodo = pila_o_cola.remover\r\n\r\n #Si el nodo en cuestion no ha sido visitado\r\n if not(nodos_visitados.include? siguiente_nodo)\r\n #Lo agregamos al arreglo de visitados\r\n nodos_visitados << siguiente_nodo\r\n #Y hacemos una llamada recursiva al metodo busqueda pero esta vez partiendo\r\n #del nodo antes tomado. En esta llamada aumentamos el numero de nodos (nro_nodos)\r\n #en 1\r\n busqueda(g, siguiente_nodo, h , nro_nodos + 1 , nodos_visitados, nro_nodos_en_caminos)\r\n end\r\n end\r\n end\r\n\r\n #Luego de que acaba todo el procesamiento verificamos si en el arreglo \"nro_nodos_en_caminos\"\r\n #esta vacio, si es asi entonces significa que el nodo \"h\" no fue alcanzado entonces\r\n if nro_nodos_en_caminos.empty?\r\n #retornamos -1\r\n return -1\r\n end\r\n\r\n #Finalmente, si sobrevivimos todo lo anterior, llegados a este punto retornamos el numero de nodos que\r\n #fueron recorridos de \"d\" a \"h\". Recordamos que el arreglo \"nro_nodos_en_caminos\" contiene para todos los\r\n #caminos de \"d\" a \"h\", el numero de nodos recorridos.\r\n\r\n ## OJO: En este caso se retornara el nro de nodos recorridos del camino mas corto. ##\r\n\r\n #Sin embargo, si se quisiera el nro de nodos de solo el primer camino por el que se metio y encontro a \"h\"\r\n #bastaria con solo retornar \"nro_nodos_en_caminos[0]\".\r\n #Por otra parte, si se quisiera para cada camino el nro de nodos recorridos entonces basta con retornar\r\n #el arreglo completo, etc.\r\n \r\n return \"#{nro_nodos_en_caminos.min} nodos recorridos.\"\r\n end", "def breadth_first_search(start, target)\n queue = [ @vertices[start] ]\n visited = []\n until queue.empty?\n vertex = queue.shift\n break if vertex.key == target\n visited << vertex\n vertex.neighbors.each { |key| queue << @vertices[key] unless visited.include?(@vertices[key])}\n end\n visited\n end", "def bfs\n q = []\n list = []\n\n return [] if @root.nil?\n\n current_node = @root\n \n q.push(current_node)\n # put current node into queue\n while q.length != 0\n # put current node into list and delete from queue\n # add current node's children into the queue\n list.push({key: q[0].key, value: q[0].value})\n q.shift\n \n if current_node.left != nil \n q.push(current_node.left) \n end \n\n if current_node.right != nil \n q.push(current_node.right)\n end\n current_node = q[0] \n end \n\n return list\n end", "def bfs(tree, value)\n q = MyQueue.new\n q.enqueue(tree)\n current_tree = q.dequeue() #need to do something when i dequeue \n \n while current_tree != nil\n puts current_tree.payload\n\n if current_tree.payload != value\n current_tree.children.each do |leaf|\n q.enqueue(leaf)\n end\n else\n q = MyQueue.new\n end\n current_tree = q.dequeue()\n end\nend", "def path_finder \n until queue.empty? \n current_node = queue.shift()\n generate_neighbours(current_node)\n current_node.neighbour_nodes.each do |neighbour|\n track_visited(current_node, neighbour)\n correct_node?(neighbour) ? (return neighbour.visited) : (queue << neighbour)\n end\n end\n end", "def bread_first_search(first)\n puts sprintf(\"%-25s %s\", \"Queue: [ bottom - top ]\", \"Visited list\")\n enqueue(first)\n insert_visited(first)\n print\n\n while !queue.empty?\n element = dequeue # => |V|\n @source.fetch(element).each do |s| \n unless @visited.include?(s) # => |E|\n enqueue(s)\n @T.push([element,s]) \n insert_visited(s) \n end\n end\n print\n end\n # spanning tree\n p @T\n end", "def bft(&block)\n queue = Queue.new\n \n # Set all nodes to not enqueued\n self.each do |node|\n node.enqueued = false\n end\n\n queue.push(self) \n self.enqueued = true\n\n while(queue.size > 0)\n # Get next node in the queue\n node = queue.pop\n \n # Pass node off to block\n block.call(node)\n\n # Enqueue all children nodes\n node.child_array.each do |child|\n if !child.enqueued\n queue.push(child)\n child.enqueued = true\n end\n end\n\n end #while\n end", "def a_star_search(tiles_order)\n tree = []\n leaves = []\n solution = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n\n leaf = build_leaf(tiles_order, {tiles_order: nil, branch: []})\n\n i = 0\n while i < 6000 && leaf[:tiles_order] != solution\n i += 1\n tree << leaf[:tiles_order]\n new_buds = neighbor_boards(leaf[:tiles_order])\n new_buds.each do |bud|\n leaves << build_leaf(bud, leaf) unless tree.include? bud\n end\n leaf = pop_cheapest_leaf(leaves)\n\n p \"iterations = #{i}\"\n p \"depth = #{leaf[:branch].length}\"\n p \"manhattan distance = #{leaf[:m_distance]}\"\n p \"tiles_order = #{leaf[:tiles_order]}\"\n\n return leaf[:branch] if leaf[:tiles_order] == solution\n end\n end", "def bsearch_tree(node, target)\n return target if node == target\n y = nil\n node.each do |x|\n if x.is_a? node.class\n y = bsearch_tree(x, target)\n else\n return target if x == target\n end\n end\n y\nend", "def grow( )\n\t\tnew_leaves = [ ]\n\t\t@leaves.each do |leaf|\n\t\t\tif @forward\n\t\t\t\tsearch = lambda { |song| leaf.song.last == song.first }\n\t\t\telse\n\t\t\t\tsearch = lambda { |song| leaf.song.first == song.last }\n\t\t\tend\n\t\t\t$songs.find_all(&search).each do |next_song|\n\t\t\t\tnew_leaves << leaf.add_next(next_song)\n\t\t\tend\n\t\tend\n\t\t@leaves = new_leaves\n\tend", "def bfs\n return [] unless @root\n q = [@root]\n out = []\n\n until q.empty? do\n current = q.shift\n out << { key: current.key, value: current.value }\n q << current.left if current.left\n q << current.right if current.right\n end\n\n return out\n end", "def search root, target\n queue = [root]\n\n until queue.empty?\n current = queue.shift\n return current if current.x == target.x && current.y == target.y\n\n current.make_children.each { |child| queue << child }\n end\nend", "def bfs(target_value)\n child_arr = [self]\n # children.each {|child| children_arr << child }\n while child_arr.length > 0\n node_to_check = child_arr.shift\n return node_to_check if node_to_check.value == target_value\n node_to_check.children.each { |child| child_arr << child }\n end\n nil\n end", "def bfs(target = nil, &prc)\n raise \"Need a proc or target\" if [target, proc].none?\n prc ||= Proc.new { |node| node.value == target }\n\n nodes = [self]\n until nodes.empty?\n node = nodes.shift\n return node if prc.call(node)\n nodes.concat(node.children)\n end\n nil \nend", "def depth_first_search_recursive(source)\n visited.add(source)\n\n source.neighbors.each do |neighbor|\n unless visited.include?(neighbor)\n depth_first_search_recursive(neighbor)\n meta[neighbor] = source\n end\n end\n end", "def expand state\n @map.adjacent(state[:city]).map do |c|\n {\n city: c,\n path: state[:path] + [c],\n depth: state[:depth] + 1,\n cost: state[:cost] + state[:city].distance_to(c)\n }\n end\n end", "def process_new_node(node)\n continue_unless_match(node) do\n if (node_in_queue = queue.find { |n| n.name == node.name }).present?\n if node.depth < node_in_queue.depth\n @requeued += 1\n queue.delete(node_in_queue)\n queue << node\n end\n elsif (node_in_queue = marked.find { |n| n.name == node.name }).present?\n if node.depth < node_in_queue.depth\n @unmarked += 1\n marked.delete(node_in_queue)\n queue << node\n end\n else\n @steps += 1\n queue << node\n end\n end\n end", "def breadthFirstSearch(array)\n queue = [self]\n\n while queue.length > 0\n current = queue.shift\n array.append(current.name)\n for child in current.children\n queue.append(child)\n end\n end\n\n return array\n\n end", "def bfs\n return [] if @root.nil?\n queue = []\n list = []\n queue.push(@root)\n while queue.length > 0\n curr_node = queue[0]\n list << {key: curr_node.key, value: curr_node.value}\n queue.push(curr_node.left) if curr_node.left\n queue.push(curr_node.right) if curr_node.right\n queue.shift\n end\n return list \n end", "def bfs\n result = []\n\n return result if @root.nil?\n\n queue = [@root]\n\n while !queue.empty?\n node = queue.shift\n\n result << { key: node.key, value: node.value }\n\n if node.left\n queue << node.left\n end\n\n if node.right\n queue << node.right\n end\n end\n\n return result\n end", "def bfs\n\n\n end", "def search(start, goal)\n openset = Set.new\n closedset = Set.new\n current = start\n\n if @maximize_cost # serves to invert the comparison\n openset_min_max = openset.method(:max_by)\n flip = -1\n else\n openset_min_max = openset.method(:min_by)\n flip = 1\n end\n\n openset.add(current)\n while not openset.empty?\n current = openset_min_max.call{|o| o.g + o.h }\n if current == goal\n path = []\n while current.parent\n path << current\n current = current.parent\n end\n path << current\n return path.reverse\n end\n openset.delete(current)\n closedset.add(current)\n @graph[current].each do |node|\n next if closedset.include? node\n\n if openset.include? node\n new_g = current.g + current.move_cost(node)\n if (node.g - new_g) * flip > 0\n node.g = new_g\n node.parent = current\n end\n else\n node.g = current.g + current.move_cost(node)\n node.h = heuristic(node, start, goal)\n node.parent = current\n openset.add(node)\n end\n end\n end\n return nil\n end", "def two_way_search(max_depth)\n start_state = State.new(@buckets, [], @goal)\n end_goal = @goal.clone\n end_goal.fill(@goal.capacity)\n end_state = State.new(@buckets, [], end_goal)\n\n left_fringe_states = [start_state]\n right_fringe_states = [end_state]\n\n depth = 0\n # until fringes intersect\n while not (left_fringe_states.intersects?(right_fringe_states)) and depth <= max_depth do\n depth += 1\n # step right\n # puts \"left_fringe: #{left_fringe_states}\"\n left_state = left_fringe_states.delete_at(0)\n left_state.generate_possible_actions.each do |action|\n left_fringe_states << left_state.clone.apply_action(action)\n end\n\n\n # step left\n # puts \"right_fringe: #{right_fringe_states}\"\n right_state = right_fringe_states.delete_at(0)\n right_state.generate_possible_reverse_actions.each do |action|\n right_fringe_states << right_state.clone.apply_action(action)\n end\n\n end\n\n if (left_fringe_states.intersects?(right_fringe_states))\n # return left_fringe_states.intersection(right_fringe_states)\n state1, state2 = left_fringe_states.intersection(right_fringe_states)\n # puts state1\n # puts state2\n # action_list = state1.actions + state2.actions.reverse.map(&:invert)\n action_list = state1.actions + state2.invert\n warn action_list.join(\", \")\n warn 'return action_list'\n return action_list\n else\n nil\n end\n end", "def fill_with_oxygen\n BFS.max_depth(Finder.new(@map.oxygen_pos, @map))\n end", "def bfs\n bfs_queue = []\n curr = @root\n node_list = []\n while curr\n visit(curr, node_list)\n bfs_queue << curr.left if curr.left\n bfs_queue << curr.right if curr.right\n curr = bfs_queue.shift\n end\n return node_list\n end", "def greedy1_fill!(remaining_partitions)\n remaining_partitions.each do |src_partition|\n # Test each site ...\n src_partition.sites.each do |site|\n\n simulation_result_below_bound = {}\n simulation_result_above_bound = {}\n # ... in each bin ...\n self.each_with_index do |bin, bin_index|\n target_partition = bin.list[src_partition.name]\n if target_partition.nil?\n # Creating a new partition is more costly than the worst case\n operations = @operations_worst_case + 1\n else\n # Simulate insertion of site into existing partition of current bin\n operations = target_partition.incr_add_sites!([site], simulate = true)\n end\n # Check if bin.size is smaller than lower_bound. Save simulation_result accordingly to prefer addition below lower_bound.\n if bin.update_size!.size < @operations_lower_bound\n simulation_result_below_bound.merge!({operations => bin_index})\n else\n simulation_result_above_bound.merge!({operations => bin_index})\n end\n\n end\n\n # Insert at lowest operation cost\n best = if simulation_result_below_bound.empty?\n simulation_result_above_bound.min_by { |operations, bin_index| operations }\n else\n simulation_result_below_bound.min_by { |operations, bin_index| operations }\n end\n target_partition = @list[best[1]].list[src_partition.name]\n if target_partition.nil?\n @list[best[1]].add!([Partition.new(src_partition.name, [site], src_partition.tree)])\n else\n target_partition.incr_add_sites!([site])\n end\n\n end\n end\n end", "def lexicograph_bfs(&block)\n lex_q = Plexus::Search::LexicographicQueue.new(vertices)\n result = []\n num_vertices.times do\n v = lex_q.pop\n result.unshift(v)\n lex_q.add_lexeme(adjacent(v))\n end\n result.each { |r| block.call(r) } if block\n result\n end", "def expand(current_node)\r\n x = current_node.x\r\n y = current_node.y\r\n return [ Astar_Node.new(x, y-1, @closed_nodes.size-1, -1, -1, -1), # north\r\n Astar_Node.new(x, y+1, @closed_nodes.size-1, -1, -1, -1), # south\r\n Astar_Node.new(x+1, y, @closed_nodes.size-1, -1, -1, -1), # east\r\n Astar_Node.new(x-1, y, @closed_nodes.size-1, -1, -1, -1) ] # west\r\n end", "def bfs_adj_list(queue, item)\n @checked_edges = []\n @current_node = start\n queue.add(@current_node)\n until current_node == item || current_node.nil?\n @current_node.linked_list.each do |next_node|\n queue.add(next_node)\n end\n current_node = queue.pop\n end\n return @current_node\n end", "def growing\n new_outer_nodes = []\n @outer_nodes.each do |o_n|\n new_partial_outer_nodes = set_outer_nodes(@neighbors_hash[o_n])\n new_outer_nodes << check_partial_outer_nodes(new_partial_outer_nodes, o_n)\n new_outer_nodes.flatten!\n end\n @outer_nodes = new_outer_nodes.compact\n end", "def breadth_first(node, target)\n # Setup\n queue = Queue.new\n queue.enqueue(node)\n # While queue exists\n while queue.elements?\n # Pop bottom off\n current_node = queue.dequeue\n # Check if it is target or nil\n return 'Could not locate your payload :(' if current_node.nil?\n return 'Found your target' if current_node.payload == target\n # Otherwise add its children to\n # back of line for checking\n add_kids_to_queue(current_node, queue)\n end\nend", "def breadth_first_search(start_node, target_value)\n\t\tvisited = [start_node]\t\t\t\n\t\tqueue = [start_node]\n\t\n\t\twhile ( queue.length > 0 )\t\n\n\t\t\t# dequeue\n\t\t\tvertex = queue.shift\n\t\t\treturn vertex if target_value.name == vertex.name\n\t\n\t\t\t# visit all adjacent unvisited vertexes, mark visited, enqueue\n\t\t\tNode.childPointers.each do |child|\n\t\t\t\tif !eval(\"vertex.#{child}.nil?\")\n\t\t\t\t\tif !eval(\"visited.include?vertex.#{child}\")\n\t\t\t\t\t\tvisited << eval(\"vertex.#{child}\")\n\t\t\t\t\t\teval(\"vertex.#{child}.prev = vertex\")\n\t\t\t\t\t\tqueue << eval(\"vertex.#{child}\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tnil\n\tend", "def solve\n graph = Graph.create(words, WordNode)\n graph.connect_nodes(:one_char_diff)\n\n end_node = graph.nodes_hash[end_word]\n start_node = graph.nodes_hash[start_word]\n start_node.cost = 0\n\n heap = Containers::Heap.new { |a, b| (a.cost <=> b.cost) == -1 }\n graph.nodes_hash.each do |k, v|\n heap.push v\n end\n\n puts heap.size\n # puts \"is empty?#{heap.empty?}\"\n until heap.empty? do\n current_node = heap.pop\n puts current_node.value, current_node.cost\n # puts current_node == end_node\n # puts current_node.value, end_node.value\n return graph.path(end_node) if current_node == end_node\n\n current_node.connected_nodes.each do |node|\n\n # puts node.visited\n unless node.visited\n cost = current_node.cost + 1\n if cost < node.cost\n node.cost = cost\n node.parent = current_node\n # puts \"changed parent\"\n # puts node.parent\n end\n end\n end\n\n current_node.visited = true\n end\n end", "def breadth_first_search(data)\n node = nil\n @list << @root if @root\n\n until @list.empty?\n # get next node from the queue\n node = @list.shift\n puts \"Visiting node #{node.value}\" if @debug\n break if node.value == data\n # place each child in the queue, from left to right\n @list << node.left if node.left\n @list << node.right if node.right\n end\n @list.clear # remove any remaining items from the queue\n\t node\n end", "def bradth_first_search(start_vertex, stop_vertex)\n queue = Array.new()\n queue << search_vertex(start_vertex)\n until queue.empty?\n temp_vertex = queue.shift()\n break if temp_vertex.value == stop_vertex\n vertex_edges = temp_vertex.edges.head\n until vertex_edges == nil\n current = search_vertex(vertex_edges.value)\n if current.visited == false\n current.visited = true\n current.parent = temp_vertex.value\n queue << current\n end\n vertex_edges = vertex_edges.link\n end\n temp_vertex.visited = true\n end\n graph_traversal(start_vertex, stop_vertex)\n end", "def find_order_bfs\n queue = []\n @num_courses.times { |v| queue.push(v) if @in_degrees[v].zero? } # 入度为0的全都放入\n\n visited = []\n until queue.empty?\n node_key = queue.shift\n\n visited.unshift(node_key) # 注意顺序\n\n @nodes[node_key]&.each do |neighbor|\n @in_degrees[neighbor] -= 1\n queue.push(neighbor) if @in_degrees[neighbor].zero?\n end\n end\n\n visited.size == @num_courses ? visited : []\n end", "def fixBTree( node, index)\n # If the left sibling has more than min keys.\n if (index != 0 && node.arr[index - 1].n > self.min)\n self.borrowFromLeft(node, index)\n elsif (index != node.n && node.arr[index + 1].n > self.min)\n self.borrowFromRight(node, index)\n else\n if (index != node.n)\n self.merge(node, index)\n else\n self.merge(node, index - 1)\n end\n end\n end", "def reconstruct_bst_from_traversal(pre_order)\n reconstruct_bst_rec(0, pre_order.length - 1, pre_order)\nend", "def each_dfs\n color_list, white_list = [], []\n\n white_list << self\n color_list << self\n\n while !white_list.empty?\n r = white_list.pop()\n\n # do some code for each room found in the BFS.\n yield r\n\n r.each_dir do |e|\n if !color_list.include?(e.towards_room.gri)\n white_list << r.exit_list[i].towards_room.gri\n color_list << r.exit_list[i].towards_room.gri\n end\n end\n end\n return nil\n end", "def build_paths(start)\n step = 0\n visited = []\n unvisited = [[board_node_by_location(start),step]]\n \n while !unvisited.empty?\n node = unvisited[0][0]\n step = unvisited[0][1] + 1\n \n node.neighbors.each do |x|\n if not_visited(board_node_by_location(x),visited, unvisited)\n unvisited << [board_node_by_location(x),step]\n end\n end\n visited << unvisited.shift\n end\n return visited\nend", "def depth_first_search(node)\n return if node.nil?\n node.visit\n node.connections.each do |conn|\n depth_first_search(conn) unless conn.visited\n end\nend", "def dfs(start_node)\n s = []\n visited = Set.new\n\n s.push(start_node)\n\n while !s.empty?\n current_node = s.shift\n next if visited.include?(current_node)\n visited.add(current_node)\n current_node.neighbors.each do |n|\n s.push(n)\n end\n puts current_node.name\n p s.map(&:name)\n p visited.map(&:name)\n end\nend", "def rebuild!\n\n scope = lambda{}\n # TODO: add scope stuff\n \n # Don't rebuild a valid tree.\n return true if valid?\n indices = {}\n \n move_to_child_of_lambda = lambda do |parent_node|\n # Set left\n parent_node[nested_set_options[:left_column]] = indices[scope.call(parent_node)] += 1\n # Gather child noodes of parend_node and iterate by children\n parent_node.children.order(:id).all.each do |child_node|\n move_to_child_of_lambda.call(child_node)\n end\n # Set right\n parent_node[nested_set_options[:right_column]] = indices[scope.call(parent_node)] += 1\n parent_node.save\n end\n\n # Gatcher root nodes and iterate by them\n self.roots.all.each do |root_node|\n # setup index for this scope\n indices[scope.call(root_node)] ||= 0\n move_to_child_of_lambda.call(root_node)\n end\n end", "def nodes_breadthfirst(node = self.root, &block)\n @nodes = []\n iterate_breadthfirst(node, &block)\n ensure\n @nodes = nil\n end", "def dfs(start_vertex, &block)\n start_vertex.gray!\n @time += 1\n start_vertex.discovery = @time\n start_vertex.get_connections.each do |next_vertex|\n if next_vertex.white?\n next_vertex.predecessor = start_vertex\n dfs(next_vertex, &block)\n end\n end\n start_vertex.black!\n @time += 1\n start_vertex.finish = @time\n yield start_vertex if block_given?\n end", "def reset_search\n breadth_first_search.visited = {}\n breadth_first_search.frontier = []\n breadth_first_search.came_from = {}\n\n dijkstra_search.frontier = []\n dijkstra_search.came_from = {}\n dijkstra_search.cost_so_far = {}\n end", "def update( search_nodes )\n if has_target_predicate? then\n search_nodes.each do |node|\n if node.slot_filled?(@slot_name) then\n unless @target_predicate.apply(node[@slot_name].to_a).empty?\n yield( node )\n end \n end\n end\n else\n search_nodes.each do |node|\n yield( node )\n end\n end\n end", "def build_tree(piece, finish, space = piece.space, board = self)\n piece.class == Queen ? space.find_adjacent_queen(board, finish, piece) : space.find_adjacent(board, piece)\n @searched << space\n return space if space == finish\n\n space.adjacent.each { |square| @queue << square }\n build_tree(piece, finish, @queue.shift)\n end", "def build(node)\n return @nodes[node.val] if @nodes[node.val]\n @nodes[node.val] = Node.new(node.val)\n node.neighbors&.each do |neighbor|\n @nodes[node.val].neighbors << build(neighbor)\n end\n @nodes[node.val]\nend", "def expand_depth(node) #:nodoc:\n relations_for(node).each do |rel|\n yield_node(rel)\n\n expand_node(rel) unless @description.prune_node?(rel)\n end\n end", "def bfs(current = @root, array = [])\n if current == nil\n return array\n else\n bfs(current.left, array)\n array << { key: current.key, value: current.value }\n bfs(current.right, array)\n end\n end", "def bfs(target_value)\n queue = []\n queue << self\n\n while queue.empty? == false\n check = queue.pop\n \n if check.value == target_value\n return check.value\n else\n queue.unshift(*check.children)\n end\n end\n \n false\n end", "def search_jps\n open_list = [@nodes[@route.start_id]]\n close_list = []\n goal = @nodes[@route.goal_id]\n\n until open_list.empty?\n n = open_list.min_by { |node| @route.estimated_cost(node) }\n if n == goal\n @route.found = true\n break\n end\n\n close_list.push( open_list.delete(n) )\n\n adjacents_of_n = n.pruned_neighbors(@route.parent(n))\n adjacents_of_n.keys.each do |m|\n j = jump(n, clamp(m.x - n.x, -1, 1), clamp(m.y - n.y, -1, 1))\n next if j == nil or close_list.include?(j)\n h = @heuristic.call(j, goal)\n new_real_cost_j = @route.real_cost(n) + Math.sqrt((n.x-j.x)**2 + (n.y-j.y)**2) # g\n new_estimated_cost_j = new_real_cost_j + h # f = g + h\n if open_list.include?(j)\n # If estimated costs are equal then use real costs for more precise comparison (or we may get less optimal path).\n next if new_estimated_cost_j > @route.estimated_cost(j)\n next if new_estimated_cost_j == @route.estimated_cost(j) && new_real_cost_j >= @route.real_cost(j)\n @route.record(j, n, new_real_cost_j, h)\n else\n open_list.push(j)\n @route.record(j, n, new_real_cost_j, h)\n end\n @visited << j.id unless @visited.include? j.id # stats\n end\n @search_iter += 1 # stats\n end\n end", "def bfs\n list = []\n if @root\n queue = []\n queue << @root\n queue.each do |current|\n list << {key: current.key, value: current.value}\n queue << current.left if current.left\n queue << current.right if current.right\n end\n end\n return list\n end", "def dfs_iterative(target)\n stack = [self]\n\n until stack.empty?\n node = stack.pop\n\n return node if node.value == target\n\n node.children.each do |child|\n stack << child\n end\n end\n\n nil\n end", "def breadth_first_search(target)\n queue = [@root]\n visited = []\n\n until queue.empty?\n node = queue[0]\n visited << node\n return \"Found target: #{target} at node #{node}\" if node.value == target\n if node.left && !visited.include?(node.left)\n queue << node.left\n end\n if node.right && !visited.include?(node.right)\n queue << node.right\n end\n queue.shift\n end\n end", "def astar pos, phi, current_road, goal\n fringe = PriorityQueue.new\n # figure out which node of our road we're facing\n facing, other = [current_road.n0, current_road.n1].sort_by{|n|\n ((n.pos - pos).dir - phi).abs\n }\n fringe.add(AStarNode.new(facing, AStarNode.new(other, nil)))\n closed_states = Set.new [other]\n nodes_expanded = 0\n until fringe.isEmpty\n current = fringe.remove\n next if closed_states.include? current.state\n return current if current.state == goal\n\n expanded = current.expand\n \n closed_states << current.state\n # since we have a bunch of nodes that only go to a single\n # node, it seems kind of silly to count those as expansions\n nodes_expanded += 1 if expanded.size > 1\n \n if nodes_expanded > MAX_NODES_EXPANDED\n puts \"Reached max expansion depth\"\n return nil\n end\n expanded.each{|successor|\n successor.g = current.g + current.state.pos.dist(successor.state.pos)\n successor.h = successor.state.pos.dist goal.pos\n fringe.add(successor)\n }\n end\n puts \"Failed to find solution after #{nodes_expanded} expansions\"\n return nil\n end", "def trim_and_extend_path(visited_nodes) \n extended_path = []\n \n subpath = visited_nodes[0..(visited_nodes.length - 3)]\n \n extension_point = subpath.detect { |node| unvisited_neighbours_of(node, visited_nodes).length > 0 }\n \n if extension_point \n extension_index = subpath.index(extension_point)\n puts \" - got extension point: #{extension_index} out of #{visited_nodes.length}\"\n \n unvisited_nodes = self.nodes - visited_nodes\n reduced_adjacencies = self.adjacencies.select { |node, connections| unvisited_nodes.include?(node) }\n\n outside_cycle_finder = CycleFinder.new(unvisited_nodes, reduced_adjacencies) \n\n first_node = unvisited_neighbours_of(extension_point, visited_nodes).first \n unvisited_path = outside_cycle_finder.grow_basic_path([ first_node ])\n \n v_j = (visited_nodes & connected_to(unvisited_path.last)).detect do |node|\n j = visited_nodes.index(node)\n (j > extension_index + 1) && (j < visited_nodes.length) && \n connected?(visited_nodes[j + 1], visited_nodes[extension_index + 1])\n end\n \n if v_j\n end_index = visited_nodes.index(v_j)\n \n extended_path += visited_nodes[0..extension_index]\n extended_path += unvisited_path\n extended_path += visited_nodes[(extension_index + 1)..end_index].reverse\n extended_path += visited_nodes[(end_index + 1)..(visited_nodes.length - 1)]\n end\n end\n\n if extended_path.length > visited_nodes.length\n puts \" - path extended by #{extended_path.length - visited_nodes.length}\"\n trim_and_extend_path(extended_path)\n else\n puts \" - failed to extend, returning #{visited_nodes.length}\"\n visited_nodes\n end \n end" ]
[ "0.6668395", "0.64870673", "0.63933283", "0.6341461", "0.6263692", "0.62364405", "0.61913985", "0.6186775", "0.61284083", "0.61246395", "0.6118684", "0.6070348", "0.60554963", "0.60554415", "0.605217", "0.60435", "0.6023189", "0.5988652", "0.5984487", "0.59387016", "0.5938162", "0.59313756", "0.59161365", "0.5892542", "0.58921", "0.5890241", "0.5811477", "0.57941765", "0.57754993", "0.57746935", "0.57423615", "0.57336545", "0.57191443", "0.570411", "0.5690956", "0.5684299", "0.5653486", "0.5646539", "0.5634842", "0.56263727", "0.5604643", "0.55992985", "0.55952644", "0.5587252", "0.5583621", "0.5574517", "0.55573356", "0.5556033", "0.5545364", "0.55452555", "0.55364734", "0.55280924", "0.5526067", "0.5521226", "0.55191225", "0.5517164", "0.5516552", "0.55133194", "0.55116534", "0.5509303", "0.54912394", "0.5486145", "0.5482225", "0.5482143", "0.5478737", "0.5476707", "0.54725736", "0.54686564", "0.5458864", "0.54577744", "0.5447081", "0.54112494", "0.5403512", "0.5398684", "0.53881073", "0.5386014", "0.5383668", "0.53762436", "0.53726417", "0.53691953", "0.5358249", "0.5356162", "0.53326863", "0.53319514", "0.5328349", "0.53281176", "0.53260094", "0.5321575", "0.53095186", "0.5309399", "0.53088415", "0.5303523", "0.5303188", "0.5297176", "0.5292721", "0.5287953", "0.5283945", "0.52764773", "0.5276238", "0.5273145", "0.527023" ]
0.0
-1
Initialize a new HttpClient
def initialize(uri = nil, options = nil, &block) @url = uri @options = options @user_agent ||= USER_AGENT['bot'] yield self if block_given? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_http_client\n c = DefaultHttpClient.new( @connection_manager, @cparams )\n c.http_request_retry_handler = @retry_handler if @retry_handler\n c\n end", "def init_http_client(options)\n http = Net::HTTP.new(@base_uri.host, 443)\n http.use_ssl = true if @base_uri.scheme == \"https\"\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE # FIXME: not 100% supported\n self.http_client = http\n end", "def new_http_client\n client = Net::HTTP.new(@uri.host, @uri.port)\n if @uri.scheme == \"https\"\n configure_ssl(client)\n end\n client\n end", "def initialize\n self.http_client = HTTPClient.new(:base_url => Rdioid::BASE_URL, :force_basic_auth => true)\n\n http_client.set_auth(Rdioid::OAUTH_TOKEN_ENDPOINT, Rdioid.config.client_id, Rdioid.config.client_secret)\n end", "def initialize(http)\n @http = http\n end", "def initialize(username, password, http_adapter = nil)\r\n http_adapter = http_adapter.nil? ? HTTPAdapter.new : http_adapter\r\n http_adapter.set_auth(username, password)\r\n\r\n @http_client = HTTPClient.new(CLX::base_url, http_adapter)\r\n end", "def initialize(url, hdrs = nil)\n @logger = Neko.logger\n @init_uri = URI(url)\n raise ArgumentError, 'Invalid URL' unless @init_uri.class <= URI::HTTP\n @http = Net::HTTP.new(init_uri.host, init_uri.port)\n http.use_ssl = init_uri.scheme == 'https'\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n @headers = hdrs\n end", "def http_client\n @http_client ||= @http_adapter.new(@site_url, @connection_options)\n end", "def initialize(opts)\n # Get the options and assign default values:\n @host = opts[:host]\n @port = opts[:port] || 443\n @username = opts[:username]\n @password = opts[:password]\n @insecure = opts[:insecure] || false\n @ca_file = opts[:ca_file]\n @log = opts[:log]\n @debug = opts[:debug] || false\n\n # Create the HTTP client:\n @client = HttpClient.new(\n :host => @host,\n :port => @port,\n :insecure => @insecure,\n :ca_file => @ca_file,\n :log => @log,\n :debug => @debug,\n )\n end", "def initialize_http(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http\n end", "def initialize(cert_file: nil)\n @client = HTTPClient.new\n\n # this callback allows following redirects from http to https, otherwise it will not\n @client.redirect_uri_callback = ->(_uri, res) {\n res.header['location'][0]\n }\n\n # ran into problems like https://github.com/nahi/httpclient/issues/181 so forcing basic auth\n @client.force_basic_auth = true\n @client.set_basic_auth(nil, APP_CONFIG[:repository][:username], APP_CONFIG[:repository][:password])\n\n # TODO: remove this once Merritt has fixed their certs on their stage server.\n @client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE # TODO: remove for extra security once Merritt gets real certs\n @client.ssl_config.set_trust_ca(cert_file) if cert_file\n @client.connect_timeout = TIMEOUT\n @client.send_timeout = TIMEOUT\n @client.receive_timeout = TIMEOUT\n @client.keep_alive_timeout = TIMEOUT\n end", "def initialize(opts)\n # Get the options and assign default values:\n @host = opts[:host]\n @port = opts[:port] || 443\n @username = opts[:username]\n @password = opts[:password]\n @insecure = opts[:insecure] || false\n @ca_file = opts[:ca_file]\n @log = opts[:log]\n @debug = opts[:debug] || false\n @proxy_url = opts[:proxy_url]\n @proxy_username = opts[:proxy_username]\n @proxy_password = opts[:proxy_password]\n @timeout = opts[:timeout]\n\n # Create the HTTP client:\n @client = HttpClient.new(\n host: @host,\n port: @port,\n insecure: @insecure,\n ca_file: @ca_file,\n log: @log,\n debug: @debug,\n proxy_url: @proxy_url,\n proxy_username: @proxy_username,\n proxy_password: @proxy_password,\n timeout: @timeout\n )\n end", "def setup_http_client(logger: nil)\n proxy = Clients::ProxyClient.from_env\n Clients::HttpClient.new(proxy: proxy, logger: logger)\n end", "def http_client\n @http_client ||=\n begin\n uri = URI(http_request[:url])\n Net::HTTP.new(uri.host, uri.port).tap { |e| e.read_timeout = dispatch_deadline }\n end\n end", "def initialize(url:, http_client: T.unsafe(nil)); end", "def initialize(options = {})\n options = DEFAULT_ARGS.merge(options)\n\n @client = Faraday.new(\n faraday_options(options),\n ) do |f|\n f.adapter :net_http\n end\n end", "def create_http_conn\n @http = Net::HTTP.new(@base_uri.host, @base_uri.port)\n @http.use_ssl = true\n @http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @digest_auth = Net::HTTP::DigestAuth.new\n end", "def initialize\n # Set some default values.\n # We're running `varnishlog` on localhost.\n default_http_hostname = 'http://localhost'\n default_http_port = '80'\n default_request_uri = '/'\n \n @uri = URI.parse(\"#{default_http_hostname}:#{default_http_port}#{default_request_uri}\")\n @http = Net::HTTP.new(@uri.host, @uri.port)\n @request_headers = {\n 'Host' => 'www.example.com',\n 'User-Agent' => 'shellac'\n }\n @request = Net::HTTP::Get.new(@uri.request_uri, @request_headers)\n end", "def initialize(http_options = {})\n @http_options = http_options\n end", "def init_http\r\n http = Net::HTTP.new(HOST, PORT)\r\n http.use_ssl = true\r\n http.set_debug_output(@parameters.http_debug_stream) if @parameters.http_debug_stream\r\n http\r\n end", "def initialize(options = {})\n self.http_connection_factory = options.delete(:http_connection_factory) || Net::HTTP\n end", "def initialize_http_handler(args = {})\n @http = HTTPHandler.new(args)\n logger.debug { \"Connection Set: #{http.to_s}\" }\n end", "def initialize(api_key)\n @client = HTTPClient.new(\n default_header: {\n 'X-Auth-Token' => api_key,\n 'Content-Type' => 'application/json'\n }\n )\n end", "def initialize_http_handler(args = {})\n @http = HTTPHandler.new(args)\n logger.debug { \"Connection Set: #{http.to_s}\" }\n end", "def initialize(options={})\n @debug_dev = options[:debug_dev]\n @autodiscover_url = options[:autodiscover_url]\n\n @http = HTTPClient.new\n @http.force_basic_auth = true # Saves one unathenticated request\n @http.connect_timeout = options[:connect_timeout] || CONNECT_TIMEOUT_DEFAULT\n @http.debug_dev = @debug_dev if @debug_dev\n\n @redirect_count = 0\n end", "def initialize(opts)\n self.token = opts[:token]\n\n # setup the http object for ssl\n @url = URI.parse(BASE_URL)\n @http = Net::HTTP.new(@url.host, @url.port)\n @http.use_ssl = true\n end", "def initialize(config, client = nil)\n @host = config[:host]\n\n raise ArgumentError, 'No API host is provided.' if @host.nil?\n\n if client.nil? # rubocop:disable Style/ConditionalAssignment\n @client = ArkEcosystem::Client::HTTP::Client.new(config)\n else\n @client = client.new(config)\n end\n end", "def initialize(options = {})\n options[:host] ||= Defaults::Request.host\n options[:port] ||= Defaults::Request.port\n options[:ssl] ||= Defaults::Request.ssl\n options[:headers] ||= Defaults::Request.headers\n @path = options[:path] || Defaults::Request.path\n\n http = Net::HTTP.new(options[:host], options[:port])\n http.use_ssl = options[:ssl]\n http.read_timeout = 8\n http.open_timeout = 4\n\n @http = http\n end", "def http\n @http ||= create_http\n end", "def http\n @http ||= create_http\n end", "def http_client\n @http_client ||= begin\n client = nil\n\n if HTTP::VERSION.split(\".\").first.to_i > 3\n client = HTTP.timeout(timeout)\n else\n # timeout setting on http.rb 3.x are a bit of a mess.\n # https://github.com/httprb/http/issues/488\n client = HTTP.timeout(:global, write: timeout / 3, connect: timeout / 3, read: timeout / 3)\n end\n\n if settings[\"oai_pmh.try_gzip\"]\n client = client.use(:auto_inflate).headers(\"accept-encoding\" => \"gzip;q=1.0, identity;q=0.5\")\n end\n\n if settings[\"oai_pmh.http_persistent\"]\n parsed_uri = URI.parse(start_url)\n client = client.persistent(\"#{parsed_uri.scheme}://#{parsed_uri.host}\")\n end\n\n client\n end\n end", "def initialize(args)\n require \"http2\"\n require \"json\"\n \n @http = Http2.new(\n :host => args[:host],\n :port => args[:port],\n :ssl => args[:ssl]\n )\n end", "def initialize(options)\n initialize_options(options)\n initialize_headers\n http_request\n end", "def setup_http_client\n if data_collector_token.nil?\n Chef::ServerAPI.new(data_collector_server_url, validate_utf8: false)\n else\n Chef::HTTP::SimpleJSON.new(data_collector_server_url, validate_utf8: false)\n end\n end", "def _new_http resource\n uri = ::URI.parse(resource.auth_uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true if uri.scheme == 'https'\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.read_timeout = 3\n http.open_timeout = 3\n http\nend", "def _new_http resource\n uri = ::URI.parse(resource.auth_uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true if uri.scheme == 'https'\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.read_timeout = 3\n http.open_timeout = 3\n http\nend", "def new_http(uri); end", "def http\n # TODO: Deal with proxies and such\n unless @http\n @http = HTTPClient.new\n # TODO: This should be on the class level\n @http.connect_timeout = ApiResource::Base.open_timeout\n @http.receive_timeout = ApiResource::Base.timeout\n end\n\n return @http\n end", "def create_http(_url = nil)\n\n\n if !request_endpoint.nil?\n _url = request_endpoint\n end\n\n\n if _url.nil? || _url[0] =~ /^\\//\n our_uri = URI.parse(site)\n else\n our_uri = URI.parse(_url)\n end\n\n\n if proxy.nil?\n http_object = Net::HTTP.new(our_uri.host, our_uri.port)\n else\n proxy_uri = proxy.is_a?(URI) ? proxy : URI.parse(proxy)\n http_object = Net::HTTP.new(our_uri.host, our_uri.port, proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password)\n end\n\n http_object.use_ssl = (our_uri.scheme == 'https')\n\n if @options[:ca_file] || CA_FILE\n http_object.ca_file = @options[:ca_file] || CA_FILE\n http_object.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http_object.verify_depth = 5\n else\n http_object.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n http_object.read_timeout = http_object.open_timeout = @options[:timeout] || 30\n http_object.open_timeout = @options[:open_timeout] if @options[:open_timeout]\n\n http_object\n end", "def initialize(**args)\n raise ArgumentError, \"args must be a Hash!\" unless args.is_a?(Hash)\n\n @url = args.fetch(:url)\n @method = args.fetch(:method).to_s.downcase\n @headers = (args[:headers] || {}).dup\n @payload = args[:payload]\n @timeout = args.fetch(:timeout, ProxyFetcher.config.client_timeout)\n @ssl_options = args.fetch(:ssl_options, default_ssl_options)\n\n @proxy = args.fetch(:proxy)\n @max_redirects = args.fetch(:max_redirects, 10)\n\n @http = build_http_client\n end", "def initialize(options = {})\n options = DEFAULT_ARGS.merge(options)\n\n @client = Faraday.new(\n faraday_options(options),\n ) do |conn|\n conn.response(:json)\n conn.adapter(Faraday.default_adapter)\n end\n end", "def initialize(server_host, server_port = nil, username = 'admin', password = 'admin', use_tls = false, version = API_CURRENT_VERSION)\n @version = version\n protocol = use_tls ? 'https' : 'http'\n server_port = use_tls ? 7183 : 7180 if server_port.nil?\n base_url = \"#{protocol}://#{server_host}:#{server_port}/api/v#{version}\"\n\n client = HttpClient.new(base_url, ApiException)\n client.set_basic_auth(username, password, API_AUTH_REALM)\n client.headers = { :'content-type' => 'application/json' }\n super(client)\n end", "def initialize(http_response, request)\n @http_response = http_response\n @request = request\n end", "def http_client\n # pass any proxy settings.\n proxy = Net::HTTP::Proxy(self.class.proxy_host, self.class.proxy_port,\n self.class.proxy_user, self.class.proxy_pass)\n http = proxy.new('api.exceptional.io', http_port)\n\n # set http client options.\n http.read_timeout = self.class.http_read_timeout || 5\n http.open_timeout = self.class.http_open_timeout || 2\n http.use_ssl = use_ssl?\n\n http\n end", "def initialize(options = {})\n @headers = options[:headers] || HEADERS\n @retries = options[:retries] || RETRIES\n @backoff_policy =\n options[:backoff_policy] || Sumologic::Metrics::BackoffPolicy.new\n\n uri = URI(options.fetch(:uri))\n http = Net::HTTP.new(uri.host, uri.port)\n http.set_debug_output(logger) if logger.level == Logger::DEBUG\n http.use_ssl = uri.scheme == 'https'\n http.read_timeout = 8\n http.open_timeout = 4\n\n @path = uri.path\n @http = http\n end", "def initialize(url_str)\n STDERR.puts \"Getting URL '#{url_str}'\"\n uri = URI.parse(url_str)\n unless VALID_SCHEMES.include?(uri.scheme)\n STDERR.puts \"URL protocol is not one of #{VALID_SCHEMES.join(',')}\"\n exit 1\n end\n if proxy = ENV['HTTP_PROXY']\n prx_uri = URI.parse(proxy)\n prx_host = prx_uri.host\n prx_port = prx_uri.port\n end\n\n h = Net::HTTP.new(uri.host, uri.port, prx_host, prx_port)\n h.set_debug_output($stderr) if $DEBUG\n h.use_ssl = uri.scheme == \"https\"\n h.verify_mode = OpenSSL::SSL::VERIFY_NONE # OpenSSL::SSL::VERIFY_PEER\n\n @body = ''\n begin\n @get_resp = h.get2(uri.request_uri, HTTP_GET_HEADER){|resp| @body += resp.body}\n rescue Exception => ex\n STDERR.puts \"Unable to get web page. Error: #{ex}\"\n exit 1\n end\n STDERR.puts \"#{@get_resp.class}\"\n\n end", "def initialize(uri, params = nil)\n @uri = uri\n @params = params || DefaultConnectionParameters.new\n\n # Open a persistent HTTP connection.\n @http = Net::HTTP::Persistent.new(\"Taverna_Server_Ruby_Client\")\n\n # Set timeouts if specified.\n @http.open_timeout = @params[:open_timeout] if @params[:open_timeout]\n @http.read_timeout = @params[:read_timeout] if @params[:read_timeout]\n end", "def http_client\n client = HTTPClient.new\n client.connect_timeout = 20 # 20 seconds\n client.receive_timeout = 20 # 20 seconds\n client\n end", "def initialize(url_str)\n $LOG.info \"Getting URL '#{url_str}'\"\n uri = URI.parse(url_str)\n unless VALID_SCHEMES.include?(uri.scheme)\n $LOG.fatal \"URL protocol is not one of #{VALID_SCHEMES.join(',')}\"\n exit 1\n end\n if proxy = ENV['HTTP_PROXY']\n prx_uri = URI.parse(proxy)\n prx_host = prx_uri.host\n prx_port = prx_uri.port\n end\n\n h = Net::HTTP.new(uri.host, uri.port, prx_host, prx_port)\n h.set_debug_output($stderr) if $DEBUG\n h.use_ssl = uri.scheme == \"https\"\n h.verify_mode = OpenSSL::SSL::VERIFY_NONE # OpenSSL::SSL::VERIFY_PEER\n\n @body = ''\n begin\n @get_resp = h.get2(uri.request_uri, Config[:http_get_header]){|resp| @body += resp.body}\n rescue Exception => ex\n $LOG.fatal \"Unable to get web page. Error: #{ex}\"\n exit 1\n end\n\n if http_redirect?\n $LOG.debug \"#{@get_resp.class} is a kind of HTTPRedirection\"\n $LOG.debug \"Redirect location = #{redirect_location}\"\n elsif http_success?\n $LOG.debug \"#{@get_resp.class} is a kind of HTTPSuccess\"\n else\n $LOG.debug \"#{@get_resp.class} is neither HTTPSuccess nor HTTPRedirection!!!\"\n end\n\n end", "def start\n @scheme_registry = create_scheme_registry\n @connection_manager = create_connection_manager\n\n @client = create_http_client\n end", "def initialize(path, subpath = nil, auth: false, client: nil)\n @auth = auth\n @client = client || Plaid.client\n verify_configuration\n\n path = File.join(@client.env, path.to_s)\n path = File.join(path, subpath.to_s) if subpath\n\n @uri = URI.parse(path)\n\n @http = Net::HTTP.new(@uri.host, @uri.port)\n @http.use_ssl = true\n\n @http.read_timeout = Plaid.read_timeout || DEFAULT_TIMEOUT\n end", "def instantiate_http(uri) # :nodoc:\n http_class = if @proxy && @proxy[:host]\n Net::HTTP::Proxy(@proxy[:host], @proxy[:port], @proxy[:username], @proxy[:password])\n else\n Net::HTTP\n end\n\n http = http_class.new(uri.host, uri.port)\n if uri.scheme == \"https\"\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n end\n http.open_timeout = @open_timeout\n http.read_timeout = @read_timeout\n\n http\n end", "def initialize(url)\n @url = url.to_s\n @http = HTTP.headers(default_headers)\n @timeout = ProxyFetcher.config.provider_proxies_load_timeout\n\n @ssl_ctx = OpenSSL::SSL::SSLContext.new\n @ssl_ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end", "def initialize(api_key, resource_url)\n @rest_client = RestClient.new(resource_url, api_key)\n end", "def initialize(http, _code, _path) # @private\n @success, @body, @errors = http.success, http.response, http.errors\n @code, @path, @params = _code, _path\n end", "def http_client\n @conn ||= Net::HTTP.start(EC2_METADATA_ADDR).tap do |h|\n h.read_timeout = 10\n h.keep_alive_timeout = 10\n end\n end", "def connection\n return @connection if @connection\n conn_opts = {\n host: host,\n port: port,\n cert: opts[:cert],\n key: opts[:key],\n cacert: opts[:cacert]\n }\n @connection = Ncio::HttpClient.new(conn_opts)\n end", "def http\n Faraday.new(url: URL) do |c|\n c.token_auth self.auth_token\n c.request http_config[:request_encoding]\n c.response :json, :content_type => /\\bjson$/ # parse responses to JSON\n c.adapter http_config[:http_adapter]\n end\n end", "def initialize(provider_url, logger=nil)\n @url = provider_url\n @req = Request.new\n @preferences = Preferences.new\n @http = HTTPClient.new\n @http.proxy = nil\n unless logger\n require 'logger'\n logger = Logger.new(STDOUT)\n end\n @logger = logger\n end", "def initialize(username, password, auth_key) \n @username = username\n @password = password\n \n @uri = URI.parse(@@fonolo_uri)\n @headers = { \"Content-Type\" => \"application/json\",\n \"X-Fonolo-Auth\" => auth_key,\n \"X-Fonolo-Username\" => username, \n \"X-Fonolo-Password\" => password }\n \n @http = Net::HTTP.new(@uri.host, @uri.port)\n @http.use_ssl = true\n end", "def initialize\n @action = :get\n @headers = {}\n @timeout = 0\n @connect_timeout = 0\n @max_redirects = -1\n end", "def initialize(url = \"http://localhost:3000\", headers = {})\n @uri = URI url\n @headers = headers\n end", "def initialize(api_key:, read_timeout: 60, open_timeout: 30, api_base: 'https://api.easypost.com',\n custom_client_exec: nil)\n raise EasyPost::Errors::MissingParameterError.new('api_key') if api_key.nil?\n\n @api_key = api_key\n @api_base = api_base\n @api_version = 'v2'\n @read_timeout = read_timeout\n @open_timeout = open_timeout\n @lib_version = File.open(File.expand_path('../../VERSION', __dir__)).read.strip\n\n # Make an HTTP client once, reuse it for all requests made by this client\n # Configuration is immutable, so this is safe\n @http_client = EasyPost::HttpClient.new(api_base, http_config, custom_client_exec)\n end", "def create_http_connection(uri); end", "def initialize(opts={})\n name = opts[:user_agent] || DEFAULT_USER_AGENT\n @client = opts[:client] || HTTPClient.new( :agent_name => name )\n @apikey = opts[:apikey] || nil \n @opts = opts\n end", "def initialize base_url, api_key\n\t\t\t\t\t@connection = Freshdesk::Api::Client::Request.new base_url, api_key\n\t\t\t\tend", "def initialize(host, use_ssl, port)\n self.handle = Net::HTTP.new(host, port)\n self.handle.open_timeout = @@open_timeout # seems to have no effect?\n self.handle.read_timeout = @@read_timeout # seems to have an effect on establishing tcp connection??\n self.handle.close_on_empty_response = true # seems to have no effect?\n if use_ssl\n self.handle.use_ssl = true\n # respond_to? check is a ruby-1.9.1-p378 (+/-?) bug workaround\n self.handle.ssl_timeout = @@ssl_timeout if OpenSSL::SSL::SSLContext.new.respond_to?(:ssl_timeout=)\n self.handle.verify_mode = @@ssl_verify_mode\n self.handle.ca_file = @@ssl_ca_file\n self.handle.verify_depth = @@ssl_verify_depth\n end\n self.cookies = {}\n end", "def initialize(*args)\n @client ||= Betaface::REST::Client.new(*args) \n end", "def initialize(host, port, proxy=nil, proxy_port=nil, proxy_user=nil, proxy_passwd=nil)\n\t\t\tconn = Net::HTTP.new(host, port, proxy, proxy_port, proxy_user, proxy_passwd)\n\t\t\tconn.use_ssl = true\n\t\t\t#conn.enable_post_connection_check= true\n\t\t\tconn.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\t\t\t#conn.verify_mode = OpenSSL::SSL::VERIFY_NONE \n\t\t\t# uncomment the previous line at your own risk : the certificate won't be verified !\n\t\t\tstore = OpenSSL::X509::Store.new\n\t\t\tstore.set_default_paths\n\t\t\tconn.cert_store = store\n\t\t\tconn.start\n\t\t\t@http_connection = conn\n\t\tend", "def http\n @http || prepare_http_connection\n end", "def http\n @http ||= Net::HTTP::Proxy(@proxy.host, @proxy.port).new @endpoint.host, @endpoint.port\n end", "def init_client; end", "def http\n @http ||= HTTPClient.new(\n agent_name: \"CPRClient/#{CPRClient::VERSION}\",\n default_header: { 'Content-Type' => 'text/xml' }\n )\n end", "def initialize(http_resp)\n @content = http_resp.body\n @data = JSON.parse(http_resp.body, symbolize_names: true)\n @status_code = http_resp.code.to_i\n end", "def initialize(host = 'nosnch.in', port = 443)\n @logger = Logger.new(STDOUT)\n logger.level = Logger::INFO\n @http = Net::HTTP.new(host, port)\n @http.use_ssl = true\n end", "def initialize(base_url)\n @base_url = base_url\n @custom_headers = {}\n @read_write_timeout = 8000\n @connection_timeout = 2000\n @use_ssl = false\n end", "def initialize(config)\n self.class.raise_if_missing_keys config, :host\n\n @handler = ::Elasticsearch::Client.new config\n end", "def http(request_opts = {})\n if @@client_class.nil?\n raise ConfigError.new(\"Qumulo::Rest::Client class has not been loaded yet!\")\n end\n if request_opts.is_a?(Hash)\n request_opts = RequestOptions.new(request_opts)\n else\n unless request_opts.is_a?(RequestOptions)\n raise ArgumentError.new(\"We need RequestOptions instance here\")\n end\n end\n client = request_opts.client || @@client_class.default\n client.http(request_opts)\n end", "def initialize(username, password)\n @username = username\n @password = password\n @http = Net::HTTP.new(HOST, 443)\n @http.use_ssl = true\n @http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @logger = Logger.new(STDOUT)\n @logger.level = Logger::INFO\n end", "def prepare_http_connection\n conn = @http\n if conn.nil? || !options[:persistent]\n conn = HTTPClient.new(options[:proxy] || self.class.proxy)\n set_http_connection_options(conn, options)\n @http = conn # Always set to last used connection\n end\n conn\n end", "def initialize(**parent_params)\n super\n\n @client = Faraday.new do |faraday|\n faraday.use FaradayMiddleware::FollowRedirects\n faraday.adapter Faraday.default_adapter\n end\n @url_template = self.class.construct_template\n end", "def initialize(server_uri = nil, api_key = nil)\n config = Shacip::Client.configuration\n @server_uri = URI.parse(server_uri&.to_s || config.server_uri.to_s)\n @api_key = api_key || config.api_key\n @http = Net::HTTP.new(@server_uri.host, @server_uri.port)\n end", "def initialize(opts = {})\n @opts = opts\n @opts[:type] ||= :block\n @opts[:timeout] ||= 10\n\n sanitize_opts!\n create_client\n end", "def http_client\n @http_client ||= DeathByCaptcha.new(self.username, self.password, :http)\n end", "def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end", "def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end", "def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end", "def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end", "def initialize\n @headers = {\n \"Authorization\" => \"token #{ENV[\"AUTH_TOKEN\"]}\",\n \"User-Agent\" => \"HTTParty\"\n }\n end", "def initialize(httparty)\n @data = httparty.parsed_response\n @http = httparty.response\n end", "def http_inst\n http = Net::HTTP.new(@uri.host, @uri.port)\n if @uri.scheme.downcase.eql? 'https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n http\n end", "def initialize host: nil, port: 443, url: nil, lazy: true, tls: {}\n raise ArgumentError if url.nil? && (host.nil? || port.nil?)\n\n if url\n url = URI.parse url unless URI === url\n @host = url.host\n @port = url.port\n @scheme = url.scheme\n tls = false if 'http' == @scheme\n else\n @host = host\n @port = port\n @scheme = tls ? 'https' : 'http'\n end\n\n @tls = tls\n @streams = {}\n @client = HTTP2::Client.new\n @read_gate = ReadGate.new\n\n init_blocking\n yield self if block_given?\n bind_events\n\n connect unless lazy\n end", "def build_http(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http\n end", "def initialize(api_key, opts={})\n @api_key = api_key\n @uri = URI.parse opts[:api_uri] || API_URI\n @https = Net::HTTP.new @uri.host, @uri.port\n @https.use_ssl = true\n @https.cert = OpenSSL::X509::Certificate.new File.read(opts[:cert] || CERT)\n @https.verify_mode = OpenSSL::SSL::VERIFY_PEER\n end", "def initialize(params={})\n # defaults\n @nessusurl = params.fetch(:url,'https://127.0.0.1:8834/')\n @username = params.fetch(:username,'nessus')\n @password = params.fetch(:password,'nessus')\n @ssl_verify = params.fetch(:ssl_verify,false)\n @ssl_use = params.fetch(:ssl_use,true)\n @autologin = params.fetch(:autologin, true)\n @defsleep = params.fetch(:defsleep, 1)\n @httpretry = params.fetch(:httpretry, 3)\n @httpsleep = params.fetch(:httpsleep, 1)\n\n init_quick_defaults()\n\n uri = URI.parse(@nessusurl)\n @connection = Net::HTTP.new(uri.host, uri.port)\n @connection.use_ssl = @ssl_use\n\n if @ssl_verify\n @connection.verify_mode = OpenSSL::SSL::VERIFY_PEER\n else\n @connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n \n yield @connection if block_given?\n authenticate(@username, @password) if @autologin\n end", "def initialize(client, host)\n @client = client\n @host = host\n end", "def initialize\n ext_initialize\n @headers = {}\n @timeout = 5\n @connect_timeout = 1\n @max_redirects = 5\n @auth_type = :basic\n end", "def nexus\n client = HTTPClient.new\n client.send_timeout = 600\n client.receive_timeout = 600\n # https://github.com/nahi/httpclient/issues/63\n client.set_auth(nil, configuration['username'], configuration['password'])\n client.www_auth.basic_auth.challenge(configuration['url'])\n client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE unless @ssl_verify\n return client\n end", "def initialize(options)\n super(options)\n @atmos_options = {\n :url => @options[:url],\n :uid => @options[:uid],\n :secret => @options[:secret]\n }\n @tag = @options[:tag]\n @http_client = HTTPClient.new\n # TODO: Remove this line once we get the proper certificate for atmos\n @http_client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end", "def initialize params = {}\n defaults = {\n :port => 80,\n :user_agent => 'Net::HTTP::RestClient'\n }\n if params[:port]==443 && !params[:ssl]\n defaults.merge! :ssl => {\n :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE\n } \n end\n @params = defaults.merge(params)\n @cookies = {}\n @headers = {}\n @params[:headers] && @headers=@params[:headers]\n @params[:cookies] && @cookies=@params[:cookies]\n end", "def initialize(**options)\n @config = Configuration.new(**options)\n @client = Client.new(config)\n end" ]
[ "0.7823902", "0.752578", "0.728903", "0.7230167", "0.7167555", "0.7111974", "0.7059632", "0.7039997", "0.7012834", "0.69910544", "0.6990311", "0.69551367", "0.69463295", "0.69166046", "0.6891927", "0.6877299", "0.68694335", "0.68469137", "0.68463993", "0.68243194", "0.68095374", "0.6788805", "0.6778722", "0.67583305", "0.6749798", "0.67485636", "0.6718666", "0.66691357", "0.6644921", "0.6644921", "0.6630705", "0.6594227", "0.65874594", "0.65674317", "0.65119356", "0.65119356", "0.65030175", "0.6489307", "0.6481625", "0.64800555", "0.6467588", "0.64580125", "0.6445577", "0.64379877", "0.64285934", "0.64184016", "0.64063346", "0.6401928", "0.639308", "0.6390765", "0.6358468", "0.634139", "0.633957", "0.63065827", "0.6299617", "0.6299086", "0.6298089", "0.6282444", "0.6280723", "0.62784004", "0.6265498", "0.6264695", "0.62642044", "0.6259581", "0.6254231", "0.62309325", "0.62269986", "0.6224648", "0.622294", "0.621583", "0.6212847", "0.61826223", "0.618038", "0.6180203", "0.61773527", "0.6161255", "0.61529684", "0.61442804", "0.61408305", "0.61233896", "0.6123123", "0.61222494", "0.61183494", "0.6114117", "0.6107551", "0.6107551", "0.6107551", "0.6107551", "0.6107551", "0.61039066", "0.60914123", "0.6085356", "0.60801554", "0.6079952", "0.6076754", "0.6076239", "0.6072096", "0.60672337", "0.6065268", "0.60642314", "0.6063375" ]
0.0
-1
Set the url for HttpClient
def url=(uri) @conn = nil @url = uri end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_base_url(url)\r\n @http_client.base_url = url\r\n end", "def set_url\n @url = DEFAULT_URL\n end", "def url(url)\n @url = url\n end", "def set_url\n url 'set'\n end", "def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend", "def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend", "def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend", "def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend", "def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend", "def url=(value)\n @url = value\n Curl.set_option(:url, value_for(value, :string), handle)\n end", "def url\n @url ||= \"http://#{host}:#{port}\"\n end", "def set_api_url(url)\n @api_url = url\n end", "def set_url_host \n @url_host = request.protocol() + request.host_with_port() + '/' \n end", "def url=(url)\n @url = url\n @connection = nil\n end", "def set_url(opts)\n opts = check_params(opts,[:urls])\n super(opts)\n end", "def _http_url\n HTTPURI + _uri_path\n end", "def url=(url)\n @@url = url\n end", "def set_url\n @url = Url.get_from_short(params[:id])\n end", "def set_base_url(url)\n base_url = url\n end", "def url(value)\n @url = value\n end", "def set_url(url_value)\n @path = url_value.delete_prefix \"/\"\n @dir = File.dirname(@path)\n @url = url_value\n end", "def set_url\n @url = Url.find_by(key: params[:key])\n end", "def set_url_host_model\n if @url.present?\n @url.url_host = @url_host\n end\n end", "def url=(v)\n @url = v ? URI.parse(v) : nil\n end", "def url=(url)\n @@url = url\n end", "def url\n @url = \"#{@http_mode}://#{self.config.servers[0]}\"\n @url << \"/#{self.config.context}\" if(!self.config.context.empty?)\n #self.config.log.debug_msg(\"Request base URL: #{@url}\")\n @url\n end", "def url\n @url || File.join(host, \"v1\")\n end", "def set_wiremock_url(url)\n @wiremock_url = url\n end", "def url(arg = nil)\n set_or_return(:url,\n arg,\n kind_of: String,\n default: 'http://localhost:8000')\n end", "def initialize(url=\"\")\n @serverURL = url\n end", "def authenticated_url=(url)\n uri = URI(url)\n self.api_key = uri.user\n uri.user = nil\n uri.password = nil\n self.endpoint = uri.to_s\n end", "def url=(_); end", "def url\n \"http://#{host}:#{port}\"\n end", "def url\n \"http://#{host}:#{port}\"\n end", "def setserverurl(value)\r\n setvalue(@@SERVER_URL, value)\r\n end", "def set_url_parts(protocol, host)\n self.url_protocol = protocol\n self.url_host = host\n end", "def url\n \"http://#{@host}:#{@port}\"\n end", "def jsonUrl=(url)\n @jsonUrl = url\n end", "def url=(value)\n if value.nil?\n @url = nil\n else\n @url = Addressable::URI.parse(value)\n @url.path << '/' unless @url.path.end_with?('/')\n end\n end", "def url=(url)\n if url =~ /^http(s?)\\:\\/\\//i\n @url = url\n write_settings\n else\n $stderr.puts \"Please include a leading http://\"\n end\n end", "def set_base_url(num = 0)\n return nil if num >= @api_servers.size\n @base_url = @api_servers[num]\n end", "def url\n @url || API_ENDPOINT\n end", "def url=(value)\n value = \"http://#{value}\" unless value.empty? || value =~ %r{^http://} || value =~ %r{^https://}\n write_local(:url, value)\n end", "def host=(host)\n @uri = host.is_a?(::URI) ? host : ::URI.parse(host)\n reset_http_client!\n @uri\n end", "def url(url=nil)\n return @url unless url\n @url = URI.parse(set_scheme(url)).to_s\n end", "def url(url=nil)\n return @url unless url\n @url = URI.parse(set_scheme(url)).to_s\n end", "def url(url=nil)\n return @url unless url\n @url = URI.parse(set_scheme(url)).to_s\n end", "def url\n 'http://'+@host+':'+@port.to_s\n end", "def url\n raise NotImplementedError, 'this should be overridden by subclass'\n end", "def url\n \"http://#{host}:#{port}/\"\n end", "def url=(new_url)\n super(new_url)\n unless URI.parse(self.url).scheme\n self.url.prepend(\"http://\")\n end\n rescue\n end", "def uri!\n @uri = URI.parse \"#{@config.http_scheme}://#{@config.host}:#{@config.port}/api/#{@config.api_version}/\"\n end", "def url(url)\n @item.url = url.to_s\n self\n end", "def url(path = nil)\n self.connection.url(path)\n end", "def initialize(url)\n self.url = url\n end", "def api_url=(value)\n raise TypeError, 'api_url must be a String or respond_to #to_s' unless value.is_a?(String) || value.respond_to?(:to_s)\n \n @api_url = value.to_s\n end", "def url\n if @service_url.nil?\n @service_url = @protocol + '://' + @host + '/' +\n (@path_prefix.empty? ? '' : (@path_prefix + '/')) + @key + '/'\n end\n @service_url\n end", "def url\n '%s://%s%s' % [\n self.scheme,\n self.host,\n self.port_default? ? '' : (':%d' % self.port)\n ]\n end", "def http_url\n context[:http_url] || context[:base_url]\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def set_url\n @url = Url.find(params[:id])\n end", "def setTaskURL(taskUrl)\r\n\t\t\t\t\t@taskUrl = taskUrl\r\n\t\t\t\tend", "def from(url)\n @url = url\n self\n end", "def initialize(url)\n @url = url\n end", "def initialize(url)\n @url = url\n end", "def url=(value)\n @url = value\n\n if localhost? && @server_thread.nil?\n require \"rack\"\n require 'webrick'\n\n ARGV.clear # clear ARGV as it is used by Rack to configure server\n\n server = WEBrick::HTTPServer.new(:Port => port, AccessLog: []).tap do |server|\n server.mount mount_path, Rack::Handler::WEBrick, Rack::Server.new.app\n end\n @server_thread = Thread.new { server.start }\n trap('INT') do\n server.shutdown\n exit\n end\n end\n end", "def initialize(url)\n @url = url\n end", "def server_url=(_arg0); end", "def new_http(uri); end", "def set_git_urls\n self.url = GitHosting.repository_path(self) if url.blank?\n self.root_url = url if root_url.blank?\n end", "def initialize\n raise NotImplementedError, 'need to implement #intialize and set @url'\n end", "def with_base_url(base_url)\n @url_prefix = base_url\n self\n end", "def url\n \"http://#{self.domain}/#{self.path}\"\n end", "def initialize(url)\n self.url = url\n self\n end", "def start_url(url)\n @start_url = url\n end", "def init_http_client(options)\n http = Net::HTTP.new(@base_uri.host, 443)\n http.use_ssl = true if @base_uri.scheme == \"https\"\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE # FIXME: not 100% supported\n self.http_client = http\n end", "def set_base_url\n uri = URI.parse(@page_url)\n @base_url = \"#{uri.scheme}://#{uri.host}\"\n end", "def initialize(**opt)\n opt = opt.dup\n @url = opt.delete(:url) || BASE_URL\n @options = opt\n end", "def set_url\n @url = Url.find_by(short: params[:short])\n end", "def url!(url=nil)\n url.kind_of?(String) ? @session.chanserv.set(self.name, :url, url) : @session.chanserv.set(self.name, :url)\n end", "def url=(url)\n uri = URI.parse(url)\n @scheme = uri.scheme\n @app_id = uri.path.split('/').last\n @key = uri.user\n @secret = uri.password\n @host = uri.host\n @port = uri.port\n end", "def url\n end", "def initialize(url, http_options={})\n unless url =~ VALID_URL\n raise ArgumentError, \"Invalid url \\\"#{url}\\\", it should be in format: (https|http)://<host>(:<port>)?/?\"\n end\n\n @url = url.match(VALID_URL)[1]\n @http_options = DEFAULT_OPTIONS.merge(http_options)\n end", "def base_url\n @client.instance_variable_get(:@base_url)\n end", "def add_http_to_url\n if !self.website_url.blank?\n unless self.website_url[/\\Ahttp:\\/\\//] || self.website_url[/\\Ahttps:\\/\\//]\n self.website_url = \"http://#{self.website_url}\"\n end\n end\n end", "def url\n @url\n end", "def url\n @url\n end", "def url\n @url ||= params['url']\n end", "def prepend_http_to_url\n self.url = \"http://#{url}\" unless url.blank? || url.starts_with?('http://') || url.starts_with?('https://')\n end", "def proxy_uri; end" ]
[ "0.76124865", "0.7402809", "0.7114214", "0.7062254", "0.70554525", "0.70554525", "0.70554525", "0.70554525", "0.70554525", "0.7028956", "0.691217", "0.68442446", "0.6795744", "0.66941214", "0.6688651", "0.6638596", "0.6603098", "0.6601508", "0.6591256", "0.6539716", "0.65157455", "0.6477086", "0.6476941", "0.64611965", "0.6449094", "0.641226", "0.64046377", "0.63838136", "0.63780266", "0.63607264", "0.63359016", "0.632298", "0.6304124", "0.6304124", "0.62898725", "0.6287994", "0.6244587", "0.6240527", "0.62401164", "0.6203294", "0.61919004", "0.61909634", "0.6184", "0.6179257", "0.6178818", "0.61786085", "0.61786085", "0.6178442", "0.6175217", "0.61693084", "0.6168699", "0.61652595", "0.61554337", "0.61536866", "0.61497426", "0.61396503", "0.61395025", "0.6125651", "0.61123943", "0.61112726", "0.61112726", "0.61112726", "0.61112726", "0.61112726", "0.61112726", "0.61112726", "0.61112726", "0.61112726", "0.61112726", "0.61112726", "0.61112726", "0.61076266", "0.60912627", "0.6049803", "0.60478806", "0.60408014", "0.603758", "0.603723", "0.60255384", "0.60220593", "0.60053307", "0.60023284", "0.59893537", "0.59884", "0.5987317", "0.5984597", "0.5982804", "0.5981622", "0.59773564", "0.5976608", "0.59595865", "0.59559584", "0.5955168", "0.59550214", "0.5952541", "0.5941999", "0.5941999", "0.5941684", "0.5937603", "0.5935717" ]
0.63643634
29