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 |
|---|---|---|---|---|---|---|
POST /sales POST /sales.json
|
def create
@sale = Sale.new(params[:sale])
respond_to do |format|
if @sale.save
format.html { redirect_to @sale, notice: 'Sale was successfully created.' }
format.json { render json: @sale, status: :created, location: @sale }
else
format.html { render action: "new" }
format.json { render json: @sale.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @sale = Sale.new(sale_params)\n\n if @sale.save\n render json: @sale, status: :created, location: @sale\n else\n render json: @sale.errors, status: :unprocessable_entity\n end\n end",
"def create\n instance = Sale.new(sale_params)\n\n if instance.save\n render json: { msg: instance }, status: :created\n else\n render json: { msg: instance.errors }, status: :unprocessable_entity\n end\n end",
"def create\n @sale = Sale.new(sale_params)\n @sale.user = current_user\n @sale.total = @sale.total_all\n respond_to do |format|\n if @sale.save\n format.html { redirect_to team_event_sale_url(@sale.event, @sale), notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: team_event_sale_detail_url }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @sales = @saleService.all_to_json().as_json;\n end",
"def create\n @sale = @organization.sales.new(sale_params.merge(user_id: current_user.id, sale_number: Organization.get_next_sale_number(@organization),\n date_of_sale: DateTime.now))\n\n respond_to do |format|\n if @sale.save!\n format.html { redirect_to customer_sale_path(@sale.customer,@sale), notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def _sales_add(sale_data)\n begin\n return set_error_object({message: @configuration.not_initialized_message}) if not_initialized?\n url = \"#{base_uri}/#{@configuration.sales_path}/add.#{@configuration.api_request_format}\"\n response = post url, body: {data: sale_data}\n JSON.parse (response.body && !response.body.empty?) ? response.body : set_error_object #returns the complete object\n rescue => e\n puts e.to_s #debug the error\n end\n end",
"def create\n @sale = Sale.new(sale_params)\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale = Sale.new(sale_params)\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sale }\n else\n format.html { render action: 'new' }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @sales = Sale.all\n\n render json: @sales\n end",
"def create\n @sales_datum = SalesDatum.new(params[:sales_datum])\n\n respond_to do |format|\n if @sales_datum.save\n format.html { redirect_to @sales_datum, notice: 'Sales datum was successfully created.' }\n format.json { render json: @sales_datum, status: :created, location: @sales_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sales_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(invoice_params)\n sales = params[:invoice][:sales_attributes]\n success = false\n \n begin\n @invoice.pick_sales sales\n success = @invoice.save\n rescue Existence::NotEnoughExistence => ex\n @invoice.errors.add :sales, \"Not Enough Existence\"\n success = false\n rescue\n success = false\n end\n\n if success\n render json: @invoice, status: :created, location: @invoice\n else\n render json: {errors: @invoice.errors}, status: :unprocessable_entity\n end\n end",
"def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save && calculate_taxes(@sale)\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if current_user\n @sale = current_user.sales.build(sale_params)\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to root_path, notice: 'You must be logged in to do this'\n end\n end",
"def create\n @sales = Sale.create(safe_params[:sales])\n @sales = [@sales] unless @sales.instance_of? Array\n render :show\n end",
"def create\n @order = Order.new(params[:order])\n @order_sales = @order.sales\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale = Sale.new(sale_params)\n @sale.user = current_user\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sale_params\n params[:sale].permit(:sales_type, :sales_date, :client_id, :staff_id)\n end",
"def create\n @sales_product = SalesProduct.new(sales_product_params)\n\n respond_to do |format|\n if @sales_product.save\n format.html { redirect_to @sales_product, notice: 'Sales product was successfully created.' }\n format.json { render :show, status: :created, location: @sales_product }\n else\n format.html { render :new }\n format.json { render json: @sales_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sale_params\n params.require(:sale).permit(:date, :total_price, :contact_name)\n end",
"def sales\n end",
"def create\n @sales_order = SalesOrder.new(sales_order_params)\n\n respond_to do |format|\n if @sales_order.save\n format.html { redirect_to @sales_order, notice: 'Sales order was successfully created.' }\n format.json { render :show, status: :created, location: @sales_order }\n else\n format.html { render :new }\n format.json { render json: @sales_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale = Sale.new\n\n @sale.user_id = session[:user_id]\n @sale.user = session[:user_name]\n @sale.date_sale = DateTime.current.to_date\n\n price = 0\n\n sale_params[:medicaments].each do |medicament|\n medicament = Medicament.find(medicament)\n price += medicament.price\n end\n\n sale_params[:medicaments].each do |medicament|\n @sale.saleDetails.build(:price => price, :medicament_id => medicament)\n end\n\n respond_to do |format|\n if @sale.save\n p @sale\n format.html { redirect_to @sale, notice: \"Compra realizada com sucesso.\" }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale = Sale.new(params[:sale])\n\n respond_to do |format|\n if @sale.save\n flash[:notice] = 'Sale was successfully created.'\n format.html { redirect_to(sales_url) }\n format.xml { render :xml => @sale, :status => :created, :location => @sale }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sale.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sales_item = SalesItem.new(sales_item_params)\n\n respond_to do |format|\n if @sales_item.save\n format.html { redirect_to @sales_item, notice: 'Sales item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sales_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @sales_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @business_sale = BusinessSale.new(business_sale_params)\n\n respond_to do |format|\n if @business_sale.save\n format.html { redirect_to @business_sale, notice: 'Business sale was successfully created.' }\n format.json { render :show, status: :created, location: @business_sale }\n else\n format.html { render :new }\n format.json { render json: @business_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_sale = ProductSale.new(product_sale_params)\n\n respond_to do |format|\n if @product_sale.save\n format.html { redirect_to @product_sale, notice: 'Product sale was successfully created.' }\n format.json { render :show, status: :created, location: @product_sale }\n else\n format.html { render :new }\n format.json { render json: @product_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sales_order = SalesOrder.new(sales_order_params)\n @sales_order.date = Time.now\n sodetails = @sales_order.sales_order_details\n sodetails.each do |sod|\n sod.pending_rg = sod.quantity\n sod.pending_cg = sod.quantity\n sod.pending_inv = sod.quantity\n end\n \n respond_to do |format|\n if @sales_order.save\n format.html {\n flash[:notice] = 'La Orden de Venta se creó satisfactoriamente.'\n redirect_to sales_orders_path\n }\n format.json { render :show, status: :created, location: @sales_order }\n else\n format.html { \n flash[:error] = @sales_order.errors\n redirect_to new_sales_order_path\n }\n format.json { render json: @sales_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @detail_sale = DetailSale.new(detail_sale_params)\n\n respond_to do |format|\n if @detail_sale.save\n format.html { redirect_to @detail_sale, notice: \"Detail sale was successfully created.\" }\n format.json { render :show, status: :created, location: @detail_sale }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @detail_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale_day_total = SaleDayTotal.new(params[:sale_day_total])\n\n respond_to do |format|\n if @sale_day_total.save\n format.html { redirect_to @sale_day_total, notice: 'Sale day total was successfully created.' }\n format.json { render json: @sale_day_total, status: :created, location: @sale_day_total }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sale_day_total.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save\n format.js\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sale }\n else\n format.js\n format.html { render action: 'new' }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sales_entry = SalesEntry.new(sales_entry_params)\n\n respond_to do |format|\n if @sales_entry.save\n format.html { redirect_to @sales_entry, notice: 'Sales entry was successfully created.' }\n format.json { render :show, status: :created, location: @sales_entry }\n else\n format.html { render :new }\n format.json { render json: @sales_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @daily_sale = DailySale.new(daily_sale_params)\n\n respond_to do |format|\n if @daily_sale.save\n format.html { redirect_to new_daily_sale_path(page: page), notice: 'Daily Sale was successfully created.' }\n format.json { render :show, status: :created, location: @daily_sale }\n else\n format.html { render :new }\n format.json { render json: @daily_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale = Sale.new(sale_params)\n\n respond_to do |format|\n if @sale.save\n #format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n \n session[:id_venta_session] = @sale.id\n session[:tipo_venta_session] = @sale.sales_type\n format.html { redirect_to new_sales_article_path }\n format.json { render :show, status: :created, location: @sale }\n else\n obtener_clientes\n obtener_empleados \n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_sale_using_post_with_http_info(sale_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SupportApi.create_sale_using_post ...'\n end\n # verify the required parameter 'sale_request' is set\n if @api_client.config.client_side_validation && sale_request.nil?\n fail ArgumentError, \"Missing the required parameter 'sale_request' when calling SupportApi.create_sale_using_post\"\n end\n # resource path\n local_var_path = '/sales'\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(sale_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 => 'Sale')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SupportApi#create_sale_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @sale = Sale.new(sale_params)\n @sale.total_price = 0;\n @sale.date = Date.today\n @sale.user_id = current_user.id\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to @sale, notice: 'La commande a été créée avec succès.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cal_month_sale = CalMonthSale.new(cal_month_sale_params)\n\n respond_to do |format|\n if @cal_month_sale.save\n format.html { redirect_to @cal_month_sale, notice: 'Cal month sale was successfully created.' }\n format.json { render :show, status: :created, location: @cal_month_sale }\n else\n format.html { render :new }\n format.json { render json: @cal_month_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sale_params\n params.require(:sale).permit(:fecha, :subtotal, :total, :client_id, :user_id, :estado)\n end",
"def create_sale(sale)\n request = Braspag::Request::CreateSaleRequest.new(merchant, environment)\n\n request.execute(sale)\n end",
"def create\n @sale = Sale.new(params[:sale])\n employment_id = params[:employment_id]\n @sale.employee_id = @sale.employment.employee.id\n\n respond_to do |format|\n if @sale.save\n \n logger.info \"Sale #{@sale.title} created by #{current_user.email}\"\n \n format.html { redirect_to(sales_path, :notice => 'Sale was successfully created.') }\n format.xml { render :xml => @sale, :status => :created, :location => @sale }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sale.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sell = Sell.new(sell_params)\n\n if @sell.save\n render json: @sell, status: :created, location: @sell\n else\n render json: @sell.errors, status: :unprocessable_entity\n end\n end",
"def create\n @sales_productivity = SalesProductivity.new(params[:sales_productivity])\n\n respond_to do |format|\n if @sales_productivity.save\n format.html { redirect_to new_sales_productivity_path, notice: 'Sales productivity was successfully created.' }\n format.json { render json: @sales_productivity, status: :created, location: @sales_productivity }\n else\n @salesman = Salesman.where(id: params[:sales_productivity][\"salesmen_id\"])\n @brand = Merk.all\n format.html { render action: \"new\" }\n format.json { render json: @sales_productivity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sale_params\n params.require(:sale).permit(:email, :order_date, :amount)\n end",
"def create\n @sales_term = SalesTerm.new(params[:sales_term])\n\n respond_to do |format|\n if @sales_term.save\n format.html { redirect_to @sales_term, notice: 'Sales Term was successfully created.' }\n format.json { render json: @sales_term, status: :created, location: @sales_term }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sales_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n cliente = Client.find(sale_params[:client_id])\n temp = sale_params\n temp[\"client_id\"] = cliente.id\n @sale = Sale.new(temp)\n\n respond_to do |format|\n if @sale.save\n format.html { redirect_to :sales, notice: 'Venta Creada' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sale_params\n params.require(:sale).permit(:event_date, :product_id, :product_variety_id, :product_presentation_id, \n :total_price, :status, :greenhouse_id, :sale_item_ids)\n end",
"def create_sale(sale_parameters)\n Cielo::Request::ApiSale.new(merchant, environment).create(sale_parameters)\n end",
"def index\n @pre_sales = PreSale.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pre_sales }\n end\n end",
"def show\n render json: @invoice, methods: [:sales]\n end",
"def create\n @sale_order = current_user.sale_orders.new(params[:sale_order])\n\n respond_to do |format|\n if @sale_order.save\n format.html { redirect_to sale_orders_path, notice: 'Sale order was successfully created.' }\n format.json { render json: @sale_order, status: :created, location: @sale_order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sale_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @sale = Sale.new(sale_params)\n @message=''\n \n if @sale.save\n articulos= params[:sale][:articulos_vendidos]\n\n articulos.each do |articulo|\n inventario= Item.find(articulo[:id_item])\n inventario.existencia = inventario.existencia - articulo[:item_cantidad]\n inventario.save() \n end \n\n\n \n articulos.each do |articulo|\n sold = ItemsSold.new(items_solds_params)\n ultima_venta= Sale.last\n sold.id_item=articulo[:id_item]\n sold.id_sale=ultima_venta.id\n sold.cantidad=articulo[:item_cantidad]\n sold.save()\n \n end \n else\n @message='error'\n end \n \n\n render json:{sale: @sale, message: @message}\n \n end",
"def create\n @sale = Sale.new(sale_params)\n respond_to do |format|\n if @sale.valid?\n format.html { redirect_to livrodiario_path, notice: 'Fato cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def new\n @order = Order.new\n @order.sales.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def sale_params\n params.require(:sale).permit(:person_id, :product_id, :saledate, :saleprice)\n end",
"def sale_params\n params.require(:sale).permit(:person_id, :product_id, :saledate, :saleprice)\n end",
"def new\n @sale = Sale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sale }\n end\n end",
"def new\n @sale = Sale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sale }\n end\n end",
"def new\n @sale = Sale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sale }\n end\n end",
"def create\n @sales_article = SalesArticle.new(sales_article_params)\n\n respond_to do |format|\n if @sales_article.save\n #format.html { redirect_to @sales_article, notice: 'Sales article was successfully created.' }\n format.html { redirect_to new_sales_article_path }\n format.json { render :show, status: :created, location: @sales_article }\n else\n obtener_articulos\n format.html { render :new }\n format.json { render json: @sales_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale = Sale.new(sale_params)\n authorize @sale\n respond_to do |format|\n if @sale.save\n format.html { redirect_to (params[:save_and_new].present? ? new_sale_path : @sale), success: I18n.t('notices.created', entity: Sale.model_name.human, id: @sale.id) }\n format.json { render :show, status: :created, location: @sale }\n else\n format.html { render :new }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @sales_datum = SalesDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sales_datum }\n end\n end",
"def show\n render json: @sale\n end",
"def sale(params = {})\r\n @PARAM_HASH['TRANSACTION_TYPE'] = 'SALE'\r\n @PARAM_HASH['AMOUNT'] = params[:amount]\r\n @PARAM_HASH['RRNO'] = params[:trans_id] || ''\r\n @PARAM_HASH['CUST_TOKEN'] = params[:customer_token] if params[:customer_token]\r\n @api = \"bp10emu\"\r\n end",
"def index\n @sales = Sale.all\n end",
"def index\n @sales = Sale.all\n end",
"def index\n @sales = Sale.all\n end",
"def index\n @sales = Sale.all\n end",
"def index\n @sales = Sale.all\n end",
"def index\n @sales = Sale.all\n end",
"def index\n @sales = Sale.all\n end",
"def sale_params\n params.require(:sale).permit(:id_client, :id_financing_models, :id_financing_types, :id_paid_systems, :cantidad_pagos, :fecha_venta, :estatus,:total_venta,:pago_diferido, :active)\n end",
"def create\n @requested_sales_document = RequestedSalesDocument.new(requested_sales_document_params)\n\n respond_to do |format|\n if @requested_sales_document.save\n format.html { redirect_to @requested_sales_document, notice: 'Requested sales document was successfully created.' }\n format.json { render :show, status: :created, location: @requested_sales_document }\n else\n format.html { render :new }\n format.json { render json: @requested_sales_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sales(options = {})\n options[:product_id] = epages_id(options[:product_id]) if options[:product_id]\n perform_get_with_object('/sales', format_dates_options(options), Epages::SalesSummary)\n end",
"def sale_params\n params.fetch(:sale, {}).permit(\n :date,\n :description,\n :evidence,\n :partner_id,\n :amount,\n :amount_males,\n :amount_females,\n )\n end",
"def create\n @sale_payment = SalePayment.new(sale_payment_params)\n\n respond_to do |format|\n if @sale_payment.save\n format.html { redirect_to @sale_payment, notice: 'Sale payment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sale_payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @sale_payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sales_team = SalesTeam.new(params[:sales_team])\n\n respond_to do |format|\n if @sales_team.save\n format.html { redirect_to @sales_team, notice: 'Sales team was successfully created.' }\n format.json { render json: @sales_team, status: :created, location: @sales_team }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sales_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sale(params = {})\r\n @PARAM_HASH['TRANSACTION_TYPE'] = 'SALE'\r\n @PARAM_HASH['AMOUNT'] = params[:amount]\r\n @PARAM_HASH['RRNO'] = params[:trans_id] || ''\r\n @api = \"bp10emu\"\r\n end",
"def create\n @sale_type = SaleType.new(sale_type_params)\n\n respond_to do |format|\n if @sale_type.save\n format.html { redirect_to @sale_type, notice: \"Sale type was successfully created.\" }\n format.json { render :show, status: :created, location: @sale_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sale_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @d_sale_item = DSaleItem.new(params[:d_sale_item])\n\n respond_to do |format|\n if @d_sale_item.save\n format.html { redirect_to @d_sale_item, notice: 'D sale item was successfully created.' }\n format.json { render json: @d_sale_item, status: :created, location: @d_sale_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @d_sale_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale_order = SaleOrder.new(params[:sale_order])\n @customers = Customer.find(:all).sort\n\n respond_to do |format|\n if @sale_order.save!\n flash[:notice] = 'Sale Order was successfully created.'\n format.html { redirect_to(@sale_order) }\n format.xml { render :xml => @sale_order, :status => :created, :location => @sale_order }\n else\n flash[:notice] = 'Failed to create the Sale Order.'\n format.html { redirect_to :controller => 'store', :action => 'sale' }\n format.xml { render :xml => @sale_order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def push_sale\n\n details = {\n name: self.customer.name,\n location: self.location,\n quantity: self.quantity,\n product: self.product.name,\n sold_at: self.created_at.strftime('%l:%M %p %A')\n }\n Pusher['flamingmoe'].trigger('sale', details)\n logger.debug(\"pushed sale details to pusher.com: #{details.inspect}\")\n\n push_counts\n end",
"def sale_params\n params.require(:sale).permit(:medicaments => [])\n end",
"def create\n @sales_associate = SalesAssociate.new(sales_associate_params)\n\n respond_to do |format|\n if @sales_associate.save\n format.html { redirect_to @sales_associate, notice: 'Sales associate was successfully created.' }\n format.json { render :show, status: :created, location: @sales_associate }\n else\n format.html { render :new }\n format.json { render json: @sales_associate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n monthly_slip(params)\n # secure valid input\n return render json: { msg: \"input valid number\" } unless @annual_salary > 0\n @timestamp = DateTime.now\n slip = Slip.new({\n \"time_stamp\" => @timestamp,\n \"annual_salary\" => @annual_salary,\n \"employee_name\" => @employee_name,\n \"monthly_income_tax\" => @monthly_income_tax,\n })\n if slip.save\n render json: { status: \"SUCCESS\", message: \"Saved Infotmation\", data: slip }, status: :ok\n else\n render json: { status: \"ERROR\", message: \"Information not saved\", data: slip.errors }, status: :unprocessable_entity\n end\n end",
"def create\n @sales_plan = SalesPlan.new(sales_plan_params)\n\n respond_to do |format|\n if @sales_plan.save\n format.html { redirect_to @sales_plan, notice: 'Sales plan was successfully created.' }\n format.json { render :show, status: :created, location: @sales_plan }\n else\n format.html { render :new }\n format.json { render json: @sales_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @accesory_sale = AccesorySale.new(accesory_sale_params)\n\n respond_to do |format|\n if @accesory_sale.save\n format.html { redirect_to @accesory_sale, notice: 'Accesory sale was successfully created.' }\n format.json { render :show, status: :created, location: @accesory_sale }\n else\n format.html { render :new }\n format.json { render json: @accesory_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale = Sale.new(sale_params)\n respond_to do |format|\n if @sale.save\n quantity = params[:quotes_quantity].gsub(/[^\\d^\\.]/, '').to_i\n\n for i in 1..quantity\n @quote = Quote.new\n @quote.amount = (params[:amount]).gsub(/[^\\d^\\.]/, '').to_f\n @quote.is_paid = false\n @quote.number = i\n @quote.total = quantity\n @quote.mounth = (@sale.date + i.month).month\n @quote.year = (@sale.date + i.month).year\n @quote.sale = @sale\n @quote.save\n end\n\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sale }\n else\n format.html { render action: 'new' }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sale_params\n params.require(:sale).permit(:quantity, :merchant_id, :product_id, :customer_id)\n end",
"def create\n @sales_upsale_product = SalesUpsaleProduct.new(sales_upsale_product_params)\n\n respond_to do |format|\n if @sales_upsale_product.save\n format.html { redirect_to sales_upsale_products_url, notice: 'Sales upsale product was successfully created.' }\n format.json { render :show, status: :created, location: @sales_upsale_product }\n else\n format.html { render :new }\n format.json { render json: @sales_upsale_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pre_sale = PreSale.new_with(params[:pre_sale], params[:date])\n\n respond_to do |format|\n if @pre_sale.save\n format.html { redirect_to @pre_sale, notice: I18n.t('app.views.pre_sales.messages.create.success') }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def sale_params\n params.require(:sale).permit(:item_sold, :item_price, :note, :date_of_sale, :user_id, :customer_id)\n end",
"def sale_params\n params[:sale][:user_id] = current_user.id\n params.require(:sale).permit(:totalValue, :date_time, :customer_id, :user_id)\n end",
"def post\n Salesforce.set_http(session[:accesstoken], session[:accessurl])\n \t@response = Salesforce.create_post(params)\n \trespond_to do |format|\n format.json { render :json => @response.to_json}\n # example of multiple reponses mapped to one object\n # format.json { render :json => {:data => @response, :meta => @describe}.to_json}\n \tend\n end",
"def create\n @sales_stage = SalesStage.new(sales_stage_params)\n\n respond_to do |format|\n if @sales_stage.save\n format.html { redirect_to sales_stages_path, notice: 'Sales stage was successfully created.' }\n format.json { render :show, status: :created, location: @sales_stage }\n else\n format.html { render :new }\n format.json { render json: @sales_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sale\n ret = nil\n if @json_body.include?('sale_id')\n ret = @mc2p.sale('id' => @json_body['sale_id'])\n ret.retrieve\n end\n ret\n end",
"def salesApi\n require 'uri'\n require 'net/http'\n require 'json'\n\n #Arrays for each category\n \n @frequency = Hash.new(0)\n\n url = URI(\"https://api.salesloft.com/v2/people.json\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n request[\"Authorization\"] = 'Bearer ' + ENV[\"API_KEY\"]\n\n response = http.request(request)\n \n @body = JSON.parse(response.body)['data']\n return @body\n end",
"def create\n @sales_rep = SalesRep.new(params[:sales_rep])\n\n respond_to do |format|\n if @sales_rep.save\n format.html { redirect_to @sales_rep, notice: 'Sales rep was successfully created.' }\n format.json { render json: @sales_rep, status: :created, location: @sales_rep }\n format.js {}\n else\n format.html { render action: \"new\" }\n format.json { render json: @sales_rep.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7400088",
"0.69771683",
"0.6967173",
"0.69038314",
"0.6879542",
"0.68598634",
"0.685645",
"0.685645",
"0.68392515",
"0.67538804",
"0.6709609",
"0.6706264",
"0.66834867",
"0.6682449",
"0.6600478",
"0.6559194",
"0.6547773",
"0.65413195",
"0.64976615",
"0.6464397",
"0.6454362",
"0.64359194",
"0.6397",
"0.63859373",
"0.63837683",
"0.63836485",
"0.6361997",
"0.63597226",
"0.6352961",
"0.63456845",
"0.6334999",
"0.6312395",
"0.62800723",
"0.6271169",
"0.6238714",
"0.6202405",
"0.619557",
"0.61914253",
"0.61867565",
"0.618634",
"0.6168125",
"0.61566293",
"0.6150266",
"0.6148316",
"0.6116767",
"0.61145234",
"0.61108947",
"0.6073136",
"0.60721177",
"0.60628754",
"0.6043073",
"0.6036344",
"0.6032615",
"0.6029276",
"0.60262406",
"0.60262406",
"0.6025865",
"0.6025865",
"0.6025865",
"0.60246056",
"0.6021527",
"0.6010105",
"0.60064566",
"0.5995586",
"0.59943783",
"0.59943783",
"0.59943783",
"0.59943783",
"0.59943783",
"0.59943783",
"0.59943783",
"0.5984935",
"0.59820795",
"0.5957344",
"0.5945928",
"0.5934701",
"0.59244823",
"0.59126836",
"0.5905384",
"0.5893915",
"0.5893345",
"0.5890959",
"0.5887345",
"0.5886618",
"0.5885728",
"0.5885075",
"0.58769006",
"0.58745617",
"0.58744293",
"0.58720165",
"0.5870064",
"0.5850664",
"0.58455855",
"0.58413184",
"0.5840833",
"0.58371013",
"0.5830107",
"0.5827753"
] |
0.69187945
|
4
|
PUT /sales/1 PUT /sales/1.json
|
def update
@sale = Sale.find(params[:id])
respond_to do |format|
if @sale.update_attributes(params[:sale])
format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @sale.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @sale = Sale.find(params[:id])\n\n if @sale.update(sale_params)\n head :no_content\n else\n render json: @sale.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @sale.update(sale_params)\n render json: { msg: @sale }, status: :ok\n else\n render json: { msg: @sale.errors }, status: :unprocessable_entity\n end\n end",
"def update\n if @sale.update(sale_params)\n SalesServices::Relations.new(@sale, params).call(create: false)\n # Sale.update_products(@sale, params[:products])\n\n render json: {\n success: true,\n msg: 'Sale successfully updated',\n product: SaleSerializer.new(@sale)\n }\n else\n render json: {\n success: false,\n msg: 'Something went wrong',\n errors: @sale.errors\n }\n end\n end",
"def update_sale_using_put_with_http_info(sales, sales_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SupportApi.update_sale_using_put ...'\n end\n # verify the required parameter 'sales' is set\n if @api_client.config.client_side_validation && sales.nil?\n fail ArgumentError, \"Missing the required parameter 'sales' when calling SupportApi.update_sale_using_put\"\n end\n # verify the required parameter 'sales_id' is set\n if @api_client.config.client_side_validation && sales_id.nil?\n fail ArgumentError, \"Missing the required parameter 'sales_id' when calling SupportApi.update_sale_using_put\"\n end\n # resource path\n local_var_path = '/sales/{sales_id}'.sub('{' + 'sales_id' + '}', sales_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(sales)\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 => 'Sale')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SupportApi#update_sale_using_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n success = false\n begin\n ActiveRecord::Base.transaction do\n @invoice.destroy!\n @invoice = Invoice.new(invoice_params)\n sales = params[:invoice][:sales_attributes]\n success = false\n @invoice.pick_sales sales\n success = @invoice.save!\n end\n rescue ActiveRecord::RecordInvalid => ex\n puts ex\n rescue Existence::NotEnoughExistence => ex\n @invoice.errors.add :sales, \"Not Enough Existence\"\n end\n\n if success\n head :no_content\n else\n render json: {errors: @invoice.errors}, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @sale\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, success: I18n.t('notices.updated', entity: Sale.model_name.human, title: @sale.reference) }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to :sales, notice: 'Venta Actualizada' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_sales_invoice(id, options)\n put(\"sales_invoices/#{id}\", sales_invoice: options)\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to customer_sale_path(@sale.customer,@sale), notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n flash[:notice] = 'Sale was successfully updated.'\n format.html { redirect_to(sales_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sale.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n #params[:sale][:existing_purchase_attributes] ||= {}\n respond_to do |format|\n if @sale.update(sale_params) && calculate_taxes(@sale)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sales_datum = SalesDatum.find(params[:id])\n\n respond_to do |format|\n if @sales_datum.update_attributes(params[:sales_datum])\n format.html { redirect_to @sales_datum, notice: 'Sales datum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: \"Compra atualizada com sucesso.\" }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sales_item.update(sales_item_params)\n format.html { redirect_to @sales_item, notice: 'Sales item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sales_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n format.html { redirect_to @sale, notice: \"Venda atualizada com sucesso\" }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sales_item\n @sales_item = SalesItem.find(params[:id])\n end",
"def update\n @sales_rep = SalesRep.find(params[:id])\n \n respond_to do |format|\n if @sales_rep.update_attributes(params[:sales_rep])\n format.html { redirect_to @sales_rep, notice: 'Sales rep was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_rep.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sales_order.update(sales_order_params)\n format.html { redirect_to @sales_order, notice: 'Sales order was successfully updated.' }\n format.json { render :show, status: :ok, location: @sales_order }\n else\n format.html { render :edit }\n format.json { render json: @sales_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sales\t \n\t\t\tif Sale.exists?(:id => params[:id])\n\t\t\t\t@sale = Sale.find(params[:id])\t\t\t\n\t\t\telse\n\t\t\t\t@sale = nil\n\t\t\tend \n\t end",
"def update\n @sale = Sale.find(params[:id])\n employment_id = params[:id][:employment_id]\n @sale.employee_id = @sale.employment.employee.id\n \n \n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n \n logger.info \"Sale #{@sale.title} updated by #{current_user.email}\"\n \n format.html { redirect_to(sales_path, :notice => 'Sale was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sale.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_sales_product\n @sales_product = SalesProduct.find(params[:id])\n end",
"def update\n if @sale.update(sale_params)\n redirect_to current_user\n else\n end\n end",
"def update\n get_data\n @sale_detail = @sale.details.find(params[:id])\n @sale_detail.update_attributes(params[:sale_detail])\n get_data\n end",
"def update\n @sales_term = SalesTerm.find(params[:id])\n\n respond_to do |format|\n if @sales_term.update_attributes(params[:sales_term])\n format.html { redirect_to @sales_term, notice: 'Sales term was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sale_order = current_company.sale_orders.find(params[:id])\n\n respond_to do |format|\n if @sale_order.update_attributes(params[:sale_order])\n format.html { redirect_to sale_orders_path, notice: 'Sale order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale_order.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 @sales_product.update(sales_product_params)\n format.html { redirect_to @sales_product, notice: 'Sales product was successfully updated.' }\n format.json { render :show, status: :ok, location: @sales_product }\n else\n format.html { render :edit }\n format.json { render json: @sales_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @detail_sale.update(detail_sale_params)\n format.html { redirect_to @detail_sale, notice: \"Detail sale was successfully updated.\" }\n format.json { render :show, status: :ok, location: @detail_sale }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @detail_sale.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 set_sales_order\n @sales_order = SalesOrder.find(params[:id])\n end",
"def set_sales_order\n @sales_order = SalesOrder.find(params[:id])\n end",
"def update\n @sales_type = SalesType.find(params[:id])\n\n respond_to do |format|\n if @sales_type.update_attributes(params[:sales_type])\n format.html { redirect_to(sales_types_path, :notice => 'Sales type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sales_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 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 set_sales_entry\n @sales_entry = SalesEntry.find(params[:id])\n end",
"def set_sale\n @sale = @organization.sales.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @sales_entry.update(sales_entry_params)\n format.html { redirect_to @sales_entry, notice: 'Sales entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @sales_entry }\n else\n format.html { render :edit }\n format.json { render json: @sales_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product_sale.update(product_sale_params)\n format.html { redirect_to @product_sale, notice: 'Product sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_sale }\n else\n format.html { render :edit }\n format.json { render json: @product_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sale = Sale.new(sale_params)\n\n if @sale.save\n render json: @sale, status: :created, location: @sale\n else\n render json: @sale.errors, status: :unprocessable_entity\n end\n end",
"def update\n @sales_team = SalesTeam.find(params[:id])\n\n respond_to do |format|\n if @sales_team.update_attributes(params[:sales_team])\n format.html { redirect_to @sales_team, notice: 'Sales team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @requested_sales_document.update(requested_sales_document_params)\n format.html { redirect_to @requested_sales_document, notice: 'Requested sales document was successfully updated.' }\n format.json { render :show, status: :ok, location: @requested_sales_document }\n else\n format.html { render :edit }\n format.json { render json: @requested_sales_document.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pre_sale = PreSale.find(params[:id])\n\n respond_to do |format|\n if @pre_sale.update_attributes_with(params[:pre_sale], params[:date])\n format.html { redirect_to @pre_sale, notice: I18n.t('app.views.pre_sales.messages.update.success') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pre_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_sales_order\n begin\n @sale = Sale.find(params[:id])\n rescue\n end\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def update\n respond_to do |format|\n if @sales_order.update(sales_order_params)\n format.html { \n flash[:notice] = 'La Orden de Venta se actualizó satisfactoriamente.'\n redirect_to sales_orders_path\n }\n format.json { render :show, status: :ok, location: @sales_order }\n else\n format.html { \n flash[:error] = @sales_order.errors\n redirect_to edit_sales_order_path(@sales_order.id)\n }\n format.json { render json: @sales_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sale\r\n @sale = Sale.find(params[:id])\r\n end",
"def update\n @sales_productivity = SalesProductivity.find(params[:id])\n\n respond_to do |format|\n if @sales_productivity.update_attributes(params[:sales_productivity])\n format.html { redirect_to @sales_productivity, notice: 'Sales productivity was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_productivity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @business_sale.update(business_sale_params)\n format.html { redirect_to @business_sale, notice: 'Business sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @business_sale }\n else\n format.html { render :edit }\n format.json { render json: @business_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n end",
"def update\n @sale = Sale.find(params[:id])\n\n if @sale != nil\n s = params[:sale]\n @sale.sold_on = filter_time(s, :sold_on)\n @sale.product_id = s[:product] unless s[:product] == \"\"\n @sale.employee_id = s[:employee] unless s[:employee] == \"\"\n @sale.price = s[:price]\n @sale.price_commission = s[:price_commission]\n @sale.percentage = s[:percentage]\n @sale.plan = s[:plan]\n\n @sale.save\n\n respond_to do |f|\n f.html { redirect_to @sale, notice: 'Venda alterada'}\n end\n else\n respond_to do |f|\n f.html { render action: \"edit\", notice: 'Erro ao editar venda'}\n end\n end\n #respond_to do |format|\n # if @sale.update_attributes(params[:sale])\n # @sale.sold_on = filter_time(params[:sale], :sold_on)\n # format.html { redirect_to @sale, notice: 'Venda alterada com sucesso.' }\n # format.json { head :ok }\n # @sale.save\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @sale.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def update\n respond_to do |format|\n if @sales_order_detail.update(sales_order_detail_params)\n format.html { redirect_to @sales_order_detail, notice: 'Sales order detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @sales_order_detail }\n else\n format.html { render :edit }\n format.json { render json: @sales_order_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_as_sold\n # Header:\n # Content-Type : application/json\n # request payload example:\n # { \"copies_sold\" : 5 }\n books_in_stock = @shop.distributions.find_by(:book_id => shop_params[:book_id])\n copies_sold = shop_params[:copies_sold]\n if books_in_stock.nil?\n render status: 404, json: {\n message: \"Record not found - cannot find the book in this shop\",\n }\n elsif copies_sold.nil? || copies_sold < 0\n render status: 422, json: {\n message: \"Failed request due to invalid paylod data\",\n }\n else\n # 1. decrement copies_in_stock\n actual_sold = books_in_stock.update_copies_in_stock copies_sold\n # 2. increment total books_sold_count of the shop\n books_in_stock.shop.update_sold_count actual_sold\n render status: 200, json: {\n message: \"Successfully updated #{actual_sold} copies as sold in the shop\",\n shop: @shop\n }\n end\n end",
"def update\n respond_to do |format|\n if @sale.update(sale_params)\n\n format.html { redirect_to @sale, notice: 'La commande a été modifiée avec succès.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sale\n @sale = Sale.find(params[:sale_id].to_i)\n end",
"def set_sale\n @sale = Sale.find(params[:sale_id].to_i)\n end",
"def set_sale\n @sale = Sale.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render json: {\n success: false,\n msg: 'Sale not found',\n }\n end",
"def update\n respond_to do |format|\n if @sales_associate.update(sales_associate_params)\n format.html { redirect_to @sales_associate, notice: 'Sales associate was successfully updated.' }\n format.json { render :show, status: :ok, location: @sales_associate }\n else\n format.html { render :edit }\n format.json { render json: @sales_associate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end",
"def update\n authorize @origin_sale\n respond_to do |format|\n if @origin_sale.update(origin_sale_params)\n format.html { redirect_to @origin_sale, notice: 'Originen de Venta actualizado con exito.' }\n format.json { render :show, status: :ok, location: @origin_sale }\n else\n format.html { render :edit }\n format.json { render json: @origin_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sales_code = SalesCode.find(params[:id])\n\n respond_to do |format|\n if @sales_code.update_attributes(params[:sales_code])\n format.html { redirect_to @sales_code, notice: 'Sales code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sales_history.update(sales_history_params)\n format.html { redirect_to @sales_history, notice: 'Sales history was successfully updated.' }\n format.json { render :show, status: :ok, location: @sales_history }\n else\n format.html { render :edit }\n format.json { render json: @sales_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_sale_setting\n service_response = ClientManagement::UpdateSaleSetting.new(params).perform\n render_api_response(service_response)\n end",
"def update\n respond_to do |format|\n if @point_of_sale.update(point_of_sale_params)\n format.json { render :show, status: :ok, location: @point_of_sale }\n else\n format.json { render json: @point_of_sale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sales_stage.update(sales_stage_params)\n format.html { redirect_to sales_stages_path, notice: 'Sales stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @sales_stage }\n else\n format.html { render :edit }\n format.json { render json: @sales_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_sales_article\n @sales_article = SalesArticle.find(params[:id])\n end"
] |
[
"0.710073",
"0.679656",
"0.6687523",
"0.6686468",
"0.6568697",
"0.6568136",
"0.6443833",
"0.6422258",
"0.6422258",
"0.6416851",
"0.6416851",
"0.6416851",
"0.6416851",
"0.6416851",
"0.6416851",
"0.6416851",
"0.64066106",
"0.63825256",
"0.6308864",
"0.62938577",
"0.62653553",
"0.62576175",
"0.62544984",
"0.62176144",
"0.6192315",
"0.6185734",
"0.61784595",
"0.61180884",
"0.611629",
"0.6104562",
"0.6093518",
"0.60868514",
"0.6082063",
"0.60632575",
"0.605385",
"0.60488117",
"0.60459936",
"0.60271",
"0.6018127",
"0.600535",
"0.5978964",
"0.59782374",
"0.59782374",
"0.5973833",
"0.5968031",
"0.5964595",
"0.59545004",
"0.59445596",
"0.5941087",
"0.5910763",
"0.59089714",
"0.5908692",
"0.5905067",
"0.5902756",
"0.5895801",
"0.58837104",
"0.58808476",
"0.5875339",
"0.586171",
"0.5858693",
"0.5858693",
"0.5841217",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.58332354",
"0.5830124",
"0.58225715",
"0.5812147",
"0.5809067",
"0.5803352",
"0.5799176",
"0.57957006",
"0.57941955",
"0.57711816",
"0.5761959",
"0.5760613",
"0.5756832",
"0.5756072",
"0.5753205",
"0.5750298",
"0.5726289"
] |
0.65577644
|
6
|
DELETE /sales/1 DELETE /sales/1.json
|
def destroy
@sale = Sale.find(params[:id])
@sale.destroy
respond_to do |format|
format.html { redirect_to sales_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale = Sale.find(params[:id])\n @sale.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sale = Sale.find(params[:id])\n @sale.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sales_item.destroy\n respond_to do |format|\n format.html { redirect_to sales_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_datum = SalesDatum.find(params[:id])\n @sales_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: 'Sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: 'Sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: 'Sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: 'Sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: 'Sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: 'Sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: 'Sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: 'Sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: 'Sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n\n head :no_content\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: \"Compra removida com sucesso.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale = Sale.find(params[:id])\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to :sales }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n\n end",
"def destroy\n @sales_rep = SalesRep.find(params[:id])\n @sales_rep.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_reps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.js\n format.html { redirect_to sales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: '売上を削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to (@customer ? customer_sales_url(@customer) : sales_url), notice: 'Sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @sale = Sale.find(params[:id])\n logger.info \"Sale #{@sale.title} destroyed by #{current_user.email}\"\n \n @sale.destroy\n\n respond_to do |format|\n format.html { redirect_to(sales_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @daily_sale.destroy\n respond_to do |format|\n format.html { redirect_to daily_sales_url, notice: 'Daily sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_order = SalesOrder.find(params[:id])\n @sales_order.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pre_sale = PreSale.find(params[:id])\n @pre_sale.destroy\n\n respond_to do |format|\n format.html { redirect_to pre_sales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n instance = @sale.destroy\n render json: { msg: instance }, status: :ok\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to \"/bridge/delete_old_deal\", notice: 'Sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detail_sale.destroy\n respond_to do |format|\n format.html { redirect_to detail_sales_url, notice: \"Detail sale was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @sale\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: 'Sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale_invoice = SaleInvoice.find(params[:id])\n @sale_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to monthly_movement_sale_invoices_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @d_sale_item = DSaleItem.find(params[:id])\n #@d_sale_item.destroy\n\n respond_to do |format|\n format.html { redirect_to d_sale_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sale_day_total = SaleDayTotal.find(params[:id])\n @sale_day_total.destroy\n\n respond_to do |format|\n format.html { redirect_to sale_day_totals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale_order = current_company.sale_orders.find(params[:id])\n @sale_order.destroy\n\n respond_to do |format|\n format.html { redirect_to sale_orders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_entry.destroy\n respond_to do |format|\n format.html { redirect_to sales_entries_url, notice: 'Sales entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @point_of_sale.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @business_sale.destroy\n respond_to do |format|\n format.html { redirect_to business_sales_url, notice: 'Business sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_type = SalesType.find(params[:id])\n @sales_type.destroy\n\n respond_to do |format|\n format.html { redirect_to({:controller=>\"sales_types\", :action=>\"index\"}) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product_sale.destroy\n respond_to do |format|\n format.html { redirect_to product_sales_url, notice: 'Product sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rr_sale = RrSale.find(params[:id])\n @rr_sale.destroy\n\n respond_to do |format|\n format.html { redirect_to(rr_sales_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @sales_productivity = SalesProductivity.find(params[:id])\n @sales_productivity.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_productivities_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sale_payment.destroy\n respond_to do |format|\n format.html { redirect_to sale_payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_order.destroy\n respond_to do |format|\n format.html { redirect_to sales_orders_url, notice: 'Sales order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n for product_sale in @sale.product_sale\n product_sale.destroy\n end\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: \"Venda apagada com sucesso.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_term = SalesTerm.find(params[:id])\n @sales_term.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_terms_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sales_product.destroy\n respond_to do |format|\n format.html { redirect_to sales_products_url, notice: 'Sales product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @requested_sales_document.destroy\n respond_to do |format|\n format.html { redirect_to requested_sales_documents_url, notice: 'Requested sales document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n product = Product.find(params[:id])\n\n product.sales.each do |sale|\n sale.destroy\n end\n\n product.delete\n\n redirect_to controller: \"products\", action: \"index\"\n end",
"def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sales_history.destroy\n respond_to do |format|\n format.html { redirect_to sales_histories_url, notice: 'Sales history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @salesperson = Salesperson.find(params[:id])\n @salesperson.destroy\n\n respond_to do |format|\n format.html { redirect_to salespeople_url }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def destroy\n @sale.destroy\n quotes = Quote.where(sale_id: @sale.id)\n\n quotes.each { |q| q.destroy }\n message = \"The sale: \\\"#{@sale.description.to_s.capitalize } \\\" was successfully deleted.\"\n respond_to do |format|\n format.html { redirect_to sales_url, notice: message }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @accesory_sale.destroy\n respond_to do |format|\n format.html { redirect_to accesory_sales_url, notice: 'Accesory sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @referral_sale.destroy\n respond_to do |format|\n format.html { redirect_to referral_sales_url, notice: 'Referral sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale_order = SaleOrder.find(params[:id])\n @sale_order.destroy\n\n respond_to do |format|\n format.html { redirect_to(sale_orders_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n get_data\n @sale_detail = @sale.details.find(params[:id])\n @sale_detail.destroy\n get_data\n end",
"def destroy\n authorize @origin_sale\n @origin_sale.destroy\n respond_to do |format|\n format.html { redirect_to origin_sales_url, notice: 'Origen de Venta eliminado con exito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_order.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'La Orden de Venta se eliminó satisfactoriamente.'\n redirect_to sales_orders_path\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_purchase = Shop::Purchase.find(params[:id])\n @shop_purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_purchases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @purchase_datum.destroy\n respond_to do |format|\n format.html { redirect_to purchase_data_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n #realiza acciones necesarias para anular la venta\n @sale.anular_venta\n @sale.destroy\n \n respond_to do |format|\n format.html { redirect_to sales_url, notice: 'La Venta ha sido eliminada con exito. El producto está en stock nuevamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @purchase.destroy\n respond_to do |format|\n\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n\n end",
"def destroy\n @analytics_purchase.destroy\n respond_to do |format|\n format.html { redirect_to analytics_purchases_url, notice: 'Analytics purchase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @supermarket = Supermarket.find(params[:id]) \n @supermarket.destroy\n respond_to do |format|\n format.json { render json: @supermarket, status: :ok }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchase_path }\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 @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 @cal_month_sale.destroy\n respond_to do |format|\n format.html { redirect_to cal_month_sales_url, notice: 'Cal month sale was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_associate.destroy\n respond_to do |format|\n format.html { redirect_to sales_associates_url, notice: 'Sales associate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_group.destroy\n respond_to do |format|\n format.html { redirect_to sales_groups_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @sales_coffee.destroy\n respond_to do |format|\n format.html { redirect_to sales_coffees_url, notice: \"Sales coffee was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete_index\n @customer = Customer.with_deleted.find(params[:id])\n if params[:type]=='normal'\n @customer.delete\n elsif params[:type]=='restore'\n @customer.restore\n @customer.update(deleted_at: nil)\n end\n\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_path, notice: 'Customer was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n # 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 @sale_on_sale_import = SaleOnSaleImport.find(params[:id])\n @sale_on_sale_import.destroy\n\n respond_to do |format|\n format.html { redirect_to(sale_on_sale_imports_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sale_type.destroy\n respond_to do |format|\n format.html { redirect_to sale_types_url, notice: \"Sale type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sale.destroy\n respond_to do |format|\n format.html { redirect_to new_team_event_sale_path(active_event), notice: 'Sale was successfully destroyed.' }\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(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n\n format.html { redirect_to sell_list_path, notice: '주문이 삭제되었습니다.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_plan.destroy\n respond_to do |format|\n format.html { redirect_to sales_plans_url, notice: 'Sales plan was successfully destroyed.' }\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 @hotsale.destroy\n respond_to do |format|\n format.html { redirect_to hotsales_url, notice: 'Hotsale ha sido eliminado' }\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"
] |
[
"0.75238115",
"0.7519581",
"0.7519581",
"0.72468376",
"0.7210167",
"0.71714795",
"0.71714795",
"0.71714795",
"0.71714795",
"0.71714795",
"0.71714795",
"0.71714795",
"0.71714795",
"0.71714795",
"0.7148764",
"0.713443",
"0.7107516",
"0.70768994",
"0.7074153",
"0.7073332",
"0.70695",
"0.7068857",
"0.70566875",
"0.70554763",
"0.6976825",
"0.6968112",
"0.69503564",
"0.6949975",
"0.69444",
"0.69438404",
"0.6921389",
"0.68954796",
"0.6875928",
"0.6869089",
"0.68447274",
"0.6819648",
"0.6777204",
"0.6774218",
"0.67686164",
"0.67660594",
"0.6760771",
"0.67470706",
"0.674442",
"0.6743662",
"0.6734235",
"0.67305684",
"0.6700029",
"0.6696499",
"0.66726804",
"0.6670427",
"0.6667796",
"0.6667378",
"0.6667237",
"0.66634905",
"0.6659192",
"0.66574854",
"0.6656069",
"0.6643215",
"0.66424406",
"0.6625828",
"0.66168404",
"0.6609007",
"0.6601679",
"0.65973437",
"0.65922314",
"0.6576738",
"0.6570799",
"0.65668166",
"0.6566406",
"0.6564657",
"0.6556736",
"0.6556736",
"0.6555499",
"0.6555499",
"0.6555499",
"0.6555499",
"0.6555499",
"0.65554535",
"0.6552089",
"0.65503746",
"0.6546934",
"0.6544285",
"0.65440357",
"0.6539808",
"0.6531853",
"0.65237147",
"0.65206176",
"0.6514236",
"0.6512214",
"0.65054315",
"0.6499453",
"0.6496087",
"0.64849675",
"0.6484636",
"0.6483444",
"0.6482143",
"0.6482143",
"0.6482143",
"0.6482143"
] |
0.75418174
|
0
|
Yields all the permutations of self into block.
|
def permute(&block)
case size
when 0 then yield []
when 1 then yield self
when 2
yield self
yield self.reverse
else
0.upto(size-1) do |i|
a = dup
c = a.slice!(i)
a.permute do |p|
yield p.dup.unshift(c)
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def all_permutations\n perms = permutations\n perms = perms.shuffle.take(1) if @single_perm || ENV['FAST_TESTS']\n\n perms.each do |p|\n yield(p)\n WebMock.reset!\n end\n end",
"def permutation(length = size, &block)\n return enum_for(:permutation, length) if not block_given?\n if length == 0\n yield EmptyList\n elsif length == 1\n each { |obj| yield Cons.new(obj, EmptyList) }\n elsif not empty?\n if length < size\n tail.permutation(length, &block)\n end\n\n tail.permutation(length-1) do |p|\n 0.upto(length-1) do |i|\n left,right = p.split_at(i)\n yield left.append(right.cons(head))\n end\n end\n end\n self\n end",
"def permutations array\n if array.size < 2\n yield array\n else\n array.each do |element|\n permutations(array.select() {|n| n != element}) \\\n {|val| yield([element].concat val)}\n end\n end\nend",
"def each\n while nextperm\n yield indices.map { |i| alphabet[i] }\n end\n end",
"def each\n yield self[0]\n yield self[1]\n end",
"def each_pair\n\t\t\t# Ruby defines #combination and #permutation for iteration of those sorts of sets\n\t\t\t\n\t\t\t# counter = wrapping_counter @head_index, @tail_index, @queue.size\n\t\t\t\n\t\t\t# counter.each_index do |index|\n\t\t\t# \ti = counter[index]\n\t\t\t\t\n\t\t\t# \tcounter[(index+1)..-1].each do |j|\n\t\t\t# \t\tyield @queue[i], @queue[j]\n\t\t\t# \tend\n\t\t\t# end\n\t\t\t\n\t\t\t# using #permutation means that the order will not be guaranteed\n\t\t\twrapping_counter(@head_index, @tail_index, @queue.size).permutation(2) do |i, j|\n\t\t\t\tyield @queue[i], @queue[j]\n\t\t\tend\n\t\tend",
"def permute!() options.permute!(self) end",
"def each\n yield self\n children.each {|c| c.each {|n| yield n}}\n end",
"def each(&block)\n @poss.each(&block)\n end",
"def each_block\n 0.upto(3) do |x|\n 0.upto(3) do |y|\n # TODO: Move the bitwise and into #rotation.\n # Not sure now there's a rotate method for each direction.\n c = Tetrominos[@shape][@rotation & 3][y][x]\n yield x, y, c if c == 1\n end\n end\n end",
"def each\n pomodoros.each do |pomo|\n yield pomo\n end\n end",
"def each(&block)\n yield self\n children.each {|c| c.each(&block)}\n end",
"def each\n # create Hash table to pack up settings\n pack = Hash.new\n @params.each do |key,value|\n pack[key] = packed?(key,value) ? value : [value]\n end\n # create full permutation of each setting\n confs = permute(pack)\n # create clone of current animconfig\n anim = self.clone\n # apply block attach to each to each config\n confs.each do |conf|\n anim.params = conf\n yield anim\n end\n end",
"def walk\n 1.upto( self.map(&:abs).max ) do |mult|\n yield [ basis[0] * mult, basis[1] * mult ]\n end\n end",
"def each_combination\n \n end",
"def yields *args\n @yields = args\n self\n end",
"def each # And define each on top of next\n loop { yield self.next }\n end",
"def each\n yield self\n end",
"def each()\n i = 0\n while i < @total\n yield at(i)\n i += 1\n end\n self\n end",
"def permutation (array)\n# yields permutation set WITH duplicates\nend",
"def permutations(base, result = [])\n base = base.dup\n base.empty? ? [result] : base.shift.map { |value| permutations(base, result + [value]) }.flatten(1)\n end",
"def each # And define each on top of next\n loop {yield self.next }\n end",
"def each\n @size.times do |y|\n @size.times do |x|\n yield x, y, @grid[x][y]\n end\n end\n self\n end",
"def permutations(array)\n \nend",
"def each(&block)\n @size.times { |position| yield self[position] }\n end",
"def each(&block)\n @size.times { |position| yield self[position] }\n end",
"def each(&block)\n @size.times { |position| yield self[position] }\n end",
"def each(&block)\n return enum_for(:each) unless block_given?\n visit { |node| yield node }\n self\n end",
"def each &block\n @parts.each(&block)\n end",
"def permutations(a, i)\n if i == a.size \n puts to_decimal(a)\n gets\n return\n end\n\n for j in i..a.size-1\n a[j], a[i] = a[i], a[j]\n permutations(a, i + 1)\n a[j], a[i] = a[i], a[j]\n end\nend",
"def permutations_lazy_iter(arr)\n new_arr = [arr]\n num_perms = factorial(arr.length)\n\n until new_arr.length == num_perms\n new_arr << arr.shuffle\n new_arr = new_arr.uniq\n end\n\n new_arr\nend",
"def each\n @length.times {|i|\n yield @gens.collect {|x| x[i]}\n }\n self\n end",
"def each\r\n 3.times do |i|\r\n 3.times do |j|\r\n yield(@table[i][j], i, j)\r\n end\r\n end\r\n\r\n self # Chainability! Yay!\r\n end",
"def each!\r\n each do |item, i, j|\r\n @table[i][j] = yield(@table[i][j], i, j) || @table[i][j]\r\n end\r\n\r\n self # Chainability! Yay!\r\n end",
"def each(&block)\n return @parts.each(&block)\n end",
"def each\n @block_args.each do |arg|\n yield arg\n end\n end",
"def map\n cur = self\n while cur\n yield(cur)\n cur = cur.next\n end\n self\n end",
"def each\n# And define each on top of next\nloop { yield self.next }\nend",
"def each\n# And define each on top of next\nloop { yield self.next }\nend",
"def each\n block_given? or return enum_for(__method__)\n @plans.each do |o| yield(o) end\n self\n end",
"def each(&block)\n @size.times { |position| yield self.get(position) }\n end",
"def each(&block)\n @values.each {|(n, v)| yield(n, v)}\n self\n end",
"def permutations(array)\n\nend",
"def permutations(array)\n\nend",
"def permutations(array)\n\nend",
"def permutations(array)\n\nend",
"def each\n @molecules.each do |mol|\n yield mol\n end\n end",
"def each\n self.traverse_down { |node| yield(node) }\n end",
"def each\n @val.each_with_index { |o, i|\n o.each_with_index { |p, j| yield(i,j,p) }\n }\n end",
"def permute(level, input)\n return [input] if level == input.length - 1\n\n results = []\n for i in level..(input.length-1)\n foo = permute(level+1, swap(input, level, i))\n results << foo\n end\n results\n end",
"def each_pair\n return enum_for(:each_pair) unless block_given?\n self.each do |c|\n yield c.path.dup, c.orig \n end\n end",
"def each\n @children.each {|child| yield child}\n end",
"def each\n self.to_a.each do |el|\n yield(el)\n end\n end",
"def each\n [@object,@parameters].flatten.each { |param|\n #Puppet.debug(\"yielding param #{param}\")\n yield param\n }\n end",
"def pipelined\n yield\n end",
"def each\n @children.each { |child| yield child }\n end",
"def each\n @node_set.each do |c|\n yield NodeProxy.new(c, parent)\n end\n end",
"def map!\n return Enumerator.new(self, :map!) unless block_given?\n\n (0...h).each do |y|\n (0...w).each do |x|\n self[x, y] = yield self[x, y]\n end\n end\n\n self\n end",
"def each\n\n rewind\n\n n,f,q,c=next_seq\n\n while (!n.nil?)\n yield(n,f,q,c)\n n,f,q,c=next_seq\n end\n\n rewind\n\n end",
"def each\n while row=self.next\n yield row\n end\n end",
"def each\n while row=self.next\n yield row\n end\n end",
"def each(&block)\n each_vertex(&block)\n end",
"def each\n @node_set.each do |c|\n yield NodeProxy.new(c, parent)\n end\n end",
"def each\r\n @many = true\r\n yield(self)\r\n end",
"def iterate_permutations(args = {})\n gems = @gems.reject { |gem| @redundant_gems.include? gem }\n permutation_count = permutations(gems)\n count = 0\n template_location = File.dirname(Open3.capture2e(\"gem which resquire\")[0]) + '/template.rb'\n gems.permutation.each do |gem_group|\n print \"#{count}/#{permutation_count}\\r\" if @progress_bar\n redundant_gem, status = Open3.capture2e(\"ruby #{template_location} #{gem_group.join(',')}\")\n @redundant_gems << redundant_gem unless status.success?\n break unless status.success?\n count += 1\n end\n find_redundant_gems(args) unless count == permutation_count\n @redundant_gems\n end",
"def each(&block) \n reset\n \n while transaction = next_transaction\n yield transaction\n end\n end",
"def batch\n yield if block_given?\n end",
"def each\n enclosed_yield = Proc.new { |*args| yield *args }\n\n @proc.call Yielder.new(&enclosed_yield)\n end",
"def permutation\n @cache_sizes.map do |a|\n @block_sizes.map do |b|\n { :cache_size => a, :block_size => b }\n end\n end.flatten\n end",
"def each(&block)\n @size.times { |position| yield self[position] }\n end",
"def each(&block)\n @size.times { |position| yield self[position] }\n end",
"def generators(&blk); end",
"def generators(&blk); end",
"def each()\n yield izq\n yield der\n end",
"def each(&block)\n @current = self.head\n position = @current\n if block_given?\n while position do\n block.call( position.value.dup )\n position = position.next\n break if position.equal?(@current)\n end\n else\n Enumerator.new do |yielder|\n while position do\n yielder << position.value.dup\n position = position.next\n break if position.equal?(@current)\n end\n end\n end\n end",
"def combination( number, & block )\n\n load_parent_state\n \n return super\n\n end",
"def each()\n self.to_a.each { |elt| yield elt }\n end",
"def permutations\n return [self] if length == 1\n\n orders = []\n positions = (0...length).to_a\n\n # Finding the permutations with a basic array of digits\n positions.each do |position|\n (positions - [position]).permutations.each do |permutation|\n orders << permutation.unshift(position)\n end\n end\n\n # We subsitute in our original elements. This prevents duplicate\n # elements from causing problems, and allows the [3,3] example to work.\n orders.map { |order| order.map { |index| self[index] } }\n end",
"def *(permutation)\n\n # To pipe two permutations, we must apply the second permutation\n # to the results of first pemutation:\n #\n # p1:\n # a => b\n # b => c\n # c => a\n #\n # p2:\n # c => a\n # a => c\n # j => k\n # k => j\n #\n # The result permutation p1*p2 will be:\n # a\t=> b\n # b\t=> c => a\n # c\t=> a => c\n # j => k\n # k => j\n #\n # That is:\n # a => b\n # b => a\n # c => c (this pair will be ommited)\n # j => k\n # k => j\n\n origins = @changes.keys\n images = @changes.values\n\n # First, we apply the new permutation to the images of this permutation\n images = permutation.apply_to(images)\n\n # Second, we remove the already applied items for the second pemutation\n # Beware: we must compare with the original images\n remaining = permutation.changes.reject { |key, _| @changes.values.include? key }\n\n # Third, we add the second permutation remaining changes to the list of changes\n origins += remaining.keys\n images += remaining.values\n\n # Then we put it togheter\n new_changes = Hash[origins.zip(images)]\n\n # Finally we remove identities (elements which change to themselves)\n new_changes.reject! { |k,e| k == e}\n\n # Et voila! Here is the new permutation\n Permutation.new(new_changes)\n end",
"def caterpillar_method\n result=[]\n i=0\n while(i<self.size/2)\n j=i+1\n while (self[j] && (yield self[i],self[j]))\n result<<[self[i],self[j]]\n j+=1\n end\n i+=1\n end\n return result\n end",
"def each(&block)\n @mutable.each(&block)\n end",
"def each\n @size.times do |i|\n yield self[i]\n end\n end",
"def each(*args, &block)\n @partition.each(*args, &block)\n end",
"def each(&b)\n if self.range.respond_to?(:each_by_step)\n self.range.each do |sub|\n each_by_step(sub, &b)\n end\n else\n each_by_step do |sub|\n # puts \"self.range = #{self.range} yielded: #{sub}\"\n yield sub\n end\n end\n end",
"def yield\n @eff.yield.perform\n end",
"def each\n @gens.each { |g| g.rewind }\n\n loop do\n count = 0\n\n ret = @gens.map { |g|\n if g.end?\n count += 1\n nil\n else\n g.next\n end\n }\n\n if count == @gens.size\n break\n end\n\n yield ret\n end\n\n self\n end",
"def each(&block)\n @succ.each(&block)\n end",
"def each\n @aln.each do | seq |\n yield seq[@col]\n end\n end",
"def permute(list)\n if (list.length <= 1)\n return [list]\n end\n permutations = []\n count = 1\n list.each do |item|\n sublist_permutations = permute(list - [item])\n sublist_permutations.each do |permutation|\n permutation.unshift(item)\n permutations << permutation\n #puts \"Permutations : #{permutations.join(', ')}\"\n #puts \"permutation lists: #{permutations.each {permutation.join(', ')}}\"\n end\n end\n return permutations\nend",
"def each\n\n\t\t@a.each do |x|\n\t\t\tyield x\n\t\tend\n\tend",
"def each\n\t\t @table.each do |pair, bigram|\n yield(bigram)\n\t\t end\n\t\t end",
"def each_chunk( &block )\n\t\t\tself.validate\n\n\t\t\titer = Enumerator.new do |yielder|\n\t\t\t\tself.bytes.each_slice( self.chunksize ) do |bytes|\n\t\t\t\t\tyielder.yield( bytes.pack('C*') )\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn iter unless block\n\t\t\treturn iter.each( &block )\n\t\tend",
"def each\n (bytesize * 8).times do |pos|\n yield self[pos]\n end\n end",
"def each\n\n this_node = @head\n\n size.times do |i|\n yield this_node.value\n this_node = this_node.child\n end\n\n return self\n end",
"def each\n @cols.length.times do |i|\n @rows.length.times do |j|\n yield [i, j]\n end\n end\n end",
"def _each(&block)\n _next.each(&block) if _next\n end",
"def yields\n parsed {\n @yields\n }\n end",
"def each(&block)\n end",
"def each(&block)\n all.each(&block)\n end",
"def each\n for i in @list_of_positions\n yield self.next()\n end\n end"
] |
[
"0.69165623",
"0.6744315",
"0.63351053",
"0.62013185",
"0.61836386",
"0.61515087",
"0.6100307",
"0.6084606",
"0.6048573",
"0.59515905",
"0.5943673",
"0.5883916",
"0.58373123",
"0.58193165",
"0.58012384",
"0.5791618",
"0.57832944",
"0.5714496",
"0.5706052",
"0.57050174",
"0.5698284",
"0.567488",
"0.56544363",
"0.56262654",
"0.56025827",
"0.56025827",
"0.56025827",
"0.55920064",
"0.5585509",
"0.5584669",
"0.5566138",
"0.5564869",
"0.556123",
"0.5555778",
"0.5552045",
"0.5551611",
"0.5543121",
"0.5541542",
"0.5541542",
"0.55353504",
"0.5534557",
"0.5531271",
"0.5519904",
"0.5519904",
"0.5519904",
"0.5519904",
"0.5515",
"0.5506739",
"0.55022794",
"0.5497245",
"0.54953164",
"0.5484552",
"0.54793227",
"0.5477263",
"0.54771364",
"0.5471282",
"0.54692113",
"0.5467416",
"0.54665864",
"0.5460963",
"0.5460963",
"0.5459656",
"0.54539067",
"0.54503196",
"0.544392",
"0.54377836",
"0.54326457",
"0.5430153",
"0.5428377",
"0.5422853",
"0.5421657",
"0.54187554",
"0.54187554",
"0.5418754",
"0.54175335",
"0.539481",
"0.53915334",
"0.53882897",
"0.5386892",
"0.53805345",
"0.53788227",
"0.537868",
"0.53764766",
"0.53712213",
"0.5366159",
"0.53640085",
"0.5360226",
"0.53568643",
"0.53566885",
"0.53524375",
"0.5351077",
"0.5340007",
"0.53379333",
"0.5337861",
"0.5332312",
"0.53302747",
"0.5328588",
"0.5328162",
"0.53261614",
"0.5322393"
] |
0.7230013
|
0
|
attr_accessor :links, :pages, :domain, :options, :db_name, :directory, :objects, :skipped_pages, :loaded_objects
|
def initialize project = "", opt = {}
self.project = project.should_not! :be_nil
self.options = opt.to_openobject
# DB
self.db_name = project
self.connection = Mongo::Connection.new # nil, nil, :logger => Logger.new(STDOUT)
self.connection.drop_database db_name if options.clear?
self.db = connection.db db_name
# File Storage
options.base_directory.should_not_be! :blank
self.base_directory = "#{options.base_directory}/#{project}"
FileUtils.rm_rf base_directory if options.clear?
FileUtils.mkdir_p base_directory unless File.exist? base_directory
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def external_link_inventory # make this an object attribute for every page object, along with base url, and other helpful state info\n []\n end",
"def initialize\n @locked = true\n @diary_pages = []\n end",
"def links\n\t\t\tlinks = {}\n\t\t\tself.page_files(true).each do |p|\n\t\t\t\tpage = Page.new(p)\n\t\t\t\tlinks[page.base_dir] = page.url\n\t\t\tend\n\t\t\tlinks\n\t\tend",
"def setup\n clear_db\n\n @url = Wgit::Url.new(Wgit::DatabaseDefaultData.url)\n @doc = Wgit::Document.new(Wgit::DatabaseDefaultData.doc)\n\n records = 3\n\n @urls = []\n records.times do\n @urls << Wgit::Url.new(Wgit::DatabaseDefaultData.url)\n end\n\n @docs = []\n records.times do\n @docs << Wgit::Document.new(Wgit::DatabaseDefaultData.doc)\n end\n end",
"def initialize(options = {})\n @paged_objects = {0 => options[:seed_page]}\n @total = options[:total].to_i\n @per_page = options[:per_page].to_i\n @pages = @per_page > 0 ? (@total.to_f / @per_page.to_f).ceil : 0\n @load_more_call = options[:load_more_call]\n @no_threads = options[:no_threads] || DEFAULT_NO_THREADS\n end",
"def get_objects\n return self.pageobjects\n end",
"def initialize initial_options = {}\n @paging = false\n @classes = nil\n\n options = self.class.default_options.update(initial_options)\n\n @formatter_klass = options[:formatter]\n\n require 'profile' if options[:profile]\n\n @names = options[:names]\n @list = options[:list]\n\n @doc_dirs = []\n @stores = []\n\n RDoc::RI::Paths.each(options[:use_system], options[:use_site],\n options[:use_home], options[:use_gems],\n *options[:extra_doc_dirs]) do |path, type|\n @doc_dirs << path\n\n store = RDoc::RI::Store.new path, type\n store.load_cache\n @stores << store\n end\n\n @list_doc_dirs = options[:list_doc_dirs]\n\n @interactive = options[:interactive]\n @server = options[:server]\n @use_stdout = options[:use_stdout]\n @show_all = options[:show_all]\n @width = options[:width]\n\n # pager process for jruby\n @jruby_pager_process = nil\n end",
"def initialize\n\t\t\t\t@options = {}\n\t\t\t\t@config = {}\n\t\t\t\t@hashes = Array.new\n\t\t\t\t@files_of_hashes = Array.new\n\t\t\t\t@sites = Array.new\n\t\t\t\t@uploads = Array.new\n\t\t\tend",
"def pages\n @pages ||= []\n end",
"def pages; end",
"def meta_links\n @meta_links ||= @internal_struct[:meta_links]\n end",
"def initialize(url, body = nil, code = nil, headers = nil, aka = nil, response_time = nil)\n @url = url\n @code = code\n @headers = headers\n @links = []\n @aliases = []\n @data = OpenStruct.new\n @external = url.is_external?\n @content_length = headers['content-length'].first if headers && headers['content-length']\n @response_time = response_time\n \t \n @aliases << aka if !aka.nil?\n\n if body\n begin\n @doc = body\n rescue\n return\n end\n\n return if @doc.nil?\n \n if self.html?\n Link.find_all_links_in(self) \n end\n \n @links.uniq!\n end\n rescue Exception => exp\n puts \"An error occured [#{exp}]\"\n Page.new(url)\n end",
"def initialize\n @page = 1\n end",
"def initialize pager, page; @pager, @page = pager, page; end",
"def setup\n @url_str = 'http://www.google.co.uk'\n @bad_url_str = 'my_server'\n @link = '/about.html'\n @url_str_link = \"#{@url_str}#{@link}\"\n @url_str_anchor = \"#{@url_str_link}#about-us\"\n @url_str_query = \"#{@url_str_link}?foo=bar\"\n @iri = 'https://www.über.com/about#top'\n @time_stamp = Time.new\n @mongo_doc_dup = {\n 'url' => @url_str,\n 'crawled' => true,\n 'date_crawled' => @time_stamp\n }\n end",
"def setup_page_links\n @page_links = PageLink.all.sort{|a,b| a.position <=> b.position}\n end",
"def pages=(_arg0); end",
"def initialize(site, base, dir, name, collection = T.unsafe(nil)); end",
"def assign_pages!; end",
"def initialize\n @name = ''\n @public = ''\n @description = ''\n @nspath = ''\n @cis = Mash.new\n @relations = Mash.new\n end",
"def initialize(db)\n @db = db\n #initialize the scraper with a database\n end",
"def initialize(object)\n @page = object[\"page\"]\n @pages = object[\"pages\"]\n @count = object[\"count\"]\n @items = object[\"items\"] || object[\"results\"]\n end",
"def initialize( *args )\n\t\t@dir = Treequel.directory\n\t\t@people = @dir.ou( :people )\n\n\t\tsuper\n\tend",
"def initialize\n @current = nil\n @generator = nil\n @last_modified = {}\n @old_siginfo = nil\n @options = nil\n @stats = nil\n @store = nil\n end",
"def pages\n @pages ||= get_pages\n end",
"def prepare()\n @pages = {}\n @files = {}\n @layouts = {}\n\n @commit = @version == :working ? @wiki.repo.head.commit : @wiki.repo.commit(@version)\n items = self.ls(@version)\n\n items.each do |item|\n filename = ::File.basename(item.path)\n dirname = ::File.dirname(item.path)\n if filename =~ /^_Layout.html/\n # layout\n @layouts[item.path] = ::Liquid::Template.parse(item.data)\n elsif @wiki.page_class.valid_page_name?(filename)\n # page\n page = @wiki.page_class.new(@wiki)\n blob = OpenStruct.new(:name => filename, :data => item.data)\n page.populate(blob, dirname)\n page.version = @commit\n\n if @preserve_tree\n key = [::File.dirname(item.path).gsub(/^\\./, \"\").gsub(/\\//, ' '), page.name].join(\" \").strip.downcase\n else\n key = page.name.downcase\n end\n @pages[key] = page\n else\n # file\n @files[item.path] = item.data\n end\n end\n end",
"def get_pages\n @pages << base_gallery_url\n (@doc/\"a\").select{|a| a[\"href\"] =~ /ndxpage/}.each do |e|\n @pages << base_gallery_url_prefix + e[\"href\"]\n end\n puts \"got pages!\"\n puts @pages.inspect\n puts \"---\"\n end",
"def initialize\n @metadata = {}\n @comment = ''\n @parent = nil\n @parent_name = nil # for loading\n @parent_class = nil # for loading\n @section = nil\n @section_title = nil # for loading\n @file = nil\n @full_name = nil\n @store = nil\n @track_visibility = true\n\n initialize_visibility\n end",
"def initialize (params = {})\t\t\n\t\t@verbose=params.fetch(:verbose, false)\n\t\t@http_timeout=params.fetch(:http_timeout, 5000)\n\t\t@crawl_depth=params.fetch(:crawl_depth, 4)\n\t\t@crawl_page_limit=params.fetch(:crawl_page_limit, 1000)\n\t\t@max_parallel=params.fetch(:max_parallel, 40)\n\t\t# Discovered data store\t\t\n\t\t@discovered_urls_by_crawler=Hash.new\n\t\t@visited_urls_by_crawler=Hash.new\n\t\t@crawl_start=Hash.new\n\t\t@crawl_done=Hash.new\n\t\t@log_file=File.dirname(__FILE__)+\"../../logs/crawler.log\"\n\tend",
"def initialize\n self.title = nil\n self.url = nil\n self.comments_url = nil\n self.created_at = nil\n self.author = nil\n self.categories = []\n self.content = nil\n self.medias = []\n end",
"def initialize\n self.title = nil\n self.url = nil\n self.description = nil\n self.updated_at = nil\n self.entries = []\n end",
"def initialize(dir)\n @dir = dir\n Dir.mkdir dir unless Dir.exists? dir\n @network = ObjectNetwork.new\n @values = {}\n @views = {}\n @visitors = {}\n @parts = {}\n end",
"def pages\n @pages \n end",
"def initialize; @docs = {} end",
"def initialize()\n @doc_count = 0\n @docs = []\n end",
"def init\t\n\tenable :static\n\tset :statics_folder, 'statics'\n\tset :deep_or_flat_structure, 'flat'\n\n\tset :public_folder, settings.statics_folder\n\n\tset :page_pool, page_pool()\nend",
"def pages\n @pages\n end",
"def initialize(options = { })\n @url = options[:url]\n @page = options[:page]\n @guid = options[:guid]\n end",
"def page_struct; end",
"def initialize(list, dir, name, max_in_memory, page_size)\n @list = list\n @file_name = File.join(dir, name + '.cache')\n @page_size = page_size\n open\n @pages = PersistentObjectCache.new(max_in_memory, max_in_memory,\n IDListPage, self)\n @page_counter = 0\n end",
"def retrieve_pages(dir, dot_pages); end",
"def objects; end",
"def initialize storename, dbm\n super()\n @dbm = dbm\n @basePath = \"/beer/c/c0010?viewall=true&nonalcoholic=false&storename=#{storename}&pagesize=200&page=\"\n end",
"def links; end",
"def links; end",
"def initialize *args\n @max_load = $MAX_LOAD\n @max_object_size = $MAX_OBJECT_SIZE\n @current_load = 0\n @cache = Hash.new()\n @semaphor = Mutex.new()\n end",
"def initialize(page)\n @page = page\n end",
"def objects\n @@objects ||= []\n end",
"def initialize\n envConfigFile = \"#{$ROOT}/../config/envConfig.yml\"\n @envConfig = loadYAMLFile(envConfigFile)\n stepsFile = \"#{$ROOT}/../config/steps.csv\"\n @steps = loadCSVFile(stepsFile)\n pageObjectsFile = \"#{$ROOT}/../config/pageObjects.csv\"\n @pageObjects = loadCSVFile(pageObjectsFile)\n @reportFolder = generatedReportFolder\n @isProcess = true\n @skipCurrentStep = false\n @report = []\n end",
"def initialize\n @links = []\n @passwords = []\n @category = \"various\"\n @comment = \"\"\n end",
"def initialize(linkfinder,baseURI)\r\n @results={\r\n :uris404=>[],\r\n :uris200=>[],\r\n :urisUnknown=>[],\r\n :checked=>{},\r\n :urisNonHTTP=>[]\r\n }\r\n @linkfinder=linkfinder\r\n @baseURI=baseURI\r\n end",
"def links\n @links ||= []\n @links\n end",
"def initialize(opts)\n @folder, @links = opts[:folder], opts[:links]\n @collection = Grab::Collection.new links\n end",
"def initialize(dir, page_extension)\n @dir = dir\n @extension = page_extension\n end",
"def initialize( opts = Options.instance )\n @opts = opts\n\n @sitemap = {}\n @redirects = []\n @paths = []\n @visited = Set.new\n\n @on_each_page_blocks = []\n @on_each_response_blocks = []\n @on_complete_blocks = []\n\n @pass_pages = true\n @pending_requests = 0\n\n seed_paths\n end",
"def initialize()\n\t\t@items = nil\n\t\t@copies = nil\n end",
"def initialize(pagination_data={})\n @page = pagination_data.fetch(:page, 1)\n @per_page = pagination_data.fetch(:per_page, 1000)\n @total_pages = pagination_data.fetch(:total_pages, 1)\n @total_records = pagination_data.fetch(:total_records, -1)\n @page_first_index = pagination_data.fetch(:page_first_index, -1)\n @page_last_index = pagination_data.fetch(:page_last_index, -1)\n end",
"def pages\n @pages ||= source.map {|path| Page.new(self, path) }\n end",
"def initialize(size,database,offset,klass)\n @size = size\n @original_size = size\n @database = database\n @klass = klass\n @offset = offset\n #@commands = []\n @added = []\n @deleted = []\n @map = {}\n end",
"def initialize(args={})\n unless args.is_a?(Hash)\n raise SiteObject::SiteInitError, \"You must provide hash arguments when initializing a site object. At a minimum you must specify a base_url. Example:\\ns = SiteObject.new(base_url: 'http://foo.com')\"\n end\n\n @arguments = args.with_indifferent_access\n @base_url = @arguments[:base_url]\n @browser = @arguments[:browser]\n @pages = self.class::Page.descendants.reject { |p| p.page_template? }\n\n # Set up accessor methods for each page and page checking methods..\n @pages.each do |current_page|\n unless current_page.page_template?\n current_page.set_url_template(@base_url)\n\n if current_page.url_matcher\n unless current_page.url_matcher.is_a? Regexp\n raise SiteObject::PageConfigError, \"A url_matcher was defined for the #{current_page} page but it was not a regular expression. Check the value provided to the set_url_matcher method in the class definition for this page. Object provided was a #{current_page.url_matcher.class.name}\"\n end\n end\n\n self.class.class_eval do\n define_method(current_page.to_s.underscore) do |args=nil, block=nil|\n current_page.new(self, args)\n end\n\n define_method(\"#{current_page.to_s.underscore}?\") do\n on_page? current_page\n end\n end\n end\n end\n\n visited = Set.new\n tmp = @pages.map {|p| p.instance_methods }.flatten\n tmp.each do |element|\n if visited.include?(element)\n else\n visited << element\n end\n end\n @unique_methods = visited\n end",
"def initialize(opts = {})\n opts = opts.inject({}){ |r, (k,v)| r[k.to_sym] = v; r }\n \n self.files = []\n \n opts.fetch(:files, []).each do |file|\n self.files << Metalink4File.new(file)\n end\n\n self.published = opts.fetch(:published, nil)\n self.updated = opts.fetch(:updated, nil)\n self.origin = opts.fetch(:origin, nil)\n self.origin_dynamic = opts.fetch(:origin_dynamic, false)\n\n self.xml = Builder::XmlMarkup.new(indent: 2)\n end",
"def initialize(url, body = nil, code = nil, headers = nil, aka = nil, referer = nil, depth = 0, response_time = nil)\n @url = url\n @code = code\n @headers = headers\n @links = []\n @aliases = []\n @data = OpenStruct.new\n @referer = referer\n @depth = depth || 0\n @response_time = response_time \n\n @aliases << aka if !aka.nil?\n\n if body\n begin\n @doc = Nokogiri::HTML(body)\n rescue\n return\n end\n\n return if @doc.nil?\n\n #get a list of distinct links on the page, in absolute url form\n @doc.css('a').each do |a| \n u = a.attributes['href'].content if a.attributes['href']\n next if u.nil?\n \n begin\n abs = to_absolute(URI(u))\n rescue\n next\n end\n\n @links << abs if in_domain?(abs)\n end\n \n @links.uniq!\n end\n end",
"def initialize(object, options = {})\n @object = set_object(object)\n @name = set_name(options)\n @path = set_path(options[:path], options[:blank_links])\n end",
"def pagination_meta(object)\n {\n :count => object.length,\n :total_pages => object.total_pages,\n :current_page => object.current_page,\n :prev_page => object.prev_page,\n :next_page => object.next_page\n }\n end",
"def links\n valid_link_keys = %w(mandate new_customer_bank_account organisation parent_event payment payout previous_customer_bank_account refund subscription )\n valid_links = (@links || {}).select { |key, _| valid_link_keys.include?(key) }\n\n links_class = Struct.new(\n *{\n\n mandate: '',\n\n new_customer_bank_account: '',\n\n organisation: '',\n\n parent_event: '',\n\n payment: '',\n\n payout: '',\n\n previous_customer_bank_account: '',\n\n refund: '',\n\n subscription: ''\n\n }.keys\n ) do\n def initialize(hash)\n hash.each do |key, val|\n send(\"#{key}=\", val)\n end\n end\n end\n links_class.new(valid_links)\n end",
"def links\n valid_link_keys = %w(creditor creditor_bank_account )\n valid_links = (@links || {}).select { |key, _| valid_link_keys.include?(key) }\n\n links_class = Struct.new(\n *{\n\n creditor: '',\n\n creditor_bank_account: ''\n\n }.keys\n ) do\n def initialize(hash)\n hash.each do |key, val|\n send(\"#{key}=\", val)\n end\n end\n end\n links_class.new(valid_links)\n end",
"def local_pages\n @link_collector.local_pages\n end",
"def attributes\n { :cookie => cookie,\n :ip_address => ip_address,\n :page_url => page_url,\n :page_name => page_name }\n end",
"def initialize(params)\n @options = params[:options] || { }\n @target = params[:target] || './'\n\n @html_files = []\n @links = []\n @errors = []\n @warnings = []\n @return_code = 0\n\n @options[:max_threads] ||= 4\n end",
"def initialize( name )\n @name = name\n get_page_content\n get_total\n end",
"def page_meta\n @page_meta ||= {}\n end",
"def initialize \n @root =\"http://web.archive.org/web/20030820233527/\" +\n \"http://bytravelers.com/journal/entry\" # Initialize the variables. The root of the URL to the cached copy of the site is here. \n @agent = Mechanize.new\n end",
"def initialize(opts = {})\n opts = opts.inject({}){ |r, (k,v)| r[k.to_sym] = v; r }\n \n self.language = []\n self.os = []\n \n \n self.local_path = opts.fetch(:local_path, nil)\n self.copyright = opts.fetch(:copyright, nil)\n self.description = opts.fetch(:description, nil)\n self.identity = opts.fetch(:identity, nil)\n case opts.fetch(:language, nil)\n when Array\n self.language = opts.fetch(:language, nil)\n when String\n self.language = [opts.fetch(:language, nil)]\n end\n \n self.logo = opts.fetch(:logo, nil)\n case opts.fetch(:os, nil)\n when Array\n self.os = opts.fetch(:os, nil)\n when String\n self.os = [opts.fetch(:os, nil)]\n end\n\n self.urls = []\n opts.fetch(:urls, []).each do |url|\n self.urls << Metalink4FileUrl.new(url)\n end\n \n self.publisher_name = opts.fetch(:publisher_name, nil)\n self.publisher_url = opts.fetch(:publisher_url, nil)\n self.signature = opts.fetch(:signature, nil)\n self.version = opts.fetch(:version, nil)\n \n self.piece_size = opts.fetch(:piece_size, nil) \n self.piece_count = opts.fetch(:piece_count, nil) \n \n self.hashes = []\n end",
"def initialize(path, options = {})\n options = self.class.default_options.merge(options)\n if path.is_a?(GitAccess)\n options[:access] = path\n path = path.path\n end\n\n @path = path\n @repo_is_bare = options.fetch :repo_is_bare, nil\n @page_file_dir = options.fetch :page_file_dir, nil\n @page_file_dir = Pathname.new(\"/#{@page_file_dir}\").cleanpath.to_s[1..-1] if @page_file_dir\n @access = options.fetch :access, GitAccess.new(path, @page_file_dir, @repo_is_bare)\n @base_path = options.fetch :base_path, \"/\"\n @repo = @access.repo\n @ref = options.fetch :ref, self.class.default_ref\n @universal_toc = options.fetch :universal_toc, false\n @mathjax = options.fetch :mathjax, false\n @global_tag_lookup = options.fetch :global_tag_lookup, false\n @hyphened_tag_lookup = options.fetch :hyphened_tag_lookup, false\n @case_insensitive_tag_lookup = options.fetch :case_insensitive_tag_lookup, false\n @css = options.fetch :css, false\n @emoji = options.fetch :emoji, false\n @critic_markup = options.fetch :critic_markup, false\n @h1_title = options.fetch :h1_title, false\n @display_metadata = options.fetch :display_metadata, true\n @index_page = options.fetch :index_page, 'Home'\n @bar_side = options.fetch :sidebar, :right\n @user_icons = ['gravatar', 'identicon'].include?(options[:user_icons]) ?\n options[:user_icons] : 'none'\n @allow_editing = options.fetch :allow_editing, true\n @allow_uploads = options.fetch :allow_uploads, false\n @per_page_uploads = options.fetch :per_page_uploads, false\n @metadata = options.fetch :metadata, {}\n @filter_chain = options.fetch :filter_chain,\n [:YAML, :BibTeX, :PlainText, :CriticMarkup, :TOC, :RemoteCode, :Code, :Macro, :Emoji, :Sanitize, :PlantUML, :Tags, :PandocBib, :Render]\n @filter_chain.delete(:Emoji) unless options.fetch :emoji, false\n @filter_chain.delete(:PandocBib) unless ::Gollum::MarkupRegisterUtils.using_pandoc?\n @filter_chain.delete(:CriticMarkup) unless options.fetch :critic_markup, false\n\n Hook.execute(:post_wiki_initialize, self)\n end",
"def setup\n @pg_url = params[:link_url] || \"\"\n @pg_title = params[:page_title] || \"\"\n @pg_descr = params[:page_descr] || \"\"\n end",
"def all_objects; end",
"def initialize(user,pw, opts = nil)\n @user = user\n @pw = pw\n @blog = nil\n \n @max_blog_entries = nil #as specified in scrape\n @curr_blog_entries = 1 #local loop variable\n \n @completed = false #stop scraping if @completed\n @options = opts #options which get filled in by templates \n \n @doc = nil #Hpricot document representing the xml file\n \n @comment_id = 1 #represents fixed comment id, increased for each comment\n @comment_hash = Hash.new #how we store hierarchical comments\n # [key in xanga] => @comment_id\n\n #for now, just set options to default\n set_default_options if @options == nil \n \n @agent = WWW::Mechanize.new{ |agent|\n # refreshes after login\n agent.follow_meta_refresh = true\n }\n end",
"def initialize\n @indexes = []\n @names = {}\n @size = 1\n @locked = false\n @parent = nil\n end",
"def initialize page, diario\n @page = page\n @uri = page.uri\n @diario = diario\n end",
"def initialize()\n @gen_info_fields = _general_information_fields();\n \n @addr_fields = _address_fields();\n\n end",
"def initialize #hash. Initializes them at nil if not provided\n @http_referers = nil\n @has_cookie = nil\n @session_duration = nil\n end",
"def initialize(**opts)\n @in_private = opts.delete(:in_private) || false\n @extension_paths = opts.delete(:extension_paths) || []\n @start_page = opts.delete(:start_page)\n end",
"def update_page_links(links) # :nodoc:\n ATTRIBUTES.each do |attr|\n send(:\"#{attr}_page_uri=\", links.send(:\"#{attr}\"))\n send(:\"#{attr}_page=\", parse_page_number(links.send(:\"#{attr}\")))\n end\n end",
"def pages\n @pages\n end",
"def setup\n @doc_url = Wgit::Url.new('http://www.mytestsite.com/home')\n @domain = Wgit::Url.new('http://www.mytestsite.com')\n @rel_base_url = '/public'\n @base_url = 'http://server.com' + @rel_base_url\n @html = File.read('test/mock/fixtures/test_doc.html')\n @mongo_doc_dup = {\n 'url' => @doc_url.to_s,\n 'html' => @html,\n 'score' => 12.05,\n 'base' => nil, # Set if using html_with_base.\n 'title' => 'My Test Webpage',\n 'author' => 'Michael Telford',\n 'keywords' => ['Minitest', 'Ruby', 'Test Document'],\n 'links' => [\n '#welcome',\n '?foo=bar',\n 'http://www.google.co.uk',\n 'http://www.mytestsite.com/security.html',\n '/about.html',\n 'about.html/',\n '/',\n 'http://www.yahoo.com',\n '/contact.html',\n 'http://www.bing.com/',\n 'http://www.mytestsite.com',\n 'http://www.mytestsite.com/',\n 'http://www.mytestsite.com/tests.html',\n 'https://duckduckgo.com/search?q=hello&page=2',\n '/blog#about-us',\n 'https://example.com/blog#about-us',\n '/contents/',\n 'http://ftp.mytestsite.com',\n 'http://ftp.mytestsite.com/',\n 'http://ftp.mytestsite.com/files'\n ],\n 'text' => [\n 'Howdy!', \"Welcome to my site, I hope you like what you \\\nsee and enjoy browsing the various randomness.\", \"This page is \\\nprimarily for testing the Ruby code used in Wgit with the \\\nMinitest framework.\", \"Minitest rocks!! It's simplicity \\\nand power matches the Ruby language in which it's developed.\"\n ]\n }\n @stats = {\n url: 30,\n html: 2317,\n title: 15,\n author: 15,\n keywords: 3,\n links: 20,\n text_snippets: 4,\n text_bytes: 280\n }\n @search_results = [\n \"Minitest rocks!! It's simplicity and power matches the Ruby \\\nlanguage in which it\",\n \"is primarily for testing the Ruby code used in Wgit with the \\\nMinitest framework.\"\n ]\n end",
"def initialize(title, url) # from first scrape data initialize == Lifecycle method in Ruby\n @title = title\n @url = url\n @@all << self if @@all.none?(self)\n end",
"def pages\n end",
"def objects\n @objects ||= []\n end",
"def initialize *args\n super *args\n self.page = (page.to_i < 1 ? 1 : page.to_i)\n end",
"def initialize(self)\n self.objects = []\n self.agents = []\n end",
"def repository\n OpenStruct.new.tap do |r|\n r.count_all = 57\n r.count_filtered = 32\n r.paginated_data = [OpenStruct.new(name: 'foo', age: 21),\n OpenStruct.new(name: 'bar', age: 12)]\n end\n end",
"def initialize(name, url) \n\t\t@name = name \n\t\t@url = url \n\t\t@@all << self \n\tend",
"def initialize(config)\n @indent = config[:indent].to_i || 0\n @pre_path = config[:path_prefix] || '/v1'\n @path_pos = @pre_path.split('/').length - 1\n @tql_path = config[:tql_path] || '/tql'\n base = config[:base] || '.'\n @model = Model.new((config['store.dir'] || File.join(base, 'data')).gsub('$BASE', base), indent)\n @type_key = config[:type_key] || 'kind'\n @logger = config[:logger]\n @logger.level = config[:verbosity] unless @logger.nil?\n @http_dir = (config['http.dir'] || File.join(base, 'pages')).gsub('$BASE', base)\n @http_port = (config['http.port'] || 6363).to_i\n @export_proxy = config[:export_proxy]\n @export_proxy = true if @export_proxy.nil? # The default is true if not present.\n @controllers = {}\n @mounts = config[:handler] || []\n\t@server = config['http.server'].to_s.downcase\n requires = config[:require]\n case requires\n when Array\n requires.each { |r| require r.strip }\n when String\n requires.split(',').each { |r| require r.strip }\n end\n end",
"def initialize(url)\n super\n generate_attributes # dynamically create & assign values to attributes :)\n @fields = fields\n end",
"def initialize structmap\n\n @sequence = []\n @valid = true\n @structmap = structmap\n @sequence = create_entries_sequence(structmap)\n\n warn_for_missing_page_images\n nip_it_in_the_bud\n mark_validly_repeated_pages\n cleanup_chapter_titles\n cleanup_page_titles\n number_pages\n end",
"def initialize (params = {})\n\t\t@verbose=params.fetch(:verbose, false)\n\t\t@data_dir=params.fetch(:data_dir, File.dirname(__FILE__)+'/../../../data/')\n\t\tDir.mkdir(@data_dir) unless Dir.exist?(@data_dir)\n\t\t@max_parallel=params.fetch(:max_parallel, 40)\n\t\t# Hash table to hold the trusted domains\n\t\t@sub_domains_file=params.fetch(:sub_domains_file, @data_dir + 'sub_domains')\n\t\tFile.write(@sub_domains_file, \"\") unless File.exist?(@sub_domains_file)\n\t\t@known_internet_sub_domains=load_domains_from_file(@sub_domains_file) #unless @known_internet_sub_domains.size>0\n\tend",
"def total_pages; end",
"def initialize(manga)\n @manga_data = manga\n @downloaded_a_page = false\n @generated_todo = false\n @params = Params.instance.download\n @dir = @params[:manga_path] + manga[:website][:dir] + 'mangas/' + manga[:name] + '/'\n @db = Manga_database.instance\n @aff = DownloadDisplay.new(manga)\n @todo = []\n @links = nil\n @got_web_data = false\n end",
"def initialize\n\t\t\n\t\t@dao = DAO.new 'rpg'\n\n\tend",
"def initialize\n @url = \"http://www.instapaper.com/u\"\n @fetched = 0\n @articles = OpenStruct.new({\n :mobi => \"http://www.instapaper.com/mobi\",\n :epub => \"http://www.instapaper.com/epub\",\n :list => []\n })\n \n # Nur +super+ funktioniert nicht, weil das Original-Argument mit \n # übergeben wird, was dieses +initialize+ nicht erwartet.\n super()\n end",
"def initialize(parent,relative_path=\"-\") # NUANCE the \"-\" is instead of \".\" because I don't wnat the URL to encode it\n @parent = parent\n @relative_path = relative_path\n @info = \"\"\n @rows = []\n @last_modified = Time.now - 3.days\n end"
] |
[
"0.63977045",
"0.62263614",
"0.61306745",
"0.6061598",
"0.59901965",
"0.5912823",
"0.58887774",
"0.5873444",
"0.58466464",
"0.5803929",
"0.5789032",
"0.57721436",
"0.57709146",
"0.57697177",
"0.5742288",
"0.5739109",
"0.57319045",
"0.5710805",
"0.57075256",
"0.56653357",
"0.5659361",
"0.5654227",
"0.56502324",
"0.56451476",
"0.5640027",
"0.5638114",
"0.56331474",
"0.56260395",
"0.5598759",
"0.55975705",
"0.55968285",
"0.55950475",
"0.55891603",
"0.55823034",
"0.5571226",
"0.55705756",
"0.5556386",
"0.555203",
"0.55489624",
"0.5538683",
"0.5537841",
"0.55118126",
"0.55101424",
"0.5504575",
"0.5504575",
"0.5504377",
"0.5502726",
"0.5466055",
"0.5460834",
"0.5436651",
"0.5432556",
"0.5408253",
"0.5407272",
"0.53962725",
"0.53870916",
"0.53801125",
"0.5353856",
"0.5352393",
"0.5351089",
"0.5340287",
"0.5334235",
"0.53273666",
"0.5327027",
"0.53261435",
"0.53221655",
"0.5317576",
"0.5311219",
"0.5307145",
"0.5304233",
"0.5295364",
"0.52949333",
"0.52942324",
"0.5286738",
"0.5284927",
"0.52829784",
"0.52788895",
"0.5270361",
"0.5269297",
"0.5260136",
"0.5256479",
"0.52549803",
"0.5252346",
"0.52474874",
"0.5245343",
"0.5244639",
"0.52438974",
"0.52433014",
"0.5236298",
"0.5230207",
"0.5213171",
"0.5212262",
"0.52071685",
"0.5196607",
"0.51962984",
"0.51952755",
"0.5184357",
"0.518316",
"0.51821154",
"0.51808417",
"0.51781636",
"0.5176733"
] |
0.0
|
-1
|
def say(words = 'hello') puts words + "." end say() say('hi') say('how are you') say("I'm fine")
|
def some_method(number)
number = 7 # this is implicitly returned by the method
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def say(words = 'hello') #a default parameter that is used whenever our method is called without any arguments.\n puts words + '.'\n end",
"def say(words='hello')\n\tputs words + '.'\nend",
"def say(words = \"hello\")\n puts words + '.'\nend",
"def say(words='hello')\n puts words + '.'\nend",
"def say(words='hello')\n puts words + '.'\nend",
"def say(words='hello')\n #prints string for words\n puts words + '.'\n # ends defining of method\nend",
"def say(words)\n puts words + \"!\"\nend",
"def say(words=\"hello\")\n puts words + '.'\nend",
"def say(words = \"hello\") # \"hello\" is the default parameter unless changed when called\n put words + \".\"\nend",
"def say(words = 'hello')\n puts words + '.' ## only make the change here\nend",
"def talk(words)\n puts \"I say #{words}\"\n end",
"def say(words)\n\tputs words\nend",
"def say2(words=\"hello2\")\n puts words \nend",
"def say(words='hello')\n puts words + '.' ## <= We only make the change here!\nend",
"def say(words)\n puts words + '.'\nend",
"def say(words) # (words) is the parameter\n puts words\nend",
"def say(words)\n # question: why do I need the (words) part here?\n # Oh! That's a parameter. These are used when you have data outside of a method's scope, but need access to it within the method's scope. Huh?\n # Arguments are pieces of info passed to the method to be modified or to return a specific result (in this case, to print the phrases)\n puts words\nsay(\"hello\")\nsay(\"hi\")\nsay(\"how are you\")\nsay(\"Im fine\")\nend",
"def say(something)\n \"Say #{something}\"\n end",
"def say (one, two, three)\n\t\tputs one\n\t\tputs two\n\t\tputs three\n\tend",
"def say(words)\n\tputs words + '.' ## <= We only make the change here!\nend",
"def sayHello( name=\"Stranger\", adjective=\"stinky\" )\n puts \"Hello #{ adjective } #{ name }\"\n \"hotdogs hotdogs hotdogs\"\nend",
"def sayhi(name=\"no name\", age= -1) #specify default values can be a good way to control this methods.\n puts (\"Hello\" + name + \", you are \" + age.to_s)\nend",
"def say(words)\n puts words + \".\" ## <= we only make the change here!\nend",
"def say words='hello fella'\n puts words\nend",
"def say(words)\n puts words + '.' #We only make the change here\nend",
"def say_hello name1=\"oscar\", name2=\"shane\"\n\t\"hello, #{name1} and #{name2}\"\nend",
"def sayhi(name = \"no name\", age = -1)\n\tputs(\"Hello \"+name+\", you are \"+age.to_s)\nend",
"def say_hello2(name1=\"oscar\", name2=\"shane\")\n puts \"hello, #{name1} and #{name2}\"\nend",
"def say (something)\n puts something\nend",
"def say_hello name1, name2 #pass parameters just like any other language. If you have lots of parameters, use Parentheses for readability (keep the code clean)\n puts \"Hello, #{name1} and #{name2}\"\nend",
"def saygoodbye(name=\"John\", surname=\"Doe\")\n puts (\"Good Bye \" + name + \" \" + surname)\nend",
"def say_hello3(name1=\"oscar\", name2=\"shane\")\n \"hello, #{name1} and #{name2}\"\nend",
"def more_say(more_words=\"butts\")\n puts more_words + \".\"\nend",
"def say(words)\n yield if block_given?\n puts \"> \" + words\nend",
"def say(words)\n puts words + '.' ## <= We only make the change here!\n end",
"def say_hello (name= \"Ruby Programmer\")\n\n\tputs \"Hello #{name}!\"\nend",
"def say_hello thing_to_say\n puts \"Hello \"+thing_to_say\nend",
"def say_hello name1=\"Oscar\", name2=\"Shane\"\n \"hello, #{name1} and #{name2}\"\nend",
"def sayHello(str)\n puts 'Hey, good to see you ' + str\nend",
"def say(text)\n `say #{text}`\n end",
"def first_method(name = \"Brooke\", age = \"38\")\n puts \"Hello #{name}. You are #{age} years old\"\nend",
"def say_hello_3 name1=\"Bill\", name2=\"Ted\"\n \"hello, #{name1} and #{name2}\"\nend",
"def greet(greeting=\"Hello\", name=\"World\")\n puts \"#{greeting}, #{name}\"\nend",
"def say_hello(name, city, state)\r\n # Your Code Here\r\n \"Hello, #{name.join(\" \")}! Welcome to #{city}, #{state}!\"\r\nend",
"def sayhi(name, age)\n puts (\"Hello \" + name + \", you are\" + age.to_s)\nend",
"def say(*_args)\n end",
"def say_hello(name)\n puts \"Good afternoon, #{name}. How are you?\"\nend",
"def sayhi(name, age)\n puts (\"Hello\" + name + \", you are \" + age.to_s)\nend",
"def say(message)\n puts \"=>\" + message\nend",
"def say(words)\n yield\n puts words\nend",
"def say_hello(name, city, state)\n \"Hello, #{name.join(\" \")}! Welcome to #{city}, #{state}!\"\nend",
"def say(str)\n \"=> #{str}\"\nend",
"def love(mom, dad)\n puts \"#{mom} #{dad}, The End.\"\nend",
"def say(statement = '')\n ui.say statement\n end",
"def what_up2(say, *bros)\n bros.each { |bro| puts \"#{say}\" + \"! \" + \"#{bro}!\" }\nend",
"def say_hello(your_name, my_name = \"Dory\")\n puts \"Hello #{your_name}, I'm #{my_name}!\"\nend",
"def say_hi( name = \"World\" )\n return \"rude\"\n \"Hello #{name}\"\nend",
"def greet name, name2\n puts \"Hello, #{name} and #{name2} how are you all doing today?\"\nend",
"def say(msg)\n puts \"#{msg}\"\nend",
"def say(msg)\n puts \"#{msg}\"\nend",
"def say(input)\n puts \"=> #{input}\"\nend",
"def say_something(something)\n puts \"#{something}, said Becca\"\nend",
"def sayHi(name = \"User\", age = -1)\n puts(\"Hi #{name}, you are \" + age.to_s + \" old\")\nend",
"def sayhello(name, last_name='Rojas')#al hacer parametro=______ es un parametro por defecto, si no se especifica luego linea 6, me lo auto completa\n horoscope = 'capricornio'\n \"Hola #{name.capitalize} #{last_name.capitalize}. Pura Vida! #{horoscope}\" #notar que las interpolaciones estan separadas!!\nend",
"def say_hello(name, city, state)\n \"Hello, %s! Welcome to %s, %s!\" % [name.join(\" \"), city, state]\nend",
"def say_hello(name= \"Ruby Programmer\")\n puts \"Hello #{name}!\"\n\nend",
"def say(m); puts m; end",
"def say_hello(name = \"Ruby Programmer\")\n puts \"Hello #{name}!\"\nend",
"def say_hello(name = \"Ruby Programmer\")\n puts \"Hello #{name}!\"\nend",
"def say_hello(name = \"Ruby Programmer\")\n puts \"Hello #{name}!\"\nend",
"def say_hello(name = \"Ruby Programmer\")\n puts \"Hello #{name}!\"\nend",
"def say_hello(name = \"Ruby Programmer\")\n puts \"Hello #{name}!\"\nend",
"def things(thing1, thing2)\n puts \"Hey can you get me #{thing1} and #{thing2}. Cool thanks\"\nend",
"def say(msg)\n puts \"=> #{msg}\"\nend",
"def say(msg)\n puts \"=> #{msg}\"\nend",
"def say(msg)\n puts \"=> #{msg}\"\nend",
"def scream(words)\n puts words + \"!!!!\"\nend",
"def say_hello(name = \"world!\")\n puts \"Hello, #{name}\"\nend",
"def say_hello(name, city, state)\n return 'Hello,' + name.join(' ') + '! Welcome to ' + city + ', ' + state + '!'\nend",
"def say_hello_ten_times #method signature\n phrase = \"Hello World\"\n puts phrase\n puts phrase\n puts phrase\n puts phrase\n puts phrase\n puts phrase\n puts phrase\n puts phrase\n puts phrase\n puts phrase\n end",
"def say_hello(thing_to_say)\n puts thing_to_say \nend",
"def greetings_programmer(name, language = \"computer\")\n puts \"Hello, #{name}. We heard you are a great #{language} programmer.\"\nend",
"def hello name = \"\", punctuation = \"!\"\n \"hello #{name.capitalize}#{punctuation}\"\nend",
"def say_hello(thing_to_say)\n puts thing_to_say\nend",
"def pets(dog = \"nevermind you don't have a dog\", cat = \"nevermind you don't have a cat\")\n puts \"Your dog's name is \" + dog + \", and your cat's name is \" + cat + \".\"\nend",
"def greet(folks); \"Hi, #{folks}!\"; end",
"def say_hello(thing_to_say)\n puts thing_to_say\nend",
"def say_hello(thing_to_say)\n puts thing_to_say\nend",
"def say_hello(thing_to_say)\n puts thing_to_say\nend",
"def say_hello (thing_to_say)\n puts thing_to_say\nend",
"def greet(name)\n print \"Hello, #{name} how are you doing today?\"\nend",
"def hello(name, age)\n\tputs \"Welcome #{name}, #{age} is definitely not too old to learn how to code\" \nend",
"def say_hello_ten_times\n\nphrase = \"Hello World!\"\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nputs phrase\nend",
"def love(man, woman)\n puts \"#{man} met #{woman} at karaoke night. The rest is history.\"\nend",
"def greet(person_1=\"default\", person_2)\n p person_1 + \" and \" + person_2\nend",
"def say_hello(name=\"Ruby Programmer\")\n puts \"Hello #{name}!\"\nend",
"def say_hello(name)\n puts \"Hello #{name}!\"\nend",
"def say\n send_text \"You just said: #{params}\"\n end",
"def say_hello(name)\n \"Hello, \" + name\nend",
"def say_hello\n me = \"Chris P. Bacon\"\n puts \"hello from #{me}\"\nend",
"def say_hello(name=\"Ruby Programmer\")\n puts \"Hello #{name}!\"\nend"
] |
[
"0.8641947",
"0.86302",
"0.8496572",
"0.84908676",
"0.84908676",
"0.84780675",
"0.84422636",
"0.8439144",
"0.83615667",
"0.8063444",
"0.80595255",
"0.80428886",
"0.7957286",
"0.79528934",
"0.7894815",
"0.78889555",
"0.7769465",
"0.7768284",
"0.7707548",
"0.77074206",
"0.7657937",
"0.7643299",
"0.76166886",
"0.7567089",
"0.75662494",
"0.749468",
"0.74471414",
"0.74389756",
"0.7429383",
"0.74173295",
"0.74052155",
"0.74038607",
"0.73984736",
"0.7396765",
"0.7383769",
"0.73703575",
"0.73540807",
"0.7334907",
"0.7328641",
"0.72875357",
"0.72788835",
"0.7277423",
"0.72595847",
"0.7234925",
"0.7229554",
"0.72167504",
"0.7216503",
"0.7208715",
"0.7199731",
"0.7197589",
"0.7184056",
"0.7180302",
"0.7173872",
"0.7161959",
"0.715008",
"0.71496516",
"0.71464103",
"0.7123207",
"0.7118039",
"0.7118039",
"0.7094154",
"0.7092572",
"0.7081747",
"0.70746386",
"0.70733917",
"0.70731676",
"0.70730853",
"0.7066922",
"0.7066922",
"0.7066922",
"0.7066922",
"0.7066922",
"0.70649546",
"0.70632726",
"0.70632726",
"0.70632726",
"0.7043961",
"0.7033742",
"0.7032012",
"0.70188946",
"0.70177233",
"0.70076007",
"0.6996934",
"0.69949305",
"0.69911265",
"0.6986068",
"0.69842154",
"0.69842154",
"0.6982529",
"0.6961126",
"0.69603735",
"0.6948348",
"0.6929631",
"0.69244874",
"0.6916566",
"0.6915972",
"0.6913885",
"0.690692",
"0.6902462",
"0.68988043",
"0.6896579"
] |
0.0
|
-1
|
GET /tagging_select_tos GET /tagging_select_tos.json
|
def index
@tagging_select_tos = TaggingSelectTo.all
if @tagging_select_tos.empty?
TaggingSelectTo.create(name: 'Sajjad-Murtaza-Testing-Taggable')
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @tagging_select_to = TaggingSelectTo.new(tagging_select_to_params)\n\n respond_to do |format|\n if @tagging_select_to.save\n format.html { redirect_to tagging_select_tos_path }\n format.json { render :show, status: :created, location: @tagging_select_to }\n else\n format.html { render :new }\n format.json { render json: @tagging_select_to.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tagging_select_to\n @tagging_select_to = TaggingSelectTo.find(params[:id])\n end",
"def tagging_select_to_params\n params.require(:tagging_select_to).permit(:name)\n end",
"def tags\n get('tags')\n end",
"def destroy\n @tagging_select_to.destroy\n respond_to do |format|\n format.html { redirect_to tagging_select_tos_url, notice: 'Tagging select to was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def get_tag_list\n # body = {\n # cmd: \"get_tag_list\"\n # }\n\n end",
"def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end",
"def get_tags_for_select() tag_ids.inject([]) { |l, tag_id| l << [get_tag_from_id(tag_id).label, tag_id] } end",
"def temas\n @tags = Tag.find(:all, Topico.find_options_for_tag_counts(:order => \"name ASC\"))\n end",
"def gettags\n @ideaid = params[:ideaid]\n @ideatagsthen = IdeasTags.find(:all, :conditions => {:idea_id => @ideaid})\n @ideatags = Tag.where(:id => @ideatagsthen.map(&:tag_id))\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def index\n @taggings = Tagging.all\n end",
"def selected_tags\n if @params[:tag] && @params[:tag].strip.length > 0\n @selected_tags ||= @params[:tag].downcase.split(',').collect{ |t| t.strip }\n end\n\n return @selected_tags\n end",
"def selected_tags\n if @params[:tag] && @params[:tag].strip.length > 0\n @selected_tags ||= @params[:tag].downcase.split(',').collect{ |t| t.strip }\n end\n\n return @selected_tags\n end",
"def tags\n taxonomies.all :conditions => { :classification => :tag }\n end",
"def tags(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Tags\", params: params)\n end",
"def tasks_by_tags\n Task.tagged_with(selected_tags, {\n :company_id => @company.id,\n :project_ids => @project_ids, \n :filter_hidden => session[:filter_hidden], \n :filter_user => session[:filter_user], \n :filter_milestone => session[:filter_milestone], \n :filter_status => session[:filter_status], \n :filter_customer => session[:filter_customer] \n })\n end",
"def selected_tags\n @selected_tags\n end",
"def tags(options={})\n self.class.parse_tags(request(singular(user_id) + \"/tags\", options))\n end",
"def activities_tags\n\t\ttags = ActivityTag.tags_for_teacher(@current_teacher_user.id)\n\n\t\trender json: {status: \"success\" , tags: tags}\n\tend",
"def tags\n klass = Object.const_get(\"Concepts\").const_get(params[:tag_class])\n results = klass.search_for_label_starting_with(params[:term]).map(&:label)\n render :json => results.uniq.sort\n end",
"def tags_from(options={})\n get(get_tags_uri, { :site_id => options[:blog]})\n end",
"def index\n @range = params[:q][:range_selector_cont] if params[:q]\n params[:q] = Tagging.fix_params(params[:q]) if params[:q]\n @q = Tagging.page(params[:page]).search(params[:q])\n @taggings = @q.result\n if params[:q].present? && params[:q][:tag_tag_group_id_eq].present?\n @tags = TagGroup.where(id: params[:q][:tag_tag_group_id_eq]).first.tags\n @form = SimpleForm::FormBuilder.new(:q, @q, view_context, {}, proc{})\n end\n @search_params = params[:q] if params[:q].present? && params[:q][:tag_tag_group_id_eq].present?\n end",
"def index\n if params[:tag].present? \n @stipes = Stipe.tagged_with(params[:tag])\nelse\n@stipes = Stipe.all.order(\"created_at DESC\")\nend\nend",
"def tags\n @tags_with_count = Asset.tag_counts_on(:tags)\n \n @tags = @tags_with_count.map{|tag_hash| tag_hash = tag_hash.name }\n \n respond_to do |format|\n format.html\n format.json { render :json => @tags }\n end\n end",
"def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Node.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Node.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end",
"def update\n respond_to do |format|\n if @tagging_select_to.update(tagging_select_to_params)\n format.html { redirect_to @tagging_select_to, notice: 'Tagging select to was successfully updated.' }\n format.json { render :show, status: :ok, location: @tagging_select_to }\n else\n format.html { render :edit }\n format.json { render json: @tagging_select_to.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tag_types = TagType.all\n end",
"def get_tag_list\n args = receive_should_validate?\n get('redtube.Tags.getTagList', {}, [], args[:should_validate])\n end",
"def available_tags\n path = \"/product-view/products/search/find-available-tags\"\n\n response, status = BeyondApi::Request.get(@session,\n path)\n\n handle_response(response, status)\n end",
"def index\n tags = Tag.all\n render json: tags, status: :ok\n end",
"def _tagging\n t_tagging[:tag_id].in(self.tags) unless self.tags.length == 0\n end",
"def index\n @has_project_tags = HasProjectTag.all\n render json: @has_project_tags\n end",
"def index\n authorize @organization\n render :json => @organization.tags\n end",
"def day_select_option_tags\n options_for_select DAYS.map.with_index.to_a\n end",
"def tags\n get.tagGuids\n end",
"def selected_tags=(value)\n @selected_tags = value\n end",
"def alltags\n tag_context = params[:context] # tag context\n @tags = TagsService.tag_counts_on(SurveyRespondent, tag_context)\n \n respond_to do |format|\n format.xml\n end\n end",
"def all\n response= handle_errors{ self.class.get('/get')}\n response[\"tags\"][\"tag\"].collect do |tag| \n t= Rubycious::Tag.new(tag)\n end\n end",
"def select_tags()\n return get_db_as_hash().execute(\"SELECT * FROM tags\")\n end",
"def classroom_tags\n\n\t\t@classroom = Classroom.where({teacher_user_id: @current_teacher_user.id, id: params[:classroom_id]}).first\n\n\t\trender json: @classroom.tags(true, false).to_json\n\t\t\n\tend",
"def tags\n response[\"tags\"]\n end",
"def top_tags()\n get(:standard, {:method => \"tag.getTopTags\"})\n end",
"def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end",
"def index\n if params[:q].nil? or params[:q]==\"\"\n @to_dos = current_user.to_dos\n else\n @to_dos = current_user.to_dos.search(params[:q]).records\n end\n @tags = @to_dos.tag_counts.order(taggings_count: :desc).first(40).sort_by {|t| t.name}\n\n if params[:tag]\n @tag = params[:tag]\n @to_dos = @to_dos.tagged_with(params[:tag])\n elsif params[:note_id]\n @to_dos = @to_dos.where(note_id: params[:note_id].to_i)\n end\n ## TODO: Manage display_all param: all todos: only open, todos of a note: all\n if not(params[:display_all])\n @to_dos = @to_dos.where(displayed: \"true\").order(deadline: :asc)\n end\n @to_dos = @to_dos.order(deadline: :asc).page(params[:page]).per(5)\n end",
"def all_tags context = :tags\n ActsAsTaggableOn::Tagging.where(context: context).select(:tag_id).distinct.includes(:tag).map(&:tag)\n end",
"def tags\n return false if params[:q] and params[:q].size < 3\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n respond_to do |format|\n format.json { render :json => @tags.map{|t| {:id => t.name, :name => t.name }}}\n end\n end",
"def where(options = {})\n _, _, root = @client.get(\"/tags\", options)\n\n root[:items].map{ |item| Tag.new(item[:data]) }\n end",
"def taglist\n @tags = Note.tag_counts.map {|tag| tag.name}\n\n respond_to do |format|\n format.json { render json: @tags }\n end\n end",
"def show\n get_status\n @tag = Tag.find(params[:id])\n taggings = Tagging.where(:tag_id => params[:id])\n\n post_ids = []\n taggings.each do |tagging|\n post_ids << tagging.post_id\n end\n post_ids.compact!\n\n @posts = Post.where(:id => post_ids).order('created_at DESC').page(params[:page]).per(5)\n @labels = [\"<span class=\\\"label\\\">\",\"<span class=\\\"label label-success\\\">\",\"<span class=\\\"label label-warning\\\">\",\"<span class=\\\"label label-important\\\">\",\"<span class=\\\"label label-info\\\">\"]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end",
"def search_tags\n\t\t# Searching for patients as per user entered term\n\t\tquestion_tags = Question.all_tags.select{|p| p=~/^#{params[:term]}/i }.uniq\n\t\tif question_tags.present?\n\t \trender :json=> {success: true, \"Tags\" => question_tags.as_json }\n\t # render json: { success: true, response: @questions.map{ |f| QuestionSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Tags are not present\" },:status=> 203\n\t end\n\tend",
"def tags_from_params\n search_filter_params[:tagged_with].to_s.split(\",\")\n end",
"def tag\n @tag = params[:id]\n @personas = Persona.find_tagged_with(@tag,:order=>\"apepat,apemat,nombre\")\n @familias = Familia.find_tagged_with(@tag) \n @instituciones = Institucion.find_tagged_with(@tag,:order=>\"nombre\")\n @comentarios = Comentario.find_tagged_with(@tag,:order=>\"created_at desc\")\n end",
"def show_my_tags\n tags = Tag.where('customer_id = ? AND active = ?', current_customer.id, true)\n\n if tags.nil?\n return_error_infos(400, 'No tags found', 'NoTagsFound', nil)\n else\n json_tags = []\n\n tags.each { |tag| json_tags << create_tag_infos(tag, nil) }\n\n render :status => 200, :json => { :tags => json_tags }\n end\n end",
"def tags\n return head :unauthorized unless current_user\n @tags = current_user.owned_tags.where(\"name like ?\", \"%#{params[:tag]}%\").\n page(params[:page]).per(20)\n if @tags.empty?\n @tags = [current_user.owned_tags.new(name: I18n.t('record.tag_list.no_tags'))]\n end\n respond_with(@tags)\n end",
"def tag(t)\n tag = get url: \"tags/#{generate_slug(t)}\", filter: @everything_filter\n tag.tag if tag\n end",
"def tags(url, options={})\n response = handle_response(self.class.get(\"/tags.json\", :query => {:url => url}.merge(options)))\n Topsy::Page.new(response,Topsy::Tag)\n end",
"def index\n @has_tags = HasTag.all\n end",
"def index\n tags = Array.wrap params.permit(:tags)[:tags]\n @clips = @allclips = Clip.where(session_id: session.id)\n @clips = @allclips.tagged_with(tags, any: true) if tags.any?\n @available_tags = Clip.available_tags_for(session.id)\n end",
"def tags(per_page: 20, options: {})\n params = { limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/tasks/#{gid}/tags\", params: params, options: options)), type: Tag, client: client)\n end",
"def index # p \"TagsController.index: params=#{params.inspect}\"\n # p \"params['example_id']=#{params['example_id']}, params[:example_id]=#{params[:example_id]}\"\n if (params[:example_id])\n @tags = Tag.where(\"example_id=?\", params[:example_id])\n else\n @tags = Tag.all\n end\n\n p \"@tags=#{@tags.inspect}\"\n\n respond_to do |format|\n format.html {}\n format.json {render :json => @tags }\n end\n end",
"def index\n if params[:genre]\n\n @tvs = Tv.tagged_with(params[:genre])\n\n elsif params[:search]\n\n @tvs = Tv.search(params[:search])\n\n else\n\n @tvs = Tv.all\n\n end\n #@tvs = Tv.search(params[:search]).paginate(:page => params[:page]) #paginate search\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tvs }\n end\n end",
"def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Video.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Video.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end",
"def gettag()\n omnifocus.tags.get.each do |tagg|\n\t tagg.tags.get.each do |t|\n\t\t\t if t.name.get == \"Today\" \n\t\t\t\t return t\n\t\t\t end\n\t\t end \n\n end\n\n end",
"def top_tags(options={})\n get(:standard, {:method => \"track.getTopTags\"}.merge(options))\n end",
"def index\n @listing_tags = ListingTag.all\n end",
"def show_contact_tags(**params)\n get('contactTags', params)\n end",
"def get_tags_for_context(context)\n ActsAsTaggableOn::Tag.includes(:taggings)\n .where(\"taggings.context = '#{context}'\")\n .select(\"DISTINCT tags.*\")\n .map(&:name)\n end",
"def all_tags(source=nil)\n @tag_svc.get_all(source)\n end",
"def index\n authorize @ticket\n render :json => @ticket.tags\n end",
"def get\n\t\tformat = getFormat(params)\n\n\t\tquery_text =\"\nselect * from tags \nwhere tag_normalized like '#{cleanTag(params[:tag])}%'\"\n\n\t\tresults = Tag.find_by_sql(query_text)\n\n\t\ttags = results.inject([]) {|res, tag|\n\t\t\tres << \n\t\t\t\t{\n\t\t\t\t\t:tag_value => tag.tag_value, \n\t\t\t\t\t:tag_normalized => tag.tag_normalized, \n\t\t\t\t\t:id => tag.id}\n\t\t\t\t}\n\n\t\trender format.to_sym => tags\n\tend",
"def index\n return render_json_for_api(Tag.map) if params[:map] == \"true\" && api_call?\n @tags_with_counts = Tag.\n joins(:vulnerabilities).\n group(\"tags.id\").\n select(\"tags.name\",\n \"tags.shortname\",\n \"tags.color\",\n \"tags.icon\",\n \"tags.id\",\n \"tags.family\",\n 'count(*) AS num_vulns').\n having('count(*) > 1')\n\n @tags = Tag.order(name: :asc).\n select(\"\n *,\n substring(tags.description from 0 for 240) || '...' as short_desc\n \")\n @articleTags = ArticleTag.joins(:article).distinct(:article_id).select(:title, :blurb, :art)\n if @tags == nil\n flash[:error] = \"Error: Tag not found\"\n redirect_to controller: 'tags', :action => 'index'\n else\n render_json_for_api(@tags)\n end\n end",
"def index\n unless params[:tag].blank?\n @recipes = current_user.recipes.tagged_with(params[:tag]).order(\"created_at desc\").page(params[:page]).per(10)\n else\n @recipes = current_user.recipes.order(\"created_at desc\").page(params[:page]).per(10) \n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end",
"def index\n @profile_diet_tags = ProfileDietTag.all\n end",
"def new\n @server = Server.new\n 1.times { @server.tags.build }\n @tags = Tag.all\n @tags_selected = [] \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end",
"def retrieve_tags\n # noop\n end",
"def get_taxonomies(options = {})\n get \"/api/taxonomies\", options\n end",
"def tags(client)\n client.get(\"#{PATH}/tags\")\n end",
"def cloud\n tag_context = params[:context] # tag context\n target = params[:target] # tag context\n limit = params[:limit] # if there is a limit then we only report back on the limit number of tags and sort by most popular\n @tags = TagsService.tag_counts_on(SurveyRespondent, tag_context).sort { |x, y| x.name.downcase <=> y.name.downcase }\n \n if limit\n l = limit.to_i\n # We now have a collection of names and count, so sort based on count and limit\n @tags = @tags.sort { |x, y| y.count <=> x.count }\n @tags = @tags[0..(l -1)]\n end\n \n if target == 'selection'\n render 'selection', :layout => 'content'\n else \n render :layout => 'content'\n end\n end",
"def tags\n query = params[:q]\n if query[-1,1] == \" \"\n query = query.gsub(\" \", \"\")\n Tag.find_or_create_by_name(query)\n end\n\n #Do the search in memory for better performance\n\n @tags = ActsAsTaggableOn::Tag.all\n @tags = @tags.select { |v| v.name =~ /#{query}/i }\n respond_to do |format|\n format.json{ render :json => @tags.map(&:attributes) }\n end\n end",
"def index\n @tags = Tag.order(\"tagtext ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tags }\n end\n end",
"def index\n authorize! :read, Deal\n \n respond_to do |format|\n format.html\n format.json { render json: Deal.select2_options(params, @current_user) }\n end\n end",
"def get_tags( params )\n secure = !params.include?(:user)\n LastFM.requires_authentication if secure\n LastFM.post( \"track.getTags\", params, secure )\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def index\n @environmental_subtags = EnvironmentalSubtag.all\n end",
"def tags\n @data['tags']\n end",
"def tags\n @tags = User.tag_counts_on(:tags, :conditions => \"name LIKE '\" + (params[:query] || \"\") + \"%'\").limit(50).order('count desc')\n respond_to do |format|\n format.html # tags.html.erb\n format.json { render json: @tags }\n format.xml { render xml: @tags }\n end\n end",
"def index # This is what we'll need if we want our url/tags page to exist\n @tags = Tag.all\n end",
"def tecnicos_postulados\n coleccion = []\n self.request.each do |request|\n info = {}\n info[:id] = request.id\n info[:article] = request.article\n info[:servicio] = request.service.description\n info[:tecnicos] = request.proposal\n coleccion.append(info)\n end\n coleccion\n end",
"def tags\n if request[:name] then\n tags = UserTag.where(:name => request[:name]).select('system_user_id')\n @users = SystemUser.where(['id IN (?)', tags.map {|x| x.system_user_id}]) # .paginate(:page => request[:page]) # COUNT seems broken in will_paginate\n else\n @tags = UserTag.select('DISTINCT name AS name').order('name ASC') #.paginate(:page => request[:page]) # COUNT doesn't seem to work well for now.\n end\n end",
"def get_tags(subject)\n act = SubjectViewAction.new(self)\n act.get_tags(subject)\n end",
"def get_tags(tenant_id, entity_type_id,entity_id)\n return @instance.get_tags(tenant_id, entity_type_id,entity_id)\n end",
"def set_tagging\n @tagging = Tagging.find(params[:id])\n end",
"def set_tagging\n @tagging = Tagging.find(params[:id])\n end",
"def all_technologies_list_for_type\n case controller_name\n when \"resources\"\n @model = \"Resource\"\n when \"projects\"\n @model = \"Project\"\n when \"collaborations\"\n @model = \"Collaboration\"\n when \"jobs\"\n @model = \"Job\"\n end\n #need local variable for squeel to work\n model = @model\n ActsAsTaggableOn::Tagging.includes(:tag).where{(taggable_type == model) & (context == 'technologies')}.map{|tagging| tagging.tag.name}.uniq.sort_by!(&:downcase)\n end",
"def index\n @tags = Tag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tags }\n end\n end",
"def filtering_by_tags?\n selected_tags\n end"
] |
[
"0.6625833",
"0.6104351",
"0.58236516",
"0.5726449",
"0.5707796",
"0.5703381",
"0.5579196",
"0.5537875",
"0.55160606",
"0.54729",
"0.5452605",
"0.5436956",
"0.5436956",
"0.54151636",
"0.54143935",
"0.5405076",
"0.5376123",
"0.53718185",
"0.5320589",
"0.52716565",
"0.526671",
"0.52542657",
"0.52503526",
"0.5226435",
"0.5226126",
"0.52189577",
"0.5218446",
"0.51887405",
"0.51736206",
"0.516114",
"0.5159461",
"0.51553005",
"0.5154383",
"0.51483625",
"0.51377726",
"0.51327634",
"0.5132311",
"0.51318055",
"0.5119877",
"0.5114455",
"0.51114464",
"0.50965714",
"0.50866646",
"0.50788933",
"0.5077745",
"0.5060689",
"0.5054059",
"0.50525236",
"0.5044024",
"0.50338",
"0.5033103",
"0.5033097",
"0.5032845",
"0.50265324",
"0.5021938",
"0.50177336",
"0.5012573",
"0.49945065",
"0.49827147",
"0.4972125",
"0.49627307",
"0.49558488",
"0.4954082",
"0.49522656",
"0.49211213",
"0.49179763",
"0.49152845",
"0.4911311",
"0.4907478",
"0.49064836",
"0.49046475",
"0.49017498",
"0.4899037",
"0.48897985",
"0.48870844",
"0.48856866",
"0.48844233",
"0.48830605",
"0.48791438",
"0.48761123",
"0.48748347",
"0.48743042",
"0.4868797",
"0.4868797",
"0.4868797",
"0.4868797",
"0.4868797",
"0.48666757",
"0.48637632",
"0.4859784",
"0.4849108",
"0.48458475",
"0.48424673",
"0.48399147",
"0.4834543",
"0.4832445",
"0.4832445",
"0.48312342",
"0.48306727",
"0.4815625"
] |
0.67894167
|
0
|
GET /tagging_select_tos/1 GET /tagging_select_tos/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @tagging_select_tos = TaggingSelectTo.all\n if @tagging_select_tos.empty?\n TaggingSelectTo.create(name: 'Sajjad-Murtaza-Testing-Taggable')\n end\n end",
"def create\n @tagging_select_to = TaggingSelectTo.new(tagging_select_to_params)\n\n respond_to do |format|\n if @tagging_select_to.save\n format.html { redirect_to tagging_select_tos_path }\n format.json { render :show, status: :created, location: @tagging_select_to }\n else\n format.html { render :new }\n format.json { render json: @tagging_select_to.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tagging_select_to\n @tagging_select_to = TaggingSelectTo.find(params[:id])\n end",
"def tagging_select_to_params\n params.require(:tagging_select_to).permit(:name)\n end",
"def destroy\n @tagging_select_to.destroy\n respond_to do |format|\n format.html { redirect_to tagging_select_tos_url, notice: 'Tagging select to was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end",
"def get_tag_list\n # body = {\n # cmd: \"get_tag_list\"\n # }\n\n end",
"def tags\n get('tags')\n end",
"def get_tags_for_select() tag_ids.inject([]) { |l, tag_id| l << [get_tag_from_id(tag_id).label, tag_id] } end",
"def index\n @taggings = Tagging.all\n end",
"def update\n respond_to do |format|\n if @tagging_select_to.update(tagging_select_to_params)\n format.html { redirect_to @tagging_select_to, notice: 'Tagging select to was successfully updated.' }\n format.json { render :show, status: :ok, location: @tagging_select_to }\n else\n format.html { render :edit }\n format.json { render json: @tagging_select_to.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tags(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Tags\", params: params)\n end",
"def gettags\n @ideaid = params[:ideaid]\n @ideatagsthen = IdeasTags.find(:all, :conditions => {:idea_id => @ideaid})\n @ideatags = Tag.where(:id => @ideatagsthen.map(&:tag_id))\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def temas\n @tags = Tag.find(:all, Topico.find_options_for_tag_counts(:order => \"name ASC\"))\n end",
"def index\n @range = params[:q][:range_selector_cont] if params[:q]\n params[:q] = Tagging.fix_params(params[:q]) if params[:q]\n @q = Tagging.page(params[:page]).search(params[:q])\n @taggings = @q.result\n if params[:q].present? && params[:q][:tag_tag_group_id_eq].present?\n @tags = TagGroup.where(id: params[:q][:tag_tag_group_id_eq]).first.tags\n @form = SimpleForm::FormBuilder.new(:q, @q, view_context, {}, proc{})\n end\n @search_params = params[:q] if params[:q].present? && params[:q][:tag_tag_group_id_eq].present?\n end",
"def tags\n taxonomies.all :conditions => { :classification => :tag }\n end",
"def tags\n @tags_with_count = Asset.tag_counts_on(:tags)\n \n @tags = @tags_with_count.map{|tag_hash| tag_hash = tag_hash.name }\n \n respond_to do |format|\n format.html\n format.json { render :json => @tags }\n end\n end",
"def index\n tags = Tag.all\n render json: tags, status: :ok\n end",
"def selected_tags\n @selected_tags\n end",
"def show\n get_status\n @tag = Tag.find(params[:id])\n taggings = Tagging.where(:tag_id => params[:id])\n\n post_ids = []\n taggings.each do |tagging|\n post_ids << tagging.post_id\n end\n post_ids.compact!\n\n @posts = Post.where(:id => post_ids).order('created_at DESC').page(params[:page]).per(5)\n @labels = [\"<span class=\\\"label\\\">\",\"<span class=\\\"label label-success\\\">\",\"<span class=\\\"label label-warning\\\">\",\"<span class=\\\"label label-important\\\">\",\"<span class=\\\"label label-info\\\">\"]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tag }\n end\n end",
"def activities_tags\n\t\ttags = ActivityTag.tags_for_teacher(@current_teacher_user.id)\n\n\t\trender json: {status: \"success\" , tags: tags}\n\tend",
"def tag(t)\n tag = get url: \"tags/#{generate_slug(t)}\", filter: @everything_filter\n tag.tag if tag\n end",
"def index\n @tag_types = TagType.all\n end",
"def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Node.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Node.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end",
"def tags\n klass = Object.const_get(\"Concepts\").const_get(params[:tag_class])\n results = klass.search_for_label_starting_with(params[:term]).map(&:label)\n render :json => results.uniq.sort\n end",
"def tags(options={})\n self.class.parse_tags(request(singular(user_id) + \"/tags\", options))\n end",
"def new\n @server = Server.new\n 1.times { @server.tags.build }\n @tags = Tag.all\n @tags_selected = [] \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end",
"def index\n @has_project_tags = HasProjectTag.all\n render json: @has_project_tags\n end",
"def index # p \"TagsController.index: params=#{params.inspect}\"\n # p \"params['example_id']=#{params['example_id']}, params[:example_id]=#{params[:example_id]}\"\n if (params[:example_id])\n @tags = Tag.where(\"example_id=?\", params[:example_id])\n else\n @tags = Tag.all\n end\n\n p \"@tags=#{@tags.inspect}\"\n\n respond_to do |format|\n format.html {}\n format.json {render :json => @tags }\n end\n end",
"def index\n if params[:tag].present? \n @stipes = Stipe.tagged_with(params[:tag])\nelse\n@stipes = Stipe.all.order(\"created_at DESC\")\nend\nend",
"def all\n response= handle_errors{ self.class.get('/get')}\n response[\"tags\"][\"tag\"].collect do |tag| \n t= Rubycious::Tag.new(tag)\n end\n end",
"def gettag()\n omnifocus.tags.get.each do |tagg|\n\t tagg.tags.get.each do |t|\n\t\t\t if t.name.get == \"Today\" \n\t\t\t\t return t\n\t\t\t end\n\t\t end \n\n end\n\n end",
"def tasks_by_tags\n Task.tagged_with(selected_tags, {\n :company_id => @company.id,\n :project_ids => @project_ids, \n :filter_hidden => session[:filter_hidden], \n :filter_user => session[:filter_user], \n :filter_milestone => session[:filter_milestone], \n :filter_status => session[:filter_status], \n :filter_customer => session[:filter_customer] \n })\n end",
"def taglist\n @tags = Note.tag_counts.map {|tag| tag.name}\n\n respond_to do |format|\n format.json { render json: @tags }\n end\n end",
"def alltags\n tag_context = params[:context] # tag context\n @tags = TagsService.tag_counts_on(SurveyRespondent, tag_context)\n \n respond_to do |format|\n format.xml\n end\n end",
"def tags_from(options={})\n get(get_tags_uri, { :site_id => options[:blog]})\n end",
"def selected_tags=(value)\n @selected_tags = value\n end",
"def selected_tags\n if @params[:tag] && @params[:tag].strip.length > 0\n @selected_tags ||= @params[:tag].downcase.split(',').collect{ |t| t.strip }\n end\n\n return @selected_tags\n end",
"def selected_tags\n if @params[:tag] && @params[:tag].strip.length > 0\n @selected_tags ||= @params[:tag].downcase.split(',').collect{ |t| t.strip }\n end\n\n return @selected_tags\n end",
"def tags\n response[\"tags\"]\n end",
"def day_select_option_tags\n options_for_select DAYS.map.with_index.to_a\n end",
"def get_tag_list\n args = receive_should_validate?\n get('redtube.Tags.getTagList', {}, [], args[:should_validate])\n end",
"def set_tagging\n @tagging = Tagging.find(params[:id])\n end",
"def set_tagging\n @tagging = Tagging.find(params[:id])\n end",
"def where(options = {})\n _, _, root = @client.get(\"/tags\", options)\n\n root[:items].map{ |item| Tag.new(item[:data]) }\n end",
"def _tagging\n t_tagging[:tag_id].in(self.tags) unless self.tags.length == 0\n end",
"def select_tags()\n return get_db_as_hash().execute(\"SELECT * FROM tags\")\n end",
"def classroom_tags\n\n\t\t@classroom = Classroom.where({teacher_user_id: @current_teacher_user.id, id: params[:classroom_id]}).first\n\n\t\trender json: @classroom.tags(true, false).to_json\n\t\t\n\tend",
"def index\n return render_json_for_api(Tag.map) if params[:map] == \"true\" && api_call?\n @tags_with_counts = Tag.\n joins(:vulnerabilities).\n group(\"tags.id\").\n select(\"tags.name\",\n \"tags.shortname\",\n \"tags.color\",\n \"tags.icon\",\n \"tags.id\",\n \"tags.family\",\n 'count(*) AS num_vulns').\n having('count(*) > 1')\n\n @tags = Tag.order(name: :asc).\n select(\"\n *,\n substring(tags.description from 0 for 240) || '...' as short_desc\n \")\n @articleTags = ArticleTag.joins(:article).distinct(:article_id).select(:title, :blurb, :art)\n if @tags == nil\n flash[:error] = \"Error: Tag not found\"\n redirect_to controller: 'tags', :action => 'index'\n else\n render_json_for_api(@tags)\n end\n end",
"def index\n authorize @organization\n render :json => @organization.tags\n end",
"def tags(url, options={})\n response = handle_response(self.class.get(\"/tags.json\", :query => {:url => url}.merge(options)))\n Topsy::Page.new(response,Topsy::Tag)\n end",
"def show\n @tagging = Tagging.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tagging }\n end\n end",
"def tag\n @tag = params[:id]\n @personas = Persona.find_tagged_with(@tag,:order=>\"apepat,apemat,nombre\")\n @familias = Familia.find_tagged_with(@tag) \n @instituciones = Institucion.find_tagged_with(@tag,:order=>\"nombre\")\n @comentarios = Comentario.find_tagged_with(@tag,:order=>\"created_at desc\")\n end",
"def top_tags()\n get(:standard, {:method => \"tag.getTopTags\"})\n end",
"def tags\n get.tagGuids\n end",
"def show_my_tags\n tags = Tag.where('customer_id = ? AND active = ?', current_customer.id, true)\n\n if tags.nil?\n return_error_infos(400, 'No tags found', 'NoTagsFound', nil)\n else\n json_tags = []\n\n tags.each { |tag| json_tags << create_tag_infos(tag, nil) }\n\n render :status => 200, :json => { :tags => json_tags }\n end\n end",
"def index\n if params[:genre]\n\n @tvs = Tv.tagged_with(params[:genre])\n\n elsif params[:search]\n\n @tvs = Tv.search(params[:search])\n\n else\n\n @tvs = Tv.all\n\n end\n #@tvs = Tv.search(params[:search]).paginate(:page => params[:page]) #paginate search\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tvs }\n end\n end",
"def index\n unless params[:tag].blank?\n @recipes = current_user.recipes.tagged_with(params[:tag]).order(\"created_at desc\").page(params[:page]).per(10)\n else\n @recipes = current_user.recipes.order(\"created_at desc\").page(params[:page]).per(10) \n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end",
"def index\n @tags = Tag.order(\"tagtext ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tags }\n end\n end",
"def tag(id, params = {})\n get \"tags/#{id}\", {query: params}\n end",
"def index\n authorize! :read, Deal\n \n respond_to do |format|\n format.html\n format.json { render json: Deal.select2_options(params, @current_user) }\n end\n end",
"def tags\n return false if params[:q] and params[:q].size < 3\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n respond_to do |format|\n format.json { render :json => @tags.map{|t| {:id => t.name, :name => t.name }}}\n end\n end",
"def tags(per_page: 20, options: {})\n params = { limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/tasks/#{gid}/tags\", params: params, options: options)), type: Tag, client: client)\n end",
"def tags\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n #@tags = Video.tag_counts(:limit => 50, :order => \"count desc\")\n #@tags = Video.tag_counts_on(:tag, :limit => 50, :order => \"count desc\")\n @out = @tags.map{|b| {:id => b.id, :name => b.name }}\n \n\n \n respond_to do |format|\n format.json { render :json => @out }\n end\n\n end",
"def index\n if params[:q].nil? or params[:q]==\"\"\n @to_dos = current_user.to_dos\n else\n @to_dos = current_user.to_dos.search(params[:q]).records\n end\n @tags = @to_dos.tag_counts.order(taggings_count: :desc).first(40).sort_by {|t| t.name}\n\n if params[:tag]\n @tag = params[:tag]\n @to_dos = @to_dos.tagged_with(params[:tag])\n elsif params[:note_id]\n @to_dos = @to_dos.where(note_id: params[:note_id].to_i)\n end\n ## TODO: Manage display_all param: all todos: only open, todos of a note: all\n if not(params[:display_all])\n @to_dos = @to_dos.where(displayed: \"true\").order(deadline: :asc)\n end\n @to_dos = @to_dos.order(deadline: :asc).page(params[:page]).per(5)\n end",
"def get\n\t\tformat = getFormat(params)\n\n\t\tquery_text =\"\nselect * from tags \nwhere tag_normalized like '#{cleanTag(params[:tag])}%'\"\n\n\t\tresults = Tag.find_by_sql(query_text)\n\n\t\ttags = results.inject([]) {|res, tag|\n\t\t\tres << \n\t\t\t\t{\n\t\t\t\t\t:tag_value => tag.tag_value, \n\t\t\t\t\t:tag_normalized => tag.tag_normalized, \n\t\t\t\t\t:id => tag.id}\n\t\t\t\t}\n\n\t\trender format.to_sym => tags\n\tend",
"def index\n @tags = Tag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tags }\n end\n end",
"def index\n @profile_diet_tags = ProfileDietTag.all\n end",
"def tag\n @favors = Favor.tagged_with(params[:tag], :order => @order)\n @tag = params[:tag]\n\n respond_to do |format|\n format.html # tag.html.erb\n format.json { render json: @favors }\n end\n end",
"def index\n @listing_tags = ListingTag.all\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 authorize @ticket\n render :json => @ticket.tags\n end",
"def index\n @promotion_tags = PromotionTag.all\n end",
"def tags(client)\n client.get(\"#{PATH}/tags\")\n end",
"def search_tags\n\t\t# Searching for patients as per user entered term\n\t\tquestion_tags = Question.all_tags.select{|p| p=~/^#{params[:term]}/i }.uniq\n\t\tif question_tags.present?\n\t \trender :json=> {success: true, \"Tags\" => question_tags.as_json }\n\t # render json: { success: true, response: @questions.map{ |f| QuestionSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Tags are not present\" },:status=> 203\n\t end\n\tend",
"def top_tags(options={})\n get(:standard, {:method => \"track.getTopTags\"}.merge(options))\n end",
"def tag\n require_admin_permissions\n @model = 'tag'\n @key = 'tag'\n @values = Tag.all.pluck(:tag)\n render 'tags'\n end",
"def show\n tagging = Tagging.find(params[:id])\n tag = tagging.tag\n render json: {status: 'SUCCESS', message:'Loaded tagging', data:tagging, tag:tag},status: :ok\n end",
"def all_tags context = :tags\n ActsAsTaggableOn::Tagging.where(context: context).select(:tag_id).distinct.includes(:tag).map(&:tag)\n end",
"def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end",
"def index\n @posttags = Posttag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posttags }\n end\n end",
"def show\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tags_of_novel }\n end\n end",
"def index\n @has_tags = HasTag.all\n end",
"def index\n tags = Array.wrap params.permit(:tags)[:tags]\n @clips = @allclips = Clip.where(session_id: session.id)\n @clips = @allclips.tagged_with(tags, any: true) if tags.any?\n @available_tags = Clip.available_tags_for(session.id)\n end",
"def available_tags\n path = \"/product-view/products/search/find-available-tags\"\n\n response, status = BeyondApi::Request.get(@session,\n path)\n\n handle_response(response, status)\n end",
"def tags\n @data['tags']\n end",
"def index\n @all = Tag.all\n render json: @all.collect{|tag| tag.strip}\n end",
"def index\n @tagged_items = TaggedItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tagged_items }\n end\n end",
"def tags\n @tags = User.tag_counts_on(:tags, :conditions => \"name LIKE '\" + (params[:query] || \"\") + \"%'\").limit(50).order('count desc')\n respond_to do |format|\n format.html # tags.html.erb\n format.json { render json: @tags }\n format.xml { render xml: @tags }\n end\n end",
"def cloud\n tag_context = params[:context] # tag context\n target = params[:target] # tag context\n limit = params[:limit] # if there is a limit then we only report back on the limit number of tags and sort by most popular\n @tags = TagsService.tag_counts_on(SurveyRespondent, tag_context).sort { |x, y| x.name.downcase <=> y.name.downcase }\n \n if limit\n l = limit.to_i\n # We now have a collection of names and count, so sort based on count and limit\n @tags = @tags.sort { |x, y| y.count <=> x.count }\n @tags = @tags[0..(l -1)]\n end\n \n if target == 'selection'\n render 'selection', :layout => 'content'\n else \n render :layout => 'content'\n end\n end",
"def index\n @technologies = Technology.all(:conditions => 'deleted_at IS NULL')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @technologies }\n end\n end",
"def select_tag(name, option_tags = T.unsafe(nil), options = T.unsafe(nil)); end",
"def new\n @tagging = Tagging.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tagging }\n end\n end",
"def tags\n return head :unauthorized unless current_user\n @tags = current_user.owned_tags.where(\"name like ?\", \"%#{params[:tag]}%\").\n page(params[:page]).per(20)\n if @tags.empty?\n @tags = [current_user.owned_tags.new(name: I18n.t('record.tag_list.no_tags'))]\n end\n respond_with(@tags)\n end",
"def index\n @tags = @tags.uniq\n respond_with(@tags)\n end",
"def retrieve_tags\n # noop\n end",
"def index\n @tagihans = Tagihan.all\n @tagihans = @tagihans.select { |x| x.user_id == params[:user_id].to_i }\n render json: { items: @tagihans }\n end",
"def show_contact_tags(**params)\n get('contactTags', params)\n end",
"def get_tags(tenant_id, entity_type_id,entity_id)\n return @instance.get_tags(tenant_id, entity_type_id,entity_id)\n end",
"def profile_diet_tag_params\n params[:profile_diet_tag]\n end",
"def add_new_tag\n puts \"******* add_new_tag *******\"\n puts \" ** params: #{params.inspect}\"\n\n @post_id = params[:post_id]\n\n # == create brand new tag; add to Tags\n if params[:new_tag] != \"new\"\n\n # == check if tag already exists\n check_tag = Tag.where(tag_name: params[:new_tag])\n puts \" ** check_tag.length: #{check_tag.length.inspect}\"\n\n # == create new tag if not existing and assign to post\n if check_tag.length == 0\n @tag = Tag.create(tag_name: params[:new_tag], tag_rank: 0)\n @post_tag = PostTag.create(post_id: params[:post_id], tag_id: @tag[:id])\n puts \" ** NEW TAG @post_tag: #{@post_tag.inspect}\"\n end\n end\n\n # == assign existing tag if selected from select box (not \"ng\")\n if params[:tag_id] != \"ng\"\n\n # == check if tag already assigned to post\n check_tag = PostTag.where(post_id: params[:post_id], tag_id: params[:tag_id])\n puts \" ** check_tag.length: #{check_tag.length.inspect}\"\n\n if check_tag.length == 0\n @post_tag = PostTag.create(post_id: params[:post_id], tag_id: params[:tag_id])\n puts \" ** EXISTING TAG @post_tag: #{@post_tag.inspect}\"\n end\n end\n @post_tags = PostTag.where(post_id: params[:post_id])\n @post_tag_ids = @post_tags.map{|pt| pt.tag_id }\n @post_no_tags = Tag.where(\"id NOT IN (?)\", @post_tag_ids)\n @tags = Tag.where(id: @post_tag_ids)\n render json: { tags: @tags, post_no_tags: @post_no_tags, post_id: @post_id}\n end"
] |
[
"0.6744151",
"0.6728961",
"0.6216666",
"0.58082235",
"0.5748116",
"0.56713325",
"0.5637615",
"0.5585872",
"0.5487587",
"0.5448449",
"0.540906",
"0.53765637",
"0.53365964",
"0.5290892",
"0.52786607",
"0.5270235",
"0.5267067",
"0.52473235",
"0.522067",
"0.5196898",
"0.5195033",
"0.5190667",
"0.5187349",
"0.51851386",
"0.51737416",
"0.51734084",
"0.51718795",
"0.51674354",
"0.5159692",
"0.51449555",
"0.5136282",
"0.5122615",
"0.51212585",
"0.5102911",
"0.5091934",
"0.5086678",
"0.5075707",
"0.5073815",
"0.5073815",
"0.5070177",
"0.506335",
"0.5056631",
"0.5048452",
"0.5048452",
"0.50470257",
"0.5041996",
"0.5030227",
"0.5024559",
"0.50094825",
"0.50035274",
"0.5003478",
"0.50015664",
"0.49951205",
"0.4987329",
"0.4979922",
"0.4976594",
"0.49757344",
"0.497389",
"0.49558866",
"0.49553415",
"0.49525997",
"0.4949826",
"0.49470067",
"0.4937996",
"0.49273527",
"0.4927179",
"0.49260297",
"0.49220347",
"0.49218988",
"0.4917394",
"0.4912437",
"0.4909086",
"0.49003255",
"0.48958528",
"0.48941386",
"0.4881581",
"0.48815158",
"0.48810324",
"0.48742238",
"0.48676693",
"0.48591456",
"0.4856427",
"0.4853392",
"0.48523042",
"0.48488924",
"0.4844095",
"0.484319",
"0.48406404",
"0.4834866",
"0.4830649",
"0.48301026",
"0.482646",
"0.48251006",
"0.48228207",
"0.4812507",
"0.48075393",
"0.4807102",
"0.48028576",
"0.48016745",
"0.48013672",
"0.48013124"
] |
0.0
|
-1
|
POST /tagging_select_tos POST /tagging_select_tos.json
|
def create
@tagging_select_to = TaggingSelectTo.new(tagging_select_to_params)
respond_to do |format|
if @tagging_select_to.save
format.html { redirect_to tagging_select_tos_path }
format.json { render :show, status: :created, location: @tagging_select_to }
else
format.html { render :new }
format.json { render json: @tagging_select_to.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @tagging_select_tos = TaggingSelectTo.all\n if @tagging_select_tos.empty?\n TaggingSelectTo.create(name: 'Sajjad-Murtaza-Testing-Taggable')\n end\n end",
"def tagging_select_to_params\n params.require(:tagging_select_to).permit(:name)\n end",
"def set_tagging_select_to\n @tagging_select_to = TaggingSelectTo.find(params[:id])\n end",
"def destroy\n @tagging_select_to.destroy\n respond_to do |format|\n format.html { redirect_to tagging_select_tos_url, notice: 'Tagging select to was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def selected_tags=(value)\n @selected_tags = value\n end",
"def update\n respond_to do |format|\n if @tagging_select_to.update(tagging_select_to_params)\n format.html { redirect_to @tagging_select_to, notice: 'Tagging select to was successfully updated.' }\n format.json { render :show, status: :ok, location: @tagging_select_to }\n else\n format.html { render :edit }\n format.json { render json: @tagging_select_to.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_tags_for_select() tag_ids.inject([]) { |l, tag_id| l << [get_tag_from_id(tag_id).label, tag_id] } end",
"def add_new_tag\n puts \"******* add_new_tag *******\"\n puts \" ** params: #{params.inspect}\"\n\n @post_id = params[:post_id]\n\n # == create brand new tag; add to Tags\n if params[:new_tag] != \"new\"\n\n # == check if tag already exists\n check_tag = Tag.where(tag_name: params[:new_tag])\n puts \" ** check_tag.length: #{check_tag.length.inspect}\"\n\n # == create new tag if not existing and assign to post\n if check_tag.length == 0\n @tag = Tag.create(tag_name: params[:new_tag], tag_rank: 0)\n @post_tag = PostTag.create(post_id: params[:post_id], tag_id: @tag[:id])\n puts \" ** NEW TAG @post_tag: #{@post_tag.inspect}\"\n end\n end\n\n # == assign existing tag if selected from select box (not \"ng\")\n if params[:tag_id] != \"ng\"\n\n # == check if tag already assigned to post\n check_tag = PostTag.where(post_id: params[:post_id], tag_id: params[:tag_id])\n puts \" ** check_tag.length: #{check_tag.length.inspect}\"\n\n if check_tag.length == 0\n @post_tag = PostTag.create(post_id: params[:post_id], tag_id: params[:tag_id])\n puts \" ** EXISTING TAG @post_tag: #{@post_tag.inspect}\"\n end\n end\n @post_tags = PostTag.where(post_id: params[:post_id])\n @post_tag_ids = @post_tags.map{|pt| pt.tag_id }\n @post_no_tags = Tag.where(\"id NOT IN (?)\", @post_tag_ids)\n @tags = Tag.where(id: @post_tag_ids)\n render json: { tags: @tags, post_no_tags: @post_no_tags, post_id: @post_id}\n end",
"def selected_tags=(data)\n self.tags.clear\n data.split('tag').each { |id| self.tags << Tag.find(id) if id.length > 0 }\n end",
"def tagging_params\n params.require(:tagging).permit(:id, :tag_group_id, :tag_id, :person_id, :_destroy, :start_date, :end_date, :comments)\n end",
"def selected_tags\n if @params[:tag] && @params[:tag].strip.length > 0\n @selected_tags ||= @params[:tag].downcase.split(',').collect{ |t| t.strip }\n end\n\n return @selected_tags\n end",
"def selected_tags\n if @params[:tag] && @params[:tag].strip.length > 0\n @selected_tags ||= @params[:tag].downcase.split(',').collect{ |t| t.strip }\n end\n\n return @selected_tags\n end",
"def tagging_params\n params.require(:tagging).permit(:campsite_id, :tag_id, :user_id)\n end",
"def tag!(params = {})\n self.post params, edge: :tags\n end",
"def create\n @vtodo = Vtodo.new\n @vtodo.summary = params[:vtodo][:summary]\n @vtodo.description = params[:vtodo][:description]\n @vtodo.status = ''\n list = params[:vtodo][:tags].split(\",\").each {|t| t.strip!}\n list.each do |item|\n tag = Tag.new\n tag = Tag.find_or_create_by_subject(item)\n tag.subject = item\n #tag.save \n @vtodo.tags << tag\n end\n\n respond_to do |format|\n if @vtodo.save\n flash[:notice] = 'Vtodo was successfully created.'\n format.html { redirect_to(@vtodo) }\n format.xml { render :xml => @vtodo, :status => :created, :location => @vtodo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vtodo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_tag\n\n wait = Selenium::WebDriver::Wait.new(:timeout => 30) # seconds\n wait.until { @driver.find_element(:id, \"tag-chooser\") }\n\n # Input \"Tiger Woods\" into search module\n @driver.find_element(:id, \"tag-chooser\").send_keys(\"tiger woods\")\n\n # Wait for Tiger Woods to appear in drop - down, then select it\n wait = Selenium::WebDriver::Wait.new(:timeout => 30) # seconds\n wait.until { @driver.find_element(:class, \"tag-chooser-checkbox\") }\n @driver.find_element(:link_text, \"Tiger Woods\").click\n\n # Select article type to be \"Breaking News\"\n @driver.find_element(:id, 'breaking_news_tag').click\n\n wait = Selenium::WebDriver::Wait.new(:timeout => 30) # seconds\n wait.until { @driver.find_element(:link_text, \"Golf\") }\n\n # Select league to be 'Golf'\n @driver.find_element(:link_text, 'Golf').click\n end",
"def tasks_by_tags\n Task.tagged_with(selected_tags, {\n :company_id => @company.id,\n :project_ids => @project_ids, \n :filter_hidden => session[:filter_hidden], \n :filter_user => session[:filter_user], \n :filter_milestone => session[:filter_milestone], \n :filter_status => session[:filter_status], \n :filter_customer => session[:filter_customer] \n })\n end",
"def new\n @server = Server.new\n 1.times { @server.tags.build }\n @tags = Tag.all\n @tags_selected = [] \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end",
"def complete_tagging_task\n @page.find(input_elements[:change_tags_button]).click\n end",
"def tag_params\n params.require(:tag).permit(:name, tag_task_id: [])\n end",
"def day_select_option_tags\n options_for_select DAYS.map.with_index.to_a\n end",
"def creation_tag_params\n params.require(:creation_tag).permit(:creation_id, :tag_id)\n end",
"def create\n #...\n params[:cat].permit(...:tag_ids: []) #allow tag_ids and expect it to be an Array\n end",
"def create\n @selection = Selection.new(params[:selection])\n @selection.user_id = session[:user_id]\n \n respond_to do |format|\n if @selection.save\n\n @bottles_to_add = params[\"bottles\"];\n if (@bottles_to_add)\n @bottles_to_add.each do |bottle_id|\n @selection.add_bottle(Bottle.find(bottle_id))\n end\n end\n\n format.html { redirect_to @selection, notice: 'Selection was successfully created.' }\n format.json { render json: @selection, status: :created, location: @selection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @selection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def select_tag(name, option_tags = T.unsafe(nil), options = T.unsafe(nil)); end",
"def create\n @tags_of_novel = TagsOfNovel.new(params[:tags_of_novel])\n\n respond_to do |format|\n if @tags_of_novel.save\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully created.' }\n format.json { render json: @tags_of_novel, status: :created, location: @tags_of_novel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:tag_names].split(',').each do |name|\n @tag = Tag.find_or_create_by_name name.strip\n @tagging = Tagging.new(params[:tagging])\n @tagging.tag = @tag\n @tags_saved = @tagging.save\n end\n \n respond_to do |format|\n if @tags_saved\n format.html { redirect_to @tagging.taggable, notice: 'Tagged.' }\n format.json { render json: @tagging, status: :created, location: @tagging }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tagging.errors, status: :unprocessable_entity }\n end\n end\n end",
"def door_tag_params\n params.require(:door_tag).permit(:tag)\n end",
"def temas\n @tags = Tag.find(:all, Topico.find_options_for_tag_counts(:order => \"name ASC\"))\n end",
"def build_select(type, select_options_as_html); end",
"def topic_tag_form\n return nil if ticket_tag_collection.blank?\n simple_form_for @topic, url: admin_update_topic_tags_path(id: @topic.id, status: params[:status]), remote: true, html: { class: 'form-inline tag-form' } do |f|\n content_tag :div, class: 'row' do\n content_tag :div, class: 'col-md-8' do\n f.input :tag_list, collection: ticket_tag_collection, \n as: :select, include_blank: false, label: false,\n input_html: { multiple: true, class: '', placeholder: 'click to add tags...' },\n # wrapper_html: { style: 'width: 0' }, \n data: { 'none-selected-text': t('tag_with', default: 'Tag Ticket'), 'live-search': false, 'width': '150px', dropdownAlignRight: false },\n style: 'width: 280px;'\n \n end\n end\n end\n end",
"def tag_params\n params.require(:tag).permit(:name, :tag_type_id)\n end",
"def tag_params\n params.require(:tag).permit(:name, :organization_id)\n end",
"def envia_taxones_seleccionados\n end",
"def tagihan_params\n params.require(:tagihan).permit(:jumlah, :user_id, :status)\n end",
"def tag_params\n params.require(:tag).permit(:name, :tag_type)\n end",
"def selected_tags\n @selected_tags\n end",
"def tag_params\r\n params.require(:tag).permit(:tag, :task_id)\r\n end",
"def create\n params[:tag][:tag_set_id] ||= params[:tag_set_id]\n @tag = Tag.create(params[:tag])\n respond_to do |format|\n format.js\n end\n end",
"def promotion_tag_params\n params.require(:promotion_tag).permit(:promotion_id, :tag_id)\n end",
"def post_params\n params.require(:post).permit(:body, {tag_ids: []}, {tag_list: []})\n end",
"def templates_select_tag\r\n templates = MailTasks::Template.find( :all, :order => \"name\" )\r\n template_options = templates.collect{ |template| [template.name, template.id] }.unshift( ['-- Pre-set templates --', nil] )\r\n select :tasks, :template_id, template_options\r\n end",
"def task_tag_params\n params.require(:task_tag).permit(:title, :description, :requires_action, :only_admin_can_apply, :default_apply, :color, :mutex_ids => [])\n end",
"def tecnicos_postulados\n coleccion = []\n self.request.each do |request|\n info = {}\n info[:id] = request.id\n info[:article] = request.article\n info[:servicio] = request.service.description\n info[:tecnicos] = request.proposal\n coleccion.append(info)\n end\n coleccion\n end",
"def create\n @tag_type_group = TagTypeGroup.new(tag_type_group_params)\n \n if @tag_type_group.save\n @tag_types = TagType.includes(:tag_type_group).all.group_by(&:tag_type_group)\n else\n render :action => 'new'\n end\n end",
"def post_tag_params\n params.require(:post_tag).permit(:post_id, :tag)\n end",
"def create\n @environmental_subtag = EnvironmentalSubtag.new(environmental_subtag_params)\n\n respond_to do |format|\n if @environmental_subtag.save\n format.html { redirect_to @environmental_subtag, notice: 'Environmental subtag was successfully created.' }\n format.json { render :show, status: :created, location: @environmental_subtag }\n else\n format.html { render :new }\n format.json { render json: @environmental_subtag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_tags\n\tend",
"def check_box_options\n [:tag_ids, Tag.order(:name), :id, :name]\n end",
"def _tagging\n t_tagging[:tag_id].in(self.tags) unless self.tags.length == 0\n end",
"def timer_tag_params\n params.require(:timer_tag).permit(:category_record_id, :tag_id, :user_id)\n end",
"def environmental_subtag_params\n params.require(:environmental_subtag).permit(:name, :environmental_tag_id)\n end",
"def tag_params\n params.fetch(:tag, {}).permit(:name, tag_ids: [])\n end",
"def create\n @post = Post.new(params[:post])\n\n if params['tag_field'] != nil\n tags_array = params['tag_field'].split(\",\")\n tags_array.each do |tag|\n @post.tags << Tag.find_or_create_by_etiqueta_and_post_id(tag.strip, @post.id)\n end\n end\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def lcb_financing_target_tag_params\n params.require(:lcb_financing_target_tag).permit(:tag, :financing_target_id, :owner_id, :create_uid, :write_uid, :id)\n end",
"def create\n params[:organization][:tag_ids] ||= []\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n flash[:notice] = t(\"organization.success_created\")\n format.html { redirect_to(@organization) }\n else\n @tag = Tag.new\n format.html { render :action => \"new\" }\n end\n end\n end",
"def tag_selected?\n # 入力されたタグ文字列を検証\n if self.added_tags.to_s.scan(/\\[.*?\\]/).blank? &&\n self.deleted_at.blank? &&\n self.tags.blank? &&\n self.selected_tags.blank?\n errors.add(:selected_tags, I18n.t('article.tag_validation_error'))\n end\n end",
"def create_new_tags\n if params[:listing][:tag_ids].present?\n params[:listing][:tag_ids].map! do |tag_id|\n if Tag.exists? tag_id\n tag_id\n else\n new_tag = Tag.create(name: tag_id.downcase)\n new_tag.id\n end\n end\n end\n end",
"def postEntityAdvertiserTag( gen_id, entity_id, language, tags_to_add, tags_to_remove)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n params['language'] = language\n params['tags_to_add'] = tags_to_add\n params['tags_to_remove'] = tags_to_remove\n return doCurl(\"post\",\"/entity/advertiser/tag\",params)\n end",
"def tags_from_params\n search_filter_params[:tagged_with].to_s.split(\",\")\n end",
"def create\n @plant = Plant.find(params[:plant_id])\n if params[:plant_tag][:tag].present?\n tags = Tag.where(id: params[:plant_tag][:tag])\n tags.each do |t|\n @plant_tag = PlantTag.new\n @plant_tag.plant = @plant\n @plant_tag.tag = t\n @plant_tag.save\n end\n redirect_to garden_path(@plant.garden)\n else\n render :new\n end\n end",
"def tag_params\n params.require(:tag).permit(:tag)\n end",
"def treinamento_ti_params\n params.require(:treinamento_ti).permit(:orgao_id, :treinamento, :empresa, :qtd_pessoa)\n end",
"def select_tiporelacion\n [ \n [\"BENEFICIARIO\",\"BENEFICIARIO\"],\n [\"INTEGRANTE\",\"INTEGRANTE\"],\n [\"PROPIETARIO\",\"PROPIETARIO\"],\n [\"APODERADO\",\"APODERADO\"]\n ] \n end",
"def os_tarefa_params\n params.require(:os_tarefa).permit(:os_id,:catl_id, :prod_id, :pess_abertura_tarefa_id, :pess_tarefa_atribuida_id, :entregavel_id, :id_tarefa_redmine, :ust_tarefa, :horastarefa, :situacao, :justificativa, :id_os_pagamento)\n end",
"def post_params\n # params.permit(:content, :color, taggings_attributes: [:id, :tag])\n params.permit(:content, :color, tag_ids: [], asset_ids: [])\n end",
"def post_params\n if params[\"post\"][\"tags\"].class == Array\n params[\"post\"][\"tags\"] = params[\"post\"][\"tags\"].join(',')\n end\n params.require(:post).permit(:sub_id, :title, :body, :tags, :created_at, :updated_at)\n end",
"def create\n #tags are sent to the controller as a string array\n #we'll create our own way to find the Tag objects\n tags = equipment_params[:tags]\n\n tags_object_collection = []\n\n tags.each do |tag|\n if tag == ''\n next\n end\n\n tag_obj = Tag.find(tag)\n\n if tag_obj != nil\n tags_object_collection.push(tag_obj)\n end\n end\n\n new_equipment_params = equipment_params.except(:tags)\n\n @equipment = Equipment.new(new_equipment_params)\n @equipment.tags = tags_object_collection\n\n respond_to do |format|\n if @equipment.save\n format.html { redirect_to equipment_index_path, notice: 'Equipment was successfully created.' }\n format.json { render json: @equipment, status: :created, location: @equipment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def event_tag_params\n params.require(:event_tag).permit(:event_id, :tag_id)\n end",
"def select_tiposdocumemto\n [\n [\"CARTAS DE PROPIETARIOS SOLICITANDO LA VIVIENDA\",\"CARTAS DE PROPIETARIOS SOLICITANDO LA VIVIENDA\"],\n [\"CARTAS PARA CAMBIO DE VIVIENDA\",\"CARTAS PARA CAMBIO DE VIVIENDA\"],\n [\"CARTAS RECIBIDAS PARA SOLICITUD DE AUMENTO DE CANON\",\"CARTAS RECIBIDAS PARA SOLICITUD DE AUMENTO DE CANON\"],\n [\"DOCUMENTACION DE TENENCIA DE VIVIENDA EVACUADA\",\"DOCUMENTACION DE TENENCIA DE VIVIENDA EVACUADA\"],\n [\"DOCUMENTACION DE VIVIENDA PARA ARRENDAR POR PRIMERA VEZ\",\"DOCUMENTACION DE VIVIENDA PARA ARRENDAR POR PRIMERA VEZ\"],\n [\"DOCUMENTACION DE VIVIENDAS DISPONIBLES\",\"DOCUMENTACION DE VIVIENDAS DISPONIBLES\"],\n [\"DOCUMENTACION PARA CAMBIO DE VIVIENDA\",\"DOCUMENTACION PARA CAMBIO DE VIVIENDA\"],\n [\"DOCUMENTOS SOPORTES DE INGRESOS FAMILIARES\",\"DOCUMENTOS SOPORTES DE INGRESOS FAMILIARES\"],\n [\"DOCUMENTOS DE IDENTIDAD DEL GRUPO FAMILIAR\",\"DOCUMENTOS DE IDENTIDAD DEL GRUPO FAMILIAR\"],\n [\"OTROS DOCUMENTOS\",\"OTROS DOCUMENTOS\"],\n [\"PAZ Y SALVOS RECIBIDOS\",\"PAZ Y SALVOS RECIBIDOS\"]\n ]\n end",
"def profile_diet_tag_params\n params[:profile_diet_tag]\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def gtag_params\n params.require(:gtag).permit(:tag_uid, :banned, :customer_id, :redeemed, :ticket_type_id)\n end",
"def tags\n taxonomies.all :conditions => { :classification => :tag }\n end",
"def create\n # params[:tag_id].split(\",\").each do |p|\n @tag = Tag.new(title:params[:title])\n @tag.save\n#end\n @meetup = Meetup.new(meetup_params)\n @meetup.save\n params[:tag_id].split(\",\").each do |p|\n @tagmeetup = Tagmeetup.new(tag_id:p,meetup_id:@meetup.id);\n @tagmeetup.save\n end\n respond_to do |format|\n if @meetup.save\n format.html { redirect_to @meetup, notice: 'Meetup was successfully created.' }\n format.json { render :show, status: :created, location: @meetup }\n else\n format.html { render :new }\n format.json { render json: @meetup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tag_params\n params.require(:nct_id).permit(:value, :user_id)\n end",
"def export_select_tags\n return Array.new unless @in_buffer_settings[\"EXPORT_SELECT_TAGS\"]\n @in_buffer_settings[\"EXPORT_SELECT_TAGS\"].split\n end",
"def set_tags\n @tags = Tag.all\n @time = Tag.all.to_a.slice(0..4)\n @place = Tag.all.to_a.slice(5..8)\n @feeling = Tag.all.to_a.slice(9..13)\n @tag = Tag.find_by(id: params[:id])\n end",
"def tag_type_params\n params.require(:tag_type).permit(:name)\n end",
"def toggle_tags\n puts \"\\n\\n******* toggle_tags *******\"\n\n # == get post_id and tag_id from combined :ids string (e.g. 1_4)\n ids = params[:ids].split(\"_\")\n @post_id = ids[0]\n tag_id = ids[1]\n\n # == check post for selected tag\n @post_tag = PostTag.where(post_id: @post_id, tag_id: tag_id).first\n\n # == remove previously assigned tag\n if @post_tag\n puts \"******* HAS TAG (delete tag) *******\"\n @post_tag.destroy\n @post_tags = PostTag.where(post_id: @post_id)\n @post_tag_ids = @post_tags.map{|pt| pt.tag_id }\n puts \"@post_tag_ids: \", @post_tag_ids\n if @post_tag_ids.length == 0\n @post_no_tags = Tag.all\n else\n @post_no_tags = Tag.where(\"id NOT IN (?)\", @post_tag_ids)\n end\n puts \"@post_no_tags: \", @post_no_tags\n @tags = Tag.where(id: @post_tag_ids)\n render json: { tags: @tags, post_no_tags: @post_no_tags, post_id: @post_id}\n end\n end",
"def teto_params\n params.require(:teto).permit(:user_id, :value)\n end",
"def get_tag_list\n # body = {\n # cmd: \"get_tag_list\"\n # }\n\n end",
"def create\n UsersAgency.selection_from_ids(current_user, params[:agency_selection])\n head :created\n end",
"def content_tag_params\n params.require(:content_tag).permit(:tag_name, :tag_type)\n end",
"def tag_collection_params\n params.require(:tag_collection).permit(:name, :priority, :menu_id)\n end",
"def tag\n params.require(:tag).permit(:example_id, :tag)\n end",
"def create\n repo = Repo.find(params[:repo_id])\n\n label_name = params[:label_name].downcase\n \n respond_to do |format|\n format.html { \n # Which ActsAsTaggableOn Context do we want to tag?\n if params[\"add_label\"]\n repo.label_list << label_name\n repo.save\n redirect_to :back, notice: \"Tagging action succeeded.\"\n elsif params[\"remove_label\"]\n repo.label_list << label_name\n repo.label_list.delete(label_name)\n repo.save\n redirect_to :back, notice: \"Tagging action succeeded.\"\n elsif params[\"add_framework\"]\n repo.framework_list << label_name\n repo.save\n redirect_to :back, notice: \"Tagging action succeeded.\" \n elsif params[\"remove_framework\"]\n repo.framework_list << label_name\n repo.framework_list.delete(label_name)\n repo.save\n redirect_to :back, notice: \"Tagging action succeeded.\" \n elsif params[\"add_language\"]\n repo.language_list << label_name\n repo.save\n redirect_to :back, notice: \"Tagging action succeeded.\" \n elsif params[\"remove_language\"]\n repo.language_list << label_name\n repo.language_list.delete(label_name)\n repo.save\n redirect_to :back, notice: \"Tagging action succeeded.\" \n else\n #no particular action wish was send along\n redirect_to :back, notice: \"Tagging action did not succeed. Please mail my creators that I did not receive instruction where to put this tag or label.\" \n end \n }\n end\n end",
"def technotype_params\n params.require(:supervise).permit(:vm_id, :techno_id, :status)\n end",
"def garden_tag_params\n params.require(:garden_tag).permit(:tag_id)\n end",
"def tag_params\n params.permit(:body, :post_id)\n .merge(post_id: params[:post_id])\n end",
"def create\n authorize @organization\n if @organization.update_attributes(tag_list: @tags)\n render :json => @organization.reload.tags, :status => :created\n else\n error!(:invalid_resource, @organization.errors, \"Tags have not been saved\")\n end\n end",
"def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end",
"def create\n @tag = Tag.new(tag_params)\n if @tag.save\n render json: @tag\n else\n render json: @tag.errors, status: :unprocessable_entity\n end\n end",
"def tag_params\n params.require(:tag).permit(:tag_id, :rssi, :antenna, :last_seen_at, :funded, :member)\n end",
"def create\n @shout = Shout.new(params[:shout])\n\n# params[:tags].split(\" \").each do |tag_word|\n# \t @shout.tags.build(:tag_word => tag_word)\n# \tend\n\t\n respond_to do |format|\n if @shout.save\n format.html { redirect_to @shout, notice: 'Shout was successfully created.' }\n format.json { render json: @shout, status: :created, location: @shout }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_select_options(os)\n vm = @opts[:value_method]\n tm = @opts[:text_method]\n sel = @opts[:selected] || @attr[:value]\n\n if @opts[:multiple]\n sel = Array(sel)\n cmp = lambda{|v| sel.include?(v)}\n else\n cmp = lambda{|v| v == sel}\n end\n\n os.map do |x|\n attr = {}\n if tm\n text = x.send(tm)\n val = x.send(vm) if vm\n elsif x.is_a?(Array)\n text = x.first\n val = x.last\n\n if val.is_a?(Hash)\n value = val[:value]\n attr.merge!(val)\n val = value\n end\n else\n text = x\n end\n\n yield [text, val, !val.nil? ? cmp.call(val) : cmp.call(text), attr]\n end\n end",
"def add_tag_to_server server_uuid, tags\n tag = (tags.respond_to? :join && tags.join(\",\") || tags)\n\n post \"server/#{server_uuid}/tag/#{tag}\"\n end",
"def form_tag_options form_tag_type, form_tag_name, form_tag_value = nil\n options = { :with => { :name => form_tag_name, :type => form_tag_type } }\n # .to_s if value is a digit or smth. else, see issue#10\n options[:with].merge!(:value => form_tag_value.to_s) if form_tag_value\n options\n end",
"def set_tagging\n @tagging = Tagging.find(params[:id])\n end",
"def set_tagging\n @tagging = Tagging.find(params[:id])\n end"
] |
[
"0.70922923",
"0.649447",
"0.6199583",
"0.5868507",
"0.55591655",
"0.54892397",
"0.53707653",
"0.52069837",
"0.51950353",
"0.5185502",
"0.5159103",
"0.5159103",
"0.51436543",
"0.5136004",
"0.50788724",
"0.5058716",
"0.50396377",
"0.50187314",
"0.49941844",
"0.49847722",
"0.49647027",
"0.49615976",
"0.49190316",
"0.49088243",
"0.48887724",
"0.48808426",
"0.4859151",
"0.48512855",
"0.4836726",
"0.4823394",
"0.48217452",
"0.48210934",
"0.4819949",
"0.48180652",
"0.4801244",
"0.47993234",
"0.47963303",
"0.47949448",
"0.47933897",
"0.4793334",
"0.47815233",
"0.4780108",
"0.4776249",
"0.4773749",
"0.47698498",
"0.47557354",
"0.47525164",
"0.474647",
"0.47455817",
"0.47342184",
"0.4733279",
"0.47255424",
"0.47248772",
"0.47183344",
"0.4716707",
"0.47078058",
"0.47040612",
"0.47013083",
"0.46988332",
"0.46982878",
"0.46871024",
"0.46865156",
"0.4684679",
"0.4670569",
"0.4669518",
"0.46683562",
"0.46671703",
"0.46645603",
"0.46610683",
"0.46575922",
"0.46566972",
"0.4655599",
"0.46552792",
"0.46530592",
"0.46530217",
"0.4652166",
"0.46474078",
"0.46414196",
"0.46408823",
"0.46385932",
"0.46376896",
"0.46315706",
"0.4630479",
"0.46193418",
"0.4615456",
"0.46123502",
"0.4608433",
"0.46028253",
"0.4601831",
"0.45938396",
"0.45934734",
"0.45924458",
"0.45808482",
"0.45784014",
"0.4576558",
"0.45696878",
"0.45676315",
"0.45672557",
"0.4563225",
"0.4563225"
] |
0.73850346
|
0
|
PATCH/PUT /tagging_select_tos/1 PATCH/PUT /tagging_select_tos/1.json
|
def update
respond_to do |format|
if @tagging_select_to.update(tagging_select_to_params)
format.html { redirect_to @tagging_select_to, notice: 'Tagging select to was successfully updated.' }
format.json { render :show, status: :ok, location: @tagging_select_to }
else
format.html { render :edit }
format.json { render json: @tagging_select_to.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def create\n @tagging_select_to = TaggingSelectTo.new(tagging_select_to_params)\n\n respond_to do |format|\n if @tagging_select_to.save\n format.html { redirect_to tagging_select_tos_path }\n format.json { render :show, status: :created, location: @tagging_select_to }\n else\n format.html { render :new }\n format.json { render json: @tagging_select_to.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tagging_select_to\n @tagging_select_to = TaggingSelectTo.find(params[:id])\n end",
"def update\n @tags_of_novel = TagsOfNovel.find(params[:id])\n\n respond_to do |format|\n if @tags_of_novel.update_attributes(params[:tags_of_novel])\n format.html { redirect_to @tags_of_novel, notice: 'Tags of novel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tags_of_novel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n body[\"tag\"]\n end",
"def update(options: {}, **data)\n\n refresh_with(parse(client.put(\"/tags/#{gid}\", body: data, options: options)).first)\n end",
"def tagging_select_to_params\n params.require(:tagging_select_to).permit(:name)\n end",
"def update\n @task.tags.each { |t| t.delete}\n\n respond_to do |format|\n if @task.update(task_params)\n create_multiple_tags(task_params[\"tag\"], @task.id)\n\n format.html { redirect_to @task.list, 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 if @tag.update(tag_params)\n render json: @tag\n else\n render json: @tag.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @tagging_select_to.destroy\n respond_to do |format|\n format.html { redirect_to tagging_select_tos_url, notice: 'Tagging select to was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @tagging.update(tagging_params)\n format.html { redirect_to @tagging, notice: 'Tagging was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tagging.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @has_tag.update(has_tag_params)\n format.html { redirect_to @has_tag, notice: 'Has tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @has_tag }\n else\n format.html { render :edit }\n format.json { render json: @has_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @organization\n @organization.tag_list.add @tags\n if @organization.save\n render :json => @organization.reload.tags\n else\n error!(:invalid_resource, @organization.errors, \"Tags have not been saved\")\n end\n end",
"def update\n respond_to do |format|\n if @promotion_tag.update(promotion_tag_params)\n format.html { redirect_to @promotion_tag, notice: 'Promotion tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @promotion_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n \n # If the button was ther \"Add tag\" button, only need to process the new tag\n if params[:add_tag].present?\n\n # Only call if the given tag exists for the current user\n if current_user.tags.find_by_id(params[:new_tag_id])\n @todo.add_tag_with_id(params[:new_tag_id])\n end\n \n respond_to do |format|\n format.html { redirect_to edit_todo_path, notice: t('todos.success_add') }\n format.json { head :no_content }\n end\n \n # Here, we are doing a regular update of :todo and :done\n else\n \n respond_to do |format|\n # new_tag_id is not an actual attribute of Todo, so it must be removed from\n # the params[:todo] hash before calling update_attributes below\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to root_path, notice: t('todos.success_update') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @selection = Selection.find(params[:id])\n \n @bottles_to_add = params[\"bottles\"];\n \n @selection.bottle_ids.clear\n if @bottles_to_add\n @bottles_to_add.each do |bottle_id|\n @selection.add_bottle(Bottle.find(bottle_id))\n end\n end\n \n @selection.user_id = session[:user_id]\n\n respond_to do |format|\n if @selection.update_attributes(params[:selection])\n format.html { redirect_to @selection, notice: 'Selection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @selection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tagging_select_tos = TaggingSelectTo.all\n if @tagging_select_tos.empty?\n TaggingSelectTo.create(name: 'Sajjad-Murtaza-Testing-Taggable')\n end\n end",
"def update\n render json: @tag.errors unless @tag.update(tag_params)\n end",
"def update\n respond_to do |format|\n if @environmental_subtag.update(environmental_subtag_params)\n format.html { redirect_to @environmental_subtag, notice: 'Environmental subtag was successfully updated.' }\n format.json { render :show, status: :ok, location: @environmental_subtag }\n else\n format.html { render :edit }\n format.json { render json: @environmental_subtag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_and_respond(@tag, tag_params)\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @api_tag = Api::Tag.find(params[:id])\n\n respond_to do |format|\n if @api_tag.update_attributes(params[:api_tag])\n format.html { redirect_to @api_tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_tag.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 respond_to do |format|\n if @tag_one.update(tag_one_params)\n format.html { redirect_to @tag_one, notice: 'Tag one was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag_one }\n else\n format.html { render :edit }\n format.json { render json: @tag_one.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n entity = Tagger::EntityTag.create_entity_tags(params)\n render json: { \"#{Tagger.tagged_resource}\": entity, tags: entity.tags }, status: 201\n rescue Exception => e\n render json: { error: \"Unprocessable entity\" }, status: 422\n end\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def update\n authorize @ticket\n @ticket.tag_list.add @tags\n if @ticket.save\n render :json => @ticket.reload.tags\n else\n error!(:invalid_resource, @ticket.errors, \"Tags have not been saved\")\n end\n end",
"def update\n respond_to do |format|\n if @tag_type.update(tag_type_params)\n format.html { redirect_to @tag_type, notice: 'Tag type was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag_type }\n else\n format.html { render :edit }\n format.json { render json: @tag_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @creation_tag.update(creation_tag_params)\n format.html { redirect_to @creation_tag, notice: 'Creation tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @creation_tag }\n else\n format.html { render :edit }\n format.json { render json: @creation_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:organization][:tag_ids] ||= []\n\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n flash[:notice] = t(\"organization.success_updated\")\n format.html { redirect_to(@organization) }\n else\n format.html { render :layout => \"main\", :partial => \"form\", :locals => { :action => \"Update\" } } \n end\n end\n end",
"def update\n @taggable = current_user.taggables.find(params[:id])\n\n respond_to do |format|\n logger.debug(params)\n if @taggable.update_attributes(params[:taggable])\n format.html { redirect_to @taggable, notice: 'Taggable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taggable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n get_status\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @events_tag = EventsTag.find(params[:id])\n\n respond_to do |format|\n if @events_tag.update_attributes(params[:events_tag])\n format.html { redirect_to @events_tag, notice: 'Events tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @events_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respondent = SurveyRespondent.find(params[:respondent_id])\n tag_context = params[:context] # tag context\n tag_list = params[:tags] # comma seperated list of tags\n\n if getTagOwner\n getTagOwner.tag(respondent, :with => tag_list, :on => tag_context)\n else\n respondent.set_tag_list_on(tag_context, tag_list) # set the tag list on the respondent for the context\n end\n \n respondent.save\n \n render :layout => 'content'\n end",
"def update\n data = tenant_update_params\n tookan = {\"api_key\": \"50646180f541481e4c422b614c5825431be3c2f82fd57936541c03\",\"customer_id\": @tenant.customer_id,\"user_type\": 0,\"name\": data[:name],\"phone\": data[:phone1],\"email\": data[:email],\"address\": data[:address],\"latitude\": data[:latitude],\"longitude\": data[:longitude]}\n response = RestClient.post \"https://api.tookanapp.com/v2/customer/edit\", tookan.to_json, :content_type => \"application/json\"\n response = JSON.parse(response)\n respond_to do |format|\n if response[\"status\"] == 200\n if @tenant.update(tenant_update_params)\n food_category = FoodCategory.find_or_create_by(name: \"Veg\")\n @tenant.tenant_details.update(food_category_id: food_category.id)\n if @tenant.active == true\n end\n end\n @tenant.update(:updated_by=>session[:kitchen_user_id])\n format.html { redirect_to tenants_url, notice: 'Tenant was successfully updated.' }\n format.json { render :show, status: :ok, location: @tenant }\n else\n format.html { redirect_to tenants_url, notice: 'Tenant was not updated.' }\n format.json { render json: @tenant.errors, status: :unprocessable_entity }\n end\n end\nend",
"def assign_tenant_circles_to_an_aos_version_box(args = {}) \n body_put(\"/aosversions.json/aosversionbox/circles/#{args[:aosVersionBoxId]}\", args[:array_of_ids])\nend",
"def update\n if @has_project_tag.update(has_project_tag_params)\n render json: @has_project_tag, status: :ok#, location: @has_project_tag\n else\n render json: @has_project_tag.errors, status: :unprocessable_entity\n end\n end",
"def update\n @kpt = Kpt.find(params[:id])\n @kpt.attributes = params[:kpt]\n \n respond_to do |format|\n if @kpt.set_tag_body && @kpt.save\n format.html { redirect_to '/kpts', notice: \"#{@kpt.category}が更新されました。\"}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kpt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n @tag.update_attributes(params[:tag])\n respond_to do |format|\n format.js\n end\n end",
"def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: t('.updated') }\n format.json { render :show, status: :ok, location: @tag }\n else\n format.html { render :edit }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tags\n tags=self.tag_ids.clone\n unless tags.nil?\n self.associations.each do |a|\n #destroy an association if its tag wasn't checked in the form\n a.destroy unless tags.include?(a.tag_id.to_s)\n #for each existing association, delete its tag from the parameters(to prevent duplicate associations)\n tags.delete(a.tag_id.to_s)\n end\n devs=Tag.find(:all,:conditions=>'type_id=4',:select=>'id').map{|d| d.id.to_s}\n genres=Tag.find(:all,:conditions=>'type_id=2',:select=>'id').map{|g| g.id.to_s}\n if (tags&devs).length==0\n indie=Tag.find_by_name('Independent')\n # if no developer has been selected, assume \"Independent\"\n self.associations.create(:tag_id=>indie.id)\n end\n if (tags&genres).length==0\n other=Tag.find_by_name('Other')\n # if no genre has been selected, assume \"Other\"\n self.associations.create(:tag_id=>other.id)\n end\n tags.each do |t|\n self.associations.create(:tag_id=>t) unless t.blank?\n end\n reload\n end\n end",
"def update\n authorize! :update, CompetenceTierGroup\n \n @competence_tier_group.update!(competence_tier_group_params)\n render json: {status: :ok}\n end",
"def update\n @entity_tag = EntityTag.find(params[:id])\n\n respond_to do |format|\n if @entity_tag.update_attributes(params[:entity_tag])\n format.html { redirect_to @entity_tag, notice: 'Entity tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entity_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n @tagg = Tagg.find(params[:id])\n\n respond_to do |format|\n if @tagg.update_attributes(params[:tagg])\n format.html { redirect_to @tagg, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tagg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lcb_financing_target_tag.update(lcb_financing_target_tag_params)\n format.html { redirect_to @lcb_financing_target_tag, notice: 'Lcb financing target tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @lcb_financing_target_tag }\n else\n format.html { render :edit }\n format.json { render json: @lcb_financing_target_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @app && @tag\n @tag.update(tag_params)\n if @tag.valid?\n head :no_content\n else\n head :bad_request\n end\n else\n head :not_found\n end\n end",
"def update\n respond_to do |format|\n if @tag_relationship.update(tag_relationship_params)\n format.html { redirect_to @tag_relationship, notice: 'Tag relationship was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tag_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @activity_tag = ActivityTag.find(params[:id])\n\n respond_to do |format|\n if @activity_tag.update_attributes(params[:activity_tag])\n format.html { redirect_to @activity_tag, notice: 'Activity tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = [{ 'op' => operation, 'path' => path, 'value' => value }]\n patch_options = { 'If-Match' => @data['eTag'] }\n response = @client.rest_patch(@data['uri'], patch_options.merge('body' => body), @api_version)\n @client.response_handler(response)\n end",
"def update\n respond_to do |format|\n if @prd_tag.update(prd_tag_params)\n format.html { redirect_to @prd_tag, notice: 'Prd tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @prd_tag }\n else\n format.html { render :edit }\n format.json { render json: @prd_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n tag = @user.tags.find_by_tid(params[:id])\n if tag.nil?\n render json_status_response(404, \"Tag not found\")\n return\n end\n\n if not tag.update_attributes(params[:location])\n render json_status_response(400, \"Could not update tag location\")\n return\n end\n\n render json_status_response(200, \"Successfully updated tag\")\n end",
"def update\n @tag = Tag.find(params[:id])\n \n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n respond_to do |format|\n if @tag.update(tag_params)\n format.json { render :show, status: :ok, location: @tag }\n else\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to tags_url, :notice => 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tag.errors, :status => :unprocessable_entity }\n end\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 respond_to do |format|\n if @instance_eni_tag.update(instance_eni_tag_params)\n format.html { redirect_to @instance_eni_tag, notice: 'Instance eni tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @instance_eni_tag }\n else\n format.html { render :edit }\n format.json { render json: @instance_eni_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, :notice => 'Tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tag.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag editada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @joke = Joke.find(params[:id])\n\n respond_to do |format|\n str_tags = params[:joke][:tags].split(',')\n @tags = str_tags.map {|tag_name|\n Tag.find_or_create_by_name(tag_name)\n }\n @joke.tags = @tags\n \n if @joke.update_attributes(params[:joke].except(:tags))\n format.html { redirect_to @joke, :notice => 'Joke was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @joke.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag }\n else\n format.html { render :edit }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag }\n else\n format.html { render :edit }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag }\n else\n format.html { render :edit }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n tags = equipment_params[:tags]\n\n tags_object_collection = []\n\n tags.each do |tag|\n if tag == ''\n next\n end\n\n tag_obj = Tag.find(tag)\n\n if tag_obj != nil\n tags_object_collection.push(tag_obj)\n end\n end\n\n new_equipment_params = equipment_params.except(:tags)\n\n @equipment = Equipment.find(params[:id])\n @equipment.tags = tags_object_collection\n\n respond_to do |format|\n if @equipment.update_attributes(new_equipment_params)\n format.html { redirect_to equipment_index_path, notice: 'Equipment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @equipment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n\n if @tag.update_attributes(params[:tag])\n render json: JSON.parse(@tag.to_json)\n else\n render json: JSON.parse(@tag.errors.to_json)\n end\n end",
"def update\n respond_to do |format|\n if @listing_tag.update(listing_tag_params)\n format.html { redirect_to @listing_tag, notice: 'Listing tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing_tag }\n else\n format.html { render :edit }\n format.json { render json: @listing_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @engine_tag.update(engine_tag_params)\n format.html { redirect_to @engine_tag, notice: 'Engine tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @engine_tag }\n else\n format.html { render :edit }\n format.json { render json: @engine_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tagging = Tagging.find(params[:id])\n\n respond_to do |format|\n if @tagging.update_attributes(params[:tagging])\n format.html { redirect_to(@tagging, :notice => 'Tagging was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tagging.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer_tag.update(answer_tag_params)\n format.html { redirect_to @answer_tag, notice: 'Answer tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @answer_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if user_signed_in?\n\n if current_user.is_admin\n\n respond_to do |format|\n \n if @offer.update(offer_params)\n\n ##BEGIN CATEGORY TAGS\n \n if params[:category_tags]\n\n params[:category_tags].each do |id, checked| \n\n\n offer_category = OfferCategory.find(id) #ERRRORORORO\n \n\n if offer_category\n\n #check for existing offer category tag entry\n\n offer_category_tag_entry = OfferCategoryTag.where(:offer_id => @offer.id, :offer_category_id => offer_category.id).last\n\n\n if checked == \"true\" #if selected\n\n unless offer_category_tag_entry\n\n OfferCategoryTag.create(:offer_category_id => offer_category.id, :offer_id => @offer.id, :is_active => true)\n\n else\n\n offer_category_tag_entry.update(:is_active => true)\n\n end\n\n\n\n else #if not selected\n\n if offer_category_tag_entry\n\n offer_category_tag_entry.update(:is_active => false)\n\n end\n\n end\n\n end\n\n end\n\n end\n\n ##END CATEGORY TAGS\n\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n\n else\n\n redirect_to root_path\n\n end\n\n else\n\n redirect_to root_path\n\n end\n\n end",
"def update\n respond_to do |format|\n if @temporary_tag.update(temporary_tag_params)\n format.html { redirect_to @temporary_tag, notice: 'Temporary tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @temporary_tag }\n else\n format.html { render :edit }\n format.json { render json: @temporary_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hearing_conference.tag_list = params[:hearing_conference][:tag_list]\n \n respond_to do |format|\n if @hearing_conference.update(hearing_conference_params)\n format.html { redirect_to @hearing_conference, notice: 'Hearing conference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hearing_conference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @diet.update(diet_params)\n head :no_content, status: 204\n else\n render json: @diet.errors, status: 422\n end\n end",
"def update\n @server = Server.find(params[:id])\n if params[:tag_ids]\n @server.tags = params[:tag_ids].map { |id| Tag.find(id) }\n end\n respond_to do |format|\n if @server.update_attributes(params[:server])\n format.html { redirect_to servers_path, notice: 'Server was successfully updated.' }\n format.json { render json: @server, status: :updated, location: @server }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n old_task = Task.find(params[:id])\n\n @task = Task.find(params[:id])\n params[:task][:name].strip!\n params[:task][:name].downcase!\n # verify if all the fields are filled\n\n # TODO: We will check it by JavaScript\n os_adv_tag_error = false\n # modify_any_os_adv_tag = verify_os_options_valid(os_adv_tags, params)\n\n # if only the first field is filled and they are left blank, ignore\n # os_adv_tag_error = true if (os_adv_tags.size != 1 && !modify_any_os_adv_tag)\n\n # if !os_adv_tag_error && modify_any_os_adv_tag\n update_and_add_new_os_adv_tag(params, @task)\n # end\n\n save_task_groups(@task, params)\n\n respond_to do |format|\n if @task.update_attributes(params[:task]) && !os_adv_tag_error\n notify_frozen_state_changed(old_task, @task)\n expire_all_fragments\n flash[:notice] = 'Task was successfully updated.'\n format.html do\n redirect_to(:controller => :tasks,\n :action => :show,\n :id => escape_url(@task.name))\n end\n format.xml { head :ok }\n else\n if os_adv_tag_error\n flash[:notice] = 'You cannot leave Os, Advisory and Candidate tag blank'\n end\n format.html { render :action => 'edit' }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def ti_update_office_textfield_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @offices = @organization.blank? ? offices_dropdown : Office.joins(:company).where(companies: { organization_id: organization }).order(:name)\n @technicians = @organization.blank? ? technicians_dropdown : @organization.technicians.order(:name)\n else\n @offices = offices_dropdown\n @technicians = technicians_dropdown\n end\n @offices_dropdown = []\n @offices.each do |i|\n @offices_dropdown = @offices_dropdown << [i.id, i.name, i.company.name]\n end\n @json_data = { \"offices\" => @offices_dropdown, \"technicians\" => @technicians }\n render json: @json_data\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n \t# update tags\n \t@question.tag_with(params[:question][:tag_list])\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 @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n tag = Tag.find_by_id(params[:id])\n if tag.update(params.permit(:name))\n render json: tag, status: :ok\n else\n respond_with tag.errors, status: :unprocessable_entity\n end\n end",
"def create_method\n :http_put\n end",
"def create_method\n :http_put\n end",
"def update\n @tag = Tag.find(params[:id])\n\n respond_to do |format|\n if @tag.update_attributes(params[:tag])\n format.html { redirect_to @tag, notice: 'Tag zaktualizowany' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tag.update(tag_params)\n format.html { redirect_to @tag, notice: 'Tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @tag }\n else\n format.html { render :edit }\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question_tag.update(question_tag_params)\n format.html { redirect_to @question_tag, notice: 'Question tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @question_tag }\n else\n format.html { render :edit }\n format.json { render json: @question_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @territory = current_company.territories.find(params[:id])\n\n # hack to determine new and deleted regions\n adjust_region_ids\n adjust_zipcode_ids\n\n if @territory.update_attributes(params[:territory])\n respond_with(@territory)\n else\n respond_with(@territory, :status => :unprocessable_entity)\n end\n end",
"def update\n respond_to do |format|\n if @profile_diet_tag.update(profile_diet_tag_params)\n format.html { redirect_to @profile_diet_tag, notice: 'Profile diet tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile_diet_tag }\n else\n format.html { render :edit }\n format.json { render json: @profile_diet_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @climb_tag.update(climb_tag_params)\n format.html { redirect_to @climb_tag, notice: 'Climb tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @climb_tag }\n else\n format.html { render :edit }\n format.json { render json: @climb_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @job_tag.update(job_tag_params)\n format.html { redirect_to @job_tag, notice: 'Job tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_tag }\n else\n format.html { render :edit }\n format.json { render json: @job_tag.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_tags_input_options(options)\n options[:allow_new] = true unless options.key?(:allow_new)\n\n if options[:typeahead] == false\n options.delete(:typeahead)\n else\n typeahead = options[:typeahead] ||= {}\n\n unless typeahead[:query_url]\n typeahead[:query_url] = if typeahead[:type]\n query_tags_path(type: typeahead.delete(:type))\n else\n query_tags_path\n end\n end\n end\n\n options\n end",
"def update\n respond_to do |format|\n if @terms_of_service.update(terms_of_service_params)\n format.html { redirect_to @terms_of_service, notice: 'Terms of service was successfully updated.' }\n format.json { render :show, status: :ok, location: @terms_of_service }\n else\n format.html { render :edit }\n format.json { render json: @terms_of_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aws_vpc_tag.update(aws_vpc_tag_params)\n format.html { redirect_to @aws_vpc_tag, notice: 'Aws vpc tag was successfully updated.' }\n format.json { render :show, status: :ok, location: @aws_vpc_tag }\n else\n format.html { render :edit }\n format.json { render json: @aws_vpc_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:post][:tag_ids] ||= []\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to [@post.user, @post], notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @posttag = Posttag.find(params[:id])\n\n respond_to do |format|\n if @posttag.update_attributes(params[:posttag])\n format.html { redirect_to @posttag, :notice => 'Posttag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @posttag.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.5837907",
"0.5675519",
"0.5596343",
"0.55959094",
"0.549714",
"0.5481679",
"0.54743373",
"0.54601854",
"0.5432531",
"0.5416601",
"0.53992194",
"0.5393969",
"0.53887045",
"0.5381043",
"0.53787017",
"0.5370408",
"0.53614634",
"0.53505164",
"0.53388655",
"0.533556",
"0.5322151",
"0.528897",
"0.528583",
"0.528583",
"0.52561504",
"0.5251345",
"0.52506995",
"0.52506995",
"0.5245062",
"0.52299374",
"0.52205265",
"0.5216563",
"0.52164924",
"0.51797104",
"0.51577353",
"0.5150548",
"0.51443535",
"0.5133449",
"0.5108395",
"0.50963634",
"0.5076127",
"0.5073002",
"0.5071587",
"0.5069451",
"0.5067979",
"0.506401",
"0.5062871",
"0.5060913",
"0.506048",
"0.50602317",
"0.50590134",
"0.5056106",
"0.5055034",
"0.50547653",
"0.5049029",
"0.504723",
"0.50460243",
"0.50460243",
"0.50459623",
"0.5043782",
"0.50385886",
"0.5028954",
"0.50245655",
"0.50238264",
"0.5010424",
"0.5004768",
"0.5004768",
"0.5004768",
"0.50017405",
"0.5001474",
"0.49926913",
"0.49844667",
"0.4982857",
"0.49825877",
"0.4980937",
"0.49792796",
"0.49781653",
"0.49757728",
"0.4974989",
"0.49749607",
"0.49732235",
"0.49714974",
"0.49697608",
"0.49697608",
"0.4960324",
"0.49587813",
"0.49587813",
"0.49572325",
"0.49529037",
"0.49478233",
"0.4943523",
"0.49433702",
"0.49427697",
"0.49377167",
"0.49365848",
"0.49272454",
"0.49246988",
"0.49231213",
"0.49193177",
"0.49187335"
] |
0.67469025
|
0
|
DELETE /tagging_select_tos/1 DELETE /tagging_select_tos/1.json
|
def destroy
@tagging_select_to.destroy
respond_to do |format|
format.html { redirect_to tagging_select_tos_url, notice: 'Tagging select to was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @tagging.destroy\n respond_to do |format|\n format.html { redirect_to taggings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tagging = Tagging.find(params[:id])\n @tagging.destroy\n\n respond_to do |format|\n format.html { redirect_to taggings_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tags_of_novel = TagsOfNovel.find(params[:id])\n @tags_of_novel.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_of_novels_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n get_status\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tagging = Tagging.find(params[:id])\n @tagging.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_taggings_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n \n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n\n end",
"def destroy\n @tag_collection = TagCollection.find(params[:id])\n @tag_collection.destroy\n render json: {}\n \n end",
"def destroy\n tag = @user.tags.find_by_tid(params[:id])\n if tag.nil?\n render json_status_response(404, \"Tag not found\")\n return\n end\n\n tag.destroy\n render json_status_response(200, \"Tag removed successfully\")\n end",
"def destroy\n @tagg = Tagg.find(params[:id])\n @tagg.destroy\n\n respond_to do |format|\n format.html { redirect_to taggs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promotion_tag.destroy\n respond_to do |format|\n format.html { redirect_to promotion_tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tag_one.destroy\n respond_to do |format|\n format.html { redirect_to tag_ones_url, notice: 'Tag one was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_tag = Api::Tag.find(params[:id])\n @api_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to api_tags_url }\n format.json { head :no_content }\n end\n end",
"def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n\n svc.destroy\n\n render :json => {}\n end",
"def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n render json: JSON.parse({msg:\"success\"}.to_json)\n end",
"def delete(tag)\n api_client.tags.multi_delete(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n end",
"def destroy\n @taxi = Taxi.find(params[:id])\n @taxi.destroy\n\n respond_to do |format|\n format.html { redirect_to taxis_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @environmental_subtag.destroy\n respond_to do |format|\n format.html { redirect_to environmental_subtags_path, notice: 'Environmental subtag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def destroy\n @tagging = Tagging.find(params[:id])\n @tagging.destroy\n\n respond_to do |format|\n format.html { redirect_to(taggings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @buildchecktag.destroy\n respond_to do |format|\n format.html { redirect_to buildchecktags_url, notice: 'Buildchecktag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def deleteEntityTag( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/tag\",params)\n end",
"def destroy\n @diet_type.destroy\n respond_to do |format|\n format.html { redirect_to diet_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tagging = Tagging.find(params[:id])\n @tagging.destroy\n\n respond_to do |format|\n format.html { redirect_to(tagging_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @go_term = GoTerm.find(params[:id])\n @go_term.destroy\n\n respond_to do |format|\n format.html { redirect_to go_terms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @diet.destroy\n head :no_content, status: 200\n else\n render json: @diet.errors, status: 405\n end\n end",
"def delete_tag tag\n delete \"tag/#{tag}\"\n end",
"def destroy\n @cto.destroy\n respond_to do |format|\n format.html { redirect_to ctos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tag_type.destroy\n respond_to do |format|\n format.html { redirect_to tag_types_url, notice: 'Tag type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sellable = Sellable.find(params[:id])\n @sellable.destroy\n\n respond_to do |format|\n format.html { redirect_to sellables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n\n end",
"def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tag = Tag.find(params[:id])\n respond_to do |format|\n if @tag.destroy\n format.json { render json: {:id => @tag.id}, status: :ok }\n else\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @activity_tag = ActivityTag.find(params[:id])\n @activity_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_tags_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tag.destroy\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @toko.destroy\n respond_to do |format|\n format.html { redirect_to tokos_url, notice: 'Toko telah dihapus.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxi_sevice.destroy\n respond_to do |format|\n format.html { redirect_to taxi_sevices_url, notice: 'Taxi sevice was successfully destroyed.' }\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 authorize! :manage, @selectf\n\n @selectf.destroy\n respond_to do |format|\n format.html { redirect_to [@metric.service, @metric] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lcb_financing_target_tag.destroy\n respond_to do |format|\n format.html { redirect_to lcb_financing_target_tags_url, notice: 'Lcb financing target tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taggable = current_user.taggables.find(params[:id])\n\n #destroy each tag in the taggable\n @taggable.tags.each do |tag|\n tag.destroy\n end\n\n @taggable.destroy\n\n respond_to do |format|\n format.html { redirect_to taggables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tag = Tag.find(params[:id])\n\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pagto_taxa.destroy\n respond_to do |format|\n format.html { redirect_to pagto_taxas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end",
"def destroy\n @taxi.destroy\n respond_to do |format|\n format.html { redirect_to taxis_url, notice: 'Taxi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @posttag = Posttag.find(params[:id])\n @posttag.destroy\n\n respond_to do |format|\n format.html { redirect_to posttags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_tag.destroy\n respond_to do |format|\n format.html { redirect_to post_tags_url, notice: 'Tagi poistettu' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_path, success: I18n.t(\"admin.flash.tags.success.destroy\") }\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 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 @events_tag = EventsTag.find(params[:id])\n @events_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to events_tags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_select_field.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_select_fields_url, notice: 'Select field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @task_tag.destroy\n respond_to do |format|\n format.html { redirect_to task_tags_url, notice: 'Task tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete()\n\n client.delete(\"/tags/#{gid}\") && true\n end",
"def destroy\n @tag.destroy\n head :no_content\n end",
"def destroy\n @tb_solicitud.destroy\n respond_to do |format|\n format.html { redirect_to tb_solicituds_url, notice: 'Tb solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @instance_eni_tag.destroy\n respond_to do |format|\n format.html { redirect_to instance_eni_tags_url, notice: 'Instance eni tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @profile_diet_tag.destroy\n respond_to do |format|\n format.html { redirect_to profile_diet_tags_url, notice: 'Profile diet tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tagged_item = TaggedItem.find(params[:id])\n @tagged_item.destroy\n\n respond_to do |format|\n format.html { redirect_to all_items_tagged_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\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 @tag_ref.destroy\n respond_to do |format|\n format.html { redirect_to tag_refs_url, notice: 'Usunięto Tag z artykułu.' }\n format.json { head :no_content }\n end\n end",
"def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def destroy\n @solicitacao_tipo.destroy\n respond_to do |format|\n format.html { redirect_to solicitacao_tipos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @has_tag.destroy\n respond_to do |format|\n format.html { redirect_to has_tags_url, notice: 'Has tag 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 @door_tag.destroy\n respond_to do |format|\n format.html { redirect_to door_tags_url, notice: 'Door tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prd_tag.destroy\n respond_to do |format|\n format.html { redirect_to prd_tags_url, notice: 'Prd tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @for_select.destroy\n respond_to do |format|\n format.html { redirect_to for_selects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n render status: 200, json: @request_item.destroy\n end",
"def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n @tipo_vehiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_vehiculos_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(tags_url) }\n format.xml { head :ok }\n end\n end",
"def delete_array_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/arrays/#{args[:arrayId]}\", args)\nend",
"def destroy\n @ad_tag = AdTag.find(params[:id])\n @ad_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to ad_tags_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tatoo.destroy\n respond_to do |format|\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @selector_detail = SelectorDetail.find(params[:id])\n @selector_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to selector_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tangent.destroy\n respond_to do |format|\n format.html { redirect_to tangents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_level_agreement = current_user.company.service_level_agreements.find(params[:id])\n @service_level_agreement.destroy\n\n render :json => {:success => true}\n end",
"def destroy\n @tax.destroy\n\n head :no_content\n end",
"def destroy\n @alternative_tag_name.destroy\n respond_to do |format|\n format.html { redirect_to alternative_tag_names_url, notice: \"Alternative tag name was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @selected_options_of_pc.destroy\n respond_to do |format|\n format.html { redirect_to selected_options_of_pcs_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.68601376",
"0.65920043",
"0.6550066",
"0.6502049",
"0.6449415",
"0.64215285",
"0.6378379",
"0.63627017",
"0.636218",
"0.63561",
"0.6351577",
"0.6345666",
"0.63378906",
"0.63337964",
"0.63175327",
"0.6313219",
"0.6311535",
"0.6311226",
"0.6299295",
"0.6288399",
"0.6286303",
"0.627479",
"0.6261633",
"0.6260042",
"0.62570536",
"0.6254217",
"0.62496585",
"0.6240585",
"0.62343884",
"0.6223508",
"0.62198",
"0.6216215",
"0.6211375",
"0.62103343",
"0.6204029",
"0.6202337",
"0.6193951",
"0.6193951",
"0.6193951",
"0.61925393",
"0.6190638",
"0.61887085",
"0.61881584",
"0.6186137",
"0.61856157",
"0.6184998",
"0.6184998",
"0.6184998",
"0.6184998",
"0.6179199",
"0.6178669",
"0.6178054",
"0.6175781",
"0.61748344",
"0.61607456",
"0.61592233",
"0.6157808",
"0.6156348",
"0.61545354",
"0.61518466",
"0.6149773",
"0.61487824",
"0.614444",
"0.6142091",
"0.6138459",
"0.6124376",
"0.61243135",
"0.61202335",
"0.61192364",
"0.61186206",
"0.61065346",
"0.6106097",
"0.6104421",
"0.61036813",
"0.6103301",
"0.61024934",
"0.6100224",
"0.6097293",
"0.6095853",
"0.60952026",
"0.6094706",
"0.60910237",
"0.6090421",
"0.60899365",
"0.6088327",
"0.608692",
"0.6074705",
"0.6072716",
"0.607052",
"0.60694325",
"0.6069161",
"0.6068566",
"0.6062255",
"0.60619575",
"0.606045",
"0.6060412",
"0.6058603",
"0.6057392",
"0.6054577",
"0.60522395"
] |
0.75845844
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_tagging_select_to
@tagging_select_to = TaggingSelectTo.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def after_set_callback; end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def around_hooks; end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def duas1(action)\n action.call\n action.call\nend"
] |
[
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.53314966",
"0.53114754",
"0.52984965",
"0.52977055",
"0.5296272",
"0.5260649",
"0.5245076",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.52388334",
"0.5235081",
"0.52321917",
"0.5228592",
"0.5220735",
"0.52198535",
"0.52139324",
"0.5208539",
"0.5206585",
"0.5178542",
"0.5175199",
"0.5173538",
"0.5167041",
"0.51614195",
"0.51577675",
"0.5153909",
"0.51528823",
"0.5152225",
"0.51429904",
"0.5141399",
"0.51345575",
"0.51145",
"0.5114052",
"0.5114052",
"0.5110216",
"0.5108656",
"0.50935394",
"0.5089196",
"0.5081936",
"0.5079627",
"0.50675833",
"0.5056105",
"0.5053687",
"0.5050475",
"0.5050475",
"0.503471",
"0.5028311",
"0.501982",
"0.50157547",
"0.5013552",
"0.50014806",
"0.50011593",
"0.49976763",
"0.4990292",
"0.4990292",
"0.49882022",
"0.4981269",
"0.49792367",
"0.49766538",
"0.4967978",
"0.49667212",
"0.4958987",
"0.49572337",
"0.49550423",
"0.4954479",
"0.4952353",
"0.494726",
"0.4944055",
"0.4935437",
"0.4931248",
"0.49283475",
"0.49281213",
"0.49268973",
"0.4921738",
"0.49204507",
"0.4918924",
"0.49182287",
"0.4916538",
"0.49158585",
"0.49156788"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def tagging_select_to_params
params.require(:tagging_select_to).permit(: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
|
returns a new array where every even number is replaced with it's greatest factor. A greatest factor is the largest number that divides another with no remainder. For example the greatest factor of 16 is 8. (For the purpose of this problem we won't say the greatest factor of 16 is 16, because that would be too easy, ha) def greatest_factor_array(arr) new_arr = [] arr.each do |ele| if ele.even? new_arr << ele / 2 else new_arr << ele end end new_arr end
|
def greatest_factor_array(arr)
new_arr = arr.map do |ele|
if ele % 2 == 0
greatest_factor(ele)
else
ele
end
end
new_arr
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def greatest_factor_array(arr)\n\tlargest = []\n \tarr.each do |num|\n if num % 2 == 0\n largest << (num/2)\n else\n largest << num\n end\n end\n return largest\nend",
"def greatest_factor_array(arr)\n factors = []\n\n arr.each_with_index do |num, idx|\n if num % 2 == 0\n (1...num).each do |x|\n if num % x == 0\n factors << x\n end\n end\n arr[idx] = factors[-1]\n end\n end\n\n return arr\n\nend",
"def greatest_factor_array(arr)\n arr.map do |num|\n if num.even?\n gf = 0\n (1...num).each{|f| gf = f if num % f == 0}\n gf\n else\n num\n end\n end\nend",
"def greatest_factor_array(arr)\n\tarray = []\n \tarr.each do |i|\n \tif i.even?\n \tarray << prime_factors(i)\n else\n \tarray << i\n end\n end\n \treturn array\nend",
"def greatest_factor_array(arr)\n\tgfArray = []\n \tarr.each do |num|\n \tif num % 2 == 0\n \tnum = findGreatestFactor(num)\n end\n \tgfArray.push(num)\n end\n \treturn gfArray\nend",
"def greatest_factor_array(arr)\n new_array = []\n\n arr.each_with_index do |num, i|\n if num % 2 == 0\n new_array << prime_factors(num)\n else\n new_array << num\n end\n end\n\n return new_array\nend",
"def greatest_factor_array(arr)\n new_arr = arr.map do |num|\n if num % 2 == 0\n greatest_factor(num)\n else\n num\n end\n end\n\n return new_arr\nend",
"def greatest_factor_array(arr)\n arr.map do |el|\n if is_prime(el)\n el\n elsif el % 2 == 0\n el / 2\n else\n el\n end\n end\nend",
"def largest_odd_factors(nums)\n finalArray = []\n nums.each do |element|\n largest = 0\n counter = 1\n while counter < element\n if counter % 2 != 0 && counter > largest && element % counter == 0\n largest = counter\n end\n counter += 1\n end\n finalArray.push(largest)\n end\n return finalArray\n \n \n \nend",
"def largest_factor(n)\n arr = []\n num = 1\n while num < n \n if n % num == 0\n arr << num \n end\n num+=1\n end\n arr[-1]\nend",
"def greatest_factor(num)\n (2...num).reverse_each { |i| return i if num % i == 0}\nend",
"def factorize(test_number)\n return [] if test_number == 1\n divisor = 2\n factor_array = []\n while test_number > 1\n while (test_number % divisor) == 0\n factor_array << divisor\n test_number /= divisor\n end\n divisor += 1\n end\n return factor_array.max\nend",
"def largest_odd_factors(nums)\r\n\r\nend",
"def find_largest_prime(integer)\n factor_array = []\n potential_factor_array = (2..integer).to_a\n potential_factor_array.each do |factor|\n if integer % factor == 0\n factor_array << factor\n end\n end\n largest_factor = factor_array.last\n potential_factor_array = (2..largest_factor).to_a\n potential_factor_array.each do |potential_factor|\n factor_array.each do |factor|\n if factor != potential_factor && factor % potential_factor == 0\n factor_array.delete(factor)\n end\n end\n end\n p factor_array.last\nend",
"def factors_of(num)\n factor_arr = []\n\n (1...num).reverse_each do |factor|\n if (num % factor).zero?\n factor_arr << factor\n end\n end\n\n factor_arr\nend",
"def max_factor(n)\n\tfactors = [1, n]\n\tidx = 2\n\twhile idx < factors[-1]\n\t\tif factors[-1] % idx == 0\n\t\t\tnew = factors[-1] / idx\n\t\t\tfactors.pop\n\t\t\tfactors.push(idx)\n\t\t\tfactors.push(new)\n\t\t\tidx = 1\n\t\tend\n\t\tidx += 1\n\tend\n\treturn factors[-1]\nend",
"def remove_factors\n a=Array.new\n self.each do | x | \n a << x if 0 == ( self.inject(0) { | memo, y | memo + (x!=y && y%x==0 ? 1 : 0) } )\n end\n a\n end",
"def greatest_factor(num)\n\n return num / 2\n\nend",
"def factors_of(num)\n new_arr = []\n\n i = 1\n while i <= num\n if num % i == 0\n new_arr << i\n else \n end \n i += 1\n end\n return new_arr\nend",
"def largest_prime_factor(num)\n #prime_division returns an array of 2 element arrays containing prime factorization - [[2, 1], [5, 2]]\n #flat_map contatenates the 2 element arrays into a single array [2, 5, 5]\n array = Prime.prime_division(num).flat_map { |factor, power| [factor] * power }\n\n largest = 0\n array.each do |i|\n if i > largest\n largest = i\n end\n end\n return largest\nend",
"def factors(num)\n output_arr = []\n\n (1..num).each do |el|\n if num % el == 0\n output_arr << el\n end\n end\n\n output_arr.sort\nend",
"def factors_of(num)\n i = 1\n newArr = []\n while i <= num\n if num % i == 0\n newArr << i\n end\n i += 1\n end\n return newArr\n end",
"def find_largest_nums(arr)\n\ta = 0\n\tfinal_arr = []\n\twhile a < arr.length\n\t\tfinal_arr << arr[a].max\n\t\ta += 1\n\tend\n\treturn final_arr\nend",
"def factors_of(num)\n array = []\n i = 1\n while i <= num\n if num % i == 0\n array << i\n end\n i += 1\n end\n return array\n end",
"def factors(num)\n arr = [1]\n i = 1\n while i <= num\n arr << i if (num % i).zero?\n i += 1\n end\n arr.uniq.sort\nend",
"def find_largest_nums(arr)\n\tlargest = []\n\tarr.each { |x| largest << x.sort[-1] }\n\treturn largest\nend",
"def largest_factor(number)\n result = prime_factors(number).sort\n result[-1]\nend",
"def factors_of(num)\n\tnewArray = []\n \tfor i in 1..num\n if num % i == 0\n \tnewArray << i\n end\n end\n return newArray\nend",
"def factors num\n f = Array.new # creates a new array to store factors\n 1.upto(num) do |i|\n f << i if num%i == 0\n end\n f # returns factors\nend",
"def factors(num)\n arr = (1..num).to_a\n factored_arr = []\n i = 0\n while i < arr.length\n if num % arr[i] == 0\n factored_arr = factored_arr + arr[i]\n end\n i +=1\n end\n factored_arr\nend",
"def largest_prime_factor(num)\n factors = []\n half_of_num = num / 2\n\n (2..half_of_num).each do |factor|\n if num % factor == 0\n factors << factor\n num = num / factor\n end\n end\n factors.max\nend",
"def largest_prime_factor(num)\n divisors = []\n (2..num).each do |divisor|\n if num % divisor == 0\n if prime?(divisor)\n divisors << divisor\n end\n end\n end\n divisors[-1]\nend",
"def mode(array)\n freq = Hash.new(0)\n\n array.each do |i|\n freq[i] += 1\n end\n\n temp = Array.new\n largest = 0\n\n freq.each do |k, v|\n if(v > largest)\n temp.clear\n temp.push(k)\n largest = v\n elsif(v == largest)\n temp.push(k)\n end\n end\n\n return temp\nend",
"def greatestDiff(arr)\n sort(arr)\n result = arr[-1] - arr[0]\nend",
"def factors_of(num)\n arr = []\n\n i = 1\n\n while i <= num\n if num % i == 0\n arr << i\n end\n i += 1\n end\n\n return arr\nend",
"def factors(num)\n array = []\n (1..num).each do |number|\n array << number if num % number == 0\n end\n array.sort!\nend",
"def cusmax(array)\r\n return array.sort.max\r\nend",
"def largest_factor(n)\n\n result = nil\n (1 .. n/2).each do |d|\n if n % d == 0\n result = d\n end\n end\n\n result\nend",
"def factors(num)\n arr = []\n (2..num).each do |ele|\n if (num % ele == 0)\n arr << ele\n end\n end\n return arr\nend",
"def maximum_sub_array2(arr)\n current = []\n max_sum = cur_sum = 0\n max = (0...arr.size).inject([]) do |max, i|\n current << arr[i]\n cur_sum += arr[i]\n if cur_sum > max_sum\n max << i\n max_sum = cur_sum\n end\n max\n end\n arr[max[0]..max[-1]]\nend",
"def factors_of(num)\n\ti = 1\n \tarry = []\n while i <= num\n if num % i == 0\n arry << i\n end\n\n i += 1\n end\n return arry\nend",
"def max(arr)\n greatest = array[0]\n arr.each do |num|\n if num > greatest\n greatest = num\n end\n end\n greatest\nend",
"def fast_lcss(arr)\n i_arr = []\n biggest = 0\n max_sub_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sum = i_arr.inject(0) do |a, b|\n a + b\n end\n max_sub_arr = i_arr if sum > biggest\n biggest = sum if sum > biggest \n end\n i_arr = []\n arr.shift\n end\n max_sub_arr\nend",
"def even_factors(n)\n\tfmax = Math.sqrt(n).div(1)\n\ti = 2\n\t# check for even\n\tif n % 2 == 1\n\t\tfs = nil\n\t# search for factors\n\telse\n\t\tfs = []\n\t\tfs.push(2)\n\t\tfs.push(n / 2)\n\t\twhile 2*i < fmax\n\t\t\tfact = 2 * i\n\t\t\tif n % fact == 0\n\t\t\t\tfs.push(fact)\n\t\t\t\tfs.push(n / fact)\n\t\t\tend\n\t\t\ti = i + 1\n\t\tend\n\t\tfs.sort!\n\tend\n\tfs\nend",
"def factorize\n if even?\n return [2, self/2]\n else\n 3.upto(self) do |i|\n return [i, self/i] if self % i == 0\n end\n end\n end",
"def stretch(array)\n new_arr = []\n # can assign array to an variable and do only /2 once\n for i in 0...array.length\n # if element is a even number\n if array[i] % 2 == 0\n # add 1/2 value of the element for twice into the new array\n new_arr << array[i]/2\n # if element is an odd number\n else\n new_arr << array[i]/2 + 1\n end\n new_arr << array[i]/2\n end\n return new_arr\nend",
"def factors(n)\n new_arr = []\n (1...n).each do |i|\n if n % i == 0 \n new_arr << i \n end\n end\n new_arr \nend",
"def largest_prime_factor num\n divisors = []\n max = 0\n\n (1..num).each { |el| divisors << el if num % el === 0 && isPrime(el)}\n\n max = divisors[0]\n\n divisors.each do |el|\n max = el if el > max \n end\n\n max\nend",
"def largest_prime(num)\n\tresult = []\n\ti = 2\n\twhile i <= num\n\t\tif is_prime?(i)\n\t\t\tif num % i == 0 # Check for whole number if % by i \n\t\t\t\tnum = num / i # Update the num\n\t\t\t\tresult << i # Add i to the array\n\t\t\t\ti = 2 # Reset i to 2\t\n\t\t\tend\t\n\t\tend\n\t\ti += 1\t\n\tend\n\tresult\nend",
"def mode(array)\n hash = Hash.new(0)\n array.each do |x|\n hash[x] += 1\n end\n result = []\n hash.each { |x,y|\n if y == hash.values.max\n result.push(x)\n end\n }\n return result\nend",
"def factorize\n x = self\n o = []\n loop do\n break unless (c = (2..x).find { |i| x % i == 0 })\n x /= c\n o << c\n end\n o\n end",
"def odd_factors(n)\n\tfmax = Math.sqrt(n).div(1)\n\tfs = []\n\ti = 1\n\t# search for factors\n\twhile 2*i + 1 < fmax\n\t\tfact = 2 * i + 1\n\t\tif n % fact == 0\n\t\t\tfs.push(fact)\n\t\t\tfs.push(n / fact)\n\t\tend\n\t\ti = i + 1\n\tend\n\t# check for factors\n\tif not fs.empty?\n\t\tfs.sort!\n\telse\n\t\tfs = nil\n\tend\n\tfs\nend",
"def halvsies(array)\n length = array.length\n new_array = []\n\n if length.odd?\n new_array << array.first(length / 2 + 1)\n new_array << array.last(length / 2)\n else\n new_array << array.first(length / 2)\n new_array << array.last(length / 2)\n end\n\n new_array\nend",
"def new_max array_of_elements\n\ti = 0\n\tlargest = array_of_elements[0]\n\twhile i < array_of_elements.length do\n\t\tif array_of_elements[i] > largest\n\t\t\tlargest = array_of_elements[i]\n\t\tend\n\t\ti += 1\n\tend\n\tlargest\nend",
"def maximal_proper_divisors\n\t\tndf = self.num_distinct_factors\n\t\tif ndf <= 0\n\t\t\tif @trivial_factor.nil?\n\t\t\t\traise \"Factorization.maximal_proper_divisors: \" \\\n\t\t\t\t\t\"No factors have been inserted.\\n\"\n\t\t\telse\n\t\t\t\treturn []\n\t\t\tend\n\t\tend\n\n\t\tsave_trivial_factor = @trivial_factor\n\t\t@trivial_factor = nil\n\t\tn = self.unfactor\n\n\t\trv = [0] * ndf\n\t\tfor k in (0..(ndf-1))\n\t\t\trv[k] = n / @factors_and_multiplicities[k][0]\n\t\tend\n\t\trv.sort!\n\n\t\t@trivial_factor = save_trivial_factor\n\n\t\treturn rv\n\tend",
"def magic_array(array)\narray.flatten.reverse.map! {|i| i = i*2}.delete_if {|i| i.modulo(3) == 0}.uniq.sort\nend",
"def halvsies(arr)\n if arr.size == 0 then\n return [[], []]\n else\n split_point = (arr.size / 2.0).ceil - 1\n return [arr[(0..split_point)], arr[split_point+1..arr.length-1]]\n end \nend",
"def old_factors(num)\n factors = []\n (1..num).each do |i|\n if num % i == 0\n factors << i\n end\n end\n factors\nend",
"def halvsies(array)\n if array.size.even?\n arr1 = array.slice(0, (array.size / 2))\n arr2 = array.slice(array.size / 2, array.size)\n else\n arr1 = array.slice(0, (array.size / 2) + 1 )\n arr2 = array.slice((array.size / 2) + 1, array.size)\n end \n [arr1, arr2]\nend",
"def halvsies(array)\n result = []\n if array.size.odd?\n result << array[0..(array.size / 2)] << array[(array.size / 2 + 1)..-1]\n elsif array.size.even?\n result << array[0..((array.size / 2) - 1)] << array[(array.size / 2)..-1]\n end\n result\nend",
"def prime_factorization(n)\n new_arr = []\n (2...n).each do |i|\n if n % i == 0\n dividend = n / i\n return [*prime_factorization(i), *prime_factorization(dividend)]\n end\n end\n new_arr << n\nend",
"def max_sub_array(nums)\n return if nums.empty?\n\n max_so_far = Array.new(nums.length)\n max_so_far[0] = nums[0]\n\n (1...nums.length).each do |i|\n max_so_far[i] = [nums[i], nums[i] + max_so_far[i-1]].max\n end\n\n return max_so_far.max\nend",
"def even_nums(max)\n newArr = []\n i = 0\n while i <= max\n if i % 2 == 0\n newArr << i\n end\n i+=1\n end\n return newArr\n end",
"def prime_factors(number, array=[])\n 2.upto(number) do |factor|\n if number % factor == 0\n array << factor\n number /= factor\n prime_factors(number, array)\n break\n end\n end\n array\nend",
"def factors(num)\n arr = []\n for i in 1..num\n if num%i == 0\n arr << i\n end\n end\n arr\nend",
"def factors(number)\n fs = [1,number]\n (2..Math.sqrt(number).to_i).each do |i|\n if number % i == 0\n fs << i\n fs << number/i unless number/i == i\n end\n end\n fs.sort\n end",
"def factors(num)\n arr = []\n (1..num).each { |n| arr << n if num%n==0}\n return arr\nend",
"def factors(num)\n arr = []\n (1..num).each do |el|\n arr << el if num % el == 0\n end\n arr\nend",
"def halvsies(array)\n result = []\n size = array.size\n if size.even?\n result << first_half = array.shift(size/2)\n result << second_half = array.shift(size/2)\n else\n result << first_half = array.shift(size/2+1)\n result << second_half = array.shift(size/2)\n end\nend",
"def largest_prime_factor(input)\n factors = []\n (1..input).each do |x|\n if input % x == 0\n factors << x\n x += 1\n else\n x == input\n break\n end\n end\nend",
"def clever(arr)\n\tlargest_fish = arr[0]\n\t(1..arr.length-1).each do |i|\n\t\tif arr[i].length > largest_fish.length\n\t\t\tlargest_fish = arr[i]\n\t\tend\n\tend\n\tlargest_fish\nend",
"def halvsies(arr)\n first_half = arr.slice(0, (arr.size / 2.0).ceil)\n second_half = arr.slice(first_half.size, arr.size - first_half.size)\n [first_half, second_half]\nend",
"def largest_prime_factor(num)\n prime_factors = []\n (2..num).each do |n|\n prime_factors << n if prime?(n) && num % n == 0\n end\n prime_factors[-1]\nend",
"def evenly_divisible_values(array)\n array.permutation(2)\n .select { |a, b| (a % b).zero? }\n .map { |a, b| a / b }\nend",
"def max_2_sum arr\n size = arr.length\n case size\n when 0\n return 0\n when 1\n return arr[0]\n else\n return arr.sort!.last(2).inject(0){|s, r| s+r}#sorts arr in Asc. order and saves, takes the last 2, black accumulator on those last 2 e's returned\n end\nend",
"def max_2_sum(array)\n array_size = array.size\n case array_size\n when 0\n 0\n when 1\n array[0]\n else\n array.sort!.last(2).inject(:+)\n\n end\nend",
"def solution(arr)\n dp = Array.new(arr.max+2, 0)\n arr.each { |a| dp[a] += 1 }\n\n for i in 2...dp.size do\n dp[i] = [dp[i-2] + i*dp[i], dp[i-1]].max\n end\n dp.last\nend",
"def halvsies(arr)\n arr.partition.with_index { |_, idx| idx <= (arr.length / 2.0).ceil - 1 }\nend",
"def max_sub_array(arr)\n current_sum = arr[0]\n max_sum = current_sum\n\n arr[1..-1].each do |num|\n current_sum = [num, current_sum + num].max\n max_sum = [max_sum, current_sum].max\n end\n\n return max_sum\nend",
"def majority(array)\n \n array.sort!\n puts array[array.length/2]\n \n end",
"def array_mode(array)\n new_array = Array.new\n freq = Hash.new\n max_count = 1\n\n array.each do |i|\n if freq.include? (i)\n freq[i] += 1\n if freq[i] > max_count\n max_count = freq[i]\n end\n else\n freq[i] = 1\n end\n end\n freq.each {|k,v| new_array.push(k) if v == max_count}\n new_array\nend",
"def factors(num)\n array = []\n (1..num).each do |x|\n if num % x == 0\n array << [x, num/x]\n end\n end\n array\nend",
"def arr_max (arr)\n arr.sort! { |x,y| y <=> x}\n arr.first()\nend",
"def largest(array)\nend",
"def convertFracts(fraction_array)\n least_common_multiple = fraction_array.transpose { |x, y, z| [x, y, z] }[1].reduce(1, :lcm)\n \n fraction_array.map do |numer, denom|\n [numer*least_common_multiple/denom, least_common_multiple]\n end\nend",
"def halvsies(arr)\n size = arr.size\n first_half_size = size.odd? ? (size / 2) + 1 : size / 2\n\n result_arr = []\n\n result_arr << arr.slice(0, first_half_size)\n result_arr << arr.slice(first_half_size, size / 2)\n\n result_arr\nend",
"def factor(num)\n\tcurrent_factor = num/2\n\tfactors = []\n\tfactors << num\n\twhile current_factor > 0\n\t\tif num%current_factor == 0\n\t\t\tfactors << current_factor\n\t\t\tcurrent_factor -= 1\n\t\telse\n\t\t\tcurrent_factor -= 1\n\t\tend\n\tend\n\t\n\treturn factors\nend",
"def factors n\n 1.upto(Math.sqrt(n)).select{ |x| (n % x).zero?}.inject([]) do |arr,x|\n arr << x\n arr << n/x unless x == n/x\n arr.sort\n end\nend",
"def halvsies(arr)\n arr_1 = []\n arr_2 = []\n\n if arr.size.odd?\n arr_1 = arr.shift((arr.size / 2) + 1)\n arr_2 = arr\n else\n arr_1 = arr.shift(arr.size / 2 )\n arr_2 = arr\n end\n\n [arr_1, arr_2]\nend",
"def factors_of(num) # Define method with one param\n \n i = 1 # To prevent dividing by zero start at one because of future modula expression\n new_array = [] # Create and empty array to shovel numbers while they meet requirements of the if statement\n \n while i <= num \n \n if num % i == 0 # Parameter entered must be a factor of i since we are cycling through iterations and i is incrementing upwards\n \n new_array << i # Shovel iterations that fulfill logical conditions\n end\n \n i += 1 # Increment up 1 at a time\n end\n return new_array # Prints array after while loop ends; while loop conditions are met\n\nend",
"def stretch(arr)\n # new empty array\n new_arr = []\n # go through each element\n arr.each do |number|\n # if even, divide by two\n if number % 2 == 0\n new_arr << (number / 2)\n new_arr << (number / 2) # this isn't DRY, I think\n # if odd, subtract one, divide by two. Add one to the first half\n else\n new_arr << (((number - 1) / 2) + 1)\n new_arr << ((number - 1) / 2) # DRY-ness issue here, maybe\n # store both halves\n end\n end\n # return new array\n return new_arr\nend",
"def halvsies(array)\n half1 = array.slice(0, (array.size / 2.0).ceil)\n half2 = array.slice(half1.size, array.size - half1.size)\n [half1, half2]\nend",
"def largest_prime_factor(current_number)\n\tprime_factors = []\n\ti = 2\n\twhile current_number > 1\n\t\twhile current_number % i == 0\n\t\t\tprime_factors << i\n\t\t\tcurrent_number /= i\n\t\tend\n\t\ti += 1\n\tend\n\treturn prime_factors.last\nend",
"def greatest_common_factor( num1, num2)\n\n gcf = 1 # all numbers share 1 as a common factor\n\n array1 = [] # stores all factors of num1\n array2 = [] # stores all factors of num2\n\n common_factors_array = [] # stores common factors of both numbers\n\n i = 1\n while( num1 >= i ) # putting all factors of num1 into array1\n\n if( num1 % i == 0 )\n array1.push(i)\n end\n\n i += 1\n end\n\n p array1\n\n j = 1\n while( num2 >= j ) # putting all factors of num2 into array2\n\n if( num2 % j == 0 )\n array2.push(j)\n end\n\n j += 1\n end\n\n p array2\n\n\n # START\n # collect all common factors of both numbers\n\n # num1 > num2 ? limit = num1 : limit = num2\n # k = 0\n # while( limit > k) # use largest num parameter as limit\n # end\n #\n # abandoned the above way of collecting matching elements from array1 and array2\n\n # take the INTERSECT of array1 and array2\n # source: https://stackoverflow.com/questions/5678108/how-can-i-get-the-intersection-union-and-subset-of-arrays-in-ruby\n\n common_factors_array = array1 & array2\n\n p common_factors_array\n\n # collect all common factors of both numbers\n # END\n\n # Find the largest number in the array i.e. common_factors_array:\n #\n # ASUMPTION !!!\n #\n # Asumming always the last element of common_factors_array !!!!!\n\n if( common_factors_array[common_factors_array.length - 1] != nil )\n gcf = common_factors_array[common_factors_array.length - 1]\n end\n\n p \"The common factor of #{num1} and #{num2} is #{gcf}.\"\n return gcf\n\nend",
"def array_of_ints(arr)\n return arr[0] * arr[1] * arr[2] if arr.length == 3\n\n comp_arr = arr.pop(3).sort\n\n arr.each do |num|\n if num > comp_arr[2]\n comp_arr.push(num)\n comp_arr.shift\n elsif num > comp_arr[1]\n comp_arr[0] = comp_arr[1]\n comp_arr[1] = num\n elsif num > comp_arr[0]\n comp_arr[0] = num\n end\n end\n comp_arr[0] * comp_arr[1] * comp_arr[2]\n\nend",
"def halvsies(array)\n first_half = []\n both_halves = []\n\n if array.size == 1 || array.size == 0\n both_halves << array\n both_halves << first_half\n elsif array.size / 2 == 0\n ((array.size) / 2).times do\n first_half << array.shift\n end\n both_halves << first_half\n both_halves << array\n else\n (((array.size - 1) / 2) + 1).times do\n first_half << array.shift\n end\n both_halves << first_half\n both_halves << array\n end\n both_halves\nend",
"def mode(array)\r\n new_hash = Hash.new(0)\r\n output = []\r\n \r\n array.each do |i|\r\n new_hash[i] += 1\r\n end\r\n \r\n new_hash.each do |i, j| \r\n if new_hash.values.max == j\r\n output << i\r\n end\r\n end\r\n output\r\nend",
"def Division(num1,num2)\n factors = []\n (1..10**3).each {|idx| factors << idx if (num1 % idx == 0 && num2 % idx == 0)}\n factors.max\nend",
"def proper_factors(n)\n f = []\n 1.step((n/2).to_i, 1).each do |x|\n if n % x == 0\n f.push(x)\n end\n end\n f.sort\nend",
"def max_inject(*num_arr)\n num_arr.inject {|acc, el| [acc, el].max }\nend"
] |
[
"0.8836459",
"0.87917525",
"0.8729955",
"0.8707655",
"0.8694197",
"0.84164226",
"0.83076316",
"0.8300444",
"0.7347033",
"0.7161948",
"0.70328724",
"0.6909982",
"0.66231513",
"0.65164655",
"0.65054137",
"0.65020794",
"0.6449267",
"0.6411552",
"0.6376486",
"0.6335429",
"0.62911963",
"0.6260228",
"0.62167585",
"0.621534",
"0.62151784",
"0.62096393",
"0.6199787",
"0.6179905",
"0.61796653",
"0.6168465",
"0.615457",
"0.6148624",
"0.6141617",
"0.61186856",
"0.6118544",
"0.61123186",
"0.61065453",
"0.61022604",
"0.6098724",
"0.60865575",
"0.60794604",
"0.6069744",
"0.6064824",
"0.60623074",
"0.6021244",
"0.6013266",
"0.60089344",
"0.5998773",
"0.5996161",
"0.59911233",
"0.5987517",
"0.596888",
"0.59520864",
"0.5928838",
"0.59266424",
"0.59154385",
"0.59025043",
"0.5899992",
"0.5899729",
"0.58993506",
"0.588937",
"0.5883572",
"0.5882572",
"0.5881991",
"0.58748823",
"0.58696204",
"0.58695465",
"0.5867167",
"0.5857586",
"0.58486766",
"0.5848337",
"0.58476",
"0.58452606",
"0.5844765",
"0.58441544",
"0.5834016",
"0.5831165",
"0.5830805",
"0.5827682",
"0.58266306",
"0.582635",
"0.5823225",
"0.582239",
"0.58179355",
"0.5814073",
"0.58109134",
"0.58103997",
"0.5809726",
"0.5807964",
"0.5806438",
"0.5803725",
"0.58033997",
"0.5801049",
"0.58006203",
"0.5798254",
"0.57895184",
"0.5788456",
"0.5788246",
"0.57871026",
"0.5785829"
] |
0.84255236
|
5
|
def greatest_factor(num) i = num 1 while i > 0 return i if num % i == 0 i = 1 end i end
|
def greatest_factor(num)
(2...num).reverse_each { |i| return i if num % i == 0}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def greatest_factor(num)\n\n return num / 2\n\nend",
"def largest_prime_factor(num)\n (1..num).reverse_each do |factor|\n if num % factor == 0 && prime?(factor)\n return factor\n end\n end\nend",
"def largest_prime_factor(num)\n i = num - 1\n\n while i > 1 \n if is_prime?(i) && num % i == 0\n return i \n end\n i -= 1\n end\n \n num\nend",
"def largest_prime_factor(num)\n i = num\n while i > 0\n if num%i == 0 && prime?(i)\n return i\n end\n i -= 1\n end\nend",
"def largest_prime_factor(num)\n track = 0\n (num).downto(2).each do |factor|\n \n if num % factor == 0 && prime?(factor)\n return factor\n end\n end\n \nend",
"def largest_prime_factor(num)\n counter = 2\n biggestFactor = 0\n while (counter * counter) <=num\n if num % counter == 0\n num = num / counter\n biggestFactor = counter\n else\n counter+=1\n end\n end\n\n if (num > biggestFactor)\n biggestFactor = num\n end\n biggestFactor\nend",
"def largest_prime_factor(num)\n (2..num).reverse_each do |factor|\n if (num % factor == 0 && Prime.prime?(factor))\n return factor\n end\n end\nend",
"def largest_prime_factor(num)\n num.downto(1).each do |divisor|\n if num % divisor == 0 && isprime?(divisor)\n return divisor\n end\n end\n return 1\nend",
"def largest_factor(n)\n\n result = nil\n (1 .. n/2).each do |d|\n if n % d == 0\n result = d\n end\n end\n\n result\nend",
"def largest_prime_factor(num)\n num.downto(2) do |i|\n return i if (num % i).zero? && prime(i)\n end\nend",
"def largest_prime_factor(num)\n i = num - 1\n while i >= 2\n if num % i == 0 && is_prime?(i) == true\n return i\n end\n i -= 1\n end\n num\nend",
"def largest_prime_factor_of(num)\n max = num\n test = 3\n best = 1\n\n while (max >= test) do\n if max % test == 0\n best = test\n max = max / test\n else\n test += 2\n end\n end\n best\nend",
"def largest_prime_factor(num)\n largest = num\n variable_num = 2\n\n while variable_num < largest\n while largest % variable_num == 0 && largest != variable_num\n largest = largest / variable_num\n end\n variable_num += 1\n end\n return largest\nend",
"def largest_prime_factor(num)\n num.downto(1) do |n|\n if num % n == 0 && prime?(n)\n return n\n end\n end\nend",
"def largest_prime_factor(num)\n\ti=2 \n\tquotient = 0\n\twhile(quotient != 1) do\n\t\ti +=1\n\t\tif(is_prime?(i) && (num % i == 0))\n\t\t\tdivisor = quotient == 0 ? num : quotient\n\t\t\tquotient = divisor / i\n\t\tend\t\n\tend\n\treturn i \nend",
"def largestPrimeFactor(num)\n\t(2..num).each do |n|\n\t\treturn num if num <= n\n\t\tnum /= n if (num > n && num % n == 0)\n\tend\nend",
"def largest_prime_factor(num)\n divisor = 1\n\n (2..num).each do |i|\n if num % i == 0 && is_prime?(i)\n divisor = i\n end\n end\n\n divisor\nend",
"def largest_prime_factor(number)\n factor = 1\n\n while factor <= number\n if number % factor == 0\n return number / factor if is_prime?(number / factor)\n end\n factor += 1\n end\nend",
"def largest_prime_factor(num) \n num.downto(2).each do |factor|\n if num % factor == 0 && isPrime(factor)\n return factor\n end\n end\nend",
"def largest_prime_factor(num)\n num.prime_division.last[0]\n end",
"def largest_prime_factor(num)\n divisors = []\n (2..num).each do |divisor|\n if num % divisor == 0\n if prime?(divisor)\n divisors << divisor\n end\n end\n end\n divisors[-1]\nend",
"def largest_prime_factor(num)\n big = 0\n prime = 0\n \n return false if num < 2\n\n # num is the only prime\n return num if prime?(num)\n \n # loops in reverse and returns the largest and first divisible prime\n j = num - 1\n while j > 1\n if num % j == 0 && prime?(j)\n return j\n end\n j -= 1\n end\nend",
"def largest_prime_factor(num)\n return nil if num <= 1\n (2..num).reverse_each do |n|\n return n if prime?(n) && num%n == 0\n end\nend",
"def largest_prime_factor (num)\n largest = 1\n (2..num).each do |ele|\n if num % ele == 0 && prime?(ele) && largest < ele\n largest = ele\n end\n end\n return largest\nend",
"def largest_prime_factor(number)\n prime = 2\n max = 1\n while (prime <= number)\n if(number % prime == 0)\n max = prime\n number = number/prime\n else\n prime += 1\n end\n end\n max\nend",
"def max_prime_factor(num)\n return num if num == 1 || num < 1\n max_num = (num ** 0.5 + 1).to_i\n f = (2..max_num).find { |x| num % x == 0 } || num\n [f, max_prime_factor(num / f)].max\nend",
"def largest_prime_factor(n)\n i = 2\n largest = 0\n while i <= n\n if n % i == 0\n while n % i == 0\n n = n / i\n largest = i\n i += 1\n end\n end\n i += 1\n end\n return largest\nend",
"def largest_factor(n)\n arr = []\n num = 1\n while num < n \n if n % num == 0\n arr << num \n end\n num+=1\n end\n arr[-1]\nend",
"def largest_prime_factor(num)\n factors = []\n half_of_num = num / 2\n\n (2..half_of_num).each do |factor|\n if num % factor == 0\n factors << factor\n num = num / factor\n end\n end\n factors.max\nend",
"def largest_prime_factor(num)\n lnum = nil\n (2..num).each do |factor|\n if num % factor == 0 && prime?(factor)\n lnum = factor\n end\n end\n lnum\nend",
"def largest_prime_factor(num)\n factors = (1..num).select { |factor| num % factor == 0}\n large_prime = factors.reverse.select { |i| return i if prime?(i)}\nend",
"def largest_prime_factor(num)\n \n (1..num).inject do |largest_factor, factor|\n if num % factor == 0 && prime?(factor)\n largest_factor = factor\n else\n largest_factor\n end\n end\nend",
"def largest_prime_factor(num)\n\n def prime?(num)\n return false if num < 2\n\n (2...num).each do |n|\n if num % n == 0\n return false\n end\n end\n\n true\n end\n\n if prime?(num)\n return num\n end\n\n (num.downto(2)).each do |i|\n if prime?(i) && num % i == 0\n return i\n end\n end\nend",
"def largest_prime_factor(number)\n # divide by the smallest prime number (2) until\n # number is no longer divisble by the given prime number\n\n # iterate to the next (prime) number\n # divide and repeat\n # the forumula will return the largest prime factor\n\n prime_number = 2\n counter = 0\n\n while prime_number != number\n if number % prime_number == 0\n number /= prime_number\n else\n prime_number += 1\n end\n \n end\n prime_number\nend",
"def largest_prime_factor(num)\n (0..num).reduce { |acc, n| prime?(n) && (num % n).zero? ? n : acc }\nend",
"def largest_prime_factor(num)\n return num if prime?(num)\n\n prime_factors(num).max\nend",
"def get_largest_prime_factor num\n get_largest_number(prime_factor_numbers(num))\nend",
"def largest_prime_factor num\n divisors = []\n max = 0\n\n (1..num).each { |el| divisors << el if num % el === 0 && isPrime(el)}\n\n max = divisors[0]\n\n divisors.each do |el|\n max = el if el > max \n end\n\n max\nend",
"def largest_prime_factor(number)\n\tlargest_pfactor = number\n\tfactor = 2\n\twhile(factor <= (largest_pfactor / 2)) do\n\t\tif(largest_pfactor % factor == 0)\n\t\t\tlargest_pfactor = largest_pfactor / factor\n\t\telse\n\t\t\tfactor = factor + 1\n\t\tend\n\tend\n\tlargest_pfactor\nend",
"def largest_prime_factor(n)\n divisor = 2\n while(divisor <= n)\n n%divisor == 0 ? n = n/divisor : divisor += 1\n end\n divisor\nend",
"def largest_prime_factor(num)\n return nil if num < 2\n (1..num).inject do |acc, fact|\n if num % fact == 0 && prime?(fact) && fact >= acc\n fact\n else\n acc\n end\n end\nend",
"def largest_factor(number)\n result = prime_factors(number).sort\n result[-1]\nend",
"def largest_prime_factor(num)\n factors = []\n\n (1..num).each do |i|\n if num % i == 0\n factors << i \n end\n end\n\n primes = []\n factors.each do |num|\n if is_prime?(num)\n primes << num \n end\n end\n\n primes.max\nend",
"def largest_prime_factor(input)\n\n prime = input\n (2..Math.sqrt(input).to_i).each do |i|\n break if prime <= 1\n prime /= i while (prime > i && prime % i == 0)\n end\n prime\nend",
"def greatest_prime_factor(n)\n return false if n < 1\n divisor = Math.sqrt(n).floor\n\n while divisor>=2\n return divisor if prime?(divisor) && n%divisor==0\n divisor-=1\n end\n return false\nend",
"def largest_prime_factor(num)\n prime_factors = []\n (2..num).each do |n|\n prime_factors << n if prime?(n) && num % n == 0\n end\n prime_factors[-1]\nend",
"def largest_prime_factor\n number = 600851475143\n n = 2\n while n < number\n if number % n == 0\n factor = number / n\n return factor if is_prime?(factor)\n end\n n += 1\n end\nend",
"def largest_prime_factor(current_number)\n\tprime_factors = []\n\ti = 2\n\twhile current_number > 1\n\t\twhile current_number % i == 0\n\t\t\tprime_factors << i\n\t\t\tcurrent_number /= i\n\t\tend\n\t\ti += 1\n\tend\n\treturn prime_factors.last\nend",
"def largest_prime_factor(num)\n primes = []\n (1..num).each do |n|\n primes << n if num % n == 0 && is_prime?(n)\n end\n primes.max\nend",
"def my_largest_prime(num)\n counter = 2\n until num == 1\n if num % counter == 0\n sol = counter\n num /= counter\n else\n counter += 1\n end\n end\n return sol\nend",
"def greatest_common_factor(number1, number2)\n\t\n\tgreatest_num = nil\n\ti = 1\n\t\n\twhile i < 10\n\t\n\t if number1 % i == 0 && number2 % i == 0\n\t \n\t if greatest_num == nil || greatest_num < i\n\t \tgreatest_num = i\n\t\n end\n end\n\t\t\n\ti += 1\n end\n return greatest_num\n \nend",
"def largest_prime_factor(number)\n\tfactors = []\n\n\t(1...number).each do |i| \n\t\tif number % i == 0 && Prime.prime?(i)\n\t\t\tfactors.push(i)\n\t\tend\n\tend\n\tfactors.last\nend",
"def greatest_common_factor(number1, number2)\n\n if number1 < number2\n smallest = number1\n largest = number2\n elsif number2 < number1\n smallest = number2\n largest = number1\n else \n puts 'Numbers must de different.'\n end \n\n factor = smallest\n\n while factor > 0\n if largest % factor == 0 && smallest % factor == 0\n puts factor # debug\n return factor\n else\n factor -= 1\n end\n \n end\nend",
"def greatest_factor_array(arr)\n arr.map do |num|\n if num.even?\n gf = 0\n (1...num).each{|f| gf = f if num % f == 0}\n gf\n else\n num\n end\n end\nend",
"def prime_factors(num)\n factors = num.prime_division\n factors.to_a\n largest_factor = factors[-1][0]\n p largest_factor\nend",
"def max_factor(n)\n\tfactors = [1, n]\n\tidx = 2\n\twhile idx < factors[-1]\n\t\tif factors[-1] % idx == 0\n\t\t\tnew = factors[-1] / idx\n\t\t\tfactors.pop\n\t\t\tfactors.push(idx)\n\t\t\tfactors.push(new)\n\t\t\tidx = 1\n\t\tend\n\t\tidx += 1\n\tend\n\treturn factors[-1]\nend",
"def largest_prime_factor( x ) \n require 'mathjb'\n primes = primes_below(x)\n i = 0\n \n until primes.include?(x)\n div = primes[i]\n if x % div == 0 then\n x /= div #if div is a factor of x, set x to x / div\n i = 0\n else\n i += 1\n end\n end\n return x\nend",
"def largest_prime(num)\n largest_prime = 0\n i = 2\n while i * i <= num\n if num % i == 0\n num /= i\n largest_prime = i\n else\n i += 1\n end\n end\n\n if num > largest_prime\n largest_prime = num\n end\n\n largest_prime\nend",
"def highest_prime_of(factors)\n factors.each do |factor|\n if check_prime(factor)\n return factor\n end\n end\nend",
"def largest_pfactor(number)\n i=2\n\n while i<=number\n\n if i==number\n puts number\n elsif number%i == 0\n number=number/i\n puts i\n i=2\n end\n\n if i%2==0\n i+=1\n else\n i+=2\n end\n\n end\n\nend",
"def highest_possible_factor\n Math.sqrt(number)\n end",
"def highest_possible_factor\n Math.sqrt(number)\n end",
"def largest_prime_factor(input)\n lpf = 2\n\n while lpf < input\n\n if input % lpf == 0\n\n input = input / lpf\n lpf = 2\n else\n lpf += 1\n end\n end\n\n return lpf\nend",
"def largestPrimeFactor\n\tn = 600851475143\n\tfactor = 2\n\tlastFactor = 1\n\n\twhile n > 1\n\t\tif n % factor == 0\n\t\t\tlastFactor = factor\n\t\t\tn /= factor\n\t\t\twhile n % factor == 0\n\t\t\t\tn /= factor\n\t\t\tend\n\t\tend\n\n\t\tfactor += 1\n\tend\n\n\tputs(lastFactor)\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_prime_factor(input)\n factors = []\n (1..input).each do |x|\n if input % x == 0\n factors << x\n x += 1\n else\n x == input\n break\n end\n end\nend",
"def largest_prime_factor(input)\n prime = input\n (2..Math.sqrt(input).to_i).each do |i|\n # Here we use the square root function to cut our range down drastically\n break if prime <= 1\n while (prime > i && prime % i == 0) do\n prime /= i\n puts \"prime - #{prime}, i - #{i}\"\n end\n end\n prime\nend",
"def greatest_factor_array(arr)\n factors = []\n\n arr.each_with_index do |num, idx|\n if num % 2 == 0\n (1...num).each do |x|\n if num % x == 0\n factors << x\n end\n end\n arr[idx] = factors[-1]\n end\n end\n\n return arr\n\nend",
"def larget_prime_factor(n)\n temp = n\n largest = 0\n div = 2\n\n while temp >= div * div\n if temp % div == 0\n temp /= div\n else\n div += 1\n end\n end\n\n largest = temp if temp > largest\n return largest\nend",
"def greatest_common_factor(number1, number2)\n new = number1.to_i\n number2 = number2.to_i\n while number1 > 0\n if (number1 % new == 0.0) && (number2 % new == 0.0)\n return new\n end\n new -= 1.0\n end\nend",
"def largest_prime_factor n\n max_prime = -1\n i = 3\n # check if n is product of 2's. then the max prime is 2. and n will be 1 at the end.\n while n % 2 == 0\n max_prime = 2\n n /= 2\n end\n\n #if n is produc of 3's , then the max prime is 3, and n will be 1 at the end.\n #if n is not product of 3's, it contains other prime factors. these factors must be greater\n #than 3 because we alreay excluded 2's in the previous step. and we have excluded 2's multiples in the\n #previous steps, so only need to check the odd numbers for possible factors.\n while i*i <= n\n while n % i == 0\n max_prime = i\n n /= i\n end\n i += 2\n end\n\n if n > 2\n max_prime = n\n end\n max_prime\nend",
"def greatest_common_factor(a, b)\n a, b = b, a%b until b == 0\n a\nend",
"def largest_prime_factor(num,prime_factors,recursive)\n candidate = 2\n until candidate >= Math.sqrt(num)\n recursive = false\n if num % candidate == 0\n num = num / candidate\n recursive = true\n prime_factors << candidate\n largest_prime_factor(num,prime_factors,recursive)\n end\n break if recursive\n candidate == 2 ? candidate += 1 : candidate += 2\n end\n prime_factors << num unless recursive\n prime_factors.last\nend",
"def largest_prime_factor(num)\n puts \"num = #{num}\"\n Prime.first(num).select {|i| i}\nend",
"def largest_odd_factors(nums)\r\n\r\nend",
"def find_highest_prime_factor(n)\n # Read http://joezack.com/index.php/2009/01/15/project-euler-problem-3-in-ruby/ - which points out you can\n # stop searching at the square root of a number. Speedup!\n (Math.sqrt(n).ceil).downto 2 do |i|\n if n % i == 0 && find_highest_prime_factor(i) == 1\n return i\n end\n end\n 1\nend",
"def largest_prime_factor(num)\n #prime_division returns an array of 2 element arrays containing prime factorization - [[2, 1], [5, 2]]\n #flat_map contatenates the 2 element arrays into a single array [2, 5, 5]\n array = Prime.prime_division(num).flat_map { |factor, power| [factor] * power }\n\n largest = 0\n array.each do |i|\n if i > largest\n largest = i\n end\n end\n return largest\nend",
"def find_largest_prime(integer)\n factor_array = []\n potential_factor_array = (2..integer).to_a\n potential_factor_array.each do |factor|\n if integer % factor == 0\n factor_array << factor\n end\n end\n largest_factor = factor_array.last\n potential_factor_array = (2..largest_factor).to_a\n potential_factor_array.each do |potential_factor|\n factor_array.each do |factor|\n if factor != potential_factor && factor % potential_factor == 0\n factor_array.delete(factor)\n end\n end\n end\n p factor_array.last\nend",
"def largest_prime(number)\n is_prime = false\n current_num = number\n divisor = 2\n max_prime = 1\n\n while is_prime != true && divisor <= current_num\n if current_num % divisor === 0\n current_num /= divisor\n if divisor > max_prime\n max_prime = divisor\n end\n divisor = 2\n else\n divisor += 1\n end\n\n if divisor > current_num\n is_prime = true\n end\n end\n\n puts max_prime\n return max_prime\nend",
"def factorize(test_number)\n return [] if test_number == 1\n divisor = 2\n factor_array = []\n while test_number > 1\n while (test_number % divisor) == 0\n factor_array << divisor\n test_number /= divisor\n end\n divisor += 1\n end\n return factor_array.max\nend",
"def greatest_common_factor(num1, num2)\n divisor = 1\n 2.upto([num1.abs, num2.abs].min) do |num|\n if num1 % num == 0 && num2 % num == 0\n divisor = num\n end\n end\n divisor\nend",
"def highest_prime_number_under(number)\n until is_prime?(number)\n number -= 1\n end\n number\nend",
"def highest_prime_number_under(number)\n counter = number\n number.times do\n if is_prime?(counter)\n p counter\n break\n else\n counter -= 1\n end\n end\nend",
"def primo_factor(number)\t\n\n\tresult =[]\n\n\twhile number != 1\n\t\tfor i in 2..10000\n\t\t\tif number % i == 0 && number > 1\n\t\t\t\tresult << i\n\t\t\t\tnumber = number/i\t\t\t\n\t\n\t \t\tend\n\t\tend\n\tend\n\tputs \"The largest prime factor of #{number} is #{result.inspect}. Congrats!\"\n\nend",
"def largest_prime_factor(n)\n recursive_prime_factors(n)\n PRIMES.keys.sort().last\nend",
"def greatest_factor_array(arr)\n\tlargest = []\n \tarr.each do |num|\n if num % 2 == 0\n largest << (num/2)\n else\n largest << num\n end\n end\n return largest\nend",
"def largest_prime_factor(n, r = [])\n prime = Prime.lazy\n r = r || []\n if n.prime?\n r << n\n return r\n else\n factor = prime.find { |j| n % j == 0 } # 用find,找到第一个就结束\n r << factor\n prime.rewind\n largest_prime_factor (n / factor), r\n end\n r.max\nend",
"def solve(nums)\n largest = nums.sort[-1]\n until nums.all? {|num| num % largest == 0 }\n largest -= 1\n end\n return largest\nend",
"def greatest_factor_array(arr)\n arr.map do |el|\n if is_prime(el)\n el\n elsif el % 2 == 0\n el / 2\n else\n el\n end\n end\nend",
"def greatest_common_factor(number1, number2)\n\tif ((number1 || number2) == 0)\n\t\treturn 1\n\tend\n\tsmall_num = 0\n\tbig_num = 0\n\tif number1 < number2\n\t\tsmall_num = number1\n\t\tbig_num = number2\n\telse \n\t\tsmall_num = number2\n\t\tbig_num = number1\n\tend \n\t\n\ti = 1\n\tfactors = []\n\twhile i <= small_num\n\t\tif small_num%i == 0\n\t\t\tfactors.push(i)\n\t\tend\n\t\ti+=1\n\tend\n\n\tj = 0\n\tbig_factors = []\n\twhile j < factors.length\n\t\tif big_num%factors[j] == 0\n\t\t\tbig_factors.push(factors[j])\n\t\tend\n\t\tj +=1\n\tend\n\tif big_factors[((big_factors.length)-1)] != nil\n\t\treturn big_factors[((big_factors.length)-1)]\n\telse\n\t\tputs \"#{number1} and #{number2} have no common factors\"\n\tend\nend",
"def factor(num)\n (1..num).select { |f| (num % f).zero? }\nend",
"def highest_prime_number_under(number)\n prime = number - 1\n counter = 1\n until is_prime?(prime)\n prime -= 1\n end\n return prime\n end",
"def largest_prime(int)\n def is_prime?(int)\n div = 2\n until div >= int\n return false if int % div == 0\n div += 1\n end\n true\n end\n remainder = int\n divider = 2\n prime_factors = []\n while divider < remainder\n if remainder % divider == 0 && is_prime?(divider)\n prime_factors << divider\n remainder /= divider\n end\n divider += 1\n end\n prime_factors << remainder\n puts prime_factors\n prime_factors.max\nend",
"def highest_prime_number_under(number)\n highest_prime = 0\n for num in 1..number\n if is_prime?(num) && num > highest_prime\n highest_prime = num\n end\n end\n return highest_prime\nend",
"def largest_prime(n)\n i = 2\n largest = 0\n while (i <= n)\n if (n % i == 0)\n while (n % i == 0 )\n n = n / i\n largest = i\n puts \"I am n #{n}\"\n puts \"I am i #{i}\"\n i += 1\n end\n end\n i += 1\n end\n return largest\nend",
"def greatest_common_factor(first_number, second_number)\n x, y = first_number, second_number\n n = x < y ? x : y\n n.downto(1).each do |i|\n if x % i == 0 and y % i == 0\n return i\n end\n end\n 1\nend",
"def max_multiple(divisor, bound)\n #your code here\n x = bound \n result = nil\n\n while result == nil do \n if x % divisor == 0\n result = x \n end\n x -= 1\n end\n return result\nend",
"def primeFactors(x)\n\tlargestFactor = 1\n\tcurrentFactor = 1\n\twhile currentFactor <= x # limit of the problem\n\t\tif x % currentFactor == 0 \n\t\t\tx = x / currentFactor\n\t\t\tif currentFactor > largestFactor\n\t\t\t\tlargestFactor = currentFactor\n\t\t\t\tcurrentFactor = 0\n\t\t\tend\n\t\tend\n\t\tcurrentFactor += 1\n\tend\n\treturn largestFactor\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 largest_prime_number(upper)\n answer = 2\n point = 3\n divisor = upper\n\n divisor /= 2 while divisor.even?\n\n while divisor != 1\n while (divisor % point) == 0\n answer = point\n divisor /= point\n end\n point += 2\n end\n answer\nend"
] |
[
"0.85741186",
"0.84822124",
"0.84734887",
"0.8472704",
"0.8405489",
"0.8399634",
"0.83548445",
"0.8351933",
"0.8349145",
"0.8347489",
"0.83375645",
"0.8337106",
"0.83363426",
"0.83282256",
"0.8323962",
"0.82846737",
"0.82792395",
"0.8270532",
"0.822819",
"0.8191237",
"0.81531256",
"0.81381017",
"0.81031907",
"0.81024766",
"0.809419",
"0.80838615",
"0.8082421",
"0.8053059",
"0.8052831",
"0.8037847",
"0.8034621",
"0.8027924",
"0.80238825",
"0.8022636",
"0.8014245",
"0.801244",
"0.79976714",
"0.79954517",
"0.7994545",
"0.7989032",
"0.7983553",
"0.79303217",
"0.78951544",
"0.78899336",
"0.7886641",
"0.7876831",
"0.78371316",
"0.7835982",
"0.78283423",
"0.78116256",
"0.7806426",
"0.7774684",
"0.77640945",
"0.7756494",
"0.7748393",
"0.77446496",
"0.77436525",
"0.76824176",
"0.76743233",
"0.7649343",
"0.7583087",
"0.7583087",
"0.75822127",
"0.75795496",
"0.7579466",
"0.7569835",
"0.75386155",
"0.7479238",
"0.7475461",
"0.74754107",
"0.7461493",
"0.74611664",
"0.7455088",
"0.74063355",
"0.7404216",
"0.7344092",
"0.7331525",
"0.7316104",
"0.7314792",
"0.7306707",
"0.72780716",
"0.72780365",
"0.7270535",
"0.72619355",
"0.72464716",
"0.7215808",
"0.7191231",
"0.71864986",
"0.71837187",
"0.718361",
"0.71817607",
"0.7181437",
"0.717518",
"0.7155907",
"0.71258014",
"0.7114546",
"0.70926577",
"0.70847696",
"0.7083784",
"0.70825887"
] |
0.93649787
|
0
|
From the Wikipedia article.
|
def play_rules_orig
<<~'HOWTOPLAY'
The word to guess is represented by a row of dashes,
representing each letter of the word.
In most variants, proper nouns, such as names, places, and brands,
are not allowed.
Slang words, sometimes referred to as informal or shortened words,
are also not allowed.
If the guessing player suggests a letter which occurs in the word,
the other player writes it in all its correct positions.
If the suggested letter does not occur in the word,
the other player draws one element of a hanged man stick figure
as a tally mark.
The player guessing the word may, at any time, attempt to guess
the whole word.
If the word is correct, the game is over and the guesser wins.
Otherwise, the other player may choose to penalize the guesser by
adding an element to the diagram.
On the other hand, if the other player makes enough incorrect guesses
to allow his opponent to complete the diagram, the game is also over,
this time with the guesser losing.
However, the guesser can also win by guessing all the letters that
appear in the word, thereby completing the word, before the diagram
is completed.
HOWTOPLAY
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def schubert; end",
"def who_we_are\r\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def formation; end",
"def schumann; end",
"def probers; end",
"def verdi; end",
"def terpene; end",
"def berlioz; end",
"def suivre; end",
"def ismn; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def malts; end",
"def desc; end",
"def jack_handey; end",
"def stderrs; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def offences_by; end",
"def herald; end",
"def nature; end",
"def p15\n\t\nend",
"def king_richard_iii; end",
"def dh; end",
"def romeo_and_juliet; end",
"def what_is\n end",
"def identify; end",
"def anchored; end",
"def buzzword; end",
"def buzzword; end",
"def trd; end",
"def tld; end",
"def tld; end",
"def most_interesting_man_in_the_world; end",
"def desc=(_); end",
"def sld; end",
"def rassoc(p0) end",
"def cardinal; end",
"def weber; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def specialty; end",
"def pos() end",
"def pos() end",
"def pos() end",
"def pos() end",
"def isp; end",
"def isp; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def gounod; end",
"def bs; end",
"def hd\n \n end",
"def real_name; end",
"def blg; end",
"def herebody_s; end",
"def feruchemist; end",
"def lsi; end",
"def name() end",
"def r; end",
"def r; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def desc() summary; end",
"def anatomy; end",
"def mambo_no_5; end",
"def scientist; end",
"def silly_adjective; end",
"def operations; end",
"def operations; end",
"def in_law; end",
"def informational?; end"
] |
[
"0.70568717",
"0.6638157",
"0.6624238",
"0.65795666",
"0.65795666",
"0.65795666",
"0.65795666",
"0.6546433",
"0.6523202",
"0.6513668",
"0.6462409",
"0.6373735",
"0.6276951",
"0.6211681",
"0.6208222",
"0.6204818",
"0.6204818",
"0.6204818",
"0.6204757",
"0.6194655",
"0.6185891",
"0.6131264",
"0.6120685",
"0.6120685",
"0.6120685",
"0.6120685",
"0.6113792",
"0.6113792",
"0.6113792",
"0.6113792",
"0.6113792",
"0.6113792",
"0.6111346",
"0.606271",
"0.60593617",
"0.60493594",
"0.6035978",
"0.6014542",
"0.60124904",
"0.60015935",
"0.5999251",
"0.59818184",
"0.59725666",
"0.59725666",
"0.5970298",
"0.5962507",
"0.5962507",
"0.5952535",
"0.5943302",
"0.5939816",
"0.5928298",
"0.5928242",
"0.5920453",
"0.59159803",
"0.59159803",
"0.59159803",
"0.59159803",
"0.59159803",
"0.59159803",
"0.59159803",
"0.59159803",
"0.5911223",
"0.58997995",
"0.58997995",
"0.58997995",
"0.58997995",
"0.58874035",
"0.58874035",
"0.58705366",
"0.58705366",
"0.58705366",
"0.58705366",
"0.58705366",
"0.58705366",
"0.58705366",
"0.58705366",
"0.58705366",
"0.58705366",
"0.5868909",
"0.58668864",
"0.5857559",
"0.58574384",
"0.5855916",
"0.5854259",
"0.5826583",
"0.5825597",
"0.5824055",
"0.5823572",
"0.5823572",
"0.581364",
"0.581364",
"0.581364",
"0.5809606",
"0.5809014",
"0.579304",
"0.5787831",
"0.5783547",
"0.5783398",
"0.5783398",
"0.5778093",
"0.5776005"
] |
0.0
|
-1
|
This is called by update_datum
|
def fetch_datum(company_number)
company_page = fetch_registry_page(company_number)
{:company_page => company_page}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def updated_data; end",
"def updated_data\n\tend",
"def update() end",
"def update ; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def set_datum\n @datum = Datum.find(1)\n end",
"def date() updated; end",
"def update\n \n end",
"def on_data_changed; end",
"def update(point)\n\t\t\t\t\n\t\t\tend",
"def after_update; end",
"def after_update; end",
"def update_values\n end",
"def update_values\n end",
"def engine_notify_datas_updated(datas_updated)\n end",
"def update\n \n end",
"def update(point)\n\t\t\n\tend",
"def update(point)\n\t\t\n\tend",
"def outdated; end",
"def update\n \t\n end",
"def update\n \t\n end",
"def update\n\t\t\n\t\tend",
"def update; end",
"def update;end",
"def update_fill\n end",
"def data\n super.dup.merge(date: date)\n end",
"def on_update; end",
"def update\r\n\r\n end",
"def save\n update_dc\n super \n end",
"def update()\n end",
"def update\n update_save(@sensor_datum, sensor_datum_params, \"Sensor datum\")\n end",
"def on_update(new_point)\n end",
"def update\r\n end",
"def _update_dataset\n this\n end",
"def _update_dataset\n this\n end",
"def set_doe_util_changes\n\n # there is no bldg_id column for sca projects\n buildings = self.school_buildings\n\n buildings_ids_array = buildings.map {|b| b['bldg_id']}.uniq\n\n doe_significant_utilization_changes = CeqrData::DoeSignificantUtilizationChanges.version(\n data_package.table_for(\"doe_significant_utilization_changes\")\n ).doe_util_changes_matching_with_building_ids(buildings_ids_array)\n\n self.doe_util_changes = doe_significant_utilization_changes.map do |d|\n {\n url: d[:url],\n title: d[:title],\n org_id: d[:org_id],\n bldg_id: d[:bldg_id],\n vote_date: d[:vote_date],\n at_scale_year: d[:at_scale_year],\n at_scale_enroll: d[:at_scale_enroll],\n bldg_id_additional: d[:bldg_id_additional]\n }\n end\nend",
"def _save_refresh\n super\n recalculate_values_hashes\n end",
"def update\n\t\t# Left empty intentionally.\n\tend",
"def update\n # Not generally used\n end",
"def update\n # Not generally used\n end",
"def touch_instance_value\n model.dataset.current_datetime\n end",
"def _refresh(dataset)\n super\n recalculate_values_hashes\n end",
"def update_visualization(point)\n\t\t\t\t\n\t\t\tend",
"def fill_from_gemo\r\n end",
"def update\n # TODO: implement update\n end",
"def after_update\n end",
"def after_update\n end",
"def refresh; end",
"def refresh_data\n raise NotImplementedError\n end",
"def update\r\n end",
"def update\r\n end",
"def update\r\n end",
"def update\r\n end",
"def initialize data\n super\n self['date'] = Time.at date / 1_000\n end",
"def updated(date_or_time = T.unsafe(nil)); end",
"def update\n\t\tend",
"def update\n\t\tend",
"def map_added_rpx_data( rpx_data )\n\n\t\t\tend",
"def value_written; end",
"def on_data_changed\n store_data(data_class.all_columns)\n end",
"def set_datum\n @datum = Datum.find(params[:id])\n end",
"def set_datum\n @datum = Datum.find(params[:id])\n end",
"def set_datum\n @datum = Datum.find(params[:id])\n end",
"def set_datum\n @datum = Datum.find(params[:id])\n end",
"def update \n end",
"def update \n end",
"def old_value; end",
"def update\n super\n end",
"def _update(*)\n fail NotImplementedError\n end",
"def clean_update(data, parameter_hash)\n\n factory = RGeo::Geographic.simple_mercator_factory(:srid => 4326)\n\n for item in data\n\n # Record event source\n item['miner_data_source'] = parameter_hash['source']\n\n\n # Clean Location Data for filtering before formatting\n raw_location = item[parameter_hash['location']]\n\n longitude = raw_location['coordinates'][0]\n latitude = raw_location['coordinates'][1]\n\n rgeo_point = factory.point(longitude, latitude)\n\n item['rgeo_location'] = factory.collection([rgeo_point])\n\n\n # Clean Time Field\n if parameter_hash['source'] == 'san_francisco'\n\n time = Time.strptime(item['time'], '%H:%M')\n date = DateTime.parse(item['date'])\n\n item['ruby_date_time'] = DateTime.new(date.year, date.month, \n date.day, time.hour, time.min, time.sec, time.zone)\n\n # Other 2 timefields are uniform\n else\n\n date_key = parameter_hash['fields']['date']\n\n no_utc_time = DateTime.parse(item[date_key])\n\n item['ruby_date_time'] = no_utc_time.new_offset('-08:00')\n\n end\n\n end\n\n return data\n\nend",
"def update\n ;\n end",
"def update_visualization(point)\n\t\t\n\tend",
"def update_visualization(point)\n\t\t\n\tend",
"def update_visualization(point)\n\t\t\n\tend",
"def update_visualization(point)\n\t\t\n\tend",
"def update(...)\n end",
"def before(datum); end",
"def before(datum); end",
"def stored_data; end",
"def after_save\n df = DataFile.find_by_id(self.orig_data_file_id)\n unless df.blank?\n df.annotations.each do |a|\n a.annotatable = self\n #need to call update without callbacks, otherwise a new version is created\n a.send(:update_without_callbacks)\n\n #versions for annotations are no longer enabled in SEEK - but this code is left here incase they are re-enabled in the future.\n a.versions.each do |av|\n av.annotatable =self\n av.save\n end\n end\n end\n super\n end",
"def set; end",
"def set; end",
"def before_update; end",
"def data\n update_data\n @data\n end",
"def update engine, time, dt\n end",
"def update!(**args)\n @dated_values = args[:dated_values] if args.key?(:dated_values)\n end",
"def update_data\n @store.get_data true\n end",
"def update\n #Nothing necessary\n end",
"def after_update(updated)\n # not required\n end",
"def update\n end",
"def update\n raise NotImplementedError\n end",
"def data= data \n end",
"def modified?; end",
"def update\n end"
] |
[
"0.75853646",
"0.71466297",
"0.69835305",
"0.6687196",
"0.65621424",
"0.65621424",
"0.65621424",
"0.65621424",
"0.65621424",
"0.65621424",
"0.65621424",
"0.65621424",
"0.64661646",
"0.64647764",
"0.6369933",
"0.636669",
"0.63366765",
"0.62973106",
"0.62973106",
"0.626755",
"0.626755",
"0.6202487",
"0.6197977",
"0.6154599",
"0.6154599",
"0.60572594",
"0.6054983",
"0.6054983",
"0.6027256",
"0.6014009",
"0.60087734",
"0.5996366",
"0.59499115",
"0.5942677",
"0.5898409",
"0.5888479",
"0.5876449",
"0.5867667",
"0.58644235",
"0.58641285",
"0.5851919",
"0.5851919",
"0.58484757",
"0.5848139",
"0.5845791",
"0.584286",
"0.584286",
"0.58360803",
"0.5835331",
"0.58224416",
"0.57968515",
"0.5796442",
"0.5796098",
"0.5796098",
"0.578532",
"0.5769905",
"0.5766781",
"0.5766781",
"0.5766781",
"0.5766781",
"0.57660735",
"0.57444257",
"0.57364076",
"0.57364076",
"0.5732068",
"0.5729893",
"0.57270175",
"0.5724975",
"0.5724975",
"0.5724975",
"0.5724975",
"0.5717864",
"0.5705351",
"0.56942606",
"0.56877005",
"0.5675615",
"0.5673006",
"0.56638026",
"0.5640089",
"0.5640089",
"0.5640089",
"0.5640089",
"0.56385845",
"0.5623529",
"0.5623529",
"0.56065065",
"0.5601941",
"0.55787265",
"0.55787265",
"0.5577474",
"0.5577066",
"0.55731034",
"0.55667806",
"0.55603874",
"0.55498016",
"0.55467105",
"0.5542337",
"0.5526228",
"0.5518524",
"0.5515479",
"0.55091214"
] |
0.0
|
-1
|
This overrides default save_entity (defined in RegisterMethods) and adds the inferred jurisdiction_code, unless it is overridden in entity_info
|
def save_entity(entity_info)
return if entity_info.blank?
default_options = {:jurisdiction_code => inferred_jurisdiction_code}
super(default_options.merge(entity_info))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def save\n if @entity\n before_save\n @entity.save\n end\n self\n end",
"def _save\n raise NotImplementedError, 'override #_save in a subclass'\n end",
"def save\n raise NotImplementedError\n end",
"def save\n self.metadata[:type] = :metagenome if !metadata[:tax].nil? and\n !metadata[:tax][:ns].nil? and metadata[:tax][:ns]==\"COMMUNITY\"\n self.metadata.save\n end",
"def save\n raise NotImplementedError\n end",
"def persist_new(entity)\n raise NotImplementedError, \"Abstract method\"\n end",
"def save_entity(entity)\n result = service.put(entity.path, entity)\n entity[:updatedAt] = result[:updatedAt]\n entity[:createdAt] = result[:createdAt]\n entity\n end",
"def save\n NotImplementedError\n end",
"def encode_entity(entity)\n Yajl::Encoder.encode(entity)\n end",
"def save\n raise NotImplemented\n end",
"def save(processed_map=ObjectMap.new) # use that in Reform::AR.\n processed_map[self] = true\n\n pre_save = self.class.pre_save_representer.new(self)\n pre_save.to_hash(:include => pre_save.twin_names, :processed_map => processed_map) # #save on nested Twins.\n\n\n\n # what we do right now\n # call save on all nested twins - how does that work with dependencies (eg Album needs Song id)?\n # extract all ORM attributes\n # write to model\n\n sync_attrs = self.class.save_representer.new(self).to_hash\n # puts \"sync> #{sync_attrs.inspect}\"\n # this is ORM-specific:\n model.update_attributes(sync_attrs) # this also does `album: #<Album>`\n\n # FIXME: sync again, here, or just id?\n self.id = model.id\n end",
"def register(entity, type)\n entities[entity] << symbolize(type)\n end",
"def save_person(info)\n return case info[:type]\n when :student\n save_student(info)\n else\n save_staff(info)\n end\n end",
"def save!\n raise NotImplemented\n end",
"def save(instance)\n raise NotImplementedError, 'Expected adapter to override `save`'\n end",
"def save\n if @json_dict.fetch(@id_property, false)\n _change\n else\n _create\n end\n end",
"def save\n self.class.persistable\n DB[self.class.name] ||= {}\n DB[self.class.name][name] = self\n Maglev.commit_transaction\n end",
"def putEntity( type, scope, country, trust, our_data)\n params = Hash.new\n params['type'] = type\n params['scope'] = scope\n params['country'] = country\n params['trust'] = trust\n params['our_data'] = our_data\n return doCurl(\"put\",\"/entity\",params)\n end",
"def before_save\n self.resource_type ||= self.class.to_s.split('::')[-1].downcase\n self.uuid ||= UUIDTools::UUID.random_create\n self.name ||= self.uuid\n self.urn ||= GURN.create(self.name, :type => self.class.to_s.split('::')[-1].downcase).to_s\n super\n end",
"def save\n # TODO validar atributos?\n response = Http.post(\"/organizations/api/identities/#{self.identity.uuid}/accounts/\", create_body)\n raise \"unexpected response: #{response.code} - #{response.body}\" unless response.code == 201\n attributes_hash = MultiJson.decode(response.body)\n set_attributes(attributes_hash)\n @persisted = true\n @errors = {}\n true\n rescue *[RestClient::BadRequest] => e\n @persisted = false\n @errors = MultiJson.decode(e.response.body)\n false\n end",
"def save\n attr_hash = {}\n selection_attr = self.Id.nil? ? \"createable\" : \"updateable\"\n self.class.description[\"fields\"].select { |f| f[selection_attr] }.collect { |f| f[\"name\"] }.each { |attr| attr_hash[attr] = self.send(attr) }\n\n if self.Id.nil?\n self.Id = self.client.create(self.class, attr_hash).Id\n else\n self.client.update(self.class, self.Id, attr_hash)\n end\n end",
"def save\n # TODO validar atributos?\n response = Http.put(\"/accounts/api/service-info/#{identity.uuid}/#{slug}/\", save_body)\n raise \"unexpected response: #{response.code} - #{response.body}\" unless [200,201].include?(response.code)\n attributes_hash = MultiJson.decode(response.body)\n set_attributes(attributes_hash)\n @errors = {}\n @persisted = true\n true\n rescue *[RestClient::Conflict, RestClient::BadRequest] => e\n @errors = MultiJson.decode(e.response.body)\n false\n end",
"def custom_entity_type_and_analyzer(**args)\n validate_entity_analyzer_args(args)\n custom_entity_types[args[:type]] = Epiphany::EntityType.new(args)\n end",
"def custom_entity_type_and_analyzer(**args)\n validate_entity_analyzer_args(args)\n custom_entity_types[args[:type]] = Epiphany::EntityType.new(args)\n end",
"def save\n super save\n end",
"def store_entity(entity, aliases, force=false)\n if !force && transaction?\n add_transaction_element(:store_entity, entity, aliases)\n else\n @entities[entity.id] = entity\n\n aliases.each do |a|\n @aliases[a] = entity.id\n map_to_aliases(entity.id) << a\n end\n end\n entity\n end",
"def save(*args)\n if @new_record && !self.is_?(App)\n self.app_name = HesCentral.application_repository_name\n end\n super(*args)\n end",
"def save(*)\n update_magic_properties\n clear_association_cache\n create_or_update\n end",
"def save *entities\n @commit.save(*entities)\n # Do not save yet\n entities\n end",
"def save\n self.id = klass.generate_identifier unless persisted? || id\n save_graph = RDF::Graph.new\n fill_save_graph save_graph\n Db.insert_data( save_graph , :graph => klass.object_graph )\n persist!\n end",
"def entity=newe\n if newe # Propogate the entity's identifying info to the rest of the item\n self.id = newe.id\n self.klass = newe.class\n end\n @entity = newe\n end",
"def save(options = {})\n options.stringify_keys!\n contribute = options.delete('contribute') || true\n \n @attributes.each do |language, language_attributes_hash|\n language_attributes_hash.each do |attribute_name, attribute|\n attribute.save(@place, @history)\n end\n end\n\n PublicEarth::Db::Contributor.contribute(@place, @current_source_data_set) if contribute\n \n @history.record\n \n @attributes\n end",
"def entity_params\n # params.require(:entity).permit(:research_aim, :research_metric, :evidence_benefit, \n # :evidence_context, :evidence_result, :evidence_intergrity,\n # 'research_methods'.to_sym)\n params.require(:entity).permit!\n end",
"def save_additional_data\n end",
"def save\n @id ||= '%064d' % CloudKit.storage_adapter.generate_unique_id\n @etag = UUID.generate unless @deleted\n @last_modified = Time.now.httpdate\n\n CloudKit.storage_adapter[@id] = {\n 'uri' => @uri.cannonical_uri_string,\n 'etag' => escape(@etag),\n 'last_modified' => @last_modified,\n 'json' => @json,\n 'deleted' => escape(@deleted),\n 'archived' => escape(@archived),\n 'remote_user' => escape(@remote_user),\n 'collection_reference' => @collection_reference ||= @uri.collection_uri_fragment,\n 'resource_reference' => @resource_reference ||= @uri.cannonical_uri_string\n }.merge(escape_values(parsed_json))\n reload\n end",
"def save\n self.class.mapper.put(self)\n end",
"def create\n the_param = entity_params\n to = the_param.delete(:to)\n\n research_methods = the_param.delete(:research_methods)\n research_participants = the_param.delete(:research_participants)\n evidence_methods = the_param.delete(:evidence_methods)\n methodologies = the_param.delete(:methodologies)\n\n @entity = Entity.new(the_param)\n @entity.bibliographic = @bibliographic\n @entity.research_methods = ResearchMethod.where(id: research_methods).all\n @entity.research_participants = ResearchParticipant.where(id: research_participants).all\n @entity.evidence_methods = EvidenceMethod.where(id: evidence_methods).all\n @entity.methodologies = Methodology.where(id: methodologies).all\n # byebug\n\n respond_to do |format|\n if @entity.save\n\n # format.html { redirect_to [@bibliographic, @entity], notice: 'Entity was successfully created.' }\n format.html { redirect_to confirmed_list_bibliographics_path, notice: 'Entity was successfully created.' }\n\n #format.html { redirect_to send(to.to_s.concat('_path')), notice: 'Bibliographic was successfully created.' }\n\n format.html { redirect_to [@bibliographic, @entity], notice: 'Entity was successfully created.' }\n format.json { render :show, status: :created, location: @entity }\n else\n format.html { render :new }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_and_give_me_a_json(additional_path, entity)\n if self.service_base_path != nil\n \n additional = \"\"\n if additional_path != nil\n additional = \"/#{additional_path}\"\n end\n \n message = self.http_client.put \"#{self.base_url}#{self.service_base_path}#{additional}.json?api_key=#{self.access_token}\", entity.to_hash\n trata_erro(message.content)\n end\n end",
"def save!\n super\n logger.debug \"overriden save called!\"\n update_vars\n super\n end",
"def save\n _create unless @json_dict.fetch(@id_property, false)\n end",
"def save\n @domain.put_attributes(@key, @attributes, :replace => :all)\n end",
"def custom_entity_types\n @_custom_entity_types ||= {}\n end",
"def custom_entity_types\n @_custom_entity_types ||= {}\n end",
"def save_data(resource_type, name, data, action_handler)\n raise NotImplementedError, :save_data\n end",
"def save\n @save_mixin.json_dict = @json_dict\n @save_mixin._deleted = @_deleted\n @save_mixin.save\n @json_dict = @save_mixin.json_dict\n end",
"def save!(context)\n raise NotImplementedError, \"Subclasses must implement a save!(context) method.\"\n end",
"def persist_new(entity)\n cargo_persistence.create(to_dao(entity))\n end",
"def save\n if valid?\n entity = to_entity\n User.dataset.save entity\n self.id = entity.key.id\n true\n else\n false\n end\n end",
"def encode_with(coder)\n PERSISTENT_PROPERTIES.each { |key|\n coder[key.to_s] = instance_variable_get(:\"@#{key}\")\n }\n end",
"def save_identifier(record)\n raise \"This method must be implemented by subclass!\"\n end",
"def save_url\n raise MotionModelResource::URLNotDefinedError.new \"URL is not defined for #{self.class.name}!\" unless self.class.respond_to?(:url)\n\n case save_action\n when :create then self.try(:url) || self.class.url\n when :update then self.try(:url) || \"#{self.class.url}/#{id}\"\n end\n end",
"def save(data)\n raise \"Implement this in subclass\"\n end",
"def save(&block)\n block = nil if !openid_identifier.blank?\n super(&block)\n end",
"def save(klass, obj, id=nil)\n raise InterfaceError, \"no save method\"\n end",
"def get_entity_type\n 'country'\n end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def create_entity(_options = {})\n # TODO: Handle exceptions\n entity = self.class.client.post(to_entity)[\"entity\"][self.class.entity_type].with_indifferent_access\n self.gr_id = entity[:id]\n end",
"def industry_code_params\n params.permit(:entity_code_name, :entity_code_id)\n end",
"def persist; end",
"def persist; end",
"def persist; end",
"def save\n call_ok?(:slft_application, request_save) do |body|\n convert_back_office_hash(body)\n end\n end",
"def save(*_)\n end",
"def save_value(key, value)\n raise NotImplementedError,\n \"The :save_value method should be overwritten by a subclass.\"\n end",
"def add_entity\n e = NSEntityDescription.new\n yield e\n register_entity(e)\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save\n fail ESP::NotImplementedError\n end",
"def save!(*)\n super.tap do\n attributes.id = @response.body[\"id\"]\n end\n end",
"def set_Entity(value)\n set_input(\"Entity\", value)\n end",
"def create_entity(entity, aliases)\n store_entity(entity, aliases)\n end",
"def save\n if @system_data and (something = @system_data[:client]) and something.respond_to?(:attributes)\n changes = 0\n something.attributes.each do |k, v|\n if self.send(k) != v\n something.send(k + '=', self.send(k))\n changes += 1\n end\n end\n something.save if changes > 0\n else\n raise TaskMapper::Exception.new(\"#{self.class.name}::#{this_method} method must be implemented by the provider\")\n end\n end",
"def save\n response = []\n \n if self.ownership.blank?\n self.ownership = Solve360::Config.config.default_ownership\n end\n \n if new_record?\n response = self.class.request(:post, \"/#{self.class.resource_name}\", to_request)\n \n if !response[\"response\"][\"errors\"]\n self.id = response[\"response\"][\"item\"][\"id\"]\n end\n else\n response = self.class.request(:put, \"/#{self.class.resource_name}/#{id}\", to_request)\n end\n \n if response[\"response\"][\"errors\"]\n message = response[\"response\"][\"errors\"].map {|k,v| \"#{k}: #{v}\" }.join(\"\\n\")\n raise Solve360::SaveFailure, message\n else\n related_items.concat(related_items_to_add)\n\n response\n end\n\n end",
"def save\n yield self if block_given?\n http.post('/__admin/mappings/save', '')\n end",
"def save(*args, &block)\n super\n # begin\n # require 'restclient'\n # server[\"/instances/#{instance_id}\"].put(to_json)\n # rescue Exception => e\n # Metavirt::Log.error \"cloudkit fail:\\n\\t#{e.inspect}\"\n # end\n self\n end",
"def save\n DB.transaction do\n DB[self.class.name] ||= {}\n DB[self.class.name][name] = self\n end\n end",
"def _process_on_create(entity)\n end",
"def save\r\n do_without_exception(:save!)\r\n end",
"def encode_with(coder); end",
"def save_wikibase_entityids(json)\n each_wikibase_entitiyid(json) do |entityid|\n @used_props << entityid[:value][:'numeric-id']\n end\n end",
"def entity_params\n params.require(:entity).permit(:name, :status_id, :registration_name, :website, :twitter, :linkedin, :finantial_year, :internal_owner_id)\n end",
"def save( confighash, name )\n\t\t\traise NotImplementedError,\n\t\t\t\t\"required method 'save' not implemented in '#{self.class.name}'\"\n\t\tend",
"def save_base_attributes(record)\n self.document_type = record.class.name.underscore\n self.document_id = record.id\n if record.embedded_one?\n base_record = {}\n record.relations.each_value do |relation|\n if relation.macro == :embedded_in\n base_class_name = relation.key\n base_record = record.send base_class_name.to_sym\n end\n end\n self.base_document_type = base_record.class.name.underscore\n self.base_document_id = base_record.id\n end\n # Sets base document_id if this record is the base/parent document\n self.base_document_type ||= self.document_type\n self.base_document_id ||= self.document_id\n end",
"def serialize(entity)\n value = entity.attribute(name)\n\n if value.nil?\n value = entity.write_attribute(name, default(entity))\n end\n\n serializer.serialize value, name: name\n end",
"def save\n #see if PID is not yet specified in DC. Note that according the rest of the code, the PID is put in DC when the object is first saved. \n #That means the below expression becomes true only if this is the object is saved first time.\n update_dc_id = get_dc.identifier == \"\"\n \n #Save the object. This generates the PID if this is a new object.\n status = super\n \n dc = get_dc\n if update_dc_id && status\n \n dc.identifier = self.pid\n \n #We need to set up the following field at some point.\n dc.creator = \"TODO\" if dc.creator == \"\"\n dc.created = \"TODO\" if dc.created == \"\"\n \n #Since the DC is updated, let's save the object again.\n status = super \n end\n \n #Return the save status.\n return status\n end",
"def save!(*)\n super.tap do\n changes_applied\n end\n end",
"def save\n self.class.insert(key, attributes)\n true\n end",
"def save\n self.class.insert(key, attributes)\n true\n end",
"def dup_entity (options = {})\n entity = super(options)\n entity.default_eng_unit_type = self.default_eng_unit_type.dup_entity(options) if default_eng_unit_type\n object_data.each { |o| entity.object_data << o.dup_entity(options) if o}\n entity.save\n return entity\n end"
] |
[
"0.55526155",
"0.5528686",
"0.5524536",
"0.55146414",
"0.54882145",
"0.54624605",
"0.54255515",
"0.5425525",
"0.53551114",
"0.52607256",
"0.52552086",
"0.52481186",
"0.52364814",
"0.5210222",
"0.51979923",
"0.51948625",
"0.5172679",
"0.5154451",
"0.5128875",
"0.5122893",
"0.510463",
"0.5102464",
"0.50862426",
"0.50862426",
"0.50746584",
"0.5073677",
"0.5065484",
"0.5061857",
"0.5040835",
"0.5009273",
"0.4998878",
"0.4988427",
"0.4970033",
"0.4950744",
"0.4928344",
"0.49267137",
"0.49255002",
"0.49024543",
"0.49023888",
"0.4901903",
"0.4899553",
"0.4895517",
"0.4895517",
"0.48907432",
"0.48821798",
"0.48742244",
"0.48700103",
"0.48546073",
"0.48328778",
"0.48254383",
"0.48042038",
"0.479804",
"0.4776649",
"0.47757414",
"0.47732195",
"0.47689116",
"0.47689116",
"0.47689116",
"0.47689116",
"0.47689116",
"0.47689116",
"0.47689116",
"0.47689116",
"0.47583935",
"0.47548497",
"0.4744142",
"0.4744142",
"0.4744142",
"0.47296405",
"0.47073355",
"0.4693651",
"0.46914673",
"0.46892092",
"0.46892092",
"0.46892092",
"0.46892092",
"0.46892092",
"0.46892092",
"0.46892092",
"0.4687363",
"0.46799782",
"0.46728608",
"0.4666627",
"0.4666119",
"0.4661846",
"0.46617022",
"0.46605808",
"0.46513006",
"0.46394655",
"0.4636807",
"0.46321207",
"0.4632057",
"0.46302906",
"0.462545",
"0.46210238",
"0.46127942",
"0.4610595",
"0.4609694",
"0.4609694",
"0.46086186"
] |
0.8446863
|
0
|
EOL: this method was previously also checking: || include_eager_select?(options, joined_tables)
|
def references_eager_loaded_tables?(options)
joined_tables = joined_tables(options)
include_eager_order?(options, nil, joined_tables) || include_eager_conditions?(options, nil, joined_tables)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def include_eager_conditions?(options)\n # look in both sets of conditions\n conditions = [scope(:find, :conditions), options[:conditions]].inject([]) do |all, cond|\n case cond\n when nil then all\n when Array then all << cond.first\n else all << cond\n end\n end\n return false unless conditions.any?\n conditions.join(' ').scan(/([\\.\\w]+)\\.[\\[\"]?\\w+[\\]\"]?/).flatten.any? do |condition_table_name|\n condition_table_name != table_name\n end\n end",
"def has_joins?\n !@options[:joins].blank?\n end",
"def include_eager_order?(options)\n order = options[:order]\n return false unless order\n order.scan(/([\\.\\w]+)\\.[\\[\"]?\\w+[\\]\"]?/).flatten.any? do |order_table_name|\n order_table_name != table_name\n end\n end",
"def supports_modifying_joins?\n true\n end",
"def uses_eager_load?\n return opts[:eager_load] unless opts[:eager_load].nil?\n [:eager, :eager_only].include?(model.cti_subclass_load)\n end",
"def eager_loadable?\n !eager_loaded && !criteria.inclusions.empty?\n end",
"def _use_insert_select?(ds)\n (!ds.opts[:select] || ds.opts[:returning]) && ds.supports_insert_select? \n end",
"def _use_insert_select?(ds)\n (!ds.opts[:select] || ds.opts[:returning]) && ds.supports_insert_select? \n end",
"def finding_with_ambiguous_select?(select_clause)\n !select_clause && columns.size != 2\n end",
"def resolve_options(klass, options)\n # Factor in scope.\n if scope = klass.get_scope\n scope = scope.dup\n scond = scope.delete(:condition)\n scope.update(options)\n options = scope\n end\n\n if sql = options[:sql]\n sql = \"SELECT * FROM #{klass.table} \" + sql unless sql =~ /SELECT/i\n return sql\n end\n\n tables = [klass::table]\n\n if included = options[:include]\n join_conditions = []\n\n for name in [included].flatten\n if rel = klass.relation(name.to_s)\n target_table = rel[:target_class]::table\n tables << target_table\n\n if rel.is_a?(JoinsMany)\n tables << rel[:join_table]\n owner_key, target_key = nil\n klass.ogmanager.with_store do |s|\n owner_key, target_key = s.join_table_keys(klass, rel[:target_class])\n end\n join_conditions << \"#{rel.join_table}.#{owner_key}=#{klass.table}.#{rel.owner_class.primary_key} AND #{rel.join_table}.#{target_key}=#{rel.target_class.table}.#{rel.target_class.primary_key}\"\n else\n join_conditions << \"#{klass::table}.#{rel.foreign_key}=#{target_table}.#{rel.target_class.primary_key}\"\n end\n else\n raise \"Unknown relation name\"\n end\n end\n\n fields = options[:select] || tables.collect { |t| \"#{t}.*\" }.join(',')\n\n update_condition options, join_conditions.join(\" AND \")\n elsif fields = options[:select]\n fields = fields.map {|f| f.to_s}.join(\", \")\n else\n fields = \"*\"\n end\n\n if join_table = options[:join_table]\n tables << join_table\n update_condition options, options[:join_condition]\n end\n\n # Factor in scope in the conditions.\n update_condition(options, scond) if scond\n\n # where is just an alias, put to :condition\n update_condition(options, options.delete(:where))\n\n # add extra conditions\n update_condition(options, options.delete(:extra_condition))\n\n # rp: type is not set in all instances such as Class.first\n # so this fix goes here for now.\n if ogtype = options[:type] || (klass.schema_inheritance_child? ? \"#{klass}\" : nil)\n update_condition options, \"ogtype='#{ogtype}'\"\n end\n\n sql = \"SELECT #{fields} FROM #{tables.join(',')}\"\n\n if condition = options[:condition]\n # If an array is passed as a condition, use prepared\n # statement style escaping.\n if condition.is_a?(Array)\n condition = prepare_statement(condition)\n end\n\n sql << \" WHERE #{condition}\"\n end\n\n if group = options[:group] || options[:group_by]\n sql << \" GROUP BY #{group}\"\n end\n\n if order = options[:order] || options[:order_by]\n sql << \" ORDER BY #{order}\"\n end\n\n resolve_limit_options(options, sql)\n\n if extra = options[:extra] || options[:extra_sql]\n sql << \" #{extra}\"\n end\n\n return sql\n end",
"def use_scrooge?(model_class, original_sql)\n original_sql =~ select_regexp(model_class.table_name) &&\n model_class.columns_hash.has_key?(model_class.primary_key) &&\n original_sql !~ ScroogeRegexJoin\n end",
"def join_dependency\n @join_dependency ||= (\n build_join_dependency(\n Arel::SelectManager.new(table.engine, table),\n joins_values\n ) && @join_dependency\n )\n end",
"def use_eager_all?\n (opts[:eager] || opts[:eager_graph]) && !opts[:all_called]\n end",
"def filter_by_associations_add_conditions?\n self[:conditions] || self[:eager_block] || self[:limit]\n end",
"def eager_loading_use_associated_key?\n false\n end",
"def select_with_sql_base\n opts[:with].any?{|w| w[:recursive]} ? \"WITH RECURSIVE \" : super\n end",
"def true_eager_limit_strategy\n if self[:eager_graph] || (offset && !associated_dataset.supports_offsets_in_correlated_subqueries?)\n # An SQL-based approach won't work if you are also eager graphing,\n # so use a ruby based approach in that case.\n :ruby\n else\n :union \n end\n end",
"def check_association(model, association)\n raise(Sequel::UndefinedAssociation, \"Invalid association #{association} for #{model.name}\") unless reflection = model.association_reflection(association)\n raise(Sequel::Error, \"Eager loading is not allowed for #{model.name} association #{association}\") if reflection[:allow_eager] == false\n reflection\n end",
"def has_joined_model?(model)\n has_base_model?(model) || has_aggregated_model?(model)\n end",
"def eager_loading_use_associated_key?\n true\n end",
"def select_associations\n @associations.select { |assoc| @selects.map { |select_clause| select_clause.call(assoc) }.all? }\n end",
"def supports_cte_in_subqueries?\n supports_cte?\n end",
"def eager_graph_association(ds, model, ta, requirements, r, *associations)\n if r.is_a?(SQL::AliasedExpression)\n alias_base = r.alias\n r = r.expression\n else\n alias_base = r[:graph_alias_base]\n end\n assoc_table_alias = ds.unused_table_alias(alias_base)\n loader = r[:eager_grapher]\n if !associations.empty?\n if associations.first.respond_to?(:call)\n callback = associations.first\n associations = {}\n elsif associations.length == 1 && (assocs = associations.first).is_a?(Hash) && assocs.length == 1 && (pr_assoc = assocs.to_a.first) && pr_assoc.first.respond_to?(:call)\n callback, assoc = pr_assoc\n associations = assoc.is_a?(Array) ? assoc : [assoc]\n end\n end\n local_opts = ds.opts[:eager_graph][:local]\n limit_strategy = r.eager_graph_limit_strategy(local_opts[:limit_strategy])\n\n if r[:conditions] && !Sequel.condition_specifier?(r[:conditions]) && !r[:orig_opts].has_key?(:graph_conditions) && !r[:orig_opts].has_key?(:graph_only_conditions) && !r.has_key?(:graph_block)\n Sequel::Deprecation.deprecate(\"Ignoring :conditions for #{r[:model]} #{r[:name]} association during eager_graph/association_join, consider specifying :graph_block\") unless r[:ignore_conditions_warning]\n end\n\n ds = loader.call(:self=>ds, :table_alias=>assoc_table_alias, :implicit_qualifier=>(ta == ds.opts[:eager_graph][:master]) ? first_source : qualifier_from_alias_symbol(ta, first_source), :callback=>callback, :join_type=>local_opts[:join_type], :join_only=>local_opts[:join_only], :limit_strategy=>limit_strategy, :from_self_alias=>ds.opts[:eager_graph][:master])\n if r[:order_eager_graph] && (order = r.fetch(:graph_order, r[:order]))\n ds = ds.order_append(*qualified_expression(order, assoc_table_alias))\n end\n eager_graph = ds.opts[:eager_graph]\n eager_graph[:requirements][assoc_table_alias] = requirements.dup\n eager_graph[:reflections][assoc_table_alias] = r\n if limit_strategy == :ruby\n eager_graph[:limits][assoc_table_alias] = r.limit_and_offset \n end\n eager_graph[:cartesian_product_number] += r[:cartesian_product_number] || 2\n ds = ds.eager_graph_associations(ds, r.associated_class, assoc_table_alias, requirements + [assoc_table_alias], *associations) unless associations.empty?\n ds\n end",
"def eager_load(a, eager_assoc=@opts[:eager])\n return if a.empty?\n # Key is foreign/primary key name symbol\n # Value is hash with keys being foreign/primary key values (generally integers)\n # and values being an array of current model objects with that\n # specific foreign/primary key\n key_hash = {}\n # Reflections for all associations to eager load\n reflections = eager_assoc.keys.map{|assoc| model.association_reflection(assoc) || (raise Sequel::UndefinedAssociation, \"Model: #{self}, Association: #{assoc}\")}\n \n # Populate the key_hash entry for each association being eagerly loaded\n reflections.each do |r|\n if key = r.eager_loader_key\n # key_hash for this key has already been populated,\n # skip populating again so that duplicate values\n # aren't added.\n unless id_map = key_hash[key]\n id_map = key_hash[key] = Hash.new{|h,k| h[k] = []}\n\n # Supporting both single (Symbol) and composite (Array) keys.\n a.each do |rec|\n case key\n when Array\n if (k = key.map{|k2| rec.get_column_value(k2)}) && k.all?\n id_map[k] << rec\n end\n when Symbol\n if k = rec.get_column_value(key)\n id_map[k] << rec\n end\n else\n raise Error, \"unhandled eager_loader_key #{key.inspect} for association #{r[:name]}\"\n end\n end\n end\n else\n id_map = nil\n end\n \n loader = r[:eager_loader]\n associations = eager_assoc[r[:name]]\n if associations.respond_to?(:call)\n eager_block = associations\n associations = {}\n elsif associations.is_a?(Hash) && associations.length == 1 && (pr_assoc = associations.to_a.first) && pr_assoc.first.respond_to?(:call)\n eager_block, associations = pr_assoc\n end\n loader.call(:key_hash=>key_hash, :rows=>a, :associations=>associations, :self=>self, :eager_block=>eager_block, :id_map=>id_map)\n a.each{|object| object.send(:run_association_callbacks, r, :after_load, object.associations[r[:name]])} unless r[:after_load].empty?\n end \n end",
"def select!\n # Ensure we can never be destructive by nilifying :update.\n Mao.sql(with_options(:update => nil).sql) do |pg_result|\n if @options[:join]\n other = Mao.query(@options[:join][0])\n pg_result.map {|result|\n Mao.normalize_join_result(result, self, other)\n }\n else\n pg_result.map {|result| Mao.normalize_result(result, @col_types)}\n end\n end\n end",
"def join_table(type, table, expr=nil, options=OPTS, &block)\n if expr.is_a?(SQL::AliasedExpression) && expr.expression.is_a?(Array) && !expr.expression.empty? && expr.expression.all?\n options = options.merge(:join_using=>true)\n end\n super\n end",
"def check_unused_preload_associations; end",
"def filter_by_associations_add_conditions?\n super || self[:order] || self[:eager_limit_strategy] || self[:filter_limit_strategy]\n end",
"def true_eager_graph_limit_strategy\n r = super\n ds = associated_dataset\n if r == :ruby && ds.supports_limits_in_correlated_subqueries? && (Array(associated_class.primary_key).length == 1 || ds.supports_multiple_column_in?) && (!offset || ds.supports_offsets_in_correlated_subqueries?)\n :correlated_subquery\n else\n r\n end\n end",
"def virtual?\n column.nil? && association.nil?\n end",
"def add_association_keys_to_select(options)\n return options[:select] unless options[:include]\n select_table_fields = split_table_fields(options[:select])\n select_table_fields.concat add_association_keys_to_select_sub(self, options)\n reform_select_from_fields(select_table_fields.uniq)\n end",
"def inline_view?(options, scope)\n options[:use_sql_view] &&\n options[:extra_cols] &&\n (scope.limit_value || scope.where_values_hash.present?) &&\n !scope.table_name&.include?(\".\") &&\n scope.respond_to?(:includes_values)\n end",
"def collapse_subquery_for?(relation)\n @scope.subset?(COLLAPSIBLE.fetch(relation.class))\n end",
"def select\n return self[:select] if include?(:select)\n self[:select] ||= associated_class.table_name.*\n end",
"def add_association_keys_to_select_sub(klass, options)\n select_table_fields = class_primary_key_fields(klass)\n \n if options[:include].class == Symbol || options[:include].class == String\n select_table_fields.concat association_keys_for(klass, options[:include].to_sym)\n elsif options[:include].class == Array\n options[:include].each do |s|\n if s.class == Hash # {:user => :favorites} or {:user => {:favorites => [:books, :movies]}}\n select_table_fields.concat association_keys_for(klass, s.keys[0].to_sym)\n \n # this :include has a nested :include, so continue recursively\n if r = klass.reflections[s.keys[0].to_sym]\n nested_add_options = options.dup\n nested_add_options[:include] = s.values[0]\n select_table_fields.concat add_association_keys_to_select_sub(r.klass, nested_add_options)\n end\n elsif s.class == Symbol || s.class == String\n select_table_fields.concat association_keys_for(klass, s.to_sym)\n end\n end\n elsif options[:include].class == Hash\n select_table_fields.concat association_keys_for(klass, options[:include].keys[0].to_sym)\n \n # this :include has a nested :include, so continue recursively\n if r = klass.reflections[options[:include].keys[0].to_sym]\n nested_add_options = options.dup\n nested_add_options[:include] = options[:include].values[0]\n select_table_fields.concat add_association_keys_to_select_sub(r.klass, nested_add_options)\n end\n end\n \n select_table_fields.uniq\n end",
"def supports_insert_select?\n !@opts[:disable_insert_returning]\n end",
"def debug_sql\n if eager_loading?\n including = (eager_load_values + includes_values).uniq\n join_dependency = JoinDependency.new(@klass, including, [])\n construct_relation_for_association_find(join_dependency).to_sql\n else\n arel.to_sql\n end\n end",
"def union_eager_loader\n cached_fetch(:union_eager_loader) do\n Sequel::Dataset::PlaceholderLiteralizer.loader(associated_dataset) do |pl, ds|\n ds = self[:eager_block].call(ds) if self[:eager_block]\n keys = predicate_keys\n ds = ds.where(keys.map{pl.arg}.zip(keys))\n if eager_loading_use_associated_key?\n ds = ds.select_append(*associated_key_array)\n end\n ds.from_self\n end\n end\n end",
"def debug_sql\n if eager_loading?\n including = (@eager_load_values + @includes_values).uniq\n join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, including, nil)\n construct_relation_for_association_find(join_dependency).to_sql\n else\n arel.to_sql\n end\n end",
"def unused_preload_associations_for?(klazz, association)\n unused_preload_associations[klazz].present? && unused_preload_associations[klazz].include?(association)\n end",
"def eager_graph_with_options(associations, opts=OPTS)\n associations = [associations] unless associations.is_a?(Array)\n if eg = @opts[:eager_graph]\n eg = eg.dup\n [:requirements, :reflections, :reciprocals, :limits].each{|k| eg[k] = eg[k].dup}\n eg[:local] = opts\n ds = clone(:eager_graph=>eg)\n ds.eager_graph_associations(ds, model, ds.opts[:eager_graph][:master], [], *associations)\n else\n # Each of the following have a symbol key for the table alias, with the following values: \n # :reciprocals :: the reciprocal value to use for this association\n # :reflections :: AssociationReflection instance related to this association\n # :requirements :: array of requirements for this association\n # :limits :: Any limit/offset array slicing that need to be handled in ruby land after loading\n opts = {:requirements=>{}, :master=>alias_symbol(first_source), :reflections=>{}, :reciprocals=>{}, :limits=>{}, :local=>opts, :cartesian_product_number=>0, :row_proc=>row_proc}\n ds = clone(:eager_graph=>opts)\n ds.eager_graph_associations(ds, model, ds.opts[:eager_graph][:master], [], *associations).naked\n end\n end",
"def actuale? opt = \"\"\n relation = opt.to_s.tableize\n\n actuale = false\n model.dependent_relations.each do |dependent_relation|\n tmp = self.send dependent_relation\n if relation == dependent_relation\n actuale ||= tmp.all.size > 1\n else\n actuale ||= tmp.exists?\n end\n end\n actuale\n end",
"def supports_foreign_keys?\n false\n end",
"def supports_foreign_keys?\n false\n end",
"def eager_options_for_associations(associations)\n opts = {}\n associations.flatten.each do |association|\n case association\n when Symbol\n check_association(model, association)\n opts[association] = nil\n when Hash\n association.keys.each{|assoc| check_association(model, assoc)}\n opts.merge!(association)\n else\n raise(Sequel::Error, 'Associations must be in the form of a symbol or hash')\n end\n end\n opts\n end",
"def can_have_associated_objects?(obj)\n !self[:left_primary_keys].any?{|k| obj.get_column_value(k).nil?}\n end",
"def scope_with_scrooge?( sql )\n sql =~ scrooge_select_regex && \n columns_hash.has_key?(self.primary_key.to_s) &&\n sql !~ ScroogeRegexJoin\n end",
"def search_joins\n @search_joins || @includes\n end",
"def add_joins!(sql, options, scope = :auto)\r\n scope = scope(:find) if :auto == scope\r\n join = (scope && scope[:joins]) || options[:joins]\r\n return if join.blank?\r\n extend_sql_avoiding_table_naming_clashes!(sql, scope && scope[:joins])\r\n extend_sql_avoiding_table_naming_clashes!(sql, options[:joins])\r\n end",
"def includes\r\n return nil unless @joins and not @joins.empty?\r\n includes = @joins.collect{|j| j.includes}\r\n end",
"def simple_select_all?\n return false unless (f = @opts[:from]) && f.length == 1\n o = @opts.reject{|k,v| v.nil? || non_sql_option?(k)}\n from = f.first\n from = from.expression if from.is_a?(SQL::AliasedExpression)\n\n if SIMPLE_SELECT_ALL_ALLOWED_FROM.any?{|x| from.is_a?(x)}\n case o.length\n when 1\n true\n when 2\n (s = o[:select]) && s.length == 1 && s.first.is_a?(SQL::ColumnAll)\n else\n false\n end\n else\n false\n end\n end",
"def supports_lateral_subqueries?\n server_version >= 90300\n end",
"def load_with_primary_key_lookup?(opts, dynamic_opts)\n opts[:type] == :many_to_one &&\n !dynamic_opts[:callback] && \n opts.send(:cached_fetch, :many_to_one_pk_lookup){opts.primary_key == opts.associated_class.primary_key}\n end",
"def join_table(type, table, *args, &block)\n if table.is_a?(Class) && table < Sequel::Model\n Sequel::Deprecation.deprecate(\"Passing Sequel::Model class to a dataset join method\", \"Pass the model's table name or dataset as the first argument instead\")\n if table.dataset.simple_select_all?\n super(type, table.table_name, *args, &block)\n else\n super(type, table.dataset, *args, &block)\n end\n else\n super\n end\n end",
"def select\n self[:select] ||= associated_class.table_name.*\n end",
"def api_include(params)\n # Which columns must we select?\n select = []\n # Which associations must we eager-load?\n eagers = []\n \n model.default_attrs.each do |attr|\n select += model.attr_columns[attr.to_s]\n eagers += model.attr_associations[attr.to_s]\n end\n \n if params['include']\n select += MF::API::IncludeNode.build_select_list(params['include'], model)\n eagers += MF::API::IncludeNode.build_eager_graph(params['include'], model)\n end\n \n # Don't eager load more than once. :)\n eagers.uniq!\n \n # Also select columns which associations may need to operate.\n eagers.each do |eager|\n # Add the primary key on this table needed to access everything.\n if eager.is_a?(Hash)\n ref = model.association_reflection(eager.keys.first.to_sym)\n else\n ref = model.association_reflection(eager)\n end\n \n case ref[:type]\n when :one_to_many\n select << ref[:primary_key] if ref[:primary_key]\n when :many_to_one\n select << ref[:key] if ref[:key]\n when :many_to_many\n select << ref[:left_primary_key] if ref[:left_primary_key]\n when :many_through_many\n select << ref[:left_primary_key] if ref[:left_primary_key]\n end\n end\n\n # Ensure we always select critical columns.\n select += model.key_columns\n \n # Don't select more than once\n select.uniq!\n \n # Modify a copy of this dataset.\n dataset = self.clone\n\n # Select columns\n if dataset.opts[:select] and\n dataset.opts[:select].size == 1 and \n dataset.opts[:select].first.kind_of? Sequel::SQL::ColumnAll\n # This dataset is selecting ALL elements; drop the select and\n # replace it with our explicit selection.\n dataset.opts[:select] = select\n else\n # The dataset may have no select() columns -or- a number of explicit\n # selections; we will merge our own.\n dataset = dataset.select_more *select\n end\n\n # Eager loading\n dataset = dataset.eager(*eagers) unless eagers.empty?\n\n # Ensure we use the first table source as the qualifier for all\n # unqualified identifiers.\n dataset = dataset.qualify_to_first_source\n \n dataset\n end",
"def def_many_to_many(opts)\n one_through_one = opts[:type] == :one_through_one\n left = (opts[:left_key] ||= opts.default_left_key)\n lcks = opts[:left_keys] = Array(left)\n right = (opts[:right_key] ||= opts.default_right_key)\n rcks = opts[:right_keys] = Array(right)\n left_pk = (opts[:left_primary_key] ||= self.primary_key)\n opts[:eager_loader_key] = left_pk unless opts.has_key?(:eager_loader_key)\n lcpks = opts[:left_primary_keys] = Array(left_pk)\n lpkc = opts[:left_primary_key_column] ||= left_pk\n lpkcs = opts[:left_primary_key_columns] ||= Array(lpkc)\n raise(Error, \"mismatched number of left keys: #{lcks.inspect} vs #{lcpks.inspect}\") unless lcks.length == lcpks.length\n if opts[:right_primary_key]\n rcpks = Array(opts[:right_primary_key])\n raise(Error, \"mismatched number of right keys: #{rcks.inspect} vs #{rcpks.inspect}\") unless rcks.length == rcpks.length\n end\n opts[:uses_left_composite_keys] = lcks.length > 1\n opts[:uses_right_composite_keys] = rcks.length > 1\n opts[:cartesian_product_number] ||= one_through_one ? 0 : 1\n join_table = (opts[:join_table] ||= opts.default_join_table)\n opts[:left_key_alias] ||= opts.default_associated_key_alias\n opts[:graph_join_table_join_type] ||= opts[:graph_join_type]\n opts[:after_load].unshift(:array_uniq!) if opts[:uniq]\n opts[:dataset] ||= opts.association_dataset_proc\n opts[:eager_loader] ||= opts.method(:default_eager_loader)\n \n join_type = opts[:graph_join_type]\n select = opts[:graph_select]\n use_only_conditions = opts.include?(:graph_only_conditions)\n only_conditions = opts[:graph_only_conditions]\n conditions = opts[:graph_conditions]\n graph_block = opts[:graph_block]\n graph_jt_conds = opts[:graph_join_table_conditions] = opts.fetch(:graph_join_table_conditions, []).to_a\n use_jt_only_conditions = opts.include?(:graph_join_table_only_conditions)\n jt_only_conditions = opts[:graph_join_table_only_conditions]\n jt_join_type = opts[:graph_join_table_join_type]\n jt_graph_block = opts[:graph_join_table_block]\n opts[:eager_grapher] ||= proc do |eo|\n ds = eo[:self]\n egls = eo[:limit_strategy]\n if egls && egls != :ruby\n associated_key_array = opts.associated_key_array\n orig_egds = egds = eager_graph_dataset(opts, eo)\n egds = egds.\n inner_join(join_table, rcks.zip(opts.right_primary_keys) + graph_jt_conds, :qualify=>:deep).\n select_all(egds.first_source).\n select_append(*associated_key_array)\n egds = opts.apply_eager_graph_limit_strategy(egls, egds)\n ds.graph(egds, associated_key_array.map(&:alias).zip(lpkcs) + conditions, :qualify=>:deep, :table_alias=>eo[:table_alias], :implicit_qualifier=>eo[:implicit_qualifier], :join_type=>eo[:join_type]||join_type, :from_self_alias=>eo[:from_self_alias], :join_only=>eo[:join_only], :select=>select||orig_egds.columns, &graph_block)\n else\n ds = ds.graph(join_table, use_jt_only_conditions ? jt_only_conditions : lcks.zip(lpkcs) + graph_jt_conds, :select=>false, :table_alias=>ds.unused_table_alias(join_table, [eo[:table_alias]]), :join_type=>eo[:join_type]||jt_join_type, :join_only=>eo[:join_only], :implicit_qualifier=>eo[:implicit_qualifier], :qualify=>:deep, :from_self_alias=>eo[:from_self_alias], &jt_graph_block)\n ds.graph(eager_graph_dataset(opts, eo), use_only_conditions ? only_conditions : opts.right_primary_keys.zip(rcks) + conditions, :select=>select, :table_alias=>eo[:table_alias], :qualify=>:deep, :join_type=>eo[:join_type]||join_type, :join_only=>eo[:join_only], &graph_block)\n end\n end\n \n return if opts[:read_only]\n \n if one_through_one\n opts[:setter] ||= proc do |o|\n h = {}\n lh = lcks.zip(lcpks.map{|k| get_column_value(k)})\n jtds = _join_table_dataset(opts).where(lh)\n\n checked_transaction do\n current = jtds.first\n\n if o\n new_values = []\n rcks.zip(opts.right_primary_key_methods).each{|k, pk| new_values << (h[k] = o.get_column_value(pk))}\n end\n\n if current\n current_values = rcks.map{|k| current[k]}\n jtds = jtds.where(rcks.zip(current_values))\n if o\n if current_values != new_values\n jtds.update(h)\n end\n else\n jtds.delete\n end\n elsif o\n lh.each{|k,v| h[k] = v}\n jtds.insert(h)\n end\n end\n end\n opts[:_setter] = proc{|o| set_one_through_one_associated_object(opts, o)}\n else \n opts[:adder] ||= proc do |o|\n h = {}\n lcks.zip(lcpks).each{|k, pk| h[k] = get_column_value(pk)}\n rcks.zip(opts.right_primary_key_methods).each{|k, pk| h[k] = o.get_column_value(pk)}\n _join_table_dataset(opts).insert(h)\n end\n\n opts[:remover] ||= proc do |o|\n _join_table_dataset(opts).where(lcks.zip(lcpks.map{|k| get_column_value(k)}) + rcks.zip(opts.right_primary_key_methods.map{|k| o.get_column_value(k)})).delete\n end\n\n opts[:clearer] ||= proc do\n _join_table_dataset(opts).where(lcks.zip(lcpks.map{|k| get_column_value(k)})).delete\n end\n end\n end",
"def relation?(options)\n options[:json].is_a?(ActiveRecord::Relation)\n end",
"def supports_foreign_tables?\n false\n end",
"def supports_foreign_tables?\n false\n end",
"def unused_preload_associations_for?(klass, association)\n Bullet.collected_unused_eager_association_notifications.select do |notification|\n notification.base_class == klass.to_s && notification.associations.include?(association)\n end.present?\n end",
"def eagerly_apply_sideload?(sideload)\n # TODO: Maybe handle this in graphiti-rails\n if defined?(::Rails) && (app = ::Rails.application)\n app.config.eager_load ? false : true\n else\n sideload.resource_class_loaded?\n end\n end",
"def join_context(context_data, options = {})\n join_column = options[:join_column] || :branch_id\n\n versioned_table = opts[:last_joined_table] || opts[:from].first\n\n ds = join(context_data, { :branch_id => join_column }, options) do |j, lj|\n Sequel.expr(Sequel.qualify(j, :version) => nil) |\n (Sequel.qualify(lj, :version) <= Sequel.qualify(j, :version))\n end\n ds.opts[:versioned_table] = versioned_table\n #ds.opts[:last_record_id] = Sequel.qualify(versioned_table, :record_id)\n ds.opts[:order_columns] = (ds.opts[:order_columns] || []) +\n [Sequel.qualify(ds.opts[:last_joined_table], :depth),\n Sequel.qualify(versioned_table, :version).desc]\n ds\n end",
"def association_prepared_statement(opts, assoc_bv)\n return unless model.cache_associations\n ps = opts.send(:cached_fetch, :prepared_statement) do\n unless opts[:instance_specific]\n ds, bv = _associated_dataset(opts, {}).unbind\n\n f = ds.opts[:from]\n if f && f.length == 1\n s = ds.opts[:select]\n if ds.opts[:join]\n if opts.eager_loading_use_associated_key? && s && s.length == 1 && s.first.is_a?(SQL::ColumnAll)\n table = s.first.table\n ds = ds.select(*opts.associated_class.columns.map{|c| Sequel.identifier(c).qualify(table)})\n end\n elsif !s || s.empty?\n ds = ds.select(*opts.associated_class.columns.map{|c| Sequel.identifier(c)})\n end\n end \n \n if bv.length != assoc_bv.length\n h = {}\n bv.each do |k,v|\n h[k] = v unless assoc_bv.has_key?(k)\n end\n ds = ds.bind(h)\n end\n ds.clone(:log_sql=>true).prepare(opts.returns_array? ? :select : :first, :\"smpsap_#{NEXT.call}\")\n end\n end\n\n if ps && @server && _associated_objects_use_same_server?\n ps = ps.server(@server)\n end\n\n ps\n end",
"def hoist_cte?(ds)\n ds.is_a?(Dataset) && ds.opts[:with] && !supports_cte_in_subqueries?\n end",
"def conditions_met?(object, associations); end",
"def handle_joins fields, select = nil\n ret = select || scoped\n fields.each do |qualified_field|\n assoc, foreign_table, field = parse_field(qualified_field)\n ret = ret.joins(join_string(assoc, foreign_table)) if assoc\n end\n ret\n end",
"def preloadable_association?( association )\n @klass.preloadable_associations.include?( association.to_sym )\n end",
"def supports_foreign_key_parsing?\n respond_to?(:foreign_key_list)\n end",
"def def_many_through_many(opts)\n one_through_many = opts[:type] == :one_through_many\n opts[:read_only] = true\n opts[:after_load].unshift(:array_uniq!) if opts[:uniq]\n opts[:cartesian_product_number] ||= one_through_many ? 0 : 2\n opts[:through] = opts[:through].map do |e|\n case e\n when Array\n raise(Error, \"array elements of the through option/argument for many_through_many associations must have at least three elements\") unless e.length == 3\n {:table=>e[0], :left=>e[1], :right=>e[2]}\n when Hash\n raise(Error, \"hash elements of the through option/argument for many_through_many associations must contain :table, :left, and :right keys\") unless e[:table] && e[:left] && e[:right]\n e\n else\n raise(Error, \"the through option/argument for many_through_many associations must be an enumerable of arrays or hashes\")\n end\n end\n\n left_key = opts[:left_key] = opts[:through].first[:left]\n opts[:left_keys] = Array(left_key)\n opts[:uses_left_composite_keys] = left_key.is_a?(Array)\n left_pk = (opts[:left_primary_key] ||= self.primary_key)\n raise(Error, \"no primary key specified for #{inspect}\") unless left_pk\n opts[:eager_loader_key] = left_pk unless opts.has_key?(:eager_loader_key)\n opts[:left_primary_keys] = Array(left_pk)\n lpkc = opts[:left_primary_key_column] ||= left_pk\n lpkcs = opts[:left_primary_key_columns] ||= Array(lpkc)\n opts[:dataset] ||= opts.association_dataset_proc\n\n opts[:left_key_alias] ||= opts.default_associated_key_alias\n opts[:eager_loader] ||= opts.method(:default_eager_loader)\n\n join_type = opts[:graph_join_type]\n select = opts[:graph_select]\n graph_block = opts[:graph_block]\n only_conditions = opts[:graph_only_conditions]\n use_only_conditions = opts.include?(:graph_only_conditions)\n conditions = opts[:graph_conditions]\n opts[:eager_grapher] ||= proc do |eo|\n ds = eo[:self]\n iq = eo[:implicit_qualifier]\n egls = eo[:limit_strategy]\n if egls && egls != :ruby\n associated_key_array = opts.associated_key_array\n orig_egds = egds = eager_graph_dataset(opts, eo)\n opts.reverse_edges.each{|t| egds = egds.join(t[:table], Array(t[:left]).zip(Array(t[:right])), :table_alias=>t[:alias], :qualify=>:deep)}\n ft = opts.final_reverse_edge\n egds = egds.join(ft[:table], Array(ft[:left]).zip(Array(ft[:right])), :table_alias=>ft[:alias], :qualify=>:deep).\n select_all(egds.first_source).\n select_append(*associated_key_array)\n egds = opts.apply_eager_graph_limit_strategy(egls, egds)\n ds.graph(egds, associated_key_array.map(&:alias).zip(Array(lpkcs)) + conditions, :qualify=>:deep, :table_alias=>eo[:table_alias], :implicit_qualifier=>iq, :join_type=>eo[:join_type]||join_type, :join_only=>eo[:join_only], :from_self_alias=>eo[:from_self_alias], :select=>select||orig_egds.columns, &graph_block)\n else\n opts.edges.each do |t|\n ds = ds.graph(t[:table], t.fetch(:only_conditions, (Array(t[:right]).zip(Array(t[:left])) + t[:conditions])), :select=>false, :table_alias=>ds.unused_table_alias(t[:table]), :join_type=>eo[:join_type]||t[:join_type], :join_only=>eo[:join_only], :qualify=>:deep, :implicit_qualifier=>iq, :from_self_alias=>eo[:from_self_alias], &t[:block])\n iq = nil\n end\n fe = opts.final_edge\n ds.graph(opts.associated_class.dataset, use_only_conditions ? only_conditions : (Array(opts.right_primary_key).zip(Array(fe[:left])) + conditions), :select=>select, :table_alias=>eo[:table_alias], :qualify=>:deep, :join_type=>eo[:join_type]||join_type, :join_only=>eo[:join_only], &graph_block)\n end\n end\n end",
"def joined?\n meta[:joined].equal?(true)\n end",
"def cached_lookup_allowed?\n @klass.use_activerecord_cache && arel.where_sql.nil? && arel.join_sources.empty? && @limit_value.nil? && @offset_value.nil?\n end",
"def non_join_table_name?(key)\n (key.in?(NonJoinTableNames) || is_selection_type(key))\n end",
"def explicit_columns_in_subquery?\n @scope.include?(Algebra::Projection) ||\n @scope.include?(Algebra::Rename) ||\n @scope.include?(Algebra::Summarization)\n end",
"def need_selection?\n fail NotImplementedError\n end",
"def multiple? #nodoc\n @options[:association] == :has_many || @options[:association] == :has_and_belongs\n end",
"def eager_graph_check_association(model, association)\n if association.is_a?(SQL::AliasedExpression)\n SQL::AliasedExpression.new(check_association(model, association.expression), association.alias)\n else\n check_association(model, association)\n end\n end",
"def get_raw_sql(options)\n # base.rb, find()\n validate_find_options(options)\n set_readonly_option!(options)\n # base.rb, find_every()\n include_associations = merge_includes(scope(:find, :include), options[:include])\n if include_associations.any? && references_eager_loaded_tables?(options)\n # associations.rb, find_with_associations()\n join_dependency = JoinDependency.new(self, merge_includes(scope(:find, :include), options[:include]), options[:joins])\n construct_finder_sql_with_included_associations(options, join_dependency)\n else\n # base.rb, find_every()\n construct_finder_sql(options)\n end\n end",
"def auto_assoc(opts = {})\n except = opts[:except] || []\n\n assocs = db.schema_parse_associations(table_name)\n relations = process_join_tables(assocs)\n\n relations.each do |row|\n src_tbl = row[:src_tbl]\n src_col = row[:src_col]\n if src_tbl == table_name && ! (src_col & except).empty?\n # TODO enable except for *_to_many\n next\n end\n src_uniq = row[:src_uniq]\n src_cardinality = cardinality(src_uniq)\n\n join_tbl = row[:join_tbl]\n\n dst_tbl = row[:dst_tbl]\n dst_col = row[:dst_col]\n dst_uniq = row[:dst_uniq]\n dst_cardinality = cardinality(dst_uniq)\n\n TABLE_MODELS.wait_all(src_tbl, dst_tbl) do |src_cls, dst_cls|\n self_ref = src_cls == dst_cls\n\n src = self_ref ? :child : underscore(src_cls.name).to_sym\n src = src_uniq ? singularize(src).to_sym : pluralize(src).to_sym\n\n dst = self_ref ? :parent : underscore(dst_cls.name).to_sym\n dst = dst_uniq ? singularize(dst).to_sym : pluralize(dst).to_sym\n\n if join_tbl\n left_col = row[:left_col]\n right_col = row[:right_col]\n send :many_to_many, src, :class => src_cls, :join_table => join_tbl,\n :left_key => left_col, :left_primary_key => dst_col,\n :right_key => right_col, :right_primary_key => src_col\n else\n # TODO name overrides\n\n if self == dst_cls\n # dst holds the foreign key -> one_to_*\n meth = dst_cardinality + '_to_' + src_cardinality\n send meth, src, :class => src_cls, :key => src_col, :primary_key => dst_col\n end\n\n if self == src_cls\n # src holds the foreign key -> *_to_one\n meth = src_cardinality + '_to_' + dst_cardinality\n\n # one_to_one requires to swap pk and fk\n src_col, dst_col = dst_col, src_col if src_uniq\n send meth, dst, :class => dst_cls, :key => src_col, :primary_key => dst_col\n end\n end\n\n end\n end\n end",
"def implementation_no_master_association\n defined?(foreign_key_name) && foreign_key_name.blank?\n end",
"def use_prepared_statements_for_pk_lookup?\n !@fast_pk_lookup_sql && !dataset.joined_dataset?\n end",
"def options_for_association_conditions(association)\n return nil if association.options[:through]\n case association.macro\n when :has_one, :has_many\n # Find only orphaned objects\n \"#{association.foreign_key} IS NULL\"\n when :belongs_to, :has_and_belongs_to_many\n # Find all\n nil\n end\n end",
"def merge_select_extra\n relation.select_extra_values.concat(other.select_extra_values).uniq! \\\n if other.select_extra_values.present?\n end",
"def select_table_options_sql(sql)\n sql << \" WITH #{@opts[:table_options]}\" if @opts[:table_options]\n end",
"def eager_load(options)\n @eager_load = options\n end",
"def should_propagate_dependent_option? record\n # When we really want to delete associated records? when these are\n # not being used by any translations. This means that either +record+\n # has no translations, or that its translations use a different set of records\n all_records = record.translations.map do |translation|\n translation.without_current_locale(translation.locale) do\n translation.send(name).to_a\n end\n end.flatten\n (all_records & record.send(name)).empty?\n end",
"def foreign_key?\n options.fetch(:foreign_key, false)\n end",
"def association_join_with_paranoid\n return @join if @join\n result = association_join_without_paranoid\n if reflection.klass.paranoid?\n aliased_table = Arel::Table.new(table_name, :as => @aliased_table_name, :engine => arel_engine)\n pb = ActiveRecord::PredicateBuilder.new(arel_engine)\n result.concat(pb.build_from_hash(reflection.klass.paranoid_condition, aliased_table))\n end\n result\n end",
"def can_have_associated_objects?(obj)\n !self[:primary_keys].any?{|k| obj.get_column_value(k).nil?}\n end",
"def eager_load_results(eo, &block)\n rows = eo[:rows]\n initialize_association_cache(rows) unless eo[:initialize_rows] == false\n if eo[:id_map]\n ids = eo[:id_map].keys\n return ids if ids.empty?\n end\n strategy = eager_limit_strategy\n cascade = eo[:associations]\n eager_limit = nil\n\n if eo[:eager_block] || eo[:loader] == false\n ds = eager_loading_dataset(eo)\n\n strategy = ds.opts[:eager_limit_strategy] || strategy\n\n eager_limit =\n if el = ds.opts[:eager_limit]\n raise Error, \"The :eager_limit dataset option is not supported for associations returning a single record\" unless returns_array?\n strategy ||= true_eager_graph_limit_strategy\n if el.is_a?(Array)\n el\n else\n [el, nil]\n end\n else\n limit_and_offset\n end\n\n strategy = true_eager_graph_limit_strategy if strategy == :union\n # Correlated subqueries are not supported for regular eager loading\n strategy = :ruby if strategy == :correlated_subquery\n strategy = nil if strategy == :ruby && assign_singular?\n objects = apply_eager_limit_strategy(ds, strategy, eager_limit).all\n elsif strategy == :union\n objects = []\n ds = associated_dataset\n loader = union_eager_loader\n joiner = \" UNION ALL \"\n ids.each_slice(subqueries_per_union).each do |slice|\n objects.concat(ds.with_sql(slice.map{|k| loader.sql(*k)}.join(joiner)).to_a)\n end\n ds = ds.eager(cascade) if cascade\n ds.send(:post_load, objects)\n else\n loader = placeholder_eager_loader\n loader = loader.with_dataset{|dataset| dataset.eager(cascade)} if cascade\n objects = loader.all(ids)\n end\n\n objects.each(&block)\n if strategy == :ruby\n apply_ruby_eager_limit_strategy(rows, eager_limit || limit_and_offset)\n end\n end",
"def save_habtm_association?(assoc)\n @record.class.paper_trail_save_join_tables.include?(assoc.name) ||\n PaperTrail.request.enabled_for_model?(assoc.klass)\n end",
"def is_foreign_key?\n association.present?\n end",
"def skip_statement_cache?(scope)\n reflection.has_scope? ||\n scope.eager_loading? ||\n klass.scope_attributes? ||\n reflection.source_reflection.active_record.default_scopes.any?\n end",
"def selectable?\n !@attributes.nil? && !@attributes.include?(:Noselect)\n end",
"def multiple_associations?\n associations.any? { |col,assocs| assocs.length > 1 }\n end",
"def eager_graph_lazy_dataset?\n true\n end",
"def options_for_association_conditions(association)\n case association.name\n when :frms\n # join with public if session is missing the usr_id\n ['frms.usr_id = ?', (session[:usr_id] || Usr.find_by_login('public').id)]\n when :prsna\n # join with public if session is missing the usr_id\n ['prsnas.usr_id = ?', (session[:usr_id] || Usr.find_by_login('public').id)]\n else\n super\n end\n end",
"def subquery(definition, other_definition, conditions)\n validate_definition_instance(definition)\n validate_definition_instance(other_definition)\n [conditions].flatten.each { |c| validate_node_or_attribute(c) }\n\n current_model = definition.model\n #current_table = definition.table\n current_joins = definition.joins\n\n other_table = other_definition.table\n other_model = other_definition.model\n #other_joins = other_definition.joins\n\n # build an exist subquery to apply conditions that\n # refer to another table\n\n subquery = other_definition.table\n\n # add conditions to subquery\n [conditions].flatten.each do |c|\n subquery = subquery.where(c)\n end\n\n # add joins that provide other table access to current table\n\n\n which_joins = current_joins\n join_paths_index = nil\n join_path_current_index = nil\n join_path_other_index = nil\n which_joins.each_with_index do |item, index|\n join_path_current_index = item.find_index { |j| j[:join] == current_model }\n join_path_other_index = item.find_index { |j| j[:join] == other_model }\n if !join_path_current_index.nil? && !join_path_other_index.nil?\n join_paths_index = index\n break\n end\n end\n\n first_index = [join_path_current_index, join_path_other_index].min\n last_index = [join_path_current_index, join_path_other_index].max\n relevant_joins = which_joins[join_paths_index][first_index..last_index]\n\n\n relevant_joins.each do |j|\n join_table = j[:join]\n join_condition = j[:on]\n\n # assume this is an arel_table if it doesn't respond to .arel_table\n arel_table = join_table.respond_to?(:arel_table) ? join_table.arel_table : join_table\n\n if arel_table.name == other_table.name && !join_condition.nil?\n # add join as condition if this is the main table in the subquery\n subquery = subquery.where(join_condition)\n elsif arel_table.name != other_table.name && !join_condition.nil?\n # add full join if this is not the main table in the subquery\n subquery = subquery.join(arel_table).on(join_condition)\n end\n\n end\n\n subquery.project(1).exists\n end",
"def sql(options = {}) \n table = options[:table_class]\t\n if table.respond_to?(:do_not_use_view_for_query) and table.do_not_use_view_for_query\n\tconditions.map {|c| c.sql(options) }\n else\n\tconditions.map {|c| c.sql(options[:table_class]) }\n end\n end",
"def enabled?\n !select.disabled?\n end"
] |
[
"0.69874036",
"0.6904944",
"0.67060846",
"0.6422002",
"0.63992643",
"0.6140148",
"0.61125284",
"0.61125284",
"0.60921144",
"0.59842724",
"0.5962169",
"0.5929013",
"0.5911884",
"0.58883256",
"0.5885971",
"0.5875612",
"0.582514",
"0.5817943",
"0.5805094",
"0.5783552",
"0.57679564",
"0.57574075",
"0.5745273",
"0.57407326",
"0.5738272",
"0.5718991",
"0.5717398",
"0.56971",
"0.56796026",
"0.5675075",
"0.5671718",
"0.5659242",
"0.56430995",
"0.56421036",
"0.56408316",
"0.56154895",
"0.560149",
"0.55659336",
"0.55493593",
"0.5505828",
"0.5494828",
"0.54854715",
"0.54843056",
"0.54843056",
"0.547293",
"0.54606557",
"0.54542416",
"0.5452246",
"0.54492706",
"0.54478866",
"0.54441035",
"0.5437862",
"0.5421428",
"0.53880525",
"0.53853244",
"0.5361817",
"0.5359977",
"0.53591406",
"0.5355338",
"0.5355338",
"0.5352719",
"0.5343319",
"0.5337985",
"0.5327831",
"0.53202385",
"0.5312228",
"0.5308951",
"0.5301569",
"0.52889746",
"0.52838796",
"0.5281142",
"0.52749646",
"0.52662486",
"0.52647597",
"0.5239469",
"0.5232132",
"0.52310485",
"0.52308357",
"0.52108365",
"0.5207436",
"0.51923996",
"0.51900434",
"0.51880413",
"0.5187771",
"0.51872563",
"0.51728106",
"0.5161078",
"0.51556176",
"0.51543176",
"0.5146258",
"0.51451766",
"0.51328826",
"0.5126864",
"0.512247",
"0.51203233",
"0.51175714",
"0.5114024",
"0.51073265",
"0.51021457",
"0.509997"
] |
0.80248296
|
0
|
these methods load other templates and render them in the same context in which current document is rendered
|
def get_partial(partial_name)
tpl = @engine.templates.get_partial(partial_name)
tpl.render(self, @context_vars)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def main_content\n do_include(@template)\n end",
"def render_template(options={})\n # puts \"ActionController#render_template(start), options = #{options}\"\n #`var d = new Date(); console.log(\"time= \" + d.getSeconds() + \":\" + d.getMilliseconds());`\n #Timer.time_stamp(\"render_template (begin)\")\n content_fors = options.delete(:content_for) || {}\n partial = options[:partial]\n\n # renderer = ActionView::Renderer.new(self, path: render_path)\n # puts \"renderer = #{@renderer.inspect}\"\n if partial\n # puts \"ActionController#render_template (partial)\"\n top_view_html = @renderer.render(options)\n else\n # puts \"ActionController#render_template (file)\"\n top_view_html = @renderer.render(file: render_path, options: {locals: @__locals})\n end\n\n content_for_htmls = {}\n content_fors.each do |key, selector|\n content_for_html = @renderer.content_fors[key]\n #puts \"content for #{key} = #{content_for_html}\"\n content_for_htmls[selector] = content_for_html\n end\n #`var d = new Date(); console.log(\"time= \" + d.getSeconds() + \":\" + d.getMilliseconds());`\n [top_view_html, content_for_htmls]\n end",
"def templates; end",
"def rendered_templates; end",
"def render(*args)\n tpls_file = (@__caller_info__ || __caller_info__).first.first\n self._template_parser.load(tpls_file).parse.each do |template_name, raw_content|\n # no controller name if absolute view path\n ctrl_name = template_name.match(/^\\//) ? nil : self.controller_name\n path = Merb.dir_for(:view) / self._template_location(template_name.gsub(/^\\//,''), nil, ctrl_name)\n file = VirtualFile.new(raw_content, path)\n TEMPLATES[path.to_s] = file\n end\n super\n end",
"def render_template(context, options); end",
"def render\n case File.extname(@template_file)\n when '.erb'\n render_erb\n else\n render_plain\n end\n end",
"def render_template(view, template, layout_name, locals); end",
"def _render_template(options); end",
"def _render_template(options); end",
"def process_default_render exp\n process_layout\n process_template template_name, nil\n end",
"def render(template_name)\n #Use controller and template names to construct paths to template files.\n\n\n #Use File.read to read the template file.\n\n #Create a new ERB template from the contents.\n \n #Evaluate the ERB template, using binding to capture the controller's instance variables.\n\n #Pass the result to #render_content with a content_type of text/html.\n\n \n end",
"def templates_for(file); end",
"def load_template(templates, obj, sym)\n owner, st_path = *resource_owner(obj.class, sym)\n if st_path\n ct_path = compiled_template_path(owner, sym)\n ct_file_exists = File.file?(ct_path)\n ct_file_mtime = ct_file_exists ? File.mtime(ct_path) : nil\n st_file = File.new(st_path, 'r:UTF-8')\n\n # Find out if template refresh is required\n if !ct_file_exists \\\n || st_file.mtime > ct_file_mtime \\\n || File.mtime(COMPILER_PATH) > ct_file_mtime\n no_refresh = compile_template(\n st_file, ct_path, ct_file_mtime, owner, sym\n )\n else\n no_refresh = true\n end\n\n # Load template\n method_name = (sym == 'view' ? sym : \"#{sym}_view\").to_sym\n owner.instance_eval do\n method_exists = instance_methods(false).include?(method_name)\n unless method_exists && no_refresh\n remove_method method_name if method_exists\n load ct_path\n end\n end\n\n # Register template in cache\n templates[\"#{owner}##{sym}\"] = nil\n templates[\"#{obj.class}##{sym}\"] = nil\n\n method_name\n else\n raise \"undefined template `#{sym}' for #{obj.class}\"\n end\n end",
"def templates(&block)\n instance_eval(&block)\n end",
"def render_with_engine_additions(opts)\n template_path_for_method = Dir[\"#{template_path}/#{opts[:file]}*\"].first\n body = opts.delete(:body)\n i = initialize_template_class(body)\n i.base_path = File.dirname(template_path_for_method)\n i.render(opts)\n end",
"def render!\n render :file => template_path\n end",
"def render(template_name)\n if already_built_response? \n raise \"DoubleRenderError\"\n else \n controller_name = self.class.to_s.underscore \n dir = File.join(\"views\",controller_name, \"#{template_name}.html.erb\")\n # debugger\n content = File.read(dir).split(\"\\n\")\n content.map! do | statement | \n start_point = /<%/ =~ statement\n # debugger\n if start_point.nil? \n statement\n else \n front_part = statement[0...start_point]\n # returning = \n # start_point += statement[start_point+2] == \"=\" ? 2 : 1\n end_point = /%>/ =~ statement \n end_point += 1\n rear_part = statement[end_point+2..-1]\n front_part.to_s + ERB.new(statement[start_point..end_point]).result(binding) + rear_part.to_s\n end \n end \n render_content(content)\n end \n end",
"def render(context)\n file = render_variable(context) || @file # use parsed variable filename unless passed explicit filename\n validate_file_name(file)\n path = locate_include_file(context, file, true) # ensure file exists in safe path\n return unless path\n # # ???????\n # add_include_to_dependency(site, path, context)\n #\n # Load the partial if it's identical to one we've already loaded ???\n partial = File.read(path) # reads the template file\n partial = Liquid::Template.parse(partial) # compiles template\n # setup and perform render\n context.stack do\n # create a hash object for any passed k/v pair args\n # by parsing passed parameters using the parent file's scope\n context[\"include\"] = parse_params(context) if @params\n begin # render the include for output\n partial.render!(context)\n rescue Liquid::Error => e\n e.template_name = path\n e.markup_context = \"included \" if e.markup_context.nil?\n raise e\n end\n end\n end",
"def render_with_layout_and_partials(format)\n # looking for system mail.\n template = MailEngine::MailTemplate.where(:path => \"#{controller_path}/#{action_name}\", :format => format, :locale => I18n.locale, :partial => false, :for_marketing => false).first\n # looking for marketing mail.\n template = MailEngine::MailTemplate.where(:path => action_name, :format => format, :locale => I18n.locale, :partial => false, :for_marketing => true).first if template.blank?\n\n # if found db template set the layout and partial for it.\n if template\n related_partial_paths = {}\n # set @footer or @header\n template.template_partials.each do |tmp|\n related_partial_paths[\"#{tmp.placeholder_name}_path\".to_sym] = tmp.partial.path\n end\n\n # set layout\n render :template => \"#{controller_path}/#{action_name}\", :layout => \"layouts/mail_engine/mail_template_layouts/#{template.layout}\", :locals => related_partial_paths\n else\n # if not found db template should render file template\n render(action_name)\n end\n end",
"def render(*args) \n return '' if @root.nil? \n \n context = case args.first\n when Liquor::Context\n args.first\n when Hash\n Context.new([args.first, assigns], instance_assigns, registers, @rethrow_errors)\n when nil\n Context.new(assigns, instance_assigns, registers, @rethrow_errors)\n else\n raise ArgumentError, \"Expect Hash or Liquor::Context as parameter\"\n end\n \n options = nil\n case args.last\n when Hash\n options = args.last\n \n if options[:registers].is_a?(Hash)\n self.registers.merge!(options[:registers]) \n end\n\n if options[:filters]\n context.add_filters(options[:filters])\n end\n \n if options[:layout]\n raise ArgumentError, \"Expected Liquor::Template as layout argument\" unless options[:layout].is_a? Liquor::Template\n end \n \n when Module\n context.add_filters(args.last) \n when Array\n context.add_filters(args.last) \n end\n \n begin \n # render the nodelist.\n # for performance reasons we get a array back here. join will make a string out of it\n res = @root.render(context).join\n \n if options && options[:layout]\n content_for_assigns = (context.has_key?(\"content_for\") ? context[\"content_for\"] : {})\n content_for_assigns = content_for_assigns.merge({ \"_rendered_template_\" => res })\n \n case args.first\n when Liquor::Context\n args.first[\"content_for\"] = content_for_assigns\n when Hash\n args.first.merge!({ \"content_for\" => content_for_assigns })\n end \n \n layout_template = args.last.delete(:layout)\n \n # Here we execute render method of the Liquor::Template object (we execute _this_ method)\n # It is not the @root.render method. It is a result of the @root.render(context).join\n # so we don't need to call join here.\n res = layout_template.render(*args)\n end\n \n res\n ensure\n @errors = context.errors\n end\n end",
"def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name,content|\n view.content_for name, content\n end\n end\n end",
"def initialize(template_text,options={})\n @renderer_extension_modules=[]\n\n @name=options[:template_name]\n @templates_root_dir= options[:templates_directory]# || \"#{::Rails.root.to_s}/app/views\"\n\n @output_buffer=\"\"\n #unique tag for escaping post and pre processing tags\n @ltag=\"!@@@##$$1212\"\n @rtag=\"!723465hjf3!@#\"\n\n @default_language=options[:default_language] || \"en\"\n\n\n @escape_tags= options[:tags_to_escape] || []\n @runtime_tags= options[:runtime_tags] || []\n\n\n #escape blocks that will be run at view time\n @template_text=template_text.clone\n @escape_tags.each do |etag|\n escape_tag_content( etag,@template_text)\n\n \n end\n\n# raise \"need templates directory\" unless options[:templates_directory]\n\n #escape all normal dynamic blocks for preprocessing\n @template_text=@template_text.gsub(\"<%\",@ltag).gsub(\"%>\",@rtag).gsub(\"<$\",\"<%\").gsub(\"$>\",\"%>\")\n \n #turn the setup block into a proc <## ##> into executable blocks\n @template_text=@template_text.gsub(\"<##\",\"<% set_setup_proc{ \").gsub(\"##>\",\"} %>\")\n\n #turn the key block into a proc <## ##> into executable blocks\n @template_text=@template_text.gsub(\"<!!KEY\",\"<% set_key_proc{ \").gsub(\"!!KEY>\",\"} %>\")\n\n\n @raw_template=compile(@template_text)\n #this hold variations of the template after it has been localized\n #into different languages, but before rendering\n @localized_templates={}\n @setup_proc=nil\n @key_proc=nil\n @render_base=options[:render_base]\n @template_name=options[:template_name]\n #this tag will be used to create non cachable dynamic blocks\n\n\n if options.has_key?(:helpers) && options[:helpers]!=nil\n options[:helpers].each do |helper|\n include helper\n end\n end\n \n end",
"def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name,content|\n view.content_for name, content\n end\n end\n end",
"def template_for(file); end",
"def render(template_name)\n contents = File.read(\"views/#{self.class.to_s.underscore}/#{template_name}.html.erb\")\n template = ERB.new(contents)\n # ivars = self.instance_variables\n new_content = template.result(binding)\n render_content(new_content, \"text/html\")\n end",
"def render(template_name)\n #Open template, put content into string-content\n cntrl_name = self.class.to_s.underscore\n\n erb_temp = File.read(\"views/#{cntrl_name}/#{template_name}.html.erb\")\n content = ERB.new(erb_temp).result(binding)\n\n render_content(content , 'text/html')\n end",
"def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end",
"def template\n raise \"Template was not loaded: #{@template}\" if !@loadOK\n @template\n end",
"def loadTemplate\n\t\t@template = File.read(@templateFile)\n\tend",
"def loadTemplate\n\t\t@template = File.read(@templateFile)\n\tend",
"def render file_name\n template_file = @template_dir + file_name\n\n template = template_for template_file, false, RDoc::ERBPartial\n\n template.filename = template_file.to_s\n\n template.result @context\n end",
"def render(template_name)\n controller_name = self.class.to_s.underscore\n\n string = File.read(\"./views/#{controller_name}/#{template_name}.html.erb\")\n #\"./\" for project root dir\n\n template = ERB.new(string)\n capture = template.result(binding) #evaluate and bind\n\n render_content(capture, \"text/html\")\n end",
"def renderOutput( request, response, session, properties, xmlFileToRender, theme, baseDocRoot,\n baseDocRootInclude, onlyModules)\n @mySession = session\n @myRequest = request\n @myResponse = response\n @myPropertyLoader = properties\n @baseDocRoot = baseDocRoot\n @baseDocRootInclude = baseDocRootInclude\n @myTheme = theme\n\n cWorkArea = GlobalSettings.getCurrentWorkArea(session)\n #docDataDir = GlobalSettings.getDocumentDataDirectory\n @FS = File::SEPARATOR\n tmp = properties.getProperties(\"redirect\")\n myPage = FileCMS.new(session, \"#{cWorkArea}#{@FS}#{xmlFileToRender}\")\n\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 page = Page.new(myPage, version, session, myPage.getFileURL)\n\n\n # TO-DO: Implement Template system then this....\n myTemplate = Template.new(templateDir, page)\n myTemplate.setRenderer(self)\n #puts \"AdditionalParams :: #{@extraParams}\"\n myTemplate.setAdditionalParameters(@extraParams)\n #myTemplate.setHTMLRenderer(self)\n if(!onlyModules)\n pageContent = myTemplate.getParsedTemplate\n #puts \"PageContent : #{pageContent}\"\n else\n pageContent = \"\"\n end\n\n if myTemplate.hasModuleTemplates\n\n #//TODO: process page, each module, one at a time.... Need to supply each with the correct module ID.\n pageModuleContent = \"\"\n mods = page.getAllPageModules\n #puts \"Mod count : #{mods.size}\"\n mods.each{ |mod|\n\n modType = mod.getModuleType\n if myTemplate.containsModuleTemplate(modType)\n #TO-DO: process needs to be implemented to support templates in modules....\n modTemplate = myTemplate.getModuleTemplate(modType)\n modTemplate.setModuleToRender(mod)\n pageModuleContent.concat(modTemplate.parseTemplate)\n else\n pageModuleContent.concat(\"<br>Module not supported:#{modType}<br>\")\n end\n\n }\n end\n #puts \"About to process #{@extraParams}\"\n\n\n #processExtraParameters(pageModuleContent)\n if(!onlyModules)\n pageContent = Parser.replaceAll(pageContent, \"*CONTENT*\", pageModuleContent)\n else\n pageContent = pageModuleContent\n end\n\n return pageContent\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 render_with_layout(template, locals = {}, additional_js = [], additional_css = [])\n script_tags = \"\"\n css_tags = \"\"\n additional_js.each { |fileName| script_tags << \"<script src='/js/#{fileName}'></script>\" }\n additional_css.each do |fileName|\n css_tags << \"<link rel='stylesheet' type='text/css' href='/css/#{fileName}'/>\"\n end\n erb :base, :locals => locals.merge({ :template => template, :user => @user,\n :script_tags => script_tags, :css_tags => css_tags })\n end",
"def render(template_name)\n controller_name = self.class.to_s.gsub(/Controller$/, '').underscore\n base_template = ERB.new File.read(\"app/views/layouts/application.html.erb\")\n page_template = ERB.new File.read(\"app/views/#{controller_name}/#{template_name}.html.erb\")\n page = page_template.result(call_binding)\n content = base_template.result(call_binding { page })\n render_content(content, \"text/html\")\n end",
"def render_plain\n template_content\n end",
"def render(*names)\n v = @response.template\n v.assigns(:x => :y)\n v.render_file\n v.template_format\n v.view_paths\n v.pick_template_extension\n names.each do |name|\n v.file_exists?(name)\n end\n end",
"def load\n @all = [] #contains all template objects\n\n template_dir = Gem.datadir('moo') + '/templates/'\n\n template_files = Dir.entries(template_dir).reject do |t|\n t == '.' || t == '..'\n end\n\n template_files.each do |f|\n path = template_dir + f\n @all << Template.new(path)\n end\n end",
"def render_partial(template, types, context)\n templates.get(template, types).render(context)\n end",
"def render(template, types, context)\n unless templates.exist_for_types?(layout, types)\n return render_partial(template, types, context)\n end\n load_layout_template(types).render(context) do\n render_partial(template, types, context)\n end\n end",
"def render(*names)\n v = ActionView::Base.new\n v.assigns(:x => :y)\n v.template_format\n v.view_paths\n v.pick_template_extension\n names.each do |name|\n v.file_exists?(name)\n end\n v.render_file(names.last, nil, nil)\n end",
"def render_with(**locals)\n render_with_template(locals: locals)\n end",
"def render\n template_body = Tilt.new(@template).render(self)\n if @layout\n layout = Dir[File.join(File.dirname(@template), @layout) + '*'].first\n raise \"#{Guinness::EMOJI} Guinness : Unable to locate layout at: '#{@layout}'\" unless layout\n @body = Tilt.new(layout).render(self) { template_body }\n end\n @body || template_body\n end",
"def do_render\n Mustache.render(template, self)\n end",
"def load_template\n\t\traw = IO.read( __FILE__ ).split( /^__END__$/m, 2 ).last\n\t\treturn ERB.new( raw, nil, '<%>' )\n\tend",
"def find_template(views, name, engine, &block)\n\t\t \t#normal\n\t\t super(views, name, engine, &block)\n\t\t #_layout folder\n\t\t super(Paths.layout_path, name.to_s, engine, &block)\n\t\t end",
"def render\n ERB.new(File.read(TEMPLATE), 0, \">\").result(binding)\n end",
"def render(template)\n template = File.read(\"./views/#{template}\")\n engine = Haml::Engine.new(template)\n @response = engine.render\nend",
"def load_template!\n feed = self\n eval(File.read(@file))\n end",
"def add_template_pages; end",
"def load\n template_data = response_data['template']\n\n @data = response_data['data']\n @template = Template.new(\n template_data['src'], template_data['type'], template_data['key']\n )\n\n super\n end",
"def load_common(file)\n paths = [\n File.dirname(__FILE__) + \"/gmd/templates/common/#{file}\",\n File.dirname(__FILE__) + \"/gmd/templates/common/#{file}.html.erb\",\n File.dirname(__FILE__) + \"/gmd/templates/common/#{file}.erb\"\n ]\n filepath = choose_file_from_paths(paths)\n raise \"Unable to find file: #{file}\" unless filepath\n tilt_render(filepath)\n end",
"def render\n template = ERB.new File.new(@template_path).read, nil, \"%\"\n template.result(binding)\n end",
"def determine_template(options); end",
"def render(options = {})\n options.merge! :vendor_lua => @vendor_lua if @vendor_lua\n #debugger\n #puts \">> LAMINATE RENDER START. Disabling gc.\"\n #GC.disable\n # Compile template if needed\n name = @name.dup\n prepare_template(name)\n lua = @loader.load_compiled(name).dup\n\n @errors = []\n error_proc = Proc.new {|err| handle_error(err, lua, options)}\n\n State.new(options).run(error_proc) do |state|\n state.logger = logger\n state.eval(lua)\n # Included template functions. The trick is that we don't return to Ruby and eval the included template, because the\n # Lua binding doesn't like re-entering eval. So instead we bind a function '_load_template' which returns the template\n # code, and then we eval it inside Lua itself using 'loadstring'. Thus the template 'include' function is actually\n # a native Lua function.\n state.function '_load_template' do |template_name|\n prepare_template(template_name)\n load_template_innerds(template_name)\n end\n\n state.eval(\"return #{@compiler.lua_template_function(name)}()\")\n end\n end",
"def render_template(full_path)\n @current_template = TemplateRenderer.new(@volt_app, @target, @controller, @binding_name, full_path)\n\n call_ready\n end",
"def template_for file, page = true, klass = ERB\n template = @template_cache[file]\n\n return template if template\n\n if page then\n template = assemble_template file\n erbout = 'io'\n else\n template = file.read\n template = template.encode @options.encoding\n\n file_var = File.basename(file).sub(/\\..*/, '')\n\n erbout = \"_erbout_#{file_var}\"\n end\n\n if RUBY_VERSION >= '2.6'\n template = klass.new template, trim_mode: '-', eoutvar: erbout\n else\n template = klass.new template, nil, '-', erbout\n end\n @template_cache[file] = template\n template\n end",
"def templates\n GitWiki.template_cache ||= Dir[\"#{ settings.views[0] }/*.liquid\"].map do |f|\n name = File.basename(f, '.liquid')\n {\n \"name\" => name,\n \"examples\" => Page.get_template(name).examples\n }\n end\n end",
"def find_template(views, name, engine, &block)\n I18n.fallbacks[I18n.locale].each { |locale|\n super(views, \"#{name}.#{locale}\", engine, &block) }\n super(views, name, engine, &block)\n end",
"def render(pathname)\n @partial_templates ||= {}\n ::ERB.new(File.read(pathname)).result(binding)\n end",
"def render_self!(files)\n files.each do |f|\n if File.exists?(f + @config['tpl_ext'])\n basename = f.sub(/^#{@app_root}\\//, '')\n carp \"From #{'self'.blue.bold} render #{basename.bold}\",\n render_file!(f + @config['tpl_ext'], f), 1\n end\n end\n end",
"def initialize(options={})\n @debug = !!options[:debug]\n\n @views = {}\n @compact = options[:compact]\n @cache = nil\n\n backend = options[:backend]\n case backend\n when 'html5', 'docbook45', 'docbook5'\n eruby = load_eruby options[:eruby]\n #Helpers.require_library 'asciidoctor/backends/' + backend\n require 'asciidoctor/backends/' + backend\n # Load up all the template classes that we know how to render for this backend\n BaseTemplate.template_classes.each do |tc|\n if tc.to_s.downcase.include?('::' + backend + '::') # optimization\n view_name, view_backend = self.class.extract_view_mapping(tc)\n if view_backend == backend\n @views[view_name] = tc.new(view_name, backend, eruby)\n end\n end\n end\n else\n Debug.debug { \"No built-in templates for backend: #{backend}\" }\n end\n\n # If user passed in a template dir, let them override our base templates\n if (template_dirs = options.delete(:template_dirs))\n Helpers.require_library 'tilt', true\n\n if (template_cache = options[:template_cache]) === true\n # FIXME probably want to use our own cache object for more control\n @cache = (@@global_cache ||= TemplateCache.new)\n elsif template_cache\n @cache = template_cache\n end\n\n view_opts = {\n :erb => { :trim => '<>' },\n :haml => { :format => :xhtml, :attr_wrapper => '\"', :ugly => true, :escape_attrs => false },\n :slim => { :disable_escape => true, :sort_attrs => false, :pretty => false }\n }\n\n # workaround until we have a proper way to configure\n if {'html5' => true, 'dzslides' => true, 'deckjs' => true, 'revealjs' => true}.has_key? backend\n view_opts[:haml][:format] = view_opts[:slim][:format] = :html5\n end\n\n slim_loaded = false\n path_resolver = PathResolver.new\n engine = options[:template_engine]\n\n template_dirs.each do |template_dir|\n # TODO need to think about safe mode restrictions here\n template_dir = path_resolver.system_path template_dir, nil\n template_glob = '*'\n if engine\n template_glob = \"*.#{engine}\"\n # example: templates/haml\n if File.directory? File.join(template_dir, engine)\n template_dir = File.join template_dir, engine\n end\n end\n\n # example: templates/html5 or templates/haml/html5\n if File.directory? File.join(template_dir, backend)\n template_dir = File.join template_dir, backend\n end\n\n # skip scanning folder if we've already done it for same backend/engine\n if @cache && @cache.cached?(:scan, template_dir, template_glob)\n @views.update(@cache.fetch :scan, template_dir, template_glob)\n next\n end\n\n helpers = nil\n scan_result = {}\n # Grab the files in the top level of the directory (we're not traversing)\n Dir.glob(File.join(template_dir, template_glob)).\n select{|f| File.file? f }.each do |template|\n basename = File.basename(template)\n if basename == 'helpers.rb'\n helpers = template\n next\n end\n name_parts = basename.split('.')\n next if name_parts.size < 2\n view_name = name_parts.first \n ext_name = name_parts.last\n if ext_name == 'slim' && !slim_loaded\n # slim doesn't get loaded by Tilt\n Helpers.require_library 'slim', true\n end\n next unless Tilt.registered? ext_name\n opts = view_opts[ext_name.to_sym]\n if @cache\n @views[view_name] = scan_result[view_name] = @cache.fetch(:view, template) {\n Tilt.new(template, nil, opts)\n }\n else\n @views[view_name] = Tilt.new template, nil, opts\n end\n end\n\n require helpers unless helpers.nil?\n @cache.store(scan_result, :scan, template_dir, template_glob) if @cache\n end\n end\n end",
"def render_templates(output, dom_namer)\n # Does nothing. Only multipliers really render templates\n end",
"def process_template name, src, type, called_from = nil, file_name = nil\n case type\n when :erb\n result = ErbTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n when :haml\n result = HamlTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n when :erubis\n result = ErubisTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n when :slim\n result = SlimTemplateProcessor.new(@tracker, name, called_from, file_name).process src\n else\n abort \"Unknown template type: #{type} (#{name})\"\n end\n\n # Each template which is rendered is stored separately\n # with a new name.\n if called_from\n name = (\"#{name}.#{called_from}\").to_sym\n end\n\n @tracker.templates[name].src = result\n @tracker.templates[name].type = type\n end",
"def render_for_file_with_inherit_views(template_path, status = nil, use_full_path = false, locals = {})\n if use_full_path and inherit_views? and found_path = find_inherited_template_path(template_path)\n template_path = found_path\n end\n render_for_file_without_inherit_views(template_path, status, use_full_path, locals)\n end",
"def render(template_name)\n # \"views/#{controller_name}/#{template_name}.html.erb\"\n\n # format view path\n controller_name = self.class.to_s.underscore\n view_path = \"views/#{controller_name}/#{template_name}.html.erb\"\n\n # read in contents of view file and interpret embedded ruby\n view_content = File.read(view_path)\n template_content = ERB.new(view_content).result(binding) # binding gives erb access to ivars\n\n # html/text downloads output???\n render_content(template_content, \"text/html\")\n end",
"def method_missing(name, *args, &block)\n if @obj.respond_to?(name)\n @obj.send(name, *args, &block)\n elsif templates.key?(name.to_s)\n render(name)\n else\n super\n end\n end",
"def view_context\n super.tap do |view|\n (@_content_for_layout || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end",
"def set_template\n end",
"def prep_template(language,frame_binding)\n\n template=@localized_templates[language]\n @language=language\n eval(\"@language='#{language}'\",frame_binding)\n \n unless template\n local_template_text=@raw_template.result(frame_binding)\n local_template_text=local_template_text.gsub(@ltag,\"<%\")\n local_template_text=local_template_text.gsub(@rtag,\"%>\")\n\n template=compile(local_template_text)\n @localized_templates[language]=template unless is_development?\n end\n template\n \n end",
"def _ctx(ctx, template_signature)\n if !ctx.resources.include? template_signature\n Loader.load_template_files(ctx, template_signature)\n end\n ctx\n end",
"def render\n ERB.new(load_resource(template)).result(bound.get_binding)\n end",
"def local_template(path)\n # Is there a better way to specify alternate template locations with sinatra?\n File.read(File.join(File.dirname(__FILE__), \"server/views/#{path}\"))\n end",
"def template_content\n if respond_to? :contents and contents\n contents.elements.map do |item|\n if item.content.respond_to? :template\n item.content.template.renderable.template.render\n else\n ::Alongslide::render item.text_value, plain: true\n end\n end\n end\n end",
"def load_page(resource_name, options={}) \n \n begin\n #p \"LOAD-PAGE-START\" \n resource_name = resource_name.to_s if resource_name.is_a?(Symbol)\n \n if path=get_path(resource_name) \n \n page_data = parse_page_file(path).symbolize_keys\n\n template_engine = if page_data.has_key?(:template_engine)\n page_data[:template_engine] \n else\n # [NOTE 2019.01.22] Resources optimization : 'erb' by default\n 'erb' # SystemConfiguration::Variable.get_value('site_template_engine') || 'erb'\n end\n\n body = page_data[:body] || \"\"\n if String.method_defined?(:force_encoding)\n body.force_encoding('utf-8')\n end \n \n # Builds the page body\n page_template = Tilt[template_engine].new { body }\n page_body = page_template.render(self, options[:locals]) \n \n if String.method_defined?(:force_encoding)\n page_body.force_encoding('utf-8')\n end \n\n page_build = { :title => options[:page_title] || page_data[:title], \n :author => options[:page_author] || page_data[:author], \n :keywords => options[:page_keywords] || page_data[:keywords], \n :language => options[:page_language] || page_data[:language], \n :description => options[:page_description] || page_data[:description], \n :summary => options[:page_summary] || page_data[:summary],\n :content => page_body,\n :resource => \"#{resource_name} #{options[:page_resource]}\",\n :scripts => options[:scripts] || page_data[:scripts]}\n\n if options.has_key?(:custom_js) and !options[:custom_js].nil? and !options[:custom_js].empty?\n if js_path = get_path(\"#{options[:custom_js]}.js\")\n page_build.store(:scripts_source, Tilt.new(js_path).render(self, options[:locals]))\n end\n else\n if js_path = get_path(\"#{resource_name}.js\")\n page_build.store(:scripts_source, Tilt.new(js_path).render(self, options[:locals]))\n end\n end\n\n if options.has_key?(:custom_css) and !options[:custom_css].nil? and !options[:custom_css].empty?\n if css_path = get_path(\"#{options[:custom_css]}.js\")\n page_build.store(:styles_source, Tilt.new(css_path).render(self, options[:locals]))\n end\n else\n if css_path = get_path(\"#{resource_name}.css\")\n page_build.store(:styles_source, Tilt.new(css_path).render(self, options[:locals]))\n end\n end\n #p \"LOAD-PAGE-END\" \n page(UI::Page.new(page_build), options)\n \n else\n puts \"Resource Not Found. Path= #{request.path_info} Resource name= #{resource_name}\"\n status 404\n end\n \n rescue Errno::ENOENT => error\n puts \"Resource Not Found. Path= #{request.path_info} Resource name= #{resource_name} Error= #{error}\"\n status 404\n end \n \n end",
"def render(options=nil, deprecated_status_or_extra_options=nil, &block)\n if ::Rails::VERSION::STRING >= '2.0.0' && deprecated_status_or_extra_options.nil?\n deprecated_status_or_extra_options = {}\n end\n \n unless block_given?\n unless integrate_views?\n if @template.respond_to?(:finder)\n (class << @template.finder; self; end).class_eval do\n define_method :file_exists? do; true; end\n end\n else\n (class << @template; self; end).class_eval do\n define_method :file_exists? do; true; end\n end\n end\n (class << @template; self; end).class_eval do\n define_method :render_file do |*args|\n @first_render ||= args[0] unless args[0] =~ /^layouts/\n end\n \n define_method :pick_template do |*args|\n @_first_render ||= args[0] unless args[0] =~ /^layouts/\n PickedTemplate.new\n end\n end\n end\n end\n\n if matching_message_expectation_exists(options)\n expect_render_mock_proxy.render(options, &block)\n @performed_render = true\n else\n if matching_stub_exists(options)\n @performed_render = true\n else\n super(options, deprecated_status_or_extra_options, &block)\n end\n end\n end",
"def partial(template_name, locals, &content)\n self.kramdown_source.render(template_name)\n end",
"def find_template(views, name, engine, &block)\n paths = views.map { |d| Sinarey.root + '/app/views/' + d }\n Array(paths).each { |v| super(v, name, engine, &block) }\n end",
"def ajax_load_email_template_info\n\n # Get the Current App\n @app = MailfunnelsUtil.get_app\n\n # Get the Node from the DB\n node = Node.find(params[:node_id])\n\n # Get the Template related to node\n @template = EmailTemplate.find(node.email_template_id)\n\n\n if @template.style_type === 1\n html = File.open(\"app/views/template/styles/mf-minimal_1.html.erb\").read\n else\n html = File.open(\"app/views/email/template.html.erb\").read\n end\n\n @renderedhtml = \"1\"\n ERB.new(html, 0, \"\", \"@renderedhtml\").result(binding)\n\n\n data = {\n :html => @renderedhtml\n }\n\n # Return data as JSON\n render json: data\n\n\n end",
"def template\n template_name = params[:template_name]\n\n render \"templates/#{template_name}\", locals: { }, :layout => nil\n end",
"def load_templates\n templates = {}\n file = __FILE__\n\n begin\n io = ::IO.respond_to?(:binread) ? ::IO.binread(file) : ::IO.read(file)\n app, data = io.gsub(\"\\r\\n\", \"\\n\").split(/^__END__$/, 2)\n rescue Errno::ENOENT\n app, data = nil\n end\n\n if data\n lines = app.count(\"\\n\") + 1\n template = nil\n data.each_line do |line|\n lines += 1\n if line =~ /^@@\\s*(.*\\S)\\s*$/\n template = ''\n templates[$1.to_sym] = template\n elsif template\n template << line\n end\n end\n end\n\n templates\nend",
"def render(template_path)\n template = File.read(\"#{app.views}/#{template_path.sub(/^\\//, '')}\")\n engine = Haml::Engine.new(template)\n @response = engine.render(self, assigns_for_template)\nend",
"def render_template(template_name, locals={})\n parse_file_as_erb(\"#{Rails.root}/lib/tasks/templates/#{template_name}.erb\", locals)\nend",
"def find_templates(name, prefix, partial, details)\n conditions = {\n path: normalize_path(name, prefix),\n locale: normalize_array(details[:locale]).first,\n format: normalize_array(details[:formats]).first,\n handler: normalize_array(details[:handlers]),\n partial: partial || false\n }\n\n ::Page.visible(user_sign_in_status).where(conditions).map do |record|\n initialize_template(record)\n end\n end",
"def render(options = {})\n template.render options\n end",
"def render(template_name)\n controller_name = self.class.name.underscore\n dir_path = File.dirname(__FILE__)\n\n file_path = File.join(dir_path, \"..\", 'views', controller_name, \"#{template_name}.html.erb\")\n file_content = File.read(file_path)\n\n template = ERB.new(file_content)\n render_content(template.result(binding), 'text/html')\n end",
"def build( special_contexts=[] )\r\n\r\n self.ehtmls, self.ecss, self.ejs = self.theme.original_page_layout_root.build_content(special_contexts)\r\n self.ehtml = self.ehtmls.first\r\n\r\n end",
"def render(template_name, view_handler, locals, &content)\n self.kramdown_source.render(template_name)\n end",
"def find_template(views, name, engine, &block)\n Array(views).each {|v|super(v, name, engine, &block) }\n end",
"def _run_tpl(ctx, obj, sym, args={}, &block)\n Tanuki::Loader.run_template(ctx.templates, obj, sym, args, &block)\n end",
"def determine_template(options)\n keys = options.has_key?(:locals) ? options[:locals].keys : []\n\n if options.key?(:body)\n Template::Text.new(options[:body])\n elsif options.key?(:plain)\n Template::Text.new(options[:plain])\n elsif options.key?(:html)\n Template::HTML.new(options[:html], formats.first)\n elsif options.key?(:file)\n if File.exist?(options[:file])\n Template::RawFile.new(options[:file])\n else\n if Pathname.new(options[:file]).absolute?\n raise ArgumentError, \"File #{options[:file]} does not exist\"\n else\n raise ArgumentError, \"`render file:` should be given the absolute path to a file. '#{options[:file]}' was given instead\"\n end\n end\n elsif options.key?(:inline)\n handler = Template.handler_for_extension(options[:type] || \"erb\")\n format = if handler.respond_to?(:default_format)\n handler.default_format\n else\n @lookup_context.formats.first\n end\n Template::Inline.new(options[:inline], \"inline template\", handler, locals: keys, format: format)\n elsif options.key?(:renderable)\n Template::Renderable.new(options[:renderable])\n elsif options.key?(:template)\n if options[:template].respond_to?(:render)\n options[:template]\n else\n @lookup_context.find_template(options[:template], options[:prefixes], false, keys, @details)\n end\n else\n raise ArgumentError, \"You invoked render but did not give any of :body, :file, :html, :inline, :partial, :plain, :renderable, or :template option.\"\n end\n end",
"def perform_template_load\n memoize(:template) do\n self.data[:template] = api.stack_template_load(self)\n true\n end\n end",
"def template_page(site); end",
"def render_template(name, is_user_template, render_params)\n template_params, haml = load(name, is_user_template)\n renderer.render(\n inline: haml,\n type: :haml,\n locals: render_params.merge(@@locals))\n end",
"def render(template_name)\n controller_name = self.class.to_s.underscore\n filepath = \"views/#{controller_name}/#{template_name}.html.erb\"\n file = File.read(filepath)\n\n to_render = ERB.new(file).result(binding)\n\n self.render_content(to_render, \"text/html\")\n end",
"def init(context={})\n\n app = context[:app]\n \n # View models\n ::Model::ViewModel.new(:content, 'content', ContentManagerSystem::Content, :view_template_contents,\n [::Model::ViewModelField.new(:_id, 'id', :string),\n ::Model::ViewModelField.new(:title, 'title', :string),\n ::Model::ViewModelField.new(:path, 'path', :string),\n ::Model::ViewModelField.new(:alias, 'alias', :string),\n ::Model::ViewModelField.new(:summary, 'summary', :string),\n ::Model::ViewModelField.new(:type, 'type', :string),\n ::Model::ViewModelField.new(:creation_date, 'creation_date', :date),\n ::Model::ViewModelField.new(:creation_user, 'creation_user', :string)])\n \n ::Model::ViewModel.new(:term, 'term', ContentManagerSystem::Term, :view_template_terms,\n [::Model::ViewModelField.new(:id, 'id', :serial),\n ::Model::ViewModelField.new(:description, 'description', :string)])\n\n ::Model::ViewModel.new(:profile, 'profile', Users::Profile, :view_template_profiles,[]) \n\n # View renders \n teaser_preprocessor = Proc.new do |data, context, render_options|\n data.map { |element| CMSRenders::Factory.get_render(element, context, 'teaser').render({}, [:ignore_complements, :ignore_blocks]) }\n end\n\n slider_preprocessor = Proc.new do |data, context, render_options|\n data.map { |element| CMSRenders::Factory.get_render(element, context, 'justphoto').render({}, [:ignore_complements, :ignore_blocks]) }\n end\n\n term_hierarchy_preprocessor = Proc.new do |data, context, render_options|\n separator = render_options['separator'] || \" · \"\n data.map do |element| \n terms = []\n terms << \"<a href=\\\"#{render_options['prefix']}/#{element.id}\\\">\"\n terms << \"#{element.description}</a>\"\n while not element.parent.nil?\n element = element.parent\n terms << separator\n terms << \"<a href=\\\"#{render_options['prefix']}/#{element.id}\\\">#{element.description}</a>\"\n end\n render_result = \"<div class=\\\"term-hierarchy-container #{render_options['container_class']}\\\">\" << terms.reverse.join << \"</div>\"\n end\n \n end\n\n ::Model::ViewRender.new(:teaser, 'teaser', ::Model::ViewStyle::VIEW_STYLE_TEASER, teaser_preprocessor)\n ::Model::ViewRender.new(:thumbnail, 'thumbnail', Model::ViewStyle::VIEW_STYLE_THUMBNAIL)\n\n end",
"def render(opts={})\n update(opts)\n render_template\n end",
"def render(template_name, context=Context.new, layout=true)\n #context = Context.new(context) if context.is_a?(Hash)\n context = hook_context(context)\n while true\n template = get_template(template_name, context) # context is passed only for preprocessor\n _buf = context._buf\n output = template.render(context)\n context._buf = _buf\n unless context._layout.nil?\n layout = context._layout\n context._layout = nil\n end\n layout = @layout if layout == true or layout.nil?\n break unless layout\n template_name = layout\n layout = false\n context.instance_variable_set('@_content', output)\n end\n return output\n end",
"def get_template(template); end"
] |
[
"0.69908416",
"0.6917662",
"0.67717123",
"0.6731284",
"0.6692956",
"0.6686512",
"0.6598087",
"0.65941477",
"0.6592466",
"0.6592466",
"0.6558711",
"0.6551879",
"0.65018123",
"0.64419883",
"0.64108515",
"0.6382845",
"0.6351124",
"0.633918",
"0.6338802",
"0.63102716",
"0.63049936",
"0.6299128",
"0.62937546",
"0.6273241",
"0.62556124",
"0.6252728",
"0.62458205",
"0.62298536",
"0.62298274",
"0.6218376",
"0.6218376",
"0.6197851",
"0.61936533",
"0.61917967",
"0.61860687",
"0.61858904",
"0.6169263",
"0.6145753",
"0.61330706",
"0.61305654",
"0.61209065",
"0.61027765",
"0.6094247",
"0.60941666",
"0.6089302",
"0.60854876",
"0.6076575",
"0.6068079",
"0.60561913",
"0.6051371",
"0.60493594",
"0.6048597",
"0.60387313",
"0.60238725",
"0.6023565",
"0.60227334",
"0.6020753",
"0.60160315",
"0.6013573",
"0.6012963",
"0.5998252",
"0.59937453",
"0.5993671",
"0.59900755",
"0.59886706",
"0.59841436",
"0.5982328",
"0.59681076",
"0.5964283",
"0.59618944",
"0.596165",
"0.5960816",
"0.5955066",
"0.5954661",
"0.5954456",
"0.59481364",
"0.59454066",
"0.59450054",
"0.59384376",
"0.59381026",
"0.59369",
"0.59340346",
"0.5927071",
"0.59262323",
"0.59242314",
"0.5922276",
"0.5922007",
"0.5919711",
"0.5912042",
"0.59108084",
"0.59053695",
"0.59031904",
"0.5899456",
"0.58973163",
"0.5896369",
"0.58960986",
"0.58958656",
"0.5894205",
"0.5887298",
"0.5886594",
"0.58851695"
] |
0.0
|
-1
|
these methods behave the same in all contexts they are context independet
|
def is_context?(context_name)
@type == context_name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def _prepare_context; end",
"def context_methods; end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def isolated; end",
"def isolated; end",
"def lookup_context; end",
"def lookup_context; end",
"def lookup_context; end",
"def in_context(context); end",
"def last_context; end",
"def context(&block); end",
"def context(&block); end",
"def last_context=(_arg0); end",
"def context_methods\n super + [:context]\n end",
"def private; end",
"def lookup_context=(_arg0); end",
"def context=(value); end",
"def mainContext\n # return Context.find( context )\n return context\n end",
"def context_pin; end",
"def run_context\n nil\n end",
"def isolated?; end",
"def isolated?; end",
"def probers; end",
"def context\n init\n @context\n end",
"def in_exception_context?; end",
"def context\n nil\n end",
"def call\n setup_context\n super\n end",
"def setup(_context)\n end",
"def same; end",
"def internship_passed; end",
"def alter_context(context = T.unsafe(nil)); end",
"def testConflictingActivation\n #\"This adaptation is known to work from previous tests.\"\n @quietContext = Context.named(\"quiet\")\n @offHookContext = Context.named(\"offHook\")\n @quietContext.adaptClass(Phone, \"advertise\", Phone.advertiseQuietly)\n assert_nothing_raised(RuntimeError){@offHookContext.adaptClass(Phone, \"advertise\", Phone.advertiseWaitingCall)}\n\n assert(!@quietContext.isActive, \"In normal conditions, the quiet context should be inactive\")\n assert_nothing_raised(RuntimeError) {@quietContext.activate} \n # description: 'It should be OK to activate the quiet context';\n assert(@quietContext.isActive,\"The context activation should have taken place\")\n assert(!@offHookContext.isActive, \"In normal conditions, the off-hook context should be inactive\")\n assert_nothing_raised(RuntimeError) {@offHookContext.activate}#to fix \n # description: 'Off-hook context should conflict with currently active quiet context';\n assert(@offHookContext.isActive, \"Off-hook should not be mistakenly activated after error\")\n assert_nothing_raised(RuntimeError) {@quietContext.deactivate} \n # description: 'It should be OK to deactivate the quiet context'.\n \n end",
"def around_hooks; end",
"def used?; end",
"def context\n @context ||= {}\n end",
"def context\n @context ||= {}\n end",
"def _context(*args, &block)\n puts \"<<< WARNING >>> IGNORING TEST SET #{args.inspect}. Remove leading _ from '_context()' to reactivate.\"\n end",
"def who_we_are\r\n end",
"def isolated=(_arg0); end",
"def isolated=(_arg0); end",
"def execution_context\n initialize_context!(Object.new)\n end",
"def in_context\n old_context = self.context\n self.context = self\n yield\n self.context = old_context\n end",
"def context\n\n self\n end",
"def context\n @context ||= Context.new(self)\n end",
"def management\n prepareBaseContext\n end",
"def context\n unless @instance_context\n @instance_context = AnonymizeContext.new(@version , @params['room_sid'], @params['sid'])\n end\n @instance_context\n end",
"def called_from; end",
"def called_from; end",
"def before_dispatch(env); end",
"def this_context\n self\n end",
"def context_for_eval; end",
"def refutal()\n end",
"def get_context(*params); raise('Stub or mock required.') end",
"def strategy; end",
"def ___super___\n isolation_context.instance\n end",
"def __bb_context; end",
"def weber; end",
"def common\n \n end",
"def context\n {}\n end",
"def context\n {}\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def simple_context\n context_director.simple_context\n end",
"def before_dispatch(_env)\n end",
"def calls; end",
"def calls; end",
"def implementation; end",
"def implementation; end"
] |
[
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.70088047",
"0.68407303",
"0.6540749",
"0.65018356",
"0.65018356",
"0.65018356",
"0.65018356",
"0.65018356",
"0.65018356",
"0.65018356",
"0.65018356",
"0.65018356",
"0.65018356",
"0.6464584",
"0.6464584",
"0.64644873",
"0.64644873",
"0.64644873",
"0.64387757",
"0.6126122",
"0.61010975",
"0.61010975",
"0.60455996",
"0.5999936",
"0.59936774",
"0.5967944",
"0.5893404",
"0.58351135",
"0.583226",
"0.57302475",
"0.5698242",
"0.5698242",
"0.5691887",
"0.568984",
"0.56792223",
"0.5644001",
"0.5635478",
"0.56286365",
"0.5625769",
"0.56055367",
"0.5603719",
"0.56019366",
"0.55869037",
"0.5586169",
"0.55859154",
"0.55859154",
"0.55735123",
"0.55553764",
"0.5528243",
"0.5528243",
"0.5527975",
"0.55239654",
"0.5522999",
"0.5519242",
"0.551856",
"0.5510183",
"0.5507346",
"0.5507346",
"0.55009663",
"0.54869914",
"0.5481598",
"0.54731244",
"0.54536134",
"0.5429144",
"0.54287684",
"0.54138285",
"0.54047865",
"0.53929955",
"0.53681594",
"0.53681594",
"0.5366499",
"0.5366499",
"0.5366499",
"0.5366499",
"0.53643674",
"0.53593487",
"0.535339",
"0.535339",
"0.53461814",
"0.53461814"
] |
0.0
|
-1
|
this is special kind of method that is used in layout template. it gets correct partial for the layout depending on context.
|
def get_content_for_layout()
get_partial(@type)
# if @type == "home"
# get_partial('home')
# elsif @type == "page"
# get_partial('page')
# elsif @type == "article"
# get_partial('article')
# elsif @type == "category"
# get_partial('category')
# end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def render_partial(context, options, &block); end",
"def render_with_layout_and_partials(format)\n # looking for system mail.\n template = MailEngine::MailTemplate.where(:path => \"#{controller_path}/#{action_name}\", :format => format, :locale => I18n.locale, :partial => false, :for_marketing => false).first\n # looking for marketing mail.\n template = MailEngine::MailTemplate.where(:path => action_name, :format => format, :locale => I18n.locale, :partial => false, :for_marketing => true).first if template.blank?\n\n # if found db template set the layout and partial for it.\n if template\n related_partial_paths = {}\n # set @footer or @header\n template.template_partials.each do |tmp|\n related_partial_paths[\"#{tmp.placeholder_name}_path\".to_sym] = tmp.partial.path\n end\n\n # set layout\n render :template => \"#{controller_path}/#{action_name}\", :layout => \"layouts/mail_engine/mail_template_layouts/#{template.layout}\", :locals => related_partial_paths\n else\n # if not found db template should render file template\n render(action_name)\n end\n end",
"def to_partial_path\n \"alchemy/page_layouts/#{layout_partial_name}\"\n end",
"def respond_with_partial_or(partial_layout: \"/layouts/_panel\", &block) \n if partial_path.to_s.strip.present?\n respond_with_partial(layout_path: partial_layout)\n else\n yield\n end\n end",
"def partial; end",
"def partial; end",
"def partial; end",
"def partial; end",
"def respond_with_partial(layout_path: \"/layouts/_panel\")\n respond_to do |format|\n format.html do\n render template: partial_path, layout: layout_path\n end\n end\n end",
"def partial?; end",
"def render(*args)\n if args.first.is_a?(Hash) && args.first.keys.include?(:partial)\n return haml \"layouts/_#{args.first[:partial]}.html\".to_sym, :layout => false\n else\n super\n end\n end",
"def show_partial\n Partial\n end",
"def to_partial_path\n \"alchemy/site_layouts/#{partial_name}\"\n end",
"def render_partial(*ignore_args); end",
"def partial (template, options = {})\n options = { :layout => false }.merge options\n if template.is_a? Hash\n options[:locals] = template[:locals] || {}\n template.delete(:locals) if template[:locals] \n options[:locals].merge! template\n template = template.reject{ |key, value| [:locals].include? key }.keys.first.to_s\n end \n haml(\"_#{template}\".to_sym, options)\n end",
"def partial\n segments = @page.template.split(\"/\").map!(&:underscore)\n\n # If we have multiple segments & they target an existing page partial\n if segments.count > 1 && lookup_context.exists?(segments.join(\"/\"), [\"pages\"], true)\n partial = segments.pop\n\n return partial_path(segments.join(\"/\"), partial)\n end\n\n partial_path(segments.join(\"/\"))\n end",
"def partial_in(controller, partial_name, *args)\n partial_name = PARTIAL_PREFIX + partial_name.to_s\n begin\n controller.render_partial(partial_name, *args)\n rescue\n Ramaze::Log.error(\"Error loading partial #{controller.to_s}.#{partial_name}\")\n raise $!\n end\n end",
"def render_partial(template, types, context)\n templates.get(template, types).render(context)\n end",
"def partial(page, locals={})\n haml page, {:layout => false}, locals\n end",
"def partial_for_model(model, partial)\n controller = active_scaffold_controller_for(model)\n while controller.uses_active_scaffold?\n path = File.join(controller.controller_path, partial)\n return path if template_exists?(path, true)\n controller = controller.superclass\n end\n nil\n end",
"def fetch_or_cache_partial(cached_partials, template, order_by:); end",
"def content_partial\n @content_partial ||= begin\n layout_variant = parent.own_or_inherited_layout_variant[target]\n layout_variant['representation'] + '_content' if layout_variant\n end\n end",
"def partial(partial_name)\n partial_name = partial_name.to_s\n ext = nil\n partial_dir = File.join [@current_group.name, @current_page.name]\n \n partial_string = \"\"\n partial_file = nil\n \n while ext.nil? do\n if File.exist?(File.expand_path(\"project/site/#{partial_dir}/#{partial_name}.erb\", MOKA_ROOT))\n partial_file = File.new(File.expand_path(\"project/site/#{partial_dir}/#{partial_name}.erb\", MOKA_ROOT), \"r\")\n ext = \"erb\"\n elsif File.exist?(File.expand_path(\"project/site/#{partial_dir}/#{partial_name}.haml\", MOKA_ROOT))\n partial_file = File.new(File.expand_path(\"project/site/#{partial_dir}/#{partial_name}.haml\", MOKA_ROOT), \"r\")\n ext = \"haml\"\n end\n if partial_dir == \"\" and ext.nil?\n puts \"WARNING: cannot find partial file #{partial_name}.erb or #{partial_name}.haml\"\n break\n end\n partial_dir = File.dirname partial_dir\n if partial_dir == \".\"\n partial_dir = \"\"\n end\n end\n \n unless partial_file.nil?\n partial_string = partial_file.read\n partial_file.close\n end\n \n return Moka::Utilities.eval_erb_haml(partial_string, ext, self.get_binding)\n end",
"def get_partial(partial_name)\n tpl = @engine.templates.get_partial(partial_name)\n tpl.render(self, @context_vars)\n end",
"def partial_for(obj, partial, parent_directory)\n\t\ttmp = obj.class.to_s.split('::')\n\t\tklass_sym = tmp[-1] # e.g, 'OfferArtifact'\n\t\tcontract_sym = tmp[-2] # e.g, 'Bet'\n\t\tpath = nil\n\t\tif (parent_directory != '') then\n\t\t\tpath = \"contract_views/#{contract_sym.underscore}/#{parent_directory}/#{klass_sym.underscore}\"\n\t\t\t# e.g, contract_views/bet/artifacts/OfferArtifact\n\t\telse\n\t\t\tpath = \"contract_views/#{contract_sym.underscore}/\"\n\t\t\t# e.g, contract_views/bet/\n\t\tend\n\t\tFile.join(path, partial)\n\tend",
"def partial(template_name, locals, &content)\n self.kramdown_source.render(template_name)\n end",
"def render_partial(name, options={})\n if File.exists?(Rails.root.join(\"app\", \"views\", \"layouts\", \"#{name.gsub(/\\/(?!.*\\/)/, \"/_\")}.html.erb\"))\n name = \"#{website.folder}/#{name}\"\n end\n eval(\"render '#{name}', options\")\n end",
"def render_partial(p,local_assigns={})\n# ActionView::TestCase::Behavior#, which invokes ActionView::Rendering#:\n if local_assigns.blank? # Work around bugs:\n render :partial => p\n else\n render p, local_assigns\n end\n @partial=p.clone.insert p.index(?/)+1, '_'\n end",
"def partial(partial)\n partial_view = \"partials/_#{partial}\".to_sym\n erb partial_view, :layout => false\nend",
"def partial(name)\n BaseController.render_partial(\"#{name}\")\n end",
"def get_group_partial(group_name)\n if layout_config[\"groups\"].include?(group_name) && layout_config[\"groups\"][group_name].include?(\"editor_partial\")\n return \"layouts/#{layout_config[\"groups\"][group_name][\"editor_partial\"]}\"\n end\n return \"editor/group\"\n end",
"def render_partial(file_name)\n # The \"default\" version of the partial.\n file_to_render = \"#{@input_folder}/partials/#{file_name.to_s}.haml\"\n if @scope\n # Look for a partial prefixed with the current \"scope\" (which is just the name of the\n # primary template being rendered).\n scope_file = \"#{@input_folder}/partials/#{@scope.to_s}_#{file_name.to_s}.haml\"\n # Use it if it's there.\n file_to_render = scope_file if File.exists? scope_file\n end\n # If we found a matching partial (either the scoped one or the default), render it now.\n if File.exists? file_to_render\n partial = Haml::Engine.new(File.read(file_to_render), @options)\n partial.render self\n else\n nil\n end\n rescue Exception => e\n raise $!, \"#{$!} PARTIAL::#{file_name} \", $!.backtrace\n end",
"def partial(template, locals = {})\n haml(template, :layout => false, :locals => locals)\n end",
"def partial(template, locals = {})\n haml(template, {:layout => false}, locals)\n end",
"def partial(template, locals = {})\n haml(template, {:layout => false}, locals)\n end",
"def render_partial(name, options={})\n name = name.to_s\n if File.exists?(Rails.root.join(\"app\", \"views\", \"#{website.folder}/#{name.gsub(/\\/(?!.*\\/)/, \"/_\")}.html.erb\"))\n name = \"#{website.folder}/#{name}\"\n end\n eval(\"render '#{name}', options\")\n end",
"def partial(name, options={})\n old_format = self.template_format\n self.template_format = :html\n js render({ :partial => name }.merge(options))\n ensure\n self.template_format = old_format\n end",
"def partial(file_name)\n erb file_name, :layout => false\n end",
"def view_layouts_base_sidebar(context={})\n context[:controller].send(:render_to_string, {\n :partial => \"hooks/proto_plugin/view_layouts_base_sidebar\",\n :locals => context\n })\n end",
"def after_partial_setup(view)\n end",
"def load_cached_partial(path, context)\n context.registers[:cached_partials] ||= {}\n cached_partial = context.registers[:cached_partials]\n\n if cached_partial.key?(path)\n cached_partial[path]\n else\n unparsed_file = context.registers[:site]\n .liquid_renderer\n .file(path)\n begin\n cached_partial[path] = unparsed_file.parse(File.read(path, **context.registers[:site].file_read_opts))\n rescue Liquid::Error => e\n e.template_name = path\n e.markup_context = \"included \" if e.markup_context.nil?\n raise e\n end\n end\n end",
"def partial\n mod = self.class.name.split(\"::\")[-2]\n partial_name = ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(self.class.name))\n File.join(STREAMLINED_TEMPLATE_ROOT, \"relationships/#{mod.underscore}/_#{partial_name}.rhtml\")\n end",
"def to_partial_path\n self.class._to_partial_path\n end",
"def render_template(view, template, layout_name, locals); end",
"def some_partial\n # Used for testing.\n render_in_modal('layouts/some_partial')\n end",
"def partial\n \"/otus/page/material_examined\"\n end",
"def inside_layout(layout, &block)\n binding = block.binding if BINDING_REQUIRED\n\n layout = Dir.entries('app/views/layouts').detect { |a| /#{layout}/.match(a) }\n @template.instance_variable_set('@content_for_layout', capture(&block))\n concat(\n @template.render(:file => \"#{RAILS_ROOT}/app/views/layouts/#{layout}\", :user_full_path => true),\n binding\n )\n end",
"def render_sidebar\n if FileTest.exist?(File.join(RAILS_ROOT, 'app', 'views', controller.controller_name.downcase, '_sidebar.html.erb')) \n render :partial => \"#{controller.controller_name.downcase}/sidebar\"\n end\n end",
"def layouts_show(*args)\n obj = args.shift\n if args.present?\n name_of_partial = (args.shift).to_s\n name_of_attribute = (args.shift||name_of_partial).to_s\n header = args.shift\n render \"layouts/show/#{name_of_partial}\", obj: obj, sender: name_of_attribute, header: header, args: args.shift\n else\n render \"layouts/show\", obj: obj\n end\n end",
"def partial(template, locals = {})\n haml(template, { layout: false }, locals)\n end",
"def partial(name, options = {})\n options[:partial] = name\n action_view.render(options)\n end",
"def to_partial_path\n \"alchemy/elements/#{name}_view\"\n end",
"def partial!(*args)\n if args.one? && _is_active_model?(args.first)\n _render_active_model_partial args.first\n else\n _render_explicit_partial(*args)\n end\n end",
"def render_partial name, locals\n @context.instance_eval { render :partial => \"view_models/collection/#{name}\", :locals => locals }\n end",
"def set_partial_path\n @partial_path = params[:partial_path]\n end",
"def determine_layout\r\n #\"earthlingtwo/earthlingtwo\"\r\n \"#{template_name}/#{template_name}\"\r\n end",
"def load_cached_partial(path, context)\n context.registers[:cached_partials] ||= {}\n cached_partial = context.registers[:cached_partials]\n\n if cached_partial.key?(path)\n cached_partial[path]\n else\n unparsed_file = context.registers[:globals]\n .liquid_renderer\n .file(path)\n begin\n # Cache a version of the\n cached_partial[path] = unparsed_file.parse(read_file(path, context))\n rescue Liquid::Error => e\n e.template_name = path\n e.markup_context = \"included \" if e.markup_context.nil?\n raise e\n end\n end\n end",
"def partial(name)\n partial_name = \"_#{name}.#{Stache.template_extension}\"\n template_dir = self.virtual_path.split(\"/\")[0..-2].join(\"/\")\n partial_path = File.expand_path(File.join(Stache.template_base_path, template_dir, partial_name))\n # ::Rails.logger.info \"Checking for #{partial_path} in template_dir: #{template_dir}\"\n unless File.file?(partial_path)\n partial_path = \"#{Stache.shared_path}/#{partial_name}\"\n end\n \n # ::Rails.logger.info \"LOADING PARTIAL: #{partial_path}\"\n File.read(partial_path)\n end",
"def main_navigation_partial\n partial_path = \"shared/\"\n partial_name = \"main_navigation\"\n path_exists?(\"app/views/#{partial_path}_#{partial_name}.html.*\") ? \"#{partial_path}#{partial_name}\" : nil\n end",
"def partial(*args)\n partial_name = args.shift.to_s\n partial_name = PARTIAL_PREFIX + partial_name\n render_partial(partial_name, *args)\n end",
"def find_template(views, name, engine, &block)\n\t\t \t#normal\n\t\t super(views, name, engine, &block)\n\t\t #_layout folder\n\t\t super(Paths.layout_path, name.to_s, engine, &block)\n\t\t end",
"def partial(template, locals = {})\n erb(template, :layout => false, :locals => locals)\n end",
"def partial(template, locals = {})\n erb(template, :layout => false, :locals => locals)\n end",
"def render_partial_for(element, field, label, tip, template, helper, required, extra_locals, args)\n errors = self.class.ignore_errors ? nil : error_message_for(field)\n locals = extra_locals.merge(:element => element, :field => field, :builder => self, :object => object, :object_name => object_name, :label => label, :errors => errors, :tip => tip, :helper => helper, :required => required)\n\n @template.render :partial => \"#{self.class.template_root}/#{template}.html.erb\", :locals => locals\n end",
"def partial(name)\n @logger.debug( \"#{__method__} name=#{name}\" )\n get_partial( name )\n end",
"def layout\n lookup_layout\n end",
"def find_view_holder\n\n view_holder_path = Themes::ThemeManager.instance.selected_theme.resource_path(\"#{frontend_skin_preffix}render-viewholder-#{view.render}.erb\",'template','cms') \n \n if not view_holder_path\n path = context.get_path(\"#{frontend_skin_preffix}render-viewholder-#{view.model_name}-#{view.render}\")\n view_holder_path = path if not path.nil? and File.exists?(path)\n end\n\n return view_holder_path\n\n end",
"def nice_partials_locale_prefix_from_view_context_and_block(context, block)\n root_paths = context.view_renderer.lookup_context.view_paths.map(&:path)\n partial_location = block.source_location.first.dup\n root_paths.each { |path| partial_location.gsub!(/^#{path}\\//, '') }\n partial_location.split('.').first.gsub('/_', '/').gsub('/', '.')\nend",
"def on_mustache_partial(name)\n [:dynamic, \"#{options[:partial]}(#{name.to_sym.inspect})\"]\n end",
"def partial(page, options={})\n erb page, options.merge!(:layout => false)\n end",
"def partial(page, options={})\n erb page, options.merge!(:layout => false)\n end",
"def page_partial(page)\n page.set_page? ? 'set_page_li' : 'page_li'\n end",
"def partial(template, *args)\n template_array = template.to_s.split('/')\n template = template_array[0..-2].join('/') + \"/_#{template_array[-1]}\"\n options = args.last.is_a?(Hash) ? args.pop : {}\n options.merge!(:layout => false)\n locals = options[:locals] || {}\n\n if (collection = options.delete(:collection))\n collection.inject([]) do |buffer, member|\n buffer << haml(:\"#{template}\",\n options.merge(:layout => false,\n :locals => {template_array[-1].to_sym => member}.merge(locals)))\n end.join(\"\\n\")\n else\n haml(:\"#{template}\", options)\n end\n end",
"def render(template, types, context)\n unless templates.exist_for_types?(layout, types)\n return render_partial(template, types, context)\n end\n load_layout_template(types).render(context) do\n render_partial(template, types, context)\n end\n end",
"def partial?\n @type == :partial\n end",
"def partial(template, *args)\n template_array = template.to_s.split('/')\n template = template_array[0..-2].join('/') + \"/_#{template_array[-1]}\"\n options = args.last.is_a?(Hash) ? args.pop : {}\n options.merge!(:layout => false)\n locals = options[:locals] || {}\n if collection = options.delete(:collection) then\n collection.inject([]) do |buffer, member|\n buffer << erb(:\"#{template}\", options.merge(:layout =>\n false, :locals => {template_array[-1].to_sym => member}.merge(locals)))\n end.join(\"\\n\")\n else\n erb(:\"#{template}\", options)\n end\n end",
"def partial(name, options={})\n path = \"com/\"+(params[:path].empty? ? ['index'] : params[:path]).join(\"/\") + \"/\"\n path = 'com' if name.starts_with?('/')\n \n render options.merge(:partial => \"#{RIGHTJS_SRC_DOCS}/#{path}#{name}.html.erb\")\n end",
"def layout \n return @layout\n end",
"def render_wizard_partial(main_wizard_model, f)\n @page = main_wizard_model.page || 0\n path = @controller.class.controller_path\n\n template = \"\"\n (0...@page).each { |i|\n fname = \"#{path}/sub_pages/#{main_wizard_model.get_page_template(i)}_hidden\"\n template << \"<%= yield :included_wizard_page_#{i+1} %>\"\n content_for \"included_wizard_page_#{i+1}\" do\n render :partial=>fname, :locals=>{:main_form=>f} rescue \"\"\n end\n }\n\n template << \"<%= yield :included_wizard_page_#{@page+1} %>\"\n content_for \"included_wizard_page_#{@page+1}\" do\n render :partial=>wizard_page_template(main_wizard_model), :locals=>{:main_form=>f}\n end\n\n render :inline=>template\n end",
"def template_content(folder = 'content', partial = 'dummy')\n render_to_string(:partial => \"shared/#{ folder }/#{ partial }\")\n end",
"def partial_path(path)\n \"listings/form_partials/#{path}\"\n end",
"def partial(template, *args)\n template_array = template.to_s.split('/')\n template = template_array[0..-2].join('/') + \"/_#{template_array[-1]}\"\n options = args.last.is_a?(Hash) ? args.pop : {}\n options.merge!(:layout => false)\n locals = options[:locals] || {}\n if collection = options.delete(:collection) then\n collection.inject([]) do |buffer, member|\n buffer << erb(:\"#{template}\", options.merge(:layout =>\n false, :locals => {template_array[-1].to_sym => member}.merge(locals)))\n end.join(\"\\n\")\n else\n erb(:\"#{template}\", options)\n end\n end",
"def find_partial(content)\n return content if content.is_a? String\n begin\n File.open(Dir[\"views/#{content}\\.*\"][0]).read\n rescue\n raise MissingPartialTemplate.new(content)\n end\n end",
"def view_context\n super.tap do |view|\n (@_content_for_layout || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end",
"def determine_layout\n request.xhr? ? 'ajax' : common_layout\n end",
"def get_partial_name( file, line )\n if line =~ /=\\s*render\\s*\\(?:partial\\s*=>\\s*[\"'](.*?)[\"']/\n path = $1\n\n if path.index( '/' )\n path = File.join( 'app/views', path )\n else\n path = File.join( File.dirname( file.path ), path )\n end\n\n path.gsub!( /([^\\/]+)$/, '_\\1')\n\n ( %w[erb rhtml rb haml] ).each do |ext|\n return \"#{path}.#{ext}\" if File.exists?( \"#{path}.#{ext}\" )\n return \"#{path}.html.#{ext}\" if File.exists?( \"#{path}.html.#{ext}\" )\n end\n end\n\n return nil\nend",
"def hookname(context)\n context[:controller].send(:render_to_string, {:locals => context, :partial => '_view_file'})\n end",
"def partial(template, *args)\n template_array = template.to_s.split('/')\n template = template_array[0..-2].join('/') + \"/_#{template_array[-1]}\"\n options = args.last.is_a?(Hash) ? args.pop : {}\n options.merge!(:layout => false)\n if collection = options.delete(:collection) then\n collection.inject([]) do |buffer, member|\n buffer << erb(:\"#{template}\", options.merge(:layout =>\n false, :locals => {template_array[-1].to_sym => member}))\n end.join(\"\\n\")\n else\n erb(:\"#{template}\", options)\n end\n end",
"def partial(template, opts={})\n choose_template_format(Merb.available_mime_types, {}) unless @_template_format\n template = _cached_partials[\"#{template}.#{@_template_format}\"] ||= find_partial(template)\n unless template\n raise TemplateNotFound, \"No template matched at #{unmatched}\"\n end\n \n opts[:as] ||= template[(template.rindex('/_') + 2)..-1].split('.').first\n\n if opts[:with] # Render a collection or an object\n partial_for_collection(template, opts.delete(:with), opts)\n else # Just render a partial\n engine = Template.engine_for(template)\n render_partial(template, engine, opts || {})\n end\n end",
"def to_partial_path\n 'section'\n end",
"def render_document_partial(doc, action_name)\n format = document_partial_name(doc)\n begin\n render :partial=>\"catalog/_#{action_name}_partials/#{format}\", :locals=>{:document=>doc}\n rescue ActionView::MissingTemplate\n render :partial=>\"catalog/_#{action_name}_partials/default\", :locals=>{:document=>doc}\n end\n end",
"def partial(name)\n partial_name = \"_#{name}.#{Config.template_extension}\"\n template_dir = Pathname.new(self.template_file).dirname\n partial_path = File.expand_path(\"#{template_dir}/#{partial_name}\")\n unless File.file?(partial_path)\n partial_path = \"#{Config.shared_path}/#{partial_name}\"\n end\n File.read(partial_path)\n end",
"def render_partial(context, options, &block) # :nodoc:\n render_partial_to_object(context, options, &block).body\n end",
"def determine_layout\n 'akinu'\n end",
"def dynamic_layout\n # ALL THIS SUCKS, I KNOW..\n \n # No layout for AJAX calls\n @layout = if request.xhr? \n nil\n # dialog param = lightview popup\n elsif params[:dialog]\n 'dialog'\n # uses user 'role' name for layout ... bad\n elsif current_user && !current_user.role.nil?\n current_user.role.downcase\n # no user, check for 'about' action\n elsif controller_name == 'about'\n 'about'\n # none of the above, use Rails default\n else\n 'home'\n end\n return nil unless @layout\n \n Rails.logger.debug \"Dyamic layout = #{@layout}\"\n # Layouts further divided by site subdomain: www vs vault\n if current_subdomain == 'vault'\n # Then public vs logged in...ugh\n if current_user\n @layout = 'vault/private/' + @layout\n else\n @layout = 'vault/public/' + @layout\n end\n end\n @layout\n end",
"def render_to_sidebar!(partial_name, options = {})\n sidebar_contains render(options.merge(:partial => partial_name))\n end",
"def determine_layout\n return @__layout if @__layout\n return false if params[:_no_layout] || request.xhr?\n\n @__layout ||= current_page.layout.try(:template) if current_page.present? \n @__layout ||= 'application/default'\n @__layout\n end",
"def partial_admin(name)\n return 'layouts/admin/' + name\n end",
"def remember_partial_name(options)\n ret = ''\n if respond_to?(:controller) and controller.kind_of?(Frontend::FrontendController)\n if options.is_a?(Hash)\n unless options[:partial].blank?\n remember_partial_name = true\n unless options[:locals].blank?\n remember_partial_name = options[:locals].delete(:remember_partial_name) === false ? false : true\n end\n layout = controller.class.inheritable_attributes[:layout]\n layout = layout.split('/').last unless layout.blank?\n name = options[:partial].split('/').last.split('.').first\n current_name = @_current_render.instance_variable_get(:@name).to_s.gsub(/^_/, '')\n values = []\n if instance_variable_defined?(\"@tpn_#{current_name}\")\n values << instance_variable_get(\"@tpn_#{current_name}\")\n values << name if remember_partial_name\n values\n else\n values << (respond_to?(:controller_name) ? controller_name : '')\n first_name = @_first_render.instance_variable_get(:@name).to_s\n values << first_name\n if not (first_name == current_name or layout == current_name)\n values << current_name\n end\n values << name if remember_partial_name\n values\n end\n values.delete_if{|el| el.blank?}\n value = values.join('-')\n instance_variable_set(\"@tpn_#{name}\", value)\n ret = value\n else\n values = []\n values << @_current_render.instance_variable_get(:@name).to_s.gsub(/^_/, '')\n values << (respond_to?(:controller_name) ? controller_name : '')\n values << (respond_to?(:action_name) ? action_name : '')\n values.delete_if{|el| el.blank?}\n ret = value = values.join('-')\n end\n options[:locals] ||= {}\n options[:locals].merge!({:template_partial_path => value})\n end\n end\n return ret\n rescue => e\n Rails.logger.error(e.message + \"\\n\" + e.backtrace.join(\"\\n\") + \"\\n\")\n end",
"def render_manifestation_partial(doc, i, action_name)\n if( i%2 == 0) \n color = \"even\"\n else \n color = \"odd\"\n end\n format = document_partial_name(doc)\n begin\n render :partial=>\"catalog/_#{action_name}_partials/#{format}\", :locals=>{:mandoc=>doc, :color=>color}\n rescue ActionView::MissingTemplate\n\n render :partial=>\"catalog/_#{action_name}_partials/manifestation.html.erb\", :locals=>{:mandoc=>doc, :color=>color}\n end\n end"
] |
[
"0.706628",
"0.6885645",
"0.67656595",
"0.67634654",
"0.6710283",
"0.6710283",
"0.6710283",
"0.6710283",
"0.66359925",
"0.66131175",
"0.6587355",
"0.6571997",
"0.65533507",
"0.6532503",
"0.63788545",
"0.6357265",
"0.6286693",
"0.6264173",
"0.62509847",
"0.62193024",
"0.6215588",
"0.6196099",
"0.61846286",
"0.61553055",
"0.615292",
"0.6129634",
"0.61235046",
"0.6106022",
"0.61057115",
"0.60917854",
"0.6052095",
"0.6047992",
"0.6039106",
"0.60316604",
"0.60316604",
"0.6030383",
"0.6022113",
"0.6017398",
"0.6016818",
"0.5993301",
"0.5984647",
"0.59729433",
"0.5963706",
"0.59629583",
"0.59603935",
"0.5948706",
"0.59375113",
"0.5936043",
"0.5922489",
"0.5911116",
"0.58988494",
"0.58947486",
"0.5878988",
"0.5877887",
"0.58738744",
"0.5870448",
"0.5865284",
"0.58600163",
"0.5857543",
"0.5855374",
"0.5852478",
"0.5851389",
"0.5851389",
"0.5840007",
"0.5837124",
"0.58365995",
"0.58356994",
"0.5822684",
"0.5817318",
"0.5795184",
"0.5795184",
"0.57922214",
"0.57869756",
"0.5770974",
"0.5768633",
"0.5765139",
"0.5760936",
"0.5756388",
"0.5750216",
"0.57478416",
"0.5745296",
"0.57297873",
"0.57296324",
"0.57243073",
"0.5723081",
"0.5717613",
"0.5717196",
"0.5709493",
"0.5701536",
"0.56980705",
"0.56875074",
"0.56872207",
"0.56767035",
"0.56745505",
"0.56699985",
"0.56697106",
"0.56696635",
"0.5669494",
"0.56630474",
"0.5662901"
] |
0.7323358
|
0
|
result of calling these depends on context in which they are used, it depends on request that is made
|
def get_article()
@engine.content_loader.articles[@request.name]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _prepare_context; end",
"def call(request); end",
"def apply_request(request_env); end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def process(request); end",
"def set_request; end",
"def request_context\n @requester ? @requester.request : \"(unknown)\"\n end",
"def conditional_requests; end",
"def conditional_requests; end",
"def lookup_context; end",
"def lookup_context; end",
"def lookup_context; end",
"def perform(request, response); end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def request_result\n \n end",
"def conditional_requests=(_arg0); end",
"def in_context(context); end",
"def request_dependencies\n end",
"def request; return @request end",
"def perform(request, options); end",
"def context(status, header, body, request)\n @context = context_retriever(request)&.call(status, header, body)\n @data[:request_context] = @context[:context_id] \\\n if @context && @context[:context_id]\n @context\n end",
"def execute request_context\n raise \"You gotta implement this method and return a hash like => {:status => <integer>, :body => <string>, :headers => <hash>}\"\n end",
"def before_dispatch(env); end",
"def handle_results(env, request = nil)\n # override me!\n end",
"def consider_all_requests_local; end",
"def consider_all_requests_local; end",
"def request=(_arg0); end",
"def request=(_arg0); end",
"def request=(_arg0); end",
"def request_context(request)\n @request_context ||= Request.retriever_for_request(request)&.call\n end",
"def lookup_context=(_arg0); end",
"def request_data; end",
"def request(*args, &block); end",
"def on_global_request(type, &block); end",
"def consider_all_requests_local=(_arg0); end",
"def consider_all_requests_local=(_arg0); end",
"def request(*args); end",
"def call(env)\n returned = nil\n if Global.benchmarking\n require 'benchmark'\n time = Benchmark.measure{ returned = respond(env) }\n Log.debug('request took %.5fs [~%.0f r/s]' % [time.real, 1.0/time.real])\n else\n returned = respond env\n end\n returned\n end",
"def receive(request); end",
"def request\n @_context[:request]\n end",
"def handle( request ) # note: all 'handle's return 'ml_response' in a chain\n\n# not yet request.record_arrival_time\n ml_response =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n# not yet request.record_completion_time\n ml_response\n end",
"def on_pre_request( request ); end",
"def get_context(*params); raise('Stub or mock required.') end",
"def req\n \n end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context=(_arg0); end",
"def context_methods; end",
"def pending_response_requests; 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 generate_request\r\n end",
"def after_request\n end",
"def context\n unless @instance_context\n @instance_context = CallContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def service_request(service); end",
"def before_dispatch(_env)\n end",
"def use_default_context(req, action)\n req.options.context ||= {}\n req.options.context.merge!(client: self.class,\n action: action,\n request_id: SecureRandom.hex(3))\n end",
"def handle_request request, usecase=Usecase, &block\n usecase = build_usecase( request, usecase, &block )\n usecase.response\n end",
"def send_request; end",
"def call(request)\r\n self\r\n end",
"def on_pre_request( request )\n end",
"def context\n unless @instance_context\n @instance_context = CallContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def get_request(request)\n\n wrapped_response = do_request(request)\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: initial request: \"+request.to_s\n\n ## If required try to renew the token and redo the request.\n if wrapped_response.meta_status == WAPIStatus::UNKNOWN_ERROR &&\n wrapped_response.result.respond_to?('http_code') &&\n wrapped_response.result.http_code == WAPIStatus::HTTP_UNAUTHORIZED\n wrapped_response = renew_token()\n ## if the token renewed ok then try the request again.\n if wrapped_response.meta_status == WAPIStatus::SUCCESS\n wrapped_response = do_request(request)\n end\n end\n\n # If it didn't work just return that information.\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: wrapped_response: meta_status: #{wrapped_response.meta_status}\"\n if wrapped_response.meta_status != WAPIStatus::SUCCESS\n return wrapped_response\n end\n\n ## Ran a query successfully. See if got partial data and need to keep going.\n\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: wrapped_response: data length: #{wrapped_response.result.length}\"\n # See if there is a link header, if so get the rest of the data.\n if wrapped_response.meta_more.length > 0\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: found link header: >>#{wrapped_response.meta_more}<<\"\n\n more_data = get_request(wrapped_response.meta_more)\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: more_data status: #{more_data.meta}\"\n\n if more_data.meta_status == WAPIStatus::SUCCESS\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: will merge data: initial wrapped_response: #{wrapped_response.result.length} more_data: #{more_data.result.length}\"\n wrapped_response = wrapped_response.append_json_results(more_data)\n else\n logger.error \"#{self.class.to_s}:#{__method__}:#{__LINE__}: can not merge more_data: #{more_data.inspect}\"\n end\n end\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: final wrapped_response: result length: #{wrapped_response.result.length}\"\n wrapped_response\n end",
"def request_dependencies \n attrib_needed! :content, true if recipe_page_needed?\n from_gleaning = Gleaning.tracked_attributes & needed_attributes\n if from_gleaning.present?\n build_gleaning if !gleaning\n gleaning.request_attributes *from_gleaning\n end\n from_mercury = MercuryResult.tracked_attributes & needed_attributes\n if from_mercury.present?\n # Translate from our needed attributes to those provided by mercury_result\n build_mercury_result if !mercury_result\n mercury_result.request_attributes *from_mercury\n end\n end"
] |
[
"0.66573787",
"0.6616938",
"0.6570738",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6513047",
"0.6468401",
"0.6443072",
"0.64282733",
"0.63554573",
"0.63554573",
"0.6352966",
"0.6352966",
"0.6352966",
"0.6349726",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.62841547",
"0.6240487",
"0.6210126",
"0.6151101",
"0.6089001",
"0.6088969",
"0.6055711",
"0.6043261",
"0.60369",
"0.5977579",
"0.5885351",
"0.58695245",
"0.58695245",
"0.5864314",
"0.5864314",
"0.5864314",
"0.58499676",
"0.58359534",
"0.5822925",
"0.5818522",
"0.58008474",
"0.57513297",
"0.57513297",
"0.573386",
"0.57250893",
"0.5702124",
"0.56847703",
"0.56764066",
"0.5670703",
"0.56676495",
"0.56236845",
"0.5607785",
"0.5607785",
"0.5607785",
"0.5607785",
"0.5607785",
"0.5607785",
"0.5607785",
"0.5607785",
"0.5607785",
"0.5607785",
"0.5594468",
"0.55838084",
"0.5574872",
"0.55624723",
"0.5549782",
"0.55479836",
"0.5540592",
"0.55343956",
"0.5532601",
"0.5530794",
"0.55294293",
"0.5507657",
"0.5502541",
"0.5501555",
"0.54602545",
"0.54582727"
] |
0.0
|
-1
|
Sneakers workergroup supports callable objects.
|
def call
case activejob_workers_strategy
when :only then activejob_workers
when :exclude then sneakers_workers
when :include then sneakers_workers + activejob_workers
else
raise "Unknown activejob_workers_strategy '#{activejob_workers_strategy}'"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def worker_pool; end",
"def worker_pool; end",
"def runnable_methods; end",
"def runnable_methods; end",
"def runnables; end",
"def worker_factory(&block)\n end",
"def work_pool; end",
"def call(object); end",
"def supports_parallel=(_arg0); end",
"def workers(count); end",
"def be_callable!(thing)\n return if thing.respond_to?(:call)\n return if thing.is_a?(Class) && thing.instance_methods.include?(:call)\n raise TypeError, \"Expecting callable but received `#{thing.class.name}`\"\n end",
"def pool; end",
"def pool; end",
"def jeweler_tasks; end",
"def call(*) end",
"def call(*) end",
"def jeweler_tasks=(_arg0); end",
"def broadcasting; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def workers!\n LambdaMail::Mailing::SendSpecialEmailMessageWorker.drain\nend",
"def invoke; end",
"def redis_pool=(_arg0); end",
"def runner(&blk); end",
"def runner(&blk); end",
"def on_worker_fork(&block); end",
"def send_as_functions *args\n args.each {|arg| send_as_function arg}\n self\n end",
"def worker(*queues)\n end",
"def allowing_other_threads; end",
"def worker_pool_stream_handler(broadcasting, user_handler, coder: T.unsafe(nil)); end",
"def snat_pool\n super\n end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def __apply__(rule) = public_send(rule)",
"def publisher; end",
"def publisher; end",
"def group\n @object.send(:try, Innsights.group_call) if Innsights.group_call.present?\n end",
"def call(*args); end",
"def register_group(object, group = T.unsafe(nil)); end",
"def fork_worker(after_requests = T.unsafe(nil)); end",
"def in_parallel(manager = T.unsafe(nil)); end",
"def call(worker_class_name)\n ss = Sidekiq::ScheduledSet.new\n rs = Sidekiq::RetrySet.new\n qs = Sidekiq::Queue.new(\"default\")\n\n [ss, rs, qs].any? { |s| s.any? { |j| (j.klass == worker_class_name) } }\n end",
"def run(&blk)\n raise NotImplementedError\n end",
"def call() end",
"def add_work(&bl)\n pool.post &bl\n end",
"def be_worker\n before_work\n super\n end",
"def redis_pool; end",
"def producer; end",
"def allowFleeing _obj, _args\n \"_obj allowFleeing _args;\" \n end",
"def linkable\n\t\tself.work\n\tend",
"def run(&block); end",
"def BlocksAndMethods(&argumento)\n\targumento.call\nend",
"def invokables\n []\n end",
"def callable?(obj)\n # Both of these objects response do call\n return true if obj.respond_to? :call\n end",
"def broadcast_example_b1\n end",
"def run(workers=processor_count)\n queue_push(Parallel::Stop)\n Parallel.map(self,:in_threads => workers) {|task|\n if task.size > 1\n if task[0].kind_of? Proc\n # Expects proc/lambda with arguments,e.g.\n # [mysqrt,2.789]\n # [myproc,x,y,z]\n task[0].call(*task[1..-1])\n else\n # expect an object in task[0] and one of its methods with arguments\n # in task[1] as a symbol\n # e.g. [a,[:attribute=,1] or\n # Math,:exp,0\n task[0].send(task[1],*task[2..-1])\n end\n else\n task[0].call\n end\n }\n end",
"def worker_culling_strategy(strategy); end",
"def nakayoshi_fork(enabled = T.unsafe(nil)); end",
"def wrappers(*args, &block); end",
"def assignAsGunner _obj, _args\n \"_obj assignAsGunner _args;\" \n end",
"def before_starting_workers\n end",
"def run(&block)\n end",
"def run(_); end",
"def run(_); end",
"def refork; end",
"def send_all_or_no_args(callable, *args, &block)\n callable.call(*[nil, args][clamp(callable.arity, min: 0, max: 1)], &block)\n end",
"def lock_workers(*args)\n \"#{name}-#{args.to_s}\"\n end",
"def calls; end",
"def calls; end",
"def worker_pool(count, *queues_and_options)\n end",
"def blocks_to_hit\n super + (task.variable ? task.variable.checkers : [])\n end",
"def perform(*args); end",
"def sendTask _obj, _args\n \"_obj sendTask _args;\" \n end",
"def create_share_of_node_method_and_execute(caller, node_key)\n create_share_of_node_method(node_key)\n caller.send(\"share_of_#{node_key}\")\n end",
"def sleepy_run; end",
"def Pipeable(*args)\n Pipeable.for(*args, caller: self)\n end",
"def use(*args, &block); end",
"def lock_workers(*args)\n \"workerslock:#{name}-#{args.to_s}\"\n end",
"def method_missing(method, *args, &block)\n if method.to_s =~ /^asynch?_(.*)/\n if instance_methods(false).detect{|meth| meth.to_s == $1 }\n Woodhouse.dispatch(@worker_name, $1, args.first)\n else\n super\n end\n else\n super\n end\n end",
"def allow_registration(method); end",
"def callable?(callable, args)\n callable.is_a?(PAnyType) && callable.callable?(args)\n end",
"def add(task_name, *args, &block)\n raise \"Block required\" unless block_given?\n WorkerMethods.define_singleton_method task_name, block\n end",
"def call_squadron; end",
"def use ware, *args, &proc\n return if locked?\n use? << {:ware => ware, :args => args, :proc => proc}\n end",
"def group\n raise(NotImplementedError)\n end",
"def call\n end",
"def available_workers?\n true\n end",
"def justRun(workers=processor_count)\n @threads = (1..workers).map {|i|\n Thread.new(self) {|q|\n until ( q == ( task = q.deq ) )\n if task.size > 1\n if task[0].kind_of? Proc\n # Expects proc/lambda with arguments, e.g. [mysqrt,2.789]\n task[0].call(*task[1..-1])\n else\n # expect an object in task[0] and one of its methods with\n # arguments in task[1] as a symbol\n # e.g. [a,[:attribute=,1]\n task[0].send(task[1],*task[2..-1])\n end\n else\n task[0].call\n end\n end\n }\n }\n @threads.size.times { self.enq self}\n @threads.each {|t| t.join}\n end",
"def call_a_proc(&my_proc)\n my_proc.call\nend",
"def block_friend\n end",
"def foo(&b)\r\n b.call\r\nend",
"def in_sklass\n @sclass.push true\n\n with_new_method_stack do\n yield\n end\n ensure\n @sclass.pop\n end",
"def runner; end"
] |
[
"0.5717419",
"0.5717419",
"0.55718195",
"0.55718195",
"0.55365074",
"0.54011554",
"0.537022",
"0.53240883",
"0.5183029",
"0.5145301",
"0.51399696",
"0.51261675",
"0.51261675",
"0.5114676",
"0.5103349",
"0.5103349",
"0.5102286",
"0.5086393",
"0.50788176",
"0.50788176",
"0.50788176",
"0.5068934",
"0.5060536",
"0.504032",
"0.5038708",
"0.5038708",
"0.50371474",
"0.5007095",
"0.49968272",
"0.4994942",
"0.49839285",
"0.49821797",
"0.49653",
"0.49653",
"0.49653",
"0.49653",
"0.49653",
"0.49653",
"0.49653",
"0.49653",
"0.4956338",
"0.49552318",
"0.49552318",
"0.49511224",
"0.49493825",
"0.49415007",
"0.49398237",
"0.4934313",
"0.4926307",
"0.49099466",
"0.49076444",
"0.4905901",
"0.49056414",
"0.4904921",
"0.49007696",
"0.48851463",
"0.48831317",
"0.48704726",
"0.48694575",
"0.48663133",
"0.48561612",
"0.48546666",
"0.4853114",
"0.484803",
"0.48478633",
"0.48454934",
"0.4841846",
"0.48415303",
"0.482863",
"0.4825438",
"0.4825438",
"0.48200142",
"0.48123935",
"0.47943684",
"0.47924772",
"0.47924772",
"0.47869",
"0.478269",
"0.47684023",
"0.47607213",
"0.47566235",
"0.47538975",
"0.47498268",
"0.47334486",
"0.47301617",
"0.47270367",
"0.47244453",
"0.47157544",
"0.46950236",
"0.4693337",
"0.4690644",
"0.4689863",
"0.46843946",
"0.4679259",
"0.46772486",
"0.46771634",
"0.46750832",
"0.4674595",
"0.46690106",
"0.4661756"
] |
0.5384648
|
6
|
FUNCTION TO CREATE NEW SHEET
|
def create_new_sheet(title,description, keys, level)
acai = Keyword.find_by_name("ACAI") #default skill keywords required
sheet = Sheet.new
sheet.title = title.split(":").last.humanize
sheet.id_dokuwiki = title
if(level.to_s.match(/[0-3]/))
sheet.level = level
else
sheet.level = 1 #default level
end
sheet.keywords << keys
sheet.description = description
if !sheet.valid?
sheet.keywords << acai
end
sheet.save
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_workspace_and_options_tabs()\n new_notebook = Wx::Notebook.new(self)\n\n @ws_tab = Wx::Panel.new(new_notebook) # Add workspace tab\n @ws_mvsizer = Wx::BoxSizer.new(Wx::VERTICAL)\n @ws_tab.set_sizer(@ws_mvsizer)\n\n @options_tab = Wx::Panel.new(new_notebook) # Add options tab\n @options_mvsizer = Wx::BoxSizer.new(Wx::VERTICAL)\n @options_tab.set_sizer(@options_mvsizer)\n\n\n new_notebook.add_page(@ws_tab , \"Workspace\")\n new_notebook.add_page(@options_tab , \"Options\")\n evt_notebook_page_changing(new_notebook.get_id()) {|event| on_changing_page(event) }\n end",
"def create_tabs\n end",
"def createWindow\r\n \r\n end",
"def content\n @bgs, @gbs = [], []\n img = image(\"#{HH::STATIC}/hhhello.png\")\n img.move 305, 42\n @bgs << img\n @bgs << rect(38, 0, width-38, 35, fill: \"#CDC\")\n @bgs << rect(38, 0, width-38, 38, fill: black.push(0.05)..black.push(0.2))\n @tabs, @tables = [], HH::DB.tables\n @scripts = HH.scripts\n\n hometab \"Programs\", true, 50, 13 do\n @slot.append do\n @homepane.clear{home_scripts}\n flush\n end\n end\n hometab \"Samples\", false, 168, 13 do\n @slot.append do\n @homepane.clear{sample_scripts}\n flush\n end\n end\n @bgs << rect(38, 38, 300, 4, fill: rgb(233, 239, 224))\n\n @slot.append do\n stack(height: 40){}\n @homepane = flow(margin_top: 10){home_scripts}\n flush\n end\n\n=begin\n stack :margin_left => 12 do\n background rgb(233, 239, 224, 0.85)..rgb(233, 239, 224, 0.0)\n image 10, 70\n end\n @bulletin_stack = stack do\n end\n=end\n end",
"def new_tab(name, klass = RoomPane)\n # Don't do anything if we already have this tab\n @channels.each { |cname,_| return nil if cname == name }\n\n # Add the visual indication of this tab\n @tab_names << FXTabItem.new(@tabs, name, nil)\n empty = FXPacker.new(@tabs)\n empty.padBottom = empty.padTop = empty.padLeft = empty.padRight = 0\n @empties << empty\n\n # Create the content of this channel - probably a RoomPane\n new_channel = klass.new(@switcher, @skin)\n @channels << [ name, new_channel ]\n new_channel.create\n new_channel.on_line(&@on_line_block) # register our callback function\n\n # Show the tabs (if so desired) now that we know we have more than one.\n (@tabs.create ; @tabs.show) if @skin[:show_tabs]\n end",
"def create\r\n super # Create the windows\r\n show(PLACEMENT_SCREEN) # Make the main window appear\r\n end",
"def init\n @title_page = 'Pine app'\n erb :welcome, layout: :template\nend",
"def layout; end",
"def create_help_window\n @help_window = Window_Help.new(1)\n @help_window.viewport = @viewport\n end",
"def create_definition(style); end",
"def create_help_window\n @help_window = Window_Help.new\n end",
"def create_help_window\n @help_window = Window_Help.new\n end",
"def new_window(type); end",
"def dashboard_h\n render :layout => 'application-h'\n end",
"def theme; end",
"def theme; end",
"def theme; end",
"def new\n ruhoh = @ruhoh\n name = @args[2]\n Ruhoh::Friend.say { \n red \"Please specify a layout name.\" \n cyan \"ex: ruhoh layouts new splash\"\n exit\n } if name.nil?\n\n filename = File.join((@ruhoh.cascade.theme || @ruhoh.cascade.base), \"layouts\", name.gsub(/\\s/, '-').downcase) + \".html\"\n\n if File.exist?(filename)\n abort(\"Create new layout: aborted!\") if ask(\"#{filename} already exists. Do you want to overwrite?\", ['y', 'n']) == 'n'\n end\n\n FileUtils.mkdir_p File.dirname(filename)\n\n File.open(filename, 'w:UTF-8') do |page|\n page.puts (@collection.scaffold || '')\n end\n\n Ruhoh::Friend.say {\n green \"New layout:\"\n plain ruhoh.relative_path(filename)\n }\n end",
"def create_title_window\n @title_window = Window_TitleList.new(TITLE_WINDOW_X, TITLE_WINDOW_Y)\n @title_window.actor = @actor\n @title_window.set_handler(:ok, method(:on_title_ok))\n @title_window.set_handler(:cancel, method(:on_title_cancel))\n @title_window.set_handler(:start, method(:toggle_help))\n @title_window.help_window = @help_window\n @title_window.hide\n end",
"def create_guide(title, description)\n result = \"\"\n result << \"<div class='explanation-unit'>\"\n result << \"<h1>#{title}</h1>\"\n result << \"<p>#{description}</p>\"\n result << \"</div>\"\n end",
"def create_guide(title, description)\n result = \"\"\n result << \"<div class='explanation-unit'>\"\n result << \"<h1>#{title}</h1>\"\n result << \"<p>#{description}</p>\"\n result << \"</div>\"\n end",
"def create_guide(title, description)\n result = \"\"\n result << \"<div class='explanation-unit'>\"\n result << \"<h1>#{title}</h1>\"\n result << \"<p>#{description}</p>\"\n result << \"</div>\"\n end",
"def createWidgets\n @topTab = KDE::TabWidget.new\n\n @mainTabPageHSplitter = Qt::Splitter.new\n @topTab.addTab(@mainTabPageHSplitter, 'Channels')\n\n @mainTabPageHSplitter.addWidget(createChannelAreaWidget)\n\n # Main Tab page. programme table area\n @progTableFrame = Qt::Splitter.new(Qt::Vertical)\n @progTableFrame.addWidget(createProgrammeAreaWidget)\n @progTableFrame.addWidget(createProgrammeSummaryWidget)\n @mainTabPageHSplitter.addWidget(@progTableFrame)\n\n # parameter : Qt::Splitter.setStretchFactor( int index, int stretch )\n @mainTabPageHSplitter.setStretchFactor( 0, 0 )\n @mainTabPageHSplitter.setStretchFactor( 1, 1 )\n\n # dock\n createPlayerDock\n\n\n # Top Tab - Task Page\n @taskWin = TaskWindow.new\n @topTab.addTab(@taskWin, 'Task')\n\n # Top Tab - Schedule Page\n @scheduleWin = ScheduleWindow.new\n @topTab.addTab(@scheduleWin, 'Schedule')\n\n # Top Tab - Log Page\n @logWin = LogWindow.new\n @topTab.addTab(@logWin, 'Log')\n\n\n # set Top Widget & Layout\n setCentralWidget(@topTab)\n end",
"def layouts; end",
"def layouts; end",
"def create_help_window\n @help_window = Window_ItemHelp.new(HELP_WINDOW_X, HELP_WINDOW_Y)\n end",
"def create_help_window\n @help_window = Window_ItemHelp.new(HELP_WINDOW_X, HELP_WINDOW_Y)\n end",
"def scaffold_setup_helper\n engine :Erubis\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::RamazeController\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::PrototypeHelper\n unless trait[:layout] && trait[:layout][:all]\n layout(:scaffold_layout) \n define_method(:scaffold_layout){::Ramaze::Action.current.template = scaffold_path(:layout)}\n end\n end",
"def create_help_window\n @help_window = Window_TitleHelp.new(HELP_WINDOW_X, HELP_WINDOW_Y)\n @help_window.hide\n end",
"def create_tab(name, bookmark=nil, &block)\n @tabs[name] = Tab.new(self, name, bookmark, &block)\n create_tab_convenience_method(name)\n end",
"def new_gs\n render :new, layout: 'popup'\n end",
"def create_help_window\n @help_window = Window_CapacityHelp.new(HELP_WINDOW_X, HELP_WINDOW_Y)\n end",
"def create_guest_tab(supplied_guest)\n @bar_tabs[supplied_guest] = 0\n end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def template; end",
"def create_help_window\n super\n @help_window.viewport = @viewport1\n end",
"def create_graphics\n create_viewport\n create_background\n create_buttons\n init_entering\n end",
"def template_guide\n @title = \"Template Guide\"\n end",
"def set_template\n end",
"def build_layout\n year = Time.now.year\n add_call('Notification des abonnements électroniques', ->() { notifier })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year - 1}\", ->() { freesubs(year - 1) })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year}\", ->() { freesubs(year) })\n add_call('Création d\\'un abonnement collectif', ->() { collective_manager })\n add_call('Exploitation des abonnements collectifs', ->() { collective_exploitation })\n add_call('Recherche des tiers par facture', ->() { billing_manager })\n add_call('(Pour développeur) Fichiers de requête', ->() { sql_files })\n @layout.add_stretch\n end",
"def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @title_window = Window_Outline_Title.new(0, 0, 640, 56)\n @content_window = Window_Outline.new(0, 56, 640, 424)\n \n # Create Window \n @list_window = Window_Outline_List.new(0, 0, 400, 400, Vocab::tutorials_strings)\n width_remain = (640 - @list_window.width)/2\n @list_window.x = width_remain.floor\n height_remain = (480 - @list_window.height)/2\n @list_window.y = height_remain.floor\n end",
"def create_header_window\n @header_window = Window_MenuHeader.new(Vocab::LOAD)\n end",
"def create(name, position=[0,0], active=true)\n return @windows[name.to_sym] if @windows[name.to_sym]\n window = GUI::Window.new(name)\n window.move(position[0],position[1])\n @windows[name.to_sym] = window\n end",
"def start_quiz\n @title_page = 'Quiz'\n erb :start, layout: :template\nend",
"def add_worksheet(name = nil)\n if name.nil? then\n n = 0\n\n begin\n name = SHEET_NAME_TEMPLATE % (n += 1)\n end until self[name].nil?\n end\n\n new_worksheet = Worksheet.new(:workbook => self, :sheet_name => name)\n worksheets << new_worksheet\n new_worksheet\n end",
"def add_worksheet(name = nil)\n if name.nil? then\n n = 0\n\n begin\n name = SHEET_NAME_TEMPLATE % (n += 1)\n end until self[name].nil?\n end\n\n new_worksheet = Worksheet.new(:workbook => self, :sheet_name => name)\n worksheets << new_worksheet\n new_worksheet\n end",
"def add_worksheet(name = nil)\n if name.nil? then\n n = 0\n\n begin\n name = SHEET_NAME_TEMPLATE % (n += 1)\n end until self[name].nil?\n end\n\n new_worksheet = Worksheet.new(:workbook => self, :sheet_name => name)\n worksheets << new_worksheet\n new_worksheet\n end",
"def add_template_pages; end",
"def new\n @template = CustomTemplate.new\n\n \trender :layout => \"templates\"\t\n end",
"def set_windows\n set_title \"R-Bloggyn::#{@usuario.alias}\" #nombre de la ventana\n set_default_size 640, 480 #tamaño de la ventana\n set_skip_taskbar_hint true\n set_window_position Gtk::Window::POS_CENTER #posicion de la ventana\n self.set_attributes\n add @hbox\n show_all #muestra todo\n end",
"def new_function\n \"#{object.title} customed\"\n end",
"def buildPyramid (command_nb)\n height = askheight\n style = askStyle\n $styles[style].(height) #voila mon tour de magie avec le hash\n puts \"et voila la #{command_nb}e commande!\"\nend",
"def create_bestiary_window\n y = @enemy_list_window.height\n w = @enemy_list_window.width\n @bestiary_window = Window_BestiaryInfo.new(0, y, w)\n @bestiary_window.viewport = @viewport\n end",
"def get_cheatsheet()\n erb :cheatsheet\n end",
"def create_toolbars\n # TODO\n end",
"def create_name_window\n @name_window = Window_StorageName.new\n @name_window.viewport = @viewport\n @name_window.x = @command_window.width\n @name_window.y = @help_window.height\n if @storage_name_window == true\n @name_window.show\n end\n end",
"def create_graphics\n create_viewport\n create_base\n create_ui\n end",
"def create_legend_window\n @legend_window = Window_Legend.new\n @legend_window.x = Graphics.width - @legend_window.width\n end",
"def header_and_footer\n @title = _'Labvirt'\n @footer = _'Something nice should go down here...'\n end",
"def template_setup\n content_for :content_title, \"Dashboard\".html_safe\n end",
"def layouts=(_arg0); end",
"def layouts=(_arg0); end",
"def template_page(site); end",
"def layout\n html do\n head do\n title 'TrackTime'\n end\n body do\n h1 \"welcome to tracktime\"\n div.content do\n self << yield\n end\n end\n end\n end",
"def create_mix_window\n @mix_window = Window_MixItem.new(@help_window, @info_viewport)\n @mix_window.set_handler(:ok, method(:on_mixitem_ok))\n @mix_window.set_handler(:confirm, method(:on_mixitem_confirm))\n @mix_window.set_handler(:cancel, method(:on_mixitem_cancel))\n resize_mix_window_yea_abe\n end",
"def place_in_layout?; end",
"def place_in_layout?; end",
"def create_backgrounds\n create_over\n create_hud_bg\n create_under\n create_flow\n end",
"def document_window(name)\n Window.new {\n title \"Document: \" + name\n\t\t\n text = TextArea.new {\n ...\n }\n }\nend",
"def h\n @template\n end",
"def templates; end",
"def create\n\t\tsuper\n\t\tshow(PLACEMENT_SCREEN)\n\tend",
"def home\n @title = \"Home Base\"\n end",
"def create_command_window\n end",
"def create_contents\n @shell.layout = GridLayout.new(6, true)\n\n Label.new(@shell, SWT::NONE).text = \"Your name:\"\n\n @name_box = Text.new(@shell, SWT::BORDER)\n layout_data = GridData.new(GridData::FILL_HORIZONTAL)\n layout_data.horizontalSpan = 4\n @name_box.layout_data = layout_data\n\n @status_label = Label.new(@shell, SWT::BORDER)\n layout_data = GridData.new(GridData::FILL_HORIZONTAL)\n layout_data.horizontalSpan = 3\n @status_label.layout_data = layout_data \n\n\n\t\t@button = Button.new(@shell, SWT::PUSH)\n\t\t@button.text = \"Click me!\"\n\t\tlayout_data = GridData.new(GridData::END, GridData::CENTER, false, false)\n\t\tlayout_data.horizontalSpan = 6\n\t\t@button.layout_data = layout_data\n @button.addSelectionListener do\n handle_click\n end\n end",
"def new\n @shelter = Shelter.new\n\n @shelter\n end",
"def create_display_template_file(directory)\n html = %{<!-- Template File -->\\n\n<div class=\"myWidget\">Hello World</div>}\n\n File.open(directory, \"w\") do |f|\n f.write(html)\n end\n end",
"def create\n super\n show PLACEMENT_SCREEN\n end",
"def h\n @template\n end",
"def main_window ; end",
"def index\n super\n use_widgets do |root|\n root << jqg_top_widget('program')\n end\n render\n end",
"def create_description_windows\n width = Graphics.width / 2\n @left_window = Window_PartyTitle.new(0, 0, width)\n @right_window = Window_PartyTitle.new(width, 0, width)\n @left_window.set_text(Vocab.active_members)\n @right_window.set_text(Vocab.standby_members)\n end",
"def create_new_wrap\n\t\t# This method is in CommonElements\n\t\twait_loading\n\t\tself.create_new_wrap_button\n\tend",
"def add_titles(heading_1, heading_2)\n @main_window.attron(Curses::color_pair(@pairs[\"Title\"]))\n\n @main_window.setpos(2, (Curses::cols.pred - heading_1.size - 2) / 2)\n @main_window << heading_1\n\n @main_window.setpos(3, (Curses::cols.pred - heading_2.size - 2) / 2)\n @main_window << heading_2\n\n @main_window.attroff(Curses::color_pair(@pairs[\"Title\"]))\n @main_window.refresh\n end",
"def new(*action_names)\n Module.new do\n extend ActiveSupport::Concern\n include Common\n\n included do\n before_action(:load_interface, :load_dashboard_items, only: action_names)\n layout('etm', only: action_names)\n end\n end\n end",
"def new\n @layout_template = LayoutTemplate.new\n \n render :update do |page|\n page.insert_html :top, \"dialog_here\", :partial => \"layout_templates/new\",\n :locals => { :layout_template => @layout_template }\n end\n end",
"def create_defaults\n import_layout(self.layout_dir(:absolute => true))\n import_content(self.content_dir(:absolute => true))\n end",
"def create_help_window\n super\n @help_window.y = @blacksmith_window.height\n end",
"def stylesheet; end",
"def create_graphics\n create_viewport\n create_base_ui\n create_sub_background\n create_trainer_sprite\n create_badge_sprites\n create_texts\n end",
"def create_new_sheet(date, new_spreadsheet_id)\n #make copy of template sheet to new spreadsheet\n new_sheet_id = copy_sheet(new_spreadsheet_id)\n \n #set the name of that sheet\n set_name_of_sheet(date.day.to_s, new_sheet_id, new_spreadsheet_id)\n \n #set the date on the sheet\n set_date_of_sheet(date, new_spreadsheet_id)\nend",
"def make_screen\n @screen = Screen.new(Configuration.screen[:size], 32, [HWSURFACE, DOUBLEBUF])\n\n @screen.title = \"Towerdefence!\"\n end",
"def create(name, *traits_and_overrides, &block); end",
"def main_window\r\n super\r\n # Make help window, status window, and skill window\r\n @help_window = Window_Help.new\r\n @status_window = Window_SkillStatus.new(@actor)\r\n @skill_window = Window_Skill.new(@actor)\r\n # Associate help window\r\n @skill_window.help_window = @help_window\r\n # Make target window (set to invisible / inactive)\r\n @target_window = Window_Target.new\r\n @target_window.visible = false\r\n @target_window.active = false\r\n end",
"def register_layout_setup\n @tab = :register\n end",
"def main_window\r\n super\r\n # Make help window, item window\r\n @help_window = Window_Help.new\r\n @item_window = Window_Item.new\r\n # Associate help window\r\n @item_window.help_window = @help_window\r\n # Make target window (set to invisible / inactive)\r\n @target_window = Window_Target.new\r\n @target_window.visible = false\r\n @target_window.active = false\r\n end"
] |
[
"0.6324326",
"0.62604487",
"0.6200395",
"0.60549337",
"0.5996959",
"0.5940327",
"0.5912834",
"0.58212954",
"0.57971656",
"0.5793669",
"0.5787875",
"0.5787875",
"0.5771627",
"0.5731664",
"0.56987804",
"0.56987804",
"0.56987804",
"0.56957215",
"0.56812",
"0.5626818",
"0.5626818",
"0.5626818",
"0.56244016",
"0.5550258",
"0.5550258",
"0.5529066",
"0.5529066",
"0.5528242",
"0.55036414",
"0.54900885",
"0.5489166",
"0.54865205",
"0.5483762",
"0.548092",
"0.548092",
"0.548092",
"0.548092",
"0.548092",
"0.548092",
"0.548092",
"0.5471361",
"0.5464528",
"0.54557616",
"0.5450736",
"0.54149806",
"0.54070586",
"0.54044014",
"0.5399965",
"0.5398485",
"0.53981036",
"0.53981036",
"0.53981036",
"0.5391439",
"0.53866184",
"0.5385943",
"0.5372965",
"0.53629726",
"0.5359977",
"0.5354831",
"0.53511393",
"0.5340396",
"0.53314096",
"0.5325433",
"0.53165936",
"0.5313118",
"0.5312945",
"0.5312945",
"0.5311247",
"0.5308188",
"0.53032756",
"0.5296224",
"0.5296224",
"0.5285932",
"0.5284892",
"0.5284405",
"0.5278287",
"0.52750176",
"0.52603",
"0.5256262",
"0.525338",
"0.5239193",
"0.52296835",
"0.52294934",
"0.5225214",
"0.5211449",
"0.52089703",
"0.5207682",
"0.52067435",
"0.5199205",
"0.51983523",
"0.51891327",
"0.5187774",
"0.51848567",
"0.5179501",
"0.51777583",
"0.51705223",
"0.51445955",
"0.5139179",
"0.51365227",
"0.513534",
"0.51350015"
] |
0.0
|
-1
|
KEYWORDS return a hash table associating : /regexp/ => [an array of keywords objects]
|
def return_hash
kt = KeywordTagger.new
hash = kt.get_hash_regex_tags("public/conversion.txt")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def keywords\n self.to_s.downcase.split(SPLIT_REGEXP).uniq\n end",
"def keywords\n response = request :keywords\n keywords = Hash.new\n response[\"labels\"].each do |label|\n keywords[label[\"keyword\"]] = label[\"content\"]\n end\n keywords\n end",
"def keywords\n @emphasis[:stemming] = use_stemming?\n\n keywords = Keywords.new\n\n Keywords.find_keywords(processed_content, wordlist, word_pattern).each do |text|\n text = text.to_s\n text = text.stem if @emphasis[:stemming]\n\n if not (text.match(/^[\\d]+(\\.[\\d]+){0,1}$/) or text.length <= 2)\n keywords << Highscore::Keyword.new(text, weight(text))\n elsif allow_short_words\n keywords << Highscore::Keyword.new(text, weight(text))\n end\n end\n\n keywords\n end",
"def keywords\n get_keywords.flatten.uniq\n end",
"def keywords\n @keywords_accessed = true\n @keywords\n end",
"def keywords\n @key_array = []\n @hash.each {|key,value| @key_array.push(key)} #push key inside key_array\n return @key_array.sort\n end",
"def keywords\n keywords = []\n metadata[dataset_uri][dcat.keyword.to_s].each do |k|\n keywords << k\n end\n rescue\n []\n end",
"def keywords\r\n @@words.keys.sort\r\nend",
"def extract_keywords\n self.keywords = Alice::Parser::NgramFactory.filtered_grams_from(self.text).flatten.uniq\n end",
"def keywords\n @entries.keys.sort # sorts keys to alphabetical \n end",
"def get_keywords\n titles.map do |title|\n title.split(\" \")\n end\n end",
"def keywords\n return nil unless @doc.keywords\n \n keywords = @doc.keywords[0..(NUM_KEYWORDS-1)].join(\", \")\n mark(keywords)\n end",
"def keywords\n [self.keyword]\n end",
"def keywords_for_index(_item)\n []\n end",
"def map_keywords(keywords)\n keywords.inject({}) do |out, keyvalue|\n key, value = keyvalue\n out.merge({ KEYWORDS[key.to_sym], value.to_s })\n end\nend",
"def scan_regex_pattern_expression expression\n words = {}\n expression.each_pair do |key, exp|\n words[key] = dictionary.scan(Regexp.new(exp)).map(&:join)\n end\n words\n end",
"def set_keywords\n self.search_fields.keys.each do |namespace| \n self._keywords[namespace] = self.search_fields[namespace].map do |field|\n if field.is_a?(Hash) \n field.keys.map do |key|\n attribute = self.send(key)\n method = field[key] \n attribute = [attribute] if !attribute.is_a?(Array) \n method = [method] if !method.is_a?(Array)\n method.map {|m| attribute.map { |a| Util.keywords a.send(m), stem_keywords[namespace], ignore_list[namespace] } }\n end\n else \n value = self[field]\n value = [value] if !value.is_a?(Array)\n value.map {|v| Util.keywords(v, stem_keywords[namespace], ignore_list[namespace]) if v}\n end\n end.flatten.map(&:to_s).select{|f| not f.empty? }.uniq.sort\n \n end\n end",
"def get_keywords( descriptions )\n keywords = []\n descriptions.each do |description|\n page_text = Nokogiri::HTML(description).text\n keywords.concat( page_text.split(/\\W+/) )\n end\n\n return keywords\nend",
"def keywords\n xml.css('keyword').map{|c| Allorails::Keyword.new(c)}\n end",
"def keywords\n plot_keywords.css(\"a[href^='/keyword/']\").map { |keyword| keyword.text.strip } rescue []\n end",
"def keywords\n\t\t\treturn @data['keywords']\n\t\tend",
"def get_keywords\r\n\t@keywords = Keyword.all\r\n\t@keywords.sort! { |a, b| a.name <=> b.name }\r\n end",
"def keywords\n read_attribute(:keywords).to_a.compact.map(&:downcase)\n end",
"def set_keywords\n self._keywords = self.search_fields.map do |field|\n if field.is_a?(Hash)\n field.keys.map do |key|\n attribute = self.send(key)\n method = field[key]\n if attribute.is_a?(Array)\n if method.is_a?(Array)\n method.map {|m| attribute.map { |a| KeywordsExtractor.extract a.send(m) } }\n else\n attribute.map(&method).map { |t| KeywordsExtractor.extract t }\n end\n else\n KeywordsExtractor.extract(attribute.send(method))\n end\n end\n else\n KeywordsExtractor.extract(self.send(field))\n end\n end.flatten.compact.sort\n end",
"def get_keywords(input_text, relevance)\n\tkeywords = Keyword.extract(input_text)\n\trelevant_words = keywords.select {|w| w[\"text\"] if w[\"relevance\"].to_f > relevance }\n\treturn relevant_words.map{|w| w[\"text\"]}\nend",
"def keywords(limit = 20)\n @keywords ||= {}\n @keywords[limit] ||= begin\n list = []\n count = 0\n _stopwords = Vidibus::Words.stopwords(*locales)\n for word in sort\n clean = word.permalink.gsub('-','')\n unless _stopwords.include?(clean)\n list << word\n count += 1\n break if count >= limit\n end\n end\n list\n end\n end",
"def tags\n records.each do |record|\n KEYWORDS_TAGGER.each do |name, keywords|\n record[name] = keywords.find {|keyword| record[:text].include?(keyword) }\n end\n end\n end",
"def get_keywords\n tweets = self.get_tweets\n counts = Hash.new(0)\n tweets.each do |tweet|\n tweet.text.downcase.split(/\\s+/).each do |word|\n word.gsub!(/\\p{^Alnum}/,'')\n next if word.size < 1\n counts[word] += 1\n end\n end\n temp_nest_array = (counts.select{ |k, v| v.to_i > 1}).sort_by{ |k, v| -v } # sort by count (descending) on counts of more than one word\n count_hash = Hash.new(0)\n temp_nest_array.each do |k, v|\n count_hash[k] = v\n end\n count_hash\n end",
"def generate_keywords\n all_keywords = {\n minions: [],\n tokens: [],\n mechanics: []\n }\n\n pt = plain_text.downcase\n\n Mechanic.names.each do |mechanic|\n next unless pt.include?(\" #{mechanic.downcase}\") || pt.include?(\"#{mechanic.downcase} \")\n\n p mechanic.downcase\n all_keywords[:mechanics].push(mechanic)\n pt.slice!(mechanic.downcase)\n end\n\n Card.names.each do |name|\n next unless pt.include?(\" #{name.downcase}\") || pt.include?(\"#{name.downcase} \")\n\n p Card.find_by(name: name).name\n all_keywords[:minions].push(name)\n pt.slice!(name)\n end\n pt\n end",
"def analyze_keyword_occurences(keywords)\n full_word_occurences = {}\n @bugs.each do |bug|\n all_text = \"#{bug.description.downcase} #{bug.summary.downcase}\"\n\n all_text.gsub(/[^a-z]/i,' ').split.each do |word|\n word = word.strip\n if full_word_occurences.has_key? word\n full_word_occurences[word] = full_word_occurences[word] + 1\n else\n full_word_occurences[word] = 1\n end\n end\n end\n\n computed_occurences = {}\n keywords.each do |keyword|\n if !full_word_occurences[keyword].nil?\n computed_occurences[keyword] = full_word_occurences[keyword]\n end\n end\n puts computed_occurences\n end",
"def keywords\n my_nodes_tagged(:querykeywordexpr)\n end",
"def keywords\n my_nodes_tagged(:querykeywordexpr)\n end",
"def keywords( *args )\n @allowed_keywords = Array([*args])\n end",
"def keywords\n @keywords ||= keyword_class.find(:all, :params => {\n :watched_domain_id => self.id })\n end",
"def add_keywords(keyword_titles)\n self.keywords = []\n keyword_titles.each do |keyword_title|\n keyword = Keyword.where(title: keyword_title).first_or_create\n self.keywords << keyword\n end\n self.keywords = self.keywords.uniq\n end",
"def keywords\n\t\t\t\treturn [\n\t\t\t\t\tsuper,\n\t\t\t\t\t@data['keywords_self'],\n\t\t\t\t\tPLAYER.current_room.keywords_neighbors(get_classname)\n\t\t\t\t].flatten.reject { |x| !x }\n\t\t\tend",
"def keywords\n attr = [status, name, title_search, subject_list]\n attr.join(' ')\n end",
"def extract_keywords(elements, keywords)\n result = {}\n \n elements.each do |node|\n keywords.each do |keyword|\n if node =~ /#{keyword}/i # node.downcase.include?(keyword.downcase)\n if result[keyword]\n result[keyword] += 1\n else\n result[keyword] = 1\n end\n end\n end\n end\n\n result\nend",
"def matchers\n keywords[\"matchers\"] || {}\n end",
"def build_keyword_list(s, heading)\n \n a = s.split.uniq.flat_map do |raw_word|\n\n i, pos = 0, []\n\n w = raw_word[/\\w{2,}/]\n \n next if IGNOREWORDS.include? w\n next unless w\n\n (pos << (s[i..-1] =~ /#{w}/i); i += pos[-1] + 1) while s[i..-1][/#{w}/i]\n\n pos[1..-1].inject([pos[0]]) {|r,x| r << r.last + x + 1 }\n\n pos.map do |x| \n \n start = x-15\n start = 0 if start < 0\n snippet = make_snippet(s, start)\n \n \"[%s] %s | %s %s\" % [heading, snippet, w.downcase, \n heading.scan(/\\w+/).join(' ').downcase]\n end\n\n\n end\n \n a\n \n end",
"def get_keywords(query_obj=nil)\n uri = URI.parse(@uri + \"/Keywords\")\n results = get(uri,query_obj)\n end",
"def search(keyword)\n re=@wordlist.select do |k,v|\n k.include?(keyword)|\n v.include?(keyword)\n end\n Hash[*re.flatten!]\n end",
"def keywords\n ks = Keyword.where(meta_key_id: id)\n if keywords_alphabetical_order\n ks.order('keywords.term ASC')\n else\n ks.order('keywords.position ASC')\n end\n end",
"def keywords(page_keywords)\n content_for(:keywords) do\n \"<meta name=\\\"keywords\\\" content=\\\"#{page_keywords}\\\" />\\n\"\n end\n end",
"def keywords(page_keywords)\n content_for(:keywords) do\n \"<meta name=\\\"keywords\\\" content=\\\"#{page_keywords}\\\" />\\n\"\n end\n end",
"def keywords(keywords)\n ensure_valid_parameter('keywords', keywords, lambda {|k| k.is_a? Array or k.is_a? String})\n keywords = keywords.join(' ') if keywords.is_a? Array\n @request[:keywords] = keywords\n self\n end",
"def keywords\n if @model\n return @keywords || @model.keywords || Keywords.empty_keywords\n end\n @keywords || Keywords.empty_keywords\n end",
"def create_keywords\n\n keywords = t(LOCALE_KEYWORDS_KEY, default: SiteMetaInfoDefaults.keywords)\n business_cats = BusinessCategory.pluck(:name).uniq\n\n cats_str = business_cats.empty? ? '' : ', ' + business_cats.join(', ')\n keywords + cats_str\n end",
"def keywords(page_keywords) \n content_for(:keywords){\"<meta name=\\\"keywords\\\" content=\\\"#{page_keywords}\\\" />\\n\"} \n end",
"def set_keywords\n\t\t\tself.keywords = [title, author, description].map(&:downcase).join(' ')\n\t\tend",
"def key_order\n keys = {}\n self.keyword.chars.sort.each_with_index do |c, index|\n keys[index] = self.keyword.index(c)\n end\n keys\n end",
"def meta_keywords\n keywords = [] # keywords = [\"one, two, three\"]\n if @category and !@category.new_record?\n keywords << [@category.title]\n end\n if @post and !@post.new_record?\n keywords << [@post.title, @post.subtitle]\n end\n keywords.join(\",\")\n end",
"def custom_keyword_regexp\n return nil if @custom_keywords.empty?\n Regexp.new(\"^(#{@custom_keywords.join('|')})\\$\")\n end",
"def initialize_keywords\n variants = []\n search_queries.each do |sq|\n variants << sq.keyword\n variants += sq.variants\n end\n\n update_column(:keywords, variants.uniq)\n end",
"def build_keyword_pages\n keyword_pages = {}\n sitemap.resources.each do |resource|\n keywords = resource.metadata[:page][\"keywords\"]\n next if keywords.blank?\n keywords.each do |keyword|\n (keyword_pages[keyword] ||= []) << resource\n end\n end\n keyword_pages\nend",
"def find(input)\r\n if include?(input)\r\n Hash[input, (@@words[input])]\r\n elsif keywords.any? {|key| key.start_with?(input)}\r\n @@words.select {|key, value| key.start_with?(input)}\r\n else\r\n Hash.new\r\n end \r\nend",
"def meta_keywords(*args)\n if args.any?\n @meta_keywords = Array(args.first).join(\", \")\n else\n keywords = @meta_keywords\n keywords ||= @page.tag_list if @page&.tags&.any?\n strip_tags(keywords)\n end\n end",
"def ref_keywords\n unless @ref_keywords_cache\n @ref_keywords_cache = Setting.commit_ref_keywords.downcase.split(',').collect(&:strip)\n @ref_keywords_cache.delete('*')\n end\n @ref_keywords_cache\n end",
"def before_create\n keywords = []\n subkeywords = []\n end",
"def index_keywords!\n all.each { |d| d.index_keywords! }\n end",
"def initialize\n @words = (KEYWORDS + OTHERS).map(&:downcase)\n end",
"def keywords\n @descriptive_detail.keywords\n end",
"def create_keywords(data=nil,generate_objects=false)\n uri = URI.parse(@uri + \"/Keywords\")\n results = post(uri,data,generate_objects)\n end",
"def required_keywords; end",
"def count_duplicates( keywords )\n counted_keywords = Hash.new(0)\n keywords.each do |keyword|\n counted_keywords[keyword.downcase] += 1\n end\n\n return counted_keywords\nend",
"def its_keywords\n spec_keywords(\"its\")\n end",
"def semantic_search_keys \n semantic_search_map.keys\n end",
"def get_keywords(site)\n response = Net::HTTP.get_response(site, \"/\")\n Hpricot(response.body).\n search(\"meta[@name='keywords']\")[0]. #Select meta keywords element\n attributes[\"content\"]. #Select its content\n split(\",\"). #Keywords are coma separated\n collect{ |k| k.strip.downcase } #Remove start and end white spaces\nend",
"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 add_keywords_regexps(attr, keyword)\n keys = [attr.to_s.humanize]\n if attr.is_a?(Symbol)\n if user && user.language.present?\n keys << l(\"field_#{attr}\", default: '', locale: user.language)\n end\n if Setting.default_language.present?\n keys << l(\"field_#{attr}\", default: '', locale: Setting.default_language)\n end\n end\n keys.reject! { |k| k.blank? }\n keys.collect! { |k| Regexp.escape(k) }\n @attributes_regexps ||= []\n keyword = Regexp.escape(keyword.to_s)\n # http://rubular.com/r/3Qtpatl12d\n @attributes_regexps << /(<{1}[^<\\/>]+>{1}\\s*){,1}\\s*(#{keys.join('|')})\\s*(<{1}\\/{1}[^<>]+>{1}\\s*)*\\s*(<{1}[^<>]+>{1}\\s*)*\\s*(:)\\s*(<{1}\\/{1}[^<>]+>{1}\\s*)*\\s*(<{1}[^<>]+>{1}\\s*)*\\s*(#{keyword})\\s*(<{1}\\/{1}[^<>]+>{1}\\s*){,1}/i\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 keywords_attributes\n keyword_ids.map(&:to_s)\n end",
"def load_keyword_cookies\n unless @keyword_cookies\n cookie_keywords = load_cookie_keywords\n\n @keyword_cookies = {}\n cookie_keywords.each do |cookie, keywords|\n keywords.each do |keyword|\n cookies = (@keyword_cookies[keyword] ||= Set.new)\n cookies.add(cookie)\n end\n end\n end\n @keyword_cookies\nend",
"def set_Keywords(value)\n set_input(\"Keywords\", value)\n end",
"def tag_keywords locale = :en\n tags.map do |t|\n t.try(\"keywords_#{locale}\")\n end.reject(&:blank?).uniq.join(', ')\n end",
"def render_keywords(tags)\n keywords = TextNormalizer.normalize_keywords(meta_tags.extract(:keywords))\n normalized_meta_tags[:keywords] = keywords\n tags << Tag.new(:meta, :name => :keywords, :content => keywords) if keywords.present?\n end",
"def setKeywords(keywords)\n @fields['keywords'] = keywords\n self\n end",
"def setKeywords(keywords)\n @fields['keywords'] = keywords\n self\n end",
"def setKeywords(keywords)\n @fields['keywords'] = keywords\n self\n end",
"def setKeywords(keywords)\n @fields['keywords'] = keywords\n self\n end",
"def meta_keywords\n keywords = [\"coin collecting, coin collecting software, free coin collecting software, coins, usa coins, us coins, coin photos\"]\n if @coin and !@coin.new_record?\n keywords << [@coin.meta_keywords]\n end\n raw keywords.join(\",\")\n end",
"def hooks_params_keywords\n hooks_keywords = {}\n hooks.each do |hook, value|\n values = split_word(value)\n hooks_keywords[hook] = values\n end\n hooks_keywords\n end",
"def get_svn_keyword_map( *files )\n\tfiles.flatten!\n\tfiles.push( '.' ) if files.empty?\n\n\tcmd = ['svn', 'pg', 'svn:keywords', *files]\n\n\t# trace \"Executing: svn pg svn:keywords \" + files.join(' ')\n\toutput = IO.read( '|-' ) or exec( 'svn', 'pg', 'svn:keywords', *files )\n\t\n\tkwmap = {}\n\toutput.split( \"\\n\" ).each do |line|\n\t\tnext if line !~ /\\s+-\\s+/\n\t\tpath, keywords = line.split( /\\s+-\\s+/, 2 )\n\t\tkwmap[ path ] = keywords.split\n\tend\n\t\n\treturn kwmap\nend",
"def set_keywords\n # keywords = '' -> can't write this way because keywords will only be a\n # local variable and won't reference the model's property. would work if\n # we were wanting to read only but not for property assignment\n self.keywords = [title, author, description].map(&:downcase).join(' ')\n # &: is symbol to proc\n # it knows that the variables in the array are referring to properties on\n # self\n end",
"def the_keywords\n k = object.get_option(\"keywords\", \"\")\n k = h.current_site.the_keywords if object.class.name != \"CamaleonCms::Site\" && !k.present?\n k.to_s.translate(get_locale)\n end",
"def find_tt_keys(contents)\n keys = []\n contents.map do |line|\n \"=#{line}\".scan(/\\Wtt[\\s\\(]+\\:([\\w\\'\\\"]+)/).each { |m| keys << m[0] }\n end\n keys.uniq\n end",
"def keywords_field= params\n\t\t\t\ttmp = params.uniq\n\t\t\t\tself.keywordings.each do |k|\n\t\t\t\t\tself.keywords.delete(k.keyword) unless tmp.delete(k.keyword.name)\n\t\t\t\tend\n\t\t\t\ttmp.each do |keyword_name|\n\t\t\t\t\tkeyword = Keyword.find(:first, :conditions => { :name => keyword_name }) || Keyword.new(:name => keyword_name)\n\t\t\t\t\tself.keywordings.build(:keyword => keyword)\n\t\t\t\tend\n\t\t\tend",
"def all_tags=(keywords)\n self.tags = keywords.split(',').map do |keyword|\n Tag.where(keyword: keyword.strip).first_or_create!\n end\n end",
"def keywords_of_be_word\n return split_word(matchers['be']) if matchers\n end",
"def complete_keyword\n keywords = []\n definition.fields.each do|f|\n next unless f[1].complete_enabled\n if (f[1].key_field)\n keywords += complete_key(f[0], f[1], tokens.last)\n else\n keywords << f[0].to_s + ' '\n end\n end\n keywords.sort\n end",
"def dull_keywords\n (@@dull_keywords ||= Defaults.dull_keywords).flatten.uniq\n end",
"def initialize \n @story_keywords = [] # Creates the array that will hold the part of speech keywords\n end",
"def keywords_to_specify\n keywords = keywords_by_type\n return keywords.select { |key| ![\"USER\", \"FRIEND\", \"IMAGE\"].include?(key) }\n end",
"def index\n @spec_keywords = SpecKeyword.all\n end",
"def rest_keywords; end",
"def keywords(obj)\n dirty_words = %w[ip browser created_at updated_at id]\n obj.class.properties.map(&:name)\n .reject { |v| dirty_words.include?(v.to_s) }\n .map { |var| obj.instance_variable_get(\"@%s\" % var).to_s }\n .join(\" \")\n end",
"def key_words\n # because dollar signs don't work we can't display a $ sign in the keyword\n # list so its not explicitly clear what the keyword\n variables = scope.to_hash.keys\n # prepend a :: to topscope variables\n scoped_vars = variables.map { |k, _v| scope.compiler.topscope.exist?(k) ? \"$::#{k}\" : \"$#{k}\" }\n PuppetDebugger::InputResponders::Functions.instance.debugger = self\n funcs = PuppetDebugger::InputResponders::Functions.instance.func_list\n PuppetDebugger::InputResponders::Datatypes.instance.debugger = self\n (scoped_vars + funcs + static_responder_list + PuppetDebugger::InputResponders::Datatypes.instance.all_data_types).uniq.sort\n end",
"def keyword\n values = super\n values = MetadataHelper.ordered( ordered_values: self.keyword_ordered, values: values )\n return values\n end",
"def keyword\n values = super\n values = MetadataHelper.ordered( ordered_values: self.keyword_ordered, values: values )\n return values\n end",
"def search pattern\n\t\tresults = all.map {|key|\n\t\t\tkey if key.to_s =~ /#{pattern}/i\n\t\t}\n\t\tresults.delete nil\n\t\tresults\n\tend",
"def extract_all_words(html)\n doc = Nokogiri::HTML(html)\n keywords = []\n doc.css(\"meta[name='keywords']\").each do |node|\n keywords += node['content'].gsub(/\\s+/, \" \").gsub(/[^a-zA-Z\\- ',]/, '').squeeze(\" \").split(\",\")\n end\n text = String.new\n doc.css(\"meta[name='description']\").each do |node|\n text += node['content']\n end\n \n %w(script style link meta).each do |tag|\n doc.css(tag).each { |node| node.remove }\n end\n\n w = []\n doc.traverse do |node|\n if node.text? then\n w << node.content + \" \"\n end\n end\n text += w.join.gsub(/\\s+/, \" \").gsub(/[^a-zA-Z\\- ']/, '').squeeze(\" \")\n words = (text.downcase.split - STOPWORDS)\n \n final = (keywords + words)\n final.map do |w|\n w.stem\n end\n end"
] |
[
"0.70199996",
"0.6949908",
"0.6922844",
"0.6886545",
"0.6787974",
"0.673679",
"0.67182547",
"0.6590022",
"0.6560572",
"0.6557703",
"0.6547681",
"0.64885974",
"0.6481766",
"0.64325744",
"0.6399092",
"0.637511",
"0.63645184",
"0.6358961",
"0.63541293",
"0.6276333",
"0.6272589",
"0.6261763",
"0.62330943",
"0.62115324",
"0.61814225",
"0.6173108",
"0.6160227",
"0.6148972",
"0.6122999",
"0.6108152",
"0.60968405",
"0.60968405",
"0.60542274",
"0.60486805",
"0.6027391",
"0.599702",
"0.5985346",
"0.59631306",
"0.59550154",
"0.5947858",
"0.59275264",
"0.5883004",
"0.5860097",
"0.58106",
"0.58106",
"0.580751",
"0.58056456",
"0.5794666",
"0.5788462",
"0.577808",
"0.5765863",
"0.57406616",
"0.57144463",
"0.57045233",
"0.56846386",
"0.56765944",
"0.5665154",
"0.5649542",
"0.56449795",
"0.5643417",
"0.5639356",
"0.563253",
"0.5610511",
"0.5600184",
"0.55944103",
"0.55710506",
"0.55680925",
"0.55571455",
"0.55361885",
"0.553361",
"0.5512315",
"0.5503361",
"0.5501467",
"0.5487013",
"0.54866236",
"0.54865944",
"0.5480447",
"0.5480447",
"0.5480447",
"0.5480447",
"0.5471498",
"0.5464502",
"0.5435062",
"0.5429773",
"0.5427405",
"0.54218936",
"0.54006624",
"0.5394716",
"0.53916365",
"0.53810966",
"0.53607833",
"0.53594375",
"0.53325504",
"0.5330785",
"0.5330182",
"0.5324804",
"0.5305311",
"0.5302922",
"0.5302922",
"0.52896035",
"0.5288928"
] |
0.0
|
-1
|
define a keyword to skip the sheet upload"
|
def keyword_to_skip(keyword_name)
kw = Keyword.find_by_name(keyword_name)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def should_be_skipped?(word)\n reject?(word) || hashtag?(word) || uri?(word) || mention?(word)\n end",
"def skip_actions; end",
"def skip &block\n annotate block do |c|\n c unless @item_rep.name == :wordcount\n end\nend",
"def skip\n end",
"def skip\n end",
"def skip!\n @skip ||= true\n end",
"def ignore\n @ignore = true\n end",
"def default_skip(input)\n return true if input == \"section\"\n return false\n end",
"def tag_name(tag_name)\n @data << [\"ignore:#{tag_name}\"]\n end",
"def ignore; end",
"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 ignore\n @ignore = true\n end",
"def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)\n # Do nothing\n end",
"def ignore!\n @should_ignore = true\n end",
"def update_skip_key\n SceneManager.goto(Scene_Title) if Input.trigger?(TH::Splash_Screen_Map::Skip_Button)\n end",
"def skip\n @skip = true\n end",
"def skipped!; end",
"def skip_name?(control, name)\n if control.has_key?(:exclude) and control[:exclude].include? name\n true\n elsif control.has_key?(:include) and not control[:include].include? name\n true\n end\n end",
"def skip!(msg = '(no message given)')\n @skipmessage = msg\n @skip = true\n end",
"def skip!(msg = '(no message given)')\n @skipmessage = msg\n @skip = true\n end",
"def set_SkipDisambiguation(value)\n set_input(\"SkipDisambiguation\", value)\n end",
"def set_ExcludePartOfSpeech(value)\n set_input(\"ExcludePartOfSpeech\", value)\n end",
"def set_ExcludePartOfSpeech(value)\n set_input(\"ExcludePartOfSpeech\", value)\n end",
"def set_ExcludePartOfSpeech(value)\n set_input(\"ExcludePartOfSpeech\", value)\n end",
"def set_ExcludePartOfSpeech(value)\n set_input(\"ExcludePartOfSpeech\", value)\n end",
"def ignore\n return unless @track_visibility\n\n @ignored = true\n\n stop_doc\n end",
"def skipped; end",
"def skips_post \n @skips_post\n end",
"def post_process(sheet)\n # Do nothing\n end",
"def check_unused_ios(worksheet, from_row, to_row, target_directory, mark)\n puts \"\\nUNUSED IOS KEYS:\"\n for row in from_row..to_row\n key = worksheet[row, 1]\n unless key.blank?\n term = Term.new(key)\n if term.restriction == 'i' || term.restriction == nil\n if !term.is_comment?\n result = find_text_on_ios_files(target_directory,term.keyword_iphone_constant)\n if(result.length == 0)\n puts term.keyword_iphone_constant\n if(mark)\n #modifiying key on spreadsheet by prepending [u] to mark key as unused\n worksheet[row, 1] = '[u]'+key\n end\n end\n else\n puts \"\\n==> Group:\"\n end\n end\n end\n end\n if(mark)\n worksheet.save()\n end\nend",
"def ignore_me\nend",
"def ignore!\n self.ignored = true\n end",
"def skip\n self[:skip]\n end",
"def required_keywords; end",
"def forbidden_keyword_validation\n errors.add :value, I18n.t('errors.messages.exclusion') if value =~ /(#{blocked_keywords.split(',').map(&:strip).join('|')})/\n end",
"def not_keyword(string)\n\t\t(str(string) >> identifier_match.absent?).absent?\n\tend",
"def set_Skip(value)\n set_input(\"Skip\", value)\n end",
"def set_Skip(value)\n set_input(\"Skip\", value)\n end",
"def set_Skip(value)\n set_input(\"Skip\", value)\n end",
"def set_Skip(value)\n set_input(\"Skip\", value)\n end",
"def set_Skip(value)\n set_input(\"Skip\", value)\n end",
"def set_Skip(value)\n set_input(\"Skip\", value)\n end",
"def ignore_parameter(key)\n ignore_params[key] = nil\n end",
"def ignore(*args); end",
"def add_ignore(*rules)\n data['Ignore'] ||= []\n rules.each { |rule| data['Ignore'] << rule.title }\n data['Ignore'].sort!.uniq!\n end",
"def skip_for_variable\n skip_tkspace_without_nl\n get_tk\n skip_tkspace_without_nl\n tk = get_tk\n unget_tk(tk) unless :on_kw == tk[:kind] and 'in' == tk[:text]\n end",
"def optional_keywords; end",
"def skip_step?(filename, step)\n if File.exist?(filename) && !@force_overwrite\n print_e \"SKIPPED #{step}: #{filename} already exists.\"\n true\n else\n print_e \"RUN #{step} => #{filename}\"\n false\n end\n end",
"def ignored?\n marking == \"IGNORED\"\n end",
"def skip?\n false \n end",
"def skip=(reason)\n @skip = reason\n end",
"def skipped?; end",
"def skipped?; end",
"def skipped?; end",
"def skipped?; end",
"def file_upload_question?\n hide_text\n end",
"def file_upload_question?\n hide_text\n end",
"def keyword_check(kw)\n unless (@keywords || %w(a is of has)).include?(kw)\n raise RDF::ReaderError, \"unqualified keyword '#{kw}' used without @keyword directive\" if validate?\n end\n end",
"def skip(skip = nil)\n set_option(:skip, skip)\n end",
"def prohibit(key)\n @status[key] = :prohibited\n end",
"def skips_post #:nodoc:\n @skips_post\n end",
"def save_metas_options_skip\n false\n end",
"def skips_post\n @@skips_post = true\n end",
"def ignore\n\t\t\treturn @data['ignore']\n\t\tend",
"def import_kwords_warning\r\n kwords = settings.import_kwords\r\n return unless kwords.nil? || kwords.none?\r\n\r\n msg = \"ImportKeywords left empty in config file\"\r\n Message::Warning.warning_puts(msg)\r\n\r\n self.check_import = false\r\n end",
"def is_non_text()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::IsNonText::IsNonTextRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def ignore(value = true)\n @ignore = value\n end",
"def ignore(value = true)\n @ignore = value\n end",
"def skips; end",
"def excluded; end",
"def check_unused_android(worksheet, from_row, to_row, target_directory, mark)\n puts \"\\nUNUSED ANDROID KEYS:\"\n for row in from_row..to_row\n key = worksheet[row, 1]\n unless key.blank?\n term = Term.new(key)\n if term.restriction == 'a' || term.restriction == nil\n if !term.is_comment?\n result = find_text_on_android_files(target_directory,term.keyword_android)\n if(result.length == 0)\n puts term.keyword_android\n if(mark)\n #modifiying key on spreadsheet by prepending [u] to mark key as unused\n worksheet[row, 1] = '[u]'+key\n end\n end\n else\n puts \"\\n==> Group:\"\n end\n end\n end\n end\n if(mark)\n worksheet.save()\n end\nend",
"def validate_keyword!\n raise ResponseError::ArgumentError.new(\"Search keyword is missing\") if self.keywords.nil?\n raise ResponseError::ArgumentError.new(\"Search keyword is blank\") if self.keywords.empty?\n end",
"def keywords_to_specify\n keywords = keywords_by_type\n return keywords.select { |key| ![\"USER\", \"FRIEND\", \"IMAGE\"].include?(key) }\n end",
"def skip_header\n @skip_header = true\n end",
"def skip_during; end",
"def skip_during; end",
"def ignore?\n input.to_s[0] == '_'\n end",
"def skip_week\n for item in action_items\n item.skip! unless item.complete?\n end\n\n end",
"def skip_name\n @attributes[:skip_name]\n end",
"def not_escaped()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Not_escaped::NotRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def skip_company\n @attributes[:skip_company]\n end",
"def skip_main_heading?\n true\n end",
"def skip_method(a,b,c)\nend",
"def skip_after; end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def keyword_check(kw)\n unless (@keywords || %w(a is of has)).include?(kw)\n raise RDF::ReaderError, \"unqualified keyword '#{kw}' used without @keyword directive\" if @strict\n end\n end",
"def skip()\n lines = send_message(\"SKIP\", message)\n end",
"def validate_keyword(keyword)\n if RESERVED_KEYWORDS.include?(keyword)\n reserved = RESERVED_KEYWORDS.collect { |key| \"'#{key}'\" }\n raise ReservedGearKeyword, \"'#{keyword}' is a reserved keyword. Reserved Keywords: #{reserved.join(', ')}.\"\n end\n\n culprit = find_by_keyword(keyword)\n\n unless culprit.nil?\n raise DuplicateGearKeyword, \"Keyword '#{keyword}' already used by #{culprit}\"\n end\n\n true\n end",
"def skip\n param 'state' => Patriot::JobStore::JobState::SUCCEEDED\n end",
"def no_submit!\n @no_submit = true\n end",
"def skip_page(site, page, message)\r\n site.collections[rp_key].docs.delete page.page\r\n Jekyll.logger.warn \"Skipping #{page.basename}: #{message}\"\r\n end",
"def ignores; end",
"def ignored_files=(_arg0); end",
"def exclude; end",
"def skip_for_gif\n ! %w(image/gif).include?(image_content_type)\n end",
"def suspicious_keyword_params\n params.require(:suspicious_keyword).permit(:keyword)\n end",
"def file_name\n 'unused'\n end",
"def fine_print_skip(*names)\n options = names.last.is_a?(Hash) ? names.pop : {}\n\n # Convert names to an array of Strings\n contract_names = names.flatten.collect{|c| c.to_s}\n contract_names = ['all'] if contract_names.empty?\n\n class_exec do\n prepend_before_action(options) do |controller|\n controller.fine_print_skipped_contract_names.push(*contract_names)\n end\n end\n end",
"def exclude_name(name)\n @rest_call.append_headers(\"X-Nuage-FilterType\", \"predicate\")\n @rest_call.append_headers(\"X-Nuage-Filter\", \"name ISNOT '#{name}'\")\n end",
"def action_should_have_robots_none_tag?(_action_name = '')\n true\n end"
] |
[
"0.57791114",
"0.567176",
"0.56295663",
"0.56086713",
"0.56086713",
"0.5521256",
"0.54990757",
"0.5498019",
"0.5457367",
"0.54508346",
"0.5446129",
"0.5419818",
"0.5403558",
"0.5350712",
"0.5344656",
"0.5343738",
"0.52921486",
"0.5287246",
"0.5282029",
"0.5282029",
"0.5266414",
"0.5248903",
"0.5248903",
"0.5248903",
"0.5248903",
"0.5248649",
"0.5246583",
"0.5212905",
"0.5200001",
"0.51801986",
"0.51795065",
"0.51769584",
"0.51730084",
"0.51691",
"0.51548266",
"0.5153776",
"0.5148626",
"0.5148626",
"0.5148626",
"0.5148626",
"0.5148626",
"0.5148626",
"0.5137683",
"0.5136552",
"0.5130088",
"0.5121947",
"0.5112639",
"0.5107939",
"0.5096138",
"0.50855297",
"0.5068523",
"0.50663114",
"0.50663114",
"0.50663114",
"0.50663114",
"0.5066252",
"0.5066252",
"0.50652397",
"0.5060028",
"0.50573903",
"0.504274",
"0.50423306",
"0.50383973",
"0.502947",
"0.50293344",
"0.5027974",
"0.50224197",
"0.50224197",
"0.50139",
"0.5009831",
"0.5008067",
"0.50071865",
"0.49990854",
"0.49976116",
"0.4989762",
"0.4989762",
"0.49806094",
"0.4972841",
"0.49703133",
"0.4969484",
"0.4961733",
"0.49558172",
"0.49530888",
"0.49528944",
"0.4950972",
"0.49508965",
"0.49499705",
"0.49439228",
"0.4937731",
"0.49355343",
"0.49083105",
"0.4907585",
"0.49007297",
"0.48915264",
"0.4877695",
"0.48504522",
"0.48500994",
"0.484725",
"0.484635",
"0.48372135"
] |
0.5718274
|
1
|
p single_number([1,1,"x",3,3,4,4]) p single_number([1,3,5,2,3,1,5])
|
def single_number2(nums)
nums.reduce do |collect, num|
collect ^= num
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def single_number(nums)\n\nend",
"def single_number(nums)\n nums.reduce(&:^)\n #亦可 nums.reduce(:^)\nend",
"def single_number(nums)\n uniques = []\n nums.each do |num|\n uniques.include?(num) ? uniques.delete(num) : uniques << num\n end\n uniques\nend",
"def single_number(nums)\n 2 * nums.uniq.reduce(:+) - nums.reduce(:+)\nend",
"def double_to_single_method\n #single_digit_array = []\n @multiplied_integer_array.each do |value|\n if value > 9\n value = value - 9\n @single_digit_array << value\n else\n value = value\n @single_digit_array << value\n end\n end\n return @single_digit_array\n end",
"def double_to_single_method(multiplied_integer_array)\n single_digit_array = []\n multiplied_integer_array.each do |value|\n if value > 9\n value = value - 9\n single_digit_array << value\n else\n value = value\n single_digit_array << value\n end\n end\n return single_digit_array\nend",
"def single_numbers\n text, ary = parse_text, [] \n until text.empty?\n top, mid, bot, blank = text.shift(4)\n ary.push(*top.zip(mid, bot).map(&:join)) \n ary.push(\",\") unless text.empty? # add comas when input entered on multiple lines\n end\n ary\n end",
"def repeated_digit number\n raise \"Wrong type of argument\" if !number.is_a? Numeric\n # array = number.to_s.split(\"\").map(&:to_i)\n # array.count{ |item| item != array.first} == 0\n\n # number.to_s.squeeze.length == 1\n\n number.to_s.chars.uniq.length == 1\nend",
"def list_of_nums(num)\n num.to_s.split('').map! {|n| n.to_i}\nend",
"def single_number(nums)\n nums.reduce(:^) # { |memo, num| memo ^ num }\nend",
"def numUnique2 list\n current_num = list[0]\n unique_numbers = [list[0]]\n\n list.each do |num|\n if num != current_num\n current_num = num\n unique_numbers << num\n end\n end\n return \"**#{unique_numbers.length}**\"\nend",
"def single_number(nums)\n (3 * nums.uniq.sum - nums.sum) / 2\nend",
"def input(number_string)\n\t\tnumber_string = number_string.split(\" \").to_a.uniq!.sort!.map{|num| num.to_i}\n\t\tputs \"Uniqe Values: #{number_string}\"\n\tend",
"def plus_one_short digits\n # int.next return the next int Ex: 2 -> 3\n # int.digits return an array of int digits\n # array.join return an string of array digits concatenation.\n # string.to_i return an int\n # array.reverse return an reversed array.\n digits.join.to_i.next.digits.reverse\nend",
"def given\n [6,5,3,1,8,7,2,3]\nend",
"def big_numbers(array_of_integers)\n # TODO\nend",
"def to_s_2num(a)\n raise StandardError, \"Invalid numbers: #{a}\" if a.instance_of?(Array) == false && a.size != 3\n \"[ #{a[0]}, #{a[1]} ]\"\nend",
"def double_numbers(array)\n\tarray.map { |integer| integer * 2 }\t\nend",
"def numbers\n %w[1 2 3 4 5 6 7 8 9 0\n tenth ninth eighth seventh sixth fifth fourth third second first\n ten nine eight seven six five four three two one ]\n end",
"def first(numbers, int)\n numbers.first(int)\nend",
"def number1\n number[0...Phonie.configuration.n1_length]\n end",
"def unique_in_order(x)\r\n a = (x.class == String ? x.chars : x ).chunk { |i| i }\r\n a.map{|a| a.first}\r\nend",
"def new_numbers (array)\n emptyArr = []\n array.each do |i|\n if i.class == Integer\n emptyArr << i\n end\n end\n return emptyArr\nend",
"def single_number(nums)\n\tnums.sort!\n\tn = nums.size - 1\n\ti = 0\n\twhile (i <= n)\n\t\tif nums[i] == nums[i+1]\n\t\t\ti+= 3\n\t\telse\n\t\t\treturn nums[i]\n\t\tend\n\tend\n\treturn 0\nend",
"def find_unique_x(numbers)\n numbers.reduce(:^)\nend",
"def magic_numbers(count)\n num = 1\n result = []\n while result.length < count\n result << num if is_magic_number?(num)\n num += 1\n end\n result\nend",
"def doubler(numbers)\n new_numbers = []\n # numbers.each { |num| new_numbers << num * 2 }\n numbers.each { |num| new_numbers.push(num * 2) }\n new_numbers\nend",
"def single_number(nums)\n result = {}\n\n nums.each do |n|\n # delete in ruby is slow... this one isn't as fast as mine\n result[n].nil? ? result[n] = n : result.delete(n)\n end\n\n result.shift.first\nend",
"def add(string_of_numbers = \"\")\n\t\tcounter = 0\n\t\tstring_of_numbers.gsub!('$',\",\")\n\t\t# p string_of_numbers\n array_of_split_numbers = string_of_numbers.split(',') \n # p array_of_split_numbers \n\n empty_array = []\n \tarray_of_split_numbers.each do |number|\n \t\tempty_array.push(number.to_i)\n \t\t\t\t\t\t\t\tend \n\n empty_array.each do |element|\n counter += element\n\t\t\t\t\t\tend\n\t\t\t\t\t\tcounter\n\tend",
"def numbers\n gsub(/[^\\n]/, '').split#.map {|x| x.to_i} #found gsub in Ruby documentation, for handling new lines between numbers. map in array doc\nend",
"def double_numbers(array)\n doubled_numbers = []\n array.each do |number|\n doubled_numbers << number * 2\n end\n return doubled_numbers\nend",
"def number1\n self.number('number1','key1')\n end",
"def slippery_numbers(n)\r\n array, num = [], 3\r\n while array.length < n\r\n array << num if is_slippery?(num)\r\n num += 1\r\n end\r\n array\r\nend",
"def slippery_numbers(n)\r\n array, num = [], 3\r\n while array.length < n\r\n array << num if is_slippery?(num)\r\n num += 1\r\n end\r\n array\r\nend",
"def lister(int)\n\tint.to_s.split('').map { |element| element.to_i }\nend",
"def natural_numbers\r\n\tnatural_numbers = []\r\n\tfor x in 1..999\r\n\t\tif x % 3 == 0 or x % 5 == 0\r\n\t\t\tnatural_numbers << x\r\n\t\tend\r\n\tend\r\nend",
"def digit_list_two(positive_integer)\n list = []\n array_of_integer_strings = positive_integer.to_s.split('')\n array_of_integer_strings.each do |number|\n list << number.to_i\n end\n list \nend",
"def wtf_nums()\r\n\tthe_wtf_num = [37107287533902102798797998220837590246510135740250, 46376937677490009712648124896970078050417018260538,\r\n\t\t\t\t\t74324986199524741059474233309513058123726617309629, 91942213363574161572522430563301811072406154908250,\r\n\t\t\t\t\t23067588207539346171171980310421047513778063246676, 89261670696623633820136378418383684178734361726757,\r\n\t\t\t\t\t28112879812849979408065481931592621691275889832738, 44274228917432520321923589422876796487670272189318,\r\n\t\t\t\t\t47451445736001306439091167216856844588711603153276, 70386486105843025439939619828917593665686757934951,\r\n\t\t\t\t\t62176457141856560629502157223196586755079324193331, 64906352462741904929101432445813822663347944758178,\r\n\t\t\t\t\t92575867718337217661963751590579239728245598838407, 58203565325359399008402633568948830189458628227828,\r\n\t\t\t\t\t80181199384826282014278194139940567587151170094390, 35398664372827112653829987240784473053190104293586,\r\n\t\t\t\t\t86515506006295864861532075273371959191420517255829, 71693888707715466499115593487603532921714970056938,\r\n\t\t\t\t\t54370070576826684624621495650076471787294438377604, 53282654108756828443191190634694037855217779295145,\r\n\t\t\t\t\t36123272525000296071075082563815656710885258350721, 45876576172410976447339110607218265236877223636045,\r\n\t\t\t\t\t17423706905851860660448207621209813287860733969412, 81142660418086830619328460811191061556940512689692,\r\n\t\t\t\t\t51934325451728388641918047049293215058642563049483, 62467221648435076201727918039944693004732956340691,\r\n\t\t\t\t\t15732444386908125794514089057706229429197107928209, 55037687525678773091862540744969844508330393682126,\r\n\t\t\t\t\t18336384825330154686196124348767681297534375946515, 80386287592878490201521685554828717201219257766954,\r\n\t\t\t\t\t78182833757993103614740356856449095527097864797581, 16726320100436897842553539920931837441497806860984,\r\n\t\t\t\t\t48403098129077791799088218795327364475675590848030, 87086987551392711854517078544161852424320693150332,\r\n\t\t\t\t\t59959406895756536782107074926966537676326235447210, 69793950679652694742597709739166693763042633987085,\r\n\t\t\t\t\t41052684708299085211399427365734116182760315001271, 65378607361501080857009149939512557028198746004375,\r\n\t\t\t\t\t35829035317434717326932123578154982629742552737307, 94953759765105305946966067683156574377167401875275,\r\n\t\t\t\t\t88902802571733229619176668713819931811048770190271, 25267680276078003013678680992525463401061632866526,\r\n\t\t\t\t\t36270218540497705585629946580636237993140746255962, 24074486908231174977792365466257246923322810917141,\r\n\t\t\t\t\t91430288197103288597806669760892938638285025333403, 34413065578016127815921815005561868836468420090470,\r\n\t\t\t\t\t23053081172816430487623791969842487255036638784583, 11487696932154902810424020138335124462181441773470,\r\n\t\t\t\t\t63783299490636259666498587618221225225512486764533, 67720186971698544312419572409913959008952310058822,\r\n\t\t\t\t\t95548255300263520781532296796249481641953868218774, 76085327132285723110424803456124867697064507995236,\r\n\t\t\t\t\t37774242535411291684276865538926205024910326572967, 23701913275725675285653248258265463092207058596522,\r\n\t\t\t\t\t29798860272258331913126375147341994889534765745501, 18495701454879288984856827726077713721403798879715,\r\n\t\t\t\t\t38298203783031473527721580348144513491373226651381, 34829543829199918180278916522431027392251122869539,\r\n\t\t\t\t\t40957953066405232632538044100059654939159879593635, 29746152185502371307642255121183693803580388584903,\r\n\t\t\t\t\t41698116222072977186158236678424689157993532961922, 62467957194401269043877107275048102390895523597457,\r\n\t\t\t\t\t23189706772547915061505504953922979530901129967519, 86188088225875314529584099251203829009407770775672,\r\n\t\t\t\t\t11306739708304724483816533873502340845647058077308, 82959174767140363198008187129011875491310547126581,\r\n\t\t\t\t\t97623331044818386269515456334926366572897563400500, 42846280183517070527831839425882145521227251250327,\r\n\t\t\t\t\t55121603546981200581762165212827652751691296897789, 32238195734329339946437501907836945765883352399886,\r\n\t\t\t\t\t75506164965184775180738168837861091527357929701337, 62177842752192623401942399639168044983993173312731,\r\n\t\t\t\t\t32924185707147349566916674687634660915035914677504, 99518671430235219628894890102423325116913619626622,\r\n\t\t\t\t\t73267460800591547471830798392868535206946944540724, 76841822524674417161514036427982273348055556214818,\r\n\t\t\t\t\t97142617910342598647204516893989422179826088076852, 87783646182799346313767754307809363333018982642090,\r\n\t\t\t\t\t10848802521674670883215120185883543223812876952786, 71329612474782464538636993009049310363619763878039,\r\n\t\t\t\t\t62184073572399794223406235393808339651327408011116, 66627891981488087797941876876144230030984490851411,\r\n\t\t\t\t\t60661826293682836764744779239180335110989069790714, 85786944089552990653640447425576083659976645795096,\r\n\t\t\t\t\t66024396409905389607120198219976047599490197230297, 64913982680032973156037120041377903785566085089252,\r\n\t\t\t\t\t16730939319872750275468906903707539413042652315011, 94809377245048795150954100921645863754710598436791,\r\n\t\t\t\t\t78639167021187492431995700641917969777599028300699, 15368713711936614952811305876380278410754449733078,\r\n\t\t\t\t\t40789923115535562561142322423255033685442488917353, 44889911501440648020369068063960672322193204149535,\r\n\t\t\t\t\t41503128880339536053299340368006977710650566631954, 81234880673210146739058568557934581403627822703280,\r\n\t\t\t\t\t82616570773948327592232845941706525094512325230608, 22918802058777319719839450180888072429661980811197,\r\n\t\t\t\t\t77158542502016545090413245809786882778948721859617, 72107838435069186155435662884062257473692284509516,\r\n\t\t\t\t\t20849603980134001723930671666823555245252804609722, 53503534226472524250874054075591789781264330331690]\r\n\t# try\r\n\treturn the_wtf_num.inject(0){ |sum, i| sum + i }\r\nend",
"def numbers(n)\n\nend",
"def extraNumber(a, b, c)\n \nend",
"def separate_comma(number)\n\tnumber\nend",
"def find_unique(numbers)\n numbers.reduce(:^)\nend",
"def initialize(array)\n @number = array.collect{|num| num.to_i}\n end",
"def commify(number)\n\t\t\tc = { :value => \"\", :length => 0 }\n\t\t\tr = number.to_s.reverse.split(\"\").inject(c) do |t, e| \n\t\t\tiv, il = t[:value], t[:length]\n\t\t\tiv += ',' if il % 3 == 0 && il != 0 \n\t\t\t{ :value => iv + e, :length => il + 1 }\n\t\tend\n\t\tr[:value].reverse!\n\tend",
"def test_six\n my_number = [\"1234\", \"2234\", \"3234\"]\n bash_numbers = [\"1233\", \"2233\", \"3233\", \"2222\", \"5555\"]\n assert_equal([\"1234\", \"2234\", \"3234\"], offbyonenumber(my_number, bash_numbers))\n end",
"def lowest_number(number_list)\n number_list.map(&:to_s)\n .permutation\n .map(&:join)\n .map(&:to_i)\n .min\nend",
"def p13\n\tnumbers = [\n\t\t37107287533902102798797998220837590246510135740250,\n\t\t46376937677490009712648124896970078050417018260538,\n\t\t74324986199524741059474233309513058123726617309629,\n\t\t91942213363574161572522430563301811072406154908250,\n\t\t23067588207539346171171980310421047513778063246676,\n\t\t89261670696623633820136378418383684178734361726757,\n\t\t28112879812849979408065481931592621691275889832738,\n\t\t44274228917432520321923589422876796487670272189318,\n\t\t47451445736001306439091167216856844588711603153276,\n\t\t70386486105843025439939619828917593665686757934951,\n\t\t62176457141856560629502157223196586755079324193331,\n\t\t64906352462741904929101432445813822663347944758178,\n\t\t92575867718337217661963751590579239728245598838407,\n\t\t58203565325359399008402633568948830189458628227828,\n\t\t80181199384826282014278194139940567587151170094390,\n\t\t35398664372827112653829987240784473053190104293586,\n\t\t86515506006295864861532075273371959191420517255829,\n\t\t71693888707715466499115593487603532921714970056938,\n\t\t54370070576826684624621495650076471787294438377604,\n\t\t53282654108756828443191190634694037855217779295145,\n\t\t36123272525000296071075082563815656710885258350721,\n\t\t45876576172410976447339110607218265236877223636045,\n\t\t17423706905851860660448207621209813287860733969412,\n\t\t81142660418086830619328460811191061556940512689692,\n\t\t51934325451728388641918047049293215058642563049483,\n\t\t62467221648435076201727918039944693004732956340691,\n\t\t15732444386908125794514089057706229429197107928209,\n\t\t55037687525678773091862540744969844508330393682126,\n\t\t18336384825330154686196124348767681297534375946515,\n\t\t80386287592878490201521685554828717201219257766954,\n\t\t78182833757993103614740356856449095527097864797581,\n\t\t16726320100436897842553539920931837441497806860984,\n\t\t48403098129077791799088218795327364475675590848030,\n\t\t87086987551392711854517078544161852424320693150332,\n\t\t59959406895756536782107074926966537676326235447210,\n\t\t69793950679652694742597709739166693763042633987085,\n\t\t41052684708299085211399427365734116182760315001271,\n\t\t65378607361501080857009149939512557028198746004375,\n\t\t35829035317434717326932123578154982629742552737307,\n\t\t94953759765105305946966067683156574377167401875275,\n\t\t88902802571733229619176668713819931811048770190271,\n\t\t25267680276078003013678680992525463401061632866526,\n\t\t36270218540497705585629946580636237993140746255962,\n\t\t24074486908231174977792365466257246923322810917141,\n\t\t91430288197103288597806669760892938638285025333403,\n\t\t34413065578016127815921815005561868836468420090470,\n\t\t23053081172816430487623791969842487255036638784583,\n\t\t11487696932154902810424020138335124462181441773470,\n\t\t63783299490636259666498587618221225225512486764533,\n\t\t67720186971698544312419572409913959008952310058822,\n\t\t95548255300263520781532296796249481641953868218774,\n\t\t76085327132285723110424803456124867697064507995236,\n\t\t37774242535411291684276865538926205024910326572967,\n\t\t23701913275725675285653248258265463092207058596522,\n\t\t29798860272258331913126375147341994889534765745501,\n\t\t18495701454879288984856827726077713721403798879715,\n\t\t38298203783031473527721580348144513491373226651381,\n\t\t34829543829199918180278916522431027392251122869539,\n\t\t40957953066405232632538044100059654939159879593635,\n\t\t29746152185502371307642255121183693803580388584903,\n\t\t41698116222072977186158236678424689157993532961922,\n\t\t62467957194401269043877107275048102390895523597457,\n\t\t23189706772547915061505504953922979530901129967519,\n\t\t86188088225875314529584099251203829009407770775672,\n\t\t11306739708304724483816533873502340845647058077308,\n\t\t82959174767140363198008187129011875491310547126581,\n\t\t97623331044818386269515456334926366572897563400500,\n\t\t42846280183517070527831839425882145521227251250327,\n\t\t55121603546981200581762165212827652751691296897789,\n\t\t32238195734329339946437501907836945765883352399886,\n\t\t75506164965184775180738168837861091527357929701337,\n\t\t62177842752192623401942399639168044983993173312731,\n\t\t32924185707147349566916674687634660915035914677504,\n\t\t99518671430235219628894890102423325116913619626622,\n\t\t73267460800591547471830798392868535206946944540724,\n\t\t76841822524674417161514036427982273348055556214818,\n\t\t97142617910342598647204516893989422179826088076852,\n\t\t87783646182799346313767754307809363333018982642090,\n\t\t10848802521674670883215120185883543223812876952786,\n\t\t71329612474782464538636993009049310363619763878039,\n\t\t62184073572399794223406235393808339651327408011116,\n\t\t66627891981488087797941876876144230030984490851411,\n\t\t60661826293682836764744779239180335110989069790714,\n\t\t85786944089552990653640447425576083659976645795096,\n\t\t66024396409905389607120198219976047599490197230297,\n\t\t64913982680032973156037120041377903785566085089252,\n\t\t16730939319872750275468906903707539413042652315011,\n\t\t94809377245048795150954100921645863754710598436791,\n\t\t78639167021187492431995700641917969777599028300699,\n\t\t15368713711936614952811305876380278410754449733078,\n\t\t40789923115535562561142322423255033685442488917353,\n\t\t44889911501440648020369068063960672322193204149535,\n\t\t41503128880339536053299340368006977710650566631954,\n\t\t81234880673210146739058568557934581403627822703280,\n\t\t82616570773948327592232845941706525094512325230608,\n\t\t22918802058777319719839450180888072429661980811197,\n\t\t77158542502016545090413245809786882778948721859617,\n\t\t72107838435069186155435662884062257473692284509516,\n\t\t20849603980134001723930671666823555245252804609722,\n\t\t53503534226472524250874054075591789781264330331690,\n\t]\n\n\tsum = numbers.reduce(:+)\n\tsum.to_s[0..9].to_i\nend",
"def unique(numbers)\r\n output = []\r\n \r\n numbers.each do |num|\r\n if output.include?(num)\r\n\r\n else\r\n output.push(num)\r\n end\r\n end\r\n\r\n return output\r\nend",
"def plus_one(digits)\n num = 0\n digits.each_with_index do |digit, index|\n num = num * 10 + digit\n end\n num += 1\n ans = []\n while num > 0 do \n ans.unshift(num % 10)\n num = num / 10\n end\n ans\nend",
"def list(nth)\n result = []\n if nth > 0\n (1..nth).each do |i|\n if i > 2 \n result << result[-1] + result[-2]\n else\n result << number(i) \n end\n end\n end\n result\n end",
"def magic_numbers(count)\nend",
"def single_number(nums)\n num_hash = {}\n \n nums.each do |num|\n if num_hash[num]\n num_hash[num] += 1\n else\n num_hash[num] = 1\n end\n end\n \n num_hash.each do |num, quantity|\n if quantity == 1\n return num\n end\n end\nend",
"def single_number(nums)\n a = 0\n for i in nums\n a ^= i\n end\n a\nend",
"def interesting_number(number)\n number.each_char.map {|c| c.to_i}\n puts number\nend",
"def digit_list(number)\n # Thank you rubocop for the &:to_i syntax\n number.to_s.chars.map &:to_i\nend",
"def numbers_mand(n1,n2,n3)\n\t\t@num1 = n1\n\t\t@num2 = n2\n\t\t@num3 = n3\n\tend",
"def amicable_numbers(n)\r\n numbers = Array.new\r\n 2.upto(n) do |x|\r\n y = d(x)\r\n if !numbers.include?(y)\r\n numbers.push(x,y) if d(y) == x && y != x\r\n end\r\n end\r\n return numbers\r\nend",
"def plus_one(digits)\n arr = digits.join.to_i + 1\n arr.to_s.split(\"\").map(&:to_i)\nend",
"def get_nums_built_in(array2)\n array2.select { |el| el.is_a? Numeric }\nend",
"def commas(num)\nend",
"def test_maps_one_element\n stream = FromArray.new([1])\n strings = stream.map { |num| num.to_s }.collect\n strings.each do |val|\n assert(val.is_a?(String))\n end\n end",
"def validate_numeric_stdin(a)\n print \"\\n(use commas for multiple selections): \"\n nums = gets.chomp.split(\",\").select { |x| /\\d+/.match x }.uniq.map(&:to_i)\n nums.reject { |z| z >= a.size }\nend",
"def multiple(*nums)\n nums.inject(:*)\nend",
"def digit_list(input)\n\n new_arr = input.to_s.chars\n \n new_arr.map {|element| element = element.to_i }\nend",
"def createPhoneNumber(numbers)\n return \"(\"+numbers[0..2].join+\") \"+numbers[3..5].join+\"-\"+numbers[6..9].join \nend",
"def fancy_number(num)\n \"$\" + num.to_s.reverse.scan(/\\d{3}|.+/).join(\",\").reverse\n end",
"def single_number(nums)\n nums.sort.uniq.each do |i|\n if appears_three?(nums.sort, i)\n return i\n end\nend\nreturn -1\nend",
"def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"def get_num(a)\n 100*a[0] + 10*a[1] + a[2]\nend",
"def slippery_numbers(n)\nend",
"def interesting_number(number)\n return false if number.to_s.split(\"\").length < 3 \n number.to_s.split(\"\").sort[0] == \"0\" ? number.to_s.split(\"\").delete_at(0) && number.to_s.split(\"\").push(\"0\") : x = x\n return number.to_s.split(\"\")[0] < number.to_s.split(\"\")[-1] ? number.to_s.split(\"\").sort == number.to_s.split(\"\") || false : number.to_s.split(\"\").sort.reverse == number.to_s.split(\"\") || false\nend",
"def doubler(numbers)\n doubled_nums = []\n\n i = 0\n while i < numbers.length\n doubled_nums << numbers[i] * 2\n \n i += 1\n end\n\n return doubled_nums\nend",
"def digit_list(num)\n array = []\n \n num.to_s.each_char do |c| \n array.push(c.to_i)\n end\n array\nend",
"def single_number2(nums)\n nums.sort!\n \n i = 0\n length = nums.length\n \n while i < length\n if nums[i] != nums[i+1]\n return nums[i]\n end\n i += 2\n end \nend",
"def digit_list(number)\n number.to_s.chars.map { |char| char.to_i }\nend",
"def single_number(nums)\n ones = 0\n twos = 0\n nums.each do |n|\n ones = (ones^n)&(~twos)\n twos = (twos^n)&(~ones)\n end\n\n ones\nend",
"def three_numbers(str)\n digits = str.split.map { |word| word.scan(/\\d+/).sort_by(&:size) }\n digits.each do |set|\n if set.size == 2 && set.first.size == 1 && set.last.size == 2\n set[1], set[2] = set.last[0], set.last[1]\n end\n set.map!(&:to_i).uniq!\n return false unless set.size == 3\n end\n true\nend",
"def split_problem_number_into_letter_and_number(x)\n if x.to_i>0 then return ['',x.to_i] end # for efficiency\n if x=~/([a-z]*)([0-9]+)/ then\n return [$1,$2.to_i]\n else\n fatal_error(\"illegal problem number, #{x}\")\n end\nend",
"def digit_list(number)\n list = number.to_s.split('')\n list.map{ |item| item.to_i }\nend",
"def triple_double(num1,num2)\n numbers = num1.to_s.scan(/(\\d)\\1\\1/)\n return 0 if numbers.empty?\n numbers.flatten!.map! { |i| num2.to_s.scan(/#{i}{2}/) }\n numbers.flatten.empty? ? 0 : 1\nend",
"def digit_list(number)\n digits = number.to_s.split('')\n digits = digits.map { |digit| digit.to_i }\n digits\nend",
"def createPhoneNumber(numbers)\n \n #join to string and split to array \n numbers = numbers.join.split(\"\")\n \n #create 3 empty arrays\n array_one = []\n array_two = []\n array_three = []\n \n #push to new arrays - index position 0-2 to new array, 3-5 same and 6-9 same\n array_one.push(numbers[0..2])\n array_two.push(numbers[3..5])\n array_three.push(numbers[6..9])\n \n #join each array\n array_one = array_one.join(\"\")\n array_two = array_two.join(\"\")\n array_three = array_three.join(\"\")\n \n #bring together\n \"(#{array_one}) #{array_two}-#{array_three}\"\n \nend",
"def single_number(nums)\n if nums.empty?\n return 0\n end\n\n num = nums[0]\n\n for i in 1..nums.length-1\n num = num^nums[i]\n end\n\n return num\nend",
"def aliquot_sequence(num)\n return [0] if num == 0\n return [1, 0] if num == 1\n [num] + aliquot_sequence(aliquot(num))\nend",
"def plus_one(a)\n return nil if a.empty?\n i = a.length - 1\n while i >= 0\n if a[i] < 9 \n a[i] = a[i] + 1 \n return a\n else\n # case 199, 49\n a[i] = 0\n i -= 1\n end\n end\n # for case 999\n result = Array.new(a.length, 0)\n result.unshift(1)\nend",
"def combine_multiple_numbers\n if [:number, :ordinal].all? {|type| token_types.include? type}\n number = token_of_type(:number)\n ordinal = token_of_type(:ordinal)\n combined_value = (number.start.to_s[0] + ordinal.start.to_s)\n new_number_token = Token.new(combined_value, combined_value, :ordinal, combined_value, 365)\n @tokens.reject! {|token| (token.type == :number || token.type == :ordinal)}\n @tokens << new_number_token\n end\n end",
"def secret_numbers\n\t\t(1..5).to_a \n\tend",
"def test_math_val_isbn\n\t \tassert_equal(true, mathpart([\"0\",\"4\",\"7\",\"1\",\"9\",\"5\",\"8\",\"6\",\"9\",\"7\"]))\n end",
"def separate_comma(number)\n comma_separated_number = number.to_s.reverse.split('').each_slice(3).map {|obj| obj.push(\",\") }.join.chop.reverse\nend",
"def slippery_numbers(n)\n num = 1\n result = []\n while result.length < n\n result << num if is_slippery?(num)\n num += 1\n end\n result\nend",
"def lowest_number(number_list)\n number_list.map(&:to_s).sort.join('').to_i\nend",
"def missing_numbers(input)\n input.sort!\n p (input[0]..input[-1]).to_a - input\nend",
"def sample_l\n format_num(l,2)\n end",
"def createPhoneNumber(numbers)\n result = []\n while numbers.count > 4\n result << numbers.take(3)\n numbers = numbers.drop(3)\n end\n result << numbers\n return \"(#{ result[0].join }) #{ result[1].join }-#{ result[2].join }\"\nend",
"def unused_digits(*a)\n numbers = [*a].join.split(\"\")\n digits_left = (0..9).to_a\n\n digits_left.length.times do |num|\n if numbers.include?(num.to_s) == true\n digits_left.delete(num)\n end\n end\n\n return digits_left.join\n\nend",
"def product(numbers)\n if numbers.length > 0\n # inject pushes a character into every position of an\n # array, in this case multiplying each integer by the next\n numbers.inject(:*)\nelse\n return 1\nend\nend"
] |
[
"0.7285275",
"0.65919673",
"0.6521219",
"0.64225745",
"0.6253436",
"0.6211811",
"0.61699307",
"0.6069327",
"0.6022176",
"0.600738",
"0.60004574",
"0.59475034",
"0.5937772",
"0.5903997",
"0.59025484",
"0.5884195",
"0.58220994",
"0.58032167",
"0.5802783",
"0.5797271",
"0.5792728",
"0.57858413",
"0.57795376",
"0.5776017",
"0.5747569",
"0.5736016",
"0.5733898",
"0.5716404",
"0.5708697",
"0.5684283",
"0.5650441",
"0.5632244",
"0.5625279",
"0.5625279",
"0.56243485",
"0.56178015",
"0.5611463",
"0.5601589",
"0.5583865",
"0.55755705",
"0.5570803",
"0.5568726",
"0.55676067",
"0.55657554",
"0.55626607",
"0.5554313",
"0.5546354",
"0.5538496",
"0.5538472",
"0.5537339",
"0.553548",
"0.55336875",
"0.5530296",
"0.55253804",
"0.55141777",
"0.5511956",
"0.55032307",
"0.5483449",
"0.54784656",
"0.5469672",
"0.5467959",
"0.54640394",
"0.54539984",
"0.5453697",
"0.54515034",
"0.5449839",
"0.5449312",
"0.5447051",
"0.5447051",
"0.5447051",
"0.5447051",
"0.5447051",
"0.5440765",
"0.5440241",
"0.54372925",
"0.543412",
"0.54305357",
"0.542695",
"0.5425861",
"0.54225993",
"0.5422335",
"0.54164046",
"0.5408275",
"0.5407976",
"0.54061776",
"0.54045945",
"0.5402317",
"0.53987896",
"0.5398034",
"0.5378876",
"0.537451",
"0.53744316",
"0.53701776",
"0.5369707",
"0.5369688",
"0.5368388",
"0.5368366",
"0.53671193",
"0.5365984",
"0.5364125"
] |
0.55491036
|
46
|
def bitwise_and(num1, num2) puts "num1 = " + num1.to_s(2) puts "num2 = " + num2.to_s(2) puts "base 10 & = " + (num1 & num2).to_s(10) puts "base 2 & = " + (num1 & num2).to_s(2) end
|
def bitwise_and(num1, num2)
bnum1 = num1.to_s(2)
bnum2 = num2.to_s(2)
band = (num1 & num2).to_s(2)
puts "num1 = " + ( ' ' * bnum2.length ) + num1.to_s(2)
puts "num2 = " + ( ' ' * bnum1.length ) + num2.to_s(2)
puts "b2& = " + ( ' ' * ([bnum1.length, bnum2.length].max ) + band)
# puts "base 10 & = " + (num1 & num2).to_s(10)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def bitwise_and(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == b[index]\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend",
"def bitwise_xor(num1, num2)\n bnum1 = num1.to_s(2)\n bnum2 = num2.to_s(2)\n band = (num1 | num2).to_s(2)\n puts \"num1 = \" + ( ' ' * bnum2.length ) + num1.to_s(2)\n puts \"num2 = \" + ( ' ' * bnum1.length ) + num2.to_s(2)\n puts \"b|& = \" + ( ' ' * ([bnum1.length, bnum2.length].min ) + band)\nend",
"def bitwise_or(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == '1' || b[index] == '1'\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend",
"def AND(x,y); \tif x==1 && y==1 \tthen 1 else 0 end; end",
"def add_binary(a,b)\n (a+b).to_s(2)\n\n # \"%b\" % (a+b)\nend",
"def op_and(t_sym, f_sym, num)\n chars = num.split('')\n is_false = 0\n chars.each do |c|\n if c == \"0\"\n is_false = 1\n break\n end\n end\n if is_false == 0\n return t_sym\n else\n return f_sym\n end\nend",
"def bitSetAnd (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] && b[i]\n\t\tend\n\t\treturn result\n\tend",
"def and_ a, b\n self.and a, b\n end",
"def add_binary(a, b)\n (a + b).to_s(2)\nend",
"def add_binary(a,b)\n sum = (a+b).to_s(2)\nend",
"def bitwise_exclusive(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif (val == '1' && b[index] == '0') || (val == '0' && b[index] == '1')\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend",
"def BitwiseTwo(strArr)\n result = strArr[0].to_i(2) & strArr[1].to_i(2)\n format(\"%0#{strArr[0].size}b\", result)\nend",
"def bit_add(a, b)\n\t(7).downto(0).each do |x|\n\tend\nend",
"def add_binary(a,b)\n #your code here\n binary = a + b\n binary.to_s(2) # Convert um inteiro para string na base 2(base binária)\nend",
"def add_binary(a,b)\n total = a+b\n total.to_s(2)\nend",
"def add_binary(a,b)\n string = (a + b).to_s(2)\nend",
"def And(a, b)\n return a && b\nend",
"def and(e1, e2)\n eval_ex(e1) & eval_ex(e2)\n end",
"def process_and(exp)\n lhs = process exp.shift\n rhs = process exp.shift\n\n return \"#{lhs} && #{rhs}\"\n end",
"def binary_integer_addition(b1, b2)\n\tr = []\n\tcarry = 0\n\t(b1.length-1).downto(0).each { |i|\n\t\tif b1[i] + b2[i] == 0\n\t\t\tr << 0 + carry\n\t\t\tcarry = 0\n\t\telsif b1[i] + b2[i] == 1\n\t\t\tcarry == 0 ? r << 1 : (r << 0; carry = 1)\n\t\telsif b1[i] + b2[i] == 2\n\t\t\tcarry == 0 ? r << 0 : r << 1\n\t\t\tcarry = 1\n\t\tend\n\t}\n\tif carry == 1\n\t\tr << 1\n\tend\n\tr.reverse\nend",
"def logical_and(input_a, input_b, name: nil)\n check_data_types(input_a, input_b)\n _op(:logical_and, input_a, input_b, name: name)\n end",
"def and\n x, y = stack.pop(2)\n push x & y\n end",
"def logical_and(input_a, input_b, name: nil)\n input_a, input_b = check_data_types(input_a, input_b)\n _op(:logical_and, input_a, input_b, name: name)\n end",
"def &(expr2)\n Operator.new(S_AND, self, expr2)\n end",
"def add_binary(a,b)\n #your code here\n sum = a + b\n return sum.to_s(2)\nend",
"def sum_of_2int a, b\n (b == 0) ? a : (sum_of_2int (a^b),((a&b)<< 1))\nend",
"def evenNumber(number)\n # AND the last bit, resultant are \n # Odd is 1 and even is 0\n # Then XOR the result so that it returns 1 for even and 0 for odd\n return (number & 1) ^ 1 \nend",
"def intersection(nums1, nums2)\n nums1 & nums2\n end",
"def solution(n)\n n & 15\nend",
"def is_power_of_2?(n)\n return (n & (n-1)) == 0 # can be written as \"n & (n-1) == 0\" as well. Parenthesis added for clarity.\nend",
"def carry_out (p,q)\n p & q\nend",
"def mask(a, b)\n a ^ b\n end",
"def handle_bit (num)\n num2str=''\n num2str+=NUM_MAP[num]\n return num2str\nend",
"def bitsEqual?(n, b1, b2)\n bits = n.to_s(2).reverse\n return bits[b1 - 1] == bits[b2 - 1]\nend",
"def BitwiseOne(strArr)\n first = strArr[0]\n second = strArr[1]\n third = \"\"\n \n i = 0 \n while i < first.length\n # When i change this line to first[i] == \"0\" &&\n # second[i] == \"0\"\n # all tests passes. Why????????????????????????\n if first[i] == second[i]\n \t third << \"0\"\n else\n \t third << \"1\"\n end\n \n i += 1\n end\n third \nend",
"def and_b\n end",
"def bitSwapRequired(a, b)\n\tcount = 0\n\t(a ^ b).to_s(2).split('').each do |x|\n\t\tcount += 1 if x == '1'\n\tend\n\tputs count\nend",
"def power_of_two?(x)\n x > 0 && x & (x - 1) == 0\nend",
"def & other\n call_enum \"boolean\", other, :and\n end",
"def pushBit bit1, bit2\n\t\t# Round inputs to 0/1 just in case\n\t\tbit1, bit2 = bit1.round.to_i, bit2.round.to_i\n\t\t##\n\t\t# Bit selection : [0, 0] = 0, [1, 0] or [0, 1] = [0, 1], [1, 1] = carry the 1\n\t\t##\n\t\t# when [1, 1]\n\t\tif bit1 == 1 && bit2 == 1\n\t\t\tif @carrying\n\t\t\t\t@bits\t= [1].concat @bits\n\t\t\telse\n\t\t\t\t@carrying \t= true\n\t\t\t\t@bits\t\t= [0].concat @bits\n\t\t\tend\n\t\t# when [0, 1] or [1, 0]\n\t\telsif bit1 == 1 || bit2 == 1\n\t\t\tif @carrying\n\t\t\t\t@bits\t= [0].concat @bits\n\t\t\telse\n\t\t\t\t@bits\t= [1].concat @bits\n\t\t\tend\n\t\t# when [0, 0]\n\t\telse\n\t\t\tif @carrying\n\t\t\t\t@bits\t= [1].concat @bits\n\t\t\t\t@carrying = false\n\t\t\telse\n\t\t\t\t@bits\t\t= [0].concat @bits\n\t\t\tend\n\t\tend\n\tend",
"def OF_CHECKING(a,b,sum) \n\tAND(XOR(sum,a),NOT(XOR(a,b)))\nend",
"def BitwiseOne(strArr)\n result = \"\"\n first = strArr[0]\n second = strArr[1]\n idx = 0\n\n while idx < strArr[0].length\n if first[idx] == \"0\" && second[idx] == \"0\"\n result << \"0\"\n else\n result << \"1\"\n end\n idx += 1\n end\n\n result\nend",
"def and_n\n value = next_byte\n and_to_a value\n @clock += 2\n end",
"def xor(a,b)\n (a | b) - (a & b)\n end",
"def exclusive_or(num1, num2)\r\n\t# your code here\r\nend",
"def to_bits(base10_num)\n bits = @bit_vals.map do |b|\n if base10_num >= b\n base10_num -= b\n '1'\n else\n '0'\n end\n end\n bits.join\n end",
"def hex_XOR(hex1, hex2)\n bin1 = hexToBin(hex1)\n bin2 = hexToBin(hex2)\n \n #XOR result in binary\n xorBin = \"\"\n \n for i in 0..bin1.length-1 do\n xorBitResult = bin1[i].to_i ^ bin2[i].to_i\n xorBin.concat(xorBitResult.to_s)\n end\n \n return binToHex(xorBin)\nend",
"def stringy(num, bit = 1)\n bin_arr = []\n num.times { |n| n.even? ? bin_arr << (0 + bit) : bin_arr << (1 - bit) }\n bin_arr.join\nend",
"def add_binary a, b\n return_arr = con_to_binary(a + b)\n return_arr.shift if return_arr[0] == \"0\"\n return_arr.join\nend",
"def from_binary(n)\n# puts \"\\n\\n#{n} => #{n && n!=0}\\n\\n\"\n n && n!=0\nend",
"def from_binary(n)\n# puts \"\\n\\n#{n} => #{n && n!=0}\\n\\n\"\n n && n!=0\nend",
"def bandand\n bandbool :and\n end",
"def bit_and\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 53 )\n return_value = BitAndReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal241 = nil\n equality240 = nil\n equality242 = nil\n\n tree_for_char_literal241 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 597:5: equality ( '&' equality )*\n @state.following.push( TOKENS_FOLLOWING_equality_IN_bit_and_3943 )\n equality240 = equality\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, equality240.tree )\n end\n # at line 597:14: ( '&' equality )*\n while true # decision 56\n alt_56 = 2\n look_56_0 = @input.peek( 1 )\n\n if ( look_56_0 == AMP )\n alt_56 = 1\n\n end\n case alt_56\n when 1\n # at line 597:17: '&' equality\n char_literal241 = match( AMP, TOKENS_FOLLOWING_AMP_IN_bit_and_3948 )\n if @state.backtracking == 0\n\n tree_for_char_literal241 = @adaptor.create_with_payload( char_literal241 )\n root_0 = @adaptor.become_root( tree_for_char_literal241, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_equality_IN_bit_and_3952 )\n equality242 = equality\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, equality242.tree )\n end\n\n else\n break # out of loop for decision 56\n end\n end # loop for decision 56\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 53 )\n\n end\n \n return return_value\n end",
"def execute_AND(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value &= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend",
"def xor?(num1, num2)\n (num1 && num2) || (!num2 && !num1) ? false : true\nend",
"def power_of_two?(n)\n n & (n-1) == 0\nend",
"def bit_odd?(n)\n n&1 == 1\nend",
"def power(num1, num2)\n return num1**num2\nend",
"def power(num1, num2)\n return num1**num2\nend",
"def power_of_two?(num)\n\nend",
"def power_of_2?(n)\n n & (n - 1) == 0\nend",
"def power_of_two?(num)\n product = 1\n while product < num\n product *= 2\n end\n\n num == product\nend",
"def calc(n,k)\n # the expressions '(1<<n)-1' and '2**n-1' are equivalent\n (k & ((1<<n)-1)) == 2**n-1\nend",
"def Bitwise(arr)\n output_num = ''\n arr[0].split(//).each_with_index {|char,idx| char == arr[1][idx] ? output_num << '0' : output_num << '1'}\n output_num.to_i\nend",
"def add_binary(a,b)\n return nil if( a.nil? && b.nil?)\n return a if( b.nil? || b.empty?)\n return b if( a.nil? || a.empty?)\n a_n = a.size\n b_n = b.size\n i = 0\n carry = 0\n result = ''\n while(i < a_n || i < b_n)\n if i >= a_n\n a_i = 0\n b_i = b[b_n - i -1].to_i\n elsif i >= b_n\n b_i = 0\n a_i = a[a_n - i - 1].to_i\n else\n b_i = b[b_n - i -1].to_i\n a_i = a[a_n - i - 1].to_i\n end\n add = a_i + b_i + carry\n result.prepend(add == 0 ? '0' : '1')\n carry = add < 2 ? 0 : 1\n i = i + 1\n end\n result.prepend('1') if carry == 1\n return result\nend",
"def intersect(other)\n @bits & bits_from_object(other)\n end",
"def word16(a, b)\n (a << 8) | b\n end",
"def set?(num, mask)\n (num & mask) != 0\nend",
"def power_of_two?(num)\n product = 1\n\n while product < num \n product *= 2\n end \n\n product == num \nend",
"def is_binary_base?(num)\n binarify(num).count('1') == 1\nend",
"def both(left, right)\n \"#{quotify left} AND #{quotify right}\"\n end",
"def share?(num1,num2)\n num1_array = num1.to_s.split(\"\")\n num2_array = num2.to_s.split(\"\")\n num1_array.any? {|digit| num2_array.include?(digit)} == true ? \"YES\" : \"FALSE\"\nend",
"def power_it(number_1, number_2)\n number_1 ** number_2\nend",
"def add(a,b)\n ret1 = a + b\n ret = ret1 & 0xff\n self[0xF] = (ret1!=ret)?1:0\n ret\n end",
"def on_and(ast_node, context)\n left, right = *ast_node\n\n return on_call_boolean(context, left) && on_call_boolean(context, right)\n end",
"def binary(num)\n if num < 0\n positiveNumBinary = calculate_binary(num.abs, 'negative')\n else\n return calculate_binary(num, 'positive')\n end\n\nend",
"def bits(integer)\n number = integer.to_s(2)\n count = number.count('1')\n puts(number)\n return count\nend",
"def ALU1BIT(a,b,cin,binv,op1,op2) \n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\t#Send out an array pair of result, cout\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1]\nend",
"def and\n self\n end",
"def compose_and(first_condition, second_condition)\n validate_condition(first_condition)\n validate_condition(second_condition)\n first_condition.and(second_condition)\n end",
"def print_n_and_n_plus1(n)\n\tputs \"#{n} and #{n+1}\"\nend",
"def exponent_plus(num1, num2)\n total = (num1 ** 2) + num2\n return total\nend",
"def single_number(nums)\n ones = 0\n twos = 0\n nums.each do |n|\n ones = (ones^n)&(~twos)\n twos = (twos^n)&(~ones)\n end\n\n ones\nend",
"def num_check(num_one,num_two)\n num_one.to_i.to_s == num_one &&num_two.to_i.to_s == num_two || num_one.to_f.to_s == num_one &&num_two.to_f.to_s == num_two\nend",
"def ADDER(a,b,cin)\n\treturn XOR(XOR(a,b),cin) , OR(AND(a,b),AND(cin,XOR(a,b)))\nend",
"def bitnot(b)\n (~b)&1\nend",
"def q7_1_and_0(num)\n str_out = ''\n num.times {|num_here|\n num_here.even? ? str_out += '1' : str_out += '0'\n }\n str_out\nend",
"def to_binary(num)\n num_bin = ''\n current_power_of_2 = 1\n \n loop do\n num_bin.prepend ((num % (current_power_of_2 * 2)) / current_power_of_2).to_s\n \n break if num < current_power_of_2 * 2\n current_power_of_2 *= 2\n end\n \n num_bin.to_i\n end",
"def xor?(num1,num2)\n if num1 == true && num2 == false\n return true\n elsif num1 == false && num2 == true\n return true\n else\n return false\n end\nend",
"def and_op(left, right, result) #method\n left = get_dir(left)\n right = get_dir(right)\n @current_context[result] = get_value(left) && get_value(right)\n end",
"def power(n1, n2)\n return n1**n2\nend",
"def _reduce_58(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend",
"def and_d8\n end",
"def powersOfTwo(num)\n\treturn false if(num % 2 != 0)\n\treturn true if( num / 2 == 1)\n\tpowersOfTwo(num / 2)\n\nend",
"def xor?(input1, input2)\n if input1 && input2\n false\n elsif \n input1 || input2\n true\n else \n false\n end \nend",
"def and(other)\n self\n end",
"def andand(*)\n self\n end",
"def and_to_a(to_and)\n @a &= to_and\n @f = 0x00\n @f |= H_FLAG\n @f |= Z_FLAG if @a == 0x00\n end",
"def addEncoded(char1, char2)\n char1 ^ char2\n end",
"def op_nand(t_sym, f_sym, num_and)\n if num_and == t_sym\n return f_sym\n elsif num_and == f_sym\n return t_sym\n end\nend"
] |
[
"0.78859276",
"0.7717622",
"0.66721344",
"0.6488093",
"0.6440578",
"0.63982505",
"0.6397612",
"0.6263405",
"0.6255527",
"0.6242118",
"0.62236214",
"0.6220425",
"0.62080175",
"0.61478835",
"0.611702",
"0.6105664",
"0.61038685",
"0.6096713",
"0.60895616",
"0.6038395",
"0.6008035",
"0.6004856",
"0.5980135",
"0.59581155",
"0.5957393",
"0.59522563",
"0.5938532",
"0.5893996",
"0.5891724",
"0.58673954",
"0.58477557",
"0.5836705",
"0.58364",
"0.58295476",
"0.5829476",
"0.582381",
"0.5818732",
"0.5818438",
"0.580595",
"0.5797407",
"0.5782395",
"0.5764997",
"0.57435423",
"0.5720944",
"0.57177585",
"0.5714842",
"0.5697627",
"0.5697058",
"0.567629",
"0.5660187",
"0.5660187",
"0.5653935",
"0.56537",
"0.565232",
"0.56467175",
"0.5645686",
"0.56327486",
"0.56271327",
"0.56271327",
"0.56173044",
"0.5589782",
"0.5586631",
"0.5585527",
"0.55574805",
"0.55558205",
"0.5547039",
"0.5527126",
"0.55265665",
"0.5505159",
"0.5501114",
"0.54960966",
"0.5495386",
"0.5484217",
"0.5481621",
"0.54772633",
"0.54682916",
"0.5460002",
"0.54462427",
"0.54444563",
"0.5437691",
"0.5437023",
"0.543237",
"0.54260415",
"0.5424127",
"0.54203194",
"0.5419127",
"0.54169804",
"0.5409414",
"0.5407952",
"0.54063594",
"0.5404121",
"0.5400176",
"0.53792673",
"0.53699815",
"0.53620976",
"0.5360596",
"0.5356561",
"0.53549993",
"0.5349202",
"0.5343643"
] |
0.937498
|
0
|
bitwise_not(num1) 01101010101 01010111011 00111101110
|
def bitwise_xor(num1, num2)
bnum1 = num1.to_s(2)
bnum2 = num2.to_s(2)
band = (num1 | num2).to_s(2)
puts "num1 = " + ( ' ' * bnum2.length ) + num1.to_s(2)
puts "num2 = " + ( ' ' * bnum1.length ) + num2.to_s(2)
puts "b|& = " + ( ' ' * ([bnum1.length, bnum2.length].min ) + band)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def bitnot(b)\n (~b)&1\nend",
"def not\n ~@bits\n end",
"def bitwise_not(a)\n\tresult = ''\n\ta.each_char do |val|\n\t\tif val == '1' \n\t\t\tresult.concat '0'\n\t\telse\n\t\t\tresult.concat '1'\n\t\tend\n\tend\n\treturn result\nend",
"def xor(a,b)\n (a | b) - (a & b)\n end",
"def unsigned_not(int)\r\n bits = int.bit_length\r\n bits = (bits / 4.0).ceil.to_i * 4 # round to nearest half-byte\r\n mask = (1 << bits) - 1\r\n return mask - int\r\n end",
"def find_complement(num)\n result = 0\n\n num_bits = num.to_s(2).chars.map(&:to_i) # Convert to binary (base 2) and map to integers\n\n num_bits.reverse.each_with_index do |n, idx|\n n = n == 0 ? 1 : 0\n result += 2 ** idx * (n) # Convert to base 10\n end\n\n result\nend",
"def bitwise_exclusive(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif (val == '1' && b[index] == '0') || (val == '0' && b[index] == '1')\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\n\tend\n\treturn result\nend",
"def mask(a, b)\n a ^ b\n end",
"def xor?(num1, num2)\n (num1 && num2) || (!num2 && !num1) ? false : true\nend",
"def not(e)\n ((1 << 64) - 1) & (~eval_ex(e))\n end",
"def complement(bit)\n bit.succ % 2\n end",
"def filter_numeric(num)\n num if (0x00..0xFF).include?(num)\n end",
"def xor(other)\n @bits ^ bits_from_object(other)\n end",
"def execute_NOT(operand)\n\t\t# no flags affected\n\t\toperand.value = ~operand.value\n\tend",
"def bitwise_and(num1, num2)\n bnum1 = num1.to_s(2)\n bnum2 = num2.to_s(2)\n band = (num1 & num2).to_s(2)\n puts \"num1 = \" + ( ' ' * bnum2.length ) + num1.to_s(2)\n puts \"num2 = \" + ( ' ' * bnum1.length ) + num2.to_s(2)\n puts \"b2& = \" + ( ' ' * ([bnum1.length, bnum2.length].max ) + band)\n # puts \"base 10 & = \" + (num1 & num2).to_s(10)\nend",
"def xor?(num1,num2)\n if num1 == true && num2 == false\n return true\n elsif num1 == false && num2 == true\n return true\n else\n return false\n end\nend",
"def ~\n UnaryOperator.new(:not, self)\n end",
"def from_binary(n)\n# puts \"\\n\\n#{n} => #{n && n!=0}\\n\\n\"\n n && n!=0\nend",
"def from_binary(n)\n# puts \"\\n\\n#{n} => #{n && n!=0}\\n\\n\"\n n && n!=0\nend",
"def res(n)\r\n p ~(4 >> 1)\r\nend",
"def flip(num)\n num ^ (2**32-1)\nend",
"def xor?(num1, num2)\n\n # If num1 is true and num2 is false, we're still going to return true\n return true if num1 && !num2\n # If num2 is true and num1 is false, we're still going to return true\n return true if num2 && !num1\nend",
"def xor(argument1, argument2)\n argument1 && !argument2 || !argument1 && argument2\n end",
"def hex_XOR(hex1, hex2)\n bin1 = hexToBin(hex1)\n bin2 = hexToBin(hex2)\n \n #XOR result in binary\n xorBin = \"\"\n \n for i in 0..bin1.length-1 do\n xorBitResult = bin1[i].to_i ^ bin2[i].to_i\n xorBin.concat(xorBitResult.to_s)\n end\n \n return binToHex(xorBin)\nend",
"def neg(num)\n val = Convert(num, :numeric)\n sub(Convert(0, val.type), val)\n end",
"def _not(memory)\n Memory::Value.bool !@left_operand.value\n end",
"def not_in_place(min_bit, max_bit)\n # make sure that we have room for maxBit\n grow_to_include(max_bit)\n i = min_bit\n while i <= max_bit\n n = word_number(i)\n @bits[n] ^= bit_mask(i)\n i += 1\n end\n end",
"def missing_number(nums)\n missing = nums.size\n nums.each_with_index do |num, index|\n missing ^= index ^ num\n end\n missing\nend",
"def single_number(nums)\n ones = 0\n twos = 0\n nums.each do |n|\n ones = (ones^n)&(~twos)\n twos = (twos^n)&(~ones)\n end\n\n ones\nend",
"def bitSwapRequired(a, b)\n\tcount = 0\n\t(a ^ b).to_s(2).split('').each do |x|\n\t\tcount += 1 if x == '1'\n\tend\n\tputs count\nend",
"def inv_xor(str1, str2)\n #result = ''\n #for i in 0..(str1.size - 1) do\n # result += mod_sub(str1[i].chr, str2[i].chr)\n #end\n #result\n\n # Probably slower than above:\n str1.split(//).zip(str2.split(//)).inject('') do |acc, ch| \n acc += mod_sub(ch.first, ch.last) \n end\n end",
"def op_xor(t_sym, f_sym, num)\n chars = num.split('')\n num_of_trues = 0\n chars.each do |c|\n if c == \"1\"\n num_of_trues += 1\n end\n end\n\n if num_of_trues.to_i.even?\n return f_sym\n else\n return t_sym\n end\nend",
"def fixedXOR(a = 0x1c0111001f010100061a024b53535009181c, b = 0x686974207468652062756c6c277320657965)\n if a.to_s(16).length == b.to_s(16).length\n res = a ^ b\n else\n # TODO: raise error\n res = 0\n puts \"error: diff size arguments\"\n end\n res\nend",
"def xor_b\n end",
"def xor_missing_element array1, array2\n return nil if array1.length == 0 && array2.length == 0\n result = 0\n (array1 + array2).each do |number|\n result ^= number\n end\n return result\nend",
"def xor_hex(a, b)\n raise \"Unequal buffers passed.\" if a.length != b.length\n (a.hex ^ b.hex).to_s(16)\nend",
"def not\n x = pop\n\n push x.respond_to?(:~) ? ~x : !x\n end",
"def single_number(nums)\n a = 0\n for i in nums\n a ^= i\n end\n a\nend",
"def evenNumber(number)\n # AND the last bit, resultant are \n # Odd is 1 and even is 0\n # Then XOR the result so that it returns 1 for even and 0 for odd\n return (number & 1) ^ 1 \nend",
"def ~()\n newval = (~ @value) & self.mask\n bounded? ? self.class.new(newval, @length) : self.class.new(newval)\n end",
"def opposite(number)\n number*-1\nend",
"def xor(first, second)\n first.bytes.zip(second.bytes).map{ |(a,b)| (a ^ b).chr }.join('')\n end",
"def xor?(value1, value2)\n (value1 && !value2) || (value2 && !value1)\nend",
"def xor?(value1, value2)\n (value1 && !value2) || (value2 && !value1)\nend",
"def missing_num a\n for i in 0...a.length\n return i if (i ^ a[i] != 0)\n end\nend",
"def bit_xor(x, bits)\n bits.map{|b| x[b]}.reduce(:^)\n end",
"def MUX2X1(x,y) XOR(x,y); end",
"def not_r(idx)\n fail unless 2 <= idx and idx <= 13\n r = Reg.new(idx)\n tmp = Reg.new(idx + 1)\n # r = r & -r\n alu32to(:-, 0, r, tmp)\n alu32to(:&, r, tmp, r)\n # r %= 3\n alu32to(:/, r, 3, tmp)\n alu32to(:*, tmp, 3, tmp)\n alu32to(:-, r, tmp, r)\n # r = (2 ^ r) / 2\n alu32to(:^, 2, r, r)\n alu32to(:>>, r, 1, r)\nend",
"def opposite num\n -num\n end",
"def opposite(number)\n return 0 - number\nend",
"def ^(value)\n value = _arg2int(value)\n value &= self.mask if (bounded?)\n bs = dup\n bs.from_i(value ^ bs.to_i)\n bs\n end",
"def bitsEqual?(n, b1, b2)\n bits = n.to_s(2).reverse\n return bits[b1 - 1] == bits[b2 - 1]\nend",
"def xor?(value1, value2)\n !!((value1 && !value2) || (value2 && !value1))\nend",
"def bits_to_mask(nm)\n\t\treturn(0) if (nm == 0)\n\t\tm = 2**32-1\n\t\treturn( m ^ (m >> nm) )\n\tend",
"def bits_to_mask(nm)\n\t\treturn(0) if (nm == 0)\n\t\tm = 2**32-1\n\t\treturn( m ^ (m >> nm) )\n\tend",
"def single_number(nums)\n sum = 0\n nums.each do |num|\n sum ^= num\n end\n\n sum\nend",
"def -(other)\n self & other.complement\n end",
"def clearBitsIthrough0(num, i)\n mask = -1 << i\n mask & num\n end",
"def xor_hex(hex1, hex2)\n s1b = hex_to_bytes(hex1)\n s2b = hex_to_bytes(hex2)\n xor_bytes(s1b, s2b)\nend",
"def xor?(a,b)\n if a && !b\n true\n elsif !a && b\n true\n else\n false\n end\nend",
"def exclude(num)\n return true if !filled? && @possible.delete(num)\n\n false\n end",
"def exclude(num)\n return true if !filled? && @possible.delete(num)\n false\n end",
"def xor?(one, two)\n (one && !two) || (two && !one)\nend",
"def xor?(value1, value2)\n return true if value1 && !value2\n return true if value2 && !value1\n false\nend",
"def xor?(x, y)\n (x || !y) || (y && !x)\nend",
"def xor?(this, that)\n (!this && that) || (this && !that)\nend",
"def xor?(value1, value2)\n (value1 || value2) && !(value1 && value2)\nend",
"def xor_bytes(bytes1, bytes2)\n results_in_bytes = (0...bytes1.length).map { |i| bytes1[i] ^ bytes2[i] }\n bytes_to_hex(results_in_bytes)\nend",
"def single_number2(nums)\n nums.reduce do |collect, num|\n collect ^= num\n end\nend",
"def xor_strings(str1, str2)\n decoded_and_xor = str1.hex ^ str2.hex\n decoded_and_xor.to_s(16)\n end",
"def secure_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\tputs l.class\n\n res = 0\n b.each_byte do |byte| \n\t k = l.shift\n\t res |= byte ^ k\n\t puts \"#{byte}-#{k}-#{res}\"\n\tend\n\tputs res\n res == 0\n end",
"def xor?(value1, value2)\n return true if value1 && !value2\n return true if value2 && !value1\n\n false\nend",
"def opposite(number)\r\n return number * (-1)\r\nend",
"def xor(x, y)\n\nend",
"def xor?(arg1, arg2)\n if !!arg1 == !!arg2\n false\n else\n true\n end \nend",
"def xor?(first, second)\n (first && !second) || (!first && second)\nend",
"def reverse_bits(num)\n num.to_s(2).rjust(32, '0').reverse.to_i(2)\nend",
"def xor?(one, two)\n return true if one && !two\n return true if two && !one\n\n false\nend",
"def not_in_place(max_bit)\n not_in_place(0, max_bit)\n end",
"def drop_trailing_zero(num)\n i, f = num.to_i, num.to_f\n i == f ? i : f\n end",
"def drop_trailing_zero(num)\n i, f = num.to_i, num.to_f\n i == f ? i : f\n end",
"def str_xor(s1, s2)\n if s1.length != s2.length:\n minlen = [s1, s2].map(&:length).min\n s1 = s1[0...minlen]\n s2 = s2[0...minlen]\n end\n s1.bytes.zip(s2.bytes).map{ |b1, b2| b1 ^ b2 }.map(&:chr).join\nend",
"def remove_odd oddNumb\n\n\toddNumb.delete_if &:odd?\nend",
"def complement!\n raise RuntimeError, \"Data is not valid Binary: #{self}\" unless self.is_bitstring?\n complement = \"\"\n\n self.each_byte do |char|\n complement << ((char.chr == \"0\") ? \"1\" : \"0\")\n end\n\n self.replace(complement)\n end",
"def xor?(arg1, arg2)\r\n (arg1 && !arg2) || (arg2 && !arg1)\r\nend",
"def diminished_radix_complement(int)\n if int > UID_MAX\n int - UINT\n else\n int\n end\n end",
"def xor?(one, two)\n if one && two\n false\n elsif one || two\n true\n else\n false\n end\nend",
"def xor_a\n end",
"def bit_odd?(n)\n n&1 == 1\nend",
"def ^ other\n left = uniq\n right = []\n other.uniq.each do |x|\n if left.include? x\n left.delete x\n elsif ! right.include?(x)\n right << x\n end\n end\n left + right\n end",
"def exclude(num)\n @arr_possible.delete(num)\n if @arr_possible.length == 1\n set(@arr_possible[0])\n return true\n end\n return false if @possible == @arr_possible.length\n @possible = @arr_possible.length\n true\n end",
"def not_regexp(left, right)\n # could be DRYer, but this is more readable than: \"NOT #{self.=~(left,right)}\"\n raise if right.is_a? Regexp\n \"NOT #{left}#{quotify right}\"\n end",
"def xor?(arg1, arg2)\n if arg1 && !arg2\n true\n elsif !arg1 && arg2\n true\n else \n false\n end\nend",
"def xor?(x, y)\n (x && !y) || (!x && y)\nend",
"def clr_only(value)\n shift_out_with_index { |bit, i| bit.clr_only = (value[i] == 0b1) }\n self\n end",
"def ~\n self ^ -1\n end",
"def stray(numbers)\n numbers.reduce(&:^)\nend",
"def opposite(num)\n if num < 0\n return num.abs\n else num >= 0\n return num * -1 end\nend",
"def OF_CHECKING(a,b,sum) \n\tAND(XOR(sum,a),NOT(XOR(a,b)))\nend",
"def xor?(value1, value2)\r\n !!((value1 && !value2) || (value2 && !value1)) # !! forces the return to be a boolean\r\nend"
] |
[
"0.7656138",
"0.7366036",
"0.72996163",
"0.65726906",
"0.6459544",
"0.63448286",
"0.6291332",
"0.62876874",
"0.621211",
"0.61929053",
"0.60908175",
"0.60612786",
"0.5994837",
"0.5928881",
"0.5894501",
"0.58674407",
"0.5862595",
"0.5853673",
"0.5853673",
"0.5853223",
"0.58345425",
"0.58136183",
"0.5780039",
"0.5733728",
"0.5723485",
"0.5636582",
"0.5630484",
"0.56220937",
"0.56174314",
"0.5610484",
"0.56046367",
"0.5590764",
"0.5585925",
"0.5559357",
"0.5531809",
"0.5523072",
"0.5520049",
"0.5518513",
"0.5517814",
"0.5514914",
"0.55128235",
"0.54950273",
"0.54918927",
"0.54918927",
"0.54918176",
"0.54777235",
"0.5476738",
"0.5476596",
"0.5473082",
"0.54719985",
"0.5465383",
"0.54578817",
"0.54547304",
"0.54522943",
"0.54522943",
"0.54372877",
"0.5432425",
"0.542628",
"0.54124033",
"0.54069823",
"0.54025966",
"0.5388456",
"0.5377085",
"0.53558344",
"0.53503036",
"0.53501844",
"0.53485256",
"0.5347704",
"0.53474724",
"0.53414065",
"0.53400314",
"0.5331425",
"0.531777",
"0.5307425",
"0.5292749",
"0.52853817",
"0.5282514",
"0.52787024",
"0.52730894",
"0.52709186",
"0.52709186",
"0.52666503",
"0.52654994",
"0.5257497",
"0.5256655",
"0.5248288",
"0.5247167",
"0.52451706",
"0.52429366",
"0.5238269",
"0.5237869",
"0.52358127",
"0.52274543",
"0.5213532",
"0.5210064",
"0.5209542",
"0.5207535",
"0.5205262",
"0.5204353",
"0.5202094"
] |
0.72867185
|
3
|
Creates and initializes a new instance of the Metrics class.
|
def initialize(client)
@client = client
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize(...)\n @metrics = {}\n register(...)\n end",
"def initialize(metrics)\n @metrics = metrics\n end",
"def initialize\n @metrics = { processed: 0, skipped: 0, failed: 0, updated: 0,\n unchanged: 0, start_time: 0, failed_list: [],\n warning: 0 }\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def metrics\n manager_instance(MetricManager)\n end",
"def build_metrics\n {}\n end",
"def initialize(hash, ignore=nil) #:nodoc:\n @metrics = Scout::MetricProxy.new(self)\n super(hash)\n end",
"def initialize(hash, ignore=nil) #:nodoc:\n @metrics = Scout::MetricProxy.new(self)\n super(hash)\n end",
"def new\n @performance = Performance.new\n end",
"def initialize(http_client, service)\n super(http_client, entity_name: 'metric', collection_name: 'metrics')\n @service = service\n @resource_instance = Metric\n end",
"def metrics\n @metrics ||= parent_klass.metrics.dup\n end",
"def initialize(params_hash)\n params_hash.each {|k,v| instance_variable_set(\"@#{k}\", v) }\n @type_name = 'metric'\n end",
"def new\n @unit_of_measure = UnitOfMeasure.new\n end",
"def register_metrics!\n return if @registered\n @registered = true\n with_instance do |t|\n # Worker related\n t.add_gauge :dynflow_active_workers, 'The number of currently busy workers',\n [:queue, :world]\n t.add_counter :dynflow_worker_events, 'The number of processed events',\n [:queue, :world, :worker]\n\n # Execution plan related\n t.add_gauge :dynflow_active_execution_plans, 'The number of active execution plans',\n [:action, :world, :state]\n t.add_gauge :dynflow_queue_size, 'Number of items in queue',\n [:queue, :world]\n t.add_counter :dynflow_finished_execution_plans, 'The number of execution plans',\n [:action, :world, :result]\n\n # Step related\n # TODO: Configure buckets in a sane manner\n t.add_histogram :dynflow_step_real_time, 'The time between the start end end of the step',\n [:action, :phase]\n t.add_histogram :dynflow_step_execution_time, 'The time spent executing a step',\n [:action, :phase]\n\n # Connector related\n t.add_counter :dynflow_connector_envelopes, 'The number of envelopes handled by a connector',\n [:world, :direction]\n\n # Persistence related\n t.add_histogram :dynflow_persistence, 'The time spent communicating with the database',\n [:world, :method]\n end\n end",
"def metrics\n @metrics ||= collect_metrics\n end",
"def custom_metrics\n @custom_metrics ||= {}\n end",
"def construct(loader: nil)\n loader ||= MeasureLoader.new\n @loader = loader\n @measures_lookup = HashWithIndifferentAccess.new\n end",
"def Metric(metric_name, &class_body)\n metric_collector = Class.new(::Critical::MetricBase)\n metric_class_name = Critical::Metrics.const_set(metric_name.to_s.capitalize, metric_collector)\n metric_collector.metric_name = metric_name\n log.debug { \"Defining metric '#{metric_name}' as '#{metric_class_name}'\"}\n metric_collector.class_eval(&class_body) if block_given?\n MonitorDSL.define_metric(metric_name, metric_collector)\n metric_collector\n end",
"def initialize(attrs = {})\n super(attrs)\n return if attrs['measures'].nil?\n @measures = attrs['measures'].collect do |measurement|\n klass = TYPES[measurement['type']]\n klass.new(measurement) unless klass.nil?\n end.reject { |obj| obj.nil? }\n end",
"def metrics\n @metrics ||= []\n end",
"def initialize(job_class, metrics)\n self.job_class = job_class\n self.load(metrics)\n end",
"def metric(name,type,value)\n @metrics[name] = {\n :type => type,\n :value => value\n }\nend",
"def initialize(options={})\n @options = options.clone\n\n @options[:subtract_overhead] = true if @options[:subtract_overhead].nil? # Never use ||= with booleans\n\n @measurements = {} # A hash of Measure\n @current_path = nil\n @instrumented_methods = {METHOD_TYPE_INSTANCE=>[],METHOD_TYPE_CLASS=>[]}\n @subtract_overhead = @options[:subtract_overhead]\n if @@overhead.nil?\n @@overhead = measure_overhead\n @measurements = {} # A hash of Measure; must repeat here to cleanup what measure_overhead did\n end\n end",
"def initialize(hash, ignore = nil) #:nodoc:\n if hash['descriptors'] && hash['descriptors']['descriptor']\n @descriptor_hash = hash['descriptors']['descriptor']\n hash.delete('descriptors')\n end\n @metrics = Scout::MetricProxy.new(self)\n super(hash)\n end",
"def init filename \n @metrics = MGT::MetricFactory.new(MGT::ParamsParser.new(filename).parse)\n end",
"def registry\n UnicornMetrics::Registry\n end",
"def create\n metric = metrics.create(create_params)\n\n respond_with(metric)\n end",
"def initialize\n # We start with an empty hash of stats\n @stats = {}\n end",
"def initialize(observations)\n observations.each { |method, value| send(\"#{method}=\", value) }\n @metric = true\n end",
"def initialize(xml, client)\n @tags ||= Hash.new\n @metrics ||= Hash.new\n @doc ||= Nokogiri::XML(xml)\n @client = client\n\n init_tags\n init_metrics\n init_custom_metrics\n end",
"def get_metrics\n {\n method: \"Performance.getMetrics\"\n }\n end",
"def initialize()\n @metadata = Hash.new()\n return self\n end",
"def initialize\n @stats = {}\n @schema = {}\n @ebd_cache = {}\n end",
"def initialize(params={})\n @profile_id = params[:profile_id]\n @profile_id = params[:profile].id if params[:profile]\n\n @metrics = Utils.prefix([params[:metrics]])\n @dimensions = Utils.prefix([params[:dimensions]])\n\n raise ArgumentError, 'You must supply at least one metric.' if @metrics.empty?\n end",
"def initialize(options = {})\n super\n @counters = {}\n @interval = options[:interval] || 0.1\n end",
"def initialize(metric: 'euclidean')\n @metric = metric\n end",
"def initialize(pipeline_config, metric)\n @pipeline_config = pipeline_config\n @metric = metric\n end",
"def construct(loader: nil)\n loader ||= MeasureDefinitionLoader.new(data_path: self.class.data_path)\n @loader = loader\n @measure_definitions_lookup = HashWithIndifferentAccess.new\n end",
"def initialize(metric: :memory, value: :allocated)\n raise ArgumentError, \"Invalid metric: #{metric.inspect}\" unless METRICS.include? metric\n raise ArgumentError, \"Invalid value: #{value.inspect}\" unless VALUES.include? value\n\n @metric = metric\n @value = value\n end",
"def initialize(options = {})\n super\n @counters = {}\n self.interval = options[:interval] || 0.01\n end",
"def to_metric\n Metric.new(\n Instrumentation.series,\n {\n duration: real_time.in_milliseconds.to_i,\n cpu_duration: cpu_time.in_milliseconds.to_i,\n call_count: call_count\n },\n method: @name\n )\n end",
"def metrics_with_methods\n {metrics: @metrics, methods: @methods}\n end",
"def metrics_with_methods\n {metrics: @metrics, methods: @methods}\n end",
"def cpu_metrics\n super\n end",
"def cw_metric\n @cw_metric ||= AWS::CloudWatch::Metric.new(\n @namespace,\n @name,\n dimensions: @dimensions\n )\n end",
"def all\n @@all_metrics ||= self.from_file(\n File.join(Rails.root, 'config', 'metrics.yml')\n )\n end",
"def counters\n metrics(Counter)\n end",
"def to_metric\n Metric.new(\n Instrumentation.series,\n {\n duration: real_time,\n cpu_duration: cpu_time,\n call_count: call_count\n },\n method: @name\n )\n end",
"def initialize(opts={})\n @ttl_of_hours = 31_556_926 # 1 year\n\n @kvstore = required(opts, :kvstore)\n @sleep_interval = required(opts, :sleep_interval)\n @max_healthy_errors = required(opts, :max_healthy_errors)\n @max_unhandled_errors = required(opts, :max_unhandled_errors)\n @max_retry_delay_in_seconds = required(opts, :max_retry_delay_in_seconds)\n @max_ttl_of_dimension = {}\n\n updater_options = {\n :kvstore => @kvstore,\n :sleep_interval => @sleep_interval,\n :max_healthy_errors => @max_healthy_errors,\n :max_unhandled_errors => @max_unhandled_errors,\n :max_retry_delay_in_seconds => @max_retry_delay_in_seconds\n }\n @open = false\n @inserter = Inserter.new(updater_options)\n bucket_count = 1 << HyperLogLog.bits_needed(CARDINALITY_ESTIMATOR_ERROR_RATE)\n @inserter.list_threshold = (2.5 * bucket_count).ceil\n @incrementer = Incrementer.new(updater_options)\n @range_updater = RangeUpdater.new(updater_options)\n @count_incrementer = CountIncrementer.new(updater_options)\n\n range_updater.handle_update_result = Proc.new do |key, result, ttl|\n if key.start_with?(\"range:\") && !result.nil?\n new_or_grew, amount = result\n if new_or_grew == :new || new_or_grew == :grew\n _, time_block, metric_name, dimensions = key.split(/[\\/\\?]/)\n unless dimensions.nil?\n dimensions = dimensions.split('&')\n dimensions.size.times do |i|\n dimensions2 = dimensions.clone\n group, dimension_value = dimensions2.delete_at(i).split('=')\n key_suffix = \"#{time_block}/#{metric_name}/#{group}?#{dimensions2.join('&')}\"\n incrementer.increment(\"rangesum:/#{key_suffix}\", amount, ttl)\n incrementer.increment(\"rangesumsqr:/#{key_suffix}\", amount * amount, ttl)\n range_updater.update_range(\"rangerange:/#{key_suffix}\", amount, ttl)\n if new_or_grew == :new\n count_incrementer.increment(\"rangecount:/#{key_suffix}\", 1, ttl)\n end\n end\n end\n end\n end\n end\n end",
"def initialize(options = {})\n raise \"You must provide either :agent or :api_token as an option\" unless options[:agent] || options[:api_token]\n @agent = options[:agent] || ::Instrumental::Agent.new(options[:api_token])\n @prefix = options[:prefix]\n @registry = options[:registry] || Metriks::Registry.default\n interval = options[:interval] || 60\n interval = [interval, 60].max\n @time_tracker = Metriks::TimeTracker.new(interval)\n @on_error = options[:on_error] || proc { |ex| }\n end",
"def new()\n #This is a stub, used for indexing\n end",
"def initialize\n System.stats.each { |s| instance_variable_set(\"@#{s}\", System.make_stat) }\n end",
"def initialize(options={})\n @frequency = options.delete(:frequency) || 5\n @max_per_class = options.delete(:max_per_class) || 10\n @quiet = options.delete(:quiet)\n @runners = {}\n @index = {}\n end",
"def initialize(metric_name = '', metric_scope = nil)\n self.name = (metric_name || '') && metric_name.to_s[LENGTH_RANGE]\n if metric_scope\n self.scope = metric_scope && metric_scope.to_s[LENGTH_RANGE]\n else\n self.scope = ''\n end\n end",
"def setup_metrics\n require 'fog'\n @options = NewRelic::Plugin::Config.config.newrelic\n log.debug 'Establishing connection to New Relic'\n end",
"def setup_metrics\n valid_passenger_versions = [3, 4]\n\n raise ConfigurationError, \"passenger_version config variable must be set\" unless defined?(passenger_version)\n raise ConfigurationError, \"Passenger version must be one of #{valid_passenger_versions}\" unless valid_passenger_versions.include?(passenger_version)\n\n\n @matches = {}\n\n @matches[:processes_max] = /max\\s+=\\s+(\\d+)/ if passenger_version.eql?(3)\n #Max pool size : 6\n @matches[:processes_max] = /Max pool size\\s+:\\s+(\\d+)/ if passenger_version.eql?(4)\n\n\n @matches[:processes_running] = /count\\s+=\\s+(\\d+)/ if passenger_version.eql?(3)\n #Processes : 6\n @matches[:processes_running] = /Processes\\s+:\\s+(\\d+)/ if passenger_version.eql?(4)\n\n\n @matches[:queue_waiting] = /Waiting on global queue:\\s+(\\d+)/ if passenger_version.eql?(3)\n #Requests in top-level queue : 0\n @matches[:queue_waiting] = /Requests in top-level queue\\s+:\\s+(\\d+)/ if passenger_version.eql?(4)\n\n end",
"def initialize(units=:mm)\n\t @units = units\n\tend",
"def initialize metric\n\t\tmetric_id = get_id metric\n\t\t@origin_id, @metric_id = metric_id.split(SEP)\n\t\t@settings = origin_settings(@origin_id).last\n\t\t@store = init_store @settings.store, @origin_id, @settings\n\t\t@source = init_source @settings.source, @origin_id, @settings\n\tend",
"def initialize(metric, namespace_name)\n @metric = metric\n @namespace_name = Array(namespace_name)\n end",
"def timers\n metrics(Timer)\n end",
"def record(name = nil, duration = nil, description = nil, **kwargs)\n name ||= kwargs[:name]\n duration ||= kwargs[:duration]\n description ||= kwargs[:description]\n\n metrics[name] = Metric.new(\n name: name,\n duration: duration,\n description: description\n )\n end",
"def initialize(opts = {})\n opts[:type] ||= :memory\n @default_timeout = opts[:default_timeout] || 60\n @store = new_store(opts)\n @store.extend(MonitorMixin)\n end",
"def initialize\n log_path = @@log[:path] + 'one2influx.log'\n begin\n $LOG = Logger.new(log_path, 'daily', 30)\n rescue Exception => e\n raise \"Unable to create log file. #{e.message}\"\n end\n $LOG.level = @@log[:level]\n\n convert_to_sec\n prepare_storage_ids\n prepare_vm_config\n end",
"def measure\n Measure.new(1, self)\n end",
"def meters \n metrics(Meter)\n end",
"def metrics=(array=[])\n @metrics = array.map { |m| m.is_a?(Metric) ? m : Metric.by_key(m) }.compact\n end",
"def temperature_metrics\n super\n end",
"def get(id)\n Hawkular::Metrics::MetricDefinition::new(@client.http_get(\"/#{@resource}/#{id}\"))\n end",
"def initialize(klass)\n\t\t\t @klass = klass\n\t\t\t @name = klass.name\n\t\t\t @created_at_method = :created_at\n\t\t\t @event = :after_create\n\t\t\t @metrics = {}\n\t\t\tend",
"def collect_metrics(*)\n raise NotImplementedError, 'Must implement collect_metrics'\n end",
"def initialize\n self.report = {}\n self.errors = 0\n self.failures = 0\n self.skips = 0\n self.test_count = 0\n self.assertion_count = 0\n self.verbose = false\n self.reporters = []\n\n @_source_cache = {}\n end",
"def call\n missing_metrics.each(&method(:create_metric))\n missing_methods.each(&method(:create_method))\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize(measure_rate = true)\n @measure_rate = measure_rate\n reset\n end",
"def counter(name, _labels, docstring, _prefix, _aggregation)\n # When we upgrade to Prometheus client 0.10.0 or higher, pass the\n # labels in the metric constructor. The 'labels' field in\n # Prometheus client 0.9.0 has a different function and will not\n # work as intended.\n PrometheusCounter.new(@registry.counter(name, docstring))\n rescue Prometheus::Client::Registry::AlreadyRegisteredError\n PrometheusCounter.new(@registry.get(name))\n end",
"def add_metric\n\t\tp_language = ProgrammingLanguage.find_by_name(RubyCoverage::PROGRAMMING_LANGUAGE)\n\t\t \n\t\tbegin\n\t\t Metric.table_exists?\n\t\t metric_analyser = RubyCoverage::ANALYSER\n\t\t metric_name = RubyCoverage::NAME\n\t\t if Metric.find_by_name(metric_name).nil?\n\t\t\tmetric = Metric.new(:name => metric_name, :analyser => metric_analyser)\n\t\t\tmetric.programming_language = p_language\n\t\t\tmetric.save!\n\t\t end \n\t\trescue\n\t\t raise \"ActiveRecord::Metric does not exist.\"\n\t\tend\n\t end",
"def initialize\n @influxdb_hosts = DEFAULTS[:influxdb_hosts]\n @influxdb_port = DEFAULTS[:influxdb_port]\n @influxdb_username = DEFAULTS[:influxdb_username]\n @influxdb_password = DEFAULTS[:influxdb_password]\n @influxdb_database = DEFAULTS[:influxdb_database]\n @async = DEFAULTS[:async]\n @use_ssl = DEFAULTS[:use_ssl]\n @retry = DEFAULTS[:retry]\n @open_timeout = DEFAULTS[:open_timeout]\n @read_timeout = DEFAULTS[:read_timeout]\n @max_delay = DEFAULTS[:max_delay]\n @time_precision = DEFAULTS[:time_precision]\n\n @series_name_for_controller_runtimes = DEFAULTS[:series_name_for_controller_runtimes]\n @series_name_for_view_runtimes = DEFAULTS[:series_name_for_view_runtimes]\n @series_name_for_db_runtimes = DEFAULTS[:series_name_for_db_runtimes]\n @series_name_for_exceptions = DEFAULTS[:series_name_for_exceptions]\n @series_name_for_instrumentation = DEFAULTS[:series_name_for_instrumentation]\n\n @tags_middleware = DEFAULTS[:tags_middleware]\n @rails_app_name = DEFAULTS[:rails_app_name]\n\n @ignored_exceptions = DEFAULTS[:ignored_exceptions].dup\n @ignored_exception_messages = DEFAULTS[:ignored_exception_messages].dup\n @ignored_reports = DEFAULTS[:ignored_reports].dup\n @ignored_environments = DEFAULTS[:ignored_environments].dup\n @ignored_user_agents = DEFAULTS[:ignored_user_agents].dup\n @backtrace_filters = DEFAULTS[:backtrace_filters].dup\n @environment_variable_filters = DEFAULTS[:environment_variable_filters]\n @aggregated_exception_classes = []\n\n @debug = false\n @rescue_global_exceptions = false\n @instrumentation_enabled = true\n end",
"def []=(key, value)\n @metrics[key] = value\n end",
"def initialize\n EM.add_periodic_timer(5) {\n check_expired_resources\n }\n check_expired_resources\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize\n @registry = Registry.new\n end",
"def initialize main_scope, options={}\n require 'redis'\n begin\n require 'redis-namespace'\n rescue LoadError\n require 'redis/namespace'\n end\n @main_scope = main_scope\n @redis = Redis.new(options)\n @namespace = options[:namespace] || 'graphiterb'\n @accumulators = Redis::Namespace.new(namespace, :redis => redis)\n end",
"def initialize(request, response, dimensions = [])\n @t = Time.now\n @dimensions = dimensions + ['global']\n\n @redis_key_prefix = \"#{RedisAnalytics.redis_namespace}:\"\n\n RedisAnalytics.redis_connection.sadd(\"#{@redis_key_prefix}#DIMENSIONS\", @dimensions)\n @rack_request = request\n @rack_response = response\n end",
"def initialize(medusa_log_writer, graphite_writer, metric_level, jolokia_port, solr_jmx_port, solr_version, time)\n @medusa_log_writer = medusa_log_writer\n @graphite_writer = graphite_writer\n @metric_level = metric_level\n @jolokia_port = jolokia_port\n @solr_jmx_port = solr_jmx_port\n @solr_version = solr_version\n @time = time\n end",
"def initialize(unit_type)\n \n @resolution_unit = unit_type\n \n # Create our hash.\n # The default value is an empty bucket with\n # a start point and resolution.\n @buckets = Hash.new do |hash, key|\n period = create_period( key )\n @buckets[ key ] = TimeSeries::Bucket.new( period )\n end\n \n if not UNITS.member?(unit_type)\n raise ArgumentError, \"#{unit_type} is not an allowed unit of time\"\n end\n\n end",
"def initialize\n\t\t@counter = 0\n\t\t@initial_usage = nil\n\tend",
"def new\n @evaluations = Evaluation.new\n end",
"def metric(*names)\n metrics = names.map do |name|\n id = name.to_s.downcase.gsub(/\\W+/, '_').to_sym\n Vanity.playground.metrics[id] ||= Vanity::Metric.new(Vanity.playground, name)\n end\n names.size == 1 ? metrics.first : metrics\n end",
"def initialize(\n spans,\n agent_sample_rate: nil,\n hostname: nil,\n id: nil,\n lang: nil,\n name: nil,\n origin: nil,\n process_id: nil,\n rate_limiter_rate: nil,\n resource: nil,\n root_span_id: nil,\n rule_sample_rate: nil,\n runtime_id: nil,\n sample_rate: nil,\n sampling_priority: nil,\n service: nil,\n tags: nil,\n metrics: nil,\n profiling_enabled: nil\n )\n @id = id\n @root_span_id = root_span_id\n @spans = spans || []\n\n # Does not make an effort to move metrics out of tags\n # The caller is expected to have done that\n @meta = (tags && tags.dup) || {}\n @metrics = (metrics && metrics.dup) || {}\n\n # Set well-known tags, defaulting to getting the values from tags\n @agent_sample_rate = agent_sample_rate || agent_sample_rate_tag\n @hostname = hostname || hostname_tag\n @lang = lang || lang_tag\n @name = Core::Utils::SafeDup.frozen_or_dup(name || name_tag)\n @origin = Core::Utils::SafeDup.frozen_or_dup(origin || origin_tag)\n @process_id = process_id || process_id_tag\n @rate_limiter_rate = rate_limiter_rate || rate_limiter_rate_tag\n @resource = Core::Utils::SafeDup.frozen_or_dup(resource || resource_tag)\n @rule_sample_rate = rule_sample_rate_tag || rule_sample_rate\n @runtime_id = runtime_id || runtime_id_tag\n @sample_rate = sample_rate || sample_rate_tag\n @sampling_decision_maker = sampling_decision_maker_tag\n @sampling_priority = sampling_priority || sampling_priority_tag\n @service = Core::Utils::SafeDup.frozen_or_dup(service || service_tag)\n @profiling_enabled = profiling_enabled\n end",
"def new\n @series = Series.new\n end",
"def initialize\n\t\t@scores = {\n\t\t\ttime: nil,\n\t\t\tpoints: 0,\n\t\t\tkills: 0\n\t\t}\n\t\t@start_time = nil\n\t\t@font = RESOURCES[:fonts][:score]\n\t\t@text_padding = SETTINGS.score :text_padding\n\t\t@colors = SETTINGS.score :colors\n\t\t@z_indexes = SETTINGS.score :z_indexes\n\t\t@background_size = SETTINGS.score :background_size\n\tend",
"def initialize(options = {}, &work_block)\n default_options = { num_threads: 10, \n num_loops: 10, \n loop_delay: 0,\n show_values: true, \n print_results: true,\n garbage_collection: false,\n work_warmup_proc: nil, \n }\n\n options = default_options.merge(options)\n options.to_instance_variables(binding, define: :attr_reader)\n @threads = []\n @results = []\n @work_block = work_block\n @results.extend(EnumerableStatistics)\n end",
"def initialize\n @domain_counts = Hash.new\n end"
] |
[
"0.78000325",
"0.7760029",
"0.73663616",
"0.70968986",
"0.70968986",
"0.70968986",
"0.68755037",
"0.66867405",
"0.6631004",
"0.6631004",
"0.6501228",
"0.65010643",
"0.64352846",
"0.6345413",
"0.63025486",
"0.6266697",
"0.62650454",
"0.62628955",
"0.61900526",
"0.6134465",
"0.6134034",
"0.6132928",
"0.61313266",
"0.61178714",
"0.6011775",
"0.5977721",
"0.5977107",
"0.5967392",
"0.59581447",
"0.59520453",
"0.5946886",
"0.58975565",
"0.5882674",
"0.57917637",
"0.5791648",
"0.57881063",
"0.5778417",
"0.57751846",
"0.577514",
"0.5758582",
"0.5753708",
"0.57496834",
"0.57278764",
"0.5689216",
"0.5689216",
"0.56808573",
"0.5671634",
"0.5650152",
"0.56407416",
"0.56402445",
"0.5639006",
"0.5638948",
"0.5634499",
"0.56326663",
"0.5620983",
"0.55981517",
"0.55923533",
"0.55695885",
"0.5562221",
"0.55606616",
"0.5553307",
"0.55496216",
"0.554408",
"0.55394316",
"0.5538815",
"0.55310994",
"0.5530034",
"0.55226153",
"0.5513722",
"0.5508641",
"0.5505927",
"0.55021054",
"0.54886276",
"0.5481879",
"0.5477423",
"0.5477423",
"0.5477423",
"0.5477423",
"0.5477423",
"0.5477423",
"0.5471331",
"0.5468518",
"0.5461505",
"0.5460068",
"0.54538935",
"0.5449709",
"0.54454494",
"0.54454494",
"0.5444695",
"0.5423808",
"0.5419674",
"0.541596",
"0.54085124",
"0.5406225",
"0.5406127",
"0.54020387",
"0.5400762",
"0.53850675",
"0.5384261",
"0.538415",
"0.5380667"
] |
0.0
|
-1
|
codecite dq codecite sq
|
def print_string_message_sq
puts 'Double-quoted strings can include escaped characters such as \n and \\\\'
puts 'as well as interpolated Ruby expressions like #{Time.now}.'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def query(q=\"\")\n\t\tif @connection != nil\n\t\t\t@data = MonetDBData.new(@connection)\n\t\t\t@data.execute(q)\n\t\tend\n\t\treturn @data\n\tend",
"def query(q=\"\")\n if @connection != nil \n @data = MonetDBData.new(@connection)\n @data.execute(q)\n end\n return @data\n end",
"def query(n)\n @query_num_to_byte[n]\n end",
"def to_Qdl\n gsub /\\\"/,\"'\"\n end",
"def run_query(q)\n return sky_table.query(q)\n end",
"def query(q)\n gql(prepare: true).query(q)\n end",
"def create_likely_qda_data\n ActiveRecord::Base.connection.execute likely_qda_sql\n end",
"def custom_sql(q)\n query = q + ';' unless q =~ /;$/\n query = @db_connection.query(\"#{query}\")\n query.each { |x| print_line(\"#{x.join(',')}\") } unless query.empty?\n end",
"def q(str)\n str.class == String ? ActiveRecord::Base.connection.quote_string(str) : str\n end",
"def db_query( sql )\n db = SQLite3::Database.new 'database.db'\n db.results_as_hash = true\n puts '==============================='\n puts sql # for debugging our SQL\n puts '==============================='\n result = db.execute sql\n db.close\n result # return the result of the query\nend",
"def to_sql\n source.select(bin_sql).to_sql\n end",
"def db_query sql\n\n db = SQLite3::Database.new 'database.db'\n db.results_as_hash = true\n # debugging output in the terminal:\n puts '================='\n puts sql\n puts '================='\n results db.execute sql\n db.close might\n\n results # return results as query\nend",
"def query; end",
"def query(sql)\n database.execute2(sql)\n end",
"def snippet_for_qd\n \"[QD#${1|#{list_qr_et_id(:qd).join(',')}|}]formate_qrd$0\"\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 quad(*ints)\n raise \"Quad does not work for big endian formats yet!\" unless little_endian?\n format = ( little_endian? ? 'Q*' : 'q*')\n # XXX: does not work for big endian!!! \n return string(ints.pack(format))\n end",
"def query_db(sql)\n pp sql\n db = SQLite3::Database.new('database.db')\n db.results_as_hash = true\n data = db.execute(sql)\n db.close\n data\nend",
"def sdb\n StudentCalendarQuarter.find(\"0#{year.to_s}#{quarter_code_id.to_s}\")\n end",
"def q_buffer(&block)\r\n Knj::Db::Query_buffer.new(:db => self, &block)\r\n end",
"def select(db); end",
"def select(db); end",
"def db_query( sql )\n\n db = SQLite3::Database.new 'database.db'\n db.results_as_hash = true\n # Debugging output in the terminal:\n puts '======================='\n puts sql\n puts '======================='\n results = db.execute sql\n db.close\n\n results # return the result of the query\nend",
"def query_def; seq1.definition; end",
"def db_query(sql)\n db = SQLite3::Database.new(\"database.db\") #connect to database\n db.results_as_hash = true\n puts \"=\"*100\n p sql\n # puts sql.red\n puts \"=\"*100\n result = db.execute( sql )\n db.close #close the connection\n result #this is what this method returns\nend",
"def bytes\n @lmdb.transaction do\n if ret = @dbs[:control]['bytes']\n ret.unpack1 'Q>'\n end\n end\n end",
"def ascii_query(sql,*values)\n sth = self.query(sql,*values)\n rows = sth.fetch_all\n col_names = sth.column_names\n sth.finish\n DBI::Utils::TableFormatter.ascii(col_names, rows)\n end",
"def to_cql\n fail NotImplementedError\n end",
"def sql_query(sql)\n\t\t\t\tbegin\n \tdbslay_results = cmd_execute(:db, 'SQL' => sql)\n rescue OpenURI::HTTPError\n\t\t\t\t\traise DbslayerException, \"Error connecting to dbslayer #{host}:#{port}\"\n\t\t\t\trescue JSON::ParserError\n\t\t\t\t\traise DbslayerException, \"Unable to parse result from JSON\"\n\t end\n\t\n # check for an error\n if dbslay_results['MYSQL_ERROR']\n raise DbslayerException, \"MySQL Error #{dbslay_results['MYSQL_ERRNO']}: #{dbslay_results['MYSQL_ERROR']}\"\n elsif result = dbslay_results['RESULT']\n case result\n when Hash\n out = DbslayerResult.new(result)\n set_affected!(out)\n out\n when Array\n out = result.map {|r| DbslayerResult.new(r) }\n set_affected!(out.last)\n out\n else \n raise DbslayerException, \"Unknown format for SQL results from DBSlayer\"\n end\n else \n raise DbslayerException, \"Unknown format for SQL results from DBSlayer\"\n end\n end",
"def get_audio_content\n begin\n audio_sql = \"SELECT * FROM mediacontent WHERE HighQFilePath IS NOT NULL\";\n audio_sql += \" AND (ContentTypeID = 2) AND (HighQFilePath LIKE '%mp3')\";\n audio_sql += \" AND HighQFilePath != ''\"\n audio_content_data = Immutable.dbh.execute(audio_sql);\n return audio_content_data;\n rescue DBI::DatabaseError => e\n Immutable.log.error \"Error code: #{e.err}\"\n Immutable.log.error \"Error message: #{e.errstr}\"\n Immutable.log.error \"Error SQLSTATE: #{e.state}\"\n abort('An error occurred while getting audio content data from DB, Check migration log for more details');\n end\n end",
"def create_query\n create_raw_query.select('audio_recordings.id, audio_recordings.uuid').order('audio_recordings.recorded_date')\n end",
"def query(q)\n @conn.query({url_path: \"#{database}/_find\", opts: q, method: :post})\n end",
"def query_def; @seq1.definition; end",
"def create_movies_table\n c = connect\n # this is another way to write a string, using %q{}\n c.exec %q{ \n CREATE TABLE movies (\n id SERIAL PRIMARY KEY,\n title TEXT,\n description TEXT,\n rating INTEGER\n );\n }\n c.close\nend",
"def static_sql_bytesize\n @static_sql_bytesize ||= insert_part.bytesize + update_part.bytesize + 2\n end",
"def qb(*args)\n $qb.puts(*args)\nend",
"def db_value_for_question(q)\n col = q[\"question\"].db_column\n RT.custom_query(\"SELECT #{col} FROM #{q[\"table\"]} WHERE path = ?\", [q[\"path\"]], true)[col]\n end",
"def query(mph, minutes, incline=\"\", date: Time.now)\n query = \"INSERT INTO cardio(cd_date, cd_mph, cd_minutes\"\n query << ((incline.empty?) ? \")#{\" \" * 13}\" : \", cd_incline) \")\n query << \"VALUES('#{date.strftime(\"%F\")}', #{mph.rjust(4)}, #{minutes.chomp(?m).rjust(2)}\"\n query << ((incline.empty?) ? \");\" : \", #{incline.chomp('%')});\")\n return query\n end",
"def igdb_query\n <<-SPARQL\n SELECT ?item ?igdbId WHERE {\n ?item wdt:P31 wd:Q7889; # Instances of video games\n wdt:P5794 ?igdbId. # Items with an IGDB ID.\n }\n SPARQL\n end",
"def dataset\n DB[SQL, from: from_truncated, to: to_truncated, tick: tick]\n end",
"def quartets_to_byte(quartetsToConvert)\n\tquartetsToConvert[1] | (quartetsToConvert[0] << 4)\nend",
"def query_simple( query )\n read_db do |dbm|\n puts RDictCcEntry.format_str(dbm[query]) if !dbm[query].nil?\n end\n end",
"def execute sql\n db[sql]\n end",
"def qip(src_addr)\n conn = PGconn.connect(\"localhost\",5432,'','',CONFIG['setup']['db']['dbname'],CONFIG['setup']['db']['user'],CONFIG['setup']['db']['password'])\n begin\n $res = conn.exec(\"select src_mac,insert_time from maestro_mac where src_ip='#{src_addr}' order by insert_time desc limit 1;\");\n rescue\n # // puts \"query failed\"\n else\n # // puts \"query ok\"\n end\n conn.close()\nend",
"def phq2?; end",
"def data_complextest(db); end",
"def insert_cako\n\t\tsql = \"insert into CacheTako values (?, ?, ?)\"\n\t\treturn sql\n\tend",
"def initialize\n @byte_num = {}\n @query_num_to_byte = []\n @query_nums = []\n end",
"def query_db(sql)\n db = SQLite3::Database.new 'database.sqlite3'\n db.results_as_hash = true\n\n puts sql # Optional but nice for debugging.\n\n results = db.execute sql\n db.close\n\n return results\nend",
"def getDBValue(connection, query, id1, *id2)\r\n dbi_query = connection.prepare(query)\r\n dbi_query.execute(id1, *id2)\r\n #fetch the result\r\n return dbi_query.fetch\r\nend",
"def convert_phred33_to_q(phred)\r\n return (phred.ord - 33)\r\nend",
"def qv\n end",
"def literal_blob_append(sql, v)\n if v.empty?\n sql << \"''\"\n else\n sql << \"x'#{v.unpack('H*').first}'\"\n end\n end",
"def compress_option_sql(attrs)\n\t case value=attrs[:compress]\n\t when Fixnum, Integer then \"COMPRESS(#{value})\"\n\t else flag_option_sql attrs, :compress\n\t end\n end",
"def query(sql)\n @dataset = @database[sql] #Take SQL string and connect it to a DB\n #puts(\"Datset\", dataset)\n @fields = Array.new #Create blank array of field/column names\n @fields = @dataset.columns #Gets table field/column names\n #print(\"Fields\", @fields, \"\\n\") #debug \n @fieldCount = @fields.length\n\n begin\n @data = @dataset.all #Executes SQL\n rescue\n @data = Array.new\n end\n end",
"def raw_query(query) #:nodoc:\n logger.benchmark \"cypher: #{query}\" do\n result = connection.execute_query(query)\n if result\n result[\"data\"]\n else\n []\n end\n end\n end",
"def sql_query(sql)\n db = PG.connect(:dbname => 'todo_book', :host => 'localhost')\n query_result = db.exec(sql)\n db.close\n\n return query_result\nend",
"def database_bloat\n data = select(<<-SQL, \"Database Bloat\")\n SELECT tablename AS table_name\n , ' ' AS index_name\n , reltuples::bigint AS rows\n , relpages::bigint AS pages\n , otta\n , ROUND(CASE WHEN otta = 0 OR sml.relpages = 0 OR sml.relpages = otta THEN 0.0 ELSE sml.relpages / otta::numeric END, 1) AS percent_bloat\n , CASE WHEN relpages < otta THEN 0 ELSE relpages::bigint - otta END AS wasted_pages\n , CASE WHEN relpages < otta THEN 0 ELSE (blocksize * (relpages - otta))::bigint END AS wasted_size\n , CASE WHEN relpages < otta THEN 0 ELSE blocksize * (sml.relpages - otta)::bigint END AS wasted_bytes\n FROM ( SELECT schemaname\n , tablename\n , cc.reltuples\n , cc.relpages\n , blocksize\n , CEIL((cc.reltuples * ((datahdr + pagesize - (CASE WHEN datahdr % pagesize = 0 THEN pagesize\n ELSE datahdr % pagesize END)) + nullhdr2 + 4)) / (blocksize - 20::float)\n ) AS otta\n FROM ( SELECT pagesize\n , blocksize\n , schemaname\n , tablename\n , (datawidth + (hdr + pagesize - (CASE WHEN hdr%pagesize = 0 THEN pagesize\n ELSE hdr%pagesize END)))::numeric AS datahdr\n , (maxfracsum * (nullhdr + pagesize - (CASE WHEN nullhdr % pagesize = 0 THEN pagesize\n ELSE nullhdr % pagesize END))) AS nullhdr2\n FROM ( SELECT schemaname\n , tablename\n , hdr\n , pagesize\n , blocksize\n , SUM((1 - null_frac) * avg_width) AS datawidth\n , MAX(null_frac) AS maxfracsum\n , hdr + ( SELECT 1 + count(*) / 8\n FROM pg_stats s2\n WHERE null_frac <> 0\n AND s2.schemaname = s.schemaname\n AND s2.tablename = s.tablename\n ) AS nullhdr\n FROM pg_stats s\n , ( SELECT\n ( SELECT current_setting('block_size')::numeric) AS blocksize\n , CASE WHEN SUBSTRING(SPLIT_PART(v, ' ', 2) FROM '#\"[0-9]+.[0-9]+#\"%' for '#')\n IN ('8.0','8.1','8.2') THEN 27 ELSE 23 END AS hdr\n , CASE WHEN v ~ 'mingw32' OR v ~ '64-bit' THEN 8 ELSE 4 END AS pagesize\n FROM ( SELECT version() AS v) AS foo\n ) AS constants\n GROUP BY 1, 2, 3, 4, 5\n ) AS foo\n ) AS rs\n JOIN pg_class cc\n ON cc.relname = rs.tablename\n JOIN pg_namespace nn\n ON cc.relnamespace = nn.oid\n AND nn.nspname = rs.schemaname\n AND nn.nspname <> 'information_schema'\n ) AS sml\n WHERE schemaname = 'public'\n\n UNION\n\n SELECT tablename AS table_name\n , iname AS index_name\n , ituples::bigint AS rows\n , ipages::bigint AS pages\n , iotta AS otta\n , ROUND(CASE WHEN iotta = 0 OR ipages = 0 OR ipages = iotta THEN 0.0 ELSE ipages / iotta::numeric END, 1) AS percent_bloat\n , CASE WHEN ipages < iotta THEN 0 ELSE ipages::bigint - iotta END AS wasted_pages\n , CASE WHEN ipages < iotta THEN 0 ELSE (blocksize * (ipages - iotta))::bigint END AS wasted_size\n , CASE WHEN ipages < iotta THEN 0 ELSE blocksize * (ipages - iotta) END AS wasted_bytes\n\n FROM ( SELECT schemaname\n , tablename\n , cc.reltuples\n , cc.relpages\n , blocksize\n , CEIL((cc.reltuples * ((datahdr + pagesize - (CASE WHEN datahdr % pagesize = 0 THEN pagesize\n ELSE datahdr % pagesize END)) + nullhdr2 + 4)) / (blocksize - 20::float)\n ) AS otta\n , COALESCE(c2.relname,'?') AS iname, COALESCE(c2.reltuples, 0) AS ituples, COALESCE(c2.relpages, 0) AS ipages\n , COALESCE(CEIL((c2.reltuples * (datahdr - 12)) / (blocksize - 20::float)), 0) AS iotta\n FROM ( SELECT pagesize\n , blocksize\n , schemaname\n , tablename\n , (datawidth + (hdr + pagesize - ( CASE WHEN hdr%pagesize = 0 THEN pagesize\n ELSE hdr%pagesize END)))::numeric AS datahdr\n , (maxfracsum * (nullhdr + pagesize - ( CASE WHEN nullhdr % pagesize = 0 THEN pagesize\n ELSE nullhdr % pagesize END))) AS nullhdr2\n FROM ( SELECT schemaname\n , tablename\n , hdr\n , pagesize\n , blocksize\n , SUM((1 - null_frac) * avg_width) AS datawidth\n , MAX(null_frac) AS maxfracsum\n , hdr + ( SELECT 1 + count(*) / 8\n FROM pg_stats s2\n WHERE null_frac <> 0\n AND s2.schemaname = s.schemaname\n AND s2.tablename = s.tablename\n ) AS nullhdr\n FROM pg_stats s\n , ( SELECT\n ( SELECT current_setting('block_size')::numeric) AS blocksize\n , CASE WHEN SUBSTRING(SPLIT_PART(v, ' ', 2) FROM '#\"[0-9]+.[0-9]+#\"%' for '#')\n IN ('8.0','8.1','8.2') THEN 27 ELSE 23 END AS hdr\n , CASE WHEN v ~ 'mingw32' OR v ~ '64-bit' THEN 8 ELSE 4 END AS pagesize\n FROM ( SELECT version() AS v) AS foo\n ) AS constants\n GROUP BY 1, 2, 3, 4, 5\n ) AS foo\n ) AS rs\n JOIN pg_class cc\n ON cc.relname = rs.tablename\n JOIN pg_namespace nn\n ON cc.relnamespace = nn.oid\n AND nn.nspname = rs.schemaname\n AND nn.nspname <> 'information_schema'\n LEFT JOIN pg_index i\n ON indrelid = cc.oid\n LEFT JOIN pg_class c2\n ON c2.oid = i.indexrelid\n ) AS sml\n WHERE schemaname = 'public'\n ORDER BY 1, 2\n SQL\n\n integer_columns = %w(\n otta\n pages\n pagesize\n rows\n wasted_bytes\n wasted_pages\n wasted_size\n )\n\n float_columns = %w(\n percent_bloat\n )\n\n data.each do |datum|\n integer_columns.each { |c| datum[c] = datum[c].to_i }\n float_columns.each { |c| datum[c] = datum[c].to_f }\n end\n\n data.to_a\n end",
"def direct_query q, retries = 6\n begin\n settings.db.query q\n rescue\n next_retries = retries - 1\n if next_retries == 0\n raise\n else\n log.warn \"Could not execute raw query (attempt #{6 - next_retries}): #{q}\"\n timeout = (6 - next_retries) ** 2\n sleep timeout\n direct_query query_string, next_retries\n end\n end\nend",
"def test_raw_insert_bind_param_with_q_mark_deprecated; end",
"def build_sql(value_str)\n \"COPY #{value_str} FROM STDIN WITH (FORMAT csv, DELIMITER E'\\x0B')\"\n end",
"def q!(query, db)\n # build bindings from references\n bindings = []\n if query.references\n query.references.each do |reference|\n bindings << @row[reference]\n end\n end\n # query\n qry = query.query.gsub(''',\"'\").gsub('"','\"') # replace single and double quotes that rexml substituted out.\n if bindings.empty?\n rows = db.connection.select_all(qry)\n else\n rows = db.connection.select_all(qry, *bindings)\n end\n result_rows = []\n rows.each do |row|\n result_rows << Row.new(query.name, row, query.attributes)\n end\n result_rows.each do |row|\n self << row\n end\n return result_rows\n end",
"def literal_blob_append(sql, v)\n sql << \"'\" << v.gsub(/[\\000-\\037\\047\\134\\177-\\377]/n){|b| \"\\\\#{(\"%o\" % b[0..1].unpack(\"C\")[0]).rjust(3, '0')}\"} << \"'\"\n end",
"def cql\n return @cql if defined?(@cql)\n \"\"\n end",
"def query_db (sql_statement)\n puts sql_statement # Option feature which will help for debugging\n db = SQLite3::Database.new 'database.sqlite3'\n db.results_as_hash = true\n result = db.execute sql_statement\n db.close\n result #implicitly returned\nend",
"def blast_string(method, db, qstring, options = nil)\n b = Blast.new(method, db, :qstring => qstring, :options => options)\n b.run!\n b\n end",
"def sql(cmd, res = [])\n @sqr = job?(cmd) ? res : job.data\n end",
"def to_sequel_blob\n SQL::Blob.new(self)\n end",
"def executeSQL(qStr, *params, &block)\n @statement_cache ||= {}\n #@statement_cache[qStr] ||= @db.prepare(qStr)\n @statement_cache[qStr] ||= qStr\n\n puts \"executeSQL: '#{qStr}', '#{params.join(\"', '\")}'\" if ::RdfContext::debug?\n if block_given?\n @db.execute(@statement_cache[qStr], *params) do |row|\n puts \"executeSQL res: #{row.inspect}\" if ::RdfContext::debug?\n row = row.keys.select{|k| k.is_a?(Integer)}.sort.map{|k| row[k]} if row.is_a?(Hash)\n yield(row)\n end\n else\n puts \"executeSQL no block given\" if ::RdfContext::debug?\n @db.execute(@statement_cache[qStr], *params)\n end\n rescue SQLite3::SQLException => e\n puts \"SQL Exception (ignored): #{e.message}\" if ::RdfContext::debug?\n end",
"def q(t)\n \n end",
"def select_data_from_db(limits)\n return unless any?\n records_array = retrieve_records(limits)\n csv_string = convert_to_csv(records_array)\n Base64.encode64(csv_string)\n end",
"def sql\n @sql ||= begin\n bind_params = []\n i = 1\n (selector_keys.length + setter_keys.length).times do\n bind_params << \"$#{i}\"\n i += 1\n end\n hstore_delete_handlers.length.times do\n bind_params << \"$#{i}::text[]\"\n i += 1\n end\n %{SELECT #{name}(#{bind_params.join(', ')})}\n end\n end",
"def sql\n @sql ||= begin\n bind_params = []\n i = 1\n (selector_keys.length + setter_keys.length).times do\n bind_params << \"$#{i}\"\n i += 1\n end\n hstore_delete_handlers.length.times do\n bind_params << \"$#{i}::text[]\"\n i += 1\n end\n %{SELECT #{name}(#{bind_params.join(', ')})}\n end\n end",
"def q(str, args = nil, &block)\r\n #If the query should be executed in a new connection unbuffered.\r\n if args\r\n if args[:cloned_ubuf]\r\n raise \"No block given.\" if !block\r\n \r\n self.cloned_conn(:clone_args => args[:clone_args]) do |cloned_conn|\r\n ret = cloned_conn.query_ubuf(str)\r\n ret.each(&block)\r\n end\r\n \r\n return nil\r\n else\r\n raise \"Invalid arguments given: '#{args}'.\"\r\n end\r\n end\r\n \r\n ret = self.query(str)\r\n \r\n if block\r\n ret.each(&block)\r\n return nil\r\n end\r\n \r\n return ret\r\n end",
"def generate_bq_query_string\n if self.is_array_based\n self.generate_array_query\n elsif self.is_numeric?\n self.generate_minmax_query\n else\n self.generate_non_array_query\n end\n end",
"def db_custom_query(query)\n db = open_create_db\n\n if db\n result = db.execute(query)\n end\n db.close\n return result\n end",
"def raw_run_sql(query)\n vprint_status \"{SQLi} Executing (#{query})\"\n if @hex_encode_strings\n query = hex_encode_strings(query)\n vprint_status \"{SQLi} Encoded to (#{query})\"\n end\n @query_proc.call(query)\n end",
"def custom_silent_sql(q)\n begin\n query = q + ';' unless q =~ /;$/\n query = @db_connection.query(\"#{query}\")\n return true\n rescue => e\n if e =~ /MySQL server has gone away/\n print_error(\"Lost MySQL Connection!\")\n print_error(\"This is likely due to payload which is too large in size.....\")\n print_error(\"Try compressing with UPX to shrink size down: upx 9 -qq payload.exe\")\n puts \"\\t=> \".white + \"Then try again\".light_red + \".....\".white\n end\n return false\n end\n end",
"def to_sequel_blob\n self\n end",
"def value\n _, _, type = @table.lookup_schema(cq)\n Util.from_bytes(type, raw)\n end",
"def to_sparql(**options)\n \"MD5(\" + operands.to_sparql(**options) + \")\"\n end",
"def make_query_packet(packet, use_tcp) #:nodoc: all\r\n if (packet.header.opcode == OpCode.QUERY || @recurse)\r\n packet.header.rd=true\r\n end\r\n \r\n if (@dnssec)\r\n # RFC 3225\r\n TheLog.debug(\";; Adding EDNS extention with UDP packetsize #{udp_packet_size} and DNS OK bit set\\n\")\r\n optrr = RR::OPT.new(udp_packet_size) # Decimal UDPpayload\r\n optrr.d_o=true\r\n \r\n packet.add_additional(optrr)\r\n \r\n elsif ((udp_packet_size > Resolver::DefaultUDPSize) && !use_tcp)\r\n TheLog.debug(\";; Adding EDNS extention with UDP packetsize #{udp_packet_size}.\\n\")\r\n # RFC 3225\r\n optrr = RR::OPT.new(udp_packet_size)\r\n \r\n packet.add_additional(optrr)\r\n end\r\n \r\n if (@tsig && !packet.signed?)\r\n @tsig.apply(packet)\r\n end\r\n return packet.encode\r\n end",
"def initialize( db, sql )\n @db = db\n #prepare_method = @db.utf16? ? :prepare16 : :prepare\n prepare_method = :prepare\n @param_positions = {}\n @stmt_api = @db.api.send( prepare_method, sql )\n @blobs_to_write = []\n @rowid_index = nil\n @result_meta = nil\n @open = true\n end",
"def query(_tql)\n raise NotImplementedError.new\n end",
"def get_budgets(db)\r\n budgets = db.execute(\"SELECT * FROM budgets\")\r\nend",
"def add_quote(msg)\n\n @db.execute(\"INSERT INTO quotes VALUES(NULL,?)\",msg)\n\n puts \"I added #{msg} to quotes database\"\n return @db.get_first_value(\"SELECT id FROM quotes ORDER BY id DESC LIMIT 1;\")\n end",
"def to_db(ex,db)\n begin\n db_val1, hop_val1 = @expr1.to_db(ex,db)\n db_val2, hop_val2 = @expr2.to_db(ex,db)\n if @short\n #short-circuit\n if not db_val1.nil? and not db_val2.nil?\n #all calculated\n\n case op\n when 'and'\n db_cond=db.and(db_val1, db_val2)\n db_cond=db_val1 if db_cond.nil?\n return db_cond, self\n when 'or'\n return db.or(db_val1, db_val2), self\n else\n hop_warn \"#{op}: unsupported short-cirtuit binary operator\"\n return nil, self\n end\n else\n # sometnig cannot be calculated\n case op\n when 'or'\n # 8( all DB must be searched...\n return nil, self\n when 'and'\n return db_val2, self if(db_val1.nil?)\n return db_val1, self\n else\n hop_warn \"#{op}: unsupported short-cirtuit binary operator\"\n return nil, nil\n end\n end #if calculated\n elsif op == 'ins'\n # nodeset\n res = nil\n db_res = db.inset db_val1, db_val2\n return db_res, self\n else\n #full evaluation\n #if @pre_conv\n # hop_val1 = hop_val1.to_f\n # hop_val2 = hop_val2.to_f\n #end\n res = nil\n db_res = db.binary(db_val1,db_val2,@op)\n\n #res = res.to_s if @post_conv\n\n return db_res, self\n end\n rescue => e\n raise #e.message+' at line '+@code_line.to_s\n end\n end",
"def as_sql(expression, aliaz)\n \"#{expression} #{quote_identifier(aliaz)}\"\n end",
"def query_thredis(prepare_only)\n if prepare_only\n @rows = @connection.redis.sqlprepare(@sql)\n else\n @rows = @connection.redis.sql(@sql, *@params)\n @prepare_only = false\n end\n if @rows.is_a? Integer\n @rows, @columns, @connection.changes = [], [], @rows\n else\n @columns = @rows.shift\n## @rows = convert_type(@rows, @columns)\n end\n end",
"def query(query_definition)\n return\n end",
"def sql! sql=nil\n require 'niceql'\n puts Niceql::Prettifier.prettify_sql sql || $last_sql_command\n end",
"def query\n end",
"def sparql_up\n begin\n direct_query \"ASK { ?s ?p ?o }\"\n rescue\n false\n end\nend",
"def db(*args); data(1, args); end",
"def to_cql\n \"ORDER BY #{@field} #{@dir.to_s.upcase}\"\n end",
"def sql_string\n self\n end",
"def query(query)\n res = LibDrizzle.drizzle_query_str(@con_ptr, nil, query, @ret_ptr)\n check_return_code\n Result.new(res)\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 run_sql(sql)\n\tconn = PG.connect(dbname: \"video_store\", host: 'localhost')\n\tresult = conn.exec(sql)\n\tconn.close\n\tresult \nend",
"def commit(q)\n\t\tdbh=Mysql.init\n\t\tdbh.real_connect(@host, @user, @password, @db,@port,nil,Mysql::CLIENT_MULTI_RESULTS)\n\t\tdbh.query_with_result=false\n\t\tdbh.query(q)\n\t\t\tbegin\n\t\t\t rs = dbh.use_result\n\t\t\trescue Mysql::Error => e \n\t\t\t no_more_results=true\n\t\t\tend \n\t\tif rs.fetch_row == nil\n\t\t\treturn nil\n\t\telse\n\t\t\treturn rs\n\t\tend\n\tend",
"def run\r\n ridFieldName = @qbc.lookupFieldNameFromID( \"3\")\r\n records = Records.new\r\n @qbc.iterateRecords(@dbid,@qbc.getFieldNames(@dbid),nil,@id,nil,qyclst()){|qb_record|\r\n record = Record.new\r\n record.build(@qbc,ridFieldName, qb_record)\r\n records << record\r\n }\r\n records\r\n end"
] |
[
"0.57243073",
"0.57214373",
"0.5711187",
"0.56434405",
"0.5637402",
"0.56352603",
"0.562154",
"0.5586893",
"0.5579014",
"0.55219436",
"0.5497306",
"0.5494304",
"0.54799455",
"0.54527503",
"0.54382294",
"0.5436169",
"0.54321504",
"0.541295",
"0.5396465",
"0.5388015",
"0.5375876",
"0.5375876",
"0.53649133",
"0.53495157",
"0.53441834",
"0.5321065",
"0.5313847",
"0.5282868",
"0.52638155",
"0.52502257",
"0.524309",
"0.5216011",
"0.51888865",
"0.5187664",
"0.5184035",
"0.516905",
"0.5167027",
"0.5158669",
"0.5145905",
"0.5142369",
"0.5141476",
"0.513568",
"0.51256794",
"0.5109919",
"0.5104619",
"0.51040417",
"0.5092631",
"0.5083418",
"0.5083043",
"0.5067311",
"0.5061645",
"0.50603294",
"0.50523734",
"0.50464594",
"0.5045067",
"0.50327015",
"0.50132066",
"0.5002594",
"0.50024205",
"0.49959606",
"0.4994788",
"0.49940023",
"0.4991332",
"0.49882475",
"0.498324",
"0.49796245",
"0.4979149",
"0.4975935",
"0.49709502",
"0.4970309",
"0.49681646",
"0.49676648",
"0.49676648",
"0.49617374",
"0.4951616",
"0.49475166",
"0.49459136",
"0.4940191",
"0.49383056",
"0.492911",
"0.49268278",
"0.49123406",
"0.49114263",
"0.49109766",
"0.49106607",
"0.49106005",
"0.49084494",
"0.49069393",
"0.49046007",
"0.49028933",
"0.48997176",
"0.48927966",
"0.48893178",
"0.48891973",
"0.48847088",
"0.4881138",
"0.48727888",
"0.4871003",
"0.48702928",
"0.4869654",
"0.4866313"
] |
0.0
|
-1
|
codecite sq codecite gdi
|
def print_string_message_gdi
puts %q{Double-quoted strings can include escaped characters such as \n and \\\\
as well as interpolated Ruby expressions like #{Time.now}.}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def grid_image\n s = ''\n s << \" %s %s %s \\n\" % [own(256), own(128), own(64)]\n s << \" %s %s %s \\n\" % [own(32), own(16), own(8)]\n s << \" %s %s %s \\n\" % [own(4), own(2), own(1)]\n s\n end",
"def to_abgr_stream\n pixels.pack(\"V*\")\n end",
"def test055()\n begin\n theCommands = CommandModule::SmigCommands.new\n theSize = MIShapes.make_size(4, 1)\n bitmapObject = theCommands.make_createbitmapcontext(\n size: theSize,\n addtocleanup: true,\n preset: \"AlphaPreMulFirstRGB8bpcInt\")\n fillRect = MIDrawElement.new(:fillrectangle)\n fillRect.rectangle = MIShapes.make_rectangle(size: theSize)\n fillRect.fillcolor = MIColor.make_rgbacolor(1,0,0)\n\n drawCommand = CommandModule.make_drawelement(bitmapObject,\n drawinstructions: fillRect)\n theCommands.add_command(drawCommand)\n pixelDataRect = MIShapes.make_rectangle(xloc: 0, yloc: 0,\n width: 1, height: 1)\n getPixelDataCommand = CommandModule.make_getpixeldata(\n bitmapObject,\n rectangle: pixelDataRect)\n theCommands.add_command(getPixelDataCommand)\n theResult = Smig.perform_commands(theCommands)\n previousResult = '{\"pixeldata\":[[0,0,255,255,0,0]],\"contextinfo\":{\"alphainfo\":16386,\"bitspercomponent\":8,\"colorspace\":\"kCGColorSpaceSRGB\",\"bitsperpixel\":32},\"columnnames\":[\"x\",\"y\",\"Alpha\",\"Red\",\"Green\",\"Blue\"]}'\n if theResult != previousResult\n puts theResult\n raise \"Pixel data has changed.\"\n end\n \n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: #{Smig.exitstring}\"\n end\n puts e.message\n puts e.backtrace.to_s\n puts #{Smig.exitstring}\"\n ensure\n end\nend",
"def make_bitmap_data1\r\n w = @bitmap.width\r\n h = @bitmap.height\r\n data = []\r\n for y in 0...h\r\n data.push(0)\r\n for x in 0...w\r\n color = @bitmap.get_pixel(x, y)\r\n red = color.red\r\n green = color.green\r\n blue = color.blue\r\n alpha = color.alpha\r\n data.push(red)\r\n data.push(green)\r\n data.push(blue)\r\n data.push(alpha)\r\n end\r\n end\r\n return data.pack(\"C*\")\r\n end",
"def sgl_from_text(txt, little_endian=true)\n code = little_endian ? 'e':'g'\n [txt].pack(code)\nend",
"def postgres_base64_data(data)\n [data].pack(\"m*\").gsub(/\\r?\\n/,\"\")\n end",
"def cp_d8\n end",
"def cobasysprog\n end",
"def static_sql_bytesize\n @static_sql_bytesize ||= insert_part.bytesize + update_part.bytesize + 2\n end",
"def qrgen\n end",
"def giga\n big_self * GIGA\n end",
"def bind_string(stmt, index, value)\n case value.encoding\n when Encoding.utf_8, Encoding.us_ascii\n API.sqlite3_bind_text(stmt, index, value, value.bytesize, TRANSIENT)\n when Encoding.utf_16le, Encoding.utf_16be\n value = add_byte_order_mask(value)\n API.sqlite3_bind_text16(stmt, index, value, value.bytesize, TRANSIENT)\n else\n API.sqlite3_bind_blob(stmt, index, value, value.bytesize, TRANSIENT)\n end\n end",
"def encoding\n @gapi.encoding\n end",
"def encoding\n @gapi.encoding\n end",
"def as_ewkb(allow_srid=true,allow_z=true,allow_m=true)\r\n ewkb=\"\";\r\n \r\n ewkb << 1.chr #little_endian by default\r\n \r\n type= binary_geometry_type\r\n if @with_z and allow_z\r\n type = type | Z_MASK\r\n end\r\n if @with_m and allow_m\r\n type = type | M_MASK\r\n end\r\n if allow_srid\r\n type = type | SRID_MASK\r\n ewkb << [type,@srid].pack(\"VV\")\r\n else\r\n ewkb << [type].pack(\"V\")\r\n end\r\n \r\n ewkb << binary_representation(allow_z,allow_m)\r\n end",
"def basic_bitmap(width, height)\n bmp = Bitmap.new(width, height)\n bmp.font.color = Color.new(255, 255, 255)\n bmp.font.size = 15\n bmp.font.shadow = true\n bmp.font.bold = false\n bmp.font.italic = false\n bmp\n end",
"def kex_byte_requirement; end",
"def generateQRCode\n id = params[:id]\n\n #on recherche l'enregistrement correspondant\n query = Qrmodel.find(id)\n query_string = query.to_s\n\n #on commence le processus de rendu du qrcode\n qrcode = RQRCode::QRCode.new(query_string)\n qrmodel.qrcode.attach(\n qrcode.as_png(\n resize_gte_to: false,\n resize_exactly_to: false,\n fill: 'white',\n color: 'black',\n size: 360,\n border_modules: 4,\n module_px_size: 6,\n file: Rails.root.join(\"tmp/#{SecureRandom.hex(2).parameterize}.png\")\n )\n )\n\n end",
"def tip_bitmap(width)\n bit = basic_bitmap(width, 24)\n\n # creazione dello sfondo\n bit.fill_rect(2, 2, bit.width - 4, bit.height - 4, Color.new(0, 0, 0, 128))\n bit.blur\n\n text_width = width / 2 - 24\n text_height = bit.height\n\n # scrittura primo comando\n bit.draw_key_icon(HIDE_MAP_KEY, 0, 0)\n bit.draw_text(24, 0, text_width, text_height, Vocab.minimap_hide)\n\n # scrittura secondo comando\n bit.draw_key_icon(WORLDMAP_KEY, width / 2, 0)\n bit.draw_text(width / 2 + 24, 0, text_width, text_height, Vocab.go_worldmap)\n\n bit\n end",
"def byte cols\n decode_values :byte, cols\n end",
"def make_bitmap_data0\r\n gz = Zlib::GzipWriter.open('hoge.gz')\r\n t_Fx = 0\r\n w = @bitmap.width\r\n h = @bitmap.height\r\n data = []\r\n for y in 0...h\r\n data.push(0)\r\n for x in 0...w\r\n t_Fx += 1\r\n if t_Fx % 10000 == 0\r\n Graphics.update\r\n end\r\n if t_Fx % 100000 == 0\r\n s = data.pack(\"C*\")\r\n gz.write(s)\r\n data.clear\r\n end\r\n color = @bitmap.get_pixel(x, y)\r\n red = color.red\r\n green = color.green\r\n blue = color.blue\r\n alpha = color.alpha\r\n data.push(red)\r\n data.push(green)\r\n data.push(blue)\r\n data.push(alpha)\r\n end\r\n end\r\n s = data.pack(\"C*\")\r\n gz.write(s)\r\n gz.close \r\n data.clear\r\n gz = Zlib::GzipReader.open('hoge.gz')\r\n data = gz.read\r\n gz.close\r\n File.delete('hoge.gz')\r\n return data\r\n end",
"def record(width, height, &rendering_code); end",
"def to_BMP\n CPL::Tools::Alchemy::BMP::Base.new(file.read,:string)\n end",
"def import_pixels(blob, columns, rows, depth, map, format = T.unsafe(nil)); end",
"def codec_3gp\n \"-ar 22050 -ab 32 -sameq -an -y\"\n end",
"def content\n [\n width,\n height,\n depth,\n color,\n compression,\n filtering,\n interlace,\n ].pack(\"NNC5\")\n end",
"def compression\n @gapi.compression\n end",
"def test03()\n begin\n createBitmapCommand = CommandModule.make_createbitmapcontext(\n width: 512,\n height: 342,\n preset: :AlphaPreMulLastRGB32bpcFloat)\n objectRef = Smig.perform_command(createBitmapCommand).to_i\n objectID = SmigIDHash.make_objectid(objectreference: objectRef)\n objectType = Smig.get_objectproperty(objectID, property: :objecttype)\n unless objectType.eql? \"bitmapcontext\"\n puts \"1: Returned object type is: #{objectType}\"\n end\n getObjectPropertiesCommand = CommandModule.make_get_objectproperties(objectID)\n result = Smig.perform_command(getObjectPropertiesCommand)\n bitmapContextProperties = '{\"height\":342,\"objecttype\":\"bitmapcontext\",\"bitspercomponent\":32,\"colorspacename\":\"kCGColorSpaceSRGB\",\"preset\":\"AlphaPreMulLastRGB32bpcFloat\",\"width\":512,\"alphaandbitmapinfo\":8450,\"bitsperpixel\":128,\"bytesperrow\":8192,\"objectreference\":0,\"objectname\":\"\"}'\n contextPropHash = JSON.parse(bitmapContextProperties)\n resultHash = JSON.parse(result)\n if AreBitmapPropertiesHashDiff(contextPropHash, resultHash)\n puts \"2: Bitmap properties different. String: #{result}\"\n end\n\n width = Smig.get_objectproperty(objectID, property: :width).to_i\n unless width.eql? 512\n puts \"3: Width returned from bitmap contex different: #{width}\"\n end\n\n height = Smig.get_objectproperty(objectID, property: :height).to_i\n unless height.eql? 342\n puts \"4: Height returned from bitmap contex different: #{height}\"\n end\n\n bitsPerComponent = Smig.get_objectproperty(objectID,\n property: :bitspercomponent).to_i\n unless bitsPerComponent.eql? 32\n puts \"5: Bits per component returned from bitmap contex different: #{bitsPerComponent}\"\n end\n\n bitsPerPixel = Smig.get_objectproperty(objectID, property: :bitsperpixel).to_i\n unless bitsPerPixel.eql? 128\n puts \"6: Bits per pixel returned from bitmap contex different: #{bitsPerPixel}\"\n end\n\n bytesPerRow = Smig.get_objectproperty(objectID, property: :bytesperrow).to_i\n unless bytesPerRow.eql? 8192\n puts \"7: Bytes per row returned from bitmap contex different: #{bytesPerRow}\"\n end\n\n colorSpaceName = Smig.get_objectproperty(objectID, property: :colorspacename)\n unless colorSpaceName.eql? \"kCGColorSpaceSRGB\"\n puts \"8: Colorspace name returned from bitmap contex different: #{colorSpaceName}\"\n end\n\n alphaBitmapInfo = Smig.get_objectproperty(objectID, property: :alphaandbitmapinfo)\n unless alphaBitmapInfo.eql? \"8450\"\n puts \"9: Alpha & Bitmap info returned from bitmap contex different: #{alphaBitmapInfo}\"\n end\n\n preset = Smig.get_objectproperty(objectID, property: :preset)\n unless preset.eql? \"AlphaPreMulLastRGB32bpcFloat\"\n puts \"10: Preset returned from bitmap contex different: #{preset}\"\n end\n\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts $teststring + \" Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n ensure\n Smig.close_object_nothrow(objectID)\n end\nend",
"def g3\n [0x00, 0x03, 0x06, 0x05, 0x0c, 0x0f, 0x0a, 0x09, 0x18, 0x1b, 0x1e, 0x1d, 0x14, 0x17, 0x12, 0x11,\n 0x30, 0x33, 0x36, 0x35, 0x3c, 0x3f, 0x3a, 0x39, 0x28, 0x2b, 0x2e, 0x2d, 0x24, 0x27, 0x22, 0x21,\n 0x60, 0x63, 0x66, 0x65, 0x6c, 0x6f, 0x6a, 0x69, 0x78, 0x7b, 0x7e, 0x7d, 0x74, 0x77, 0x72, 0x71,\n 0x50, 0x53, 0x56, 0x55, 0x5c, 0x5f, 0x5a, 0x59, 0x48, 0x4b, 0x4e, 0x4d, 0x44, 0x47, 0x42, 0x41,\n 0xc0, 0xc3, 0xc6, 0xc5, 0xcc, 0xcf, 0xca, 0xc9, 0xd8, 0xdb, 0xde, 0xdd, 0xd4, 0xd7, 0xd2, 0xd1,\n 0xf0, 0xf3, 0xf6, 0xf5, 0xfc, 0xff, 0xfa, 0xf9, 0xe8, 0xeb, 0xee, 0xed, 0xe4, 0xe7, 0xe2, 0xe1,\n 0xa0, 0xa3, 0xa6, 0xa5, 0xac, 0xaf, 0xaa, 0xa9, 0xb8, 0xbb, 0xbe, 0xbd, 0xb4, 0xb7, 0xb2, 0xb1,\n 0x90, 0x93, 0x96, 0x95, 0x9c, 0x9f, 0x9a, 0x99, 0x88, 0x8b, 0x8e, 0x8d, 0x84, 0x87, 0x82, 0x81,\n 0x9b, 0x98, 0x9d, 0x9e, 0x97, 0x94, 0x91, 0x92, 0x83, 0x80, 0x85, 0x86, 0x8f, 0x8c, 0x89, 0x8a,\n 0xab, 0xa8, 0xad, 0xae, 0xa7, 0xa4, 0xa1, 0xa2, 0xb3, 0xb0, 0xb5, 0xb6, 0xbf, 0xbc, 0xb9, 0xba,\n 0xfb, 0xf8, 0xfd, 0xfe, 0xf7, 0xf4, 0xf1, 0xf2, 0xe3, 0xe0, 0xe5, 0xe6, 0xef, 0xec, 0xe9, 0xea,\n 0xcb, 0xc8, 0xcd, 0xce, 0xc7, 0xc4, 0xc1, 0xc2, 0xd3, 0xd0, 0xd5, 0xd6, 0xdf, 0xdc, 0xd9, 0xda,\n 0x5b, 0x58, 0x5d, 0x5e, 0x57, 0x54, 0x51, 0x52, 0x43, 0x40, 0x45, 0x46, 0x4f, 0x4c, 0x49, 0x4a,\n 0x6b, 0x68, 0x6d, 0x6e, 0x67, 0x64, 0x61, 0x62, 0x73, 0x70, 0x75, 0x76, 0x7f, 0x7c, 0x79, 0x7a,\n 0x3b, 0x38, 0x3d, 0x3e, 0x37, 0x34, 0x31, 0x32, 0x23, 0x20, 0x25, 0x26, 0x2f, 0x2c, 0x29, 0x2a,\n 0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a][self]\n end",
"def fh\n return hex_side_length + 2 * th\n end",
"def write_on_bitmap\n draw_key_icon(@key, padding, padding)\n x = padding + 26\n y = padding\n w = @width\n h = base_height\n bitmap.draw_text(x, y, w, h, @text)\n end",
"def encoding\n select_value(\"SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname LIKE '#{current_database}'\", 'SCHEMA')\n end",
"def pack_format\n \"a#{width}\"\n end",
"def enc_table\r\n if !@enc_table\r\n self.conn_exec do |driver|\r\n @enc_table = driver.escape_table\r\n end\r\n end\r\n \r\n return @enc_table\r\n end",
"def generate_gid(type, id)\n Base64.strict_encode64([\"0\", type.length, \":\", type, id.to_s].join)\nend",
"def test04()\n begin\n origModes = \"kCGBlendModeNormal kCGBlendModeMultiply kCGBlendModeScreen \"+\n \"kCGBlendModeOverlay kCGBlendModeDarken kCGBlendModeLighten \" + \n \"kCGBlendModeColorDodge kCGBlendModeColorBurn kCGBlendModeSoftLight \" +\n \"kCGBlendModeHardLight kCGBlendModeDifference kCGBlendModeExclusion \" +\n \"kCGBlendModeHue kCGBlendModeSaturation kCGBlendModeColor \" +\n \"kCGBlendModeLuminosity kCGBlendModeClear kCGBlendModeCopy \" +\n \"kCGBlendModeSourceIn kCGBlendModeSourceOut kCGBlendModeSourceAtop \" +\n \"kCGBlendModeDestinationOver kCGBlendModeDestinationIn \" +\n \"kCGBlendModeDestinationOut kCGBlendModeDestinationAtop kCGBlendModeXOR \" +\n \"kCGBlendModePlusDarker kCGBlendModePlusLighter\"\n blendModes = MIMeta.listcgblendmodes\n unless origModes.eql? blendModes\n raise \"Blend modes are different, new:\" + blendModes\n end\n\n origPresets = \"AlphaOnly8bpcInt Gray8bpcInt Gray16bpcInt Gray32bpcFloat \" +\n \"AlphaSkipFirstRGB8bpcInt AlphaSkipLastRGB8bpcInt \"+\n \"AlphaPreMulFirstRGB8bpcInt AlphaPreMulBGRA8bpcInt AlphaPreMulLastRGB8bpcInt \" +\n \"AlphaPreMulLastRGB16bpcInt AlphaSkipLastRGB16bpcInt \" +\n \"AlphaSkipLastRGB32bpcFloat AlphaPreMulLastRGB32bpcFloat \" +\n \"CMYK8bpcInt CMYK16bpcInt CMYK32bpcFloat PlatformDefaultBitmapContext\"\n presets = MIMeta.listpresets\n unless origPresets.eql? presets\n raise \"Presets are different, new:\" + presets\n end\n\n origCommands = [:getproperty, :setproperty, :getproperties, :setproperties,\n :create, :close, :closeall, :addimage, :export, :drawelement, :snapshot,\n :finalizepage, :getpixeldata, :calculategraphicsizeoftext, :renderfilterchain,\n :assignimagetocollection, :removeimagefromcollection, :processframes,\n :createtrack, :addinputtowriter, :addimagesampletowriter,\n :finishwritingframes, :cancelwritingframes, :addmovieinstruction,\n :inserttracksegment, :insertemptytracksegment]\n\n commands = MIMeta.listallcommands\n unless origCommands.eql? commands\n raise \"Command lists are different, new:\" + commands.to_s\n end\n\n origObjects = [:bitmapcontext, :imageimporter, :imageexporter,\n :imagefilterchain, :pdfcontext, :nsgraphiccontext,\n :movieimporter, :movieeditor, :videoframeswriter]\n objectTypes = MIMeta.listobjecttypes\n\n unless origObjects.eql? objectTypes\n raise \"List of objects is different, new:\" + commands.to_s\n end\n\n origInputVideoWriterPresets = \"h264preset_sd jpegpreset h264preset_hd \" +\n \"prores4444preset prores422preset\"\n \n videoWriterPresets = MIMeta.listvideoframewriterpresets\n unless origInputVideoWriterPresets.eql? videoWriterPresets\n raise \"List of video writer presets is different, new:\" + videoWriterPresets.to_s\n end\n\n origUserInterfaceFonts = \"kCTFontUIFontMiniEmphasizedSystem \" +\n \"kCTFontUIFontSmallToolbar kCTFontUIFontWindowTitle \" +\n \"kCTFontUIFontMenuTitle kCTFontUIFontSystem kCTFontUIFontMenuItem \" +\n \"kCTFontUIFontEmphasizedSystem kCTFontUIFontToolbar kCTFontUIFontMessage \" +\n \"kCTFontUIFontEmphasizedSystemDetail kCTFontUIFontSmallEmphasizedSystem \" +\n \"kCTFontUIFontUserFixedPitch kCTFontUIFontMiniSystem kCTFontUIFontLabel \" +\n \"kCTFontUIFontControlContent kCTFontUIFontSystemDetail kCTFontUIFontViews \"+\n \"kCTFontUIFontUser kCTFontUIFontSmallSystem kCTFontUIFontApplication\" +\n \"kCTFontUIFontToolTip\"\n \n userInterfaceFonts = MIMeta.listuserinterfacefonts\n unless userInterfaceFonts.eql? userInterfaceFonts\n raise \"User iterface fonts are different, new:\" + userInterfaceFonts\n end\n\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: #{Smig.get_exitstring}\"\n end\n puts e.message\n puts e.backtrace.to_s\n puts #{Smig.exitstring}\"\n# exit 240\n end\nend",
"def content\n [width, height, depth, color, compression, filtering, interlace].pack('NNC5')\n end",
"def bcctx\n return ByteCodes.new, Context.new\nend",
"def cgimage\n CGBitmapContextCreateImage(@ctx) # => CGImageRef (works with bitmap context only)\n #cgimageref = CGImageCreate(@width, @height, @bits_per_component, nil,nil,@colorspace, nil, @provider,nil,true,KCGRenderingIntentDefault)\n end",
"def test_06b\r\n db = build\r\n db.fetch('image-1.jpg',:width => 102)\r\n db.fetch('image-1.jpg',:width => 103)\r\n db.fetch('image-1.jpg',:width => 104)\r\n db.fetch('image-1.jpg',:height => 105)\r\n r = db.image('image-1.jpg')\r\n assert_equal 'image-1.jpg',r[:original]\r\n end",
"def new_character(unicode)\n {:width=>\"1000\", :flags=>\"W\", :layercount=>\"2\", :splineset=>\"\", :unicode=>unicode}\n end",
"def use_autowidth() @use_autowidth; end",
"def image_hwstring(width, height)\n out = ''\n if width\n out += 'width=\"' + width.to_i.to_s + '\" '\n end\n if height\n out += 'height=\"' + height.to_i.to_s + '\" '\n end\n out\n end",
"def base_width; 26 + @width; end",
"def store_guts #:nodoc:\n record = 0x0080 # Record identifier\n length = 0x0008 # Bytes to follow\n\n dxRwGut = 0x0000 # Size of row gutter\n dxColGut = 0x0000 # Size of col gutter\n\n row_level = @outline_row_level\n col_level = 0\n\n\n # Calculate the maximum column outline level. The equivalent calculation\n # for the row outline level is carried out in set_row().\n #\n @colinfo.each do |colinfo|\n # Skip cols without outline level info.\n next if colinfo.size < 6\n col_level = colinfo[5] if colinfo[5] > col_level\n end\n\n # Set the limits for the outline levels (0 <= x <= 7).\n col_level = 0 if col_level < 0\n col_level = 7 if col_level > 7\n\n # The displayed level is one greater than the max outline levels\n row_level = row_level + 1 if row_level > 0\n col_level = col_level + 1 if col_level > 0\n\n header = [record, length].pack(\"vv\")\n data = [dxRwGut, dxColGut, row_level, col_level].pack(\"vvvv\")\n\n prepend(header, data)\n end",
"def basic_pixel_format\n\n\t\tattributes\t\t= Pointer.new_with_type('I', 5)\n\t\tattributes[0]\t= NSOpenGLPFAWindow\n\t\tattributes[1]\t= NSOpenGLPFADoubleBuffer\t\t\t# double buffered\n\t\tattributes[2]\t= NSOpenGLPFADepthSize\n\t\tattributes[3]\t= 16\t\t\t\t\t\t\t\t# 16 bit depth buffer\n\t\tattributes[4]\t= 0\t\t\t\t\t\t\t\t\t# 0 terminated list of attributes\n\n\t\tpixel_format\t= NSOpenGLPixelFormat.alloc.initWithAttributes(attributes)\n\n\t\treturn pixel_format\n\n\tend",
"def sbc_a_d8\n end",
"def create\n @bar_code = BarCode.new(bar_code_params)\n gen = Barby::Code128B.new(@bar_code.text)\n send_data gen.to_png(:height => 50), :type => \"image/png\", :disposition => \"inline\"\n\n @bar_code.save\n\n\n\n end",
"def image\r\n buf = \"\\x00\" * 256\r\n if Ragweed::Wrap32::nt_query_information_process(@h, 27, buf)\r\n buf = buf.from_utf16\r\n buf = buf[(buf.index(\"\\\\\"))..-1]\r\n return buf.asciiz\r\n end\r\n nil\r\n end",
"def generate_byte_code\n abc = ARuby::SWF::ABC.new\n \n @classes.each do |klass|\n abc.create_class(klass)\n end\n \n abc.serialize.to_s\n end",
"def content\n [\n keyword,\n ChunkyPNG::COMPRESSION_DEFAULT,\n Zlib::Deflate.deflate(value),\n ].pack(\"Z*Ca*\")\n end",
"def set_one_pixel(pixelno,r,g,b)\n# puts \"Set one pixel length packetdata in \" + @@packetdata.size.to_s\n pixelno = pixelno % @@numpixels\n if r < 256 then\n temp = [r]\n @@packetdata[pixelno * 3] = temp.pack(\"C\")\n end\n if g < 256 then\n temp = [g]\n @@packetdata[(pixelno * 3) + 1] = temp.pack(\"C\")\n end\n if b < 256 then\n temp = [b]\n @@packetdata[(pixelno * 3) + 2] = temp.pack(\"C\") \n end \nend",
"def quadkey level, x, y\n\t\t\tx_chars = x.bin_str(level).split \"\"\n\t\t\ty_chars = y.bin_str(level).split \"\"\n\n\t\t\ty_chars.zip(x_chars).flatten.join(\"\").to_i(2).to_s(4).rjust(level, \"0\")\n\t\tend",
"def write_on_bitmap\n draw_key_icon(@key, padding, padding)\n x = padding + 24\n y = padding\n w = SKC_Settings::WIDTH\n h = base_height\n bitmap.draw_text(x, y, w, h, @text)\n end",
"def to_param\r\n pixi_id\r\n end",
"def bumpspark( results )\r\n white, red, grey = [0xFF,0xFF,0xFF], [0,0,0xFF], [0x99,0x99,0x99]\r\n ibmp = results.inject([]) do |ary, r|\r\n ary << [white]*15 << [white]*15\r\n ary.last[r/9,4] = [(r > 50 and red or grey)]*4\r\n ary\r\n end.transpose.map do |px|\r\n px.flatten!.pack(\"C#{px.length}x#{px.length%4}\")\r\n end.join\r\n [\"BM\", ibmp.length + 54, 0, 0, 54, 40, results.length * 2, 15, 1, 24, 0, 0, 0, 0, 0, 0].pack(\"A2ISSIIiiSSIIiiII\") + ibmp\r\nend",
"def create_genre(db)\r\n create_genre_cmd = <<-SQL\r\n CREATE TABLE IF NOT EXISTS genre(\r\n genre_id INTEGER PRIMARY KEY,\r\n genre_name VARCHAR(255)\r\n )\r\n SQL\r\n #create table genre\r\n db.execute(create_genre_cmd)\r\nend",
"def createAscii(options = {})\n if @status == true\n options = {\"width\" => 90, \"color\" => true}.merge(options)\n\t img = Magick::Image.from_blob(@data).first\n\t width = options[\"width\"]\n\t scale = (width.to_f / img.columns)\n\t \n\t height = ((img.rows * scale) / 2).to_i\n\t # puts height\n\t if height >= 100\n\t \theight = 80\n\t end\n\n\t border = \"+#{'-' * width}+\\n\"\n\t output = border.dup\n\n\t img.resize!(width, height)\n\t color_image = img.dup if options[\"color\"]\n\t img = img.quantize(@image_chars.length, Magick::GRAYColorspace).normalize\n\t quantum_calc = Magick::QuantumRange / (@image_chars.length - 1)\n\n\t \n\t img.view(0, 0, width, height) do |view|\n\t \n\t height.times do |i|\n\t \n\t output << '|'\n\t width.times do |j|\n\n\t character = @image_chars[view[i][j].red/quantum_calc] \n\n\t if options[\"color\"]\n\t pix = color_image.pixel_color(j,i)\n\t character = character.color(unified_rgb_value(pix.red), unified_rgb_value(pix.green), unified_rgb_value(pix.blue))\n\t end\n\n\t output << character\n\t end\n\n\t output << \"|\\n\"\n\t end\n\t end\n\n\n\t output << border\n\t return output\n end\n end",
"def encode_small\n encode \"small\"\n end",
"def internal_encoding()\n #This is a stub, used for indexing\n end",
"def content\n [keyword, ChunkyPNG::COMPRESSION_DEFAULT, Zlib::Deflate.deflate(value)].pack('Z*Ca*')\n end",
"def imageSteg(data, password, image)\n # Suck in the image\n original_image = Magick::Image.read(image).first\n\n # Get the number of pixels in the current image\n pixels = Images.numberOfPixels(image)\n\n # Get the number of bits that can be utilized in the image\n # 3 bits (RGB) per pixel\n image_bits = pixels * 3\n\n # Encrypt the data with the password\n cipher = Gibberish::AES.new(password)\n encrypted_data = cipher.encrypt(data, :binary => true)\n\n # Convert the encrypted input to a binary value\n binary = Stegg.convertStringToBinary(encrypted_data)\n\n # Get the number of bits for the binary value\n # This should be a multiple of 128 using AES encryption\n data_bits = Stegg.getBits(binary)\n\n # Encrypt the length bits\n encrypted_length_bits = cipher.encrypt(data_bits.to_s(), :binary => true)\n\n # Convert the encrypted length bits to a binary value\n # This should be 128 bits using AES encryption\n binary_length = Stegg.convertStringToBinary(encrypted_length_bits)\n\n # Data is the binary_length + binary data\n data = binary_length[0] + binary[0]\n\n # Make sure we don't have more data than the image can handle\n if (data.length <= image_bits)\n # Create a new empty image to modify\n new_image = Magick::Image.new(original_image.columns, original_image.rows)\n\n # Initialize the new_pixels array\n @new_pixels = []\n\n # For each pixel in the original image\n # For 8-bit QuantumDepth the QuantumRange is 255\n # For 16-bit QuantumDepth the QuantumRange is 65535\n # For 32-bit QuantumDepth the QuantumRange is 4294967295\n original_image.each_pixel do |pixel, col, row|\n # Set data to empty\n data1 = \"\"\n data2 = \"\"\n data3 = \"\"\n\n # Set colors to their current value\n red = pixel.red\n green = pixel.green\n blue = pixel.blue\n\n # If the data is not empty\n # Grab the first character of data\n if (data.length > 0)\n data1 = data[0]\n data.slice!(0)\n \n # If the data is even and the red pixel is odd\n if ((data1%2 == \"0\") && (red%2 == 1))\n # Change the red to even\n #puts(\"Change red to even\")\n red = red - 1\n end\n\n # If the data is odd and the red pixel is even\n if ((data1%2 == \"1\") && (red%2 == 0))\n # Change the red to odd\n #puts(\"Change red to odd\")\n red = red + 1\n end\n end\n\n # If the data is not empty\n # Grab the second character of data\n if (data.length > 0)\n data2 = data[0]\n data.slice!(0)\n\n # If the data is even and the green pixel is odd\n if ((data2%2 == \"0\") && (green%2 == 1))\n # Change the green to even\n #puts(\"Change green to even\")\n green = green - 1\n end\n \n # If the data is odd and the green pixel is even\n if ((data2%2 == \"1\") && (green%2 == 0))\n # Change the green to odd\n #puts(\"Change green to odd\")\n green = green + 1\n end\n end\n\n # If the data is not empty\n # Grab the third character of data\n if (data.length > 0)\n data3 = data[0]\n data.slice!(0)\n\n # If the data is even and the blue pixel is odd\n if ((data3%2 == \"0\") && (blue%2 == 1))\n # Change the blue to even\n #puts(\"Change blue to even\")\n blue = blue - 1\n end\n \n # If the data is odd and the blue pixel is even\n if ((data3%2 == \"1\") && (blue%2 == 0))\n # Change the blue to odd\n #puts(\"Change blue to odd\")\n blue = blue + 1\n end\n end\n\n # Save the pixel to the pixel array\n @new_pixels << Magick::Pixel.new(red, green, blue, 0)\n #new_image.store_pixels(col, row, 1, 1, new_pixel)\n\n #puts \"Pixel at: #{col}x#{row}:\n #\\tR: #{new_pixel.red}, G: #{new_pixel.green}, B: #{new_pixel.blue}\"\n end\n\n # Write out the new pixel array\n new_image.store_pixels(0, 0, new_image.columns, new_image.rows, @new_pixels)\n\n # Create a random image name\n image_name = Array.new(10){rand(36).to_s(36)}.join\n\n # Write out the new image\n new_image.write(\"./images/#{image_name}.png\")\n\n # Return the image name we wrote to\n return \"#{image_name}.png\"\n end\n end",
"def setup\n size 640, 360\n @num_chars = 26\n @key_scale = 200.0 / @num_chars-1.0\n @rect_width = width/4 \n no_stroke\n background 0\nend",
"def initialize( db, sql )\n @db = db\n #prepare_method = @db.utf16? ? :prepare16 : :prepare\n prepare_method = :prepare\n @param_positions = {}\n @stmt_api = @db.api.send( prepare_method, sql )\n @blobs_to_write = []\n @rowid_index = nil\n @result_meta = nil\n @open = true\n end",
"def init(num_of_pixels)\n @@packetdata = String.new\n @@numpixels = num_of_pixels \n i = 0\n p = [0.to_i]\n while i < (@@numpixels * 3)\n @@packetdata[i] = p.pack(\"C\")\n i = i + 1\n end\nend",
"def g(value)\n (value & 0x00ff0000) >> 16\n end",
"def g(value)\n (value & 0x00ff0000) >> 16\n end",
"def read_bytes(params=nil)\n d = @density ? \"-density #{@density}\" : nil\n s = \"|convert -depth 8 #{d} #{@path} #{params} gray:-\"\n IO.read(s).unpack 'C*'\n end",
"def to_giga\n big_self / GIGA\n end",
"def default_space_encoding=(_arg0); end",
"def dbsize; end",
"def dbsize; end",
"def fbe_body\n 4 + 4 \\\n + byte0.fbe_size \\\n + byte1.fbe_size \\\n + byte2.fbe_size \\\n + byte3.fbe_size \\\n + byte4.fbe_size \\\n + byte5.fbe_size \\\n + char0.fbe_size \\\n + char1.fbe_size \\\n + char2.fbe_size \\\n + char3.fbe_size \\\n + char4.fbe_size \\\n + char5.fbe_size \\\n + wchar0.fbe_size \\\n + wchar1.fbe_size \\\n + wchar2.fbe_size \\\n + wchar3.fbe_size \\\n + wchar4.fbe_size \\\n + wchar5.fbe_size \\\n + int8b0.fbe_size \\\n + int8b1.fbe_size \\\n + int8b2.fbe_size \\\n + int8b3.fbe_size \\\n + int8b4.fbe_size \\\n + int8b5.fbe_size \\\n + uint8b0.fbe_size \\\n + uint8b1.fbe_size \\\n + uint8b2.fbe_size \\\n + uint8b3.fbe_size \\\n + uint8b4.fbe_size \\\n + uint8b5.fbe_size \\\n + int16b0.fbe_size \\\n + int16b1.fbe_size \\\n + int16b2.fbe_size \\\n + int16b3.fbe_size \\\n + int16b4.fbe_size \\\n + int16b5.fbe_size \\\n + uint16b0.fbe_size \\\n + uint16b1.fbe_size \\\n + uint16b2.fbe_size \\\n + uint16b3.fbe_size \\\n + uint16b4.fbe_size \\\n + uint16b5.fbe_size \\\n + int32b0.fbe_size \\\n + int32b1.fbe_size \\\n + int32b2.fbe_size \\\n + int32b3.fbe_size \\\n + int32b4.fbe_size \\\n + int32b5.fbe_size \\\n + uint32b0.fbe_size \\\n + uint32b1.fbe_size \\\n + uint32b2.fbe_size \\\n + uint32b3.fbe_size \\\n + uint32b4.fbe_size \\\n + uint32b5.fbe_size \\\n + int64b0.fbe_size \\\n + int64b1.fbe_size \\\n + int64b2.fbe_size \\\n + int64b3.fbe_size \\\n + int64b4.fbe_size \\\n + int64b5.fbe_size \\\n + uint64b0.fbe_size \\\n + uint64b1.fbe_size \\\n + uint64b2.fbe_size \\\n + uint64b3.fbe_size \\\n + uint64b4.fbe_size \\\n + uint64b5.fbe_size \\\n end",
"def encode_uint8(int); [int].pack(PACK_FORMAT_UINT8); end",
"def literal_blob_append(sql, v)\n if v.empty?\n sql << \"''\"\n else\n sql << \"x'#{v.unpack('H*').first}'\"\n end\n end",
"def wbmp(fgcolor)\n size = FFI::MemoryPointer.new(:pointer)\n ptr = ::GD2::GD2FFI.send(:gdImageWBMPPtr, image_ptr, size, color2pixel(fgcolor))\n ptr.get_bytes(0, size.get_int(0))\n ensure\n ::GD2::GD2FFI.send(:gdFree, ptr)\n end",
"def as_hex_ewkb(allow_srid=true,allow_z=true,allow_m=true)\r\n \tas_ewkb(allow_srid, allow_z, allow_m).unpack('H*').join('').upcase\r\n end",
"def store_window2 #:nodoc:\n record = 0x023E # Record identifier\n length = 0x0012 # Number of bytes to follow\n\n grbit = 0x00B6 # Option flags\n rwTop = @first_row # Top visible row\n colLeft = @first_col # Leftmost visible column\n rgbHdr = 0x00000040 # Row/col heading, grid color\n\n wScaleSLV = 0x0000 # Zoom in page break preview\n wScaleNormal = 0x0000 # Zoom in normal view\n reserved = 0x00000000\n\n\n # The options flags that comprise $grbit\n fDspFmla = @display_formulas # 0 - bit\n fDspGrid = @screen_gridlines # 1\n fDspRwCol = @display_headers # 2\n fFrozen = @frozen # 3\n fDspZeros = @display_zeros # 4\n fDefaultHdr = 1 # 5\n fArabic = @display_arabic # 6\n fDspGuts = @outline_on # 7\n fFrozenNoSplit = @frozen_no_split # 0 - bit\n fSelected = @selected # 1\n fPaged = @active # 2\n fBreakPreview = 0 # 3\n\n grbit = fDspFmla\n grbit |= fDspGrid << 1\n grbit |= fDspRwCol << 2\n grbit |= fFrozen << 3\n grbit |= fDspZeros << 4\n grbit |= fDefaultHdr << 5\n grbit |= fArabic << 6\n grbit |= fDspGuts << 7\n grbit |= fFrozenNoSplit << 8\n grbit |= fSelected << 9\n grbit |= fPaged << 10\n grbit |= fBreakPreview << 11\n\n header = [record, length].pack(\"vv\")\n data =[grbit, rwTop, colLeft, rgbHdr, wScaleSLV, wScaleNormal, reserved].pack(\"vvvVvvV\")\n\n append(header, data)\n end",
"def to_s\n (0..8).collect { |r|\n @grid[r*9,9].pack('c9') # TODO\n } .join(\"\\n\").tr(BIN,ASCII)\n end",
"def compute_pack_code(size: self.size, integer: self.integer?, unsigned: self.unsigned?)\n if integer\n INTEGER_PACK_CODES[[size, unsigned, ModelKit::Types.big_endian?]]\n else\n FLOAT_PACK_CODES[[size, ModelKit::Types.big_endian?]]\n end\n end",
"def encoding\n select_value(\n \"SELECT pg_encoding_to_char(pg_database.encoding)\" <<\n \" FROM pg_database\" <<\n \" WHERE pg_database.datname LIKE '#{current_database}'\",\n 'SCHEMA')\n end",
"def create_characters\n @db.execute %Q{\n CREATE TABLE Characters (\n id INTEGER PRIMARY KEY NOT NULL,\n character_name TEXT NOT NULL,\n image TEXT NOT NULL,\n team TEXT NOT NULL\n );\n }\n end",
"def binmode() end",
"def binmode() end",
"def binmode() end",
"def initialize(chars_max=0, default=nil)\n @chars_max = (chars_max == 0 ? 1000 : chars_max)\n @char_widths = calculate_char_widths\n @cursor_width = CURSOR_WIDTH\n super(0, 0, 480, 64)\n self.contents = Bitmap.new(width - 32, height - 32)\n self.z += 9999\n self.opacity = 0\n @cursor_x = 0\n @text = Array.new\n if default != nil\n for i in 0...default.size\n @text[i] = default[i].chr\n @cursor_x += @char_widths[@text[i]]\n end\n @index = @text.size\n else\n @index = 0\n end\n @last_text = @text.clone\n refresh\n update_cursor_rect\n end",
"def gci source\n cifrom(compile(source))\nend",
"def gp_flags; end",
"def gp_development_keys\n key = (0x40..0x4F).to_a.pack('C*')\n { :senc => key, :smac => key, :dek => key }\n end",
"def draw_bitmap(bmp)\n $disp.cursor.x_pos = bmp.x\n $disp.cursor.y_pos = bmp.y\n i = 0\n for strip in bmp.content\n $disp.buffer[$disp.cursor.buffer_index + i] = strip\n i = i + 1\n end\nend",
"def setup\n size 640, 360\n @num_chars = 26\n @key_scale = 200.0 / @num_chars - 1.0\n @rect_width = width / 4\n no_stroke\n background 0\nend",
"def binmode\n end",
"def binmode\n end",
"def writePhyloSeguid(db)\n out = File.new(\"phylodb.seguid\",\"w\")\n db.query(\"SELECT proteins.name, seguid, contigs.taxon_id, contigs.species FROM proteins, contigs WHERE contigs.name=contig_name\").each do |row|\n out.print row.join(\"\\t\")+\"\\n\"\n end\n out.close\nend",
"def convert_to_emu(dim_str); end",
"def create_begin\n buffer.allocate(4 + @_model.fbe_size)\n end",
"def create_begin\n buffer.allocate(4 + @_model.fbe_size)\n end",
"def create_begin\n buffer.allocate(4 + @_model.fbe_size)\n end",
"def create_begin\n buffer.allocate(4 + @_model.fbe_size)\n end",
"def mysqlchar\n foo='CHAR('\n foo += self.asciime + ')'\n return foo\n end",
"def encode_png_pixels_to_scanline_grayscale_alpha_8bit(pixels)\n pixels.pack(\"xn#{width}\")\n end"
] |
[
"0.5013841",
"0.49944857",
"0.48619965",
"0.4856925",
"0.48478654",
"0.483111",
"0.48011625",
"0.47925946",
"0.47771898",
"0.47669128",
"0.47601056",
"0.475142",
"0.47498924",
"0.47498924",
"0.474847",
"0.47419417",
"0.470961",
"0.46942613",
"0.46757555",
"0.46641204",
"0.46608627",
"0.46497586",
"0.46381795",
"0.46359536",
"0.46292496",
"0.4629077",
"0.46075416",
"0.45819104",
"0.45812592",
"0.4578622",
"0.45758268",
"0.45621604",
"0.45465153",
"0.45464358",
"0.45389858",
"0.45349008",
"0.45309877",
"0.452928",
"0.45195308",
"0.45154807",
"0.45068938",
"0.45015034",
"0.44982234",
"0.44803405",
"0.44740218",
"0.44649097",
"0.44607925",
"0.44603127",
"0.4455323",
"0.44494188",
"0.44391176",
"0.44372115",
"0.4437136",
"0.4435015",
"0.44342357",
"0.4427945",
"0.44244906",
"0.44148394",
"0.4414066",
"0.44064665",
"0.44059083",
"0.44046643",
"0.4400061",
"0.43969813",
"0.43949404",
"0.43940875",
"0.43940875",
"0.4391664",
"0.4390434",
"0.43898043",
"0.43857527",
"0.43857527",
"0.43839374",
"0.43815193",
"0.4378514",
"0.43774363",
"0.4377236",
"0.43770397",
"0.4376984",
"0.43737793",
"0.4373704",
"0.43716538",
"0.43655977",
"0.43655977",
"0.43655977",
"0.43652698",
"0.436353",
"0.43601587",
"0.4359294",
"0.4358123",
"0.43567467",
"0.43512383",
"0.43512383",
"0.43458524",
"0.43426436",
"0.43417877",
"0.43417877",
"0.43417877",
"0.43417877",
"0.43406498",
"0.43406144"
] |
0.0
|
-1
|
codecite gdi codecite hd
|
def print_string_message_hd
puts <<'EOS'
Double-quoted strings can include escaped characters such as \n and \\
as well as interpolated Ruby expressions like #{Time.now}.
EOS
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fh\n return hex_side_length + 2 * th\n end",
"def cp_d8\n end",
"def test_progressive_dct_based_jpeg_image\n testname = '35w x 35h progressive jpeg image.'\n data = %w(\n FF D8 FF E0 00 10 4A 46 49 46 00 01 02 01 00 96\n 00 96 00 00 FF E1 04 E7 45 78 69 66 00 00 4D 4D\n 00 2A 00 00 00 08 00 07 01 12 00 03 00 00 00 01\n 00 01 00 00 01 1A 00 05 00 00 00 01 00 00 00 62\n 01 1B 00 05 00 00 00 01 00 00 00 6A 01 28 00 03\n 00 00 00 01 00 02 00 00 01 31 00 02 00 00 00 14\n 00 00 00 72 01 32 00 02 00 00 00 14 00 00 00 86\n 87 69 00 04 00 00 00 01 00 00 00 9C 00 00 00 C8\n 00 00 00 96 00 00 00 01 00 00 00 96 00 00 00 01\n 41 64 6F 62 65 20 50 68 6F 74 6F 73 68 6F 70 20\n 37 2E 30 00 32 30 30 38 3A 30 39 3A 30 39 20 32\n 32 3A 32 33 3A 31 32 00 00 00 00 03 A0 01 00 03\n 00 00 00 01 FF FF 00 00 A0 02 00 04 00 00 00 01\n 00 00 00 23 A0 03 00 04 00 00 00 01 00 00 00 23\n 00 00 00 00 00 00 00 06 01 03 00 03 00 00 00 01\n 00 06 00 00 01 1A 00 05 00 00 00 01 00 00 01 16\n 01 1B 00 05 00 00 00 01 00 00 01 1E 01 28 00 03\n 00 00 00 01 00 02 00 00 02 01 00 04 00 00 00 01\n 00 00 01 26 02 02 00 04 00 00 00 01 00 00 03 B9\n 00 00 00 00 00 00 00 48 00 00 00 01 00 00 00 48\n 00 00 00 01 FF D8 FF E0 00 10 4A 46 49 46 00 01\n 02 01 00 48 00 48 00 00 FF ED 00 0C 41 64 6F 62\n 65 5F 43 4D 00 02 FF EE 00 0E 41 64 6F 62 65 00\n 64 80 00 00 00 01 FF DB 00 84 00 0C 08 08 08 09\n 08 0C 09 09 0C 11 0B 0A 0B 11 15 0F 0C 0C 0F 15\n 18 13 13 15 13 13 18 11 0C 0C 0C 0C 0C 0C 11 0C\n 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C\n 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 01 0D 0B 0B 0D\n 0E 0D 10 0E 0E 10 14 0E 0E 0E 14 14 0E 0E 0E 0E\n 14 11 0C 0C 0C 0C 0C 11 11 0C 0C 0C 0C 0C 0C 11\n 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C\n 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C FF C0 00 11\n 08 00 23 00 23 03 01 22 00 02 11 01 03 11 01 FF\n DD 00 04 00 03 FF C4 01 3F 00 00 01 05 01 01 01\n 01 01 01 00 00 00 00 00 00 00 03 00 01 02 04 05\n 06 07 08 09 0A 0B 01 00 01 05 01 01 01 01 01 01\n 00 00 00 00 00 00 00 01 00 02 03 04 05 06 07 08\n 09 0A 0B 10 00 01 04 01 03 02 04 02 05 07 06 08\n 05 03 0C 33 01 00 02 11 03 04 21 12 31 05 41 51\n 61 13 22 71 81 32 06 14 91 A1 B1 42 23 24 15 52\n C1 62 33 34 72 82 D1 43 07 25 92 53 F0 E1 F1 63\n 73 35 16 A2 B2 83 26 44 93 54 64 45 C2 A3 74 36\n 17 D2 55 E2 65 F2 B3 84 C3 D3 75 E3 F3 46 27 94\n A4 85 B4 95 C4 D4 E4 F4 A5 B5 C5 D5 E5 F5 56 66\n 76 86 96 A6 B6 C6 D6 E6 F6 37 47 57 67 77 87 97\n A7 B7 C7 D7 E7 F7 11 00 02 02 01 02 04 04 03 04\n 05 06 07 07 06 05 35 01 00 02 11 03 21 31 12 04\n 41 51 61 71 22 13 05 32 81 91 14 A1 B1 42 23 C1\n 52 D1 F0 33 24 62 E1 72 82 92 43 53 15 63 73 34\n F1 25 06 16 A2 B2 83 07 26 35 C2 D2 44 93 54 A3\n 17 64 45 55 36 74 65 E2 F2 B3 84 C3 D3 75 E3 F3\n 46 94 A4 85 B4 95 C4 D4 E4 F4 A5 B5 C5 D5 E5 F5\n 56 66 76 86 96 A6 B6 C6 D6 E6 F6 27 37 47 57 67\n 77 87 97 A7 B7 C7 FF DA 00 0C 03 01 00 02 11 03\n 11 00 3F 00 F5 54 0B 33 71 AB 79 AC BF 75 83 53\n 5B 01 7B 84 F1 B9 95 EE 73 54 F2 1C E6 D1 63 9B\n F4 9A C7 16 FC 40 5C F7 49 B7 1A FA 19 51 BF 23\n 1B 2C B4 3A EC 7B 2D 65 76 6E 23 DC FD 06 FB 58\n FF 00 A4 CB 92 53 1E B9 F5 9B 3E 96 DB 8D 83 D3\n B2 85 A7 DB 56 53 D8 1B 5C E9 EE 0F 7E E6 37 FE\n B8 AF FD 5B FD AA 71 9E EE A2 CB 6A 26 36 D7 7B\n C5 8F 07 5D EE DE 27 F4 7F 43 E9 21 E5 D5 85 8D\n 59 39 B9 04 56 EE 45 D9 6F F7 79 7A 6D 1E FF 00\n EA AB 9D 0A C3 67 4D AC 9A AC C7 01 CF 0C A6 D2\n 4B DA D0 E7 7A 61 FE A4 BF E8 7E FA 4A 74 12 49\n 24 94 FF 00 FF D0 F5 2B DA 5D 4D 8D 1C B9 A4 7D\n E1 66 F4 FB BA 7F 50 C3 C7 17 D4 CF 59 B5 33 F4\n 57 06 97 00 47 2D 9F CC 74 7D 26 2D 55 CC 7D 61\n CD 7F 40 38 66 BA 99 76 16 4D CE AD EC B8 4B 69\n 2E 06 C6 7A 76 0F 73 37 D9 EC D8 EF EC 24 A7 61\n 95 74 7C 70 6F 6B 28 AF 61 FE 72 1B 20 8F DD 77\n D2 44 E9 97 8C 8C 63 7B 5A E6 36 CB 2C 21 AE D1\n D0 1E EA F5 1F D8 58 1F 57 FA 95 DD 6B 23 25 B5\n D5 5E 23 31 F6 13 63 1A 1E F9 70 73 76 56 F7 7B\n 6A FE 6F 7F D0 FC F5 D3 63 D1 56 3D 2C A6 A6 ED\n AD 82 1A 12 52 44 92 49 25 3F FF D1 F5 55 47 AD\n C7 EC AC AD DE 84 7A 6E 9F B5 4F A3 11 FE 1B 67\n BF 67 F5 17 CC 69 24 A7 E9 6F AB BB 7F 66 55 B7\n EC BB 60 47 D8 B7 7A 5C 7F C2 7E 93 FC F5 A8 BE\n 55 49 25 3F 55 24 BE 55 49 25 3F FF D9 FF ED 09\n 94 50 68 6F 74 6F 73 68 6F 70 20 33 2E 30 00 38\n 42 49 4D 04 25 00 00 00 00 00 10 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 38 42 49 4D 03\n ED 00 00 00 00 00 10 00 96 00 00 00 01 00 01 00\n 96 00 00 00 01 00 01 38 42 49 4D 04 26 00 00 00\n 00 00 0E 00 00 00 00 00 00 00 00 00 00 3F 80 00\n 00 38 42 49 4D 04 0D 00 00 00 00 00 04 00 00 00\n 1E 38 42 49 4D 04 19 00 00 00 00 00 04 00 00 00\n 1E 38 42 49 4D 03 F3 00 00 00 00 00 09 00 00 00\n 00 00 00 00 00 01 00 38 42 49 4D 04 0A 00 00 00\n 00 00 01 00 00 38 42 49 4D 27 10 00 00 00 00 00\n 0A 00 01 00 00 00 00 00 00 00 01 38 42 49 4D 03\n F5 00 00 00 00 00 48 00 2F 66 66 00 01 00 6C 66\n 66 00 06 00 00 00 00 00 01 00 2F 66 66 00 01 00\n A1 99 9A 00 06 00 00 00 00 00 01 00 32 00 00 00\n 01 00 5A 00 00 00 06 00 00 00 00 00 01 00 35 00\n 00 00 01 00 2D 00 00 00 06 00 00 00 00 00 01 38\n 42 49 4D 03 F8 00 00 00 00 00 70 00 00 FF FF FF\n FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF\n FF FF FF 03 E8 00 00 00 00 FF FF FF FF FF FF FF\n FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 03\n E8 00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF\n FF FF FF FF FF FF FF FF FF FF FF 03 E8 00 00 00\n 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF\n FF FF FF FF FF FF FF 03 E8 00 00 38 42 49 4D 04\n 08 00 00 00 00 00 10 00 00 00 01 00 00 02 40 00\n 00 02 40 00 00 00 00 38 42 49 4D 04 1E 00 00 00\n 00 00 04 00 00 00 00 38 42 49 4D 04 1A 00 00 00\n 00 03 59 00 00 00 06 00 00 00 00 00 00 00 00 00\n 00 00 23 00 00 00 23 00 00 00 12 00 54 00 43 00\n 50 00 5F 00 43 00 69 00 72 00 63 00 6C 00 65 00\n 5F 00 42 00 61 00 6C 00 6C 00 61 00 73 00 74 00\n 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00\n 00 00 23 00 00 00 23 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 01\n 00 00 00 00 00 00 6E 75 6C 6C 00 00 00 02 00 00\n 00 06 62 6F 75 6E 64 73 4F 62 6A 63 00 00 00 01\n 00 00 00 00 00 00 52 63 74 31 00 00 00 04 00 00\n 00 00 54 6F 70 20 6C 6F 6E 67 00 00 00 00 00 00\n 00 00 4C 65 66 74 6C 6F 6E 67 00 00 00 00 00 00\n 00 00 42 74 6F 6D 6C 6F 6E 67 00 00 00 23 00 00\n 00 00 52 67 68 74 6C 6F 6E 67 00 00 00 23 00 00\n 00 06 73 6C 69 63 65 73 56 6C 4C 73 00 00 00 01\n 4F 62 6A 63 00 00 00 01 00 00 00 00 00 05 73 6C\n 69 63 65 00 00 00 12 00 00 00 07 73 6C 69 63 65\n 49 44 6C 6F 6E 67 00 00 00 00 00 00 00 07 67 72\n 6F 75 70 49 44 6C 6F 6E 67 00 00 00 00 00 00 00\n 06 6F 72 69 67 69 6E 65 6E 75 6D 00 00 00 0C 45\n 53 6C 69 63 65 4F 72 69 67 69 6E 00 00 00 0D 61\n 75 74 6F 47 65 6E 65 72 61 74 65 64 00 00 00 00\n 54 79 70 65 65 6E 75 6D 00 00 00 0A 45 53 6C 69\n 63 65 54 79 70 65 00 00 00 00 49 6D 67 20 00 00\n 00 06 62 6F 75 6E 64 73 4F 62 6A 63 00 00 00 01\n 00 00 00 00 00 00 52 63 74 31 00 00 00 04 00 00\n 00 00 54 6F 70 20 6C 6F 6E 67 00 00 00 00 00 00\n 00 00 4C 65 66 74 6C 6F 6E 67 00 00 00 00 00 00\n 00 00 42 74 6F 6D 6C 6F 6E 67 00 00 00 23 00 00\n 00 00 52 67 68 74 6C 6F 6E 67 00 00 00 23 00 00\n 00 03 75 72 6C 54 45 58 54 00 00 00 01 00 00 00\n 00 00 00 6E 75 6C 6C 54 45 58 54 00 00 00 01 00\n 00 00 00 00 00 4D 73 67 65 54 45 58 54 00 00 00\n 01 00 00 00 00 00 06 61 6C 74 54 61 67 54 45 58\n 54 00 00 00 01 00 00 00 00 00 0E 63 65 6C 6C 54\n 65 78 74 49 73 48 54 4D 4C 62 6F 6F 6C 01 00 00\n 00 08 63 65 6C 6C 54 65 78 74 54 45 58 54 00 00\n 00 01 00 00 00 00 00 09 68 6F 72 7A 41 6C 69 67\n 6E 65 6E 75 6D 00 00 00 0F 45 53 6C 69 63 65 48\n 6F 72 7A 41 6C 69 67 6E 00 00 00 07 64 65 66 61\n 75 6C 74 00 00 00 09 76 65 72 74 41 6C 69 67 6E\n 65 6E 75 6D 00 00 00 0F 45 53 6C 69 63 65 56 65\n 72 74 41 6C 69 67 6E 00 00 00 07 64 65 66 61 75\n 6C 74 00 00 00 0B 62 67 43 6F 6C 6F 72 54 79 70\n 65 65 6E 75 6D 00 00 00 11 45 53 6C 69 63 65 42\n 47 43 6F 6C 6F 72 54 79 70 65 00 00 00 00 4E 6F\n 6E 65 00 00 00 09 74 6F 70 4F 75 74 73 65 74 6C\n 6F 6E 67 00 00 00 00 00 00 00 0A 6C 65 66 74 4F\n 75 74 73 65 74 6C 6F 6E 67 00 00 00 00 00 00 00\n 0C 62 6F 74 74 6F 6D 4F 75 74 73 65 74 6C 6F 6E\n 67 00 00 00 00 00 00 00 0B 72 69 67 68 74 4F 75\n 74 73 65 74 6C 6F 6E 67 00 00 00 00 00 38 42 49\n 4D 04 11 00 00 00 00 00 01 01 00 38 42 49 4D 04\n 14 00 00 00 00 00 04 00 00 00 01 38 42 49 4D 04\n 0C 00 00 00 00 03 D5 00 00 00 01 00 00 00 23 00\n 00 00 23 00 00 00 6C 00 00 0E C4 00 00 03 B9 00\n 18 00 01 FF D8 FF E0 00 10 4A 46 49 46 00 01 02\n 01 00 48 00 48 00 00 FF ED 00 0C 41 64 6F 62 65\n 5F 43 4D 00 02 FF EE 00 0E 41 64 6F 62 65 00 64\n 80 00 00 00 01 FF DB 00 84 00 0C 08 08 08 09 08\n 0C 09 09 0C 11 0B 0A 0B 11 15 0F 0C 0C 0F 15 18\n 13 13 15 13 13 18 11 0C 0C 0C 0C 0C 0C 11 0C 0C\n 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C\n 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 01 0D 0B 0B 0D 0E\n 0D 10 0E 0E 10 14 0E 0E 0E 14 14 0E 0E 0E 0E 14\n 11 0C 0C 0C 0C 0C 11 11 0C 0C 0C 0C 0C 0C 11 0C\n 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C\n 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C 0C FF C0 00 11 08\n 00 23 00 23 03 01 22 00 02 11 01 03 11 01 FF DD\n 00 04 00 03 FF C4 01 3F 00 00 01 05 01 01 01 01\n 01 01 00 00 00 00 00 00 00 03 00 01 02 04 05 06\n 07 08 09 0A 0B 01 00 01 05 01 01 01 01 01 01 00\n 00 00 00 00 00 00 01 00 02 03 04 05 06 07 08 09\n 0A 0B 10 00 01 04 01 03 02 04 02 05 07 06 08 05\n 03 0C 33 01 00 02 11 03 04 21 12 31 05 41 51 61\n 13 22 71 81 32 06 14 91 A1 B1 42 23 24 15 52 C1\n 62 33 34 72 82 D1 43 07 25 92 53 F0 E1 F1 63 73\n 35 16 A2 B2 83 26 44 93 54 64 45 C2 A3 74 36 17\n D2 55 E2 65 F2 B3 84 C3 D3 75 E3 F3 46 27 94 A4\n 85 B4 95 C4 D4 E4 F4 A5 B5 C5 D5 E5 F5 56 66 76\n 86 96 A6 B6 C6 D6 E6 F6 37 47 57 67 77 87 97 A7\n B7 C7 D7 E7 F7 11 00 02 02 01 02 04 04 03 04 05\n 06 07 07 06 05 35 01 00 02 11 03 21 31 12 04 41\n 51 61 71 22 13 05 32 81 91 14 A1 B1 42 23 C1 52\n D1 F0 33 24 62 E1 72 82 92 43 53 15 63 73 34 F1\n 25 06 16 A2 B2 83 07 26 35 C2 D2 44 93 54 A3 17\n 64 45 55 36 74 65 E2 F2 B3 84 C3 D3 75 E3 F3 46\n 94 A4 85 B4 95 C4 D4 E4 F4 A5 B5 C5 D5 E5 F5 56\n 66 76 86 96 A6 B6 C6 D6 E6 F6 27 37 47 57 67 77\n 87 97 A7 B7 C7 FF DA 00 0C 03 01 00 02 11 03 11\n 00 3F 00 F5 54 0B 33 71 AB 79 AC BF 75 83 53 5B\n 01 7B 84 F1 B9 95 EE 73 54 F2 1C E6 D1 63 9B F4\n 9A C7 16 FC 40 5C F7 49 B7 1A FA 19 51 BF 23 1B\n 2C B4 3A EC 7B 2D 65 76 6E 23 DC FD 06 FB 58 FF\n 00 A4 CB 92 53 1E B9 F5 9B 3E 96 DB 8D 83 D3 B2\n 85 A7 DB 56 53 D8 1B 5C E9 EE 0F 7E E6 37 FE B8\n AF FD 5B FD AA 71 9E EE A2 CB 6A 26 36 D7 7B C5\n 8F 07 5D EE DE 27 F4 7F 43 E9 21 E5 D5 85 8D 59\n 39 B9 04 56 EE 45 D9 6F F7 79 7A 6D 1E FF 00 EA\n AB 9D 0A C3 67 4D AC 9A AC C7 01 CF 0C A6 D2 4B\n DA D0 E7 7A 61 FE A4 BF E8 7E FA 4A 74 12 49 24\n 94 FF 00 FF D0 F5 2B DA 5D 4D 8D 1C B9 A4 7D E1\n 66 F4 FB BA 7F 50 C3 C7 17 D4 CF 59 B5 33 F4 57\n 06 97 00 47 2D 9F CC 74 7D 26 2D 55 CC 7D 61 CD\n 7F 40 38 66 BA 99 76 16 4D CE AD EC B8 4B 69 2E\n 06 C6 7A 76 0F 73 37 D9 EC D8 EF EC 24 A7 61 95\n 74 7C 70 6F 6B 28 AF 61 FE 72 1B 20 8F DD 77 D2\n 44 E9 97 8C 8C 63 7B 5A E6 36 CB 2C 21 AE D1 D0\n 1E EA F5 1F D8 58 1F 57 FA 95 DD 6B 23 25 B5 D5\n 5E 23 31 F6 13 63 1A 1E F9 70 73 76 56 F7 7B 6A\n FE 6F 7F D0 FC F5 D3 63 D1 56 3D 2C A6 A6 ED AD\n 82 1A 12 52 44 92 49 25 3F FF D1 F5 55 47 AD C7\n EC AC AD DE 84 7A 6E 9F B5 4F A3 11 FE 1B 67 BF\n 67 F5 17 CC 69 24 A7 E9 6F AB BB 7F 66 55 B7 EC\n BB 60 47 D8 B7 7A 5C 7F C2 7E 93 FC F5 A8 BE 55\n 49 25 3F 55 24 BE 55 49 25 3F FF D9 00 38 42 49\n 4D 04 21 00 00 00 00 00 55 00 00 00 01 01 00 00\n 00 0F 00 41 00 64 00 6F 00 62 00 65 00 20 00 50\n 00 68 00 6F 00 74 00 6F 00 73 00 68 00 6F 00 70\n 00 00 00 13 00 41 00 64 00 6F 00 62 00 65 00 20\n 00 50 00 68 00 6F 00 74 00 6F 00 73 00 68 00 6F\n 00 70 00 20 00 37 00 2E 00 30 00 00 00 01 00 38\n 42 49 4D 04 06 00 00 00 00 00 07 00 08 01 01 00\n 01 01 00 FF E1 12 48 68 74 74 70 3A 2F 2F 6E 73\n 2E 61 64 6F 62 65 2E 63 6F 6D 2F 78 61 70 2F 31\n 2E 30 2F 00 3C 3F 78 70 61 63 6B 65 74 20 62 65\n 67 69 6E 3D 27 EF BB BF 27 20 69 64 3D 27 57 35\n 4D 30 4D 70 43 65 68 69 48 7A 72 65 53 7A 4E 54\n 63 7A 6B 63 39 64 27 3F 3E 0A 3C 3F 61 64 6F 62\n 65 2D 78 61 70 2D 66 69 6C 74 65 72 73 20 65 73\n 63 3D 22 43 52 22 3F 3E 0A 3C 78 3A 78 61 70 6D\n 65 74 61 20 78 6D 6C 6E 73 3A 78 3D 27 61 64 6F\n 62 65 3A 6E 73 3A 6D 65 74 61 2F 27 20 78 3A 78\n 61 70 74 6B 3D 27 58 4D 50 20 74 6F 6F 6C 6B 69\n 74 20 32 2E 38 2E 32 2D 33 33 2C 20 66 72 61 6D\n 65 77 6F 72 6B 20 31 2E 35 27 3E 0A 3C 72 64 66\n 3A 52 44 46 20 78 6D 6C 6E 73 3A 72 64 66 3D 27\n 68 74 74 70 3A 2F 2F 77 77 77 2E 77 33 2E 6F 72\n 67 2F 31 39 39 39 2F 30 32 2F 32 32 2D 72 64 66\n 2D 73 79 6E 74 61 78 2D 6E 73 23 27 20 78 6D 6C\n 6E 73 3A 69 58 3D 27 68 74 74 70 3A 2F 2F 6E 73\n 2E 61 64 6F 62 65 2E 63 6F 6D 2F 69 58 2F 31 2E\n 30 2F 27 3E 0A 0A 20 3C 72 64 66 3A 44 65 73 63\n 72 69 70 74 69 6F 6E 20 61 62 6F 75 74 3D 27 75\n 75 69 64 3A 34 37 38 34 61 35 39 66 2D 37 65 64\n 66 2D 31 31 64 64 2D 39 61 37 39 2D 61 31 62 66\n 63 38 33 61 61 63 63 36 27 0A 20 20 78 6D 6C 6E\n 73 3A 78 61 70 4D 4D 3D 27 68 74 74 70 3A 2F 2F\n 6E 73 2E 61 64 6F 62 65 2E 63 6F 6D 2F 78 61 70\n 2F 31 2E 30 2F 6D 6D 2F 27 3E 0A 20 20 3C 78 61\n 70 4D 4D 3A 44 6F 63 75 6D 65 6E 74 49 44 3E 61\n 64 6F 62 65 3A 64 6F 63 69 64 3A 70 68 6F 74 6F\n 73 68 6F 70 3A 34 37 38 34 61 35 39 64 2D 37 65\n 64 66 2D 31 31 64 64 2D 39 61 37 39 2D 61 31 62\n 66 63 38 33 61 61 63 63 36 3C 2F 78 61 70 4D 4D\n 3A 44 6F 63 75 6D 65 6E 74 49 44 3E 0A 20 3C 2F\n 72 64 66 3A 44 65 73 63 72 69 70 74 69 6F 6E 3E\n 0A 0A 3C 2F 72 64 66 3A 52 44 46 3E 0A 3C 2F 78\n 3A 78 61 70 6D 65 74 61 3E 0A 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0A 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 0A 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 0A 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 0A 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 0A 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 0A 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 0A 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 0A 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 0A 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 0A 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 0A 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 0A 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 0A 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0A\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 0A 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 0A 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0A 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 0A 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 0A 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 0A 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 0A 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 0A 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 0A 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 0A 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 0A 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 0A 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 0A 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 0A 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 0A 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0A\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 0A 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 0A 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0A 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 0A 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 0A 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 0A 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 0A 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 0A 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 0A 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 0A 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20\n 20 20 20 20 20 20 20 20 20 0A 3C 3F 78 70 61 63\n 6B 65 74 20 65 6E 64 3D 27 77 27 3F 3E FF EE 00\n 21 41 64 6F 62 65 00 64 40 00 00 00 01 03 00 10\n 03 02 03 06 00 00 00 00 00 00 00 00 00 00 00 00\n FF DB 00 84 00 01 01 01 01 01 01 01 01 01 01 01\n 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01\n 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01\n 02 02 02 02 02 02 02 02 02 02 02 03 03 03 03 03\n 03 03 03 03 03 01 01 01 01 01 01 01 01 01 01 01\n 02 02 01 02 02 03 03 03 03 03 03 03 03 03 03 03\n 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03\n 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03\n 03 03 03 03 03 03 FF C2 00 11 08 00 23 00 23 03\n )\n @image.__send__(\"process_jpg\", [data.join('')].pack('H*'))\n assert_equal(@type, @image.type)\n assert_equal(35, @image.width)\n assert_equal(35, @image.height)\n end",
"def setup\n size 640, 360\n @num_chars = 26\n @key_scale = 200.0 / @num_chars-1.0\n @rect_width = width/4 \n no_stroke\n background 0\nend",
"def setup\n size 640, 360\n @num_chars = 26\n @key_scale = 200.0 / @num_chars - 1.0\n @rect_width = width / 4\n no_stroke\n background 0\nend",
"def g3\n [0x00, 0x03, 0x06, 0x05, 0x0c, 0x0f, 0x0a, 0x09, 0x18, 0x1b, 0x1e, 0x1d, 0x14, 0x17, 0x12, 0x11,\n 0x30, 0x33, 0x36, 0x35, 0x3c, 0x3f, 0x3a, 0x39, 0x28, 0x2b, 0x2e, 0x2d, 0x24, 0x27, 0x22, 0x21,\n 0x60, 0x63, 0x66, 0x65, 0x6c, 0x6f, 0x6a, 0x69, 0x78, 0x7b, 0x7e, 0x7d, 0x74, 0x77, 0x72, 0x71,\n 0x50, 0x53, 0x56, 0x55, 0x5c, 0x5f, 0x5a, 0x59, 0x48, 0x4b, 0x4e, 0x4d, 0x44, 0x47, 0x42, 0x41,\n 0xc0, 0xc3, 0xc6, 0xc5, 0xcc, 0xcf, 0xca, 0xc9, 0xd8, 0xdb, 0xde, 0xdd, 0xd4, 0xd7, 0xd2, 0xd1,\n 0xf0, 0xf3, 0xf6, 0xf5, 0xfc, 0xff, 0xfa, 0xf9, 0xe8, 0xeb, 0xee, 0xed, 0xe4, 0xe7, 0xe2, 0xe1,\n 0xa0, 0xa3, 0xa6, 0xa5, 0xac, 0xaf, 0xaa, 0xa9, 0xb8, 0xbb, 0xbe, 0xbd, 0xb4, 0xb7, 0xb2, 0xb1,\n 0x90, 0x93, 0x96, 0x95, 0x9c, 0x9f, 0x9a, 0x99, 0x88, 0x8b, 0x8e, 0x8d, 0x84, 0x87, 0x82, 0x81,\n 0x9b, 0x98, 0x9d, 0x9e, 0x97, 0x94, 0x91, 0x92, 0x83, 0x80, 0x85, 0x86, 0x8f, 0x8c, 0x89, 0x8a,\n 0xab, 0xa8, 0xad, 0xae, 0xa7, 0xa4, 0xa1, 0xa2, 0xb3, 0xb0, 0xb5, 0xb6, 0xbf, 0xbc, 0xb9, 0xba,\n 0xfb, 0xf8, 0xfd, 0xfe, 0xf7, 0xf4, 0xf1, 0xf2, 0xe3, 0xe0, 0xe5, 0xe6, 0xef, 0xec, 0xe9, 0xea,\n 0xcb, 0xc8, 0xcd, 0xce, 0xc7, 0xc4, 0xc1, 0xc2, 0xd3, 0xd0, 0xd5, 0xd6, 0xdf, 0xdc, 0xd9, 0xda,\n 0x5b, 0x58, 0x5d, 0x5e, 0x57, 0x54, 0x51, 0x52, 0x43, 0x40, 0x45, 0x46, 0x4f, 0x4c, 0x49, 0x4a,\n 0x6b, 0x68, 0x6d, 0x6e, 0x67, 0x64, 0x61, 0x62, 0x73, 0x70, 0x75, 0x76, 0x7f, 0x7c, 0x79, 0x7a,\n 0x3b, 0x38, 0x3d, 0x3e, 0x37, 0x34, 0x31, 0x32, 0x23, 0x20, 0x25, 0x26, 0x2f, 0x2c, 0x29, 0x2a,\n 0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a][self]\n end",
"def decypher\n Trace::get_logger.info('Image.cypher') { \"Decyphering message...\" }\n \n res_b = res_s = \"\"\n\n # Fetch each pixel within image, retrieve least significant bit for its color component\n # Store result sequentially in res_b string\n for y in (0...@height)\n for x in (0...@width)\n res_b += @pixels[[x,y]].r.to_s(2).rjust(8, \"0\")[7].to_s\n res_b += @pixels[[x,y]].g.to_s(2).rjust(8, \"0\")[7].to_s\n res_b += @pixels[[x,y]].b.to_s(2).rjust(8, \"0\")[7].to_s\n end\n end\n\n # Then, fetch octet by octet, convert to char, and append result in res_s string\n for i in (0...res_b.length).step(8)\n chunk = res_b[i...i+8].to_i(2).chr\n break if chunk == Messages::get[\"cypher\"][\"ending_flag\"]\n res_s += chunk\n end\n \n # Return decyphered string !\n res_s\n end",
"def g(value)\n (value & 0x00ff0000) >> 16\n end",
"def g(value)\n (value & 0x00ff0000) >> 16\n end",
"def pbGetPlayerCharset(meta,charset,trainer=nil)\n trainer=$Trainer if !trainer\n outfit=trainer ? trainer.outfit : 0\n ret=meta[charset]\n ret=meta[1] if !ret || ret==\"\"\n# if FileTest.image_exist?(\"Graphics/Characters/\"+ret+\"_\"+outfit.to_s)\n if pbResolveBitmap(\"Graphics/Characters/\"+ret+\"_\"+outfit.to_s)\n ret=ret+\"_\"+outfit.to_s\n end\n return ret\nend",
"def get_video_codec \n send_cmd(\"get_video_codec\")\n end",
"def kex_byte_requirement; end",
"def image\r\n buf = \"\\x00\" * 256\r\n if Ragweed::Wrap32::nt_query_information_process(@h, 27, buf)\r\n buf = buf.from_utf16\r\n buf = buf[(buf.index(\"\\\\\"))..-1]\r\n return buf.asciiz\r\n end\r\n nil\r\n end",
"def ChenThongDiep (pixel)\n\t\t\t\n\t\t\tred = pixel.red.to_bin(8).chars #pixel.red kieu integer -> nhi phan -> array char\n\t\t\tred[7] = @thongdiep[@dem] # chen 1 bit cua thong diep vao bit cuoi cua pixel.red\n\t\t\tpixel.red = red.join.to_i(2) # array char -> string -> integer\n\t\t\t@dem += 1 # dem \n\t\t\t\n\t\t\tif @dem == @thongdiep.length # kiem tra da chen het thong diep chua\n\t\t\t\treturn \n\t\t\tend\n\t\t\tgreen = pixel.green.to_bin(8).chars\n\t\t\tgreen[7] = @thongdiep[@dem]\n\t\t\tpixel.green = green.join.to_i(2)\n\t\t\t@dem += 1\n\t\t\t\n\t\t\tif @dem == @thongdiep.length\n\t\t\t\treturn \n\t\t\tend\n\t\t\tblue = pixel.blue.to_bin(8).chars\n\t\t\tblue[7] = @thongdiep[@dem]\n\t\t\tpixel.blue = blue.join.to_i(2)\n\t\t\t@dem += 1\n\t\t\tif @dem == @thongdiep.length\n\t\t\t\treturn \n\t\t\tend\n\n\t\t\n\tend",
"def get_audio_codec \n send_cmd(\"get_audio_codec\")\n end",
"def giga\n big_self * GIGA\n end",
"def cobasysprog\n end",
"def caption\n hash.to_s(16)\n end",
"def hd\n \n end",
"def tip_bitmap(width)\n bit = basic_bitmap(width, 24)\n\n # creazione dello sfondo\n bit.fill_rect(2, 2, bit.width - 4, bit.height - 4, Color.new(0, 0, 0, 128))\n bit.blur\n\n text_width = width / 2 - 24\n text_height = bit.height\n\n # scrittura primo comando\n bit.draw_key_icon(HIDE_MAP_KEY, 0, 0)\n bit.draw_text(24, 0, text_width, text_height, Vocab.minimap_hide)\n\n # scrittura secondo comando\n bit.draw_key_icon(WORLDMAP_KEY, width / 2, 0)\n bit.draw_text(width / 2 + 24, 0, text_width, text_height, Vocab.go_worldmap)\n\n bit\n end",
"def char_to_block c\n c = bg_white \" \" if c == \"W\" \n c = bg_red \" \" if c == \"R\" \n c = bg_green \" \" if c == \"G\" \n c = bg_yellow \" \" if c == \"Y\" \n c = bg_purple \" \" if c == \"P\" \n c = bg_fuscia \" \" if c == \"F\" \n c = bg_blue \" \" if c == \"B\" \n c = bg_grey \" \" if c == \"E\" \n c = \" \" if c == \"x\"\n c\n end",
"def imageDeSteg(password, image)\n # Suck in the image\n original_image = Magick::Image.read(image).first\n\n # Initialize the bits array\n bits = []\n\n # For each pixel in the image\n original_image.each_pixel do |pixel, col, row|\n # Set colors to their current value\n red = pixel.red\n green = pixel.green\n blue = pixel.blue\n\n # If the red value for the pixel is odd\n if (red%2 == 1)\n bits << 1\n else\n bits << 0\n end\n\n # If the green value for the pixel is odd\n if (green%2 == 1)\n bits << 1\n else\n bits << 0\n end\n\n # If the blue value for the pixel is odd\n if (blue%2 == 1)\n bits << 1\n else\n bits << 0\n end\n end\n\n # Initialize the encrypted_length_bits\n encrypted_length_bits = \"\"\n\n # For the first 256 characters in the array\n for counter in (0..255)\n # Append the value to the encrypted_length_bits\n encrypted_length_bits = encrypted_length_bits + bits[counter].to_s()\n end\n\n # Convert the binary encrypted length bits to a string\n encrypted_length = Stegg.convertBinaryToString(encrypted_length_bits)\n\n # Decrypt the encrypted length\n cipher = Gibberish::AES.new(password)\n length = cipher.decrypt(encrypted_length, :binary => true)\n\n # Initialize the encrypted_data_bits\n encrypted_data_bits = \"\"\n\n # Data starts at 256 and goes through the length\n last_bit = 255 + length.to_i()\n \n # For character 256 through the last bit\n for counter in (256..last_bit)\n # Append the value to the encrypted_data_bits\n encrypted_data_bits = encrypted_data_bits + bits[counter].to_s()\n end\n\n # Convert the binary encrypted data bits to a string\n encrypted_data = Stegg.convertBinaryToString(encrypted_data_bits)\n\n # Decrypt the encrypted data\n data = cipher.decrypt(encrypted_data, :binary => true)\n\n # Return the data\n return data\n end",
"def read_bytes(params=nil)\n d = @density ? \"-density #{@density}\" : nil\n s = \"|convert -depth 8 #{d} #{@path} #{params} gray:-\"\n IO.read(s).unpack 'C*'\n end",
"def base_width; 26 + @width; end",
"def content\n [keyword, ChunkyPNG::COMPRESSION_DEFAULT, Zlib::Deflate.deflate(value)].pack('Z*Ca*')\n end",
"def content\n [\n keyword,\n ChunkyPNG::COMPRESSION_DEFAULT,\n Zlib::Deflate.deflate(value),\n ].pack(\"Z*Ca*\")\n end",
"def create\n @bar_code = BarCode.new(bar_code_params)\n gen = Barby::Code128B.new(@bar_code.text)\n send_data gen.to_png(:height => 50), :type => \"image/png\", :disposition => \"inline\"\n\n @bar_code.save\n\n\n\n end",
"def guage(n) \n r = (255 * n) / 100\n g = (255 * (100 - n)) / 100 \n b = 0\n return { :r => r, :g => g, :b => b }\nend",
"def codec_3gp\n \"-ar 22050 -ab 32 -sameq -an -y\"\n end",
"def encode(byte,sz = schluessel) # given are the to be encoded bytecode and the key\n # only letters will be encoded, numbers & special characters won't\n if ('A'..'Z').include?(byte.chr) || ('a'..'z').include?(byte.chr)\n start = (byte > 96) ? 'a'.ord : 'A'.ord # determine the start-value for decoding a-z & A-Z\n anzahl_zeichen = 26 # das deutsche Alphabet\n\n (byte + sz - start) % anzahl_zeichen + start\n else\n byte\n end\n end",
"def commonKey()\n\treturn \"\\xEB\\xE4\\x2A\\x22\\x5E\\x85\\x93\\xE4\\x48\\xD9\\xC5\\x45\\x73\\x81\\xAA\\xF7\"\nend",
"def qrgen\n end",
"def set_one_pixel(pixelno,r,g,b)\n# puts \"Set one pixel length packetdata in \" + @@packetdata.size.to_s\n pixelno = pixelno % @@numpixels\n if r < 256 then\n temp = [r]\n @@packetdata[pixelno * 3] = temp.pack(\"C\")\n end\n if g < 256 then\n temp = [g]\n @@packetdata[(pixelno * 3) + 1] = temp.pack(\"C\")\n end\n if b < 256 then\n temp = [b]\n @@packetdata[(pixelno * 3) + 2] = temp.pack(\"C\") \n end \nend",
"def dh; end",
"def packetfu_ascii_art\n\tputs <<EOM\n _______ _______ _______ _ _______ _________ _______ \n( ____ )( ___ )( ____ \\\\| \\\\ /\\\\( ____ \\\\\\\\__ __/( ____ \\\\|\\\\ /|\n| ( )|| ( ) || ( \\\\/| \\\\ / /| ( \\\\/ ) ( | ( \\\\/| ) ( |\n| (____)|| (___) || | | (_/ / | (__ | | | (__ | | | |\n| _____)| ___ || | | _ ( | __) | | | __) | | | |\n| ( | ( ) || | | ( \\\\ \\\\ | ( | | | ( | | | |\n| ) | ) ( || (____/\\\\| / \\\\ \\\\| (____/\\\\ | | | ) | (___) |\n|/ |/ \\\\|(_______/|_/ \\\\/(_______/ )_( |/ (_______)\n ____________________________ ____________________________\n( ) ( )\n| 01000001 00101101 01001000 )( )( )( )( )( 00101101 01000001 00100001 |\n| )( )( )( )( )( |\n(____________________________) (____________________________)\n パケットフ\n a mid-level packet manipulation library for ruby\n\nEOM\n\tend",
"def customQRcode(inputStr) \n qrcode = RQRCode::QRCode.new(inputStr).as_png(fill: 'white', color: 'black', file: 'abc.png')\n avatar = ChunkyPNG::Image.from_file('abc.png')\n\n # alogo.png being the logo file\n badge = ChunkyPNG::Image.from_file('alogo.png')\n\n print(\"height of backgound:\")\n print(avatar.height)\n print(\"height of logo:\")\n print(badge.height)\n\n #Alpha Blending\n avatar.compose!(badge, avatar.height/2 - badge.height/2, avatar.height/2 - badge.height/2)\n avatar.save('composited.png', :fast_rgba)\nend",
"def test04()\n begin\n origModes = \"kCGBlendModeNormal kCGBlendModeMultiply kCGBlendModeScreen \"+\n \"kCGBlendModeOverlay kCGBlendModeDarken kCGBlendModeLighten \" + \n \"kCGBlendModeColorDodge kCGBlendModeColorBurn kCGBlendModeSoftLight \" +\n \"kCGBlendModeHardLight kCGBlendModeDifference kCGBlendModeExclusion \" +\n \"kCGBlendModeHue kCGBlendModeSaturation kCGBlendModeColor \" +\n \"kCGBlendModeLuminosity kCGBlendModeClear kCGBlendModeCopy \" +\n \"kCGBlendModeSourceIn kCGBlendModeSourceOut kCGBlendModeSourceAtop \" +\n \"kCGBlendModeDestinationOver kCGBlendModeDestinationIn \" +\n \"kCGBlendModeDestinationOut kCGBlendModeDestinationAtop kCGBlendModeXOR \" +\n \"kCGBlendModePlusDarker kCGBlendModePlusLighter\"\n blendModes = MIMeta.listcgblendmodes\n unless origModes.eql? blendModes\n raise \"Blend modes are different, new:\" + blendModes\n end\n\n origPresets = \"AlphaOnly8bpcInt Gray8bpcInt Gray16bpcInt Gray32bpcFloat \" +\n \"AlphaSkipFirstRGB8bpcInt AlphaSkipLastRGB8bpcInt \"+\n \"AlphaPreMulFirstRGB8bpcInt AlphaPreMulBGRA8bpcInt AlphaPreMulLastRGB8bpcInt \" +\n \"AlphaPreMulLastRGB16bpcInt AlphaSkipLastRGB16bpcInt \" +\n \"AlphaSkipLastRGB32bpcFloat AlphaPreMulLastRGB32bpcFloat \" +\n \"CMYK8bpcInt CMYK16bpcInt CMYK32bpcFloat PlatformDefaultBitmapContext\"\n presets = MIMeta.listpresets\n unless origPresets.eql? presets\n raise \"Presets are different, new:\" + presets\n end\n\n origCommands = [:getproperty, :setproperty, :getproperties, :setproperties,\n :create, :close, :closeall, :addimage, :export, :drawelement, :snapshot,\n :finalizepage, :getpixeldata, :calculategraphicsizeoftext, :renderfilterchain,\n :assignimagetocollection, :removeimagefromcollection, :processframes,\n :createtrack, :addinputtowriter, :addimagesampletowriter,\n :finishwritingframes, :cancelwritingframes, :addmovieinstruction,\n :inserttracksegment, :insertemptytracksegment]\n\n commands = MIMeta.listallcommands\n unless origCommands.eql? commands\n raise \"Command lists are different, new:\" + commands.to_s\n end\n\n origObjects = [:bitmapcontext, :imageimporter, :imageexporter,\n :imagefilterchain, :pdfcontext, :nsgraphiccontext,\n :movieimporter, :movieeditor, :videoframeswriter]\n objectTypes = MIMeta.listobjecttypes\n\n unless origObjects.eql? objectTypes\n raise \"List of objects is different, new:\" + commands.to_s\n end\n\n origInputVideoWriterPresets = \"h264preset_sd jpegpreset h264preset_hd \" +\n \"prores4444preset prores422preset\"\n \n videoWriterPresets = MIMeta.listvideoframewriterpresets\n unless origInputVideoWriterPresets.eql? videoWriterPresets\n raise \"List of video writer presets is different, new:\" + videoWriterPresets.to_s\n end\n\n origUserInterfaceFonts = \"kCTFontUIFontMiniEmphasizedSystem \" +\n \"kCTFontUIFontSmallToolbar kCTFontUIFontWindowTitle \" +\n \"kCTFontUIFontMenuTitle kCTFontUIFontSystem kCTFontUIFontMenuItem \" +\n \"kCTFontUIFontEmphasizedSystem kCTFontUIFontToolbar kCTFontUIFontMessage \" +\n \"kCTFontUIFontEmphasizedSystemDetail kCTFontUIFontSmallEmphasizedSystem \" +\n \"kCTFontUIFontUserFixedPitch kCTFontUIFontMiniSystem kCTFontUIFontLabel \" +\n \"kCTFontUIFontControlContent kCTFontUIFontSystemDetail kCTFontUIFontViews \"+\n \"kCTFontUIFontUser kCTFontUIFontSmallSystem kCTFontUIFontApplication\" +\n \"kCTFontUIFontToolTip\"\n \n userInterfaceFonts = MIMeta.listuserinterfacefonts\n unless userInterfaceFonts.eql? userInterfaceFonts\n raise \"User iterface fonts are different, new:\" + userInterfaceFonts\n end\n\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: #{Smig.get_exitstring}\"\n end\n puts e.message\n puts e.backtrace.to_s\n puts #{Smig.exitstring}\"\n# exit 240\n end\nend",
"def content\n [\n width,\n height,\n depth,\n color,\n compression,\n filtering,\n interlace,\n ].pack(\"NNC5\")\n end",
"def setup\n\t\tbackground(0)\n\t\tzahlen = (2*3*5*7)-1# <-- change integer here. # what is biggest array?\n\t\t@table = color_it(rsa_group(zahlen))\n\t\tsquare = [1000] * 2 ; size(*square)\n\t\tframe_rate 1 ; colorMode(HSB,360,100,100)\n\tend",
"def imageSteg(data, password, image)\n # Suck in the image\n original_image = Magick::Image.read(image).first\n\n # Get the number of pixels in the current image\n pixels = Images.numberOfPixels(image)\n\n # Get the number of bits that can be utilized in the image\n # 3 bits (RGB) per pixel\n image_bits = pixels * 3\n\n # Encrypt the data with the password\n cipher = Gibberish::AES.new(password)\n encrypted_data = cipher.encrypt(data, :binary => true)\n\n # Convert the encrypted input to a binary value\n binary = Stegg.convertStringToBinary(encrypted_data)\n\n # Get the number of bits for the binary value\n # This should be a multiple of 128 using AES encryption\n data_bits = Stegg.getBits(binary)\n\n # Encrypt the length bits\n encrypted_length_bits = cipher.encrypt(data_bits.to_s(), :binary => true)\n\n # Convert the encrypted length bits to a binary value\n # This should be 128 bits using AES encryption\n binary_length = Stegg.convertStringToBinary(encrypted_length_bits)\n\n # Data is the binary_length + binary data\n data = binary_length[0] + binary[0]\n\n # Make sure we don't have more data than the image can handle\n if (data.length <= image_bits)\n # Create a new empty image to modify\n new_image = Magick::Image.new(original_image.columns, original_image.rows)\n\n # Initialize the new_pixels array\n @new_pixels = []\n\n # For each pixel in the original image\n # For 8-bit QuantumDepth the QuantumRange is 255\n # For 16-bit QuantumDepth the QuantumRange is 65535\n # For 32-bit QuantumDepth the QuantumRange is 4294967295\n original_image.each_pixel do |pixel, col, row|\n # Set data to empty\n data1 = \"\"\n data2 = \"\"\n data3 = \"\"\n\n # Set colors to their current value\n red = pixel.red\n green = pixel.green\n blue = pixel.blue\n\n # If the data is not empty\n # Grab the first character of data\n if (data.length > 0)\n data1 = data[0]\n data.slice!(0)\n \n # If the data is even and the red pixel is odd\n if ((data1%2 == \"0\") && (red%2 == 1))\n # Change the red to even\n #puts(\"Change red to even\")\n red = red - 1\n end\n\n # If the data is odd and the red pixel is even\n if ((data1%2 == \"1\") && (red%2 == 0))\n # Change the red to odd\n #puts(\"Change red to odd\")\n red = red + 1\n end\n end\n\n # If the data is not empty\n # Grab the second character of data\n if (data.length > 0)\n data2 = data[0]\n data.slice!(0)\n\n # If the data is even and the green pixel is odd\n if ((data2%2 == \"0\") && (green%2 == 1))\n # Change the green to even\n #puts(\"Change green to even\")\n green = green - 1\n end\n \n # If the data is odd and the green pixel is even\n if ((data2%2 == \"1\") && (green%2 == 0))\n # Change the green to odd\n #puts(\"Change green to odd\")\n green = green + 1\n end\n end\n\n # If the data is not empty\n # Grab the third character of data\n if (data.length > 0)\n data3 = data[0]\n data.slice!(0)\n\n # If the data is even and the blue pixel is odd\n if ((data3%2 == \"0\") && (blue%2 == 1))\n # Change the blue to even\n #puts(\"Change blue to even\")\n blue = blue - 1\n end\n \n # If the data is odd and the blue pixel is even\n if ((data3%2 == \"1\") && (blue%2 == 0))\n # Change the blue to odd\n #puts(\"Change blue to odd\")\n blue = blue + 1\n end\n end\n\n # Save the pixel to the pixel array\n @new_pixels << Magick::Pixel.new(red, green, blue, 0)\n #new_image.store_pixels(col, row, 1, 1, new_pixel)\n\n #puts \"Pixel at: #{col}x#{row}:\n #\\tR: #{new_pixel.red}, G: #{new_pixel.green}, B: #{new_pixel.blue}\"\n end\n\n # Write out the new pixel array\n new_image.store_pixels(0, 0, new_image.columns, new_image.rows, @new_pixels)\n\n # Create a random image name\n image_name = Array.new(10){rand(36).to_s(36)}.join\n\n # Write out the new image\n new_image.write(\"./images/#{image_name}.png\")\n\n # Return the image name we wrote to\n return \"#{image_name}.png\"\n end\n end",
"def encode_end(state)\n\t\tstate.encoded.gsub!(/A/, state.decoder_key_size.chr)\n\t\tstate.encoded.gsub!(/B/, (state.decoder_key_size+5).chr)\n\t\tstate.encoded[0x24, 0] = state.key\n\tend",
"def sbc_a_h\n end",
"def test_encode_rectangle_outer_width\n\n key = \"PLAYFAIREXAMPLE\"\n pf = Playfair.new(key)\n\n assert_equal(\"FI\", pf.encode(\"PM\"))\n end",
"def key_byte\n @i = (@i + 1) % 256\n @j = (@j + @sbox[@i]) % 256\n @sbox[@i], @sbox[@j] = @sbox[@j], @sbox[@i]\n @sbox[(@sbox[@i] + @sbox[@j]) % 256]\n end",
"def b2h\n hex = self.unpack(\"H*\")[0]\n hex.scan(/.{,32}/).map{|s|\n s.scan(/../) * \" \"\n } * \"\\n\"\n end",
"def make_bitmap_data0\r\n gz = Zlib::GzipWriter.open('hoge.gz')\r\n t_Fx = 0\r\n w = @bitmap.width\r\n h = @bitmap.height\r\n data = []\r\n for y in 0...h\r\n data.push(0)\r\n for x in 0...w\r\n t_Fx += 1\r\n if t_Fx % 10000 == 0\r\n Graphics.update\r\n end\r\n if t_Fx % 100000 == 0\r\n s = data.pack(\"C*\")\r\n gz.write(s)\r\n data.clear\r\n end\r\n color = @bitmap.get_pixel(x, y)\r\n red = color.red\r\n green = color.green\r\n blue = color.blue\r\n alpha = color.alpha\r\n data.push(red)\r\n data.push(green)\r\n data.push(blue)\r\n data.push(alpha)\r\n end\r\n end\r\n s = data.pack(\"C*\")\r\n gz.write(s)\r\n gz.close \r\n data.clear\r\n gz = Zlib::GzipReader.open('hoge.gz')\r\n data = gz.read\r\n gz.close\r\n File.delete('hoge.gz')\r\n return data\r\n end",
"def compression\n @gapi.compression\n end",
"def cheri_icon\n @cheri_icon ||= get_icon('cheri_icon_16x16.png')\n end",
"def image_hwstring(width, height)\n out = ''\n if width\n out += 'width=\"' + width.to_i.to_s + '\" '\n end\n if height\n out += 'height=\"' + height.to_i.to_s + '\" '\n end\n out\n end",
"def content\n [width, height, depth, color, compression, filtering, interlace].pack('NNC5')\n end",
"def galoi(valor)\n valor= valor << 1\n h=valor & 0x100\n if (h== 0x100)\n valor^= 0x11b\n end\n valor\n end",
"def key_image(key)\n case key\n when A then return Atoa::A_Image\n when B then return Atoa::B_Image\n when C then return Atoa::C_Image\n when X then return Atoa::X_Image\n when Y then return Atoa::Y_Image\n when Z then return Atoa::Z_Image\n when L then return Atoa::L_Image\n when R then return Atoa::R_Image\n when UP then return Atoa::UP_Image\n when DOWN then return Atoa::DOWN_Image\n when LEFT then return Atoa::LEFT_Image\n when RIGHT then return Atoa::RIGHT_Image\n end\n end",
"def algorithm\n \"HS256\"\n end",
"def rc4_initialize(key)\r\n @q1 = 0\r\n @q2 = 0\r\n @key = []\r\n key.each_byte { |elem| @key << elem } while @key.size < 256\r\n @key.slice!(256..@key.size - 1) if @key.size >= 256\r\n @s = (0..255).to_a\r\n j = 0\r\n 0.upto(255) do |i|\r\n j = (j + @s[i] + @key[i]) % 256\r\n @s[i], @s[j] = @s[j], @s[i]\r\n end\r\n end",
"def fw\n return 2 * rhl\n end",
"def upc_e\n generate_barcode('barcode.upc_e')\n end",
"def to_abgr_stream\n pixels.pack(\"V*\")\n end",
"def record(width, height, &rendering_code); end",
"def base_height; 24; end",
"def base_height; 24; end",
"def digest_byte_code(byte_code)\n abc = ARuby::SWF::ABC.new\n abc.unserialize(ByteBuffer.new(byte_code))\n end",
"def test055()\n begin\n theCommands = CommandModule::SmigCommands.new\n theSize = MIShapes.make_size(4, 1)\n bitmapObject = theCommands.make_createbitmapcontext(\n size: theSize,\n addtocleanup: true,\n preset: \"AlphaPreMulFirstRGB8bpcInt\")\n fillRect = MIDrawElement.new(:fillrectangle)\n fillRect.rectangle = MIShapes.make_rectangle(size: theSize)\n fillRect.fillcolor = MIColor.make_rgbacolor(1,0,0)\n\n drawCommand = CommandModule.make_drawelement(bitmapObject,\n drawinstructions: fillRect)\n theCommands.add_command(drawCommand)\n pixelDataRect = MIShapes.make_rectangle(xloc: 0, yloc: 0,\n width: 1, height: 1)\n getPixelDataCommand = CommandModule.make_getpixeldata(\n bitmapObject,\n rectangle: pixelDataRect)\n theCommands.add_command(getPixelDataCommand)\n theResult = Smig.perform_commands(theCommands)\n previousResult = '{\"pixeldata\":[[0,0,255,255,0,0]],\"contextinfo\":{\"alphainfo\":16386,\"bitspercomponent\":8,\"colorspace\":\"kCGColorSpaceSRGB\",\"bitsperpixel\":32},\"columnnames\":[\"x\",\"y\",\"Alpha\",\"Red\",\"Green\",\"Blue\"]}'\n if theResult != previousResult\n puts theResult\n raise \"Pixel data has changed.\"\n end\n \n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: #{Smig.exitstring}\"\n end\n puts e.message\n puts e.backtrace.to_s\n puts #{Smig.exitstring}\"\n ensure\n end\nend",
"def rhl\n return ((hex_side_length - 0.15) * Math.cos(Math::PI / 6)) \n end",
"def getbyte\n end",
"def getbyte\n end",
"def write_on_bitmap\n draw_key_icon(@key, padding, padding)\n x = padding + 26\n y = padding\n w = @width\n h = base_height\n bitmap.draw_text(x, y, w, h, @text)\n end",
"def hsla_color; end",
"def pasar_cadena(cadena)\n letra = \"\"\n i = 0\n aux =\"\"\n \n cadena.bytes do |c|\n # 32 es el espacio Se pone un 0 para que se de 8 bit\n i = i + 1\n if( i==8) then\n aux << c\n letra << aux.to_i(2).chr\n aux =\"\"\n i=0\n elsif \n \n aux << c\n \n end\n \n # binario << \"0\" + c.to_s(2)\n end\n return letra\n end",
"def upc_a\n generate_barcode('barcode.upc_a')\n end",
"def new_character(unicode)\n {:width=>\"1000\", :flags=>\"W\", :layercount=>\"2\", :splineset=>\"\", :unicode=>unicode}\n end",
"def to_alpha_channel_stream\n pixels.pack(\"C*\")\n end",
"def test_load_8bit_interlaced_paletted\n img = Imgrb::Image.new(\"test/png_test_suite/basi3p08.png\")\n assert INDEXED_8BIT_DEPALETTED_R_ROWS == img.get_channel(0).rows\n assert INDEXED_8BIT_DEPALETTED_G_ROWS == img.get_channel(1).rows\n assert INDEXED_8BIT_DEPALETTED_B_ROWS == img.get_channel(2).rows\n end",
"def default_expected_micalg\n \"pgp-sha512\"\n end",
"def encode h\n return h.init_data if h.vanila?\n str = h.to_json\n str = @cipher_key ? cipher(str) : encode64(str)\n digest = @dss.digest str\n return h.init_data if digest == h.init_digest\n\n sig = @dsa.syssign digest\n \"#{encode64 sig}/#{str}\"\n end",
"def createAscii(options = {})\n if @status == true\n options = {\"width\" => 90, \"color\" => true}.merge(options)\n\t img = Magick::Image.from_blob(@data).first\n\t width = options[\"width\"]\n\t scale = (width.to_f / img.columns)\n\t \n\t height = ((img.rows * scale) / 2).to_i\n\t # puts height\n\t if height >= 100\n\t \theight = 80\n\t end\n\n\t border = \"+#{'-' * width}+\\n\"\n\t output = border.dup\n\n\t img.resize!(width, height)\n\t color_image = img.dup if options[\"color\"]\n\t img = img.quantize(@image_chars.length, Magick::GRAYColorspace).normalize\n\t quantum_calc = Magick::QuantumRange / (@image_chars.length - 1)\n\n\t \n\t img.view(0, 0, width, height) do |view|\n\t \n\t height.times do |i|\n\t \n\t output << '|'\n\t width.times do |j|\n\n\t character = @image_chars[view[i][j].red/quantum_calc] \n\n\t if options[\"color\"]\n\t pix = color_image.pixel_color(j,i)\n\t character = character.color(unified_rgb_value(pix.red), unified_rgb_value(pix.green), unified_rgb_value(pix.blue))\n\t end\n\n\t output << character\n\t end\n\n\t output << \"|\\n\"\n\t end\n\t end\n\n\n\t output << border\n\t return output\n end\n end",
"def acrostic_decoder(coded_message)\n # write code here \nend",
"def ecd_pack_cpsd cpsd\n\t\tbase_ofs = 0\n\t\tamp_ofs = base_ofs + C.sizeof(@pack.htype)\n\t\tpack_ofs = base_ofs + C.sizeof(@pack.htype) * 2\n\t\trecl_ofs = pack_ofs + 4\n\t\tx = \"nxd\"\n\t\ty = \"nyd\"\n\t\tnelems = \"buf->nelems\"\n\t\tif @miss.lcname == \"mask\"\n\t\t\tx = \"i\"\n\t\t\ty = \"1\"\n\t\t\tnelems = \"i\"\n\t\tend\n\t\ttext = (<<-EOF).gsub(/^\\s*\\|/, \"\")\n\t\t|\tN_UI4\ti;\n\t\t|\tconst #{@user.ctype} *source = buf->ob_ptr;\n\t\t|\t#{@pack.elemint} *packed;\n\t\t|\t#{@pack.htype} base, amp;\n\t\t|\t#{@user.ctype} max0;\n\t\t|\t#{@user.ctype} min0;\n\t\t|\tdouble scale, base_d, amp_d;\n\t\t|\tunsigned char *dptr;\n\t\t|\tlong rlen;\n\t\t|#{ecd_miss_decl}\n\t\t|\t/* code */\n\t\t|#{ecd_maxmincheck}\n\t\t|#{@user.maxminzero}\n\t\t|#{@pack.getfactor}\n\t\t|\t#{ecd_miss_set}\n\t\t|\tPOKE_#{@pack.htype}(drec + #{base_ofs} + #{miss_offset}, base);\n\t\t|\tPOKE_#{@pack.htype}(drec + #{amp_ofs} + #{miss_offset}, amp);\n\t\t|\tpacked = (#{@pack.elemint} *)nus_malloc(sizeof(#{@pack.elemint})*buf->nelems);\n\t\t|#{parallel}\n\t\t|\tfor (#{i} = 0; #{i} < buf->nelems; #{i}++) {\n\t\t|\t\t#{ecd_mask_core}\n\t\t|\t}\n\t\t|\tdptr = drec + #{pack_ofs} + #{miss_offset};\n\t\t|\trlen = nus_encode_#{cpsd}((const unsigned char *)packed, #{x}, #{y}, dptr, sizeof(#{@pack.elemint})*buf->nelems*2);\n\t\t|\tnus_free(packed);\n\t\t|\tif (rlen < 0) { return rlen; }\n\t\t|\treturn #{recl_ofs} + #{miss_offset} + rlen;\n\t\tEOF\n\tend",
"def build_common\n @font.encoding = 'UniJIS-UCS2-H'\n @font.names = NAMES\n # Initialize font dictionary.\n @dict.registry = 'Adobe'\n @dict.ordering = 'Japan1'\n @dict.supplement = 2\n @dict.default_width = 1000\n @dict.default_vertical_widths = [880, -1000]\n # Initialize font descriptor.\n @desc.b_box = [0, -136, 1000, 859]\n @desc.italic_angle = 0\n @desc.ascent = 859\n @desc.descent = -140\n @desc.cap_height = 769\n @desc.stem_v = 78\n end",
"def hex() end",
"def generate(char, size, color)\n color = \"#\" + color.rgb.map{|f| f.to_s(16).rjust(2, \"0\") }.join()\n path = @fontimage.write(char.value, color, size.to_i)\n font_image_url(path)\n end",
"def c\n center(26)\n end",
"def binmode() end",
"def binmode() end",
"def binmode() end",
"def sbc_a_d8\n end",
"def xor_d8\n end",
"def code\n return get_upc(@image)\n end",
"def barcode_generator\n require 'barby'\n require 'barby/barcode/code_128'\n require 'barby/outputter/png_outputter'\n\n code = @package.barcode_packet\n # Set a path to store png\n path = \"barcodes/#{code}.png\"\n\n\n # Create a barcode with secure barcode_128\n barcode = Barby::Code128B.new(code)\n # Set to BINARY because it can't convert assci 8 bit to a utf-8 8 bit image, so, convert: binary => base64 => utf-8\n # Save in path directory\n File.open(path, 'w:BINARY'){ |f|\n f.write barcode.to_png(:height => 40, :margin => 5)\n }\n end",
"def imagemagick7?; end",
"def convert_to_key(real_color)\n return \"%02X\" % (real_color * 255)\nend",
"def make_bitmap_data1\r\n w = @bitmap.width\r\n h = @bitmap.height\r\n data = []\r\n for y in 0...h\r\n data.push(0)\r\n for x in 0...w\r\n color = @bitmap.get_pixel(x, y)\r\n red = color.red\r\n green = color.green\r\n blue = color.blue\r\n alpha = color.alpha\r\n data.push(red)\r\n data.push(green)\r\n data.push(blue)\r\n data.push(alpha)\r\n end\r\n end\r\n return data.pack(\"C*\")\r\n end",
"def compression; end",
"def cgimage\n CGBitmapContextCreateImage(@ctx) # => CGImageRef (works with bitmap context only)\n #cgimageref = CGImageCreate(@width, @height, @bits_per_component, nil,nil,@colorspace, nil, @provider,nil,true,KCGRenderingIntentDefault)\n end",
"def each_byte\n end",
"def koreanKey() # Kekekekeke\n\treturn \"\\x63\\xB8\\x2B\\xB4\\xF4\\x61\\x4E\\x2E\\x13\\xF2\\xFE\\xFB\\xBA\\x4C\\x9B\\x7E\"\nend",
"def print_header\n header = \"\"\n Imgrb::BmpMethods::add_bmp_bytes(header, file_size, 4)\n\n #Reserved, depends on application. Safe to set to 0s\n header << 0.chr*4\n\n #Offset. 40 (from DIB) + 14 (from header)\n Imgrb::BmpMethods::add_bmp_bytes(header, 54, 4)\n\n #Size of DIB-header\n Imgrb::BmpMethods::add_bmp_bytes(header, 40, 4)\n\n Imgrb::BmpMethods::add_bmp_bytes(header, @width, 4)\n Imgrb::BmpMethods::add_bmp_bytes(header, @height, 4)\n\n #Color planes, must be set to 1\n Imgrb::BmpMethods::add_bmp_bytes(header, 1, 2)\n\n #Bits per pixel. Always write 24-bit bmps.\n Imgrb::BmpMethods::add_bmp_bytes(header, 24, 2)\n\n #No compression\n Imgrb::BmpMethods::add_bmp_bytes(header, 0, 4)\n\n #Image size. Can be 0 for compression method 0.\n Imgrb::BmpMethods::add_bmp_bytes(header, image_size, 4)\n\n Imgrb::BmpMethods::add_bmp_bytes(header, @horizontal_res, 4)\n Imgrb::BmpMethods::add_bmp_bytes(header, @vertical_res, 4)\n\n #Default color palette\n Imgrb::BmpMethods::add_bmp_bytes(header, 0, 4)\n\n #All colors important\n Imgrb::BmpMethods::add_bmp_bytes(header, 0, 4)\n end",
"def kcode() end",
"def grid_image\n s = ''\n s << \" %s %s %s \\n\" % [own(256), own(128), own(64)]\n s << \" %s %s %s \\n\" % [own(32), own(16), own(8)]\n s << \" %s %s %s \\n\" % [own(4), own(2), own(1)]\n s\n end",
"def decode\n \"#{@width}%x#{@height}+#{offset_x}+#{offset_y}\"\n end",
"def get_cardsymbolimage_of(lbl)\r\n index = 0\r\n index = SYMBIMAGE_CARD[lbl][:ix] if SYMBIMAGE_CARD[lbl]\r\n return @symbols_card[index]\r\n end",
"def swift_bic; end"
] |
[
"0.5783946",
"0.5724541",
"0.53958356",
"0.5323703",
"0.5311564",
"0.52439237",
"0.51876384",
"0.5156179",
"0.5156179",
"0.5151124",
"0.5150838",
"0.5118829",
"0.5089709",
"0.5073772",
"0.5069505",
"0.5060393",
"0.5059443",
"0.5059357",
"0.5044219",
"0.5018501",
"0.5006215",
"0.50057846",
"0.49984366",
"0.49925843",
"0.49905357",
"0.49869996",
"0.4985181",
"0.4981759",
"0.49767268",
"0.4973475",
"0.49649742",
"0.49647263",
"0.49625355",
"0.49603677",
"0.4936188",
"0.49311945",
"0.49308273",
"0.4929936",
"0.49099994",
"0.4904805",
"0.4893477",
"0.48872057",
"0.48837122",
"0.48640376",
"0.48554128",
"0.48550972",
"0.48548532",
"0.4851763",
"0.48509008",
"0.4846343",
"0.48413002",
"0.48327276",
"0.48303157",
"0.4829361",
"0.48246053",
"0.48195565",
"0.4816893",
"0.48008138",
"0.47987878",
"0.47987878",
"0.47981134",
"0.47971138",
"0.47966558",
"0.4795231",
"0.4795231",
"0.47931823",
"0.4787079",
"0.47857434",
"0.47830433",
"0.478243",
"0.47811112",
"0.47780114",
"0.47774407",
"0.47731176",
"0.47728726",
"0.47723505",
"0.47718543",
"0.4771152",
"0.47625318",
"0.475721",
"0.4741554",
"0.47398072",
"0.47398072",
"0.47398072",
"0.47367916",
"0.47356853",
"0.47344404",
"0.47333425",
"0.47221014",
"0.47219288",
"0.47159636",
"0.47150597",
"0.47091317",
"0.47038525",
"0.46972397",
"0.469573",
"0.46956003",
"0.46953338",
"0.4692864",
"0.46913752",
"0.46873194"
] |
0.0
|
-1
|
codecite revised_delete_matches codecite lookups
|
def many_lookups(keys)
h = {}
keys.each{|k| h[k] = rand(100)}
1_000_000.times do
key = keys[rand(keys.size)]
v = h[key]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_matched\n raise NotImplementedError, \"#{self.class} does not support delete_matched\"\n end",
"def delete_matched(matcher, options = nil)\n key = expand_key(matcher)\n\n begin\n @gibson.mdel key\n rescue\n 0\n end\n end",
"def delete_matched(matcher, options = nil)\n @redis.keys(\"#{VALUE_PREF}_*\").map{|key| key[(VALUE_PREF.size + 1)..-1] }.grep(matcher).each do |key| \n delete_entry(key, options)\n end.size\n end",
"def delete_matched(matcher, options = T.unsafe(nil)); end",
"def delete_matched(matcher, options = nil) # :nodoc:\n options = merged_options(options)\n response = instrument(:delete_matched, matcher.inspect) do\n matcher = key_matcher(matcher, options)\n @data.keys(matcher).each { |key| @data.del key }\n end\n rescue => e\n logger.error(\"Error calling delete_matched on redis: #{e}\") if logger\n nil\n end",
"def delete_matched(matcher, options = nil)\n raise NotImplementedError.new(\"#{self.class.name} does not support delete_matched\")\n end",
"def delete_matched(matcher, options = nil)\n options = merged_options(options)\n instrument(:delete_matched, matcher.inspect) do\n failsafe(:read_multi, returning: false) do\n matcher = key_matcher(matcher, options)\n begin\n with do |store|\n !(keys = store.keys(matcher)).empty? && store.del(*keys)\n end\n end\n end\n end\n end",
"def delete_matched(matcher, _options = nil)\n pattern =\n case matcher\n when Regexp\n matcher.inspect[1..-2]\n when String\n matcher.tr(\"?\", \".\").gsub(\"*\", \".*\")\n else\n raise NotImplementedError, \"Unable to convert #{matcher.inspect} to Regexp pattern\"\n end\n operation_options = ::Couchbase::Options::Query(named_parameters: {\"pattern\" => pattern}, metrics: true)\n operation_options.consistent_with(::Couchbase::MutationState.new(@last_mutation_token)) if @last_mutation_token\n begin\n result = cluster.query(\"DELETE FROM #{scope_qualifier} cache WHERE REGEXP_MATCHES(META(cache).id, $pattern)\", operation_options)\n result.meta_data.metrics.mutation_count\n rescue ::Couchbase::Error::ParsingFailure, ::Couchbase::Error::ServiceNotAvailable\n raise NotImplementedError, \"The server does not support delete_matched operation\"\n end\n end",
"def db_remove\n \"DELETE\" + from_table_where + sql_match_conditions\n end",
"def delete_matches(to_delete, array)\n to_delete = to_delete.reverse # so indexes don't shift down as items are being deleted\n to_delete.each do |num|\n array.delete_at(num)\n end\n array\n end",
"def receive_match(pos_one, pos_two)\n @matches.push(pos_one, pos_two)\n @known_cards.delete_if { |k,v| v.include?(pos_one) || v.include?(pos_two) } #it is deleting that k/v from known_c!!!\n end",
"def borra_fuzzy_match\n return if Rails.env.development_mac?\n # Borra el nombre cientifico\n FUZZY_NOM_CIEN.delete(id)\n\n # Borra los nombre comunes\n 50.times do |i|\n id_referencia = nombre_comun_a_id_referencia(i+1)\n FUZZY_NOM_COM.delete(id_referencia)\n end\n end",
"def delete( *regexs )\n self.dup.delete!( *regexs )\n end",
"def delete_all\n Neo.db.execute_query(\"#{initial_match} OPTIONAL MATCH (n0)-[r]-() DELETE n0,r\")\n end",
"def check_for_matches(guess, key)\n check_for_direct_matches(guess, key)\n delete_matches(@@direct_matches, guess)\n delete_matches(@@direct_matches, key)\n check_for_color_matches(guess, key)\n end",
"def unmatch_existing_match(user_id, matched_id)\n # Find User C/D's Match entry.\n selected_match = Match.where(user_id: matched_id).first\n selected_match.matched_id = nil\n selected_match.save(validate: false)\n\n # Find User A/B's Match entry.\n selector_match = Match.where(user_id: user_id).first\n selector_match.matched_id = nil\n selector_match.save(validate: false)\n end",
"def remove_sync_matches(product)\n product.master.integration_sync_matches.destroy_all\n end",
"def my_hash_deletion_method(source, thing_to_delete)\n p\tsource.delete_if { |pets| pets.to_s.include?(thing_to_delete) }\nend",
"def remove_affects_with_keywords(keywords)\n keywords\n list = @affects.select{ |a| a.fuzzy_match( keywords ) }\n list.each do |affect|\n affect.clear(false)\n end\n return\n end",
"def free!\n return false if matches.empty?\n match_preference_indexes = matches.map { | match | preferences.index match }\n max = match_preference_indexes.max # The index of the match with the lowest preference\n candidate_to_reject = preferences[ max ]\n\n # Delete from both sides\n candidate_to_reject.matches.delete self\n self.matches.delete candidate_to_reject\n end",
"def my_hash_deletion_method!(source, thing_to_delete)\nsource.reject! {|k,v| k == thing_to_delete}\np source\nend",
"def delete_unknown\n Jhead.call(\"-du\", @match, @pattern)\n end",
"def remove_bad_ident_matches(matches)\n passed_matches = []\n matches.each do |m|\n next if (m[\"match_type\"] == \"content_body\" &&\n m[\"matched_content\"] == \"(?-mix:Drupal)\")\n\n next if (m[\"match_type\"] == \"content_cookies\" &&\n m[\"matched_content\"] == \"(?i-mx:ADRUM_BTa)\" &&\n m[\"product\"] == \"Jobvite\")\n\n passed_matches << m\n end\n passed_matches\n end",
"def remove_match_statements(name, action, seqno, cmds)\n raise ArgumentError, 'cmds must be an Array' unless cmds.is_a?(Array)\n\n entries = parse_entries(name)\n return nil unless entries\n entries.each do |entry|\n next unless entry[0] == action && entry[1].assoc(seqno) && \\\n entry[1].assoc(seqno)[0] == seqno\n Array(entry[1].assoc(seqno)[1][:match]).each do |options|\n cmds << \"no match #{options}\"\n end\n end\n end",
"def delete_all\n neo4j_query(\"MATCH (n:`#{mapped_label_name}`) OPTIONAL MATCH (n)-[r]-() DELETE n,r\")\n end",
"def remove_db_updated_results\n result_array.delete_if { |res_hash| DB_UPDATED_CODES.include?(res_hash.keys.first) }\n end",
"def delete_exists_pairs_in_response\n make_currency_pairs - CurrencyPair.pluck(:pair)\n end",
"def discover_deleted_craft existing_craft_map = nil\n #In the root of the campaigns git repo run the --diff-filter command and then return to the current working dir.\n log = self.repo.log_filterD\n \n\n #Select the craft already present in the DB which can either be from passed in existing_craft_map or directly from the DB\n if existing_craft_map\n existing_craft = {\n \"VAB\" => existing_craft_map.has_key?(\"vab\") ? existing_craft_map[\"vab\"].keys : [],\n \"SPH\" => existing_craft_map.has_key?(\"sph\") ? existing_craft_map[\"sph\"].keys : []\n } \n else \n existing_craft = {\n \"VAB\" => self.craft.where(:craft_type => \"vab\").map{|c| c.name},\n \"SPH\" => self.craft.where(:craft_type => \"sph\").map{|c| c.name}\n } \n end\n\n #get all the SHA_ID's used in the campaigns repo\n logs = self.repo.log.map{|log| log.to_s}\n\n #split logs so that each element contains one commit and each commit is an array, the 1st element of which is the SHA_ID\n log = log.split(\"commit \").map{|l| l.split(\"\\n\") }.select{|l| !l.empty?}\n\n log.map{|l|\n next unless logs.include?(l[0]) #perhaps un-nessesary, a security step to ensure this only examines commits whos SHA_ID matches one in this repo.\n commit_info = {\n :sha => l[0], #first element is the SHA_ID\n #select lines which include \"delete mode\" and remove the \"delete mode\" text. Each line (of which there maybe 1 or more) is a file which was deleted.\n :deleted => l.select{|line| line.include?(\"delete mode\")}.map{|line| line.gsub(\"delete mode 100644\",\"\").strip}.map{|data|\n s = data.sub(\"Ships/\",\"\").split(\"/\") #assume the file path has 'Ships/' and remove it and split on '/'\n d = {:craft_type => s[0], :name => s[1]} #assuming the file is a craft, the first element will be VAB or SPH and the 2nd element will be the name.craft\n d = nil unless d[:name].include?('.craft')#set d to nil 'skip' if the name does not include .craft\n #second skip clause, skip if the craft type is not either VAB or SPH and skip if the existing craft already contain a craft by that name (for that craft_type).\n d = nil if ![\"SPH\",\"VAB\"].include?(d[:craft_type]) || existing_craft[d[:craft_type]].include?(d[:name].sub(\".craft\",\"\"))\n d\n }.compact #remove the nil'ed entries\n }\n commit_info = nil if commit_info[:deleted].compact.empty? #if all the entries were nil'ed then skip this commit\n commit_info\n }.compact #remove the nil'ed commits.\n end",
"def nuclear_option!\n query(\"MATCH (n) DETACH DELETE n\")\n end",
"def my_array_deletion_method!(source, thing_to_delete)\r\n words_to_delete = source.find_all { |f| f.to_s.include?(thing_to_delete)}\r\n words_to_delete.each do |word|\r\n source.delete(word)\r\n end\r\n p source\r\nend",
"def delete_iptc\n Jhead.call(\"-di\", @match, @pattern)\n end",
"def delete(key); end",
"def delete(key); end",
"def delete(key); end",
"def delete(key); end",
"def delete(key); end",
"def delete_matched(pattern, options = {})\n namespaced = namespaced_key(pattern, merged_options(options))\n\n invoke(:delete, pattern) do |store|\n cursor = nil\n count = options.fetch(:count, 1000)\n deleted = 0\n\n until cursor == '0'\n cursor, matched = store.scan(cursor || 0, match: namespaced, count: count)\n\n if matched.any?\n store.del(*matched)\n deleted += matched.length\n end\n end\n\n deleted\n end\n end",
"def remove_db_updated_results\n result_array.delete_if { |res_hash| DB_UPDATED_CODES.include?(res_hash.keys.first) }\n end",
"def save_unmatched_words # :nodoc:\n tokens = phrase_without_matches.split(' ')\n unmatched_db = Corpus.new(\"unmatched-#{program_name}.db\")\n tokens.each do |token|\n if !complex_token_matches?(token) # token was not transformed earlier\n @to_match << token\n unmatched_db[token] = @processor.original_text\n end\n end\n unmatched_db.close\n end",
"def del(*keys); end",
"def dedup_pure_rec\n return if @misc[:by_rmid].size < 2\t# Dups not possible for 0 or 1 rmids\n\n rmids = {}\n is_preferred_rmids = {}\n @misc[:by_rmid].each{|rmid,values|\n uuid = values[:pure_rec_ids][:uuid]\n rmids[uuid] ||= []\n rmids[uuid] << rmid\n\n is_preferred_rmids[uuid] ||= []\n is_preferred_rmids[uuid] << (rmid == values[:pure_rec_ids][:externalId])\n }\n return if rmids.all?{|uuid,id_list| id_list.size < 2}\t# 1 rmid for each uuid\n\n # At least 1 record (uuid) needs to be deduped by discarding some rmids.\n is_preferred_rmids.each{|uuid,is_prefs|\n i = is_prefs.find_index{|is_pref| is_pref}\n rmid_keep = i ? rmids[uuid][i] : rmids[uuid][0]\n rmids_to_del = rmids[uuid] - [rmid_keep]\n STDERR.puts \"INFO: For uuid #{uuid} & rmid #{rmid_keep}; deleting matching-rmids #{rmids_to_del.inspect}\"\n rmids_to_del.each{|id| @misc[:by_rmid].delete(id)}\n }\n end",
"def remove(entry); end",
"def my_hash_deletion_method(source, thing_to_delete)\n\tsource.delete_if {|key, value| key.to_s.include?(thing_to_delete)}\nend",
"def remove *k\n\t\t\t# todo combine queries in a transaction\n\t\t\tActiveOrient::Base.logger.debug { \"delete: #{@name} --< #{k.map(&:to_or).join( ' :: ' )}\"}\n\t\t k.map{|l|\t@orient.update( {remove: { @name => l} } ) }\n\t#\t\t@orient.reload!\n\t#\t\t@orient.send @name \n\t\tend",
"def remove(key); end",
"def modification_2_deletion\n projects = Perpetuity[Project].all.sort(:created_at).reverse.to_a[0..4]\n document_mapper = Perpetuity[Document]\n documents = document_mapper.all.to_a\n document_mapper.load_association! documents, :projects\n contract_mapper = Perpetuity[LegalContract]\n contracts = contract_mapper.all.to_a\n contract_mapper.load_association! contracts, :projects\n\n projects.each do |project|\n ds = document_mapper.select{|document| document.project.id == project.id}\n ds.each do |doc|\n document_mapper.delete doc\n end\n\n lc = contract_mapper.select{|contract| contract.project.id == project.id}\n lc.each do |lcon|\n contract_mapper.delete lcon\n end\n\n Perpetuity[Project].delete project\n end\n\n return \"deleted\"\nend",
"def delete_re(pattern, &hndlr)\n @j_del.deleteWithRegEx(pattern) { |j_req| hndlr.call(HttpServerRequest.new(j_req)) }\n end",
"def test_delete\n bf = BloomFilter.new(10, 2, 1, 2, false)\n bf.insert(\"test\")\n assert bf.include?(\"test\")\n bf.delete(\"test\")\n assert !bf.include?(\"test\")\n end",
"def retract_reverse_mappings\n @binary_mappings.each do |object_type, mapping|\n mapping.all_member.to_a. # Avoid problems with deletion from all_member\n each do |member|\n next unless member.is_a?(MM::Mapping)\n member.retract if member.forward_mapping # This is the reverse of some mapping\n end\n mapping.re_rank\n end\n end",
"def recalculate_matches\n Match.destroy_all\n\n self.matches.each do |match_str|\n Match.parse(match_str)\n end\n end",
"def rehash() end",
"def candidates_of(file)\n @table.candidates_of(file).delete(file)\n end",
"def save_direct_matches\n @@direct_matches.each do |i|\n keep_matches[i] = @@player_key[i]\n end\n end",
"def remove_duplicate_matches(matches)\r\n # Sort the items.\r\n # Sort the array without matches[0], since we need it to\r\n # stay in place no matter what.\r\n if matches.length>0\r\n matches[1..-2] = matches[1..-2].sort.uniq\r\n end\r\n matches\r\n end",
"def receive_match(pos, value)\n @visited_first.delete(value)\n @visited_second.delete(value)\n end",
"def delfile(input)\n _records(input).each do |sid|\n if arec = Song.find_by_id(sid)\n begin\n FileUtils.remove(arec.path, :verbose=>true)\n rescue Errno::ENOENT\n end\n arec.state = 'N'\n arec.save_wait\n end\n end\n if @mpattern\n @matchset = Song.search(@mpattern)\n end\n end",
"def test_match_reference\n parser = CEdictParser.new(Rails.root.join(\"data/cedict/test_data/cedict_parser_match_reference.txt\").to_s)\n entries = parser.run\n assert_equal(6,entries.count)\n assert_equal(1,parser.reference_only_entries.count)\n \n merged_entries = parser.merge_references_into_base_entries(entries,parser.reference_only_entries)\n assert_equal(6,merged_entries.count)\n end",
"def rem_qs k,v,p={}; alter_qs :rem, k,v,p; end",
"def my_array_deletion_method!(source, thing_to_delete)\n remove_letter = source.find_all { |letter| letter.to_s.include?(thing_to_delete)}\n\n remove_letter.each { |word| source.delete(word)}\n\n p source\nend",
"def find_remove(preposistion)\n\t\tremove(find(preposition))\n\tend",
"def deleteDescriptionPhyloDB(db, description)\n seen = Hash.new\n STDERR << \"Processing \" << description << \"...\\n\"\n db.query(\"SELECT name FROM contigs WHERE description=\\\"#{description}\\\"\").each do |contig|\n seen[contig.first] = true\n end\n infield = '(\"'+seen.keys.join('\",\"') + '\")'\n [\"geneorders\", \"proteins\", \"rrnas\", \"transcripts\"].each do |tbl|\n db.query(\"DELETE FROM #{tbl} WHERE contig_name IN #{infield}\")\n end\n db.query(\"DELETE FROM contigs WHERE name IN #{infield}\")\nend",
"def xdel(key, *ids); end",
"def delete_duplicated_relationship(entity_sym, relationship_type_desc)\n \n entity = entity_sym.to_s\n \n puts \"---- Deleting duplicated \" + entity + \" relationships: \" + relationship_type_desc\n \n # get an entity _relantionship model\n relationship_model_s = entity.capitalize + \"Relationship\"\n relationship_model = relationship_model_s.constantize\n \n conditions = entity + \"_id IN (SELECT r.\" + entity + \"_id FROM (SELECT \" + entity + \"_id, relationship_type_id, count(*) AS count \" +\n \"FROM \" + entity + \"_relationships WHERE relationship_type_id=(SELECT relationship_type_id FROM relationship_types WHERE \" +\n\t\t\t \" relationship_type_desc='\" + relationship_type_desc +\"') GROUP BY \" + entity + \"_id, relationship_type_id) r WHERE r.count > 1) \" +\n\t\t\t \" AND relationship_type_id=(SELECT relationship_type_id FROM relationship_types WHERE relationship_type_desc='\" + relationship_type_desc +\"')\"\n \n puts conditions\n \n objects = relationship_model.find(:all, :conditions => conditions, :order => entity + '_id, '+ entity + '_relationship_id')\n \n puts \"Objects length:\" + objects.length.to_s\n \n objects_hash = Hash.new\n objects.each do |o|\n \t#puts o.id.to_s + \" -> \" + o.send(entity + \"_id\").to_s\n \tobjects_hash.store(o.id, o.send(entity + \"_id\"))\n end\n \n puts \"---- Objects Hash (with dupes)\"\n puts \"Format: entity _relationship_id: entity _id\"\n puts objects_hash.to_yaml \n \n # by using invert method of Hash class\n # we make values to be keys, hence we get\n # uniq entity _id\n objects_hash_inverted = objects_hash.invert\n #objects_hash = objects_hash_inverted.invert\n \n #puts \"---- Objects Hash (uniq)\" \n #puts objects_hash.to_yaml \n \n puts \"---- Objects Hash Inverted (uniq)\" \n puts objects_hash_inverted.to_yaml \n \n puts \"Objects Hash Inverted (uniq) length:\" + objects_hash_inverted.length.to_s\n \n entities_affected = Array.new\n \n objects_hash_inverted.each_pair {|key, value| \n \t# get entities relationships of which are\n \t# affected for recording purposes\n \tentities_affected.push(key)\n\t\n \t# an entity _relationships record\n\tobject_to_delete = relationship_model.find(value)\n\t\n\t# the associated relationships record\n\trelationship = object_to_delete.relationship\n\t\n\t# delete entity _relationships record\n\tobject_to_delete.destroy\n\t\n\t# delete relationships record\n\trelationship.destroy\n }\n \n puts \"---- Duplicate relationships of type '\" + relationship_type_desc + \"' deleted for the following \" + entity.capitalize + \"s\"\n puts entities_affected.to_yaml\n \nend",
"def cleanup_distances!\n r = get_result(:distances)\n ref = project.datasets.select(&:ref?).select(&:active?).map(&:name)\n return if r.nil?\n\n %i[haai_db aai_db ani_db].each do |db_type|\n db = r.file_path(db_type)\n next if db.nil? || !File.size?(db)\n\n sqlite_db = SQLite3::Database.new db\n table = db_type[-6..-4]\n val = sqlite_db.execute \"select seq2 from #{table}\"\n next if val.empty?\n\n (val.map(&:first) - ref).each do |extra|\n sqlite_db.execute \"delete from #{table} where seq2=?\", extra\n end\n end\n end",
"def record_delete(record)\n # assign picked record PID to variable\n record_pid = $wtmp_entries[record][\"pid\"]\n # Search through each entry in $wtmp_entries array\n $wtmp_entries.reverse.each do |entry|\n # Looks for records with the same PID\n if entry[\"pid\"] == record_pid\n $wtmp_delete.push(entry) # Adds to deleted array - Exists for validation\n $wtmp_entries.delete(entry) # Removes from entry array\n end\n end\nend",
"def unlink(*keys); end",
"def destroy\n @clan_match.destroy\n\n head :no_content\n end",
"def delete(target_key)\n new_map = @map.reject! do |key_value_pair|\n key = key_value_pair.first\n key == target_key\n end\n new_map == @map\n end",
"def remove_from_list(item_to_rmv)\n item_to_rmv.to_str\n updated_list = Hash.new\n updated_list = $old_list.to_h\n #updated_list.delete_if {|key, value| key == item_to_rmv}\n if updated_list.include?(item_to_rmv) == true \n #p \"test\"\n #p item_to_rmv\n #p $old_list\n p updated_list.delete(item_to_rmv)\n p updated_list.each {|key, val| p key, val}\n #p updated_list\n else \n p \"that item isn't on the list\"\n end\n #if $old_list.to_h.include?(item_to_rmv) == true\n # updated_list.delete(item_to_rmv)\n # updated_list = $old_list.to_h\n #else\n # p \"that item isn't on the list\"\n #end\n \n \nend",
"def cleanup_distances!\n r = get_result(:distances)\n ref = project.datasets.select(&:is_ref?).select(&:is_active?).map(&:name)\n return if r.nil?\n [:haai_db, :aai_db, :ani_db].each do |db_type|\n db = r.file_path(db_type)\n next if db.nil? or not File.size? db\n sqlite_db = SQLite3::Database.new db\n table = db_type[-6..-4]\n val = sqlite_db.execute \"select seq2 from #{table}\"\n next if val.empty?\n (val.map(&:first) - ref).each do |extra|\n sqlite_db.execute \"delete from #{table} where seq2=?\", extra\n end\n end\n end",
"def destroy\n self.class.where(:id => self.id).update_all(:is_mirrored => false) if self.is_mirrored?\n super\n end",
"def unmatched_keys; end",
"def accept!(*key_list)\n intersection = keys - key_list\n intersection.each{ |key| delete(key) }\n self\n end",
"def my_array_deletion_method!(source, thing_to_delete)\n source.reject! {|s| s.to_s.include?(thing_to_delete.to_s) }\nend",
"def hdel(key, *fields); end",
"def remove_errant_matches_from(pot_ex_array)\n correct_match_arr = []\n pot_ex_array.each do |example|\n constituents = example.construct_constituents_array\n constituents.each do |const_array|\n if const_array[0] == self.word && const_array[1] == self.hiragana && const_array[3] == self.reading # For this to work, the constituents have to be normalized to dictionary_forms.\n correct_match_arr << example\n end\n end\n end\n return correct_match_arr\n end",
"def remove_record(record)\n condensed_record = condense_record(record)\n atoms = add_occurences(condensed_record,record.id)\n\n @storage.remove(atoms)\n end",
"def remove_record(record)\n condensed_record = condense_record(record)\n atoms = add_occurences(condensed_record,record.id)\n\n @storage.remove(atoms)\n end",
"def my_hash_deletion_method!(source, thing_to_delete)\r\n source.delete(thing_to_delete)\r\n p source\r\nend",
"def remove_fuzzy(item)\n yield_ngrams(item) do |ngram| \n @ngrams.srem(ngram, \"#{item}:#{compute_soundex_code(item)}\")\n end\n end",
"def del(*args); end",
"def delete_operations; end",
"def my_array_deletion_method!(source, thing_to_delete)\n source.reject! {|word| word.to_s.rindex(thing_to_delete) != nil}\n return source\nend",
"def deletion_method(hash)\r\n\r\n hash.delete_if{|spell,number| number<4}\r\n\r\nend",
"def keep_only(*codes)\n to_remove = table.keys - codes.map { |x| prepare_code(x) }\n synchronize do\n @codes = nil\n to_remove.each do |code|\n instances.delete(code)\n table.delete(code)\n end\n end\n end",
"def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end",
"def my_hash_deletion_method!(source, thing_to_delete)\n source.delete(thing_to_delete)\n p source\nend",
"def my_hash_deletion_method!(source, thing_to_delete)\n source.delete(thing_to_delete)\n p source\nend",
"def filter_out_unwanted_names(output, names)\n names.each do |match|\n output.keys.each do |uuid|\n output[uuid].keys.each do |name|\n unless name_matches?(name, match)\n output[uuid].delete name\n end\n end\n end\n end\n end",
"def remove(params)\n params[:real_at] ||= AtStructure.new(params[:at])\n\n # Le text-item de référence\n unless params.key?(:titem_ref)\n params.merge!(titem_ref: params[:real_at].first_titem)\n end\n\n # Pour connaitre l'opération, pour faire la distinction, plus tard, entre\n # une pure suppression et un remplacement. Elle permet aussi d'enregistrer\n # l'opération dans l'historique operations.txt\n unless params.key?(:operation)\n params.merge!(operation: 'remove')\n end\n\n # Un débug (régler les valeurs en haut de ce module)\n if debug_replace? || debug_remove?\n log(\"-> remove(params=#{params.inspect})\")\n end\n\n if params[:operation] == 'remove'\n msg = \"Suppression de “#{params[:real_at].first_titem.content}” (index absolu #{params[:real_at].abs(:at)}, index relatif #{params[:real_at].at}).\"\n log(msg, true)\n end\n\n\n # Si c'est une vraie suppression (i.e. pas un remplacement), il faut\n # supprimer aussi l'espace après. S'il n'y a pas d'espace après, il faut\n # supprimer l'espace avant s'il existe.\n # La formule est différente en fonction du fait qu'on ait un rang ou\n # un index seul et une liste discontinue d'index.\n # ATTENTION AUSSI : l'espace supplémentaire à supprimer est peut-être\n # dans la liste des index à supprimer et dans ce cas il faut étudier\n # le mot suivant et le text-item non-mot suivant.\n #\n # Le but de cette partie est donc de produire la liste exacte des text-items\n # qui doivent être finalement supprimé.\n # Elle n'est valable que pour une suppression pure car pour un replacement,\n # il faut garder tous les éléments autour du mot ou des mots remplacés.\n at = params[:real_at]\n if params[:operation] == 'remove'\n if at.list?\n # Pour une liste, on doit faire un traitement particulier : il faut\n # vérifier les text-item après chaque \"trou\"\n liste_finale = at.list.dup\n at.titems.each_with_index do |titem, idx_in_list|\n # Les non-mots doivent être passés\n next if titem.non_mot?\n # On passe ce mot si le mot suivant appartient aussi à la liste\n next if at.list[idx_in_list + 1] == idx + 1\n # On passe ce mot si le mot précédent appartient aussi à la liste\n next if at.list[idx_in_list - 1] == idx - 1\n # On doit tester ce mot qui est \"seul\" dans la liste, c'est-à-dire\n # que la liste ne contient ni son mot juste après ni son mot\n # juste avant.\n next_index = idx + 1\n next_titem = extrait_titems[next_index]\n prev_index = idx - 1\n prev_index = nil if prev_index < 0\n prev_titem = prev_index.nil? ? nil : extrait_titems[prev_index]\n if next_titem && next_titem.space?\n # On l'ajoute à la liste des items à supprimer\n liste_finale.insert(idx_in_list + 1, next_index)\n elsif prev_titem && prev_titem.space?\n liste_finale.insert(idx_in_list, prev_index)\n end\n end #/ boucle sur la liste\n\n # Si la liste finale a changé, il faut corrigé le at\n if liste_finale != at.list\n params[:real_at] = at = AtStructure.new(liste_finale.join(VG))\n end\n\n else\n # Pour un rang et un index seul, le traitement est plus simple, il\n # suffit de voir l'index après le dernier.\n # Noter qu'on ne supprime pas les espaces ici, on modifie le rang\n # ou on transforme l'index en range, ceci afin de ne pas provoquer\n # de doubles suppressions\n next_index = at.last + 1\n prev_index = at.first - 1\n prev_index = nil if prev_index < 0\n if extrait_titems[next_index].space?\n params[:real_at] = at = AtStructure.new(\"#{at.first}-#{next_index}\")\n elsif prev_index && extrait_titems[prev_index].space?\n params[:real_at] = at = AtStructure.new(\"#{prev_index}-#{at.last}\")\n end\n end\n end\n\n # On mémorise l'opération pour pouvoir l'annuler\n if params.key?(:cancellor) # pas quand c'est une annulation\n at.titems.each do |titem|\n params[:cancellor] << {operation: :insert, index: titem.index, content: params[:content]}\n end\n end\n\n # SUPPRESSION\n # ------------\n # On procède vraiment à la suppression des mots dans le texte\n # lui-même, ainsi que dans la base de données avec une formule différente en\n # fonction du fait que c'est un rang ou une liste (note : un index unique\n # a été mis dans une liste pour simplifier les opérations)\n if at.range?\n extrait_titems.slice!(at.from, at.nombre)\n itexte.db.delete_text_items(from:at.abs(:from), for:at.nombre)\n else\n at.list.each { |idx| extrait_titems.slice!(idx) }\n itexte.db.delete_text_items(at.abs(:list))\n end\n\n # Si c'est vraiment une opération de destruction, on l'enregistre\n # en tant qu'opération et on actualise l'affichage en indiquant que\n # l'extrait a changé\n if params[:operation] == 'remove'\n itexte.operator.add_text_operation(params)\n update\n end\n\nend",
"def run_on_removals(paths)\n end",
"def remove!( *entries )\n _modify( *entries ) { |a,b| a - b }\n end",
"def my_array_deletion_method(source, thing_to_delete)\n source.reject!{ |x| x.to_s.include?(thing_to_delete) }\nend",
"def delete(key)\n\n end",
"def remove!; end",
"def update_variants\n # new_variants = []\n # variant_keys.each do |key|\n # new_variants += Move.where([\"name LIKE ?\", \"%#{key}%\"]).all\n # end\n\n # Yeah, this is not so pretty.\n regex = /#{variant_keys.join('|')}/i\n puts regex.inspect\n new_variants = Move.all.to_a.find_all { |m| m.name =~ regex }\n\n # This stuff doesn't change though\n new_variants.uniq!\n new_variants -= [self]\n self.variants.replace new_variants\n end",
"def delete_by(wildcard)\n redis.keys(wildcard).each do |key|\n redis.del(key)\n end\nend",
"def delete_entry(aliaz)\n\n end",
"def cull_old_ids\n saved_ids = @ids.keys.reverse.take(@max_ids)\n @ids.select! do |k, v|\n saved_ids.include? k\n end\n end",
"def remove_old_stored_csvs\n end",
"def remove; end"
] |
[
"0.6774322",
"0.66050416",
"0.6576475",
"0.64533734",
"0.62030494",
"0.6066605",
"0.6064087",
"0.5980027",
"0.5934873",
"0.5803076",
"0.5779177",
"0.5756609",
"0.5682677",
"0.56647307",
"0.56103575",
"0.5589637",
"0.55868906",
"0.5581016",
"0.5578092",
"0.5563069",
"0.5536397",
"0.54655224",
"0.5465374",
"0.54614335",
"0.545412",
"0.54098505",
"0.53996766",
"0.5385159",
"0.53662825",
"0.53239477",
"0.5318458",
"0.5310564",
"0.5310564",
"0.5310564",
"0.5310564",
"0.5310564",
"0.5296274",
"0.52916473",
"0.5247109",
"0.52427816",
"0.5231487",
"0.52243686",
"0.5220061",
"0.52062947",
"0.5204214",
"0.52004486",
"0.5198143",
"0.51944166",
"0.5191926",
"0.5162416",
"0.5158181",
"0.5146526",
"0.5142281",
"0.5141268",
"0.5140089",
"0.5121866",
"0.51207125",
"0.5103687",
"0.5097717",
"0.5091877",
"0.5087119",
"0.5083472",
"0.5078316",
"0.50718844",
"0.5070595",
"0.506866",
"0.506125",
"0.5052711",
"0.5048473",
"0.5040884",
"0.50367415",
"0.5036402",
"0.5033016",
"0.50283223",
"0.502368",
"0.5022097",
"0.5016395",
"0.5016395",
"0.5015995",
"0.50146073",
"0.5012972",
"0.50063795",
"0.5004217",
"0.50000453",
"0.4996943",
"0.49851042",
"0.49831194",
"0.49831194",
"0.4975451",
"0.49736798",
"0.49732193",
"0.496902",
"0.4963404",
"0.4963159",
"0.49629855",
"0.49580094",
"0.4954753",
"0.4953152",
"0.49494857",
"0.49493235",
"0.49493092"
] |
0.0
|
-1
|
Initialise an object of this class
|
def initialize(p)
super p.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize() end",
"def initialize\n init\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize\n \n end",
"def initialize()\n end",
"def initialize\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize\r\n\r\n end",
"def initialize\n\t\t\n\tend",
"def init\n end",
"def init\n end",
"def init\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def constructor; end",
"def initialize(obj); end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n \n end",
"def initialize\n \n end",
"def initialize\n\n\n\n end",
"def initialize()\n\t\tend",
"def initialize()\r\n\r\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def initialize()\n end",
"def init\n raise NotImplementedError\n end",
"def init\n\n end",
"def initialize\n \n end",
"def initialize\n puts \"constructor is automatically called when we create object\"\n end",
"def initialize\n\n\nend",
"def initialize object\n\t\tself.object = object\n\tend",
"def init\n self\n end",
"def initialize\n\t\nend",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\nend",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n\n end",
"def initialize\n\n end",
"def initialize()\n raise \"#{self.class.to_s} should not be instantiated directly.\"\n end",
"def initialize\n super()\n init_data()\n end",
"def init; end",
"def initialize()\n\tend",
"def initialize()\n\tend",
"def initialize(obj)\n @obj = obj\n end",
"def initialize(obj)\n @obj = obj\n end",
"def initialize\n # nothing here for now\n end"
] |
[
"0.81757414",
"0.8128207",
"0.8067372",
"0.8067372",
"0.80479723",
"0.7882572",
"0.7870836",
"0.7818271",
"0.7818271",
"0.7818271",
"0.7818271",
"0.7818271",
"0.7817099",
"0.78005636",
"0.779854",
"0.779854",
"0.779854",
"0.7768438",
"0.7768438",
"0.7768438",
"0.7768438",
"0.7768438",
"0.7768438",
"0.77560604",
"0.77560604",
"0.77560604",
"0.77560604",
"0.77271044",
"0.7720852",
"0.76837087",
"0.76837087",
"0.76837087",
"0.76837087",
"0.76837087",
"0.76837087",
"0.76837087",
"0.76837087",
"0.76837087",
"0.76837087",
"0.76837087",
"0.7671294",
"0.7671294",
"0.7646991",
"0.7646991",
"0.7646991",
"0.7646991",
"0.7646991",
"0.7646991",
"0.7646991",
"0.7646991",
"0.7646991",
"0.7629138",
"0.7584396",
"0.7584396",
"0.7550882",
"0.75508434",
"0.75340074",
"0.7520771",
"0.7520771",
"0.7520771",
"0.7520771",
"0.7520771",
"0.7520771",
"0.7520771",
"0.7520771",
"0.7496647",
"0.7486342",
"0.74566644",
"0.7407432",
"0.73922133",
"0.73644024",
"0.7338345",
"0.7280125",
"0.7268324",
"0.7268324",
"0.7268324",
"0.7268324",
"0.7268324",
"0.7268324",
"0.7268324",
"0.7262628",
"0.72262746",
"0.72262746",
"0.72262746",
"0.72262746",
"0.72262746",
"0.72262746",
"0.72262746",
"0.72262746",
"0.72262746",
"0.72262746",
"0.7221371",
"0.7221371",
"0.72062504",
"0.718215",
"0.71817",
"0.7179563",
"0.7179563",
"0.7166548",
"0.7166548",
"0.71653295"
] |
0.0
|
-1
|
Return the concatenated path
|
def +(p)
Tenji::Path.new(super(p))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def path\n s = ''\n s << '/' if @absolute\n s << @path.join('/')\n s << '/' if @trail\n s << '.' if s.empty?\n s\n end",
"def path_str\n path.join(\"-\")\n end",
"def to_s\n return \"\" if self.empty?\n @path.join(\":\")\n end",
"def path\n \"/\" + @prefix.join(\"/\")\n end",
"def join(path)\n path_str = path.to_s\n super(path_str[0..0] == '/' ? path_str[1..-1] : path_str).p\n end",
"def join_path(path)\n if path.include?('\\\\') && path.include?('/')\n path.gsub('\\\\', '/')\n else\n path\n end\n end",
"def to_s\n return (@BasePath || \"\") + \"|\" + (@RelativePath || \"nil\")\n end",
"def path\n \"%s/%s\" % [dirname, filename]\n end",
"def path_join(base, path)\n return path if path_is_absolute(path)\n base.gsub(/[\\/]+$/, '') + '/' + path.gsub(/^[\\/]+/, '')\n end",
"def relativePath\n return (parentPathElements + [name]).join(\"/\")\n end",
"def path\n return @path.sub(/^\\//,'').sub(/^%2F/,'/')\n end",
"def join(*args)\n args.unshift self\n result = Path.new(args.pop)\n return result if result.absolute?\n args.reverse_each { |arg|\n arg = Path.new(arg)\n result = arg / result\n return result if result.absolute?\n }\n result\n end",
"def build_path(parent_path)\n return name if (not parent_path) || parent_path.empty?\n parent_path + ::File::SEPARATOR + name\n end",
"def get_path(dest,path)\n if @prev[dest] != -1\n path += get_path(@prev[dest],\"\")\n end\n path += \">#{dest}\"\n end",
"def relativePath\n #N Without this the path elements won't be joined together with \"/\" to get the relative path as a single string\n return @pathElements.join(\"/\")\n end",
"def path(*strings)\n app_dir_pathname.join(*strings).to_s\n end",
"def to_s\n s = ''\n s << '/' if @absolute\n s << @path.join('/')\n s << '/' if @trail\n s << '.' if s.empty?\n s\n end",
"def join_path(*parts)\n File.join(*parts.reject { |x| x.nil? || x.empty? })\n end",
"def abs_path_with(rel_path)\n path = abs_path\n return rel_path if path.nil?\n return \"#{path}.#{rel_path}\"\n end",
"def get_path(path)\n return '' if path.blank?\n return path if path[0] == '/'\n Rails.root.to_s + '/' + path\n end",
"def join_path(*path)\n win_friendly_path(::File.join(path))\n end",
"def join_path(*path)\n win_friendly_path(::File.join(path))\n end",
"def join_and_expand_path(*parts)\n File.expand_path(File.join(parts))\n end",
"def to_s\n return '' if @path.empty?\n\n @path.map { |str| '/' + str.gsub(*ESCAPE) }.join\n end",
"def join(prefix, path, suffix=nil)\n root = prefix.nil? ? path.relative : prefix + \"/\" + path.relative\n suffix.nil? ? root : root + \"/\" + suffix\n end",
"def path_name\n str = name.dup\n str << '/' if is_dir\n str = parent.path_name + str if parent\n str\n end",
"def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\n end",
"def join(*args)\n Path::Name.new(*args)\n #args.unshift self\n #result = args.pop\n #result = Path::Name.new(result) unless Path::Name === result\n #return result if result.absolute?\n #args.reverse_each {|arg|\n # arg = Path::Name.new(arg) unless Path::Name === arg\n # result = arg + result\n # return result if result.absolute?\n #}\n #result\n end",
"def path()\n\t\t\t\t@basePath + \"/\" + hierarchy().join( \"/\" )\n\t\t\tend",
"def rto(a, b)\n\tPathname.new(File.join a, '..', b).cleanpath.to_s\nend",
"def path\n\t\t\t@path_elements.join(\"/\")\n\t\tend",
"def path(*a)\n return @path if a.empty?\n ret = File.join(@path, *(a.map { |arg| arg.to_s }))\n ret = File.expand_path(ret) # Try to fix some heroku issues (?)\n File.exists?(ret) ? ret : nil\n end",
"def to_s\n path\n end",
"def build_path\n @path_values.inject(base_value){|uri,path| uri.merge URI::Generic.build(path: path) }.path\n end",
"def full_path(custom)\n \"#{base_path}/#{custom}\"\n end",
"def to_s\n path\n end",
"def final_path_component(path)\n path.split(PATH_SEPARATOR)[-1].split[0]\n end",
"def full_path\n path\n end",
"def full_path\n File.join(@path, @name)\n end",
"def join_paths(paths)\n paths.join('/').gsub(%r{/+}, '/')\n end",
"def join_paths(*args)\n paths = []\n full_path = []\n temp_paths = []\n args.each {|x| temp_paths << x }\n temp_paths.flatten!\n temp_paths.each do |x|\n unless x.nil?\n paths << x.to_s.dup\n end\n end\n if paths[0].start_with?('/')\n absolute_path = true\n else\n absolute_path = false\n end\n paths.each do |path|\n unless path.nil?\n path.strip!\n path.slice!(0) while path.start_with?('/')\n path.chop! while path.end_with?('/')\n full_path << path\n end\n end\n full_path_string = full_path.join('/')\n full_path_string.slice!(0) while full_path_string.start_with?('/')\n full_path_string.chop! while full_path_string.end_with?('/')\n full_path_string.insert(0, '/') if absolute_path == true\n full_path_string\n end",
"def file_name_with_path\n root_path.dup + file_name\n end",
"def to_s\n @path.dup\n end",
"def +(path)\n self.join(path)\n end",
"def container_path(no_filename: nil, final_slash: nil, use_archive_file_name: nil, leading_dot: nil)\n parts = []\n parts << '.' if leading_dot\n parts << path unless path.blank?\n parts << file_name unless no_filename\n res = File.join parts\n res += '/' if final_slash && !res.empty?\n res\n end",
"def join(*args)\n args.unshift self\n result = args.pop\n result = VirtualPath.new(result) unless VirtualPath === result\n return result if result.absolute?\n args.reverse_each {|arg|\n arg = VirtualPath.new(arg) unless VirtualPath === arg\n result = arg + result\n return result if result.absolute?\n }\n result\n end",
"def to_s\n '/' + @path.map { |part|\n if part.is_a? String\n part\n elsif part.is_a? Symbol\n part.inspect\n else\n fail \"Invalid path part: #{part}\"\n end\n }.join('/')\n end",
"def path\n folder.path + name\n end",
"def collect_path_string(dir_set)\n path = \"/\"\n dir_set.each { |dir| path += \"#{dir}/\" }\n path\n end",
"def concat(*paths) = add(paths, position: :last)",
"def full_path(file_or_bucket)\n path = ''\n if(file_or_bucket.respond_to?(:bucket))\n path << '/' << bucket_path(file_or_bucket.bucket)\n end\n path << '/' << file_path(file_or_bucket)\n path\n end",
"def to_s\n out = absolute_prefix\n out += @parts.join(NATIVE_DIRECTORY_SEPARATOR)\n out\n end",
"def full_path; end",
"def to_s\n @path\n end",
"def to_s\n @path\n end",
"def to_s\n @path\n end",
"def path(*segments)\n segments.collect! {|segment| segment.to_s }\n File.join(grit.path, *segments)\n end",
"def shortpath(fullpath)\n components = Pathname(fullpath).each_filename.to_a\n return fullpath if components.size <= 2\n\n File.join(\"...\", components[-3..-1])\n end",
"def relative_path(path)\n path[self.prefix.size..-1].gsub(%r{^/}, '').tap do |pth|\n #puts \"self.prefix=#{self.prefix}, path=#{path}, result=#{pth}\"\n end\n end",
"def join(basedir, dir)\n return \"#{basedir}#{dir[2..-1]}\" if windows? && !basedir.empty? && (dir.length > 2)\n\n \"#{basedir}#{dir}\"\n end",
"def getFullPath(relativePath)\n return baseDir + relativePath\n end",
"def path\n name + extension\n end",
"def fullpath; end",
"def expand(path)\n (root_path/trim(path)).to_s\n end",
"def relative_pallet_path_for(element) \n sub_path = @sub_path.to_s\n sub_path = sub_path[1..-1] + '/' unless sub_path.blank?\n return sub_path << element\n end",
"def reduce_path(path)\n if path =~ /^(https?:\\/\\/.+)(\\/.*)/\n prefix = $1\n path = $2\n relative = false\n else\n prefix = nil\n relative = path[0] != '/'\n end\n\n while path.sub!(/\\/*[^\\/]+\\/+\\.\\./, ''); end\n while path.sub!(/\\/+\\.\\/+/, '/'); end\n path = path[2..-1] if path[0..1] == './'\n while path.sub!(/\\/\\//, '/'); end\n\n path = path[1..-1] if relative and path[0] == '/'\n path = prefix + path if prefix\n path\n end",
"def resource_path(*components)\n components.collect { |c| URI.escape c }.join('/')\n end",
"def linked_path_for(path)\n return path unless path.include?('/')\n current_path_base = request.env['REQUEST_URI'].gsub(path,'')\n dirs = path.split('/')\n file = dirs.pop\n linked_path = ''\n dirs.each do |dir|\n link = '<a href=\"' + current_path_base + dir + '\">' + dir + '</a>'\n current_path_base << \"#{dir}/\"\n linked_path << \"#{link}/\" \n end\n linked_path << file\n end",
"def full_path\n container.root.join(path)\n end",
"def full_path\n container.root.join(path)\n end",
"def join_path segments, root = nil\n root ? %(#{root}#{segments * SLASH}) : segments * SLASH\n end",
"def path_expanded path\n end",
"def to_s\n @path\n end",
"def container_path(no_filename: nil, final_slash: nil, use_archive_file_name: nil, leading_dot: nil)\n parts = []\n parts << '.' if leading_dot\n if use_archive_file_name && archive_file.present?\n parts << archive_file.to_s\n elsif archive_mount_name.present?\n parts << archive_mount_name.to_s\n end\n parts << path.to_s unless path.blank?\n parts << file_name.to_s unless no_filename\n res = File.join parts\n res += '/' if final_slash && res.present?\n res.to_s\n end",
"def path\n '/' + path_states.map(&:name)[1..-1].join('/')\n end",
"def path\n File.join(@base, @name)\n end",
"def relative_path(path)\n path.split('/').drop(5).join('/')\nend",
"def to_s\n @path\n end",
"def uniPath(source)\n source.gsub(/\\\\/, File::SEPARATOR)\nend",
"def path(name)\n root.join(name)\n end",
"def paths_s\n \"['#{paths.join(\"','\")}']\"\n end",
"def make_path inOut, name=''\r\n return @options[inOut] + '/' + name\r\n end",
"def format_path(entry)\n server_path = entry.path\n if base_path && server_path[0,base_path.length] == base_path\n if server_path == base_path\n return \".\"\n elsif server_path[base_path.length,1] == \"/\"\n return server_path[base_path.length + 1, server_path.length - base_path.length - 1]\n elsif base_path == \"/\" && server_path[0,1] == \"/\"\n return server_path[1, server_path.length - 1]\n end\n end\n server_path\n end",
"def to_s\n @parts.join(NATIVE_PATH_SEPARATOR)\n end",
"def to_relative_path\n File.join('.', to.path(identify).to_s)\n end",
"def path(join_with = '_')\n @path = (namespace.path(join_with) + join_with unless namespace.nil? or namespace.path.empty?).to_s + @name.to_s\n end",
"def canonical_path\n p = path.gsub(/\\/+/,'/')\n p.length > 1 ? p.chomp('/') : p\n end",
"def build_path\n end",
"def base_path\n [attachment_options[:path_prefix], attachment_path_id].join(\"/\")\n end",
"def path\n @path ||= [ path_only ].concat( [*matrix].delete_if { |v| v.respond_to?(:empty?) and v.empty? } ).join('')\n end",
"def fullpath\n File.join(@root, @path)\n end",
"def add_path(s, val)\n if s.empty?\n s = val.to_s\n else\n s = s + \"->\" + val.to_s\n end\n return s\nend",
"def path\n File.join(@base, @name)\n end",
"def join(other)\n if other.is_a? Integer\n return shed(-other) if other.negative?\n\n other = other.to_s\n end\n\n other = '/' + other if other.is_a?(String) && other[0] != '/'\n self.class.new(@path + self.class.new(other).to_a)\n end",
"def __build_path(entries)\n parts = entries[0][:path].split('/')\n parts.pop(entries[0][:chunks].length)\n parts.join('/') # stitch parts together to form a path\n end",
"def path(name=nil)\n if name\n return @dir + '/' + name\n else\n return @dir\n end\n end",
"def relative_directory\n return '' unless @directory_root\n @path - @directory_root - name\n end",
"def full_path_for(path)\n path = \"/#{path}\" unless path[0..0] == '/'\n path\n end",
"def path\n folders = ancestors.reverse + [self]\n folders.shift # Remove the root folder\n path = File.join('/', folders.map(&:name))\n Pathname.new(path)\n end",
"def getFullPath(relativePath)\n return @baseDirectory.fullPath + relativePath\n end",
"def join_path(*path)\n windows? ? win_friendly_path(::File.join(path)) : ::File.join(path)\n end"
] |
[
"0.74296117",
"0.7292411",
"0.7278487",
"0.716188",
"0.70760024",
"0.69143766",
"0.68920183",
"0.684579",
"0.682155",
"0.6789956",
"0.6778412",
"0.6757849",
"0.6728688",
"0.6701082",
"0.6676298",
"0.6655346",
"0.66476667",
"0.6633297",
"0.66215134",
"0.6604594",
"0.65826005",
"0.65826005",
"0.6577012",
"0.65769136",
"0.65758055",
"0.652358",
"0.6516751",
"0.6510926",
"0.64999324",
"0.64997864",
"0.6484731",
"0.6476455",
"0.6446236",
"0.6435844",
"0.6425273",
"0.64202595",
"0.64168864",
"0.64127994",
"0.6409468",
"0.64009595",
"0.6399793",
"0.63996917",
"0.639949",
"0.6398118",
"0.63971937",
"0.6393744",
"0.63856775",
"0.63801736",
"0.6379971",
"0.63744533",
"0.6373492",
"0.63695633",
"0.63677204",
"0.63659346",
"0.63659346",
"0.63617074",
"0.634375",
"0.6339281",
"0.6325442",
"0.6311904",
"0.6307897",
"0.62988627",
"0.6295307",
"0.62931913",
"0.62920904",
"0.6290193",
"0.62888503",
"0.62854505",
"0.62824285",
"0.62824285",
"0.6278212",
"0.62698966",
"0.6269601",
"0.6240855",
"0.62383497",
"0.62367594",
"0.6235841",
"0.62321645",
"0.62297875",
"0.62293035",
"0.6228582",
"0.62259877",
"0.6222794",
"0.62166286",
"0.6213741",
"0.6209688",
"0.6202545",
"0.6200031",
"0.61935276",
"0.6190895",
"0.6189553",
"0.6182793",
"0.6175302",
"0.61730325",
"0.6167264",
"0.616262",
"0.61555785",
"0.61489",
"0.61334527",
"0.6132605",
"0.6131011"
] |
0.0
|
-1
|
Return the base of a path The 'base' here means the portion of the basename before the extension.
|
def base()
sub_ext('').basename.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def base_path\n @base_path ||= Dir.pwd\n end",
"def base_path\n @base_path ||= server_path(File.expand_path(Dir.pwd))\n end",
"def base\n File.basename @filename, extension_with_delimiter\n end",
"def base_path path=nil\n if path\n @base_path = path\n end\n @base_path || default_base_path\n end",
"def base(filename)\n filename.sub(/\\.[^.]*$/, '')\nend",
"def base_name\n File.basename(file_name)\n end",
"def base_name\n File.basename @absolute_name\n end",
"def base_path\n @base_path || self.class.base_path\n end",
"def base_name\n File.basename @relative_name\n end",
"def absolute_path_base\n absolute_path.gsub File.extname( absolute_path ), ''\n end",
"def chop_path(path, base='.')\n full_base = File.expand_path(base)\n full_path = File.expand_path(path)\n if full_path == full_base\n '.'\n elsif full_path.start_with?(full_base)\n full_path[full_base.size+1..-1]\n else\n full_path\n end\n end",
"def filename_base\n return '_'+basename if is_type_partial?\n basename\n end",
"def path\n @base\n end",
"def get_base\n # See if we need to extend the base_dir\n if @config['base']\n extended_base = File.expand_path(File.join(@real_base, @config['base']))\n if File.directory? extended_base\n @base_dir = extended_base\n else\n puts \"Your base directory doesn't exist: #{extended_base}\"\n exit 1\n end\n end\n end",
"def base file, ext; return File.basename file, ext end",
"def base file, ext; return File.basename file, ext end",
"def base_path\n Dir.pwd + \"/\"\n end",
"def base_path(val=nil)\n if val\n @base_path = val\n else\n @base_path || default_base_path_name\n end\n end",
"def get_corresponding_file_base_name\n return File.basename(@URL)\n end",
"def relative_path path, base\n (root? path) && (offset = descends_from? path, base) ? (path.slice offset, path.length) : path\n end",
"def doc_base(base)\n # find if the document has a base element\n base_el = @doc.at_css(\"html>head>base\") \n base = base_el.attribute(\"href\").to_s.split(\"#\").first if base_el\n base\n end",
"def base_name(suffix=nil)\n adapter.basename(suffix)\n end",
"def default_base_path_name\n self.name.split('::').last.downcase\n end",
"def base\n @base = if doc\n href = doc.search('//head/base/@href')\n URI(href.to_s) unless href.nil? rescue nil\n end unless @base\n\n return nil if @base && @base.to_s().empty?\n @base\n end",
"def input_base_path(input_file,ext=nil)\n input_path=Pathname.new(input_file)\n throw \"Error: Input directory #{input_path.dirname} does not exist\" unless input_path.dirname.exist?\n dir=input_path.dirname.realpath.to_s\n if ( ext==nil)\n ext=input_path.extname \n end\n base_name=input_path.basename.to_s.gsub(/#{ext}$/,\"\")\n \"#{dir}/#{base_name}\"\n end",
"def base_dir(dir_name)\n File.expand_path(dir_name)\n end",
"def basedir\n return nil if !file\n File.dirname File.absolute_path @file\n end",
"def base_path\n self.class.base_path\n end",
"def find_path_with_base(f)\n Dir.glob(f + \"*\").first || \"\" # don't return nil; makes for bad spec error messages\nend",
"def base_path\n [attachment_options[:path_prefix], attachment_path_id].join(\"/\")\n end",
"def base_name\n @base_name ||= if base = name.to_s.split(\"::\").first\n base.underscore\n end\n end",
"def base_path\n File.join(attachment_options[:path_prefix], attachment_path_id)\n end",
"def base_url\n current_base_href = base_href.to_s.strip.empty? ? nil : URL.absolutify(base_href, URL.new(url).root_url)\n current_base_href || url\n end",
"def base\n find_base\n end",
"def get_base\n if @data =~ /<\\s*base[^\\>]*href\\s*=\\s*[\\\"\"\\']?([^\\\"\"\\'\\s>]*).*?>/im\n # if base tag is set in the page, use it\n \n base = ($1[-1] == ?/) ? $1 : $1 + \"/\"\n \n # remove base tag\n @data.gsub!($&, \"\")\n \n base\n else\n # if not, get it from source url\n \n uri = URI.parse(@source)\n \n if uri.scheme == \"http\" \n unless uri.path[-1] == ?/\n if pos = uri.path.rindex('/')\n uri.path = uri.path[0..pos]\n else\n uri.path = nil\n end\n end\n \n URI::HTTP.build([uri.userinfo, uri.host, uri.port, uri.path, nil, nil]).to_s\n else\n nil\n end\n end\n end",
"def get_url_host_base(host)\n host_split = host.split '.'\n\n # check for hostnames without periods, like \"localhost\"\n if host_split.size == 1\n return host\n end\n\n host_split.pop(2).join('.')\n\n end",
"def base_dir_for_path_parameters; end",
"def base\n @info[:base]\n end",
"def basepath; end",
"def base_uri\n ary = contents_uri.to_s.split(\"/\")\n ary.pop if ary[-1].blank?\n ary.pop\n ary.join(\"/\") + \"/\"\n end",
"def base_path\n @base_path ||= self.class.respond_to?(:base_path) ? self.class.base_path : Merb.dir_for(:public)\n end",
"def find_base\n if contents and (found = tag(\"base\", {:href => /.*/}, contents))\n ensure_uri(found[:href])\n else\n extract_base(location)\n end\n end",
"def base_path\n instance.options[:base_path]\n end",
"def base_path(type = 'import')\n ENV['HYKU_MULTITENANT'] ? File.join(Bulkrax.send(\"#{type}_path\"), Site.instance.account.name) : Bulkrax.send(\"#{type}_path\")\n end",
"def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end",
"def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end",
"def base\n return @config[\"base\"]\n end",
"def base?\n @base ||= path.compact.empty?\n end",
"def base_uri\n url = URI.parse( @config[\"portal_url\"] )\n if url.path === \"/\"\n return \"\"\n else\n return url.path\n end\n end",
"def base\n _base = base_inheritable\n _base = configuration[:base] if _base.nil? and configuration\n _base ||= base_inheritable(true)\n [prefix, _base].find_all do |component|\n component and !component.empty?\n end.join(\",\")\n end",
"def base_dir_for_path_parameters\n @base_dir_for_path_parameters ||=\n if File.basename(loaded_path).start_with?('.rubocop') &&\n loaded_path != File.join(Dir.home, ConfigLoader::DOTFILE)\n File.expand_path(File.dirname(loaded_path))\n else\n Dir.pwd\n end\n end",
"def base_dir_for_path_parameters\n @base_dir_for_path_parameters ||=\n if File.basename(loaded_path).start_with?('.rubocop') &&\n loaded_path != File.join(Dir.home, ConfigLoader::DOTFILE)\n File.expand_path(File.dirname(loaded_path))\n else\n Dir.pwd\n end\n end",
"def base_path\n wiki.base_path\n end",
"def guess_base_uri\n \"#{@http_request.raw_server_value('SCRIPT_NAME')}/\"\n end",
"def extract_base_url(uri)\n root = uri.split(\"/\",4)\n root[0] + \"//\" + root[2]\n end",
"def base\n if self.attributes['xml:base']\n return self.attributes['xml:base'].to_s\n elsif self.parent != nil\n return self.parent.base\n else\n return nil\n end\n end",
"def get_element_base(root)\n base_element = REXML::XPath.first(root, 'complexContent/extension')\n base = (base_element.nil?) ? nil :\n base_element.attribute('base').to_s.gsub(/^.+:/, '')\n return base\n end",
"def base_url\n File.join(host, path)\n end",
"def rebase(base_path)\n path = Pathname.new(filename).relative_path_from(Pathname.new(base_path)).to_s\n\n Juicer::Asset::Path.new(path,\n :base => base_path,\n :hosts => hosts,\n :document_root => document_root)\n end",
"def base_path\n # starts out like \"users/index\"\n @view.virtual_path.sub(%r{/[^/]*$}, '')\n end",
"def chop_basename(path)\n base = File.basename(path)\n if base.empty? or base == '/'\n return nil\n else\n return path[0, path.rindex(base)], base\n end\n end",
"def dir_base\n File.expand_path(File.dirname(__FILE__)+\"/../..\")\n end",
"def path(ident=:default)\n tail = identifying_path_part(ident)\n if tail.empty?\n base_path\n else\n File.join base_path, tail\n end\n end",
"def base_url\n @url.to_s.split('?').first\n end",
"def base_directory\n @base_directory\n end",
"def base_href\n parsed.search('base').first.attributes['href'].value rescue nil\n end",
"def base\n @base\n end",
"def base_href\n parsed_search('base').first.attributes['href'].value rescue nil\n end",
"def sub_dir_of(file, base = base_directory)\n file = Pathname.new(file) unless file.respond_to?(:relative_path_from)\n base = Pathname.new(base) unless base.respond_to?(:relative_path_from)\n rel = file.relative_path_from(base)\n if file.directory?\n rel\n else\n rel.dirname\n end\n end",
"def rewrite_base_path(path) # :nodoc:\n if path !~ %r(^/)\n File.join('/', dir, path)\n else\n path\n end\n end",
"def base_path\n if debug\n \"/#{debug_prefix}/\"\n else\n \"/#{digest_prefix}/\"\n end\n end",
"def root\n '../' * file.count('/')\n end",
"def basedir\n File.dirname File.absolute_path options[:file]\n end",
"def strip_base(env)\n stripped = nil\n req_path = env['REQUEST_PATH']\n stripped = req_path[@base_path.length..-1]\n end",
"def base_relative_dir\n \t\t@dir.gsub(/^\\//,\"\")\n \tend",
"def basename\n @basename ||= File.basename(path)\n end",
"def basename\n File.basename(path)\n end",
"def basename(delimiter = '/', start = nil)\n return nil if is_placeholder_directory? \n \n prefix = self.key\n unless start.nil?\n prefix = prefix.gsub(start,'')\n end\n \n arr = prefix.split(delimiter)\n if arr.length == 1\n arr[0]\n else\n nil\n end\n end",
"def base_dir\n return Gem.dir unless loaded_from\n @base_dir ||= if default_gem? then\n File.dirname File.dirname File.dirname loaded_from\n else\n File.dirname File.dirname loaded_from\n end\n end",
"def base_directory\n File.expand_path(File.join(File.dirname(__FILE__), '..'))\n end",
"def base_dir\n options.fetch('base_dir', '')\n end",
"def resolve_relative_path(path, base_path)\n p = Pathname(base_path)\n p = p.dirname unless p.extname.empty?\n p += path\n\n p.cleanpath.to_s\n end",
"def basename(path)\n path.chomp(\"/\")\nend",
"def path_name\n return unless @basename\n\n parts = @basename.split('.')\n parts.pop if parts.length > 1 && parts.last =~ /^\\w+$/\n parts.pop if parts.last =~ /^\\d+$/\n parts.join('.')\n end",
"def base_uri(in_or_out = :in)\n Rails.my_config(\"base_uri_#{in_or_out}\".to_sym)\n end",
"def base_uri\n @base_uri ||= guess_base_uri\n end",
"def basename\n File.basename( fullpath, ext )\n end",
"def base_url(link: nil)\n get_base = -> { @base.is_relative? ? @url.to_base.concat(@base) : @base }\n\n if link\n assert_type(link, Wgit::Url)\n raise \"link must be relative: #{link}\" unless link.is_relative?\n\n if link.is_anchor? || link.is_query_string?\n base_url = @base ? get_base.call : @url\n return base_url.without_anchor.without_query_string\n end\n end\n\n base_url = @base ? get_base.call : @url.base\n base_url.without_anchor.without_query_string\n end",
"def base_key\n\t\tself.split('.')[0]\n\tend",
"def basename\n if extension\n basename = filename.split('.')\n basename.pop\n basename.join('.')\n else\n filename\n end\n end",
"def path_root\n base_uri ? base_uri : path_to( '/' )\n end",
"def root(path = nil)\n base = File.expand_path(File.dirname(__FILE__))\n path ? File.join(base, path) : base\n end",
"def base\n node.attributes['base'] ? node.attributes['base'].value : nil\n end",
"def path\n File.join(@base, @name)\n end",
"def rootname filename\n if (last_dot_idx = filename.rindex '.')\n (filename.index '/', last_dot_idx) ? filename : (filename.slice 0, last_dot_idx)\n else\n filename\n end\n end",
"def base=(value)\n @base = value\n valid_base?\n return @base\n end",
"def base_url_path; end",
"def basename\n s = name\n (i = s.rindex('::')) and (s = s.right(-i-2)) unless s.blank?\n s\n end",
"def base_dir(name)\n if name.to_s !~ BASE_DIR_NAME_REGEX\n raise ArgumentError.new(\"A base dir name must match this regex: #{ BASE_DIR_NAME_REGEX.inspect }\")\n end\n get_config_val(@base_dirs, name)\n end",
"def base_paths\n @base_paths ||= find_base_paths\n end"
] |
[
"0.74745333",
"0.742273",
"0.7410979",
"0.7403777",
"0.7384916",
"0.72389424",
"0.72376144",
"0.7234708",
"0.7222469",
"0.72050786",
"0.71746284",
"0.71538174",
"0.71474844",
"0.7137092",
"0.7124422",
"0.7124422",
"0.70651734",
"0.7056925",
"0.7041405",
"0.69552046",
"0.69213885",
"0.68942",
"0.68157023",
"0.6771087",
"0.6768156",
"0.67475003",
"0.67427915",
"0.67036957",
"0.66786754",
"0.66479206",
"0.6641286",
"0.6611492",
"0.6604572",
"0.6570151",
"0.65602744",
"0.65510046",
"0.6550797",
"0.6549889",
"0.6544899",
"0.65328187",
"0.6532045",
"0.65287566",
"0.64741814",
"0.6456152",
"0.64518094",
"0.64518094",
"0.6416158",
"0.6397215",
"0.6345168",
"0.63434047",
"0.63392633",
"0.63392633",
"0.63275003",
"0.6324519",
"0.6324088",
"0.6307368",
"0.63060385",
"0.6282713",
"0.6282257",
"0.62696147",
"0.6269189",
"0.62559766",
"0.6250946",
"0.62442094",
"0.62387055",
"0.62378997",
"0.6230045",
"0.620761",
"0.6206692",
"0.61864936",
"0.61759025",
"0.6153064",
"0.6148506",
"0.6121464",
"0.6103886",
"0.610094",
"0.6082338",
"0.60804975",
"0.60751975",
"0.60721815",
"0.6066765",
"0.60659844",
"0.6051114",
"0.6041838",
"0.60409707",
"0.60327405",
"0.60316896",
"0.6027485",
"0.60219085",
"0.60182333",
"0.6006771",
"0.59980434",
"0.5992935",
"0.59880286",
"0.59839374",
"0.59699607",
"0.5968912",
"0.5961042",
"0.5951052",
"0.5943604"
] |
0.79545283
|
0
|
Return paths to files that are located within the path
|
def files()
children.select { |c| c.file? }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def files_in_path\n Dir.glob(\"#{@path}/**/*/**\") | Dir.glob(\"#{@path}/**\")\n end",
"def get_file_absolute_paths path\n get_file_names(path).map { |file| File.join(path, file) }\n end",
"def paths\n f = File.open(@path)\n f.grep(FILE_NAME_PATTERN) { $1 }\n end",
"def get_file_names path\n Dir.entries(path).select { |file| !File.directory? File.join(path, file) }\n end",
"def get_files_in_path(path)\n puts \"Scanning for files in directory: #{path}\"\n Dir.entries(path).reject { |f| File.directory? f }\nend",
"def find_files( path )\n file_paths.each_with_object([]) do |search_path,obj|\n found = File.join( search_path, path )\n obj << found if File.exist? found\n end.reverse.uniq\n end",
"def possible_files(path, base_path)\n path = Pathname.new(path)\n base_path = Pathname.new(base_path).dirname\n root_path = Pathname.new(context.root_path)\n paths = [ path, partialize_path(path) ]\n\n # Add the relative path from the root, if necessary\n if path.relative? && base_path != root_path && path.to_s !~ /\\A\\.\\//\n relative_path = base_path.relative_path_from(root_path).join path\n \n paths.unshift(relative_path, partialize_path(relative_path))\n end\n\n paths.compact\n end",
"def get_chef_files_absolute_paths path\n get_file_absolute_paths(path).select { |file| is_valid_chef_component_file?(file) }\n end",
"def file_paths\n @file_paths ||= begin\n files = []\n each_file do |path|\n files << path\n end\n files\n end\n end",
"def possible_files(context, path, base_path)\n path = Pathname.new(path)\n base_path = Pathname.new(base_path).dirname\n paths = [ path, partialize_path(path) ]\n\n # Find base_path's root\n env_root_paths = context.environment.paths.map {|p| Pathname.new(p) }\n root_path = env_root_paths.detect do |env_root_path|\n base_path.to_s.start_with?(env_root_path.to_s)\n end\n root_path ||= Pathname.new(context.root_path)\n\n # Add the relative path from the root, if necessary\n if path.relative? && base_path != root_path\n relative_path = base_path.relative_path_from(root_path).join path\n paths.unshift(relative_path, partialize_path(relative_path))\n end\n\n paths.compact\n end",
"def file_paths\n @file_paths ||= begin\n files = []\n each_file do |path|\n files << path\n end\n files\n end\n end",
"def full_path\n look_in.each do |dir|\n extensions.each do |ext| \n path = File.join(dir, [@path, ext].join)\n if File.exists?(path) && File.file?(path)\n return path\n end\n end\n end\n return\n end",
"def file_paths\n src_file_mask = File.join(@folder_path, '**', '*.c')\n @file_paths = Dir.glob(src_file_mask)\n return @file_paths\n end",
"def files_for_directory(path)\n directory = find_preferred_file(\n @new_resource.cookbook_name, \n :remote_file, \n path, \n @node[:fqdn],\n @node[:platform],\n @node[:platform_version]\n )\n\n unless (directory && ::File.directory?(directory))\n raise NotFound, \"Cannot find a suitable directory\"\n end\n\n directory_listing = Array.new\n Dir[::File.join(directory, '**', '*')].sort { |a,b| b <=> a }.each do |file|\n next if ::File.directory?(file)\n file =~ /^#{directory}\\/(.+)$/\n directory_listing << $1\n end\n directory_listing\n end",
"def list_files(path)\n base_directory_content = Dir.glob(File.join(path, \"*\"))\n nested_directory_content = Dir.glob(File.join(path, \"*/**/*\"))\n [base_directory_content, nested_directory_content].flatten\n end",
"def find_paths(dir=\"\")\n base = File.join(@source, dir)\n entries = Dir.chdir(base) { filter_entries(Dir[\"*\"]) }\n paths = []\n\n entries.each do |entry|\n absolute_path = File.join(base, entry)\n relative_path = File.join(dir, entry)\n\n if File.directory?(absolute_path)\n paths.concat find_paths(relative_path)\n else\n paths << absolute_path\n end\n end\n paths\n end",
"def resolve_files(path)\n path = File.expand_path(path, __FILE__)\n\n if File::directory? path\n files = Dir.entries(path).reject! {|s| s =~ /^\\./} # don't include dotfiles\n files.map! {|file| File.join(path, file)}\n files = files.sort_by {|filename| File.size(File.expand_path(filename, path)) }\n else\n files = [path]\n end\n\n files.reject! {|file| File::directory? file}\n\n files\n end",
"def _find_files(*paths)\n paths.flatten!\n paths.map! { |p| Pathname.new(p) }\n files = paths.select(&:file?)\n\n (paths - files).each do |dir|\n files << _find_files(dir.children)\n end\n\n files.flatten.map(&:to_s)\n end",
"def non_dir_files(path)\n `find -L #{path}`\n .split\n .map { |f| Pathname.new(f) }\n .reject { |f| f.directory? }\n .map { |f| f.relative_path_from(path) }\nend",
"def find_files(path)\r\n Dir.entries(path).reject {|f| f =~ /^\\./} || Array.new\r\nend",
"def get_files_in_dir(path)\n Dir[\"#{path}*\"].sort! { |e1, e2| stringnum_comparison(e1, e2) }\n end",
"def all_files() = path.glob('**/*').select(&:file?).map(&:to_s)",
"def files\n @files = []\n Find.find(@path) do |path|\n if File.directory? path\n if File.basename(path)[0] == ?.\n Find.prune # don't look any further into this directory.\n else\n next\n end\n else\n @files << path\n end\n end\n @files.size\n end",
"def get_file_list relative_path\n\t\t\t\tpath = File.join(@src, relative_path)\n\t\t\t\tresult = nil\n\t\t\t\tFileUtils.cd(path) do\n\t\t\t\t\tresult = Dir.glob(\"**/*\", File::FNM_DOTMATCH)\n\t\t\t\t\tresult.reject! { |fn| File.directory?(fn) }\n\t\t\t\t\tresult.reject! { |fn| fn =~ /(^_|\\/_)/ }\n\t\t\t\tend\n\t\t\t\tresult\n\t\t\tend",
"def filePaths\n result = OpenStudio::PathVector.new\n if @workflow[:file_paths]\n @workflow[:file_paths].each do |file_path|\n result << OpenStudio.toPath(file_path)\n end\n else\n result << OpenStudio.toPath('./files')\n result << OpenStudio.toPath('./weather')\n result << OpenStudio.toPath('../../files')\n result << OpenStudio.toPath('../../weather')\n result << OpenStudio.toPath('./')\n end\n result\n end",
"def list_files_from_dir(path)\n Dir[path + \"/*/\"].map { |file| File.basename(file) }\n end",
"def files\n files_in_path.map do |file|\n TemplateFile.from_full_path(@path, file) unless File.directory?(file)\n end.compact\n end",
"def _find_files(*paths)\n paths.flatten.map do |path|\n path = Pathname.new(path)\n path.file? ? [path.to_s] : _find_files(path.children)\n end.flatten\n end",
"def files\n %x{\n find . -type f ! -path \"./.git/*\" ! -path \"./node_modules/*\"\n }.\n split(\"\\n\").\n map { |p| Pathname.new(p) }\n end",
"def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\/\"), ''\n end\n end",
"def get_files (path, files_found) \n\t\tif File.directory? path\n\t\t\tDir.foreach path do |file| \n\t\t\t\tif (!EXCLUDED_FILES.include? file)\n\t\t\t\t\tget_files(path+file, files_found) \n\t\t\t\tend\n\t\t\tend\n\t\telsif File.file? path\n\t\t\tfiles_found << path\n\t\tend\n\tend",
"def upload_paths\n @paths ||= begin\n (images + files + renders).map do |name|\n file_path = @directory.join(name)\n\n next unless File.readable?(file_path)\n\n file_path\n end.compact\n end\n end",
"def file_paths\n Dir.glob(@filepath_pattern).sort\n end",
"def subdir_paths(path)\n\tfolder_metadata = @client.metadata(path)\n\tcontents = folder_metadata['contents']\n\n\tsubdir_paths = []\n\tfor i in contents\n\t\tif i['is_dir']\n\t\t\tsubdir_paths << i['path']\n\t\tend\n\tend\n\tsubdir_paths\nend",
"def ls(path)\n dir = scope.get(path)\n InvalidPath.raise! {!dir.try(:is_dir)}\n dir.files.map(&:path)\n end",
"def all_files_under(path, &ignore)\n path = Pathname(path)\n\n if path.directory?\n path.children.flat_map do |child|\n all_files_under(child, &ignore)\n end.compact\n elsif path.file?\n if block_given? && ignore.call(path)\n []\n else\n [path]\n end\n else\n []\n end\n end",
"def files_listing path\n cmd = \"find #{path} -type f \"\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@file_regexp}\\\" \" if @file_regexp\n out = exec_cmd(cmd)\n end",
"def possible_paths_for(path)\n possible_paths[path] ||= [\n paths_from_project_root,\n paths_from_local_software_dirs,\n paths_from_software_gems,\n ].flatten.inject([]) do |array, directory|\n destination = File.join(directory, path)\n\n if File.directory?(destination)\n array << destination\n end\n\n array\n end\n end",
"def entries(path)\n result = []\n path.entries.each do |entry|\n next if ignore_basename?(entry)\n\n file = path.join(entry)\n next if ignore_pathname?(file)\n\n result.push(file)\n end\n return result\n end",
"def files() = files_path.glob('**/*')",
"def monitored_paths\n paths = Dir['**/*'].select do |path|\n @script.patterns.any? {|p| path.match(p) }\n end\n paths.push(@script.path).compact!\n paths.map {|path| Pathname(path).expand_path }\n end",
"def get_filepaths(target_dir)\n dirpaths = [target_dir + \"/subnodes\", target_dir + \"/headnodes\"]\n filepaths = []\n dirpaths.each do |dirpath|\n Dir[dirpath+\"/*\"].each do |filepath|\n filepaths << filepath\n end\n end\n return filepaths\n end",
"def traverse_files\n result = []\n paths = config[:paths].select { |p| File.exist?(p) }\n if paths.empty?\n log_warn \"search.paths #{config[:paths].inspect} do not exist\"\n return result\n end\n Find.find(*paths) do |path|\n is_dir = File.directory?(path)\n hidden = File.basename(path).start_with?('.')\n not_incl = config[:include] && !path_fnmatch_any?(path, config[:include])\n excl = path_fnmatch_any?(path, config[:exclude])\n if is_dir || hidden || not_incl || excl\n Find.prune if is_dir && (hidden || excl)\n else\n result << yield(path)\n end\n end\n result\n end",
"def files\n @files = Dir.entries(@path)\n @files.delete_if {|file| file == \".\" || file == \"..\"}\n end",
"def SubPaths()\n #puts \"Searching subpaths in #{to_s()}\"\n entries = Dir.entries(AbsolutePath())\n subPaths = []\n \n #puts \"Found entries #{entries}\"\n \n entries.each do |entry|\n if(entry == \"..\" || entry == \".\")\n next\n end\n \n copy = CreateCopy()\n \n #puts \"Copy is #{copy}\"\n \n copy.RelativePath = JoinPaths([copy.RelativePath, entry])\n subPaths.push(copy)\n \n #puts \"Created path #{copy} for entry #{entry}\"\n end\n \n return subPaths\n end",
"def all_paths\n paths = Dir[\"#{@path}/*\"]\n paths = paths.select(&matcher(options[:accept])) if options[:accept]\n paths = paths.reject(&matcher(options[:reject])) if options[:reject]\n paths\n end",
"def find_files_in_dir dir\n unless dir.exist?\n warn \"Can't find files in dir %s as it doesn't exist!\",\n dir.relative_path_from(project.path + '..').to_s\n return []\n end\n Dir.chdir dir do\n Dir['**/*'].map { |path| Pathname(path) }\n end\n end",
"def ingest_paths\n path = Pathname.new(Figgy.config[\"ingest_folder_path\"]).join(ingest_directory)\n return [] unless path.exist?\n path.children.select(&:directory?)\n end",
"def GetDirectoryPathsFromRelativeBase(path)\n pathParts = path.RelativePathParts\n paths = []\n for i in 1..pathParts.length\n\tsubPath = ProjectPath.new(JoinPaths(pathParts.slice(0, i)))\n\tpaths.push(subPath)\n end\n return paths\n end",
"def find_files(*paths)\n Find.find(*paths).select do |path|\n File.file?(path)\n end\n end",
"def find_files(path)\n entries = Dir[path + \"/*\"]\n puts entries.size\n entries.select! { |entry| File.file?(entry) }\n entries\n end",
"def files\n file = Dir[self.path + \"/*\"]\n file.each do |file_name|\n file_name.slice!(self.path + \"/\")\n end\n file\n end",
"def files\n real_path = self.path[2...-1] + \"s/*\"#trim './' and add 's/*' \n \n Dir[real_path].map{|file| file.split(\"/\")[-1]} \n end",
"def slice_files_from_search_path\n search_paths = Array(Merb::Plugins.config[:merb_slices][:search_path] || [Merb.root / \"slices\"])\n search_paths.inject([]) do |files, path|\n # handle both Pathname and String\n path = path.to_s\n if File.file?(path) && File.extname(path) == \".rb\"\n files << path\n elsif path.include?(\"*\")\n files += glob_search_path(path)\n elsif File.directory?(path)\n files += glob_search_path(path / \"**/lib/*.rb\")\n end\n files\n end\n end",
"def filepaths\n object.object_files.map(&:relative_path)\n end",
"def files_path\n File.expand_path(\"#{Config.project_root}/files\")\n end",
"def files(uri)\n [].tap do |ary|\n ary.concat Dir[uri]\n search_paths.each { |p| ary.concat Dir[File.join p, uri] }\n end\n end",
"def file_paths(file_tree, path_so_far = \"\")\n paths = []\n file_tree.keys.each do |key|\n if file_tree[key] == true\n extended_path = path_so_far + \"#{key}\"\n paths << extended_path\n else\n extended_path = path_so_far + \"#{key}/\"\n paths += file_paths(file_tree[key], extended_path)\n end\n end\n paths\nend",
"def paths\n Array(@ruhoh.cascade.paths.map{|h| h[\"path\"]}).map { |path|\n collection_path = File.join(path, resource_name)\n next unless File.directory?(collection_path)\n\n collection_path\n }.compact\n end",
"def search_paths\n # NOTE: Do not cache this list, specific generators\n # will modify it with their own lookups\n create_search_paths.select { |path| File.directory?(path) }\n end",
"def get_directories_absolute_paths path\n dir_list = Dir[\"#{path}/*/\"]\n \n #Remove unnecessary directories\n dir_list.delete(File.join(path, \".\"))\n dir_list.delete(File.join(path, \"..\"))\n \n dir_list\n end",
"def list_files_from path,opts = {}\n unless Dir.exists? path\n Logger.<<(__FILE__,\"ERROR\",\"Local fetcher: path does not exists for listing... #{path} \")\n raise \"Error LocalFileFetcher !\"\n end\n if opts[:directories]\n cmd = \"ls -td #{path}/*/\"\n else\n cmd = \"ls #{path}\"\n cmd += \"/#{opts[:regexp]}\" if opts[:regexp]\n end\n out = `#{cmd}`\n return out.split(\"\\n\")\n end",
"def get_files_in(directory_name, options = {})\n options = {\n :traverse => false,\n :full_paths => true\n }.merge(options)\n \n ## If directory name is not absolute, go one-up to what should\n ## be the root directory of the app. (I.e. We're in ROOT/helpers.)\n path = directory_name =~ /^\\// ? directory_name : File.join(File.dirname(__FILE__), '..', directory_name)\n \n pattern = options[:traverse] ? \"/**/*.rb\" : \"/*.rb\"\n files = Dir[path + pattern].select { |e| e =~ /^.+\\.rb$/ }\n\n if options[:full_paths]\n files\n else\n files.map { |file| file.match(/\\/([A-Za-z0-9_]+\\.rb)$/)[1] }\n end\n end",
"def asset_paths\n search_path.children.select { |n| Cnfs::Core.asset_names.include?(base_name(n)) }.sort\n end",
"def get_files\n if @options[:recursive]\n `find \"#{@srcdir}\" -name '*.#{@extension}'`.split(\"\\n\")\n else\n Dir.glob(\"#{@srcdir}/*.#{@extension}\")\n end\n end",
"def files\n Dir.glob(bag_dir/\"**\"/\"*\")\n .map {|f| Pathname.new(f) }\n .reject(&:directory?)\n end",
"def absolute_file_paths\n @absolute_file_paths = if single_file?\n [path]\n else\n path.glob(\"**/*\")\n .reject { |p| File.directory?(p) }\n .map { |ap| Pathname.new(ap) }\n end\n end",
"def paths\n tree_path = File.join(File.dirname(__FILE__), 'rails_tree')\n [\"\", \"multitest\", \"results\"].inject([tree_path]) do |result, suffix|\n result << File.join(result[-1], suffix)\n end[1..3]\n end",
"def find_files_recursive (base_directory, relative_path)\n result = []\n directory = File.join(base_directory, relative_path)\n Dir.foreach(directory) do |file|\n relative_file = relative_path.empty? ? file : File.join(relative_path, file)\n if matchesFilters(file, relative_file)\n full_path = File.join(base_directory, relative_file)\n if File.directory?(full_path)\n result = result + find_files_recursive(base_directory, relative_file)\n else\n result << relative_file\n end\n end\n end\n result\n end",
"def expand_all path\n real_path = VirtualLayer.realpath(path)\n elems = real_path.split('/'); elems.shift # throw away the first element which is empty for a FQ pathname\n if path[-1] == '/'\n filt_fn = ->(p) { VirtualLayer.directory?(p) }\n else\n filt_fn = ->(p) { p }\n end\n result = rejoin(walk_globs(elems)).flatten.select(&filt_fn).sort\n\n if path[0] == '/'\n result\n else\n cwd = VirtualLayer.pwd\n result.map {|p| p[(cwd.length+1)..] }\n end\nend",
"def get_content_search_paths()\n r = @file_content_search_paths.clone\n p = find_project_dir_of_cur_buffer()\n if p.nil?\n p = vma.buffers.last_dir\n end\n\n if p and !@file_content_search_paths.include?(p)\n r.insert(0, p)\n end\n\n return r\n end",
"def get_bag_paths\n bag_paths = Array.new\n \n Dir.glob(@path).each do |entry|\n if !(File.directory? entry) || entry == \".\" || entry == \"..\"\n next\n end\n \n bag_paths.push entry\n end\n \n return bag_paths\n end",
"def ls_r path\n ls(path).inject([]){|rec_paths,path| rec_paths << path; rec_paths << ls(path) unless file?(path); rec_paths}.flatten\n end",
"def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end",
"def content_paths(path)\n arr = []\n @content_tree.with_subtree(path, nil, nil) do |node|\n arr << node.doc_path\n end\n arr\n end",
"def base_files(path)\n Dir.glob(\"#{path}/*\").map do |f|\n TmpFile.new file: File.basename(f), path: path if File.file?(f)\n end.compact\n end",
"def files\n @files.map do |file|\n if File.directory?(file)\n Dir[File.join(file, '**', '*.rb')]\n else\n file\n end\n end.flatten\n end",
"def file_paths\n @file_paths ||= BrowseEverythingFilePaths.new(selected_files)\n end",
"def possible_files(context, path, base_path)\n paths, root_path = super(context, path, base_path)\n paths = additional_paths_for_sprockets(context, paths, path, base_path)\n [paths.compact, root_path]\n end",
"def getFiles(dirs)\n files = []\n for dir in dirs\n # This is recursive...could use Dir.glob() for local lookups.\n Find.find(dir) do |path|\n files << path if goodPath(path)\n end\n end\n return files\nend",
"def files\n @@files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n end",
"def files(root = '')\n files = []\n dir = @path.join(root)\n Dir.chdir(dir) do\n files = Dir.glob('**/*').select { |p| dir.join(p).file? }\n end\n end",
"def getFilesInDirCompiler(path)\n files = []\n #search for all of the files in the directory\n Dir.foreach(path) do |filename|\n #dont include parent files\n next if filename == '.' || filename == '..'\n\n #dont include files that are not jack files\n next unless filename.to_s.include?(\"jack\")\n\n #push the file to the list\n files.push(path+\"/\"+filename)\n end\n\n return files\nend",
"def whereis(prog, path=ENV['PATH'])\n dirs = []\n path.split(File::PATH_SEPARATOR).each do |dir|\n if File::ALT_SEPARATOR\n if prog.include?('.')\n f = File.join(dir,prog)\n if File.executable?(f) && !File.directory?(f)\n if block_given?\n yield f.gsub(/\\//,'\\\\')\n else\n dirs << f.gsub(/\\//,'\\\\')\n end\n end\n else\n Win32Exts.find_all do |ext|\n f = File.join(dir,prog+ext)\n if File.executable?(f) && !File.directory?(f)\n if block_given?\n yield f.gsub(/\\//,'\\\\')\n else\n dirs << f.gsub(/\\//,'\\\\')\n end\n end\n end\n end\n else\n f = File.join(dir,prog)\n if File.executable?(f) && !File.directory?(f)\n if block_given?\n yield f\n else\n dirs << f\n end\n end\n end\n end\n dirs.empty? ? nil : dirs\n end",
"def entries() Dir.entries(path).map {|f| Path::Name.new(f) } end",
"def promethee_partial_paths_for(path)\n promethee_partial_sources.map do |source|\n Dir[source + 'promethee' + path].map { |file| Pathname.new(file).relative_path_from source }\n end.flatten.uniq(&:to_s)\n end",
"def paths\n Array(config.path).map(&:to_s)\n end",
"def list_files_from (path,opts = {})\n safe_fetch do\n list_files = Set.new\n var = \"Search in #{path} at #{@host}... \"\n cmd = \"find #{path}\"\n cmd = \"(cd #{path} && ls \" ### dont know why cd alone doesn't work\n cmd << \"-td */\" if opts[:directories]\n cmd << opts[:regexp] if opts[:regexp]\n cmd << \" 2>/dev/null)\"\n out = @ssh.exec!(cmd)\n list_files = out.split\n list_files = out.split(\"/\\n\") if opts[:directories]\n\n var << \"Found #{list_files.size} entries\\n\"\n Logger.<<(__FILE__,\"INFO\",var)\n list_files\n end\n end",
"def files\n # list_of_filenames = Dir.entries(path)\n @list_of_filenames = Dir.glob(\"#{@path}/*.mp3\").collect! {|x| x.gsub(\"#{@path}/\", \"\") }\n # binding.pry\n end",
"def full_files\n @full_files ||= if File.directory?(full_path)\n Dir.glob(File.join(full_path, '**', '*'), File::FNM_DOTMATCH).sort.reject {|p| relative(p) == '.' }\n else\n [full_path].select {|path| File.exist?(path) }\n end\n end",
"def paths\n names = Array.new\n each_tarball_entry { |entry| names << Pathname.new(entry).cleanpath.to_s }\n names - ['.']\n end",
"def getFiles(theArgs)\n\n\ttheFiles = [];\n\tpathsExclude = theArgs[:exclude];\n\n\ttheArgs[:paths].each do |pathRoot|\n\t\n\t\tif (File.exist?(pathRoot))\n\t\t\tFind.find(pathRoot) do |thePath|\n\t\t\t\tif (File.file?(thePath))\n\n\t\t\t\t\tif (!pathsExclude.include?(thePath))\n\t\t\t\t\t\tif (!FILES_EXCLUDE.include?(File.basename(thePath)))\n\t\t\t\t\t\t\ttheFiles << thePath;\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tputs \"Skipping #{pathRoot}, file not found\";\n\t\tend\n\tend\n\n\treturn theFiles;\n\nend",
"def files(recurse)\n if recurse\n Dir['**/*'].select { |f| File.file?(f) }\n else\n Dir.entries(Dir.pwd).select { |f| File.file? f }\n end\n end",
"def files_in_directory name, glob = '**' / '*'\n Dir[path / name / glob]\n end",
"def entries\n ::Dir.entries(path) - ['.', '..']\n end",
"def files\n directory.files\n\n #@files ||= (\n # files = []\n # Dir.recurse(directory.to_s) do |path|\n # next if IGNORE_FILES.include?(File.basename(path))\n # files << path.sub(directory.to_s+'/','')\n # end\n # files.reject{ |f| File.match?(CONFIG_FILE) }\n #)\n end",
"def directory_entries\n entries.select{ |f| File.directory?(File.join(path,f)) }\n #dirs = ::Dir.glob(\"#{path}/\")\n #dirs.collect{ |f| f.chomp('/') }\n end",
"def search_path\n result = []\n\n result += $LOAD_PATH.map { |path| File.expand_path('facter', path) }\n\n if @environment_vars.include?(\"FACTERLIB\")\n result += @environment_vars[\"FACTERLIB\"].split(File::PATH_SEPARATOR)\n end\n\n # silently ignore bad search paths from $LOAD_PATH and FACTERLIB\n result = result.select { |path| valid_search_path?(path) }\n\n # This allows others to register additional paths we should search.\n # We are assuming that these are already absolute paths.\n result += Facter.search_path.select do |path|\n valid = valid_search_path?(path)\n Facter.warn \"Excluding #{path} from search path. Fact file paths must be an absolute directory\" unless valid\n valid\n end\n\n # remove any dups\n result.uniq\n end",
"def find_files dir = test_dir\n glob file_pattern(dir)\n end",
"def files( env )\n return env[:files] if env.include? :files\n raise(ArgumentError, \"env hash must include either :files or :path\") unless env.include? :path\n\n file_glob = self.class.class_eval { @file_pattern } || '*'\n Dir.glob(File.join(env[:path], '**', file_glob))\n end",
"def files\n Dir.entries(\"#{path}\").select {|song_filename| song_filename.include?(\"mp3\")}\n end"
] |
[
"0.82268316",
"0.78790146",
"0.7836054",
"0.7814991",
"0.7773205",
"0.76948005",
"0.7514166",
"0.74693745",
"0.7413053",
"0.7412432",
"0.7410526",
"0.73028815",
"0.7286824",
"0.7285109",
"0.72723496",
"0.72565365",
"0.725538",
"0.7242554",
"0.7230413",
"0.72164303",
"0.72061616",
"0.7203494",
"0.71565914",
"0.7132331",
"0.70948035",
"0.7083391",
"0.70779943",
"0.7043258",
"0.7014863",
"0.70000005",
"0.695201",
"0.69515467",
"0.69504625",
"0.6936533",
"0.6917719",
"0.69168854",
"0.68850553",
"0.68552",
"0.6853597",
"0.6847969",
"0.68398476",
"0.6809827",
"0.68069035",
"0.679653",
"0.6795154",
"0.6775011",
"0.6773293",
"0.6773224",
"0.67668253",
"0.6759691",
"0.6758908",
"0.67496836",
"0.6734674",
"0.6726031",
"0.6722621",
"0.6710027",
"0.66981554",
"0.66941774",
"0.6692389",
"0.66860354",
"0.6685153",
"0.6656095",
"0.6651744",
"0.6609962",
"0.6609467",
"0.6604893",
"0.6595771",
"0.6590797",
"0.65893066",
"0.658666",
"0.65546787",
"0.65483683",
"0.65449923",
"0.65102464",
"0.64782834",
"0.6457574",
"0.6445287",
"0.6443211",
"0.644267",
"0.64424527",
"0.6436738",
"0.6431424",
"0.6428493",
"0.64244616",
"0.6411108",
"0.64108574",
"0.64099586",
"0.6409164",
"0.6404113",
"0.6403616",
"0.6402392",
"0.63976085",
"0.6385861",
"0.63731885",
"0.6371066",
"0.6356857",
"0.63562095",
"0.6348357",
"0.6343722",
"0.63415194",
"0.634143"
] |
0.0
|
-1
|
Return whether this is a path to an image
|
def image?()
IMAGE_EXTS.include? extname
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def image?\n ext = File.extname(@path)\n case ext.downcase\n when '.png', '.jpg', '.jpeg', '.gif'; return true\n else; return false\n end\n end",
"def is_path?\n !!((@file.is_a?(String) || @file.is_a?(Pathname)) && !@file.blank?)\n end",
"def image?(src)\n !File.directory?(src)\n end",
"def image?\n file_type.match(/\\Aimage\\//).present?\n end",
"def user_path?(file); end",
"def is_image?\n ['jpg', 'jpeg', 'pjpeg', 'png', 'bmp', 'gif', 'x-png'].include? self.image_file_name.split('.').last\n end",
"def is_path?(); @type == GRT_PATH; end",
"def image_file?\n false\n end",
"def image?\n self.image.file?\n end",
"def image?\n self.image.file?\n end",
"def image?\n self.file_content_type == 'image/png' || self.file_content_type == 'image/jpeg'\n end",
"def image?\n self.type == \"Image\"\n end",
"def is_image?\n content_type.split('/')[0] == \"image\"\n end",
"def image?\n %w(jpg jpeg gif png).include?(file_ext.downcase)\n end",
"def image?\n !!image\n end",
"def image?(file)\n file.content_type.include? 'image'\n end",
"def image?\n self.content_type.to_s.index(/image/).nil?\n end",
"def image?\n self.sti_type == IMAGE_TYPE\n end",
"def image?\n (self.file_content_type =~ %r{^(image|(x-)?application)/(x-png|pjpeg|jpeg|jpg|png|gif)$})\n end",
"def image?\n image ? true : false\n end",
"def is_image_type?\n file_content_type =~ %r(image)\n end",
"def image?\n self.type == \"Assetabler::Image\"\n end",
"def has_image?\n \t# self.image.file?\n true\n end",
"def image?\n !!( content_type =~ Transit.config.image_regexp )\n end",
"def imageurl?\n !!self.imageurl\n end",
"def is_image?\n if self.mimetype\n self.mimetype =~ %r(image)\n elsif self.file_upload_content_type\n self.file_upload_content_type =~ %r(image)\n end\n end",
"def image?\n IMAGE_EXTENSIONS.include? File.extname(filename)[1..-1]\n end",
"def image? new_file\n new_file.content_type.start_with? 'image'\n end",
"def url_with_image?(url)\n url.match('\\.(png|jpg|gif)$')\n end",
"def in_path?(path); end",
"def is_processed_image? picture\n model.class.to_s.underscore == \"pimage\"\n end",
"def has_image?(type)\n # Use of S3 without AWS-Ruby doesn't allow for checking whether or not image is available\n true\n # path = \"#{Rails.root}/app/assets/images/people/#{key}/#{type.to_s}.jpg\"\n # FileTest.exist?(path) ? path : false\n end",
"def main_image_url?\n main_image_source == ImageSource::URL\n end",
"def contains_jpeg?\n contains_images? and @url =~ /j\\z/i\n end",
"def has_image?(image)\n # FIXME\n true\n end",
"def isImage\n if self.image.attached? && self.image.content_type.in?(\"%w{image/jpeg,image/png,image/jpg}\")\n return true\n else\n return false\n end\n end",
"def path?\n !path.empty?\n end",
"def is_type_image?\n image_types.include? self.data_content_type\n end",
"def image?\n photo_content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}\n end",
"def picture?\n ThriveSmart::Helpers::AssetHelper::asset?(asset_type, asset_urn)\n end",
"def image?\n @image ||= !!(attachment_content_type =~ /^image\\/.+/)\n end",
"def contains_png?\n contains_images? and @url =~ /p\\z/i\n end",
"def image?\n picture_content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}\n end",
"def path_is?(path)\n @location.path_is?(path)\n end",
"def is_image_type?\n photo_content_type =~ %r(image)\n end",
"def is_image?\n !(attachment_content_type =~ /^image.*/).nil?\n end",
"def image?(uri)\n uri = URI.parse(uri) unless uri.is_a? URI\n !(IMAGE_REGEX =~ uri.path).nil?\n end",
"def image?(new_file)\n self.file.content_type.include? 'image'\n end",
"def has_image?\n\t\treturn File.exists? image_filename\n\tend",
"def has_image?\n File.exists? image_filename\n end",
"def has_image?\n false\n end",
"def path?\n !path.nil? && File.directory?(path)\n end",
"def is_url?\n path =~ URL_PATHS\n end",
"def has_imagen?\n\t\tFile.exists?\n\tend",
"def derived_image?\n respond_to?(:format_name) && !format_name.blank?\n end",
"def image?\n document_content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}\n end",
"def path?\n !!@path\n end",
"def path?\n !!@path\n end",
"def contains_images?\n !@url.nil?\n end",
"def image_url?\n image_node.nil?\n end",
"def raster_file?\n false\n end",
"def has_image?\n return File.exists? image_filename \n end",
"def has_image?\n return File.exists? image_filename \n end",
"def image?\n attachment_content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}\n end",
"def file?(path)\n ftype(path) == 'file' rescue false\n end",
"def current_path?(file); end",
"def path?(val)\n !!(val =~ /\\A\\//)\n end",
"def previewable?\n image? file\n end",
"def picture_exists?(path=nil)\n path ||= picture_path\n File.exist? path\n end",
"def pfile?\n @raw_image_files.first.pfile?\n end",
"def check_if_image?\n !(attachment_content_type =~ /^image.*/).nil?\n end",
"def has_image?\n !image.nil?\n end",
"def image?\n @streams.any? { |stream| stream.is_a? ImageStream }\n end",
"def not_image?(file)\n !file.content_type.include? 'image'\n end",
"def valid_other_image_parameters?\n # check version of gif\n return Image.gif89a?(@file_temp_path) if @file_type == GIF_TYPE\n # check \"color system\" of \"jpeg, jpg\" file\n return Image.rgb_color_system?(@file_temp_path) if @file_type == JPG_TYPE\n # always return true with \"png\" file\n true if @file_type == PNG_TYPE\n end",
"def valid_other_image_parameters?\n # check version of gif\n return Image.gif89a?(@file_temp_path) if @file_type == GIF_TYPE\n # check \"color system\" of \"jpeg, jpg\" file\n return Image.rgb_color_system?(@file_temp_path) if @file_type == JPEG_TYPE\n # always return true with \"png\" file\n true if @file_type == PNG_TYPE\n end",
"def valid_other_image_parameters?\n # check version of gif\n return Image.gif89a?(@file_temp_path) if @file_type == GIF_TYPE\n # check \"color system\" of \"jpeg, jpg\" file\n return Image.rgb_color_system?(@file_temp_path) if @file_type == JPEG_TYPE\n # always return true with \"png\" file\n true if @file_type == PNG_TYPE\n end",
"def image?(content_type)\n content_types.include?(content_type)\n end",
"def is_image?(resource, attribute)\n file = resource.send(attribute) if resource.respond_to?(attribute)\n is_document?(resource, attribute) && file && file.respond_to?(:styles) && !file.styles.blank?\n end",
"def not_image?(new_file)\n !self.file.content_type.include? 'image'\n end",
"def is_file?(path)\n ::File.file? abspath(path)\n end",
"def is_pathtype?(); @type == GRT_PATHTYPE; end",
"def geifile?\n @raw_image_files.first.geifile?\n end",
"def image_resource?\n parent.respond_to?(:image_resource?) && parent.image_resource?\n end",
"def absolute?(path); end",
"def png?\n \n if @tmpfile \n begin\n image = ChunkyPNG::Image.from_file(@tmpfile.path)\n return true if image\n rescue\n return false\n end\n end\n \n return @png if @png\n return false if location.empty?\n\n # # ... \n\n return true if location =~ /[.]png$/\n \n begin\n response = RestClient.head(location)\n return true if response.headers['content-type'] == 'image/png'\n rescue\n return false\n end\n \n return false\n \n end",
"def image_processing?\n !image_tmp.blank?\n end",
"def direct_link_to_image?(url)\n regexp = Regexp.new('^https?://(?:[a-z\\-]+\\.)+[a-z]{2,6}(?:/[^/#?]+)+\\.(?:jpg|gif|png|jpeg|JPEG|JPG|PNG|GIF)$')\n (url =~ regexp).present?\n end",
"def has_thumbnail?\n File.exists? path.gsub(/(.+)\\/(.+)/, '\\1/thumbs/\\2')\n end",
"def uploaded_image_displayed?\n displayed? UPLOADED_IMAGE\n end",
"def web_image?\n %w(png jpg jpeg gif).each do |sub_type|\n return true if Rack::Mime.match?(mime_type, \"image/#{sub_type}\")\n end\n\n false\n end",
"def valid_image_format?\n VALID_FILE_MIMETYPES.include? self.filetype\n end",
"def file?\n type == :file\n end",
"def is_file?\n !file_type.empty?\n end",
"def image_work?\n true\n end",
"def is_image_type?\n background_media.content_type =~ %r(image)\n end",
"def paths?\n !paths.empty?\n end",
"def image_url_provided?\n !self.image_url.blank?\n end",
"def image?\n return ( VALID_HEADERS.include? @hdr_reader )\n end",
"def verify_image(path)\n end"
] |
[
"0.7915396",
"0.7627567",
"0.7523299",
"0.7521808",
"0.73289144",
"0.7310542",
"0.7299094",
"0.72928894",
"0.7286898",
"0.7286898",
"0.7236265",
"0.7222476",
"0.7149916",
"0.7141606",
"0.7115477",
"0.7093228",
"0.7071559",
"0.70577955",
"0.7042917",
"0.7042819",
"0.70237076",
"0.7007816",
"0.69935787",
"0.69699323",
"0.69635713",
"0.6959048",
"0.69373125",
"0.69222885",
"0.6907359",
"0.68967545",
"0.68902797",
"0.68846077",
"0.68826675",
"0.6867455",
"0.68628746",
"0.6842262",
"0.68204516",
"0.6819712",
"0.6819048",
"0.6812319",
"0.6807178",
"0.68064535",
"0.6789117",
"0.67328185",
"0.6726983",
"0.6725211",
"0.6723047",
"0.67164314",
"0.6698137",
"0.66946363",
"0.668845",
"0.6688066",
"0.66705996",
"0.6648316",
"0.6638418",
"0.6634372",
"0.6628313",
"0.6628313",
"0.6617402",
"0.66068935",
"0.65916556",
"0.6562185",
"0.6562185",
"0.654001",
"0.6535074",
"0.6520892",
"0.65164137",
"0.6511513",
"0.6488357",
"0.6485653",
"0.64841115",
"0.64840895",
"0.6480885",
"0.64773875",
"0.6463166",
"0.6460902",
"0.6460902",
"0.64599717",
"0.6441803",
"0.6435",
"0.641132",
"0.6408826",
"0.6402863",
"0.6393303",
"0.6390533",
"0.63840306",
"0.6373793",
"0.6371961",
"0.6366225",
"0.63649106",
"0.6331814",
"0.6331163",
"0.6322172",
"0.6320454",
"0.63185763",
"0.6313832",
"0.63132685",
"0.63014317",
"0.62766093",
"0.6274182"
] |
0.71911275
|
12
|
Return the index file that is within this path
|
def index()
INDEXES.find { |i| (self + i).exist? }&.yield_self { |i| self + i }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index_file\n File.join(@directory, @host)\n end",
"def index_path(path)\n path ? path.chomp(File.extname(path)) + '.index' : nil\n end",
"def index_path\n safe_dir / options[:index_name]\n end",
"def open_index_file\n end",
"def open_index_file\n @index = File.open(@index_path, 'rb')\n end",
"def dotindex(path)\n file = File.join(path, '.index')\n File.file?(file) ? file : false\n end",
"def directory_index\n return @directory_index\n end",
"def index_path\n @index_path ||= begin\n index_path = ENV['INDEX']\n index_path = Dir['indexes/*.json'].sort.last if index_path.blank?\n abort 'Need an INDEX=indexes/some_index.json' if index_path.blank?\n abort \"#{ index_path } is not a file\" unless File.file?(index_path)\n index_path\n end\nend",
"def file_path\n 'index.html'\n end",
"def work_index_file\n File.join(tmpdir, SPECS_FILE)\n end",
"def file\n \"#{@request.path_info}.html\".gsub(/\\/\\./, 'index.')\n end",
"def index_path\n \"#{path}/index.html\"\n end",
"def directory_index\n @hash[\"DirectoryIndex\"]\n end",
"def croucher_index_file\n nil\n end",
"def directory_index\n end",
"def indexed_directory\n Picolena::IndexedDirectories.keys.find{|indexed_dir|\n dirname.starts_with?(indexed_dir)\n }\n end",
"def idx_log_file\n\t\t\"#{pre}/genome_idx/log\" #Bowtie2 Index Log\n\tend",
"def index_path(config)\n uri = config[REPOSITORY_ROOT]\n uri = uri[0..-2] while uri.end_with? '/'\n \"#{uri}#{INDEX_PATH}\"\n end",
"def get_index_from_gh # rubocop:disable Metrics/MethodLength, Metrics/AbcSize\n resp = Zip::InputStream.new URI(\"#{Hit::GHURL}index.zip\").open\n zip = resp.get_next_entry\n yaml = zip.get_input_stream.read\n index = RelatonBib.parse_yaml yaml, [Symbol]\n File.write path, index.to_yaml, encoding: \"UTF-8\"\n index\n end",
"def index\n Index.new(root, paths, extensions, aliases)\n end",
"def file\n File.join(root, FILENAME)\n end",
"def path\n @path ||= begin\n dir = File.join Dir.home, \".relaton\", \"iec\"\n FileUtils.mkdir_p dir\n File.join dir, \"index.yaml\"\n end\n end",
"def logical_path_for(filename)\n # TODO: Review performance\n _, path = paths_split(self.paths, filename)\n path, extname, _ = parse_path_extnames(path)\n path = path.sub(/\\/index$/, '') if File.basename(path) == 'index'\n path += extname if extname\n path\n end",
"def root\n '../' * file.count('/')\n end",
"def index?\n File.basename(path, '.*') == 'index'\n end",
"def root_file\n File.find(name) or raise 'No root file!'\n end",
"def template_path\n exact_path = File.join(root, request.path)\n with_erb = File.join(root, \"#{request.path}.html.erb\")\n with_index = File.join(root, File.dirname(request.path), 'index.html.erb')\n\n [ exact_path, with_erb, with_index ].find { |f| File.file?(f) }\n end",
"def file\n @pathname.to_s\n end",
"def get_indexfile_with_line number\n IO.readlines(@indexfile)[number]\n end",
"def file_path\n Dir.glob(config.cache).first || File.join(File.dirname(config.cache),\n File.basename(config.cache).gsub(/_.+\\.txt/, '_0.txt'))\n end",
"def get_indexfile_with_revision revision\n result = nil\n File.open(@indexfile, \"r\") do |f|\n f.each_line do |line|\n row = parse_indexfile_line(line)\n if row[0] == revision\n result = line\n break\n end\n end\n end\n return result\n end",
"def index_filename\n return @index_filename if @index_filename\n if !ARGV.grep(/\\-\\-util[ =]update$/).empty?\n @index_filename = File.join(VSCODE_SCRIPT_PATH, 'script_update_index.txt')\n # Prevent RMXP Scripts from loading\n Kernel.define_method(:eval) { |*args| }\n elsif !(matches = ARGV.grep(/\\-\\-script_context[ =].+\\.txt$/)).empty?\n @index_filename = File.join(VSCODE_SCRIPT_PATH, matches.first.match(/\\-\\-script_context[ =](.*)/).captures.first)\n # We also don't want custom script in that context\n Kernel.define_method(:eval) { |*args| }\n else\n @index_filename = SCRIPT_INDEX_PATH\n end\n puts \"Script Index : #{@index_filename}\"\n return @index_filename\n end",
"def outrelpath\n File.join(*permalink_ary(), \"index.html\")\n end",
"def lock_file_name\n @path + '/index.lock'\n end",
"def index\n history = File.open(@current)\n line = history.readline.rstrip\n line =~ /(\\d+)$/ # get the index\n $1.to_i\n end",
"def filename\n\t\treturn self.fullpath.split('/').last\n\tend",
"def index (path)\n extension = FileUtils.extension(path).downcase\n\n if extension == 'txt'\n return IO.read(path)\n end\n\n if extension == 'html' || extension == 'htm'\n return IO.read(path)\n end\n\n tmp = self.temp('html')\n begin\n FileUtils::OpenOffice.convert(path, tmp)\n return IO.read(tmp) if File.exists?(tmp)\n rescue\n ensure\n File.delete(tmp) if File.exists?(tmp) && File.writable?(tmp)\n end\n\n ''\n end",
"def html\n source = if @index_path\n raise \"index does not exist: #{@index_path}\" unless File.exist?(@index_path)\n File.read @index_path\n elsif File.exist? 'index.html'\n File.read 'index.html'\n elsif File.exist? 'index.html.erb'\n File.read 'index.html.erb'\n else\n SOURCE\n end\n\n ::ERB.new(source).result binding\n end",
"def root_page\n sitemap.find_resource_by_path(config.index_file)\n end",
"def load_index\n construct_index unless index_valid?\n open_index_file\n end",
"def parent\n root = path.sub(/^#{::Regexp.escape(traversal_root)}/, '')\n parts = root.split('/')\n\n tail = parts.pop\n is_index = (tail == @app.config[:index_file])\n\n if parts.empty?\n return is_index ? nil : @store.find_resource_by_path(@app.config[:index_file])\n end\n\n test_expr = parts.join('\\\\/')\n test_expr = %r{^#{test_expr}(?:\\.[a-zA-Z0-9]+|\\/)$}\n # eponymous reverse-lookup\n found = @store.resources.find do |candidate|\n candidate.path =~ test_expr\n end\n\n if found\n found\n else\n parts.pop if is_index\n @store.find_resource_by_destination_path(\"#{parts.join('/')}/#{@app.config[:index_file]}\")\n end\n end",
"def load_old_index\n file = File.open('/home/matt/Documents/programming/ruby/dmsw/index.html', 'rb')\n html = file.read.chomp\n file.close\n return html\nend",
"def load_script_from_index\n lines = File.readlines(index_filename)\n path = ENV['ALTERNATIVE_PATH'] || '.'\n lines.each do |filename|\n require(File.join(path, filename.chomp))\n end\n end",
"def file_path\n dir\n end",
"def read_index_file\n return if !File.exist?(path) || File.ctime(path).to_date < Date.today\n\n RelatonBib.parse_yaml File.read(path, encoding: \"UTF-8\"), [Symbol]\n end",
"def output_path\n writes_to_elasticsearch? ? elasticsearch_hdfs_tmp_dir(output_index) : super()\n end",
"def matching_file(path)\n File.join(root.folder, path)\n end",
"def phrender_index_file(index_file_path = nil)\n @phrender_index_file = index_file_path || @phrender_index_file\n end",
"def file_name\n File.basename @path\n end",
"def filename()\n #This is a stub, used for indexing\n end",
"def index\n Dir[\"#{@base_path}/*.json\"].map{|p| File.basename(p)}\n end",
"def current_file_path\n current_file.to_path\n end",
"def find_index_by_path(*path)\n if item = find_item_by_path(*path)\n item.index\n end\n end",
"def directory_index?\n path.include?(@app.config[:index_file]) || path =~ /\\/$/ || eponymous_directory?\n end",
"def index_path\n return templates_path\n end",
"def index\n env[INDEX] ||= Index.new(File.join(git.work_dir, 'refs', git.branch, 'index'))\n end",
"def source_file\n @source_location[0]\n end",
"def template_path(path)\n # Add a new template extension here if we need to.\n [ 'haml', 'erb' ].each do |template_extension|\n if path.directory? && (path + \"index.html.#{template_extension}\").file?\n return \"#{path}/index\"\n elsif (path.dirname + (path.basename.to_s + \".html.#{template_extension}\")).file?\n return path.dirname + path.basename.to_s\n end\n end\n nil\n end",
"def path()\n return ::File.join(@root, @name)\n end",
"def root_file_path; end",
"def indexed?\n @index_file and File.exist?(@index_file)\n end",
"def file\n file_names[x]\n end",
"def file_node(path)\n file_info(path).first[0..19]\n end",
"def path\n @base\n end",
"def path\n @file.path\n end",
"def index\n DocumentIndex.new(Colonel.config.storage_path)\n end",
"def index\n @index ||= Gem::SourceIndex.from_gems_in File.join(path, \"specifications\")\n end",
"def file\n File.join(directory, @file)\n end",
"def locate\r\n File.dirname(__FILE__)\r\n end",
"def locate\r\n File.dirname(__FILE__)\r\n end",
"def resolve\n file_location = modify_uri\n # Adding doc root if path is not aliased. Handling pathname joining\n if(file_location == @request.uri)\n file_location = File.join(@conf.document_root, file_location)\n end\n # If the path is directory, add dir index to serve index file\n if (!File.file?(file_location) and @request.extension == '')\n file_location = File.join(file_location, @conf.directory_index)\n @request.extension = File.extname(file_location)\n if @request.extension != \"\"\n @request.extension = @request.extension.split('.')[1]\n end\n end\n file_location\n end",
"def path\n @file\n end",
"def index?\n basename == \"index\"\n end",
"def index?\n basename == \"index\"\n end",
"def index; @index; end",
"def file\n if glob = file_map['vclog']\n Dir.glob(glob).first\n else\n Dir.glob(DEFAULT_GLOB).first\n end\n end",
"def get_content_output_filename output_dir, filename\n\n file_basename = File.basename(filename, '.*')\n\n if file_basename != 'index'\n output_dir = File.join(output_dir, file_basename)\n Dir.mkdir( output_dir )\n end\n\n File.join(output_dir, 'index.html')\n end",
"def index\n @index ||= tree.all_data.index(entry)\n end",
"def stream_index\n data_config.index_name\n end",
"def path\n @reader.path\n end",
"def file_path\n File.join(dir,filename)\n end",
"def index(file_rec)\n @index_driver.index(file_rec)\n end",
"def current_path\n file.try(:path)\n end",
"def index\n @index ||= Crawler::Index.new(base_uri)\n end",
"def first_savefile_index\r\n DataManager.latest_savefile_index\r\n end",
"def path\n http_url @store.rdoc.generator.file_dir\n end",
"def get_working_listing_file\n local_instances_list_file_locations.reject {|f| f unless File.file?(f) }.first\n end",
"def current_dir\n File.dirname(file_path)\n end",
"def index_uuid\n return nil if !@index_uuid_file\n return @index_uuid_file.read.chomp if @index_uuid_file.file?\n return nil\n end",
"def get_index\n # url = \"http://marketdata.set.or.th/mkt/marketsummary.do?language=th&country=TH\"\n # file = File.open('tmp/sample_index.html','w') do |f|\n # f.binmode\n # f << open(url).read\n # end\n file_name= 'tmp/sample_index.html'\n f = File.read(file_name)\n doc = Nokogiri::HTML(f)\n set_index = doc.css('tr:nth-child(8) td')[1].text\n render :text => string2f(set_index)\n end",
"def current\n\t\t\t\t\treturn Pathname.new(\".\")\n\t\t\t\tend",
"def index_path\n raise NotImplementedError\n end",
"def full_path\n container.root.join(path)\n end",
"def full_path\n container.root.join(path)\n end",
"def path_for_index(ps = {})\n home_path\n end",
"def index_dump\n { id => {\n \"name\" => name,\n \"file\" => filepath.relative_path_from(Dixi.contents_dir).to_s,\n \"type\" => type,\n }\n }\n end",
"def render_path\n @render_path ||= generate_file_name(@site.config[\"url\"], @site.config[\"baseurl\"])\n end",
"def filename\n File.basename(path)\n end",
"def aaf_index\n @index ||= ActsAsFerret::get_index(aaf_configuration[:name])\n end",
"def file\n files.first\n end",
"def file\n files.first\n end"
] |
[
"0.80191094",
"0.7670035",
"0.74189043",
"0.7242241",
"0.7171243",
"0.7085409",
"0.7046452",
"0.70265096",
"0.6979762",
"0.679883",
"0.675183",
"0.6677703",
"0.6581338",
"0.65166694",
"0.6486712",
"0.6464035",
"0.6377175",
"0.6350682",
"0.63445973",
"0.6334734",
"0.6332449",
"0.6310249",
"0.63009644",
"0.6288892",
"0.62389076",
"0.6229821",
"0.62173754",
"0.6211385",
"0.6198821",
"0.6171291",
"0.61575115",
"0.61423075",
"0.60887307",
"0.6083357",
"0.608117",
"0.607152",
"0.60633296",
"0.60578614",
"0.60441387",
"0.6029597",
"0.6020062",
"0.60172117",
"0.5980929",
"0.59772736",
"0.5972658",
"0.5971535",
"0.5961169",
"0.5960129",
"0.59348506",
"0.5896465",
"0.5894912",
"0.5886634",
"0.5875228",
"0.5873976",
"0.5846506",
"0.5827233",
"0.58118653",
"0.58020276",
"0.5793095",
"0.57840663",
"0.5772703",
"0.5772061",
"0.5763192",
"0.5761609",
"0.57598925",
"0.57587457",
"0.57580316",
"0.5757294",
"0.5756897",
"0.5756897",
"0.57517695",
"0.5743582",
"0.57419676",
"0.57419676",
"0.57320815",
"0.5728597",
"0.57271177",
"0.57137406",
"0.57129997",
"0.5708652",
"0.5701792",
"0.5700689",
"0.56997037",
"0.5698021",
"0.56887454",
"0.5683217",
"0.56725127",
"0.56710964",
"0.56693053",
"0.5663039",
"0.5660636",
"0.565943",
"0.5654906",
"0.5654906",
"0.56540895",
"0.5651147",
"0.5648667",
"0.56456447",
"0.56451446",
"0.5644644",
"0.5644644"
] |
0.0
|
-1
|
Return whether this is a path to an index file
|
def index?
INDEXES.include? self.name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index?\n File.basename(path, '.*') == 'index'\n end",
"def index?\n basename == \"index\"\n end",
"def index?\n basename == \"index\"\n end",
"def directory_index?\n path.include?(@app.config[:index_file]) || path =~ /\\/$/ || eponymous_directory?\n end",
"def indexing?\n File.exist?(@indexing)\n end",
"def indexed?\n @index_file and File.exist?(@index_file)\n end",
"def dotindex(path)\n file = File.join(path, '.index')\n File.file?(file) ? file : false\n end",
"def dotindex?\n @_dotindex ||= File.exist?(File.join(location, '.index'))\n end",
"def exist?\n File.exist?(index_file)\n end",
"def root_valid?\n index_files = Dir[File.join(path, \"index.*\")].count\n return true if index_files > 0\n return false\n end",
"def can_index?\n study.metadata_file.present? && study.metadata_file.parsed? && study_file.parsed? && !indexed && !is_indexing\n end",
"def index_path(path)\n path ? path.chomp(File.extname(path)) + '.index' : nil\n end",
"def index_valid?\n timestamp = File.open(@index_path, 'rb') { |f| read_int(0, f) }\n timestamp == @data_timestamp\n rescue\n false\n end",
"def has_index?\n INDEX_REGEXP =~ rootname_minus_role\n end",
"def index?\n self == '/'\n end",
"def supports_index_parsing?\n respond_to?(:indexes)\n end",
"def current_path?(file); end",
"def in_path?\n config.paths.any? do |path_spec|\n path_spec === file\n end\n end",
"def user_path?(file); end",
"def sitemap_index?\n sitemap_root_name == 'sitemapindex'\n end",
"def sitemap_index?\n root_name == 'sitemapindex'\n end",
"def should_index_this_document?(complete_path)\n last_itime=index_time_dbm_file[complete_path]\n @from_scratch || !last_itime || File.mtime(complete_path)> Time._load(last_itime) \n end",
"def in_path?(path); end",
"def is_path?\n !!((@file.is_a?(String) || @file.is_a?(Pathname)) && !@file.blank?)\n end",
"def file?(path)\n ::File.file?(prefixed(path))\n end",
"def load_index_cache?(file)\n load_index_cache(file) if File.exist?(file)\n end",
"def exist?\n @index_info.index_exists?\n end",
"def file?\n (@typeflag == \"0\" || @typeflag == \"\\0\") && !@name.end_with?(\"/\")\n end",
"def file?(file_path)\n nlst(file_path)[0] == file_path\n end",
"def file?(path)\n raise NotImplemented\n end",
"def index_exists?\n begin\n result = Slingshot::Configuration.client.get \"#{Mebla::Configuration.instance.url}/#{@slingshot_index_name}/_status\"\n return (result =~ /error/) ? false : true\n rescue RestClient::ResourceNotFound\n return false\n end\n end",
"def parse_file\n n = 0\n begin\n @opener.open(@indexfile,\"r\") do |f|\n until f.eof?\n # read the entry\n entry = read_entry(f, n)\n n += 1\n end\n end\n return true\n rescue Errno::ENOENT\n return false\n end\n end",
"def skip_index?(file)\n if file.end_with? 'README.md'\n dir = File.dirname file\n File.exist? \"#{dir}/index.md\"\n else\n false\n end\n end",
"def file_is_filtered?(path_cand)\n filename = File.basename(path_cand)\n ix = @filter_file.index(filename)\n if ix\n log \"FILTER: #{path_cand}\" \n return true\n else\n return false\n end\n end",
"def index_path\n @index_path ||= begin\n index_path = ENV['INDEX']\n index_path = Dir['indexes/*.json'].sort.last if index_path.blank?\n abort 'Need an INDEX=indexes/some_index.json' if index_path.blank?\n abort \"#{ index_path } is not a file\" unless File.file?(index_path)\n index_path\n end\nend",
"def file?(path)\n File.file?(path_of(path))\n end",
"def open_index_file\n end",
"def is_file?(path)\n ::File.file? abspath(path)\n end",
"def index_exists?\n connection.index_exists?(index_name_with_prefix)\n end",
"def index?\n true\n end",
"def index?\n true\n end",
"def is_subpage_of?(fullpath, parent_fullpath)\n return false if %w(index 404).include?(fullpath)\n\n if parent_fullpath == 'index' && fullpath.split('/').size == 1\n return true\n end\n\n File.dirname(fullpath.dasherize) == parent_fullpath.dasherize\n end",
"def dump_index_cache?(file)\n dump_index_cache(file) unless File.exist?(file)\n end",
"def contain?(filename); end",
"def has_index? index\n @index.include? index\n end",
"def has_index? index\n @index.include? index\n end",
"def index?\n false\n end",
"def index?\n false\n end",
"def file?(path)\n ftype(path) == 'file' rescue false\n end",
"def valid_search_path?(path)\n if File.directory?(path) and Pathname.new(path).absolute?\n return true\n elsif path.match %r[^file:/]\n return true\n end\n\n return false\n end",
"def exists?\n File.exists?(\"#{rdoc_dir('default')}/index.html\") && File.exists?(\"#{rdoc_dir(RdocInfo.config[:template])}/index.html\")\n end",
"def file_exists?(path)\n end",
"def request_is_file?(path)\n question = absolute_path(path) \n File.file?(question) \n end",
"def index_exists?(index)\n indexes([index[:table]]).find {|i| i[\"columns\"] == index[:columns]}\n end",
"def exists\n resp = create_request().get(build_index_definition_url())\n if resp.code == 404\n return false\n end\n raise_on_http_error(resp)\n return true\n end",
"def index_exists?\n __elasticsearch__.client.exists? id: id,\n index: self.class.__elasticsearch__.index_name,\n type: self.class.__elasticsearch__.document_type\n end",
"def index_exists_by_name?(table, index)\n indexes_for_table[table].include?(index)\n end",
"def has_file?(path)\n @data[:files].has_key? path.to_sym\n end",
"def file_is_filtered?(path_cand)\n filename = File.basename(path_cand)\n extname = File.extname(filename)\n ix_ext = @filter_extension.index(extname)\n ix = @filter_file.index(filename)\n if ix or ix_ext\n log \"FILTER: #{path_cand}\" \n return true\n else\n return false\n end\n end",
"def in_path? file\n return true if file =~ %r%\\A/% and File.exist? file\n\n ENV['PATH'].split(File::PATH_SEPARATOR).any? do |path|\n File.exist? File.join(path, file)\n end\n end",
"def path?\n !path.empty?\n end",
"def in_path? file\n return true if file =~ %r%\\A/% and File.exist? file\n ENV['PATH'].split(File::PATH_SEPARATOR).any? do |path|\n File.exist? File.join(path, file)\n end\n end",
"def found?\n File.exist?(request_path) and (stat.directory? or stat.file?) and stat.readable?\n end",
"def visited? fullname\n return @visited_files.index fullname\nend",
"def document_exists? path_to_document\n File.exists? path_to_document\n end",
"def file?\n File.exist?(path) && File.directory?(path)\n end",
"def valid?\n prefix = File.expand_path(root_path)\n prefix == File.expand_path(@file)[0...prefix.size]\n end",
"def eponymous_directory?\n if !path.end_with?(\"/#{@app.config[:index_file]}\") && destination_path.end_with?(\"/#{@app.config[:index_file]}\")\n return true\n end\n\n @app.files.by_type(:source).watchers.any? do |source|\n (source.directory + Pathname(eponymous_directory_path)).directory?\n end\n end",
"def path_is?(path)\n @location.path_is?(path)\n end",
"def valid_indexes?(file_index, rank_index)\n validate_class file_index, Integer\n validate_class rank_index, Integer\n (file_index > -1 && file_index < files.size) &&\n (rank_index > -1 && rank_index < ranks.size)\n end",
"def virtual_file?(name); end",
"def file_exists?\r\n File.file?(full_path)\r\n end",
"def file?() end",
"def is_file?\n path = self.to_abs_path\n ((File.exist?(path)) &&\n (File.readable?(path)))\n end",
"def any?\n if @path.is_a?(String)\n File.exist?(@path)\n else\n @path.size.positive?\n end\n end",
"def has_index?( *index_names )\n \n has_index = false\n \n index_names.each do |this_index_name|\n break unless has_index = indexes.has_key?( this_index_name )\n end\n \n return has_index\n\n end",
"def exists? path\n end",
"def stdlib_path?(file); end",
"def has_file?(path)\n @files.has_key?(path)\n end",
"def file?(name)\n File.file?(path(name))\n end",
"def is_file?(path)\n !self.is_dir?(path)\n end",
"def file?\n original_filename.present?\n end",
"def index_exists index\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}\")\n req = Net::HTTP::Head.new(uri)\n\n begin\n result = run(uri, req)\n result.is_a?(Net::HTTPNotFound) ? false : true\n rescue StandardError => error\n log.warn \"encountered an error while checking if index #{index} exists\"\n log.warn error\n false\n end\n end",
"def file?\n type == :file\n end",
"def check_index_name\n return if index_name\n @logger.display('index_name_missing')\n exit 1\n end",
"def has_file? name\n File.file? path / name\n end",
"def index_path\n safe_dir / options[:index_name]\n end",
"def partial?\n file_type == :view and basename !~ /^_/\n end",
"def document?(location)\n location.file? and location.extname == \".pione\"\n end",
"def maybe_hidden_file?(path); end",
"def maybe_hidden_file?(path); end",
"def file?\n not identifier.blank?\n end",
"def ignored_file?(path); end",
"def has_file?(path)\n @files.has_key?(path)\n end",
"def file?\n kind == NODE_FILE\n end",
"def index?\n return true\n end",
"def has_sphinx_index?\n sphinx_index.is_a?(ThinkingSphinx::Index)\n rescue\n false\n end",
"def file?\n case type\n when T_REGULAR then true\n when T_UNKNOWN then nil\n else false\n end\n end",
"def include?(index)\n true\n end",
"def check_index_finder\n # Leave it alone\n end"
] |
[
"0.85196257",
"0.8095758",
"0.8095758",
"0.8028921",
"0.80063266",
"0.79343736",
"0.77629954",
"0.7431194",
"0.7342893",
"0.73079026",
"0.7023683",
"0.69463253",
"0.68939525",
"0.67599154",
"0.6754572",
"0.6690822",
"0.6678313",
"0.6670263",
"0.6662022",
"0.6610829",
"0.6575489",
"0.6571281",
"0.6551043",
"0.65240234",
"0.64994746",
"0.6495377",
"0.647638",
"0.6468063",
"0.64667964",
"0.6431873",
"0.64287525",
"0.64072675",
"0.64040667",
"0.6348642",
"0.6344187",
"0.6336742",
"0.63246566",
"0.63083845",
"0.6307849",
"0.630385",
"0.6289224",
"0.62546223",
"0.62487954",
"0.6231844",
"0.62044626",
"0.62044626",
"0.6166071",
"0.6166071",
"0.61537135",
"0.6151072",
"0.6126357",
"0.6123942",
"0.61169964",
"0.60881925",
"0.60872394",
"0.6075337",
"0.60743463",
"0.60593945",
"0.6054583",
"0.6052462",
"0.6040662",
"0.60389054",
"0.602692",
"0.60133535",
"0.600401",
"0.5999605",
"0.5992257",
"0.59918505",
"0.5976204",
"0.59680957",
"0.5959483",
"0.595601",
"0.5952829",
"0.5939748",
"0.5938815",
"0.5938372",
"0.59370196",
"0.59353954",
"0.59314656",
"0.59314144",
"0.593031",
"0.593004",
"0.59290946",
"0.59286135",
"0.59259576",
"0.5925746",
"0.5925187",
"0.59225416",
"0.59193736",
"0.59173226",
"0.59173226",
"0.5915853",
"0.5915546",
"0.5913802",
"0.5907863",
"0.5907526",
"0.5905289",
"0.58998007",
"0.5890662",
"0.5887888"
] |
0.69843817
|
11
|
Return the basename of this path
|
def name()
basename.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def basename\n File.basename(path)\n end",
"def basename\n File.basename(@path, '.*')\n end",
"def basename\n @basename ||= File.basename(path)\n end",
"def basename( path )\r\n File.basename( path )\r\n end",
"def basename\n File.basename( fullpath, ext )\n end",
"def basename(path)\n File.basename(path)\n end",
"def name\n File.basename(@path)\n end",
"def name\n File.basename(@path)\n end",
"def name\n File.basename(@path)\n end",
"def get_basename(file_path)\n File.basename file_path\n end",
"def basename\n File.basename(filename)\n end",
"def name\n File.basename(path)\n end",
"def name\n ::File.basename(path)\n end",
"def path_name\n return unless @basename\n\n parts = @basename.split('.')\n parts.pop if parts.length > 1 && parts.last =~ /^\\w+$/\n parts.pop if parts.last =~ /^\\d+$/\n parts.join('.')\n end",
"def file_name\n File.basename @path\n end",
"def basename\n return self.name.downcase.gsub(/^.*::/, '')\n end",
"def basename(fn)\n split_filename(fn).last\n end",
"def basename(fn)\n split_filename(fn).last\n end",
"def filename\n File.basename(path)\n end",
"def basename\n @basename ||= ''\n end",
"def name\n File.basename(self.path)\n end",
"def filename\n File.basename( fullpath )\n end",
"def basename\n filename.chomp(extname)\n end",
"def basename\n if extension\n basename = filename.split('.')\n basename.pop\n basename.join('.')\n else\n filename\n end\n end",
"def basename(path)\n path.chomp(\"/\")\nend",
"def basename\n s = name\n (i = s.rindex('::')) and (s = s.right(-i-2)) unless s.blank?\n s\n end",
"def basename(name)\n if name =~ /.*\\/(.*)/\n name = $1\n end\n name\n end",
"def name\n File.basename(absolute_path)\n end",
"def basename( fn )\n ::File.basename(fn, '.*')\n end",
"def basename_of(filename)\n filename.sub(/(\\.[a-z]+)*$/, '')\n end",
"def instance_method\n File.basename(self.path)\n end",
"def basename(*args) Path::Name.new(File.basename(path, *args)) end",
"def basename(file_path)\n filename = File.basename(file_path)\n return filename.split('.')[0].to_sym if file_path\n end",
"def file_name\n File.basename(file_path)\n end",
"def base\n File.basename @filename, extension_with_delimiter\n end",
"def basename\n @generator.basename\n end",
"def directory_basename\n File.basename(@directory)\n end",
"def base_name\n File.basename @absolute_name\n end",
"def base_name\n File.basename(file_name)\n end",
"def basename\n File.basename(self.upload.url).split(/\\?/)[0]\n end",
"def filename\n path && File.basename(path)\n end",
"def name\n name = nil\n if root?\n name = path.to_s\n else\n name = @path.basename.to_s\n end\n return name\n end",
"def basename_of(filename)\n filename.sub(extension_regex, '')\n end",
"def basename_without_ext\n @basename_without_ext ||= File.basename(path, \".*\")\n end",
"def name\n file.partition(base).last.gsub(/[_\\/]/, \" \").strip\n end",
"def file_name_from_path(path)\n path.split(\"/\")[-1]\n end",
"def basename(file)\n File.basename(file, \".*\")\n end",
"def filename\n\t\treturn self.fullpath.split('/').last\n\tend",
"def extract_name(file_path)\n if file_path[-1, 1] == \"/\"\n return nil\n end\n\n # File.basename is too eager to please and will return the last\n # component of the path even if it ends with a directory separator.\n ::File.basename(file_path)\n end",
"def base_name(suffix=nil)\n adapter.basename(suffix)\n end",
"def basename_without_ext; end",
"def file_name\n \"/\" + current_file.path.split('/').pop\n end",
"def name\n @name ||= File.basename(path)\n end",
"def original_filename\n File.basename(self.path)\n end",
"def original_filename\n File.basename(self.path)\n end",
"def original_filename\n File.basename(self.path)\n end",
"def basename; end",
"def basename; end",
"def basename; end",
"def basename; end",
"def inspect\n File.basename @__path\n end",
"def basename\n suffixed? ? name.sub(/\\.#{Regexp.escape(template.name)}$/, '') : name\n end",
"def name\n @name ||= ::File.basename(@path)\n end",
"def name\n @name ||= File.basename(path)\n end",
"def name\n @name ||= File.basename(path)\n end",
"def get_corresponding_file_base_name\n return File.basename(@URL)\n end",
"def name\n File.basename(@root)\n end",
"def main_name(path)\n File.basename(path).sub(/\\.[^\\.]+$/,'')\n end",
"def chop_basename(path)\n base = File.basename(path)\n if base.empty? or base == '/'\n return nil\n else\n return path[0, path.rindex(base)], base\n end\n end",
"def basename(delimiter = '/', start = nil)\n return nil if is_placeholder_directory? \n \n prefix = self.key\n unless start.nil?\n prefix = prefix.gsub(start,'')\n end\n \n arr = prefix.split(delimiter)\n if arr.length == 1\n arr[0]\n else\n nil\n end\n end",
"def basename(filename)\n value = filename\n known_extensions.each do |str|\n value = value.gsub(/\\.#{str}$/, '')\n end\n value\n end",
"def base file, ext; return File.basename file, ext end",
"def base file, ext; return File.basename file, ext end",
"def base_name\n File.basename @relative_name\n end",
"def basename(suffix = nil)\n File.basename(filename, suffix || extname)\n end",
"def extract_basename(input)\n input.to_s.gsub(/^.*\\/([^\\/\\?]+).*$/, '\\1')\n end",
"def chop_basename(path)\n base = File.basename(path)\n if /\\A#{SEPARATOR_PAT}?\\z/o =~ base\n return nil\n else\n return path[0, path.rindex(base)], base\n end\n end",
"def to_name\n basename.to_s.sub extname, ''\n end",
"def basename filename, drop_ext = nil\n if drop_ext\n ::File.basename filename, (drop_ext == true ? (extname filename) : drop_ext)\n else\n ::File.basename filename\n end\n end",
"def basename\n @chart_data.title\n .strip\n .gsub(/\\s+/, '_')\n .downcase\n end",
"def original_filename\n File.basename(@file_path)\n end",
"def get_filename(file)\n File.basename(file)\n end",
"def filename\n unless @filename\n @filename = @path.basename.to_s\n end\n\n @filename\n end",
"def chop_basename(path)\n base = File.basename(path)\n if /\\A#{SEPARATOR_PATTERN}?\\z/ =~ base\n return nil\n else\n return path[0, path.rindex(base)], base\n end\n end",
"def chop_basename(path)\n base = File.basename(path)\n if /\\A#{SEPARATOR_PAT}?\\z/o =~ base\n return nil\n else\n return path[0, path.rindex(base)], base\n end\n end",
"def basename_without_ext\n if not @basename_without_ext\n @basename_without_ext = File.basename(path, '.*')\n if not @is_default_language\n @basename_without_ext ['.' + @language] = ''\n end\n end\n @basename_without_ext\n end",
"def printable_part(pathname)\r\n if (!@rl_filename_completion_desired) # don't need to do anything\r\n return (pathname)\r\n end\r\n\r\n temp = pathname.rindex('/')\r\n return pathname if temp.nil?\r\n File.basename(pathname)\r\n end",
"def wp_basename(path, suffix = '')\n CGI::unescape( File.basename( CGI.escape(path).gsub(/%2F|%5C/, '/'), suffix ))\n end",
"def base()\n sub_ext('').basename.to_s\n end",
"def filename\n path.split(File::Separator).join(\"_\")\n end",
"def filename\n @parts[-1]\n end",
"def basename\n without_extension.delete_suffix(WIP_IDENTIFIER)\n .delete_suffix(DEV_IDENTIFIER)\n end",
"def fname(path)\n path.split(\"/\").last\n end",
"def filename\n return unless url\n\n ::File.basename(url.split(\"?\").first)\n end",
"def intname\n @basename\n end",
"def basename(namespace)\n normalize(namespace).gsub(/.*::/,'')\n end",
"def basename_without_extension(file)\n return File::basename(file.to_s, File::extname(file.to_s))\n end",
"def file_name(at_path = nil)\n at_path ||= @full_path\n File.basename at_path, '.*'\n end",
"def file_name(at_path = nil)\n at_path ||= @full_path\n File.basename at_path, '.*'\n end",
"def basename(suffix = T.unsafe(nil)); end"
] |
[
"0.8931662",
"0.8930892",
"0.8696967",
"0.8563624",
"0.8524203",
"0.84646547",
"0.8336217",
"0.8336217",
"0.8336217",
"0.8334566",
"0.8332328",
"0.8284411",
"0.8193947",
"0.81410867",
"0.81361055",
"0.8090682",
"0.8075787",
"0.80571336",
"0.8047242",
"0.7970981",
"0.7968894",
"0.7964907",
"0.79535276",
"0.79370475",
"0.7920359",
"0.7906874",
"0.78648084",
"0.7837108",
"0.77928084",
"0.7764949",
"0.7730547",
"0.7710012",
"0.7692631",
"0.76816493",
"0.7614022",
"0.75978285",
"0.7570377",
"0.75479734",
"0.75340307",
"0.75300825",
"0.7528456",
"0.75171316",
"0.7491672",
"0.745843",
"0.74232334",
"0.74095696",
"0.7385844",
"0.7379764",
"0.7378343",
"0.73760474",
"0.73607266",
"0.73577404",
"0.73340297",
"0.73220116",
"0.73220116",
"0.73220116",
"0.7318254",
"0.7318254",
"0.7318254",
"0.7318254",
"0.7315785",
"0.7312747",
"0.7291445",
"0.729108",
"0.729108",
"0.7267096",
"0.72613806",
"0.72362167",
"0.7232836",
"0.72305125",
"0.7228766",
"0.7222103",
"0.7222103",
"0.72197515",
"0.7182654",
"0.7155603",
"0.7141181",
"0.711776",
"0.70935506",
"0.7092683",
"0.707396",
"0.7062466",
"0.7054644",
"0.70489734",
"0.7023966",
"0.6990234",
"0.69873023",
"0.6961705",
"0.6948658",
"0.6946661",
"0.694503",
"0.6944602",
"0.6937046",
"0.6916382",
"0.691065",
"0.68799734",
"0.6863468",
"0.6858361",
"0.6858361",
"0.68549305"
] |
0.75784487
|
36
|
Return whether this is a path to a page
|
def page?
PAGE_EXTS.include? extname
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def in_path?(path); end",
"def path_is?(path)\n @location.path_is?(path)\n end",
"def in_path?\r\n self.aln_path_id.nil? ? false : true\r\n end",
"def points_to? path\n href = @tag.scan(/href=\\\"([^\"]*)\\\"/)[0][0] rescue nil\n return false unless href\n unless href.start_with? '/'\n href = URI(href).send :path_query rescue nil\n end\n href == path\n end",
"def page_selected?(page)\n self.current_page.fullpath =~ /^#{page.fullpath}(\\/.*)?$/\n end",
"def path?\n !path.empty?\n end",
"def path?\n !!@path\n end",
"def path?\n !!@path\n end",
"def is_url?\n path =~ URL_PATHS\n end",
"def current_spree_page?(url)\n path = request.fullpath.gsub(/^\\/\\//, '/')\n if url.is_a?(String)\n return path == url\n elsif url.is_a?(Hash)\n return path == spree.url_for(url)\n end\n return false\n end",
"def page_link?(uri)\n uri = URI.parse(uri) unless uri.is_a? URI\n uri.path =~ PAGE_REGEX || uri.path !~ /\\..*$/\n end",
"def exists?(path)\n @pages.has_key?(normalize_path(path))\n end",
"def is_path?(); @type == GRT_PATH; end",
"def has_path?(path)\n !node_for(path).nil?\n end",
"def is_subpage_of?(page, parent)\n return false if page.index_or_404?\n\n if page.parent_id # only in the new version of the engine\n return page.parent_id == parent._id\n end\n\n if parent.fullpath == 'index' && page.fullpath.split('/').size == 1\n return true\n end\n\n File.dirname(page.fullpath.dasherize) == parent.fullpath.dasherize\n end",
"def current_page?(url); end",
"def relative?\n\t\tpath[0] == 47\n\tend",
"def is_direct_path item\n\t\t!item.nil? and !item[3] and item[1] == @zero_pathitem\n\tend",
"def activepage?(path)\n \t\t\"active\" if current_page?(path)\n \tend",
"def path?(val)\n !!(val =~ /\\A\\//)\n end",
"def if_questions_page\n view_context.request.path == '/questions'\n end",
"def current_section?(path)\n request.fullpath.starts_with?(path)\n end",
"def is_subpage_of?(fullpath, parent_fullpath)\n return false if %w(index 404).include?(fullpath)\n\n if parent_fullpath == 'index' && fullpath.split('/').size == 1\n return true\n end\n\n File.dirname(fullpath.dasherize) == parent_fullpath.dasherize\n end",
"def segmented_path?\n path.split('/').any? { |s| s[0] == ':' }\n end",
"def current_path?(path)\n request.path == path\n end",
"def page?\n !!self.page_id\n end",
"def current_path?(path)\n @ctx.path_with_slashes(@ctx.current_path) == @ctx.path_with_slashes(path)\n end",
"def include_page?(page)\n if do_not_show?(page)\n false\n elsif @options[:exclude]\n (page.fullpath =~ @options[:exclude]).nil?\n else\n true\n end\n end",
"def include_page?(page)\n if !page.listed? || page.templatized? || !page.published?\n false\n elsif @options[:exclude]\n (page.fullpath =~ @options[:exclude]).nil?\n else\n true\n end\n end",
"def path_defined?(path)\n return (not root_defined_path_part[path].nil?)\n end",
"def include_page?(page)\n if !page.listed? || page.templatized? || !page.published?\n false\n elsif @_options[:exclude]\n (page.fullpath =~ @_options[:exclude]).nil?\n else\n true\n end\n end",
"def is_page?(action)\n d = Dir.new \"pages\"\n d.each do |f|\n if f[0] != '.'\n # TODO: Allow different kind of extensions\n return true if action == File.basename(f, \".html.erb\")\n end\n end\n false\n end",
"def top_level?\n slug == slug_path\n end",
"def active_path?(href, current_path = \"\")\n href == get_path(current_path)\n end",
"def match?(path)\n has_real_path? path\n end",
"def current? link\n request.env['PATH_INFO'] == link\n end",
"def valid_path?(content)\n content.visibility_ancestor_ids.all? { |id| existing_ids.include?(id) }\n end",
"def hierarchical?\n if @path\n true\n else\n false\n end\n end",
"def is_current_section(path)\n request.fullpath.start_with?(path)\n end",
"def active? path \n \"active\" if current_page? path\n end",
"def url?\n children[0] && children[0].is_a?(Url)\n end",
"def valid_page?\n File.exist?(Pathname.new(Rails.root + \"app/views/welcome/#{params[:page]}.html.erb\"))\n end",
"def is_page?\n is_entry? && params[:_entry_type_] == 'page'\n end",
"def active? path\n \"active\" if current_page? path\n end",
"def active? path\n \"active\" if current_page? path\n end",
"def home_path?(path)\n path[0] == ?~\n end",
"def empty_path?\n super || remaining_path == '/'\n end",
"def supports_path?; end",
"def home_page?\n current_route?('')\n end",
"def part_of_current_url?(url)\n url = url.is_a?(String) ? url : polymorphic_path(url)\n url == '/' ? request.request_uri == '/' : request.request_uri.starts_with?(url)\n end",
"def has_path?(v)\n @visited[v]\n end",
"def is_page?(page = '')\n return false unless @is_page\n\n return true if page.blank?\n\n page_obj = get_queried_object()\n\n page = [page] unless page.is_a?(Array)\n page.map!(&:to_s)\n\n if page_obj.is_a?(Railspress::Page) && page.include?(page_obj.id.to_s)\n return true\n elsif page_obj.is_a?(Railspress::Page) && page.include?(page_obj.post_title)\n return true\n elsif page_obj.is_a?(Railspress::Page) && page.include?(page_obj.post_name)\n return true\n else\n page.each do |pagepath|\n next unless pagepath.include?('/')\n pagepath_obj = get_page_by_path(pagepath)\n if !pagepath_obj.blank? && pagepath_obj.id == page_obj.id\n return true\n end\n end\n end\n false\n end",
"def at?(loc)\n\t\t\trequest.path_info.downcase.include? loc.to_s\n\t\tend",
"def current_path_starts_with?(path)\n @ctx.path_with_slashes(@ctx.current_path).start_with?(@ctx.path_with_slashes(path))\n end",
"def game_path?\n !NonGamePaths.include?('%s:%s' % [request.request_method, request.path])\n end",
"def path?(instance, *method_names)\n !path(instance, *method_names, try: true).nil?\n end",
"def has_page?\n if url.nil? or page.nil? or page.document.nil?\n errors.add(:page, \"can not be nil\")\n return false\n end\n true\n end",
"def is_path?\n !!((@file.is_a?(String) || @file.is_a?(Pathname)) && !@file.blank?)\n end",
"def active_url?(request)\n\t\t\t\t\treturn false if !request || !self.url\n\t\t\t\t\tcurrent_locale, current_path = RicWebsite::Helpers::LocaleHelper.disassemble(request.fullpath)\n\t\t\t\t\tif self.url == \"/\"\n\t\t\t\t\t\treturn current_path == \"/\"\n\t\t\t\t\telse\n\t\t\t\t\t\treturn current_path.start_with?(self.url)\n\t\t\t\t\tend\n\t\t\t\tend",
"def checkUserPageAccess(user, pagePath)\n return false\n end",
"def parent_dir_link?(link)\n link[:href] == '../'\n end",
"def path_exist?(path)\n @content_tree.path_exist? path\n end",
"def path_would_break_wraith?(path)\n path.include?('path')\n end",
"def acceptable_request?\n location_path\n end",
"def has_path_to?(node)\n @visited.include?(node)\n end",
"def on_page?\n raise NotImplementedError, \"implement me, e.g. using #has_title?\"\n end",
"def path?\n !path.nil? && File.directory?(path)\n end",
"def requesting_a_part?\n parts.any? && requested_content_item_path && requested_content_item_path != base_path\n end",
"def home_page?\n controller_name == 'pages' && %w(home location_name).detect {|x| action_name == x} ? true : false\n end",
"def page_redirect?(title)\n page_info_contains_key(title, 'redirect')\n end",
"def index?\n self == '/'\n end",
"def has_own_breadcrumbs?\n !self.is_a?(SystemPage)\n end",
"def empty_path?\n path.empty?\n end",
"def root_path_match?\n url == '/'\n end",
"def accessing_absolute_path(path)\n return true if path.start_with?('/')\n\n false\n end",
"def page_url_is_correct\n ( current_url =~ self.class.page_url_validation_value ) !=nil\n end",
"def valid_path? unit, path\n path.inject(@units[unit].location) do |p,c|\n return false unless adjacent?(p, c) && can_path_through(*c)\n c\n end\n true\n end",
"def path_open?(index)\n\t\treturn element_props(index)['open-path']\n\tend",
"def permitted_path?\n FirstClickFree.permitted_paths.include?(URI.parse(request.fullpath).path)\n end",
"def path?(point, direction)\n @paths[point] & direction != 0\n end",
"def hasChild?\n @path.size > 1\n end",
"def outside_path?(param)\n outside_addresses = [\n \"/login\",\n \"/signup\",\n \"/\" # equivalent to /login\n ]\n outside_addresses.any?{ |path| path == param }\n end",
"def verify_page?\n current_url.include?('Google')\n end",
"def current_page?(url_string, check_parameters: false)\n if url_string.index(\"?\") || check_parameters\n clean_params = request.query_parameters.except(:page)\n fullpath = if request.fullpath.index(\"?\")\n request.path + \"?\" + clean_params.to_query\n else\n request.path\n end\n\n fullpath == url_string\n else\n request.path == url_string\n end\n end",
"def page_found_with_redirect?\n @page_found_with_redirect\n end",
"def circular_reference?(path)\n path.include?(\"#{escaped_pointer}/\")\n end",
"def landing_page? \n landing_page.present? \n end",
"def is_workplace_page? \n return true if controller_name == \"workplaces\" || controller_name ==\"workplace_posts\" || controller_name == \"workplace_map_posts\"\n end",
"def is_parent_page_active(page)\n current_page.url.match(page)\n end",
"def include?(path)\n path_to_object(path) ? true : false\n end",
"def is_home?\n current_page?('/')\n end",
"def is_exact?\n @path.include?('*') == false\n end",
"def is_active?(path)\n \tpaths = []\n \tif not path.is_a?(Array)\n \t\tpaths << path\n \telse\n \t\tpaths = path\n \tend\n \tpaths.each { |p| return \"active\" if current_page?(p) }\n end",
"def paths?\n !paths.empty?\n end",
"def is_page_active(page)\n current_page.url == page\n end",
"def current_path?(file); end",
"def should_inline?(path)\n path !~ /\\A\\/\\//\n end",
"def root?\n self.path == '/'\n end",
"def next_page?\n !next_page_link.nil?\n end",
"def root_page?\n current_page == root_page\n end"
] |
[
"0.7659068",
"0.7474515",
"0.7307276",
"0.72600466",
"0.7252238",
"0.71985817",
"0.7168751",
"0.7168751",
"0.71575993",
"0.70962524",
"0.7028101",
"0.70043",
"0.6998761",
"0.6980428",
"0.6898934",
"0.67808247",
"0.67758626",
"0.67670053",
"0.6727148",
"0.668895",
"0.6672746",
"0.66632366",
"0.6661577",
"0.6661563",
"0.66609573",
"0.66529334",
"0.663641",
"0.66255665",
"0.66202855",
"0.6612788",
"0.65989906",
"0.6595983",
"0.65851855",
"0.6580016",
"0.65674335",
"0.653653",
"0.6535299",
"0.6532698",
"0.6529522",
"0.6513503",
"0.6507848",
"0.65061617",
"0.65038896",
"0.6496946",
"0.6496946",
"0.6484531",
"0.6476781",
"0.6474496",
"0.64560914",
"0.64435023",
"0.6435681",
"0.6433988",
"0.64183706",
"0.64005727",
"0.6371942",
"0.63686883",
"0.63651",
"0.6364912",
"0.63573444",
"0.6348077",
"0.634807",
"0.63438445",
"0.6343267",
"0.6333402",
"0.63139826",
"0.63067985",
"0.6298473",
"0.628429",
"0.62771714",
"0.62714976",
"0.6270695",
"0.6266018",
"0.62603486",
"0.62427956",
"0.62187976",
"0.6215354",
"0.621437",
"0.62103885",
"0.62025493",
"0.619826",
"0.6189762",
"0.61882985",
"0.6183497",
"0.61756694",
"0.6175265",
"0.61685467",
"0.6162815",
"0.61622167",
"0.6160493",
"0.6158253",
"0.6146134",
"0.6139209",
"0.61385506",
"0.61329293",
"0.61322546",
"0.6125743",
"0.6121545",
"0.6121072",
"0.61206776",
"0.61169696"
] |
0.6680367
|
20
|
Return paths to directories that are located within the path
|
def subdirectories()
children.select { |c| c.directory? }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_directories_absolute_paths path\n dir_list = Dir[\"#{path}/*/\"]\n \n #Remove unnecessary directories\n dir_list.delete(File.join(path, \".\"))\n dir_list.delete(File.join(path, \"..\"))\n \n dir_list\n end",
"def subdir_paths(path)\n\tfolder_metadata = @client.metadata(path)\n\tcontents = folder_metadata['contents']\n\n\tsubdir_paths = []\n\tfor i in contents\n\t\tif i['is_dir']\n\t\t\tsubdir_paths << i['path']\n\t\tend\n\tend\n\tsubdir_paths\nend",
"def GetDirectoryPathsFromRelativeBase(path)\n pathParts = path.RelativePathParts\n paths = []\n for i in 1..pathParts.length\n\tsubPath = ProjectPath.new(JoinPaths(pathParts.slice(0, i)))\n\tpaths.push(subPath)\n end\n return paths\n end",
"def find_paths(dir=\"\")\n base = File.join(@source, dir)\n entries = Dir.chdir(base) { filter_entries(Dir[\"*\"]) }\n paths = []\n\n entries.each do |entry|\n absolute_path = File.join(base, entry)\n relative_path = File.join(dir, entry)\n\n if File.directory?(absolute_path)\n paths.concat find_paths(relative_path)\n else\n paths << absolute_path\n end\n end\n paths\n end",
"def possible_paths_for(path)\n possible_paths[path] ||= [\n paths_from_project_root,\n paths_from_local_software_dirs,\n paths_from_software_gems,\n ].flatten.inject([]) do |array, directory|\n destination = File.join(directory, path)\n\n if File.directory?(destination)\n array << destination\n end\n\n array\n end\n end",
"def non_dir_files(path)\n `find -L #{path}`\n .split\n .map { |f| Pathname.new(f) }\n .reject { |f| f.directory? }\n .map { |f| f.relative_path_from(path) }\nend",
"def get_directories_names path\n get_directories_absolute_paths(path).map {|dir| File.basename(dir) }\n end",
"def get_dirs(dir_path)\n dirs = Array.new\n Dir[dir_path + \"/*\"].each do |i|\n if Dir.exists?(i)\n dirs.push(i) if File.directory?(i)\n # Recursive\n dirs.push(get_dirs(i)) \n end\n end\n dirs.flatten!\n dirs.compact!\n dirs\n end",
"def get_files_in_path(path)\n puts \"Scanning for files in directory: #{path}\"\n Dir.entries(path).reject { |f| File.directory? f }\nend",
"def search_paths\n # NOTE: Do not cache this list, specific generators\n # will modify it with their own lookups\n create_search_paths.select { |path| File.directory?(path) }\n end",
"def find_dir(path)\n return path if path.starts_with?('/') && Dir.exist?(path)\n\n repository_search_paths.each do |search_path|\n combined_path = File.join(search_path, path)\n return combined_path if Dir.exist?(combined_path)\n end\n\n nil\n end",
"def dirs(path)\n ary = Dir.entries(path).collect do |f|\n d(f, path)\n end\n ary.delete(nil)\n ary\n end",
"def folders_listing path\n cmd = \"find #{path} -type d \"\n if @folder_regexp\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@folder_regexp}\\\"\"\n end\n folders = exec_cmd(cmd)\n folders\n end",
"def directory_subdirectories(path)\n\tputs ''\n\tfor i in subdir_paths(path)\n\t\tputs i\n\tend\n\tputs ''\n\treturn nil\nend",
"def ingest_paths\n path = Pathname.new(Figgy.config[\"ingest_folder_path\"]).join(ingest_directory)\n return [] unless path.exist?\n path.children.select(&:directory?)\n end",
"def expand_all path\n real_path = VirtualLayer.realpath(path)\n elems = real_path.split('/'); elems.shift # throw away the first element which is empty for a FQ pathname\n if path[-1] == '/'\n filt_fn = ->(p) { VirtualLayer.directory?(p) }\n else\n filt_fn = ->(p) { p }\n end\n result = rejoin(walk_globs(elems)).flatten.select(&filt_fn).sort\n\n if path[0] == '/'\n result\n else\n cwd = VirtualLayer.pwd\n result.map {|p| p[(cwd.length+1)..] }\n end\nend",
"def directory_entries\n entries.select{ |f| File.directory?(File.join(path,f)) }\n #dirs = ::Dir.glob(\"#{path}/\")\n #dirs.collect{ |f| f.chomp('/') }\n end",
"def directories\n directory.directoires\n end",
"def scan_sub_dirs_in_path(path)\n puts 'Scanning destination directories'\n Dir.chdir(path)\n sub_dirs = Dir['*'].select { |o| File.directory?(o) }\n Dir.chdir(root_dir)\n sub_dirs\nend",
"def get_file_names path\n Dir.entries(path).select { |file| !File.directory? File.join(path, file) }\n end",
"def directory_paths\n pages.map { |p| File.dirname(p.path).split(\"/\")[0] }.uniq\n end",
"def get_directories(src)\n directories = Array.new\n #return directories\n Find.find(src) do |path|\n # not too sure what this was intended to do but its getting in the way\n # and can not be matched correctly.\n #next if File.dirname(path) != src \n next if path == src\n next if not File.directory? path\n directories.push path\n end\n directories.reverse\nend",
"def ls(path)\n dir = scope.get(path)\n InvalidPath.raise! {!dir.try(:is_dir)}\n dir.files.map(&:path)\n end",
"def files_in_path\n Dir.glob(\"#{@path}/**/*/**\") | Dir.glob(\"#{@path}/**\")\n end",
"def paths\n tree_path = File.join(File.dirname(__FILE__), 'rails_tree')\n [\"\", \"multitest\", \"results\"].inject([tree_path]) do |result, suffix|\n result << File.join(result[-1], suffix)\n end[1..3]\n end",
"def find_data_dir(path)\n each_data_path(path).find { |full_path| File.directory?(full_path) }\n end",
"def getDirs dir\n\t\tFind.find(dir)\t\n\tend",
"def containing_directory\n path.dirname\n end",
"def directories\n return @expanded_dirs if @expanded_dirs\n\n raw_dirs = File.readlines(settings.check_dirs).map(&:chomp)\n simple_dirs = raw_dirs.reject{ |line| line.empty? || line.start_with?('#') }\n expanded_dirs = simple_dirs.map do |line|\n expanded = Dir.glob(line)\n if expanded.empty?\n # return original line for error reporting\n line\n else\n # only return directories\n expanded.select{ |dir| File.directory?(dir) }\n end\n end\n @expanded_dirs = expanded_dirs.flatten.sort_by(&:downcase)\n end",
"def recursive_find_directories_and_files dirname\r\n base_path = self.class.lookup('ExtAdminSection').path + \"/templates/\"\r\n \r\n directories = []\r\n files = []\r\n \r\n Find.find(File.join(base_path, dirname)) do |path|\r\n if FileTest.directory?(path)\r\n directories << path.gsub(base_path, '')\r\n else\r\n files << path.gsub(base_path, '')\r\n end\r\n end\r\n \r\n return directories, files\r\n end",
"def all_directories dir\n Dir[\"#{dir}**/\"]\nend",
"def files_for_directory(path)\n directory = find_preferred_file(\n @new_resource.cookbook_name, \n :remote_file, \n path, \n @node[:fqdn],\n @node[:platform],\n @node[:platform_version]\n )\n\n unless (directory && ::File.directory?(directory))\n raise NotFound, \"Cannot find a suitable directory\"\n end\n\n directory_listing = Array.new\n Dir[::File.join(directory, '**', '*')].sort { |a,b| b <=> a }.each do |file|\n next if ::File.directory?(file)\n file =~ /^#{directory}\\/(.+)$/\n directory_listing << $1\n end\n directory_listing\n end",
"def path_dir\n File.split(path).first\n end",
"def iterationFolder(path) \r\n\t\tfolderArray = []\r\n\t\tDir.entries(path).each do |sub| \r\n\t\t\tif sub != '.' && sub != '..' \r\n\t\t\t if File.directory?(\"#{path}/#{sub}\") \r\n\t\t\t\t#puts \"[#{sub}]\"\r\n\t\t\t\titerationFolder(\"#{path}/#{sub}\") \r\n\t\t\t else \r\n\t\t\t\t#puts \"|--#{sub}\"\r\n\t\t\t\tfolderArray << $SCRIPT_DIR_PATH + \"/\" + \"#{sub}\"\r\n\t\t\t end \r\n\t\t\tend \r\n\t\tend \r\n\t\treturn folderArray\r\n\tend",
"def get_dirs\n Dir.glob(\"#{@options[:load_path]}/*/**/\")\n end",
"def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end",
"def whereis(prog, path=ENV['PATH'])\n dirs = []\n path.split(File::PATH_SEPARATOR).each do |dir|\n if File::ALT_SEPARATOR\n if prog.include?('.')\n f = File.join(dir,prog)\n if File.executable?(f) && !File.directory?(f)\n if block_given?\n yield f.gsub(/\\//,'\\\\')\n else\n dirs << f.gsub(/\\//,'\\\\')\n end\n end\n else\n Win32Exts.find_all do |ext|\n f = File.join(dir,prog+ext)\n if File.executable?(f) && !File.directory?(f)\n if block_given?\n yield f.gsub(/\\//,'\\\\')\n else\n dirs << f.gsub(/\\//,'\\\\')\n end\n end\n end\n end\n else\n f = File.join(dir,prog)\n if File.executable?(f) && !File.directory?(f)\n if block_given?\n yield f\n else\n dirs << f\n end\n end\n end\n end\n dirs.empty? ? nil : dirs\n end",
"def paths\n Array(@ruhoh.cascade.paths.map{|h| h[\"path\"]}).map { |path|\n collection_path = File.join(path, resource_name)\n next unless File.directory?(collection_path)\n\n collection_path\n }.compact\n end",
"def list_dirs(path)\n dir = pathname(path)\n\n Dir.chdir(dir) do\n Dir['*/'].sort\n end\n\n rescue\n raise FileNotFound, \"no such file in repo - #{path}\"\n end",
"def SubPaths()\n #puts \"Searching subpaths in #{to_s()}\"\n entries = Dir.entries(AbsolutePath())\n subPaths = []\n \n #puts \"Found entries #{entries}\"\n \n entries.each do |entry|\n if(entry == \"..\" || entry == \".\")\n next\n end\n \n copy = CreateCopy()\n \n #puts \"Copy is #{copy}\"\n \n copy.RelativePath = JoinPaths([copy.RelativePath, entry])\n subPaths.push(copy)\n \n #puts \"Created path #{copy} for entry #{entry}\"\n end\n \n return subPaths\n end",
"def list_of_directories\n Dir.entries(\"./inspections\").select {|d| !d.start_with?(\".\") }\n end",
"def detected_directories\n sub_directories.reject do |on_disk|\n children.any? { |in_db| in_db.full_path == on_disk }\n end.map do |found|\n children.new(relative_path: found.relative_path_from(disk.path), disk: disk)\n end.each(&:valid?) # build paths\n end",
"def directories\n [root_path, deploys_path, shared_path,\n log_path, checkout_path, scripts_path]\n end",
"def _potential_directories\n dirs = []\n dirs << _vim_user_dir\n dirs << _vim_system_dir\n return dirs.compact.map { |dir| File.expand_path(dir) }\n end",
"def walk_path(dirs)\n (1..dirs.to_a.length).map do |k|\n File.join(*dirs.to_a.take(k))\n end\nend",
"def relativize_paths(paths)\n return paths unless relativize_paths?\n paths.map do |path|\n path.gsub(%r{^#{@directory}/}, '')\n end\n end",
"def get_folders(path = \".\")\n @@FOLDER.clear\n if File.absolute_path(path) == Dir.pwd\n populate_folders()\n elsif File.directory?(path)\n Dir.chdir path\n populate_folders()\n else\n return \"Path is not a folder\"\n raise IOError\n end\n\n end",
"def find_root_path(path)\n return nil if path.nil?\n filepath = File.expand_path(path)\n\n if dir_exist?(filepath)\n directory = filepath\n elsif file_exist?(filepath)\n directory = File.dirname(filepath)\n else\n return nil\n end\n\n until directory.nil?\n break if file_exist?(File.join(directory, 'metadata.json')) || file_exist?(File.join(directory, 'environment.conf'))\n parent = File.dirname(directory)\n # If the parent is the same as the original, then we've reached the end of the path chain\n if parent == directory\n directory = nil\n else\n directory = parent\n end\n end\n\n directory\n end",
"def directories\n directory_entries.map{ |f| FileObject[path, f] }\n end",
"def enumerate_directories(directory)\n return directory.\n children.\n select(&:directory?).\n map(&:expand_path)\n end",
"def get_non_linked_dir_path_for_path(path)\n \n #check if the directory exists (either as an actual directory or hard link) or whether we need to get the parent first\n \n if File.exist?(path) then\n \n #check first if we can go and get it directly\n \n if File.directory?(path) then\n \n return path\n \n end\n \n #otherwise, find the index from hard link count\n \n index = File.stat(path).nlink\n \n final_dir = File.join(@mount_point, @path_to_dir_entries, Dirlisting_prefix + index.to_s)\n \n return final_dir\n \n end\n \n #recursively get the parent directory\n \n split_path = File.split(path)\n \n parent_path = get_non_linked_dir_path_for_path(split_path[0])\n \n get_non_linked_dir_path_for_path(File.join(parent_path, split_path[1]))\n \n end",
"def list_files(path)\n base_directory_content = Dir.glob(File.join(path, \"*\"))\n nested_directory_content = Dir.glob(File.join(path, \"*/**/*\"))\n [base_directory_content, nested_directory_content].flatten\n end",
"def get_file_absolute_paths path\n get_file_names(path).map { |file| File.join(path, file) }\n end",
"def possible_files(path, base_path)\n path = Pathname.new(path)\n base_path = Pathname.new(base_path).dirname\n root_path = Pathname.new(context.root_path)\n paths = [ path, partialize_path(path) ]\n\n # Add the relative path from the root, if necessary\n if path.relative? && base_path != root_path && path.to_s !~ /\\A\\.\\//\n relative_path = base_path.relative_path_from(root_path).join path\n \n paths.unshift(relative_path, partialize_path(relative_path))\n end\n\n paths.compact\n end",
"def possible_files(context, path, base_path)\n path = Pathname.new(path)\n base_path = Pathname.new(base_path).dirname\n paths = [ path, partialize_path(path) ]\n\n # Find base_path's root\n env_root_paths = context.environment.paths.map {|p| Pathname.new(p) }\n root_path = env_root_paths.detect do |env_root_path|\n base_path.to_s.start_with?(env_root_path.to_s)\n end\n root_path ||= Pathname.new(context.root_path)\n\n # Add the relative path from the root, if necessary\n if path.relative? && base_path != root_path\n relative_path = base_path.relative_path_from(root_path).join path\n paths.unshift(relative_path, partialize_path(relative_path))\n end\n\n paths.compact\n end",
"def directories(install)\n install = !!install\n @cache[\"directories\"].select do |key, d_install|\n d_install == install\n end.map(&:first)\n end",
"def all_files_under(path, &ignore)\n path = Pathname(path)\n\n if path.directory?\n path.children.flat_map do |child|\n all_files_under(child, &ignore)\n end.compact\n elsif path.file?\n if block_given? && ignore.call(path)\n []\n else\n [path]\n end\n else\n []\n end\n end",
"def common_directory paths\n dirs = paths.map{|path| path.split('/')}\n min_size = dirs.map{|splits| splits.size}.min\n dirs = dirs.map{|splits| splits[0...min_size]}\n uncommon_idx = dirs.transpose.each_with_index.find{|dirnames, idx| dirnames.uniq.length > 1}.last\n dirs[0][0...uncommon_idx].join('/')\n end",
"def find_existing(path)\n until File.directory?(path)\n path = File.dirname(path)\n end\n path\n end",
"def dir_list\n path_from_env || default_path\n end",
"def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\/\"), ''\n end\n end",
"def paths\n names = Array.new\n each_tarball_entry { |entry| names << Pathname.new(entry).cleanpath.to_s }\n names - ['.']\n end",
"def entries\n ::Dir.entries(path) - ['.', '..']\n end",
"def get_file_list relative_path\n\t\t\t\tpath = File.join(@src, relative_path)\n\t\t\t\tresult = nil\n\t\t\t\tFileUtils.cd(path) do\n\t\t\t\t\tresult = Dir.glob(\"**/*\", File::FNM_DOTMATCH)\n\t\t\t\t\tresult.reject! { |fn| File.directory?(fn) }\n\t\t\t\t\tresult.reject! { |fn| fn =~ /(^_|\\/_)/ }\n\t\t\t\tend\n\t\t\t\tresult\n\t\t\tend",
"def mungle_paths(paths)\n return paths if terraform.pre_0_12?\n\n paths.map do |path|\n File.directory?(path) ? path : File.dirname(path)\n end.uniq\n end",
"def full_path\n look_in.each do |dir|\n extensions.each do |ext| \n path = File.join(dir, [@path, ext].join)\n if File.exists?(path) && File.file?(path)\n return path\n end\n end\n end\n return\n end",
"def ls_r path\n ls(path).inject([]){|rec_paths,path| rec_paths << path; rec_paths << ls(path) unless file?(path); rec_paths}.flatten\n end",
"def list_directories(options = {})\n options = DEFAULTS.merge(options)\n\n path = options[:path]\n all = options[:all]\n\n path = \"#{path}/\" unless path == '' or path.end_with?('/')\n path = path+'**/' if all\n \n\n Dir.glob(\"#{path}*/\")\n end",
"def get_files_in_dir(path)\n Dir[\"#{path}*\"].sort! { |e1, e2| stringnum_comparison(e1, e2) }\n end",
"def retrieve_dirs(_base, dir, dot_dirs); end",
"def all_data_dirs(path)\n each_data_dir(path).to_a\n end",
"def find_files( path )\n file_paths.each_with_object([]) do |search_path,obj|\n found = File.join( search_path, path )\n obj << found if File.exist? found\n end.reverse.uniq\n end",
"def get_ls(path)\n #repo = @repo\n #head = repo.commits.first\n #tree = head.tree @branch\n\n tree = @repo.tree @branch\n\n #strip trailing /\n path.sub! /[\\/]*$/, ''\n\n # find dir\n while !path.empty?\n tdir = tree / path\n break if tdir.is_a?(Grit::Tree)\n # strip last conponent to /\n path.sub! /(^|\\/)[^\\/]*$/, ''\n end\n\n if path.empty?\n tdir = tree\n else\n path += '/'\n end\n print \"path:\", path, \"\\n\"\n print \"tdir:\", tdir, \"\\n\"\n\n files = tdir.blobs.map do |b|\n { path: \"#{path}#{b.name}\", name: b.name, siz: b.size }\n end\n dirs = tdir.trees.map do |t|\n { path: \"#{path}#{t.name}\", name: t.name}\n end\n if !path.empty?\n dirs.push( { path: path.sub(/(^|\\/)[^\\/]*\\/$/, ''),\n name: '..'} )\n end\n\n [files, dirs, path]\n end",
"def monitored_paths\n paths = Dir['**/*'].select do |path|\n @script.patterns.any? {|p| path.match(p) }\n end\n paths.push(@script.path).compact!\n paths.map {|path| Pathname(path).expand_path }\n end",
"def resolve_files(path)\n path = File.expand_path(path, __FILE__)\n\n if File::directory? path\n files = Dir.entries(path).reject! {|s| s =~ /^\\./} # don't include dotfiles\n files.map! {|file| File.join(path, file)}\n files = files.sort_by {|filename| File.size(File.expand_path(filename, path)) }\n else\n files = [path]\n end\n\n files.reject! {|file| File::directory? file}\n\n files\n end",
"def each_directory(path)\n return to_enum(__method__, path) unless block_given?\n\n path_so_far = nil\n Pathname.new(path).each_filename do |dir|\n if path_so_far.nil?\n path_so_far = String.new(dir)\n else\n path_so_far << File::SEPARATOR << dir\n end\n yield path_so_far\n end\n end",
"def source_directories(dir)\n elm_package_json(dir)['source-directories']\n .to_a\n .map { |directory| Pathname.new(\"#{dir}/#{directory}\").cleanpath }\n .select { |directory| Dir.exist?(directory) }\n .map { |directory| \"'#{directory}'\" }\n .join(' ')\n end",
"def _directories wd\n $log.debug \" directories got XXX: #{wd} \"\n d = Dir.new(wd)\n ent = d.entries.reject{|e| !File.directory? File.join(wd,e)}\n $log.debug \" directories got XXX: #{ent} \"\n ent.delete(\".\");ent.delete(\"..\")\n return ent\n end",
"def split_paths(path)\n dir_list = path.split('/').drop(1) # drops the \"\" because of the first \"/\"\n path_list = ['/'+dir_list.first]\n dir_list.drop(1).each do |dir|\n path = path_list.last + '/' + dir\n path_list.push path\n end\n path_list\nend",
"def find_dirs\n\tlog_paths = [ \"/etc/\", \"/home/log/\", \"/home/ids/log/\", \"/usr/adm/\", \"/usr/apache/\", \"/usr/apache2/\", \"/usr/httpd/\", \"/usr/local/apache/\", \"/usr/local/apache2/\", \"/usr/var/adm/\", \"/usr/var/ids/\", \"/usr/var/log/\", \"/var/adm/\", \"/var/ids/\", \"/var/log/\", \"/var/prelude/\", \"/var/run/\", \"/var/www/\", \"/root/Desktop/\" ]\n\n\t#Cycle through the Possible Log File Locations and Check for Logs if directory exists\n\tlog_paths.each do |dir|\n\t\t#Check if the log possible log file directory exists before we go and glob its content\n\t\tif File.exists?(dir) && File.directory?(dir)\n\t\t\tfind_logs(\"#{dir}\")\n\t\tend\n\tend\nend",
"def get_filepaths(target_dir)\n dirpaths = [target_dir + \"/subnodes\", target_dir + \"/headnodes\"]\n filepaths = []\n dirpaths.each do |dirpath|\n Dir[dirpath+\"/*\"].each do |filepath|\n filepaths << filepath\n end\n end\n return filepaths\n end",
"def find_path(path)\n @data.each_pair do |name, dir|\n if dir[:directory] == path\n return Directory::new(name, dir)\n end\n end\n \n return nil\n end",
"def list_files_from_dir(path)\n Dir[path + \"/*/\"].map { |file| File.basename(file) }\n end",
"def simplify_path(path)\n stack = []\n result = ''\n\n path.split('/').each do |dir|\n if dir == '' || dir == '.'\n next\n elsif dir == '..'\n stack.pop()\n else\n stack.push(dir)\n end\n end\n\n while stack.length > 0\n result = '/' + stack.pop() + result\n end\n\n return '/' if result == ''\n\n result\nend",
"def get_dir_contents(path)\n\tfolder_metadata = @client.metadata(path)\n\tcontents = folder_metadata['contents']\n\n\tcontents_paths = []\n\tfor i in contents\n\t\tcontents_paths << i['path']\n\tend\n\tcontents_paths\nend",
"def find_files_recursive (base_directory, relative_path)\n result = []\n directory = File.join(base_directory, relative_path)\n Dir.foreach(directory) do |file|\n relative_file = relative_path.empty? ? file : File.join(relative_path, file)\n if matchesFilters(file, relative_file)\n full_path = File.join(base_directory, relative_file)\n if File.directory?(full_path)\n result = result + find_files_recursive(base_directory, relative_file)\n else\n result << relative_file\n end\n end\n end\n result\n end",
"def possible_paths_dir(opts)\n # partial_path is implemented in each store.\n @storage_paths.map { |path| File.join(path, partial_path(opts)) }\n end",
"def get_chef_files_absolute_paths path\n get_file_absolute_paths(path).select { |file| is_valid_chef_component_file?(file) }\n end",
"def sort_contained_files_and_dirs(path)\n dirs, files = [], []\n if path != nil && File.directory?(path)\n Find.find(path) do |x|\n case\n when File.directory?(x)\n x.sub!(path, '')\n dirs << x unless x.length == 0\n when File.file?(x)\n x.sub!(path, '')\n files << x unless x.length == 0\n end\n end\n end\n {:files => files, :dirs => dirs}\n end",
"def paths\n Array(config.path).map(&:to_s)\n end",
"def relative_paths(smart_path)\n root = smart_path.generic_path\n found = []\n @path_index.each do |path|\n found << Pathname(path).relative_path_from(Pathname(root)).to_s if smart_path.valid_path?(path)\n end\n found\n end",
"def absolute_paths_for(relative_path)\n base_directories.inject([]) do |acc, dir|\n f = \"#{dir}/#{relative_path}\"\n File.exists?(f) ? acc << f : acc\n end\n end",
"def result_paths( pattern = '*' )\n paths = nil\n Dir.chdir(dir) {\n paths = Dir.glob(pattern).map {|x| Pathname.new(x).expand_path }\n }\n # remove directories of Analysis\n anl_dirs = analyses.map {|anl| /^#{anl.dir.to_s}/ }\n paths.reject do |path|\n anl_dirs.find {|anl_dir| anl_dir =~ path.to_s }\n end\n end",
"def get_asset_dir(path)\n root_paths.each { |root| return root if path.include?(root) }\n nil\n end",
"def paths\n f = File.open(@path)\n f.grep(FILE_NAME_PATTERN) { $1 }\n end",
"def list_directories\n Dir.chdir(path)\n Dir.foreach(EXTENSION) do |element|\n next if element == \".\" or element == \"..\"\n yield element\n end\n end",
"def directories\n @directories.values\n end",
"def file_paths(file_tree, path_so_far = \"\")\n paths = []\n file_tree.keys.each do |key|\n if file_tree[key] == true\n extended_path = path_so_far + \"#{key}\"\n paths << extended_path\n else\n extended_path = path_so_far + \"#{key}/\"\n paths += file_paths(file_tree[key], extended_path)\n end\n end\n paths\nend",
"def guest_paths(folders)\n folders.map { |parts| parts[2] }\n end",
"def get_bag_paths\n bag_paths = Array.new\n \n Dir.glob(@path).each do |entry|\n if !(File.directory? entry) || entry == \".\" || entry == \"..\"\n next\n end\n \n bag_paths.push entry\n end\n \n return bag_paths\n end",
"def path(*path)\n [dir, *path].reduce(:+)\n end"
] |
[
"0.7960086",
"0.7743149",
"0.77249473",
"0.7532881",
"0.74060684",
"0.71659684",
"0.714252",
"0.70631945",
"0.70460904",
"0.7045724",
"0.7043294",
"0.69965637",
"0.69935155",
"0.6992477",
"0.6915281",
"0.6914906",
"0.6872348",
"0.6838196",
"0.68331164",
"0.67923707",
"0.6764497",
"0.6753649",
"0.67490727",
"0.67410225",
"0.67287195",
"0.6726295",
"0.6713492",
"0.6702306",
"0.6701877",
"0.66989064",
"0.6685469",
"0.6678667",
"0.66728497",
"0.66582817",
"0.66292906",
"0.66257316",
"0.6603035",
"0.6601918",
"0.6587071",
"0.6574408",
"0.6563004",
"0.65387577",
"0.6525635",
"0.64715606",
"0.6465777",
"0.64262843",
"0.6425509",
"0.64222914",
"0.64182216",
"0.64178216",
"0.6408277",
"0.6395516",
"0.63639796",
"0.63355863",
"0.6322465",
"0.6310074",
"0.63089406",
"0.6288556",
"0.628751",
"0.62868154",
"0.6280504",
"0.62539643",
"0.6217596",
"0.619449",
"0.6193975",
"0.6172508",
"0.6165998",
"0.6149206",
"0.61484087",
"0.6148391",
"0.6146263",
"0.6138555",
"0.6124596",
"0.6121859",
"0.6120746",
"0.6118039",
"0.611767",
"0.6107355",
"0.6104446",
"0.6104139",
"0.6096468",
"0.60854787",
"0.60849446",
"0.608105",
"0.6076544",
"0.6071598",
"0.6070068",
"0.60618126",
"0.60611165",
"0.6059454",
"0.6054975",
"0.60502183",
"0.60470444",
"0.6040008",
"0.60393846",
"0.6020008",
"0.6018792",
"0.60068303",
"0.6003992",
"0.5989935",
"0.5986358"
] |
0.0
|
-1
|
may lead to loops in blank transition graph...(as may opt and star)
|
def nothing
return lambda do |pos|
return []
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def transitions; end",
"def transition_at; end",
"def transition_at; end",
"def build_assignment_graph(layer)\n\t\th = @via_positions.length\n\t\tfail if (h == 0) || h.odd?\n\t\tfail if @start_node.pads.min < 0 || @start_node.pads.max >= @layer_count\n\t\tfail if @end_node.pads.min < 0 || @end_node.pads.max >= @layer_count\n\t\tvia_count = h / 2\n\t\tputs via_count\n\t\tlayers = 0..(@layer_count - 1) \n\t\tcolums = 0..(via_count * 2) # F O F O F for via_count == 2 \n\t\t#vp = @via_positions.dup # x,y pairs\n\t\t#vp.unshift(@start_node.y)\n\t\t#vp.unshift(@start_node.x)\n\t\tvp = [@start_node.x, @start_node.y] + @via_positions\n\t\tm = Array.new(@layer_count){Array.new(via_count * 2 + 1)}\n\t\tfor i in colums # from T back to S\n\t\t\tif i.even?\n\t\t\t\ty = vp.pop\n\t\t\t\tx = vp.pop\n\t\t\tend\n\t\t\tfor j in layers\n\t\t\t\tl = Array.new\n\t\t\t\tif i.even? # forward\n\t\t\t\t\tk = i + 1\n\t\t\t\t\twhile k > 0\n\t\t\t\t\t\tk -= 2\n\t\t\t\t\t\tif k == -1 # link forward node to T node\n\t\t\t\t\t\t\tl << @end_node if @end_node.pads.include?(j)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif (h = m[j][k])\n\t\t\t\t\t\t\t\tl << h # link to up/down node \n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tunless l.empty?\n\t\t\t\t\t\tm[j][i] = F_node.new(x, y, j, l)\n\t\t\t\t\t\tl.each{|el|\n\t\t\t\t\t\t#unless @segment_list.index{|m| m.x1 == && m.y1 == el.y1 & m.x2 == el.x2 && m.y2 == el.y2}\n\t\t\t\t\t\t\t@segment_list << Segment.new(x, y, el.x, el.y)\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\telse #up/down\n\t\t\t\t\tfor k in layers do\n\t\t\t\t\t\tif (k != j) && (h = m[k][i - 1])\n\t\t\t\t\t\t\tl << h\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tunless l.empty?\n\t\t\t\t\t\tm[j][i] = V_node.new(x, y, j, l)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#puts @segment_list.length\n\t\t@segment_list.uniq!{|el| [el.x1, el.y1, el.x2, el.y2]}\n\t\tputs @segment_list.length\n\t\t@all_intersecting_segments = Array.new\n\t\t@segment_list.each{|el|\n\t\t\t@all_intersecting_segments += el.intersecting_segments\n\t\t}\n\t\t@all_intersecting_segments.uniq!\n\n\t\tfor j in layers\n\t\t\tif (h = m[j][-1]) && @start_node.pads.include?(j)\n\t\t\t\t@start_node.next << h\n\t\t\tend\n\t\tend\n\tend",
"def minimize\n# create a new one, or modify the current one in place,\n# and return it\nfa = FiniteAutomaton.new\nkeys = @state.keys.sort\np0, p1 = [], []\nkeys.each{|k|\nif is_final?(k)\np0 = p0.push(k)\nelsif\np1 = p1.push(k)\nend\n}\nnewfa = {}\nrstate = []\nif p0 != nil then rstate.push(p0) end\nif p1 != nil then rstate.push(p1) end\npstate = []\nwhile pstate != rstate\npstate = []\nrstate.each{|r| pstate.push(r)}\nrstate = []\npstate.each{|p|\np = p.sort\nresult = split(p, pstate)\np0 = result[0]\np1 = result[1]\nresult.each{|r|\nif r != []\nr = r.sort\nrstate = rstate.push(r)\nend\n}\n}\nend\nstart = []\nfinal = []\nrstate.each{|r| newfa[r] = fa.new_state}\nlist = newfa.keys\nlist.each{|l|\nl.each{|k|\nif k == @start\nstart.push(l)\nend\nif is_final?(k)\nfinal.push(l)\nend\n}\n}\nif start != []\nstart.each{|s| if newfa[s] then fa.set_start(newfa[s]) end}\nend\nif final != []\nfinal.each{|f| fa.set_final(newfa[f], true)}\nend\nrstate.each{|r0|\nr0.each{|r1|\n@alphabet.each{|a|\nif get_transition(r1, a) != nil\nrstate.each{|r|\nif r.include?(get_transition(r1, a)[0])\nif !(fa.get_transition(newfa[r0], a))\nfa.add_transition(newfa[r0], newfa[r], a)\nif fa.get_alpha.include?(a) == false\nfa.get_alpha.push(a)\nend\nend\nend\n}\nend\n}\n}\n}\nfa\nend",
"def feedback_arc_set_step1(graph, fas)\n reduced_graph = subtract_edges_graph(graph, edges_to_graph(fas))\n fas.select do |(u, v)|\n reduced_graph[u] ||= []\n reduced_graph[u] << v\n cyclic = cyclic?(reduced_graph)\n reduced_graph[u].pop if cyclic\n cyclic\n end\n end",
"def compute_unreachable_states\n queue = [starting_state].to_set\n transitions = self.each_transition.to_a.dup\n\n done_something = true\n while done_something\n done_something = false\n transitions.delete_if do |from, _, to|\n if queue.include?(from)\n queue << to\n done_something = true\n end\n end\n end\n\n transitions.map(&:first).to_set\n end",
"def detect_cycle_in_graph(edges)\nend",
"def eClosure(ss)\nvisited = []\ndiscovered = [ss]\nwhile discovered != []\nn = discovered.pop\nif !(visited.include?(n))\nvisited.push(n)\nsuccessor = get_transition(n, \"\")\nif successor != nil\nsuccessor.each{|s|\nif !(visited.include?(s))\ndiscovered.push(s)\nend\n}\nend\nend\nend\nvisited\nend",
"def state_next_gen(matrix,next_matrix,x,y)\r\n #Get number of neighbors\r\n matrix[[x,y]].get_neighbor(matrix)\r\n #Rules for live cells\r\n if matrix[[x,y]].state==1\r\n if matrix[[x,y]].live_neighbor<2||matrix[[x,y]].live_neighbor>3\r\n next_matrix[[x,y]].die\r\n else next_matrix[[x,y]].live\r\n end\r\n #Rules for dead cells\r\n else\r\n if matrix[[x,y]].live_neighbor==3\r\n next_matrix[[x,y]].live\r\n else next_matrix[[x,y]].die\r\n end\r\n end\r\nend",
"def build_graph\n @matrix.each_with_index do |row, x|\n row.each_with_index do |move, y|\n move = Coordinate.new(x,y)\n @matrix[x][y] = possible_moves(move)\n end\n end\n\tend",
"def solve_stupid\n nodes_num.times.collect{|node_num| make_wave(node_num) }.min\n end",
"def solve jug_sizes, starting_state, has_drain, has_source\n if !block_given? \n raise \"Solve must be called with a block that checks a state (array of jug fill states) if it is a winning state.\"\n end\n\n if jug_sizes.length != starting_state.length \n raise \"The jug sizes array and starting state array must have the same length (i.e. for each jug there must be a size and fill state)\"\n end\n\n seen_states=[starting_state].to_set\n states_to_process = [[[], starting_state]]\n\n while states_to_process.length > 0\n state_to_process = states_to_process.delete_at(0)\n puts \"Processing state #{state_to_process[1]}...\"\n if yield(state_to_process[1]) \n puts \" problem solved.\"\n return state_to_process[0] \n end\n\n state=state_to_process[1]\n steps=state_to_process[0]\n\n for from in 0..jug_sizes.length-1\n for to in 0..jug_sizes.length-1\n next if from==to\n next if state[from]==0\n next if state[to]==jug_sizes[to]\n\n new_state=state[0..-1]\n if state[from] + state[to] > jug_sizes[to]\n new_state[to] = jug_sizes[to]\n poured_amount = jug_sizes[to] - state[to]\n new_state[from] = state[from] - poured_amount\n else\n new_state[to] = state[from] + state[to]\n new_state[from] = 0\n end\n\n puts \" after pouring from #{from} to #{to} reached #{new_state}.\"\n if !seen_states.include?(new_state)\n seen_states.add(new_state)\n new_steps = steps[0..-1]\n new_steps << \"#{from} -> #{to}\"\n states_to_process << [new_steps, new_state]\n end\n end\n end\n\n if has_drain \n for target in 0..jug_sizes.length-1\n new_state=state[0..-1]\n new_state[target]=0 \n puts \" after draining from #{target} reached #{new_state}.\"\n if !seen_states.include?(new_state)\n new_steps = steps[0..-1]\n new_steps << \"#{target} -> DRAIN\"\n states_to_process << [new_steps, new_state]\n end\n end\n end\n\n if has_drain \n for target in 0..jug_sizes.length-1\n new_state=state[0..-1]\n new_state[target]=jug_sizes[target]\n puts \" after filling #{target} reached #{new_state}.\"\n if !seen_states.include?(new_state)\n new_steps = steps[0..-1]\n new_steps << \"SOURCE -> #{target}\"\n states_to_process << [new_steps, new_state]\n end\n end\n end \n end\n\n raise \"No solution found.\"\nend",
"def aStar(tx = @player.x/@TILESIZE, ty = @player.y/@TILESIZE, x = @x/@TILESIZE, y = @y/@TILESIZE)\n #exit conditions\n if tx > @map.WIDTH or ty > @map.HEIGHT or tx < 0 or ty < 0\n return Node.new(x, y, nil, 0)\n end\n start = Time.now\n evald = Array.new #nodes that have already been evaluated\n queue = [Node.new(x, y, 0)]#the last element is the g value\n until queue.empty?\n #queue.each{ |q| print q.toArray, \"...\"}\n #print \"\\n\" #for debugging\n current = queue[0]#finds the node in queue with the lowest f value\n queue.each do |q|\n current = q if q.f(tx, ty) < current.f(tx, ty)\n end\n evald.push(current)#move current from 'queue' to 'evald'\n queue.delete(current)\n #direction from the second node aka the one after the one the ghost is at\n if current.x == tx and current.y == ty\n current.trim\n return current\n #print \"the ghost is confused\\n\" # for debugging\n end\n @map.getSurrounding(current.x, current.y, false).each{ |n|\n node = Node.toNode(n)\n node.g= current.g + 1\n node.parent= current\n nodeInEvald = false\n evald.each{ |evNode|\n if(evNode.coords == node.coords)\n if(evNode.g > node.g)\n evNode.g = node.g\n evvNode.dir = node.dir\n end\n nodeInEvald = true\n break\n end\n }\n if !nodeInEvald\n queue.push(node) \n end\n }\n #just gives up if it's been trying to find a path for more than 5 seconds\n if Time.now - start > 5\n current.trim\n current.timeOut = true;\n return current\n end\n end\n nil\n end",
"def test_step_on_examples\n assert_equal([], @small_dfa.step(0,'b'))\n @small_dfa.each_state do |s|\n s.out_edges.each do |e|\n assert_equal([e.target], @small_dfa.step(s,e.symbol))\n end\n end\n\n assert_equal([], @small_nfa.step(0, 'b'))\n assert_equal(@small_nfa.ith_states(1), @small_nfa.step(0, 'a'))\n assert_equal(@small_nfa.ith_states(2,3), @small_nfa.step(1, 'b'))\n assert_equal(@small_nfa.ith_states(1), @small_nfa.step(1, nil))\n end",
"def next_nodes\n transitions.map(&:target)\n end",
"def render_unvisited\n outputs.solids << scale_up(grid.rect).merge(unvisited_color)\n outputs.solids << move_and_scale_up(grid.rect).merge(unvisited_color)\n end",
"def generate_graph\n end",
"def move_to_next_generation\n @x.times{ |r|\n @y.times{|c| \n @mat[r][c].step_generation\n }\n } \n end",
"def minimize; end",
"def closure!\ns0 = new_state\ns1 = new_state\nadd_transition(s0, @start, \"\")\n# reset the final states of the current object\nkeys = @final.keys\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\nset_final(keys[i], false)\ni = i + 1\nend\nadd_transition(s0, s1, \"\")\nadd_transition(s1, s0, \"\")\nset_start(s0)\nset_final(s1, true)\nend",
"def add_transition(v1, v2, x)\nadd_state(v1)\nadd_state(v2)\nif @transition[v1][x] == nil\n@transition[v1][x] = Array.new\nend\n@transition[v1][x].push(v2)\nend",
"def solve\n # 1\n generation = Generation.new(@starting_paths)\n\n # 2\n while !generation.target_reached?\n generation = generation.next\n end\n\n # 3\n message = \"Maze description : going from #{@source} to #{@target}\\n\"\n message << generation.to_s\n Renderer.result(message)\n end",
"def a_star pitch, start, goal\n\t\t# The set of nodes already evaluated.\n\t\tclosedset = []\n\t\t# The set of tentative nodes to be evaluated.\n\t\topenset = []\n\t\t# Visited nodes\n\t\tfrontier = []\n\t\topenset << start\n\t\t# The map of navigated nodes.\n\t\tcame_from = { }\n\t\t# Distance from start along optimal path.\n\t\tg_score, h_score, f_score = { }, { }, { }\n\t\tg_score[start] = 0\n\t\th_score[start] = dist start, goal, :manhattan\n\t\t# Estimated total distance from start to goal through y.\n\t\tf_score[start] = h_score[start]\n\n\t\t# Main loop\n\t\twhile not openset.empty?\n\t\t\t# Fetching the node among openset with the least f_score\n\t\t\tx, _value = [], 1_000_000\n\t\t\topenset.each do |key|\n\t\t\t\tx, _value = key, f_score[key] if f_score[key] < _value\n\t\t\tend\n\n\t\t\tbreak if x == goal # We reached target point and thus finished looking for it !!\n\n\t\t\t# Moving x from openset to closedset\n\t\t\topenset.delete x\n\t\t\tclosedset << x\n\n\t\t\t(-1..1).each do |i|\n\t\t\t\t(-1..1).each do |j|\n\t\t\t\t\ty = [x[0] + i, x[1] + j]\n\t\t\t\t\tunless i == 0 and y == 0\n\t\t\t\t\t\tif pitch[y].nil? # We only want to explore neighbours\n\t\t\t\t\t\t\tnext if closedset.include? y # If already in closedset, we skip it\n\n\t\t\t\t\t\t\tbetter = false\n\t\t\t\t\t\t\th = dist x, y, :manhattan\n\t\t\t\t\t\t\tg = g_score[x] + h\n\n\t\t\t\t\t\t\tif not openset.include? y then\n\t\t\t\t\t\t\t\treturn [] if frontier.include? y\n\t\t\t\t\t\t\t\tfrontier << y\n\t\t\t\t\t\t\t\topenset << y # Adding current neighbours to openset\n\t\t\t\t\t\t\t\tbetter = true\n\t\t\t\t\t\t\telsif g < g_score[y]\n\t\t\t\t\t\t\t\tbetter = true\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tbetter = false\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# Updating what needs to be\n\t\t\t\t\t\t\tif better then\n\t\t\t\t\t\t\t\tcame_from[y] = x\n\t\t\t\t\t\t\t\tg_score[y] = g\n\t\t\t\t\t\t\t\th_score[y] = dist y, goal, :manhattan # heuristic estimate of distance (y, coords)\n\t\t\t\t\t\t\t\tf_score[y] = g_score[y] + h_score[y]\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# Finally assembling path and returning it\n\t\tpath = []\n\t\t_cur = goal\n\t\twhile _cur != start do\n\t\t\tpath << _cur\n\t\t\t_cur = came_from[_cur]\n\t\tend\n\n\t\treturn path.reverse\n\tend",
"def test_dfa_step_on_examples\n assert_equal(nil, @small_dfa.dfa_step(0,'b'))\n @small_dfa.each_state do |s|\n s.out_edges.each do |e|\n assert_equal(e.target, @small_dfa.dfa_step(s,e.symbol))\n end\n end\n end",
"def main_transition\r\n Graphics.transition(120)\r\n end",
"def complete_graph(n)\n set = (Integer === n) ? 1..n : n\n RGL::ImplicitGraph.new do |g|\n g.vertex_iterator { |b| set.each(&b) }\n g.adjacent_iterator do |x, b|\n set.each { |y| b.call(y) unless x == y }\n end\n end\nend",
"def closure! \n\t\ttemp = new_state\n\t\tadd_transition(temp, @start, \"\")\n\t\t@start = temp\n\t\ttemp = new_state\n\t\t@final.keys.sort.each { |x| \n\t\tadd_transition(x, temp, \"\") \n\t\tset_final(x, false) }\n\t\t\n\t\t@final = {temp=>true}\n\t\tadd_transition(@start, temp, \"\")\n\t\tadd_transition(temp, @start, \"\")\n\t\t@state.delete(nil)\n\t\t@transition.delete(nil)\n end",
"def feedback_arc_set_step0(graph)\n fas = []\n each_cyclic_strongly_connected_component_graph(graph) do |scc|\n scc.keys.sort.each do |n| # demand determinism\n vs = scc[n] or next\n vs.size > 0 or next\n vs.sort! # demand determinism\n fas << [n, vs.shift]\n break\n end\n end\n fas\n end",
"def star; end",
"def extract_valid_transitions\r\n transitions_in_model=Array.new\r\n \t\tself.adjacency_matrix.each_key do |a_state|\r\n\t\t\t if self.adjacency_matrix[a_state].length == 0\r\n\t\t\t \t\t\t # Ignore if no actions, as this is not a transition, just a dead end\r\n else\r\n \t self.adjacency_matrix[a_state].each do |a_transition|\r\n \t transitions_in_model.push a_transition\r\n \tend # end each \t\r\n end # end else\r\n end # end each key\r\n\r\n return transitions_in_model\r\n end",
"def check_for_implication_loops\n # actually this is tricky\n end",
"def inf_label(g)\n @unlabeled_v.each do |u| \n no_follower_labeled_i = true\n g.adjacent_vertices(u).each do |v|\n\tno_follower_labeled_i = false if @l[v] == @i.to_s\n end # do\n set_label(u,'inf') if no_follower_labeled_i\n end # do\n end",
"def transition\n newMap = []\n for x in 0...@map.length do\n for y in 0...@map[x].length do\n if !newMap[x]\n newMap[x] = []\n end\n if !newMap[x][y]\n newMap[x][y] = @map[x][y]\n end\n numAlive = neighbors(x, y).reduce(0) { |a, c| c == 1 ? a + 1 : a }\n if numAlive < 2\n newMap[x][y] = 0 # death by under population\n elsif numAlive > 3\n newMap[x][y] = 0 # death by over population\n elsif @map[x][y] == 0 and numAlive == 3\n newMap[x][y] = 1 # alive by reproduction\n end\n end\n end\n @map = newMap\n end",
"def reduce_graph( states )\n @graph.delete_if do |state, neighbours|\n neighbours.delete_if { |neighbour| !states.include?(neighbour) }\n !states.include?(state)\n end\n end",
"def mark_unreachable_symbols\n # Mark all non-terminals as unreachable\n start_vertex_for.each_value do |a_vertex|\n a_vertex.non_terminal.unreachable = true\n end\n\n # Now traverse graph from start vertex of graph\n # and mark all visited non-terminals as reachable\n traverse_df(start_vertex) do |a_vertex|\n # print_vertex(' Visiting', a_vertex)\n if a_vertex.kind_of?(StartVertex)\n a_vertex.non_terminal.unreachable = false\n end\n end\n end",
"def step_through_iterative_division_maze_generator(grid, state)\n unless state[:finished_init]\n draw_canvas_border(grid)\n state[:finished_init] = true\n end\n new_chamber = divide(grid, state[:current_chamber])\n if new_chamber\n state[:current_chamber] = new_chamber[0]\n state[:todo_chamber].push(new_chamber[1])\n elsif !state[:todo_chamber].empty?\n state[:current_chamber] = state[:todo_chamber].pop\n elsif !state[:generation_complete]\n state[:generation_complete] = true\n end\nend",
"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 steps_before_repeat_state_naive\n\t\t# state = {}\n\t\tsteps = 0\n\t\torig = @moons_pos.to_s\n\t\tzero_vel = [0, 0, 0]\n\t\tstarting_time = Time.now\n\t\tp @moons_pos\n\t\twhile (42)\n\t\t\tsleep(1)\n\t\t\t# state.has_key?(@moons_pos.to_s) ? break : state[@moons_pos.to_s] = true\n\n\t\t\tapply_gravity_to_velocity\n\t\t\tapply_velocity_to_position\n\t\t\tsteps += 1\n\t\t\tp @moons_pos\n\t\t\tbreak if velocity(:io) == zero_vel && @moons_pos.to_s == orig\n\t\tend\n\t\tsteps\n\tend",
"def one_level\n improvement = false\n nb_passes = 0\n cur_mod = @graph.modularity\n new_mod = cur_mod\n begin\n cur_mod = new_mod\n nb_moves = 0\n nb_passes += 1\n @graph.nodes.shuffle.each do |node|\n orig_community = @graph.get_community node\n\n neighbour_communities = @graph.get_neighbour_comms node\n\n @graph.remove_node node, orig_community\n\n\n best_community = orig_community\n max_gain = 0.0\n\n neighbour_communities.each do |comm|\n mod_gain = @graph.modularity_gain node, comm\n if mod_gain > max_gain\n max_gain = mod_gain\n best_community = comm\n end\n end\n if best_community != orig_community\n nb_moves += 1\n improvement = true\n end\n\n @graph.insert_node node, best_community\n\n @graph.garbage_collect orig_community\n\n end\n new_mod = @graph.modularity\n end while nb_moves > 0 and new_mod - cur_mod >= MIN_INCREASE\n return improvement\n end",
"def main_transition\r\n Graphics.transition\r\n end",
"def initSource(source)\n\t\tfor i in 0..(@graph.size - 1) do\n\t\t\tif @graph[i].node == source\n\t\t\t\t@graph[i].distance = 0\n\t\t\t\tbreak\n\t\t\tend \n\t\tend\n\tend",
"def flamegraph_mode; end",
"def flamegraph_mode=(_arg0); end",
"def starting_nodes(graph)\n graph.nodes.select { |node| node.incoming_edges.empty? }\n end",
"def condensation\n sc = strong_components\n cg = DirectedMultiGraph.new\n map = sc.inject({}) do |a,c| \n c.each {|v| a[v] = c }; a\n end\n sc.each do |c|\n c.each do |v|\n adjacent(v).each {|v1| cg.add_edge!(c, map[v1]) unless cg.edge?(c, map[v1]) }\n end\n end; \n cg\n end",
"def eps_closure(stateSet)\n stk = stateSet.to_a\n while !stk.empty?\n s = stk.pop\n s.edges.each do |lbl,dest|\n if lbl.contains? EPSILON\n if stateSet.add?(dest)\n stk.push(dest)\n end\n end\n end\n end\n end",
"def converge(state) ; end",
"def apply_kruskal\r\n #sort the edges by its time-distance (sec)\r\n #then go over each edge, check if its borders vertices belong to the same group, if not , connect it,\r\n #groups are the lowest id\r\n\r\n edges_counter=0\r\n\r\n #1. sort edges\r\n @valid_edges.sort! { |a,b| a.time_distance <=> b.time_distance }\r\n\r\n #2. initialize head and inks nodes. each is his own head and points to null. (we maintaint information only for the selected ones (saving))\r\n @valid_vertices.each do |n|\r\n n.set_node_head_mst(n.osm_id)\r\n n.set_node_tail_mst(n.osm_id)\r\n #puts \"#{n.osm_id}, #{n.mst_head} \"\r\n end\r\n\r\n #3. go over valid (filtered)edges, join if possible. lower id will always be n1\r\n @valid_edges.each do |e|\r\n #lower id to be first of the selected two nodes\r\n if e.osm_from<e.osm_to\r\n then\r\n n1osm=e.osm_from\r\n n2osm=e.osm_to\r\n else\r\n n1osm=e.osm_to\r\n n2osm=e.osm_from\r\n end\r\n\r\n #get object, its current head and next\r\n n1=@nodes_hash[n1osm]\r\n n2=@nodes_hash[n2osm]\r\n n1_head_osm=n1.mst_head\r\n n2_head_osm=n2.mst_head\r\n\r\n #4. if the head1 != head2, nodes can be connected and marked bold red\r\n if n1_head_osm != n2_head_osm\r\n #mark the edge as bold\r\n e.set_bold\r\n edges_counter=edges_counter + 1\r\n\r\n #get head object of both lists\r\n n1_tail_osm=n1.mst_tail\r\n n2_tail_osm=n2.mst_tail\r\n n1_head=@nodes_hash[n1_head_osm]\r\n n1_tail=@nodes_hash[n1_tail_osm]\r\n\r\n #join two lists (if they are lists)\r\n #puts \"n1: H1:#{n1_head.mst_head} T1:#{n1_head.mst_tail} H1N:#{n1_head.mst_next} ## n2: H2:#{n2Head.mst_head} T2:#{n2Head.mst_tail} H2N:#{n2Head.mst_next}\"\r\n n1_tail.set_next_node_mst(n2_head_osm)\r\n n1_head.set_node_tail_mst(n2_tail_osm)\r\n\r\n #fix links to head and tail on all their children\r\n child_node_osm=n1_head.mst_next\r\n until child_node_osm==-1 do\r\n child_node=@nodes_hash[child_node_osm]\r\n child_node.set_node_head_mst(n1_head_osm)\r\n child_node.set_node_tail_mst(n2_tail_osm)\r\n child_node_osm=child_node.mst_next\r\n end\r\n\r\n #puts \"n1: H1:#{n1_head.mst_head} T1:#{n1_head.mst_tail} H1N:#{n1_head.mst_next} ## n2: H2:#{n2Head.mst_head} T2:#{n2Head.mst_tail} H2N:#{n2Head.mst_next}\"\r\n end\r\n end\r\n\r\n #validations\r\n\r\n puts \"Validation error. In mst should be less edges then vertices\" if @valid_vertices.length <= edges_counter\r\n puts \"Validation passed. Minimum spanning tree has less edges (#{edges_counter}) than vertices (#{@valid_vertices.length}). Graph has more components. \" if @valid_vertices.length > edges_counter+1\r\n puts \"Validation passed. Minimum spanning tree has one edge less (#{edges_counter}) than vertices (#{@valid_vertices.length}). Graph has one component. \" if @valid_vertices.length == edges_counter+1\r\n end",
"def DFS_solution\n\n\t\t# Checking if I got the final solution\n\t\tif @graph.solution?\n\t\t\tif DEBUG\n\t\t\t\tputs \"Solution found:\\n#{@graph.plot_graph}\"\n\t\t\tend\n\t\t\treturn 0\n\t\tend\n\n\t\t# If not i'll find which are the possible next actions from this state\n\t\t# and iterates on them.\n\t\tresult = -1\n\t\t@graph.find_next_actions\n\t\tif DEBUG\n\t\t\tputs \"Un-A -> #{@graph.get_current_node.get_unexplored_actions}\"\n\t\tend\n\t\t# TODO Make this correct, i am skipping a level in the structures\n\t\t@graph.get_current_node.get_unexplored_actions.each do |i|\n\t\t\t# I have to create a new node starting from the current one and \n\t\t\t# knowing the action we have chosen\n\t\t\t@graph.next_state( i )\n\t\t\tresult = self.DFS_solution\n\t\t\t# With break I have to pass over all the calls in the recursive\n\t\t\t# stack, with return it skips all these steps.\n\t\t\t# break if result == 0\n\t\t\treturn 0 if result == 0\n\t\tend\n\n\t\t# If I get here means that with this configuration I will not get to a\n\t\t# solution, so I have to delete what I did in this step.\n\t\t# I'll delete the last positioned Queen, replacing it with a nil.\n\t\tunless result == 0\n\t\t\tif DEBUG\n\t\t\t\tputs \"BACKWARD!\"\n\t\t\tend\n\t\t\t@graph.delete_last_action\n\t\t\treturn -1 \n\t\tend\n\n\tend",
"def infinite_loops\n reachable_sets = @nodes.group_by(&:forward)\n reachable_sets.each do |reachable,nodes|\n yield reachable if reachable == nodes.to_set\n end\n end",
"def test_next_state_is_different\n init_state = @game.build_graph\n refute_equal(init_state, @game.get_next_state(init_state))\n end",
"def choose_next_vertex_and_determine_whether_to_pause()\n # Hint 2: http://urls.softf1.com/a1/krl/frag3/\n kibuvits_throw(\"This method is expected to be overridden.\")\n end",
"def astar(maze, start, last)\n\n #Cria node inicial\n start_node = Node.new(parent = nil, position = start)\n\n start_node.g = 0\n start_node.h = 0\n start_node.f = 0\n\n #Cria node final\n end_node = Node.new(parent =nil, position =last)\n\n end_node.g = 0\n end_node.h = 0\n end_node.f = 0\n\n #Inicializa lista de nodes visitados\n open_list = []\n\n #inicializa lista closed\n closed_list = []\n\n # Adiciona o node inicial na open list\n open_list.push(start_node)\n\n #Loop enquando nao encontra no final\n while open_list.length > 0\n\n #Pega node sendo analizado no momento, tem que ser o node com o menor f\n current_node = open_list[0]\n current_index = 0\n\n open_list.each_with_index do |item, index|\n if item.f < current_node.f\n current_node = item\n current_index = index\n end\n end\n\n #Retira node analizado no momento da open list\n open_list.delete_at(current_index)\n #Retira node analizado no momento da closed list\n closed_list.push(current_node)\n\n #Verifica se encontrou o no final\n if current_node.position == end_node.position\n path = []\n current = current_node\n\n while current != nil\n path.push(current.position)\n current = current.parent\n end\n\n return path.reverse\n\n end\n\n #Gera os vizinhos do node atual\n children = []\n\n [[0, -1], [0, 1], [-1, 0], [1, 0]].each { |new_position|\n #percorre uma coluna OU uma linha por vez\n node_position = [current_node.position[0] + new_position[0], current_node.position[1] + new_position[1]]\n\n #verifica se o vizinho nao ultrapassa a borda da matriz\n if node_position[0] > (maze.length - 1) || node_position[0] < 0 || node_position[1] > (maze[maze.length - 1].length - 1) || node_position[1] < 0\n next\n end\n\n #verifica se o vizinho se encontra na rua\n if maze[node_position[0]][node_position[1]] != 0\n next\n end\n\n\n new_node = Node.new(current_node, node_position)\n children.push(new_node)\n\n }\n\n #Loop entre os vizinhos\n children.each { |child|\n #Verifica se o vizinho esta na closed list\n closed_list.each { |closed_child|\n if child.position == closed_child.position\n next\n end\n }\n\n #Cria os valores f, g e h para a funcao f = g + h, sendo h a heuristica\n child.g = current_node.g + 1\n child.h = ((child.position[0] - end_node.position[0]) ** 2) + ((child.position[1] - end_node.position[1]) ** 2)\n child.f = child.g + child.h\n\n #Se o vizinho ja esta na open list\n open_list.each { |open_node|\n if child.position == open_node.position && child.g > open_node.g\n next\n end\n }\n\n #Adiciona o vizinho na open list\n open_list.push(child)\n }\n\n end\n\nend",
"def create_sub_graph(spec_edges, move_dist = nil)\n # declare locals\n time = Time.now\n m = $game_map\n map_width,map_height = m.width, m.height\n MoveUtils.init_ev_passables\n \n if !move_dist\n dist = spec_edges[:move] ||= TactBattleManager::Defaults::Move\n else\n dist = move_dist\n end\n \n x_low = x_high = y_low = y_high = nil\n if @source\n x_low, x_high = [@source.x-dist, 0].max, [@source.x+dist,map_width-1].min\n y_low, y_high = [@source.y-dist, 0].max, [@source.y+dist,map_height-1].min \n else\n x_low, x_high = 0, [dist,map_width-1].min\n y_low, y_high = 0, [dist,map_height-1].min\n end\n \n @jump_time = 0\n @optim_cache = {}\n x_low.upto(x_high).each do |x|\n y_low.upto(y_high).each do |y|\n expand_graph_adj(v=Vertex.new(x,y, m.terrain_tag(x,y)), spec_edges[:pass])\n add_adjacent_jumpables(v.x,v.y,dist,spec_edges)if spec_edges[:jump_length]>0\n end\n end\n self\n end",
"def test_new_not_on_self\n Automaton.new(false) do |fa|\n fa.add_state(:initial => true)\n fa.add_state(:accepting => true)\n fa.connect(0,1,'a')\n fa.connect(1,0,'b')\n end\n end",
"def start_transition\n nil\n end",
"def union! newFA\ns0 = new_state\ns1 = new_state\nadd_transition(s0, @start, \"\")\nadd_transition(s0, newFA.get_start, \"\")\n# reset the final states of the current object\nkeys = @final.keys\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\nset_final(keys[i], false)\ni = i + 1\nend\n# set the final states of the other object\nkeys = newFA.get_final\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\ni = i + 1\nend\n# copy over the states\nkeys = newFA.get_state\ni = 0\nwhile i < keys.size\nadd_state(keys[i])\ni = i + 1\nend\n# copy over the transitions\nnewFA.get_trans_hash.keys.sort.each { |v1|\nnewFA.get_trans_hash[v1].keys.sort.each { |x|\nv2 = newFA.get_transition(v1,x)\ni = 0\nwhile i < v2.size\nadd_transition(v1, v2[i], x)\ni = i + 1\nend\n}\n}\nset_start(s0)\nset_final(s1, true)\n# copy over the alphabets\nnewFA.get_alpha.each{|a|\nif @alphabet.include?(a) == false\n@alphabet.push(a)\nend\n}\nend",
"def selected_next_edges\n @next_summit = @edges_distances.select{ |edges| edges.include?(@next_summit.first.select{ |distance| distance > 0}.min)if edges != @next_summit && edges != @first_position }\n end",
"def minimize\n\t\tdfa = DFA.new\n\t\tif @alphabet.empty?\n\t\t\treturn self\n\t\tend\n\t\taccept = @final.keys\n\t\treject = @state.keys - accept\n\t\t#print \"Accept { \" + accept.join(\", \").to_s + \" }\\n\"\n\t\t#print \"Reject { \" + reject.join(\", \").to_s + \" }\\n\"\n\t\tcounter = @@nextID\n\t\ta = counter\n\t\tif(!reject.empty?)\n\t\t\tcounter+=1\n\t\tend\n\t\tb = counter\n\t\tsymbol = nil\n\t\tdestination = nil\n\t\t\n\t\tif(!reject.empty?)\n\t\t\tdfa.state_rep[a] = reject\n\t\t\tdfa.state_rep[b] = accept\n\t\telse\n\t\t\tdfa.state_rep[a] = accept\n\t\tend\n\t\t\t\n\t\tstack = Array.new\n\t\tstack.push a\n\t\tstack.push b\n\t\tpartitions = Array.new\n\t\t#dfa.prettyPrint\n\t\twhile(partitions != stack)\n\t\t\tpartitions = stack\n\t\t\tstack = Array.new\n\t\t\t#puts \"Part: \" + partitions.to_s + \"stak: \" + stack.to_s\n\t\t\t#print \"R = {\" + partitions.join(\", \").to_s + \"}\\n\"\n\t\t\tpartitions.flatten.each{ |p|\n\t\t\t\t#print \"Split partition: { \" + dfa.state_rep[p].join(\", \").to_s + \" }\\n\"\n\t\t\t\tdfa.state_rep[p], temp = split(dfa.state_rep[p], dfa.state_rep)\n\t\t\t\t#print p.to_s + \" now contains: { \" + dfa.state_rep[p].join(\", \").to_s + \" }\\n\"\n\t\t\t\t#print \"Temp: { \" + temp.join(\", \").to_s + \" }\\n\"\n\t\t\t\tif(!temp.empty?)\n\t\t\t\t\tcounter+=1\n\t\t\t\t\tc = counter\n\t\t\t\t\tstack.push p\n\t\t\t\t\tstack.push c\n\t\t\t\t\t#print c.to_s + \" now contains { \" + temp.join(\", \").to_s + \" }\\n\"\n\t\t\t\t\t#dfa.prettyPrint\n\t\t\t\t\tdfa.state_rep[c] = temp\n\t\t\t\tend\n\t\t\t\tdfa.state_rep.keys.each { |state|\n\t\t\t\t\tdfa.clear_trans(state)\n\t\t\t\t\tdfa.state_rep[state].each { |stuffs|\n\t\t\t\t\t@alphabet.each{ |c|\n\t\t\t\t\t\tdest = get_transition(stuffs, c)\n\t\t\t\t\t\tif dest != nil\n\t\t\t\t\t\t\tparks = dfa.state_rep.keys.dup\n\t\t\t\t\t\t\tparks.each{ |place|\n\t\t\t\t\t\t\t\tif dfa.state_rep[place].include?(dest)\n\t\t\t\t\t\t\t\t\t#puts \"adding (\" + state.to_s + \" \" + c.to_s + \" \" + place.to_s + \"\\n\" \n\t\t\t\t\t\t\t\t\tdfa.add_transition(state, place, c)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t#end\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#print dfa.state.to_s + \"\\n\"\n\t\t\t\t#puts \"-------------------------------\"\n\t\t\t}\n\t\t\t#puts \"Part: \" + partitions.to_s + \"stak: \" + stack.to_s\n\t\tend\n\t\tdfa.state.keys.each{ |parts|\n\t\t\tresult = 0\n\t\t\tis_start = 0\n\t\t\t#puts parts\n\t\t\tdfa.state_rep[parts].each { |state|\n\t\t\t\tif(is_final?(state))\n\t\t\t\t\tresult = 1\n\t\t\t\tend\n\t\t\t\tif(state == @start)\n\t\t\t\t\tis_start = 1\n\t\t\t\tend\n\t\t\t\t}\n\t\t\tif result == 1\n\t\t\t\tdfa.set_final(parts)\n\t\t\tend\n\t\t\tif(is_start == 1)\n\t\t\t\tdfa.set_start(parts)\n\t\t\tend\n\t\t}\n\t\tdfa\n end",
"def parse(&block)\n super\n\n unless starting_state\n raise ArgumentError, \"no starting state defined\"\n end\n\n # Validate that all source states in transitions are reachable\n # from the start state\n unreachable = compute_unreachable_states\n unless unreachable.empty?\n raise UnreachableStateUsed.new(unreachable),\n \"#{unreachable.size} states are used in transitions \"\\\n \"but are actually not reachable\"\n end\n end",
"def draw_graph\n @graph = Array.new((2 * (self.down) + 1)){Array.new((2 * (self.across) + 1),\"\")}\n for i in 0..(2 * (self.down)) do\n for j in 0..(2 * (self.across)) do\n plane[i][j] == 1? graph[i][j] = '*': graph[i][j] = ' '\n end\n end\n end",
"def reachable\n @vertices.each do |vk, is_up|\n if is_up\n print \"#{vk}\\n\"\n if @edges_up[vk]\n @edges_up[vk].each do |ek, up_too|\n if up_too\n print \" #{ek}\\n\"\n end\n end\n end\n end\n end\n end",
"def transitions\n [\n {:parked => :idling, :on => :ignite},\n {:idling => :first_gear, :first_gear => :second_gear, :on => :shift_up}\n # ...\n ]\n end",
"def directed?() false; end",
"def epsilon_closure(state_set)\n visited_states = Set.new()\n unvisited_states = state_set\n begin\n epsilon_transitions = @transitions.select { |t| t.accept?(Transition::Epsilon) && unvisited_states.include?(t.from) }\n destination_states = epsilon_transitions.map(&:to).to_set\n visited_states.merge(unvisited_states) # add the unvisited states to the visited_states\n unvisited_states = destination_states - visited_states\n end until unvisited_states.empty?\n visited_states\n end",
"def toDFA\n # create a new one, or modify the current one in place,\n # and return it\n dfa = DFA.new\n\t\tstack = []\n\t\tstack.push eClosure(@start)\n\t\t#print \"R = {\" + stack.join(\", \").to_s + \"}\\n\"\n\t\tpainted = []\n\t\tcounter = @@nextID\n\t\twhile(!stack.empty?)\n\t\t\ttemp = stack.pop\n\t\t\tpainted.push temp\n\t\t\t#print \"Painted = {\" + painted.join(\", \").to_s + \"}\\n\"\n\t\t\tb = counter\n\t\t\tif(!dfa.state_rep.has_value?(temp))\n\t\t\t\tb = counter\n\t\t\t\tdfa.state_rep[b] = temp\n\t\t\telse\n\t\t\t\tb = dfa.state_rep.index(temp)\n\t\t\tend\n\t\t\t\n\t\t\tif(dfa.start==nil)\n\t\t\t\tdfa.set_start(b)\n\t\t\t\tend\n\t\t\tif temp.is_a?(Array)\n\t\t\t\ttemp.each{|fin|\n\t\t\t\tif(is_final?(fin))\n\t\t\t\t\tdfa.set_final(b)\n\t\t\t\tend\n\t\t\t\t}\n\t\t\telsif(is_final?(temp) && !dfa.is_final?(temp))\n\t\t\t\tdfa.set_final(b)\n\t\t\tend\n\t\t\t@alphabet.sort.each{|a|\n\t\t\t\ts = move(temp,a)\n\t\t\t\t#print \"Move (\" + temp.join(\", \").to_s + \",\" + a + \") = {\" + s.join(\", \").to_s + \"}\\n\"\n\t\t\tif (!s.empty?)\n\t\t\t\te = eClosure(s)\n\t\t\t\t#print \"e = {\" + e.join(\", \").to_s + \"}\\n\"\n\t\t\t\tc = counter\n\t\t\t\tif(!dfa.state_rep.has_value?(e))\n\t\t\t\t\tcounter+=1\n\t\t\t\t\tc = counter\n\t\t\t\t\tdfa.state_rep[c] = e\n\t\t\t\telse\n\t\t\t\t\tc = dfa.state_rep.index(e)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif(!painted.include?(e))\n\t\t\t\t\tstack.push e\n\t\t\t\t\t#print \"stack = {\" + stack.join(\", \").to_s + \"}\\n\"\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tdfa.add_transition(b, c, a)\n #puts \"transition (#{b} #{a} #{c})\" \n\t\t\t\t#puts \"-------------------------\"\n\t\t\t\te.flatten.each{ |f|\n\t\t\t\tif(is_final?(f) && !dfa.is_final?(f))\n\t\t\t\t\tdfa.set_final(c)\n\t\t\t\tend\n\t\t\t\t}\n\t\t\tend\n\t\t\t\t}\n\t\tend\n\t\tdfa\n end",
"def omit_degree_2_nodes\r\n # add all nodes into a queue\r\n # queue = put all nodes from @nodes into the queue\r\n # puts \"#{@vertices}\"\r\n queue = Queue.new\r\n @vertices.each do |node|\r\n queue << node\r\n end\r\n\r\n # iterate through all nodes until queue is not empty\r\n while ! queue.empty?\r\n # take the first node number from the queue\r\n # i = queue.deque()\r\n # take the first node itself\r\n node=queue.pop\r\n\r\n # puts \"osm_id=#{node.osm_id} degree=#{node.degree}\"\r\n # puts \"node neighbours #{node.neighbours}\"\r\n # do anything only iff this node's degree == 2\r\n if node.degree == 2\r\n # take the node's neighbours and the two edges going from the node\r\n # we would like to shrink these two edges into only one while isolating\r\n # the _node_\r\n v1_nr = node.neighbours[0]\r\n e1_nr = node.edges[0]\r\n v2_nr = node.neighbours[1]\r\n e2_nr = node.edges[1]\r\n\r\n #puts \"actual node: #{node.osm_id} , actual neighbours #{v1_nr} , #{v1_nr}\"\r\n #puts \"neigbours of #{node.osm_id}: #{v1_nr.osm_id} #{v2_nr.osm_id}\" if (node.neighbours.length==2)\r\n next if node.neighbours.length!=2\r\n\r\n # IMPORTANT!\r\n # however, if there was a cycle, which means that the node's neighbours\r\n # ARE already connected, do nothing and leave this degree-2-node _i_ as\r\n # it is!\r\n\r\n #puts \"are connected #{v1_nr}, #{v2_nr} of #{node.osm_id}?\"\r\n next if are_connected(v1_nr, v2_nr, node.osm_id)\r\n\r\n #puts \"handling #{node.osm_id} - has 2 and is not cyclic, going to delete neighbours!\"\r\n #puts \"cur_node is: #{node.osm_id}\"\r\n\r\n #puts \"# this is not needed, but just for sure: record the neighbours' degrees before the shrinkage\"\r\n #v1_deg = v1_nr.degree ; v2_deg = v2_nr.degree\r\n #puts \" -> neighbours degree: v1:#{v1_deg} v2:#{v2_deg}\"\r\n\r\n #puts \"# record the neighbours' OSM/id, for future use\"\r\n #v1_osm = v1_nr.osm_id ; v2_osm = v2_nr.osm_id\r\n #puts \" -> v1_osm: #{v1_osm} deg: #{v1_deg} :: v2_osm #{v2_osm} deg: #{v2_deg}\"\r\n\r\n #puts \"# invalidate the two edges -- particularly, do not output them into Graphviz output\"\r\n e1_nr.invalidate\r\n e2_nr.invalidate\r\n e_distance=e1_nr.time_distance+e2_nr.time_distance\r\n\r\n #puts \" -> invalidated edges - #{e1_nr} #{e1_nr.osm_from}-#{e1_nr.osm_to}(#{e1_nr.is_valid}) #{e2_nr} #{e2_nr.osm_from}-#{e2_nr.osm_to}(#{e2_nr.is_valid})\"\r\n #puts \"# disconnect the triple v1--i--v2, i.e. leave out the neighbours from\r\n # the nodes' own neighbours' lists\"\r\n #ns=[] ; v1_nr.neighbours.each do |n| ns << \"#{n.osm_id}\" end; puts \"old v1 neighbours : #{ns}\"\r\n #ns=[] ; v2_nr.neighbours.each do |n| ns << \"#{n.osm_id}\" end; puts \"old v2 neighbours : #{ns}\"\r\n #ns=[] ; node.neighbours.each do |n| ns << \"#{n.osm_id}\" end; puts \"old v neighbours : #{ns}\"\r\n\r\n node.disconnect_neighbour(v1_nr)\r\n node.disconnect_neighbour(v2_nr)\r\n v2_nr.disconnect_neighbour(node)\r\n v1_nr.disconnect_neighbour(node)\r\n node.invalidate\r\n\r\n #puts \"Disconnect edges from nodes\"\r\n #ns=[] ; v1_nr.edges.each do |n| ns << \"#{n.osm_from}-#{n.osm_to}(#{n.is_valid})\" end; puts \" -> old v1 neighbours : #{ns}\"\r\n #ns=[] ; v2_nr.edges.each do |n| ns << \"#{n.osm_from}-#{n.osm_to}(#{n.is_valid})\" end; puts \" -> old v2 neighbours : #{ns}\"\r\n v1_nr.disconnect_edge(e1_nr)\r\n v2_nr.disconnect_edge(e2_nr)\r\n\r\n #puts \" # create a new edge going from v1 into v2 (it does not matter in which direction, it is anyway an artificial/virtual edge\"\r\n # save this Edge into the array @edges\r\n v_nr = @vertices.length\r\n e = Edge.new(v1_nr.osm_id, v2_nr.osm_id, 0, v_nr, e1_nr.name, e1_nr.maxspeed, e1_nr.is_oneway, e_distance)\r\n\r\n #puts (\"new edge from #{v1_nr.osm_id} to #{v2_nr.osm_id}\")\r\n @edges.push(e)\r\n\r\n #puts \"#add edge to vertex\"\r\n #ns=[] ; v1_nr.edges.each do |n| ns << \"#{n.osm_from}-#{n.osm_to}(#{n.is_valid})\" end; puts \"old v1 edges : #{ns}\"\r\n #ns=[] ; v2_nr.edges.each do |n| ns << \"#{n.osm_from}-#{n.osm_to}(#{n.is_valid})\" end; puts \"old v2 edges : #{ns}\"\r\n v1_nr.add_edge(e)\r\n v2_nr.add_edge(e)\r\n\r\n #add linkeds to vetexes\r\n v1_nr.connect_neighbour(v2_nr)\r\n v2_nr.connect_neighbour(v1_nr)\r\n end\r\n end\r\n end",
"def epsilon_closure(state)\n\tstack = [state]\n\t# Runs a DFS\n\tstates = []\n\twhile stack.length != 0\n\t state = stack.pop\n\t state.next_states.each do |substate|\n\t if substate.key?(\"e\") and !states.include?(substate[\"e\"])\n\t states.push(substate[\"e\"])\n\t\t stack.push(substate[\"e\"])\n\t end\n\t end\n\tend\n\treturn states\n end",
"def transit_to_stop_iteration(e)\n if not(@inputs.empty?) or not(@generator.stream?)\n write(TupleSpace::CommandTuple.new(\"start-root-rule\", nil))\n end\n end",
"def create_knight_tour_graph(board_size)\n new_graph = Graph.new()\n board_size.times do |x|\n board_size.times do |y|\n new_graph.add_vertex([x,y])\n end\n end\n knight_legal_moves(new_graph)\n new_graph\nend",
"def closure! \n cstart = new_state\n cend = new_state\n\n add_transition(cstart, cend, \"\")\n add_transition(cend, cstart, \"\")\n\n add_transition(cstart, @start, \"\")\n @final.keys.each { |key| add_transition(key, cend, \"\")}\n\n set_start(cstart)\n @final.keys.each { |key| set_final(key, false)}\n set_final(cend, true)\n\n\n end",
"def can_walk_to?(transition); end",
"def surge; end",
"def test_state_delta_on_non_deterministic_with_epsilon\n #\n # tests on s0 -a-> s1 -a-> s2\n # with a looping nil on s1\n #\n fa, s0, s1, s2, s3, s4 = nil\n fa = Automaton.new do |fa|\n s0 = fa.add_state(:initial => true)\n s1, s2 = fa.add_state, fa.add_state\n fa.connect(s0,s1,'a')\n fa.connect(s1,s1,nil)\n fa.connect(s1,s2,'a')\n end\n assert_equal(false, fa.deterministic?)\n assert_equal([], s0.delta('b'))\n assert_equal([s1], s0.delta('a'))\n assert_equal([s2], s1.delta('a'))\n assert_equal([s1], s1.delta(nil))\n\n #\n # tests on s0 -a-> s1 -nil-> s2\n #\n fa = Automaton.new do |fa|\n s0 = fa.add_state(:initial => true)\n s1, s2 = fa.add_state, fa.add_state\n fa.connect(s0,s1,'a')\n fa.connect(s1,s2,nil)\n end\n assert_equal(false, fa.deterministic?)\n assert_equal([], s0.delta(nil))\n assert_equal([s1,s2], s0.delta('a').sort)\n assert_equal([], s1.delta('a'))\n assert_equal([s2], s1.delta(nil))\n\n #\n # tests on s0 -a-> s1 -nil-> s2 -a-> s3\n #\n fa = Automaton.new do |fa|\n s0 = fa.add_state(:initial => true)\n s1, s2, s3 = fa.add_state, fa.add_state, fa.add_state\n fa.connect(s0,s1,'a')\n fa.connect(s1,s2,nil)\n fa.connect(s2,s3,'a')\n end\n assert_equal(false, fa.deterministic?)\n assert_equal([], s0.delta(nil))\n assert_equal([s1,s2], s0.delta('a').sort)\n assert_equal([s3], s1.delta('a'))\n assert_equal([s3], s2.delta('a'))\n assert_equal([s2], s1.delta(nil))\n\n # s0 -a-> s1 -nil-> s2\n # s1 <-a- s1\n # s1<->a\n fa = Automaton.new do |fa|\n s0 = fa.add_state(:initial => true)\n s1, s2 = fa.add_state, fa.add_state\n fa.connect(s0,s1,'a')\n fa.connect(s1,s1,'a')\n fa.connect(s1,s2,nil)\n fa.connect(s2,s1,'a')\n end\n assert_equal(false, fa.deterministic?)\n assert_equal([s1,s2], s0.delta('a').sort)\n assert_equal([s1,s2], s1.delta('a').sort)\n assert_equal([s1,s2], s2.delta('a').sort)\n\n # s0 -nil-> s1 -a-> s2 -nil-> s3\n # s1 -a-> s4\n fa = Automaton.new do |fa|\n s0 = fa.add_state(:initial => true)\n s1, s2, s3, s4 = fa.add_n_states(4)\n fa.connect(s0,s1,nil)\n fa.connect(s1,s2,'a')\n fa.connect(s2,s3,nil)\n fa.connect(s1,s4,'a')\n end\n assert_equal(false, fa.deterministic?)\n assert_equal([s1], s0.delta(nil))\n assert_equal([s2,s3,s4], s0.delta('a').sort)\n assert_equal([s2,s3,s4], s1.delta('a').sort)\n end",
"def starship; end",
"def step\n any_independent = false\n net.edges.each do |e|\n a, b = e.source, e.target\n intersect = (@net.adjacent_either(a, b) & @net.verts_on_paths(a, b)).extend(PowerSet)\n \n # Is |Aab ^ Uab| > n? \n if intersect.length <= n\n next\n else\n # Are a and b independent conditioned on any subsets of Aab ^ Uab of cardinality n+1?\n valid_intersects = intersect.power_set.select {|s| s.length == n+1}.reject { |subset| subset.include?(a) || subset.include?(b) }\n if valid_intersects.any? { |subset|\n print \"Testing independence between #{a.name} and #{b.name}, conditioning on #{(subset.any? ? subset.map(&:name).join(', ') : 'nothing') + '...'}\"\n print (coindependent?(p_value, a, b, *subset) ? \"[+]\\n\" : \"[-]\\n\")\n coindependent?(p_value, a, b, *subset)\n }\n @net = remove_edge(net, e)\n net.edges.each do |e|\n puts \"#{e.source.name} => #{e.target.name}\"\n end\n any_independent = true\n end\n end\n end\n @n += 1\n any_independent\n end",
"def make_blank_graph\n ISSUE_NAMES.each_with_index {|name, i| @nodes[i] = Graph::Node.new(i, name, \"\") unless name.blank? }\n\n #testing\n #@edges[1] = Graph::Edge.new(1, @nodes[0], @nodes[3], MapvisualizationsHelper::INCREASES)\n\n @nodes[START].location = Vector[(@width-200)/2, @height/2] #pull out Menhaden Population and center\n grid_nodes_in_box(@nodes.reject{|k,v| k==START},Vector[@width-200+50, 130],Vector[200, @height-130+50]) #hard-coded starting box\n end",
"def test_add_edge_with_cycles\n @graph.add_edge('a', 'b');\n @graph.add_edge('b', 'c');\n @graph.add_edge('c', 'a');\n\n # 0 and 2 are indexes of vertex a and vertex c respectively\n assert(@graph.vertices[0].neighbours[2] == true && @graph.vertices[2].neighbours[0] == true)\n end",
"def temp_ghost\n @temp_ghost = true\n @through = true\n end",
"def steps\n infect the cell at a\n while we have more? new_infections do\n spread a new_infection\n more cowbell!\n end\n if the maze is infected? at b then return the generation at b else return 0 end\n end",
"def star_zeroes!()\n @matrix_size.times{|r|\n next if @rows_covered[r]\n @matrix_size.times{|c|\n next if @cols_covered[c]\n if @cost_matrix[r][c] == 0\n star!(r,c)\n cover_row!(r)\n cover_col!(c)\n break\n end\n }\n }\n clear_covers!()\n end",
"def keep_going; end",
"def build_sketch_graph\n\t@temp_hop_record = Hash.new\n\t@processed_list = Hash.new\n\t$node_list.each do |n|\n\t\t#Nodes in sketched graph: queries, user_inputs\n\t\t#if n.getInstr.getFromUserInput or (n.isQuery? and n.isWriteQuery?) or (n.getInstr.instance_of?AttrAssign_instr and n.getInstr.getFuncname.index('!') == nil)\n\t\tif n.isQuery? #or n.getInstr.getFromUserInputor isTableAttrAssign(n) \n\t\t\tn.Tnode = TreeNode.new(n)\n\t\t\t$sketch_node_list.push(n.Tnode)\t\n\t\t\t@temp_hop_record[n] = Array.new\n\t\t\t@processed_list[n] = Array.new\n\t\t\t@temp_hop_record[n].push(n)\n\t\tend \n\tend\n\tfor i in 0...$node_list.length\n\t\tadded_edge = false\n\t\tno_changes = true\n\t\t$node_list.each do |n|\n\t\t\tif n.Tnode != nil\n\t\t\t\t@temp_hop_record[n].push(nil)\n\t\t\t\ttemp_node = @temp_hop_record[n].shift\n\t\t\t\tstep = 0\n\t\t\t\twhile temp_node != nil and step < 10000 do\n\t\t\t\t\tstep += 1\n\t\t\t\t\tno_changes = false\n\t\t\t\t\ttemp_node.getDataflowEdges.each do |e|\n\t\t\t\t\t\tif e.getToNode.Tnode != nil and e.getToNode != n\n\t\t\t\t\t\t\tif n.Tnode.hasChildren(e.getToNode.Tnode) == false and (n.getIndex < e.getToNode.getIndex)\n\t\t\t\t\t\t\t\tn.Tnode.addChildren(e.getToNode.Tnode, i)\n\t\t\t\t\t\t\t\t#puts \"\\tAdd edge: #{n.getIndex}:#{n.getInstr.toString} -> #{e.getToNode.getIndex}:#{e.getToNode.getInstr.toString}\"\n\t\t\t\t\t\t\t\tadded_edge = true\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tif e.getToNode != n \n\t\t\t\t\t\t\t\tif @processed_list[n].include?e\n\t\t\t\t\t\t\t\telsif e.getToNode.getIndex < e.getFromNode.getIndex #returnv\n\t\t\t\t\t\t\t\t\te.getToNode.getDataflowEdges.each do |e1|\n\t\t\t\t\t\t\t\t\t\tif e1.getToNode.getIndex > temp_node.getIndex\n\t\t\t\t\t\t\t\t\t\t\t@temp_hop_record[n].push(e1.getToNode)\n\t\t\t\t\t\t\t\t\t\t\t@processed_list[n].push(e1)\n\t\t\t\t\t\t\t\t\t\tend \n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t@temp_hop_record[n].push(e.getToNode)\n\t\t\t\t\t\t\t\t\t@processed_list[n].push(e)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\ttemp_node = @temp_hop_record[n].shift\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tif added_edge\n\t\t\t#puts \"iteration #{i} ||\"\n\t\tend\n\t\tif no_changes\n\t\t\tbreak\n\t\tend\n\tend\n=begin\n\tgraph_write($graph_file, \"digraph sketch {\\n\")\n\t$node_list.each do |n|\n\t\tif n.Tnode != nil\n\t\t\tif n.isQuery?\n\t\t\t\tcolor = \"blue\"\n\t\t\telsif n.getInstr.instance_of?AttrAssign_instr\n\t\t\t\tcolor = \"darkorange\"\n\t\t\telse\n\t\t\t\tcolor = \"crimson\"\n\t\t\tend\n\t\t\tgraph_write($graph_file, \"\\tn#{n.getIndex} [label=<<i>#{n.getIndex}__#{n.getInstr.toString2}</i>> color=#{color}]; \\n\")\n\t\t\tn.Tnode.children.each do |c|\n\t\t\t\tgraph_write($graph_file, \"\\tn#{n.getIndex} -> n#{c.node.node.getIndex} [label=\\\"#{c.dist}\\\"]\\n\")\n\t\t\tend\n\t\tend\n\tend\n\tgraph_write($graph_file, \"}\")\n=end\nend",
"def backtrack!(nodes)\n while true\n return nil if nodes.empty? # backtracked back to 0, so we are done\n \n # We tried nodes.last and it didn't work, so\n # pop it off and uncover the corresponding columns.\n node = nodes.pop\n node.unchoose_except_self_column\n \n # Try the next node in this column.\n x = node.down\n\n return x unless x.is_a? Column\n \n # Our downwards iteration has gone full-circle\n # back to the column object where it started.\n x.uncover # Uncover the column.\n end\n end",
"def move(currX,currY,nextX,nextY,prev)\n if @mat[currY][currX] == \"0\"\n point = Point.new(nextX,nextY)\n if !(@traceSet.include?(point.to_S))\n point.setPrev(prev)\n @traceArray.push(point)\n @traceSet.add(point.to_S)\n if point.isEqual(@final)\n @tnode = point\n end\n end\n end\n end",
"def emit_finish_mutations\n finish = node.finish\n #emit_self(negative_infinity, finish)\n emit_self(nan, finish)\n end",
"def setup_transition\n return TSBS.error(@acts[0], 2, @used_sequence) if @acts.size < 3\n Fiber.yield\n name = \"Graphics/Pictures/\" + @acts[1]\n dur = @acts[2]\n vague = @acts[3] || 40\n Graphics.transition(dur, name, vague)\n end",
"def walk_rule_nfacreating_dot(dot, s)\n if (@marked_states.contains(s))\n return # already visited this node\n end\n @marked_states.add(s) # mark this node as completed.\n # first add this node\n state_st = nil\n if (s.is_accept_state)\n state_st = self.attr_stlib.get_instance_of(\"org/antlr/tool/templates/dot/stopstate\")\n else\n state_st = self.attr_stlib.get_instance_of(\"org/antlr/tool/templates/dot/state\")\n end\n state_st.set_attribute(\"name\", get_state_label(s))\n dot.set_attribute(\"states\", state_st)\n if (s.is_accept_state)\n return # don't go past end of rule node to the follow states\n end\n # special case: if decision point, then line up the alt start states\n # unless it's an end of block\n if ((s).is_decision_state)\n n = (s).attr_associated_astnode\n if (!(n).nil? && !(n.get_type).equal?(ANTLRParser::EOB))\n rank_st = self.attr_stlib.get_instance_of(\"org/antlr/tool/templates/dot/decision-rank\")\n alt = s\n while (!(alt).nil?)\n rank_st.set_attribute(\"states\", get_state_label(alt))\n if (!(alt.attr_transition[1]).nil?)\n alt = alt.attr_transition[1].attr_target\n else\n alt = nil\n end\n end\n dot.set_attribute(\"decisionRanks\", rank_st)\n end\n end\n # make a DOT edge for each transition\n edge_st = nil\n i = 0\n while i < s.get_number_of_transitions\n edge = s.transition(i)\n if (edge.is_a?(RuleClosureTransition))\n rr = (edge)\n # don't jump to other rules, but display edge to follow node\n edge_st = self.attr_stlib.get_instance_of(\"org/antlr/tool/templates/dot/edge\")\n if (!(rr.attr_rule.attr_grammar).equal?(@grammar))\n edge_st.set_attribute(\"label\", \"<\" + RJava.cast_to_string(rr.attr_rule.attr_grammar.attr_name) + \".\" + RJava.cast_to_string(rr.attr_rule.attr_name) + \">\")\n else\n edge_st.set_attribute(\"label\", \"<\" + RJava.cast_to_string(rr.attr_rule.attr_name) + \">\")\n end\n edge_st.set_attribute(\"src\", get_state_label(s))\n edge_st.set_attribute(\"target\", get_state_label(rr.attr_follow_state))\n edge_st.set_attribute(\"arrowhead\", @arrowhead)\n dot.set_attribute(\"edges\", edge_st)\n walk_rule_nfacreating_dot(dot, rr.attr_follow_state)\n i += 1\n next\n end\n if (edge.is_action)\n edge_st = self.attr_stlib.get_instance_of(\"org/antlr/tool/templates/dot/action-edge\")\n else\n if (edge.is_epsilon)\n edge_st = self.attr_stlib.get_instance_of(\"org/antlr/tool/templates/dot/epsilon-edge\")\n else\n edge_st = self.attr_stlib.get_instance_of(\"org/antlr/tool/templates/dot/edge\")\n end\n end\n edge_st.set_attribute(\"label\", get_edge_label(edge))\n edge_st.set_attribute(\"src\", get_state_label(s))\n edge_st.set_attribute(\"target\", get_state_label(edge.attr_target))\n edge_st.set_attribute(\"arrowhead\", @arrowhead)\n dot.set_attribute(\"edges\", edge_st)\n walk_rule_nfacreating_dot(dot, edge.attr_target) # keep walkin'\n i += 1\n end\n end",
"def test_layover\n @vertex.add_destination(Edge.new('', 3000))\n layover = 2.166666667 - (0.166666667)\n assert_equal(@vertex.layover, layover)\n @vertex.add_destination(Edge.new('', 4000))\n @vertex.add_destination(Edge.new('', 1000))\n layover = 2.166666667 - (0.166666667 * 3)\n assert_equal(@vertex.layover, layover)\n end",
"def best_swap graph\n swap.gain = MIN\n A.each do |a|\n B.each do |b|\n d = a.d + b.d - 2*c(a,b)\n if d > swap.gain\n swap.gain = d\n swap = a,b\n end\n end\n end\n return swap\nend",
"def not_visited(node, visited, unvisited)\n visited.each do |x,i|\n return false if x == node\n end\n \n unvisited.each do |x,i|\n return false if x == node\n end\n true\nend",
"def solve(begX, begY, endX, endY)\n #first create two points object as starting point and destination\n start = Point.new(begX,begY)\n @final = Point.new(endX,endY)\n #first initialize these objects in case that there are\n #data left after last iteration of solve\n @tnode = nil\n @traceSet = Set.new\n @traceArray = Array.new\n if start.isEqual(@final)\n @tnode = start\n true\n else\n @traceSet.add(start.to_S)\n @traceArray.push(start)\n\n #start sloving\n newp = @traceArray.shift\n #we don't stop until all the possible pathes are tested\n\n while newp != nil && @tnode == nil do\n #test each route and if we reach the destination, immediately break\n #the while loop\n\n #test if we can move upward\n move(2*newp.x+1,2*newp.y,newp.x,newp.y-1,newp)\n\n #test if we can move downward\n move(2*newp.x+1,2*newp.y+2,newp.x,newp.y+1,newp)\n\n #test if we can move leftward\n move(2*newp.x,2*newp.y+1,newp.x-1,newp.y,newp)\n\n #test if we can move rightward\n move(2*newp.x+2,2*newp.y+1,newp.x+1,newp.y,newp)\n\n #move to the next cell\n newp = @traceArray.shift\n end\n\n #if the current cell is nil, it means we have no solution for this maze puzzle\n if newp == nil\n false\n else #else return true\n true\n end\n end\n end",
"def nip_it_in_the_bud\n while has_bud?(@sequence) do\n @sequence.shift\n @sequence.each { |entry| entry.level -= 1 }\n end\n end",
"def reduziere_lebendige_transitionen(lebendig)\n # Prüfe alle Transitionen\n lebendig.transitionen.each do |t|\n # Überspringe t, sofern Übergänge zu t laufen\n next if lebendig.fluss.values.join(', ').include?(t)\n\n # t kommt im Vorbereich mindestens einer Stelle vor\n next unless lebendig.fluss.key?(t)\n\n # Da wir vorher alle Transitionen übersprungen haben, die keinen leeren Vorbereich haben,\n # sind ab hier alle Transitionen lebendig.\n\n # Entferne jede Stelle im Nachbereich von t, mitsamt Übergängen\n lebendig.fluss[t].each do |s|\n lebendig.reduziere_knoten(s)\n end\n\n # Entferne die lebendige Transition t\n lebendig.reduziere_knoten(t)\n\n # Fürs Protokoll\n puts(\"Lebendige Transitionen reduziert!\")\n end\nend",
"def fill(edges, l_act_edge, scan)\n q = Quaternion.new\n\n begin\n edges = edges.next\n q.x = edges.x_int + 0.5\n q.y = scan\n edges = edges.next\n set_dither_line(q, (edges.x_int + 0.5) )\n\n end while (edges != l_act_edge)\n end",
"def solve_prims\n linked, unlinked = [nodes.first], nodes[1..-1].dup\n end",
"def pre_loop; end",
"def build_graph(node = @root)\n node.make_knights(@target)\n if node.connected_knights.empty?\n return\n else\n node.connected_knights.each do |knight|\n build_graph(knight)\n end\n end\n end",
"def test_should_kill_with_just_one_neighbour\n @game.state = [[0,0,0],[1,0,0],[1,0,0]]\n after = @game.evolve\n assert_equal 0,after[1][0]\n assert_equal 0,after[2][0]\n end",
"def smoothing; end"
] |
[
"0.6105018",
"0.5975996",
"0.5975996",
"0.5898765",
"0.5732203",
"0.57321805",
"0.57247144",
"0.56873465",
"0.5593367",
"0.55826366",
"0.55662495",
"0.5543487",
"0.5496651",
"0.54930145",
"0.546061",
"0.5457375",
"0.5449119",
"0.5427467",
"0.5408365",
"0.5395222",
"0.53791296",
"0.53709954",
"0.53628874",
"0.536",
"0.53530633",
"0.53506136",
"0.534089",
"0.533736",
"0.5327639",
"0.53232706",
"0.52884525",
"0.52884376",
"0.5275651",
"0.5271226",
"0.5235071",
"0.52288985",
"0.5227954",
"0.5221912",
"0.5221543",
"0.5211643",
"0.52069104",
"0.52063143",
"0.52017945",
"0.519584",
"0.5192611",
"0.5191977",
"0.51851535",
"0.51638377",
"0.516194",
"0.5159786",
"0.5154773",
"0.5153562",
"0.5152014",
"0.51404214",
"0.51340914",
"0.513396",
"0.5131863",
"0.5130652",
"0.513064",
"0.51258755",
"0.5124551",
"0.5111827",
"0.510332",
"0.50973195",
"0.5088248",
"0.5088145",
"0.50871015",
"0.5087065",
"0.50843984",
"0.5080967",
"0.5079368",
"0.50740176",
"0.506259",
"0.50603306",
"0.50587714",
"0.50489223",
"0.50446904",
"0.50398225",
"0.50392056",
"0.5038842",
"0.5026496",
"0.50242394",
"0.50174665",
"0.5010912",
"0.5000629",
"0.4998321",
"0.49976325",
"0.49914825",
"0.49897018",
"0.49887168",
"0.49836892",
"0.4981946",
"0.49815688",
"0.49737355",
"0.49670362",
"0.4966546",
"0.49562675",
"0.49508065",
"0.49479973",
"0.49465835",
"0.4946407"
] |
0.0
|
-1
|
N.B. this assumes that the NFA will not be modified after creation (breaking this assumption will result in problems)
|
def alt(*list)
return lambda do |pos|
startstate = { '' => Set.new }
statelist = [startstate]
endstate = { '' => Set.new }
curpos = pos + statelist.size
list.each do |item|
startstate[''] << curpos
statelist += item.call(curpos)
statelist << endstate
curpos = pos + statelist.size
end
endstate[''] << curpos
return statelist
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_dfa\n # FILL IN\n\tinput = self\n output = NFA.new\n\toutput.set_start([input.start])\n\trStates = [output.start]\n\tmarked = []\n\t# get Sigma\n\tsigma = []\n\tinput.delta.values.each{|hash|\n\t\thash.keys.each{|sym|\n\t\tsigma << sym\n\t\t}\n\t}\n\tsigma =sigma.uniq\n\tr = rStates[0]\n\ti = 0\n\t\n\twhile marked.include?(r) == false\n\t\tmarked.push(r) #mark r\n\t\tsigma.each{|a|\n\t\t\tmove = []\n\t\t\tif r != nil then\n\t\t\t\tr.each{|q|\n\t\t\t\t\tif input.delta[q] != nil then\n\t\t\t\t\t\t\n\t\t\t\t\t\tif input.delta[q][a] != nil then\n\t\t\t\t\t\t\tinput.delta[q][a].each{|sta|\n\t\t\t\t\t\t\t\tmove << sta\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\t\tif rStates.include?(move) == false then\n\t\t\t\t\trStates << move\n\t\t\t\tend\n\t\t\t\toutput.add_trans(r, a, move)\n\t\t\tend\n\t\t}\n\t\ti+=1\n\t\tx = 0\n\t\tif r != nil then\n\t\tr.each{|s|\n\t\t\tif input.final.include?(s) then\n\t\t\t\tx = 1\n\t\t\tend\n\t\t}\n\t\tif x == 1 then\n\t\t\toutput.make_final(r)\n\t\tend\n\t\tend\n\t\tr = rStates[i]\n\tend\n\treturn output\n end",
"def nfa_to_dfa_aux\n @nextId = 0\n\n # Build a map of nfa state ids => nfa states\n @nfaStateMap = {}\n nfas = start_state.reachable_states\n nfas.each {|s| @nfaStateMap[s.id] = s}\n\n # Initialize an array of nfa state lists, indexed by dfa state id\n @sorted_nfa_state_id_lists = []\n\n # Map of existing DFA states; key is array of NFA state ids\n @dfaStateMap = {}\n\n iset = Set.new\n iset.add(start_state)\n eps_closure(iset)\n\n new_start_state,_ = create_dfa_state_if_necessary(states_to_sorted_ids(iset))\n\n unmarked = [new_start_state]\n\n until unmarked.empty?\n dfaState = unmarked.pop\n\n nfaIds = @sorted_nfa_state_id_lists[dfaState.id]\n\n # map of CodeSet => set of NFA states\n moveMap = {}\n\n nfaIds.each do |nfaId|\n nfaState = @nfaStateMap[nfaId]\n nfaState.edges.each do |lbl,dest|\n if lbl.elements[0] == EPSILON\n next\n end\n\n nfaStates = moveMap[lbl]\n if nfaStates.nil?\n nfaStates = Set.new\n moveMap[lbl] = nfaStates\n end\n nfaStates.add(dest)\n end\n end\n\n moveMap.each_pair do |charRange,nfaStates|\n # May be better to test if already in set before calc closure; or simply has closure\n eps_closure(nfaStates)\n dfaDestState, isNew = create_dfa_state_if_necessary(states_to_sorted_ids(nfaStates))\n if isNew\n unmarked.push(dfaDestState)\n end\n dfaState.addEdge(charRange, dfaDestState)\n end\n\n end\n\n @start_state = new_start_state\n end",
"def create_dfa_from_nfa(nfa)\n\tfirst_state = State.new(\"\", [], true, [nfa.epsilon_closure(nfa)])\n\t# Need a stack to ensure that nodes are processed in order\n\tstack = [first_state]\n\t# Array of states used to store all possible states with their epsilon closures\n\tepsilon_closures = [first_state]\n\twhile stack.length > 0\n\t nodes = stack.pop\n\t #Find whether an accepting state exists, if it does the node is assigned to be accepting\n\t nodes.type = find_accepting_states(nodes)\n\t #Iterate over all the operands to find all possible transitions out of a node\n\t OPERANDS.each do |operand|\n\t\t# Iteratively identify which transitions exist, and their respective epsilon closures and store in check_states\n\t check_states = get_transition_epsilon_closure(nodes, operand)\n\t\t# If a transition with operand exists then\n\t\tif check_states.key?(operand)\n concatenated = check_states[operand]\n\t\t #Check if the epsilon closure of the transition state is equivalent to an epsilon closure that we have in our epsilon closure array, if we have seen it before identify the index so we can use that state again\n\t\t closure_index = included_in_closures(epsilon_closures, concatenated)\n\t\t next_state = nil\n\t\t # If we have seen the closure before direct the transition out of our state toward the same state for which that epsilon closure exists, \n\t\t if closure_index != -1\n\t\t\tnext_state = epsilon_closures[closure_index]\n\t\t # if we have not seen it before then create a new state and add a transition to it\n\t\t else\n\t\t next_state = State.new(\"\", [], true, concatenated)\n\t\t epsilon_closures.push(next_state)\n\t\t stack.push(next_state)\n\t\t end\n\t\t nodes.next_states.push({operand => next_state})\n\t\tend \n\t end\n\tend\n\t# After the stack is empty and there are no more nodes to process, return the root of the DFA\n \treturn first_state\n end",
"def create_nfa_from_tree(tree)\n\tinitial_state = State.new(\"\",[])\n\tintermediate_state = initial_state\n final_state = State.new(\"Accepting\",[])\n\t\n\t#Base Case\n\tif tree.type == \"leaf\"\n\t initial_state.next_states = [{tree.value => final_state}]\n\telse \n\t tree.subtrees.each do |subtree|\n\t\tif OPERATORS.include?(tree.value)\n\t\t substate = create_nfa_from_tree(subtree)\n\t\t substate[1].type = \"\"\n\t\t substate[1].next_states = [{\"e\" => final_state}]\n\t\tend\n # Inductive Cases\n\t case tree.value\n\t when OPERATORS[1]\n\t\t initial_state.next_states.push({\"e\" => substate[0]})\n\t when OPERATORS[2]\n\t\t initial_state.next_states.push({\"e\" => substate[0]})\n\t\t substate[1].next_states.push({\"e\" => substate[0]})\n when OPERATORS[0]\n\t\t intermediate_state.next_states = [{\"e\" => substate[0]}]\n\t\t intermediate_state = substate[1] \n\t\tend\n\t end\n\tend\n\treturn [initial_state, final_state]\t\n end",
"def toDFA\n# create a new one, or modify the current one in place,\n# and return it\nfa = FiniteAutomaton.new\nrstate, group, result = {}, [], []\nempty = eClosure(@start)\nresult.push(empty)\nn = fa.new_state\nfa.set_start(n)\nrstate[empty] = n\nwhile result != []\ncurr = result.pop\n@alphabet.each{|alpha|\nempty = []\ngroup = move(curr, alpha)\nif group != nil && group != []\ngroup.each{|elem| group = group | eClosure(elem)}\n# check if the state is already in R\nif rstate[group] == nil && group.size != 0\nresult.push(group)\nn = fa.new_state\nrstate[group] = n\nend\nfa.add_transition(rstate[curr], rstate[group], alpha)\nif fa.get_alpha.include?(alpha) == false\nfa.get_alpha.push(alpha)\nend\nend\n}\nend\nkeys = @final.keys\nrkeys = rstate.keys\nfinal = []\nrkeys.each{|r|\nkeys.each{|k| if r.include?(k) then fa.set_final(rstate[r], true) end}\n}\nfa\nend",
"def to_dfa\n state_map = Hash.new # this map contains nfa_state_set => dfa_state pairs\n dfa_transitions = []\n dfa_alphabet = Set.new(@alphabet) - Set[:epsilon]\n visited_state_sets = Set.new()\n nfa_start_state_set = epsilon_closure([@start_state])\n unvisited_state_sets = Set[nfa_start_state_set]\n until unvisited_state_sets.empty?\n # take one of the unvisited state sets\n state_set = unvisited_state_sets.first\n unvisited_state_sets.delete(state_set)\n\n # this new DFA state, new_dfa_state, represents the nfa state set, state_set\n new_dfa_state = State.new(state_set.any?(&:final?))\n \n # add the mapping from nfa state set => dfa state\n state_map[state_set] = new_dfa_state\n \n # Figure out the set of next-states for each token in the alphabet\n # Add each set of next-states to unvisited_state_sets\n dfa_alphabet.each do |token|\n next_nfa_state_set = next_states(state_set, token)\n unvisited_state_sets << next_nfa_state_set\n # add a transition from new_dfa_state -> next_nfa_state_set\n # next_nfa_state_set is a placeholder that I'll go back and replace with the corresponding dfa_state\n # I don't insert the dfa_state yet, because it hasn't been created yet\n dfa_transitions << Transition.new(token, new_dfa_state, next_nfa_state_set)\n end\n \n visited_state_sets << state_set\n unvisited_state_sets = unvisited_state_sets - visited_state_sets\n end\n \n # replace the nfa_state_set currently stored in each transition's \"to\" field with the\n # corresponding dfa state.\n dfa_transitions.each {|transition| transition.to = state_map[transition.to] }\n \n DFA.new(state_map[nfa_start_state_set], dfa_transitions, dfa_alphabet)\n end",
"def nfa_to_dfa\n\n partition_edges\n minimize\n\n @start_state.generate_pdf(\"_SKIP_prefilter.pdf\") if @generate_pdf\n\n if @with_filter\n filter = Filter.new(@start_state)\n filter.verbose = @generate_pdf\n filter.apply\n if filter.modified\n # Re-minimize the dfa, since it's been modified by the filter\n minimize\n @start_state.generate_pdf(\"_SKIP_postfilter.pdf\") if @generate_pdf\n end\n end\n\n @start_state\n end",
"def dfa\n return @dfa unless @dfa.nil?\n @dfa = nfa_to_dfa(@nfa)\n end",
"def to_dfa\n # create a new one, or modify the current one in place,\n # and return it\n newdfa = FiniteAutomaton.new\n \n \n r = {}\n r2 ={}\n\n epsilonq0 = get_epsilon(@start)\n newdfa.set_start(new_state)\n r[epsilonq0] = false\n r2[epsilonq0] = newdfa.start\n\n while r.has_value?(false)\n r.keys.each{|key|\n if r[key] == false\n r[key] = true\n alphabet.each{|letter|\n eclose = []\n newstate = move(key, letter)\n newstate.each{|state|\n newepsilon = get_epsilon(state)\n eclose.concat(newepsilon)\n }\n eclose.uniq!\n if !r.has_key?(eclose) && eclose != []\n r[eclose] = false\n r2[eclose] = new_state\n end\n if eclose != []\n newdfa.add_transitiondfa(r2[key], r2[eclose], letter)\n end\n }\n end\n }\n end\n r.keys.each{|key|\n key.each{|state|\n if @final.has_key?(state)\n newdfa.set_final(r2[key], true)\n end\n }\n }\n newdfa.alphabet.concat(@alphabet)\n newdfa\n end",
"def isNFA?\n if isValid? then \n if @alphabet.include? \"\" then\n return true\n else\n combo = []\n @transition_rules.each do |transition|\n combo.push([transition.current_state, transition.input_char])\n if combo.count != combo.uniq.count then\n return true \n end\n end\n end\n end\n return false\n end",
"def concat! newFA\n# reset the final states and copy over start\nkeys = @final.keys\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], newFA.get_start, \"\")\nset_final(keys[i], false)\ni = i + 1\nend\n# copy over the final states\nkeys = newFA.get_final\ni = 0\nwhile i < keys.size\nset_final(keys[i], true)\ni = i + 1\nend\n# copy over the states\nkeys = newFA.get_state\ni = 0\nwhile i < keys.size\nadd_state(keys[i])\ni = i + 1\nend\n# copy over the transitions\nnewFA.get_trans_hash.keys.sort.each { |v1|\nnewFA.get_trans_hash[v1].keys.sort.each { |x|\nv2 = newFA.get_transition(v1,x)\ni = 0\nwhile i < v2.size\nadd_transition(v1, v2[i], x)\ni = i + 1\nend\n}\n}\n# copy over the alphabets\nnewFA.get_alpha.each{|a|\nif @alphabet.include?(a) == false\n@alphabet.push(a)\nend\n}\nend",
"def minimize\n# create a new one, or modify the current one in place,\n# and return it\nfa = FiniteAutomaton.new\nkeys = @state.keys.sort\np0, p1 = [], []\nkeys.each{|k|\nif is_final?(k)\np0 = p0.push(k)\nelsif\np1 = p1.push(k)\nend\n}\nnewfa = {}\nrstate = []\nif p0 != nil then rstate.push(p0) end\nif p1 != nil then rstate.push(p1) end\npstate = []\nwhile pstate != rstate\npstate = []\nrstate.each{|r| pstate.push(r)}\nrstate = []\npstate.each{|p|\np = p.sort\nresult = split(p, pstate)\np0 = result[0]\np1 = result[1]\nresult.each{|r|\nif r != []\nr = r.sort\nrstate = rstate.push(r)\nend\n}\n}\nend\nstart = []\nfinal = []\nrstate.each{|r| newfa[r] = fa.new_state}\nlist = newfa.keys\nlist.each{|l|\nl.each{|k|\nif k == @start\nstart.push(l)\nend\nif is_final?(k)\nfinal.push(l)\nend\n}\n}\nif start != []\nstart.each{|s| if newfa[s] then fa.set_start(newfa[s]) end}\nend\nif final != []\nfinal.each{|f| fa.set_final(newfa[f], true)}\nend\nrstate.each{|r0|\nr0.each{|r1|\n@alphabet.each{|a|\nif get_transition(r1, a) != nil\nrstate.each{|r|\nif r.include?(get_transition(r1, a)[0])\nif !(fa.get_transition(newfa[r0], a))\nfa.add_transition(newfa[r0], newfa[r], a)\nif fa.get_alpha.include?(a) == false\nfa.get_alpha.push(a)\nend\nend\nend\n}\nend\n}\n}\n}\nfa\nend",
"def process_lasgn exp\n exp = exp.dup\n exp.rhs = process exp.rhs\n exp\n end",
"def toDFA\n # create a new one, or modify the current one in place,\n # and return it\n FiniteAutomaton.new\n end",
"def initialize(nfa) \n @nfa = nfa\n \t# p nfa\n\n\n \t@statusList = []\n \t@finalNumList = []\n\n #origin status\n \tstatusList << Status.new(searchStatusSet(Set.new([nfa.begin])))\n @begin = statusList.size - 1\n\n \tstatusList.each { |status|\n signSet = Set.new\n \t\tstatus.nodeSet.each { |node_num|\n signSet << nfa.nodeList[node_num].refKey if nfa.nodeList[node_num].refKey != nil\n \t\t}\t\n next if signSet.empty?\n signSet.each { |sign|\n newStatusSet = Set.new\n status.nodeSet.each { |n|\n newStatusSet << nfa.nodeList[n].ref(sign) if nfa.nodeList[n].ref(sign) != nil\n\n }\n newStatusSet = searchStatusSet newStatusSet\n repeat = false\n statusCount = 0\n statusList.each { |s|\n if s.nodeSet == newStatusSet\n repeat = true\n break\n end\n statusCount += 1\n }\n\n if !repeat\n statusList << Status.new(newStatusSet)\n status.hashList[sign] = statusList.size - 1\n else\n status.hashList[sign] = statusCount\n end\n }\n\n\n\n \t}\n statusNum = 0\n statusList.each { |status|\n endCount = 0\n nfa.end.each { |endNum|\n if status.nodeSet.include? endNum\n status.isEndStatus = true\n if finalNumList[endCount] == nil\n finalNumList[endCount] = [statusNum]\n else\n finalNumList[endCount] << statusNum\n end\n break\n end \n endCount += 1\n }\n statusNum += 1\n }\n # p finalNumList\n # p statusList\n # p statusList.size\n end",
"def process_iasgn exp\n exp = exp.dup\n exp.rhs = process exp.rhs\n exp\n end",
"def generate(passes=5, n=:unigrams)\n unigramsOn = (n == :unigrams)\n index = rand(@sentences.length)\n tikis = @sentences[index]\n used = [index] # Sentences we've already used\n verbatim = [tikis] # Verbatim sentences to avoid reproducing\n\n (1..passes).each do |passno|\n log \"Generating... pass ##{passno}/#{passes}\"\n varsites = {} # Map bigram start site => next tiki alternatives\n\n tikis.each_with_index do |tiki, i|\n next_tiki = tikis[i+1]\n next if i == 0\n break if next_tiki.nil?\n\n alternatives = unigramsOn ? @unigrams[next_tiki] : @bigrams[tiki][next_tiki]\n # Filter out suffixes from previous sentences\n alternatives = alternatives.reject { |a| a[1] == -1 || used.include?(a[0]) }\n alternatives = alternatives.sample(10000)\n varsites[i] = alternatives unless alternatives.empty?\n end\n\n variant = nil\n ia = 0\n varsites.to_a.shuffle.each do |site|\n \n start = site[0]\n ib = 0\n site[1].each do |alt|\n puts \"Site #{start}/#{varsites.length} alt #{ib}/#{site[1].length}\" if (ib % 1000) == 0\n ib += 1\n alts = @sentences[alt[0]]\n verbatim << alts\n suffix = alts[alt[1]..-1]\n puts \"Zero length!\" if suffix.length < 1\n potential = tikis[0..start+1] + suffix\n\n # Ensure we're not just rebuilding some segment of another sentence\n unless verbatim.find { |v| v.length > 1 && SuffixGenerator.subseq?(v, potential) }\n used << alt[0]\n variant = potential\n break\n end\n raise(\"Wargh\") if ib > 100000 # got stuck. still don't know what causes this...\n end\n ia += 1\n break if variant\n end\n\n tikis = variant if variant\n end\n\n tikis\n end",
"def minimize\n # Reverse this NFA, convert to DFA, then\n # reverse it, and convert it again. Apparently this\n # produces a minimal DFA.\n\n @start_state = @start_state.reverseNFA\n nfa_to_dfa_aux\n\n @start_state = @start_state.reverseNFA\n nfa_to_dfa_aux\n\n State.normalizeStates(@start_state)\n end",
"def to_dfa\n RLSM::DFA.new(subset_construction).minimize!\n end",
"def test_new_not_on_self\n Automaton.new(false) do |fa|\n fa.add_state(:initial => true)\n fa.add_state(:accepting => true)\n fa.connect(0,1,'a')\n fa.connect(1,0,'b')\n end\n end",
"def to_dfa\n fa.determinize\n end",
"def test_step_on_examples\n assert_equal([], @small_dfa.step(0,'b'))\n @small_dfa.each_state do |s|\n s.out_edges.each do |e|\n assert_equal([e.target], @small_dfa.step(s,e.symbol))\n end\n end\n\n assert_equal([], @small_nfa.step(0, 'b'))\n assert_equal(@small_nfa.ith_states(1), @small_nfa.step(0, 'a'))\n assert_equal(@small_nfa.ith_states(2,3), @small_nfa.step(1, 'b'))\n assert_equal(@small_nfa.ith_states(1), @small_nfa.step(1, nil))\n end",
"def ngram_analysis(str, n)\r\n # use a hash to store ngram - frequency mapping\r\n freq = Hash.new\r\n bigram = \"\"\r\n count = n-1\r\n i = 0\r\n\r\n # get the first ngram\r\n for i in 0..count\r\n bigram[i] = str[i]\r\n end\r\n\r\n freq[bigram] = 1\r\n\r\n str.each_char do |char|\r\n if i>=n then\r\n\r\n # bigram, trigram or quadrigram?\r\n bigram[0] = bigram[1]\r\n if n==2 then\r\n bigram[1] = char\r\n elsif n==3 then\r\n bigram[1] = bigram[2]\r\n bigram[2] = char\r\n elsif n==4 then\r\n bigram[1] = bigram[2]\r\n bigram[2] = bigram[3]\r\n bigram[3] = char\r\n end\r\n\r\n # updates values in the hash\r\n if freq.key?(bigram)==false then\r\n freq[bigram] = 1\r\n else \r\n freq[bigram] = freq[bigram]+1\r\n end\r\n\r\n end\r\n i = i + 1\r\n end\r\n\r\n # sort and print\r\n freq = freq.sort_by {|_key, value| value}.reverse.to_h\r\n i=0\r\n puts \"N-gram Analysis Results:\"\r\n freq.each do |key, value|\r\n if value!=1 && i<20 then\r\n puts key.to_s+\"\\t\"+value.to_s\r\n end\r\n i = i + 1\r\n end\r\nend",
"def add_and_check_digrams(rule, node, digram_index)\n puts \"Starting add_and_check, seq is #{rule.sequence.inspect}\"\n digram=[node, node.next]\n digram_values=[node.value, node.next.value]\n puts \"This digram is #{digram.inspect}\"\n digram_locations=digram_index[digram_values]\n if (existing_rule=digram_locations.first).is_a? Rule\n # replace with existing rule\n puts \"Main loop, replace with existing\"\n replacement=rule.replace_digram_with( digram.first, existing_rule ) \n puts \"main replace done\"\n elsif digram_locations.size+1 > K\n # create a new rule\n $grammar.counter+=1\n new_rule=Rule.new($grammar.counter, digram_index)\n digram_values.each {|val| new_rule << val}\n $grammar << new_rule\n digram_locations << digram.first\n # replace all occurrences of the digram with the rule\n digram_locations.each {|digram_head|\n puts \"Main loop, replace with new\"\n replacement=rule.replace_digram_with( digram_head, new_rule )\n puts \"main replace new done\"\n }\n else\n # Not more than K occurrences yet.\n # Add this node to the list of digram locations\n digram_locations << node\n end\n puts \"Leaving. seq is now #{rule.sequence.inspect}\"\nend",
"def get_nfapath(s, label_index, labels, path)\n # starting where?\n # 0..labels.size()-1\n # input sequence\n # output list of NFA states\n # track a visit to state s at input index labelIndex if not seen\n this_state_key = get_state_label_index_key(s.attr_state_number, label_index)\n if (@states_visited_at_input_depth.contains(this_state_key))\n # System.out.println(\"### already visited \"+s.stateNumber+\" previously at index \"+\n # labelIndex);\n return false\n end\n @states_visited_at_input_depth.add(this_state_key)\n # System.out.println(\"enter state \"+s.stateNumber+\" visited states: \"+\n # statesVisitedAtInputDepth);\n # pick the first edge whose target is in states and whose\n # label is labels[labelIndex]\n i = 0\n while i < s.get_number_of_transitions\n t = s.attr_transition[i]\n edge_target = t.attr_target\n label = labels.get(label_index)\n # System.out.println(s.stateNumber+\"-\"+\n # t.label.toString(dfa.nfa.grammar)+\"->\"+\n # edgeTarget.stateNumber+\" ==\"+\n # label.toString(dfa.nfa.grammar)+\"?\");\n if (t.attr_label.is_epsilon || t.attr_label.is_semantic_predicate)\n # nondeterministically backtrack down epsilon edges\n path.add(edge_target)\n found = get_nfapath(edge_target, label_index, labels, path)\n if (found)\n @states_visited_at_input_depth.remove(this_state_key)\n return true # return to \"calling\" state\n end\n path.remove(path.size - 1) # remove; didn't work out\n i += 1\n next # look at the next edge\n end\n if (t.attr_label.matches(label))\n path.add(edge_target)\n # System.out.println(\"found label \"+\n # t.label.toString(dfa.nfa.grammar)+\n # \" at state \"+s.stateNumber+\"; labelIndex=\"+labelIndex);\n if ((label_index).equal?(labels.size - 1))\n # found last label; done!\n @states_visited_at_input_depth.remove(this_state_key)\n return true\n end\n # otherwise try to match remaining input\n found = get_nfapath(edge_target, label_index + 1, labels, path)\n if (found)\n @states_visited_at_input_depth.remove(this_state_key)\n return true\n end\n # System.out.println(\"backtrack; path from \"+s.stateNumber+\"->\"+\n # t.label.toString(dfa.nfa.grammar)+\" didn't work\");\n path.remove(path.size - 1) # remove; didn't work out\n i += 1\n next # keep looking for a path for labels\n end\n i += 1\n end\n # System.out.println(\"no epsilon or matching edge; removing \"+thisStateKey);\n # no edge was found matching label; is ok, some state will have it\n @states_visited_at_input_depth.remove(this_state_key)\n return false\n end",
"def union! newFA\ns0 = new_state\ns1 = new_state\nadd_transition(s0, @start, \"\")\nadd_transition(s0, newFA.get_start, \"\")\n# reset the final states of the current object\nkeys = @final.keys\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\nset_final(keys[i], false)\ni = i + 1\nend\n# set the final states of the other object\nkeys = newFA.get_final\ni = 0\nwhile i < keys.size\nadd_transition(keys[i], s1, \"\")\ni = i + 1\nend\n# copy over the states\nkeys = newFA.get_state\ni = 0\nwhile i < keys.size\nadd_state(keys[i])\ni = i + 1\nend\n# copy over the transitions\nnewFA.get_trans_hash.keys.sort.each { |v1|\nnewFA.get_trans_hash[v1].keys.sort.each { |x|\nv2 = newFA.get_transition(v1,x)\ni = 0\nwhile i < v2.size\nadd_transition(v1, v2[i], x)\ni = i + 1\nend\n}\n}\nset_start(s0)\nset_final(s1, true)\n# copy over the alphabets\nnewFA.get_alpha.each{|a|\nif @alphabet.include?(a) == false\n@alphabet.push(a)\nend\n}\nend",
"def concat! newFA\n end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def concat! newFA\n \n @final.keys.each { |key| add_transition(key, newFA.start, \"\")}\n @final.keys.each { |key| set_final(key, false)}\n\n @transition.merge!(newFA.transition)\n @state.merge!(newFA.state)\n newFA.final.keys.each { |key| set_final(key, true)}\n \n newFA.alphabet.each{|letter|\n if !@alphabet.include?(letter)\n @alphabet.push(letter)\n end\n } \n end",
"def initialize(randomness, ngram_size)\n @chains = []\n @input_set = []\n @randomness, @ngram_size = randomness, ngram_size\n end",
"def test_add_state\n Automaton.new(false) do |fa|\n s0 = fa.add_state\n assert_equal(1, fa.state_count)\n assert_equal(false, s0.initial?)\n assert_equal(false, s0.accepting?)\n\n s1 = fa.add_state(:initial => true)\n assert_equal(2, fa.state_count)\n assert_equal(true, s1.initial?)\n assert_equal(false, s1.accepting?)\n\n s2 = fa.add_state(:initial => true, :accepting => true)\n assert_equal(3, fa.state_count)\n assert_equal(true, s2.initial?)\n assert_equal(true, s2.accepting?)\n\n s3 = fa.add_state(:myownkey => \"blambeau\")\n assert_equal(4, fa.state_count)\n assert_equal(false, s3.initial?)\n assert_equal(false, s3.accepting?)\n assert_equal(\"blambeau\", s3[:myownkey])\n\n assert_equal(0, fa.edge_count)\n end\n end",
"def interpreter\n dfaStack = [ ] \n loop do\n line = gets\n words = line.scan(/\\S+/)\n words.each{ |word|\n case word\n when /DONE/\n return\n when /DOT/\n f = dfaStack.last\n f.dotfile\n when /SIZE/\n f = dfaStack.last\n puts f.num_states\n when /PRINT/\n f = dfaStack.last\n f.prettyPrint\n when /DFA/\n f = dfaStack.pop\n f2 = f.toDFA\n dfaStack.push f2\n when /MINIMIZE/\n f = dfaStack.pop\n f2 = f.minimize\n dfaStack.push f2\n when /GENSTR([0-9]+)/\n f = dfaStack.last\n puts f.genStr($1)\n when /\"([a-z]*)\"/\n f = dfaStack.last\n str = $1\n if f.accept?(str)\n puts \"Accept #{str}\"\n else\n puts \"Reject #{str}\"\n end\n when /([a-zE])/\n puts \"Illegal syntax for: #{word}\" if word.length != 1\n f = NFA.new #changed from FA because it always gonna create a new NFA object\n sym = $1\n sym=\"\" if $1==\"E\"\n f.symbol!(sym)\n dfaStack.push f\n when /\\*/\n puts \"Illegal syntax for: #{word}\" if word.length != 1\n f = dfaStack.pop\n f.closure!\n dfaStack.push f\n when /\\|/\n puts \"Illegal syntax for: #{word}\" if word.length != 1\n f1 = dfaStack.pop\n f2 = dfaStack.pop\n f2.union!(f1)\n dfaStack.push f2\n when /\\./\n puts \"Illegal syntax for: #{word}\" if word.length != 1\n f1 = dfaStack.pop\n f2 = dfaStack.pop\n f2.concat!(f1)\n dfaStack.push f2\n else\n puts \"Ignoring #{word}\"\n end\n }\n end\nend",
"def minimize\n\t\tdfa = DFA.new\n\t\tif @alphabet.empty?\n\t\t\treturn self\n\t\tend\n\t\taccept = @final.keys\n\t\treject = @state.keys - accept\n\t\t#print \"Accept { \" + accept.join(\", \").to_s + \" }\\n\"\n\t\t#print \"Reject { \" + reject.join(\", \").to_s + \" }\\n\"\n\t\tcounter = @@nextID\n\t\ta = counter\n\t\tif(!reject.empty?)\n\t\t\tcounter+=1\n\t\tend\n\t\tb = counter\n\t\tsymbol = nil\n\t\tdestination = nil\n\t\t\n\t\tif(!reject.empty?)\n\t\t\tdfa.state_rep[a] = reject\n\t\t\tdfa.state_rep[b] = accept\n\t\telse\n\t\t\tdfa.state_rep[a] = accept\n\t\tend\n\t\t\t\n\t\tstack = Array.new\n\t\tstack.push a\n\t\tstack.push b\n\t\tpartitions = Array.new\n\t\t#dfa.prettyPrint\n\t\twhile(partitions != stack)\n\t\t\tpartitions = stack\n\t\t\tstack = Array.new\n\t\t\t#puts \"Part: \" + partitions.to_s + \"stak: \" + stack.to_s\n\t\t\t#print \"R = {\" + partitions.join(\", \").to_s + \"}\\n\"\n\t\t\tpartitions.flatten.each{ |p|\n\t\t\t\t#print \"Split partition: { \" + dfa.state_rep[p].join(\", \").to_s + \" }\\n\"\n\t\t\t\tdfa.state_rep[p], temp = split(dfa.state_rep[p], dfa.state_rep)\n\t\t\t\t#print p.to_s + \" now contains: { \" + dfa.state_rep[p].join(\", \").to_s + \" }\\n\"\n\t\t\t\t#print \"Temp: { \" + temp.join(\", \").to_s + \" }\\n\"\n\t\t\t\tif(!temp.empty?)\n\t\t\t\t\tcounter+=1\n\t\t\t\t\tc = counter\n\t\t\t\t\tstack.push p\n\t\t\t\t\tstack.push c\n\t\t\t\t\t#print c.to_s + \" now contains { \" + temp.join(\", \").to_s + \" }\\n\"\n\t\t\t\t\t#dfa.prettyPrint\n\t\t\t\t\tdfa.state_rep[c] = temp\n\t\t\t\tend\n\t\t\t\tdfa.state_rep.keys.each { |state|\n\t\t\t\t\tdfa.clear_trans(state)\n\t\t\t\t\tdfa.state_rep[state].each { |stuffs|\n\t\t\t\t\t@alphabet.each{ |c|\n\t\t\t\t\t\tdest = get_transition(stuffs, c)\n\t\t\t\t\t\tif dest != nil\n\t\t\t\t\t\t\tparks = dfa.state_rep.keys.dup\n\t\t\t\t\t\t\tparks.each{ |place|\n\t\t\t\t\t\t\t\tif dfa.state_rep[place].include?(dest)\n\t\t\t\t\t\t\t\t\t#puts \"adding (\" + state.to_s + \" \" + c.to_s + \" \" + place.to_s + \"\\n\" \n\t\t\t\t\t\t\t\t\tdfa.add_transition(state, place, c)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t#end\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#print dfa.state.to_s + \"\\n\"\n\t\t\t\t#puts \"-------------------------------\"\n\t\t\t}\n\t\t\t#puts \"Part: \" + partitions.to_s + \"stak: \" + stack.to_s\n\t\tend\n\t\tdfa.state.keys.each{ |parts|\n\t\t\tresult = 0\n\t\t\tis_start = 0\n\t\t\t#puts parts\n\t\t\tdfa.state_rep[parts].each { |state|\n\t\t\t\tif(is_final?(state))\n\t\t\t\t\tresult = 1\n\t\t\t\tend\n\t\t\t\tif(state == @start)\n\t\t\t\t\tis_start = 1\n\t\t\t\tend\n\t\t\t\t}\n\t\t\tif result == 1\n\t\t\t\tdfa.set_final(parts)\n\t\t\tend\n\t\t\tif(is_start == 1)\n\t\t\t\tdfa.set_start(parts)\n\t\t\tend\n\t\t}\n\t\tdfa\n end",
"def initialize\n @set = BitSet.new\n @endOf = Sym::NoSym\n @ctx = false\n @correct = true\n end",
"def combine_token_nfas(token_records)\n\n # Create a new distinguished start state\n\n start_state = State.new(0)\n baseId = 1\n\n token_records.each do |tk|\n regParse = tk.reg_ex\n\n oldToNewMap, baseId = regParse.start_state.duplicateNFA(baseId)\n\n dupStart = oldToNewMap[regParse.start_state]\n\n # Transition from the expression's end state (not a final state)\n # to a new final state, with the transitioning edge\n # labelled with the token id (actually, a transformed token id to distinguish\n # it from character codes)\n dupEnd = oldToNewMap[regParse.endState]\n\n dupfinal_state = State.new(baseId)\n baseId += 1\n dupfinal_state.final_state = true\n\n # Why do I need to add 'ToknInternal.' here? Very confusing.\n dupEnd.addEdge(CodeSet.new(ToknInternal.token_id_to_edge_label(tk.id)), dupfinal_state)\n\n # Add an e-transition from the start state to this expression's start\n start_state.addEdge(CodeSet.new(EPSILON),dupStart)\n end\n start_state\n end",
"def test_new_on_self\n Automaton.new(true) do |fa|\n fa.add_state(:initial => true)\n add_state(:accepting => true)\n connect(0,1,'a')\n fa.connect(1,0,'b')\n end\n end",
"def create_dfa_state_if_necessary(sorted_nfa_state_id_list)\n newState = @nfaStateMap[sorted_nfa_state_id_list]\n isNewState = newState.nil?\n if isNewState\n newState = State.new(@nextId)\n\n # Determine if any of the NFA states were final states\n newState.final_state = sorted_nfa_state_id_list.any?{|id| @nfaStateMap[id].final_state}\n\n @nextId += 1\n @nfaStateMap[sorted_nfa_state_id_list] = newState\n @sorted_nfa_state_id_lists.push(sorted_nfa_state_id_list)\n end\n return [newState,isNewState]\n end",
"def test_automaton_of_lambda_language\n fa, s0 = nil\n assert_nothing_raised do\n fa = Automaton.new do |fa|\n s0 = fa.add_state(:initial => true, :accepting => true)\n end\n end\n assert_equal(1, fa.state_count)\n assert_equal(0, fa.edge_count)\n assert_equal([s0], fa.states)\n assert_equal(true, fa.deterministic?)\n assert_equal([s0], fa.initial_states)\n assert_equal(s0, fa.initial_state)\n assert_equal([], fa.edges)\n assert_equal([], fa.in_edges(s0))\n assert_equal([], fa.out_edges(s0))\n assert_equal([], fa.in_symbols(s0))\n assert_equal([], fa.out_symbols(s0))\n assert_equal([], fa.adjacent_states(s0))\n assert_equal([], fa.in_adjacent_states(s0))\n assert_equal([], fa.out_adjacent_states(s0))\n end",
"def fast_factorial(n)\n ApproxFactorial.stieltjes_factorial(n)\n end",
"def test_initial_state_cache_works_correctly\n dfa = Stamina::ADL.parse_automaton <<-EOF\n 2 2\n 0 true false\n 1 false true\n 0 1 a\n 1 0 b\n EOF\n initial, other = dfa.ith_state(0), dfa.ith_state(1)\n assert_equal initial, dfa.initial_state\n initial[:hello] = \"world\"\n assert_equal initial, dfa.initial_state\n dfa.ith_state(0)[:initial] = false\n dfa.ith_state(1)[:initial] = true\n assert_equal other, dfa.initial_state\n end",
"def alg; end",
"def initialize *args\n @attempts = Hash.new(nil)\n @sentence = args[0] || DEFAULT_SENTENCE\n @words = args[1] || ENGLISH_NUMBERS\n @words = @words.dup\n @thirty_plus = args[1] || ENGLISH_THIRTY_PLUS\n count = 30\n @thirty_plus.each do |word|\n @words[count] = word\n count += 10\n end\n\n extend_wordlist MAX_COUNT\n #puts \"@sentence=#{@sentence}\"\n # only add one the first time, all the others already have the extra one\n\n @result = letter_frequency @sentence\n @result.each { |k,v| @result[k] += 1 }\n #puts full_sentence( @result )\n self\n end",
"def applyNps\r\n currentIdx = 0\r\n \r\n @sentences.each do |sentence|\r\n \r\n #right now we're just going to select the first NP per sentence... this will need to be fixed later\r\n sentence.npModels.each do |npModel|\r\n if npModel.coref\r\n \r\n #just moving on for right now...\r\n npModel.findBestMatch(currentIdx, @sentences)\r\n\r\n #handle if we have a \"they\" in there\r\n\t #TODO: could probably try reordering these rules and see\r\n\t #if we can get greater accuracy\r\n #if(Rules.findItAnt(npModel, currentIdx, @sentences))\r\n #elsif(Rules.findTheyAnt(npModel, currentIdx, @sentences))\r\n #elsif(Rules.matchPlurality(npModel, currentIdx, @sentences))\r\n #elsif(Rules.findSimilarName(npModel, currentIdx, @sentences))\r\n #else\r\n #Rules.findCorrectAnt(npModel, currentIdx, @sentences)\r\n #end\r\n end\r\n end\r\n currentIdx = currentIdx + 1\r\n end\r\n end",
"def minimize\n # create a new one, or modify the current one in place,\n # and return it\n DFA.new \n end",
"def test_ith_states_on_examples\n assert_equal(@small_dfa.states, @small_dfa.ith_states(0,1,2,3))\n assert_equal([@small_dfa.ith_state(1)], @small_dfa.ith_states(1))\n assert_equal(@small_nfa.states, @small_nfa.ith_states(0,1,2,3))\n assert_equal([@small_nfa.ith_state(1)], @small_nfa.ith_states(1))\n end",
"def test_states_on_examples\n assert_equal(4,@small_dfa.states.size)\n assert_equal(4,@small_nfa.states.size)\n end",
"def test_dfa_step_on_examples\n assert_equal(nil, @small_dfa.dfa_step(0,'b'))\n @small_dfa.each_state do |s|\n s.out_edges.each do |e|\n assert_equal(e.target, @small_dfa.dfa_step(s,e.symbol))\n end\n end\n end",
"def test_add_state_aliases\n Automaton.new(false) do |fa|\n assert_not_nil(s0 = fa.add_state(:initial => true))\n assert_not_nil(s1 = fa.create_state)\n assert_not_nil fa.add_edge(s0,s1, 'a')\n end\n end",
"def test_documentation_example2\n # create some automaton (here a non deterministic automaton)\n nfa = Automaton.new do |fa|\n s0 = fa.add_state(:initial => true, :accepting => false)\n s1 = fa.add_state(:initial => false, :accepting => true)\n s2 = fa.add_state(:initial => false, :accepting => true)\n fa.add_edge(s0, s1, 'a')\n fa.add_edge(s0, s2, 'a')\n end\n\n # check that it is recognized as a non deterministic one\n assert_equal false,nfa.deterministic?\n end",
"def test_automaton_of_whole_langage_on_a\n fa, s0, e0 = nil\n assert_nothing_raised do\n fa = Automaton.new do |fa|\n s0 = fa.add_state(:initial => true, :accepting => true)\n e0 = fa.add_edge(s0, s0, {:symbol => 'a'})\n end\n end\n\n # check the whole automaton\n assert_equal(1, fa.state_count)\n assert_equal(1, fa.edge_count)\n assert_equal([s0], fa.states)\n assert_equal([e0], fa.edges)\n assert_equal(true, fa.deterministic?)\n assert_equal([s0], fa.initial_states)\n assert_equal(s0, fa.initial_state)\n assert_equal([e0], fa.in_edges(s0))\n assert_equal([e0], fa.out_edges(s0))\n assert_equal(['a'], fa.in_symbols(s0))\n assert_equal(['a'], fa.out_symbols(s0))\n assert_equal([s0], fa.adjacent_states(s0))\n assert_equal([s0], fa.in_adjacent_states(s0))\n assert_equal([s0], fa.out_adjacent_states(s0))\n end",
"def to_annoj\n ##this is the list of features that will be grouped for parenting in AnnoJ. Can be extended...\n ## why is there a list? why not all parented features??? - Its an AnnoJ thing, it overlies some valid features\n ## with the same parent, this is a kludge for the most common feature types that will get parented.\n case self.feature\n when 'intron', 'exon', 'CDS', 'five_prime_UTR', 'three_prime_UTR', 'start_codon', 'stop_codon', 'match_part'\n if self.has_parent?\n [Feature.find(self.parents[0].parent_feature).gff_id, self.id, self.strand, self.feature, self.start, self.end - self.start + 1]\n else\n [nil, self.gff_id, self.strand, self.feature, self.start, self.end - self.start + 1]\n end\n else\n [nil, self.gff_id, self.strand, self.feature, self.start, self.end - self.start + 1]\n end\n end",
"def report_non_llstar_decision(dfa)\n # System.out.println(\"non-LL(*) DFA \"+dfa.decisionNumber+\", alts: \"+\n # dfa.recursiveAltSet.toList());\n @non_llstar_decision = true\n @alts_with_problem.add_all(dfa.attr_recursive_alt_set.to_list)\n end",
"def change_from_wild_probability\n # TODO: 2+ skips\n has_wild_probability\n end",
"def dp_possible_trees(n)\n array = Array.new(n+2) { Array.new(n+1) { 0 } }\n (0...n+2).to_a.each do |i|\n array[i][0] = 1\n end\n\n sum = 0\n (1...n+1).to_a.each do |i|\n sum = 0\n (1..i).to_a.each do |j|\n array[j][i] = array[n+1][i-j] * array[n+1][j-1]\n sum += array[j][i]\n end\n array[n+1][i] = sum\n end\n array[n+1].last\nend",
"def start_graph(words)\n # initialize graph and edge count\n g = nodeset(words)\n gk = g.keys\n\n # initialize edge count\n incoming_edges = {}\n gk.each { |k| incoming_edges[k] = 0 }\n\n words.each_with_index do |w, i|\n w2 = words[i + 1]\n unless i + 1 == words.length\n # grab adjacent words in the dict and split them into arrays of their characters\n chars1, chars2 = w.split(\"\"), w2.split(\"\")\n chars1.each_with_index do |c, j|\n # compare characters in the words\n c2 = chars2[j]\n next if c == c2\n # note the parent/child relationship and increment the in-degree count\n g[c] += c2\n incoming_edges[c2] += 1\n break\n end\n end\n end\n\n alienlang(g, incoming_edges)\nend",
"def bfs\n\n\n end",
"def bfs\n\n end",
"def test_automaton_of_empty_language\n fa, s0 = nil\n assert_nothing_raised do\n fa = Automaton.new do |fa|\n s0 = fa.add_state(:initial => true, :accepting => false)\n end\n end\n assert_equal(1, fa.state_count)\n assert_equal(0, fa.edge_count)\n assert_equal(true, fa.deterministic?)\n assert_equal([s0], fa.initial_states)\n assert_equal(s0, fa.initial_state)\n assert_equal([s0], fa.states)\n assert_equal([], fa.edges)\n assert_equal([], fa.in_edges(s0))\n assert_equal([], fa.out_edges(s0))\n assert_equal([], fa.in_symbols(s0))\n assert_equal([], fa.out_symbols(s0))\n assert_equal([], fa.adjacent_states(s0))\n assert_equal([], fa.in_adjacent_states(s0))\n assert_equal([], fa.out_adjacent_states(s0))\n end",
"def fact_sig_exp(n)\n gamma_sig_exp(n + 1)\nend",
"def test_initial_states_on_examples\n assert_equal([@small_dfa.ith_state(3)], @small_dfa.initial_states())\n assert_equal(@small_nfa.ith_states(0,3), @small_nfa.initial_states().sort)\n end",
"def bfs\n # raise NotImplementedError\n end",
"def gen_bigrams(a)\n bigrams = a.zip(a[1..-1])\n bigrams.pop # remove last useless one [lastitem, nil]\n return bigrams\nend",
"def a3g_hypermut(ref = nil)\n # mut_hash number of apobec3g/f mutations per sequence\n mut_hash = {}\n hm_hash = {}\n out_hash = {}\n\n # total G->A mutations at apobec3g/f positions.\n total = 0\n\n unless ref \n # make consensus sequence for the input sequence hash\n ref = self.consensus\n end\n\n # obtain apobec3g positions and control positions\n apobec = apobec3gf(ref)\n mut = apobec[0]\n control = apobec[1]\n\n self.dna_hash.each do |k,v|\n a = 0 # muts\n b = 0 # potential mut sites\n c = 0 # control muts\n d = 0 # potenrial controls\n mut.each do |n|\n if v[n] == \"A\"\n a += 1\n b += 1\n else\n b += 1\n end\n end\n mut_hash[k] = a\n total += a\n\n control.each do |n|\n if v[n] == \"A\"\n c += 1\n d += 1\n else\n d += 1\n end\n end\n rr = (a/b.to_f)/(c/d.to_f)\n\n t1 = b - a\n t2 = d - c\n\n fet = ViralSeq::Rubystats::FishersExactTest.new\n fisher = fet.calculate(t1,t2,a,c)\n perc = fisher[:twotail]\n info = [k, a, b, c, d, rr.round(2), perc]\n out_hash[k] = info\n if perc < 0.05\n hm_hash[k] = info\n end\n end\n\n if self.dna_hash.size > 200\n rate = total.to_f/(self.dna_hash.size)\n count_mut = mut_hash.values.count_freq\n maxi_count = count_mut.values.max\n poisson_hash = ViralSeq::Math::PoissonDist.new(rate,maxi_count).poisson_hash\n cut_off = 0\n poisson_hash.each do |k,v|\n cal = self.dna_hash.size * v\n obs = count_mut[k]\n if obs >= 20 * cal\n cut_off = k\n break\n elsif k == maxi_count\n cut_off = maxi_count\n end\n end\n mut_hash.each do |k,v|\n if v > cut_off\n hm_hash[k] = out_hash[k]\n end\n end\n end\n\n hm_seq_hash = ViralSeq::SeqHash.new\n hm_hash.each do |k,_v|\n hm_seq_hash.dna_hash[k] = self.dna_hash[k]\n end\n \n hm_seq_hash.title = self.title + \"_hypermut\"\n hm_seq_hash.file = self.file\n filtered_seq_hash = self.sub(self.dna_hash.keys - hm_hash.keys)\n return { a3g_seq: hm_seq_hash,\n filtered_seq: filtered_seq_hash,\n stats: hm_hash.values\n }\n end",
"def test_automaton_with_epsilon\n fa, s0, s1, edge = nil\n assert_nothing_raised do\n fa = Automaton.new(false) do |fa|\n s0 = fa.add_state(:initial => true, :accepting => true)\n s1 = fa.add_state\n edge = fa.connect(s0, s1, {:symbol => nil})\n assert_equal(nil, edge.symbol)\n end\n end\n assert_equal(false, fa.deterministic?)\n assert_equal([s0,s1], fa.initial_states.sort)\n assert_equal(true, fa.initial_states.include?(fa.initial_state))\n end",
"def inversed=(_arg0); end",
"def n_1_0(term, klass)\n @n_1_0 = pre_compute_n_1_0 unless @n_1_0\n\n @n_1_0[klass][term]\n end",
"def inverse_of=(_arg0); end",
"def simhash(ngrams)\n # map each ngram to its bitsums\n sums = ngrams.map { |i| simhash_bitsums(i) }\n # transpose and calculate final sum for each bit\n bits = sums.transpose.map { |values| values.inject(&:+) }\n # wherever we have a positive sum, the simhash bit is 1\n simhash = 0\n bits.each_with_index do |i, index|\n simhash |= (1 << index) if i > 0\n end\n simhash\n end",
"def nn\n end",
"def test_deterministic_fa_with_two_states\n s0, s1, e01, e10, fa = nil\n\n # automaton construction, should not raise anything\n fa = Automaton.new do |a|\n s0 = a.add_state(:initial => true)\n s1 = a.add_state(:accepting => true)\n e01 = a.add_edge(s0, s1, 'a')\n e10 = a.add_edge(s1, s0, 'b')\n end\n\n # check automaton\n assert_equal(2, fa.state_count)\n assert_equal(2, fa.edge_count)\n assert_equal(true, fa.deterministic?)\n assert_equal([s0], fa.initial_states)\n assert_equal(s0, fa.initial_state)\n assert_equal([s0,s1], fa.states)\n assert_equal([e01,e10], fa.edges)\n\n # check state s0\n assert_equal(true, s0.initial?)\n assert_equal(false, s0.accepting?)\n assert_equal(true, s0.deterministic?)\n assert_equal([e01], s0.out_edges)\n assert_equal([e10], s0.in_edges)\n\n # check state s1\n assert_equal(false, s1.initial?)\n assert_equal(true, s1.accepting?)\n assert_equal(true, s1.deterministic?)\n assert_equal([e10], s1.out_edges)\n assert_equal([e01], s1.in_edges)\n\n # check edge 01\n assert_equal('a', e01.symbol)\n assert_equal(s0, e01.source)\n assert_equal(s1, e01.target)\n\n # check edge 10\n assert_equal('b', e10.symbol)\n assert_equal(s1, e10.source)\n assert_equal(s0, e10.target)\n\n # check the whole automaton\n assert_equal(2, fa.state_count)\n assert_equal(2, fa.edge_count)\n assert_equal([s0, s1], fa.states)\n assert_equal([e01, e10], fa.edges)\n assert_equal([e10], fa.in_edges(s0))\n assert_equal([e01], fa.out_edges(s0))\n assert_equal(['b'], fa.in_symbols(s0))\n assert_equal(['a'], fa.out_symbols(s0))\n assert_equal([e01], fa.in_edges(s1))\n assert_equal([e10], fa.out_edges(s1))\n assert_equal(['a'], fa.in_symbols(s1))\n assert_equal(['b'], fa.out_symbols(s1))\n assert_equal([s1], fa.adjacent_states(s0))\n assert_equal([s1], fa.in_adjacent_states(s0))\n assert_equal([s1], fa.out_adjacent_states(s0))\n assert_equal([s0], fa.adjacent_states(s1))\n assert_equal([s0], fa.in_adjacent_states(s1))\n assert_equal([s0], fa.out_adjacent_states(s1))\n\n # check that it is recognized as a deterministic automaton\n assert_equal true, fa.deterministic?\n end",
"def nonRecursiveFibonacci(n)\na=Array.new\na[0] = a[1] = 1\n\nfor i in 2..n\na[i]=a[i-1] + a[i-2]\nend\nreturn a[n]\nend",
"def union! newFA\n \n ustart = new_state\n uend = new_state\n \n add_transition(ustart, @start, \"\")\n add_transition(ustart, newFA.start, \"\")\n set_start(ustart)\n\n @transition.merge!(newFA.transition)\n @state.merge!(newFA.state)\n\n @final.keys.each { |key| add_transition(key, uend, \"\")}\n newFA.final.keys.each { |key| add_transition(key, uend, \"\")}\n\n \n @final.keys.each { |key| set_final(key, false)}\n set_final(uend, true)\n \n newFA.alphabet.each{|letter|\n if !@alphabet.include?(letter)\n @alphabet.push(letter)\n end\n } \n\n\n end",
"def p(trigram)\n\n bigram = trigram[1..2]\n unigram = trigram[2..2]\n # see which case we fall into for this backoff scheme\n if @counts.include?(trigram)\n # p1 function, trigram exists\n return pML(trigram, @discount)\n else\n ngram = nil\n beta_gram = nil\n alpha = 0\n if @counts.include?(bigram)\n # p2 function, no trigram but bigram exists\n ngram = bigram\n beta_gram = trigram[0..1] # the words used to help generate a beta-set of zero-count trigram\n # alpha mass redistribution\n alpha = @weights[:p2] * (1 - pML(trigram, @discount))\n else\n # p3 function, no trigram or bigram\n ngram = unigram\n beta_gram = trigram[0..0] # the words used to help generate a beta-set of zero-count bigrams\n # alpha mass redistribution\n alpha = @weights[:p3] * (1 - pML(trigram, @discount))\n end\n\n numerator = pML(ngram) \n denominator = @beta_gram_cache.fetch(beta_gram, nil) \n if not denominator\n dgram = nil\n sum = 0\n @vocab.each do |v| # all permutations of vocab words\n dgram = beta_gram + [v]\n # that are zero-count ngrams of (w,w_i-1,w_i-2) or (w,w_i-1)\n if not @counts.include?(dgram)\n # should be part of the sum of pML(w|w_i-1) or pML(w)\n sum += pML(dgram.drop(1)) # drop w_i-2 or w_i-1 as needed\n end\n end\n\n @beta_gram_cache.store(beta_gram, sum)\n denominator = sum\n end\n\n if denominator == 0 then return 0 end\n return alpha * numerator / denominator\n end\n\n end",
"def class_disambiguation(rdfdata,transitive)\n puts \"RDF to SVM WITH META PROPERTIES ...\"\n number_homonyms=[]\n max=nil\n min=nil\n svmmodelbygroup=[]\n ftotal = 0\n max_featuresbygroup=[]\n min_featuresbygroup=[]\n global_maximum=0\n\n # puts \"DATA DEBUG 1\"\n # puts rdfdata[0][0]\n puts \"############# RESTRICTED INVERSE FUNCTIONAL PROPERTIES\"\n # puts $textp\n ifp = restricted_IFP(rdfdata) + $textp + propertyoverflow(rdfdata)\n ifp.uniq!\n # puts ifp\n ifp.map!{|x| getCode(x.to_s.hash.abs)}\n\n groups_counter=[]\n count=-1\n pivot = nil # the smallest ambiguous set\n\n rdfdata.each{|group|\n count=count+1\n ######################## All Predicates ##########################\n # puts \"Encoding group ...\"\n #puts group.uniq.map{|s,p,o| s.to_s + \" \" + p.to_s + \" \" + o.to_s}\n new_group = group.uniq.map{|s,p,o| [getCode(s.to_s.hash.abs),getCode(p.to_s.hash.abs),getCode(o.to_s.hash.abs),o.instance_of?(RDFS::Resource) ] }.compact\n # new_group = group.uniq.map{|s,p,o| [ (s.to_s ), (p.to_s ), (o.to_s),o.instance_of?(RDFS::Resource) ] }.compact\n # puts \"Selecting items of measurement ...\"\n predicate_counter = new_group.map{|s,p| p }.compact\n datatype_objects = new_group.map{|s,p,o,t| o if !t and !ifp.include?(p) }.compact\n object_properties = new_group.map{|s,p,o,t| o if t and !ifp.include?(p) }.compact\n tuple_counter = new_group.map{|s,p,o,t| p.to_s + \" \" + o.to_s if !ifp.include?(p) }.compact\n #tuple_counter = new_group.map{|s,p,o,t| p.to_s + \" \" + o.to_s if !ifp.include?(p) && discriminative_predicates.include?(p) }.compact\n\n # puts \"Grouping subjects ...\"\n subjects = new_group.map{|s,p,o,t| s}.uniq\n groupedsubject = subjects.map{|x| new_group.find_all{|s,p,o,t| s==x}}\n groups_counter << [groupedsubject,predicate_counter,datatype_objects,object_properties,tuple_counter]\n }\n\n puts \"Buiding Model ...\"\n #####################################################################\n groups_counter_idx = -1\n groups_counter.each{|gs, group_predicates, group_datatype, group_objects, group_tuple|\n groups_counter_idx = groups_counter_idx + 1\n ################ GLOBAL PREDICATES AND OBJECTS ##############\n lines=[]\n max=nil\n count=count+1\n puts \"GROUP############## - \" + groups_counter_idx.to_s\n puts gs.size\n number_homonyms << gs.size\n gs.each{|subject|\n predicates = subject.map{|s,p| p }.compact\n datatype_objects = subject.map{|s,p,o,t| o if !t and !ifp.include?(p) }.compact\n object_properties = subject.map{|s,p,o,t| o if t and !ifp.include?(p) }.compact\n tuple_counter = subject.map{|s,p,o| p.to_s + \" \" + o.to_s if !ifp.include?(p) }.compact\n # tuple_counter = subject.map{|s,p,o| p.to_s + \" \" + o.to_s if !ifp.include?(p) && discriminative_predicates.include?(p) }.compact\n\n features = []\n sim1 = 0\n sim2 = 0\n sim3 = 0\n sim4 = 0\n counter1 = -1\n # puts \"SUBJECT\"\n puts subject[0][0]\n # puts tuple_counter\n ############################ Resource Vs. Origin Pivot\n if groups_counter_idx < $origin_subjects.size\n # puts \"ORIGIN SIZE \"\n # puts $origin_subjects.size\n # puts $origin_subjects[groups_counter_idx].size\n\n origin_s = $origin_subjects[groups_counter_idx].map{|p,o| [ getCode(p.to_s.hash.abs),getCode(o.to_s.hash.abs),o.instance_of?(RDFS::Resource) ] }.compact\n # origin_s = $origin_subjects[groups_counter_idx].map{|p,o| [ (p.to_s ), (o.to_s),o.instance_of?(RDFS::Resource) ] }.compact\n origin_predicates = origin_s.map{|p,o| p}.compact\n origin_datatype_objects = origin_s.map{|p,o,t| o if !t }.compact\n origin_object_properties = origin_s.map{|p,o,t| o if t }.compact\n origin_tuple_counter = origin_s.map{|p,o| p.to_s + \" \" + o.to_s }.compact\n\n groups_counter.each{|gs,group_predicates,group_datatype, group_objects, group_tuple|\n sim1 = sim1 + hm(origin_predicates,predicates, gs.size.to_f)\n sim2 = sim2 + hm(origin_datatype_objects, datatype_objects, gs.size.to_f)\n sim3 = sim3 + hm(origin_object_properties, object_properties, gs.size.to_f)\n sim4 = sim4 + hm(origin_tuple_counter, tuple_counter, gs.size.to_f)\n }\n end\n # puts \"PIVOT SIMILARITY\"\n # puts sim1\n # puts sim2\n # puts sim3\n # puts sim4\n ############################ Resource Vs. Pseudo-Homonyms\n groups_counter.each{|gs,group_predicates,group_datatype, group_objects, group_tuple|\n counter1 = counter1 + 1\n next if groups_counter_idx == counter1\n sim1 = sim1 + hm(group_predicates,predicates, gs.size.to_f)\n sim2 = sim2 + hm(group_datatype, datatype_objects, gs.size.to_f)\n sim3 = sim3 + hm(group_objects, object_properties, gs.size.to_f)\n sim4 = sim4 + hm(group_tuple, tuple_counter, gs.size.to_f)\n }\n # puts \"SIMILARITY\"\n # puts sim1\n # puts sim2\n # puts sim3\n # puts sim4\n # features << sim1\n # features << sim2\n # features << sim3\n # features << sim4\n features << (sim1 + sim2 + sim3 + sim4 ).abs\n\n lines << features\n max = Array.new(features) if max == nil\n max.each_index{|idx| max[idx] = features[idx] if max[idx] < features[idx]}\n }\n max.each {|gg| global_maximum = gg if global_maximum < gg}\n max_featuresbygroup << max\n svmmodelbygroup << lines\n # lines.each{|ss| puts ss.join (\" \") }\n puts \"END GROUP ###\"\n }\n # put \"####### Maximum Absolute\"\n # max_featuresbygroup.map{|v| }\n puts \"########### Normalizing Features\"\n idx=-1\n svmmodelbygroup.map!{|g|\n idx=idx+1\n subidx = -1\n g.map!{|f|\n subidx = subidx+1\n line = \"\"\n f.each_index{|i|\n v = f[i]\n if max_featuresbygroup[idx][i] != 0\n v = f[i] / global_maximum\n\n # v = f[i] / max_featuresbygroup[idx][i]\n\n if f[i] == global_maximum\n # add_pivot(rdfdata[idx], @searchedlabels[idx] ,subidx) if $usepivot\n add_pivot(rdfdata[idx], nil ,subidx) if $usepivot\n end\n end\n line = line + \"#{i+1}:#{v} \" if !v.nan?\n }\n line\n }\n }\n # puts \"THRESHOLD USED\"\n # # change this if more than one feature is used.\n # $threshold_global = (max_featuresbygroup.flatten.sum.to_f/ max_featuresbygroup.size.to_f) / global_maximum\n # if $threshold_global > 0.90\n # $threshold_global = max_featuresbygroup.flatten.min\n # end\n puts $threshold_global\n # svmmodelbygroup.each{|g| puts \"GROUP ########\"\n # puts g\n # puts \"############3\"\n # }\n puts \"NUMBER OF GROUPS\"\n puts svmmodelbygroup.size\n puts \"NUMBER OF ELEMENTS BY GROUPS 0\"\n puts svmmodelbygroup[0].size if svmmodelbygroup.size > 0\n puts \"NUMBER OF HOMONYMS\"\n number_homonyms.each{|v | $number_homonyms = $number_homonyms + v}\n $list_number_homonyms = $list_number_homonyms + number_homonyms\n puts number_homonyms.sort.join(\"\\t\")\n puts number_homonyms.join(\"\\t\")\n\n return svmmodelbygroup\n end",
"def fibo_nth(n)\n\n def fibo_nth_ll(n)\n @fibo_numbers[n] ||= fibo_nth_ll(n-2) + fibo_nth_ll(n-1)\n end\n\n @fibo_numbers = {0 => 0, 1 => 1} # init_memory\n\n fibo_nth_ll(n)\nend",
"def termsig(*) end",
"def prefix_closed\n automaton = fa.dup\n automaton.each_state{|s| s.accepting!}\n RegLang.new(automaton)\n end",
"def backup(next_state_ns)\n next_state_ns.map do |next_state_n, probability, reward|\n probability * (reward + @discount * @array_value[next_state_n])\n end.inject(:+)\n end",
"def test_initial_state_on_examples\n assert_equal(@small_dfa.ith_state(3), @small_dfa.initial_state())\n end",
"def test_delta_on_examples\n assert_equal([], @small_dfa.delta(0,'b'))\n @small_dfa.each_state do |s|\n s.out_edges.each do |e|\n assert_equal([e.target], @small_dfa.delta(s,e.symbol))\n end\n end\n\n assert_equal([], @small_nfa.delta(0,'b'))\n assert_equal(@small_nfa.ith_states(1,2,3), @small_nfa.delta(1, 'b').sort)\n assert_equal(@small_nfa.ith_states(), @small_nfa.delta(1, 'a').sort)\n assert_equal(@small_nfa.ith_states(1), @small_nfa.delta(0, 'a').sort)\n assert_equal(@small_nfa.ith_states(1,2,3), @small_nfa.delta(2, 'b').sort)\n end",
"def initialize\n @dirty = false\n @total = 0\n @frequencies = {}\n @probabilities = {}\n end",
"def n=(new_n)\n @n , @previous_n = new_n, @n\n build_chains() if @n != @previous_n && @previous_n != nil && @previous_n != 0\n end",
"def n_0_1(term, klass)\n @n_0_1 = pre_compute_n_0_1 unless @n_0_1\n\n @n_0_1[klass][term]\n end",
"def gamma_decomposition\r\n k = 0; comparability=true; classification={}\r\n edges.map {|edge| [edge.source,edge.target]}.each do |e|\r\n if classification[e].nil?\r\n k += 1\r\n classification[e] = k; classification[e.reverse] = -k\r\n comparability &&= gratr_comparability_explore(e, k, classification)\r\n end\r\n end; [classification, comparability]\r\n end",
"def complement!\n # create a new one, or modify the current one in place,\n # and return it\n newdfa = FiniteAutomaton.new\n newdfa.set_start(@start)\n newdfa.state.merge!(@state)\n newdfa.transition.merge!(@transition)\n \n dead_state = new_state\n\n newdfa.state.keys.each{|key|\n if@transition[key] == {} \n \n @alphabet.each{|letter|\n newdfa.add_transitiondfa(key, dead_state, letter)\n newdfa.add_transitiondfa(dead_state, dead_state, letter)\n }\n else\n \n @alphabet.each{|letter|\n if get_transition(key, letter) == nil\n newdfa.add_transitiondfa(key, dead_state, letter)\n newdfa.add_transitiondfa(dead_state, dead_state, letter)\n end\n }\n end\n }\n newdfa.state.each_key{|state| newdfa.set_final(state, true)}\n @final.each_key{|state| newdfa.set_final(state, false)}\n newdfa.alphabet.concat(@alphabet)\n newdfa\n end",
"def nostalgia; return rand end",
"def union! newFA\n end",
"def inversed; end",
"def gamma_decomposition\n k = 0; comparability=true; classification={}\n edges.map {|edge| [edge.source,edge.target]}.each do |e|\n if classification[e].nil?\n k += 1\n classification[e] = k; classification[e.reverse] = -k\n comparability &&= plexus_comparability_explore(e, k, classification)\n end\n end; [classification, comparability]\n end",
"def is_dfa?\n # FILL IN\n\tself.delta.values.each{|secHash|\n\t\tsecHash.values.each{|arr|\n\t\t\tif arr.size > 1\n\t\t\t\treturn false\n\t\t\tend\n\t\t}\n\t}\n\treturn true\n end",
"def reset \n init_fann\n end",
"def greibach_normal_form\n raise NotImplementedError\n end",
"def n_gramas\n for i in 2...8\n busca_n_gramas(i)\n end\n end",
"def fibs(n) ; PHI**n - PHA**n ; end",
"def start_lasgn(node)\n remember_new_variable(node)\n end",
"def test_state_count_on_examples\n assert_equal(4, @small_dfa.state_count)\n assert_equal(4, @small_nfa.state_count)\n end",
"def gen_new_node_num()\n gen_uniq_rand($node_range, $nodes)\nend",
"def sequence(hidden, open)\n weight = { 1 => \"A\", 2 => \"2\", 3 => \"3\", 4 => \"4\", 5 => \"5\", 6 => \"6\", 7 => \"7\", 8 => \"8\", 9 => \"9\", \n 10 => \"T\", 11 => \"J\", 12 => \"Q\", 13 => \"K\" }\n i = 0\n result = []\n inputs = 1\n differ = 0\n if weight.key(hidden[i]) > weight.key(hidden[i+2])\n small = weight.key(hidden[i+2])\n big = weight.key(hidden[i])\n differ = big - small\n elsif weight.key(hidden[i]) < weight.key(hidden[i+2])\n small = weight.key(hidden[i])\n big = weight.key(hidden[i+2])\n differ = big - small\n else\n return false\n end\n return false if differ > 4\n if differ > 1\n start = small + 1\n end1 = big - 1\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n inputs += 1\n end \n end \n end \n end\n end\n return false unless differ == inputs \n if result.size < 6\n steps = (6-result.size)/2\n start = big + 1\n end1 = big + steps\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n end \n end \n end \n end\n if result.size < 6\n steps = (6-result.size)/2\n return false if small - steps < 1 \n start = small - steps\n end1 = small - 1\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n end \n end \n end \n end\n return false if result.size < 6\n end\n end \n result \n end"
] |
[
"0.6660806",
"0.64166707",
"0.62069744",
"0.608312",
"0.6000144",
"0.58836854",
"0.58663476",
"0.5805256",
"0.5668479",
"0.5551849",
"0.5510701",
"0.5497563",
"0.54340285",
"0.534625",
"0.5335955",
"0.5301236",
"0.528755",
"0.52710116",
"0.52608716",
"0.5255979",
"0.5231693",
"0.52301145",
"0.5228015",
"0.51583815",
"0.5155102",
"0.5139671",
"0.51195234",
"0.50909436",
"0.50909436",
"0.50909436",
"0.50909436",
"0.50399363",
"0.5022453",
"0.5017571",
"0.50057495",
"0.4997484",
"0.4992574",
"0.4980435",
"0.4926843",
"0.4898841",
"0.488475",
"0.4866735",
"0.48474964",
"0.48434103",
"0.48378763",
"0.48301283",
"0.48233566",
"0.4815082",
"0.481478",
"0.47934943",
"0.47878075",
"0.47807473",
"0.47578838",
"0.47464955",
"0.4740004",
"0.47373694",
"0.4735874",
"0.4734074",
"0.47230494",
"0.47205698",
"0.47146496",
"0.47087398",
"0.46989825",
"0.4697605",
"0.46975815",
"0.46970326",
"0.46952006",
"0.46916965",
"0.46829405",
"0.46812978",
"0.46780196",
"0.46692052",
"0.46571684",
"0.46510994",
"0.46478063",
"0.46400514",
"0.4640022",
"0.4638658",
"0.46324298",
"0.46285847",
"0.46256214",
"0.4621135",
"0.46208245",
"0.46180597",
"0.46146783",
"0.46098575",
"0.45975596",
"0.45974824",
"0.45927328",
"0.45920953",
"0.4591297",
"0.45883945",
"0.4587955",
"0.4585048",
"0.4554893",
"0.45531288",
"0.45407057",
"0.4535656",
"0.45346072",
"0.45312664",
"0.45307818"
] |
0.0
|
-1
|
used in the composition of star(reg)
|
def plus(reg)
return lambda do |pos|
statelist = reg.call(pos)
curpos = pos + statelist.size
endstate = { '' => Set.new( [pos, curpos + 1] ) }
statelist << endstate
return statelist
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def star(reg)\n return opt(plus(reg))\nend",
"def star; end",
"def star\n end",
"def *(mat)\n end",
"def _all_gp_reg_pair\n (0..7).each do |reg|\n (0..3).each do |x|\n yield \"r#{reg}\", \"r#{x*2}#{x*2+1}\"\n end\n end\n end",
"def g_(acc,elt)\n elt/acc\nend",
"def do_asterisk s; a = mega_pop(s); b = mega_pop(s); s[:stack].push(a*b); end",
"def to_reg()\n source = \"reduce #{@register.symbol}[#{@index}]\"\n slot_to_reg = Risc.slot_to_reg(source , register, index)\n if compiler\n compiler.add_code(slot_to_reg)\n slot_to_reg.register.set_compiler(compiler)\n end\n slot_to_reg.register\n end",
"def g(acc,elt)\n acc/elt\nend",
"def process_iasgn exp\n exp = exp.dup\n exp.rhs = process exp.rhs\n exp\n end",
"def mathtex(*)\n super\n end",
"def register(curr); end",
"def +(mat)\n end",
"def *(mat)\n if (@c == mat.f)\n result = Array.new\n for i in 0...@f do\n result[i] = Array.new\n for j in 0...@c do\n result[i][j] = 0\n end\n end\n aux = Densa.new(result)\n nElementos = 0\n for i in 0...@f do\n for j in 0...mat.c do\n for z in 0...@c do\n if ((!@matriz[i].nil?) && (!@matriz[i][z].nil?) && (!mat.matriz[z].nil?) && (!mat.matriz[z][j].nil?))\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n nElementos += 1\n end\n end\n end\n end\n if ((@f * @c) * 0.4 > nElementos)\n aux = to_dispersa(aux)\n end\n else\n aux = \"No se pueden multiplicar\"\n end\n aux\n end",
"def *(x); end",
"def starship; end",
"def *(mat)\n if (@mCol == mat.nFil)\n result = Array.new\n (@nFil).times do |i|\n result[i] = Array.new\n (mat.mCol).times do |j|\n\t if(@matriz[i][j].class==Fraccion)\n result[i][j] = Fraccion.new(0,1)\n\t else\n\t result[i][j] = 0\n\t end\n end\n end\n\n aux = Matriz.new(result)\n\n (@nFil).times do |i|\n (mat.mCol).times do |j|\n (@mCol).times do |z|\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n end\n end\n end\n else\n aux = 0\n end\n aux\n end",
"def firm_star star\n star.to_i == 0 ? 0 : 15 * star.to_i\n end",
"def *(p0) end",
"def *(p0) end",
"def *(p0) end",
"def matz; end",
"def star\n set_starred_state(true)\n end",
"def star!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 44 )\n\n type = STAR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 165:8: '*'\n match( 0x2a )\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__, 44 )\n\n end",
"def termsig(*) end",
"def noise_pattern() abstract_method\n\tend",
"def registers; end",
"def |(p0) end",
"def |(p0) end",
"def |(p0) end",
"def |(p0) end",
"def |(p0) end",
"def |(p0) end",
"def qrgen\n end",
"def *(other)\n end",
"def rec_exp_1(base, power)\nend",
"def /(p0) end",
"def *(value)\n mul(value) ;\n end",
"def opt(reg)\n return lambda do |pos|\n startstate = { '' => Set.new( [pos + 1] ) }\n\n statelist = [startstate]\n curpos = pos + statelist.size\n\n statelist += reg.call(curpos)\n curpos = pos + statelist.size\n\n startstate[''] << curpos\n\n return statelist\n end\nend",
"def * x; operation(:*, 2, \"x\", x); end",
"def flag()\n\tb=[0,0.2,0.6]\n\ty=[0.8,0.8,0.2]\n\tr=[1,0,0]\n\t\n\t[[b,b,y,y,r,r],\n\t[b,b,y,y,r,r],\n\t[b,b,y,y,r,r],\n\t[b,b,y,y,r,r],\n\t[b,b,y,y,r,r]]\nend",
"def r2\n @n_predictors.times.inject(0) {|ac,i| ac+@coeffs_stan[i]* @matrix_y[i,0]} \n end",
"def multiply\n match '*'\n factor\n emit_ln 'MULS (SP)+,D0'\nend",
"def opcode_8XY1(helper)\n\t\thelper.registry_X = helper.registry_X | helper.registry_Y\n\tend",
"def bstardrag\n bstar\n end",
"def numerator() end",
"def star_asgn!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 47 )\n\n type = STAR_ASGN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 168:13: '*='\n match( \"*=\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 47 )\n\n end",
"def pattern=(_arg0); end",
"def features_simple_real_modular(A=matrix)\n \n\nend",
"def scan_for_plus(token); end",
"def *(other)\n\t\tif other.respond_to?(\"d\")\n return Fraccion.new(@n*other.n, @d*other.d)\n else\n return Fraccion.new(other*@n,@d)\n end\n\tend",
"def ^(p0) end",
"def ^(p0) end",
"def ^(p0) end",
"def ^(p0) end",
"def ^(p0) end",
"def * other\n result = Polynomial.new\n @coeffs.each_with_index do |c, i|\n result.plus! other.scale(c).shift(i)\n end\n result\n end",
"def squared\n end",
"def pattern; end",
"def pattern; end",
"def pattern; end",
"def method_missing(sym, *args)\n raise if sym == :reg\n emit(sym, *args)\n end",
"def f6; return *['a','b'] &['a','Y','Z'] end",
"def * other\n mul(other)\n end",
"def mrg; xparam(8); end",
"def **(p0) end",
"def ∑(*addends)\n if addends.any?\n Sigma[*addends]\n else\n Sigma\n end\nend",
"def grasa\n\t\t1.2*imc+0.23*@edad-10.8*@sexo-5.4\n\tend",
"def mul\r\n node = unary()\r\n\r\n loop do\r\n if consume(\"*\")\r\n node = new_binary(ND_MUL, node, unary())\r\n elsif consume(\"/\")\r\n node = new_binary(ND_DIV, node, unary())\r\n else\r\n return node\r\n end\r\n end\r\nend",
"def g(x,y) x + y end",
"def regnum_of(reg)\n (@state.first_phase) ? 0 : reg.regnum\n end",
"def rec_exp_2(base, power)\nend",
"def *(object)\n #multiplica numerador con numerador y denominador con denominador\n Fraccion.new(@numerador*object.numerador,@denominador*object.denominador)\n end",
"def star?\n if @star.nil?\n @star = weights.dense.trace.positive?\n else\n @star\n end\n end",
"def rpower(arg0)\n end",
"def term\n factor\n while MULOPS.include?($lookahead)\n emitln \"movl %eax, -(0x8*#{$stackdepth})(%rsp)\"\n case $lookahead\n when \"*\"\n multiply\n when \"/\"\n divide\n else\n expected \"mulop\"\n end\n end\nend",
"def mul!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n\n type = MUL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 376:7: '*'\n match( 0x2a )\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__, 50 )\n\n end",
"def power_araray(array)\n ## recorrer el arreglo con map\n ## hacer la operatorio con ** 2\n ## map entrega un copia lista\nend",
"def -(mat)\n end",
"def union! newFA\n end",
"def op; end",
"def use_reg type , value = nil\n if @regs.empty?\n reg = Register.tmp_reg(type , value)\n else\n reg = @regs.last.next_reg_use(type , value)\n end\n @regs << reg\n return reg\n end",
"def _reduce_111(val, _values, result)\n result = @builder.symbol(val[0])\n \n result\nend",
"def term; end",
"def /(value)\n mul(value) ;\n end",
"def imc \n\t\t@peso/(@talla*@talla)\n\tend",
"def x2\n x + w\n end",
"def mul!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 42 )\n\n\n\n type = MUL\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 63:6: '*'\n match( 0x2a )\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__, 42 )\n\n\n end",
"def src_reg_to_alu_op(reg)\n rnum = reg[1].to_i\n return rnum.even? ? $alu_ops['alu_logic_A'] : $alu_ops['alu_logic_B']\nend",
"def *(other)\n\t\tRacional.new(num*other.num,denom*other.denom)\n\tend",
"def sqr\n\t\t\t@elem[0] ** 2 + @elem[1] ** 2 + @elem[2] ** 2 + @elem[3] ** 2 \n\t\tend",
"def match(p0) end",
"def match(p0) end",
"def *(other)\n\t\telemento = Array.new(0)\n\t\tfor i in 0...filas do\n\t\t\tfila = Array.new(0)\n\t\t\tfor j in 0...colum do\n\t\t\t\tfila << pos[i][j]*other\n\t\t\tend\n\t\t\telemento << fila\n\t\tend\n\t\tMatriz.new(@nfil, @ncol, elemento)\n\tend",
"def |(parslet); end",
"def |(parslet); end",
"def ein; end",
"def *(mat)\n if (@mCol == mat.nFil)\n result = Array.new\n for i in 0...@nFil do\n result[i] = Array.new\n for j in 0...mat.mCol do\n if (mat.matriz[0][0].class == Fraccion)\n result[i][j] = Fraccion.new(0, 1)\n else\n result[i][j] = 0\n end\n end\n end\n\n aux = MatrizDensa.new(result)\n\n for i in 0...@nFil do\n for j in 0...mat.mCol do\n for z in 0...@mCol do\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n end\n end\n end\n else\n aux = 0\n end\n aux\n end",
"def on_mlhs_add_star(left, right)\n if right\n left << right.updated(nil, [*right.children, true])\n # Add a placeholder for the expander token.\n else\n left << nil\n end\n\n return left\n end",
"def power (*base_and_power)\n base_and_power.inject(:**)\nend"
] |
[
"0.7529917",
"0.6907497",
"0.6515655",
"0.6114417",
"0.5879277",
"0.5828981",
"0.5748637",
"0.57189995",
"0.5566581",
"0.5525674",
"0.55143756",
"0.5504979",
"0.5434158",
"0.54329085",
"0.54289484",
"0.5415777",
"0.54147065",
"0.5371988",
"0.5345551",
"0.5345551",
"0.53455114",
"0.5325531",
"0.5292917",
"0.5288351",
"0.52861565",
"0.52334344",
"0.5220193",
"0.51944065",
"0.51944065",
"0.51944065",
"0.51944065",
"0.51944065",
"0.51944065",
"0.51937354",
"0.51863104",
"0.5168221",
"0.5166382",
"0.515323",
"0.51180553",
"0.5115764",
"0.50978893",
"0.5085327",
"0.5078358",
"0.50694627",
"0.5067055",
"0.50645995",
"0.5048757",
"0.50361425",
"0.50253534",
"0.5010449",
"0.5001435",
"0.49991494",
"0.49991494",
"0.49991494",
"0.49991494",
"0.49991494",
"0.49949443",
"0.49942324",
"0.49941045",
"0.49941045",
"0.49941045",
"0.49934873",
"0.49934545",
"0.49934503",
"0.49918777",
"0.4991749",
"0.4985518",
"0.4985498",
"0.49708936",
"0.49586827",
"0.49585947",
"0.49537697",
"0.49296716",
"0.49261707",
"0.49158138",
"0.49021032",
"0.49008337",
"0.48998168",
"0.4897973",
"0.48892635",
"0.4886101",
"0.48850447",
"0.487784",
"0.4876717",
"0.48703015",
"0.48646805",
"0.48594993",
"0.48522577",
"0.48500988",
"0.48500735",
"0.4846865",
"0.48457864",
"0.48457864",
"0.48440883",
"0.4830484",
"0.4830484",
"0.48281842",
"0.48091224",
"0.4809009",
"0.48072875"
] |
0.5284418
|
25
|
a bit more sparing of states than alt(reg, nothing)
|
def opt(reg)
return lambda do |pos|
startstate = { '' => Set.new( [pos + 1] ) }
statelist = [startstate]
curpos = pos + statelist.size
statelist += reg.call(curpos)
curpos = pos + statelist.size
startstate[''] << curpos
return statelist
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def alt; end",
"def alt!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n\n type = ALT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 364:6: 'alt'\n match( \"alt\" )\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__, 34 )\n\n end",
"def enter_alt(alt)\n raise NotImplementedError\n end",
"def alt(left, right)\n\t\t\t lambda { |x| left[x] or right[x] }\n\t\t\tend",
"def process_iasgn exp\n exp = exp.dup\n exp.rhs = process exp.rhs\n exp\n end",
"def refute_same(exp, act, msg = T.unsafe(nil)); end",
"def alt?\n @alt\n end",
"def jmp_on_false(label, op = :eax)\n testl(op, op)\n je(label)\n end",
"def refute_in_delta(exp, act, delta = T.unsafe(nil), msg = T.unsafe(nil)); end",
"def refute_alike(exp, act, msg=nil)\n LikeAssay.refute!(act, exp, :message=>msg, :backtrace=>caller)\n end",
"def eth_gpu_rst=(val); eth_ctrl_bit(5, val); end",
"def not_r(idx)\n fail unless 2 <= idx and idx <= 13\n r = Reg.new(idx)\n tmp = Reg.new(idx + 1)\n # r = r & -r\n alu32to(:-, 0, r, tmp)\n alu32to(:&, r, tmp, r)\n # r %= 3\n alu32to(:/, r, 3, tmp)\n alu32to(:*, tmp, 3, tmp)\n alu32to(:-, r, tmp, r)\n # r = (2 ^ r) / 2\n alu32to(:^, 2, r, r)\n alu32to(:>>, r, 1, r)\nend",
"def extra_state; end",
"def src_reg_to_alu_op(reg)\n rnum = reg[1].to_i\n return rnum.even? ? $alu_ops['alu_logic_A'] : $alu_ops['alu_logic_B']\nend",
"def xor_e\n end",
"def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end",
"def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end",
"def refute_false(exp, msg=nil)\n FalseAssay.refute!(exp, :message=>msg, :backtrace=>caller)\n end",
"def state=(_arg0); end",
"def state=(_arg0); end",
"def state=(_arg0); end",
"def call_enn(reg_key, addr, i_reg, m_spec)\n val = get_mem_addr(addr, i_reg)\n @registers[reg_key].word.from_int(-val)\n end",
"def process_lasgn exp\n exp = exp.dup\n exp.rhs = process exp.rhs\n exp\n end",
"def update_state\n raise \"Nothing to do\"\n end",
"def converge(state) ; end",
"def call_ldn(reg_key, addr, i_reg, m_spec)\n call_ld(reg_key, addr, i_reg, m_spec)\n reg = @registers[reg_key]\n reg.word.negate_sign\n end",
"def alt &blk\r\n build_piece Alternatives, blk\r\n end",
"def ein; end",
"def invert() end",
"def refute_true(exp, msg=nil)\n TrueAssay.refute!(exp, :message=>msg, :backtrace=>caller)\n end",
"def diff(exp, act); end",
"def eth_gpu_rst; eth_ctrl_bit(5); end",
"def rest\n @state -= 1 if @state > 2\n @state += 1 if @state < 2\n end",
"def alt?\n expr.is_a?(Array) && expr.first == :alt\n end",
"def refute_same(exp, act, msg=nil)\n IdentityAssay.refute!(act, exp, :message=>msg, :backtrace=>caller)\n end",
"def test_ith_states_on_examples\n assert_equal(@small_dfa.states, @small_dfa.ith_states(0,1,2,3))\n assert_equal([@small_dfa.ith_state(1)], @small_dfa.ith_states(1))\n assert_equal(@small_nfa.states, @small_nfa.ith_states(0,1,2,3))\n assert_equal([@small_nfa.ith_state(1)], @small_nfa.ith_states(1))\n end",
"def misty ci, &blk\n begin\n print 'stack: '; p ci.ctx.stack\n puts 'vars: '; p ci.ctx.vars\n print 'next instruction: '; p ci.peek\n gets\n ci.step\n rescue HaltState\n puts 'halted'\n rescue OpcodeError => err\n puts err.message\n end\nend",
"def alt\n\t\tnode['alt']\n\tend",
"def sigmoidal(activation_value)\n\tneuron_value=1/(1 + 2.71828 ** activation_value)\n\treturn neuron_value\nend",
"def update!(**args)\n @lut = args[:lut] if args.key?(:lut)\n end",
"def activate\n @output = (1.0 / (1.0 + Math.exp(-1 * self.weightedsum - @bias)))\n @output\n end",
"def impose_state(s) # :args: state\n @_hegemon_state = s\n nil end",
"def default_set(v)\n (sigmoid(v) * 2) - 1\n end",
"def trans(the_state, val)\n return the_state, :ignore\n end",
"def setup_rem_state\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n c = @acts[2] || 100\n c = c/100.0 if c.integer?\n if area_flag\n target_array.each do |t|\n if chance(c)\n t.remove_state(@acts[1])\n get_scene.tsbs_redraw_status(t)\n end\n end\n return\n end\n return unless target\n if chance(c)\n target.remove_state(@acts[1])\n get_scene.tsbs_redraw_status(target)\n end\n end",
"def test_initial_state_on_examples\n assert_equal(@small_dfa.ith_state(3), @small_dfa.initial_state())\n end",
"def not\n ~@bits\n end",
"def not(e)\n ((1 << 64) - 1) & (~eval_ex(e))\n end",
"def execute_NOT(operand)\n\t\t# no flags affected\n\t\toperand.value = ~operand.value\n\tend",
"def g(acc,elt)\n acc/elt\nend",
"def g_(acc,elt)\n elt/acc\nend",
"def final_state(state)\n final_states(state)\n end",
"def alpha=(_); end",
"def anneal\n step = 0\n self.start = Time.now\n\n # Precompute factor for exponential cooling from Tmax to Tmin\n if self.tmin <= 0.0\n raise 'Exponential cooling requires a minimum temperature greater than zero.'\n end\n t_factor = -Math.log(self.tmax.to_f / self.tmin)\n\n # Note initial state\n t = self.tmax\n e = self.energy\n\n prev_state = self.state.dup\n prev_energy = e\n best_state = self.state.dup\n best_energy = e\n\n trials, accepts, improves = 0, 0, 0\n if self.updates > 0\n update_wavelength = self.steps / self.updates\n self.update(step, t, e, nil, nil)\n end\n\n # Attempt moves to new states\n while step < self.steps\n step += 1\n t = self.tmax * Math.exp(t_factor * step / self.steps)\n self.move\n e = self.energy\n dE = e - prev_energy\n trials += 1\n\n if dE > 0.0 and Math.exp(-dE / t) < rand()\n # Restore previous state\n self.state = prev_state.dup\n e = prev_energy\n else\n # Accept new state and compare to best state\n accepts += 1\n if dE < 0.0\n improves += 1\n end\n\n prev_state = self.state.dup\n prev_energy = e\n\n if e < best_energy\n best_state = self.state.dup\n best_energy = e\n end\n end\n\n if self.updates > 1\n if step / update_wavelength > (step - 1) / update_wavelength\n self.update(step, t, e, accepts.to_f / trials, improves.to_f / trials)\n trials, accepts, improves = 0, 0, 0\n end\n end\n\n break if best_energy == 0.0\n end\n\n # line break after progress output\n puts\n\n self.state = best_state.dup\n\n # Return best state and energy\n return [best_state, best_energy]\n\n end",
"def for_broke(ci)\n begin\n ci.run\n\n rescue HaltState\n # nop\n rescue err\n puts err.message\n puts 'should not have got this'\n end\nend",
"def invert; end",
"def process_not(exp)\n term = process exp.shift\n return \"!(#{term})\"\n end",
"def set_ignore_aia_state(opts)\n opts = check_params(opts,[:states])\n super(opts)\n end",
"def check_state_ext\n for state in @battler.states.sort {|a,b| $data_states[b].rating <=> $data_states[a].rating}\n return @battler.state_ext = State_Battler[state] if State_Battler[state] != nil\n end\n @battler.state_ext = ''\n end",
"def backup(next_state_ns)\n next_state_ns.map do |next_state_n, probability, reward|\n probability * (reward + @discount * @array_value[next_state_n])\n end.inject(:+)\n end",
"def und\r\n oper = read_or_fix_read\r\n @a &= oper\r\n set_zero_and_negative @a\r\n end",
"def opcode_8XY3(helper)\n\t\thelper.registry_X = helper.registry_X ^ helper.registry_Y\n\tend",
"def value(dendrites_array,num)\n\t\t\tx=activation(dendrites_array,num)\n\t\t\t@value=sigmoidal(x)\n\t\tend",
"def value(dendrites_array,num)\n\t\t\tx=activation(dendrites_array,num)\n\t\t\t@value=sigmoidal(x)\n\t\tend",
"def initial_state=(new_initial_state); end",
"def op_ifenil\n op_ifeeq(nil)\n end",
"def tr!(p0, p1) end",
"def method_missing(sym, *args)\n raise if sym == :reg\n emit(sym, *args)\n end",
"def ~() end",
"def ~() end",
"def elv_blindalys\n !elv_armulys\n end",
"def used_invert\n\t\tif @used\n\t\t\t@used = false\n\t\telse\n\t\t\t@used = true\n\t\tend\n\tend",
"def ibu; end",
"def pry_hooks(ex); end",
"def test_that_unmasking_works\n end",
"def corrector=(_); end",
"def refute_false(exp, msg=nil)\n FalseFailure.refute(exp, :message=>msg, :backtrace=>caller)\n end",
"def pass=(pass); end",
"def inverse_of=(_arg0); end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def refute_equal(exp, act, msg = T.unsafe(nil)); end",
"def invert!(alpha = false); end",
"def things_to_diff(exp, act); end",
"def inactiveG(g, gi, gv)\n not nullG(g, gi, gv) and\n not f(g, gi, gv) and\n not s(g, gi, gv) and\n not terminalG(g, gi, gv) and\n not state(SUSPENDEDG, g, gi, gv) and\n not activeG(g, gi, gv)\nend",
"def op_nop\n end",
"def eth_sw_rst; eth_ctrl_bit(4); end",
"def full_aux?\n @coil_state_normal ? !@aux_state.all? : @aux_state.all?\n end",
"def set_absorbent! \n set_normal! \n @absorbent = true \n end",
"def refute_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end",
"def star(reg)\n return opt(plus(reg))\nend",
"def succ!() end",
"def eat(a)\n @state = @d.call(@state,a)\n final?\n end",
"def activation_system(input)\n b = input\n\n a = b | 65536\n b = 13159625\n\n while a > 0\n b += a & 255\n b &= 16777215\n\n b *= 65899\n b &= 16777215\n\n a /= 256\n end\n\n b\nend",
"def state=(val); region= val; end"
] |
[
"0.63446397",
"0.5824006",
"0.56562275",
"0.5316395",
"0.5261836",
"0.52585137",
"0.52528393",
"0.5120512",
"0.5072245",
"0.5040999",
"0.50188017",
"0.49687326",
"0.4962686",
"0.49578175",
"0.49424246",
"0.4932312",
"0.4932312",
"0.49138054",
"0.4894773",
"0.4894773",
"0.4894773",
"0.48784515",
"0.48660353",
"0.4859137",
"0.48548335",
"0.48525596",
"0.48400965",
"0.48325637",
"0.48299482",
"0.4829472",
"0.48288843",
"0.48257908",
"0.48214176",
"0.48194817",
"0.4819268",
"0.48170316",
"0.47927368",
"0.47853285",
"0.47851557",
"0.47660667",
"0.47645923",
"0.4757351",
"0.4741137",
"0.47332332",
"0.47288352",
"0.47287655",
"0.47174415",
"0.47155643",
"0.47064722",
"0.46951577",
"0.46877655",
"0.4670978",
"0.4654771",
"0.46521342",
"0.46364895",
"0.46301013",
"0.46254587",
"0.46211195",
"0.46197882",
"0.4619017",
"0.46168637",
"0.46168587",
"0.46137774",
"0.46137774",
"0.46136752",
"0.46108422",
"0.45949286",
"0.45916808",
"0.4589662",
"0.4589662",
"0.4587177",
"0.45869988",
"0.45857835",
"0.45847467",
"0.45844054",
"0.45841068",
"0.45827007",
"0.4582673",
"0.45814142",
"0.45806864",
"0.45806864",
"0.45806864",
"0.45806864",
"0.45806864",
"0.45806864",
"0.45806864",
"0.45806864",
"0.45806172",
"0.45786792",
"0.45769954",
"0.45737442",
"0.45733064",
"0.45709392",
"0.45688924",
"0.4566316",
"0.4562755",
"0.45615047",
"0.45599225",
"0.4559319",
"0.45592177",
"0.45525298"
] |
0.0
|
-1
|
AFAIK star effectively has to be implemented this way anyway This does end up with effectively a redundant state. However, AFAICT there is no way to change this without changing the way that the regexp is constructed. It will all be cleaned up anyway in conversion to a DFA (or one of the preliminary steps).
|
def star(reg)
return opt(plus(reg))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def star!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 44 )\n\n type = STAR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 165:8: '*'\n match( 0x2a )\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__, 44 )\n\n end",
"def regexp; end",
"def regexp; end",
"def star\n RLSM::RegExp.new \"(#@string)*\"\n end",
"def star_asgn!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 47 )\n\n type = STAR_ASGN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 168:13: '*='\n match( \"*=\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 47 )\n\n end",
"def regexp=(_arg0); end",
"def start_re=(_); end",
"def start_re; end",
"def translate_pattern_to_regexp(pat)\n i = 0\n n = pat.size\n res = ''\n while i < n\n c = pat[i]\n i = i + 1\n if c == '*'\n j = i\n if j < n and pat[j] == '*'\n res[-1] = '(\\/)?(?<double_asterisk>.*)?'\n i = j + 1\n else\n res = res + '.*'\n end\n elsif c == '?'\n res = res + '.'\n elsif c == '['\n j = i\n # The following two statements check if the sequence we stumbled\n # upon is '[]' or '[^]' because those are not valid character\n # classes.\n if j < n and pat[j] == '^'\n j = j + 1\n end\n if j < n and pat[j] == ']'\n j = j + 1\n end\n # Look for the closing ']' right off the bat. If one is not found,\n # escape the opening '[' and continue. If it is found, process\n # he contents of '[...]'.\n while j < n and pat[j] != ']'\n j = j + 1\n end\n if j >= n\n res = res + '\\\\['\n else\n stuff = pat[i...j].gsub('\\\\', '\\\\\\\\')\n i = j + 1\n #if stuff[0] == '!'\n # stuff = '^' + stuff[1..-1]\n #elsif stuff[0] == '^'\n # stuff = '\\\\' + stuff\n #end\n res = \"#{res}[#{stuff}]\"\n end\n else\n res = res + Regexp.escape(c)\n end\n end\n\n return Regexp.new(res + '$')\nend",
"def monocle(inputString)\n\toptic = Regexp.new(inputString)\n\treturn optic\nend",
"def make_regexp\n @intent = self.intent\n regexp = self.pattern.dup.downcase\n words = regexp.split(\" \")\n words.each do |word|\n if word.include? '/'\n regexp = regexp.gsub(word,\"(#{word})\")\n\n end\n\n end\n regexp = regexp.gsub('/',\"|\")\n regexp = regexp.gsub('^ ','.{0,60}').gsub(' ^','.{0,60}').gsub(' *','.{1,60}').gsub('* ','.{1,60}').gsub('^','.{1,60}').gsub(' [','.{0,60}[')\n regexp = regexp.gsub(' .{0,60}','.{0,60}')\n regexp = regexp.gsub(' .{1,60}','.{1,60}')\n regexp = '.{0,60}' + regexp + '.{0,60}'\n self.regexp = regexp\n chunks = self.pattern.split(' ')\n chunks.each do |ch|\n result= Regexp.new(/\\[.{0,12}\\]/) =~ ch\n if(result==0)\n set = WordSet.find_by_keyword(ch[1..-2])\n str = '(' + set.words.join('|') + ')'\n regexp = self.regexp.gsub(ch,str)\n self.regexp = regexp\n end\n end\n self.save\n end",
"def simplified_pattern\n pattern\n end",
"def simplified_pattern\n pattern\n end",
"def re; end",
"def match(regexp); end",
"def lex_en_regexp_modifiers=(_arg0); end",
"def lex_en_regexp_modifiers=(_arg0); end",
"def lex_en_regexp_modifiers=(_arg0); end",
"def lex_en_regexp_modifiers; end",
"def lex_en_regexp_modifiers; end",
"def lex_en_regexp_modifiers; end",
"def regexps; end",
"def match_string_to_regexp(str)\n #str = str.split(/(\\(\\(.*?\\)\\))(?!\\))/).map{ |x|\n # x =~ /\\A\\(\\((.*)\\)\\)\\Z/ ? $1 : Regexp.escape(x)\n #}.join\n #str = str.gsub(/\\\\\\s+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n\n #str = str.split(/([#$]\\(.*?\\))/).map{ |x|\n # x =~ /\\A[#$]\\((.*)\\)\\Z/ ? ($1.start_with?('#') ? \"(#{$1})\" : $1 ) : Regexp.escape(x)\n #}.join\n #str = str.gsub(/\\\\\\s+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n\n$stderr.puts \"HERE!!!!!!\"\n\n str = str.split(PATTERN).map{ |x|\n case x\n when /\\A\\(\\((.*)\\)\\)\\Z/\n $1\n when /\\A[#$]\\((.*)\\)\\Z/\n $1.start_with?('#') ? \"(#{$1})\" : $1\n else\n Regexp.escape(x)\n end\n }.join\n\n str = str.gsub(/\\\\\\s+/, '\\s+')\n\n Regexp.new(str, Regexp::IGNORECASE)\n\n #rexps = []\n #str = str.gsub(/\\(\\((.*?)\\)\\)/) do |m|\n # rexps << '(' + $1 + ')'\n # \"\\0\"\n #end\n #str = Regexp.escape(str)\n #rexps.each do |r|\n # str = str.sub(\"\\0\", r)\n #end\n #str = str.gsub(/(\\\\\\ )+/, '\\s+')\n #Regexp.new(str, Regexp::IGNORECASE)\n end",
"def to_sp\n regexp_s = self.to_s\n return StringPattern.cache[regexp_s] unless StringPattern.cache[regexp_s].nil?\n regexp = Regexp.new regexp_s\n require \"regexp_parser\"\n default_infinite = StringPattern.default_infinite\n pata = []\n pats = \"\"\n patg = [] # for (aa|bb|cc) group\n set = false\n set_negate = false\n options = []\n capture = false\n\n range = \"\"\n fixed_text = false\n options = regexp.to_s.scan(/\\A\\(\\?([mix]*)\\-[mix]*:/).join.split('')\n last_char = (regexp.to_s.gsub(/\\A\\(\\?[mix]*\\-[mix]*:/, \"\").length) - 2\n Regexp::Scanner.scan regexp do |type, token, text, ts, te|\n if type == :escape\n if token == :dot\n token = :literal\n text = \".\"\n elsif token == :literal and text.size == 2\n text = text[1]\n else\n puts \"Report token not controlled: type: #{type}, token: #{token}, text: '#{text}' [#{ts}..#{te}]\"\n end\n end\n\n unless set || (token == :interval) || (token == :zero_or_one) ||\n (token == :zero_or_more) || (token == :one_or_more) || (pats == \"\")\n if (pats[0] == \"[\") && (pats[-1] == \"]\")\n pats[0] = \"\"\n if (token == :alternation) || !patg.empty?\n if fixed_text\n if patg.size == 0\n patg << (pata.pop + pats.chop)\n else\n patg[-1] += pats.chop\n end\n else\n patg << pats.chop\n end\n else\n if fixed_text\n pata[-1] += pats.chop\n else\n if pats.size == 2\n pata << pats.chop\n else\n pata << \"1:[#{pats}\"\n end\n if last_char == te and type == :literal and token == :literal\n pata << text\n pats = \"\"\n next\n end\n end\n end\n else\n if (token == :alternation) || !patg.empty?\n patg << \"1:#{pats}\"\n else\n pata << \"1:#{pats}\"\n end\n end\n pats = \"\"\n end\n fixed_text = false\n case token\n when :open\n set = true\n pats += \"[\"\n when :close\n if type == :set\n set = false\n if pats[-1] == \"[\"\n pats.chop!\n else\n if set_negate\n pats+=\"%]*\"\n set_negate = false\n else\n pats += \"]\"\n end \n\n end\n elsif type == :group\n capture = false\n unless patg.empty?\n patg << pats if pats.to_s != \"\"\n pata << patg\n patg = []\n pats = \"\"\n end\n end\n when :negate\n if set and pats[-1] == '['\n pats+=\"%\"\n set_negate = true\n end\n when :capture\n capture = true if type == :group\n when :alternation\n if type == :meta\n if pats != \"\"\n patg << pats\n pats = \"\"\n elsif patg.empty?\n # for the case the first element was not added to patg and was on pata fex: (a+|b|c)\n patg << pata.pop\n end\n end\n when :range\n pats.chop! if options.include?('i')\n range = pats[-1]\n pats.chop!\n when :digit\n pats += \"n\"\n when :nondigit\n pats += \"*[%0123456789%]\"\n when :space\n pats += \"_\"\n when :nonspace\n pats += \"*[% %]\"\n when :word\n pats += \"Ln_\"\n when :nonword\n pats += \"$\"\n when :word_boundary\n pats += \"$\"\n when :dot\n pats += \"*\"\n when :literal\n if range == \"\"\n if text.size > 1\n fixed_text = true\n if !patg.empty?\n patg << text.chop\n else\n pata << text.chop\n end\n pats = text[-1]\n else\n pats += text\n pats += text.upcase if options.include?('i')\n end\n else\n range = range + \"-\" + text\n if range == \"a-z\"\n if options.include?('i')\n pats = \"L\" + pats\n else\n pats = \"x\" + pats\n end\n elsif range == \"A-Z\"\n if options.include?('i')\n pats = \"L\" + pats\n else\n pats = \"X\" + pats\n end\n elsif range == \"0-9\"\n pats = \"n\" + pats\n else\n if set\n pats += (range[0]..range[2]).to_a.join\n if options.include?('i')\n pats += (range[0]..range[2]).to_a.join.upcase\n end\n else\n trange = (range[0]..range[2]).to_a.join\n if options.include?('i')\n trange += trange.upcase\n end\n pats += \"[\" + trange + \"]\"\n end\n end\n range = \"\"\n end\n pats = \"[\" + pats + \"]\" unless set\n when :interval\n size = text.sub(\",\", \"-\").sub(\"{\", \"\").sub(\"}\", \"\")\n size+=(default_infinite+size.chop.to_i).to_s if size[-1] == \"-\"\n pats = size + \":\" + pats\n if !patg.empty?\n patg << pats\n else\n pata << pats\n end\n pats = \"\"\n when :zero_or_one\n pats = \"0-1:\" + pats\n if !patg.empty?\n patg << pats\n else\n pata << pats\n end\n pats = \"\"\n when :zero_or_more\n pats = \"0-#{default_infinite}:\" + pats\n if !patg.empty?\n patg << pats\n else\n pata << pats\n end\n pats = \"\"\n when :one_or_more\n pats = \"1-#{default_infinite}:\" + pats\n if !patg.empty?\n patg << pats\n else\n pata << pats\n end\n pats = \"\"\n end\n end\n if pats != \"\"\n if pata.empty?\n if pats[0] == \"[\" and pats[-1] == \"]\" #fex: /[12ab]/\n pata = [\"1:#{pats}\"]\n end\n else\n pata[-1] += pats[1] #fex: /allo/\n end\n end\n if pata.size == 1 and pata[0].kind_of?(String)\n res = pata[0]\n else\n res = pata\n end\n StringPattern.cache[regexp_s] = res\n return res\n end",
"def pre_match() end",
"def lexer_regexp; LEXER_REGEXP end",
"def make_pattern pattern\n state = :close\n rule = ''\n last_ch = ''\n pattern.split('').each do |ch|\n case ch\n when '('\n state = :open\n rule << '('\n when ')'\n state = :close\n rule << ')'\n else\n case state\n when :open\n case last_ch\n when '('\n else\n rule << '|'\n end\n rule << ch\n when :close\n rule << \"[#{ch}]\"\n end\n end\n last_ch = ch\n end\n Regexp.new rule\nend",
"def add_regexp(regexp)\n starting_chars = regexp.starting_chars\n if starting_chars.kind_of? Symbol \n scanning_table.default = regexp\n else\n common_chars = starting_chars.select { |c| scanning_table.has_key? c } \n starting_chars = starting_chars - common_chars\n starting_chars.each { |c| scanning_table[c] = regexp }\n colliding_states = common_chars.map { |c| scanning_table[c] }\n colliding_states.uniq!\n colliding_states.zip(common_chars).each { |r,c| scanning_table[c] = RegexpSpecification.mix(regexp,r) }\n end\t\n \n if @built\n build\n end\n \n self\n end",
"def parse_star(msg, strict = false, name = false)\n !!msg[/#{strict ? \"(\\A|\\W)\" : \"\"}\\*#{strict ? \"(\\z|\\W)\" : \"\"}/i] || name && !!msg[/\\bstar\\b/i]\nend",
"def glob!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 7 )\n\n type = GLOB\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 42:5: ( '?' | '*' )+\n # at file 42:5: ( '?' | '*' )+\n match_count_12 = 0\n while true\n alt_12 = 2\n look_12_0 = @input.peek( 1 )\n\n if ( look_12_0 == 0x2a || look_12_0 == 0x3f )\n alt_12 = 1\n\n end\n case alt_12\n when 1\n # at line \n if @input.peek(1) == 0x2a || @input.peek(1) == 0x3f\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_12 > 0 and break\n eee = EarlyExit(12)\n\n\n raise eee\n end\n match_count_12 += 1\n end\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 7 )\n\n end",
"def pattern2regex(pattern); end",
"def regexp_with_working_captures?(node); end",
"def match(pattern); end",
"def regexp\n @regexp ||= Regexp.compile(source.to_s, Regexp::IGNORECASE)\n end",
"def scan strOrRegexp\n @in.scan /\\s*/ # Skip whitespace\n @match = @in.scan strOrRegexp\n @last_matched_token = @match if @match # Update last matched only if a token was matched\n end",
"def mult\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 59 )\n return_value = MultReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal268 = nil\n __SLASH269__ = nil\n __MOD270__ = nil\n unary267 = nil\n unary271 = nil\n\n tree_for_char_literal268 = nil\n tree_for_SLASH269 = nil\n tree_for_MOD270 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 630:5: unary ( ( '*' | SLASH | MOD ) unary )*\n @state.following.push( TOKENS_FOLLOWING_unary_IN_mult_4179 )\n unary267 = unary\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, unary267.tree )\n end\n # at line 630:11: ( ( '*' | SLASH | MOD ) unary )*\n while true # decision 66\n alt_66 = 2\n look_66_0 = @input.peek( 1 )\n\n if ( look_66_0 == SLASH || look_66_0 == STAR || look_66_0 == MOD )\n alt_66 = 1\n\n end\n case alt_66\n when 1\n # at line 630:14: ( '*' | SLASH | MOD ) unary\n # at line 630:14: ( '*' | SLASH | MOD )\n alt_65 = 3\n case look_65 = @input.peek( 1 )\n when STAR then alt_65 = 1\n when SLASH then alt_65 = 2\n when MOD then alt_65 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 65, 0 )\n end\n case alt_65\n when 1\n # at line 630:16: '*'\n char_literal268 = match( STAR, TOKENS_FOLLOWING_STAR_IN_mult_4186 )\n if @state.backtracking == 0\n\n tree_for_char_literal268 = @adaptor.create_with_payload( char_literal268 )\n root_0 = @adaptor.become_root( tree_for_char_literal268, root_0 )\n\n end\n\n when 2\n # at line 630:23: SLASH\n __SLASH269__ = match( SLASH, TOKENS_FOLLOWING_SLASH_IN_mult_4191 )\n if @state.backtracking == 0\n\n tree_for_SLASH269 = @adaptor.create_with_payload( __SLASH269__ )\n root_0 = @adaptor.become_root( tree_for_SLASH269, root_0 )\n\n end\n\n when 3\n # at line 630:32: MOD\n __MOD270__ = match( MOD, TOKENS_FOLLOWING_MOD_IN_mult_4196 )\n if @state.backtracking == 0\n\n tree_for_MOD270 = @adaptor.create_with_payload( __MOD270__ )\n root_0 = @adaptor.become_root( tree_for_MOD270, root_0 )\n\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_unary_IN_mult_4202 )\n unary271 = unary\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, unary271.tree )\n end\n\n else\n break # out of loop for decision 66\n end\n end # loop for decision 66\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 59 )\n\n end\n \n return return_value\n end",
"def scan(pattern); end",
"def match=(_); end",
"def regexp_tree(name=nil)\n name ||= start_symbol\n env = {}\n each_strongly_connected_component_from(name) {|ns|\n rules = {}\n ns.each {|n|\n\trules[n] = @rules[n]\n }\n\n resolved_rules = {}\n updated = true\n while updated\n\tupdated = false\n\tns.reject! {|n| !rules.include?(n)}\n\n\trs = {}\n\tns.reverse_each {|n|\n\t e = rules[n]\n if !e\n raise ABNFError.new(\"no rule defined: #{n}\")\n end\n\t rs[n] = e.recursion(ns, n)\n\t if rs[n] & OtherRecursion != 0\n\t raise TooComplex.new(\"too complex to convert to regexp: #{n} (#{ns.join(', ')})\")\n\t end\n\t}\n\n\tns.reverse_each {|n|\n\t e = rules[n]\n\t r = rs[n]\n\t if r & SelfRecursion == 0\n\t resolved_rules[n] = e\n\t rules.delete n\n\t rules.each {|n2, e2| rules[n2] = e2.subst_var {|n3| n3 == n ? e : nil}}\n\t updated = true\n\t break\n\t end\n\t}\n\tnext if updated\n\n\t# X = Y | a\n\t# Y = X | b\n\t# => \n\t# Y = Y | a | b\n\tns.reverse_each {|n|\n\t e = rules[n]\n\t r = rs[n]\n\t if r & JustRecursion != 0 && r & ~(NonRecursion|JustRecursion) == 0\n\t e = e.remove_just_recursion(n)\n\t resolved_rules[n] = e\n\t rules.delete n\n\t rules.each {|n2, e2| rules[n2] = e2.subst_var {|n3| n3 == n ? e : nil}}\n\t updated = true\n\t break\n\t end\n\t}\n\tnext if updated\n\n\t# X = X a | b\n\t# =>\n\t# X = b a*\n\tns.reverse_each {|n|\n\t e = rules[n]\n\t r = rs[n]\n\t if r & LeftRecursion != 0 && r & ~(NonRecursion|JustRecursion|LeftRecursion|SelfRecursion) == 0\n\t e = e.remove_left_recursion(n)\n\t resolved_rules[n] = e\n\t rules.delete n\n\t rules.each {|n2, e2| rules[n2] = e2.subst_var {|n3| n3 == n ? e : nil}}\n\t updated = true\n\t break\n\t end\n\t}\n\tnext if updated\n\n\t# X = a X | b\n\t# =>\n\t# X = a* b\n\tns.reverse_each {|n|\n\t e = rules[n]\n\t r = rs[n]\n\t if r & RightRecursion != 0 && r & ~(NonRecursion|JustRecursion|RightRecursion|SelfRecursion) == 0\n\t e = e.remove_right_recursion(n)\n\t resolved_rules[n] = e\n\t rules.delete n\n\t rules.each {|n2, e2| rules[n2] = e2.subst_var {|n3| n3 == n ? e : nil}}\n\t updated = true\n\t break\n\t end\n\t}\n\tnext if updated\n end\n\n if 1 < rules.length\n\traise TooComplex.new(\"too complex to convert to regexp: (#{ns.join(', ')})\")\n end\n\n if rules.length == 1\n\tn, e = rules.shift\n\tr = e.recursion(ns, n)\n\tif r & OtherRecursion != 0\n\t raise TooComplex.new(\"too complex to convert to regexp: #{n} (#{ns.join(', ')})\")\n\tend\n\tif r == NonRecursion\n\t resolved_rules[n] = e\n\telse\n\t # X = a X | b | X c\n\t # =>\n\t # X = a* b c*\n\t left, middle, right = e.split_recursion(n)\n\t resolved_rules[n] = Seq.new(Alt.new(left).rep, Alt.new(middle), Alt.new(right).rep)\n\tend\n end\n\n class << resolved_rules\n include TSort\n\talias tsort_each_node each_key\n\tdef tsort_each_child(n, &block)\n\t self[n].each_var {|n2|\n\t yield n2 if self.include? n2\n\t }\n\tend\n end\n\n resolved_rules.tsort_each {|n|\n env[n] = resolved_rules[n].subst_var {|n2|\n\t unless env[n2]\n\t raise Exception.new(\"unresolved nonterminal: #{n}\") # bug\n\t end\n\t env[n2]\n\t}\n }\n }\n env[name].regexp_tree\n end",
"def star_pattern(stars_num)\n stars_num == 1 ? '*' : \"*#{' ' * (stars_num - 2)}*\"\nend",
"def pattern2regex(pattern)\n tail = pattern\n prefix = String.new\n while !tail.empty? do\n head, sep, tail = tail.partition(/[\\*\\?]/)\n prefix = prefix + Regexp.quote(head)\n case sep\n when '*'\n prefix += '.*'\n when '?'\n prefix += '.'\n when ''\n else\n fail \"Unpexpcted sep:#{sep}\"\n end\n end\n Regexp.new(\"^\" + prefix + \"$\", true)\n end",
"def test_regexp\n# (find-node \"(emacs-ja)Regexps\")\n \n conv = lambda{|from,to| assert_equal(to, el4r_conv_regexp(from)) }\n conv[ //, '' ]\n conv[ /a/, 'a' ]\n conv[ /a./, 'a.' ]\n conv[ /a*/, 'a*' ]\n conv[ /a+/, 'a+' ]\n conv[ /a?/, 'a?' ]\n conv[ /[ab]/, '[ab]' ]\n conv[ /[^ab]/, '[^ab]' ]\n conv[ /^ab/, '^ab' ]\n conv[ /ab$/, 'ab$' ]\n conv[ /a|b/, 'a\\|b' ]\n conv[ /(ab)/, '\\(ab\\)' ]\n conv[ /\\As/, '\\`s' ]\n conv[ /s\\Z/, %q[s\\'] ]\n # \\=\n conv[ /\\bball\\B/, '\\bball\\B']\n # \\<\n # \\>\n conv[ /\\w/, '[0-9A-Za-z_]']\n conv[ /\\W/, '[^0-9A-Za-z_]']\n # \\sC\n # \\SC\n # \\D (number)\n end",
"def on_regexp_beg(token)\n log \"REGEXP_BEG: '#{token}'\"\n super(token)\n end",
"def regexp\n s = Regexp.escape self\n s.gsub! /\\\\\\?/, '[^/]'\n s.gsub! /\\\\\\*/, '[^/]*'\n s.gsub! /\\\\\\[!/, '[^'\n s.gsub! /\\\\\\]/, ']'\n s.gsub! /\\\\\\{/, '('\n s.gsub! /,/, '|'\n s.gsub! /\\\\\\}/, ')'\n Regexp.new s\n end",
"def pattern; end",
"def pattern; end",
"def pattern; end",
"def star; end",
"def submatcher; end",
"def submatcher; end",
"def on_match_pattern_p(node); end",
"def regexp(r0, which)\n source, stop_index = r0.source, r0.stop_index\n return factor_result(source, stop_index, stop_index+$&.length) \\\n if source.index(@regexps[which],stop_index)==stop_index\n terminal_parse_failure(r0, which)\n end",
"def lex_rule start_state, regexp, action = nil\n rules << Rule.new(start_state, regexp, action)\n end",
"def reduce_pattern_sequence(_production, _range, _tokens, theChildren)\n return theChildren[0] if theChildren[1].empty?\n\n successors = theChildren[1].map { |pair| pair[1] }\n if successors[0].kind_of?(Regex::Lookaround) && successors[0].dir == :behind\n Regex::Concatenation.new(successors.shift, theChildren[0], *successors)\n else\n Regex::Concatenation.new(theChildren[0], *successors)\n end\n end",
"def show_regexp(a, re)\n if a =~ re\n \"#{$`}<<#{$&}>>#{$'}\"\n else\n \"no match\"\n end\nend",
"def show_regexp(a, re)\n if a =~ re\n \"#{$`}<<#{$&}>>#{$'}\"\n else\n \"no match\"\n end\nend",
"def show_regexp(a, re)\n if a =~ re\n \"#{$`}<<#{$&}>>#{$'}\"\n else\n \"no match\"\n end\nend",
"def show_regexp(a, re) \n if a =~ re \n \"#{$`}<<#{$&}>>#{$'}\" \n else \n \"no match - #{a} - #{re}\" \n end \nend",
"def match(p0) end",
"def match(p0) end",
"def pattern=(_arg0); end",
"def init_regex(regex)\n optimized_regex=/\\A#{regex}/ # anchor the search\n self.parser=lambda do |parent_node|\n offset = parent_node.next\n if parent_node.src[offset..-1].index(optimized_regex)==0\n range = $~.offset(0)\n range = (range.min+offset)..(range.max+offset)\n TerminalNode.new(parent_node,range,regex)\n end\n end\n self.terminal=true\n end",
"def initialize\n @regexp_handling = 1\n\n @name_to_bitmap = [\n [:_REGEXP_HANDLING_, @regexp_handling],\n ]\n\n @next_bitmap = @regexp_handling << 1\n end",
"def test_extended_patterns_no_flags\n [\n [ \".*\", \"abcd\\nefg\", \"abcd\" ],\n [ \"^a.\", \"abcd\\naefg\", \"ab\" ],\n [ \"^a.\", \"bacd\\naefg\", \"ae\" ],\n [ \".$\", \"bacd\\naefg\", \"d\" ]\n ].each do |reg, str, result|\n m = RustRegexp.new(reg).match(str)\n puts m.inspect\n unless m.nil?\n assert_equal result, m[0]\n end\n end\n end",
"def peek_next\n fail 'No string specified' unless @str\n\n return Token.new(:eos) if skip_space == :eos\n\n PATTERNS.each do |re, func|\n re.match(@str) do |mat|\n @last_re = re # This is what will be removed\n mat = mat.to_s\n return func.is_a?(Symbol) ? send(func, mat) : instance_exec(mat, &func)\n end\n end\n end",
"def scan_for_plus(token); end",
"def gsub(*)\n self\n end",
"def show_regexp(string, pattern)\n match = pattern.match(string)\n if match\n \"#{match.pre_match}->#{match[0]}<-#{match.post_match}\"\n else\n \"no match\"\n end\nend",
"def convert_regexp_handlings str, attrs, exclusive = false\n @regexp_handlings.each do |regexp, attribute|\n next unless exclusive == exclusive?(attribute)\n str.scan(regexp) do\n capture = $~.size == 1 ? 0 : 1\n\n s, e = $~.offset capture\n\n attrs.set_attrs s, e - s, attribute | @attributes.regexp_handling\n end\n end\n end",
"def consume\n return nil if @s.eos?\n\n @s.mark\n return create_token(:whitespace) if @s.scan(RE_WHITESPACE)\n\n char = @s.consume\n\n case char.to_sym\n when :'\"'\n consume_string('\"')\n\n when :'#'\n if @s.peek =~ RE_NAME || valid_escape?\n create_token(:hash,\n :type => start_identifier? ? :id : :unrestricted,\n :value => consume_name)\n else\n create_token(:delim, :value => char)\n end\n\n when :'$'\n if @s.peek == '='\n @s.consume\n create_token(:suffix_match)\n else\n create_token(:delim, :value => char)\n end\n\n when :\"'\"\n consume_string(\"'\")\n\n when :'('\n create_token(:'(')\n\n when :')'\n create_token(:')')\n\n when :*\n if @s.peek == '='\n @s.consume\n create_token(:substring_match)\n\n elsif @options[:preserve_hacks] && @s.peek =~ RE_NAME_START\n # NON-STANDARD: IE * hack\n @s.reconsume\n consume_ident\n\n else\n create_token(:delim, :value => char)\n end\n\n when :+\n if start_number?(char + @s.peek(2))\n @s.reconsume\n consume_numeric\n else\n create_token(:delim, :value => char)\n end\n\n when :','\n create_token(:comma)\n\n when :-\n if start_number?(char + @s.peek(2))\n @s.reconsume\n consume_numeric\n elsif start_identifier?(char + @s.peek(2))\n @s.reconsume\n consume_ident\n elsif @s.peek(2) == '->'\n @s.consume\n @s.consume\n create_token(:cdc)\n else\n create_token(:delim, :value => char)\n end\n\n when :'.'\n if start_number?(char + @s.peek(2))\n @s.reconsume\n consume_numeric\n else\n create_token(:delim, :value => char)\n end\n\n when :/\n if @s.peek == '*'\n @s.consume\n\n if text = @s.scan_until(RE_COMMENT_CLOSE)\n text.slice!(-2, 2)\n else\n text = @s.consume_rest\n end\n\n if @options[:preserve_comments]\n create_token(:comment, :value => text)\n else\n consume\n end\n else\n create_token(:delim, :value => char)\n end\n\n when :':'\n create_token(:colon)\n\n when :';'\n create_token(:semicolon)\n\n when :<\n if @s.peek(3) == '!--'\n @s.consume\n @s.consume\n @s.consume\n\n create_token(:cdo)\n else\n create_token(:delim, :value => char)\n end\n\n when :'@'\n if start_identifier?\n create_token(:at_keyword, :value => consume_name)\n else\n create_token(:delim, :value => char)\n end\n\n when :'['\n create_token(:'[')\n\n when :'\\\\'\n if valid_escape?(char + @s.peek)\n @s.reconsume\n consume_ident\n else\n create_token(:delim,\n :error => true,\n :value => char)\n end\n\n when :']'\n create_token(:']')\n\n when :'^'\n if @s.peek == '='\n @s.consume\n create_token(:prefix_match)\n else\n create_token(:delim, :value => char)\n end\n\n when :'{'\n create_token(:'{')\n\n when :'}'\n create_token(:'}')\n\n when :U, :u\n if @s.peek(2) =~ RE_UNICODE_RANGE_START\n @s.consume\n consume_unicode_range\n else\n @s.reconsume\n consume_ident\n end\n\n when :|\n case @s.peek\n when '='\n @s.consume\n create_token(:dash_match)\n\n when '|'\n @s.consume\n create_token(:column)\n\n else\n create_token(:delim, :value => char)\n end\n\n when :~\n if @s.peek == '='\n @s.consume\n create_token(:include_match)\n else\n create_token(:delim, :value => char)\n end\n\n else\n case char\n when RE_DIGIT\n @s.reconsume\n consume_numeric\n\n when RE_NAME_START\n @s.reconsume\n consume_ident\n\n else\n create_token(:delim, :value => char)\n end\n end\n end",
"def check_scan(s, pattern); end",
"def check_scan(s, pattern); end",
"def create_reg_exp(sport)\n sport_regexp = \"\"\n sport_chars = sport.split \"\"\n sport_chars.each_index do |i|\n # regular expression contains substrings of various lengths\n sport_regexp += \"|\" + \"#{sport_chars[i]}#{sport_chars[i + 1]}#{sport_chars[i + 2]}#{sport_chars[i+3]}\" if i < sport.length - 3\n sport_regexp += \"|\" + \"#{sport_chars[i]}#{sport_chars[i + 1]}#{sport_chars[i + 2]}\" if i < sport.length - 2\n sport_regexp += \"|\" + \"#{sport_chars[i]}#{sport_chars[i + 1]}\" if i < sport.length - 1\n sport_regexp += \"|\" + \"#{sport_chars[i]}\" if i < sport.length\n end\n Regexp.new sport_regexp[1, sport_regexp.length]\nend",
"def match; end",
"def match; end",
"def modify_grammar gm\n def cleanup_entry token, entry\n return {} if entry.nil?\n return entry.map { |subentry| cleanup_entry token, subentry } if entry.is_a?(Array)\n # Convert a reference to a Seeker class to the class itself\n return entry.constantize if entry.is_a?(String) && entry.match(/Seeker$/)\n return entry unless entry.is_a?(Hash)\n # Syntactic sugar: these flags may specify the actual match. Make this explicit\n [\n :checklist, # All elements must be matched, but the order is unimportant\n :or, # The list is taken as an ordered set of alternatives, any of which will match the list\n :repeating, # The spec will be matched repeatedly until the end of input\n :orlist, # The item will be repeatedly matched in the form of a comma-separated, 'and'/'or' terminated list\n # :accumulate, # Accumulate matches serially in a single child\n :optional # Failure to match is not a failure\n ].each do |flag|\n if entry[flag] && entry[flag] != true\n entry[:match], entry[flag] = entry[flag], true\n end\n end\n entry[:match] = cleanup_entry :match, entry[:match] if entry[:match]\n keys = entry.keys.map &:to_sym # Ensure all keys are symbols\n [\n %i{ bound terminus }, # :bound and :terminus are exclusive options\n %i{ atline inline }, # :atline and :inline are exclusive options\n %i{ in_css_match at_css_match after_css_match } # :in_css_match, :at_css_match and :after_css_match are exclusive options\n ].each do |flagset|\n # At most one of the flags in the flagset can be non-nil\n setflags = (entry.slice *flagset).compact # Eliminating the nil flags\n if setflags.count > 1\n wrongstring = ':' + setflags.keys.map(&:to_s).join(', :')\n flagstring = ':' + flagset.map(&:to_s).join(', :')\n raise \"Error: grammar entry for #{token} has #{wrongstring} flags. (Only one of #{flagstring} allowed).\"\n end\n end\n entry\n end # cleanup_entry\n # Do \n def merge_entries original, mod\n return original unless mod && mod != {}\n return mod unless original&.is_a?(Hash)\n mod.each do |key, value|\n if value.nil?\n original.delete key\n else\n original[key] = value.is_a?(Hash) ? merge_entries(original[key], value) : value\n end\n end\n original\n end\n @grammar.keys.each do |key|\n key = key.to_sym\n entry = cleanup_entry key, @grammar[key]\n mod = cleanup_entry key, gm[key]\n @grammar[key] = merge_entries entry, mod # Allows elements to be removed\n end\n end",
"def signature\r\n [@regexp, @replace]\r\n end",
"def signature\r\n [@regexp, @replace]\r\n end",
"def convert_regexp_handling target\n convert_string super\n end",
"def star(pattern, that, topic, type, index)\n input = pattern.to_s.upcase\n input = input.gsub(/(?=\\S)(\\W)/, \" \").squeeze(\" \").strip\n\n # Normalize 'that' \n formatted_that = that.to_s.upcase\n formatted_that = formatted_that.gsub(/(?=\\S)(\\W)/, \" \").squeeze(\" \").strip\n\n # Normalize 'topic'\n formatted_topic = topic.to_s.upcase\n formatted_topic = formatted_topic.gsub(/(?=\\S)(\\W)/, \" \").squeeze(\" \").strip\n\n match, template = recursive_match input.split(\" \"), formatted_that.split(\" \"), formatted_topic.split(\" \"), @nodemap\n\n return \"\" if template == nil\n\n\n # Find appropriate pattern based on the star type.\n words = nil\n if type == 'star'\n #match = match[0..match.index(THAT)]\n words = input.split(\" \")\n \n elsif type == 'thatstar'\n match = match[(match.index(THAT)+1)..match.index(STAR)]\n words = that.split(\" \")\n \n elsif type == 'topicstar'\n match = match[(match.index(TOPIC)+1)..-1]\n words = topic.split(\" \")\n \n else\n raise \"Star Type must be in ['star', 'thatstar', 'topicstar']\"\n end\n \n # compare the input string to the matched pattern, word by word.\n # At the end of this loop, if found_star is true, start and\n # end will contain the start and end indices (in \"words\") of\n # the substring that the desired star matched.\n \n found_star = false\n start = last = j = num_stars = k = 0\n \n for i in (0...words.count)\n # This condition is true after processing a star\n # that ISN'T the one we're looking for.\n next if i < k\n\n # If we're reached the end of the pattern, we're done.\n break if j == match.count\n\n if not found_star\n if [STAR, UNDERSCORE].include?(match[j]) #we got a star\n num_stars += 1\n \n # This is the star we care about.\n found_star = true if num_stars == index\n \n # Iterate through the rest of the string.\n start = i\n for k in (i...words.count)\n # If the star is at the end of the pattern,\n # we know exactly where it ends.\n if j+1 == match.count\n last = words.count\n break\n end\n # If the words have started matching the\n # pattern again, the star has ended.\n if match[j+1] == words[k]\n last = k - 1\n i = k\n break\n end\n end\n end\n # If we just finished processing the star we cared\n # about, we exit the loop early.\n break if found_star\n end\n # Move to the next element of the pattern.\n j += 1\n end\n \n # extract the star words from the original, unmutilated input.\n if found_star\n if type == 'star'\n response = pattern.split(\" \")\n response = response[start..last]\n return response.join(\" \")\n \n elsif type == 'thatstar'\n response = that.split(\" \")\n response = response[start..last]\n return response.join(\" \")\n\n elsif type == 'topicstar'\n response = topic.split(\" \")\n response = response[start..last]\n return response.join(\" \")\n end\n else \n return \"\"\n end\n end",
"def pre_match\n nil\n end",
"def underlying_matcher; end",
"def underlying_matcher; end",
"def token_pattern\n /\\A#{pattern}\\z/\n end",
"def action_char_literal!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 53)\n\n \n # - - - - main rule block - - - -\n # at line 567:4: '\\\\'' (~ ( '\\\\\\\\' | '\\\\'' ) | '\\\\\\\\' . )* '\\\\''\n match(?\\')\n # at line 567:9: (~ ( '\\\\\\\\' | '\\\\'' ) | '\\\\\\\\' . )*\n loop do #loop 14\n alt_14 = 3\n look_14_0 = @input.peek(1)\n\n if (look_14_0.between?(0x0000, ?&) || look_14_0.between?(?(, ?[) || look_14_0.between?(?], 0xFFFF)) \n alt_14 = 1\n elsif (look_14_0 == ?\\\\) \n alt_14 = 2\n\n end\n case alt_14\n when 1\n # at line 567:11: ~ ( '\\\\\\\\' | '\\\\'' )\n if @input.peek(1).between?(0x0000, ?&) || @input.peek(1).between?(?(, ?[) || @input.peek(1).between?(?], 0x00FF)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n when 2\n # at line 567:26: '\\\\\\\\' .\n match(?\\\\)\n match_any\n\n else\n break #loop 14\n end\n end\n match(?\\')\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 53)\n\n end",
"def generalized_delimiter!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 110 )\n\n \n # - - - - main rule block - - - -\n # at line 991:3: ( NESTED_PARENTHESES | NESTED_BRACKETS | NESTED_BRACES | NESTED_ANGLES | ( '!' | '@' | '~' | '`' | '^' | '&' | '*' | '-' | '+' | '=' | '|' | ':' | ';' | '.' | ',' | '?' | '/' | '\\\"' | '\\\\'' ) )\n alt_65 = 5\n case look_65 = @input.peek( 1 )\n when 0x28 then alt_65 = 1\n when 0x5b then alt_65 = 2\n when 0x7b then alt_65 = 3\n when 0x3c then alt_65 = 4\n when 0x21, 0x22, 0x26, 0x27, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x3a, 0x3b, 0x3d, 0x3f, 0x40, 0x5e, 0x60, 0x7c, 0x7e then alt_65 = 5\n else\n raise NoViableAlternative( \"\", 65, 0 )\n end\n case alt_65\n when 1\n # at line 991:5: NESTED_PARENTHESES\n nested_parentheses!\n\n when 2\n # at line 992:5: NESTED_BRACKETS\n nested_brackets!\n\n when 3\n # at line 993:5: NESTED_BRACES\n nested_braces!\n\n when 4\n # at line 994:5: NESTED_ANGLES\n nested_angles!\n\n when 5\n # at line 995:5: ( '!' | '@' | '~' | '`' | '^' | '&' | '*' | '-' | '+' | '=' | '|' | ':' | ';' | '.' | ',' | '?' | '/' | '\\\"' | '\\\\'' )\n if @input.peek( 1 ).between?( 0x21, 0x22 ) || @input.peek( 1 ).between?( 0x26, 0x27 ) || @input.peek( 1 ).between?( 0x2a, 0x2f ) || @input.peek( 1 ).between?( 0x3a, 0x3b ) || @input.peek(1) == 0x3d || @input.peek( 1 ).between?( 0x3f, 0x40 ) || @input.peek(1) == 0x5e || @input.peek(1) == 0x60 || @input.peek(1) == 0x7c || @input.peek(1) == 0x7e\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # --> action\n scan_until_delimiter( @input.peek( -1 ) ) \n # <-- action\n\n end\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 110 )\n\n end",
"def allow_matcher; end",
"def regex_token\n return if @chunk[0] != '/'\n length = heregex_token\n return length if length\n prev = @tokens[-1]\n return if prev && (prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX).include?(prev[0])\n return unless match = @chunk.match(REGEX)\n match, regex, flags = *match\n # Avoid conflicts with floor division operator.\n return if regex == '//'\n if regex[0..1] == '/*'\n raise_syntax_error! 'regular expressions cannot begin with `*`'\n end\n token(:REGEX, \"#{regex}#{flags}\", 0, match.size)\n match.size\n end",
"def pattern\n Regexp.union(pattern_classifiers.map(&:pattern))\n end",
"def sl_comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 39)\n\n type = SL_COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 470:5: '//' ( ' $ANTLR ' SRC | (~ ( '\\\\r' | '\\\\n' ) )* ) ( '\\\\r' )? '\\\\n'\n match(\"//\")\n # at line 471:5: ( ' $ANTLR ' SRC | (~ ( '\\\\r' | '\\\\n' ) )* )\n alt_2 = 2\n alt_2 = @dfa2.predict(@input)\n case alt_2\n when 1\n # at line 471:7: ' $ANTLR ' SRC\n match(\" $ANTLR \")\n src!\n\n when 2\n # at line 472:6: (~ ( '\\\\r' | '\\\\n' ) )*\n # at line 472:6: (~ ( '\\\\r' | '\\\\n' ) )*\n loop do #loop 1\n alt_1 = 2\n look_1_0 = @input.peek(1)\n\n if (look_1_0.between?(0x0000, ?\\t) || look_1_0.between?(0x000B, ?\\f) || look_1_0.between?(0x000E, 0xFFFF)) \n alt_1 = 1\n\n end\n case alt_1\n when 1\n # at line 472:6: ~ ( '\\\\r' | '\\\\n' )\n if @input.peek(1).between?(0x0000, ?\\t) || @input.peek(1).between?(0x000B, ?\\f) || @input.peek(1).between?(0x000E, 0x00FF)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n else\n break #loop 1\n end\n end\n\n end\n # at line 474:3: ( '\\\\r' )?\n alt_3 = 2\n look_3_0 = @input.peek(1)\n\n if (look_3_0 == ?\\r) \n alt_3 = 1\n end\n case alt_3\n when 1\n # at line 474:3: '\\\\r'\n match(?\\r)\n\n end\n match(?\\n)\n # --> action\n channel=HIDDEN;\n # <-- action\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__, 39)\n\n end",
"def on_match_pattern(node); end",
"def match re\n unless re.inspect[1..2] == \"\\\\A\"\n a = re.inspect\n a[0] = \"/\\\\A\"\n re = eval(a)\n end\n @last_match = remaining.match(re)\n end",
"def reserved\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 86 )\n return_value = ReservedReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n set428 = nil\n\n tree_for_set428 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line \n set428 = @input.look\n if @input.peek(1) == GET || @input.peek(1) == IF || @input.peek(1) == IN || @input.peek( 1 ).between?( BREAK, RETURN ) || @input.peek(1) == CASE || @input.peek(1) == CATCH || @input.peek( 1 ).between?( SET, LET ) || @input.peek(1) == DEFAULT || @input.peek(1) == DELETE || @input.peek(1) == SWITCH || @input.peek( 1 ).between?( THIS, DO ) || @input.peek(1) == THROW || @input.peek(1) == TRUE || @input.peek(1) == TRY || @input.peek(1) == TYPEOF || @input.peek(1) == NEW || @input.peek(1) == EACH || @input.peek( 1 ).between?( UNDEFINED, UNLESS ) || @input.peek(1) == UNTIL || @input.peek(1) == FALSE || @input.peek( 1 ).between?( VAR, FINALLY ) || @input.peek( 1 ).between?( VOID, FOR ) || @input.peek(1) == WHILE || @input.peek( 1 ).between?( WITH, FUNCTION ) || @input.peek(1) == YIELD || @input.peek( 1 ).between?( DEF, OBJECT_DEF ) || @input.peek( 1 ).between?( T__148, T__150 )\n @input.consume\n if @state.backtracking == 0\n @adaptor.add_child( root_0, @adaptor.create_with_payload( set428 ) )\n end\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 86 )\n\n end\n \n return return_value\n end",
"def parse(node = @tree)\n result = case node\n when Regexp::Expression::Group::Capture\n # Assumes it's going to be parsed in right order\n group(new_group, sequence(*node.expressions.map { |n| parse(n) }))\n when Regexp::Expression::Alternation\n alternative(*node.expressions.map { |n| parse(n) })\n when Regexp::Expression::Assertion::Lookahead\n [:anchor, :lookahead, sequence(*node.expressions.map { |n| parse(n) })]\n when Regexp::Expression::Assertion::NegativeLookahead\n [:anchor, :negative_lookahead, sequence(*node.expressions.map { |n| parse(n) })]\n when Regexp::Expression::Assertion::Lookbehind\n [:anchor, :lookbehind, sequence(*node.expressions.map { |n| parse(n) })]\n when Regexp::Expression::Assertion::NegativeLookbehind\n [:anchor, :negative_lookbehind, sequence(*node.expressions.map { |n| parse(n) })]\n when Regexp::Expression::CharacterSet\n character_set(node.negative?, node.expressions)\n when Regexp::Expression::Subexpression\n # It's annoyingly subtypes a lot\n unless (node.class == Regexp::Expression::Subexpression or\n node.class == Regexp::Expression::Group::Passive or\n node.class == Regexp::Expression::Root or\n node.class == Regexp::Expression::Alternative)\n raise \"Don't know how to deal with #{node.class}\"\n end\n sequence(*node.expressions.map { |n| parse(n) })\n when Regexp::Expression::Literal\n literal(node.text.chars)\n when Regexp::Expression::CharacterType::Base\n character_type(node.text)\n when Regexp::Expression::EscapeSequence::Base\n character_type(node.text)\n when Regexp::Expression::Backreference::Number\n num = node.text[%r[\\A\\\\(\\d+)\\z], 1] or raise \"Parse error\"\n backref(num.to_i)\n when Regexp::Expression::Anchor::BeginningOfString\n [:anchor, :bos]\n when Regexp::Expression::Anchor::EndOfString\n [:anchor, :eos]\n when Regexp::Expression::Anchor::BeginningOfLine\n [:anchor, :bol]\n when Regexp::Expression::Anchor::EndOfLine\n [:anchor, :eol]\n else\n raise \"Unknown expression\"\n end\n if node.quantified?\n min = node.quantifier.min\n max = node.quantifier.max\n result = if result[0] == :group\n repeat_group(result, min, max)\n else\n repeat(result, min, max)\n end\n end\n\n result\n end",
"def reduce_none_of(_production, _range, _tokens, theChildren)\n raw_literal = theChildren[-1].token.lexeme.dup\n chars = raw_literal.chars.map do |ch|\n Regex::Character.new(ch)\n end\n Regex::CharClass.new(true, *chars)\n end",
"def regexp_literal\n # RegularExpressionLiteral::\n # \t/ RegularExpressionBody / RegularExpressionFlags\n pos0 = @pos\n return nil unless @codes[@pos] == 0x2f\n\n body = regexp_body\n flags = regexp_flags\n return ECMA262::ECMA262RegExp.new(body, flags)\n end",
"def ignorable!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 105 )\n\n \n # - - - - main rule block - - - -\n # at line 941:3: ( '//' (~ ( '\\\\n' | '\\\\r' ) )* ( ( '\\\\r' )? '\\\\n' )? | '/*' ( . )* '*/' | ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' | '\\\\\\\\' ( '\\\\r' )? '\\\\n' )+ )\n alt_44 = 3\n look_44_0 = @input.peek( 1 )\n\n if ( look_44_0 == 0x2f )\n look_44_1 = @input.peek( 2 )\n\n if ( look_44_1 == 0x2f )\n alt_44 = 1\n elsif ( look_44_1 == 0x2a )\n alt_44 = 2\n else\n raise NoViableAlternative( \"\", 44, 1 )\n end\n elsif ( look_44_0 == 0x9 || look_44_0 == 0xc || look_44_0 == 0x20 || look_44_0 == 0x5c || look_44_0 == 0xa0 )\n alt_44 = 3\n else\n raise NoViableAlternative( \"\", 44, 0 )\n end\n case alt_44\n when 1\n # at line 941:5: '//' (~ ( '\\\\n' | '\\\\r' ) )* ( ( '\\\\r' )? '\\\\n' )?\n match( \"//\" )\n # at line 941:10: (~ ( '\\\\n' | '\\\\r' ) )*\n while true # decision 38\n alt_38 = 2\n look_38_0 = @input.peek( 1 )\n\n if ( look_38_0.between?( 0x0, 0x9 ) || look_38_0.between?( 0xb, 0xc ) || look_38_0.between?( 0xe, 0xffff ) )\n alt_38 = 1\n\n end\n case alt_38\n when 1\n # at line 941:10: ~ ( '\\\\n' | '\\\\r' )\n if @input.peek( 1 ).between?( 0x0, 0x9 ) || @input.peek( 1 ).between?( 0xb, 0xc ) || @input.peek( 1 ).between?( 0xe, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 38\n end\n end # loop for decision 38\n # at line 941:28: ( ( '\\\\r' )? '\\\\n' )?\n alt_40 = 2\n look_40_0 = @input.peek( 1 )\n\n if ( look_40_0 == 0xa || look_40_0 == 0xd )\n alt_40 = 1\n end\n case alt_40\n when 1\n # at line 941:30: ( '\\\\r' )? '\\\\n'\n # at line 941:30: ( '\\\\r' )?\n alt_39 = 2\n look_39_0 = @input.peek( 1 )\n\n if ( look_39_0 == 0xd )\n alt_39 = 1\n end\n case alt_39\n when 1\n # at line 941:30: '\\\\r'\n match( 0xd )\n\n end\n match( 0xa )\n\n end\n\n when 2\n # at line 942:5: '/*' ( . )* '*/'\n match( \"/*\" )\n # at line 942:10: ( . )*\n while true # decision 41\n alt_41 = 2\n look_41_0 = @input.peek( 1 )\n\n if ( look_41_0 == 0x2a )\n look_41_1 = @input.peek( 2 )\n\n if ( look_41_1 == 0x2f )\n alt_41 = 2\n elsif ( look_41_1.between?( 0x0, 0x2e ) || look_41_1.between?( 0x30, 0xffff ) )\n alt_41 = 1\n\n end\n elsif ( look_41_0.between?( 0x0, 0x29 ) || look_41_0.between?( 0x2b, 0xffff ) )\n alt_41 = 1\n\n end\n case alt_41\n when 1\n # at line 942:10: .\n match_any\n\n else\n break # out of loop for decision 41\n end\n end # loop for decision 41\n match( \"*/\" )\n\n when 3\n # at line 943:5: ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' | '\\\\\\\\' ( '\\\\r' )? '\\\\n' )+\n # at file 943:5: ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' | '\\\\\\\\' ( '\\\\r' )? '\\\\n' )+\n match_count_43 = 0\n while true\n alt_43 = 6\n case look_43 = @input.peek( 1 )\n when 0x9 then alt_43 = 1\n when 0xc then alt_43 = 2\n when 0x20 then alt_43 = 3\n when 0xa0 then alt_43 = 4\n when 0x5c then alt_43 = 5\n end\n case alt_43\n when 1\n # at line 943:7: '\\\\t'\n match( 0x9 )\n\n when 2\n # at line 943:14: '\\\\f'\n match( 0xc )\n\n when 3\n # at line 943:21: ' '\n match( 0x20 )\n\n when 4\n # at line 943:27: '\\\\u00A0'\n match( 0xa0 )\n\n when 5\n # at line 943:38: '\\\\\\\\' ( '\\\\r' )? '\\\\n'\n match( 0x5c )\n # at line 943:43: ( '\\\\r' )?\n alt_42 = 2\n look_42_0 = @input.peek( 1 )\n\n if ( look_42_0 == 0xd )\n alt_42 = 1\n end\n case alt_42\n when 1\n # at line 943:43: '\\\\r'\n match( 0xd )\n\n end\n match( 0xa )\n\n else\n match_count_43 > 0 and break\n eee = EarlyExit(43)\n\n\n raise eee\n end\n match_count_43 += 1\n end\n\n\n end\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 105 )\n\n end",
"def string!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 98 )\n\n type = STRING\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 897:3: ( '\\\\'' (~ ( '\\\\'' | '\\\\\\\\' ) | '\\\\\\\\' . )* '\\\\'' | '\\\"' (~ ( '\\\"' | '\\\\\\\\' | '#' ) | '\\\\\\\\' . | {...}? => INTERPOLATION | '#' )* '\\\"' )\n alt_16 = 2\n look_16_0 = @input.peek( 1 )\n\n if ( look_16_0 == 0x27 )\n alt_16 = 1\n elsif ( look_16_0 == 0x22 )\n alt_16 = 2\n else\n raise NoViableAlternative( \"\", 16, 0 )\n end\n case alt_16\n when 1\n # at line 897:5: '\\\\'' (~ ( '\\\\'' | '\\\\\\\\' ) | '\\\\\\\\' . )* '\\\\''\n match( 0x27 )\n # at line 897:10: (~ ( '\\\\'' | '\\\\\\\\' ) | '\\\\\\\\' . )*\n while true # decision 14\n alt_14 = 3\n look_14_0 = @input.peek( 1 )\n\n if ( look_14_0.between?( 0x0, 0x26 ) || look_14_0.between?( 0x28, 0x5b ) || look_14_0.between?( 0x5d, 0xffff ) )\n alt_14 = 1\n elsif ( look_14_0 == 0x5c )\n alt_14 = 2\n\n end\n case alt_14\n when 1\n # at line 897:12: ~ ( '\\\\'' | '\\\\\\\\' )\n if @input.peek( 1 ).between?( 0x0, 0x26 ) || @input.peek( 1 ).between?( 0x28, 0x5b ) || @input.peek( 1 ).between?( 0x5d, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n when 2\n # at line 897:31: '\\\\\\\\' .\n match( 0x5c )\n match_any\n\n else\n break # out of loop for decision 14\n end\n end # loop for decision 14\n match( 0x27 )\n\n when 2\n # at line 898:5: '\\\"' (~ ( '\\\"' | '\\\\\\\\' | '#' ) | '\\\\\\\\' . | {...}? => INTERPOLATION | '#' )* '\\\"'\n match( 0x22 )\n # at line 899:5: (~ ( '\\\"' | '\\\\\\\\' | '#' ) | '\\\\\\\\' . | {...}? => INTERPOLATION | '#' )*\n while true # decision 15\n alt_15 = 5\n alt_15 = @dfa15.predict( @input )\n case alt_15\n when 1\n # at line 899:7: ~ ( '\\\"' | '\\\\\\\\' | '#' )\n if @input.peek( 1 ).between?( 0x0, 0x21 ) || @input.peek( 1 ).between?( 0x24, 0x5b ) || @input.peek( 1 ).between?( 0x5d, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n when 2\n # at line 900:7: '\\\\\\\\' .\n match( 0x5c )\n match_any\n\n when 3\n # at line 901:7: {...}? => INTERPOLATION\n raise FailedPredicate( \"STRING\", \" at_interpolation? \" ) unless ( ( at_interpolation? ) )\n interpolation!\n # --> action\n type = DSTRING \n # <-- action\n\n when 4\n # at line 902:7: '#'\n match( 0x23 )\n\n else\n break # out of loop for decision 15\n end\n end # loop for decision 15\n match( 0x22 )\n\n end\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__, 98 )\n\n end",
"def match(input); end",
"def match(str=nil)\n return DelayedMatchConstructor.new unless str\n \n return Atoms::Re.new(str)\n end"
] |
[
"0.66381747",
"0.658676",
"0.658676",
"0.65733165",
"0.65465087",
"0.65069866",
"0.6434461",
"0.6313024",
"0.627578",
"0.614446",
"0.6119185",
"0.6092252",
"0.6092252",
"0.60854095",
"0.6083728",
"0.60592455",
"0.60592455",
"0.60592455",
"0.60528296",
"0.60528296",
"0.60528296",
"0.60345477",
"0.6012366",
"0.6007802",
"0.59753513",
"0.5951009",
"0.5948319",
"0.59252423",
"0.59134203",
"0.58865345",
"0.58604187",
"0.5846945",
"0.5841701",
"0.583702",
"0.58355254",
"0.58293927",
"0.58213294",
"0.58091325",
"0.57781094",
"0.57648593",
"0.57522255",
"0.5740192",
"0.57362455",
"0.5709614",
"0.5708106",
"0.5708106",
"0.5708106",
"0.57048976",
"0.5681915",
"0.5681915",
"0.5668267",
"0.56667995",
"0.56595474",
"0.56312656",
"0.5584295",
"0.5584295",
"0.5584295",
"0.55728817",
"0.55647427",
"0.55647427",
"0.5562925",
"0.5562744",
"0.5551073",
"0.55503803",
"0.55374753",
"0.5536142",
"0.553136",
"0.5499183",
"0.54959685",
"0.5495088",
"0.54855853",
"0.54855853",
"0.54586536",
"0.5451751",
"0.5451751",
"0.5439727",
"0.5436853",
"0.5436853",
"0.5434956",
"0.54255414",
"0.5423346",
"0.54209304",
"0.54209304",
"0.53933144",
"0.5383264",
"0.5372643",
"0.53675246",
"0.5362187",
"0.5361284",
"0.53481215",
"0.534733",
"0.53472924",
"0.53429794",
"0.5341943",
"0.5339135",
"0.53364384",
"0.5297095",
"0.52725375",
"0.5270657",
"0.52698153"
] |
0.64518315
|
6
|
Override ActiveRecord::Core::ClassMethodscached_find_by_statement `.find_by` not use caching
|
def cached_find_by_statement(key, &block)
ActiveRecord::StatementCache.create(connection, &block)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_by()\n\n end",
"def find_by_sql(sql)\n raise \"not implemented\"\n end",
"def execute_find(raw = false)\n get_records\n cached = AridCache::CacheProxy::Result.new\n\n if !records.is_a?(Enumerable) || (!records.empty? && !records.first.is_a?(::ActiveRecord::Base))\n cached = records # some base type, cache it as itself\n else\n cached.ids = records.collect(&:id)\n cached.count = records.size\n if records.respond_to?(:proxy_reflection) # association proxy\n cached.klass = records.proxy_reflection.klass\n elsif !records.empty?\n cached.klass = records.first.class\n else\n cached.klass = object_base_class\n end\n end\n Rails.cache.write(cache_key, cached, opts_for_cache)\n self.cached = cached\n\n # Return the raw result?\n return self.cached if raw\n\n # An order has been specified. We have to go to the database\n # to order because we can't be sure that the current order is the same as the cache.\n if cached.is_a?(AridCache::CacheProxy::Result) && combined_options.include?(:order)\n self.klass = self.cached.klass # TODO used by fetch_from_cache needs refactor\n fetch_from_cache\n else\n process_result_in_memory(records)\n end\n end",
"def find_record_by(model)\n raise_must_override\n end",
"def method_missing(method, *args)\n begin\n if method != :find_by_symbol\n if obj = find_by_symbol(method)\n redefine_method method do\n find_by_symbol(method)\n end\n return obj\n end\n end\n rescue\n # Ignore errors, and call super\n end\n super\n end",
"def find_by(field, value)\n @base.send('find_by_' + field, value)\n end",
"def find_one_with_second_level_cache(id)\n return find_one_without_second_level_cache(id) unless second_level_cache_enabled?\n return find_one_without_second_level_cache(id) unless select_all_column?\n \n id = id.id if ActiveRecord::Base === id\n\n if cachable?\n if record = @klass.read_second_level_cache(id)\n return record\n end\n end\n \n if cachable_without_conditions?\n if record = @klass.read_second_level_cache(id)\n return record if where_match_with_cache?(where_values, record)\n end\n end\n \n record = find_one_without_second_level_cache(id)\n record.write_second_level_cache\n record\n end",
"def find\n raise \"Method not implemented\"\n end",
"def find\n fail NotImplementedError\n end",
"def find(as)\n @cache[as] ||= resolve(as)\n end",
"def find(as)\n @cache[as] ||= resolve(as)\n end",
"def find opt = nil, opts = { }\n opt ||= :all\n \n opts[:limit] = 1 if opt == :first\n\n # self.sql sets self.model_class.\n this_sql = self.sql(opts)\n result = model_class.find_by_sql(this_sql)\n\n result = result.first if opt == :first\n\n result\n end",
"def method_missing(method_name, *args)\n\n method = method_name.to_s\n\n if method.end_with? '!'\n method.chop!\n error_on_empty = true\n end\n\n if method.start_with? 'find_all_by_'\n attribs = method.gsub /^find_all_by_/, ''\n elsif method.start_with? 'find_by_'\n attribs = method.gsub /^find_by_/, ''\n limit(1)\n elsif method.start_with? 'find_first_by_'\n limit(1)\n find_first = true\n attribs = method.gsub /^find_first_by_/, ''\n elsif method.start_with? 'find_last_by_'\n limit(1)\n find_last = true\n attribs = method.gsub /^find_last_by_/, ''\n else\n super\n end\n\n attribs = attribs.split '_and_'\n conditions = {}\n attribs.each { |attr| conditions[attr] = args.shift }\n\n where(conditions, *args)\n load\n raise RecordNotFound if error_on_empty && @records.empty?\n return @records.first if limit_value == 1\n @records\n end",
"def find_by_name(name)\n # self.all.find do |customer|\n # customer.name == name\n # end\n Customer.find_by(name: name)\n end",
"def find(object, parent = @base)\n raise NotImplementedError, \"Subclasses must implement public method find\"\n end",
"def find(query); end",
"def find(query); end",
"def find; end",
"def method_missing(method, *args)\n if method =~ /find/\n finder = method.to_s.split('_by_').first\n attributes = method.to_s.split('_by_').last.split('_and_')\n\n chain = Dynamoid::Criteria::Chain.new(self)\n chain.query = Hash.new.tap {|h| attributes.each_with_index {|attr, index| h[attr.to_sym] = args[index]}}\n \n if finder =~ /all/\n return chain.all\n else\n return chain.first\n end\n else\n super\n end\n end",
"def prepared_finder(meth=OPTS, opts=OPTS, &block)\n # SEQUEL5: Remove\n if block\n raise Error, \"cannot pass both a method name argument and a block of Model.finder\" unless meth.is_a?(Hash)\n meth = meth.merge(:prepare=>true)\n else\n opts = opts.merge(:prepare=>true)\n end\n finder(meth, opts, &block)\n end",
"def _find_record(options)\n if options && options[:lock]\n self.class.preload(strict_loaded_associations).lock(options[:lock]).find_by!(hid: hid)\n else\n self.class.preload(strict_loaded_associations).find_by!(hid: hid)\n end\n end",
"def find(id)\n raise NotImplementedError\n end",
"def find(database_model, lookups)\n record = @cache[database_model].detect do |cached|\n lookups.all? { |column, value| cached.send(column) == value }\n end\n\n return record if record\n\n record = database_model.find_by(lookups)\n self << record if record\n\n record\n end",
"def find(*ids)\n if Georeferencer.configuration.perform_caching && perform_object_caching != false\n ids.uniq!\n uncached_ids = ids.reject {|i| Georeferencer.configuration.cache.read(\"#{cache_key_base}/#{i}\").present?}\n [super(*uncached_ids)].flatten.reject(&:blank?).collect do |object|\n Georeferencer.configuration.logger.debug(\"Caching #{cache_key_base}/#{object.id}\")\n Georeferencer.configuration.cache.write(object.cache_key, object)\n end\n all_objects = ids.collect do |id|\n Georeferencer.configuration.cache.read(\"#{cache_key_base}/#{id}\")\n end\n\n all_objects.each {|o| o.run_callbacks(:find)}\n all_objects.length == 1 ? all_objects.first : all_objects\n else\n super\n end\n end",
"def find_each(opts={})\n if @site\n super.collect do |values|\n record = @site.cached_records[values['_id']]\n record ? record : @constructor.load(@site, values)\n end\n else\n super.collect {|values| @constructor.load(values)}\n end\n end",
"def method_missing(method_id, *arguments)\n if match = /find_(all_by|by)_([_a-zA-Z]\\w*)/.match(method_id.to_s)\n finder = determine_finder(match)\n\n facets = extract_attribute_names_from_match(match)\n super unless all_attributes_exists?(facets)\n\n #Overrride facets to use appropriate attribute name for current locale\n facets.collect! {|attr_name| respond_to?(:globalize_facets) && globalize_facets.include?(attr_name.intern) ? localized_facet(attr_name) : attr_name}\n\n attributes = construct_attributes_from_arguments(facets, arguments)\n\n case extra_options = arguments[facets.size]\n when nil\n options = { :conditions => attributes }\n set_readonly_option!(options)\n ActiveSupport::Deprecation.silence { send(finder, options) }\n\n when Hash\n finder_options = extra_options.merge(:conditions => attributes)\n validate_find_options(finder_options)\n set_readonly_option!(finder_options)\n\n if extra_options[:conditions]\n with_scope(:find => { :conditions => extra_options[:conditions] }) do\n ActiveSupport::Deprecation.silence { send(finder, finder_options) }\n end\n else\n ActiveSupport::Deprecation.silence { send(finder, finder_options) }\n end\n\n else\n raise ArgumentError, \"Unrecognized arguments for #{method_id}: #{extra_options.inspect}\"\n end\n elsif match = /find_or_(initialize|create)_by_([_a-zA-Z]\\w*)/.match(method_id.to_s)\n instantiator = determine_instantiator(match)\n facets = extract_attribute_names_from_match(match)\n super unless all_attributes_exists?(facets)\n\n if arguments[0].is_a?(Hash)\n attributes = arguments[0].with_indifferent_access\n find_attributes = attributes.slice(*facets)\n else\n find_attributes = attributes = construct_attributes_from_arguments(facets, arguments)\n end\n options = { :conditions => find_attributes }\n set_readonly_option!(options)\n\n find_initial(options) || send(instantiator, attributes)\n else\n super\n end\n end",
"def find_by(conditions={})\n raise ArgumentError if conditions.empty?\n query = %(SELECT * FROM #{table_name} #{build_condition(conditions)})\n res = connection.execute(query).first\n\n if res.nil?\n raise RecordNotFound\n end\n res.extend Result::Behavior\n end",
"def find_by(**args)\n where(**args).first\n end",
"def find method=:all, options={}\r\n if method.is_a? Hash\r\n options = method\r\n method= :all\r\n end\r\n if @scope\r\n model_class.send(:with_scope, @scope) {model_class.find method, find_options(options)}\r\n else\r\n model_class.find method, find_options(options)\r\n end\r\n end",
"def find_with_ferret(q, options = {}, find_options = {})\n options[:lazy] = true\n super\n end",
"def find_by_abbreviation!(abbreviation)\n all_cached.detect { |ct| ct.abbreviation == abbreviation } || super\n end",
"def find_by(search = {}, &block)\n block = finder search unless block_given?\n find(&block)\n end",
"def find(id)\n finder_or_run(:find, id)\n end",
"def find(options = {})\n tmp = nil\n @member_class.with_scope(options) do\n tmp = @owner.send(@find_proc, @find_options)\n end\n return tmp\n end",
"def find_on_extension(*args)\n if extended?\n define_extended_class\n finder_type, options = args.first, args.extract_options!\n options = prepare_extended_options(options, finder_type)\n sql = construct_finder_sql(options)\n sql = replace_tables_text(sql)\n result = find_by_sql(sql)\n preload_associations(result, options[:include]) if options[:include]\n [:first,:last].include?(finder_type) ? result.first : result\n else\n find(*args)\n end\n end",
"def find\n model_class.filterrific_find(self)\n end",
"def finder_for(meth)\n # SEQUEL5: Remove\n unless finder = (frozen? ? @finders[meth] : Sequel.synchronize{@finders[meth]})\n finder_loader = @finder_loaders.fetch(meth)\n finder = finder_loader.call(self)\n Sequel.synchronize{@finders[meth] = finder}\n end\n finder\n end",
"def find(id, options = {})\n if model = find_locally(id)\n model\n else\n adapter(model_class).find(id, options)\n end\n end",
"def method_missing(method, *args, &block)\n if name?(method.to_sym)\n find(method.to_sym)\n else\n super\n end\n end",
"def primary_key_lookup(pk)\n ck = cache_key(pk)\n unless obj = cache_get(ck)\n if obj = super(pk)\n cache_set(ck, obj)\n end\n end \n obj\n end",
"def find_by_query(&block)\n finder = block ? block.call(table) : table\n if user_data = execute_sql(:read, :user) { finder.first }\n inflate_model(user_data)\n else\n nil\n end\n end",
"def find_all\n finder_or_run(:find_all)\n end",
"def find_by_id(id)\n raise NotImplementedError.new\n end",
"def find\n super.first\n end",
"def find(id); end",
"def find(id); end",
"def from_param(*options)\n if param_column?\n send \"find_by_#{param_column}\", *options\n else\n find(*options) \n end\n end",
"def find( id )\n model.get( id ).extend( InstanceMethods )\n end",
"def find_by!(*conditions)\n where(*conditions).take!\n end",
"def find_records(predicate)\n raise_must_override\n end",
"def find_by!(arg, *args)\n where(arg, *args).take!\n end",
"def method_missing msg, *args, &block\n model = begin;\n Object.const_get msg\n rescue NameError\n end\n \n if model and model.respond_to?(:descends_from_active_record?) and model.descends_from_active_record?\n model.find args.first\n else\n super\n end\nend",
"def find_record\n if record\n self.new_session = false\n return record\n end\n \n find_with.each do |find_method|\n if send(\"valid_#{find_method}?\")\n self.new_session = false\n return record\n end\n end\n nil\n end",
"def find_by_id(id)\n find_by(:id, id)\n end",
"def promise_find(id)\n sid = id.to_s\n record_in_progress = if _record_cache.has_key?(sid)\n _record_cache[sid]\n else\n self.new(id: id)\n end\n _promise_find(id, record_in_progress)\n end",
"def find_all_by(attributes = {})\n raise NotImplementedError.new\n end",
"def fetch_by_id(id)\n ensure_base_model\n raise_if_scoped\n return unless id\n raise NotImplementedError, \"fetching needs the primary index enabled\" unless primary_cache_index_enabled\n if IdentityCache.should_use_cache?\n\n require_if_necessary do\n object = nil\n coder = IdentityCache.fetch(rails_cache_key(id)){ coder_from_record(object = resolve_cache_miss(id)) }\n object ||= record_from_coder(coder)\n IdentityCache.logger.error \"[IDC id mismatch] fetch_by_id_requested=#{id} fetch_by_id_got=#{object.id} for #{object.inspect[(0..100)]} \" if object && object.id != id.to_i\n object\n end\n\n else\n self.reorder(nil).where(primary_key => id).first\n end\n end",
"def find(*args)\n Collection.new(super, @mapped_collection)\n end",
"def find(record_id) \n result = CONNECTION.execute(\"SELECT * FROM #{self.table_name} WHERE id = #{record_id}\").first\n \n self.new(result)\n end",
"def execute_sql\n # add conditions including the cache_ids and retrieve a count and all of the records\n return @model.find(:all,to_active_record)\n end",
"def prepared_lookup\n # SEQUEL5: Remove\n cached_prepared_statement(:fixed, :lookup){prepare_explicit_statement(filter(prepared_statement_key_array(primary_key)), :first)}\n end",
"def fetch_from_cache\n if paginate?\n\n # Return a paginated collection\n if cached.ids.empty?\n\n # No ids, return an empty WillPaginate result\n [].paginate(opts_for_paginate)\n\n elsif combined_options.include?(:order)\n\n # An order has been specified. We have to go to the database\n # and paginate there because the contents of the requested\n # page will be different.\n klass.paginate(cached.ids, { :total_entries => cached.ids.size }.merge(opts_for_find.merge(opts_for_paginate)))\n\n else\n\n # Order is unchanged. We can paginate in memory and only select\n # those ids that we actually need. This is the most efficient.\n paged_ids = cached.ids.paginate(opts_for_paginate)\n paged_ids.replace(klass.find_all_by_id(paged_ids, opts_for_find(paged_ids)))\n\n end\n\n elsif cached.ids.empty?\n\n # We are returning a regular (non-paginated) result.\n # If we don't have any ids, that's an empty result\n # in any language.\n []\n\n elsif combined_options.include?(:order)\n\n # An order has been specified, so use it.\n klass.find_all_by_id(cached.ids, opts_for_find)\n\n else\n\n # No order has been specified, so we have to maintain\n # the current order. We do this by passing some extra\n # SQL which orders by the current array ordering.\n offset, limit = combined_options.delete(:offset) || 0, combined_options.delete(:limit) || cached.count\n ids = cached.ids[offset, limit]\n\n klass.find_all_by_id(ids, opts_for_find(ids))\n end\n end",
"def method_for_find\n :find_by_slug!\n end",
"def fetch\n @raw_result = opts_for_cache_proxy[:raw] == true\n\n result = if refresh_cache?\n execute_find(@raw_result)\n elsif cached.is_a?(AridCache::CacheProxy::Result)\n if cached.has_ids? && @raw_result\n self.cached # return it unmodified\n elsif cached.has_ids?\n fetch_from_cache # return a list of active records after applying options\n else # true if we have only calculated the count thus far\n execute_find(@raw_result)\n end\n else\n cached # some base type, return it unmodified\n end\n end",
"def find(record_id) \n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n results = QUIZ.execute(\"SELECT * FROM #{table_name} WHERE id = #{record_id}\").first\n self.new(results)\n end",
"def find(*args)\n return super if block_given?\n find_with_ids(*args)\n end",
"def find_record_with_callbacks\n run_callbacks(:before_find)\n result = find_record_without_callbacks\n run_callbacks(:after_find) if result\n result\n end",
"def find(*args, &block)\n if block_given?\n decorated_collection.find(*args, &block)\n else\n ActiveSupport::Deprecation.warn(\"Using ActiveRecord's `find` on a CollectionDecorator is deprecated. Call `find` on a model, and then decorate the result\", caller)\n decorate_item(object.find(*args))\n end\n end",
"def method_missing(method_id, *arguments, &block)\n if match = ActiveRecord::DynamicFinderMatch.match(method_id)\n attribute_names = match.attribute_names\n super unless all_attributes_exist?(attribute_names)\n if !arguments.first.is_a?(Hash) && arguments.size < attribute_names.size\n ActiveSupport::Deprecation.warn(\n \"Calling dynamic finder with less number of arguments than the number of attributes in \" \\\n \"method name is deprecated and will raise an ArguementError in the next version of Rails. \" \\\n \"Please passing `nil' to the argument you want it to be nil.\"\n )\n end\n if match.finder?\n options = arguments.extract_options!\n relation = options.any? ? scoped(options) : scoped\n relation.send :find_by_attributes, match, attribute_names, *arguments\n elsif match.instantiator?\n scoped.send :find_or_instantiator_by_attributes, match, attribute_names, *arguments, &block\n end\n elsif match = ActiveRecord::DynamicScopeMatch.match(method_id)\n attribute_names = match.attribute_names\n super unless all_attributes_exist?(attribute_names)\n if arguments.size < attribute_names.size\n ActiveSupport::Deprecation.warn(\n \"Calling dynamic scope with less number of arguments than the number of attributes in \" \\\n \"method name is deprecated and will raise an ArguementError in the next version of Rails. \" \\\n \"Please passing `nil' to the argument you want it to be nil.\"\n )\n end\n if match.scope?\n self.class_eval <<-METHOD, __FILE__, __LINE__ + 1\n def self.#{method_id}(*args) # def self.scoped_by_user_name_and_password(*args)\n attributes = Hash[[:#{attribute_names.join(',:')}].zip(args)] # attributes = Hash[[:user_name, :password].zip(args)]\n scoped(:conditions => attributes) # scoped(:conditions => attributes)\n end # end\n METHOD\n send(method_id, *arguments)\n end\n else\n super\n end\n end",
"def find_with_cache hash, config\n cache = config.cache.get config.key.(hash, config)\n if cache\n hash = config.deserialize.(cache, config)\n if hash[:version] == config.model_class.unicache_version\n return dataset.row_proc.call hash[:values]\n end\n end\n model = yield\n Write.write model if model\n model\n end",
"def find_by(arg, *args)\n where(arg, *args).take\n end",
"def method_missing(m,*args)\n #find_by_name(\"John\") returns first YamlContentBase object that matches\n if m.to_s.index(\"find_by\") == 0\n attribute = m.to_s.gsub(\"find_by_\",\"\")\n return self.detect{|x| x.send(attribute) == args[0]}\n #find_all_by_name(\"John\") returns array of YamlContentBase objects that match\n elsif m.to_s.index(\"find_all_by\") == 0\n attribute = m.to_s.gsub(\"find_all_by_\",\"\")\n return self.select{|x| x.send(attribute) == args[0]}\n end\n raise \"'#{m}' is not a method\"\n end",
"def find_statement(attr_name, attr_value)\n rateable = self.base_class.name\n sql = sanitize_sql([\"SELECT DISTINCT r2.* FROM rates r1 INNER JOIN \" +\n \"#{rateable.constantize.table_name} r2 ON r1.rateable_id = r2.id \" +\n \"WHERE (r1.[rateable_type] = ? AND r1.[#{attr_name}] = ?)\",\n rateable, attr_value])\n find_by_sql(sql)\n end",
"def find(record_id)\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results= CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{record_id}\")\n if results.empty? \n return nil\n else \n result=results.first\n self.new(result)\n end\n end",
"def opts_for_find(ids=nil)\n ids ||= cached.ids\n find_opts = combined_options.reject { |k,v| !OPTIONS_FOR_FIND.include?(k) }\n find_opts[:order] = preserve_order(ids) unless find_opts.include?(:order)\n find_opts\n end",
"def primary_key_lookup(pk)\n cache[pk]\n end",
"def find_by_sql(sql, binds = [], preparable: nil, &block)\n result_set = connection.select_all(sanitize_sql(sql), \"#{name} Load\", binds, preparable: preparable)\n column_types = {}\n message_bus = ActiveSupport::Notifications.instrumenter\n\n payload = {\n record_count: result_set.length,\n class_name: name\n }\n\n message_bus.instrument(\"instantiation.active_record\", payload) do\n result_set.map { |record| instantiate(record, column_types, &block) }\n end\n end",
"def find(dn = self.dn, options = {})\n # Some misguided attempts to emulate active record.\n case dn\n when :all then search({:limit => false}.merge(options))\n when :first then first(options)\n when Array then dn.map {|d| fetch(d, options)}\n else fetch(dn, options)\n end\n end",
"def find(id)\n find_result\n end",
"def find_for_reload\n self.class.find(self.customer_id, self.id)\n end",
"def find_with_ferret(q, options = {}, find_options = {})\n if respond_to?(:scope) && scope(:find, :conditions)\n if find_options[:conditions]\n find_options[:conditions] = \"(#{find_options[:conditions]}) AND (#{scope(:find, :conditions)})\"\n else\n find_options[:conditions] = scope(:find, :conditions)\n end\n end\n return ActsAsFerret::find q, self, options, find_options\n end",
"def find(*args)\n records = super\n @after.call(records) if @after\n records\n end",
"def find_by_name(name)\n end",
"def find_or(method, attrs = {}, &block)\n where(attrs).first || send(method, attrs, &block)\n end",
"def association_scope_cache(klass, owner, &block)\n key = self\n key = [key, owner._read_attribute(@foreign_type)] if polymorphic?\n key = [key, shard(owner).id].flatten\n klass.cached_find_by_statement(key, &block)\n end",
"def get_record\n recordset = self.get_recordset\n find_by_fields = self.get_find_by_fields\n find_by_key = self.get_model.primary_key\n\n # Find by another column if it's permitted.\n if find_by_query_param && params[find_by_query_param].in?(find_by_fields)\n find_by_key = params[find_by_query_param]\n end\n\n # Filter recordset, if configured.\n if self.filter_recordset_before_find\n recordset = self.get_filtered_data(recordset)\n end\n\n # Return the record.\n if find_by_value = params[:id] # Route key is always :id by Rails convention.\n return self.get_recordset.find_by!(find_by_key => find_by_value)\n end\n return nil\n end",
"def find(id)\n table_name = self.to_s.pluralize.underscore\n results = DATABASE.execute(\"SELECT * FROM #{table_name} WHERE id = #{id}\").first\n self.new(results)\n end",
"def db_find(query=nil)\n return $posts.find(query)\nend",
"def find_locally(id)\n if @all.present?\n @all.find { |model| model.id == id }\n end\n end",
"def find_by_key(key)\n find_by_id(key) # backlog method looks exactly the same except for the parameter type\n end",
"def find(selector = {})\n Query.new(self, selector)\n end",
"def define_find_method(name, builder)\n define_helper \"find_#{name}\", ->(id) { builder.find(id) }\n end",
"def find(id)\n\nend",
"def find\n self.class.find_by_key(@jira_key)\n end",
"def execute *args\n if args.first == :query\n self\n else\n opts = args.last.is_a?(Hash) ? args.last : {}\n results = []\n\n pagination = opts.delete(:paginate) || {}\n model.send(:with_scope, :find => opts) do\n @conditions.paginate(pagination) unless pagination.empty?\n results = model.find args[0], to_find_parameters\n if @conditions.paginate?\n paginate_result_set results, to_find_parameters\n end\n end\n results\n end\n end",
"def finder(*finders)\r\n finders.each do |finder|\r\n instance_eval <<CODE, __FILE__, __LINE__ + 1\r\n#--\r\n# FIXME: This can probably be refactored as:\r\n#\r\n# scoped(args.extract_options!).\\#{finder} *args, &block\r\n#++\r\ndef #{finder}(*args, &block)\r\n options = args.extract_options!\r\n\r\n validate_limit! options\r\n validate_offset! options\r\n\r\n version = options.delete :version\r\n format = options.delete :format\r\n\r\n unless (input = options.delete(:filter)).blank?\r\n query = filter(version)[input]\r\n end\r\n\r\n validate_order!(for_finding = options.dup)\r\n if for_finding[:include]\r\n for_finding[:include] = translate_include for_finding[:include], version\r\n end\r\n\r\n result = model.scoped(query || {}).#{finder} *(args << for_finding), &block\r\n\r\n case result\r\n when nil\r\n # nil\r\n when ActiveRecord::Base\r\n new result, version, format, options.slice(:limit, :include)\r\n when Array\r\n options.update :filter => input if input\r\n\r\n Restful::Resource::Collection.new result.map { |resource|\r\n new resource, version, format\r\n }, format, model.table_name, options\r\n end\r\nend\r\nCODE\r\n end\r\n end",
"def find_by(params = {})\n find_by_index(params) || where(params).first\n end",
"def where(*args)\n #self.class.new(layout, layout.find(*args), args)\n get_results(:find, args)\n end",
"def where(attrs = {})\n return self if attrs.blank?\n self.clone.tap do |r|\n r.query_attrs = r.query_attrs.merge(attrs)\n r.clear_fetch_cache!\n end\n end",
"def find_by(*conditions)\n where(*conditions).take\n end"
] |
[
"0.72358453",
"0.6870087",
"0.6779436",
"0.66328907",
"0.65448064",
"0.6391681",
"0.63457483",
"0.62718374",
"0.6224275",
"0.61801624",
"0.61801624",
"0.6170054",
"0.61586505",
"0.6157591",
"0.6153274",
"0.60969555",
"0.60969555",
"0.60943407",
"0.6061849",
"0.60610247",
"0.6055693",
"0.60233355",
"0.60021514",
"0.59951484",
"0.5972875",
"0.5964386",
"0.59635663",
"0.59603435",
"0.59477043",
"0.59260666",
"0.5910897",
"0.59094554",
"0.5903794",
"0.58836657",
"0.5880423",
"0.5875671",
"0.5859752",
"0.58589435",
"0.58534926",
"0.58387613",
"0.58336383",
"0.5831689",
"0.58099496",
"0.57905114",
"0.57795376",
"0.57795376",
"0.57726717",
"0.5755896",
"0.57358825",
"0.5735531",
"0.5727084",
"0.5725065",
"0.57061696",
"0.56944644",
"0.5689091",
"0.56778663",
"0.5676098",
"0.56676316",
"0.566107",
"0.5652328",
"0.5648265",
"0.56389356",
"0.5636949",
"0.5636272",
"0.5634515",
"0.5621576",
"0.5609417",
"0.5605181",
"0.5582226",
"0.55731106",
"0.5572771",
"0.55695885",
"0.55633914",
"0.55631065",
"0.5561294",
"0.5549252",
"0.554677",
"0.5545141",
"0.55413526",
"0.5535546",
"0.55159557",
"0.55140364",
"0.5513359",
"0.5512197",
"0.55032116",
"0.5503076",
"0.5499377",
"0.5497372",
"0.54917806",
"0.5488732",
"0.548858",
"0.54872173",
"0.5483209",
"0.5479795",
"0.546863",
"0.54657996",
"0.54545593",
"0.54504365",
"0.54492384",
"0.5447662"
] |
0.7276167
|
0
|
test_oi_category_selection Description: This method does the functional testing of the oi_category_selection method from the OI Instruction Controller class
|
def test_io_category_selection
categories = ['Board Preparation', 'Placement',
'Routing', 'Fabrication Drawing',
'Nomenclature', 'Assembly Drawing',
'Other']
# Try accessing from an account that is not a PCB Designer and
# verify that the user is redirected.
get(:oi_category_selection, {:design_id => @mx234a.id}, pat_dfm_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a Teradyne PCB Designer can access the list.
get(:oi_category_selection, { :design_id => @mx234a.id }, scott_designer_session)
assert_response(:success)
assert_not_nil(assigns(:design))
assert_equal(@mx234a.id, assigns(:design).id)
assert_equal('252-234-a0 g', assigns(:design).part_number.pcb_display_name)
assert_not_nil(assigns(:oi_category_list))
oi_category_list = assigns(:oi_category_list)
assert_equal(categories.size, oi_category_list.size)
categories.each_index do |i|
assert_equal(categories[i], oi_category_list[i].name)
end
# Verify that a contractor PCB Designer can access the list.
get(:oi_category_selection, { :design_id => @mx234a.id }, siva_designer_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
#assert_equal("You are not authorized to access this page", flash['notice'])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_feature_for_category\r\n\t\tfeatures = Feature.for_category(categories(:root).id, 99)\r\n\r\n\t\tassert_equal(2, features.length)\r\n\t\tassert_equal(true, features.include?(products(:persian)))\r\n\t\tassert_equal(true, features.include?(products(:cow2)))\r\n\r\n\t\tfeatures = Feature.for_category(categories(:livestock).id, 99)\r\n\r\n\t\tassert_equal(1, features.length)\r\n\t\tassert_equal(true, features.include?(products(:optioner)))\r\n\r\n\t\tfeatures = Feature.for_category(categories(:dogs).id, 99)\r\n\r\n\t\tassert_equal(3, features.length)\r\n\t\tassert_equal(true, features.include?(products(:cow2)))\r\n\t\tassert_equal(true, features.include?(products(:cow3)))\r\n\t\tassert_equal(true, features.include?(products(:optioner))) # inherited from livestock\r\n\r\n\t\tfeatures = Feature.for_category(categories(:dogs).id)\r\n\r\n\t\tassert_equal(1, features.length)\r\n\r\n\t\t# check that the correct number is given when the number to return is < the number of\r\n\t\t# results found in the db\r\n\t\tfeatures = Feature.for_category(categories(:dogs).id, 1)\r\n\r\n\t\tassert_equal(1, features.length)\r\n\r\n\t\tfeatures = Feature.for_category(categories(:dogs).id)\r\n\r\n\t\tassert_equal(1, features.length)\r\n\r\n\t\t# check a blank return\r\n\t\tfeatures = Feature.for_category(categories(:utilities).id, 1)\r\n\r\n\t\tassert_equal(0, features.length)\r\n\tend",
"def selectCategory(data = {})\n self.has_expected_element?\n data = data_for('homepage',data)\n case data['category'].downcase.gsub(/\\s+/, '')\n when 'news&politics'\n news_and_politics_element.click\n when 'style'\n style_element.click\n end\n end",
"def test_passed_by_category(category)\n tests.by_category_name(category)\n end",
"def test_section_selection\n \n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:section_selection,\n { :id => @board_prep.id, :design_id => @mx234a.id },\n pat_dfm_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify that a Teradyne PCB Designer can access the list.\n post(:section_selection,\n {:id => @board_prep.id, :design_id => @mx234a.id},\n scott_designer_session)\n assert_response(:success)\n design = assigns(:design)\n assert_not_nil(design)\n assert_equal(@mx234a.id, design.id)\n assert_equal('252-234-a0 g', design.part_number.pcb_display_name)\n \n category = assigns(:category)\n assert_not_nil(category)\n assert_equal(@board_prep.id, category.id)\n assert_equal('Board Preparation', category.name)\n \n exp_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n sections = assigns(:sections)\n \n exp_sections.each do |exp_section|\n actual_section = sections.shift\n assert_equal(exp_section.id, actual_section.id)\n assert_equal(exp_section.name, actual_section.name)\n assert_equal(exp_section.url1, actual_section.url1)\n assert_equal(exp_section.instructions, actual_section.instructions)\n assert_equal(exp_section.oi_category_id,\n actual_section.oi_category_id)\n assert_equal(exp_section.allegro_board_symbol,\n actual_section.allegro_board_symbol)\n assert_equal(exp_section.outline_drawing_link,\n actual_section.outline_drawing_link)\n end\n \n # Verify that a contractor PCB Designer can not access the list.\n get(:section_selection,\n {:id => @board_prep.id, :design_id => @mx234a.id},\n siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n end",
"def select_category\n puts \"Please select from the following catagories:\\n\\n\"\n category_lister\n puts \"\\n\\n\"\n fact_input\n end",
"def test_should_find_all_option_categories\n @ocats = OptionCategory.all()\n assert_not_nil(@ocats)\n assert(@ocats.length == 3)\n end",
"def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end",
"def select_category\n #Parbauda vai ekrans ir redzams\n @screens.screen_create_filter.visible?\n #Pievieno kategoriju no filtra datiem\n @screens.screen_create_filter.select_row(@filter_data.category)\n end",
"def create_awe_test_for(category)\n awe_priority_test = nil\n \n #puts 'CREATE TEST'\n\n if category[:target_priorities][:test_type] == :no_test # NO TEST\n \n #puts 'CREATE NO TEST'\n \n awe_priority_test = Battle::NoTest.new\n category[:target_priorities][:results][0].each do | target |\n awe_priority_test.pushCategoryToPriority(target)\n end\n \n elsif category[:target_priorities][:test_type] == :line_size_test # LINE SIZE TEST\n \n #puts 'CREATE LINE SIZE TEST'\n \n awe_priority_test = Battle::LineSizeTest.new(category[:target_priorities][:test_category])\n category[:target_priorities][:results][0].each do | target |\n awe_priority_test.pushCategoryToPriorityOnSuccess(target)\n end \n category[:target_priorities][:results][1].each do | target |\n awe_priority_test.pushCategoryToPriorityOnFail(target)\n end \n end\n \n awe_priority_test\n end",
"def select_fittest(category, options = {})\n category = case category\n when Category\n category\n when String\n categories.first(:conditions => ['upper(categories.name) = upper(?)', category])\n end\n uhook_select_fittest category, options unless category.nil?\n end",
"def test_displaying_cat1\n setup_product_tests(true, true, false, true, filt1: 'val1')\n\n assert displaying_cat1?(@product_test.tasks.find_by(_type: 'C1Task'))\n assert displaying_cat1?(@f_test.tasks.find_by(_type: 'Cat1FilterTask'))\n\n assert_equal false, displaying_cat1?(@product_test.tasks.find_by(_type: 'C2Task'))\n assert_equal false, displaying_cat1?(@f_test.tasks.find_by(_type: 'Cat3FilterTask'))\n end",
"def set_test_category\n @test_category = TestCategory.find(params[:id])\n end",
"def test_reset_categories\n assert @work_opinion.categories_string = @new_cat_string\n assert @work_opinion.reload\n assert_equal 2, @work_opinion.categories.size\n assert @work_opinion.categories.include?(@home_cat)\n assert !@work_opinion.categories.include?(@work_cat)\n end",
"def test_display_list\n\n # Nothing selected\n list = Category.display_list\n assert_equal(1, list.size)\n assert_equal(categories(:category1), list[0])\n\n # Non-leaf selected\n list = Category.display_list(categories(:category1))\n assert_equal(6, list.size, list.inspect)\n assert_equal(categories(:category1), list[0])\n assert_equal(categories(:category2), list[1])\n assert_equal(categories(:category3), list[2])\n assert(list[0].selected)\n assert(!list[1].selected)\n assert(!list[2].selected)\n assert(!list[0].indented)\n assert(list[1].indented)\n assert(list[2].indented) \n\n # Leaf selected\n list = Category.display_list(categories(:category3))\n assert_equal(6, list.size)\n assert_equal(categories(:category1), list[0])\n assert_equal(categories(:category2), list[1])\n assert_equal(categories(:category3), list[2])\n assert(!list[0].selected)\n assert(!list[1].selected)\n assert(list[2].selected)\n assert(!list[0].indented)\n assert(list[1].indented)\n assert(list[2].indented)\n\n end",
"def switch\n\n set_type\n\n set_country\n\n set_city\n\n set_area_id_names_generic\n\n # This will find the number of vendors in the current city\n set_shops_count\n\n # This will find the number of areas in the current city\n set_areas_count\n\n self.create_instance_variables# create the instance variables that are totally necessary for the switching the category.\n\n set_sub_categories#called from application_controller, this will set the @sub_categories variable with all the records in Subcategories table.\n\n create_master_hash# create the @master_hash which is very important for search and it holds books_list_id and mobiles_list_id of part-2 after searching in 4 places, :join, :filter, :title, :final for all the subcategories.\n\n set_page(params[:from_pagination].to_i,params[:page].to_i)# called from application_controller, this is set the @page variable which handles pagination navigations.\n\n set_search_case#this method is called from application_controller, it sets the instance variable @search_type from params.\n\n puts \"View #{@view_name} ALREADY EXIST...\"\n\n set_master_hash_from_generic_view# The master_hash which was created in the create_instance_variables method will be set from the generic_view based on the data present in the view_name procured from the url parameter as params[:view_name]\n\n puts \"this is master hash after setting from generic_view #{@master_hash}\"\n\n loop_categories(@sub_category_flag)#This method will take sub_category_id as input and form its left-side bar of the generic page. Categories, filters and count. Located in application_controller, FOR ONLY THE CURRENT Subcategory.\n\n # 2012sep27 : senthil : commented this line out, the importance of this line below is, if its present all the categories will persist even if they are selected, if its removed the selected/clicked category will persist and the other categories will vanish.\n #self.set_products_count_of_other_categories(@master_hash.keys - [@sub_category_flag])\n\n set_category_order(0,1)# This method is called from application_controller, decides which category has to be listed first.\n\n fetch_ad_list_details(\"generic\",0)\n\n render ('search/generic')\n\n end",
"def test_add_multiple_categories_by_string\n total_num_categories = Category.count\n\n categories_to_add = \"%s %s %s\" % [@work_cat.name, @religion_cat.name, \"popular\"]\n \n # check the two categories have been added to the quotation\n assert @work_opinion.set_categories_by_string(categories_to_add)\n assert_equal 3, @work_opinion.categories.size\n \n # check the new category has been added\n assert_equal total_num_categories + 1, Category.count\n assert Category.find_by_name(\"popular\")\n end",
"def test_listable\n assert_equal(0, categories(:category1).listable_products.size)\n assert_equal(2, categories(:category2).listable_products.size)\n assert_equal(products(:product1), categories(:category2).listable_products[0])\n assert_equal(products(:product2), categories(:category2).listable_products[1])\n assert_equal(2, categories(:category3).listable_products.size)\n assert_equal(products(:product3), categories(:category3).listable_products[0])\n assert_equal(products(:product5), categories(:category3).listable_products[1])\n end",
"def test05_EventWithCategories\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_new_event)\n\n \t\t$post_event_title.when_present.set(\"Super fun run #{random}\")\n \t\t$post_event_calendar_start_text.when_present.set(\"#{next_year}-07-04\") #make dynamic?\n \t\t$post_event_time_start_field.when_present.click\n \t\t$post_event_select_time.when_present.select(\"8:00 AM\")\n \t\t$post_event_location.when_present.set(\"Location #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('lava is hot.')\")\n\t\tsleep 4\n\t\t$post_event_type_family.when_present.click\n\t\t$post_event_category_sport.when_present.click\n\t\t$post_now_event.fire_event(\"onclick\")\n\t\tsleep 3\n\t\tassert $post_new_post.exists?\n\t\t#verify details?\n\tend",
"def test_category_not_assigned\n @work_opinion.categories = []\n assert !@work_opinion.save\n end",
"def select_category_255(category_option)\n ui_manager.select_radio_btn(category_locator)\n end",
"def test04_EventWithCategories\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_new_event)\n\n \t\t$post_event_title.when_present.set(\"Super fun run #{random}\")\n \t\t$post_event_calendar_start_text.when_present.set(\"#{next_year}-12-05\") #make dynamic?\n \t\t$post_event_time_start_field.when_present.click\n \t\t$post_event_select_time.when_present.select(\"8:00 AM\")\n \t\t$post_event_location.when_present.set(\"Location #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('lava is hot.')\")\n\t\tsleep 4\n\t\t$post_event_category_sport.when_present.click\n\t\t$post_now_event.fire_event(\"onclick\")\n\t\tsleep 3\n\t\tassert $post_new_post.exists?\n\t\t#verify details?\n\tend",
"def categories\n self.button(:id=>\"entity_group_permissions\").click\n self.button(:text=>\"Categories\").click\n self.wait_until { self.text.include? \"Assign a category\" }\n self.class.class_eval { include AddRemoveCategories }\n end",
"def select_industry_category\n\t\t@industry_categories = IndustryCategory.all.joins(:countries).where(\"countries.id = ?\", session[:country].id).order \"position\"\n\t\t@watch = \"IndustryCategory\"\n\n \t@title_content = 'Servicios para tu Matrimonio'\n \t@meta_description_content = 'Encuentra todos los servicios y productos que necesitas para la organización de tu matrimonio y aprovecha las oportunidades especiales que tenemos para ti'\n\n\tend",
"def select_category3(category_option)\n category_locator = Locator.new(NewRequestWhatLocators::CATEGORY).replace_value('<category>', category_option)\n sp_helper.select_radio_btn(category_locator)\n end",
"def test_truth\r\n assert_kind_of CptCategory, @categories\r\n assert_not_equal @mycategory.id, @categories.id\r\n assert_not_equal @mycategory.description, @categories.description\r\n assert_not_equal @mycategory.level, @categories.level\r\n end",
"def set_category\n match_data = /^What is [-]?\\d+\\s*(?<operation>[\\+\\-\\*\\/])\\s*[-]?\\d+\\?$/.match(self.query) || {}\n self.category = CATEGORIES[match_data[:operation]]\n end",
"def set_category\n end",
"def test03_EventWithCategories\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_new_event)\n\n \t\t$post_event_title.when_present.set(\"Super fun run #{random}\")\n \t\t$post_event_calendar_start_text.when_present.set(\"#{next_year}-11-15\") #make dynamic?\n \t\t$post_event_time_start_field.when_present.click\n \t\t$post_event_select_time.when_present.select(\"8:00 AM\")\n \t\t$post_event_location.when_present.set(\"Location #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('lava is hot.')\")\n\t\tsleep 4\n\t\t$post_event_type_family.when_present.click\n\t\t$post_now_event.fire_event(\"onclick\")\n\t\tsleep 3\n\t\tassert $post_new_post.exists?\n\t\t#verify details?\n\tend",
"def test_category_purged\n religion_cat_original_id = @religion_cat.id\n assert @importance_of_religion.categories_string = @work_cat.name\n assert @importance_of_religion.save\n assert @importance_of_religion.categories.include?(@work_cat)\n assert !@importance_of_religion.categories.include?(@religion_cat)\n assert_raise(ActiveRecord::RecordNotFound) { Category.find(religion_cat_original_id) }\n end",
"def test_find_categories\n @request.env[\"RAW_POST_DATA\"] = \"act\"\n xhr :post, :find_categories, :type => 1, :name => 'genre'\n assert_success\n assert @response.body.include?('add_genre(\\'' + categories(:action).id.to_s + '\\');')\n end",
"def show_category_all_tests\n @category = Category.find_by_slug!(params[:category_slug])\n \n if @category\n @quizzes = Quiz.store_category_quizzes(current_user,@category)\n @quizzes = load_words_for_quizzes(@quizzes)\n @name = @category.name\n else\n @quizzes = []\n end\n \n render \"show_all_tests\"\n \n end",
"def select_object_audit_category(data_set)\n obj_audit = data_set[ConditionCheck::OBJ_AUDIT_CATEGORY.name]\n obj_audit_options_locator = input_options_locator([fieldset(ConditionCheck::OBJ_AUDIT_CATEGORY.name, 0)])\n wait_for_options_and_select(obj_audit_input_locator(0),obj_audit_options_locator, obj_audit) if obj_audit\n end",
"def generate_cat3_tests(args = nil)\n opts = args ? @options.merge(args) : @options\n\n print \"Generating Cat III tests...\"\n\n tests = Measure.top_level.collect do |t|\n opts[:test_type] = t.type == \"ep\" ? \"CalculatedProductTest\" : \"InpatientProductTest\"\n opts[:measure_ids] = [t.hqmf_id]\n self.generate_test(opts)\n end\n\n puts \"done\"\n return tests\n end",
"def ai_selection\n @acceptable_choices.sample\n end",
"def test03_OpenEducation_TC_24397\n\t\tloginGroup\n\t\t\n\t\tsleep 5\n\n\t\t$open_group.fire_event(\"onclick\")\n\t\t$group_name.set(\"Education Group #{random}\")\n\t\t$group_nickname.set(\"Nickname #{random}\")\n\t\t$group_description.set(\"Description #{random}\")\n\t\t$category_education.click\n\t\tchooseExistingIcon\n\t\t$create_group.click\n\t\t\n\t\tcheckIfIncorrectErrorDisplays\n\t\t\n\t\tsleep 5\n\t\t\n\t\tbegin\n\t\tassert $invite_facebook.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO01T03: FAILED! Invite via Facebook button not found\"\n\t\tend\t\n\t\t\n\t\tbegin\n\t\tassert $invite_aol_mail.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO01T03: FAILED! Invite via AOL Mail button not found.\"\n\t\tend\n\t\t\n\t\tbegin\n\t\tassert $invite_email.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO01T03: FAILED! Invite via Email button not found.\"\n\t\tend\n\t\t\n\t\tbegin\n\t\tassert $invite_gmail.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO01T03: FAILED! Invite via Gmail button not found.\"\n\t\tend\n\t\t\n\t\tbegin\n\t\tassert $invite_yahoo.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO01T03: FAILED! Invite via Yahoo button not found.\"\n\t\tend\n\tend",
"def generate_cat1_tests(cat3_tests, args = nil)\n opts = args ? @options.merge(args) : @options\n\n print \"Generating Cat I tests...\"\n\n cat3_tests.each do |t|\n if !ProductTest.where({_type: \"QRDAProductTest\", calculated_product_test: t.id}).exists?\n t.generate_qrda_cat1_test\n end\n end\n\n puts \"done\"\n end",
"def test_cant_add_invalid_categories_string\n @work_opinion.set_categories_by_string(\"\")\n assert !@work_opinion.save\n @work_opinion.set_categories_by_string(@bad_category_string)\n assert !@work_opinion.save\n end",
"def selected_list \n @practice = Practice.find(session[:practice_id], :include => [:icd_codes])\n @category_icd_codes = IcdCode.find(:all,:conditions=>[\"icd_category_id = ?\",params[:id]])\n icd_code_status = false\n for icd_code in @category_icd_codes\n temp = (\"check_\"+ icd_code.id.to_s).to_sym \n if !params[temp].nil? \n icd_code_status = true \n \n @p_icd_info = PracticeIcdList.create(:practice_id => session[:practice_id],\n :icd_code_id => icd_code.id)\n \n else\n \n end\n end\n \n if icd_code_status\n flash.now[:notice] = 'Successfully updated in to your List'\n else\n flash.now[:warning] = 'Enter atleast one ICD code' \n end\n \n @practice.reload\n @icd_codes = @practice.icd_codes.group_by {|icd_code| icd_code.icd_category} \n render :partial=> 'selected_list' \n end",
"def test_icons\n menu\n click \"View\"\n click \"Change View\"\n click \"Icons\"\n menu\n click \"View\"\n click \"Change View\"\n assert_checked \"Icons\"\n click \"List\"\n menu\n click \"View\"\n click \"Change View\"\n assert_checked \"List\"\n end",
"def click_to_search_category_dropdown\n click('Click to categories dropdown', @driver.find_element(:xpath, SEARCH_CATEGORY_BUTTON))\n end",
"def select_category_from_dropdown(category)\n click('Click to select category from dropdown', @driver.find_element(:xpath, DROPDOWN_OPTIONS_FORMAT % [category]))\n end",
"def check_category(text)\n if @browser.link(:title=>text).exists? == false\n puts \"\\nCategory...\\n#{text}\\n...not found in list!\\n\\nPlease check for typos in your test data.\\n\"\n end\n if @browser.link(:title=>text).visible? == false\n @browser.link(:title=>text).parent.parent.parent.ins.click\n end\n if @browser.link(:title=>text).parent.class_name =~ /jstree-unchecked/\n @browser.link(:title=>text).click\n end\n sleep 0.3\n end",
"def test_task_assignment\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_list = [@siva_e]\n \n designer_session = scott_designer_session\n \n \n # Verify that a Teradyne PCB Designer can access the list\n # \n # Section Selection - Other\n get(:section_selection,\n { :id => @other.id, :design_id => @mx234a.id },\n designer_session) \n assert_redirected_to(:action => :process_assignments,\n :category_id => @other.id,\n :design_id => @mx234a.id,\n :section_id => OiCategory.other_category_section_id)\n \n # Section Selection - Board Prep\n get(:section_selection,\n {:id => @board_prep.id, :design_id => @mx234a.id }, \n designer_session)\n assert_equal(board_prep_sections, assigns(:sections))\n assert_equal(0, assigns(:section_id))\n \n # Process Assignments - No step selected\n post(:process_assignments,\n { :design => { :id => @mx234a.id },\n :category => { :id => @board_prep.id } },\n designer_session)\n #assert_equal(\"Please select the step\", flash['notice'])\n assert_nil(flash[:assignment])\n assert_redirected_to(:action => 'section_selection',\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n \n # Process Assignments - No errors\n post(:process_assignments,\n { :section_id => oi_category_sections(:board_prep_1).id,\n :design => { :id => @mx234a.id },\n :category => { :id => @board_prep.id } },\n designer_session)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n \n lcr_team_members = assigns(:team_members)\n expected_team_members = [@siva_e, @mathi_n] \n assert_equal(expected_team_members, lcr_team_members)\n \n assert_equal(oi_category_sections(:board_prep_1).id,\n assigns(:selected_step).id)\n \n instruction = assigns(:instruction)\n assert_equal(@board_prep.id, instruction.oi_category_section_id)\n assert_equal(@mx234a.id, instruction.design_id)\n \n assignment = assigns(:assignment)\n assert_equal((Time.now+1.day).year, assignment.due_date.year)\n assert_equal((Time.now+1.day).month, assignment.due_date.month)\n assert_equal((Time.now+1.day).day, assignment.due_date.day)\n assert_equal(OiAssignment.complexity_id('Low'), assignment.complexity_id)\n \n assert_not_nil(assigns(:comment))\n \n assert(!assigns(:selected_step).outline_drawing_link?)\n \n allegro_board_symbol = '10987654321'\n assignment_comment = 'This is a test'\n medium_complexity_id = OiAssignment.complexity_id('Medium')\n due_date = Time.local(2007, \"May\", 1)\n \n # Process Assignment Details - No allegro board symbol provided.\n post(:process_assignment_details,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '1', \"5005\" => '1' } },\n designer_session,\n {:assignment => {:instruction => \"\",\n :member_selections => \"\",\n :comment => \"\",\n :assignment => \"\"\n } }\n )\n #assert_equal('Please identify the Allegro Board Symbol', flash['notice'])\n #assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n #assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n #assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n #assert_not_nil(assignment[:design])\n #assert_equal(@mx234a.id, assignment[:design].id)\n #flash[:assignment][:design].name = 'abc'\n \n #assert_not_nil(assignment[:selected_step])\n #assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n #assert_not_nil(assignment[:instruction])\n #assert_equal(board_prep_sections[0].id,\n # assignment[:instruction].oi_category_section_id)\n \n #assert_not_nil(assignment[:member_selections])\n #assert_equal({ \"5004\" => '1', \"5005\" => '1' }, assignment[:member_selections])\n \n #assert_not_nil(assignment[:team_members])\n #assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n #assert_not_nil(assignment[:comment])\n #assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\nreturn \n follow_redirect!\n \n #Verify that the variable where loaded from the flash.\n #assert_equal(assignment[:design], assigns(:design)) \n #assert_equal(assignment[:category], assigns(:category))\n #assert_equal(assignment[:team_members], assigns(:team_members))\n #assert_equal(assignment[:selected_step], assigns(:selected_step))\n #assert_equal(assignment[:instruction], assigns(:instruction))\n #assert_equal(assignment[:assignment], assigns(:assignment))\n #assert_equal(assignment[:comment], assigns(:comment))\n #assert_not_nil(flash[:assignment])\n #assert_nil(assigns(:outline_drawing))\n \n \n # Process Assignment Details - No team members identified.\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s,\n :allegro_board_symbol => allegro_board_symbol },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '0', \"5005\" => '0' })\n\n assert_equal('Please select a team member or members', flash['notice'])\n assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n assert_not_nil(assignment[:design])\n assert_equal(@mx234a.id, assignment[:design].id)\n flash[:assignment][:design].name = 'abc'\n \n assert_not_nil(assignment[:selected_step])\n assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n assert_not_nil(assignment[:instruction])\n assert_equal(board_prep_sections[0].id,\n assignment[:instruction].oi_category_section_id)\n \n assert_not_nil(assignment[:member_selections])\n assert_equal({ \"5004\" => '0', \"5005\" => '0' }, assignment[:member_selections])\n \n assert_not_nil(assignment[:team_members])\n assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n assert_not_nil(assignment[:comment])\n assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\n \n follow_redirect\n \n #Verify that the variable where loaded from the flash.\n assert_equal(assignment[:design], assigns(:design)) \n assert_equal(assignment[:category], assigns(:category))\n assert_equal(assignment[:team_members], assigns(:team_members))\n assert_equal(assignment[:selected_step], assigns(:selected_step))\n assert_equal(assignment[:instruction], assigns(:instruction))\n assert_equal(assignment[:assignment], assigns(:assignment))\n assert_equal(assignment[:comment], assigns(:comment))\n assert_not_nil(flash[:assignment])\n assert_nil(assigns(:outline_drawing))\n \n section_selections = {}\n section_ids.each { |id| section_selections[id.to_s] = '0' }\n\n # Process Assignment Details - No team members identified and no allegro board symbol\n # provided.\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '0', \"5005\" => '0' })\n\n assert_equal('Please identify the Allegro Board Symbol<br />' +\n 'Please select a team member or members', \n flash['notice'])\n assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n assert_not_nil(assignment[:design])\n assert_equal(@mx234a.id, assignment[:design].id)\n flash[:assignment][:design].name = 'abc'\n \n assert_not_nil(assignment[:selected_step])\n assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n assert_not_nil(assignment[:instruction])\n assert_equal(board_prep_sections[0].id,\n assignment[:instruction].oi_category_section_id)\n \n assert_not_nil(assignment[:member_selections])\n assert_equal({ \"5004\" => '0', \"5005\" => '0' }, assignment[:member_selections])\n \n assert_not_nil(assignment[:team_members])\n assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n assert_not_nil(assignment[:comment])\n assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\n \n follow_redirect\n \n #Verify that the variable where loaded from the flash.\n assert_equal(assignment[:design], assigns(:design)) \n assert_equal(assignment[:category], assigns(:category))\n assert_equal(assignment[:team_members], assigns(:team_members))\n assert_equal(assignment[:selected_step], assigns(:selected_step))\n assert_equal(assignment[:instruction], assigns(:instruction))\n assert_equal(assignment[:assignment], assigns(:assignment))\n assert_equal(assignment[:comment], assigns(:comment))\n assert_not_nil(flash[:assignment])\n assert_nil(assigns(:outline_drawing))\n\n instruction_count = OiInstruction.count\n assignment_count = OiAssignment.count\n assignment_comment_count = OiAssignmentComment.count\n \n \n post(:view_assignments,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(0, assigns(:assignment_list).size)\n \n\n # Process Assignment Details - No errors\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s,\n :allegro_board_symbol => allegro_board_symbol },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '1', \"5005\" => '1' })\n\n assert_equal('The work assignments have been recorded - mail was sent',\n flash['notice'])\n assert_nil(flash[:assignment])\n\n assert_redirected_to(:action => 'oi_category_selection',\n :design_id => @mx234a.id)\n \n \n assert_equal(instruction_count+1, OiInstruction.count)\n instructions = OiInstruction.find(:all)\n last_instruction = instructions.pop\n assert_equal(@scott_g.id, last_instruction.user_id)\n assert_equal(allegro_board_symbol, last_instruction.allegro_board_symbol)\n assert_equal(board_prep_sections[0].id, last_instruction.oi_category_section_id)\n \n assert_equal(assignment_count+2, OiAssignment.count)\n assignments = OiAssignment.find(:all)\n mathi_assignment = assignments.pop\n siva_assignment = assignments.pop\n \n assert(!siva_assignment.complete?)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(last_instruction.id, siva_assignment.oi_instruction_id)\n assert_equal(due_date.to_i, siva_assignment.due_date.to_i)\n assert_equal(medium_complexity_id, siva_assignment.complexity_id)\n\n assert(!mathi_assignment.complete?)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n assert_equal(last_instruction.id, mathi_assignment.oi_instruction_id)\n assert_equal(due_date.to_i, mathi_assignment.due_date.to_i)\n assert_equal(medium_complexity_id, mathi_assignment.complexity_id)\n \n assert_equal(assignment_comment_count+2, OiAssignmentComment.count)\n assignment_comments = OiAssignmentComment.find(:all)\n mathi_comment = assignment_comments.pop\n siva_comment = assignment_comments.pop\n \n assert_equal(siva_assignment.id, siva_comment.oi_assignment_id)\n assert_equal(@scott_g.id, siva_comment.user_id)\n assert_equal(assignment_comment, siva_comment.comment)\n \n assert_equal(mathi_assignment.id, mathi_comment.oi_assignment_id)\n assert_equal(@scott_g.id, mathi_comment.user_id)\n assert_equal(assignment_comment, mathi_comment.comment)\n \n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n set_user(@pat_a.id, 'Product Support')\n post(:process_assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n\n # Verify that a contractor PCB Designer can not access the list.\n set_user(@siva_e.id, 'Designer')\n post(:process_assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify the email that was generated\n expected_to = [ [ @siva_e.email ].sort,\n [ @mathi_n.email ].sort,\n [ @siva_e.email, @mathi_n.email ].sort ]\n \n expected_cc_list = [@scott_g.email,\n @jim_l.email, \n @jan_k.email,\n users(:bala_g).email,\n @cathy_m.email].sort\n \n assert_equal(2, @emails.size) \n mathi_email = @emails.pop\n siva_email = @emails.pop\n \n assert_equal(1, siva_email.to.size)\n assert_equal(@siva_e.email, siva_email.to.pop)\n assert_equal(expected_cc_list, siva_email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment created',\n siva_email.subject)\n\n assert_equal(1, mathi_email.to.size)\n assert_equal(@mathi_n.email, mathi_email.to.pop)\n assert_equal(expected_cc_list, mathi_email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment created', \n mathi_email.subject)\n\n # Verify that a user from outside the PCB Group can not \n # access the view_assignments view\n set_user(@pat_a.id, 'Product Support')\n post(:view_assignments)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n\n # Verify that a contractor PCB Designer can not access the \n # view_assignments view\n set_user(@siva_e.id, 'Designer')\n post(:view_assignments)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify that a Teradyne PCB Designer can access the \n # view_assignments view\n set_user(@scott_g.id, 'Designer')\n post(:view_assignments,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n \n assignment_list = assigns(:assignment_list)\n assert_equal(1, assignment_list.size)\n \n expected_sections = board_prep_sections.dup\n \n # There is only on category populated\n assignment_list.each do |category, assignments|\n assert_equal(expected_sections.shift.id, category.id)\n assert_equal(2, assignments.size)\n end\n \n # Verify that a user from outside the PCB Group can not \n # access the assignment_view view\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_view)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a Teradyne PCB Designer can access the \n # the assignment_view view\n set_user(@scott_g.id, 'Designer')\n assignment_id = assignments.pop.id\n post(:assignment_view, :id => assignment_id)\n \n assert_response(:success)\n assert_equal(assignment_id, assigns(:assignment).id)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n\n comments = assigns(:comments)\n assert_equal(1, comments.size)\n comment = comments.pop\n assert_equal(assignment_comment, comment.comment)\n \n assert_not_nil(assigns(:post_comment))\n \n \n # Verify that a user from outside the PCB Group can not \n # access the category_details view\n set_user(@pat_a.id, 'Product Support')\n post(:category_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a contractor Team Member can access the \n # category_details view\n set_user(@siva_e.id, 'Designer')\n post(:category_details, :id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n \n siva_assignments = assigns(:category_list)\n assert_equal(2, siva_assignments.size)\n assert_not_nil(siva_assignments[@board_prep])\n \n assignment_list = siva_assignments[@board_prep]\n assert_equal(1, assignment_list.size)\n assert_not_nil(assignment_list.detect { |a| \n a.oi_instruction.oi_category_section_id == board_prep_sections[0].id }) \n assignment_list.each { |a| assert_equal(@siva_e.id, a.user_id) }\n\n # Verify that a user from outside the PCB Group can not \n # access the assignment_details view\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a contractor Team Member can access the \n # category_details view\n set_user(@siva_e.id, 'Designer')\n post(:assignment_details,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n \n section_list = assigns(:section_list)\n assert_equal('Board Preparation', section_list[:category].name)\n assert_equal(1, section_list[:assignment_list].size)\n assert_equal(1, section_list[:assignment_list][0].oi_instruction.oi_category_section_id)\n\n\n # Verify that a user from outside the PCB Group can not \n # update an assignment.\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_update)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify that a member of the PCB Design group can \n # update an assignment\n set_user(@siva_e.id, 'Designer')\n \n # Get the instruction with 2 assignments associated with it\n instruction = OiInstruction.find_by_design_id_and_oi_category_section_id(\n @mx234a.id,\n board_prep_sections[0].id)\n\n siva_assignment = instruction.oi_assignments.detect { |a| a.user_id == @siva_e.id }\n mathi_assignment = instruction.oi_assignments.detect { |a| a.user_id == @mathi_n.id }\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(1, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n siva_assignment_comment = siva_assignment.oi_assignment_comments.pop\n mathi_assignment_comment = mathi_assignment.oi_assignment_comments.pop\n assert_not_equal(siva_assignment_comment.id, mathi_assignment_comment.id)\n\n\n post(:assignment_update,\n :assignment => siva_assignment,\n :post_comment => {:comment => 'My 2 cents'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(2, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n cc_list = expected_cc_list.dup + [@siva_e.email] - [@scott_g.email]\n email = @emails.pop\n assert_equal([@scott_g.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update',\n email.subject)\n\n\n post(:assignment_update,\n :assignment => { :id => siva_assignment.id,\n :complete => \"1\"},\n :post_comment => {:comment => 'It is done'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(3, siva_assignment.oi_assignment_comments.size)\n assert_equal(1, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n email = @emails.pop\n assert_equal([@scott_g.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update - Completed',\n email.subject)\n \n set_user(@scott_g.id, 'Designer')\n post(:assignment_update,\n :assignment => { :id => siva_assignment.id,\n :complete => \"0\"},\n :post_comment => {:comment => 'My 2 cents'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(4, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n cc_list = expected_cc_list.dup\n email = @emails.pop\n assert_equal([@siva_e.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update - Reopened',\n email.subject)\n \n end",
"def random_category_action\n category = (QuickSearch::Engine::APP_CONFIG['searchers'] + ['spelling-suggestion', 'result-types', 'doi-trap', 'more-options']).sample.dasherize\n # Default action is a click\n action = 'click'\n\n # Typically, serves only happen for these categories\n if category == 'best-bets' || category == 'spelling-suggestion'\n action = ['click', 'serve'].sample\n end\n\n return category, action\nend",
"def test_is_applicable_to_test_models\n\t[\"LargeHotel-90.1-2010-ASHRAE 169-2006-3B.osm\", \"LargeOffice-90.1-2010-ASHRAE 169-2006-5A.osm\", \"MediumOffice-90.1-2010-ASHRAE 169-2006-5A.osm\", \"PrimarySchool-90.1-2007-ASHRAE 169-2006-2A.osm\", \"SecondarySchool-90.1-2010-ASHRAE 169-2006-4A.osm\", \"SmallHotel-90.1-2010-ASHRAE 169-2006-3B.osm\", \"SmallOffice-90.1-2010-ASHRAE 169-2006-2A.osm\"].each do |m|\n\t\tresult,_ = applytotestmodel(m)\n\t\tassert_equal(\"Success\", result.value.valueName)\n end\n end",
"def test_return_category_id\n assert_equal(1, Products.return_category_id(1))\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 set_lectures\r\n @category = Category.find(params[:category_id])\r\n end",
"def random_item(category)\n if category == 'best-bets'\n # Sample a random Best Bet type from a static list\n ['webofscience', 'googlescholar', 'ieee', 'pubmed', 'morningstar', 'wgsn', 'standards', 'dissertation', 'refworks', 'ibis', 'proquest',\n 'psychinfo', 'sciencemagazine', 'sciencedirect', 'petition', 'compendex', 'jstor', 'software', 'naturejournal'].sample\n elsif category == 'doi-trap'\n # Sample a random DOI from a static list\n ['10.1080/10510974.2013.797483', '10.1111/j.1468-2958.1996.tb00379.x', 'http://dx.doi.org/10.1063/1.2741534', 'DOI: 10.1007/BF02887151',\n '10.1039/C4RA16247A', '10.1002/sce.3730670213', 'DOI: 10.1007/s40596-014-0241-5', '10.1080/15348423.2012.697437',\n 'http://dx.doi.org/10.3168/jds.S0022-0302(86)80552-5', 'DOI: 10.1023/A:1005204727421', '10.1039/C3TA00019B', 'doi:10.1038/leu.2016.163',\n 'DOI: 10.1007/s10853-013-7374-x', 'doi: 10.1016/0167-2738(91)90233-2', 'doi: 10.1179/000705992798268927', '10.1038/nphys3794',\n 'doi: 10.1149/1.1393288', '10.1080/1554480X.2014.926052', '10.1002/adma.201506234', '10.1080/00958972.2016.1176158'].sample\n elsif category == 'result-types'\n # Use a defined searcher for found types\n (QuickSearch::Engine::APP_CONFIG['searchers']).sample.dasherize\n elsif category == 'more-options'\n # Use a result number for more-options\n ['result-1', 'result-2', 'result-3', 'result-4'].sample\n elsif category == 'spelling-suggestion'\n # Use a fake string\n 'spelling suggestion ' + (rand*200).to_i.to_s\n else\n # Use one of the typical options for a searcher click (or anything else we haven't handled above)\n ['heading', 'result-1', 'result-2', 'result-3', 'see-all-results', 'no-results', 'error'].sample\n end \nend",
"def select_category_option(value, _)\n locators = %w[.cucumber-popular-item .cucumber-item]\n locators.each do |locator|\n return find(locator, text: value).click if page.has_css?(locator, text: value)\n end\n raise Capybara::ElementNotFound.new(\"Can't click on #{value} target option\")\n end",
"def category_view(prompt, categories, inventory)\r\n \r\n system 'clear'\r\n \r\n # Asks user which category they'd like to view\r\n choose_categories = []\r\n categories.each { |hash| choose_categories << hash[:category]}\r\n category_to_view = prompt.select(\"Which category would you like to view?\", choose_categories)\r\n\r\n # Finds all sub-categories within chosen category\r\n sub_categories = []\r\n categories.each { |hash| hash[:sub_categories].each{ |hash| hash.each { |k, v| sub_categories << k }} if hash[:category] == category_to_view }\r\n \r\n # Iterate over list of sub_categories within chosen category and display them to the user using display_method\r\n system 'clear'\r\n string_in_line(\" #{category_to_view.upcase.colorize(:light_green)} \", 114) ; puts\r\n sub_categories.each { |sub_cat| display_method(inventory, sub_cat.to_s)}\r\n\r\n end",
"def test02_OpenOpinion\n\t\tloginGroup\n\t\t\n\t\tcheckIfIncorrectErrorDisplays\n\t\t\n\t\tsleep 5\n\n\t\t$open_group.fire_event(\"onclick\")\n\t\t$group_name.set(\"Opinion Group #{random}\")\n\t\t$group_nickname.set(\"Nickname #{random}\")\n\t\t$group_description.set(\"Description #{random}\")\n\t\t$category_opinion.click\n\t\tchooseExistingIcon\n\t\t$create_group.click\n\t\t\n\t\tcheckIfIncorrectErrorDisplays\n\t\t\n\t\tsleep 5\n\t\t\n\t\tbegin\n\t\tassert $invite_facebook.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO02T02: FAILED! Invite via Facebook button not found\"\n\t\tend\t\n\t\t\n\t\tbegin\n\t\tassert $invite_aol_mail.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO02T02: FAILED! Invite via AOL Mail button not found.\"\n\t\tend\n\t\t\n\t\tbegin\n\t\tassert $invite_email.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO02T02: FAILED! Invite via Email button not found.\"\n\t\tend\n\t\t\n\t\tbegin\n\t\tassert $invite_gmail.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO02T02: FAILED! Invite via Gmail button not found.\"\n\t\tend\n\t\t\n\t\tbegin\n\t\tassert $invite_yahoo.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO02T02: FAILED! Invite via Yahoo button not found.\"\n\t\tend\n\tend",
"def index\n \n \n if params[:category_id] # TO CHANGE\n @category = Category.find_by_cached_slug(params[:category_id])\n @product_tests = @category.published.product_tests.recent.page(params[:page]).per(5)\n add_breadcrumb \"Catégories\", :categories_path, :title => \"Revenir à la liste des catégories\"\n add_breadcrumb @category.name.camelize, category_path(@category)\n add_breadcrumb \"Avis/Tests de produits\", product_tests_from_category_path(@category), :title => \"Revenir à la liste des avis/tests de produits\"\n else\n add_breadcrumb \"Avis/Tests de produits\", :product_tests_path, :title => \"Revenir à la liste des avis/tests de produits\"\n @product_tests = ProductTest.published.recent.page(params[:page]).per(5)\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @product_tests }\n end\n end",
"def index\n if params[:category_id]\n @category = Category.find(params[:category_id])\n end\n session[:last_cat_id] = params[:category_id] \n if params[:q].nil? && @category\n @test_cases = KoalaTestCase.paginate_by_category_id @category.id, :page => params[:page], :per_page => 50, :conditions => { :active => true} \n elsif !params[:q].blank?\n if @category.nil?\n\t\t\t\t\tlogger.info \"SEARCHING......................\"\n @test_cases = KoalaTestCase.search(params[:q], :page => params[:page], :per_page => 20, :group_by => 'category_id', :group_function => :attr, :conditions => { :active => true} ) \n else\n\t\t\t\t\tflash[:notice] = \"Please search from the top level\"\n @test_cases = KoalaTestCase.search(params[:q], :page => params[:page], :per_page => 20, :group_by => 'category_id', :group_function => :attr, :with => {:category_id => @category.self_and_descendants.map(&:id)}, :conditions => { :active => true} ) \n #@test_cases = KoalaTestCase.paginate_search(params[:q] + \" & ancestor_ids:#{@category.id}\", {:page => params[:page], :per_page => 50}, {:order => 'category_id', :conditions => { :active => true }})\n end\n else\n @test_cases = []\n end\n\n if logged_in?\n @playlists = current_user.live_playlists \n @playlist_collection = current_user.live_playlists.collect {|p| [ \"#{p.title}\", p.id ] }.reverse\n end\n end",
"def selection(input, user)\n case input\n when 1\n get_number_of_random_recipes(user)\n when 2\n recipe_hash = run_option_find_recipe_by_name\n run_sub_menu_option(user, recipe_hash)\n when 3\n run_option_create(user)\n when 4\n run_option_view_favs(user)\n end\n end",
"def test_toplevel\n assert(categories(:category1).toplevel?)\n assert(!categories(:category2).toplevel?)\n assert(!categories(:category3).toplevel?)\n end",
"def list_categories\n Category.all.each.with_index(1) {|x, i| puts \"#{i}. #{x.name}\"} #Scraper.categories.each.with_index(1) {|category, i| puts \"#{i}. #{category[0]}\"}\n puts \"select the number of the category you would like to browse or type 'exit'\"\n end",
"def test_changePriorityValidation\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n test = [{\"displayed\" =>RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"click\" => RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_SELECT_XPATH},\n {\"click\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_CHANGE_PRIORITY_JOBS_XPATH},\n {\"displayed\" => RequisitionsChangePriority::REQUISITIONS_CHANGE_PRIORITY_NEW_PRIORITY_XPATH},\n {\"click\" => RequisitionsChangePriority::REQUISITIONS_CHANGE_PRIORITY_BTN_UPDATE_PRIORITY_XPATH}]\n Common.main(test)\n assert $wait.until {\n $browser.find_element(:xpath, RequisitionsChangePriority::ERROR_PRIORITY_MUST_BE_SELECTED).displayed?\n } \nend",
"def ctag(category = \"environment\", value = \"test\")\n env = Classification.find_by_name(category) ||\n FactoryGirl.create(:classification, :name => category, :single_value => 1)\n FactoryGirl.create(:classification_tag, :name => value, :parent => env)\n end",
"def test_destroy\n assert_destroyable @work_opinion\n assert @work_cat.reload\n assert_equal @work_cat, Category.find(@work_cat.id)\n end",
"def on_category_ok; @quest_list_window.activate; end",
"def test_008\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n @@pj = Pj.find_by_name('SamplePJ1')#\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # test for value of master into combobox in master tab\n assert_equal [\"sample_c_cpp\"], get_select_options(\"master_id\")\n assert is_text_present(_(\"Optional setting\"))\n\n click $xpath[\"task\"][\"registration_task_button\"]\n sleep 2\n #assert !60.times{ break if (is_text_present(\"解析ツール未選択 入力内容に問題があるためタスクを登録できません。\") rescue false); sleep 2 }\n\n\n # logout\n logout\n\n end",
"def test_cases; end",
"def evaluate_all_cat1(args = nil)\n opts = args ? @options.merge(args) : @options\n\n cat3_tests = generate_cat3_tests(opts)\n\n wait_for_calculations\n\n generate_cat1_tests(cat3_tests)\n\n print \"Creating and uploading Cat I zips...\"\n\n p = Product.where({name: \"MeasureEvaluationProduct\"}).first\n ProductTest.where({_type: \"QRDAProductTest\", product: p}).each do |t|\n begin\n zip = create_cat1_zip(t)\n FileUtils.mv zip, \"#{File.dirname(zip)}/#{File.basename(zip)}.zip\"\n zip2 = File.new(\"#{File.dirname(zip)}/#{File.basename(zip)}.zip\")\n t.execute(zip2)\n rescue NoMethodError => e\n $stderr.puts \"Cat 1 test #{t.id} failed: #{e}\"\n end\n end\n\n puts \"done\"\n end",
"def test_show\n get '/category/1'\n end",
"def test_truth\n assert_kind_of OrganizationCategory, organization_categories(:first)\n end",
"def create_tests( inspection_type, filter_record )\n\n inspection_type.qc_inspection_type_tests.each do |inspection_type_test|\n #next if filter_record.attributes[inspection_type_test.filter_column] != inspection_type_test.filter_value\n # filter_value can have a comma-separated list of codes, so split them out into an array:\n filter_checks = inspection_type_test.filter_value.split(/\\s*,\\s*/)\n next unless filter_checks.include?(filter_record.attributes[inspection_type_test.filter_column])\n\n # Create a test\n qc_inspection_test = QcInspectionTest.new( :qc_inspection_id => self.id,\n :passed => false,\n :username => self.username,\n :status => QcInspectionTest::STATUS_CREATED,\n :optional => inspection_type_test.optional,\n :cull_test => inspection_type_test.cull_test,\n :qc_inspection_type_test_id => inspection_type_test.id)\n qc_inspection_test.inspection_test_number = MesControlFile.next_seq_web(MesControlFile::QC_INSPECTION_TEST)\n unless qc_inspection_test.save\n qc_inspection_test.errors.each_full do |msg|\n errors.add_to_base \"Inspection Test: #{msg}\"\n end\n return false\n end\n\n # Create Cull result and measurements:\n if qc_inspection_test.cull_test?\n qc_result = QcResult.new( :qc_test_id => inspection_type_test.qc_test_id, :sample_no => 1)\n if qc_inspection_test.qc_results << qc_result\n inspection_type_test.qc_test.qc_measurement_types.each do |qc_measurement_type|\n qc_result.add_cull_measurement( qc_measurement_type )\n end\n else\n qc_result.errors.each_full do |msg|\n errors.add_to_base \"QC Result: #{msg}\"\n end\n return false\n end\n else\n # Optimized insert for non-cull tests:\n\n # NB. This uses PostgreSQL-specific generate_series function:\n query = \"INSERT INTO qc_results(qc_inspection_test_id, qc_test_id, sample_no)\n select #{qc_inspection_test.id}, #{inspection_type_test.qc_test_id}, sample_no\n from generate_series(1,#{inspection_type_test.sample_size}) x(sample_no)\"\n self.connection.execute(query)\n\n # Insert measurements while bypassing validation:\n query = \"INSERT INTO qc_result_measurements(qc_measurement_type_id, qc_result_id, qc_measurement_code, \n qc_measurement_description, test_uom, test_criteria, test_method, sample_no)\n select qc_measurement_types.id, qc_results.id, qc_measurement_types.qc_measurement_code,\n qc_measurement_types.qc_measurement_description, qc_measurement_types.test_uom,\n qc_measurement_types.test_criteria, qc_measurement_types.test_method, qc_results.sample_no\n from qc_measurement_types\n join qc_results on qc_results.qc_test_id = qc_measurement_types.qc_test_id\n where qc_measurement_types.qc_test_id = #{inspection_type_test.qc_test_id}\n and qc_results.qc_inspection_test_id = #{qc_inspection_test.id}\"\n self.connection.execute(query)\n end\n end\n true\n end",
"def set_interviewcategory\n @interviewcategory = Interviewcategory.find(params[:id])\n end",
"def category_results(db,options)\n spacer\n puts \"\\nChoose a catagory\"\n puts options\n choice = gets.chomp\n if options.include?(choice)\n choice\n else\n spacer\n puts \"\\n---- Thats not a choice ----\"\n category_results(db,options)\n end\nend",
"def test_process_assignments\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_list = [@siva_e]\n \n section_selections = {}\n section_ids.each { |id| section_selections[id.to_s] = '0' }\n\n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n pat_dfm_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n \n # Verify that a contractor PCB Designer can not access the list.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n end",
"def create_context\n # create FactoryGirl objects\n # examples:\n # @ruby = FactoryGirl.create(:category)\n # @rails = FactoryGirl.create(:category, name: \"Rails\")\n\n # Create three competencies\n @communication = FactoryGirl.create(:competency)\n @decision_making = FactoryGirl.create(:competency, name: \"Decision Making\")\n @problem_solving = FactoryGirl.create(:competency, name: \"Problem Solving\", active: false)\n\n # Create four indicators\n @indicator1 = FactoryGirl.create(:indicator, competency: @communication)\n @indicator2 = FactoryGirl.create(:indicator, competency: @communication, description: \"Able to present written communication in an easy–to-read format.\")\n @indicator3 = FactoryGirl.create(:indicator, competency: @communication, level: \"Champion\", description: \"Engages in difficult conversations with others while maintaining respect.\")\n @indicator4 = FactoryGirl.create(:indicator, competency: @decision_making, level: \"Companion\", description: \"Able to outline a plan to gather data that will aid in the completion of a familiar task.\")\n @indicator5 = FactoryGirl.create(:indicator, competency: @problem_solving, level: \"Companion\", description: \"Able to identify apparent causes of a problem.\", active: false)\n # Create Four Resourcess\n @dundee = FactoryGirl.create(:resource)\n @bears = FactoryGirl.create(:resource, name: \"Waltzing With Bears\")\n @newyork = FactoryGirl.create(:resource, name: \"Talking to New Yorkers\")\n @irwin = FactoryGirl.create(:resource, name: \"Steve Irwin: A Legacy\", active:false)\n \n # Create relations between indicators and resources\n @a1 = FactoryGirl.create(:indicator_resource, resource: @dundee, indicator: @indicator1)\n @a2 = FactoryGirl.create(:indicator_resource, resource: @bears, indicator: @indicator1)\n @a3 = FactoryGirl.create(:indicator_resource, resource: @dundee, indicator: @indicator2)\n\n # Create questions\n @q1 = FactoryGirl.create(:question)\n @q2 = FactoryGirl.create(:question, question: \"How frequently do you give presentations?\")\n @q3 = FactoryGirl.create(:question, question: \"How frequently do you lead discussion?\", active: false)\n\n # Create indicator questions\n\n @iq1 = FactoryGirl.create(:indicator_question, indicator: @indicator1, question: @q1)\n @iq2 = FactoryGirl.create(:indicator_question, question: @q1, indicator: @indicator2)\n @iq3 = FactoryGirl.create(:indicator_question, indicator: @indicator3, question: @q2)\n @iq4 = FactoryGirl.create(:indicator_question, indicator: @indicator4, question: @q3)\n\n end",
"def new\n @test_case = KoalaTestCase.new( :user_id => current_user.id, :category_id => params[:category_id] )\n\n @tag_favorites = current_user.group.tag_favorites + TagFavorite.find_all_by_group_id() + []\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_case }\n end\n end",
"def test_ReduceElectricEquipmentByPercentageAudit_AllEquipment\n \n # create an instance of the measure\n measure = ReduceElectricEquipmentByPercentageAudit.new\n \n # create an instance of a runner\n runner = OpenStudio::Ruleset::OSRunner.new\n \n # get test model\n model = makeTestModel\n \n # get arguments and test that they are what we are expecting\n arguments = measure.arguments(model)\n assert_equal(6, arguments.size)\n assert_equal(\"equip_def\", arguments[0].name)\n assert_equal(\"equip_power_reduction_percent\", arguments[1].name)\n assert_equal(\"material_and_installation_cost\", arguments[2].name)\n assert_equal(\"expected_life\", arguments[3].name)\n assert_equal(\"om_cost\", arguments[4].name)\n assert_equal(\"om_frequency\", arguments[5].name)\n\n # fill in argument_map\n argument_map = OpenStudio::Ruleset::OSArgumentMap.new\n\n count = -1\n\n equip_def = arguments[count += 1].clone\n assert(equip_def.setValue(\"*All Equipment*\"))\n argument_map[\"equip_def\"] = equip_def\n\n equip_power_reduction_percent = arguments[count += 1].clone\n assert(equip_power_reduction_percent.setValue(20.0))\n argument_map[\"equip_power_reduction_percent\"] = equip_power_reduction_percent\n\n material_and_installation_cost = arguments[count += 1].clone\n assert(material_and_installation_cost.setValue(10.0))\n argument_map[\"material_and_installation_cost\"] = material_and_installation_cost\n\n expected_life = arguments[count += 1].clone\n assert(expected_life.setValue(20))\n argument_map[\"expected_life\"] = expected_life\n\n om_cost = arguments[count += 1].clone\n assert(om_cost.setValue(0.0))\n argument_map[\"om_cost\"] = om_cost\n\n om_frequency = arguments[count += 1].clone\n assert(om_frequency.setValue(1))\n argument_map[\"om_frequency\"] = om_frequency\n \n # test building\n building = model.getBuilding\n assert_equal(200, building.electricEquipmentPower)\n assert_equal(0, building.lifeCycleCosts.size)\n \n measure.run(model, runner, argument_map)\n result = runner.result\n puts \"test_ReduceElectricEquipmentByPercentage_AllEquipment\"\n show_output(result)\n assert(result.value.valueName == \"Success\")\n\n building = model.getBuilding\n assert_equal(160, building.electricEquipmentPower)\n assert_equal(1, building.lifeCycleCosts.size)\n end",
"def set_category_controls\n @control_help_window.add_control(Vocab::ITEM, Input::Keys::A) \n @control_help_window.add_control(Vocab::BACK, Input::Keys::B)\n @control_help_window.add_control(Vocab::CHANGE_CATEGORY, Input::Keys::L, Input::Keys::R)\n end",
"def sub_category_view(prompt, categories, inventory)\r\n \r\n system 'clear'\r\n \r\n # Asks user which sub_category they'd like to view\r\n choose_sub_categories = []\r\n categories.each { |hash| hash[:sub_categories].each { |hash| hash.each { |k, v| choose_sub_categories << k.to_s } } }\r\n sub_category_to_view = prompt.select(\"Which sub-category would you like to view?\", choose_sub_categories)\r\n\r\n # Calls display_method to display chosen sub_category\r\n system 'clear'\r\n\r\n display_method(inventory, sub_category_to_view)\r\n\r\n end",
"def test03_board_OpenEducation_TC_24397\n\t\tlogin $user_1_email, $master_password\n\t\t\n\t\tsleep 5\n\n\t\t$open_group.fire_event(\"onclick\")\n\t\t$group_name.set(\"Education Group #{random}\")\n\t\t$group_nickname.set(\"Nickname #{random}\")\n\t\t$group_description.set(\"Description #{random}\")\n\t\t$category_education.click\n\t\t$boards_arts_ent_image.when_present.fire_event(\"onclick\")\n\t\t$create_group.click\n\t\t\n\t\tcheckIfIncorrectErrorDisplays\n\tend",
"def chosen_categories\n return chosen_options.collect &:category\n end",
"def set_categorium\n @categorium = Categorium.find(params[:id])\n end",
"def set_categorium\n @categorium = Categorium.find(params[:id])\n end",
"def pick_collection(string, user_name, selection)\r\n clear\r\n options = []\r\n # Pasting all required attributes to next method\r\n if string == 'Default'\r\n begin default_collections_array = @test.default[string]\r\n default_collections_array.each do |e|\r\n options.push({ name: \"Default collection #{e['Default_Id']} :#{e['Default_Name']}\\n\\n\", value: lambda {\r\n test_comfirm(string, e['Default_Name'], e, user_name, selection)\r\n } })\r\n end\r\n # In case the default file is corrupted, receive default content from test model\r\n rescue JSON::ParserError, NoMethodError, NoMemoryError, StandardError\r\n puts \"Sorry, couldn't read the content of Default_collection file.\\n\"\r\n puts \"Recreating the Default contetnt.\\n\\n\"\r\n new_default = @test.default_content_setter\r\n @test.reset_default(new_default)\r\n retry\r\n end\r\n elsif string == 'Custom'\r\n begin custom_collections_array = @custom.custom_load[string]\r\n custom_collections_array.each do |e|\r\n options.push({ name: \"Custom collection #{e['Custom_Id']} :#{e['Custom_Name']}\\n\\n\", value: lambda {\r\n test_comfirm(string, e['Custom_Name'], e, user_name, selection)\r\n } })\r\n end\r\n # In case counldn't read custom file prompt user to go back to add new custom content.\r\n rescue JSON::ParserError, NoMethodError, NoMemoryError, StandardError\r\n puts \"Sorry, couldn't read the content of Custom_collection file.\\n\"\r\n puts \"Please go back to custom menu and add new custom content.\\n\\n\"\r\n end\r\n\r\n end\r\n # Provide access to go back even if the reading file failed\r\n options.push([\r\n { name: 'Back', value: lambda {\r\n interface\r\n } }\r\n ])\r\n option = @prompt.select(\"Please select the quiz that you want to test or go back to main menu.\\n\\n\", options,\r\n help: \"(Pressing Enter to go back)\\n\\n\", show_help: :always, per_page: 10)\r\n end",
"def test_create_product\n login\n sleep 15\n @driver.find_element(:xpath, \"//div[@id='account-name']/a\").click\n @driver.find_element(:xpath, \"//li[@ng-if='currentAccount.featureFlags.orderManagementEnabled && currentAccount.policies.posSettingShow']\").click\n @driver.find_element(:xpath, \"//i[@class='fa fa-dollar']\").click\n @driver.find_element(:xpath, \"//a[@ui-sref='products']\").click\n sleep 2\n @driver.find_element(:link_text, \"New Product\").click\n \n time = get_Present\n product_name = \"Product \"+time\n @driver.find_element(:xpath, \"//input[@name='product[name]']\").send_keys product_name \n begin\n @driver.find_element(:xpath, \"//textarea[@name='product[description]']\").send_keys \"Test description\" \n puts \"description available\"\n sleep 2\n rescue => e\n puts \"description not available\" \n end\n type = \"//select[@name='product[product_type_id]']\"\n type_index = \"3\"\n getSelect_by_index(type,type_index)\n sleep 2\n category = \"//select[@name='product[category_id]']\"\n category_index = \"2\"\n getSelect_by_index(category,category_index)\n \n @driver.find_element(:xpath, \"//input[@name='product[buying_cost_in_dollars]']\").clear\n @driver.find_element(:xpath, \"//input[@name='product[buying_cost_in_dollars]']\").send_keys \"20\"\n sleep 2\n @driver.find_element(:xpath, \"//input[@name='product[cost_in_dollars]']\").clear\n @driver.find_element(:xpath, \"//input[@name='product[cost_in_dollars]']\").send_keys \"30\"\n\n sleep 2\n @driver.find_element(:xpath, \"//input[@name='product[price_in_dollars]']\").clear\n @driver.find_element(:xpath, \"//input[@name='product[price_in_dollars]']\").send_keys \"40\"\n \n incomeaccount = \"//select[@name='product[income_coa_account_id]']\"\n incomeaccount_index = \"2\"\n getSelect_by_index(incomeaccount,incomeaccount_index)\n\n cogaccount = \"//select[@name='product[cog_coa_account_id]']\"\n cogaccount_index = \"2\"\n getSelect_by_index(cogaccount,cogaccount_index)\n \n @driver.find_element(:xpath, \"//input[@class='button']\").click\n sleep 5\n puts \"Created \"+product_name \n end",
"def test_select_view\n\n checklist_1_0 = checklists(:checklist_1_0)\n \n get(:select_view, {:id => checklist_1_0.id}, cathy_admin_session)\n assert_equal(checklist_1_0.id, assigns(:checklist).id)\n \n end",
"def test04_OpenPolitics\n\t\tloginGroup\n\t\t\n\t\tsleep 5\n\n\t\t$open_group.fire_event(\"onclick\")\n\t\t$group_name.set(\"Politics Group #{random}\")\n\t\t$group_nickname.set(\"Nickname #{random}\")\n\t\t$group_description.set(\"Description #{random}\")\n\t\t$category_politics.click\n\t\tsleep 2\n\t\tchooseExistingIcon\n\t\t$create_group.click\n\t\t\n\t\tcheckIfIncorrectErrorDisplays\n\t\t\n\t\tsleep 5\n\t\t\n\t\tbegin\n\t\tassert $invite_facebook.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO02T04: FAILED! Invite via Facebook button not found\"\n\t\tend\t\n\t\t\n\t\tbegin\n\t\tassert $invite_aol_mail.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO02T04: FAILED! Invite via AOL Mail button not found.\"\n\t\tend\n\t\t\n\t\tbegin\n\t\tassert $invite_email.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO02T04: FAILED! Invite via Email button not found.\"\n\t\tend\n\t\t\n\t\tbegin\n\t\tassert $invite_gmail.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO02T04: FAILED! Invite via Gmail button not found.\"\n\t\tend\n\t\t\n\t\tbegin\n\t\tassert $invite_yahoo.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO02T04: FAILED! Invite via Yahoo button not found.\"\n\t\tend\n\tend",
"def process_test_cases\n raise NotImplementedError, 'You must implement this'\n end",
"def test_select\n\n @dashboard.register { catchall }\n\n @dashboard.launch(Ruote.define do\n concurrence { alpha; bravo; charly }\n end)\n\n while @dashboard.storage_participant.size < 3; end\n\n assert_equal(\n 1,\n @dashboard.storage_participant.select { |wi|\n wi.participant_name == 'bravo'\n }.size)\n end",
"def test04_news_OpenOpinionOther\n\t\tlogin $editor_1_email, $master_password\n\t\t$browser.goto($patch_new_news_group)\n\t\tsleep 5\n\n\t\t$group_name.set(\"Opinion/Other Group #{random}\")\n\t\t$group_nickname.set(\"Nickname #{random}\")\n\t\t$group_description.set(\"Description #{random}\")\n\t\t$category_opinion.click\n\t\t$category_other.click\n\t\t$boards_arts_ent_image.when_present.fire_event(\"onclick\")\n\t\t$create_group.click\n\t\t\n\t\tcheckIfIncorrectErrorDisplays\n\t\t\n\tend",
"def test_recent_reviews_no_cat\r\n successful_get_test '/recent_reviews'\r\n end",
"def test02_OpenBusiness_TC_24397\n\t\tloginGroup\n\t\t\n\t\tsleep 5\n\n\t\t$open_group.fire_event(\"onclick\")\n\t\t$group_name.set(\"Business Group #{random}\")\n\t\t$group_nickname.set(\"Nickname #{random}\")\n\t\t$group_description.set(\"Description #{random}\")\n\t\t$category_business.click\n\t\tchooseExistingIcon\n\t\t$create_group.click\n\t\t\n\t\tcheckIfIncorrectErrorDisplays\n\t\t\n\t\tsleep 5\n\t\t\n\t\tbegin\n\t\tassert $invite_facebook.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO01T02: FAILED! Invite via Facebook button not found\"\n\t\tend\t\n\t\t\n\t\tbegin\n\t\tassert $invite_aol_mail.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO01T02: FAILED! Invite via AOL Mail button not found.\"\n\t\tend\n\t\t\n\t\tbegin\n\t\tassert $invite_email.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO01T02: FAILED! Invite via Email button not found.\"\n\t\tend\n\t\t\n\t\tbegin\n\t\tassert $invite_gmail.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO01T02: FAILED! Invite via Gmail button not found.\"\n\t\tend\n\t\t\n\t\tbegin\n\t\tassert $invite_yahoo.exists?\n\t\trescue => e\n\t\t\tputs e\n\t\tputs \"GO01T02: FAILED! Invite via Yahoo button not found.\"\n\t\tend\n\tend",
"def test_007\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n @@pu = Pu.find_by_name('SamplePU1')\n\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n @@pj = Pj.find_by_name('SamplePJ1')\n\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # test for value of master into combobox in master tab\n assert_equal [\"sample_c_cpp\"], get_select_options(\"master_id\")\n assert is_text_present(_(\"Optional setting\"))\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n # click link setup QAC++\n assert is_text_present(\"qacpp\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link2\"]\n sleep 2\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n\n\n # logout\n logout\n\n end",
"def test_scenario2\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 4}, 'Iris-setosa', {\"kind\" => \"probability\", \"threshold\" => 0.1, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 4}, 'Iris-versicolor', {\"kind\" => \"probability\", \"threshold\" => 0.9, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"sepal length\" => 4.1, \"sepal width\" => 2.4}, 'Iris-setosa', {\"kind\" => \"confidence\", \"threshold\" => 0.1, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"sepal length\" => 4.1, \"sepal width\" => 2.4}, 'Iris-versicolor', {\"kind\" => \"confidence\", \"threshold\" => 0.9, \"positive_class\" => \"Iris-setosa\"}, \"000004\"]\n ]\n puts\n puts \"Scenario : Successfully comparing predictions in operating points for models\"\n\n data.each do |filename, data_input, prediction_result, operating_point, objective|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create model\"\n model=@api.create_model(dataset)\n \n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n \n puts \"And I create a local model\"\n local_model = BigML::Model.new(model, @api)\n\n puts \"When I create a prediction for %s in %s \" % [JSON.generate(data_input), JSON.generate(operating_point)]\n prediction = @api.create_prediction(model, data_input, {\"operating_point\" => operating_point})\n \n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n assert_equal(@api.ok(prediction), true)\n\n puts \"Then the prediction for '<%s>' is '<%s>'\" % [objective, prediction_result]\n \n if !prediction['object']['prediction'][objective].is_a?(String)\n assert_equal(prediction['object']['prediction'][objective].to_f.round(5), prediction_result.to_f.round(5))\n else\n assert_equal(prediction['object']['prediction'][objective], prediction_result)\n end\n\n puts \"And I create a local prediction for <%s> in <%s>\" % [JSON.generate(data_input), JSON.generate(operating_point)]\n local_prediction = local_model.predict(data_input, {\"operating_point\" => operating_point})\n \n puts \"Then the local prediction is <%s>\" % prediction_result\n \n if local_prediction.is_a?(Array)\n local_prediction = local_prediction[0]\n elsif local_prediction.is_a?(Hash)\n local_prediction = local_prediction['prediction']\n else\n local_prediction = local_prediction\n end \n \n if (local_model.regression) or \n (local_model.is_a?(BigML::MultiModel) and local_model.models[0].regression)\n assert_equal(local_prediction.to_f.round(4), prediction_result.to_f.round(4))\n else\n assert_equal(local_prediction, prediction_result)\n end \n \n end\n \n end",
"def test_004\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 全体解析 (Analysis of all)\n select \"analyze_type\", \"label=#{@overall}\"\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n #There is no display below \"selection of the upload method of an individual analysis file.\"\n assert !is_text_present(_(\"Select the upload method of individual analysis files\"))\n\n @@pu.destroy\n # logout\n logout\n\n end",
"def create_category\n @category = TestCategory.new(params[:category])\n @category.save\n @categories = TestCategory.find(:all)\n redraw 'categories'\n end",
"def populate_category\n\t\t\t\tif params[:purpose] == \"category\"\n\t\t\t\t\t\tcategory = Category.find(params[:category_id])\n\t\t\t\t\t\t@sub_categories = category.sub_categories\n\t\t\t\telsif params[:purpose] == \"sub_category\"\n\t\t\t\t\t\tsub_category = SubCategory.find(params[:category_id])\n\t\t\t\t\t\t@inner_categories = sub_category.inner_categories\n\t\t\t\tend\n\t\tend",
"def test_truth\r\n assert_kind_of FaqCategory, @faq_category\r\n end",
"def test_scenario4\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 4}, 'Iris-setosa', {\"kind\" => \"probability\", \"threshold\" => 0.1, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 4}, 'Iris-virginica', {\"kind\" => \"probability\", \"threshold\" => 0.9, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"sepal length\" => 4.1, \"sepal width\"=> 2.4}, 'Iris-setosa', {\"kind\" => \"confidence\", \"threshold\" => 0.1, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"sepal length\" => 4.1, \"sepal width\"=> 2.4}, 'Iris-versicolor', {\"kind\" => \"confidence\", \"threshold\" => 0.9, \"positive_class\" => \"Iris-setosa\"}, \"000004\"]\n ]\n puts\n puts \"Successfully comparing predictions in operating points for ensembles\"\n\n data.each do |filename, data_input, prediction_result, operating_point, objective|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create an ensemble\"\n ensemble = @api.create_ensemble(dataset, {\"number_of_models\"=> 2, \"seed\" => 'BigML', 'ensemble_sample'=>{'rate' => 0.7, 'seed' => 'BigML'}, 'missing_splits' => false})\n \n puts \"And I wait until the ensemble is ready\"\n assert_equal(BigML::HTTP_CREATED, ensemble[\"code\"])\n assert_equal(1, ensemble[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(ensemble), true)\n \n puts \"And I create a local ensemble\"\n local_ensemble = BigML::Ensemble.new(ensemble, @api)\n local_model = BigML::Model.new(local_ensemble.model_ids[0], @api)\n \n puts \" When I create a prediction for <%s>\" % [JSON.generate(data_input)]\n prediction = @api.create_prediction(ensemble['resource'], data_input, {\"operating_point\" => operating_point})\n \n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n assert_equal(@api.ok(prediction), true)\n \n \n puts \"Then the prediction for <%s> is <%s>\" % [objective, prediction_result]\n \n if !prediction['object']['prediction'][objective].is_a?(String)\n assert_equal(prediction['object']['prediction'][objective].to_f.round(5), prediction_result.to_f.round(5))\n else\n assert_equal(prediction['object']['prediction'][objective], prediction_result)\n end \n \n puts \"And I create a local prediction for <%s>\" % JSON.generate(data_input)\n local_prediction = local_ensemble.predict(data_input, {\"operating_point\" => operating_point})\n \n puts \"Then the local prediction is <%s>\" % prediction_result\n \n if local_prediction.is_a?(Array)\n local_prediction = local_prediction[0]\n elsif local_prediction.is_a?(Hash)\n local_prediction = local_prediction['prediction']\n else\n local_prediction = local_prediction\n end \n \n if (local_ensemble.regression) or \n (local_ensemble.is_a?(BigML::MultiModel) and local_ensemble.models[0].regression)\n assert_equal(local_prediction.to_f.round(4), prediction_result.to_f.round(4))\n else\n assert_equal(local_prediction, prediction_result)\n end \n \n end\n end",
"def test_RolloverDifferentQuestionSets\n randomName = \"a\" + SecureRandom.hex(4)\n randomName2 = \"a\" + SecureRandom.hex(4)\n randomQS = SecureRandom.hex(4)\n randomQS2 = SecureRandom.hex(4)\n randomContact = SecureRandom.hex(4)\n randomContact2 = SecureRandom.hex(4)\n \n #PRECONDITIONS\n #Login\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n Common.go_to_custom_settings\n CustomSettings.EnableEnhancedApplyToJob(true)\n \n Common.CreateQuestionSetEmpty(randomQS)\n \n Common.CreateQuestionSetEmpty(randomQS2)\n \n Common.CreateRequisitionPostJob(randomName, true, false, randomQS)\n \n Common.CreateRequisitionPostJob(randomName2, true, false, randomQS2)\n \n #Must have several accounts\n Common.CreateAccount(randomContact) \n \n #Must have several contacs\n Common.CreateContact(randomContact, randomContact)\n \n #Must have several accounts\n Common.CreateAccount(randomContact2) \n \n #Must have several contacs\n Common.CreateContact(randomContact2, randomContact2)\n \n # Application was moved to any further stage: Submittal, Interview, Offer or Placement.\n \n Common.goToTab(HomePage::CONTACTS_TAB_LINK_XPATH)\n \n test = [\n {\"displayed\" => ContactsHomePage::CONTACT_HOME_VIEW_SELECT_XPATH},\n {\"set_text\" => ContactsHomePage::CONTACT_HOME_VIEW_SELECT_XPATH, \"text\" => \"CRM Contacts - All\"},\n {\"click_and_load\" => ContactsHomePage::CONTACT_HOME_BTN_GO_XPATH},\n {\"displayed\" => ContactsHomePage::CONTACT_HOME_CONTACT_LIST_XPATH}\n ]\n Common.main(test)\n \n # Select a Candidate\n $browser.find_element(:xpath => ContactsHomePage::CONTACT_HOME_CONTACT_LIST_XPATH + \"//*[text()[contains(.,'\" + randomContact + \"')]]/../../../..//td[1]//input\").click\n \n # Select a Candidate\n $browser.find_element(:xpath => ContactsHomePage::CONTACT_HOME_CONTACT_LIST_XPATH + \"//*[text()[contains(.,'\" + randomContact2 + \"')]]/../../../..//td[1]//input\").click\n \n # Click on \"Apply to jobs\"\n Common.click(ContactsHomePage::CONTACT_HOME_APPLY_TO_JOB_XPATH)\n sleep(2)\n #A pop up window will be disaplyed\n newWindow= $browser.window_handles.last\n $browser.switch_to.window(newWindow)\n \n sleep(2)\n \n test = [\n # Select a job\n {\"displayed\" => ContactsHomePage::CONTACT_JOB_POPUP_JOB_TITLE_XPATH},\n {\"set_text\" => ContactsHomePage::CONTACT_JOB_POPUP_JOB_TITLE_XPATH, \"text\" => randomName},\n #Click \"Next\" \n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_BTN_NEXT_XPATH},\n {\"displayed\" => ContactsHomePage::CONTACT_JOB_POPUP_RADIO_INVITE_XPATH},\n # Click on Exception \n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_RADIO_EXCEP_XPATH},\n {\"displayed\" => ContactsHomePage::CONTACT_JOB_POPUP_REASON_XPATH},\n # Select Referral in picklist \n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_REASON_OTHER_OPTION_XPATH},\n {\"set_text\" => ContactsHomePage::CONTACT_JOB_POPUP_REASON_OTHER_XPATH, \"text\" => \"some text\"},\n # Click \"Save\" \n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_SAVE_XPATH},\n {\"displayed\" => ContactsHomePage::CONTACT_JOB_POPUP_TOTAL_APP_XPATH},\n {\"click\" => ContactsHomePage::CONTACT_JOB_POPUP_BTN_CLOSE_XPATH} \n ]\n Common.main(test)\n \n newWindow2= $browser.window_handles.first\n $browser.switch_to.window(newWindow2)\n \n # 1 - Click on \"Requisitions\"\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n \n test= [\n {\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_LIST_XPATH}\n ]\n Common.main(test)\n sleep(3)\n \n test= [\n # 2 - Select a Job Order \n {\"click_and_load\" => RequisitionsHomePage::REQUISITIONS_PAGE_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\"},\n {\"displayed\" => RequisitionsDetail::REQUISITIONS_DETAIL_BTN_ROLLOVER_CONTACTS_XPATH},\n # 3 - Click on \"Rollover Contacts\" \n {\"click\" => RequisitionsDetail::REQUISITIONS_DETAIL_BTN_ROLLOVER_CONTACTS_XPATH},\n ]\n Common.main(test)\n \n sleep(2)\n newWindow3= $browser.window_handles.last\n $browser.switch_to.window(newWindow3)\n sleep(2)\n \n test= [\n {\"displayed\" => RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_JOB_INPUT_XPATH},\n # 4 - Select another job order that fits the preconditions \n {\"set_text\" => RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_JOB_INPUT_XPATH, \"text\" => randomName2},\n # 5 - Click on \"Rollover\" \n {\"click\" => RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_BTN_ROLLOVER_XPATH},\n {\"displayed\" => RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_MSG_CELL_XPATH}\n ]\n Common.main(test)\n sleep(3)\n # RESULT \n # A message stating that Rollover is impossible and prompt to apply contacts to the selected job order will be displayed.\n assert_equal(RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_MSG_WARNING_TEXT, $browser.find_element(:xpath, RequisitionsDetail::REQUISITIONS_ROLLOVER_POPUP_MSG_CELL_XPATH).text)\n \n $browser.close\n \n newWindow9= $browser.window_handles.first\n $browser.switch_to.window(newWindow9)\n \n end",
"def load_default_test_data_to_db_before_suite\n community1 = FactoryGirl.create(:community, :ident => \"test\", :consent => \"test_consent0.1\", :settings => {\"locales\" => [\"en\", \"fi\"]}, :real_name_required => true)\n community1.community_customizations.create(name: \"Yelo\", locale: \"fi\")\n community2 = FactoryGirl.create(:community, :ident => \"test2\", :consent => \"KASSI_FI1.0\", :settings => {\"locales\" => [\"en\"]}, :real_name_required => true, :allowed_emails => \"@example.com\")\n community3 = FactoryGirl.create(:community, :ident => \"test3\", :consent => \"KASSI_FI1.0\", :settings => {\"locales\" => [\"en\"]}, :real_name_required => true)\n\n [community1, community2, community3].each { |c| TestHelpers::CategoriesHelper.load_test_categories_and_listing_shapes_to_db(c) }\n end",
"def set_casecategory\n @casecategory = Casecategory.find(params[:id])\n end",
"def set_category\n @category = GoodCategory.find(params[:id])\n end",
"def test_001\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n @@pu.destroy\n # logout\n logout\n\n end"
] |
[
"0.6159697",
"0.6121553",
"0.6109961",
"0.61050713",
"0.6050262",
"0.59318423",
"0.5913041",
"0.589557",
"0.588123",
"0.5817813",
"0.5737933",
"0.57141",
"0.5670626",
"0.56403756",
"0.55908376",
"0.5588808",
"0.5502979",
"0.5473487",
"0.5470811",
"0.5427661",
"0.5418104",
"0.5407081",
"0.5376884",
"0.5364578",
"0.5349463",
"0.53212494",
"0.52733535",
"0.5271652",
"0.52695173",
"0.52279466",
"0.5219139",
"0.5216965",
"0.5198234",
"0.5170267",
"0.51375926",
"0.51285917",
"0.5107775",
"0.5094715",
"0.5091562",
"0.50904244",
"0.5086802",
"0.50866604",
"0.5085151",
"0.50796616",
"0.506682",
"0.50621974",
"0.5056585",
"0.50472885",
"0.50462013",
"0.5030899",
"0.5021541",
"0.50149226",
"0.49920118",
"0.4991784",
"0.49736714",
"0.49601638",
"0.49540976",
"0.49507725",
"0.49487582",
"0.49476808",
"0.49449137",
"0.49348575",
"0.49345106",
"0.49125242",
"0.49108285",
"0.49073637",
"0.49064654",
"0.49036935",
"0.49024937",
"0.49001336",
"0.48986754",
"0.48916796",
"0.48876083",
"0.48851624",
"0.48826724",
"0.48793855",
"0.487831",
"0.48742494",
"0.48742494",
"0.4869993",
"0.4867952",
"0.48512542",
"0.48399606",
"0.48377082",
"0.4829228",
"0.4829194",
"0.4827709",
"0.48252735",
"0.48206216",
"0.48158246",
"0.48057735",
"0.48035654",
"0.4802037",
"0.48016658",
"0.47948346",
"0.47947687",
"0.47929394",
"0.47805822",
"0.4777617",
"0.47755015"
] |
0.7933748
|
0
|
test_section_selection Description: This method does the functional testing of the section_selection method from the OI Instruction Controller class
|
def test_section_selection
# Try accessing from an account that is not a PCB Designer and
# verify that the user is redirected.
get(:section_selection,
{ :id => @board_prep.id, :design_id => @mx234a.id },
pat_dfm_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a Teradyne PCB Designer can access the list.
post(:section_selection,
{:id => @board_prep.id, :design_id => @mx234a.id},
scott_designer_session)
assert_response(:success)
design = assigns(:design)
assert_not_nil(design)
assert_equal(@mx234a.id, design.id)
assert_equal('252-234-a0 g', design.part_number.pcb_display_name)
category = assigns(:category)
assert_not_nil(category)
assert_equal(@board_prep.id, category.id)
assert_equal('Board Preparation', category.name)
exp_sections = [oi_category_sections(:board_prep_1),
oi_category_sections(:board_prep_2),
oi_category_sections(:board_prep_3)]
sections = assigns(:sections)
exp_sections.each do |exp_section|
actual_section = sections.shift
assert_equal(exp_section.id, actual_section.id)
assert_equal(exp_section.name, actual_section.name)
assert_equal(exp_section.url1, actual_section.url1)
assert_equal(exp_section.instructions, actual_section.instructions)
assert_equal(exp_section.oi_category_id,
actual_section.oi_category_id)
assert_equal(exp_section.allegro_board_symbol,
actual_section.allegro_board_symbol)
assert_equal(exp_section.outline_drawing_link,
actual_section.outline_drawing_link)
end
# Verify that a contractor PCB Designer can not access the list.
get(:section_selection,
{:id => @board_prep.id, :design_id => @mx234a.id},
siva_designer_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
#assert_equal("You are not authorized to access this page", flash['notice'])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def section\n section_test.section\n end",
"def assert_section (selected)\n is_nil = selected === nil\n @assertions.each do |section,tests|\n now = Time.now\n if section === selected or is_nil then\n puts 'Testing ' + section\n tests.each do |test|\n @browser.goto(test[:url]) if is_nil\n #ensure the directory exists to save the screenshots\n make_dir \"#{@screenshots}/#{section}\"\n @browser.screenshot.save \"screenshots/#{section}/screenshot-#{section}-#{now}.png\"\n custom_assertion test[:tests]\n end\n end\n end\n end",
"def section_selection\n sections.map { |s| [s.to_label, s.id] }\n end",
"def select_section(section_name)\n result = super(section_name.to_s)\n raise get_message(result) if result != TPL_OK\n @stack.push(section_name.to_sym)\n return true\n end",
"def test_list_by_section\n a_section = sections(:pseudoscientific_claims)\n \n get :list_by_section, :section_name => a_section.name\n assert_response :success\n assert_equal assigns(:title), \"Blog entries for #{a_section.name}\"\n assert_template 'index.rhtml'\n assert_not_nil assigns(:content_nodes)\n \n # Assert the blog posts are being shown.\n assert assigns(:sections).size > 0\n assert_select \"a\", :count => 1, :text => content_nodes(:pigasus_awards).title\n assert_select \"a\", :count => 1, :text => content_nodes(:silent_birth).title\n\n\n # Now using an invalid name.\n get :list_by_section, :section_name => \"bleargh\"\n assert_response :missing\n end",
"def test_task_assignment\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_list = [@siva_e]\n \n designer_session = scott_designer_session\n \n \n # Verify that a Teradyne PCB Designer can access the list\n # \n # Section Selection - Other\n get(:section_selection,\n { :id => @other.id, :design_id => @mx234a.id },\n designer_session) \n assert_redirected_to(:action => :process_assignments,\n :category_id => @other.id,\n :design_id => @mx234a.id,\n :section_id => OiCategory.other_category_section_id)\n \n # Section Selection - Board Prep\n get(:section_selection,\n {:id => @board_prep.id, :design_id => @mx234a.id }, \n designer_session)\n assert_equal(board_prep_sections, assigns(:sections))\n assert_equal(0, assigns(:section_id))\n \n # Process Assignments - No step selected\n post(:process_assignments,\n { :design => { :id => @mx234a.id },\n :category => { :id => @board_prep.id } },\n designer_session)\n #assert_equal(\"Please select the step\", flash['notice'])\n assert_nil(flash[:assignment])\n assert_redirected_to(:action => 'section_selection',\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n \n # Process Assignments - No errors\n post(:process_assignments,\n { :section_id => oi_category_sections(:board_prep_1).id,\n :design => { :id => @mx234a.id },\n :category => { :id => @board_prep.id } },\n designer_session)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n \n lcr_team_members = assigns(:team_members)\n expected_team_members = [@siva_e, @mathi_n] \n assert_equal(expected_team_members, lcr_team_members)\n \n assert_equal(oi_category_sections(:board_prep_1).id,\n assigns(:selected_step).id)\n \n instruction = assigns(:instruction)\n assert_equal(@board_prep.id, instruction.oi_category_section_id)\n assert_equal(@mx234a.id, instruction.design_id)\n \n assignment = assigns(:assignment)\n assert_equal((Time.now+1.day).year, assignment.due_date.year)\n assert_equal((Time.now+1.day).month, assignment.due_date.month)\n assert_equal((Time.now+1.day).day, assignment.due_date.day)\n assert_equal(OiAssignment.complexity_id('Low'), assignment.complexity_id)\n \n assert_not_nil(assigns(:comment))\n \n assert(!assigns(:selected_step).outline_drawing_link?)\n \n allegro_board_symbol = '10987654321'\n assignment_comment = 'This is a test'\n medium_complexity_id = OiAssignment.complexity_id('Medium')\n due_date = Time.local(2007, \"May\", 1)\n \n # Process Assignment Details - No allegro board symbol provided.\n post(:process_assignment_details,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '1', \"5005\" => '1' } },\n designer_session,\n {:assignment => {:instruction => \"\",\n :member_selections => \"\",\n :comment => \"\",\n :assignment => \"\"\n } }\n )\n #assert_equal('Please identify the Allegro Board Symbol', flash['notice'])\n #assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n #assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n #assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n #assert_not_nil(assignment[:design])\n #assert_equal(@mx234a.id, assignment[:design].id)\n #flash[:assignment][:design].name = 'abc'\n \n #assert_not_nil(assignment[:selected_step])\n #assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n #assert_not_nil(assignment[:instruction])\n #assert_equal(board_prep_sections[0].id,\n # assignment[:instruction].oi_category_section_id)\n \n #assert_not_nil(assignment[:member_selections])\n #assert_equal({ \"5004\" => '1', \"5005\" => '1' }, assignment[:member_selections])\n \n #assert_not_nil(assignment[:team_members])\n #assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n #assert_not_nil(assignment[:comment])\n #assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\nreturn \n follow_redirect!\n \n #Verify that the variable where loaded from the flash.\n #assert_equal(assignment[:design], assigns(:design)) \n #assert_equal(assignment[:category], assigns(:category))\n #assert_equal(assignment[:team_members], assigns(:team_members))\n #assert_equal(assignment[:selected_step], assigns(:selected_step))\n #assert_equal(assignment[:instruction], assigns(:instruction))\n #assert_equal(assignment[:assignment], assigns(:assignment))\n #assert_equal(assignment[:comment], assigns(:comment))\n #assert_not_nil(flash[:assignment])\n #assert_nil(assigns(:outline_drawing))\n \n \n # Process Assignment Details - No team members identified.\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s,\n :allegro_board_symbol => allegro_board_symbol },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '0', \"5005\" => '0' })\n\n assert_equal('Please select a team member or members', flash['notice'])\n assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n assert_not_nil(assignment[:design])\n assert_equal(@mx234a.id, assignment[:design].id)\n flash[:assignment][:design].name = 'abc'\n \n assert_not_nil(assignment[:selected_step])\n assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n assert_not_nil(assignment[:instruction])\n assert_equal(board_prep_sections[0].id,\n assignment[:instruction].oi_category_section_id)\n \n assert_not_nil(assignment[:member_selections])\n assert_equal({ \"5004\" => '0', \"5005\" => '0' }, assignment[:member_selections])\n \n assert_not_nil(assignment[:team_members])\n assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n assert_not_nil(assignment[:comment])\n assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\n \n follow_redirect\n \n #Verify that the variable where loaded from the flash.\n assert_equal(assignment[:design], assigns(:design)) \n assert_equal(assignment[:category], assigns(:category))\n assert_equal(assignment[:team_members], assigns(:team_members))\n assert_equal(assignment[:selected_step], assigns(:selected_step))\n assert_equal(assignment[:instruction], assigns(:instruction))\n assert_equal(assignment[:assignment], assigns(:assignment))\n assert_equal(assignment[:comment], assigns(:comment))\n assert_not_nil(flash[:assignment])\n assert_nil(assigns(:outline_drawing))\n \n section_selections = {}\n section_ids.each { |id| section_selections[id.to_s] = '0' }\n\n # Process Assignment Details - No team members identified and no allegro board symbol\n # provided.\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '0', \"5005\" => '0' })\n\n assert_equal('Please identify the Allegro Board Symbol<br />' +\n 'Please select a team member or members', \n flash['notice'])\n assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n assert_not_nil(assignment[:design])\n assert_equal(@mx234a.id, assignment[:design].id)\n flash[:assignment][:design].name = 'abc'\n \n assert_not_nil(assignment[:selected_step])\n assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n assert_not_nil(assignment[:instruction])\n assert_equal(board_prep_sections[0].id,\n assignment[:instruction].oi_category_section_id)\n \n assert_not_nil(assignment[:member_selections])\n assert_equal({ \"5004\" => '0', \"5005\" => '0' }, assignment[:member_selections])\n \n assert_not_nil(assignment[:team_members])\n assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n assert_not_nil(assignment[:comment])\n assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\n \n follow_redirect\n \n #Verify that the variable where loaded from the flash.\n assert_equal(assignment[:design], assigns(:design)) \n assert_equal(assignment[:category], assigns(:category))\n assert_equal(assignment[:team_members], assigns(:team_members))\n assert_equal(assignment[:selected_step], assigns(:selected_step))\n assert_equal(assignment[:instruction], assigns(:instruction))\n assert_equal(assignment[:assignment], assigns(:assignment))\n assert_equal(assignment[:comment], assigns(:comment))\n assert_not_nil(flash[:assignment])\n assert_nil(assigns(:outline_drawing))\n\n instruction_count = OiInstruction.count\n assignment_count = OiAssignment.count\n assignment_comment_count = OiAssignmentComment.count\n \n \n post(:view_assignments,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(0, assigns(:assignment_list).size)\n \n\n # Process Assignment Details - No errors\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s,\n :allegro_board_symbol => allegro_board_symbol },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '1', \"5005\" => '1' })\n\n assert_equal('The work assignments have been recorded - mail was sent',\n flash['notice'])\n assert_nil(flash[:assignment])\n\n assert_redirected_to(:action => 'oi_category_selection',\n :design_id => @mx234a.id)\n \n \n assert_equal(instruction_count+1, OiInstruction.count)\n instructions = OiInstruction.find(:all)\n last_instruction = instructions.pop\n assert_equal(@scott_g.id, last_instruction.user_id)\n assert_equal(allegro_board_symbol, last_instruction.allegro_board_symbol)\n assert_equal(board_prep_sections[0].id, last_instruction.oi_category_section_id)\n \n assert_equal(assignment_count+2, OiAssignment.count)\n assignments = OiAssignment.find(:all)\n mathi_assignment = assignments.pop\n siva_assignment = assignments.pop\n \n assert(!siva_assignment.complete?)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(last_instruction.id, siva_assignment.oi_instruction_id)\n assert_equal(due_date.to_i, siva_assignment.due_date.to_i)\n assert_equal(medium_complexity_id, siva_assignment.complexity_id)\n\n assert(!mathi_assignment.complete?)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n assert_equal(last_instruction.id, mathi_assignment.oi_instruction_id)\n assert_equal(due_date.to_i, mathi_assignment.due_date.to_i)\n assert_equal(medium_complexity_id, mathi_assignment.complexity_id)\n \n assert_equal(assignment_comment_count+2, OiAssignmentComment.count)\n assignment_comments = OiAssignmentComment.find(:all)\n mathi_comment = assignment_comments.pop\n siva_comment = assignment_comments.pop\n \n assert_equal(siva_assignment.id, siva_comment.oi_assignment_id)\n assert_equal(@scott_g.id, siva_comment.user_id)\n assert_equal(assignment_comment, siva_comment.comment)\n \n assert_equal(mathi_assignment.id, mathi_comment.oi_assignment_id)\n assert_equal(@scott_g.id, mathi_comment.user_id)\n assert_equal(assignment_comment, mathi_comment.comment)\n \n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n set_user(@pat_a.id, 'Product Support')\n post(:process_assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n\n # Verify that a contractor PCB Designer can not access the list.\n set_user(@siva_e.id, 'Designer')\n post(:process_assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify the email that was generated\n expected_to = [ [ @siva_e.email ].sort,\n [ @mathi_n.email ].sort,\n [ @siva_e.email, @mathi_n.email ].sort ]\n \n expected_cc_list = [@scott_g.email,\n @jim_l.email, \n @jan_k.email,\n users(:bala_g).email,\n @cathy_m.email].sort\n \n assert_equal(2, @emails.size) \n mathi_email = @emails.pop\n siva_email = @emails.pop\n \n assert_equal(1, siva_email.to.size)\n assert_equal(@siva_e.email, siva_email.to.pop)\n assert_equal(expected_cc_list, siva_email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment created',\n siva_email.subject)\n\n assert_equal(1, mathi_email.to.size)\n assert_equal(@mathi_n.email, mathi_email.to.pop)\n assert_equal(expected_cc_list, mathi_email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment created', \n mathi_email.subject)\n\n # Verify that a user from outside the PCB Group can not \n # access the view_assignments view\n set_user(@pat_a.id, 'Product Support')\n post(:view_assignments)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n\n # Verify that a contractor PCB Designer can not access the \n # view_assignments view\n set_user(@siva_e.id, 'Designer')\n post(:view_assignments)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify that a Teradyne PCB Designer can access the \n # view_assignments view\n set_user(@scott_g.id, 'Designer')\n post(:view_assignments,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n \n assignment_list = assigns(:assignment_list)\n assert_equal(1, assignment_list.size)\n \n expected_sections = board_prep_sections.dup\n \n # There is only on category populated\n assignment_list.each do |category, assignments|\n assert_equal(expected_sections.shift.id, category.id)\n assert_equal(2, assignments.size)\n end\n \n # Verify that a user from outside the PCB Group can not \n # access the assignment_view view\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_view)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a Teradyne PCB Designer can access the \n # the assignment_view view\n set_user(@scott_g.id, 'Designer')\n assignment_id = assignments.pop.id\n post(:assignment_view, :id => assignment_id)\n \n assert_response(:success)\n assert_equal(assignment_id, assigns(:assignment).id)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n\n comments = assigns(:comments)\n assert_equal(1, comments.size)\n comment = comments.pop\n assert_equal(assignment_comment, comment.comment)\n \n assert_not_nil(assigns(:post_comment))\n \n \n # Verify that a user from outside the PCB Group can not \n # access the category_details view\n set_user(@pat_a.id, 'Product Support')\n post(:category_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a contractor Team Member can access the \n # category_details view\n set_user(@siva_e.id, 'Designer')\n post(:category_details, :id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n \n siva_assignments = assigns(:category_list)\n assert_equal(2, siva_assignments.size)\n assert_not_nil(siva_assignments[@board_prep])\n \n assignment_list = siva_assignments[@board_prep]\n assert_equal(1, assignment_list.size)\n assert_not_nil(assignment_list.detect { |a| \n a.oi_instruction.oi_category_section_id == board_prep_sections[0].id }) \n assignment_list.each { |a| assert_equal(@siva_e.id, a.user_id) }\n\n # Verify that a user from outside the PCB Group can not \n # access the assignment_details view\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a contractor Team Member can access the \n # category_details view\n set_user(@siva_e.id, 'Designer')\n post(:assignment_details,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n \n section_list = assigns(:section_list)\n assert_equal('Board Preparation', section_list[:category].name)\n assert_equal(1, section_list[:assignment_list].size)\n assert_equal(1, section_list[:assignment_list][0].oi_instruction.oi_category_section_id)\n\n\n # Verify that a user from outside the PCB Group can not \n # update an assignment.\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_update)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify that a member of the PCB Design group can \n # update an assignment\n set_user(@siva_e.id, 'Designer')\n \n # Get the instruction with 2 assignments associated with it\n instruction = OiInstruction.find_by_design_id_and_oi_category_section_id(\n @mx234a.id,\n board_prep_sections[0].id)\n\n siva_assignment = instruction.oi_assignments.detect { |a| a.user_id == @siva_e.id }\n mathi_assignment = instruction.oi_assignments.detect { |a| a.user_id == @mathi_n.id }\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(1, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n siva_assignment_comment = siva_assignment.oi_assignment_comments.pop\n mathi_assignment_comment = mathi_assignment.oi_assignment_comments.pop\n assert_not_equal(siva_assignment_comment.id, mathi_assignment_comment.id)\n\n\n post(:assignment_update,\n :assignment => siva_assignment,\n :post_comment => {:comment => 'My 2 cents'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(2, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n cc_list = expected_cc_list.dup + [@siva_e.email] - [@scott_g.email]\n email = @emails.pop\n assert_equal([@scott_g.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update',\n email.subject)\n\n\n post(:assignment_update,\n :assignment => { :id => siva_assignment.id,\n :complete => \"1\"},\n :post_comment => {:comment => 'It is done'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(3, siva_assignment.oi_assignment_comments.size)\n assert_equal(1, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n email = @emails.pop\n assert_equal([@scott_g.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update - Completed',\n email.subject)\n \n set_user(@scott_g.id, 'Designer')\n post(:assignment_update,\n :assignment => { :id => siva_assignment.id,\n :complete => \"0\"},\n :post_comment => {:comment => 'My 2 cents'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(4, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n cc_list = expected_cc_list.dup\n email = @emails.pop\n assert_equal([@siva_e.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update - Reopened',\n email.subject)\n \n end",
"def switch_section\n\t\t#enrollment works here\n\t\t@enrollment = Enroll.find(params[:id])\n\t\t@section = Section.find(@enrollment.section_id)\n\t\t@course = Course.find(@enrollment.course_id)\n\t\t@open_sections = @section.getOtherOpenSections()\n\t\t@offer = @enrollment.offer\n\t\t@compatable_offers = Offer.getCompatableOffers(@section)\n\t\t@transactions = @enrollment.getTransactionsInReverseOrder\n @section_limit = @section.getLimit()\n\tend",
"def section_by_id(section_id); end",
"def section\n @section.call\n end",
"def section; end",
"def process_sections\n @tag_selection.attributes = {'section_ids' => []}.merge(params[:tag_selection] || {})\n end",
"def test_process_assignments\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_list = [@siva_e]\n \n section_selections = {}\n section_ids.each { |id| section_selections[id.to_s] = '0' }\n\n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n pat_dfm_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n \n # Verify that a contractor PCB Designer can not access the list.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n end",
"def section_selected?(section_name)\n if article_id_present?\n current_article.section.name == section_name\n elsif section_id_present?\n current_section.name == section_name\n else # none of the necessary controllers/actions is active\n false\n end\n end",
"def test_append_subsection\n\n new_subsection = { 'date_code_check' => '1',\n 'dot_rev_check' => '1',\n 'full_review' => '1',\n 'name' => 'New Subsection',\n 'note' => 'New subsection note',\n 'url' => 'www.pirateball.com' }\n subsection = {'id' => subsections(:subsection_01_1_1).id}\n section_01_1 = sections(:section_01_1)\n assert_equal(2, section_01_1.subsections.size)\n\n post(:append_subsection, \n { :new_subsection => new_subsection,\n :subsection => subsection },\n cathy_admin_session)\n assert_equal('Appended subsection successfully.', flash['notice'])\n assert_redirected_to(:id => section_01_1.checklist_id,\n :action => 'edit',\n :controller => 'checklist')\n\n section_01_1.reload\n subsections = section_01_1.subsections\n assert_equal(3, subsections.size)\n\n 1.upto(subsections.size) { |x| assert_equal((x), subsections[x-1][:position])}\n\n assert_equal(subsections(:subsection_01_1_1).id, subsections[0][:id])\n assert_equal('New Subsection', subsections[1][:name])\n assert_equal(subsections(:subsection_01_1_2).id, subsections[2][:id])\n\n end",
"def print_test_suite_section(options={})\n options = {\n }.merge(options)\n\n in_test_suite_section = false\n\n # go thru file data\n @testflow_lines.each_index do |linenum|\n line = @testflow_lines[linenum]\n line.gsub!(/\\r/,\"\"); line.gsub!(/\\n/,\"\")\n\n if line =~ /^------/ && in_test_suite_section\n in_test_suite_section = false\n end\n\n if in_test_suite_section\n print \"#{line}\\n\"\n end\n\n if line =~ /^test_suites/\n in_test_suite_section = true\n end\n end\n\nend",
"def click_sections\n find(\"#header-sections\").click\n end",
"def list_sections\n \n end",
"def test_io_category_selection\n \n categories = ['Board Preparation', 'Placement',\n 'Routing', 'Fabrication Drawing',\n 'Nomenclature', 'Assembly Drawing',\n 'Other']\n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:oi_category_selection, {:design_id => @mx234a.id}, pat_dfm_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify that a Teradyne PCB Designer can access the list.\n get(:oi_category_selection, { :design_id => @mx234a.id }, scott_designer_session)\n assert_response(:success)\n assert_not_nil(assigns(:design))\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal('252-234-a0 g', assigns(:design).part_number.pcb_display_name)\n \n assert_not_nil(assigns(:oi_category_list))\n oi_category_list = assigns(:oi_category_list)\n assert_equal(categories.size, oi_category_list.size)\n categories.each_index do |i| \n assert_equal(categories[i], oi_category_list[i].name) \n end\n \n # Verify that a contractor PCB Designer can access the list.\n get(:oi_category_selection, { :design_id => @mx234a.id }, siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n end",
"def test_insert_subsection\n\n section_01_1 = sections(:section_01_1)\n assert_equal(2, section_01_1.subsections.size)\n\n new_subsection = {\n 'name' => 'subsection_01_1_0.5',\n 'note' => 'inserting before the first subsection',\n 'url' => '',\n 'date_code_check' => '1',\n 'dot_rev_check' => '1',\n 'full_review' => '1'\n }\n\n post(:insert_subsection,\n { :new_subsection => new_subsection,\n :subsection => { 'id' => subsections(:subsection_01_1_1).id } },\n cathy_admin_session)\n section_01_1.reload\n subsections = section_01_1.subsections\n assert_equal(3, subsections.size)\n\n assert_equal('subsection_01_1_0.5', subsections[0].name)\n assert_equal('Subsection 1 Note', subsections[1].note)\n assert_equal('Subsection 2 Note', subsections[2].note)\n\n end",
"def section_by_name(section_name); end",
"def set_section\n @course = Course.find(params[:course_id])\n @section = @course.sections.find(params[:section_id])\n end",
"def sections=(value)\n @sections = value\n end",
"def set_section\n @section = @form.sections.find(params[:id])\n end",
"def select_solution\n if session[:solution]\n load_sections(params[:chosen] && params[:chosen].to_i)\n else\n render :nothing => true\n end\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def section_assigned?(oi_instructions, section_id)\n oi_instructions.detect { |i| i.oi_category_section_id == section_id }\n end",
"def init_section; end",
"def test_insert_first\n\n section_01_3 = sections(:section_01_3)\n subsections = section_01_3.subsections\n assert_equal(0, subsections.size)\n \n subsection_count = Subsection.count\n\n new_subsection = { 'name' => 'subsection_01_3_1',\n 'note' => 'adding the first subsection',\n 'url' => 'www.pirateball.com',\n 'date_code_check' => '1',\n 'dot_rev_check' => '1',\n 'full_review' => '1' }\n\n post(:insert_first,\n { :new_subsection => new_subsection,\n :section => { 'id' => section_01_3.id } },\n cathy_admin_session)\n section_01_3.reload\n subsections = section_01_3.subsections\n assert_equal(1, subsections.size)\n subsection_count += 1\n assert_equal(subsection_count, Subsection.count)\n\n subsection = subsections.pop\n\n assert_equal(1, subsection.position)\n assert_equal(section_01_3.id, subsection.section_id)\n assert_equal(section_01_3.checklist_id, subsection.checklist.id)\n\n # Verify the counters were not impacted.\n checklist = subsection.checklist\n assert_equal(6, checklist.designer_only_count)\n assert_equal(5, checklist.designer_auditor_count)\n assert_equal(0, checklist.dc_designer_only_count)\n assert_equal(3, checklist.dc_designer_auditor_count)\n assert_equal(0, checklist.dr_designer_only_count)\n assert_equal(3, checklist.dr_designer_auditor_count)\n \n end",
"def choose_section(section)\n section_name = \"#{section.course} #{section.label}\"\n logger.info \"Downloading grades for #{section_name}\"\n Utils.prepare_download_dir\n wait_for_element_and_select_js(sections_select_element, section_name)\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def set_section\n @section = Section.find(params[:id])\n end",
"def test_move_up\n\n section_01_2 = sections(:section_01_2)\n subsects = section_01_2.subsections\n \n assert_equal(subsections(:subsection_01_2_1).id, subsects[0].id)\n assert_equal(subsections(:subsection_01_2_2).id, subsects[1].id)\n assert_equal(subsections(:subsection_01_2_3).id, subsects[2].id)\n assert_equal(3, subsects.size)\n\n\n get(:move_up, { :id => subsections(:subsection_01_2_2).id }, rich_designer_session)\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n assert_redirected_to(:controller => 'tracker',\t:action => 'index')\n\n get(:move_up, { :id => subsections(:subsection_01_2_2).id }, cathy_admin_session)\n assert('Subsections were re-ordered', flash['notice'])\n assert_redirected_to(:action => 'edit', :controller => 'checklist',\n\t\t\t :id => subsections(:subsection_01_2_2).checklist.id)\n \n subsects.reload\n assert_equal(subsections(:subsection_01_2_2).id, subsects[0].id)\n assert_equal(subsections(:subsection_01_2_1).id, subsects[1].id)\n assert_equal(subsections(:subsection_01_2_3).id, subsects[2].id)\n assert_equal(3, subsects.size)\n\n end",
"def assert_page_section(section_heading)\n Helpers::MobileBrowserHelper.open_section_if_required(section_heading)\n page.all(\".cucumber__clarkordion__item__header--active\").each do |section|\n return nil if section.text.include?(section_heading)\n end\n raise Capybara::ElementNotFound.new(\"Section #{section_heading} was not found\")\n end",
"def test_move_down\n\n section_01_2 = sections(:section_01_2)\n subsects = section_01_2.subsections\n \n assert_equal(subsections(:subsection_01_2_1).id, subsects[0].id)\n assert_equal(subsections(:subsection_01_2_2).id, subsects[1].id)\n assert_equal(subsections(:subsection_01_2_3).id, subsects[2].id)\n assert_equal(3, subsects.size)\n\n get(:move_down, { :id => subsections(:subsection_01_2_2).id }, rich_designer_session)\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n\n get(:move_down, { :id => subsections(:subsection_01_2_1).id }, cathy_admin_session)\n assert('Subsections were re-ordered', flash['notice'])\n assert_redirected_to(:action => 'edit', :controller => 'checklist',\n :id => subsections(:subsection_01_2_2).checklist.id)\n \n subsects.reload\n assert_equal(subsections(:subsection_01_2_2).id, subsects[0].id)\n assert_equal(subsections(:subsection_01_2_1).id, subsects[1].id)\n assert_equal(subsections(:subsection_01_2_3).id, subsects[2].id)\n assert_equal(3, subsects.size)\n\n end",
"def print_test_flow_section (options={})\n options = {\n }.merge(options)\n\n in_test_flow_section = false\n # go thru file data\n @testflow_lines.each_index do |linenum|\n line = @testflow_lines[linenum]\n line.gsub!(/\\r/,\"\"); line.gsub!(/\\n/,\"\")\n\n if line =~ /^------/ && in_test_flow_section\n in_test_flow_section = false\n end\n\n\n if in_test_flow_section\n \n # close all groups for easier comparison\n if line =~ /, open,/\n line.gsub!(/, open,/,\", closed, \")\n end\n print \"#{line}\\n\"\n end\n\n if line =~ /^test_flow/\n in_test_flow_section = true\n end\n end\n\nend",
"def set_section_p\n @section = Section.find(params[:section_id])\n end",
"def set_section\n @section = EventGroup.find(params[:id] || params[:section_id])\n end",
"def section_selector\n \"s_#{page_layout.id}_#{page_layout.section_id}\"\n end",
"def load_sections(solution_to_load = nil, show_previews = false)\n\n user = User.find session[:user]\n plan = user.semesters.find(params[:id]).course_plan\n semester = Semester.find(params[:id]);\n courses = semester.cis_courses\n\n if solution_to_load\n plan.cis_sections.delete plan.cis_sections\n plan.cis_sections.concat session[:solution][solution_to_load]\n end\n\n # previews stuff\n npreviews = 6\n @solutions = session[:solution]\n\n @total_width = 100\n @total_height = 100\n padding_horiz = 5\n padding_vert = 5\n ndays = 6\n nhours = 15\n @start_hour = 8\n\n @seconds_per_pixel = nhours * 60 * 60 / (@total_height - 2 * padding_vert)\n\n @width = (@total_width - 2 * padding_horiz)/ ndays\n\n @day_left = {\n 'M' => 0,\n 'T' => @width,\n 'W' => @width * 2,\n 'R' => @width * 3,\n 'F' => @width * 4,\n 'S' => @width * 5,\n }\n\n if !session[:generator_error] && (!session[:solution] || session[:solution].length == 0)\n session[:generator_error] = 'No possible schedules (Click here to close).'\n end\n\n render :update do |page|\n if solution_to_load\n page.replace_html 'times_row', :partial => 'times_row', :locals => {:semester => semester}\n courses.each do |course|\n if course.sections_for_semester(semester) && course.sections_for_semester(semester).length != 0\n page.replace_html \"sects_#{semester.id}_#{course.id}\", :partial => 'section_choice', :collection => course.sections_for_semester(semester), :locals => {:semester => semester}\n end\n end\n else\n if session[:generator_error]\n page.replace_html 'generator_error', session[:generator_error]\n else\n page.replace_html 'previews_list', :partial => 'solution', :collection => @solutions[session[:marker], npreviews]\n end\n end\n if show_previews\n page.visual_effect :toggle_blind, 'previews_window'\n end\n end\n end",
"def test_modify_checks\n\n subsection_01_1_1 = subsections(:subsection_01_1_1)\n\n # Try editing without logging in.\n @request.session[:user] = nil\n @request.session[:active_role] = nil\n @request.session[:roles] = nil\n \n put(:modify_checks, { :id => subsection_01_1_1.id }, {})\n assert_redirected_to(:controller => 'user', :action => 'login')\n assert_equal('Please log in', flash[:notice])\n\n # Try editing from an Admin account\n admin_session = cathy_admin_session\n put(:modify_checks, { :id => subsection_01_1_1.id }, admin_session)\n assert_response 200\n assert_equal(subsection_01_1_1.id, assigns(:subsection).id)\n \n # TODO:\n # Is there a better way to test than with hard code?\n # The only query I can think of is the same one that \n # is used in the method\n assert_equal(3, assigns(:checks).size)\n\n # Try with a subsection that has no checks.\n subsection_01_2_3 = subsections(:subsection_01_2_3)\n \n put(:modify_checks, { :id => subsection_01_2_3.id }, admin_session)\n assert_redirected_to(:action => 'add_first', :id => subsection_01_2_3.id)\n \n end",
"def find_section\n @section = Section.find(params[:section_id])\n end",
"def sections(*args); end",
"def sections\n respond_with @page.sections\n end",
"def sections\n respond_with @page.sections\n end",
"def load_section!\n if @extra_page\n @section = current_cookbook.sections.find @extra_page.section_id\n else\n @section = current_cookbook.sections.find params[:section_id]\n end\n end",
"def show\n @section = Section.find(params[:id]) \t\n @nav_sections = Section.where(scenario_id: @section.scenario_id).order(:order)\n @inquests = Inquest.where(section_id: params[:id]).order(:order)\n @scenario = Scenario.where(id: @section.scenario_id)[0]\n end",
"def match_extraction_form_section input\n section = case input\n # these should be consistent now\n when \"questions\" then \"Assign Key Questions\"\n when \"publications\" then \"Publications\"\n when \"arms\" then \"Study Arms\"\n when \"design\" then \"Design Details\"\n when \"baselines\" then \"Baseline Characteristics\"\n when \"outcomes\" then \"Outcome Setup\"\n when \"results\" then \"Outcome Data\"\n when \"adverse\" then \"Adverse Events\"\n when \"quality\" then \"Study Quality\"\n when \"import\" then \"Import from Previous Forms\"\n else input.to_s.capitalize\n end\n return section\n end",
"def set_section\n @section = Section.friendly.find(params[:id])\n end",
"def section_id\n 'generic'\n end",
"def create_section_event_context\n \n end",
"def create_section_context\n @wy_belt_sparring = FactoryGirl.create(:section, event: @sparring, tournament: @fall)\n @wy_belt_breaking = FactoryGirl.create(:section, event: @breaking, tournament: @fall, location: \"Stage\")\n @wy_belt_forms = FactoryGirl.create(:section, event: @forms, tournament: @fall)\n @r_belt_breaking = FactoryGirl.create(:section, event: @breaking, min_rank: 8, max_rank: 10, min_age: 13, max_age: 15, tournament: @fall)\n @r_belt_sparring = FactoryGirl.create(:section, event: @sparring, min_rank: 8, max_rank: 10, min_age: 13, max_age: 15, active: false, tournament: @fall)\n @bl_belt_breaking = FactoryGirl.create(:section, event: @breaking, min_rank: 11, max_rank: nil, min_age: 18, max_age: nil, tournament: @dans)\n end",
"def section(ident)\n @sections[ident]\n end",
"def build_section_html(tree, node, section_hash, special_context = nil)\n #\n return '' if special_context.present? && !node.valid_context?(special_context)\n return '' unless node.is_enabled?\n subpieces = \"\"\n unless node.leaf?\n subnodes = tree.select{|n| n.parent_id==node.id}\n for child in subnodes\n next unless child.is_enabled?\n subpiece = build_section_html(tree, child, section_hash, special_context)\n subpieces.concat(subpiece)\n end\n end\n piece = node.section.build_html\n # replace ~~selectors~~ with ex. 's_112_2 c_111'\n unless node.root?\n offline_css = \"s_#{node.id}_#{node.section_id} c_#{node.parent_id} #{node.get_css_class}\"\n if node.has_extra_selector?\n piece.sub!('~~selector~~', \"#{offline_css} <%=@template.get_css_classes %>\")\n else\n piece.sub!('~~selector~~', offline_css)\n end\n #if node.content_css_class.present?\n # piece.sub!(/\\bcontent_css_class_placeholder/, node.content_css_class)\n #end\n end\n # if node.root?\n # piece.insert(0,init_vars)\n # end\n # select current page_layout at end of subpieces, pagination required, data_souce_param is on current page_layout\n subpieces << get_section_script(node) if subpieces.present?\n\n #piece may contain several ~~content~~, the deepest one is first.\n if(pos = (piece=~/~~content~~/))\n if node.data_source.present? #node.data_source.singularize\n case node.current_data_source\n # var_collection has to vary in name, may be nested.\n # data_source, data_item is for column index computing.\n when DataSourceEnum.gpvs, DataSourceEnum.this_product, DataSourceEnum.gpvs_theme\n # for this_product, we have to wrapped with form, or option_value radio would not work.\n form_enabled = node.get_content_param_by_key( :form_enabled )\n remote_form_enabled = node.get_content_param_by_key( :remote_form_enabled )\n if remote_form_enabled\n form_start = '<%= form_for :order, url: populate_orders_path, remote: true do |f| %>'\n form_end = '<% end %>'\n elsif form_enabled\n form_start = '<%= form_for :order, url: populate_orders_path do |f| %>'\n form_end = '<% end %>'\n else\n form_start = form_end =nil\n end\n # once data_source retrieved, we should use context :site1_themes to support product_property.property.presentation\n subpieces = <<-EOS1\n <% @template.running_data_source= @template.products( (defined?(page) ? page : @current_page) ) %>\n <% @template.running_data_source.each(){|product| @template.running_data_item = product %>\n #{form_start}\n #{subpieces}\n #{form_end}\n <% } %>\n #{get_pagination(node)}\n <% @template.running_data_source = nil %>\n EOS1\n #set var_collection to nil, or render pagination more times\n when DataSourceEnum.related_products\n subpieces = <<-EOS1\n <% @template.running_data_source= @template.related_products( ) %>\n <% @template.running_data_source.each(){|product| @template.running_data_item = product %>\n #{subpieces}\n <% } %>\n #{get_pagination(node)}\n <% @template.running_data_source = nil %>\n EOS1\n\n when DataSourceEnum.blog, DataSourceEnum.post\n subpieces = <<-EOS1\n <% @template.running_data_source= @template.posts( (defined?(page) ? page : @current_page) ) %>\n <% @template.running_data_source.each{|post| @template.running_data_item = post %>\n #{subpieces}\n <% } %>\n #{get_pagination(node)}\n <% @template.running_data_source = nil %>\n EOS1\n #when DataSourceEnum.related_posts\n # subpieces = <<-EOS1\n # <% @template.running_data_source= @template.related_posts( (defined?(page) ? page : @current_page) ) %>\n # <% @template.running_data_source.each{|post| @template.running_data_item = post %>\n # #{subpieces}\n # <% } %>\n # <% @template.running_data_source = nil %>\n # EOS1\n when DataSourceEnum.taxonomy\n #assigned menu could be root or node\n subpieces = <<-EOS3\n <% if @template.menu.present? %>\n <% if @template.menu.root? %>\n <% @template.running_data_source= @template.menu.children %>\n <% @template.running_data_source.each{|page| @template.running_data_item = page %> #{subpieces} <%}%>\n <% @template.running_data_source = nil %>\n <% else %>\n <% @template.running_data_source= @template.menu %>\n <% @template.running_data_source.tap{|page| @template.running_data_item = page %> #{subpieces} <%}%>\n <% @template.running_data_source = nil %>\n <% end %>\n <% end %>\n EOS3\n when DataSourceEnum.taxon\n #assigned node, could be root\n subpieces = <<-EOS6\n <% if @template.menu.present? %>\n <% @template.running_data_source= @template.menu %>\n <% @template.running_data_source.tap{|page| @template.running_data_item = page %> #{subpieces} <%}%>\n <% @template.running_data_source = nil %>\n <% end %>\n EOS6\n when DataSourceEnum.related_taxon\n #assigned node, could be root\n subpieces = <<-EOS7\n <% @template.running_data_source= @template.related_taxon%>\n <% @template.running_data_source.each{|page| @template.running_data_item = page %> #{subpieces} <%}%>\n <% @template.running_data_source = nil %>\n EOS7\n end\n end\n # we recovery template.select after ~~content~~\n piece.insert(pos,subpieces)\n end\n\n if node.section_context.present?\n # should set current page_layout before do valid_context.\n piece = <<-EOS2\n <% if @current_page.valid_context? %>\n #{piece}\n <% end %>\n EOS2\n end\n\n piece = \"#{get_section_script(node)} #{piece} \"\n\n # remove ~~content~~ however, node could be a container.\n # in section.build_html, ~~content~~ have not removed.\n # there could be more than one ~~content~~, use gsub!\n piece.gsub!(/~~content~~/,'')\n piece\n end",
"def sections(project_id, suite_id)\n get(\"get_sections/#{project_id}&suite_id=#{suite_id}\")\n end",
"def toggle_section\n\n # friend is viewing schedule\n if Semester.find(params[:id]).user.id.to_s != session[:user].to_s\n render :nothing => true\n return\n end\n\n user = User.find session[:user]\n section = CisSection.find(params[:section])\n plan = user.semesters.find(params[:id]).course_plan\n\n if plan.cis_sections.exists? params[:section]\n plan.cis_sections.delete section\n else\n plan.cis_sections.concat section\n end\n\n @semester = Semester.find(params[:id])\n\n # TODO clean this up\n @start_time = DateTime.new(0,1,1,8)\n @end_time = DateTime.new(0,1,1,21,30)\n @time_inc = 15/(24.0*60)\n @courses = @semester.cis_courses\n @plan = @semester.course_plan\n course = section.cis_semester.cis_course\n\n sections = course.sections_for_semester @semester\n\n render :update do |page|\n page.replace_html 'times_row', :partial => 'times_row', :locals => {:semester => @semester}\n page.replace_html \"sects_#{@semester.id}_#{course.id}\", :partial => 'section_choice', :collection => sections, :locals => {:semester => @semester}\n end\n end",
"def set_section_row\n @section_row = SectionRow.find(params[:id])\n end",
"def section_params\n params.require(:section).permit(:course_id, :year_id, :term_id, :block_id)\n end",
"def section?\n type == \"Section\"\n end",
"def section_by_id(section_id = @one_section_id)\n url = @url_sections + '/' + section_id\n @nsx_client.get(url)\n end",
"def section=(section)\n self[:section] = section\n end",
"def add_section(fields={})\n section_data = fields.merge({\n :suite_id => data.id,\n })\n return add_entity(Section, data.project_id, section_data)\n end",
"def section_id\n \"section-#{name}\"\n end",
"def section_for_script(script)\n sections_as_student.find {|section| section.script_id == script.id} ||\n sections.find {|section| section.script_id == script.id}\n end",
"def show\n @section = Section.find(params[:id])\n session[:section] = @section.id\n @test = Test.find(@section.test_id)\n @test_id = @test.id\n session[:test_id] = @test_id \n\n @user = current_user\n if @user.pssed_sections.include?(@test_id)\n flash[:info] = \"Already passed\"\n end\n end",
"def set_divisions_and_sections\n @division = current_user.section.division\n @sections = @division.sections.order(\"number\")\n end",
"def end_section\n end",
"def sections\n temp_sections = []\n if @section_ids.count > 0\n @section_ids.each do |section_id|\n temp_sections.push @client.section(@org_id, section_id)\n end\n end\n return temp_sections\n end",
"def test_008\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n @@pj = Pj.find_by_name('SamplePJ1')#\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # test for value of master into combobox in master tab\n assert_equal [\"sample_c_cpp\"], get_select_options(\"master_id\")\n assert is_text_present(_(\"Optional setting\"))\n\n click $xpath[\"task\"][\"registration_task_button\"]\n sleep 2\n #assert !60.times{ break if (is_text_present(\"解析ツール未選択 入力内容に問題があるためタスクを登録できません。\") rescue false); sleep 2 }\n\n\n # logout\n logout\n\n end",
"def section\n return @section if @section\n\n resp = HTTP\n .headers(authorization: \"Bearer #{access_token[:access_token]}\")\n .get(LIST_SECTIONS_ENDPOINT % notebook[:id], params: {\n select: 'id,name',\n filter: \"name eq '#{Config[:section]}'\"\n })\n if resp.code.to_s.start_with? '2'\n json = response_body(resp)\n @section = JSON.parse(json, symbolize_names: true)[:value].first\n end\n return @section\n end",
"def test_007\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n @@pu = Pu.find_by_name('SamplePU1')\n\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n @@pj = Pj.find_by_name('SamplePJ1')\n\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # test for value of master into combobox in master tab\n assert_equal [\"sample_c_cpp\"], get_select_options(\"master_id\")\n assert is_text_present(_(\"Optional setting\"))\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n # click link setup QAC++\n assert is_text_present(\"qacpp\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link2\"]\n sleep 2\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n\n\n # logout\n logout\n\n end",
"def create_section_context\n @wy_belt_sparring = FactoryGirl.create(:section, :event => @sparring, :tournament => @am)\n @wy_belt_breaking = FactoryGirl.create(:section, :event => @breaking, :tournament => @pm)\n @r_belt_breaking = FactoryGirl.create(:section, :event => @breaking, :tournament => @pm, :min_rank => 8, :max_rank => 10, :min_age => 13, :max_age => 15)\n @r_belt_sparring = FactoryGirl.create(:section, :event => @sparring, :tournament => @am, :min_rank => 8, :max_rank => 10, :min_age => 13, :max_age => 15, :active => false)\n @bl_belt_breaking = FactoryGirl.create(:section, :event => @breaking, :tournament => @pm, :min_rank => 11, :max_rank => nil, :min_age => 18, :max_age => nil)\n end",
"def deselect_section()\n result = super()\n raise get_message(result) if result != TPL_OK\n @stack.pop\n return true\n end",
"def prepare_section(sun_state, irradiance, section)\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 section_preparation_finished\n end",
"def toggle_section_complete\n unless params[:ef_section].empty?\n study_id = params[:study_id]\n extraction_form_id = params[:extraction_form_id]\n @section = params[:ef_section]\n @new_status = Study.toggle_section_complete(study_id, extraction_form_id, @section, current_user.id)\n if @section == 'all'\n session[:completed_sections].keys.each do |k|\n puts \"\\n\\nsetting key of #{k} to #{@new_status}\\n\\n\"\n session[:completed_sections][k] = [@new_status, current_user.id]\n end\n else\n session[:completed_sections][@section] = [@new_status, current_user.id]\n end\n @finalize_tab = params[:finalize_tab] == 'true' ? true : false\n end\n end",
"def show_collection_section(collection, section)\n if [\"intro\", \"faq\", \"rules\"].include?(section) # just a check that we're not using a bogus section string\n !collection.collection_profile.send(section).blank? || collection.parent && !collection.parent.collection_profile.send(section).blank?\n end\n end",
"def test_cases; end",
"def section\n @section || path_section\n end",
"def create_discount_eligible_section(teacher, section_name = 'Discount Eligible Section')\n section = Section.create!(name: section_name, user_id: teacher.id)\n csd2 = Script.get_from_cache('csd2')\n csd3 = Script.get_from_cache('csd3')\n\n csd2_programming_level_ids = csd2.levels.select {|level| level.is_a?(Weblab)}.map(&:id).first(5)\n csd3_programming_level_ids = csd3.levels.select {|level| level.is_a?(Gamelab)}.map(&:id).first(5)\n\n 10.times do |n|\n student = User.create!(\n name: \"Student#{n}\",\n user_type: 'student',\n age: 20,\n password: 'secret',\n provider: 'sponsored',\n )\n section.add_student(student)\n csd2_programming_level_ids.each do |level_id|\n UserLevel.find_or_create_by!(user_id: student.id, level_id: level_id, script_id: csd2.id)\n end\n csd3_programming_level_ids.each do |level_id|\n UserLevel.find_or_create_by!(user_id: student.id, level_id: level_id, script_id: csd3.id)\n end\n end\n section\nend",
"def section=(_arg0); end"
] |
[
"0.6841492",
"0.67223203",
"0.6290562",
"0.623527",
"0.6116589",
"0.5965091",
"0.59279114",
"0.58901155",
"0.5863963",
"0.58354694",
"0.5829924",
"0.57749844",
"0.5761754",
"0.57307285",
"0.5727075",
"0.57064474",
"0.5703775",
"0.56948864",
"0.568129",
"0.5634366",
"0.561321",
"0.5550742",
"0.5527828",
"0.55165267",
"0.5514774",
"0.5514774",
"0.551147",
"0.5470333",
"0.5462136",
"0.54372674",
"0.5421074",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5420872",
"0.5411797",
"0.53912127",
"0.53899795",
"0.53891885",
"0.53867453",
"0.538037",
"0.5368143",
"0.53498274",
"0.53208476",
"0.5317619",
"0.53165615",
"0.5306224",
"0.5306224",
"0.52675116",
"0.5224609",
"0.52211493",
"0.52034837",
"0.5194188",
"0.5183749",
"0.51835775",
"0.51816845",
"0.5160712",
"0.5146227",
"0.5144228",
"0.5133965",
"0.5118931",
"0.51147187",
"0.51006335",
"0.50848114",
"0.50711304",
"0.5070158",
"0.5059578",
"0.5058278",
"0.5053141",
"0.50510305",
"0.5028814",
"0.5027323",
"0.5020746",
"0.50206524",
"0.50181216",
"0.50108135",
"0.5003246",
"0.49992108",
"0.4992555",
"0.49839544",
"0.4977411",
"0.49773946",
"0.49632016",
"0.4942578",
"0.49400327"
] |
0.74733424
|
0
|
test_process_assignments Description: This method does the functional testing of the
|
def test_process_assignments
board_prep_sections = [oi_category_sections(:board_prep_1),
oi_category_sections(:board_prep_2),
oi_category_sections(:board_prep_3)]
section_ids = board_prep_sections.collect { |s| s.id }
team_member_list = [@siva_e]
section_selections = {}
section_ids.each { |id| section_selections[id.to_s] = '0' }
# Try accessing from an account that is not a PCB Designer and
# verify that the user is redirected.
post(:process_assignments,
{ :category => { :id => @board_prep.id },
:design => { :id => @mx234a.id },
:section => section_selections },
pat_dfm_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a contractor PCB Designer can not access the list.
post(:process_assignments,
{ :category => { :id => @board_prep.id },
:design => { :id => @mx234a.id },
:section => section_selections },
siva_designer_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
#assert_equal("You are not authorized to access this page", flash['notice'])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def process_assignments(user)\n # A user can manage an Assignment if they have the\n # can_manage_assignments? permission in any of the CourseOfferings of\n # the Course that the assignment belongs to.\n #\n # TODO This may need improvement.\n can :manage, Assignment do |assignment|\n course = assignment.course\n course_offerings = course.course_offerings.joins(\n :course_enrollments => :course_role).where(\n course_enrollments: { user_id: user.id },\n course_roles: { can_manage_assignments: true }\n )\n\n course_offerings.any?\n end\n\n can :read, Assignment do |assignment|\n course = assignment.course\n course_offerings = course.course_offerings.joins(\n :course_enrollments).where(\n course_enrollments: { user_id: user.id }\n )\n\n course_offerings.any?\n end\n\n # A user can manage an AssignmentOffering in any CourseOffering where\n # they are enrolled and have the can_manage_assignments? permission.\n\n can :manage, AssignmentOffering do |offering|\n course_offering = offering.course_offering\n\n user_enrollment = CourseEnrollment.where(\n user_id: user.id,\n course_offering_id: course_offering.id).first\n\n user_enrollment && user_enrollment.course_role.can_manage_assignments?\n end\n\n # A user can read an AssignmentOffering in any course offering where\n # they are enrolled, period.\n\n can :read, AssignmentOffering do |offering|\n course_offering = offering.course_offering\n\n CourseEnrollment.where(\n user_id: user.id,\n course_offering_id: course_offering.id).any?\n end\n end",
"def test_task_assignment\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_list = [@siva_e]\n \n designer_session = scott_designer_session\n \n \n # Verify that a Teradyne PCB Designer can access the list\n # \n # Section Selection - Other\n get(:section_selection,\n { :id => @other.id, :design_id => @mx234a.id },\n designer_session) \n assert_redirected_to(:action => :process_assignments,\n :category_id => @other.id,\n :design_id => @mx234a.id,\n :section_id => OiCategory.other_category_section_id)\n \n # Section Selection - Board Prep\n get(:section_selection,\n {:id => @board_prep.id, :design_id => @mx234a.id }, \n designer_session)\n assert_equal(board_prep_sections, assigns(:sections))\n assert_equal(0, assigns(:section_id))\n \n # Process Assignments - No step selected\n post(:process_assignments,\n { :design => { :id => @mx234a.id },\n :category => { :id => @board_prep.id } },\n designer_session)\n #assert_equal(\"Please select the step\", flash['notice'])\n assert_nil(flash[:assignment])\n assert_redirected_to(:action => 'section_selection',\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n \n # Process Assignments - No errors\n post(:process_assignments,\n { :section_id => oi_category_sections(:board_prep_1).id,\n :design => { :id => @mx234a.id },\n :category => { :id => @board_prep.id } },\n designer_session)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n \n lcr_team_members = assigns(:team_members)\n expected_team_members = [@siva_e, @mathi_n] \n assert_equal(expected_team_members, lcr_team_members)\n \n assert_equal(oi_category_sections(:board_prep_1).id,\n assigns(:selected_step).id)\n \n instruction = assigns(:instruction)\n assert_equal(@board_prep.id, instruction.oi_category_section_id)\n assert_equal(@mx234a.id, instruction.design_id)\n \n assignment = assigns(:assignment)\n assert_equal((Time.now+1.day).year, assignment.due_date.year)\n assert_equal((Time.now+1.day).month, assignment.due_date.month)\n assert_equal((Time.now+1.day).day, assignment.due_date.day)\n assert_equal(OiAssignment.complexity_id('Low'), assignment.complexity_id)\n \n assert_not_nil(assigns(:comment))\n \n assert(!assigns(:selected_step).outline_drawing_link?)\n \n allegro_board_symbol = '10987654321'\n assignment_comment = 'This is a test'\n medium_complexity_id = OiAssignment.complexity_id('Medium')\n due_date = Time.local(2007, \"May\", 1)\n \n # Process Assignment Details - No allegro board symbol provided.\n post(:process_assignment_details,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '1', \"5005\" => '1' } },\n designer_session,\n {:assignment => {:instruction => \"\",\n :member_selections => \"\",\n :comment => \"\",\n :assignment => \"\"\n } }\n )\n #assert_equal('Please identify the Allegro Board Symbol', flash['notice'])\n #assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n #assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n #assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n #assert_not_nil(assignment[:design])\n #assert_equal(@mx234a.id, assignment[:design].id)\n #flash[:assignment][:design].name = 'abc'\n \n #assert_not_nil(assignment[:selected_step])\n #assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n #assert_not_nil(assignment[:instruction])\n #assert_equal(board_prep_sections[0].id,\n # assignment[:instruction].oi_category_section_id)\n \n #assert_not_nil(assignment[:member_selections])\n #assert_equal({ \"5004\" => '1', \"5005\" => '1' }, assignment[:member_selections])\n \n #assert_not_nil(assignment[:team_members])\n #assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n #assert_not_nil(assignment[:comment])\n #assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\nreturn \n follow_redirect!\n \n #Verify that the variable where loaded from the flash.\n #assert_equal(assignment[:design], assigns(:design)) \n #assert_equal(assignment[:category], assigns(:category))\n #assert_equal(assignment[:team_members], assigns(:team_members))\n #assert_equal(assignment[:selected_step], assigns(:selected_step))\n #assert_equal(assignment[:instruction], assigns(:instruction))\n #assert_equal(assignment[:assignment], assigns(:assignment))\n #assert_equal(assignment[:comment], assigns(:comment))\n #assert_not_nil(flash[:assignment])\n #assert_nil(assigns(:outline_drawing))\n \n \n # Process Assignment Details - No team members identified.\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s,\n :allegro_board_symbol => allegro_board_symbol },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '0', \"5005\" => '0' })\n\n assert_equal('Please select a team member or members', flash['notice'])\n assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n assert_not_nil(assignment[:design])\n assert_equal(@mx234a.id, assignment[:design].id)\n flash[:assignment][:design].name = 'abc'\n \n assert_not_nil(assignment[:selected_step])\n assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n assert_not_nil(assignment[:instruction])\n assert_equal(board_prep_sections[0].id,\n assignment[:instruction].oi_category_section_id)\n \n assert_not_nil(assignment[:member_selections])\n assert_equal({ \"5004\" => '0', \"5005\" => '0' }, assignment[:member_selections])\n \n assert_not_nil(assignment[:team_members])\n assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n assert_not_nil(assignment[:comment])\n assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\n \n follow_redirect\n \n #Verify that the variable where loaded from the flash.\n assert_equal(assignment[:design], assigns(:design)) \n assert_equal(assignment[:category], assigns(:category))\n assert_equal(assignment[:team_members], assigns(:team_members))\n assert_equal(assignment[:selected_step], assigns(:selected_step))\n assert_equal(assignment[:instruction], assigns(:instruction))\n assert_equal(assignment[:assignment], assigns(:assignment))\n assert_equal(assignment[:comment], assigns(:comment))\n assert_not_nil(flash[:assignment])\n assert_nil(assigns(:outline_drawing))\n \n section_selections = {}\n section_ids.each { |id| section_selections[id.to_s] = '0' }\n\n # Process Assignment Details - No team members identified and no allegro board symbol\n # provided.\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '0', \"5005\" => '0' })\n\n assert_equal('Please identify the Allegro Board Symbol<br />' +\n 'Please select a team member or members', \n flash['notice'])\n assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n assert_not_nil(assignment[:design])\n assert_equal(@mx234a.id, assignment[:design].id)\n flash[:assignment][:design].name = 'abc'\n \n assert_not_nil(assignment[:selected_step])\n assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n assert_not_nil(assignment[:instruction])\n assert_equal(board_prep_sections[0].id,\n assignment[:instruction].oi_category_section_id)\n \n assert_not_nil(assignment[:member_selections])\n assert_equal({ \"5004\" => '0', \"5005\" => '0' }, assignment[:member_selections])\n \n assert_not_nil(assignment[:team_members])\n assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n assert_not_nil(assignment[:comment])\n assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\n \n follow_redirect\n \n #Verify that the variable where loaded from the flash.\n assert_equal(assignment[:design], assigns(:design)) \n assert_equal(assignment[:category], assigns(:category))\n assert_equal(assignment[:team_members], assigns(:team_members))\n assert_equal(assignment[:selected_step], assigns(:selected_step))\n assert_equal(assignment[:instruction], assigns(:instruction))\n assert_equal(assignment[:assignment], assigns(:assignment))\n assert_equal(assignment[:comment], assigns(:comment))\n assert_not_nil(flash[:assignment])\n assert_nil(assigns(:outline_drawing))\n\n instruction_count = OiInstruction.count\n assignment_count = OiAssignment.count\n assignment_comment_count = OiAssignmentComment.count\n \n \n post(:view_assignments,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(0, assigns(:assignment_list).size)\n \n\n # Process Assignment Details - No errors\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s,\n :allegro_board_symbol => allegro_board_symbol },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '1', \"5005\" => '1' })\n\n assert_equal('The work assignments have been recorded - mail was sent',\n flash['notice'])\n assert_nil(flash[:assignment])\n\n assert_redirected_to(:action => 'oi_category_selection',\n :design_id => @mx234a.id)\n \n \n assert_equal(instruction_count+1, OiInstruction.count)\n instructions = OiInstruction.find(:all)\n last_instruction = instructions.pop\n assert_equal(@scott_g.id, last_instruction.user_id)\n assert_equal(allegro_board_symbol, last_instruction.allegro_board_symbol)\n assert_equal(board_prep_sections[0].id, last_instruction.oi_category_section_id)\n \n assert_equal(assignment_count+2, OiAssignment.count)\n assignments = OiAssignment.find(:all)\n mathi_assignment = assignments.pop\n siva_assignment = assignments.pop\n \n assert(!siva_assignment.complete?)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(last_instruction.id, siva_assignment.oi_instruction_id)\n assert_equal(due_date.to_i, siva_assignment.due_date.to_i)\n assert_equal(medium_complexity_id, siva_assignment.complexity_id)\n\n assert(!mathi_assignment.complete?)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n assert_equal(last_instruction.id, mathi_assignment.oi_instruction_id)\n assert_equal(due_date.to_i, mathi_assignment.due_date.to_i)\n assert_equal(medium_complexity_id, mathi_assignment.complexity_id)\n \n assert_equal(assignment_comment_count+2, OiAssignmentComment.count)\n assignment_comments = OiAssignmentComment.find(:all)\n mathi_comment = assignment_comments.pop\n siva_comment = assignment_comments.pop\n \n assert_equal(siva_assignment.id, siva_comment.oi_assignment_id)\n assert_equal(@scott_g.id, siva_comment.user_id)\n assert_equal(assignment_comment, siva_comment.comment)\n \n assert_equal(mathi_assignment.id, mathi_comment.oi_assignment_id)\n assert_equal(@scott_g.id, mathi_comment.user_id)\n assert_equal(assignment_comment, mathi_comment.comment)\n \n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n set_user(@pat_a.id, 'Product Support')\n post(:process_assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n\n # Verify that a contractor PCB Designer can not access the list.\n set_user(@siva_e.id, 'Designer')\n post(:process_assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify the email that was generated\n expected_to = [ [ @siva_e.email ].sort,\n [ @mathi_n.email ].sort,\n [ @siva_e.email, @mathi_n.email ].sort ]\n \n expected_cc_list = [@scott_g.email,\n @jim_l.email, \n @jan_k.email,\n users(:bala_g).email,\n @cathy_m.email].sort\n \n assert_equal(2, @emails.size) \n mathi_email = @emails.pop\n siva_email = @emails.pop\n \n assert_equal(1, siva_email.to.size)\n assert_equal(@siva_e.email, siva_email.to.pop)\n assert_equal(expected_cc_list, siva_email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment created',\n siva_email.subject)\n\n assert_equal(1, mathi_email.to.size)\n assert_equal(@mathi_n.email, mathi_email.to.pop)\n assert_equal(expected_cc_list, mathi_email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment created', \n mathi_email.subject)\n\n # Verify that a user from outside the PCB Group can not \n # access the view_assignments view\n set_user(@pat_a.id, 'Product Support')\n post(:view_assignments)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n\n # Verify that a contractor PCB Designer can not access the \n # view_assignments view\n set_user(@siva_e.id, 'Designer')\n post(:view_assignments)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify that a Teradyne PCB Designer can access the \n # view_assignments view\n set_user(@scott_g.id, 'Designer')\n post(:view_assignments,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n \n assignment_list = assigns(:assignment_list)\n assert_equal(1, assignment_list.size)\n \n expected_sections = board_prep_sections.dup\n \n # There is only on category populated\n assignment_list.each do |category, assignments|\n assert_equal(expected_sections.shift.id, category.id)\n assert_equal(2, assignments.size)\n end\n \n # Verify that a user from outside the PCB Group can not \n # access the assignment_view view\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_view)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a Teradyne PCB Designer can access the \n # the assignment_view view\n set_user(@scott_g.id, 'Designer')\n assignment_id = assignments.pop.id\n post(:assignment_view, :id => assignment_id)\n \n assert_response(:success)\n assert_equal(assignment_id, assigns(:assignment).id)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n\n comments = assigns(:comments)\n assert_equal(1, comments.size)\n comment = comments.pop\n assert_equal(assignment_comment, comment.comment)\n \n assert_not_nil(assigns(:post_comment))\n \n \n # Verify that a user from outside the PCB Group can not \n # access the category_details view\n set_user(@pat_a.id, 'Product Support')\n post(:category_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a contractor Team Member can access the \n # category_details view\n set_user(@siva_e.id, 'Designer')\n post(:category_details, :id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n \n siva_assignments = assigns(:category_list)\n assert_equal(2, siva_assignments.size)\n assert_not_nil(siva_assignments[@board_prep])\n \n assignment_list = siva_assignments[@board_prep]\n assert_equal(1, assignment_list.size)\n assert_not_nil(assignment_list.detect { |a| \n a.oi_instruction.oi_category_section_id == board_prep_sections[0].id }) \n assignment_list.each { |a| assert_equal(@siva_e.id, a.user_id) }\n\n # Verify that a user from outside the PCB Group can not \n # access the assignment_details view\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a contractor Team Member can access the \n # category_details view\n set_user(@siva_e.id, 'Designer')\n post(:assignment_details,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n \n section_list = assigns(:section_list)\n assert_equal('Board Preparation', section_list[:category].name)\n assert_equal(1, section_list[:assignment_list].size)\n assert_equal(1, section_list[:assignment_list][0].oi_instruction.oi_category_section_id)\n\n\n # Verify that a user from outside the PCB Group can not \n # update an assignment.\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_update)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify that a member of the PCB Design group can \n # update an assignment\n set_user(@siva_e.id, 'Designer')\n \n # Get the instruction with 2 assignments associated with it\n instruction = OiInstruction.find_by_design_id_and_oi_category_section_id(\n @mx234a.id,\n board_prep_sections[0].id)\n\n siva_assignment = instruction.oi_assignments.detect { |a| a.user_id == @siva_e.id }\n mathi_assignment = instruction.oi_assignments.detect { |a| a.user_id == @mathi_n.id }\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(1, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n siva_assignment_comment = siva_assignment.oi_assignment_comments.pop\n mathi_assignment_comment = mathi_assignment.oi_assignment_comments.pop\n assert_not_equal(siva_assignment_comment.id, mathi_assignment_comment.id)\n\n\n post(:assignment_update,\n :assignment => siva_assignment,\n :post_comment => {:comment => 'My 2 cents'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(2, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n cc_list = expected_cc_list.dup + [@siva_e.email] - [@scott_g.email]\n email = @emails.pop\n assert_equal([@scott_g.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update',\n email.subject)\n\n\n post(:assignment_update,\n :assignment => { :id => siva_assignment.id,\n :complete => \"1\"},\n :post_comment => {:comment => 'It is done'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(3, siva_assignment.oi_assignment_comments.size)\n assert_equal(1, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n email = @emails.pop\n assert_equal([@scott_g.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update - Completed',\n email.subject)\n \n set_user(@scott_g.id, 'Designer')\n post(:assignment_update,\n :assignment => { :id => siva_assignment.id,\n :complete => \"0\"},\n :post_comment => {:comment => 'My 2 cents'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(4, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n cc_list = expected_cc_list.dup\n email = @emails.pop\n assert_equal([@siva_e.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update - Reopened',\n email.subject)\n \n end",
"def assignments; end",
"def assign_test(barcode,tests,mappings)\n\t\t## so do we get the name of the worker.\n\t\tif barcode_exists?(barcode[0]).blank?\n\n\t\t\tworker_hash = {}\n\t\t\ttests.each do |machine_code|\n\t\t\t\tworker_name = \"NO_ONE\"\n\t\t\t\t\n\t\t\t\tunless mappings[machine_code].blank?\n\t\t\t\t\ttest_type = mappings[machine_code][\"TYPE\"]\n\t\t\t\t\tworker_name = self.work_allotment_hash[test_type]\n\n\t\t\t\t\tworker_hash[worker_name] ||= []\n\n\t\t\t\t\t#puts \"worker name: #{worker_name}\"\n\t\t\t\t\t#puts \"lis code: #{machine_code}\"\n\t\t\t\t\t#puts mappings[machine_code].to_s\n\t\t\t\t\tworker_hash[worker_name] << mappings[machine_code][\"REPORT_NAME\"]\n\t\t\t\telse\n\t\t\t\t\tworker_hash[worker_name] ||= []\n\t\t\t\t\tworker_hash[worker_name] << machine_code\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t\n\t\t\tend\n\n\t\t\t#puts \"this is the workers hash\"\n\t\t\t#puts worker_hash.to_s\n\t\t\tworker_hash.keys.each do |worker_name|\n\t\t\t\tk = self.connection.post(ENDPOINT, :tests => worker_hash[worker_name].uniq, :barcode => barcode[0], :timestamp => Time.now.strftime(\"%b %-d %Y %I:%M %P\"), :worker_name => worker_name, :status => ACCESSION_DONE, :next_step => PROCESSING, :combi_key => worker_name + \"_pending\")\n\t\t\t\t#puts k.to_s\n\t\t\tend\n\t\telse\n\t\t\tputs \"this barcode: #{barcode[0]} already exists.\"\n\t\tend\n\n\tend",
"def _assign\n configure_logger() # Sets up loggers\n\n # Consumers can optionally return false from assign if they don't want exposure to be logged\n assign_val = assign(@_assignment, **@inputs)\n @_in_experiment = assign_val || assign_val == nil ? true : false\n @_assigned = true\n end",
"def test_parallel_assignments_with_extra_values\n first_name, last_name = [\"John\", \"Smith\", \"III\"]\n assert_equal \"John\", first_name\n assert_equal \"Smith\", last_name\n end",
"def test_assignments_are_associated_with_courses\n course = Course.create(name: \"Ruby on Rails\", course_code: \"ROR600\", color: \"Violet\")\n assignment = Assignment.create(name: \"Battleship\", percent_of_grade: 10)\n assignment_two = Assignment.create(name: \"Currency Converter\", percent_of_grade: 10)\n assignment_three = Assignment.create(name: \"Time Entries\", percent_of_grade: 10)\n\n assert course.assignments << assignment\n assert course.assignments << assignment_two\n assert course.assignments << assignment_three\n\n assert_equal 3, course.assignments.count\n end",
"def updateAssignments(src, dest)\n if src.programme_item_assignments\n src.programme_item_assignments.each do |srcAssignment|\n if !srcAssignment.destroyed?\n # add the person only if the destination does not have that person\n if (dest.people == nil) || (dest.people.index(srcAssignment.person) == nil)\n # check their role for reserved, if reserved then we do not want that person published\n if (srcAssignment.role != PersonItemRole['Reserved'] && srcAssignment.role != PersonItemRole['Invisible'] )\n assignment = dest.published_programme_item_assignments.new(:person => srcAssignment.person, \n :role => srcAssignment.role, \n :sort_order => srcAssignment.sort_order,\n :description => srcAssignment.description,\n :person_name => srcAssignment.person.getFullPublicationName)\n assignment.save\n end\n else # the destination has the person, but their role may have changed\n # TODO - if the person is assigned twice we need to deal with it correctly... i.e. participant and reserved\n \n # find the index of the person only if the role and sort order are also different\n idx = dest.published_programme_item_assignments.index{ |a| (a.person == srcAssignment.person) && ((a.role != srcAssignment.role) || (a.sort_order != srcAssignment.sort_order))}\n if idx != nil && !dest.published_programme_item_assignments[idx].destroyed?\n if (srcAssignment.role == PersonItemRole['Reserved']) || (srcAssignment.role == PersonItemRole['Invisible'])\n # If the role is changed to reserved or invisible then they should be removed...\n dest.published_programme_item_assignments[idx].destroy\n else \n dest.published_programme_item_assignments[idx].role = srcAssignment.role\n dest.published_programme_item_assignments[idx].description = srcAssignment.description\n dest.published_programme_item_assignments[idx].sort_order = srcAssignment.sort_order\n dest.published_programme_item_assignments[idx].save\n end\n end\n end\n end\n end\n \n # if the destination has a person that the source does not then we need to remove that assignment\n dest.published_programme_item_assignments.each do |pitem|\n if (src.people.index(pitem.person) == nil)\n pitem.destroy\n end\n end\n else # since there are no source assignments we should then remove all the destination assignments (if there are any)\n if dest.published_programme_item_assignments\n dest.published_programme_item_assignments.destroy\n end\n end\n end",
"def handle_assign(initial_assign)\n list = @data.list\n reg_opts = @data.reg_opts\n\n count = 0\n\n list.each do |row|\n index = row['i']\n mem_id = row['mem_id']\n reg = @cgi[\"reg_#{index}\"].to_i\n if !initial_assign || reg != Affiliate::NONE\n membership = Membership.with_id(mem_id)\n old_region = membership.mem_region || Affiliate::NONE\n if old_region != reg\n count += 1\n if reg == Affiliate::NONE\n membership.mem_region = nil\n else\n membership.mem_region = reg\n end\n\n $store.transaction do\n membership.save\n membership.log(@session.user, \"Assigned to region #{reg_opts[reg]}\")\n end\n end\n end\n end\n\n note(case count\n when 0 then \"No teams assigned\"\n when 1 then \"One team assigned\"\n else\n \"#{count} teams assigned\"\n end)\n\n @session.dispatch(Portal)\n end",
"def make_assignments(assigned_users)\n assigned_users.each do |user|\n existing_assignment = Assignment.find_by_user_id_and_question_id(user.id,self.id)\n Assignment.create(:user_id => user.id , :question_id => self.id)if existing_assignment == nil\n end \n end",
"def make_assignments(assigned_questions)\n assigned_questions.each do |question|\n existing_assignment = Assignment.find_by_user_id_and_question_id(self.id,question.id)\n if existing_assignment == nil\n Assignment.create(:question_id => question.id , :user_id => self.id)\n end\n end\n end",
"def assignments=(value)\n @assignments = value\n end",
"def assignments=(value)\n @assignments = value\n end",
"def assignments=(value)\n @assignments = value\n end",
"def assignments=(value)\n @assignments = value\n end",
"def assignments=(value)\n @assignments = value\n end",
"def save_assignments\n csids = self.assigned_to_ids\n klass = self.is_annotation? ? 'Annotation' : self.class.name\n unless csids.nil?\n new_ids = csids.to_s.split(',').map(&:to_i)\n current_ids = self.reload.assignments.map(&:user_id)\n to_create = new_ids - current_ids\n to_delete = current_ids - new_ids\n to_delete.each do |id|\n Assignment.where(assigned_type: klass, assigned_id: self.id, user_id: id).last.destroy!\n end\n to_create.each do |id|\n Assignment.create!(assigned_type: klass, assigned_id: self.id, user_id: id, message: self.assignment_message)\n end\n # Save the assignment details to send them as Slack notifications\n self.instance_variable_set(\"@assignment\", { to_create: to_create, to_delete: to_delete }) unless to_delete.blank? and to_create.blank?\n end\n end",
"def test_legal_edit_assignment\n @assignment = Assignment.first\n id = Assignment.first.id\n number_of_assignment = Assignment.count\n questionnaire_id = Questionnaire.first.id\n post :update, :id => id, :assignment=> { :name => 'updatedAssignment9',\n :review_questionnaire_id => questionnaire_id,\n :review_of_review_questionnaire_id => questionnaire_id,\n :author_feedback_questionnaire_id => questionnaire_id\n }\n\n assert_equal flash[:notice], 'Assignment was successfully updated.'\n\n assert_response :redirect\n assert_equal Assignment.count, number_of_assignment\n assert Assignment.find(:all, :conditions => \"name = 'updatedAssignment9'\")\n end",
"def run_intelligent_assignment\n priority_info = []\n assignment = Assignment.find_by(id: params[:id])\n topics = assignment.sign_up_topics\n teams = assignment.teams\n teams.each do |team|\n # grab student id and list of bids\n bids = []\n topics.each do |topic|\n bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)\n bids << (bid_record.nil? ? 0 : bid_record.priority ||= 0)\n end\n team.users.each {|user| priority_info << {pid: user.id, ranks: bids} if bids.uniq != [0] }\n end\n data = {users: priority_info, max_team_size: assignment.max_team_size}\n url = WEBSERVICE_CONFIG[\"topic_bidding_webservice_url\"]\n begin\n response = RestClient.post url, data.to_json, content_type: :json, accept: :json\n # store each summary in a hashmap and use the question as the key\n teams = JSON.parse(response)[\"teams\"]\n create_new_teams_for_bidding_response(teams, assignment)\n run_intelligent_bid(assignment)\n rescue StandardError => err\n flash[:error] = err.message\n end\n redirect_to controller: 'tree_display', action: 'list'\n end",
"def match_assignment(assign,assign_params)\n ( Account.includes(:skills).where.not(skills: { id: nil }) |\n Account.includes(:languages).where.not(languages: { id: nil }) |\n Account.includes(:locations).where.not(locations: {id: nil}) ).each do |acc|\n if acc.id != assign.user_id\n total_score = total_score(acc,assign)\n if total_score > 10.00\n automatch = ScoreAccountAssignment.new(assignment_id: assign.id, account_id: acc.id)\n automatch.score_categories = score_categories(acc,assign).to_json\n automatch.total_score = total_score\n automatch.save\n end\n end\n end\n end",
"def create_assignments\n self.assignments.each do |a|\n #want to keep the history of responses even if the question no longer applies.\n #it could be that the question was answered in a prior rotation.\n a.destroy unless a.responded\n end\n assigned_users = User.scoped\n assigned_users =assigned_users.where(:rotation => self.rotation)unless rotation == nil\n assigned_users =assigned_users.where(:year => self.year) unless year == nil\n make_assignments(assigned_users)\n clear_old_assignments\n end",
"def run_intelligent_assignment\n assignment = Assignment.find(params[:id])\n teams = assignment.teams\n\n users_bidding_info = construct_users_bidding_info(assignment.sign_up_topics, teams)\n bidding_data = { users: users_bidding_info, max_team_size: assignment.max_team_size }\n ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, \"Bidding data for assignment #{assignment.name}: #{bidding_data}\", request)\n\n begin\n url = WEBSERVICE_CONFIG['topic_bidding_webservice_url']\n response = RestClient.post url, bidding_data.to_json, content_type: :json, accept: :json\n # Structure of teams variable: [[user_id1, user_id2], [user_id3, user_id4]]\n teams = JSON.parse(response)['teams']\n ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, \"Team formation info for assignment #{assignment.name}: #{teams}\", request)\n create_new_teams_for_bidding_response(teams, assignment, users_bidding_info)\n assignment.remove_empty_teams\n match_new_teams_to_topics(assignment)\n rescue StandardError => e\n flash[:error] = e.message\n end\n\n redirect_to controller: 'tree_display', action: 'list'\n end",
"def assign(submissions)\n return nil if total_workload <= 0\n\n # At this point, assume the graders and submissions are both valid, i.e.:\n # - Non-zero number of identified graders with a net positive workload\n # - Some number of submissions with known owners and file locations\n\n # Determine which graders are active, sorted from greatest to least workload\n active_graders = @graders.select(&:active?).sort_by(&:workload).reverse\n\n # Compute how many submissions should each grader do as a minimum\n grader_counts = active_graders\n .map {|g| [g, g.min_submissions(total_workload, submissions.size)]}\n .to_h\n\n unassigned_submissions = submissions.size - grader_counts.values.reduce(:+)\n\n raise 'BAD MATH, NEGATIVE UNASSIGNED SUBMISSIONS' if unassigned_submissions < 0\n\n # So long as there are submissions needing a grader, spread it around\n # In theory, this loop should never touch a grader more than once\n next_responsible_grader = 0\n while unassigned_submissions > 0\n grader_counts[active_graders[next_responsible_grader]] += 1\n\n next_responsible_grader += 1\n next_responsible_grader %= active_graders.size\n unassigned_submissions -= 1\n end\n\n # Translate the number of submissions to grade into concrete submissions\n result = {}\n remaining_submissions = submissions.dup\n grader_counts.each {|g, n|\n if n > 0\n result[g] = remaining_submissions.take(n)\n remaining_submissions = remaining_submissions.drop(n)\n end\n }\n\n result\n end",
"def test_illegal_edit_assignment\r\n\r\n id = Assignment.first.id\r\n @assignment = Assignment.first\r\n original_assignment_name = @assignment.name\r\n number_of_assignment = Assignment.count\r\n # It will raise an error while execute render method in controller\r\n # Because the goldberg variables didn't been initialized in the test framework\r\n assert_raise (ActionView::TemplateError){\r\n post :update, :id => id, :assignment=> { :name => '',\r\n :directory_path => \"admin/test1\",\r\n :review_questionnaire_id => 1,\r\n :review_of_review_questionnaire_id => 1,\r\n },\r\n :due_date => { \"1\" , { :resubmission_allowed_id =>1 ,\r\n :submission_allowed_id =>3,\r\n :review_of_review_allowed_id =>1,\r\n :review_allowed_id =>1,\r\n :due_at =>\"2007-07-10 15:00:00\",\r\n :rereview_allowed_id =>1\r\n }\r\n }\r\n }\r\n assert_template 'assignment/edit'\r\n assert_equal original_assignment_name, Assignment.first.name\r\n end",
"def requires_assignment\n _assign if !@_assigned\n end",
"def update\n @assignment = Assignment.find(params[:assignment_id])\n\n @assignment.transaction do\n\n begin\n # Process testing framework form for validation\n @assignment = process_test_form(@assignment, params)\n rescue Exception, RuntimeError => e\n @assignment.errors.add(:base, I18n.t('assignment.error',\n message: e.message))\n return redirect_to action: 'manage',\n assignment_id: params[:assignment_id]\n end\n\n # Save assignment and associated test files\n if @assignment.save\n flash[:success] = I18n.t('assignment.update_success')\n redirect_to action: 'manage',\n assignment_id: params[:assignment_id]\n else\n render :manage\n end\n end\n end",
"def test_courses_assignments_are_ordered_by_due_at_then_active_at\n assignment = Assignment.new(name: \"Battleship\", percent_of_grade: 10, due_at: \"2016-09-15\", active_at: \"2016-09-01\")\n assignment_two = Assignment.new(name: \"Currency\", percent_of_grade: 10, due_at: \"2016-09-05\", active_at: \"2016-09-01\")\n assignment_three = Assignment.new(name: \"Time entry\", percent_of_grade: 10, due_at: \"2016-09-15\", active_at: \"2016-08-01\")\n\n course = Course.create(name: \"Ruby on Rails\", course_code: \"ROR600\", color: \"Violet\")\n\n course.assignments << assignment\n course.assignments << assignment_two\n course.assignments << assignment_three\n\n assert_equal 3, course.assignments.count\n\n assert_equal [assignment_two, assignment_three, assignment], course.assignments.to_a\n end",
"def assigment\n @assignment = Assignment.new(params[:assignment])\n @asset = Asset.new(params[:asset])\n\n if @assignment.save\n\n @delivery_from_assignment = Delivery.find(@assignment.delivery)\n\n @delivery_from_assignment.evaluation_criteria.each do |generate_rubres|\n @response_to_the_evaluation = ResponseToTheEvaluation.new\n @response_to_the_evaluation.name = generate_rubres.name\n @response_to_the_evaluation.comment_for_rubre = generate_rubres.description\n @response_to_the_evaluation.assignment_id = @assignment.id\n @response_to_the_evaluation.save\n end\n end\n end",
"def test_assignments_are_associated_with_assignment_grades\n assignment = Assignment.create(name: \"Battleship\", percent_of_grade: 10, course_id: 2)\n\n grade = AssignmentGrade.create(final_grade: \"A\")\n grade_two = AssignmentGrade.create(final_grade: \"B\")\n\n assert assignment.assignment_grades << grade\n assert assignment.assignment_grades << grade_two\n\n assert_equal 2, assignment.assignment_grades.count\n end",
"def reset_assignments\n @assigned_factories.clear\n return true\n end",
"def test_review_type_role_assignment\n\n # Verify response when not logged in.\n get :review_type_role_assignment, {},{}\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n\n # Verify response when logged in as a non-admin\n get :review_type_role_assignment, {}, rich_designer_session\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Verify response when logged in as an admin\n get :review_type_role_assignment, {}, cathy_admin_session\n assert_response :success\n\n roles = assigns(roles)['roles']\n review_types = assigns(review_types)['review_types']\n\n assert_equal(@expected_values.size, roles.size)\n assert_equal(5, review_types.size)\n\n roles.each_with_index { |role, i|\n expected_role = @expected_values[i]\n assert_equal(expected_role[:name], role.name)\n\n review_types = role.review_types.sort_by { |rt| rt.name }\n review_types.each_with_index { |rt, j|\n expected_name = expected_role[:review_types][j]\n assert_equal(expected_role[:name]+'::'+expected_name.to_s,\n role.name+'::'+rt.name)\n }\n\n }\n\n expected_values = [\n {:name => 'Final',\n :role_names => ['CE-DFT', 'DFM', 'HWENG',\n 'Mechanical', 'Mechanical-MFG', 'PCB Design',\n 'Planning', 'TDE', 'Valor'] },\n {:name => 'Pre-Artwork',\n :role_names => ['CE-DFT', 'DFM', 'HWENG', \n 'Library', 'Mechanical', 'Mechanical-MFG',\n 'PCB Input Gate', 'PCB Mechanical', 'Planning',\n 'SLM BOM', 'SLM-Vendor', 'TDE',\n 'Valor' ]},\n {:name => 'Placement',\n :role_names => ['CE-DFT', 'DFM', 'HWENG',\n 'Mechanical', 'Mechanical-MFG', 'TDE' ]},\n {:name => 'Routing',\n :role_names => ['CE-DFT', 'DFM', 'HWENG',\n 'Library', 'Mechanical-MFG' ]},\n {:name => 'Release',\n :role_names => ['HWENG', 'Operations Manager',\n 'PCB Design' ]},\n ]\n\n review_types.each_with_index do |review_type, i|\n expected_rt = expected_values[i]\n assert_equal(expected_rt[:name], review_type.name)\n\n review_type.roles.sort_by { |role| role.name }.each_with_index do |role, j|\n expected_role = expected_rt[:role_names]\n expected_name = expected_role[j]\n assert_equal(expected_name, role.name)\n end\n end\n\n end",
"def test_assign_groups_to_reviews\n\n post(:assign_groups_to_reviews,\n { :review_type => {\n # 1-Final, 2-Routing, 3-Pre-Art, 4-Placement, 5-Release\n '5_1'=>'1', '5_2'=>'0', '5_3'=>'1', '5_4'=>'0', '5_5'=>'0', #HWENG\n '6_1'=>'1', '6_2'=>'1', '6_3'=>'1', '6_4'=>'0', '6_5'=>'1', #VALOR\n '7_1'=>'1', '7_2'=>'1', '7_3'=>'0', '7_4'=>'1', '7_5'=>'1', #CE-DFT\n '8_1'=>'0', '8_2'=>'0', '8_3'=>'1', '8_4'=>'0', '8_5'=>'1', #DFM\n '9_1'=>'1', '9_2'=>'0', '9_3'=>'1', '9_4'=>'1', '9_5'=>'0', #TDE\n '10_1'=>'1', '10_2'=>'0', '10_3'=>'1', '10_4'=>'1', '10_5'=>'0', #MECHANICAL\n '11_1'=>'0', '11_2'=>'1', '11_3'=>'1', '11_4'=>'1', '11_5'=>'0', #MECH-MFG\n '12_1'=>'1', '12_2'=>'0', '12_3'=>'0', '12_4'=>'0', '12_5'=>'1', #PCB DESIGN\n '13_1'=>'1', '13_2'=>'0', '13_3'=>'1', '13_4'=>'0', '13_5'=>'0', #PLANNING\n '14_1'=>'1', '14_2'=>'0', '14_3'=>'0', '14_4'=>'0', '14_5'=>'0', #PCB IG\n '15_1'=>'1', '15_2'=>'0', '15_3'=>'0', '15_4'=>'0', '15_5'=>'0', #LIBRARY\n '16_1'=>'0', '16_2'=>'0', '16_3'=>'1', '16_4'=>'1', '16_5'=>'1', #PCB MECH\n '17_1'=>'1', '17_2'=>'1', '17_3'=>'1', '17_4'=>'1', '17_5'=>'1', #SLM BOM\n '18_1'=>'0', '18_2'=>'1', '18_3'=>'1', '18_4'=>'1', '18_5'=>'0', #SLM-Vendor\n '19_1'=>'1', '19_2'=>'0', '19_3'=>'0', '19_4'=>'0', '19_5'=>'1' #OPS MGR\n } },\n cathy_admin_session)\n\n post :review_type_role_assignment, {}, cathy_admin_session\n\n assert_response :success\n\n roles = assigns(roles)['roles']\n review_types = assigns(review_types)['review_types']\n\n expected_values = [\n {:name => 'Hardware Engineering Manager',\n :review_types => []},\n {:name => 'Operations Manager',\n :review_types => ['Final', 'Release']},\n {:name => 'PCB Design',\n :review_types => ['Final', 'Release']},\n {:name => 'Program Manager',\n :review_types => []},\n {:name => 'DFM',\n :review_types => ['Pre-Artwork', 'Release']},\n {:name => 'CE-DFT',\n :review_types => ['Final', 'Placement', 'Release', 'Routing']},\n {:name => 'Compliance - EMC', \n :review_types => []},\n {:name => 'Compliance - Safety', \n :review_types => []},\n {:name => 'Library',\n :review_types => ['Final']},\n {:name => 'ECN',\n :review_types => []},\n {:name => 'HWENG',\n :review_types => ['Final', 'Pre-Artwork']},\n {:name => 'Mechanical',\n :review_types => ['Final', 'Placement', 'Pre-Artwork']},\n {:name => 'Mechanical-MFG',\n :review_types => ['Placement', 'Pre-Artwork', 'Routing']},\n {:name => 'Planning',\n :review_types => ['Final', 'Pre-Artwork']},\n {:name => 'PCB Input Gate',\n :review_types => ['Final']},\n {:name => 'PCB Mechanical',\n :review_types => ['Placement', 'Pre-Artwork', 'Release']},\n {:name => 'SLM BOM',\n :review_types => ['Final', 'Placement', 'Pre-Artwork', 'Release', 'Routing']},\n {:name => 'SLM-Vendor',\n :review_types => ['Placement', 'Pre-Artwork', 'Routing']},\n {:name => 'TDE',\n :review_types => ['Final', 'Placement', 'Pre-Artwork']},\n {:name => 'Valor', \n :review_types => ['Final', 'Pre-Artwork', 'Release', 'Routing']}\n ]\n\n #assert_equal(expected_values, roles)\n assert_equal(expected_values.size, roles.size)\n assert_equal(5, review_types.size)\n\n roles.each_with_index { |role, i|\n expected_role = expected_values[i]\n assert_equal(expected_role[:name], role.name)\n \n returned_rts = role.review_types.collect { |rt| rt.name }\n\n returned_rts = returned_rts.sort_by { |rt| rt }\n returned_rts.each_with_index { |review_type, j|\n expected_name = expected_role[:review_types][j]\n assert_equal(expected_role[:name]+'::'+expected_name.to_s,\n role.name+'::'+review_type)\n }\n\n }\n\n expected_values = [\n {:name => 'Pre-Artwork',\n :role_names => ['DFM', 'HWENG', 'Mechanical', 'Mechanical-MFG', 'PCB Mechanical', 'Planning', 'SLM BOM', 'SLM-Vendor', 'TDE', 'Valor']},\n {:name => 'Placement', \n :role_names => ['CE-DFT', 'Mechanical', 'Mechanical-MFG', 'PCB Mechanical', 'SLM BOM', 'SLM-Vendor', 'TDE']},\n {:name => 'Routing', \n :role_names => ['CE-DFT', 'Mechanical-MFG', 'SLM BOM', 'SLM-Vendor', 'Valor']},\n {:name => 'Final',\n :role_names => ['CE-DFT', 'HWENG', 'Library', 'Mechanical', 'Operations Manager', 'PCB Design', 'PCB Input Gate', 'Planning', 'SLM BOM', 'TDE', 'Valor']},\n {:name => 'Release', \n :role_names => ['CE-DFT', 'DFM', 'Operations Manager', 'PCB Design', 'PCB Mechanical', 'SLM BOM', 'Valor']}\n ]\n review_types.each { |review_type| \n expected_rt = expected_values.shift\n\n returned_roles = []\n review_type.roles.each { |role| returned_roles.push(role.name) }\n\n returned_roles.sort.each { |role|\n expected_role = expected_rt[:role_names]\n expected_name = expected_role.shift\n assert_equal(expected_rt[:name]+'::'+expected_name, \n review_type.name+'::'+role)\n }\n }\n\n end",
"def test_illegal_edit_assignment\n\n id = Assignment.first.id\n @assignment = Assignment.first\n original_assignment_name = @assignment.name\n number_of_assignment = Assignment.count\n # It will raise an error while execute render method in controller\n # Because the goldberg variables didn't been initialized in the test framework\n assert_raise (ActionView::TemplateError){\n post :update, :id => id, :assignment=> { :name => '',\n :directory_path => \"admin/test1\",\n :review_questionnaire_id => 1,\n :review_of_review_questionnaire_id => 1,\n },\n :due_date => { \"1\" , { :resubmission_allowed_id =>1 ,\n :submission_allowed_id =>3,\n :review_of_review_allowed_id =>1,\n :review_allowed_id =>1,\n :due_at =>\"2007-07-10 15:00:00\",\n :rereview_allowed_id =>1\n }\n }\n }\n assert_template 'assignment/edit'\n assert_equal original_assignment_name, Assignment.first.name\n end",
"def create_submissions_for_assignments\n @all_courses.each do |course|\n course.assignments.each do |assignment|\n mean = rand(50..100)\n deviation = 101 - mean\n course.students.each do |student|\n norm = Rubystats::NormalDistribution.new(mean, deviation)\n raw_percent = norm.rng\n raw_percent = 100 if raw_percent > 100\n raw_percent = 0 if raw_percent < 0\n raw_score = (raw_percent/100 * assignment.possible_score).floor\n student.submissions.create(assignment_id: assignment.id,\n raw_score: raw_score)\n end\n end\n end\n end",
"def on_assignment_completed(assignment)\n\t\t\ttally\n\t\tend",
"def test_add_assignment_participant()\n\t\tparticipant = AssignmentParticipant.new\n\t\tassert !participant.valid?\n\t\t\n\t\t#TODO read TODO tag in line 13\n\t\t\n\t\tparticipant.handle = 'test_handle'\n\t\tassert participant.valid?\n\tend",
"def reset_assignments\n @assigned_factories.clear\n end",
"def test_view_assignment_report\n \n first_assignment = oi_assignments(:first)\n \n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:view_assignment_report, { :id => first_assignment }, siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n get(:view_assignment_report, { :id => first_assignment }, scott_designer_session)\n assert_equal(first_assignment.id, assigns(:assignment).id)\n assert_equal([], assigns(:comments))\n assert_equal(OiAssignmentReport.report_card_scoring, assigns(:scoring_table))\n assert_equal(\"0% Rework\", assigns(:current_score))\n \n end",
"def done?(assignments)\n \tassignments.size == problem.vars.size\n end",
"def ab_assigned(_experiment, _identity)\n raise \"Not implemented\"\n end",
"def test_lessons_are_associated_with_their_pre_class_assignments\n course = Course.create(name: \"Ruby on Rails\", course_code: \"ROR600\", color: \"Violet\")\n lesson = Lesson.create(name:\"Algebra Basics\", description: \"Basic intro into the wonderful world of Algebra\", outline: \"See math, do math\")\n assignment = Assignment.create(name: \"Variables\", percent_of_grade: 10)\n\n course.assignments << assignment\n assert lesson.pre_class_assignment = assignment\n\n assert_equal Assignment.find(assignment.id), lesson.pre_class_assignment\n end",
"def testProcessParametersAliases\n setRepository('UniqueDeliverableProcessAliases') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID/0.1/TestDeliverable'])\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal( [\n $FSCMSTest_RepositoryToolsDir,\n 'ProcessParam1Value',\n 'ProcessParam2Value'\n ], iFile.read.split(\"\\n\"))\n end\n end\n end",
"def testNominalWithSeveralDeliverables\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_2DummyGems ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem1.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ],\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem2.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def score(options = {})\n count = 0;\n \n assignations = options[:assignations]\n \n if assignations.blank?\n assignations = self.assignation_array()\n end\n\n assignations.each do |a|\n #ATTENTION: we skip learnphase assignations!\n if a.test.test_learnphase? \n next\n end\n \n count+=1 if a.passed?\n end\n count\n end",
"def process_test_cases\n raise NotImplementedError, 'You must implement this'\n end",
"def assignments_method(node, tmp_object)\n tmp_object.merge!(\n \"course_id\" => node.get_course_id,\n \"max_team_size\" => node.get_max_team_size,\n \"is_intelligent\" => node.get_is_intelligent,\n \"require_quiz\" => node.get_require_quiz,\n \"allow_suggestions\" => node.get_allow_suggestions,\n \"has_topic\" => SignUpTopic.where(['assignment_id = ?', node.node_object_id]).first ? true : false\n )\n end",
"def test_parallel_assignments_with_too_few_variables\n first_name, last_name = [\"Cher\"]\n assert_equal \"Cher\", first_name\n assert_equal nil, last_name\n end",
"def testNominalWithSeveralRN\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_SingleDummyGemWithSeveralRN ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ],\n Actions::File_UploadReleaseNote => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/ReleaseNotes/DummyGemReleaseNote.html\"), 'html', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ],\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/ReleaseNotes/DummyGemReleaseNote.txt\"), 'txt', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def process_assignment_checks(user)\n can :read, AssignmentCheck do |check|\n if check.assignment_repository.user == user\n true\n else\n co = check.assignment_repository.assignment_offering.course_offering\n role = co.role_for_user(user)\n role.can_view_other_submissions?\n end\n end\n end",
"def test_employee_added_to_a_human_resources\n human_resources = Department.new(\"Human Resources\")\n danai = Employee.new(name: \"Danai\",email: \"danai@live.com\", phone_number: \"307-555-5555\", salary: 100)\n anna = Employee.new(name: \"Anna\",email: \"anna@live.com\", phone_number: \"919-555-5555\", salary: 5000)\n turner = Employee.new(name: \"Turner\", email: \"turner@live.com\", phone_number: \"303-555-5555\", salary: 500)\n\n assert human_resources.assign(danai)\n assert human_resources.assign(anna)\n assert human_resources.assign(turner)\n\n assert_equal [danai,anna,turner], human_resources.department_staff\n end",
"def test_associate_assignments_courses_autoboom_assignments_04\n that_thing = Course.create(name: \"Things 101\", course_code: \"ABC 123\")\n did_you_get = Assignment.create(name: \"Did you get that thing I sent ya?\")\n that_thing.assignments << did_you_get\n assert_equal 1, Course.count\n that_thing.destroy\n assert_equal 0, Assignment.count\n end",
"def _test_numbers ; process_test_case(\"numbers\") ; end",
"def testNominal\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_SingleDummyGem ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def test_assignments_are_deleted_when_course_is_deleted\n course = Course.create(name: \"Ruby on Rails\", course_code: \"ROR600\", color: \"Violet\")\n assignment = Assignment.create(name: \"Battleship\", percent_of_grade: 10)\n assignment_two = Assignment.create(name: \"Currency Converter\", percent_of_grade: 10)\n assignment_three = Assignment.create(name: \"Time Entries\", percent_of_grade: 10)\n\n assert course.assignments << assignment\n assert course.assignments << assignment_two\n assert course.assignments << assignment_three\n\n assert course.destroy\n refute Assignment.exists?(assignment.id)\n refute Assignment.exists?(assignment_two.id)\n refute Assignment.exists?(assignment_three.id)\n end",
"def reassign_judge_assign_tasks\n judge_assign_tasks = open_tasks.of_type(:JudgeAssignTask)\n\n if judge_assign_tasks.any?\n task_ids = judge_assign_tasks.pluck(:id).sort\n message = \"#{cancel} #{task_ids.count} JudgeAssignTasks with ids #{task_ids.join(', ')} and #{create} \" \\\n \"#{task_ids.count} DistributionTasks\"\n Rails.logger.info(message)\n\n if !dry_run\n judge_assign_tasks.each do |task|\n DistributionTask.create!(appeal: task.appeal, parent: task.appeal.root_task)\n update_task_status_with_instructions(task, Constants.TASK_STATUSES.cancelled)\n end\n end\n end\n end",
"def validate_assignments\n assignments.sum(:amount_in_cents) == self[:amount_in_cents]\n end",
"def test_assignments_must_have_qualities\n a = Assignment.create(course_id: 3, name: \"Assignment 3\", percent_of_grade: 20.00)\n a1 = Assignment.new(course_id: 3, name: \"Assignment 3\")\n refute a1.save\n a2 = Assignment.new(course_id: 4)\n refute a2.save\n end",
"def testNominal\n executeProcess(\n [\n '--masterticket', '123',\n '--slaveticket', '456'\n ]\n ) do |iError, iSlaveActions|\n assert_equal(\n {\n Tools::TicketTracker => {\n Actions::Ticket_RejectDuplicate => [\n [ '123', '456' ]\n ]\n }\n },\n iSlaveActions\n )\n end\n end",
"def assert_assigns(*args)\n symbols_assigned = []\n symbols_not_assigned = []\n\n for sym in args\n ((assigns(sym) != nil)? symbols_assigned : symbols_not_assigned) << sym\n end\n\n message = build_message(\"\", \"The following variables should have been assigned values by the controller: <?>\", symbols_not_assigned.map{|s| \"@#{s.to_s}\"}.join(\", \"))\n\n assert_block message do\n symbols_not_assigned.length == 0\n end\n\n if symbols_assigned.length == 1\n assigns(symbols_assigned.first)\n else\n symbols_assigned.map{|s| assigns(s)}\n end\n end",
"def test_parallel_assignment_with_one_variable\n first_name, = [\"John\", \"Smith\"]\n assert_equal \"John\", first_name\n end",
"def update_assignments\n # for new patterns this should be empty\n existing_trs = self.get_assigned_transactions\n # transactions the pattern matches now\n current_trs = self.get_matches\n\n # for transactions that still match, just update the tag\n still_matches = existing_trs & current_trs\n still_matches.each do |tr|\n # assume only one ta per source and source_info\n # might want to enforce this constraint in model and db\n # problem is, this isn't updating it!\n tr.tag_assignments.find_by_source_and_source_info(2, \n self.id).update_attribute(:tag_id, self.tag_id)\n end\n\n # for transactions that no longer match, remove the tag assignment\n # like when deleting patterns, might want to check if other patterns\n # below this one now match? Could do this with after_destroy in \n # TagAssignment model??\n no_longer_matches = existing_trs - current_trs\n no_longer_matches.each do |tr|\n tr.tag_assignments.find_by_source_and_source_info(2, \n self.id).destroy if self.has_attribute?('id')\n # this is not called at the moment when ta's are destroyed\n tr.update_current_tag\n end\n\n new_matches = current_trs - existing_trs\n # apply new or modified pattern to those that need it\n self.apply_to_transactions(new_matches)\n\n end",
"def call_assignment(node)\n if [\"save\", \"save!\"].include? node.message.to_s\n subject = node.subject.to_s\n add_error \"use model association (for #{subject})\" if @assignments[subject]\n end\n end",
"def test_q11_b_a\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Number of permissions created is incorrect\"\n assert_equal 3, form_processor.permission_count, \"Permission count on processor is incorrect\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r50\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r51\"}.length, \"Incorrect rule created\"\n end",
"def testNominalWithRegression\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # Run regression => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_SingleDummyGem ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}',\n '--regressioncmd', 'test/runReg'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', 'test/runReg' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def reset_assignments!\n assignments.each do |a|\n a.destroy!\n end\n tasks.each do |t|\n t.destroy!\n end\n\n # re-recreate them after destroying to get fresh data\n create_child_skeleton_rows\n end",
"def process_test_form(assignment, params, assignment_params,\r\n new_script, new_support_file)\r\n updated_script_files = {}\r\n updated_support_files = {}\r\n\r\n testscripts = assignment_params[:test_scripts_attributes] || []\r\n testsupporters = assignment_params[:test_support_files_attributes] || []\r\n\r\n # Create/Update test scripts\r\n testscripts.each do |file_num, file|\r\n # If no new_script then form is empty and skip\r\n next if testscripts[file_num][:seq_num].empty? && new_script.nil?\r\n if testscripts[file_num][:script_name].nil?\r\n # Create new test script file if one with the same name does not exist\r\n updated_script_files[file_num] = {}\r\n filename = new_script.original_filename\r\n if TestScript.exists?(script_name: filename, assignment: assignment)\r\n raise I18n.t('automated_tests.duplicate_filename') + filename\r\n end\r\n updated_script_files[file_num] = file.clone\r\n # Override filename from form\r\n updated_script_files[file_num][:script_name] = filename\r\n updated_script_files[file_num][:seq_num] = file_num\r\n else\r\n # Edit existing test script file\r\n if params[('new_update_script_' + testscripts[file_num][:script_name]).to_sym].nil?\r\n updated_script_files[file_num] = file.clone\r\n else\r\n new_update_script = params[('new_update_script_' + testscripts[file_num][:script_name]).to_sym]\r\n new_script_name = new_update_script.original_filename\r\n old_script_name = file[:script_name]\r\n if TestScript.exists?(script_name: new_script_name, assignment: assignment)\r\n raise I18n.t('automated_tests.duplicate_filename') + new_script_name\r\n end\r\n updated_script_files[file_num] = file.clone\r\n updated_script_files[file_num][:script_name] = new_script_name\r\n updated_script_files[file_num][:seq_num] = file_num\r\n\r\n # Uploading new script\r\n assignment_tests_path = File.join(\r\n MarkusConfigurator.markus_ate_client_dir,\r\n @assignment.repository_folder,\r\n new_script_name)\r\n # Replace bad line endings from windows\r\n contents = new_update_script.read.tr(\"\\r\", '')\r\n File.open(assignment_tests_path, 'w') { |f| f.write contents }\r\n\r\n # Deleting old script\r\n old_script_path = File.join(\r\n MarkusConfigurator.markus_ate_client_dir,\r\n @assignment.repository_folder,\r\n old_script_name)\r\n if File.exist?(old_script_path)\r\n File.delete(old_script_path)\r\n end\r\n end\r\n end\r\n # Always make sure the criterion type is correct.\r\n # The :criterion_id parameter contains a list of the form\r\n # [criterion_id, criterion_type], which JSON.parse cannot parse unless\r\n # neither element is nil\r\n if testscripts[file_num][:criterion_id].nil? || testscripts[file_num][:criterion_id][0].nil? || testscripts[file_num][:criterion_id][1].nil?\r\n updated_script_files[file_num][:criterion_type]\r\n else\r\n crit_id, crit_type = JSON.parse testscripts[file_num][:criterion_id]\r\n updated_script_files[file_num][:criterion_id] = crit_id\r\n updated_script_files[file_num][:criterion_type] = crit_type\r\n end\r\n end\r\n\r\n # Create/Update test support files\r\n # Ignore editing files for now\r\n testsupporters.each do |file_num, file|\r\n # Empty file submission, skip\r\n next if testsupporters[file_num][:file_name].nil? && new_support_file.nil?\r\n if testsupporters[file_num][:file_name].nil?\r\n # Create test support file if one with the same name does not exist\r\n updated_support_files[file_num] = {}\r\n filename = new_support_file.original_filename\r\n if TestSupportFile.exists?(file_name: filename, assignment: assignment)\r\n raise I18n.t('automated_tests.duplicate_filename') + filename\r\n end\r\n updated_support_files[file_num] = file.clone\r\n # Override filename from form\r\n updated_support_files[file_num][:file_name] = filename\r\n else\r\n # Edit existing test support file\r\n if params[('new_update_file_' + testsupporters[file_num][:file_name]).to_sym].nil?\r\n updated_support_files[file_num] = file.clone\r\n else\r\n new_update_file = params[('new_update_file_' + testsupporters[file_num][:file_name]).to_sym]\r\n new_file_name = new_update_file.original_filename\r\n old_file_name = file[:file_name]\r\n if TestSupportFile.exists?(file_name: new_file_name, assignment: assignment)\r\n raise I18n.t('automated_tests.duplicate_filename') + new_file_name\r\n end\r\n updated_support_files[file_num] = file.clone\r\n updated_support_files[file_num][:file_name] = new_file_name\r\n\r\n # Uploading new file\r\n assignment_tests_path = File.join(\r\n MarkusConfigurator.markus_ate_client_dir,\r\n @assignment.repository_folder,\r\n new_file_name)\r\n File.open(\r\n assignment_tests_path, 'w') { |f| f.write new_update_file.read }\r\n\r\n # Deleting old file\r\n old_file_path = File.join(\r\n MarkusConfigurator.markus_ate_client_dir,\r\n @assignment.repository_folder,\r\n old_file_name)\r\n if File.exist?(old_file_path)\r\n File.delete(old_file_path)\r\n end\r\n end\r\n end\r\n end\r\n\r\n # Update test file attributes\r\n assignment.test_scripts_attributes = updated_script_files\r\n assignment.test_support_files_attributes = updated_support_files\r\n\r\n assignment.enable_test = assignment_params[:enable_test]\r\n assignment.enable_student_tests = assignment_params[:enable_student_tests]\r\n assignment.unlimited_tokens = assignment_params[:unlimited_tokens]\r\n assignment.token_start_date = assignment_params[:token_start_date]\r\n assignment.token_period = assignment_params[:token_period]\r\n assignment.tokens_per_period = assignment_params[:tokens_per_period].nil? ?\r\n 0 : assignment_params[:tokens_per_period]\r\n\r\n return assignment\r\n end",
"def assignment_intialize\n\t\tif(@puret and @puref)\n\t\t\treturn false\n\t\tend\n\t\tif(@num_negative == 0 or @puret)\n\t\t\t@assignments = [1]\n\t\telsif(@num_positive == 0 or @puref)\n\t\t\t@assignments = [-1]\n\t\telsif(@best_guess <0)\n\t\t\t@assignments = [-1,1]\n\t\telse\n\t\t\t@assignments = [1,-1]\n\t\tend\n\t\treturn true\n\tend",
"def test_new_microtask\r\n #@assignment = assignments(:Assignment_Microtask1)\r\n questionnaire_id = questionnaires(:questionnaire1).id\r\n instructorid = users(:instructor1).id\r\n courseid = courses(:course_object_oriented).id,\r\n number_of_topics = SignUpTopic.count\r\n # create a new assignment\r\n post :new, :assignment => { :name => \"Assignment_Microtask1\",\r\n :directory_path => \"CSC517_instructor1/Assignment_Microtask1\",\r\n :submitter_count => 0,\r\n :course_id => courseid,\r\n :instructor_id => instructorid,\r\n :num_reviews => 1,\r\n :num_review_of_reviews => 0,\r\n :num_review_of_reviewers => 0,\r\n :review_questionnaire_id => questionnaire_id,\r\n :reviews_visible_to_all => 0,\r\n :require_signup => 0,\r\n :num_reviewers => 3,\r\n :team_assignment => 0,\r\n :team_count => 1,\r\n :microtask => true }\r\n\r\n assert_response 200\r\n assert Assignment.find(:all, :conditions => \"name = 'Assignment_Microtask1'\")\r\n\r\n end",
"def done\n AssignmentNotifier.done\n end",
"def set_assigned\n @assigned = Assigned.find(params[:id])\n end",
"def test_loop(badgedefs, user_id, course_points, user_points, exercises)\n to_award = []\n errors = []\n badgedefs.each do |badgedef|\n Rails.logger.debug(\"Evaluating BadgeDef #{badgedef.id}, user #{user_id}\")\n rezult = BadgeHelper.evaluate_badgedef(badgedef, user_id, course_points,\n user_points, exercises)\n if rezult[:ok]\n to_award.push(badgedef) if rezult[:give_badge]\n else\n # This clunky line has to be used because\n # [a, b, c].push([x, y, z]) doesn't give [a, b, c, x, y, z]\n # but rather [a, b, c, [x, y, z]].\n rezult[:errors].each { |e| errors.push(e) }\n end\n end\n { to_award: to_award, errors: errors }\n end",
"def test_q11_b_ab\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n params[:q11_b_b] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r32\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r51\"}.length, \"Incorrect rule created\"\n end",
"def test_should_create_test_results\n test_target_instance = get_new_test_target_instance(\"example2\", \"2012112802\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1', 'test_case_2')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 1)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_2', 1)\n end",
"def process\n process_moves\n reassign_team_sets\n reset_quantitative_data\n #notify\n end",
"def test_exercise_1128\n verify_method :exercise_1128,\n :with => [{param: [0, 0, 1, 2, 3, 3], expect: [0, 1, 2, 3]},\n {param: [0, 1, 2, 3], expect: [0, 1, 2, 3]},\n {param: [0, 0], expect: [0]},\n {param: [0], expect: [0]}]\n end",
"def test_002\n\n # login\n login\n @@pu = 1\n @@pj = 1\n open\"/devgroup/pj_index/#{@@pu}/#{@@pj}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu}/#{@@pj}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n #Select \"uploading a file individually\"\n click \"file_upload_upload_way_upload_each\"\n assert is_text_present(_(\"Uploaded individually.\"))\n click $xpath[\"task\"][\"read_tree\"]\n\n assert !60.times{ break if (is_text_present(_(\"Directory structure\")) rescue false); sleep 2 }\n # logout\n logout\n\n end",
"def update_assignment(attributes)\n unless @assignment.update_attributes(attributes)\n @errors = @assignment.errors.to_s\n @has_errors = true\n end\n @assignment.num_review_of_reviews = @assignment.num_metareviews_allowed\n @assignment.num_reviews = @assignment.num_reviews_allowed\n end",
"def test_q11_b_ac\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n params[:q11_b_c] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r33\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r50\"}.length, \"Incorrect rule created\"\n end",
"def test_multiple_users_should_update_test_result_under_c1_0\n test_target_instance = get_new_test_target_instance(\"example5\", \"2012112805\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1')\n batch_edit_test_results(test_target_instance, members(:two), TestResult::TEST_TARGET_PASS, 'test_case_1')\n\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_FAIL, 'test_case_1')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:two), 'test_case_1', 0b01, 0b11)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 0b10, 0b11, 2)\n end",
"def manage_assignments(assessor,certification_id = nil)\n if certification_id.nil?\n joins([:student_assignments,:owned]).where(:issued=>false,:owned=>{:id=>assessor.students},:student_assignments=>{:assigner_id=>assessor})#.group('owned_id')\n else\n joins([:student_assignments,:owned]).by_certification(certification_id).\n where(:issued=>false,:owned=>{:id=>assessor.students},:student_assignments=>{:assigner_id=>assessor})#.group('owned_id')\n end\n end",
"def task_assignments\n @task_assignments ||= Harvest::API::TaskAssignments.new(credentials)\n end",
"def test_exercise_1124\n verify_method :exercise_1124,\n :with => [{params: [1111111, 1234567], expect: 1},\n {params: [33 * 7, 33 * 23], expect: 33},\n {params: [41 * 13, 41 * 29], expect: 41}]\n\n end",
"def test_multiple_users_should_update_test_result_under_c1_1\n test_target_instance = get_new_test_target_instance(\"example6\", \"2012112806\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1')\n batch_edit_test_results(test_target_instance, members(:two), TestResult::TEST_TARGET_FAIL, 'test_case_1')\n\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_FAIL, 'test_case_1')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:two), 'test_case_1', 0b10, 0b11)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 0b10, 0b11, 2)\n end",
"def execute_task_tests\n # Run all tasks tests (ensuring we capture any changes in the sites we are monitoring)\n test_results = @tasks_by_job_ids.values.map {|task|\n puts \"- Running test for task: #{task.class.name}\" \n if task.respond_to?(:test)\n begin\n result = task.test()\n if result.kind_of?(Array) && result.length > 0\n # Log the error for the result\n @task_test_results_logger.error(\"FAILURE:#{result.inspect}\")\n # Send an email with the failure information\n Notifier.deliver_crawler_error(\"christkv@gmail.com\", task.class.name, result)\n end\n rescue Exception => e\n # Log the error for the result\n @task_test_results_logger.error(\"ERROR:#{e.backtrace}\")\n # Send an email with the failure information\n Notifier.deliver_crawler_error(\"christkv@gmail.com\", task.class.name, [e.backtrace.inspect])\n end\n end\n }\n # return the test results\n return test_results\n end",
"def test_report_card_list\n \n get(:report_card_list, \n { :id => @board_prep.id, :design_id => @mx234a.id },\n scott_designer_session)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n assert_nil(assigns(:assignments_list))\n \n end",
"def test_create_assignment_report\n \n first_report = oi_assignment_reports(:first)\n \n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:create_assignment_report, { :id => oi_assignment_reports(:first) }, lee_hweng_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n get(:create_assignment_report, {:id => first_report}, scott_designer_session)\n assert_equal(first_report.id, assigns(:assignment).id)\n assert_equal(1, assigns(:complexity_id))\n assert_equal(OiAssignmentReport::NOT_SCORED, assigns(:report).score)\n assert_equal([], assigns(:comments))\n assert_equal(OiAssignmentReport.report_card_scoring,\n assigns(:scoring_table))\n \n # Verify the redirect to create_assignment_report by create report when the \n # report has not been scored.\n \n \n end",
"def test_exercise_119\n verify_method :exercise_119,\n :with => [{param: 1, expect: '1'},\n {param: 2, expect: '10'},\n {param: 3, expect: '11'},\n {param: 8, expect: '1000'},\n {param: 11, expect: '1011'}]\n end",
"def test_parallel_assignments_with_subarrays\n first_name, last_name = [[\"Willie\", \"Rae\"], \"Johnson\"]\n assert_equal [\"Willie\", \"Rae\"], first_name\n assert_equal \"Johnson\", last_name\n end",
"def satisfied?(assignments)\n \tproblem.constraint.satisfied?(new_assigns)\n end",
"def test_get_etc_function_by_qa\n\t\tbatch = Batch.create!( :batchid => 291206,\n :facility => facilities(:facility1),\n :date => Date.today.strftime(\"%m/%d/%Y\"),\n :arrival_time => \"#{Time.now}\",\n :target_time\t=> \"#{Time.now.tomorrow - 64.minutes}\",\n :status => \"New\",\n :manual_override => false)\n\n\t\tjob_new = Job.create!(:batch=>batch,\n :tiff_number=>1234,:check_number=>12131,\n :count=>12,:estimated_eob => 50,\n :qa_id => 1)\n\t\tbatch.reload\n\t\tbatch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_with_qa = batch.expected_completion_time\n\n job_one_more = Job.create(:batch=>batch,:tiff_number=>1231,\n :check_number=>12135,:count=>12,\n :estimated_eob => 50,\n :qa_id => 2)\n\t\tbatch.reload\n\t\tbatch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_with_two_jobs = batch.expected_completion_time\n \tassert_in_delta etc_with_qa.to_i, etc_with_two_jobs.to_i,1\n\n\t\tjob_one_more.qa_id = 1\n\t\tjob_one_more.update\n\t\tbatch.reload\n\t\tbatch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_after_change_qa = batch.expected_completion_time\n\n\t\tassert_not_equal(etc_with_qa, etc_after_change_qa)\n\n\t\tjob_new.qa_id = nil\n\t\tjob_new.update\n\t\tbatch.reload\n batch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_after_deallocate = batch.expected_completion_time\n\t\tassert_not_equal(etc_after_deallocate, etc_after_change_qa)\n\t\tassert_in_delta etc_after_deallocate.to_i, etc_with_two_jobs.to_i, 1\n end",
"def doValidation\r\n\t\tprepare if ! @machine\r\n\t\ti = 0 \r\n\t\twhile i < @trainTestStruct.testSetCount\r\n\t\t\ttrainTestDataSplit = getTargets @trainTestStruct.testSets(i)\r\n\t\t\t@trainTestStruct.pushResult @machine.validateSet(trainTestDataSplit.first, trainTestDataSplit.last, @predictionType)\r\n\t\t\ti += 1\r\n\t\tend\r\n\tend",
"def assignment_params\n params.require(:assignment).permit(:metric_id, :test_id, :test_slot)\n end",
"def run_test(tests, ints_to_test, current_test_name)\n require \"./primality_tests/\" + current_test_name + \".rb\"\n tests[current_test_name.to_sym][:result] = []\n ints_to_test.each {|int|\n tests[current_test_name.to_sym][:result] << send(current_test_name, int)\n }\nend",
"def test_008\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n @@pj = Pj.find_by_name('SamplePJ1')#\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # test for value of master into combobox in master tab\n assert_equal [\"sample_c_cpp\"], get_select_options(\"master_id\")\n assert is_text_present(_(\"Optional setting\"))\n\n click $xpath[\"task\"][\"registration_task_button\"]\n sleep 2\n #assert !60.times{ break if (is_text_present(\"解析ツール未選択 入力内容に問題があるためタスクを登録できません。\") rescue false); sleep 2 }\n\n\n # logout\n logout\n\n end",
"def all_assignments(user)\n team = user.teams.where(\"school_id = ? and coreteam = ?\",user.school,true).first\n if team\n assignments = self.assignments.includes([:duedates]).where( \"team_id = ?\",team).order(\"duedates.duedate ASC\")\n end\n end",
"def task_assignments\n harvest_client.task_assignments(project_id: self.id)\n end",
"def testNominalWithSeveralTypes\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_DummyGemAndOther ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ],\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Other/DummyOtherFile\"), 'All', 'Other', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def create\n if @project.round_begin?\n return render json: {error: 'You cannot change assignments after a round begins'}, status: :unprocessable_entity \n end\n\n requests = params[:list] || []\n assigns = @project.assigns.map{|a| \"#{a.document_id}-#{a.user_id}\"}\n\n insertSet = requests - assigns\n deleteSet = assigns - requests\n\n success = false \n insert_values = insertSet.map do |id|\n ids = id.split('-')\n pu = @project.project_users.where('user_id=?', ids[1].to_i).first\n \"(#{pu.id}, #{@project.id}, #{ids[0].to_i}, #{ids[1].to_i}, NOW(), NOW())\"\n end\n delete_values = deleteSet.map do |id|\n ids = id.split('-')\n \"(#{@project.id}, #{ids[0].to_i}, #{ids[1].to_i})\"\n end\n Assign.transaction do \n ActiveRecord::Base.connection.execute(\"\n INSERT INTO assigns(project_user_id, project_id, document_id, user_id, created_at, updated_at) VALUES #{insert_values.join(',')}\n \") unless insert_values.empty?\n\n ActiveRecord::Base.connection.execute(\"\n DELETE FROM assigns WHERE (project_id, document_id, user_id) IN (#{delete_values.join(',')})\n \") unless delete_values.empty?\n\n ActiveRecord::Base.connection.execute(\"\n UPDATE projects\n SET \n assigns_count = (SELECT count(1) FROM assigns WHERE assigns.project_id = projects.id)\n WHERE\n projects.id = #{@project.id}\n \")\n ActiveRecord::Base.connection.execute(\"\n UPDATE documents\n SET \n assigns_count = (SELECT count(1) FROM assigns WHERE assigns.document_id = documents.id)\n WHERE\n documents.project_id = #{@project.id}\n \")\n @project = Project.find(@project.id)\n success = true\n end\n # @assign = Assign.new(assign_params)\n\n respond_to do |format|\n if success\n format.html { redirect_to @assign, notice: 'Assign was successfully created.' }\n format.json { render json: {project: @project} }\n else\n format.html { render :new }\n format.json { render json: @assign.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_cell_ranger_expression_parse\n puts \"#{File.basename(__FILE__)}: #{self.method_name}\"\n\n # load study files\n matrix = @study.study_files.by_type('MM Coordinate Matrix').first\n genes = @study.study_files.by_type('10X Genes File').first\n barcodes = @study.study_files.by_type('10X Barcodes File').first\n\n # control values\n @expected_genes = File.open(genes.upload.path).readlines.map {|line| line.split.map(&:strip)}\n @expected_cells = File.open(barcodes.upload.path).readlines.map(&:strip)\n matrix_file = File.open(matrix.upload.path).readlines\n matrix_file.shift(3) # discard header lines\n expressed_gene_idx = matrix_file.map {|line| line.split.first.strip.to_i}\n @expressed_genes = expressed_gene_idx.map {|idx| @expected_genes[idx - 1].last}\n\n # initiate parse\n\n user = User.first\n puts 'Parsing 10X GRCh38 output...'\n ParseUtils.cell_ranger_expression_parse(@study, user, matrix, genes, barcodes, {skip_upload: true})\n puts 'Parse of 10X GRCh38 complete'\n # validate that the expected significant values have been created\n @expected_genes.each do |entry|\n gene_id, gene_name = entry\n gene = @study.genes.find_by(name: gene_name)\n assert gene_name == gene.name, \"Gene names do not match: #{gene_name}, #{gene.name}\"\n assert gene_id == gene.gene_id, \"Gene IDs do not match: #{gene_id}, #{gene.gene_id}\"\n # if this gene is expected to have expression, then validate the score is correct\n if @expressed_genes.include?(gene_name)\n expected_value = @expressed_genes.index(gene_name) + 1\n cell_name = gene.scores.keys.first\n assert @expected_cells.include?(cell_name), \"Cell name '#{cell_name}' was not from control list: #{@expected_cells}\"\n value = gene.scores.values.first\n assert value == expected_value, \"Did not find correct score value for #{gene.name}:#{cell_name}, expected #{expected_value} but found #{value}\"\n end\n end\n puts \"#{File.basename(__FILE__)}: #{self.method_name} successful!\"\n end",
"def tests=(_arg0); end"
] |
[
"0.6459815",
"0.6316795",
"0.61676776",
"0.61282265",
"0.60985446",
"0.58879894",
"0.5867649",
"0.5842562",
"0.58248323",
"0.5806834",
"0.5797749",
"0.5794961",
"0.5794961",
"0.5794961",
"0.5794961",
"0.5794961",
"0.5760024",
"0.5683397",
"0.5625491",
"0.5575681",
"0.5547382",
"0.55227673",
"0.5470821",
"0.5462535",
"0.5451964",
"0.5445027",
"0.54325616",
"0.54190946",
"0.54165953",
"0.5403104",
"0.54015887",
"0.5394544",
"0.5388489",
"0.5361067",
"0.53540164",
"0.5345333",
"0.53424764",
"0.53331757",
"0.53244853",
"0.5308095",
"0.5277322",
"0.52662337",
"0.5241322",
"0.52394116",
"0.5238602",
"0.52284783",
"0.5227561",
"0.5226751",
"0.522111",
"0.521616",
"0.52113986",
"0.5208135",
"0.5203398",
"0.5185325",
"0.51806283",
"0.5177174",
"0.5174804",
"0.5162174",
"0.51547694",
"0.5151604",
"0.5150675",
"0.5141518",
"0.51364344",
"0.51146686",
"0.51141745",
"0.5105199",
"0.5085689",
"0.50843287",
"0.507839",
"0.5068513",
"0.5053309",
"0.5042703",
"0.50422263",
"0.5039243",
"0.5037984",
"0.503044",
"0.50284",
"0.50210553",
"0.50144535",
"0.50100344",
"0.5004022",
"0.50024533",
"0.5001973",
"0.4980905",
"0.49801016",
"0.49797013",
"0.4978837",
"0.4972263",
"0.4967438",
"0.49672532",
"0.49648908",
"0.49640942",
"0.4959423",
"0.49556935",
"0.49556515",
"0.49520198",
"0.4946908",
"0.4942514",
"0.49419048",
"0.49405202"
] |
0.6767746
|
0
|
test_process_assignment_details Description: This method does the functional testing of the
|
def test_task_assignment
board_prep_sections = [oi_category_sections(:board_prep_1),
oi_category_sections(:board_prep_2),
oi_category_sections(:board_prep_3)]
section_ids = board_prep_sections.collect { |s| s.id }
team_member_list = [@siva_e]
designer_session = scott_designer_session
# Verify that a Teradyne PCB Designer can access the list
#
# Section Selection - Other
get(:section_selection,
{ :id => @other.id, :design_id => @mx234a.id },
designer_session)
assert_redirected_to(:action => :process_assignments,
:category_id => @other.id,
:design_id => @mx234a.id,
:section_id => OiCategory.other_category_section_id)
# Section Selection - Board Prep
get(:section_selection,
{:id => @board_prep.id, :design_id => @mx234a.id },
designer_session)
assert_equal(board_prep_sections, assigns(:sections))
assert_equal(0, assigns(:section_id))
# Process Assignments - No step selected
post(:process_assignments,
{ :design => { :id => @mx234a.id },
:category => { :id => @board_prep.id } },
designer_session)
#assert_equal("Please select the step", flash['notice'])
assert_nil(flash[:assignment])
assert_redirected_to(:action => 'section_selection',
:id => @board_prep.id,
:design_id => @mx234a.id)
# Process Assignments - No errors
post(:process_assignments,
{ :section_id => oi_category_sections(:board_prep_1).id,
:design => { :id => @mx234a.id },
:category => { :id => @board_prep.id } },
designer_session)
assert_equal(@mx234a.id, assigns(:design).id)
assert_equal(@board_prep.id, assigns(:category).id)
lcr_team_members = assigns(:team_members)
expected_team_members = [@siva_e, @mathi_n]
assert_equal(expected_team_members, lcr_team_members)
assert_equal(oi_category_sections(:board_prep_1).id,
assigns(:selected_step).id)
instruction = assigns(:instruction)
assert_equal(@board_prep.id, instruction.oi_category_section_id)
assert_equal(@mx234a.id, instruction.design_id)
assignment = assigns(:assignment)
assert_equal((Time.now+1.day).year, assignment.due_date.year)
assert_equal((Time.now+1.day).month, assignment.due_date.month)
assert_equal((Time.now+1.day).day, assignment.due_date.day)
assert_equal(OiAssignment.complexity_id('Low'), assignment.complexity_id)
assert_not_nil(assigns(:comment))
assert(!assigns(:selected_step).outline_drawing_link?)
allegro_board_symbol = '10987654321'
assignment_comment = 'This is a test'
medium_complexity_id = OiAssignment.complexity_id('Medium')
due_date = Time.local(2007, "May", 1)
# Process Assignment Details - No allegro board symbol provided.
post(:process_assignment_details,
{ :category => { :id => @board_prep.id },
:design => { :id => @mx234a.id },
:comment => { :comment => assignment_comment},
:instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s },
:assignment => { :complexity_id => medium_complexity_id,
"due_date(1i)" => "2007",
"due_date(2i)" => "5",
"due_date(3i)" => "1" },
:team_member => { "5004" => '1', "5005" => '1' } },
designer_session,
{:assignment => {:instruction => "",
:member_selections => "",
:comment => "",
:assignment => ""
} }
)
#assert_equal('Please identify the Allegro Board Symbol', flash['notice'])
#assert_not_nil(flash[:assignment])
assignment = flash[:assignment]
#assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)
#assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)
#assert_not_nil(assignment[:design])
#assert_equal(@mx234a.id, assignment[:design].id)
#flash[:assignment][:design].name = 'abc'
#assert_not_nil(assignment[:selected_step])
#assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)
#assert_not_nil(assignment[:instruction])
#assert_equal(board_prep_sections[0].id,
# assignment[:instruction].oi_category_section_id)
#assert_not_nil(assignment[:member_selections])
#assert_equal({ "5004" => '1', "5005" => '1' }, assignment[:member_selections])
#assert_not_nil(assignment[:team_members])
#assert_equal([@siva_e, @mathi_n], assignment[:team_members])
#assert_not_nil(assignment[:comment])
#assert_equal(assignment_comment, assignment[:comment].comment )
assert_redirected_to(:action => 'process_assignments',
:category_id => @board_prep.id,
:design_id => @mx234a.id)
return
follow_redirect!
#Verify that the variable where loaded from the flash.
#assert_equal(assignment[:design], assigns(:design))
#assert_equal(assignment[:category], assigns(:category))
#assert_equal(assignment[:team_members], assigns(:team_members))
#assert_equal(assignment[:selected_step], assigns(:selected_step))
#assert_equal(assignment[:instruction], assigns(:instruction))
#assert_equal(assignment[:assignment], assigns(:assignment))
#assert_equal(assignment[:comment], assigns(:comment))
#assert_not_nil(flash[:assignment])
#assert_nil(assigns(:outline_drawing))
# Process Assignment Details - No team members identified.
post(:process_assignment_details,
:category => { :id => @board_prep.id },
:design => { :id => @mx234a.id },
:comment => { :comment => assignment_comment},
:instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s,
:allegro_board_symbol => allegro_board_symbol },
:assignment => { :complexity_id => medium_complexity_id,
"due_date(1i)" => "2007",
"due_date(2i)" => "5",
"due_date(3i)" => "1" },
:team_member => { "5004" => '0', "5005" => '0' })
assert_equal('Please select a team member or members', flash['notice'])
assert_not_nil(flash[:assignment])
assignment = flash[:assignment]
assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)
assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)
assert_not_nil(assignment[:design])
assert_equal(@mx234a.id, assignment[:design].id)
flash[:assignment][:design].name = 'abc'
assert_not_nil(assignment[:selected_step])
assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)
assert_not_nil(assignment[:instruction])
assert_equal(board_prep_sections[0].id,
assignment[:instruction].oi_category_section_id)
assert_not_nil(assignment[:member_selections])
assert_equal({ "5004" => '0', "5005" => '0' }, assignment[:member_selections])
assert_not_nil(assignment[:team_members])
assert_equal([@siva_e, @mathi_n], assignment[:team_members])
assert_not_nil(assignment[:comment])
assert_equal(assignment_comment, assignment[:comment].comment )
assert_redirected_to(:action => 'process_assignments',
:category_id => @board_prep.id,
:design_id => @mx234a.id)
follow_redirect
#Verify that the variable where loaded from the flash.
assert_equal(assignment[:design], assigns(:design))
assert_equal(assignment[:category], assigns(:category))
assert_equal(assignment[:team_members], assigns(:team_members))
assert_equal(assignment[:selected_step], assigns(:selected_step))
assert_equal(assignment[:instruction], assigns(:instruction))
assert_equal(assignment[:assignment], assigns(:assignment))
assert_equal(assignment[:comment], assigns(:comment))
assert_not_nil(flash[:assignment])
assert_nil(assigns(:outline_drawing))
section_selections = {}
section_ids.each { |id| section_selections[id.to_s] = '0' }
# Process Assignment Details - No team members identified and no allegro board symbol
# provided.
post(:process_assignment_details,
:category => { :id => @board_prep.id },
:design => { :id => @mx234a.id },
:comment => { :comment => assignment_comment},
:instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s },
:assignment => { :complexity_id => medium_complexity_id,
"due_date(1i)" => "2007",
"due_date(2i)" => "5",
"due_date(3i)" => "1" },
:team_member => { "5004" => '0', "5005" => '0' })
assert_equal('Please identify the Allegro Board Symbol<br />' +
'Please select a team member or members',
flash['notice'])
assert_not_nil(flash[:assignment])
assignment = flash[:assignment]
assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)
assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)
assert_not_nil(assignment[:design])
assert_equal(@mx234a.id, assignment[:design].id)
flash[:assignment][:design].name = 'abc'
assert_not_nil(assignment[:selected_step])
assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)
assert_not_nil(assignment[:instruction])
assert_equal(board_prep_sections[0].id,
assignment[:instruction].oi_category_section_id)
assert_not_nil(assignment[:member_selections])
assert_equal({ "5004" => '0', "5005" => '0' }, assignment[:member_selections])
assert_not_nil(assignment[:team_members])
assert_equal([@siva_e, @mathi_n], assignment[:team_members])
assert_not_nil(assignment[:comment])
assert_equal(assignment_comment, assignment[:comment].comment )
assert_redirected_to(:action => 'process_assignments',
:category_id => @board_prep.id,
:design_id => @mx234a.id)
follow_redirect
#Verify that the variable where loaded from the flash.
assert_equal(assignment[:design], assigns(:design))
assert_equal(assignment[:category], assigns(:category))
assert_equal(assignment[:team_members], assigns(:team_members))
assert_equal(assignment[:selected_step], assigns(:selected_step))
assert_equal(assignment[:instruction], assigns(:instruction))
assert_equal(assignment[:assignment], assigns(:assignment))
assert_equal(assignment[:comment], assigns(:comment))
assert_not_nil(flash[:assignment])
assert_nil(assigns(:outline_drawing))
instruction_count = OiInstruction.count
assignment_count = OiAssignment.count
assignment_comment_count = OiAssignmentComment.count
post(:view_assignments,
:id => @board_prep.id,
:design_id => @mx234a.id)
assert_response(:success)
assert_equal(@mx234a.id, assigns(:design).id)
assert_equal(0, assigns(:assignment_list).size)
# Process Assignment Details - No errors
post(:process_assignment_details,
:category => { :id => @board_prep.id },
:design => { :id => @mx234a.id },
:comment => { :comment => assignment_comment},
:instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s,
:allegro_board_symbol => allegro_board_symbol },
:assignment => { :complexity_id => medium_complexity_id,
"due_date(1i)" => "2007",
"due_date(2i)" => "5",
"due_date(3i)" => "1" },
:team_member => { "5004" => '1', "5005" => '1' })
assert_equal('The work assignments have been recorded - mail was sent',
flash['notice'])
assert_nil(flash[:assignment])
assert_redirected_to(:action => 'oi_category_selection',
:design_id => @mx234a.id)
assert_equal(instruction_count+1, OiInstruction.count)
instructions = OiInstruction.find(:all)
last_instruction = instructions.pop
assert_equal(@scott_g.id, last_instruction.user_id)
assert_equal(allegro_board_symbol, last_instruction.allegro_board_symbol)
assert_equal(board_prep_sections[0].id, last_instruction.oi_category_section_id)
assert_equal(assignment_count+2, OiAssignment.count)
assignments = OiAssignment.find(:all)
mathi_assignment = assignments.pop
siva_assignment = assignments.pop
assert(!siva_assignment.complete?)
assert_equal(@siva_e.id, siva_assignment.user_id)
assert_equal(last_instruction.id, siva_assignment.oi_instruction_id)
assert_equal(due_date.to_i, siva_assignment.due_date.to_i)
assert_equal(medium_complexity_id, siva_assignment.complexity_id)
assert(!mathi_assignment.complete?)
assert_equal(@mathi_n.id, mathi_assignment.user_id)
assert_equal(last_instruction.id, mathi_assignment.oi_instruction_id)
assert_equal(due_date.to_i, mathi_assignment.due_date.to_i)
assert_equal(medium_complexity_id, mathi_assignment.complexity_id)
assert_equal(assignment_comment_count+2, OiAssignmentComment.count)
assignment_comments = OiAssignmentComment.find(:all)
mathi_comment = assignment_comments.pop
siva_comment = assignment_comments.pop
assert_equal(siva_assignment.id, siva_comment.oi_assignment_id)
assert_equal(@scott_g.id, siva_comment.user_id)
assert_equal(assignment_comment, siva_comment.comment)
assert_equal(mathi_assignment.id, mathi_comment.oi_assignment_id)
assert_equal(@scott_g.id, mathi_comment.user_id)
assert_equal(assignment_comment, mathi_comment.comment)
# Try accessing from an account that is not a PCB Designer and
# verify that the user is redirected.
set_user(@pat_a.id, 'Product Support')
post(:process_assignment_details)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a contractor PCB Designer can not access the list.
set_user(@siva_e.id, 'Designer')
post(:process_assignment_details)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify the email that was generated
expected_to = [ [ @siva_e.email ].sort,
[ @mathi_n.email ].sort,
[ @siva_e.email, @mathi_n.email ].sort ]
expected_cc_list = [@scott_g.email,
@jim_l.email,
@jan_k.email,
users(:bala_g).email,
@cathy_m.email].sort
assert_equal(2, @emails.size)
mathi_email = @emails.pop
siva_email = @emails.pop
assert_equal(1, siva_email.to.size)
assert_equal(@siva_e.email, siva_email.to.pop)
assert_equal(expected_cc_list, siva_email.cc.sort)
assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment created',
siva_email.subject)
assert_equal(1, mathi_email.to.size)
assert_equal(@mathi_n.email, mathi_email.to.pop)
assert_equal(expected_cc_list, mathi_email.cc.sort)
assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment created',
mathi_email.subject)
# Verify that a user from outside the PCB Group can not
# access the view_assignments view
set_user(@pat_a.id, 'Product Support')
post(:view_assignments)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a contractor PCB Designer can not access the
# view_assignments view
set_user(@siva_e.id, 'Designer')
post(:view_assignments)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a Teradyne PCB Designer can access the
# view_assignments view
set_user(@scott_g.id, 'Designer')
post(:view_assignments,
:id => @board_prep.id,
:design_id => @mx234a.id)
assert_response(:success)
assert_equal(@mx234a.id, assigns(:design).id)
assignment_list = assigns(:assignment_list)
assert_equal(1, assignment_list.size)
expected_sections = board_prep_sections.dup
# There is only on category populated
assignment_list.each do |category, assignments|
assert_equal(expected_sections.shift.id, category.id)
assert_equal(2, assignments.size)
end
# Verify that a user from outside the PCB Group can not
# access the assignment_view view
set_user(@pat_a.id, 'Product Support')
post(:assignment_view)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a Teradyne PCB Designer can access the
# the assignment_view view
set_user(@scott_g.id, 'Designer')
assignment_id = assignments.pop.id
post(:assignment_view, :id => assignment_id)
assert_response(:success)
assert_equal(assignment_id, assigns(:assignment).id)
assert_equal(@mx234a.id, assigns(:design).id)
assert_equal(@board_prep.id, assigns(:category).id)
comments = assigns(:comments)
assert_equal(1, comments.size)
comment = comments.pop
assert_equal(assignment_comment, comment.comment)
assert_not_nil(assigns(:post_comment))
# Verify that a user from outside the PCB Group can not
# access the category_details view
set_user(@pat_a.id, 'Product Support')
post(:category_details)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a contractor Team Member can access the
# category_details view
set_user(@siva_e.id, 'Designer')
post(:category_details, :id => @mx234a.id)
assert_response(:success)
assert_equal(@mx234a.id, assigns(:design).id)
siva_assignments = assigns(:category_list)
assert_equal(2, siva_assignments.size)
assert_not_nil(siva_assignments[@board_prep])
assignment_list = siva_assignments[@board_prep]
assert_equal(1, assignment_list.size)
assert_not_nil(assignment_list.detect { |a|
a.oi_instruction.oi_category_section_id == board_prep_sections[0].id })
assignment_list.each { |a| assert_equal(@siva_e.id, a.user_id) }
# Verify that a user from outside the PCB Group can not
# access the assignment_details view
set_user(@pat_a.id, 'Product Support')
post(:assignment_details)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a contractor Team Member can access the
# category_details view
set_user(@siva_e.id, 'Designer')
post(:assignment_details,
:id => @board_prep.id,
:design_id => @mx234a.id)
assert_response(:success)
assert_equal(@mx234a.id, assigns(:design).id)
assert_equal(@board_prep.id, assigns(:category).id)
section_list = assigns(:section_list)
assert_equal('Board Preparation', section_list[:category].name)
assert_equal(1, section_list[:assignment_list].size)
assert_equal(1, section_list[:assignment_list][0].oi_instruction.oi_category_section_id)
# Verify that a user from outside the PCB Group can not
# update an assignment.
set_user(@pat_a.id, 'Product Support')
post(:assignment_update)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
# Verify that a member of the PCB Design group can
# update an assignment
set_user(@siva_e.id, 'Designer')
# Get the instruction with 2 assignments associated with it
instruction = OiInstruction.find_by_design_id_and_oi_category_section_id(
@mx234a.id,
board_prep_sections[0].id)
siva_assignment = instruction.oi_assignments.detect { |a| a.user_id == @siva_e.id }
mathi_assignment = instruction.oi_assignments.detect { |a| a.user_id == @mathi_n.id }
assert_equal(2, instruction.oi_assignments.size)
assert_equal(1, siva_assignment.oi_assignment_comments.size)
assert_equal(0, siva_assignment.complete)
assert_equal(@siva_e.id, siva_assignment.user_id)
assert_equal(1, mathi_assignment.oi_assignment_comments.size)
assert_equal(0, mathi_assignment.complete)
assert_equal(@mathi_n.id, mathi_assignment.user_id)
siva_assignment_comment = siva_assignment.oi_assignment_comments.pop
mathi_assignment_comment = mathi_assignment.oi_assignment_comments.pop
assert_not_equal(siva_assignment_comment.id, mathi_assignment_comment.id)
post(:assignment_update,
:assignment => siva_assignment,
:post_comment => {:comment => 'My 2 cents'})
siva_assignment.reload
mathi_assignment.reload
assert_equal(2, instruction.oi_assignments.size)
assert_equal(2, siva_assignment.oi_assignment_comments.size)
assert_equal(0, siva_assignment.complete)
assert_equal(@siva_e.id, siva_assignment.user_id)
assert_equal(1, mathi_assignment.oi_assignment_comments.size)
assert_equal(0, mathi_assignment.complete)
assert_equal(@mathi_n.id, mathi_assignment.user_id)
cc_list = expected_cc_list.dup + [@siva_e.email] - [@scott_g.email]
email = @emails.pop
assert_equal([@scott_g.email], email.to.sort)
assert_equal(cc_list.sort, email.cc.sort)
assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update',
email.subject)
post(:assignment_update,
:assignment => { :id => siva_assignment.id,
:complete => "1"},
:post_comment => {:comment => 'It is done'})
siva_assignment.reload
mathi_assignment.reload
assert_equal(2, instruction.oi_assignments.size)
assert_equal(3, siva_assignment.oi_assignment_comments.size)
assert_equal(1, siva_assignment.complete)
assert_equal(@siva_e.id, siva_assignment.user_id)
assert_equal(1, mathi_assignment.oi_assignment_comments.size)
assert_equal(0, mathi_assignment.complete)
assert_equal(@mathi_n.id, mathi_assignment.user_id)
email = @emails.pop
assert_equal([@scott_g.email], email.to.sort)
assert_equal(cc_list.sort, email.cc.sort)
assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update - Completed',
email.subject)
set_user(@scott_g.id, 'Designer')
post(:assignment_update,
:assignment => { :id => siva_assignment.id,
:complete => "0"},
:post_comment => {:comment => 'My 2 cents'})
siva_assignment.reload
mathi_assignment.reload
assert_equal(2, instruction.oi_assignments.size)
assert_equal(4, siva_assignment.oi_assignment_comments.size)
assert_equal(0, siva_assignment.complete)
assert_equal(@siva_e.id, siva_assignment.user_id)
assert_equal(1, mathi_assignment.oi_assignment_comments.size)
assert_equal(0, mathi_assignment.complete)
assert_equal(@mathi_n.id, mathi_assignment.user_id)
cc_list = expected_cc_list.dup
email = @emails.pop
assert_equal([@siva_e.email], email.to.sort)
assert_equal(cc_list.sort, email.cc.sort)
assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update - Reopened',
email.subject)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_process_assignments\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_list = [@siva_e]\n \n section_selections = {}\n section_ids.each { |id| section_selections[id.to_s] = '0' }\n\n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n pat_dfm_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n \n # Verify that a contractor PCB Designer can not access the list.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n end",
"def test_legal_edit_assignment\n @assignment = Assignment.first\n id = Assignment.first.id\n number_of_assignment = Assignment.count\n questionnaire_id = Questionnaire.first.id\n post :update, :id => id, :assignment=> { :name => 'updatedAssignment9',\n :review_questionnaire_id => questionnaire_id,\n :review_of_review_questionnaire_id => questionnaire_id,\n :author_feedback_questionnaire_id => questionnaire_id\n }\n\n assert_equal flash[:notice], 'Assignment was successfully updated.'\n\n assert_response :redirect\n assert_equal Assignment.count, number_of_assignment\n assert Assignment.find(:all, :conditions => \"name = 'updatedAssignment9'\")\n end",
"def update\n @assignment = Assignment.find(params[:assignment_id])\n\n @assignment.transaction do\n\n begin\n # Process testing framework form for validation\n @assignment = process_test_form(@assignment, params)\n rescue Exception, RuntimeError => e\n @assignment.errors.add(:base, I18n.t('assignment.error',\n message: e.message))\n return redirect_to action: 'manage',\n assignment_id: params[:assignment_id]\n end\n\n # Save assignment and associated test files\n if @assignment.save\n flash[:success] = I18n.t('assignment.update_success')\n redirect_to action: 'manage',\n assignment_id: params[:assignment_id]\n else\n render :manage\n end\n end\n end",
"def test_add_assignment_participant()\n\t\tparticipant = AssignmentParticipant.new\n\t\tassert !participant.valid?\n\t\t\n\t\t#TODO read TODO tag in line 13\n\t\t\n\t\tparticipant.handle = 'test_handle'\n\t\tassert participant.valid?\n\tend",
"def assign_test(barcode,tests,mappings)\n\t\t## so do we get the name of the worker.\n\t\tif barcode_exists?(barcode[0]).blank?\n\n\t\t\tworker_hash = {}\n\t\t\ttests.each do |machine_code|\n\t\t\t\tworker_name = \"NO_ONE\"\n\t\t\t\t\n\t\t\t\tunless mappings[machine_code].blank?\n\t\t\t\t\ttest_type = mappings[machine_code][\"TYPE\"]\n\t\t\t\t\tworker_name = self.work_allotment_hash[test_type]\n\n\t\t\t\t\tworker_hash[worker_name] ||= []\n\n\t\t\t\t\t#puts \"worker name: #{worker_name}\"\n\t\t\t\t\t#puts \"lis code: #{machine_code}\"\n\t\t\t\t\t#puts mappings[machine_code].to_s\n\t\t\t\t\tworker_hash[worker_name] << mappings[machine_code][\"REPORT_NAME\"]\n\t\t\t\telse\n\t\t\t\t\tworker_hash[worker_name] ||= []\n\t\t\t\t\tworker_hash[worker_name] << machine_code\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t\n\t\t\tend\n\n\t\t\t#puts \"this is the workers hash\"\n\t\t\t#puts worker_hash.to_s\n\t\t\tworker_hash.keys.each do |worker_name|\n\t\t\t\tk = self.connection.post(ENDPOINT, :tests => worker_hash[worker_name].uniq, :barcode => barcode[0], :timestamp => Time.now.strftime(\"%b %-d %Y %I:%M %P\"), :worker_name => worker_name, :status => ACCESSION_DONE, :next_step => PROCESSING, :combi_key => worker_name + \"_pending\")\n\t\t\t\t#puts k.to_s\n\t\t\tend\n\t\telse\n\t\t\tputs \"this barcode: #{barcode[0]} already exists.\"\n\t\tend\n\n\tend",
"def test_illegal_edit_assignment\r\n\r\n id = Assignment.first.id\r\n @assignment = Assignment.first\r\n original_assignment_name = @assignment.name\r\n number_of_assignment = Assignment.count\r\n # It will raise an error while execute render method in controller\r\n # Because the goldberg variables didn't been initialized in the test framework\r\n assert_raise (ActionView::TemplateError){\r\n post :update, :id => id, :assignment=> { :name => '',\r\n :directory_path => \"admin/test1\",\r\n :review_questionnaire_id => 1,\r\n :review_of_review_questionnaire_id => 1,\r\n },\r\n :due_date => { \"1\" , { :resubmission_allowed_id =>1 ,\r\n :submission_allowed_id =>3,\r\n :review_of_review_allowed_id =>1,\r\n :review_allowed_id =>1,\r\n :due_at =>\"2007-07-10 15:00:00\",\r\n :rereview_allowed_id =>1\r\n }\r\n }\r\n }\r\n assert_template 'assignment/edit'\r\n assert_equal original_assignment_name, Assignment.first.name\r\n end",
"def test_illegal_edit_assignment\n\n id = Assignment.first.id\n @assignment = Assignment.first\n original_assignment_name = @assignment.name\n number_of_assignment = Assignment.count\n # It will raise an error while execute render method in controller\n # Because the goldberg variables didn't been initialized in the test framework\n assert_raise (ActionView::TemplateError){\n post :update, :id => id, :assignment=> { :name => '',\n :directory_path => \"admin/test1\",\n :review_questionnaire_id => 1,\n :review_of_review_questionnaire_id => 1,\n },\n :due_date => { \"1\" , { :resubmission_allowed_id =>1 ,\n :submission_allowed_id =>3,\n :review_of_review_allowed_id =>1,\n :review_allowed_id =>1,\n :due_at =>\"2007-07-10 15:00:00\",\n :rereview_allowed_id =>1\n }\n }\n }\n assert_template 'assignment/edit'\n assert_equal original_assignment_name, Assignment.first.name\n end",
"def assigment\n @assignment = Assignment.new(params[:assignment])\n @asset = Asset.new(params[:asset])\n\n if @assignment.save\n\n @delivery_from_assignment = Delivery.find(@assignment.delivery)\n\n @delivery_from_assignment.evaluation_criteria.each do |generate_rubres|\n @response_to_the_evaluation = ResponseToTheEvaluation.new\n @response_to_the_evaluation.name = generate_rubres.name\n @response_to_the_evaluation.comment_for_rubre = generate_rubres.description\n @response_to_the_evaluation.assignment_id = @assignment.id\n @response_to_the_evaluation.save\n end\n end\n end",
"def test_new_microtask\r\n #@assignment = assignments(:Assignment_Microtask1)\r\n questionnaire_id = questionnaires(:questionnaire1).id\r\n instructorid = users(:instructor1).id\r\n courseid = courses(:course_object_oriented).id,\r\n number_of_topics = SignUpTopic.count\r\n # create a new assignment\r\n post :new, :assignment => { :name => \"Assignment_Microtask1\",\r\n :directory_path => \"CSC517_instructor1/Assignment_Microtask1\",\r\n :submitter_count => 0,\r\n :course_id => courseid,\r\n :instructor_id => instructorid,\r\n :num_reviews => 1,\r\n :num_review_of_reviews => 0,\r\n :num_review_of_reviewers => 0,\r\n :review_questionnaire_id => questionnaire_id,\r\n :reviews_visible_to_all => 0,\r\n :require_signup => 0,\r\n :num_reviewers => 3,\r\n :team_assignment => 0,\r\n :team_count => 1,\r\n :microtask => true }\r\n\r\n assert_response 200\r\n assert Assignment.find(:all, :conditions => \"name = 'Assignment_Microtask1'\")\r\n\r\n end",
"def test_007\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n @@pu = Pu.find_by_name('SamplePU1')\n\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n @@pj = Pj.find_by_name('SamplePJ1')\n\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # test for value of master into combobox in master tab\n assert_equal [\"sample_c_cpp\"], get_select_options(\"master_id\")\n assert is_text_present(_(\"Optional setting\"))\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n # click link setup QAC++\n assert is_text_present(\"qacpp\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link2\"]\n sleep 2\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n\n\n # logout\n logout\n\n end",
"def test_004\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 全体解析 (Analysis of all)\n select \"analyze_type\", \"label=#{@overall}\"\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n #There is no display below \"selection of the upload method of an individual analysis file.\"\n assert !is_text_present(_(\"Select the upload method of individual analysis files\"))\n\n @@pu.destroy\n # logout\n logout\n\n end",
"def test_011\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n #Pu created\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n sleep 2\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # click link setup QAC++\n assert is_text_present(\"qacpp\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link2\"]\n # check log in the navigation bar\n sleep 2\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def testNominal\n executeProcess(\n [\n '--masterticket', '123',\n '--slaveticket', '456'\n ]\n ) do |iError, iSlaveActions|\n assert_equal(\n {\n Tools::TicketTracker => {\n Actions::Ticket_RejectDuplicate => [\n [ '123', '456' ]\n ]\n }\n },\n iSlaveActions\n )\n end\n end",
"def test_010\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n #Pu created\n\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_008\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n @@pj = Pj.find_by_name('SamplePJ1')#\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # test for value of master into combobox in master tab\n assert_equal [\"sample_c_cpp\"], get_select_options(\"master_id\")\n assert is_text_present(_(\"Optional setting\"))\n\n click $xpath[\"task\"][\"registration_task_button\"]\n sleep 2\n #assert !60.times{ break if (is_text_present(\"解析ツール未選択 入力内容に問題があるためタスクを登録できません。\") rescue false); sleep 2 }\n\n\n # logout\n logout\n\n end",
"def test_ut_t2_ars_ard_007\n ars_detail = AnalyzeRuleConfigDetail.find(:first)\n new_ars_detail = AnalyzeRuleConfigDetail.create()\n new_ars_detail.copy(ars_detail)\n #new_ars_detail.save\n assert_equal ars_detail.analyze_tool_id ,new_ars_detail.analyze_tool_id\n assert_equal ars_detail.rule_level, new_ars_detail.rule_level\n assert_equal ars_detail.rule_numbers, new_ars_detail.rule_numbers\n end",
"def test_q11_b_a\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Number of permissions created is incorrect\"\n assert_equal 3, form_processor.permission_count, \"Permission count on processor is incorrect\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r50\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r51\"}.length, \"Incorrect rule created\"\n end",
"def test_005\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # Below \"selection of the upload method of an individual analysis file\" is displayed.\n assert is_text_present(_(\"Select a master\"))\n assert is_text_present(_(\"Master\"))\n assert is_text_present(_(\"Select the upload method of individual analysis files\"))\n assert is_text_present(_(\"Upload of individual analysis files\"))\n\n @@pu.destroy\n # logout\n logout\n\n end",
"def process_assignments(user)\n # A user can manage an Assignment if they have the\n # can_manage_assignments? permission in any of the CourseOfferings of\n # the Course that the assignment belongs to.\n #\n # TODO This may need improvement.\n can :manage, Assignment do |assignment|\n course = assignment.course\n course_offerings = course.course_offerings.joins(\n :course_enrollments => :course_role).where(\n course_enrollments: { user_id: user.id },\n course_roles: { can_manage_assignments: true }\n )\n\n course_offerings.any?\n end\n\n can :read, Assignment do |assignment|\n course = assignment.course\n course_offerings = course.course_offerings.joins(\n :course_enrollments).where(\n course_enrollments: { user_id: user.id }\n )\n\n course_offerings.any?\n end\n\n # A user can manage an AssignmentOffering in any CourseOffering where\n # they are enrolled and have the can_manage_assignments? permission.\n\n can :manage, AssignmentOffering do |offering|\n course_offering = offering.course_offering\n\n user_enrollment = CourseEnrollment.where(\n user_id: user.id,\n course_offering_id: course_offering.id).first\n\n user_enrollment && user_enrollment.course_role.can_manage_assignments?\n end\n\n # A user can read an AssignmentOffering in any course offering where\n # they are enrolled, period.\n\n can :read, AssignmentOffering do |offering|\n course_offering = offering.course_offering\n\n CourseEnrollment.where(\n user_id: user.id,\n course_offering_id: course_offering.id).any?\n end\n end",
"def test_q11_b_ab\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n params[:q11_b_b] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r32\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r51\"}.length, \"Incorrect rule created\"\n end",
"def test_001\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n @@pu.destroy\n # logout\n logout\n\n end",
"def get_assignment\n return TestCase.find(params[:id]).assignment\n end",
"def test_009\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n #Pu created\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"analyze_allow_file_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(\"analyze_allow_files(qac)\") rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n # click link setup QAC++\n assert is_text_present(\"qacpp\")\n sleep 3\n click $xpath[\"task\"][\"analyze_allow_file_link2\"]\n # check log in the navigation bar\n sleep 2\n assert !60.times{ break if (is_text_present(\"analyze_allow_files(qacpp)\") rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_should_create_test_results\n test_target_instance = get_new_test_target_instance(\"example2\", \"2012112802\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1', 'test_case_2')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 1)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_2', 1)\n end",
"def test_lessons_are_associated_with_their_pre_class_assignments\n course = Course.create(name: \"Ruby on Rails\", course_code: \"ROR600\", color: \"Violet\")\n lesson = Lesson.create(name:\"Algebra Basics\", description: \"Basic intro into the wonderful world of Algebra\", outline: \"See math, do math\")\n assignment = Assignment.create(name: \"Variables\", percent_of_grade: 10)\n\n course.assignments << assignment\n assert lesson.pre_class_assignment = assignment\n\n assert_equal Assignment.find(assignment.id), lesson.pre_class_assignment\n end",
"def run_intelligent_assignment\n assignment = Assignment.find(params[:id])\n teams = assignment.teams\n\n users_bidding_info = construct_users_bidding_info(assignment.sign_up_topics, teams)\n bidding_data = { users: users_bidding_info, max_team_size: assignment.max_team_size }\n ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, \"Bidding data for assignment #{assignment.name}: #{bidding_data}\", request)\n\n begin\n url = WEBSERVICE_CONFIG['topic_bidding_webservice_url']\n response = RestClient.post url, bidding_data.to_json, content_type: :json, accept: :json\n # Structure of teams variable: [[user_id1, user_id2], [user_id3, user_id4]]\n teams = JSON.parse(response)['teams']\n ExpertizaLogger.info LoggerMessage.new(controller_name, session[:user].name, \"Team formation info for assignment #{assignment.name}: #{teams}\", request)\n create_new_teams_for_bidding_response(teams, assignment, users_bidding_info)\n assignment.remove_empty_teams\n match_new_teams_to_topics(assignment)\n rescue StandardError => e\n flash[:error] = e.message\n end\n\n redirect_to controller: 'tree_display', action: 'list'\n end",
"def test_assignments_are_associated_with_courses\n course = Course.create(name: \"Ruby on Rails\", course_code: \"ROR600\", color: \"Violet\")\n assignment = Assignment.create(name: \"Battleship\", percent_of_grade: 10)\n assignment_two = Assignment.create(name: \"Currency Converter\", percent_of_grade: 10)\n assignment_three = Assignment.create(name: \"Time Entries\", percent_of_grade: 10)\n\n assert course.assignments << assignment\n assert course.assignments << assignment_two\n assert course.assignments << assignment_three\n\n assert_equal 3, course.assignments.count\n end",
"def _assign\n configure_logger() # Sets up loggers\n\n # Consumers can optionally return false from assign if they don't want exposure to be logged\n assign_val = assign(@_assignment, **@inputs)\n @_in_experiment = assign_val || assign_val == nil ? true : false\n @_assigned = true\n end",
"def test_022\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Set Make_root as a suitable directory.\n type \"option_makeroot\", \"public/\"\n\n #The button \"which returns reflecting change\" is clicked.\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n sleep 3\n\n #An option setup of the target tool is changed.\n assert is_text_present(_(\"Make root\")+\":\")\n\n #The Make root directory set as the make_root field enters.\n assert_equal \"public/\", get_value($xpath[\"task\"][\"make_root_main_link\"])\n\n # logout\n logout\n\n end",
"def test_03_createORG_NPOdetails_audit()\n\t\t\n\t\tputs \"---------------------- START OF SCENARIO 3 ----------------------\"\n\t\t$neworg_ein = $workSheet.Cells($createOrg, \"C\").value\n\t\t$neworg_ein_afterincr = $neworg_ein.to_i()+1\n\t\t$workSheet.Cells($createOrg, \"C\").value = $neworg_ein_afterincr\n\t\t$workBook.Save\n\t\t$neworg2_ein = $neworg_ein_afterincr\n\t\tcreateOrg($admincon_url, $neworg2_ein, $new_orgname2, $org_city, $org_state)\n\t\teditNpoDetails($org2_url, $org_firstname, $org_lastname, $org_address1, $org_address2, $org_emailId, $org_phonenum)\n\t\tauditVerifyOrg(\"Verified this ORG\", $org2_url)\n\t\tputs \"---------------------- END OF SCENARIO 3 --------------------------\"\n\tend",
"def test_024\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Set Make_root as a suitable directory.\n type \"option_makeroot\", \"public/\"\n\n #The button \"which returns reflecting change\" is clicked.\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n sleep 3\n\n #An option setup of the target tool is changed.\n assert is_text_present(_(\"Make root\")+\":\")\n\n #The Make root directory set as the make_root field enters.\n assert_equal \"public/\", get_value($xpath[\"task\"][\"make_root_main_link\"])\n\n #The directory/file names which were being changed into the state\n #where it does not check at the information dialog\n #which clicks analyze_deny_files and comes out are enumerated.\n\n click $xpath[\"task\"][\"analyze_deny_files\"]\n sleep 3\n\n assert is_text_present(\"sample_c/Makefile\")\n\n\n # logout\n logout\n\n end",
"def test_023\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Set Make_root as a suitable directory.\n type \"option_makeroot\", \"public/\"\n\n #The button \"which returns reflecting change\" is clicked.\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n sleep 3\n\n #An option setup of the target tool is changed.\n assert is_text_present(_(\"Make root\")+\":\")\n\n #The Make root directory set as the make_root field enters.\n assert_equal \"public/\", get_value($xpath[\"task\"][\"make_root_main_link\"])\n\n #The directory/file names which were being changed into the check state\n #at the information dialog which clicks analyze_allow_files\n #and comes out are enumerated.\n click $xpath[\"task\"][\"analyze_allow_file_link\"]\n sleep 3\n\n assert !is_text_present(\"sample_c/Makefile\")\n\n # logout\n logout\n\n end",
"def test_q11_b_ac\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n params[:q11_b_c] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r33\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r50\"}.length, \"Incorrect rule created\"\n end",
"def test_unique_assignment_name_within_course_id\n a = Assignment.create(course_id: 1, name: \"Assignment 1\", percent_of_grade: 20.00)\n a1 = Assignment.new(course_id: 2, name: \"Assignment 1\", percent_of_grade: 20.00)\n assert a1.save\n a2 = Assignment.create(course_id: 3, name: \"Assignment 3\", percent_of_grade: 20.00)\n a3 = Assignment.new(course_id: 3, name: \"Assignment 3\", percent_of_grade: 20.00)\n refute a3.save\n end",
"def run_intelligent_assignment\n priority_info = []\n assignment = Assignment.find_by(id: params[:id])\n topics = assignment.sign_up_topics\n teams = assignment.teams\n teams.each do |team|\n # grab student id and list of bids\n bids = []\n topics.each do |topic|\n bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)\n bids << (bid_record.nil? ? 0 : bid_record.priority ||= 0)\n end\n team.users.each {|user| priority_info << {pid: user.id, ranks: bids} if bids.uniq != [0] }\n end\n data = {users: priority_info, max_team_size: assignment.max_team_size}\n url = WEBSERVICE_CONFIG[\"topic_bidding_webservice_url\"]\n begin\n response = RestClient.post url, data.to_json, content_type: :json, accept: :json\n # store each summary in a hashmap and use the question as the key\n teams = JSON.parse(response)[\"teams\"]\n create_new_teams_for_bidding_response(teams, assignment)\n run_intelligent_bid(assignment)\n rescue StandardError => err\n flash[:error] = err.message\n end\n redirect_to controller: 'tree_display', action: 'list'\n end",
"def update_assignment(attributes)\n unless @assignment.update_attributes(attributes)\n @errors = @assignment.errors.to_s\n @has_errors = true\n end\n @assignment.num_review_of_reviews = @assignment.num_metareviews_allowed\n @assignment.num_reviews = @assignment.num_reviews_allowed\n end",
"def test_parallel_assignments_with_extra_values\n first_name, last_name = [\"John\", \"Smith\", \"III\"]\n assert_equal \"John\", first_name\n assert_equal \"Smith\", last_name\n end",
"def test_04_createORG_NPOdetails_audit()\n\t\t\n\t\tputs \"---------------------- START OF SCENARIO 4 ----------------------\"\n\t\t$neworg_ein = $workSheet.Cells($createOrg, \"C\").value\n\t\t$neworg_ein_afterincr = $neworg_ein.to_i()+1\n\t\t$workSheet.Cells($createOrg, \"C\").value = $neworg_ein_afterincr\n\t\t$workBook.Save\n\t\t$neworg3_ein = $neworg_ein_afterincr\n\t\tcreateOrg($admincon_url, $neworg3_ein, $new_orgname3, $org_city, $org_state)\n\t\t$new_orgname2 = $workSheet.Cells($createOrg, \"P\").value\n\t\teditNpoDetails($org3_url, $org_firstname, $org_lastname, $org_address1, $org_address2, $org_emailId, $org_phonenum)\n\t\tauditVerifyOrg(\"Verified this ORG\", $org3_url)\n\t\tlogout()\n\t\tputs \"---------------------- END OF SCENARIO 4 --------------------------\"\n\tend",
"def assignment_params\n params.require(:assignment).permit(:metric_id, :test_id, :test_slot)\n end",
"def assignment\n # Create assignment\n Relationship.create(assignment_parameters)\n \n # Get human readable assignment values\n @assignment_parts = assign_parts(params)\n end",
"def test_view_assignment_report\n \n first_assignment = oi_assignments(:first)\n \n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:view_assignment_report, { :id => first_assignment }, siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n get(:view_assignment_report, { :id => first_assignment }, scott_designer_session)\n assert_equal(first_assignment.id, assigns(:assignment).id)\n assert_equal([], assigns(:comments))\n assert_equal(OiAssignmentReport.report_card_scoring, assigns(:scoring_table))\n assert_equal(\"0% Rework\", assigns(:current_score))\n \n end",
"def test_021\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Set Make_root as a suitable directory.\n type \"option_makeroot\", \"public/\"\n\n #The button \"which returns reflecting change\" is clicked.\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n sleep 3\n\n #An option setup of the target tool is changed.\n assert is_text_present(_(\"Make root\")+\":\")\n\n # logout\n logout\n\n end",
"def test_002\n\n # login\n login\n @@pu = 1\n @@pj = 1\n open\"/devgroup/pj_index/#{@@pu}/#{@@pj}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu}/#{@@pj}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n #Select \"uploading a file individually\"\n click \"file_upload_upload_way_upload_each\"\n assert is_text_present(_(\"Uploaded individually.\"))\n click $xpath[\"task\"][\"read_tree\"]\n\n assert !60.times{ break if (is_text_present(_(\"Directory structure\")) rescue false); sleep 2 }\n # logout\n logout\n\n end",
"def compare_product_tests(test1, test2)\n # compare relevant details\n test1.save\n test2.save\n assert_performed_jobs 2\n\n test1.reload\n test2.reload\n compare_results(test1, test2)\n\n # compare records\n test1.patients.each_index do |x|\n patient1 = test1.patients.fetch(x)\n patient2 = test2.patients.fetch(x)\n compare_records(patient1, patient2)\n end\n end",
"def test_add_participant()\n\t\tparticipant = Participant.new\n assert participant.valid?\n\t\t#TODO Should an empty Participant be allowed?\n\t\t# assert !participant.valid?\n\t\t#TODO Define required fields in test and add those validations to the model so test passes.\n user = users(:student1)\n participant.user= user\n participant.assignment= assignments(:assignment1)\n\t\tassert participant.valid?\n assert \"student1\", participant.name\n assert \"student1_fullname\", participant.fullname\n assert \"assignment 1\", participant.assignment.name\n\tend",
"def test_01_createORG_NPOdetails_audit()\n\t\t\n\t\tputs \"---------------------- START OF SCENARIO 1 ----------------------\"\n\t\tlogin($globaladmin_emailId, $globaladmin_password)\n\t\tcreateOrg($admincon_url, $neworg_ein, $new_orgname, $org_city, $org_state)\n\t\teditNpoDetails($org_url, $org_firstname, $org_lastname, $org_address1, $org_address2, $org_emailId, $org_phonenum)\n\t\tauditVerifyOrg(\"Verified this ORG\", $org_url)\n\t\tverifyNpoDetails()\n\t\tbecomeFan()\n\t\tputs \"---------------------- END OF SCENARIO 1 --------------------------\"\n\tend",
"def test_get_etc_function_by_qa\n\t\tbatch = Batch.create!( :batchid => 291206,\n :facility => facilities(:facility1),\n :date => Date.today.strftime(\"%m/%d/%Y\"),\n :arrival_time => \"#{Time.now}\",\n :target_time\t=> \"#{Time.now.tomorrow - 64.minutes}\",\n :status => \"New\",\n :manual_override => false)\n\n\t\tjob_new = Job.create!(:batch=>batch,\n :tiff_number=>1234,:check_number=>12131,\n :count=>12,:estimated_eob => 50,\n :qa_id => 1)\n\t\tbatch.reload\n\t\tbatch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_with_qa = batch.expected_completion_time\n\n job_one_more = Job.create(:batch=>batch,:tiff_number=>1231,\n :check_number=>12135,:count=>12,\n :estimated_eob => 50,\n :qa_id => 2)\n\t\tbatch.reload\n\t\tbatch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_with_two_jobs = batch.expected_completion_time\n \tassert_in_delta etc_with_qa.to_i, etc_with_two_jobs.to_i,1\n\n\t\tjob_one_more.qa_id = 1\n\t\tjob_one_more.update\n\t\tbatch.reload\n\t\tbatch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_after_change_qa = batch.expected_completion_time\n\n\t\tassert_not_equal(etc_with_qa, etc_after_change_qa)\n\n\t\tjob_new.qa_id = nil\n\t\tjob_new.update\n\t\tbatch.reload\n batch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_after_deallocate = batch.expected_completion_time\n\t\tassert_not_equal(etc_after_deallocate, etc_after_change_qa)\n\t\tassert_in_delta etc_after_deallocate.to_i, etc_with_two_jobs.to_i, 1\n end",
"def test_025\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Set Make_root as a suitable directory.\n type \"option_makeroot\", \"public/\"\n\n #The button \"which returns reflecting change\" is clicked.\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n sleep 3\n\n #An option setup of the target tool is changed.\n assert is_text_present(_(\"Make root\")+\":\")\n\n #The Make root directory set as the make_root field enters.\n assert_equal \"public/\", get_value($xpath[\"task\"][\"make_root_main_link\"])\n\n #Move to general control tab\n click $xpath[\"task\"][\"general_control_tab\"]\n\n #The information set does not disappear and remains.\n assert_equal \"public/\", get_value($xpath[\"task\"][\"make_root_main_link\"])\n\n # logout\n logout\n\n end",
"def test_assign_groups_to_reviews\n\n post(:assign_groups_to_reviews,\n { :review_type => {\n # 1-Final, 2-Routing, 3-Pre-Art, 4-Placement, 5-Release\n '5_1'=>'1', '5_2'=>'0', '5_3'=>'1', '5_4'=>'0', '5_5'=>'0', #HWENG\n '6_1'=>'1', '6_2'=>'1', '6_3'=>'1', '6_4'=>'0', '6_5'=>'1', #VALOR\n '7_1'=>'1', '7_2'=>'1', '7_3'=>'0', '7_4'=>'1', '7_5'=>'1', #CE-DFT\n '8_1'=>'0', '8_2'=>'0', '8_3'=>'1', '8_4'=>'0', '8_5'=>'1', #DFM\n '9_1'=>'1', '9_2'=>'0', '9_3'=>'1', '9_4'=>'1', '9_5'=>'0', #TDE\n '10_1'=>'1', '10_2'=>'0', '10_3'=>'1', '10_4'=>'1', '10_5'=>'0', #MECHANICAL\n '11_1'=>'0', '11_2'=>'1', '11_3'=>'1', '11_4'=>'1', '11_5'=>'0', #MECH-MFG\n '12_1'=>'1', '12_2'=>'0', '12_3'=>'0', '12_4'=>'0', '12_5'=>'1', #PCB DESIGN\n '13_1'=>'1', '13_2'=>'0', '13_3'=>'1', '13_4'=>'0', '13_5'=>'0', #PLANNING\n '14_1'=>'1', '14_2'=>'0', '14_3'=>'0', '14_4'=>'0', '14_5'=>'0', #PCB IG\n '15_1'=>'1', '15_2'=>'0', '15_3'=>'0', '15_4'=>'0', '15_5'=>'0', #LIBRARY\n '16_1'=>'0', '16_2'=>'0', '16_3'=>'1', '16_4'=>'1', '16_5'=>'1', #PCB MECH\n '17_1'=>'1', '17_2'=>'1', '17_3'=>'1', '17_4'=>'1', '17_5'=>'1', #SLM BOM\n '18_1'=>'0', '18_2'=>'1', '18_3'=>'1', '18_4'=>'1', '18_5'=>'0', #SLM-Vendor\n '19_1'=>'1', '19_2'=>'0', '19_3'=>'0', '19_4'=>'0', '19_5'=>'1' #OPS MGR\n } },\n cathy_admin_session)\n\n post :review_type_role_assignment, {}, cathy_admin_session\n\n assert_response :success\n\n roles = assigns(roles)['roles']\n review_types = assigns(review_types)['review_types']\n\n expected_values = [\n {:name => 'Hardware Engineering Manager',\n :review_types => []},\n {:name => 'Operations Manager',\n :review_types => ['Final', 'Release']},\n {:name => 'PCB Design',\n :review_types => ['Final', 'Release']},\n {:name => 'Program Manager',\n :review_types => []},\n {:name => 'DFM',\n :review_types => ['Pre-Artwork', 'Release']},\n {:name => 'CE-DFT',\n :review_types => ['Final', 'Placement', 'Release', 'Routing']},\n {:name => 'Compliance - EMC', \n :review_types => []},\n {:name => 'Compliance - Safety', \n :review_types => []},\n {:name => 'Library',\n :review_types => ['Final']},\n {:name => 'ECN',\n :review_types => []},\n {:name => 'HWENG',\n :review_types => ['Final', 'Pre-Artwork']},\n {:name => 'Mechanical',\n :review_types => ['Final', 'Placement', 'Pre-Artwork']},\n {:name => 'Mechanical-MFG',\n :review_types => ['Placement', 'Pre-Artwork', 'Routing']},\n {:name => 'Planning',\n :review_types => ['Final', 'Pre-Artwork']},\n {:name => 'PCB Input Gate',\n :review_types => ['Final']},\n {:name => 'PCB Mechanical',\n :review_types => ['Placement', 'Pre-Artwork', 'Release']},\n {:name => 'SLM BOM',\n :review_types => ['Final', 'Placement', 'Pre-Artwork', 'Release', 'Routing']},\n {:name => 'SLM-Vendor',\n :review_types => ['Placement', 'Pre-Artwork', 'Routing']},\n {:name => 'TDE',\n :review_types => ['Final', 'Placement', 'Pre-Artwork']},\n {:name => 'Valor', \n :review_types => ['Final', 'Pre-Artwork', 'Release', 'Routing']}\n ]\n\n #assert_equal(expected_values, roles)\n assert_equal(expected_values.size, roles.size)\n assert_equal(5, review_types.size)\n\n roles.each_with_index { |role, i|\n expected_role = expected_values[i]\n assert_equal(expected_role[:name], role.name)\n \n returned_rts = role.review_types.collect { |rt| rt.name }\n\n returned_rts = returned_rts.sort_by { |rt| rt }\n returned_rts.each_with_index { |review_type, j|\n expected_name = expected_role[:review_types][j]\n assert_equal(expected_role[:name]+'::'+expected_name.to_s,\n role.name+'::'+review_type)\n }\n\n }\n\n expected_values = [\n {:name => 'Pre-Artwork',\n :role_names => ['DFM', 'HWENG', 'Mechanical', 'Mechanical-MFG', 'PCB Mechanical', 'Planning', 'SLM BOM', 'SLM-Vendor', 'TDE', 'Valor']},\n {:name => 'Placement', \n :role_names => ['CE-DFT', 'Mechanical', 'Mechanical-MFG', 'PCB Mechanical', 'SLM BOM', 'SLM-Vendor', 'TDE']},\n {:name => 'Routing', \n :role_names => ['CE-DFT', 'Mechanical-MFG', 'SLM BOM', 'SLM-Vendor', 'Valor']},\n {:name => 'Final',\n :role_names => ['CE-DFT', 'HWENG', 'Library', 'Mechanical', 'Operations Manager', 'PCB Design', 'PCB Input Gate', 'Planning', 'SLM BOM', 'TDE', 'Valor']},\n {:name => 'Release', \n :role_names => ['CE-DFT', 'DFM', 'Operations Manager', 'PCB Design', 'PCB Mechanical', 'SLM BOM', 'Valor']}\n ]\n review_types.each { |review_type| \n expected_rt = expected_values.shift\n\n returned_roles = []\n review_type.roles.each { |role| returned_roles.push(role.name) }\n\n returned_roles.sort.each { |role|\n expected_role = expected_rt[:role_names]\n expected_name = expected_role.shift\n assert_equal(expected_rt[:name]+'::'+expected_name, \n review_type.name+'::'+role)\n }\n }\n\n end",
"def test_02_createEinLessORG_NPOdetails_audit()\n\t\t\n\t\tputs \"---------------------- START OF SCENARIO 2 ----------------------\"\n\t\tcreateEinLessOrg($admincon_url, $new_einlessorgname, $org_city, $org_state)\n\t\teditNpoDetails($einlessorg_url, $org_firstname, $org_lastname, $org_address1, $org_address2, $org_emailId, $org_phonenum)\n\t\tauditVerifyOrg(\"Verified this ORG\", $einlessorg_url)\n\t\tverifyNpoDetails()\n\t\tbecomeFan()\n\t\tputs \"---------------------- END OF SCENARIO 2 --------------------------\"\n\tend",
"def process_test_form(assignment, params, assignment_params,\r\n new_script, new_support_file)\r\n updated_script_files = {}\r\n updated_support_files = {}\r\n\r\n testscripts = assignment_params[:test_scripts_attributes] || []\r\n testsupporters = assignment_params[:test_support_files_attributes] || []\r\n\r\n # Create/Update test scripts\r\n testscripts.each do |file_num, file|\r\n # If no new_script then form is empty and skip\r\n next if testscripts[file_num][:seq_num].empty? && new_script.nil?\r\n if testscripts[file_num][:script_name].nil?\r\n # Create new test script file if one with the same name does not exist\r\n updated_script_files[file_num] = {}\r\n filename = new_script.original_filename\r\n if TestScript.exists?(script_name: filename, assignment: assignment)\r\n raise I18n.t('automated_tests.duplicate_filename') + filename\r\n end\r\n updated_script_files[file_num] = file.clone\r\n # Override filename from form\r\n updated_script_files[file_num][:script_name] = filename\r\n updated_script_files[file_num][:seq_num] = file_num\r\n else\r\n # Edit existing test script file\r\n if params[('new_update_script_' + testscripts[file_num][:script_name]).to_sym].nil?\r\n updated_script_files[file_num] = file.clone\r\n else\r\n new_update_script = params[('new_update_script_' + testscripts[file_num][:script_name]).to_sym]\r\n new_script_name = new_update_script.original_filename\r\n old_script_name = file[:script_name]\r\n if TestScript.exists?(script_name: new_script_name, assignment: assignment)\r\n raise I18n.t('automated_tests.duplicate_filename') + new_script_name\r\n end\r\n updated_script_files[file_num] = file.clone\r\n updated_script_files[file_num][:script_name] = new_script_name\r\n updated_script_files[file_num][:seq_num] = file_num\r\n\r\n # Uploading new script\r\n assignment_tests_path = File.join(\r\n MarkusConfigurator.markus_ate_client_dir,\r\n @assignment.repository_folder,\r\n new_script_name)\r\n # Replace bad line endings from windows\r\n contents = new_update_script.read.tr(\"\\r\", '')\r\n File.open(assignment_tests_path, 'w') { |f| f.write contents }\r\n\r\n # Deleting old script\r\n old_script_path = File.join(\r\n MarkusConfigurator.markus_ate_client_dir,\r\n @assignment.repository_folder,\r\n old_script_name)\r\n if File.exist?(old_script_path)\r\n File.delete(old_script_path)\r\n end\r\n end\r\n end\r\n # Always make sure the criterion type is correct.\r\n # The :criterion_id parameter contains a list of the form\r\n # [criterion_id, criterion_type], which JSON.parse cannot parse unless\r\n # neither element is nil\r\n if testscripts[file_num][:criterion_id].nil? || testscripts[file_num][:criterion_id][0].nil? || testscripts[file_num][:criterion_id][1].nil?\r\n updated_script_files[file_num][:criterion_type]\r\n else\r\n crit_id, crit_type = JSON.parse testscripts[file_num][:criterion_id]\r\n updated_script_files[file_num][:criterion_id] = crit_id\r\n updated_script_files[file_num][:criterion_type] = crit_type\r\n end\r\n end\r\n\r\n # Create/Update test support files\r\n # Ignore editing files for now\r\n testsupporters.each do |file_num, file|\r\n # Empty file submission, skip\r\n next if testsupporters[file_num][:file_name].nil? && new_support_file.nil?\r\n if testsupporters[file_num][:file_name].nil?\r\n # Create test support file if one with the same name does not exist\r\n updated_support_files[file_num] = {}\r\n filename = new_support_file.original_filename\r\n if TestSupportFile.exists?(file_name: filename, assignment: assignment)\r\n raise I18n.t('automated_tests.duplicate_filename') + filename\r\n end\r\n updated_support_files[file_num] = file.clone\r\n # Override filename from form\r\n updated_support_files[file_num][:file_name] = filename\r\n else\r\n # Edit existing test support file\r\n if params[('new_update_file_' + testsupporters[file_num][:file_name]).to_sym].nil?\r\n updated_support_files[file_num] = file.clone\r\n else\r\n new_update_file = params[('new_update_file_' + testsupporters[file_num][:file_name]).to_sym]\r\n new_file_name = new_update_file.original_filename\r\n old_file_name = file[:file_name]\r\n if TestSupportFile.exists?(file_name: new_file_name, assignment: assignment)\r\n raise I18n.t('automated_tests.duplicate_filename') + new_file_name\r\n end\r\n updated_support_files[file_num] = file.clone\r\n updated_support_files[file_num][:file_name] = new_file_name\r\n\r\n # Uploading new file\r\n assignment_tests_path = File.join(\r\n MarkusConfigurator.markus_ate_client_dir,\r\n @assignment.repository_folder,\r\n new_file_name)\r\n File.open(\r\n assignment_tests_path, 'w') { |f| f.write new_update_file.read }\r\n\r\n # Deleting old file\r\n old_file_path = File.join(\r\n MarkusConfigurator.markus_ate_client_dir,\r\n @assignment.repository_folder,\r\n old_file_name)\r\n if File.exist?(old_file_path)\r\n File.delete(old_file_path)\r\n end\r\n end\r\n end\r\n end\r\n\r\n # Update test file attributes\r\n assignment.test_scripts_attributes = updated_script_files\r\n assignment.test_support_files_attributes = updated_support_files\r\n\r\n assignment.enable_test = assignment_params[:enable_test]\r\n assignment.enable_student_tests = assignment_params[:enable_student_tests]\r\n assignment.unlimited_tokens = assignment_params[:unlimited_tokens]\r\n assignment.token_start_date = assignment_params[:token_start_date]\r\n assignment.token_period = assignment_params[:token_period]\r\n assignment.tokens_per_period = assignment_params[:tokens_per_period].nil? ?\r\n 0 : assignment_params[:tokens_per_period]\r\n\r\n return assignment\r\n end",
"def test_get_etc_by_processor\n\t\tclient = Client.create!(:name => 'New Client', :contracted_tat => 12, :tat => 30)\n\t\tfacility = Facility.create!(:name => 'New Facility', :client => client, :sitecode => '00902')\n\t\tprocessor = User.new(:name => 'gg', :userid => 'gg', :password => 'gg',\n :processing_rate_triad => 10, :processing_rate_others => 15)\n\t\tbatch = Batch.create!(:batchid \t\t\t\t\t=> 14567,\n :facility \t\t\t\t=> facility,\n :date \t\t\t\t\t\t=> Date.today.strftime(\"%m/%d/%Y\"),\n :arrival_time \t\t=> \"#{Time.now}\",\n :target_time \t\t=> \"#{Time.now.tomorrow - 64.minutes}\",\n :status \t\t=> \"New\",\n :manual_override \t=> false)\n\n\t\tjob_new = Job.create!(:batch=>batch,:tiff_number=>1234,\n :check_number=>12131,:count=>12,\n :estimated_eob => 50, :processor => processor,\n :processor_status => 'Processor Allocated',:job_status => 'Processing')\n\t\tbatch.reload\n batch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_with_one_job = batch.expected_completion_time\n\n job_one_more = Job.new(:batch=>batch,:tiff_number=>1231,\n :check_number=>12135,:count=>12,\n :estimated_eob => 50,:processor => processor,\n :processor_status => 'Processor Allocated',:job_status => 'Processing')\n\t\tjob_one_more.save\n\t\tbatch.reload\n\t\tbatch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_with_two_jobs = batch.expected_completion_time\n\n\t\tassert_not_equal(etc_with_one_job, etc_with_two_jobs)\n\n\t\tjob_one_more.processor = nil\n\t\tjob_one_more.job_status = ''\n\t\tjob_one_more.update\n\t\tbatch.reload\n\t\tbatch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_after_deallocation = batch.expected_completion_time\n assert_in_delta(etc_after_deallocation, etc_with_one_job, 1, \"ETC after deallocation varys by more than 1 second.\")\n end",
"def test_create_assignment_report\n \n first_report = oi_assignment_reports(:first)\n \n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:create_assignment_report, { :id => oi_assignment_reports(:first) }, lee_hweng_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n get(:create_assignment_report, {:id => first_report}, scott_designer_session)\n assert_equal(first_report.id, assigns(:assignment).id)\n assert_equal(1, assigns(:complexity_id))\n assert_equal(OiAssignmentReport::NOT_SCORED, assigns(:report).score)\n assert_equal([], assigns(:comments))\n assert_equal(OiAssignmentReport.report_card_scoring,\n assigns(:scoring_table))\n \n # Verify the redirect to create_assignment_report by create report when the \n # report has not been scored.\n \n \n end",
"def test_employee_added_to_a_human_resources\n human_resources = Department.new(\"Human Resources\")\n danai = Employee.new(name: \"Danai\",email: \"danai@live.com\", phone_number: \"307-555-5555\", salary: 100)\n anna = Employee.new(name: \"Anna\",email: \"anna@live.com\", phone_number: \"919-555-5555\", salary: 5000)\n turner = Employee.new(name: \"Turner\", email: \"turner@live.com\", phone_number: \"303-555-5555\", salary: 500)\n\n assert human_resources.assign(danai)\n assert human_resources.assign(anna)\n assert human_resources.assign(turner)\n\n assert_equal [danai,anna,turner], human_resources.department_staff\n end",
"def process_test_cases\n raise NotImplementedError, 'You must implement this'\n end",
"def test_q11_b_c\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_c] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Number of permissions created is incorrect\"\n assert_equal 3, form_processor.permission_count, \"Permission count on processor is incorrect\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r33\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r49\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r50\"}.length, \"Incorrect rule created\"\n end",
"def test_assignments_are_associated_with_assignment_grades\n assignment = Assignment.create(name: \"Battleship\", percent_of_grade: 10, course_id: 2)\n\n grade = AssignmentGrade.create(final_grade: \"A\")\n grade_two = AssignmentGrade.create(final_grade: \"B\")\n\n assert assignment.assignment_grades << grade\n assert assignment.assignment_grades << grade_two\n\n assert_equal 2, assignment.assignment_grades.count\n end",
"def dup_test\n duplicate = dup\n duplicate.update_attributes(\n state: :incomplete,\n step: :details,\n wizard_progress: 0,\n qrda_progress: 0,\n results: { passed: 0, total: 0 },\n disable_details: false,\n file_path: ''\n )\n duplicate.save\n duplicate\n end",
"def assignments; end",
"def test_delete_assignment\r\n\r\n number_of_assignment = Assignment.count\r\n number_of_duedate = DueDate.count\r\n id = Assignment.first(:conditions => {:instructor_id => users(:instructor3).id}).id\r\n post :delete, :id => id\r\n assert_redirected_to :controller => 'tree_display', :action => 'list'\r\n assert_equal number_of_assignment-1, Assignment.count\r\n assert_raise(ActiveRecord::RecordNotFound){ Assignment.find(id) }\r\n\r\n end",
"def on_assignment_completed(assignment)\n\t\t\ttally\n\t\tend",
"def test_should_create_test_result\n test_target_instance = get_new_test_target_instance(\"example1\", \"2012112801\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1')\n assert_response :success\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 1)\n end",
"def test_006\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #A task type is changed into \"individual analysis\"\n # with a \"general control\" tab.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析 (Individual Analysis)\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n #An option setup of \"master: A qac\" subwindow is displayed.\n click $xpath[\"task\"][\"option_setup_link\"]\n # click \"link=設定する\"\n sleep 3\n # #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n assert !60.times{ break if (@selenium.is_text_present(_(\"Optional setting\")+\":qac\") rescue false); sleep 2 }\n sleep 2\n\n # logout\n logout\n\n end",
"def test_assignments_must_have_qualities\n a = Assignment.create(course_id: 3, name: \"Assignment 3\", percent_of_grade: 20.00)\n a1 = Assignment.new(course_id: 3, name: \"Assignment 3\")\n refute a1.save\n a2 = Assignment.new(course_id: 4)\n refute a2.save\n end",
"def test_012\n\n #login\n login\n\n #Open PU management page\n open_pu_management_page_1\n\n # Find a PU\n # Pu created\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n #test for make root in the master tab & in the popup which is displayed by clicking 設定する\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link\"]\n #test for make root\n type \"makeroot_qac\", \"abc\"\n run_script \"destroy_subwindow()\"\n assert is_text_present(_(\"Make root\")+\":\")\n click $xpath[\"task\"][\"option_setup_link\"]\n sleep 2\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n sleep 3\n assert !60.times{ break if (@selenium.is_text_present(_(\"Optional setting\")+\":qac\") rescue false); sleep 2 }\n type \"makeroot_qac\", \"abc\"\n click $xpath[\"task\"][\"back_to_reflect_the_changes\"]\n sleep 2\n assert is_text_present(_(\"Make root\")+\":\")\n click $xpath[\"task\"][\"option_setup_link\"]\n assert !60.times{ break if (@selenium.is_text_present(_(\"Optional setting\")+\":qac\") rescue false); sleep 2 }\n\n\n\n #logout\n logout\n\n end",
"def match_assignment(assign,assign_params)\n ( Account.includes(:skills).where.not(skills: { id: nil }) |\n Account.includes(:languages).where.not(languages: { id: nil }) |\n Account.includes(:locations).where.not(locations: {id: nil}) ).each do |acc|\n if acc.id != assign.user_id\n total_score = total_score(acc,assign)\n if total_score > 10.00\n automatch = ScoreAccountAssignment.new(assignment_id: assign.id, account_id: acc.id)\n automatch.score_categories = score_categories(acc,assign).to_json\n automatch.total_score = total_score\n automatch.save\n end\n end\n end\n end",
"def test_q11_b_b\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_b] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Number of permissions created is incorrect\"\n assert_equal 3, form_processor.permission_count, \"Permission count on processor is incorrect\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r32\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r49\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r51\"}.length, \"Incorrect rule created\"\n end",
"def assignment_params\n params.require(:assignment).permit(:assignment_id, :assignment_name, :details, :priority, :date_created, :date_due, :is_complete, :grade_received, :select_course)\n end",
"def create\n @assignment = Assignment.new(assignment_params)\n @assignment.creator_id = current_user.id\n\n # THIS IS ONLY FOR CREATING ASSIGNMENT FOR THE VERY FIRST TIME\n # if users wants to add more users to this, edit should be used and user_assignment_controller for it\n respond_to do |format|\n if @assignment.save\n current_user.assignments << @assignment\n @assignment.update_attribute(:is_done, false)\n @assignment.user_assignments.first.update_attribute(:assignment_id, @assignment.id) # for each?\n format.html { redirect_to current_user, notice: 'Assignment was successfully created.' }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { redirect_to :back }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_export_to_pstore\r\n model=Model.new(2, 'pstore persistance')\r\n model.description = 'will be deleted between tests'\r\n model.commentary = 'and they are off'\r\n \r\n proc1 = model.node_list.add_node(1, 'process one', PROCESS)\r\n proc2 = model.node_list.add_node(2, 'process two', PROCESS)\r\n proc1.evidence = [0.2, 0.3]\r\n model.link_list.add_link(proc1, proc2)\r\n \r\n Persist.export_to_pstore(model, 'models/unittest1')\r\n end",
"def test_delete_assignment\n\n number_of_assignment = Assignment.count\n number_of_duedate = DueDate.count\n id = Assignment.first(:conditions => {:instructor_id => users(:instructor3).id}).id\n post :delete, :id => id\n assert_redirected_to :controller => 'tree_display', :action => 'list'\n assert_equal number_of_assignment-1, Assignment.count\n assert_raise(ActiveRecord::RecordNotFound){ Assignment.find(id) }\n\n end",
"def test_016\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option setup was performed\n\n assert is_checked($xpath[\"task\"][\"master_option_chk2\"])\n\n #uncheck an option setup of a directory.\n click $xpath[\"task\"][\"master_option_chk2\"]\n sleep 3\n\n #Click a directory link\n click $xpath[\"task\"][\"master_option_dir1\"]\n sleep 2\n assert !is_checked($xpath[\"task\"][\"master_option_chk3\"])\n assert !is_checked($xpath[\"task\"][\"master_option_chk4\"])\n\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_listchunk_attributes\n\t\t\n\tend",
"def test_q11_b_bc\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_b] = \"true\"\n params[:q11_b_c] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r32\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r33\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r49\"}.length, \"Incorrect rule created\"\n end",
"def test_017\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option is checked\n assert is_checked($xpath[\"task\"][\"master_option_chk2\"])\n #Click a directory link\n click $xpath[\"task\"][\"master_option_dir1\"]\n sleep 2\n #All file of directory is checked.\n\n assert is_checked($xpath[\"task\"][\"master_option_chk3\"])\n assert is_checked($xpath[\"task\"][\"master_option_chk4\"])\n\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_successful_sign_up\n# topicid = sign_up_topics(:first_topic).id\n\n # Setup the session\n# @request.session[:user] = users(:student_team_formation1)\n \n #call the sign_up_topic controller to sign up the user for topic.\n #SignUpSheetController.signup\n# get(:signup, {'assignment_id' => assignments(:assignment_team_formation).id}, {'confirm_by' => 0}, {'id' => topicid}) \n \n #This should pass fine as the student is paired with student_team_formation2 and max required\n #students for topic is 2\n #Check for no error message\n #assert_equal flash[:error], nil\n \n #backup code\n #assert_response :redirect\n #assert_equal Assignment.count, number_of_assignment\n #assert Assignment.find(:all, :conditions => \"name = 'updatedAssignment9'\")\n end",
"def test_single_user_should_update_test_results_under_c1\n test_target_instance = get_new_test_target_instance(\"example3\", \"2012112803\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1', 'test_case_2')\n\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_FAIL, 'test_case_1', 'test_case_2')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 2, 3, 2)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_2', 2, 3, 2)\n end",
"def set_assignment\n @assignment = Assignment.find_by(number: params[:assignment_number])\n end",
"def testNominal\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_SingleDummyGem ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def test_review_type_role_assignment\n\n # Verify response when not logged in.\n get :review_type_role_assignment, {},{}\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n\n # Verify response when logged in as a non-admin\n get :review_type_role_assignment, {}, rich_designer_session\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Verify response when logged in as an admin\n get :review_type_role_assignment, {}, cathy_admin_session\n assert_response :success\n\n roles = assigns(roles)['roles']\n review_types = assigns(review_types)['review_types']\n\n assert_equal(@expected_values.size, roles.size)\n assert_equal(5, review_types.size)\n\n roles.each_with_index { |role, i|\n expected_role = @expected_values[i]\n assert_equal(expected_role[:name], role.name)\n\n review_types = role.review_types.sort_by { |rt| rt.name }\n review_types.each_with_index { |rt, j|\n expected_name = expected_role[:review_types][j]\n assert_equal(expected_role[:name]+'::'+expected_name.to_s,\n role.name+'::'+rt.name)\n }\n\n }\n\n expected_values = [\n {:name => 'Final',\n :role_names => ['CE-DFT', 'DFM', 'HWENG',\n 'Mechanical', 'Mechanical-MFG', 'PCB Design',\n 'Planning', 'TDE', 'Valor'] },\n {:name => 'Pre-Artwork',\n :role_names => ['CE-DFT', 'DFM', 'HWENG', \n 'Library', 'Mechanical', 'Mechanical-MFG',\n 'PCB Input Gate', 'PCB Mechanical', 'Planning',\n 'SLM BOM', 'SLM-Vendor', 'TDE',\n 'Valor' ]},\n {:name => 'Placement',\n :role_names => ['CE-DFT', 'DFM', 'HWENG',\n 'Mechanical', 'Mechanical-MFG', 'TDE' ]},\n {:name => 'Routing',\n :role_names => ['CE-DFT', 'DFM', 'HWENG',\n 'Library', 'Mechanical-MFG' ]},\n {:name => 'Release',\n :role_names => ['HWENG', 'Operations Manager',\n 'PCB Design' ]},\n ]\n\n review_types.each_with_index do |review_type, i|\n expected_rt = expected_values[i]\n assert_equal(expected_rt[:name], review_type.name)\n\n review_type.roles.sort_by { |role| role.name }.each_with_index do |role, j|\n expected_role = expected_rt[:role_names]\n expected_name = expected_role[j]\n assert_equal(expected_name, role.name)\n end\n end\n\n end",
"def test_VerifyQuestionSetJobBoard\n randomName = SecureRandom.hex(4)\n randomReq = \"0\" + SecureRandom.hex(4)\n \n randomEmail = SecureRandom.hex(4) \n randomLastName = SecureRandom.hex(4)\n \n #PRECONDITION: Must be logged in\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n home_url = $browser.current_url\n \n #PRECONDITION: Must have a Question Set created, with Questions already created, some with Optional = true some not, some with Text= true, some not and combined.\n self.CreateQuestionSetWithQuestions(randomName)\n \n #Create Job with Question Set asociated\n Common.goToTab(HomePage::REQUISITIONS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH).displayed?\n }\n Common.click_and_load(RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH) \n $wait.until{\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH).displayed?\n }\n Common.click_and_load(RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH) \n $wait.until{\n $browser.find_element(:id => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_ID).displayed?\n }\n $browser.find_element(:id => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_ID).send_keys randomReq\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_PRIMARY_RECRUITER_TEXT_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_PRIMARY_RECRUITER_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_LOCATION_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_LOCATION_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_DEPARTAMENT_OPTION_XPATH).click\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MIN_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MIN_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MAX_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MAX_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH).send_keys randomName\n unless $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).click\n end\n \n Common.click_and_load(RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_SAVE_XPATH)\n \n #JobBoard without login\n CustomSettings.JobBoardLogin(false)\n \n Common.goToTab(HomePage::BOARD_SETUP_TAB_LINK_XPATH)\n Common.displayed(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.click_and_load(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n CustomSettings.BoardSetupInit\n CustomSettings.ResumeRequired(false)\n CustomSettings.DefineEEOQuestions(false, false, false, false, false)\n \n # 1 - Apply to a job from the job board site, with Question Set asociated.\n $browser.get(HomePage::JOB_BOARD_URL)\n $wait.until{\n $browser.find_element(:xpath => JobBoardHomePage::JOB_BOARD_JOB_LIST_XPATH).displayed?\n }\n Common.click_and_load(JobBoardHomePage::JOB_BOARD_JOB_LIST_XPATH + \"//*[text()[contains(.,'\" + randomReq + \"')]]\") \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH).displayed?\n }\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH) \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).displayed?\n }\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).send_keys randomEmail + Users::EMAIL_DOMAIN\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_FIRST_NAME_XPATH).send_keys randomEmail\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LAST_NAME_XPATH).send_keys randomLastName\n \n #If How did you hear about us? is displayed\n begin\n aboutUsSelect = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).displayed?\n rescue\n aboutUsSelect = false\n end \n if aboutUsSelect\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).send_keys \"Job Board\"\n end\n \n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH) \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH)\n end\n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH)\n end\n \n # 2 - Verify that questions are shown correctly\n # Question 1 must be required and no text\n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_1_XPATH).displayed?\n }\n assert $wait.until {\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_1_XPATH + \"//*[@class='atsRequired']\")\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_1_INPUT_XPATH + \"//select\")\n }\n \n # Question 2 must be optional and no text\n assert $wait.until {\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_2_XPATH)\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_2_INPUT_XPATH + \"//select\")\n }\n \n # Question 3 must be optional and text\n assert $wait.until {\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_3_XPATH)\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_3_INPUT_XPATH + \"//textarea\")\n }\n \n # Question 4 must be required and text\n assert $wait.until {\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_4_XPATH + \"//*[@class='atsRequired']\")\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_4_INPUT_XPATH + \"//textarea\")\n }\n # 3 - Answer questions\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_1_INPUT_XPATH + \"//select\").send_keys \"YES\"\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_2_INPUT_XPATH + \"//select\").send_keys \"YES\"\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_3_INPUT_XPATH + \"//textarea\").send_keys \"YES\"\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_QUESTION_4_INPUT_XPATH + \"//textarea\").send_keys \"YES\"\n \n # 4 - Click on Submit\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_QUESTIONS_SET_BTN_SUBMIT_XPATH)\n \n #RESULTS\n $browser.get(home_url)\n Common.goToTab(HomePage::QUESTION_SETS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH).displayed?\n }\n Common.click_and_load(QuestionSetsHomePage::QUESTION_SET_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\") \n \n $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH).displayed?\n }\n assert $wait.until { \n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SET_DETAIL_PRESCREENS_FIRST_XPATH).displayed?\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SET_DETAIL_PRESCREENS_SECOND_XPATH).displayed?\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SET_DETAIL_PRESCREENS_THIRD_XPATH).displayed?\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SET_DETAIL_PRESCREENS_FOURTH_XPATH).displayed?\n }\n Common.click_and_load(QuestionSetsDetail::QUESTION_SET_DETAIL_PRESCREENS_FIRST_APPLICATION_XPATH)\n $wait.until{\n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_PRESCREEN_1_XPATH).displayed?\n }\n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_JOB_TEXT_XPATH + \"[//*[text()[contains(.,'\" + randomReq + \"')]]]\").displayed?\n assert $wait.until { \n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_PRESCREEN_1_XPATH).displayed?\n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_PRESCREEN_2_XPATH).displayed?\n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_PRESCREEN_3_XPATH).displayed?\n $browser.find_element(:xpath => ApplicationsDetailPage::APPLICATIONS_DETAIL_PRESCREEN_4_XPATH).displayed?\n }\n \n end",
"def test_q11_b_all\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n params[:q11_b_a] = \"true\"\n params[:q11_b_b] = \"true\"\n params[:q11_b_c] = \"true\"\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r31\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r32\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r33\"}.length, \"Incorrect rule created\"\n end",
"def testNominalWithSeveralRN\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_SingleDummyGemWithSeveralRN ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ],\n Actions::File_UploadReleaseNote => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/ReleaseNotes/DummyGemReleaseNote.html\"), 'html', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ],\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/ReleaseNotes/DummyGemReleaseNote.txt\"), 'txt', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end",
"def test_product_status\n product = Product.new(vendor: @vendor, name: 'my product', c1_test: true, measure_ids: ['BE65090C-EB1F-11E7-8C3F-9A214CF093AE'], bundle_id: @bundle.id)\n product.save!\n product_test = product.product_tests.build({ name: 'my product test 1', measure_ids: ['BE65090C-EB1F-11E7-8C3F-9A214CF093AE'] }, MeasureTest)\n product_test.save!\n # status should be incomplete if all product tests passing but no checklist test exists\n product_test.tasks.first.test_executions.create!(state: :passed, user: @vendor_user)\n assert_equal 'incomplete', product.status\n\n # if product does not need to certify for c1, than product should pass\n product.update(c1_test: nil, c2_test: true)\n assert_equal 'passing', product.status\n product.update(c1_test: true, c2_test: nil)\n\n # adding a complete checklist test will make product pass\n create_complete_checklist_test_for_product(product, product.measure_ids.first)\n assert_equal 'passing', product.status\n\n # one failing product test will fail the product\n product_test = product.product_tests.build({ name: 'my product test 2', measure_ids: ['BE65090C-EB1F-11E7-8C3F-9A214CF093AE'] }, MeasureTest)\n product_test.save!\n te = product_test.tasks.first.test_executions.build(state: :failed)\n @vendor_user.test_executions << te\n te.save!\n assert_equal 'failing', product.status\n end",
"def create\n @assignment = @course.assignments.new(params[:assignment])\n @assignment.save\n @outline = Outline.where(\"course_id = ?\", @course.id).all\n @outline.empty? ? i = 1 : i = @outline.sort_by {|x| x.order_number}.last.order_number += 1\n @content = Outline.new(:course_id => @course.id, :content_type => 'Assignment', :order_number => i, :content_id => @assignment.id)\n @content.save\n @users = User.enrolled(@course)\n @users.each do |u|\n @enrollment = Enrollment.where(:user_id => u.id, :course_id => @course.id).first\n Homework.create(:enrollment_id => @enrollment.id, :assignment_id => @assignment.id, :user_id => u.id)\n end\n \n respond_to do |format|\n if @assignment.save\n format.html { redirect_to edit_course_path(@course), notice: 'Assignment was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def test_003\n\n # login\n login\n @@pu = 1\n @@pj = 1\n open\"/devgroup/pj_index/#{@@pu}/#{@@pj}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu}/#{@@pj}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # select uploading method in the master tab\n assert is_text_present(_(\"Select a master\"))\n assert is_text_present(_(\"Master\"))\n assert is_text_present(_(\"Select the upload method of individual analysis files\"))\n assert is_text_present(_(\"Upload of individual analysis files\"))\n\n #Select \"uploading a file individually\"\n click \"file_upload_upload_way_upload_each\"\n assert is_text_present(_(\"Uploaded individually.\"))\n #Click button Read tree\n click $xpath[\"task\"][\"read_tree\"]\n assert !60.times{ break if (is_text_present(_(\"Directory structure\")) rescue false); sleep 2 }\n #It will return, if a check is returned for uploading collectively (F2-003)\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # logout\n logout\n\n end",
"def test_courses_assignments_are_ordered_by_due_at_then_active_at\n assignment = Assignment.new(name: \"Battleship\", percent_of_grade: 10, due_at: \"2016-09-15\", active_at: \"2016-09-01\")\n assignment_two = Assignment.new(name: \"Currency\", percent_of_grade: 10, due_at: \"2016-09-05\", active_at: \"2016-09-01\")\n assignment_three = Assignment.new(name: \"Time entry\", percent_of_grade: 10, due_at: \"2016-09-15\", active_at: \"2016-08-01\")\n\n course = Course.create(name: \"Ruby on Rails\", course_code: \"ROR600\", color: \"Violet\")\n\n course.assignments << assignment\n course.assignments << assignment_two\n course.assignments << assignment_three\n\n assert_equal 3, course.assignments.count\n\n assert_equal [assignment_two, assignment_three, assignment], course.assignments.to_a\n end",
"def test_013\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n\n #Get window id\n window_id = get_attribute(\"//body/div[2]\", \"id\")\n window_id =~ /.*?id=(\\d+).*?/\n\n #Maximize window\n click window_id + \"_maximize\"\n\n sleep 3\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_sources_tc958 #20 \n # Refering candidate with tracking source, new candidate, Clear Source Tracking for Internal Referrals\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n # Preconditions\n Common.goToTab(HomePage::BOARD_SETUP_TAB_LINK_XPATH)\n Common.displayed(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.click_and_load(BoardSetupHomePage::INTERNAL_LINK_LIST_XPATH)\n Common.displayed(BoardSetupDetailPage::BOARD_DETAIL_EDIT_BUTTON_XPATH)\n test = [\n {\"displayed\" => BoardSetupDetailPage::BOARD_DETAIL_EDIT_BUTTON_XPATH},\n {\"click\" => BoardSetupDetailPage::BOARD_DETAIL_EDIT_BUTTON_XPATH},\n \n {\"displayed\" => BoardSetupEditPage::BOARD_EDIT_APPLY_REFERRAL_IMMEDIATELY_XPATH},\n {\"checked\" => BoardSetupEditPage::BOARD_EDIT_APPLY_REFERRAL_IMMEDIATELY_XPATH},\n {\"set_text\" => BoardSetupEditPage::BOARD_EDIT_SOURCE_TRACKING_FOR_INTERNAL_REFERRAL_XPATH, \"text\" => \" \"},\n \n {\"click\" => BoardSetupEditPage::BOARD_EDIT_SAVE_BUTTON_XPATH},\n ]\n Common.main(test)\n \n $browser.get HomePage::JOB_BOARD_INTERNAL_URL\n test = [\n {\"check_apply\" => \"\"},\n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_REFER_CANDIDATE_XPATH},\n {\"click\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_REFER_CANDIDATE_XPATH},\n \n {\"displayed\" => JobBoardJobDetail::JOB_BOARD_APPLY_REFERRER_EMAIL_XPATH},\n {\"set_text\" => JobBoardJobDetail::JOB_BOARD_APPLY_REFERRER_EMAIL_XPATH, \"text\" => Users::JOB_BOARD_USER_TEXT},\n {\"click\" => JobBoardJobDetail::JOB_BOARD_CONTINUE_BUTTON_XPATH},\n \n {\"displayed\" => JobBoardJobDetail::PROSPECT_FIRST_NAME_XPATH},\n {\"set_text\" => JobBoardJobDetail::PROSPECT_FIRST_NAME_XPATH, \"text\" => \"a\"},\n {\"set_text\" => JobBoardJobDetail::PROSPECT_LAST_NAME_XPATH, \"text\" => \"b\"},\n {\"set_text\" => JobBoardJobDetail::PROSPECT_EMAIL, \"text\" => \"matiast@oktana.io\"},\n {\"click\" => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_SUBMIT_XPATH},\n {\"displayed\" => JobBoardJobDetail::THANK_YOU_REFERRAL_MESSAGE_XPATH}\n ]\n Common.main(test)\n \n assert $browser.find_element(:xpath, JobBoardJobDetail::THANK_YOU_REFERRAL_MESSAGE_XPATH).displayed?\n \n end",
"def test_019\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n\n #Click link M of a directory\n click $xpath[\"task\"][\"m_link\"]\n sleep 2\n\n #The name of the directory which pushed [M] goes into the field of right-hand side make_root.\n assert_equal \"sample_c/\", get_value( $xpath[\"task\"][\"make_root_link\"])\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def update_result_in_test_rail(test_rail_url, user_name, access_key, run_id, hash_case_id)\n\n begin\n # hash of mapping case id to id as per the test rail\n hash_test_mapping = Hash.new\n b_flag = true\n\n if test_rail_url.to_s.strip.empty? or user_name.to_s.strip.empty? or access_key.to_s.strip.empty? or run_id.to_s.strip.empty?\n puts 'Specified parameters is not correct, please re-check !'\n puts 'Specified Test Rail URL : ' + test_rail_url\n puts 'Specified Test Rail User Name : ' + user_name\n puts 'Specified Test Rail Access Key : ' + access_key\n puts 'Specified Test Rail Run Id : ' + run_id\n else\n # creating connection with test rail api\n obj_test_rail = TestRail::APIClient.new(test_rail_url)\n obj_test_rail.user = user_name\n obj_test_rail.password = access_key\n get_tests_uri = 'get_tests/' + run_id.to_s\n\n get_response = obj_test_rail.send_get(get_tests_uri)\n response_size = get_response.size\n i_count = 0\n\n while i_count < response_size do\n case_id = get_response[i_count.to_i]['case_id']\n id = get_response[i_count.to_i]['id']\n hash_test_mapping[case_id] = id\n i_count = i_count + 1\n end\n\n if hash_test_mapping.empty?\n puts 'No entry retrieved from Test Rail for Test Rail Run ID : ' + run_id.to_s\n else\n # specify the result array\n result = []\n\n hash_test_mapping.each do |key,value|\n case_id = 'C' + key.to_s\n if hash_case_id.has_key?case_id\n status = hash_case_id[case_id]\n if status.downcase == 'pass'\n result << {\"test_id\": \"#{hash_test_mapping[key]}\", \"status_id\": 1}\n elsif status.downcase == 'fail'\n result << {\"test_id\": \"#{hash_test_mapping[key]}\", \"status_id\": 5}\n end\n end\n end\n\n result_string = {\"results\": JSON.parse(result.to_json)}\n result_string = JSON.parse(result_string.to_json)\n\n if result_string['results'].size > 0\n add_results_uri = 'add_results/' + run_id.to_s\n obj_test_rail.send_post(add_results_uri, result_string)\n else\n puts 'No result found to upload in Test Rail'\n end\n end\n end\n rescue Exception => e\n b_flag = false\n puts 'Error Occured In Uploading The results in Test Rail, Error is : ' + e.message\n ensure\n return b_flag\n end\nend",
"def test_015\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option setup was performed\n\n assert is_checked($xpath[\"task\"][\"master_option_chk1\"])\n\n #uncheck an option setup\n click $xpath[\"task\"][\"master_option_chk1\"]\n\n\n #Get window id\n window_id = get_attribute(\"//body/div[2]\", \"id\")\n window_id =~ /.*?id=(\\d+).*?/\n\n #Close window\n click window_id + \"_close\"\n\n sleep 3\n #Open popup set again\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #the information set remains\n assert is_checked($xpath[\"task\"][\"master_option_chk1\"])\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def assignment_params\n params.require(:assignment).permit(:number)\n end",
"def test_create_task\n login\n sleep 20\n @driver.find_element(:xpath, \".//*[@id='main-nav']/li[9]/a/i\").click\n sleep 5 \n @driver.find_element(:xpath, \"//input[@ng-model='model.bindable']\").click \n sleep 2\n time = get_Present\n task_Name = \"task for \"+time\n @driver.find_element(:xpath, \"//input[@placeholder='Type your task here...']\").send_keys task_Name\n @driver.find_element(:xpath, \"//div[@placeholder='Task description...']\").send_keys \"Test selenium description for task\"\n sleep 2\n # Due date selection for task\n @driver.find_element(:xpath, \".//*[@id='main-section']/div/div/div[2]/vox-task-form/div/form/div[3]/div[1]/date-picker/div/div/div/span\").click\n sleep 2\n @driver.find_element(:xpath, \"//button[@class='picker__button--today']\").click\n sleep 2\n assignto = \"//select[@name='assignedToId']\"\n assignto_index = \"2\"\n getSelect_by_index(assignto,assignto_index)\n sleep 2\n category = \"//select[@name='taskTypeId']\"\n category_index = \"2\"\n getSelect_by_index(category,category_index)\n sleep 2\n @driver.find_element(:xpath, \"//button[@class='submit-button button']\").send_keys :enter \n sleep 2\n puts \"Created \"+task_Name\n sleep 5 \n end",
"def test_performs_and_returns_hash\n expected = {\n id: \"36692321\",\n type: \"evaluated-data-point\",\n attributes: {\n title: \"Total Population\",\n modifier: \"total\",\n aggregator: \"sum_and_moe\",\n value: 2616.0,\n margin: 134.54,\n units: \"residents\"\n }\n }\n assert_equal expected, evaluation.perform\n end",
"def test_q11_b_none\n test_agreement = create_test_agreement\n params = HashWithIndifferentAccess.new\n params[:q11] = 'b'\n\n form_processor = Maps.new\n form_processor.process_question(test_agreement.agreementid.to_i, '11', params, 'UNIT_TESTING')\n\n permissions = test_agreement.active_permissions\n\n # Check Permissions created\n assert_equal 3, permissions.length, \"Incorrect number of permissions created\"\n assert_equal 3, form_processor.permission_count, \"Incorrect count of permissions on form processor\"\n\n #Check Permissions match rules\n assert_equal 1, permissions.select{|p| p.rule==\"r49\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r50\"}.length, \"Incorrect rule created\"\n assert_equal 1, permissions.select{|p| p.rule==\"r51\"}.length, \"Incorrect rule created\"\n end",
"def test_03assignLeave\n $objLoginPage.clickOnAssignLeave()\n $objLoginPage.enterEmpName(\"Linda Anderson\")\n $objLoginPage.selectLeaveType(\"Vacation US\")\n $objLoginPage.leaveFromDt(\"2019-03-15\")\n $objLoginPage.leaveToDt(\"2019-03-16\")\n $objLoginPage.enterComments(\"No comments\")\n puts \"Everything entered\"\n $objLoginPage.clickOnAssignBtn()\n assert_equal(\"OrangeHRM - Confirm Leave Assignment\", $objLoginPage.verifyConfirmationPopUpAndHeader(), \"Incorrect header found\")\n sleep 5\n $objLoginPage.clickLeaveList()\n sleep 5\n end",
"def requires_assignment\n _assign if !@_assigned\n end",
"def test_NewQuestionOptional \n randomName = SecureRandom.hex(4)\n randomReq = SecureRandom.hex(4)\n \n randomEmail = SecureRandom.hex(4) \n randomLastName = SecureRandom.hex(4)\n \n #PRECONDITION: Must be logged in\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n \n #Create an empty Question Sets\n self.CreateQuestionSetEmpty(randomName)\n \n #Create Job with Question Set asociated\n Common.goToTab(HomePage::REQUISITIONS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => RequisitionsHomePage::REQUISITIONS_PAGE_FIRST_ENTRY_LIST_TITLE_XPATH).displayed?\n }\n Common.click_and_load(RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH)\n $wait.until{\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH).displayed?\n }\n Common.click_and_load(RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_CONTINUE_XPATH) \n $wait.until{\n $browser.find_element(:id => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_ID).displayed?\n }\n $browser.find_element(:id => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_ID).send_keys randomReq\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_PRIMARY_RECRUITER_TEXT_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_PRIMARY_RECRUITER_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_LOCATION_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_LOCATION_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_DEPARTAMENT_OPTION_XPATH).click\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MIN_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MIN_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_MAX_SALARY_XPATH).send_keys RequisitionsNewAndEdit::REQUISITIONS_NEW_DATA_MAX_SALARY_TEXT\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_QUESTIONS_SET_XPATH).send_keys randomName\n \n unless $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => RequisitionsNewAndEdit::REQUISITIONS_NEW_POST_JOB_BOX_XPATH).click\n end\n \n Common.click_and_load(RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_SAVE_XPATH)\n Common.displayed(RequisitionsDetail::REQUISITIONS_DETAIL_NAME_XPATH)\n \n # 1 - Click on Tab \"Question Sets\"\n Common.goToTab(HomePage::QUESTION_SETS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH).displayed?\n }\n \n # 2 - Click on previously created Question Set's name from the list\n Common.click_and_load(QuestionSetsHomePage::QUESTION_SET_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\")\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH).displayed? \n }\n \n # 3 - Click on \"New Question\"\n Common.click_and_load(QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).displayed?\n }\n \n # 4 - Fill all the fields\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_INT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_QUESTION_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH\n\n # 5 - Check \"Optional\" box\n unless $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_OPTIONAL_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_OPTIONAL_XPATH).click\n end\n \n # 6 - Click on \"Save\"\n Common.click_and_load(QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_BTN_SAVE_XPATH)\n \n $wait.until{\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_NEW_ANSWER_XPATH).displayed?\n }\n \n #RESULTS\n # 6 - You will be redirected to the \"Question\" page.\n assert $wait.until {\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_QUESTION_NAME_XPATH + \"//*[text()[contains(.,'\" + QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH + \"')]]\").displayed?\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_OPTIONAL_XPATH + \"//*[@title='Checked']\").displayed?\n }\n \n \n # 7 - Click on Tab \"Question Sets\"\n Common.goToTab(HomePage::QUESTION_SETS_LINK_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsHomePage::QUESTION_SETS_HOME_BTN_NEW_XPATH).displayed?\n }\n \n # 8 - Click on previously created Question Set's name from the list\n $browser.find_element(:xpath => QuestionSetsHomePage::QUESTION_SET_LIST_XPATH + \"//*[text()[contains(.,'\" + randomName + \"')]]\").click\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH).displayed? \n }\n \n # 9 - Click on \"New Question\"\n Common.click_and_load(QuestionSetsDetail::QUESTION_SETS_DETAIL_NEW_QUESTION_XPATH)\n $wait.until{\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).displayed?\n }\n \n # 10 - Fill all the fields\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_2_TEXT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_ORDER_2_INT_XPATH\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_QUESTION_XPATH).send_keys QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_2_TEXT_XPATH\n\n # 11 - Uncheck \"Optional\" box\n if $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_OPTIONAL_XPATH).attribute(\"checked\")\n $browser.find_element(:xpath => QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_OPTIONAL_XPATH).click\n end\n \n # 12 - Click on \"Save\"\n Common.click_and_load(QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_BTN_SAVE_XPATH)\n \n $wait.until{\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_QUESTION_NAME_XPATH).displayed?\n } \n \n #RESULTS\n # 12 - You will be redirected to the \"Question\" page.\n assert $wait.until{\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_QUESTION_NAME_XPATH + \"//*[text()[contains(.,'\" + QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_2_TEXT_XPATH + \"')]]\").displayed?\n $browser.find_element(:xpath => QuestionDetailPage::QUESTION_DETAIL_OPTIONAL_XPATH + \"//*[@title='Not Checked']\").displayed? \n }\n #JobBoard without login\n CustomSettings.JobBoardLogin(false)\n \n Common.goToTab(HomePage::BOARD_SETUP_TAB_LINK_XPATH)\n Common.displayed(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n Common.click_and_load(BoardSetupHomePage::CAREERS_LINK_LIST_XPATH)\n CustomSettings.BoardSetupInit\n CustomSettings.ResumeRequired(false)\n CustomSettings.DefineEEOQuestions(false, false, false, false, false)\n \n # 13 - Apply to a job from the job board site, with Question Set asociated.\n $browser.get(HomePage::JOB_BOARD_URL)\n $wait.until{\n $browser.find_element(:xpath => JobBoardHomePage::JOB_BOARD_RETURN_TO_SEARCH_XPATH).displayed?\n }\n Common.click_and_load(JobBoardHomePage::JOB_BOARD_JOB_LIST_XPATH + \"//*[text()[contains(.,'\" + randomReq + \"')]]\") \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH).displayed?\n }\n \n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LINK_XPATH) \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).displayed?\n }\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_EMAIL_XPATH).send_keys randomEmail + Users::EMAIL_DOMAIN\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_FIRST_NAME_XPATH).send_keys randomEmail\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_LAST_NAME_XPATH).send_keys randomLastName\n \n #If How did you hear about us? is displayed\n begin\n aboutUsSelect = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).displayed?\n rescue\n aboutUsSelect = false\n end \n if aboutUsSelect\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_HEAR_ABOUT_US_XPATH).send_keys \"Job Board\"\n end\n \n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH) \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH) \n end\n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_RETURN_JOBSEARCH_XPATH).displayed?\n }\n begin\n continue_button = $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH).displayed?\n rescue\n continue_button = false\n end \n if continue_button\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_CONTINUE_XPATH) \n end\n \n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_SUBMIT_XPATH).displayed?\n }\n \n #14 - Verify that questions from question set are shown correctly, check their order.\n Common.click_and_load(JobBoardJobDetail::JOB_BOARD_APPLY_JOB_SUBMIT_XPATH)\n $wait.until{\n $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_ERROR_BLOCK_XPATH).displayed?\n }\n assert_match QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_2_TEXT_XPATH, $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_ERROR_BLOCK_XPATH).text\n \n #Check order\n assert_match QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_TEXT_XPATH, $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_QUESTION_NAME_1_XPATH).text\n assert_match QuestionSetsNewQuestion::QUESTION_SETS_NEW_QUESTION_NAME_2_TEXT_XPATH, $browser.find_element(:xpath => JobBoardJobDetail::JOB_BOARD_APPLY_JOB_QUESTION_NAME_2_XPATH).text\n \n end",
"def create\n @assignment = Assignment.new\n @assignment.build_assignment_stat\n @assignment.build_submission_rule\n @assignment.transaction do\n begin\n @assignment, new_required_files = process_assignment_form(@assignment)\n @assignment.token_start_date = @assignment.due_date\n @assignment.token_period = 1\n rescue Exception, RuntimeError => e\n @assignment.errors.add(:base, e.message)\n new_required_files = false\n end\n unless @assignment.save\n @assignments = Assignment.all\n @sections = Section.all\n @clone_assignments = Assignment.where(vcs_submit: true)\n .order(:id)\n render :new\n return\n end\n if params[:persist_groups_assignment]\n clone_warnings = @assignment.clone_groupings_from(params[:persist_groups_assignment])\n unless clone_warnings.empty?\n clone_warnings.each { |w| flash_message(:warning, w) }\n end\n end\n if @assignment.save\n flash_message(:success, I18n.t('assignment.create_success'))\n end\n if new_required_files && !MarkusConfigurator.markus_config_repository_hooks.empty?\n # update list of required files in all repos only if there is a hook that will use that list\n UpdateRepoRequiredFilesJob.perform_later(current_user)\n end\n end\n redirect_to action: 'edit', id: @assignment.id\n end"
] |
[
"0.67055166",
"0.61792755",
"0.60794455",
"0.59472847",
"0.58578086",
"0.58466375",
"0.57890767",
"0.5770384",
"0.5729329",
"0.5682453",
"0.5673812",
"0.5661049",
"0.56528574",
"0.563056",
"0.5623086",
"0.5607764",
"0.5607616",
"0.55951285",
"0.5565419",
"0.55369407",
"0.55277777",
"0.5526886",
"0.5523312",
"0.54977363",
"0.5496038",
"0.54950905",
"0.5491792",
"0.5486552",
"0.54860663",
"0.54817",
"0.54809386",
"0.5480671",
"0.54795355",
"0.54748225",
"0.5468802",
"0.54513276",
"0.5448945",
"0.54489285",
"0.54476446",
"0.5447",
"0.54444855",
"0.5425598",
"0.54160666",
"0.54117894",
"0.5409231",
"0.54032475",
"0.5399949",
"0.5397773",
"0.5391709",
"0.53865063",
"0.5384932",
"0.538109",
"0.5377317",
"0.5362183",
"0.5361406",
"0.5360869",
"0.53587544",
"0.5347504",
"0.5338411",
"0.53347313",
"0.5333332",
"0.53322834",
"0.53289646",
"0.53132653",
"0.5290359",
"0.5283195",
"0.52829385",
"0.5274506",
"0.5269878",
"0.52632445",
"0.52596575",
"0.5257448",
"0.5251533",
"0.52487946",
"0.52424896",
"0.5234478",
"0.52329856",
"0.5222273",
"0.521367",
"0.5210873",
"0.52017313",
"0.51975036",
"0.5192004",
"0.5191476",
"0.51909417",
"0.5175758",
"0.5175023",
"0.517356",
"0.51726",
"0.5168281",
"0.51602644",
"0.5158084",
"0.5143384",
"0.51413906",
"0.5136882",
"0.5132144",
"0.5129781",
"0.5127001",
"0.5112358",
"0.5109955"
] |
0.65888274
|
1
|
test_report_card_list Description: This method does the functional testing of the report card list view.
|
def test_report_card_list
get(:report_card_list,
{ :id => @board_prep.id, :design_id => @mx234a.id },
scott_designer_session)
assert_equal(@mx234a.id, assigns(:design).id)
assert_equal(@board_prep.id, assigns(:category).id)
assert_nil(assigns(:assignments_list))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_deck_has_cards\n assert_equal [@card_1, @card_2, @card_3], @deck.cards\n end",
"def cardlist\n if params.has_key?(:nocache) || !flash.empty? || stale?(:last_modified => @cardset.last_edit_log.updated_at, :etag => \"cardset_#{@cardset.id}_cardlist\")\n respond_to do |format|\n format.html # cardlist.html.erb\n format.xml { render :xml => @cardset.cards } # ??\n format.text { render }\n format.csv { render }\n end\n end\n end",
"def has_card? test_card\r\n @card_list.has_card? test_card\r\n end",
"def test_display_list\n\n checklist_1_0 = checklists(:checklist_1_0)\n\n checklist = { :id => checklist_1_0.id }\n review = { :review_type => 'full_review' }\n \n get(:display_list,\n { :checklist => checklist, :review => review},\n cathy_admin_session)\n assert_equal(checklist_1_0.id, assigns(:checklist).id)\n assert_equal(2, assigns(:sections).size)\n assert_equal('full_review', assigns(:review_type))\n\n end",
"def display_deck\n @deck_array.each do |x|\n x.display_card\n end\n end",
"def display_card\t\n\n\t\trows=[]\n\n\t\ttable=Terminal::Table.new\n\t\ttable.title=\"Your Shoping Card List\"\n\t\ttable.headings=[\"Product Id\",\"Product Name\",\"Product price\",\"Product quantity\",\"Total\"]\n#fetch recorde and multiplication of price and qauntity from inline_products and products\n\t\tstatement5=@connection.prepare(\"select i.p_id,p.p_name,p.p_price,i.quantity,\n\t\t\t(p.p_price*i.quantity) from inline_products i,products p where i.card_no=? and p.p_id=i.p_id\")\n\t\tstatement5.execute(@card_no)\n\t\t\n\t\twhile recordset3=statement5.fetch do\n\n\t\t\trows<<[recordset3[0],recordset3[1],recordset3[2],recordset3[3],recordset3[4]]\n\t\tend\n\n\t\ttable.rows=rows\n\t\tputs \"\\n#{table}\"\n#call add_edit_delete_confirm_card method\n\t\tadd_edit_delete_confirm_card\n\tend",
"def has_card? test_card \n @card_list.has_card? test_card\n end",
"def test_deck_card_counts\n print \"\\nOriginal Deck:\\n#{@deck.to_s}\\n\"\n assert_equal(52, @cards.length, \"Num Cards\")\n end",
"def set_report_card\n @report_card = ReportCard.find(params[:id])\n end",
"def test_it_has_cards\n assert_equal [@card_generator.cards[0], @card_generator.cards[1], @card_generator.cards[2], @card_generator.cards[3]], @card_generator.cards\n end",
"def edit_qc_inspection_test_from_test_list\n edit_qc_inspection_test true\n end",
"def test_draw_several_cards\n cards = @deck.draw(4)\n assert_equal(48, @deck.count)\n assert_equal(4, cards.length)\n end",
"def test_card_data_to_csv_row_array\n overviews_helper = OverviewsHelper.new()\n assert_equal(@card_csv_row_array_no_products, overviews_helper.card_data_to_csv_row_array(@card_data_no_products))\n end",
"def test_card_data_to_csv_row_array\n overviews_helper = OverviewsHelper.new()\n assert_equal(@card_csv_row_array_no_products, overviews_helper.card_data_to_csv_row_array(@card_data_no_products))\n end",
"def test_display\n assert_equal nil, @disc.display\n end",
"def test_successful_authorize_stored_card_metadata\n test_successful_purchase_credit_card_metadata(false, true, true)\n end",
"def get_cards(deck)\n\n end",
"def test_draw_one_card\n cards = @deck.draw\n assert_equal(51, @deck.count)\n assert_equal(1, cards.length)\n end",
"def test_list\n get :list\n assert_response :success\n assert_template 'list'\n assert_equal assigns(:title), \"Customer List\"\n assert_not_nil assigns(:customers)\n end",
"def show\n @cards = Card.where(:duelist_id == @duelist.id)\n end",
"def create_52_card_deck\n\n end",
"def test_initial_card_count \n assert_equal(52, @deck.count)\n assert_equal(52, @deck.cards.length)\n end",
"def test_successful_authorize_credit_card_metadata\n test_successful_purchase_credit_card_metadata(false, true, false)\n end",
"def test_index\n get :index\n assert_response :success\n assert_template 'index'\n\n assert_not_nil assigns(:pairs)\n\n assert_select 'div#currencies-pairs-list' do\n #security: valid count checks also that other user currencies are not included\n assert_select 'li', :count => 6 # 3 + 2 + 1 possible exchanges between currencies\n @currencies.each do |currency|\n assert_select 'li', :text => Regexp.new(currency.long_symbol), :count => 3 # each currency can be exchanged to 3 other currencies\n end\n #security:\n assert_select 'li', :text => Regexp.new(@bad.long_symbol), :count => 0\n end\n end",
"def create_card_list(deck, create_mode)\n\t#create_mode:[full, except_price, from_file]\n\t#if create_mode is \"full\", the contents of each card are\n\t\t#card_type,\n\t\t#name,\n\t\t#quantity,\n\t\t#price, <-very slow!\n\t\t#store_url,\n\t\t#price.date,\n\t#if create_mode is \"except_price\", the contents of each card are\n\t\t#card_type,\n\t\t#name,\n\t\t#quantity,\n\t\t#store_url,\n\t#if create_mode is \"from_file\", the contents are depend on the file(deck.path)\n\t\t@log.debug \"Hareruya.create_card_list(\" + deck.deckname.to_s + \", \" + create_mode.to_s + \") start\"\n\t\t\n\t\tif create_mode != \"full\" && create_mode != \"except_price\" && create_mode != \"from_file\" then\n\t\t\t@log.error \"create_mode ERROR. create_mode is [\" + create_mode.to_s + \"]\"\n\t\tend\n\t\t\n\t\tdeck.cards = []\n\t\tif deck.path.nil? then\n\t\t\t@log.error \"open[nil]@hareruya.create_card_list\"\n\t\tend\n\t\t@log.debug \"open[\" + deck.path + \"]\"\n\t\t@deck_row_data = open(deck.path)\n\t\t\n\t\tquantity_list=[] #Array of card quantity\n\t\tcard_type=\"land\"\n\t\tdeck.quantity_of_mainboard_cards = 0\n\t\tdeck.quantity_of_lands = 0\n\t\t@deck_row_data.each_line do |line|\n\t\t\tif line.include?('Lands</h3>') then\n\t\t\t\tcard_type = \"creature\"\n\t\t\t\tdeck.quantity_of_creatures = 0\n\t\t\tend\n\t\t\tif line.include?('Creatures</h3>') then\n\t\t\t\tcard_type = \"spell\"\n\t\t\t\tdeck.quantity_of_spells = 0\n\t\t\tend\n\t\t\tif line.include?('Spells</h3>') then\n\t\t\t\tcard_type = \"sideboardCards\"\n\t\t\t\tdeck.quantity_of_sideboard_cards = 0\n\t\t\tend\n\t\t\t\n\t\t\t#extract quantity\n\t\t\tif line.include?('decksNumber') then\n\t\t\t\tquantity = Nokogiri::HTML.parse(line, nil, @charset).text\n\t\t\t\tquantity.chomp!\n\t\t\t\tquantity_list.push quantity\n\t\t\t\t\n\t\t\t\tcase card_type\n\t\t\t\twhen \"land\"\n\t\t\t\t\tdeck.quantity_of_mainboard_cards += quantity.to_i\n\t\t\t\t\tdeck.quantity_of_lands += quantity.to_i\n\t\t\t\t\t#puts \"quantity_of_lands \" + deck.quantity_of_lands.to_s\n\t\t\t\twhen \"creature\"\n\t\t\t\t\tdeck.quantity_of_mainboard_cards += quantity.to_i\n\t\t\t\t\tdeck.quantity_of_creatures +=quantity.to_i\n\t\t\t\t\t#puts \"quantity_of_creatures \" + deck.quantity_of_creatures.to_s\n\t\t\t\twhen \"spell\"\n\t\t\t\t\tdeck.quantity_of_mainboard_cards += quantity.to_i\n\t\t\t\t\tdeck.quantity_of_spells +=quantity.to_i\n\t\t\t\t\t#puts \"quantity_of_spells \" + deck.quantity_of_spells.to_s\n\t\t\t\twhen \"sideboardCards\"\n\t\t\t\t\tdeck.quantity_of_sideboard_cards += quantity.to_i\n\t\t\t\t\t#puts \"quantity_of_sideboard_cards \" + deck.quantity_of_sideboard_cards.to_s\n\t\t\t\telse\n\t\t\t\t\t@log.error \"invalid card_type at extract quantity\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t#extract card_name and url\n\t\t\tif line.include?('data-goods') then\n\t\t\t\tcard_name = Nokogiri::HTML.parse(line, nil, @charset).text\n\t\t\t\tcard_name.chomp!\n\t\t\t\turl = \"http://www.hareruyamtg.com\" + line.split(\"\\\"\")[1]\n\t\t\t\tcard = Card.new(card_name, @log)\n\t\t\t\tcard.store_url = url\n\t\t\t\tcard.card_type = card_type\n\t\t\t\tif create_mode == \"full\" then\n\t\t\t\t\t@log.debug \"hareruya.create_card_list call #{card.name}.renew_at(card, hareruya)\"\n\t\t\t\t\tcard.price.renew_at(self)\n\t\t\t\t\t@log.debug \"renewed value is #{card.price}\"\n\t\t\t\tend\n\t\t\t\t@log.debug \"name[#{card_name}], card_type[#{card.card_type}], card.price[#card.price}]\"\n\t\t\t\tdeck.cards.push(card)\n\t\t\tend\n\t\tend\n\n\t\tfor i in 0..deck.cards.size-1\n\t\t\tdeck.cards[i].quantity = quantity_list[i]\n\t\tend\n\tend",
"def each\n @card_list.each\n end",
"def each\r\n @card_list.each\r\n end",
"def index\n @report_mockups = @survey.list_report_mockups\n end",
"def test_list\n\n # Try listing without logging in.\n get(:list, {}, {})\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n\n # Try listing from a non-Admin account.\n get(:list, {}, rich_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n checklist_count = Checklist.count\n\n get(:list, {}, cathy_admin_session)\n assert_response(200)\n assert_equal(checklist_count, assigns(:checklists).size)\n\n end",
"def test_successful_authorize_stored_card_recurring_metadata\n test_successful_purchase_credit_card_recurring_metadata(false, true, true)\n end",
"def card_list(card_id, options = {})\n card_resource(card_id, \"list\", options)\n end",
"def index\n #@cards = Card.all\n #authorize! :read, @cards\n @cards = @cards.sort_by{|e| e[:id]}\n\n if can? :read, DoorLog then\n most_active_count = 0\n runner_up_count = 0\n @most_active_card = nil\n @runner_up_card = nil\n @cards.each do |card|\n card_num_R = card.card_number.to_i(16)%32767\n card[:accesses_this_week] = DoorLog.where(\"key = ? AND data = ? AND created_at > ?\", 'G', card_num_R, DateTime.now - 1.month).order(\"created_at DESC\").group_by { |d| d.created_at.beginning_of_day }.count\n end\n @most_active_cards = @cards.sort{|a,b| b[:accesses_this_week] <=> a[:accesses_this_week]}\n @most_active_card = @most_active_cards[0]\n @runner_up_card = @most_active_cards[1]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cards }\n end\n end",
"def display\n\t\t@deck_of_cards.each.with_index do |card, i|\n\t\t\tputs \"#{i}=> #{card.display}\"\n\t\tend\n\tend",
"def index\n @report_cards = ReportCard.all\n\n # api from ecephd\n @pbphdees = Student.find(:all, :params => {:degree=> 'pb-phd-ee'})\n @pb_phd_ee_count = 0;\n\n @pmphdees = Student.find(:all, :params => {:degree=> 'pm-phd-ee'})\n @pm_phd_ee_count = 0;\n\n @pbphdces = Student.find(:all, :params => {:degree=> 'pb-phd-ce'})\n @pb_phd_ce_count = 0;\n\n @pmphdces = Student.find(:all, :params => {:degree=> 'pm-phd-ce'})\n @pm_phd_ce_count = 0;\n\n @phd_count = 0;\n\n # api from ecems\n\n @mengce = Msstudent.find(:all, :params => {:degree=> 'MEng-ce'})\n @meng_ce_count = 0;\n\n @mengee = Msstudent.find(:all, :params => {:degree=> 'MEng-ee'})\n @meng_ee_count = 0;\n\n @mengphd = Msstudent.find(:all, :params => {:degree=> 'MEng-phd'})\n @meng_phd_count = 0;\n\n @msce = Msstudent.find(:all, :params => {:degree=> 'MS-ce'})\n @ms_ce_count = 0;\n\n @msee = Msstudent.find(:all, :params => {:degree=> 'MS-ce'})\n @ms_ee_count = 0;\n\n @msphd = Msstudent.find(:all, :params => {:degree=> 'MS-phd'})\n @ms_phd_count = 0;\n\n @ms_count = 0;\n\n end",
"def test_card_length_equals_card_count \n assert_equal(@deck.cards.length, @deck.count)\n end",
"def do_test_id_card(doc)\n assert_select '#id-card' do\n assert_select '.docu-title', doc.title\n assert_select '.docu-subtitle', doc.subtitle\n assert_select '.impact', doc.impact unless doc.impact.blank?\n assert_select '.summary', :html => doc.description.strip\n assert_select('.editor a', doc.director) unless doc.director.blank?\n assert_select('.editor a[href=?]', doc.director_url) unless doc.director_url.blank?\n end\n end",
"def create\n @report_card = ReportCard.new(report_card_params)\n\n respond_to do |format|\n if @report_card.save\n format.html { redirect_to @report_card, notice: 'Report card was successfully created.' }\n format.json { render action: 'show', status: :created, location: @report_card }\n else\n format.html { render action: 'new' }\n format.json { render json: @report_card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tools_cards = ToolsCard.all\n end",
"def index\n @cards = @plan.cards\n @card = Card.new\n end",
"def test_list\n @builder.write_list('http://lancaster.myreadinglists.org/lists/4510B70F-7C50-D726-4A6C-B129F5EABB2C')\n end",
"def index\n @card_sorts = CardSort.all\n end",
"def index\n @deck_of_cards = DeckOfCard.all\n end",
"def test_list\n\n # Try editing from a non-Admin account.\n # VERIFY: The user is redirected.\n get :list, {}, rich_designer_session\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try listing from an Admin account\n # VERIFY: The platform list data is retrieved\n post(:list, { :page => 1 }, cathy_admin_session)\n assert_equal(3, assigns(:design_directories).size)\n\n end",
"def test_successful_authorize_credit_card_recurring_metadata\n test_successful_purchase_credit_card_recurring_metadata(false, true, false)\n end",
"def shuffle_list\n @cardList.shuffle!\n end",
"def user_list\n current_user_cards = current_user.cards\n if !current_user_cards || current_user_cards.size.to_i == 0\n flash[:notice] = _('You_have_no_view_permission')\n redirect_to(:root) && (return false)\n end\n\n @page_title = _('Card_groups')\n\n session[:cardgroup_search_options] ||= {}\n\n @options = {\n 's_number' => '',\n 's_pin' => '',\n 's_balance_max' => '',\n 's_balance_min' => '',\n 's_sold' => '',\n 's_caller_id' => ''\n }\n\n @pin_visible = Confline.get_value('CCShop_hide_pins_for_distributors').to_i.zero?\n @options = @options.merge(session[:cardgroup_search_options])\n\n @cardgroups = Cardgroup.select('cardgroups.*, COUNT(cards.id) AS card_count').joins('LEFT JOIN cards ON (cards.cardgroup_id = cardgroups.id and cards.hidden = 0)').where(['cards.user_id = ?', current_user_id]).group('cardgroups.id').all\n end",
"def test_manager_home\n \n get('index', {}, {})\n assert_response(:success)\n assert_template('tracker/index')\n\n manager_session = jim_manager_session\n get('index', {}, manager_session)\n assert_equal('DESC', assigns(:sort_order)[:priority])\n\n active_reviews = assigns(:active_reviews)\n inactive_reviews = assigns(:inactive_reviews)\n\n expected_active_design_reviews = [ design_reviews(:mx600a_pre_artwork),\n design_reviews(:mx234a_pre_artwork),\n design_reviews(:la454c3_placement),\n design_reviews(:mx999a_pre_artwork),\n design_reviews(:mx999b_pre_artwork),\n design_reviews(:mx999c_pre_artwork),\n design_reviews(:la453a1_placement),\n design_reviews(:design_reviews_129)]\n\n assert_equal(expected_active_design_reviews.size, active_reviews.size)\n assert_equal(expected_active_design_reviews.collect { |dr| dr.design.directory_name }, \n active_reviews.collect { |dr| dr.design.directory_name })\n\n expected_inactive_design_reviews = [ design_reviews(:mx234b_placement),\n design_reviews(:mx700b_pre_artwork),\n design_reviews(:la455b_final),\n design_reviews(:mx234c_routing),\n design_reviews(:la453b_placement) ]\n \n assert_equal(expected_inactive_design_reviews.size, inactive_reviews.size)\n assert_equal(expected_inactive_design_reviews, inactive_reviews)\n \n\n #manager_session['flash'] = 'ASC'\n post('manager_list_by_priority', { :order => 'DESC' }, manager_session)\n\n expected_active_design_reviews = expected_active_design_reviews.sort_by { |dr| [dr.priority.value, dr.age] }.reverse\n expected_inactive_design_reviews.reverse!\n assert_equal('ASC', assigns(:sort_order)[:priority])\n assert_equal(expected_active_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.priority.name }, \n assigns(:active_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.priority.name })\n assert_equal(expected_inactive_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.priority.name }, \n assigns(:inactive_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.priority.name })\n\n expected_active_design_reviews.reverse!\n expected_inactive_design_reviews.reverse!\n post('manager_list_by_priority', { :order => 'ASC' }, manager_session)\n assert_equal('DESC', assigns(:sort_order)[:priority])\n assert_equal(expected_active_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.priority.name }, \n assigns(:active_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.priority.name })\n assert_equal(expected_inactive_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.priority.name },\n assigns(:inactive_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.priority.name })\n\n post('manager_list_by_design', { :order => 'DESC' }, manager_session)\n expected_active_design_reviews = \n expected_active_design_reviews.sort_by { |dr| [dr.design.part_number.pcb_display_name, dr.age] }\n expected_inactive_design_reviews = \n expected_inactive_design_reviews.sort_by { |dr| [dr.design.part_number.pcb_display_name, dr.age] }\n expected_active_design_reviews.reverse!\n expected_inactive_design_reviews.reverse!\n assert_equal('ASC', assigns(:sort_order)[:design])\n assert_equal(expected_active_design_reviews.collect { |dr| dr.design.part_number.pcb_display_name },\n assigns(:active_reviews).collect { |dr| dr.design.part_number.pcb_display_name })\n assert_equal(expected_inactive_design_reviews.collect { |dr| dr.design.part_number.pcb_display_name }, \n assigns(:inactive_reviews).collect { |dr| dr.design.part_number.pcb_display_name })\n\n expected_active_design_reviews.reverse!\n expected_inactive_design_reviews.reverse!\n post('manager_list_by_design', { :order => 'ASC' }, manager_session)\n assert_equal('DESC', assigns(:sort_order)[:design])\n assert_equal(expected_active_design_reviews.collect { |dr| dr.design.part_number.pcb_display_name }, \n assigns(:active_reviews).collect { |dr| dr.design.part_number.pcb_display_name })\n assert_equal(expected_inactive_design_reviews.collect { |dr| dr.design.part_number.pcb_display_name }, \n assigns(:inactive_reviews).collect { |dr| dr.design.part_number.pcb_display_name })\n\n post('manager_list_by_type', { :order => 'DESC' }, manager_session)\n expected_active_design_reviews = \n expected_active_design_reviews.sort_by { |dr| [dr.review_type.sort_order, dr.age] }\n expected_inactive_design_reviews = \n expected_inactive_design_reviews.sort_by { |dr| [dr.review_type.sort_order, dr.age] }\n expected_active_design_reviews.reverse!\n expected_inactive_design_reviews.reverse!\n assert_equal('ASC', assigns(:sort_order)[:type])\n assert_equal(expected_active_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.review_type.name },\n assigns(:active_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.review_type.name })\n assert_equal(expected_inactive_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.review_type.name }, \n assigns(:inactive_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.review_type.name })\n\n expected_active_design_reviews.reverse!\n expected_inactive_design_reviews.reverse!\n post('manager_list_by_type', { :order => 'ASC' }, manager_session)\n assert_equal('DESC', assigns(:sort_order)[:type])\n assert_equal(expected_active_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.review_type.name }, \n assigns(:active_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.review_type.name })\n assert_equal(expected_inactive_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.review_type.name }, \n assigns(:inactive_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.review_type.name })\n\n post('manager_list_by_designer', { :order => 'DESC' }, manager_session)\n expected_active_design_reviews = \n expected_active_design_reviews.sort_by { |dr| [dr.designer.last_name, dr.age] }\n expected_inactive_design_reviews = \n expected_inactive_design_reviews.sort_by { |dr| [dr.designer.last_name, dr.age] }\n expected_active_design_reviews.reverse!\n expected_inactive_design_reviews.reverse!\n assert_equal('ASC', assigns(:sort_order)[:designer])\n assert_equal(expected_active_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.designer.last_name }, \n assigns(:active_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.designer.last_name })\n assert_equal(expected_inactive_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.designer.last_name },\n assigns(:inactive_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.designer.last_name })\n\n expected_active_design_reviews.reverse!\n expected_inactive_design_reviews.reverse!\n post('manager_list_by_designer', { :order => 'ASC' }, manager_session)\n assert_equal('DESC', assigns(:sort_order)[:designer])\n assert_equal(expected_active_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.designer.last_name }, \n assigns(:active_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.designer.last_name })\n assert_equal(expected_inactive_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.designer.last_name }, \n assigns(:inactive_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.designer.last_name })\n\n post('manager_list_by_peer', { :order => 'DESC' }, manager_session)\n expected_active_design_reviews = \n expected_active_design_reviews.sort_by { |dr| [dr.design.peer.last_name, dr.age] }\n expected_inactive_design_reviews = \n expected_inactive_design_reviews.sort_by { |dr| [dr.design.peer.last_name, dr.age] }\n expected_active_design_reviews.reverse!\n expected_inactive_design_reviews.reverse!\n assert_equal('ASC', assigns(:sort_order)[:peer])\n assert_equal(expected_active_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.design.peer.last_name }, \n assigns(:active_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.design.peer.last_name })\n assert_equal(expected_inactive_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.design.peer.last_name }, \n assigns(:inactive_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.design.peer.last_name })\n\n expected_active_design_reviews.reverse!\n expected_inactive_design_reviews.reverse!\n post('manager_list_by_peer', { :order => 'ASC' }, manager_session)\n assert_equal('DESC', assigns(:sort_order)[:peer])\n assert_equal(expected_active_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.design.peer.last_name }, \n assigns(:active_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.design.peer.last_name })\n assert_equal(expected_inactive_design_reviews.collect { |dr| dr.design.directory_name + ': ' + dr.design.peer.last_name }, \n assigns(:inactive_reviews).collect { |dr| dr.design.directory_name + ': ' + dr.design.peer.last_name })\n\n post('manager_list_by_age', { :order => 'DESC' }, manager_session)\n expected_active_design_reviews = \n expected_active_design_reviews.sort_by { |dr| [dr.age, dr.priority.value] }\n expected_inactive_design_reviews = \n expected_inactive_design_reviews.sort_by { |dr| [dr.age, dr.priority.value] }\n expected_active_design_reviews.reverse!\n expected_inactive_design_reviews.reverse!\n assert_equal('ASC', assigns(:sort_order)[:date])\n assert_equal(expected_active_design_reviews.collect { |dr| dr.design.directory_name }, \n assigns(:active_reviews).collect { |dr| dr.design.directory_name })\n assert_equal(expected_inactive_design_reviews.collect { |dr| dr.design.directory_name }, \n assigns(:inactive_reviews).collect { |dr| dr.design.directory_name })\n\n expected_active_design_reviews.reverse!\n expected_inactive_design_reviews.reverse!\n post('manager_list_by_age', { :order => 'ASC' }, manager_session)\n assert_equal('DESC', assigns(:sort_order)[:date])\n assert_equal(expected_active_design_reviews.collect { |dr| dr.design.directory_name }, \n assigns(:active_reviews).collect { |dr| dr.design.directory_name })\n assert_equal(expected_inactive_design_reviews.collect { |dr| dr.design.directory_name }, \n assigns(:inactive_reviews).collect { |dr| dr.design.directory_name })\n\n end",
"def test_cards_total()\n assert_equal(\"You have a total of 4\", @cardgame.cards_total([@card1, @card2]))\n end",
"def index\n @card_instances = CardInstance.all\n end",
"def index\n @card_instances = CardInstance.all\n end",
"def get_card\n end",
"def show\n @card_sort_result = CardSortResult.new\n end",
"def test_sorting_the_deck_large\n card_1 = Card.new(\"4\",\"Hearts\")\n card_2 = Card.new(\"3\", \"Clubs\")\n card_3 = Card.new(\"5\", \"Diamonds\")\n card_4 = Card.new(\"1\",\"Hearts\")\n card_5 = Card.new(\"Jack\", \"Clubs\")\n card_6 = Card.new(\"Ace\", \"Diamonds\")\n card_7 = Card.new(\"7\", \"Diamonds\")\n deck = Deck.new([card_1, card_2, card_3, card_4, card_5, card_6, card_7])\n assert_equal [card_4, card_2, card_1, card_3, card_7, card_5, card_6], deck.sorting_the_deck\n end",
"def index\n @feeling_cards = FeelingCard.all\n end",
"def show\n @root = current_user.device_group_or_root\n \n #@report_card = group_reports(@root ? @root.children : current_account.groups.of_devices.roots)\n \n # template = \"list\"\n \n @range_type = (params[:range_type] || 1).to_i\n\n # @report_card = \n # if params[:group_id]\n # group = current_account.groups.find(params[:group_id])\n \n # if group.children.any?\n # group_reports(group.children)\n # elsif group.devices.any?\n # template = \"list_vehicles\"\n # GroupVehiclesReport.new(current_user, \n # :group => group, :range => {:type => @range_type}).tap {|g| g.run }\n # else\n # []\n # end\n # else\n # group_reports(current_account.groups.of_devices.roots)\n # end\n \n\n if request.xhr?\n #render :partial => template, :locals => {:report_card => @report_card}\n render :json => {\n :status => 'success',\n :html => render_to_string(:partial => 'report_card/tree', :locals => {:node => @root}),\n :id => dom_id(@root)\n }\n end\n end",
"def test_sorting_the_deck\n card_1 = Card.new(\"4\",\"Hearts\")\n card_2 = Card.new(\"3\", \"Clubs\")\n card_3 = Card.new(\"5\", \"Diamonds\")\n deck = Deck.new([card_1, card_2, card_3])\n assert_equal [card_2, card_1, card_3], deck.sorting_the_deck\n end",
"def test_list\n\n # Try listing from a non-Admin account.\n # VERIFY: The user is redirected.\n post :list, {}, rich_designer_session\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try listing from an Admin account\n # VERIFY: The project list data is retrieved\n post(:list, { :page => 1 }, cathy_admin_session)\n assert_equal(5, assigns(:document_types).size)\n end",
"def index\n @entry_cards = EntryCard.all\n end",
"def show\n set_card\n end",
"def report_list(_)\n report_templates = ReportPrivate.all_report_templates(@path_to)\n report_templates = yield(report_templates) if block_given?\n @console.info self, ReportPrivate.table(report_templates)\n end",
"def index\n @card_pages = CardPage.all\n end",
"def test_should_show_list\n login_as :admin\n \n # No parameters.\n get :list\n assert_response :success\n assert_template 'list'\n assert_equal assigns(:title), \"Manage Tags\"\n assert_not_nil assigns(:tags)\n end",
"def index\n @m_cards = MCard.all\n end",
"def test_test_list_payments()\r\n # Parameters for the API call\r\n begin_time = nil\r\n end_time = nil\r\n sort_order = nil\r\n cursor = nil\r\n location_id = nil\r\n total = nil\r\n last_4 = nil\r\n card_brand = nil\r\n\r\n # Perform the API call through the SDK function\r\n result = @controller.list_payments(begin_time: begin_time, end_time: end_time, sort_order: sort_order, cursor: cursor, location_id: location_id, total: total, last_4: last_4, card_brand: card_brand)\r\n\r\n # Test response code\r\n assert_equal(200, @response_catcher.response.status_code)\r\n\r\n # Test headers\r\n expected_headers = {}\r\n expected_headers['content-type'] = 'application/json'\r\n\r\n assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))\r\n end",
"def index\n @cards = @deck.cards\n end",
"def index\n if Card.where(authorization_id: Authorization.current_id).count == 0 then\n # Create default cards & tasks if empty for this authorization\n tasks = Task.create([{name:\"ContactList Example\", done:true, authorization_id: Authorization.current_id},{name:\"Kanban Example\", done:false, authorization_id: Authorization.current_id},{name:\"My own experiments\", done:false, authorization_id: Authorization.current_id}])\n cards = Card.create([{title: \"Read the Book\", description: \"I should read the **whole** book\", color: '#BD8D31', status: \"in-progress\",authorization_id: Authorization.current_id}, {title: \"Write some code\", description: \"Code along with the samples in the book at [github](https://github.com/pro-react)\",color: '#3A7E28',status: \"todo\",tasks: tasks,authorization_id: Authorization.current_id}])\n end\n\n @cards = Card.rank(:row_order).where(authorization_id: Authorization.current_id).includes(:tasks)\n end",
"def index\n @flash_card_sets = FlashCardSet.all\n\n render :index, status: 200\n end",
"def index\n #@cards = Card.all\n end",
"def test_successful_purchase_encryption_credit_card_metadata\n test_successful_purchase_credit_card_metadata(true)\n end",
"def index\n @work_cards = WorkCard.all\n end",
"def index\n @deck_matchups = DeckMatchup.all\n end",
"def initialize(deck)\n @cards_showing = Array.new\n base#just like the deck I want this to be adaptable if we can\n @table_max.times {@cards_showing.push(deck.draw_card)}\n @table_size = @cards_showing.length\n set_warnings\n end",
"def index\n @cards = @deck.cards.all\n end",
"def cards(addressbook_id)\n end",
"def card_deck\n CardDeck.new(card: @subject)\n end",
"def test_successful_authorize_stored_card_webhook_metadata\n test_successful_purchase_credit_card_webhook_metadata(false, true, true)\n end",
"def test_view_assignment_report\n \n first_assignment = oi_assignments(:first)\n \n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:view_assignment_report, { :id => first_assignment }, siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n get(:view_assignment_report, { :id => first_assignment }, scott_designer_session)\n assert_equal(first_assignment.id, assigns(:assignment).id)\n assert_equal([], assigns(:comments))\n assert_equal(OiAssignmentReport.report_card_scoring, assigns(:scoring_table))\n assert_equal(\"0% Rework\", assigns(:current_score))\n \n end",
"def test_successful_purchase_encryption_stored_card_metadata\n test_successful_purchase_stored_card_metadata(true)\n end",
"def index\n @card_assignments = CardAssignment.all\n end",
"def test_shall_list_briefcase_items\n login_as :administrator\n get :list\n assert :success\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def index\n @cards = Card.all\n end",
"def has_card? test_card\n @cards.each do |card|\n if card.to_string==test_card.to_string\n return true\n end\n end\n false\n end",
"def test_checklist_for_species_list\n login\n list = species_lists(:one_genus_three_species_list)\n expect = Name.joins(observations: :species_list_observations).\n where({ species_list_observations: { species_list_id: list.id } }).\n with_rank(\"Species\").distinct\n\n get(:show, params: { species_list_id: list.id })\n assert_match(/Checklist for #{list.title}/, css_select(\"title\").text,\n \"Wrong page\")\n\n prove_checklist_content(expect)\n end",
"def test_list\n\n # Try editing from a non-Admin account.\n # VERIFY: The user is redirected.\n get(:list, {}, rich_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Try listing from an Admin account\n # VERIFY: The platform list data is retrieved\n post(:list, { :page => 1 }, cathy_admin_session)\n assert_equal(5, assigns(:platforms).size)\n\n end",
"def index\n @ccards = Ccard.all\n end",
"def deal_cards\n\t\t\tend",
"def index\n @graphic_cards = GraphicCard.all\n end",
"def test_create_assignment_report\n \n first_report = oi_assignment_reports(:first)\n \n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:create_assignment_report, { :id => oi_assignment_reports(:first) }, lee_hweng_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n get(:create_assignment_report, {:id => first_report}, scott_designer_session)\n assert_equal(first_report.id, assigns(:assignment).id)\n assert_equal(1, assigns(:complexity_id))\n assert_equal(OiAssignmentReport::NOT_SCORED, assigns(:report).score)\n assert_equal([], assigns(:comments))\n assert_equal(OiAssignmentReport.report_card_scoring,\n assigns(:scoring_table))\n \n # Verify the redirect to create_assignment_report by create report when the \n # report has not been scored.\n \n \n end",
"def index\n @company_cards = CompanyCard.all\n end",
"def test_io_category_selection\n \n categories = ['Board Preparation', 'Placement',\n 'Routing', 'Fabrication Drawing',\n 'Nomenclature', 'Assembly Drawing',\n 'Other']\n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:oi_category_selection, {:design_id => @mx234a.id}, pat_dfm_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify that a Teradyne PCB Designer can access the list.\n get(:oi_category_selection, { :design_id => @mx234a.id }, scott_designer_session)\n assert_response(:success)\n assert_not_nil(assigns(:design))\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal('252-234-a0 g', assigns(:design).part_number.pcb_display_name)\n \n assert_not_nil(assigns(:oi_category_list))\n oi_category_list = assigns(:oi_category_list)\n assert_equal(categories.size, oi_category_list.size)\n categories.each_index do |i| \n assert_equal(categories[i], oi_category_list[i].name) \n end\n \n # Verify that a contractor PCB Designer can access the list.\n get(:oi_category_selection, { :design_id => @mx234a.id }, siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n end",
"def test_card_members\n\t\tcard = Card.new(\"A\", \"Hearts\")\n\t\tassert_equal(card.value, 1)\n\t\tassert_equal(card.face, \"A\")\n\t\tassert_equal(card.is_ace, true)\n\tend",
"def index\n @user_cards = UserCard.all\n end",
"def index\n @user_cards = UserCard.all\n end",
"def test_successful_authorize_encryption_credit_card_metadata\n test_successful_purchase_credit_card_metadata(true, true)\n end",
"def test_deck_display_size_fullDeck\n print \"Expected size of 81: Found \"\n Deck.new.display_size\n end",
"def test_data_ctr_from_dashboard\r\n\r\n # Sign into the application\r\n @place_holder.login_with_proper_credentials\r\n\r\n # Make sure the current page is dashboard (this actually is not a functional verification, but just an intermediate check to make sure the following\r\n # assertions are carried out on the dashboard)\r\n @place_holder.assert_actual_url(PropertiesReader.get_dash_board_url, 'just an intermediate check to make sure the following assertions are carried out on the dashboard')\r\n\r\n #sleep(60)\r\n # Verify on the dash board that the following exist\r\n # a) the navigation menu (that contains the link to the data center)\r\n # b) link to the data center\r\n @place_holder.assert_nav_data_ctr_links_exist('on dashboard')\r\n\r\n # Navigate to the data center from dashboard\r\n @place_holder.go_to_data_center(\"from dashboard\")\r\n\r\n # Verify the navigation to the data center from the dashboard\r\n @place_holder.assert_actual_url(PropertiesReader.get_data_center_url, 'after clicking on the data center link from dashboard')\r\n\r\n # Verify that the expected divs exists on the data center page when navigated from the dashboard\r\n @place_holder.assert_divs_exist_on_data_center('after navigating to the data center from dashboard')\r\n\r\n end",
"def test_list_csv\n get :index, :format => 'csv'\n assert_response_csv\n end"
] |
[
"0.5846489",
"0.58184975",
"0.5715349",
"0.56638736",
"0.56466544",
"0.56362575",
"0.56354636",
"0.552045",
"0.54872024",
"0.54784036",
"0.5396856",
"0.5375988",
"0.5368743",
"0.5368743",
"0.5313435",
"0.53019434",
"0.53002983",
"0.52925974",
"0.52864707",
"0.5280211",
"0.52796197",
"0.52687085",
"0.5252889",
"0.52383995",
"0.52365386",
"0.5233258",
"0.5222146",
"0.51996785",
"0.51887846",
"0.5157957",
"0.5156458",
"0.51432985",
"0.51379037",
"0.5135621",
"0.5131216",
"0.51309836",
"0.5130557",
"0.5113149",
"0.50872535",
"0.5084942",
"0.508105",
"0.50804734",
"0.50773627",
"0.505924",
"0.5051053",
"0.50421035",
"0.5040117",
"0.5025143",
"0.50219375",
"0.50219375",
"0.5020986",
"0.5015758",
"0.50106555",
"0.5007406",
"0.4993413",
"0.4990233",
"0.49889562",
"0.49887255",
"0.49863642",
"0.49776065",
"0.4977523",
"0.49721286",
"0.49707115",
"0.4968888",
"0.4962372",
"0.49560583",
"0.49531567",
"0.4948122",
"0.4945248",
"0.49429125",
"0.49401414",
"0.4929301",
"0.49225307",
"0.49200818",
"0.4912902",
"0.49126187",
"0.49107116",
"0.49072042",
"0.48999092",
"0.48941985",
"0.48885188",
"0.48885188",
"0.48885188",
"0.48885188",
"0.48752677",
"0.48721766",
"0.486841",
"0.48667935",
"0.48631677",
"0.48624662",
"0.48616844",
"0.48616266",
"0.48563057",
"0.4855652",
"0.48548377",
"0.48548377",
"0.485132",
"0.4846874",
"0.48394307",
"0.48386547"
] |
0.6882792
|
0
|
test_create_assignment_report Description: This method does the functional testing of the create assignment report view.
|
def test_create_assignment_report
first_report = oi_assignment_reports(:first)
# Try accessing from an account that is not a PCB Designer and
# verify that the user is redirected.
get(:create_assignment_report, { :id => oi_assignment_reports(:first) }, lee_hweng_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
get(:create_assignment_report, {:id => first_report}, scott_designer_session)
assert_equal(first_report.id, assigns(:assignment).id)
assert_equal(1, assigns(:complexity_id))
assert_equal(OiAssignmentReport::NOT_SCORED, assigns(:report).score)
assert_equal([], assigns(:comments))
assert_equal(OiAssignmentReport.report_card_scoring,
assigns(:scoring_table))
# Verify the redirect to create_assignment_report by create report when the
# report has not been scored.
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_view_assignment_report\n \n first_assignment = oi_assignments(:first)\n \n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:view_assignment_report, { :id => first_assignment }, siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n get(:view_assignment_report, { :id => first_assignment }, scott_designer_session)\n assert_equal(first_assignment.id, assigns(:assignment).id)\n assert_equal([], assigns(:comments))\n assert_equal(OiAssignmentReport.report_card_scoring, assigns(:scoring_table))\n assert_equal(\"0% Rework\", assigns(:current_score))\n \n end",
"def create\n AssignmentNotifier.create(@assignment)\n end",
"def create\n @assignment = @user.assignments.new(params[:assignment])\n\n respond_to do |format|\n if @assignment.save\n flash[:notice] = 'Committee assignment was successfully created'\n format.html { redirect_to user_assignments_path(@user) }\n format.xml { render :xml => @assignment, :status => :created, :location => @assignment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @assignment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @assignment = Assignment.new(assignment_params)\n @users = User.all\n @resources = Resource.all\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { render :new }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_new_report!; end",
"def create_new_report!; end",
"def create\n @assignment = Assignment.new\n @assignment.build_assignment_stat\n @assignment.build_submission_rule\n @assignment.transaction do\n begin\n @assignment, new_required_files = process_assignment_form(@assignment)\n @assignment.token_start_date = @assignment.due_date\n @assignment.token_period = 1\n rescue Exception, RuntimeError => e\n @assignment.errors.add(:base, e.message)\n new_required_files = false\n end\n unless @assignment.save\n @assignments = Assignment.all\n @sections = Section.all\n @clone_assignments = Assignment.where(vcs_submit: true)\n .order(:id)\n render :new\n return\n end\n if params[:persist_groups_assignment]\n clone_warnings = @assignment.clone_groupings_from(params[:persist_groups_assignment])\n unless clone_warnings.empty?\n clone_warnings.each { |w| flash_message(:warning, w) }\n end\n end\n if @assignment.save\n flash_message(:success, I18n.t('assignment.create_success'))\n end\n if new_required_files && !MarkusConfigurator.markus_config_repository_hooks.empty?\n # update list of required files in all repos only if there is a hook that will use that list\n UpdateRepoRequiredFilesJob.perform_later(current_user)\n end\n end\n redirect_to action: 'edit', id: @assignment.id\n end",
"def test_illegal_edit_assignment\r\n\r\n id = Assignment.first.id\r\n @assignment = Assignment.first\r\n original_assignment_name = @assignment.name\r\n number_of_assignment = Assignment.count\r\n # It will raise an error while execute render method in controller\r\n # Because the goldberg variables didn't been initialized in the test framework\r\n assert_raise (ActionView::TemplateError){\r\n post :update, :id => id, :assignment=> { :name => '',\r\n :directory_path => \"admin/test1\",\r\n :review_questionnaire_id => 1,\r\n :review_of_review_questionnaire_id => 1,\r\n },\r\n :due_date => { \"1\" , { :resubmission_allowed_id =>1 ,\r\n :submission_allowed_id =>3,\r\n :review_of_review_allowed_id =>1,\r\n :review_allowed_id =>1,\r\n :due_at =>\"2007-07-10 15:00:00\",\r\n :rereview_allowed_id =>1\r\n }\r\n }\r\n }\r\n assert_template 'assignment/edit'\r\n assert_equal original_assignment_name, Assignment.first.name\r\n end",
"def test_illegal_edit_assignment\n\n id = Assignment.first.id\n @assignment = Assignment.first\n original_assignment_name = @assignment.name\n number_of_assignment = Assignment.count\n # It will raise an error while execute render method in controller\n # Because the goldberg variables didn't been initialized in the test framework\n assert_raise (ActionView::TemplateError){\n post :update, :id => id, :assignment=> { :name => '',\n :directory_path => \"admin/test1\",\n :review_questionnaire_id => 1,\n :review_of_review_questionnaire_id => 1,\n },\n :due_date => { \"1\" , { :resubmission_allowed_id =>1 ,\n :submission_allowed_id =>3,\n :review_of_review_allowed_id =>1,\n :review_allowed_id =>1,\n :due_at =>\"2007-07-10 15:00:00\",\n :rereview_allowed_id =>1\n }\n }\n }\n assert_template 'assignment/edit'\n assert_equal original_assignment_name, Assignment.first.name\n end",
"def create\n\t\t@assignment = Assignment.new(params[:assignment])\n\t\t@course = @assignment.course\n\t\t\n\t\t# Check permissions\n\t\tif (not @current_user.courses.include?(@course)) && (not @current_user.is_administrator?)\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @assignment.save\n\t\t\t\tLogsController.createAssignment(@current_user, @assignment)\n\n\t\t\t\tformat.html { redirect_to course_path(@course), :flash => {:success => \"Assignment was successfully created.\"}}\n\t\t\telse\n\t\t\t\t@assignment_types = @course.assignment_types\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @assignment = Assignment.new(assignment_params)\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { render :new }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_assignment = UserAssignment.new(user_assignment_params)\n\n respond_to do |format|\n if @user_assignment.save\n format.html { redirect_to @user_assignment, notice: 'User assignment was successfully created.' }\n format.json { render :show, status: :created, location: @user_assignment }\n else\n format.html { render :new }\n format.json { render json: @user_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assignment = Assignment.new(assignment_params)\n\n if @assignment.save\n redirect_to @teacher_index_path, notice: 'Assignment was successfully created.'\n else\n render :new\n end\n end",
"def report_test\n report_data = params.require(:api).permit(:code,:stdout,:project,:suite,:section)\n report = api_user.test_reports.create(report_data)\n if report.valid?\n render text: \"ok\"\n else\n raise \"Invalid report\"\n end\n end",
"def create\n @assignment = Assignment.new(assignment_params)\n @assignment.creator_id = current_user.id\n\n # THIS IS ONLY FOR CREATING ASSIGNMENT FOR THE VERY FIRST TIME\n # if users wants to add more users to this, edit should be used and user_assignment_controller for it\n respond_to do |format|\n if @assignment.save\n current_user.assignments << @assignment\n @assignment.update_attribute(:is_done, false)\n @assignment.user_assignments.first.update_attribute(:assignment_id, @assignment.id) # for each?\n format.html { redirect_to current_user, notice: 'Assignment was successfully created.' }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { redirect_to :back }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_assignment(object,client,channel)\n\t \tcourse_name = object['course_name']\n\t \tdescription = object['description']\n\t \tdue_date = object['due_date']\n\n\t\t assignment = Assignment.create!(:course_name => course_name, :description => description, :due_date => due_date)\n\t\t assignment.save!\n\n\t\t return \"Assignment for #{course} regarding #{description}, due #{due_date} has been created!\"\n \tend",
"def create\n authorize! :create, Assignment\n @assignment = Assignment.new(assignment_params)\n @assignment.task = @task\n # @assignment.creator = current_user\n # @task.work = @work\n\n respond_to do |format|\n if @assignment.save!\n format.html { redirect_to project_task_assignments_path(@project,@task), notice: 'Assignment was successfully created.' }\n format.json { render action: 'show', status: :created, location: project_task_assignments_url(@project,@task) }\n else\n set_users\n @url = project_task_assignments_path(@project,@task)\n format.html { render action: 'new' }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assignment = Assignment.new(params[:assignment])\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render json: @assignment, status: :created, location: @assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assignment = Assignment.new(params[:assignment])\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, :notice => 'Assignment was successfully created.' }\n format.json { render :json => @assignment, :status => :created, :location => @assignment }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @assignment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t#render plain: params[:assignment].inspect\n\t\t@assignment = Assignment.new(assignment_params)\n\n#Save assignment if requirements met, else refresh the page.\n\t\tif (@assignment.save)\n\t\t\tredirect_to @assignment\n\t\telse\n\t\t\trender 'new'\n\t\tend \n\tend",
"def create\n @assignment = Assignment.new(assignment_params)\n\n respond_to do |format|\n if @assignment.save\n format.html {redirect_to @assignment, notice: 'Assignment was successfully created.'}\n format.json {render :show, status: :created, location: @assignment}\n else\n format.html {render :new}\n format.json {render json: @assignment.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @assignment = Assignment.new(assignment_params)\n @labs = Lab.all\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { render :new }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patient_assignment = PatientAssignment.new(params[:patient_assignment])\n\n respond_to do |format|\n if @patient_assignment.save\n format.html { redirect_to @patient_assignment, notice: 'Patient assignment was successfully created.' }\n format.json { render json: @patient_assignment, status: :created, location: @patient_assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patient_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assignment = Assignment.new(assignment_params)\n @plan = Plan.find(params[:plan_id])\n @assignment.plan_id = @plan.id\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to plan_path(@plan), notice: 'Assignment was successfully created.' }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { render :new }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_assignment(course, assignment)\n logger.info \"Creating submission assignment named '#{assignment.title}'\"\n navigate_to \"#{Utils.canvas_base_url}/courses/#{course.site_id}/assignments/new\"\n assignment_name_element.when_visible Utils.medium_wait\n assignment_name_element.send_keys assignment.title\n wait_for_element_and_type_js(assignment_due_date_element, assignment.due_date.strftime(\"%b %-d %Y\")) unless assignment.due_date.nil?\n assignment_type_element.when_visible Utils.medium_wait\n scroll_to_bottom\n wait_for_element_and_select_js(assignment_type_element, 'Online')\n online_url_cbx_element.when_visible Utils.short_wait\n check_online_url_cbx\n check_online_upload_cbx\n click_save_and_publish\n published_button_element.when_visible Utils.medium_wait\n logger.info \"Submission assignment URL is #{current_url}\"\n assignment.url = current_url\n end",
"def create\n @task_assignment = TaskAssignment.new(task_assignment_params)\n\n respond_to do |format|\n if @task_assignment.save\n format.html { redirect_to @task_assignment, notice: 'Task assignment was successfully created.' }\n format.json { render :show, status: :created, location: @task_assignment }\n else\n format.html { render :new }\n format.json { render json: @task_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assignment = @course.assignments.new(params[:assignment])\n @assignment.save\n @outline = Outline.where(\"course_id = ?\", @course.id).all\n @outline.empty? ? i = 1 : i = @outline.sort_by {|x| x.order_number}.last.order_number += 1\n @content = Outline.new(:course_id => @course.id, :content_type => 'Assignment', :order_number => i, :content_id => @assignment.id)\n @content.save\n @users = User.enrolled(@course)\n @users.each do |u|\n @enrollment = Enrollment.where(:user_id => u.id, :course_id => @course.id).first\n Homework.create(:enrollment_id => @enrollment.id, :assignment_id => @assignment.id, :user_id => u.id)\n end\n \n respond_to do |format|\n if @assignment.save\n format.html { redirect_to edit_course_path(@course), notice: 'Assignment was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def create \n\t\t@course = Course.find_by_id(session[:course_id])\n\t\t@new_assignment = Assignment.new\n\t\t@new_assignment.title = assignment_params[:title]\n\t\t@new_assignment.description = assignment_params[:description]\n\t\t@new_assignment.due_date = assignment_params[:date]\n\t\t@new_assignment.course_id = session[:course_id]\n\t\tdeadline = DateTime.new(assignment_params[\"date(1i)\"].to_i,\n\t\t\tassignment_params[\"date(2i)\"].to_i, assignment_params[\"date(3i)\"].to_i )\n\t\t@new_assignment.due_date = deadline\n\t\tif lecturer_signed_in?\n\t\t\t@new_assignment.owner_id = current_lecturer.id\n\t\t\t@new_assignment.owner_type = \"lecturer\"\n\t\telsif teaching_assistant_signed_in?\n\t\t\t@new_assignment.owner_id = current_teaching_assistant.id\n\t\t\t@new_assignment.owner_type = \"teaching assistant\"\n\t\tend\n\t\tif @new_assignment.save\n\t\t\tredirect_to :controller => 'assignment_problems', :action => 'new',\n\t\t\t\t:id => @new_assignment.id\n\t\telse\n\t\t\trender :action=>'new', :course_id => params[:course_id]\n\t\tend\n\tend",
"def create\n @task_assignment = TaskAssignment.new(params[:task_assignment])\n \n respond_to do |format|\n if @task_assignment.save\n format.html { redirect_to(@task_assignment, :notice => 'Task assignment was successfully created.') }\n format.xml { render :xml => @task_assignment, :status => :created, :location => @task_assignment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task_assignment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @exceller_assignment = ExcellerAssignment.new(exceller_assignment_params)\n\n respond_to do |format|\n if @exceller_assignment.save\n format.html { redirect_to @exceller_assignment, notice: 'Exceller assignment was successfully created.' }\n format.json { render :show, status: :created, location: @exceller_assignment }\n else\n format.html { render :new }\n format.json { render json: @exceller_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, :notice => 'Assignment was successfully created.' }\n format.json { render :json => @assignment, :status => :created, :location => @assignment }\n else\n format.html { render :action => 'new' }\n format.json { render :json => @assignment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_report\n Report.create_for_team(id)\n end",
"def create_report\n Report.create_for_team(id)\n end",
"def test_task_assignment\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_list = [@siva_e]\n \n designer_session = scott_designer_session\n \n \n # Verify that a Teradyne PCB Designer can access the list\n # \n # Section Selection - Other\n get(:section_selection,\n { :id => @other.id, :design_id => @mx234a.id },\n designer_session) \n assert_redirected_to(:action => :process_assignments,\n :category_id => @other.id,\n :design_id => @mx234a.id,\n :section_id => OiCategory.other_category_section_id)\n \n # Section Selection - Board Prep\n get(:section_selection,\n {:id => @board_prep.id, :design_id => @mx234a.id }, \n designer_session)\n assert_equal(board_prep_sections, assigns(:sections))\n assert_equal(0, assigns(:section_id))\n \n # Process Assignments - No step selected\n post(:process_assignments,\n { :design => { :id => @mx234a.id },\n :category => { :id => @board_prep.id } },\n designer_session)\n #assert_equal(\"Please select the step\", flash['notice'])\n assert_nil(flash[:assignment])\n assert_redirected_to(:action => 'section_selection',\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n \n # Process Assignments - No errors\n post(:process_assignments,\n { :section_id => oi_category_sections(:board_prep_1).id,\n :design => { :id => @mx234a.id },\n :category => { :id => @board_prep.id } },\n designer_session)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n \n lcr_team_members = assigns(:team_members)\n expected_team_members = [@siva_e, @mathi_n] \n assert_equal(expected_team_members, lcr_team_members)\n \n assert_equal(oi_category_sections(:board_prep_1).id,\n assigns(:selected_step).id)\n \n instruction = assigns(:instruction)\n assert_equal(@board_prep.id, instruction.oi_category_section_id)\n assert_equal(@mx234a.id, instruction.design_id)\n \n assignment = assigns(:assignment)\n assert_equal((Time.now+1.day).year, assignment.due_date.year)\n assert_equal((Time.now+1.day).month, assignment.due_date.month)\n assert_equal((Time.now+1.day).day, assignment.due_date.day)\n assert_equal(OiAssignment.complexity_id('Low'), assignment.complexity_id)\n \n assert_not_nil(assigns(:comment))\n \n assert(!assigns(:selected_step).outline_drawing_link?)\n \n allegro_board_symbol = '10987654321'\n assignment_comment = 'This is a test'\n medium_complexity_id = OiAssignment.complexity_id('Medium')\n due_date = Time.local(2007, \"May\", 1)\n \n # Process Assignment Details - No allegro board symbol provided.\n post(:process_assignment_details,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '1', \"5005\" => '1' } },\n designer_session,\n {:assignment => {:instruction => \"\",\n :member_selections => \"\",\n :comment => \"\",\n :assignment => \"\"\n } }\n )\n #assert_equal('Please identify the Allegro Board Symbol', flash['notice'])\n #assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n #assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n #assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n #assert_not_nil(assignment[:design])\n #assert_equal(@mx234a.id, assignment[:design].id)\n #flash[:assignment][:design].name = 'abc'\n \n #assert_not_nil(assignment[:selected_step])\n #assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n #assert_not_nil(assignment[:instruction])\n #assert_equal(board_prep_sections[0].id,\n # assignment[:instruction].oi_category_section_id)\n \n #assert_not_nil(assignment[:member_selections])\n #assert_equal({ \"5004\" => '1', \"5005\" => '1' }, assignment[:member_selections])\n \n #assert_not_nil(assignment[:team_members])\n #assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n #assert_not_nil(assignment[:comment])\n #assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\nreturn \n follow_redirect!\n \n #Verify that the variable where loaded from the flash.\n #assert_equal(assignment[:design], assigns(:design)) \n #assert_equal(assignment[:category], assigns(:category))\n #assert_equal(assignment[:team_members], assigns(:team_members))\n #assert_equal(assignment[:selected_step], assigns(:selected_step))\n #assert_equal(assignment[:instruction], assigns(:instruction))\n #assert_equal(assignment[:assignment], assigns(:assignment))\n #assert_equal(assignment[:comment], assigns(:comment))\n #assert_not_nil(flash[:assignment])\n #assert_nil(assigns(:outline_drawing))\n \n \n # Process Assignment Details - No team members identified.\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s,\n :allegro_board_symbol => allegro_board_symbol },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '0', \"5005\" => '0' })\n\n assert_equal('Please select a team member or members', flash['notice'])\n assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n assert_not_nil(assignment[:design])\n assert_equal(@mx234a.id, assignment[:design].id)\n flash[:assignment][:design].name = 'abc'\n \n assert_not_nil(assignment[:selected_step])\n assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n assert_not_nil(assignment[:instruction])\n assert_equal(board_prep_sections[0].id,\n assignment[:instruction].oi_category_section_id)\n \n assert_not_nil(assignment[:member_selections])\n assert_equal({ \"5004\" => '0', \"5005\" => '0' }, assignment[:member_selections])\n \n assert_not_nil(assignment[:team_members])\n assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n assert_not_nil(assignment[:comment])\n assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\n \n follow_redirect\n \n #Verify that the variable where loaded from the flash.\n assert_equal(assignment[:design], assigns(:design)) \n assert_equal(assignment[:category], assigns(:category))\n assert_equal(assignment[:team_members], assigns(:team_members))\n assert_equal(assignment[:selected_step], assigns(:selected_step))\n assert_equal(assignment[:instruction], assigns(:instruction))\n assert_equal(assignment[:assignment], assigns(:assignment))\n assert_equal(assignment[:comment], assigns(:comment))\n assert_not_nil(flash[:assignment])\n assert_nil(assigns(:outline_drawing))\n \n section_selections = {}\n section_ids.each { |id| section_selections[id.to_s] = '0' }\n\n # Process Assignment Details - No team members identified and no allegro board symbol\n # provided.\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '0', \"5005\" => '0' })\n\n assert_equal('Please identify the Allegro Board Symbol<br />' +\n 'Please select a team member or members', \n flash['notice'])\n assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n assert_not_nil(assignment[:design])\n assert_equal(@mx234a.id, assignment[:design].id)\n flash[:assignment][:design].name = 'abc'\n \n assert_not_nil(assignment[:selected_step])\n assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n assert_not_nil(assignment[:instruction])\n assert_equal(board_prep_sections[0].id,\n assignment[:instruction].oi_category_section_id)\n \n assert_not_nil(assignment[:member_selections])\n assert_equal({ \"5004\" => '0', \"5005\" => '0' }, assignment[:member_selections])\n \n assert_not_nil(assignment[:team_members])\n assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n assert_not_nil(assignment[:comment])\n assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\n \n follow_redirect\n \n #Verify that the variable where loaded from the flash.\n assert_equal(assignment[:design], assigns(:design)) \n assert_equal(assignment[:category], assigns(:category))\n assert_equal(assignment[:team_members], assigns(:team_members))\n assert_equal(assignment[:selected_step], assigns(:selected_step))\n assert_equal(assignment[:instruction], assigns(:instruction))\n assert_equal(assignment[:assignment], assigns(:assignment))\n assert_equal(assignment[:comment], assigns(:comment))\n assert_not_nil(flash[:assignment])\n assert_nil(assigns(:outline_drawing))\n\n instruction_count = OiInstruction.count\n assignment_count = OiAssignment.count\n assignment_comment_count = OiAssignmentComment.count\n \n \n post(:view_assignments,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(0, assigns(:assignment_list).size)\n \n\n # Process Assignment Details - No errors\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s,\n :allegro_board_symbol => allegro_board_symbol },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '1', \"5005\" => '1' })\n\n assert_equal('The work assignments have been recorded - mail was sent',\n flash['notice'])\n assert_nil(flash[:assignment])\n\n assert_redirected_to(:action => 'oi_category_selection',\n :design_id => @mx234a.id)\n \n \n assert_equal(instruction_count+1, OiInstruction.count)\n instructions = OiInstruction.find(:all)\n last_instruction = instructions.pop\n assert_equal(@scott_g.id, last_instruction.user_id)\n assert_equal(allegro_board_symbol, last_instruction.allegro_board_symbol)\n assert_equal(board_prep_sections[0].id, last_instruction.oi_category_section_id)\n \n assert_equal(assignment_count+2, OiAssignment.count)\n assignments = OiAssignment.find(:all)\n mathi_assignment = assignments.pop\n siva_assignment = assignments.pop\n \n assert(!siva_assignment.complete?)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(last_instruction.id, siva_assignment.oi_instruction_id)\n assert_equal(due_date.to_i, siva_assignment.due_date.to_i)\n assert_equal(medium_complexity_id, siva_assignment.complexity_id)\n\n assert(!mathi_assignment.complete?)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n assert_equal(last_instruction.id, mathi_assignment.oi_instruction_id)\n assert_equal(due_date.to_i, mathi_assignment.due_date.to_i)\n assert_equal(medium_complexity_id, mathi_assignment.complexity_id)\n \n assert_equal(assignment_comment_count+2, OiAssignmentComment.count)\n assignment_comments = OiAssignmentComment.find(:all)\n mathi_comment = assignment_comments.pop\n siva_comment = assignment_comments.pop\n \n assert_equal(siva_assignment.id, siva_comment.oi_assignment_id)\n assert_equal(@scott_g.id, siva_comment.user_id)\n assert_equal(assignment_comment, siva_comment.comment)\n \n assert_equal(mathi_assignment.id, mathi_comment.oi_assignment_id)\n assert_equal(@scott_g.id, mathi_comment.user_id)\n assert_equal(assignment_comment, mathi_comment.comment)\n \n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n set_user(@pat_a.id, 'Product Support')\n post(:process_assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n\n # Verify that a contractor PCB Designer can not access the list.\n set_user(@siva_e.id, 'Designer')\n post(:process_assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify the email that was generated\n expected_to = [ [ @siva_e.email ].sort,\n [ @mathi_n.email ].sort,\n [ @siva_e.email, @mathi_n.email ].sort ]\n \n expected_cc_list = [@scott_g.email,\n @jim_l.email, \n @jan_k.email,\n users(:bala_g).email,\n @cathy_m.email].sort\n \n assert_equal(2, @emails.size) \n mathi_email = @emails.pop\n siva_email = @emails.pop\n \n assert_equal(1, siva_email.to.size)\n assert_equal(@siva_e.email, siva_email.to.pop)\n assert_equal(expected_cc_list, siva_email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment created',\n siva_email.subject)\n\n assert_equal(1, mathi_email.to.size)\n assert_equal(@mathi_n.email, mathi_email.to.pop)\n assert_equal(expected_cc_list, mathi_email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment created', \n mathi_email.subject)\n\n # Verify that a user from outside the PCB Group can not \n # access the view_assignments view\n set_user(@pat_a.id, 'Product Support')\n post(:view_assignments)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n\n # Verify that a contractor PCB Designer can not access the \n # view_assignments view\n set_user(@siva_e.id, 'Designer')\n post(:view_assignments)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify that a Teradyne PCB Designer can access the \n # view_assignments view\n set_user(@scott_g.id, 'Designer')\n post(:view_assignments,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n \n assignment_list = assigns(:assignment_list)\n assert_equal(1, assignment_list.size)\n \n expected_sections = board_prep_sections.dup\n \n # There is only on category populated\n assignment_list.each do |category, assignments|\n assert_equal(expected_sections.shift.id, category.id)\n assert_equal(2, assignments.size)\n end\n \n # Verify that a user from outside the PCB Group can not \n # access the assignment_view view\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_view)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a Teradyne PCB Designer can access the \n # the assignment_view view\n set_user(@scott_g.id, 'Designer')\n assignment_id = assignments.pop.id\n post(:assignment_view, :id => assignment_id)\n \n assert_response(:success)\n assert_equal(assignment_id, assigns(:assignment).id)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n\n comments = assigns(:comments)\n assert_equal(1, comments.size)\n comment = comments.pop\n assert_equal(assignment_comment, comment.comment)\n \n assert_not_nil(assigns(:post_comment))\n \n \n # Verify that a user from outside the PCB Group can not \n # access the category_details view\n set_user(@pat_a.id, 'Product Support')\n post(:category_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a contractor Team Member can access the \n # category_details view\n set_user(@siva_e.id, 'Designer')\n post(:category_details, :id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n \n siva_assignments = assigns(:category_list)\n assert_equal(2, siva_assignments.size)\n assert_not_nil(siva_assignments[@board_prep])\n \n assignment_list = siva_assignments[@board_prep]\n assert_equal(1, assignment_list.size)\n assert_not_nil(assignment_list.detect { |a| \n a.oi_instruction.oi_category_section_id == board_prep_sections[0].id }) \n assignment_list.each { |a| assert_equal(@siva_e.id, a.user_id) }\n\n # Verify that a user from outside the PCB Group can not \n # access the assignment_details view\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a contractor Team Member can access the \n # category_details view\n set_user(@siva_e.id, 'Designer')\n post(:assignment_details,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n \n section_list = assigns(:section_list)\n assert_equal('Board Preparation', section_list[:category].name)\n assert_equal(1, section_list[:assignment_list].size)\n assert_equal(1, section_list[:assignment_list][0].oi_instruction.oi_category_section_id)\n\n\n # Verify that a user from outside the PCB Group can not \n # update an assignment.\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_update)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify that a member of the PCB Design group can \n # update an assignment\n set_user(@siva_e.id, 'Designer')\n \n # Get the instruction with 2 assignments associated with it\n instruction = OiInstruction.find_by_design_id_and_oi_category_section_id(\n @mx234a.id,\n board_prep_sections[0].id)\n\n siva_assignment = instruction.oi_assignments.detect { |a| a.user_id == @siva_e.id }\n mathi_assignment = instruction.oi_assignments.detect { |a| a.user_id == @mathi_n.id }\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(1, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n siva_assignment_comment = siva_assignment.oi_assignment_comments.pop\n mathi_assignment_comment = mathi_assignment.oi_assignment_comments.pop\n assert_not_equal(siva_assignment_comment.id, mathi_assignment_comment.id)\n\n\n post(:assignment_update,\n :assignment => siva_assignment,\n :post_comment => {:comment => 'My 2 cents'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(2, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n cc_list = expected_cc_list.dup + [@siva_e.email] - [@scott_g.email]\n email = @emails.pop\n assert_equal([@scott_g.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update',\n email.subject)\n\n\n post(:assignment_update,\n :assignment => { :id => siva_assignment.id,\n :complete => \"1\"},\n :post_comment => {:comment => 'It is done'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(3, siva_assignment.oi_assignment_comments.size)\n assert_equal(1, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n email = @emails.pop\n assert_equal([@scott_g.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update - Completed',\n email.subject)\n \n set_user(@scott_g.id, 'Designer')\n post(:assignment_update,\n :assignment => { :id => siva_assignment.id,\n :complete => \"0\"},\n :post_comment => {:comment => 'My 2 cents'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(4, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n cc_list = expected_cc_list.dup\n email = @emails.pop\n assert_equal([@siva_e.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update - Reopened',\n email.subject)\n \n end",
"def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n \n @report.test_suite.test_cases.each do |test_case|\n @report.results.create({ status: 'Queued', report_id: @report, test_case_id: test_case.id})\n end\n \n format.html { redirect_to [:admin, @report], notice: 'Report was successfully created.' }\n format.json { render action: 'show', status: :created, location: @report }\n else\n format.html { render action: 'new' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assignment\n # Create assignment\n Relationship.create(assignment_parameters)\n \n # Get human readable assignment values\n @assignment_parts = assign_parts(params)\n end",
"def test_report_card_list\n \n get(:report_card_list, \n { :id => @board_prep.id, :design_id => @mx234a.id },\n scott_designer_session)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n assert_nil(assigns(:assignments_list))\n \n end",
"def test_add_assignment_participant()\n\t\tparticipant = AssignmentParticipant.new\n\t\tassert !participant.valid?\n\t\t\n\t\t#TODO read TODO tag in line 13\n\t\t\n\t\tparticipant.handle = 'test_handle'\n\t\tassert participant.valid?\n\tend",
"def create\n @assignment = Assignment.new(params[:assignment].merge(:course_id => params[:course_id]))\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to(course_assignment_path(:course_id => params[:course_id], :id => @assignment.id), :notice => 'Assignment was successfully created.') }\n format.xml { render :xml => @assignment, :status => :created, :location => @assignment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @assignment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group_assignment = GroupAssignment.new(group_assignment_params)\n\n respond_to do |format|\n if @group_assignment.save\n format.html { redirect_to @group_assignment, notice: 'Group assignment was successfully created.' }\n format.json { render :show, status: :created, location: @group_assignment }\n else\n format.html { render :new }\n format.json { render json: @group_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cim_hrdb_assignment = Assignment.new(params[:assignment])\n @cim_hrdb_assignment.person_id = params[:cim_hrdb_person_id]\n\n respond_to do |format|\n if @cim_hrdb_assignment.save\n flash[:notice] = 'Assignment was successfully created.'\n format.html { redirect_to(edit_cim_hrdb_person_path(@cim_hrdb_assignment.person)) }\n format.xml { render :xml => @cim_hrdb_assignment, :status => :created, :location => @cim_hrdb_assignment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cim_hrdb_assignment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_new_report\n\n testOne = BookmarkReport.newReport(2, 1, \"issue\", \"description\");\n\n assert_equal true, testOne\n\n testTwo = BookmarkReport.newReport(nil, 1, \" \", \"test\");\n\n assert_equal false, testTwo\n\n end",
"def create\n @group_assignment = GroupAssignment.new(group_assignment_params)\n\n respond_to do |format|\n if @group_assignment.save\n format.html { redirect_to @group_assignment, notice: \"Group assignment was successfully created.\" }\n format.json { render :show, status: :created, location: @group_assignment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @group_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assignment = Assignment.new(assignment_params)\n authorize @assignment\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: t(:success, :model => Assignment.model_name.human) }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { render :new }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # raise params.inspect\n @assignment = Assignment.new(assignment_params)\n @assignment.course = Course.find(params[:course_id])\n @assignment.user=current_user\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @assignment }\n else\n format.html { render action: 'new' }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task = Task.find(params[:task_id])\n @assignment = @task.assignments.build(params[:assignment])\n\n respond_to do |format|\n if @assignment.save\n flash[:notice] = 'The assignment was successfully created.'\n format.html { redirect_to project_task_path(@task.project, @task)}\n format.xml { render :xml => @assignment, :status => :created, :location => @assignment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @assignment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @assignment = current_user.created_assignments.create(assignment_params)\n @assignment.subtasks.create(params[:assignment][:subtask])\n respond_to do |format|\n if @assignment.save\n AssignmentsWorker.delay.perform(current_user.id)\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render json: @assignment, status: :created, location: @assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def write_report!\n notify.critical_error(\"Must run `test!` before writing a report\") if test.status.nil?\n in_test_dir do\n self.writer = GitTest::Writer.new(:path => report_path,\n :name => report_name,\n :report => test.report )\n in_report_branch do\n writer.save!\n commit_to_test_proj!\n end\n end\n end",
"def test_delete_assignment\r\n\r\n number_of_assignment = Assignment.count\r\n number_of_duedate = DueDate.count\r\n id = Assignment.first(:conditions => {:instructor_id => users(:instructor3).id}).id\r\n post :delete, :id => id\r\n assert_redirected_to :controller => 'tree_display', :action => 'list'\r\n assert_equal number_of_assignment-1, Assignment.count\r\n assert_raise(ActiveRecord::RecordNotFound){ Assignment.find(id) }\r\n\r\n end",
"def create\n @event_assignment = EventAssignment.new(event_assignment_params)\n\n respond_to do |format|\n if @event_assignment.save\n format.html { redirect_to @event_assignment, notice: 'Event assignment was successfully created.' }\n format.json { render :show, status: :created, location: @event_assignment }\n else\n format.html { render :new }\n format.json { render json: @event_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assigment\n @assignment = Assignment.new(params[:assignment])\n @asset = Asset.new(params[:asset])\n\n if @assignment.save\n\n @delivery_from_assignment = Delivery.find(@assignment.delivery)\n\n @delivery_from_assignment.evaluation_criteria.each do |generate_rubres|\n @response_to_the_evaluation = ResponseToTheEvaluation.new\n @response_to_the_evaluation.name = generate_rubres.name\n @response_to_the_evaluation.comment_for_rubre = generate_rubres.description\n @response_to_the_evaluation.assignment_id = @assignment.id\n @response_to_the_evaluation.save\n end\n end\n end",
"def create\n\t\t@problem = AssignmentProblem.find_by_id(new_test_case_params[:assignment_problem_id])\n\t\t@test_case = TestCase.new(new_test_case_params)\n\t\t@test_case.input = new_test_case_params[:input]\n\t\t@test_case.output = new_test_case_params[:output]\n\t\t@test_case.assignment_problem_id = new_test_case_params[:assignment_problem_id]\n\t\tif lecturer_signed_in?\n\t\t\t@test_case.owner_id = current_lecturer.id\n\t\t\t@test_case.owner_type = \"lecturer\"\n\t\t\t@test_case.assignment_problem_id = session[:assignment_problem_id]\n\t\telsif teaching_assistant_signed_in?\n\t\t\t@test_case.owner_id = current_teaching_assistant.id\n\t\t\t@test_case.owner_type = \"teaching assistant\"\n\t\t\t@test_case.assignment_problem_id = session[:assignment_problem_id]\n\t\tend\n\t\tif @test_case.save\n\t\t\tflash[:notice] = \"Your test case is now added\"\n\t\t\tredirect_to :controller => 'assignment_problems', :action => 'new',\n\t\t\t:id => session[:problem_assignment_id]\n\t\telse\n\t\t\trender :action=>'new', :assignment_id => @test_case.assignment_problem_id\n\t\tend\n\tend",
"def create\n @case_assignment = CaseAssignment.new(case_assignment_params)\n\n respond_to do |format|\n if @case_assignment.save\n format.html { redirect_to @case_assignment, notice: 'Case assignment was successfully created.' }\n format.json { render :show, status: :created, location: @case_assignment }\n else\n format.html { render :new }\n format.json { render json: @case_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_legal_edit_assignment\n @assignment = Assignment.first\n id = Assignment.first.id\n number_of_assignment = Assignment.count\n questionnaire_id = Questionnaire.first.id\n post :update, :id => id, :assignment=> { :name => 'updatedAssignment9',\n :review_questionnaire_id => questionnaire_id,\n :review_of_review_questionnaire_id => questionnaire_id,\n :author_feedback_questionnaire_id => questionnaire_id\n }\n\n assert_equal flash[:notice], 'Assignment was successfully updated.'\n\n assert_response :redirect\n assert_equal Assignment.count, number_of_assignment\n assert Assignment.find(:all, :conditions => \"name = 'updatedAssignment9'\")\n end",
"def create\n @activity_participant_assignment = ActivityParticipantAssignment.new(activity_participant_assignment_params)\n\n respond_to do |format|\n if @activity_participant_assignment.save\n format.html { redirect_to @activity_participant_assignment, notice: 'Activity participant assignment was successfully created.' }\n format.json { render :show, status: :created, location: @activity_participant_assignment }\n else\n format.html { render :new }\n format.json { render json: @activity_participant_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_delete_assignment\n\n number_of_assignment = Assignment.count\n number_of_duedate = DueDate.count\n id = Assignment.first(:conditions => {:instructor_id => users(:instructor3).id}).id\n post :delete, :id => id\n assert_redirected_to :controller => 'tree_display', :action => 'list'\n assert_equal number_of_assignment-1, Assignment.count\n assert_raise(ActiveRecord::RecordNotFound){ Assignment.find(id) }\n\n end",
"def createAssignment\n @current_user = User.find_by_session_token(cookies[:session_token])\n if(@current_user.role != \"Student\" && $course != nil && $course != [])\n result = Assignment.createAssignment($course.id, params[:title], params[:points], params[:file], params[:dueDate])\n if(result.is_a? String)\n flash[:warning] = result\n end\n else($course == nil && $course == [])\n flash[:warning] = \"Unable to create assignment\"\n end\n redirect_to assignments_home_path\n end",
"def create\n @student_assignment = StudentAssignment.new(student_assignment_params)\n\n respond_to do |format|\n if @student_assignment.save\n format.html { redirect_to @student_assignment, notice: 'Student assignment was successfully created.' }\n format.json { render :show, status: :created, location: @student_assignment }\n else\n format.html { render :new }\n format.json { render json: @student_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assignment_special_assignment = Assignment::SpecialAssignment.new(params[:assignment_special_assignment])\n\n respond_to do |format|\n if @assignment_special_assignment.save\n format.html { redirect_to @assignment_special_assignment, notice: 'Special assignment was successfully created.' }\n format.json { render json: @assignment_special_assignment, status: :created, location: @assignment_special_assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment_special_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_report\n\tcreate_rep_heading\n \tcreate_product_data\n \tcreate_brand_data\nend",
"def test_assignments_are_associated_with_courses\n course = Course.create(name: \"Ruby on Rails\", course_code: \"ROR600\", color: \"Violet\")\n assignment = Assignment.create(name: \"Battleship\", percent_of_grade: 10)\n assignment_two = Assignment.create(name: \"Currency Converter\", percent_of_grade: 10)\n assignment_three = Assignment.create(name: \"Time Entries\", percent_of_grade: 10)\n\n assert course.assignments << assignment\n assert course.assignments << assignment_two\n assert course.assignments << assignment_three\n\n assert_equal 3, course.assignments.count\n end",
"def test_assignments_are_associated_with_assignment_grades\n assignment = Assignment.create(name: \"Battleship\", percent_of_grade: 10, course_id: 2)\n\n grade = AssignmentGrade.create(final_grade: \"A\")\n grade_two = AssignmentGrade.create(final_grade: \"B\")\n\n assert assignment.assignment_grades << grade\n assert assignment.assignment_grades << grade_two\n\n assert_equal 2, assignment.assignment_grades.count\n end",
"def test_process_assignments\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_list = [@siva_e]\n \n section_selections = {}\n section_ids.each { |id| section_selections[id.to_s] = '0' }\n\n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n pat_dfm_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n \n # Verify that a contractor PCB Designer can not access the list.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n end",
"def create\n params[:assignment].delete(:employee)\n @assignment = Assignment.new(params[:assignment])\n @assignment.start_date = Chronic.parse(params[:assignment][:start_date])\n @assignment.end_date = Chronic.parse(params[:assignment][:end_date])\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render json: @assignment, status: :created, location: @assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @annual_summary_report = AnnualSummaryReport.new(annual_summary_report_params)\n\n #create default questions\n questions = Question.all\n @annual_summary_report.user_id = current_user.id\n @annual_summary_report.status = 1\n\n respond_to do |format|\n if @annual_summary_report.save\n for question in questions\n answer = Answer.new\n answer.question = question.question\n answer.question_id = question.id\n answer.answer = '';\n answer.section_id = question.section_id\n answer.annual_summary_report_id = @annual_summary_report.id\n answer.save\n end\n\n format.html { redirect_to @annual_summary_report }\n format.json { render :show, status: :created, location: @annual_summary_report }\n else\n format.html { render :new }\n format.json { render json: @annual_summary_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assignment = Assignment.new(params[:assignment])\n @assignment.notification_type = params[:notification_type].to_s\n @assignment.user = User.find(current_user)\n @courses = Course.where(:user_id => @assignment.user)\n \n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render json: @assignment, status: :created, location: @assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_successful_sign_up\n# topicid = sign_up_topics(:first_topic).id\n\n # Setup the session\n# @request.session[:user] = users(:student_team_formation1)\n \n #call the sign_up_topic controller to sign up the user for topic.\n #SignUpSheetController.signup\n# get(:signup, {'assignment_id' => assignments(:assignment_team_formation).id}, {'confirm_by' => 0}, {'id' => topicid}) \n \n #This should pass fine as the student is paired with student_team_formation2 and max required\n #students for topic is 2\n #Check for no error message\n #assert_equal flash[:error], nil\n \n #backup code\n #assert_response :redirect\n #assert_equal Assignment.count, number_of_assignment\n #assert Assignment.find(:all, :conditions => \"name = 'updatedAssignment9'\")\n end",
"def create\n @assignment_standard_assignment = Assignment::StandardAssignment.new(params[:assignment_standard_assignment])\n\n respond_to do |format|\n if @assignment_standard_assignment.save\n format.html { redirect_to @assignment_standard_assignment, notice: 'Standard assignment was successfully created.' }\n format.json { render json: @assignment_standard_assignment, status: :created, location: @assignment_standard_assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment_standard_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @action_report = ActionReport.new(action_report_params)\n\n respond_to do |format|\n if @action_report.save\n format.html { redirect_to @action_report, notice: 'Action report was successfully created.' }\n format.json { render :show, status: :created, location: @action_report }\n else\n format.html { render :new }\n format.json { render json: @action_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_new_microtask\r\n #@assignment = assignments(:Assignment_Microtask1)\r\n questionnaire_id = questionnaires(:questionnaire1).id\r\n instructorid = users(:instructor1).id\r\n courseid = courses(:course_object_oriented).id,\r\n number_of_topics = SignUpTopic.count\r\n # create a new assignment\r\n post :new, :assignment => { :name => \"Assignment_Microtask1\",\r\n :directory_path => \"CSC517_instructor1/Assignment_Microtask1\",\r\n :submitter_count => 0,\r\n :course_id => courseid,\r\n :instructor_id => instructorid,\r\n :num_reviews => 1,\r\n :num_review_of_reviews => 0,\r\n :num_review_of_reviewers => 0,\r\n :review_questionnaire_id => questionnaire_id,\r\n :reviews_visible_to_all => 0,\r\n :require_signup => 0,\r\n :num_reviewers => 3,\r\n :team_assignment => 0,\r\n :team_count => 1,\r\n :microtask => true }\r\n\r\n assert_response 200\r\n assert Assignment.find(:all, :conditions => \"name = 'Assignment_Microtask1'\")\r\n\r\n end",
"def create\n @test_subject_evaluation = TestSubjectEvaluation.new(params[:test_subject_evaluation])\n\n @test_subject_evaluation.test_subject = @test_subject\n\n respond_to do |format|\n if @test_subject_evaluation.save\n flash[:notice] = \"#{TestSubject.title} Evaluation was successfully created.\"\n format.html { redirect_to(test_subject_test_subject_evaluation_url(@test_subject, @test_subject_evaluation)) }\n format.xml { render :xml => @test_subject_evaluation, :status => :created, :location => @test_subject_evaluation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_subject_evaluation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create \n if logged_in?\n assignment_instructor\n @assignment = @instructor.assignments.build(assignment_params)\n if @assignment.save \n flash[:notice] = \"Successfully saved new assignment\"\n redirect_to instructor_assignment_path(@instructor, @assignment)\n else \n flash[:notice] = \"Please fill in all required fields\"\n render :new \n end \n else\n flash[:notice] = \"Must be logged in to manage account\"\n redirect_to '/login'\n end \n end",
"def create\n @assigned = Assigned.new(assigned_params)\n @table = Relation.find_by_name( @assigned.relation )\n if @table.present?\n if RelationsController.check_permissions( @assigned.grantor, @assigned.relation, true )\n if RelationsController.check_permissions( @assigned.grantee, @assigned.relation, false )\n Log.new({user: current_user.user, \n subject: \"user:\"+@assigned.grantee,\n operation: \"granted access\",\n object: \"table:\"+@assigned.relation,\n parameters: \"canGrant:\"+@assigned.can_grant.to_s\n }).save\n respond_to do |format|\n if @assigned.save\n format.html { redirect_to @assigned, notice: 'Grant was successfully created.' }\n format.json { render :show, status: :created, location: @assigned }\n else\n format.html { redirect_to assigneds_path, notice: 'Problem saving Assigned.' }\n format.json { render json: @assigned.errors, status: :unprocessable_entity }\n end\n end\n else\n Log.new({user: current_user.user, \n subject: \"user:\"+@assigned.grantee,\n operation: \"GRANT DENIED\",\n object: \"table:\"+@assigned.relation,\n parameters: \"grantee:\"+@assigned.grantee\n }).save\n respond_to do |format|\n format.html { redirect_to :root, notice: @assigned.grantee+' does not have access to table '+@assigned.relation }\n format.json { render json: @assigned.errors, status: :unprocessable_entity }\n end\n end\n else\n Log.new({user: current_user.user, \n subject: \"user:\"+@assigned.grantee,\n operation: \"ACCESS DENIED\",\n object: \"table:\"+@assigned.relation,\n parameters: \"canGrant:\"+@assigned.can_grant.to_s\n }).save\n respond_to do |format|\n format.html { redirect_to :root, notice: 'Access denied to '+@assigned.relation }\n format.json { render json: @assigned.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to :root, notice: 'Table not found: '+@assigned.relation }\n format.json { render json: @assigned.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_assignment = UserAssignment.new(user_assignment_params)\n\n respond_to do |format|\n if @user_assignment.save\n format.html { redirect_to current_user, notice: 'Worker was successfully added' }\n format.json { render :show, status: :created, location: @user_assignment.assignment }\n\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @patient_provider_assignment = PatientProviderAssignment.new(params[:patient_provider_assignment])\n @patient_provider_assignment.patient_id = @patient.id\n\n respond_to do |format|\n if @patient_provider_assignment.save\n flash[:notice] = 'PatientProviderAssignment was successfully created.'\n format.html { redirect_to(@patient) }\n format.xml { render :xml => @patient_provider_assignment, :status => :created, :location => @patient_provider_assignment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @patient_provider_assignment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def assignment_params\n params.require(:assignment).permit(:metric_id, :test_id, :test_slot)\n end",
"def create\n report_variable = create_report_variable\n ok = report_variable.persisted?\n notify(ok, :successful_report_variable_create, :failure_in_report_variable_create)\n ok ? redirect_to(edit_report_path(current_report)) : locals(:new, :report_variable => report_variable)\n end",
"def create\n @techers_assignment = TechersAssignment.new(techers_assignment_params)\n\n respond_to do |format|\n if @techers_assignment.save\n format.html { redirect_to @techers_assignment, notice: 'Techers assignment was successfully created.' }\n format.json { render :show, status: :created, location: @techers_assignment }\n else\n format.html { render :new }\n format.json { render json: @techers_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.find(params[:group_id])\n @assignment = @group.assignments.build(params[:assignment])\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to [:teacher, @group], notice: 'Assignment was successfully created.' }\n format.json { render json: @assignment, status: :created, location: @assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_report\n print_sales_report_ASCII\n print_date\n print_products_ASCII\n print_brands_ASCII\n end",
"def create\n raise \"Disabled\"\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # existing = Assignment.where(classroom_id: params[:classroom_id], repo_url: params[:repo_url])\n # if !existing.first.nil?\n # return error_as_json(\"Assignment #{params[:repo_url]} already exists for classroom #{params[:classroom_id]}\")\n # end\n @assignment = Assignment.new(assignment_params)\n @assignment.save ? info_as_json(\"Created assignment #{@assignment.name}\") : error_as_json(@assignment.errors)\n end",
"def create\n if current_user.company.reports.any?\n if [\"Queued\", \"Running\"].include? current_user.company.reports.last.status\n redirect_to dashboard_path, notice: \"Looks like you already have a report queued. We'll get to it asap, promise!\"\n return\n end\n end\n \n @report = Report.new(report_params) \n\n respond_to do |format|\n if @report.save\n \n @report.test_suite.test_cases.order('id ASC').each do |test_case|\n @report.results.create({ status: 'Queued', report_id: @report, test_case_id: test_case.id})\n end\n \n ReportMailer.admin_requested_report_triggered_email(@report).deliver\n #ReportMailer.requested_report_triggered_email(@report).deliver\n \n format.html { redirect_to dashboard_path }\n format.json { render action: 'show', status: :created, location: @report }\n else\n format.html { render action: 'new' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_new_report!\n File.write(report_filename, report_title + report_body)\n end",
"def create\n @reportabus = Reportabuse.new(reportabus_params)\n @reportabus.reporter_id = current_user.id\n respond_to do |format|\n if @reportabus.save\n format.html { redirect_to '/reportabuses/', notice: 'Reportabuse was successfully created.' }\n format.json { render :show, status: :created, location: @reportabus }\n else\n format.html { render :new }\n format.json { render json: @reportabus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_grader_that_has_active_report_cant_take_on_another_report\n login_as :sean\n post :auto_assign\n assert_redirected_to :controller => :home, :action=>:index\n end",
"def new\n @assignments = Assignment.all\n @assignment = Assignment.new\n if params[:scanned].present?\n @assignment.scanned_exam = true\n end\n @clone_assignments = Assignment.where(vcs_submit: true)\n .order(:id)\n @sections = Section.all\n @assignment.build_submission_rule\n @assignment.build_assignment_stat\n\n # build section_due_dates for each section\n Section.all.each { |s| @assignment.section_due_dates.build(section: s)}\n @section_due_dates = @assignment.section_due_dates\n .sort_by { |s| s.section.name }\n\n # set default value if web submits are allowed\n @assignment.allow_web_submits =\n !MarkusConfigurator.markus_config_repository_external_submits_only?\n render :new\n end",
"def create\n @assignment = Assignment.new(assignment_params.merge(lecturer_id: current_user.id))\n\n if @assignment.save\n if params[:projects_attributes]\n render json: @assignment,\n serializer: Includes::AssignmentSerializer,\n include: 'projects',\n status: :created\n else\n render json: @assignment, status: :created\n end\n else\n render json: format_errors(@assignment.errors),\n status: :unprocessable_entity\n end\n end",
"def test_unique_assignment_name_within_course_id\n a = Assignment.create(course_id: 1, name: \"Assignment 1\", percent_of_grade: 20.00)\n a1 = Assignment.new(course_id: 2, name: \"Assignment 1\", percent_of_grade: 20.00)\n assert a1.save\n a2 = Assignment.create(course_id: 3, name: \"Assignment 3\", percent_of_grade: 20.00)\n a3 = Assignment.new(course_id: 3, name: \"Assignment 3\", percent_of_grade: 20.00)\n refute a3.save\n end",
"def test_add_participant()\n\t\tparticipant = Participant.new\n assert participant.valid?\n\t\t#TODO Should an empty Participant be allowed?\n\t\t# assert !participant.valid?\n\t\t#TODO Define required fields in test and add those validations to the model so test passes.\n user = users(:student1)\n participant.user= user\n participant.assignment= assignments(:assignment1)\n\t\tassert participant.valid?\n assert \"student1\", participant.name\n assert \"student1_fullname\", participant.fullname\n assert \"assignment 1\", participant.assignment.name\n\tend",
"def create\n @test_plan = TestPlan.new(params[:test_plan])\n @test_plan.report_definitions << ReportDefinition.find(params[:report_definition_id]) if params[:report_definition_id]\n\n respond_to do |format|\n if @test_plan.save\n format.html { redirect_to @test_plan, notice: 'Test plan was successfully created.' }\n format.json { render json: @test_plan, status: :created, location: @test_plan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_assignment_node\n @assignment.create_node unless @assignment.nil?\n end",
"def create\n @assignment_employee = AssignmentEmployee.new(assignment_employee_params)\n\n respond_to do |format|\n if @assignment_employee.save\n format.html { redirect_to @assignment_employee, notice: 'Assignment employee was successfully created.' }\n format.json { render :show, status: :created, location: @assignment_employee }\n else\n format.html { render :new }\n format.json { render json: @assignment_employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_assignment\n return TestCase.find(params[:id]).assignment\n end",
"def create\n if current_user.admin?\n @report = Report.new(report_params)\n respond_to do |format|\n if @report.save\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_back :fallback_location => root_path, :alert => \"Access denied.\"\n end\n end",
"def create\n @failure_report = FailureReport.new(failure_report_params)\n @failure_report.author = current_user\n\n respond_to do |format|\n if @failure_report.save\n format.html { redirect_to @failure_report, notice: 'Failure report was successfully created.' }\n format.json { render action: 'show', status: :created, location: @failure_report }\n else\n format.html { render action: 'new' }\n format.json { render json: @failure_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_report\n end",
"def create\n @assignment_log = AssignmentLog.new(assignment_log_params)\n\n respond_to do |format|\n if @assignment_log.save\n format.html { redirect_to @assignment_log, notice: 'Assignment log was successfully created.' }\n format.json { render :show, status: :created, location: @assignment_log }\n else\n format.html { render :new }\n format.json { render json: @assignment_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @abuse_report = AbuseReport.new(params[:abuse_report])\n\n if @abuse_report.save\n AdminMailer.deliver_abuse_report(@abuse_report.email, @abuse_report.url, @abuse_report.comment)\n flash[:notice] = t('abuse_report_sent', :default => 'The Abuse Report was sent to the abuse team email alias.')\n redirect_to ''\n else\n render :action => 'new'\n end\n end",
"def create_assignment(name)\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/assignments\"\n puts \"@url is #{@url}\"\n\n @payload={'assignment': { \n 'name': name,\n 'points_possible': '0',\n 'grading_type': 'pass_fail',\n 'published': 'true',\n 'submission_types': [ \"none\" ]\n }\n }\n\n @postResponse = HTTParty.post(@url, :body => @payload.to_json, :headers => $header )\n puts(\" POST to create assignment has Response.code #{@postResponse.code} and postResponse is #{@postRepsone}\")\nend"
] |
[
"0.6981552",
"0.64904445",
"0.6470197",
"0.6369361",
"0.62846583",
"0.62846583",
"0.6195638",
"0.61498445",
"0.6143314",
"0.6131525",
"0.6127125",
"0.6093784",
"0.6082833",
"0.6043959",
"0.60354584",
"0.6031244",
"0.6025659",
"0.6022759",
"0.59975857",
"0.59962714",
"0.5995922",
"0.5983447",
"0.59669864",
"0.59472144",
"0.5920697",
"0.5916736",
"0.59166545",
"0.59060764",
"0.5893319",
"0.58889145",
"0.58575827",
"0.5852513",
"0.5852513",
"0.5848471",
"0.5842441",
"0.58327943",
"0.5831471",
"0.5831331",
"0.58267856",
"0.5812008",
"0.5807622",
"0.5795427",
"0.5785041",
"0.57807493",
"0.5777568",
"0.57710767",
"0.5769515",
"0.5764051",
"0.57596236",
"0.5758288",
"0.5739629",
"0.57278943",
"0.57219166",
"0.5720146",
"0.571495",
"0.569634",
"0.5694759",
"0.5691874",
"0.5690698",
"0.56721485",
"0.5664889",
"0.5659215",
"0.5655126",
"0.56507534",
"0.56499755",
"0.56483155",
"0.564208",
"0.56410915",
"0.5635939",
"0.5625929",
"0.56197137",
"0.56154203",
"0.56108487",
"0.5610442",
"0.56100744",
"0.560054",
"0.5595065",
"0.5583864",
"0.55669475",
"0.5564901",
"0.55627733",
"0.55526674",
"0.55487",
"0.55486757",
"0.55310714",
"0.5529469",
"0.55294657",
"0.5528462",
"0.5523742",
"0.55204785",
"0.5519841",
"0.5516025",
"0.5513988",
"0.5511539",
"0.55082804",
"0.550683",
"0.5506071",
"0.5505967",
"0.5495257",
"0.54840624"
] |
0.7563527
|
0
|
test_static_view Description: This method does the functional testing of the static_view view.
|
def test_static_view
first_assignment = oi_assignments(:first)
# Try accessing from an account that is not a PCB Designer and
# verify that the user is redirected.
get(:static_view, { :id => first_assignment }, siva_designer_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
get(:static_view, {:id => first_assignment}, scott_designer_session)
assert_equal(first_assignment.id, assigns(:assignment).id)
assert_equal(oi_category_sections(:placement_3), assigns(:section))
assert_equal(designs(:mx234a), assigns(:design))
assert_equal([], assigns(:comments))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_index \n get :index\n assert_response :success\n assert_template 'index'\n end",
"def test_index \n get :index\n assert_response :success\n assert_template 'index'\n end",
"def test_should_show_index\n login_as :admin\n\n get :index\n assert_response :success\n assert_template 'list'\n end",
"def test_view\n # Test a non-existent user\n get :view, :params => { :display_name => \"unknown\" }\n assert_response :not_found\n\n # Test a normal user\n user = create(:user)\n get :view, :params => { :display_name => user.display_name }\n assert_response :success\n assert_select \"div#userinformation\" do\n assert_select \"a[href^='/user/#{ERB::Util.u(user.display_name)}/history']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/traces']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/diary']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/diary/comments']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/account']\", 0\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/blocks']\", 0\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/blocks_by']\", 0\n assert_select \"a[href='/blocks/new/#{ERB::Util.u(user.display_name)}']\", 0\n end\n\n # Test a user who has been blocked\n blocked_user = create(:user)\n create(:user_block, :user => blocked_user)\n get :view, :params => { :display_name => blocked_user.display_name }\n assert_response :success\n assert_select \"div#userinformation\" do\n assert_select \"a[href^='/user/#{ERB::Util.u(blocked_user.display_name)}/history']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(blocked_user.display_name)}/traces']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(blocked_user.display_name)}/diary']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(blocked_user.display_name)}/diary/comments']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(blocked_user.display_name)}/account']\", 0\n assert_select \"a[href='/user/#{ERB::Util.u(blocked_user.display_name)}/blocks']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(blocked_user.display_name)}/blocks_by']\", 0\n assert_select \"a[href='/blocks/new/#{ERB::Util.u(blocked_user.display_name)}']\", 0\n end\n\n # Test a moderator who has applied blocks\n moderator_user = create(:moderator_user)\n create(:user_block, :creator => moderator_user)\n get :view, :params => { :display_name => moderator_user.display_name }\n assert_response :success\n assert_select \"div#userinformation\" do\n assert_select \"a[href^='/user/#{ERB::Util.u(moderator_user.display_name)}/history']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(moderator_user.display_name)}/traces']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(moderator_user.display_name)}/diary']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(moderator_user.display_name)}/diary/comments']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(moderator_user.display_name)}/account']\", 0\n assert_select \"a[href='/user/#{ERB::Util.u(moderator_user.display_name)}/blocks']\", 0\n assert_select \"a[href='/user/#{ERB::Util.u(moderator_user.display_name)}/blocks_by']\", 1\n assert_select \"a[href='/blocks/new/#{ERB::Util.u(moderator_user.display_name)}']\", 0\n end\n\n # Login as a normal user\n session[:user] = user.id\n\n # Test the normal user\n get :view, :params => { :display_name => user.display_name }\n assert_response :success\n assert_select \"div#userinformation\" do\n assert_select \"a[href^='/user/#{ERB::Util.u(user.display_name)}/history']\", 1\n assert_select \"a[href='/traces/mine']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/diary']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/diary/comments']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/account']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/blocks']\", 0\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/blocks_by']\", 0\n assert_select \"a[href='/blocks/new/#{ERB::Util.u(user.display_name)}']\", 0\n end\n\n # Login as a moderator\n session[:user] = create(:moderator_user).id\n\n # Test the normal user\n get :view, :params => { :display_name => user.display_name }\n assert_response :success\n assert_select \"div#userinformation\" do\n assert_select \"a[href^='/user/#{ERB::Util.u(user.display_name)}/history']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/traces']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/diary']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/diary/comments']\", 1\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/account']\", 0\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/blocks']\", 0\n assert_select \"a[href='/user/#{ERB::Util.u(user.display_name)}/blocks_by']\", 0\n assert_select \"a[href='/blocks/new/#{ERB::Util.u(user.display_name)}']\", 1\n end\n end",
"def test_show_partial\n return if Rails.env.production?\n test_tag {render '/sandboxes/test'}\n end",
"def _view; end",
"def test_how_it_works \n get :how_it_works\n assert_response :success\n assert_template 'how_it_works'\n end",
"def test_view_user_account\n get :view\n assert_response :not_found\n \n get :view, {:display_name => \"test\"}\n assert_response :success\n end",
"def test\n render(text: \"test\")\n end",
"def test\n\n render layout: 'views/index'\n\n end",
"def should_have_correct_static_pages_links\n\tvisit root_path\n\tclick_link \"About\"\n\tpage.should have_selector 'title', text: full_title('About Us')\n\tclick_link \"Help\"\n\tpage.should have_selector 'title', text: full_title('Help')\n\tclick_link \"Contact\"\n\tpage.should have_selector 'title', text: full_title('Contact')\n\tclick_link \"Home\"\n\tclick_link \"Sign up now!\"\n\tpage.should have_selector 'title', text: full_title('Sign up')\n\tclick_link \"social app\"\n\tpage.should have_selector 'title', text: 'Social App'\nend",
"def execute_static_tests\n result = nil\n code = self.without_comments\n self.test_cases.only_static.each do |test_case|\n this_result = test_case.apply_static_check(self, code)\n if !result && this_result\n result = this_result\n end\n end\n result\n end",
"def should_have_correct_static_pages_links\n visit root_path\n\tclick_link \"About\"\n\tpage.should have_selector 'title', text: 'About'\n\tclick_link \"Home\"\n\tclick_link \"Sign up now!\"\n\tpage.should have_selector 'title', text: 'Sign up'\n\tclick_link \"pbook\"\n\tpage.should have_selector 'title', text: 'PammBook'\nend",
"def test_index\n get :index\n assert_response :success\n assert_equal assigns(:title), \"Blog\"\n assert_template 'index.rhtml'\n assert_not_nil assigns(:content_nodes)\n \n # Assert the blog posts are being shown.\n assert_select \"a\", :count => 1, :text => content_nodes(:tinkerbel_pregnant).title\n assert_select \"a\", :count => 1, :text => content_nodes(:pigasus_awards).title\n assert_select \"a\", :count => 1, :text => content_nodes(:silent_birth).title\n end",
"def test_index\n get :index\n assert_response :success\n end",
"def test_index\n get :index\n assert_response :success\n end",
"def should_display_about_and_features\n controller.controller_name == \"static_pages\"\n end",
"def test_index \n get :index \n assert_response :success \n end",
"def test_feature_for_static_page\r\n\t\tfeatures = Feature.for_static_page(static_pages(:home).id, 99)\r\n\r\n\t\tassert_equal(2, features.length)\r\n\t\tassert_equal(true, features.include?(products(:optioner)))\r\n\t\tassert_equal(true, features.include?(products(:cow2)))\r\n\r\n\t\tfeatures = Feature.for_static_page(static_pages(:aboutus).id, 99)\r\n\r\n\t\tassert_equal(1, features.length)\r\n\t\tassert_equal(true, features.include?(products(:cow3)))\r\n\r\n\t\t# check that the correct number is given when the number to return is < the number of\r\n\t\t# results found in the db\r\n\t\tfeatures = Feature.for_static_page(static_pages(:home).id, 1)\r\n\r\n\t\tassert_equal(1, features.length)\r\n\r\n\t\tfeatures = Feature.for_static_page(static_pages(:home).id)\r\n\r\n\t\tassert_equal(1, features.length)\r\n\r\n\t\t# check a blank return\r\n\t\tfeatures = Feature.for_static_page(static_pages(:contactus).id, 1)\r\n\r\n\t\tassert_equal(0, features.length)\r\n\tend",
"def test_show_by_id\n # TODO: Template is missing for this action.\n a_content_node = content_nodes(:home)\n \n assert_raise(ActionView::MissingTemplate) do\n get :show, :id => a_content_node.id\n end\n end",
"def loc_view\n \n end",
"def test_show\n login\n xhr :get, :show, :id => 2\n assert assigns(:group)\n assert_response :success\n assert_template('show')\n end",
"def test_all \n get :all\n assert_response :success\n assert_template 'all'\n\n\n end",
"def test_index\n get :index\n assert_response :success\n ## должен прийти флеш\n assert_tag :tag=>'object'\n end",
"def test_designer_home\n\n post('index', {}, {})\n assert_response(:success)\n assert_template('tracker/index')\n\n post('index', {}, bob_designer_session)\n assert_response(:success)\n assert_template('tracker/designer_home')\n\n end",
"def test_index\n login\n get(:index)\n default_sorted_by = \"sort_by_#{::Query::ImageBase.default_order}\".to_sym.l\n\n assert_template(\"index\")\n assert_template(partial: \"_matrix_box\")\n assert_displayed_title(\"Images by #{default_sorted_by}\")\n end",
"def test_index\n login\n get(:index)\n\n assert_displayed_title(\"Names by Name\")\n end",
"def first_mandate\n # renders static page\n end",
"def mock_action_view(assigns = {})\n controller = ActionView::TestCase::TestController.new\n ActionView::Base.send :include, ActionView::Helpers\n ActionView::Base.send :include, ActiveAdmin::ViewHelpers\n ActionView::Base.send :include, Rails.application.routes.url_helpers\n ActionView::Base.new(ActionController::Base.view_paths, assigns, controller)\n end",
"def random_view\n if GameController::USE_MEMCACHED\n xprev = Cache.get(\"scalability_test_random_view_x\")\n yprev = Cache.get(\"scalability_test_random_view_y\")\n if (xprev != nil && yprev != nil)\n xpos = xprev\n ypos = yprev\n else\n xpos = (rand() * 100 + ScalabilityTest::TEST_NEWUSER_STARTX).to_i\n ypos = (rand() * 100 + ScalabilityTest::TEST_NEWUSER_STARTY).to_i\n Cache.put(\"scalability_test_random_view_x\", xpos, 30)\n Cache.put(\"scalability_test_random_view_y\", ypos, 30)\n end\n else\n xpos = (rand() * 100 + ScalabilityTest::TEST_NEWUSER_STARTX).to_i\n ypos = (rand() * 100 + ScalabilityTest::TEST_NEWUSER_STARTY).to_i\n end\n if GameController::USE_MEMCACHED\n if Zone.MEMCACHED_ViewportSame(xpos, xpos + ScalabilityTest::VIEW_W, ypos, ypos + ScalabilityTest::VIEW_H) \n @zonedata_str = Zone.MEMCACHED_LoadZoneXML\n else\n @zonedata = Zone.find_zones_in_view_xml(xpos, xpos + ScalabilityTest::VIEW_W, ypos, ypos + ScalabilityTest::VIEW_H)\n @zonedata_str = Zone.MEMCACHED_SaveZoneXML(xpos, xpos + ScalabilityTest::VIEW_W, ypos, ypos + ScalabilityTest::VIEW_H, @zonedata)\n end\n else\n @zonedata = Zone.find_zones_in_view_xml(xpos, xpos + ScalabilityTest::VIEW_W, ypos, ypos + ScalabilityTest::VIEW_H)\n end\n #cache will be effective for 30 seconds\n respond_to do |format|\n format.xml { render :layout => false}\n end\n # redirect_to( :controller => \"users\", :action => \"index\" )\n end",
"def test_index\n assert_response 200\n end",
"def after_view_setup\n end",
"def accessibility_statement\n # renders static page\n end",
"def visit_static_page\n visiting = STATIC_LOCATIONS[Kernel.rand(STATIC_LOCATIONS.size)]\n puts \"Competitor #{@id} is visiting #{visiting}\"\n @browser.location = @base_url + visiting\n raise \"Visiting #{visiting} led to an error\" unless @browser.is200\n end",
"def test_overly_specific\n make_controller :overly_specific\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_protected\n end",
"def stub_view_routes\n\n view.stub( :experiment_path ).and_return( '/split_cat/experiment' )\n view.stub( :experiments_path ).and_return( '/split_cat/experiments' )\n view.stub( :new_experiment_path ).and_return( '/split_cat/experiments/new' )\n\nend",
"def view; end",
"def test_reviewer_home\n\n post('index', {}, {})\n assert_response(:success)\n assert_template('tracker/index')\n \n post('index', {}, lee_hweng_session)\n assert_response(:success)\n assert_template('tracker/reviewer_home')\n\n #follow_redirect\n #assert_no_tag :content => \"POST Placement Review\"\n\n end",
"def test_index \n post :index \n assert_response :success \n end",
"def test_get_index\n get :index\n assert_response :success\n end",
"def test_index\n get :index\n assert_response :success\n assert assigns(:for_hires)\n assert_template 'index'\n end",
"def test_should_get_sitemap\n get :index\n assert_response :success\n end",
"def test_static\n\n ENV['TM_SCOPE'] = 'source.actionscript.3'\n\n ENV['TM_CURRENT_LINE'] = <<-EOF\n Math. notStatic Math(). new Bottle().cider\n EOF\n\n ENV['TM_LINE_INDEX'] = '11'\n assert_equal true, PropertyInspector.is_static\n\n ENV['TM_LINE_INDEX'] = '10'\n assert_equal true, PropertyInspector.is_static\n\n ENV['TM_LINE_INDEX'] = '21'\n assert_equal false, PropertyInspector.is_static\n\n ENV['TM_LINE_INDEX'] = '24'\n assert_equal false, PropertyInspector.is_static\n\n ENV['TM_LINE_INDEX'] = '33'\n assert_equal false, PropertyInspector.is_static\n\n ENV['TM_LINE_INDEX'] = '31'\n assert_equal false, PropertyInspector.is_static\n\n ENV['TM_LINE_INDEX'] = '30'\n assert_equal true, PropertyInspector.is_static\n\n ENV['TM_LINE_INDEX'] = '46'\n assert_equal false, PropertyInspector.is_static\n\n ENV['TM_LINE_INDEX'] = '54'\n assert_equal false, PropertyInspector.is_static\n\n end",
"def test_index_authorized\n authorize @valid_user\n get :index\n assert_response :success\n assert_template \"index\"\n end",
"def w3c_tests\n render(layout: false)\n end",
"def assert_basic_layout\n get topic_path(@topic)\n # Posts index is actually topic show.\n assert_template 'posts/index'\n # Assert there is topic title.\n assert_match CGI.escapeHTML(@topic.title), response.body\n # Assert there is current_page/total_pages indicator.\n current_page = assigns(:posts).current_page\n total_pages = assigns(:posts).total_pages\n assert_match CGI.escapeHTML(\"#{current_page}/#{total_pages}\"), response.body\n # Asset there is link to corresponding category.\n assert_select 'a[href=?]', category_path(@topic.category)\n # Assert there is will_paginate on the page.\n assert_select 'ul.pagination', count: 1\n # Assert there is no flash messages.\n assert_flash_notices\n end",
"def setup_static\n setup_adapters(phase: :static)\n end",
"def test_show\n #login_as(:john)\n #get :show, :id => @first_id\n\n #assert_response :success\n #assert_template 'show'\n\n #assert_not_nil assigns(:taverna_enactor)\n #assert assigns(:taverna_enactor).valid?\n \n assert true\n end",
"def tests(controller_class); end",
"def test_news\n get 'index'\n assert_tag :tag=>'div', :attributes=>{:class=>'newsitem'}\n assert_tag :tag=>'div', :attributes=>{:id=>'newsbar'}\n end",
"def test_view\n\n checklist_1_0 = checklists(:checklist_1_0)\n \n get(:view, { :id => checklist_1_0.id }, cathy_admin_session)\n assert_equal(checklist_1_0.id, assigns(:checklist).id)\n\n end",
"def test_index\n get '/'\n assert last_response.ok?\n end",
"def view\n end",
"def test_show_by_name_page\n a_content_node = content_nodes(:home)\n \n get :show_by_name, :name => a_content_node.name\n assert_response :success\n assert_equal assigns(:title), a_content_node.title\n assert_template 'show_by_name'\n assert_not_nil assigns(:content_node)\n \n # Assert the content node is being shown.\n assert_select \"h1\", :count => 1, :text => /Welcome to Substruct/\n end",
"def view_instance\n # view = if controller.response.template\n # controller.response.template\n # else\n View.new controller, master_helper_module\n # end\n \n # view.extend Extensions::View\n end",
"def test_05\n prepare_web_application\n assert_equal(200, Alfa::WebApplication.call({'PATH_INFO'=>'/frontend_only'})[0]) # defined in frontend/DefaultController\n assert_equal(404, Alfa::WebApplication.call({'PATH_INFO'=>'/admin/frontend_only'})[0]) # not defined in admin/DefaultController\n end",
"def mock_action_view(base = MockActionView)\n controller = ActionView::TestCase::TestController.new\n\n base.new(view_paths, {}, controller)\n end",
"def test_show_image\n\t\t#get :show, :path => 'photo1.jpg'\n\t\t#assert_response :success \n\tend",
"def test_url_generation\n page = new_page()\n assert_equal page.url, '/test'\n end",
"def testing\n # ...\n end",
"def setup\n router = self.class.router\n @controller = ActionView::TestCase::TestController.new\n @controller.instance_variable_set(:@_routes, router)\n @controller.class_eval do\n include router.url_helpers\n end\n\n @controller.view_context_class.class_eval do\n include router.url_helpers\n end\n end",
"def run()\n\t\tif Core::DEBUG\n\t\t\traise \"View #{self.class.name} can't be build because run method is not redefined.\"\t\t\n\t\tend\n\tend",
"def about\n # Static Page\n end",
"def test_show\n get '/category/1'\n end",
"def test_render_to_string_and_render\n get :render_to_string_and_render\n assert_equal(\"Hi web users! here is some cached stuff\", @response.body)\n end",
"def test_show\n get :show, :id => 1\n\n assert_response :success\n assert_template 'show'\n\n assert_not_nil assigns(:member)\n assert assigns(:member).valid?\n end",
"def test_index\n get :index\n assert_response :success\n assert_template 'index'\n assert_equal \"Store\", assigns(:title)\n assert_not_nil assigns(:tags)\n assert_not_nil assigns(:products)\n end",
"def test_get_content_for\n end",
"def define_rails_helper_methods!\n self.stub!(:render).and_return(\"rendered content\")\nend",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @static_page }\n end\n end",
"def test_make_sure_the_testing_structure_works\n make_controller :mock\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_response :success\n end",
"def show\n page = params[:page]\n puts \"the page is#{page}\"\n render \"statics#{page}\"\n end",
"def test_create_questionnaire_with_existing_name\r\n # It will raise an error while execute render method in controller\r\n # Because the goldberg variables didn't been initialized in the test framework\r\n assert_raise (ActionView::TemplateError){\r\n post :create_questionnaire, :save => true, \r\n :questionnaire => {:name => questionnaires(:questionnaire2).name, \r\n :type_id => 2,\r\n :min_question_score => 1,\r\n :max_question_score => 3, \r\n :id => @Questionnaire }\r\n } \r\n assert_template 'questionnaire/new_questionnaire'\r\n end",
"def test\n\n end",
"def index\n render layout: 'static_pages'\n end",
"def setup_index_view()\n # Perhaps I'm not doing something right...\n # I don't have a single line of duplicated code\n # in those in my get and post calls, so this is \n # difficult to refactor.\nend",
"def show\n# if params[:version]\n# @test_case = KoalaTestCase.find_version(params[:id], params[:version])\n# else\n @test_case = KoalaTestCase.find(params[:id])\n# end\n respond_to do |format|\n \n format.html do\n if params[:layout] != \"false\" \n render\n else\n end\n end\n\t\t\tformat.js { render :inline => \"<%=@test_case.body.blank? ? '':@test_case.body%>\" }\n format.xml { render :xml => @test_case }\n end\n end",
"def supports_views?\n true\n end",
"def test_specifics_index_views\n ebay_singles = generate_ebay_items_with_size(25, \"7\\\"\")\n ebay_singles.map {|ebay_item| ebay_item.save}\n get :singles, :page => 1, :sort => ENDTIME, :order => DESC\n check_index_items(ebay_singles.reverse[0..19])\n\n ebay_eps = generate_ebay_items_with_size(25, \"10\\\"\")\n save_ebay_items(ebay_eps)\n get :eps, :page => 1\n check_index_items(ebay_eps.reverse[0..19])\n\n ebay_lps = generate_ebay_items_with_size(25, \"LP\")\n save_ebay_items(ebay_lps)\n get :lps, :page => 1\n check_index_items(ebay_lps.reverse[0..19])\n\n other_items = generate_ebay_items_with_size(25, \"something else\")\n save_ebay_items(other_items)\n get :other, :page => 1\n check_index_items(other_items.reverse[0..19])\n end",
"def test_index\n get :index\n assert_response :success\n assert_not_nil assigns(:projects)\n end",
"def test_index\n create_document(\"about.md\") # setup necessary data\n create_document(\"changes.txt\")\n\n get \"/\"\n \n assert_equal(200, last_response.status)\n assert_equal(\"text/html;charset=utf-8\", last_response[\"Content-Type\"])\n assert_includes(last_response.body, \"about.md\")\n assert_includes(last_response.body, \"changes.txt\")\n\n end",
"def test_should_show_list\n login_as :admin\n \n # No parameters.\n get :list\n assert_response :success\n assert_template 'list'\n assert_equal assigns(:title), \"Manage Tags\"\n assert_not_nil assigns(:tags)\n end",
"def index\n @statics = Static.all\n end",
"def test_contradictory\n make_controller :contradictory\n get :index\n assert_response :success\n get :secret_ferret_brigade\n assert_response :success\n end",
"def public_menu_displayed\n assert_tag :tag => \"a\", :attributes => { :href => \"/home/index\"}, :content => \"Home\"\n assert_tag :tag => \"a\", :attributes => { :href => \"/users/sign_in\"}, :content => \"Login\"\n assert_no_tag :tag => \"a\", :content => \"Users\"\n assert_no_tag :tag => \"a\", :content => \"Logout\"\n end",
"def rendered_views=(_arg0); end",
"def rendered_views; end",
"def test_homepage\n\t\tget '/'\n\t\tassert last_response.ok?,\n\t\t\t\"Homepage loaded without an error.\"\n\t\tassert last_response.body.include?('Please leave me a message below!'),\n\t\t\t\"Expected text present.\"\n\tend",
"def test\n end",
"def test\n end",
"def test\n end",
"def show\n @static_page = StaticPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @static_page }\n end\n end",
"def render_static?\n @context.registers[:render_static?]\n end",
"def test_application_with_public_path\n assert_pattern_match [ \"/\", \"index.vwf\", nil, \"file.ext\" ], \"/file.ext\"\n assert_pattern_match [ \"/\", \"component.vwf\", nil, \"file.ext\" ], \"/component.vwf/file.ext\"\n assert_pattern_match [ \"/directory\", \"index.vwf\", nil, \"file.ext\" ], \"/directory/file.ext\"\n assert_pattern_match [ \"/directory\", \"component.vwf\", nil, \"file.ext\" ], \"/directory/component.vwf/file.ext\"\n end",
"def test_show_as_edit_as_specified_as_a_block\n @controller = SquirrelsController.new\n \n get \"show\", :id => @bob, :view => 'name_as_a_block' \n assert_equal(\"showing name\", @response.body)\n\n get \"edit\", :id => @bob, :view => 'name_as_a_block'\n assert_equal(\"editing name\", @response.body)\n end",
"def public_menu_displayed\n assert_tag :tag => \"a\", :attributes => { :href => \"/home/index\"}, :content => \"Home\"\n assert_tag :tag => \"a\", :attributes => { :href => \"/users/sign_up\"}, :content => \"Register\"\n assert_tag :tag => \"a\", :attributes => { :href => \"/users/sign_in\"}, :content => \"Login\"\n assert_no_tag :tag => \"a\", :content => \"Contacts\"\n assert_no_tag :tag => \"a\", :content => \"Companies\"\n assert_no_tag :tag => \"a\", :content => \"Calendar\"\n assert_no_tag :tag => \"a\", :content => \"Admin\"\n assert_no_tag :tag => \"a\", :content => \"Logout\"\n end",
"def test_safe_squirrels\n @controller = SafeSquirrelsController.new\n \n get \"show\", :id => @bob, :view => 'stuff'\n assert_equal(\"<span id='squirrel_name'>Bob</span>\", @response.body)\n end",
"def test_04\n prepare_web_application\n #puts Alfa::Router.instance_variable_get(:@routes).inspect\n assert_equal(\"Frontend\\n\", Alfa::WebApplication.call({'PATH_INFO'=>'/test_04'})[2].join)\n assert_equal(\"Admin\\n\", Alfa::WebApplication.call({'PATH_INFO'=>'/admin/test_04'})[2].join)\n assert_equal(\"Frontend\\n\", Alfa::WebApplication.call({'PATH_INFO'=>'/test_04'})[2].join) # call controller after calling same name controller should not interleave controller variables\n assert_equal(\"Admin\\n\", Alfa::WebApplication.call({'PATH_INFO'=>'/admin/test_04'})[2].join)\n end",
"def builder_partial_test\n render action: \"hello_world_container\"\n end",
"def view\n @_view\n end"
] |
[
"0.620146",
"0.6173631",
"0.61484206",
"0.59964097",
"0.5978809",
"0.59613407",
"0.5932028",
"0.59311694",
"0.5916225",
"0.5893453",
"0.5809368",
"0.5800353",
"0.57798797",
"0.5766727",
"0.57615876",
"0.57615876",
"0.5761294",
"0.5752731",
"0.57192093",
"0.5706943",
"0.5693311",
"0.567006",
"0.5629494",
"0.56278366",
"0.56259674",
"0.5620303",
"0.5601731",
"0.5593951",
"0.55936676",
"0.5590873",
"0.5571981",
"0.55717266",
"0.5561705",
"0.5560529",
"0.5560355",
"0.5555619",
"0.55520713",
"0.55490375",
"0.5544366",
"0.5528985",
"0.5520651",
"0.5504701",
"0.55031437",
"0.5494827",
"0.5444974",
"0.54437584",
"0.5431146",
"0.54286885",
"0.5416611",
"0.54162693",
"0.539535",
"0.53934824",
"0.5379631",
"0.5366711",
"0.5359614",
"0.5356986",
"0.53542227",
"0.5342043",
"0.5327936",
"0.531388",
"0.5310147",
"0.530633",
"0.5296897",
"0.52904326",
"0.5283877",
"0.5278959",
"0.5276584",
"0.52673876",
"0.52615416",
"0.52576303",
"0.5257586",
"0.5250466",
"0.52401197",
"0.5240119",
"0.52379644",
"0.52334785",
"0.52218795",
"0.5219625",
"0.52183026",
"0.5216226",
"0.5214054",
"0.5208331",
"0.52058643",
"0.5204872",
"0.52026725",
"0.519909",
"0.5171731",
"0.5169463",
"0.51685184",
"0.51685184",
"0.51685184",
"0.5166694",
"0.5165682",
"0.51559913",
"0.5149723",
"0.5149628",
"0.51469123",
"0.51443166",
"0.51419276",
"0.5139871"
] |
0.6990885
|
0
|
test_view_assignment_report Description: This method does the functional testing of the view assignment report view.
|
def test_view_assignment_report
first_assignment = oi_assignments(:first)
# Try accessing from an account that is not a PCB Designer and
# verify that the user is redirected.
get(:view_assignment_report, { :id => first_assignment }, siva_designer_session)
assert_redirected_to(:controller => 'tracker', :action => 'index')
assert_equal("You are not authorized to access this page", flash['notice'])
get(:view_assignment_report, { :id => first_assignment }, scott_designer_session)
assert_equal(first_assignment.id, assigns(:assignment).id)
assert_equal([], assigns(:comments))
assert_equal(OiAssignmentReport.report_card_scoring, assigns(:scoring_table))
assert_equal("0% Rework", assigns(:current_score))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_create_assignment_report\n \n first_report = oi_assignment_reports(:first)\n \n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:create_assignment_report, { :id => oi_assignment_reports(:first) }, lee_hweng_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n get(:create_assignment_report, {:id => first_report}, scott_designer_session)\n assert_equal(first_report.id, assigns(:assignment).id)\n assert_equal(1, assigns(:complexity_id))\n assert_equal(OiAssignmentReport::NOT_SCORED, assigns(:report).score)\n assert_equal([], assigns(:comments))\n assert_equal(OiAssignmentReport.report_card_scoring,\n assigns(:scoring_table))\n \n # Verify the redirect to create_assignment_report by create report when the \n # report has not been scored.\n \n \n end",
"def test_illegal_edit_assignment\r\n\r\n id = Assignment.first.id\r\n @assignment = Assignment.first\r\n original_assignment_name = @assignment.name\r\n number_of_assignment = Assignment.count\r\n # It will raise an error while execute render method in controller\r\n # Because the goldberg variables didn't been initialized in the test framework\r\n assert_raise (ActionView::TemplateError){\r\n post :update, :id => id, :assignment=> { :name => '',\r\n :directory_path => \"admin/test1\",\r\n :review_questionnaire_id => 1,\r\n :review_of_review_questionnaire_id => 1,\r\n },\r\n :due_date => { \"1\" , { :resubmission_allowed_id =>1 ,\r\n :submission_allowed_id =>3,\r\n :review_of_review_allowed_id =>1,\r\n :review_allowed_id =>1,\r\n :due_at =>\"2007-07-10 15:00:00\",\r\n :rereview_allowed_id =>1\r\n }\r\n }\r\n }\r\n assert_template 'assignment/edit'\r\n assert_equal original_assignment_name, Assignment.first.name\r\n end",
"def test_illegal_edit_assignment\n\n id = Assignment.first.id\n @assignment = Assignment.first\n original_assignment_name = @assignment.name\n number_of_assignment = Assignment.count\n # It will raise an error while execute render method in controller\n # Because the goldberg variables didn't been initialized in the test framework\n assert_raise (ActionView::TemplateError){\n post :update, :id => id, :assignment=> { :name => '',\n :directory_path => \"admin/test1\",\n :review_questionnaire_id => 1,\n :review_of_review_questionnaire_id => 1,\n },\n :due_date => { \"1\" , { :resubmission_allowed_id =>1 ,\n :submission_allowed_id =>3,\n :review_of_review_allowed_id =>1,\n :review_allowed_id =>1,\n :due_at =>\"2007-07-10 15:00:00\",\n :rereview_allowed_id =>1\n }\n }\n }\n assert_template 'assignment/edit'\n assert_equal original_assignment_name, Assignment.first.name\n end",
"def test_static_view\n \n first_assignment = oi_assignments(:first)\n \n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n get(:static_view, { :id => first_assignment }, siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n get(:static_view, {:id => first_assignment}, scott_designer_session)\n assert_equal(first_assignment.id, assigns(:assignment).id)\n assert_equal(oi_category_sections(:placement_3), assigns(:section))\n assert_equal(designs(:mx234a), assigns(:design))\n assert_equal([], assigns(:comments))\n \n end",
"def test_report_card_list\n \n get(:report_card_list, \n { :id => @board_prep.id, :design_id => @mx234a.id },\n scott_designer_session)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n assert_nil(assigns(:assignments_list))\n \n end",
"def view_assigns; end",
"def view_assigns; end",
"def test_task_assignment\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_list = [@siva_e]\n \n designer_session = scott_designer_session\n \n \n # Verify that a Teradyne PCB Designer can access the list\n # \n # Section Selection - Other\n get(:section_selection,\n { :id => @other.id, :design_id => @mx234a.id },\n designer_session) \n assert_redirected_to(:action => :process_assignments,\n :category_id => @other.id,\n :design_id => @mx234a.id,\n :section_id => OiCategory.other_category_section_id)\n \n # Section Selection - Board Prep\n get(:section_selection,\n {:id => @board_prep.id, :design_id => @mx234a.id }, \n designer_session)\n assert_equal(board_prep_sections, assigns(:sections))\n assert_equal(0, assigns(:section_id))\n \n # Process Assignments - No step selected\n post(:process_assignments,\n { :design => { :id => @mx234a.id },\n :category => { :id => @board_prep.id } },\n designer_session)\n #assert_equal(\"Please select the step\", flash['notice'])\n assert_nil(flash[:assignment])\n assert_redirected_to(:action => 'section_selection',\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n \n # Process Assignments - No errors\n post(:process_assignments,\n { :section_id => oi_category_sections(:board_prep_1).id,\n :design => { :id => @mx234a.id },\n :category => { :id => @board_prep.id } },\n designer_session)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n \n lcr_team_members = assigns(:team_members)\n expected_team_members = [@siva_e, @mathi_n] \n assert_equal(expected_team_members, lcr_team_members)\n \n assert_equal(oi_category_sections(:board_prep_1).id,\n assigns(:selected_step).id)\n \n instruction = assigns(:instruction)\n assert_equal(@board_prep.id, instruction.oi_category_section_id)\n assert_equal(@mx234a.id, instruction.design_id)\n \n assignment = assigns(:assignment)\n assert_equal((Time.now+1.day).year, assignment.due_date.year)\n assert_equal((Time.now+1.day).month, assignment.due_date.month)\n assert_equal((Time.now+1.day).day, assignment.due_date.day)\n assert_equal(OiAssignment.complexity_id('Low'), assignment.complexity_id)\n \n assert_not_nil(assigns(:comment))\n \n assert(!assigns(:selected_step).outline_drawing_link?)\n \n allegro_board_symbol = '10987654321'\n assignment_comment = 'This is a test'\n medium_complexity_id = OiAssignment.complexity_id('Medium')\n due_date = Time.local(2007, \"May\", 1)\n \n # Process Assignment Details - No allegro board symbol provided.\n post(:process_assignment_details,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '1', \"5005\" => '1' } },\n designer_session,\n {:assignment => {:instruction => \"\",\n :member_selections => \"\",\n :comment => \"\",\n :assignment => \"\"\n } }\n )\n #assert_equal('Please identify the Allegro Board Symbol', flash['notice'])\n #assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n #assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n #assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n #assert_not_nil(assignment[:design])\n #assert_equal(@mx234a.id, assignment[:design].id)\n #flash[:assignment][:design].name = 'abc'\n \n #assert_not_nil(assignment[:selected_step])\n #assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n #assert_not_nil(assignment[:instruction])\n #assert_equal(board_prep_sections[0].id,\n # assignment[:instruction].oi_category_section_id)\n \n #assert_not_nil(assignment[:member_selections])\n #assert_equal({ \"5004\" => '1', \"5005\" => '1' }, assignment[:member_selections])\n \n #assert_not_nil(assignment[:team_members])\n #assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n #assert_not_nil(assignment[:comment])\n #assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\nreturn \n follow_redirect!\n \n #Verify that the variable where loaded from the flash.\n #assert_equal(assignment[:design], assigns(:design)) \n #assert_equal(assignment[:category], assigns(:category))\n #assert_equal(assignment[:team_members], assigns(:team_members))\n #assert_equal(assignment[:selected_step], assigns(:selected_step))\n #assert_equal(assignment[:instruction], assigns(:instruction))\n #assert_equal(assignment[:assignment], assigns(:assignment))\n #assert_equal(assignment[:comment], assigns(:comment))\n #assert_not_nil(flash[:assignment])\n #assert_nil(assigns(:outline_drawing))\n \n \n # Process Assignment Details - No team members identified.\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s,\n :allegro_board_symbol => allegro_board_symbol },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '0', \"5005\" => '0' })\n\n assert_equal('Please select a team member or members', flash['notice'])\n assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n assert_not_nil(assignment[:design])\n assert_equal(@mx234a.id, assignment[:design].id)\n flash[:assignment][:design].name = 'abc'\n \n assert_not_nil(assignment[:selected_step])\n assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n assert_not_nil(assignment[:instruction])\n assert_equal(board_prep_sections[0].id,\n assignment[:instruction].oi_category_section_id)\n \n assert_not_nil(assignment[:member_selections])\n assert_equal({ \"5004\" => '0', \"5005\" => '0' }, assignment[:member_selections])\n \n assert_not_nil(assignment[:team_members])\n assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n assert_not_nil(assignment[:comment])\n assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\n \n follow_redirect\n \n #Verify that the variable where loaded from the flash.\n assert_equal(assignment[:design], assigns(:design)) \n assert_equal(assignment[:category], assigns(:category))\n assert_equal(assignment[:team_members], assigns(:team_members))\n assert_equal(assignment[:selected_step], assigns(:selected_step))\n assert_equal(assignment[:instruction], assigns(:instruction))\n assert_equal(assignment[:assignment], assigns(:assignment))\n assert_equal(assignment[:comment], assigns(:comment))\n assert_not_nil(flash[:assignment])\n assert_nil(assigns(:outline_drawing))\n \n section_selections = {}\n section_ids.each { |id| section_selections[id.to_s] = '0' }\n\n # Process Assignment Details - No team members identified and no allegro board symbol\n # provided.\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '0', \"5005\" => '0' })\n\n assert_equal('Please identify the Allegro Board Symbol<br />' +\n 'Please select a team member or members', \n flash['notice'])\n assert_not_nil(flash[:assignment])\n assignment = flash[:assignment]\n \n assert_equal(medium_complexity_id, assignment[:assignment].complexity_id)\n assert_equal(due_date.to_i, assignment[:assignment].due_date.to_i)\n \n assert_not_nil(assignment[:design])\n assert_equal(@mx234a.id, assignment[:design].id)\n flash[:assignment][:design].name = 'abc'\n \n assert_not_nil(assignment[:selected_step])\n assert_equal(board_prep_sections[0].id, assignment[:selected_step].id)\n \n assert_not_nil(assignment[:instruction])\n assert_equal(board_prep_sections[0].id,\n assignment[:instruction].oi_category_section_id)\n \n assert_not_nil(assignment[:member_selections])\n assert_equal({ \"5004\" => '0', \"5005\" => '0' }, assignment[:member_selections])\n \n assert_not_nil(assignment[:team_members])\n assert_equal([@siva_e, @mathi_n], assignment[:team_members])\n \n assert_not_nil(assignment[:comment])\n assert_equal(assignment_comment, assignment[:comment].comment )\n \n assert_redirected_to(:action => 'process_assignments',\n :category_id => @board_prep.id,\n :design_id => @mx234a.id)\n \n follow_redirect\n \n #Verify that the variable where loaded from the flash.\n assert_equal(assignment[:design], assigns(:design)) \n assert_equal(assignment[:category], assigns(:category))\n assert_equal(assignment[:team_members], assigns(:team_members))\n assert_equal(assignment[:selected_step], assigns(:selected_step))\n assert_equal(assignment[:instruction], assigns(:instruction))\n assert_equal(assignment[:assignment], assigns(:assignment))\n assert_equal(assignment[:comment], assigns(:comment))\n assert_not_nil(flash[:assignment])\n assert_nil(assigns(:outline_drawing))\n\n instruction_count = OiInstruction.count\n assignment_count = OiAssignment.count\n assignment_comment_count = OiAssignmentComment.count\n \n \n post(:view_assignments,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(0, assigns(:assignment_list).size)\n \n\n # Process Assignment Details - No errors\n post(:process_assignment_details,\n :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :comment => { :comment => assignment_comment},\n :instruction => { :oi_category_section_id => board_prep_sections[0].id.to_s,\n :allegro_board_symbol => allegro_board_symbol },\n :assignment => { :complexity_id => medium_complexity_id,\n \"due_date(1i)\" => \"2007\",\n \"due_date(2i)\" => \"5\",\n \"due_date(3i)\" => \"1\" },\n :team_member => { \"5004\" => '1', \"5005\" => '1' })\n\n assert_equal('The work assignments have been recorded - mail was sent',\n flash['notice'])\n assert_nil(flash[:assignment])\n\n assert_redirected_to(:action => 'oi_category_selection',\n :design_id => @mx234a.id)\n \n \n assert_equal(instruction_count+1, OiInstruction.count)\n instructions = OiInstruction.find(:all)\n last_instruction = instructions.pop\n assert_equal(@scott_g.id, last_instruction.user_id)\n assert_equal(allegro_board_symbol, last_instruction.allegro_board_symbol)\n assert_equal(board_prep_sections[0].id, last_instruction.oi_category_section_id)\n \n assert_equal(assignment_count+2, OiAssignment.count)\n assignments = OiAssignment.find(:all)\n mathi_assignment = assignments.pop\n siva_assignment = assignments.pop\n \n assert(!siva_assignment.complete?)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(last_instruction.id, siva_assignment.oi_instruction_id)\n assert_equal(due_date.to_i, siva_assignment.due_date.to_i)\n assert_equal(medium_complexity_id, siva_assignment.complexity_id)\n\n assert(!mathi_assignment.complete?)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n assert_equal(last_instruction.id, mathi_assignment.oi_instruction_id)\n assert_equal(due_date.to_i, mathi_assignment.due_date.to_i)\n assert_equal(medium_complexity_id, mathi_assignment.complexity_id)\n \n assert_equal(assignment_comment_count+2, OiAssignmentComment.count)\n assignment_comments = OiAssignmentComment.find(:all)\n mathi_comment = assignment_comments.pop\n siva_comment = assignment_comments.pop\n \n assert_equal(siva_assignment.id, siva_comment.oi_assignment_id)\n assert_equal(@scott_g.id, siva_comment.user_id)\n assert_equal(assignment_comment, siva_comment.comment)\n \n assert_equal(mathi_assignment.id, mathi_comment.oi_assignment_id)\n assert_equal(@scott_g.id, mathi_comment.user_id)\n assert_equal(assignment_comment, mathi_comment.comment)\n \n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n set_user(@pat_a.id, 'Product Support')\n post(:process_assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n\n # Verify that a contractor PCB Designer can not access the list.\n set_user(@siva_e.id, 'Designer')\n post(:process_assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify the email that was generated\n expected_to = [ [ @siva_e.email ].sort,\n [ @mathi_n.email ].sort,\n [ @siva_e.email, @mathi_n.email ].sort ]\n \n expected_cc_list = [@scott_g.email,\n @jim_l.email, \n @jan_k.email,\n users(:bala_g).email,\n @cathy_m.email].sort\n \n assert_equal(2, @emails.size) \n mathi_email = @emails.pop\n siva_email = @emails.pop\n \n assert_equal(1, siva_email.to.size)\n assert_equal(@siva_e.email, siva_email.to.pop)\n assert_equal(expected_cc_list, siva_email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment created',\n siva_email.subject)\n\n assert_equal(1, mathi_email.to.size)\n assert_equal(@mathi_n.email, mathi_email.to.pop)\n assert_equal(expected_cc_list, mathi_email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment created', \n mathi_email.subject)\n\n # Verify that a user from outside the PCB Group can not \n # access the view_assignments view\n set_user(@pat_a.id, 'Product Support')\n post(:view_assignments)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n\n # Verify that a contractor PCB Designer can not access the \n # view_assignments view\n set_user(@siva_e.id, 'Designer')\n post(:view_assignments)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify that a Teradyne PCB Designer can access the \n # view_assignments view\n set_user(@scott_g.id, 'Designer')\n post(:view_assignments,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n \n assignment_list = assigns(:assignment_list)\n assert_equal(1, assignment_list.size)\n \n expected_sections = board_prep_sections.dup\n \n # There is only on category populated\n assignment_list.each do |category, assignments|\n assert_equal(expected_sections.shift.id, category.id)\n assert_equal(2, assignments.size)\n end\n \n # Verify that a user from outside the PCB Group can not \n # access the assignment_view view\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_view)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a Teradyne PCB Designer can access the \n # the assignment_view view\n set_user(@scott_g.id, 'Designer')\n assignment_id = assignments.pop.id\n post(:assignment_view, :id => assignment_id)\n \n assert_response(:success)\n assert_equal(assignment_id, assigns(:assignment).id)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n\n comments = assigns(:comments)\n assert_equal(1, comments.size)\n comment = comments.pop\n assert_equal(assignment_comment, comment.comment)\n \n assert_not_nil(assigns(:post_comment))\n \n \n # Verify that a user from outside the PCB Group can not \n # access the category_details view\n set_user(@pat_a.id, 'Product Support')\n post(:category_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a contractor Team Member can access the \n # category_details view\n set_user(@siva_e.id, 'Designer')\n post(:category_details, :id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n \n siva_assignments = assigns(:category_list)\n assert_equal(2, siva_assignments.size)\n assert_not_nil(siva_assignments[@board_prep])\n \n assignment_list = siva_assignments[@board_prep]\n assert_equal(1, assignment_list.size)\n assert_not_nil(assignment_list.detect { |a| \n a.oi_instruction.oi_category_section_id == board_prep_sections[0].id }) \n assignment_list.each { |a| assert_equal(@siva_e.id, a.user_id) }\n\n # Verify that a user from outside the PCB Group can not \n # access the assignment_details view\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_details)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n # Verify that a contractor Team Member can access the \n # category_details view\n set_user(@siva_e.id, 'Designer')\n post(:assignment_details,\n :id => @board_prep.id,\n :design_id => @mx234a.id)\n \n assert_response(:success)\n assert_equal(@mx234a.id, assigns(:design).id)\n assert_equal(@board_prep.id, assigns(:category).id)\n \n section_list = assigns(:section_list)\n assert_equal('Board Preparation', section_list[:category].name)\n assert_equal(1, section_list[:assignment_list].size)\n assert_equal(1, section_list[:assignment_list][0].oi_instruction.oi_category_section_id)\n\n\n # Verify that a user from outside the PCB Group can not \n # update an assignment.\n set_user(@pat_a.id, 'Product Support')\n post(:assignment_update)\n \n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n # Verify that a member of the PCB Design group can \n # update an assignment\n set_user(@siva_e.id, 'Designer')\n \n # Get the instruction with 2 assignments associated with it\n instruction = OiInstruction.find_by_design_id_and_oi_category_section_id(\n @mx234a.id,\n board_prep_sections[0].id)\n\n siva_assignment = instruction.oi_assignments.detect { |a| a.user_id == @siva_e.id }\n mathi_assignment = instruction.oi_assignments.detect { |a| a.user_id == @mathi_n.id }\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(1, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n siva_assignment_comment = siva_assignment.oi_assignment_comments.pop\n mathi_assignment_comment = mathi_assignment.oi_assignment_comments.pop\n assert_not_equal(siva_assignment_comment.id, mathi_assignment_comment.id)\n\n\n post(:assignment_update,\n :assignment => siva_assignment,\n :post_comment => {:comment => 'My 2 cents'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(2, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n cc_list = expected_cc_list.dup + [@siva_e.email] - [@scott_g.email]\n email = @emails.pop\n assert_equal([@scott_g.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update',\n email.subject)\n\n\n post(:assignment_update,\n :assignment => { :id => siva_assignment.id,\n :complete => \"1\"},\n :post_comment => {:comment => 'It is done'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(3, siva_assignment.oi_assignment_comments.size)\n assert_equal(1, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n email = @emails.pop\n assert_equal([@scott_g.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update - Completed',\n email.subject)\n \n set_user(@scott_g.id, 'Designer')\n post(:assignment_update,\n :assignment => { :id => siva_assignment.id,\n :complete => \"0\"},\n :post_comment => {:comment => 'My 2 cents'})\n \n siva_assignment.reload\n mathi_assignment.reload\n\n assert_equal(2, instruction.oi_assignments.size)\n assert_equal(4, siva_assignment.oi_assignment_comments.size)\n assert_equal(0, siva_assignment.complete)\n assert_equal(@siva_e.id, siva_assignment.user_id)\n assert_equal(1, mathi_assignment.oi_assignment_comments.size)\n assert_equal(0, mathi_assignment.complete)\n assert_equal(@mathi_n.id, mathi_assignment.user_id)\n\n cc_list = expected_cc_list.dup\n email = @emails.pop\n assert_equal([@siva_e.email], email.to.sort)\n assert_equal(cc_list.sort, email.cc.sort)\n assert_equal('Catalyst/AC/(pcb252_234_a0_g): Work Assignment Update - Reopened',\n email.subject)\n \n end",
"def test_grader_that_has_active_report_cant_take_on_another_report\n login_as :sean\n post :auto_assign\n assert_redirected_to :controller => :home, :action=>:index\n end",
"def test_legal_edit_assignment\n @assignment = Assignment.first\n id = Assignment.first.id\n number_of_assignment = Assignment.count\n questionnaire_id = Questionnaire.first.id\n post :update, :id => id, :assignment=> { :name => 'updatedAssignment9',\n :review_questionnaire_id => questionnaire_id,\n :review_of_review_questionnaire_id => questionnaire_id,\n :author_feedback_questionnaire_id => questionnaire_id\n }\n\n assert_equal flash[:notice], 'Assignment was successfully updated.'\n\n assert_response :redirect\n assert_equal Assignment.count, number_of_assignment\n assert Assignment.find(:all, :conditions => \"name = 'updatedAssignment9'\")\n end",
"def test_process_assignments\n \n board_prep_sections = [oi_category_sections(:board_prep_1),\n oi_category_sections(:board_prep_2),\n oi_category_sections(:board_prep_3)]\n section_ids = board_prep_sections.collect { |s| s.id }\n team_member_list = [@siva_e]\n \n section_selections = {}\n section_ids.each { |id| section_selections[id.to_s] = '0' }\n\n\n # Try accessing from an account that is not a PCB Designer and\n # verify that the user is redirected.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n pat_dfm_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(\"You are not authorized to access this page\", flash['notice'])\n \n \n # Verify that a contractor PCB Designer can not access the list.\n post(:process_assignments,\n { :category => { :id => @board_prep.id },\n :design => { :id => @mx234a.id },\n :section => section_selections },\n siva_designer_session)\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(\"You are not authorized to access this page\", flash['notice'])\n\n end",
"def set_report\n end",
"def agreement_report\n\t\treport = ActiveReporting::Report.new( { :title => \"Review Stage Agreement\", :description => \"Comparison of document dispositions across reviewers\" } )\n\t\tfor sr in self.stage_reviewers do\n\t\t\treport.columns << ActiveReporting::Report::Column.new( :title => \"Reviewer #{sr.user.nickname}\", :formatter => Proc.new { |v| DocumentReview.action_verb(v) } )\n\t\tend\n\t\treport.columns << ActiveReporting::Report::Column.new( :title => \"Count\" )\n\t\tsql_select1 = self.stage_reviewers.collect{ |sr| \"dr#{sr.id}.disposition disposition#{sr.id}\" }.join(\", \")\n\t\tsql_join1 = self.stage_reviewers.collect{ |sr| \"LEFT JOIN stage_reviewers sr#{sr.id} ON sr#{sr.id}.review_stage_id = rs.id AND sr#{sr.id}.id = #{sr.id}\" }.join(\"\\n\")\n\t\tsql_join2 = self.stage_reviewers.collect{ |sr| \"LEFT JOIN document_reviews dr#{sr.id} ON dr#{sr.id}.stage_reviewer_id = sr#{sr.id}.id AND dr#{sr.id}.document_id = d.id\" }.join(\"\\n\")\n\t\tsql_where1 = self.stage_reviewers.collect{ |sr| \"dr#{sr.id}.id IS NOT NULL\" }.join(\" OR \")\n\t\tsql_group1 = self.stage_reviewers.collect{ |sr| \"dr#{sr.id}.disposition\" }.join(\", \")\n\t\t# SELECT dr101.disposition disp202, dr202.disposition disp202, count(d.id)\n\t\t# FROM review_stages rs, documents d\n\t\t# LEFT JOIN stage_reviewers sr101 ON sr101.review_stage_id = rs.id AND sr101.id = 101\n\t\t# LEFT JOIN stage_reviewers sr202 ON sr202.review_stage_id = rs.id AND sr202.id = 202\n\t\t# LEFT JOIN document_reviews dr101 ON dr101.stage_reviewer_id = sr101.id AND dr101.document_id = d.id\n\t\t# LEFT JOIN document_reviews dr202 ON dr202.stage_reviewer_id = sr202.id AND dr202.document_id = d.id\n\t\t# GROUP BY dr101.disposition, dr202.disposition\n\t\t# WHERE rs.id = #{self.id} AND (dr101.id NOT NULL OR dr202.id NOT NULL)\n\t\tsql = <<-EOT\n\t\t\tSELECT\n\t\t\t\t#{sql_select1},\n\t\t\t\tCOUNT(d.id) document_count\n\t\t\t\tFROM review_stages rs JOIN documents d\n\t\t\t\tLEFT JOIN document_sources ds ON d.document_source_id = ds.id\n\t\t\t\t#{sql_join1}\n\t\t\t\t#{sql_join2}\n\t\t\t\tWHERE rs.id = #{self.id} AND ds.project_id = rs.project_id AND (#{sql_where1})\n\t\t\t\tGROUP BY\n\t\t\t\t\t#{sql_group1}\n\t\t\t\t;\n\t\tEOT\n\t\trows = self.connection.select_rows( sql )\n\t\tfor row in self.connection.select_rows( sql )\n\t\t\tvalues = {}\n\t\t\treport.columns.each_index do |i|\n\t\t\t\tcol = report.columns[i]\n\t\t\t\tvalue = col.format(row[i])\n\t\t\t\tvalues[col] = value\n\t\t\tend\n\t\t\trow = ActiveReporting::Report::Row.new( values )\n\t\t\treport.rows << row\n\t\tend\n\t\treport\n\tend",
"def run_report\n comparison_values.tap do |results|\n display_report(results)\n end\n end",
"def _evaluate_assigns(object)\n view_assigns.each { |k,v| object.instance_variable_set(k, v) }\n end",
"def report_data\n options = process_params_options(params)\n if options.nil? || options[:view].nil?\n model_view = process_params_model_view(params, options)\n @edit = session[:edit]\n @view, settings = get_view(model_view, options, true)\n else\n @view = options[:view]\n settings = options[:pages]\n end\n settings = set_variables_report_data(settings, @view)\n\n if options && options[:named_scope] == \"in_my_region\" && options[:model] == \"Tenant\"\n @view.table = filter_parent_name_tenant(@view.table)\n end\n\n render :json => {\n :checkboxes_clicked => params.fetch_path(:additional_options, :checkboxes_clicked),\n :settings => settings,\n :data => view_to_hash(@view, true),\n :messages => @flash_array\n }\n end",
"def report\n \n end",
"def write_report!\n notify.critical_error(\"Must run `test!` before writing a report\") if test.status.nil?\n in_test_dir do\n self.writer = GitTest::Writer.new(:path => report_path,\n :name => report_name,\n :report => test.report )\n in_report_branch do\n writer.save!\n commit_to_test_proj!\n end\n end\n end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def test_delete_assignment\r\n\r\n number_of_assignment = Assignment.count\r\n number_of_duedate = DueDate.count\r\n id = Assignment.first(:conditions => {:instructor_id => users(:instructor3).id}).id\r\n post :delete, :id => id\r\n assert_redirected_to :controller => 'tree_display', :action => 'list'\r\n assert_equal number_of_assignment-1, Assignment.count\r\n assert_raise(ActiveRecord::RecordNotFound){ Assignment.find(id) }\r\n\r\n end",
"def test_view\n\n checklist_1_0 = checklists(:checklist_1_0)\n \n get(:view, { :id => checklist_1_0.id }, cathy_admin_session)\n assert_equal(checklist_1_0.id, assigns(:checklist).id)\n\n end",
"def mock_action_view(assigns = {})\n controller = ActionView::TestCase::TestController.new\n ActionView::Base.send :include, ActionView::Helpers\n ActionView::Base.send :include, ActiveAdmin::ViewHelpers\n ActionView::Base.send :include, Rails.application.routes.url_helpers\n ActionView::Base.new(ActionController::Base.view_paths, assigns, controller)\n end",
"def _assign\n configure_logger() # Sets up loggers\n\n # Consumers can optionally return false from assign if they don't want exposure to be logged\n assign_val = assign(@_assignment, **@inputs)\n @_in_experiment = assign_val || assign_val == nil ? true : false\n @_assigned = true\n end",
"def test_delete_assignment\n\n number_of_assignment = Assignment.count\n number_of_duedate = DueDate.count\n id = Assignment.first(:conditions => {:instructor_id => users(:instructor3).id}).id\n post :delete, :id => id\n assert_redirected_to :controller => 'tree_display', :action => 'list'\n assert_equal number_of_assignment-1, Assignment.count\n assert_raise(ActiveRecord::RecordNotFound){ Assignment.find(id) }\n\n end",
"def report\n\t\tend",
"def test_select_view\n\n checklist_1_0 = checklists(:checklist_1_0)\n \n get(:select_view, {:id => checklist_1_0.id}, cathy_admin_session)\n assert_equal(checklist_1_0.id, assigns(:checklist).id)\n \n end",
"def view\n if pending?\n ask_pending\n elsif failed?\n ask_failed\n else\n puts rendered\n puts \"Rendered output for #{test_file} matches expected.\"\n end\n end",
"def view\n if session[\"github_access_token\"].nil?\n session[\"assignment_id\"] = params[:id]\n session[\"github_view_type\"] = \"view_scores\"\n return redirect_to authorize_github_grades_path\n end\n @assignment = Assignment.find(params[:id])\n @questions = {}\n questionnaires = @assignment.questionnaires\n if @assignment.varying_rubrics_by_round?\n retrieve_questions questionnaires\n else # if this assignment does not have \"varying rubric by rounds\" feature\n questionnaires.each do |questionnaire|\n @questions[questionnaire.symbol] = questionnaire.questions\n end\n end\n\n @scores = @assignment.scores(@questions)\n averages = calculate_average_vector(@assignment.scores(@questions))\n @average_chart = bar_chart(averages, 300, 100, 5)\n @avg_of_avg = mean(averages)\n calculate_all_penalties(@assignment.id)\n @show_reputation = false\n end",
"def report_test\n report_data = params.require(:api).permit(:code,:stdout,:project,:suite,:section)\n report = api_user.test_reports.create(report_data)\n if report.valid?\n render text: \"ok\"\n else\n raise \"Invalid report\"\n end\n end",
"def report\n super\n\n begin\n puts \"Writing HTML reports to #{@reports_path}\"\n erb_str = File.read(@erb_template)\n renderer = ERB.new(erb_str)\n\n tests_by_suites = tests.group_by { |test| test_class(test) } # taken from the JUnit reporter\n\n suites = tests_by_suites.map do |suite, tests|\n suite_summary = summarize_suite(suite, tests)\n suite_summary[:tests] = tests.sort { |a, b| compare_tests(a, b) }\n suite_summary\n end\n\n suites.sort! { |a, b| compare_suites(a, b) }\n\n result = renderer.result(binding)\n File.open(html_file, 'w') do |f|\n f.write(result)\n end\n\n # rubocop:disable Lint/RescueException\n rescue Exception => e\n puts 'There was an error writing the HTML report'\n puts 'This may have been caused by cancelling the test run'\n puts 'Use mode => :verbose in the HTML reporters constructor to see more detail' if @mode == :terse\n puts 'Use mode => :terse in the HTML reporters constructor to see less detail' if @mode != :terse\n raise e if @mode != :terse\n end\n # rubocop:enable Lint/RescueException\n end",
"def update\n @assignment = Assignment.find(params[:assignment_id])\n\n @assignment.transaction do\n\n begin\n # Process testing framework form for validation\n @assignment = process_test_form(@assignment, params)\n rescue Exception, RuntimeError => e\n @assignment.errors.add(:base, I18n.t('assignment.error',\n message: e.message))\n return redirect_to action: 'manage',\n assignment_id: params[:assignment_id]\n end\n\n # Save assignment and associated test files\n if @assignment.save\n flash[:success] = I18n.t('assignment.update_success')\n redirect_to action: 'manage',\n assignment_id: params[:assignment_id]\n else\n render :manage\n end\n end\n end",
"def test_010\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n #Pu created\n\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def parse_test_report(test_report)\n if @question.language.is_a?(Coursemology::Polyglot::Language::Java)\n Course::Assessment::Java::JavaProgrammingTestCaseReport.new(test_report).test_cases\n else\n Course::Assessment::ProgrammingTestCaseReport.new(test_report).test_cases\n end\n end",
"def view_report\n (@shift_report = find_params_id(ShiftReport)) || return\n redirect_to :controller => :report if (!@shift_report.submitted? and @shift_report.shift.user == get_user)\n end",
"def report_params\n params.fetch(:report, {}).permit(:company_id, :test_suite_id, :test_environment_id, :initiated_at, :initiated_by, :started_at, :completed_at, :monitored_by, :status, :summary, :created_at, :updated_at, \n test_results_attributes: [:id, :report_id, :test_case_id, :status])\n end",
"def report_params\n params.fetch(:report, {}).permit(:company_id, :test_suite_id, :test_environment_id, :initiated_at, :initiated_by, :started_at, :completed_at, :monitored_by, :status, :summary, :created_at, :updated_at, \n test_results_attributes: [:id, :report_id, :test_case_id, :status])\n end",
"def view_team\n @participant = AssignmentParticipant.find(params[:id])\n @assignment = @participant.assignment\n @team = @participant.team\n @team_id = @team.id\n @questions = {}\n questionnaires = @assignment.questionnaires\n retrieve_questions questionnaires\n @pscore = @participant.scores(@questions)\n @vmlist = []\n\n # loop through each questionnaire, and populate the view model for all data necessary\n # to render the html tables.\n counter_for_same_rubric = 0\n questionnaires.each do |questionnaire|\n @round = nil\n if @assignment.varying_rubrics_by_round? && questionnaire.type == \"ReviewQuestionnaire\"\n questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)\n if questionnaires.count > 1\n @round = questionnaires[counter_for_same_rubric].used_in_round\n counter_for_same_rubric += 1\n else\n @round = questionnaires[0].used_in_round\n counter_for_same_rubric = 0\n end\n end\n vm = VmQuestionResponse.new(questionnaire, @assignment, @round)\n vmquestions = questionnaire.questions\n vm.add_questions(vmquestions)\n vm.add_team_members(@team)\n vm.add_reviews(@participant, @team, @assignment.varying_rubrics_by_round?)\n vm.get_number_of_comments_greater_than_10_words\n @vmlist << vm\n end\n @current_role_name = current_role_name\n end",
"def setup\n @agent = Mechanize.new\n uri = URI.join('file:///', File.absolute_path(\"test/data/view.html\"))\n @page = @agent.get uri.to_s\n @view = PortfolioView.new uri.to_s, @page, \"test mameber\", \"test portfolio\", \"View1\", \"testgroup\"\n\n @analyzer = PortfolioStatistics::DescriptiveViewAnalyzer.new\n end",
"def create_analysis_views\n puts \"====================\"\n puts \"creating analysis views for #{self.name}\"\n puts \"====================\"\n\n run_analysis_views\n\n puts \"> done\"\n puts \"====================\"\n end",
"def show\n @subject = Subject.find(params[:id])\n @view_all = params[:view_all]\n @assignments = @subject.assignments.all\n @new_assign = @subject.assignments.build\n @subject_id = @subject.id\n @adate = @subject.get_next_assignment_date\n\n respond_with(@assignments, @new_assign, @subject_id, @adate)\n end",
"def test_009\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n #Pu created\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"analyze_allow_file_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(\"analyze_allow_files(qac)\") rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n # click link setup QAC++\n assert is_text_present(\"qacpp\")\n sleep 3\n click $xpath[\"task\"][\"analyze_allow_file_link2\"]\n # check log in the navigation bar\n sleep 2\n assert !60.times{ break if (is_text_present(\"analyze_allow_files(qacpp)\") rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def test_011\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n #Pu created\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n sleep 2\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # click link setup QAC++\n assert is_text_present(\"qacpp\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link2\"]\n # check log in the navigation bar\n sleep 2\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end",
"def teardown\n if self.passed?\n @reportiumClient.testStop(TestResultFactory.createSuccess)\n\n else\n @reportiumClient.testStop(TestResultFactory.createFailure(@exception.message, @exception))\n\n end\n\n @driver.quit\n\n # Retrieve the URL to the DigitalZoom Report (= Reportium Application) for an aggregated view over the execution\n reportURL = @reportiumClient.getReportUrl\n\n # Retrieve the URL to the Execution Summary PDF Report\n reportPdfUrl = @driver.capabilities['reportPdfUrl']\n\n puts 'reportUrl='.concat reportURL\n\n # For detailed documentation on how to export the Execution Summary PDF Report, the Single Test report and other attachments such as\n # video, images, device logs, vitals and network files - see http://developers.perfectomobile.com/display/PD/Exporting+the+Reports\n\n end",
"def open_response_report\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHOOSE_AUTHORIZE\n # no authorization needed ...\n # authorize Portal::Learner\n # authorize @learner\n # authorize Portal::Learner, :new_or_create?\n # authorize @learner, :update_edit_or_destroy?\n @portal_learner = Portal::Learner.find(params[:id])\n \n respond_to do |format|\n format.html # report.html.haml\n end\n end",
"def test_successful_sign_up\n# topicid = sign_up_topics(:first_topic).id\n\n # Setup the session\n# @request.session[:user] = users(:student_team_formation1)\n \n #call the sign_up_topic controller to sign up the user for topic.\n #SignUpSheetController.signup\n# get(:signup, {'assignment_id' => assignments(:assignment_team_formation).id}, {'confirm_by' => 0}, {'id' => topicid}) \n \n #This should pass fine as the student is paired with student_team_formation2 and max required\n #students for topic is 2\n #Check for no error message\n #assert_equal flash[:error], nil\n \n #backup code\n #assert_response :redirect\n #assert_equal Assignment.count, number_of_assignment\n #assert Assignment.find(:all, :conditions => \"name = 'updatedAssignment9'\")\n end",
"def test_index\n get :index\n assert_response :success\n assert_not_nil assigns(:projects)\n end",
"def test_004\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 全体解析 (Analysis of all)\n select \"analyze_type\", \"label=#{@overall}\"\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n #There is no display below \"selection of the upload method of an individual analysis file.\"\n assert !is_text_present(_(\"Select the upload method of individual analysis files\"))\n\n @@pu.destroy\n # logout\n logout\n\n end",
"def assignment_params\n params.require(:assignment).permit(:metric_id, :test_id, :test_slot)\n end",
"def view_report(entity_id, action)\n\t\t\tr = Report.find(entity_id)\n\t\t\tif action == true\n\t\t\t\tr['status'] = 'checked'\n\t\t\tend\n\t\tend",
"def view\n @subject = Subject.find(params[:id])\n @assignments = @subject.assignments.limit(10).reverse_order\n @new_assign = @subject.assignments.build\n @subject_id = @subject.id\n @adate = @subject.get_next_assignment_date\n\n respond_with(@assignments, @new_assign, @subject_id, @adate)\n end",
"def test_007\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n @@pu = Pu.find_by_name('SamplePU1')\n\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n @@pj = Pj.find_by_name('SamplePJ1')\n\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # test for value of master into combobox in master tab\n assert_equal [\"sample_c_cpp\"], get_select_options(\"master_id\")\n assert is_text_present(_(\"Optional setting\"))\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n # click link setup QAC++\n assert is_text_present(\"qacpp\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link2\"]\n sleep 2\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n\n\n # logout\n logout\n\n end",
"def get_assignment\n return TestCase.find(params[:id]).assignment\n end",
"def set_view_statistic\n @view_statistic = ViewStatistic.find(params[:id])\n end",
"def render\n @compiled_tests.each do |test|\n tmpl = test[:tmpl]\n assigns = test[:assigns]\n layout = test[:layout]\n\n if layout\n assigns['content_for_layout'] = tmpl.render!(assigns)\n layout.render!(assigns)\n else\n tmpl.render!(assigns)\n end\n end\n end",
"def report_params\n end",
"def evaluate\n @view.evaluate if @view\n end",
"def emp_report\n \n end",
"def test_report\n @report.heading('Testing')\n @report.run('echo', 'foo')\n assert_equal \">>>>> Testing\\n>>> echo foo\\nfoo\\n\", @report.text\n end",
"def compare_action\n # ToDo: Change the hard coded report to a Report setting, or client base\n raise 'Hard coded report implementation' unless RAILS_ENV =~ /susbkk/\n end",
"def test_review_type_role_assignment\n\n # Verify response when not logged in.\n get :review_type_role_assignment, {},{}\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n\n # Verify response when logged in as a non-admin\n get :review_type_role_assignment, {}, rich_designer_session\n assert_redirected_to(:controller => 'tracker', :action => 'index')\n #assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n # Verify response when logged in as an admin\n get :review_type_role_assignment, {}, cathy_admin_session\n assert_response :success\n\n roles = assigns(roles)['roles']\n review_types = assigns(review_types)['review_types']\n\n assert_equal(@expected_values.size, roles.size)\n assert_equal(5, review_types.size)\n\n roles.each_with_index { |role, i|\n expected_role = @expected_values[i]\n assert_equal(expected_role[:name], role.name)\n\n review_types = role.review_types.sort_by { |rt| rt.name }\n review_types.each_with_index { |rt, j|\n expected_name = expected_role[:review_types][j]\n assert_equal(expected_role[:name]+'::'+expected_name.to_s,\n role.name+'::'+rt.name)\n }\n\n }\n\n expected_values = [\n {:name => 'Final',\n :role_names => ['CE-DFT', 'DFM', 'HWENG',\n 'Mechanical', 'Mechanical-MFG', 'PCB Design',\n 'Planning', 'TDE', 'Valor'] },\n {:name => 'Pre-Artwork',\n :role_names => ['CE-DFT', 'DFM', 'HWENG', \n 'Library', 'Mechanical', 'Mechanical-MFG',\n 'PCB Input Gate', 'PCB Mechanical', 'Planning',\n 'SLM BOM', 'SLM-Vendor', 'TDE',\n 'Valor' ]},\n {:name => 'Placement',\n :role_names => ['CE-DFT', 'DFM', 'HWENG',\n 'Mechanical', 'Mechanical-MFG', 'TDE' ]},\n {:name => 'Routing',\n :role_names => ['CE-DFT', 'DFM', 'HWENG',\n 'Library', 'Mechanical-MFG' ]},\n {:name => 'Release',\n :role_names => ['HWENG', 'Operations Manager',\n 'PCB Design' ]},\n ]\n\n review_types.each_with_index do |review_type, i|\n expected_rt = expected_values[i]\n assert_equal(expected_rt[:name], review_type.name)\n\n review_type.roles.sort_by { |role| role.name }.each_with_index do |role, j|\n expected_role = expected_rt[:role_names]\n expected_name = expected_role[j]\n assert_equal(expected_name, role.name)\n end\n end\n\n end",
"def show\n # @reports = @month_simulation.reports\n end",
"def test_default_report\n assert_equal \"No weather data yet!\", @weather_report.report\n end",
"def build_report\n puts \"building performance test comparison report...\"\n puts\n\n # load template\n report = File.read(@template_path)\n\n # metrics result\n result_comparison_table = extract_table_from_csv2html_output(@result_comparison_path)\n\n # atop summary\n atop_summary_comparison_table = extract_table_from_csv2html_output(@atop_summary_comparison_path)\n\n # atop detail\n # TODO: enable\n # atop_detail_comparison_table = extract_table(@atop_detail_comparison_path)\n\n # replace tables (do this first since table data may include parameters)\n report = report.gsub(\"$RESULT_COMPARISON_TABLE\", result_comparison_table)\n report = report.gsub(\"$ATOP_SUMMARY_COMPARISON_TABLE\", atop_summary_comparison_table)\n\n # TODO: enable\n # report = report.gsub(\"$ATOP_DETAIL_TABLE\", atop_detail_table)\n\n # replace parameters\n report = replace_parameters(report)\n\n # write report\n puts \"writing report to #{@output_path}\"\n\n File.write(@output_path, report)\nend",
"def test_show_add\n xhr :get, :show_add, :contract_id => @contract.id\n \n assert_template 'assignment/_assignment_form'\n end",
"def test_authorization_of_protocols_and_datafiles_links\n #sanity check the fixtures are correct\n check_fixtures_for_authorization_of_protocols_and_datafiles_links\n login_as(:model_owner)\n experiment=experiments(:experiment_with_public_and_private_protocols_and_datafiles)\n assert_difference('ActivityLog.count') do\n get :show, :id=>experiment.id\n end\n\n assert_response :success\n\n assert_select \"div.tabbertab\" do\n assert_select \"h3\", :text=>\"Protocols (1+1)\", :count=>1\n assert_select \"h3\", :text=>\"Data Files (1+1)\", :count=>1\n end\n\n assert_select \"div.list_item\" do\n assert_select \"div.list_item_title a[href=?]\", protocol_path(protocols(:protocol_with_fully_public_policy)), :text=>\"Protocol with fully public policy\", :count=>1\n assert_select \"div.list_item_actions a[href=?]\", protocol_path(protocols(:protocol_with_fully_public_policy)), :count=>1\n assert_select \"div.list_item_title a[href=?]\", protocol_path(protocols(:protocol_with_private_policy_and_custom_sharing)), :count=>0\n assert_select \"div.list_item_actions a[href=?]\", protocol_path(protocols(:protocol_with_private_policy_and_custom_sharing)), :count=>0\n\n assert_select \"div.list_item_title a[href=?]\", data_file_path(data_files(:downloadable_data_file)), :text=>\"Download Only\", :count=>1\n assert_select \"div.list_item_actions a[href=?]\", data_file_path(data_files(:downloadable_data_file)), :count=>1\n assert_select \"div.list_item_title a[href=?]\", data_file_path(data_files(:private_data_file)), :count=>0\n assert_select \"div.list_item_actions a[href=?]\", data_file_path(data_files(:private_data_file)), :count=>0\n end\n\n end",
"def show\n @participant = AssignmentParticipant.find(params[:id].to_i)\n @assignment = @participant.assignment\n @sign_up_topics = SignUpTopic.where(assignment_id: @assignment.id, private_to: nil)\n my_topic = SignedUpTeam.topic_id(@participant.parent_id, @participant.user_id)\n @sign_up_topics -= SignUpTopic.where(assignment_id: @assignment.id, id: my_topic)\n @num_participants = AssignmentParticipant.where(parent_id: @assignment.id).count\n @selected_topics = nil # this is used to list the topics assigned to review. (ie select == assigned i believe)\n @bids = ReviewBid.where(participant_id: @participant, assignment_id: @assignment.id)\n signed_up_topics = []\n @bids.each do |bid|\n sign_up_topic = SignUpTopic.find_by(id: bid.signuptopic_id)\n signed_up_topics << sign_up_topic if sign_up_topic\n end\n signed_up_topics &= @sign_up_topics\n @sign_up_topics -= signed_up_topics\n @bids = signed_up_topics\n @num_of_topics = @sign_up_topics.size\n @assigned_review_maps = []\n ReviewResponseMap.where(reviewed_object_id: @assignment.id, reviewer_id: @participant.id).each do |review_map|\n @assigned_review_maps << review_map\n end\n\n # explicitly render view since it's in the sign up sheet views\n render 'sign_up_sheet/review_bids_show'\n end",
"def test_show\n #login_as(:john)\n #get :show, :id => @first_id\n\n #assert_response :success\n #assert_template 'show'\n\n #assert_not_nil assigns(:taverna_enactor)\n #assert assigns(:taverna_enactor).valid?\n \n assert true\n end",
"def index\n @exceller_assignments = ExcellerAssignment.all\n end",
"def update_reports\n\n\t\tremove_reports\n\n\t\texisting_report_ids = self.reports.map{|c|\n\t\t\tc.id.to_s\n\t\t}\n\n\t\t## after this the quantity issue\n\t\t## and then the test verification toggles, textual inference, and report generation ->\n\t\t## so only if the order is finalized, then \n\t\t## now the worth processing.\n\t\t## local item group\n\t\t## organization from \n\n\t\tself.template_report_ids.each do |r_id|\n\t\t\t#puts \"doing template report id: #{r_id}\"\n\t\t\tunless existing_report_ids.include? r_id\n\t\t\t\ttx = Time.now\n\t\t\t\tself.finalize_order = NO\n\t\t\t\t## unfinalize the order\n\t\t\t\t## \n\t\t\t\t## get teh report raw hash.\n\t\t\t\t## get rid of the non-applicable ranges\n\t\t\t\t## and only then initialize the object.\n\t\t\t\t## that will make it much faster.\n\t\t\t\treport = Diagnostics::Report.find(r_id)\n\t\t\t\t\n\t\t\t\tty = Time.now\n\t\t\t\tputs \"time to get report: #{(ty - tx).in_milliseconds}\"\n\t\t\t\treport.created_by_user = User.find(report.created_by_user_id)\n\t\t\t\treport.current_user = self.current_user\n\t\t\t\ttz = Time.now\n\t\t\t\tputs \"time to get created by user: #{(tz - ty).in_milliseconds}\"\n\t\t\t\treport.run_callbacks(:find)\n\t\t\t\tt1 = Time.now\n\t\t\t\tputs \"time to run callbacks: #{(t1 - tz).in_milliseconds}\"\n\t\t\t\treport.prune_test_ranges(self.patient)\n\t\t\t\tt2 = Time.now\n\t\t\t\tputs \"prune ranges took: #{(t2-t1).in_milliseconds}\"\n\t\t\t\tself.reports << report\n\t\t\t\tself.order_completed = NO\n\t\t\tend\n\t\tend\n\tend",
"def test_008\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n @@pj = Pj.find_by_name('SamplePJ1')#\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # test for value of master into combobox in master tab\n assert_equal [\"sample_c_cpp\"], get_select_options(\"master_id\")\n assert is_text_present(_(\"Optional setting\"))\n\n click $xpath[\"task\"][\"registration_task_button\"]\n sleep 2\n #assert !60.times{ break if (is_text_present(\"解析ツール未選択 入力内容に問題があるためタスクを登録できません。\") rescue false); sleep 2 }\n\n\n # logout\n logout\n\n end",
"def set_report\n @report = Report.find(params[:id])\n @reportable = @report.reportable\n end",
"def set_action_report\n @action_report = ActionReport.find(params[:id])\n end",
"def show\n @report.done = true\n @report.update(report_params)\n end",
"def index\n @participant = AssignmentParticipant.find(params[:id])\n return unless current_user_id?(@participant.user_id)\n\n @assignment = @participant.assignment\n @review_mappings = ReviewResponseMap.where(reviewer_id: @participant.id)\n\n # Finding how many reviews have been completed\n @num_reviews_completed = 0\n @review_mappings.each do |map|\n @num_reviews_completed += 1 if !map.response.empty? && map.response.last.is_submitted\n end\n\n # render view for completing reviews after review bidding has been completed\n render 'sign_up_sheet/review_bids_others_work'\n end",
"def on_assignment_completed(assignment)\n\t\t\ttally\n\t\tend",
"def test_005\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n # #Find a PU\n #Pu created\n pu_name = 'pu'\n register_pu(pu_name)\n @@pu = Pu.find(:last)\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n pj_name = 'pj'\n register_pj(pj_name)\n @@pj = Pj.find(:last)\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n # Below \"selection of the upload method of an individual analysis file\" is displayed.\n assert is_text_present(_(\"Select a master\"))\n assert is_text_present(_(\"Master\"))\n assert is_text_present(_(\"Select the upload method of individual analysis files\"))\n assert is_text_present(_(\"Upload of individual analysis files\"))\n\n @@pu.destroy\n # logout\n logout\n\n end",
"def set_report\n @month_simulation = MonthSimulation.find(params[:id])\n end",
"def index\n @activity_participant_assignments = ActivityParticipantAssignment.all\n end",
"def write_report\n\n end",
"def assigment\n @assignment = Assignment.new(params[:assignment])\n @asset = Asset.new(params[:asset])\n\n if @assignment.save\n\n @delivery_from_assignment = Delivery.find(@assignment.delivery)\n\n @delivery_from_assignment.evaluation_criteria.each do |generate_rubres|\n @response_to_the_evaluation = ResponseToTheEvaluation.new\n @response_to_the_evaluation.name = generate_rubres.name\n @response_to_the_evaluation.comment_for_rubre = generate_rubres.description\n @response_to_the_evaluation.assignment_id = @assignment.id\n @response_to_the_evaluation.save\n end\n end\n end",
"def index\n @user_assignments = UserAssignment.all\n end",
"def test_002\n\n # login\n login\n @@pu = 1\n @@pj = 1\n open\"/devgroup/pj_index/#{@@pu}/#{@@pj}\"\n wait_for_page_to_load \"30000\"\n\n # test for individual analysis task\n open(\"/task/index2/#{@@pu}/#{@@pj}\")\n #The contents of a display of a \"master\" tab become\n # a thing for individual analysis task registration.\n click $xpath[\"task\"][\"main_area_td4\"]\n wait_for_page_to_load \"30000\"\n assert is_text_present(_(\"Registration of an Analysis Task\"))\n # select analyze type: 個人解析\n select \"analyze_type\", \"label=#{@individual}\"\n #Click Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n #Select \"uploading a file individually\"\n click \"file_upload_upload_way_upload_each\"\n assert is_text_present(_(\"Uploaded individually.\"))\n click $xpath[\"task\"][\"read_tree\"]\n\n assert !60.times{ break if (is_text_present(_(\"Directory structure\")) rescue false); sleep 2 }\n # logout\n logout\n\n end",
"def test_get_ctools_collection_view_submission_link_url\n\n file_name = \"unitTestAssignmentSubmission\"\n file_data_as_string = get_RESULT_json_from_file(file_name)\n response = CToolsDirectResponse.new(file_data_as_string, Hash.new)\n logger.debug \"#{__method__}: #{__LINE__}: response: \"+response.inspect\n dash_format = response.toDoLms\n\n logger.debug \"#{__method__}: #{__LINE__}: dash_format: \"+dash_format.inspect\n dash_format.each do |a|\n assert_match /assignmentId/,a[:link],\"url has expected value assignmentId\"\n assert_match /&sakai_action=doView_submission/,a[:link],\"url has expected action parameter\"\n end\n end",
"def parse_test_report(language, test_report)\n if language.is_a?(Coursemology::Polyglot::Language::Java)\n Course::Assessment::Java::JavaProgrammingTestCaseReport.new(test_report).test_cases\n else\n Course::Assessment::ProgrammingTestCaseReport.new(test_report).test_cases\n end\n end",
"def multiple_choice_report\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHOOSE_AUTHORIZE\n # no authorization needed ...\n # authorize Portal::Learner\n # authorize @learner\n # authorize Portal::Learner, :new_or_create?\n # authorize @learner, :update_edit_or_destroy?\n @portal_learner = Portal::Learner.find(params[:id])\n \n respond_to do |format|\n format.html # report.html.haml\n end\n end",
"def test_add_assignment_participant()\n\t\tparticipant = AssignmentParticipant.new\n\t\tassert !participant.valid?\n\t\t\n\t\t#TODO read TODO tag in line 13\n\t\t\n\t\tparticipant.handle = 'test_handle'\n\t\tassert participant.valid?\n\tend",
"def cop_reports=(_); end",
"def test_new_report\n\n testOne = BookmarkReport.newReport(2, 1, \"issue\", \"description\");\n\n assert_equal true, testOne\n\n testTwo = BookmarkReport.newReport(nil, 1, \" \", \"test\");\n\n assert_equal false, testTwo\n\n end",
"def show\n @assignment = Assignment.find(params[:id])\n @course = @assignment.course\n @user = current_user\n if @user.instructor?(@course)\n if params[:fix]\n fix\n end\n if reviewer_id = params[:reviewer]\n @reviewer = User.find(reviewer_id)\n @reviewing_tasks = @assignment.evaluations.forUser(@reviewer)\n render 'assignments/show_instructor'\n return\n else\n redirect_to(edit_course_assignment_url(@course, @assignment))\n return\n end\n end\n\n # User is a student. Create 'To Do' List\n @to_do = @course.to_do(current_user)\n\n @reviewing_tasks = @assignment.evaluations.forUser(current_user).sort_by{|t| t.created_at}\n if Time.zone.now > @assignment.review_due # allow late reviewing until instructor ends\n @reviewing_tasks = @reviewing_tasks.select{|r| r.finished or !r.submission.instructor_approved }\n end\n @submissions = @assignment.get_submissions(current_user)\n @submission = @submissions.sort_by{|s| s.created_at }.last\n unless @submission\n @submission = Submission.new(assignment_id: @assignment.id)\n end\n @questions = @assignment.questions.sort_by{|q| q.created_at }\n @teams = @user.memberships.select{|m| m.assignment.course_id == @course.id and m.assignment_id == @assignment.id }.\n map{|m| User.find(m.pseudo_user_id)}\n\n @s3_direct_post = S3_BUCKET.presigned_post(\n key: vanilla(@course.name) + '/' + @user.id.to_s + '/' + vanilla(@assignment.name) + '.pdf',\n success_action_status: 201,\n acl: :public_read,\n content_type: 'application/pdf') # For uploads. It will be filed under the human (not team) user id.\n\n respond_to do |format|\n format.html\n format.json {render json: @assignment }\n end\n end",
"def report_status_td(report)\n render 'reports/report_status_td', :report => report\n end",
"def set_report\n @report = Report.find(params[:id])\n redirect_to dashboard_path, notice: \"Sorry, but you don't have permission to view that.\" unless @report.company_id == current_user.company_id\n end",
"def set_question_report\n @question_report = QuestionReport.find(params[:id])\n end",
"def index\n @techers_assignments = TechersAssignment.all\n end",
"def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n \n @report.test_suite.test_cases.each do |test_case|\n @report.results.create({ status: 'Queued', report_id: @report, test_case_id: test_case.id})\n end\n \n format.html { redirect_to [:admin, @report], notice: 'Report was successfully created.' }\n format.json { render action: 'show', status: :created, location: @report }\n else\n format.html { render action: 'new' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_display_as_html\r\n\r\n assert_equal @responsemaps.reviewer_id, 380671078\r\n assert_equal @responsemaps.reviewee_id, 538862539\r\n time = @response.updated_at\r\n puts time\r\n assert @response.display_as_html\r\n end",
"def goto\n navigate_application_to \"Report=>Custom Views\"\n end"
] |
[
"0.67401147",
"0.622488",
"0.61929166",
"0.6048909",
"0.5982111",
"0.58500254",
"0.58500254",
"0.5776563",
"0.5731412",
"0.568352",
"0.56371826",
"0.5625055",
"0.55252844",
"0.54299563",
"0.53632176",
"0.5355442",
"0.5316235",
"0.52715546",
"0.5243433",
"0.5243433",
"0.5243433",
"0.5243433",
"0.5243433",
"0.52016807",
"0.5177215",
"0.51684177",
"0.51340884",
"0.5133559",
"0.51234734",
"0.5103673",
"0.50869095",
"0.5053344",
"0.5031466",
"0.50166583",
"0.501298",
"0.5004245",
"0.5000185",
"0.49984208",
"0.4993275",
"0.4993275",
"0.4991439",
"0.4976596",
"0.4968539",
"0.49542832",
"0.49527818",
"0.49478468",
"0.49460414",
"0.49386364",
"0.49369338",
"0.49277824",
"0.4924258",
"0.49225438",
"0.49218962",
"0.49025697",
"0.49019182",
"0.4896129",
"0.4891419",
"0.48891804",
"0.48850223",
"0.48812163",
"0.48811907",
"0.48771223",
"0.48723933",
"0.48574078",
"0.4853851",
"0.48422605",
"0.48375636",
"0.48370117",
"0.48370114",
"0.4824061",
"0.48198074",
"0.4817814",
"0.48167375",
"0.48035938",
"0.4802643",
"0.4800243",
"0.47947562",
"0.47929645",
"0.47910416",
"0.47874057",
"0.47860608",
"0.47747245",
"0.47722074",
"0.4766417",
"0.47658685",
"0.47636878",
"0.47633338",
"0.47606182",
"0.4758173",
"0.47578466",
"0.4755722",
"0.4752518",
"0.4750792",
"0.47486973",
"0.4748368",
"0.47429255",
"0.47428772",
"0.47408116",
"0.47372395",
"0.47322837"
] |
0.7340644
|
0
|
A featured number (something unique to this exercise) is an odd number that is a multiple of 7, and whose digits occur exactly once each. So, for example, 49 is a featured number, but 98 is not (it is not odd), 97 is not (it is not a multiple of 7), and 133 is not (the digit 3 appears twice). Write a method that takes a single integer as an argument, and returns the next featured number that is greater than the argument. Issue an error message if there is no next featured number. Solution :
|
def featured(n)
(n..9_999_999_999).each {|number| return number if number_valid?(n, number)}
return "There is no possible number that fulfills those requirements."
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def featured(num)\n # next_num = 7 # assume input is only positive\n closer_num = num / 7 * 7 # to start closer to the next required number instead of starting from 7\n next_num = closer_num.odd? ? closer_num : closer_num + 7 # so that next_num is odd and we can increment by 14 in the while loop\n\n while next_num < 9_999_999_999\n if next_num % 7 == 0 \\\n && next_num.to_s.size == next_num.to_s.chars.uniq.size \\\n && next_num > num\n return next_num\n else\n next_num += 14\n end\n end\nend",
"def featured(int)\n next_num = 0\n loop do\n next_num = int.succ\n break if next_num.odd? && next_num % 7 == 0\n int = next_num\n end\n loop do\n break if next_num >= 9_876_543_210\n if next_num.to_s.chars.uniq == next_num.to_s.chars\n return next_num\n else next_num += 14\n end\n end\n \"There is no possible number that fulfills those requirements.\"\nend",
"def featured(int)\n if int >= 9_876_543_210\n return 'There is no possible number that fulfills those requirements.'\n end\n \n featured_num = 0\n until featured_num > int\n loop do\n featured_num += 7\n next if featured_num.even?\n next if featured_num.digits != featured_num.digits.uniq\n break\n end\n end\n featured_num\nend",
"def featured(number)\n max = 9_876_543_210\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n loop do\n number_chars = number.to_s.chars\n if number_chars.size == number_chars.uniq.size\n return number\n end\n if number > max\n break\n end\n number += 14\n end\n \"ERROR! No next featured number!\"\nend",
"def featured(n)\n # The next 2 lines guarantees we start with odd multiples of 7 that is higher than n\n n += 1\n n += 1 until n.odd? && n % 7 == 0\n\n while n < 9_876_543_201\n return n if featured?(n)\n n += 14 # this hastens the loop - we only iterate odd multiples of 7\n end\n raise StandardError, \"No more featured number available\"\nend",
"def featured(num)\n return 'Error! No featured numbers exist over 10 digits!' if num >= 9876543210\n loop do\n num += 1\n break if num.odd? && (num % 7).zero? && num.digits.uniq! == nil\n end\n num\nend",
"def featured(num)\n num += 1\n num += 1 until num.odd? && (num % 7).zero?\n loop do\n return num if num.to_s.chars.size == num.to_s.chars.uniq.size\n num += 14\n break if num > 9_876_543_210\n end\n 'There is no possible number that fulfills those requirements'\nend",
"def featured(num)\n num +=1 \n until num % 7 == 0 && num.odd?\n num += 1\n end\n\n loop do\n return num if num.to_s.chars.uniq == num.to_s.chars\n num += 14\n break if num >= 9_876_543_210\n end\n\n \"Your quest is doomed. There is no featured number beyond these walls.\"\nend",
"def featured(num)\n divisor = num / 7\n count = 1\n total = 0\n\n until (count > divisor) && (total.odd? && total > num) \n total = count * 7\n count += 1\n end\n\n loop do\n number_chars = total.to_s.split('')\n return total if number_chars.uniq == number_chars\n total += 7\n break if num >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements'\nend",
"def featured(number)\n number += 1\n\n until number % 7 == 0 && number.odd?\n number += 1\n end\n\n loop do\n if number.digits.uniq == number.digits\n return number\n else\n number += 14\n end\n break if number.digits.size > 10\n end\n\n \"Error\"\nend",
"def featured(number)\n featured = 0\n loop do \n number += 1\n if number % 7 == 0 &&\n number.odd? &&\n number.to_s.length == number.to_s.chars.uniq.length\n featured = number\n break\n end\n if number.to_s.length > 10\n puts \"Invalid\"\n featured = 0\n break\n end\n end\n featured\nend",
"def featured(integer)\n return \"There is no possible number that fulfills those requirements\" if \n integer >= 9_876_543_210\n integer += 1\n until integer % 7 == 0 && integer.odd? && integer.digits.uniq! == nil\n integer += 1\n end\n integer\nend",
"def featured(int)\n int += 1\n int += 1 until int % 7 == 0 && int.odd?\n \n loop do\n double_check = int.to_s.split(\"\")\n if double_check.uniq == double_check\n return int\n else\n int += 14\n end \n break if int >= 9_876_543_210 \n end\n \"There is no possible number that fulfills those requirements\"\nend",
"def featured(int)\n loop do \n int += 1\n if int.odd? && int % 7 == 0\n return int if int.to_s.chars.uniq == int.to_s.chars\n end\n break if int == 9_999_999\n end\n \"There is no possible number that fulfils those requirements\"\nend",
"def featured(integer)\n return \"Error: There is no possible number that fulfills those requirements\" if integer >= 9_876_543_210\n counter = integer + 1\n counter += 1 until counter % 7 == 0 && counter.odd?\n \n loop do\n return counter if counter.digits.uniq.size == counter.digits.size\n counter += 14\n end\nend",
"def featured(num)\n loop do\n num += num % 7 == 0 ? 7 : 1\n num_str = num.to_s.chars\n return num if num.odd? && num % 7 == 0 && num_str.uniq == num_str\n break if num >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend",
"def featured(num)\n number = 0\n\n loop do\n if num % 7 != 0 && num.even?\n number += 7 \n elsif num % 7 != 0 && num.odd?\n number += 7\n else\n number += 7\n end\n break if number % 7 == 0 && number > num && number.odd?\n end\nend",
"def featured(number)\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n\n loop do\n number_chars = number.to_s.split('')\n return number if number_chars.uniq == number_chars\n number += 14\n break if number > 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend",
"def featured(int)\n for num in (int + 1...9_999_999_999) \n return num if num.odd? && num % 7 == 0 && num.digits == num.digits.uniq\n end\n \"There is no possible number that fulfills those requirements\"\nend",
"def featured(integer)\n count = 0\n\n loop do \n break if count >= 9_999_999_999\n count += 7\n if count.odd? && count % 7 == 0 && count.digits.uniq == count.digits && count > integer\n return count\n end\n end\n \"There is no possible number that fulfills those requirements.\"\nend",
"def featured(number)\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n\n loop do\n number_chars = number.to_s.split('')\n return number if number_chars.uniq == number_chars\n number += 14\n break if number >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend",
"def featured2(number)\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n\n loop do\n number_chars = number.to_s.split('')\n return number if number_chars.uniq == number_chars\n number += 14\n break if number >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend",
"def featured(n)\n n += 1\n n += 1 until n % 7 == 0 && n.odd?\n loop do\n break if n.to_s.chars.uniq.join == n.to_s\n n += 14\n if n > 9876543210\n puts \"There is no possible number that fulfills those requirements\"\n return nil\n end\n end\n n\nend",
"def featured(number)\n sum = 7\n loop do \n return \"There is no possible number that fulfills those requirements\" if number >= 9_876_543_210\n if sum <= number\n sum += 7\n elsif sum.even?\n sum += 7\n elsif sum.digits.uniq != sum.digits\n sum += 7\n else\n break\n end\n end\n sum\nend",
"def featured(i) # found digits method but only works > v2.4 so...\n i = i - i % 7\n loop do\n i += 7\n list = []\n x = i\n while x > 0 do\n list.unshift(x % 10)\n x /= 10\n end\n if list.length > 9; return \"There is no possible number that fulfills those requirements\" end\n if list == list.uniq; break end\n end \n i\nend",
"def featured?(num)\n num.odd? && num % 7 == 0 && num.digits.uniq.size == num.digits.size\nend",
"def featured(number)\n loop do\n number +=1\n characters = number.to_s.split('')\n if (number.odd?) && (number % 7 == 0) && (characters.uniq == characters) \n p number\n break\n end \n end \nend",
"def featured_num?(num)\n num.odd? && num % 7 == 0 && num.digits.uniq == num.digits\nend",
"def featured_num?(num)\n return false unless num.odd?\n return false unless num % 7 == 0\n return false unless num.digits.size == num.digits.uniq.size\n true\nend",
"def featured?(num)\n chars = num.to_s.chars\n num % 7 == 0 && num.odd? && chars.none? { |char| chars.count(char) > 1 }\nend",
"def is_featured?(num)\n if !num.odd?\n return false\n elsif num % 7 != 0\n return false\n elsif num.to_s.chars.uniq.length != num.to_s.length\n return false\n else\n true\n end\nend",
"def next_number(number)\n if number.even?\n number / 2\n else\n 3 * number + 1\n end\nend",
"def featured?(num)\n chars = num.to_s.split(//)\n num.odd? && (num % 7).zero? && chars.size == chars.uniq.size\nend",
"def find_number\n\ti = 0 \n\tnot_found = true\n\twhile not_found \n\t\ti+=1\n\t\t#puts i \n\t\t#puts is_int(f6(i))\n\t\tnot_found = ! is_int(f6(i.to_f))\n\tend\n\ti\nend",
"def next_number(last)\n\t#checks on the value at the 25th point\n\ttap25 = (last & 0x1000000) != 0 # 1_0000_0000_0000_0000_0000_0000\n\t#checks on the value at the 22nd point\n\ttap22 = (last & 0x200000) != 0 # 0_0010_0000_0000_0000_0000_0000\n\txnor = !(tap25 ^ tap22)\n\t\n\tif xnor\n\t\t#\"<<\" pushes all the digits up\n\t\t#the \"& 0x1FFFFFF\" cuts off any ones that are too large\n\t\t#then adds a one to the end - that OR will always return true, because they're shifted everything up\n\t\treturn ((last << 1) & 0x1FFFFFF) | 0x00000001\n\telse\n\t\treturn ((last << 1) & 0x1FFFFFF)\n\tend\nend",
"def next_num(num)\n return num + 1\nend",
"def next_number(num)\n return num + 1\nend",
"def next_number(num)\n return num + 1\nend",
"def next_number(num)\n return num + 1\nend",
"def next_number(num)\n return num + 1\nend",
"def next_number(num)\n num + 1\n end",
"def next_number(number)\n return number +1\nend",
"def next_bigger_num(num)\r\n digits = num.digits\r\n sorted_digits = digits.sort { |a, b| b <=> a }\r\n if digits.count(digits[0]) == digits.size || digits.size < 2 || sorted_digits == digits.reverse\r\n return -1\r\n end\r\n \r\n permutation = digits.permutation.to_a.map do |sub_arr|\r\n sub_arr.join('').to_i\r\n end\r\n \r\n sorted_permutation = permutation.sort\r\n \r\n sorted_permutation.each do |current_num|\r\n return current_num if current_num > num\r\n end\r\nend",
"def next_number(number)\n number.to_i\n return number+=1\nend",
"def next_bigger(input)\n puts \"input = #{input}\"\n puts '------------------'\n puts\n puts\n\n digits = input.to_s.chars.map(&:to_i)\n\n return -1 if all_digits_are_the_same?(digits)\n\n result = input\n tail = -1\n next_tail = -1\n next_tail_digit = nil\n\n puts 'Starting iterations to find the bigger number by permutating digits from right to left...'\n puts\n while(tail.abs < digits.length && result <= input)\n next_tail = tail -1\n tail_digit = digits[tail]\n next_tail_digit = digits[next_tail]\n\n if to_number(next_tail_digit, tail_digit) > to_number(tail_digit, next_tail_digit)\n puts \"SKIPPING flipping since #{next_tail_digit}#{tail_digit} > #{tail_digit}#{next_tail_digit}\"\n else\n puts \"FLIPPING digits...\"\n puts \"digits before = #{digits}\"\n digits[tail] = next_tail_digit\n digits[next_tail] = tail_digit\n puts \"digits after = #{digits}\"\n\n result = digits.join.to_i\n\n puts \"tail = #{tail} digit = #{tail_digit}\"\n puts \"next_tail = #{next_tail} digit = #{next_tail_digit}\"\n puts \"result = #{result}\"\n end\n\n tail -= 1\n puts \"new_tail = #{tail}\"\n puts '--'\n puts ''\n end\n\n return -1 if result == input\n\n replaced_digit = next_tail_digit\n winning_digit = digits[next_tail]\n\n puts\n puts \"Iterations Completed and Bigger number found: #{result}\"\n puts \" - Digit that won was: #{winning_digit}.\"\n puts \" - It replaced the digit: #{replaced_digit} from input: #{input} at index #{next_tail}.\"\n puts\n puts \"Let see if we can make the number smaller by sorting the numbers to the right from bigger to smaller\"\n\n digits_before = digits.slice(0..next_tail)\n digits_after = digits.slice((next_tail+1)..-1)\n sorted_digits_after = sort_desc(digits_after)\n\n puts\n puts \"digits_before: #{digits_before}, digits_after: #{digits_after}\"\n puts \"Sorting digits after: #{sorted_digits_after}\"\n puts \"Resulting Number: #{array_to_number(digits_before + sorted_digits_after)}\"\n puts\n puts \"Now let see if we can find any number to the right of the winning position that\" \\\n \" is smaller than the number that won #{winning_digit} but bigger than the replaced digit #{replaced_digit}...\"\n\n index_of_digit_smaller_than_winner = sorted_digits_after.find_index { |d| d < winning_digit && d > replaced_digit }\n\n if index_of_digit_smaller_than_winner\n digit_smaller_than_the_winner = sorted_digits_after[index_of_digit_smaller_than_winner]\n puts\n puts \"We found it one! Since the array was already sorted we can trust that the one we found is the smalles one.\"\n puts \"Index: #{index_of_digit_smaller_than_winner} and number: #{digit_smaller_than_the_winner}\"\n puts \"Lets switch the winning number by this one now.\"\n puts \"Before: #{digits_before} + #{sorted_digits_after}\"\n\n digits_before[-1] = digit_smaller_than_the_winner\n sorted_digits_after[index_of_digit_smaller_than_winner] = winning_digit\n\n puts \"After: #{digits_before} + #{sorted_digits_after}\"\n puts\n puts \"We now have to sort the digits again because they may be out of order:\"\n sorted_digits_after = sort_desc(sorted_digits_after)\n puts \"After Re-Sorting: #{digits_before} + #{sorted_digits_after}\"\n puts\n end\n\n result = digits_before + sorted_digits_after\n result.join.to_i\nend",
"def next_number(n)\n n.even? ? n/2 : 3*n+1\nend",
"def next_number(number)\n\n return number + 1\n\nend",
"def next_number(number)\n output = number + 1\n return output\nend",
"def next_bigger(input) \n\treturn -1 if input <= 10\n\treversed_input = input.to_s.split(\"\").reverse.map { |m| m.to_i } # = [7,1,0,2]\n\treversed_input.each_with_index do |m,i|\n if m > reversed_input[i+1] # 7 > 1 then switch and break\n \tswitch = reversed_input[i+1]\n \treversed_input[i+1] = m\n \treversed_input[i] = switch\n \tbreak\n end \n\tend # reversed_input = [1,7,0,2] \n reversed_input.reverse.join(\"\").to_i # returns 2071\nend",
"def multiple_of_7(num)\n num % 7 == 0\nend",
"def fact num\n if num == 0\n 1\n elsif num == 1\n 1\n elsif num == 2\n 2\n elsif num == 10\n 3628800\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 pe52(startAt, endAt)\n (startAt..endAt).step(6).each do |x|\n bNum = x/6\n bNumCSort = bNum.to_s.chars.sort\n next if bNumCSort != x.to_s.chars.sort\n next if bNumCSort != (bNum*5).to_s.chars.sort\n next if bNumCSort != (bNum*4).to_s.chars.sort\n next if bNumCSort != (bNum*3).to_s.chars.sort\n next if bNumCSort != (bNum*2).to_s.chars.sort\n return bNum\n end\n false\nend",
"def next_number(number)\n return number += 1\nend",
"def next_check_number\n\t\tmaximum = cash_bank_check_offereds.maximum(\"number\")\n\t\t(maximum ? maximum+1 : initial_check_number).to_s\n\tend",
"def problem_seven\n Prime.first(10_001).last\n end",
"def solution(digits)\n result = 0\n digits.size.times do |n|\n new_number = digits[n...(n + 5)].to_i\n result = new_number if new_number > result\n end\n result\nend",
"def next_number(num)\n return num += 1\nend",
"def next_bigger_num(num)\n return -1 if num if num.digits.all? {|digit| digit == num[0]}\n return -1 if num.digits.sort! {|a,b| b <=> a}.join.to_i == num\n \n combinations = num.digits.permutation(num.digits.length).to_a\n \n combinations.map! do |arr|\n arr.join.to_i\n end.sort!\n \n combinations.each.with_index do |number, index|\n return combinations[index + 1] if number == num\n end\n \nend",
"def count7(int)\n if( int < 10)\n if int == 7\n return 1\n else\n return 0\n end\n end\n right_most = int % 10\n right_most == 7 ? 1 + count7(int / 10) : 0 + count7(int / 10)\nend",
"def next_largest_number (array, given_number)\n array.find {|number| number > given_number}\nend",
"def cheat number\n if number > 0 && number < 7\n @numberShowing = number\n return true\n end\n return false\n end",
"def get_actual_number(number)\n if number >= 31\n return number + 2\n else\n return number + 1\n end\n end",
"def next_smaller(n)\n result = n.digits.permutation.select { |p| p.join.to_i < n && p.first != 0 }\n result.empty? ? -1 : result.last.join.to_i\nend",
"def find_smallest_multiple(num,count,acc)\n if count == max\n return acc\n #if number is divisible by one last than the number\n elsif !check_a_num(num,count)\n acc*num\n return check_a_num(num,count)\n \n \n end\n puts num\nend",
"def divisible_by_seven(nums)\n nums.each do |num|\n if num % 7 == 0\n return num\n end\n end\nend",
"def divisive_by_7(x)\n x % 7 == 0 ? \"yup!\" : \"nope!\"\nend",
"def next_num(num, max=9, min=0)\r\n arr = num\r\n done = false\r\n for i in 0...arr.length\r\n index = arr.length - i - 1\r\n \tif arr[index] == max\r\n \t arr[index] = min\r\n \t next\r\n \tend\r\n\t arr[index] += 1\r\n done = true\r\n\t break\r\n end\r\n arr = [min] + arr if not done\r\n arr.join_to_i\r\nend",
"def next_greater_element(nums)\n res = []\n nums.each_with_index do |num, idx|\n\n pushed = false\n (nums.length - 1).times do |step|\n current_idx = (idx + step + 1) % nums.length\n\n if nums[current_idx] > num\n res.push(nums[current_idx])\n pushed = true\n break\n end\n\n end\n\n res.push(-1) unless pushed\n end\n\n res\nend",
"def factrl(num)\n num > 0 ? num.downto(1).inject(:*) : 1\nend",
"def boolean_smallest_miltiple (num, low, high)\n while low < high\n if num%low != 0\n return false\n end\n low = low + 1\n end\n true\nend",
"def highest_prime_number_under(number)\n until is_prime?(number)\n number -= 1\n end\n number\nend",
"def digit_factorials\n max = biggest_possible_digit_factorial\n results = []\n \n test_number = 10\n \n while test_number <= max\n results << test_number if is_curious?(test_number)\n test_number += 1\n end\n \n print results\n results.inject(:+)\nend",
"def previous_number(number)\n if !number.is_a?(Integer)\n return false\n else \n return number-1\n end\nend",
"def generate_next(number)\n if number == 0\n return 0\n elsif number == 1\n return 1\n else\n next_element = generate_next(number-1) + generate_next(number-2)\n end\n return next_element\nend",
"def find_greatest(numbers)\n saved_number = nil\n\n\n numbers.each do |num|\n saved_number ||= num\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n\n\nsaved_number\nend",
"def guess_the_number\n prog_num=rand(1..20)\ncounter=0\nwhile counter < 10\nnumber=user_guessing\ncounter+=1\nif number>prog_num\n if number-(prog_num)>5\n puts \"too large try no.#{counter}\"\n else number-(prog_num)>5\n puts \"bit large try no.#{counter}\"\n end\nelsif number<prog_num\n if (prog_num)-number>5\n puts \"too small try no.#{counter}\"\n else (prog_num)-number>5\n puts \"bit small try no.#{counter}\"\n end\nelsif number==prog_num\n return puts \"you win after #{counter} try(s).\"\nend\nend\nend",
"def smallest_number()\r\n\tprime_numbers = [19,17,13,11,7,5,3,2] # primes numbers from 0-20.\r\n\tproduct_prime = prime_numbers.reduce(:*)\r\n\tnumber = product_prime\r\n\twhile (1)\r\n\t\treturn number if divisible_1to20?(number)\r\n\t\tnumber += product_prime\r\n\tend\r\nend",
"def find_min_num(num)\n return 1 if num == 1\n n = 2\n minimum_num = nil\n loop do\n minimum_num = n if divisors(n).flatten.uniq.size == num\n n += 1\n break if minimum_num\n end\n minimum_num\nend",
"def solution(number)\n ans = 0\n (3...number).step(3) {|n| ans += n}\n (5...number).step(5) {|n| n % 3 == 0 ? next : ans += n}\n return ans\nend",
"def featured?(num)\n num.odd? && num.to_s.chars.uniq.size == num.to_s.chars.size\nend",
"def find_greatest(numbers)\n saved_number = nil\n\n numbers.each do |num|\n saved_number = numbers[0]\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n p saved_number\nend",
"def smallest_paledrome(original_num)\n paledrome = (original_num + 1).to_s\n return paledrome if paledrome.eql?(paledrome.reverse)\n number = original_num\n until paledrome.eql?(paledrome.reverse) do\n number += 1\n paledrome = number.to_s\n return paledrome if paledrome.eql?(paledrome.reverse)\n end\nend",
"def largest_palindrome_product(max_factor, min_factor)\n max_num = max_factor ** 2\n min_num = min_factor ** 2\n max_num.downto(min_num) do |num|\n if is_palindrome?(num) && has_three_digit_factors?(num, min_factor, max_factor)\n puts \"FOUND ONE!\"\n puts num\n return num\n end\n end\nend",
"def highest_prime_number_under(number)\n counter = number\n number.times do\n if is_prime?(counter)\n p counter\n break\n else\n counter -= 1\n end\n end\nend",
"def smallest_multiple(top_divisor)\n num = 1\n loop do\n return num if top_divisor.downto(1).all? { |divisor| num % divisor == 0 }\n num += 1\n end\nend",
"def biggest_possible_digit_factorial\n digits = 1\n \n loop do \n digits += 1\n break if digits * factorial(9) < ('9' * digits).to_i\n end\n ('9' * digits).to_i\nend",
"def last_digit_odd?(int)\r\n # your code goes here\r\n last_digit(int) % 2 == 1\r\nend",
"def findFiveHundred(numberOfFactors)\n count = 1\n triangleNumber = 0\n factors = 0;\n while(factors <= numberOfFactors)\n triangleNumber = triangleNumber + count\n factors = countFactors(triangleNumber)\n\n if(factors > numberOfFactors)\n return triangleNumber\n end\n count += 1\n end\n\n\nend",
"def is_keith_number?(num)\n return false if num < 10\n digits = num.digits.reverse\n current_sum = 0\n iteration = 0\n \n until current_sum >= num\n current_sum = digits.sum\n digits.shift\n digits << current_sum\n iteration += 1\n end\n return iteration if current_sum == num\n false\nend",
"def prime_digit_replacement()\r\n\treturner = 1000000\r\n\t# Loop through not repeated digits\r\n\tfor digits in (11..999).step(2)\r\n\t\t# Sum of 3 repeated digits is divisable by 3\r\n\t\tnext if digits % 3 == 0\r\n\t\t# The last digit is 1, 3, 7 or 9\r\n\t\tnext if digits % 5 == 0\r\n\t\t\r\n\t\t\r\n\t\tthe_patterns = (digits < 100)? five_digit_pattern() : \r\n\t\t\t\t\t\t\t\t\t\tsix_digit_pattern()\r\n\t\t\r\n\t\tfor a_pattern in the_patterns\r\n\t\t\t# Check 'the smallest' members of '8 primes' family\r\n\t\t\tfor repeated_d in (0..2)\r\n\t\t\t\tnext if ((a_pattern[0] == 0) and (repeated_d == 0))\r\n\t\t\t\t\r\n\t\t\t\t# Create a number\r\n\t\t\t\tto_test = []\r\n\t\t\t\ttmp_digits = digits\r\n\t\t\t\tfor i in a_pattern.reverse()\r\n\t\t\t\t\tif i == 1\r\n\t\t\t\t\t\tto_test.unshift(tmp_digits % 10)\r\n\t\t\t\t\t\ttmp_digits /= 10\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tto_test.unshift(repeated_d)\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\ta_number = to_test.inject(0){ |multi, val| multi*10 + val }\r\n#\t\t\t\tputs \"\\t#{a_number}\"\r\n\t\t\t\t\r\n\t\t\t\t# Check for prime\r\n\t\t\t\tif (a_number < returner) && (Prime.prime?(a_number))\r\n\t\t\t\t\t# Check for family\r\n\t\t\t\t\tfamily_size = 0\r\n\t\t\t\t\tfor i in (repeated_d..9)\r\n\t\t\t\t\t\ttmp = to_test.map{ |a| (a == repeated_d)? i : a }\r\n\t\t\t\t\t\ttmp_num = tmp.inject(0){ |multi, val| multi*10 + val }\r\n\t\t\t\t\t\tif Prime.prime?(tmp_num)\r\n\t\t\t\t\t\t\tfamily_size += 1\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\t\treturner = a_number if family_size > 7\r\n\t\t\t\t\t\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\treturn returner\r\nend",
"def solution(digits)\n\tstop = digits.length - 4\n\tgo = 0\n\tlargest_number = 0\n\tindex = 0\n\n\twhile go < stop\n\t\ttest = \"\"\n\t\textra_index = index\n\t\t5.times do \n\t\t\ttest += digits[extra_index].to_s\n\t\t\textra_index += 1 \n\t\tend\n\t\tif test.to_i > largest_number\n\t\t\tlargest_number = test.to_i\n\t\tend \n\t\tindex += 1\n\t\tgo += 1 \n\tend \n\tlargest_number\nend",
"def solution(digits)\n greatest = 0\n (0..(digits.size - 1)).each do |pos|\n num = digits[pos..pos+5].to_i\n greatest = num if num > greatest\n end\n greatest \nend",
"def factor_primes(num)\n\n return \"Not a valid number\" if num < 2\n\n for divisor in 2..(num - 1)\n while num % divisor == 0 \n (divisor * divisor > num) ? (return num) : (num /= divisor)\n # puts \"The divisor is #{divisor}\"\n # puts \"The new num is #{num}\"\n end\n end\n puts \"only divisible by 1 and itself\"\nend",
"def smallest_n_digit_number(n)\n 10 ** (n-1)\nend",
"def twelve\n iter = 1\n trinum_temp = 0\n begin\n factors = count_factors(trinum_temp = (trinum(iter)))\n iter = iter + 1\n\n end until factors > 200\n\n return trinum_temp\nend",
"def problem_104\n all = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\n k = 2\n low_fn0,low_fn1 = 1,1\n hi_fn0,hi_fn1 = 1,1\n loop do\n k += 1\n low_fn0,low_fn1 =(low_fn0 + low_fn1) % 10_000_000_000, low_fn0\n hi_fn0, hi_fn1 = hi_fn0 + hi_fn1, hi_fn0\n if hi_fn0 > 1_000_000_000_000_000_000\n hi_fn0 /= 10\n hi_fn1 /= 10\n end\n front = false\n next unless k > 300\n hi = hi_fn0.to_s[0,9].split(//)\n if (hi & all).length == 9\n puts \"front #{k}\" \n front = true\n end\n if (low = low_fn0.to_s).length >= 9\n low = low[-9,9].split(//)\n if (low & all).length == 9\n puts \"back #{k}\" \n return k if front\n end\n end\n end\nend",
"def solve (input)\n output = 0\n mult_five = 5\n curr_val = 3\n\n while curr_val < input\n if curr_val > mult_five\n output += mult_five\n mult_five += 5\n elsif curr_val == mult_five\n mult_five += 5\n end\n\n output += curr_val\n curr_val += 3\n end\n\n return output\nend",
"def smallest_multiple(num)\n\n curr = num\n\n loop do\n state = true\n for i in num.downto(1)\n if curr % i != 0\n state = false\n break\n end\n end\n if state == true\n return curr\n else\n curr += num\n end\n end\n\nend",
"def largest_pfactor(number)\n i=2\n\n while i<=number\n\n if i==number\n puts number\n elsif number%i == 0\n number=number/i\n puts i\n i=2\n end\n\n if i%2==0\n i+=1\n else\n i+=2\n end\n\n end\n\nend"
] |
[
"0.8416592",
"0.83547753",
"0.8308533",
"0.8230069",
"0.8137688",
"0.8069092",
"0.80039865",
"0.79901063",
"0.78999215",
"0.78786457",
"0.7830859",
"0.78024894",
"0.78010833",
"0.7773184",
"0.76714987",
"0.76628697",
"0.7648454",
"0.76433915",
"0.76429534",
"0.7612073",
"0.7601259",
"0.7553633",
"0.7553513",
"0.74643487",
"0.73440266",
"0.7011124",
"0.6985374",
"0.6964022",
"0.68602854",
"0.6801811",
"0.6757606",
"0.6706573",
"0.64949745",
"0.64753276",
"0.63823646",
"0.635679",
"0.6328737",
"0.6328737",
"0.6328737",
"0.6328737",
"0.63045025",
"0.63010323",
"0.6297566",
"0.6264068",
"0.62610155",
"0.62433004",
"0.62237924",
"0.62227774",
"0.62117976",
"0.61987776",
"0.6153906",
"0.60847896",
"0.6057597",
"0.6042417",
"0.6041908",
"0.60398835",
"0.6030734",
"0.6019853",
"0.6018099",
"0.60010546",
"0.5995678",
"0.5995513",
"0.5994851",
"0.59362864",
"0.59336567",
"0.5929518",
"0.5875395",
"0.5871164",
"0.58568215",
"0.58550686",
"0.5843704",
"0.58295196",
"0.58145475",
"0.5796969",
"0.5775119",
"0.5758982",
"0.57507706",
"0.57500297",
"0.57468283",
"0.5731185",
"0.5729484",
"0.5713296",
"0.57065374",
"0.5704773",
"0.5702769",
"0.5689837",
"0.5689645",
"0.56734514",
"0.5668717",
"0.56556565",
"0.5650054",
"0.5642229",
"0.5638988",
"0.56335413",
"0.5628489",
"0.56281316",
"0.5627814",
"0.56265664",
"0.56253785",
"0.56199336"
] |
0.71051323
|
25
|
based on the reference spec in lib/rpmvercmp.c in rpm 4.9.0
|
def rpmvercmp(x, y)
# easy! :)
return 0 if x == y
if x.nil?
x = ""
end
if y.nil?
y = ""
end
# not so easy :(
#
# takes 2 strings like
#
# x = "1.20.b18.el5"
# y = "1.20.b17.el5"
#
# breaks into purely alpha and numeric segments and compares them using
# some rules
#
# * 10 > 1
# * 1 > a
# * z > a
# * Z > A
# * z > Z
# * leading zeros are ignored
# * separators (periods, commas) are ignored
# * "1.20.b18.el5.extrastuff" > "1.20.b18.el5"
x_pos = 0 # overall string element reference position
x_pos_max = x.length - 1 # number of elements in string, starting from 0
x_seg_pos = 0 # segment string element reference position
x_comp = nil # segment to compare
y_pos = 0
y_seg_pos = 0
y_pos_max = y.length - 1
y_comp = nil
while x_pos <= x_pos_max && y_pos <= y_pos_max
# first we skip over anything non alphanumeric
while (x_pos <= x_pos_max) && (isalnum(x[x_pos]) == false)
x_pos += 1 # +1 over pos_max if end of string
end
y_pos += 1 while (y_pos <= y_pos_max) && (isalnum(y[y_pos]) == false)
# if we hit the end of either we are done matching segments
if (x_pos == x_pos_max + 1) || (y_pos == y_pos_max + 1)
break
end
# we are now at the start of a alpha or numeric segment
x_seg_pos = x_pos
y_seg_pos = y_pos
# grab segment so we can compare them
if isdigit(x[x_seg_pos].ord)
x_seg_is_num = true
# already know it's a digit
x_seg_pos += 1
# gather up our digits
x_seg_pos += 1 while (x_seg_pos <= x_pos_max) && isdigit(x[x_seg_pos])
# copy the segment but not the unmatched character that x_seg_pos will
# refer to
x_comp = x[x_pos, x_seg_pos - x_pos]
y_seg_pos += 1 while (y_seg_pos <= y_pos_max) && isdigit(y[y_seg_pos])
y_comp = y[y_pos, y_seg_pos - y_pos]
else
# we are comparing strings
x_seg_is_num = false
x_seg_pos += 1 while (x_seg_pos <= x_pos_max) && isalpha(x[x_seg_pos])
x_comp = x[x_pos, x_seg_pos - x_pos]
y_seg_pos += 1 while (y_seg_pos <= y_pos_max) && isalpha(y[y_seg_pos])
y_comp = y[y_pos, y_seg_pos - y_pos]
end
# if y_seg_pos didn't advance in the above loop it means the segments are
# different types
if y_pos == y_seg_pos
# numbers always win over letters
return x_seg_is_num ? 1 : -1
end
# move the ball forward before we mess with the segments
x_pos += x_comp.length # +1 over pos_max if end of string
y_pos += y_comp.length
# we are comparing numbers - simply convert them
if x_seg_is_num
x_comp = x_comp.to_i
y_comp = y_comp.to_i
end
# compares ints or strings
# don't return if equal - try the next segment
if x_comp > y_comp
return 1
elsif x_comp < y_comp
return -1
end
# if we've reached here than the segments are the same - try again
end
# we must have reached the end of one or both of the strings and they
# matched up until this point
# segments matched completely but the segment separators were different -
# rpm reference code treats these as equal.
if (x_pos == x_pos_max + 1) && (y_pos == y_pos_max + 1)
return 0
end
# the most unprocessed characters left wins
if (x_pos_max - x_pos) > (y_pos_max - y_pos)
1
else
-1
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rpm_version(name)\n if (self.centos? && !self.centos7?) || self.fedora? || self.redhat8? || self.oracle8? || self.redhat9?\n # returns epoch.version\n v = Chef::Provider::Package::Dnf::PythonHelper.instance.\n package_query(:whatinstalled, name).version\n unless v.nil?\n v.split(':')[1]\n end\n elsif self.centos7? &&\n (FB::Version.new(Chef::VERSION) > FB::Version.new('14'))\n # returns epoch.version.arch\n v = Chef::Provider::Package::Yum::PythonHelper.instance.\n package_query(:whatinstalled, name).version\n unless v.nil?\n v.split(':')[1]\n end\n else\n # return version\n Chef::Provider::Package::Yum::YumCache.instance.\n installed_version(name)\n end\n end",
"def ruby_version?(cmp, v)\n rv = Gem::Version.create(RUBY_VERSION.dup)\n v = Gem::Version.create(v)\n if cmp.to_sym==:'~>'\n rv = rv.release\n rv >= v && rv < v.bump\n else\n rv.send(cmp, v)\n end\n end",
"def get_rpm_status(proj_info)\n if proj_info.type == :module\n # FIXME This ASSUMES the release qualifier is 0 instead of using\n # simp-core/build/rpm/dependencies.yaml.\n rpm = \"#{proj_info.rpm_name}-#{proj_info.version}-0.#{proj_info.arch}.rpm\"\n url_el6 = PCLOUD_URL_BASE + \"6/\" + rpm\n url_el7 = PCLOUD_URL_BASE + \"7/\" + rpm\n else\n # FIXME If the RPM release qualifier has a %dist macro in it, there\n # is no way to accurately extract it from the spec file. The logic\n # below is a hack!\n rpm = \"#{proj_info.rpm_name}-#{proj_info.version}-#{proj_info.release}.#{proj_info.arch}.rpm\"\n url_el6 = PCLOUD_URL_BASE + \"6/\" + rpm\n url_el6.gsub!('el7','el6')\n url_el7 = PCLOUD_URL_BASE + \"7/\" + rpm\n url_el7.gsub!('el6','el7')\n end\n\n # query PackageCloud to see if a release to both el6 and el7 repos has been made\n # Note that each URL is for a page with a download button, not the RPM itself.\n debug(\"Checking existence of #{url_el6}: #{url_exists?(url_el6) ? 'exists' : 'does not exist'}\")\n debug(\"Checking existence of #{url_el7}: #{url_exists?(url_el7) ? 'exists' : 'does not exist'}\")\n rpms_found = url_exists?(url_el6) && url_exists?(url_el7)\n rpms_found = url_exists?(url_el6) && url_exists?(url_el7)\n rpms_released = rpms_found ? :released : :unreleased\n rpms_released\n end",
"def get_rpm_status(proj_info)\n if proj_info.type == :module\n # FIXME This ASSUMES the release qualifier is 0 instead of using\n # simp-core/build/rpm/dependencies.yaml.\n rpm = \"#{proj_info.rpm_name}-#{proj_info.version}-0.#{proj_info.arch}.rpm\"\n url_el6 = PCLOUD_URL_BASE + \"6/\" + rpm\n url_el7 = PCLOUD_URL_BASE + \"7/\" + rpm\n else\n # FIXME If the RPM release qualifier has a %dist macro in it, there\n # is no way to accurately extract it from the spec file. The logic\n # below is a hack!\n rpm = \"#{proj_info.rpm_name}-#{proj_info.version}-#{proj_info.release}.#{proj_info.arch}.rpm\"\n url_el6 = PCLOUD_URL_BASE + \"6/\" + rpm\n url_el6.gsub!('el7','el6')\n url_el7 = PCLOUD_URL_BASE + \"7/\" + rpm\n url_el7.gsub!('el6','el7')\n end\n\n # query PackageCloud to see if a release to both el6 and el7 repos has been made\n # Note that each URL is for a page with a download button, not the RPM itself.\n debug(\"Checking existence of #{url_el6}: #{url_exists?(url_el6) ? 'exists' : 'does not exist'}\")\n debug(\"Checking existence of #{url_el7}: #{url_exists?(url_el7) ? 'exists' : 'does not exist'}\")\n rpms_found = url_exists?(url_el6) && url_exists?(url_el7)\n rpms_found = url_exists?(url_el6) && url_exists?(url_el7)\n rpms_released = rpms_found ? :released : :unreleased\n rpms_released\n end",
"def compare_versions(local_version,depot_version,mode)\n if local_version.match(/-/)\n local_version = local_version.split(/-/)[1]\n end\n if depot_version.match(/-/)\n depot_version = depot_version.split(/-/)[1]\n end\n puts \"Current: \"+local_version\n puts \"Available: \"+depot_version\n if mode =~ /up|check/\n avail_fw = compare_ver(local_version,depot_version)\n if avail_fw.to_s != local_version.to_s\n puts \"Depot patch level is newer than installed version\"\n update_available = \"y\"\n else\n update_available = \"n\"\n puts \"Local patch level is up to date\"\n end\n else\n if depot_version.to_i < local_version.to_i\n puts \"Depot patch level is lower than installed version\"\n update_available = \"y\"\n else\n update_available = \"n\"\n puts \"Local patch level is up to date\"\n end\n end\n if mode == \"check\"\n exit\n end\n return update_available\nend",
"def rpm_family_and_version\n if Pkg::Config.vanagon_project\n Pkg::Config.rpm_targets.split(' ').map do |target|\n rpm_el_family, rpm_el_version, = target.split('-')\n \"#{rpm_el_family}-#{rpm_el_version}\"\n end\n else\n Pkg::Config.final_mocks.split.map { |mock| \"#{mock_el_family(mock)}-#{mock_el_ver(mock)}\" }\n end\nend",
"def compare_build_vers(loc_ver,rem_ver)\n if loc_ver.to_s.match(/No/)\n result = 0\n else\n if rem_ver.to_s.match(/-/) and !rem_ver.to_s.match(/beta/)\n if $verbose == 1\n puts \"Local build date: \"+loc_ver.to_s\n puts \"Remote build date: \"+rem_ver.to_s\n end\n if rem_ver.to_time > loc_ver.to_time\n result = 0\n else\n result = 1\n end\n else\n if $verbose == 1\n puts \"Local build version: \"+loc_ver\n puts \"Remote build version: \"+rem_ver\n end\n if loc_ver !~ /No/\n loc_ver = Versionomy.parse(loc_ver)\n rem_ver = Versionomy.parse(rem_ver)\n if rem_ver > loc_ver\n result = 0\n else\n result = 1\n end\n else\n result = 2\n end\n end\n end\n if result == 0\n puts \"Remote version of build is newer than local\"\n else\n if result == 1\n puts \"Local version of build is up to date\"\n else\n puts \"Local version could not be accurately determined\"\n end\n end\n return result\nend",
"def mock_to_dist_version_arch(mock)\n # We care about matching against two patterns here:\n # pupent-3.4-el5-i386 <= old style with PE_VER baked into the mock name\n # pupent-el5-i386 <= new style derived from a template\n mock.match(/pupent(-\\d\\.\\d)?-([a-z]*)(\\d*)-([^-]*)/)[2..4]\n end",
"def component_versions(cmp)\n component_build_vars(cmp)['PACKAGE_VERSIONS']\nend",
"def pkg_version_less(a, b)\n a < b\n end",
"def version_number\n self.name =~ /RHEL-([0-9]+)/\n return $1.to_i\n end",
"def prerelease_specs; end",
"def _versioncmp(a, b)\n a, b = a.to_s.split('.'), b.to_s.split('.')\n [a.length, b.length].max.times do |i|\n return -1 if a[i].to_i < b[i].to_i\n return 1 if a[i].to_i > b[i].to_i\n end\n return 0\nend",
"def restrictive_version_specified_gem?(node); end",
"def test_numeric_comparison\n value1_ = ::Versionomy.create([1, 9, 2], :rubygems)\n value2_ = ::Versionomy.create([1, 9], :rubygems)\n assert(value2_ < value1_)\n value1_ = ::Versionomy.create([1, 9, 0], :rubygems)\n value2_ = ::Versionomy.create([1, 9], :rubygems)\n assert(value2_ == value1_)\n end",
"def rpm_version\n @lead.rpm_version\n end",
"def ver_cmp(version1,version2)\n v_int_lista=version1.split(\".\").map { |x| x.to_i() }\n v_int_listb=version2.split(\".\").map { |x| x.to_i() }\n lena=v_int_lista.length()\n lenb=v_int_listb.length()\n minab=lena<lenb ? lena:lenb\n ii=0\n while(ii<minab)\n if v_int_lista[ii]!=v_int_listb[ii]\n break\n end\n ii=ii+1\n end\n if ii<minab\n then\n return v_int_lista[ii]-v_int_listb[ii]\n elsif ii==minab\n then\n if lena>minab\n then\n return 1\n elsif (lenb > minab)\n then\n return -1\n else\n return v_int_lista[minab-1]-v_int_listb[minab-1]\n end\n end\n return 9999\nend",
"def mock_el_ver(mock_config)\n if Pkg::Config.build_pe\n # This uses a regex capture instead of splitting to allow the now defunct PE version component to be optional\n version = mock_config.match(/^pupent-(\\d\\.\\d-)?([a-z]+)([0-9]+)-(.*)$/)[3]\n else\n first, second, third = mock_config.split('-')\n if ['el', 'fedora'].include?(first) || (first == 'pl' && second.match(/^\\d+$/))\n version = second\n else\n version = third\n end\n end\n if [first, second].include?('fedora')\n version = \"f#{version}\"\n end\n version\nend",
"def version_specified_gem?(node); end",
"def test_rubygems_to_standard_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.3', :rubygems), :<, ::Versionomy.parse('1.2.4'))\n assert_operator(::Versionomy.parse('1.2.b.3', :rubygems), :>, ::Versionomy.parse('1.2b2'))\n assert_operator(::Versionomy.parse('1.2', :rubygems), :>, ::Versionomy.parse('1.2b1'))\n end",
"def check_update(component_def, spec, gem_name_to_version)\n component_def.each_line do |line|\n # TODO: Some of the component files handle multiple versions with a case statement (for example net-ssh). \n # Add more logic to compare each of those versions. For now there are only a hand full. \n if line =~ /pkg.version/\n ver = Gem::Version.new(line.scan(/\\d\\.*/).join(''))\n if gem_name_to_version[spec.name] > ver\n warn \"Update needed for: #{spec.name} \\nUpgrade from #{ver} to #{gem_name_to_version[spec.name]}\\n\\n\"\n end\n end\n end\nend",
"def win_64bit?\n x86_64? && (latest_version? || new_resource.version.split('.').first.to_i >= 42)\nend",
"def test_method_prereleasep\n value_ = ::Versionomy.create([1, 9, 2, 'a', 2], :rubygems)\n assert_equal(true, value_.prerelease?)\n value_ = ::Versionomy.create([1, 9, 2, 2], :rubygems)\n assert_equal(false, value_.prerelease?)\n end",
"def test_standard_to_rubygems_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.4'), :>, ::Versionomy.parse('1.2.3', :rubygems))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.beta.3', :rubygems))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2', :rubygems))\n end",
"def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\nend",
"def rpm_installed?(name)\n system_command(\"rpm\", args: [\"-q\", \"--qf\", \"%{NAME}-%{VERSION}\", name]).success?\nend",
"def rpm_no_arch\n @rpm_no_arch\n end",
"def win_bin?\n new_resource.version.split('.')[0].to_i > 1\nend",
"def version_mismatch_detected\n end",
"def test_numeric_comparison\n value1_ = ::Versionomy.create([1, 9, 2], :semver)\n value2_ = ::Versionomy.create([1, 9], :semver)\n assert(value2_ < value1_)\n value1_ = ::Versionomy.create([1, 9, 0], :semver)\n value2_ = ::Versionomy.create([1, 9], :semver)\n assert(value2_ == value1_)\n end",
"def test_string_comparison\n value1_ = ::Versionomy.create([1, 9, 2, 'a', 2], :rubygems)\n value2_ = ::Versionomy.create([1, 9, 2, 'b', 1], :rubygems)\n assert(value2_ > value1_)\n end",
"def installed_versions; end",
"def compare_versions(y, partial = false)\n x = self\n\n # compare epoch\n if (x.e.nil? == false && x.e > 0) && y.e.nil?\n return 1\n elsif x.e.nil? && (y.e.nil? == false && y.e > 0)\n return -1\n elsif x.e.nil? == false && y.e.nil? == false\n if x.e < y.e\n return -1\n elsif x.e > y.e\n return 1\n end\n end\n\n # compare version\n if partial && (x.v.nil? || y.v.nil?)\n return 0\n elsif x.v.nil? == false && y.v.nil?\n return 1\n elsif x.v.nil? && y.v.nil? == false\n return -1\n elsif x.v.nil? == false && y.v.nil? == false\n cmp = RPMUtils.rpmvercmp(x.v, y.v)\n return cmp if cmp != 0\n end\n\n # compare release\n if partial && (x.r.nil? || y.r.nil?)\n return 0\n elsif x.r.nil? == false && y.r.nil?\n return 1\n elsif x.r.nil? && y.r.nil? == false\n return -1\n elsif x.r.nil? == false && y.r.nil? == false\n cmp = RPMUtils.rpmvercmp(x.r, y.r)\n return cmp\n end\n\n 0\n end",
"def version_compare(v1, v2)\n gem_v1 = Gem::Version.new(v1.gsub(/\\A\\s*(#{Gem::Version::VERSION_PATTERN}).*/, '\\1'))\n gem_v2 = Gem::Version.new(v2.gsub(/\\A\\s*(#{Gem::Version::VERSION_PATTERN}).*/, '\\1'))\n\n gem_v1 <=> gem_v2\n end",
"def component_version(cmp)\n component_cmake_vars(cmp)['PACKAGE_VERSION']\nend",
"def test_method_prereleasep\n value_ = ::Versionomy.create([1, 9, 2, 'a2'], :semver)\n assert_equal(true, value_.prerelease?)\n value_ = ::Versionomy.create([1, 9, 2], :semver)\n assert_equal(false, value_.prerelease?)\n end",
"def test_rubygems_to_standard_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0', :rubygems), :==, ::Versionomy.parse('1.2'))\n assert_operator(::Versionomy.parse('1.2.b.3', :rubygems), :==, ::Versionomy.parse('1.2b3'))\n end",
"def test_standard_to_rubygems_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0'), :==, ::Versionomy.parse('1.2', :rubygems))\n assert_operator(::Versionomy.parse('1.2b3'), :==, ::Versionomy.parse('1.2.beta.3', :rubygems))\n end",
"def test_numeric_and_string_comparison\n value1_ = ::Versionomy.create([1, 9, 2, 'a', 2], :rubygems)\n value2_ = ::Versionomy.create([1, 9, 2, 1], :rubygems)\n assert(value2_ > value1_)\n end",
"def stable_gem_versions(http_response)\n http_response.blank? ? [] : http_response.select { |val| val['prerelease'] == false }\n end",
"def initial_rpm\n 700\n end",
"def find_centos_minor_version\n os_minor_version = ''\n kernel_patch_version = find_kernel_patch_version\n\n os_minor_version = '7' if kernel_patch_version >= '1062'\n os_minor_version = '8' if kernel_patch_version >= '1127'\n os_minor_version = '9' if kernel_patch_version >= '1160'\n\n os_minor_version\nend",
"def satisfied_by?(req_vers, new_vers)\n req = LibGems::Requirement.new(req_vers)\n req_vers.sub(/^= /,'') == new_vers.sub(/^= /,'') ||\n req.satisfied_by?(LibGems::Version.new(new_vers))\n end",
"def get_linux_version_info(iso_file_name)\n iso_info = File.basename(iso_file_name)\n if iso_file_name.match(/purity/)\n iso_info = iso_info.split(/_/)\n else\n iso_info = iso_info.split(/-/)\n end\n linux_distro = iso_info[0]\n linux_distro = linux_distro.downcase\n if linux_distro.match(/^sle$/)\n linux_distro = \"sles\"\n end\n if linux_distro.match(/oraclelinux/)\n linux_distro = \"oel\"\n end\n if linux_distro.match(/centos|ubuntu|sles|sl|oel|rhel/)\n if linux_distro.match(/sles/)\n if iso_info[2].match(/Server/)\n iso_version = iso_info[1]+\".0\"\n else\n iso_version = iso_info[1]+\".\"+iso_info[2]\n iso_version = iso_version.gsub(/SP/,\"\")\n end\n else\n if linux_distro.match(/sl$/)\n iso_version = iso_info[1].split(//).join(\".\")\n if iso_version.length == 1\n iso_version = iso_version+\".0\"\n end\n else\n if linux_distro.match(/oel|rhel/)\n if iso_file_name =~ /-rc-/\n iso_version = iso_info[1..3].join(\".\")\n iso_version = iso_version.gsub(/server/,\"\")\n else\n iso_version = iso_info[1..2].join(\".\")\n iso_version = iso_version.gsub(/[a-z,A-Z]/,\"\")\n end\n iso_version = iso_version.gsub(/^\\./,\"\")\n else\n iso_version = iso_info[1]\n end\n end\n end\n case iso_file_name\n when /i[3-6]86/\n iso_arch = \"i386\"\n when /x86_64/\n iso_arch = \"x86_64\"\n else\n if linux_distro.match(/centos|sl$/)\n iso_arch = iso_info[2]\n else\n if linux_distro.match(/sles|oel/)\n iso_arch = iso_info[4]\n else\n iso_arch = iso_info[3]\n iso_arch = iso_arch.split(/\\./)[0]\n if iso_arch.match(/amd64/)\n iso_arch = \"x86_64\"\n else\n iso_arch = \"i386\"\n end\n end\n end\n end\n else\n if linux_distro.match(/fedora/)\n iso_version = iso_info[1]\n iso_arch = iso_info[2]\n else\n if linux_distro.match(/purity/)\n iso_version = iso_info[1]\n iso_arch = \"x86_64\"\n else\n if linux_distro.match(/vmware/)\n iso_version = iso_info[3].split(/\\./)[0..-2].join(\".\")\n iso_update = iso_info[3].split(/\\./)[-1]\n iso_release = iso_info[4].split(/\\./)[-3]\n iso_version = iso_version+\".\"+iso_update+\".\"+iso_release\n iso_arch = \"x86_64\"\n else\n iso_version = iso_info[2]\n iso_arch = iso_info[3]\n end\n end\n end\n end\n return linux_distro,iso_version,iso_arch\nend",
"def platform_version_for_package\n if platform == 'rhel'\n platform_version[/([\\d]+)\\..+/, 1]\n else\n platform_version\n end\n end",
"def el_version\n if File.exists?('/etc/fedora-release')\n nil\n elsif File.exists?('/etc/redhat-release')\n rpm = Pkg::Util::Tool.find_tool('rpm', :required => true)\n stdout, _, _ = Pkg::Util::Execution.capture3(\"#{rpm} -q --qf \\\"%{VERSION}\\\" $(#{rpm} -q --whatprovides /etc/redhat-release )\")\n stdout\n end\n end",
"def binary_version; end",
"def version\na = unpack\nv = (a[2] & 0xF000).to_s(16)[0].chr.to_i\nreturn v if (1..5).include? v\nreturn nil\nend",
"def test_semver_and_rubygems\n value_ = ::Versionomy.create([1,2,3], :semver)\n value2_ = value_.convert(:rubygems)\n assert_equal([1, 2, 3, 0, 0, 0, 0, 0], value2_.values_array)\n value_ = ::Versionomy.create([1,2,3], :rubygems)\n value2_ = value_.convert(:semver)\n assert_equal([1, 2, 3, ''], value2_.values_array)\n end",
"def supported_pkgs\n {\"rpm\"=>1, \"deb\"=>1}\nend",
"def linux_version\n case ENV['MACHTYPE']\n when \"s390x-suse-linux\"\n :sles_zlnx\n when /^i[356]86/\n if File.exist? \"/etc/fedora-release\"\n :linux_ia32_cell\n else\n :linux_ia32\n end\n else\n if File.exist? \"/etc/rhel-release\"\n :rhel\n elsif File.exist? \"/etc/redhat-release\"\n `awk '/release 5/||/release 4.9/{v=5};/release 4/{v=4}; END {print \"rhel\" v}' /etc/redhad-release`.to_sym\n elsif File.exist? \"/etc/SuSE-release\"\n `awk '$1==\"VERSION\" { v=$3}; END { print \"sles\" v}' /etc/SuSE-release`.to_sym\n elsif File.exist? \"/etc/yellowdog-release\"\n :yhpc\n else\n :rhel\n end\n end\nend",
"def installed_version\n capture(\"#{chef_solo} -v || true\") =~ /Chef: (\\d+\\.\\d+\\.\\d+)/ ? $1 : nil\n end",
"def compare_version(a, b)\n\n\t\t#split into titl.maj.min.bug.ext\n\t\ta_segments = a.split('.')\n\t\tb_segments = b.split('.')\n\n\t\t#puts a_segments\n\t\t#puts b_segments\n\n\t\t#compare major 1.x.x\n\t\tcase\n\t\twhen a_segments[1].to_i < b_segments[1].to_i\n\t\t\t-1\n\t\twhen a_segments[1].to_i > b_segments[1].to_i\n\t\t\t1\n\t\telse\n\t\t\t#compare minor 1.1.x\n\t\t\tcase\n\t\t\twhen a_segments[2].to_i < b_segments[2].to_i\n\t\t\t-1\n\t\t\twhen a_segments[2].to_i > b_segments[2].to_i\n\t\t\t\t1\n\t\t\telse\n\t\t\t\t#compare point 1.1.1\n\t\t\t\tcase\n\t\t\t\twhen a_segments[3].to_i < b_segments[3].to_i\n\t\t\t\t\t-1\n\t\t\t\twhen a_segments[3].to_i > b_segments[3].to_i\n\t\t\t\t\t1\n\t\t\t\telse\n\t\t\t\t\t0\n\t\t\t\tend\n\t\t\tend\n\t\tend #END comparator\n\tend",
"def packages_providing(component)\n matches = []\n `yum provides #{component}`.each_line { |l|\n matches << $1 if l =~ /(.*)\\.fc.*/\n }\n matches\nend",
"def test_standard_to_rubygems_with_patchlevel\n value_ = ::Versionomy.parse('1.2-3')\n value2_ = value_.convert(:rubygems)\n assert_equal([1, 2, 3, 0, 0, 0, 0, 0], value2_.values_array)\n value_ = ::Versionomy.parse('1.2p3')\n value2_ = value_.convert(:rubygems)\n assert_equal([1, 2, 3, 0, 0, 0, 0, 0], value2_.values_array)\n value_ = ::Versionomy.parse('1.2c')\n value2_ = value_.convert(:rubygems)\n assert_equal([1, 2, 3, 0, 0, 0, 0, 0], value2_.values_array)\n end",
"def test_comparison_string\n value1_ = ::Versionomy.parse(\"1.8.7p72\")\n assert_operator(value1_, :<, \"1.8.7p73\")\n assert_operator(value1_, :<, \"1.8.8pre1\")\n assert_operator(value1_, :>, \"1.8.7p71\")\n assert_operator(value1_, :>, \"1.8.7rc2\")\n assert_operator(value1_, :>, \"1.8.7.0\")\n end",
"def test_comparison_minor\n value1_ = ::Versionomy.create(:major => 2, :tiny => 1, :tiny2 => 3, :release_type => :release_candidate, :release_candidate_version => 2)\n value2_ = ::Versionomy.create(:major => 2, :minor => 1, :release_type => :alpha)\n assert(value2_ > value1_)\n end",
"def has_version?; end",
"def yosemite_or_newer?\n Gem::Version.new(`sw_vers -productVersion`) >= Gem::Version.new('10.10')\nend",
"def is_rpm?\n return !!@name.match(/^(aix|cisco-wrlinux|el|eos|fedora|sles|redhat|redhatfips)-.*$/)\n end",
"def latest_specs(include_prerelease = T.unsafe(nil)); end",
"def make_rpm_spec\n puts 'creating rpm.spec'\n File.unlink('rpm.spec') if File.exist?('rpm.spec')\n f = File.open('rpm.spec', 'w')\n f.puts <<EOF\n# DO NOT EDIT -- automatically generated by ./configure\nName: #{@project.id}\nSummary: #{@project.summary}\nVersion: #{@project.version}\nRelease: 1\nLicense: #{@project.license}\nVendor: #{@project.author}\nGroup: System Environment/Libraries\nSource0: %{name}-%version.tar.gz\n\n%description\n#{@project.description}\n\n%prep\n#%setup -q -n #{@project.id}-#{@project.version}\n%setup\n\n%build\n./configure --prefix=/usr --disable-static\nmake\n\n%install\nmake DESTDIR=%{buildroot} install\n\n%clean\n[ %{buildroot} != \"/\" ] && rm -rf %{buildroot}\n\n%post -p /sbin/ldconfig\n%postun -p /sbin/ldconfig\n\n%files\n%defattr(-,root,root)\n\n#{ @project.installer.package_manifest }\n\n%changelog\n* Thu Jan 01 2011 Some Person <nobody@nobody.invalid> - #{@project.version}-1\n- automatically generated spec file\nEOF\n f.close()\n end",
"def test_semver_to_standard_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.3', :semver), :<, ::Versionomy.parse('1.2.4'))\n assert_operator(::Versionomy.parse('1.2.0b3', :semver), :>, ::Versionomy.parse('1.2b2'))\n assert_operator(::Versionomy.parse('1.2.0', :semver), :>, ::Versionomy.parse('1.2b1'))\n end",
"def rpm_arch\n @lead.arch\n end",
"def target_version=(_arg0); end",
"def compare_version(v1, v2)\r\n v1 = v1.split('.')\r\n v2 = v2.split('.')\r\n longest = v1.length > v2.length ? v1 : v2\r\n (0...(longest.length)).each do |idx|\r\n one = v1[idx] || '0'\r\n two = v2[idx] || '0'\r\n return -1 if two.to_i > one.to_i\r\n return 1 if one.to_i > two.to_i\r\n end\r\n 0\r\nend",
"def version_check_less_than(version_str_new, version_str_old)\n Gem::Version.new(version_str_old) < Gem::Version.new(version_str_new)\n end",
"def best_version(should_range)\n included_available_versions = []\n available_versions.each do |version|\n version = PIP_VERSION.parse(version)\n included_available_versions.push(version) if should_range.include?(version)\n end\n\n included_available_versions.sort!\n return included_available_versions.last unless included_available_versions.empty?\n\n Puppet.debug(\"No available version for package #{@resource[:name]} is included in range #{should_range}\")\n should_range\n end",
"def version_gt(v1, v2)\n # Construct an array to make sure the shorter version is padded with nil\n Array.new([v1.length, v2.length].max).zip(v1.split(\".\"), v2.split(\".\")) do |_, p1, p2|\n p1 ||= \"0\"\n p2 ||= \"0\"\n release1 = p1 =~ /^[0-9]+$/\n release2 = p2 =~ /^[0-9]+$/\n if release1 && release2\n # Integer comparison if both are full releases\n p1, p2 = p1.to_i, p2.to_i\n next if p1 == p2\n return p1 > p2\n elsif !release1 && !release2\n # String comparison if both are prereleases\n next if p1 == p2\n return p1 > p2\n else\n # If only one is a release, that one is newer\n return release1\n end\n end\n end",
"def minor_version; end",
"def nmap_version_at_least?(test_ver=nil)\n raise ArgumentError, \"Cannot compare a Float, use a String or Integer\" if test_ver.kind_of? Float\n unless test_ver.to_s[/^([0-9]+(\\x2e[0-9]+)?)/n]\n raise ArgumentError, \"Bad Nmap comparison version: #{test_ver.inspect}\"\n end\n test_ver_str = test_ver.to_s\n tnum_arr = $1.split(/\\x2e/n)[0,2].map {|x| x.to_i}\n installed_ver = get_nmap_ver()\n vtag = installed_ver.split[2] # Should be [\"Nmap\", \"version\", \"X.YZTAG\", \"(\", \"http..\", \")\"]\n return false if (vtag.nil? || vtag.empty?)\n return false unless (vtag =~ /^([0-9]+\\x2e[0-9]+)/n) # Drop the tag.\n inum_arr = $1.split(/\\x2e/n)[0,2].map {|x| x.to_i}\n return true if inum_arr[0] > tnum_arr[0]\n return false if inum_arr[0] < tnum_arr[0]\n inum_arr[1].to_i >= tnum_arr[1].to_i\nend",
"def test_that_bumping_with_prereleases\r\n v = Bumper::Version.new\r\n assert_equal '0.0.0.0', v.to_s\r\n assert_equal 1, v.bump_minor\r\n assert_equal '0.1.0.0', v.to_s\r\n assert_equal 'beta', v.bump_patch_tag('beta')\r\n assert_equal '0.1.1-beta.0', v.to_s\r\n assert_equal 'beta2', v.bump_patch_tag('beta')\r\n assert_equal '0.1.1-beta2.0', v.to_s\r\n assert_equal '1', v.bump_build\r\n assert_equal '0.1.1-beta2.1', v.to_s\r\n assert_equal 'rc', v.bump_patch_tag('rc') # replaces tag\r\n assert_equal '0.1.1-rc.0', v.to_s\r\n assert_equal 'rc2', v.bump_patch_tag('rc')\r\n assert_equal '0.1.1-rc2.0', v.to_s\r\n assert_equal 1, v.bump_patch # drops tag\r\n assert_equal '0.1.1.0', v.to_s\r\n assert_equal 2, v.bump_patch\r\n assert_equal '0.1.2.0', v.to_s\r\n assert_equal 2, v.bump_minor\r\n assert_equal '0.2.0.0', v.to_s\r\n assert_equal 'alpha', v.bump_patch_tag('alpha')\r\n assert_equal '0.2.1-alpha.0', v.to_s\r\n assert_equal 3, v.bump_minor\r\n assert_equal '0.3.0.0', v.to_s\r\n v.build = 'rc1'\r\n assert_equal '0.3.0.rc1', v.to_s\r\n assert_equal 'rc2', v.bump_build\r\n assert_equal '0.3.0.rc2', v.to_s\r\n end",
"def oracle_server_vernum()\n #This is a stub, used for indexing\n end",
"def pre_0_12?\n VersionRequirement.new('< 0.12.0-alpha').satisfied_by?(version)\n end",
"def patch_version; end",
"def test_standard_to_semver_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.4'), :>, ::Versionomy.parse('1.2.3', :semver))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.0beta3', :semver))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.0', :semver))\n end",
"def is_yum_platform\n node[:platform_family] == \"rhel\"\nend",
"def jamm_version(version)\n case version.to_s.strip\n when /^0.[0-7]/\n '0.2.5'\n when /^0.8/\n '0.2.2'\n when /^1|^2.0/\n '0.2.5'\n when /^2.1.[0-1]$/\n '0.2.6'\n when /^2.1.[2-3]$/\n '0.2.8'\n when /^2.1/\n '0.3.1'\n when /^2.2/\n '0.3.1'\n when /^3.[0-9]/\n '0.3.1'\n end\nend",
"def version_constraint(gem_name); end",
"def validate_semver(changelog_hash)\n latest_release, latest_release_changelog = changelog_hash.first\n # extract prefix from first release to use on all subsequent releases\n latest_release_prefix = latest_release.partition(RELEASE_REGEX)[0]\n\n newer_version = nil\n changelog_hash.each do |key,value|\n\n prefix, version, suffix = key.partition(RELEASE_REGEX)\n puts \"Checking version with prefix:'#{prefix}', version:'#{version}', suffix:'#{suffix}'.\" if @releasinator_config[:verbose]\n if prefix != latest_release_prefix\n Printer.fail(\"version #{key} does not start with extracted prefix '#{latest_release_prefix}'.\")\n abort()\n end\n older_version = Semantic::Version.new version\n\n if nil != newer_version\n version_comp = newer_version <=> older_version\n if version_comp < 0\n Printer.fail(\"Semver releases out of order: #{older_version} should be smaller than #{newer_version}\")\n abort()\n elsif version_comp == 0\n # this case cannot be found with Vandamme library because 2 versions in a row get overwritten in the underlying hash\n if suffix.empty?\n Printer.fail(\"2 semver releases in a row without a suffix (like -beta, -rc1, etc...) is not allowed.\")\n abort()\n end\n else\n error_suffix = \"version increment error - comparing #{newer_version} to #{older_version} does not pass semver validation.\"\n # validate the next sequence in semver\n if newer_version.major == older_version.major\n if newer_version.minor == older_version.minor\n check_semver_criteria(newer_version.patch == older_version.patch + 1, \"patch #{error_suffix}\")\n else\n check_semver_criteria(newer_version.minor == older_version.minor + 1 && newer_version.patch == 0, \"minor #{error_suffix}\")\n end\n else\n check_semver_criteria(newer_version.major == older_version.major + 1 && newer_version.minor == 0 && newer_version.patch == 0, \"major #{error_suffix}\")\n end\n end\n end\n newer_version = older_version\n end\n end",
"def released_specs; end",
"def test_string_comparison\n value1_ = ::Versionomy.create([1, 9, 2, 'a2'], :semver)\n value2_ = ::Versionomy.create([1, 9, 2, 'b1'], :semver)\n assert(value2_ > value1_)\n end",
"def test_that_it_should_bump_versions\r\n v = Bumper::Version.new\r\n assert_equal '1', v.bump_build\r\n assert_equal '0.0.0.1', v.to_s\r\n assert_equal 1, v.bump_patch\r\n assert_equal '0.0.1.0', v.to_s\r\n assert_equal 1, v.bump_minor\r\n assert_equal '0.1.0.0', v.to_s\r\n assert_equal 1, v.bump_major\r\n assert_equal '1.0.0.0', v.to_s\r\n end",
"def yum_releasever\n platform?('amazon') ? '7' : '$releasever'\n end",
"def test_semver_to_standard_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0', :semver), :==, ::Versionomy.parse('1.2'))\n assert_operator(::Versionomy.parse('1.2.0b3', :semver), :==, ::Versionomy.parse('1.2b3'))\n end",
"def test_prerelease?(version)\n !@version.stable? && @version.major == version.major && @version.minor == version.minor && @version.patch == version.patch\n end",
"def major_version; end",
"def requirement\n \"~> #{major}\"\n end",
"def patchlevel_upgrade?(to)\n nil unless installed?\n major_version(installed_version?) == major_version(to) && minor_version(installed_version?) == minor_version(to)\n end",
"def compare(rhs)\n\n\t\t\t\tif (@major > rhs.major) \n\t\t\t\t\treturn VERSION_LOWER\n\t\t\t\telsif (@major < rhs.major)\n\t\t\t\t\treturn VERSION_GREATER\n\t\t\t\telsif (@minor > rhs.minor) \n\t\t\t\t\treturn VERSION_LOWER\n\t\t\t\telsif (@minor < rhs.minor) \n\t\t\t\t\treturn VERSION_GREATER\n\t\t\t\telsif (@build > rhs.build) \n\t\t\t\t\treturn VERSION_LOWER\n\t\t\t\telsif (@build < rhs.build) \n\t\t\t\t\treturn VERSION_GREATER\n\t\t\t\telse\n\t\t\t\t\treturn VERSION_SAME\n\t\t\t\tend\n\n\t\t\tend",
"def hdp_version\n case node['hadoop']['distribution_version']\n when '2.2.0.0'\n '2.2.0.0-2041'\n when '2.2.1.0'\n '2.2.1.0-2340'\n when '2.2.4.2'\n '2.2.4.2-2'\n when '2.2.4.4'\n '2.2.4.4-16'\n when '2.2.6.0'\n '2.2.6.0-2800'\n when '2.2.6.3'\n '2.2.6.3-1'\n when '2.2.8.0'\n '2.2.8.0-3150'\n when '2.2.9.0'\n '2.2.9.0-3393'\n when '2.3.0.0'\n '2.3.0.0-2557'\n when '2.3.2.0'\n '2.3.2.0-2950'\n when '2.3.4.0'\n '2.3.4.0-3485'\n when '2.3.4.7'\n '2.3.4.7-4'\n when '2.3.6.0'\n '2.3.6.0-3796'\n when '2.4.0.0'\n '2.4.0.0-169'\n when '2.4.2.0'\n '2.4.2.0-258'\n when '2.4.3.0'\n '2.4.3.0-227'\n when '2.5.0.0'\n '2.5.0.0-1245'\n when '2.5.3.0'\n '2.5.3.0-37'\n when '2.5.5.0'\n '2.5.5.0-157'\n when '2.5.6.0'\n '2.5.6.0-40'\n when '2.6.0.3'\n '2.6.0.3-8'\n when '2.6.1.0'\n '2.6.1.0-129'\n when '2.6.2.0'\n '2.6.2.0-205'\n when '2.6.3.0'\n '2.6.3.0-235'\n when '2.6.4.0'\n '2.6.4.0-91'\n else\n # fetch build number from HDP public repository\n build_number = hdp_build_number(node['hadoop']['distribution_version'])\n [node['hadoop']['distribution_version'], build_number].compact.join('-')\n end\n end",
"def gem_version_more?(name, version)\n Gem.loaded_specs[name].version >= Gem::Version.new(version)\n end",
"def test_numeric_and_string_comparison\n value1_ = ::Versionomy.create([1, 9, 2, 'a2'], :semver)\n value2_ = ::Versionomy.create([1, 9, 2], :semver)\n assert(value2_ > value1_)\n end",
"def version_needed_to_extract\n 0x0014\n end",
"def version_needed_to_extract\n 0x0014\n end",
"def test_comparison_release_type\n value1_ = ::Versionomy.create(:major => 2, :release_type => :alpha, :alpha_version => 5)\n value2_ = ::Versionomy.create(:major => 2, :release_type => :release_candidate, :release_candidate_version => 2)\n assert(value2_ > value1_)\n end",
"def test_method_parts\n value_ = ::Versionomy.create([1, 9, 2, 'a', 2], :rubygems)\n assert_equal([1, 9, 2, 'a', 2], value_.parts)\n value_ = ::Versionomy.create([1, 9, 0], :rubygems)\n assert_equal([1, 9], value_.parts)\n end",
"def update_necessary?\n load_mixlib_versioning\n cur_version = Mixlib::Versioning.parse(current_version)\n # we have to \"resolve\" partial versions like \"12\" through mixlib-install before comparing them here\n des_version =\n if new_resource.download_url_override\n # probably in an air-gapped environment.\n Mixlib::Versioning.parse(desired_version)\n else\n Mixlib::Versioning.parse(Array(mixlib_install.artifact_info).first.version)\n end\n Chef::Log.debug(\"The current chef-client version is #{cur_version} and the desired version is #{desired_version}\")\n new_resource.prevent_downgrade ? (des_version > cur_version) : (des_version != cur_version)\nend",
"def latest\n source = @resource[:source]\n unless source\n @resource.fail _(\"RPMs must specify a package source\")\n end\n\n cmd = [command(:rpm), \"-q\", \"--qf\", \"#{self.class::NEVRA_FORMAT}\", \"-p\", source]\n h = self.class.nevra_to_multiversion_hash(execute(cmd))\n h[:ensure]\n rescue Puppet::ExecutionFailure => e\n raise Puppet::Error, e.message, e.backtrace\n end",
"def test\n commit_v = check_commit_version\n serv_v = check_server_version\n updated = Gem::Version.new(serv_v) < Gem::Version.new(commit_v)\n\n puts \"Running cookbook version rev'd test:\"\n puts \"Server version: #{serv_v}\".indent\n puts \"Commit version: #{commit_v}\".indent\n puts updated ? \"PASS: Metadata version has been rev'd\".indent : \"FAIL: Metadata version has NOT been rev'd\".indent.to_red\n updated\n end"
] |
[
"0.63795966",
"0.62147635",
"0.61626464",
"0.61626464",
"0.61104226",
"0.6106799",
"0.6083635",
"0.6077758",
"0.6024959",
"0.60186243",
"0.60100156",
"0.60028785",
"0.59957945",
"0.59578854",
"0.59387094",
"0.5937774",
"0.5911235",
"0.5895849",
"0.5877471",
"0.5854041",
"0.58528495",
"0.5841398",
"0.5825106",
"0.5808567",
"0.57968944",
"0.5791227",
"0.57881224",
"0.57860714",
"0.5782544",
"0.5755452",
"0.57450736",
"0.5744774",
"0.5717589",
"0.570996",
"0.57077473",
"0.5701044",
"0.5699444",
"0.5691882",
"0.5688548",
"0.5678501",
"0.56679595",
"0.56572926",
"0.5647089",
"0.562909",
"0.56282085",
"0.5619922",
"0.5614914",
"0.56036085",
"0.5600971",
"0.5596354",
"0.55940694",
"0.5592417",
"0.55878615",
"0.5557426",
"0.5557302",
"0.55557823",
"0.5545873",
"0.5545745",
"0.5545385",
"0.55221474",
"0.5518649",
"0.5517508",
"0.551459",
"0.5510818",
"0.54972917",
"0.5497149",
"0.5496709",
"0.54938126",
"0.5488046",
"0.5475396",
"0.5449855",
"0.5446236",
"0.5444664",
"0.5443779",
"0.5443073",
"0.5441849",
"0.54323864",
"0.5429246",
"0.542066",
"0.54166853",
"0.5409971",
"0.54066056",
"0.54049873",
"0.539321",
"0.5390591",
"0.5385889",
"0.5382686",
"0.53793466",
"0.53766423",
"0.53765684",
"0.5374349",
"0.53557765",
"0.53510207",
"0.5350033",
"0.5350033",
"0.5347775",
"0.53464615",
"0.5338988",
"0.53368163",
"0.53348935"
] |
0.63841134
|
0
|
Rough RPM::Version rpm_version_cmp equivalent except much slower :) partial lets epoch and version segment equality be good enough to return equal, eg: 2:1.21 == 2:1.2 2:1.21 == 2:
|
def compare_versions(y, partial = false)
x = self
# compare epoch
if (x.e.nil? == false && x.e > 0) && y.e.nil?
return 1
elsif x.e.nil? && (y.e.nil? == false && y.e > 0)
return -1
elsif x.e.nil? == false && y.e.nil? == false
if x.e < y.e
return -1
elsif x.e > y.e
return 1
end
end
# compare version
if partial && (x.v.nil? || y.v.nil?)
return 0
elsif x.v.nil? == false && y.v.nil?
return 1
elsif x.v.nil? && y.v.nil? == false
return -1
elsif x.v.nil? == false && y.v.nil? == false
cmp = RPMUtils.rpmvercmp(x.v, y.v)
return cmp if cmp != 0
end
# compare release
if partial && (x.r.nil? || y.r.nil?)
return 0
elsif x.r.nil? == false && y.r.nil?
return 1
elsif x.r.nil? && y.r.nil? == false
return -1
elsif x.r.nil? == false && y.r.nil? == false
cmp = RPMUtils.rpmvercmp(x.r, y.r)
return cmp
end
0
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rpmvercmp(x, y)\n # easy! :)\n return 0 if x == y\n\n if x.nil?\n x = \"\"\n end\n\n if y.nil?\n y = \"\"\n end\n\n # not so easy :(\n #\n # takes 2 strings like\n #\n # x = \"1.20.b18.el5\"\n # y = \"1.20.b17.el5\"\n #\n # breaks into purely alpha and numeric segments and compares them using\n # some rules\n #\n # * 10 > 1\n # * 1 > a\n # * z > a\n # * Z > A\n # * z > Z\n # * leading zeros are ignored\n # * separators (periods, commas) are ignored\n # * \"1.20.b18.el5.extrastuff\" > \"1.20.b18.el5\"\n\n x_pos = 0 # overall string element reference position\n x_pos_max = x.length - 1 # number of elements in string, starting from 0\n x_seg_pos = 0 # segment string element reference position\n x_comp = nil # segment to compare\n\n y_pos = 0\n y_seg_pos = 0\n y_pos_max = y.length - 1\n y_comp = nil\n\n while x_pos <= x_pos_max && y_pos <= y_pos_max\n # first we skip over anything non alphanumeric\n while (x_pos <= x_pos_max) && (isalnum(x[x_pos]) == false)\n x_pos += 1 # +1 over pos_max if end of string\n end\n y_pos += 1 while (y_pos <= y_pos_max) && (isalnum(y[y_pos]) == false)\n\n # if we hit the end of either we are done matching segments\n if (x_pos == x_pos_max + 1) || (y_pos == y_pos_max + 1)\n break\n end\n\n # we are now at the start of a alpha or numeric segment\n x_seg_pos = x_pos\n y_seg_pos = y_pos\n\n # grab segment so we can compare them\n if isdigit(x[x_seg_pos].ord)\n x_seg_is_num = true\n\n # already know it's a digit\n x_seg_pos += 1\n\n # gather up our digits\n x_seg_pos += 1 while (x_seg_pos <= x_pos_max) && isdigit(x[x_seg_pos])\n # copy the segment but not the unmatched character that x_seg_pos will\n # refer to\n x_comp = x[x_pos, x_seg_pos - x_pos]\n\n y_seg_pos += 1 while (y_seg_pos <= y_pos_max) && isdigit(y[y_seg_pos])\n y_comp = y[y_pos, y_seg_pos - y_pos]\n else\n # we are comparing strings\n x_seg_is_num = false\n\n x_seg_pos += 1 while (x_seg_pos <= x_pos_max) && isalpha(x[x_seg_pos])\n x_comp = x[x_pos, x_seg_pos - x_pos]\n\n y_seg_pos += 1 while (y_seg_pos <= y_pos_max) && isalpha(y[y_seg_pos])\n y_comp = y[y_pos, y_seg_pos - y_pos]\n end\n\n # if y_seg_pos didn't advance in the above loop it means the segments are\n # different types\n if y_pos == y_seg_pos\n # numbers always win over letters\n return x_seg_is_num ? 1 : -1\n end\n\n # move the ball forward before we mess with the segments\n x_pos += x_comp.length # +1 over pos_max if end of string\n y_pos += y_comp.length\n\n # we are comparing numbers - simply convert them\n if x_seg_is_num\n x_comp = x_comp.to_i\n y_comp = y_comp.to_i\n end\n\n # compares ints or strings\n # don't return if equal - try the next segment\n if x_comp > y_comp\n return 1\n elsif x_comp < y_comp\n return -1\n end\n\n # if we've reached here than the segments are the same - try again\n end\n\n # we must have reached the end of one or both of the strings and they\n # matched up until this point\n\n # segments matched completely but the segment separators were different -\n # rpm reference code treats these as equal.\n if (x_pos == x_pos_max + 1) && (y_pos == y_pos_max + 1)\n return 0\n end\n\n # the most unprocessed characters left wins\n if (x_pos_max - x_pos) > (y_pos_max - y_pos)\n 1\n else\n -1\n end\n end",
"def test_equality_parsed\n value1_ = ::Versionomy.parse(\"1.8.7p72\")\n value2_ = ::Versionomy.parse(\"1.8.7.0-72.0\")\n assert_equal(value2_, value1_)\n assert_equal(value2_.hash, value1_.hash)\n end",
"def test_numeric_comparison\n value1_ = ::Versionomy.create([1, 9, 2], :semver)\n value2_ = ::Versionomy.create([1, 9], :semver)\n assert(value2_ < value1_)\n value1_ = ::Versionomy.create([1, 9, 0], :semver)\n value2_ = ::Versionomy.create([1, 9], :semver)\n assert(value2_ == value1_)\n end",
"def test_numeric_comparison\n value1_ = ::Versionomy.create([1, 9, 2], :rubygems)\n value2_ = ::Versionomy.create([1, 9], :rubygems)\n assert(value2_ < value1_)\n value1_ = ::Versionomy.create([1, 9, 0], :rubygems)\n value2_ = ::Versionomy.create([1, 9], :rubygems)\n assert(value2_ == value1_)\n end",
"def _versioncmp(a, b)\n a, b = a.to_s.split('.'), b.to_s.split('.')\n [a.length, b.length].max.times do |i|\n return -1 if a[i].to_i < b[i].to_i\n return 1 if a[i].to_i > b[i].to_i\n end\n return 0\nend",
"def v1_older_v2(v1=\"0.0.0_0\", v2=\"0.0.0_0\")\n v1_n = version_split(v1)\n v2_n = version_split(v2)\n i = 0\n while ( v1_n[i] && v2_n[i] ) do\n if v1_n[i] < v2_n[i]\n return true\n elsif v1_n[i] > v2_n[i]\n return false\n end\n i+=1\n end\n # versions equal case\n return false\n end",
"def ver_cmp(version1,version2)\n v_int_lista=version1.split(\".\").map { |x| x.to_i() }\n v_int_listb=version2.split(\".\").map { |x| x.to_i() }\n lena=v_int_lista.length()\n lenb=v_int_listb.length()\n minab=lena<lenb ? lena:lenb\n ii=0\n while(ii<minab)\n if v_int_lista[ii]!=v_int_listb[ii]\n break\n end\n ii=ii+1\n end\n if ii<minab\n then\n return v_int_lista[ii]-v_int_listb[ii]\n elsif ii==minab\n then\n if lena>minab\n then\n return 1\n elsif (lenb > minab)\n then\n return -1\n else\n return v_int_lista[minab-1]-v_int_listb[minab-1]\n end\n end\n return 9999\nend",
"def compare_version(v1, v2)\r\n v1 = v1.split('.')\r\n v2 = v2.split('.')\r\n longest = v1.length > v2.length ? v1 : v2\r\n (0...(longest.length)).each do |idx|\r\n one = v1[idx] || '0'\r\n two = v2[idx] || '0'\r\n return -1 if two.to_i > one.to_i\r\n return 1 if one.to_i > two.to_i\r\n end\r\n 0\r\nend",
"def compare_build_vers(loc_ver,rem_ver)\n if loc_ver.to_s.match(/No/)\n result = 0\n else\n if rem_ver.to_s.match(/-/) and !rem_ver.to_s.match(/beta/)\n if $verbose == 1\n puts \"Local build date: \"+loc_ver.to_s\n puts \"Remote build date: \"+rem_ver.to_s\n end\n if rem_ver.to_time > loc_ver.to_time\n result = 0\n else\n result = 1\n end\n else\n if $verbose == 1\n puts \"Local build version: \"+loc_ver\n puts \"Remote build version: \"+rem_ver\n end\n if loc_ver !~ /No/\n loc_ver = Versionomy.parse(loc_ver)\n rem_ver = Versionomy.parse(rem_ver)\n if rem_ver > loc_ver\n result = 0\n else\n result = 1\n end\n else\n result = 2\n end\n end\n end\n if result == 0\n puts \"Remote version of build is newer than local\"\n else\n if result == 1\n puts \"Local version of build is up to date\"\n else\n puts \"Local version could not be accurately determined\"\n end\n end\n return result\nend",
"def test_comparison_string\n value1_ = ::Versionomy.parse(\"1.8.7p72\")\n assert_operator(value1_, :<, \"1.8.7p73\")\n assert_operator(value1_, :<, \"1.8.8pre1\")\n assert_operator(value1_, :>, \"1.8.7p71\")\n assert_operator(value1_, :>, \"1.8.7rc2\")\n assert_operator(value1_, :>, \"1.8.7.0\")\n end",
"def compare_version(remote_version)\n re = /(\\d+)\\./\n remote_version && re.match(remote_version)[1] != re.match(Replica.version)[1] \n end",
"def test_equality_string\n value1_ = ::Versionomy.parse(\"1.8.7p72\")\n assert_operator(value1_, :==, \"1.8.7p72\")\n assert_operator(value1_, :==, \"1.8.7.0-72.0\")\n end",
"def nmap_version_at_least?(test_ver=nil)\n raise ArgumentError, \"Cannot compare a Float, use a String or Integer\" if test_ver.kind_of? Float\n unless test_ver.to_s[/^([0-9]+(\\x2e[0-9]+)?)/n]\n raise ArgumentError, \"Bad Nmap comparison version: #{test_ver.inspect}\"\n end\n test_ver_str = test_ver.to_s\n tnum_arr = $1.split(/\\x2e/n)[0,2].map {|x| x.to_i}\n installed_ver = get_nmap_ver()\n vtag = installed_ver.split[2] # Should be [\"Nmap\", \"version\", \"X.YZTAG\", \"(\", \"http..\", \")\"]\n return false if (vtag.nil? || vtag.empty?)\n return false unless (vtag =~ /^([0-9]+\\x2e[0-9]+)/n) # Drop the tag.\n inum_arr = $1.split(/\\x2e/n)[0,2].map {|x| x.to_i}\n return true if inum_arr[0] > tnum_arr[0]\n return false if inum_arr[0] < tnum_arr[0]\n inum_arr[1].to_i >= tnum_arr[1].to_i\nend",
"def test_comparison_minor\n value1_ = ::Versionomy.create(:major => 2, :tiny => 1, :tiny2 => 3, :release_type => :release_candidate, :release_candidate_version => 2)\n value2_ = ::Versionomy.create(:major => 2, :minor => 1, :release_type => :alpha)\n assert(value2_ > value1_)\n end",
"def version_gt(v1, v2)\n # Construct an array to make sure the shorter version is padded with nil\n Array.new([v1.length, v2.length].max).zip(v1.split(\".\"), v2.split(\".\")) do |_, p1, p2|\n p1 ||= \"0\"\n p2 ||= \"0\"\n release1 = p1 =~ /^[0-9]+$/\n release2 = p2 =~ /^[0-9]+$/\n if release1 && release2\n # Integer comparison if both are full releases\n p1, p2 = p1.to_i, p2.to_i\n next if p1 == p2\n return p1 > p2\n elsif !release1 && !release2\n # String comparison if both are prereleases\n next if p1 == p2\n return p1 > p2\n else\n # If only one is a release, that one is newer\n return release1\n end\n end\n end",
"def version_compare(v1, v2)\n gem_v1 = Gem::Version.new(v1.gsub(/\\A\\s*(#{Gem::Version::VERSION_PATTERN}).*/, '\\1'))\n gem_v2 = Gem::Version.new(v2.gsub(/\\A\\s*(#{Gem::Version::VERSION_PATTERN}).*/, '\\1'))\n\n gem_v1 <=> gem_v2\n end",
"def test_rubygems_to_standard_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0', :rubygems), :==, ::Versionomy.parse('1.2'))\n assert_operator(::Versionomy.parse('1.2.b.3', :rubygems), :==, ::Versionomy.parse('1.2b3'))\n end",
"def compare_version(a, b)\n\n\t\t#split into titl.maj.min.bug.ext\n\t\ta_segments = a.split('.')\n\t\tb_segments = b.split('.')\n\n\t\t#puts a_segments\n\t\t#puts b_segments\n\n\t\t#compare major 1.x.x\n\t\tcase\n\t\twhen a_segments[1].to_i < b_segments[1].to_i\n\t\t\t-1\n\t\twhen a_segments[1].to_i > b_segments[1].to_i\n\t\t\t1\n\t\telse\n\t\t\t#compare minor 1.1.x\n\t\t\tcase\n\t\t\twhen a_segments[2].to_i < b_segments[2].to_i\n\t\t\t-1\n\t\t\twhen a_segments[2].to_i > b_segments[2].to_i\n\t\t\t\t1\n\t\t\telse\n\t\t\t\t#compare point 1.1.1\n\t\t\t\tcase\n\t\t\t\twhen a_segments[3].to_i < b_segments[3].to_i\n\t\t\t\t\t-1\n\t\t\t\twhen a_segments[3].to_i > b_segments[3].to_i\n\t\t\t\t\t1\n\t\t\t\telse\n\t\t\t\t\t0\n\t\t\t\tend\n\t\t\tend\n\t\tend #END comparator\n\tend",
"def test_numeric_and_string_comparison\n value1_ = ::Versionomy.create([1, 9, 2, 'a', 2], :rubygems)\n value2_ = ::Versionomy.create([1, 9, 2, 1], :rubygems)\n assert(value2_ > value1_)\n end",
"def test_numeric_and_string_comparison\n value1_ = ::Versionomy.create([1, 9, 2, 'a2'], :semver)\n value2_ = ::Versionomy.create([1, 9, 2], :semver)\n assert(value2_ > value1_)\n end",
"def test_semver_to_standard_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0', :semver), :==, ::Versionomy.parse('1.2'))\n assert_operator(::Versionomy.parse('1.2.0b3', :semver), :==, ::Versionomy.parse('1.2b3'))\n end",
"def VersionALtB(a_version, b_version)\n a_version_l = Builtins.filter(Builtins.splitstring(a_version, \"-.\")) do |s|\n Builtins.regexpmatch(s, \"^[0123456789]+$\")\n end\n b_version_l = Builtins.filter(Builtins.splitstring(b_version, \"-.\")) do |s|\n Builtins.regexpmatch(s, \"^[0123456789]+$\")\n end\n\n Builtins.y2milestone(\n \"Comparing versions %1 and %2\",\n a_version_l,\n b_version_l\n )\n a_size = Builtins.size(a_version_l)\n b_size = Builtins.size(b_version_l)\n longer_size = Ops.greater_than(a_size, b_size) ? a_size : b_size\n\n b_version_is_newer = false\n compare = 0 # <0 if a<b, =0 if a==b, >0 if a>b\n i = 0\n while Ops.less_than(i, longer_size)\n # -1 will make the desirable outcome of \"2\" < \"2.0\"\n a_item = Builtins.tointeger(Ops.get(a_version_l, i, \"-1\"))\n b_item = Builtins.tointeger(Ops.get(b_version_l, i, \"-1\"))\n if Ops.less_than(a_item, b_item)\n compare = -1\n break\n end\n if Ops.greater_than(a_item, b_item)\n compare = 1\n break\n end\n i = Ops.add(i, 1)\n end\n\n Builtins.y2milestone(\"%1 <=> %2 -> %3\", a_version, b_version, compare)\n Ops.less_than(compare, 0)\n end",
"def test_string_comparison\n value1_ = ::Versionomy.create([1, 9, 2, 'a', 2], :rubygems)\n value2_ = ::Versionomy.create([1, 9, 2, 'b', 1], :rubygems)\n assert(value2_ > value1_)\n end",
"def test_nonequality_parsed\n value1_ = ::Versionomy.parse(\"1.8.7b7\")\n value2_ = ::Versionomy.parse(\"1.8.7a7\")\n refute_equal(value2_, value1_)\n refute_equal(value2_.hash, value1_.hash)\n end",
"def older_version v1, v2\n v1 = v1.split('.').map{|s|s.to_i}.extend(Comparable)\n v2 = v2.split('.').map{|s|s.to_i}.extend(Comparable)\n return v1 < v2\n end",
"def test_standard_to_rubygems_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.4'), :>, ::Versionomy.parse('1.2.3', :rubygems))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.beta.3', :rubygems))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2', :rubygems))\n end",
"def test_standard_to_rubygems_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0'), :==, ::Versionomy.parse('1.2', :rubygems))\n assert_operator(::Versionomy.parse('1.2b3'), :==, ::Versionomy.parse('1.2.beta.3', :rubygems))\n end",
"def test_rubygems_to_standard_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.3', :rubygems), :<, ::Versionomy.parse('1.2.4'))\n assert_operator(::Versionomy.parse('1.2.b.3', :rubygems), :>, ::Versionomy.parse('1.2b2'))\n assert_operator(::Versionomy.parse('1.2', :rubygems), :>, ::Versionomy.parse('1.2b1'))\n end",
"def test_equality_simple\n value1_ = ::Versionomy.create(:major => 2, :minor => 0, :release_type => :alpha, :alpha_version => 5)\n value2_ = ::Versionomy.create(:major => 2, :release_type => :alpha, :alpha_version => 5)\n assert_equal(value2_, value1_)\n assert_equal(value2_.hash, value1_.hash)\n end",
"def compare_versions(first, second)\n raise ArgumentError, \"bad version format, version=#{first}\" unless first =~ Orientdb4r::Client::SERVER_VERSION_PATTERN\n raise ArgumentError, \"bad version format, version=#{second}\" unless second =~ Orientdb4r::Client::SERVER_VERSION_PATTERN\n\n firstv = /^(?:(\\d+)\\.)?(?:(\\d+)\\.)?(\\*|\\d+)/.match(first)[0]\n secondv = /^(?:(\\d+)\\.)?(?:(\\d+)\\.)?(\\*|\\d+)/.match(second)[0]\n\n rslt = 0\n rslt = 1 if firstv > secondv\n rslt = -1 if firstv < secondv\n\n yield rslt if block_given?\n\n rslt\n end",
"def compare(rhs)\n\n\t\t\t\tif (@major > rhs.major) \n\t\t\t\t\treturn VERSION_LOWER\n\t\t\t\telsif (@major < rhs.major)\n\t\t\t\t\treturn VERSION_GREATER\n\t\t\t\telsif (@minor > rhs.minor) \n\t\t\t\t\treturn VERSION_LOWER\n\t\t\t\telsif (@minor < rhs.minor) \n\t\t\t\t\treturn VERSION_GREATER\n\t\t\t\telsif (@build > rhs.build) \n\t\t\t\t\treturn VERSION_LOWER\n\t\t\t\telsif (@build < rhs.build) \n\t\t\t\t\treturn VERSION_GREATER\n\t\t\t\telse\n\t\t\t\t\treturn VERSION_SAME\n\t\t\t\tend\n\n\t\t\tend",
"def test_semver_to_standard_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.3', :semver), :<, ::Versionomy.parse('1.2.4'))\n assert_operator(::Versionomy.parse('1.2.0b3', :semver), :>, ::Versionomy.parse('1.2b2'))\n assert_operator(::Versionomy.parse('1.2.0', :semver), :>, ::Versionomy.parse('1.2b1'))\n end",
"def test_string_comparison\n value1_ = ::Versionomy.create([1, 9, 2, 'a2'], :semver)\n value2_ = ::Versionomy.create([1, 9, 2, 'b1'], :semver)\n assert(value2_ > value1_)\n end",
"def test_standard_to_semver_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0'), :==, ::Versionomy.parse('1.2.0', :semver))\n assert_operator(::Versionomy.parse('1.2b3'), :==, ::Versionomy.parse('1.2.0beta3', :semver))\n end",
"def test_standard_to_semver_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.4'), :>, ::Versionomy.parse('1.2.3', :semver))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.0beta3', :semver))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.0', :semver))\n end",
"def compare_versions(version_a, version_b)\n if version_a == version_b\n return 0\n else\n version_a_d = deconstruct_version_string(version_a)\n version_b_d = deconstruct_version_string(version_b)\n\n if version_a_d[0] > version_b_d[0] ||\n (version_a_d[0] == version_b_d[0] && version_a_d[1] > version_b_d[1]) ||\n (version_a_d[0] == version_b_d[0] && version_a_d[1] == version_b_d[1] && version_a_d[2] > version_b_d[2])\n return 1\n else\n return -1\n end\n end\n end",
"def ruby_version?(cmp, v)\n rv = Gem::Version.create(RUBY_VERSION.dup)\n v = Gem::Version.create(v)\n if cmp.to_sym==:'~>'\n rv = rv.release\n rv >= v && rv < v.bump\n else\n rv.send(cmp, v)\n end\n end",
"def compare_versions(local_version,depot_version,mode)\n if local_version.match(/-/)\n local_version = local_version.split(/-/)[1]\n end\n if depot_version.match(/-/)\n depot_version = depot_version.split(/-/)[1]\n end\n puts \"Current: \"+local_version\n puts \"Available: \"+depot_version\n if mode =~ /up|check/\n avail_fw = compare_ver(local_version,depot_version)\n if avail_fw.to_s != local_version.to_s\n puts \"Depot patch level is newer than installed version\"\n update_available = \"y\"\n else\n update_available = \"n\"\n puts \"Local patch level is up to date\"\n end\n else\n if depot_version.to_i < local_version.to_i\n puts \"Depot patch level is lower than installed version\"\n update_available = \"y\"\n else\n update_available = \"n\"\n puts \"Local patch level is up to date\"\n end\n end\n if mode == \"check\"\n exit\n end\n return update_available\nend",
"def test_comparison_release_type\n value1_ = ::Versionomy.create(:major => 2, :release_type => :alpha, :alpha_version => 5)\n value2_ = ::Versionomy.create(:major => 2, :release_type => :release_candidate, :release_candidate_version => 2)\n assert(value2_ > value1_)\n end",
"def compare_serial(s1, s2)\n if s1 == s2\n return 0\n end\n if s1 < s2 and (s2 - s1) < (2**31)\n return 1\n end\n if s1 > s2 and (s1 - s2) > (2**31)\n return 1\n end\n if s1 < s2 and (s2 - s1) > (2**31)\n return -1\n end\n if s1 > s2 and (s1 - s2) < (2**31)\n return -1\n end\n return 0\n end",
"def version_lt?( v1, v2 )\n v1 = version_string_to_a( v1 )\n v2 = version_string_to_a( v2 )\n c = v1 && v2 && ( v1 <=> v2 ) #-> nil for String/Integer mix\n c && c < 0\n end",
"def version_gte?( v1, v2 )\n v1 = version_string_to_a( v1 )\n v2 = version_string_to_a( v2 )\n c = v1 && v2 && ( v1 <=> v2 ) #-> nil for String/Integer mix\n c && c >= 0\n end",
"def version_mismatch_detected\n end",
"def pkg_version_less(a, b)\n a < b\n end",
"def test_equal_nanoseconds\n v = Verify.new\n return_code = v.verify_fourth_pipeset('121.99', '121.99')\n assert_equal 2, return_code\n end",
"def <=>(other)\n return unless FoobarMod::Version === other\n return 0 if @version == other._version || canonical_segments == other.canonical_segments\n\n lhsegments = canonical_segments\n rhsegments = other.canonical_segments\n\n lhsize = lhsegments.size\n rhsize = rhsegments.size\n limit = (lhsize > rhsize ? lhsize : rhsize) - 1\n\n i = 0\n\n while i <= limit\n lhs, rhs = lhsegments[i] || 0, rhsegments[i] || 0\n i += 1\n\n next if lhs == rhs\n return -1 if String === lhs && Numeric === rhs\n return 1 if Numeric === lhs && String === rhs\n\n return lhs <=> rhs\n end\n\n return 0\n end",
"def version_check_less_than(version_str_new, version_str_old)\n Gem::Version.new(version_str_old) < Gem::Version.new(version_str_new)\n end",
"def diff_to_compare; end",
"def validate_semver(changelog_hash)\n latest_release, latest_release_changelog = changelog_hash.first\n # extract prefix from first release to use on all subsequent releases\n latest_release_prefix = latest_release.partition(RELEASE_REGEX)[0]\n\n newer_version = nil\n changelog_hash.each do |key,value|\n\n prefix, version, suffix = key.partition(RELEASE_REGEX)\n puts \"Checking version with prefix:'#{prefix}', version:'#{version}', suffix:'#{suffix}'.\" if @releasinator_config[:verbose]\n if prefix != latest_release_prefix\n Printer.fail(\"version #{key} does not start with extracted prefix '#{latest_release_prefix}'.\")\n abort()\n end\n older_version = Semantic::Version.new version\n\n if nil != newer_version\n version_comp = newer_version <=> older_version\n if version_comp < 0\n Printer.fail(\"Semver releases out of order: #{older_version} should be smaller than #{newer_version}\")\n abort()\n elsif version_comp == 0\n # this case cannot be found with Vandamme library because 2 versions in a row get overwritten in the underlying hash\n if suffix.empty?\n Printer.fail(\"2 semver releases in a row without a suffix (like -beta, -rc1, etc...) is not allowed.\")\n abort()\n end\n else\n error_suffix = \"version increment error - comparing #{newer_version} to #{older_version} does not pass semver validation.\"\n # validate the next sequence in semver\n if newer_version.major == older_version.major\n if newer_version.minor == older_version.minor\n check_semver_criteria(newer_version.patch == older_version.patch + 1, \"patch #{error_suffix}\")\n else\n check_semver_criteria(newer_version.minor == older_version.minor + 1 && newer_version.patch == 0, \"minor #{error_suffix}\")\n end\n else\n check_semver_criteria(newer_version.major == older_version.major + 1 && newer_version.minor == 0 && newer_version.patch == 0, \"major #{error_suffix}\")\n end\n end\n end\n newer_version = older_version\n end\n end",
"def in_same_release_line?(other)\n major == other.major &&\n # minor and patch always match if one or the other is nil (~>-like behavior)\n ( minor.nil? || other.minor.nil? || minor == other.minor ) &&\n ( patch.nil? || other.patch.nil? || patch == other.patch )\n end",
"def calculate_versions\n tags = `git for-each-ref --sort='*authordate' --format='%(refname:short)' refs/tags/`.split(\"\\n\")\n @last = tags.select {|l| l =~ /(^#{@prefix}-|\\.0$)/ }.last.gsub(/^#{@prefix}-/, '')\n @current = @last\n\n pemajor, major, minor = @last.split('.')\n minor = minor.to_i + 1\n quarter = major.to_i + 1\n @next = \"#{pemajor}.#{major}.#{minor}\"\n @quarter = \"#{pemajor}.#{quarter}.0\"\nend",
"def test_equal_timestamp\n billcoin = BillCoin::new\n parser = Minitest::Mock.new('Parser')\n def parser.parse_timestamp timestamp\n timestamp.split('.').map! {|x| Integer(x)}\n end\n assert_raises SystemExit do\n billcoin.verify_valid_timestamp('1518893688.562508000', '1518893688.562508000', 0, parser)\n end\n end",
"def compare_versions\n if @local_version && \n (@local_version.to_machine_format >= @website_version.to_machine_format)\n display_versions\n puts \"You have the most recent version.\"\n puts \"Exiting...\"\n exit 0\n end\nend",
"def version_compare(a, b)\n make_comparable(a) <=> make_comparable(b)\n end",
"def mock_to_dist_version_arch(mock)\n # We care about matching against two patterns here:\n # pupent-3.4-el5-i386 <= old style with PE_VER baked into the mock name\n # pupent-el5-i386 <= new style derived from a template\n mock.match(/pupent(-\\d\\.\\d)?-([a-z]*)(\\d*)-([^-]*)/)[2..4]\n end",
"def valid_version?(version)\n version =~ /\\d+\\.\\d+\\.\\d+(\\.(alpha|beta|rc)(\\.\\d+)?)?/\nend",
"def version_between? low_version, high_version, current_version = nil\n current_version ||= rails_version\n return false unless current_version\n\n version = current_version.split(\".\").map!(&:to_i)\n low_version = low_version.split(\".\").map!(&:to_i)\n high_version = high_version.split(\".\").map!(&:to_i)\n\n version.each_with_index do |v, i|\n if v < low_version.fetch(i, 0)\n return false\n elsif v > low_version.fetch(i, 0)\n break\n end\n end\n\n version.each_with_index do |v, i|\n if v > high_version.fetch(i, 0)\n return false\n elsif v < high_version.fetch(i, 0)\n break\n end\n end\n\n true\n end",
"def match?(version)\n return false if version < lower_bound\n return include_lower_bound? if version == lower_bound\n return true if upper_bound.nil?\n return false if version > upper_bound\n return include_upper_bound? if version == upper_bound\n true\n end",
"def test_current_version\n check_current_version(current_nodes(:visible_node))\n check_current_version(current_nodes(:used_node_1))\n check_current_version(current_nodes(:used_node_2))\n check_current_version(current_nodes(:node_used_by_relationship))\n check_current_version(current_nodes(:node_with_versions))\n end",
"def test_earlier_timestamp\n billcoin = BillCoin::new\n parser = Minitest::Mock.new('Parser')\n def parser.parse_timestamp timestamp\n timestamp.split('.').map! {|x| Integer(x)}\n end\n assert_raises SystemExit do\n billcoin.verify_valid_timestamp('1518893688.562508000', '1518893687.562508100', 0, parser)\n end\n end",
"def is_less_than_one?\n return TRUE if get_dash_version.match(/^(\\d+)\\.\\d+\\.\\d+/)[1].to_i.zero?\n return FALSE\n end",
"def test_Rational_Compares\n\t\tassert_equal(true, Rational(\"1\") < Rational(\"2\"))\n\t\tassert_equal(false, Rational(\"2\") < Rational(\"1\"))\n\t\tassert_equal(true, Rational(\"1\") <= Rational(\"2\"))\n\t\tassert_equal(true, Rational(\"2\") <= Rational(\"2\"))\n\t\tassert_equal(false, Rational(\"4\") <= Rational(\"2\"))\n\t\tassert_equal(true, Rational(\"2\") == Rational(\"2\"))\n\t\tassert_equal(false, Rational(\"1\") == Rational(\"2\"))\n\t\tassert_equal(true, Rational(\"2\") >= Rational(\"1\"))\n\t\tassert_equal(true, Rational(\"2\") >= Rational(\"2\"))\n\t\tassert_equal(false, Rational(\"1\") >= Rational(\"2\"))\n\t\tassert_equal(true, Rational(\"2\") > Rational(\"1\"))\n\t\tassert_equal(false, Rational(\"1\") > Rational(\"2\"))\n\tend",
"def semver_cmp( semver1, semver2 )\n semver_to_i(semver1) - semver_to_i(semver2)\n end",
"def version_greater_than(left, right)\n return Gem::Version.new(left) >= Gem::Version.new(right)\n end",
"def version_equals?(v1, v2)\n return false unless v1 && v2\n\n v1 == v2\n end",
"def compare_versions\n return true unless version\n\n case browser\n when :msie then version >= '7.0'\n when :firefox then version >= '3.6.25'\n when :chrome then version >= '4.1.249'\n when :safari then version >= '4.0'\n when :opera then version >= '9.0'\n else true # return true if we don't know\n end\n end",
"def test_version\n assert Snarl.version >= '1.1'\n end",
"def test_prerelease?(version)\n !@version.stable? && @version.major == version.major && @version.minor == version.minor && @version.patch == version.patch\n end",
"def breaking_changes?(version)\n\t\t\tDownloadTV::VERSION.split(\".\").zip(version.split(\".\")).find_index { |x, y| y > x }&.< 2\n\t\tend",
"def have_version?(major, minor = nil, update = nil, build = nil)\n if major.class == Float\n major = major.to_s\n end\n if major.class == String\n major,minor,update = major.split('.').collect { |x| x.to_i }\n end\n if major == @major\n return false if minor != nil && minor != @minor\n return false if update != nil && update != @update\n return false if build != nil && build != @build\n return true\n else\n return false\n end\n end",
"def <=> other\n return unless Vendor::Version === other\n return 0 if @version == other.version\n\n lhsegments = segments\n rhsegments = other.segments\n\n lhsize = lhsegments.size\n rhsize = rhsegments.size\n limit = (lhsize > rhsize ? lhsize : rhsize) - 1\n\n i = 0\n\n while i <= limit\n lhs, rhs = lhsegments[i] || 0, rhsegments[i] || 0\n i += 1\n\n next if lhs == rhs\n return -1 if String === lhs && Numeric === rhs\n return 1 if Numeric === lhs && String === rhs\n\n return lhs <=> rhs\n end\n\n return 0\n end",
"def next_logical_version(increment = 1)\n return false if patchlevel_is_significant?\n split_version = @version_without_patchlevel.split(\".\")\n teeny = split_version.pop\n split_version << teeny.to_i + increment\n split_version.join(\".\")\n end",
"def mock_el_ver(mock_config)\n if Pkg::Config.build_pe\n # This uses a regex capture instead of splitting to allow the now defunct PE version component to be optional\n version = mock_config.match(/^pupent-(\\d\\.\\d-)?([a-z]+)([0-9]+)-(.*)$/)[3]\n else\n first, second, third = mock_config.split('-')\n if ['el', 'fedora'].include?(first) || (first == 'pl' && second.match(/^\\d+$/))\n version = second\n else\n version = third\n end\n end\n if [first, second].include?('fedora')\n version = \"f#{version}\"\n end\n version\nend",
"def matches?(version_operation)\n pattern_match = version_operation.scan(/\\A([<>]?=?)\\s*(\\d+\\.\\d+)\\z/).first\n fail \"Unsupported comparison operation or version name in #{version_operation.inspect}\" unless pattern_match\n operator, other_version = pattern_match\n operator = '==' if operator.empty? || operator == '='\n send(operator, other_version)\n end",
"def check_version(v)\n return true if (!version || version[0..4].gsub(\".\",\"\").to_i>=v)\n return false\n end",
"def have_at_least_version?(major, minor = nil, update = nil, build = nil)\n if major.class == Float\n major = major.to_s\n end\n if major.class == String\n major,minor,update = major.split('.').collect { |x| x.to_i }\n end\n if major == @major #Could true\n if minor != nil #Being asked to test minor level\n if minor == @minor #Could be true\n if update != nil #Being asked to test update level\n if update == @update #Could be true\n if build != nil #Being asked to test the build version\n return build <= @build #have at least the required patch level.\n end\n return true #update was equal\n end\n return update < @update #current version is newer\n end\n return true #major and minor was equal.\n end\n return minor < @minor #true if current version is newer\n end\n return true #major was equal.\n end\n return major < @major #true, if current version is newer\n end",
"def test_history_equals_versions\n check_history_equals_versions(current_ways(:visible_way).id)\n check_history_equals_versions(current_ways(:used_way).id)\n check_history_equals_versions(current_ways(:way_with_versions).id)\n end",
"def <=>(other)\n return self <=> self.class.new(other) if (String === other) && self.class.correct?(other)\n\n return unless Gem::Version === other\n return 0 if @version == other._version || canonical_segments == other.canonical_segments\n\n lhsegments = canonical_segments\n rhsegments = other.canonical_segments\n\n lhsize = lhsegments.size\n rhsize = rhsegments.size\n limit = (lhsize > rhsize ? lhsize : rhsize) - 1\n\n i = 0\n\n while i <= limit\n lhs, rhs = lhsegments[i] || 0, rhsegments[i] || 0\n i += 1\n\n next if lhs == rhs\n return -1 if String === lhs && Numeric === rhs\n return 1 if Numeric === lhs && String === rhs\n\n return lhs <=> rhs\n end\n\n return 0\n end",
"def test\n commit_v = check_commit_version\n serv_v = check_server_version\n updated = Gem::Version.new(serv_v) < Gem::Version.new(commit_v)\n\n puts \"Running cookbook version rev'd test:\"\n puts \"Server version: #{serv_v}\".indent\n puts \"Commit version: #{commit_v}\".indent\n puts updated ? \"PASS: Metadata version has been rev'd\".indent : \"FAIL: Metadata version has NOT been rev'd\".indent.to_red\n updated\n end",
"def compare_gem_to_reference(calculation_method, reference_results)\n top_dates = reference_results.first.map{|date| Date.parse(date) if date}\n left_dates = reference_results.map{|line| Date.parse(line[0]) if line[0]}\n\n differences = same_result = 0\n\n top_dates.each_with_index do |top_date, top_index|\n next if top_index == 0\n left_dates.each_with_index do |left_date, left_index|\n next if left_index == 0\n gem_result = days360(left_date, top_date, calculation_method)\n reference_result = reference_results[left_index][top_index].to_i\n equal = reference_result.eql?(gem_result)\n\n same_result += 1 if equal\n differences += 1 if not equal\n puts \"For DAYS360( #{left_date}, #{top_date} ) the result should be #{reference_result} instead of #{gem_result}.\" if not equal\n\n end\n end\n\n p \"Compared #{differences + same_result} date combinations to reference results using #{calculation_method} and found #{differences} differences\"\n\n return {:comparisons => (differences + same_result), :differences => differences}\nend",
"def snapshots_match?(s1, s2)\n s1 == s2\n end",
"def test_Rational_InstanceMethods_Comparison\n\t\tassert_equal(0, Rational(\"4/2\") <=> Rational(\"98/49\"))\n\t\tassert_equal(-1, Rational(\"3/4\") <=> 41)\n\t\tassert_equal(0, Rational(\"0\") <=> 0.0)\n\tend",
"def version_geq(v1, v2)\n version_gt(v1, v2) || !version_gt(v2, v1)\n end",
"def valid_version?(arg)\n return true if arg == 'latest'\n arg =~ /^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9]+)?$/ ? true : false\n end",
"def valid_version?(arg)\n return true if arg == false || arg == 'latest'\n arg =~ /^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9]+)?$/ ? true : false\n end",
"def totest_version\n Rails.cache.fetch(\"totest_version_for_#{name}\", expires_in: 10.minutes) do\n begin\n d = Xmlhash.parse(ActiveXML::backend.direct_http \"/build/#{name}:ToTest/#{TOTEST_VERSION_FILE}\")\n d.elements('binary') do |b|\n matchdata = %r{.*Snapshot(.*)-Media\\.iso$}.match(b['filename'])\n return matchdata[1] if matchdata\n end\n rescue\n nil\n end\n end\n end",
"def test_format_prerelease\n version = VMLib::Version.new\n \n # Test that an empty prerelease corresponds to an empty string\n version.prerelease = ''\n assert_equal '', version.format('%r')\n\n # Test that a dev release corresponds to a -# string\n version.prerelease = '0'\n assert_equal '-0', version.format('%r')\n version.prerelease = '1'\n assert_equal '-1', version.format('%r')\n\n # Test that an alpha prerelease corresponds to a -a.# string\n version.prerelease = 'alpha.1'\n assert_equal '-a.1', version.format('%r')\n version.prerelease = 'a.2'\n assert_equal '-a.2', version.format('%r')\n\n # Test that a beta prerelease corresponds to a -b.# string\n version.prerelease = 'beta.3'\n assert_equal '-b.3', version.format('%r')\n version.prerelease = 'b.4'\n assert_equal '-b.4', version.format('%r')\n\n # Test that a rc prerelease corresponds to a -rc.# string\n version.prerelease = 'rc.5'\n assert_equal '-rc.5', version.format('%r')\n\n # Test that a custom prerelease prints as entered\n version.prerelease = 'foo.bar.baz'\n assert_equal '-foo.bar.baz', version.format('%r')\n version.prerelease = '1.2.3.4.5.6.7.8.9.0'\n assert_equal '-1.2.3.4.5.6.7.8.9.0', version.format('%r')\n\n # Verify that numeric fields are stripped of leading zeroes\n version.prerelease = '1.2.3.4.5.6.7.8.9.09'\n assert_equal '-1.2.3.4.5.6.7.8.9.9', version.format('%r')\n\n end",
"def jamm_version(version)\n case version.to_s.strip\n when /^0.[0-7]/\n '0.2.5'\n when /^0.8/\n '0.2.2'\n when /^1|^2.0/\n '0.2.5'\n when /^2.1.[0-1]$/\n '0.2.6'\n when /^2.1.[2-3]$/\n '0.2.8'\n when /^2.1/\n '0.3.1'\n when /^2.2/\n '0.3.1'\n when /^3.[0-9]/\n '0.3.1'\n end\nend",
"def <=>(other) \n\n versionComparison = Substring.new(get_version_string) <=> Substring.new(other.get_version_string)\n (return versionComparison) if versionComparison != 0\n\n other_pre = other.instance_variable_get('@pre')\n if @pre != nil and other_pre == nil\n return -1\n elsif @pre == nil and other_pre != nil\n return 1\n elsif @pre != nil and other_pre != nil\n pre_comparison = Substring.new(@pre) <=> Substring.new(other_pre)\n (return pre_comparison) if pre_comparison != 0\n end\n\n other_build = other.instance_variable_get('@build')\n if @build == nil and other_build != nil\n return -1\n elsif @build != nil and other_build == nil\n return 1\n elsif @build != nil and other_build != nil\n build_comparison = Substring.new(@build) <=> Substring.new(other_build)\n (return build_comparison) if build_comparison != 0\n end\n\n return 0\n end",
"def test_call_instance_get_version_at_given_time\r\n\t\tVCR.use_cassette('get_version_at_given_time') do\r\n\t\t\tdata = {'timestamp' => \"2019-12-09T10:28:20.000Z\"}\r\n\t\t\tcdo = CordraRestClient::DigitalObject.call_instance_method(API_URL, \"#{CORDRA_PREFIX}/82752031921751eb6ab9\",\"getVersionAtGivenTime\",data,nil)\r\n\r\n\t\t\t# Because we have requested the version before the object was modified, the response should contain the attribute \"comparisonAgainstCurrentVersion\"\r\n\t\t\tassert_equal \"#{CORDRA_PREFIX}/82752031921751eb6ab9\", cdo[\"id\"]\r\n\t\t\tassert_equal true, cdo[\"attributes\"].key?(\"comparisonAgainstCurrentVersion\")\r\n\t\tend\r\n\tend",
"def outdated_state(scraper_version, latest_version)\n scraper_parts = scraper_version.to_s.split(/[-.]/).map(&:to_i)\n latest_parts = latest_version.to_s.split(/[-.]/).map(&:to_i)\n\n # Only check the first two parts, the third part is for patch updates\n [0, 1].each do |i|\n break if i >= scraper_parts.length or i >= latest_parts.length\n return 'Outdated major version' if i == 0 and latest_parts[i] > scraper_parts[i]\n return 'Outdated minor version' if i == 1 and latest_parts[i] > scraper_parts[i]\n return 'Up-to-date' if latest_parts[i] < scraper_parts[i]\n end\n\n 'Up-to-date'\n end",
"def do_compare (opts)\n\tif (params = opts[:parameters]) && params.size(:seq) > 0 &&\n\t params[0].is_a?(Numeric)\n\t diff = params[0]\n\telse diff = 0\n\tend\n\tdiff = @original - diff\n\tcase opts[:method]\n\twhen '<' then diff < 0\n\twhen '<=' then diff <= 0\n\twhen '==' then diff == 0\n\twhen '!=' then diff != 0\n\twhen '>=' then diff >= 0\n\twhen '>' then diff > 0\n\tend\n end",
"def is_rc?\n case get_dash_version\n when /^\\d+\\.\\d+\\.\\d+-*rc\\d+/\n TRUE\n when /^\\d+\\.\\d+\\.\\d+\\.SNAPSHOT\\.\\d{4}\\.\\d{2}\\.\\d{2}T\\d{4}/\n TRUE\n else\n FALSE\n end\n end",
"def patch(version)\n res = 0\n res = Regexp.last_match(1) if version =~ /^\\s*\\d+\\.\\d+\\.(\\d+)/\n res\n end",
"def test_Rational_InstanceMethods_Compare2\n\t\tassert_equal(true, Rational(\"2\") == Rational(\"2\"))\n\t\tassert_equal(false, Rational(\"1\") == Rational(\"2\"))\n\tend",
"def is_odd?\n return TRUE if get_dash_version.match(/^\\d+\\.(\\d+)\\.\\d+/)[1].to_i.odd?\n return FALSE\n end",
"def test_out_of_order_times_nanoseconds\n v = Verify.new\n return_code = v.verify_fourth_pipeset('121.12', '121.99')\n assert_equal 2, return_code\n end",
"def test_version\n check_current_version(current_ways(:visible_way).id)\n check_current_version(current_ways(:used_way).id)\n check_current_version(current_ways(:way_with_versions).id)\n end",
"def <=> (other)\n # Check major version\n cmp = (@major <=> other.major)\n return cmp unless cmp == 0\n\n # Check minor version\n cmp = (@minor <=> other.minor)\n return cmp unless cmp == 0\n\n # Check patch version\n cmp = (@patch <=> other.patch)\n return cmp unless cmp == 0\n\n # Check prerelease arrays\n myown_pre = self.prerelease.split('.')\n convert_to_integer(myown_pre)\n other_pre = other.prerelease.split('.')\n convert_to_integer(other_pre)\n cmp = compare_arrays(myown_pre, other_pre)\n \n # Make sure that the prerelease is compared correctly\n cmp = 1 if cmp == -1 and myown_pre.length == 0\n cmp = -1 if cmp == 1 and other_pre.length == 0\n return cmp unless cmp == 0\n\n # Check build arrays, but only if specified\n # As with the parser, leave identifiers as strings so they can\n # be compared lexically\n if (@@compare_build)\n myown_bld = self.build.split('.')\n other_bld = other.build.split('.')\n cmp = compare_arrays(myown_bld, other_bld)\n return cmp unless cmp == 0\n end\n\n return 0\n end",
"def test_method_prereleasep\n value_ = ::Versionomy.create([1, 9, 2, 'a2'], :semver)\n assert_equal(true, value_.prerelease?)\n value_ = ::Versionomy.create([1, 9, 2], :semver)\n assert_equal(false, value_.prerelease?)\n end"
] |
[
"0.68930626",
"0.6777023",
"0.66131496",
"0.658415",
"0.65485173",
"0.6538966",
"0.6520678",
"0.6511816",
"0.63691634",
"0.6321949",
"0.628066",
"0.626531",
"0.62384665",
"0.6185876",
"0.61678445",
"0.61628306",
"0.61530167",
"0.6127873",
"0.6123939",
"0.6079843",
"0.60696566",
"0.60688275",
"0.6067578",
"0.6044561",
"0.60438323",
"0.6043655",
"0.6037256",
"0.6035581",
"0.60060525",
"0.59800625",
"0.59665495",
"0.5947109",
"0.59381396",
"0.5928633",
"0.59150594",
"0.5862264",
"0.5857319",
"0.58102906",
"0.5804128",
"0.5797814",
"0.5784821",
"0.5781533",
"0.57033944",
"0.56991154",
"0.56778497",
"0.56376827",
"0.56055695",
"0.55728173",
"0.55633396",
"0.5552055",
"0.55306756",
"0.5514599",
"0.5503093",
"0.55000144",
"0.5486611",
"0.5480726",
"0.5470881",
"0.5430339",
"0.54127336",
"0.5380488",
"0.5377796",
"0.53742045",
"0.53472024",
"0.53437716",
"0.53424937",
"0.53318644",
"0.531349",
"0.53085804",
"0.5295785",
"0.52838373",
"0.52683485",
"0.5263501",
"0.5260502",
"0.5259488",
"0.52536136",
"0.52477086",
"0.5243771",
"0.52419776",
"0.523794",
"0.523152",
"0.52313936",
"0.5227066",
"0.52085835",
"0.52025336",
"0.5192815",
"0.5185779",
"0.51828474",
"0.51813745",
"0.5179705",
"0.5174623",
"0.51732665",
"0.5163558",
"0.51522523",
"0.5144021",
"0.51409256",
"0.51300836",
"0.51177365",
"0.5108712",
"0.50962114",
"0.5095705"
] |
0.71972096
|
0
|
Test if another RPMDependency satisfies our requirements
|
def satisfy?(y)
unless y.is_a?(RPMDependency)
raise ArgumentError, "Expecting an RPMDependency object"
end
x = self
# Easy!
if x.name != y.name
return false
end
# Partial compare
#
# eg: x.version 2.3 == y.version 2.3-1
sense = x.version.partial_compare(y.version)
# Thanks to rpmdsCompare() rpmds.c
if (sense < 0) && ((x.flag == :> || x.flag == :>=) || (y.flag == :<= || y.flag == :<))
return true
elsif (sense > 0) && ((x.flag == :< || x.flag == :<=) || (y.flag == :>= || y.flag == :>))
return true
elsif sense == 0 && (
((x.flag == :== || x.flag == :<= || x.flag == :>=) && (y.flag == :== || y.flag == :<= || y.flag == :>=)) ||
(x.flag == :< && y.flag == :<) ||
(x.flag == :> && y.flag == :>)
)
return true
end
false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def =~(other)\n unless Gem::Dependency === other\n return unless other.respond_to?(:name) && other.respond_to?(:version)\n other = Gem::Dependency.new other.name, other.version\n end\n\n return false unless name === other.name\n\n reqs = other.requirement.requirements\n\n return false unless reqs.length == 1\n return false unless reqs.first.first == '='\n\n version = reqs.first.last\n\n requirement.satisfied_by? version\n end",
"def satisfies_requirement?(dependency)\n return @name == dependency.name &&\n dependency.requirement.satisfied_by?(@version)\n end",
"def =~(other)\n unless FoobarMod::Dependency === other\n return false unless other.respond_to?(:identifier) && other.respond_to?(:version)\n other = FoobarMod::Dependency.new other.identifier, other.version\n end\n\n return false unless identifier === other.identifier\n\n reqs = other.requirement.requirements\n\n return false unless reqs.length == 1\n return false unless reqs.first.first == '=='\n\n version = reqs.first.last\n\n requirement.satisfied_by? version\n end",
"def satisfied_by?(req_vers, new_vers)\n req = LibGems::Requirement.new(req_vers)\n req_vers.sub(/^= /,'') == new_vers.sub(/^= /,'') ||\n req.satisfied_by?(LibGems::Version.new(new_vers))\n end",
"def has_all_requirements_for?(gem_dep)\n reqs = self.requirements_for_gem gem_dep.name\n # create a spec requirement dependency for each expanded subrequirement,\n # verify we can find a match for that\n gem_dep.requirement.to_s.split(',').all? { |greq|\n Gem2Rpm::Helpers.expand_requirement([greq.split]).all? { |ereq|\n tereq = Requirement.new :name => \"#{requirement_prefix}(#{gem_dep.name})\",\n :condition => ereq.first,\n :version => ereq.last.to_s\n reqs.any? { |req| req.matches?(tereq)}\n }\n }\n end",
"def gem_dep_matches?(what, version, *deps)\n # always match if we have no chef_version at all\n return true unless deps.length > 0\n\n # match if we match any of the chef_version lines\n deps.any? { |dep| dep.match?(what, version) }\n end",
"def check_dependencies(desc, target_package = nil, active_criteria = false)\n # dependent_packages = Pkgd.where(\n # { 'pd.package_content' => { '$elemMatch' => { 'id.name' => desc['id'][:name],\n # 'id.vendor' => desc['id'][:vendor],\n # 'id.version' => desc['id'][:version] } } })\n # dependent_packages.each do |dp|\n # diffp_condition = true\n # if target_package != nil\n # diffp_condition = ( (dp['pd']['name'] != target_package['name']) or\n # (dp['pd']['vendor'] != target_package['vendor']) or\n # (dp['pd']['version'] != target_package['version']) )\n # end\n # if diffp_condition\n # if active_criteria\n # return true if dp['status'].casecmp('ACTIVE') == 0\n # else\n # return true\n # end\n # end\n # end\n false\n end",
"def satisfied_by?(spec)\n return false unless requirement\n spec = ArtifactNamespace.to_hash(spec)\n hash = to_spec_hash\n hash.delete(:version)\n version = spec.delete(:version)\n hash == spec && requirement.satisfied_by?(version)\n end",
"def meets_requirements?\n if dirname = Micro.installed_gem_dirnames(name).last\n Gem::Version.from_gem_dirname(dirname) >= @version_requirements.version\n end\n end",
"def match?(spec, allow_prerelease = false)\n @dependency.match? spec, nil, allow_prerelease\n end",
"def RunSCRSwitchTest_DoNeededRPMsRequire(package_name)\n test_result = nil\n ret = true\n\n required_packages = Convert.convert(\n SCR.Execute(\n path(\".target.bash_output\"),\n Builtins.sformat(\n \"%1 %2 %3\",\n @test_chroot_binary,\n @chroot_path,\n Builtins.sformat(@test_requires, package_name)\n )\n ),\n :from => \"any\",\n :to => \"map <string, any>\"\n )\n test_result = Ops.get_integer(required_packages, \"exit\", 42) == 0\n ret = false if !test_result\n\n ReportTest(\n # Test progress\n Builtins.sformat(\n _(\"Checking what requires RPM package %1...\"),\n package_name\n ),\n test_result\n )\n\n # we have required objects\n if test_result\n required_packages_s = Ops.get_string(required_packages, \"stdout\", \"\")\n\n already_checked = []\n\n # check all required objects (sorted and only once)\n Builtins.foreach(\n Builtins.toset(Builtins.splitstring(required_packages_s, \"\\n\"))\n ) do |one_require|\n next if one_require == nil || one_require == \"\"\n # already checked\n next if Builtins.contains(already_checked, one_require)\n # do not check again\n already_checked = Builtins.add(already_checked, one_require)\n if Builtins.regexpmatch(one_require, \"[ \\t]\")\n one_require = Builtins.regexpsub(\n one_require,\n \"^([^ \\t]*)[ \\t]\",\n \"\\\\1\"\n )\n end\n what_provides = Convert.convert(\n SCR.Execute(\n path(\".target.bash_output\"),\n Builtins.sformat(\n \"%1 %2 %3\",\n @test_chroot_binary,\n @chroot_path,\n Builtins.sformat(@test_whatprovides, one_require)\n )\n ),\n :from => \"any\",\n :to => \"map <string, any>\"\n )\n test_result = Ops.get_integer(what_provides, \"exit\", 42) == 0\n if !test_result\n # do not check whether required objects are installed\n # if we don't have which they are\n raise Break\n ret = false\n end\n what_provides_s = Ops.get_string(what_provides, \"stdout\", \"\")\n at_least_one = false\n # checks whether objects that provides something are installed\n Builtins.foreach(\n Builtins.toset(Builtins.splitstring(what_provides_s, \"\\n\"))\n ) do |one_provides|\n next if one_provides == \"\"\n if RunSCRSwitchTest_CheckWhetherInstalled(one_provides)\n at_least_one = true\n raise Break\n else\n ret = false\n end\n end\n # none of what_provides is installed\n # or nothing provides the requierd object\n ret = false if !at_least_one\n end\n end\n\n ret\n end",
"def requirement_satisfied_by?(requirement, activated, spec)\n requirement.constraint.satisfies?(spec.version)\n end",
"def requirement_satisfied_by?(requirement, activated, spec)\n true\n end",
"def RunSCRSwitchTest_DoNeededRPMsCheck\n ret = true\n\n # check whether all needed packages are installed\n Builtins.foreach(Builtins.sort(@needed_rpm_packages)) do |package_name|\n # Test progress\n ReportProgress(\n Builtins.sformat(\n _(\"Running complex check on package %1...\"),\n package_name\n )\n )\n # is the package installed?\n if !RunSCRSwitchTest_CheckWhetherInstalled(package_name)\n ret = false\n raise Break\n # if it is installed, check whetheris has all dependencies\n elsif !RunSCRSwitchTest_DoNeededRPMsRequire(package_name)\n ret = false\n raise Break\n end\n end\n\n ret\n end",
"def requirement_satisfied_by?(requirement, activated, spec)\n version = spec.version\n return false unless requirement.requirement.satisfied_by?(version)\n return false unless valid_possibility_version_for_root_name?(requirement, activated, spec)\n return false unless spec_is_platform_compatible?(activated, requirement, spec)\n true\n end",
"def matches_spec?(spec)\n @dependency.matches_spec? spec\n end",
"def ok?\n @specs.all? { |spec|\n\tspec.dependencies.all? { |dep|\n\t @specs.find { |s| s.satisfies_requirement?(dep) }\n\t}\n }\n end",
"def matches_spec? spec\n name == spec.name and requirement.satisfied_by? spec.version\n end",
"def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend",
"def compare(upstream_source)\n same = {}\n diff = {}\n upstream_source.deps.each do |d|\n spec_reqs = self.requirements_for_gem(d.name)\n spec_reqs_specifier = spec_reqs.empty? ? nil :\n spec_reqs.collect { |req| req.specifier }\n\n if spec_reqs.nil?\n diff[d.name] = {:spec => nil,\n :upstream => d.requirement.to_s}\n\n elsif !spec_reqs.any? { |req| req.matches?(d) } ||\n !self.has_all_requirements_for?(d)\n diff[d.name] = {:spec => spec_reqs_specifier,\n :upstream => d.requirement.to_s}\n\n elsif !diff.has_key?(d.name)\n same[d.name] = {:spec => spec_reqs_specifier,\n :upstream => d.requirement.to_s }\n end\n end\n\n @metadata[:requires].each do |req|\n next unless req.gem?\n\n upstream_dep = upstream_source.deps.find { |d| d.name == req.gem_name }\n\n if upstream_dep.nil?\n diff[req.gem_name] = {:spec => req.specifier,\n :upstream => nil}\n\n elsif !req.matches?(upstream_dep)\n diff[req.gem_name] = {:spec => req.specifier,\n :upstream => upstream_dep.requirement.to_s }\n\n elsif !diff.has_key?(req.gem_name)\n same[req.gem_name] = {:spec => req.specifier,\n :upstream => upstream_dep.requirement.to_s }\n end\n end unless @metadata[:requires].nil?\n\n {:same => same, :diff => diff}\n end",
"def has_conflicts?\n return true unless Gem.env_requirement(name).satisfied_by?(version)\n self.dependencies.any? do |dep|\n if dep.runtime?\n spec = Gem.loaded_specs[dep.name]\n spec and not spec.satisfies_requirement? dep\n else\n false\n end\n end\n end",
"def version_requirement_satisfied?(current_version, new_version)\n target_version_already_installed?(current_version, new_version)\n end",
"def pd_version_satisfies?(*constraints)\n pd_version = Gem::Version.new(@driver.version)\n Gem::Requirement.new(*constraints).satisfied_by?(pd_version)\n end",
"def match_requirements r,p,path=\"\"\n r.each { |k|\n if not p.has_key? k\n @fails << \"Missing #{path}/#{k}\"\n else\n if r[k].class == Hash\n if p[k].class != Hash\n @fails << \"'provides' #{path}/#{k} should be a hash because 'requires' is.\"\n else\n match_requirements r[k],p[k],\"#{path}/#{k}\"\n end\n end\n end\n }\n end",
"def satisfied_by?(version)\n raise ArgumentError, \"Need a Gem::Version: #{version.inspect}\" unless\n Gem::Version === version\n requirements.all? {|op, rv| OPS[op].call version, rv }\n end",
"def ok?\n @specs.all? do |spec|\n spec.runtime_dependencies.all? do |dep|\n @specs.find { |s| s.satisfies_requirement? dep }\n end\n end\n end",
"def matches_requirement?(query, option, requirement); end",
"def dependencies_satisfied?(deps)\n deps.all? do |dep|\n depprop = Proposal.where(barclamp: dep[\"barclamp\"], name: dep[\"inst\"]).first\n depprop_queued = depprop[\"deployment\"][dep[\"barclamp\"]][\"crowbar-queued\"] rescue false\n depprop_deployed = (depprop[\"deployment\"][dep[\"barclamp\"]][\"crowbar-status\"] == \"success\") rescue false\n\n depprop && !depprop_queued && depprop_deployed\n end\n end",
"def requirement_satisfied_by?(requirement, _activated, spec)\n requirement.satisified_by?(spec)\n end",
"def installed?(name, req = Gem::Requirement.default)\n Gem::Specification.any? { |s| s.name =~ name and req =~ s.version }\n end",
"def packages_from_require(rpmdep)\n refresh\n @rpmdb.whatprovides(rpmdep)\n end",
"def dependencies_equal?(dependencies, other_dependencies)\n dependencies == other_dependencies\n end",
"def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend",
"def prerelease?\n requirements.any? {|r| r.last.prerelease? }\n end",
"def for_spec?(spec)\n @dependency.name == spec.name\n end",
"def for_spec?(spec)\n @dependency.name == spec.name\n end",
"def matches_spec?(spec)\n return false unless name === spec.name\n return true if requirement.none?\n\n requirement.satisfied_by?(spec.version)\n end",
"def rpm_installed?(name)\n system_command(\"rpm\", args: [\"-q\", \"--qf\", \"%{NAME}-%{VERSION}\", name]).success?\nend",
"def has_dependencies?\n update_for.length > 0 or requires.length > 0\n end",
"def requirements_met?\n preconditions.all? &:met?\n end",
"def assert_satisfies(specs)\n unsatisfied_specs = specs.specs.reject do |spec|\n @modules.any? do |mod|\n spec.satisfied_by?(mod)\n end\n end\n\n versionless_mods = @modules.select { |mod| mod.is_a?(ForgeModule) && mod.version.nil? }\n command = Bolt::Util.windows? ? 'Install-BoltModule -Force' : 'bolt module install --force'\n\n if unsatisfied_specs.any?\n message = <<~MESSAGE.chomp\n Puppetfile does not include modules that satisfy the following specifications:\n\n #{unsatisfied_specs.map(&:to_hash).to_yaml.lines.drop(1).join.chomp}\n \n This Puppetfile might not be managed by Bolt. To forcibly overwrite the\n Puppetfile, run '#{command}'.\n MESSAGE\n\n raise Bolt::Error.new(message, 'bolt/missing-module-specs')\n end\n\n if versionless_mods.any?\n message = <<~MESSAGE.chomp\n Puppetfile includes Forge modules without a version requirement:\n \n #{versionless_mods.map(&:to_spec).join.chomp}\n \n This Puppetfile might not be managed by Bolt. To forcibly overwrite the\n Puppetfile, run '#{command}'.\n MESSAGE\n\n raise Bolt::Error.new(message, 'bolt/missing-module-version-specs')\n end\n end",
"def deps_satisfied?(deps)\n deps.each do |dep|\n if dep.to_s =~ /^no_(.*)$/\n return false if @used_legos.include?( $1 )\n else\n return false unless @used_legos.include?( dep.to_s )\n end\n end\n\n true\nend",
"def require_matched_dependency_version\n false\n end",
"def dependency_met?\n true\n end",
"def check_for_requirements; end",
"def missing_deps_for(gem)\n # Comparison by name here assuming if it is in existing spec,\n # spec author will have ensured versions are correct for their purposes\n gem.deps.select { |dep| requirements_for_gem(dep.name).empty? }\n end",
"def ok_to_remove?(full_name)\n gem_to_remove = find_name(full_name)\n siblings = @specs.find_all { |s|\n\ts.name == gem_to_remove.name &&\n\t s.full_name != gem_to_remove.full_name\t\n }\n deps = []\n @specs.each do |spec|\n\tspec.dependencies.each do |dep|\n\t deps << dep if gem_to_remove.satisfies_requirement?(dep)\n\tend\n end\n deps.all? { |dep|\n\tsiblings.any? { |s| \n\t s.satisfies_requirement?(dep)\n\t}\n }\n end",
"def requirement\n @dependency.requirement\n end",
"def check_version(version, requirement)\n Gem::Requirement.new( requirement ).satisfied_by? Gem::Version.new( version )\n end",
"def ok_to_remove?(full_name)\n gem_to_remove = find_name full_name\n\n siblings = @specs.find_all { |s|\n s.name == gem_to_remove.name &&\n s.full_name != gem_to_remove.full_name\n }\n\n deps = []\n\n @specs.each do |spec|\n spec.dependencies.each do |dep|\n deps << dep if gem_to_remove.satisfies_requirement?(dep)\n end\n end\n\n deps.all? { |dep|\n siblings.any? { |s|\n s.satisfies_requirement? dep\n }\n }\n end",
"def dependency?(software)\n name = if software.respond_to?(:name)\n software.send(:name)\n else\n software\n end\n @dependencies.include?(name)\n end",
"def validate_dependencies # :nodoc:\n warning_messages = []\n @specification.dependencies.each do |dep|\n prerelease_dep = dep.requirements_list.any? do |req|\n Gem::Requirement.new(req).prerelease?\n end\n\n warning_messages << \"prerelease dependency on #{dep} is not recommended\" if\n prerelease_dep && !@specification.version.prerelease?\n\n open_ended = dep.requirement.requirements.all? do |op, version|\n not version.prerelease? and (op == '>' or op == '>=')\n end\n\n if open_ended\n op, dep_version = dep.requirement.requirements.first\n\n segments = dep_version.segments\n\n base = segments.first 2\n\n recommendation = if (op == '>' || op == '>=') && segments == [0]\n \" use a bounded requirement, such as '~> x.y'\"\n else\n bugfix = if op == '>'\n \", '> #{dep_version}'\"\n elsif op == '>=' and base != segments\n \", '>= #{dep_version}'\"\n end\n\n \" if #{dep.name} is semantically versioned, use:\\n\" \\\n \" add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join '.'}'#{bugfix}\"\n end\n\n warning_messages << [\"open-ended dependency on #{dep} is not recommended\", recommendation].join(\"\\n\") + \"\\n\"\n end\n end\n if warning_messages.any?\n warning_messages.each {|warning_message| warning warning_message }\n end\n end",
"def check_dependencies\n fetch_module_dependencies.map do |dependency, constraint|\n dependency = dependency.sub('-', '/')\n current = dependency == @updated_module ? SemanticPuppet::Version.parse(@updated_module_version) : @forge.get_current_version(dependency)\n [dependency, constraint, current, constraint.include?(current)]\n end\n end",
"def check_manifest(manifest, all_deps)\n related = all_deps.select{|d| d.name == manifest.name}\n if q = related.find{|d| !d.satisfied_by?(manifest)}\n debug_conflict manifest, q\n return false\n end\n true\n end",
"def has_build_satisfying?(name, version)\n dep = ::Gem::Dependency.new name, version\n versions_for(name).any? { |v| dep.match?(name, v) }\n end",
"def dependency_unmet?(*args, &block); end",
"def dependency?(software)\n name = software.is_a?(Software) ? software.name : software\n dependencies.include?(name)\n end",
"def dependency?(software)\n name = software.is_a?(Software) ? software.name : software\n dependencies.include?(name)\n end",
"def requirements(requirements); end",
"def required_by(dependency, dependent_name)\n dependencies_by_requirer_name[dependent_name] ||= []\n dependencies_by_requirer_name[dependent_name] << dependency\n dependencies << dependency\n\n if acceptable_versions.empty?\n message = \"Unable to satisfy the following requirements:\\n\\n\"\n dependencies_by_requirer_name.each do |name, dependencies|\n dependencies.each do |dep|\n message << \"- `#{dep}` required by `#{name}`\\n\"\n end\n end\n raise Informative, message\n end\n end",
"def spec_is_platform_compatible?(dependency_graph, dependency, spec)\n # This is safe since a pod will only be in locked dependencies if we're\n # using the same exact version\n return true if locked_dependencies.vertex_named(spec.name)\n\n vertex = dependency_graph.vertex_named(dependency.name)\n predecessors = vertex.recursive_predecessors.select(&:root?)\n predecessors << vertex if vertex.root?\n platforms_to_satisfy = predecessors.flat_map(&:explicit_requirements).flat_map { |r| @platforms_by_dependency[r] }.uniq\n\n available_platforms = spec.available_platforms\n\n platforms_to_satisfy.all? do |platform_to_satisfy|\n available_platforms.all? do |spec_platform|\n next true unless spec_platform.name == platform_to_satisfy.name\n # For non library specs all we care is to match by the platform name, not to satisfy the version.\n next true if spec.non_library_specification?\n platform_to_satisfy.supports?(spec_platform)\n end\n end\n end",
"def need(*specs)\n named = specs.flatten.inject({}) do |seen, spec|\n if Hash === spec && (spec.keys & ActsAsArtifact::ARTIFACT_ATTRIBUTES).empty?\n spec.each_pair do |name, spec|\n if Array === spec # a group\n seen[name] ||= spec.map { |s| ArtifactRequirement.new(s) }\n else\n artifact = ArtifactRequirement.new(spec)\n artifact.name = name\n seen[artifact.name] ||= artifact\n end\n end\n else\n artifact = ArtifactRequirement.new(spec)\n seen[artifact.name] ||= artifact\n end\n seen\n end\n named.each_pair do |name, artifact|\n if Array === artifact # a group\n artifact.each do |a|\n unvers = a.unversioned_spec\n previous = registry[unvers]\n if previous && previous.selected? && a.satisfied_by?(previous)\n a.version = previous.version\n end\n registry[unvers] = a\n end\n group(name, *(artifact.map { |a| a.unversioned_spec } + [{:namespace => self}]))\n else\n unvers = artifact.unversioned_spec\n previous = registry.get(unvers, true)\n if previous && previous.selected? && artifact.satisfied_by?(previous)\n artifact.version = previous.version\n artifact.selected!\n end\n registry[unvers] = artifact\n registry.alias name, unvers unless name.to_s[/^\\s*$/]\n end\n end\n self\n end",
"def depends_on?(other_task)\n depends_on.include?(other_task)\n end",
"def use(*specs)\n named = specs.flatten.inject({}) do |seen, spec|\n if Hash === spec && (spec.keys & ActsAsArtifact::ARTIFACT_ATTRIBUTES).empty?\n spec.each_pair do |name, spec|\n if ArtifactNamespace === spec # create as subnamespace\n raise ArgumentError.new(\"Circular reference\") if self == spec\n registry[name.to_sym] = spec\n elsif Numeric === spec || (String === spec && VersionRequirement.version?(spec))\n artifact = ArtifactRequirement.allocate\n artifact.name = name\n artifact.version = spec.to_s\n seen[artifact.name] ||= artifact\n elsif Symbol === spec\n self.alias name, spec\n elsif Array === spec # a group\n seen[name] ||= spec.map { |s| ArtifactRequirement.new(s) }\n else\n artifact = ArtifactRequirement.new(spec)\n artifact.name = name\n seen[artifact.name] ||= artifact\n end\n end\n else\n if Symbol === spec\n artifact = get(spec).dclone\n else\n artifact = ArtifactRequirement.new(spec)\n end\n seen[artifact.name] ||= artifact\n end\n seen\n end\n named.each_pair do |name, artifact|\n is_group = Array === artifact\n artifact = [artifact].flatten.map do |artifact|\n unvers = artifact.unversioned_spec\n previous = get(unvers, false) || get(name, false)\n if previous # have previous on current namespace\n if previous.requirement # we must satisfy the requirement\n if unvers\n satisfied = previous.satisfied_by?(artifact)\n else # we only have the version\n satisfied = previous.requirement.satisfied_by?(artifact.version)\n end\n raise \"Unsatisfied dependency #{previous} \" +\n \"not satisfied by #{artifact}\" unless satisfied\n previous.version = artifact.version # OK, set new version\n artifact = previous # use the same object for aliases\n else # not a requirement, set the new values\n unless artifact.id == previous.id && name != previous.name\n previous.copy_attrs(artifact)\n artifact = previous\n end\n end\n else\n if unvers.nil? && # we only have the version\n (previous = get(unvers, true, false, false))\n version = artifact.version\n artifact.copy_attrs(previous)\n artifact.version = version\n end\n artifact.requirement = nil\n end\n artifact.selected!\n end\n artifact = artifact.first unless is_group\n if is_group\n names = artifact.map do |art|\n unv = art.unversioned_spec\n registry[unv] = art\n unv\n end\n group(name, *(names + [{:namespace => self}]))\n elsif artifact.id\n unvers = artifact.unversioned_spec\n registry[name] = artifact\n registry.alias unvers, name\n else\n registry[name] = artifact\n end\n end\n self\n end",
"def require_version(name, current, required)\n print \"Checking for #{name} >= #{required}... \"\n\n if version_greater_than(current, required)\n puts 'yes'\n else\n abort 'no'\n end\n end",
"def satisfied?\n dependencies.none? { |_, v| v.empty? }\n end",
"def match?(obj, version=nil, allow_prerelease=false)\n if !version\n name = obj.name\n version = obj.version\n else\n name = obj\n end\n\n return false unless self.name === name\n\n version = Gem::Version.new version\n\n return true if requirement.none? and not version.prerelease?\n return false if version.prerelease? and\n not allow_prerelease and\n not prerelease?\n\n requirement.satisfied_by? version\n end",
"def restrictive_version_specified_gem?(node); end",
"def dependencies_satisfied?\n missing_dependencies.empty?\n end",
"def requirements_for_gem(gem_name)\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem_name == gem_name }\n end",
"def satisfy_all(constraints, versions)\n constraints = Array(constraints).collect do |con|\n con.is_a?(Gem::Requirement) ? con : Gem::Requirement.new(con.to_s)\n end.uniq\n\n versions = Array(versions).collect do |ver|\n ver.is_a?(Gem::Version) ? ver : Gem::Version.new(ver.to_s)\n end.uniq\n\n versions.select do |ver|\n constraints.all? { |constraint| constraint.satisfied_by?(ver) }\n end\n end",
"def test_bad_node_deps\n check_deps_fail \"notapackage\" => :node if which('node')\n end",
"def test_bad_node_deps\n check_deps_fail \"notapackage\" => :node if which('node')\n end",
"def version_specified_gem?(node); end",
"def SomePackagesAreRemainForInstallation\n # Either 'remaining' or 'srcremaining' are not empty\n size_remaining = @remaining == nil ? 0 : Builtins.size(@remaining)\n size_srcremaining = @srcremaining == nil ?\n 0 :\n Builtins.size(@srcremaining)\n\n Builtins.y2milestone(\n \"remaining: %1, srcremaining: %2\",\n size_remaining,\n size_srcremaining\n )\n Ops.greater_than(size_remaining, 0) ||\n Ops.greater_than(size_srcremaining, 0)\n end",
"def specific?\n @requirement.specific?\n end",
"def specific?\n @requirement.specific?\n end",
"def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end",
"def gem_version_more?(name, version)\n Gem.loaded_specs[name].version >= Gem::Version.new(version)\n end",
"def ensure_dependencies\n\t\tunless !self.date_of_booking.blank?\n\t\t\tself.errors[:date_of_booking] << \"=> Date of booking can't be empty\"\n\t\t\treturn false\n\t\tend\n\t\tunless ( self.company.resources.find_by_id(self.resource_id) )\n\t\t\tself.errors[:resource_not_present] << \"=> Requested resource is not available.\"\n\t\t\treturn false\n\t\tend\n\t\ttrue\n\tend",
"def has_rpm(package)\n @commands << \"rpm -qa | grep #{package}\"\n end",
"def gem_available?(gemname)\n\t# gem_available_new_rubygems?(gemname) or gem_available_old_rubygems?(gemname)\n\tif defined?(Gem::Specification) and defined?(Gem::Specification.find_by_name)\n\t\tgem_available_new_rubygems?(gemname)\n\telse\n\t\tgem_available_old_rubygems?(gemname)\n\tend\nend",
"def req *requirements\n return requirements.first if Gem::Requirement === requirements.first\n Gem::Requirement.create requirements\n end",
"def req *requirements\n return requirements.first if Gem::Requirement === requirements.first\n Gem::Requirement.create requirements\n end",
"def b_s_dependencies_are_met(s_bdmcomponent_name,\n ht_cycle_detection_opmem=Hash.new, fd_threshold=1.0)\n if KIBUVITS_b_DEBUG\n bn=binding()\n kibuvits_typecheck bn, String, s_bdmcomponent_name\n end # if\n b_dependencies_are_NOT_ready_for_use=false\n s_name_of_the_unmet_dependency=$kibuvits_lc_emptystring\n load_bdmroutine_classes_if_not_already_loaded\n load_bdmservice_detector_classes_if_not_already_loaded\n ht_objects=@ht_bdmcomponents\n s_ob_name=s_bdmcomponent_name\n if !ht_objects.has_key? s_ob_name\n kibuvits_throw(\"s_ob_name==\"+s_ob_name.to_s+\n \"\\nGUID='97f44121-6354-4630-b360-f2a0a0615dd7'\")\n end # if\n ob_bdmcomponent=ht_objects[s_ob_name]\n ht_dependency_relations=ob_bdmcomponent.ht_dependency_relations\n sym_b_ready_for_use=\"b_ready_for_use\".to_sym\n fd_availability, ht_selected_dependencies=Kibuvits_dependencymetrics_t1.fd_ht_get_availability(\n s_ob_name,ht_dependency_relations,ht_objects,sym_b_ready_for_use,\n ht_cycle_detection_opmem,fd_threshold)\n if 1<=fd_availability\n return b_dependencies_are_NOT_ready_for_use,s_name_of_the_unmet_dependency\n end # if\n b_dependencies_are_NOT_ready_for_use=true\n if ht_selected_dependencies.keys.length==0\n s_name_of_the_unmet_dependency=$kibuvits_lc_emptystring+s_ob_name\n return b_dependencies_are_NOT_ready_for_use,s_name_of_the_unmet_dependency\n end # if\n ht_selected_dependencies.each_pair do |s_key,s_value|\n if !ht_objects.has_key? s_value\n s_name_of_the_unmet_dependency=$kibuvits_lc_emptystring+s_value\n return b_dependencies_are_NOT_ready_for_use,s_name_of_the_unmet_dependency\n end # if\n end # loop\n ht_1=nil\n ht_selected_dependencies.each_pair do |s_key,s_value|\n ht_dependency_relations=ht_objects[s_value].ht_dependency_relations\n fd_availability,ht_1=Kibuvits_dependencymetrics_t1.fd_ht_get_availability(\n s_value,ht_dependency_relations,ht_objects,sym_b_ready_for_use)\n if fd_availability<1\n s_name_of_the_unmet_dependency=$kibuvits_lc_emptystring+s_value\n return b_dependencies_are_NOT_ready_for_use,s_name_of_the_unmet_dependency\n end # if\n end # loop\n kibuvits_throw(\"s_ob_name==\"+s_ob_name.to_s+\n \"\\nGUID='2668f5c1-53f6-4396-8260-f2a0a0615dd7'\")\n end",
"def depends_on?(node)\n dependency_list = []\n @dependencies.each do |d|\n dependency_list << d if node.run_list.include? d\n end\n [dependency_list.any?, dependency_list]\n end",
"def versions_matching(dep)\n remote_versions_for(dep.name).select { |v|\n dep.match? dep.name, v\n }\n end",
"def nodes_satisfying(dependency)\r\n @nodes.find_all { |n| n.satisfies?(dependency) }\r\n end",
"def check_dependencies\n ok = true\n\n @config.each_pair { |type, values|\n next if !values.instance_of?(Array)\n _shortclass, cfg_name, _cfg_plural, _classname = MU::Cloud.getResourceNames(type, false)\n next if !cfg_name\n values.each { |resource|\n next if !resource.kind_of?(Hash) or resource[\"dependencies\"].nil?\n addme = []\n deleteme = []\n\n resource[\"dependencies\"].each { |dependency|\n dependency[\"their_phase\"] ||= dependency[\"phase\"]\n dependency.delete(\"phase\")\n dependency[\"my_phase\"] ||= dependency[\"no_create_wait\"] ? \"groom\" : \"create\"\n dependency.delete(\"no_create_wait\")\n # make sure the thing we depend on really exists\n sibling = haveLitterMate?(dependency['name'], dependency['type'])\n if !sibling\n MU.log \"Missing dependency: #{type}{#{resource['name']}} needs #{cfg_name}{#{dependency['name']}}\", MU::ERR\n ok = false\n next\n end\n\n # Fudge dependency declarations to quash virtual_names that we know\n # are extraneous. Note that wee can't do all virtual names here; we\n # have no way to guess which of a collection of resources is the\n # real correct one.\n if sibling['virtual_name'] == dependency['name']\n real_resources = []\n found_exact = false\n resource[\"dependencies\"].each { |dep_again|\n if dep_again['type'] == dependency['type'] and sibling['name'] == dep_again['name']\n dependency['name'] = sibling['name']\n found_exact = true\n break\n end\n }\n if !found_exact\n all_siblings = haveLitterMate?(dependency['name'], dependency['type'], has_multiple: true)\n if all_siblings.size > 0\n all_siblings.each { |s|\n newguy = dependency.clone\n newguy['name'] = s['name']\n addme << newguy\n }\n deleteme << dependency\n MU.log \"Expanding dependency which maps to virtual resources to all matching real resources\", MU::NOTICE, details: { sibling['virtual_name'] => addme }\n next\n end\n end\n end\n\n if dependency['their_phase'] == \"groom\"\n sibling['dependencies'].each { |sib_dep|\n next if sib_dep['type'] != cfg_name or sib_dep['their_phase'] != \"groom\"\n cousin = haveLitterMate?(sib_dep['name'], sib_dep['type'])\n if cousin and cousin['name'] == resource['name']\n MU.log \"Circular dependency between #{type} #{resource['name']} <=> #{dependency['type']} #{dependency['name']}\", MU::ERR, details: [ resource['name'] => dependency, sibling['name'] => sib_dep ]\n ok = false\n end\n }\n end\n\n # Check for a circular relationship that will lead to a deadlock\n # when creating resource. This only goes one layer deep, and does\n # not consider groom-phase deadlocks.\n if dependency['their_phase'] == \"groom\" or\n dependency['my_phase'] == \"groom\" or (\n !MU::Cloud.resourceClass(sibling['cloud'], type).deps_wait_on_my_creation and\n !MU::Cloud.resourceClass(resource['cloud'], type).waits_on_parent_completion\n )\n next\n end\n\n if sibling['dependencies']\n sibling['dependencies'].each { |sib_dep|\n next if sib_dep['type'] != cfg_name or sib_dep['my_phase'] == \"groom\"\n cousin = haveLitterMate?(sib_dep['name'], sib_dep['type'])\n if cousin and cousin['name'] == resource['name']\n MU.log \"Circular dependency between #{type} #{resource['name']} <=> #{dependency['type']} #{dependency['name']}\", MU::ERR, details: [ resource['name'] => dependency, sibling['name'] => sib_dep ]\n ok = false\n end\n }\n end\n }\n resource[\"dependencies\"].reject! { |dep| deleteme.include?(dep) }\n resource[\"dependencies\"].concat(addme)\n resource[\"dependencies\"].uniq!\n\n }\n }\n\n ok\n end",
"def test_bad_rubinius_deps\n check_deps_fail \"notapackage\" => :rbx if which('rbx')\n end",
"def test_bad_rubinius_deps\n check_deps_fail \"notapackage\" => :rbx if which('rbx')\n end",
"def should_do_requirements_install\n if has_python_requirements\n if not install_date('pythonenv')\n # We've never done an install from requirements.txt before\n return true\n else\n return (requirements_edit_date > install_date('pythonenv'))\n end\n else\n return false\n end\n end",
"def test_standard_to_rubygems_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.4'), :>, ::Versionomy.parse('1.2.3', :rubygems))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.beta.3', :rubygems))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2', :rubygems))\n end",
"def version_available?(package_name, desired_version, arch = nil)\n version(package_name, arch, true, false) do |v|\n return true if desired_version == v\n end\n\n false\n end",
"def prerelease?\n @prerelease || requirement.prerelease?\n end",
"def is_rpm?\n return !!@name.match(/^(aix|cisco-wrlinux|el|eos|fedora|sles|redhat|redhatfips)-.*$/)\n end",
"def satisfies?(target)\n target = Version.coerce(target)\n\n return false if !version.zero? && greedy_match?(target)\n\n compare(target)\n end",
"def requires(*args)\n normalize_list(args).each do |dependency|\n @available.add_required(dependency)\n end\n end",
"def from_dependency?\n source_options && version_dependency\n end",
"def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end"
] |
[
"0.7186977",
"0.70694053",
"0.6906571",
"0.68474925",
"0.6784584",
"0.667682",
"0.6645595",
"0.6627601",
"0.66122615",
"0.6579966",
"0.643627",
"0.6425606",
"0.6317606",
"0.6298653",
"0.6295924",
"0.6294732",
"0.6243786",
"0.61787283",
"0.61519796",
"0.61489576",
"0.6130937",
"0.61087555",
"0.60960877",
"0.60956645",
"0.60839814",
"0.6080126",
"0.6073984",
"0.60725087",
"0.60672235",
"0.6065257",
"0.6056417",
"0.6046287",
"0.6022027",
"0.60135347",
"0.5989671",
"0.5989671",
"0.5959626",
"0.5959487",
"0.59520614",
"0.5932555",
"0.5922015",
"0.5887206",
"0.58822244",
"0.58597517",
"0.5855178",
"0.58338886",
"0.5831258",
"0.5816265",
"0.57859564",
"0.5784678",
"0.5780369",
"0.5746651",
"0.57341766",
"0.572709",
"0.5726067",
"0.57149565",
"0.5710396",
"0.5710396",
"0.5700356",
"0.5676099",
"0.5672988",
"0.5657081",
"0.5655753",
"0.5629785",
"0.5627076",
"0.5625018",
"0.56229156",
"0.56144774",
"0.5580859",
"0.55682606",
"0.55529875",
"0.55529267",
"0.55529267",
"0.55486214",
"0.554427",
"0.5538879",
"0.5538879",
"0.553728",
"0.553075",
"0.55300146",
"0.5501101",
"0.5500952",
"0.5499194",
"0.5498243",
"0.54885775",
"0.54863065",
"0.54801285",
"0.5470355",
"0.54636383",
"0.54624164",
"0.54624164",
"0.54531157",
"0.5437323",
"0.5430418",
"0.54204726",
"0.54175997",
"0.54157466",
"0.54156756",
"0.5407649",
"0.5407446"
] |
0.7707219
|
0
|
Lookup package_name and return a descending array of package objects
|
def lookup(package_name)
pkgs = @rpms[package_name]
if pkgs
pkgs.sort.reverse
else
nil
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_package_by_name(name)\n @packages[name]\n end",
"def search_for_description pkgname, packages = []\n cache_key = \"description_package_#{pkgname.downcase}\"\n description_package = Rails.cache.fetch(cache_key, :expires_in => 12.hours) do\n if packages.blank?\n packages = Seeker.prepare_result(\"\\\"#{pkgname}\\\"\", nil, nil, nil, nil)\n packages = packages.reject {|p| p.first.type == 'ymp'}\n end\n packages.select {|p| p.name == pkgname}.each do |package|\n description_package = nil\n unless package.description.blank?\n description_package = package\n logger.info \"Found package info for #{pkgname} in: #{package.project}\"\n break\n end\n logger.error \"No package info for #{pkgname} in: #{package.project}\"\n end\n description_package\n end\n end",
"def find_package_set(name)\n each_package_set.find { |set| set.name == name }\n end",
"def find_package_set_by_name(name)\n @package_sets[name]\n end",
"def [](packagename)\n\t\t\t\treturn(packages()[packagename])\n\t\t\tend",
"def package_from_name(package_name)\n return self if package_name == self.name\n local_deps.find { |pkg| pkg.name == package_name }\n end",
"def search_packages(pattern)\n packages = RailsPwnerer::Base.all_packages\n Hash[packages.select { |key, value|\n pattern.kind_of?(Regexp) ? (pattern =~ key) : key.index(pattern)\n }.map { |key, value|\n # apt-cache search sometimes leaves version numbers out\n # Update the cache with version numbers.\n if value.nil?\n info = RailsPwnerer::Base.package_info_hash(\n Kernel.`(\"apt-cache show #{key}\"))\n packages[key] = value = info['Version']\n end\n [key, value]\n }]\n end",
"def packages\n ::Packages::Package.all\n end",
"def find_package_definition(name)\n packages[validate_package_name_argument(name, require_existing: false)]\n end",
"def packages()\n\t\t\t\tpackages = installed_packages()\n\n\t\t\t\tpackagelist = `#{@finkbin} list -n`\n\n\t\t\t\tpackagelist.each_line() { |line|\n\t\t\t\t\tlinearr = line.split()\n\t\t\t\t\tpackages[linearr[0]] = PackageInfo.new()\n\t\t\t\t\tpackages[linearr[0]].name = linearr[0]\n\t\t\t\t\tpackages[linearr[0]].version = linearr[1]\n\t\t\t\t\tpackages[linearr[0]].description = linearr[2]\n\t\t\t\t}\n\n\t\t\t\treturn(packages)\n\t\t\tend",
"def [](name)\n packages[name]\n end",
"def packages\n @packages ||= []\n end",
"def packages\n @packages ||= []\n end",
"def all_package_names\n each_autobuild_package.map(&:name)\n end",
"def main_package_set\n each_package_set.find(&:main?)\n end",
"def listpackages\n packages = []\n\n @repository.categories.each do |category|\n Architecture.dataset(category).each do |entry|\n source = Architecture.new(entry[:architecture], entry[:component], entry[:suitename], category)\n source.files.each do |fullname|\n package = Package.new(fullname, entry[:suitename], entry[:component])\n packages << {\n :fullname => fullname,\n :category => category,\n :basename => File.basename(fullname),\n :controlfile => package.controlfile,\n :component => entry[:component],\n :suitename => entry[:suitename],\n :architecture => entry[:architecture]\n }\n end\n end\n if category.eql? \"stage\"\n Component.dataset(category).each do |entry|\n source = Component.new(entry[:component], entry[:suitename], category)\n source.files.each do |fullname|\n package = Package.new(fullname, entry[:suitename], entry[:component])\n packages << {\n :fullname => fullname,\n :category => category,\n :basename => File.basename(fullname),\n :controlfile => package.controlfile,\n :component => entry[:component],\n :suitename => entry[:suitename],\n :architecture => \"unknown\"\n }\n end\n end\n end\n end\n packages\n end",
"def query_package(pkg_name)\n @logger.info(\"Querying for #{pkg_name}\")\n @index[:packages].key?(pkg_name)\n end",
"def find_packages\n declared_packages.collect do |package|\n guess = ::Albacore::PackageRepo.new(%w|./packages ./src/packages|).find_latest package.id\n debug \"#{name}: guess: #{guess} [albacore: project]\"\n guess\n end\n end",
"def find_packages(name, constraint = nil)\n # implement inside child\n end",
"def packages\n Dir[File.join($__HELLO_DIR__, 'packages/*/*.yml')]\n .map do |yml|\n info = YAML.load File.read yml\n info['dir'] = File.dirname yml if info\n info\n end\n .select {|p| p }\n .sort_by {|p| p['priority'] || 10 }\nend",
"def each_package(&block)\n packages_by_name.each_value(&block)\n end",
"def list_packages\n res = []\n out = Aptly::runcmd \"aptly mirror show -with-packages #{@name.quote}\"\n Aptly::parse_indented_list out.lines\n end",
"def package_info(package_name)\n # return the package hash if it's in the brew info hash\n return brew_info[package_name] if brew_info[package_name]\n\n # check each item in the hash to see if we were passed an alias\n brew_info.each_value do |p|\n return p if p[\"full_name\"] == package_name || p[\"aliases\"].include?(package_name)\n end\n\n {}\n end",
"def packages\n FileList[package_path('.*')]\n end",
"def differentiate(packages)\n named_groups = Hash.new{|h,k| h[k] = []}\n packages.each{|p| named_groups[p.name] << p }\n named_groups.each do |name, packages| \n if packages.length > 1\n packages.each{|p| p.name = \"#{p.name} (#{p.paths.first})\"} \n end\n end\n end",
"def package_names_for_targets\n package_names_for_targets = []\n target_version_array.each_with_index do |target_version, i|\n if !target_version.nil?\n package_name = package_name_array[i]\n package_names_for_targets.push(package_name)\n else\n package_names_for_targets.push(nil) if allow_nils?\n end\n end\n multipackage? ? package_names_for_targets : package_names_for_targets[0]\n end",
"def packages()\n\t\t\t\treturn(PackageList.new())\n\t\t\tend",
"def best_package_matching(patterns)\n patterns = [patterns] unless patterns.kind_of?(Enumerable)\n patterns.each do |pattern|\n packages = search_packages(pattern)\n next if packages.empty? \n best = packages.sort_by { |key, value|\n [\n pattern.kind_of?(Regexp) ? ((key.index(pattern) == 0) ? 1 : 0) :\n ((key == pattern) ? 1 : 0),\n value.split(/[.-]/)\n ]\n }.last \n return { :name => best.first, :version => best.last }\n end\n nil\n end",
"def scan(name)\n raise NotImplementedError, \"Repositories must return an Array of matching packages.\"\n end",
"def relevant_packages\n packages.select { |p| p['version'] == version }\n end",
"def get_packages(adb_opts = {})\n packages = []\n run_adb_shell(\"pm list packages -f\", adb_opts) do |pout|\n pout.each do |line|\n @log.debug(\"{stdout} #{line}\") unless @log.nil?\n parts = line.split(\":\")\n if (parts.length > 1)\n info = parts[1].strip.split(\"=\")\n package = AndroidAdb::Package.new(info[1], info[0]);\n packages << package;\n end\n end\n end\n return packages\n end",
"def package_by_name(package_name)\n raise RuntimeError, \"#{self.class} needs to overwrite package_by_name\"\n end",
"def existing_packages\n paths_by_app = Dir[File.join(config[:packages_dir], '*', '*.{tar.gz,json}')].group_by { |path|\n path.split(File::SEPARATOR)[-2]\n }\n\n Hash[\n paths_by_app.map { |app, paths|\n names_by_base = paths.group_by do |path|\n File.basename(path).sub(/\\.(?:tar\\.gz|json)\\z/, '')\n end\n\n packages = names_by_base.flat_map { |base, names|\n names.map do |name|\n (\n name.end_with?(\".tar.gz\") &&\n names.find { |_| _.end_with?(\".json\") } &&\n base\n ) || nil\n end\n }.compact\n\n [app, packages.sort]\n }\n ]\n end",
"def installed_packages()\n\t\t\t\tinstalledpackagelist = `#{@finkbin} list -i`\n\n\t\t\t\tinstalledpackages = PackageList.new()\n\t\t\t\tinstalledpackagelist.each_line() { |line|\n\t\t\t\t\tlinearr = line.split()\n\t\t\t\t\tinstalledpackages[linearr[1]] = PackageInfo.new()\n\t\t\t\t\tinstalledpackages[linearr[1]].name = linearr[1]\n\t\t\t\t\tinstalledpackages[linearr[1]].version = linearr[2]\n\t\t\t\t\tinstalledpackages[linearr[1]].description = linearr[3]\n\t\t\t\t\tinstalledpackages[linearr[1]].installed = true\n\t\t\t\t}\n\n\t\t\t\treturn(installedpackages)\n\t\t\tend",
"def packages\n Autoproj.warn_deprecated \"use #each_package instead\"\n each_package.to_a\n end",
"def infer_package(names)\n # Package is longest common prefix ending in '.', if any.\n if not names.empty?\n min, max = names.minmax\n last_common_dot = nil\n min.size.times { |i|\n if min[i] != max[i] then break end\n if min[i] == \".\" then last_common_dot = i end\n }\n if last_common_dot\n return min.slice(0, last_common_dot)\n end\n end\n\n nil\n end",
"def installed_packages()\n\t\t\t\tpackages = PackageList.new()\n\t\t\t\tpackageregex = /^([^ ]+)-([^- ]+)\\s+(.*)$/\n\n\t\t\t\tinstalledpackageslist = `/usr/sbin/pkg_info`\n\t\t\t\tinstalledpackageslist.each_line() { |line|\n\t\t\t\t\tline.strip!()\n\t\t\t\t\tmatch = packageregex.match(line)\n\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\tname = match[1]\n\t\t\t\t\t\tversion = match[2]\n\t\t\t\t\t\tdescription = match[3]\n\n\t\t\t\t\t\tpackages[name] = PackageInfo.new()\n\t\t\t\t\t\tpackages[name].name = name\n\t\t\t\t\t\tpackages[name].version = version\n\t\t\t\t\t\tpackages[name].description = description\n\t\t\t\t\tend\n\t\t\t\t}\n\n\t\t\t\treturn(packages)\n\t\t\tend",
"def packages\n packages = []\n @repositories.each do |repo|\n repo_packages = repo.packages\n repo_packages.map { |p| packages.push(p) } unless repo_packages.empty?\n end\n packages\n end",
"def split_name_package(fullname)\n fixing = fullname.gsub(/:/, \".\")\n split = fixing.match(/^(?:((?:\\w+\\.?)*)\\.)?(\\w+)$/) || []\n name = split[2] || \"\"\n package = split[1] || \"\"\n # downcase the first letter of each package name\n package = package.split(\".\").map {|s| s[0].downcase+s[1..-1]}.join(\".\")\n [name, package]\n end",
"def each_package\n package_name_array.each_with_index do |package_name, i|\n candidate_version = candidate_version_array[i]\n current_version = current_version_array[i]\n magic_version = use_magic_version? ? magic_version_array[i] : current_version_array[i]\n new_version = new_version_array[i]\n yield package_name, new_version, current_version, candidate_version, magic_version\n end\n end",
"def query\n self.class.newstylepkgoutput\n begin\n output = pkg(:list, \"-H\", @resource[:name])\n rescue Puppet::ExecutionFailure\n # pkg returns 1 if the package is not found.\n return {:ensure => :absent, :name => @resource[:name]}\n end\n\n hash = self.class.parse_line(output.chomp) || {:ensure => :absent, :name => @resource[:name]}\n hash\n end",
"def GetPackages\n ProbeKernel() if !@kernel_probed\n deep_copy(@kernel_packages)\n end",
"def packages; end",
"def whereis(package_name)\n package_name = validate_package_name_argument(package_name)\n\n matches = [package_name]\n if (source_package = find_package_definition(package_name))\n each_metapackage do |meta|\n matches << meta.name if meta.include?(source_package)\n end\n end\n\n matches.each do |name|\n if (place = normalized_layout[name])\n return place\n end\n end\n \"/\"\n end",
"def installed_packages()\n\t\t\t\treturn(PackageList.new())\n\t\t\tend",
"def package_list(packages, version)\n Array(packages[:base]).join(' ') + ' ' + Array(packages[version]).join(' ')\n end",
"def install_order(arr)\n pairs = {}\n queue = []\n sorted = [] \n arr.each do |pair|\n pairs[pair[0]] = pair[1]\n end \n packages = (1..pairs.keys.max).to_a\n packages.each do |package|\n if !pairs.keys.include?(package)\n queue.push(package)\n end \n end \n\n until queue.empty?\n package = queue.shift \n sorted.push(package)\n neighbors = []\n\n pairs.each do |key, value|\n if value == package\n neighbors.push(key)\n pairs.delete(key)\n end \n end\n neighbors.each do |package|\n if !pairs.keys.include?(package)\n queue.push(package)\n end \n end \n end \n\n if packages.length == sorted.length \n return sorted\n else \n return []\n end \nend",
"def packages\n @packages ||= begin\n publish_packages = []\n build_packages = FileSyncer.glob(@pattern).map { |path| Package.new(path) }\n\n if @options[:platform_mappings]\n # the platform map is a simple hash with publish to build platform mappings\n @options[:platform_mappings].each_pair do |build_platform, publish_platforms|\n # Splits `ubuntu-12.04-x86_64` into `ubuntu`, `12.04` and `x86_64`\n build_platform, build_platform_version, build_architecture = build_platform.split(\"-\")\n\n # locate the package for the build platform\n packages = build_packages.select do |p|\n p.metadata[:platform] == build_platform &&\n p.metadata[:platform_version] == build_platform_version &&\n p.metadata[:arch] == build_architecture\n end\n\n if packages.empty?\n log.warn(log_key) do\n \"Could not locate a package for build platform #{build_platform}-#{build_platform_version}-#{build_architecture}. \" \\\n \"Publishing will be skipped for: #{publish_platforms.join(\", \")}\"\n end\n end\n\n publish_platforms.each do |publish_platform|\n publish_platform, publish_platform_version, publish_architecture = publish_platform.split(\"-\")\n\n packages.each do |p|\n # create a copy of our package before mucking with its metadata\n publish_package = p.dup\n publish_metadata = p.metadata.dup.to_hash\n\n # override the platform, platform version and architecture in the metadata\n publish_metadata[:platform] = publish_platform\n publish_metadata[:platform_version] = publish_platform_version\n publish_metadata[:arch] = publish_architecture\n\n # Set the updated metadata on the package object\n publish_package.metadata = Metadata.new(publish_package, publish_metadata)\n\n publish_packages << publish_package\n end\n end\n end\n else\n publish_packages.concat(build_packages)\n end\n\n if publish_packages.empty?\n log.info(log_key) { \"No packages found, skipping publish\" }\n end\n\n publish_packages\n end\n end",
"def install_order(arr)\n result = []\n\n hash_pkg = Hash.new {|k,v| v = []}\n\n arr.each do |tup|\n hash_pkg[tup[0]] += [tup[1]]\n end\n\n (1..hash_pkg.keys.max).each do |pkg|\n result << pkg unless hash_pkg.keys.include?(pkg)\n end\n\n\n until hash_pkg.empty?\n hash_pkg.each do |pkg, dep|\n if dep.all? {|d| result.include?(d)}\n result << pkg\n hash_pkg.delete(pkg)\n end\n end\n end\n\n result\nend",
"def query\n r = exec_cmd(command(:pkg), 'list', '-Hv', @resource[:name])\n return {:ensure => :absent, :name => @resource[:name]} if r[:exit] != 0\n self.class.parse_line(r[:out])\n end",
"def package_list(packages, version)\n packages[:base].to_a.join(' ') + ' ' + packages[version].to_a.join(' ')\n end",
"def packages\n manifest.each_with_object({}) do |(src, package_name), hsh|\n next if src.nil? || src.empty?\n hsh[package_name] ||= []\n hsh[package_name] << File.join(Licensed::Git.repository_root, src)\n end\n end",
"def packages\n return @packages if @packages\n\n @packages = resolve_packages.map do |pkg|\n next if ignored?(pkg)\n\n package_set = pkg.kind_of? Autoproj::InstallationManifest::PackageSet\n pkg = pkg.to_h\n local_dir = if package_set\n pkg[:raw_local_dir]\n else\n pkg[:importdir] || pkg[:srcdir]\n end\n\n Autoproj::Daemon::PackageRepository.new(\n pkg[:name] || pkg[:package_set],\n pkg[:vcs],\n package_set: package_set,\n local_dir: local_dir,\n ws: ws\n )\n end.compact\n @packages\n end",
"def package_manifest()\n res = []\n @items.each do |item|\n sources = item[:sources]\n sources = [ sources ] unless sources.kind_of?(Array)\n sources.each do |src|\n # TODO - want to split into multiple packages\n #if pkg == :main\n # next unless item[:dest] =~ /(LIB|BIN)DIR/\n #elsif pkg == :devel\n # next unless item[:dest] =~ /(INCLUDE|MAN)DIR/\n #else\n # throw \"bad pkg type\"\n #end\n dst = expand_dir(item[:dest])\n if item[:rename].nil?\n dst += '/' + src\n else\n dst += '/' + item[:rename]\n end\n dst.gsub!(/^\\/usr\\/local\\//, '/usr/') # KLUDGE: only true when making an RPM or DEB\n res.push dst\n end\n end\n res.join \"\\n\"\n end",
"def getdeps(pkg)\n deps = []\n @pkg.each {|k, v| deps << k if v.include?(pkg) }\n\n return deps\n end",
"def resolve_packages\n installation_manifest =\n Autoproj::InstallationManifest.from_workspace_root(ws.root_dir)\n installation_manifest.each_package.to_a +\n installation_manifest.each_package_set.to_a\n end",
"def get_all_uses_cases_from_packages(packages)\n package_usecases = Hash.new\n packages.each do |package|\n use_cases = get_use_cases_from_package(package)\n package_usecases[package] = use_cases\n end\n array = []\n package_usecases.each_value{|value| value.each do |v| array << v end} \n return array\n end",
"def load_packages\n packages = []\n return packages unless File.readable?(PACKAGES)\n File.open(PACKAGES, 'r') do |f|\n f.each_line do |line|\n next unless line =~ /\\S/\n line.chomp!\n packages.push(line)\n end\n end\n\n packages\n end",
"def find(name)\n # look into each gempath for a matching file, sort by version (roughly), \n # and return the last hit\n gem_paths.\n map { |gem_path| Dir.glob(\"#{gem_path}/gems/#{name}-[0-9]*\") }.\n flatten.\n sort_by { |gem_path| gem_path.gsub(/.*\\/gems\\/[^-]+-/, \"\") }.\n last\n end",
"def index\n @package_items = @package.package_items\n end",
"def metapackage(name, *packages)\n Autoproj.workspace.manifest.metapackage(name, *packages)\nend",
"def package(name)\n Packaged.instance self , name\n end",
"def package\n return @children['package'][:value]\n end",
"def resolve( name, version )\n # It is possible, and almost inevitable, that we can install two packages that must oscilate\n # at the same time. As a result, we will be relinking a package that has not been installed yet,\n # but will be on the next commit. In this situation, we need keep a cache of packages mapped in\n # this session, so that when this occurs, we can resolve it with no problems. In this way, we\n # maintain an instance variable hash that is added to whenever map() is called\n cached = @pkg_cache[ \"%s-%s\" % [ name, version ] ]\n if( cached != nil )\n return cached\n end\n\n # Past this, we do not want to proceed if the package is not present in the install\n # dir\n\n # We ensure that this package is in fact installed\n if( !File.directory?( Config.instance.install_dir + \"/\" + name + \"/\" + version ) )\n puts \"%s-%s is not installed!\" % [ name, version ]\n return nil\n end\n\n # If the cache file exists and is in fact a file, slurp it up and use that\n # I'd love to do some digest check here to:\n # 1. Ensure that the cache file is intact and valid\n # 2. The directory installed matches the one that this cache file was generated from\n\n # First, we check the cache to see if we've resolved this package before\n # Figure out where the cache file would be if it existed\n cache_file = Config.instance.cache_dir + \"/\" + name + \"-\" + version + \".json\"\n if( File.file?( cache_file ) )\n file = File.new( cache_file, \"r\" )\n buff = \"\"\n while (line = file.gets)\n buff += line\n end\n file.close( )\n pkg = JSON.parse( buff )\n return pkg\n end\n\n # If we haven't, we'll need to do a full trace of the package\n\n # It may be better to store all of our package file in\n # $(install_dir)/$(name)/$(version)/pkg_files\n # and store the manifest next to pkg_files\n # Therefore, when we need to do this, we can just consult the manifest for\n # data such as dependencies\n pkg = map( Config.instance.install_dir + \"/\" + name + \"/\" + version )\n file = File.new( cache_file, \"w\" )\n\n # Write metadata\n file.write( pkg.to_json( ) )\n\n file.close( )\n\n return pkg\n end",
"def advisories_by_package(search_package = '', search_servers = [],\n search_provider = '')\n report = {}\n Package.find_each do |package|\n next unless search_package == '' || /#{search_package}/ =~ package.name\n next unless search_provider == '' || search_provider == package.provider\n next if package.servers.count == 0\n next if package.advisories.count == 0\n\n # Get the servers that this package/version/etc applies to.\n servers = []\n package.servers.each do |server|\n next unless search_servers.empty? || search_servers.include?(server.hostname)\n next unless server.last_checkin\n next unless server.last_checkin > LAST_CHECKIN\n servers << server.hostname\n end\n next unless servers.count > 0\n\n name = package.name\n version = package.version\n arch = package.arch\n provider = package.provider\n\n report[name] = {} unless report.key?(name)\n report[name][version] = {} unless report[name].key?(version)\n report[name][version][arch] = {} unless report[name][version].key?(arch)\n report[name][version][arch][provider] = {} \\\n unless report[name][version][arch].key?(name)\n\n advisories = package.advisories.count\n report[name][version][arch][provider]['advisories'] = advisories\n report[name][version][arch][provider]['servers'] = servers\n end\n\n report\n end",
"def find_package(word)\n\t\n\tTextMate.exit_show_tool_tip(\"Please select a class to\\nlocate the package path for.\") if word.empty?\n\t\n\t$package_paths = []\n\t$best_paths = []\n\t\n\tsearch_all_paths(word)\n\t\n\tif $package_paths.size > 0 and $best_paths.size > 0\n\t\t$package_paths = $best_paths + ['-'] + $package_paths\n\telse\n\t\t$package_paths = $best_paths + $package_paths\n\tend\n\n\tTextMate.exit_show_tool_tip \"Class not found\" if $package_paths.empty?\n\n\tif $package_paths.size == 1\n\n\t\t$package_paths.pop\n\t\n\telse\n\t\t\n\t\t# Move any exact hits to the top of the list.\n\t\t$best_paths = $package_paths.grep( /\\.#{word}$/ )\n\t\t\n\t\ti = TextMate::UI.menu($package_paths)\n\t\tTextMate.exit_discard() if i == nil\n\t\t$package_paths[i]\n\n\tend\n\nend",
"def package(name)\n if name.respond_to? :cache_path\n name\n elsif @versions[name]\n Package.for(@sources[name], @versions[name], @files[name])\n end\n end",
"def find_module(name, version)\n e = []\n\n @envs.each do |k, v|\n next unless v.keys.include?(name) && v[name] == version\n e << k\n end\n\n e\n end",
"def packages\n %w(dtach rtorrent)\nend",
"def read_pkglist(filename)\n\tpkg_list = Array.new\n\tf = File.new(filename)\n\tbegin\n\t\twhile (line = f.readline)\n\t\t\t# line.chomp\n\t\t\t# $stdout.print line if line =~ /blue/\n\t\t\trawline = line.strip\n\t\t\tunless rawline == \"\"\n\t\t\t\trawtoks = rawline.split\n\t\t\t\tpkg_list.push(rawtoks[0]) unless rawtoks[0] =~ /^#/\n\t\t\tend\n\t\tend\n\trescue EOFError\n\t\tf.close\n\tend\n\treturn pkg_list\nend",
"def packages\n @root.xpath('./ns:Shipment/ns:Package').map do |package|\n Package.new(package)\n end\n end",
"def find_module(name, version)\n e = []\n\n @envs.each do |k, v|\n next unless v.keys.include?(name) && v[name] == version\n e << k\n end\n\n e\n end",
"def instances\n packages = []\n\n begin\n execpipe(listcmd) do |process|\n fields = [:name, :ensure]\n\n # yaourt -Q returns a list of packages in the format of\n # repo/package version (group)\n regex = /^\\w+\\/(\\S+)\\s+(\\S+)/\n\n process.each_line do |line|\n hash = {}\n\n if match = line.match(regex)\n fields.zip(match.captures) do |field, value|\n hash[field] = value\n end\n\n hash[:provider] = self.name\n packages << new(hash)\n else\n warning('Failed to match line %s' % line)\n end\n end\n end\n rescue Puppet::ExecutionFailure\n return nil\n end\n\n return packages\n end",
"def search(name)\n universe\n .select { |cookbook| cookbook.name =~ Regexp.new(name) }\n .group_by(&:name)\n .collect { |name, versions| versions.max_by { |v| Semverse::Version.new(v.version) } }\n end",
"def packages\n @packages ||= client.list_packages('duo-openvpn').response\n end",
"def guess_package_name(gem_name, args)\n package_name = nil\n package_name ||= guess_package_name_from_args(gem_name, args)\n package_name ||= guess_package_name_from_environment\n package_name ||= guess_package_name_from_appfile\n package_name ||= guess_package_name_from_config_files\n package_name\n end",
"def query\n begin\n output = pkg(:list, \"-H\", @resource[:name])\n rescue Puppet::ExecutionFailure\n # pkg returns 1 if the package is not found.\n return {:ensure => :absent, :name => @resource[:name]}\n end\n\n hash = self.class.parse_line(output.chomp) || {:ensure => :absent, :name => @resource[:name]}\n hash\n end",
"def haspackage? pkgname\n\t\tif @cf.packagelist\n\t\t\treturn @cf.packagelist[pkgname]\n\t\tend\n\t\t# ---- check for direct name of binary using the path\n\t\t`which #{pkgname}` =~ /#{pkgname}/\n\tend",
"def packages\n return @package_manager if @package_manager\n\n @package_manager = Rosh::PackageManager.new(@name)\n @package_manager.add_observer(self)\n\n @package_manager\n end",
"def resolved_source_array\n @resolved_source_array ||=\n source_array.each_with_index.map do |source, i|\n package_name = package_name_array[i]\n # we require at least one '/' in the package_name to avoid [XXX_]package 'foo' breaking due to a random 'foo' file in cwd\n if use_package_name_for_source? && source.nil? && package_name.match(/#{::File::SEPARATOR}/) && ::File.exist?(package_name)\n logger.trace(\"No package source specified, but #{package_name} exists on filesystem, using #{package_name} as source.\")\n package_name\n else\n source\n end\n end\n end",
"def search(name)\n universe\n .select { |cookbook| cookbook.name =~ Regexp.new(name) }\n .group_by(&:name)\n .collect { |_, versions| versions.max_by { |v| Semverse::Version.new(v.version) } }\n end",
"def package_get(ref)\n raise ArgumentError.new(ref.inspect) unless ref.package_id\n\n package_table.get(ref)\n end",
"def find_autobuild_package(name)\n find_package_definition(name)&.autobuild\n end",
"def package_name\n # TODO: verify renamed packages\n resource['title']\n end",
"def versions name # :nodoc:\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end",
"def locate_package(package_name, vers, verbose)\n local = has_local_package?(package_name)\n \n # It's true that we don't have a prerelase check here, but the\n # previous one we had didn't do anything, so it's better to have\n # none than one that doesn't work\n vers = \">= 0\" if vers == \">= 0-pre\"\n src_path = local ? locate_local_package(package_name) : \n BPM::Local.new.source_root(package_name, vers)\n\n return nil unless src_path\n\n pkg = BPM::Package.new(src_path)\n pkg.load_json # throws exception if json invalid\n pkg\n end",
"def versions name\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end",
"def packages(order)\n units = Spree::ActiveShipping::Config[:units].to_sym\n packages = []\n weights = convert_order_to_weights_array(order)\n max_weight = get_max_weight(order)\n item_specific_packages = convert_order_to_item_packages_array(order)\n\n if max_weight <= 0\n packages << Package.new(weights.sum, [], :units => units)\n else\n package_weight = 0\n weights.each do |li_weight|\n if package_weight + li_weight <= max_weight\n package_weight += li_weight\n else\n packages << Package.new(package_weight, [], :units => units)\n package_weight = li_weight\n end\n end\n packages << Package.new(package_weight, [], :units => units) if package_weight > 0\n end\n\n item_specific_packages.each do |package|\n packages << Package.new(package.at(0), [package.at(1), package.at(2), package.at(3)], :units => :imperial)\n end\n\n packages\n end",
"def dependencies(pkg)\n pkg.resolve_optional_dependencies\n deps_rock_packages = pkg.dependencies.map do |pkg_name|\n debian_name(Autoproj.manifest.package(pkg_name).autobuild)\n end.sort\n\n pkg_osdeps = Autoproj.osdeps.resolve_os_dependencies(pkg.os_packages)\n # There are limitations regarding handling packages with native dependencies\n #\n # Currently gems need to converted into debs using gem2deb\n # These deps dependencies are updated here before uploading a package\n # \n # Generation of the debian packages from the gems can be done in postprocessing step\n # i.e. see convert_gems\n \n deps_osdeps_packages = []\n native_package_manager = Autoproj.osdeps.os_package_handler\n _, native_pkg_list = pkg_osdeps.find { |handler, _| handler == native_package_manager }\n\n deps_osdeps_packages += native_pkg_list if native_pkg_list\n\n # Update global list\n @osdeps += deps_osdeps_packages\n\n non_native_handlers = pkg_osdeps.collect do |handler, pkg_list|\n if handler != native_package_manager\n [handler, pkg_list]\n end\n end.compact\n\n non_native_handlers.each do |pkg_handler, pkg_list|\n # Convert native ruby gems package names to rock-xxx \n if pkg_handler.kind_of?(Autoproj::PackageManagers::GemManager)\n pkg_list.each do |name,version|\n @ruby_gems << [name,version]\n deps_osdeps_packages << debian_ruby_name(name)\n end\n else\n raise ArgumentError, \"cannot package #{pkg.name} as it has non-native dependencies (#{pkg_list}) -- #{pkg_handler.class} #{pkg_handler}\"\n end\n end\n\n # Remove duplicates\n @osdeps.uniq!\n @ruby_gems.uniq!\n\n # Return rock packages and osdeps\n [deps_rock_packages, deps_osdeps_packages]\n end",
"def extract_raw_packages_from_json(json)\n if json[:PackageSearchResultList] && json[:PackageSearchResultList][:PackageSearchResult]\n json[:PackageSearchResultList][:PackageSearchResult]\n else\n []\n end\n end",
"def filter_yarn_internal_package(all_packages)\n internal_package_pattern = /workspace-aggregator-[a-zA-z0-9]{8}-[a-zA-z0-9]{4}-[a-zA-z0-9]{4}-[a-zA-z0-9]{4}-[a-zA-z0-9]{12}/\n yarn_internal_package = all_packages.find { |package| internal_package_pattern.match(package['Name']) }\n all_packages - [yarn_internal_package]\n end",
"def extract_upgraded_packages(output)\n new_packages = []\n\n output.each_line do |line|\n next if line.match(/The following packages will be upgraded:/)\n break if line.match(/\\d+ upgraded, \\d+ newly installed/)\n\n line.split.each do |pkg|\n puts \"pkg #{pkg}\"\n new_packages << PackageManager::Package.new(pkg, @host_name)\n end\n end\n\n new_packages\n end",
"def walk_down_dependencies(pkg_name, known_deps=Array.new)\n\talldeps = Array.new\n\t@total_deps[pkg_name].each { |m|\n\t\tunless alldeps.include?(m) || m.nil? || known_deps.include?(m) \n\t\t\talldeps = alldeps + walk_down_dependencies(m, alldeps)\n\t\tend\n\t\talldeps.push m\n\t}\n\talldeps.uniq!\n\talldeps.push pkg_name\n\t# puts alldeps.join(\", \") \n\treturn alldeps.compact \nend",
"def map( pkg_path )\n # This is the package we will return\n p = nil\n\n # This will give us a list of all the files the package will install\n pkg_files = traverse( pkg_path + \"/pkg_files\", \"\" )\n\n # We then read the manifest for other data that we need\n mf = pkg_path + \"/MANIFEST.json\"\n\n if( File.file?( mf ) )\n file = File.new( mf, \"r\" )\n buff = \"\"\n while (line = file.gets)\n buff += line\n end\n file.close( )\n meta = JSON.parse( buff )\n p = Package.new( meta[ \"name\" ], meta[ \"version\" ], pkg_files, meta[ \"depends\" ] )\n end\n puts \"PkgCrawler: placing %s-%s in cache\" % [ p.name, p.version ]\n name = \"%s-%s\" % [ p.name, p.version ]\n @pkg_cache[ name ] = p\n return p\n end",
"def package_data\n dpkg_query = 'dpkg-query -W -f=\\'\"${Package}\": {' \\\n '\"version\": \"${Version}\",' \\\n '\"status\": \"${Status}\",' \\\n '\"arch\": \"${Architecture}\",' \\\n '\"src_pkg\": \"${source:Package}\"' \\\n '}\\n\\''\n dpkg_query_so = shell_out(dpkg_query)\n\n if dpkg_query_so.error?\n Ohai::Log.error \"dpkg-query failed: #{dpkg_query_so}\"\n return\n end\n\n JSON.parse(\"{#{dpkg_query_so.stdout.split(\"\\n\").join(',')}}\")\n end",
"def search_list(name, config)\n file = File.read(config)\n data = JSON.parse(file)\n packages = data.each { |x|\n if x[1][\"name\"] == name\n puts x[1][\"name\"].green + \"\\n-- \" + x[1][\"desc\"].green\n else\n puts x[1][\"name\"] + \"\\n-- \" + x[1][\"desc\"]\n end\n }\nend",
"def package_from_name\n case name.downcase\n when 'splunk' then package :splunk\n when 'universal_forwarder' then package :universal_forwarder\n else raise 'Package must be specified (:splunk or :universal_forwarder)'\n end\n end",
"def each_ignored_package\n return enum_for(__method__) unless block_given?\n\n cache_ignored_package_names.each do |pkg_name|\n yield(find_autobuild_package(pkg_name))\n end\n end",
"def getsfLma__PackageObjName\r\n\t\t\treturn \"sfLma__Package__c\"\r\n\t\tend",
"def packages_from_require(rpmdep)\n refresh\n @rpmdb.whatprovides(rpmdep)\n end"
] |
[
"0.7300775",
"0.7257258",
"0.70202047",
"0.69410783",
"0.68412924",
"0.67444324",
"0.6609925",
"0.65386343",
"0.653666",
"0.65336734",
"0.6526174",
"0.6486079",
"0.6486079",
"0.64606327",
"0.6380588",
"0.6360088",
"0.63586986",
"0.63584906",
"0.6318584",
"0.6305778",
"0.622593",
"0.62142",
"0.6204346",
"0.62011194",
"0.6193139",
"0.617825",
"0.6115888",
"0.6108443",
"0.60846734",
"0.6084085",
"0.6044877",
"0.6005773",
"0.600278",
"0.5998296",
"0.5990767",
"0.59865236",
"0.5983274",
"0.5978836",
"0.5949629",
"0.59283125",
"0.5916211",
"0.59120786",
"0.59065974",
"0.5848182",
"0.58348423",
"0.5820418",
"0.58166015",
"0.58111227",
"0.58014894",
"0.5800199",
"0.5785886",
"0.5754713",
"0.57397217",
"0.5739164",
"0.5729451",
"0.5718174",
"0.57144153",
"0.5699248",
"0.5698591",
"0.5697597",
"0.5689921",
"0.56793606",
"0.5676389",
"0.5667865",
"0.5661495",
"0.56601596",
"0.56601256",
"0.5653393",
"0.56484604",
"0.56443226",
"0.5641718",
"0.563145",
"0.5628923",
"0.56277657",
"0.56055087",
"0.5599116",
"0.55926573",
"0.558985",
"0.5588813",
"0.55795664",
"0.55786246",
"0.55735946",
"0.55647403",
"0.5557935",
"0.55374277",
"0.55189824",
"0.551587",
"0.5511487",
"0.55098474",
"0.5506785",
"0.5500526",
"0.5491245",
"0.5487897",
"0.5471485",
"0.54424644",
"0.5432106",
"0.5428061",
"0.54254884",
"0.5424562",
"0.5421929"
] |
0.7955433
|
0
|
Using the package name as a key, and nevra for an index, keep a unique list of packages. The available/installed state can be overwritten for existing packages.
|
def push(*args)
args.flatten.each do |new_rpm|
unless new_rpm.is_a?(RPMDbPackage)
raise ArgumentError, "Expecting an RPMDbPackage object"
end
@rpms[new_rpm.n] ||= []
# we may already have this one, like when the installed list is refreshed
idx = @index[new_rpm.nevra]
if idx
# grab the existing package if it's not
curr_rpm = idx
else
@rpms[new_rpm.n] << new_rpm
new_rpm.provides.each do |provide|
@provides[provide.name] ||= []
@provides[provide.name] << new_rpm
end
curr_rpm = new_rpm
end
# Track the nevra -> RPMPackage association to avoid having to compare versions
# with @rpms[new_rpm.n] on the next round
@index[new_rpm.nevra] = curr_rpm
# these are overwritten for existing packages
if new_rpm.available
@available << curr_rpm
end
if new_rpm.installed
@installed << curr_rpm
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def search_packages(pattern)\n packages = RailsPwnerer::Base.all_packages\n Hash[packages.select { |key, value|\n pattern.kind_of?(Regexp) ? (pattern =~ key) : key.index(pattern)\n }.map { |key, value|\n # apt-cache search sometimes leaves version numbers out\n # Update the cache with version numbers.\n if value.nil?\n info = RailsPwnerer::Base.package_info_hash(\n Kernel.`(\"apt-cache show #{key}\"))\n packages[key] = value = info['Version']\n end\n [key, value]\n }]\n end",
"def existing_packages\n paths_by_app = Dir[File.join(config[:packages_dir], '*', '*.{tar.gz,json}')].group_by { |path|\n path.split(File::SEPARATOR)[-2]\n }\n\n Hash[\n paths_by_app.map { |app, paths|\n names_by_base = paths.group_by do |path|\n File.basename(path).sub(/\\.(?:tar\\.gz|json)\\z/, '')\n end\n\n packages = names_by_base.flat_map { |base, names|\n names.map do |name|\n (\n name.end_with?(\".tar.gz\") &&\n names.find { |_| _.end_with?(\".json\") } &&\n base\n ) || nil\n end\n }.compact\n\n [app, packages.sort]\n }\n ]\n end",
"def old_stow_packages(pkg_name, version)\n old_versions = []\n # Iterate over directories that match name & delimiter\n Dir.glob(\"#{stow_path}/#{pkg_name}#{pkg_delim}*\") do |pkg_path|\n old_versions << File.basename(pkg_path)\n end\n unless blank?(old_versions)\n # Remove the up to date package from array if it exists\n configured_version = [\"#{pkg_name}#{pkg_delim}#{version}\"]\n old_versions -= configured_version\n end\n Chef::Log.debug \".old_stow_packages: #{old_versions}\"\n old_versions\n end",
"def installed_packages()\n\t\t\t\tinstalledpackagelist = `#{@finkbin} list -i`\n\n\t\t\t\tinstalledpackages = PackageList.new()\n\t\t\t\tinstalledpackagelist.each_line() { |line|\n\t\t\t\t\tlinearr = line.split()\n\t\t\t\t\tinstalledpackages[linearr[1]] = PackageInfo.new()\n\t\t\t\t\tinstalledpackages[linearr[1]].name = linearr[1]\n\t\t\t\t\tinstalledpackages[linearr[1]].version = linearr[2]\n\t\t\t\t\tinstalledpackages[linearr[1]].description = linearr[3]\n\t\t\t\t\tinstalledpackages[linearr[1]].installed = true\n\t\t\t\t}\n\n\t\t\t\treturn(installedpackages)\n\t\t\tend",
"def resolve( name, version )\n # It is possible, and almost inevitable, that we can install two packages that must oscilate\n # at the same time. As a result, we will be relinking a package that has not been installed yet,\n # but will be on the next commit. In this situation, we need keep a cache of packages mapped in\n # this session, so that when this occurs, we can resolve it with no problems. In this way, we\n # maintain an instance variable hash that is added to whenever map() is called\n cached = @pkg_cache[ \"%s-%s\" % [ name, version ] ]\n if( cached != nil )\n return cached\n end\n\n # Past this, we do not want to proceed if the package is not present in the install\n # dir\n\n # We ensure that this package is in fact installed\n if( !File.directory?( Config.instance.install_dir + \"/\" + name + \"/\" + version ) )\n puts \"%s-%s is not installed!\" % [ name, version ]\n return nil\n end\n\n # If the cache file exists and is in fact a file, slurp it up and use that\n # I'd love to do some digest check here to:\n # 1. Ensure that the cache file is intact and valid\n # 2. The directory installed matches the one that this cache file was generated from\n\n # First, we check the cache to see if we've resolved this package before\n # Figure out where the cache file would be if it existed\n cache_file = Config.instance.cache_dir + \"/\" + name + \"-\" + version + \".json\"\n if( File.file?( cache_file ) )\n file = File.new( cache_file, \"r\" )\n buff = \"\"\n while (line = file.gets)\n buff += line\n end\n file.close( )\n pkg = JSON.parse( buff )\n return pkg\n end\n\n # If we haven't, we'll need to do a full trace of the package\n\n # It may be better to store all of our package file in\n # $(install_dir)/$(name)/$(version)/pkg_files\n # and store the manifest next to pkg_files\n # Therefore, when we need to do this, we can just consult the manifest for\n # data such as dependencies\n pkg = map( Config.instance.install_dir + \"/\" + name + \"/\" + version )\n file = File.new( cache_file, \"w\" )\n\n # Write metadata\n file.write( pkg.to_json( ) )\n\n file.close( )\n\n return pkg\n end",
"def installed_packages()\n\t\t\t\treturn(PackageList.new())\n\t\t\tend",
"def packages()\n\t\t\t\tpackages = installed_packages()\n\n\t\t\t\tpackagelist = `#{@finkbin} list -n`\n\n\t\t\t\tpackagelist.each_line() { |line|\n\t\t\t\t\tlinearr = line.split()\n\t\t\t\t\tpackages[linearr[0]] = PackageInfo.new()\n\t\t\t\t\tpackages[linearr[0]].name = linearr[0]\n\t\t\t\t\tpackages[linearr[0]].version = linearr[1]\n\t\t\t\t\tpackages[linearr[0]].description = linearr[2]\n\t\t\t\t}\n\n\t\t\t\treturn(packages)\n\t\t\tend",
"def packages\n @packages ||= []\n end",
"def packages\n @packages ||= []\n end",
"def all_package_names\n each_autobuild_package.map(&:name)\n end",
"def query_package(pkg_name)\n @logger.info(\"Querying for #{pkg_name}\")\n @index[:packages].key?(pkg_name)\n end",
"def find_package_set(name)\n each_package_set.find { |set| set.name == name }\n end",
"def installed_packages()\n\t\t\t\tpackages = PackageList.new()\n\t\t\t\tpackageregex = /^([^ ]+)-([^- ]+)\\s+(.*)$/\n\n\t\t\t\tinstalledpackageslist = `/usr/sbin/pkg_info`\n\t\t\t\tinstalledpackageslist.each_line() { |line|\n\t\t\t\t\tline.strip!()\n\t\t\t\t\tmatch = packageregex.match(line)\n\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\tname = match[1]\n\t\t\t\t\t\tversion = match[2]\n\t\t\t\t\t\tdescription = match[3]\n\n\t\t\t\t\t\tpackages[name] = PackageInfo.new()\n\t\t\t\t\t\tpackages[name].name = name\n\t\t\t\t\t\tpackages[name].version = version\n\t\t\t\t\t\tpackages[name].description = description\n\t\t\t\t\tend\n\t\t\t\t}\n\n\t\t\t\treturn(packages)\n\t\t\tend",
"def installed_packages(hostname = '')\n report = {}\n Server.where(\"last_checkin > ?\", LAST_CHECKIN).find_each do |server|\n next if hostname != '' && server.hostname != hostname\n report[server.hostname] = {}\n\n # Go through each package. In some cases (gems) there may be multiple\n # versions of a package on the machine.\n server.installed_packages.each do |package|\n name = package.name\n provider = package.provider\n\n # Create data structure if we've not yet encountered this provider or\n # package.\n if !report[server.hostname].key?(provider)\n report[server.hostname][provider] = {}\n report[server.hostname][provider][name] = []\n elsif !report[server.hostname][provider].key?(name)\n report[server.hostname][provider][name] = []\n end\n\n # Add the version.\n report[server.hostname][provider][name] << package.version\n end\n end\n\n report\n end",
"def populate_ks_pkg_list(options)\n pkg_list = []\n if options['service'].to_s.match(/centos|fedora|rhel|sl_|oel/)\n if not options['service'].to_s.match(/fedora/)\n pkg_list.push(\"@base\")\n end\n pkg_list.push(\"@core\")\n if options['service'].to_s.match(/[a-z]_6/)\n pkg_list.push(\"@console-internet\")\n pkg_list.push(\"@system-admin-tools\")\n end\n if not options['service'].to_s.match(/sl_6|[a-z]_5|fedora/)\n pkg_list.push(\"@network-file-system-client\")\n end\n if options['service'].to_s.match(/centos_[6,7]|fedora|sl_[6,7]/)\n if not options['service'].to_s.match(/fedora_2[3-9]|centos_6/)\n pkg_list.push(\"redhat-lsb-core\")\n if not options['service'].to_s.match(/rhel_[6,7]|oel_[6,7]|centos_7/)\n pkg_list.push(\"augeas\")\n pkg_list.push(\"tk\")\n end\n end\n if not options['service'].to_s.match(/fedora|_[6,7,8]/)\n pkg_list.push(\"ruby\")\n pkg_list.push(\"ruby-irb\")\n pkg_list.push(\"rubygems\")\n pkg_list.push(\"ruby-rdoc\")\n pkg_list.push(\"ruby-devel\")\n end\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"augeas-libs\")\n pkg_list.push(\"ruby-libs\")\n end\n end\n if not options['service'].to_s.match(/fedora|el_[7,8]|centos_[6,7,8]/)\n pkg_list.push(\"grub\")\n pkg_list.push(\"libselinux-ruby\")\n end\n if options['service'].to_s.match(/el_[7,8]|centos_[7,8]/)\n pkg_list.push(\"iscsi-initiator-utils\")\n end\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"e2fsprogs\")\n pkg_list.push(\"lvm2\")\n end\n if not options['service'].to_s.match(/fedora/)\n pkg_list.push(\"kernel-devel\")\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"automake\")\n pkg_list.push(\"autoconf\")\n pkg_list.push(\"lftp\")\n pkg_list.push(\"avahi\")\n end\n end\n pkg_list.push(\"kernel-headers\")\n pkg_list.push(\"dos2unix\")\n pkg_list.push(\"unix2dos\")\n if not options['service'].to_s.match(/fedora_2[4-9]|centos_6/)\n pkg_list.push(\"zlib-devel\")\n end\n if not options['service'].to_s.match(/fedora/)\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"libgpg-error-devel\")\n pkg_list.push(\"libxml2-devel\")\n pkg_list.push(\"libgcrypt-devel\")\n pkg_list.push(\"xz-devel\")\n pkg_list.push(\"libxslt-devel\")\n pkg_list.push(\"libstdc++-devel\")\n end\n if not options['service'].to_s.match(/rhel_5|fedora|centos_6/)\n pkg_list.push(\"perl-TermReadKey\")\n pkg_list.push(\"git\")\n pkg_list.push(\"perl-Git\")\n end\n pkg_list.push(\"gcc\")\n pkg_list.push(\"gcc-c++\")\n if not options['service'].to_s.match(/centos_|el_8/)\n pkg_list.push(\"dhcp\")\n end\n pkg_list.push(\"xinetd\")\n pkg_list.push(\"tftp-server\")\n end\n if not options['service'].to_s.match(/el_|centos_/)\n pkg_list.push(\"libgnome-keyring\")\n end\n if not options['service'].to_s.match(/rhel_5/)\n pkg_list.push(\"perl-Error\")\n end\n pkg_list.push(\"httpd\")\n if options['service'].to_s.match(/fedora/)\n pkg_list.push(\"net-tools\")\n pkg_list.push(\"bind-utils\")\n end\n if not options['service'].to_s.match(/fedora|el_8|centos_8/)\n pkg_list.push(\"ntp\")\n end\n pkg_list.push(\"rsync\")\n if options['service'].to_s.match(/sl_6/)\n pkg_list.push(\"-samba-client\")\n end\n end\n return pkg_list\nend",
"def package_by_name(package_name)\n raise RuntimeError, \"#{self.class} needs to overwrite package_by_name\"\n end",
"def index\n @package_items = @package.package_items\n end",
"def find_package_set_by_name(name)\n @package_sets[name]\n end",
"def packages\n manifest.each_with_object({}) do |(src, package_name), hsh|\n next if src.nil? || src.empty?\n hsh[package_name] ||= []\n hsh[package_name] << File.join(Licensed::Git.repository_root, src)\n end\n end",
"def lookup(package_name)\n pkgs = @rpms[package_name]\n if pkgs\n pkgs.sort.reverse\n else\n nil\n end\n end",
"def updates_by_package(search_package = '', search_servers)\n updates = {}\n Package.joins(:advisories).includes(:advisories).each do |package|\n next unless search_package == '' || /#{search_package}/ =~ package.name\n next if package.servers.count == 0\n next if package.provider == 'gem'\n\n # Get the servers that this package/version/etc applies to.\n name = package.name\n package.servers.each do |server|\n next unless search_servers.empty? || search_servers.include?(server.hostname)\n next unless server.last_checkin\n next unless server.last_checkin > LAST_CHECKIN\n\n pending = Package.includes(:pending_packages).find_by(packages: { name: name }, servers: { hostname: server.hostname })\n next if pending.nil?\n updates[name] = {} unless updates.key?(name)\n updates[name][pending.version] = [] \\\n unless updates[name].key?(pending.version)\n updates[name][pending.version] << server.hostname\n end\n end\n\n updates\n end",
"def setpkg2\n abort \"Error: installed.db is not readable!! #{INSTALLDB}\" unless File.readable?(INSTALLDB)\n\n r_pkg = []\n\n File.open(INSTALLDB, File::RDONLY) do |fp|\n fp.flock(File::LOCK_SH)\n\n fp.gets # skip 1st line\n while l = fp.gets\n l = l.split(' ', 2)[0].strip\n\n if @pkg[l].nil?\n warn \"Warning: Package #{l} is marked as installed, but it is not listed in setup.ini.\"\n else\n r_pkg << @pkg[l]\n @i_pkg << l\n end\n end\n end\n\n @r_pkg = r_pkg.flatten\n end",
"def install_order(arr)\n result = []\n\n hash_pkg = Hash.new {|k,v| v = []}\n\n arr.each do |tup|\n hash_pkg[tup[0]] += [tup[1]]\n end\n\n (1..hash_pkg.keys.max).each do |pkg|\n result << pkg unless hash_pkg.keys.include?(pkg)\n end\n\n\n until hash_pkg.empty?\n hash_pkg.each do |pkg, dep|\n if dep.all? {|d| result.include?(d)}\n result << pkg\n hash_pkg.delete(pkg)\n end\n end\n end\n\n result\nend",
"def packages\n FileList[package_path('.*')]\n end",
"def scan_for_packages\n # Scan the dropbox\n new_packages = collection.dropbox.find_new_packages\n Rails.logger.info \"<< Found #{new_packages.count} new packages for collection #{@collection.name} >>\" if new_packages.count > 0\n new_packages.each do |package|\n @previous_entries = nil # clear it out in case the last package set it\n @current_package = package\n process_valid_package if valid_package?\n end\n end",
"def package(index = 0)\n container.package(index)\n end",
"def [](name)\n packages[name]\n end",
"def remove_package_deps(pkg_name)\n if @index[:packages].key?(pkg_name) &&\n !@index[:packages][pkg_name].empty?\n @index[:packages][pkg_name].each do |dep|\n @index[:deps][dep].delete(pkg_name)\n end\n end\n end",
"def package_list(packages, version)\n packages[:base].to_a.join(' ') + ' ' + packages[version].to_a.join(' ')\n end",
"def [](packagename)\n\t\t\t\treturn(packages()[packagename])\n\t\t\tend",
"def find_package_by_name(name)\n @packages[name]\n end",
"def debian_versions(names_packages)\n # Group the keys in a Hash by their version. This is so we can easily\n # sort the versions.\n versions = names_packages.group_by(&:version)\n # Pack them in a Debian::Version object for sorting\n Hash[versions.map { |k, v| [Debian::Version.new(k), v] }]\n end",
"def list_packages\n res = []\n out = Aptly::runcmd \"aptly mirror show -with-packages #{@name.quote}\"\n Aptly::parse_indented_list out.lines\n end",
"def index\n @packages = @packages.sort_by {|p| p.name}\n @current_packages = @packages.select {|p| !p.old}\n @old_packages = @packages.select {|p| p.old}\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def packages_missing_candidates\n @packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n missing.push(package_name) if magic_version.nil? && candidate_version.nil?\n end\n missing\n end\n end",
"def build_current_versions\n version_list = []\n new_resource.package_name.each_with_index do |name, index|\n version = if new_resource.version && !new_resource.version[index].nil?\n powershell_exec(build_powershell_package_command(\"Get-Package '#{name}'\", new_resource.version[index]), timeout: new_resource.timeout).result\n else\n powershell_exec(build_powershell_package_command(\"Get-Package '#{name}'\"), timeout: new_resource.timeout).result\n end\n if version.empty?\n version = nil\n end\n version = version.strip if version.respond_to?(:strip)\n version_list.push(version)\n end\n version_list\n end",
"def get_all_keys\n keys = Hash.new()\n @packages.each do |key, value|\n keys[key] = value.stringpool_keystrings.values\n end\n\n return keys\n end",
"def key\n \"gem-package-#{name}\"\n end",
"def packages()\n\t\t\t\treturn(PackageList.new())\n\t\t\tend",
"def relevant_packages\n packages.select { |p| p['version'] == version }\n end",
"def install_order(arr)\n pairs = {}\n queue = []\n sorted = [] \n arr.each do |pair|\n pairs[pair[0]] = pair[1]\n end \n packages = (1..pairs.keys.max).to_a\n packages.each do |package|\n if !pairs.keys.include?(package)\n queue.push(package)\n end \n end \n\n until queue.empty?\n package = queue.shift \n sorted.push(package)\n neighbors = []\n\n pairs.each do |key, value|\n if value == package\n neighbors.push(key)\n pairs.delete(key)\n end \n end\n neighbors.each do |package|\n if !pairs.keys.include?(package)\n queue.push(package)\n end \n end \n end \n\n if packages.length == sorted.length \n return sorted\n else \n return []\n end \nend",
"def reuse(workspace_root)\n return if reused_installations.any? { |mnf| mnf.path == workspace_root }\n\n manifest = InstallationManifest.from_workspace_root(workspace_root)\n manifest.load\n @reused_installations << manifest\n manifest.each do |pkg|\n ignore_package pkg.name\n end\n end",
"def package_from_name(package_name)\n return self if package_name == self.name\n local_deps.find { |pkg| pkg.name == package_name }\n end",
"def search_for_description pkgname, packages = []\n cache_key = \"description_package_#{pkgname.downcase}\"\n description_package = Rails.cache.fetch(cache_key, :expires_in => 12.hours) do\n if packages.blank?\n packages = Seeker.prepare_result(\"\\\"#{pkgname}\\\"\", nil, nil, nil, nil)\n packages = packages.reject {|p| p.first.type == 'ymp'}\n end\n packages.select {|p| p.name == pkgname}.each do |package|\n description_package = nil\n unless package.description.blank?\n description_package = package\n logger.info \"Found package info for #{pkgname} in: #{package.project}\"\n break\n end\n logger.error \"No package info for #{pkgname} in: #{package.project}\"\n end\n description_package\n end\n end",
"def packages\n @packages ||= begin\n publish_packages = []\n build_packages = FileSyncer.glob(@pattern).map { |path| Package.new(path) }\n\n if @options[:platform_mappings]\n # the platform map is a simple hash with publish to build platform mappings\n @options[:platform_mappings].each_pair do |build_platform, publish_platforms|\n # Splits `ubuntu-12.04-x86_64` into `ubuntu`, `12.04` and `x86_64`\n build_platform, build_platform_version, build_architecture = build_platform.split(\"-\")\n\n # locate the package for the build platform\n packages = build_packages.select do |p|\n p.metadata[:platform] == build_platform &&\n p.metadata[:platform_version] == build_platform_version &&\n p.metadata[:arch] == build_architecture\n end\n\n if packages.empty?\n log.warn(log_key) do\n \"Could not locate a package for build platform #{build_platform}-#{build_platform_version}-#{build_architecture}. \" \\\n \"Publishing will be skipped for: #{publish_platforms.join(\", \")}\"\n end\n end\n\n publish_platforms.each do |publish_platform|\n publish_platform, publish_platform_version, publish_architecture = publish_platform.split(\"-\")\n\n packages.each do |p|\n # create a copy of our package before mucking with its metadata\n publish_package = p.dup\n publish_metadata = p.metadata.dup.to_hash\n\n # override the platform, platform version and architecture in the metadata\n publish_metadata[:platform] = publish_platform\n publish_metadata[:platform_version] = publish_platform_version\n publish_metadata[:arch] = publish_architecture\n\n # Set the updated metadata on the package object\n publish_package.metadata = Metadata.new(publish_package, publish_metadata)\n\n publish_packages << publish_package\n end\n end\n end\n else\n publish_packages.concat(build_packages)\n end\n\n if publish_packages.empty?\n log.info(log_key) { \"No packages found, skipping publish\" }\n end\n\n publish_packages\n end\n end",
"def packages\n return @packages if @packages\n\n @packages = resolve_packages.map do |pkg|\n next if ignored?(pkg)\n\n package_set = pkg.kind_of? Autoproj::InstallationManifest::PackageSet\n pkg = pkg.to_h\n local_dir = if package_set\n pkg[:raw_local_dir]\n else\n pkg[:importdir] || pkg[:srcdir]\n end\n\n Autoproj::Daemon::PackageRepository.new(\n pkg[:name] || pkg[:package_set],\n pkg[:vcs],\n package_set: package_set,\n local_dir: local_dir,\n ws: ws\n )\n end.compact\n @packages\n end",
"def listpackages\n packages = []\n\n @repository.categories.each do |category|\n Architecture.dataset(category).each do |entry|\n source = Architecture.new(entry[:architecture], entry[:component], entry[:suitename], category)\n source.files.each do |fullname|\n package = Package.new(fullname, entry[:suitename], entry[:component])\n packages << {\n :fullname => fullname,\n :category => category,\n :basename => File.basename(fullname),\n :controlfile => package.controlfile,\n :component => entry[:component],\n :suitename => entry[:suitename],\n :architecture => entry[:architecture]\n }\n end\n end\n if category.eql? \"stage\"\n Component.dataset(category).each do |entry|\n source = Component.new(entry[:component], entry[:suitename], category)\n source.files.each do |fullname|\n package = Package.new(fullname, entry[:suitename], entry[:component])\n packages << {\n :fullname => fullname,\n :category => category,\n :basename => File.basename(fullname),\n :controlfile => package.controlfile,\n :component => entry[:component],\n :suitename => entry[:suitename],\n :architecture => \"unknown\"\n }\n end\n end\n end\n end\n packages\n end",
"def advisories_by_package(search_package = '', search_servers = [],\n search_provider = '')\n report = {}\n Package.find_each do |package|\n next unless search_package == '' || /#{search_package}/ =~ package.name\n next unless search_provider == '' || search_provider == package.provider\n next if package.servers.count == 0\n next if package.advisories.count == 0\n\n # Get the servers that this package/version/etc applies to.\n servers = []\n package.servers.each do |server|\n next unless search_servers.empty? || search_servers.include?(server.hostname)\n next unless server.last_checkin\n next unless server.last_checkin > LAST_CHECKIN\n servers << server.hostname\n end\n next unless servers.count > 0\n\n name = package.name\n version = package.version\n arch = package.arch\n provider = package.provider\n\n report[name] = {} unless report.key?(name)\n report[name][version] = {} unless report[name].key?(version)\n report[name][version][arch] = {} unless report[name][version].key?(arch)\n report[name][version][arch][provider] = {} \\\n unless report[name][version][arch].key?(name)\n\n advisories = package.advisories.count\n report[name][version][arch][provider]['advisories'] = advisories\n report[name][version][arch][provider]['servers'] = servers\n end\n\n report\n end",
"def packages()\n\t\t\t\traise(PackageError, \"A full package list is not implemented on OpenBSD\")\n\t\t\tend",
"def packages\n ::Packages::Package.all\n end",
"def autoinstPackages\n allpackages = []\n\n # the primary list of packages\n allpackages = Convert.convert(\n Builtins.union(allpackages, PackageAI.toinstall),\n :from => \"list\",\n :to => \"list <string>\"\n )\n\n # In autoinst mode, a kernel should not be available\n # in <packages>\n if Builtins.size(@kernel) == 0\n kernel_pkgs = Kernel.ComputePackages\n allpackages = Convert.convert(\n Builtins.union(allpackages, kernel_pkgs),\n :from => \"list\",\n :to => \"list <string>\"\n )\n else\n if Pkg.IsAvailable(@kernel)\n allpackages = Builtins.add(allpackages, @kernel)\n kernel_nongpl = Ops.add(@kernel, \"-nongpl\")\n\n if Pkg.IsAvailable(kernel_nongpl)\n allpackages = Builtins.add(allpackages, kernel_nongpl)\n end\n else\n Builtins.y2warning(\"%1 not available, using kernel-default\", @kernel)\n kernel_pkgs = Kernel.ComputePackages\n allpackages = Convert.convert(\n Builtins.union(allpackages, kernel_pkgs),\n :from => \"list\",\n :to => \"list <string>\"\n )\n end\n end\n\n deep_copy(allpackages)\n end",
"def key_for_package(pkg)\n if !pkg.id.nil?\n \"#{pkg.id}-#{@name}\"\n else\n return \"#{pkg.categories.split.first}/#{pkg.name}-#{@name}\"\n end\n end",
"def package_list(packages, version)\n Array(packages[:base]).join(' ') + ' ' + Array(packages[version]).join(' ')\n end",
"def packages_with_advisories\n @packages_with_advisories ||= ReleaseComponent.includes(:package)\\\n .where('errata_id != ? AND errata_id IN (?)', @errata, @errata.release.errata)\\\n .map{|m| [m.package.name, m.package.id]}\\\n .flatten.uniq\n end",
"def update_for\n update_for_items.collect(&:package)\n end",
"def versions name # :nodoc:\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end",
"def default_packages(*names)\n pkg_set = Autoproj.current_package_set\n clear_metapackage(pkg_set.name)\n metapackage(pkg_set.name, *names)\nend",
"def versions name\n if @data.key?(name)\n return @data[name]\n end\n\n uri = @dep_uri + \"?gems=#{name}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n\n @data[name]\n end",
"def find_package_definition(name)\n packages[validate_package_name_argument(name, require_existing: false)]\n end",
"def forced_packages_missing_candidates\n @forced_packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n next if new_version.nil? || current_version.nil?\n\n if use_magic_version?\n if !magic_version && candidate_version.nil?\n missing.push(package_name)\n end\n else\n if !version_requirement_satisfied?(current_version, new_version) && candidate_version.nil?\n missing.push(package_name)\n end\n end\n end\n missing\n end\n end",
"def differentiate(packages)\n named_groups = Hash.new{|h,k| h[k] = []}\n packages.each{|p| named_groups[p.name] << p }\n named_groups.each do |name, packages| \n if packages.length > 1\n packages.each{|p| p.name = \"#{p.name} (#{p.paths.first})\"} \n end\n end\n end",
"def add_package(package)\n return if @git_resolver.package?(package) && @cache.key?(package)\n\n @git_resolver\n .repository(package)\n .tags\n .map(&:name)\n .each do |version|\n @cache.ensure_version(package, version)\n add_version(package, version)\n end\n end",
"def remove_from_default(*names)\n pkg_set = Autoproj.current_package_set\n Autoproj.workspace.manifest.metapackage(pkg_set.name).packages.delete_if do |pkg|\n names.include?(pkg.name)\n end\nend",
"def test_remove_duplicates_installed_packages\n inventoryXMLstr = File.read(@inventoryPath)\n inventoryXML = LinuxUpdates::strToXML(inventoryXMLstr)\n instancesXML = LinuxUpdates::getInstancesXML(inventoryXML)\n installedPackageXML = instancesXML.select { |instanceXML| LinuxUpdates::isInstalledPackageInstanceXML(instanceXML) }\n installedPackages = installedPackageXML.map { |installedPackage| LinuxUpdates::installedPackageXMLtoHash(installedPackage, \"Ubuntu_16.04\")}\n assert_equal(605, installedPackages.size)\n\n collectionNames = installedPackages.map { |installedPackage| installedPackage[\"CollectionName\"] }\n collectionNamesSet = Set.new collectionNames\n assert_equal(598, collectionNamesSet.size) # 7 duplicates\n assert(collectionNamesSet.size < collectionNames.size, \"Test data does not contain duplicate Collection Names\")\n\n data_items_dedup = LinuxUpdates::removeDuplicateCollectionNames(installedPackages)\n assert_equal(collectionNamesSet.size, data_items_dedup.size, \"Deduplication failed\")\n end",
"def installed_packages()\n\t\t\tend",
"def installed_version(i)\n p_data = package_info(i)\n\n if p_data[\"keg_only\"]\n if p_data[\"installed\"].empty?\n nil\n else\n p_data[\"installed\"].last[\"version\"]\n end\n else\n p_data[\"linked_keg\"]\n end\n end",
"def build_candidate_versions\n versions = []\n new_resource.package_name.each_with_index do |name, index|\n version = if new_resource.version && !new_resource.version[index].nil?\n powershell_exec(build_powershell_package_command(\"Find-Package '#{name}'\", new_resource.version[index]), timeout: new_resource.timeout).result\n else\n powershell_exec(build_powershell_package_command(\"Find-Package '#{name}'\"), timeout: new_resource.timeout).result\n end\n if version.empty?\n version = nil\n end\n version = version.strip if version.respond_to?(:strip)\n versions.push(version)\n end\n versions\n end",
"def packages; end",
"def register_package_set(pkg_set)\n invalidate_ignored_package_names\n metapackage(pkg_set.name)\n metapackage(\"#{pkg_set.name}.all\")\n @package_sets << pkg_set\n end",
"def remove_package(pkg_name)\n with_mutex do\n if @index[:deps].key? pkg_name\n @index[:deps][pkg_name].each do |pkg, _junk|\n if query_package(pkg)\n @logger.info(\"Unable to remove package #{pkg_name} due to dependency on #{pkg}\")\n return false\n end\n end\n end\n remove_package_deps(pkg_name)\n @index[:packages].delete(pkg_name)\n @logger.info(\"Removed #{pkg_name} from index\")\n return true\n end\n end",
"def find_module(name, version)\n e = []\n\n @envs.each do |k, v|\n next unless v.keys.include?(name) && v[name] == version\n e << k\n end\n\n e\n end",
"def package_info(package_name)\n # return the package hash if it's in the brew info hash\n return brew_info[package_name] if brew_info[package_name]\n\n # check each item in the hash to see if we were passed an alias\n brew_info.each_value do |p|\n return p if p[\"full_name\"] == package_name || p[\"aliases\"].include?(package_name)\n end\n\n {}\n end",
"def find_module(name, version)\n e = []\n\n @envs.each do |k, v|\n next unless v.keys.include?(name) && v[name] == version\n e << k\n end\n\n e\n end",
"def index\n @packages = Package.all\n end",
"def index\n @packages = Package.all\n end",
"def index\n @packages = Package.all\n end",
"def index\n @packages = Package.all\n end",
"def find_packages\n declared_packages.collect do |package|\n guess = ::Albacore::PackageRepo.new(%w|./packages ./src/packages|).find_latest package.id\n debug \"#{name}: guess: #{guess} [albacore: project]\"\n guess\n end\n end",
"def check_all_packages\n packages_not_installed = []\n Constants::PACKAGES.each do |pkg|\n string = \"Looking for package #{pkg}...\"\n installed = check_package(pkg)\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append package name to packages_not_installed list\n packages_not_installed << pkg\n end #if\n end #do\n \n packages_not_installed\n end",
"def packages\n return @package_manager if @package_manager\n\n @package_manager = Rosh::PackageManager.new(@name)\n @package_manager.add_observer(self)\n\n @package_manager\n end",
"def advisories(hostname = '', search_package = '', search_provider = '')\n report = {}\n package_cache = {}\n Server.where(\"last_checkin > ?\", LAST_CHECKIN).find_each do |server|\n next unless hostname == '' || /#{hostname}/ =~ server.hostname\n\n packages = {}\n server.installed_packages.each do |package|\n next unless search_package == '' || /#{search_package}/ =~ package.name\n next unless search_provider == '' || search_provider == package.provider\n\n name = package.name\n version = package.version\n arch = package.arch\n provider = package.provider\n\n pkey = name + ' ' + version + ' ' + arch + ' ' + provider\n package_cache[pkey] = advisory_report(package) \\\n unless package_cache.key?(pkey)\n advisories = Marshal.load(Marshal.dump(package_cache[pkey]))\n\n # Now add any advisories to the record for this package/version.\n next if advisories.empty?\n packages[package.name] = {} unless packages.key?(package.name)\n packages[package.name][package.version] = advisories\n end\n\n # And if there were any packages, add them to the server.\n next if packages.empty?\n report[server.hostname] = packages\n end\n\n report\n end",
"def index\n @order_pack_packages = OrderPackPackage.all\n end",
"def resolve_packages\n installation_manifest =\n Autoproj::InstallationManifest.from_workspace_root(ws.root_dir)\n installation_manifest.each_package.to_a +\n installation_manifest.each_package_set.to_a\n end",
"def each_ignored_package\n return enum_for(__method__) unless block_given?\n\n cache_ignored_package_names.each do |pkg_name|\n yield(find_autobuild_package(pkg_name))\n end\n end",
"def fetch_local_packages\n Dir[@local_packages_dir.join(\"*.rpm\").to_s].each do |package|\n # Replace downloaded packages for local ones\n rpm_name = `rpm -qp --qf \\\"%{NAME}\\\" #{package}`\n Dir[cache_dir.join(\"**\", \"*.rpm\").to_s].each do |rpm_to_exchange|\n if `rpm -qp --qf \\\"%{NAME}\\\" #{rpm_to_exchange}` == rpm_name\n log.info \"Removing #{rpm_to_exchange}\"\n FileUtils.remove_file(rpm_to_exchange)\n end\n end\n log.info \"Copying #{package}\"\n FileUtils.cp(package, cache_dir)\n end\n end",
"def target_version_array\n @target_version_array ||=\n begin\n target_version_array = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n case action\n when :upgrade\n if version_equals?(current_version, new_version)\n # This is a short-circuit (mostly for the rubygems provider) to avoid needing to\n # expensively query the candidate_version which must come later. This only checks\n # exact matching, the check for fuzzy matching is later.\n logger.trace(\"#{new_resource} #{package_name} #{new_version} is already installed\")\n target_version_array.push(nil)\n elsif current_version.nil?\n # This is a simple check to see if we have any currently installed version at all, this is\n # safe to do before the allow_downgrade check so we check this before.\n logger.trace(\"#{new_resource} has no existing installed version. Installing install #{candidate_version}\")\n target_version_array.push(candidate_version)\n elsif !allow_downgrade && version_compare(current_version, candidate_version) == 1\n # This check for downgrading when allow_downgrade is false uses the current_version rather\n # than the magic_version since we never want to downgrade even if the constraints are not met\n # if the version is higher. This check does use the candidate_version and unlazies this so\n # there will a perf hit on idempotent use when allow_downgrade is false which is unavoidable.\n logger.trace(\"#{new_resource} #{package_name} has installed version #{current_version}, which is newer than available version #{candidate_version}. Skipping...)\")\n target_version_array.push(nil)\n elsif magic_version.nil?\n # This is the check for fuzzy matching of the installed_version, where if the installed version\n # does not match the desired version constraints (but is not an exact match) then we need to\n # install the candidate_version (this must come after the allow_downgrade check)\n logger.trace(\"#{new_resource} has an installed version that does not match the version constraint. Installing install #{candidate_version}\")\n target_version_array.push(candidate_version)\n elsif candidate_version.nil?\n # This check necessarily unlazies the candidate_version and may be expensive (connecting to\n # rubygems.org or whatever). It comes as late as possible.\n logger.trace(\"#{new_resource} #{package_name} has no candidate_version to upgrade to\")\n target_version_array.push(nil)\n elsif version_equals?(current_version, candidate_version)\n # This check sees if the candidate_version is already installed or if we should upgrade/update the\n # package. This is the normal idempotent behavior of :upgrade and is inherently expensive due to\n # unlazying the candidate_version. To prevent the perf hit the version may be specified with a full\n # version constraint. Then the cookbook can roll the version forward and use :upgrade to force version\n # pinning.\n logger.trace(\"#{new_resource} #{package_name} #{candidate_version} is already installed\")\n target_version_array.push(nil)\n else\n logger.trace(\"#{new_resource} #{package_name} is out of date, will update to #{candidate_version}\")\n target_version_array.push(candidate_version)\n end\n\n when :install\n if current_version && new_version && !allow_downgrade && version_compare(current_version, new_version) == 1\n # This is the idempotency guard for downgrades when downgrades are not allowed. This should perhaps raise\n # an exception since we were told to install an exact package version but we are silently refusing to do so\n # because a higher version is already installed. Maybe we need a flag for users to apply their preferred\n # declarative philosophy? This has to come early and outside of the two code paths below.\n logger.warn(\"#{new_resource} #{package_name} has installed version #{current_version}, which is newer than available version #{new_version}. Skipping...)\")\n target_version_array.push(nil)\n elsif new_version && !use_magic_version?\n # This is for \"non magic version using\" subclasses to do comparisons between the current_version and the\n # desired new_version. XXX: If we converted this to current_version_requirement_satisfied? and made it specific\n # to the current version check and then eliminated the magic_version, we might be able to eliminate separate codepaths\n # here, and eliminate the semantic confusion around the magic_version?\n if version_requirement_satisfied?(current_version, new_version)\n logger.trace(\"#{new_resource} #{package_name} #{current_version} satisfies #{new_version} requirement\")\n target_version_array.push(nil)\n else\n # XXX: some subclasses seem to depend on this behavior where the new_version can be different from the\n # candidate_version and we install the new_version, it seems like the candidate_version should be fixed to\n # be resolved correctly to the new_version for those providers. although it may just be unit test bugs.\n # it would be more correct to use the candidate_version here, but then it needs to be the correctly resolved\n # candidate_version against the new_version constraint.\n logger.trace(\"#{new_resource} #{package_name} #{current_version} needs updating to #{new_version}\")\n target_version_array.push(new_version)\n end\n elsif magic_version.nil?\n # This is for when we have a \"magic version using\" subclass and where the installed version does not match the\n # constraint specified in the new_version, so we need to upgrade to the candidate_version. This is the only\n # codepath in the :install branch which references the candidate_version so it is slow, but it is the path where\n # we need to do work anyway. XXX: should we check for candidate_version.nil? somewhere around here?\n logger.trace(\"#{new_resource} #{package_name} not installed, installing #{candidate_version}\")\n target_version_array.push(candidate_version)\n else\n logger.trace(\"#{new_resource} #{package_name} #{current_version} already installed\")\n target_version_array.push(nil)\n end\n\n else\n # in specs please test the public interface provider.run_action(:install) instead of provider.action_install\n raise \"internal error - target_version_array in package provider does not understand this action\"\n end\n end\n\n target_version_array\n end\n end",
"def GetPackages\n ProbeKernel() if !@kernel_probed\n deep_copy(@kernel_packages)\n end",
"def index\n @package_versions = PackageVersion.all\n end",
"def unverifiable_packages\n published_packages.keys.select {|p| !expected_cksums.any? {|m| m[\"relpath\"] == p } }\n end",
"def get_update_pkgs\n get_update_dirs\n delete_contrib\n return @update_pkgs\n end",
"def packages\n %w(dtach rtorrent)\nend",
"def get_variants_used_by_rpms\n return {} if is_pdc?\n brew_build_map = HashList.new\n mappings = self.build_mappings.for_rpms\n product_version_ids, brew_build_ids, package_ids = collect_id_lists(mappings)\n\n ThreadLocal.with_thread_locals(\n :cached_restrictions => Package.prepare_cached_package_restrictions(package_ids),\n :cached_arches => Arch.prepare_cached_arches,\n :cached_files => BrewBuild.prepare_cached_files(brew_build_ids),\n :cached_listings => ProductListingCache.prepare_cached_listings(product_version_ids, brew_build_ids)\n ) do\n mappings.group_by(&:product_version).each_pair do |product_version,mappings|\n mappings.each do |mapping|\n package = mapping.package\n mapping.build_product_listing_iterator({:cache_only => true}) do |file, variant, brew_build, arch_list|\n # Some packages are restricted to push to certain dists.\n # Exclude the package if it is not pushing to the dists.\n next if (package.supported_push_types_by_variant(variant) & self.supported_push_types).empty?\n\n # If the errata is multi-product supported then we need to find the\n # mapped channels by given the product listing variant and arches.\n mapped_variants = self.supports_multiple_product_destinations? ?\n self.get_mapped_variants(product_version, package, variant, arch_list) :\n []\n brew_build_map[package].concat([variant] + mapped_variants)\n end\n end\n end\n end\n\n brew_build_map.values.each {|v| v.uniq!}\n brew_build_map\n end",
"def scan(name)\n raise NotImplementedError, \"Repositories must return an Array of matching packages.\"\n end",
"def filter_yarn_internal_package(all_packages)\n internal_package_pattern = /workspace-aggregator-[a-zA-z0-9]{8}-[a-zA-z0-9]{4}-[a-zA-z0-9]{4}-[a-zA-z0-9]{4}-[a-zA-z0-9]{12}/\n yarn_internal_package = all_packages.find { |package| internal_package_pattern.match(package['Name']) }\n all_packages - [yarn_internal_package]\n end",
"def packages\n Autoproj.warn_deprecated \"use #each_package instead\"\n each_package.to_a\n end",
"def each_package\n package_name_array.each_with_index do |package_name, i|\n candidate_version = candidate_version_array[i]\n current_version = current_version_array[i]\n magic_version = use_magic_version? ? magic_version_array[i] : current_version_array[i]\n new_version = new_version_array[i]\n yield package_name, new_version, current_version, candidate_version, magic_version\n end\n end",
"def get_release_packages\n get_local_constraints\n\n if !@force && @installed.include?(@module_name)\n\n raise AlreadyInstalledError,\n :module_name => @module_name,\n :installed_version => @installed[@module_name].first.version,\n :requested_version => @version || (@conditions[@module_name].empty? ? :latest : :best),\n :local_changes => @installed[@module_name].first.local_changes\n end\n\n if @ignore_dependencies && @source == :filesystem\n @urls = {}\n @remote = { \"#{@module_name}@#{@version}\" => { } }\n @versions = {\n @module_name => [\n { :vstring => @version, :semver => SemVer.new(@version) }\n ]\n }\n else\n get_remote_constraints\n end\n\n @graph = resolve_constraints({ @module_name => @version })\n @graph.first[:tarball] = @filename if @source == :filesystem\n resolve_install_conflicts(@graph) unless @force\n\n # This clean call means we never \"cache\" the module we're installing, but this\n # is desired since module authors can easily rerelease modules different content but the same\n # version number, meaning someone with the old content cached will be very confused as to why\n # they can't get new content.\n # Long term we should just get rid of this caching behavior and cleanup downloaded modules after they install\n # but for now this is a quick fix to disable caching\n Puppet::Forge::Cache.clean\n download_tarballs(@graph, @graph.last[:path])\n end",
"def package *args\n\t\targs.each do | name |\n\t\t\treturn if haspackage? name\n\t\tend\n\t\t@cf.cfp_logger.notify VERBOSE_MAJOR,\"Skipping - package #{args.join(',')} not installed\"\n\t\traise PackageNotInstalledError.new('Package '+args.join(\",\")+' not installed')\n\tend",
"def packages_for_multiple_projects\n ::Packages::Package.for_projects(projects_visible_to_current_user)\n end",
"def packages(*names)\n names.empty? ? @packages : @packages = names\n end",
"def installed_version(packagename)\n\t\t\t\treturn(installed_packages()[packagename].version)\t\t\t\t\n\t\t\tend"
] |
[
"0.6211733",
"0.6074426",
"0.6007114",
"0.5980379",
"0.5915451",
"0.58449703",
"0.5836779",
"0.57482874",
"0.57482874",
"0.57408214",
"0.5735739",
"0.57170093",
"0.57163805",
"0.57151437",
"0.56889135",
"0.56455445",
"0.5641386",
"0.5638998",
"0.56162965",
"0.56049263",
"0.5583808",
"0.5571438",
"0.55473787",
"0.55389047",
"0.553655",
"0.55332965",
"0.55286926",
"0.55239356",
"0.5511441",
"0.5476779",
"0.54506695",
"0.5445725",
"0.5429094",
"0.54197663",
"0.5403029",
"0.5390985",
"0.5381273",
"0.53786165",
"0.5377354",
"0.5373192",
"0.53713465",
"0.53625256",
"0.5361582",
"0.5356862",
"0.5356573",
"0.53507376",
"0.5349453",
"0.5346791",
"0.5334809",
"0.5324758",
"0.5322249",
"0.5319079",
"0.53146684",
"0.52885133",
"0.5286561",
"0.5270321",
"0.52674526",
"0.52639616",
"0.5262989",
"0.5244527",
"0.5240452",
"0.523431",
"0.5224073",
"0.52230614",
"0.5221769",
"0.5214249",
"0.5208911",
"0.51789737",
"0.51788193",
"0.5175858",
"0.51711214",
"0.5159124",
"0.5158168",
"0.51546884",
"0.51546884",
"0.51546884",
"0.51546884",
"0.5145814",
"0.5133966",
"0.5121163",
"0.51181746",
"0.5117965",
"0.5114073",
"0.51123303",
"0.51078355",
"0.5101988",
"0.51015425",
"0.509931",
"0.50970304",
"0.50906545",
"0.50888765",
"0.50756055",
"0.5075477",
"0.50735104",
"0.5066886",
"0.50636494",
"0.50625175",
"0.506237",
"0.5058124",
"0.50573856",
"0.50554854"
] |
0.0
|
-1
|
Lists the names of the store this user is entitled to read or write to.
|
def store_names
names = @store_names.dup
names << "users" unless names.include?("users")
names
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_store_names\n\n if @user.admin?\n find_all_storenames\n else\n @permissions.keys.sort\n end\n end",
"def find_all_storenames\n\n WiStore.find(:all).collect do |store|\n store.name\n end\n end",
"def index\n @stores = current_account.stores.find(:all)\t\n end",
"def index\n @admin_stores = Store.all\n end",
"def list_stores\n @stores = Store.where(\"level = ?\", 2)\n if @stores.present?\n render :index, status: :ok\n else\n @message = \"no store found\"\n render :error, status: :not_found\n end\n end",
"def workitems (store_name=nil)\n\n return load_user_workitems if store_name == 'users'\n return (@workitems[store_name] || []) if store_name\n\n # then return all the workitems the user has access to\n\n wis = load_user_workitems\n\n @store_names.inject(wis) do |r, sname|\n r += (@workitems[sname] || [])\n end\n end",
"def index\n if current_user.role?(\"admin\")\n @stores=Store.all\n else\n @stores = current_user.stores\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stores }\n end\n end",
"def index\n if current_user.admin?\n @stores = Store.all\n else\n @stores = current_user.stores\n end\n\n render json: @stores\n end",
"def index\n\t\t@stores = Store.all\n\tend",
"def index\n @store_managers = StoreManager.all\n end",
"def store_information\n get('store')\n end",
"def stores\n @stores ||= config.maildirstores.map(&:path)\n end",
"def storage_names\n @storage_names\n end",
"def index\n top_level_folders = current_user.top_level_folders\n redux_store(\"configureStore\", props: {data: top_level_folders})\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n if store\n if super_user?\n redirect_to edit_store_path(store)\n else\n if store.current_menu\n redirect_to menu_path(store.current_menu)\n else\n redirect_to menus_path, :alert => \"#{store.name} is currently closed.\"\n end\n end\n else\n redirect_to new_store_path\n end\n end",
"def show_users\n @users = User.where(store: false, admin: false)\n end",
"def pstores_names\n @pstores_names ||= begin\n Dir[\"./data/pstore/*.pstore\"].collect do |path|\n File.basename(path)\n end\n end\n end",
"def get_permissions (user, store_name)\n s = \"\"\n [ :read, :write, :delegate ].each do |action|\n s << action.to_s[0, 1] \\\n if @auth_system.authorized?(user, store_name, action)\n end\n s\n end",
"def index\n set_meta_tags title: 'Stores'\n @stores = Kaminari.paginate_array(current_user.all_stores).page(params[:page]).per(25)\n end",
"def admin_store\n\t\t@store = current_store\n\t\t@stores = Store.all.page(params[:page]).per(10)\n\t\trender :layout => 'store_application'\n\tend",
"def index\n @store_items = StoreItem.all\n end",
"def show\n\t@store = current_account.stores.find(params[:id])\n end",
"def show\n @created_stores = @user.created_stores.search(params[:search])\n @created_stores = @created_stores.by_state(params[:state]) if params[:state].present?\n @created_stores = @created_stores.by_type(params[:type]) if params[:type].present?\n @created_stores = @created_stores.order(:name).page(params[:page])\n end",
"def list\n perform_request(action: 'reseller-list')\n parse_returned_params_as_list('usernames')\n end",
"def stores_list\n $tracer.trace(format_method(__method__))\n return ProfileStoreList.new(@tag.find.span.className(create_ats_regex_string(\"ats-storepanel\")), format_method(__method__))\n end",
"def show\n semantic_breadcrumb @store.name, store_path(@store)\n set_meta_tags title: @store.name\n @orders_count = @store.orders.count\n @users_count = @store.users_count\n end",
"def display_stores(database, store_name)\n display = $database.execute(\"SELECT DISTINCT store_name FROM shopping\")\n puts \"STORES TO GO TO\"\n puts \"***************\"\n display.each do |store|\n puts store\n end\nend",
"def get_headers (user, store_name, limit)\n\n authorized?(user, store_name, :read)\n\n l = []\n\n get_store(store_name).each do |workitem, locked|\n break if limit and l.size >= limit\n l << [ workitem, locked ]\n end\n\n l\n end",
"def list\n get('users')['users']\n end",
"def all\n storage.lists.each do |list|\n output \" #{list.name}\"\n list.items.each do |item|\n output \" #{item.short_name}:#{item.spacer} #{item.value}\"\n end\n end\n end",
"def index\n @stores = @commerce.stores\n end",
"def index\n wl = current_user.watchlists.select(:name).distinct\n @watchlists = wl.map {|wlname| Watchlist.find_by(name: wlname.name) }\n end",
"def index\n @keystores = Keystore.all\n end",
"def index\n @manages = User.all\n end",
"def valid_store_name\n [\"MY\", \"CA\", \"ROOT\", \"AUTHROOT\", \"DISALLOWED\", \"SPC\", \"TRUST\", \"TRUSTEDPEOPLE\", \"TRUSTEDPUBLISHER\", \"CLIENTAUTHISSUER\", \"TRUSTEDDEVICES\", \"SMARTCARDROOT\", \"WEBHOSTING\", \"REMOTE DESKTOP\"]\n end",
"def get_store_items(opts = {})\n data, _status_code, _headers = get_store_items_with_http_info(opts)\n return data\n end",
"def keys\n @store.keys\n end",
"def index\n @stores = Stock.all\n end",
"def current_store\n user = current_user\n return nil unless user\n return nil unless session[:store_id]\n user.stores.get(session[:store_id])\nend",
"def index\n @store_details = StoreDetailPolicy::Scope.new(current_user, StoreDetail).resolve \n #@store_details = StoreDetail.order(store_name: :asc)\n #authorize current_user, :index?\n authorize @store_details, :index?\n end",
"def index\n @book_stores = BookStore.all\n end",
"def index\n storeid = User.find(current_user).stores\n @orders = Order.all.where(store: storeid, svis: true)\n end",
"def index\n authorize_action_for Property, at: current_store\n @properties = current_store.properties\n end",
"def permission (store_name)\n\n return RWD_STORE_PERMISSION if @user.admin?\n return RWD_STORE_PERMISSION if store_name == 'users'\n @permissions[store_name]\n end",
"def canManageStore(user, store)\n\t \t\t\t\n\t \t\t\tif user.nil? || store.nil?\n\t \t\t\t\treturn false\n\t \t\t\tend\n\n\t \t\t\tif isUserStoreManagerOf(user,store) || isUserStoreOwnerOf(user,store) || user.has_role?(:admin)\n\t \t\t\t\treturn true\n\t \t\t\telse\n\t \t\t\t\treturn false\n\t \t\t\tend\n\t \t\tend",
"def store_name\n promo = self.promo\n branches = promo.branches\n return unless branches.any?\n return branches.first.store.name\n end",
"def get_all_user_names\n @user_manager.get_all_user_names\n end",
"def index\n @mystery_books = current_user.mystery_books\n end",
"def index\n @storeinfos = Storeinfo.order(:id)\n end",
"def user_item_names(record)\n record.user.send(item_plural(record)).all.collect { |item| item.name.downcase }\n end",
"def users_by_name\n if in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end",
"def all_database_names\n @specs_store.names\n end",
"def show\n @products = Product.all\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n render json: @stores\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n return @secret_stores.list(\n filter,\n *args,\n deadline: deadline,\n )\n end",
"def index\n\t\t@shops = current_user.shop_profiles\n\tend",
"def printstore\n @output = \"\"\n @output << \"Store Name: #{name}\\n\"\n @output << \"Store Number: #{storenum}\\n\"\n @output << \"Store Location: #{loc}\\n\"\n @output << \"\\t Latitude: #{lat}\\n\"\n @output << \"\\t Longitude: #{long}\\n\"\n end",
"def index\n @admin_stores = Admin::Store.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_stores }\n end\n end",
"def index\n @sys_users = Sys::User.all\n end",
"def index\n @store_adds = StoreAdd.all\n end",
"def index\n @stores = Store.all.includes(:admin)\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n @store_books = StoreBook.all\n end",
"def users_by_name # :norobots:\n if is_in_admin_mode?\n query = create_query(:User, :all, by: :name)\n show_selected_users(query)\n else\n flash_error(:permission_denied.t)\n redirect_to(action: \"list_rss_logs\")\n end\n end",
"def subscribers\n store[name].map { |r| r.contents } \n end",
"def index\n if params[:name] == nil\n @stores = Store.all\n else\n @stores = Store.all.where(\"stores.name LIKE '%\"+params[:name]+\"%'\")\n end \n end",
"def show\n if (@store.related_store_id)\n @related_store = Store.find(@store.related_store_id)\n end\n end",
"def show\n @displays = Display.all\n @names=[]\n @displays.each do |display|\n @names.push display.name\n end\n end",
"def index\n @lists = current.user.list\n end",
"def index\n @stores = if params[:title]\n Store.where('name like?', \"%#{params[:title]}%\")\n else\n Store.all\n end\n end",
"def index\n @lists = current_user.lists\n end",
"def index\n @lists = current_user.lists\n end",
"def list_names # :nologin:\n query = create_query(:Name, :all, :by => :name)\n show_selected_names(query)\n end",
"def index\n # The notebooks of the current user\n @notebooks = current_user.notebooks\n end",
"def list\n @redis.hgetall(STORE_KEY).sort.map do |name, command|\n AliasedCommand.new(name, command)\n end\n end",
"def index\n @cakestores = Cakestore.all\n end",
"def index\n @products = Product.where(:store_id => current_merchant.store_name)\n end",
"def index\n @store = store.index\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 show\n render json: @store\n end",
"def set_store\n @store = Store.find_by name: (params[:store_name])\n end",
"def list\n @user = User.all(:order => :login) # sort by login name\n end",
"def index\n @author_site_storages = SiteStorage.fetch_data(current_user)\n end",
"def store=(store)\n @store = store\n end",
"def get_storage_names\n select(<<-SQL.compress_lines)\n SELECT name\n FROM (SELECT * FROM sqlite_master UNION SELECT * FROM sqlite_temp_master)\n WHERE type IN('table', 'view')\n AND name NOT LIKE 'sqlite_%'\n ORDER BY name\n SQL\n end",
"def index\n @store_tabs = StoreTab.all\n end",
"def index\n if current_user.role == 'admin'\n\t@shoppinglists = Shoppinglist.all\n else\n\t@shoppinglists = Shoppinglist.select{|l| l.user == current_user}\n end\n end",
"def index\n @store_statuses = StoreStatus.all\n end",
"def dor_read_rights\n public_xml_doc.xpath('//rightsMetadata/access[@type=\"read\"]/machine/*').map(&:name)\n end",
"def usernames\n @attributes[:usernames]\n end",
"def usernames\n @attributes[:usernames]\n end",
"def list\n items = storage.items\n if items.empty?\n puts 'No items in the list.'\n return\n end\n\n storage.items.each do |(id, data)|\n puts \"#{id} #{data[:stamp]} #{data[:source].ljust(48)}\"\n end\n end",
"def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end",
"def delegation_targets (workitem=nil)\n\n names = @store_names.find_all { |n| permission(n).may_delegate? }\n\n names.delete(workitem.store_name) if workitem\n\n names\n end",
"def index\n @storage_units = StorageUnit.all\n end"
] |
[
"0.7399919",
"0.6922078",
"0.6532522",
"0.6490655",
"0.63840324",
"0.63617325",
"0.62848675",
"0.6239569",
"0.62273854",
"0.622369",
"0.6205164",
"0.60669655",
"0.6049849",
"0.6042551",
"0.60425305",
"0.60425305",
"0.60425305",
"0.60425305",
"0.60425305",
"0.6031795",
"0.59742206",
"0.5841442",
"0.58371717",
"0.5818297",
"0.57725286",
"0.5764057",
"0.57275146",
"0.57177675",
"0.56580144",
"0.56563914",
"0.5627095",
"0.56002736",
"0.5596709",
"0.55364925",
"0.5523129",
"0.54958886",
"0.5493665",
"0.54727644",
"0.5453614",
"0.54517126",
"0.5451464",
"0.54468346",
"0.54406494",
"0.5437129",
"0.5432472",
"0.5420815",
"0.5414171",
"0.5406857",
"0.5383815",
"0.53824526",
"0.53679854",
"0.5365137",
"0.53646827",
"0.53481275",
"0.5342882",
"0.53416526",
"0.5341619",
"0.5331047",
"0.5325596",
"0.532431",
"0.5323814",
"0.53145957",
"0.5309125",
"0.5303888",
"0.53025824",
"0.5301968",
"0.5300685",
"0.5291984",
"0.529092",
"0.5284506",
"0.52827525",
"0.52734774",
"0.52682805",
"0.52534664",
"0.52495104",
"0.52495104",
"0.52479565",
"0.524086",
"0.5239356",
"0.5230253",
"0.5227514",
"0.5215411",
"0.52113086",
"0.52113086",
"0.5206265",
"0.5200575",
"0.5198954",
"0.51951003",
"0.5192628",
"0.51908815",
"0.518924",
"0.518454",
"0.51840687",
"0.5183788",
"0.51816857",
"0.51816857",
"0.5176454",
"0.5173677",
"0.51716596",
"0.51661986"
] |
0.69922507
|
1
|
Returns the permission for the given store.
|
def permission (store_name)
return RWD_STORE_PERMISSION if @user.admin?
return RWD_STORE_PERMISSION if store_name == 'users'
@permissions[store_name]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_permissions (user, store_name)\n s = \"\"\n [ :read, :write, :delegate ].each do |action|\n s << action.to_s[0, 1] \\\n if @auth_system.authorized?(user, store_name, action)\n end\n s\n end",
"def find_permissions\n\n return nil if @user.admin?\n\n groupnames = Group.find_groups(@user)\n\n StorePermission.find_all_by_groupname(groupnames).inject({}) do \n |result, permission|\n\n result[permission.storename] = permission\n result\n end\n end",
"def canManageStore(user, store)\n\t \t\t\t\n\t \t\t\tif user.nil? || store.nil?\n\t \t\t\t\treturn false\n\t \t\t\tend\n\n\t \t\t\tif isUserStoreManagerOf(user,store) || isUserStoreOwnerOf(user,store) || user.has_role?(:admin)\n\t \t\t\t\treturn true\n\t \t\t\telse\n\t \t\t\t\treturn false\n\t \t\t\tend\n\t \t\tend",
"def current_store\n user = current_user\n return nil unless user\n return nil unless session[:store_id]\n user.stores.get(session[:store_id])\nend",
"def permission_level(repo, collaborator, options={})\n get \"#{Repository.path repo}/collaborators/#{collaborator}/permission\", options\n end",
"def get_store (store_name)\n each_store do |regex, s_name, store|\n return store if s_name == store_name\n end\n nil\n end",
"def is_authorized_to_edit_locations_of store\n store = store.id if store.is_a? Store\n return true if is_authorized_to_create_locations_of(store)\n @a = Authorization.find_by_target_id_and_target_type_and_user_id(store, 'Store', id) && [1,2].include?(@a.authorization_type)\n end",
"def is_authorized_to_create_locations_of store\n store = store.id if store.is_a? Store\n return true if authorized_to_authorize(Store.find(store))\n Authorization.find_by_authorization_type_and_target_id_and_target_type_and_user_id(1, store, 'Store', id)\n end",
"def permission(name)\n permissions.detect { |p| p.name == name }\n end",
"def authorized_to_authorize store_or_location\n if store_or_location.is_a? Store\n id == store_or_location.user_id\n elsif store_or_location.is_a? Location\n id == store_or_location.user_id || id == store_or_location.store.user_id\n else\n raise TypeError\n end\n end",
"def store\n _store_id = store_id\n ::Spree::User.logger.debug \"| ByParameters: store_id #{_store_id}\"\n store = _store_id ? ::Spree::Store.where(id: _store_id).first : nil\n store || Spree::Store.new\n end",
"def find_store_names\n\n if @user.admin?\n find_all_storenames\n else\n @permissions.keys.sort\n end\n end",
"def show\n authorize_action_for @order_type, at: current_store\n end",
"def show\n @permissions = @role.permissions\n end",
"def store_information\n get('store')\n end",
"def policy\n self.permissions['policy'].to_sym\n end",
"def grant_permission\n @attributes[:grant_permission]\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 permissions_for(game)\n self.permissions.where(\"user_roles.game_id = ?\", game.id)\n end",
"def show\n\t@store = current_account.stores.find(params[:id])\n end",
"def index\n @store_details = StoreDetailPolicy::Scope.new(current_user, StoreDetail).resolve \n #@store_details = StoreDetail.order(store_name: :asc)\n #authorize current_user, :index?\n authorize @store_details, :index?\n end",
"def fetch_granted_permissions(action:, user:, type:, target:, token:)\n permissions = granted_permissions_for_user(user: user, type: type, target: target, token: token)\n @read = permissions.include?('read')\n @create = permissions.include?('create')\n @update = permissions.include?('update')\n @delete = permissions.include?('delete')\n instance_variable_get(\"@#{action}\")\n end",
"def simple_get_acc_res_permission(permission)\n unless self.acc_group\n return 0\n end\n right = self.acc_group.acc_group_rights.find(:first, :conditions => \"acc_rights.name = '#{permission}'\", :include => :acc_right) if self.is_accountant? or self.is_reseller?\n if right\n return right.value.to_i\n else\n return 0\n end\n end",
"def permission_for (collection)\n permission = Permission.find_or_create_by_user_id_and_collection_id(self.id, collection.id)\n end",
"def permission\n return @children['permission'][:value]\n end",
"def access_rights_for_permission(perm)\n sym = Lockdown.get_symbol(perm)\n\n permissions[sym]\n rescue \n raise SecurityError, \"Permission requested is not defined: #{sym}\"\n end",
"def your_project_access_type policy = nil, resource = nil\n unless policy.nil? or resource.nil? or !(policy.sharing_scope == Policy::ALL_SYSMO_USERS)\n unless policy.permissions.empty?\n my_project_ids = if resource.class == Project then [resource.id] else resource.project_ids end\n my_project_perms = policy.permissions.select {|p| p.contributor_type == 'Project' and my_project_ids.include? p.contributor_id}\n access_types = my_project_perms.map(&:access_type)\n return access_types.first if access_types.all?{|acc| acc == access_types.first}\n else\n policy.access_type\n end\n end\n end",
"def role\n permission_type\n end",
"def has_permission?(show, type, any = false)\n return true if self.site_admin?\n\n show_id = show.is_a?(Show) ? show.id : show.to_i\n\n self.permissions.select { |p|\n (p.global? or p.show_id == show_id) and\n (any == true or p.level == :full or p.level == type)\n }.any?\n end",
"def manager_permissions\n can :manage_collection, String do |pid|\n Rails.logger.debug(\"[MANPERM] Checking from STRING\")\n test_manager(pid)\n end\n\n can :manage_collection, DRI::Batch do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from Object\")\n test_manager(obj.id)\n end\n\n can :manage_collection, SolrDocument do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from SolrDoc\")\n cache.put(obj.id, obj)\n test_manager(obj.id)\n end\n\n can :manage, String do |pid|\n Rails.logger.debug(\"[MANPERM] Checking from STRING\")\n test_manager(pid)\n end\n\n can :manage, DRI::Batch do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from Object\")\n test_manager(obj.id)\n end\n\n can :manage, SolrDocument do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from SolrDoc\")\n cache.put(obj.id, obj)\n test_manager(obj.id)\n end\n end",
"def show\n @seller = Seller.find_by(id: @product.seller_id)\n\n if @usertype == \"Admin\" or @usertype == \"Seller\"\n @permission = true\n else\n @permission = false\n end\n\n end",
"def show\n @store_manager_policy = Store::Manager::Policy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @store_manager_policy }\n end\n end",
"def get_permission_menu\n return @client.raw(\"get\", \"/helpers/menu\")\n end",
"def get_permission( model, action, options_for_permission )\n\n # Note 'ctrl' will be set to the *class*, not an instance. The exception\n # handler block lets us handle \"ModelsController\" in the common pluralized\n # case, then try \"ModelController\" in the unusual singleton resource case,\n # then drop out with 'nil' if something goes wrong.\n\n ctrl = begin\n \"#{ model.name.pluralize }Controller\".constantize\n rescue\n \"#{ model.name }Controller\".constantize\n end\n\n return true unless ctrl.nil? == false && ctrl.respond_to?( :hubssolib_permissions )\n\n # From-Artisan backwards compatibility: Options should be a User, but we\n # allow a hash with user_id too.\n\n if ( options_for_permission.is_a? Hash )\n user = User.find_by_id( options_for_permission[ :user_id ] )\n elsif ( logged_in? )\n user = controller.current_user() # (sic. - query current action's controller *instance* for current user)\n else\n user = nil\n end\n\n roles = HubSsoLib::Roles.new( user.nil? ? false : user.admin )\n permissions = ctrl.hubssolib_permissions()\n\n roles.clear if ( user.nil? )\n\n return permissions.permitted?( roles, action ) == true ? true : ''\n end",
"def show\n authorize! :read, @admin_system_admin\n end",
"def isUserStoreManagerOf(user, store) \n\t \t\t\tif user.nil? || store.nil?\n\t \t\t\t\treturn false\n\t \t\t\telse \n\t \t\t\t\treturn user.has_role? :storemanager, store\n\t \t\t\tend\n\t \t\tend",
"def index\n if current_user.role?(\"admin\")\n @stores=Store.all\n else\n @stores = current_user.stores\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stores }\n end\n end",
"def get(token)\n access = @store.read(key_for(token))\n if access\n access[:anonymous] = access[:identity] == Hadley::ANONYMOUS_IDENTITY\n end\n access\n end",
"def permission_set\n @attributes[:permission_set]\n end",
"def group(store)\n groups.find_by(store: store)\n end",
"def permission\n perm = data.fetch(\"permissionSources\")\n .map { |i| i[\"permission\"] }\n .first\n .downcase\n GITHUB_TO_TERRAFORM_PERMISSIONS.fetch(perm)\n end",
"def permission\n Ricer::Irc::Permission.by_permission(self.permissions, authenticated?)\n end",
"def parse_permission(name)\n if name.reverse.index(VIEWER.reverse)\n return VIEWER\n elsif name.reverse.index(EDITOR.reverse)\n return EDITOR\n elsif name.reverse.index(USER.reverse)\n return USER\n elsif name.reverse.index(ADMIN.reverse)\n return ADMIN\n else\n @logger.info \"Error in parsing permission\"\n end\n nil\n end",
"def in(store)\n store_class = if store.is_a? Symbol\n MobileStores::STORES[store]\n elsif store.is_a? String\n Object.const_get(store) rescue nil\n elsif store.is_a? Class\n store\n end\n\n raise NotImplementedError, \"#{ store } is not implemented yet.\" if store.nil?\n\n store_class.new\n end",
"def lookup_store (store_name)\n each_store do |regex, name, store|\n return store if regex.match store_name\n end\n nil\n end",
"def parse_permission(name)\n if name.reverse.index(VIEWER.reverse)\n return VIEWER\n elsif name.reverse.index(EDITOR.reverse)\n return EDITOR\n elsif name.reverse.index(USER.reverse)\n return USER\n elsif name.reverse.index(ADMIN.reverse)\n return ADMIN\n else\n @logger.info \"Error in parsing permission\"\n end\n nil\n end",
"def permission_grants\n return @permission_grants\n end",
"def get_permissions(poll_path, polls = read_polls_data)\n if signed_in?\n @user.permissions(poll_path, polls)\n else\n []\n end\n end",
"def p_id(controller, action)\r\n Permission.find_by_controller_and_action(controller.to_s,action.to_s).id\r\nend",
"def show?\n user.super_admin? or user.digital_store_admin?\n end",
"def dav_permission\n @attributes[:dav_permission]\n end",
"def dav_permission\n @attributes[:dav_permission]\n end",
"def provided_store_details?(merchant)\n store = Store.find_by(merchant_id: merchant.id)\n store\n\tend",
"def authorization_from(action, response)\n if action == ENDPOINTS[:store]\n response['customer_id']\n else\n response['transaction_id'] || response['check_transaction_id']\n end\n end",
"def get_permission_menu\n @client.raw('get', '/helpers/menu')\n end",
"def store_admin?\n\n\t\tself.has_role? :store_admin\n\n\tend",
"def show\n authorize @work_type\n end",
"def show\n authorize_action_for @tax_category, at: current_store\n end",
"def show\n authorize_action_for @department, at: current_store\n end",
"def reseller_allow_read(permission)\n return reseller_right(permission) > 0\n end",
"def authorize (permission_name)\n self.allowances.detect {|a| a.permission.name == permission_name.to_s}\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 get_permissions permissions_ds\n # default to rightsMetadata (like standard Hydra) if permissions_ds isn't set\n permissions_ds = \"rightsMetadata\" if permissions_ds.to_s == \"\"\n (datastreams[permissions_ds].groups.map {|x| {:type=>'group', :access=>x[1], :name=>x[0] }} + \n datastreams[permissions_ds].individuals.map {|x| {:type=>'user', :access=>x[1], :name=>x[0]}})\n\n (datastreams[permissions_ds].groups.map {|x| {:type=>'group', :access=>x[1], :name=>x[0] }} + \n datastreams[permissions_ds].individuals.map {|x| {:type=>'user', :access=>x[1], :name=>x[0]}})\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 get_loging_permission\n # Note: we want to use \"find_by_id\" because it's OK to return a nil.\n # If we were to use User.find, it would throw an exception if the user can't be found.\n if session[:user_id]\n @has_permission = @current_user.role \n else\n nil\n end\n end",
"def retrieve_store_class(store)\n # require_relative cannot be used here because the class might be\n # provided by another gem, like redis-activesupport for example.\n require \"active_support/cache/#{store}\"\n rescue LoadError => e\n raise \"Could not find cache store adapter for #{store} (#{e})\"\n else\n ActiveSupport::Cache.const_get(store.to_s.camelize)\n end",
"def get_permissions\n permissions.keys\n end",
"def get_permissions\n permissions.keys\n end",
"def find_class_or_module name\n @store.find_class_or_module name\n end",
"def permission_role_for(target, context, proles=nil)\n auth_scope do\n proles ||= roles_for(context)\n return permission_role_class.find_by(role_foreign_key.to_sym => proles.map(&:id), permission_foreign_key.to_sym => target.id, :context_type => context.class_name, :context_id => context.id)\n end\n end",
"def show\n @permissions = Permission.all\n end",
"def canViewWriteReviewButton(user, store)\n\t \t\t\tif store.nil?\n\t \t\t\t\treturn false\n\t \t\t\tend\n\n\t \t\t\tif user.nil?\n\t \t\t\t\treturn true\n\t \t\t\tend\n\t \t\t\tif isStoreManager(user) || isStoreOwner(user)\n\t \t\t\t\treturn \"store managers cannot review stores\"\n\t \t\t\tend\n\n\t \t\t\tpreviousreview = store.store_reviews.find_by user_id: user.id\n\t \t\t\tif previousreview.nil?\n\t \t\t\t\treturn true\n\t \t\t\telse\n\t \t\t\t\treturn \"you've already reviewed this store\"\n\t \t\t\tend\n\t \t\tend",
"def get_permission(name, return_boolean = true)\n value = nil\n\n role_permissions.each do |permission|\n next if permission.name != name\n\n value = if permission.enabled\n permission.value\n else\n default_value(name)\n end\n end\n\n # Create the role_permissions since it doesn't exist\n role_permissions.create(name: name) if value.nil?\n\n if return_boolean\n value == \"true\"\n else\n value\n end\n end",
"def set_store\n @store = Store.friendly.find(params[:id])\n end",
"def permission_classification\n return @permission_classification\n end",
"def get_user_authority_check(moderator = false, admin = false)\n if moderator\n authority_check = AuthorityCheckService::get_moderator(session, admin)\n else\n authority_check = AuthorityCheckService::get_logged_user(session)\n end\n \n if(not authority_check.get_is_successful)\n flash[:error] = Errors::not_authenticated\n redirect authority_check.get_redirect\n end\n return authority_check\n end",
"def permissions_info(sco_id, filter = nil)\n res = query(\"permissions-info\", \"acl-id\" => sco_id, \"filter\" => filter)\n\n return res.body\n data = XmlSimple.xml_in(res.body)\n if data['permissions'][0]\n return data['permissions'][0]\n end\n #puts YAML::dump(data)\n# if data[\"sco\"][0]\n# return data[\"sco\"][0]\n# end\n end",
"def permissions\n return @permissions\n end",
"def has_permission?(permission:)\n permissions.include? permission.to_sym\n end",
"def grant_permissions( force_reload = false )\n permissions( force_reload ).select( &:is_grant? )\n end",
"def permission_for?(controller)\n permissions.where(:controller => controller).present?\n end",
"def permissions\n @attributes[:permissions]\n end",
"def permissions\n @attributes[:permissions]\n end",
"def provider\n authorization.provider\n end",
"def can? action, service\n allowed_actions = [ALL]\n allowed_actions << decode_action(action)\n permission_index = MasasService.position(service)\n\n allowed_actions.include?(permissions_store[permission_index])\n end",
"def show\n authorize_action_for @user, at: current_store\n track @user\n end",
"def show\n @role_permission = RolePermission.find(params[:id])\n #authorize! :show, @role_permission\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_permission }\n end\n end",
"def solr_field_for(permission_type, permission_category)\n permissions = Hydra.config.permissions[permission_type.to_sym]\n permission_category == 'group' ? permissions.group : permissions.individual\n end",
"def show\n @admin_store = Admin::Store.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_store }\n end\n end",
"def accountant_right(permission)\n if not is_accountant?\n raise \"User is not accountant\"\n elsif acc_group\n right = acc_group.acc_group_rights.find(:first, :conditions => \"acc_rights.name = '#{permission}'\", :include => :acc_right)\n if right\n return right.value.to_i\n else\n return 0\n end\n else\n return 0\n end\n end",
"def store\r\n return @store\r\n end",
"def show\n @all_permissions = Permission.all\n end",
"def show\n authorize @loan_manager_profile\n end",
"def swpmanager_getCollaboratorAdminSuperuserPermission\n return SWPMANAGER_COLLABORATORADMINSUPERUSERPERMISSION if defined? SWPMANAGER_COLLABORATORADMINSUPERUSERPERMISSION\n permission = 2\n if File.exist? \"#{Rails.root}/config/lato/swpmanager.yml\"\n config = YAML.load(\n File.read(File.expand_path(\"#{Rails.root}/config/lato/swpmanager.yml\", __FILE__))\n )\n if config && config['collaborator_admin_superuser_permission']\n permission = config['collaborator_admin_superuser_permission']\n end\n end\n # return result\n return permission\n end",
"def fetch_store\n @store ||= self.store || create_store!\n end",
"def permission_subject_for(target, context)\n auth_scope do\n return permission_subject_class.find_by(subject_foreign_key.to_sym => id, permission_foreign_key.to_sym => target.id, :context_type => context.class_name, :context_id => context.id)\n end\n end",
"def show\n if (@store.related_store_id)\n @related_store = Store.find(@store.related_store_id)\n end\n end",
"def set_store\n @store = Store.friendly.find(params[:id])\n end",
"def permissions\n attribute_prop(5)\n end"
] |
[
"0.6499601",
"0.6216662",
"0.55079794",
"0.54641545",
"0.5447283",
"0.5420848",
"0.5382845",
"0.53765523",
"0.53488135",
"0.5347169",
"0.5325485",
"0.52896684",
"0.528886",
"0.52618",
"0.52474105",
"0.52408576",
"0.52322125",
"0.523144",
"0.5229859",
"0.51618344",
"0.51603085",
"0.5079842",
"0.50739807",
"0.5062963",
"0.50108236",
"0.50048333",
"0.4986484",
"0.49784142",
"0.49783123",
"0.49682122",
"0.49677628",
"0.49407625",
"0.49300972",
"0.4901818",
"0.48908502",
"0.48886505",
"0.4863674",
"0.48530722",
"0.48500726",
"0.4841064",
"0.48338562",
"0.48092437",
"0.48013854",
"0.4797864",
"0.47954464",
"0.47920647",
"0.47850618",
"0.47756335",
"0.47727245",
"0.47640374",
"0.47631654",
"0.47631654",
"0.47500739",
"0.47373474",
"0.4732996",
"0.47210947",
"0.4719518",
"0.4716742",
"0.47143728",
"0.4706676",
"0.47047058",
"0.4682221",
"0.4663679",
"0.46624616",
"0.46624616",
"0.46560547",
"0.46537346",
"0.46512866",
"0.46512866",
"0.46441147",
"0.46389145",
"0.46378636",
"0.46292704",
"0.4625689",
"0.46187156",
"0.46180025",
"0.46128502",
"0.46077356",
"0.4599747",
"0.4592202",
"0.45867524",
"0.45800763",
"0.45762986",
"0.45762986",
"0.45624813",
"0.4559976",
"0.45558968",
"0.45541847",
"0.45533505",
"0.45455542",
"0.4535435",
"0.45273173",
"0.45267633",
"0.45245647",
"0.45233303",
"0.45222276",
"0.45196226",
"0.45179525",
"0.45142967",
"0.45082608"
] |
0.7805503
|
0
|
Returns the workitems for the given store.
|
def workitems (store_name=nil)
return load_user_workitems if store_name == 'users'
return (@workitems[store_name] || []) if store_name
# then return all the workitems the user has access to
wis = load_user_workitems
@store_names.inject(wis) do |r, sname|
r += (@workitems[sname] || [])
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_store_items(opts = {})\n data, _status_code, _headers = get_store_items_with_http_info(opts)\n return data\n end",
"def each (&block)\n\n return unless block\n\n wis = Workitem.find_by_store_name(@store_name)\n\n wis.each { |wi| block.call(wi) }\n end",
"def get_wms_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\n cs = []\n ws.each{ |w| cs += w.wms_stores if w.wms_stores }\n cs\n end",
"def by_wfid(wfid, opts={})\n\n if @context.storage.respond_to?(:by_wfid)\n return @context.storage.by_wfid('workitems', wfid, opts)\n end\n\n wis(@context.storage.get_many('workitems', wfid, opts))\n end",
"def all(opts={})\n\n res = fetch_all(opts)\n\n res.is_a?(Array) ? res.map { |hwi| Ruote::Workitem.new(hwi) } : res\n end",
"def index\n @store_items = StoreItem.all\n end",
"def get_store_items(storeid, item)\n \tresponse = Services::SupermarketClient.new.item_search(storeid, item)\n \tresponse.parsed_response[\"ArrayOfProduct_Commercial\"][\"Product_Commercial\"].each do |item|\n \t\tStoreItem.create(name: item[\"Itemname\"], image: item[\"ItemImage\"], description: item[\"ItemDescription\"], price: item[\"Pricing\"])\n end\n end",
"def index\n @stores = current_account.stores.find(:all)\t\n end",
"def get_data_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\n ds = []\n ws.each{ |w| ds += w.data_stores if w.data_stores }\n ds\n end",
"def get_work_items_for(issue_id)\n get(\"issue/#{issue_id}/timetracking/workitem/\")\n response.parsed_response\n end",
"def getRealTimeStoreItemInfos(itemIdArray, storeIdArray)\r\n return StoreItemInfo.where(item_id: itemIdArray, store_id: storeIdArray, is_category_item: false, in_stock: true)\r\n end",
"def index\n @integration_stores = IntegrationStore.all\n end",
"def index\n @store_managers = StoreManager.all\n end",
"def user_works\n work_ids = Rails.cache.fetch(\"#{cache_key_with_version}/all_work_ids\") { self.works.pluck(:id) } #here is used \"cache_key_with_version\" method, so the resulting cache_key will be something like \"users/1/all_work_ids\" but \"cache_key_with_version\" generates a string based on the model's `id` and `updated_at` attributes. This is a common convention and has the benefit of invalidating the cache whenever the product is updated.\n Work.where(id: work_ids)\n end",
"def find_all_storenames\n\n WiStore.find(:all).collect do |store|\n store.name\n end\n end",
"def items_all\n @work_order_items = WorkOrderItem.by_id\n render json: serialized_work_order_items(@work_order_items)\n end",
"def get_coverage_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\n cs = []\n ws.each{ |w| cs += w.coverage_stores if w.coverage_stores }\n cs\n end",
"def workitems\n\n @expressions.select { |fexp|\n #fexp.is_a?(Ruote::Exp::ParticipantExpression)\n fexp.h.name == 'participant'\n }.collect { |fexp|\n Ruote::Workitem.new(fexp.h.applied_workitem)\n }\n end",
"def get_work_items(team_name, state, *labels)\n get_team_info(team_name)\n\n # TODO This does not include PRs.\n @team_repos.map do |repo|\n get_issues_for_repo(repo, state, *labels)\n end.flatten\n end",
"def store_items\n store = {\n \"yogurts\" => 2,\n \"meat\" => 7,\n \"vegetables\" => 5,\n \"potatoes\" => 2,\n \"rice\" => 1\n }\n return store\nend",
"def index\n\t\t@stores = Store.all\n\tend",
"def get_store (store_name)\n each_store do |regex, s_name, store|\n return store if s_name == store_name\n end\n nil\n end",
"def index\n @store_order_items = StoreOrderItem.all\n end",
"def project_stores(_project)\n _array = []\n _stores = nil\n\n # Adding stores belonging to current project only\n # Stores with exclusive office\n if !_project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(company_id = ? AND office_id = ?)\", _project.company.id, _project.office.id)\n elsif !_project.company.blank? && _project.office.blank?\n _stores = Store.where(\"(company_id = ?)\", _project.company.id)\n elsif _project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(office_id = ?)\", _project.office.id)\n else\n _stores = nil\n end\n ret_array(_array, _stores, 'id')\n # Stores with multiple offices\n if !_project.office.blank?\n _stores = StoreOffice.where(\"office_id = ?\", _project.office.id)\n ret_array(_array, _stores, 'store_id')\n end\n\n # Returning founded stores\n _stores = Store.where(id: _array).order(:name)\n end",
"def project_stores(_project)\n _array = []\n _stores = nil\n\n # Adding stores belonging to current project only\n # Stores with exclusive office\n if !_project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(company_id = ? AND office_id = ?)\", _project.company.id, _project.office.id)\n elsif !_project.company.blank? && _project.office.blank?\n _stores = Store.where(\"(company_id = ?)\", _project.company.id)\n elsif _project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(office_id = ?)\", _project.office.id)\n else\n _stores = nil\n end\n ret_array(_array, _stores, 'id')\n # Stores with multiple offices\n if !_project.office.blank?\n _stores = StoreOffice.where(\"office_id = ?\", _project.office.id)\n ret_array(_array, _stores, 'store_id')\n end\n\n # Returning founded stores\n _stores = Store.where(id: _array).order(:name)\n end",
"def project_stores(_project)\n _array = []\n _stores = nil\n\n # Adding stores belonging to current project only\n # Stores with exclusive office\n if !_project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(company_id = ? AND office_id = ?)\", _project.company.id, _project.office.id)\n elsif !_project.company.blank? && _project.office.blank?\n _stores = Store.where(\"(company_id = ?)\", _project.company.id)\n elsif _project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(office_id = ?)\", _project.office.id)\n else\n _stores = nil\n end\n ret_array(_array, _stores, 'id')\n # Stores with multiple offices\n if !_project.office.blank?\n _stores = StoreOffice.where(\"office_id = ?\", _project.office.id)\n ret_array(_array, _stores, 'store_id')\n end\n\n # Returning founded stores\n _stores = Store.where(id: _array).order(:name)\n end",
"def store\n (@_stores ||= doc.xpath(\"/html/body/div[@id='storeArea']\")).first\n end",
"def get_store_items_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StoreApi.get_store_items ...\"\n end\n # resource path\n local_var_path = \"/store/items\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_name_search'] = opts[:'filter_name_search'] if !opts[:'filter_name_search'].nil?\n query_params[:'filter_unique_key'] = opts[:'filter_unique_key'] if !opts[:'filter_unique_key'].nil?\n query_params[:'filter_published'] = opts[:'filter_published'] if !opts[:'filter_published'].nil?\n query_params[:'filter_displayable'] = opts[:'filter_displayable'] if !opts[:'filter_displayable'].nil?\n query_params[:'filter_start'] = opts[:'filter_start'] if !opts[:'filter_start'].nil?\n query_params[:'filter_end'] = opts[:'filter_end'] if !opts[:'filter_end'].nil?\n query_params[:'filter_start_date'] = opts[:'filter_start_date'] if !opts[:'filter_start_date'].nil?\n query_params[:'filter_stop_date'] = opts[:'filter_stop_date'] if !opts[:'filter_stop_date'].nil?\n query_params[:'filter_sku'] = opts[:'filter_sku'] if !opts[:'filter_sku'].nil?\n query_params[:'filter_price'] = opts[:'filter_price'] if !opts[:'filter_price'].nil?\n query_params[:'filter_tag'] = opts[:'filter_tag'] if !opts[:'filter_tag'].nil?\n query_params[:'filter_items_by_type'] = opts[:'filter_items_by_type'] if !opts[:'filter_items_by_type'].nil?\n query_params[:'filter_bundled_skus'] = opts[:'filter_bundled_skus'] if !opts[:'filter_bundled_skus'].nil?\n query_params[:'filter_vendor'] = opts[:'filter_vendor'] if !opts[:'filter_vendor'].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 => 'PageResourceStoreItem')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StoreApi#get_store_items\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def store_instances(enabled_stores, store_configs)\n fail \"No stores have been enabled, see configuration file\" if enabled_stores.blank?\n fail \"No store configuration present, see configuration file\" if store_configs.blank?\n\n enabled_stores.collect do |store_name|\n STORES[store_name].new(\n store_configs.respond_to?(store_name) ? store_configs.send(store_name) : {}\n )\n end\n end",
"def set_store\n\t\t\t@store = Store.includes(stocks: :item).find(params[:id])\n\t\tend",
"def get_headers (user, store_name, limit)\n\n authorized?(user, store_name, :read)\n\n l = []\n\n get_store(store_name).each do |workitem, locked|\n break if limit and l.size >= limit\n l << [ workitem, locked ]\n end\n\n l\n end",
"def all\n # Accessing the store requires a transaction \n @store.transaction do\n # Create an array with the values for each key \n @store.roots.map { |id| @store[id] }\n end\n end",
"def index\n @statements = @store.statements.includes(:store, :statement_items)\n end",
"def store_index(search_store, store_type)\n\n raise ArgumentError, 'search_store is nil' if search_store.nil?\n Log.instance.debug \"Looking for store '#{search_store}'\"\n bops_availablility = false\n\n if macys?\n bops_availablility = !bops_store_container_elements.empty? || !bops_store_container_selected_elements.empty?\n else\n store_header_text = store_container_element.div_element(:class => 'bops_so_storeAvailabilityContainer').div_element(:class => 'bops_so_storeAvailability').text\n bops_availablility = store_header_text.include?'Buy online'\n end\n\n case store_type\n when 'bops_store'\n bops_store_list.each_with_index do |store, index|\n Log.instance.debug \"Comparing against store: '#{store}'\"\n match = store.all? { |key, value| value == search_store[key] }\n if match\n Log.instance.debug 'Found a match.'\n return index\n end\n end\n when 'available_store'\n bops_store_count = 0\n if bops_availablility\n bops_store_count = bops_store_list.count\n end\n \n purchase_in_store_list.each_with_index do |store, index|\n Log.instance.debug \"Comparing against store: '#{store}'\"\n match = store.all? { |key, value| value == search_store[key] }\n if match\n Log.instance.debug 'Found a match.'\n if macys?\n return index\n else\n return index + bops_store_count\n end\n end\n end\n end\n raise StoreNotFoundError, \"Unable to find a store that matches '#{search_store}'.\"\n end",
"def stores\n @stores ||= config.maildirstores.map(&:path)\n end",
"def fetch(workitem_or_fei)\n\n hfei = Ruote::FlowExpressionId.extract_h(workitem_or_fei)\n\n @context.storage.get('workitems', to_id(hfei))\n end",
"def index\n @store = store.index\n end",
"def get_store_item(id, opts = {})\n data, _status_code, _headers = get_store_item_with_http_info(id, opts)\n return data\n end",
"def index\n @work_item_types = WorkItemType.all\n end",
"def get_submissions\n puts \"== searching for whoishiring submissions ==\"\n @items ||= HiringTrends::ItemSearch.new.execute\n end",
"def get_work_items(item_id = nil, include_archived = nil)\n name = @table_name.to_s\n sql = @model.select(:work_item_id, :description, :guide, :status, :username, :archived).from(name.to_sym)\n sql = sql.where(archived: true?(include_archived)) if include_archived\n sql = sql.where(work_item_id: item_id.to_i) if item_id\n sql = _format_sql(sql.sql)\n @logger.info(\"Prepared GET query: #{sql}\")\n results = run_statement(sql, \"get\")\n response = parse_work_items(results)\n @logger.info(\"Received GET response: #{response}\")\n response\n end",
"def group(store)\n groups.find_by(store: store)\n end",
"def index\n @admin_stores = Store.all\n end",
"def all\n @store.transaction do\n @store.roots.map {|id| @store[id] }\n end\n end",
"def items\n @items ||= fetch_items(contents)\n end",
"def index\n @stores = Stock.all\n end",
"def job_items\n job_arguments(1)\n end",
"def workers_all\n @work_order_workers = WorkOrderWorker.by_id\n render json: serialized_work_order_workers(@work_order_workers)\n end",
"def items(opts = {})\n Item.all(opts)\n end",
"def index\n @stores = @stores.page(params[:page]).per(10)\n end",
"def list_stores\n @stores = Store.where(\"level = ?\", 2)\n if @stores.present?\n render :index, status: :ok\n else\n @message = \"no store found\"\n render :error, status: :not_found\n end\n end",
"def get_results(store,pricelist)\n storename = 'QFC'\n visit store\n page.driver.browser.switch_to.frame(0)\n page.execute_script \"wishabi.app.gotoGridView()\"\n #sleep 1\n page.first(:button,\"Meat & Seafood\").click\n $meaty_targets.each do |m|\n page.all(:xpath,\"//li[@class='item']\").each do |node|\n item_name = node.first(:xpath,\"./div[@class='item-name']\").text\n item_price = node.first(:xpath,\"./div[@class='item-price']\").text\n pricelist[\"#{item_name}\"] = item_price\n scan_price(storename, item_name, m, item_price)\n end\n end\n end",
"def get_work\n client.make_request('/get-work', 'post', params: {})\n end",
"def windows_store\n self.in(WindowsStore)\n end",
"def index\n @stores = @commerce.stores\n end",
"def items\n if @items.nil?\n raise NoData.new(\"No data has been retrieved yet.\", self)\n else\n @items.collect do |hsh|\n item = self.class.item_class.new\n item.store_result(:attrs => hsh)\n item\n end\n end\n end",
"def store\r\n return @store\r\n end",
"def project_stores(_project)\n _array = []\n _stores = nil\n\n # Adding global stores, not JIT, belonging to current project's company\n if !_project.company.blank?\n _stores = Store.where(\"company_id = ? AND office_id IS NULL AND supplier_id IS NULL\", _project.company_id)\n elsif session[:company] != '0'\n _stores = Store.where(\"company_id = ? AND office_id IS NULL AND supplier_id IS NULL\", session[:company].to_i)\n else\n _stores = session[:organization] != '0' ? Store.where(\"organization_id = ? AND office_id IS NULL AND supplier_id IS NULL\", session[:organization].to_i) : Store.all\n end\n ret_array(_array, _stores)\n # Adding stores belonging to current project\n if !_project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(company_id = ? AND office_id = ?)\", _project.company.id, _project.office.id)\n elsif !_project.company.blank? && _project.office.blank?\n _stores = Store.where(\"(company_id = ?)\", _project.company.id)\n elsif _project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(office_id = ?)\", _project.office.id)\n else\n _stores = stores_dropdown\n end\n ret_array(_array, _stores)\n # Adding JIT stores\n _ret = session[:organization] != '0' ? Store.where(\"organization_id = ? AND company_id IS NULL AND NOT supplier_id IS NULL\", session[:organization].to_i) : Store.where(\"(company_id IS NULL AND NOT supplier_id IS NULL)\")\n ret_array(_array, _ret)\n # Returning founded stores\n _stores = Store.where(id: _array).order(:name)\n end",
"def keys\n @store.keys\n end",
"def index\n @shifts = Shift.all\n @shiftsmanager = Shift.where(assignment_id: Assignment.for_store(current_user.employee.current_assignment.store_id))\n end",
"def get_workitem (args)\n\n args.find { |a| a.is_a?(WorkItem) }\n end",
"def _all\n out = {}\n ids.each {|i| @store.transaction(true) {out[i] = @store[i]}}\n out\n end",
"def hops_store_list\n $tracer.trace(__method__)\n #return GameStopHopsStoreList.new(jquery(\"table[id~='searchResults']> tbody > tr\"))\n return GameStopHopsStoreList.new(table.id(\"/searchResults/\").tbody.tr, __method__)\n end",
"def works\n Work.all.select {|work| work.make_id == id}\n end",
"def in(store)\n store_class = if store.is_a? Symbol\n MobileStores::STORES[store]\n elsif store.is_a? String\n Object.const_get(store) rescue nil\n elsif store.is_a? Class\n store\n end\n\n raise NotImplementedError, \"#{ store } is not implemented yet.\" if store.nil?\n\n store_class.new\n end",
"def find_store_names\n\n if @user.admin?\n find_all_storenames\n else\n @permissions.keys.sort\n end\n end",
"def get_items\n if get_data_type == TYPE_LIST\n return get_list_items\n elsif get_data_type == TYPE_STEMCELL_LINUX\n return get_linux_stemcells\n elsif get_data_type == TYPE_STEMCELL_WINDOWS\n return get_windows_stemcells\n else\n raise \"Items not available for type '#{get_data_type}\"\n end\n end",
"def getDeliverableStores(deliveryZipCode)\n begin\n serviceAreaId = ServableZipCode.getZipCodeServiceAreaId(deliveryZipCode)\n allDeliverableStores = Store.where(service_area_id: serviceAreaId)\n storeHash = {}\n allDeliverableStores.each do |store|\n storeHash[store.id] = store\n end\n return storeHash\n rescue => error\n renderError(HaigyManageConstant::Error::UNEXPECTED_ERROR, [\"Unable to get deliverable stores. (\", error.message, \")\"].join(\"\"))\n return nil\n end\n end",
"def getDeliverableStores(deliveryZipCode)\n begin\n serviceAreaId = ServableZipCode.getZipCodeServiceAreaId(deliveryZipCode)\n allDeliverableStores = Store.where(service_area_id: serviceAreaId)\n storeHash = {}\n allDeliverableStores.each do |store|\n storeHash[store.id] = store\n end\n return storeHash\n rescue => error\n renderError(HaigyManageConstant::Error::UNEXPECTED_ERROR, [\"Unable to get deliverable stores. (\", error.message, \")\"].join(\"\"))\n return nil\n end\n end",
"def find_work_order_items\n if !params.has_key?(:work_order_id) || !is_numeric?(params[:work_order_id]) || params[:work_order_id] == '0'\n render json: :bad_request, status: :bad_request\n else\n @work_order_items = WorkOrderItem.belongs_to_work_order(params[:work_order_id])\n render json: :not_found, status: :not_found unless @work_order_items.present?\n end\n end",
"def stores_list\n $tracer.trace(format_method(__method__))\n return ProfileStoreList.new(@tag.find.span.className(create_ats_regex_string(\"ats-storepanel\")), format_method(__method__))\n end",
"def purchase_in_store_list\n stores = []\n if macys?\n purchase_in_store_container_elements.each do |container|\n\n city, state = container.span_element(:class => 'line', :index => 4).text.split(',')\n state.strip!\n\n stores << {\n 'store_name' => container.span_element(:index => 0).text,\n 'address_line_1' => container.span_element(:class => 'line', :index => 0).text,\n 'address_line_2' => container.span_element(:class => 'line', :index => 1).text,\n 'address_city' => city,\n 'address_state' => state,\n 'address_zip_code' => container.span_element(:class => 'line', :index => 4).text,\n 'distance' => container.span_element(:class => 'miles-bops').text,\n 'store_hours' => container.div_element(:class =>'store-hours').text,\n }\n end\n else\n instore_availability = false\n store_header = store_container_element.div_elements(:class => 'bops_so_storeAvailability').map(&:text)\n store_header.each do |header|\n if header.include?('not available for our buy online')\n instore_availability = true\n break\n end\n end\n raise 'No in-store available stores are found' unless instore_availability\n\n store_count = 0\n container = store_container_element.div_elements(:class => 'bops_so_storeResultWrapper')\n\n if store_availability_message.include?('Buy online')\n store_count = store_count_div[/(\\d+)/, 1].to_i\n total_store_count = container.count - 1\n elsif store_availability_message.include?('not available for our buy online')\n total_store_count = container.count - 1\n end\n\n not_available_stores = false\n store_header.each do |header|\n if header.include?('Not available at')\n not_available_stores = true\n break\n end\n end\n\n if not_available_stores\n total_store_count -= 1\n end\n\n (store_count..total_store_count).each do |i|\n location_container = container[i].div_element(:class => 'bops_so_storeLocation')\n hours_container = container[i].div_element(:class => 'bops_so_storeHoursContainer')\n city_state_zip = location_container.div_element(:index => 2).text\n\n stores << {\n 'store_name' => location_container.div_element(:index => 0).text,\n 'address_line_1' => location_container.div_element(:index => 1).text,\n 'address_line_2' => '',\n 'address_city' => city_state_zip[/([^,]+)/, 1], # Everything up to the first ,\n 'address_state' => city_state_zip[/,(\\w{2})/, 1], # First two characters after the ,\n 'address_zip_code' => city_state_zip[/(\\d{5}(-\\d{4})?)$/, 1], # Last 5 digits (plus optional 4 digits)\n 'phone_number' => location_container.div_element(:index => 3).text,\n 'distance' => location_container.span_element(:class => 'bops_so_storeMiles').text.sub(' View Map', '').sub(' Hide Map', ''),\n 'store_hours' => hours_container.text\n }\n end\n end\n stores\n end",
"def select_bops_store(store, store_type)\n index = store_index(store, store_type)\n select_store_button_elements[index].click\n save_button_element.click\n end",
"def shop\n return shops[0]\n end",
"def index\n if current_user.admin?\n @stores = Store.all\n else\n @stores = current_user.stores\n end\n\n render json: @stores\n end",
"def stores\n unless @stores\n page = request(store_url)\n raise StoreRequestError unless page.code == \"200\"\n\n xml = Nokogiri::XML(page.body)\n \n @stores = {}\n \n xml.css('GotoURL SetFontStyle').each do |name_node|\n name = name_node.text\n url = name_node.parent.parent['url']\n store_id = url.match(/storeFrontId=([0-9]+)/)[1] rescue nil\n @stores[name] = store_id if store_id && name\n end\n end\n @stores\n end",
"def index\n\n if params[:certification_id]\n @workitems = Workitem.where(:certification_id => params[:certification_id], :user_id => current_user.id)\n else\n @workitems = Workitem.where(:user_id => current_user.id)\n end\n\n end",
"def get_shelves\n shelves = [@shelf_ag, @shelf_hp, @shelf_qz]\n return shelves\n end",
"def get_items\n @items\n end",
"def items\n return @items\n end",
"def item_list_windows\n instance_variables.map{ |v|instance_variable_get v}.select{|w|w.is_a?(Window_ShopItems) }\n end",
"def items\n return [] if self[:item_display].blank? && self[:item_display_struct].blank?\n\n @items ||= self[:item_display_struct]&.map do |item_display|\n Holdings::Item.new(item_display, document: self)\n end&.sort_by(&:full_shelfkey)\n\n # legacy implementation until everything that needs it has a item_display_struct\n @items ||= self[:item_display]&.map do |item_display|\n Holdings::Item.from_item_display_string(item_display, document: self)\n end&.sort_by(&:full_shelfkey)\n\n @items ||= []\n end",
"def get_workspaces &block\n response = self.search :workspaces => nil\n doc = Nokogiri::XML(response)\n workspaces = doc.xpath(Workspace.root_xpath).collect{|w| w.text.to_s }\n list Workspace, workspaces, {}, &block\n end",
"def workitem(fei=nil)\n\n return fetch_workitem(fei) if fei\n\n @workitem ? @workitem : applied_workitem\n end",
"def items\n return @items\n end",
"def items\n return @items\n end",
"def items\n Taco.storage.items\n end",
"def store\n _store_id = store_id\n ::Spree::User.logger.debug \"| ByParameters: store_id #{_store_id}\"\n store = _store_id ? ::Spree::Store.where(id: _store_id).first : nil\n store || Spree::Store.new\n end",
"def show\n @created_stores = @user.created_stores.search(params[:search])\n @created_stores = @created_stores.by_state(params[:state]) if params[:state].present?\n @created_stores = @created_stores.by_type(params[:type]) if params[:type].present?\n @created_stores = @created_stores.order(:name).page(params[:page])\n end",
"def fetch_store\n @store ||= self.store || create_store!\n end",
"def mgs_hops_store_list\n $tracer.trace(__method__)\n return GameStopMobileStoreList.new(ToolTag.new(section.id(\"hops_store_list\").ol.li, __method__, self), self)\n\tend",
"def storage_all_items\n storage_items + storage_equip_items\n end",
"def contexts\n @store.contexts\n end",
"def work_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_worker, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end",
"def store_information\n get('store')\n end"
] |
[
"0.6577767",
"0.6322996",
"0.6125597",
"0.5964179",
"0.59063333",
"0.5893999",
"0.5842434",
"0.571832",
"0.5678437",
"0.5545342",
"0.55338",
"0.5500814",
"0.54911095",
"0.54763865",
"0.5455842",
"0.5428017",
"0.54177606",
"0.54126227",
"0.5400239",
"0.53830254",
"0.53824455",
"0.5305733",
"0.52831113",
"0.52716124",
"0.52716124",
"0.52716124",
"0.5265848",
"0.5264057",
"0.52271783",
"0.52271783",
"0.52271783",
"0.52271783",
"0.52271783",
"0.52250963",
"0.5215264",
"0.51963156",
"0.5189222",
"0.51830494",
"0.5172578",
"0.5152579",
"0.5152526",
"0.51434666",
"0.513696",
"0.5135294",
"0.5131622",
"0.51302385",
"0.5125247",
"0.51232505",
"0.51228",
"0.5105352",
"0.5093411",
"0.507777",
"0.50701207",
"0.5068766",
"0.5052282",
"0.5040529",
"0.5036959",
"0.50354844",
"0.50249785",
"0.50212747",
"0.5015876",
"0.50100684",
"0.5006367",
"0.5005959",
"0.49932644",
"0.4983342",
"0.4980325",
"0.49712667",
"0.4964771",
"0.49628702",
"0.49511713",
"0.4933885",
"0.49276114",
"0.49276114",
"0.49239624",
"0.49233952",
"0.49224725",
"0.4916195",
"0.49085176",
"0.49080914",
"0.49073473",
"0.49004123",
"0.49001038",
"0.48932034",
"0.48902035",
"0.48897994",
"0.4876038",
"0.4861538",
"0.485955",
"0.48502123",
"0.48502123",
"0.4847906",
"0.4838523",
"0.48275036",
"0.48138422",
"0.48077938",
"0.47999337",
"0.4797301",
"0.47943372",
"0.47916734"
] |
0.804833
|
0
|
Returns the list of store[ names]s to which the user can delegate. If a workitem is passed, makes sure to remove the workitem current store name from the resulting list.
|
def delegation_targets (workitem=nil)
names = @store_names.find_all { |n| permission(n).may_delegate? }
names.delete(workitem.store_name) if workitem
names
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def workitems (store_name=nil)\n\n return load_user_workitems if store_name == 'users'\n return (@workitems[store_name] || []) if store_name\n\n # then return all the workitems the user has access to\n\n wis = load_user_workitems\n\n @store_names.inject(wis) do |r, sname|\n r += (@workitems[sname] || [])\n end\n end",
"def store_names\n\n names = @store_names.dup\n names << \"users\" unless names.include?(\"users\")\n names\n end",
"def find_store_names\n\n if @user.admin?\n find_all_storenames\n else\n @permissions.keys.sort\n end\n end",
"def find_all_storenames\n\n WiStore.find(:all).collect do |store|\n store.name\n end\n end",
"def valid_store_name\n [\"MY\", \"CA\", \"ROOT\", \"AUTHROOT\", \"DISALLOWED\", \"SPC\", \"TRUST\", \"TRUSTEDPEOPLE\", \"TRUSTEDPUBLISHER\", \"CLIENTAUTHISSUER\", \"TRUSTEDDEVICES\", \"SMARTCARDROOT\", \"WEBHOSTING\", \"REMOTE DESKTOP\"]\n end",
"def isStoreManager(user) \t \t\t\t\n\t \t\t\tif user.nil?\n\t \t\t\t\treturn false\n\t \t\t\telse\n\t \t\t\t\t# returns all stores that this user is a storemanager of\n\t \t\t\t\tstores = Store.with_role(:storemanager, user)\t \t\t\t\t\n\t \t\t\t\t\n\t \t\t\t\tif stores.empty? #returns empty array, not nil\n\t \t\t\t\t\treturn false\n\t \t\t\t\telse \n\t \t\t\t\t\treturn true\n\t \t\t\t\tend\n\t \t\t\tend\n\t \t\tend",
"def get_wms_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\n cs = []\n ws.each{ |w| cs += w.wms_stores if w.wms_stores }\n cs\n end",
"def stores\n @stores ||= config.maildirstores.map(&:path)\n end",
"def stores_list\n $tracer.trace(format_method(__method__))\n return ProfileStoreList.new(@tag.find.span.className(create_ats_regex_string(\"ats-storepanel\")), format_method(__method__))\n end",
"def canManageStore(user, store)\n\t \t\t\t\n\t \t\t\tif user.nil? || store.nil?\n\t \t\t\t\treturn false\n\t \t\t\tend\n\n\t \t\t\tif isUserStoreManagerOf(user,store) || isUserStoreOwnerOf(user,store) || user.has_role?(:admin)\n\t \t\t\t\treturn true\n\t \t\t\telse\n\t \t\t\t\treturn false\n\t \t\t\tend\n\t \t\tend",
"def get_store (store_name)\n each_store do |regex, s_name, store|\n return store if s_name == store_name\n end\n nil\n end",
"def isUserStoreManagerOf(user, store) \n\t \t\t\tif user.nil? || store.nil?\n\t \t\t\t\treturn false\n\t \t\t\telse \n\t \t\t\t\treturn user.has_role? :storemanager, store\n\t \t\t\tend\n\t \t\tend",
"def store_name\n promo = self.promo\n branches = promo.branches\n return unless branches.any?\n return branches.first.store.name\n end",
"def get_data_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\n ds = []\n ws.each{ |w| ds += w.data_stores if w.data_stores }\n ds\n end",
"def get_store_items(opts = {})\n data, _status_code, _headers = get_store_items_with_http_info(opts)\n return data\n end",
"def remove_item(grocery_list, item_name)\n\tgrocery_list.delete(item_name)\n\treturn grocery_list\nend",
"def remove_item(grocery_list, item_name)\n\tgrocery_list.delete(item_name)\n\treturn grocery_list\nend",
"def isStoreOwner(user)\n\t \t\t\tif user.nil?\n\t \t\t\t\treturn false\n\t \t\t\telse\n\t \t\t\t\t# returns all stores that this user is a storeowner of\n\t \t\t\t\tstores = Store.with_role(:storeowner, user)\n\t \t\t\t\tif stores.empty? #returns empty array, not nil\n\t \t\t\t\t\treturn false\n\t \t\t\t\telse \n\t \t\t\t\t\treturn true\n\t \t\t\t\tend\n\t \t\t\tend\n\t \t\tend",
"def list_remove(hash_items, item_name)\n hash_items.delete(item_name)\n return hash_items\nend",
"def remove_item(grocery_list, item_name)\r\n\tgrocery_list.delete(item_name)\r\n\treturn grocery_list\r\nend",
"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 current_store\n user = current_user\n return nil unless user\n return nil unless session[:store_id]\n user.stores.get(session[:store_id])\nend",
"def get_headers (user, store_name, limit)\n\n authorized?(user, store_name, :read)\n\n l = []\n\n get_store(store_name).each do |workitem, locked|\n break if limit and l.size >= limit\n l << [ workitem, locked ]\n end\n\n l\n end",
"def may_edit? (workitem)\n (is_admin? or\n workitem.store_name == self.login or\n self.group_names.include?(workitem.store_name))\n end",
"def pstores_names\n @pstores_names ||= begin\n Dir[\"./data/pstore/*.pstore\"].collect do |path|\n File.basename(path)\n end\n end\n end",
"def mgs_hops_store_list\n $tracer.trace(__method__)\n return GameStopMobileStoreList.new(ToolTag.new(section.id(\"hops_store_list\").ol.li, __method__, self), self)\n\tend",
"def remove_from_grocery_list(grocery_list, item_name)\n # steps: remove item from hash\n grocery_list.delete(item_name.to_sym)\n # output: explicit return updated hash\n grocery_list\nend",
"def removeAllAssignedItems _args\n \"removeAllAssignedItems _args;\" \n end",
"def remove_item(list_item,user_list)\n user_list.delete(list_item)\n user_list\nend",
"def isUserStoreOwnerOf(user, store)\n\t \t\t\tif user.nil? || store.nil?\n\t \t\t\t\treturn false\n\t \t\t\telse\n\t \t\t\t\treturn user.has_role? :storeowner, store\n\t \t\t\tend\n\t \t\tend",
"def cache_store_and_namespace_to_strip\n store = cache.store\n # Store can be a ActiveSupport::Cache::RedisCacheStore, a Redis::Store object, or a Redis object.\n # If it is a ActiveSupport::Cache::RedisCacheStore, then we need to get the redis object in\n # order to get keys from it.\n store = store.redis if store.respond_to?(:redis)\n if store.respond_to?(:data) # Redis::Store already stripped namespaced\n store = store.data\n [store, nil]\n else\n # Redis object (which is all we have available in the case of a\n # ActiveSupport::Cache::RedisCacheStore) unfortunately returns keys with namespace prefix in\n # each key, so we need to strip this out (Redis::Store does this already; see store.data.keys above)\n [store, cache_namespace]\n end\n end",
"def get_permissions (user, store_name)\n s = \"\"\n [ :read, :write, :delegate ].each do |action|\n s << action.to_s[0, 1] \\\n if @auth_system.authorized?(user, store_name, action)\n end\n s\n end",
"def index\n if store\n if super_user?\n redirect_to edit_store_path(store)\n else\n if store.current_menu\n redirect_to menu_path(store.current_menu)\n else\n redirect_to menus_path, :alert => \"#{store.name} is currently closed.\"\n end\n end\n else\n redirect_to new_store_path\n end\n end",
"def index\n top_level_folders = current_user.top_level_folders\n redux_store(\"configureStore\", props: {data: top_level_folders})\n end",
"def remove_items(shopping_list, item)\n shopping_list.delete(item)\nend",
"def index\n @store_managers = StoreManager.all\n end",
"def remove_item(item, grocery_list)\n grocery_list.delete(item)\n return grocery_list\nend",
"def remove_item(item, grocery_list)\n grocery_list.delete(item)\n return grocery_list\nend",
"def index\n wl = current_user.watchlists.select(:name).distinct\n @watchlists = wl.map {|wlname| Watchlist.find_by(name: wlname.name) }\n end",
"def remove_item(item_name, grocery_list)\n grocery_list.delete(item_name)\n grocery_list\n end",
"def lookup_store (store_name)\n each_store do |regex, name, store|\n return store if regex.match store_name\n end\n nil\n end",
"def remove_item(list, item_name)\n list.delete(item_name.to_sym)\n list\nend",
"def store_as\n @store_as ||= (@options[:store_as].try(:to_s) || name.to_s)\n end",
"def remove_all\n store = @store\n @store = {}\n store.values.map(&:last)\n end",
"def each (&block)\n\n return unless block\n\n wis = Workitem.find_by_store_name(@store_name)\n\n wis.each { |wi| block.call(wi) }\n end",
"def remove_item(items, groceries_list)\n groceries_list.delete(items)\nend",
"def remove_item(list, item_name)\n list.delete(item_name)\n list\nend",
"def windows_store\n self.in(WindowsStore)\n end",
"def permission (store_name)\n\n return RWD_STORE_PERMISSION if @user.admin?\n return RWD_STORE_PERMISSION if store_name == 'users'\n @permissions[store_name]\n end",
"def remove\n @store.shift\n end",
"def list_remover(list_input_remover, item_name_remove)\n list_input_remover.delete(item_name_remove)\nend",
"def store_instances(enabled_stores, store_configs)\n fail \"No stores have been enabled, see configuration file\" if enabled_stores.blank?\n fail \"No store configuration present, see configuration file\" if store_configs.blank?\n\n enabled_stores.collect do |store_name|\n STORES[store_name].new(\n store_configs.respond_to?(store_name) ? store_configs.send(store_name) : {}\n )\n end\n end",
"def remove_item(grocery_list, item)\r\n\tgrocery_list.delete(item)\r\n\tgrocery_list\r\nend",
"def remove_item_list\n if @listing.job? \n ['Filled Position', 'Removed Job']\n elsif @listing.event? \n ['Event Cancelled', 'Event Ended']\n else\n ['Changed Mind', 'Donated Item', 'Gave Away Item', 'Sold Item']\n end\n end",
"def remove_item(grocery_list, item)\n\tif grocery_list.include?(item.to_sym)\n\t\tgrocery_list.delete(item.to_sym)\n\telse\n\t\tputs \"item name invalid\"\n\tend\nend",
"def add_stores (names, store_map)\n names.each do |name|\n #hp = OpenWFE::HashParticipant.new\n #$engine.register_participant(name, hp)\n hp = $engine.register_participant(name, OpenWFE::YamlParticipant)\n store_map[name] = hp\n end\nend",
"def remove_item(list, item_name)\n\t{|list| list.delete(\"mangoes\")}\nend",
"def remove_item(grocery_list, item)\n grocery_list.delete(item)\n return grocery_list\nend",
"def remove_item(list, name)\n list.delete(normalize_string(name))\n return list\nend",
"def remove_items(item, grocery_list)\n grocery_list.delete(item)\nend",
"def names_list\n backend.queue_names\n end",
"def remove_item(list, item_name)\r\n\tif list.has_key?(item_name)\r\n\t\tlist.delete(item_name)\r\n\tend\r\n\tlist\r\nend",
"def categories_items_without(user)\n all_items = self.all_active_items\n categories_given_without(all_items,user)\n end",
"def managers\n @members = self.user_workspace_memberships.where({:manager => 1})\n @users = []\n @members.each do |member|\n @users.push member.user if member.user\n end\n return @users\n end",
"def search (query_string)\n\n OpenWFE::Extras::Workitem.search(query_string, store_names).find_all do |wi|\n\n @user.admin? or (\n wi.store_name != 'users' || wi.participant_name == @user.name)\n end\n end",
"def process_menu_authorization user, items\n to_delete = []\n if items\n for item in items\n if not item.allow_all_access and not user.authorized?(item.controller, item.action)\n to_delete << item\n end\n item.items = process_menu_authorization user, item.items\n end\n items -= to_delete\n end\n items\n end",
"def move_store store\n if @store && @store != store\n raise NotImplementedError.new('An object can\\'t be moved to another store')\n elsif @store != store\n @store = store\n end\n self.store\n end",
"def store name = nil\n name ? @store = name : @store\n end",
"def store_key; @store.to_sym; end",
"def items_to_check\n User.not_admins\n end",
"def remove_item(list, item_name)\r\n list.delete(item_name)\r\n list\r\nend",
"def index\n @admin_stores = Store.all\n end",
"def remove_item (grocery_list, item)\n\tif grocery_list[item] == nil\n\t\tputs \"Item not on list.\"\n\telse\n\t\tgrocery_list.delete(item)\n\tend\n\treturn grocery_list\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def remove_item(list, item_name)\n\tlist.delete(item_name)\n\tlist\nend",
"def dianping_shop_checkins(shop)\n if shop is_a? Shop\n users = Shop.find_people_via_checkins\n end\n return users || []\nend",
"def subscribers\n store[name].map { |r| r.contents } \n end",
"def session_stores\n @session_stores ||= {}\n end",
"def remove_item(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend",
"def remove_item(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend",
"def item_names\n @registry.keys\n end",
"def remove_from_list\n empty_list if @mylist.length <= 0\n item_names = @mylist.map { |item| item['name'] }\n item_names << 'Back'\n selection = @prompt.select('Which item would you like to remove?'.colorize(:light_green), item_names)\n @menu.my_list if selection == 'Back'\n @mylist.each_with_index do |item, index|\n @mylist.delete_at(index) if item['name'] == selection\n end\n update_file\n end",
"def dock_apps(user = CURRENTUSER)\n\n\tplist = CFPropertyList::List.new(:file => \"/Users/#{user}/Library/Preferences/com.apple.dock.plist\")\n\tresults=CFPropertyList.native_types(plist.value)\n\tapps=[]\n\tfor key, value in results['persistent-apps']\n\t\tfor key, value in key\n\t\t\tif value.class == Hash\n\t\t\t\tfor x, y in value\n\t\t\t\t\tif x == \"file-label\"\n\t\t\t\t\t\tapps.push(y)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\treturn apps\nend",
"def remove_item(item, grocery_list)\n grocery_list.delete(item)\n # print_list(grocery_list)\n grocery_list\nend",
"def remove_item(list, item)\r\n# input: shopping list and item to be removed\r\n# steps: \r\n # Use shopping list as input\r\n # Use item to be removed as input\r\n # Remove the item from the list if it exists on the list\r\n list.delete(item)\r\n# output: shopping list with item removed\r\n printlist(list)\r\nend",
"def remove_item(list, item_name)\n if list.has_key?(item_name)\n list.delete(item_name)\n end\n list\nend",
"def remove_item(shopping_list, item)\n shopping_list.delete(item)\nend",
"def user_item_names(record)\n record.user.send(item_plural(record)).all.collect { |item| item.name.downcase }\n end",
"def group(store)\n groups.find_by(store: store)\n end",
"def remove_intermediate(station_name)\n self.stations.delete_if { |s| s.name == station_name && stations.index(s) != 0 && stations.index(s) != stations.size - 1 }\n end",
"def stick_store_request(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"stick store-request \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def index\n @stores = current_account.stores.find(:all)\t\n end",
"def item_list_windows\n instance_variables.map{ |v|instance_variable_get v}.select{|w|w.is_a?(Window_ShopItems) }\n end",
"def store_all_window_names variable_name\r\n command 'storeAllWindowNames', variable_name\r\n end",
"def prune(items)\n wants = []\n # owners = []\n items.each do |item|\n # owners << item.user\n item.user.wants.each do |want|\n if want.possession.trade_id == self.id\n wants << want.possession\n end\n end\n end\n # wants = []\n # owners.each do |owner|\n # owner.wants.each do |want|\n # if want.possession.trade_id == self.id\n # wants << want.possession\n # end\n # end\n # end\n items.each do |item|\n if !wants.include?(item)\n items.delete(item)\n end\n end\n items\n end",
"def get_alternate_stores(query_obj=nil)\n uri = URI.parse(@uri + \"/AlternateStores\")\n results = get(uri,query_obj)\n end",
"def remove_item(list_items, item_name)\n list_items.delete(item_name)\nend",
"def delete_store!\n FileUtils.remove_dir( self.send(:store_path), :force )\n expire_selector\n end",
"def clean_storeconfigs(node, do_unexport=false)\n return unless Puppet[:storeconfigs] && Puppet.features.rails?\n require 'puppet/rails'\n Puppet::Rails.connect\n unless rails_node = Puppet::Rails::Host.find_by_name(node)\n Puppet.notice \"No entries found for #{node} in storedconfigs.\"\n return\n end\n\n if do_unexport\n unexport(rails_node)\n Puppet.notice \"Force #{node}'s exported resources to absent\"\n Puppet.warning \"Please wait until all other hosts have checked out their configuration before finishing the cleanup with:\"\n Puppet.warning \"$ puppet node clean #{node}\"\n else\n rails_node.destroy\n Puppet.notice \"#{node} storeconfigs removed\"\n end\n end"
] |
[
"0.6875334",
"0.6045649",
"0.6026068",
"0.56866467",
"0.5318249",
"0.5267477",
"0.5237851",
"0.5135215",
"0.5087775",
"0.5026814",
"0.5006327",
"0.497881",
"0.49108797",
"0.4821121",
"0.47736892",
"0.4773425",
"0.4773425",
"0.4730687",
"0.4725012",
"0.47026858",
"0.46875027",
"0.46781597",
"0.46707425",
"0.46641913",
"0.46625507",
"0.46349388",
"0.45997706",
"0.45909187",
"0.45877868",
"0.45608452",
"0.45520577",
"0.45467824",
"0.45408025",
"0.4537127",
"0.45171595",
"0.45171025",
"0.44948778",
"0.44948778",
"0.44892266",
"0.4478501",
"0.44719338",
"0.44679064",
"0.4465032",
"0.4464493",
"0.44589493",
"0.44534588",
"0.44404024",
"0.44395357",
"0.44382504",
"0.44294405",
"0.44223306",
"0.44190258",
"0.44168702",
"0.44161806",
"0.4412507",
"0.44113573",
"0.44065383",
"0.44064072",
"0.44021162",
"0.44012377",
"0.43942124",
"0.43901438",
"0.43834743",
"0.4382585",
"0.43814442",
"0.43632892",
"0.43575144",
"0.43533647",
"0.4353081",
"0.43487442",
"0.4339765",
"0.4334186",
"0.43316382",
"0.4331212",
"0.4331212",
"0.4331212",
"0.432955",
"0.4328716",
"0.43283358",
"0.43027183",
"0.43027183",
"0.42974803",
"0.42947537",
"0.42927366",
"0.42866138",
"0.42826152",
"0.42711943",
"0.42643514",
"0.42568022",
"0.42435703",
"0.4240973",
"0.42289728",
"0.42288288",
"0.42280278",
"0.42244324",
"0.42234126",
"0.42213956",
"0.42201158",
"0.42169833",
"0.4215266"
] |
0.77069974
|
0
|
Given a search string, returns all the matching workitems (in the stores in which the user can read).
|
def search (query_string)
OpenWFE::Extras::Workitem.search(query_string, store_names).find_all do |wi|
@user.admin? or (
wi.store_name != 'users' || wi.participant_name == @user.name)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def search(search_string)\n root = EmployeeFolder.root\n result = []\n key = search_string.downcase\n Dir.glob(\"#{root}/*/*\") do |folder|\n next unless Dir.exist? folder\n next unless folder[key]\n\n employee_spec = parse_dir folder\n next if project? employee_spec\n\n result << employee_spec.to_employee\n end\n result\n end",
"def find_jobs_by_term\n\n print \"\\nEnter a search term to filter jobs by: \".blue\n search_term = gets.strip\n\n jobs = FreelancerFinder::Job.all.find_all do |job|\n job.title.include?(\"#{search_term}\") || job.short_description.include?(\"#{search_term}\") || !!job.tags.detect {|tag| tag.include?(\"#{search_term}\")}\n end\n\n jobs\n end",
"def search(term, store='143441')\n page = request(search_url, {:media => 'software', :term => term}, store)\n raise StoreRequestError unless page.code == \"200\"\n plist = Plist::parse_xml(page.body)\n plist[\"items\"].inject([]) { |arr,item| arr << App.new(item) unless item[\"type\"] == \"more\"; arr }\n end",
"def workitems (store_name=nil)\n\n return load_user_workitems if store_name == 'users'\n return (@workitems[store_name] || []) if store_name\n\n # then return all the workitems the user has access to\n\n wis = load_user_workitems\n\n @store_names.inject(wis) do |r, sname|\n r += (@workitems[sname] || [])\n end\n end",
"def search(sfilter = nil)\n sfilter ||= filter\n\n result = []\n connect do |conn|\n conn.search2(base, 1, sfilter) do |entry|\n result << entry2provider(entry)\n end\n end\n return(result.empty? ? nil : result)\n end",
"def search(term)\n page = request(search_url, {:media => 'software', :term => term})\n raise StoreRequestError unless page.code == \"200\"\n plist = Plist::parse_xml(page.body)\n plist[\"items\"].inject([]) { |arr,item| arr << App.new(item) unless item[\"type\"] == \"more\"; arr }\n end",
"def search\n puts params[:terms]\n query = 'FALSE'\n params[:terms].split(',').each do |term|\n query += \" OR item.name iLIKE ? OR ingredients.unit iLIKE ? OR ingredients.quantity iLIKE ?\"\n end\n @items = Item.where(query, *params[:terms].split(',').map { |i| \"%\"+i+\"%\"}, *params[:terms].split(',').map { |i| \"%\"+i+\"%\"}, *params[:terms].split(',').map { |i| \"%\"+i+\"%\"}).eager_load(:ingredients)\n if @items.any?\n @recipes = Recipe.joins(:ingredients).where('ingredients.item_id IN (?)', @items.pluck(:id)).uniq\n end\n end",
"def search(search_string)\n\n # Convert to a get-paramenter\n search_string = CGI.escapeHTML search_string\n search_string.gsub!(\" \", \" \")\n\n results = []\n \n return results\n end",
"def search (pattern)\n\t\tputs \"Search site store based on the regular expression: #{pattern}\" if @verbose\n\t\tpattern=pattern.strip.downcase\n\t\tresults=Array.new\n\t\t@known_sites.keys.map do |key|\n\t\t\tif key =~ /#{pattern}/i\n\t\t\t\tresults.push(key)\n\t\t\tend\n\t\tend\n\t\treturn results\n\trescue Exception => ee\n\t\tputs \"Exception on method search: #{ee}\" if @verbose\n\t\treturn nil\n\tend",
"def search_locally(search_term:)\n return [] unless search_term.present? && search_term.length > 2\n\n orgs = local_search(search_term: search_term)\n prepare(search_term: search_term, records: orgs)\n end",
"def search\n @search ||= exhibit.searches.first\n # @searches ||= exhibit.searches.published.where(slug: item_ids).sort do |a, b|\n # order.index(a.slug) <=> order.index(b.slug)\n # end\n end",
"def index\n if params[:search]\n @items = Item.all.order(id: :desc).page(params[:page]).per(20).where(\"(name_item LIKE ?) OR (maker LIKE ?)\", \"%#{params[:search]}%\", \"%#{params[:search]}%\")\n else\n @items = Item.all.order(id: :desc).page(params[:page]).per(20)\n end\n end",
"def search(word)\n results = []\n @books.each {|item| results << item if item[0].downcase.include?(word) }\n results.empty? ? (puts \"Search returned no results...\") : (results.each {|item| puts \"#{item[0]} (#{item[1]})\"})\n end",
"def search\n @results = Cookbook.search(\n params.fetch(:q, nil)\n ).offset(@start).limit(@items)\n end",
"def searches\n search_objects.map{ |s| s.query }\n end",
"def osops_search(\n search_string, # recipe or role name\n one_or_all=:one,# return first node found or a list of nodes?\n # if set to :all a list will be returned\n # even if only one node is found.\n include_me=true,# include self in results\n order=[:role, :recipe], # if only one item is to be returned and\n # there are results from both the role\n # search and the recipe search, pick the\n # first item from the list specified here.%\n # must be :recipe or :role\n safe_deref=nil, # if nil, return node(s), else return\n # rcb_safe_deref(node,safe_deref)\n current_node=nil,\n options = {}\n )\n\n # Next refactor, move options to first/only param\n # Passing options from other methods to override search params\n options = {\n :search_string => search_string,\n :one_or_all => one_or_all,\n :include_me => include_me,\n :order => order,\n :safe_deref => safe_deref,\n :current_node => current_node\n }.merge(options)\n\n search_string = options[:search_string]\n one_or_all = options[:one_or_all]\n include_me = options[:include_me]\n order = options[:order]\n safe_deref = options[:safe_deref]\n current_node = options[:current_node]\n\n debug(\"Osops_search: search_string:#{search_string}, one_or_all:#{one_or_all},\"\\\n + \"include_me:#{include_me}, order:#{order}, safe_deref:#{safe_deref}\")\n results = {\n :recipe => [],\n :role => [],\n :tag => []\n }\n\n current_node ||= node\n\n for query_type in order\n if include_me and current_node[\"#{query_type}s\"].include? search_string\n debug(\"node #{current_node} contains #{query_type} #{search_string}, so adding node to results\")\n results[query_type] << current_node\n break if one_or_all == :one # skip expensive searches if unnecessary\n end\n\n search_string.gsub!(/::/, \"\\\\:\\\\:\")\n query = \"#{query_type}s:#{search_string} AND chef_environment:#{current_node.chef_environment}\"\n debug(\"osops_search query: #{query}\")\n result, _, _ = Chef::Search::Query.new.search(:node, query)\n results[query_type].push(*result)\n break if one_or_all == :one and results.values.map(&:length).reduce(:+).nonzero?\n end #end for\n\n #combine results into prioritised list\n return_list = order.map { |search_type| results[search_type] }.reduce(:+)\n\n #remove duplicates\n return_list.uniq!(&:name)\n\n #remove self if returned by search but include_me is false\n return_list.delete_if { |e| e.name == current_node.name } if not include_me\n\n if not safe_deref.nil?\n # result should be dereferenced, do that then remove nils.\n debug(\"applying deref #{safe_deref}\")\n return_list.map! { |nodeish| rcb_safe_deref(nodeish, safe_deref) }\n return_list.delete_if { |item| item.nil? }\n end\n\n debug(\"ospos_search return_list: #{return_list}\")\n\n if one_or_all == :one\n #return first item\n return_list.first\n else\n #return list (even if it only contains one item)\n return_list\n end\n end",
"def find(items)\n query_array = query.gsub(/_/,\" \").downcase.split\n\n results = []\n items.each{ |item|\n match_all = true\n query_array.each{ |query|\n description = item.description.gsub(\"/,/\",\"~\")\n if !item.name.gsub(/_/,\" \").downcase.include?(query) and !description.gsub(/_/,\" \").downcase.include?(query)\n match_all = false\n else\n if description.gsub(/_/,\" \").downcase.include?(query)\n self.description_map[item] = map_description_part(description, query)\n else\n self.description_map[item] = if item.description.size>=30 then item.description[0..27] + \"...\" else item.description end\n end\n end\n }\n if match_all\n results.push(item)\n end\n }\n\n self.found_items = results\n if self.found_items.size == 0 and self.query.size >= 2\n suggest_other_query(items, query)\n end\n\n end",
"def fetch_items\n items = @klass.order(\"#{sort_column} #{sort_direction}\")\n items = items.page(page).per_page(per_page)\n if @params[:sSearch].present?\n query = @fields.map { |field| \"#{field} ilike :search\" }.join(\" OR \")\n items = items.where(query, search: \"%#{@params[:sSearch]}%\")\n end\n return items\n end",
"def search_items(name, options = {})\n\t\t\tif (name.is_a?(Hash))\n\t\t\t\toptions = name\n\t\t\telse\n\t\t\t\toptions.merge!(:search => name)\n\t\t\tend\n\t\t\t\n\t\t\toptions.merge!(:type => @@search_types[:item])\n\t\t\treturn search(options)\n\t\tend",
"def find\n puts params[:search_string]\n @results = Clientworkout.where(client_name: params[:search_string])\n #@results = Clientworkout.where('lower(client_name)=?' params[:search_string])\n end",
"def search(string, options = {})\n\t\t\tif (string.is_a?(Hash))\n\t\t\t\toptions = string\n\t\t\telse\n\t\t\t\toptions.merge!(:search => string)\n\t\t\tend\n\t\t\t\n\t\t\toptions = merge_defaults(options)\n\t\t\t\n\t\t\tif options[:search].nil? || options[:search].empty?\n\t\t\t\traise Wowr::Exceptions::NoSearchString.new\n\t\t\tend\n\t\t\t\n\t\t\tif !@@search_types.has_value?(options[:type])\n\t\t\t\traise Wowr::Exceptions::InvalidSearchType.new(options[:type])\n\t\t\tend\n\t\t\t\n\t\t\toptions.merge!(:caching => false)\n\t\t\toptions.delete(:realm) # all searches are across realms\n\t\t\t\t\t\t\n\t\t\txml = get_xml(@@search_url, options)\n\t\t\t\n\t\t\tresults = []\n\t\t\t\t\t\t\n\t\t\tif (xml) && (xml%'armorySearch') && (xml%'armorySearch'%'searchResults')\n\t\t\t\tcase options[:type]\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:item]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'items'/:item).each do |item|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchItem.new(item)\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:character]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'characters'/:character).each do |char|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchCharacter.new(char, self)\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:guild]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'guilds'/:guild).each do |guild|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchGuild.new(guild)\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:arena_team]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'arenaTeams'/:arenaTeam).each do |team|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchArenaTeam.new(team)\n\t\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\treturn results\n\t\tend",
"def search(string, options = {})\n\t\t\tif (string.is_a?(Hash))\n\t\t\t\toptions = string\n\t\t\telse\n\t\t\t\toptions.merge!(:search => string)\n\t\t\tend\n\t\t\t\n\t\t\toptions = merge_defaults(options)\n\t\t\t\n\t\t\tif options[:search].nil? || options[:search].empty?\n\t\t\t\traise Wowr::Exceptions::NoSearchString.new\n\t\t\tend\n\t\t\t\n\t\t\tif !@@search_types.has_value?(options[:type])\n\t\t\t\traise Wowr::Exceptions::InvalidSearchType.new(options[:type])\n\t\t\tend\n\t\t\t\n\t\t\toptions.merge!(:caching => false)\n\t\t\toptions.delete(:realm) # all searches are across realms\n\t\t\t\t\t\t\n\t\t\txml = get_xml(@@search_url, options)\n\t\t\t\n\t\t\tresults = []\n\t\t\t\t\t\t\n\t\t\tif (xml) && (xml%'armorySearch') && (xml%'armorySearch'%'searchResults')\n\t\t\t\tcase options[:type]\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:item]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'items'/:item).each do |item|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchItem.new(item)\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:character]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'characters'/:character).each do |char|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchCharacter.new(char, self)\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:guild]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'guilds'/:guild).each do |guild|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchGuild.new(guild)\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\twhen @@search_types[:arena_team]\n\t\t\t\t\t\t(xml%'armorySearch'%'searchResults'%'arenaTeams'/:arenaTeam).each do |team|\n\t\t\t\t\t\t\tresults << Wowr::Classes::SearchArenaTeam.new(team)\n\t\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\treturn results\n\t\tend",
"def search\n if params[:search].present?\n # This is for the elastic search\n #@bid_items = BidItem.search(params[:search])\n\n # Those are Ruby SQL queries\n # This is to search item_name\n #@bid_items = BidItem.where(:item_name => params[:search])\n # This is to search price larger than\n @bid_items = BidItem.where(\"starting_price > ?\", params[:search])\n else\n @bid_items = BidItem.order(\"id DESC\").limit(30)\n end\n end",
"def all_search\n @results ||= []\n feat_keyword ||= {:name_contains => params[:q]}\n reward_keyword ||= {:partner_business_name_contains => params[:q]}\n\n Feat.search(feat_keyword).all.each do |r|\n @results << r\n end if !Feat.search(feat_keyword).all.nil? && feat_keyword.length > 0\n\n Reward.search(reward_keyword).all.each do |r|\n @results << r\n end if !Reward.search(reward_keyword).all.nil? && reward_keyword.length > 0\n end",
"def find(search_terms, acct=nil)\n []\n end",
"def find(search_string)\n result_array = []\n search_words = search_string.split(/\\s+/)\n\n # Loop over all entries in the index.\n @data.each{ |entry|\n begin\n # Check whether this entry matches the search words.\n score = 0\n search_words.each{ |search_word|\n next if search_word.empty?\n\n s = 2 * AE::LaunchUp::Scorer.score(search_word, entry[:name]) if entry[:name].is_a?(String)\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:description]) if entry[:description].is_a?(String)\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:category]) if entry[:category].is_a?(String)\n s += exact_matches(search_word, entry[:keywords].join(\" \"))/(entry[:keywords].length|1).to_f if entry[:keywords].is_a?(Array) && !entry[:keywords].empty?\n s += 2 * AE::LaunchUp::Scorer.score(search_word, entry[:keywords].join(\" \")) if entry[:keywords].is_a?(Array)\n s += exact_matches( search_word.gsub(/\\/|\\\\/, \"\"), entry[:file].gsub(/\\/|\\\\/, \"\") ) if entry[:file].is_a?(String) && search_word.length > 4\n\n # Skip if no match has been found.\n break score = 0.0 if s == 0.0\n score += s\n }\n\n # Tweaks for relevance:\n # Entries with icons match better with users's expectation,\n # urls or \"about\" rather not.\n score *= 3 if entry[:icon].is_a?(String)\n #score *= 0.5 if entry[:name][/about|paypal/i] || entry[:description][/http/]\n\n # Check wether the command is available in the current context. We don't\n # want to reject it completely from the search results, so that the user\n # won't miss it in an explicit search will. We give a hint if it's disabled.\n if entry[:validation_proc]\n status = nil\n begin\n status = entry[:validation_proc].call == MF_ENABLED\n rescue LocalJumpError => e\n # Validation proc contains a \"return\"?\n $stderr.write(\"Validation proc of '#{entry[:name]}' (#{entry[:id]}) contains 'return'\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n rescue Exception => e\n # Validation proc contains other bug.\n $stderr.write(\"Error in validation proc of '#{entry[:name]}' (#{entry[:id]})\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/) if $VERBOSE\n end\n entry[:enabled] = status\n score *= 0.5 if status == false\n end\n\n # Skip if no match has been found.\n next if score < 1.0\n\n # Consider tracking data, how often this entry has been selected over others:\n # Divide track by half of average track (total_track/data.length).\n score += [entry[:track] / (@total_track|1).to_f * 0.5 * @data.length, 5].min if entry[:track]\n entry[:score] = score\n\n # Add it to results.\n result_array << entry\n rescue Exception => e\n $stderr.write(\"AE::LaunchUp::Index: Error in 'find' when searching '#{entry[:name]}' (#{entry[:id]})\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n break\n end\n }\n\n return result_array\n rescue Exception => e\n $stderr.write(\"AE::LaunchUp::Index: Error in 'find' when searching '#{search_string}'\\n#{e.message.to_s}\\n#{e.backtrace.join(\"\\n\")}\" << $/)\n return []\n end",
"def search(search, admin)\n if !search.blank?\n @results = []\n if !search.strip.include? \" \"\n @results = self.search_keyword(search, admin)\n else\n @results = self.search_phrase(search, admin)\n end\n end\n end",
"def search_items(name, options = {})\n\t\t\tif (name.is_a?(Hash))\n\t\t\t\toptions = name\n\t\t\telse\n\t\t\t\toptions.merge!(:search => name)\n\t\t\tend\n\t\t\t\n\t\t\toptions.merge!(:type => @@search_types[:item])\n\t\t\t\n\t\t\tputs options.inspect if options[:debug]\n\t\t\treturn search(options)\n\t\tend",
"def query_items(items)\n query = params[:query].downcase.split(' ').join('%')\n query = ActiveRecord::Base.sanitize(\"%#{query}%\")\n items.where(search_query(query))\n end",
"def search(params={:SearchIndex => :Books, :ResponseGroup => :Medium})\n response = call(params.merge(:Operation => :ItemSearch))\n arrayfy(response['ItemSearchResponse']['Items']['Item']).map {|item| handle_type(item, :item)}\n end",
"def search_externally(search_term:)\n return [] unless search_term.present? && search_term.length > 2\n\n orgs = externals_search(search_term: search_term)\n prepare(search_term: search_term, records: orgs)\n end",
"def search_on_filename\n needle = query.downcase.as_wiki_link\n all_pages.select { |name| name.downcase.include? needle }.map do |name|\n # unfreeze the String name by creating a \"new\" one\n SearchResult.new(name, 2 * @score, [0, name.tr('_', ' ')])\n end\n end",
"def search_helper *args\n matches = []\n @script_executor.search(*args) { |match|\n matches << match\n }\n matches\nend",
"def search_files(params)\n # return if no search term entered\n return nil if params[:term].blank?\n \n result = {:term => params[:term], :current_page => params[:page], :per_page => 100, :previous_page => nil, :next_page => nil, :results => []}\n \n begin\n api_result = @client.search('', result[:term], result[:per_page])\n rescue\n return nil\n end\n\n if api_result.present?\n api_result.each do |item|\n result[:results] << self.item_into_standard_format(item)\n end\n end\n\n result\n end",
"def search(search_string)\n queue=search_string.split '/'\n current_term=queue.shift\n return [self] if current_term.nil? #If for some reason nothing is given in the search string\n matches=[]\n if current_term=='*'\n\t\t\t\tnew_matches=self.children.values\n\t\t\t\tnew_matches.sort! {|a, b| a.node_name <=> b.node_name} rescue nil #is this evil?\n matches.concat new_matches\n elsif current_term[/\\d+/]==current_term\n matches << @children[current_term.to_i]\n else\n matches << @children[current_term.to_sym]\n end\n if queue.empty?\n return matches.flatten.compact\n else\n return matches.collect {|match| match.search(queue.join('/'))}.flatten.compact\n end\n end",
"def search_filter(search_term)\n @items = @items.where('client_name like ? OR client_ssn like ? OR case_id like ?', \"%#{search_term}%\", \"%#{search_term}%\", \"%#{search_term}%\")\n @old_items = @items.where('client_name like ? OR client_ssn like ? OR case_id like ?', \"%#{search_term}%\", \"%#{search_term}%\", \"%#{search_term}%\")\n session[:search] = search_term\n end",
"def search\n @recipes = Recipe.find_by_contents params[:query]\n end",
"def search(*args)\n search_provider.search(*args)\n end",
"def search(cmd)\n songs = select_songs_with cmd\n\n if songs.empty?\n failure('It matches not even one')\n else\n playlists[:focus] <= songs\n playlists[:search] <= songs\n success(songs: songs, response_type: :songs)\n end\n end",
"def parse_search(q)\n # TODO continue\n end",
"def search_for_stores(data)\n Log.instance.debug \"Searching for stores that match '#{data}'\"\n populate_page_with(data)\n search_button_element.click\n wait_for_loading_mask\n end",
"def search\n\n end",
"def search_words\n begin\n regex = Regexp.new(@pattern)\n rescue RegexpError => msg\n error_msg(msg)\n rescue NameError => msg\n error_msg(msg)\n end\n @results = DICT.select do |word|\n regex =~ word\n end\n @num_results = @results.length\n format_results\n display_results\n end",
"def search; end",
"def parse_search; end",
"def search (search_term)\n\n res = Amazon::Ecs.item_search(search_term , :search_index => 'All')\n items = res.marshal_dump\n items_return = []\n #puts res.marshal_dump\n Hash.from_xml(items)[\"ItemSearchResponse\"][\"Items\"][\"Item\"].each do |item|\n myitem = item[\"ItemAttributes\"]\n myitem.merge!(\"DetailPageURL\" => item[\"DetailPageURL\"])\n myitem.merge!(\"ASIN\" => item[\"ASIN\"])\n #m = find_prices(myitem[\"ASIN\"])\n #puts m\n #sleep(100)\n sleep 1\n myitem.merge!(\"Prices\" => self.find_prices(item[\"ASIN\"]) )\n #puts myitem[\"ASIN\"]\n #puts myitem\n\n #myitem.merge!(find_prices(myitem[\"ASIN\"]))\n items_return.push(myitem)\n end\n\n items_return\n end",
"def search_results\n @products = Product.where(\"name LIKE ?\", \"%#{params[:keywords]}%\")\n end",
"def search_phrase(search, admin)\n search = search.split(\" \")\n permissions = admin ? @@member + @@admin_only : @@member\n @results = []\n\n for col in permissions\n for word in search\n self.update_results(col, word)\n end\n end\n @results\n end",
"def search_list\n if params[:keyword].nil? or params[:keyword].empty?\n redirect_back :fallback_location => root_path, :alert => \"Unrecognized user input. \"\n else\n keyword = \"%\" + params[:keyword].strip + \"%\"\n end\n @domains = Domain.where('name like ?', keyword).limit(10)\n end",
"def index\n @item_collections = ItemCollection.where('is_private=false')\n if !params[:search].nil? || params[:search] == ''\n t = ItemCollection.arel_table\n @item_collections = ItemCollection.where(t[:name].matches(\"%#{params[:search]}%\").and(t[:is_private].eq(false)))\n #@item_collections = ItemCollection.where('name LIKE ? AND is_private=false', \"%#{params[:search]}%\")\n end\n end",
"def search_all\n users = User.where([\"name LIKE ?\", \"%#{keywords}%\"])\n end",
"def search_for_item\n search_service.fetch(params[:solr_document_id])\n end",
"def search\n @results = Tool.ordered_by(params[:order])\n\n if params[:q].present?\n @results = @results.search(params[:q])\n end\n\n if Tool::ALLOWED_TYPES.include?(params[:type])\n @results = @results.where(type: params[:type])\n end\n\n @results = @results.offset(@start).limit(@items)\n\n @total = @results.count(:all)\n end",
"def search_file_by_name (search)\n\n if @user.get_role == ExpaPerson.roles[:role_mc]\n return Archive.where(\"name ILIKE ?\",\"%#{search}%\")\n # or if someone is from a LC\n elsif @user.get_role == ExpaPerson.roles[:role_eb]\n return Archive.where(\"(is_private = true AND office_id = ? AND name ILIKE ? AND is_deleted=false) OR (is_private = false AND name ILIKE ? AND is_deleted=false)\",@user.xp_current_office.id, \"%#{search}%\", \"%#{search}%\")\n else\n return Archive.where(\"(is_deleted = false is_private = true AND office_id = ? AND name ILIKE ?) OR (is_deleted = false AND is_private = false AND name ILIKE ?)\",@user.xp_current_office.id, \"%#{search}%\", \"%#{search}%\")\n end\n\n end",
"def search(keywords, *fields)\n return all\n end",
"def search\n\n @tasks = []\n \n PgSearch.multisearch(params['search-string']).where(:searchable_type => \"Task\").find_each do |document|\n @tasks << document.searchable\n end\n\n respond_to do |format|\n format.html { render action: \"index\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n \n end",
"def search\n data.select { |raw| raw.values.join(',').match?(/#{search_query}/) }\n end",
"def get_results()\n restriction_nodes = []\n result_nodes = []\n if !(@inputs.nil? || @inputs.empty? || @inputs.first.empty?)\n input_set = @inputs.first\n restriction_nodes= input_set.nodes\n result_nodes = input_set.breadth_first_search(true){|node| node.item.text.downcase.include?(@keyword_phrase.to_s.downcase)} \n end\n \n if !@inplace\n results = @server.match_all(parse_keyword_phrase(), restriction_nodes) \n result_nodes = results.map{|item| Xplain::Node.new(item: item)}\n end\n \n result_nodes\n \n end",
"def dbsearch(args=[])\n\t\t\t# Make sure we form the class name correctly\n\t\t\tclass_name = args[0].downcase\n\t\t\tclass_name[0] = class_name[0].capitalize\n\t\t\tclass_name = class_name.singularize\n\t\t\t\t\t\t\n\t\t\tprint_deb (\"Class name: #{class_name}\")\n\t\t\t \n\t\t\tbegin\n\t\t\t\teval(\"Msf::DBManager::#{class_name}.respond_to?(:find)\")\n\t\t\trescue Exception => e\n\t\t\t\t#print_error \"Error while querying database. Make sure this table\"\n\t\t\t\t#print_error \"and column combination actually exists in the database.\"\n\t\t\t\tprint_error e.to_s\n\t\t\t\treturn\n\t\t\tend\n\t\t\t\n\t\t\tif args.count == 1\n\t\t\t\t@working_set = eval(\"Msf::DBManager::#{class_name}.all\")\n\t\t \telse\n\t\t\t\tfilters = []\n\t\t\t\tsub_items_list = []\n\t\t\t\t@working_set = []\t\t\t\n\t\t\n\t\t\t\targs.shift ## drop the table from the string\t\t\n\t\t\t\t\n\t\t\t\t# Parse argument string\n\t\t\t\targs.each_with_index do |arg,i|\n\t\t\t\t\n\t\t\t\t\tprint_deb \"parsing arg #{arg}\"\n\t\t\t\t\n\t\t\t\t\tif arg.downcase =~ /where/\n\t\t\t\t\t\tfilters << args[i+1]\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tif arg.downcase =~ /or/\n\t\t\t\t\t\tfilters << args[i+1]\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tif arg.downcase =~ /contain/\n\t\t\t\t\t\tsub_items_list << args[i-1]\n\t\t\t\t\t\tfilters.pop # remove the last item from the filter\n\t\t\t\t\t\tfilters << args[i+1]\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# Go get the items\n\t\t\t\tquery_string = \"Msf::DBManager::#{class_name}.all\"\n\t\t\t\titem_set = eval(query_string)\n\t\t\t\t\n\t\t\t\t### \n\t\t\t\t## \tParse filters\n\t\t\t\t###\n\t\t\t\tequal_conditions = {}\n\t\t\t\tmatch_conditions = {}\n\t\n\t\t\t\tfilters.each do |filter|\n\t\t\t\t\n\t\t\t\t\t# Split based on the delimiter\n\t\t\t\t\tif filter =~ /=/\n\t\t\t\t\t\tequal_condition = filter.split(\"=\")\n\t\t\t\t\t\t#equal_condition[-1] = nil if equal_condition[-1] = \"nil\"\n\t\t\t\t\t\tequal_conditions[equal_condition.first] = equal_condition.last\n\t\t\t\t\tend\n\n\n\t\t\t\t\t# Split based on the delimiter\n\t\t\t\t\tif filter =~ /~/\n\t\t\t\t\t\tmatch_condition = filter.split(\"~\")\n\t\t\t\t\t\tmatch_conditions[match_condition.first] = match_condition.last\n\t\t\t\t\tend\t\n\t\t\t\tend\t\n\n\t\t\t\tprint_status \"Searching for #{class_name} with conditions...\"\n\n\t\t\t\t# Tell the user what their filter looks like\n\t\t\t\tequal_conditions.each_pair do |key,val|\n\t\t\t\t\tprint_status \"Exact: #{key} = #{val}\"\n\t\t\t\tend\n\n\t\t\t\t# Tell the user what their filter looks like\n\t\t\t\tmatch_conditions.each_pair do |key,val|\n\t\t\t\t\tprint_status \"Match: #{key} =~ /#{val}/\"\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t### \n\t\t\t\t## \tEnd Parsing\n\t\t\t\t###\n\n\t\t\t\t###\n\t\t\t\t## \tGet the right collection if we include sub-items\n\t\t\t\t###\n\t\t\t\twhile sub_items_list.count > 0 do\n\t\t\t\t\tsub_items = sub_items_list.shift\n\t\t\t\t\tprint_deb \"Handling a sub item : #{sub_items}!\"\n\t\t\t\t\t#item_set = eval(\"item.#{sub_items}\")\n\t\t\t\t\ttemp_item_set = []\n\t\t\t\t\titem_set.each do |item|\n\t\t\t\t\t\ttemp_item_set = temp_item_set + (eval(\"item.#{sub_items}\"))\n\t\t\t\t\tend\t\t\t\t\t\n\t\t\t\t\titem_set = temp_item_set\n\t\t\t\t\t\n\t\t\t\t\tprint_deb \" Item set is now: #{item_set.count} objects\"\n\t\t\t\t\t\n\t\t\t\tend\n\n\t\t\t\t#print_deb item_set.inspect\n\t\t\t\t#print_deb item_set.each { |item| puts item.inspect }\n\n\t\t\t\t###\n\t\t\t\t##\tFilter items\n\t\t\t\t###\n\n\t\t\t\titem_set.each do |item|\n\t\t\t\t\t# Look through for the user-specified filters\n\t\t\t\t\tequal_conditions.each_pair do |method,value|\n\t\t\t\t\t\t# we should get an object by looking for the \n\t\t\t\t\t\t# user-specified filter item (unless it doesn't\n\t\t\t\t\t\t# exist in the database...)\n\t\t\t\t\t\tdb_object = eval(\"item.#{method}\") # get the value we want to examine\n\n\t\t\t\t\t\t# handle the case when people are looking for nil-like values\t\t\t\t\t\n\t\t\t\t\t\tif self.is_nil_like?(value)\n\t\t\t\t\t\t\t#print_deb \"#{value} IS NIL-LIKE, checking for nil-like db object\"\n\t\t\t\t\t\t\t# if they are searching for something akin to nil then\n\t\t\t\t\t\t\t# let's match if the db_object entry is akin to nil\n\t\t\t\t\t\t\t@working_set << item if self.is_nil_like?(db_object)\n\t\t\t\t\t\telsif db_object.to_s == value\n\t\t\t\t\t\t\t# otherwise we do a normal comparison\n\t\t\t\t\t\t\t@working_set << item\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\t# Look for match conditions\n\t\t\t\t\tmatch_conditions.each_pair do |method,value|\n\t\t\t\t\t\t# we should get an object by looking for the \n\t\t\t\t\t\t# user-specified filter item (unless it doesn't\n\t\t\t\t\t\t# exist in the database...)\n\t\t\t\t\t\tdb_object = eval(\"item.#{method}\") # get the value we want to examine\n\t\t\t\t\t\t\n\t\t\t\t\t\t# handle the case when people are looking for nil-like values\n\t\t\t\t\t\t# especially since doing a regex comparison on nil is kinda rough...\t\t\t\t\n\t\t\t\t\t\tif is_nil_like?(value)\n\t\t\t\t\t\t\t# if they are searching for something akin to nil then\n\t\t\t\t\t\t\t# let's match if the db_object entry is akin to nil\n\t\t\t\t\t\t\t@working_set << item if self.is_nil_like?(db_object)\n\t\t\t\t\t\telsif db_object.to_s =~ Regexp.new(value,true)\n\t\t\t\t\t\t\t# otherwise we do a normal regex comparison\n\t\t\t\t\t\t\t@working_set << item\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn @working_set\n\t\tend",
"def search_keywords(*keywords)\n params = keywords.last.is_a?(Hash) ? keywords.pop : {:SearchIndex => :Books, :ResponseGroup => :Medium}\n response = call(params.merge(:Operation => :ItemSearch, :Keywords => keywords.join(' ')))\n arrayfy(response['ItemSearchResponse']['Items']['Item']).map {|item| handle_type(item, :item)}\n end",
"def search\n @users = User.search(@search_term)\n @tweets = Tweet.search(@search_term)\n @tags = Tag.search(@search_term)\n end",
"def search_by_chunks filters\n\t\tif NSConnector::Config[:use_threads] then\n\t\t\treturn threaded_search_by_chunks(filters)\n\t\telse\n\t\t\treturn normal_search_by_chunks(filters)\n\t\tend\n\tend",
"def medley_search\n\t\t@keywords = params[:keywords].downcase.gsub(/[^a-z\\s]/, '')\n\t\t@keywords_array = @keywords.strip.split(/\\s+/)\n\t\t@formatted_search = ''\n\t\t@keywords_array.each do |keyword|\n\t\t\t@formatted_search = @formatted_search + keyword.to_s + '|'\n\t\tend\n\t\t@formatted_search = @formatted_search.chop\n\t\t@medleys = Medley.advanced_search(@formatted_search).order('votes DESC').joins(:user).limit(15)\n\t\t@medleys = medley_extra_formatter(@medleys)\n\t\t# Build Custom Item URLs Here...\n\tend",
"def search(params)\n filter_name, keywords, field_queries = extract params\n scope = filtered_by filter_name\n query = text_search keywords\n query = field_search field_queries, query\n scope.where query\n end",
"def search\n end",
"def search\n @features = Central::Storage.search(_params_search)\n end",
"def search(search_text)\n res = {files: {}, folders: {}}\n (@current_site.get_meta(cache_key, nil) || browser_files).each do |folder_key, object|\n res[:folders][folder_key] = get_file(folder_key) if !['', '/'].include?(folder_key) && folder_key.split('/').last.include?(search_text)\n object[:files].each do |file_key, obj|\n res[:files][file_key] = obj if file_key.include?(search_text)\n end\n res\n end\n res\n end",
"def search_results\n @keyword = params[:keyword]\n \n @products = Product.where(\"name LIKE ?\", \"%#{@keyword}%\")\n end",
"def search_items(opts = {})\n data, _status_code, _headers = search_items_with_http_info(opts)\n data\n end",
"def search(query); end",
"def search(*args)\n search_internal([\"SEARCH\"], *args)\n end",
"def search_all_worksheets(*search_terms)\n spreadsheet_feed_response = get_feed(\"#{SPREADSHEET_FEED}?q=#{search_terms.join('+')}\")\n create_datastructure_from_xml(spreadsheet_feed_response.body)\n end",
"def index\n if current_user.admin?\n @products = params[:store_id] ? Product.where(item_type: 'Store', item_id: params[:store_id]) : Product.all\n else\n @products = params[:store_id] ? Product.where(item_type: 'Store', item_id: params[:store_id]) : current_user.products\n end\n\n palabra = \"%#{params[:search]}%\"\n\n @products = Product.where(\"name LIKE ? OR description LIKE ?\", palabra, palabra)\n end",
"def search\n @results = Extension.search(\n params.fetch(:q, nil)\n ).offset(@start).limit(@items)\n\n @total = @results.count(:all)\n end",
"def search_results search\n search = normalize search\n @searches[search.to_s]\n end",
"def search_files(params)\n # return if no search term entered\n return nil if params[:term].blank?\n \n result = {:term => params[:term], :current_page => params[:page], :per_page => 100, :previous_page => nil, :next_page => nil, :results => []}\n search_term_escaped = params[:term].gsub(\"'\", %q(\\\\\\'))\n \n # Build out search params\n parameters = {}\n parameters['q'] = \"title contains '#{search_term_escaped}'\"\n parameters['pageToken'] = result[:current_page].to_s if result[:current_page].to_s.present?\n parameters['maxResults'] = result[:per_page]\n \n begin\n drive = @client.discovered_api('drive', 'v2')\n api_result = @client.execute(:api_method => drive.files.list, :parameters => parameters)\n rescue\n return nil\n end\n \n if api_result.status == 200\n files = api_result.data\n files.items.each do |item|\n result[:results] << self.item_into_standard_format(item)\n end\n # Pagination\n #result[:next_page] = files.next_page_token\n else\n result[:error] = {:code => api_result.status, :message => api_result.data['error']['message']} \n end\n result\n end",
"def search(index, query_or_params = nil)\n params = case query_or_params\n when String\n { 'Keywords' => query_or_params }\n else\n query_or_params\n end\n rebuild params.merge! 'Operation' => 'ItemSearch',\n 'SearchIndex' => Utils.camelize(index.to_s)\n\n check_response\n end",
"def grep(pattern = '.*')\n regexp = Regexp.new(pattern)\n fetch_items_from_filesystem_or_zip\n @items = items.shift(2) + items.select {|i| i.name =~ regexp}\n sort_items_according_to_current_direction\n draw_items\n draw_total_items\n switch_page 0\n move_cursor 0\n end",
"def search\n search = Wine.search do\n fulltext params[:search]\n paginate(:page => params[:page], :per_page => params[:per_page])\n end\n\n # Assign our search results to the wines to display, and render it the same as our index.\n @wines = search.results\n @wines.index\n render 'index'\n end",
"def search_filenames\n # * => all files\n # r => search from its subdirectories\n # i => ignore cases\n # l => list file name\n # c => show word occurence count\n # w => words\n\n args = set_args\n # grep -ril '#keyword1' --include=\\*.rb *\n `grep -ril '#{args}' #{search_extension} *`\n end",
"def apply_search(results:)\n return results unless search_params.present?\n\n terms = search_params[:search_words] || ''\n return results unless terms.present?\n\n results.search(term: terms)\n end",
"def find_items(params)\n\t\tif params.has_key?(:loc) and params.has_key?(:search)\n\t\t\t@loc = params[:loc]\n\t\t\t\n\t\t\t# @issues = current_user.business.issues.search(params[:search], \"name|description\").where(state: \"publish\", department_area_id: @loc).order(created_at: :desc).page(params[:page])\n\t\t\t# @issues = Issue.search(params[:search], \"name|description\", params[:page]).where(state: \"publish\", department_area_id: @loc).order(created_at: :desc).page(params[:page])\n\t\t\t@problems = Item.includes(:type).search(params[:search], \"name|description\", params[:page]).where(department_area_id: @loc).order(created_at: :desc).page(params[:page])\n\t\telsif params.has_key?(:search)\n\t\t\t# @issues = Issue.search(params[:search], \"name|description\", params[:page]).where(state: \"publish\").order(created_at: :desc).page(params[:page])\n\t\t\t@problems = Item.includes(:type).search(params[:search], \"name|description\", params[:page]).order(created_at: :desc).page(params[:page])\n\t\t\t\n\t\telse\n\t\t\t\n\t\t\t# @issues = Issue.where(state: \"publish\").order(created_at: :desc).page(params[:page])\n\t\t\t@problems = Item.includes(:type).order(created_at: :desc).page(params[:page])\n\t\t\t# @issues = current_user.business.issues.where(state: \"publish\").order(created_at: :desc).page(params[:page])\n\n\t\tend\n\tend",
"def index\n if params[:name] == nil\n @stores = Store.all\n else\n @stores = Store.all.where(\"stores.name LIKE '%\"+params[:name]+\"%'\")\n end \n end",
"def search \n\n end",
"def searchABatch(directory, extension, searchString)\n return Dir.entries(directory).select{|file| File.open(file, \"r\").include?(searchString)}\nend",
"def search(string)\n if not @open\n raise Exception, \"The library is not open.\", caller\n elsif string.empty? || string.length < 4\n output = \"Search string must contain at least four characters.\"\n else\n results = @books.select { |k,book| \n (book.get_title().downcase.include?(string.downcase) || book.get_author().downcase.include?(string.downcase)) && book.get_due_date() == nil\n }\n\n if results.count > 0\n output = \"\"\n # make sure it only returns unique results\n results.to_a.uniq { |k,b| \n b.get_author() && b.get_title() \n }.each { |k,b| output = output + \"#{b.to_s}\\n\" }\n else\n output = \"No books found.\"\n end\n end\n output\n end",
"def search\n @search_criteria =\"\"\n if params[:q].eql? \"\"\n @search_criteria =\"All\"\n @items = Item.all.paginate(:page => params[:page], per_page: 9)\n else\n @st = \"%#{params[:q]}%\"\n @search_criteria = params[:q]\n @items = Item.where(\"LOWER(title) LIKE ?\", @st.downcase).paginate(:page => params[:page], per_page: 9)\n end\n end",
"def search(user, query, collection, wiki)\n end",
"def search(*args)\n end",
"def search_search(exploits_array, query)\n search_results=[]\n exploits_array.each do |line|\n line = line.unpack('C*').pack('U*') if !line.valid_encoding?\n if query == 'nil'\n search_results << line\n else\n search_results << line if line =~ /#{query}/i\n end\n end\n return search_results\nend",
"def search(query, &block)\n mailbox(get_right_box :all).search(query, &block)\n end",
"def search(*rules); end",
"def search(*rules); end",
"def search(keywords)\n\n # Create key pool\n @tmp = keywords.split(\" \")\n\n # Check if data pool contain any key of key pool\n @tmp.each do |k|\n\n # Create data pool\n @tmp_data = \"#{self.id} #{self.name} #{self.link} #{self.description}\"\n\n # If contained then return true\n if(@tmp_data.include? k)\n return true\n end\n end\n\n # If not contained then return false\n return false\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end"
] |
[
"0.6381887",
"0.62826955",
"0.6244389",
"0.61944616",
"0.60290784",
"0.5967592",
"0.5943505",
"0.593287",
"0.5931565",
"0.59101796",
"0.5901961",
"0.5880442",
"0.5867845",
"0.586291",
"0.58337057",
"0.58210737",
"0.5818531",
"0.5802142",
"0.5801932",
"0.57808614",
"0.576399",
"0.576399",
"0.5743755",
"0.57427025",
"0.57136124",
"0.57047975",
"0.56967044",
"0.56787986",
"0.5678392",
"0.566938",
"0.56521714",
"0.5647346",
"0.5639275",
"0.56343395",
"0.5630317",
"0.5624647",
"0.5614352",
"0.5607378",
"0.56062686",
"0.5605793",
"0.5597265",
"0.5581217",
"0.5580839",
"0.55686104",
"0.5566822",
"0.55609417",
"0.5548595",
"0.55484456",
"0.5545799",
"0.55382377",
"0.5530379",
"0.55183995",
"0.5508191",
"0.5491999",
"0.54839194",
"0.5482587",
"0.5481445",
"0.54672766",
"0.546722",
"0.54612774",
"0.54595107",
"0.54573965",
"0.54503405",
"0.5447415",
"0.54309267",
"0.5429213",
"0.54116386",
"0.5406991",
"0.54054767",
"0.5404105",
"0.5399911",
"0.53991264",
"0.5396281",
"0.53957176",
"0.53898096",
"0.5385642",
"0.53815466",
"0.5380615",
"0.53762805",
"0.5375708",
"0.5375646",
"0.53723747",
"0.5371923",
"0.5359257",
"0.53547084",
"0.5341576",
"0.53382033",
"0.5337195",
"0.533611",
"0.5335453",
"0.5330387",
"0.53277314",
"0.53277314",
"0.5327218",
"0.5325384",
"0.5325384",
"0.5325384",
"0.5325384",
"0.5325384",
"0.5325384"
] |
0.67167896
|
0
|
Returns all the store names (according to the 'wi_stores' table)
|
def find_all_storenames
WiStore.find(:all).collect do |store|
store.name
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_store_names\n\n if @user.admin?\n find_all_storenames\n else\n @permissions.keys.sort\n end\n end",
"def get_wms_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\n cs = []\n ws.each{ |w| cs += w.wms_stores if w.wms_stores }\n cs\n end",
"def store_names\n\n names = @store_names.dup\n names << \"users\" unless names.include?(\"users\")\n names\n end",
"def stores_list\n $tracer.trace(format_method(__method__))\n return ProfileStoreList.new(@tag.find.span.className(create_ats_regex_string(\"ats-storepanel\")), format_method(__method__))\n end",
"def list_stores\n @stores = Store.where(\"level = ?\", 2)\n if @stores.present?\n render :index, status: :ok\n else\n @message = \"no store found\"\n render :error, status: :not_found\n end\n end",
"def stores\n unless @stores\n page = request(store_url)\n raise StoreRequestError unless page.code == \"200\"\n\n xml = Nokogiri::XML(page.body)\n \n @stores = {}\n \n xml.css('GotoURL SetFontStyle').each do |name_node|\n name = name_node.text\n url = name_node.parent.parent['url']\n store_id = url.match(/storeFrontId=([0-9]+)/)[1] rescue nil\n @stores[name] = store_id if store_id && name\n end\n end\n @stores\n end",
"def index\n @stores = current_account.stores.find(:all)\t\n end",
"def store_name\n promo = self.promo\n branches = promo.branches\n return unless branches.any?\n return branches.first.store.name\n end",
"def get_store_items(opts = {})\n data, _status_code, _headers = get_store_items_with_http_info(opts)\n return data\n end",
"def index\n\t\t@stores = Store.all\n\tend",
"def all_database_names\n @specs_store.names\n end",
"def pstores_names\n @pstores_names ||= begin\n Dir[\"./data/pstore/*.pstore\"].collect do |path|\n File.basename(path)\n end\n end\n end",
"def display_stores(database, store_name)\n display = $database.execute(\"SELECT DISTINCT store_name FROM shopping\")\n puts \"STORES TO GO TO\"\n puts \"***************\"\n display.each do |store|\n puts store\n end\nend",
"def find_lists_stores(list_id)\r\n\t \tstores = Store.find(:all,\r\n :conditions => [\"list_stores.list_id = ?\", list_id],\r\n :joins => [:list_stores],\r\n :select => \"stores.name, stores.id\")\r\n \tend",
"def stores\n @stores ||= config.maildirstores.map(&:path)\n end",
"def index\n @admin_stores = Store.all\n end",
"def get_store (store_name)\n each_store do |regex, s_name, store|\n return store if s_name == store_name\n end\n nil\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def get_data_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\n ds = []\n ws.each{ |w| ds += w.data_stores if w.data_stores }\n ds\n end",
"def keys\n @store.keys\n end",
"def valid_store_name\n [\"MY\", \"CA\", \"ROOT\", \"AUTHROOT\", \"DISALLOWED\", \"SPC\", \"TRUST\", \"TRUSTEDPEOPLE\", \"TRUSTEDPUBLISHER\", \"CLIENTAUTHISSUER\", \"TRUSTEDDEVICES\", \"SMARTCARDROOT\", \"WEBHOSTING\", \"REMOTE DESKTOP\"]\n end",
"def us_states\n response = get('AllUSStates')\n StoreStatesSerializer.new([]).from_xml(response) #.map(&:state)\n end",
"def purchase_in_store_list\n stores = []\n if macys?\n purchase_in_store_container_elements.each do |container|\n\n city, state = container.span_element(:class => 'line', :index => 4).text.split(',')\n state.strip!\n\n stores << {\n 'store_name' => container.span_element(:index => 0).text,\n 'address_line_1' => container.span_element(:class => 'line', :index => 0).text,\n 'address_line_2' => container.span_element(:class => 'line', :index => 1).text,\n 'address_city' => city,\n 'address_state' => state,\n 'address_zip_code' => container.span_element(:class => 'line', :index => 4).text,\n 'distance' => container.span_element(:class => 'miles-bops').text,\n 'store_hours' => container.div_element(:class =>'store-hours').text,\n }\n end\n else\n instore_availability = false\n store_header = store_container_element.div_elements(:class => 'bops_so_storeAvailability').map(&:text)\n store_header.each do |header|\n if header.include?('not available for our buy online')\n instore_availability = true\n break\n end\n end\n raise 'No in-store available stores are found' unless instore_availability\n\n store_count = 0\n container = store_container_element.div_elements(:class => 'bops_so_storeResultWrapper')\n\n if store_availability_message.include?('Buy online')\n store_count = store_count_div[/(\\d+)/, 1].to_i\n total_store_count = container.count - 1\n elsif store_availability_message.include?('not available for our buy online')\n total_store_count = container.count - 1\n end\n\n not_available_stores = false\n store_header.each do |header|\n if header.include?('Not available at')\n not_available_stores = true\n break\n end\n end\n\n if not_available_stores\n total_store_count -= 1\n end\n\n (store_count..total_store_count).each do |i|\n location_container = container[i].div_element(:class => 'bops_so_storeLocation')\n hours_container = container[i].div_element(:class => 'bops_so_storeHoursContainer')\n city_state_zip = location_container.div_element(:index => 2).text\n\n stores << {\n 'store_name' => location_container.div_element(:index => 0).text,\n 'address_line_1' => location_container.div_element(:index => 1).text,\n 'address_line_2' => '',\n 'address_city' => city_state_zip[/([^,]+)/, 1], # Everything up to the first ,\n 'address_state' => city_state_zip[/,(\\w{2})/, 1], # First two characters after the ,\n 'address_zip_code' => city_state_zip[/(\\d{5}(-\\d{4})?)$/, 1], # Last 5 digits (plus optional 4 digits)\n 'phone_number' => location_container.div_element(:index => 3).text,\n 'distance' => location_container.span_element(:class => 'bops_so_storeMiles').text.sub(' View Map', '').sub(' Hide Map', ''),\n 'store_hours' => hours_container.text\n }\n end\n end\n stores\n end",
"def index\n @stores = @commerce.stores\n end",
"def storage_names\n @storage_names\n end",
"def index\n if params[:name] == nil\n @stores = Store.all\n else\n @stores = Store.all.where(\"stores.name LIKE '%\"+params[:name]+\"%'\")\n end \n end",
"def workitems (store_name=nil)\n\n return load_user_workitems if store_name == 'users'\n return (@workitems[store_name] || []) if store_name\n\n # then return all the workitems the user has access to\n\n wis = load_user_workitems\n\n @store_names.inject(wis) do |r, sname|\n r += (@workitems[sname] || [])\n end\n end",
"def index\n @integration_stores = IntegrationStore.all\n end",
"def index\n @store_managers = StoreManager.all\n end",
"def user_stores_get_all_stores user_id, page: nil, per_page: nil\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\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\n \"user_id\" => user_id,\n }\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"page\" => page,\n \"per_page\" => per_page,\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.get query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif response.code == 404\n raise APIException.new \"Not Found\", 404, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end",
"def get_station_names\n\n\t\t# Typhoeus is used to submit http requests\n\n\t\t response = Typhoeus.get(\"http://api.bart.gov/api/stn.aspx?cmd=stns&key=ZZLI-UU93-IMPQ-DT35\")\n\n\t\t # Extract the station names and short names\n\n\t\t response_XML = Nokogiri.XML(response.body)\n\n\t\t @station_names = {}\n\n\t\t # Create a hash list of the station names and abbreviations\n\t\t # node provides the full name of the station and next node is \n\t\t # the abbreviation\n\n\t\t response_XML.xpath(\"//stations/station/name\").each do |node|\n\t\t \t\t@station_names[node.text] = node.next.text\n\t\t end\n\n\t\t return @station_names\n\n\tend",
"def store_information\n get('store')\n end",
"def show\n @created_stores = @user.created_stores.search(params[:search])\n @created_stores = @created_stores.by_state(params[:state]) if params[:state].present?\n @created_stores = @created_stores.by_type(params[:type]) if params[:type].present?\n @created_stores = @created_stores.order(:name).page(params[:page])\n end",
"def index\n set_meta_tags title: 'Stores'\n @stores = Kaminari.paginate_array(current_user.all_stores).page(params[:page]).per(25)\n end",
"def all\n # Accessing the store requires a transaction \n @store.transaction do\n # Create an array with the values for each key \n @store.roots.map { |id| @store[id] }\n end\n end",
"def index\n @stores = Store.all\n render json: @stores\n end",
"def local_store\n @stores[\"sc-chi\"]\n end",
"def lookup_store (store_name)\n each_store do |regex, name, store|\n return store if regex.match store_name\n end\n nil\n end",
"def index\n @store_items = StoreItem.all\n end",
"def item_names\n @registry.keys\n end",
"def store\n (@_stores ||= doc.xpath(\"/html/body/div[@id='storeArea']\")).first\n end",
"def index\n @stores = @stores.page(params[:page]).per(10)\n end",
"def index\n @stores = Stock.all\n end",
"def get_storage_names\n @schemas = self.get_schema\n @schemas.map { |schema| schema['id'] }\n end",
"def index\n @store_adds = StoreAdd.all\n end",
"def getStoreAktiveMap\n return @xmlStoreMap\n end",
"def store_instances(enabled_stores, store_configs)\n fail \"No stores have been enabled, see configuration file\" if enabled_stores.blank?\n fail \"No store configuration present, see configuration file\" if store_configs.blank?\n\n enabled_stores.collect do |store_name|\n STORES[store_name].new(\n store_configs.respond_to?(store_name) ? store_configs.send(store_name) : {}\n )\n end\n end",
"def get_storage_names\n select(<<-SQL.compress_lines)\n SELECT name\n FROM (SELECT * FROM sqlite_master UNION SELECT * FROM sqlite_temp_master)\n WHERE type IN('table', 'view')\n AND name NOT LIKE 'sqlite_%'\n ORDER BY name\n SQL\n end",
"def keyspace_names\n @keyspaces.keys\n end",
"def index\n if current_user.admin?\n @stores = Store.all\n else\n @stores = current_user.stores\n end\n\n render json: @stores\n end",
"def store_key; @store.to_sym; end",
"def keys\n store.keys.select{ |k| k.match(/^#{prefix}/) and self[k] }\n end",
"def get_alternate_stores(query_obj=nil)\n uri = URI.parse(@uri + \"/AlternateStores\")\n results = get(uri,query_obj)\n end",
"def index\n @stores = if params[:title]\n Store.where('name like?', \"%#{params[:title]}%\")\n else\n Store.all\n end\n end",
"def get_coverage_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\n cs = []\n ws.each{ |w| cs += w.coverage_stores if w.coverage_stores }\n cs\n end",
"def keys\n configs.keys | store.keys\n end",
"def keys\n store.keys.select { |k| k.match(/^#{prefix}/) and self[k] }\n end",
"def project_stores(_project)\n _array = []\n _stores = nil\n\n # Adding stores belonging to current project only\n # Stores with exclusive office\n if !_project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(company_id = ? AND office_id = ?)\", _project.company.id, _project.office.id)\n elsif !_project.company.blank? && _project.office.blank?\n _stores = Store.where(\"(company_id = ?)\", _project.company.id)\n elsif _project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(office_id = ?)\", _project.office.id)\n else\n _stores = nil\n end\n ret_array(_array, _stores, 'id')\n # Stores with multiple offices\n if !_project.office.blank?\n _stores = StoreOffice.where(\"office_id = ?\", _project.office.id)\n ret_array(_array, _stores, 'store_id')\n end\n\n # Returning founded stores\n _stores = Store.where(id: _array).order(:name)\n end",
"def project_stores(_project)\n _array = []\n _stores = nil\n\n # Adding stores belonging to current project only\n # Stores with exclusive office\n if !_project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(company_id = ? AND office_id = ?)\", _project.company.id, _project.office.id)\n elsif !_project.company.blank? && _project.office.blank?\n _stores = Store.where(\"(company_id = ?)\", _project.company.id)\n elsif _project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(office_id = ?)\", _project.office.id)\n else\n _stores = nil\n end\n ret_array(_array, _stores, 'id')\n # Stores with multiple offices\n if !_project.office.blank?\n _stores = StoreOffice.where(\"office_id = ?\", _project.office.id)\n ret_array(_array, _stores, 'store_id')\n end\n\n # Returning founded stores\n _stores = Store.where(id: _array).order(:name)\n end",
"def project_stores(_project)\n _array = []\n _stores = nil\n\n # Adding stores belonging to current project only\n # Stores with exclusive office\n if !_project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(company_id = ? AND office_id = ?)\", _project.company.id, _project.office.id)\n elsif !_project.company.blank? && _project.office.blank?\n _stores = Store.where(\"(company_id = ?)\", _project.company.id)\n elsif _project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(office_id = ?)\", _project.office.id)\n else\n _stores = nil\n end\n ret_array(_array, _stores, 'id')\n # Stores with multiple offices\n if !_project.office.blank?\n _stores = StoreOffice.where(\"office_id = ?\", _project.office.id)\n ret_array(_array, _stores, 'store_id')\n end\n\n # Returning founded stores\n _stores = Store.where(id: _array).order(:name)\n end",
"def all\n @store.transaction do\n @store.roots.map {|id| @store[id] }\n end\n end",
"def index\n @cakestores = Cakestore.all\n end",
"def get_storage_names\n # This gets all the non view tables, but has to strip column 0 out of the two column response.\n select(\"SHOW FULL TABLES FROM #{options[:path][1..-1]} WHERE Table_type = 'BASE TABLE'\").map { |item| item.first }\n end",
"def names\n all.map { |item| item.name_sym }\n end",
"def admin_store\n\t\t@store = current_store\n\t\t@stores = Store.all.page(params[:page]).per(10)\n\t\trender :layout => 'store_application'\n\tend",
"def index\n @products = Product.where(:store_id => current_merchant.store_name)\n end",
"def get_names\n @names\n end",
"def index\n @stores = Store.all.includes(:admin)\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n semantic_breadcrumb @store.name, store_path(@store)\n set_meta_tags title: @store.name\n @orders_count = @store.orders.count\n @users_count = @store.users_count\n end",
"def all_breweries_in_us\n state_names.collect do |state|\n name_iterate_through_json(state)\n end\n end",
"def get_store_items(storeid, item)\n \tresponse = Services::SupermarketClient.new.item_search(storeid, item)\n \tresponse.parsed_response[\"ArrayOfProduct_Commercial\"][\"Product_Commercial\"].each do |item|\n \t\tStoreItem.create(name: item[\"Itemname\"], image: item[\"ItemImage\"], description: item[\"ItemDescription\"], price: item[\"Pricing\"])\n end\n end",
"def getDeliverableStores(deliveryZipCode)\n begin\n serviceAreaId = ServableZipCode.getZipCodeServiceAreaId(deliveryZipCode)\n allDeliverableStores = Store.where(service_area_id: serviceAreaId)\n storeHash = {}\n allDeliverableStores.each do |store|\n storeHash[store.id] = store\n end\n return storeHash\n rescue => error\n renderError(HaigyManageConstant::Error::UNEXPECTED_ERROR, [\"Unable to get deliverable stores. (\", error.message, \")\"].join(\"\"))\n return nil\n end\n end",
"def getDeliverableStores(deliveryZipCode)\n begin\n serviceAreaId = ServableZipCode.getZipCodeServiceAreaId(deliveryZipCode)\n allDeliverableStores = Store.where(service_area_id: serviceAreaId)\n storeHash = {}\n allDeliverableStores.each do |store|\n storeHash[store.id] = store\n end\n return storeHash\n rescue => error\n renderError(HaigyManageConstant::Error::UNEXPECTED_ERROR, [\"Unable to get deliverable stores. (\", error.message, \")\"].join(\"\"))\n return nil\n end\n end",
"def index\n @drug_stores = DrugStore.all\n end",
"def get_item_names\n items = []\n Static.get_item_list.values.each do |f|\n items << f[\"name\"]\n end\n items\n end",
"def parse_store_data(json:)\n store_data = JSON.parse(json)\n\n stores = Array.new\n store_data['Stores'].each do |store|\n # Filter the object leaving only the keys we require\n filtered_data = store.select do |key, _value|\n %w(StoreID Phone AddressDescription ServiceHoursDescription).include?(key)\n end\n\n # Rename the keys so they are all ready to print to stdout\n mappings = { 'StoreID': 'Store #',\n 'Phone': 'Phone',\n 'AddressDescription': 'Location',\n 'ServiceHoursDescription': 'Hours' }\n\n stores.push(Hash[filtered_data.map { |k, v| [mappings[k], v] }])\n end\n puts stores\n stores\n end",
"def shop_name\n data[:shop_name]\n end",
"def index\n @store_statuses = StoreStatus.all\n end",
"def list_stations\n Station.all.collect{|obj| obj.name}.sort\n end",
"def windows_store\n self.in(WindowsStore)\n end",
"def search_for_stores(data)\n Log.instance.debug \"Searching for stores that match '#{data}'\"\n populate_page_with(data)\n search_button_element.click\n wait_for_loading_mask\n end",
"def data_store_joins(id)\n response = request(:get, \"/settings/hypervisor_zones/#{id}/data_store_joins.json\")\n response.collect { |i| i['data_store_join'] }\n end",
"def names\n @searches.names\n end",
"def index\n @api_v1_stores = Store.all\n json_response(@api_v1_stores)\n end",
"def index\n storeid = User.find(current_user).stores\n @orders = Order.all.where(store: storeid, svis: true)\n end",
"def index\n @admin_stores = Admin::Store.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_stores }\n end\n end",
"def index\n @store_flavors = StoreFlavor.all\n end",
"def session_stores\n @session_stores ||= {}\n end",
"def index\n @keystores = Keystore.all\n end",
"def index\n @storeinfos = Storeinfo.order(:id)\n end",
"def stations\r\n return @stations\r\n end",
"def printstore\n @output = \"\"\n @output << \"Store Name: #{name}\\n\"\n @output << \"Store Number: #{storenum}\\n\"\n @output << \"Store Location: #{loc}\\n\"\n @output << \"\\t Latitude: #{lat}\\n\"\n @output << \"\\t Longitude: #{long}\\n\"\n end",
"def json_stores\n @_json_stores ||= doc.xpath(\"/html/body/script[@class='tiddlywiki-tiddler-store']\")\n end",
"def index\n @dish_features = @store.dish_features.includes(:store)\n end",
"def instruments_names\n instruments_s = \"\"\n\n instruments.each do |instrument|\n instruments_s += instrument.name + \", \"\n end\n\n return instruments_s.first(instruments_s.length-2)\n end",
"def service_names\n @services.keys\n end"
] |
[
"0.71889263",
"0.688306",
"0.64553434",
"0.6337646",
"0.6303855",
"0.61992735",
"0.6159913",
"0.61306286",
"0.6119914",
"0.60766655",
"0.6008347",
"0.6000676",
"0.59800816",
"0.5974715",
"0.59460187",
"0.59197265",
"0.58701867",
"0.5842894",
"0.5842894",
"0.5842894",
"0.5842894",
"0.5842894",
"0.5810751",
"0.57415056",
"0.57241637",
"0.5716436",
"0.5692147",
"0.5659681",
"0.5632724",
"0.56212395",
"0.5602754",
"0.5594963",
"0.55935013",
"0.5588324",
"0.5574102",
"0.55576116",
"0.5542913",
"0.5524594",
"0.5428972",
"0.5403415",
"0.53902704",
"0.53841144",
"0.5380332",
"0.5377611",
"0.5376436",
"0.53452003",
"0.5335491",
"0.5302807",
"0.5291444",
"0.52760315",
"0.5268342",
"0.52462626",
"0.52175295",
"0.52158153",
"0.52120256",
"0.52107084",
"0.520961",
"0.52006984",
"0.51992345",
"0.519014",
"0.51849574",
"0.5159143",
"0.5159143",
"0.5159143",
"0.5154939",
"0.5154769",
"0.5143953",
"0.5140154",
"0.51296204",
"0.5117461",
"0.51001877",
"0.5090836",
"0.5089105",
"0.5077699",
"0.50759417",
"0.5072702",
"0.5072702",
"0.5061904",
"0.50552267",
"0.5051366",
"0.5051288",
"0.50458217",
"0.5040354",
"0.503319",
"0.50273955",
"0.50273323",
"0.5026839",
"0.50210255",
"0.5013107",
"0.50043803",
"0.49872112",
"0.4975078",
"0.49698186",
"0.49652",
"0.4961784",
"0.4947299",
"0.49444705",
"0.49426308",
"0.49422106",
"0.49388582"
] |
0.8794882
|
0
|
Returns the mapping "storename" > Permission instance
|
def find_permissions
return nil if @user.admin?
groupnames = Group.find_groups(@user)
StorePermission.find_all_by_groupname(groupnames).inject({}) do
|result, permission|
result[permission.storename] = permission
result
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def permission (store_name)\n\n return RWD_STORE_PERMISSION if @user.admin?\n return RWD_STORE_PERMISSION if store_name == 'users'\n @permissions[store_name]\n end",
"def permissions = {}",
"def permission_mapping\n super.merge(\n {\n 'index_role_screen' => 'index',\n 'index_role_field' => 'index',\n 'index_user_screen' => 'index',\n 'index_user_field' => 'index',\n 'fetch_row' => 'index'\n }\n )\n end",
"def find_store_names\n\n if @user.admin?\n find_all_storenames\n else\n @permissions.keys.sort\n end\n end",
"def get_permissions permissions_ds\n # default to rightsMetadata (like standard Hydra) if permissions_ds isn't set\n permissions_ds = \"rightsMetadata\" if permissions_ds.to_s == \"\"\n (datastreams[permissions_ds].groups.map {|x| {:type=>'group', :access=>x[1], :name=>x[0] }} + \n datastreams[permissions_ds].individuals.map {|x| {:type=>'user', :access=>x[1], :name=>x[0]}})\n\n (datastreams[permissions_ds].groups.map {|x| {:type=>'group', :access=>x[1], :name=>x[0] }} + \n datastreams[permissions_ds].individuals.map {|x| {:type=>'user', :access=>x[1], :name=>x[0]}})\n end",
"def permission_set\n @attributes[:permission_set]\n end",
"def get_permissions (user, store_name)\n s = \"\"\n [ :read, :write, :delegate ].each do |action|\n s << action.to_s[0, 1] \\\n if @auth_system.authorized?(user, store_name, action)\n end\n s\n end",
"def permission(name)\n permissions.detect { |p| p.name == name }\n end",
"def mapping\n {key => name}\n end",
"def get_permissions\n permissions.keys\n end",
"def get_permissions\n permissions.keys\n end",
"def policy\n self.permissions['policy'].to_sym\n end",
"def objects\n @object_permission_map.keys\n end",
"def user_permission_keys\n new_record? ? [] : self.permissions(true).collect(&:key)\n end",
"def default_permission\n\t\treturn self.app_id.downcase.gsub(/\\W+/, '_' ).to_sym\n\tend",
"def get_permissions\n permissions = Hash.new\n permissions[:CanEditAllTeams] = 1\n permissions[:CanEditAllPlayers] = 2\n permissions[:CanEditAllSeasons] = 3\n permissions[:CanEditAllDivisions] = 4\n permissions[:CanEditAllRatings] = 5\n permissions[:CanEditAllRoles] = 6\n permissions[:CanEditAllPermissions] = 7\n permissions[:CanImport] = 8\n permissions[:CanApproveRatings] = 10\n @permissions = permissions\n end",
"def solr_field_for(permission_type, permission_category)\n permissions = Hydra.config.permissions[permission_type.to_sym]\n permission_category == 'group' ? permissions.group : permissions.individual\n end",
"def permissions_cache_key\n \"#{self.cache_key}/permissions\"\n end",
"def access_rights_for_permission(perm)\n sym = Lockdown.get_symbol(perm)\n\n permissions[sym]\n rescue \n raise SecurityError, \"Permission requested is not defined: #{sym}\"\n end",
"def [](resource_name)\n case\n when store.respond_to?(:read)\n store.read key_for(resource_name)\n when store.respond_to?(:[])\n store[key_for(resource_name)]\n when store.respond_to?(:get)\n store.get key_for(resource_name)\n end\n end",
"def collection\n @collection ||= Permission.all\n end",
"def property_to_rest_mapping\n {\n :name => :aclname,\n :interface => :Interface,\n }\n end",
"def store_key; @store.to_sym; end",
"def role\n permission_type\n end",
"def permission_for (collection)\n permission = Permission.find_or_create_by_user_id_and_collection_id(self.id, collection.id)\n end",
"def prepare_permission(machine, perm, opts)\n key = \"map_#{perm}\".to_sym\n return nil if opts.has_key?(key) && opts[key].nil?\n\n # The options on the hash get priority, then the default\n # values\n value = opts.has_key?(key) ? opts[key] : machine.config.nfs.send(key)\n return value if value != :auto\n\n # Get UID/GID from guests user if we've made it this far\n # (value == :auto)\n return machine.guest.capability(\"read_#{perm}\".to_sym)\n end",
"def permissions_hash\n @permissions_hash = permissions.hash\n end",
"def access_grant_model\n @access_grant_model ||= access_grant_class.constantize\n end",
"def resource_sym\n mapping.singular\n end",
"def permissions\n @attributes[:permissions]\n end",
"def permissions\n @attributes[:permissions]\n end",
"def parse_permission(name)\n if name.reverse.index(VIEWER.reverse)\n return VIEWER\n elsif name.reverse.index(EDITOR.reverse)\n return EDITOR\n elsif name.reverse.index(USER.reverse)\n return USER\n elsif name.reverse.index(ADMIN.reverse)\n return ADMIN\n else\n @logger.info \"Error in parsing permission\"\n end\n nil\n end",
"def permissions\n read_attribute(:permissions) || {}\n end",
"def parse_permission(name)\n if name.reverse.index(VIEWER.reverse)\n return VIEWER\n elsif name.reverse.index(EDITOR.reverse)\n return EDITOR\n elsif name.reverse.index(USER.reverse)\n return USER\n elsif name.reverse.index(ADMIN.reverse)\n return ADMIN\n else\n @logger.info \"Error in parsing permission\"\n end\n nil\n end",
"def show\n @permissions = Permission.all\n end",
"def default_entities_for_permission(type, access)\n default_permissions.collect { |p| p[:name] if p[:type] == type and p[:access] == access }.compact\n end",
"def default_entities_for_permission(type, access)\n default_permissions.collect { |p| p[:name] if p[:type] == type and p[:access] == access }.compact\n end",
"def permissions\n attribute_prop(5)\n end",
"def permission_keys\n return @permission_keys if @permission_keys\n\n role_keys = if role(true)\n role_key = \"#{role.cache_key}/permissions\"\n\n keys = Rails.cache.fetch(role_key) do\n role.permission_keys.clone\n end\n\n Rails.cache.write(role_key, keys)\n keys\n else\n []\n end\n\n user_keys = Rails.cache.fetch(permissions_cache_key) do\n user_permission_keys.clone\n end\n\n user_keys = [] unless user_keys\n\n Rails.cache.write(permissions_cache_key, keys) unless new_record?\n\n @permission_keys = (role_keys + user_keys).uniq\n end",
"def show\n @permissions = @role.permissions\n end",
"def store_information\n get('store')\n end",
"def getStoreAktiveMap\n return @xmlStoreMap\n end",
"def permission_scheme\n # Get the permission scheme class variable\n class_variables.include?('@@permission_scheme') ? class_variable_get(:@@permission_scheme) : {}\n end",
"def write_permission(model, cancan_action, name)\n permission = Permission.find(:first, :conditions => [\"subject_class = ? and action = ?\", model, cancan_action])\n unless permission\n permission = Permission.new\n permission.name = name\n permission.subject_class = model\n permission.action = cancan_action\n permission.save\n end\nend",
"def write_permission(model, cancan_action, name)\n permission = Permission.find(:first, :conditions => [\"subject_class = ? and action = ?\", model, cancan_action])\n unless permission\n permission = Permission.new\n permission.name = name\n permission.subject_class = model\n permission.action = cancan_action\n permission.save\n end\nend",
"def p_id(controller, action)\r\n Permission.find_by_controller_and_action(controller.to_s,action.to_s).id\r\nend",
"def access_list\n\t\tif(MARKETPLACE_MODE_ONLINE_SHOP)\n\t\t\treturn {}\n\t\telse\n\t\t\tacl = self.acl\n\t\t\tacl = {} if(acl.blank?)\n\t\t\tacl[:creator_user_id] = self.user_id\n\t\t\treturn self.acl\n\t\tend\n\tend",
"def model_actions(perms)\n ActiveRecord::Base.descendants.each do |m|\n next unless m.respond_to?(:permission_definition)\n next if m.permission_definition.nil? || m.permission_definition == {}\n perms << PermissionsGenerator.new(m)\n end\n return perms\nend",
"def permission_classification\n return @permission_classification\n end",
"def billing_permission\n @attributes[:billing_permission]\n end",
"def create_new_permissions\n @permissions.each do |key|\n next if Lockdown::System.permission_assigned_automatically?(key)\n str = Lockdown.get_string(key)\n p = ::Permission.find(:first, :conditions => [\"name = ?\", str])\n unless p\n Lockdown.logger.info \">> Lockdown: Permission not found in db: #{str}, creating.\"\n ::Permission.create(:name => str)\n end\n end\n end",
"def access_by_key(access_by)\n \"#{access_by.id}--#{access_by.app_type_id}\"\n end",
"def show\n @all_permissions = Permission.all\n end",
"def permissions\n Roles.type_map[role_type].permissions\n end",
"def permissions_info(sco_id, filter = nil)\n res = query(\"permissions-info\", \"acl-id\" => sco_id, \"filter\" => filter)\n\n return res.body\n data = XmlSimple.xml_in(res.body)\n if data['permissions'][0]\n return data['permissions'][0]\n end\n #puts YAML::dump(data)\n# if data[\"sco\"][0]\n# return data[\"sco\"][0]\n# end\n end",
"def get_permission(name, return_boolean = true)\n value = nil\n\n role_permissions.each do |permission|\n next if permission.name != name\n\n value = if permission.enabled\n permission.value\n else\n default_value(name)\n end\n end\n\n # Create the role_permissions since it doesn't exist\n role_permissions.create(name: name) if value.nil?\n\n if return_boolean\n value == \"true\"\n else\n value\n end\n end",
"def permission\n return @children['permission'][:value]\n end",
"def key\n store_as.to_s\n end",
"def manager_permissions\n can :manage_collection, String do |pid|\n Rails.logger.debug(\"[MANPERM] Checking from STRING\")\n test_manager(pid)\n end\n\n can :manage_collection, DRI::Batch do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from Object\")\n test_manager(obj.id)\n end\n\n can :manage_collection, SolrDocument do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from SolrDoc\")\n cache.put(obj.id, obj)\n test_manager(obj.id)\n end\n\n can :manage, String do |pid|\n Rails.logger.debug(\"[MANPERM] Checking from STRING\")\n test_manager(pid)\n end\n\n can :manage, DRI::Batch do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from Object\")\n test_manager(obj.id)\n end\n\n can :manage, SolrDocument do |obj|\n Rails.logger.debug(\"[MANPERM] Checking from SolrDoc\")\n cache.put(obj.id, obj)\n test_manager(obj.id)\n end\n end",
"def simple_get_acc_res_permission(permission)\n unless self.acc_group\n return 0\n end\n right = self.acc_group.acc_group_rights.find(:first, :conditions => \"acc_rights.name = '#{permission}'\", :include => :acc_right) if self.is_accountant? or self.is_reseller?\n if right\n return right.value.to_i\n else\n return 0\n end\n end",
"def index\n @permissions = Permission.all\n end",
"def map name\n @mapper[name]\n end",
"def is_authorized_to_edit_locations_of store\n store = store.id if store.is_a? Store\n return true if is_authorized_to_create_locations_of(store)\n @a = Authorization.find_by_target_id_and_target_type_and_user_id(store, 'Store', id) && [1,2].include?(@a.authorization_type)\n end",
"def permissions_for(game)\n self.permissions.where(\"user_roles.game_id = ?\", game.id)\n end",
"def grant_permission\n @attributes[:grant_permission]\n end",
"def your_project_access_type policy = nil, resource = nil\n unless policy.nil? or resource.nil? or !(policy.sharing_scope == Policy::ALL_SYSMO_USERS)\n unless policy.permissions.empty?\n my_project_ids = if resource.class == Project then [resource.id] else resource.project_ids end\n my_project_perms = policy.permissions.select {|p| p.contributor_type == 'Project' and my_project_ids.include? p.contributor_id}\n access_types = my_project_perms.map(&:access_type)\n return access_types.first if access_types.all?{|acc| acc == access_types.first}\n else\n policy.access_type\n end\n end\n end",
"def permissions\n return @permissions\n end",
"def get_permission_menu\n return @client.raw(\"get\", \"/helpers/menu\")\n end",
"def mapping_from_name(name)\n const_get(\"#{name}_mapping\".upcase)\n end",
"def is_authorized_to_create_locations_of store\n store = store.id if store.is_a? Store\n return true if authorized_to_authorize(Store.find(store))\n Authorization.find_by_authorization_type_and_target_id_and_target_type_and_user_id(1, store, 'Store', id)\n end",
"def store_as\n @store_as ||= (@options[:store_as].try(:to_s) || name.to_s)\n end",
"def mapping(name)\n mappings.find{ |mapping| mapping.name == name }\n end",
"def site_maps\n if current_user && current_user.admin?\n Map.all\n else\n Map.active\n end\n end",
"def permissions( force_reload = false )\n\n # Two levels of joins here, so can't use has_many :through\n if force_reload\n @permissions = nil \n @permissions_by_class_and_op = {}\n end\n\n cond_str = 'role_id in ' + self.class.role_assigned_cond( '?' )\n if !instance_variable_defined?(\"@permissions\") || @permissions.nil?\n @permissions ||= Permission.where([cond_str, self]).to_a\n end\n\n return @permissions\n end",
"def load_permissions_from_user\n # user_permission_sets = user.permission_sets.entries\n user_permission_sets = user.roles.first ? user.roles.first.permission_sets.entries : []\n\n Hash.new do |h, k|\n h[k] = user_permission_sets.detect { |set| set.name == k } || SessionPermissionSet.new(k, 0)\n end\n end",
"def get_store (store_name)\n each_store do |regex, s_name, store|\n return store if s_name == store_name\n end\n nil\n end",
"def storage_key\n self.class.member_path(self[self.class.param_name])\n end",
"def restapi_permission\n @attributes[:restapi_permission]\n end",
"def state_permission(permission); end",
"def findAccession(name)\n if arr = @obo[name]\n arr\n else\n @missedMappings << name\n [\"\", \"\"]\n end\n end",
"def add_permissions\n [\"License\", \"Archive\", \"Contract\"].each do |doc|\n klass = doc.constantize\n doc_id = \"#{doc.downcase}_id\".to_sym\n permissions = self.send(\"#{doc.downcase.pluralize.singularize}_permissions\".to_sym)\n klass.find(:all).each { |record|\n permissions.create doc_id => record.id, :ycrole_id => self.id,\n :can_read => false, :can_write => false\n }\n end\n end",
"def get_permission_name(permission)\n case permission\n when Footprint32::PRIVATE\n return \"Private\"\n when Footprint32::FRIENDS\n return \"Friends\"\n else\n return \"Public\"\n end\n end",
"def preserved(type, permission)\n # Always preserves exceptions\n g = Hash[rightsMetadata.quick_search_by_type(type).select {|k, v| v == 'exceptions'}] || {} \n\n case permission\n when :exceptions\n # Preserves edit groups/users \n g.merge! Hash[rightsMetadata.quick_search_by_type(type).select {|k, v| v == 'edit'}]\n when :read\n g.merge! Hash[rightsMetadata.quick_search_by_type(type).select {|k, v| v == 'edit'}]\n when :discover\n g.merge! Hash[rightsMetadata.quick_search_by_type(type).select {|k, v| v == 'discover'}]\n end\n g\n end",
"def key_name\n MapEntryType::KEY_NAME\n end",
"def set_permission\n if params[:action] == 'show'\n @permission = Permission.find(params[:id])\n else\n @permission = Permission.find(params[:id])\n end\n end",
"def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end",
"def reverse_get mapping\n (@map.rassoc(mapping) || (raise \"#{mapping} is not a mapping of a registered id\"))[0]\n end",
"def map_name; end",
"def storage_pair(key)\n field = key.to_s\n name = aliases[field] || field\n [ name, serializers[name] ]\n end",
"def permission\n perm = data.fetch(\"permissionSources\")\n .map { |i| i[\"permission\"] }\n .first\n .downcase\n GITHUB_TO_TERRAFORM_PERMISSIONS.fetch(perm)\n end",
"def findAccession(name)\n if arr = @obo[name]\n arr\n else\n# @missedMappings << name\n# [\"\", \"\"]\n @non_obo_mappings << name\n [\"\", name]\n end\n end",
"def authorize (permission_name)\n self.allowances.detect {|a| a.permission.name == permission_name.to_s}\n end",
"def dav_permission\n @attributes[:dav_permission]\n end",
"def dav_permission\n @attributes[:dav_permission]\n end",
"def permissions\n Rails.cache.fetch(\"permissions_#{self.id}\", expire_in: 1.month) do\n self.roles.map(&:permissions).flatten\n end\n end",
"def permissions\n objects_from_response(Code42::Permission, :get, 'permission')\n end",
"def load_permissions \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]} \n end",
"def get(token)\n access = @store.read(key_for(token))\n if access\n access[:anonymous] = access[:identity] == Hadley::ANONYMOUS_IDENTITY\n end\n access\n end",
"def one_object_perm privilege, obj\n Permission.new( :privilege => privilege,\n :class_name => obj.class.name,\n :is_grant => false,\n :has_grant_option => false,\n :target_owned_by_self => false,\n :target => obj\n )\n \n end",
"def permission_grants\n return @permission_grants\n end"
] |
[
"0.677501",
"0.6169189",
"0.6016778",
"0.5778898",
"0.5659508",
"0.56052434",
"0.5601946",
"0.5568518",
"0.55033296",
"0.5458634",
"0.5458634",
"0.54528016",
"0.54023063",
"0.53707504",
"0.5334834",
"0.53318614",
"0.5313097",
"0.52998924",
"0.52880937",
"0.52857155",
"0.527564",
"0.5264033",
"0.5260181",
"0.5259785",
"0.52294075",
"0.5228201",
"0.52182245",
"0.5213138",
"0.52073455",
"0.5204615",
"0.5204615",
"0.5195826",
"0.5188649",
"0.51779115",
"0.5150722",
"0.51505363",
"0.51505363",
"0.5135833",
"0.51310414",
"0.51180214",
"0.51055306",
"0.5102718",
"0.50904965",
"0.5071386",
"0.5071386",
"0.5037125",
"0.5029901",
"0.5001762",
"0.49814743",
"0.49766633",
"0.49756232",
"0.49699736",
"0.49698117",
"0.49636042",
"0.49562216",
"0.49356362",
"0.49215183",
"0.49097717",
"0.48901695",
"0.48839808",
"0.48767543",
"0.48757443",
"0.4874658",
"0.486749",
"0.48626736",
"0.48617175",
"0.4854857",
"0.48531103",
"0.48520032",
"0.48489743",
"0.48476917",
"0.48418254",
"0.4840062",
"0.48380408",
"0.48302945",
"0.48238966",
"0.48004597",
"0.47975108",
"0.4794575",
"0.47929385",
"0.47870952",
"0.4785724",
"0.47856218",
"0.47834226",
"0.47808877",
"0.47804797",
"0.47727042",
"0.47726732",
"0.4770671",
"0.4769349",
"0.476868",
"0.47678456",
"0.47661793",
"0.47661793",
"0.4765793",
"0.47448385",
"0.47405526",
"0.47354102",
"0.4734887",
"0.47268373"
] |
0.6694527
|
1
|
Returns a list of Store instances.
|
def find_store_names
if @user.admin?
find_all_storenames
else
@permissions.keys.sort
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def store_instances(enabled_stores, store_configs)\n fail \"No stores have been enabled, see configuration file\" if enabled_stores.blank?\n fail \"No store configuration present, see configuration file\" if store_configs.blank?\n\n enabled_stores.collect do |store_name|\n STORES[store_name].new(\n store_configs.respond_to?(store_name) ? store_configs.send(store_name) : {}\n )\n end\n end",
"def index\n\t\t@stores = Store.all\n\tend",
"def index\n @store_managers = StoreManager.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def index\n @stores = Store.all\n end",
"def stores_list\n $tracer.trace(format_method(__method__))\n return ProfileStoreList.new(@tag.find.span.className(create_ats_regex_string(\"ats-storepanel\")), format_method(__method__))\n end",
"def index\n @admin_stores = Store.all\n end",
"def index\n @stores = current_account.stores.find(:all)\t\n end",
"def find_all_storenames\n\n WiStore.find(:all).collect do |store|\n store.name\n end\n end",
"def index\n @integration_stores = IntegrationStore.all\n end",
"def index\n @store_items = StoreItem.all\n end",
"def all\n @store.transaction do\n @store.roots.map {|id| @store[id] }\n end\n end",
"def all\n # Accessing the store requires a transaction \n @store.transaction do\n # Create an array with the values for each key \n @store.roots.map { |id| @store[id] }\n end\n end",
"def index\n @stores = Store.all\n render json: @stores\n end",
"def get_store_items(opts = {})\n data, _status_code, _headers = get_store_items_with_http_info(opts)\n return data\n end",
"def stores\n @stores ||= config.maildirstores.map(&:path)\n end",
"def instances\n @instances ||= begin\n h = {}\n PPStore::new(app.pstore_new_sujets).each_root(except: :last_id) do |ps, art_id|\n h.merge! art_id => new( art_id )\n end\n h\n end\n end",
"def index\n @stores = @stores.page(params[:page]).per(10)\n end",
"def index\n @stores = Stock.all\n end",
"def index\n @store = store.index\n end",
"def index\n @stores = @commerce.stores\n end",
"def index\n @api_v1_stores = Store.all\n json_response(@api_v1_stores)\n end",
"def index\n @store_products = StoreProduct.all\n end",
"def index\n @store_adds = StoreAdd.all\n end",
"def list_stores\n @stores = Store.where(\"level = ?\", 2)\n if @stores.present?\n render :index, status: :ok\n else\n @message = \"no store found\"\n render :error, status: :not_found\n end\n end",
"def index\n @store_to_visits = StoreToVisit.all\n end",
"def stores\n unless @stores\n page = request(store_url)\n raise StoreRequestError unless page.code == \"200\"\n\n xml = Nokogiri::XML(page.body)\n \n @stores = {}\n \n xml.css('GotoURL SetFontStyle').each do |name_node|\n name = name_node.text\n url = name_node.parent.parent['url']\n store_id = url.match(/storeFrontId=([0-9]+)/)[1] rescue nil\n @stores[name] = store_id if store_id && name\n end\n end\n @stores\n end",
"def index\n @store_tabs = StoreTab.all\n end",
"def index\n @store_orders = StoreOrder.all\n end",
"def instances()\n return @instances\n end",
"def get_data_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\n ds = []\n ws.each{ |w| ds += w.data_stores if w.data_stores }\n ds\n end",
"def all\n raise ArgumentError, \"No type specified for query\" if @type.nil?\n\n @store.load_from_url(uri_builder.resources_uri(@type, to_query))\n end",
"def index\n if current_user.admin?\n @stores = Store.all\n else\n @stores = current_user.stores\n end\n\n render json: @stores\n end",
"def index\n @cakestores = Cakestore.all\n end",
"def get_wms_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\n cs = []\n ws.each{ |w| cs += w.wms_stores if w.wms_stores }\n cs\n end",
"def index\n @keystores = Keystore.all\n end",
"def index\n @book_stores = BookStore.all\n end",
"def index\n @admin_stores = Admin::Store.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_stores }\n end\n end",
"def show\n @created_stores = @user.created_stores.search(params[:search])\n @created_stores = @created_stores.by_state(params[:state]) if params[:state].present?\n @created_stores = @created_stores.by_type(params[:type]) if params[:type].present?\n @created_stores = @created_stores.order(:name).page(params[:page])\n end",
"def get_instances\n instances = [ ]\n get_clouds.each do |cloud|\n instances += cloud.instances.index(:filter => [], :view => 'tiny')\n end\n instances\n end",
"def show\n @products = Product.all\n @stores = Store.all\n end",
"def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end",
"def index\n @store_flavors = StoreFlavor.all\n end",
"def keys\n @store.keys\n end",
"def instances\n @instances ||= []\n end",
"def list(\n filter,\n *args,\n deadline: nil\n )\n return @secret_stores.list(\n filter,\n *args,\n deadline: deadline,\n )\n end",
"def index\n @store_order_items = StoreOrderItem.all\n end",
"def all\n storage\n end",
"def list\n @redis.hgetall(STORE_KEY).sort.map do |name, command|\n AliasedCommand.new(name, command)\n end\n end",
"def store_list\n $tracer.trace(format_method(__method__))\n return GameStopStoreList.new(@tag.find.div.id(\"overlay_addrbox\"), @spec)\n end",
"def index\n @store_transactions = StoreTransaction.all\n end",
"def index\n set_meta_tags title: 'Stores'\n @stores = Kaminari.paginate_array(current_user.all_stores).page(params[:page]).per(25)\n end",
"def index\n @contact_stores = ContactStore.all\n end",
"def store\n @store ||= Store.new\n end",
"def session_stores\n @session_stores ||= {}\n end",
"def index\n Shop.set_store_session\n @products = ShopifyAPI::Product.all\n end",
"def index\n @storeinfos = Storeinfo.order(:id)\n end",
"def values\n @store.all_values\n end",
"def project_stores(_project)\n _array = []\n _stores = nil\n\n # Adding stores belonging to current project only\n # Stores with exclusive office\n if !_project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(company_id = ? AND office_id = ?)\", _project.company.id, _project.office.id)\n elsif !_project.company.blank? && _project.office.blank?\n _stores = Store.where(\"(company_id = ?)\", _project.company.id)\n elsif _project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(office_id = ?)\", _project.office.id)\n else\n _stores = nil\n end\n ret_array(_array, _stores, 'id')\n # Stores with multiple offices\n if !_project.office.blank?\n _stores = StoreOffice.where(\"office_id = ?\", _project.office.id)\n ret_array(_array, _stores, 'store_id')\n end\n\n # Returning founded stores\n _stores = Store.where(id: _array).order(:name)\n end",
"def project_stores(_project)\n _array = []\n _stores = nil\n\n # Adding stores belonging to current project only\n # Stores with exclusive office\n if !_project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(company_id = ? AND office_id = ?)\", _project.company.id, _project.office.id)\n elsif !_project.company.blank? && _project.office.blank?\n _stores = Store.where(\"(company_id = ?)\", _project.company.id)\n elsif _project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(office_id = ?)\", _project.office.id)\n else\n _stores = nil\n end\n ret_array(_array, _stores, 'id')\n # Stores with multiple offices\n if !_project.office.blank?\n _stores = StoreOffice.where(\"office_id = ?\", _project.office.id)\n ret_array(_array, _stores, 'store_id')\n end\n\n # Returning founded stores\n _stores = Store.where(id: _array).order(:name)\n end",
"def project_stores(_project)\n _array = []\n _stores = nil\n\n # Adding stores belonging to current project only\n # Stores with exclusive office\n if !_project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(company_id = ? AND office_id = ?)\", _project.company.id, _project.office.id)\n elsif !_project.company.blank? && _project.office.blank?\n _stores = Store.where(\"(company_id = ?)\", _project.company.id)\n elsif _project.company.blank? && !_project.office.blank?\n _stores = Store.where(\"(office_id = ?)\", _project.office.id)\n else\n _stores = nil\n end\n ret_array(_array, _stores, 'id')\n # Stores with multiple offices\n if !_project.office.blank?\n _stores = StoreOffice.where(\"office_id = ?\", _project.office.id)\n ret_array(_array, _stores, 'store_id')\n end\n\n # Returning founded stores\n _stores = Store.where(id: _array).order(:name)\n end",
"def index\n @stores = Store.all\n prepFormVariables\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stores }\n end\n end",
"def all_active_shops\n Shop.all\n end",
"def _all\n out = {}\n ids.each {|i| @store.transaction(true) {out[i] = @store[i]}}\n out\n end",
"def all\n storage.map(&:repository)\n end",
"def instances_list\n return [] unless configured?\n\n @service.fetch_all do |token|\n @service.list_instances(@gcp_config['project'], @gcp_config['zone'], page_token: token)\n end.map(&:name)\n end",
"def hops_store_list\n $tracer.trace(__method__)\n #return GameStopHopsStoreList.new(jquery(\"table[id~='searchResults']> tbody > tr\"))\n return GameStopHopsStoreList.new(table.id(\"/searchResults/\").tbody.tr, __method__)\n end",
"def index\n @stores = Store.by_id\n @categories = Category.all\n\n end",
"def get_coverage_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\n cs = []\n ws.each{ |w| cs += w.coverage_stores if w.coverage_stores }\n cs\n end",
"def index\n @store_statuses = StoreStatus.all\n end",
"def store\n _store_id = store_id\n ::Spree::User.logger.debug \"| ByParameters: store_id #{_store_id}\"\n store = _store_id ? ::Spree::Store.where(id: _store_id).first : nil\n store || Spree::Store.new\n end",
"def store\r\n return @store\r\n end",
"def store\n return self.class.store\n end",
"def show\n render json: @store\n end",
"def index\n @stores = Store.all.includes(:admin)\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n storeid = User.find(current_user).stores\n @orders = Order.all.where(store: storeid, svis: true)\n end",
"def list\n storage.transaction {return storage.roots}\n end",
"def instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving active instances\"\n fetch_instances\n end",
"def sale_entities\n redis.smembers(\"#{Porp.ns}:stockentity:id:#{id}:saleentities)\")\n end",
"def stores\n [\n checksum_store,\n compiled_content_cache,\n @dependency_store,\n rule_memory_store,\n ]\n end",
"def stock_entities\n redis.smembers(\"#{Porp.ns}:saleentity:id:#{id}:stockentities\")\n end",
"def index\n @store_books = StoreBook.all\n end",
"def get_store_items(storeid, item)\n \tresponse = Services::SupermarketClient.new.item_search(storeid, item)\n \tresponse.parsed_response[\"ArrayOfProduct_Commercial\"][\"Product_Commercial\"].each do |item|\n \t\tStoreItem.create(name: item[\"Itemname\"], image: item[\"ItemImage\"], description: item[\"ItemDescription\"], price: item[\"Pricing\"])\n end\n end",
"def fetch_store\n @store ||= self.store || create_store!\n end",
"def get_shelves\n shelves = [@shelf_ag, @shelf_hp, @shelf_qz]\n return shelves\n end",
"def store\n @store\n end",
"def store\n @store\n end",
"def initialize\n @store = []\n end",
"def get_objects(syncer, query, status)\n\t\traise \"getObjects: Not Implemented\"\n\t\t\n\t\t# object_list = []\n\t\t# #for each object that matches the query\n\t\t# # object = an active record database object that contains the information from the store object\n\t\t# # store_object_id = the object_id of the store object\n\t\t# object.set_dbID(syncer, self, store_object_id)\n\t\t# object_list.push(object)\n\t\t# #end\n\t\t# return object_list\n\tend",
"def index\n @products = Product.where(:store_id => current_merchant.store_name)\n end",
"def shoes\n results = DATABASE.execute(\"SELECT * FROM shoes WHERE category_id = #{@id};\")\n\n store_results = []\n\n results.each do |hash|\n store_results << Shoe.new(hash)\n end\n\n return store_results\n end",
"def get_instances\n all_instances = Array.new()\n @groups.values.each do |instances|\n instances.each do |instance|\n all_instances << instance\n end\n end\n all_instances\n end",
"def set_store\n\t\t\t@store = Store.includes(stocks: :item).find(params[:id])\n\t\tend",
"def index\n @store_type = StoreType.new\n @store_types = StoreType.active\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @store_types }\n end\n end",
"def store(options = {})\n each(&:store)\n self\n end",
"def instances #:nodoc:\n r = []\n ObjectSpace.each_object(self) { |mod| r << mod }\n r\n end",
"def index\n @drug_stores = DrugStore.all\n end"
] |
[
"0.71081614",
"0.69828284",
"0.69593227",
"0.68698156",
"0.68698156",
"0.68698156",
"0.68698156",
"0.68698156",
"0.6759534",
"0.67400247",
"0.6716083",
"0.6543452",
"0.65233463",
"0.6468889",
"0.64407545",
"0.6394418",
"0.6380012",
"0.6371188",
"0.6368392",
"0.6259121",
"0.62297785",
"0.62011826",
"0.6188664",
"0.6178609",
"0.61768216",
"0.6151986",
"0.6107742",
"0.61065876",
"0.6104382",
"0.609738",
"0.60876614",
"0.6080498",
"0.60369194",
"0.60311997",
"0.6028404",
"0.60227853",
"0.60168916",
"0.59680235",
"0.5924024",
"0.5921881",
"0.59116775",
"0.5910734",
"0.58697045",
"0.58680457",
"0.58654606",
"0.58171505",
"0.5805615",
"0.5802182",
"0.5796298",
"0.5793445",
"0.5778104",
"0.5765036",
"0.57465404",
"0.5739752",
"0.5737947",
"0.5721119",
"0.57081664",
"0.57005256",
"0.57001823",
"0.56998515",
"0.5695848",
"0.56949335",
"0.56949335",
"0.56949335",
"0.5648172",
"0.5640999",
"0.5630043",
"0.5622499",
"0.5622372",
"0.561768",
"0.5612007",
"0.5611875",
"0.56064093",
"0.5598591",
"0.559352",
"0.55930334",
"0.5592292",
"0.55873865",
"0.558342",
"0.5570245",
"0.55596256",
"0.5555137",
"0.55440074",
"0.55433494",
"0.5540323",
"0.5529902",
"0.5518901",
"0.5513734",
"0.55101484",
"0.55101484",
"0.5505628",
"0.5505134",
"0.55008173",
"0.5497844",
"0.5483393",
"0.548229",
"0.54501987",
"0.54477054",
"0.5441695",
"0.5439218"
] |
0.5544448
|
82
|
Companion function to the !roles command used to generate the embeds for each group
|
def generate_embed(index)
embed = Discordrb::Webhooks::Embed.new
embed.color = 0xFFD700
# If index for a role group is given, generate embed for that group
if index > 0
group = AssignableRoleGroup.all[index - 1]
embed.author = {
name: "Group: #{group.name}",
icon_url: BOT_AVATAR_URL
}
embed.description = <<~DESC.strip
#{group.description}
#{group.is_exclusive ? '**This group is exclusive; you can only have one role from it at a time.**' : nil}
DESC
roles_text = if group.roles.any?
group.roles.map do |role|
if role.description
"• `!#{role.key}` **#{SERVER.role(role.id).name}** - *#{role.description}*"
else
"• `!#{role.key}` **#{SERVER.role(role.id).name}**"
end
end.join("\n")
else
'No roles found.'
end
embed.add_field(
name: 'Roles',
value: roles_text
)
embed.footer = {text: "Group key: #{group.key}"}
# Otherwise, generate an embed for ungrouped roles
else
roles = AssignableRole.all.reject { |r| r.group }
embed.author = {
name: "Ungrouped Roles",
icon_url: BOT_AVATAR_URL
}
embed.description = <<~DESC_DICHADO.strip
This is a list of all assignable roles that do not have a group.
Use a role's command to assign it to you, and use it again to remove it.
DESC_DICHADO
roles_text = if roles.any?
roles.map do |role|
if role.description
"• `!#{role.key}` **#{SERVER.role(role.id).name}** - *#{role.description}*"
else
"• `!#{role.key}` **#{SERVER.role(role.id).name}**"
end
end.join("\n")
else
'No roles found.'
end
embed.add_field(
name: 'Roles',
value: roles_text
)
embed.footer = {text: "Use the reaction buttons to scroll through the groups."}
end
embed
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def roles_to_embed *roles\n raise \"Must be implemented by embed storage to generate a set of roles to embed\"\n end",
"def groups\n roles\n end",
"def show_roles(roles, editable: false, only_speaker: false, show_registration: false)\n if only_speaker \n roles = roles.select{|r| r.speak}\n end\n roles.map do |role|\n show_role(role, editable: editable, show_registration: show_registration)\n end.join(', ').html_safe\n end",
"def group_roles\n hyrax_groups.map(&:roles).flatten.uniq\n end",
"def roles_to_resources\n Role\n .where.not(resource_id: current_shared_collection_id)\n .joins(:groups_roles)\n .where(GroupsRole.arel_table[:group_id].in(id))\n end",
"def roles\n groups.find(:all, :conditions => {:context => Group::GroupType::ROLE})\n end",
"def list\n rolegroup_subject.rolegroup_list\n end",
"def set_rolegroups *rolegroups\n # creates and embeds new Role instances from symbols\n set_ds_field rolegroups_to_embed(*rolegroups)\n end",
"def roles_of rolegroup\n raise \"Pending\"\n end",
"def api_name\n :roles_mask\nend",
"def admin_labs\n self.roles.where(name: \"admin\", resource_type: \"Lab\")\n end",
"def roles\n self.dig_for_array(\"roles\")\n end",
"def index\n @iams = $iam.groups.map{ |x| Iam.new(name: x.name) } \n @users = $iam.users\n @roles = $iam.client.list_roles \n end",
"def ansible_roles\n roles = build.ansible_groups || []\n # roles = blueprint.resources.pluck(:type).map { |resource| resource.demodulize.underscore }\n roles.each_with_object({}) do |role, hash|\n # hash[role] = [project_name]\n hash[role] = ['default']\n end\n end",
"def send_roles\n s_roles = Hash.new\n @world.roles.keys.each do |role|\n s_roles[role] = @world.role_lookup(role)\n end\n s_roles\n end",
"def display_all_roles\n # Interface method\n end",
"def build_roles\n if local_attr? :build\n slide.set_attr 'build-initiated', ''\n (local_attr :build).split('+').map {|type| BUILD_ROLE_BY_TYPE[type] }\n elsif option? :build\n if (_slide = slide).local_attr? 'build-initiated'\n ['build-items']\n else\n _slide.set_attr 'build-initiated', ''\n ['build', 'build-items']\n end\n else\n []\n end\n end",
"def cluster_roles\n iterate :clusterroles do |r|\n setup_role role_kind: :ClusterRole, role: r\n end\n\n # For cluster roles with aggregation rules create an edge betweeen those roles\n @aggregable_roles.each do |aggregating_role, composite_roles|\n composite_roles.each do |composite_role|\n edge :aggregate, {\n aggregating_role_name: aggregating_role, \n composite_role_name: composite_role\n }\n edge :composite, {\n aggregating_role_name: aggregating_role,\n composite_role_name: composite_role\n }\n end\n end\n end",
"def roles\n # rocking this in memory because eager-loading\n roles = object.paper_roles.select { |role|\n role.user_id == scoped_user.id\n }.map(&:description)\n roles << \"My Paper\" if object.user_id == scoped_user.id\n roles\n end",
"def full_roles\n r = ''\n if roles\n roles.each do |role|\n r += (role.name+\" \")\n puts role.name\n end\n end\n r\n end",
"def taggable_ministerial_roles_container\n Rails.cache.fetch(taggable_ministerial_roles_cache_digest, expires_in: 1.day) do\n MinisterialRole.with_translations.with_translations_for(:organisations).alphabetical_by_person.map do |role|\n [\"#{role.name}, #{role.organisations.map(&:name).to_sentence} (#{role.current_person_name})\", role.id]\n end\n end\n end",
"def roles(**opt)\n roles = present? && object.role_list || []\n html_tag(:ul, opt) do\n roles.map do |role|\n html_tag(:li, role)\n end\n end\n end",
"def list\n @roles = Role.all(:include => [:groups, :users])\n end",
"def girl_groups; end",
"def barrie_ingham_multiple_roles\n MovieDatabase.execute(<<-SQL)\n SELECT\n movies.title\n FROM\n movies\n JOIN castings ON castings.movie_id = movies.id\n JOIN actors ON actors.id = castings.actor_id\n WHERE\n actors.name = 'Barrie Ingham'\n GROUP BY\n actors.name\n SQL\nend",
"def has_role settings, role, make_security_group=nil\n security_group role if make_security_group\n settings[:user_data][:attributes][:run_list] << \"role[#{role}]\"\nend",
"def all_roles\n result = Array.new\n \n# for role in self.roles\n# result << role.ancestors_and_self\n# end\n \n for group in self.groups\n result << group.all_roles\n end\n \n result.flatten!\n result.uniq!\n \n return result\n end",
"def roles\n roles_as_editor + roles_as_reviewer + role_as_admin\n end",
"def add_embed_many(name, options={}, &block)\n embedded_field = add_field(name, 'many_embedded', options)\n embedded_field.instance_exec(embedded_field, &block) if block_given?\n end",
"def hyrax_groups\n roles.where(name: 'member', resource_type: 'Hyrax::Group').map(&:resource).uniq\n end",
"def embedments\n model.embedments\n end",
"def roles(force_reload = false)\n unless force_reload\n return @role_list unless @role_list.nil? \n end\n return nil unless self.id\n \n @role_list = GroupRoleList.new({:group_id => self.id})\n return @role_list\n end",
"def role_list \n @role_list ||= begin\n (store.display_roles | group_store.display_roles)\n end\n end",
"def installRoles\n roledir = @ansible_path+\"/roles\"\n\n canon_links = {}\n\n repodirs = []\n\n # Make sure we search the global ansible_dir, if any is set\n if $MU_CFG and $MU_CFG['ansible_dir'] and !$MU_CFG['ansible_dir'].empty?\n if !Dir.exist?($MU_CFG['ansible_dir'])\n MU.log \"Config lists an Ansible directory at #{$MU_CFG['ansible_dir']}, but I see no such directory\", MU::WARN\n else\n repodirs << $MU_CFG['ansible_dir']\n end\n end\n\n # Hook up any Ansible roles listed in our platform repos\n if $MU_CFG and $MU_CFG['repos']\n $MU_CFG['repos'].each { |repo|\n repo.match(/\\/([^\\/]+?)(\\.git)?$/)\n shortname = Regexp.last_match(1)\n repodirs << MU.dataDir + \"/\" + shortname\n }\n end\n\n repodirs.each { |repodir|\n [\"roles\", \"ansible/roles\"].each { |subdir|\n next if !Dir.exist?(repodir+\"/\"+subdir)\n Dir.foreach(repodir+\"/\"+subdir) { |role|\n next if [\".\", \"..\"].include?(role)\n realpath = repodir+\"/\"+subdir+\"/\"+role\n link = roledir+\"/\"+role\n \n if isAnsibleRole?(realpath)\n if !File.exist?(link)\n File.symlink(realpath, link)\n canon_links[role] = realpath\n elsif File.symlink?(link)\n cur_target = File.readlink(link)\n if cur_target == realpath\n canon_links[role] = realpath\n elsif !canon_links[role]\n File.unlink(link)\n File.symlink(realpath, link)\n canon_links[role] = realpath\n end\n end\n end\n }\n }\n }\n\n # Now layer on everything bundled in the main Mu repo\n Dir.foreach(MU.myRoot+\"/ansible/roles\") { |role|\n next if [\".\", \"..\"].include?(role)\n next if File.exist?(roledir+\"/\"+role)\n File.symlink(MU.myRoot+\"/ansible/roles/\"+role, roledir+\"/\"+role)\n }\n\n coldir = \"#{Etc.getpwuid(Process.uid).dir}/.ansible/collections/ansible_collections\"\n [\"ansible.windows\", \"community.general.gem\"].each { |coll|\n %x{#{@ansible_execs}/ansible-galaxy collection list -p \"#{coldir}\"}\n if $? != 0\n system(%Q{#{@ansible_execs}/ansible-galaxy}, \"collection\", \"install\", coll, \"-p\", coldir)\n end\n } \n\n if @server.config['run_list']\n @server.config['run_list'].each { |role|\n found = false\n if !File.exist?(roledir+\"/\"+role)\n if role.match(/[^\\.]\\.[^\\.]/) and @server.config['groomer_autofetch']\n system(%Q{#{@ansible_execs}/ansible-galaxy}, \"--roles-path\", roledir, \"install\", role)\n found = true\n# XXX check return value\n else\n canon_links.keys.each { |longrole|\n if longrole.match(/\\.#{Regexp.quote(role)}$/)\n File.symlink(roledir+\"/\"+longrole, roledir+\"/\"+role)\n found = true\n break\n end\n }\n end\n else\n found = true\n end\n if !found\n raise MuError, \"Unable to locate Ansible role #{role}\"\n end\n }\n end\n\n end",
"def update_member_roles\n eve_api = Eve::API.new(key_id: \"4233755\", v_code: \"1fu1tvYX38Ub5GE6K6W7zc1DWAd5UMpNzebSX32ZSapWmRBOMk00duZKDSDhLaKf\")\n result = eve_api.account.apikeyinfo\n eve_api[:character_id] = result.key.characters[0].character_id\n # Query EVE for member roles\n member_security = eve_api.corporation.member_security\n\n\n # Find the roles the member should have\n members = {}\n # Iterate over each returned member\n member_security.members.each do |member|\n # Build a hash of each member's roles, keyed by character_id\n members.store(\"#{member.character_id}\", [])\n members[\"#{member.character_id}\"] << \"Corp Member\"\n # Retrieve the member's roles from the returned API data\n member[\"roles\"].each do |role|\n # Since member's roles appear to start with 'role', slice it off\n name = role.role_name.slice(4, role.role_name.length)\n # Append 'Corp' to match the role names and insert it into the member's role array\n members[\"#{member.character_id}\"] << \"Corp #{name}\"\n end\n end\n\n # Iterate over each member in the members hash\n members.each do |key, value|\n # Retrieve the member using the character_id key in the members hash\n member = Member.where(\"\\\"characterID\\\" = ?\", key)[0]\n # Find the member's current roles\n roles = member.roles.pluck(:id, :name)\n # If there are current roles\n if roles.present?\n # iterate over each existing role and remove any the member should no longer have\n roles.each do |role|\n # if the member should have the role\n if value.include?(role[1])\n # delete that role from the hash value\n value.delete(role[1])\n else\n # otherwise, delete the role from the member\n MembersRole.where(\"member_id = ? AND role_id = ?\", member.id, role[0])[0].destroy\n end\n end\n end\n\n # Retrieve the IDs of each remaining role from the database\n role_ids = Role.where(name: value).pluck(:id)\n # Iterate over the role_ids array building a hash for batch insertion\n members_role_array = []\n role_ids.each do |role_id|\n members_role_array << {member_id: member.id, role_id: role_id}\n end\n # Batch insert the new MembersRoles into the database\n MembersRole.create(members_role_array)\n end\n end",
"def build_groups\n groups = {}\n roles = %w[client server initial]\n roles.each do |role|\n groups[role] = build_roles(role)\n end\n groups\n end",
"def map_available_roles\n roles.each.map &:name\n end",
"def run_list\n self.roles.collect { |role| \"role[#{role}]\" } +\n self.recipes.collect { |recipe| \"recipe[#{recipe}]\" }\n end",
"def components_in_roles( qroles )\n ( qroles & roles ).inject([]) { |m,r| m += space.role( r ) }\n end",
"def update_IT_Admin(roles)\n roles.each do |group|\n if group[\"groupTitle\"] == \"IT Administrator\"\n rights = group[\"rights\"]\n rights.push(SECURITY_EVENT_RIGHT).uniq!\n end\n end\nend",
"def role(name, options = {}, &block)\n final_options = { name: name }.merge(options).merge(scoped_options: scoped_options)\n require_namespace!('role', final_options)\n\n definitions << Matsuri::DSL::Cluster::Role.new(final_options).tap do |role|\n if options[:resources].present? && options[:verbs].present?\n role.resources(options[:resources], names: options[:resource_names], verbs: options[:verbs], api_groups: options[:api_groups])\n end\n\n role.configure(&block)\n end\n end",
"def update_roles_and_groups(role_ids, group_ids)\n # if self.access_to_roles?(roles) && self.access_to_groups?(groups)\n logger.info \"role_ids; #{role_ids.inspect}\"\n self.roles = Role.where(id: role_ids).to_a\n logger.info \"roles: #{self.roles.inspect}\"\n g = Group.where(id: group_ids).to_a\n logger.info \"g; #{g.inspect}\"\n # g.each {|group| self.groups << group unless self.groups.include?(group) }\n self.groups = g\n logger.info \"groups: #{self.groups.to_a.inspect}\"\n\n self.center = self.groups.first.center \n return self\n end",
"def role_symbols\n (roles || []).map {|r| r.name.to_sym} + [self.is_author? ? :author : []].flatten\n end",
"def roles_with_permission\n shift.location.loc_group.roles\n end",
"def get_roles\n result = {}\n roles.each do |role|\n resource = if role.resource_type == 'Conference'\n Conference.find(role.resource_id).short_title\n elsif role.resource_type == 'Track'\n Track.find(role.resource_id).name\n end\n if result[role.name].nil?\n result[role.name] = [resource]\n else\n result[role.name] << resource\n end\n end\n result\n end",
"def camaleon_spree_user_roles_hook(args)\n args[:roles_list][:manager] << { key: 'spree_role', label: t('plugins.spree_cama.admin.roles.label', default: 'Spree Ecommerce'), description: t('plugins.spree_cama.admin.roles.descr', default: 'Manage all sections of Spree Ecommerce')}\n end",
"def remove_roles_from_admin group\n group.roles.each do |role|\n if admin_roles.map(&:role).include?(role) and not role_in_groups?(role.name)\n admin_roles.find_by_role_id(role.id).destroy\n end\n end\n end",
"def edit\n @show_element=\"admin\"\n (l1id, id) = params[:id].split(',')\n @org = Org.find(params[:id])\n @rolesgroups = @org.roles_groups.all(:order=>:blue_groups_name)\n \n @rolesgroups.each do |group|\n @org.roles_groups.build\n end\n #@rolesgroup = RolesGroup.new\n end",
"def update_roles\r\n self.roles.create(:title => \"admin\")\r\n if self.name.eql? \"Grandor Eldoran\"\r\n self.roles.create(:title => \"admin\")\r\n elsif self.name.eql? \"Test2 Test2\"\r\n self.roles.create(:title => \"member\")\r\n end\r\n end",
"def roles_assigned_to_shift( for_print )\n self.roles.empty? ? for_print : self.roles.map { |role| role.name }.join(\", \") \n end",
"def show_roles(roles)\n roles.map{ |x| x[0].titleize + ' (' + x[1].join(', ') + ')' }.join ', '\n end",
"def manage_group\n member_options = set_members_options\n if member_options.empty?\n shell_out!(\"pw\", \"groupmod\", set_options)\n else\n member_options.each do |option|\n shell_out!(\"pw\", \"groupmod\", set_options, option)\n end\n end\n end",
"def emit_role(role: {}, oversees: {}, desc: {})\n id = role['info']['id'] || role['info']['chair']\n missingid, idnam = _id_to_names(id)\n _ol.breadcrumb do\n _li do\n _a 'OrgChart', href: URLROOT\n end\n _li.active do\n _ role['info']['role']\n end\n end\n _whimsy_panel_table(\n title: \"#{role['info']['role']} - #{idnam}\",\n ) do\n _table.table.table_striped do\n _tbody do\n role['info'].each do |k, value|\n key = k.downcase # Prevent case mismatches\n next if key == 'role'\n next if key == 'roster' # No purpose in public display yet\n next if key =~ /private/i\n next unless value\n _tr_ do\n # Different output than www/roster/orgchart\n _td do\n _(desc[key]) if desc.key?(key)\n end\n if %w(id chair).include? key\n _td do\n if missingid\n _em idnam\n else\n _ idnam\n end\n end\n elsif %w(reports-to).include? key\n _td! do\n value.split(/[, ]+/).each_with_index do |role_inner, index|\n _span ', ' if index > 0\n if role_inner == 'members'\n _a 'Apache Membership', href: 'https://www.apache.org/foundation/members'\n else\n _a role_inner, href: \"#{URLROOT}/#{role_inner}\"\n end\n end\n end\n elsif %w(email).include? key\n _td do\n _a value, href: \"mailto:#{value}\"\n end\n elsif %w(resolution website resolution-policy resolution-other reports-board).include? key\n _td do\n _a value, href: value\n end\n else\n _td value\n end\n end\n end\n end\n end\n unless oversees.empty?\n oversees = oversees.sort_by {|name, duties| duties['info']['role']}\n _ul.list_group do\n _li.list_group_item.active do\n _h4 'This Officer Oversees'\n end\n _li.list_unstyled do\n _ul style: 'margin-top: 15px; margin-bottom: 15px;' do\n oversees.each do |name, duties|\n _li do\n _a duties['info']['role'], href: \"#{URLROOT}/#{name}\"\n end\n end\n end\n end\n end\n end\n _ul.list_group do\n role.each do |title, text|\n next if title == 'info' or title == 'mtime'\n next if title =~ /private/i\n _li.list_group_item.active do\n _h4 title.capitalize\n end\n _li.list_group_item do\n _markdown text\n end\n end\n end\n end\nend",
"def rolegroup_list\n @rolegroup_list ||= begin\n group_store.display_rolegroups\n end\n end",
"def ansible_roles\n roles = blueprint.resources.pluck(:type).map { |resource| resource.demodulize.underscore }\n roles.each_with_object({}) do |role, hash|\n hash[role] = [project_name]\n end\n end",
"def write_build_roles(path)\n docker_run_list.expanded_run_list_roles.each do |role|\n r = Chef::Resource::File.new(::File.join(path, \"#{role}.json\"), run_context)\n r.content(Chef::Role.load(role).to_json)\n r.run_action(:create)\n end\n end",
"def roles\n roles_from_users\n end",
"def aggregated_cluster_role(name, options = {}, &block)\n forbid_namespace!('aggregated_cluster_role', options)\n\n final_options = { name: name }.merge(options).merge(scoped_options: scoped_options)\n definitions << Matsuri::DSL::Cluster::ClusterRole.new(final_options, &block)\n end",
"def handle_admin_role_ids(role)\n current_members = send(role.to_s.pluralize)\n new_members = Person.find(send(\"#{role}_ids\"))\n\n to_add = new_members - current_members\n to_remove = current_members - new_members\n to_add.each do |person|\n person.send(\"is_#{role}=\", [true, self])\n disable_authorization_checks { person.save! }\n end\n to_remove.each do |person|\n person.send(\"is_#{role}=\", [false, self])\n disable_authorization_checks { person.save! }\n end\n end",
"def handle_admin_role_ids(role)\n current_members = send(role.to_s.pluralize)\n new_members = Person.find(send(\"#{role}_ids\"))\n\n to_add = new_members - current_members\n to_remove = current_members - new_members\n to_add.each do |person|\n person.send(\"is_#{role}=\", [true, self])\n disable_authorization_checks { person.save! }\n end\n to_remove.each do |person|\n person.send(\"is_#{role}=\", [false, self])\n disable_authorization_checks { person.save! }\n end\n end",
"def manage_group\n shell_out!(\"groupmod\", set_options)\n modify_group_members\n end",
"def handle_pal_ids\n handle_admin_role_ids Seek::Roles::PAL\n end",
"def handle_pal_ids\n handle_admin_role_ids Seek::Roles::PAL\n end",
"def publisher_admin(role)\n\n can :manage, Publication, :publisher_id => role.publisher_id\n can :update, Publisher, :id => role.publisher_id\n can :update, IssueState\n can :update, AdminUser, :id => @user.id\n\n\n\n end",
"def interactive_box_embeddables\n section_embeddables(INTERACTIVE_BOX)\n end",
"def organization_roles\n roles = []\n\n if Figaro.env.respond_to?(:cf_organization_add_manager) &&\n Figaro.env.cf_organization_add_manager.downcase == 'true'\n roles << 'manager'\n end\n\n if Figaro.env.respond_to?(:cf_organization_add_billing_manager) &&\n Figaro.env.cf_organization_add_billing_manager.downcase == 'true'\n roles << 'billing_manager'\n end\n\n if Figaro.env.respond_to?(:cf_organization_add_auditor) &&\n Figaro.env.cf_organization_add_auditor.downcase == 'true'\n roles << 'auditor'\n end\n\n roles\n end",
"def embeds(models)\n embed_attribute(models)\n end",
"def meta_abilities\n User.roles.each do |(k, v)|\n if user.has_role? k\n can \"do_#{k}\".to_sym, :all\n end\n end\n end",
"def role_selection\n \"#{name}\"\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [Role.find_by_name(\"User\").id] \n end\n end",
"def actors\n self.roles.map do |role|\n role.actor\n end\n end",
"def space_roles\n roles = []\n\n if Figaro.env.respond_to?(:cf_space_add_manager) &&\n Figaro.env.cf_space_add_manager.downcase == 'true'\n roles << 'manager'\n end\n\n if Figaro.env.respond_to?(:cf_space_add_developer) &&\n Figaro.env.cf_space_add_developer.downcase == 'true'\n roles << 'developer'\n end\n\n if Figaro.env.respond_to?(:cf_space_add_auditor) &&\n Figaro.env.cf_organization_add_auditor.downcase == 'true'\n roles << 'auditor'\n end\n\n roles\n end",
"def roles_string() \n self[:roles].join(\",\") \n end",
"def role_symbols\n [:admin,:developer,:support_person]\n end",
"def role_symbols\n (roles || []).map {|r| r.title.to_sym}\n end",
"def create_roles\n ['admin', 'lector', 'jefe_calidad', 'jefe_bodega', 'op_bodega'].each do |role_name|\n Role.create!(name: role_name)\n end\nend",
"def groups; end",
"def groups; end",
"def groups; end",
"def associated_roles\n data[:associated_roles]\n end",
"def associated_roles\n data[:associated_roles]\n end",
"def remove_roles\n render(:layout => false)\n end",
"def check_role_group\n @roles = Role.role_group.accessible_by(current_ability)\n end",
"def cluster_assign_roles(environment, type, entry=nil)\n types = %w[basic hadoop kafka]\n unless types.include?(type.to_s.downcase)\n raise \"#{type} is not one of #{types.join(',')} !\"\n end\n\n #\n # We use system() instead of Mixlib::ShellOut specifically so that the\n # child process re-uses our STDOUT/STDERR.\n #\n # TODO: replace with IO::popen3\n #\n if entry.nil?\n system('sudo', './cluster-assign-roles.sh',\n environment, type.to_s.downcase.capitalize)\n else\n system('sudo', './cluster-assign-roles.sh',\n environment, type.to_s.downcase.capitalize, entry[:hostname])\n end\n\n # Why doesn't this raise an error?\n puts 'cluster-assign-roles.sh failed!' unless $CHILD_STATUS.success?\nend",
"def index\n @roles = record.roles.includes(:resource)\n render jsonapi: @roles, include: %i[users groups resource]\n end",
"def role(*args)\n cap_role(*args)\n puppet_role(*args)\n end",
"def display_roles\n \n @active_roles = Role.find_all_active\n \n render(:layout => false)\n \n end",
"def role_symbols\n # Think trice before changing this!\n [:soker]\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def guild_role_format\n {\n position: @position,\n permissions: @permissions,\n managed: false, # TODO: investigate what this is (probably integration stuff)\n id: @id.to_s,\n name: @name,\n hoist: @hoist,\n color: @colour # damn American spelling\n }\n end",
"def roles\n Role.group_roles_from_cache(self)\n end",
"def role; end",
"def role; end",
"def query_roles(options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.query_roles(@cluster, policy)\n end",
"def setup_role\n \tif self.role_ids.empty?\n \t self.role_ids = [3]\n \tend\n end",
"def list_roles\n self.characters.map do |character|\n \"#{character.name} - #{character.show.name}\"\n end\n end",
"def list_roles\n self.characters.map do |character|\n \"#{character.name} - #{character.show.name}\"\n end\n end",
"def embeds_by_node\n strong_memoize(:embeds_by_node) do\n nodes.each_with_object({}) do |node, embeds|\n embed = Embed.new\n url = node.attribute('data-dashboard-url').to_s\n\n permissions_by_route.each do |route|\n set_path_and_permission(embed, url, route.regex, route.permission) unless embed.permission\n end\n\n embeds[node] = embed if embed.permission\n end\n end\n end"
] |
[
"0.7119568",
"0.6027745",
"0.5926707",
"0.57730526",
"0.56533283",
"0.56523526",
"0.55967224",
"0.55532175",
"0.5518457",
"0.5500429",
"0.54974747",
"0.5497411",
"0.5494413",
"0.54918516",
"0.5464567",
"0.54566014",
"0.543802",
"0.54372394",
"0.5430615",
"0.541105",
"0.54086787",
"0.53608125",
"0.53582513",
"0.53472793",
"0.53458846",
"0.5338604",
"0.53276813",
"0.53211176",
"0.5318821",
"0.530351",
"0.53032285",
"0.529955",
"0.5299403",
"0.5285764",
"0.5277711",
"0.52713627",
"0.52509725",
"0.52464014",
"0.5244917",
"0.52263665",
"0.522424",
"0.52224445",
"0.52095556",
"0.520732",
"0.51998913",
"0.51772594",
"0.51653284",
"0.5158025",
"0.5155479",
"0.51412576",
"0.5141114",
"0.5129452",
"0.5128192",
"0.5126965",
"0.5122005",
"0.51155794",
"0.51100534",
"0.51062816",
"0.5103812",
"0.5103812",
"0.51037",
"0.5101961",
"0.5101961",
"0.5101466",
"0.5099117",
"0.5098016",
"0.5093897",
"0.5078223",
"0.5076543",
"0.5075922",
"0.5060663",
"0.50528884",
"0.5045794",
"0.50427306",
"0.5038357",
"0.50310725",
"0.50264996",
"0.50264996",
"0.50264996",
"0.50263613",
"0.50263613",
"0.5018582",
"0.5014602",
"0.50100857",
"0.49993637",
"0.49977642",
"0.49913904",
"0.49864352",
"0.4986385",
"0.4986385",
"0.4986385",
"0.4985172",
"0.49839061",
"0.49712014",
"0.49712014",
"0.49687794",
"0.49668154",
"0.49628446",
"0.49628446",
"0.49621832"
] |
0.7491963
|
0
|
GET /score_evaluations GET /score_evaluations.json
|
def index
@score_evaluations = ScoreEvaluation.all
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @score_evaluations }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @score_evaluation = ScoreEvaluation.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @score_evaluation }\n end\n end",
"def get_eval\n\t\t@student = Student.find(params[:student_id])\n\t\t@evaluation = @student.evaluations.find(params[:eval_id])\n\t\trender json: @evaluation\n\tend",
"def get_evaluations\n\t\tif current_student.id.to_i == params[:id].to_i\n\t\t\t@student = Student.find(params[:id])\n\t\t\t@evaluations = @student.evaluations\n\t\tend\n\t\trender 'get_evaluations'\n\tend",
"def evaluate\n response = Quiz.find(params[:quiz_id]).evaluate(params[:questions], current_user)\n @answers = response[:answers]\n @nota = response[:grade]\n\n respond_to do |format|\n format.html { render 'evaluate' }\n end\n end",
"def scores\n response[\"scores\"]\n end",
"def index\n @evaluations = @course.evaluations\n end",
"def index\n @evaluations = @course.evaluations\n end",
"def new\n @score_evaluation = ScoreEvaluation.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @score_evaluation }\n end\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluates = Evaluate.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def getEvaluations\n\t\tharness.evaluations\n\tend",
"def show\n @enrolled_score = EnrolledScore.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @enrolled_score }\n end\n end",
"def evaluations(id)\n connection.get do |req|\n req.url \"job/#{id}/evaluations\"\n end\n end",
"def index\n @request_scores = RequestScore.all\n end",
"def scores\n scores = ValueActivity.all\n render json: ValueActivitiesSerializer.new(scores).serializable_hash\n end",
"def scores\n @scores\n end",
"def create\n # ToDo: 名前の変更\n score = params[:score]\n \n\n if @evaluation.update_attributes(score: score)\n render :show, status: :ok, location: @evaluation\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def index\n @scores = Score.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scores }\n end\n end",
"def index\n @performance_evaluations = PerformanceEvaluation.all\n end",
"def index\n\t\t@scores = @product.scores.all\n\tend",
"def evaluation\n @api_v1_reservation.evaluate(evaluation_params[:comment], evaluation_params[:rating].to_i) unless @api_v1_reservation.evaluation\n render json: { success: true }, status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end",
"def index\n @evaluation_results = EvaluationResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluation_results }\n end\n end",
"def index\n @student_goal_evaluations = StudentGoalEvaluation.all\n end",
"def completed_evaluations_list\n\t\t@student = Student.find(params[:student_id])\n\t\t@evaluations = []\n\t\tfor evaluation in @student.evaluations\n\t\t\tif evaluation.isCompleted\n\t\t\t\t@evaluations << evaluation\n\t\t\tend\n\t\tend\n\t\trender json: @evaluations\n\tend",
"def index\n \n @evaluation = Evaluation.find_by(user_id: params[:user_id], study_case_id: params[:study_case_id])\n\n if @evaluation.present?\n render :show\n else\n render json: nil\n end\n \n end",
"def show\n @score = Evaluation.eval_user(@user)\n end",
"def show\n @evaluations = Evaluation.find(params[:id])\n end",
"def scores\n @title_page = 'Scores'\n $game.player.score = params['grade'].to_i\n\n @username = $game.player.username\n @score = $game.player.score\n\n response = Request.post_request(URL_SCORES, {\n username: $game.player.username,\n score: $game.player.score\n })\n\n @scores = Request.manage_response(response)\n\n erb :scores, layout: :template\nend",
"def index\n @course_evaluations = CourseEvaluation.all\n end",
"def index\r\n @evaluaciones = Evaluacione.all\r\n end",
"def index\n @question_scores = QuestionScore.all\n end",
"def index\n @evaluaciones = Evaluacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluaciones }\n end\n end",
"def show\n @score = Evaluation.eval_post(@post)\n end",
"def index\n @scores = Score.all\n end",
"def index\n @scores = Score.all\n end",
"def index\n @evaluations = Evaluation.all\n @evaluation = Evaluation.new\n end",
"def score\n return nil if scores.count == 0\n average = Hash.new(0)\n scores.each_with_index do |score, num|\n Score::METRICS.each do |metric|\n average[metric] = (average[metric] * num + score.try(metric))/(num + 1.0)\n end\n end\n ret = {score: average}\n return JSON.generate ret\n end",
"def new\n @enrolled_score = EnrolledScore.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled_score }\n end\n end",
"def index\n @challenge_scores = ChallengeScore.all\n end",
"def view\n @assignment = Assignment.find(params[:id])\n @questions = Hash.new\n questionnaires = @assignment.questionnaires\n questionnaires.each {\n |questionnaire|\n @questions[questionnaire.symbol] = questionnaire.questions\n }\n\n @scores = @assignment.get_scores(@questions)\n end",
"def index\n @evaluations = Evaluation.accessible_by(current_ability, :read)\n end",
"def index\n @scores = Score.all \n end",
"def score\n respond_to do |format|\n if @survey.score\n format.html { redirect_to edit_admins_thriver_path(@user), notice: 'Survey was successfully scored.' }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @rating_scores = RatingScore.all\n end",
"def auto_score!\n responses = sanitize_form_data_hash\n\n scores = {\n regional_partner_name: regional_partner ? YES : NO,\n committed: responses[:committed] == YES ? YES : NO,\n able_to_attend_single: yes_no_response_to_yes_no_score(responses[:able_to_attend_single])\n }\n\n if responses[:principal_approval] == YES\n scores.merge!(\n {\n principal_approval: YES,\n schedule_confirmed: yes_no_response_to_yes_no_score(responses[:schedule_confirmed]),\n diversity_recruitment: yes_no_response_to_yes_no_score(responses[:diversity_recruitment]),\n free_lunch_percent: responses[:free_lunch_percent].to_f >= 50 ? 5 : 0,\n underrepresented_minority_percent: responses[:underrepresented_minority_percent].to_f >= 50 ? 5 : 0,\n wont_replace_existing_course: responses[:wont_replace_existing_course].try(:start_with?, NO) ? 5 : nil,\n }\n )\n elsif responses[:principal_approval] == NO\n scores[:principal_approval] = NO\n end\n\n if course == 'csp'\n scores[:csp_which_grades] = responses[:csp_which_grades].any? ? YES : NO\n scores[:csp_course_hours_per_year] = responses[:csp_course_hours_per_year] == COMMON_OPTIONS[:course_hours_per_year].first ? YES : NO\n scores[:previous_yearlong_cdo_pd] = responses[:previous_yearlong_cdo_pd].exclude?('CS Principles') ? YES : NO\n scores[:csp_ap_exam] = responses[:csp_ap_exam] != Pd::Application::Teacher1819Application.options[:csp_ap_exam].last ? YES : NO\n scores[:taught_in_past] = responses[:taught_in_past].none? {|x| x.include? 'AP'} ? 2 : 0\n elsif course == 'csd'\n scores[:csd_which_grades] = (responses[:csd_which_grades].map(&:to_i) & (6..10).to_a).any? ? YES : NO\n scores[:csd_course_hours_per_year] = responses[:csd_course_hours_per_year] != COMMON_OPTIONS[:course_hours_per_year].last ? YES : NO\n scores[:previous_yearlong_cdo_pd] = (responses[:previous_yearlong_cdo_pd] & ['CS Discoveries', 'Exploring Computer Science']).empty? ? YES : NO\n scores[:taught_in_past] = responses[:taught_in_past].include?(Pd::Application::Teacher1819Application.options[:taught_in_past].last) ? 2 : 0\n end\n\n # Update the hash, but don't override existing scores\n update(response_scores: response_scores_hash.merge(scores) {|_, old_value, _| old_value}.to_json)\n end",
"def index\n @scoring_scales = ScoringScale.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scoring_scales }\n end\n end",
"def index\n @high_scores = HighScore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @high_scores }\n end\n end",
"def scores\n quiz_entries.collect { |qe| qe.score }\n end",
"def index\n authorize Score\n @scores = Score.all\n end",
"def list_model_evaluations 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_list_model_evaluations_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::AutoML::V1::ListModelEvaluationsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def index\n @user_scores = UserScore.all\n end",
"def score\n properties['score']\n end",
"def index\n @analyst_scores = AnalystScore.all\n end",
"def index\n @dish_evaluations = DishEvaluation.all\n end",
"def list_model_evaluations 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_list_model_evaluations_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::AutoML::V1beta1::ListModelEvaluationsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def scores\n cells = self.concatenate_data_arrays(self.cell_key, 'cells')\n exp_values = self.concatenate_data_arrays(self.score_key, 'expression')\n Hash[cells.zip(exp_values)]\n end",
"def scores\n @raw.map(&:score)\n end",
"def get_score(user, module_name)\n url = \"https://forgeapi.puppetlabs.com/private/validations/#{user}-#{module_name}\"\n response = Typhoeus.get(url).body\n\n meta_data = JSON.parse response\n\n meta_data[-1]['score'] / 20.0\nend",
"def index\n @project_evaluations = ProjectEvaluation.all\n end",
"def evaluation\n responses = self.user_survey_responses\n correct_answers = 0.0\n responses.each do |response|\n answer = Answer.find(response.answer_id)\n correct_answers += 1 if answer.correct\n end\n if self.grade.nil?\n self.grade = Grade.create score: 0, gradable: self, user_id: self.user_id\n end\n if (responses.size != 0) then\n evaluation = (correct_answers/responses.size)*10\n #self.update_attributes result: evaluation\n if evaluation != grade.score\n self.grade.update_attributes score: evaluation\n end\n return evaluation\n else\n #self.update_attributes result: 0.0\n if grade.score != 0\n self.grade.update_attributes score: 0, gradable: self\n end\n return 0.0\n end\n end",
"def index\n @evals = Eval.all\n respond_with(@evals) \n end",
"def index\n @scores = (@user || @quiz).scores\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @scores }\n end\n end",
"def index\n @test_subject_evaluations = @test_subject.test_subject_evaluations.find(:all, :order => 'evaluated_on DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @test_subject_evaluations }\n end\n end",
"def index\n @username_scores = UsernameScore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @username_scores }\n end\n end",
"def index\n @five_scores = FiveScore.all\n end",
"def index\n @test_scores = @participant.test_scores.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @test_scores }\n end\n end",
"def review_scores\n list = extract_from_list self.responses, :get_average_score\n (list.empty?) ? [0] : list\n end",
"def index\n @evaluos = Evaluo.all\n end",
"def score\n calculator.score\n end",
"def evaluation_params\n params.require(:evaluation).permit(:score, :comment, :project_id, :team_member_id)\n end",
"def show\n @score = Score.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @score }\n end\n end",
"def show\n @score = Score.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @score }\n end\n end",
"def show\n @score = Score.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @score }\n end\n end",
"def index\n @classpersonscores = Classpersonscore.all\n end",
"def scores\n ids = params[:ids].is_a?(Array) ? params[:ids] : params[:ids].split(/ |\\+/).collect{|i|i.to_i}\n posts = Post.where(id: ids).select('id,score').to_a\n if logged_in?\n rated = current_user.ratings_for(*posts)\n response.headers['Cache-Control'] = 'private'\n else\n response.headers['Cache-Control'] = 'public'\n end\n\n m = {}\n\n posts.each do |r|\n id = r.id\n json = {score: r.score}\n if rated\n json['rated'] = rated[id]\n end\n m[id] = json\n end\n\n respond_to do |format|\n format.json {\n render :json => m\n }\n end\n end",
"def get_scores(questions)\n scores = Hash.new\n scores[:team] = self # This doesn't appear to be used anywhere\n assignment.questionnaires.each do |questionnaire|\n scores[questionnaire.symbol] = Hash.new\n scores[questionnaire.symbol][:assessments] = Response.all(:joins => :map,\n :conditions => {:response_maps => {:reviewee_id => self.id, :type => 'TeamReviewResponseMap'}})\n scores[questionnaire.symbol][:scores] = Score.compute_scores(scores[questionnaire.symbol][:assessments], questions[questionnaire.symbol])\n end\n scores[:total_score] = assignment.compute_total_score(scores)\n return scores\n end",
"def get_scores(questions)\n scores = Hash.new\n scores[:team] = self # This doesn't appear to be used anywhere\n assignment.questionnaires.each do |questionnaire|\n scores[questionnaire.symbol] = Hash.new\n scores[questionnaire.symbol][:assessments] = Response.all(:joins => :map,\n :conditions => {:response_maps => {:reviewee_id => self.id, :type => 'TeamReviewResponseMap'}})\n scores[questionnaire.symbol][:scores] = Score.compute_scores(scores[questionnaire.symbol][:assessments], questions[questionnaire.symbol]) \n end\n scores[:total_score] = assignment.compute_total_score(scores)\n return scores\n end",
"def get_scores(questions)\n scores = Hash.new\n scores[:team] = self # This doesn't appear to be used anywhere\n assignment.questionnaires.each do |questionnaire|\n scores[questionnaire.symbol] = Hash.new\n scores[questionnaire.symbol][:assessments] = Response.all(:joins => :map,\n :conditions => {:response_maps => {:reviewee_id => self.id, :type => 'TeamReviewResponseMap'}})\n scores[questionnaire.symbol][:scores] = Score.compute_scores(scores[questionnaire.symbol][:assessments], questions[questionnaire.symbol]) \n end\n scores[:total_score] = assignment.compute_total_score(scores)\n return scores\n end",
"def index\n @scores = Score.all\n @high_scores = Score.order(correct: :desc).where.not(:correct => nil)\n @score = session[:score]\n end",
"def read_scores\n end",
"def show\n @score = Score.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @score }\n end\n end",
"def index\n @scoring_options = ScoringOption.all\n end",
"def score\n @scores[ result.key ]\n end",
"def course_complete_eval\n\t\t@student_evals = Student.find(params[:student_id]).evaluations.where('course_id = ?', params[:course_id])\n\t\t@evaluations = []\n\t\tif @student_evals != nil\n\t\t\tfor e in @student_evals\n\t\t\t\tif e.isCompleted\n\t\t\t\t\t@evaluations << e\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\trender json: @evaluations\n\tend",
"def score\n rate.score\n end",
"def index\n @record_scores = RecordScore.all\n end",
"def evaluation_params\n params.require(:evaluation).permit(:course_id, :professor_id, :course_score, :teacher_score)\n end",
"def show\n @scoring_method = ScoringMethod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scoring_method }\n end\n end",
"def show\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_evaluation }\n end\n end",
"def index\n @w3mmd_elo_scores = W3mmdEloScore.all\n end",
"def show\n @assessments = Assessment.find(params[:id])\n\n @remoteScore = @assessments.remoteOneValue + @assessments.remoteTwoValue + @assessments.remoteThreeValue + @assessments.remoteFourValue + @assessments.remoteFiveValue;\n\n @strategyScore = @assessments.strategyOneValue + @assessments.strategyTwoValue + @assessments.strategyThreeValue + @assessments.strategyFourValue + @assessments.strategyFiveValue + @assessments.strategySixValue;\n\n @totalScore = @assessments.remoteOneValue + @assessments.remoteTwoValue + @assessments.remoteThreeValue + @assessments.remoteFourValue + @assessments.remoteFiveValue + @assessments.strategyOneValue + @assessments.strategyTwoValue + @assessments.strategyThreeValue + @assessments.strategyFourValue + @assessments.strategyFiveValue + @assessments.strategySixValue;\n end",
"def score\n @score\n end",
"def view\n if session[\"github_access_token\"].nil?\n session[\"assignment_id\"] = params[:id]\n session[\"github_view_type\"] = \"view_scores\"\n return redirect_to authorize_github_grades_path\n end\n @assignment = Assignment.find(params[:id])\n @questions = {}\n questionnaires = @assignment.questionnaires\n if @assignment.varying_rubrics_by_round?\n retrieve_questions questionnaires\n else # if this assignment does not have \"varying rubric by rounds\" feature\n questionnaires.each do |questionnaire|\n @questions[questionnaire.symbol] = questionnaire.questions\n end\n end\n\n @scores = @assignment.scores(@questions)\n averages = calculate_average_vector(@assignment.scores(@questions))\n @average_chart = bar_chart(averages, 300, 100, 5)\n @avg_of_avg = mean(averages)\n calculate_all_penalties(@assignment.id)\n @show_reputation = false\n end",
"def index\n @psicologic_evaluations = PsicologicEvaluation.all\n end",
"def show\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluable_competency }\n end\n end"
] |
[
"0.70963204",
"0.7001828",
"0.6768023",
"0.67598486",
"0.67183495",
"0.6691511",
"0.66504794",
"0.66358405",
"0.663198",
"0.6578833",
"0.65650374",
"0.65650374",
"0.65650374",
"0.65650374",
"0.65650374",
"0.64273256",
"0.64253145",
"0.6393016",
"0.63750654",
"0.62790066",
"0.62569433",
"0.6248035",
"0.62400156",
"0.6222307",
"0.6219262",
"0.61920464",
"0.6174575",
"0.61633897",
"0.6162807",
"0.61589307",
"0.6131951",
"0.6097607",
"0.60938203",
"0.60887915",
"0.6060269",
"0.6060012",
"0.60518306",
"0.6046826",
"0.60457736",
"0.60457736",
"0.6034498",
"0.6024904",
"0.60175014",
"0.6001205",
"0.59943926",
"0.59901714",
"0.5985996",
"0.5976706",
"0.59713465",
"0.59674156",
"0.5943884",
"0.59387726",
"0.59338784",
"0.59338427",
"0.5933291",
"0.592677",
"0.5925914",
"0.59111637",
"0.5909444",
"0.5908546",
"0.5898971",
"0.5867981",
"0.5866682",
"0.5847078",
"0.5839442",
"0.5838198",
"0.5835018",
"0.58322847",
"0.58304423",
"0.5823452",
"0.5819988",
"0.58148164",
"0.5810519",
"0.5808195",
"0.5780723",
"0.5771131",
"0.5771131",
"0.5771131",
"0.57449865",
"0.5744508",
"0.5742205",
"0.57414323",
"0.57414323",
"0.5741071",
"0.57403326",
"0.57384306",
"0.5719803",
"0.57154155",
"0.57081336",
"0.5707382",
"0.5703693",
"0.5688417",
"0.5684654",
"0.5682666",
"0.5679361",
"0.56729746",
"0.56701297",
"0.56579614",
"0.5649784",
"0.5639085"
] |
0.7937988
|
0
|
GET /score_evaluations/1 GET /score_evaluations/1.json
|
def show
@score_evaluation = ScoreEvaluation.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @score_evaluation }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @score_evaluations = ScoreEvaluation.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @score_evaluations }\n end\n end",
"def get_eval\n\t\t@student = Student.find(params[:student_id])\n\t\t@evaluation = @student.evaluations.find(params[:eval_id])\n\t\trender json: @evaluation\n\tend",
"def new\n @score_evaluation = ScoreEvaluation.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @score_evaluation }\n end\n end",
"def show\n @enrolled_score = EnrolledScore.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @enrolled_score }\n end\n end",
"def evaluate\n response = Quiz.find(params[:quiz_id]).evaluate(params[:questions], current_user)\n @answers = response[:answers]\n @nota = response[:grade]\n\n respond_to do |format|\n format.html { render 'evaluate' }\n end\n end",
"def get_evaluations\n\t\tif current_student.id.to_i == params[:id].to_i\n\t\t\t@student = Student.find(params[:id])\n\t\t\t@evaluations = @student.evaluations\n\t\tend\n\t\trender 'get_evaluations'\n\tend",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = Evaluation.all\n end",
"def index\n @evaluations = @course.evaluations\n end",
"def index\n @evaluations = @course.evaluations\n end",
"def index\n @evaluates = Evaluate.all\n end",
"def index\n \n @evaluation = Evaluation.find_by(user_id: params[:user_id], study_case_id: params[:study_case_id])\n\n if @evaluation.present?\n render :show\n else\n render json: nil\n end\n \n end",
"def show\n @evaluations = Evaluation.find(params[:id])\n end",
"def create\n # ToDo: 名前の変更\n score = params[:score]\n \n\n if @evaluation.update_attributes(score: score)\n render :show, status: :ok, location: @evaluation\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def index\n @evaluation_results = EvaluationResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluation_results }\n end\n end",
"def scores\n response[\"scores\"]\n end",
"def index\n @scores = Score.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scores }\n end\n end",
"def evaluations(id)\n connection.get do |req|\n req.url \"job/#{id}/evaluations\"\n end\n end",
"def new\n @enrolled_score = EnrolledScore.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled_score }\n end\n end",
"def index\n @request_scores = RequestScore.all\n end",
"def show\n @score = Score.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @score }\n end\n end",
"def show\n @score = Score.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @score }\n end\n end",
"def show\n @score = Score.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @score }\n end\n end",
"def index\n @evaluations = Evaluation.all\n @evaluation = Evaluation.new\n end",
"def show\n @scoring_method = ScoringMethod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scoring_method }\n end\n end",
"def evaluation\n @api_v1_reservation.evaluate(evaluation_params[:comment], evaluation_params[:rating].to_i) unless @api_v1_reservation.evaluation\n render json: { success: true }, status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end",
"def index\n @evaluaciones = Evaluacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluaciones }\n end\n end",
"def show\n @score = Score.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @score }\n end\n end",
"def show\n @evaluation_result = EvaluationResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluation_result }\n end\n end",
"def show\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_evaluation }\n end\n end",
"def show\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluable_competency }\n end\n end",
"def index\n @performance_evaluations = PerformanceEvaluation.all\n end",
"def index\n @scoring_scales = ScoringScale.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scoring_scales }\n end\n end",
"def show\n @evaluation_criterium = EvaluationCriterium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluation_criterium }\n end\n end",
"def show\n @score = Evaluation.eval_post(@post)\n end",
"def show\n @score = Evaluation.eval_user(@user)\n end",
"def index\n @student_goal_evaluations = StudentGoalEvaluation.all\n end",
"def index\n\t\t@scores = @product.scores.all\n\tend",
"def show\n @evaluacion = Evaluacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluacion }\n end\n end",
"def index\n @high_scores = HighScore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @high_scores }\n end\n end",
"def index\r\n @evaluaciones = Evaluacione.all\r\n end",
"def index\n @challenge_scores = ChallengeScore.all\n end",
"def show\n @evaluationstatus = Evaluationstatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluationstatus }\n end\n end",
"def scores\n @title_page = 'Scores'\n $game.player.score = params['grade'].to_i\n\n @username = $game.player.username\n @score = $game.player.score\n\n response = Request.post_request(URL_SCORES, {\n username: $game.player.username,\n score: $game.player.score\n })\n\n @scores = Request.manage_response(response)\n\n erb :scores, layout: :template\nend",
"def index\n @question_scores = QuestionScore.all\n end",
"def view\n @assignment = Assignment.find(params[:id])\n @questions = Hash.new\n questionnaires = @assignment.questionnaires\n questionnaires.each {\n |questionnaire|\n @questions[questionnaire.symbol] = questionnaire.questions\n }\n\n @scores = @assignment.get_scores(@questions)\n end",
"def show\n @game_score = GameScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_score }\n end\n end",
"def score\n respond_to do |format|\n if @survey.score\n format.html { redirect_to edit_admins_thriver_path(@user), notice: 'Survey was successfully scored.' }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getEvaluations\n\t\tharness.evaluations\n\tend",
"def get_score(user, module_name)\n url = \"https://forgeapi.puppetlabs.com/private/validations/#{user}-#{module_name}\"\n response = Typhoeus.get(url).body\n\n meta_data = JSON.parse response\n\n meta_data[-1]['score'] / 20.0\nend",
"def index\n @scores = Score.all\n end",
"def index\n @scores = Score.all\n end",
"def scores\n @scores\n end",
"def scores\n scores = ValueActivity.all\n render json: ValueActivitiesSerializer.new(scores).serializable_hash\n end",
"def index\n @course_evaluations = CourseEvaluation.all\n end",
"def index\n @scores = Score.all \n end",
"def score\n return nil if scores.count == 0\n average = Hash.new(0)\n scores.each_with_index do |score, num|\n Score::METRICS.each do |metric|\n average[metric] = (average[metric] * num + score.try(metric))/(num + 1.0)\n end\n end\n ret = {score: average}\n return JSON.generate ret\n end",
"def index\n @username_scores = UsernameScore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @username_scores }\n end\n end",
"def show\r\n @evaluation = Evaluation.find(params[:id])\r\n @responses = Response.find_all_by_Evaluation_id params[:id]\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @evaluation }\r\n end\r\n end",
"def index\n @rating_scores = RatingScore.all\n end",
"def show\n @qc_evaluation = QcEvaluation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qc_evaluation }\n end\n end",
"def score\n properties['score']\n end",
"def index\n @evals = Eval.all\n respond_with(@evals) \n end",
"def show\n @scoring_scale = ScoringScale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scoring_scale }\n end\n end",
"def show\n @high_score = HighScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @high_score }\n end\n end",
"def index\n @evaluos = Evaluo.all\n end",
"def update\n if @evaluation.update(evaluation_params)\n render :show, status: :ok\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def index\n authorize Score\n @scores = Score.all\n end",
"def index\n @project_evaluations = ProjectEvaluation.all\n end",
"def new\n @scoring_method = ScoringMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scoring_method }\n end\n end",
"def index\n @analyst_scores = AnalystScore.all\n end",
"def show\n @username_score = UsernameScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @username_score }\n end\n end",
"def index\n @evaluations = Evaluation.accessible_by(current_ability, :read)\n end",
"def show\n @aja_score = AjaScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aja_score }\n end\n end",
"def index\n @test_subject_evaluations = @test_subject.test_subject_evaluations.find(:all, :order => 'evaluated_on DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @test_subject_evaluations }\n end\n end",
"def show\n @title = \"View Team Challenge Score\"\n @challenge_grade = ChallengeGrade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge_grade }\n end\n end",
"def index\n @dish_evaluations = DishEvaluation.all\n end",
"def index\n @test_scores = @participant.test_scores.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @test_scores }\n end\n end",
"def score\n @scores[ result.key ]\n end",
"def create\n @evaluations = Evaluation.new(evaluation_params)\n\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to @evaluation, notice: 'evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @evaluation_sheet = EvaluationSheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evaluation_sheet }\n end\n end",
"def index\n @scores = (@user || @quiz).scores\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @scores }\n end\n end",
"def index\n @user_scores = UserScore.all\n end",
"def view\n if session[\"github_access_token\"].nil?\n session[\"assignment_id\"] = params[:id]\n session[\"github_view_type\"] = \"view_scores\"\n return redirect_to authorize_github_grades_path\n end\n @assignment = Assignment.find(params[:id])\n @questions = {}\n questionnaires = @assignment.questionnaires\n if @assignment.varying_rubrics_by_round?\n retrieve_questions questionnaires\n else # if this assignment does not have \"varying rubric by rounds\" feature\n questionnaires.each do |questionnaire|\n @questions[questionnaire.symbol] = questionnaire.questions\n end\n end\n\n @scores = @assignment.scores(@questions)\n averages = calculate_average_vector(@assignment.scores(@questions))\n @average_chart = bar_chart(averages, 300, 100, 5)\n @avg_of_avg = mean(averages)\n calculate_all_penalties(@assignment.id)\n @show_reputation = false\n end",
"def completed_evaluations_list\n\t\t@student = Student.find(params[:student_id])\n\t\t@evaluations = []\n\t\tfor evaluation in @student.evaluations\n\t\t\tif evaluation.isCompleted\n\t\t\t\t@evaluations << evaluation\n\t\t\tend\n\t\tend\n\t\trender json: @evaluations\n\tend",
"def index\n @bet_scores = @match.bet_scores\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bet_scores }\n end\n end",
"def create\n @score_evaluation = ScoreEvaluation.new(params[:score_evaluation])\n \n respond_to do |format|\n if @score_evaluation.save\n format.html { redirect_to @score_evaluation, :notice => t('selecao_admin.flash_messages.successfully_created.', :model => @score_evaluation.class.model_name.human) }\n format.json { render :json => @score_evaluation, :status => :created, :location => @score_evaluation }\n format.js\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @score_evaluation.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end",
"def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end",
"def new\n @scoring_scale = ScoringScale.new\n @scoring = Scoring.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scoring_scale }\n end\n end",
"def index\n @scoring_options = ScoringOption.all\n end",
"def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @score }\n end\n end",
"def index\n @five_scores = FiveScore.all\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n\n if @evaluation.save\n render :show, status: :created\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def new\n @evaluation = current_customer.customer_evaluations.new\n\n @evaluation.name = Evaluation.sample_evaluation.name if params[:testing]\n respond_to do |format|\n format.html # new.html.erb\n format.json {render json: @evaluation}\n end\n end",
"def index\n @score_templates = ScoreTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @score_templates }\n end\n end"
] |
[
"0.7758526",
"0.73732257",
"0.70204735",
"0.6716154",
"0.66650575",
"0.663015",
"0.6580333",
"0.6580333",
"0.6580333",
"0.6580333",
"0.6580333",
"0.6572777",
"0.65650946",
"0.65452427",
"0.6541506",
"0.6540212",
"0.64819765",
"0.64585924",
"0.64346033",
"0.63955975",
"0.63431776",
"0.6328063",
"0.6314175",
"0.6301119",
"0.62729794",
"0.62729794",
"0.62729794",
"0.6260007",
"0.6250315",
"0.6250006",
"0.6242753",
"0.6236388",
"0.62323654",
"0.62251854",
"0.61926997",
"0.6184595",
"0.6183531",
"0.61340666",
"0.61215705",
"0.6114486",
"0.6096726",
"0.60878325",
"0.6084941",
"0.6075886",
"0.6072786",
"0.6062588",
"0.60619855",
"0.6055212",
"0.60525554",
"0.60470045",
"0.6045161",
"0.60419905",
"0.6018591",
"0.60151255",
"0.60132927",
"0.60132927",
"0.59927064",
"0.59912056",
"0.59804976",
"0.5979304",
"0.5965392",
"0.5961632",
"0.59476954",
"0.59319097",
"0.5929115",
"0.59199697",
"0.59146446",
"0.5900867",
"0.58978516",
"0.58970875",
"0.5884044",
"0.58812016",
"0.5880298",
"0.58747137",
"0.58705693",
"0.5868432",
"0.5857293",
"0.58266795",
"0.58204025",
"0.5810276",
"0.58091193",
"0.5801865",
"0.57944876",
"0.5794046",
"0.5790753",
"0.57906145",
"0.578572",
"0.57736343",
"0.5773309",
"0.5759189",
"0.57551163",
"0.5745375",
"0.5745375",
"0.57409126",
"0.573803",
"0.57318217",
"0.5714966",
"0.5710929",
"0.570656",
"0.5705832"
] |
0.7525323
|
1
|
GET /score_evaluations/new GET /score_evaluations/new.json
|
def new
@score_evaluation = ScoreEvaluation.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @score_evaluation }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @enrolled_score = EnrolledScore.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled_score }\n end\n end",
"def new\n @scoring_method = ScoringMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scoring_method }\n end\n end",
"def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end",
"def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end",
"def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @score }\n end\n end",
"def new\n @evaluation_criterium = EvaluationCriterium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @evaluation_criterium }\n end\n end",
"def new\n @evaluationstatus = Evaluationstatus.new\n @title = 'New Evaluation Status'\n @description = 'Add a new evaluation status to the system'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @evaluationstatus }\n end\n end",
"def new\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competency_pertenece_evaluation }\n end\n end",
"def new\n @high_score = HighScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @high_score }\n end\n end",
"def new\n @scoring_scale = ScoringScale.new\n @scoring = Scoring.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scoring_scale }\n end\n end",
"def create\n @score_evaluation = ScoreEvaluation.new(params[:score_evaluation])\n \n respond_to do |format|\n if @score_evaluation.save\n format.html { redirect_to @score_evaluation, :notice => t('selecao_admin.flash_messages.successfully_created.', :model => @score_evaluation.class.model_name.human) }\n format.json { render :json => @score_evaluation, :status => :created, :location => @score_evaluation }\n format.js\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @score_evaluation.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def new\n @evaluation = current_customer.customer_evaluations.new\n\n @evaluation.name = Evaluation.sample_evaluation.name if params[:testing]\n respond_to do |format|\n format.html # new.html.erb\n format.json {render json: @evaluation}\n end\n end",
"def new\n @evaluable_competency = EvaluableCompetency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @evaluable_competency }\n end\n end",
"def new\n @game_score = GameScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game_score }\n end\n end",
"def new\n @qc_evaluation = QcEvaluation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @qc_evaluation }\n end\n end",
"def create\n @evaluations = Evaluation.new(evaluation_params)\n\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to @evaluation, notice: 'evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @username_score = UsernameScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @username_score }\n end\n end",
"def new\n @matrix_evaluation_type = MatrixEvaluationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @matrix_evaluation_type }\n end\n end",
"def new\n @evaluations = Evaluation.new\n end",
"def new\n @rcrieval = Rcrieval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rcrieval }\n end\n end",
"def new\n @aja_score = AjaScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aja_score }\n end\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @evaluation }\n else\n format.html { render action: 'new' }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @evaluation }\n else\n format.html { render action: 'new' }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # ToDo: 名前の変更\n score = params[:score]\n \n\n if @evaluation.update_attributes(score: score)\n render :show, status: :ok, location: @evaluation\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def new\n @transit_score = TransitScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transit_score }\n end\n end",
"def new\n @score = Score.new\n end",
"def create\n @score = Score.new(score_params)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to next_scores_path, notice: 'Score was successfully created.' }\n format.json { render action: 'show', status: :created, location: @score }\n else\n format.html { render action: 'new' }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @test_score = @participant.test_scores.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_score }\n end\n end",
"def new\n @score = Score.new\n @score.date = Time.now-4.hours\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score }\n end\n end",
"def new\n @ranking = Ranking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ranking }\n end\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n\n if @evaluation.save\n render :show, status: :created\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @score = Score.new(params[:score])\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render json: @score, status: :created, location: @score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @score = Score.new(params[:score])\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render json: @score, status: :created, location: @score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @box_score = BoxScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @box_score }\n end\n end",
"def new\n @bet_score = @match.bet_scores.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bet_score }\n end\n end",
"def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @score }\n end\n end",
"def new\n @score = Score.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @score }\n end\n end",
"def create\n @enrolled_score = EnrolledScore.new(params[:enrolled_score])\n \n respond_to do |format|\n if @enrolled_score.save\n format.html { redirect_to @enrolled_score, :notice => t('selecao_admin.flash_messages.successfully_created', :model => @enrolled_score.class.model_name.human) }\n format.json { render :json => @enrolled_score, :status => :created, :location => @enrolled_score }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @enrolled_score.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @evaluation = Evaluation.new\n\t\t\n\t\tif request.post?\n\t\t\tevaluator = Evaluator.first(:conditions => ['email = ?', params[:evaluator]])\n\t\t\tif evaluator.nil?\n\t\t\t\tevaluator = Evaluator.create({:email => params[:evaluator]})\n\t\t\tend\n\t\t\t\n\t\t\t@evaluation.evaluator = evaluator\n\t\t\t@evaluation.citation = Citation.find(params[:citation_id])\n\t\t\t@evaluation.result = params[:evaluation]\n\t\t\t@evaluation.parser = params[:parser]\n\t\t\t@evaluation.save\n\t\tend\n\t\t\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @evaluation }\n end\n end",
"def new\n @possess = Possess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @possess }\n end\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to @evaluation, notice: 'Avaliação criada.' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @reward_rule = RewardRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reward_rule }\n end\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n\n if @evaluation.save\n redirect_to action: \"index\", notice: 'Evaluation was successfully created.' \n else\n @evaluations = Evaluation.all\n\n render :new, locals: {evaluation: @evaluation, evaluations: @evaluations } \n end\n end",
"def create\n @score = Score.new(score_params)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render :show, status: :created, location: @score }\n else\n format.html { render :new }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @score = Score.new(score_params)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render :show, status: :created, location: @score }\n else\n format.html { render :new }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @grade_scale = GradeScale.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @grade_scale }\n end\n end",
"def create\n \n \n @evaluation = @course.evaluations.new(evaluation_params)\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to course_evaluation_path(@course,@evaluation) , notice: 'La evaluación fue creada con éxito.' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @accuracy = Accuracy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accuracy }\n end\n end",
"def new\n @predict = Predict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @predict }\n end\n end",
"def new\n @scraping_algorithm = ScrapingAlgorithm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scraping_algorithm }\n end\n end",
"def new\n @grade = Grade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grade }\n end\n end",
"def create\n \n if ENV[\"NEW_EVALUATION\"] == nil\n raise ActionController::RoutingError\n return\n end\n @entry = Entry.find(params[:id])\n @evaluation = @entry.evaluations.find_by(school_num:params[:evaluation][:school_num])\n success_flag = true\n begin \n if(@evaluation == nil)then\n \n @evaluation = Evaluation.create(evaluation_params)\n @entry.evaluations<<@evaluation\n else\n success_flag = @evaluation.update(evaluation_params)\n end\n rescue\n success_flag = false\n end\n\n if @evaluation.id == nil\n # @evaluation = Evaluation.new\n success_flag = false\n end\n respond_to do |format|\n if success_flag == true\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { redirect_to \"/evaluations/\"+params[:id].to_s + \"/new\", json: @evaluation.errors}\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @score = Score.new(score_params)\n if @score.save\n render json: @score, status: 201\n else\n render json: { errors: @score.errors.full_message }, status: 422\n end\n end",
"def new\n @prob = Prob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prob }\n end\n end",
"def create_evaluation\n @professor_form = ProfessorForm.new(professor_form_params)\n if @professor_form.save\n render json: @professor_form\n else\n render json: @professor_form.errors\n end\n end",
"def new\r\n @reviewId = params[:review_id]\r\n @review = Review.find(@reviewId)\r\n \r\n @reviewer = TeamMember.find_by_name('Eric Peterson')\r\n\r\n @reviewee_name = @review.TeamMember.name\r\n @reviewer_name = @reviewer.name\r\n\r\n @evaluation = Evaluation.new\r\n @evaluation.Review = @review\r\n @evaluation.TeamMember = @reviewer\r\n\r\n @questions = Question.all\r\n @answers = @questions.compact.map { |q|\r\n @r = Response.new\r\n @r.Evaluation = @evaluation\r\n @r.Question = q\r\n @r.Answer = Answer.new\r\n\r\n @r\r\n }\r\n\r\n @evaluation.answer_set = @answers\r\n \r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @evaluation }\r\n end\r\n end",
"def new\n @ability_score = AbilityScore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ability_score }\n end\n end",
"def new\n @calculated_data_assessment = CalculatedDataAssessment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calculated_data_assessment }\n end\n end",
"def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end",
"def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end",
"def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating }\n end\n end",
"def new\n @training_level = TrainingLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @training_level }\n end\n end",
"def new\n @criterion = Criterion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @criterion }\n end\n end",
"def create\n score = current_user.scores.new(score_params)\n\n if score.save\n render json: score\n else\n render json: { errors: score.errors.join(',') }, status: 422\n end\n end",
"def create\n @student_goal_evaluation = StudentGoalEvaluation.new(student_goal_evaluation_params)\n\n respond_to do |format|\n if @student_goal_evaluation.save\n format.html { redirect_to root_path, notice: 'Evalueringen er gemt.' }\n format.json { render :show, status: :created, location: @student_goal_evaluation }\n else\n format.html { render :new }\n format.json { render json: @student_goal_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @rating_scale_step = RatingScaleStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating_scale_step }\n end\n end",
"def new\n @points_history = PointsHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @points_history }\n end\n end",
"def new\n @scorecard = Scorecard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scorecard }\n end\n end",
"def new\n @box_score_entry = BoxScoreEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @box_score_entry }\n end\n end",
"def new\n @enrolled = Enrolled.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled }\n end\n end",
"def create\n @request_score = RequestScore.new(request_score_params)\n\n respond_to do |format|\n if @request_score.save\n format.html { redirect_to @request_score, notice: 'Request score was successfully created.' }\n format.json { render :show, status: :created, location: @request_score }\n else\n format.html { render :new }\n format.json { render json: @request_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @objective = Objective.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @objective }\n end\n end",
"def new\n @event = Event.find(params[:event_id])\n @score_template = ScoreTemplate.new()\n\n @question = @score_template.questions.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score_template }\n end\n end",
"def create\n @game_score = GameScore.new(params[:game_score])\n\n respond_to do |format|\n if @game_score.save\n format.html { redirect_to @game_score, notice: 'Game score was successfully created.' }\n format.json { render json: @game_score, status: :created, location: @game_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end",
"def new\n @school_rating = SchoolRating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @school_rating }\n end\n end",
"def new\n @objective_result = ObjectiveResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @objective_result }\n end\n end",
"def new\n @rank = Rank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @rank }\n end\n end",
"def new\n @decision = Decision.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @decision }\n end\n end",
"def create\n @evaluation = Evaluation.new(params[:evaluation])\n\n respond_to do |format|\n if @evaluation.save\n flash[:notice] = 'Evaluation was successfully created.'\n format.html { redirect_to(@evaluation) }\n format.xml { render :xml => @evaluation, :status => :created, :location => @evaluation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @evaluation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @risk_classification = RiskClassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @risk_classification }\n end\n end",
"def new\n @exp = Exp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exp }\n end\n end",
"def new\n @event = Event.find(params[:event_id])\n @competitor = Competitor.find(params[:competitor_id])\n @judge = Judge.find(params[:judge_id])\n @score_sheet = ScoreSheet.new(event_id: @event.id, \n judge_id: @judge.id, \n competitor_id: @competitor.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @score_sheet }\n end\n end",
"def new\n @team_rating = TeamRating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team_rating }\n end\n end",
"def create\n @high_score = HighScore.new(params[:high_score])\n\n respond_to do |format|\n if @high_score.save\n format.html { redirect_to @high_score, notice: 'High score was successfully created.' }\n format.json { render json: @high_score, status: :created, location: @high_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @high_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @criterion = Criterion.new\n render json: @criterion\n end",
"def new\n @risk_level = RiskLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @risk_level }\n end\n end",
"def create\n @analyst_score = AnalystScore.new(analyst_score_params)\n\n respond_to do |format|\n if @analyst_score.save\n format.html { redirect_to @analyst_score, notice: 'Analyst score was successfully created.' }\n format.json { render action: 'show', status: :created, location: @analyst_score }\n else\n format.html { render action: 'new' }\n format.json { render json: @analyst_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @leaderboard = Leaderboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @leaderboard }\n end\n end",
"def new\n @rock = Rock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rock }\n end\n end",
"def create\n @evaluationstatus = Evaluationstatus.new(params[:evaluationstatus])\n\n respond_to do |format|\n if @evaluationstatus.save\n format.html { redirect_to @evaluationstatus, notice: 'Evaluation status was successfully created.' }\n format.json { render json: @evaluationstatus, status: :created, location: @evaluationstatus }\n else\n format.html { render action: \"new\" }\n format.json { render json: @evaluationstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @assigned = Assigned.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assigned }\n end\n end",
"def create\r\n @evaluacione = Evaluacione.new(evaluacione_params)\r\n\r\n respond_to do |format|\r\n if @evaluacione.save\r\n format.html { redirect_to @evaluacione, notice: 'Evaluacione was successfully created.' }\r\n format.json { render :show, status: :created, location: @evaluacione }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @evaluacione.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def new\n @leader = Leader.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @leader }\n end\n end",
"def create\n @evaluation = current_customer.customer_evaluations.new(evaluation_params)\n if params['clone'] == 'true'\n @evaluation = @evaluation.clone_last_evaluation\n @evaluation.name = params[:evaluation][:name]\n @evaluation.status = Evaluation::STATUSES.index(\"draft\")\n @evaluation.published_at = nil\n end\n\n if params[:testing] == 'true'\n @evaluation = Evaluation.sample_evaluation.clone_evaluation\n @evaluation.name = params[:evaluation][:name]\n @evaluation.status = Evaluation::STATUSES.index(\"draft\")\n @evaluation.published_at = nil\n @evaluation.distinguish_type = Evaluation::TYPES.index(:sandbox)\n end\n\n @evaluation.company_id = current_company.id\n @evaluation.customer_id = current_customer.id\n @evaluation.created_by = current_user.id\n\n respond_to do |format|\n if @evaluation.save\n @evaluation.create_default_evaluation_services if params['clone'] != 'true'\n format.html {redirect_to customer_evaluation_path(current_customer, @evaluation), notice: I18n.t('evaluations.messages.successfully_created')}\n format.json {render json: @evaluation, status: :created, location: @evaluation}\n else\n format.html {render action: \"new\"}\n format.json {render json: @evaluation.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @course_evaluation = CourseEvaluation.new(course_evaluation_params)\n\n respond_to do |format|\n if @course_evaluation.save\n format.html { redirect_to @course_evaluation, notice: 'Course evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @course_evaluation }\n else\n format.html { render :new }\n format.json { render json: @course_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rating_score = RatingScore.new(rating_score_params)\n\n respond_to do |format|\n if @rating_score.save\n format.html { redirect_to @rating_score, notice: 'Rating score was successfully created.' }\n format.json { render :show, status: :created, location: @rating_score }\n else\n format.html { render :new }\n format.json { render json: @rating_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @grade = Grade.new\n\n respond_to do |format|\n format.html { render :layout => false }\n format.json { render json: @grade }\n end\n end",
"def new\n @rating_alt = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating_alt }\n end\n end"
] |
[
"0.7627355",
"0.757976",
"0.7560061",
"0.7560061",
"0.7487279",
"0.72648525",
"0.72530866",
"0.7227352",
"0.7157638",
"0.7148147",
"0.7145764",
"0.71226704",
"0.7105994",
"0.7081638",
"0.7004847",
"0.6993702",
"0.69931126",
"0.69393915",
"0.69366086",
"0.6908612",
"0.68849134",
"0.68500286",
"0.68500286",
"0.68348277",
"0.6819673",
"0.6817293",
"0.6815095",
"0.68135554",
"0.68109554",
"0.6788194",
"0.67701435",
"0.6769834",
"0.6759639",
"0.6759639",
"0.67514",
"0.6747112",
"0.671733",
"0.671733",
"0.6717184",
"0.6717158",
"0.6691995",
"0.66860473",
"0.665543",
"0.66153514",
"0.657034",
"0.657034",
"0.6553871",
"0.6545015",
"0.6540289",
"0.6538479",
"0.65372545",
"0.6531964",
"0.6528033",
"0.65219885",
"0.6520308",
"0.65202963",
"0.6517118",
"0.6514611",
"0.65141994",
"0.6513933",
"0.6513933",
"0.6513933",
"0.6511329",
"0.65112394",
"0.6507784",
"0.6499407",
"0.6484549",
"0.6479908",
"0.6474376",
"0.64656883",
"0.6464979",
"0.64576423",
"0.6448689",
"0.64461994",
"0.644337",
"0.6434458",
"0.6432178",
"0.6428993",
"0.64183253",
"0.6412454",
"0.64115405",
"0.6409856",
"0.6402422",
"0.639705",
"0.6393114",
"0.63913125",
"0.6388291",
"0.63815165",
"0.63812065",
"0.63731855",
"0.6360071",
"0.6353688",
"0.63518006",
"0.6344227",
"0.63400817",
"0.63365996",
"0.63293326",
"0.63289016",
"0.63261956",
"0.6325296"
] |
0.8273216
|
0
|
POST /score_evaluations POST /score_evaluations.json
|
def create
@score_evaluation = ScoreEvaluation.new(params[:score_evaluation])
respond_to do |format|
if @score_evaluation.save
format.html { redirect_to @score_evaluation, :notice => t('selecao_admin.flash_messages.successfully_created.', :model => @score_evaluation.class.model_name.human) }
format.json { render :json => @score_evaluation, :status => :created, :location => @score_evaluation }
format.js
else
format.html { render :action => "new" }
format.json { render :json => @score_evaluation.errors, :status => :unprocessable_entity }
format.js
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n # ToDo: 名前の変更\n score = params[:score]\n \n\n if @evaluation.update_attributes(score: score)\n render :show, status: :ok, location: @evaluation\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def create\n @evaluations = Evaluation.new(evaluation_params)\n\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to @evaluation, notice: 'evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @score_evaluations = ScoreEvaluation.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @score_evaluations }\n end\n end",
"def new\n @score_evaluation = ScoreEvaluation.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @score_evaluation }\n end\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n\n if @evaluation.save\n render :show, status: :created\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def evaluation_params\n params.require(:evaluation).permit(:score, :comment, :project_id, :team_member_id)\n end",
"def create\r\n @evaluation = Evaluation.new(params[:evaluation])\r\n @answers = @evaluation.responses\r\n\r\n respond_to do |format|\r\n if @evaluation.save && @answers.each{|a| a.save }.all?\r\n format.html { redirect_to(@evaluation, :notice => 'Evaluation was successfully created.') }\r\n format.xml { render :xml => @evaluation, :status => :created, :location => @evaluation }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @evaluation.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def evaluation_params\n params.require(:evaluation).permit(:course_id, :professor_id, :course_score, :teacher_score)\n end",
"def create\n @score = Score.new(score_params)\n if @score.save\n render json: @score, status: 201\n else\n render json: { errors: @score.errors.full_message }, status: 422\n end\n end",
"def create\n @enrolled_score = EnrolledScore.new(params[:enrolled_score])\n \n respond_to do |format|\n if @enrolled_score.save\n format.html { redirect_to @enrolled_score, :notice => t('selecao_admin.flash_messages.successfully_created', :model => @enrolled_score.class.model_name.human) }\n format.json { render :json => @enrolled_score, :status => :created, :location => @enrolled_score }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @enrolled_score.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @evaluation }\n else\n format.html { render action: 'new' }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @evaluation }\n else\n format.html { render action: 'new' }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def evaluation\n @api_v1_reservation.evaluate(evaluation_params[:comment], evaluation_params[:rating].to_i) unless @api_v1_reservation.evaluation\n render json: { success: true }, status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end",
"def create\n \n \n @evaluation = @course.evaluations.new(evaluation_params)\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to course_evaluation_path(@course,@evaluation) , notice: 'La evaluación fue creada con éxito.' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n score = current_user.scores.new(score_params)\n\n if score.save\n render json: score\n else\n render json: { errors: score.errors.join(',') }, status: 422\n end\n end",
"def create_scores\r\n\r\n end",
"def evaluation_params\n params.require(:evaluation).permit(:value, :study_case_id, :user_id)\n end",
"def evaluate\n response = Quiz.find(params[:quiz_id]).evaluate(params[:questions], current_user)\n @answers = response[:answers]\n @nota = response[:grade]\n\n respond_to do |format|\n format.html { render 'evaluate' }\n end\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n @evaluation.collection = evaluation_params[:collection]\n \n\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to @evaluation, notice: \"Evaluation was successfully created.\" }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to @evaluation, notice: 'Avaliação criada.' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def evaluation_params\n params.require(:evaluation).permit(:school_num, :evaluate1, :evaluate2, :evaluate3, :evaluate4, :comment)\n end",
"def auto_score!\n responses = sanitize_form_data_hash\n\n scores = {\n regional_partner_name: regional_partner ? YES : NO,\n committed: responses[:committed] == YES ? YES : NO,\n able_to_attend_single: yes_no_response_to_yes_no_score(responses[:able_to_attend_single])\n }\n\n if responses[:principal_approval] == YES\n scores.merge!(\n {\n principal_approval: YES,\n schedule_confirmed: yes_no_response_to_yes_no_score(responses[:schedule_confirmed]),\n diversity_recruitment: yes_no_response_to_yes_no_score(responses[:diversity_recruitment]),\n free_lunch_percent: responses[:free_lunch_percent].to_f >= 50 ? 5 : 0,\n underrepresented_minority_percent: responses[:underrepresented_minority_percent].to_f >= 50 ? 5 : 0,\n wont_replace_existing_course: responses[:wont_replace_existing_course].try(:start_with?, NO) ? 5 : nil,\n }\n )\n elsif responses[:principal_approval] == NO\n scores[:principal_approval] = NO\n end\n\n if course == 'csp'\n scores[:csp_which_grades] = responses[:csp_which_grades].any? ? YES : NO\n scores[:csp_course_hours_per_year] = responses[:csp_course_hours_per_year] == COMMON_OPTIONS[:course_hours_per_year].first ? YES : NO\n scores[:previous_yearlong_cdo_pd] = responses[:previous_yearlong_cdo_pd].exclude?('CS Principles') ? YES : NO\n scores[:csp_ap_exam] = responses[:csp_ap_exam] != Pd::Application::Teacher1819Application.options[:csp_ap_exam].last ? YES : NO\n scores[:taught_in_past] = responses[:taught_in_past].none? {|x| x.include? 'AP'} ? 2 : 0\n elsif course == 'csd'\n scores[:csd_which_grades] = (responses[:csd_which_grades].map(&:to_i) & (6..10).to_a).any? ? YES : NO\n scores[:csd_course_hours_per_year] = responses[:csd_course_hours_per_year] != COMMON_OPTIONS[:course_hours_per_year].last ? YES : NO\n scores[:previous_yearlong_cdo_pd] = (responses[:previous_yearlong_cdo_pd] & ['CS Discoveries', 'Exploring Computer Science']).empty? ? YES : NO\n scores[:taught_in_past] = responses[:taught_in_past].include?(Pd::Application::Teacher1819Application.options[:taught_in_past].last) ? 2 : 0\n end\n\n # Update the hash, but don't override existing scores\n update(response_scores: response_scores_hash.merge(scores) {|_, old_value, _| old_value}.to_json)\n end",
"def update\n unless @submission.evaluated.blank?\n respond_to do |format|\n format.html { redirect_to test_submission_path(@test, @submission), info: \"Evaluated!\" }\n end\n return\n end\n\n unless Time.now > @timeout + 5.seconds\n @submission.answers_of_questions.each do |user_answer|\n user_answer.update(choice: submission_params.fetch(user_answer.answer_id.to_s, \"false\"))\n end\n end\n if Time.now > @timeout || params[:evaluate]\n @test.questions.each do |question|\n crrct = get_result(question)\n @submission.increment!(:point, question.point) if crrct\n @submission.question_evaluations.create({question_id: question.id, value: crrct})\n end\n @submission.update(evaluated: true)\n respond_to do |format|\n format.html { redirect_to test_submission_path(@test, @submission) }\n end\n else\n respond_to do |format|\n format.html { redirect_to submissions_path, success: 'Submission was successfully saved.' }\n end\n end\n\n end",
"def create\n\n\n @score = Score.new(simulate_test_score_params)\n\n if @score.save\n\n redirect_to examination_scores_path(@examination),\n notice: '模考成绩已保存'\n\n end\n\n end",
"def create\n @score = Score.new(score_params)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to next_scores_path, notice: 'Score was successfully created.' }\n format.json { render action: 'show', status: :created, location: @score }\n else\n format.html { render action: 'new' }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_goal_evaluation = StudentGoalEvaluation.new(student_goal_evaluation_params)\n\n respond_to do |format|\n if @student_goal_evaluation.save\n format.html { redirect_to root_path, notice: 'Evalueringen er gemt.' }\n format.json { render :show, status: :created, location: @student_goal_evaluation }\n else\n format.html { render :new }\n format.json { render json: @student_goal_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_evaluation\n @professor_form = ProfessorForm.new(professor_form_params)\n if @professor_form.save\n render json: @professor_form\n else\n render json: @professor_form.errors\n end\n end",
"def evaluation\n responses = self.user_survey_responses\n correct_answers = 0.0\n responses.each do |response|\n answer = Answer.find(response.answer_id)\n correct_answers += 1 if answer.correct\n end\n if self.grade.nil?\n self.grade = Grade.create score: 0, gradable: self, user_id: self.user_id\n end\n if (responses.size != 0) then\n evaluation = (correct_answers/responses.size)*10\n #self.update_attributes result: evaluation\n if evaluation != grade.score\n self.grade.update_attributes score: evaluation\n end\n return evaluation\n else\n #self.update_attributes result: 0.0\n if grade.score != 0\n self.grade.update_attributes score: 0, gradable: self\n end\n return 0.0\n end\n end",
"def create\n @evaluate = Evaluate.new(evaluate_params)\n @evaluate.user_id= current_user.id\n @evaluate.review_id = @review.id\n\n respond_to do |format|\n if @evaluate.save\n format.html { redirect_to @review, notice: 'Evaluate was successfully created.' }\n format.json { render :show, status: :created, location: @evaluate }\n else\n format.html { render :new }\n format.json { render json: @evaluate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def evaluation_params\n params.require(:evaluation).permit(:title, :approbation_grade, :date)\n end",
"def create\n @request_score = RequestScore.new(request_score_params)\n\n respond_to do |format|\n if @request_score.save\n format.html { redirect_to @request_score, notice: 'Request score was successfully created.' }\n format.json { render :show, status: :created, location: @request_score }\n else\n format.html { render :new }\n format.json { render json: @request_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def evaluation_params\n params.require(:evaluation).permit(:user_id, :lesson_id, :practice_id, :title, :material, :question, :answer, :your_answer, :score, :practice_score, :picture_ya, :end_at, :papertest)\n end",
"def create\n @score = Score.new(params[:score])\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render json: @score, status: :created, location: @score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @score = Score.new(params[:score])\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render json: @score, status: :created, location: @score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_evaluation = ::UserEvaluation.new(user_evaluation_params)\n @user_evaluation.evaluation = @evaluation\n @user_evaluation.account = current_user.account\n \n if @user_evaluation.save\n render json: @user_evaluation, status: :created, \n serializer: ::Admin::Evaluation::UserEvaluationSerializer\n else\n render json: @user_evaluation.errors, status: :unprocessable_entity\n end\n end",
"def create\n @score = Score.new(score_params)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render :show, status: :created, location: @score }\n else\n format.html { render :new }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @score = Score.new(score_params)\n\n respond_to do |format|\n if @score.save\n format.html { redirect_to @score, notice: 'Score was successfully created.' }\n format.json { render :show, status: :created, location: @score }\n else\n format.html { render :new }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n course = Course.find(params[:course_id])\n student = Student.find_by(dni: params[:student_id])\n @enroll = Enroll.new( student: student, course: course)\n TestCourse.of(course).each do |tc|\n Score.create( student: student, test_id: tc.test_id, value: -2)\n end\n \n respond_to do |format|\n if @enroll.save\n format.html { redirect_to course_enrolls_path(course), notice: 'Enroll was successfully created.' }\n format.json { render :show, status: :created, location: course_enrolls_path(course) }\n else\n format.html { render :new }\n format.json { render json: @enroll.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n course = Course.find(params[:course_id])\n test = Test.find(params[:test_id])\n respond_to do |format|\n begin\n puts params[:absent].nil?\n i = 0\n Score.where(test: test).each do |score|\n if !score.update(value: (params[:\"absent#{i}\"]? -2 : params[:\"score-input#{i}\"]))\n raise\n end\n i += 1\n end\n rescue => exception\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n else\n format.html { redirect_to course_test_scores_path(course, test), notice: 'Scores were successfully updated.' }\n format.json { render :show, status: :ok, location: course_test_scores_path(course, test) }\n end\n end\n end",
"def evaluation_params\n params.require(:evaluation).permit(:collection, :resource, :body, :result, :executor, :title, :metrics, :subject)\n end",
"def evaluation_params\n params.require(:evaluation).permit(:collection, :resource, :body, :result, :executor, :title, :metrics, :subject)\n end",
"def evaluate_params\n params.require(:evaluate).permit(:rating, :comment)\n end",
"def score_params\n params.require(:regularscorer).permit(:homescore, :awayscore)\n end",
"def create\n \n if ENV[\"NEW_EVALUATION\"] == nil\n raise ActionController::RoutingError\n return\n end\n @entry = Entry.find(params[:id])\n @evaluation = @entry.evaluations.find_by(school_num:params[:evaluation][:school_num])\n success_flag = true\n begin \n if(@evaluation == nil)then\n \n @evaluation = Evaluation.create(evaluation_params)\n @entry.evaluations<<@evaluation\n else\n success_flag = @evaluation.update(evaluation_params)\n end\n rescue\n success_flag = false\n end\n\n if @evaluation.id == nil\n # @evaluation = Evaluation.new\n success_flag = false\n end\n respond_to do |format|\n if success_flag == true\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { redirect_to \"/evaluations/\"+params[:id].to_s + \"/new\", json: @evaluation.errors}\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def answer_value_params\n params.require(:answer_value).permit(:score)\n end",
"def create\r\n @evaluacione = Evaluacione.new(evaluacione_params)\r\n\r\n respond_to do |format|\r\n if @evaluacione.save\r\n format.html { redirect_to @evaluacione, notice: 'Evaluacione was successfully created.' }\r\n format.json { render :show, status: :created, location: @evaluacione }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @evaluacione.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @user_score = UserScore.new(user_score_params)\n\n respond_to do |format|\n if @user_score.save\n format.html { redirect_to @user_score, notice: 'User score was successfully created.' }\n format.json { render :show, status: :created, location: @user_score }\n else\n format.html { render :new }\n format.json { render json: @user_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n\n if @evaluation.save\n redirect_to action: \"index\", notice: 'Evaluation was successfully created.' \n else\n @evaluations = Evaluation.all\n\n render :new, locals: {evaluation: @evaluation, evaluations: @evaluations } \n end\n end",
"def score_params\n params.require(:score).permit(:name, :test_type, :month, :year, :math, :reading, :writing, :essay, :science, :english, :comment, :day, :taken_date, :user_id)\n end",
"def evaluation_params\n params.require(:evaluation).permit(:restaurant_id, :standards, :name, :message)\n end",
"def score_params\n params.require(:score).permit(:app_form_id, :user_id, :criteria, :score, :reason)\n end",
"def create\n if current_user.has_role? :admin\n @evaluation = Evaluation.new(evaluation_params)\n else\n @practice = Practice.find(session[:practice_id])\n @evaluation = Evaluation.new(evaluation_params)\n @evaluation.lesson_id = session[:lesson_id]\n @evaluation.user_id = current_user.id\n @evaluation.practice_id = @practice.id\n @evaluation.title = @practice.title\n @evaluation.material = @practice.material\n @evaluation.question = @practice.question\n @evaluation.answer = @practice.answer\n @evaluation.practice_score ||= @practice.score\n if session[:papertest_id]\n @papertest = Papertest.find(session[:papertest_id])\n if Time.now < @papertest.end_at\n @evaluation.end_at = @papertest.end_at\n @evaluation.papertest_id = @papertest.id\n else\n session[:papertest_id] = nil\n redirect_to paper_url(@papertest.paper_id), notice: \"考试已结束!\"\n return\n end\n end\n end\n respond_to do |format|\n if @evaluation.save\n if @practice.answer.gsub(/(<(\\w|\\/)+[^>]*>|\\s)/, \"\") == @evaluation.your_answer.gsub(/(<(\\w|\\/)+[^>]*>|\\s)/, \"\") # 如果答对了\n @justice = Justice.create!(\n user_id: 1,\n evaluation_user_id: @evaluation.user_id,\n practice_id: @evaluation.practice_id,\n\t evaluation_id: @evaluation.id,\n\t score: @evaluation.practice_score, # 得到满分\n\t p_score: @evaluation.practice_score,\n remark: \"完全正确!\",\n )\n @evaluation.update(score: @evaluation.practice_score)\n end\n format.html { redirect_to @evaluation, notice: '答案提交成功' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def score_params\n params.require(:score).permit(:value, :game_id, :user_id, :date, :detail, :streak)\n end",
"def create\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.new(params[:competency_pertenece_evaluation])\n\n respond_to do |format|\n if @competency_pertenece_evaluation.save\n format.html { redirect_to @competency_pertenece_evaluation, notice: 'Competency pertenece evaluation was successfully created.' }\n format.json { render json: @competency_pertenece_evaluation, status: :created, location: @competency_pertenece_evaluation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competency_pertenece_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rating_score = RatingScore.new(rating_score_params)\n\n respond_to do |format|\n if @rating_score.save\n format.html { redirect_to @rating_score, notice: 'Rating score was successfully created.' }\n format.json { render :show, status: :created, location: @rating_score }\n else\n format.html { render :new }\n format.json { render json: @rating_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def evaluate\n puts params[:rating].inspect.yellow\n params[:ratings].each do |tenant, report|\n participant = @game.participants.find_by(tenant: tenant)\n if participant\n participant.ratings.create!(report: report, rated_at: Time.parse(report[:stopped_at]))\n else\n puts \"Cannot find participant #{tenant}\"\n end\n end\n render json: { status: 'ok' }\n end",
"def addEval\n #puts \"hi student being evaluatied\"\n #puts params[:evaluation][:student_evaluated]\n #@team_member = User.find_by(u_name: params[:evaluation][:student_evaluated])\n @specific_user = User.find_by(u_name: params[:evaluation][:student_evaluating])\n @current_project = Project.find_by(p_name: params[:evaluation][:project])\n\n #puts \"start11\"\n #puts @team_member.inspect\n #puts @specific_user.inspect\n #puts @current_project.inspect\n\n # Klass.create subject: 'Maths', student: bart, tutor: edna\n # object = Student.new(:name => \"a\", :age => 2)\n @evaluation = Evaluation.new(student_evaluated: params[:evaluation][:student_evaluated], content: params[:evaluation][:content], rating: params[:evaluation][:rating], user: @specific_user, project: @current_project)\n puts \"hi2\"\n puts @evaluation.inspect\n #@evaluation = Evaluation.new(student_evaluated: @team_member.u_name, content: params[:content], \n #rating: params[:rating], user: @specific_user, project: @current_project)\n if @evaluation.save\n redirect_to userSpecificProjects_url\n #format.html { redirect_to evalAndSuccess_url(@evaluation), notice: 'Evaluation was successfully created.' }\n #format.json { render :evalAddSuccess, status: :created, location: @evaluation }\n else\n redirect_to userSpecificProjects_url\n #format.html { render :ratingPage_path(:team_member => @team_member.id) }\n end\n end",
"def create\n @evaluation = current_customer.customer_evaluations.new(evaluation_params)\n if params['clone'] == 'true'\n @evaluation = @evaluation.clone_last_evaluation\n @evaluation.name = params[:evaluation][:name]\n @evaluation.status = Evaluation::STATUSES.index(\"draft\")\n @evaluation.published_at = nil\n end\n\n if params[:testing] == 'true'\n @evaluation = Evaluation.sample_evaluation.clone_evaluation\n @evaluation.name = params[:evaluation][:name]\n @evaluation.status = Evaluation::STATUSES.index(\"draft\")\n @evaluation.published_at = nil\n @evaluation.distinguish_type = Evaluation::TYPES.index(:sandbox)\n end\n\n @evaluation.company_id = current_company.id\n @evaluation.customer_id = current_customer.id\n @evaluation.created_by = current_user.id\n\n respond_to do |format|\n if @evaluation.save\n @evaluation.create_default_evaluation_services if params['clone'] != 'true'\n format.html {redirect_to customer_evaluation_path(current_customer, @evaluation), notice: I18n.t('evaluations.messages.successfully_created')}\n format.json {render json: @evaluation, status: :created, location: @evaluation}\n else\n format.html {render action: \"new\"}\n format.json {render json: @evaluation.errors, status: :unprocessable_entity}\n end\n end\n end",
"def post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend",
"def create_score_using_post(score, opts = {})\n data, _status_code, _headers = create_score_using_post_with_http_info(score, opts)\n data\n end",
"def evaluation_params\n params.require(:evaluation).permit(:user_id, :project_id, :comment, :rating)\n end",
"def evaluation_params\n params.require(:evaluation).permit(:date, :time, :event, :name, :team, :parent, :email, :bodypart, :left, :right, :subjective, :visual, :palpation, :rom, :mmt, :neurological, :specialtests, :functionaltesting, :assessment, :plan, :rice, :taping, :mdreferral, :crutches, :instruction, :screen, :erreferral, :hospitalname, :notifiedparent, :whomnotified, :datetime)\n end",
"def evaluation_params\n params.require(:evaluation).permit(:candidate_id, :user_id, :attitude_id, :intention_id, :production_id, :localization_id, :comment, :boost)\n end",
"def evaluation_instance_params\n params.require(:evaluation_instance).permit(:title, :date, :passing_score, :top_score)\n end",
"def scores\n @title_page = 'Scores'\n $game.player.score = params['grade'].to_i\n\n @username = $game.player.username\n @score = $game.player.score\n\n response = Request.post_request(URL_SCORES, {\n username: $game.player.username,\n score: $game.player.score\n })\n\n @scores = Request.manage_response(response)\n\n erb :scores, layout: :template\nend",
"def score_params\n params.require(:score).permit!\n end",
"def create\n @evaluation = Evaluation.new(params[:evaluation])\n\n respond_to do |format|\n if @evaluation.save\n flash[:notice] = 'Evaluation was successfully created.'\n format.html { redirect_to(@evaluation) }\n format.xml { render :xml => @evaluation, :status => :created, :location => @evaluation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @evaluation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @analyst_score = AnalystScore.new(analyst_score_params)\n\n respond_to do |format|\n if @analyst_score.save\n format.html { redirect_to @analyst_score, notice: 'Analyst score was successfully created.' }\n format.json { render action: 'show', status: :created, location: @analyst_score }\n else\n format.html { render action: 'new' }\n format.json { render json: @analyst_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n scores = []\n # ?essays=true we use essays to predict scores.\n if params['essays']\n psu_date = DateTime.new(2017,11,27) # PSU DAY\n user_essays = current_user.essays.order(\"date_full ASC\")\n objectives = current_user.objectives\n [2,1,4,3].each do |s|\n completed = false\n subject_objective = objectives.select {|x| x.subject_id == s}.first # We get objective\n objective_score = subject_objective.nil? ? nil : subject_objective.score # We get objective score.\n essays = user_essays.select { |x| x.subject_id == s}\n if essays.length >= 4 # If there is enough essays we use a prediction.\n result = predict(essays,psu_date,s,objective_score)\n if result['r_score'] > 0.2 # Valid prediction.\n scores.append result['prediction']\n completed = true\n end\n elsif essays.length == 0 # If no essays we assume is not relevant to user.\n scores.append 0\n completed = true\n end\n unless completed\n if objective_score.nil? # If score doesnt have objective we assume is not relevant to user.\n scores.append 0\n else\n scores.append objective_score\n end\n end\n end\n # We add NEM to score array.\n scores += [current_user.nem]\n\n # ?essays=false we use objectives as scores.\n else\n scores = []\n objs = current_user.objectives\n [2,1,4,3].each do |i|\n obj = objs.select {|x| x.subject_id == i}\n if obj.first\n scores.append(obj.first.score)\n else\n scores.append(0)\n end\n end\n # We add NEM to score array.\n scores += [current_user.nem]\n end\n\n # Calculating area.\n\n #?area=compute\n if params['area'] == 'compute'\n areas = current_user.carreers.map {|x| x.area_id}\n # We get the ids of the two most frequent areas in user goals.\n areas = areas.map {|x| [x, areas.count(x)]}.uniq.sort_by {|x| x[1]}.reverse[0..1].map {|x| x[0]}\n else\n areas = [params['area'].to_i]\n end\n\n # Request for recommendations\n url = 'newton.tuniversidad.cl/get_recommendations' # Newton URL\n areas.each do |area|\n payload = {area_id:area,scores:[scores]}\n response = RestClient.post(url,payload.to_json, {content_type: :json, accept: :json})\n result_req = JSON.parse(response)\n # We create a recommendation object for each result.\n result_req['result'][\"0\"].each do |id|\n Recommendation.create do |rec|\n rec.user_id = current_user.id\n rec.carreer_id = id.to_i\n rec.liked = false\n rec.seen = false\n rec.area_id = area.to_i\n # We store params to use them on GET requests.\n rec.essay = params['essays']\n rec.computed_area = params['area'] == 'compute'\n end\n end\n end\n # Select a random subset of the created recs.\n result = random_select(current_user,RECS_NUMBER,params['essays'],params['area'])\n if result\n updater(result) # We set send recommendations to seen.\n render json:result, status:200\n else\n # IF random sampling fails we try with similar to he ones that have already been computed.\n sampled_area = areas.sample(1).first\n recs = Recommendation.where(user_id:current_user.id,liked:true,area_id: sampled_area.to_i)\n if recs.empty?\n recs = Recommendation.where(user_id:current_user.id,liked:false,area_id:sampled_area.to_i)\n end\n k = 5\n result = []\n while result.length < RECS_NUMBER\n recs.each do |rec|\n similars = request_similar([rec.carreer_id],k)\n similars[1...similars.length].each do |similar|\n new_rec = Recommendation.new do |new_rec|\n new_rec.user_id = current_user.id\n new_rec.carreer_id = similar\n new_rec.liked = false\n new_rec.seen = false\n new_rec.area_id = sampled_area.to_i\n new_rec.essay = params['essays']\n new_rec.computed_area = params['area'] == 'compute'\n end\n if new_rec.save\n result.append(new_rec)\n end\n end\n end\n k += 1\n end\n updater(result[0...RECS_NUMBER])\n render json:result[0...RECS_NUMBER], status:200\n end\n end",
"def evaluation_params\n params.permit(:evaluation, :evaluator_id, :evaluee_id, :project_id, :comment, :team_id)\n end",
"def enneagram_score_params\n params.require(:enneagram_score).permit(:user_id, :enneagram_one_score, :enneagram_two_score, :enneagram_three_score, :enneagram_four_score, :enneagram_five_score, :enneagram_six_score, :enneagram_seven_score, :enneagram_eight_score, :enneagram_nine_score)\n end",
"def create\n\t\t@product.latest_score.archieve unless !@product.is_assessed\n\t\t@product.assess unless @product.is_assessed\n\t\t@score = score_params.nil? ? @product.scores.new : @product.scores.new(score_params)\n\t\trespond_to do |format|\n\t\t\tif @score.save\n\t\t\t\tformat.html { redirect_to products_path, notice: {:type =>'success' ,:message => 'Score was successfully created.'}}\n\t\t\t\tformat.json { render :show, status: :created, location: @score }\n\t\t\telse\n\t\t\t\tformat.html { render :new, notice: {:type =>'danger', :message => 'Score failed to create.'} }\n\t\t\t\tformat.json { render json: @score.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def show\n @score = Evaluation.eval_post(@post)\n end",
"def create\n @course_evaluation = CourseEvaluation.new(course_evaluation_params)\n\n respond_to do |format|\n if @course_evaluation.save\n format.html { redirect_to @course_evaluation, notice: 'Course evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @course_evaluation }\n else\n format.html { render :new }\n format.json { render json: @course_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @enrolled_score = EnrolledScore.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @enrolled_score }\n end\n end",
"def evaluation_params\n params.require(:evaluation).permit(:employee_id, :task_id, :result, :comment, :image, :date)\n end",
"def score_params\n params.require(:score).permit(:key_name, :value, :view_number)\n end",
"def score_params\n params.require(:score).permit(:username, :quiz_id, :points)\n end",
"def evaluation_params\n params.require(:evaluation).permit(:title, :description)\n end",
"def score\n respond_to do |format|\n if @survey.score\n format.html { redirect_to edit_admins_thriver_path(@user), notice: 'Survey was successfully scored.' }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @game_score = GameScore.new(params[:game_score])\n\n respond_to do |format|\n if @game_score.save\n format.html { redirect_to @game_score, notice: 'Game score was successfully created.' }\n format.json { render json: @game_score, status: :created, location: @game_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @game_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @evaluation.update(evaluation_params)\n render :show, status: :ok\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def create\n @question_score = QuestionScore.new(question_score_params)\n\n respond_to do |format|\n if @question_score.save\n format.html { redirect_to @question_score, notice: 'Question score was successfully created.' }\n format.js { }\n format.json { render :show, status: :created, location: @question_score }\n else\n format.html { render :new }\n format.json { render json: @question_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def evaluation_params\n params.require(:evaluation).permit(:organization, :standard, :suitability, :funding, :assessment, :report)\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n @evaluation.group_id = params[:group_id]\n @evaluation.student_id = current_student.id\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to student_dashboard_path, notice: 'Evaluation was successfully created.' }\n format.json { render :show, status: :created, location: student_dashboard_path }\n else\n format.html { render :new }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dish_evaluation = DishEvaluation.new(dish_evaluation_params)\n\n respond_to do |format|\n if @dish_evaluation.save\n format.html { redirect_to @dish_evaluation, notice: 'Dish evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @dish_evaluation }\n else\n format.html { render :new }\n format.json { render json: @dish_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_score = StudentScore.new(student_score_params)\n\n respond_to do |format|\n if @student_score.save\n format.html { redirect_to @student_score, notice: 'Student score was successfully created.' }\n format.json { render :show, status: :created, location: @student_score }\n else\n format.html { render :new }\n format.json { render json: @student_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @employee = Employee.find(1)\n @performance_evaluation = @employee.performance_evaluations.build(performance_evaluation_params)\n #@performance_evaluation = PerformanceEvaluation.new(performance_evaluation_params)\n\n respond_to do |format|\n if @performance_evaluation.save\n format.html { redirect_to @performance_evaluation, notice: 'Performance evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @performance_evaluation }\n else\n format.html { render :new }\n format.json { render json: @performance_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_score(user_name)\n user_info = {user_name: user_name, score: @user_score}\n @user_score = 0\n post_to_url(@scores_conn, SCORES_KEY, user_info)\n end",
"def evals_questions evaluation_id\n call_path = \"evals/questions\"\n request = {\"evaluationID\": evaluation_id}.to_json\n data = build_post_data(request)\n perform_post(build_url(call_path), data)\n end",
"def simulate_test_score_params\n params.require(:score).permit(:examination_id, :student_id,:final_score,\n\n :cr_score,:math_score, :writing_score, :essay_writing_score,\n\n :course_a_score,:course_b_score,:course_c_score,:course_d_score,\n\n :stat_01,:stat_02,:stat_03,:stat_04,:stat_05,:stat_06,:stat_07,:stat_08,:stat_09,\n :stat_10,:stat_11,:stat_12,:stat_13,:stat_14,:stat_15,:stat_16,\n :hard_level1,:hard_level2,:hard_level3,:hard_level4,:hard_level5,\n\n score_details_attributes: [:id,:answer_result,:score_number,:section_question_id])\n end",
"def create\n @username_score = UsernameScore.new(params[:username_score])\n\n respond_to do |format|\n if @username_score.save\n format.html { redirect_to @username_score, notice: 'Username score was successfully created.' }\n format.json { render json: @username_score, status: :created, location: @username_score }\n else\n format.html { render action: \"new\" }\n format.json { render json: @username_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evaluation = Evaluation.new(evaluation_params)\n @evaluation.course = @course\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to course_evaluations_url, notice: 'La evaluacion fue creada correctamente!' }\n else\n format.html { render :new }\n end\n end\n end",
"def score_params\n params.require(:score).permit(:event)\n end",
"def evaluation_params\n params.require(:evaluation).permit(:title, :min_grade, :date, :course_id, grades_attributes: [:id, :grade,:student,:evaluation, :_destroy])\n end",
"def score_params\n params.require(:score).permit(:score, :user_id)\n end",
"def index\n @evaluations = Evaluation.all\n @evaluation = Evaluation.new\n end",
"def evaluation_params\n params.require(:evaluation).permit(:moyenne, :annee_scolaire, :matiere, :periode, :coefficient)\n end",
"def index\n @evaluates = Evaluate.all\n end"
] |
[
"0.7332654",
"0.67077494",
"0.6616827",
"0.64930874",
"0.64740974",
"0.64423674",
"0.6432431",
"0.637621",
"0.63749444",
"0.6361069",
"0.63250655",
"0.62867385",
"0.62867385",
"0.62663",
"0.62436855",
"0.62362534",
"0.62195516",
"0.6217482",
"0.6213327",
"0.615658",
"0.61481506",
"0.6143263",
"0.6136733",
"0.6133832",
"0.6132771",
"0.6131266",
"0.61145496",
"0.61092454",
"0.6108887",
"0.6101877",
"0.61014426",
"0.60835385",
"0.60713273",
"0.6060785",
"0.6060785",
"0.604715",
"0.6045975",
"0.6045975",
"0.60376084",
"0.6032732",
"0.6014299",
"0.6014299",
"0.5995294",
"0.5992754",
"0.5989319",
"0.5977824",
"0.5975521",
"0.59408736",
"0.5936672",
"0.5915615",
"0.5913413",
"0.59017557",
"0.58964926",
"0.58872074",
"0.5885382",
"0.5874566",
"0.58731127",
"0.5870156",
"0.5865099",
"0.58514047",
"0.5838521",
"0.5838228",
"0.58264405",
"0.58253616",
"0.58240134",
"0.580973",
"0.5804746",
"0.5787417",
"0.57874024",
"0.5785225",
"0.57795143",
"0.5773804",
"0.5768155",
"0.57674205",
"0.5757228",
"0.5754522",
"0.5742892",
"0.57390624",
"0.5736468",
"0.5712733",
"0.57082903",
"0.5705062",
"0.5693095",
"0.5687346",
"0.5683026",
"0.567917",
"0.5677238",
"0.5660277",
"0.5650038",
"0.564891",
"0.5636211",
"0.5626713",
"0.56246084",
"0.5618722",
"0.5613315",
"0.5609014",
"0.56062406",
"0.56053126",
"0.5599602",
"0.55967736"
] |
0.68660045
|
1
|
PUT /score_evaluations/1 PUT /score_evaluations/1.json
|
def update
@score_evaluation = ScoreEvaluation.find(params[:id])
params[:score_evaluation][:discipline_ids] ||= []
respond_to do |format|
if @score_evaluation.update_attributes(params[:score_evaluation])
format.html { redirect_to @score_evaluation, :notice => t('selecao_admin.flash_messages.successfully_updated', :model => @score_evaluation.class.model_name.human) }
format.json { head :no_content }
format.js
else
format.html { render :action => "edit" }
format.json { render :json => @score_evaluation.errors, :status => :unprocessable_entity }
format.js
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n # ToDo: 名前の変更\n score = params[:score]\n \n\n if @evaluation.update_attributes(score: score)\n render :show, status: :ok, location: @evaluation\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def update_score\n question_params = params.require(:question).permit(:id, :score)\n\n render json: Question.update_score(question_params)\n end",
"def update\n if @evaluation.update(evaluation_params)\n render :show, status: :ok\n else\n render json: @evaluation.errors, status: :unprocessable_entity\n end\n end",
"def update\n if ENV[\"NEW_EVALUATION\"] == nil\n raise ActionController::RoutingError\n return\n end\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n unless @submission.evaluated.blank?\n respond_to do |format|\n format.html { redirect_to test_submission_path(@test, @submission), info: \"Evaluated!\" }\n end\n return\n end\n\n unless Time.now > @timeout + 5.seconds\n @submission.answers_of_questions.each do |user_answer|\n user_answer.update(choice: submission_params.fetch(user_answer.answer_id.to_s, \"false\"))\n end\n end\n if Time.now > @timeout || params[:evaluate]\n @test.questions.each do |question|\n crrct = get_result(question)\n @submission.increment!(:point, question.point) if crrct\n @submission.question_evaluations.create({question_id: question.id, value: crrct})\n end\n @submission.update(evaluated: true)\n respond_to do |format|\n format.html { redirect_to test_submission_path(@test, @submission) }\n end\n else\n respond_to do |format|\n format.html { redirect_to submissions_path, success: 'Submission was successfully saved.' }\n end\n end\n\n end",
"def update\n @enrolled_score = EnrolledScore.find(params[:id])\n \n respond_to do |format|\n if @enrolled_score.update_attributes(params[:enrolled_score])\n format.html { redirect_to @enrolled_score, :notice => t('selecao_admin.flash_messages.successfully_updated', :model => @enrolled_score.class.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @enrolled_score.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_score\n if @submission.intest && @submission.score != -1\n @submission.score = params[:new_score].to_i\n @submission.save\n end\n redirect_to problem_path(@problem, :sub => @submission)\n end",
"def update\n respond_to do |format|\n if @evaluate.update(evaluate_params)\n format.html { redirect_to @evaluate, notice: 'Evaluate was successfully updated.' }\n format.json { render :show, status: :ok, location: @evaluate }\n else\n format.html { render :edit }\n format.json { render json: @evaluate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: \"Evaluation was successfully updated.\" }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { render :show, status: :ok, location: @score }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { render :show, status: :ok, location: @score }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { render :show, status: :ok, location: @score }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to @score, notice: 'Score was successfully updated.' }\n format.json { render :show, status: :ok, location: @score }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'La evaluación fue actualizada correctamente' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @evaluation.update(evaluation_params)\n flash[:success] = 'Actualizado correctamente'\n redirect_to evaluations_url\n else\n flash[:danger] = 'Ocurrió un error'\n render :edit\n end\n end",
"def update\n if @evaluation.update(evaluation_params)\n redirect_to action: \"index\", notice: 'Evaluation was successfully updated.' \n else\n render :edit \n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Avaliação atualizada.' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n course = Course.find(params[:course_id])\n test = Test.find(params[:test_id])\n respond_to do |format|\n begin\n puts params[:absent].nil?\n i = 0\n Score.where(test: test).each do |score|\n if !score.update(value: (params[:\"absent#{i}\"]? -2 : params[:\"score-input#{i}\"]))\n raise\n end\n i += 1\n end\n rescue => exception\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n else\n format.html { redirect_to course_test_scores_path(course, test), notice: 'Scores were successfully updated.' }\n format.json { render :show, status: :ok, location: course_test_scores_path(course, test) }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to result_url(@evaluation), notice: \"\" }\n format.json { redirect_to result_url(@evaluation) }\n #else\n # format.html { render :edit }\n # format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @five_score.update(five_score_params)\n format.html { redirect_to @five_score, notice: 'Five score was successfully updated.' }\n format.json { render :show, status: :ok, location: @five_score }\n else\n format.html { render :edit }\n format.json { render json: @five_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @request_score.update(request_score_params)\n format.html { redirect_to @request_score, notice: 'Request score was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_score }\n else\n format.html { render :edit }\n format.json { render json: @request_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to course_evaluations_url, notice: 'La evaluación fue modificada correctamente!' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n @evaluation = Evaluation.find(params[:id])\n\n respond_to do |format|\n if @evaluation.update_attributes(params[:evaluation])\n format.html { redirect_to @evaluation, notice: 'Avaliacao atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @score.update(simulate_test_score_params)\n\n\n format.html { redirect_to examination_scores_path(@examination),notice: '学员成绩己记录.' }\n format.json { render :show, status: :ok, location: @score }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n @practice = Practice.find(@evaluation.practice_id)\n if @practice.answer == @evaluation.your_answer\n @justice = Justice.create!(\n user_id: 1,\n evaluation_user_id: @evaluation.user_id,\n practice_id: @evaluation.practice_id,\n\t evaluation_id: @evaluation.id,\n\t score: @evaluation.practice_score, # 得到满分\n\t p_score: @evaluation.practice_score,\n remark: \"完全正确!\",\n )\n @evaluation.update(score: @evaluation.practice_score)\n end\n format.html { redirect_to @evaluation, notice: \"答案更新成功\" }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @evaluation = Evaluation.find(params[:id])\n\n respond_to do |format|\n if @evaluation.update_attributes(params[:evaluation])\n format.html { redirect_to(@evaluation, :notice => 'Evaluation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evaluation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @evaluacion = Evaluacion.find(params[:id])\n\n respond_to do |format|\n if @evaluacion.update_attributes(params[:evaluacion])\n format.html { redirect_to @evaluacion, notice: 'Evaluacion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @challenge_score.update(challenge_score_params)\n format.html { redirect_to @challenge_score, notice: 'Challenge score was successfully updated.' }\n format.json { render :show, status: :ok, location: @challenge_score }\n else\n format.html { render :edit }\n format.json { render json: @challenge_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scoring_method = ScoringMethod.find(params[:id])\n\n respond_to do |format|\n if @scoring_method.update_attributes(params[:scoring_method])\n format.html { redirect_to @scoring_method, notice: 'Scoring method was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scoring_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @analyst_score.update(analyst_score_params)\n format.html { redirect_to @analyst_score, notice: 'Analyst score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @analyst_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @score\n\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to :back, notice: 'Score was successfully updated.' }\n format.json { render :show, status: :ok, location: @score }\n format.js { render :update_rubric }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @evaluation = Evaluation.find(params[:id])\n\n respond_to do |format|\n if @evaluation.update_attributes(params[:evaluation])\n flash[:notice] = 'Evaluation was successfully updated.'\n format.html { redirect_to(@evaluation) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evaluation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_score!(points)\n increment!(:score, points)\n end",
"def update\n respond_to do |format|\n if @performance_evaluation.update(performance_evaluation_params)\n format.html { redirect_to @performance_evaluation, notice: 'Performance evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @performance_evaluation }\n else\n format.html { render :edit }\n format.json { render json: @performance_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student_goal_evaluation.update(student_goal_evaluation_params)\n format.html { redirect_to root_path, notice: 'Evalueringen er opdateret.' }\n format.json { render :show, status: :ok, location: @student_goal_evaluation }\n else\n format.html { render :edit }\n format.json { render json: @student_goal_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @score = args[:score] if args.key?(:score)\n end",
"def update!(**args)\n @score = args[:score] if args.key?(:score)\n end",
"def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n format.html { redirect_to(@score, :notice => 'Score was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @score.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @eval = Eval.find(params[:id])\n if @eval.update_attributes(params[:eval])\n flash[:notice] = \"Eval was successfully updated.\"\n respond_with(@eval)\n else\n respond_with(@eval.errors)\n end\n end",
"def update\r\n respond_to do |format|\r\n if @evaluacione.update(evaluacione_params)\r\n format.html { redirect_to @evaluacione, notice: 'Evaluacione was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @evaluacione }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @evaluacione.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def save_score\n @round = Round.find(params[:id])\n @round.update_attributes(params[:round])\n redirect_to round_result_path(@round.id)\n end",
"def set_score\n @score = Score.find(params[:id])\n end",
"def set_score\n @score = Score.find(params[:id])\n end",
"def set_score\n @score = Score.find(params[:id])\n end",
"def set_score\n @score = Score.find(params[:id])\n end",
"def set_score\n @score = Score.find(params[:id])\n end",
"def set_score\n @score = Score.find(params[:id])\n end",
"def set_score\n @score = Score.find(params[:id])\n end",
"def set_score\n @score = Score.find(params[:id])\n end",
"def set_score\n @score = Score.find(params[:id])\n end",
"def set_score\n @score = Score.find(params[:id])\n end",
"def set_score\n @score = Score.find(params[:id])\n end",
"def update\n @review = Employee.find(params[:id])\n\n respond_to do |format|\n @review.reviewed = true; @review.score = params[:employee][:score];\n if @review.save\n format.html { redirect_to admin_reviews_path, notice: 'Review was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evaluo.update(evaluo_params)\n format.html { redirect_to @evaluo, notice: 'Evaluo was successfully updated.' }\n format.json { render :show, status: :ok, location: @evaluo }\n else\n format.html { render :edit }\n format.json { render json: @evaluo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @score_ratio = args[:score_ratio] if args.key?(:score_ratio)\n end",
"def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n flash[:notice] = 'Score was successfully updated.'\n format.html { redirect_to(@score) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @score.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_score.update(user_score_params)\n format.html { redirect_to @user_score, notice: 'User score was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_score }\n else\n format.html { render :edit }\n format.json { render json: @user_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @high_score = HighScore.find(params[:id])\n\n respond_to do |format|\n if @high_score.update_attributes(params[:high_score])\n format.html { redirect_to @high_score, notice: 'High score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @high_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_score\n @score = Score.find(params[:id])\n end",
"def update!(**args)\n @score = args[:score] if args.key?(:score)\n @trusted_name_confidence = args[:trusted_name_confidence] if args.key?(:trusted_name_confidence)\n end",
"def score\n respond_to do |format|\n if @survey.score\n format.html { redirect_to edit_admins_thriver_path(@user), notice: 'Survey was successfully scored.' }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game_score = GameScore.find(params[:id])\n\n respond_to do |format|\n if @game_score.update_attributes(params[:game_score])\n format.html { redirect_to @game_score, notice: 'Game score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_exam_score\n @exam = Exam.shod(params[:id])\n @exam_group = @exam.exam_group\n @batch = @exam_group.batch\n grades = @exam.exam_group.batch.grading_levels.order(min_score: :asc)\n @temps = params[:exams][:exam]\n @exam.score_exam(@temps, @batch, @exam, @exam_group, grades)\n exam\n end",
"def update!(**args)\n @experimental_title_salient_terms_score = args[:experimental_title_salient_terms_score] if args.key?(:experimental_title_salient_terms_score)\n @leadingtext_distance_score = args[:leadingtext_distance_score] if args.key?(:leadingtext_distance_score)\n @meta_boost_score = args[:meta_boost_score] if args.key?(:meta_boost_score)\n @salient_position_boost_score = args[:salient_position_boost_score] if args.key?(:salient_position_boost_score)\n @salient_terms_score = args[:salient_terms_score] if args.key?(:salient_terms_score)\n @schema_org_description_boost_score = args[:schema_org_description_boost_score] if args.key?(:schema_org_description_boost_score)\n @unstable_tokens_score = args[:unstable_tokens_score] if args.key?(:unstable_tokens_score)\n end",
"def update_exam_score\n @exam = Exam.shod(params[:id])\n @exam_group = @exam.exam_group\n @batch = @exam_group.batch\n @exam.update_exam_scr(@exam, @exam_group, @batch, params[:exams][:exam])\n redirect_to previous_exam_scores_exam_groups_path(@exam.id)\n end",
"def update!(**args)\n @model_evaluations = args[:model_evaluations] if args.key?(:model_evaluations)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update\n respond_to do |format|\n if @question_score.update(question_score_params)\n format.html { redirect_to @question_score, notice: 'Question score was successfully updated.' }\n format.js { }\n format.json { render :show, status: :ok, location: @question_score }\n else\n format.html { render :edit }\n format.json { render json: @question_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @evaluation.update(evaluation_params)\n flash[:success] = 'Evaluación actualizada con éxito.'\n else\n flash[:danger] = @evaluation.errors.full_messages.to_sentence\n end\n\n redirect_back fallback_location: evaluations_path\n end",
"def update\n respond_to do |format|\n \n if @evaluation.update(evaluation_params)\n if params[:evaluation][:grades_attributes].present?\n @evaluation.set_grade=true\n @evaluation.save\n end\n format.html { redirect_to course_evaluation_path(@course,@evaluation), notice: 'La evaluación fue actualizada con éxito.' }\n format.json { render :show, status: :ok, location: @evaluation }\n else\n if params[:evaluation][:grades_attributes].present?\n format.html { render :show }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n else\n format.html { render :edit }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @course_evaluation.update(course_evaluation_params)\n format.html { redirect_to @course_evaluation, notice: 'Course evaluation was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_evaluation }\n else\n format.html { render :edit }\n format.json { render json: @course_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rating_score.update(rating_score_params)\n format.html { redirect_to @rating_score, notice: 'Rating score was successfully updated.' }\n format.json { render :show, status: :ok, location: @rating_score }\n else\n format.html { render :edit }\n format.json { render json: @rating_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @result_entity_score = args[:result_entity_score] if args.key?(:result_entity_score)\n end",
"def evaluation_params\n params.require(:evaluation).permit(:score, :comment, :project_id, :team_member_id)\n end",
"def update!(**args)\n @score_type = args[:score_type] if args.key?(:score_type)\n @score_value = args[:score_value] if args.key?(:score_value)\n end",
"def update\n @evaluacione = Evaluacione.find(params[:id])\n\n respond_to do |format|\n if @evaluacione.update_attributes(params[:evaluacione])\n format.html { redirect_to(@evaluacione, :notice => 'Evaluacione was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evaluacione.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_question_score\n @question_score = QuestionScore.find(params[:id])\n end",
"def update\n @submission = Submission.find(params[:id])\n\n respond_to do |format|\n if @submission.update_attributes(params[:submission])\n flag = true\n @submission.score = 0 \n @submission.submitted_answers.each do |answer|\n if answer.points\n @submission.score += answer.points\n flag = false\n end\n end\n if flag == true\n @submission.score=nil\n end\n @submission.save\n format.html { redirect_to @submission, notice: 'Submission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @response_to_the_evaluation = ResponseToTheEvaluation.find(params[:id])\n @response_to_the_evaluation.save\n respond_to do |format|\n if @response_to_the_evaluation.save\n format.json\n format.js\n end\n end\n end",
"def update\n @username_score = UsernameScore.find(params[:id])\n\n respond_to do |format|\n if @username_score.update_attributes(params[:username_score])\n format.html { redirect_to @username_score, notice: 'Username score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @username_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student_score.update(student_score_params)\n format.html { redirect_to @student_score, notice: 'Student score was successfully updated.' }\n format.json { render :show, status: :ok, location: @student_score }\n else\n format.html { render :edit }\n format.json { render json: @student_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @evaluationstatus = Evaluationstatus.find(params[:id])\n\n respond_to do |format|\n if @evaluationstatus.update_attributes(params[:evaluationstatus])\n format.html { redirect_to @evaluationstatus, notice: 'Evaluation status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluationstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def evaluation_params\n params.require(:evaluation).permit(:course_id, :professor_id, :course_score, :teacher_score)\n end",
"def update\n @test_score = @participant.test_scores.find(params[:id])\n @test_score.test_type_id = params[:test_score][:test_type_id]\n @test_score.test_type.reload\n @test_score.add_section_score_attribute_methods\n\n respond_to do |format|\n if @test_score.update_attributes(params[:test_score])\n flash[:notice] = 'TestScore was successfully updated.'\n format.html { redirect_to participant_path(@participant, :anchor => \"!/section/test_scores\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_score.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @foreign_meta_score = args[:foreign_meta_score] if args.key?(:foreign_meta_score)\n @hidden_ratio_score = args[:hidden_ratio_score] if args.key?(:hidden_ratio_score)\n @num_tidbits_score = args[:num_tidbits_score] if args.key?(:num_tidbits_score)\n @num_visible_tokens_score = args[:num_visible_tokens_score] if args.key?(:num_visible_tokens_score)\n @outlink_score = args[:outlink_score] if args.key?(:outlink_score)\n @redundancy_score = args[:redundancy_score] if args.key?(:redundancy_score)\n @sentence_start_score = args[:sentence_start_score] if args.key?(:sentence_start_score)\n end",
"def update\n @score.user = current_user\n respond_to do |format|\n if @score.update(score_params)\n format.html { redirect_to @score.goal, notice: 'Score was successfully updated.' }\n format.json { render :show, status: :ok, location: @score.goal }\n else\n format.html { render :edit }\n format.json { render json: @score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @evaluation_sheet = EvaluationSheet.find(params[:id])\n\n respond_to do |format|\n if @evaluation_sheet.update_attributes(params[:evaluation_sheet])\n format.html { redirect_to @evaluation_sheet, notice: 'Evaluation sheet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluation_sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.find(params[:id])\n\n respond_to do |format|\n if @competency_pertenece_evaluation.update_attributes(params[:competency_pertenece_evaluation])\n format.html { redirect_to @competency_pertenece_evaluation, notice: 'Competency pertenece evaluation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @competency_pertenece_evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @highscore.update(highscore_params)\n format.html { redirect_to @highscore, flash: { info: 'Highscore was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @highscore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @score_evaluations = ScoreEvaluation.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @score_evaluations }\n end\n end",
"def update\n @score = Score.find(params[:id])\n\n respond_to do |format|\n if @score.update_attributes(params[:score])\n#\tif @score.update_attributes( :image=> params[:score] )\n format.html { redirect_to @score, :notice => 'Score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @score.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7260799",
"0.67114663",
"0.6629903",
"0.65614665",
"0.64909816",
"0.6460522",
"0.64427364",
"0.6435706",
"0.6433818",
"0.64332044",
"0.643314",
"0.643314",
"0.643314",
"0.6429852",
"0.6429852",
"0.6429852",
"0.6428169",
"0.64125896",
"0.64125896",
"0.64125896",
"0.64125896",
"0.640876",
"0.640876",
"0.6371401",
"0.6300488",
"0.6291067",
"0.62882763",
"0.6278634",
"0.625525",
"0.6252277",
"0.6249073",
"0.6227805",
"0.6206011",
"0.61850697",
"0.61793035",
"0.6174801",
"0.61666846",
"0.6164141",
"0.615387",
"0.61519223",
"0.6151245",
"0.6150669",
"0.61187965",
"0.611601",
"0.6105426",
"0.6072778",
"0.6072778",
"0.6068525",
"0.60682833",
"0.6066918",
"0.6062141",
"0.60595125",
"0.60595125",
"0.60595125",
"0.60595125",
"0.60595125",
"0.60595125",
"0.60595125",
"0.60595125",
"0.60595125",
"0.60595125",
"0.60595125",
"0.6058718",
"0.60383666",
"0.6019703",
"0.6016047",
"0.6015523",
"0.60132366",
"0.6012461",
"0.6005352",
"0.60022086",
"0.59954834",
"0.59902924",
"0.5981628",
"0.5966676",
"0.596121",
"0.5959095",
"0.59540963",
"0.5953097",
"0.59525573",
"0.5949721",
"0.5946171",
"0.59401125",
"0.5938551",
"0.59331197",
"0.5932474",
"0.5928069",
"0.5925427",
"0.5924309",
"0.5920731",
"0.5908813",
"0.59087795",
"0.59043705",
"0.59027284",
"0.5899282",
"0.5896905",
"0.5888996",
"0.5886575",
"0.58833426",
"0.5873398"
] |
0.6244234
|
31
|
DELETE /score_evaluations/1 DELETE /score_evaluations/1.json
|
def destroy
@score_evaluation = ScoreEvaluation.find(params[:id])
@score_evaluation.destroy
respond_to do |format|
format.html { redirect_to score_evaluations_url }
format.json { head :no_content }
format.js
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to examination_scores_url, notice: 'Simulate test score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation = Evaluation.find(params[:id])\n @evaluation.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @analyst_score.destroy\n respond_to do |format|\n format.html { redirect_to analyst_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url, notice: 'evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluacion = Evaluacion.find(params[:id])\n @evaluacion.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluaciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score = Score.find(params[:id])\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_goal_evaluation.destroy\n respond_to do |format|\n format.html { redirect_to student_goal_evaluations_url, notice: 'Evalueringen er slettet.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url, notice: 'Evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url, notice: 'Evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url, notice: 'Evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url, notice: 'Evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url, notice: 'Evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url, notice: 'Evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url, notice: 'Avaliação deletada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url, notice: 'La evaluación fue eliminada satisfactoriamente' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_score.destroy\n respond_to do |format|\n format.html { redirect_to request_scores_url, notice: 'Request score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluate.destroy\n respond_to do |format|\n format.html { redirect_to evaluates_url, notice: 'Evaluate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @qc_evaluation = QcEvaluation.find(params[:id])\n @qc_evaluation.destroy\n\n respond_to do |format|\n format.html { redirect_to qc_evaluations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url, notice: '答题记录已被删除' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation_result = EvaluationResult.find(params[:id])\n @evaluation_result.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluation_results_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to @score.goal, notice: 'Score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation_criterium = EvaluationCriterium.find(params[:id])\n @evaluation_criterium.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluation_criteria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competency_pertenece_evaluation = CompetencyPerteneceEvaluation.find(params[:id])\n @competency_pertenece_evaluation.destroy\n\n respond_to do |format|\n format.html { redirect_to competency_pertenece_evaluations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation = Evaluation.find(params[:id])\n @evaluation.destroy\n\n respond_to do |format|\n format.html { redirect_to(evaluations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @evaluation = Evaluation.find(params[:id])\n @evaluation.destroy\n\n respond_to do |format|\n format.html { redirect_to(evaluations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @evaluationstatus = Evaluationstatus.find(params[:id])\n @evaluationstatus.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluationstatuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluare = Evaluare.find(params[:id])\n @evaluare.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluares_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluable_competency = EvaluableCompetency.find(params[:id])\n @evaluable_competency.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluable_competencies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_subject_evaluation = @test_subject.test_subject_evaluations.find(params[:id])\n @test_subject_evaluation.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_subject_test_subject_evaluations_url(@test_subject)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @enrolled_score = EnrolledScore.find(params[:id])\n @enrolled_score.destroy\n \n respond_to do |format|\n format.html { redirect_to enrolled_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aja_score = AjaScore.find(params[:id])\n @aja_score.destroy\n\n respond_to do |format|\n format.html { redirect_to aja_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url, notice: 'Score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url, notice: 'Score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url, notice: 'Score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url, notice: 'Score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @evaluation = Evaluation.find(params[:id])\r\n @evaluation.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(evaluations_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n # @scoring_method = ScoringMethod.find(params[:id])\n # @scoring_method.destroy\n\n respond_to do |format|\n format.html { redirect_to scoring_methods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @performance_evaluation.destroy\n respond_to do |format|\n format.html { redirect_to performance_evaluations_url, notice: 'Performance evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n entry = @evaluation.entry\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url, notice: 'Evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rcrieval = Rcrieval.find(params[:id])\n @rcrieval.destroy\n\n respond_to do |format|\n format.html { redirect_to rcrievals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_score = GameScore.find(params[:id])\n @game_score.destroy\n\n respond_to do |format|\n format.html { redirect_to game_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @five_score.destroy\n respond_to do |format|\n format.html { redirect_to five_scores_url, notice: 'Five score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dish_evaluation.destroy\n respond_to do |format|\n format.html { redirect_to dish_evaluations_url, notice: 'Dish evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluator.destroy\n\n respond_to do |format|\n format.html { redirect_to(evaluators_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test_score = @participant.test_scores.find(params[:id])\n @test_score.destroy\n\n respond_to do |format|\n format.html { redirect_to participant_path(@participant, :anchor => \"!/section/test_scores\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url, notice: 'Evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to(scores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @score = Score.find(params[:id])\n @score.destroy\n\n respond_to do |format|\n format.html { redirect_to(scores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @score.destroy\n end",
"def destroy\n @highscore.destroy\n respond_to do |format|\n format.html { redirect_to highscores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluacione = Evaluacione.find(params[:id])\n @evaluacione.destroy\n\n respond_to do |format|\n format.html { redirect_to(evaluaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rating_score.destroy\n respond_to do |format|\n format.html { redirect_to rating_scores_url, notice: 'Rating score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score_general.destroy\n respond_to do |format|\n format.html { redirect_to score_generals_url, notice: 'Score general was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @score_query.destroy\n # respond_to do |format|\n # format.html { redirect_to phone_score_queries_url, notice: 'Score query was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n # @score_query.destroy\n # respond_to do |format|\n # format.html { redirect_to phone_score_queries_url, notice: 'Score query was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n authorize @score\n @score.destroy\n respond_to do |format|\n format.html { redirect_to scores_url, notice: 'Score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @high_score = HighScore.find(params[:id])\n @high_score.destroy\n\n respond_to do |format|\n format.html { redirect_to high_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @high_score = HighScore.find(params[:id])\n @high_score.destroy\n\n respond_to do |format|\n format.html { redirect_to high_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to course_evaluations_url, notice: 'La evaluación fue eliminada correctamente!' }\n end\n end",
"def destroy\n @scoring_scale = ScoringScale.find(params[:id])\n @scoring_scale.destroy\n\n respond_to do |format|\n format.html { redirect_to scoring_scales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n end",
"def destroy\n @box_score_entry.destroy\n respond_to do |format|\n format.html { redirect_to box_score_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ability_score = AbilityScore.find(params[:id])\n @ability_score.destroy\n\n respond_to do |format|\n format.html { redirect_to(ability_scores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @criterion_grade.destroy\n respond_to do |format|\n format.html { redirect_to criterion_grades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluo.destroy\n respond_to do |format|\n format.html { redirect_to evaluos_url, notice: 'Evaluo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @home_score.destroy\n respond_to do |format|\n format.html { redirect_to home_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @four_score.destroy\n respond_to do |format|\n format.html { redirect_to four_scores_url, notice: 'Four score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @username_score = UsernameScore.find(params[:id])\n @username_score.destroy\n\n respond_to do |format|\n format.html { redirect_to username_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant_evaluation.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_evaluations_url, notice: 'Restaurant evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_scores\n end",
"def destroy\n @course_evaluation.destroy\n respond_to do |format|\n format.html { redirect_to course_evaluations_url, notice: 'Course evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @evaluacione.destroy\r\n respond_to do |format|\r\n format.html { redirect_to evaluaciones_url, notice: 'Evaluacione was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @evaluation.destroy\n flash[:success] = 'Eliminado correctamente'\n redirect_to evaluations_url\n end",
"def destroy\n @student_score.destroy\n respond_to do |format|\n format.html { redirect_to student_scores_url, notice: 'Student score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @psicologic_evaluation.destroy\n respond_to do |format|\n format.html { redirect_to psicologic_evaluations_url, notice: 'Psicologic evaluation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seven_score.destroy\n respond_to do |format|\n format.html { redirect_to seven_scores_url, notice: 'Seven score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @record_score.destroy\n respond_to do |format|\n format.html { redirect_to record_scores_url, notice: 'Record score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_score.destroy\n respond_to do |format|\n format.html { redirect_to user_scores_url, notice: 'User score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_to do |format|\n if @evaluation.destroy\n format.html { redirect_to course_evaluations_path(@course), notice: 'La evaluación fue eliminada con éxito.' }\n format.json { head :no_content }\n else\n format.html { render :show }\n format.json { render json: @evaluation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @three_score.destroy\n respond_to do |format|\n format.html { redirect_to three_scores_url, notice: 'Three score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transit_score = TransitScore.find(params[:id])\n @transit_score.destroy\n\n respond_to do |format|\n format.html { redirect_to transit_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation_sheet = EvaluationSheet.find(params[:id])\n @evaluation_sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluation_sheets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n redirect_to action: \"index\", notice: 'Evaluation was successfully destroyed.' \n end",
"def destroy\n @evaluation.destroy\n\n respond_to do |format|\n format.html {redirect_to customer_path(current_customer)}\n format.json {head :no_content}\n end\n end",
"def destroy\n @eval = Eval.find(params[:id])\n @eval.destroy\n redirect_to(evals_url)\n end",
"def destroy\n @accuracy = Accuracy.find(params[:id])\n @accuracy.destroy\n\n respond_to do |format|\n format.html { redirect_to accuracies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @two_score.destroy\n respond_to do |format|\n format.html { redirect_to two_scores_url, notice: 'Two score was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score_history.destroy\n respond_to do |format|\n format.html { redirect_to admin_score_histories_url, notice: '积分历史删除成功.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classpersonscore.destroy\n respond_to do |format|\n format.html { redirect_to classpersonscores_url, notice: 'Classpersonscore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @box_score = BoxScore.find(params[:id])\n @box_score.destroy\n\n respond_to do |format|\n format.html { redirect_to box_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score_sheet = ScoreSheet.find(params[:id])\n @score_sheet.destroy\n\n respond_to do |format|\n format.html { redirect_to score_sheets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @score_paper.destroy\n respond_to do |format|\n format.html { redirect_to score_papers_url, notice: 'Score paper was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @anstoeval.destroy\n respond_to do |format|\n format.html { redirect_to anstoevals_url, notice: 'anstoeval was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.73572135",
"0.73572135",
"0.7300002",
"0.7240983",
"0.72230655",
"0.71482706",
"0.7110597",
"0.7079376",
"0.70701236",
"0.70690894",
"0.70690894",
"0.70690894",
"0.70690894",
"0.70687413",
"0.7065726",
"0.7065726",
"0.7065726",
"0.7065726",
"0.7065726",
"0.7065726",
"0.7061861",
"0.7061591",
"0.70388436",
"0.7014215",
"0.7007289",
"0.6982662",
"0.69497854",
"0.69471633",
"0.6938101",
"0.6935929",
"0.6931034",
"0.6931034",
"0.6930586",
"0.69272697",
"0.6918451",
"0.6914141",
"0.6913042",
"0.6909894",
"0.6907954",
"0.6907954",
"0.6907954",
"0.6907954",
"0.6895255",
"0.688637",
"0.68844014",
"0.6862559",
"0.68579346",
"0.68554235",
"0.68472546",
"0.68385243",
"0.6814752",
"0.6808033",
"0.6798505",
"0.679237",
"0.679237",
"0.6776419",
"0.6749138",
"0.6735742",
"0.67323846",
"0.6722261",
"0.67217726",
"0.67217594",
"0.67138845",
"0.6687871",
"0.6687871",
"0.668221",
"0.66804326",
"0.667405",
"0.666681",
"0.6664189",
"0.6658996",
"0.66561586",
"0.66484815",
"0.6648351",
"0.6636271",
"0.66254014",
"0.66170913",
"0.6615373",
"0.6604772",
"0.6602828",
"0.6591159",
"0.65823764",
"0.65798134",
"0.6570984",
"0.6570802",
"0.65636325",
"0.6562412",
"0.65542924",
"0.65539646",
"0.6545288",
"0.6541336",
"0.6539181",
"0.65276045",
"0.65048546",
"0.65006804",
"0.64853245",
"0.64841354",
"0.6479613",
"0.64780664",
"0.6475534"
] |
0.74119717
|
0
|
Return string that describes year, make, and model, and optional submod.
|
def ymmText
ans = date_of_manufacture
ans += ' ' + make.name
if model
ans += ' ' + model.name
end
if submodel
ans += ' ' + submodel.name
end
return ans
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def info\n @model + \" \" + @year\n end",
"def name\n return \"#{year.to_s} #{make.name} #{model.name}\"\n end",
"def vehicle_details\n \"#{year} #{make} #{model}\"\n end",
"def to_s\n txt = name\n txt += \" (#{self.year})\" if self.year && self.year > 0\n return txt\n end",
"def inspect\n \"the year is \" + humanize_list(@parts)\n end",
"def carInfo\n return \"Make: #{@make}, Model Year: #{@model_year}, Wheels: #{@wheels}\"\n end",
"def to_s\r\n \"#{@major}.#{@minor}\"\r\n end",
"def year_name(number); end",
"def build_header_year\n \"#{begin_date.year}/#{end_date.year}\"\n end",
"def to_s\n \"#{@major}.#{@minor}.#{@update} Build #{@build}\"\n end",
"def to_s\n \"The vehicles's model is #{model}, the year it's from is #{year}, and \"\\\n \"the color is #{color}.\"\n end",
"def to_name\n \"#{MAJOR}_#{MINOR}_#{REVISION}\"\n end",
"def to_name\n \"#{MAJOR}_#{MINOR}_#{REVISION}\"\n end",
"def name_author_year_string\n [name, author_year_string].compact.join(\" \")\n end",
"def get_verbose_name\n # [Steve, 20140725] This is surely excessively long/repetitive too:\n \"#{edition} #{description} #{header_year} - #{get_federation_type} - (#{begin_date ? begin_date.strftime('%Y') : '?'}/#{end_date ? end_date.strftime('%y') : '?'}) \"\n end",
"def pub_year_display_str(ignore_approximate = false)\n single_pub_year(ignore_approximate, :year_display_str)\n\n # TODO: want range displayed when start and end points\n # TODO: also want best year in year_isi fields\n # get_main_title_date\n # https://github.com/sul-dlss/SearchWorks/blob/7d4d870a9d450fed8b081c38dc3dbd590f0b706e/app/helpers/results_document_helper.rb#L8-L46\n\n # \"publication_year_isi\" => \"Publication date\", <-- do it already\n # \"beginning_year_isi\" => \"Beginning date\",\n # \"earliest_year_isi\" => \"Earliest date\",\n # \"earliest_poss_year_isi\" => \"Earliest possible date\",\n # \"ending_year_isi\" => \"Ending date\",\n # \"latest_year_isi\" => \"Latest date\",\n # \"latest_poss_year_isi\" => \"Latest possible date\",\n # \"production_year_isi\" => \"Production date\",\n # \"original_year_isi\" => \"Original date\",\n # \"copyright_year_isi\" => \"Copyright date\"} %>\n\n # \"creation_year_isi\" => \"Creation date\", <-- do it already\n # {}\"release_year_isi\" => \"Release date\",\n # {}\"reprint_year_isi\" => \"Reprint/reissue date\",\n # {}\"other_year_isi\" => \"Date\",\n end",
"def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend",
"def year_details(make, model, year, raw_parameters={}, &block)\n Edmunds::Api.get(\"/api/vehicle/v2/#{make}/#{model}/#{year}\") do |request|\n request.raw_parameters = raw_parameters\n\n request.allowed_parameters = {\n submodel: Edmunds::Vehicle::SUBMODEL_REGEX,\n category: Edmunds::Vehicle::VEHICLE_CATEGORIES,\n state: %w[new used future],\n year: ((1990.to_s)..(Date.current.year.to_s)),\n view: %w[basic full],\n fmt: %w[json]\n }\n\n request.default_parameters = { view: 'basic', fmt: 'json' }\n\n request.required_parameters = %w[fmt]\n\n request.result_function = block\n end\n end",
"def partial_date_string(year, month, day)\n if !day.nil?\n \"on #{Date::MONTHNAMES[month]}, #{day} of #{year}\"\n elsif !month.nil?\n \"in #{Date::MONTHNAMES[month]} of #{year}\"\n else\n \"in #{year}\"\n end\n end",
"def to_s\n str = [major, minor, patch].compact.join('.')\n str = \"#{str}.#{pre}\" if pre\n str\n end",
"def to_string\n return @year.to_s + \" \" + @month.to_s + \" \" + @day.to_s\n end",
"def to_s\n v = [major, minor, patch].compact.join('.')\n v += \"-#{pre}\" if pre\n v\n end",
"def to_s\n @to_s ||= [@major, @minor, @tiny].join(\".\")\n end",
"def to_s\n fy = first.year.to_s\n end_year = last.year\n fy += \"-\" + end_year.to_s unless first.year == end_year\n fy\n end",
"def to_s\n\t\tMonth.month_names[@month-1][0..2] + \" \" + @year.to_s\n\tend",
"def get_number_with_year\n receipt_num.to_s + \" / \" + get_date_receipt().strftime(\"%Y\")\n end",
"def w_year; end",
"def car2 (make, model)\n return make + ' ' + model\nend",
"def get_year_with_number\n date_receipt.strftime(\"%Y\") + \"-\" + sprintf( \"%03i\", receipt_num )\n end",
"def display_name\n \"#{self.year} #{self.make} #{self.model}\" + (self.color.blank? ? \"\" : \", #{self.color}\") + \" (#{self.vin})\"\n end",
"def cwyear\n end",
"def name\n\t\treturn \"#{year} season\"\n\tend",
"def publication_year\n end",
"def name_and_version\n [display_name, version].compact.join(' ')\n end",
"def extract_swimmer_year_and_category( compound_year_or_category )\n parts = compound_year_or_category.to_s.split(/\\s+/)\n if (parts[0] =~ /\\d{4}/) && (parts[1] =~ /\\d{2}/)\n [ parts[0] , \"M#{parts[1]}\" ]\n\n elsif (parts[0] =~ /\\d{4}/) && (parts[1] == '0')\n [ parts[0] , 'U25' ]\n\n elsif parts[0] =~ /M|U/i\n [ nil, parts.join ]\n\n else\n [ nil, nil ]\n end\n end",
"def to_s\n format(\"%d.%d\", @major, @minor)\n end",
"def details(vehicle_type)\n \"Your #{vehicle_type} is #{model} is #{color} colour and it is a #{year} model and is #{how_old} years old.\"\n end",
"def info\n \"Car with make of #{make}, #{model}, was made in #{year} and is #{color}\"\n end",
"def fullName()\n\t\t\t\t@mod.to_s\n\t\t\tend",
"def raw_year\n start_on.year\n end",
"def to_s\n \"My car is a #{color}, #{year} model, #{model}\"\n end",
"def w_year\n @obj.date.strftime(\"%G\")\n end",
"def display_course_name\n mini_text = self.mini == \"Both\" ? \"\" : self.mini\n result = self.short_or_full_name + self.semester + mini_text + self.year.to_s\n result.gsub(\" \", \"\")\n end",
"def display_course_name\n mini_text = self.mini == \"Both\" ? \"\" : self.mini\n result = self.short_or_full_name + self.semester + mini_text + self.year.to_s\n result.gsub(\" \", \"\")\n end",
"def author_year_string\n au = [author_string, self.year].compact.join(\", \")\n return nil if au.size == 0\n au\n end",
"def first_year\n 2012\n end",
"def test_format_to_s\n version = VMLib::Version.new 'foo', 1, 2, 3, 'rc.1', 'sha.5114f85'\n\n # Make sure all fields are included in the to_s\n assert_equal 'foo 1.2.3-rc.1+sha.5114f85', version.to_s\n\n # Changing the name should reflect in the to_s\n version.name = 'bar'\n assert_equal 'bar 1.2.3-rc.1+sha.5114f85', version.to_s\n\n # Changing the major number should reflect in the to_s\n version.major = 4\n assert_equal 'bar 4.2.3-rc.1+sha.5114f85', version.to_s\n\n # Changing the minor number should reflect in the to_s\n version.minor = 5\n assert_equal 'bar 4.5.3-rc.1+sha.5114f85', version.to_s\n\n # Changing the patch number should reflect in the to_s\n version.patch = 6\n assert_equal 'bar 4.5.6-rc.1+sha.5114f85', version.to_s\n\n version.major = 1\n version.minor = 2\n version.patch = 3\n\n # Changing the build should reflect in the to_s\n version.build = 'sha.0012312'\n assert_equal 'bar 1.2.3-rc.1+sha.0012312', version.to_s\n\n # Removing the build should reflect in the to_s\n version.build = ''\n assert_equal 'bar 1.2.3-rc.1', version.to_s\n\n # Changing the prerelease should reflect in the to_s\n version.prerelease = 'alpha.02'\n assert_equal 'bar 1.2.3-a.2', version.to_s\n\n # Removing the prerelease should reflect in the to_s\n version.prerelease = ''\n assert_equal 'bar 1.2.3', version.to_s\n\n # Having a build metadata and no prerelease should reflect in the to_s\n version.build = 'sha.12ab32d'\n assert_equal 'bar 1.2.3+sha.12ab32d', version.to_s\n end",
"def to_string\n contents = @metadata[:contents]\n\n # replace version / release\n contents.gsub!(SPEC_VERSION_MATCHER, \"Version: #{@metadata[:version]}\")\n contents.gsub!(SPEC_RELEASE_MATCHER, \"Release: #{@metadata[:release]}\")\n\n # add changelog entry\n cp = contents.index SPEC_CHANGELOG_MATCHER\n cpn = contents.index \"\\n\", cp\n contents = contents[0...cpn+1] +\n @metadata[:changelog_entries].join(\"\\n\\n\")\n\n # update requires/build requires\n rp = contents.index SPEC_REQUIRES_MATCHER\n brp = contents.index SPEC_BUILD_REQUIRES_MATCHER\n tp = rp < brp ? rp : brp\n\n pp = contents.index SPEC_SUBPACKAGE_MATCHER\n pp = -1 if pp.nil?\n\n lrp = contents.rindex SPEC_REQUIRES_MATCHER, pp\n lbrp = contents.rindex SPEC_BUILD_REQUIRES_MATCHER, pp\n ltp = lrp > lbrp ? lrp : lbrp\n\n ltpn = contents.index \"\\n\", ltp\n\n contents.slice!(tp...ltpn)\n contents.insert tp,\n (@metadata[:requires].collect { |r| \"Requires: #{r.str}\" } +\n @metadata[:build_requires].collect { |r| \"BuildRequires: #{r.str}\" }).join(\"\\n\")\n\n # add new files\n fp = contents.index SPEC_FILES_MATCHER\n lfp = contents.index SPEC_SUBPKG_FILES_MATCHER, fp + 1\n lfp = contents.index SPEC_CHANGELOG_MATCHER if lfp.nil?\n\n contents.insert lfp - 1, @metadata[:new_files].join(\"\\n\") + \"\\n\"\n\n # add new doc files\n fp = contents.index SPEC_DOC_FILES_MATCHER\n fp = contents.index SPEC_FILES_MATCHER if fp.nil?\n lfp = contents.index SPEC_SUBPKG_FILES_MATCHER, fp + 1\n lfp = contents.index SPEC_CHANGELOG_MATCHER if lfp.nil?\n \n contents.insert lfp - 1, @metadata[:new_docs].join(\"\\n\") + \"\\n\"\n\n # return new contents\n contents\n end",
"def copyright_period\n if Time.now.year > 2009\n raw %Q(2009–#{Time.now.year})\n else\n raw %Q(2009)\n end\n end",
"def date\n tt = Time.gm(*filename_base.scan(/\\d+/))\n\n def tt.to_s\n to_formatted_s(:short_date_with_year) + \" \" + to_formatted_s(:short_time)\n end\n\n tt\n\tend",
"def to_s\n \"#{@month}/#{@day}/#{@year}\"\n end",
"def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end",
"def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end",
"def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end",
"def inspect\n \"the year is \" + humanize_list(@years)\n end",
"def get_built_year\n return @built_year\n end",
"def year; end",
"def year; end",
"def get_name\n \"#{@manufacturer} #{@model}\"\n end",
"def year\n end",
"def author_year\n au = author_year_string\n return nil if au.nil?\n (self.parens == true) ? \"(#{au})\" : au\n end",
"def format(obj)\n case obj\n when Time\n obj.strftime(\"%Y-%m-%d\")\n when Date, Gem::Version, Gem::Requirement\n obj.to_s\n else\n obj\n end\n end",
"def format_year(year)\n \"#{year}-#{year+1}\"\n end",
"def full_name\n [vendor, model].join(\" \")\n end",
"def year() end",
"def get_filename(year, month)\n\tfolder = year == nil ? '.' : './_c' + year.to_s\n\tfilename = month == nil ? 'index' : month.to_s\n\textension = 'md'\n\treturn folder + \"/\" + filename + \".\" + extension\nend",
"def version\n build_string\n end",
"def get_full_name\n # [Steve, 20140725] Too long/repetitive: \"#{description} #{header_year} - #{get_federation_type}\"\n description\n end",
"def comment_year(datetime)\n datetime.year != DateTime.now.year ? \"#{datetime.year} \" : \"\"\n end",
"def do_something(year, model, make)\n puts year\n puts model\n puts make\nend",
"def number\n \"#{@major}.#{@minor}.#{@patch}\"\n end",
"def year\n current_year = Date.today.year\n\n case raw_year\n when current_year; \"this year\"\n when current_year.next; \"next year\"\n when current_year.pred; \"last year\"\n else; raw_year.to_s\n end\n end",
"def year\n 2020\n end",
"def get_full_name\n \"#{season.get_season_type}, #{get_event_type} #{get_category_type} #{get_gender_type_code}: #{get_timing}\"\n end",
"def design_name\n\n if 1 == 2 # self.part_number_id == 0\n design_name = self.prefix.pcb_mnemonic + self.number\n design_name += self.revision.name if self.revision && self.revision_id > 0\n \n case self.entry_type\n when 'dot_rev'\n design_name += self.numeric_revision.to_s if self.numeric_revision > 0\n when 'date_code'\n design_name += self.numeric_revision.to_s if self.numeric_revision && self.numeric_revision > 0\n design_name += '_eco'\n design_name += self.eco_number\n end\n \n \"#{design_name} (\" + \n self.prefix.pcb_number(self.number,\n self.revision.name,\n self.numeric_revision) + ')'\n else\n self.pcb_number\n end\n \n end",
"def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end",
"def modeler_description\n return 'Currently this is just setup for design level calculation method, but it could be extended as needed..'\n end",
"def full_name\n return \"#{make.name} #{name}\"\n end",
"def to_s\n \"#{year}-#{month.to_s.rjust(2, '0')}\"\n end",
"def modeler_description\r\n return \"This measure imports 8760 chilled water and hot water demand profiles for use in the LoadProfilePlant. The source is a csv file with seven columns titles: timestep, chw_supply_temp_f, chw_flow_frac, chw_load_w, hw_supply_temp_f, hw_flow_frac, hw_load_w.\"\r\n end",
"def name () to_s unless quarter.blank? || year.blank? end",
"def name_author_year(string)\n s = string.split\n name = s.shift\n notes = nil\n notes ||= s.pop if s[-1] == (\"Emend.\" || \"Syn.\" || \"Homo.\" || \"check\")\n year = nil\n year ||= s.pop if (s[-1] =~ /\\A\\d+\\Z/ && s[-1].length == 4)\n authors = nil\n authors = s.join(\" \") if s.size > 0\n [name, authors, year, notes]\n end",
"def package_name(buildno=nil)\n if buildno\n buildno = Time.now.strftime(\"%H*60+%M\")\n versnum = \"#{version}.#{buildno}\"\n else\n versnum = version\n end\n\n if platform\n \"#{name}-#{versnum}-#{platform}\"\n else\n \"#{name}-#{versnum}\"\n end\n end",
"def to_s\n minor ? \"#{@major}-#{Patch.pad_minor(@minor)}\" : \"#{@major}\"\n end",
"def build_name\n \"#{manufacturer} #{weight} #{style} #{name}\"\n end",
"def full_academic_year\n unless academic_year.blank?\n academic_year.to_s + '-' + (academic_year + 1).to_s\n end\n end",
"def year\n created.strftime '%Y'\n end",
"def identifier(no_version: false)\n return emma_recordId if emma_recordId.present?\n parts = [emma_repository, emma_repositoryRecordId, dc_format]\n parts << emma_formatVersion unless no_version\n parts.compact_blank.join('-').presence\n end",
"def modeler_description\n return 'HVAC system creation logic uses [openstudio-standards](https://github.com/NREL/openstudio-standards) and efficiency values are defined in the openstudio-standards Standards spreadsheet under the *NREL ZNE Ready 2017* template.'\n end",
"def to_s\n return '' if name.nil?\n return name if version.nil?\n return \"#{name}-#{version}\" if arch.nil?\n \"#{name}-#{version}-#{arch}\"\n end",
"def to_s\n \"#{'%04i' % year}-W#{'%02i' % index}\"\n end",
"def toText(short)\n \"#{author.to_short_s}. #{displayTitle(title)}#{metaTitle ? '. '+metaTitle.to_full_s : ''}, #{year}.\"\n end",
"def to_s; \"%d-%02d\" % [@years, @months.abs] end",
"def modeler_description\n return \"Checks year, start day of week, daylight savings, leap year, and timestep inputs and outputs\"\n end",
"def full_name\n \"#{@name}-#{@version}\"\n end",
"def modeler_description\n return \"A measure that will take Annual Building Utilty Performance tables, Demand End use Components summary table, Source Energy End Use Components Summary and produce an output Json\"\n end",
"def inspect\n \"#{year}-W#{week}-#{day}\"\n end",
"def to_s\n [@year,@month,@day].join(\"/\")\n end",
"def modeler_description\n return \"Assume that the starting point technology is primarily 90.1-2013 T8 lighting, with an efficacy of 90 lm/W. According to Table 5.2, LED Efficacy Improvement, in (1), 2015 LED luminaire efficacy is 145 lm/W. Calculate the total lighting power of the model and divide by this initial efficacy to determine the total number of lumens needed. Assuming that this same number of lumens should be provided by LED lighting, divide by the LED efficacy to determine the total wattage of LEDs that would be necessary to achieve the same lighting. Reduce the overall building lighting power by the resulting multiplier. IE new LPD = old LPD * (1 - 90 lm/W /145 lm/W). This is a very crude estimate of the impact of current LED technology. In order to perform a more nuanced analysis, lighting in the prototype buildings should be broken down by use type (general space lighting, task lighting, etc.) and by currently assumed technology (T12, T8, metal halide, etc.). If this breakdown were available, each type of lighting could be modified according to its own efficacy characteristics. Additionally, this measure does not account for the impact of LEDs on outdoor lighting.\"\n end",
"def year\n return @t_year\n end"
] |
[
"0.70236707",
"0.70207965",
"0.6833335",
"0.65488356",
"0.64275956",
"0.63911164",
"0.61556107",
"0.6001814",
"0.5972173",
"0.59226567",
"0.58873117",
"0.5864135",
"0.5864135",
"0.5847761",
"0.57896286",
"0.57839864",
"0.5776276",
"0.5706453",
"0.56913716",
"0.56651926",
"0.5635733",
"0.56111664",
"0.5577958",
"0.55716324",
"0.55674314",
"0.5548925",
"0.5545096",
"0.55390066",
"0.55260575",
"0.5522616",
"0.55174714",
"0.55138654",
"0.549703",
"0.54950553",
"0.5479622",
"0.5479064",
"0.547854",
"0.5476895",
"0.5456947",
"0.5456135",
"0.5434699",
"0.54325175",
"0.5432359",
"0.5432359",
"0.54298234",
"0.54283553",
"0.5400302",
"0.539825",
"0.5391547",
"0.53895634",
"0.5386607",
"0.5373177",
"0.5373177",
"0.53728074",
"0.53661156",
"0.5365997",
"0.53552574",
"0.53552574",
"0.53538704",
"0.5347502",
"0.53429735",
"0.5340622",
"0.5327175",
"0.5326569",
"0.5324459",
"0.532376",
"0.5312197",
"0.5310809",
"0.5305512",
"0.5298072",
"0.5289274",
"0.528633",
"0.52845126",
"0.52784455",
"0.526465",
"0.52602935",
"0.5253963",
"0.52500296",
"0.5245881",
"0.52398926",
"0.523937",
"0.52295846",
"0.52238244",
"0.5220768",
"0.5220544",
"0.52191985",
"0.52159905",
"0.5215556",
"0.52152115",
"0.52151483",
"0.52036273",
"0.52012575",
"0.5196487",
"0.5195479",
"0.5192275",
"0.5190417",
"0.5190134",
"0.5181201",
"0.5178932",
"0.51775694"
] |
0.6805958
|
3
|
GET /today_activities/1 GET /today_activities/1.xml
|
def show
@today_activity = TodayActivity.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @today_activity }
end
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 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 activities_xml(time = nil, filter = nil)\n timestamp = time ? time.to_gnip_bucket_id : 'current'\n if filter\n _name, _endpoint = filter.name, \"#{self.uri}/#{filter.path}/activity/#{timestamp}.xml\"\n else\n _name, _endpoint = self.name, \"#{self.uri}/activity/#{timestamp}.xml\"\n end\n log_action(_name, time, timestamp)\n response, activities_xml = fetch(_endpoint)\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 activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\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 activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end",
"def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\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 activity(params={})\n Endpoints::Activity.new(self).get(params)\n end",
"def index\n @search_activities = @site.search_activities.order('stamped_at desc').paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @search_activities }\n end\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 frequent_activities\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @current_activity }\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 new\n @today_activity = TodayActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @today_activity }\n end\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 show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @activity.to_xml }\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 index\n @activities = @user.activities.where(\"date = ?\", requested_date(params[:date]))\n end",
"def index\n @meetings = Meeting.recent\n @past_meetings = Meeting.recent.past\n @upcoming_meetings = Meeting.upcoming\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meetings }\n format.atom\n end\n end",
"def index\n \n @activities = Activity.search(params[:search], params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @activities }\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.xml { render :xml => @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.xml { render :xml => @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.xml { render :xml => @activity }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def recent_activity\n doc = request(@user, \"recentactivity\")\n items = []\n doc.xpath('//rss/channel/item').each do |node|\n items << { :title => node.xpath('title').text.strip,\n :link => node.xpath('link').text.strip,\n :description => node.xpath('description').text.strip,\n :date => node.xpath('pubDate').text.strip,\n :track => node.xpath('mm:Track/dc:title').text.strip,\n :artist => node.xpath('mm:Artist/dc:title').text.strip,\n :album => node.xpath('mm:Album/dc:title').text.strip,\n :artwork => node.xpath('pandora:albumArtUrl').text.strip,\n :station => node.xpath('pandora:stationLink').text.strip}\n end\n items\n end",
"def show\n @evactivity = Evactivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @evactivity }\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 @datetimes = current_user.datetimes.where [\"DATE(start) = DATE(?)\", Time.now]\n\n if params[:new_tracking_info]\n @desired_activity_name = params[:new_tracking_info][:activity_name]\n end\n\n self.prepare_tracking_data\n\n @tags = current_user.datetimes.tag_counts_on(:tags)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datetimes }\n end\n end",
"def show\n @model = Model.find(params[:id])\n @model_activities = @model.included_activities\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @model.to_xml(:methods => [:activity_use_count])}\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 activities\n\t activity_feed.activities\n\tend",
"def fetch(activity_id)\n RubyRedtail::Query.run(\"calendar/activities/#{activity_id}\", @api_hash, \"GET\")\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 activities(time = nil, filter = nil)\n parse_xml(*activities_xml(time, filter))\n end",
"def home \n @total = Activity.count()\n @activities_pages, @activities = paginate :activities,:per_page =>2\n if request.xml_http_request?\n render :partial => \"activities_list\", :layout => false\n \n end\n end",
"def index\n@activity = Activity.all\nend",
"def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n format.json { render :json => @activity.to_json }\n end\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 activity\n @root.xpath('Events/Event').map do |act|\n Activity.new(act)\n end\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 show\n @search_activity = @site.search_activities.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @search_activity }\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 @events = Event.find_upcoming(5).reverse\n @title = 'Tulevat tapahtumat'\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => events }\n end\n end",
"def index\n @user = current_user\n @activities = Activity.where({processed: 1, user_id: current_user.id}).order('activity_date')\n #@new_activities = Activity.where({processed: 0, user_id: current_user.id}).order('activity_date')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activities }\n end\n end",
"def weekly_goals\n get(\"/user/#{@user_id}/activities/goals/weekly.json\")\n end",
"def index\n @activities = Activity.all\n render json: @activities\n end",
"def index\n @date = params[:date].present? ? Date.parse(params[:date]) : Date.today\n beginning_of_day, end_of_day = @date.beginning_of_day, @date.end_of_day\n @feats = @person.feats.all(\n :include => :activity, \n :conditions => [\"activities.start_time > ? and activities.start_time < ?\", beginning_of_day, end_of_day])\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feats }\n end\n end",
"def show\n render json: @day, include: [:activities]\n end",
"def index\n @status_activities = StatusActivity.all\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(user = nil, opts = {})\n client.get_activity(user, opts)\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 index\n @activities = current_user.activities\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 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 = Activity.find(params[:id])\n @actattributes = @activity.actattributes\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def show\n @recent_activity = RecentActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recent_activity }\n end\n end",
"def show\r\n Connection.switch_data(params[:connection], \"daily\")\r\n @connections = Connection.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @connections.to_xml(:root => 'records', :children => 'record', :dasherize => false) }\r\n end\r\n end",
"def scrape_today\n url = \"https://www.timeout.com/melbourne/things-to-do/things-to-do-in-melbourne-today\"\n unparsed_page = HTTParty.get(url)\n parsed_page = Nokogiri::HTML(unparsed_page.body)\n items = parsed_page.css('div.card-content')\n items.each do |activity|\n activity = {\n title: activity.css('h3.card-title').text.strip,\n description: activity.css('p').text } \n @today_activities << activity \n end \n end",
"def activity_on_date_range(activity, start, finish)\n get(\"/user/#{@user_id}/activities/#{activity}/date/#{format_date(start)}/#{format_date(finish)}.json\")\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 rss\n @event = Event.find_by_key(params['id'])\n @histories = @event.histories(:order => 'created_at DESC')\n render :layout => false\n response.headers[\"Content-Type\"] = \"application/xml; charset=utf-8\"\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 index\n @activities = if params[:past]\n @group.activities\n .where('start < ?', Time.zone.now)\n .order(start: :desc)\n .paginate(page: params[:page], per_page: 25)\n else\n @group.activities\n .where('start > ?', Time.zone.now)\n .order(start: :asc)\n .paginate(page: params[:page], per_page: 25)\n end\n end",
"def index\n @activities = current_user.attending_activities\n render :index\n end",
"def url\n activity_path(self)\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 activities_get(opts = {})\n activities_get_with_http_info(opts)\n end",
"def index\n @commission_days = CommissionDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @commission_days }\n end\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 new\n @current_activity = CurrentActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @current_activity }\n end\n end",
"def index\n respond_to do |format|\n format.html { render action: 'index' } # index.html.erb\n format.json do\n out = meetings.per(500).map(&:to_json_attributes)\n out.each { |m| m[:url] = meeting_path(m[:url]) }\n render json: out\n end\n format.xml { render xml: meetings }\n end\n end",
"def get(params={})\n if params[\"until\"]\n params[\"until\"] = ParseHelper.format_time(params[\"until\"])\n end\n\n if params[\"since\"]\n params[\"since\"] = ParseHelper.format_time(params[\"since\"])\n end\n\n if params[\"object\"]\n params[\"object_id\"] = params[\"object\"].id\n params.delete(\"object\")\n end\n\n if params[\"parent_object\"]\n params[\"parent_object_id\"] = params[\"parent_object\"].id\n params.delete(\"parent_object\")\n end\n\n if params[\"parent_item\"]\n params[\"parent_item_id\"] = params[\"parent_item\"].id\n params.delete(\"parent_item\")\n end\n\n if params[\"initiator\"]\n params[\"initiator_id\"] = params[\"initiator\"].id\n params.delete(\"initiator\")\n end\n\n result = @client.api_helper.get_response(Config::TODOIST_ACTIVITY_GET_COMMAND, params)\n end",
"def index\n @appointments = Appointment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @appointments }\n end\n end",
"def get_friends_activities_atom(user_id,params={})\n @restv1.get_friends_activities(user_id, params)\n end",
"def index\n @traffics = Traffic.find(:all, :order => \"created_at\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traffics }\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 list_activities(name)\n puts \"\"\n puts \"--------------------------------------------------\"\n puts \"Here is a list of activities popular in #{name}:\".colorize(:green)\n puts \"--------------------------------------------------\"\n puts \"\"\n # prints activities available in city chosen by user\n Twyd::Activity.all.each.with_index(1) do |a, i|\n puts \"#{i}. #{a.name}\"\n end\n end",
"def index\n @activities = PublicActivity::Activity.published\n\n if params[:recipient_type] and recipient_klass = params[:recipient_type].safe_constantize and r_id = params[:recipient_id] and @recipient = recipient_klass.find(r_id)\n @activities = @activities.on(@recipient)\n elsif current_user\n # This is user current feed !\n query_params = ['User', current_user.id]\n query = \"(activities.recipient_type = ? AND activities.recipient_id = ?)\"\n\n # Followed Pages\n if pages = current_user.followed_pages and pages.present?\n query += \" OR (activities.recipient_type = ? AND activities.recipient_id IN (?))\"\n query_params += [\"Page\"] + [pages.collect(&:id)]\n end\n\n @activities = @activities.where(query, *query_params)\n\n else\n head :bad_request # should not happen\n end\n\n @activities = @activities.order('updated_at DESC, created_at DESC').page(params[:page]).per(5)\n \n authorize @activities\n end"
] |
[
"0.73294634",
"0.7149871",
"0.7085055",
"0.70748377",
"0.7040429",
"0.7039494",
"0.69966096",
"0.69966096",
"0.69782054",
"0.67987555",
"0.67987555",
"0.6772547",
"0.66820544",
"0.6679438",
"0.6602559",
"0.6597832",
"0.6584657",
"0.6570117",
"0.65365404",
"0.65365404",
"0.64997846",
"0.6487704",
"0.6357882",
"0.6357733",
"0.635749",
"0.63560724",
"0.6354386",
"0.6345735",
"0.629964",
"0.629964",
"0.629964",
"0.6296142",
"0.6277234",
"0.62632364",
"0.62586474",
"0.6258578",
"0.62127227",
"0.61983454",
"0.61977607",
"0.61977607",
"0.61977607",
"0.61977607",
"0.61977607",
"0.61977607",
"0.61977607",
"0.61977607",
"0.61977607",
"0.61977607",
"0.61924654",
"0.61787766",
"0.6159259",
"0.6156226",
"0.61333483",
"0.61256593",
"0.6118328",
"0.61134374",
"0.6101696",
"0.6101266",
"0.60844225",
"0.60692155",
"0.6058377",
"0.60352975",
"0.60259485",
"0.59983593",
"0.59895515",
"0.59860367",
"0.5985404",
"0.5952096",
"0.5935151",
"0.5928456",
"0.59165937",
"0.5915474",
"0.5911896",
"0.5909093",
"0.5898927",
"0.58976567",
"0.5896332",
"0.58785313",
"0.58776104",
"0.5875002",
"0.58686346",
"0.5864389",
"0.5862203",
"0.58557874",
"0.5855149",
"0.5843632",
"0.5841788",
"0.5840975",
"0.5835848",
"0.5835848",
"0.5835848",
"0.58307564",
"0.5827421",
"0.5822676",
"0.5809695",
"0.5804846",
"0.57988036",
"0.57856035",
"0.57823604",
"0.57817835"
] |
0.72362953
|
1
|
GET /today_activities/new GET /today_activities/new.xml
|
def new
@today_activity = TodayActivity.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @today_activity }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activity = Activity.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @current_activity = CurrentActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @current_activity }\n end\n end",
"def new\n @activity = Activity.new\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @evactivity = Evactivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evactivity }\n end\n end",
"def new\n @activity = Activity.new\n @attcategories = Attcategory.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @breadcrumb = 'create'\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @app = App.find(params[:app_id])\n @activity = @app.activities.build\n @base_versions = [Activity::NO_BASE_VERSION]\n\n respond_to do |format|\n format.html do # new.html.erb\n render :layout => false if request.xhr?\n end\n format.xml { render :xml => @activity }\n end\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 new\n @recent_activity = RecentActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recent_activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end",
"def create\n @today_activity = TodayActivity.new(params[:today_activity])\n\n respond_to do |format|\n if @today_activity.save\n flash[:notice] = 'TodayActivity was successfully created.'\n format.html { redirect_to(@today_activity) }\n format.xml { render :xml => @today_activity, :status => :created, :location => @today_activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @today_activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @schedule = Schedule.new\n @apps = App.find(:all)\n @tags = Contact.get_tags\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n authorize Activity\n @activity = Activity.new\n @activity.user = current_visitor\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n end\n end",
"def new\n @activities_project = ActivitiesProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activities_project }\n end\n end",
"def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @spot_activity = SpotActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spot_activity }\n end\n end",
"def new\n @activity = Activity.new\n @activity.project_id = session[:project_id] unless session[:project_id].nil?\n @activity.do_today = true\n @activity.someday = true\n \n respond_to do |format|\n format.js { }\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n format.json { render :json => @activity }\n end\n end",
"def new\n @latestinfo = Latestinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @latestinfo }\n end\n end",
"def new\n @live_news = LiveNews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @live_news }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end",
"def new\n @traffic = Traffic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @traffic }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @external_activity = ExternalActivity.new\n @external_activity.user = current_visitor\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @external_activity }\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 new\n @the_day = TheDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @the_day }\n end\n end",
"def new\n authorize ExternalActivity\n @external_activity = ExternalActivity.new\n @external_activity.user = current_visitor\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @external_activity }\n end\n end",
"def new\n @visit_stat = VisitStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @visit_stat }\n end\n end",
"def new\n @vehicle_daily = VehicleDaily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vehicle_daily }\n end\n end",
"def show\n @today_activity = TodayActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @today_activity }\n end\n end",
"def new\n @commission_day = CommissionDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @commission_day }\n end\n end",
"def new\n @activity_inventory = ActivityInventory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @activity_inventory }\n end\n end",
"def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end",
"def new\n @timeline = Timeline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timeline }\n end\n end",
"def new\n @workflow = Workflow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workflow }\n end\n end",
"def new\n @todos = Todos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todos }\n end\n end",
"def new\n @daily_grr = DailyGrr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end",
"def new\n @news = News.new\n @title = \"New news\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end",
"def new\n @activity = Activity.new\n end",
"def new\n @activity = Activity.new\n end",
"def new\n @aircraft_history = AircraftHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aircraft_history }\n end\n end",
"def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end",
"def new\n @task = context.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @activity_event = ActivityEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_event }\n end\n end",
"def new\n @page_title = \"Task List New\"\n @task_list = TaskList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task_list }\n end\n end",
"def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n format.xml { render xml: @tasks }\n end\n end",
"def new\n @tournaments = Tournament.all\n @tournament_day = TournamentDay.new\n\n respond_to do |format|\n format.html # new.rb\n format.xml { render :xml => @tournament_day }\n end\n end",
"def new\n @bday = Bday.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bday }\n end\n end",
"def new\n @calendario = Calendario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendario }\n end\n end",
"def new\n @task = Task.new(:expires => true, :time => -1, :start_date => Time.now.at_beginning_of_day, :end_date => Time.now.at_beginning_of_day)\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @page = Page.new(:status => params[:from])\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 @activite = Activite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activite }\n end\n end",
"def new\n @activity_item = ActivityItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_item }\n end\n end",
"def new\n @attendance = Attendance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attendance }\n end\n end",
"def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end",
"def new\n @appointment = Appointment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appointment }\n end\n end",
"def new\n @appointment = Appointment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appointment }\n end\n end",
"def new\n @meeting = Meeting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @meeting }\n end\n end",
"def new\n @meeting = Meeting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @meeting }\n end\n end",
"def new\n @meeting = Meeting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @meeting }\n end\n end",
"def new\n @appointment = Appointment.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appointment }\n end\n end",
"def new\n @appointment = Appointment.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appointment }\n end\n end",
"def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end",
"def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end",
"def new\n @activity_tag = ActivityTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_tag }\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'activity was successfully saved'\n format.html { redirect_to activities_url }\n format.xml do\n headers[\"Location\"] = activity_url(@activity)\n render :nothing => true, :status => \"201 Created\"\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors.to_xml }\n end\n end\n end",
"def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @sleep_log = SleepLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sleep_log }\n end\n end",
"def new\n @vehicle_historic = VehicleHistoric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vehicle_historic }\n end\n end",
"def new\n @workflow_task = WorkflowTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workflow_task }\n end\n end",
"def new\n @news_update = NewsUpdate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_update }\n end\n end",
"def new\n @datetime = Datetime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @datetime }\n end\n end",
"def new\n @task = Task.new(:user_id => current_user.id)\n\n respond_to do |format|\n format.xml { render :xml => @task }\n end\n end",
"def new\n @user_day = UserDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_day }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @status }\n end\n end",
"def new\n @machine_historic = MachineHistoric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @machine_historic }\n end\n end",
"def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @tracker = Tracker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tracker }\n end\n end",
"def new\n @appointment_request = AppointmentRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appointment_request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end"
] |
[
"0.72711295",
"0.72711295",
"0.72711295",
"0.7268141",
"0.72278106",
"0.70316213",
"0.70222986",
"0.6999209",
"0.699162",
"0.6908136",
"0.68990225",
"0.68770003",
"0.6799573",
"0.6799573",
"0.6744312",
"0.6713452",
"0.67091805",
"0.67066514",
"0.6685236",
"0.6669365",
"0.6653161",
"0.6603861",
"0.65966254",
"0.65528846",
"0.65444607",
"0.6505511",
"0.6486937",
"0.6480422",
"0.6469839",
"0.6467263",
"0.6456138",
"0.6434808",
"0.6404021",
"0.6403281",
"0.63886726",
"0.63862365",
"0.63838",
"0.63837934",
"0.63768256",
"0.63689727",
"0.6367478",
"0.63506263",
"0.63473976",
"0.63473976",
"0.63473976",
"0.6336085",
"0.6336085",
"0.63353074",
"0.6330621",
"0.63259953",
"0.63226163",
"0.6312381",
"0.63092655",
"0.6302036",
"0.6298552",
"0.62965316",
"0.6290998",
"0.6289824",
"0.62817127",
"0.6270993",
"0.62585855",
"0.62585044",
"0.6255805",
"0.6253146",
"0.6253146",
"0.62511706",
"0.62511706",
"0.62511706",
"0.62489367",
"0.62489367",
"0.6246476",
"0.6246476",
"0.6246018",
"0.6246018",
"0.6246018",
"0.6246018",
"0.62439185",
"0.6234781",
"0.62331676",
"0.62295735",
"0.6229532",
"0.62279016",
"0.62277293",
"0.6225891",
"0.62152225",
"0.62113845",
"0.62092817",
"0.6207589",
"0.6207589",
"0.6205226",
"0.6205226",
"0.6205226",
"0.6204798",
"0.62024623",
"0.62007004",
"0.61988807",
"0.6193873",
"0.6191233",
"0.6191233",
"0.6191233"
] |
0.78723276
|
0
|
POST /today_activities POST /today_activities.xml
|
def create
@today_activity = TodayActivity.new(params[:today_activity])
respond_to do |format|
if @today_activity.save
flash[:notice] = 'TodayActivity was successfully created.'
format.html { redirect_to(@today_activity) }
format.xml { render :xml => @today_activity, :status => :created, :location => @today_activity }
else
format.html { render :action => "new" }
format.xml { render :xml => @today_activity.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 new\n @today_activity = TodayActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @today_activity }\n end\n end",
"def publish_xml(activity_xml)\n logger.info(\"Publishing activities for #{self.name}\")\n publisher_path = \"#{self.uri}/activity.xml\"\n post(publisher_path, activity_xml)\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 = 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\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 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 @evactivity = Evactivity.new(params[:evactivity])\n\n respond_to do |format|\n if @evactivity.save\n flash[:notice] = 'Evactivity was successfully created.'\n format.html { redirect_to(@evactivity) }\n format.xml { render :xml => @evactivity, :status => :created, :location => @evactivity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @evactivity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = Activity.new(params[:activity])\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'activity was successfully saved'\n format.html { redirect_to activities_url }\n format.xml do\n headers[\"Location\"] = activity_url(@activity)\n render :nothing => true, :status => \"201 Created\"\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors.to_xml }\n end\n end\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 = 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 create\n @activity = Activity.new\n\n @activity.name = params[:name]\n @activity.duration = params[:duration]\n @activity.house_id = params[:selected_house]\n @activity.cost = params[:cost]\n @activity.description = params[:description]\n @activity.expiration = Date.civil(params[:date_expiration][:\"expiration(1i)\"].to_i,params[:date_expiration][:\"expiration(2i)\"].to_i,params[:date_expiration][:\"expiration(3i)\"].to_i)\n\n @activity.user_id = current_user.id\n @activity.done = 0\n\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Attività creata correttamente'\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 @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.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 @activity = Activity.new(params[:activity])\n @activity.user_id = current_user.id\n \n session[:project_id] = params[:activity][:project_id]\n\n respond_to do |format|\n if @activity.save\n\n if @activity.do_today != \"0\" # why is it not converted to bool? probably because it's virtual attribute\n Todotoday.create( :activity_id => @activity.id, :today => Date.today, :user_id => current_user.id,\n :position => ( Todotoday.where(:user_id => current_user.id).count + 1) )\n end\n\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, :status => :created, :location => @activity }\n else\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 create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = I18n.t('activities.controller.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 @activity = Activity.new(params[:activity])\n @activity.user = current_user\n @activity.organization = current_user.organization\n @activity.date = change_date_format(params[:activity][:date]) if !(params[:activity][:date]).blank?\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activity_path(@activity), notice: 'Data 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\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 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 activities_xml(time = nil, filter = nil)\n timestamp = time ? time.to_gnip_bucket_id : 'current'\n if filter\n _name, _endpoint = filter.name, \"#{self.uri}/#{filter.path}/activity/#{timestamp}.xml\"\n else\n _name, _endpoint = self.name, \"#{self.uri}/activity/#{timestamp}.xml\"\n end\n log_action(_name, time, timestamp)\n response, activities_xml = fetch(_endpoint)\n end",
"def activities\n get_call(\"1/activities.json\")\n end",
"def create\n save_status = false\n\n if (nil == params[:id])\n ruby_date = Activity.new(params.require(:activity).permit(:date)).date\n @activity = @user.activities.find_by(params.require(:activity).permit(:item_id).merge({:date => ruby_date}))\n\n if (nil != @activity)\n save_status = @activity.update(params.require(:activity).permit(:amount))\n else\n @activity = Activity.new(params.require(:activity).permit(:amount, :item_id, :date))\n @activity.user = @user\n save_status = @activity.save\n end\n else\n @activity = @user.activities.find_by({:id => params[:id]})\n save_status = @activity.update(params.require(:activity).permit(:amount))\n end\n\n respond_to do |format|\n if (nil == @activity)\n format.json { render json: {}, status: :unauthorized }\n elsif (true == save_status)\n format.json { render :show, status: :created }\n else\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 activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end",
"def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end",
"def postEntityOpening_times( entity_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, closed, closed_public_holidays)\n params = Hash.new\n params['entity_id'] = entity_id\n params['monday'] = monday\n params['tuesday'] = tuesday\n params['wednesday'] = wednesday\n params['thursday'] = thursday\n params['friday'] = friday\n params['saturday'] = saturday\n params['sunday'] = sunday\n params['closed'] = closed\n params['closed_public_holidays'] = closed_public_holidays\n return doCurl(\"post\",\"/entity/opening_times\",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 :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 @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 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 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 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\n ap = activity_params\n if !ap[:points].nil?\n doc = Nokogiri::XML(ap[:points].read)\n parse_gpx(doc,ap)\n end\n @activity = Activity.new(ap)\n @activity.owner_id = current_user.id\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 activity_params\n params.require(:activity).permit(:description, :is_done, :observations, :activity_type, :deadline)\n end",
"def activity\n @root.xpath('Events/Event').map do |act|\n Activity.new(act)\n end\n end",
"def republish\n json = JSON.parse(request.body.read)\n begin\n @external_activity = ActivityRuntimeAPI.republish(json)\n head :created, :location => @external_activity\n rescue StandardError => e\n json_error(e)\n end\n end",
"def create\n @activity = Activity.new(activity_params)\n @activity.user = current_user\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 :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 new\n @activity = Activity.new\n @activity.project_id = session[:project_id] unless session[:project_id].nil?\n @activity.do_today = true\n @activity.someday = true\n \n respond_to do |format|\n format.js { }\n format.html # new.html.erb\n format.xml { render :xml => @activity }\n format.json { render :json => @activity }\n end\n end",
"def index\n @datetimes = current_user.datetimes.where [\"DATE(start) = DATE(?)\", Time.now]\n\n if params[:new_tracking_info]\n @desired_activity_name = params[:new_tracking_info][:activity_name]\n end\n\n self.prepare_tracking_data\n\n @tags = current_user.datetimes.tag_counts_on(:tags)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datetimes }\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(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\n @activity = Activity.new(activity_params)\n\n\n @activity.date = convert_date_to_i(params[:date])\n @activity.time_from = get_time_from\n @activity.time_to = get_time_to\n\n respond_to do |format|\n if @activity.save\n\n format.html { redirect_to new_lambing_path }\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\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 create\n authorize Eventunscraped\n @eventunscraped = Eventunscraped.new(eventunscraped_params)\n @eventunscraped.user = current_user\n\n respond_to do |format|\n if @eventunscraped.save\n @eventunscraped.create_activity :create, owner: current_user\n format.html { redirect_to @eventunscraped, notice: 'Eventunscraped was successfully created.' }\n format.json { render :show, status: :created, location: @eventunscraped }\n else\n format.html { render :new }\n format.json { render json: @eventunscraped.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recent_activity = RecentActivity.new(params[:recent_activity])\n\n respond_to do |format|\n if @recent_activity.save\n format.html { redirect_to @recent_activity, notice: 'Recent activity was successfully created.' }\n format.json { render json: @recent_activity, status: :created, location: @recent_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recent_activity.errors, status: :unprocessable_entity }\n end\n end\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 scope 'default'\n get('activities/', params)\n end",
"def create\n\t@activity = Activity.new\n\ttime = Time.now\n\t#set attributes\n\t@activity.description = params[:description]\n\t@activity.user_id = params[:user_id]\n\t@activity.parent_or_child = params[:user_type]\n\t@activity.type = params[:type]\n\t@activity.created_at = Date.new(2011,4,17)\n\t@activity.created_at_time = time\n\n\t#save activity\n\t@activity.save\nend",
"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 activities=(value)\n @activities = value\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 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 create\n @breadcrumb = 'create'\n @activity = Activity.new(params[:activity])\n @activity.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: crud_notice('created', @activity) }\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\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 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 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 scrape_today\n url = \"https://www.timeout.com/melbourne/things-to-do/things-to-do-in-melbourne-today\"\n unparsed_page = HTTParty.get(url)\n parsed_page = Nokogiri::HTML(unparsed_page.body)\n items = parsed_page.css('div.card-content')\n items.each do |activity|\n activity = {\n title: activity.css('h3.card-title').text.strip,\n description: activity.css('p').text } \n @today_activities << activity \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 [@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 create\n @goal = current_user.goals.build(goal_params)\n\n # iterate throught dates\n puts goal_params[:start_date]\n puts goal_params[:duration]\n\n if goal_params[:start_date] != \"\" && goal_params[:duration] != \"\"\n start_date = Date.parse(goal_params[:start_date])\n end_date = start_date + goal_params[:duration].to_i - 1\n\n start_date.upto(end_date) do |date|\n @goal.activities.build({done: false, due_date: date})\n end\n end\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to goals_path, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.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 process_today_activities\n i=0\n while i < 10\n item = {name: today_activities[i][:title], value: i+1.to_i} \n \n @processed_today << item\n \n i += 1 \n end \n \n end",
"def create\n @spot_activity = SpotActivity.new(params[:spot_activity])\n\n respond_to do |format|\n if @spot_activity.save\n format.html { redirect_to(@spot_activity, :notice => 'SpotActivity was successfully created.') }\n format.xml { render :xml => @spot_activity, :status => :created, :location => @spot_activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @spot_activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def postActivity_stream( entity_id, entity_name, type, country, longitude, latitude)\n params = Hash.new\n params['entity_id'] = entity_id\n params['entity_name'] = entity_name\n params['type'] = type\n params['country'] = country\n params['longitude'] = longitude\n params['latitude'] = latitude\n return doCurl(\"post\",\"/activity_stream\",params)\n end",
"def create\n if current_user\n @activity = Activity.new(activity_params)\n @activity.user_id = current_user.id\n\n respond_to do |format|\n if @activity.save\n\n # add owner to going to activity\n Goingtoactivity.create(user_id: @activity.user_id, activity_id: @activity.id)\n\n format.json { render :show, status: :created, location: @activity }\n else\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.json { render :json => {:success=>false, :message=>\"Something's wrong with the token. current_user is nil.\"} }\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 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 create\n @user_activity = UserActivity.new(user_activity_params)\n\n respond_to do |format|\n if @user_activity.save\n format.html { redirect_to @user_activity, notice: 'User activity was successfully created.' }\n format.json { render :show, status: :created, location: @user_activity }\n else\n format.html { render :new }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n attendance_params[:checkin] = attendance_params[:checkin].to_time\n attendance_params[:checkout] = attendance_params[:checkout].to_time\n attendance_params[:attendance_date] = attendance_params[:attendance_date].to_date\n\n r = @api.create_attendance(attendance_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to attendances_url, notice: 'Attendance was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to attendances_url, alert: response['message']}\n end\n end\n end",
"def daily_activity_aaa\n\t\t@work_flows = WorkFlow.where(is_active: true)\n\t\t@workflows = WorkFlow.where(is_active: true, is_in_use: false)\n\t\tif request.post? or session[:daily_activity_report_date].present?\n\t\t\tif request.post?\n\t\t\t\t@daily_report_date = params[:daily_report_date]\n\t\t\t\tsession[:daily_activity_report_date] = @daily_report_date\n\t\t\telse\n\t\t\t\t@daily_report_date = session[:daily_activity_report_date]\n\t\t\tend\n\t\t\tdate = L1.set_db_date_format(@daily_report_date)\n\t\t\tq_string = \"STR_TO_DATE( '#{date}', '%Y-%m-%d') = STR_TO_DATE(created_at, '%Y-%m-%d')\"\n\t\t\tworkflow = params[:work_flow]\n\t\t\tif workflow.present?\n\t\t\t\tq_string += \"and work_flow_id = #{workflow}\"\n\t\t\telse\n\t\t\t\tq_string += \"and work_flow_id = #{@workflow.id}\"\n\t\t\tend\n\t\t\t@logs = TimestampLog.where(q_string)\n\t\tend\n\tend",
"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 activity_params\n params.require(:activity).permit(:name, :description, :location, :start, :end, :deadline, :reminder_at, :subgroup_division_enabled, :no_response_action)\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 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 create\n @activity = Activity.new(params[:activity])\n\t\tauthorize! :create, @activity\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to(activities_url) }\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 activities(time = nil, filter = nil)\n parse_xml(*activities_xml(time, filter))\n end",
"def create\n @activity_event = ActivityEvent.new(params[:activity_event])\n\n respond_to do |format|\n if @activity_event.save\n format.html { redirect_to @activity_event, notice: 'Activity event was successfully created.' }\n format.json { render json: @activity_event, status: :created, location: @activity_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_activity = UserActivity.new(user_activity_params)\n\n respond_to do |format|\n if @user_activity.save\n format.html { redirect_to customer_path(@user_activity.customer_id), notice: 'User activity was successfully created.' }\n format.json { render :show, status: :created, location: @user_activity }\n else\n format.html { render :new }\n format.json { render json: @user_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(activity_params)\n\n if @activity.save\n redirect_to activities_path\n else\n render 'new'\n end\n\n end",
"def create\n @activity = Activity.new(params[:activity])\n @activity.user = current_user\n @activity.organization = current_user.organization\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activity_path(@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\n @activity = PublicActivity::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 @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 create\n @my_activity = MyActivity.new(params[:my_activity])\n\n respond_to do |format|\n if @my_activity.save\n @all_activites = MyActivity.where(\"user_id =?\", current_user.id).order('created_at DESC').limit(10)\n #format.html { redirect_to @my_activity, notice: 'My activity was successfully created.' }\n #format.json { render json: @my_activity, status: :created, location: @my_activity }\n format.html {redirect_to new_my_activity_path}\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @user = current_user\n @activities = Activity.where({processed: 1, user_id: current_user.id}).order('activity_date')\n #@new_activities = Activity.where({processed: 0, user_id: current_user.id}).order('activity_date')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activities }\n end\n end",
"def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def index\n @search_activities = @site.search_activities.order('stamped_at desc').paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @search_activities }\n end\n end",
"def create\n act=params[:activity]\n params[:activity][:user_id]=session[:current_user_id]\n params[:activity][:location_id]=params[:location_id]\n\n @activity = Activity.new(params[:activity])\n\n\n\n respond_to do |format|\n if @activity.save\n if params[:tag]!=nil\n params[:tag].each do |f|\n ActivityTag.create({:activity_id=>@activity.id,:tag_id=>f})\n @tag=Tag.find(f)\n @tag.update_attributes({:refnum=>@tag.refnum+1})\n end\n end\n ActivityUserAction.create({:activity_id=>@activity.id,:action_type=>'create',:user_id=>session[:current_user_id]})\n ActivityRef.create({:activity_id=>@activity.id,:ref_name=>'comment',:refnum=>0})\n ActivityRef.create({:activity_id=>@activity.id,:ref_name=>'share',:refnum=>0})\n ActivityRef.create({:activity_id=>@activity.id,:ref_name=>'watch',:refnum=>0})\n ActivityRef.create({:activity_id=>@activity.id,:ref_name=>'in',:refnum=>0})\n\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n format.js {render :nothing=>true}\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 # TODO: Need to move this logic to Model ??\n # Get max activity number\n current_activity_number = Activity.maximum(:activity_id, :conditions => [\"issue_id = ?\", activity_params[:issue_id]])\n\n # Set next activity number\n if current_activity_number\n next_activity_number = current_activity_number + 1\n else\n next_activity_number = 1\n end\n @activity.activity_id = next_activity_number\n\n # Convert blank into zero\n @activity.hours = 0 if @activity.hours.blank?\n @activity.minutes = 0 if @activity.minutes.blank?\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 daily_activity\n\t\t@work_flows = WorkFlow.where(is_active: true)\n\t\t@workflows = WorkFlow.where(is_active: true, is_in_use: false)\n\t\tif request.post? or session[:daily_activity_report_date].present?\n\t\t\tif request.post?\n\t\t\t\t@daily_report_date = params[:daily_report_date]\n\t\t\t\tsession[:daily_activity_report_date] = @daily_report_date\n\t\t\telse\n\t\t\t\t@daily_report_date = session[:daily_activity_report_date]\n\t\t\tend\n\t\t\tdate = L1.set_db_date_format(@daily_report_date)\n\t\t\tq_string = \"STR_TO_DATE( '#{date}', '%Y-%m-%d') = STR_TO_DATE(timestamp_logs.created_at, '%Y-%m-%d')\"\n\t\t\tworkflow = params[:work_flow]\n\t\t\tif workflow.present? \n\t\t\t\t@searched_work_flow = workflow\n\t\t\t\tq_string += \"and timestamp_logs.work_flow_id = #{workflow}\"\n\t\t\telse\n\t\t\t\t@searched_work_flow = @workflow.id\n\t\t\t\tq_string += \"and timestamp_logs.work_flow_id = #{@workflow.id}\"\n\t\t\tend\n\t\t\t@report_serach_result = WorkFlow.daily_report_serach(q_string)\n\t\tend\n\tend",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity_params\n res = params.require(:activity).permit(:activity_date, :place, :content, :activity_type_id, :starter_id, :status, :activity_end_time)\n if res[:activity_date].size > 0\n res[:activity_date] = Time.strptime(res[:activity_date], '%m/%d/%Y %H:%M')\n end\n if res[:activity_end_time].size > 0\n res[:activity_end_time] = Time.strptime(res[:activity_end_time], '%m/%d/%Y %H:%M')\n end\n res\n end",
"def update\n @today_activity = TodayActivity.find(params[:id])\n\n respond_to do |format|\n if @today_activity.update_attributes(params[:today_activity])\n flash[:notice] = 'TodayActivity was successfully updated.'\n format.html { redirect_to(@today_activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @today_activity.errors, :status => :unprocessable_entity }\n end\n end\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 # Obtain user information by searching for username\n @user = User.find_by_username(params[:username])\n @activity = @user.activities.new(activity_params)\n if @activity.save\n flash[:success] = \"Activity Successfully Added!\"\n redirect_to calendar_path(@user.username)\n else\n render 'new'\n end\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 scrape_weekend\n url = \"https://www.timeout.com/melbourne/things-to-do/things-to-do-in-melbourne-this-weekend\"\n unparsed_page = HTTParty.get(url)\n parsed_page = Nokogiri::HTML(unparsed_page.body)\n items = parsed_page.css('div.card-content')\n items.each do |activity|\n activity = {\n title: activity.css('h3.card-title').text.strip,\n description: activity.css('p').text } \n @weekend_activities << activity \n end \n end",
"def create\n @activity_log = ActivityLog.new(create_params)\n\n respond_to do |format|\n if @activity_log.save\n format.html { redirect_to @activity_log, notice: 'Activity log was successfully created.' }\n format.json { render :show, status: :created, location: @activity_log }\n else\n format.html { render :new }\n format.json { render json: @activity_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_activity = UserActivity.new(user_activity_params)\n @user_activity.user_id = current_user.try(:id)\n \n respond_to do |format|\n if @user_activity.save\n format.html { redirect_to @user_activity, notice: \"User activity was successfully created.\" }\n format.json { render :show, status: :created, location: @user_activity }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activity_params\n params.fetch(:activity, {}).permit(:name, :date, :calories, :description, :activity => [:hours, :minutes, :seconds])\n end",
"def daily_activity_params\n params.require(:daily_activity).permit(:name, :kind, :date, :description, :dog_id, :time, :id)\n end"
] |
[
"0.62320113",
"0.60473484",
"0.60353965",
"0.5974586",
"0.5961937",
"0.5950495",
"0.59354126",
"0.5923211",
"0.5879357",
"0.5876503",
"0.58538103",
"0.5826054",
"0.5824398",
"0.58243537",
"0.5814983",
"0.57971054",
"0.5758822",
"0.57548803",
"0.5734489",
"0.5684397",
"0.5671626",
"0.5655172",
"0.56456333",
"0.56456333",
"0.55901164",
"0.55728215",
"0.55655384",
"0.55484575",
"0.5544404",
"0.554371",
"0.55375516",
"0.5523499",
"0.5516082",
"0.550026",
"0.5497707",
"0.549135",
"0.5482409",
"0.5481112",
"0.5481112",
"0.54805267",
"0.5476973",
"0.5471181",
"0.5463955",
"0.546185",
"0.54543245",
"0.5446337",
"0.5441427",
"0.54373693",
"0.54370564",
"0.54357165",
"0.5433963",
"0.54269874",
"0.54177266",
"0.5412519",
"0.5410574",
"0.5410422",
"0.5393133",
"0.5391743",
"0.53898185",
"0.53773785",
"0.537727",
"0.53653944",
"0.5362447",
"0.5354796",
"0.53493357",
"0.5345875",
"0.53457874",
"0.5336296",
"0.53359956",
"0.53302044",
"0.5327315",
"0.5325099",
"0.5307867",
"0.5295938",
"0.52958906",
"0.5283339",
"0.52825826",
"0.52817214",
"0.5277453",
"0.5274053",
"0.52644175",
"0.5258176",
"0.52572554",
"0.52534014",
"0.5246056",
"0.5241804",
"0.5239604",
"0.52386504",
"0.52368957",
"0.52368957",
"0.52355415",
"0.5230441",
"0.5224314",
"0.5223265",
"0.52220637",
"0.5216885",
"0.520399",
"0.5200344",
"0.51983094",
"0.5198109"
] |
0.663838
|
0
|
PUT /today_activities/1 PUT /today_activities/1.xml
|
def update
@today_activity = TodayActivity.find(params[:id])
respond_to do |format|
if @today_activity.update_attributes(params[:today_activity])
flash[:notice] = 'TodayActivity was successfully updated.'
format.html { redirect_to(@today_activity) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @today_activity.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 update\n @activity = Activity.find(params[:id])\n\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 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 @evactivity = Evactivity.find(params[:id])\n\n respond_to do |format|\n if @evactivity.update_attributes(params[:evactivity])\n flash[:notice] = 'Evactivity was successfully updated.'\n format.html { redirect_to(@evactivity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evactivity.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.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 update\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.update(activity_params)\n format.html { redirect_to \"/events/#{@event.id}\", 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 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 @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 @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Attività aggiornata correttamente'\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 update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = I18n.t('activities.controller.Successfully_updated')\n format.html { redirect_to(activities_path) }\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 update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\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\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 update\n @spot_activity = SpotActivity.find(params[:id])\n\n respond_to do |format|\n if @spot_activity.update_attributes(params[:spot_activity])\n format.html { redirect_to(@spot_activity, :notice => 'SpotActivity was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spot_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 :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 @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\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_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\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 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 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\n @activity_event = ActivityEvent.find(params[:id])\n\n respond_to do |format|\n if @activity_event.update_attributes(params[:activity_event])\n format.html { redirect_to @activity_event, notice: 'Activity event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_event.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 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 update\n #@activity = Activity.find(params[:id])\n @activity = Activity.find_by_permalink(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.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 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 @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 @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 # 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 @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to( course_path(params[:course_id]), :notice => 'Lista de presença salva com sucesso') }\n format.html { redirect_to(@activity, :notice => 'activity was successfully updated.') }\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 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\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 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 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 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\n @recent_activity = RecentActivity.find(params[:id])\n\n respond_to do |format|\n if @recent_activity.update_attributes(params[:recent_activity])\n format.html { redirect_to @recent_activity, notice: 'Recent activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recent_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 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 update\n @activity = Activity.find(params[:id])\n\t\tauthorize! :update, @activity\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(activities_url) }\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 update\n ap = activity_params\n if !ap[:points].nil?\n doc = Nokogiri::XML(ap[:points].read)\n parse_gpx(doc,ap)\n end\n\n respond_to do |format|\n if @activity.update(ap)\n @activity.save\n\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 @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 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 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 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 test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end",
"def edit_activity\n @activity = Activity.find(params[:id])\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def publish_xml(activity_xml)\n logger.info(\"Publishing activities for #{self.name}\")\n publisher_path = \"#{self.uri}/activity.xml\"\n post(publisher_path, activity_xml)\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\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 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 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 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 create\n @today_activity = TodayActivity.new(params[:today_activity])\n\n respond_to do |format|\n if @today_activity.save\n flash[:notice] = 'TodayActivity was successfully created.'\n format.html { redirect_to(@today_activity) }\n format.xml { render :xml => @today_activity, :status => :created, :location => @today_activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @today_activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def activities=(value)\n @activities = value\n end",
"def update\n @activity_tag = ActivityTag.find(params[:id])\n\n respond_to do |format|\n if @activity_tag.update_attributes(params[:activity_tag])\n format.html { redirect_to @activity_tag, notice: 'Activity tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update\n @activity_item = ActivityItem.find(params[:id])\n\n respond_to do |format|\n if @activity_item.update_attributes(params[:activity_item])\n format.html { redirect_to @activity_item, notice: 'Activity item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def set_activity\n @activity = Activity.find(params[:id])\n end",
"def update!(**args)\n @activities = args[:activities] if args.key?(:activities)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end",
"def update!(**args)\n @activities = args[:activities] if args.key?(:activities)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end"
] |
[
"0.631074",
"0.607107",
"0.6034178",
"0.60261756",
"0.6022064",
"0.5983958",
"0.59805375",
"0.5972873",
"0.59531415",
"0.59507155",
"0.59136194",
"0.58991814",
"0.58951575",
"0.5884823",
"0.58019334",
"0.5793046",
"0.57847863",
"0.57422596",
"0.5723481",
"0.5698547",
"0.5688626",
"0.5684982",
"0.56825554",
"0.56825554",
"0.56825554",
"0.56820345",
"0.5681814",
"0.56793046",
"0.56730366",
"0.5658723",
"0.56566226",
"0.5656101",
"0.5645876",
"0.5642579",
"0.56378525",
"0.5629725",
"0.5628816",
"0.5625705",
"0.56238973",
"0.56238973",
"0.56238973",
"0.56238973",
"0.56238973",
"0.5613245",
"0.5605679",
"0.55848986",
"0.5568184",
"0.5550557",
"0.55500513",
"0.5548803",
"0.55356854",
"0.5532604",
"0.55160683",
"0.55045885",
"0.5496538",
"0.5495174",
"0.5494251",
"0.5494251",
"0.54911536",
"0.54911536",
"0.54911536",
"0.54911536",
"0.54911536",
"0.54911536",
"0.54911536",
"0.54911536",
"0.547917",
"0.547044",
"0.5465408",
"0.5457241",
"0.5443193",
"0.5442112",
"0.5429452",
"0.54268384",
"0.54237574",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5423053",
"0.5419612",
"0.5419612"
] |
0.6804169
|
0
|
DELETE /today_activities/1 DELETE /today_activities/1.xml
|
def destroy
@today_activity = TodayActivity.find(params[:id])
@today_activity.destroy
respond_to do |format|
format.html { redirect_to(today_activities_url) }
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 delete_activity(db, act_id)\n\tdb.execute(\"DELETE FROM activities WHERE id=?\", [act_id])\nend",
"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 @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 = 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 RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n # @activity.destroy\n # instead lets be lets be more gentle:\n @activity.archived = true;\n @activity.save\n respond_to do |format|\n format.html { redirect_to(:action => 'index', :page => params[:page] || 1) }\n format.xml { head :ok }\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 delete_activities\n self.activities.delete_all\n end",
"def destroy_activity\n @activity = Activity.find(params[:id])\n @activity.destroy\n end",
"def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_path(params[:course_id])) }\n format.xml { head :ok }\n end\n end",
"def destroy\n activity = Activity.find(params[:id])\n activity.destroy\n redirect_to root_url\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 delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\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 if Activity.exists?(uuid: params[:id])\n @activity = Activity.find_by(uuid: params[:id])\n @activity.destroy\n end\n end",
"def destroy\n @datetime.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env['HTTP_REFERER'] }\n format.xml { head :ok }\n end\n end",
"def destroy\n @attendance = Attendance.find(params[:id])\n @attendance.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action=>'today') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity = Activity.find(params[:id])\n\n @activity.destroy\n\n redirect_to activities_path\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def delete_all(date = Date.today)\n delete(date.strftime(@request_path))\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\n if @activity.created_at < 1.day.ago\n \tauthorize! :edit, @activity\n end\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @activity = Activity.find(params[:id])\n\t\tauthorize! :destroy, @activity\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 @spot_activity = SpotActivity.find(params[:id])\n @spot_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(spot_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.json { head :ok }\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 @vehicle_daily = VehicleDaily.find(params[:id])\n @vehicle_daily.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicle_dailies_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_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 @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 @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 @group_activity = GroupActivity.find(params[:id])\n @group_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(group_activities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bday = Bday.find(params[:id])\n @bday.destroy\n\n respond_to do |format|\n format.html { redirect_to(bdays_url) }\n format.xml { head :ok }\n end\n end",
"def delete_activity(title, url)\n logger.info \"Deleting '#{title}'\"\n navigate_to url\n wait_for_load_and_click settings_link_element\n confirm(true) { wait_for_update_and_click delete_link_element }\n list_item_element(xpath: \"//li[contains(.,'#{title} deleted successfully')]\").when_present Utils.short_wait\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 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 @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 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 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 delete_all(xpath); end",
"def delete\n client.delete(\"/#{id}\")\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.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>[]}}\n \n end\n end",
"def destroy\n @recent_activity = RecentActivity.find(params[:id])\n @recent_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to recent_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @node = @delivery_date.node\n @environment = @delivery_date.environment\n add_activity_to_subscribers_inbox(@delivery_date.create_activity :destroy, owner: @current_user, parameters: {environment: @environment.name, node: @node.id})\n @delivery_date.destroy\n respond_to do |format|\n format.html { redirect_to @node, notice: 'Delivery date was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n Iterable.request(conf, base_path).delete\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 @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 @daily_grr = DailyGrr.find(params[:id])\n @daily_grr.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_daily_grrs_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n\t@activity = Activity.get params[:id]\n\t@title = \"Confirm deletion of note ##{params[:id]}\"\n\t#redirect to delete page\n\terb :delete\nend",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.html { redirect_to(visits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @appointment = Appointment.find(params[:id])\n @appointment.destroy\n\n respond_to do |format|\n format.html { redirect_to(appointments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @appointment = Appointment.find(params[:id])\n @appointment.destroy\n\n respond_to do |format|\n format.html { redirect_to(appointments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @appointment = Appointment.find(params[:id])\n @appointment.destroy\n\n respond_to do |format|\n format.html { redirect_to(appointments_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\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 delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\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\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @appointment_request = AppointmentRequest.find(params[:id])\n @appointment_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(appointment_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @the_day = TheDay.find(params[:id])\n @the_day.destroy\n\n respond_to do |format|\n format.html { redirect_to(the_days_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity_inventory = ActivityInventory.find(params[:id])\n @activity_inventory.destroy\n\n respond_to do |format|\n format.html { redirect_to(activity_inventories_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_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.destroy\n flash[:success] = \"Activity deleted\"\n\n format.html { redirect_to(people_url(current_user)) }\n end",
"def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end",
"def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @audit_log = AuditLog.find(params[:id])\n @audit_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(audit_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity_event = ActivityEvent.find(params[:id])\n @activity_event.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attendance = Attendance.find(params[:id])\n @attendance.destroy\n\n respond_to do |format|\n format.html { redirect_to(attendances_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @document.create_activity :destroy, owner: current_user\n @document.destroy\n respond_to do |format|\n format.html { redirect_to documents_url, notice: 'Document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @viewdate = Viewdate.find(params[:id])\n @viewdate.destroy\n\n respond_to do |format|\n format.html { redirect_to(viewdates_url) }\n format.xml { head :ok }\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 deleteEntityOpening_times( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/opening_times\",params)\n end",
"def destroy\n @dailyreport = Dailyreport.find(params[:id])\n @dailyreport.destroy\n\n respond_to do |format|\n format.html { redirect_to(dailyreports_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @activity_item = ActivityItem.find(params[:id])\n @activity_item.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_items_url }\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 association_activites_url(@association) }\n format.xml { head :ok }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n authorize @eventunscraped\n @eventunscraped.create_activity :destroy, owner: current_user\n @eventunscraped.destroy\n respond_to do |format|\n format.html { redirect_to eventunscrapeds_url, notice: 'Eventunscraped 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 delete\n\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @auditflows_flownode = AuditflowsFlownode.find(params[:id])\n @auditflows_flownode.destroy\n\n respond_to do |format|\n format.html { redirect_to(auditflows_flownodes_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.66917735",
"0.6593528",
"0.6591737",
"0.6578982",
"0.65553606",
"0.65204775",
"0.65204775",
"0.65204775",
"0.65204775",
"0.6473795",
"0.6459832",
"0.6441286",
"0.6338811",
"0.62965286",
"0.6288732",
"0.6274719",
"0.62332684",
"0.622137",
"0.61857164",
"0.61740637",
"0.6173595",
"0.61430806",
"0.613659",
"0.61236197",
"0.6122782",
"0.61197984",
"0.61087877",
"0.6101613",
"0.60955524",
"0.6076689",
"0.607027",
"0.60640734",
"0.6041801",
"0.6041801",
"0.6041801",
"0.6041801",
"0.6041801",
"0.60354334",
"0.60354334",
"0.60291547",
"0.60291547",
"0.6003757",
"0.5997263",
"0.597044",
"0.5967431",
"0.59371066",
"0.59308326",
"0.5906392",
"0.590242",
"0.59015846",
"0.5901195",
"0.5895159",
"0.58929163",
"0.58768845",
"0.5873339",
"0.58626586",
"0.5861011",
"0.5855028",
"0.5838299",
"0.58294934",
"0.58135223",
"0.58135223",
"0.58135223",
"0.5810387",
"0.5807842",
"0.5807129",
"0.57981366",
"0.5797295",
"0.57971823",
"0.57889754",
"0.5788459",
"0.5780895",
"0.57738733",
"0.57738733",
"0.57738733",
"0.57738733",
"0.57738733",
"0.57738733",
"0.5773527",
"0.5766609",
"0.5765912",
"0.5762347",
"0.5759866",
"0.5751413",
"0.57511044",
"0.57489747",
"0.5740713",
"0.5740713",
"0.5740713",
"0.5740713",
"0.57380223",
"0.5736478",
"0.5735967",
"0.5732868",
"0.5717344",
"0.5715425",
"0.5713714",
"0.5708547",
"0.57048905",
"0.5703381"
] |
0.71921545
|
0
|
In the following 6 digit number: 283910 91 is the greatest sequence of 2 digits. Complete the solution so that it returns the largest five digit number found within the number given.. The number will be passed in as a string of only digits. It should return a five digit integer. The number passed may be as large as 1000 digits.
|
def solution(digits)
digits.scan(/\d{5}/).max.to_i
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def solution(digits)\n greatest = 0\n (0..(digits.size - 1)).each do |pos|\n num = digits[pos..pos+5].to_i\n greatest = num if num > greatest\n end\n greatest \nend",
"def solution(digits)\n digits.split('').each_cons(5).max.join.to_i\nend",
"def solution(digits)\n\tstop = digits.length - 4\n\tgo = 0\n\tlargest_number = 0\n\tindex = 0\n\n\twhile go < stop\n\t\ttest = \"\"\n\t\textra_index = index\n\t\t5.times do \n\t\t\ttest += digits[extra_index].to_s\n\t\t\textra_index += 1 \n\t\tend\n\t\tif test.to_i > largest_number\n\t\t\tlargest_number = test.to_i\n\t\tend \n\t\tindex += 1\n\t\tgo += 1 \n\tend \n\tlargest_number\nend",
"def solution(digits)\n digits.to_s.split(\"\").each_cons(5).max.join.to_i\nend",
"def maxNumber(num)\n \n num.digits.sort {|a,b| b <=> a}.join.to_i\n \nend",
"def solution(digits)\n digits.chars.each_cons(5).max_by(&:itself).join.to_i\nend",
"def largest_digit(input)\n\t\tcreate_array(input).max.to_i\n\tend",
"def largest_five(digits)\r\n\r\nend",
"def max_number(n)\nn = n.to_s\narr = []\n n.length.times do |i|\n arr << n[i].to_i\n end\narr.sort!.reverse!\nstr= \"\"\narr.each do |i| str = str + \"#{i}\"\nend\nstr.to_i\nend",
"def solution(digits)\n\tlargest = (digits[0]+digits[1]+digits[2]+digits[3]+digits[4]).to_i\n\ti = 4\n\twhile i < digits.length\n\t\ttester = (digits[i-4]+digits[i-3]+digits[i-2]+digits[i-1]+digits[i]).to_i\n\t\tif tester > largest\n\t\t\tlargest = tester\n\t\tend \n\t\ti += 1\n\tend \n\tlargest\nend",
"def largest_number_digit\n (@primes.last ** 2).to_s.length\n end",
"def largest(number_of_digits)\n ('9' * number_of_digits).to_i\nend",
"def find_largest_5 string\n max, number_array = 0, string.split(\"\").map(&:to_i)\n (0...number_array.size-4). each do |i|\n product = number_array[i..i+4].inject(:*)\n max = product if(product>max)\n end\n max\nend",
"def largest_consecutives_5(number)\n\tnumber = number.split('')\n\tproduct= 0 \n\n\twhile number.size > 0\n\t\tnew_product = number[0].to_i * number[1].to_i * number[2].to_i * number[3].to_i * number[4].to_i \n#convert the splitted digits to single ones\n\t\tproduct = new_product > product ? new_product : product\n #if the new product is greater than the original, then the new_product becomes the original. if true, the variable before the ':' will pass. if not, the latter\n \t\tnumber.shift\n #removes the first number and returns it\n \tend\n \tproduct\n end",
"def max_number(string)\n string.scan(/\\d/).size\nend",
"def solution(n)\n n.to_s(2).reverse.to_i.to_s.split('1').map(&:length).max || 0\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 max_number_in_string(string=\"89563 4777 10\")\n array = string.gsub(/[^\\d]/, '|').split('|')\n new_array = Array.new\n array.each {|el| new_array.push(el.to_i) }\n puts new_array.max\n end",
"def biggest_possible_digit_factorial\n digits = 1\n \n loop do \n digits += 1\n break if digits * factorial(9) < ('9' * digits).to_i\n end\n ('9' * digits).to_i\nend",
"def euler038\n (9213..9876)\n .map{ |x| x.to_s + (x*2).to_s }\n .select{ |f| f.chars.sort.join == \"123456789\" }\n .map{ |f| f.to_i }\n .max\nend",
"def largest_palindrome(num_of_digits)\r\n\tmax_number_string = \"\"\r\n\tnum_of_digits.times { max_number_string += \"9\"}\r\n\tmax_product = max_number_string.to_i ** 2\t\t# e.g: 999* 999 = 998001\r\n\t\r\n\tsub_string = (max_product.to_s)[0..(max_product.to_s).length/2 - 1]\r\n\tsub_string_number = sub_string.to_i \r\n\t\r\n\tdelta = 1\r\n\tdelta.upto(sub_string_number) { |x|\r\n\t\tpalindrome = ((sub_string_number - x).to_s + (sub_string_number - x).to_s.reverse).to_i\r\n\t\t\r\n\t\tfactor = sub_string_number\r\n\t\tfactor.downto(10**(num_of_digits - 1)) { |div|\r\n\t\t\treturn div, (palindrome/div) if (palindrome % div == 0) and (palindrome/div).to_s.length == num_of_digits\r\n\t\t}\r\n\t}\r\nend",
"def solution(n)\n # write your code in Ruby 2.2\n a = n.to_s(2)\n arr = []\n if a[-1] == '1'\n arr = a.split('1')\n else\n arr = a.split('1')\n arr.pop\n end\n if arr.max.nil?\n 0\n else\n arr.max.length\n end\nend",
"def solution(n)\n max = 0\n tmp = 0\n n.to_s(2).each_char do |s|\n if s == \"0\"\n tmp += 1\n else\n max = [tmp, max].max\n tmp = 0\n end\n end\n max\nend",
"def get_max_num\n r,t,a = 0, 0, 9**self\n while r < t.to_s.size\n r,t = r + 1, t+a\n end\n return t\n end",
"def solution(digits)\n result = 0\n digits.size.times do |n|\n new_number = digits[n...(n + 5)].to_i\n result = new_number if new_number > result\n end\n result\nend",
"def getMaxNumber(str, num)\n number = 0\n dict = countCardValue(str)\n dict.each do |i, j|\n if j == num\n number = i\n end\n end\n replaceCharToNumber(number)\nend",
"def next_bigger_num(num)\r\n digits = num.digits\r\n sorted_digits = digits.sort { |a, b| b <=> a }\r\n if digits.count(digits[0]) == digits.size || digits.size < 2 || sorted_digits == digits.reverse\r\n return -1\r\n end\r\n \r\n permutation = digits.permutation.to_a.map do |sub_arr|\r\n sub_arr.join('').to_i\r\n end\r\n \r\n sorted_permutation = permutation.sort\r\n \r\n sorted_permutation.each do |current_num|\r\n return current_num if current_num > num\r\n end\r\nend",
"def next_bigger_num(num)\n return -1 if num if num.digits.all? {|digit| digit == num[0]}\n return -1 if num.digits.sort! {|a,b| b <=> a}.join.to_i == num\n \n combinations = num.digits.permutation(num.digits.length).to_a\n \n combinations.map! do |arr|\n arr.join.to_i\n end.sort!\n \n combinations.each.with_index do |number, index|\n return combinations[index + 1] if number == num\n end\n \nend",
"def find_max_number_of_digits(string=\"00 000 0\")\n array = string.gsub(/[^\\d]/, '|').split('|')\n max_number_of_digits = Array.new\n array.each {|el| max_number_of_digits.push(el.length) }\n puts max_number_of_digits.max\n end",
"def largest_number(n)\n num = []\n n.times do\n num << 9\n end\n puts num.join('').to_i\nend",
"def problem8(text)\n\tdigits = text.split('').map {|x| x.to_i }\n\t\n\treturn -1 if digits.length < 5\n\ti = 0\n\tj = 4\n\t\n\tmax = 1\n\tdigits[0..4].each do |d|\n\t\tmax *= d\n\tend\n\t\n\tmaxdigits = digits[0..4]\n\t\n\tbuffernum = max\n\twhile j < (digits.length - 1)\n\n\t\t#pop left digit\n\t\tif digits[i] == 0\n\t\t\tbuffernum = 1\n\t\t\tdigits[i+1..j].each { |x| buffernum *= x}\n\t\t\tputs buffernum\n\t\telse\n\t\t\tbuffernum /= digits[i]\n\t\tend\n\t\ti += 1\n\n\t\t#push right digit\n\n\t\tj += 1\n\t\tbuffernum *= digits[j]\n\t\tif buffernum > max\n\t\t\tmax = buffernum\n\t\t\tmaxdigits = digits[i..j]\n\t\tend\n\t\t\n\n\n\tend\n\t\n puts \"Max Product : #{max}\"\n\tputs \"Max Digits : #{maxdigits}\"\n\t\n\t\nend",
"def max_rotation(num)\n num_out = num\n num.to_s.length.downto(1) {|n|\n num_out = rotate_rightmost_digits(num_out, n)\n }\n num_out.to_i\nend",
"def largest_integer(list_of_nums)\n# Your Solution Below\n# Refactored solution\n\treturn list_of_nums.max\nend",
"def greatest_product(digits)\r\n\t# Get Number in one string. Can probably do this with greater optimization\r\n\tnumber = \"73167176531330624919225119674426574742355349194934\"\r\n number += \"96983520312774506326239578318016984801869478851843\"\r\n\tnumber += \"85861560789112949495459501737958331952853208805511\"\r\n\tnumber += \"12540698747158523863050715693290963295227443043557\"\r\n\tnumber += \"66896648950445244523161731856403098711121722383113\"\r\n\tnumber += \"62229893423380308135336276614282806444486645238749\"\r\n\tnumber += \"30358907296290491560440772390713810515859307960866\"\r\n\tnumber += \"70172427121883998797908792274921901699720888093776\"\r\n\tnumber += \"65727333001053367881220235421809751254540594752243\"\r\n\tnumber += \"52584907711670556013604839586446706324415722155397\"\r\n\tnumber += \"53697817977846174064955149290862569321978468622482\"\r\n\tnumber += \"83972241375657056057490261407972968652414535100474\"\r\n\tnumber += \"82166370484403199890008895243450658541227588666881\"\r\n\tnumber += \"16427171479924442928230863465674813919123162824586\"\r\n\tnumber += \"17866458359124566529476545682848912883142607690042\"\r\n\tnumber += \"24219022671055626321111109370544217506941658960408\"\r\n\tnumber += \"07198403850962455444362981230987879927244284909188\"\r\n\tnumber += \"84580156166097919133875499200524063689912560717606\"\r\n\tnumber += \"05886116467109405077541002256983155200055935729725\"\r\n\tnumber += \"71636269561882670428252483600823257530420752963450\"\r\n\t\r\n\tanswer = 0\r\n\r\n\t# Run through all possible 13 digit combinations\r\n\t(0..number.length-digits).each do |x|\r\n\t\t# Set localized product to the first digit in combo\r\n\t\tproduct = number[x].to_i\r\n\t\t# Multiply the rest of the digits in combo together\r\n\t\t((x+1)...x+digits).each do |n|\r\n\t\t\tproduct *= number[n].to_i\r\n\t\tend\r\n\t\t# If localized product is highest so far, set to answer\r\n\t\tanswer = product if product > answer\r\n\tend\r\n\tputs answer\r\nend",
"def largest_possible_product(num_of_digits)\n return ((\"9\" * num_of_digits).to_i) ** 2\nend",
"def highestProductOfConsecutiveDigits( seriesLength )\n longNum = '7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450'\n\n largestProduct = 1\n\n Range.new( 0, longNum.length - seriesLength ).each do | pos |\n slice = longNum[ pos, seriesLength ]\n newProduct = 1\n slice.each_char do | digit |\n newProduct *= digit.to_i\n end\n largestProduct = newProduct if newProduct > largestProduct\n end\n\n return largestProduct\nend",
"def find_max_nth_power(n)\r\n\tnum_of_digits = 2\r\n\r\n\t(num_of_digits += 1) until (num_of_digits * 9 ** n) < ((\"9\" * num_of_digits).to_i + 1)\r\n\r\n\t(\"9\" * (num_of_digits)).to_i\r\nend",
"def max_rotation(number)\n num_array = number.to_s.split(//)\n rotation = num_array.length\n loop do\n break if rotation == 1\n number = rotate_rightmost_digits(number, rotation)\n rotation -= 1\n end\n number\nend",
"def largest_palindrome_for_even_digits(n)\n max_val = 0\n multiplier_x = get_multiplier_x(n)\n n.downto(100) { |y|\n multiplier_x.each { |x|\n product = x * y\n if product.to_s == product.to_s.reverse\n max_val = [max_val, product].max\n end\n }\n }\n max_val\nend",
"def next_bigger(n)\n return -1 if n / 10 == 0 || same_digits?(n) || biggest?(n)\n digits_array = n.to_s.chars.map(&:to_i)\n n_length = digits_array.length\n i = 1\n until i == n_length\n if digits_array[n_length - i] > digits_array[n_length - 1 - i]\n # find next bigger num from the right\n b = digits_array[(n_length - i)..-1].sort.find { |x| x > digits_array[n_length - 1 - i] }\n digits_array.insert(n_length - 1 - i, b)\n # sort everything on the right and delete inserted num\n sorted = digits_array[(n_length - i)..-1].sort!\n sorted.delete_at(sorted.index(b))\n digits_array[(n_length - i)..-1] = sorted\n return digits_array.join.to_i\n end\n i += 1\n end\nend",
"def max_rotation(number)\n number_digits = number.to_s.size\n number_digits.downto(2) do |n|\n number = rotate_rightmost_digits(number, n)\n end\n number\nend",
"def max_rotation(number)\n number_digits = number.to_s.size\n number_digits.downto(2) do |n|\n number = rotate_rightmost_digits(number, n)\n end\n number\nend",
"def eight \n max = 0\n number = 7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450\n\n a = numTo_a(number, []) \n for i in 0..(a.length-1)-5\n acc = 1\n for j in 0..4\n acc = acc * a[i+j]\n end\n if acc > max\n max = acc\n end\n end\n return max\nend",
"def largest_integer(list_of_nums)\n return list_of_nums.max\nend",
"def max_rotation(num)\n number_string = num.to_s\n\n number_string.size.downto(2) do |i|\n num = rotate_rightmost_digits(num, i)\n end\n num\nend",
"def find_max_number(any_array)\n\treference = any_array[1]\n\tany_array.each do |number|\n\t\tif number > reference\n\t\treference = number\n\t\tend\n\tend \n\treference\nend",
"def largest_number(nums)\n nums.map { |x| x.to_s }.sort { |x, y| (x + y) <=> (y + x) }.reverse.join.sub(/^0+/, \"0\")\nend",
"def largest_integer(list_of_nums)\n if list_of_nums.length == 0\n return nil\n else\n biggie = list_of_nums[0]\n i = 0\n while i<list_of_nums.length do\n if list_of_nums[i] >= biggie\n biggie = list_of_nums[i]\n end\n i+=1\n end\n return biggie\n end\nend",
"def biggest_number(array_of_integers)\n # TODO\nend",
"def solution(n)\n # write your code in Ruby 2.2\n max = 0\n count = 0\n\n n.to_s(2).sub(/^0*/, '').each_char do |d|\n if d == '0'\n count += 1\n else\n max = count if max < count\n count = 0\n end\n end\n \n max\nend",
"def largest_integer(list_of_nums)\n list_of_nums.sort!\n return list_of_nums[-1]\nend",
"def largest_prime_factor(number)\n # start with the number and go backwards\n while number > 0\n numb_split = number.to_s.split('')\n numb_split_length = numb_split.length\n #p numb_split[numb_split_length - 1]\n if numb_split[numb_split_length - 1] == \"5\" || numb_split[numb_split_length - 1] == \"0\" \n\n \n elsif number%2 == 0 && number > 2 \n # definitely not prime\n elsif number%2 == 0 && number%3 == 0\n \n \n else\n # test if number is prime\n # if number is prime\n \n\n p number.to_s\n end\n number -= 1 \n end\n\nend",
"def max_rotation(number)\n starting_num = number.to_s.length\n starting_num.downto(2) do |digits|\n number = rotate_rightmost_digits(number, digits)\n end\n number\nend",
"def solution(n)\n # write your code in Ruby 2.2\n bin = n.to_s(2)\n return 0 unless bin =~ /0/i\n\n max = 0\n count = 0\n\n bin.each_char do |s|\n if s == '1'\n max = count if count > max\n count = 0\n else\n count += 1\n end\n end\n\n return max\nend",
"def max_rotation(int)\n rotated = int\n count = int.digits.size\n\n until count < 2\n rotated = rotate_rightmost_digits(rotated, count)\n count -= 1\n end\n rotated\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 largest_integer(list_of_nums)\n list_of_nums.sort!\n p list_of_nums[-1]\nend",
"def largest_integer(list_of_nums)\n return list_of_nums.sort().slice(-1)\nend",
"def max_rotation(num)\n num.to_s.size.downto(2) do |rotators|\n num = rotate_rightmost_digits(num, rotators)\n end\n num\nend",
"def largest_integer(list_of_nums)\n list_of_nums.sort!\n list_of_nums.reverse!\n return list_of_nums[0]\nend",
"def get_largest_prime_factor num\n get_largest_number(prime_factor_numbers(num))\nend",
"def find_largest_num(nums)\n\treturn nums.max()\nend",
"def longest_digit_run(digit)\nend",
"def euler(num)\n thousand = 7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450\n largest = 0\n working_ary = []\n thousand.to_s.split(\"\").each_cons(num) { |ary| working_ary << ary }\n working_ary.uniq!\n working_ary.each do |ary|\n if ary.reduce { |product, n| (product.to_i) * (n.to_i) } > largest\n largest = ary.reduce { |product, n| (product.to_i) * (n.to_i) }\n end\n end\n largest\nend",
"def max_rotation(int)\n int_digits = int.to_s.length\n rotation_iterations = int_digits - 1\n rotated_number = int\n rotation_iterations.times { |iteration| rotated_number = rotate_rightmost_digits(rotated_number, int_digits - iteration) }\n rotated_number\nend",
"def featured(number)\n max = 9_876_543_210\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n loop do\n number_chars = number.to_s.chars\n if number_chars.size == number_chars.uniq.size\n return number\n end\n if number > max\n break\n end\n number += 14\n end\n \"ERROR! No next featured number!\"\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 getLargestPalindrome()\n\tlargestPalindrome = 1\n\tx = 1\n\twhile x <= 999\n\t\ty = 1\n\t\twhile y <= 999\n\t\t\tproduct = x * y\n\t\t\tif product.to_s == product.to_s.reverse!\n\t\t\t\tlargestPalindrome = product\n\t\t\tend\n\t\t\ty = y + 1\n\t\tend\n\t\tx = x + 1\n\tend\n\treturn largestPalindrome\nend",
"def largest_palindrome(digits)\n\tnumbers = []\n\tx = (\"9\"*digits).to_i\n\ty = (\"9\"*digits).to_i\n\tlimit = ((\"9\"*(digits-1)).to_i)\n\twhile x > limit\n\t\ty.downto(limit+1) do |i|\n\t\t\tx*i == (x*i).to_s.reverse.to_i ? numbers << x*i : \"\"\n\t\tend\n\t\tx -= 1\n\tend\n\treturn numbers.sort.last\nend",
"def problem_eight\n big_number = File.read('big_number.txt')\n start, stop = 0, 5\n window = big_number[start, stop]\n largest_product = 0\n while stop < big_number.length\n current_product = window.split('').take(5).map(&:to_i).reduce(&:*)\n if current_product > largest_product\n largest_product = current_product\n end\n window = big_number[start += 1, stop += 1]\n end\n\n largest_product\n end",
"def max_num_of_digits(string)\n split_string = string.split('')\n digits = split_string.select { |el| el.to_i.to_s == el.to_s }\n return digits.count\nend",
"def largest_number (number_1, number_2)\n \n [number_1, number_2].max\n \nend",
"def find_highest_drome_mapping\n low = 100\n high = 999\n dromes = high.downto(low).map do |num_one|\n num_one.downto(low).map do |num_two|\n num_one * num_two if (num_one * num_two).to_s == (num_one * num_two).to_s.reverse\n end\n end\n dromes.flatten.compact.max\nend",
"def next_bigger(input) \n\treturn -1 if input <= 10\n\treversed_input = input.to_s.split(\"\").reverse.map { |m| m.to_i } # = [7,1,0,2]\n\treversed_input.each_with_index do |m,i|\n if m > reversed_input[i+1] # 7 > 1 then switch and break\n \tswitch = reversed_input[i+1]\n \treversed_input[i+1] = m\n \treversed_input[i] = switch\n \tbreak\n end \n\tend # reversed_input = [1,7,0,2] \n reversed_input.reverse.join(\"\").to_i # returns 2071\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 solution_reg(n)\n n.to_s(2)\n .scan(/(?<=1)0+(?=1)/)\n .map(&:length)\n .max.to_i\nend",
"def greatest_product(n)\n idx = 0\n largest_product = 0\n\n loop do\n sum = n[idx, 5].chars.map(&:to_i).inject { |mem, num| mem * num }\n largest_product = sum if sum > largest_product\n idx += 1\n break if idx >= n.length - 4\n end\n largest_product\nend",
"def longest_sequence(num, numbers)\n\tputs \"calculating for #{num}; #{100*num / 999983}% complete\"\n\tresults = [0]\n\tleft,right = 0,0\n\tsum = numbers[0]\n\twhile numbers[left] < num\n# \t\tputs \"sum=#{sum}\"\n# \t\tputs \"real sum=#{numbers[left..right].sum}\"\n\t\tcase sum <=> num\n\t\t\twhen -1: right += 1; sum += numbers[right]\n\t\t\twhen 0: results << (right - left + 1) ; sum-= numbers[left]; left+=1\n\t\t\twhen 1: sum-= numbers[left]; left+=1\n\t\tend\n\t\t\t\t\n\tend\n\treturn results.max\nend",
"def solution(n)\n binary_n = convert_to_binary(n)\n current, longest = 0, 0\n seen_start_one = false\n seen_end_one = false\n\n binary_n.each_char do |c|\n if c == \"0\"\n current += 1\n longest = [longest, current].max\n else\n current = 0\n end\n end\n\n longest\nend",
"def largest_int(numbers)\n\tnumbers.sort!\n\tnumbers[-1]\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 largest_integer(list_of_nums)\n largestnumber = list_of_nums.pop\n while list_of_nums.length > 0 do\n secondnum = list_of_nums.pop\n if largestnumber < secondnum\n largestnumber = secondnum\n end\n end\n p largestnumber\n\nend",
"def next_largest_number (array, given_number)\n array.find {|number| number > given_number}\nend",
"def highest_number_in_box n\n return 1 if n == 1\n highest_number_in_box(n - 1) + (8 * (n-1))\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 find_longest(arr)\n longest_num = 0 # current longest number\n most_digits = 0 # current most digits found in a number in the array\n\n arr.each do |num|\n digits_in_num = num.to_s.length\n if digits_in_num <= most_digits # if length of the current number is <= longest number yet - next\n next\n else # but if length is > than any other number we have seen yet -\n longest_num = num # set this num as new longest_num\n most_digits = digits_in_num # set the length of this num as the new standard to compare against\n end\n end\n longest_num\nend",
"def largest_integer(list_of_nums)\n # Your code goes here!\n list_sorted_array = []\n zero = 3-3\n \n if list_of_nums.empty?() == true\n return\n elsif list_of_nums.length == 1\n if list_of_nums.include?(0)\n return zero.to_i\n elsif list_of_nums.include?(-10)\n return -10\n end \n \n else \n \n list_sorted_array = list_of_nums.sort\n list_sorted_last = list_sorted_array.last\n list_sorted_first = list_sorted_array.first\n \n if list_sorted_last < list_sorted_first\n return list_sorted_first\n elsif list_sorted_last > list_sorted_first\n return list_sorted_last\n end \n \n end\n \nend",
"def largestPalindromicNumber(n_digits)\n # palindromes = []\n startPoint = (10**n_digits-1)**2\n endPoint = (10**(n_digits-1))**2\n i = startPoint\n while i >= endPoint do\n if isAPalindrome(i) && isNumAProductOfTwoNDigitNumbers(i, n_digits)\n puts i\n return i\n end\n i -= 1\n end\n p 'no product/palindromes found'\nend",
"def findLargestProduct\n \n solution = 0\n last = 4\n n = \"73167176531330624919225119674426574742355349194934969835203127745063262395783180169\n 8480186947885184385861560789112949495459501737958331952853208805511125406987471585238630\n 5071569329096329522744304355766896648950445244523161731856403098711121722383113622298934\n 2338030813533627661428280644448664523874930358907296290491560440772390713810515859307960\n 8667017242712188399879790879227492190169972088809377665727333001053367881220235421809751\n 2545405947522435258490771167055601360483958644670632441572215539753697817977846174064955\n 1492908625693219784686224828397224137565705605749026140797296865241453510047482166370484\n 4031998900088952434506585412275886668811642717147992444292823086346567481391912316282458\n 6178664583591245665294765456828489128831426076900422421902267105562632111110937054421750\n 6941658960408071984038509624554443629812309878799272442849091888458015616609791913387549\n 9200524063689912560717606058861164671094050775410022569831552000559357297257163626956188\n 2670428252483600823257530420752963450\"\n dataArray = n.chars.map(&:to_i)\n\n (0..995).each do |start| \n possible_sol = dataArray[start..last].inject(:*)\n \tsolution = possible_sol if possible_sol > solution \n \tlast += 1\n end\n\n solution\n\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 greatest_product(n)\r\n\r\n num_array = n.gsub(/\\n/,'').split('').map(&:to_i)\r\n max = 0\r\n i = 0\r\n while i < num_array.length - 13\r\n sum = num_array[i..i+12].reduce(:*)\r\n if sum > max\r\n max = sum\r\n end\r\n i += 1\r\n end\r\n max\r\nend",
"def max_rotation(original_num)\ncount = original_num.to_s.size\ncount.downto(2) do |num|\noriginal_num = rotate_rightmost_digits(original_num, num)\nend\noriginal_num\nend",
"def largest_integer(array)\n large = array[0]\n array.each do |n|\n if n > large\n large = n\n end\n end\n large\nend",
"def max_num_of_not_digits(string)\n split_string = string.split('')\n not_digits = split_string.select { |el| el.to_i.to_s != el.to_s }\n return not_digits.count\nend",
"def next_bigger(input)\n puts \"input = #{input}\"\n puts '------------------'\n puts\n puts\n\n digits = input.to_s.chars.map(&:to_i)\n\n return -1 if all_digits_are_the_same?(digits)\n\n result = input\n tail = -1\n next_tail = -1\n next_tail_digit = nil\n\n puts 'Starting iterations to find the bigger number by permutating digits from right to left...'\n puts\n while(tail.abs < digits.length && result <= input)\n next_tail = tail -1\n tail_digit = digits[tail]\n next_tail_digit = digits[next_tail]\n\n if to_number(next_tail_digit, tail_digit) > to_number(tail_digit, next_tail_digit)\n puts \"SKIPPING flipping since #{next_tail_digit}#{tail_digit} > #{tail_digit}#{next_tail_digit}\"\n else\n puts \"FLIPPING digits...\"\n puts \"digits before = #{digits}\"\n digits[tail] = next_tail_digit\n digits[next_tail] = tail_digit\n puts \"digits after = #{digits}\"\n\n result = digits.join.to_i\n\n puts \"tail = #{tail} digit = #{tail_digit}\"\n puts \"next_tail = #{next_tail} digit = #{next_tail_digit}\"\n puts \"result = #{result}\"\n end\n\n tail -= 1\n puts \"new_tail = #{tail}\"\n puts '--'\n puts ''\n end\n\n return -1 if result == input\n\n replaced_digit = next_tail_digit\n winning_digit = digits[next_tail]\n\n puts\n puts \"Iterations Completed and Bigger number found: #{result}\"\n puts \" - Digit that won was: #{winning_digit}.\"\n puts \" - It replaced the digit: #{replaced_digit} from input: #{input} at index #{next_tail}.\"\n puts\n puts \"Let see if we can make the number smaller by sorting the numbers to the right from bigger to smaller\"\n\n digits_before = digits.slice(0..next_tail)\n digits_after = digits.slice((next_tail+1)..-1)\n sorted_digits_after = sort_desc(digits_after)\n\n puts\n puts \"digits_before: #{digits_before}, digits_after: #{digits_after}\"\n puts \"Sorting digits after: #{sorted_digits_after}\"\n puts \"Resulting Number: #{array_to_number(digits_before + sorted_digits_after)}\"\n puts\n puts \"Now let see if we can find any number to the right of the winning position that\" \\\n \" is smaller than the number that won #{winning_digit} but bigger than the replaced digit #{replaced_digit}...\"\n\n index_of_digit_smaller_than_winner = sorted_digits_after.find_index { |d| d < winning_digit && d > replaced_digit }\n\n if index_of_digit_smaller_than_winner\n digit_smaller_than_the_winner = sorted_digits_after[index_of_digit_smaller_than_winner]\n puts\n puts \"We found it one! Since the array was already sorted we can trust that the one we found is the smalles one.\"\n puts \"Index: #{index_of_digit_smaller_than_winner} and number: #{digit_smaller_than_the_winner}\"\n puts \"Lets switch the winning number by this one now.\"\n puts \"Before: #{digits_before} + #{sorted_digits_after}\"\n\n digits_before[-1] = digit_smaller_than_the_winner\n sorted_digits_after[index_of_digit_smaller_than_winner] = winning_digit\n\n puts \"After: #{digits_before} + #{sorted_digits_after}\"\n puts\n puts \"We now have to sort the digits again because they may be out of order:\"\n sorted_digits_after = sort_desc(sorted_digits_after)\n puts \"After Re-Sorting: #{digits_before} + #{sorted_digits_after}\"\n puts\n end\n\n result = digits_before + sorted_digits_after\n result.join.to_i\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 find_max_num(numbers)\n if numbers.length == 0 \n \tputs \"No numbers were passed.\" \n elsif numbers.length > 0\n max_num = numbers[0]\n \tfor i in 1..numbers.length - 1 # So I don't over-run the array, and start at the 2nd position to compare against max at postion [0]\n if max_num < numbers[i] \n max_num = numbers[i] \n end\n i += 1\n \tend\n puts \"Looked through an array of lenght #{numbers.length}.\"\n puts \"The largest value is #{max_num}\"\n end\nend",
"def biggest(nums)\n n = nums.map(&:to_s).sort{ |k,l| l+k <=> k+l }.join\n n.to_i == 0 ? '0' : n\nend",
"def max_rotation(num)\n arr = num.to_s.split(\"\")\n first_rotation = arr[1..-1] + [arr[0]]\n result = first_rotation\n if arr.size == 1\n return num\n elsif arr.size == 2\n return first_rotation.join.to_i\n else\n rotation_times = first_rotation.size - 2\n\n 1.upto(rotation_times) do |i|\n rotating_digit = result.delete_at(i)\n result.push(rotating_digit)\n end\n end\n return result.join.to_i\nend",
"def largest_integer(list_of_nums)\n # Your code goes here!\n list_of_nums.sort! {|x,y| y<=>x}\n return list_of_nums[0]\nend"
] |
[
"0.83006096",
"0.785736",
"0.7820732",
"0.778584",
"0.7728957",
"0.7593007",
"0.75362617",
"0.7466691",
"0.74362713",
"0.7419624",
"0.73802584",
"0.73550844",
"0.73188853",
"0.73064935",
"0.7212375",
"0.7205079",
"0.7204353",
"0.7165965",
"0.7152583",
"0.71505404",
"0.71380824",
"0.71359354",
"0.70589674",
"0.7001979",
"0.69903094",
"0.696504",
"0.6956452",
"0.6911267",
"0.6908813",
"0.6888521",
"0.6881452",
"0.68778133",
"0.6873153",
"0.68517965",
"0.6848071",
"0.6845524",
"0.68410504",
"0.6832015",
"0.68307704",
"0.68227494",
"0.68191254",
"0.68191254",
"0.68058956",
"0.6795989",
"0.67847",
"0.67809105",
"0.6770563",
"0.67671233",
"0.674287",
"0.67304116",
"0.67069936",
"0.6690253",
"0.668271",
"0.66438204",
"0.6633718",
"0.6629096",
"0.6620909",
"0.66201895",
"0.6619724",
"0.6605183",
"0.6603282",
"0.6594247",
"0.6585045",
"0.65787405",
"0.6574898",
"0.65600693",
"0.6549647",
"0.65495205",
"0.65465105",
"0.65407616",
"0.6539846",
"0.65300435",
"0.65281826",
"0.6526593",
"0.65249395",
"0.6508699",
"0.65049845",
"0.64947164",
"0.6480332",
"0.64793104",
"0.64729226",
"0.64599866",
"0.64523184",
"0.64522785",
"0.64474136",
"0.643676",
"0.64359015",
"0.64293456",
"0.6411038",
"0.6408825",
"0.6406511",
"0.6401474",
"0.6401445",
"0.6395142",
"0.6383017",
"0.6379873",
"0.6366455",
"0.6356425",
"0.63486254",
"0.6347599"
] |
0.83084786
|
0
|
Adds a properly formatted entry to the exception's backtrace.
|
def add_backtrace_entry(filename) # :nodoc:
@sass_filename ||= filename
self.backtrace ||= []
self.backtrace.unshift "#{@sass_filename || '(sass)'}:#{@sass_line}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def format_backtrace(backtrace)\n safe_join(backtrace.to_a, tag.br)\n end",
"def formatted\n message = \"\\n#{@exception.class}: #{@exception.message}\\n \"\n message << @exception.backtrace.join(\"\\n \")\n message << \"\\n\\n\"\n end",
"def set_backtrace(bt)\n if @cause\n # We remove all lines of the nested exception's backtrace that intersect with\n # this exception's backtrace.\n @cause.backtrace.reverse.each { |line| bt.last == line ? bt.pop : break }\n # Add the nested exception's message and back trace to this exception's backtrace.\n bt << \"cause: #{@cause} (#{@cause.class.name})\"\n bt.concat @cause.backtrace\n end\n #\n super bt\n end",
"def backtrace_message\n backtrace = exception.backtrace ? clean_backtrace(exception) : nil\n\n return unless backtrace\n\n text = []\n\n text << '```'\n backtrace.first(3).each { |line| text << \"* #{line}\" }\n text << '```'\n\n text.join(\"\\n\")\n end",
"def set_backtrace(*) end",
"def mega_mutex_insert_into_backtrace(exception, re, newline)\n loc = nil\n exception.backtrace.each_with_index do |line, index|\n if line =~ re\n loc = index\n break\n end\n end\n if loc\n exception.backtrace.insert(loc, newline)\n end\n end",
"def service_backtrace exception\n service_logger.error exception.backtrace.first(20).map { |row| row.prepend(\"\\t\") }.join(\"\\n\")\n end",
"def backtrace(exception)\n return unless Gem.configuration.backtrace\n\n @errs.puts \"\\t#{exception.backtrace.join \"\\n\\t\"}\"\n end",
"def backtrace(exception)\n message = \"<br/>\" + sanitize(exception.message) + \"<br/>\"\n message += exception.backtrace.collect { |line|\n sanitize(line)\n }.join(\"<br/>\")\n return message\n end",
"def append_backtrace(segment, duration)\n if duration >= Agent.config[:'transaction_tracer.stack_trace_threshold']\n segment[:backtrace] = caller.join(\"\\n\")\n end\n end",
"def error exception, backtrace = nil\n backtrace ||= exception.backtrace\n unless backtrace.is_a? Array\n backtrace = [ backtrace ]\n end\n\n @errors << { :error => exception.to_s.gsub(\"\\n\", \" \"), :backtrace => backtrace }\n end",
"def full_backtrace=(_arg0); end",
"def show_backtraces=(_arg0); end",
"def render_backtrace(exception)\n return unless Rails.application.config.consider_all_requests_local\n backtrace = Rails.backtrace_cleaner.filter(exception.backtrace).first(10)\n backtrace << '...'\n backtrace.join(\"\\n\")\n end",
"def _log_exception(icon, note, excpt)\n warn \"#{icon} #{note}:\\n#{EXPT} \\xE2\\x94\\x8C#{excpt} \\xE2\\x94\\x90\"\n warn excpt.backtrace[0..7].reduce(\"\") { |s,x|\n s += \"#{EXPT} \\xE2\\x94\\x9C#{x}\\n\" } +\n \"#{EXPT} \\xE2\\x94\\x94#{BAR*25}\\xE2\\x94\\x98\"\n end",
"def full_backtrace; end",
"def backtrace(exc, level_meth = T.unsafe(nil)); end",
"def annotate_exception!(exception)\n location = pathname.to_s\n location << \":#{@__LINE__}\" if @__LINE__\n\n exception.extend(Sprockets::EngineError)\n exception.sprockets_annotation = \" (in #{location})\"\n end",
"def clean_backtrace(exception)\n if backtrace = exception.backtrace\n\t\t\tbacktrace.join(\"\\n \") + \"\\n\\n\"\n\t\tend\n\tend",
"def clean_backtrace(exception)\n if backtrace = exception.backtrace\n\t\t\tbacktrace.join(\"\\n \") + \"\\n\\n\"\n\t\tend\n\tend",
"def full_backtrace(ex)\n backtrace = String.new\n backtrace_for(ex, backtrace)\n\n # Avoid circular causes\n causes = {}\n causes[ex] = true\n\n cause = ex\n while (cause = cause.cause) && !causes.key?(cause)\n backtrace_for(cause, backtrace)\n causes[cause] = true\n end\n\n backtrace\n end",
"def set_backtrace(arg0)\n end",
"def append_backtrace(node, duration)\n if duration*1000 >= Agent.config[:'nbs.action_tracer.stack_trace_threshold']\n trace = caller.reject! { |t| t.include?('tingyun_rpm') }\n # freeze here will reduce used memory\n trace = trace.first(20).map!(&:freeze)\n node[:stacktrace] = trace\n end\n end",
"def backtrace(exc, level_meth = :error)\n return unless show_backtraces\n send(level_meth, \"#{exc.class.class_name}: #{exc.message}\")\n send(level_meth, \"Stack trace:\" +\n exc.backtrace[0..5].map {|x| \"\\n\\t#{x}\" }.join + \"\\n\")\n end",
"def backtrace_includes; end",
"def log_backtrace(e)\n Qwirk.logger.error \"\\t#{e.backtrace.join(\"\\n\\t\")}\"\n end",
"def backtrace_level=(_arg0); end",
"def backtrace_includes=(_arg0); end",
"def format_error(error)\n \"#{error.inspect} \\n #{error.backtrace}\"\n end",
"def link_backtrace_line( line )\n\t\treturn line.strip.sub( /(?<filename>[^:]*\\.rb):(?<line>\\d*)(?<rest>.*)/ ) do\n\t\t\tmatch = $~\n\t\t\tfullpath = File.expand_path( match[:filename] )\n\t\t\t%|<a href=\"txmt://open?url=file://%s&line=%s\">%s:%s</a>%s| %\n\t\t\t\t[ fullpath, match[:line], match[:filename], match[:line], h(match[:rest]) ]\n\t\tend\n\tend",
"def format_trace(args)\n if args.size > 1 && args.first.is_a?(String)\n format(\"%s: %p\\n\", args.shift, args.size == 1 ? args.first : args)\n elsif args.size == 1 && args.first.is_a?(String)\n \"#{args.first}\\n\"\n else\n format(\"%p\\n\", args.size == 1 ? args.first : args)\n end\n end",
"def backtrace_level; end",
"def report_backtrace\n metadata = {\n 'sourcetype' => 'chef-handler-backtrace',\n 'source' => 'chef-handler',\n 'host' => node.hostname,\n 'index' => @index,\n 'check-index' => false\n }\n event = Array(run_status.backtrace).join(\"\\n\")\n\n splunk_post(event, metadata)\n end",
"def message\n \"#{original_message}\\n\\t#{backtrace.join(\"\\n\\t\")}\"\n end",
"def backtrace\n end",
"def backtrace; end",
"def format_error(exception)\n message = \"#{exception.class} (#{exception.respond_to?(:message) ? exception.message : exception.inspect}):\\n\"\n message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code)\n message << ' ' << exception.backtrace.join(\"\\n \") if exception.respond_to?(:backtrace)\n message\n end",
"def backtrace_cleaner; end",
"def log_backtrace(exception, context_msg: '', re_raise: true, send_return: nil)\n context_msg = 'printing raised exception' if context_msg.length.zero?\n\n $ibm_cloud_log.error(format_message(context_msg))\n $ibm_cloud_log.log_backtrace(exception)\n raise if re_raise\n\n send_return\n end",
"def stacktrace=(_arg0); end",
"def print_colorized_backtrace(e)\n e.backtrace.map! do |line|\n line.gsub!(/^#{Merb.framework_root}/, \"\\e[34mFRAMEWORK_ROOT\\e[31m\")\n end\n \n Merb.logger.fatal! \"\\e[34mFRAMEWORK_ROOT\\e[0m = #{Merb.framework_root}\"\n Merb.logger.fatal!\n Merb.logger.fatal! \"\\e[31m#{e.class}: \\e[1;31;47m#{e.message}\\e[0m\"\n e.backtrace.each do |line|\n Merb.logger.fatal! \"\\e[31m#{line}\\e[0m\"\n end \n end",
"def store_backtrace(layer, meta)\n return unless layer.backtrace\n\n bt = ScoutApm::Utils::BacktraceParser.new(layer.backtrace).call\n if bt.any?\n meta.backtrace = bt\n @backtraces << meta\n end\n end",
"def long_display\n backtrace = filter_backtrace(@exception.backtrace).join(\"\\n \")\n [\n \"Error\".red.bold, \n \":\\n\", \n \"#@test_name:\".white, \n \"\\n\", \"#{message}\".red, \n \"\\n #{backtrace}\".gsub(/:(\\d+):/,\":#{'\\1'.red}:\")\n ].join('')\n end",
"def pretty_backtrace backtrace = caller(1)\n trace = purge_harness_files_from( Array( backtrace ) )\n expand_symlinks( trace ).join \"\\n\"\n end",
"def cover_up_backtrace\n new = dup\n new.backtrace = backtrace\n new.origin = self\n new\n end",
"def stacktrace_includes=(_arg0); end",
"def puts_stacktrace(exception)\n logger.debug \"\\033[1m\\033[32m#{exception.message}\\033[0m\\033[22m\"\n filtered_trace = exception.backtrace.grep(/#{Regexp.escape(\"nilavu\")}/)\n unless filtered_trace.empty?\n full_stacktrace = (filtered_trace.map { |ft| ft.split('/').last }).join(\"\\n\")\n logger.debug \"\\033[1m\\033[36m#{full_stacktrace}\\033[0m\\033[22m\"\n end\n logger.debug \"\\033[1m\\033[32m..(*_*)...\\033[0m\"\n end",
"def build_trace\n Backtrace.to_s(backtrace)\n end",
"def handle_exception(e)\n puts \"\"\n puts \"An exception has occurred:\\n #{e.message} (#{e.class})\"\n puts \"Backtrace:\"\n output = Output.new\n output.set_columns(['%s', '%-s'], ' at ')\n bt = e.awesome_backtrace\n first = true\n bt.frames.each do |fr|\n recv = fr[0]\n loc = fr[1]\n break if recv =~ /Debugger#process_command/\n output.set_color(bt.color_from_loc(loc, first))\n first = false # special handling for first line\n output << [recv, loc]\n end\n puts output\n end",
"def error e\n log(\"ERREUR: #{e.message}\")\n log(\"BACKTRACE ERREUR: #{e.backtrace.join(\"\\n\")}\")\n self << {error: e.message, backtrace: e.backtrace}\n end",
"def backtrace\n @exception && @exception.backtrace\n end",
"def backtrace\n Spec::deprecate(\"ExampleGroupProxy#backtrace\",\"ExampleGroupProxy#location\")\n @backtrace\n end",
"def stack_trace=(_arg0); end",
"def error_line(comment, line_number, item, line, exception = nil)\n puts \"#{comment}::#{line_number}::#{exception.class}::#{item}::::#{line}\"\n end",
"def format_backtrace( notification )\n\t\tlines = notification.formatted_backtrace\n\t\treturn lines.map do |line|\n\t\t\tlink_backtrace_line( line )\n\t\tend\n\tend",
"def format(arg)\n str = if arg.is_a?(Exception)\n \"#{arg.class}: #{arg.message}\\n\\t\" <<\n arg.backtrace.join(\"\\n\\t\") << \"\\n\"\n elsif arg.respond_to?(:to_str)\n arg.to_str\n else\n arg.inspect\n end\nend",
"def exception(e)\n self.error \"#{e.class}: #{e.message}\" << (\"\\n#{e.backtrace.join(\"\\n\")}\" unless e.backtrace.nil?)\n end",
"def backtrace\n @backtrace ||= Protest.backtrace_filter.filter_backtrace(raw_backtrace)\n end",
"def parse_crash_address(line)\n address = remove_prefix(line, 'Crash address:')\n\n @extra[:crash_address] = address\n end",
"def build_trace\n if with_bt_set?\n Backtrace.to_s(@with_bt + [first_filtered_bt_line(backtrace)])\n else\n src_line\n end\n end",
"def debug_exception_response_format=(_arg0); end",
"def debug_exception_response_format=(_arg0); end",
"def formatted_exception\n @exception && \"#{@exception.class.name}: #{@exception.message}\"\n end",
"def stacktrace; end",
"def format_log_entry(message, dump = nil)\n if Rails.application.config.colorize_logging\n if @@row_even\n @@row_even = false\n message_color, dump_color = \"4;36;1\", \"0;1\"\n else\n @@row_even = true\n message_color, dump_color = \"4;35;1\", \"0\"\n end\n\n log_entry = \" \\e[#{message_color}m#{message}\\e[0m \"\n log_entry << \"\\e[#{dump_color}m%#{String === dump ? 's' : 'p'}\\e[0m\" % dump if dump\n log_entry\n else\n \"%s %s\" % [message, dump]\n end\n end",
"def backtrace\n @backtrace\n end",
"def format_error(e)\n data = { error: e.class.to_s, message: e.message, backtrace: e.backtrace }\n JSON.pretty_generate(data)\n end",
"def log_trace(log_entry = \"\")\n entry(Gml::LOG_LEVEL_TRACE, log_entry, 1)\n end",
"def add_location(path, line); end",
"def backtrace_ignores=(_arg0); end",
"def stack_trace\n trace = @context_stack.reverse.map do |context|\n next if context.context_type == :base\n ['Line', context.line_number.to_s, 'in', context.context_type.to_s, context.path, context.name, ':', context.line].compact.join(' ')\n end.compact\n if stacked? && expanded_lines && expanded_lines.size > 1\n trace.unshift ['Line', expanded_line_number, 'in', 'request expansion', ':', expanded_line].join(' ')\n end\n trace\n end",
"def stack_trace; end",
"def backtrace\n if original.nil?\n super\n else\n original.backtrace\n end\n end",
"def puts_ex(e)\n\tputs \"\\nException: #{e}\"\n\tputs e.backtrace\t\n end",
"def visit_exception\n exception = object.value\n\n puts(\n EXCEPTION_ERROR_MESSAGE % [\n exception.inspect,\n exception.backtrace.join(\"\\n\")\n ]\n )\n end",
"def raw_backtrace\n error.backtrace\n end",
"def format_compile_error(file_name, file_path, reason,\n line, cursor); EMPTY; end",
"def format_message\n return @format_message if @format_message\n\n @format_message = self.message.dup\n\n if self.line\n @format_message << \" near line #{self.line}\"\n end\n\n if self.code\n @format_message << \": #{format_code}\"\n end\n\n @format_message\n end",
"def trace( crashfile, template )\n end",
"def format_cause(e)\n rv = curr = {}\n prev = nil\n\n cause_depth.times do\n break unless e.respond_to?(:cause) && e.cause\n\n cause = e.cause\n curr[:class] = cause.class.name\n curr[:message] = cause.message\n curr[:backtrace] = format_cause_backtrace(e, cause) if backtrace? && cause.backtrace\n\n prev[:cause] = curr unless prev.nil?\n prev, curr = curr, {}\n\n e = cause\n end\n\n if e.respond_to?(:cause) && e.cause\n prev[:cause] = {message: \"Further #cause backtraces were omitted\"}\n end\n\n rv\n end",
"def format_error_report(e, additional_info = nil)\n error_chain = Enumerator.unfold(e) { |e| [e.cause, e.cause] }.to_a\n initial_report = format_single_error(e, clean_backtrace(nil, e), additional_info)\n # starting with the outermost error, reduce the error chain into the formatted report\n error_chain.reduce([e, initial_report]) do |(prev_e, report), e|\n new_report = format_single_error(e, clean_backtrace(prev_e, e)) + \" which caused:\\n \" + report\n [e, new_report]\n end[1]\n rescue\n # if something went wrong, fall back to something simpler\n format_short_message(e) + \"\\n\" + e.backtrace.join(\"\\n\")\n end",
"def backtrace\n @process_error.h['trace'].split(/\\n/)\n end",
"def backtrace_ignores; end",
"def exception(ex, msg='')\n line = ''\n ex.backtrace.each do |l|\n line += \"\\n #{l}\"\n end\n @logger.error \"#{msg}: ** Exception thrown: #{ex.class}, backtrace follows:#{line}\"\n end",
"def print_error(e)\n puts e.message\n puts e.backtrace if(trace)\n end",
"def get_line(exception)\n # SyntaxErrors have weird line reporting\n # when there's trailing whitespace,\n # which there is for BabyBro documents.\n return (exception.message.scan(/:(\\d+)/).first || [\"??\"]).first if exception.is_a?(::SyntaxError)\n (exception.backtrace[0].scan(/:(\\d+)/).first || [\"??\"]).first\n end",
"def message\n backtrace = @config.backtrace_cleaner.clean(exception.backtrace)\n markdown = Markdown.new\n metadata.each { |key, value| markdown.bullet(\"#{key}: #{value}\") }\n max_block_size = MAX_MESSAGE_SIZE - markdown.result.length - 10\n markdown.code_block(backtrace.join(\"\\n\"), 'text', max_block_size)\n markdown.result\n end",
"def backtrace_remove; end",
"def backtrace_remove=(_arg0); end",
"def log_exception(exception, details = {})\n details = details.stringify_keys\n max = details.keys.max { |a,b| a.length <=> b.length }\n env = details.keys.sort.inject [] do |env, key|\n env << '* ' + (\"%-*s: %s\" % [max.length, key, details[key].to_s.strip])\n end\n\n details_str = env.join(\"\\n\")\n trace = exception.backtrace.join(\"\\n\")\n error(\"Exception '#{exception.class_name}', '#{exception.message}', details:\\n#{details_str}\\nBacktrace:\\n#{trace}\")\n end",
"def build_error_msg(e)\n message = []\n message << tabify(\"Exception message: #{e.message}\") if e.message\n message << build_debug_msg\n message << tabify(e.backtrace) unless e.backtrace.blank?\n message.join(\"\\n\")\n end",
"def possibly_add_trace_info_calls(line)\n # If the current line does not start a logical line, don't bother\n if not @state[:ll_start]\n return line\n end\n\n # We will be making decisions based on the first word on the line\n line_words = line.split\n if line_words.empty?\n # The line is empty, so we disregard it\n return line\n end\n first_word = line_words[0]\n\n # Extract first word and check if it makes us want to refrain from adding a line number call\n if KEYWORDS_WITHOUT_LINE_NUMBERS.include?(first_word)\n # It's one of the statements we don't want\n return line\n\n elsif [\"'\", '\"', \"#\"].include?(first_word[0])\n # The line starts with a string or with a comment\n return line\n end\n\n # Do include a line number call\n return \"#{@state[:indent_string]}garbledwebpiratenlibraryname.debug(locals(), globals())\\n\" +\n \"#{@state[:indent_string]}garbledwebpiratenlibraryname.line(#{@state[:line_number]})\\n\" +\n \"#{line}\"\n end",
"def merge_backtrace(sender_trace, provider_trace)\n return nil if provider_trace.nil?\n return provider_trace if sender_trace.nil?\n\n # Find the first live resource stack trace\n index = provider_trace.index do |t|\n t =~ /lib\\/live_resource\\/method_provider/\n end\n\n # Slice off everything starting at that index\n result = provider_trace[0 .. (index - 1)]\n\n # Add a trace that indicates that live resource was used\n # to link the sender to the provider.\n result << 'via LiveResource'\n\n # For the sender trace, remove the 'method_sendor'\n # part of the trace.\n index = sender_trace.index do |t| \n t =~ /lib\\/live_resource\\/method_sender/\n end\n result += sender_trace[(index + 1) .. (sender_trace.length - 1)]\n\n result\n end",
"def email_error_message(message, backtrace, attach_file_path = nil)\n send_email_admin(MailPart.new_subject('Error in job'),\n \"#{message} <br/> <br/> backtrace: #{backtrace}\",\n attach_file_path)\n end",
"def add_error(line)\n add_value(line, \"error\")\n end",
"def exception_message(e, msg=nil)\n m = []\n m << msg if msg\n m << e.message\n m += e.backtrace\n m.join(\"\\n\")\n end",
"def format(level, context, message)\n msg = message.to_s.strip\n thread = thread_context ? \"[#{thread_name}] - \" : nil\n\n if message.ndc.any?\n msg = \"#{thread}#{level.to_s.upcase} - #{context} #{message.ndc.join(' ')} - #{msg}\"\n else\n msg = \"#{thread}#{level.to_s.upcase} - #{context} - #{msg}\"\n end\n\n with_backtrace(message, msg)\n end",
"def log_entry(type, message)\n \"#{message_type(type)}#{message_body(type, message)}\".freeze\n end",
"def format_log_message file, lineno, line, parameters\n message = insert_parameters(line, parameters)\n return \"#{file[:file_name]}@#{lineno}: #{message}\"\nend"
] |
[
"0.6723981",
"0.6405788",
"0.621267",
"0.6140735",
"0.6136937",
"0.6133015",
"0.6112489",
"0.60806924",
"0.60640556",
"0.6034824",
"0.60305166",
"0.59950125",
"0.59851074",
"0.59000087",
"0.58676815",
"0.58202934",
"0.5798464",
"0.5765267",
"0.5752046",
"0.5752046",
"0.5732417",
"0.5718674",
"0.57163435",
"0.5711431",
"0.57090515",
"0.57028633",
"0.5695922",
"0.5671517",
"0.5662067",
"0.56550866",
"0.56228626",
"0.56101954",
"0.5605715",
"0.56039655",
"0.5601472",
"0.55931485",
"0.5527898",
"0.5512779",
"0.5480906",
"0.54716855",
"0.5467164",
"0.54584473",
"0.5443872",
"0.544182",
"0.543654",
"0.5434971",
"0.54100513",
"0.5399386",
"0.5388909",
"0.535028",
"0.5338888",
"0.5328275",
"0.5323299",
"0.53144825",
"0.53029263",
"0.5301684",
"0.5270037",
"0.5231417",
"0.52295125",
"0.52180153",
"0.52026546",
"0.52026546",
"0.5196307",
"0.5184136",
"0.51720464",
"0.51694584",
"0.51581424",
"0.51570725",
"0.51487446",
"0.5146221",
"0.513624",
"0.51325446",
"0.512823",
"0.5121331",
"0.5118228",
"0.5116247",
"0.5111517",
"0.5104154",
"0.5086724",
"0.50850177",
"0.50840056",
"0.50811803",
"0.50769687",
"0.5050764",
"0.50479674",
"0.50318396",
"0.5012328",
"0.49995404",
"0.49945143",
"0.49901727",
"0.49837354",
"0.4979573",
"0.49786094",
"0.49700454",
"0.49688974",
"0.49580112",
"0.49576372",
"0.49547377",
"0.49540755"
] |
0.649048
|
2
|
Rock Paper Scissors Let's play! You have to return which player won! In case of a draw return Draw!. Examples: rps('scissors','paper') // Player 1 won! rps('scissors','rock') // Player 2 won! rps('paper','paper') // Draw! My code:
|
def rps(p1, p2)
if p1 == "scissors" && p2 == "paper"
return "Player 1 won!"
elsif p1 == "scissors" && p2 == "rock"
return "Player 2 won!"
elsif p1 == "scissors" && p2 == "scissors"
return "Draw!"
end
if p1 == "paper" && p2 == "paper"
return "Draw!"
elsif p1 == "paper" && p2 == "rock"
return "Player 1 won!"
elsif p1 == "paper" && p2 == "scissors"
return "Player 2 won!"
end
if p1 == "rock" && p2 == "paper"
return "Player 2 won!"
elsif p1 == "rock" && p2 == "rock"
return "Draw!"
elsif p1 == "rock" && p2 == "scissors"
return "Player 1 won!"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rps(p1, p2)\n return 'Player 1 won!' if p1 == 'scissors' && p2 == 'paper'\n return 'Player 1 won!' if p1 == 'paper' && p2 == 'rock'\n return 'Player 1 won!' if p1 == 'rock' && p2 == 'scissors'\n return 'Draw!' if p1 == p2\n # Otherwise player 2 wins...\n 'Player 2 won!'\nend",
"def rps(choice)\n choice = choice.capitalize\n rps = [\"Rock\", \"Paper\", \"Scissors\"]\n computer_choice = rps[rand(3)]\n return \"You: #{choice}, Computer: #{computer_choice}, Draw\" if choice == computer_choice\n return \"You: #{choice}, Computer: #{computer_choice}, Win\" if choice == \"Rock\" && computer_choice == \"Scissors\"\n return \"You: #{choice}, Computer: #{computer_choice}, Lose\" if choice == \"Rock\" && computer_choice == \"Paper\"\n return \"You: #{choice}, Computer: #{computer_choice}, Win\" if choice == \"Paper\" && computer_choice == \"Rock\"\n return \"You: #{choice}, Computer: #{computer_choice}, Lose\" if choice == \"Paper\" && computer_choice == \"Scissors\"\n return \"You: #{choice}, Computer: #{computer_choice}, Win\" if choice == \"Scissors\" && computer_choice == \"Paper\"\n return \"You: #{choice}, Computer: #{computer_choice}, Lose\" if choice == \"Scissors\" && computer_choice == \"Rock\"\nend",
"def play(p1_choice,p2_choice)\n if p1_choice == \"rock\"\n if p2_choice == \"paper\"\n self.winner_id = p2_choice.id\n elsif p2_choice == \"scissor\"\n self.winner_id = p1_choice.id\n end\n\n return winner_id\n end\n\n if p1_choice == \"paper\"\n if p2_choice == \"rock\"\n return @winner_id = p1_choice.id\n elsif p2_choice == \"scissor\"\n return @winner_id = p2_choice.id\n else\n return @winner_id\n end\n end\n\n if p1_choice == \"scissor\"\n if p2_choice == \"rock\"\n return @winner_id = p2_choice.id\n elsif p2_choice == \"paper\"\n return @winner_id = p1_choice.id\n else\n return @winner_id\n end\n end\n\n\n # plays game\n # return either p1_choice or p2_choice winner\n end",
"def play_game\nget_winner(comp_choose_rps,user_choose_rps)\t\nend",
"def winner(p,c)\n if p == c\n output \"It's a Draw!\"\n elsif (\"#{p}\" == 'Rock' && \"#{c}\" == 'Paper')\n output \"Computer wins!\"\n elsif (\"#{p}\" == 'Paper' && \"#{c}\" == 'Scissors')\n output \"Computer wins!\"\n elsif (\"#{p}\" == 'Scissors' && \"#{c}\" == 'Rock')\n output \"Computer wins!\"\n else \"Player wins!\"\n end\nend",
"def rps\n c = ['r','p','s'].sample\n puts \"choose r, p or s\"\n u = gets\n puts \"comp chose #{c}\"\n if u==c \n puts \"you tie \"\n elsif u==\"r\"&&c==\"p\"||u==\"p\"&&c==\"s\"||u==\"s\"&&c==\"r\"\n puts 'you lose'\n else \n puts \"you win\"\n \n end\n end",
"def rps_game\n puts 'Enter a move Player 1: Rock, Paper, or Scissors'\n p1_move = gets.chomp\n puts 'Enter a move Player 2: Rock, Paper, or Scissors'\n p2_move = gets.chomp\n if p1_move == p2_move\n puts \"Draw\"\n elsif (p1_move == \"Rock\" && p2_move == \"Scissors\") || (p1_move == \"Paper\" && p2_move == \"Rock\") ||\n (p1_move == \"Scissors\" && p2_move == \"Paper\")\n puts \"Player 1 Wins!!\"\n elsif (p2_move == \"Rock\" && p1_move == \"Scissors\") || (p2_move == \"Paper\" && p1_move == \"Rock\") ||\n (p2_move == \"Scissors\" && p1_move == \"Paper\")\n puts \"Player 2 Wins!!\"\n end\nend",
"def print_which_player_wins player_picked, comp_picked\n if player_picked == comp_picked\n puts \"It's a tie!\"\n elsif player_picked == \"Paper\"\n if comp_picked == \"Rock\"\n puts \"Paper wraps Rock, you win!\"\n elsif comp_picked == \"Scissors\"\n puts \"Scissors cuts Paper, you lose!\"\n end\n elsif player_picked == \"Rock\"\n if comp_picked == \"Paper\"\n puts \"Paper wraps Rock, you lose!\"\n elsif comp_picked == \"Scissors\"\n puts \"Rock crushes Scissors, you win!\"\n end\n elsif player_picked == \"Scissors\"\n if comp_picked == \"Paper\"\n puts \"Scissors cut Paper, you win!\"\n elsif comp_picked == \"Rock\"\n puts \"Rock crushes Scissors, you lose!\"\n end\n end\nend",
"def rps(user_hand)\nuser_hand.downcase!\ncomp_hand = [\"rock\", \"paper\", \"scissors\"].sample\n# \"rock\" < \"paper\"=== tru\n# \"rock\" > \"scissor\"\n# \"paper\" < \"scissor\"\n if (comp_hand == \"rock\" && user_hand == \"paper\") || \n (comp_hand== \"scissors\" && user_hand == \"rock\") || \n (comp_hand== \"paper\" && user_hand == \"scissors\")\n \"user had #{user_hand} and computer had #{comp_hand}. User wins!\"\n elsif comp_hand == user_hand\n \"user had #{user_hand} and computer had #{comp_hand}. Draw!\"\n else \n \"user had #{user_hand} and computer had #{comp_hand}. Computer wins!\"\n end\nend",
"def comp_choose_rps\n\trand_num = rand(3) \n\tif rand_num == 1 \n\t \"rock\"\n\telsif rand_num == 2 \n\t \"paper\"\n\telse \n\t \"scissors\"\n\tend\nend",
"def rps_game()\n print \"Player 1: Rock, paper, scissors? \"\n move1 = gets.chomp.downcase\n print \"Player 2: Rock, paper, scissors? \"\n move2 = gets.chomp.downcase\n\n if move1 == \"rock\"\n if move2 == \"rock\"\n puts \"It's a tie\"\n elsif move2 == \"paper\"\n puts \"Player 2 wins\"\n elsif move2 == \"scissors\"\n puts \"Payer 1 wins\"\n else\n puts \"Wrong input!\"\n end\n elsif move1 == \"paper\"\n if move2 == \"rock\"\n puts \"Player 1 wins\"\n elsif move2 == \"paper\"\n puts \"It's a tie\"\n elsif move2 == \"scissors\"\n puts \"Player 2 wins\"\n else\n puts \"Wrong input!\"\n end\n elsif move1 == \"scissors\"\n if move2 == \"rock\"\n puts \"Player 2 wins\"\n elsif move2 == \"paper\"\n puts \"Player 1 wins\"\n elsif move2 == \"scissors\"\n puts \"It's a tie\"\n else\n puts \"Wrong input!\"\n end\n else\n puts \"Wrong input!\"\n end\nend",
"def win(pick_w)\n case pick_w \n when 'r' \n puts \"You: Rock | Me: Scissors\"\n when 'p'\n puts \"you: Paper | Me: Rock\"\n when 's'\n puts \"you: Scissors | Me: Paper\"\n end\nend",
"def rps_game\n puts \"Player 1 enter rock, paper, or scissors: \"\n player1 = gets.chomp\n puts \"Player 2 enter rock, paper, or scissors: \"\n player2 = gets.chomp\n if player1 != \"rock\" || player1 != \"paper\" || player1 != \"scissors\"\n puts \"Player 1 MUST enter rock, paper, or scissors! \"\n elsif player2 != \"rock\" || player2 != \"paper\" || player2 != \"scissors\"\n puts \"Player 2 MUST enter rock, paper, or scissors! \"\n elsif player1 == \"rock\" && player2 == \"paper\"\n puts \"Player 2 wins\"\n elsif player1 == \"rock\" && player2 == \"scissors\"\n puts \"Player 1 wins\"\n elsif player2 == \"rock\" && player1 == \"paper\"\n puts \"Player 1 wins\"\n elsif player2 == \"rock\" && player1 == \"scissors\"\n puts \"Player 2 wins\"\n elsif player1 == \"paper\" && player2 == \"scissors\"\n puts \"Player 2 wins\"\n elsif player1 == \"paper\" && player2 == \"rock\"\n puts \"Player 2 wins\"\n else\n puts \"Its a tie!\"\n end\nend",
"def game\n if p1 == \"rock\" && p2 == \"scissors\"\n victor = \"rock\"\n elsif p1 == \"scissors\" && p2 == \"rock\"\n victor = \"rock\"\n elsif p1 == \"scissors\" && p2 == \"paper\"\n victor = \"scissors\"\n elsif p1 == \"paper\" && p2 == \"scissors\"\n victor = \"scissors\"\n elsif p1 == \"paper\" && p2 == \"rock\"\n victor = \"paper\"\n else p1 == \"rock\" && p2 == \"paper\"\n victor = \"paper\"\n end\n return victor\n end",
"def rock_battle\n if computer_rand == \"p\"\n puts \"Paper beats rock.\"\n puts \"The computer won.\"\n elsif computer_rand == \"s\"\n puts \"Rock beats scissors.\"\n puts \"You won!\"\n end\nend",
"def play_game\n\t#user_choose_rps \n\tcomp_choice = comp_choose_rps #<-- no need to use this because it's used once \n\tuser_choice = user_choose_rps \n\tputs \"The computer chose #{comp_choice}. You chose #{user_choice}.\" \n\tputs get_winner(comp_choice, user_choice) \n\treplay \nend",
"def rps(user_weapon)\n weapons = [\"rock\", \"paper\", \"scissors\"]\n computer_weapon = weapons.shuffle.last\n\n if user_weapon == \"rock\"\n case computer_weapon\n when \"rock\"\n return \"Rock, Draw!\"\n when \"paper\"\n return \"Paper, Lose!\"\n when \"scissors\"\n return \"Scissors, Win!\"\n end\n elsif user_weapon == \"paper\"\n case computer_weapon\n when \"rock\"\n return \"Rock, Win!\"\n when \"paper\"\n return \"Paper, Draw!\"\n when \"scissors\"\n return \"Scissors, Lose!\"\n end\n elsif user_weapon == \"scissors\"\n case computer_weapon\n when \"rock\"\n return \"Rock, Lose!\"\n when \"paper\"\n return \"Paper, Win!\"\n when \"scissors\"\n return \"Scissors, Draw!\"\n end\n end\n\nend",
"def play_a_game\n\t#PLAYER 1 choses a valid selection of r,p,s\n\tprint \"\\nPLAYER 1, please select the corresponding number for your choice:\\n1 rock\\n2 paper\\n3 scissors\\n\\n\"\n\tchoice = gets.chomp\n\tvalidate_rps_choice(choice)\n\tplayer_1_choice = choice\n\n\tputs \"-------------------------------------------------\"\n\tprint \"\\nPLAYER 2, please select the corresponding number for your choice:\\n1 rock\\n2 paper\\n3 scissors\\n\\n\"\n\t\t#PLAYER 2 choses a valid selection of r,p,s\n\tchoice = gets.chomp\n\tvalidate_rps_choice(choice)\n\tplayer_2_choice = choice\n\n\tputs lets_see_who_wins(player_1_choice, player_2_choice)\n\nend",
"def run\n player1 = Player.new(\"You\")\n player2 = Player.new(\"Computer\")\n rps = RockPaperScissors.new\n\t\tbegin\n\t\t\tputs \"---------Play Rock Paper Scissors!----------------\"\n\n\t\t\tplayer1.choose_by_input\n\t\t\tplayer2.choose_by_rand\n\n\t\t\tputs \"#{player1.name} picked #{player1.gesture}, and #{player2.name} picked #{player2.gesture}\"\n\n\t\t\trps.arbitrate(player1, player2)\n\n\t\t\tputs \"Do you want to play again? (Y/N)\"\n\t\t\tplay=gets.chomp.downcase\n\t\t\tplay = ( play =='y') ? TRUE: FALSE\n\n\t\tend while play==TRUE\n\tend",
"def main_game\n p1_wins = 0\n p2_wins = 0\n puts \"Let's play Rock-Paper-Scissors!\"\n games = how_many_games\n best_of(games)\n\n until p1_wins == games || p2_wins == games\n winner = one_round\n display_winner(winner)\n p1_wins += track_p1_wins(winner)\n p2_wins += track_p2_wins(winner)\n end\n\n overall_winner = overall_winner?(p1_wins, p2_wins)\n display_overall_winner(overall_winner)\nend",
"def evaluate(player, computer)\n # `#{scores.key scores[:player1_name]} wins!`\n if player == computer\n return \"It's a draw!\"\n else\n if player == \"Rock\"\n if computer == \"Paper\"\n score = $scores[:player2_name].to_i\n score += 1\n $scores[:player2_name] = score\n return \"Computer wins!\"\n else\n score = $scores[:player1_name].to_i\n score += 1\n $scores[:player1_name] = score\n return \"#{$scores.key $scores.fetch(:player1_name)} wins!\"\n end\n elsif player == \"Paper\"\n if computer == \"Scissors\"\n score = $scores[:player2_name].to_i\n score += 1\n $scores[:player2_name] = score\n return \"Computer wins!\"\n else\n score = $scores[:player1_name].to_i\n score += 1\n $scores[:player1_name] = score\n return \"#{$scores.key $scores.fetch(:player1_name)} wins!\"\n end\n else\n if computer == \"Rock\"\n score = $scores[:player2_name].to_i\n score += 1\n $scores[:player2_name] = score\n return \"Computer wins!\"\n else\n score = $scores[:player1_name].to_i\n score += 1\n $scores[:player1_name] = score\n return \"#{$scores.key $scores.fetch(:player1_name)} wins!\"\n end\n end\n end\nend",
"def won\n divider\n if @input == @comp\n puts \"You picked #{@input}. Computer picked #{@comp}.\"\n puts \"\n ╦┌┬┐┌─┐ ┌─┐ ┌┬┐┬┌─┐ \n ║ │ └─┐ ├─┤ │ │├┤ \n ╩ ┴ └─┘ ┴ ┴ ┴ ┴└─┘o\"\n divider2\n puts \"Current Score: [User] #{@u_score} *** [Computer] #{@c_score}\" \n play_again\n elsif @input == \"rock\" && @comp == \"scissors\" || @input == \"paper\" && @comp == \"rock\" || @input == \"scissors\" && @comp == \"paper\"\n @u_score += 1\n puts \"You picked #{@input}. Computer picked #{@comp}.\"\n puts \"\n ╦ ╦┌─┐┬ ┬ ┬ ┬┬┌┐┌┬\n ╚╦╝│ ││ │ ││││││││\n ╩ └─┘└─┘ └┴┘┴┘└┘o\"\n divider2\n puts \"Current Score: [User] #{@u_score} *** [Computer] #{@c_score}\"\n play_again\n elsif \n @c_score += 1\n @input == \"rock\" && @comp == \"paper\" || @input == \"paper\" && @comp == \"scissors\" || @input == \"scissors\" && @comp == \"rock\"\n puts \"You picked #{@input}. Computer picked #{@comp}.\"\n puts \"\n ╦ ╦╔═╗╦ ╦ ╦ ╔═╗╔═╗╔═╗┬┬┬\n ╚╦╝║ ║║ ║ ║ ║ ║╚═╗║╣ │││\n ╩ ╚═╝╚═╝ ╩═╝╚═╝╚═╝╚═╝ooo\"\n divider2\n puts \"Current Score: [User] #{@u_score} /// [Computer] #{@c_score}\"\n play_again\n else\n puts \"You dun fucked up, I'm not even telling you the score because I don't even know how you got here bro\"\n play_again\n end\n end",
"def play\n title\n divider\n puts \"Choose 'Rock', 'Paper', or 'Scissors'\"\n input = gets.strip\n input_downcase(input)\n if valid_selection?\n computer_selection\n won\n else\n play\n end\n end",
"def rock_paper_scissors_game\n \n # Creates What hand (rock, paper, scissors) that the cpu uses\n def cpu_answer\n cpu_answer = rand(3)\n if cpu_answer == 0\n cpu_answer = 'Rock'\n elsif cpu_answer == 1\n cpu_answer = 'Paper'\n elsif cpu_answer == 2\n cpu_answer = 'Scissors'\n end\n end\n\n # Compares your hand and computers hand to see who won or tied\n # if tied will run the program again\n def winner(answer, computers_answer)\n if (answer.downcase == 'rock') && (computers_answer.downcase == 'paper')\n puts 'YOU LOSE'\n elsif (answer.downcase == 'paper') && (computers_answer.downcase == 'rock')\n puts 'WINNER'\n elsif (answer.downcase == 'paper') && (computers_answer.downcase == 'scissors')\n puts 'You Lose'\n elsif (answer.downcase == 'scissors') && (computers_answer.downcase == 'paper')\n puts 'WINNER'\n elsif (answer.downcase == 'scissors') && (computers_answer.downcase == 'rock')\n puts 'You Lose'\n elsif (answer.downcase == 'rock') && (computers_answer.downcase == 'scissors')\n puts 'Winner'\n else\n puts 'You both tied. Go again.'\n rock_paper_scissors_game\n exit\n end\n end\n \n # Asks if you want to play again after a winner is decided\n def play_again(play_again_response)\n while play_again_response.downcase != 'no'\n puts 'Do you want to play another round of Rock, Paper, Scissors? Yes or No?'\n play_again_response = gets.chomp\n if play_again_response.downcase == 'yes'\n puts \"OK! Lets play again!\"\n rock_paper_scissors_game\n exit\n elsif play_again_response.downcase == 'no'\n else\n puts 'You enetered '+play_again_response.capitalize+' which isnt Yes or No. Please type Yes or No if you want to play again.'\n play_again_response = gets.chomp\n end\n end\n end\n\n puts 'Rock, Paper, Scissors, Shoot!!!'\n puts 'What do you choose, Rock, Paper, or Scissors?'\n answer = gets.chomp\n\n # Gets what the user is picking for his hand (rock, paper, or scissors)\n while answer != nil\n if (answer.downcase == 'rock') || (answer.downcase == 'paper') || (answer.downcase == 'scissors')\n break\n else\n puts 'You entered '+answer.capitalize+' which isn\\'t one of the following words, Scissors, Paper, or Rock. Please try again.'\n answer = gets.chomp\n end\n end\n\n computers_answer = cpu_answer\n puts 'You chose '+answer.capitalize+' and the computer chose '+computers_answer+'!'\n winner(answer, computers_answer)\n play_again('yes')\nend",
"def display_winner_one_game(r)\n if r == 1\n puts \"#{@player_1_name} wins\"\n elsif r == 2\n puts \"#{@player_2_name} wins\"\n else\n puts \"Tie\"\n end\n end",
"def user_plays_rock\n #we keep as much of our ruby code here as possible\n \n # we first create an array of computer moves\n @computer_move_list = [\"rock\", \"paper\", \"scissors\"]\n \n #randomly choose computer move\n @computer_move = @computer_move_list.sample\n \n # Logic for moves and results\n\n #initialize result as nil\n @rock_game_result = nil\n \n if (@computer_move == \"rock\")\n @rock_game_result = \"We tied!\"\n elsif (@computer_move == \"paper\")\n @rock_game_result = \"We lost!\"\n else\n @rock_game_result = \"We won!\"\n end\n \n render(\"move_templates/played_rock.html.erb\")\n end",
"def winner(player, comp)\n return 'tie' if player == comp\n if player == 'rock'\n comp == 'scissors' ? 'player' : 'comp'\n elsif player == 'paper'\n comp == 'rock' ? 'player' : 'comp'\n else # player = scissors\n comp == 'rock' ? 'comp' : 'player'\n end\nend",
"def check_win(person1, person2)\n case person1\n when 'rock'\n if person2 == 'scissor'\n return \"Player 1 wins by playing #{person1}!\"\n elsif\n person2 == 'paper'\n return \"Player2 wins by playing #{person2}!\"\n else return \"Draw!\"\n end\n when 'scissor'\n if person2 == 'paper'\n return \"Player 1 wins by playing #{person1}!\"\n elsif\n person2 == 'rock'\n return \"Player2 wins by playing #{person2}!\"\n else return \"Draw!\"\n end\n when 'paper'\n if person2 == 'rock'\n return \"Player 1 wins by playing #{person1}!\"\n elsif\n person2 == 'scissor'\n return \"Player2 wins by playing #{person2}!\"\n else return \"Draw!\"\n end\n end\n end",
"def play\n # print \"\\n Welcome to the game of Scissors-Paper-Rock\"\n print \"\\n Enter your name: \"\n user_name = gets.chomp\n until @user_score == @score_required || @computer_score == @score_required\n options = ['scissors', 'paper', 'rock']\n \n print \"\\nHi #{user_name}, please select 's' for scissors, 'p' for paper or 'r' for rock. \"\n \n # Display user selection:\n selected_options = gets.chomp\n \n puts \"User has selected #{user_choice}.\"\n # p user_choice\n\n # display the computer's randomised selection:\n # options = ['s', 'p', 'r']\n @computer_choice = options.sample\n # p computer_choice\n puts \"Computer has selected #{computer_choice}.\"\n\n result()\n end\n \n return @user_score > @computer_score ? (puts \"Game over! you won!\"): (puts \"Game over! Computer won!\")\n \n end",
"def play_paper\n @computer_move = [\"rock\",\"paper\",\"scissors\"].sample\n if @computer_move == \"paper\"\n @outcome = \"tie\"\n elsif @computer_move == \"scissors\"\n @outcome = \"lose\"\n else\n @outcome = \"win\"\n end\n render(\"games/play_paper.html.erb\")\n end",
"def play()\n c=1\n p=\"X\"\n while !over?()\n turn()\n end\n if won?()\n puts \"Congratulations #{winner()}!\"\n elsif draw?()\n puts \"Cats Game!\"\n else\n end\nend",
"def round_win(p1_answer, p2_answer)\n\tif p1_answer == p2_answer\n\t\treturn 0\n\telsif p1_answer == \"rock\" and p2_answer == \"paper\"\n\t\treturn 2\n\telsif p1_answer == \"scissors\" and p2_answer == \"rock\"\n\t\treturn 2\n\telsif p1_answer == \"paper\" and p2_answer == \"scissors\"\n\t \treturn 2\n\telse\n\t\treturn 1\n\tend\nend",
"def check_who_win(user_input, computer_input)\n if user_input == computer_input\n 'Haha! It is draw! You can try again!'\n elsif user_input == 'R'\n if computer_input == 'S'\n 'Wow! Rock smashes Scissors! You Win!'\n elsif computer_input == 'P'\n 'Oh! Paper covers Rock! You Lose!'\n end\n elsif user_input == 'P'\n if computer_input == 'R'\n 'Wow! Paper covers Rock! You Win!'\n elsif computer_input == 'S'\n 'Oh! scissors cuts Paper! You Lose!'\n end\n elsif user_input == 'S'\n if computer_input == 'P'\n 'Wow! Scissors cuts Paper! You Win!'\n elsif computer_input == 'R'\n 'Oh! Rock smashes Scissors! You Lose!'\n end\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\n end",
"def get_player_choice()\n\n puts \"[1] - rock\\n[2] - paper\\n[3] - scissors\\n\\n\"\n\n\n print \"Choose > \"\n\n inp = gets.chomp()\n\n while true\n\n case inp\n\n when \"1\"\n\n return \"rock\"\n \n when \"2\"\n\n return \"paper\"\n\n when \"3\"\n \n return \"scissors\"\n \n else\n puts \"[!] Option not found !\\n\"\n print \"Choose > \"\n\n inp = gets.chomp()\n \n end\n\n end\n\n end",
"def rps_game_winner(game)\n raise WrongNumberOfPlayersError unless game.length == 2\n @first_player = game[0];\n @second_player = game[1];\n \n raise NoSuchStrategyError unless (@first_player[1] =~ /\\A[RPS]\\z/i) and (@second_player[1] =~ /\\A[RPS]\\z/i)\n # if the first and second player chose the same move, the first player wins\n if @first_player[1] == @second_player[1]\n @winner = @first_player;\n # if the first and second player choose different moves... who wins?\n else\n # if the first player chooses rock\n if @first_player[1].upcase == 'R'\n # second player wins if he chooses paper\n if @second_player[1].upcase == 'P'\n @winner = @second_player\n # second player loses if he chooses scissors\n else\n @winner = @first_player\n end\n # if the first player chooses paper\n elsif @first_player[1].upcase == 'P'\n # second player loses if he chooses rock\n if @second_player[1].upcase == 'R'\n @winner = @first_player\n # second player wins if he chooses scissors\n else\n @winner = @second_player\n end\n # if the first player chooses scissors\n else\n # second player loses if he chooses paper\n if @second_player[1].upcase == 'P'\n @winner = @first_player\n # second player wins if he chooses rock\n else\n @winner = @second_player\n end\n end\n end\n # return the winner\n return @winner;\nend",
"def determine_winner(comp_choice, player_choice)\n rock = 0\n paper = 1\n scissors = 2\n\n player_won = 0\n comp_won = 1\n tie = 2\n\n if comp_choice == rock\n if player_choice = rock\n return tie\n elsif player_choice = paper\n return player_won\n else\n return comp_won\n end\n elsif comp_choice == paper\n if player_choice = rock\n return comp_won\n elsif player_choice = paper\n return tie\n else\n return player_won\n end\n else \n if player_choice = rock\n return player_won\n elsif player_choice = paper\n return comp_won\n else\n return tie\n end\n end\nend",
"def playRound(score)\n\tputs \"Player 1 enter your weapon: \"\n\tp1 = gets.chomp.downcase\n\tputs \"Player 2 enter your weapon: \"\n\tp2 = gets.chomp.downcase\n\tresult = determineWinner(p1, p2)\n\tupdateScore(score,result)\nend",
"def player_pick(player_num) #to convert the player's letter choice to a word\n if player_num == 'r'\n player_choice = 'rock'\n elsif player_num == 'p'\n player_choice = 'paper'\n elsif player_num == 's'\n player_choice = 'scissors'\n end\nend",
"def rps(fist1, fist2)\n if fist1 == 'rock'\n (fist2 == 'paper') ? 'paper' : 'rock'\n elsif fist1 == 'paper'\n (fist2 == 'scissors') ? 'scissors' : 'paper'\n else\n (fist2 == 'rock') ? 'rock' : 'scissors'\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else \n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def rps(fist1, fist2)\n if fist1 == \"rock\"\n (fist2 == \"paper\") ? \"paper\" : \"rock\"\n elsif fist1 == \"paper\"\n (fist2 == \"scissors\") ? \"scissors\" : \"paper\"\n else\n (fist2 == \"rock\") ? \"rock\" : \"scissors\"\n end\nend",
"def play(answer)\n until answer.downcase != \"y\"\n puts \"#{$scores[:player1_name]}, I assume that you already know the rules ;)\"\n puts \"Let's go!\"\n r = rand(3)\n computer_rps = $rps[r]\n puts \"Please enter 'R' for Rock, 'P' for Paper or 'S' for Scissors:\"\n player_rps = gets.chomp\n player_rps.upcase!\n case player_rps\n when \"R\"\n player_rps = \"Rock\"\n when \"P\"\n player_rps = \"Paper\"\n when \"S\"\n player_rps = \"Scissors\"\n else\n player_rps = \"Error\"\n end\n if player_rps != \"Error\"\n puts evaluate(player_rps, computer_rps)\n puts get_scores()\n else\n puts \"Error! you have enter something else than R, P or S\"\n end\n puts \"Do you want to play again? y/Y or n/N\"\n answer = gets.chomp\n end\n puts \"Thank you, bye!\"\nend",
"def determineWinner(p1_weapon, p2_weapon)\n\tif p1_weapon == \"rock\"\n\t\tif p2_weapon == \"paper\"\n\t\t\ttext = \"Player 2 wins this round!\"\n\t\telsif p2_weapon == \"scissors\"\n\t\t\ttext = \"Player 1 wins this round!\"\n\t\telsif p2_weapon == \"rock\"\n\t\t\ttext = \"Tie!\"\n\t\telse\n\t\t\ttext = \"Please enter rock, paper, or scissors!\"\n\t\tend\n\telsif p1_weapon == \"paper\"\n\t\tif p2_weapon == \"scissors\"\n\t\t\ttext = \"Player 2 wins this round!\"\n\t\telsif p2_weapon == \"rock\"\n\t\t\ttext = \"Player 1 wins this round!\"\n\t\telsif p2_weapon == \"paper\"\n\t\t\ttext = \"Tie!\"\n\t\telse\n\t\t\ttext = \"Please enter rock, paper, or scissors!\"\n\t\tend\n\telsif p1_weapon == \"scissors\"\n\t\tif p2_weapon == \"rock\"\n\t\t\ttext = \"Player 2 wins this round!\"\n\t\telsif p2_weapon == \"paper\"\n\t\t\ttext = \"Player 1 wins this round!\"\n\t\telsif p2_weapon == \"scissors\"\n\t\t\ttext = \"Tie!\"\n\t\telse\n\t\t\ttext = \"Please enter rock, paper, or scissors!\"\n\t\tend\n\telse\n\t\ttext = \"Please enter rock, paper, or scissors!\"\n\tend\n\tputs text\n\treturn text\nend",
"def determine_result(player, computer)\n if win?(player, computer)\n \"Win\"\n elsif win?(computer, player)\n \"Lose\"\n else\n \"Tie\"\n end\nend",
"def get_winner(comp,user)\n if (comp == user) \n puts \"It was a tie!\"\n elsif (comp ==\"rock\" && user == \"scissors\") || (comp ==\"paper\" && user == \"rock\") || (comp ==\"scissors\" && user == \"paper\")\n puts \"The computer wins!\"\n elsif ( comp == \"scissors\" && user ==\"rock\") || (comp == \"rock\" && user ==\"paper\") || (comp == \"paper\" && user ==\"scissors\")\n puts \"You win!\"\n else \n \tputs \"You did not pick either of the choices! Let's try this again.\" \n \tplay_game\n end \nend",
"def display_win_message(winning_choice)\n case winning_choice\n when 'p'\n puts \"Paper covers Rock!\"\n when 'r'\n puts \"Rock smashes Scissors\"\n when 's'\n puts \"Scissors cuts Paper!\"\n end\nend",
"def paper_scissors_rock\n clear_screen\n draw_shovel_line\n\tputs \"\\n Play with the Sphinx's stomach to get out!\\n\"\n sleep(1)\n\tresult = rand(3).floor\n\task_user \"\\n What have you got?:\" , \" \\n\\n 1| for paper \\u{1F4C3}\\n 2| for scissors \\u{2702}\\n 3| for rock \\u{270A}\\n\\n\"\n\tsleep(0.5)\n puts \" \\u{1F449}\"\n choice = gets.chomp.to_i\n\n\tif choice == result\n\t\tsay \"\\nIt's a tie!\\n\"\n sleep(1.5)\n\t\tpaper_scissors_rock\n\telsif choice < result\n\t\tsay \"\\nSorry, you lost\\n Try again!\"\n sleep(1.5)\n\t\tpaper_scissors_rock\n\telsif choice > result\n\t\tputs \"\\n You won! Get out!!!!\\n\"\n sleep(1.5)\n draw_shovel_line\n sleep(1.5)\n\n\tend\nend",
"def determineWinner\n if @botChoice == @playerChoice\n puts \"It's a tie! Redo round:\"\n elsif (@playerChoice == \"paper\" and @botChoice == \"rock\") or \\\n (@playerChoice == \"scissors\" and @botChoice == \"paper\") or \\\n (@playerChoice == \"rock\" and @botChoice == \"scissors\")\n @roundsWon += 1\n @roundsLeft -= 1\n puts \"You won this round! Rounds Won: #{@roundsWon}. Rounds Lost: #{@roundsLost}\"\n else\n @roundsLost += 1\n @roundsLeft -= 1\n puts \"You lost this round... Rounds Won: #{@roundsWon}. Rounds Lost: #{@roundsLost}\"\n end\n end",
"def winner?(player1_weapon,player2_weapon)\n if player1_weapon == \"rock\" && player2_weapon == \"scissors\"\n return 1\n elsif player1_weapon == \"paper\" && player2_weapon == \"rock\"\n return 1\n elsif player1_weapon == \"scissors\" && player2_weapon == \"paper\"\n return 1\n elsif player2_weapon == \"rock\" && player1_weapon == \"scissors\"\n return 2\n elsif player2_weapon == \"paper\" && player1_weapon == \"rock\"\n return 2\n elsif player2_weapon == \"scissors\" && player1_weapon == \"paper\"\n return 2\n elsif player1_weapon == player2_weapon\n return nil\n end\nend",
"def if_player_1_wins?\n\t($p1 == \"scissors\" && $p2 == \"paper\") || ($p1 == \"rock\" && $p2 == \"scissors\") || ($p1 == \"paper\" && $p2 == \"rock\") || ($p1 == \"rock\" && $p2 == \"lizard\") || ($p1 == \"spock\" && $p2 == \"scissors\") || ($p1 == \"scissors\" && $p2 == \"lizard\") || ($p1 == \"spock\" && $p2 == \"rock\") || ($p1 == \"lizard\" && $p2 == \"paper\") || ($p1 == \"paper\" && $p2 == \"spock\")|| ($p1 == \"lizard\" && $p2 == \"spock\") \nend",
"def game\n puts \"\\nTake your pick: (R)ock, (P)aper, (S)cissors\"\n sleep(1)\n puts \"\\nShoot!\"\n\n computer = \"rps\"[rand(3)].chr\n player = gets.chomp.downcase\n case [player, computer]\n when ['r','s'],['s','p'],['p','r']\n puts \"\\nWIN\"\n puts \"\\nThe computer chose #{computer}.\"\n roundcount\n again\n when ['r','r'],['p','p'],['s','s']\n puts \"\\nTIE\"\n puts \"\\nThe computer chose #{computer}.\"\n roundcount\n again\n when ['s','r'],['p', 's'],['r', 'p']\n puts \"\\nLOSER\"\n puts \"\\nThe computer chose #{computer}.\"\n roundcount\n again\n else\n puts \"\\nARE YOU A MORON? CHOOSE R,P,S\"\n game\n end\nend",
"def p_winner(tictactoe)\n return \"Player 1\" if tictactoe.winner?(p1_moves(tictactoe))\n return \"Player 2\" if tictactoe.winner?(p2_moves(tictactoe))\n return \"Draw\" if tictactoe.draw?(p1_moves(tictactoe),p2_moves(tictactoe))\n end",
"def rps_game_winner(game)\n raise WrongNumberOfPlayersError unless game.length == 2\n @P1 = game[0][1]\n @P2 = game[1][1]\n\n \n if(@P1.match(/[RPS]/)) && (@P2.match(/[RPS]/))\n\n if(@P1 == \"R\") && (@P2 == \"S\")\n return game[0]\n elsif(@P1 == \"R\") && (@P2 == \"P\")\n\treturn game[1]\n end\n\t\n if(@P1 == \"P\") && (@P2 == \"R\")\n return game[0]\n elsif(@P1 == \"P\") && (@P2 == \"S\")\n\treturn game[1]\n end\n \n \n if(@P1 == \"S\") && (@P2 == \"P\")\n\treturn game[0]\n elsif(@P1 == \"S\") && (@P2 == \"R\")\n\treturn game[1]\n end\n end\n\n end",
"def rps(arg1, arg2)\n if arg1 == arg2\n puts \"Remis\"\n elsif (arg1 == \"paper\" && arg2 == \"rock\") || (arg1 == \"scissors\" && arg2 == \"paper\") || (arg1 == \"rock\" && arg2 == \"scissors\")\n puts \"Gracz 1 wygrywa\"\n else\n puts \"Gracz 2 wygrywa\"\n end\nend",
"def rps\nputs \"Rock...\"\nsleep(0.5)\nputs \"Paper...\"\nsleep(0.5)\nputs \"Scissors...\"\nsleep(0.5)\nputs \"Shoot!\"\nsleep(0.1)\nputs \" \"\nend",
"def choose_winner; end",
"def winning_message(player)\n case player\n when 'Paper'\n puts \"Paper wraps rock\"\n when 'Rock'\n puts \"Rock breaks scissors\"\n when 'Scissors'\n puts \"Scissors cuts paper\"\n end\nend",
"def display_results(player, computer)\n if win?(player, computer)\n prompt 'You won!'\n elsif win?(computer, player)\n prompt 'You lost!'\n else\n prompt \"It's a tie!\"\n end\nend",
"def choose_weapons\n puts \"Choose 'r' for rock, 'p' for paper or 's' for scissors\"\n return gets.chomp.downcase\n end",
"def tie\n puts \"It's a draw! Nobody wins :(\"\n end",
"def getRoundResult(winning_suit, suit1, number1, suit2, number2)\n # Write your code here\n return 'Player 1 wins' if suit1 == winning_suit && suit2 != winning_suit\n return 'Player 2 wins' if suit2 == winning_suit && suit1 != winning_suit\n if (suit1 == winning_suit && suit2 == winning_suit) || (suit1 != winning_suit && suit2 != winning_suit)\n if number1 > number2\n return 'Player 1 wins'\n elsif number2 > number1\n return 'Player 2 wins'\n else\n return 'Draw'\n end\n end\nend",
"def play_round\n puts \"Your throw: #{@user_current_throw}\"\n puts \"Computers throw: #{@comp_current_throw}\"\n case @user_current_throw\n when @rock\n if @comp_current_throw == @rock\n puts \"Tie! play again\"\n elsif @comp_current_throw == @scissors\n @user_score += 1\n puts \"You win this round!\"\n elsif @comp_current_throw == @paper\n @comp_score += 1\n puts \"Computer wins this round\"\n end\n when @paper\n if @comp_current_throw == @paper\n puts \"Tie! play again\"\n elsif @comp_current_throw == @rock\n @user_score += 1\n puts \"You win this round!\"\n elsif @comp_current_throw == @scissors\n @comp_score += 1\n puts \"Computer wins round\"\n end\n when @scissors\n if @comp_current_throw == @scissors\n puts \"Tie! play again\"\n elsif @comp_current_throw == @paper\n @user_score += 1\n puts \"You win this round!\"\n else\n puts \"Computer wins round\"\n @comp_score += 1\n end\n end #end of case/when\n puts \"Current scores: You: #{@user_score} Computer: #{@comp_score}\"\n end",
"def play()\n \n begin\n \n @computer_choice = get_computer_choice()\n @player_choice = get_player_choice()\n \n result = logic(@computer_choice, @player_choice)\n\n get_choices()\n \n case result\n\n when \"tie\"\n @rounds -= 1\n @ties += 1\n puts \"[~] it's a tie !\"\n \n when \"player win\"\n @rounds -= 1\n @player_wins += 1\n puts \"[$] Player win this round (#{@player_wins}/3)!\"\n\n when \"computer win\"\n @rounds -= 1\n @computer_wins += 1\n puts \"[$] Computer win this round (#{@computer_wins}/3)!\"\n\n end\n\n rescue Interrupt\n\n puts \"\\n\\n[!] Keyboard interrupt, Exting.\"; exit()\n \n \n end\n \n\n end",
"def print_winning_message(winning_choice)\n case\n when 'Rock'\n say('Rock smashes scissors!')\n when 'Paper'\n say('Paper covers rock!')\n when 'Scissors'\n say('Scissors cuts paper!')\n end\nend",
"def choose\n \n case @last_opponent_choice\n when :paper\n [:rock, :scissors][rand(2)]\n when :rock\n [:paper, :scissors][rand(2)]\n when :scissors\n [:rock, :scissors][rand(2)]\n end\n \n #:paper\n \n \n end",
"def play_game\n puts \"Would you like to play\"\n puts \"Rock-Paper-Scissor (RPS)\" \n puts \"OR\" \n puts \"Rock-Paper-Scissor-Lizard-Spock? (RPSLS)\"\n h_line\n rule_type = check_input([\"RPS\",\"RPSLS\"])\n rules = rule_type == \"RPS\" ? RPS_Rules.new : RPSLS_Rules.new\n puts \"Ok! Let's play \" + rules.prompt + \"!\"\n h_line\n p1 = create_player(1,rules)\n p2 = create_player(2,rules)\n h_line\n puts \"Great. How many points are you playing to? (1-5)\"\n valid = [\"1\",\"2\",\"3\",\"4\",\"5\"]\n length = check_input(valid).to_i\n this_game = Game.new(p1,p2,length,rules)\n h_line\n puts \"Ok!\"\n puts rules.prompt + \":\"\n puts this_game.p1.control + \":\" +this_game.p1.name + \" > VERSUS < \" + this_game.p2.name + \":\" + this_game.p2.control\n puts \"First to \" + length.to_s + \" points wins!\"\n pause\n this_game.run_game\nend",
"def loss(pick_l)\n case pick_l \n when 'r' \n puts \"You: Rock | Me: Paper\"\n when 'p'\n puts \"you: Paper | Me: Scissors\"\n when 's'\n puts \"you: Scissors | Me: Rock\"\n end\nend",
"def determineWinner(p1_weapon, p2_weapon)\n\ttext = \"\"\n\tif p1_weapon == \"rock\"\n\t\tif p2_weapon == \"paper\" then text = \"P2 wins!\"\n\t\telsif p2_weapon == \"scissors\" then text = \"P1 wins!\"\n\t\telsif p2_weapon == \"rock\" then text = \"Tie!\" \n\t\telse text = \"Player 2 must choose rock, paper, or scissors. Replay round.\" end\n\telsif p1_weapon == \"paper\"\n\t\tif p2_weapon == \"scissors\" then text = \"P2 wins!\"\n\t\telsif p2_weapon == \"rock\" then text = \"P1 wins!\"\n\t\telsif p2_weapon == \"paper\" then text = \"Tie!\"\n\t\telse text = \"Player 2 must choose rock, paper, or scissors. Replay round.\" end\n\telsif p1_weapon == \"scissors\"\n\t\tif p2_weapon == \"rock\" then text = \"P2 wins!\"\n\t\telsif p2_weapon == \"paper\" then text = \"P1 wins!\"\n\t\telsif p2_weapon == \"scissors\" then text = \"Tie!\"\n\t\telse text = \"Player 2 must choose rock, paper, or scissors. Replay round.\" end\n\telse \n\t\ttext = \"P1 must choose Rock, Paper or Scissors.\"\n\t\tunless p2_weapon == \"rock\" || p2_weapon == \"paper\" || p2_weapon == \"scissors\"\n\t\t\ttext = text + \"\\nPlayer 2 must choose rock, paper, or scissors. Replay round.\"\n\t\tend\n\tend\n\treturn text\nend",
"def rps_game_winner(game)\n raise WrongNumberOfPlayersError unless game.length == 2\n game.each do |sign|\nif sign[1] != \"R\" and sign[1] != \"P\" and sign[1] != \"S\"\nraise NoSuchStrategyError\nend\n end\n if game[0][1] == \"R\" and game[1][1] != \"P\"\nreturn game[0]\n elsif game[0][1] == \"P\" and game[1][1] != \"S\"\nreturn game[0]\n elsif game[0][1] == \"S\" and game[1][1] != \"R\"\nreturn game[0]\n else\nreturn game[1]\n end\nend",
"def record_users_choice input\n\n if input == \"p\"\n player_picked = \"Paper\"\n elsif input == \"r\"\n player_picked = \"Rock\"\n elsif input == \"s\"\n player_picked = \"Scissors\"\n end\nend",
"def start_game\n p = super\n cpu_move = pick_rps\n s = p.select(\"Your opponent throws #{cpu_move}. You throw:\", rpsArr) #Prompt Rc/Pp/Sc and wait for input\n winner?(win_hash[cpu_move.to_sym],s)\n end",
"def whoWon(p1weapon, p2weapon)\n\n\tif p1weapon === p2weapon\n\t\twinnerResult = \"It's a tie!\"\n\t\tputs(winnerResult)\n\t\tputs \"The score is currently \" + $player1Score.to_s + \" to \" + $player2Score.to_s + \".\"\n\t\tstartGame\n\t\treturn winnerResult\n\tend\t\n\n\tif (p1weapon === \"rock\" && p2weapon === \"scissors\") || (p1weapon === \"scissors\" && p2weapon === \"paper\") || (p1weapon === \"paper\" && p2weapon === \"rock\")\n\t\twinnerResult = \"Player 1 wins!!!\"\n\t\tputs(winnerResult)\n\t\taddScore(winnerResult)\n\t\treturn winnerResult\n\tend\n\n\tif (p2weapon === \"rock\" && p1weapon === \"scissors\") || (p2weapon === \"scissors\" && p1weapon === \"paper\") || (p2weapon === \"paper\" && p1weapon === \"rock\")\n\t\twinnerResult = \"Player 2 wins!!!\"\n\t\tputs(winnerResult)\n\t\taddScore(winnerResult)\n\t\treturn winnerResult\n\tend\nend",
"def determine_winner(player_one_selection, player_two_selection)\n if player_one_selection == player_two_selection\n outcome = \"\\nThis round was a tie. You both chose '#{player_one.move}'\"\n elsif player_one_selection == \"rock\" && player_two_selection == \"scissors\" ||\n player_one_selection == \"paper\" && player_two_selection == \"rock\" ||\n player_one_selection == \"scissors\" && player_two_selection == \"paper\"\n outcome = \"\\n#{player_one.name} won this round!\"\n @player_one.wins_round\n elsif player_two_selection == \"rock\" && player_one_selection == \"scissors\" ||\n player_two_selection == \"paper\" && player_one_selection == \"rock\" ||\n player_two_selection == \"scissors\" && player_one_selection == \"paper\"\n outcome = \"\\n#{player_two.name} won this round!\"\n @player_two.wins_round\n else\n puts \"\\nSomething strange happened here\"\n end\n outcome\n end",
"def play_game\n display_header\n user = collect_and_validate_input \"Choose a Play (R/P/S)\", :play\n computer = %w(R P S).sample\n \n # determine who won this round\n display_header\n string = case user\n when computer\n \"It's a TIE!!!\"\n when \"P\"\n computer == \"R\" ? \"Paper covers rock! YOU WIN!\" : \"Scissors cut paper! Computer Wins!\"\n when \"R\"\n computer == \"S\" ? \"Rock breaks scissors! YOU WIN!\" : \"Paper covers Rock! Computer Wins!\"\n when \"S\"\n computer == \"P\" ? \"Scissors cut paper! YOU WIN!\" : \"Rock breaks scissors! Computer Wins!\"\n end\n puts string\n \n # ask the user if they wish to play again\n again = (collect_and_validate_input \"Would you like to go again? (Y/N)\", :again).upcase\n again == \"Y\" ? play_game : (puts \"Thanks for playing!\")\nend",
"def rules (player_choice, comp_choice, comp_score, player_score)\n\t\tputs \"Player: #{player_choice}\"\n\t\tputs \"Computer: #{comp_choice}\"\n\t\tif player_choice == comp_choice\n\t\t\tputs \"Tie\"\n\t\t\tcomp_score+=1\n\t\t\tplayer_score+=1\n\t\t\tmenu(player_score, comp_score)\n\t\telsif player_choice == 'rock'\n\t\t\tif comp_choice == 'paper'\n\t\t\t\tputs \"Comp wins\"\n\t\t\t\tcomp_score+=1\n\t\t\t\tmenu(player_score, comp_score)\n\t\t\telse\n\t\t\t\tputs \"Player wins\"\n\t\t\t\tplayer_score+=1\n\t\t\t\tmenu(player_score, comp_score)\n\t\t\tend\n\t\telsif player_choice == 'paper'\n\t\t\tif comp_choice == 'scissors'\n\t\t\t\tputs \"Comp wins\"\n\t\t\t\tcomp_score+=1\n\t\t\t\tmenu(player_score, comp_score)\n\t\t\telse \n\t\t\t\tputs \"Player wins\"\n\t\t\t\tplayer_score+=1\n\t\t\t\tmenu(player_score, comp_score)\n\t\t\tend\n\t\telsif player_choice == 'scissors'\n\t\t\tif comp_choice == 'rock'\n\t\t\t\tputs \"Comp wins\"\n\t\t\t\tcomp_score+=1\n\t\t\t\tmenu(player_score, comp_score)\n\t\t\telse \n\t\t\t\tputs \"Player wins\"\n\t\t\t\tplayer_score+=1\n\t\t\t\tmenu(player_score, comp_score)\n\t\t\tend\n\t\telse \n\t\t\tputs \"Not a valid choice.\"\n\t\t\tmenu(player_score, comp_score)\n\t\tend\n\tend",
"def winner(player)\n puts \"Player #{player} is the WINRAR!\"\n end",
"def new_game\n puts \"Let's rochambeau!\"\n puts \"Use 'r' to choose rock, 'p' to choose paper, and 's' to choose scissors.\"\n puts \"Ready? (press any key)\"\n gets\n end",
"def determine_winner\n if @current_moves[0] == @current_moves[1]\n \t\tputs \"We have a tie!\"\n \telsif ((@current_moves[0] == \"Rock\") && (@current_moves[1] == \"Scissors\")) \n \t\tputs \"#{player_1.name} wins - #{@current_moves[0]} crushes #{@current_moves[1]}\"\n @winner = @player_1\n player_1.games_won\n \telsif ((@current_moves[0] == \"Scissors\") && (@current_moves[1] == \"Paper\")) \n \t\tputs \"#{player_1.name} wins - #{@current_moves[0]} cuts #{@current_moves[1]}\"\n @winner = @player_1\n player_1.games_won\n \telsif ((@current_moves[0] == \"Paper\") && (@current_moves[1] == \"Rock\"))\n \t\tputs \"#{player_1.name} wins - #{@current_moves[0]} covers #{@current_moves[1]}\"\n @winner = @player_1\n player_1.games_won\n \telse\n \t\tputs \"#{player_2.name} wins - #{@current_moves[1]} beats #{@current_moves[0]}\"\n @winner = @player_2\n player_2.games_won\n \tend\n end",
"def round(player,hash_board)\n \tputs \" Damn it #{player.name}, that's your turn.\".colorize(:green)\n \tputs \" (Your sign is #{player.sign})\".colorize(:green)\n \twhile true\n \t print \" Select the case you want to play (format A1) > \".colorize(:green)\n case_played = (gets.chomp.to_s).upcase\n if hash_board[\"#{case_played.upcase}\"] == \" -\"\n \treturn case_played\n else\n \tputs \" Wrong choice!!!\\n\".colorize(:red)\n end\n end\n end",
"def play\nturn until over?\nif won?\n puts \"Congratulations #{winner}!\"\nelsif draw? == true\n puts \"Game over! Thanks for playing.\"\nend\nend",
"def winner\n return nil if player_one_move == player_two_move\n winning_combinations = { 'rock' => 'scissors', 'scissors' => 'paper', 'paper' => 'rock' }\n {\n true => player_one,\n false => player_two,\n }[winning_combinations[player_one_move] == player_two_move]\n end",
"def rps_game_winner(game)\n # check parameters\n raise WrongNumberOfPlayersError unless game.length == 2\n player1 = game[0]\n player2 = game[1]\n raise WrongNumberOfPlayersError unless \n (player1.length == 2) && \n (player2.length == 2)\n # play game\n return rps_result(player1, player2)\nend",
"def scoreboard(round_winner)\n if round_winner != 0\n round_winner == 1 ? round_winner = @player1 : round_winner = @player2 \n puts \"#{round_winner.name} won the round.\"\n round_winner.win\n else puts \"tie\"\n end\n puts \"#{player1.name}: #{player1.score}\", \"#{player2.name}: #{player2.score}\"\n end",
"def player_wins(player1_action, player2_action)\n if ((player1_action == \"R\" and player2_action == \"S\") or\n (player1_action == \"S\" and player2_action == \"P\") or\n (player1_action == \"P\" and player2_action == \"R\"))\n return true\n end\nend",
"def rps(c)\n puts \"enter r, p, or s\"\n o = [\"r\", \"p\", \"s\"]\n d = o.sample\n if (c == d)\n puts 'tie'\n elsif (c == \"r\" && d == \"p\" || c == \"s\" && d == \"r\" || c == \"p\" && d == \"s\")\n puts 'You Lose'\n else\n puts 'You win'\n end\nend",
"def determine_game_winner(p1, p2)\n winning_choices = {spock: [\"scissors\", \"rock\"], paper: [\"rock\", \"spock\"], scissors: [\"paper\", \"lizard\"], rock: [\"scissors\", \"lizard\"], lizard: [\"spock\", \"paper\"]}\n \n if p1.move == p2.move\n winner = Player.new(\"Neither\")\n elsif\n winning_choices[p1.move.to_sym].include?(p2.move.to_s)\n winner = p1\n else\n winner = p2\n end\n winner.score += 1\n return winner\n end",
"def calculate_winner(a, b)\n if a == b\n puts \"A tie!\"\n return [0,0]\n elsif a == ROCK && b == SCISSORS ||\n a == SCISSORS && b == PAPER ||\n a == PAPER && b == ROCK\n puts \"You win that round! (#{RPS::CHOICES[a]} beats #{RPS::CHOICES[b]})\"\n return [1,0]\n elsif b == ROCK && a == SCISSORS ||\n b == SCISSORS && a == PAPER ||\n b == PAPER && a == ROCK\n puts \"You lose that round :( (#{RPS::CHOICES[a]} loses to #{RPS::CHOICES[b]})\"\n return [0,1]\n end\n puts \"what: #{a} #{b}\"\n end"
] |
[
"0.7909239",
"0.7767667",
"0.7549004",
"0.7447289",
"0.7404648",
"0.73192704",
"0.7290745",
"0.72346854",
"0.7197022",
"0.71951705",
"0.71461445",
"0.7145533",
"0.71226215",
"0.7109055",
"0.71026695",
"0.7096357",
"0.70457935",
"0.70231926",
"0.7000322",
"0.6953865",
"0.69460285",
"0.6941478",
"0.6932927",
"0.6928409",
"0.6903799",
"0.6903233",
"0.68965566",
"0.6892402",
"0.68909836",
"0.688021",
"0.6870684",
"0.68567884",
"0.6850999",
"0.68427783",
"0.6838423",
"0.6833187",
"0.6829606",
"0.68220025",
"0.681702",
"0.68052137",
"0.68036336",
"0.68026507",
"0.68026507",
"0.68026507",
"0.68026507",
"0.68026507",
"0.68026507",
"0.68026507",
"0.68026507",
"0.68026507",
"0.68026507",
"0.68026507",
"0.68026507",
"0.68026507",
"0.6794099",
"0.6786836",
"0.6779103",
"0.6772138",
"0.67672724",
"0.6765074",
"0.67580336",
"0.6746594",
"0.67419314",
"0.67363304",
"0.6735614",
"0.6729985",
"0.6688357",
"0.6687438",
"0.66863906",
"0.66830635",
"0.6673154",
"0.6655656",
"0.6646215",
"0.6628888",
"0.6616044",
"0.6609636",
"0.66012335",
"0.6589244",
"0.6581722",
"0.65737015",
"0.6559809",
"0.65578216",
"0.6550199",
"0.65482914",
"0.6543958",
"0.65357816",
"0.65236706",
"0.6519248",
"0.6518396",
"0.6517448",
"0.65168476",
"0.65144527",
"0.6497888",
"0.6494825",
"0.649394",
"0.6492855",
"0.64825326",
"0.6482366",
"0.6481982",
"0.647862"
] |
0.8137535
|
0
|
GET /auto1h_fold_changes/1 GET /auto1h_fold_changes/1.xml
|
def show
@auto1h_fold_change = Auto1hFoldChange.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @auto1h_fold_change }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @auto1h_fold_change.update_attributes(params[:auto1h_fold_change])\n format.html { redirect_to(@auto1h_fold_change, :notice => 'Auto1h fold change was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @auto1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @auto1h_fold_change = Auto1hFoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auto1h_fold_change }\n end\n end",
"def show\n @hetero1h_fold_change = Hetero1hFoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hetero1h_fold_change }\n end\n end",
"def update\n @hetero1h_fold_change = Hetero1hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @hetero1h_fold_change.update_attributes(params[:hetero1h_fold_change])\n format.html { redirect_to(@hetero1h_fold_change, :notice => 'Hetero1h fold change was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hetero1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @auto24h_fold_change = Auto24hFoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auto24h_fold_change }\n end\n end",
"def destroy\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n @auto1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @auto1h_fold_change = Auto1hFoldChange.new(params[:auto1h_fold_change])\n\n respond_to do |format|\n if @auto1h_fold_change.save\n format.html { redirect_to(@auto1h_fold_change, :notice => 'Auto1h fold change was successfully created.') }\n format.xml { render :xml => @auto1h_fold_change, :status => :created, :location => @auto1h_fold_change }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @auto1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @auto24h_fold_change = Auto24hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @auto24h_fold_change.update_attributes(params[:auto24h_fold_change])\n format.html { redirect_to(@auto24h_fold_change, :notice => 'Auto24h fold change was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @auto24h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @hetero1h_fold_change = Hetero1hFoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hetero1h_fold_change }\n end\n end",
"def changes\n respond_to do |format|\n format.xml do\n raise ::AbstractController::ActionNotFound if params[:interval].blank?\n @changes = Node.all_including_deleted(:conditions => ['updated_at > ?', Time.now - params[:interval].to_i], :order => 'updated_at DESC')\n end\n format.any(:rss, :atom) do\n @nodes = @node.last_changes(:all, { :limit => 25 })\n render :template => '/shared/changes', :layout => false\n end\n end\n end",
"def changes\n poll(\"Changes\")\n end",
"def get_changes\n CouchRest.get(SERVER.uri << DB.uri << \"/_changes\")\nend",
"def show\n @auto24h_r2_fold_change = Auto24hR2FoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @auto24h_r2_fold_change }\n end\n end",
"def index\n @changes = Change.all\n end",
"def show\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hetero24h_r2_fold_change }\n end\n end",
"def new\n @auto24h_fold_change = Auto24hFoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auto24h_fold_change }\n end\n end",
"def destroy\n @hetero1h_fold_change = Hetero1hFoldChange.find(params[:id])\n @hetero1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(hetero1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def show_changes\n if error.blank?\n if changes.length == 0\n error_block(\"No changes for #{defect_name}\")\n else\n build_html do\n c_enum = changes.to_enum\n div.defect do\n describe_defect_changes(c_enum)\n end\n end\n end\n else\n error_block(error)\n end\n end",
"def destroy\n @auto24h_fold_change = Auto24hFoldChange.find(params[:id])\n @auto24h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto24h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def test_7082\n setup_changeset_test(7082)\n p find_changes('el_type' => 'W', 'el_id' => '16105282')[0]\n p find_changes('el_type' => 'W', 'el_id' => '16105282')[1]\n assert_equal(1, find_changes('el_type' => 'W', 'el_id' => '16105282').size)\n end",
"def update\n @auto24h_r2_fold_change = Auto24hR2FoldChange.find(params[:id])\n\n respond_to do |format|\n if @auto24h_r2_fold_change.update_attributes(params[:auto24h_r2_fold_change])\n format.html { redirect_to @auto24h_r2_fold_change, notice: 'Auto24h r2 fold change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @auto24h_r2_fold_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hetero1h_fold_change = Hetero1hFoldChange.new(params[:hetero1h_fold_change])\n\n respond_to do |format|\n if @hetero1h_fold_change.save\n format.html { redirect_to(@hetero1h_fold_change, :notice => 'Hetero1h fold change was successfully created.') }\n format.xml { render :xml => @hetero1h_fold_change, :status => :created, :location => @hetero1h_fold_change }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hetero1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @auto24h_fold_change = Auto24hFoldChange.new(params[:auto24h_fold_change])\n\n respond_to do |format|\n if @auto24h_fold_change.save\n format.html { redirect_to(@auto24h_fold_change, :notice => 'Auto24h fold change was successfully created.') }\n format.xml { render :xml => @auto24h_fold_change, :status => :created, :location => @auto24h_fold_change }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @auto24h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.find(params[:id])\n\n respond_to do |format|\n if @hetero24h_r2_fold_change.update_attributes(params[:hetero24h_r2_fold_change])\n format.html { redirect_to @hetero24h_r2_fold_change, notice: 'Hetero24h r2 fold change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hetero24h_r2_fold_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def changes\n result = get_modified_from_solr(first_modified: params['first_modified'], last_modified: params['last_modified'])\n render_result(result)\n end",
"def index\n @changes = Change.find(:all, :conditions => [\"priority_id = ? or new_priority_id = ?\",@priority.id,@priority.id], :order => \"updated_at desc\").paginate :page => params[:page], :per_page => params[:per_page]\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @changes.to_xml(:include => [:user, :priority, :new_priority], :except => NB_CONFIG['api_exclude_fields']) }\n format.json { render :json => @changes.to_json(:include => [:user, :priority, :new_priority], :except => NB_CONFIG['api_exclude_fields']) } \n end\n end",
"def get_changes(opts = {})\n data, _status_code, _headers = get_changes_with_http_info(opts)\n data\n end",
"def index\n @working_changes = WorkingChange.all\n end",
"def update_xml_from_api(tries: 5)\n url = \"#{BASE_URL}/show/#{nct_id}?resultsxml=true\"\n attempts = 0\n content = nil\n begin\n attempts += 1\n s = Time.now\n content = Faraday.get(url).body\n puts \" fetch #{Time.now - s}\"\n rescue Faraday::ConnectionFailed\n return false if attempts > 5\n retry\n end\n xml = Nokogiri::XML(content)\n if xml.xpath('//clinical_study').length > 0\n self.content = content\n return false unless changed?\n return update content: content\n else\n # add error\n end\n end",
"def start_continuous_changes(host, port, db, heartbeat = '1000')\n Net::HTTP.get_response(host, '/' << db << '/_changes?feed=continuous&heartbeat=' << heartbeat, port) do |response|\n response.read_body do |notification|\n if notification?(notification) #Due to heartbeat, it's a newline instead of notification. \n result = JSON.parse(notification)\n puts result\n if (notification_type(notification) == \"save/update\") #not good to get non-existing doc.\n puts \"Here we go, getting the doc:\"\n doc = get_doc(get_doc_id(result))\n puts doc\n if affects_me?(doc, db)\n puts \"YES, IT DID!\"\n jobs = get_job(doc)\n jobs.each do |job|\n system(job)\n end\n else\n puts \"nah, it was for #{doc[\"node\"]}\"\n end\n end\n end\n end\n end\nend",
"def show\n @knowledge = Knowledge.find(params[:id])\n\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), knowledge_path(@knowledge)\n \n #fresh_when :etag => [@knowledge] \n if stale?(:etag => @knowledge, :last_modified => @knowledge.created_at)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @knowledge }\n end\n end\n end",
"def destroy\n @auto24h_r2_fold_change = Auto24hR2FoldChange.find(params[:id])\n @auto24h_r2_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to auto24h_r2_fold_changes_url }\n format.json { head :no_content }\n end\n end",
"def changelog\n verify_ajax_request\n require_parameters :id\n @issue_results = Api.issues.find(params[:id])\n @issue = @issue_results.first()\n @changelog = Internal.issues.changelog(params[:id])\n render :partial => 'issue/changelog'\n end",
"def all_changed_by_completion_toggle\n handle_xhr_request do\n raise MissingUserChecklistParameterError, t('.missing-checklist-param-error') if params[:id].blank?\n\n user_checklist_id = params[:id]\n user_checklist = UserChecklist.find(user_checklist_id)\n raise ActiveRecord::RecordNotFound, t('.not_found', id: user_checklist_id) if user_checklist.nil?\n\n # toggle the date_completed and update any parents needed\n user_checklist.all_changed_by_completion_toggle\n\n check_membership_status_if_complete(user_checklist.root, user_checklist.root.percent_complete)\n\n { checklist_id: user_checklist.id,\n date_completed: user_checklist.date_completed,\n overall_percent_complete: user_checklist.percent_complete\n }\n end\n end",
"def changed\n _find_changed_twins!(@_changes)\n\n @_changes\n end",
"def changeset(message=\"Story:#{PTID} Implement awesome feature\")\n xml =<<EOF\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<changeset>\n <author-date type=\"datetime\">2010-05-26T17:22:11Z</author-date>\n <author-email>toby.matejovsky@gmail.com</author-email>\n <author-id type=\"integer\">1</author-id>\n <author-name>Toby Matejovsky</author-name>\n <committer-date type=\"datetime\">2010-05-26T17:22:11Z</committer-date>\n <committer-email>toby.matejovsky@gmail.com</committer-email>\n <committer-id type=\"integer\">1</committer-id>\n <committer-name>Toby Matejovsky</committer-name>\n <created-at type=\"datetime\">2010-05-26T17:22:11Z</created-at>\n <id type=\"integer\">3564</id>\n <message>#{message}</message>\n <repository-id type=\"integer\">6</repository-id>\n <revision>4f657b17281aaae24284bfd15e47f9c279049f9b</revision>\n</changeset>\nEOF\n end",
"def index\n @refactorings = Refactoring.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @refactorings }\n end\n end",
"def new\n @auto24h_r2_fold_change = Auto24hR2FoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auto24h_r2_fold_change }\n end\n end",
"def history\n # Should be paginatable.\n # Oh, it's belongs as a separate resource, paginateable.\n self.edits.where(state: 'applied').order(:date)\n end",
"def scan_for_changes(path)\n path = Pathname.new(path)\n path = @app.root.pathname + path if path.relative?\n @app.indexer.scan(path)\n end",
"def content_changes\n attributes.fetch(:contentChanges)\n end",
"def content_changes\n attributes.fetch(:contentChanges)\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def changelog\n return @changelog if @changelog\n \n @changelog = Amp::Mercurial::ChangeLog.new @store.opener\n \n if path = ENV['HG_PENDING']\n if path =~ /^#{root}/\n @changelog.read_pending('00changelog.i.a')\n end\n end\n \n @changelog\n end",
"def show\n @changelog = Changelog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @changelog }\n end\n end",
"def document_changes\n attributes.fetch(:documentChanges)\n end",
"def document_changes\n attributes.fetch(:documentChanges)\n end",
"def index\n \n @design = Design.find(params[:id])\n #@design.design_changes.find(:all, :order => 'approved, created_at ASC')\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @design }\n end\n end",
"def describe_defect_changes(enum)\n begin\n change = enum.peek\n rescue StopIteration\n return \"\"\n end\n span do\n defect_heading(change)\n end\n ul.defect do\n list_defect_changes(enum)\n end\n end",
"def changes\n @changes ||= Set.new\n end",
"def changes\n @changes ||= Set.new\n end",
"def describe_single_change(change)\n split_path = change.path.split(/\\//)\n if change.prev_sccsid.blank?\n text \"Initial Drop\"\n else\n a(change.prev_sccsid, href: src_files_path(change.release,\n split_path,\n change.prev_sccsid))\n text ' '\n a(\"->\", href: diffs_path(change.release,\n split_path,\n change.sccsid,\n change.prev_sccsid))\n end\n text ' '\n a(change.sccsid, href: src_files_path(change.release,\n split_path,\n change.sccsid))\n text ' '\n text change.type\n text ' '\n text change.path\n end",
"def list_file_changed\n content = \"Files changed since last deploy:\\n\"\n IO.popen('find * -newer _last_deploy.txt -type f') do |io| \n while (line = io.gets) do\n filename = line.chomp\n if user_visible(filename) then\n content << \"* \\\"#{filename}\\\":{{site.url}}/#{file_change_ext(filename, \".html\")}\\n\"\n end\n end\n end \n content\nend",
"def changes_from_template\n changes_from_document(template, false)\n end",
"def show\n @change = @priority.changes.find(params[:id])\n @page_title = t('changes.show.title', :priority_name => @priority.name)\n for a in @change.activities.find(:all, :conditions => \"type in ('ActivityCapitalAcquisitionProposal','ActivityPriorityMergeProposal')\")\n @activity = a\n end\n if @activity\n @activities = @change.activities.active.by_recently_updated.find(:all, :conditions => \"id <> #{@activity.id.to_s}\").paginate :page => params[:page], :per_page => params[:per_page]\n else\n @activities = @change.activities.active.by_recently_updated.paginate :page => params[:page], :per_page => params[:per_page]\n end\n @vote = nil\n\t\t@vote = @change.votes.find_by_user_id(current_user.id) if logged_in?\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @change.to_xml(:include => [:user, :priority, :new_priority], :except => NB_CONFIG['api_exclude_fields']) }\n format.json { render :json => @change.to_json(:include => [:user, :priority, :new_priority], :except => NB_CONFIG['api_exclude_fields']) } \n end\n end",
"def reload\n client.get_change(number)\n end",
"def refresh!\n load if changed?\n end",
"def code_revs\n @arc = Arc.find_by_code(params[:code])\n @arc_revs = @arc.rev_relationships\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @arc_revs.to_xml(:root => 'relationships', :except => [ :created_at, :updated_at ]) }\n end\n end",
"def refresh\n # FIXME\n end",
"def destroy\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.find(params[:id])\n @hetero24h_r2_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to hetero24h_r2_fold_changes_url }\n format.json { head :no_content }\n end\n end",
"def diffs_to_api\n return @diffs_to_api if @diffs_to_api\n @diffs_to_api = []\n\n diffs.each do |diff|\n path = diff.delta.new_file[:path]\n # Presumably only the first commit\n next if path.split('.').first.to_s.downcase == \"readme\"\n\n lines = []\n diff.each_hunk.each do |hunk|\n lines += hunk.lines\n end\n\n html = OutputRenderer.diff(lines)\n status = diff.delta.status\n\n @diffs_to_api << {\n status: status,\n path: path,\n html: html,\n content: @repo.lookup(diff.delta.new_file[:oid]).content\n }\n\n end\n\n @diffs_to_api\n end",
"def index\n @farmer_group_changes = @farmer.farmer_group_changes.all.page(params[:page]).per(20)\n end",
"def index\n @confections = Confection.all\n end",
"def pending_list\n @design_changes = DesignChange.find_pending\n \n respond_to do |format|\n format.html # pending_list.html.erb\n format.xml { render :xml => @design_changes }\n end\n end",
"def index\n @user_account_changes = UserAccountChange.all\n end",
"def test_13476841\n setup_changeset_test(13476841)\n assert_equal(1, find_changes('el_type' => 'W', 'el_id' => '172609358').size)\n assert(!find_changes('el_type' => 'W', 'el_id' => '172609358')[0]['prev_tags'].nil?)\n end",
"def index\n @diffs = Diff.all\n end",
"def index\n @diffs = Diff.all\n end",
"def cmd_changed\n print_tree(ChangedEditor, nil, true)\n end",
"def refresh_vcs_status(evt = nil)\n \n if not (@selWs.nil?)\n\n mst, mods_dirs, mods_files = @selWs.modified_files\n cst, cflt_dirs, cflt_files = @selWs.conflicted_files\n nst, news_dirs, news_files = @selWs.new_files\n dst, dels_dirs, dels_files = @selWs.deleted_files\n\n data = []\n mods_dirs.each do |f|\n data << ModifiedFile.new(f,:dir)\n end\n mods_files.each do |f|\n data << ModifiedFile.new(f,:file)\n end\n\n cflt_dirs.each do |f|\n data << ConflictedFile.new(f,:dir)\n end\n cflt_files.each do |f|\n data << ConflictedFile.new(f,:file)\n end\n\n news_dirs.each do |f|\n data << NewFile.new(f,:dir)\n end\n news_files.each do |f|\n data << NewFile.new(f,:file)\n end\n dels_dirs.each do |f|\n data << DeletedFile.new(f,:dir)\n end\n dels_files.each do |f|\n data << DeletedFile.new(f,:file)\n end\n\n bst, currBranch = @selWs.current_branch\n if bst\n @lblCurrBranch.text = currBranch\n else\n @lblCurrBranch.text = \"<Exception while reading branch [#{currBranch}]>\"\n end\n\n\n @tblChanges.items.clear\n @tblChanges.items.add_all(data)\n end\n\n end",
"def history(id)\n http.get(\"/nfse/#{id}/history\") do |response|\n respond_with_collection(response, Entities::NfseStatusTransition)\n end\n end",
"def fetch_changelogs\n @changelogs = @spkg.changelogs\n .includes(:maintainer)\n .order(at: :desc, evr: :desc, created_at: :desc)\n end",
"def new\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hetero24h_r2_fold_change }\n end\n end",
"def refresh\n end",
"def refresh\n end",
"def show\n if @client_change.type == 'template'\n new_section = DocumentTemplateSection.unscoped.find(@client_change.new_section_id)\n attrs = {\n :template => new_section.document_template.file,\n :section_id => new_section.name,\n :section_name => new_section.name.underscore.humanize.titleize,\n :reverted => @client_change.new_section.nil?\n }\n render json: get_json(@client_change, attrs)\n return\n end\n\n prev_changes = ClientChange.where({\n 'client_id' => @client_change.client_id,\n 'new_section_id' => nil,\n :id.lt => @client_change.id\n }).desc(:id)\n\n prev_change = prev_changes.first\n\n next_change = ClientChange.where({\n 'client_id' => @client_change.client_id,\n 'new_section_id' => nil,\n :id.gt => @client_change.id\n }).asc(:id).first\n\n cur_data = @client_change.client_data\n prev_data = prev_change.andand.client_data\n\n if params.has_key? :location_id\n cur_data = cur_data.andand['locations'].andand['value'].andand[params[:location_id].to_i]\n prev_data = prev_data.andand['locations'].andand['value'].andand[params[:location_id].to_i]\n end\n\n field_list = Client::FIELDS\n if params.has_key? :location_id\n field_list = field_list.find { |f| f[:id] == 'locations' }[:type]\n end\n\n changed_fields = ClientChange.get_changed_fields(cur_data, prev_data, field_list)\n\n changed_sections = Hash[changed_fields.keys.map { |field_id, val|\n section = 'basicInfo'\n field_list.each do |field|\n if field[:id] == field_id\n section = field_id\n elsif !field[:id].ends_with?('s') && field[:type].is_a?(Array)\n field[:type].each do |subfield|\n if subfield[:id] == field_id\n section = field[:id]\n end\n end\n end\n end\n [section, true]\n }]\n\n attrs = {\n :changed_fields => changed_fields,\n :changed_sections => changed_sections,\n :prev_change_id => prev_change.andand.id.to_s,\n :next_change_id => next_change.andand.id.to_s,\n :cur_change_num => prev_changes.length + 1,\n :change_count => ClientChange.where('client_id' => @client_change.client_id, 'new_section_id' => nil).length,\n }\n\n respond_to do |format|\n format.json { render json: get_json(@client_change, attrs) }\n end\n end",
"def index\n @recent_change_comments = RecentChangeComment.all\n end",
"def view_result\n file = params[:fold]\n @result_content = BrowsingFile.read_file file\n render layout: false\n end",
"def list_defect_changes(enum)\n change = enum.peek\n defect = change.defect\n loop do\n break if change.defect != defect\n li do\n describe_changes_within_release(enum)\n end\n begin\n change = enum.peek\n rescue StopIteration\n break\n end\n end\n end",
"def show\n @refactoring = Refactoring.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @refactoring }\n end\n end",
"def hilite_new_infections(file)\n return \"unchanged\" if prev_scan.nil? || prev_scan.infections == scan.infections\n Thread.current[:prev_infections] ||= prev_scan.infections.collect{|infection| infection.file}\n return (Thread.current[:prev_infections].include?(file) ? \"unchanged\" : \"changed\")\nend",
"def altered_files; raw_changeset.files; end",
"def refresh\n end",
"def index\n @retain_node_selectors = RetainNodeSelector.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @retain_node_selectors }\n end\n end",
"def changes\n @changes ||= Changes.new do |msg|\n log.indent do\n log << msg\n end\n end\n end",
"def refresh\n load if changed?\n end",
"def index\n @refactors = @snippet ? @snippet.refactors : Refactor.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @refactors }\n end\n end",
"def files; changeset.all_files; end",
"def fetch_changelogs\n @changelogs = @spkg.changelogs\n .includes(:maintainer)\n .order(at: :desc, evr: :desc, created_at: :desc)\n end",
"def index\n if params[:conditions].present?\n @knowledges = Knowledge.where(params[:conditions]).paginate(:page => params[:page]).order('id DESC')\n else\n @knowledges = Knowledge.paginate(:page => params[:page]).order('id DESC')\n end\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), knowledges_path\n\n #fresh_when model's last recoder is newer\n if stale?(:etag => Knowledge.last)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @knowledge }\n end\n end\n end",
"def index\n @change_functions = ChangeFunction.all\n end",
"def index\n\n @change_classes = ChangeClass.find(:all, :order => :position)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @change_classes }\n end\n end",
"def index\n @conflicts = Conflict.all\n end",
"def changes\n additions + deletions\n end",
"def index\n @cp_changes = CpChange.all\n\n render json: @cp_changes\n end",
"def changelogs\n changelog.entries(pattern: \"*#{key.digest}*\")\n end",
"def to_xml_change\n doc = Nokogiri::XML::Document.new\n root = doc.create_element(\"#{identifier.tag_name.gsub(/Id$/, '')}Change\")\n root << identifier.to_xml\n root << to_xml_updates\n root\n end",
"def changed_cookbooks\n DeliveryGolang::Helpers.changed_cookbooks(node)\n end",
"def bad_changeset\n xml =<<EOF\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<changeset>\n <author-date type=\"datetime\">2010-05-26T17:22:11Z</author-date>\n <author-email>toby.matejovsky@gmail.com</author-email>\n <author-id type=\"integer\">1</author-id>\n <author-name>Toby Matejovsky</author-name>\n <committer-date type=\"datetime\">2010-05-26T17:22:11Z</committer-date>\n <committer-email>toby.matejovsky@gmail.com</committer-email>\n <committer-id type=\"integer\">1</committer-id>\n <committer-name>Toby Matejovsky</committer-name>\n <created-at type=\"datetime\">2010-05-26T17:22:11Z</created-at>\n <id type=\"integer\">3564</id>\n <message>Implement awesome feature but forgot to mention Story ID</message>\n <repository-id type=\"integer\">6</repository-id>\n <revision>4f657b17281aaae24284bfd15e47f9c279049f9b</revision>\n</changeset>\nEOF\n end",
"def on_file_changed(content, out, path)\n SpacewalkHtmlClean.generate_diff(content, out, path)\n end"
] |
[
"0.66975474",
"0.63715464",
"0.6345822",
"0.60864514",
"0.60087264",
"0.57884383",
"0.57838863",
"0.57491595",
"0.5675938",
"0.5662908",
"0.55488575",
"0.55389583",
"0.54748243",
"0.54565024",
"0.5376001",
"0.53462684",
"0.5249507",
"0.52120405",
"0.52045774",
"0.5199062",
"0.51737",
"0.5115625",
"0.50092375",
"0.50041276",
"0.49986234",
"0.49642384",
"0.49270707",
"0.4921052",
"0.4874382",
"0.48580146",
"0.48492765",
"0.48055214",
"0.48008344",
"0.47818735",
"0.47676954",
"0.47520405",
"0.4744595",
"0.47396997",
"0.47264585",
"0.47220165",
"0.47085562",
"0.47085562",
"0.47082767",
"0.47058204",
"0.4697171",
"0.46880507",
"0.46880507",
"0.46723208",
"0.4661305",
"0.46268082",
"0.46268082",
"0.46249107",
"0.4620788",
"0.4618817",
"0.4616173",
"0.46143505",
"0.46139878",
"0.4612742",
"0.46106404",
"0.46058854",
"0.46056333",
"0.4592503",
"0.45904213",
"0.45751083",
"0.4546297",
"0.4533767",
"0.45336986",
"0.45336986",
"0.45303732",
"0.452255",
"0.4507981",
"0.45066792",
"0.45061243",
"0.4498515",
"0.4498515",
"0.44950774",
"0.44923976",
"0.44909284",
"0.4489595",
"0.44888118",
"0.44830596",
"0.44815361",
"0.44814882",
"0.44774964",
"0.44774908",
"0.44774082",
"0.44730335",
"0.447141",
"0.44645736",
"0.44640413",
"0.4460249",
"0.44527537",
"0.44499907",
"0.4443023",
"0.44426045",
"0.4436483",
"0.4423579",
"0.44226083",
"0.44201753",
"0.44178823"
] |
0.68709546
|
0
|
GET /auto1h_fold_changes/new GET /auto1h_fold_changes/new.xml
|
def new
@auto1h_fold_change = Auto1hFoldChange.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @auto1h_fold_change }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @hetero1h_fold_change = Hetero1hFoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hetero1h_fold_change }\n end\n end",
"def new\n @auto24h_fold_change = Auto24hFoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auto24h_fold_change }\n end\n end",
"def create\n @auto1h_fold_change = Auto1hFoldChange.new(params[:auto1h_fold_change])\n\n respond_to do |format|\n if @auto1h_fold_change.save\n format.html { redirect_to(@auto1h_fold_change, :notice => 'Auto1h fold change was successfully created.') }\n format.xml { render :xml => @auto1h_fold_change, :status => :created, :location => @auto1h_fold_change }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @auto1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auto1h_fold_change }\n end\n end",
"def new\n @auto24h_r2_fold_change = Auto24hR2FoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auto24h_r2_fold_change }\n end\n end",
"def create\n @auto24h_fold_change = Auto24hFoldChange.new(params[:auto24h_fold_change])\n\n respond_to do |format|\n if @auto24h_fold_change.save\n format.html { redirect_to(@auto24h_fold_change, :notice => 'Auto24h fold change was successfully created.') }\n format.xml { render :xml => @auto24h_fold_change, :status => :created, :location => @auto24h_fold_change }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @auto24h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @hetero1h_fold_change = Hetero1hFoldChange.new(params[:hetero1h_fold_change])\n\n respond_to do |format|\n if @hetero1h_fold_change.save\n format.html { redirect_to(@hetero1h_fold_change, :notice => 'Hetero1h fold change was successfully created.') }\n format.xml { render :xml => @hetero1h_fold_change, :status => :created, :location => @hetero1h_fold_change }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hetero1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hetero24h_r2_fold_change }\n end\n end",
"def update\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @auto1h_fold_change.update_attributes(params[:auto1h_fold_change])\n format.html { redirect_to(@auto1h_fold_change, :notice => 'Auto1h fold change was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @auto1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @changelog = Changelog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @changelog }\n end\n end",
"def show\n @hetero1h_fold_change = Hetero1hFoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hetero1h_fold_change }\n end\n end",
"def changes\n respond_to do |format|\n format.xml do\n raise ::AbstractController::ActionNotFound if params[:interval].blank?\n @changes = Node.all_including_deleted(:conditions => ['updated_at > ?', Time.now - params[:interval].to_i], :order => 'updated_at DESC')\n end\n format.any(:rss, :atom) do\n @nodes = @node.last_changes(:all, { :limit => 25 })\n render :template => '/shared/changes', :layout => false\n end\n end\n end",
"def old_new\n @cursos = Curso.find(:all)\n @modulos = Modulo.find(:all)\n @profesores = Profesor.find(:all)\n @aulas = Aula.find(:all)\n @programa = Programa.new\n @tab = :inicio\n @nav = :programaciones\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @programa }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def create\n @auto24h_r2_fold_change = Auto24hR2FoldChange.new(params[:auto24h_r2_fold_change])\n\n respond_to do |format|\n if @auto24h_r2_fold_change.save\n format.html { redirect_to @auto24h_r2_fold_change, notice: 'Auto24h r2 fold change was successfully created.' }\n format.json { render json: @auto24h_r2_fold_change, status: :created, location: @auto24h_r2_fold_change }\n else\n format.html { render action: \"new\" }\n format.json { render json: @auto24h_r2_fold_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @change = @priority.changes.new\n if @priority.has_change?\n flash[:error] = t('changes.new.already_proposed', :priority_name => @priority.change.new_priority.name)\n return\n end\n respond_to do |format|\n format.html # new.html.erb\n format.js {\n render :update do |page|\n page.select('#priority_' + @priority.id.to_s + '_change_form').each {|item| item.remove}\n page.insert_html :top, 'activities', render(:partial => \"new_inline\", :locals => {:change => @change, :priority => @priority})\n page['change_new_priority_name'].focus\n end \n } \n end\n end",
"def new\n @task_changes = TaskChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_changes }\n end\n end",
"def new\n @page_title = t('branches.new.title')\n @branches = Branch.all \n @branch = Branch.new\n respond_to do |format|\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @branch }\n end\n end",
"def update\n @hetero1h_fold_change = Hetero1hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @hetero1h_fold_change.update_attributes(params[:hetero1h_fold_change])\n format.html { redirect_to(@hetero1h_fold_change, :notice => 'Hetero1h fold change was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hetero1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n \tif params[:id]\n \t\t@old_doc = Doc.find(params[:id])\n \t\t@doc = Doc.new({:component => @old_doc.component, :maj_version => (params[:version] == \"major\" ? @old_doc.maj_version + 1 : @old_doc.maj_version ), :min_version => (params[:version] == \"minor\" ? @old_doc.min_version + 1 : @old_doc.min_version), :dev_stage => @old_doc.dev_stage, :url => @old_doc.new_version_url(params[:version]), :contents => @old_doc.contents})\n \telse\n\t @doc = Doc.new\n\t\tend\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @doc }\n end\n end",
"def new\n @explain = Explain.new\n @page = 'new-explain'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @explain }\n end\n end",
"def show\n @auto24h_fold_change = Auto24hFoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auto24h_fold_change }\n end\n end",
"def new\n @refactoring = @snippet ? @snippet.refactorings.build : Refactoring.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @refactoring }\n end\n end",
"def new\n @retain_node_selector = RetainNodeSelector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node_selector }\n end\n end",
"def get_changes\n CouchRest.get(SERVER.uri << DB.uri << \"/_changes\")\nend",
"def changes\n poll(\"Changes\")\n end",
"def new\n @checkpoint_removed = CheckpointRemoved.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @checkpoint_removed }\n end\n end",
"def create\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.new(params[:hetero24h_r2_fold_change])\n\n respond_to do |format|\n if @hetero24h_r2_fold_change.save\n format.html { redirect_to @hetero24h_r2_fold_change, notice: 'Hetero24h r2 fold change was successfully created.' }\n format.json { render json: @hetero24h_r2_fold_change, status: :created, location: @hetero24h_r2_fold_change }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hetero24h_r2_fold_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\r\n @prev_work_history = PrevWorkHistory.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @prev_work_history }\r\n end\r\n end",
"def new_changelist(desc)\n input = {\n \"Change\" => \"new\",\n \"Description\" => desc,\n }\n\n number =\n run_with_input(input, \"change\", \"-i\").\n first.\n match(%r!\\AChange (\\d+) created\\.!).\n captures.\n first\n\n Changelist.new(self, number)\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 'story'; flash.discard }\n format.json { render json: @story }\n end\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 'feature' }\n format.json { render json: @feature }\n end\n end",
"def new\n @checkpoint = Checkpoint.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @checkpoint }\n end\n end",
"def destroy\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n @auto1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def new\n @lookup_cohort = LookupCohort.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_cohort }\n end\n end",
"def new\n @versioned_jnlp = MavenJnlp::VersionedJnlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @versioned_jnlp }\n end\n end",
"def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end",
"def new\n @retain_node = RetainNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node }\n format.json { render :json => @retain_node }\n end\n end",
"def new\n @defect = Defect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @defect }\n end\n end",
"def new\n @versioned_jnlp_url = MavenJnlp::VersionedJnlpUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @versioned_jnlp_url }\n end\n end",
"def get_all_new\n uri = [@@base_uri, 'all', 'getAllNew'].join('/')\n return get(uri)\n end",
"def new\n @doc = DocHead.find(params[:doc_id])\n @work_flow_info = WorkFlowInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work_flow_info }\n end\n end",
"def new\n @copy = Copy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @copy }\n end\n end",
"def index\n @changes = Change.all\n end",
"def new\n @candidate_revision = CandidateRevision.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @candidate_revision }\n end\n end",
"def index\n @new_resource = Referential::Resource.new(referential: @referential)\n breadcrumb\n end",
"def new\n @diaper_change = DiaperChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diaper_change }\n end\n end",
"def new\n @refactor = @snippet ? @snippet.refactors.build : Refactor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @refactor }\n end\n end",
"def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"def new\n @convenio = Convenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @convenio }\n end\n end",
"def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end",
"def new\n @howto = Howto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @howto }\n end\n end",
"def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end",
"def make_changelog\n @hg_opener.open \"00changelog.i\", \"w\" do |file|\n file.write \"\\0\\0\\0\\2\" # represents revlogv2\n file.write \" dummy changelog to avoid using the old repo type\"\n end\n end",
"def new\n @suggestion_history = SuggestionHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suggestion_history }\n end\n end",
"def new\n #@branch = Branch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @branch }\n end\n end",
"def new\n @research = Research.new\n @page_title = \"Request research from White House 2 members\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end",
"def update\n @auto24h_fold_change = Auto24hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @auto24h_fold_change.update_attributes(params[:auto24h_fold_change])\n format.html { redirect_to(@auto24h_fold_change, :notice => 'Auto24h fold change was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @auto24h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @entry = Entry.new\n @folders = Folder.find(:all, :order => \"updated_at DESC\").map { |f| [f.name, f.id] }\n @new = true;\n\n respond_to do |format|\n format.html { render \"edit\" }\n format.xml { render :xml => @entry }\n end\n end",
"def new\n @lookup_switchboard = LookupSwitchboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_switchboard }\n end\n end",
"def new\n\n add_breadcrumb 'New'\n\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.haml this had been an erb and is now an haml the change should just be caught\n format.json { render :json => @user }\n end\n end",
"def new\n @contribution = Contribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contribution }\n end\n end",
"def new\n @contribution = Contribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contribution }\n end\n end",
"def changelog\n return @changelog if @changelog\n \n @changelog = Amp::Mercurial::ChangeLog.new @store.opener\n \n if path = ENV['HG_PENDING']\n if path =~ /^#{root}/\n @changelog.read_pending('00changelog.i.a')\n end\n end\n \n @changelog\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 @knowledge = Knowledge.new\n @identities=Identity.all\n @identities_choose=[]\n @timelines_choose=[]\n @timelines=[]\n @categories_choose=[]\n @categories=[]\n breadcrumbs.add I18n.t(\"helpers.titles.#{current_action}\", :model => Model_class.model_name.human), new_knowledge_path\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @knowledge }\n end\n end",
"def new\n @title = \"New Operations\"\n @operation = Operation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @operation }\n end\n end",
"def index\n @newnodes = Newnode.all\n end",
"def new\n @old_point_tag = OldPointTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_point_tag }\n end\n end",
"def new\n @rate_change_history = RateChangeHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rate_change_history }\n end\n end",
"def new\n @check = Check.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @check }\n end\n end",
"def new\n @repo = Repo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repo }\n end\n end",
"def new\n @paste = Paste.new\n @languages = Language.find :all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @paste }\n end\n end",
"def new\n respond_to do |format|\n format.html\n format.xml\n end\n end",
"def new\n @wiki = Wiki.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wiki }\n end\n end",
"def new\n @wiki = Wiki.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wiki }\n end\n end",
"def new\n @focusing_section = FocusingSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @focusing_section }\n end\n end",
"def changelog\n verify_ajax_request\n require_parameters :id\n @issue_results = Api.issues.find(params[:id])\n @issue = @issue_results.first()\n @changelog = Internal.issues.changelog(params[:id])\n render :partial => 'issue/changelog'\n end",
"def new\n @pushed = Pushed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pushed }\n end\n end",
"def show\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hetero24h_r2_fold_change }\n end\n end",
"def new\n @hpt_history = HptHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hpt_history }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"def new\n @conseq = Conseq.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @conseq }\n end\n end",
"def new\n @creation = Creation.new\n @topics = Topic.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @creation }\n end\n end",
"def new\n @check = Check.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @check }\n end\n end",
"def test_7082\n setup_changeset_test(7082)\n p find_changes('el_type' => 'W', 'el_id' => '16105282')[0]\n p find_changes('el_type' => 'W', 'el_id' => '16105282')[1]\n assert_equal(1, find_changes('el_type' => 'W', 'el_id' => '16105282').size)\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ciclo }\n end\n end",
"def new\n @title = \"New income classification\"\n @incomeclassification = Incomeclassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incomeclassification }\n end\n end",
"def new\n @snippet = Snippet.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snippet }\n end\n end",
"def show\n @auto24h_r2_fold_change = Auto24hR2FoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @auto24h_r2_fold_change }\n end\n end",
"def new\n @git_repo = GitRepo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @git_repo }\n end\n end",
"def new\n @occurence = Occurence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occurence }\n end\n end",
"def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"def new\n @auditflows_flownode = AuditflowsFlownode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auditflows_flownode }\n end\n end",
"def new\n @snippet = Snippet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snippet }\n end\n end",
"def netdev_resxml_new( edit_xml )\n self.properties.each do |p| \n self.send(\"xml_change_#{p}\", edit_xml ) \n end\n end",
"def new\n @addition = Addition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @addition }\n end\n end",
"def new \n @how_to = HowTo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @how_to }\n end\n end",
"def create\n @changelog = Changelog.new(params[:changelog])\n\n respond_to do |format|\n if @changelog.save\n\n format.html do\n redirect_to(@changelog,\n :notice => 'Changelog was successfully created.')\n end\n\n format.xml do\n render :xml => @changelog,\n :status => :created,\n :location => @changelog\n end\n else\n format.html { render :action => 'new' }\n\n format.xml do\n render :xml => @changelog.errors, :status => :unprocessable_entity\n end\n\n end\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @compliance }\n end\n end"
] |
[
"0.69216496",
"0.67254597",
"0.66003704",
"0.61234367",
"0.60837746",
"0.6052604",
"0.604529",
"0.5884453",
"0.58323526",
"0.57824755",
"0.577326",
"0.56456065",
"0.5607873",
"0.5531151",
"0.5477435",
"0.543659",
"0.5433517",
"0.5428538",
"0.5402589",
"0.5397345",
"0.5373941",
"0.53710383",
"0.533033",
"0.532138",
"0.5321235",
"0.5319746",
"0.5308003",
"0.52865356",
"0.5283885",
"0.52797365",
"0.5259924",
"0.5258058",
"0.52521527",
"0.5231799",
"0.52284557",
"0.5226733",
"0.52159303",
"0.5215383",
"0.52120346",
"0.51929814",
"0.51894313",
"0.51733583",
"0.5165924",
"0.51656353",
"0.51544285",
"0.5152838",
"0.51305735",
"0.5129087",
"0.51174116",
"0.5114569",
"0.5102105",
"0.50988513",
"0.50857675",
"0.5080051",
"0.50710535",
"0.5067771",
"0.50618273",
"0.5052855",
"0.50421727",
"0.50407386",
"0.5038227",
"0.50329417",
"0.50329417",
"0.5032869",
"0.5023432",
"0.5018026",
"0.500967",
"0.5006023",
"0.5001507",
"0.49938712",
"0.499235",
"0.49889517",
"0.49875623",
"0.4984033",
"0.49784356",
"0.49784356",
"0.49770534",
"0.49752593",
"0.4972942",
"0.49724498",
"0.49698302",
"0.49683976",
"0.49653956",
"0.4964561",
"0.49636912",
"0.49624193",
"0.4960463",
"0.4949153",
"0.49472398",
"0.49451688",
"0.49415344",
"0.49395132",
"0.4936857",
"0.49349624",
"0.49315083",
"0.49252152",
"0.49241242",
"0.49225384",
"0.49209535",
"0.49206218"
] |
0.75340813
|
0
|
POST /auto1h_fold_changes POST /auto1h_fold_changes.xml
|
def create
@auto1h_fold_change = Auto1hFoldChange.new(params[:auto1h_fold_change])
respond_to do |format|
if @auto1h_fold_change.save
format.html { redirect_to(@auto1h_fold_change, :notice => 'Auto1h fold change was successfully created.') }
format.xml { render :xml => @auto1h_fold_change, :status => :created, :location => @auto1h_fold_change }
else
format.html { render :action => "new" }
format.xml { render :xml => @auto1h_fold_change.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @auto1h_fold_change.update_attributes(params[:auto1h_fold_change])\n format.html { redirect_to(@auto1h_fold_change, :notice => 'Auto1h fold change was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @auto1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @hetero1h_fold_change = Hetero1hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @hetero1h_fold_change.update_attributes(params[:hetero1h_fold_change])\n format.html { redirect_to(@hetero1h_fold_change, :notice => 'Hetero1h fold change was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hetero1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @auto1h_fold_change = Auto1hFoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auto1h_fold_change }\n end\n end",
"def create\n @hetero1h_fold_change = Hetero1hFoldChange.new(params[:hetero1h_fold_change])\n\n respond_to do |format|\n if @hetero1h_fold_change.save\n format.html { redirect_to(@hetero1h_fold_change, :notice => 'Hetero1h fold change was successfully created.') }\n format.xml { render :xml => @hetero1h_fold_change, :status => :created, :location => @hetero1h_fold_change }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hetero1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @auto24h_fold_change = Auto24hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @auto24h_fold_change.update_attributes(params[:auto24h_fold_change])\n format.html { redirect_to(@auto24h_fold_change, :notice => 'Auto24h fold change was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @auto24h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n @auto1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @auto24h_fold_change = Auto24hFoldChange.new(params[:auto24h_fold_change])\n\n respond_to do |format|\n if @auto24h_fold_change.save\n format.html { redirect_to(@auto24h_fold_change, :notice => 'Auto24h fold change was successfully created.') }\n format.xml { render :xml => @auto24h_fold_change, :status => :created, :location => @auto24h_fold_change }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @auto24h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auto1h_fold_change }\n end\n end",
"def new\n @hetero1h_fold_change = Hetero1hFoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hetero1h_fold_change }\n end\n end",
"def destroy\n @hetero1h_fold_change = Hetero1hFoldChange.find(params[:id])\n @hetero1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(hetero1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def update\n @auto24h_r2_fold_change = Auto24hR2FoldChange.find(params[:id])\n\n respond_to do |format|\n if @auto24h_r2_fold_change.update_attributes(params[:auto24h_r2_fold_change])\n format.html { redirect_to @auto24h_r2_fold_change, notice: 'Auto24h r2 fold change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @auto24h_r2_fold_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.find(params[:id])\n\n respond_to do |format|\n if @hetero24h_r2_fold_change.update_attributes(params[:hetero24h_r2_fold_change])\n format.html { redirect_to @hetero24h_r2_fold_change, notice: 'Hetero24h r2 fold change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hetero24h_r2_fold_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @hetero1h_fold_change = Hetero1hFoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hetero1h_fold_change }\n end\n end",
"def destroy\n @auto24h_fold_change = Auto24hFoldChange.find(params[:id])\n @auto24h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto24h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @auto24h_r2_fold_change = Auto24hR2FoldChange.new(params[:auto24h_r2_fold_change])\n\n respond_to do |format|\n if @auto24h_r2_fold_change.save\n format.html { redirect_to @auto24h_r2_fold_change, notice: 'Auto24h r2 fold change was successfully created.' }\n format.json { render json: @auto24h_r2_fold_change, status: :created, location: @auto24h_r2_fold_change }\n else\n format.html { render action: \"new\" }\n format.json { render json: @auto24h_r2_fold_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @auto24h_fold_change = Auto24hFoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auto24h_fold_change }\n end\n end",
"def create\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.new(params[:hetero24h_r2_fold_change])\n\n respond_to do |format|\n if @hetero24h_r2_fold_change.save\n format.html { redirect_to @hetero24h_r2_fold_change, notice: 'Hetero24h r2 fold change was successfully created.' }\n format.json { render json: @hetero24h_r2_fold_change, status: :created, location: @hetero24h_r2_fold_change }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hetero24h_r2_fold_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show_changes\n if error.blank?\n if changes.length == 0\n error_block(\"No changes for #{defect_name}\")\n else\n build_html do\n c_enum = changes.to_enum\n div.defect do\n describe_defect_changes(c_enum)\n end\n end\n end\n else\n error_block(error)\n end\n end",
"def destroy\n @auto24h_r2_fold_change = Auto24hR2FoldChange.find(params[:id])\n @auto24h_r2_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to auto24h_r2_fold_changes_url }\n format.json { head :no_content }\n end\n end",
"def test_7082\n setup_changeset_test(7082)\n p find_changes('el_type' => 'W', 'el_id' => '16105282')[0]\n p find_changes('el_type' => 'W', 'el_id' => '16105282')[1]\n assert_equal(1, find_changes('el_type' => 'W', 'el_id' => '16105282').size)\n end",
"def changes\n poll(\"Changes\")\n end",
"def show\n @auto24h_fold_change = Auto24hFoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auto24h_fold_change }\n end\n end",
"def new\n @auto24h_r2_fold_change = Auto24hR2FoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auto24h_r2_fold_change }\n end\n end",
"def changes\n respond_to do |format|\n format.xml do\n raise ::AbstractController::ActionNotFound if params[:interval].blank?\n @changes = Node.all_including_deleted(:conditions => ['updated_at > ?', Time.now - params[:interval].to_i], :order => 'updated_at DESC')\n end\n format.any(:rss, :atom) do\n @nodes = @node.last_changes(:all, { :limit => 25 })\n render :template => '/shared/changes', :layout => false\n end\n end\n end",
"def destroy\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.find(params[:id])\n @hetero24h_r2_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to hetero24h_r2_fold_changes_url }\n format.json { head :no_content }\n end\n end",
"def all_changed_by_completion_toggle\n handle_xhr_request do\n raise MissingUserChecklistParameterError, t('.missing-checklist-param-error') if params[:id].blank?\n\n user_checklist_id = params[:id]\n user_checklist = UserChecklist.find(user_checklist_id)\n raise ActiveRecord::RecordNotFound, t('.not_found', id: user_checklist_id) if user_checklist.nil?\n\n # toggle the date_completed and update any parents needed\n user_checklist.all_changed_by_completion_toggle\n\n check_membership_status_if_complete(user_checklist.root, user_checklist.root.percent_complete)\n\n { checklist_id: user_checklist.id,\n date_completed: user_checklist.date_completed,\n overall_percent_complete: user_checklist.percent_complete\n }\n end\n end",
"def new\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hetero24h_r2_fold_change }\n end\n end",
"def changeset(message=\"Story:#{PTID} Implement awesome feature\")\n xml =<<EOF\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<changeset>\n <author-date type=\"datetime\">2010-05-26T17:22:11Z</author-date>\n <author-email>toby.matejovsky@gmail.com</author-email>\n <author-id type=\"integer\">1</author-id>\n <author-name>Toby Matejovsky</author-name>\n <committer-date type=\"datetime\">2010-05-26T17:22:11Z</committer-date>\n <committer-email>toby.matejovsky@gmail.com</committer-email>\n <committer-id type=\"integer\">1</committer-id>\n <committer-name>Toby Matejovsky</committer-name>\n <created-at type=\"datetime\">2010-05-26T17:22:11Z</created-at>\n <id type=\"integer\">3564</id>\n <message>#{message}</message>\n <repository-id type=\"integer\">6</repository-id>\n <revision>4f657b17281aaae24284bfd15e47f9c279049f9b</revision>\n</changeset>\nEOF\n end",
"def update_multi_fields(doc, changes)\n #Fields is expected to be in the form of [[field, content, append]]\n #Ex: [[:title, \"My New Title\"],[:people, \"Person I Forgot To List\", true]]\n changes.each do |change|\n content = change[1]\n content = join_content(doc, change[0], change[1]) if change[2]\n doc.send(change[0].to_s+get_args_for_send(change[0]),content)\n end\n return doc.save #Returns true if this all worked\n end",
"def autofill\n my_proposed_changes = propose_changes\n apply_changes(@evidence.project, my_proposed_changes)\n end",
"def describe_defect_changes(enum)\n begin\n change = enum.peek\n rescue StopIteration\n return \"\"\n end\n span do\n defect_heading(change)\n end\n ul.defect do\n list_defect_changes(enum)\n end\n end",
"def save_changes\n frm.button(:value=>\"Save Changes\").click\n Announcements.new(@browser)\n end",
"def save_changes\n frm.button(:value=>\"Save Changes\").click\n Announcements.new(@browser)\n end",
"def test_13476841\n setup_changeset_test(13476841)\n assert_equal(1, find_changes('el_type' => 'W', 'el_id' => '172609358').size)\n assert(!find_changes('el_type' => 'W', 'el_id' => '172609358')[0]['prev_tags'].nil?)\n end",
"def changes_from_template\n changes_from_document(template, false)\n end",
"def apply_changes\n\t\t@admin_manager.CommitChanges\n\tend",
"def update\n @document = Document.find(params[:id])\n @oldname = @document.name\n @oldcontent = @document.content\n @space = @document.space\n @edited_content = params[:document][:content]\n @job = Job.where(:wikispace => @space.wiki_name)[0]\n @comments = @space.comments.order('updated_at DESC') \n \n #Check there isn't a newer version in the DB\n #dd = DateTime.parse(t.to_s)\n #tt = Time.parse(d.to_s)\n \n d = @document.updated_at.to_datetime.to_i - params[:document][:updated_at].to_datetime.to_i \n puts \"Document in DB was updated at #{@document.updated_at.to_datetime.to_i}\"\n puts \"My copy was updated at #{params[:document][:updated_at].to_datetime.to_i}\"\n puts \"The diference: #{d}\"\n puts \"Editedt content:\" + @edited_content\n \n if ( d != 0)\n puts \"Conflict\"\n @conflict = true\n @diff = Diffy::Diff.new(@edited_content, @oldcontent).to_s(:html)\n else\n @conflict = false\n \n #Get the diff and set to the user\n diffed = HtmlDiffer.diff(@oldcontent, @edited_content.strip, \"#{current_user.id}\")\n \n #save to a file for debugging in case of finding errors\n# File.open(\"diffdebugtest.log\", \"a+\") do |f|\n# f.puts(\"old = %Q{#{@oldcontent}}\")\n# f.puts(\"new = %Q{#{@edited_content.strip}}\")\n# f.puts(\"result = %Q{#{diffed}}\")\n# end\n \n params[:document][:content] = diffed\n \n @success = @document.update_attributes(params[:document])\n @activity = Activity.find(:all, :conditions => ['user_id = ? and job_id = ? and code = ?', current_user.id, @job.id, 1])\n current_user.activities.create(:job_id => @job.id, :code => 1) unless !@activity[@activity.count-1].nil? && @activity[@activity.count-1].created_at.to_date == Date.today\n current_user.activities.create(:job_id => @job.id, :code => 2)\n end \n \n #If there is no conflict save the document and update the verions\n if @success\n \tparams[:oldcont] = @oldcontent\n \tparams[:newcont] = @document.content\n \tif @oldcontent != @document.content\n\t \tversion_hash = UUIDTools::UUID.timestamp_create.to_s\n\t \t@user = current_user\n\t \t@version = @document.versions.create(:content =>@document.content,:version => version_hash, :user_id=> current_user.id)\n\t \t@version.save\n \tend\n end\n \n respond_to do |format|\n if @success \n format.html { redirect_to \"/spaces/\"+@space.wiki_name+\"/documents/\"+@document.id.to_s, :notice => \"Saved\" }\n format.xml { head :ok }\n elsif @conflict \n #format.html { redirect_to \"/spaces/\"+@space.wiki_name+\"/documents/\"+@document.id.to_s, :notice => \"Conflict\" }\n format.html { render :action => :show , :notice => \"Conflict\"} \n format.xml { head :ok }\n else\n format.html { render :action => :show , :notice => \"Error\"}\n format.xml { render :xml => @document.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def save_git_content\n MergeRequest\n .where('id = ? AND COALESCE(latest_merge_request_diff_id, 0) < ?', self.merge_request_id, self.id)\n .update_all(latest_merge_request_diff_id: self.id)\n\n ensure_commit_shas\n save_commits\n save_diffs\n save\n keep_around_commits\n end",
"def update\n # A bit of security here to ensure we get values we expected:\n # - 'false'\n # - 'citations'\n # - 'project'\n propagation_scope = { 'false' => false, 'citations' => :citations,\n 'project' => :project }[extractions_extraction_forms_projects_sections_type1_params.dig(\n :should, :propagate\n )]\n\n # If we want to propagate then do it now.\n if propagation_scope\n @extractions_extraction_forms_projects_sections_type1.propagate_type1_change(propagation_scope,\n extractions_extraction_forms_projects_sections_type1_params)\n end\n\n respond_to do |format|\n if @extractions_extraction_forms_projects_sections_type1.update(extractions_extraction_forms_projects_sections_type1_params)\n format.html do\n redirect_to work_extraction_path(@extractions_extraction_forms_projects_sections_type1.extraction,\n 'panel-tab': @extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction_forms_projects_section.id),\n notice: t('success')\n end\n format.json { render json: {} }\n format.js {}\n else\n format.html do\n flash[:alert] = @extractions_extraction_forms_projects_sections_type1.errors.messages.values.dig(0, 0)\n render :edit\n end\n format.json do\n render json: @extractions_extraction_forms_projects_sections_type1.errors, status: :unprocessable_entity\n end\n format.js {}\n end\n end\n end",
"def content_changes\n attributes.fetch(:contentChanges)\n end",
"def content_changes\n attributes.fetch(:contentChanges)\n end",
"def start_continuous_changes(host, port, db, heartbeat = '1000')\n Net::HTTP.get_response(host, '/' << db << '/_changes?feed=continuous&heartbeat=' << heartbeat, port) do |response|\n response.read_body do |notification|\n if notification?(notification) #Due to heartbeat, it's a newline instead of notification. \n result = JSON.parse(notification)\n puts result\n if (notification_type(notification) == \"save/update\") #not good to get non-existing doc.\n puts \"Here we go, getting the doc:\"\n doc = get_doc(get_doc_id(result))\n puts doc\n if affects_me?(doc, db)\n puts \"YES, IT DID!\"\n jobs = get_job(doc)\n jobs.each do |job|\n system(job)\n end\n else\n puts \"nah, it was for #{doc[\"node\"]}\"\n end\n end\n end\n end\n end\nend",
"def on_file_changed(content, out, path)\n SpacewalkHtmlClean.generate_diff(content, out, path)\n end",
"def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end",
"def show\n @auto24h_r2_fold_change = Auto24hR2FoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @auto24h_r2_fold_change }\n end\n end",
"def hilite_new_infections(file)\n return \"unchanged\" if prev_scan.nil? || prev_scan.infections == scan.infections\n Thread.current[:prev_infections] ||= prev_scan.infections.collect{|infection| infection.file}\n return (Thread.current[:prev_infections].include?(file) ? \"unchanged\" : \"changed\")\nend",
"def show\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hetero24h_r2_fold_change }\n end\n end",
"def parse_changes\n scanner = StringScanner.new(@status)\n requested_groups.each_with_object({}) do |(type, identifier), h|\n if scanner.scan_until(/#{identifier}/)\n scan_until_next_empty_line(scanner)\n file_block = scan_until_next_empty_line(scanner)\n h[type] = extract_changes(file_block)\n end\n scanner.reset\n end\n end",
"def replay_edits\n document_edits.order(:id).each(&:execute_change)\n end",
"def index\n @changes = Change.all\n end",
"def revisiondesc_change_node_set(input_element)\n input_element.xpath(XPATH[:revisiondesc_change])\n end",
"def test_12917265\n setup_changeset_test(12917265)\n assert_equal(6, find_changes('el_type' => 'N').size)\n #assert_equal(3, @tiles.size)\n end",
"def save_changed\n save changed: true\n end",
"def transfer_correction(coordinator, _all_corrected_ruby_lines, haml_lines)\n to_ruby_lines = coordinator.extract_from_corrected_lines(@start_marker_line_number, @ruby_lines.size)\n transfer_correction_logic(coordinator, to_ruby_lines, haml_lines)\n end",
"def cmd_changed\n print_tree(ChangedEditor, nil, true)\n end",
"def create_content_change(content_change, headers = {})\n post_json(\"#{endpoint}/content-changes\", content_change, headers)\n end",
"def create_content_change(content_change, headers = {})\n post_json(\"#{endpoint}/content-changes\", content_change, headers)\n end",
"def changelog\n verify_ajax_request\n require_parameters :id\n @issue_results = Api.issues.find(params[:id])\n @issue = @issue_results.first()\n @changelog = Internal.issues.changelog(params[:id])\n render :partial => 'issue/changelog'\n end",
"def changed_cookbooks\n DeliveryGolang::Helpers.changed_cookbooks(node)\n end",
"def prov_field_changed\n assert_privileges(\"miq_request_edit\")\n\n if params[:tab_id]\n @edit = session[:edit]\n else\n return unless load_edit(\"prov_edit__#{params[:id]}\", \"show_list\")\n end\n\n if @edit.nil? || @edit.try(:[], :stamp_typ) # load tab for show screen\n if params[:tab_id]\n @options[:current_tab_key] = params[:tab_id].split('_')[0].to_sym\n @options[:wf].refresh_field_values(@options)\n end\n prov_load_tab\n else\n if params[:tab_id]\n @edit[:new][:current_tab_key] = params[:tab_id].split('_')[0].to_sym\n @edit[:wf].refresh_field_values(@edit[:new])\n end\n refresh_divs = prov_get_form_vars # Get changed option, returns true if divs need refreshing\n build_grid if refresh_divs\n changed = (@edit[:new] != @edit[:current])\n @record =\n if @edit[:new][:src_configured_system_ids].present?\n PhysicalServer.where(:id => @edit[:new][:src_configured_system_ids].first).first\n else\n MiqTemplate.where(:id => Array(@edit[:new][:src_vm_id]).first)\n end\n\n all_dialogs = @edit[:wf].get_all_dialogs rescue []\n\n render :update do |page|\n page << javascript_prologue\n # Going thru all dialogs to see if model has set any of the dialog display to hide/ignore\n all_dialogs.each do |dialog_name, dialog|\n page << \"miq_tabs_show_hide('#{dialog_name}_tab', #{dialog[:display] == :show});\"\n end\n if refresh_divs\n all_dialogs.each do |dialog_name, dialog|\n if dialog[:display] == :show && dialog_name == @edit[:new][:current_tab_key]\n page.replace_html(dialog_name, :partial => dialog_partial_for_workflow, :locals => {:wf => @edit[:wf], :dialog => dialog_name})\n end\n end\n end\n if @edit.fetch_path(:new, :schedule_type, 0) == \"schedule\"\n page << \"ManageIQ.calendar.calDateFrom = new Date(#{@timezone_offset});\"\n page << \"miqBuildCalendar();\"\n end\n if @edit.fetch_path(:new, :owner_email).blank?\n page << javascript_hide(\"lookup_button_on\")\n page << javascript_show(\"lookup_button_off\")\n else\n page << javascript_hide(\"lookup_button_off\")\n page << javascript_show(\"lookup_button_on\")\n end\n if changed != session[:changed]\n session[:changed] = changed\n page << javascript_for_miq_button_visibility(changed)\n end\n page.replace(\"flash_msg_div\", :partial => \"layouts/flash_msg\")\n page << \"miqScrollTop();\" if @flash_array.present?\n page << \"miqSparkle(false);\"\n end\n end\n end",
"def save_changes\n save(:changed=>true) || false unless @changed_columns.empty?\n end",
"def changes\n result = get_modified_from_solr(first_modified: params['first_modified'], last_modified: params['last_modified'])\n render_result(result)\n end",
"def get_changes\n CouchRest.get(SERVER.uri << DB.uri << \"/_changes\")\nend",
"def update_xml_from_api(tries: 5)\n url = \"#{BASE_URL}/show/#{nct_id}?resultsxml=true\"\n attempts = 0\n content = nil\n begin\n attempts += 1\n s = Time.now\n content = Faraday.get(url).body\n puts \" fetch #{Time.now - s}\"\n rescue Faraday::ConnectionFailed\n return false if attempts > 5\n retry\n end\n xml = Nokogiri::XML(content)\n if xml.xpath('//clinical_study').length > 0\n self.content = content\n return false unless changed?\n return update content: content\n else\n # add error\n end\n end",
"def stash_changes(evt)\n mst, mods_dirs, mods_files = @selWs.modified_files\n cst, cflt_dirs, cflt_files = @selWs.conflicted_files\n nst, news_dirs, news_files = @selWs.new_files\n dst, dels_dirs, dels_files = @selWs.deleted_files\n\n if mods_dirs.length > 0 or mods_files.length > 0 \\\n or cflt_dirs.length > 0 or cflt_files.length > 0 \\\n or news_dirs.length > 0 or news_files.length > 0 \\\n or dels_dirs.length > 0 or dels_files.length > 0\n\n msg = []\n msg << \"System detected there are existing uncommitted changes in the current workspace:\\n\"\n msg << \"\\tModified folder(s) : \\t\\t#{mods_dirs.length}\\n\"\n msg << \"\\tModified file(s) : \\t\\t#{mods_files.length}\\n\"\n msg << \"\\tConflicted folder(s) : \\t#{cflt_dirs.length}\\n\"\n msg << \"\\tConflicted file(s) : \\t\\t#{cflt_files.length}\\n\"\n msg << \"\\tDeleted folder(s) : \\t\\t#{dels_dirs.length}\\n\"\n msg << \"\\tDeleted file(s) : \\t\\t#{dels_files.length}\\n\"\n msg << \"\\tNew folder(s) : \\t\\t#{news_dirs.length}\\n\"\n msg << \"\\tNew file(s) : \\t\\t\\t#{news_files.length}\\n\"\n\n st, name = fx_alert_input(\"Temporary Save Changes To Branch\",msg.join, \"Please give a descriptive name of this temporary changes.\\nIt is recommended but not mandatory\")\n if st\n # this means user click ok, but the text can still be empty\n sst, res = @selWs.stash_changes(name)\n if sst\n set_info_gmsg(res)\n refresh_vcs_status\n else\n prompt_error(\"Failed to stash the changes. Error was : #{res}\")\n end \n end\n\n else\n fx_alert_info(\"Workspace is clean. No uncommitted changes found\")\n end\n end",
"def changes(opts={})\n row_offset = opts[:row_offset].to_i\n\n dirty_rows.inject({}) do |h, row|\n idx = @rows.index(row) + row_offset\n h[idx] = row.changes(opts)\n \n h\n end \n end",
"def list_defect_changes(enum)\n change = enum.peek\n defect = change.defect\n loop do\n break if change.defect != defect\n li do\n describe_changes_within_release(enum)\n end\n begin\n change = enum.peek\n rescue StopIteration\n break\n end\n end\n end",
"def update #saves and redirects, saves changes\n end",
"def change(hash); end",
"def document_changes\n attributes.fetch(:documentChanges)\n end",
"def document_changes\n attributes.fetch(:documentChanges)\n end",
"def growallfields\n @fields = Field.all\n @fields.each { |field|\n if (field.fstate != 5) then\n field.fstate = field.fstate + 1\n field.update_attribute(:fstate, field.fstate)\n end\n }\n render :xml => @fields\n end",
"def changed\n _find_changed_twins!(@_changes)\n\n @_changes\n end",
"def changed_cookbooks\n DeliveryTruck::Helpers.changed_cookbooks(node)\n end",
"def detect_changes(hash)\n return unless (!events.empty? || on_change) && @configuration\n squished = hash.squish\n changes = configuration.squish.to_a.diff(squished.to_a).to_h.only(*squished.keys).expand\n return if changes.empty?\n on_change.call(hash, changes)\n trigger_events(changes)\n end",
"def changes\n @changes ||= Set.new\n end",
"def changes\n @changes ||= Set.new\n end",
"def changes_from_clone\n changes_from_document(clone_source, true)\n end",
"def test_insert_first\n\n subsection_01_1_1 = subsections(:subsection_01_1_1)\n checklist = Checklist.find(subsection_01_1_1.checklist.id)\n \n assert_equal(6, checklist.designer_only_count)\n assert_equal(5, checklist.designer_auditor_count)\n assert_equal(0, checklist.dc_designer_only_count)\n assert_equal(3, checklist.dc_designer_auditor_count)\n assert_equal(0, checklist.dr_designer_only_count)\n assert_equal(3, checklist.dr_designer_auditor_count)\n\n new_check = { 'date_code_check' => '1',\n 'full_review' => '0',\n 'title' => 'First Check',\n 'dot_rev_check' => '1',\n 'url' => '',\n 'check' => 'text',\n 'check_type' => 'yes_no' }\n\n subsection_01_2_3 = subsections(:subsection_01_2_3)\n section_01_2 = sections(:section_01_2)\n \n assert_equal(0, subsection_01_2_3.checks.size)\n\n post(:insert_first,\n { :new_check => new_check,\n :section => { 'id' => subsection_01_2_3.section_id,\n 'checklist_id' => subsection_01_2_3.checklist.id },\n :subsection => { 'id' => subsection_01_2_3.id } },\n cathy_admin_session)\n\t \n assert_equal('Added first check successfully.',\n\t\t flash['notice'])\n assert_redirected_to(:controller => 'checklist',\n :action => 'edit',\n :id => subsection_01_2_3.checklist.id)\n\n\n subsection_01_2_3.reload\n checks = subsection_01_2_3.checks\n assert_equal(1, checks.size)\n assert_equal('First Check', checks[0][:title])\n\n checklist = Checklist.find(subsection_01_1_1.checklist.id)\n assert_equal(6, checklist.designer_only_count)\n assert_equal(5, checklist.designer_auditor_count)\n assert_equal(1, checklist.dc_designer_only_count)\n assert_equal(3, checklist.dc_designer_auditor_count)\n assert_equal(1, checklist.dr_designer_only_count)\n assert_equal(3, checklist.dr_designer_auditor_count)\n\n end",
"def run_on_changes(_)\n restart\n end",
"def bad_changeset\n xml =<<EOF\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<changeset>\n <author-date type=\"datetime\">2010-05-26T17:22:11Z</author-date>\n <author-email>toby.matejovsky@gmail.com</author-email>\n <author-id type=\"integer\">1</author-id>\n <author-name>Toby Matejovsky</author-name>\n <committer-date type=\"datetime\">2010-05-26T17:22:11Z</committer-date>\n <committer-email>toby.matejovsky@gmail.com</committer-email>\n <committer-id type=\"integer\">1</committer-id>\n <committer-name>Toby Matejovsky</committer-name>\n <created-at type=\"datetime\">2010-05-26T17:22:11Z</created-at>\n <id type=\"integer\">3564</id>\n <message>Implement awesome feature but forgot to mention Story ID</message>\n <repository-id type=\"integer\">6</repository-id>\n <revision>4f657b17281aaae24284bfd15e47f9c279049f9b</revision>\n</changeset>\nEOF\n end",
"def changes\n @changes ||= Changes.new do |msg|\n log.indent do\n log << msg\n end\n end\n end",
"def rebuild(event)\n info \"Rebuilding updates from file system\"\n end",
"def additions\n commit_summary(:additions)\n end",
"def post_init\n req = \"GET #{@conn_obj.base_url}/#{@conn_obj.db_name}/_changes?feed=continuous&heartbeat=5000\\r\\n\\r\\n\"\n send_data req\n end",
"def changes\n additions + deletions\n end",
"def test_append_check\n\n subsection_01_1_1 = subsections(:subsection_01_1_1)\n section_01_1 = sections(:section_01_1)\n checklist = Checklist.find(subsection_01_1_1.checklist.id)\n assert_equal(6, checklist.designer_only_count)\n assert_equal(5, checklist.designer_auditor_count)\n assert_equal(0, checklist.dc_designer_only_count)\n assert_equal(3, checklist.dc_designer_auditor_count)\n assert_equal(0, checklist.dr_designer_only_count)\n assert_equal(3, checklist.dr_designer_auditor_count)\n\n new_check = { 'date_code_check' => '1',\n 'full_review' => '1',\n 'title' => 'New Check APPEND',\n 'dot_rev_check' => '1',\n 'url' => '',\n 'check' => 'text',\n 'check_type' => 'designer_auditor' }\n \n check = {'id' => checks(:check_03).id}\n \n assert_equal(3, subsection_01_1_1.checks.size)\n\n put(:append_check, { :new_check => new_check, :check => check }, cathy_admin_session)\n assert_equal('Appended check successfully.', flash['notice'])\n assert_redirected_to(:id => subsection_01_1_1.id, :action => 'modify_checks')\n\n subsection_01_1_1.reload\n checks = subsection_01_1_1.checks\n assert_equal(4, checks.size)\n 0.upto(checks.size-1) { |x| assert_equal(x+1, checks[x][:position]) }\n\n checklist = Checklist.find(subsection_01_1_1.checklist.id)\n assert_equal(6, checklist.designer_only_count)\n assert_equal(6, checklist.designer_auditor_count)\n assert_equal(0, checklist.dc_designer_only_count)\n assert_equal(4, checklist.dc_designer_auditor_count)\n assert_equal(0, checklist.dr_designer_only_count)\n assert_equal(4, checklist.dr_designer_auditor_count)\n\n assert_equal(checks(:check_01).id, checks[0][:id])\n assert_equal(checks(:check_02).id, checks[1][:id])\n assert_equal(checks(:check_03).id, checks[2][:id])\n assert_equal('New Check APPEND', checks[3][:title])\n\n end",
"def click_on_change_tags\n @page.find(input_elements[:result_more]).click\n wait_for_css(input_elements[:change_tags])\n @page.find(input_elements[:change_tags]).click\n end",
"def reopen_case\n # Update USer kyc detail\n @user_kyc_detail.admin_status = GlobalConstant::UserKycDetail.unprocessed_admin_status\n @user_kyc_detail.aml_status = GlobalConstant::UserKycDetail.pending_aml_status if @user_kyc_detail.aml_status !=\n GlobalConstant::UserKycDetail.unprocessed_aml_status\n\n @user_kyc_detail.aml_user_id = nil\n @user_kyc_detail.whitelist_status = GlobalConstant::UserKycDetail.unprocessed_whitelist_status\n @user_kyc_detail.kyc_confirmed_at = nil\n @user_kyc_detail.last_acted_by = @edit_kyc_request.admin_id\n @user_kyc_detail.last_acted_timestamp = Time.now.to_i\n @user_kyc_detail.last_reopened_at = Time.now.to_i\n @user_kyc_detail.save!\n\n update_edit_kyc_row(GlobalConstant::EditKycRequest.processed_status)\n end",
"def page_revisions\n self.back_to_top\n page_revisions_button\n wait_for_ajax\n \n end",
"def changed_clause_titles(changed_clause, action)\n if changed_clause\n rev_clause_title = changed_clause#Clause.find(changed_clause)\n\n #check print status\n if action != 'changed'\n \"<table width='100%' class='rev_table'><tr id='#{rev_clause_title.id.to_s}' class='clause_title_2'><td class='rev_clause_code'>#{rev_clause_title.clauseref.subsection.section.ref.to_s}#{rev_clause_title.clauseref.subsection.ref.to_s}.#{rev_clause_title.clauseref.clausetype_id.to_s}#{rev_clause_title.clauseref.clause.to_s}#{rev_clause_title.clauseref.subclause.to_s}</td><td class ='rev_clause_title'>#{rev_clause_title.clausetitle.text.to_s}</td><td class='rev_line_menu_mob'>#{rev_mob_menu(rev_clause_title)}</td><td class='rev_line_menu'>#{reinstate_original_clause(rev_clause_title)}#{change_info_clause(rev_clause_title)}</td></tr><tr class='rev_mob_menu_popup'><td class='mob_rev_menu' colspan=3 >#{reinstate_original_clause(rev_clause_title)}#{change_info_clause(rev_clause_title)}</td></tr></table>\".html_safe \n else\n\n check_clause_print_status = Change.where(:project_id => @current_project, :clause_id => changed_clause, :revision_id => @selected_revision.id).collect{|item| item.print_change}.uniq \n if check_clause_print_status.include?(true)\n \"<table><tr class='clause_title'><td class='changed_clause_code'>#{rev_clause_title.clauseref.subsection.section.ref.to_s}#{rev_clause_title.clauseref.subsection.ref.to_s}.#{rev_clause_title.clauseref.clausetype_id.to_s}#{rev_clause_title.clauseref.clause.to_s}#{rev_clause_title.clauseref.subclause.to_s}</td><td class ='changed_clause_title'>#{rev_clause_title.clausetitle.text.to_s}</td></tr></table>\".html_safe \n else\n \"<table><tr class='clause_title_strike'><td class='changed_clause_code'>#{rev_clause_title.clauseref.subsection.section.ref.to_s}#{rev_clause_title.clauseref.subsection.ref.to_s}.#{rev_clause_title.clauseref.clausetype_id.to_s}#{rev_clause_title.clauseref.clause.to_s}#{rev_clause_title.clauseref.subclause.to_s}</td><td class ='changed_clause_title'>#{rev_clause_title.clausetitle.text.to_s}</td></tr></table>\".html_safe \n end\n end\n end\n end",
"def update\n flash[:notice] = t('scaffold.notice.updated', :item => Refenciacontable.model_name.human) if @refenciacontable.update_attributes(params[:refenciacontable])\n respond_with(@refenciacontable, :location => refenciacontables_path)\n end",
"def push_fedora(cx)\n\tComponent.reset_counters( cx.id, :master_files )\n\ttitle = (cx.title or cx.content_desc.strip)\n\tputs \"[#{cx.id}]: #{title}\"\n\tFedora.create_or_update_object( cx, title )\n\tcx.update_attribute( :date_dl_ingest, Time.now ) if cx.date_dl_ingest.nil? \n\tcx.update_metadata('allxml')\n\tcx.save! \n\tcx.master_files.each { |mf| mf.update_metadata( 'allxml' ); mf.save! } \nend",
"def update\n @branches = Branch.all \n @branch = Branch.find(params[:id])\n @page_title = t('branches.edit.title', :branch_name => @branch.name) \n respond_to do |format|\n if @branch.update_attributes(params[:branch])\n Branch.expire_cache\n flash[:notice] = t('branches.new.success', :branch_name => @branch.name)\n format.html { redirect_to(edit_branch_url(@branch)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @branch.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def change(params); end",
"def trigger_event\n event_name = params[:event_name]\n review = Review.find(params[:id])\n nb_opinions, nb_opinions_moved = 0,0\n review.opinions.each do |opinion|\n begin\n opinion.send(\"#{event_name}!\")\n nb_opinions_moved += 1\n rescue\n puts \"transition for opinion #{opinion.id} in state #{opinion.state} with event #{event_name} impossible \"\n end\n nb_opinions += 1\n end\n review.paragraphs.collect(&:update_status)\n review.update_status\n flash[:notice] = \"#{nb_opinions_moved} opinion(s) moved for #{nb_opinions} opinions total\"\n redirect_to \"/reviews/edit/#{review.id}\"\n end",
"def updated()\n # ICLA file form\n # TODO: why not used?\n _valid = %w(pubname email).all? do |name|\n document.querySelector(\"input[name=#{name}]\").validity.valid\n end\n\n # wire up form\n jQuery('form')[0].addEventListener('submit', self.file)\n jQuery('input[name=message]').val(window.parent.location.pathname)\n jQuery('input[name=selected]').val(decodeURIComponent(@@selected))\n\n # Safari autocomplete workaround: trigger change on leaving field\n # https://github.com/facebook/react/issues/2125\n if navigator.userAgent.include? \"Safari\"\n Array(document.getElementsByTagName('input')).each do |input|\n input.addEventListener('blur', self.onblur)\n end\n end\n end",
"def process_changes\n GC.start\n add_new_expressions\n process_changed_metadata\n puts 'Done.'\n end",
"def after_wiki_activity\n end",
"def to_xml_change\n doc = Nokogiri::XML::Document.new\n root = doc.create_element(\"#{identifier.tag_name.gsub(/Id$/, '')}Change\")\n root << identifier.to_xml\n root << to_xml_updates\n root\n end"
] |
[
"0.6669969",
"0.61592245",
"0.6146433",
"0.57850224",
"0.5746697",
"0.5727979",
"0.5665986",
"0.5624672",
"0.5528979",
"0.5212441",
"0.5196037",
"0.51373094",
"0.51309395",
"0.5124373",
"0.5124307",
"0.5124254",
"0.49629757",
"0.48081446",
"0.47723004",
"0.47159457",
"0.47105953",
"0.47066098",
"0.46656868",
"0.46281987",
"0.46220687",
"0.45983216",
"0.45390475",
"0.45306408",
"0.45131978",
"0.44901913",
"0.44868004",
"0.44863567",
"0.44863567",
"0.44699925",
"0.44544682",
"0.4413986",
"0.43901643",
"0.43890712",
"0.43842342",
"0.43776655",
"0.43776655",
"0.43587068",
"0.43517098",
"0.43483546",
"0.4345139",
"0.43374893",
"0.43348882",
"0.4330492",
"0.43035874",
"0.43008357",
"0.42989892",
"0.42976344",
"0.42952704",
"0.42897582",
"0.4288072",
"0.42860597",
"0.42860597",
"0.4277237",
"0.42595956",
"0.42532972",
"0.4251185",
"0.42438006",
"0.4241088",
"0.4236949",
"0.4230756",
"0.42262655",
"0.42109603",
"0.42096338",
"0.42004615",
"0.4195788",
"0.4195788",
"0.41930905",
"0.41925284",
"0.41787624",
"0.41778672",
"0.41766313",
"0.41766313",
"0.4162056",
"0.41506946",
"0.41393957",
"0.41370022",
"0.41355908",
"0.41333604",
"0.41332138",
"0.4131559",
"0.41280982",
"0.41088095",
"0.41068375",
"0.4106503",
"0.4103666",
"0.4102448",
"0.41022336",
"0.40992278",
"0.4095853",
"0.40922415",
"0.4091724",
"0.40910545",
"0.4087035",
"0.4085506",
"0.4078701"
] |
0.63633174
|
1
|
PUT /auto1h_fold_changes/1 PUT /auto1h_fold_changes/1.xml
|
def update
@auto1h_fold_change = Auto1hFoldChange.find(params[:id])
respond_to do |format|
if @auto1h_fold_change.update_attributes(params[:auto1h_fold_change])
format.html { redirect_to(@auto1h_fold_change, :notice => 'Auto1h fold change was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @auto1h_fold_change.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @hetero1h_fold_change = Hetero1hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @hetero1h_fold_change.update_attributes(params[:hetero1h_fold_change])\n format.html { redirect_to(@hetero1h_fold_change, :notice => 'Hetero1h fold change was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hetero1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @auto24h_fold_change = Auto24hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @auto24h_fold_change.update_attributes(params[:auto24h_fold_change])\n format.html { redirect_to(@auto24h_fold_change, :notice => 'Auto24h fold change was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @auto24h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @auto1h_fold_change = Auto1hFoldChange.new(params[:auto1h_fold_change])\n\n respond_to do |format|\n if @auto1h_fold_change.save\n format.html { redirect_to(@auto1h_fold_change, :notice => 'Auto1h fold change was successfully created.') }\n format.xml { render :xml => @auto1h_fold_change, :status => :created, :location => @auto1h_fold_change }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @auto1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n @auto1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def update\n @auto24h_r2_fold_change = Auto24hR2FoldChange.find(params[:id])\n\n respond_to do |format|\n if @auto24h_r2_fold_change.update_attributes(params[:auto24h_r2_fold_change])\n format.html { redirect_to @auto24h_r2_fold_change, notice: 'Auto24h r2 fold change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @auto24h_r2_fold_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @auto1h_fold_change = Auto1hFoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auto1h_fold_change }\n end\n end",
"def show\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auto1h_fold_change }\n end\n end",
"def update\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.find(params[:id])\n\n respond_to do |format|\n if @hetero24h_r2_fold_change.update_attributes(params[:hetero24h_r2_fold_change])\n format.html { redirect_to @hetero24h_r2_fold_change, notice: 'Hetero24h r2 fold change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hetero24h_r2_fold_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @hetero1h_fold_change = Hetero1hFoldChange.find(params[:id])\n @hetero1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(hetero1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @hetero1h_fold_change = Hetero1hFoldChange.new(params[:hetero1h_fold_change])\n\n respond_to do |format|\n if @hetero1h_fold_change.save\n format.html { redirect_to(@hetero1h_fold_change, :notice => 'Hetero1h fold change was successfully created.') }\n format.xml { render :xml => @hetero1h_fold_change, :status => :created, :location => @hetero1h_fold_change }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hetero1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @auto24h_fold_change = Auto24hFoldChange.find(params[:id])\n @auto24h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto24h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @auto24h_fold_change = Auto24hFoldChange.new(params[:auto24h_fold_change])\n\n respond_to do |format|\n if @auto24h_fold_change.save\n format.html { redirect_to(@auto24h_fold_change, :notice => 'Auto24h fold change was successfully created.') }\n format.xml { render :xml => @auto24h_fold_change, :status => :created, :location => @auto24h_fold_change }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @auto24h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @hetero1h_fold_change = Hetero1hFoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hetero1h_fold_change }\n end\n end",
"def new\n @hetero1h_fold_change = Hetero1hFoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hetero1h_fold_change }\n end\n end",
"def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @auto24h_r2_fold_change = Auto24hR2FoldChange.find(params[:id])\n @auto24h_r2_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to auto24h_r2_fold_changes_url }\n format.json { head :no_content }\n end\n end",
"def update #saves and redirects, saves changes\n end",
"def show\n @auto24h_fold_change = Auto24hFoldChange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auto24h_fold_change }\n end\n end",
"def update\n replace_entry \"word/document.xml\", doc.serialize(:save_with => 0)\n end",
"def update\n save_doc\n end",
"def test_7082\n setup_changeset_test(7082)\n p find_changes('el_type' => 'W', 'el_id' => '16105282')[0]\n p find_changes('el_type' => 'W', 'el_id' => '16105282')[1]\n assert_equal(1, find_changes('el_type' => 'W', 'el_id' => '16105282').size)\n end",
"def new\n @auto24h_fold_change = Auto24hFoldChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auto24h_fold_change }\n end\n end",
"def create\n @auto24h_r2_fold_change = Auto24hR2FoldChange.new(params[:auto24h_r2_fold_change])\n\n respond_to do |format|\n if @auto24h_r2_fold_change.save\n format.html { redirect_to @auto24h_r2_fold_change, notice: 'Auto24h r2 fold change was successfully created.' }\n format.json { render json: @auto24h_r2_fold_change, status: :created, location: @auto24h_r2_fold_change }\n else\n format.html { render action: \"new\" }\n format.json { render json: @auto24h_r2_fold_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.find(params[:id])\n @hetero24h_r2_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to hetero24h_r2_fold_changes_url }\n format.json { head :no_content }\n end\n end",
"def update\n @hambrief = Hambrief.find(params[:id])\n\n respond_to do |format|\n if @hambrief.update_attributes(params[:hambrief])\n flash[:notice] = 'Hambrief was successfully updated.'\n format.html { redirect_to('/') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hambrief.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n head :ok\n end",
"def update\n @checkpoint = Checkpoint.find(params[:id])\n respond_to do |format|\n if @checkpoint.update_attributes(params[:checkpoint])\n ##format.html { redirect_to(@checkpoint, :notice => 'Checkpoint was successfully updated.') }\n ##format.xml { head :ok }\n format.html { redirect_to(:action => :index) }\n format.xml { redirect_to(:action => :index) }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @checkpoint.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n #\n end",
"def apply_changes\n\t\t@admin_manager.CommitChanges\n\tend",
"def update\r\n # write some gangsta code here\r\n end",
"def update\n @defect = Defect.find(params[:id])\n\n respond_to do |format|\n if @defect.update_attributes(params[:defect])\n flash[:notice] = 'Defect was successfully updated.'\n format.html { redirect_to(@defect) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @defect.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update_changeset(xml, changeset_id)\n xml_attr_rewrite(xml, \"changeset\", changeset_id)\n end",
"def changeset(message=\"Story:#{PTID} Implement awesome feature\")\n xml =<<EOF\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<changeset>\n <author-date type=\"datetime\">2010-05-26T17:22:11Z</author-date>\n <author-email>toby.matejovsky@gmail.com</author-email>\n <author-id type=\"integer\">1</author-id>\n <author-name>Toby Matejovsky</author-name>\n <committer-date type=\"datetime\">2010-05-26T17:22:11Z</committer-date>\n <committer-email>toby.matejovsky@gmail.com</committer-email>\n <committer-id type=\"integer\">1</committer-id>\n <committer-name>Toby Matejovsky</committer-name>\n <created-at type=\"datetime\">2010-05-26T17:22:11Z</created-at>\n <id type=\"integer\">3564</id>\n <message>#{message}</message>\n <repository-id type=\"integer\">6</repository-id>\n <revision>4f657b17281aaae24284bfd15e47f9c279049f9b</revision>\n</changeset>\nEOF\n end",
"def update\n respond_to do |format|\n if @label_sheet.update_attributes(label_sheet_params)\n format.html { redirect_to([:admin, @label_sheet], notice: 'Label Sheet was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated Label Sheet: #{@label_sheet.name}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @label_sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @branches = Branch.all \n @branch = Branch.find(params[:id])\n @page_title = t('branches.edit.title', :branch_name => @branch.name) \n respond_to do |format|\n if @branch.update_attributes(params[:branch])\n Branch.expire_cache\n flash[:notice] = t('branches.new.success', :branch_name => @branch.name)\n format.html { redirect_to(edit_branch_url(@branch)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @branch.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update \n end",
"def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to [:admin, @chef], notice: t('messages.updated', model:Chef.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n flash[:notice] = 'Convention was successfully updated.' if @convention.update_attributes convention_params\n respond_with @convention, location: :conventions\n end",
"def update\n # cyber-dojo.sh does actual [update]\nend",
"def save\n @client.patch(@endpoint, :content=>@changed)\n return nil\n end",
"def update\n @document = load_document_from_params\n # generates sanatized params from params hash to update the doc with\n sanitize_update_params\n @response = update_document(@document,@sanitized_params)\n @document.save\n flash[:notice] = \"Your changes have been saved.\"\n if params.has_key? :add_another_author\n redirect_to({:controller => \"catalog\", :action => \"edit\", :id => params[:id], :wf_step => :contributor, :add_contributor => true}) \n else\n redirect_to( {:controller => \"catalog\", :action => \"edit\", :id => params[:id]}.merge(params_for_next_step_in_wokflow) )\n end\n end",
"def update\n\t\t# Left empty intentionally.\n\tend",
"def create\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.new(params[:hetero24h_r2_fold_change])\n\n respond_to do |format|\n if @hetero24h_r2_fold_change.save\n format.html { redirect_to @hetero24h_r2_fold_change, notice: 'Hetero24h r2 fold change was successfully created.' }\n format.json { render json: @hetero24h_r2_fold_change, status: :created, location: @hetero24h_r2_fold_change }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hetero24h_r2_fold_change.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n\n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n \n end",
"def update\n @wiki = Wiki.find(params[:id])\n @wiki.update_attributes(:changed_by => current_user)\n \n\n respond_to do |format|\n if @wiki.update_attributes(params[:wiki])\n @wiki.audit_tag_with(@wiki.changetag) \n format.html { redirect_to @wiki, notice: @wiki.title << ' was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wiki.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update\n @checklist = Checklist.find(params[:id])\n\n respond_to do |format|\n if @checklist.update_attributes(params[:checklist])\n flash[:notice] = 'Checklist was successfully updated.'\n format.html { redirect_to(@checklist) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @checklist.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end",
"def update\n end"
] |
[
"0.6806152",
"0.6460156",
"0.60975254",
"0.60180956",
"0.59429765",
"0.59218717",
"0.58927643",
"0.5807008",
"0.54730195",
"0.5468437",
"0.54474705",
"0.53939223",
"0.5383452",
"0.52899224",
"0.5144697",
"0.5093051",
"0.50664556",
"0.50269735",
"0.5022232",
"0.4989123",
"0.49513343",
"0.49425596",
"0.48946342",
"0.48605943",
"0.48159358",
"0.48122182",
"0.4777048",
"0.47623447",
"0.47560182",
"0.47504056",
"0.4748244",
"0.4745414",
"0.47448727",
"0.47414634",
"0.47407475",
"0.46988094",
"0.4697367",
"0.4695194",
"0.4691145",
"0.4689661",
"0.4671486",
"0.46602568",
"0.46600634",
"0.46564856",
"0.46537983",
"0.46452215",
"0.46452215",
"0.46452215",
"0.46452215",
"0.46452215",
"0.46452215",
"0.46452215",
"0.46452215",
"0.46452215",
"0.46452215",
"0.46449766",
"0.4643488",
"0.4643052",
"0.4643052",
"0.4643052",
"0.4643052",
"0.4643052",
"0.4643052",
"0.4643052",
"0.4643052",
"0.46409324",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356",
"0.46380356"
] |
0.73654467
|
0
|
DELETE /auto1h_fold_changes/1 DELETE /auto1h_fold_changes/1.xml
|
def destroy
@auto1h_fold_change = Auto1hFoldChange.find(params[:id])
@auto1h_fold_change.destroy
respond_to do |format|
format.html { redirect_to(auto1h_fold_changes_url) }
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @auto24h_fold_change = Auto24hFoldChange.find(params[:id])\n @auto24h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto24h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hetero1h_fold_change = Hetero1hFoldChange.find(params[:id])\n @hetero1h_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(hetero1h_fold_changes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @auto24h_r2_fold_change = Auto24hR2FoldChange.find(params[:id])\n @auto24h_r2_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to auto24h_r2_fold_changes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hetero24h_r2_fold_change = Hetero24hR2FoldChange.find(params[:id])\n @hetero24h_r2_fold_change.destroy\n\n respond_to do |format|\n format.html { redirect_to hetero24h_r2_fold_changes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete_now\n revisions.each do |rev_id| \n CouchDB.delete( \"#{uri}?rev=#{rev_id}\" )\n end\n true \n end",
"def delete_all(xpath); end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def delete(slide)\n # ./_rels/presentation.xml.rels\n # Update Relationship ids\n # Insert a new one slideRef\n @doc.edit_xml @doc.presentation.rels.path do |xml|\n # Calucate the next id\n # next_id = xml.xpath('//xmlns:Relationship[@Id]').map{ |n| n['Id'] }.sort.last.succ\n # TODO - Figure out how to make this more MS idiomatic up 9->10 instead of incrementing\n # the character....\n # Insert that into the slide and crakc open the presentation.xml file\n\n target = slide.path.relative_path_from(@doc.presentation.path.dirname)\n relationship = xml.at_xpath(\"/xmlns:Relationships/xmlns:Relationship[@Type='#{Slide::REL_TYPE}' and @Target='#{target}']\")\n # ./presentation.xml\n # Update attr\n # p:notesMasterId\n # Insert attr\n # p:sldId, increment, etc.\n @doc.edit_xml '/ppt/presentation.xml' do |xml|\n xml.at_xpath(\"/p:presentation/p:sldIdLst/p:sldId[@r:id='#{relationship['Id']}']\").remove\n end\n relationship.remove\n end\n\n # Delete slide link and slideNotes link from ./[Content-Types].xml \n @doc.edit_xml @doc.content_types.path do |xml|\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Slide::CONTENT_TYPE}' and @PartName='#{slide.path}']\").remove\n xml.at_xpath(\"/xmlns:Types/xmlns:Override[@ContentType='#{Notes::CONTENT_TYPE}' and @PartName='#{slide.notes.path}']\").remove\n end\n\n # Update ./ppt\n # !!! DESTROY !!!\n # ./slides\n # Delete files\n # ./_rels/notesSlide(\\d+).xml.rels\n @doc.delete slide.notes.rels.path\n # ./notesSlide(\\d+).xml file\n @doc.delete slide.notes.path\n # ./_rels/slide(\\d+).xml.rels\n @doc.delete slide.rels.path\n # ./slide(\\d+).xml file\n @doc.delete slide.path\n # ./notesSlides\n # Delete files\n\n # Hooray! We're done! Ummm, what should we return though? can't be the slide since\n # its destroyed and there's no practical way to keep it around in memory.\n end",
"def xml_on_delete( xml )\r\n return unless @under_vlans\r\n return if @under_vlans.empty?\r\n \r\n _xml_rm_under_vlans( xml, @under_vlans )\r\n end",
"def destroy\n @document.destroy\n save_log({ :action => 'DELETE', :document => { :before => @old_document }})\n #TODO delete the file from disk\n respond_to do |format|\n format.html { redirect_to(documents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cp_change.destroy\n\n head :no_content\n end",
"def destroy\n @yml_file = Cmtool::YmlFile.find(params[:id])\n @yml_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(cmtool.yml_files_url, notice: I18n.t('cmtool.action.destroy.successful', model: Cmtool::YmlFile.model_name.human)) }\n format.xml { head :ok }\n end\n end",
"def delete_checksums\n # puts \"Del: #{@basename}\"\n @pkgdb.query(\"delete from checksums where basename = '#{@basename}'\")\n end",
"def destroy\n @changelog = Changelog.find(params[:id])\n @changelog.destroy\n\n respond_to do |format|\n format.html { redirect_to(changelogs_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n # set_chef\n @chef.destroy\n redirect_to chefs_path\n end",
"def delete_content_paths\n\n # Delete all the paths with the ancestor as the current id\n ContentPath.delete_all(:ancestor => self.id)\n\n # Delete all the paths with the descendant as the current id\n ContentPath.delete_all(:descendant => self.id)\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def delete_story_version(id)\n @client.raw('delete', \"/content/story-versions/#{id}\")\n end",
"def run_on_deletion(paths)\n end",
"def run_on_deletion(paths)\n end",
"def delete_operations; end",
"def destroy\n @helocagree = Helocagree.find(params[:id])\n @helocagree.destroy\n\n respond_to do |format|\n format.html { redirect_to(helocagrees_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @model_class.transaction do\n id = @object.id\n @object.destroy\n create_change_log_entry(id)\n end\n respond_to do |format|\n format.html { redirect_to(:action => 'index') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user_testcase_xref = UserTestcaseXref.find(params[:id])\n @user_testcase_xref.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_testcase_xrefs_url) }\n format.xml { head :ok }\n end\n end",
"def clear(opts = {}) \n save(setup_commit_options({:message => \"all clear\"}.merge(opts))) do |index|\n if tree = index.current_tree\n tree.contents.each do |entry|\n index.delete(key_for(entry.name))\n end\n end\n end\n end",
"def clear(opts = {}) \n save(setup_commit_options({:message => \"all clear\"}.merge(opts))) do |index|\n if tree = index.current_tree\n tree.contents.each do |entry|\n index.delete(key_for(entry.name))\n end\n end\n end\n end",
"def destroy\n @flat_happening = FlatHappening.find(params[:id])\n @flat_happening.destroy\n\n head :no_content\n end",
"def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end",
"def delete_change_set(change_set_name, options = {})\n options['ChangeSetName'] = change_set_name\n request({\n 'Action' => 'DeleteChangeSet',\n :parser => Fog::Parsers::AWS::CloudFormation::Basic.new\n }.merge!(options))\n end",
"def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end",
"def delete_all\n solr.delete_by_query('*:*')\n solr.commit\n end",
"def destroy\n @diaper_change = DiaperChange.find(params[:id])\n @diaper_change.destroy\n\n respond_to do |format|\n format.html { redirect_to(diaper_changes_url) }\n format.xml { head :ok }\n end\n end",
"def clean!\n @changes = []\n end",
"def destroy\n @content = Content.find(params[:id])\n @folder = Folder.find(session[:folder_id])\n Searcher.open(Const.get('searcher_db')) do |db|\n db.erase(@content)\n end\n @content.destroy\n\n respond_to do |format|\n #format.html { redirect_to(contents_url) }\n format.html { redirect_to(@folder) }\n format.xml { head :ok }\n end\n end",
"def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end",
"def destroy\n @auto = Auto.find(params[:id])\n @auto.destroy\n\n respond_to do |format|\n format.html { redirect_to(autos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vdm_change.destroy\n\n head :no_content\n end",
"def clear_changes!\n @changes.clear\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def after_soft_delete; end",
"def destroy\n @convenio = Convenio.find(params[:id])\n @convenio.destroy\n\n respond_to do |format|\n format.html { redirect_to(convenios_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n \n end",
"def delete\n \n end",
"def destroy\n @change.destroy\n respond_to do |format|\n format.html { redirect_to changes_url }\n format.json { head :no_content }\n end\n end",
"def delete_from_disk; end",
"def destroy\n @reflection.destroy\n head :no_content\n end",
"def delete_node(current_node)\n\nend",
"def destroy\n @change = @priority.changes_with_deleted.find(params[:id])\n flash[:notice] = t('changes.destroy')\n @change.delete!\n respond_to do |format|\n format.html { redirect_to(changes_url) }\n end\n end",
"def destroy\n @check = Check.find(params[:id])\n @check.destroy\n\n respond_to do |format|\n format.html { redirect_to(checks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @check = Check.find(params[:id])\n @check.destroy\n respond_to do |format|\n format.html { redirect_to(checks_url) }\n format.xml { head :ok }\n end\n end",
"def delete_empty_changelists\n pending_changelists.each { |changelist|\n changelist.delete\n }\n end",
"def ensure_deletion_fixes \n # TO DO\n end",
"def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend",
"def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend",
"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( )\n File.delete(@configFileDNE)\n self.clear\n self\n end",
"def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end",
"def destroy\n @markup = Markup.find(params[:id])\n @markup.destroy\n\n respond_to do |format|\n format.html { redirect_to [@parent, :markups] }\n format.xml { head :ok }\n end\n end",
"def delete\n end",
"def purge\n self.files.each do |f|\n f.destroy\n end\n self.commits.each do |c|\n c.destroy\n end\n end",
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def delete(key)\n configuration.hpath_delete.tap do |result|\n save if sync_down\n end\n end",
"def destroy\n @hambrief = Hambrief.find(params[:id])\n @hambrief.destroy\n\n respond_to do |format|\n format.html { redirect_to(hambriefs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @defect = Defect.find(params[:id])\n @defect.destroy\n\n respond_to do |format|\n format.html { redirect_to(defects_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n raise RuntimeError, \"File datastore does not support document deletion\"\n end",
"def destroy\n @chef_att_source.destroy\n respond_to do |format|\n format.html { redirect_to chef_att_sources_url, notice: 'Chef att source was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n @auto1h_fold_change = Auto1hFoldChange.find(params[:id])\n\n respond_to do |format|\n if @auto1h_fold_change.update_attributes(params[:auto1h_fold_change])\n format.html { redirect_to(@auto1h_fold_change, :notice => 'Auto1h fold change was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @auto1h_fold_change.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def delete_decision\n\t\t# ES: Por medio de la configuracion del modelo, todo lo relacionado con esa decision, y sus hijos se borrará también\n\t\t# EN: According to the model configuration, all information related to that decision and it sons will be deleted also\n\t\tdecision = GovernanceDecision.find(params[:idDecision].to_i)\n\t\thijasToDelete = view_context.recursiveDarHijos(decision, []) # ES: Agrega sus hijos - EN: Add it sons\n\t\thijasToDelete.push(decision.id) # ES: Se agrega a si misma - EN: Add it itself\n\n\t\tdecision.destroy\n\n\t\trespond_to do |format|\n\t\t\t# ES: Envia el texto:\n\t\t\t# EN: Send the text:\n\t\t\tformat.json {render json: hijasToDelete}\n\t end\n\tend",
"def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend",
"def destroy\n @home_check = HomeCheck.find(params[:id])\n @home_check.destroy\n\n respond_to do |format|\n format.html { redirect_to(home_checks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @checkpoint_removed = CheckpointRemoved.find(params[:id])\n @checkpoint_removed.destroy\n\n respond_to do |format|\n format.html { redirect_to(checkpoint_removeds_url) }\n format.xml { head :ok }\n end\n end",
"def delete_one(file)\n files_collection.find(:_id => file.id).delete_one\n chunks_collection.find(:files_id => file.id).delete_many\n end",
"def delete_index_file\n $log.info(\"Deleting old index.html file...\")\n File.delete(\"/home/matt/Documents/programming/ruby/dmsw/index.html\")\nend",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def destroy\n @auditflows_flownode = AuditflowsFlownode.find(params[:id])\n @auditflows_flownode.destroy\n\n respond_to do |format|\n format.html { redirect_to(auditflows_flownodes_url) }\n format.xml { head :ok }\n end\n end",
"def teardown\n File.delete 'file.xml' if File.exists?('file.xml')\n File.delete '.file.xml.duxml' if File.exists?('.file.xml.duxml')\n end",
"def destroy\n @checklist = Checklist.find(params[:id])\n @checklist.destroy\n\n respond_to do |format|\n format.html { redirect_to(checklists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end",
"def destroy\n @label_sheet.destroy\n respond_to do |format|\n format.html { redirect_to(admin_label_sheets_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted Label Sheet: #{@label_sheet.name}\")\n end",
"def destroy\n @cultural_heritage_part = CulturalHeritage::Part.find(params[:id])\n @cultural_heritage_part.deleted = 1\n @cultural_heritage_part.save\n\n respond_to do |format|\n format.html { redirect_to(cultural_heritage_parts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @retain_node_selector = RetainNodeSelector.find(params[:id])\n @retain_node_selector.destroy\n\n respond_to do |format|\n format.html { redirect_to(retain_node_selectors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @upload_file = UploadFile.find(params[:id])\n doc_no=@upload_file.doc_no\n @upload_file.destroy\n\n respond_to do |format|\n format.html { redirect_to upload_files_url(:doc_no=>doc_no) }\n format.xml { head :ok }\n end\n end",
"def delete\n\n end",
"def destroy\n @opml_metadata = OpmlMetadata.find(params[:id])\n @opml_metadata.destroy\n\n respond_to do |format|\n format.html { redirect_to(opml_metadatas_url) }\n format.xml { head :ok }\n end\n end",
"def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end",
"def file_delete(file)\n\t\tputs \"Delete entries to the local site store from file: #{file}\" if @verbose\n\t\traise \"File non-exist. Please check your file path and name again: #{file}\" unless File.exist?(file)\n\t\tsites=file_2_list(file)\n\t\tchanges=Array.new\n\t\tchanges=bulk_delete(sites) unless sites.nil? or sites.empty?\n\trescue => ee\n\t\tputs \"Exception on method file_delete: #{ee} for file: #{file}\" if @verbose\n\tend",
"def version_delete(version_delete = nil)\n\n change_log_nodes = @sopm.xpath('/otrs_package/ChangeLog')\n\n if !version_delete || version_delete == @structure['version']\n\n new_version = nil\n if change_log_nodes.length > 0\n @sopm.xpath('/otrs_package/ChangeLog').first.remove\n if @sopm.xpath('/otrs_package/ChangeLog').length > 0\n new_version = @sopm.xpath('/otrs_package/ChangeLog').first['Version']\n end\n end\n\n @sopm.xpath('/otrs_package/Version').children[0].content = new_version\n elsif change_log_nodes.length > 0\n\n change_log_nodes.each { |change_log_node|\n\n next if !change_log_node['Version'].is_a? String\n next if change_log_node['Version'] != version_delete\n\n change_log_node.remove\n\n break\n }\n end\n\n store\n end",
"def destroy\n @wiki = @project.wikis.find(params[:id])\n @project.wikis.delete(@wiki)\n @wiki.destroy\n\n respond_to do |format|\n format.html { redirect_to project_wikis_path(@project) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tdoc = Tdoc.find(params[:id])\n @tdoc.destroy\n\n respond_to do |format|\n format.html { redirect_to(tdocs_url) }\n format.xml { head :ok }\n end\n end",
"def del\n delete\n end",
"def destroy\n @goods_auto_option = GoodsAutoOption.find(params[:id])\n @goods_auto_option.destroy\n\n respond_to do |format|\n format.html { redirect_to(goods_auto_options_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.6999659",
"0.69996226",
"0.65494996",
"0.6258215",
"0.58834153",
"0.58636796",
"0.5760584",
"0.5737086",
"0.5615536",
"0.5603464",
"0.55823964",
"0.55224675",
"0.54767346",
"0.5435245",
"0.54351914",
"0.53915316",
"0.53686434",
"0.5356971",
"0.53467727",
"0.5346028",
"0.5322442",
"0.5322442",
"0.53109884",
"0.53091574",
"0.5299619",
"0.5283446",
"0.5283242",
"0.5283242",
"0.5280754",
"0.5280248",
"0.5272977",
"0.52721924",
"0.526945",
"0.5261786",
"0.5249994",
"0.5234281",
"0.5224319",
"0.5223416",
"0.5221811",
"0.5213875",
"0.52098525",
"0.51990026",
"0.51966166",
"0.51957965",
"0.51949966",
"0.5193247",
"0.51862884",
"0.5181816",
"0.518085",
"0.5176549",
"0.51729554",
"0.5168994",
"0.516441",
"0.51640034",
"0.5163624",
"0.5163624",
"0.5154786",
"0.515302",
"0.5151697",
"0.51494944",
"0.5142752",
"0.51409143",
"0.51362777",
"0.51362777",
"0.5133302",
"0.513021",
"0.5122481",
"0.5120314",
"0.5119338",
"0.5119202",
"0.51113415",
"0.5107589",
"0.51066846",
"0.51062393",
"0.51036066",
"0.51020795",
"0.5099779",
"0.5099779",
"0.5099779",
"0.5099779",
"0.5099779",
"0.5099779",
"0.5099779",
"0.50977916",
"0.5096773",
"0.5094929",
"0.5089203",
"0.5085125",
"0.5082742",
"0.50813794",
"0.50784886",
"0.5075208",
"0.507047",
"0.50667685",
"0.5066393",
"0.5063905",
"0.5059489",
"0.5058356",
"0.50571793",
"0.5054619"
] |
0.75717944
|
0
|
runs after each test
|
def teardown
# delete everything
@client.delete('/words.json') rescue nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def after_test(_test); end",
"def after_test(_test); end",
"def after_test(_test); end",
"def after; end",
"def after; end",
"def after\n end",
"def testing_end\n end",
"def after\n end",
"def after\n end",
"def after\n end",
"def after_teardown; end",
"def after() nil ; end",
"def after\n\t\t\ttrue\n\t\tend",
"def teardown\n\t\tputs \"Completed unit test execution\"\n\tend",
"def run_after_each\n #puts \"[#{Process.pid}] #{self} after_each\"\n @example_group_instance.verify_mocks_for_rspec\n Amnesia.check_for_server_errors!\n end",
"def final_test\n return unless MiniApivore.all_test_ran?\n\n @errors = MiniApivore.prepare_untested_errors\n assert(@errors.empty?, @errors.join(\"\\n\"))\n\n # preventing duplicate execution\n MiniApivore.runnable_list << \"#{self.class}::#{__method__}_runned\"\n end",
"def done\n puts 'Done running tests'\n end",
"def after_finished\n end",
"def teardown(&block)\n after(:each, &block)\n end",
"def before_teardown; end",
"def teardown\r\n end",
"def teardown; end",
"def teardown; end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n @suite.p \"\\n:: [TEARDOWN]\\n\"\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def after\n @after\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def teardown\n\n end",
"def testloop\n \n end",
"def teardown\n\tend",
"def teardown\n\tend",
"def teardown\n end",
"def teardown\n end",
"def teardown\n # if necessary\n end",
"def teardown!\n\n end",
"def teardown\n # empty\n end",
"def teardown\n end",
"def after_failed\n end",
"def teardown\n # do something\n end",
"def test_run_completed(test_run)\n report_results test_run\n end",
"def after_suite(&after_suite_proc)\n @counter = 0\n context = self\n singleton_class.class_eval do\n original_singleton_run = instance_method(:run)\n define_method :run do |*args, &block|\n original_singleton_run.bind(self).call(*args, &block)\n context.instance_eval do\n @counter += 1\n if has_run_all_related_suites?\n @sandbox.instance_eval &after_suite_proc\n end\n end\n end\n end\n end",
"def teardown\n puts \"tear down\"\n end",
"def finish\n\t\t\twrite_log_to_file(@logfile)\n\t\t\twrite_xmlfile(@xmlfile)\n\t\t\tif @errcount > 0 or @warncount > 0 then\n\t\t\t\twrite_log_to_stdout\n\t\t\tend\n\t\t\tputs \"Test run finished (#{@errcount} errors, #{@warncount} warnings).\"\n\t\tend",
"def teardown\n # Empty\n end",
"def teardown\n # Empty\n end",
"def recycle; teardown; setup; end",
"def finish\n @test_output = @test_output.join.split(\"\\n\")\n @test_description = @test_output.shift\n end",
"def teardown\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def teardown\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def after_processing\n end",
"def after_all(&block)\n @runner.set_after_all(@current_platform, block)\n end",
"def after_run\n check_output_files\n show_results\n end",
"def after(datum); end",
"def after(datum); end",
"def after_resolution\n end",
"def teardown\n\t\tputs 'teardown: '+ @test_name\n\n\t\t@driver.close\n\t\t@driver.quit\n\tend",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\r\n # Do nothing\r\n end"
] |
[
"0.870935",
"0.870935",
"0.870935",
"0.7898083",
"0.7898083",
"0.7802519",
"0.7731518",
"0.7725426",
"0.7725426",
"0.7721521",
"0.76235646",
"0.74868226",
"0.73683226",
"0.73535156",
"0.73533344",
"0.71286774",
"0.709552",
"0.7061224",
"0.7002905",
"0.68963164",
"0.6883115",
"0.6874081",
"0.6874081",
"0.68576264",
"0.68576264",
"0.68576264",
"0.68576264",
"0.68576264",
"0.68576264",
"0.68576264",
"0.68576264",
"0.68576264",
"0.68576264",
"0.68576264",
"0.68576264",
"0.68576264",
"0.6843746",
"0.68207026",
"0.68207026",
"0.68207026",
"0.68207026",
"0.68207026",
"0.68207026",
"0.68207026",
"0.68207026",
"0.6815896",
"0.6777102",
"0.6777102",
"0.6777102",
"0.6777102",
"0.6777102",
"0.6777102",
"0.6777102",
"0.6777102",
"0.6777102",
"0.6777102",
"0.6777102",
"0.6777102",
"0.6777102",
"0.6777102",
"0.6777102",
"0.6777102",
"0.6777102",
"0.67459583",
"0.67361695",
"0.67361695",
"0.6732661",
"0.6732661",
"0.6726809",
"0.6724854",
"0.6719223",
"0.66560626",
"0.66436005",
"0.66153824",
"0.6612035",
"0.66108775",
"0.65972596",
"0.6578206",
"0.6575554",
"0.6575554",
"0.656895",
"0.6553506",
"0.64925665",
"0.64925665",
"0.64914876",
"0.6476177",
"0.6457103",
"0.64453954",
"0.64453954",
"0.6444296",
"0.6441134",
"0.64224225",
"0.64224225",
"0.64224225",
"0.64224225",
"0.64224225",
"0.64224225",
"0.64224225",
"0.64224225",
"0.64224225",
"0.64224225"
] |
0.0
|
-1
|
~ Validation ............................................................... ~ Constants ................................................................ ~ Hooks .................................................................... ~ Class methods ............................................................ ~ Instance methods ......................................................... clone inst_chapter_module
|
def clone(book, chapter)
ch_mod = InstChapterModule.new
ch_mod.inst_chapter_id = chapter.id
ch_mod.inst_module_id = self.inst_module_id
ch_mod.module_position = self.module_position
ch_mod.save
inst_sections.each do |section|
inst_section = section.clone(book, ch_mod)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def clone(inst_book)\n ch = InstChapter.new\n ch.inst_book_id = inst_book.id\n ch.name = self.name\n ch.short_display_name = self.short_display_name\n ch.position = self.position\n ch.save\n\n inst_chapter_modules.each do |chapter_module|\n inst_chapter_module = chapter_module.clone(inst_book, ch)\n end\n end",
"def load_chapter\n end",
"def clone(inst_book, inst_section)\n book_section_exercise = InstBookSectionExercise.new\n book_section_exercise.inst_section_id = inst_section.id\n book_section_exercise.inst_book_id = inst_book.id\n book_section_exercise.inst_exercise_id = self.inst_exercise_id\n book_section_exercise.points = self.points\n book_section_exercise.required = self.required\n book_section_exercise.threshold = self.threshold\n book_section_exercise.options = self.options\n book_section_exercise.save\n end",
"def clone(current_user)\n b = InstBook.new\n b.title = self.title\n b.desc = self.desc\n b.options = self.options\n b.user_id = current_user.id\n b.save\n\n inst_chapters.each do |chapter|\n inst_chapter = chapter.clone(b)\n end\n return b\n end",
"def clone\n end",
"def clone\n end",
"def clone\n end",
"def clone() end",
"def clone\n end",
"def clone; end",
"def clone; end",
"def clone; end",
"def initialize(title)\n # instance variable - this variable is accessible all throughout our class\n @title = title\n # @chapters = chapters\n @chapters = []\n end",
"def clone(*) end",
"def clone(*) end",
"def clone\n super\n end",
"def clone_course \n if params[:copy_course_id]\n @service_learning_course ||= ServiceLearningCourse.find(params[:copy_course_id])\n \n if slc2 = @service_learning_course.deep_clone!\n slc2.update_attribute(:quarter_id, @quarter.id)\n flash[:notice] = \"Successfully cloned #{@service_learning_course.title} for #{slc2.quarter.title}. You can customize the details below.\" \n redirect_to edit_service_learning_course_path(@unit, slc2.quarter, slc2)\n else\n flash[:error] = \"Sorry, but we couldn't copy that course. An error occurred.\"\n redirect_to :back\n end\n end \n end",
"def initialize\n @title, @chapter = title, []\n\n p 'Your book was opened!'\n\n end",
"def copy\n if @ok\n @new_lesson = @lesson.copy(current_user.id)\n if @new_lesson.nil?\n @ok = false\n @error = @lesson.get_base_error\n end\n else\n @error = I18n.t('activerecord.errors.models.lesson.problem_copying')\n end\n end",
"def clone\n super\n end",
"def clone\n raise NotImplementedError\n end",
"def clone_story\n clone = self.amoeba_dup\n if clone.save\n puts \"$$$$$$$$$ clone successful - copying asset files\"\n\n # copy the assets\n # - have to copy each one by hand so can update the file name with the id of the new asset\n original_id = self.id\n new_id = clone.id\n\n # story thumbnail\n puts \"$$$$$$$$$ clone successful - copying thumbnail\"\n if self.asset.present? && self.asset.file.exists?\n Dir.glob(self.asset.file.path.gsub('/original/', '/*/')).each do |file|\n copy_asset file, file.gsub(\"/thumbnail/#{original_id}/\", \"/thumbnail/#{new_id}/\")\n end\n end\n\n # section audio\n puts \"$$$$$$$$$ clone successful - copying audio\"\n new_audio = clone.sections.map{|x| x.section_translations }.flatten.select{|x| x.asset.present? && x.asset.asset.exists?}.map{|x| x.asset }\n self.sections.map{|x| x.section_translations }.flatten.select{|x| x.asset.present? && x.asset.asset.exists?}.map{|x| x.asset }.each do |audio|\n # find matching record\n record = new_audio.select{|x| x.asset_file_name == audio.asset_file_name &&\n x.asset_content_type == audio.asset_content_type &&\n x.asset_file_size == audio.asset_file_size &&\n x.asset_updated_at == audio.asset_updated_at}.first\n # copy the file if match found\n if record.present?\n copy_asset audio.file.path, audio.file.path.gsub(\"/audio/#{original_id}/\", \"/audio/#{new_id}/\")\n .gsub(\"/#{audio.id}__\", \"/#{record.id}__\")\n end\n end\n\n # slideshow\n puts \"$$$$$$$$$ clone successful - copying slideshow\"\n new_ss = clone.sections.select{|x| x.slideshow? && x.slideshow.present? }.map{|x| x.slideshow.slideshow_translations }.flatten.map{|x| x.asset_files }.flatten.select{|x| x.asset.exists? }\n self.sections.select{|x| x.slideshow? && x.slideshow.present? }.map{|x| x.slideshow.slideshow_translations }.flatten.map{|x| x.asset_files }.flatten.select{|x| x.asset.exists? }.each do |img|\n # find matching record\n record = new_ss.select{|x| x.asset_file_name == img.asset_file_name &&\n x.asset_content_type == img.asset_content_type &&\n x.asset_file_size == img.asset_file_size &&\n x.asset_updated_at == img.asset_updated_at}.first\n # copy the file if match found\n if record.present?\n Dir.glob(img.file.path.gsub('/original/', '/*/')).each do |file|\n copy_asset file, file.gsub(\"/slideshow/#{original_id}/\", \"/slideshow/#{new_id}/\")\n .gsub(\"/#{img.id}__\", \"/#{record.id}__\")\n end\n end\n end\n\n # media image\n puts \"$$$$$$$$$ clone successful - copying images\"\n new_img = clone.sections.select{|x| x.media? && x.media.present? }.map{ |x| x.media }.flatten.map{|x| x.medium_translations}.flatten.select{|x| x.image_exists? }.map{|x| x.image }\n self.sections.select{|x| x.media? && x.media.present? }.map{ |x| x.media }.flatten.map{|x| x.medium_translations}.flatten.select{|x| x.image_exists? }.map{|x| x.image }.each do |img|\n # find matching record\n record = new_img.select{|x| x.asset_file_name == img.asset_file_name &&\n x.asset_content_type == img.asset_content_type &&\n x.asset_file_size == img.asset_file_size &&\n x.asset_updated_at == img.asset_updated_at}.first\n # copy the file if match found\n if record.present?\n Dir.glob(img.file.path.gsub('/original/', '/*/')).each do |file|\n copy_asset file, file.gsub(\"/images/#{original_id}/\", \"/images/#{new_id}/\")\n .gsub(\"/#{img.id}__\", \"/#{record.id}__\")\n end\n end\n end\n\n # videos\n puts \"$$$$$$$$$ clone successful - copying videos\"\n new_video = clone.sections.select{|x| x.media? && x.media.present? }.map{ |x| x.media }.flatten.map{|x| x.medium_translations}.flatten.select{|x| x.video_exists? }.map{|x| x.video }\n self.sections.select{|x| x.media? && x.media.present? }.map{ |x| x.media }.flatten.map{|x| x.medium_translations}.flatten.select{|x| x.video_exists? }.map{|x| x.video }.each do |video|\n # find matching record\n record = new_video.select{|x| x.asset_file_name == video.asset_file_name &&\n x.asset_content_type == video.asset_content_type &&\n x.asset_file_size == video.asset_file_size &&\n x.asset_updated_at == video.asset_updated_at}.first\n # copy the file if match found\n if record.present?\n # it is possible that the original video is not mp4 so need to look for anything that has same basename (ignore file ext)\n ext = File.extname(video.file.path)\n basename = File.basename(video.file.path)\n name = File.basename(video.file.path, ext)\n\n Dir.glob(video.file.path.gsub('/original/', '/*/').gsub(basename, \"#{name}.*\")).each do |file|\n copy_asset file, file.gsub(\"/video/#{original_id}/\", \"/video/#{new_id}/\")\n .gsub(\"/#{video.id}__\", \"/#{record.id}__\")\n end\n\n # get the poster folder too\n copy_asset video.file.path(:poster), video.file.path(:poster).gsub(\"/video/#{original_id}/\", \"/video/#{new_id}/\")\n .gsub(\"/#{video.id}__\", \"/#{record.id}__\")\n\n end\n end\n\n\n # infographic\n puts \"$$$$$$$$$ clone successful - copying infographic\"\n new_info = clone.sections.select{|x| x.infographic? && x.infographic.present? }.map{|x| x.infographic.infographic_translations }.flatten.select{|x| x.image_exists?}.map{|x| x.image}\n self.sections.select{|x| x.infographic? && x.infographic.present? }.map{|x| x.infographic.infographic_translations }.flatten.select{|x| x.image_exists?}.map{|x| x.image}.each do |img|\n # find matching record\n record = new_info.select{|x| x.asset_file_name == img.asset_file_name &&\n x.asset_content_type == img.asset_content_type &&\n x.asset_file_size == img.asset_file_size &&\n x.asset_updated_at == img.asset_updated_at}.first\n # copy the file if match found\n if record.present?\n Dir.glob(img.file.path.gsub('/original/', '/*/')).each do |file|\n copy_asset file, file.gsub(\"/infographic/#{original_id}/\", \"/infographic/#{new_id}/\")\n .gsub(\"/#{img.id}__\", \"/#{record.id}__\")\n end\n end\n end\n\n # infographic_dataset\n puts \"$$$$$$$$$ clone successful - copying infographic_dataset\"\n new_info_dataset = clone.sections.select{|x| x.infographic? && x.infographic.present? }.map{|x| x.infographic.infographic_translations }.flatten.select{|x| x.dataset_file_exists?}.map{|x| x.dataset_file}\n self.sections.select{|x| x.infographic? && x.infographic.present? }.map{|x| x.infographic.infographic_translations }.flatten.select{|x| x.dataset_file_exists?}.map{|x| x.dataset_file}.each do |img|\n # find matching record\n record = new_info_dataset.select{|x| x.asset_file_name == img.asset_file_name &&\n x.asset_content_type == img.asset_content_type &&\n x.asset_file_size == img.asset_file_size &&\n x.asset_updated_at == img.asset_updated_at}.first\n # copy the file if match found\n if record.present?\n Dir.glob(img.file.path.gsub('/original/', '/*/')).each do |file|\n copy_asset file, file.gsub(\"/infographic_dataset/#{original_id}/\", \"/infographic_dataset/#{new_id}/\")\n .gsub(\"/#{img.id}__\", \"/#{record.id}__\")\n end\n end\n end\n\n # # look in each directory in path and see if it has folder for original_id\n # # if so, copy it for new story\n # Dir.glob(\"#{path}/*\").select {|f| File.directory? f}.each do |directory|\n # if Dir.exists?(\"#{directory}/#{original_id}\")\n # puts \"$$$$$$$$$ - copying files from #{directory}\"\n # FileUtils.cp_r \"#{directory}/#{original_id}\", \"#{directory}/#{new_id}\"\n # end\n # end\n end\n\n return clone\n end",
"def clone\n @clone = true\n end",
"def initialize(title,author,isbn)\n @title = title\n @author = author\n @isbn = isbn.to_i\n# @borrow = false\n end",
"def copy\n \n end",
"def test_more_chapters\n Republic::DirBinder.write(Republic::Book.new { |b|\n b << Republic::HtmlChapter.new { |c| \n c.text = \"<p>This is chapter 1</p>\"\n }\n b << Republic::HtmlChapter.new { |c| \n c.text = \"<p>This is chapter 2</p>\"\n }\n b << Republic::HtmlChapter.new { |c| \n c.text = \"<p>This is chapter 3</p>\"\n }\n }, TEST_DIR + \"/book2\")\n\n assert File.file?(TEST_DIR + \"/book2/chap0000.xhtml\"), \"First chapter present\"\n assert File.file?(TEST_DIR + \"/book2/chap0001.xhtml\"), \"Second chapter present\"\n assert File.file?(TEST_DIR + \"/book2/chap0002.xhtml\"), \"Third chapter present\"\n\n assert_match /.*This is chapter 1.*/, IO.read(TEST_DIR + \"/book2/chap0000.xhtml\")\n assert_match /.*This is chapter 2.*/, IO.read(TEST_DIR + \"/book2/chap0001.xhtml\")\n assert_match /.*This is chapter 3.*/, IO.read(TEST_DIR + \"/book2/chap0002.xhtml\")\n end",
"def cloning_tank\n end",
"def vendored\n clone unless cloned?\n super\n end",
"def clone_me\n ActiveRecord::Base.transaction do\n survey = self.survey\n\n #get greatest minor version\n minor_version = self.survey.survey_versions.where(:major => self.major).order('survey_versions.minor desc').first.minor + 1\n new_sv = survey.survey_versions.build(self.attributes.merge(:minor => minor_version))\n new_sv.published = false\n new_sv.locked = false\n new_sv.save!\n\n #clone members\n [\"pages\", \"survey_elements\", \"display_fields\", \"rules\"].each do |member_name|\n self.send(member_name).each do |item|\n item.clone_me(new_sv)\n end\n end\n\n # Fix the next_page_ids for page level flow control\n new_sv.pages.where(\"pages.next_page_id is not null\").all.select {|page| page.next_page.survey_version_id != new_sv.id}.each do |page|\n page.update_attributes(:next_page_id => new_sv.pages.find_by_clone_of_id(page.next_page_id).try(:id)) # Use try so that if something goes wrong and you can't find the correct page it will just blank out the flow control\n end\n\n new_sv\n end\n end",
"def copy\n ComponentModule.new(*original_arguments, &component_descriptors)\n end",
"def module_move_up(mod) end",
"def clone\n @clone ||= super\n end",
"def clone_head; end",
"def copy\n orig_questionnaire = Questionnaire.find(params[:id])\n questions = Question.find_all_by_questionnaire_id(params[:id]) \n @questionnaire = orig_questionnaire.clone\n \n if (session[:user]).role.name != \"Teaching Assistant\"\n @questionnaire.instructor_id = session[:user].id\n else # for TA we need to get his instructor id and by default add it to his course for which he is the TA\n @questionnaire.instructor_id = Ta.get_my_instructor((session[:user]).id)\n end\n @questionnaire.name = 'Copy of '+orig_questionnaire.name\n \n begin\n @questionnaire.save! \n @questionnaire.update_attribute('created_at',Time.now)\n questions.each{\n | question |\n newquestion = question.clone\n newquestion.questionnaire_id = @questionnaire.id\n newquestion.save \n \n advice = QuestionAdvice.find_by_question_id(question.id)\n newadvice = advice.clone\n newadvice.question_id = newquestion.id\n newadvice.save\n } \n pFolder = TreeFolder.find_by_name(@questionnaire.display_type)\n parent = FolderNode.find_by_node_object_id(pFolder.id)\n if QuestionnaireNode.find_by_parent_id_and_node_object_id(parent.id,@questionnaire.id) == nil\n QuestionnaireNode.create(:parent_id => parent.id, :node_object_id => @questionnaire.id)\n end\n redirect_to :controller => 'questionnaire', :action => 'view', :id => @questionnaire.id\n rescue\n flash[:error] = 'The questionnaire was not able to be copied. Please check the original course for missing information.'+$! \n redirect_to :action => 'list', :controller => 'tree_display'\n end \n end",
"def new\n #= Course.find(params[:cid])\n @title = \"New Module\"\n order=0\n if coursemod = Coursemod.where(course_id: @course.id).first\n order=coursemod.coursemod_order\n end\n @coursemod= Coursemod.new(:coursemod_order => (order+1))\n end",
"def new\n params_hash = {board_id: params[:board_id],content_year_id: params[:content_year_id],subject_id: params[:subject_id]}\n @chapter = Chapter.new(params_hash)\n @chapter.assets.build\n @chapter.build_content_profile\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chapter }\n end\n end",
"def is_chapter?()\n end",
"def initialize(chapter_number, chapter_name, slide_file, plain_file)\n @chapter_number = chapter_number\n @chapter_name = chapter_name\n @slide_file = slide_file\n @plain_file = plain_file\n end",
"def create_chapters(params)\n #@new_chapters = []\n #params.each do |key, value|\n @new_chapter = self.chapters.new(title: params[:title], description: params[:description], draft: params[:draft])\n #@new_chapters << chapter \n end",
"def clone_course(course)\n cloned_course = course.dup\n cloned_course.update_attribute(\"name\", course.name + \"-CLONE\")\n cloned_course.save\n\n cloned_course\n end",
"def initialize(info = {})\n\n\t\t@module_info_copy = info.dup\n\n\n\t\tself.module_info = info\n\t\tgenerate_uuid\n\n\t\tset_defaults\n\n\t\t# Initialize module compatibility hashes\n\t\tinit_compat\n\n\t\t# Fixup module fields as needed\n\t\tinfo_fixups\n\n\t\t# Transform some of the fields to arrays as necessary\n\t\tself.author = Author.transform(module_info['Author'])\n\t\tself.arch = Rex::Transformer.transform(module_info['Arch'], Array, [ String ], 'Arch')\n\t\tself.platform = PlatformList.transform(module_info['Platform'])\n\t\tself.references = Rex::Transformer.transform(module_info['References'], Array, [ SiteReference, Reference ], 'Ref')\n\n\t\t# Create and initialize the option container for this module\n\t\tself.options = OptionContainer.new\n\t\tself.options.add_options(info['Options'], self.class)\n\t\tself.options.add_advanced_options(info['AdvancedOptions'], self.class)\n\t\tself.options.add_evasion_options(info['EvasionOptions'], self.class)\n\n\t\t# Create and initialize the data store for this module\n\t\tself.datastore = ModuleDataStore.new(self)\n\n\t\t# Import default options into the datastore\n\t\timport_defaults\n\n\t\tself.privileged = module_info['Privileged'] || false\n\t\tself.license = module_info['License'] || MSF_LICENSE\n\n\t\t# Allow all modules to track their current workspace\n\t\tregister_advanced_options(\n\t\t\t[\n\t\t\t\tOptString.new('WORKSPACE', [ false, \"Specify the workspace for this module\" ])\n\t\t\t], Msf::Module)\n\tend",
"def new_chapter\n\t\tchapter = Chapter.new\n\t\tchapter.story = self\n\t\tchapter.position = self.newest_chapter_position\n\n\t\treturn chapter\n\tend",
"def initialize(title, author, desc, year, edition, num_copies)\n @title = title\n @author = author\n @desc = desc\n @year = year\n @num_copies = num_copies\n @year = year\n @edition = edition\n\n @num_copies = num_copies\n @num_in = @num_copies\n @num_out = 0\n @borrowed_by = []\n @reviews = []\n @ratings = []\n @future_check_out = {}\n end",
"def initialize_clone\n # avoids crash in RepositoriesController#destroy\n return unless attributes[\"extra_info\"][\"extra_clone_url\"]\n \n p = parse(attributes[\"extra_info\"][\"extra_clone_url\"])\n self.identifier = p[:identifier] if identifier.empty?\n self.url = PATH_PREFIX + p[:path] if url.empty?\n\n err = ensure_possibly_empty_clone_exists\n errors.add :extra_clone_url, err if err \n end",
"def initialize_copy(other)\n # The code in super (Module#initialize_copy) will duplicate\n # the method table. Therefore do this check here to see whether\n # we've already initialized this class before continuing.\n unless @method_table == other.method_table\n raise TypeError, \"already initialized class\"\n end\n\n @module_name = nil\n super\n end",
"def parent\n self.chapter\n end",
"def initialize_clone( hooked_array_clone )\n \n super\n \n hooked_array_clone.internal_array = hooked_array_clone.internal_array.clone\n \n end",
"def clone_me(target_sv)\n target_sv.pages.create(\n self.attributes.except(\n \"created_at\",\n \"updated_at\",\n \"id\",\n \"survey_version_id\",\n \"survey_version\",\n \"clone_of_id\"\n ).merge(\"clone_of_id\" => self.id)\n )\n end",
"def copy_actions\r\n end",
"def initialize(mod)\n @exported = mod # for now simply nil\n end",
"def initialize_copy(*args)\n super\n\n reset_main_generator\n end",
"def clone(*args); end",
"def clone\n copy(false)\n end",
"def clone\n Chord::new self.to_hash\n end",
"def deep_clone\n # use deep_cloneable to create a clone of most of the test_case\n new_case = self.dup(:include => [:steps], :except => [:unique_key, {:steps => :id}])\n # couldn't get the suites to copy, but those are simple enough\n new_case.suite_ids=self.suite_ids\n return new_case\n end",
"def initialize_copy(orig)\n #This is a stub, used for indexing\n end",
"def start_new_chapter chapter\n start_new_page unless at_page_top?\n if @ppbook && verso_page? && !(chapter.option? 'nonfacing')\n update_colors # prevents Ghostscript from reporting a warning when running content is written to blank page\n start_new_page\n end\n end",
"def clone\n dup\n end",
"def initialize(json_file_path)\n @@_module_key = ENV['MODULE_KEY'].to_sym\n @@_content_key = ENV['CONTENT_KEY'].to_sym\n @@_lesson_key = ENV['LESSON_KEY'].to_sym\n @@_lesson_title_key = ENV['LESSON_TITLE_KEY'].to_sym\n @@_lesson_description = ENV['LESSON_DISCRIPTION'].to_sym\n\n\n hash = Utilities.load_json(json_file_path)\n descriptions = :Description\n mod = :Module\n\n\n super()\n @title = hash[mod][:Title]\n @difficulty = hash[mod][:Difficulty]\n\n @author = hash[mod][:Author]\n @updated = hash[mod][:Last_Updated]\n @desc = hash[mod][descriptions]\n @section_titles = []\n @section_descriptions = []\n @file_ref = json_file_path\n # alias to ContentController module\n @sys = ContentController\n\n\n hash[@@_content_key].each do |section|\n @section_titles.push section[@@_lesson_title_key] ||= []\n @section_descriptions.push section[@@_lesson_description] ||= []\n end\n end",
"def copy\n expression_to_clone = Expression.find(params[:id])\n\t\t\t \n\t@expression = expression_to_clone.clone\n\t\n\t@expression.expression_title = \"Copy of '#{expression_to_clone.expression_title}'\"\n \n if @expression.expression_title.length > 100\n flash[:error] = \"The new title '#{@expression.expression_title}' is too long.\"\n redirect_to :action => 'edit', :id => expression_to_clone.id\n return\n end\n\t\n\t@expression.status = Status::PENDING # default to 'pending'\n\t\n\t# delete created_at assigned from expression_to_clone created_at value\n\t# as we need created_at be actual time of creating the copy\n\t@expression.created_at = nil\t\n\t\t\n\t# updated by\n\t@expression.updated_by = get_user.login_id\n\t\n\t# languages\n\texpression_to_clone.languages.each do |l|\n\t @expression.languages << Language.find(l.language_id)\n\tend\n\t\t\n\tif @expression.save_with_frbr\n\t \n\t # copying relationships\n\t success = true\n\t \n\t # FIXME do we need to clone access rights???\n\t # it seems that currently there is no UI for entering them???\n\t #expression_to_clone.expression_access_rights.each do |ar|\n\t # expression_access_right = ExpressionAccessRight.new\n\t # expression_access_right = ar.clone\n\t # expression_access_right.expression_id = @expression.id\n\t # \n\t # success = false if !expression_access_right.save\n\t #end\n\t \t \n\t # manifestations - it is requested to do not copy relationships with manifestations\n\t #expression_to_clone.manifestations.each do |m|\n\t #\tsuccess = false if !m.add_expression(@expression)\n\t #end\n\t \n\t # other relationships\n\t expression_to_clone.expression_relationships.each do |ex_relationship|\n\t \tsuccess = false if !RelationshipHelper.copy_frbr_relationships(@expression, ex_relationship, @login)\n\t end\n\t \n\t notice = 'Expression clone was successfully created.'\n\t notice += ' But some of the relationships failed to be copied.' if !success\n\t \n\t flash[:notice] = notice\n\t \n\t redirect_to :action => 'edit', :id => @expression\n\telse\n\t flash[:error] = 'Expression cloning has failed.'\n\t redirect_to :action => 'edit', :id => expression_to_clone.id\n\tend\t\t\t\n end",
"def call\n clone_revision\n end",
"def mod\n @mod \n end",
"def clone()\n Judge.new(@school.clone, @name.clone)\n end",
"def clone\n self\n end",
"def chapter_params\n params.require(:chapter).permit(:number, :name, :course_id, :cancel_url, :redirect_url)\n end",
"def clone_pre_copy_hook(clone_source_object, _opts = {})\n clone_source_object\n end",
"def deep_clone; end",
"def create_new_chapters!\n new_chapters.each do |c|\n chap = Chapter.new(lecture_id: @lecture.id, title: c.second)\n chap.insert_at(c.first)\n corresponding = @chapters.find { |d| d['counter'] == c.third }\n corresponding['mampf_chapter'] = chap\n end\n @lecture = @lecture.reload\n end",
"def edit_aux(module_type,module_id,module_name,version,opts={})\n module_location = OsUtil.module_location(module_type,module_name,version,opts)\n\n pull_if_needed = opts[:pull_if_needed]\n # check if there is repository cloned\n unless File.directory?(module_location)\n if opts[:automatically_clone] or Console.confirmation_prompt(\"Edit not possible, module '#{module_name}#{version && \"-#{version}\"}' has not been cloned. Would you like to clone module now\"+'?')\n internal_trigger = true\n omit_output = true\n response = clone_aux(module_type,module_id,version,internal_trigger,omit_output,opts)\n # if error return\n return response unless response.ok?\n pull_if_needed = false\n else\n # user choose not to clone needed module\n return\n end\n end\n # here we should have desired module cloned\n\n if pull_if_needed\n response = pull_clone_changes?(module_type,module_id,version,opts)\n return response unless response.ok?\n end\n grit_adapter = Helper(:git_repo).create(module_location)\n if edit_info = opts[:edit_file]\n #TODO: cleanup so dont need :base_file_name\n file_to_edit =\n if edit_info.kind_of?(String)\n edit_info\n else #edit_info.kind_of?(Hash) and has key :base_file_name\n base_file = edit_info[:base_file_name]\n (File.exists?(\"#{module_location}/#{base_file}.yaml\") ? \"#{base_file}.yaml\" : \"#{base_file}.json\")\n end\n OsUtil.edit(\"#{module_location}/#{file_to_edit}\")\n OsUtil.print(\"If you want to use different editor please set environment variable EDITOR and log back into dtk-shell!\", :yellow) unless ENV['EDITOR']\n else\n Console.unix_shell(module_location, module_id, module_type, version)\n end\n\n unless grit_adapter.repo_exists?\n puts \"Local module has been removed, skipping changes.\"\n return Response::Ok.new()\n end\n\n unless grit_adapter.changed?\n puts \"No changes to repository\"\n return Response::Ok.new()\n end\n\n unless file_to_edit\n grit_adapter.print_status\n end\n\n # check to see if auto commit flag\n auto_commit = ::DTK::Configuration.get(:auto_commit_changes)\n confirmed_ok = false\n\n # if there is no auto commit ask for confirmation\n unless auto_commit\n confirm_msg =\n if file_to_edit\n \"Would you like to commit changes to the file?\"\n else\n \"Would you like to commit ALL the changes?\"\n end\n confirmed_ok = Console.confirmation_prompt_simple(confirm_msg)\n end\n if (auto_commit || confirmed_ok)\n if auto_commit\n puts \"[NOTICE] You are using auto-commit option, all changes you have made will be commited.\"\n end\n commit_msg = user_input(\"Commit message\")\n\n # remove qoutes if they are not closed properly in commit_msg\n commit_msg.gsub!(/\\\"/,'') unless commit_msg.count('\"') % 2 ==0\n\n internal_trigger=true\n reparse_aux(module_location)\n\n # use_impl_id - if edit-component-module which has version use impl_id from assembly--<assembly_name> version of component instance\n opts.merge!(:force_parse => true, :update_from_includes => true, :print_dependencies => true, :use_impl_id => true)\n response = push_clone_changes_aux(module_type,module_id,version,commit_msg,internal_trigger,opts)\n\n # if error return\n return response unless response.ok?\n end\n\n #TODO: temporary took out; wil put back in\n #puts \"DTK SHELL TIP: Adding the client configuration parameter <config param name>=true will have the client automatically commit each time you exit edit mode\" unless auto_commit\n Response::Ok.new()\n end",
"def create_copy\n #add page at end of survey\n new_page_num = self.survey_version.pages.size + 1\n page_attribs = self.attributes.merge(:page_number => new_page_num)\n page_attribs.delete(\"id\")\n page_attribs.delete(\"next_page_id\")\n new_page = Page.create!(page_attribs)\n\n #Copy current page assetables\n self.survey_elements.each do |se|\n se.copy_to_page(new_page)\n end\n\n new_page\n end",
"def initialize(title, author, isbn)\n @title = title\n @author = author\n @isbn = isbn\nend",
"def paste\n # no authorization applied as the method must always render\n if @section.changeable?(current_visitor)\n @original = clipboard_object(params)\n if @original\n @container = params[:container] || 'section_pages_list'\n if @original.class == Page\n @component = @original.duplicate\n else\n @component = @original.deep_clone :no_duplicates => true, :never_clone => [:uuid, :updated_at,:created_at]\n @component.name = \"copy of #{@original.name}\"\n end\n if (@component)\n # @component.original = @original\n @component.section = @section\n @component.save\n end\n @component.deep_set_user current_visitor\n end\n end\n render :update do |page|\n page.insert_html :bottom, @container, render(:partial => 'page_list_item', :locals => {:page => @component})\n page.sortable :section_pages_list, :handle=> 'sort-handle', :dropOnEmpty => true, :url=> {:action => 'sort_pages', :params => {:section_id => @section.id }}\n page[dom_id_for(@component, :item)].scrollTo()\n page.visual_effect :highlight, dom_id_for(@component, :item)\n end\n end",
"def _clone\n self.class.new(self)\n end",
"def duplicate\n super do |cloned_resource|\n cloned_resource.title = \"Copy #{@resource.title[0...Integral.title_length_maximum - 5]}\"\n cloned_resource.view_count = 0\n cloned_resource.build_active_block_list(content: @resource.active_block_list.content, listable: cloned_resource)\n cloned_resource.tag_list = @resource.tag_list_on(@resource.tag_context)\n cloned_resource.slug = @resource.slug\n cloned_resource.status = :draft\n cloned_resource.published_at = nil\n end\n end",
"def set_ab_chapter\n @ab_chapter = AbChapter.find(params[:id])\n end",
"def write_book(title,num_pages)\n # THIS PARTICULAR author\n # self\n # WRITE A NEW book\n book = Book.new(title,self,num_pages)\n #code\n end",
"def initialize_copy(source)\n super\n @ob = OpenBabel::OBMol.new(source.ob)\n self\n end",
"def copy\n super || title\n end",
"def chapter_title\n self.part_title_by_type('Chapter')\n end",
"def private; end",
"def create\n \n @chapter = Chapter.create(chapter_params)\n @chapter.course_id = params[:course_id] \n @course = Course.find(@chapter.course_id)\n if @chapter.save\n flash[:success] = \"You created a new chapter, '#{ @chapter.title }' for course #{ @chapter.course_id }\"\n redirect_to admin_course_path(@chapter.course_id)\n else\n flash[:alert] = \"You could not create a new chapter. Please check the error messages.\"\n render :new\n end\n \n end",
"def changes_from_clone\n changes_from_document(clone_source, true)\n end",
"def chapter_params\n params.require(:chapter).permit(:position, :name, :number, :law_id)\n end",
"def initialize(history)\n\t\t@generations = history.generations\n\t\t@modifications = history.modifications\n\t\t@n = 0\n\t\t\n\t\tputs \"history.generations: \" + history.generations.to_s\n\t\tputs \"history.generations[0].word: \" + history.generations[0].word.to_s\n\t\tputs @generations.length\n\t\tputs \"index \" + @n.to_s + \" of a max \" + (@generations.length-1).to_s + \" (length \" + (@generations.length).to_s + \")\"\n\t\t# will instance variables with the same name have namespacing issues?\n\tend",
"def duplicate\n super do |cloned_resource|\n cloned_resource.title = \"Copy #{@resource.title}\"\n end\n end",
"def make_copy(company, fix_ref = true)\n #puts company\n dup = super(company)\n #dup.parent_project = project\n #dup = find_copied_or_make_copy(page_to_attach)\n #pb = AzPageAzProjectBlock.new\n #pb.az_project_block = dup\n #pb.az_page = page_to_attach\n #pb.az_project_block.parent_project = page_to_attach.az_base_project\n #pb.az_project_block.parent_project_id = page_to_attach.az_base_project_id\n #pb.save!\n #dup.az_page = page_to_attach\n\n dup.parent_project_id = nil\n\n commons = [AzCommonsFunctionality,\n AzCommonsRequirementsHosting]\n\n commons.each do |cmc|\n cms = eval(\"#{cmc.to_s.underscore.pluralize}\")\n cms.each do |cm|\n cm.make_copy_common(company, dup)\n end\n end\n\n dup.save!\n\n if fix_ref\n full_pages_list = dup.get_full_pages_list\n dup.fix_page_structure(full_pages_list)\n dup.fix_page_references(full_pages_list)\n end\n\n return dup\n end",
"def new\n chapter = biblebook.chapters.build\n locals chapter:\n end",
"def set_chapter\n @chapter = Chapter.find(params[:id])\n end",
"def initialize_copy(other)\n # self\n end",
"def initialize_copy(orig); end",
"def initialize_copy(orig); end",
"def initialize_copy(orig); end",
"def initialize_copy(orig); end",
"def initialize_copy(orig); end",
"def chapter_params\n params.require(:chapter).permit(:name, :number, :body, :creative_id)\n end",
"def p15\n\t\nend",
"def create\n if current_user.is?(\"ET\")\n @content = Content.find(params[:chapter][:subject_id])\n params[:chapter][:board_id] = @content.board_id\n params[:chapter][:content_year_id]= @content.content_year_id\n end\n @chapter = Chapter.new(params[:chapter])\n respond_to do |format|\n if @chapter.save\n if [\".pdf\",\".swf\",\".mp4\"].include?(File.extname(@chapter.assets.first.attachment_file_name))\n @chapter.update_attribute(:status,0)\n elsif @chapter.status == 1\n # extracting_zip_file(@chapter)\n # reading_and_updating_content(@extract_path)\n Content.send_message_to_est(false,current_user,@chapter)\n else\n true\n end\n format.html { redirect_to current_user.is?(\"ET\")? teacher_contents_path(@teacher) : @chapter, notice: 'Chapter was successfully created.' }\n format.json { render json: @chapter, status: :created, location: @chapter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @chapter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(title=\"TITLE\", pages=0)\n\t\t@title = title\n\t\t@pages = pages\n @@book_count += 1\n\tend",
"def cop; end",
"def cop; end"
] |
[
"0.7890258",
"0.6462407",
"0.621236",
"0.6099441",
"0.6005311",
"0.6005311",
"0.6005311",
"0.5979878",
"0.5948332",
"0.59145516",
"0.59145516",
"0.59145516",
"0.58370215",
"0.58052343",
"0.58052343",
"0.57945704",
"0.5776038",
"0.5721032",
"0.57147",
"0.57038325",
"0.56764686",
"0.56316394",
"0.56273806",
"0.55840635",
"0.5438691",
"0.5399391",
"0.5386602",
"0.5386056",
"0.5382083",
"0.5381233",
"0.5367083",
"0.5358698",
"0.5345187",
"0.5315731",
"0.5314487",
"0.5289174",
"0.52813405",
"0.5277834",
"0.52655566",
"0.5261878",
"0.5259039",
"0.524595",
"0.52394265",
"0.52389914",
"0.52253795",
"0.5223541",
"0.522206",
"0.52150476",
"0.52028304",
"0.5194925",
"0.51944757",
"0.5181429",
"0.5166337",
"0.51618487",
"0.5153869",
"0.5153657",
"0.515173",
"0.5149516",
"0.514566",
"0.5143743",
"0.51419574",
"0.5141593",
"0.51281536",
"0.5123795",
"0.5118594",
"0.5113775",
"0.5113226",
"0.5111771",
"0.51101923",
"0.510336",
"0.5102855",
"0.50919336",
"0.5088",
"0.5086176",
"0.50843364",
"0.5080456",
"0.50779337",
"0.50766385",
"0.5062981",
"0.5060576",
"0.5060063",
"0.5055336",
"0.5051178",
"0.50505096",
"0.5044981",
"0.5042052",
"0.5036143",
"0.5033994",
"0.5032588",
"0.5031665",
"0.5031665",
"0.5031665",
"0.5031665",
"0.5031665",
"0.5025745",
"0.5019912",
"0.5008508",
"0.5008392",
"0.50064814",
"0.50064814"
] |
0.7693855
|
1
|
gets all the exercises in one module
|
def get_exercises_list
exercises_list = []
inst_sections.each do |inst_section|
exercises_ids = inst_section.inst_book_section_exercises.collect(&:inst_exercise_id).compact
exercises_objs = InstExercise.where(id: exercises_ids)
exercises_list.concat exercises_objs.collect(&:short_name)
end
return exercises_list
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_bk_sec_exercises()\n InstBookSectionExercise.includes(:inst_exercise)\n .joins(:inst_section)\n .where(inst_sections: {inst_chapter_module_id: self.id})\n end",
"def index\n @programme_exercises = ProgrammeExercise.all\n end",
"def index\n @api_v1_exercises = Api::V1::Exercise.all\n end",
"def exercises\n ids = self.exercise_records.pluck(:exercise_id)\n Exercise.where(id: ids)\n end",
"def index\n @user = User.find(params[:user_id])\n @exercises = @user.exercises.all\n end",
"def show\n @exercises = Exercise.all\n @workout_routines = WorkoutRoutine.all\n end",
"def index\n @epitech_modules = EpitechModule.all.includes(:semesters, :courses, :schools)\n end",
"def fetch_type name\n exercises = []\n data.exercises.each do |exe|\n if exe.target === name\n exercises.push(exe.name)\n end\n end\n exercises\n end",
"def exploits\n\t\treturn module_sets[MODULE_EXPLOIT]\n\tend",
"def index\n @workout_routines = WorkoutRoutine.all\n @exercises = Exercise.all\n end",
"def index\n @oncourse_exercises = OncourseExercise.all\n\n\n\n end",
"def index\n @user = User.find(current_user.id)\n @exercises = Exercise.all\n end",
"def get_tests\n t = []\n\n defmod = Module.new{self.name='default'}\n\n selection = [@selection].flatten ; selection = [defmod] if selection.empty?\n crossover = [@crossover].flatten ; crossover = [defmod] if crossover.empty?\n mutator = [@mutator].flatten ; mutator = [defmod] if mutator.empty?\n\n selection.each{|s|\n crossover.each{|c| \n mutator.each{|m|\n t << [s,c,m]\n }\n }\n }\n t\n end",
"def examples\n @examples\n end",
"def index\n @exercises = Exercise.where(is_public: true)\n end",
"def tests\n @tests.ordered_example_groups\n end",
"def list_experiments\n @interface.list_experiments\n end",
"def index\n @exercises = Exercise.where(published: true).all\n @user_exercises = current_user.exercises.all\n \n end",
"def index\n @exercise_names = ExerciseName.all\n end",
"def exercices\n @exercices ||= begin\n lignes_exercices.collect do |ligne_ex|\n ExerciceFingers::new ligne_ex.strip\n end\n end\n end",
"def get_exercise_progresses(user_id)\n OdsaExerciseProgress.joins(inst_book_section_exercise: [:inst_section])\n .where(inst_sections: {inst_chapter_module_id: self.id}, user_id: user_id)\n end",
"def index\n @exercises = Exercise.search(params)\n # @exercises = Kaminari.paginate_array(@exercises).page(params[:exercise_page]).per(PER_PAGE_RECORDS)\n end",
"def exercise_instances\n Workout.all.select{|workout_instance| workout_instance.gym_id == self.id}\n end",
"def tests\n @tests ||= begin\n require \"m/test_collection\"\n require \"m/test_method\"\n # With each suite and array of tests,\n # and with each test method present in this test file,\n # shove a new test method into this collection.\n suites.each_with_object TestCollection.new do |(suite_class, test_methods), collection|\n test_methods.each do |test_method|\n collection << TestMethod.create(suite_class, test_method)\n end\n end\n end\n end",
"def ordre_exercices\n return [] if data_exercices.nil?\n data_exercices[:ordre] || []\n end",
"def examples\n @examples ||= []\n end",
"def test_methods()\n tests = []\n stack = [@contexts.first]\n until stack.empty? do\n item = stack.pop\n stack += item.tests_and_subcontexts.reverse if item.is_a?(Context)\n tests << item if item.is_a?(String)\n end\n tests\n end",
"def show\n @exercises = @programme.exercises\n if params[:search]\n @search = Exercise.search do\n fulltext params[:search]\n end\n @exSearch = @search.results\n else\n @exSearch = Exercise.all\n end\n end",
"def index\n @exercise_executions = ExerciseExecution.all\n end",
"def index\n @ects_modules = EctsModule.all\n end",
"def index\n @exercise_tasks = ExerciseTask.all\n end",
"def all\n load_paths.inject([]) do |all_scenarios, load_path|\n Dir[ File.join(load_path, '**', '*.rb') ].each do |found_scenario_file|\n all_scenarios << EolScenario.new(found_scenario_file)\n end\n all_scenarios\n end\n end",
"def examples\n @examples ||= HappinessExercises::Example.new\nend",
"def index\n @rand_exams = Xmt::Test::RandExam.all\n end",
"def index\n @testsuites = Testsuite.all\n end",
"def index\n @exam_sets = ExamSet.all\n end",
"def modules\n all(QTest::Module, project: @id)\n end",
"def index\n @exapmles = Exapmle.all\n end",
"def modules; end",
"def modules; end",
"def modules; end",
"def getTests\n\t\t\ttests = Array.new\n\t\t\t@language.each do |test,data|\n\t\t\t\ttests << test\n\t\t\tend\n\n\t\t\treturn tests\n\t\tend",
"def test_suites\n all(QTest::TestSuite, project: @project.id, test_cycle: @id)\n end",
"def examples\n parsed {\n @examples\n }\n end",
"def moduleList()\n res = \"\"\n leader = \" \"\n begin\n Dir.foreach($opdir) do |name|\n next unless name =~ /(.*)\\.rb$/\n require File.join(\"ri/op\", $1)\n klass = eval $1\n modDesc = klass::desc\n res << leader << $1 << \": \" << modDesc << \"\\n\"\n end\n rescue\n puts $!\n res = leader + \"no modules found...\"\n end\n res\nend",
"def find_examples(node)\n return [] if scope_change?(node)\n\n if example?(node)\n [node]\n else\n examples_in_scope(node)\n end\n end",
"def index\n @lesson_entrysets = LessonEntryset.root.descendants\n end",
"def siblings\n self.drill.exercises.sort\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end",
"def index\n @experiments = Experiment.all\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def index\n @exerciseoverviews = Exerciseoverview.all\n end",
"def completed_tests()\n test_array = []\n self.problems.each do |problem|\n problem.tests.each do |test|\n test_array.push(test)\n end\n end\n test_array\n end",
"def suites\n # Since we're not using `ruby -Itest -Ilib` to run the tests, we need to add this directory to the `LOAD_PATH`\n $LOAD_PATH.unshift \"./test\", \"./spec\", \"./lib\"\n\n begin\n # Fire up this Ruby file. Let's hope it actually has tests.\n require \"./#{testable.file}\"\n rescue LoadError => e\n # Fail with a happier error message instead of spitting out a backtrace from this gem\n warn \"Failed loading test file:\\n#{e.message}\"\n return []\n end\n\n suites = runner.suites\n\n # Use some janky internal APIs to group test methods by test suite.\n suites.each_with_object({}) do |suite_class, test_suites|\n # End up with a hash of suite class name to an array of test methods, so we can later find them and ignore empty test suites\n test_suites[suite_class] = runner.test_methods(suite_class) if runner.test_methods(suite_class).any?\n end\n end",
"def get_test_courses\n return [get_courses_in_page('https://www.sis.hawaii.edu/uhdad/avail.classes?i=MAN&t=201430&s=ICS'),\n get_courses_in_page('https://www.sis.hawaii.edu/uhdad/avail.classes?i=MAN&t=201430&s=MATH'),\n get_courses_in_page('https://www.sis.hawaii.edu/uhdad/avail.classes?i=MAN&t=201430&s=PSY')]\n end",
"def show\n\tset_exercise\n end",
"def tests_suites\n @tests_suites.keys.sort\n end",
"def get_tutorials\n Story.published.commoners_voice.select do |s|\n %w(tutorial howto).all? {|t| s.tags.pluck(:name).include?(t)}\n end.first(3)\n end",
"def get_all_synthetics_tests\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/synthetics/tests\", nil, nil, false)\n end",
"def show\n @projects = @setting.experiments.collect { |experiment| experiment.project }.uniq\n end",
"def index\n @exercise = Exercise.find(params[:exercise_id])\n load_course\n\n if @course.has_teacher(current_user)\n @available_groups = Group.where('course_instance_id=?', @course_instance.id).joins(:users).order(:name).all.select { |group| group.users.size <= @exercise.groupsizemax }\n else\n @available_groups = Group.where('course_instance_id=? AND user_id=?', @course_instance.id, current_user.id).joins(:users).order(:name).all.select { |group| group.users.size <= @exercise.groupsizemax }\n end\n end",
"def index\n @project = find_project\n @project_demos = @project.demos\n end",
"def index\n @exercises = current_company.exercises.all\n flash[:notice] = t('flash.actions.index.notice') if @exercises.empty?\n respond_with(@exercises)\n end",
"def index\n @exercises = Exercise.all\n @user = current_user # changed get logged user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def index\n \n # generate store entities.\n @store_entities = generate_store_entities\n \n # Load words for each quiz.\n @store_entities.each do |entity_name_quizzes|\n load_words_for_quizzes(entity_name_quizzes[:quizzes])\n end\n \n end",
"def folder_exercices\n @folder_exercices ||= File.join( folder, 'exercice' )\n end",
"def auxiliary\n\t\treturn module_sets[MODULE_AUX]\n\tend",
"def show\n set_exercise\n \n end",
"def index\n @examquestions = Examquestion.all\n end",
"def modules\n @modules.values\n end",
"def modules\n @modules.values\n end",
"def section_contents\n used_sections = {}\n\n each_method do |method|\n next unless method.display?\n\n used_sections[method.section] = true\n end\n\n # order found sections\n sections = sort_sections.select do |section|\n used_sections[section]\n end\n\n # only the default section is used\n return [] if\n sections.length == 1 and not sections.first.title\n\n sections\n end",
"def index\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_cases = @test_suite.test_cases\n end",
"def index\n @experiments = Experiment.all.order(:project_id)\n end",
"def get_exam_sections(user_id, course_id, exam_id)\r\n get(Path::USERS_COURSES_EXAMS_SECTIONS % [user_id, course_id, exam_id])\r\n end",
"def section_exemples habswork\n habswork[:exemples] != nil || (return '')\n (\n 'Exemples'.in_span(class: 'libelle') +\n habswork[:exemples].as_id_list.collect do |eid|\n \"Exemple n°#{eid}\".in_a(href:\"unanunscript/exemples/#{eid}\", target:'_exemple_work_').in_span\n end.join.in_div(class: 'contents')\n ).in_div(class:'section_exemples infos_sup')\n end",
"def setup\n print_status \"Collecting local exploits for #{session.session_type}...\"\n # Initializes an array\n @local_exploits = []\n # Collects exploits into an array\n framework.exploits.each do |name, _obj|\n mod = framework.exploits.create name\n next unless mod\n set_module_options mod\n next unless is_module_wanted? mod\n @local_exploits << mod\n end\n end",
"def index\n @exercise_types_in_users = ExerciseTypesInUser.all\n end",
"def index\n @tutorial_sections = TutorialSection.all\n end",
"def chapters_with_problems\n get_chapters.inject Hash.new do |chapters_with_sections,chapter|\n challenges = Dir[\"ch#{chapter}/challenge/*\"]\n chapters_with_sections[chapter] = challenges.map { |challenge| challenge[%r([^/]+?$)].to_i }.sort\n chapters_with_sections\n end\nend",
"def index\n @performed_exercises = PerformedExercise.all.order(done_on: :desc)\n end",
"def index\n @introexams = Introexam.all\n end",
"def index\n @exercise_types = ExerciseType.all.order(id: :asc)\n end",
"def all_works\n result = []\n for exp in (happening_expressions+presented_expressions).flatten.uniq\n # result << exp.work\n logger.debug \"CLASS:#{exp.work.class}\"\n result = result + [exp.work]\n end\n \n \n result.flatten.uniq.sort_by{|w|[w.work_title.downcase]}\n\n end",
"def templates\n Dir.glob(::Webby.path('examples') / '*').sort\n end",
"def index\n @do_exercises = DoExercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @do_exercises }\n end\n end",
"def explore\n end",
"def explore\n end",
"def explore\n end",
"def explore\n end",
"def explore\n end",
"def get_exhibitions\n Exhibition.all.where(\"artist_id = ?\", self.id)\n end",
"def load_helps\n log :debug, \"Load_helps: getting all help files.\"\n\n hfiles = File.join(\"data/help\", \"*.yml\")\n\n Dir.glob(hfiles).each do |a_file|\n help = Help.new()\n help.load_from_file(a_file) # loads each help file.\n help.text.gsub!(/\\n/, \"\\r\\n\")\n $help_list << help\n case help.keyword\n when \"GREETING\" \n $greeting = help.text\n log :debug, \"Greeting loaded.\"\n when \"MOTD\"\n $motd = help.text\n log :debug, \"MOTD loaded.\"\n end\n\n end \nend",
"def view_all(db, user_id)\n results = db.execute(\"SELECT exercises.name, exercises_users.reps, exercises_users.weight \n FROM users \n JOIN exercises_users ON users.id = exercises_users.user_id \n JOIN exercises ON exercises_users.exercise_id = exercises.id WHERE users.id = ?\", [user_id])\n results.each do |info_array|\n puts \"#{info_array[0]}:\\t #{info_array[1]} reps\\t #{info_array[2]} pounds\"\n end\nend",
"def lignes_exercices\n @lignes_exercices ||= File.read(fingerings_path).split(\"\\n\")\n end",
"def generate_dummy_data_for_presentation(pt1,user)\n\n#generate the exercises:\n# For the legs session type\n legs1 = Exercise.new(\"Full Squat\", \"Legs\", true, 10, 5, 1.2,4,3) \n legs2 = Exercise.new(\"Barbell Lunge\", \"Legs\", false, 15, 5, 1.1,4,2) \n legs3 = Exercise.new(\"Deadlift\", \"Legs\", true, 15, 5, 1.3,2,4) \n legs4 = Exercise.new(\"Leg Press\", \"Legs\", false, 20, 5, 1.25,6,5) \n legs5 = Exercise.new(\"Ham String Curl\", \"Legs\", true, 12, 5, 1.15,4,4) \n # For the Biceps, Triceps, Forearms and Abs (aka BTFA) session type \n btfa1 = Exercise.new(\"Bicep Curls\", \"BTFA\",true, 10, 5, 1.2,4,3) \n btfa2 = Exercise.new(\"Shoulder Press\", \"BTFA\", false, 10, 5, 1.2,4,3) \n btfa3 = Exercise.new(\"Bench Press\", \"BTFA\", true, 10, 5, 1.2,4,3) \n btfa4 = Exercise.new(\"Triceps Extension\", \"BTFA\", false, 10, 5, 1.2,4,3) \n btfa5 = Exercise.new(\"Sit Up\", \"BTFA\", true, 10, 5, 1.2,4,3) \n # For the Shoulders and Traps session type\n shoulders_traps1 = Exercise.new(\"Dumbell Shoulder Press\", \"Shoulders and Traps\",true, 10, 5, 1.2,4,3) \n shoulders_traps2 = Exercise.new(\"Upright Barbell Row\", \"Shoulders and Traps\", false, 10, 5, 1.2,4,3) \n shoulders_traps3 = Exercise.new(\"Seated Bent-over Rear Delt Raise\", \"Shoulders and Traps\", true, 10, 5, 1.2,4,3) \n shoulders_traps4 = Exercise.new(\"Side Lateral Raise\", \"Shoulders and Traps\", false, 10, 5, 1.2,4,3) \n shoulders_traps5 = Exercise.new(\"Barbell Shrug\", \"Shoulders and Traps\", true, 10, 5, 1.2,4,3) \n # For the Back session type\n back1 = Exercise.new(\"Barbell Deadlift\", \"Back\", true, 10, 5, 1.2,4,3) \n back2 = Exercise.new(\"Wide-Grip Pull Up\", \"Back\", false, 10, 5, 1.2,4,3) \n back3 = Exercise.new(\"Bent-Over Barbell Deadlift\", \"Back\", true, 10, 5, 1.2,4,3) \n back4 = Exercise.new(\"Standing T-Bar Row\", \"Back\", false, 10, 5, 1.2,4,3) \n # For the Chest session type\n chest1 = Exercise.new(\"Barbell Bench Press\", \"Chest\", true, 10, 5, 1.2,4,3) \n chest2 = Exercise.new(\"Flat Bench Dumbbell Press\", \"Chest\", false, 10, 5, 1.2,4,3) \n chest3 = Exercise.new(\"Seated Machine Chest Press\", \"Chest\", true, 10, 5, 1.2,4,3) \n chest4 = Exercise.new(\"Incline Dumbbell Press\", \"Chest\", false, 10, 5, 1.2,4,3) \n chest5 = Exercise.new(\"Machine Decline Press\", \"Chest\", true, 10, 5, 1.2,4,3) \n\n# add exercises to the PT object so that it's aware of them\n pt1.add_exercises(legs1)\n pt1.add_exercises(legs2)\n pt1.add_exercises(legs3)\n pt1.add_exercises(legs4)\n pt1.add_exercises(legs5)\n pt1.add_exercises(btfa1)\n pt1.add_exercises(btfa2)\n pt1.add_exercises(btfa3)\n pt1.add_exercises(btfa4)\n pt1.add_exercises(btfa5)\n pt1.add_exercises(shoulders_traps1)\n pt1.add_exercises(shoulders_traps2)\n pt1.add_exercises(shoulders_traps3)\n pt1.add_exercises(shoulders_traps4)\n pt1.add_exercises(shoulders_traps5)\n pt1.add_exercises(back1)\n pt1.add_exercises(back2)\n pt1.add_exercises(back3)\n pt1.add_exercises(back4)\n pt1.add_exercises(chest1)\n pt1.add_exercises(chest2)\n pt1.add_exercises(chest3)\n pt1.add_exercises(chest4)\n pt1.add_exercises(chest5)\n\n\n # establish id for user\n user.username = \"jim\"\n user.password = \"password\"\n user.first_name = \"Jimmy\"\n user.last_name = \"Coder\"\n user.gender = \"Male\"\n user.body_type = \"Mesomorph\"\n user.goal = \"musclebuild\"\n user.disclaimer = \"accept\"\n user.date_of_birth = Date.new(1990,9,9)\n # binding.pry\n user.weight = 56\n user.goal_weight = 75\n\n#establish some dummy workout history for our user:\n # (weight, completed_reps, exercise_performed, duration, date, session_number, session_type)\n workout_history_for_user = ExerciseInput.new(10, 8, chest1.name, 10, Date.new(2017,8,1), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(10, 9, chest1.name, 10, Date.new(2017,8,1), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(10, 10, chest1.name, 10, Date.new(2017,8,1), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(10, 11, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 9, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 9, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 5, chest1.name, 10, Date.new(2017,8,5), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,6), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(20, 8, chest1.name, 10, Date.new(2017,8,7), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(20, 10, chest1.name, 10, Date.new(2017,8,8), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 7, chest1.name, 10, Date.new(2017,8,9), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 8, chest1.name, 10, Date.new(2017,8,10), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 9, chest1.name, 10, Date.new(2017,8,11), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 10, chest1.name, 10, Date.new(2017,8,12), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n\n\nend",
"def all_example_groups\n strategy.example_groups\n end",
"def test_cases\n @test_cases ||= Dir.glob(model.spec_dir + '**/**/?*Spec.as')\n end",
"def index\n @ezii_robot_experiments = EziiRobotExperiment.all\n end"
] |
[
"0.68270224",
"0.63926715",
"0.63837355",
"0.6327996",
"0.6315433",
"0.6277688",
"0.62363505",
"0.6235913",
"0.6233418",
"0.62311316",
"0.617177",
"0.5988263",
"0.5979324",
"0.58786833",
"0.58611494",
"0.57945496",
"0.57819676",
"0.57789344",
"0.57742757",
"0.573673",
"0.5695414",
"0.5694435",
"0.5654327",
"0.5623644",
"0.5623628",
"0.5585323",
"0.5521444",
"0.5514038",
"0.5512241",
"0.55106324",
"0.5492426",
"0.54903895",
"0.54802865",
"0.54371625",
"0.54351854",
"0.542481",
"0.5388301",
"0.5359235",
"0.5351783",
"0.5351783",
"0.5351783",
"0.53487605",
"0.5348674",
"0.5346467",
"0.5342515",
"0.53388244",
"0.5311264",
"0.5310458",
"0.52979195",
"0.5296226",
"0.5286362",
"0.5286362",
"0.525299",
"0.52488655",
"0.52482873",
"0.5241286",
"0.52394736",
"0.5239404",
"0.5236629",
"0.523591",
"0.5232339",
"0.5227914",
"0.5217854",
"0.5217472",
"0.5215785",
"0.52143395",
"0.5211024",
"0.52104926",
"0.5197265",
"0.51965076",
"0.5183677",
"0.5183677",
"0.5179855",
"0.5178222",
"0.5172205",
"0.51645976",
"0.5158552",
"0.5156482",
"0.51563895",
"0.51526934",
"0.51508504",
"0.51485664",
"0.5147775",
"0.5143899",
"0.5140796",
"0.51188016",
"0.51138806",
"0.5113105",
"0.5113105",
"0.5113105",
"0.5113105",
"0.5113105",
"0.51103497",
"0.5110163",
"0.51064205",
"0.51043236",
"0.5095287",
"0.50922537",
"0.50910866",
"0.5090349"
] |
0.74532676
|
0
|
get all of the inst_book_section_exercise instances associated with this module
|
def get_bk_sec_exercises()
InstBookSectionExercise.includes(:inst_exercise)
.joins(:inst_section)
.where(inst_sections: {inst_chapter_module_id: self.id})
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_exercises_list\n exercises_list = []\n inst_sections.each do |inst_section|\n exercises_ids = inst_section.inst_book_section_exercises.collect(&:inst_exercise_id).compact\n exercises_objs = InstExercise.where(id: exercises_ids)\n exercises_list.concat exercises_objs.collect(&:short_name)\n end\n return exercises_list\n end",
"def section_exemples habswork\n habswork[:exemples] != nil || (return '')\n (\n 'Exemples'.in_span(class: 'libelle') +\n habswork[:exemples].as_id_list.collect do |eid|\n \"Exemple n°#{eid}\".in_a(href:\"unanunscript/exemples/#{eid}\", target:'_exemple_work_').in_span\n end.join.in_div(class: 'contents')\n ).in_div(class:'section_exemples infos_sup')\n end",
"def exercises\n ids = self.exercise_records.pluck(:exercise_id)\n Exercise.where(id: ids)\n end",
"def sections\n @sections ||= context\n .public_methods\n .grep(/\\A(?!wait_)\\w+_section$\\z/)\n .map { |el| Meta::Section.new(el.to_s.gsub('_section', ''), context) }\n end",
"def get_exercise_progresses(user_id)\n OdsaExerciseProgress.joins(inst_book_section_exercise: [:inst_section])\n .where(inst_sections: {inst_chapter_module_id: self.id}, user_id: user_id)\n end",
"def sections\n return @sections\n end",
"def show\n @exercises = Exercise.all\n @workout_routines = WorkoutRoutine.all\n end",
"def exercices\n @exercices ||= begin\n lignes_exercices.collect do |ligne_ex|\n ExerciceFingers::new ligne_ex.strip\n end\n end\n end",
"def index\n @oncourse_exercises = OncourseExercise.all\n\n\n\n end",
"def index\n @workout_routines = WorkoutRoutine.all\n @exercises = Exercise.all\n end",
"def sections\n temp_sections = []\n if @section_ids.count > 0\n @section_ids.each do |section_id|\n temp_sections.push @client.section(@org_id, section_id)\n end\n end\n return temp_sections\n end",
"def recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end",
"def exercise_instances\n Workout.all.select{|workout_instance| workout_instance.gym_id == self.id}\n end",
"def index\n @programme_exercises = ProgrammeExercise.all\n end",
"def index\n @exercise_tasks = ExerciseTask.all\n end",
"def sections\n @sections.values\n end",
"def exercise_classes\n sql = \"SELECT exercise_classes.* FROM exercise_classes INNER JOIN booking_infos ON exercise_classes.id = booking_infos.exercise_class_id WHERE member_id = $1;\"\n values = [@id]\n results = SqlRunner.run(sql, values)\n return results.map {|exercise_class| ExerciseClass.new(exercise_class)}\n end",
"def index\n @api_v1_exercises = Api::V1::Exercise.all\n end",
"def index\n @user = User.find(params[:user_id])\n @exercises = @user.exercises.all\n end",
"def get_exhibitions\n Exhibition.all.where(\"artist_id = ?\", self.id)\n end",
"def index\n @user = User.find(current_user.id)\n @exercises = Exercise.all\n end",
"def sections\n @section_ids.collect { |idx| BSection.store[idx] }\n end",
"def section_contents\n used_sections = {}\n\n each_method do |method|\n next unless method.display?\n\n used_sections[method.section] = true\n end\n\n # order found sections\n sections = sort_sections.select do |section|\n used_sections[section]\n end\n\n # only the default section is used\n return [] if\n sections.length == 1 and not sections.first.title\n\n sections\n end",
"def index\n @epitech_modules = EpitechModule.all.includes(:semesters, :courses, :schools)\n end",
"def sections\n self.entries.select { |e| e.is_a?(ListSection) }\n end",
"def sections\n @blocks.inject([]) {|collector, block|\n collector << block if block.is_a?(Section)\n collector\n }\n end",
"def index\n @section_instructors = SectionInstructor.all\n end",
"def clone(inst_book, inst_section)\n book_section_exercise = InstBookSectionExercise.new\n book_section_exercise.inst_section_id = inst_section.id\n book_section_exercise.inst_book_id = inst_book.id\n book_section_exercise.inst_exercise_id = self.inst_exercise_id\n book_section_exercise.points = self.points\n book_section_exercise.required = self.required\n book_section_exercise.threshold = self.threshold\n book_section_exercise.options = self.options\n book_section_exercise.save\n end",
"def show\n @sections = @course.sections.all.to_a\n end",
"def index\n @section_rows = SectionRow.all\n end",
"def sections\n result = @nsx_client.get(@url_sections)\n result['results']\n end",
"def index\n @exercise_names = ExerciseName.all\n end",
"def examples\n @examples\n end",
"def get_exam_sections(user_id, course_id, exam_id)\r\n get(Path::USERS_COURSES_EXAMS_SECTIONS % [user_id, course_id, exam_id])\r\n end",
"def index\n @exercise_executions = ExerciseExecution.all\n end",
"def examples\n @examples ||= HappinessExercises::Example.new\nend",
"def sections\n parsed {\n @sections\n }\n end",
"def section_list_for record\n tags_for_context_and_taggable(context: :sections, taggable: record)\n end",
"def index\n @exercises = Exercise.where(published: true).all\n @user_exercises = current_user.exercises.all\n \n end",
"def index\n @tutorial_sections = TutorialSection.all\n end",
"def sections\n @data.keys\n end",
"def sections\n @sections ||= @account.sections\n end",
"def course_sections\n ['1', '2']\n end",
"def index\n @exercises = Exercise.search(params)\n # @exercises = Kaminari.paginate_array(@exercises).page(params[:exercise_page]).per(PER_PAGE_RECORDS)\n end",
"def index\n @exerciseoverviews = Exerciseoverview.all\n end",
"def sections\n children.select { |child| child.is_a? DocumentSection }\n end",
"def sections\n @pages.collect { |p| p.sections }.flatten\n end",
"def scenarios\n return @scenarios\n end",
"def index\n @book_exemplars = BookExemplar.all\n end",
"def show\n p exercise_id = params[:exercise_id]\n p @exercise = Exercise.find(exercise_id)\n p @texts = Text.where(exercise_id: @exercise.id)\n p @inputs = Input.where(exercise_id: @exercise.id)\n end",
"def examples\n @examples ||= []\n end",
"def get_exam_section_questions(user_id, course_id, exam_id, section_id)\r\n relative_url = Path::USERS_COURSES_EXAMS_SECTIONS_QUESTIONS % [user_id,\r\n course_id, exam_id, section_id]\r\n response = get(relative_url)\r\n if !response.error?\r\n json_obj = JSON::parse(response.content)\r\n questions = json_obj['questions'] || []\r\n section_questions = []\r\n questions.each do |question|\r\n question_type = question['type']\r\n question_id = question['id']\r\n question_response = get_exam_section_question(user_id, course_id,\r\n exam_id, section_id,\r\n question_type, question_id)\r\n return question_response if question_response.error?\r\n\r\n section_question = JSON.parse(question_response.content)\r\n\t\t section_question['id'] = question_id\r\n section_question['type'] = question_type\t\t \r\n\t\t section_question['pointsPossible'] = question['pointsPossible']\r\n section_questions << section_question\r\n end\r\n\r\n response.content = { 'questions' => section_questions }.to_json\r\n end\r\n\r\n response\r\n end",
"def section_ids\n sections.map { |co| co.id }\n end",
"def exhibitions\n @bio.fetch('Exhibitions')\n end",
"def extrait_titems ; @extrait_titems end",
"def section\n section_test.section\n end",
"def sections(project_id, suite_id)\n get(\"get_sections/#{project_id}&suite_id=#{suite_id}\")\n end",
"def index\n @exercise_types_in_users = ExerciseTypesInUser.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @sections = Section.all\n end",
"def index\n @exercise_modifications = ExerciseModification.all\n end",
"def subsections\n return suite.sections.select do |sect|\n sect.parent_id == data.id\n end\n end",
"def relatedQuestions(section)\n relQuestions = []\n \n questions = sectionQuestions(pretest())\n questions.each do |question|\n question.getActivityReferences.getVector.each do |reference|\n if section.equals(reference.getReferencedObject)\n relQuestions << question\n break\n end\n end\n end\n \n relQuestions\n end",
"def ordre_exercices\n return [] if data_exercices.nil?\n data_exercices[:ordre] || []\n end",
"def sectionQuestionsForIds(section, otids)\n questions = []\n \n return questions unless section.content.is_a? org.concord.otrunk.ui.OTCardContainer\n \t\t\t\t\n return sectionQuestions(section) if otids.empty? \n \n pageCards = allPages(section)\n\n pageCards.each do | doc |\n questions.concat documentQuestionsForIds(doc, otids)\n end\n\n questions\nend",
"def sectionQuestionsForIds(section, otids)\n questions = []\n \n return questions unless section.content.is_a? org.concord.otrunk.ui.OTCardContainer\n \n return sectionQuestions(section) if otids.empty? \n \n pageCards = allPages(section)\n \n pageCards.each do | doc |\n questions.concat documentQuestionsForIds(doc, otids)\n end\n \n questions\n end",
"def sections_for( page )\n titles_for( page ).zip( tables_for( page ) )\n end",
"def index\n #@sections = Section.find(params[:course_id])\n #@sections = Section.all\n end",
"def educations\r\n @education_levels = Education.find(:all)\r\n end",
"def subsections\n Section.where(parent_id: id)\n end",
"def all\n return @recipearray\n end",
"def talks\n @talks ||= Talk.all.select { |t| t.edition_id == self.id }\n end",
"def index\n @exhibition = Exhibition.find(params[:exhibition_id])\n @exhibition_informations = @exhibition.exhibition_informations\n end",
"def section\n BSection.store[@section_id]\n end",
"def about_section_E\n OpenStruct.new(\n :header => \"About section E\",\n :context => [\n \"The environmental, social, and corporate governance (ESG) section is an opportunity for you to highlight your responsible business conduct and its impact within your organisation, supply chain and the wider community.\",\n \"We expect all King's Award for Enterprise applicants to adhere to commonly accepted standards for environmentally and socially responsible corporate governance. Failure to demonstrate that will result in your application not being successful.\"\n ]\n )\n end",
"def show\n set_exercise\n \n end",
"def initialize()\n @exercise_list = Array.new\n @workout_routines = Array.new\n end",
"def all\n load_paths.inject([]) do |all_scenarios, load_path|\n Dir[ File.join(load_path, '**', '*.rb') ].each do |found_scenario_file|\n all_scenarios << EolScenario.new(found_scenario_file)\n end\n all_scenarios\n end\n end",
"def set_exercise\n @exercise = Exercise.find(params[:id])\n end",
"def set_exercise\n @exercise = Exercise.find(params[:id])\n end",
"def parse_examples(section, sections)\n examples = []\n\n section = section.sub('Examples', '').strip\n\n examples << section unless section.empty?\n while sections.first && sections.first !~ /^\\S/\n lines = sections.shift.split(\"\\n\")\n examples << deindent(lines).join(\"\\n\")\n end\n\n @examples = examples\n end",
"def index\n @lab_sections = LabSection.all\n end",
"def editions\n works.map {|work| work.editions}.flatten.map\n end",
"def ingredients\n a = Array.new\n self.steps.each do |step|\n step.ingredients.each do |ing|\n a << ing\n end\n end\n a\n end",
"def index\n @exhibition = Exhibition.find(params[:exhibition_id])\n @pieces = @exhibition.pieces\n end",
"def sections\n @ini.keys\n end",
"def sections\n @ini.keys\n end",
"def get_recipes(section)\n # Example: https://terraria.gamepedia.com/index.php?title=Recipes/Iron_Anvil&action=raw\n @connection.get '/index.php', {\n 'title' => \"Recipes/#{section}\",\n 'action' => 'raw'\n }\n end",
"def set_exercise\n @exercise = Exercise.find(params[:id])\n end",
"def set_exercise\n @exercise = Exercise.find(params[:id])\n end",
"def set_exercise\n @exercise = Exercise.find(params[:id])\n end",
"def set_exercise\n @exercise = Exercise.find(params[:id])\n end",
"def set_exercise\n @exercise = Exercise.find(params[:id])\n end",
"def set_exercise\n @exercise = Exercise.find(params[:id])\n end",
"def set_exercise\n @exercise = Exercise.find(params[:id])\n end"
] |
[
"0.73905605",
"0.61486846",
"0.6032731",
"0.58753085",
"0.58352643",
"0.568193",
"0.56593484",
"0.5606959",
"0.5599002",
"0.5564633",
"0.55466497",
"0.55225277",
"0.5483004",
"0.54768443",
"0.54677606",
"0.5445167",
"0.54239225",
"0.540966",
"0.5392279",
"0.5383424",
"0.53695196",
"0.53679204",
"0.53549415",
"0.5291163",
"0.5285673",
"0.5266107",
"0.5261711",
"0.5261395",
"0.52578056",
"0.5239407",
"0.52297205",
"0.5214206",
"0.5200127",
"0.5180706",
"0.5179996",
"0.51519567",
"0.5135533",
"0.5131854",
"0.50825673",
"0.5073338",
"0.5065795",
"0.50455",
"0.5038704",
"0.5020375",
"0.500522",
"0.4985802",
"0.49834326",
"0.49745926",
"0.4972116",
"0.4970704",
"0.49646854",
"0.49627236",
"0.4950133",
"0.49479935",
"0.49333194",
"0.49310887",
"0.49212655",
"0.49209228",
"0.49064654",
"0.49064654",
"0.49064654",
"0.49064654",
"0.49064654",
"0.49064654",
"0.49064654",
"0.48959517",
"0.48933846",
"0.48878387",
"0.48712406",
"0.48691443",
"0.48597825",
"0.4859084",
"0.48441488",
"0.48439828",
"0.48337403",
"0.48326337",
"0.48319983",
"0.48287046",
"0.48283154",
"0.48254716",
"0.48213828",
"0.48170975",
"0.4813228",
"0.48109388",
"0.48109388",
"0.4808311",
"0.48056766",
"0.4804685",
"0.48040918",
"0.48035103",
"0.48032996",
"0.48032996",
"0.48032966",
"0.48031178",
"0.48031178",
"0.48031178",
"0.48031178",
"0.48031178",
"0.48031178",
"0.48031178"
] |
0.7846473
|
0
|
get all exercise progresses for the exercises in this module for the specified user
|
def get_exercise_progresses(user_id)
OdsaExerciseProgress.joins(inst_book_section_exercise: [:inst_section])
.where(inst_sections: {inst_chapter_module_id: self.id}, user_id: user_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @user = User.find(params[:user_id])\n @exercises = @user.exercises.all\n end",
"def index\n @user = User.find(current_user.id)\n @exercises = Exercise.all\n end",
"def get_exercises_list\n exercises_list = []\n inst_sections.each do |inst_section|\n exercises_ids = inst_section.inst_book_section_exercises.collect(&:inst_exercise_id).compact\n exercises_objs = InstExercise.where(id: exercises_ids)\n exercises_list.concat exercises_objs.collect(&:short_name)\n end\n return exercises_list\n end",
"def index\n @exercises = Exercise.where(published: true).all\n @user_exercises = current_user.exercises.all\n \n end",
"def index\n# @exercise_programs = ExerciseProgram.where('exercise_programs.user_id = ?', current_user.id).limit(10).offset(@page.to_i * 10)\n @exercise_programs = ExerciseProgram.for_page(@page, current_user)\n end",
"def index\n all_user = params[:user_id].nil?\n if !params[:user_id].nil? && params[:user_id].empty?\n all_user = true\n params[:user_id] = current_user.id\n end\n @task_progresses = TaskProgress.joins(:system_example)\n .select(\"system_examples.id, system_examples.is_for_training, task_progresses.id, task_progresses.user_id, \" +\n \"task_progresses.task_id, task_progresses.done\")\n .where(\"task_progresses.user_id = ? OR ?\", params[:user_id], all_user)\n .distinct.order(\"task_progresses.user_id, system_examples.is_for_training DESC, system_examples.id, task_progresses.id\")\n end",
"def show\n @exercises = Exercise.all\n @workout_routines = WorkoutRoutine.all\n end",
"def index\n @programme_exercises = ProgrammeExercise.all\n end",
"def get_bk_sec_exercises()\n InstBookSectionExercise.includes(:inst_exercise)\n .joins(:inst_section)\n .where(inst_sections: {inst_chapter_module_id: self.id})\n end",
"def gym_user_instances\n user_names = []\n self.exercise_instances.each do |user|\n user_names << User.all.find {|user_instance| user_instance.id == user.user_id}\n end\n user_names\n \n end",
"def exercises\n ids = self.exercise_records.pluck(:exercise_id)\n Exercise.where(id: ids)\n end",
"def project_evaluations\n ProjectEvaluation.where(user_id: @id)\n end",
"def index\n @exercises = Exercise.all\n @user = current_user # changed get logged user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def get_existing_exams(user_id, course_id)\r\n get(Path::USERS_COURSES_EXAMS % [user_id, course_id])\r\n end",
"def index_user\n p \"*\" * 50\n p \"index_user\"\n if current_user.status == \"teacher\" || current_user.admin?# && !current_user?(user)\n user_id = current_user.id\n @user = User.find(user_id)\n @exercises = Exercise.where(user_id: @user.id)\n elsif current_user.status == \"student\"\n redirect_to(current_user)\n end\n \n end",
"def index\n @workout_routines = WorkoutRoutine.all\n @exercises = Exercise.all\n end",
"def programs\n Program.all(:creator_username => username)\n end",
"def show\n @task = Task.find(params[:id])\n @exercises = (@task.visible_to_admin_only && !current_user.master?) ? [] : @task.exercises\n\n @exercise = if @task.finished?(current_user)\n Exercise.where(:user_id => current_user.id, :task_id => @task.id).first\n else\n Exercise.new(:date => Date.current, :task_id => @task.id, :user_id => current_user.id)\n end\n end",
"def participants\n users = self.users\n participants = []\n users.each do |user|\n participant = AssignmentParticipant.find_by(user_id: user.id, parent_id: parent_id)\n participants << participant unless participant.nil?\n end\n participants\n end",
"def get_exam_sections(user_id, course_id, exam_id)\r\n get(Path::USERS_COURSES_EXAMS_SECTIONS % [user_id, course_id, exam_id])\r\n end",
"def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end",
"def exercices\n @exercices ||= begin\n lignes_exercices.collect do |ligne_ex|\n ExerciceFingers::new ligne_ex.strip\n end\n end\n end",
"def exercise_on_a_day(date)\n #iterate through workouts and find workouts.user_id == self\n my_workouts = Workout.all.select do |workout|\n workout[\"user_id\"] == self[\"id\"]\n end\n # find where date == workout date\n workouts_for_date = my_workouts.find_all do |workouts|\n workouts[\"date\"] == date\n end.map {|workout_instance| workout_instance.exercise_id}\n \n exercise_array = []\n exercise_list = workouts_for_date.each do |exercise_id|\n Exercise.all.each do |exercise_instances|\n exercise_array << exercise_instances.name if (exercise_instances.id == exercise_id)\n end\n end\n \n if exercise_array == []\n return \"Sorry. Doesn't look like you worked out on #{date}.\".colorize(:light_cyan)\n else\n return exercise_array\n end\n end",
"def programs\n @programs = @sheet_obj.programs\n end",
"def index\n @exercises = Exercise.where(is_public: true)\n end",
"def steps_editable(user)\n # TODO: Improve efficiency! Way too many DB calls!\n self.workflow.step_flows.where(current_step_role: user.roles.first.name).collect(&:current_step)\n end",
"def get_exam_attempts(user_id, course_id, exam_id)\r\n get(Path::USERS_COURSES_EXAMS_ATTEMPTS % [user_id, course_id, exam_id])\r\n end",
"def index\n @exercise_types_in_users = ExerciseTypesInUser.all\n end",
"def fetch_type name\n exercises = []\n data.exercises.each do |exe|\n if exe.target === name\n exercises.push(exe.name)\n end\n end\n exercises\n end",
"def index\n @oncourse_exercises = OncourseExercise.all\n\n\n\n end",
"def index\n @exercise_executions = ExerciseExecution.all\n end",
"def get_all_exam_items(user_id, course_id)\r\n relative_url = Path::USERS_COURSES_ITEMS % [user_id, course_id]\r\n response = get(relative_url)\r\n if !response.error?\r\n course_items_json = response.content\r\n json_obj = JSON.parse(course_items_json)\r\n items = json_obj['items'] || []\r\n exams = []\r\n items.each do |item|\r\n links = item['links'] || []\r\n exams << links.select { |link| Relation::USER_COURSE_EXAM == link['rel'] }\r\n end\r\n exam_items = { \"items\" => exams }\r\n response.content = exam_items.to_json\r\n end\r\n response\r\n end",
"def index\n @activities = @user.activities.includes(:user, :intensity, :exercise_unit, :exercise_type).includes(:comments => [:user]).includes(:cheers => [:user]).order(:date).paginate(:page => params[:page])\n end",
"def index\n @exercise = Exercise.find(params[:exercise_id])\n load_course\n\n if @course.has_teacher(current_user)\n @available_groups = Group.where('course_instance_id=?', @course_instance.id).joins(:users).order(:name).all.select { |group| group.users.size <= @exercise.groupsizemax }\n else\n @available_groups = Group.where('course_instance_id=? AND user_id=?', @course_instance.id, current_user.id).joins(:users).order(:name).all.select { |group| group.users.size <= @exercise.groupsizemax }\n end\n end",
"def show_priorities(db, user_name)\n\tprint \"\\n\"\n\tp \"Upper Body Exercises\"\n\tp db.execute(\"SELECT * FROM upper_body WHERE user_id=?\", [user_name])\n\tprint \"\\n\"\n\tp \"Leg Exercises\"\n\tp db.execute(\"SELECT * FROM lower_body WHERE user_id=?\", [user_name])\n\tprint \"\\n\"\nend",
"def assignment_by_teacher(student_user)\n self.line_break\n puts \"Please select a teacher by typing out their full name below:\".colorize(:light_blue)\n self.all_teachers(student_user)\n self.line_break\n student_input = gets.chomp.titleize\n self.line_break\n if Teacher.find_by(name: student_input)\n puts \"Here are your assignments for Professor #{student_input}:\".colorize(:magenta)\n s = Student.find_by(name: student_user)\n t = Teacher.find_by(name: student_input)\n list = s.assignments.select do |assignment|\n assignment.teacher_id == t.id\n end\n list.each do |assignment|\n puts assignment.task\n end\n self.student_main_menu(student_user)\n else \n puts \"Invalid response!\".colorize(:yellow)\n self.assignment_by_teacher(student_user)\n end\n end",
"def find_users_have_completed_program(users: User.all, curricula: [LearningModules::FOOD_ETALK, LearningModules::BETTER_U], date_range: nil)\n completed_users = []\n users.each do |user|\n completed = user_has_completed_program?(user, curricula, date_range)\n completed_users << user if completed\n end\n return User.where(id: completed_users.map(&:id))\n end",
"def index\n @project_eulers = ProjectEuler.all\n end",
"def list_experiments\n @interface.list_experiments\n end",
"def index\n\tif (params.has_key?(:workout_id))\n\t\tset_workout\n\t\t@exercises = @workout.exercises.paginate(page: params[:page])\n\t\t\t\n\t\t#@exercises = current_user.exercises.find(params[:workout_exercises][:workout_id])\n\telse\n\t\t@exercises = current_user.exercises.paginate(page: params[:page])\n\tend\t\n\t\n end",
"def view_all(db, user_id)\n results = db.execute(\"SELECT exercises.name, exercises_users.reps, exercises_users.weight \n FROM users \n JOIN exercises_users ON users.id = exercises_users.user_id \n JOIN exercises ON exercises_users.exercise_id = exercises.id WHERE users.id = ?\", [user_id])\n results.each do |info_array|\n puts \"#{info_array[0]}:\\t #{info_array[1]} reps\\t #{info_array[2]} pounds\"\n end\nend",
"def workout_program(user)\n return workout_summary(user) if user.started?\n start_workout(user)\n end",
"def index\n # TODO: Find personal quests\n quests = UsersQuest.where(:assignor_id => @current_user.id).pluck(:quest_id)\n @quests = Quest.where(:id => quests).order('due_date')\n end",
"def index\n @user = current_user\n if @user.project_manager\n @tasks = Task.where(pm_id: @user.id)\n else\n @tasks = Task.where(collaborator_id: @user.id)\n end\n\n end",
"def index\n @resumes = current_user.resumes\n end",
"def index\n @exercise_tasks = ExerciseTask.all\n end",
"def load_programs\n if session[:user_id]\n @programs = Program.where(user_id: session[:user_id]).order('reward ASC')\n elsif params[:username] && params[:password]\n user = User.find_by_username(params[:username])\n\n if user && user.authenticate(params[:password])\n @programs = Program.where(user_id: user.id).order('reward ASC')\n end\n end\n end",
"def show_courses_instructing\n if is_professor?\n Course.where(user_id: self).order(:course_id)\n end\n end",
"def getActivitiesCohortSemester\n degreeProgs = Programme.all.pluck(:id)\n \n acts = []\n degreeProgs.each do |prgm|\n \n #Get the durations of activities that belong to the current programme\n actProgs = ActivityProgramme.where(programme_id: prgm).pluck(:activity_id)\n actstt = ActivityTimetable.where(activity_id: actProgs).pluck(:duration)\n \n #Add all durations to the sum\n sum = 0\n actstt.each do |time|\n unless time.nil?\n sum = sum + (time/60.0)\n end\n end\n \n #push the result\n progName = Programme.find(prgm).code\n acts.push([progName, sum]) \n\n end\n return acts\n end",
"def index\n @api_v1_exercises = Api::V1::Exercise.all\n end",
"def index\n @exhibits = Exhibit.added_by(current_admin_user).page(params[:page]).per(10)\n end",
"def my_peer_results(user)\n results = []\n (self.my_roles(user) - self.my_assigned_roles(user)).each do |role|\n results << self.design_review_results.detect { |drr| drr.role == role }\n end\n results\n end",
"def hpt\n @checklists = Checklist.get_checklist_entries(current_user).get_pending_tasks.get_high_priority_tasks.paginate(page: params[:page])\n end",
"def index\n @weekend_programmes = WeekendProgramme.future_by_date_ascending\n @past_programmes = WeekendProgramme.past_programmes\n @cancelled_programmes = WeekendProgramme.cancelled\n end",
"def index\n @exercises = Exercise.search(params)\n # @exercises = Kaminari.paginate_array(@exercises).page(params[:exercise_page]).per(PER_PAGE_RECORDS)\n end",
"def index\n @exercise_names = ExerciseName.all\n end",
"def view_info(db, user_id)\n puts \"Which exercise would you like to view?\"\n exercise = gets.chomp\n until is_existing_exercise(db, exercise) do\n puts \"Invalid exercise. Please retry.\"\n exercise = gets.chomp\n end\n\n results = db.execute(\"SELECT * FROM exercises_users WHERE user_id=? AND exercise_id=?\", [user_id, exercise_id])\n puts \"You last did #{results[0][1]} reps of #{exercise} at #{results[0][2]} pounds\"\nend",
"def generate_dummy_data_for_presentation(pt1,user)\n\n#generate the exercises:\n# For the legs session type\n legs1 = Exercise.new(\"Full Squat\", \"Legs\", true, 10, 5, 1.2,4,3) \n legs2 = Exercise.new(\"Barbell Lunge\", \"Legs\", false, 15, 5, 1.1,4,2) \n legs3 = Exercise.new(\"Deadlift\", \"Legs\", true, 15, 5, 1.3,2,4) \n legs4 = Exercise.new(\"Leg Press\", \"Legs\", false, 20, 5, 1.25,6,5) \n legs5 = Exercise.new(\"Ham String Curl\", \"Legs\", true, 12, 5, 1.15,4,4) \n # For the Biceps, Triceps, Forearms and Abs (aka BTFA) session type \n btfa1 = Exercise.new(\"Bicep Curls\", \"BTFA\",true, 10, 5, 1.2,4,3) \n btfa2 = Exercise.new(\"Shoulder Press\", \"BTFA\", false, 10, 5, 1.2,4,3) \n btfa3 = Exercise.new(\"Bench Press\", \"BTFA\", true, 10, 5, 1.2,4,3) \n btfa4 = Exercise.new(\"Triceps Extension\", \"BTFA\", false, 10, 5, 1.2,4,3) \n btfa5 = Exercise.new(\"Sit Up\", \"BTFA\", true, 10, 5, 1.2,4,3) \n # For the Shoulders and Traps session type\n shoulders_traps1 = Exercise.new(\"Dumbell Shoulder Press\", \"Shoulders and Traps\",true, 10, 5, 1.2,4,3) \n shoulders_traps2 = Exercise.new(\"Upright Barbell Row\", \"Shoulders and Traps\", false, 10, 5, 1.2,4,3) \n shoulders_traps3 = Exercise.new(\"Seated Bent-over Rear Delt Raise\", \"Shoulders and Traps\", true, 10, 5, 1.2,4,3) \n shoulders_traps4 = Exercise.new(\"Side Lateral Raise\", \"Shoulders and Traps\", false, 10, 5, 1.2,4,3) \n shoulders_traps5 = Exercise.new(\"Barbell Shrug\", \"Shoulders and Traps\", true, 10, 5, 1.2,4,3) \n # For the Back session type\n back1 = Exercise.new(\"Barbell Deadlift\", \"Back\", true, 10, 5, 1.2,4,3) \n back2 = Exercise.new(\"Wide-Grip Pull Up\", \"Back\", false, 10, 5, 1.2,4,3) \n back3 = Exercise.new(\"Bent-Over Barbell Deadlift\", \"Back\", true, 10, 5, 1.2,4,3) \n back4 = Exercise.new(\"Standing T-Bar Row\", \"Back\", false, 10, 5, 1.2,4,3) \n # For the Chest session type\n chest1 = Exercise.new(\"Barbell Bench Press\", \"Chest\", true, 10, 5, 1.2,4,3) \n chest2 = Exercise.new(\"Flat Bench Dumbbell Press\", \"Chest\", false, 10, 5, 1.2,4,3) \n chest3 = Exercise.new(\"Seated Machine Chest Press\", \"Chest\", true, 10, 5, 1.2,4,3) \n chest4 = Exercise.new(\"Incline Dumbbell Press\", \"Chest\", false, 10, 5, 1.2,4,3) \n chest5 = Exercise.new(\"Machine Decline Press\", \"Chest\", true, 10, 5, 1.2,4,3) \n\n# add exercises to the PT object so that it's aware of them\n pt1.add_exercises(legs1)\n pt1.add_exercises(legs2)\n pt1.add_exercises(legs3)\n pt1.add_exercises(legs4)\n pt1.add_exercises(legs5)\n pt1.add_exercises(btfa1)\n pt1.add_exercises(btfa2)\n pt1.add_exercises(btfa3)\n pt1.add_exercises(btfa4)\n pt1.add_exercises(btfa5)\n pt1.add_exercises(shoulders_traps1)\n pt1.add_exercises(shoulders_traps2)\n pt1.add_exercises(shoulders_traps3)\n pt1.add_exercises(shoulders_traps4)\n pt1.add_exercises(shoulders_traps5)\n pt1.add_exercises(back1)\n pt1.add_exercises(back2)\n pt1.add_exercises(back3)\n pt1.add_exercises(back4)\n pt1.add_exercises(chest1)\n pt1.add_exercises(chest2)\n pt1.add_exercises(chest3)\n pt1.add_exercises(chest4)\n pt1.add_exercises(chest5)\n\n\n # establish id for user\n user.username = \"jim\"\n user.password = \"password\"\n user.first_name = \"Jimmy\"\n user.last_name = \"Coder\"\n user.gender = \"Male\"\n user.body_type = \"Mesomorph\"\n user.goal = \"musclebuild\"\n user.disclaimer = \"accept\"\n user.date_of_birth = Date.new(1990,9,9)\n # binding.pry\n user.weight = 56\n user.goal_weight = 75\n\n#establish some dummy workout history for our user:\n # (weight, completed_reps, exercise_performed, duration, date, session_number, session_type)\n workout_history_for_user = ExerciseInput.new(10, 8, chest1.name, 10, Date.new(2017,8,1), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(10, 9, chest1.name, 10, Date.new(2017,8,1), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(10, 10, chest1.name, 10, Date.new(2017,8,1), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(10, 11, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 9, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 9, chest1.name, 10, Date.new(2017,8,2), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,3), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,4), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 5, chest1.name, 10, Date.new(2017,8,5), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(15, 8, chest1.name, 10, Date.new(2017,8,6), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(20, 8, chest1.name, 10, Date.new(2017,8,7), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(20, 10, chest1.name, 10, Date.new(2017,8,8), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 7, chest1.name, 10, Date.new(2017,8,9), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 8, chest1.name, 10, Date.new(2017,8,10), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 9, chest1.name, 10, Date.new(2017,8,11), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n workout_history_for_user = ExerciseInput.new(25, 10, chest1.name, 10, Date.new(2017,8,12), 1, chest1.session_type)\n user.add_completed_session(workout_history_for_user)\n #\n\n\nend",
"def employees\n self.employee_examination_sessions.map(&:employee)\n end",
"def index\n @program_exms = ProgramExm.all\n end",
"def index\n @experiments = list_public\n begin\n @experiments_by_user = current_user.experiments\n rescue Exception\n # seems we dont have a session\n end\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @experiments }\n end\n end",
"def index\n if current_employee.user_role == 'employee'\n @exams = Exam.eager_load(team: :team_members).where(\"team_members.employee_id = ?\", current_employee.id)\n else\n @exams = Exam.all\n end\n end",
"def all_assignments(user)\n team = user.teams.where(\"school_id = ? and coreteam = ?\",user.school,true).first\n if team\n assignments = self.assignments.includes([:duedates]).where( \"team_id = ?\",team).order(\"duedates.duedate ASC\")\n end\n end",
"def programmes\n Programme.where(id: programme_id)\n end",
"def programmes\n Programme.where(id: programme_id)\n end",
"def index\n @employee_tasks = current_user.employee_tasks.all\n end",
"def ordre_exercices\n return [] if data_exercices.nil?\n data_exercices[:ordre] || []\n end",
"def my_absences\n @absences = AttendanceRecord.get_absences(current_user)\n end",
"def index\n @performed_exercises = PerformedExercise.all.order(done_on: :desc)\n end",
"def index\n @personal_tasks = PersonalTask.all_personal_tasks(session[:userid])\n @complete = PersonalTask.all_complete_personal_tasks(session[:userid])\n @incomplete = PersonalTask.all_incomplete_personal_tasks(session[:userid])\n end",
"def get_user_enrollments(user_id)\n request = Net::HTTP::Get.new(\n \"/api/v1/users/#{user_id}/enrollments?access_token=#{Rails.application.secrets.canvas_access_token}\"\n )\n response = open_canvas_http.request(request)\n info = get_all_from_pagination(response)\n\n info\n end",
"def index\n @users = User.all\n \n \n @employees = Employee.all\n @eadmin_tasks = EadminTask.all\n @eadmin_tasks = current_user.eadmin_tasks\n\n\n \n end",
"def student_assignment_by_teacher(student_user) \n puts \"Please select a command:\".colorize(:light_blue), \"1: Select a teacher\".colorize(:cyan), \"2: Return to Main Menu\".colorize(:cyan), \"3: Exit\".colorize(:cyan)\n self.line_break\n input = gets.chomp\n until input == \"1\" || input == \"2\" || input == \"3\"\n puts \"Invalid response. Please select a command:\".colorize(:yellow), \"1: View Assignments by Teacher\".colorize(:cyan), \"2: Return to Main Menu\".colorize(:cyan), \"3: Exit\".colorize(:cyan) \n input = gets.chomp\n end\n if input == \"1\"\n self.assignment_by_teacher(student_user)\n elsif input == \"2\"\n self.student_tasks(student_user)\n elsif input == \"3\"\n puts \"Have a great day!\".colorize(:light_green)\n end\n end",
"def index\n if current_user.admin?\n @exams = Exam.all\n else\n professional_list = Exam.where(user: @list).pluck(:id)\n user_list = Exam.where(user: current_user).pluck(:id)\n @exams = Exam.where(id: [professional_list, user_list].flatten)\n end\n end",
"def index\n @user_steps = UserStep.all\n end",
"def index\n @user_challenges = UserChallenge.all\n end",
"def index\n @answers = eager_answer.joins(:userpoll).where(userpolls: {user_id: current_user.id})\n end",
"def index\n redirect_to assignment_path(@assignment) unless current_user.teacher? || @assignment.past_due?\n if current_user.student?\n @group = @assignment.user_assignments.find_by(user_id: current_user).group\n end\n @essays = @assignment.essays\n end",
"def index\n\t\tauth_producer\n\t\t@cohorts = @current_user.cohorts\n\tend",
"def show\n @projects = @dataset.experiments.collect { |experiment| experiment.project }.uniq\n end",
"def completed_tests()\n test_array = []\n self.problems.each do |problem|\n problem.tests.each do |test|\n test_array.push(test)\n end\n end\n test_array\n end",
"def browse\n todaydate = Time.now.in_time_zone(\"US/Pacific\").to_date\n now = Time.now\n\n # grab upcoming contests that user can enter.\n @contests = Contest.in_range(current_user, todaydate, todaydate+1).eligible(current_user, now)\n \n # for realtime push testing: show fake contests only when user is admin\n if current_user.try(:admin)\n @contests += Contest.where(\"contest_start > ?\", Date.strptime(\"2030\",\"%Y\"))\n end\n\n end",
"def index\n @contests = current_user.contests\n end",
"def programmes\n [programme].compact\n end",
"def participants\n expose Challenge.participants(@oauth_token, params[:challenge_id].strip)\n end",
"def lignes_exercices\n @lignes_exercices ||= File.read(fingerings_path).split(\"\\n\")\n end",
"def getMEELeadActivities\n users = User.all.pluck(:id)\n activities = []\n users.each do |id|\n username = User.find(id).display_name\n #create list of [[user, [their activities...]]...]\n activities.push([username, Activity.where(user_id: id)]) \n end\n return activities \n end",
"def interviewer_tasks\n tasks.find(:all, :conditions => { :context => 'interviewers', :show_for_context_object_tasks => true })\n end",
"def get_exam_section_questions(user_id, course_id, exam_id, section_id)\r\n relative_url = Path::USERS_COURSES_EXAMS_SECTIONS_QUESTIONS % [user_id,\r\n course_id, exam_id, section_id]\r\n response = get(relative_url)\r\n if !response.error?\r\n json_obj = JSON::parse(response.content)\r\n questions = json_obj['questions'] || []\r\n section_questions = []\r\n questions.each do |question|\r\n question_type = question['type']\r\n question_id = question['id']\r\n question_response = get_exam_section_question(user_id, course_id,\r\n exam_id, section_id,\r\n question_type, question_id)\r\n return question_response if question_response.error?\r\n\r\n section_question = JSON.parse(question_response.content)\r\n\t\t section_question['id'] = question_id\r\n section_question['type'] = question_type\t\t \r\n\t\t section_question['pointsPossible'] = question['pointsPossible']\r\n section_questions << section_question\r\n end\r\n\r\n response.content = { 'questions' => section_questions }.to_json\r\n end\r\n\r\n response\r\n end",
"def get_user_enrollments(user_id)\n open_canvas_http\n\n request = Net::HTTP::Get.new(\n \"/api/v1/users/#{user_id}/enrollments?access_token=#{Rails.application.secrets.canvas_access_token}\"\n )\n response = @canvas_http.request(request)\n info = JSON.parse response.body\n\n info\n end",
"def visible_sections(user)\n user.filter_sections(sections).select { |s| s.lecture.visible_for_user?(user) }\n end",
"def show\n @projects = @setting.experiments.collect { |experiment| experiment.project }.uniq\n end",
"def index\n @api_v1_user_to_progresses = Api::V1::UserToProgress.all\n end",
"def all_priors()\n #self.bracketgrouping.bracketcontests.bracketcontestants\n #Bracketcontestant.where(bracketgrouping: self.bracketgrouping).select{|bc|bc.priorcontest().id()==self.id()}.collect{|bc|bc.priorcontest()}\n self.bcadvancements.collect {|bcadv| bcadv.bracketcontestant}\n end",
"def contests()\n\t\tself.as_contestants.collect{|c| c.contest }\n\tend",
"def index\n if params[:user_id] and user_in_organizer_committee?\n @user = User.find(params[:user_id])\n else\n @user = current_user\n end\n @presentations = @user.presentations.includes(:tags, authors: :user, conference_session: [organizers: :user]).all\n end",
"def index\n @groups = current_user.groups\n @contests = Contest.entered_by_user(current_user.id)\n @contests_explore = Contest.not_entered_by_user(current_user.id).order('created_at desc')\n render 'index'\n end",
"def user_assignments\n harvest_client.user_assignments(project_id: self.id)\n end",
"def find_user_modules(username)\n module_array = []\n modules = PuppetForge::Module.where(owner: username) # The object will be used to return all user module data\n modules.unpaginated.map do | mod | # unpaginated results allow us to work with all module data on a single page\n username = mod.owner.username \n name = mod.name # The data retrieved from the methods are collected in each parameter\n downloads = mod.downloads # each method are related to parameters retrieved from the Forge API \n module_array << {\n name: name,\n downloads: downloads,\n username: username\n }\n end\n # binding.pry\n return module_array\nend",
"def show\n @exercises = @programme.exercises\n if params[:search]\n @search = Exercise.search do\n fulltext params[:search]\n end\n @exSearch = @search.results\n else\n @exSearch = Exercise.all\n end\n end"
] |
[
"0.62693167",
"0.5825106",
"0.5666747",
"0.5660282",
"0.5629161",
"0.55948055",
"0.553738",
"0.5506217",
"0.54563826",
"0.5438358",
"0.54136205",
"0.5322686",
"0.5318455",
"0.5294175",
"0.52817625",
"0.52794385",
"0.52567387",
"0.5256051",
"0.5254691",
"0.5232709",
"0.51732856",
"0.5111119",
"0.5108511",
"0.50280637",
"0.5012965",
"0.5007572",
"0.49993917",
"0.4988962",
"0.4984005",
"0.4969837",
"0.49593842",
"0.49397394",
"0.4931644",
"0.49129108",
"0.48909652",
"0.48657733",
"0.48482645",
"0.4847872",
"0.4839469",
"0.4811565",
"0.48029667",
"0.48025087",
"0.4801451",
"0.47926858",
"0.47860733",
"0.47846365",
"0.47680163",
"0.47641644",
"0.47632563",
"0.47627127",
"0.4750506",
"0.4746106",
"0.47304034",
"0.47221434",
"0.47168177",
"0.4714101",
"0.47140354",
"0.47047666",
"0.46958378",
"0.46850714",
"0.4684905",
"0.46817103",
"0.46815762",
"0.4673119",
"0.4673119",
"0.46676952",
"0.4652122",
"0.4649046",
"0.46421683",
"0.46313024",
"0.4630579",
"0.4617894",
"0.46164227",
"0.4615889",
"0.46146086",
"0.46141163",
"0.46119073",
"0.46072525",
"0.46027005",
"0.4596203",
"0.45961037",
"0.45960206",
"0.45885554",
"0.45802024",
"0.45785683",
"0.45685825",
"0.4553545",
"0.45530438",
"0.45504636",
"0.45499635",
"0.4549382",
"0.45484397",
"0.45467108",
"0.45450878",
"0.45396528",
"0.4539629",
"0.45395073",
"0.45351386",
"0.45349815",
"0.45320722"
] |
0.79263496
|
0
|
GET /volunteer_jobs GET /volunteer_jobs.json
|
def index
@volunteer_jobs = VolunteerJob.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @volunteer_jobs }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @volunteer_job = VolunteerJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volunteer_job }\n end\n end",
"def index\n @jobs = current_user.jobs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def index\n \n @meeting_threads = @current_user.available_jobs\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meeting_threads }\n end\n end",
"def new\n @volunteer_job = VolunteerJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @volunteer_job }\n end\n end",
"def index\n @jobs = Job.all\n\n render json: @jobs\n end",
"def index\n @jobs = Job.all\n render json: @jobs\n end",
"def index \n @jobs = Job.all.find_all{ |job| job.user_id == current_user.user_id }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def index\n @job_items = @job.job_items.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_items }\n end\n end",
"def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @launched_job }\n end\n end",
"def index\n @jobs = Job.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def index\n #@jobs = Job.all\n @jobs = Job.all(:order => 'updated_at DESC')\n #@jobs = @user.jobs.all(:order => 'updated_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def index\n self.limit\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def show\n render json: @job\n end",
"def show\n render json: @job\n end",
"def jobs\n\t\t@jobs = Job.where(user_id: @company.user_id)\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend",
"def listjobs(project=self.project)\n get('listjobs.json', project: project).reject{|k,v| k=='status'}\n end",
"def list_jobs\n jobs = if unsafe_params[:editable]\n Job.editable_by(@context).accessible_by_private\n else\n Job.accessible_by(@context)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n jobs = jobs.where(scope: unsafe_params[:scopes])\n end\n\n if unsafe_params[:space_uid].present?\n jobs = jobs.terminal\n end\n\n result = jobs.eager_load(user: :org).order(id: :desc).map do |job|\n describe_for_api(job, unsafe_params[:describe])\n end\n\n render json: result\n end",
"def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end",
"def index\n render json: {:jobs => Job.where('branch_id = ?', current_user.branch_id).order(id: :desc),\n :branch_id => current_user.branch_id }\n end",
"def show\n @user = User.find(params[:id])\n @jobs = @user.jobs\n end",
"def show\n @employing_unit = EmployingUnit.find(params[:id])\n @job=Job.new\n @jobs=@employing_unit.jobs\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employing_unit }\n end\n end",
"def show\n @job = @user.jobs.find_by_id!(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render_for_api :checkins_with_job, json: @job, root: :job }\n end\n end",
"def create\n @volunteer_job = VolunteerJob.new(params[:volunteer_job])\n\n respond_to do |format|\n if @volunteer_job.save\n format.html { redirect_to @volunteer_job, notice: 'Volunteer job was successfully created.' }\n format.json { render json: @volunteer_job, status: :created, location: @volunteer_job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @volunteer_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @training_active_jobs = Training::ActiveJob.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @training_active_jobs }\n end\n end",
"def show\n user = User.find(params[:id])\n # render json: {status: 'SUCCESS', message: 'Loaded jobs For user', data:user['id']},status: :ok\n\n if user && user['role'] == 'jobSeeker'\n userId = user['id']\n jobs = Applied.find_by(user_id: params[:id])\n jobname = Job.find(jobs[\"job_id\"])\n render json: {status: 'SUCCESS', message: 'Job for user', data:jobname},status: :ok\n\n else\n render json: {status: 'Error', message: 'Can not find jobs for user', data:jobs.error},status: :unprocessable_entity\n end\n end",
"def index\n @volunteers = Volunteer.order(:name).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @name }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job }\n end\n end",
"def jobs(opts = {})\n api(\n @client.list_jobs(\n @project_id,\n deep_symbolize_keys(opts)\n )\n )\n end",
"def index\n #@jobs = Job.all\n smart_listing_create :jobs, current_user.employer.jobs, partial: \"partials/bidding_job_listing\"\n end",
"def destroy\n @volunteer_job = VolunteerJob.find(params[:id])\n @volunteer_job.destroy\n\n respond_to do |format|\n format.html { redirect_to volunteer_jobs_url }\n format.json { head :ok }\n end\n end",
"def job\n fetch('games.final_fantasy_xiv.jobs')\n end",
"def index\n jobs = Job.all.map do |job|\n { title: job.title, timerange: job.timerange }\n end\n \n render json: { results: jobs }.to_json, status: :ok\n end",
"def index\n respond_to do |format|\n format.html \n format.js { render :partial => 'list', :locals => { :jobs => Job.get_jobs(current_user, params) } }\n format.xml { render :xml => Job.get_jobs(current_user, params.merge({:show => 'all'})) }\n end\n end",
"def index\n if pmg_super? || admin?\n @jobs = Job.paginate :per_page => 15, :include => [:versions, :client],\n :page => params[:page], \n :order => sort_order('created_at')\n\n elsif pmg_user?\n @jobs = Job.paginate :per_page => 15, :page => params[:page],\n :include => [:versions, :client],\n :conditions => ['client_id IN (?)', current_user.clients.map{|x| x.id}],\n :order => sort_order('job_name')\n\n elsif client_su?\n @jobs = Job.paginate :per_page => 15, :page => params[:page],\n :include => [:versions, :client],\n :conditions => ['client_id IN (?)', current_user.employer.subclients.map{|x| x.id}],\n :order => sort_order('job_name')\n\n elsif client?\n @jobs = Job.paginate :per_page => 15, :page => params[:page],\n :include => [:versions, :client],\n :conditions => ['client_id = ?', current_user.client_id],\n :order => sort_order('job_name')\n\n end\n \n # error messages\n if current_user.level == :admin\n @messages = Message.find(:all, :order => \"updated_at desc\")\n end\n \n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @jobs.to_xml }\n end\n end",
"def index\n @jobs = current_user.works\n end",
"def possible_jobs\n \n\n job = params[:job].titleize\n location = params[:location].titleize\n\n results = Cb.job.search({ location: location,\n keywords: job })\n jobs = results.model.jobs\n @job_data = {\n job: job,\n location: location,\n job_results: jobs\n }\n end",
"def new\n @jobs = Job.new(params[:accepted_jobs])\n\n @jobs.user_id = current_user.id\n\n pp @jobs\n\n # respond_to do |format|\n # if @jobs.save\n # format.html { redirect_to home_path, notice: 'Request was successfully created.' }\n # format.json { render json: @jobs, status: :created, location: home_path }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @jobs.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def jobfamily\n @jobfamilies = @company.jobfamilies\n respond_to do |format|\n format.json { render json: @jobfamilies}\n end\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def index\n @jobs = Job.all\n end",
"def show\n @jobber = Jobber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jobber }\n end\n end",
"def index #method for index.html.erb\n @jobs = Job.all#fetch all jobs from controllers/jobs.rb\n #@jobs = Job.where :approve => true#fetch jobs that the admin approved from controllers/jobs.rb\n end",
"def index\n @jobs = PeriodicJob.list params[:page], current_user.row_limit\n end",
"def public_api_get_jobs(modified, api_key, opts = {})\n data, _status_code, _headers = public_api_get_jobs_with_http_info(modified, api_key, opts)\n return data\n end",
"def show\n @job = Job.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json {\n render :json => @job,\n :methods => [:status_name, :percentage, :total, :completed, :error, :ended?]\n }\n end\n end",
"def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n p 'Get jobs'\n p response\nend",
"def index\n @job = Job.filter(params.slice(:sector_id, :category_id, :job_title)).order('created_at desc')\n render json: @job\n end",
"def index\n @jobs = Job.paginate :page => params[:page], :order => 'created_at DESC', :per_page =>10\n @job = Job.find(:last)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n format.json { render :json => @jobs }\n end\n end",
"def index\n @volunteers = Volunteer.all\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def index\n @jobtimes = current_company.jobtimes.find_all_by_job_id(params[:job_id])\n respond_to do |format|\n format.xml {render :xml => @jobtimes }\n format.json { render :json => @jobtimes }\n end\n end",
"def employer_home\n show_my_jobs = params['show_my_jobs'].present? ? ActiveRecord::Type::Boolean.new.cast(params['show_my_jobs']) : true\n show_my_closed_jobs = params['show_my_closed_jobs'].present? ? ActiveRecord::Type::Boolean.new.cast(params['show_my_closed_jobs']) : false\n respond_to do |format|\n format.html\n format.json do\n result = EmployerJobsService.new(current_user, params, own_jobs: show_my_jobs, closed_jobs: show_my_closed_jobs)\n result.call\n render json: result.jobs_data\n end\n end\n end",
"def index\n if current_user.admin?\n @new = JobApplication.where(state: @state)\n @vacancies = Vacancy.all\n else\n @job_assignments = JobAssignment.where(manager_id: current_user.id, reviewed: false)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.js\n end\n end",
"def index\n @jobs = Job.by_department.paginate(:page => params[:page], :per_page => current_user.preferred_items_per_page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end",
"def index\n @job_folios = JobFolio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_folios }\n end\n end",
"def find_jobs(params:)\n response = HTTParty.get(\"#{@host}/api/jobs\", query: params)\n\n return response[\"jobs\"] \n end",
"def show\n @job_item = @job.job_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_item }\n end\n end",
"def get_job_templates\n dprint \"get /api/v1/job_templates\"\n resp = @rest['/api/v1/job_templates'].get\n dprint resp\n # ruby's implicit return\n JSON.parse(resp)[\"results\"]\n end",
"def index\n @jobs = Job.all\n render :index\n end",
"def show\n @volunteer_task = VolunteerTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volunteer_task }\n end\n end",
"def user_jobs\r\n @selected_user = User.find(params[:user])\r\n jobs = filter_user_jobs(params[:user], params[:hours])\r\n @job_pages, @jobs = paginate_collection jobs, :per_page => 50, :page => params[:page]\r\n end",
"def index\n \t@jobs = Job.all\n \t# if i wanted to find all of my jobs\n \t# @jobs = current_user.jobs.all\n end",
"def index\n @jobs = Job.all\n end",
"def jobs\n\t\t# ...\n\tend",
"def index\n @distance = 3\n listers = Adult.near(current_user.lat_long, @distance, units: :km)\n @jobs = listers.map(&:jobs).flatten.uniq\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobs }\n end\n end",
"def show\n @saved_jobs = SavedJob.where(:user_id => current_user.id).order(\"created_at DESC\")\n\n @saved_job = SavedJob.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @saved_job }\n end\n end",
"def show\n @emp_job = EmpJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_job }\n end\n end",
"def index\n per_page = params[:per_page] ||= PER_PAGE\n @jobs = Job.paginate :page => params[:page],\n :per_page => params[:per_page],\n :order=>'created_at DESC'\n respond_to do |format|\n format.html # index.html.erb\n format.xml {render :xml => @jobs} \n format.json {render :json => @jobs}\n end\n end",
"def list_jobs(username, password, uuid = nil)\n jobs = get_json('jobs.json', username, password)\n puts \"\"\n jobs[\"jobs\"].each do |job|\n next if uuid && job['uuid'] != uuid\n if job['jobURL']\n job.merge!(get_json(job['jobURL'], username, password, ''))\n end\n puts summarise_job(job, 2)\n puts \"\"\n end\n del = jobs['delivered']\n puts \"#{del['jobCount']} jobs, #{del['activityCount']} activities delivered since #{del['since']}\"\nend",
"def show\n #@job_application = JobApplication.find(params[:id])\n\n #@user = User.find(params[:id])\n @job_application = current_user.job_applications #.page(params[:page]).per_page(10)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_application }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: LaunchedJobDatatable.new(view_context, min_start_date: params[:min_start_date]) }\n end\n end",
"def index\n @inventories = current_company.inventories.find_all_by_job_id(params[:job_id])\n respond_to do |format|\n format.xml{ render :xml => @inventories }\n format.json{ render :json => @inventories }\n end\n end",
"def index\n @pricings = @job.pricings\n end",
"def index\n @job_requests = JobRequest.all\n end",
"def show\n @location = Location.find(params[:id])\n @jobs = @location.jobs\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end",
"def show\n @job_title = JobTitle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_title }\n end\n end",
"def index\n @jobs = Job.all\n @paginated_jobs = @jobs.paginate(:page => params[:page], :per_page => Settings.Pagination.NoOfEntriesPerPage)\n end",
"def show\n @volunteer = Volunteer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volunteer }\n end\n end",
"def index\n @applicant_jobs = ApplicantJob.all\n end",
"def index\n @jobs = Job.all\n # @jobs = ScriptedClient::Job.all\n end",
"def index\n @anuncios = Anuncio.all.paginate(page: params[:page], per_page: 4 )\n\n respond_to do |format|\n format.html\n format.json { render json: @jobs }\n end\n end",
"def index\n @jobs = Job.page(params[:page])\n end",
"def update\n @volunteer_job = VolunteerJob.find(params[:id])\n\n respond_to do |format|\n if @volunteer_job.update_attributes(params[:volunteer_job])\n format.html { redirect_to @volunteer_job, notice: 'Volunteer job was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @volunteer_job.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @jobsearches = Jobsearch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobsearches }\n end\n end",
"def show\n @job_compact = JobCompact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_compact }\n end\n end",
"def show\n @job_folio = JobFolio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_folio }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = Job.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end"
] |
[
"0.7364898",
"0.712347",
"0.7085784",
"0.6929859",
"0.6753155",
"0.6736709",
"0.66865975",
"0.64835364",
"0.6483072",
"0.64656293",
"0.6452728",
"0.6450726",
"0.64321464",
"0.6416266",
"0.6416266",
"0.64099526",
"0.6407239",
"0.6379839",
"0.6371384",
"0.6371384",
"0.63697743",
"0.6319225",
"0.6289646",
"0.62890536",
"0.6287859",
"0.62829685",
"0.6239302",
"0.6222286",
"0.6194022",
"0.6179163",
"0.6179163",
"0.6179163",
"0.6179163",
"0.6179163",
"0.6177939",
"0.6175676",
"0.61677825",
"0.61488223",
"0.61468875",
"0.609932",
"0.6092347",
"0.6083716",
"0.606997",
"0.603679",
"0.603495",
"0.60348016",
"0.60348016",
"0.60348016",
"0.60348016",
"0.60348016",
"0.60348016",
"0.60171854",
"0.60161376",
"0.60112625",
"0.60006875",
"0.59744316",
"0.59664947",
"0.59648377",
"0.59646153",
"0.596334",
"0.5961984",
"0.59616244",
"0.59582955",
"0.5951355",
"0.5945196",
"0.5945193",
"0.5943837",
"0.5939552",
"0.5936204",
"0.59278136",
"0.5916357",
"0.59074575",
"0.5890192",
"0.58892936",
"0.5883271",
"0.5881955",
"0.58742785",
"0.5861708",
"0.5861053",
"0.5854807",
"0.5844421",
"0.5843469",
"0.58326113",
"0.5821544",
"0.5800737",
"0.58005893",
"0.5797441",
"0.5792061",
"0.5791977",
"0.57910025",
"0.577731",
"0.57752484",
"0.5771037",
"0.57689947",
"0.5750707",
"0.57502395",
"0.57465136",
"0.5739261",
"0.5739261",
"0.5739261"
] |
0.790424
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.